content_type
stringclasses
8 values
main_lang
stringclasses
7 values
message
stringlengths
1
50
sha
stringlengths
40
40
patch
stringlengths
52
962k
file_count
int64
1
300
Text
Text
add changelog entry to action pack as well
801c6f9e04033b68dd9f268a94e4317f7dde8b65
<ide><path>actionpack/CHANGELOG.md <add>* Show cache hits and misses when rendering partials. <add> <add> Partials using the `cache` helper will show whether a render hit or missed <add> the cache: <add> <add> ``` <add> Rendered messages/_message.html.erb in 1.2 ms [cache hit] <add> Rendered recordings/threads/_thread.html.erb in 1.5 ms [cache miss] <add> ``` <add> <add> This removes the need for the old fragment cache logging: <add> <add> ``` <add> Read fragment views/v1/2914079/v1/2914079/recordings/70182313-20160225015037000000/d0bdf2974e1ef6d31685c3b392ad0b74 (0.6ms) <add> Rendered messages/_message.html.erb in 1.2 ms [cache hit] <add> Write fragment views/v1/2914079/v1/2914079/recordings/70182313-20160225015037000000/3b4e249ac9d168c617e32e84b99218b5 (1.1ms) <add> Rendered recordings/threads/_thread.html.erb in 1.5 ms [cache miss] <add> ``` <add> <add> Though that full output can be reenabled with <add> `config.action_controller.enable_fragment_cache_logging = true`. <add> <add> *Stan Lo* <add> <ide> * Don't override the `Accept` header in integration tests when called with `xhr: true`. <ide> <ide> Fixes #25859.
1
Javascript
Javascript
specify function return type for handler
a903d1b86ab56163abcdcb584f335949ba0c85fc
<ide><path>Libraries/Utilities/BackHandler.android.js <ide> type TBackHandler = {| <ide> +exitApp: () => void, <ide> +addEventListener: ( <ide> eventName: BackPressEventName, <del> handler: Function, <add> handler: () => ?boolean, <ide> ) => {remove: () => void, ...}, <ide> +removeEventListener: ( <ide> eventName: BackPressEventName, <del> handler: Function, <add> handler: () => ?boolean, <ide> ) => void, <ide> |}; <ide> const BackHandler: TBackHandler = { <ide> const BackHandler: TBackHandler = { <ide> */ <ide> addEventListener: function( <ide> eventName: BackPressEventName, <del> handler: Function, <add> handler: () => ?boolean, <ide> ): {remove: () => void, ...} { <ide> if (_backPressSubscriptions.indexOf(handler) === -1) { <ide> _backPressSubscriptions.push(handler); <ide> const BackHandler: TBackHandler = { <ide> */ <ide> removeEventListener: function( <ide> eventName: BackPressEventName, <del> handler: Function, <add> handler: () => ?boolean, <ide> ): void { <ide> if (_backPressSubscriptions.indexOf(handler) !== -1) { <ide> _backPressSubscriptions.splice( <ide><path>Libraries/Utilities/BackHandler.ios.js <ide> type TBackHandler = {| <ide> +exitApp: () => void, <ide> +addEventListener: ( <ide> eventName: BackPressEventName, <del> handler: Function, <add> handler: () => ?boolean, <ide> ) => {remove: () => void, ...}, <ide> +removeEventListener: ( <ide> eventName: BackPressEventName, <del> handler: Function, <add> handler: () => ?boolean, <ide> ) => void, <ide> |}; <ide> <ide> if (Platform.isTV) { <ide> <ide> addEventListener: function( <ide> eventName: BackPressEventName, <del> handler: Function, <add> handler: () => ?boolean, <ide> ): {remove: () => void, ...} { <ide> _backPressSubscriptions.add(handler); <ide> return { <ide> if (Platform.isTV) { <ide> <ide> removeEventListener: function( <ide> eventName: BackPressEventName, <del> handler: Function, <add> handler: () => ?boolean, <ide> ): void { <ide> _backPressSubscriptions.delete(handler); <ide> }, <ide><path>Libraries/Utilities/__mocks__/BackHandler.js <ide> const BackHandler = { <ide> <ide> addEventListener: function( <ide> eventName: BackPressEventName, <del> handler: Function, <add> handler: () => ?boolean, <ide> ): {remove: () => void} { <ide> _backPressSubscriptions.add(handler); <ide> return { <ide> const BackHandler = { <ide> <ide> removeEventListener: function( <ide> eventName: BackPressEventName, <del> handler: Function, <add> handler: () => ?boolean, <ide> ): void { <ide> _backPressSubscriptions.delete(handler); <ide> },
3
Javascript
Javascript
add alltime vs. perbatch uimanager stats
340229303f7d0e4c45167d8eefa25a45a728985c
<ide><path>Libraries/ReactNative/UIManagerStatTracker.js <ide> <ide> var RCTUIManager = require('NativeModules').UIManager; <ide> <add>var performanceNow = require('performanceNow'); <add> <ide> var installed = false; <ide> var UIManagerStatTracker = { <ide> install: function() { <ide> var UIManagerStatTracker = { <ide> } <ide> installed = true; <ide> var statLogHandle; <del> var stats = {}; <add> var startTime = 0; <add> var allTimeStats = {}; <add> var perFrameStats = {}; <ide> function printStats() { <del> console.log({UIManagerStatTracker: stats}); <add> console.log({UIManagerStatTracker: { <add> allTime: allTimeStats, <add> lastFrame: perFrameStats, <add> elapsedMilliseconds: performanceNow() - startTime, <add> }}); <ide> statLogHandle = null; <add> perFrameStats = {}; <ide> } <ide> function incStat(key: string, increment: number) { <del> stats[key] = (stats[key] || 0) + increment; <add> allTimeStats[key] = (allTimeStats[key] || 0) + increment; <add> perFrameStats[key] = (perFrameStats[key] || 0) + increment; <ide> if (!statLogHandle) { <del> statLogHandle = setImmediate(printStats); <add> startTime = performanceNow(); <add> statLogHandle = window.requestAnimationFrame(printStats); <ide> } <ide> } <ide> var createViewOrig = RCTUIManager.createView;
1
Ruby
Ruby
remove useless require
3ed92c876c5cebea908f23020457bd494755f54b
<ide><path>activesupport/lib/active_support/dependencies/autoload.rb <ide> require "active_support/inflector/methods" <del>require "active_support/lazy_load_hooks" <ide> <ide> module ActiveSupport <ide> module Autoload
1
PHP
PHP
update timehelper docs
1c7985089452299b713a353fd123818e5c4501b1
<ide><path>src/View/Helper/TimeHelper.php <ide> public function isThisWeek($dateString, $timezone = null) { <ide> * <ide> * @param int|string|\DateTime $dateString UNIX timestamp, strtotime() valid string or DateTime object <ide> * @param string|\DateTimeZone $timezone User's timezone string or DateTimeZone object <del> * @return bool True if datetime string is within current month <add> * @return bool True if datetime string is within the current month <ide> * @link http://book.cakephp.org/2.0/en/core-libraries/helpers/time.html#testing-time <ide> */ <ide> public function isThisMonth($dateString, $timezone = null) { <ide> return (new Time($dateString, $timezone))->isThisMonth(); <ide> } <ide> <ide> /** <del> * Returns true if given datetime string is within current year. <add> * Returns true if given datetime string is within the current year. <ide> * <ide> * @param int|string|\DateTime $dateString UNIX timestamp, strtotime() valid string or DateTime object <ide> * @param string|\DateTimeZone $timezone User's timezone string or DateTimeZone object <ide> public function toQuarter($dateString, $range = false) { <ide> } <ide> <ide> /** <del> * Returns a UNIX timestamp from a textual datetime description. Wrapper for PHP function strtotime(). <add> * Returns a UNIX timestamp from a textual datetime description. <ide> * <ide> * @param int|string|\DateTime $dateString UNIX timestamp, strtotime() valid string or DateTime object <ide> * @param string|\DateTimeZone $timezone User's timezone string or DateTimeZone object <ide> public function toRSS($dateString, $timezone = null) { <ide> } <ide> <ide> /** <del> * Formats date for RSS feeds <add> * Formats a date into a phrase expressing the relative time. <ide> * <ide> * ## Additional options <ide> * <ide> public function wasWithinLast($timeInterval, $dateString, $timezone = null) { <ide> * @param int|string|\DateTime $dateString UNIX timestamp, strtotime() valid string or DateTime object <ide> * @param string|\DateTimeZone $timezone User's timezone string or DateTimeZone object <ide> * @return bool <del> * @see \Cake\Utility\Time::isWithinLast() <add> * @see \Cake\Utility\Time::wasWithinLast() <ide> * @link http://book.cakephp.org/2.0/en/core-libraries/helpers/time.html#testing-time <ide> */ <ide> public function isWithinNext($timeInterval, $dateString, $timezone = null) { <ide> public function gmt($string = null) { <ide> <ide> /** <ide> * Returns a formatted date string, given either a UNIX timestamp or a valid strtotime() date string. <add> * <ide> * This function also accepts a time string and a format string as first and second parameters. <ide> * In that case this function behaves as a wrapper for Time::i18nFormat() <ide> * <ide> public function format($date, $format = null, $invalid = false, $timezone = null <ide> <ide> /** <ide> * Returns a formatted date string, given either a UNIX timestamp or a valid strtotime() date string. <del> * It takes into account the default date format for the current language if a LC_TIME file is used. <add> * <add> * This method takes into account the default date format for the current language if an LC_TIME file is used. <ide> * <ide> * @param int|string|\DateTime $date UNIX timestamp, strtotime() valid string or DateTime object <ide> * @param string $format strftime format string.
1
Text
Text
update description of etag [ci skip]
0f87413f41050d6e3eacefb97a05a5d954f602d1
<ide><path>guides/source/5_0_release_notes.md <ide> Please refer to the [Changelog][action-pack] for detailed changes. <ide> `ActionDispatch::IntegrationTest` instead. <ide> ([commit](https://github.com/rails/rails/commit/4414c5d1795e815b102571425974a8b1d46d932d)) <ide> <del>* Rails will only generate "weak", instead of strong ETags. <add>* Rails generates weak ETags by default. <ide> ([Pull Request](https://github.com/rails/rails/pull/17573)) <ide> <ide> * Controller actions without an explicit `render` call and with no <ide> Please refer to the [Changelog][action-pack] for detailed changes. <ide> `ActionController::Live`. <ide> ([More details in this issue](https://github.com/rails/rails/issues/25581)) <ide> <add>* Introduce `Response#strong_etag=` and `#weak_etag=` and analogous <add> options for `fresh_when` and `stale?`. <add> ([Pull Request](https://github.com/rails/rails/pull/24387)) <ide> <ide> Action View <ide> -------------
1
PHP
PHP
touch owners on delete
46ff00d733ee72c5419702af0181d8bbd8272b38
<ide><path>src/Illuminate/Database/Eloquent/Model.php <ide> public function delete() <ide> { <ide> $this->fireModelEvent('deleting', false); <ide> <del> // After firing the "deleting" event, we can go ahead and delete off the model <del> // then call the "deleted" event. These events could give the developer the <del> // opportunity to clear any relationships on the model or do other works. <del> $key = $this->getKeyName(); <add> // Here, we'll touch the owning models, verifying these timestamps get updated <add> // for the models. This will allow any caching to get broken on the parents <add> // by the timestamp. Then we will go ahead and delete the model instance. <add> $this->touchOwners(); <ide> <del> $this->newQuery()->where($key, $this->getKey())->delete(); <add> $this->newQuery()->where($this->getKeyName(), $this->getKey())->delete(); <ide> <ide> $this->fireModelEvent('deleted', false); <ide> } <ide><path>tests/Database/DatabaseEloquentModelTest.php <ide> public function testInsertIsCancelledIfCreatingEventReturnsFalse() <ide> <ide> public function testDeleteProperlyDeletesModel() <ide> { <del> $model = $this->getMock('Illuminate\Database\Eloquent\Model', array('newQuery', 'updateTimestamps')); <add> $model = $this->getMock('Illuminate\Database\Eloquent\Model', array('newQuery', 'updateTimestamps', 'touchOwners')); <ide> $query = m::mock('stdClass'); <ide> $query->shouldReceive('where')->once()->with('id', 1)->andReturn($query); <ide> $query->shouldReceive('delete')->once(); <ide> $model->expects($this->once())->method('newQuery')->will($this->returnValue($query)); <add> $model->expects($this->once())->method('touchOwners'); <ide> $model->exists = true; <ide> $model->id = 1; <ide> $model->delete();
2
Python
Python
adapt attention masks for the decoder case
075206961700fd2359f5c5cfc86a8c18d8404406
<ide><path>transformers/modeling_bert.py <ide> def transpose_for_scores(self, x): <ide> x = x.view(*new_x_shape) <ide> return x.permute(0, 2, 1, 3) <ide> <del> def forward(self, hidden_states, attention_mask=None, head_mask=None, encoder_hidden_states=None): <add> def forward(self, hidden_states, attention_mask=None, head_mask=None, encoder_hidden_states=None, encoder_attention_mask=None): <ide> mixed_query_layer = self.query(hidden_states) <add> <ide> # if the attention Module is a encoder-decoder self attention module <add> # they keys & values are given by the encoder; the attention mask <add> # needs to be such that there is no atention on the encoder's padding tokens. <ide> if encoder_hidden_states is not None: <ide> mixed_key_layer = self.key(encoder_hidden_states) <ide> mixed_value_layer = self.value(encoder_hidden_states) <add> attention_mask = encoder_attention_mask <ide> else: <ide> mixed_key_layer = self.key(hidden_states) <ide> mixed_value_layer = self.value(hidden_states) <ide> def prune_heads(self, heads): <ide> self.self.all_head_size = self.self.attention_head_size * self.self.num_attention_heads <ide> self.pruned_heads = self.pruned_heads.union(heads) <ide> <del> def forward(self, hidden_states, attention_mask=None, head_mask=None, encoder_hidden_states=None): <del> self_outputs = self.self(hidden_states, attention_mask, head_mask, encoder_hidden_states) <add> def forward(self, hidden_states, attention_mask=None, head_mask=None, encoder_hidden_states=None, encoder_attention_mask=None): <add> self_outputs = self.self(hidden_states, attention_mask, head_mask, encoder_hidden_states, encoder_attention_mask) <ide> attention_output = self.output(self_outputs[0], hidden_states) <ide> outputs = (attention_output,) + self_outputs[1:] # add attentions if we output them <ide> return outputs <ide> def __init__(self, config): <ide> self.intermediate = BertIntermediate(config) <ide> self.output = BertOutput(config) <ide> <del> def forward(self, hidden_states, attention_mask=None, head_mask=None, encoder_hidden_state=None): <add> def forward(self, hidden_states, attention_mask=None, head_mask=None, encoder_hidden_state=None, encoder_attention_mask=None): <ide> self_attention_outputs = self.attention(hidden_states, attention_mask, head_mask) <ide> attention_output = self_attention_outputs[0] <ide> outputs = self_attention_outputs[1:] # add self attentions if we output attention weights <ide> <ide> if self.is_decoder and encoder_hidden_state is not None: <del> cross_attention_outputs = self.crossattention(attention_output, attention_mask, head_mask, encoder_hidden_state) <add> cross_attention_outputs = self.crossattention(attention_output, attention_mask, head_mask, encoder_hidden_state, encoder_attention_mask) <ide> attention_output = cross_attention_outputs[0] <ide> outputs = outputs + cross_attention_outputs[1:] # add cross attentions if we output attention weights <ide> <ide> def forward(self, hidden_states, attention_mask=None, head_mask=None, encoder_hi <ide> return outputs <ide> <ide> <add># NOTE I think we may need to call encoder_hidden_states[i] for each layer <ide> class BertEncoder(nn.Module): <ide> def __init__(self, config): <ide> super(BertEncoder, self).__init__() <ide> self.output_attentions = config.output_attentions <ide> self.output_hidden_states = config.output_hidden_states <ide> self.layer = nn.ModuleList([BertLayer(config) for _ in range(config.num_hidden_layers)]) <ide> <del> def forward(self, hidden_states, attention_mask=None, head_mask=None, encoder_hidden_states=None): <add> def forward(self, hidden_states, attention_mask=None, head_mask=None, encoder_hidden_states=None, encoder_attention_mask=None): <ide> all_hidden_states = () <ide> all_attentions = () <ide> for i, layer_module in enumerate(self.layer): <ide> if self.output_hidden_states: <ide> all_hidden_states = all_hidden_states + (hidden_states,) <ide> <del> layer_outputs = layer_module(hidden_states, attention_mask, head_mask[i], encoder_hidden_states) <add> layer_outputs = layer_module(hidden_states, attention_mask, head_mask[i], encoder_hidden_states, encoder_attention_mask) <ide> hidden_states = layer_outputs[0] <ide> <ide> if self.output_attentions: <ide> class BertModel(BertPreTrainedModel): <ide> """ <ide> def __init__(self, config): <ide> super(BertModel, self).__init__(config) <add> self.config = config <ide> <ide> self.embeddings = BertEmbeddings(config) <ide> self.encoder = BertEncoder(config) <ide> def _prune_heads(self, heads_to_prune): <ide> self.encoder.layer[layer].attention.prune_heads(heads) <ide> <ide> def forward(self, input_ids, attention_mask=None, token_type_ids=None, position_ids=None, <del> head_mask=None, encoder_hidden_state=None): <add> head_mask=None, encoder_hidden_state=None, encoder_attention_mask=None): <add> """ Forward pass on the Model. <add> <add> The model can behave as an encoder (with only self-attention) as well <add> as a decoder, in which case a layer of cross-attention is added between <add> ever self-attention layer, following the architecture described in [1]. <add> <add> To behave like as a decoder the model needs to be initialized with the <add> `is_decoder` argument of the config set to `True`. An <add> `encoder_hidden_state` is expected as an input to the forward pass. <add> When a decoder, there are two kinds of attention masks to specify: <add> <add> (1) Self-attention masks that need to be causal (only attends to <add> previous tokens); <add> (2) A cross-attention mask that prevents the module <add> from attending to the encoder' padding tokens. <add> <add> [1] Vaswani, Ashish, et al. "Attention is all you need." Advances in <add> neural information processing systems. 2017. <add> """ <ide> if attention_mask is None: <ide> attention_mask = torch.ones_like(input_ids) <ide> if token_type_ids is None: <ide> token_type_ids = torch.zeros_like(input_ids) <ide> <del> # We create a 3D attention mask from a 2D tensor mask. <del> # Sizes are [batch_size, 1, 1, to_seq_length] <del> # So we can broadcast to [batch_size, num_heads, from_seq_length, to_seq_length] <del> # this attention mask is more simple than the triangular masking of causal attention <del> # used in OpenAI GPT, we just need to prepare the broadcast dimension here. <del> extended_attention_mask = attention_mask.unsqueeze(1).unsqueeze(2) <add> # we may want to provide a mask of dimensions [batch_size, from_seq_length, to_seq_length] <add> # ourselves in which case we just make it broadcastable to all heads. <add> if attention_mask.dims() == 3: <add> extended_attention_mask = attention_mask[:, None, :, :] <add> <add> # provided a padding mask of dimensions [batch_size, seq_length] <add> # - if encoder, make it broadcastable to [batch_size, num_heads, seq_length, seq_length] <add> # - if decoder, make it causal <add> if attention_mask.dims() == 2: <add> if self.config.is_decoder: <add> batch_size, seq_length = input_ids.size() <add> seq_ids = torch.arange(seq_length) <add> causal_mask = seq_ids[None, None, :].repeat(batch_size, seq_length, 1) <= seq_ids[None, :, None] <add> extended_attention_mask = causal_mask[:, None, :, :] * attention_mask[None, None, :, :] <add> else: <add> extended_attention_mask = attention_mask[:, None, None, :] <ide> <ide> # Since attention_mask is 1.0 for positions we want to attend and 0.0 for <ide> # masked positions, this operation will create a tensor which is 0.0 for <ide> def forward(self, input_ids, attention_mask=None, token_type_ids=None, position_ <ide> encoder_outputs = self.encoder(embedding_output, <ide> attention_mask=extended_attention_mask, <ide> head_mask=head_mask, <del> encoder_hidden_state=encoder_hidden_state) <add> encoder_hidden_state=encoder_hidden_state, <add> encoder_attention_mask=encoder_attention_mask) <ide> sequence_output = encoder_outputs[0] <ide> pooled_output = self.pooler(sequence_output) <ide>
1
Python
Python
ignore dummy process
3c1485b1bc64a7f007feae5722923f1e755e7dec
<ide><path>glances/glances.py <ide> def update(self): <ide> for proc in psutil.process_iter(): <ide> try: <ide> procstat = self.__get_process_stats__(proc) <del> # Ignore the 'idle' process on Windows or Bsd <del> # Waiting upstream patch from PsUtil <add> # ignore the 'idle' process on Windows and *BSD <add> # ignore the 'kernel_task' process on OS X <add> # waiting for upstream patch from psutil <ide> if (is_Bsd and procstat['name'] == 'idle' or <del> is_Windows and procstat['name'] == 'System Idle Process'): <add> is_Windows and procstat['name'] == 'System Idle Process' or <add> is_Mac and procstat['name'] == 'kernel_task'): <ide> continue <ide> # Update processcount (global stattistics) <ide> try:
1
PHP
PHP
use non-mocked methods for tests
e04e0a0ec89ba95eaaa6dc51b1612a2909722018
<ide><path>lib/Cake/Test/Case/View/MediaViewTest.php <ide> class MediaViewTest extends CakeTestCase { <ide> public function setUp() { <ide> parent::setUp(); <ide> $this->MediaView = $this->getMock('MediaView', array('_isActive', '_clearBuffer', '_flushBuffer')); <del> $this->MediaView->response = $this->getMock('CakeResponse'); <add> $this->MediaView->response = $this->getMock( <add> 'CakeResponse', <add> array('send', 'cache', 'type', 'download', 'statusCode') <add> ); <ide> } <ide> <ide> /** <ide> public function testRender() { <ide> ->with('css') <ide> ->will($this->returnArgument(0)); <ide> <del> $this->MediaView->response->expects($this->at(1)) <del> ->method('header') <del> ->with(array( <del> 'Date' => gmdate('D, d M Y H:i:s', time()) . ' GMT', <del> 'Expires' => '0', <del> 'Cache-Control' => 'private, must-revalidate, post-check=0, pre-check=0', <del> 'Pragma' => 'no-cache' <del> )); <del> <del> $this->MediaView->response->expects($this->at(2)) <del> ->method('header') <del> ->with(array( <del> 'Content-Length' => 31 <del> )); <ide> $this->MediaView->response->expects($this->once())->method('send'); <ide> $this->MediaView->expects($this->once())->method('_clearBuffer'); <ide> $this->MediaView->expects($this->once())->method('_flushBuffer'); <ide> public function testRender() { <ide> $output = ob_get_clean(); <ide> $this->assertEquals('this is the test asset css file', $output); <ide> $this->assertTrue($result !== false); <add> <add> $headers = $this->MediaView->response->header(); <add> $this->assertEquals(31, $headers['Content-Length']); <add> $this->assertEquals(0, $headers['Expires']); <add> $this->assertEquals( <add> 'private, must-revalidate, post-check=0, pre-check=0', <add> $headers['Cache-Control'] <add> ); <add> $this->assertEquals('no-cache', $headers['Pragma']); <add> $this->assertContains(gmdate('D, d M Y H:i', time()), $headers['Date']); <ide> } <ide> <ide> /** <ide> public function testRenderWithUnknownFileTypeGeneric() { <ide> ->with('ini') <ide> ->will($this->returnValue(false)); <ide> <del> $this->MediaView->response->expects($this->at(1)) <del> ->method('header') <del> ->with($this->logicalAnd( <del> $this->arrayHasKey('Date'), <del> $this->arrayHasKey('Expires'), <del> $this->arrayHasKey('Cache-Control'), <del> $this->arrayHasKey('Pragma'), <del> $this->contains('0'), <del> $this->contains('private, must-revalidate, post-check=0, pre-check=0'), <del> $this->contains('no-cache') <del> )); <del> <ide> $this->MediaView->response->expects($this->once()) <ide> ->method('download') <ide> ->with('no_section.ini'); <ide> <del> $this->MediaView->response->expects($this->at(3)) <del> ->method('header') <del> ->with(array( <del> 'Accept-Ranges' => 'bytes' <del> )); <del> <del> $this->MediaView->response->expects($this->at(4)) <del> ->method('header') <del> ->with('Content-Length', 35); <del> <ide> $this->MediaView->response->expects($this->once())->method('send'); <ide> $this->MediaView->expects($this->once())->method('_clearBuffer'); <ide> $this->MediaView->expects($this->once())->method('_flushBuffer'); <ide> public function testRenderWithUnknownFileTypeGeneric() { <ide> if ($currentUserAgent !== null) { <ide> $_SERVER['HTTP_USER_AGENT'] = $currentUserAgent; <ide> } <add> <add> $headers = $this->MediaView->response->header(); <add> $this->assertEquals(35, $headers['Content-Length']); <add> $this->assertEquals(0, $headers['Expires']); <add> $this->assertEquals('bytes', $headers['Accept-Ranges']); <add> $this->assertEquals( <add> 'private, must-revalidate, post-check=0, pre-check=0', <add> $headers['Cache-Control'] <add> ); <add> $this->assertEquals('no-cache', $headers['Pragma']); <add> $this->assertContains(gmdate('D, d M Y H:i', time()), $headers['Date']); <ide> } <ide> <ide> /** <ide> public function testRenderWithUnknownFileTypeOpera() { <ide> ->will($this->returnValue(false)); <ide> <ide> $this->MediaView->response->expects($this->at(1)) <del> ->method('header') <del> ->with(array( <del> 'Date' => gmdate('D, d M Y H:i:s', time()) . ' GMT', <del> 'Expires' => '0', <del> 'Cache-Control' => 'private, must-revalidate, post-check=0, pre-check=0', <del> 'Pragma' => 'no-cache' <del> )); <del> <del> $this->MediaView->response->expects($this->at(2)) <ide> ->method('type') <ide> ->with('application/octetstream') <ide> ->will($this->returnValue(false)); <ide> public function testRenderWithUnknownFileTypeOpera() { <ide> ->method('download') <ide> ->with('no_section.ini'); <ide> <del> $this->MediaView->response->expects($this->at(4)) <del> ->method('header') <del> ->with(array( <del> 'Accept-Ranges' => 'bytes' <del> )); <del> <del> $this->MediaView->response->expects($this->at(5)) <del> ->method('header') <del> ->with('Content-Length', 35); <del> <ide> $this->MediaView->response->expects($this->once())->method('send'); <ide> $this->MediaView->expects($this->once())->method('_clearBuffer'); <ide> $this->MediaView->expects($this->once())->method('_flushBuffer'); <ide> public function testRenderWithUnknownFileTypeOpera() { <ide> if ($currentUserAgent !== null) { <ide> $_SERVER['HTTP_USER_AGENT'] = $currentUserAgent; <ide> } <add> <add> $headers = $this->MediaView->response->header(); <add> $this->assertEquals(35, $headers['Content-Length']); <add> $this->assertEquals(0, $headers['Expires']); <add> $this->assertEquals('bytes', $headers['Accept-Ranges']); <add> $this->assertEquals( <add> 'private, must-revalidate, post-check=0, pre-check=0', <add> $headers['Cache-Control'] <add> ); <add> $this->assertEquals('no-cache', $headers['Pragma']); <add> $this->assertContains(gmdate('D, d M Y H:i', time()), $headers['Date']); <ide> } <ide> <ide> /** <ide> public function testRenderWithUnknownFileTypeIE() { <ide> ->will($this->returnValue(false)); <ide> <ide> $this->MediaView->response->expects($this->at(1)) <del> ->method('header') <del> ->with(array( <del> 'Date' => gmdate('D, d M Y H:i:s', time()) . ' GMT', <del> 'Expires' => '0', <del> 'Cache-Control' => 'private, must-revalidate, post-check=0, pre-check=0', <del> 'Pragma' => 'no-cache' <del> )); <del> <del> $this->MediaView->response->expects($this->at(2)) <ide> ->method('type') <ide> ->with('application/force-download') <ide> ->will($this->returnValue(false)); <ide> public function testRenderWithUnknownFileTypeIE() { <ide> ->method('download') <ide> ->with('config.ini'); <ide> <del> $this->MediaView->response->expects($this->at(4)) <del> ->method('header') <del> ->with(array( <del> 'Accept-Ranges' => 'bytes' <del> )); <del> <del> $this->MediaView->response->expects($this->at(5)) <del> ->method('header') <del> ->with('Content-Length', 35); <del> <ide> $this->MediaView->response->expects($this->once())->method('send'); <ide> $this->MediaView->expects($this->once())->method('_clearBuffer'); <ide> $this->MediaView->expects($this->once())->method('_flushBuffer'); <ide> public function testRenderWithUnknownFileTypeIE() { <ide> if ($currentUserAgent !== null) { <ide> $_SERVER['HTTP_USER_AGENT'] = $currentUserAgent; <ide> } <add> <add> $headers = $this->MediaView->response->header(); <add> $this->assertEquals(35, $headers['Content-Length']); <add> $this->assertEquals(0, $headers['Expires']); <add> $this->assertEquals('bytes', $headers['Accept-Ranges']); <add> $this->assertEquals( <add> 'private, must-revalidate, post-check=0, pre-check=0', <add> $headers['Cache-Control'] <add> ); <add> $this->assertEquals('no-cache', $headers['Pragma']); <add> $this->assertContains(gmdate('D, d M Y H:i', time()), $headers['Date']); <ide> } <ide> <ide> /**
1
PHP
PHP
provide immediate access to set cookies
374f72f5e51c13cf375d64d5ddd46c9dc37ad23d
<ide><path>laravel/cookie.php <ide> public static function put($name, $value, $minutes = 0, $path = '/', $domain = n <ide> { <ide> if (headers_sent()) return false; <ide> <del> if ($minutes < 0) unset($_COOKIE[$name]); <add> if ($minutes < 0) <add> { <add> unset($_COOKIE[$name]); <add> } <add> else <add> { <add> $_COOKIE[$name] = $value; <add> } <ide> <ide> $time = ($minutes !== 0) ? time() + ($minutes * 60) : 0; <ide> <ide> public static function forget($name) <ide> return static::put($name, null, -2000); <ide> } <ide> <del>} <add>} <ide>\ No newline at end of file
1
PHP
PHP
consolidate underscore, dasherize and humanize
77bd88d84abc914149813c426e9ed240d59bb325
<ide><path>src/Utility/Inflector.php <ide> public static function singularize($word) <ide> /** <ide> * Returns the given lower_case_and_underscored_word as a CamelCased word. <ide> * <del> * @param string $lowerCaseAndUnderscoredWord Word to camelize <add> * @param string $string Word to camelize <ide> * @return string Camelized word. LikeThis. <ide> * @link http://book.cakephp.org/3.0/en/core-libraries/inflector.html#creating-camelcase-and-under-scored-forms <ide> */ <del> public static function camelize($lowerCaseAndUnderscoredWord) <add> public static function camelize($string) <ide> { <del> if (!($result = static::_cache(__FUNCTION__, $lowerCaseAndUnderscoredWord))) { <del> $result = str_replace(' ', '', static::humanize($lowerCaseAndUnderscoredWord)); <del> static::_cache(__FUNCTION__, $lowerCaseAndUnderscoredWord, $result); <add> if (!($result = static::_cache(__FUNCTION__, $string))) { <add> $result = str_replace(' ', '', static::humanize($string)); <add> static::_cache(__FUNCTION__, $string, $result); <ide> } <ide> return $result; <ide> } <ide> public static function camelize($lowerCaseAndUnderscoredWord) <ide> * @return string Underscore-syntaxed version of the $camelCasedWord <ide> * @link http://book.cakephp.org/3.0/en/core-libraries/inflector.html#creating-camelcase-and-under-scored-forms <ide> */ <del> public static function underscore($camelCasedWord) <add> public static function underscore($string) <ide> { <del> if (!($result = static::_cache(__FUNCTION__, $camelCasedWord))) { <del> $result = strtolower(preg_replace('/(?<=\\w)([A-Z])/', '_\\1', $camelCasedWord)); <del> static::_cache(__FUNCTION__, $camelCasedWord, $result); <del> } <del> return $result; <add> return static::normalize($string, '_'); <ide> } <ide> <ide> /** <ide> * Returns the given CamelCasedWordGroup as an dashed-word-group. <ide> * <del> * @param string $wordGroup The string to dasherize. <add> * @param string $string The string to dasherize. <ide> * @return string Dashed version of the word group <ide> */ <del> public static function dasherize($wordGroup) <add> public static function dasherize($string) <ide> { <del> $result = static::_cache(__FUNCTION__, $wordGroup); <del> if ($result !== false) { <del> return $result; <del> } <del> <del> $result = str_replace('_', '-', static::underscore($wordGroup)); <del> static::_cache(__FUNCTION__, $wordGroup, $result); <del> return $result; <add> return static::normalize($string, '-'); <ide> } <ide> <ide> /** <ide> * Returns the given underscored_word_group as a Human Readable Word Group. <ide> * (Underscores are replaced by spaces and capitalized following words.) <ide> * <del> * @param string $lowerCaseAndUnderscoredWord String to be made more readable <add> * @param string $string String to be made more readable <add> * @param string $replacement <ide> * @return string Human-readable string <ide> * @link http://book.cakephp.org/3.0/en/core-libraries/inflector.html#creating-human-readable-forms <ide> */ <del> public static function humanize($lowerCaseAndUnderscoredWord) <add> public static function humanize($string, $replacement = '_') <add> { <add> return ucwords(str_replace($replacement, ' ', static::normalize($string, $replacement))); <add> } <add> <add> /** <add> * Returns the given CamelCasedWordGroup as lower cased words, separated by the replacement <add> * character <add> * <add> * @param string $string <add> * @param string $replacement <add> * @return string normalized stringd <add> */ <add> public static function normalize($string, $replacement = '_') <ide> { <del> if (!($result = static::_cache(__FUNCTION__, $lowerCaseAndUnderscoredWord))) { <del> $result = ucwords(str_replace('_', ' ', $lowerCaseAndUnderscoredWord)); <del> static::_cache(__FUNCTION__, $lowerCaseAndUnderscoredWord, $result); <add> $cacheKey = __FUNCTION__ . $replacement; <add> <add> $result = static::_cache($cacheKey, $string); <add> <add> if ($result === false) { <add> $result = strtolower(preg_replace('/(?<=\\w)([A-Z])/', $replacement .'\\1', $string)); <add> static::_cache($cacheKey, $string, $result); <ide> } <add> <ide> return $result; <ide> } <ide> <ide><path>tests/TestCase/Utility/InflectorTest.php <ide> public function testDasherized() <ide> $this->assertSame('test-thing', Inflector::dasherize('testThing')); <ide> $this->assertSame('test-thing-extra', Inflector::dasherize('TestThingExtra')); <ide> $this->assertSame('test-thing-extra', Inflector::dasherize('testThingExtra')); <del> $this->assertSame('test-this-thing', Inflector::dasherize('test_this_thing')); <add> $this->assertSame('test_this_thing', Inflector::dasherize('test_this_thing'), 'Should be unchanged'); <ide> <ide> // Test stupid values <ide> $this->assertSame('', Inflector::dasherize(null));
2
Java
Java
ignore invalid connect frame
dc2947c52df18d5e99cad03383f7d6ba13d031fd
<ide><path>spring-messaging/src/main/java/org/springframework/messaging/simp/broker/SimpleBrokerMessageHandler.java <ide> /* <del> * Copyright 2002-2019 the original author or authors. <add> * Copyright 2002-2022 the original author or authors. <ide> * <ide> * Licensed under the Apache License, Version 2.0 (the "License"); <ide> * you may not use this file except in compliance with the License. <ide> protected void handleMessageInternal(Message<?> message) { <ide> else if (SimpMessageType.CONNECT.equals(messageType)) { <ide> logMessage(message); <ide> if (sessionId != null) { <add> if (this.sessions.get(sessionId) != null) { <add> if (logger.isWarnEnabled()) { <add> logger.warn("Ignoring CONNECT in session " + sessionId + ". Already connected."); <add> } <add> return; <add> } <ide> long[] heartbeatIn = SimpMessageHeaderAccessor.getHeartbeat(headers); <ide> long[] heartbeatOut = getHeartbeatValue(); <ide> Principal user = SimpMessageHeaderAccessor.getUser(headers); <ide><path>spring-messaging/src/main/java/org/springframework/messaging/simp/stomp/StompBrokerRelayMessageHandler.java <ide> /* <del> * Copyright 2002-2021 the original author or authors. <add> * Copyright 2002-2022 the original author or authors. <ide> * <ide> * Licensed under the Apache License, Version 2.0 (the "License"); <ide> * you may not use this file except in compliance with the License. <ide> else if (accessor instanceof SimpMessageHeaderAccessor) { <ide> } <ide> <ide> if (StompCommand.CONNECT.equals(command) || StompCommand.STOMP.equals(command)) { <add> if (this.connectionHandlers.get(sessionId) != null) { <add> if (logger.isWarnEnabled()) { <add> logger.warn("Ignoring CONNECT in session " + sessionId + ". Already connected."); <add> } <add> return; <add> } <ide> if (logger.isDebugEnabled()) { <ide> logger.debug(stompAccessor.getShortLogMessage(EMPTY_PAYLOAD)); <ide> } <ide><path>spring-messaging/src/test/java/org/springframework/messaging/simp/stomp/StompBrokerRelayMessageHandlerTests.java <ide> /* <del> * Copyright 2002-2020 the original author or authors. <add> * Copyright 2002-2022 the original author or authors. <ide> * <ide> * Licensed under the Apache License, Version 2.0 (the "License"); <ide> * you may not use this file except in compliance with the License. <ide> void systemSubscription() { <ide> assertThat(captor.getValue()).isSameAs(message); <ide> } <ide> <add> @Test <add> void alreadyConnected() { <add> <add> this.brokerRelay.start(); <add> <add> Message<byte[]> connect = connectMessage("sess1", "joe"); <add> this.brokerRelay.handleMessage(connect); <add> <add> assertThat(this.tcpClient.getSentMessages().size()).isEqualTo(2); <add> <add> StompHeaderAccessor headers1 = this.tcpClient.getSentHeaders(0); <add> assertThat(headers1.getCommand()).isEqualTo(StompCommand.CONNECT); <add> assertThat(headers1.getSessionId()).isEqualTo(StompBrokerRelayMessageHandler.SYSTEM_SESSION_ID); <add> <add> StompHeaderAccessor headers2 = this.tcpClient.getSentHeaders(1); <add> assertThat(headers2.getCommand()).isEqualTo(StompCommand.CONNECT); <add> assertThat(headers2.getSessionId()).isEqualTo("sess1"); <add> <add> this.brokerRelay.handleMessage(connect); <add> <add> assertThat(this.tcpClient.getSentMessages().size()).isEqualTo(2); <add> assertThat(this.outboundChannel.getMessages()).isEmpty(); <add> } <add> <ide> private Message<byte[]> connectMessage(String sessionId, String user) { <ide> StompHeaderAccessor headers = StompHeaderAccessor.create(StompCommand.CONNECT); <ide> headers.setSessionId(sessionId);
3
Text
Text
add npm downloads badge
72904d894daa5947e4b368fa15b1b9737b9d4ba9
<ide><path>README.md <ide> # [Redux](http://gaearon.github.io/redux) <del>[![build status](https://img.shields.io/travis/gaearon/redux/master.svg?style=flat-square)](https://travis-ci.org/gaearon/redux) [![npm version](https://img.shields.io/npm/v/redux.svg?style=flat-square)](https://www.npmjs.com/package/redux) [![redux channel on slack](https://img.shields.io/badge/slack-redux@reactiflux-61DAFB.svg?style=flat-square)](http://www.reactiflux.com) <add>[![build status](https://img.shields.io/travis/gaearon/redux/master.svg?style=flat-square)](https://travis-ci.org/gaearon/redux) <add>[![npm version](https://img.shields.io/npm/v/redux.svg?style=flat-square)](https://www.npmjs.com/package/redux) <add>[![npm downloads](https://img.shields.io/npm/dm/redux.svg?style=flat-square)](https://www.npmjs.com/package/redux) <add>[![redux channel on slack](https://img.shields.io/badge/slack-redux@reactiflux-61DAFB.svg?style=flat-square)](http://www.reactiflux.com) <ide> <ide> Redux is a predictable state container for JavaScript apps. <ide>
1
Python
Python
add tests for prefer_gpu() and require_gpu()
91593b7378f5480d0b95930d12e7d1874967ccfa
<ide><path>spacy/tests/test_misc.py <ide> from ..tokens import Span <ide> from .util import get_doc <ide> from .._ml import PrecomputableAffine <add>from .. import prefer_gpu, require_gpu <ide> <ide> from pathlib import Path <ide> import pytest <ide> def test_PrecomputableAffine(nO=4, nI=5, nF=3, nP=2): <ide> assert model.d_pad[0, 2, 0, 0] == 0. <ide> model._backprop_padding(dY, ids) <ide> assert model.d_pad[0, 2, 0, 0] == 3. <add> <add>def test_prefer_gpu(): <add> assert not prefer_gpu() <add> <add>def test_require_gpu(): <add> with pytest.raises(ValueError): <add> require_gpu()
1
Javascript
Javascript
add dependency on angular-sanitize to example
8c121b94e7cfe9fd3e0f0acfb238a23156ea4093
<ide><path>src/ngSanitize/sanitize.js <ide> var $sanitizeMinErr = angular.$$minErr('$sanitize'); <ide> * @returns {string} Sanitized html. <ide> * <ide> * @example <del> <example module="ngSanitize"> <add> <example module="ngSanitize" deps="angular-sanitize.js"> <ide> <file name="index.html"> <ide> <script> <ide> function Ctrl($scope, $sce) {
1
Javascript
Javascript
add support for binding to global paths
0f09b6d79e4a387cc600dac8e82db5061c86da87
<ide><path>packages/ember-htmlbars/lib/hooks/get-root.js <ide> */ <ide> <ide> import Ember from "ember-metal/core"; <add>import { isGlobal } from "ember-metal/path_cache"; <add>import SimpleStream from "ember-metal/streams/simple-stream"; <ide> <ide> export default function getRoot(scope, key) { <ide> if (key === 'this') { <ide> return [scope.self]; <del> } <del> <del> if (scope.locals[key]) { <add> } else if (isGlobal(key) && Ember.lookup[key]) { <add> return [getGlobal(key)]; <add> } else if (scope.locals[key]) { <ide> return [scope.locals[key]]; <ide> } else { <ide> return [getKey(scope, key)]; <ide> function getKey(scope, key) { <ide> return scope.attrs; <ide> } <ide> <del> var self = scope.self; <add> var self = scope.self || scope.locals.view; <ide> <ide> if (scope.attrs && key in scope.attrs) { <ide> Ember.deprecate("You accessed the `" + key + "` attribute directly. Please use `attrs." + key + "` instead."); <ide> return scope.attrs[key]; <ide> } else if (self) { <ide> return self.getKey(key); <del> } else { <del> return scope.locals.view.getKey(key); <ide> } <ide> } <add> <add>var globalStreams = {}; <add> <add>function getGlobal(name) { <add> Ember.deprecate("Global lookup of " + name + " from a Handlebars template is deprecated") <add> <add> var globalStream = globalStreams[name]; <add> <add> if (globalStream === undefined) { <add> var global = Ember.lookup[name]; <add> globalStream = new SimpleStream(global, name); <add> globalStreams[name] = globalStream; <add> } <add> <add> return globalStream; <add>} <ide><path>packages/ember-htmlbars/tests/helpers/bind_attr_test.js <ide> QUnit.test("should be able to bind to globals with {{bind-attr}}", function() { <ide> <ide> expectDeprecation(function() { <ide> runAppend(view); <del> }, /Global lookup of TemplateTests.value from a Handlebars template is deprecated/); <add> }, /Global lookup of TemplateTests from a Handlebars template is deprecated/); <ide> <ide> equal(view.$('img').attr('alt'), "Test", "renders initial value"); <ide> }); <ide> QUnit.test("should be able to bind classes to globals with {{bind-attr class}}", <ide> <ide> expectDeprecation(function() { <ide> runAppend(view); <del> }, /Global lookup of TemplateTests.isOpen from a Handlebars template is deprecated/); <add> }, /Global lookup of TemplateTests from a Handlebars template is deprecated/); <ide> <ide> ok(view.$('img').hasClass('is-open'), "sets classname to the dasherized value of the global property"); <ide> }); <ide><path>packages/ember-htmlbars/tests/helpers/collection_test.js <ide> QUnit.test("itemViewClass works in the #collection helper with a global (DEPRECA <ide> template: compile('{{#collection content=view.exampleController itemViewClass=TemplateTests.ExampleItemView}}beta{{/collection}}') <ide> }); <ide> <del> var deprecation = /Global lookup of TemplateTests.ExampleItemView from a Handlebars template is deprecated/; <add> var deprecation = /Global lookup of TemplateTests from a Handlebars template is deprecated/; <ide> expectDeprecation(function() { <ide> runAppend(view); <ide> }, deprecation); <ide><path>packages/ember-htmlbars/tests/helpers/view_test.js <ide> QUnit.test("View lookup - App.FuView (DEPRECATED)", function() { <ide> <ide> expectDeprecation(function() { <ide> runAppend(view); <del> }, /Global lookup of App.FuView from a Handlebars template is deprecated./); <add> }, /Global lookup of App from a Handlebars template is deprecated./); <ide> <ide> equal(jQuery('#fu').text(), 'bro'); <ide> }); <ide> QUnit.test('{{view}} should evaluate other attribute bindings set to global path <ide> <ide> expectDeprecation(function() { <ide> runAppend(view); <del> }, 'Global lookup of App.name from a Handlebars template is deprecated.'); <add> }, 'Global lookup of App from a Handlebars template is deprecated.'); <ide> <ide> equal(view.$('input').val(), 'myApp', 'evaluates attributes bound to global paths'); <ide> <ide><path>packages/ember-htmlbars/tests/helpers/with_test.js <ide> QUnit.module("Handlebars {{#with}} globals helper [DEPRECATED]", { <ide> QUnit.test("it should support #with Foo.bar as qux [DEPRECATED]", function() { <ide> expectDeprecation(function() { <ide> runAppend(view); <del> }, /Global lookup of Foo.bar from a Handlebars template is deprecated/); <add> }, /Global lookup of Foo from a Handlebars template is deprecated/); <ide> <ide> equal(view.$().text(), "baz", "should be properly scoped"); <ide> <ide><path>packages/ember-htmlbars/tests/integration/globals_integration_test.js <ide> QUnit.test('should read from globals with a path (DEPRECATED)', function() { <ide> <ide> expectDeprecation(function() { <ide> runAppend(view); <del> }, 'Global lookup of Global.Space from a Handlebars template is deprecated.'); <add> }, 'Global lookup of Global from a Handlebars template is deprecated.'); <ide> equal(view.$().text(), Ember.lookup.Global.Space); <ide> }); <ide> <ide> QUnit.test('with context, should read from globals with a path (DEPRECATED)', fu <ide> <ide> expectDeprecation(function() { <ide> runAppend(view); <del> }, 'Global lookup of Global.Space from a Handlebars template is deprecated.'); <add> }, 'Global lookup of Global from a Handlebars template is deprecated.'); <ide> equal(view.$().text(), Ember.lookup.Global.Space); <ide> }); <ide><path>packages/ember-metal/lib/streams/stream.js <ide> Stream.prototype = { <ide> this.dependencies = null; <ide> return true; <ide> } <del> }, <del> <del> isGlobal() { <del> var stream = this; <del> while (stream !== undefined) { <del> if (stream._isRoot) { <del> return stream._isGlobal; <del> } <del> stream = stream.source; <del> } <ide> } <ide> }; <ide>
7
Go
Go
extend health check to start service
a99db84b4a966f0f09e81c446e857323a2a3302c
<ide><path>daemon/cluster/executor/container/controller.go <ide> func (r *controller) Start(ctx context.Context) error { <ide> return errors.Wrap(err, "starting container failed") <ide> } <ide> <del> return nil <add> // no health check <add> if ctnr.Config == nil || ctnr.Config.Healthcheck == nil { <add> return nil <add> } <add> <add> healthCmd := ctnr.Config.Healthcheck.Test <add> <add> if len(healthCmd) == 0 || healthCmd[0] == "NONE" { <add> return nil <add> } <add> <add> // wait for container to be healthy <add> eventq := r.adapter.events(ctx) <add> <add> var healthErr error <add> for { <add> select { <add> case event := <-eventq: <add> if !r.matchevent(event) { <add> continue <add> } <add> <add> switch event.Action { <add> case "die": // exit on terminal events <add> ctnr, err := r.adapter.inspect(ctx) <add> if err != nil { <add> return errors.Wrap(err, "die event received") <add> } else if ctnr.State.ExitCode != 0 { <add> return &exitError{code: ctnr.State.ExitCode, cause: healthErr} <add> } <add> <add> return nil <add> case "destroy": <add> // If we get here, something has gone wrong but we want to exit <add> // and report anyways. <add> return ErrContainerDestroyed <add> case "health_status: unhealthy": <add> // in this case, we stop the container and report unhealthy status <add> if err := r.Shutdown(ctx); err != nil { <add> return errors.Wrap(err, "unhealthy container shutdown failed") <add> } <add> // set health check error, and wait for container to fully exit ("die" event) <add> healthErr = ErrContainerUnhealthy <add> case "health_status: healthy": <add> return nil <add> } <add> case <-ctx.Done(): <add> return ctx.Err() <add> case <-r.closed: <add> return r.err <add> } <add> } <ide> } <ide> <ide> // Wait on the container to exit. <ide><path>integration-cli/docker_cli_service_health_test.go <add>// +build !windows <add> <add>package main <add> <add>import ( <add> "strconv" <add> "strings" <add> <add> "github.com/docker/docker/daemon/cluster/executor/container" <add> "github.com/docker/docker/pkg/integration/checker" <add> "github.com/docker/engine-api/types/swarm" <add> "github.com/go-check/check" <add>) <add> <add>// start a service, and then make its task unhealthy during running <add>// finally, unhealthy task should be detected and killed <add>func (s *DockerSwarmSuite) TestServiceHealthRun(c *check.C) { <add> testRequires(c, DaemonIsLinux) // busybox doesn't work on Windows <add> <add> d := s.AddDaemon(c, true, true) <add> <add> // build image with health-check <add> // note: use `daemon.buildImageWithOut` to build, do not use `buildImage` to build <add> imageName := "testhealth" <add> _, _, err := d.buildImageWithOut(imageName, <add> `FROM busybox <add> RUN touch /status <add> HEALTHCHECK --interval=1s --timeout=1s --retries=1\ <add> CMD cat /status`, <add> true) <add> c.Check(err, check.IsNil) <add> <add> serviceName := "healthServiceRun" <add> out, err := d.Cmd("service", "create", "--name", serviceName, imageName, "top") <add> c.Assert(err, checker.IsNil, check.Commentf(out)) <add> id := strings.TrimSpace(out) <add> <add> var tasks []swarm.Task <add> waitAndAssert(c, defaultReconciliationTimeout, func(c *check.C) (interface{}, check.CommentInterface) { <add> tasks = d.getServiceTasks(c, id) <add> return tasks, nil <add> }, checker.HasLen, 1) <add> <add> task := tasks[0] <add> <add> // wait for task to start <add> waitAndAssert(c, defaultReconciliationTimeout, func(c *check.C) (interface{}, check.CommentInterface) { <add> task = d.getTask(c, task.ID) <add> return task.Status.State, nil <add> }, checker.Equals, swarm.TaskStateStarting) <add> containerID := task.Status.ContainerStatus.ContainerID <add> <add> // wait for container to be healthy <add> waitAndAssert(c, defaultReconciliationTimeout, func(c *check.C) (interface{}, check.CommentInterface) { <add> out, _ := d.Cmd("inspect", "--format={{.State.Health.Status}}", containerID) <add> return strings.TrimSpace(out), nil <add> }, checker.Equals, "healthy") <add> <add> // make it fail <add> d.Cmd("exec", containerID, "rm", "/status") <add> // wait for container to be unhealthy <add> waitAndAssert(c, defaultReconciliationTimeout, func(c *check.C) (interface{}, check.CommentInterface) { <add> out, _ := d.Cmd("inspect", "--format={{.State.Health.Status}}", containerID) <add> return strings.TrimSpace(out), nil <add> }, checker.Equals, "unhealthy") <add> <add> // Task should be terminated <add> waitAndAssert(c, defaultReconciliationTimeout, func(c *check.C) (interface{}, check.CommentInterface) { <add> task = d.getTask(c, task.ID) <add> return task.Status.State, nil <add> }, checker.Equals, swarm.TaskStateFailed) <add> <add> if !strings.Contains(task.Status.Err, container.ErrContainerUnhealthy.Error()) { <add> c.Fatal("unhealthy task exits because of other error") <add> } <add>} <add> <add>// start a service whose task is unhealthy at beginning <add>// its tasks should be blocked in starting stage, until health check is passed <add>func (s *DockerSwarmSuite) TestServiceHealthStart(c *check.C) { <add> testRequires(c, DaemonIsLinux) // busybox doesn't work on Windows <add> <add> d := s.AddDaemon(c, true, true) <add> <add> // service started from this image won't pass health check <add> imageName := "testhealth" <add> _, _, err := d.buildImageWithOut(imageName, <add> `FROM busybox <add> HEALTHCHECK --interval=1s --timeout=1s --retries=1024\ <add> CMD cat /status`, <add> true) <add> c.Check(err, check.IsNil) <add> <add> serviceName := "healthServiceStart" <add> out, err := d.Cmd("service", "create", "--name", serviceName, imageName, "top") <add> c.Assert(err, checker.IsNil, check.Commentf(out)) <add> id := strings.TrimSpace(out) <add> <add> var tasks []swarm.Task <add> waitAndAssert(c, defaultReconciliationTimeout, func(c *check.C) (interface{}, check.CommentInterface) { <add> tasks = d.getServiceTasks(c, id) <add> return tasks, nil <add> }, checker.HasLen, 1) <add> <add> task := tasks[0] <add> <add> // wait for task to start <add> waitAndAssert(c, defaultReconciliationTimeout, func(c *check.C) (interface{}, check.CommentInterface) { <add> task = d.getTask(c, task.ID) <add> return task.Status.State, nil <add> }, checker.Equals, swarm.TaskStateStarting) <add> <add> containerID := task.Status.ContainerStatus.ContainerID <add> <add> // wait for health check to work <add> waitAndAssert(c, defaultReconciliationTimeout, func(c *check.C) (interface{}, check.CommentInterface) { <add> out, _ := d.Cmd("inspect", "--format={{.State.Health.FailingStreak}}", containerID) <add> failingStreak, _ := strconv.Atoi(strings.TrimSpace(out)) <add> return failingStreak, nil <add> }, checker.GreaterThan, 0) <add> <add> // task should be blocked at starting status <add> task = d.getTask(c, task.ID) <add> c.Assert(task.Status.State, check.Equals, swarm.TaskStateStarting) <add> <add> // make it healthy <add> d.Cmd("exec", containerID, "touch", "/status") <add> <add> // Task should be at running status <add> waitAndAssert(c, defaultReconciliationTimeout, func(c *check.C) (interface{}, check.CommentInterface) { <add> task = d.getTask(c, task.ID) <add> return task.Status.State, nil <add> }, checker.Equals, swarm.TaskStateRunning) <add>} <add> <add>// start a service whose task is unhealthy at beginning <add>// its tasks should be blocked in starting stage, until health check is passed <add>func (s *DockerSwarmSuite) TestServiceHealthUpdate(c *check.C) { <add> testRequires(c, DaemonIsLinux) // busybox doesn't work on Windows <add> <add> d := s.AddDaemon(c, true, true) <add> <add> // service started from this image won't pass health check <add> imageName := "testhealth" <add> _, _, err := d.buildImageWithOut(imageName, <add> `FROM busybox <add> HEALTHCHECK --interval=1s --timeout=1s --retries=1024\ <add> CMD cat /status`, <add> true) <add> c.Check(err, check.IsNil) <add> <add> serviceName := "healthServiceStart" <add> out, err := d.Cmd("service", "create", "--name", serviceName, imageName, "top") <add> c.Assert(err, checker.IsNil, check.Commentf(out)) <add> id := strings.TrimSpace(out) <add> <add> var tasks []swarm.Task <add> waitAndAssert(c, defaultReconciliationTimeout, func(c *check.C) (interface{}, check.CommentInterface) { <add> tasks = d.getServiceTasks(c, id) <add> return tasks, nil <add> }, checker.HasLen, 1) <add> <add> task := tasks[0] <add> <add> // wait for task to start <add> waitAndAssert(c, defaultReconciliationTimeout, func(c *check.C) (interface{}, check.CommentInterface) { <add> task = d.getTask(c, task.ID) <add> return task.Status.State, nil <add> }, checker.Equals, swarm.TaskStateStarting) <add> <add> containerID := task.Status.ContainerStatus.ContainerID <add> <add> // wait for health check to work <add> waitAndAssert(c, defaultReconciliationTimeout, func(c *check.C) (interface{}, check.CommentInterface) { <add> out, _ := d.Cmd("inspect", "--format={{.State.Health.FailingStreak}}", containerID) <add> failingStreak, _ := strconv.Atoi(strings.TrimSpace(out)) <add> return failingStreak, nil <add> }, checker.GreaterThan, 0) <add> <add> // task should be blocked at starting status <add> task = d.getTask(c, task.ID) <add> c.Assert(task.Status.State, check.Equals, swarm.TaskStateStarting) <add> <add> // make it healthy <add> d.Cmd("exec", containerID, "touch", "/status") <add> // Task should be at running status <add> waitAndAssert(c, defaultReconciliationTimeout, func(c *check.C) (interface{}, check.CommentInterface) { <add> task = d.getTask(c, task.ID) <add> return task.Status.State, nil <add> }, checker.Equals, swarm.TaskStateRunning) <add>}
2
PHP
PHP
perform redirection only in case of get requests
fd4cc43435353b3358013bb9b33374830157da12
<ide><path>src/Http/Middleware/HttpsEnforcerMiddleware.php <ide> class HttpsEnforcerMiddleware implements MiddlewareInterface <ide> * <ide> * ### Options <ide> * <del> * - `redirect` If set to true (default) redirect to same URL with https. <add> * - `redirect` If set to true (default) redirects GET requests to same URL with https. <ide> * - `statusCode` Status code to use in case of redirect, defaults to 301 - Permanent redirect. <ide> * - `headers` Array of response headers in case of redirect. <ide> * <ide> public function __construct(array $config = []) <ide> /** <ide> * Check whether request has been made using HTTPS. <ide> * <del> * Depending on configuration either redirects to same URL with https or throws exception. <add> * Depending on the configuration and request method, either redirects to <add> * same URL with https or throws an exception. <ide> * <ide> * @param \Psr\Http\Message\ServerRequestInterface $request The request. <ide> * @param \Psr\Http\Server\RequestHandlerInterface $handler The request handler. <ide> public function process(ServerRequestInterface $request, RequestHandlerInterface <ide> return $handler->handle($request); <ide> } <ide> <del> if ($this->config['redirect']) { <add> if ($this->config['redirect'] && $request->getMethod() === 'GET') { <ide> $uri = $request->getUri()->withScheme('https'); <ide> <ide> return new RedirectResponse( <ide><path>tests/TestCase/Http/Middleware/HttpsEnforcerMiddlewareTest.php <ide> public function testRedirect() <ide> { <ide> $uri = new Uri('http://localhost/foo'); <ide> $request = new ServerRequest(); <del> $request = $request->withUri($uri); <add> $request = $request->withUri($uri)->withMethod('GET'); <ide> <ide> $handler = new TestRequestHandler(function ($req) { <ide> return new Response(); <ide> public function testRedirect() <ide> ); <ide> } <ide> <del> public function testSecurityException() <add> /** <add> * Test that exception is thrown when redirect is disabled. <add> * <add> * @return void <add> */ <add> public function testNoRedirectException() <ide> { <ide> $this->expectException(BadRequestException::class); <ide> <ide> public function testSecurityException() <ide> $middleware = new HttpsEnforcerMiddleware(['redirect' => false]); <ide> $middleware->process($request, $handler); <ide> } <add> <add> /** <add> * Test that exception is thrown for non GET request even if redirect is enabled. <add> * <add> * @return void <add> */ <add> public function testExceptionForNonGetRequest() <add> { <add> $this->expectException(BadRequestException::class); <add> <add> $uri = new Uri('http://localhost/foo'); <add> $request = new ServerRequest(); <add> $request = $request->withUri($uri)->withMethod('POST'); <add> <add> $handler = new TestRequestHandler(function ($req) { <add> return new Response(); <add> }); <add> <add> $middleware = new HttpsEnforcerMiddleware(['redirect' => true]); <add> $middleware->process($request, $handler); <add> } <ide> }
2
Python
Python
fix import of secrets
75b4caf442bcc2889b66e3a966e02449ceb2433e
<ide><path>test/test_voxel.py <ide> import httplib <ide> <ide> from test import MockHttp, multipleresponse, TestCaseMixin <del>from secrets import VOXEL_USER, VOXEL_SECRET <add>from secrets import VOXEL_KEY, VOXEL_SECRET <ide> from xml.etree import ElementTree as ET <ide> <ide> class VoxelTest(unittest.TestCase):
1
Ruby
Ruby
add missing inflector dependency
b13400086c2d39a5bbc5e8a6ea26434e842fbb10
<ide><path>activesupport/lib/active_support/testing/constant_lookup.rb <ide> require "active_support/concern" <add>require "active_support/inflector" <ide> <ide> module ActiveSupport <ide> module Testing <ide> module ClassMethods <ide> def determine_constant_from_test_name(test_name) <ide> names = test_name.split "::" <ide> while names.size > 0 do <del> names.last.sub! /Test$/, "" <del> # Rails 3.0 doesn't have safe_constantize, <del> # so we'll do it the hard way. <add> names.last.sub!(/Test$/, "") <ide> begin <ide> constant = names.join("::").constantize <ide> break(constant) if yield(constant) <ide><path>activesupport/test/testing/constant_lookup_test.rb <ide> def self.index; end <ide> class Baz < Bar; end <ide> module FooBar; end <ide> <del>class TestLookup < ActiveSupport::TestCase <add>class ConstantLookupTest < ActiveSupport::TestCase <ide> <ide> def find_foo(name) <ide> self.class.determine_constant_from_test_name(name) do |constant|
2
Ruby
Ruby
remove wrong comment
8d0c107a60a5f240c7a6e9caee4ad10cff8fe63e
<ide><path>actionpack/lib/action_dispatch/routing/route_set.rb <ide> def serve(req) <ide> <ide> prepare_params!(params) <ide> <del> # Just raise undefined constant errors if a controller was specified as default. <ide> controller = controller(params, @raise_on_name_error) do <ide> return [404, {'X-Cascade' => 'pass'}, []] <ide> end
1
Javascript
Javascript
uniformize links in layoutproptypes docs
1234d274787aa2e4e5a8bbbf7c94dbbd43339b4f
<ide><path>Libraries/StyleSheet/LayoutPropTypes.js <ide> var LayoutPropTypes = { <ide> * <ide> * It works similarly to `width` in CSS, but in React Native you <ide> * must use logical pixel units, rather than percents, ems, or any of that. <del> * See http://www.w3schools.com/cssref/pr_dim_width.asp for more details. <add> * See https://developer.mozilla.org/en-US/docs/Web/CSS/width for more details. <ide> */ <ide> width: ReactPropTypes.number, <ide> <ide> /** `height` sets the height of this component. <ide> * <ide> * It works similarly to `height` in CSS, but in React Native you <ide> * must use logical pixel units, rather than percents, ems, or any of that. <del> * See http://www.w3schools.com/cssref/pr_dim_width.asp for more details. <add> * See https://developer.mozilla.org/en-US/docs/Web/CSS/height for more details. <ide> */ <ide> height: ReactPropTypes.number, <ide> <ide> var LayoutPropTypes = { <ide> * It works similarly to `min-width` in CSS, but in React Native you <ide> * must use logical pixel units, rather than percents, ems, or any of that. <ide> * <del> * See http://www.w3schools.com/cssref/pr_dim_min-width.asp <add> * See https://developer.mozilla.org/en-US/docs/Web/CSS/min-width <ide> * for more details. <ide> */ <ide> minWidth: ReactPropTypes.number, <ide> var LayoutPropTypes = { <ide> * It works similarly to `max-width` in CSS, but in React Native you <ide> * must use logical pixel units, rather than percents, ems, or any of that. <ide> * <del> * See http://www.w3schools.com/cssref/pr_dim_max-width.asp <add> * See https://developer.mozilla.org/en-US/docs/Web/CSS/max-width <ide> * for more details. <ide> */ <ide> maxWidth: ReactPropTypes.number, <ide> var LayoutPropTypes = { <ide> * It works similarly to `min-height` in CSS, but in React Native you <ide> * must use logical pixel units, rather than percents, ems, or any of that. <ide> * <del> * See http://www.w3schools.com/cssref/pr_dim_min-height.asp <add> * See https://developer.mozilla.org/en-US/docs/Web/CSS/min-height <ide> * for more details. <ide> */ <ide> minHeight: ReactPropTypes.number, <ide> var LayoutPropTypes = { <ide> * It works similarly to `max-height` in CSS, but in React Native you <ide> * must use logical pixel units, rather than percents, ems, or any of that. <ide> * <del> * See http://www.w3schools.com/cssref/pr_dim_max-height.asp <add> * See https://developer.mozilla.org/en-US/docs/Web/CSS/max-height <ide> * for more details. <ide> */ <ide> maxHeight: ReactPropTypes.number, <ide> <ide> /** Setting `margin` has the same effect as setting each of <ide> * `marginTop`, `marginLeft`, `marginBottom`, and `marginRight`. <add> * See https://developer.mozilla.org/en-US/docs/Web/CSS/margin <add> * for more details. <ide> */ <ide> margin: ReactPropTypes.number, <ide> <ide> var LayoutPropTypes = { <ide> marginHorizontal: ReactPropTypes.number, <ide> <ide> /** `marginTop` works like `margin-top` in CSS. <del> * See http://www.w3schools.com/cssref/pr_margin-top.asp <add> * See https://developer.mozilla.org/en-US/docs/Web/CSS/margin-top <ide> * for more details. <ide> */ <ide> marginTop: ReactPropTypes.number, <ide> <ide> /** `marginBottom` works like `margin-bottom` in CSS. <del> * See http://www.w3schools.com/cssref/pr_margin-bottom.asp <add> * See https://developer.mozilla.org/en-US/docs/Web/CSS/margin-bottom <ide> * for more details. <ide> */ <ide> marginBottom: ReactPropTypes.number, <ide> <ide> /** `marginLeft` works like `margin-left` in CSS. <del> * See http://www.w3schools.com/cssref/pr_margin-left.asp <add> * See https://developer.mozilla.org/en-US/docs/Web/CSS/margin-left <ide> * for more details. <ide> */ <ide> marginLeft: ReactPropTypes.number, <ide> <ide> /** `marginRight` works like `margin-right` in CSS. <del> * See http://www.w3schools.com/cssref/pr_margin-right.asp <add> * See https://developer.mozilla.org/en-US/docs/Web/CSS/margin-right <ide> * for more details. <ide> */ <ide> marginRight: ReactPropTypes.number, <ide> <del> /** `padding` works like `padding` in CSS. <del> * It's like setting each of `paddingTop`, `paddingBottom`, <del> * `paddingLeft`, and `paddingRight` to the same thing. <del> * See http://www.w3schools.com/css/css_padding.asp <add> /** Setting `padding` has the same effect as setting each of <add> * `paddingTop`, `paddingBottom`, `paddingLeft`, and `paddingRight`. <add> * See https://developer.mozilla.org/en-US/docs/Web/CSS/padding <ide> * for more details. <ide> */ <ide> padding: ReactPropTypes.number, <ide> var LayoutPropTypes = { <ide> paddingHorizontal: ReactPropTypes.number, <ide> <ide> /** `paddingTop` works like `padding-top` in CSS. <del> * See http://www.w3schools.com/cssref/pr_padding-top.asp <add> * See https://developer.mozilla.org/en-US/docs/Web/CSS/padding-top <ide> * for more details. <ide> */ <ide> paddingTop: ReactPropTypes.number, <ide> <ide> /** `paddingBottom` works like `padding-bottom` in CSS. <del> * See http://www.w3schools.com/cssref/pr_padding-bottom.asp <add> * See https://developer.mozilla.org/en-US/docs/Web/CSS/padding-bottom <ide> * for more details. <ide> */ <ide> paddingBottom: ReactPropTypes.number, <ide> <ide> /** `paddingLeft` works like `padding-left` in CSS. <del> * See http://www.w3schools.com/cssref/pr_padding-left.asp <add> * See https://developer.mozilla.org/en-US/docs/Web/CSS/padding-left <ide> * for more details. <ide> */ <ide> paddingLeft: ReactPropTypes.number, <ide> <ide> /** `paddingRight` works like `padding-right` in CSS. <del> * See http://www.w3schools.com/cssref/pr_padding-right.asp <add> * See https://developer.mozilla.org/en-US/docs/Web/CSS/padding-right <ide> * for more details. <ide> */ <ide> paddingRight: ReactPropTypes.number, <ide> <ide> /** `borderWidth` works like `border-width` in CSS. <del> * See http://www.w3schools.com/cssref/pr_border-width.asp <add> * See https://developer.mozilla.org/en-US/docs/Web/CSS/border-width <ide> * for more details. <ide> */ <ide> borderWidth: ReactPropTypes.number, <ide> <ide> /** `borderTopWidth` works like `border-top-width` in CSS. <del> * See http://www.w3schools.com/cssref/pr_border-top_width.asp <add> * See https://developer.mozilla.org/en-US/docs/Web/CSS/border-top-width <ide> * for more details. <ide> */ <ide> borderTopWidth: ReactPropTypes.number, <ide> <ide> /** `borderRightWidth` works like `border-right-width` in CSS. <del> * See http://www.w3schools.com/cssref/pr_border-right_width.asp <add> * See https://developer.mozilla.org/en-US/docs/Web/CSS/border-right-width <ide> * for more details. <ide> */ <ide> borderRightWidth: ReactPropTypes.number, <ide> <ide> /** `borderBottomWidth` works like `border-bottom-width` in CSS. <del> * See http://www.w3schools.com/cssref/pr_border-bottom_width.asp <add> * See https://developer.mozilla.org/en-US/docs/Web/CSS/border-bottom-width <ide> * for more details. <ide> */ <ide> borderBottomWidth: ReactPropTypes.number, <ide> <ide> /** `borderLeftWidth` works like `border-left-width` in CSS. <del> * See http://www.w3schools.com/cssref/pr_border-bottom_width.asp <add> * See https://developer.mozilla.org/en-US/docs/Web/CSS/border-left-width <ide> * for more details. <ide> */ <ide> borderLeftWidth: ReactPropTypes.number, <ide> var LayoutPropTypes = { <ide> /** `flexDirection` controls which directions children of a container go. <ide> * `row` goes left to right, `column` goes top to bottom, and you may <ide> * be able to guess what the other two do. It works like `flex-direction` <del> * in CSS, except the default is `column`. See <del> * https://css-tricks.com/almanac/properties/f/flex-direction/ <del> * for more detail. <add> * in CSS, except the default is `column`. <add> * See https://developer.mozilla.org/en-US/docs/Web/CSS/flex-direction <add> * for more details. <ide> */ <ide> flexDirection: ReactPropTypes.oneOf([ <ide> 'row', <ide> var LayoutPropTypes = { <ide> <ide> /** `flexWrap` controls whether children can wrap around after they <ide> * hit the end of a flex container. <del> * It works like `flex-wrap` in CSS. See <del> * https://css-tricks.com/almanac/properties/f/flex-wrap/ <del> * for more detail. <add> * It works like `flex-wrap` in CSS. <add> * See https://developer.mozilla.org/en-US/docs/Web/CSS/flex-wrap <add> * for more details. <ide> */ <ide> flexWrap: ReactPropTypes.oneOf([ <ide> 'wrap', <ide> var LayoutPropTypes = { <ide> /** `justifyContent` aligns children in the main direction. <ide> * For example, if children are flowing vertically, `justifyContent` <ide> * controls how they align vertically. <del> * It works like `justify-content` in CSS. See <del> * https://css-tricks.com/almanac/properties/j/justify-content/ <del> * for more detail. <add> * It works like `justify-content` in CSS. <add> * See https://developer.mozilla.org/en-US/docs/Web/CSS/justify-content <add> * for more details. <ide> */ <ide> justifyContent: ReactPropTypes.oneOf([ <ide> 'flex-start', <ide> var LayoutPropTypes = { <ide> * For example, if children are flowing vertically, `alignItems` <ide> * controls how they align horizontally. <ide> * It works like `align-items` in CSS, except the default value <del> * is `stretch` instead of `flex-start`. See <del> * https://css-tricks.com/almanac/properties/a/align-items/ <del> * for more detail. <add> * is `stretch` instead of `flex-start`. <add> * See https://developer.mozilla.org/en-US/docs/Web/CSS/align-items <add> * for more details. <ide> */ <ide> alignItems: ReactPropTypes.oneOf([ <ide> 'flex-start', <ide> var LayoutPropTypes = { <ide> <ide> /** `alignSelf` controls how a child aligns in the cross direction, <ide> * overriding the `alignItems` of the parent. It works like `align-self` <del> * in CSS. See <del> * https://css-tricks.com/almanac/properties/a/align-self/ <del> * for more detail. <add> * in CSS. <add> * See https://developer.mozilla.org/en-US/docs/Web/CSS/align-self <add> * for more details. <ide> */ <ide> alignSelf: ReactPropTypes.oneOf([ <ide> 'auto', <ide> var LayoutPropTypes = { <ide> /** In React Native `flex` does not work the same way that it does in CSS. <ide> * `flex` is a number rather than a string, and it works <ide> * according to the `css-layout` library <del> * at https://github.com/facebook/css-layout . <add> * at https://github.com/facebook/css-layout. <ide> * <ide> * When `flex` is a positive number, it makes the component flexible <ide> * and it will be sized proportional to its flex value. So a <ide> var LayoutPropTypes = { <ide> * <ide> * It works like the CSS `z-index` property - components with a larger <ide> * `zIndex` will render on top. Think of the z-direction like it's <del> * pointing from the phone into your eyeball. See <del> * https://developer.mozilla.org/en-US/docs/Web/CSS/z-index for <del> * more detail. <add> * pointing from the phone into your eyeball. <add> * See https://developer.mozilla.org/en-US/docs/Web/CSS/z-index for <add> * more details. <ide> */ <ide> zIndex: ReactPropTypes.number, <ide> };
1
PHP
PHP
change some paths
f53b52c8a177e20e3947212a26798dedd1346be6
<ide><path>src/Illuminate/Foundation/Application.php <ide> public function databasePath() <ide> */ <ide> public function langPath() <ide> { <del> return $this->basePath.'/resources/lang'; <add> return $this->basePath.'/lang'; <ide> } <ide> <ide> /** <ide><path>src/Illuminate/Foundation/Console/FreshCommand.php <ide> protected function getFiles() <ide> base_path('bower.json'), <ide> base_path('gulpfile.js'), <ide> base_path('package.json'), <add> base_path('views/dashboard.blade.php'), <ide> app_path('Http/Controllers/HomeController.php'), <del> base_path('resources/views/dashboard.blade.php'), <ide> ]; <ide> } <ide> <ide> protected function getDirectories() <ide> return [ <ide> public_path('js'), <ide> public_path('css'), <del> base_path('resources/assets'), <add> base_path('assets'), <add> base_path('views/auth'), <add> base_path('views/emails'), <add> base_path('views/layouts'), <add> base_path('views/partials'), <ide> app_path('Http/Requests/Auth'), <ide> app_path('Http/Controllers/Auth'), <del> base_path('resources/views/auth'), <del> base_path('resources/views/emails'), <del> base_path('resources/views/layouts'), <del> base_path('resources/views/partials'), <ide> ]; <ide> } <ide> <ide> protected function getStubs() <ide> { <ide> return [ <ide> 'routes.stub' => app_path('Http/routes.php'), <del> 'view.stub' => base_path('resources/views/welcome.blade.php'), <add> 'view.stub' => base_path('views/welcome.blade.php'), <ide> 'welcome.stub' => app_path('Http/Controllers/WelcomeController.php'), <ide> ]; <ide> }
2
Text
Text
use a react component as a vjs component
cff2e503ef9088207fcdd541fbe0c45c0c79c1b8
<ide><path>docs/guides/react.md <ide> return <VideoPlayer { ...videoJsOptions } /> <ide> Dont forget to include the video.js CSS, located at `video.js/dist/video-js.css`. <ide> <ide> [options]: /docs/guides/options.md <add> <add> <add>## Using a React Component as a Video JS Component <add> <add>```jsx <add>/** <add> * EpisodeList.js <add> * <add> * This is just a plain ol' React component. <add> * the vjsComponent methods, player methods etc. are available via <add> * the vjsComponent prop (`this.props.vjsComponent`) <add> */ <add>import React, { Component, PropTypes } from 'react'; <add> <add>class EpisodeList extends Component { <add> render() { <add> return ( <add> <div> <add> <h1>{this.props.body}</h1> <add> </div> <add> ); <add> } <add>} <add> <add> <add>/** <add> * vjsEpisodeList.js <add> * <add> * Here is where we register a Video JS Component and <add> * mount the React component to it when the player is ready. <add> */ <add>import EpisodeList from './EpisodeList'; <add>import ReactDOM from 'react-dom'; <add>import videojs from 'video.js'; <add> <add>const vjsComponent = videojs.getComponent('Component'); <add> <add>class vjsEpisodeList extends vjsComponent { <add> <add> constructor(player, options) { <add> super(player, options); <add> <add> /* Bind the current class context to the mount method */ <add> this.mount = this.mount.bind(this); <add> <add> /* When player is ready, call method to mount React component */ <add> player.ready(() => { <add> this.mount(); <add> }); <add> } <add> <add> /** <add> * We will render out the React EpisodeList component into the DOM element <add> * generated automatically by the VideoJS createEl() method. <add> * <add> * We fetch that generated element using `this.el()`, a method provided by the <add> * vjsComponent class that this class is extending. <add> */ <add> mount() { <add> ReactDOM.render(<EpisodeList vjsComponent={this} body="Episodes" />, this.el() ); <add> } <add>} <add> <add>/** <add> * Make sure to register the vjsComponent so Video JS knows it exists <add> */ <add>vjsComponent.registerComponent('vjsEpisodeList', vjsEpisodeList); <add> <add>export default vjsEpisodeList; <add> <add> <add>/** <add> * VideoPlayer.js <add> * Check the above example for how to integrate the rest of this class. <add> */ <add> <add>// ... <add> componentDidMount() { <add> // instantiate video.js <add> this.player = videojs(this.videoNode, this.props, function onPlayerReady() { <add> console.log('onPlayerReady', this) <add> }); <add> <add> /** <add> * Fetch the controlBar component and add the new vjsEpisodeList component as a child <add> * You can pass options here if desired in the second object. <add> */ <add> this.player.getChild('controlBar').addChild('vjsEpisodeList', {}); <add> } <add>// ... <add>```
1
Javascript
Javascript
extract snapshotoptimization into separate class
577156f790f96fa5a8892839cc5a77455d0d339d
<ide><path>lib/FileSystemInfo.js <ide> const INVALID = Symbol("invalid"); <ide> * @property {Set<string>} resolveDependencies.missing list of missing entries <ide> */ <ide> <add>class SnapshotOptimization { <add> constructor(key) { <add> this._key = key; <add> /** @type {Map<string, SnapshotOptimizationEntry>} */ <add> this._map = new Map(); <add> } <add> <add> storeUnsharedSnapshot(snapshot, locations) { <add> if (locations === undefined) return; <add> const optimizationEntry = { <add> snapshot, <add> shared: 0, <add> snapshotContent: undefined, <add> children: undefined <add> }; <add> for (const path of locations) { <add> this._map.set(path, optimizationEntry); <add> } <add> } <add> <add> optimize(capturedFiles, startTime, children) { <add> const key = this._key; <add> /** @type {Set<string>} */ <add> const unsetOptimizationEntries = new Set(); <add> /** @type {Set<SnapshotOptimizationEntry>} */ <add> const checkedOptimizationEntries = new Set(); <add> /** <add> * @param {SnapshotOptimizationEntry} entry optimization entry <add> * @returns {void} <add> */ <add> const increaseSharedAndStoreOptimizationEntry = entry => { <add> if (entry.children !== undefined) { <add> entry.children.forEach(increaseSharedAndStoreOptimizationEntry); <add> } <add> entry.shared++; <add> storeOptimizationEntry(entry); <add> }; <add> /** <add> * @param {SnapshotOptimizationEntry} entry optimization entry <add> * @returns {void} <add> */ <add> const storeOptimizationEntry = entry => { <add> for (const path of entry.snapshotContent) { <add> const old = this._map.get(path); <add> if (old.shared < entry.shared) { <add> this._map.set(path, entry); <add> } <add> capturedFiles.delete(path); <add> } <add> }; <add> capturedFiles: for (const path of capturedFiles) { <add> const optimizationEntry = this._map.get(path); <add> if (optimizationEntry === undefined) { <add> unsetOptimizationEntries.add(path); <add> continue; <add> } <add> if (checkedOptimizationEntries.has(optimizationEntry)) continue; <add> const snapshot = optimizationEntry.snapshot; <add> if (optimizationEntry.shared > 0) { <add> // It's a shared snapshot <add> // We can't change it, so we can only use it when all files match <add> // and startTime is compatible <add> if ( <add> startTime && <add> (!snapshot.startTime || snapshot.startTime > startTime) <add> ) { <add> continue; <add> } <add> const nonSharedFiles = new Set(); <add> for (const path of optimizationEntry.snapshotContent) { <add> if (!capturedFiles.has(path)) { <add> if (!snapshot[key].has(path)) { <add> // File is not shared and can't be removed from the snapshot <add> // because it's in a child of the snapshot <add> checkedOptimizationEntries.add(optimizationEntry); <add> continue capturedFiles; <add> } <add> nonSharedFiles.add(path); <add> continue; <add> } <add> } <add> if (nonSharedFiles.size === 0) { <add> // The complete snapshot is shared <add> // add it as child <add> children.add(snapshot); <add> increaseSharedAndStoreOptimizationEntry(optimizationEntry); <add> } else { <add> // Only a part of the snapshot is shared <add> // Extract common timestamps from both snapshots <add> const commonMap = new Map(); <add> for (const [path, ts] of snapshot[key]) { <add> if (nonSharedFiles.has(path)) continue; <add> commonMap.set(path, ts); <add> snapshot[key].delete(path); <add> } <add> // Create and attach snapshot <add> /** @type {Snapshot} */ <add> const commonSnapshot = { <add> startTime: <add> startTime && snapshot.startTime <add> ? Math.min(startTime, snapshot.startTime) <add> : startTime || snapshot.startTime, <add> [key]: commonMap <add> }; <add> children.add(commonSnapshot); <add> if (!snapshot.children) snapshot.children = new Set(); <add> snapshot.children.add(commonSnapshot); <add> // Create optimization entry <add> const newEntry = { <add> snapshot: commonSnapshot, <add> shared: optimizationEntry.shared + 1, <add> snapshotContent: new Set(commonMap.keys()), <add> children: undefined <add> }; <add> if (optimizationEntry.children === undefined) <add> optimizationEntry.children = new Set(); <add> optimizationEntry.children.add(newEntry); <add> storeOptimizationEntry(newEntry); <add> } <add> } else { <add> // It's a unshared snapshot <add> // We can extract a common shared snapshot <add> // with all common files <add> const commonMap = new Map(); <add> for (const path of capturedFiles) { <add> const ts = snapshot[key].get(path); <add> if (ts === undefined) continue; <add> commonMap.set(path, ts); <add> } <add> if (commonMap.size < 2) { <add> // Common part it too small <add> continue capturedFiles; <add> } <add> // Create and attach snapshot <add> /** @type {Snapshot} */ <add> const commonSnapshot = { <add> startTime: <add> startTime && snapshot.startTime <add> ? Math.min(startTime, snapshot.startTime) <add> : startTime || snapshot.startTime, <add> [key]: commonMap <add> }; <add> children.add(commonSnapshot); <add> if (!snapshot.children) snapshot.children = new Set(); <add> snapshot.children.add(commonSnapshot); <add> // Remove files from snapshot <add> for (const path of commonMap.keys()) snapshot[key].delete(path); <add> // Create optimization entry <add> storeOptimizationEntry({ <add> snapshot: commonSnapshot, <add> shared: 2, <add> snapshotContent: new Set(commonMap.keys()), <add> children: undefined <add> }); <add> } <add> } <add> return unsetOptimizationEntries; <add> } <add>} <add> <ide> /* istanbul ignore next */ <ide> /** <ide> * @param {number} mtime mtime <ide> class FileSystemInfo { <ide> this._loggedPaths = logger ? new Set() : undefined; <ide> /** @type {WeakMap<Snapshot, boolean | (function(WebpackError=, boolean=): void)[]>} */ <ide> this._snapshotCache = new WeakMap(); <del> /** @type {Map<string, SnapshotOptimizationEntry>} */ <del> this._snapshotOptimization = new Map(); <add> this._fileTimestampsOptimization = new SnapshotOptimization( <add> "fileTimestamps" <add> ); <ide> /** @type {Map<string, FileSystemInfoEntry | "ignore" | null>} */ <ide> this._fileTimestamps = new Map(); <ide> /** @type {Map<string, string>} */ <ide> class FileSystemInfo { <ide> const children = new Set(); <ide> <ide> /** @type {Set<string>} */ <del> const unsetOptimizationEntries = new Set(); <add> let unsharedFileTimestamps; <ide> <ide> /** @type {Set<string>} */ <ide> const managedItems = new Set(); <ide> class FileSystemInfo { <ide> snapshot.managedItemInfo = managedItemInfo; <ide> if (children.size !== 0) snapshot.children = children; <ide> this._snapshotCache.set(snapshot, true); <del> const optimizationEntry = { <add> this._fileTimestampsOptimization.storeUnsharedSnapshot( <ide> snapshot, <del> shared: 0, <del> snapshotContent: undefined, <del> children: undefined <del> }; <del> for (const path of unsetOptimizationEntries) { <del> this._snapshotOptimization.set(path, optimizationEntry); <del> } <add> unsharedFileTimestamps <add> ); <ide> callback(null, snapshot); <ide> } <ide> }; <ide> class FileSystemInfo { <ide> callback(null, null); <ide> } <ide> }; <add> const checkManaged = path => { <add> for (const immutablePath of this.immutablePathsWithSlash) { <add> if (path.startsWith(immutablePath)) { <add> return true; <add> } <add> } <add> for (const managedPath of this.managedPathsWithSlash) { <add> if (path.startsWith(managedPath)) { <add> const managedItem = getManagedItem(managedPath, path); <add> if (managedItem) { <add> managedItems.add(managedItem); <add> return true; <add> } <add> } <add> } <add> return false; <add> }; <add> const captureNonManaged = items => { <add> const capturedItems = new Set(); <add> for (const path of items) { <add> if (!checkManaged(path)) capturedItems.add(path); <add> } <add> return capturedItems; <add> }; <ide> if (files) { <ide> if (options && options.hash) { <del> files: for (const path of files) { <del> for (const immutablePath of this.immutablePathsWithSlash) { <del> if (path.startsWith(immutablePath)) { <del> continue files; <del> } <del> } <del> for (const managedPath of this.managedPathsWithSlash) { <del> if (path.startsWith(managedPath)) { <del> const managedItem = getManagedItem(managedPath, path); <del> if (managedItem) { <del> managedItems.add(managedItem); <del> continue files; <del> } <del> } <del> } <add> for (const path of files) { <add> if (checkManaged(path)) continue; <ide> const cache = this._fileHashes.get(path); <ide> if (cache !== undefined) { <ide> fileHashes.set(path, cache); <ide> class FileSystemInfo { <ide> } <ide> } <ide> } else { <del> const capturedFiles = new Set(); <del> files: for (const path of files) { <del> for (const immutablePath of this.immutablePathsWithSlash) { <del> if (path.startsWith(immutablePath)) { <del> continue files; <del> } <del> } <del> for (const managedPath of this.managedPathsWithSlash) { <del> if (path.startsWith(managedPath)) { <del> const managedItem = getManagedItem(managedPath, path); <del> if (managedItem) { <del> managedItems.add(managedItem); <del> continue files; <del> } <del> } <del> } <del> capturedFiles.add(path); <del> } <del> const checkedOptimizationEntries = new Set(); <del> /** <del> * @param {SnapshotOptimizationEntry} entry optimization entry <del> * @returns {void} <del> */ <del> const increaseSharedAndStoreOptimizationEntry = entry => { <del> if (entry.children !== undefined) { <del> entry.children.forEach(increaseSharedAndStoreOptimizationEntry); <del> } <del> entry.shared++; <del> storeOptimizationEntry(entry); <del> }; <del> /** <del> * @param {SnapshotOptimizationEntry} entry optimization entry <del> * @returns {void} <del> */ <del> const storeOptimizationEntry = entry => { <del> for (const path of entry.snapshotContent) { <del> const old = this._snapshotOptimization.get(path); <del> if (old.shared < entry.shared) { <del> this._snapshotOptimization.set(path, entry); <del> } <del> capturedFiles.delete(path); <del> } <del> }; <del> capturedFiles: for (const path of capturedFiles) { <del> const optimizationEntry = this._snapshotOptimization.get(path); <del> if (optimizationEntry === undefined) { <del> unsetOptimizationEntries.add(path); <del> continue; <del> } <del> if (checkedOptimizationEntries.has(optimizationEntry)) continue; <del> const snapshot = optimizationEntry.snapshot; <del> if (optimizationEntry.shared > 0) { <del> // It's a shared snapshot <del> // We can't change it, so we can only use it when all files match <del> // and startTime is compatible <del> if ( <del> startTime && <del> (!snapshot.startTime || snapshot.startTime > startTime) <del> ) { <del> continue; <del> } <del> const nonSharedFiles = new Set(); <del> for (const path of optimizationEntry.snapshotContent) { <del> if (!capturedFiles.has(path)) { <del> if (!snapshot.fileTimestamps.has(path)) { <del> // File is not shared and can't be removed from the snapshot <del> // because it's in a child of the snapshot <del> checkedOptimizationEntries.add(optimizationEntry); <del> continue capturedFiles; <del> } <del> nonSharedFiles.add(path); <del> continue; <del> } <del> } <del> if (nonSharedFiles.size === 0) { <del> // The complete snapshot is shared <del> // add it as child <del> children.add(snapshot); <del> increaseSharedAndStoreOptimizationEntry(optimizationEntry); <del> } else { <del> // Only a part of the snapshot is shared <del> // Extract common timestamps from both snapshots <del> const commonMap = new Map(); <del> for (const [path, ts] of snapshot.fileTimestamps) { <del> if (nonSharedFiles.has(path)) continue; <del> commonMap.set(path, ts); <del> snapshot.fileTimestamps.delete(path); <del> } <del> // Create and attach snapshot <del> /** @type {Snapshot} */ <del> const commonSnapshot = { <del> startTime: <del> startTime && snapshot.startTime <del> ? Math.min(startTime, snapshot.startTime) <del> : startTime || snapshot.startTime, <del> fileTimestamps: commonMap <del> }; <del> children.add(commonSnapshot); <del> if (!snapshot.children) snapshot.children = new Set(); <del> snapshot.children.add(commonSnapshot); <del> // Create optimization entry <del> const newEntry = { <del> snapshot: commonSnapshot, <del> shared: optimizationEntry.shared + 1, <del> snapshotContent: new Set(commonMap.keys()), <del> children: undefined <del> }; <del> if (optimizationEntry.children === undefined) <del> optimizationEntry.children = new Set(); <del> optimizationEntry.children.add(newEntry); <del> storeOptimizationEntry(newEntry); <del> } <del> } else { <del> // It's a unshared snapshot <del> // We can extract a common shared snapshot <del> // with all common files <del> const commonMap = new Map(); <del> for (const path of capturedFiles) { <del> const ts = snapshot.fileTimestamps.get(path); <del> if (ts === undefined) continue; <del> commonMap.set(path, ts); <del> } <del> if (commonMap.size < 2) { <del> // Common part it too small <del> continue capturedFiles; <del> } <del> // Create and attach snapshot <del> /** @type {Snapshot} */ <del> const commonSnapshot = { <del> startTime: <del> startTime && snapshot.startTime <del> ? Math.min(startTime, snapshot.startTime) <del> : startTime || snapshot.startTime, <del> fileTimestamps: commonMap <del> }; <del> children.add(commonSnapshot); <del> if (!snapshot.children) snapshot.children = new Set(); <del> snapshot.children.add(commonSnapshot); <del> // Remove files from snapshot <del> for (const path of commonMap.keys()) <del> snapshot.fileTimestamps.delete(path); <del> // Create optimization entry <del> storeOptimizationEntry({ <del> snapshot: commonSnapshot, <del> shared: 2, <del> snapshotContent: new Set(commonMap.keys()), <del> children: undefined <del> }); <del> } <del> } <add> const capturedFiles = captureNonManaged(files); <add> unsharedFileTimestamps = this._fileTimestampsOptimization.optimize( <add> capturedFiles, <add> startTime, <add> children <add> ); <ide> for (const path of capturedFiles) { <ide> const cache = this._fileTimestamps.get(path); <ide> if (cache !== undefined) { <ide> class FileSystemInfo { <ide> } <ide> if (directories) { <ide> if (options && options.hash) { <del> directories: for (const path of directories) { <del> for (const immutablePath of this.immutablePathsWithSlash) { <del> if (path.startsWith(immutablePath)) { <del> continue directories; <del> } <del> } <del> for (const managedPath of this.managedPathsWithSlash) { <del> if (path.startsWith(managedPath)) { <del> const managedItem = getManagedItem(managedPath, path); <del> if (managedItem) { <del> managedItems.add(managedItem); <del> continue directories; <del> } <del> } <del> } <add> for (const path of directories) { <add> if (checkManaged(path)) continue; <ide> const cache = this._contextHashes.get(path); <ide> if (cache !== undefined) { <ide> contextHashes.set(path, cache); <ide> class FileSystemInfo { <ide> } <ide> } <ide> } else { <del> directories: for (const path of directories) { <del> for (const immutablePath of this.immutablePathsWithSlash) { <del> if (path.startsWith(immutablePath)) { <del> continue directories; <del> } <del> } <del> for (const managedPath of this.managedPathsWithSlash) { <del> if (path.startsWith(managedPath)) { <del> const managedItem = getManagedItem(managedPath, path); <del> if (managedItem) { <del> managedItems.add(managedItem); <del> continue directories; <del> } <del> } <del> } <add> for (const path of directories) { <add> if (checkManaged(path)) continue; <ide> const cache = this._contextTimestamps.get(path); <ide> if (cache !== undefined) { <ide> if (cache !== "ignore") { <ide> class FileSystemInfo { <ide> } <ide> } <ide> if (missing) { <del> missing: for (const path of missing) { <del> for (const immutablePath of this.immutablePathsWithSlash) { <del> if (path.startsWith(immutablePath)) { <del> continue missing; <del> } <del> } <del> for (const managedPath of this.managedPathsWithSlash) { <del> if (path.startsWith(managedPath)) { <del> const managedItem = getManagedItem(managedPath, path); <del> if (managedItem) { <del> managedItems.add(managedItem); <del> continue missing; <del> } <del> } <del> } <add> for (const path of missing) { <add> if (checkManaged(path)) continue; <ide> const cache = this._fileTimestamps.get(path); <ide> if (cache !== undefined) { <ide> if (cache !== "ignore") {
1
Javascript
Javascript
fetch dom node lazily for updates
27996377e0da502b6d9fccd2018d7919c3de6733
<ide><path>src/renderers/dom/shared/ReactDOMComponent.js <ide> ReactDOMComponent.Mixin = { <ide> break; <ide> } <ide> <del> var node = ReactMount.getNode(this._rootNodeID); <ide> assertValidProps(this, nextProps); <del> this._updateDOMProperties(lastProps, nextProps, transaction, node); <add> this._updateDOMProperties(lastProps, nextProps, transaction, null); <ide> this._updateDOMChildren( <ide> lastProps, <ide> nextProps, <ide> ReactDOMComponent.Mixin = { <ide> * @param {object} lastProps <ide> * @param {object} nextProps <ide> * @param {ReactReconcileTransaction} transaction <add> * @param {?DOMElement} node <ide> */ <ide> _updateDOMProperties: function(lastProps, nextProps, transaction, node) { <ide> var propKey; <ide> ReactDOMComponent.Mixin = { <ide> } else if ( <ide> DOMProperty.properties[propKey] || <ide> DOMProperty.isCustomAttribute(propKey)) { <add> if (!node) { <add> node = ReactMount.getNode(this._rootNodeID); <add> } <ide> DOMPropertyOperations.deleteValueForProperty(node, propKey); <ide> } <ide> } <ide> ReactDOMComponent.Mixin = { <ide> deleteListener(this._rootNodeID, propKey); <ide> } <ide> } else if (isCustomComponent(this._tag, nextProps)) { <add> if (!node) { <add> node = ReactMount.getNode(this._rootNodeID); <add> } <ide> DOMPropertyOperations.setValueForAttribute( <ide> node, <ide> propKey, <ide> ReactDOMComponent.Mixin = { <ide> } else if ( <ide> DOMProperty.properties[propKey] || <ide> DOMProperty.isCustomAttribute(propKey)) { <add> if (!node) { <add> node = ReactMount.getNode(this._rootNodeID); <add> } <ide> // If we're updating to null or undefined, we should remove the property <ide> // from the DOM node instead of inadvertantly setting to a string. This <ide> // brings us in line with the same behavior we have on initial render. <ide> ReactDOMComponent.Mixin = { <ide> } <ide> } <ide> if (styleUpdates) { <add> if (!node) { <add> node = ReactMount.getNode(this._rootNodeID); <add> } <ide> CSSPropertyOperations.setValueForStyles(node, styleUpdates); <ide> } <ide> },
1
Ruby
Ruby
fix documentation mistakes
2033db171ad88d0cbee719cd603bf76aa3dda5a9
<ide><path>actionpack/lib/action_view/helpers/asset_tag_helper.rb <ide> module AssetTagHelper <ide> # * <tt>:title</tt> - Specify the title of the link, defaults to the +type+ <ide> # <ide> # ==== Examples <del> # auto_discovery_link_tag # => <del> # <link rel="alternate" type="application/rss+xml" title="RSS" href="http://www.currenthost.com/controller/action" /> <del> # auto_discovery_link_tag(:atom) # => <del> # <link rel="alternate" type="application/atom+xml" title="ATOM" href="http://www.currenthost.com/controller/action" /> <del> # auto_discovery_link_tag(:rss, {:action => "feed"}) # => <del> # <link rel="alternate" type="application/rss+xml" title="RSS" href="http://www.currenthost.com/controller/feed" /> <del> # auto_discovery_link_tag(:rss, {:action => "feed"}, {:title => "My RSS"}) # => <del> # <link rel="alternate" type="application/rss+xml" title="My RSS" href="http://www.currenthost.com/controller/feed" /> <del> # auto_discovery_link_tag(:rss, {:controller => "news", :action => "feed"}) # => <del> # <link rel="alternate" type="application/rss+xml" title="RSS" href="http://www.currenthost.com/news/feed" /> <del> # auto_discovery_link_tag(:rss, "http://www.example.com/feed.rss", {:title => "Example RSS"}) # => <del> # <link rel="alternate" type="application/rss+xml" title="Example RSS" href="http://www.example.com/feed" /> <add> # auto_discovery_link_tag <add> # # => <link rel="alternate" type="application/rss+xml" title="RSS" href="http://www.currenthost.com/controller/action" /> <add> # auto_discovery_link_tag(:atom) <add> # # => <link rel="alternate" type="application/atom+xml" title="ATOM" href="http://www.currenthost.com/controller/action" /> <add> # auto_discovery_link_tag(:rss, {:action => "feed"}) <add> # # => <link rel="alternate" type="application/rss+xml" title="RSS" href="http://www.currenthost.com/controller/feed" /> <add> # auto_discovery_link_tag(:rss, {:action => "feed"}, {:title => "My RSS"}) <add> # # => <link rel="alternate" type="application/rss+xml" title="My RSS" href="http://www.currenthost.com/controller/feed" /> <add> # auto_discovery_link_tag(:rss, {:controller => "news", :action => "feed"}) <add> # # => <link rel="alternate" type="application/rss+xml" title="RSS" href="http://www.currenthost.com/news/feed" /> <add> # auto_discovery_link_tag(:rss, "http://www.example.com/feed.rss", {:title => "Example RSS"}) <add> # # => <link rel="alternate" type="application/rss+xml" title="Example RSS" href="http://www.example.com/feed" /> <ide> def auto_discovery_link_tag(type = :rss, url_options = {}, tag_options = {}) <ide> tag( <ide> "link", <ide> def font_url(source) <ide> # width="30" and height="45". <tt>:size</tt> will be ignored if the <ide> # value is not in the correct format. <ide> # <del> # image_tag("icon") # => <del> # <img src="/assets/icon" alt="Icon" /> <del> # image_tag("icon.png") # => <del> # <img src="/assets/icon.png" alt="Icon" /> <del> # image_tag("icon.png", :size => "16x10", :alt => "Edit Entry") # => <del> # <img src="/assets/icon.png" width="16" height="10" alt="Edit Entry" /> <del> # image_tag("/icons/icon.gif", :size => "16x16") # => <del> # <img src="/icons/icon.gif" width="16" height="16" alt="Icon" /> <del> # image_tag("/icons/icon.gif", :height => '32', :width => '32') # => <del> # <img alt="Icon" height="32" src="/icons/icon.gif" width="32" /> <del> # image_tag("/icons/icon.gif", :class => "menu_icon") # => <del> # <img alt="Icon" class="menu_icon" src="/icons/icon.gif" /> <add> # image_tag("icon") <add> # # => <img src="/assets/icon" alt="Icon" /> <add> # image_tag("icon.png") <add> # # => <img src="/assets/icon.png" alt="Icon" /> <add> # image_tag("icon.png", :size => "16x10", :alt => "Edit Entry") <add> # # => <img src="/assets/icon.png" width="16" height="10" alt="Edit Entry" /> <add> # image_tag("/icons/icon.gif", :size => "16x16") <add> # # => <img src="/icons/icon.gif" width="16" height="16" alt="Icon" /> <add> # image_tag("/icons/icon.gif", :height => '32', :width => '32') <add> # # => <img alt="Icon" height="32" src="/icons/icon.gif" width="32" /> <add> # image_tag("/icons/icon.gif", :class => "menu_icon") <add> # # => <img alt="Icon" class="menu_icon" src="/icons/icon.gif" /> <ide> def image_tag(source, options={}) <ide> options = options.symbolize_keys <ide> <ide> def image_alt(src) <ide> # width="30" and height="45". <tt>:size</tt> will be ignored if the <ide> # value is not in the correct format. <ide> # <del> # video_tag("trailer") # => <del> # <video src="/videos/trailer" /> <del> # video_tag("trailer.ogg") # => <del> # <video src="/videos/trailer.ogg" /> <del> # video_tag("trailer.ogg", :controls => true, :autobuffer => true) # => <del> # <video autobuffer="autobuffer" controls="controls" src="/videos/trailer.ogg" /> <del> # video_tag("trailer.m4v", :size => "16x10", :poster => "screenshot.png") # => <del> # <video src="/videos/trailer.m4v" width="16" height="10" poster="/assets/screenshot.png" /> <del> # video_tag("/trailers/hd.avi", :size => "16x16") # => <del> # <video src="/trailers/hd.avi" width="16" height="16" /> <del> # video_tag("/trailers/hd.avi", :height => '32', :width => '32') # => <del> # <video height="32" src="/trailers/hd.avi" width="32" /> <del> # video_tag("trailer.ogg", "trailer.flv") # => <del> # <video><source src="/videos/trailer.ogg" /><source src="/videos/trailer.flv" /></video> <del> # video_tag(["trailer.ogg", "trailer.flv"]) # => <del> # <video><source src="/videos/trailer.ogg" /><source src="/videos/trailer.flv" /></video> <del> # video_tag(["trailer.ogg", "trailer.flv"], :size => "160x120") # => <del> # <video height="120" width="160"><source src="/videos/trailer.ogg" /><source src="/videos/trailer.flv" /></video> <add> # video_tag("trailer") <add> # # => <video src="/videos/trailer" /> <add> # video_tag("trailer.ogg") <add> # # => <video src="/videos/trailer.ogg" /> <add> # video_tag("trailer.ogg", :controls => true, :autobuffer => true) <add> # # => <video autobuffer="autobuffer" controls="controls" src="/videos/trailer.ogg" /> <add> # video_tag("trailer.m4v", :size => "16x10", :poster => "screenshot.png") <add> # # => <video src="/videos/trailer.m4v" width="16" height="10" poster="/assets/screenshot.png" /> <add> # video_tag("/trailers/hd.avi", :size => "16x16") <add> # # => <video src="/trailers/hd.avi" width="16" height="16" /> <add> # video_tag("/trailers/hd.avi", :height => '32', :width => '32') <add> # # => <video height="32" src="/trailers/hd.avi" width="32" /> <add> # video_tag("trailer.ogg", "trailer.flv") <add> # # => <video><source src="/videos/trailer.ogg" /><source src="/videos/trailer.flv" /></video> <add> # video_tag(["trailer.ogg", "trailer.flv"]) <add> # # => <video><source src="/videos/trailer.ogg" /><source src="/videos/trailer.flv" /></video> <add> # video_tag(["trailer.ogg", "trailer.flv"], :size => "160x120") <add> # # => <video height="120" width="160"><source src="/videos/trailer.ogg" /><source src="/videos/trailer.flv" /></video> <ide> def video_tag(*sources) <ide> multiple_sources_tag('video', sources) do |options| <ide> options[:poster] = path_to_image(options[:poster]) if options[:poster] <ide><path>actionpack/lib/action_view/helpers/form_helper.rb <ide> def fields_for(record_name, record_object = nil, options = {}, &block) <ide> # label(:post, :title) <ide> # # => <label for="post_title">Title</label> <ide> # <del> # You can localize your labels based on model and attribute names. <del> # For example you can define the following in your locale (e.g. en.yml) <add> # You can localize your labels based on model and attribute names. <add> # For example you can define the following in your locale (e.g. en.yml) <ide> # <ide> # helpers: <ide> # label: <ide> # post: <ide> # body: "Write your entire text here" <ide> # <del> # Which then will result in <add> # Which then will result in <ide> # <ide> # label(:post, :body) <ide> # # => <label for="post_body">Write your entire text here</label>
2
Javascript
Javascript
fix typo in `avoid-prototype-pollution` lint rule
3303a10f322dbc351deb9ca8c33310c77ae46a69
<ide><path>tools/eslint-rules/avoid-prototype-pollution.js <ide> module.exports = { <ide> [CallExpression('PromisePrototypeCatch')](node) { <ide> context.report({ <ide> node, <del> message: '%Promise.prototype.catch% look up the `then` property of ' + <add> message: '%Promise.prototype.catch% looks up the `then` property of ' + <ide> 'the `this` argument, use PromisePrototypeThen instead', <ide> }); <ide> }, <ide> <ide> [CallExpression('PromisePrototypeFinally')](node) { <ide> context.report({ <ide> node, <del> message: '%Promise.prototype.finally% look up the `then` property of ' + <add> message: '%Promise.prototype.finally% looks up the `then` property of ' + <ide> 'the `this` argument, use SafePromisePrototypeFinally or ' + <ide> 'try/finally instead', <ide> });
1
Ruby
Ruby
add ghc@8.6 to binary formula urls whitelist
f60e2a0c4a496ddfd2e2f69f499cb229deba3f75
<ide><path>Library/Homebrew/rubocops/urls.rb <ide> class Urls < FormulaCop <ide> fpc <ide> ghc <ide> ghc@8.2 <add> ghc@8.6 <ide> go <ide> go@1.9 <ide> go@1.10
1
Java
Java
remove utility functions from public api
56b9feaf4257c86f5f952677e3529b09cb16a620
<ide><path>src/main/java/rx/Observable.java <ide> */ <ide> package rx; <ide> <del>import static rx.functions.Functions.alwaysFalse; <del> <ide> import java.util.*; <ide> import java.util.concurrent.*; <ide> <ide> import rx.exceptions.*; <ide> import rx.functions.*; <ide> import rx.internal.operators.*; <ide> import rx.internal.util.ScalarSynchronousObservable; <add>import rx.internal.util.UtilityFunctions; <add> <ide> import rx.observables.*; <ide> import rx.observers.SafeSubscriber; <ide> import rx.plugins.*; <ide> public final <T2> Observable<T2> dematerialize() { <ide> * @see <a href="http://msdn.microsoft.com/en-us/library/hh229764.aspx">MSDN: Observable.distinct</a> <ide> */ <ide> public final Observable<T> distinct() { <del> return lift(new OperatorDistinct<T, T>(Functions.<T>identity())); <add> return lift(new OperatorDistinct<T, T>(UtilityFunctions.<T>identity())); <ide> } <ide> <ide> /** <ide> public final <U> Observable<T> distinct(Func1<? super T, ? extends U> keySelecto <ide> * @see <a href="http://msdn.microsoft.com/en-us/library/hh229494.aspx">MSDN: Observable.distinctUntilChanged</a> <ide> */ <ide> public final Observable<T> distinctUntilChanged() { <del> return lift(new OperatorDistinctUntilChanged<T, T>(Functions.<T>identity())); <add> return lift(new OperatorDistinctUntilChanged<T, T>(UtilityFunctions.<T>identity())); <ide> } <ide> <ide> /** <ide> public final <T2, D1, D2, R> Observable<R> groupJoin(Observable<T2> right, Func1 <ide> * @see <a href="http://msdn.microsoft.com/en-us/library/hh229242.aspx">MSDN: Observable.IgnoreElements</a> <ide> */ <ide> public final Observable<T> ignoreElements() { <del> return filter(alwaysFalse()); <add> return filter(UtilityFunctions.alwaysFalse()); <ide> } <ide> <ide> /** <ide> public final Observable<T> ignoreElements() { <ide> * @see <a href= "http://msdn.microsoft.com/en-us/library/hh229905.aspx">MSDN: Observable.Any</a> <ide> */ <ide> public final Observable<Boolean> isEmpty() { <del> return lift(new OperatorAny<T>(Functions.alwaysTrue(), true)); <add> return lift(new OperatorAny<T>(UtilityFunctions.alwaysTrue(), true)); <ide> } <ide> <ide> /** <ide> public final Observable<List<T>> toList() { <ide> * @see <a href="http://msdn.microsoft.com/en-us/library/hh229137.aspx">MSDN: Observable.ToDictionary</a> <ide> */ <ide> public final <K> Observable<Map<K, T>> toMap(Func1<? super T, ? extends K> keySelector) { <del> return lift(new OperatorToMap<T, K, T>(keySelector, Functions.<T>identity())); <add> return lift(new OperatorToMap<T, K, T>(keySelector, UtilityFunctions.<T>identity())); <ide> } <ide> <ide> /** <ide> public final <K, V> Observable<Map<K, V>> toMap(Func1<? super T, ? extends K> ke <ide> * @see <a href="http://msdn.microsoft.com/en-us/library/hh212098.aspx">MSDN: Observable.ToLookup</a> <ide> */ <ide> public final <K> Observable<Map<K, Collection<T>>> toMultimap(Func1<? super T, ? extends K> keySelector) { <del> return lift(new OperatorToMultimap<T, K, T>(keySelector, Functions.<T>identity())); <add> return lift(new OperatorToMultimap<T, K, T>(keySelector, UtilityFunctions.<T>identity())); <ide> } <ide> <ide> /** <ide><path>src/main/java/rx/functions/Functions.java <ide> public Void call(Object... args) { <ide> }; <ide> } <ide> <del> /** <del> * Returns a function that always returns {@code true}. <del> * <del> * @return a {@link Func1} that accepts an Object and returns the Boolean {@code true} <del> */ <del> public static <T> Func1<? super T, Boolean> alwaysTrue() { <del> return AlwaysTrue.INSTANCE; <del> } <del> <del> /** <del> * Returns a function that always returns {@code false}. <del> * <del> * @return a {@link Func1} that accepts an Object and returns the Boolean {@code false} <del> */ <del> public static <T> Func1<? super T, Boolean> alwaysFalse() { <del> return AlwaysFalse.INSTANCE; <del> } <del> <del> /** <del> * Returns a function that always returns the Object it is passed. <del> * <del> * @return a {@link Func1} that accepts an Object and returns the same Object <del> */ <del> public static <T> Func1<T, T> identity() { <del> return new Func1<T, T>() { <del> @Override <del> public T call(T o) { <del> return o; <del> } <del> }; <del> } <del> <del> private enum AlwaysTrue implements Func1<Object, Boolean> { <del> INSTANCE; <del> <del> @Override <del> public Boolean call(Object o) { <del> return true; <del> } <del> } <del> <del> private enum AlwaysFalse implements Func1<Object, Boolean> { <del> INSTANCE; <del> <del> @Override <del> public Boolean call(Object o) { <del> return false; <del> } <del> } <del> <del> /** <del> * Returns a function that merely returns {@code null}, without side effects. <del> * <del> * @return a function that returns {@code null} <del> */ <del> @SuppressWarnings("unchecked") <del> public static <T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, R> NullFunction<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, R> returnNull() { <del> return NULL_FUNCTION; <del> } <del> <del> @SuppressWarnings("rawtypes") <del> private static final NullFunction NULL_FUNCTION = new NullFunction(); <del> <del> private static final class NullFunction<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, R> implements <del> Func0<R>, <del> Func1<T0, R>, <del> Func2<T0, T1, R>, <del> Func3<T0, T1, T2, R>, <del> Func4<T0, T1, T2, T3, R>, <del> Func5<T0, T1, T2, T3, T4, R>, <del> Func6<T0, T1, T2, T3, T4, T5, R>, <del> Func7<T0, T1, T2, T3, T4, T5, T6, R>, <del> Func8<T0, T1, T2, T3, T4, T5, T6, T7, R>, <del> Func9<T0, T1, T2, T3, T4, T5, T6, T7, T8, R>, <del> FuncN<R> { <del> @Override <del> public R call() { <del> return null; <del> } <del> <del> @Override <del> public R call(T0 t1) { <del> return null; <del> } <del> <del> @Override <del> public R call(T0 t1, T1 t2) { <del> return null; <del> } <del> <del> @Override <del> public R call(T0 t1, T1 t2, T2 t3) { <del> return null; <del> } <del> <del> @Override <del> public R call(T0 t1, T1 t2, T2 t3, T3 t4) { <del> return null; <del> } <del> <del> @Override <del> public R call(T0 t1, T1 t2, T2 t3, T3 t4, T4 t5) { <del> return null; <del> } <del> <del> @Override <del> public R call(T0 t1, T1 t2, T2 t3, T3 t4, T4 t5, T5 t6) { <del> return null; <del> } <del> <del> @Override <del> public R call(T0 t1, T1 t2, T2 t3, T3 t4, T4 t5, T5 t6, T6 t7) { <del> return null; <del> } <del> <del> @Override <del> public R call(T0 t1, T1 t2, T2 t3, T3 t4, T4 t5, T5 t6, T6 t7, T7 t8) { <del> return null; <del> } <del> <del> @Override <del> public R call(T0 t1, T1 t2, T2 t3, T3 t4, T4 t5, T5 t6, T6 t7, T7 t8, T8 t9) { <del> return null; <del> } <del> <del> @Override <del> public R call(Object... args) { <del> return null; <del> } <del> } <ide> } <ide><path>src/main/java/rx/internal/operators/OperatorSequenceEqual.java <ide> import rx.Observable; <ide> import rx.functions.Func1; <ide> import rx.functions.Func2; <del>import rx.functions.Functions; <add>import rx.internal.util.UtilityFunctions; <ide> <ide> /** <ide> * Returns an {@link Observable} that emits a single {@code Boolean} value that indicates whether two source <ide> public Boolean call(Object t1, Object t2) { <ide> return equality.call((T)t1, (T)t2); <ide> } <ide> <del> }).all(Functions.<Boolean> identity()); <add> }).all(UtilityFunctions.<Boolean> identity()); <ide> } <ide> } <ide><path>src/main/java/rx/internal/util/UtilityFunctions.java <add>/** <add> * Copyright 2014 Netflix, Inc. <add> * <add> * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in <add> * compliance with the License. You may obtain a copy of the License at <add> * <add> * http://www.apache.org/licenses/LICENSE-2.0 <add> * <add> * Unless required by applicable law or agreed to in writing, software distributed under the License is <add> * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See <add> * the License for the specific language governing permissions and limitations under the License. <add> */ <add>package rx.internal.util; <add> <add>import rx.functions.Func0; <add>import rx.functions.Func1; <add>import rx.functions.Func2; <add>import rx.functions.Func3; <add>import rx.functions.Func4; <add>import rx.functions.Func5; <add>import rx.functions.Func6; <add>import rx.functions.Func7; <add>import rx.functions.Func8; <add>import rx.functions.Func9; <add>import rx.functions.FuncN; <add> <add>/** <add> * Utility functions for internal use that we don't want part of the public API. <add> */ <add>public final class UtilityFunctions { <add> <add> /** <add> * Returns a function that always returns {@code true}. <add> * <add> * @return a {@link Func1} that accepts an Object and returns the Boolean {@code true} <add> */ <add> public static <T> Func1<? super T, Boolean> alwaysTrue() { <add> return AlwaysTrue.INSTANCE; <add> } <add> <add> /** <add> * Returns a function that always returns {@code false}. <add> * <add> * @return a {@link Func1} that accepts an Object and returns the Boolean {@code false} <add> */ <add> public static <T> Func1<? super T, Boolean> alwaysFalse() { <add> return AlwaysFalse.INSTANCE; <add> } <add> <add> /** <add> * Returns a function that always returns the Object it is passed. <add> * <add> * @return a {@link Func1} that accepts an Object and returns the same Object <add> */ <add> public static <T> Func1<T, T> identity() { <add> return new Func1<T, T>() { <add> @Override <add> public T call(T o) { <add> return o; <add> } <add> }; <add> } <add> <add> private enum AlwaysTrue implements Func1<Object, Boolean> { <add> INSTANCE; <add> <add> @Override <add> public Boolean call(Object o) { <add> return true; <add> } <add> } <add> <add> private enum AlwaysFalse implements Func1<Object, Boolean> { <add> INSTANCE; <add> <add> @Override <add> public Boolean call(Object o) { <add> return false; <add> } <add> } <add> <add> /** <add> * Returns a function that merely returns {@code null}, without side effects. <add> * <add> * @return a function that returns {@code null} <add> */ <add> @SuppressWarnings("unchecked") <add> public static <T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, R> NullFunction<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, R> returnNull() { <add> return NULL_FUNCTION; <add> } <add> <add> @SuppressWarnings("rawtypes") <add> private static final NullFunction NULL_FUNCTION = new NullFunction(); <add> <add> private static final class NullFunction<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, R> implements <add> Func0<R>, <add> Func1<T0, R>, <add> Func2<T0, T1, R>, <add> Func3<T0, T1, T2, R>, <add> Func4<T0, T1, T2, T3, R>, <add> Func5<T0, T1, T2, T3, T4, R>, <add> Func6<T0, T1, T2, T3, T4, T5, R>, <add> Func7<T0, T1, T2, T3, T4, T5, T6, R>, <add> Func8<T0, T1, T2, T3, T4, T5, T6, T7, R>, <add> Func9<T0, T1, T2, T3, T4, T5, T6, T7, T8, R>, <add> FuncN<R> { <add> @Override <add> public R call() { <add> return null; <add> } <add> <add> @Override <add> public R call(T0 t1) { <add> return null; <add> } <add> <add> @Override <add> public R call(T0 t1, T1 t2) { <add> return null; <add> } <add> <add> @Override <add> public R call(T0 t1, T1 t2, T2 t3) { <add> return null; <add> } <add> <add> @Override <add> public R call(T0 t1, T1 t2, T2 t3, T3 t4) { <add> return null; <add> } <add> <add> @Override <add> public R call(T0 t1, T1 t2, T2 t3, T3 t4, T4 t5) { <add> return null; <add> } <add> <add> @Override <add> public R call(T0 t1, T1 t2, T2 t3, T3 t4, T4 t5, T5 t6) { <add> return null; <add> } <add> <add> @Override <add> public R call(T0 t1, T1 t2, T2 t3, T3 t4, T4 t5, T5 t6, T6 t7) { <add> return null; <add> } <add> <add> @Override <add> public R call(T0 t1, T1 t2, T2 t3, T3 t4, T4 t5, T5 t6, T6 t7, T7 t8) { <add> return null; <add> } <add> <add> @Override <add> public R call(T0 t1, T1 t2, T2 t3, T3 t4, T4 t5, T5 t6, T6 t7, T7 t8, T8 t9) { <add> return null; <add> } <add> <add> @Override <add> public R call(Object... args) { <add> return null; <add> } <add> } <add> <add>} <ide><path>src/main/java/rx/observables/BlockingObservable.java <ide> import rx.internal.operators.BlockingOperatorNext; <ide> import rx.internal.operators.BlockingOperatorToFuture; <ide> import rx.internal.operators.BlockingOperatorToIterator; <add>import rx.internal.util.UtilityFunctions; <ide> <ide> /** <ide> * An extension of {@link Observable} that provides blocking operators. <ide> public T first(Func1<? super T, Boolean> predicate) { <ide> * @see <a href="http://msdn.microsoft.com/en-us/library/hh229320.aspx">MSDN: Observable.FirstOrDefault</a> <ide> */ <ide> public T firstOrDefault(T defaultValue) { <del> return blockForSingle(o.map(Functions.<T>identity()).firstOrDefault(defaultValue)); <add> return blockForSingle(o.map(UtilityFunctions.<T>identity()).firstOrDefault(defaultValue)); <ide> } <ide> <ide> /** <ide> public T firstOrDefault(T defaultValue) { <ide> * @see <a href="http://msdn.microsoft.com/en-us/library/hh229759.aspx">MSDN: Observable.FirstOrDefault</a> <ide> */ <ide> public T firstOrDefault(T defaultValue, Func1<? super T, Boolean> predicate) { <del> return blockForSingle(o.filter(predicate).map(Functions.<T>identity()).firstOrDefault(defaultValue)); <add> return blockForSingle(o.filter(predicate).map(UtilityFunctions.<T>identity()).firstOrDefault(defaultValue)); <ide> } <ide> <ide> /** <ide> public T last(final Func1<? super T, Boolean> predicate) { <ide> * @see <a href="http://msdn.microsoft.com/en-us/library/system.reactive.linq.observable.lastordefault.aspx">MSDN: Observable.LastOrDefault</a> <ide> */ <ide> public T lastOrDefault(T defaultValue) { <del> return blockForSingle(o.map(Functions.<T>identity()).lastOrDefault(defaultValue)); <add> return blockForSingle(o.map(UtilityFunctions.<T>identity()).lastOrDefault(defaultValue)); <ide> } <ide> <ide> /** <ide> public T lastOrDefault(T defaultValue) { <ide> * @see <a href="http://msdn.microsoft.com/en-us/library/system.reactive.linq.observable.lastordefault.aspx">MSDN: Observable.LastOrDefault</a> <ide> */ <ide> public T lastOrDefault(T defaultValue, Func1<? super T, Boolean> predicate) { <del> return blockForSingle(o.filter(predicate).map(Functions.<T>identity()).lastOrDefault(defaultValue)); <add> return blockForSingle(o.filter(predicate).map(UtilityFunctions.<T>identity()).lastOrDefault(defaultValue)); <ide> } <ide> <ide> /** <ide> public T single(Func1<? super T, Boolean> predicate) { <ide> * @see <a href="http://msdn.microsoft.com/en-us/library/system.reactive.linq.observable.singleordefault.aspx">MSDN: Observable.SingleOrDefault</a> <ide> */ <ide> public T singleOrDefault(T defaultValue) { <del> return blockForSingle(o.map(Functions.<T>identity()).singleOrDefault(defaultValue)); <add> return blockForSingle(o.map(UtilityFunctions.<T>identity()).singleOrDefault(defaultValue)); <ide> } <ide> <ide> /** <ide> public T singleOrDefault(T defaultValue) { <ide> * @see <a href="http://msdn.microsoft.com/en-us/library/system.reactive.linq.observable.singleordefault.aspx">MSDN: Observable.SingleOrDefault</a> <ide> */ <ide> public T singleOrDefault(T defaultValue, Func1<? super T, Boolean> predicate) { <del> return blockForSingle(o.filter(predicate).map(Functions.<T>identity()).singleOrDefault(defaultValue)); <add> return blockForSingle(o.filter(predicate).map(UtilityFunctions.<T>identity()).singleOrDefault(defaultValue)); <ide> } <ide> <ide> /** <ide><path>src/main/java/rx/subjects/ReplaySubject.java <ide> import rx.functions.Func1; <ide> import rx.functions.Functions; <ide> import rx.internal.operators.NotificationLite; <add>import rx.internal.util.UtilityFunctions; <ide> import rx.schedulers.Timestamped; <ide> import rx.subjects.ReplaySubject.NodeList.Node; <ide> import rx.subjects.SubjectSubscriptionManager.SubjectObserver; <ide> public void call(SubjectObserver<T> o) { <ide> /* public */ static <T> ReplaySubject<T> createUnbounded() { <ide> final BoundedState<T> state = new BoundedState<T>( <ide> new EmptyEvictionPolicy(), <del> Functions.identity(), <del> Functions.identity() <add> UtilityFunctions.identity(), <add> UtilityFunctions.identity() <ide> ); <ide> return createWithState(state, new DefaultOnAdd<T>(state)); <ide> } <ide> public void call(SubjectObserver<T> o) { <ide> public static <T> ReplaySubject<T> createWithSize(int size) { <ide> final BoundedState<T> state = new BoundedState<T>( <ide> new SizeEvictionPolicy(size), <del> Functions.identity(), <del> Functions.identity() <add> UtilityFunctions.identity(), <add> UtilityFunctions.identity() <ide> ); <ide> return createWithState(state, new DefaultOnAdd<T>(state)); <ide> } <ide><path>src/test/java/rx/internal/operators/OperatorAnyTest.java <ide> import static org.mockito.Mockito.times; <ide> import static org.mockito.Mockito.verify; <ide> <add>import java.util.Arrays; <add> <ide> import org.junit.Test; <ide> <ide> import rx.Observable; <ide> import rx.Observer; <ide> import rx.functions.Func1; <ide> import rx.functions.Functions; <del> <del>import java.util.Arrays; <add>import rx.internal.util.UtilityFunctions; <ide> <ide> public class OperatorAnyTest { <ide> <ide> @Test <ide> public void testAnyWithTwoItems() { <ide> Observable<Integer> w = Observable.just(1, 2); <del> Observable<Boolean> observable = w.exists(Functions.alwaysTrue()); <add> Observable<Boolean> observable = w.exists(UtilityFunctions.alwaysTrue()); <ide> <ide> @SuppressWarnings("unchecked") <ide> Observer<Boolean> observer = mock(Observer.class); <ide> public void testIsEmptyWithTwoItems() { <ide> @Test <ide> public void testAnyWithOneItem() { <ide> Observable<Integer> w = Observable.just(1); <del> Observable<Boolean> observable = w.exists(Functions.alwaysTrue()); <add> Observable<Boolean> observable = w.exists(UtilityFunctions.alwaysTrue()); <ide> <ide> @SuppressWarnings("unchecked") <ide> Observer<Boolean> observer = mock(Observer.class); <ide> public void testIsEmptyWithOneItem() { <ide> @Test <ide> public void testAnyWithEmpty() { <ide> Observable<Integer> w = Observable.empty(); <del> Observable<Boolean> observable = w.exists(Functions.alwaysTrue()); <add> Observable<Boolean> observable = w.exists(UtilityFunctions.alwaysTrue()); <ide> <ide> @SuppressWarnings("unchecked") <ide> Observer<Boolean> observer = mock(Observer.class); <ide><path>src/test/java/rx/internal/operators/OperatorGroupByTest.java <ide> import rx.functions.Action0; <ide> import rx.functions.Action1; <ide> import rx.functions.Func1; <del>import rx.functions.Functions; <add>import rx.internal.util.UtilityFunctions; <ide> import rx.observables.GroupedObservable; <ide> import rx.observers.TestSubscriber; <ide> import rx.schedulers.Schedulers; <ide> public Integer call(Integer t1) { <ide> return t1 * 2; <ide> } <ide> }; <del> Func1<Integer, Integer> identity = Functions.identity(); <add> Func1<Integer, Integer> identity = UtilityFunctions.identity(); <ide> <ide> @Before <ide> public void before() { <ide><path>src/test/java/rx/internal/operators/OperatorReduceTest.java <ide> import rx.exceptions.TestException; <ide> import rx.functions.Func1; <ide> import rx.functions.Func2; <del>import rx.functions.Functions; <add>import rx.internal.util.UtilityFunctions; <ide> <ide> public class OperatorReduceTest { <ide> @Mock <ide> public Integer call(Integer t1, Integer t2) { <ide> @Test <ide> public void testAggregateAsIntSum() { <ide> <del> Observable<Integer> result = Observable.just(1, 2, 3, 4, 5).reduce(0, sum).map(Functions.<Integer> identity()); <add> Observable<Integer> result = Observable.just(1, 2, 3, 4, 5).reduce(0, sum).map(UtilityFunctions.<Integer> identity()); <ide> <ide> result.subscribe(observer); <ide> <ide> public void testAggregateAsIntSum() { <ide> public void testAggregateAsIntSumSourceThrows() { <ide> Observable<Integer> result = Observable.concat(Observable.just(1, 2, 3, 4, 5), <ide> Observable.<Integer> error(new TestException())) <del> .reduce(0, sum).map(Functions.<Integer> identity()); <add> .reduce(0, sum).map(UtilityFunctions.<Integer> identity()); <ide> <ide> result.subscribe(observer); <ide> <ide> public Integer call(Integer t1, Integer t2) { <ide> }; <ide> <ide> Observable<Integer> result = Observable.just(1, 2, 3, 4, 5) <del> .reduce(0, sumErr).map(Functions.<Integer> identity()); <add> .reduce(0, sumErr).map(UtilityFunctions.<Integer> identity()); <ide> <ide> result.subscribe(observer); <ide> <ide><path>src/test/java/rx/internal/operators/OperatorTakeLastTest.java <ide> import rx.Observer; <ide> import rx.Subscriber; <ide> import rx.functions.Func1; <del>import rx.functions.Functions; <ide> import rx.internal.util.RxRingBuffer; <add>import rx.internal.util.UtilityFunctions; <ide> import rx.observers.TestSubscriber; <ide> import rx.schedulers.Schedulers; <ide> <ide> public void testIssue1522() { <ide> assertEquals(0, Observable <ide> .empty() <ide> .count() <del> .filter(Functions.alwaysFalse()) <add> .filter(UtilityFunctions.alwaysFalse()) <ide> .toList() <ide> .toBlocking().single().size()); <ide> } <ide><path>src/test/java/rx/internal/operators/OperatorToMapTest.java <ide> import rx.Observer; <ide> import rx.functions.Func0; <ide> import rx.functions.Func1; <del>import rx.functions.Functions; <add>import rx.internal.util.UtilityFunctions; <ide> <ide> public class OperatorToMapTest { <ide> @Mock <ide> public Integer call(String t1) { <ide> return t1.length(); <ide> } <ide> }; <del> Observable<Map<Integer, String>> mapped = source.toMap(lengthFunc, Functions.<String>identity(), mapFactory); <add> Observable<Map<Integer, String>> mapped = source.toMap(lengthFunc, UtilityFunctions.<String>identity(), mapFactory); <ide> <ide> Map<Integer, String> expected = new LinkedHashMap<Integer, String>(); <ide> expected.put(2, "bb"); <ide> public Integer call(String t1) { <ide> return t1.length(); <ide> } <ide> }; <del> Observable<Map<Integer, String>> mapped = source.toMap(lengthFunc, Functions.<String>identity(), mapFactory); <add> Observable<Map<Integer, String>> mapped = source.toMap(lengthFunc, UtilityFunctions.<String>identity(), mapFactory); <ide> <ide> Map<Integer, String> expected = new LinkedHashMap<Integer, String>(); <ide> expected.put(2, "bb"); <ide><path>src/test/java/rx/internal/operators/OperatorToMultimapTest.java <ide> import rx.Observer; <ide> import rx.functions.Func0; <ide> import rx.functions.Func1; <del>import rx.functions.Functions; <ide> import rx.internal.operators.OperatorToMultimap.DefaultMultimapCollectionFactory; <ide> import rx.internal.operators.OperatorToMultimap.DefaultToMultimapFactory; <add>import rx.internal.util.UtilityFunctions; <ide> <ide> public class OperatorToMultimapTest { <ide> @Mock <ide> protected boolean removeEldestEntry(Map.Entry<Integer, Collection<String>> eldes <ide> }; <ide> <ide> Observable<Map<Integer, Collection<String>>> mapped = source.toMultimap( <del> lengthFunc, Functions.<String>identity(), <add> lengthFunc, UtilityFunctions.<String>identity(), <ide> mapFactory, new DefaultMultimapCollectionFactory<Integer, String>()); <ide> <ide> Map<Integer, Collection<String>> expected = new HashMap<Integer, Collection<String>>(); <ide> public Collection<String> call(Integer t1) { <ide> }; <ide> <ide> Observable<Map<Integer, Collection<String>>> mapped = source.toMultimap( <del> lengthFunc, Functions.<String>identity(), <add> lengthFunc, UtilityFunctions.<String>identity(), <ide> new DefaultToMultimapFactory<Integer, String>(), collectionFactory); <ide> <ide> Map<Integer, Collection<String>> expected = new HashMap<Integer, Collection<String>>(); <ide> public Map<Integer, Collection<String>> call() { <ide> } <ide> }; <ide> <del> Observable<Map<Integer, Collection<String>>> mapped = source.toMultimap(lengthFunc, Functions.<String>identity(), mapFactory); <add> Observable<Map<Integer, Collection<String>>> mapped = source.toMultimap(lengthFunc, UtilityFunctions.<String>identity(), mapFactory); <ide> <ide> Map<Integer, Collection<String>> expected = new HashMap<Integer, Collection<String>>(); <ide> expected.put(2, Arrays.asList("cc", "dd")); <ide> public Collection<String> call(Integer t1) { <ide> } <ide> }; <ide> <del> Observable<Map<Integer, Collection<String>>> mapped = source.toMultimap(lengthFunc, Functions.<String>identity(), new DefaultToMultimapFactory<Integer, String>(), collectionFactory); <add> Observable<Map<Integer, Collection<String>>> mapped = source.toMultimap(lengthFunc, UtilityFunctions.<String>identity(), new DefaultToMultimapFactory<Integer, String>(), collectionFactory); <ide> <ide> Map<Integer, Collection<String>> expected = new HashMap<Integer, Collection<String>>(); <ide> expected.put(2, Arrays.asList("cc", "dd"));
12
Ruby
Ruby
fix http 422 when gist-logs sends an empty file
840a5c74185ee44546008bd585c3e5edbfa9528c
<ide><path>Library/Contributions/cmd/brew-gist-logs.rb <ide> def load_logs name <ide> logs = {} <ide> dir = (HOMEBREW_LOGS/name) <ide> dir.children.sort.each do |file| <del> logs[file.basename.to_s] = {:content => file.read} <add> logs[file.basename.to_s] = {:content => (file.size == 0 ? "empty log" : file.read)} <ide> end if dir.exist? <ide> raise 'No logs.' if logs.empty? <ide> logs
1
Text
Text
replace "base" with "ubuntu" in documentation
c0969ed3d896c9add0a2cca7b9a9074cd138571b
<ide><path>docs/sources/reference/api/docker_remote_api_v1.10.md <ide> List containers <ide> [ <ide> { <ide> "Id": "8dfafdbc3a40", <del> "Image": "base:latest", <add> "Image": "ubuntu:latest", <ide> "Command": "echo 1", <ide> "Created": 1367854155, <ide> "Status": "Exit 0", <ide> List containers <ide> }, <ide> { <ide> "Id": "9cd87474be90", <del> "Image": "base:latest", <add> "Image": "ubuntu:latest", <ide> "Command": "echo 222222", <ide> "Created": 1367854155, <ide> "Status": "Exit 0", <ide> List containers <ide> }, <ide> { <ide> "Id": "3176a2479c92", <del> "Image": "base:latest", <add> "Image": "ubuntu:latest", <ide> "Command": "echo 3333333333333333", <ide> "Created": 1367854154, <ide> "Status": "Exit 0", <ide> List containers <ide> }, <ide> { <ide> "Id": "4cb07b47f9fb", <del> "Image": "base:latest", <add> "Image": "ubuntu:latest", <ide> "Command": "echo 444444444444444444444444444444444", <ide> "Created": 1367854152, <ide> "Status": "Exit 0", <ide> Create a container <ide> "Cmd":[ <ide> "date" <ide> ], <del> "Image":"base", <add> "Image":"ubuntu", <ide> "Volumes":{ <ide> "/tmp": {} <ide> }, <ide> Return low-level information on the container `id` <ide> "Cmd": [ <ide> "date" <ide> ], <del> "Image": "base", <add> "Image": "ubuntu", <ide> "Volumes": {}, <ide> "WorkingDir":"" <ide> <ide> Create an image, either by pull it from the registry or by importing <ide> <ide> **Example request**: <ide> <del> POST /images/create?fromImage=base HTTP/1.1 <add> POST /images/create?fromImage=ubuntu HTTP/1.1 <ide> <ide> **Example response**: <ide> <ide> Return low-level information on the image `name` <ide> <ide> **Example request**: <ide> <del> GET /images/base/json HTTP/1.1 <add> GET /images/ubuntu/json HTTP/1.1 <ide> <ide> **Example response**: <ide> <ide> Return low-level information on the image `name` <ide> "StdinOnce":false, <ide> "Env":null, <ide> "Cmd": ["/bin/bash"] <del> "Image":"base", <add> "Image":"ubuntu", <ide> "Volumes":null, <ide> "WorkingDir":"" <ide> }, <ide> Return the history of the image `name` <ide> <ide> **Example request**: <ide> <del> GET /images/base/history HTTP/1.1 <add> GET /images/ubuntu/history HTTP/1.1 <ide> <ide> **Example response**: <ide> <ide> and Docker images will report: <ide> HTTP/1.1 200 OK <ide> Content-Type: application/json <ide> <del> {"status": "create", "id": "dfdf82bd3881","from": "base:latest", "time":1374067924} <del> {"status": "start", "id": "dfdf82bd3881","from": "base:latest", "time":1374067924} <del> {"status": "stop", "id": "dfdf82bd3881","from": "base:latest", "time":1374067966} <del> {"status": "destroy", "id": "dfdf82bd3881","from": "base:latest", "time":1374067970} <add> {"status": "create", "id": "dfdf82bd3881","from": "ubuntu:latest", "time":1374067924} <add> {"status": "start", "id": "dfdf82bd3881","from": "ubuntu:latest", "time":1374067924} <add> {"status": "stop", "id": "dfdf82bd3881","from": "ubuntu:latest", "time":1374067966} <add> {"status": "destroy", "id": "dfdf82bd3881","from": "ubuntu:latest", "time":1374067970} <ide> <ide> Query Parameters: <ide> <ide><path>docs/sources/reference/api/docker_remote_api_v1.11.md <ide> List containers <ide> [ <ide> { <ide> "Id": "8dfafdbc3a40", <del> "Image": "base:latest", <add> "Image": "ubuntu:latest", <ide> "Command": "echo 1", <ide> "Created": 1367854155, <ide> "Status": "Exit 0", <ide> List containers <ide> }, <ide> { <ide> "Id": "9cd87474be90", <del> "Image": "base:latest", <add> "Image": "ubuntu:latest", <ide> "Command": "echo 222222", <ide> "Created": 1367854155, <ide> "Status": "Exit 0", <ide> List containers <ide> }, <ide> { <ide> "Id": "3176a2479c92", <del> "Image": "base:latest", <add> "Image": "ubuntu:latest", <ide> "Command": "echo 3333333333333333", <ide> "Created": 1367854154, <ide> "Status": "Exit 0", <ide> List containers <ide> }, <ide> { <ide> "Id": "4cb07b47f9fb", <del> "Image": "base:latest", <add> "Image": "ubuntu:latest", <ide> "Command": "echo 444444444444444444444444444444444", <ide> "Created": 1367854152, <ide> "Status": "Exit 0", <ide> Create a container <ide> "Cmd":[ <ide> "date" <ide> ], <del> "Image":"base", <add> "Image":"ubuntu", <ide> "Volumes":{ <ide> "/tmp": {} <ide> }, <ide> Return low-level information on the container `id` <ide> "date" <ide> ], <ide> "Dns": null, <del> "Image": "base", <add> "Image": "ubuntu", <ide> "Volumes": {}, <ide> "VolumesFrom": "", <ide> "WorkingDir": "" <ide> Create an image, either by pull it from the registry or by importing i <ide> <ide> **Example request**: <ide> <del> POST /images/create?fromImage=base HTTP/1.1 <add> POST /images/create?fromImage=ubuntu HTTP/1.1 <ide> <ide> **Example response**: <ide> <ide> Return low-level information on the image `name` <ide> <ide> **Example request**: <ide> <del> GET /images/base/json HTTP/1.1 <add> GET /images/ubuntu/json HTTP/1.1 <ide> <ide> **Example response**: <ide> <ide> Return low-level information on the image `name` <ide> "Env":null, <ide> "Cmd": ["/bin/bash"], <ide> "Dns":null, <del> "Image":"base", <add> "Image":"ubuntu", <ide> "Volumes":null, <ide> "VolumesFrom":"", <ide> "WorkingDir":"" <ide> Return the history of the image `name` <ide> <ide> **Example request**: <ide> <del> GET /images/base/history HTTP/1.1 <add> GET /images/ubuntu/history HTTP/1.1 <ide> <ide> **Example response**: <ide> <ide> and Docker images will report: <ide> HTTP/1.1 200 OK <ide> Content-Type: application/json <ide> <del> {"status": "create", "id": "dfdf82bd3881","from": "base:latest", "time":1374067924} <del> {"status": "start", "id": "dfdf82bd3881","from": "base:latest", "time":1374067924} <del> {"status": "stop", "id": "dfdf82bd3881","from": "base:latest", "time":1374067966} <del> {"status": "destroy", "id": "dfdf82bd3881","from": "base:latest", "time":1374067970} <add> {"status": "create", "id": "dfdf82bd3881","from": "ubuntu:latest", "time":1374067924} <add> {"status": "start", "id": "dfdf82bd3881","from": "ubuntu:latest", "time":1374067924} <add> {"status": "stop", "id": "dfdf82bd3881","from": "ubuntu:latest", "time":1374067966} <add> {"status": "destroy", "id": "dfdf82bd3881","from": "ubuntu:latest", "time":1374067970} <ide> <ide> Query Parameters: <ide> <ide><path>docs/sources/reference/api/docker_remote_api_v1.12.md <ide> List containers <ide> [ <ide> { <ide> "Id": "8dfafdbc3a40", <del> "Image": "base:latest", <add> "Image": "ubuntu:latest", <ide> "Command": "echo 1", <ide> "Created": 1367854155, <ide> "Status": "Exit 0", <ide> List containers <ide> }, <ide> { <ide> "Id": "9cd87474be90", <del> "Image": "base:latest", <add> "Image": "ubuntu:latest", <ide> "Command": "echo 222222", <ide> "Created": 1367854155, <ide> "Status": "Exit 0", <ide> List containers <ide> }, <ide> { <ide> "Id": "3176a2479c92", <del> "Image": "base:latest", <add> "Image": "ubuntu:latest", <ide> "Command": "echo 3333333333333333", <ide> "Created": 1367854154, <ide> "Status": "Exit 0", <ide> List containers <ide> }, <ide> { <ide> "Id": "4cb07b47f9fb", <del> "Image": "base:latest", <add> "Image": "ubuntu:latest", <ide> "Command": "echo 444444444444444444444444444444444", <ide> "Created": 1367854152, <ide> "Status": "Exit 0", <ide> Create a container <ide> "Cmd":[ <ide> "date" <ide> ], <del> "Image":"base", <add> "Image":"ubuntu", <ide> "Volumes":{ <ide> "/tmp": {} <ide> }, <ide> Return low-level information on the container `id` <ide> "date" <ide> ], <ide> "Dns": null, <del> "Image": "base", <add> "Image": "ubuntu", <ide> "Volumes": {}, <ide> "VolumesFrom": "", <ide> "WorkingDir": "" <ide> Create an image, either by pull it from the registry or by importing i <ide> <ide> **Example request**: <ide> <del> POST /images/create?fromImage=base HTTP/1.1 <add> POST /images/create?fromImage=ubuntu HTTP/1.1 <ide> <ide> **Example response**: <ide> <ide> Return low-level information on the image `name` <ide> <ide> **Example request**: <ide> <del> GET /images/base/json HTTP/1.1 <add> GET /images/ubuntu/json HTTP/1.1 <ide> <ide> **Example response**: <ide> <ide> Return low-level information on the image `name` <ide> "Env": null, <ide> "Cmd": ["/bin/bash"], <ide> "Dns": null, <del> "Image": "base", <add> "Image": "ubuntu", <ide> "Volumes": null, <ide> "VolumesFrom": "", <ide> "WorkingDir": "" <ide> Return the history of the image `name` <ide> <ide> **Example request**: <ide> <del> GET /images/base/history HTTP/1.1 <add> GET /images/ubuntu/history HTTP/1.1 <ide> <ide> **Example response**: <ide> <ide> and Docker images will report: <ide> HTTP/1.1 200 OK <ide> Content-Type: application/json <ide> <del> {"status": "create", "id": "dfdf82bd3881","from": "base:latest", "time":1374067924} <del> {"status": "start", "id": "dfdf82bd3881","from": "base:latest", "time":1374067924} <del> {"status": "stop", "id": "dfdf82bd3881","from": "base:latest", "time":1374067966} <del> {"status": "destroy", "id": "dfdf82bd3881","from": "base:latest", "time":1374067970} <add> {"status": "create", "id": "dfdf82bd3881","from": "ubuntu:latest", "time":1374067924} <add> {"status": "start", "id": "dfdf82bd3881","from": "ubuntu:latest", "time":1374067924} <add> {"status": "stop", "id": "dfdf82bd3881","from": "ubuntu:latest", "time":1374067966} <add> {"status": "destroy", "id": "dfdf82bd3881","from": "ubuntu:latest", "time":1374067970} <ide> <ide> Query Parameters: <ide> <ide><path>docs/sources/reference/api/docker_remote_api_v1.13.md <ide> List containers <ide> [ <ide> { <ide> "Id": "8dfafdbc3a40", <del> "Image": "base:latest", <add> "Image": "ubuntu:latest", <ide> "Command": "echo 1", <ide> "Created": 1367854155, <ide> "Status": "Exit 0", <ide> List containers <ide> }, <ide> { <ide> "Id": "9cd87474be90", <del> "Image": "base:latest", <add> "Image": "ubuntu:latest", <ide> "Command": "echo 222222", <ide> "Created": 1367854155, <ide> "Status": "Exit 0", <ide> List containers <ide> }, <ide> { <ide> "Id": "3176a2479c92", <del> "Image": "base:latest", <add> "Image": "ubuntu:latest", <ide> "Command": "echo 3333333333333333", <ide> "Created": 1367854154, <ide> "Status": "Exit 0", <ide> List containers <ide> }, <ide> { <ide> "Id": "4cb07b47f9fb", <del> "Image": "base:latest", <add> "Image": "ubuntu:latest", <ide> "Command": "echo 444444444444444444444444444444444", <ide> "Created": 1367854152, <ide> "Status": "Exit 0", <ide> Create a container <ide> "Cmd":[ <ide> "date" <ide> ], <del> "Image":"base", <add> "Image":"ubuntu", <ide> "Volumes":{ <ide> "/tmp": {} <ide> }, <ide> Return low-level information on the container `id` <ide> "date" <ide> ], <ide> "Dns": null, <del> "Image": "base", <add> "Image": "ubuntu", <ide> "Volumes": {}, <ide> "VolumesFrom": "", <ide> "WorkingDir": "" <ide> Create an image, either by pulling it from the registry or by importing it <ide> <ide> **Example request**: <ide> <del> POST /images/create?fromImage=base HTTP/1.1 <add> POST /images/create?fromImage=ubuntu HTTP/1.1 <ide> <ide> **Example response**: <ide> <ide> Return low-level information on the image `name` <ide> <ide> **Example request**: <ide> <del> GET /images/base/json HTTP/1.1 <add> GET /images/ubuntu/json HTTP/1.1 <ide> <ide> **Example response**: <ide> <ide> Return low-level information on the image `name` <ide> "Env": null, <ide> "Cmd": ["/bin/bash"], <ide> "Dns": null, <del> "Image": "base", <add> "Image": "ubuntu", <ide> "Volumes": null, <ide> "VolumesFrom": "", <ide> "WorkingDir": "" <ide> Return the history of the image `name` <ide> <ide> **Example request**: <ide> <del> GET /images/base/history HTTP/1.1 <add> GET /images/ubuntu/history HTTP/1.1 <ide> <ide> **Example response**: <ide> <ide> and Docker images will report: <ide> HTTP/1.1 200 OK <ide> Content-Type: application/json <ide> <del> {"status": "create", "id": "dfdf82bd3881","from": "base:latest", "time":1374067924} <del> {"status": "start", "id": "dfdf82bd3881","from": "base:latest", "time":1374067924} <del> {"status": "stop", "id": "dfdf82bd3881","from": "base:latest", "time":1374067966} <del> {"status": "destroy", "id": "dfdf82bd3881","from": "base:latest", "time":1374067970} <add> {"status": "create", "id": "dfdf82bd3881","from": "ubuntu:latest", "time":1374067924} <add> {"status": "start", "id": "dfdf82bd3881","from": "ubuntu:latest", "time":1374067924} <add> {"status": "stop", "id": "dfdf82bd3881","from": "ubuntu:latest", "time":1374067966} <add> {"status": "destroy", "id": "dfdf82bd3881","from": "ubuntu:latest", "time":1374067970} <ide> <ide> Query Parameters: <ide> <ide><path>docs/sources/reference/api/docker_remote_api_v1.14.md <ide> List containers <ide> [ <ide> { <ide> "Id": "8dfafdbc3a40", <del> "Image": "base:latest", <add> "Image": "ubuntu:latest", <ide> "Command": "echo 1", <ide> "Created": 1367854155, <ide> "Status": "Exit 0", <ide> List containers <ide> }, <ide> { <ide> "Id": "9cd87474be90", <del> "Image": "base:latest", <add> "Image": "ubuntu:latest", <ide> "Command": "echo 222222", <ide> "Created": 1367854155, <ide> "Status": "Exit 0", <ide> List containers <ide> }, <ide> { <ide> "Id": "3176a2479c92", <del> "Image": "base:latest", <add> "Image": "ubuntu:latest", <ide> "Command": "echo 3333333333333333", <ide> "Created": 1367854154, <ide> "Status": "Exit 0", <ide> List containers <ide> }, <ide> { <ide> "Id": "4cb07b47f9fb", <del> "Image": "base:latest", <add> "Image": "ubuntu:latest", <ide> "Command": "echo 444444444444444444444444444444444", <ide> "Created": 1367854152, <ide> "Status": "Exit 0", <ide> Create a container <ide> "Cmd":[ <ide> "date" <ide> ], <del> "Image":"base", <add> "Image":"ubuntu", <ide> "Volumes":{ <ide> "/tmp": {} <ide> }, <ide> Return low-level information on the container `id` <ide> "date" <ide> ], <ide> "Dns": null, <del> "Image": "base", <add> "Image": "ubuntu", <ide> "Volumes": {}, <ide> "VolumesFrom": "", <ide> "WorkingDir": "" <ide> Create an image, either by pulling it from the registry or by importing it <ide> <ide> **Example request**: <ide> <del> POST /images/create?fromImage=base HTTP/1.1 <add> POST /images/create?fromImage=ubuntu HTTP/1.1 <ide> <ide> **Example response**: <ide> <ide> Return low-level information on the image `name` <ide> <ide> **Example request**: <ide> <del> GET /images/base/json HTTP/1.1 <add> GET /images/ubuntu/json HTTP/1.1 <ide> <ide> **Example response**: <ide> <ide> Return low-level information on the image `name` <ide> "Env": null, <ide> "Cmd": ["/bin/bash"], <ide> "Dns": null, <del> "Image": "base", <add> "Image": "ubuntu", <ide> "Volumes": null, <ide> "VolumesFrom": "", <ide> "WorkingDir": "" <ide> Return the history of the image `name` <ide> <ide> **Example request**: <ide> <del> GET /images/base/history HTTP/1.1 <add> GET /images/ubuntu/history HTTP/1.1 <ide> <ide> **Example response**: <ide> <ide> and Docker images will report: <ide> HTTP/1.1 200 OK <ide> Content-Type: application/json <ide> <del> {"status": "create", "id": "dfdf82bd3881","from": "base:latest", "time":1374067924} <del> {"status": "start", "id": "dfdf82bd3881","from": "base:latest", "time":1374067924} <del> {"status": "stop", "id": "dfdf82bd3881","from": "base:latest", "time":1374067966} <del> {"status": "destroy", "id": "dfdf82bd3881","from": "base:latest", "time":1374067970} <add> {"status": "create", "id": "dfdf82bd3881","from": "ubuntu:latest", "time":1374067924} <add> {"status": "start", "id": "dfdf82bd3881","from": "ubuntu:latest", "time":1374067924} <add> {"status": "stop", "id": "dfdf82bd3881","from": "ubuntu:latest", "time":1374067966} <add> {"status": "destroy", "id": "dfdf82bd3881","from": "ubuntu:latest", "time":1374067970} <ide> <ide> Query Parameters: <ide> <ide><path>docs/sources/reference/api/docker_remote_api_v1.15.md <ide> List containers <ide> [ <ide> { <ide> "Id": "8dfafdbc3a40", <del> "Image": "base:latest", <add> "Image": "ubuntu:latest", <ide> "Command": "echo 1", <ide> "Created": 1367854155, <ide> "Status": "Exit 0", <ide> List containers <ide> }, <ide> { <ide> "Id": "9cd87474be90", <del> "Image": "base:latest", <add> "Image": "ubuntu:latest", <ide> "Command": "echo 222222", <ide> "Created": 1367854155, <ide> "Status": "Exit 0", <ide> List containers <ide> }, <ide> { <ide> "Id": "3176a2479c92", <del> "Image": "base:latest", <add> "Image": "ubuntu:latest", <ide> "Command": "echo 3333333333333333", <ide> "Created": 1367854154, <ide> "Status": "Exit 0", <ide> List containers <ide> }, <ide> { <ide> "Id": "4cb07b47f9fb", <del> "Image": "base:latest", <add> "Image": "ubuntu:latest", <ide> "Command": "echo 444444444444444444444444444444444", <ide> "Created": 1367854152, <ide> "Status": "Exit 0", <ide> Create a container <ide> "date" <ide> ], <ide> "Entrypoint": "", <del> "Image": "base", <add> "Image": "ubuntu", <ide> "Volumes": { <ide> "/tmp": {} <ide> }, <ide> Return low-level information on the container `id` <ide> "date" <ide> ], <ide> "Dns": null, <del> "Image": "base", <add> "Image": "ubuntu", <ide> "Volumes": {}, <ide> "VolumesFrom": "", <ide> "WorkingDir": "" <ide> Create an image, either by pulling it from the registry or by importing it <ide> <ide> **Example request**: <ide> <del> POST /images/create?fromImage=base HTTP/1.1 <add> POST /images/create?fromImage=ubuntu HTTP/1.1 <ide> <ide> **Example response**: <ide> <ide> Return low-level information on the image `name` <ide> <ide> **Example request**: <ide> <del> GET /images/base/json HTTP/1.1 <add> GET /images/ubuntu/json HTTP/1.1 <ide> <ide> **Example response**: <ide> <ide> Return low-level information on the image `name` <ide> "Env": null, <ide> "Cmd": ["/bin/bash"], <ide> "Dns": null, <del> "Image": "base", <add> "Image": "ubuntu", <ide> "Volumes": null, <ide> "VolumesFrom": "", <ide> "WorkingDir": "" <ide> Return the history of the image `name` <ide> <ide> **Example request**: <ide> <del> GET /images/base/history HTTP/1.1 <add> GET /images/ubuntu/history HTTP/1.1 <ide> <ide> **Example response**: <ide> <ide> and Docker images will report: <ide> HTTP/1.1 200 OK <ide> Content-Type: application/json <ide> <del> {"status": "create", "id": "dfdf82bd3881","from": "base:latest", "time":1374067924} <del> {"status": "start", "id": "dfdf82bd3881","from": "base:latest", "time":1374067924} <del> {"status": "stop", "id": "dfdf82bd3881","from": "base:latest", "time":1374067966} <del> {"status": "destroy", "id": "dfdf82bd3881","from": "base:latest", "time":1374067970} <add> {"status": "create", "id": "dfdf82bd3881","from": "ubuntu:latest", "time":1374067924} <add> {"status": "start", "id": "dfdf82bd3881","from": "ubuntu:latest", "time":1374067924} <add> {"status": "stop", "id": "dfdf82bd3881","from": "ubuntu:latest", "time":1374067966} <add> {"status": "destroy", "id": "dfdf82bd3881","from": "ubuntu:latest", "time":1374067970} <ide> <ide> Query Parameters: <ide> <ide><path>docs/sources/reference/api/docker_remote_api_v1.16.md <ide> List containers <ide> [ <ide> { <ide> "Id": "8dfafdbc3a40", <del> "Image": "base:latest", <add> "Image": "ubuntu:latest", <ide> "Command": "echo 1", <ide> "Created": 1367854155, <ide> "Status": "Exit 0", <ide> List containers <ide> }, <ide> { <ide> "Id": "9cd87474be90", <del> "Image": "base:latest", <add> "Image": "ubuntu:latest", <ide> "Command": "echo 222222", <ide> "Created": 1367854155, <ide> "Status": "Exit 0", <ide> List containers <ide> }, <ide> { <ide> "Id": "3176a2479c92", <del> "Image": "base:latest", <add> "Image": "ubuntu:latest", <ide> "Command": "echo 3333333333333333", <ide> "Created": 1367854154, <ide> "Status": "Exit 0", <ide> List containers <ide> }, <ide> { <ide> "Id": "4cb07b47f9fb", <del> "Image": "base:latest", <add> "Image": "ubuntu:latest", <ide> "Command": "echo 444444444444444444444444444444444", <ide> "Created": 1367854152, <ide> "Status": "Exit 0", <ide> Create a container <ide> "date" <ide> ], <ide> "Entrypoint": "", <del> "Image": "base", <add> "Image": "ubuntu", <ide> "Volumes": { <ide> "/tmp": {} <ide> }, <ide> Return low-level information on the container `id` <ide> "date" <ide> ], <ide> "Dns": null, <del> "Image": "base", <add> "Image": "ubuntu", <ide> "Volumes": {}, <ide> "VolumesFrom": "", <ide> "WorkingDir": "" <ide> Create an image, either by pulling it from the registry or by importing it <ide> <ide> **Example request**: <ide> <del> POST /images/create?fromImage=base HTTP/1.1 <add> POST /images/create?fromImage=ubuntu HTTP/1.1 <ide> <ide> **Example response**: <ide> <ide> Return low-level information on the image `name` <ide> <ide> **Example request**: <ide> <del> GET /images/base/json HTTP/1.1 <add> GET /images/ubuntu/json HTTP/1.1 <ide> <ide> **Example response**: <ide> <ide> Return low-level information on the image `name` <ide> "Env": null, <ide> "Cmd": ["/bin/bash"], <ide> "Dns": null, <del> "Image": "base", <add> "Image": "ubuntu", <ide> "Volumes": null, <ide> "VolumesFrom": "", <ide> "WorkingDir": "" <ide> Return the history of the image `name` <ide> <ide> **Example request**: <ide> <del> GET /images/base/history HTTP/1.1 <add> GET /images/ubuntu/history HTTP/1.1 <ide> <ide> **Example response**: <ide> <ide> and Docker images will report: <ide> HTTP/1.1 200 OK <ide> Content-Type: application/json <ide> <del> {"status": "create", "id": "dfdf82bd3881","from": "base:latest", "time":1374067924} <del> {"status": "start", "id": "dfdf82bd3881","from": "base:latest", "time":1374067924} <del> {"status": "stop", "id": "dfdf82bd3881","from": "base:latest", "time":1374067966} <del> {"status": "destroy", "id": "dfdf82bd3881","from": "base:latest", "time":1374067970} <add> {"status": "create", "id": "dfdf82bd3881","from": "ubuntu:latest", "time":1374067924} <add> {"status": "start", "id": "dfdf82bd3881","from": "ubuntu:latest", "time":1374067924} <add> {"status": "stop", "id": "dfdf82bd3881","from": "ubuntu:latest", "time":1374067966} <add> {"status": "destroy", "id": "dfdf82bd3881","from": "ubuntu:latest", "time":1374067970} <ide> <ide> Query Parameters: <ide> <ide><path>docs/sources/reference/api/docker_remote_api_v1.17.md <ide> List containers <ide> [ <ide> { <ide> "Id": "8dfafdbc3a40", <del> "Image": "base:latest", <add> "Image": "ubuntu:latest", <ide> "Command": "echo 1", <ide> "Created": 1367854155, <ide> "Status": "Exit 0", <ide> List containers <ide> }, <ide> { <ide> "Id": "9cd87474be90", <del> "Image": "base:latest", <add> "Image": "ubuntu:latest", <ide> "Command": "echo 222222", <ide> "Created": 1367854155, <ide> "Status": "Exit 0", <ide> List containers <ide> }, <ide> { <ide> "Id": "3176a2479c92", <del> "Image": "base:latest", <add> "Image": "ubuntu:latest", <ide> "Command": "echo 3333333333333333", <ide> "Created": 1367854154, <ide> "Status": "Exit 0", <ide> List containers <ide> }, <ide> { <ide> "Id": "4cb07b47f9fb", <del> "Image": "base:latest", <add> "Image": "ubuntu:latest", <ide> "Command": "echo 444444444444444444444444444444444", <ide> "Created": 1367854152, <ide> "Status": "Exit 0", <ide> Create a container <ide> "date" <ide> ], <ide> "Entrypoint": "", <del> "Image": "base", <add> "Image": "ubuntu", <ide> "Volumes": { <ide> "/tmp": {} <ide> }, <ide> Create an image, either by pulling it from the registry or by importing it <ide> <ide> **Example request**: <ide> <del> POST /images/create?fromImage=base HTTP/1.1 <add> POST /images/create?fromImage=ubuntu HTTP/1.1 <ide> <ide> **Example response**: <ide> <ide> Return low-level information on the image `name` <ide> <ide> **Example request**: <ide> <del> GET /images/base/json HTTP/1.1 <add> GET /images/ubuntu/json HTTP/1.1 <ide> <ide> **Example response**: <ide> <ide> Return low-level information on the image `name` <ide> "Env": null, <ide> "Cmd": ["/bin/bash"], <ide> "Dns": null, <del> "Image": "base", <add> "Image": "ubuntu", <ide> "Volumes": null, <ide> "VolumesFrom": "", <ide> "WorkingDir": "" <ide> Return the history of the image `name` <ide> <ide> **Example request**: <ide> <del> GET /images/base/history HTTP/1.1 <add> GET /images/ubuntu/history HTTP/1.1 <ide> <ide> **Example response**: <ide> <ide> and Docker images will report: <ide> HTTP/1.1 200 OK <ide> Content-Type: application/json <ide> <del> {"status": "create", "id": "dfdf82bd3881","from": "base:latest", "time":1374067924} <del> {"status": "start", "id": "dfdf82bd3881","from": "base:latest", "time":1374067924} <del> {"status": "stop", "id": "dfdf82bd3881","from": "base:latest", "time":1374067966} <del> {"status": "destroy", "id": "dfdf82bd3881","from": "base:latest", "time":1374067970} <add> {"status": "create", "id": "dfdf82bd3881","from": "ubuntu:latest", "time":1374067924} <add> {"status": "start", "id": "dfdf82bd3881","from": "ubuntu:latest", "time":1374067924} <add> {"status": "stop", "id": "dfdf82bd3881","from": "ubuntu:latest", "time":1374067966} <add> {"status": "destroy", "id": "dfdf82bd3881","from": "ubuntu:latest", "time":1374067970} <ide> <ide> Query Parameters: <ide>
8
Java
Java
remove obsolete code
ba42deb7db626aecbee78707d2f697b7898f8bfb
<ide><path>spring-web/src/main/java/org/springframework/web/bind/UnsatisfiedServletRequestParameterException.java <ide> private static List<String> paramsToStringList(List<String[]> paramConditions) { <ide> @Override <ide> public String getMessage() { <ide> StringBuilder sb = new StringBuilder("Parameter conditions "); <del> int i = 0; <ide> sb.append(String.join(" OR ", paramsToStringList(this.paramConditions))); <ide> sb.append(" not met for actual request parameters: "); <ide> sb.append(requestParameterMapToString(this.actualParams));
1
Javascript
Javascript
improve tests for test-http-url.parse
4a881e04dc1659669d2e84d2307abc1b9d9cbbd1
<ide><path>test/parallel/test-http-url.parse-auth-with-header-in-request.js <ide> function check(request) { <ide> <ide> const server = http.createServer(function(request, response) { <ide> // run the check function <del> check.call(this, request, response); <add> check(request); <ide> response.writeHead(200, {}); <ide> response.end('ok'); <ide> server.close(); <ide><path>test/parallel/test-http-url.parse-auth.js <ide> function check(request) { <ide> <ide> const server = http.createServer(function(request, response) { <ide> // run the check function <del> check.call(this, request, response); <add> check(request); <ide> response.writeHead(200, {}); <ide> response.end('ok'); <ide> server.close(); <ide><path>test/parallel/test-http-url.parse-basic.js <ide> function check(request) { <ide> <ide> const server = http.createServer(function(request, response) { <ide> // run the check function <del> check.call(this, request, response); <add> check(request); <ide> response.writeHead(200, {}); <ide> response.end('ok'); <ide> server.close(); <ide><path>test/parallel/test-http-url.parse-https.request.js <ide> function check(request) { <ide> <ide> const server = https.createServer(httpsOptions, function(request, response) { <ide> // run the check function <del> check.call(this, request, response); <add> check(request); <ide> response.writeHead(200, {}); <ide> response.end('ok'); <ide> server.close(); <ide><path>test/parallel/test-http-url.parse-only-support-http-https-protocol.js <ide> // USE OR OTHER DEALINGS IN THE SOFTWARE. <ide> <ide> 'use strict'; <del>require('../common'); <del>const assert = require('assert'); <add>const common = require('../common'); <ide> const http = require('http'); <ide> const url = require('url'); <ide> <del> <del>assert.throws(function() { <del> http.request(url.parse('file:///whatever')); <del>}, function(err) { <del> if (err instanceof Error) { <del> assert.strictEqual( <del> err.message, 'Protocol "file:" not supported. Expected "http:"'); <del> return true; <del> } <del>}); <del> <del>assert.throws(function() { <del> http.request(url.parse('mailto:asdf@asdf.com')); <del>}, function(err) { <del> if (err instanceof Error) { <del> assert.strictEqual( <del> err.message, 'Protocol "mailto:" not supported. Expected "http:"'); <del> return true; <del> } <del>}); <del> <del>assert.throws(function() { <del> http.request(url.parse('ftp://www.example.com')); <del>}, function(err) { <del> if (err instanceof Error) { <del> assert.strictEqual( <del> err.message, 'Protocol "ftp:" not supported. Expected "http:"'); <del> return true; <del> } <del>}); <del> <del>assert.throws(function() { <del> http.request(url.parse('javascript:alert(\'hello\');')); <del>}, function(err) { <del> if (err instanceof Error) { <del> assert.strictEqual( <del> err.message, 'Protocol "javascript:" not supported. Expected "http:"'); <del> return true; <del> } <del>}); <del> <del>assert.throws(function() { <del> http.request(url.parse('xmpp:isaacschlueter@jabber.org')); <del>}, function(err) { <del> if (err instanceof Error) { <del> assert.strictEqual( <del> err.message, 'Protocol "xmpp:" not supported. Expected "http:"'); <del> return true; <del> } <del>}); <del> <del>assert.throws(function() { <del> http.request(url.parse('f://some.host/path')); <del>}, function(err) { <del> if (err instanceof Error) { <del> assert.strictEqual( <del> err.message, 'Protocol "f:" not supported. Expected "http:"'); <del> return true; <del> } <add>const invalidUrls = [ <add> 'file:///whatever', <add> 'mailto:asdf@asdf.com', <add> 'ftp://www.example.com', <add> 'javascript:alert(\'hello\');', <add> 'xmpp:foo@bar.com', <add> 'f://some.host/path' <add>]; <add> <add>invalidUrls.forEach((invalid) => { <add> common.expectsError( <add> () => { http.request(url.parse(invalid)); }, <add> { <add> code: 'ERR_INVALID_PROTOCOL', <add> type: Error <add> } <add> ); <ide> }); <ide><path>test/parallel/test-http-url.parse-path.js <ide> function check(request) { <ide> <ide> const server = http.createServer(function(request, response) { <ide> // run the check function <del> check.call(this, request, response); <add> check(request); <ide> response.writeHead(200, {}); <ide> response.end('ok'); <ide> server.close(); <ide><path>test/parallel/test-http-url.parse-post.js <ide> function check(request) { <ide> <ide> const server = http.createServer(function(request, response) { <ide> // run the check function <del> check.call(this, request, response); <add> check(request); <ide> response.writeHead(200, {}); <ide> response.end('ok'); <ide> server.close(); <ide><path>test/parallel/test-http-url.parse-search.js <ide> function check(request) { <ide> <ide> const server = http.createServer(function(request, response) { <ide> // run the check function <del> check.call(this, request, response); <add> check(request); <ide> response.writeHead(200, {}); <ide> response.end('ok'); <ide> server.close();
8
Javascript
Javascript
update message with instructions
c451dd6cceb526d4814993e4d0eb431375a9b01c
<ide><path>local-cli/server/middleware/systraceProfileMiddleware.js <ide> */ <ide> 'use strict'; <ide> <del>const exec = require('child_process').exec; <ide> const fs = require('fs'); <del>const path = require('path'); <ide> <ide> module.exports = function(req, res, next) { <ide> if (req.url !== '/systrace') { <ide> module.exports = function(req, res, next) { <ide> <ide> console.log('Dumping profile information...'); <ide> var dumpName = '/tmp/dump_' + Date.now() + '.json'; <del> var prefix = process.env.TRACE_VIEWER_PATH || ''; <del> var cmd = path.join(prefix, 'trace2html') + ' ' + dumpName; <ide> fs.writeFileSync(dumpName, req.rawBody); <del> exec(cmd, function(error) { <del> if (error) { <del> if (error.code === 127) { <del> var response = '\n** Failed executing `' + cmd + '` **\n\n' + <del> 'Google trace-viewer is required to visualize the data, ' + <del> 'You can install it with `brew install trace2html`\n\n' + <del> 'NOTE: Your profile data was kept at:\n' + dumpName; <del> console.log(response); <del> res.end(response); <del> } else { <del> console.error(error); <del> res.end('Unknown error: ' + error.message); <del> } <del> return; <del> } else { <del> exec('rm ' + dumpName); <del> exec('open ' + dumpName.replace(/json$/, 'html'), function(err) { <del> if (err) { <del> console.error(err); <del> res.end(err.message); <del> } else { <del> res.end(); <del> } <del> }); <del> } <del> }); <add> var response = <add> 'Your profile was saved at:\n' + dumpName + '\n\n' + <add> 'On Google Chrome navigate to chrome://tracing and then click on "load" ' + <add> 'to load and visualise your profile.\n\n' + <add> 'This message is also printed to your console by the packager so you can copy it :)'; <add> console.log(response); <add> res.end(response); <ide> };
1
Go
Go
add remove method to subsystems
7fdeda87173ee6722ef1cbe7b21a13ac8b173365
<ide><path>pkg/cgroups/fs/apply_raw.go <ide> var ( <ide> <ide> type subsystem interface { <ide> Set(*data) error <add> Remove(*data) error <ide> } <ide> <ide> type data struct { <ide> func (raw *data) join(subsystem string) (string, error) { <ide> } <ide> <ide> func (raw *data) Cleanup() error { <del> get := func(subsystem string) string { <del> path, _ := raw.path(subsystem) <del> return path <del> } <del> <del> for _, path := range []string{ <del> get("memory"), <del> get("devices"), <del> get("cpu"), <del> get("cpuset"), <del> get("cpuacct"), <del> get("blkio"), <del> get("perf_event"), <del> get("freezer"), <del> } { <del> if path != "" { <del> os.RemoveAll(path) <del> } <add> for _, sys := range subsystems { <add> sys.Remove(raw) <ide> } <ide> return nil <ide> } <ide> <ide> func writeFile(dir, file, data string) error { <ide> return ioutil.WriteFile(filepath.Join(dir, file), []byte(data), 0700) <ide> } <add> <add>func removePath(p string, err error) error { <add> if err != nil { <add> return err <add> } <add> if p != "" { <add> return os.RemoveAll(p) <add> } <add> return nil <add>} <ide><path>pkg/cgroups/fs/blkio.go <ide> func (s *blkioGroup) Set(d *data) error { <ide> } <ide> return nil <ide> } <add> <add>func (s *blkioGroup) Remove(d *data) error { <add> return removePath(d.path("blkio")) <add>} <ide><path>pkg/cgroups/fs/cpu.go <ide> func (s *cpuGroup) Set(d *data) error { <ide> } <ide> return nil <ide> } <add> <add>func (s *cpuGroup) Remove(d *data) error { <add> return removePath(d.path("cpu")) <add>} <ide><path>pkg/cgroups/fs/cpuacct.go <ide> func (s *cpuacctGroup) Set(d *data) error { <ide> } <ide> return nil <ide> } <add> <add>func (s *cpuacctGroup) Remove(d *data) error { <add> return removePath(d.path("cpuacct")) <add>} <ide><path>pkg/cgroups/fs/cpuset.go <ide> func (s *cpusetGroup) Set(d *data) error { <ide> } <ide> return nil <ide> } <add> <add>func (s *cpusetGroup) Remove(d *data) error { <add> return removePath(d.path("cpuset")) <add>} <ide><path>pkg/cgroups/fs/devices.go <ide> func (s *devicesGroup) Set(d *data) error { <ide> } <ide> return nil <ide> } <add> <add>func (s *devicesGroup) Remove(d *data) error { <add> return removePath(d.path("devices")) <add>} <ide><path>pkg/cgroups/fs/freezer.go <ide> func (s *freezerGroup) Set(d *data) error { <ide> } <ide> return nil <ide> } <add> <add>func (s *freezerGroup) Remove(d *data) error { <add> return removePath(d.path("freezer")) <add>} <ide><path>pkg/cgroups/fs/memory.go <ide> func (s *memoryGroup) Set(d *data) error { <ide> } <ide> return nil <ide> } <add> <add>func (s *memoryGroup) Remove(d *data) error { <add> return removePath(d.path("memory")) <add>} <ide><path>pkg/cgroups/fs/perf_event.go <ide> func (s *perfEventGroup) Set(d *data) error { <ide> } <ide> return nil <ide> } <add> <add>func (s *perfEventGroup) Remove(d *data) error { <add> return removePath(d.path("perf_event")) <add>}
9
PHP
PHP
update core cake command for new bootstrapping
89eeb630bca66cd1f418abb32ee1792dc3cea717
<ide><path>App/Console/cake.php <ide> * @license MIT License (http://www.opensource.org/licenses/mit-license.php) <ide> */ <ide> include dirname(__DIR__) . '/Config/bootstrap.php'; <add> <ide> return Cake\Console\ShellDispatcher::run($argv); <ide><path>lib/Cake/Console/cake.php <ide> * @since CakePHP(tm) v 1.2.0.5012 <ide> * @license MIT License (http://www.opensource.org/licenses/mit-license.php) <ide> */ <del>$ds = DIRECTORY_SEPARATOR; <del>$dispatcher = 'Cake' . $ds . 'Console' . $ds . 'ShellDispatcher.php'; <del>$found = false; <del>$paths = explode(PATH_SEPARATOR, ini_get('include_path')); <add>$root = dirname(dirname(dirname(__DIR__))); <ide> <del>foreach ($paths as $path) { <del> if (file_exists($path . $ds . $dispatcher)) { <del> $found = $path; <del> break; <del> } <add>// Default app directory layout <add>if (file_exists($root . '/App/Config/bootstrap.php')) { <add> require $root . '/App/Config/bootstrap.php'; <ide> } <del> <del>if (!$found) { <del> $root = dirname(dirname(__DIR__)); <del> if (!include $root . $ds . $dispatcher) { <del> trigger_error('Could not locate CakePHP core files.', E_USER_ERROR); <del> } <del>} else { <del> include $found . $ds . $dispatcher; <del>} <del> <del>unset($paths, $path, $found, $dispatcher, $root, $ds); <del> <add>// TODO read ARGV for -app flag, and bootstrap that application. <ide> return Cake\Console\ShellDispatcher::run($argv); <ide><path>lib/Cake/bootstrap.php <ide> <ide> <ide> use Cake\Core\App; <del>use Cake\Core\Configure; <ide> <ide> App::init(); <ide> App::build();
3
Javascript
Javascript
simplify regression test for segv
624a242b05397fdacc1e79007de223cd0331f6e8
<ide><path>test/parallel/test-crypto.js <ide> const tls = require('tls'); <ide> const fixtures = require('../common/fixtures'); <ide> <ide> // Test Certificates <del>const caPem = fixtures.readSync('test_ca.pem', 'ascii'); <del>const certPem = fixtures.readSync('test_cert.pem', 'ascii'); <ide> const certPfx = fixtures.readSync('test_cert.pfx'); <del>const keyPem = fixtures.readSync('test_key.pem', 'ascii'); <ide> <ide> // 'this' safety <ide> // https://github.com/joyent/node/issues/6690 <ide> assert.throws(function() { <del> const options = { key: keyPem, cert: certPem, ca: caPem }; <del> const credentials = tls.createSecureContext(options); <add> const credentials = tls.createSecureContext(); <ide> const context = credentials.context; <del> const notcontext = { setOptions: context.setOptions, setKey: context.setKey }; <del> tls.createSecureContext({ secureOptions: 1 }, notcontext); <add> const notcontext = { setOptions: context.setOptions }; <add> <add> // Methods of native objects should not segfault when reassigned to a new <add> // object and called illegally. This core dumped in 0.10 and was fixed in <add> // 0.11. <add> notcontext.setOptions(); <ide> }, (err) => { <ide> // Throws TypeError, so there is no opensslErrorStack property. <ide> if ((err instanceof Error) &&
1
Python
Python
handle invalid user situation
be590d61c09805955d89231cff84fd6fd1ab1ecb
<ide><path>rest_framework/authtoken/management/commands/drf_create_token.py <ide> def add_arguments(self, parser): <ide> <ide> def handle(self, *args, **options): <ide> username = options['username'] <del> token = self.create_user_token(username) <add> <add> try: <add> token = self.create_user_token(username) <add> except User.DoesNotExist: <add> print('Cannot create the Token: user {0} does not exist'.format( <add> username <add> )) <ide> print('Generated token {0} for user {1}'.format(token.key, username)) <ide><path>tests/test_authtoken.py <ide> def test_command_create_user_token(self): <ide> assert token is not None <ide> token_saved = Token.objects.first() <ide> assert token.key == token_saved.key <add> <add> def test_command_create_user_token_invalid_user(self): <add> with pytest.raises(User.DoesNotExist): <add> AuthTokenCommand().create_user_token('not_existing_user')
2
Ruby
Ruby
reduce verbosity of artifacts hash
5eab54f892cfac39c78a3d092f3084ce817fca04
<ide><path>Library/Homebrew/cask/lib/hbc/cli/internal_stanza.rb <ide> def run <ide> end <ide> <ide> if stanza == :artifacts <del> value = Hash[value.map { |v| [v.class.dsl_key, v] }] <add> value = Hash[value.map { |v| [v.class.dsl_key, v.to_s] }] <ide> value = value[artifact_name] if artifact_name <ide> end <ide>
1
PHP
PHP
add attachmany method to the pendingrequest.php
884dd4ab56848949fc25d15c3036981446953bd1
<ide><path>src/Illuminate/Http/Client/PendingRequest.php <ide> public function attach($name, $contents, $filename = null, array $headers = []) <ide> <ide> return $this; <ide> } <add> <add> /** <add> * Attach multiple files to the request. Accepts an array containing arrays of files <add> * <add> * @param array $files <add> * @return $this <add> */ <add> public function attachMany(array $files) <add> { <add> foreach ($files as $file) { <add> $this->attach(...$file); <add> } <add> <add> return $this; <add> } <ide> <ide> /** <ide> * Indicate the request is a multi-part form request.
1
Python
Python
fix failing tests
3c6b379d46b10994fbd037ea238e3f703c0f62e9
<ide><path>libcloud/dns/drivers/vultr.py <ide> def create_zone(self, domain, type='master', ttl=None, extra=None): <ide> zones = self.list_zones() <ide> if self.ex_zone_exists(domain, zones): <ide> raise ZoneAlreadyExistsError(value='', driver=self, <del> domain=domain) <add> zone_id=domain) <ide> <ide> self.connection.request(params=params, action=action, data=data, <ide> method='POST') <ide><path>libcloud/test/dns/test_vultr.py <ide> def test_delete_zone_success(self): <ide> self.assertTrue(status) <ide> <ide> def test_create_zone_success(self): <del> zone = self.driver.create_zone(zone_id='test.com', <add> zone = self.driver.create_zone(domain='test.com', <ide> extra={'serverip': '127.0.0.1'}) <ide> <ide> self.assertEqual(zone.id, 'test.com') <ide> def test_create_zone_zone_already_exists(self): <ide> VultrMockHttp.type = 'CREATE_ZONE_ZONE_ALREADY_EXISTS' <ide> <ide> try: <del> self.driver.create_zone(zone_id='example.com', <add> self.driver.create_zone(domain='example.com', <ide> extra={'serverip': '127.0.0.1'}) <ide> except ZoneAlreadyExistsError: <ide> e = sys.exc_info()[1]
2
PHP
PHP
fix unreachable code in model mergevars
e7c913acba7cfff3dd17dd7270c5079dfdad300d
<ide><path>lib/Cake/Model/Model.php <ide> public function __construct($id = false, $table = null, $ds = null) { <ide> } <ide> <ide> if (is_subclass_of($this, 'AppModel')) { <del> $merge = array('findMethods'); <del> if ($this->actsAs !== null || $this->actsAs !== false) { <del> $merge[] = 'actsAs'; <del> } <add> $merge = array('actsAs', 'findMethods'); <ide> $parentClass = get_parent_class($this); <ide> if ($parentClass !== 'AppModel') { <ide> $this->_mergeVars($merge, $parentClass);
1
Javascript
Javascript
add examples to rtlexample
bc5083ac40b269169522fa4e4acca17e26c17213
<ide><path>RNTester/js/RTLExample.js <ide> * of patent rights can be found in the PATENTS file in the same directory. <ide> * <ide> * @flow <add> * @format <ide> * @providesModule RTLExample <ide> */ <ide> 'use strict'; <ide> const { <ide> TouchableWithoutFeedback, <ide> Switch, <ide> View, <add> Button, <ide> } = ReactNative; <ide> const Platform = require('Platform'); <ide> <del> <ide> const RNTesterPage = require('./RNTesterPage'); <ide> const RNTesterBlock = require('./RNTesterBlock'); <ide> <ide> const IMAGE_SIZE = [IMAGE_DIMENSION, IMAGE_DIMENSION]; <ide> const IS_RTL = I18nManager.isRTL; <ide> <ide> function ListItem(props) { <del> return ( <add> return ( <ide> <View style={styles.row}> <del> <View style={styles.column1}> <del> <Image <del> source={props.imageSource} <del> style={styles.icon} <del> /> <del> </View> <del> <View style={styles.column2}> <del> <View style={styles.textBox}> <del> <Text> <del> Text <del> Text <del> Text <del> </Text> <del> </View> <del> </View> <del> <View style={styles.column3}> <del> <View style={styles.smallButton}> <del> <Text style={styles.fontSizeSmall}> <del> Button <del> </Text> <del> </View> <del> </View> <del> </View> <del> ); <add> <View style={styles.column1}> <add> <Image source={props.imageSource} style={styles.icon} /> <add> </View> <add> <View style={styles.column2}> <add> <View style={styles.textBox}> <add> <Text>Text Text Text</Text> <add> </View> <add> </View> <add> <View style={styles.column3}> <add> <View style={styles.smallButton}> <add> <Text style={styles.fontSizeSmall}>Button</Text> <add> </View> <add> </View> <add> </View> <add> ); <ide> } <ide> <ide> function TextAlignmentExample(props) { <ide> return ( <del> <RNTesterBlock <del> title={props.title} <del> description={props.description}> <del> <View> <del> <Text style={props.style}> <del> Left-to-Right language without text alignment. <del> </Text> <del> <Text style={props.style}> <del> {'\u0645\u0646 \u0627\u0644\u064A\u0645\u064A\u0646 ' + <del> '\u0625\u0644\u0649 \u0627\u0644\u064A\u0633\u0627\u0631 ' + <del> '\u0627\u0644\u0644\u063A\u0629 \u062F\u0648\u0646 ' + <del> '\u0645\u062D\u0627\u0630\u0627\u0629 \u0627\u0644\u0646\u0635'} <del> </Text> <del> <Text style={props.style}> <del> {'\u05DE\u05D9\u05DE\u05D9\u05DF \u05DC\u05E9\u05DE\u05D0\u05DC ' + <del> '\u05D4\u05E9\u05E4\u05D4 \u05D1\u05DC\u05D9 ' + <del> '\u05D9\u05D9\u05E9\u05D5\u05E8 \u05D8\u05E7\u05E1\u05D8'} <del> </Text> <del> </View> <del> </RNTesterBlock> <del> ); <add> <RNTesterBlock title={props.title} description={props.description}> <add> <View> <add> <Text style={props.style}> <add> Left-to-Right language without text alignment. <add> </Text> <add> <Text style={props.style}> <add> {'\u0645\u0646 \u0627\u0644\u064A\u0645\u064A\u0646 ' + <add> '\u0625\u0644\u0649 \u0627\u0644\u064A\u0633\u0627\u0631 ' + <add> '\u0627\u0644\u0644\u063A\u0629 \u062F\u0648\u0646 ' + <add> '\u0645\u062D\u0627\u0630\u0627\u0629 \u0627\u0644\u0646\u0635'} <add> </Text> <add> <Text style={props.style}> <add> {'\u05DE\u05D9\u05DE\u05D9\u05DF \u05DC\u05E9\u05DE\u05D0\u05DC ' + <add> '\u05D4\u05E9\u05E4\u05D4 \u05D1\u05DC\u05D9 ' + <add> '\u05D9\u05D9\u05E9\u05D5\u05E8 \u05D8\u05E7\u05E1\u05D8'} <add> </Text> <add> </View> <add> </RNTesterBlock> <add> ); <ide> } <ide> <ide> function AnimationBlock(props) { <ide> function AnimationBlock(props) { <ide> ); <ide> } <ide> <add>type RTLSwitcherComponentState = {| <add> isRTL: boolean, <add>|}; <add> <add>function withRTLState(Component) { <add> return class extends React.Component<*, RTLSwitcherComponentState> { <add> constructor(...args) { <add> super(...args); <add> this.state = { <add> isRTL: IS_RTL, <add> }; <add> } <add> <add> render() { <add> const setRTL = isRTL => this.setState({isRTL: isRTL}); <add> return <Component isRTL={this.state.isRTL} setRTL={setRTL} />; <add> } <add> }; <add>} <add> <add>const RTLToggler = ({isRTL, setRTL}) => { <add> if (Platform.OS === 'android') { <add> return <Text style={styles.rtlToggler}>{isRTL ? 'RTL' : 'LTR'}</Text>; <add> } <add> <add> const toggleRTL = () => setRTL(!isRTL); <add> return ( <add> <Button <add> onPress={toggleRTL} <add> title={isRTL ? 'RTL' : 'LTR'} <add> color="gray" <add> accessibilityLabel="Change layout direction" <add> /> <add> ); <add>}; <add> <add>const PaddingExample = withRTLState(({isRTL, setRTL}) => { <add> const color = 'teal'; <add> <add> return ( <add> <RNTesterBlock title={'Padding Start/End'}> <add> <Text style={styles.bold}>Styles</Text> <add> <Text>paddingStart: 50,</Text> <add> <Text>paddingEnd: 10</Text> <add> <Text /> <add> <Text style={styles.bold}>Demo: </Text> <add> <Text>The {color} is padding.</Text> <add> <View <add> style={{ <add> backgroundColor: color, <add> paddingStart: 50, <add> paddingEnd: 10, <add> borderWidth: 1, <add> borderColor: color, <add> direction: isRTL ? 'rtl' : 'ltr', <add> }}> <add> <View <add> style={{ <add> backgroundColor: 'white', <add> paddingTop: 5, <add> paddingBottom: 5, <add> borderLeftWidth: 1, <add> borderRightWidth: 1, <add> borderColor: 'gray', <add> }}> <add> <RTLToggler setRTL={setRTL} isRTL={isRTL} /> <add> </View> <add> </View> <add> </RNTesterBlock> <add> ); <add>}); <add> <add>const MarginExample = withRTLState(({isRTL, setRTL}) => { <add> return ( <add> <RNTesterBlock title={'Margin Start/End'}> <add> <Text style={styles.bold}>Styles</Text> <add> <Text>marginStart: 50,</Text> <add> <Text>marginEnd: 10</Text> <add> <Text /> <add> <Text style={styles.bold}>Demo: </Text> <add> <Text>The green is margin.</Text> <add> <View <add> style={{ <add> backgroundColor: 'green', <add> borderWidth: 1, <add> borderColor: 'green', <add> direction: isRTL ? 'rtl' : 'ltr', <add> }}> <add> <View <add> style={{ <add> backgroundColor: 'white', <add> paddingTop: 5, <add> paddingBottom: 5, <add> marginStart: 50, <add> marginEnd: 10, <add> borderLeftWidth: 1, <add> borderRightWidth: 1, <add> borderColor: 'gray', <add> }}> <add> <RTLToggler setRTL={setRTL} isRTL={isRTL} /> <add> </View> <add> </View> <add> </RNTesterBlock> <add> ); <add>}); <add> <add>const PositionExample = withRTLState(({isRTL, setRTL}) => { <add> return ( <add> <RNTesterBlock title={'Position Start/End'}> <add> <Text style={styles.bold}>Styles</Text> <add> <Text>start: 50</Text> <add> <Text /> <add> <Text style={styles.bold}>Demo: </Text> <add> <Text>The orange is position.</Text> <add> <View <add> style={{ <add> backgroundColor: 'orange', <add> borderWidth: 1, <add> borderColor: 'orange', <add> direction: isRTL ? 'rtl' : 'ltr', <add> }}> <add> <View <add> style={{ <add> backgroundColor: 'white', <add> start: 50, <add> borderColor: 'gray', <add> }}> <add> <RTLToggler setRTL={setRTL} isRTL={isRTL} /> <add> </View> <add> </View> <add> <Text /> <add> <Text style={styles.bold}>Styles</Text> <add> <Text>end: 50</Text> <add> <Text /> <add> <Text style={styles.bold}>Demo: </Text> <add> <Text>The orange is position.</Text> <add> <View <add> style={{ <add> backgroundColor: 'orange', <add> borderWidth: 1, <add> borderColor: 'orange', <add> direction: isRTL ? 'rtl' : 'ltr', <add> }}> <add> <View <add> style={{ <add> backgroundColor: 'white', <add> end: 50, <add> borderColor: 'gray', <add> }}> <add> <RTLToggler setRTL={setRTL} isRTL={isRTL} /> <add> </View> <add> </View> <add> </RNTesterBlock> <add> ); <add>}); <add> <add>const BorderWidthExample = withRTLState(({isRTL, setRTL}) => { <add> return ( <add> <RNTesterBlock title={'Border Width Start/End'}> <add> <Text style={styles.bold}>Styles</Text> <add> <Text>borderStartWidth: 10,</Text> <add> <Text>borderEndWidth: 50</Text> <add> <Text /> <add> <Text style={styles.bold}>Demo: </Text> <add> <View style={{direction: isRTL ? 'rtl' : 'ltr'}}> <add> <View <add> style={{ <add> borderStartWidth: 10, <add> borderEndWidth: 50, <add> }}> <add> <View> <add> <RTLToggler setRTL={setRTL} isRTL={isRTL} /> <add> </View> <add> </View> <add> </View> <add> </RNTesterBlock> <add> ); <add>}); <add> <add>const BorderColorExample = withRTLState(({isRTL, setRTL}) => { <add> return ( <add> <RNTesterBlock title={'Border Color Start/End'}> <add> <Text style={styles.bold}>Styles</Text> <add> <Text>borderStartColor: 'red',</Text> <add> <Text>borderEndColor: 'green',</Text> <add> <Text /> <add> <Text style={styles.bold}>Demo: </Text> <add> <View style={{direction: isRTL ? 'rtl' : 'ltr'}}> <add> <View <add> style={{ <add> borderStartColor: 'red', <add> borderEndColor: 'green', <add> borderLeftWidth: 20, <add> borderRightWidth: 20, <add> padding: 10, <add> }}> <add> <View> <add> <RTLToggler setRTL={setRTL} isRTL={isRTL} /> <add> </View> <add> </View> <add> </View> <add> </RNTesterBlock> <add> ); <add>}); <add> <add>const BorderRadiiExample = withRTLState(({isRTL, setRTL}) => { <add> return ( <add> <RNTesterBlock title={'Border Radii Start/End'}> <add> <Text style={styles.bold}>Styles</Text> <add> <Text>borderTopStartRadius: 10,</Text> <add> <Text>borderTopEndRadius: 20,</Text> <add> <Text>borderBottomStartRadius: 30,</Text> <add> <Text>borderBottomEndRadius: 40</Text> <add> <Text /> <add> <Text style={styles.bold}>Demo: </Text> <add> <View style={{direction: isRTL ? 'rtl' : 'ltr'}}> <add> <View <add> style={{ <add> borderWidth: 10, <add> borderTopStartRadius: 10, <add> borderTopEndRadius: 20, <add> borderBottomStartRadius: 30, <add> borderBottomEndRadius: 40, <add> padding: 10, <add> }}> <add> <View> <add> <RTLToggler setRTL={setRTL} isRTL={isRTL} /> <add> </View> <add> </View> <add> </View> <add> </RNTesterBlock> <add> ); <add>}); <add> <add>const BorderExample = withRTLState(({isRTL, setRTL}) => { <add> return ( <add> <RNTesterBlock title={'Border '}> <add> <Text style={styles.bold}>Styles</Text> <add> <Text>borderStartColor: 'red',</Text> <add> <Text>borderEndColor: 'green',</Text> <add> <Text>borderStartWidth: 10,</Text> <add> <Text>borderEndWidth: 50,</Text> <add> <Text>borderTopStartRadius: 10,</Text> <add> <Text>borderTopEndRadius: 20,</Text> <add> <Text>borderBottomStartRadius: 30,</Text> <add> <Text>borderBottomEndRadius: 40</Text> <add> <Text /> <add> <Text style={styles.bold}>Demo: </Text> <add> <View style={{direction: isRTL ? 'rtl' : 'ltr'}}> <add> <View <add> style={{ <add> borderStartColor: 'red', <add> borderEndColor: 'green', <add> borderStartWidth: 10, <add> borderEndWidth: 50, <add> borderTopStartRadius: 10, <add> borderTopEndRadius: 20, <add> borderBottomStartRadius: 30, <add> borderBottomEndRadius: 40, <add> padding: 10, <add> }}> <add> <View> <add> <RTLToggler setRTL={setRTL} isRTL={isRTL} /> <add> </View> <add> </View> <add> </View> <add> </RNTesterBlock> <add> ); <add>}); <add> <ide> class RTLExample extends React.Component<any, State> { <ide> static title = 'RTLExample'; <ide> static description = 'Examples to show how to apply components to RTL layout.'; <ide> class RTLExample extends React.Component<any, State> { <ide> this._panResponder = PanResponder.create({ <ide> onStartShouldSetPanResponder: () => true, <ide> onPanResponderGrant: this._onPanResponderGrant, <del> onPanResponderMove: Animated.event([ <del> null, {dx: pan.x, dy: pan.y}, <del> ]), <add> onPanResponderMove: Animated.event([null, {dx: pan.x, dy: pan.y}]), <ide> onPanResponderRelease: this._onPanResponderEnd, <ide> onPanResponderTerminate: this._onPanResponderEnd, <ide> }); <ide> class RTLExample extends React.Component<any, State> { <ide> style={[ <ide> styles.container, <ide> // `direction` property is supported only on iOS now. <del> Platform.OS === 'ios' ? <del> {direction: this.state.isRTL ? 'rtl' : 'ltr'} : <del> null <add> Platform.OS === 'ios' <add> ? {direction: this.state.isRTL ? 'rtl' : 'ltr'} <add> : null, <ide> ]} <ide> onLayout={this._onLayout}> <ide> <RNTesterPage title={'Right-to-Left (RTL) UI Layout'}> <ide> class RTLExample extends React.Component<any, State> { <ide> </RNTesterBlock> <ide> <RNTesterBlock title={'Quickly Test RTL Layout'}> <ide> <View style={styles.flexDirectionRow}> <del> <Text style={styles.switchRowTextView}> <del> forceRTL <del> </Text> <add> <Text style={styles.switchRowTextView}>forceRTL</Text> <ide> <View style={styles.switchRowSwitchView}> <ide> <Switch <ide> onValueChange={this._onDirectionChange} <ide> style={styles.rightAlignStyle} <del> value={this.state.isRTL} /> <add> value={this.state.isRTL} <add> /> <ide> </View> <ide> </View> <ide> </RNTesterBlock> <ide> <RNTesterBlock title={'A Simple List Item Layout'}> <ide> <View style={styles.list}> <del> <ListItem imageSource={require('./Thumbnails/like.png')}/> <del> <ListItem imageSource={require('./Thumbnails/poke.png')}/> <add> <ListItem imageSource={require('./Thumbnails/like.png')} /> <add> <ListItem imageSource={require('./Thumbnails/poke.png')} /> <ide> </View> <ide> </RNTesterBlock> <ide> <TextAlignmentExample <ide> class RTLExample extends React.Component<any, State> { <ide> imgStyle={{ <ide> transform: [ <ide> {translateX: this.state.linear}, <del> {scaleX: IS_RTL ? -1 : 1} <del> ] <add> {scaleX: IS_RTL ? -1 : 1}, <add> ], <ide> }} <ide> /> <ide> </View> <ide> </RNTesterBlock> <add> <PaddingExample /> <add> <MarginExample /> <add> <PositionExample /> <add> <BorderWidthExample /> <add> <BorderColorExample /> <add> <BorderRadiiExample /> <add> <BorderExample /> <ide> </RNTesterPage> <ide> </ScrollView> <ide> ); <ide> class RTLExample extends React.Component<any, State> { <ide> _onDirectionChange = () => { <ide> I18nManager.forceRTL(!this.state.isRTL); <ide> this.setState({isRTL: !this.state.isRTL}); <del> Alert.alert('Reload this page', <del> 'Please reload this page to change the UI direction! ' + <del> 'All examples in this app will be affected. ' + <del> 'Check them out to see what they look like in RTL layout.' <add> Alert.alert( <add> 'Reload this page', <add> 'Please reload this page to change the UI direction! ' + <add> 'All examples in this app will be affected. ' + <add> 'Check them out to see what they look like in RTL layout.', <ide> ); <ide> }; <ide> <ide> class RTLExample extends React.Component<any, State> { <ide> }); <ide> const offset = IMAGE_SIZE[0] / SCALE / 2 + 10; <ide> const toMaxDistance = <del> (IS_RTL ? -1 : 1) * (this.state.windowWidth / 2 - offset); <add> (IS_RTL ? -1 : 1) * (this.state.windowWidth / 2 - offset); <ide> Animated.timing(this.state.linear, { <ide> toValue: this.state.toggleStatus[refName] ? toMaxDistance : 0, <ide> duration: 2000, <ide> const styles = StyleSheet.create({ <ide> justifyContent: 'center', <ide> alignItems: 'center', <ide> }, <del> fontSizeSmall:{ <add> fontSizeSmall: { <ide> fontSize: 10, <ide> }, <del> fontSizeExtraSmall:{ <add> fontSizeExtraSmall: { <ide> fontSize: 8, <ide> }, <ide> textAlignLeft: { <ide> const styles = StyleSheet.create({ <ide> flexDirectionRow: { <ide> flexDirection: 'row', <ide> }, <add> bold: { <add> fontWeight: 'bold', <add> }, <add> rtlToggler: { <add> color: 'gray', <add> padding: 8, <add> textAlign: 'center', <add> fontWeight: '500', <add> }, <ide> }); <ide> <ide> module.exports = RTLExample;
1
Javascript
Javascript
improve cert claiming test
f4dc81bce32763336a623dd44508658224597889
<ide><path>cypress/integration/learn/responsive-web-design/claim-cert-from-learn.js <ide> describe('Responsive Web Design Superblock', () => { <ide> cy.contains("I've completed this challenge") <ide> .should('not.be.disabled') <ide> .click(); <add> cy.intercept('http://localhost:3000/project-completed').as( <add> 'challengeCompleted' <add> ); <ide> cy.contains('Submit and go to next challenge').click(); <add> cy.wait('@challengeCompleted') <add> .its('response.statusCode') <add> .should('eq', 200); <ide> cy.location().should(loc => { <ide> expect(loc.pathname).to.not.eq(url); <ide> }); <ide> describe('Responsive Web Design Superblock', () => { <ide> }); <ide> cy.get('.donation-modal').should('be.visible'); <ide> cy.contains('Ask me later').click(); <del> cy.get('.donation-modal').should('not.be.visible'); <add> cy.get('.donation-modal').should('not.exist'); <ide> // directed to claim-cert-block section <ide> cy.url().should('include', '#claim-cert-block'); <ide> cy.contains('Claim Certification').should('not.be.disabled').click();
1
Text
Text
fix small typo in typescript documentation
432eec2aecac0d3ee6336349d726f1130080de0f
<ide><path>packages/next/README.md <ide> After adding the `tsconfig.json` you need to install `@types` to get proper Type <ide> npm install --save-dev @types/react @types/react-dom @types/node <ide> ``` <ide> <del>Now can change any file from `.js` to `.ts` / `.tsx` (tsx is for files using JSX). To learn more about TypeScript checkout out its [documentation](https://www.typescriptlang.org/). <add>Now can change any file from `.js` to `.ts` / `.tsx` (tsx is for files using JSX). To learn more about TypeScript checkout its [documentation](https://www.typescriptlang.org/). <ide> <ide> ### Exported types <ide>
1
Python
Python
set version to 2.1.1
5a53e9358a2faa4f091fab196b48a66bbb6eb07f
<ide><path>spacy/about.py <ide> # fmt: off <ide> <ide> __title__ = "spacy" <del>__version__ = "2.1.0" <add>__version__ = "2.1.1" <ide> __summary__ = "Industrial-strength Natural Language Processing (NLP) with Python and Cython" <ide> __uri__ = "https://spacy.io" <ide> __author__ = "Explosion AI"
1
Javascript
Javascript
save datalistener in memory
d86fe6b30122b7464471131b145cfecb7541cb47
<ide><path>extensions/firefox/components/PdfStreamConverter.js <ide> PdfStreamConverter.prototype = { <ide> var channel = ioService.newChannel( <ide> PDF_VIEWER_WEB_PAGE, null, null); <ide> <del> var self = this; <ide> var listener = this.listener; <add> var dataListener = this.dataListener; <ide> // Proxy all the request observer calls, when it gets to onStopRequest <ide> // we can get the dom window. We also intentionally pass on the original <ide> // request(aRequest) below so we don't overwrite the original channel and <ide> PdfStreamConverter.prototype = { <ide> contentDispositionFilename, aRequest); <ide> } else { <ide> actions = new StandardChromeActions( <del> domWindow, contentDispositionFilename, self.dataListener); <add> domWindow, contentDispositionFilename, dataListener); <ide> } <ide> var requestListener = new RequestListener(actions); <ide> domWindow.addEventListener(PDFJS_EVENT_ID, function(event) {
1
Python
Python
add test for ticket #203
19ce2ea3251916695bc5a7f3d4389664255d4db4
<ide><path>numpy/core/tests/test_regression.py <ide> def check_mem_array_creation_invalid_specification(self,level=rlevel): <ide> # Correct way <ide> N.array([(1,'object')],dt) <ide> <add> def check_recarray_single_element(self,level=rlevel): <add> """Ticket #202""" <add> a = N.array([1,2,3],dtype=N.int32) <add> b = a.copy() <add> r = N.rec.array(a,shape=1,formats=['3i4'],names=['d']) <add> assert_array_equal(a,b) <add> assert_equal(a,r[0][0]) <add> <ide> def check_zero_sized_array_indexing(self,level=rlevel): <ide> """Ticket #205""" <ide> tmp = N.array([])
1
Text
Text
correct my wrong note about buf.fill()
17c6b1d4f78d6050642d3cd3723c08564e67dcd5
<ide><path>doc/api/buffer.md <ide> console.log(b.toString()); <ide> <ide> `value` is coerced to a `uint32` value if it is not a string, `Buffer`, or <ide> integer. If the resulting integer is greater than `255` (decimal), `buf` will be <del>filled with `0`. <add>filled with `value & 255`. <ide> <ide> If the final write of a `fill()` operation falls on a multi-byte character, <ide> then only the bytes of that character that fit into `buf` are written:
1
Text
Text
add section and information on packet sniffing.
ec255f2d8068b6808fa71efa29551ffc9973939f
<ide><path>guide/english/security/packet-sniffing/index.md <add>--- <add>title: Packet Sniffing <add>--- <add>## Packet Sniffing <add> <add>Packet Sniffing is the process/strategy of intercepting/capturing traffic on the Network Level. The purpose of this act is to recover and analyze data passing through the target network such as sensitive information. This can also be used by network engineers or technicians to analyze and diagnose a network infrastructure to identify problems. <add> <add>### Packet Sniffing Software <add> <add>Also known as Packet Sniffers, can come in the form of either a dedicated hardware solution or software applications using the network <add>infrastructure of the target computer to collect information or inject malicious data. <add> <add>### Protection from Packet Sniffing <add> <add>The best/simplest way to keep data on a network safe is to use encryption such as Secure-Socket-Layer (SSL) or Transport-Layer-Security (TLS). Encrypting network data will not prevent packet sniffers from acquirring the source and destination details of specific data, but it will prevent the data being passed from being readable by the sniffers. <add> <add>Alternatively there are multiple tools available for technicians or administrators to identify wether or not a network has been compromised. <add> <add>Example: https://packetstormsecurity.com/sniffers/antisniff/ <add> <add>These tools can detect if a network is in 'Promiscuous Mode', the required state for capturing network data.
1
PHP
PHP
do sameness checks on the type sensitive parts
5e961c9e0ecc2023812f32fa3cb5e0a16113a6ae
<ide><path>tests/TestCase/Database/Schema/SqlserverSchemaTest.php <ide> public function testDescribeTable() <ide> ]; <ide> $this->assertEquals(['id'], $result->primaryKey()); <ide> foreach ($expected as $field => $definition) { <del> $this->assertSame($definition, $result->column($field), 'Failed to match field ' . $field); <add> $column = $result->column($field); <add> $this->assertEquals($definition, $column, 'Failed to match field ' . $field); <add> $this->assertSame($definition['length'], $column['length']); <add> $this->assertSame($definition['scale'], $column['scale']); <add> $this->assertSame($definition['precision'], $column['precision']); <ide> } <ide> } <ide>
1
Javascript
Javascript
replace tab with space
0d533b860fa6f72f0a6a8d7e3832f74e3e55ef35
<ide><path>bin/webpack.js <ide> try { <ide> } <ide> <ide> if(webpackCliInstalled) { <del> require("webpack-cli"); // eslint-disable-line node/no-missing-require, node/no-extraneous-require, node/no-unpublished-require <add> require("webpack-cli"); // eslint-disable-line node/no-missing-require, node/no-extraneous-require, node/no-unpublished-require <ide> } else { <ide> console.error("The CLI moved into a separate package: webpack-cli."); <ide> console.error("Please install 'webpack-cli' in addition to webpack itself to use the CLI.");
1
Text
Text
add flags section to document all flags
53822f605d3171530ab820d71e8832f473479c27
<ide><path>doc/api/fs.md <ide> changes: <ide> * `options` {Object|string} <ide> * `encoding` {string|null} **Default:** `'utf8'` <ide> * `mode` {integer} **Default:** `0o666` <del> * `flag` {string} **Default:** `'a'` <add> * `flag` {string} See [support of file system `flags`][]. **Default:** `'a'`. <ide> * `callback` {Function} <ide> * `err` {Error} <ide> <ide> changes: <ide> * `options` {Object|string} <ide> * `encoding` {string|null} **Default:** `'utf8'` <ide> * `mode` {integer} **Default:** `0o666` <del> * `flag` {string} **Default:** `'a'` <add> * `flag` {string} See [support of file system `flags`][]. **Default:** `'a'`. <ide> <ide> Synchronously append data to a file, creating the file if it does not yet <ide> exist. `data` can be a string or a [`Buffer`][]. <ide> changes: <ide> <ide> * `path` {string|Buffer|URL} <ide> * `options` {string|Object} <del> * `flags` {string} **Default:** `'r'` <add> * `flags` {string} See [support of file system `flags`][]. **Default:** <add> `'r'`. <ide> * `encoding` {string} **Default:** `null` <ide> * `fd` {integer} **Default:** `null` <ide> * `mode` {integer} **Default:** `0o666` <ide> changes: <ide> <ide> * `path` {string|Buffer|URL} <ide> * `options` {string|Object} <del> * `flags` {string} **Default:** `'w'` <add> * `flags` {string} See [support of file system `flags`][]. **Default:** <add> `'w'`. <ide> * `encoding` {string} **Default:** `'utf8'` <ide> * `fd` {integer} **Default:** `null` <ide> * `mode` {integer} **Default:** `0o666` <ide> changes: <ide> --> <ide> <ide> * `path` {string|Buffer|URL} <del>* `flags` {string|number} <add>* `flags` {string|number} See [support of file system `flags`][]. <ide> * `mode` {integer} **Default:** `0o666` (readable and writable) <ide> * `callback` {Function} <ide> * `err` {Error} <ide> * `fd` {integer} <ide> <del>Asynchronous file open. See open(2). `flags` can be: <del> <del>* `'r'` - Open file for reading. <del>An exception occurs if the file does not exist. <del> <del>* `'r+'` - Open file for reading and writing. <del>An exception occurs if the file does not exist. <del> <del>* `'rs+'` - Open file for reading and writing in synchronous mode. Instructs <del> the operating system to bypass the local file system cache. <del> <del> This is primarily useful for opening files on NFS mounts as it allows skipping <del> the potentially stale local cache. It has a very real impact on I/O <del> performance so using this flag is not recommended unless it is needed. <del> <del> Note that this doesn't turn `fs.open()` into a synchronous blocking call. <del> If synchronous operation is desired `fs.openSync()` should be used. <del> <del>* `'w'` - Open file for writing. <del>The file is created (if it does not exist) or truncated (if it exists). <del> <del>* `'wx'` - Like `'w'` but fails if `path` exists. <del> <del>* `'w+'` - Open file for reading and writing. <del>The file is created (if it does not exist) or truncated (if it exists). <del> <del>* `'wx+'` - Like `'w+'` but fails if `path` exists. <del> <del>* `'a'` - Open file for appending. <del>The file is created if it does not exist. <del> <del>* `'ax'` - Like `'a'` but fails if `path` exists. <del> <del>* `'as'` - Open file for appending in synchronous mode. <del>The file is created if it does not exist. <del> <del>* `'a+'` - Open file for reading and appending. <del>The file is created if it does not exist. <del> <del>* `'ax+'` - Like `'a+'` but fails if `path` exists. <del> <del>* `'as+'` - Open file for reading and appending in synchronous mode. <del>The file is created if it does not exist. <add>Asynchronous file open. See open(2). <ide> <ide> `mode` sets the file mode (permission and sticky bits), but only if the file was <ide> created. <ide> <ide> The callback gets two arguments `(err, fd)`. <ide> <del>The exclusive flag `'x'` (`O_EXCL` flag in open(2)) ensures that `path` is newly <del>created. On POSIX systems, `path` is considered to exist even if it is a symlink <del>to a non-existent file. The exclusive flag may or may not work with network file <del>systems. <del> <del>`flags` can also be a number as documented by open(2); commonly used constants <del>are available from `fs.constants`. On Windows, flags are translated to <del>their equivalent ones where applicable, e.g. `O_WRONLY` to `FILE_GENERIC_WRITE`, <del>or `O_EXCL|O_CREAT` to `CREATE_NEW`, as accepted by CreateFileW. <del> <del>On Linux, positional writes don't work when the file is opened in append mode. <del>The kernel ignores the position argument and always appends the data to <del>the end of the file. <del> <del>The behavior of `fs.open()` is platform-specific for some flags. As such, <del>opening a directory on macOS and Linux with the `'a+'` flag - see example <del>below - will return an error. In contrast, on Windows and FreeBSD, a file <del>descriptor will be returned. <del> <del>```js <del>// macOS and Linux <del>fs.open('<directory>', 'a+', (err, fd) => { <del> // => [Error: EISDIR: illegal operation on a directory, open <directory>] <del>}); <del> <del>// Windows and FreeBSD <del>fs.open('<directory>', 'a+', (err, fd) => { <del> // => null, <fd> <del>}); <del>``` <del> <ide> Some characters (`< > : " / \ | ? *`) are reserved under Windows as documented <ide> by [Naming Files, Paths, and Namespaces][]. Under NTFS, if the filename contains <ide> a colon, Node.js will open a file system stream, as described by <ide> a colon, Node.js will open a file system stream, as described by <ide> Functions based on `fs.open()` exhibit this behavior as well. eg. <ide> `fs.writeFile()`, `fs.readFile()`, etc. <ide> <del>*Note:* On Windows, opening an existing hidden file using the `w` flag (either <del>through `fs.open()` or `fs.writeFile()`) will fail with `EPERM`. Existing hidden <del>files can be opened for writing with the `r+` flag. A call to `fs.ftruncate()` <del>can be used to reset the file contents. <del> <ide> ## fs.openSync(path, flags[, mode]) <ide> <!-- YAML <ide> added: v0.1.21 <ide> changes: <ide> --> <ide> <ide> * `path` {string|Buffer|URL} <del>* `flags` {string|number} <add>* `flags` {string|number} See [support of file system `flags`][]. <ide> * `mode` {integer} **Default:** `0o666` <ide> * Returns: {number} <ide> <ide> changes: <ide> * `path` {string|Buffer|URL|integer} filename or file descriptor <ide> * `options` {Object|string} <ide> * `encoding` {string|null} **Default:** `null` <del> * `flag` {string} **Default:** `'r'` <add> * `flag` {string} See [support of file system `flags`][]. **Default:** `'r'`. <ide> * `callback` {Function} <ide> * `err` {Error} <ide> * `data` {string|Buffer} <ide> changes: <ide> * `path` {string|Buffer|URL|integer} filename or file descriptor <ide> * `options` {Object|string} <ide> * `encoding` {string|null} **Default:** `null` <del> * `flag` {string} **Default:** `'r'` <add> * `flag` {string} See [support of file system `flags`][]. **Default:** `'r'`. <ide> * Returns: {string|Buffer} <ide> <ide> Synchronous version of [`fs.readFile()`][]. Returns the contents of the `path`. <ide> changes: <ide> * `options` {Object|string} <ide> * `encoding` {string|null} **Default:** `'utf8'` <ide> * `mode` {integer} **Default:** `0o666` <del> * `flag` {string} **Default:** `'w'` <add> * `flag` {string} See [support of file system `flags`][]. **Default:** `'w'`. <ide> * `callback` {Function} <ide> * `err` {Error} <ide> <ide> changes: <ide> * `options` {Object|string} <ide> * `encoding` {string|null} **Default:** `'utf8'` <ide> * `mode` {integer} **Default:** `0o666` <del> * `flag` {string} **Default:** `'w'` <add> * `flag` {string} See [support of file system `flags`][]. **Default:** `'w'`. <ide> <ide> The synchronous version of [`fs.writeFile()`][]. Returns `undefined`. <ide> <ide> added: REPLACEME <ide> * `options` {Object|string} <ide> * `encoding` {string|null} **Default:** `'utf8'` <ide> * `mode` {integer} **Default:** `0o666` <del> * `flag` {string} **Default:** `'a'` <add> * `flag` {string} See [support of file system `flags`][]. **Default:** `'a'`. <ide> * Returns: {Promise} <ide> <ide> Asynchronously append data to this file, creating the file if it does not yet <ide> added: REPLACEME <ide> --> <ide> * `options` {Object|string} <ide> * `encoding` {string|null} **Default:** `null` <del> * `flag` {string} **Default:** `'r'` <add> * `flag` {string} See [support of file system `flags`][]. **Default:** `'r'`. <ide> * Returns: {Promise} <ide> <ide> Asynchronously reads the entire contents of a file. <ide> added: REPLACEME <ide> * `options` {Object|string} <ide> * `encoding` {string|null} **Default:** `'utf8'` <ide> * `mode` {integer} **Default:** `0o666` <del> * `flag` {string} **Default:** `'w'` <add> * `flag` {string} See [support of file system `flags`][]. **Default:** `'w'`. <ide> * Returns: {Promise} <ide> <ide> Asynchronously writes data to a file, replacing the file if it already exists. <ide> added: REPLACEME <ide> * `options` {Object|string} <ide> * `encoding` {string|null} **Default:** `'utf8'` <ide> * `mode` {integer} **Default:** `0o666` <del> * `flag` {string} **Default:** `'a'` <add> * `flag` {string} See [support of file system `flags`][]. **Default:** `'a'`. <ide> * Returns: {Promise} <ide> <ide> Asynchronously append data to a file, creating the file if it does not yet <ide> added: REPLACEME <ide> --> <ide> <ide> * `path` {string|Buffer|URL} <del>* `flags` {string|number} <add>* `flags` {string|number} See [support of file system `flags`][]. <ide> * `mode` {integer} **Default:** `0o666` (readable and writable) <ide> * Returns: {Promise} <ide> <ide> Asynchronous file open that returns a `Promise` that, when resolved, yields a <ide> `FileHandle` object. See open(2). <ide> <del>The `flags` argument can be: <del> <del>* `'r'` - Open file for reading. <del>An exception occurs if the file does not exist. <del> <del>* `'r+'` - Open file for reading and writing. <del>An exception occurs if the file does not exist. <del> <del>* `'rs+'` - Open file for reading and writing in synchronous mode. Instructs <del> the operating system to bypass the local file system cache. <del> <del> This is primarily useful for opening files on NFS mounts as it allows skipping <del> the potentially stale local cache. It has a very real impact on I/O <del> performance so using this flag is not recommended unless it is needed. <del> <del> Note that this does not turn `fsPromises.open()` into a synchronous blocking <del> call. <del> <del>* `'w'` - Open file for writing. <del>The file is created (if it does not exist) or truncated (if it exists). <del> <del>* `'wx'` - Like `'w'` but fails if `path` exists. <del> <del>* `'w+'` - Open file for reading and writing. <del>The file is created (if it does not exist) or truncated (if it exists). <del> <del>* `'wx+'` - Like `'w+'` but fails if `path` exists. <del> <del>* `'a'` - Open file for appending. <del>The file is created if it does not exist. <del> <del>* `'ax'` - Like `'a'` but fails if `path` exists. <del> <del>* `'as'` - Open file for appending in synchronous mode. <del>The file is created if it does not exist. <del> <del>* `'a+'` - Open file for reading and appending. <del>The file is created if it does not exist. <del> <del>* `'ax+'` - Like `'a+'` but fails if `path` exists. <del> <del>* `'as+'` - Open file for reading and appending in synchronous mode. <del>The file is created if it does not exist. <del> <ide> `mode` sets the file mode (permission and sticky bits), but only if the file was <ide> created. <ide> <del>The exclusive flag `'x'` (`O_EXCL` flag in open(2)) ensures that `path` is newly <del>created. On POSIX systems, `path` is considered to exist even if it is a symlink <del>to a non-existent file. The exclusive flag may or may not work with network file <del>systems. <del> <del>`flags` can also be a number as documented by open(2); commonly used constants <del>are available from `fs.constants`. On Windows, flags are translated to <del>their equivalent ones where applicable, e.g. `O_WRONLY` to `FILE_GENERIC_WRITE`, <del>or `O_EXCL|O_CREAT` to `CREATE_NEW`, as accepted by CreateFileW. <del> <del>On Linux, positional writes don't work when the file is opened in append mode. <del>The kernel ignores the position argument and always appends the data to <del>the end of the file. <del> <del>The behavior of `fsPromises.open()` is platform-specific for some <del>flags. As such, opening a directory on macOS and Linux with the `'a+'` flag will <del>return an error. In contrast, on Windows and FreeBSD, a `FileHandle` will be <del>returned. <del> <ide> Some characters (`< > : " / \ | ? *`) are reserved under Windows as documented <ide> by [Naming Files, Paths, and Namespaces][]. Under NTFS, if the filename contains <ide> a colon, Node.js will open a file system stream, as described by <ide> [this MSDN page][MSDN-Using-Streams]. <ide> <del>*Note:* On Windows, opening an existing hidden file using the `w` flag (e.g. <del>using `fsPromises.open()`) will fail with `EPERM`. Existing hidden <del>files can be opened for writing with the `r+` flag. A call to <del>`fsPromises.ftruncate()` can be used to reset the file contents. <del> <ide> ### fsPromises.read(filehandle, buffer, offset, length, position) <ide> <!-- YAML <ide> added: REPLACEME <ide> added: REPLACEME <ide> * `path` {string|Buffer|URL|FileHandle} filename or `FileHandle` <ide> * `options` {Object|string} <ide> * `encoding` {string|null} **Default:** `null` <del> * `flag` {string} **Default:** `'r'` <add> * `flag` {string} See [support of file system `flags`][]. **Default:** `'r'`. <ide> * Returns: {Promise} <ide> <ide> Asynchronously reads the entire contents of a file. <ide> added: REPLACEME <ide> * `options` {Object|string} <ide> * `encoding` {string|null} **Default:** `'utf8'` <ide> * `mode` {integer} **Default:** `0o666` <del> * `flag` {string} **Default:** `'w'` <add> * `flag` {string} See [support of file system `flags`][]. **Default:** `'w'`. <ide> * Returns: {Promise} <ide> <ide> Asynchronously writes data to a file, replacing the file if it already exists. <ide> The following constants are meant for use with the [`fs.Stats`][] object's <ide> </tr> <ide> </table> <ide> <add>## File System Flags <add> <add>The following flags are available wherever the `flag` option takes a <add>string: <add> <add>* `'a'` - Open file for appending. <add> The file is created if it does not exist. <add> <add>* `'ax'` - Like `'a'` but fails if the path exists. <add> <add>* `'a+'` - Open file for reading and appending. <add> The file is created if it does not exist. <add> <add>* `'ax+'` - Like `'a+'` but fails if the path exists. <add> <add>* `'as'` - Open file for appending in synchronous mode. <add> The file is created if it does not exist. <add> <add>* `'as+'` - Open file for reading and appending in synchronous mode. <add> The file is created if it does not exist. <add> <add>* `'r'` - Open file for reading. <add> An exception occurs if the file does not exist. <add> <add>* `'r+'` - Open file for reading and writing. <add> An exception occurs if the file does not exist. <add> <add>* `'rs+'` - Open file for reading and writing in synchronous mode. Instructs <add> the operating system to bypass the local file system cache. <add> <add> This is primarily useful for opening files on NFS mounts as it allows <add> skipping the potentially stale local cache. It has a very real impact on <add> I/O performance so using this flag is not recommended unless it is needed. <add> <add> Note that this doesn't turn `fs.open()` or `fsPromises.open()` into a <add> synchronous blocking call. If synchronous operation is desired, something <add> like `fs.openSync()` should be used. <add> <add>* `'w'` - Open file for writing. <add> The file is created (if it does not exist) or truncated (if it exists). <add> <add>* `'wx'` - Like `'w'` but fails if the path exists. <add> <add>* `'w+'` - Open file for reading and writing. <add>The file is created (if it does not exist) or truncated (if it exists). <add> <add>* `'wx+'` - Like `'w+'` but fails if the path exists. <add> <add>`flag` can also be a number as documented by open(2); commonly used constants <add>are available from `fs.constants`. On Windows, flags are translated to <add>their equivalent ones where applicable, e.g. `O_WRONLY` to `FILE_GENERIC_WRITE`, <add>or `O_EXCL|O_CREAT` to `CREATE_NEW`, as accepted by CreateFileW. <add> <add>The exclusive flag `'x'` (`O_EXCL` flag in open(2)) ensures that path is newly <add>created. On POSIX systems, path is considered to exist even if it is a symlink <add>to a non-existent file. The exclusive flag may or may not work with network <add>file systems. <add> <add>On Linux, positional writes don't work when the file is opened in append mode. <add>The kernel ignores the position argument and always appends the data to <add>the end of the file. <add> <add>Modifying a file rather than replacing it may require a flags mode of `'r+'` <add>rather than the default mode `'w'`. <add> <add>The behavior of some flags are platform-specific. As such, opening a directory <add>on macOS and Linux with the `'a+'` flag - see example below - will return an <add>error. In contrast, on Windows and FreeBSD, a file descriptor or a `FileHandle` <add>will be returned. <add> <add>```js <add>// macOS and Linux <add>fs.open('<directory>', 'a+', (err, fd) => { <add> // => [Error: EISDIR: illegal operation on a directory, open <directory>] <add>}); <add> <add>// Windows and FreeBSD <add>fs.open('<directory>', 'a+', (err, fd) => { <add> // => null, <fd> <add>}); <add>``` <add> <add>On Windows, opening an existing hidden file using the `'w'` flag (either <add>through `fs.open()` or `fs.writeFile()` or `fsPromises.open()`) will fail with <add>`EPERM`. Existing hidden files can be opened for writing with the `'r+'` flag. <add> <add>A call to `fs.ftruncate()` or `fsPromises.ftruncate()` can be used to reset <add>the file contents. <ide> <ide> [`AHAFS`]: https://www.ibm.com/developerworks/aix/library/au-aix_event_infrastructure/ <ide> [`Buffer.byteLength`]: buffer.html#buffer_class_method_buffer_bytelength_string_encoding <ide> The following constants are meant for use with the [`fs.Stats`][] object's <ide> [inode]: https://en.wikipedia.org/wiki/Inode <ide> [Naming Files, Paths, and Namespaces]: https://msdn.microsoft.com/en-us/library/windows/desktop/aa365247(v=vs.85).aspx <ide> [MSDN-Using-Streams]: https://msdn.microsoft.com/en-us/library/windows/desktop/bb540537.aspx <add>[support of file system `flags`]: #fs_file_system_flags
1
Mixed
Python
add doctests to radix_sort()
5b6ebf8f12fa56f710c4d5fa254d069c0052f520
<ide><path>DIRECTORY.md <ide> * [All Subsequences](https://github.com/TheAlgorithms/Python/blob/master/backtracking/all_subsequences.py) <ide> * [Coloring](https://github.com/TheAlgorithms/Python/blob/master/backtracking/coloring.py) <ide> * [Hamiltonian Cycle](https://github.com/TheAlgorithms/Python/blob/master/backtracking/hamiltonian_cycle.py) <add> * [Knight Tour](https://github.com/TheAlgorithms/Python/blob/master/backtracking/knight_tour.py) <ide> * [Minimax](https://github.com/TheAlgorithms/Python/blob/master/backtracking/minimax.py) <ide> * [N Queens](https://github.com/TheAlgorithms/Python/blob/master/backtracking/n_queens.py) <ide> * [Rat In Maze](https://github.com/TheAlgorithms/Python/blob/master/backtracking/rat_in_maze.py) <ide> ## Compression <ide> * [Burrows Wheeler](https://github.com/TheAlgorithms/Python/blob/master/compression/burrows_wheeler.py) <ide> * [Huffman](https://github.com/TheAlgorithms/Python/blob/master/compression/huffman.py) <add> * [Lempel Ziv](https://github.com/TheAlgorithms/Python/blob/master/compression/lempel_ziv.py) <add> * [Lempel Ziv Decompress](https://github.com/TheAlgorithms/Python/blob/master/compression/lempel_ziv_decompress.py) <ide> * [Peak Signal To Noise Ratio](https://github.com/TheAlgorithms/Python/blob/master/compression/peak_signal_to_noise_ratio.py) <ide> <ide> ## Computer Vision <ide> * [Longest Increasing Subsequence O(Nlogn)](https://github.com/TheAlgorithms/Python/blob/master/dynamic_programming/longest_increasing_subsequence_o(nlogn).py) <ide> * [Longest Sub Array](https://github.com/TheAlgorithms/Python/blob/master/dynamic_programming/longest_sub_array.py) <ide> * [Matrix Chain Order](https://github.com/TheAlgorithms/Python/blob/master/dynamic_programming/matrix_chain_order.py) <add> * [Max Non Adjacent Sum](https://github.com/TheAlgorithms/Python/blob/master/dynamic_programming/max_non_adjacent_sum.py) <ide> * [Max Sub Array](https://github.com/TheAlgorithms/Python/blob/master/dynamic_programming/max_sub_array.py) <ide> * [Max Sum Contiguous Subsequence](https://github.com/TheAlgorithms/Python/blob/master/dynamic_programming/max_sum_contiguous_subsequence.py) <ide> * [Minimum Partition](https://github.com/TheAlgorithms/Python/blob/master/dynamic_programming/minimum_partition.py) <ide> * [Least Recently Used](https://github.com/TheAlgorithms/Python/blob/master/other/least_recently_used.py) <ide> * [Linear Congruential Generator](https://github.com/TheAlgorithms/Python/blob/master/other/linear_congruential_generator.py) <ide> * [Magicdiamondpattern](https://github.com/TheAlgorithms/Python/blob/master/other/magicdiamondpattern.py) <add> * [Markov Chain](https://github.com/TheAlgorithms/Python/blob/master/other/markov_chain.py) <ide> * [Nested Brackets](https://github.com/TheAlgorithms/Python/blob/master/other/nested_brackets.py) <ide> * [Palindrome](https://github.com/TheAlgorithms/Python/blob/master/other/palindrome.py) <ide> * [Password Generator](https://github.com/TheAlgorithms/Python/blob/master/other/password_generator.py) <ide><path>other/markov_chain.py <ide> <ide> <ide> class MarkovChainGraphUndirectedUnweighted: <del> ''' <add> """ <ide> Undirected Unweighted Graph for running Markov Chain Algorithm <del> ''' <add> """ <ide> <ide> def __init__(self): <ide> self.connections = {} <ide> <ide> def add_node(self, node: str) -> None: <ide> self.connections[node] = {} <ide> <del> def add_transition_probability(self, node1: str, <del> node2: str, <del> probability: float) -> None: <add> def add_transition_probability( <add> self, node1: str, node2: str, probability: float <add> ) -> None: <ide> if node1 not in self.connections: <ide> self.add_node(node1) <ide> if node2 not in self.connections: <ide> def transition(self, node: str) -> str: <ide> return dest <ide> <ide> <del>def get_transitions(start: str, <del> transitions: List[Tuple[str, str, float]], <del> steps: int) -> Dict[str, int]: <del> ''' <add>def get_transitions( <add> start: str, transitions: List[Tuple[str, str, float]], steps: int <add>) -> Dict[str, int]: <add> """ <ide> Running Markov Chain algorithm and calculating the number of times each node is <ide> visited <ide> <ide> def get_transitions(start: str, <ide> <ide> >>> result['a'] > result['b'] > result['c'] <ide> True <del> ''' <add> """ <ide> <ide> graph = MarkovChainGraphUndirectedUnweighted() <ide> <ide><path>sorts/radix_sort.py <del>def radix_sort(lst): <del> RADIX = 10 <del> placement = 1 <add>from typing import List <ide> <del> # get the maximum number <del> max_digit = max(lst) <ide> <add>def radix_sort(list_of_ints: List[int]) -> List[int]: <add> """ <add> radix_sort(range(15)) == sorted(range(15)) <add> True <add> radix_sort(reversed(range(15))) == sorted(range(15)) <add> True <add> """ <add> RADIX = 10 <add> placement = 1 <add> max_digit = max(list_of_ints) <ide> while placement < max_digit: <del> # declare and initialize buckets <add> # declare and initialize empty buckets <ide> buckets = [list() for _ in range(RADIX)] <del> <del> # split lst between lists <del> for i in lst: <add> # split list_of_ints between the buckets <add> for i in list_of_ints: <ide> tmp = int((i / placement) % RADIX) <ide> buckets[tmp].append(i) <del> <del> # empty lists into lst array <add> # put each buckets' contents into list_of_ints <ide> a = 0 <ide> for b in range(RADIX): <del> buck = buckets[b] <del> for i in buck: <del> lst[a] = i <add> for i in buckets[b]: <add> list_of_ints[a] = i <ide> a += 1 <del> <ide> # move to next <ide> placement *= RADIX <add> return list_of_ints
3
Go
Go
handle nxdomain, refused and log errors
6dd3f452482c5487cea3f0643d0c70c5215ba1f0
<ide><path>libnetwork/resolver.go <ide> func (r *resolver) ServeDNS(w dns.ResponseWriter, query *dns.Msg) { <ide> logrus.Debugf("[resolver] external DNS %s:%s returned empty response for %q", proto, extDNS.IPStr, name) <ide> break <ide> } <del> if resp.Rcode == dns.RcodeServerFailure { <del> // for Server Failure response, continue to the next external DNS server <del> logrus.Debugf("[resolver] external DNS %s:%s responded with ServFail for %q", proto, extDNS.IPStr, name) <add> switch resp.Rcode { <add> case dns.RcodeServerFailure, dns.RcodeRefused: <add> // Server returned FAILURE: continue with the next external DNS server <add> // Server returned REFUSED: this can be a transitional status, so continue with the next external DNS server <add> logrus.Debugf("[resolver] external DNS %s:%s responded with %s for %q", proto, extDNS.IPStr, statusString(resp.Rcode), name) <add> continue <add> case dns.RcodeNameError: <add> // Server returned NXDOMAIN. Stop resolution if it's an authoritative answer (see RFC 8020: https://tools.ietf.org/html/rfc8020#section-2) <add> logrus.Debugf("[resolver] external DNS %s:%s responded with %s for %q", proto, extDNS.IPStr, statusString(resp.Rcode), name) <add> if resp.Authoritative { <add> break <add> } <add> continue <add> case dns.RcodeSuccess: <add> // All is well <add> default: <add> // Server gave some error. Log the error, and continue with the next external DNS server <add> logrus.Debugf("[resolver] external DNS %s:%s responded with %s (code %d) for %q", proto, extDNS.IPStr, statusString(resp.Rcode), resp.Rcode, name) <ide> continue <ide> } <ide> answers := 0 <ide> func (r *resolver) ServeDNS(w dns.ResponseWriter, query *dns.Msg) { <ide> } <ide> } <ide> <add>func statusString(responseCode int) string { <add> if s, ok := dns.RcodeToString[responseCode]; ok { <add> return s <add> } <add> return "UNKNOWN" <add>} <add> <ide> func (r *resolver) forwardQueryStart() bool { <ide> r.queryLock.Lock() <ide> defer r.queryLock.Unlock()
1
PHP
PHP
fix protocol relative urls for css and js files
5180540d1f5eae68f39ff000f743669ce328d56b
<ide><path>lib/Cake/Test/Case/View/Helper/HtmlHelperTest.php <ide> public function testCssLink() { <ide> $expected['link']['href'] = 'preg:/.*ccss\/cake\.generic\.css/'; <ide> $this->assertTags($result, $expected); <ide> <add> $result = $this->Html->css('//example.com/css/cake.generic.css'); <add> $expected['link']['href'] = 'preg:/.*example\.com\/css\/cake\.generic\.css/'; <add> $this->assertTags($result, $expected); <add> <ide> Configure::write('Asset.filter.css', false); <ide> <ide> $result = explode("\n", trim($this->Html->css(array('cake.generic', 'vendor.generic')))); <ide> public function testScript() { <ide> $this->assertNull($result); <ide> } <ide> <add>/** <add> * Test that Asset.filter.js works. <add> * <add> * @return void <add> */ <add> function testScriptAssetFilter() { <add> Configure::write('Asset.filter.js', 'js.php'); <add> <add> $result = $this->Html->script('jquery-1.3'); <add> $expected = array( <add> 'script' => array('type' => 'text/javascript', 'src' => 'cjs/jquery-1.3.js') <add> ); <add> $this->assertTags($result, $expected); <add> <add> $result = $this->Html->script('//example.com/js/jquery-1.3.js'); <add> $expected = array( <add> 'script' => array('type' => 'text/javascript', 'src' => '//example.com/js/jquery-1.3.js') <add> ); <add> $this->assertTags($result, $expected); <add> } <add> <ide> /** <ide> * test a script file in the webroot/theme dir. <ide> * <ide><path>lib/Cake/View/Helper/HtmlHelper.php <ide> public function css($path, $rel = null, $options = array()) { <ide> return; <ide> } <ide> <del> if (strpos($path, '://') !== false) { <add> if (strpos($path, '//') !== false) { <ide> $url = $path; <ide> } else { <ide> if ($path[0] !== '/') { <ide> public function script($url, $options = array()) { <ide> } <ide> $this->_includedScripts[$url] = true; <ide> <del> if (strpos($url, '://') === false) { <add> if (strpos($url, '//') === false) { <ide> if ($url[0] !== '/') { <ide> $url = JS_URL . $url; <ide> }
2
Text
Text
add details for "heap sort"
e1ae1bdd09f894eae83491ca58815befb257e284
<ide><path>guide/english/algorithms/index.md <ide> There is no sorting discussion which can finish without quick sort. <ide> It is the sorting algorithm which relies on the concept how to sorted arrays are merged to give one sorted arrays. Read more about it here- <ide> [Merge Sort](https://www.geeksforgeeks.org/merge-sort/) <ide> <add>#### Heap Sort <add>A sorting algorithm that works by first organizing the data to be sorted into a special type of binary tree called a heap. The heap itself has, by definition, the largest value at the top of the tree, so the heap sort algorithm must also reverse the order. Read more about it here- <add>[Heap Sort](https://www.geeksforgeeks.org/heap-sort/) <add> <ide> freeCodeCamp's curriculum heavily emphasizes creating algorithms. This is because learning algorithms is a good way to practice programming skills. Interviewers most commonly test candidates on algorithms during developer job interviews. <ide> <ide> ### Further Resources
1
PHP
PHP
remove empty array when plugin requires nothing
a743dacc59de19ae2ee74614a5a0a535cbc7d633
<ide><path>src/Shell/Task/LoadTask.php <ide> protected function _modifyBootstrap($plugin, $hasBootstrap, $hasRoutes, $hasAuto <ide> $append = "\nPlugin::load('%s', [%s]);\n"; <ide> $options = implode(', ', array_filter([$autoloadString, $bootstrapString, $routesString])); <ide> <del> $bootstrap->append(sprintf($append, $plugin, $options)); <add> $bootstrap->append(str_replace(', []', '', sprintf($append, $plugin, $options))); <ide> $this->out(''); <ide> $this->out(sprintf('%s modified', $this->bootstrap)); <ide> return true; <ide><path>tests/TestCase/Shell/Task/LoadTaskTest.php <ide> public function testLoadNoAutoload() <ide> $bootstrap = new File($this->bootstrap, false); <ide> $this->assertContains($expected, $bootstrap->read()); <ide> } <add> <add> /** <add> * testLoad <add> * <add> * @return void <add> */ <add> public function testLoadNothing() <add> { <add> $this->Task->params = [ <add> 'bootstrap' => false, <add> 'routes' => false, <add> 'autoload' => false, <add> ]; <add> <add> $action = $this->Task->main('TestPlugin'); <add> <add> $this->assertTrue($action); <add> <add> $expected = "Plugin::load('TestPlugin');"; <add> $bootstrap = new File($this->bootstrap, false); <add> $this->assertContains($expected, $bootstrap->read()); <add> } <ide> }
2
Python
Python
add validate cli command
fff1028391aee0f4218dfd7f572a86407cee48cf
<ide><path>spacy/__main__.py <ide> import plac <ide> import sys <ide> from spacy.cli import download, link, info, package, train, convert, model <del> from spacy.cli import profile, evaluate <add> from spacy.cli import profile, evaluate, validate <ide> from spacy.util import prints <ide> <ide> commands = { <ide> 'package': package, <ide> 'model': model, <ide> 'profile': profile, <add> 'validate': validate <ide> } <ide> if len(sys.argv) == 1: <ide> prints(', '.join(commands), title="Available commands", exits=1) <ide><path>spacy/cli/__init__.py <ide> from .evaluate import evaluate <ide> from .convert import convert <ide> from .model import model <add>from .validate import validate <ide><path>spacy/cli/validate.py <add># coding: utf8 <add>from __future__ import unicode_literals <add> <add>import requests <add>import pkg_resources <add>from pathlib import Path <add> <add>from ..compat import path2str <add>from ..util import prints, get_data_path, read_json <add>from .. import about <add> <add> <add>def validate(cmd): <add> """Validate that the currently installed version of spaCy is compatible <add> with the installed models. Should be run after `pip install -U spacy`. <add> """ <add> r = requests.get(about.__compatibility__) <add> if r.status_code != 200: <add> prints("Couldn't fetch compatibility table.", <add> title="Server error (%d)" % r.status_code, exits=1) <add> compat = r.json()['spacy'] <add> all_models = set() <add> for spacy_v, models in dict(compat).items(): <add> all_models.update(models.keys()) <add> for model, model_vs in models.items(): <add> compat[spacy_v][model] = [reformat_version(v) for v in model_vs] <add> <add> current_compat = compat[about.__version__] <add> model_links = get_model_links(current_compat) <add> model_pkgs = get_model_pkgs(current_compat, all_models) <add> incompat_links = {l for l, d in model_links.items() if not d['compat']} <add> incompat_models = {d['name'] for _, d in model_pkgs.items() if not d['compat']} <add> incompat_models.update([d['name'] for _, d in model_links.items() if not d['compat']]) <add> na_models = [m for m in incompat_models if m not in current_compat] <add> update_models = [m for m in incompat_models if m in current_compat] <add> <add> prints(path2str(Path(__file__).parent.parent), <add> title="Installed models (spaCy v{})".format(about.__version__)) <add> if model_links or model_pkgs: <add> print(get_row('TYPE', 'NAME', 'MODEL', 'VERSION', '')) <add> for name, data in model_pkgs.items(): <add> print(get_model_row(current_compat, name, data, 'package')) <add> for name, data in model_links.items(): <add> print(get_model_row(current_compat, name, data, 'link')) <add> else: <add> prints("No models found in your current environment.", exits=0) <add> <add> if update_models: <add> cmd = ' python -m spacy download {}' <add> print("\n Use the following commands to update the model packages:") <add> print('\n'.join([cmd.format(pkg) for pkg in update_models])) <add> <add> if na_models: <add> prints("The following models are not available for spaCy v{}: {}" <add> .format(about.__version__, ', '.join(na_models))) <add> <add> if incompat_links: <add> prints("You may also want to overwrite the incompatible links using " <add> "the `spacy link` command with `--force`, or remove them from " <add> "the data directory. Data path: {}" <add> .format(path2str(get_data_path()))) <add> <add> <add>def get_model_links(compat): <add> links = {} <add> data_path = get_data_path() <add> if data_path: <add> models = [p for p in data_path.iterdir() if is_model_path(p)] <add> for model in models: <add> meta_path = Path(model) / 'meta.json' <add> if not meta_path.exists(): <add> continue <add> meta = read_json(meta_path) <add> link = model.parts[-1] <add> name = meta['lang'] + '_' + meta['name'] <add> links[link] = {'name': name, 'version': meta['version'], <add> 'compat': is_compat(compat, name, meta['version'])} <add> return links <add> <add> <add>def get_model_pkgs(compat, all_models): <add> pkgs = {} <add> for pkg_name, pkg_data in pkg_resources.working_set.by_key.items(): <add> package = pkg_name.replace('-', '_') <add> if package in all_models: <add> version = pkg_data.version <add> pkgs[pkg_name] = {'name': package, 'version': version, <add> 'compat': is_compat(compat, package, version)} <add> return pkgs <add> <add> <add>def get_model_row(compat, name, data, type='package'): <add> tpl_row = ' {:<10}' + (' {:<20}' * 4) <add> tpl_red = '\x1b[38;5;1m{}\x1b[0m' <add> tpl_green = '\x1b[38;5;2m{}\x1b[0m' <add> if data['compat']: <add> comp = tpl_green.format('✔') <add> version = tpl_green.format(data['version']) <add> else: <add> comp = '--> {}'.format(compat.get(data['name'], ['n/a'])[0]) <add> version = tpl_red.format(data['version']) <add> return get_row(type, name, data['name'], version, comp) <add> <add> <add>def get_row(*args): <add> tpl_row = ' {:<10}' + (' {:<20}' * 4) <add> return tpl_row.format(*args) <add> <add> <add>def is_model_path(model_path): <add> exclude = ['cache', 'pycache', '__pycache__'] <add> name = model_path.parts[-1] <add> return model_path.is_dir() and name not in exclude and not name.startswith('.') <add> <add> <add>def is_compat(compat, name, version): <add> return name in compat and version in compat[name] <add> <add> <add>def reformat_version(version): <add> if version.endswith('-alpha'): <add> return version.replace('-alpha', 'a0') <add> return version.replace('-alpha', 'a')
3
PHP
PHP
improve docs and add reset() method
f3ae5e6ff1ed8bc42ea15a6ff52a81cded1b023e
<ide><path>lib/Cake/Test/TestCase/Controller/ComponentRegistryTest.php <ide> public function testGetController() { <ide> $result = $this->Components->getController(); <ide> $this->assertInstanceOf('Cake\Controller\Controller', $result); <ide> } <add> <add>/** <add> * Test reset. <add> * <add> * @return void <add> */ <add> public function testReset() { <add> $instance = $this->Components->load('Paginator'); <add> $this->assertSame( <add> $instance, <add> $this->Components->Paginator, <add> 'Instance in registry should be the same as previously loaded' <add> ); <add> $this->assertNull($this->Components->reset(), 'No return expected'); <add> $this->assertNotSame($instance, $this->Components->load('Paginator')); <add> } <ide> } <ide><path>lib/Cake/Utility/ObjectRegistry.php <ide> * Provides registry & factory functionality for object types. Used <ide> * as a super class for various composition based re-use features in CakePHP. <ide> * <del> * Each subclass needs to implement its own load() functionality. Replaces ObjectCollection <del> * in previous versions of CakePHP. <add> * Each subclass needs to implement the various abstract methods to complete <add> * the template method load(). This class replaces ObjectCollection <add> * from previous versions of CakePHP. <ide> * <ide> * @since CakePHP 3.0 <ide> * @see Cake\Controller\ComponentRegistry <ide> abstract class ObjectRegistry { <ide> * Loads/constructs a object instance. <ide> * <ide> * Will return the instance in the registry if it already exists. <del> * You can use `$settings['enabled'] = false` to disable events on an object when loading it. <del> * Not all registry subclasses support events. <add> * If a subclass provides event support, you can use `$settings['enabled'] = false` <add> * to exclude constructed objects from being registered for events. <add> * <add> * Using Cake\Controller\Controller::$components as an example. You can alias <add> * an object by setting the 'className' key, i.e., <ide> * <del> * You can alias an object by setting the 'className' key, i.e., <ide> * {{{ <ide> * public $components = [ <ide> * 'Email' => [ <ide> public function normalizeArray($objects) { <ide> return $normal; <ide> } <ide> <add>/** <add> * Clear loaded instances in the registry. <add> * <add> * @return void <add> */ <add> public function reset() { <add> $this->_loaded = []; <add> } <add> <ide> }
2
Python
Python
use setattr for adding fields to a new instance
853c7a16c15c7291561bc4b3dfbcad88ea262a18
<ide><path>rest_framework/serializers.py <ide> def restore_object(self, attrs, instance=None): <ide> if isinstance(self.fields.get(field_name, None), Serializer): <ide> nested_forward_relations[field_name] = attrs[field_name] <ide> <del> # Update an existing instance... <del> if instance is not None: <del> for key, val in attrs.items(): <del> try: <del> setattr(instance, key, val) <del> except ValueError: <del> self._errors[key] = self.error_messages['required'] <add> # Create an empty instance of the model <add> if instance is None: <add> instance = self.opts.model() <ide> <del> # ...or create a new instance <del> else: <del> instance = self.opts.model(**attrs) <add> for key, val in attrs.items(): <add> try: <add> setattr(instance, key, val) <add> except ValueError: <add> self._errors[key] = self.error_messages['required'] <ide> <ide> # Any relations that cannot be set until we've <ide> # saved the model get hidden away on these <ide><path>rest_framework/tests/test_genericrelations.py <ide> class Meta: <ide> } <ide> ] <ide> self.assertEqual(serializer.data, expected) <add> <add> def test_restore_object_generic_fk(self): <add> """ <add> Ensure an object with a generic foreign key can be restored. <add> """ <add> <add> class TagSerializer(serializers.ModelSerializer): <add> class Meta: <add> model = Tag <add> exclude = ('content_type', 'object_id') <add> <add> serializer = TagSerializer() <add> <add> bookmark = Bookmark(url='http://example.com') <add> attrs = {'tagged_item': bookmark, 'tag': 'example'} <add> <add> tag = serializer.restore_object(attrs) <add> self.assertEqual(tag.tagged_item, bookmark)
2
Python
Python
fix rackspace tests
14b68f59e7c3180846e41fe726d43bdaffdb5327
<ide><path>libcloud/test/compute/test_rackspace.py <ide> class RackspaceNovaLonTests(BaseRackspaceNovaTestCase, OpenStack_1_1_Tests): <ide> driver_args = RACKSPACE_NOVA_PARAMS <ide> driver_kwargs = {'region': 'lon'} <ide> <del> conn_classes = RackspaceNovaLonMockHttp <add> conn_class = RackspaceNovaLonMockHttp <ide> auth_url = 'https://lon.auth.api.example.com' <ide> <ide> expected_endpoint = 'https://lon.servers.api.rackspacecloud.com/v2/1337'
1
Go
Go
set default directory
c2d183426ba2fb4e850dc006d3ad3cc3bd86cc24
<ide><path>daemon/oci_windows.go <ide> func (daemon *Daemon) createSpec(c *container.Container) (*libcontainerd.Spec, e <ide> s.Process.Args = escapeArgs(s.Process.Args) <ide> } <ide> s.Process.Cwd = c.Config.WorkingDir <add> if len(s.Process.Cwd) == 0 { <add> // We default to C:\ to workaround the oddity of the case that the <add> // default directory for cmd running as LocalSystem (or <add> // ContainerAdministrator) is c:\windows\system32. Hence docker run <add> // <image> cmd will by default end in c:\windows\system32, rather <add> // than 'root' (/) on Linux. The oddity is that if you have a dockerfile <add> // which has no WORKDIR and has a COPY file ., . will be interpreted <add> // as c:\. Hence, setting it to default of c:\ makes for consistency. <add> s.Process.Cwd = `C:\` <add> } <ide> s.Process.Env = c.CreateDaemonEnvironment(linkedEnv) <ide> s.Process.InitialConsoleSize = c.HostConfig.ConsoleSize <ide> s.Process.Terminal = c.Config.Tty <ide><path>integration-cli/docker_cli_build_test.go <ide> func (s *DockerSuite) TestBuildRelativeWorkdir(c *check.C) { <ide> expected4 string <ide> expectedFinal string <ide> ) <add> // TODO Windows: The expectedFinal needs fixing to match Windows <add> // filepath semantics. However, this is a non-trivial change. @jhowardmsft <add> // Short story - need to make the configuration file platform semantically <add> // consistent, so even if `WORKDIR /test2/test3` is specified in a Dockerfile, <add> // the configuration should be stored as C:\test2\test3. Something similar to <add> // if runtime.GOOS == "windows" && len(workdir) > 2 && string(workdir[0]) == `\` { <add> // workdir = "C:" + workdir <add> // } <add> // in builder\dockerfile\dispatchers.go, function workdir(), but also <add> // ironing out all other cases where this causes other failures. <ide> if daemonPlatform == "windows" { <del> expected1 = `C:/Windows/system32` <add> expected1 = `C:/` <ide> expected2 = `C:/test1` <ide> expected3 = `C:/test2` <ide> expected4 = `C:/test2/test3` <ide> func (s *DockerSuite) TestBuildRelativeWorkdir(c *check.C) { <ide> <ide> _, err := buildImage(name, <ide> `FROM busybox <del> RUN sh -c "[ "$PWD" = '`+expected1+`' ]" <add> RUN sh -c "[ "$PWD" = "`+expected1+`" ]" <ide> WORKDIR test1 <del> RUN sh -c "[ "$PWD" = '`+expected2+`' ]" <add> RUN sh -c "[ "$PWD" = "`+expected2+`" ]" <ide> WORKDIR /test2 <del> RUN sh -c "[ "$PWD" = '`+expected3+`' ]" <add> RUN sh -c "[ "$PWD" = "`+expected3+`" ]" <ide> WORKDIR test3 <del> RUN sh -c "[ "$PWD" = '`+expected4+`' ]"`, <add> RUN sh -c "[ "$PWD" = "`+expected4+`" ]"`, <ide> true) <ide> if err != nil { <ide> c.Fatal(err)
2
Javascript
Javascript
improve example description
c54f7a93e09d165d8e6742da7c8b7df2391f0c91
<ide><path>src/ng/directive/ngRepeat.js <ide> * <ide> * @example <ide> * This example uses `ngRepeat` to display a list of people. A filter is used to restrict the displayed <del> * results by name. New (entering) and removed (leaving) items are animated. <add> * results by name or by age. New (entering) and removed (leaving) items are animated. <ide> <example module="ngRepeat" name="ngRepeat" deps="angular-animate.js" animations="true" name="ng-repeat"> <ide> <file name="index.html"> <ide> <div ng-controller="repeatController">
1
Javascript
Javascript
fix abnormal close js exception
9c75871a8152f03d73ec52fc49c3e65a91a78d1e
<ide><path>Libraries/Utilities/HMRClient.js <ide> Error: ${e.message}`; <ide> // https://www.rfc-editor.org/rfc/rfc6455.html#section-7.4.1 <ide> // https://www.rfc-editor.org/rfc/rfc6455.html#section-7.1.5 <ide> const isNormalOrUnsetCloseReason = <add> closeEvent == null || <ide> closeEvent.code === 1000 || <ide> closeEvent.code === 1005 || <ide> closeEvent.code == null;
1
Go
Go
use spf13/cobra for docker pause
91731706c2c7d7efba78045ff8080f2b38d07c4f
<ide><path>api/client/commands.go <ide> func (cli *DockerCli) Command(name string) func(...string) error { <ide> "load": cli.CmdLoad, <ide> "login": cli.CmdLogin, <ide> "logout": cli.CmdLogout, <del> "pause": cli.CmdPause, <ide> "ps": cli.CmdPs, <ide> "pull": cli.CmdPull, <ide> "push": cli.CmdPush, <ide><path>api/client/container/pause.go <add>package container <add> <add>import ( <add> "fmt" <add> "strings" <add> <add> "golang.org/x/net/context" <add> <add> "github.com/docker/docker/api/client" <add> "github.com/docker/docker/cli" <add> "github.com/spf13/cobra" <add>) <add> <add>type pauseOptions struct { <add> containers []string <add>} <add> <add>// NewPauseCommand creats a new cobra.Command for `docker pause` <add>func NewPauseCommand(dockerCli *client.DockerCli) *cobra.Command { <add> var opts pauseOptions <add> <add> cmd := &cobra.Command{ <add> Use: "pause CONTAINER [CONTAINER...]", <add> Short: "Pause all processes within one or more containers", <add> Args: cli.RequiresMinArgs(1), <add> RunE: func(cmd *cobra.Command, args []string) error { <add> opts.containers = args <add> return runPause(dockerCli, &opts) <add> }, <add> } <add> cmd.SetFlagErrorFunc(flagErrorFunc) <add> <add> return cmd <add>} <add> <add>func runPause(dockerCli *client.DockerCli, opts *pauseOptions) error { <add> ctx := context.Background() <add> <add> var errs []string <add> for _, container := range opts.containers { <add> if err := dockerCli.Client().ContainerPause(ctx, container); err != nil { <add> errs = append(errs, err.Error()) <add> } else { <add> fmt.Fprintf(dockerCli.Out(), "%s\n", container) <add> } <add> } <add> if len(errs) > 0 { <add> return fmt.Errorf("%s", strings.Join(errs, "\n")) <add> } <add> return nil <add>} <ide><path>api/client/pause.go <del>package client <del> <del>import ( <del> "fmt" <del> "strings" <del> <del> "golang.org/x/net/context" <del> <del> Cli "github.com/docker/docker/cli" <del> flag "github.com/docker/docker/pkg/mflag" <del>) <del> <del>// CmdPause pauses all processes within one or more containers. <del>// <del>// Usage: docker pause CONTAINER [CONTAINER...] <del>func (cli *DockerCli) CmdPause(args ...string) error { <del> cmd := Cli.Subcmd("pause", []string{"CONTAINER [CONTAINER...]"}, Cli.DockerCommands["pause"].Description, true) <del> cmd.Require(flag.Min, 1) <del> <del> cmd.ParseFlags(args, true) <del> <del> ctx := context.Background() <del> <del> var errs []string <del> for _, name := range cmd.Args() { <del> if err := cli.client.ContainerPause(ctx, name); err != nil { <del> errs = append(errs, err.Error()) <del> } else { <del> fmt.Fprintf(cli.out, "%s\n", name) <del> } <del> } <del> if len(errs) > 0 { <del> return fmt.Errorf("%s", strings.Join(errs, "\n")) <del> } <del> return nil <del>} <ide><path>cli/cobraadaptor/adaptor.go <ide> func NewCobraAdaptor(clientFlags *cliflags.ClientFlags) CobraAdaptor { <ide> container.NewDiffCommand(dockerCli), <ide> container.NewExportCommand(dockerCli), <ide> container.NewLogsCommand(dockerCli), <add> container.NewPauseCommand(dockerCli), <ide> container.NewPortCommand(dockerCli), <ide> container.NewRunCommand(dockerCli), <ide> container.NewStartCommand(dockerCli), <ide><path>cli/usage.go <ide> var DockerCommandUsage = []Command{ <ide> {"load", "Load an image from a tar archive or STDIN"}, <ide> {"login", "Log in to a Docker registry"}, <ide> {"logout", "Log out from a Docker registry"}, <del> {"pause", "Pause all processes within a container"}, <ide> {"ps", "List containers"}, <ide> {"pull", "Pull an image or a repository from a registry"}, <ide> {"push", "Push an image or a repository to a registry"},
5
Javascript
Javascript
fix typo in text
2fb9eeb7e10cfbea778b5e26a0871c6679b96bc5
<ide><path>Libraries/Text/Text.js <ide> const viewConfig = { <ide> * <ide> * In the following example, the nested title and body text will inherit the <ide> * `fontFamily` from `styles.baseText`, but the title provides its own <del> * additional styles. The title and body willstack on top of each other on <add> * additional styles. The title and body will stack on top of each other on <ide> * account of the literal newlines: <ide> * <ide> * ```ReactNativeWebPlayer
1
Text
Text
update portuguese sql inner join guide
68bacae50287f4388bdcaabaf3c314b41b0cd681
<ide><path>guide/portuguese/sql/sql-inner-join-keyword/index.md <ide> Para este guia, discutiremos as junções SQL (INNER) <ide> <ide> ### Junte-se (mesmo que a junção interna) <ide> <del>A tabela do aluno estará na cláusula FROM, portanto, será uma tabela inicial ou LEFT. <add>A tabela do aluno estará na cláusula FROM, portanto, será uma tabela inicial ou ESQUERDA. <ide> <ide> Vamos nos juntar à tabela de contatos dos alunos ou à tabela DIREITA. Você verá que todos os alunos aparecem que também estão na tabela de contatos. Conforme mostrado nas tabelas abaixo, o studentID 9 está na tabela do aluno, mas NÃO na tabela de contatos, portanto, não aparecerá em uma junção. <ide> <ide> SELECT a.studentID, a.FullName, a.programOfStudy, <ide> INNER JOIN `student-contact-info` AS b ON a.studentID = b.studentID; <ide> ``` <ide> <del>Dados "cadastrados" \`\` \`text + ----------- + ------------------------ + ------------ ------ + -------------------- + -------------------- + | studentID | FullName | programOfStudy | estudante-telefone-celular | student-US-zipcode | + ----------- + ------------------------ + ------------ ------ + -------------------- + -------------------- + | 1 | Monique Davis | Literatura 555-555-5551 | 97111 | | 2 | Teri Gutierrez | Programação | 555-555-5552 | 97112 | | 3 | Spencer Pautier | Programação | 555-555-5553 | 97113 | | 4 | Louis Ramsey | Programação | 555-555-5554 | 97114 | | 5 | Alvin Greene | Programação | 555-555-5555 | 97115 | | 6 | Sophie Freeman | Programação | 555-555-5556 | 97116 | | 7 | Edgar Frank "Ted" Codd | Ciência da Computação | 555-555-5557 | 97117 | | 8 | Donald D. Chamberlin | Ciência da Computação | 555-555-5558 | 97118 | + ----------- + ------------------------ + ------------ ------ + -------------------- + -------------------- + <add>Dados "cadastrados" <add>```text <add>+ ----------- + ------------------------ + --------------------- + -------------------- + ------------------- + <add>| studentID | FullName | programOfStudy | student-phone-cell | student-US-zipcode | <add>+ ----------- + ------------------------ + --------------------- + -------------------- + ------------------- + <add>| 1 | Monique Davis | Literatura | 555-555-5551 | 97111 | <add>| 2 | Teri Gutierrez | Programação | 555-555-5552 | 97112 | <add>| 3 | Spencer Pautier | Programação | 555-555-5553 | 97113 | <add>| 4 | Louis Ramsey | Programação | 555-555-5554 | 97114 | <add>| 5 | Alvin Greene | Programação | 555-555-5555 | 97115 | <add>| 6 | Sophie Freeman | Programação | 555-555-5556 | 97116 | <add>| 7 | Edgar Frank "Ted" Codd | Ciência da Computação | 555-555-5557 | 97117 | <add>| 8 | Donald D. Chamberlin | Ciência da Computação | 555-555-5558 | 97118 | <add>+ ----------- + ------------------------ + --------------------- + -------------------- + ------------------- + <add>8 linhas no set (0,00 seg) <ide> ``` <ide> ### Complete table listings for reference <ide> <del> Student table SQL <del>``` <del> <del>sql SELECT a.studentID, a.FullName, sat\_score, a.programOfStudy, schoolEmailAdr DE estudante COMO; <add> SQL da tabela student <add> <add>```sql <add>SELECT a.studentID, a.FullName, sat_score, a.programOfStudy, schoolEmailAdr FROM student AS a; <ide> ``` <del>student or LEFT table <add>student or tabela ESQUERDA <add> <add>```text <add>+ ----------- + ------------------------ + ----------- + --------------------- + ------------------------ + <add>| studentID | FullName | sat_score | programOfStudy | schoolEmailAdr | <add>+ ----------- + ------------------------ + ----------- + --------------------- + ------------------------ + <add>| 1 | Monique Davis | 400 | Literatura | Monique@someSchool.edu | <add>| 2 | Teri Gutierrez | 800 | Programação | Teri@someSchool.edu | <add>| 3 | Spencer Pautier | 1000 | Programação | Spencer@someSchool.edu | <add>| 4 | Louis Ramsey | 1200 | Programação | Louis@someSchool.edu | <add>| 5 | Alvin Greene | 1200 | Programação | Alvin@someSchool.edu | <add>| 6 | Sophie Freeman | 1200 | Programação | Sophie@someSchool.edu | <add>| 7 | Edgar Frank "Ted" Codd | 2400 | Ciência da Computação | Edgar@someSchool.edu | <add>| 8 | Donald D. Chamberlin | 2400 | Ciência da Computação | Donald@someSchool.edu | <add>| 9 | Raymond F. Boyce | 2400 | Ciência da Computação | Raymond@someSchool.edu | <add>+ ----------- + ------------------------ + ----------- + --------------------- + ------------------------ + <add>9 linhas no set (0,00 seg) <ide> ``` <ide> <del>texto + ----------- + ------------------------ + ----------- + ------------------ + ------------------------ + | studentID | FullName | sat\_score | programOfStudy | schoolEmailAdr | + ----------- + ------------------------ + ----------- + ------------------ + ------------------------ + | 1 | Monique Davis | 400 | Literatura Monique@someSchool.edu | | 2 | Teri Gutierrez | 800 | Programação | Teri@someSchool.edu | | 3 | Spencer Pautier | 1000 | Programação | Spencer@someSchool.edu | | 4 | Louis Ramsey | 1200 | Programação | Louis@someSchool.edu | | 5 | Alvin Greene | 1200 | Programação | Alvin@someSchool.edu | | 6 | Sophie Freeman | 1200 | Programação | Sophie@someSchool.edu | | 7 | Edgar Frank "Ted" Codd | 2400 | Ciência da Computação | Edgar@someSchool.edu | | 8 | Donald D. Chamberlin | 2400 | Ciência da Computação | Donald@someSchool.edu | | 9 | Raymond F. Boyce | 2400 | Ciência da Computação | Raymond@someSchool.edu | + ----------- + ------------------------ + ----------- + ------------------ + ------------------------ + 9 linhas no set (0,00 seg) <add>SQL da tabela student-contact-info <ide> <ide> ```sql <del>SELECT * FROM `student-contact-info` AS b; <add>SELECT * FROM `student-contact-info` AS b; <ide> ``` <ide> <del>mesa de contato do estudante ou mesa DIREITA `text +-----------+----------------------------------+--------------------+--------------------+ | studentID | studentEmailAddr | student-phone-cell | student-US-zipcode | +-----------+----------------------------------+--------------------+--------------------+ | 1 | Monique.Davis@freeCodeCamp.org | 555-555-5551 | 97111 | | 2 | Teri.Gutierrez@freeCodeCamp.org | 555-555-5552 | 97112 | | 3 | Spencer.Pautier@freeCodeCamp.org | 555-555-5553 | 97113 | | 4 | Louis.Ramsey@freeCodeCamp.org | 555-555-5554 | 97114 | | 5 | Alvin.Green@freeCodeCamp.org | 555-555-5555 | 97115 | | 6 | Sophie.Freeman@freeCodeCamp.org | 555-555-5556 | 97116 | | 7 | Maximo.Smith@freeCodeCamp.org | 555-555-5557 | 97117 | | 8 | Michael.Roach@freeCodeCamp.ort | 555-555-5558 | 97118 | +-----------+----------------------------------+--------------------+--------------------+ 8 rows in set (0.00 sec)` <add>tabela de contato do estudante ou mesa DIREITA <add> <add>```text <add>+-----------+----------------------------------+--------------------+--------------------+ <add>| studentID | studentEmailAddr | student-phone-cell | student-US-zipcode | <add>+-----------+----------------------------------+--------------------+--------------------+ <add>| 1 | Monique.Davis@freeCodeCamp.org | 555-555-5551 | 97111 | <add>| 2 | Teri.Gutierrez@freeCodeCamp.org | 555-555-5552 | 97112 | <add>| 3 | Spencer.Pautier@freeCodeCamp.org | 555-555-5553 | 97113 | <add>| 4 | Louis.Ramsey@freeCodeCamp.org | 555-555-5554 | 97114 | <add>| 5 | Alvin.Green@freeCodeCamp.org | 555-555-5555 | 97115 | <add>| 6 | Sophie.Freeman@freeCodeCamp.org | 555-555-5556 | 97116 | <add>| 7 | Maximo.Smith@freeCodeCamp.org | 555-555-5557 | 97117 | <add>| 8 | Michael.Roach@freeCodeCamp.org | 555-555-5558 | 97118 | <add>+-----------+----------------------------------+--------------------+--------------------+ <add>8 linhas no set (0,00 seg) <add>``` <ide> <ide> ### Conclusão <ide> <ide> Como acontece com todas essas coisas SQL, MUITO MAIS para elas é o que está neste guia introdutório. <ide> <ide> Espero que pelo menos isso lhe dê o suficiente para começar. <ide> <del>Por favor, consulte o manual do seu gerenciador de banco de dados e divirta-se tentando opções diferentes. <ide>\ No newline at end of file <add>Por favor, consulte o manual do seu gerenciador de banco de dados e divirta-se tentando opções diferentes.
1
Text
Text
fix added version of randomfill+randomfillsync
fa19ce92339edb0d741bfe1855ac39d4bc80e1d2
<ide><path>doc/api/crypto.md <ide> request. <ide> <ide> ### crypto.randomFillSync(buffer[, offset][, size]) <ide> <!-- YAML <del>added: v7.10.0 <add>added: <add> - v7.10.0 <add> - v6.13.0 <ide> changes: <ide> - version: v9.0.0 <ide> pr-url: https://github.com/nodejs/node/pull/15231 <ide> console.log(Buffer.from(crypto.randomFillSync(c).buffer, <ide> <ide> ### crypto.randomFill(buffer[, offset][, size], callback) <ide> <!-- YAML <del>added: v7.10.0 <add>added: <add> - v7.10.0 <add> - v6.13.0 <ide> changes: <ide> - version: v9.0.0 <ide> pr-url: https://github.com/nodejs/node/pull/15231
1
PHP
PHP
add request tests
82068c2bfef86119434208a01bcf1f4fc3b03e1b
<ide><path>tests/Http/HttpRequestTest.php <ide> public function testCreateFromBase() <ide> <ide> $this->assertEquals($request->request->all(), $body); <ide> } <add> <add> public function testHttpRequestFlashCallsSessionFlashInputWithInputData() <add> { <add> $session = m::mock('Illuminate\Session\Store'); <add> $session->shouldReceive('flashInput')->once()->with(['name' => 'Taylor', 'email' => 'foo']); <add> $request = Request::create('/', 'GET', ['name' => 'Taylor', 'email' => 'foo']); <add> $request->setSession($session); <add> $request->flash(); <add> } <add> <add> public function testHttpRequestFlashOnlyCallsFlashWithProperParameters() <add> { <add> $request = m::mock('Illuminate\Http\Request[flash]'); <add> $request->shouldReceive('flash')->once()->with('only', ['key1', 'key2']); <add> $request->flashOnly(['key1', 'key2']); <add> } <add> <add> public function testHttpRequestFlashExceptCallsFlashWithProperParameters() <add> { <add> $request = m::mock('Illuminate\Http\Request[flash]'); <add> $request->shouldReceive('flash')->once()->with('except', ['key1', 'key2']); <add> $request->flashExcept(['key1', 'key2']); <add> } <ide> }
1
Javascript
Javascript
document the workspacecenter class
c34061a52e3752339adb5dc1473e6931fbf71895
<ide><path>src/workspace-center.js <ide> const TextEditor = require('./text-editor') <ide> const PaneContainer = require('./pane-container') <ide> <add>// Essential: Represents the workspace at the center of the entire window. <ide> module.exports = class WorkspaceCenter { <ide> constructor (params) { <ide> params.location = 'center'
1
Text
Text
change titles on lines 51 and 77
a8115b11817553db0938c97a3765f3971c8b3330
<ide><path>guide/portuguese/html/tutorials/how-to-use-lists/index.md <ide> Uma lista não ordenada é usada para agrupar um conjunto de itens relacionados, <ide> * Bolo floresta negra <ide> * Bolo de abacaxi <ide> <del>### Descrição Listas <add>### Listas de descrição <ide> <ide> Uma lista de descrição é usada para especificar uma lista de termos e suas descrições. Esta lista é criada com a tag `<dl>` . Cada item da lista é cercado pela tag `<dd>` . <ide> <ide> Café <ide> <ide> Uma bebida feita a partir de grãos de café torrados. <ide> <del>#### Lista de estilo <add>#### Estilo da lista <ide> <ide> Você também pode controlar o estilo da lista. Você pode usar `list-style` propriedade de listas de `list-style` . Sua lista pode ser marcadores, quadrados, números numéricos ou imagens que você deseja. <ide> <ide> `list-style` propriedade `list-style` é uma abreviação para `list-style-type` , `list-style-position` e `list-style-image` . <ide> <ide> #### Mais Informações: <ide> <del>\[Listas HTML · Documentos WebPlatform\] (https://webplatform.github.io/docs/guides/html\_lists/ ) <ide>\ No newline at end of file <add>\[Listas HTML · Documentos WebPlatform\] (https://webplatform.github.io/docs/guides/html\_lists/ )
1
Ruby
Ruby
prefer normal method call over method_missing
aa756a4c4490b9260618b217eba6b7aa84629c67
<ide><path>activesupport/lib/active_support/multibyte/chars.rb <ide> def reverse <ide> # <ide> # 'こんにちは'.mb_chars.limit(7).to_s # => "こん" <ide> def limit(limit) <del> truncate_bytes(limit, omission: nil) <add> chars(@wrapped_string.truncate_bytes(limit, omission: nil)) <ide> end <ide> <ide> # Capitalizes the first letter of every word, when possible.
1
Javascript
Javascript
add watch test case
0d6b5db12e92464c3070ebe9b0205f8954e6d9c1
<ide><path>test/watchCases/cache/loader-import-module/0/a.generate-json.js <add>export const value = 42; <add>export * from "./imported.js"; <add>export { default as nested } from "./b.generate-json.js"; <add>export const random = Math.random(); <ide><path>test/watchCases/cache/loader-import-module/0/b.generate-json.js <add>export const value = 42; <add>export * from "./imported.js"; <ide><path>test/watchCases/cache/loader-import-module/0/imported.js <add>export const a = "a"; <add>export const b = "b"; <ide><path>test/watchCases/cache/loader-import-module/0/index.js <add>import a from "./a.generate-json.js"; <add>import { value as unrelated } from "./unrelated"; <add> <add>it("should have to correct values and validate on change", () => { <add> const step = +WATCH_STEP; <add> expect(a.value).toBe(42); <add> expect(a.a).toBe("a"); <add> expect(a.nested.value).toBe(step < 3 ? 42 : 24); <add> expect(a.nested.a).toBe(step < 3 ? "a" : undefined); <add> expect(a.b).toBe(step < 1 ? "b" : undefined); <add> expect(a.nested.b).toBe(step < 1 ? "b" : undefined); <add> expect(a.c).toBe(step < 1 ? undefined : "c"); <add> expect(a.nested.c).toBe(step < 1 || step >= 3 ? undefined : "c"); <add> if (step !== 0) { <add> expect(STATE.random === a.random).toBe(step === 2); <add> } <add> STATE.random = a.random; <add>}); <ide><path>test/watchCases/cache/loader-import-module/0/loader.js <add>exports.pitch = async function (remaining) { <add> const result = await this.importModule( <add> `${this.resourcePath}.webpack[javascript/auto]!=!${remaining}` <add> ); <add> return JSON.stringify(result, null, 2); <add>}; <ide><path>test/watchCases/cache/loader-import-module/0/unrelated.js <add>export const value = 42; <ide><path>test/watchCases/cache/loader-import-module/1/imported.js <add>export const a = "a"; <add>export const c = "c"; <ide><path>test/watchCases/cache/loader-import-module/2/unrelated.js <add>export const value = 24; <ide><path>test/watchCases/cache/loader-import-module/3/b.generate-json.js <add>export const value = 24; <ide><path>test/watchCases/cache/loader-import-module/webpack.config.js <add>/** @type {import("../../../../").Configuration} */ <add>module.exports = { <add> module: { <add> rules: [ <add> { <add> test: /\.generate-json\.js$/, <add> use: "./loader", <add> type: "json" <add> } <add> ] <add> } <add>};
10
Javascript
Javascript
move debugenvironment helper to open source
990dd869cf721ecc563544bcba062d37befe1b51
<ide><path>Libraries/Utilities/DebugEnvironment.js <add>/** <add> * Copyright (c) Facebook, Inc. and its affiliates. <add> * <add> * This source code is licensed under the MIT license found in the <add> * LICENSE file in the root directory of this source tree. <add> * <add> * @format <add> * @flow strict-local <add> */ <add> <add>'use strict'; <add> <add>export let isAsyncDebugging: boolean = false; <add> <add>if (__DEV__) { <add> // These native interfaces don't exist in asynchronous debugging environments. <add> isAsyncDebugging = <add> !global.nativeExtensions && <add> !global.nativeCallSyncHook && <add> !global.RN$Bridgeless; <add>}
1
Javascript
Javascript
copy some sizzle combinators tests
80ea65edf7466afc11823a914b175bd835d5b228
<ide><path>test/unit/selector.js <ide> test( "selectors with comma", function() { <ide> equal( fixture.find( "h2 , div p" ).filter( "h2" ).length, 1, "has to find one <h2>" ); <ide> }); <ide> <add>test("child and adjacent", function() { <add> expect( 27 ); <add> <add> var nothiddendiv; <add> <add> t( "Child", "p > a", ["simon1","google","groups","mark","yahoo","simon"] ); <add> t( "Child", "p> a", ["simon1","google","groups","mark","yahoo","simon"] ); <add> t( "Child", "p >a", ["simon1","google","groups","mark","yahoo","simon"] ); <add> t( "Child", "p>a", ["simon1","google","groups","mark","yahoo","simon"] ); <add> t( "Child w/ Class", "p > a.blog", ["mark","simon"] ); <add> t( "All Children", "code > *", ["anchor1","anchor2"] ); <add> t( "All Grandchildren", "p > * > *", ["anchor1","anchor2"] ); <add> t( "Adjacent", "p + p", ["ap","en","sap"] ); <add> t( "Adjacent", "p#firstp + p", ["ap"] ); <add> t( "Adjacent", "p[lang=en] + p", ["sap"] ); <add> t( "Adjacent", "a.GROUPS + code + a", ["mark"] ); <add> t( "Element Preceded By", "#groups ~ a", ["mark"] ); <add> t( "Element Preceded By", "#length ~ input", ["idTest"] ); <add> t( "Element Preceded By", "#siblingfirst ~ em", ["siblingnext", "siblingthird"] ); <add> t( "Element Preceded By (multiple)", "#siblingTest em ~ em ~ em ~ span", ["siblingspan"] ); <add> t( "Element Preceded By, Containing", "#liveHandlerOrder ~ div em:contains('1')", ["siblingfirst"] ); <add> <add> t( "Multiple combinators selects all levels", "#siblingTest em *", ["siblingchild", "siblinggrandchild", "siblinggreatgrandchild"] ); <add> t( "Multiple combinators selects all levels", "#siblingTest > em *", ["siblingchild", "siblinggrandchild", "siblinggreatgrandchild"] ); <add> t( "Multiple sibling combinators doesn't miss general siblings", "#siblingTest > em:first-child + em ~ span", ["siblingspan"] ); <add> t( "Combinators are not skipped when mixing general and specific", "#siblingTest > em:contains('x') + em ~ span", [] ); <add> <add> equal( jQuery("#listWithTabIndex").length, 1, "Parent div for next test is found via ID (#8310)" ); <add> equal( jQuery("#listWithTabIndex li:eq(2) ~ li").length, 1, "Find by general sibling combinator (#8310)" ); <add> equal( jQuery("#__sizzle__").length, 0, "Make sure the temporary id assigned by sizzle is cleared out (#8310)" ); <add> equal( jQuery("#listWithTabIndex").length, 1, "Parent div for previous test is still found via ID (#8310)" ); <add> <add> t( "Verify deep class selector", "div.blah > p > a", [] ); <add> <add> t( "No element deep selector", "div.foo > span > a", [] ); <add> <add> nothiddendiv = document.getElementById("nothiddendiv"); <add> <add> t( "Non-existant ancestors", ".fototab > .thumbnails > a", [] ); <add>}); <add> <ide> test("attributes", function() { <ide> expect( 54 ); <ide>
1
Text
Text
jump search code in java
12ef1b792524f53ee1f45947e49b7bc46f954786
<ide><path>guide/english/algorithms/search-algorithms/jump-search/index.md <ide> O(√N) <ide> <ide> ![Jumping Search 1](https://i1.wp.com/theoryofprogramming.com/wp-content/uploads/2016/11/jump-search-1.jpg?resize=676%2C290) <ide> <add># Code In Java. <add> <add>``` Java <add> <add>public int jumpSearch(int[] arr, int x) <add>{ <add> int n = arr.length; <add> <add> // Finding the size to be jumped <add> int jumpSize = (int) Math.floor(Math.sqrt(n)); <add> <add> // Finding the index where element is present <add> int index = 0; <add> while (arr[Math.min(jumpSize, n)-1] < x) <add> { <add> index = jumpSize; <add> jumpSize += (int) Math.floor(Math.sqrt(n)); <add> if (index >= n) <add> return -1; <add> } <add> // Searching for x beginning with index. <add> while (arr[index] < x) <add> { <add> index++; <add> // If we reached next index or end of array then element is not present. <add> if (index == Math.min(jumpSize, n)) <add> return -1; <add> } <add> // If element is found <add> if (arr[index] == x) <add> return index; <add> return -1; <add>} <add> <add>``` <add> <ide> # Code <ide> To view examples of code implementation for this method, access this link below: <ide>
1
Javascript
Javascript
fix flaky test-repl
ef6c4c694f901dbd47087bc2f7e3b72ed5d033a3
<ide><path>test/parallel/test-repl.js <ide> const prompt_npm = 'npm should be run outside of the ' + <ide> 'node repl, in your normal shell.\n' + <ide> '(Press Control-D to exit.)\n'; <ide> const expect_npm = prompt_npm + prompt_unix; <del>var server_tcp, server_unix, client_tcp, client_unix, timer, replServer; <add>var server_tcp, server_unix, client_tcp, client_unix, replServer; <ide> <ide> <ide> // absolute path to test/fixtures/a.js <ide> function send_expect(list) { <ide> function clean_up() { <ide> client_tcp.end(); <ide> client_unix.end(); <del> clearTimeout(timer); <ide> } <ide> <ide> function strict_mode_error_test() { <ide> function unix_test() { <ide> } <ide> <ide> unix_test(); <del> <del>timer = setTimeout(function() { <del> assert.fail(null, null, 'Timeout'); <del>}, 5000);
1
Javascript
Javascript
avoid redundant else block
50e48a8ad7d9a92b161446d21576f052f9c6f53b
<ide><path>test/MultiCompiler.test.js <ide> describe("MultiCompiler", function () { <ide> compiler.run(err => { <ide> if (err) { <ide> throw err; <del> } else { <del> expect(called).toBe(2); <del> done(); <ide> } <add> expect(called).toBe(2); <add> done(); <ide> }); <ide> }); <ide> <ide> describe("MultiCompiler", function () { <ide> const watcher = compiler.watch(1000, err => { <ide> if (err) { <ide> throw err; <del> } else { <del> watcher.close(); <del> expect(called).toBe(2); <del> done(); <ide> } <add> watcher.close(); <add> expect(called).toBe(2); <add> done(); <ide> }); <ide> }); <ide>
1
Javascript
Javascript
update dllentryplugin to es2015
021d0cc53b42076cd5ea589c7fb40851c40423c9
<ide><path>lib/DllEntryPlugin.js <ide> MIT License http://www.opensource.org/licenses/mit-license.php <ide> Author Tobias Koppers @sokra <ide> */ <del>var DllEntryDependency = require("./dependencies/DllEntryDependency"); <del>var SingleEntryDependency = require("./dependencies/SingleEntryDependency"); <del>var DllModuleFactory = require("./DllModuleFactory"); <add>"use strict"; <ide> <del>function DllEntryPlugin(context, entries, name, type) { <del> this.context = context; <del> this.entries = entries; <del> this.name = name; <del> this.type = type; <del>} <del>module.exports = DllEntryPlugin; <del>DllEntryPlugin.prototype.apply = function(compiler) { <del> compiler.plugin("compilation", function(compilation, params) { <del> var dllModuleFactory = new DllModuleFactory(); <del> var normalModuleFactory = params.normalModuleFactory; <add>const DllEntryDependency = require("./dependencies/DllEntryDependency"); <add>const SingleEntryDependency = require("./dependencies/SingleEntryDependency"); <add>const DllModuleFactory = require("./DllModuleFactory"); <add> <add>class DllEntryPlugin { <add> constructor(context, entries, name, type) { <add> this.context = context; <add> this.entries = entries; <add> this.name = name; <add> this.type = type; <add> } <add> <add> apply(compiler) { <add> compiler.plugin("compilation", (compilation, params) => { <add> let dllModuleFactory = new DllModuleFactory(); <add> let normalModuleFactory = params.normalModuleFactory; <ide> <del> compilation.dependencyFactories.set(DllEntryDependency, dllModuleFactory); <add> compilation.dependencyFactories.set(DllEntryDependency, dllModuleFactory); <ide> <del> compilation.dependencyFactories.set(SingleEntryDependency, normalModuleFactory); <del> }); <del> compiler.plugin("make", function(compilation, callback) { <del> compilation.addEntry(this.context, new DllEntryDependency(this.entries.map(function(e, idx) { <del> var dep = new SingleEntryDependency(e); <del> dep.loc = this.name + ":" + idx; <del> return dep; <del> }, this), this.name, this.type), this.name, callback); <del> }.bind(this)); <del>}; <add> compilation.dependencyFactories.set(SingleEntryDependency, normalModuleFactory); <add> }); <add> compiler.plugin("make", (compilation, callback) => { <add> compilation.addEntry(this.context, new DllEntryDependency(this.entries.map((e, idx) => { <add> let dep = new SingleEntryDependency(e); <add> dep.loc = `${this.name}:${idx}`; <add> return dep; <add> }), this.name, this.type), this.name, callback); <add> }); <add> } <add>} <add> <add>module.exports = DllEntryPlugin;
1
Go
Go
improve performance by using legacy mounts
11e9167a6b45fdc134ee43e89abefd34a85cf624
<ide><path>daemon/graphdriver/zfs/zfs.go <ide> func (d *Driver) Status() [][2]string { <ide> } <ide> } <ide> <del>func cloneFilesystem(id, parent, mountpoint string) error { <del> parentDataset, err := zfs.GetDataset(parent) <del> if err != nil { <del> return err <del> } <add>func cloneFilesystem(name, parentName string) error { <ide> snapshotName := fmt.Sprintf("%d", time.Now().Nanosecond()) <add> parentDataset := zfs.Dataset{Name: parentName} <ide> snapshot, err := parentDataset.Snapshot(snapshotName /*recursive */, false) <ide> if err != nil { <ide> return err <ide> } <ide> <del> _, err = snapshot.Clone(id, map[string]string{ <del> "mountpoint": mountpoint, <del> }) <add> _, err = snapshot.Clone(name, map[string]string{"mountpoint": "legacy"}) <ide> if err != nil { <ide> snapshot.Destroy(zfs.DestroyDeferDeletion) <ide> return err <ide> func (d *Driver) ZfsPath(id string) string { <ide> return d.options.fsName + "/" + id <ide> } <ide> <add>func (d *Driver) MountPath(id string) string { <add> return path.Join(d.options.mountPath, "graph", id) <add>} <add> <ide> func (d *Driver) Create(id string, parent string) error { <del> datasetName := d.ZfsPath(id) <del> dataset, err := zfs.GetDataset(datasetName) <add> err := d.create(id, parent) <ide> if err == nil { <del> // cleanup existing dataset from an aborted build <del> err := dataset.Destroy(zfs.DestroyRecursiveClones) <del> if err != nil { <del> log.Warnf("[zfs] failed to destroy dataset '%s': %v", dataset.Name, err) <del> } <del> } else if zfsError, ok := err.(*zfs.Error); ok { <del> if !strings.HasSuffix(zfsError.Stderr, "dataset does not exist\n") { <add> return nil <add> } <add> if zfsError, ok := err.(*zfs.Error); ok { <add> if !strings.HasSuffix(zfsError.Stderr, "dataset already exists\n") { <ide> return err <ide> } <add> // aborted build -> cleanup <ide> } else { <ide> return err <ide> } <ide> <del> mountPoint := path.Join(d.options.mountPath, "graph", id) <del> if parent == "" { <del> _, err := zfs.CreateFilesystem(datasetName, map[string]string{ <del> "mountpoint": mountPoint, <del> }) <add> dataset := zfs.Dataset{Name: d.ZfsPath(id)} <add> if err := dataset.Destroy(zfs.DestroyRecursiveClones); err != nil { <ide> return err <ide> } <del> return cloneFilesystem(datasetName, d.ZfsPath(parent), mountPoint) <add> <add> // retry <add> return d.create(id, parent) <ide> } <ide> <del>func (d *Driver) Remove(id string) error { <del> dataset, err := zfs.GetDataset(d.ZfsPath(id)) <del> if dataset == nil { <add>func (d *Driver) create(id, parent string) error { <add> name := d.ZfsPath(id) <add> if parent == "" { <add> mountoptions := map[string]string{"mountpoint": "legacy"} <add> _, err := zfs.CreateFilesystem(name, mountoptions) <ide> return err <ide> } <add> return cloneFilesystem(name, d.ZfsPath(parent)) <add>} <ide> <add>func (d *Driver) Remove(id string) error { <add> dataset := zfs.Dataset{Name: d.ZfsPath(id)} <ide> return dataset.Destroy(zfs.DestroyRecursive) <ide> } <ide> <ide> func (d *Driver) Get(id, mountLabel string) (string, error) { <del> dataset, err := zfs.GetDataset(d.ZfsPath(id)) <del> if err != nil { <add> mountpoint := d.MountPath(id) <add> filesystem := d.ZfsPath(id) <add> log.Debugf(`[zfs] mount("%s", "%s", "%s")`, filesystem, mountpoint, mountLabel) <add> <add> // Create the target directories if they don't exist <add> if err := os.MkdirAll(mountpoint, 0755); err != nil && !os.IsExist(err) { <ide> return "", err <ide> } <del> return dataset.Mountpoint, nil <add> <add> err := mount.Mount(filesystem, mountpoint, "zfs", mountLabel) <add> if err != nil { <add> return "", fmt.Errorf("error creating zfs mount of %s to %s: %v", filesystem, mountpoint, err) <add> } <add> <add> return mountpoint, nil <ide> } <ide> <ide> func (d *Driver) Put(id string) error { <del> // FS is already mounted <add> mountpoint := d.MountPath(id) <add> log.Debugf(`[zfs] unmount("%s")`, mountpoint) <add> <add> if err := mount.Unmount(mountpoint); err != nil { <add> return fmt.Errorf("error unmounting to %s: %v", mountpoint, err) <add> } <ide> return nil <ide> } <ide>
1
Text
Text
add kvakil to triagers
4c4963221083a35e65b40182a7797c5446c4857d
<ide><path>README.md <ide> maintaining the Node.js project. <ide> **Himadri Ganguly** <<himadri.tech@gmail.com>> (he/him) <ide> * [iam-frankqiu](https://github.com/iam-frankqiu) - <ide> **Frank Qiu** <<iam.frankqiu@gmail.com>> (he/him) <add>* [kvakil](https://github.com/kvakil) - <add> **Keyhan Vakil** <<kvakil@sylph.kvakil.me>> (they/them) <ide> * [marsonya](https://github.com/marsonya) - <ide> **Akhil Marsonya** <<akhil.marsonya27@gmail.com>> (he/him) <ide> * [meixg](https://github.com/meixg) -
1
Javascript
Javascript
add buffer() function
ac69703e278a5c1326f62bf02f61db19f847c391
<ide><path>examples/jsm/nodes/ShaderNode.js <ide> import AttributeNode from './core/AttributeNode.js'; <ide> <ide> // input nodes <ide> import BoolNode from './inputs/BoolNode.js'; <add>import BufferNode from './inputs/BufferNode.js'; <ide> import ColorNode from './inputs/ColorNode.js'; <ide> import FloatNode from './inputs/FloatNode.js'; <ide> import IntNode from './inputs/IntNode.js'; <ide> export const addTo = ( varNode, ...params ) => { <ide> export const uv = new ShaderNodeProxy( UVNode ); <ide> export const attribute = new ShaderNodeProxy( AttributeNode ); <ide> <add>export const buffer = new ShaderNodeProxy( BufferNode ); <ide> export const texture = new ShaderNodeProxy( TextureNode ); <ide> <ide> export const add = new ShaderNodeProxy( OperatorNode, '+' );
1
Text
Text
remove erroneous line about static methods
93a033a94fa4e0d65a2703f40ebc5ac1ff88f3a9
<ide><path>docs/tips/16-references-to-components.md <ide> var myComponent = React.renderComponent(<MyComponent />, myContainer); <ide> <ide> Keep in mind, however, that the "constructor" of a component doesn't return a component instance! It's just a **descriptor**: a lightweight representation that tells React what the mounted component should look like. <ide> <del>Descriptors also contain any methods that you define in the [statics](http://facebook.github.io/react/docs/component-specs.html#statics) property of the component. <del> <ide> ```js <ide> /** @jsx React.DOM */ <ide>
1
Python
Python
add support to detect wsl
2340881dde775a43714c6bc15c4bd620bf8e1865
<ide><path>glances/globals.py <ide> import errno <ide> import os <ide> import sys <add>import platform <ide> <ide> # OS constants (some libraries/features are OS-dependent) <ide> BSD = sys.platform.find('bsd') != -1
1
Javascript
Javascript
fix default index for router#replacewith
b4189a5316b490e6523d0fa49a02f55bf9c91de0
<ide><path>packages/ember-routing/lib/system/router.js <ide> Ember.Router = Ember.Object.extend({ <ide> this.notifyPropertyChange('url'); <ide> }, <ide> <del> transitionTo: function(passedName) { <del> var args = [].slice.call(arguments), name; <del> <del> if (!this.router.hasRoute(passedName)) { <del> name = args[0] = passedName + '.index'; <del> } else { <del> name = passedName; <del> } <del> <del> Ember.assert("The route " + passedName + " was not found", this.router.hasRoute(name)); <del> <del> this.router.transitionTo.apply(this.router, args); <del> this.notifyPropertyChange('url'); <add> transitionTo: function(name) { <add> var args = [].slice.call(arguments); <add> doTransition(this, 'transitionTo', args); <ide> }, <ide> <ide> replaceWith: function() { <del> this.router.replaceWith.apply(this.router, arguments); <del> this.notifyPropertyChange('url'); <add> var args = [].slice.call(arguments); <add> doTransition(this, 'replaceWith', args); <ide> }, <ide> <ide> generate: function() { <ide> function setupRouter(emberRouter, router, location) { <ide> }; <ide> } <ide> <add>function doTransition(router, method, args) { <add> var passedName = args[0], name; <add> <add> if (!router.router.hasRoute(args[0])) { <add> name = args[0] = passedName + '.index'; <add> } else { <add> name = passedName; <add> } <add> <add> Ember.assert("The route " + passedName + " was not found", router.router.hasRoute(name)); <add> <add> router.router[method].apply(router.router, args); <add> router.notifyPropertyChange('url'); <add>} <add> <ide> Ember.Router.reopenClass({ <ide> map: function(callback) { <ide> var router = this.router = new Router();
1
Text
Text
add minimum node.js version to upgrading guide
dfb280b4a9591df345fe1927d3b6510ce5648d06
<ide><path>docs/upgrading.md <ide> description: Learn how to upgrade Next.js. <ide> <ide> ## Upgrading from 11 to 12 <ide> <add>### Minimum Node.js version <add> <add>The minimum Node.js version has been bumped from 12.0.0 to 12.22.0 which is the first version of Node.js with native ES Modules support. <add> <ide> ### SWC replacing Babel <ide> <ide> Next.js now uses Rust-based compiler [SWC](https://swc.rs/) to compile JavaScript/TypeScript. This new compiler is up to 17x faster than Babel when compiling individual files and up to 5x faster Fast Refresh.
1
Text
Text
add builtin module in building.md
f2e62b52385ff5e778d997ba86db70975e5670c7
<ide><path>BUILDING.md <ide> and [user guide](https://openssl.org/docs/fips/UserGuide-2.0.pdf). <ide> `/usr/local/ssl/fips-2.0` <ide> 8. Build Node.js with `make -j` <ide> 9. Verify with `node -p "process.versions.openssl"` (for example `1.0.2a-fips`) <add> <add>## Building Node.js with external core modules <add> <add>It is possible to specify one or more JavaScript text files to be bundled in <add>the binary as builtin modules when building Node.js. <add> <add>### Unix / macOS <add> <add>This command will make `/root/myModule.js` available via <add>`require('/root/myModule')` and `./myModule2.js` available via <add>`require('myModule2')`. <add> <add>```console <add>$ ./configure --link-module '/root/myModule.js' --link-module './myModule2.js' <add>``` <add> <add>### Windows <add> <add>To make `./myCustomModule.js` available via `require('myCustomModule')`. <add> <add>```console <add>> .\vcbuild link-module './myCustomModule.js' <add>```
1
Python
Python
improve v3 pretrain command
54c40223a1fac01ae1a8afd39eab90b866af2964
<ide><path>spacy/cli/pretrain.py <del>from typing import Optional, Dict, Any <del>import random <add>from typing import Optional <ide> import numpy <ide> import time <ide> import re <ide> from collections import Counter <ide> from pathlib import Path <add>from thinc.api import Config <ide> from thinc.api import use_pytorch_for_gpu_memory, require_gpu <ide> from thinc.api import set_dropout_rate, to_categorical, fix_random_seed <ide> from thinc.api import CosineDistance, L2Distance <ide> <ide> from ._util import app, Arg, Opt, parse_config_overrides, show_validation_error <ide> from ._util import import_code <del>from ..errors import Errors <ide> from ..ml.models.multi_task import build_cloze_multi_task_model <ide> from ..ml.models.multi_task import build_cloze_characters_multi_task_model <ide> from ..tokens import Doc <del>from ..attrs import ID, HEAD <add>from ..attrs import ID <ide> from .. import util <ide> <ide> <ide> def pretrain_cli( <ide> # fmt: off <ide> ctx: typer.Context, # This is only used to read additional arguments <del> texts_loc: Path = Arg(..., help="Path to JSONL file with raw texts to learn from, with text provided as the key 'text' or tokens as the key 'tokens'", exists=True), <del> output_dir: Path = Arg(..., help="Directory to write weights to on each epoch"), <ide> config_path: Path = Arg(..., help="Path to config file", exists=True, dir_okay=False), <add> output_dir: Path = Arg(..., help="Directory to write weights to on each epoch"), <ide> code_path: Optional[Path] = Opt(None, "--code-path", "-c", help="Path to Python file with additional code (registered functions) to be imported"), <ide> resume_path: Optional[Path] = Opt(None, "--resume-path", "-r", help="Path to pretrained weights from which to resume pretraining"), <ide> epoch_resume: Optional[int] = Opt(None, "--epoch-resume", "-er", help="The epoch to resume counting from when using --resume-path. Prevents unintended overwriting of existing weight files."), <ide> def pretrain_cli( <ide> <ide> DOCS: https://nightly.spacy.io/api/cli#pretrain <ide> """ <del> overrides = parse_config_overrides(ctx.args) <add> config_overrides = parse_config_overrides(ctx.args) <ide> import_code(code_path) <del> pretrain( <del> texts_loc, <del> output_dir, <del> config_path, <del> config_overrides=overrides, <del> resume_path=resume_path, <del> epoch_resume=epoch_resume, <del> use_gpu=use_gpu, <del> ) <del> <del> <del>def pretrain( <del> texts_loc: Path, <del> output_dir: Path, <del> config_path: Path, <del> config_overrides: Dict[str, Any] = {}, <del> resume_path: Optional[Path] = None, <del> epoch_resume: Optional[int] = None, <del> use_gpu: int = -1, <del>): <del> verify_cli_args(texts_loc, output_dir, config_path, resume_path, epoch_resume) <add> verify_cli_args(config_path, output_dir, resume_path, epoch_resume) <ide> if use_gpu >= 0: <ide> msg.info("Using GPU") <ide> require_gpu(use_gpu) <ide> else: <ide> msg.info("Using CPU") <ide> msg.info(f"Loading config from: {config_path}") <add> <ide> with show_validation_error(config_path): <del> config = util.load_config(config_path, overrides=config_overrides) <del> nlp, config = util.load_model_from_config(config) <del> pretrain_config = config["pretraining"] <del> if not pretrain_config: <add> config = util.load_config( <add> config_path, <add> overrides=config_overrides, <add> interpolate=True <add> ) <add> if not config.get("pretraining"): <ide> # TODO: What's the solution here? How do we handle optional blocks? <ide> msg.fail("The [pretraining] block in your config is empty", exits=1) <ide> if not output_dir.exists(): <ide> output_dir.mkdir() <ide> msg.good(f"Created output directory: {output_dir}") <del> seed = pretrain_config["seed"] <del> if seed is not None: <del> fix_random_seed(seed) <del> if use_gpu >= 0 and pretrain_config["use_pytorch_for_gpu_memory"]: <del> use_pytorch_for_gpu_memory() <add> <ide> config.to_disk(output_dir / "config.cfg") <ide> msg.good("Saved config file in the output directory") <del> if texts_loc != "-": # reading from a file <del> with msg.loading("Loading input texts..."): <del> texts = list(srsly.read_jsonl(texts_loc)) <del> random.shuffle(texts) <del> else: # reading from stdin <del> msg.info("Reading input text from stdin...") <del> texts = srsly.read_jsonl("-") <del> <del> tok2vec_path = pretrain_config["tok2vec_model"] <del> tok2vec = config <del> for subpath in tok2vec_path.split("."): <del> tok2vec = tok2vec.get(subpath) <del> model = create_pretraining_model(nlp, tok2vec, pretrain_config) <del> optimizer = pretrain_config["optimizer"] <add> <add> pretrain( <add> config, <add> output_dir, <add> resume_path=resume_path, <add> epoch_resume=epoch_resume, <add> use_gpu=use_gpu, <add> ) <add> <add> <add>def pretrain( <add> config: Config, <add> output_dir: Path, <add> resume_path: Optional[Path] = None, <add> epoch_resume: Optional[int] = None, <add> use_gpu: int=-1 <add>): <add> if config["system"].get("seed") is not None: <add> fix_random_seed(config["system"]["seed"]) <add> if use_gpu >= 0 and config["system"].get("use_pytorch_for_gpu_memory"): <add> use_pytorch_for_gpu_memory() <add> nlp, config = util.load_model_from_config(config) <add> P_cfg = config["pretraining"] <add> corpus = P_cfg["corpus"] <add> batcher = P_cfg["batcher"] <add> model = create_pretraining_model(nlp, config["pretraining"]) <add> optimizer = config["pretraining"]["optimizer"] <ide> <ide> # Load in pretrained weights to resume from <ide> if resume_path is not None: <ide> def _save_model(epoch, is_temp=False): <ide> with (output_dir / "log.jsonl").open("a") as file_: <ide> file_.write(srsly.json_dumps(log) + "\n") <ide> <del> skip_counter = 0 <del> objective = create_objective(pretrain_config["objective"]) <del> for epoch in range(epoch_resume, pretrain_config["max_epochs"]): <del> batches = util.minibatch_by_words(texts, size=pretrain_config["batch_size"]) <del> for batch_id, batch in enumerate(batches): <del> docs, count = make_docs( <del> nlp, <del> batch, <del> max_length=pretrain_config["max_length"], <del> min_length=pretrain_config["min_length"], <del> ) <del> skip_counter += count <add> objective = create_objective(P_cfg["objective"]) <add> # TODO: I think we probably want this to look more like the <add> # 'create_train_batches' function? <add> for epoch in range(epoch_resume, P_cfg["max_epochs"]): <add> for batch_id, batch in enumerate(batcher(corpus(nlp))): <add> docs = ensure_docs(batch) <ide> loss = make_update(model, docs, optimizer, objective) <ide> progress = tracker.update(epoch, loss, docs) <ide> if progress: <ide> msg.row(progress, **row_settings) <del> if texts_loc == "-" and tracker.words_per_epoch[epoch] >= 10 ** 7: <del> break <del> if pretrain_config["n_save_every"] and ( <del> batch_id % pretrain_config["n_save_every"] == 0 <add> if P_cfg["n_save_every"] and ( <add> batch_id % P_cfg["n_save_every"] == 0 <ide> ): <ide> _save_model(epoch, is_temp=True) <ide> _save_model(epoch) <ide> tracker.epoch_loss = 0.0 <del> if texts_loc != "-": <del> # Reshuffle the texts if texts were loaded from a file <del> random.shuffle(texts) <del> if skip_counter > 0: <del> msg.warn(f"Skipped {skip_counter} empty values") <ide> msg.good("Successfully finished pretrain") <ide> <ide> <add>def ensure_docs(examples_or_docs): <add> docs = [] <add> for eg_or_doc in examples_or_docs: <add> if isinstance(eg_or_doc, Doc): <add> docs.append(eg_or_doc) <add> else: <add> docs.append(eg_or_doc.reference) <add> return docs <add> <add> <ide> def _resume_model(model, resume_path, epoch_resume): <ide> msg.info(f"Resume training tok2vec from: {resume_path}") <ide> with resume_path.open("rb") as file_: <ide> def make_update(model, docs, optimizer, objective_func): <ide> return float(loss) <ide> <ide> <del>def make_docs(nlp, batch, min_length, max_length): <del> docs = [] <del> skip_count = 0 <del> for record in batch: <del> if not isinstance(record, dict): <del> raise TypeError(Errors.E137.format(type=type(record), line=record)) <del> if "tokens" in record: <del> words = record["tokens"] <del> if not words: <del> skip_count += 1 <del> continue <del> doc = Doc(nlp.vocab, words=words) <del> elif "text" in record: <del> text = record["text"] <del> if not text: <del> skip_count += 1 <del> continue <del> doc = nlp.make_doc(text) <del> else: <del> raise ValueError(Errors.E138.format(text=record)) <del> if "heads" in record: <del> heads = record["heads"] <del> heads = numpy.asarray(heads, dtype="uint64") <del> heads = heads.reshape((len(doc), 1)) <del> doc = doc.from_array([HEAD], heads) <del> if min_length <= len(doc) < max_length: <del> docs.append(doc) <del> return docs, skip_count <del> <del> <ide> def create_objective(config): <ide> """Create the objective for pretraining. <ide> <ide> def get_characters_loss(ops, docs, prediction, nr_char): <ide> return loss, d_target <ide> <ide> <del>def create_pretraining_model(nlp, tok2vec, pretrain_config): <add>def create_pretraining_model(nlp, pretrain_config): <ide> """Define a network for the pretraining. We simply add an output layer onto <ide> the tok2vec input model. The tok2vec input model needs to be a model that <ide> takes a batch of Doc objects (as a list), and returns a list of arrays. <ide> Each array in the output needs to have one row per token in the doc. <ide> The actual tok2vec layer is stored as a reference, and only this bit will be <ide> serialized to file and read back in when calling the 'train' command. <ide> """ <add> component = nlp.get_pipe(pretrain_config["component"]) <add> if pretrain_config.get("layer"): <add> tok2vec = component.model.get_ref(pretrain_config["layer"]) <add> else: <add> tok2vec = component.model <add> <ide> # TODO <ide> maxout_pieces = 3 <ide> hidden_size = 300 <ide> def _smart_round(figure, width=10, max_decimal=4): <ide> return format_str % figure <ide> <ide> <del>def verify_cli_args(texts_loc, output_dir, config_path, resume_path, epoch_resume): <add>def verify_cli_args(config_path, output_dir, resume_path, epoch_resume): <ide> if not config_path or not config_path.exists(): <ide> msg.fail("Config file not found", config_path, exits=1) <ide> if output_dir.exists() and [p for p in output_dir.iterdir()]: <ide> def verify_cli_args(texts_loc, output_dir, config_path, resume_path, epoch_resum <ide> "It is better to use an empty directory or refer to a new output path, " <ide> "then the new directory will be created for you.", <ide> ) <del> if texts_loc != "-": # reading from a file <del> texts_loc = Path(texts_loc) <del> if not texts_loc.exists(): <del> msg.fail("Input text file doesn't exist", texts_loc, exits=1) <del> <del> for text in srsly.read_jsonl(texts_loc): <del> break <del> else: <del> msg.fail("Input file is empty", texts_loc, exits=1) <del> <ide> if resume_path is not None: <ide> model_name = re.search(r"model\d+\.bin", str(resume_path)) <ide> if not model_name and not epoch_resume: <ide><path>spacy/schemas.py <ide> class Config: <ide> class ConfigSchemaPretrain(BaseModel): <ide> # fmt: off <ide> max_epochs: StrictInt = Field(..., title="Maximum number of epochs to train for") <del> min_length: StrictInt = Field(..., title="Minimum length of examples") <del> max_length: StrictInt = Field(..., title="Maximum length of examples") <ide> dropout: StrictFloat = Field(..., title="Dropout rate") <ide> n_save_every: Optional[StrictInt] = Field(..., title="Saving frequency") <del> batch_size: Union[Sequence[int], int] = Field(..., title="The batch size or batch size schedule") <del> seed: Optional[StrictInt] = Field(..., title="Random seed") <del> use_pytorch_for_gpu_memory: StrictBool = Field(..., title="Allocate memory via PyTorch") <del> tok2vec_model: StrictStr = Field(..., title="tok2vec model in config, e.g. components.tok2vec.model") <ide> optimizer: Optimizer = Field(..., title="The optimizer to use") <add> corpus: Reader = Field(..., title="Reader for the training data") <add> batcher: Batcher = Field(..., title="Batcher for the training data") <add> component: str = Field(..., title="Component to find the layer to pretrain") <add> layer: str = Field(..., title="Layer to pretrain. Whole model if empty.") <add> <ide> # TODO: use a more detailed schema for this? <ide> objective: Dict[str, Any] = Field(..., title="Pretraining objective") <ide> # fmt: on <ide><path>spacy/tests/test_cli.py <ide> from spacy.training.converters import iob2docs, conll_ner2docs, conllu2docs <ide> from spacy.lang.en import English <ide> from spacy.schemas import ProjectConfigSchema, RecommendationSchema, validate <del>from spacy.cli.pretrain import make_docs <ide> from spacy.cli.init_config import init_config, RECOMMENDATIONS <ide> from spacy.cli._util import validate_project_commands, parse_config_overrides <ide> from spacy.cli._util import load_project_config, substitute_project_variables <ide> def test_cli_converters_conll_ner2json(): <ide> assert ent.text in ["New York City", "London"] <ide> <ide> <del>def test_pretrain_make_docs(): <del> nlp = English() <del> <del> valid_jsonl_text = {"text": "Some text"} <del> docs, skip_count = make_docs(nlp, [valid_jsonl_text], 1, 10) <del> assert len(docs) == 1 <del> assert skip_count == 0 <del> <del> valid_jsonl_tokens = {"tokens": ["Some", "tokens"]} <del> docs, skip_count = make_docs(nlp, [valid_jsonl_tokens], 1, 10) <del> assert len(docs) == 1 <del> assert skip_count == 0 <del> <del> invalid_jsonl_type = 0 <del> with pytest.raises(TypeError): <del> make_docs(nlp, [invalid_jsonl_type], 1, 100) <del> <del> invalid_jsonl_key = {"invalid": "Does not matter"} <del> with pytest.raises(ValueError): <del> make_docs(nlp, [invalid_jsonl_key], 1, 100) <del> <del> empty_jsonl_text = {"text": ""} <del> docs, skip_count = make_docs(nlp, [empty_jsonl_text], 1, 10) <del> assert len(docs) == 0 <del> assert skip_count == 1 <del> <del> empty_jsonl_tokens = {"tokens": []} <del> docs, skip_count = make_docs(nlp, [empty_jsonl_tokens], 1, 10) <del> assert len(docs) == 0 <del> assert skip_count == 1 <del> <del> too_short_jsonl = {"text": "This text is not long enough"} <del> docs, skip_count = make_docs(nlp, [too_short_jsonl], 10, 15) <del> assert len(docs) == 0 <del> assert skip_count == 0 <del> <del> too_long_jsonl = {"text": "This text contains way too much tokens for this test"} <del> docs, skip_count = make_docs(nlp, [too_long_jsonl], 1, 5) <del> assert len(docs) == 0 <del> assert skip_count == 0 <del> <del> <ide> def test_project_config_validation_full(): <ide> config = { <ide> "vars": {"some_var": 20}, <ide><path>spacy/training/corpus.py <ide> import warnings <ide> from typing import Union, List, Iterable, Iterator, TYPE_CHECKING, Callable <ide> from pathlib import Path <add>import srsly <ide> <ide> from .. import util <ide> from .example import Example <ide> def create_docbin_reader( <ide> ) -> Callable[["Language"], Iterable[Example]]: <ide> return Corpus(path, gold_preproc=gold_preproc, max_length=max_length, limit=limit) <ide> <add>@util.registry.readers("spacy.JsonlReader.v1") <add>def create_jsonl_reader( <add> path: Path, min_length: int=0, max_length: int = 0, limit: int = 0 <add>) -> Callable[["Language"], Iterable[Doc]]: <add> return JsonlTexts(path, min_length=min_length, max_length=max_length, limit=limit) <add> <add> <add>def walk_corpus(path: Union[str, Path], file_type) -> List[Path]: <add> path = util.ensure_path(path) <add> if not path.is_dir() and path.parts[-1].endswith(file_type): <add> return [path] <add> orig_path = path <add> paths = [path] <add> locs = [] <add> seen = set() <add> for path in paths: <add> if str(path) in seen: <add> continue <add> seen.add(str(path)) <add> if path.parts and path.parts[-1].startswith("."): <add> continue <add> elif path.is_dir(): <add> paths.extend(path.iterdir()) <add> elif path.parts[-1].endswith(file_type): <add> locs.append(path) <add> if len(locs) == 0: <add> warnings.warn(Warnings.W090.format(path=orig_path)) <add> return locs <add> <add> <ide> <ide> class Corpus: <ide> """Iterate Example objects from a file or directory of DocBin (.spacy) <ide> def __init__( <ide> self.max_length = max_length <ide> self.limit = limit <ide> <del> @staticmethod <del> def walk_corpus(path: Union[str, Path]) -> List[Path]: <del> path = util.ensure_path(path) <del> if not path.is_dir() and path.parts[-1].endswith(FILE_TYPE): <del> return [path] <del> orig_path = path <del> paths = [path] <del> locs = [] <del> seen = set() <del> for path in paths: <del> if str(path) in seen: <del> continue <del> seen.add(str(path)) <del> if path.parts and path.parts[-1].startswith("."): <del> continue <del> elif path.is_dir(): <del> paths.extend(path.iterdir()) <del> elif path.parts[-1].endswith(FILE_TYPE): <del> locs.append(path) <del> if len(locs) == 0: <del> warnings.warn(Warnings.W090.format(path=orig_path)) <del> return locs <del> <ide> def __call__(self, nlp: "Language") -> Iterator[Example]: <ide> """Yield examples from the data. <ide> <ide> def __call__(self, nlp: "Language") -> Iterator[Example]: <ide> <ide> DOCS: https://nightly.spacy.io/api/corpus#call <ide> """ <del> ref_docs = self.read_docbin(nlp.vocab, self.walk_corpus(self.path)) <add> ref_docs = self.read_docbin(nlp.vocab, walk_corpus(self.path, FILE_TYPE)) <ide> if self.gold_preproc: <ide> examples = self.make_examples_gold_preproc(nlp, ref_docs) <ide> else: <ide> def read_docbin( <ide> i += 1 <ide> if self.limit >= 1 and i >= self.limit: <ide> break <add> <add> <add>class JsonlTexts: <add> """Iterate Doc objects from a file or directory of jsonl <add> formatted raw text files. <add> <add> path (Path): The directory or filename to read from. <add> min_length (int): Minimum document length (in tokens). Shorter documents <add> will be skipped. Defaults to 0, which indicates no limit. <add> <add> max_length (int): Maximum document length (in tokens). Longer documents will <add> be skipped. Defaults to 0, which indicates no limit. <add> limit (int): Limit corpus to a subset of examples, e.g. for debugging. <add> Defaults to 0, which indicates no limit. <add> <add> DOCS: https://nightly.spacy.io/api/corpus <add> """ <add> file_type = "jsonl" <add> <add> def __init__( <add> self, <add> path: Union[str, Path], <add> *, <add> limit: int = 0, <add> min_length: int = 0, <add> max_length: int = 0, <add> ) -> None: <add> self.path = util.ensure_path(path) <add> self.min_length = min_length <add> self.max_length = max_length <add> self.limit = limit <add> <add> def __call__(self, nlp: "Language") -> Iterator[Example]: <add> """Yield examples from the data. <add> <add> nlp (Language): The current nlp object. <add> YIELDS (Doc): The docs. <add> <add> DOCS: https://nightly.spacy.io/api/corpus#call <add> """ <add> for loc in walk_corpus(self.path, "jsonl"): <add> records = srsly.read_jsonl(loc) <add> for record in records: <add> doc = nlp.make_doc(record["text"]) <add> if self.min_length >= 1 and len(doc) < self.min_length: <add> continue <add> elif self.max_length >= 1 and len(doc) >= self.max_length: <add> continue <add> else: <add> words = [w.text for w in doc] <add> spaces = [bool(w.whitespace_) for w in doc] <add> # We don't *need* an example here, but it seems nice to <add> # make it match the Corpus signature. <add> yield Example(doc, Doc(nlp.vocab, words=words, spaces=spaces))
4
Python
Python
use a condition variable instead of sleeping
75f2af7a6afdf620d7afdccee876b06f8c39373b
<ide><path>flask/testsuite/basic.py <ide> import pickle <ide> import unittest <ide> from datetime import datetime <del>from threading import Thread <del>from time import sleep <add>from threading import Thread, Condition <ide> from flask.testsuite import FlaskTestCase, emits_module_deprecation_warning <ide> from flask._compat import text_type <ide> from werkzeug.exceptions import BadRequest, NotFound <ide> def foo(): <ide> def test_before_first_request_functions_concurrent(self): <ide> got = [] <ide> app = flask.Flask(__name__) <add> cv = Condition() <ide> @app.before_first_request <ide> def foo(): <del> sleep(1) <add> with cv: <add> cv.wait() <ide> got.append(42) <ide> c = app.test_client() <ide> def get_and_assert(): <add> with cv: <add> cv.notify() <ide> c.get("/") <ide> self.assert_equal(got, [42]) <ide> t = Thread(target=get_and_assert)
1
Javascript
Javascript
update webgl state
b0403abc33cf3cd24572545c0e0d9991eb751c0b
<ide><path>src/materials/Material.js <ide> function Material() { <ide> this.stencilFail = KeepStencilOp; <ide> this.stencilZFail = KeepStencilOp; <ide> this.stencilZPass = KeepStencilOp; <del> this.stencilWrite = true; <add> this.stencilWrite = false; <ide> <ide> this.clippingPlanes = null; <ide> this.clipIntersection = false; <ide><path>src/renderers/webgl/WebGLState.js <ide> function WebGLState( gl, extensions, utils, capabilities ) { <ide> depthBuffer.setMask( material.depthWrite ); <ide> colorBuffer.setMask( material.colorWrite ); <ide> <del> var stencil = material.stencil; <del> var useStencil = stencil !== null; <del> stencilBuffer.setTest( useStencil ); <del> if ( useStencil ) { <add> var stencilWrite = material.stencilWrite; <add> stencilBuffer.setTest( stencilWrite ); <add> if ( stencilWrite ) { <ide> <del> stencilBuffer.setFunc( stencil.func, stencil.ref, stencil.mask ); <del> stencilBuffer.setOp( stencil.fail, stencil.zfail, stencil.zpass ); <add> stencilBuffer.setFunc( material.stencilFunc, material.stencilRef, material.stencilMask ); <add> stencilBuffer.setOp( material.stencilFail, material.stencilZFail, material.stencilZPass ); <ide> <ide> } <ide>
2
Javascript
Javascript
remove array.from(s) and add consts
43a07bb8b87a11c4194c71da9b9114b9c5727e5f
<ide><path>src/config.js <ide> class Config { <ide> this.scopedSettingsStore.removePropertiesForSourceAndSelector(source, scopeSelector) <ide> setValueAtKeyPath(settings, keyPath, undefined) <ide> settings = withoutEmptyObjects(settings) <del> if (settings != null) { this.set(null, settings, {scopeSelector, source, priority: this.priorityForSource(source)}) } <del> if ((source === this.getUserConfigPath()) && !this.configFileHasErrors && this.settingsLoaded) { <add> if (settings != null) { <add> this.set(null, settings, {scopeSelector, source, priority: this.priorityForSource(source)}) <add> } <add> <add> const configIsReady = (source === this.getUserConfigPath()) && !this.configFileHasErrors && this.settingsLoaded <add> if (configIsReady) { <ide> return this.requestSave() <ide> } <ide> } <ide> sizes. See [this document][watches] for more info. <ide> } <ide> <ide> getRawScopedValue (scopeDescriptor, keyPath, options) { <del> let legacyScopeDescriptor <ide> scopeDescriptor = ScopeDescriptor.fromObject(scopeDescriptor) <ide> const result = this.scopedSettingsStore.getPropertyValue( <ide> scopeDescriptor.getScopeChain(), <ide> keyPath, <ide> options <ide> ) <ide> <del> legacyScopeDescriptor = this.getLegacyScopeDescriptor(scopeDescriptor) <add> const legacyScopeDescriptor = this.getLegacyScopeDescriptor(scopeDescriptor) <ide> if (result != null) { <ide> return result <ide> } else if (legacyScopeDescriptor) { <ide> sizes. See [this document][watches] for more info. <ide> if (!_.isEqual(oldValue, newValue)) { <ide> const event = {oldValue, newValue} <ide> oldValue = newValue <del> return callback(event) <add> callback(event) <ide> } <ide> }) <ide> } <ide> sizes. See [this document][watches] for more info. <ide> return new ScopeDescriptor({scopes}) <ide> } <ide> } <del> }; <add>}; <ide> <ide> // Base schema enforcers. These will coerce raw input into the specified type, <ide> // and will throw an error when the value cannot be coerced. Throwing the error <ide> Config.addSchemaEnforcers({ <ide> const itemSchema = schema.items <ide> if (itemSchema != null) { <ide> const newValue = [] <del> for (let item of Array.from(value)) { <add> for (let item of value) { <ide> try { <ide> newValue.push(this.executeSchemaEnforcers(keyPath, item, itemSchema)) <ide> } catch (error) { <ide> Config.addSchemaEnforcers({ <ide> <ide> if ((possibleValues == null) || !Array.isArray(possibleValues) || !possibleValues.length) { return value } <ide> <del> for (let possibleValue of Array.from(possibleValues)) { <add> for (let possibleValue of possibleValues) { <ide> // Using `isEqual` for possibility of placing enums on array and object schemas <ide> if (_.isEqual(possibleValue, value)) { return value } <ide> } <ide> let isPlainObject = value => _.isObject(value) && !_.isArray(value) && !_.isFunc <ide> let sortObject = value => { <ide> if (!isPlainObject(value)) { return value } <ide> const result = {} <del> for (let key of Array.from(Object.keys(value).sort())) { <add> for (let key of Object.keys(value).sort()) { <ide> result[key] = sortObject(value[key]) <ide> } <ide> return result
1
Python
Python
remove duplicate code
c95f5d10c222c0e596135f6d32ee70f18f2958c6
<ide><path>keras/models.py <ide> def compile(self, optimizer, loss, <ide> self.optimizer = optimizers.get(optimizer) <ide> <ide> self.loss = objectives.get(loss) <del> weighted_loss = weighted_objective(objectives.get(loss)) <add> weighted_loss = weighted_objective(self.loss) <ide> <ide> # input of model <ide> self.X_train = self.get_input(train=True)
1
Ruby
Ruby
use == 0 instead of .zero? in #try
a94c2e1f23c4216a5b854c13f439882311fda461
<ide><path>activesupport/lib/active_support/core_ext/object/try.rb <ide> def try(*a, &b) <ide> <ide> def try!(*a, &b) <ide> if a.empty? && block_given? <del> if b.arity.zero? <add> if b.arity == 0 <ide> instance_eval(&b) <ide> else <ide> yield self
1
PHP
PHP
fix failing tests hopefully
8bfb8e44053960b40e8d6a890a4942c0bd8a51c3
<ide><path>src/Database/Connection.php <ide> public function disableConstraints(callable $callback) <ide> <ide> try { <ide> $result = $callback($this); <del> } catch (Exception $e) { <add> } finally { <ide> $this->enableForeignKeys(); <del> throw $e; <ide> } <ide> <del> $this->enableForeignKeys(); <del> <ide> return $result; <ide> }); <ide> } <ide><path>tests/TestCase/Database/Schema/CollectionTest.php <ide> public function setUp(): void <ide> public function tearDown(): void <ide> { <ide> parent::tearDown(); <del> $this->connection->cacheMetadata('_cake_model_'); <add> $this->connection->cacheMetadata(false); <ide> unset($this->connection); <ide> } <ide> <ide> public function testDescribeIncorrectTable() <ide> */ <ide> public function testDescribeCache() <ide> { <add> $this->connection->cacheMetadata('_cake_model_'); <ide> $schema = $this->connection->getSchemaCollection(); <ide> $table = $schema->describe('users'); <ide> <ide><path>tests/TestCase/Database/Schema/TableSchemaTest.php <ide> public function testConstraintForeignKey() <ide> 'delete' => 'cascade', <ide> 'length' => [], <ide> ]; <del> <ide> $this->assertEquals($expected, $compositeConstraint); <ide> <ide> $expectedSubstring = 'CONSTRAINT <tag_id_fk> FOREIGN KEY \(<tag_id>\) REFERENCES <tags> \(<id>\)'; <ide><path>tests/TestCase/Database/SchemaCacheTest.php <ide> public function tearDown(): void <ide> { <ide> parent::tearDown(); <ide> <del> $this->connection->cacheMetadata('_cake_model_'); <add> $this->connection->cacheMetadata(false); <ide> unset($this->connection); <ide> Cache::drop('orm_cache'); <ide> }
4
PHP
PHP
correct typos in behavior.php
74fc26157ef2427b3655553425beee32fd04af87
<ide><path>src/ORM/Behavior.php <ide> class Behavior implements EventListener { <ide> /** <ide> * Constructor <ide> * <del> * Merge config with the default and store in the config property <add> * Merges config with the default and store in the config property <ide> * <ide> * Does not retain a reference to the Table object. If you need this <ide> * you should override the constructor. <ide> protected function _resolveMethodAliases($key, $defaults, $config) { <ide> /** <ide> * verifyConfig <ide> * <del> * Check that implemented* keys contain values pointing at callable. <add> * Checks that implemented keys contain values pointing at callable. <ide> * <ide> * @return void <ide> * @throws \Cake\Core\Exception\Exception if config are invalid <ide> public function verifyConfig() { <ide> } <ide> <ide> /** <del> * Get the Model callbacks this behavior is interested in. <add> * Gets the Model callbacks this behavior is interested in. <ide> * <ide> * By defining one of the callback methods a behavior is assumed <ide> * to be interested in the related event. <ide> public function implementedEvents() { <ide> /** <ide> * implementedFinders <ide> * <del> * provides and alias->methodname map of which finders a behavior implements. Example: <add> * Provides an alias->methodname map of which finders a behavior implements. Example: <ide> * <ide> * {{{ <ide> * [ <ide> public function implementedFinders() { <ide> /** <ide> * implementedMethods <ide> * <del> * provides an alias->methodname map of which methods a behavior implements. Example: <add> * Provides an alias->methodname map of which methods a behavior implements. Example: <ide> * <ide> * {{{ <ide> * [ <ide> public function implementedMethods() { <ide> } <ide> <ide> /** <del> * Get the methods implemented by this behavior <add> * Gets the methods implemented by this behavior <ide> * <del> * Use the implementedEvents() method to exclude callback methods. <add> * Uses the implementedEvents() method to exclude callback methods. <ide> * Methods starting with `_` will be ignored, as will methods <ide> * declared on Cake\ORM\Behavior <ide> *
1
Ruby
Ruby
use system tmpdir rather than our own
7896f35be37ab5ee8961a384f503137cfb154df0
<ide><path>railties/lib/rails/generators/test_case.rb <ide> class TestCase < ActiveSupport::TestCase <ide> self.current_path = File.expand_path(Dir.pwd) <ide> self.default_arguments = [] <ide> <del> setup :destination_root_is_set?, :ensure_current_path <del> teardown :ensure_current_path <add> def setup <add> destination_root_is_set? <add> ensure_current_path <add> super <add> end <add> <add> def teardown <add> ensure_current_path <add> super <add> end <ide> <ide> # Sets which generator should be tested: <ide> # <ide><path>railties/test/isolation/abstract_unit.rb <ide> # to run the tests <ide> require "active_support/testing/isolation" <ide> require "active_support/core_ext/kernel/reporting" <add>require 'tmpdir' <ide> <ide> module TestHelpers <ide> module Paths <ide> module_function <ide> <del> TMP_PATH = File.expand_path(File.join(File.dirname(__FILE__), *%w[.. .. tmp])) <add> def app_template_path <add> File.join Dir.tmpdir, 'app_template' <add> end <ide> <ide> def tmp_path(*args) <del> File.join(TMP_PATH, *args) <add> @tmp_path ||= Dir.mktmpdir <ide> end <ide> <ide> def app_path(*args) <ide> def build_app(options = {}) <ide> ENV['RAILS_ENV'] = 'development' <ide> <ide> FileUtils.rm_rf(app_path) <del> FileUtils.cp_r(tmp_path('app_template'), app_path) <add> FileUtils.cp_r(app_template_path, app_path) <ide> <ide> # Delete the initializers unless requested <ide> unless options[:initializers] <ide> class ActiveSupport::TestCase <ide> Module.new do <ide> extend TestHelpers::Paths <ide> # Build a rails app <del> if File.exist?(tmp_path) <del> FileUtils.rm_rf(tmp_path) <add> if File.exist?(app_template_path) <add> FileUtils.rm_rf(app_template_path) <ide> end <del> FileUtils.mkdir(tmp_path) <add> FileUtils.mkdir(app_template_path) <ide> <ide> environment = File.expand_path('../../../../load_paths', __FILE__) <ide> if File.exist?("#{environment}.rb") <ide> require_environment = "-r #{environment}" <ide> end <ide> <del> `#{Gem.ruby} #{require_environment} #{RAILS_FRAMEWORK_ROOT}/railties/bin/rails new #{tmp_path('app_template')}` <del> File.open("#{tmp_path}/app_template/config/boot.rb", 'w') do |f| <add> `#{Gem.ruby} #{require_environment} #{RAILS_FRAMEWORK_ROOT}/railties/bin/rails new #{app_template_path}` <add> File.open("#{app_template_path}/config/boot.rb", 'w') do |f| <ide> if require_environment <ide> f.puts "Dir.chdir('#{File.dirname(environment)}') do" <ide> f.puts " require '#{environment}'" <ide><path>railties/test/railties/generators_test.rb <ide> module RailtiesTests <ide> class GeneratorTest < Rails::Generators::TestCase <ide> include ActiveSupport::Testing::Isolation <ide> <del> TMP_PATH = File.expand_path(File.join(File.dirname(__FILE__), *%w[.. .. tmp])) <del> self.destination_root = File.join(TMP_PATH, "foo_bar") <add> def destination_root <add> tmp_path 'foo_bar' <add> end <ide> <ide> def tmp_path(*args) <del> File.join(TMP_PATH, *args) <add> @tmp_path ||= Dir.mktmpdir <add> File.join(@tmp_path, *args) <ide> end <ide> <ide> def engine_path
3
PHP
PHP
add missing tests for files and dir
432c93783b1f137b2ab30d0a12e9b37d696c9ab4
<ide><path>tests/Filesystem/FilesystemTest.php <ide> public function testCopyDirectoryMovesEntireDirectory() <ide> rmdir(__DIR__.'/tmp2'); <ide> } <ide> <add> <add> public function testGetFiles() <add> { <add> mkdir(__DIR__.'/tmp', 0777, true); <add> file_put_contents(__DIR__.'/tmp/foo.txt', ''); <add> file_put_contents(__DIR__.'/tmp/bar.txt', ''); <add> mkdir(__DIR__.'/tmp/nested', 0777, true); <add> file_put_contents(__DIR__.'/tmp/nested/baz.txt', ''); <add> <add> $fileSystem = new Filesystem; <add> <add> $directories = [ <add> __DIR__.'/tmp/nested', <add> ]; <add> $this->assertSame($directories, $fileSystem->directories(__DIR__.'/tmp')); <add> <add> $files = [ <add> __DIR__.'/tmp/bar.txt', <add> __DIR__.'/tmp/foo.txt', <add> ]; <add> $this->assertSame($files, $fileSystem->files(__DIR__.'/tmp')); <add> <add> unlink(__DIR__.'/tmp/nested/baz.txt'); <add> rmdir(__DIR__.'/tmp/nested'); <add> unlink(__DIR__.'/tmp/bar.txt'); <add> unlink(__DIR__.'/tmp/foo.txt'); <add> rmdir(__DIR__.'/tmp'); <add> } <add> <ide> }
1