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
Go
Go
fix lint error on sprintf call for runtime string
6fd94aa933f774dc6f582a96f800b1e875628be3
<ide><path>daemon/reload_unix.go <ide> func (daemon *Daemon) reloadPlatform(conf *config.Config, attributes map[string] <ide> if runtimeList.Len() > 0 { <ide> runtimeList.WriteRune(' ') <ide> } <del> runtimeList.WriteString(fmt.Sprintf("%s:%s", name, rt)) <add> runtimeList.WriteString(fmt.Sprintf("%s:%s", name, rt.Path)) <ide> } <ide> <ide> attributes["runtimes"] = runtimeList.String()
1
PHP
PHP
convert time to seconds once
aae5c4acf3492ffac107ac2e466914e455623da8
<ide><path>src/Illuminate/Cache/Repository.php <ide> public function setMultiple($values, $ttl = null) <ide> */ <ide> public function add($key, $value, $ttl = null) <ide> { <add> $seconds = null; <add> <ide> if ($ttl !== null) { <del> if ($this->getSeconds($ttl) <= 0) { <add> $seconds = $this->getSeconds($ttl); <add> <add> if ($seconds <= 0) { <ide> return false; <ide> } <ide> <ide> // If the store has an "add" method we will call the method on the store so it <ide> // has a chance to override this logic. Some drivers better support the way <ide> // this operation should work with a total "atomic" implementation of it. <ide> if (method_exists($this->store, 'add')) { <del> $seconds = $this->getSeconds($ttl); <del> <ide> return $this->store->add( <ide> $this->itemKey($key), $value, $seconds <ide> ); <ide> public function add($key, $value, $ttl = null) <ide> // so it exists for subsequent requests. Then, we will return true so it is <ide> // easy to know if the value gets added. Otherwise, we will return false. <ide> if (is_null($this->get($key))) { <del> return $this->put($key, $value, $ttl); <add> return $this->put($key, $value, $seconds); <ide> } <ide> <ide> return false;
1
Python
Python
add type hints for unispeech
0540d1b6c0bc1eae80144c5d228e89e87589ea99
<ide><path>src/transformers/models/data2vec/modeling_data2vec_audio.py <ide> def _mask_hidden_states( <ide> ) <ide> def forward( <ide> self, <del> input_values, <del> attention_mask=None, <del> mask_time_indices=None, <del> output_attentions=None, <del> output_hidden_states=None, <del> return_dict=None, <del> ): <add> input_values: Optional[torch.Tensor], <add> attention_mask: Optional[torch.Tensor] = None, <add> mask_time_indices: Optional[torch.FloatTensor] = None, <add> output_attentions: Optional[bool] = None, <add> output_hidden_states: Optional[bool] = None, <add> return_dict: Optional[bool] = None, <add> ) -> Union[Tuple, Data2VecAudioBaseModelOutput]: <ide> output_attentions = output_attentions if output_attentions is not None else self.config.output_attentions <ide> output_hidden_states = ( <ide> output_hidden_states if output_hidden_states is not None else self.config.output_hidden_states <ide> def freeze_feature_encoder(self): <ide> ) <ide> def forward( <ide> self, <del> input_values, <del> attention_mask=None, <del> output_attentions=None, <del> output_hidden_states=None, <del> return_dict=None, <del> labels=None, <del> ): <add> input_values: Optional[torch.Tensor], <add> attention_mask: Optional[torch.Tensor] = None, <add> output_attentions: Optional[bool] = None, <add> output_hidden_states: Optional[bool] = None, <add> return_dict: Optional[bool] = None, <add> labels: Optional[torch.Tensor] = None, <add> ) -> Union[Tuple, CausalLMOutput]: <ide> r""" <ide> labels (`torch.LongTensor` of shape `(batch_size, target_length)`, *optional*): <ide> Labels for connectionist temporal classification. Note that `target_length` has to be smaller or equal to <ide> def freeze_base_model(self): <ide> ) <ide> def forward( <ide> self, <del> input_values, <del> attention_mask=None, <del> output_attentions=None, <del> output_hidden_states=None, <del> return_dict=None, <del> labels=None, <del> ): <add> input_values: Optional[torch.Tensor], <add> attention_mask: Optional[torch.Tensor] = None, <add> output_attentions: Optional[bool] = None, <add> output_hidden_states: Optional[bool] = None, <add> return_dict: Optional[bool] = None, <add> labels: Optional[torch.Tensor] = None, <add> ) -> Union[Tuple, SequenceClassifierOutput]: <ide> r""" <ide> labels (`torch.LongTensor` of shape `(batch_size,)`, *optional*): <ide> Labels for computing the sequence classification/regression loss. Indices should be in `[0, ..., <ide> def freeze_base_model(self): <ide> ) <ide> def forward( <ide> self, <del> input_values, <del> attention_mask=None, <del> output_attentions=None, <del> output_hidden_states=None, <del> return_dict=None, <del> ): <add> input_values: Optional[torch.Tensor], <add> attention_mask: Optional[torch.Tensor] = None, <add> output_attentions: Optional[bool] = None, <add> output_hidden_states: Optional[bool] = None, <add> return_dict: Optional[bool] = None, <add> ) -> Union[Tuple, TokenClassifierOutput]: <ide> r""" <ide> labels (`torch.LongTensor` of shape `(batch_size,)`, *optional*): <ide> Labels for computing the sequence classification/regression loss. Indices should be in `[0, ..., <ide> def _conv_out_length(input_length, kernel_size, stride): <ide> ) <ide> def forward( <ide> self, <del> input_values, <del> attention_mask=None, <del> output_attentions=None, <del> output_hidden_states=None, <del> return_dict=None, <del> labels=None, <del> ): <add> input_values: Optional[torch.Tensor], <add> attention_mask: Optional[torch.Tensor] = None, <add> output_attentions: Optional[bool] = None, <add> output_hidden_states: Optional[bool] = None, <add> return_dict: Optional[bool] = None, <add> labels: Optional[torch.Tensor] = None, <add> ) -> Union[Tuple, XVectorOutput]: <ide> r""" <ide> labels (`torch.LongTensor` of shape `(batch_size,)`, *optional*): <ide> Labels for computing the sequence classification/regression loss. Indices should be in `[0, ..., <ide><path>src/transformers/models/hubert/modeling_hubert.py <ide> def _mask_hidden_states( <ide> @replace_return_docstrings(output_type=BaseModelOutput, config_class=_CONFIG_FOR_DOC) <ide> def forward( <ide> self, <del> input_values, <del> attention_mask=None, <del> mask_time_indices=None, <del> output_attentions=None, <del> output_hidden_states=None, <del> return_dict=None, <del> ): <add> input_values: Optional[torch.Tensor], <add> attention_mask: Optional[torch.Tensor] = None, <add> mask_time_indices: Optional[torch.FloatTensor] = None, <add> output_attentions: Optional[bool] = None, <add> output_hidden_states: Optional[bool] = None, <add> return_dict: Optional[bool] = None, <add> ) -> Union[Tuple, BaseModelOutput]: <ide> """ <ide> <ide> Returns: <ide> def freeze_feature_encoder(self): <ide> ) <ide> def forward( <ide> self, <del> input_values, <del> attention_mask=None, <del> output_attentions=None, <del> output_hidden_states=None, <del> return_dict=None, <del> labels=None, <del> ): <add> input_values: Optional[torch.Tensor], <add> attention_mask: Optional[torch.Tensor] = None, <add> output_attentions: Optional[bool] = None, <add> output_hidden_states: Optional[bool] = None, <add> return_dict: Optional[bool] = None, <add> labels: Optional[torch.Tensor] = None, <add> ) -> Union[Tuple, CausalLMOutput]: <ide> r""" <ide> labels (`torch.LongTensor` of shape `(batch_size, target_length)`, *optional*): <ide> Labels for connectionist temporal classification. Note that `target_length` has to be smaller or equal to <ide> def freeze_base_model(self): <ide> ) <ide> def forward( <ide> self, <del> input_values, <del> attention_mask=None, <del> output_attentions=None, <del> output_hidden_states=None, <del> return_dict=None, <del> labels=None, <del> ): <add> input_values: Optional[torch.Tensor], <add> attention_mask: Optional[torch.Tensor] = None, <add> output_attentions: Optional[bool] = None, <add> output_hidden_states: Optional[bool] = None, <add> return_dict: Optional[bool] = None, <add> labels: Optional[torch.Tensor] = None, <add> ) -> Union[Tuple, SequenceClassifierOutput]: <ide> r""" <ide> labels (`torch.LongTensor` of shape `(batch_size,)`, *optional*): <ide> Labels for computing the sequence classification/regression loss. Indices should be in `[0, ..., <ide><path>src/transformers/models/sew/modeling_sew.py <ide> def _mask_hidden_states( <ide> ) <ide> def forward( <ide> self, <del> input_values, <del> attention_mask=None, <del> mask_time_indices=None, <del> output_attentions=None, <del> output_hidden_states=None, <del> return_dict=None, <del> ): <add> input_values: Optional[torch.Tensor], <add> attention_mask: Optional[torch.Tensor] = None, <add> mask_time_indices: Optional[torch.FloatTensor] = None, <add> output_attentions: Optional[bool] = None, <add> output_hidden_states: Optional[bool] = None, <add> return_dict: Optional[bool] = None, <add> ) -> Union[Tuple, BaseModelOutput]: <ide> output_attentions = output_attentions if output_attentions is not None else self.config.output_attentions <ide> output_hidden_states = ( <ide> output_hidden_states if output_hidden_states is not None else self.config.output_hidden_states <ide> def freeze_feature_encoder(self): <ide> ) <ide> def forward( <ide> self, <del> input_values, <del> attention_mask=None, <del> output_attentions=None, <del> output_hidden_states=None, <del> return_dict=None, <del> labels=None, <del> ): <add> input_values: Optional[torch.Tensor], <add> attention_mask: Optional[torch.Tensor] = None, <add> output_attentions: Optional[bool] = None, <add> output_hidden_states: Optional[bool] = None, <add> return_dict: Optional[bool] = None, <add> labels: Optional[torch.Tensor] = None, <add> ) -> Union[Tuple, CausalLMOutput]: <ide> r""" <ide> labels (`torch.LongTensor` of shape `(batch_size, target_length)`, *optional*): <ide> Labels for connectionist temporal classification. Note that `target_length` has to be smaller or equal to <ide> def freeze_base_model(self): <ide> ) <ide> def forward( <ide> self, <del> input_values, <del> attention_mask=None, <del> output_attentions=None, <del> output_hidden_states=None, <del> return_dict=None, <del> labels=None, <del> ): <add> input_values: Optional[torch.Tensor], <add> attention_mask: Optional[torch.Tensor] = None, <add> output_attentions: Optional[bool] = None, <add> output_hidden_states: Optional[bool] = None, <add> return_dict: Optional[bool] = None, <add> labels: Optional[torch.Tensor] = None, <add> ) -> Union[Tuple, SequenceClassifierOutput]: <ide> r""" <ide> labels (`torch.LongTensor` of shape `(batch_size,)`, *optional*): <ide> Labels for computing the sequence classification/regression loss. Indices should be in `[0, ..., <ide><path>src/transformers/models/sew_d/modeling_sew_d.py <ide> def _mask_hidden_states( <ide> ) <ide> def forward( <ide> self, <del> input_values, <del> attention_mask=None, <del> mask_time_indices=None, <del> output_attentions=None, <del> output_hidden_states=None, <del> return_dict=None, <del> ): <add> input_values: Optional[torch.Tensor], <add> attention_mask: Optional[torch.Tensor] = None, <add> mask_time_indices: Optional[torch.FloatTensor] = None, <add> output_attentions: Optional[bool] = None, <add> output_hidden_states: Optional[bool] = None, <add> return_dict: Optional[bool] = None, <add> ) -> Union[Tuple, BaseModelOutput]: <ide> output_attentions = output_attentions if output_attentions is not None else self.config.output_attentions <ide> output_hidden_states = ( <ide> output_hidden_states if output_hidden_states is not None else self.config.output_hidden_states <ide> def freeze_feature_encoder(self): <ide> ) <ide> def forward( <ide> self, <del> input_values, <del> attention_mask=None, <del> output_attentions=None, <del> output_hidden_states=None, <del> return_dict=None, <del> labels=None, <del> ): <add> input_values: Optional[torch.Tensor], <add> attention_mask: Optional[torch.Tensor] = None, <add> output_attentions: Optional[bool] = None, <add> output_hidden_states: Optional[bool] = None, <add> return_dict: Optional[bool] = None, <add> labels: Optional[torch.Tensor] = None, <add> ) -> Union[Tuple, CausalLMOutput]: <ide> r""" <ide> labels (`torch.LongTensor` of shape `(batch_size, target_length)`, *optional*): <ide> Labels for connectionist temporal classification. Note that `target_length` has to be smaller or equal to <ide> def freeze_base_model(self): <ide> ) <ide> def forward( <ide> self, <del> input_values, <del> attention_mask=None, <del> output_attentions=None, <del> output_hidden_states=None, <del> return_dict=None, <del> labels=None, <del> ): <add> input_values: Optional[torch.Tensor], <add> attention_mask: Optional[torch.Tensor] = None, <add> output_attentions: Optional[bool] = None, <add> output_hidden_states: Optional[bool] = None, <add> return_dict: Optional[bool] = None, <add> labels: Optional[torch.Tensor] = None, <add> ) -> Union[Tuple, SequenceClassifierOutput]: <ide> r""" <ide> labels (`torch.LongTensor` of shape `(batch_size,)`, *optional*): <ide> Labels for computing the sequence classification/regression loss. Indices should be in `[0, ..., <ide><path>src/transformers/models/unispeech/modeling_unispeech.py <ide> def _mask_hidden_states( <ide> ) <ide> def forward( <ide> self, <del> input_values, <del> attention_mask=None, <del> mask_time_indices=None, <del> output_attentions=None, <del> output_hidden_states=None, <del> return_dict=None, <del> ): <add> input_values: Optional[torch.Tensor], <add> attention_mask: Optional[torch.Tensor] = None, <add> mask_time_indices: Optional[torch.FloatTensor] = None, <add> output_attentions: Optional[bool] = None, <add> output_hidden_states: Optional[bool] = None, <add> return_dict: Optional[bool] = None, <add> ) -> Union[Tuple, UniSpeechBaseModelOutput]: <ide> output_attentions = output_attentions if output_attentions is not None else self.config.output_attentions <ide> output_hidden_states = ( <ide> output_hidden_states if output_hidden_states is not None else self.config.output_hidden_states <ide> def compute_contrastive_logits( <ide> @replace_return_docstrings(output_type=UniSpeechForPreTrainingOutput, config_class=_CONFIG_FOR_DOC) <ide> def forward( <ide> self, <del> input_values, <del> attention_mask=None, <del> output_attentions=None, <del> output_hidden_states=None, <del> return_dict=None, <del> ): <add> input_values: Optional[torch.Tensor], <add> attention_mask: Optional[torch.Tensor] = None, <add> output_attentions: Optional[bool] = None, <add> output_hidden_states: Optional[bool] = None, <add> return_dict: Optional[bool] = None, <add> ) -> Union[Tuple, UniSpeechForPreTrainingOutput]: <ide> r""" <ide> mask_time_indices (`torch.BoolTensor` of shape `(batch_size, sequence_length)`, *optional*): <ide> Indices to mask extracted features for contrastive loss. When in training mode, model learns to predict <ide> def freeze_feature_encoder(self): <ide> ) <ide> def forward( <ide> self, <del> input_values, <del> attention_mask=None, <del> output_attentions=None, <del> output_hidden_states=None, <del> return_dict=None, <del> labels=None, <del> ): <add> input_values: Optional[torch.Tensor], <add> attention_mask: Optional[torch.Tensor] = None, <add> output_attentions: Optional[bool] = None, <add> output_hidden_states: Optional[bool] = None, <add> return_dict: Optional[bool] = None, <add> labels: Optional[torch.Tensor] = None, <add> ) -> Union[Tuple, CausalLMOutput]: <ide> r""" <ide> labels (`torch.LongTensor` of shape `(batch_size, target_length)`, *optional*): <ide> Labels for connectionist temporal classification. Note that `target_length` has to be smaller or equal to <ide> def freeze_base_model(self): <ide> ) <ide> def forward( <ide> self, <del> input_values, <del> attention_mask=None, <del> output_attentions=None, <del> output_hidden_states=None, <del> return_dict=None, <del> labels=None, <del> ): <add> input_values: Optional[torch.Tensor], <add> attention_mask: Optional[torch.Tensor] = None, <add> output_attentions: Optional[bool] = None, <add> output_hidden_states: Optional[bool] = None, <add> return_dict: Optional[bool] = None, <add> labels: Optional[torch.Tensor] = None, <add> ) -> Union[Tuple, SequenceClassifierOutput]: <ide> r""" <ide> labels (`torch.LongTensor` of shape `(batch_size,)`, *optional*): <ide> Labels for computing the sequence classification/regression loss. Indices should be in `[0, ..., <ide><path>src/transformers/models/unispeech_sat/modeling_unispeech_sat.py <ide> def _mask_hidden_states( <ide> ) <ide> def forward( <ide> self, <del> input_values, <del> attention_mask=None, <del> mask_time_indices=None, <del> output_attentions=None, <del> output_hidden_states=None, <del> return_dict=None, <del> ): <add> input_values: Optional[torch.Tensor], <add> attention_mask: Optional[torch.Tensor] = None, <add> mask_time_indices: Optional[torch.FloatTensor] = None, <add> output_attentions: Optional[bool] = None, <add> output_hidden_states: Optional[bool] = None, <add> return_dict: Optional[bool] = None, <add> ) -> Union[Tuple, UniSpeechSatBaseModelOutput]: <ide> output_attentions = output_attentions if output_attentions is not None else self.config.output_attentions <ide> output_hidden_states = ( <ide> output_hidden_states if output_hidden_states is not None else self.config.output_hidden_states <ide> def compute_contrastive_logits( <ide> @replace_return_docstrings(output_type=UniSpeechSatForPreTrainingOutput, config_class=_CONFIG_FOR_DOC) <ide> def forward( <ide> self, <del> input_values, <del> attention_mask=None, <del> output_attentions=None, <del> output_hidden_states=None, <del> return_dict=None, <del> ): <add> input_values: Optional[torch.Tensor], <add> attention_mask: Optional[torch.Tensor] = None, <add> output_attentions: Optional[bool] = None, <add> output_hidden_states: Optional[bool] = None, <add> return_dict: Optional[bool] = None, <add> ) -> Union[Tuple, UniSpeechSatForPreTrainingOutput]: <ide> r""" <ide> Returns: <ide> <ide> def freeze_feature_encoder(self): <ide> ) <ide> def forward( <ide> self, <del> input_values, <del> attention_mask=None, <del> output_attentions=None, <del> output_hidden_states=None, <del> return_dict=None, <del> labels=None, <del> ): <add> input_values: Optional[torch.Tensor], <add> attention_mask: Optional[torch.Tensor] = None, <add> output_attentions: Optional[bool] = None, <add> output_hidden_states: Optional[bool] = None, <add> return_dict: Optional[bool] = None, <add> labels: Optional[torch.Tensor] = None, <add> ) -> Union[Tuple, CausalLMOutput]: <ide> r""" <ide> labels (`torch.LongTensor` of shape `(batch_size, target_length)`, *optional*): <ide> Labels for connectionist temporal classification. Note that `target_length` has to be smaller or equal to <ide> def freeze_base_model(self): <ide> ) <ide> def forward( <ide> self, <del> input_values, <del> attention_mask=None, <del> output_attentions=None, <del> output_hidden_states=None, <del> return_dict=None, <del> labels=None, <del> ): <add> input_values: Optional[torch.Tensor], <add> attention_mask: Optional[torch.Tensor] = None, <add> output_attentions: Optional[bool] = None, <add> output_hidden_states: Optional[bool] = None, <add> return_dict: Optional[bool] = None, <add> labels: Optional[torch.Tensor] = None, <add> ) -> Union[Tuple, SequenceClassifierOutput]: <ide> r""" <ide> labels (`torch.LongTensor` of shape `(batch_size,)`, *optional*): <ide> Labels for computing the sequence classification/regression loss. Indices should be in `[0, ..., <ide> def freeze_base_model(self): <ide> ) <ide> def forward( <ide> self, <del> input_values, <del> attention_mask=None, <del> output_attentions=None, <del> output_hidden_states=None, <del> return_dict=None, <del> ): <add> input_values: Optional[torch.Tensor], <add> attention_mask: Optional[torch.Tensor] = None, <add> output_attentions: Optional[bool] = None, <add> output_hidden_states: Optional[bool] = None, <add> return_dict: Optional[bool] = None, <add> ) -> Union[Tuple, TokenClassifierOutput]: <ide> r""" <ide> labels (`torch.LongTensor` of shape `(batch_size,)`, *optional*): <ide> Labels for computing the sequence classification/regression loss. Indices should be in `[0, ..., <ide> def _conv_out_length(input_length, kernel_size, stride): <ide> ) <ide> def forward( <ide> self, <del> input_values, <del> attention_mask=None, <del> output_attentions=None, <del> output_hidden_states=None, <del> return_dict=None, <del> labels=None, <del> ): <add> input_values: Optional[torch.Tensor], <add> attention_mask: Optional[torch.Tensor] = None, <add> output_attentions: Optional[bool] = None, <add> output_hidden_states: Optional[bool] = None, <add> return_dict: Optional[bool] = None, <add> labels: Optional[torch.Tensor] = None, <add> ) -> Union[Tuple, XVectorOutput]: <ide> r""" <ide> labels (`torch.LongTensor` of shape `(batch_size,)`, *optional*): <ide> Labels for computing the sequence classification/regression loss. Indices should be in `[0, ..., <ide><path>src/transformers/models/wav2vec2/modeling_wav2vec2.py <ide> def _mask_hidden_states( <ide> ) <ide> def forward( <ide> self, <del> input_values, <del> attention_mask=None, <del> mask_time_indices=None, <del> output_attentions=None, <del> output_hidden_states=None, <del> return_dict=None, <del> ): <add> input_values: Optional[torch.Tensor], <add> attention_mask: Optional[torch.Tensor] = None, <add> mask_time_indices: Optional[torch.FloatTensor] = None, <add> output_attentions: Optional[bool] = None, <add> output_hidden_states: Optional[bool] = None, <add> return_dict: Optional[bool] = None, <add> ) -> Union[Tuple, Wav2Vec2BaseModelOutput]: <ide> output_attentions = output_attentions if output_attentions is not None else self.config.output_attentions <ide> output_hidden_states = ( <ide> output_hidden_states if output_hidden_states is not None else self.config.output_hidden_states <ide> def compute_contrastive_logits( <ide> @replace_return_docstrings(output_type=Wav2Vec2ForPreTrainingOutput, config_class=_CONFIG_FOR_DOC) <ide> def forward( <ide> self, <del> input_values, <del> attention_mask=None, <del> mask_time_indices=None, <del> sampled_negative_indices=None, <del> output_attentions=None, <del> output_hidden_states=None, <del> return_dict=None, <del> ): <add> input_values: Optional[torch.Tensor], <add> attention_mask: Optional[torch.Tensor] = None, <add> mask_time_indices: Optional[torch.BoolTensor] = None, <add> sampled_negative_indices: Optional[torch.BoolTensor] = None, <add> output_attentions: Optional[bool] = None, <add> output_hidden_states: Optional[bool] = None, <add> return_dict: Optional[bool] = None, <add> ) -> Union[Tuple, Wav2Vec2ForPreTrainingOutput]: <ide> r""" <ide> mask_time_indices (`torch.BoolTensor` of shape `(batch_size, sequence_length)`, *optional*): <ide> Indices to mask extracted features for contrastive loss. When in training mode, model learns to predict <ide> def freeze_feature_encoder(self): <ide> ) <ide> def forward( <ide> self, <del> input_values, <del> attention_mask=None, <del> output_attentions=None, <del> output_hidden_states=None, <del> return_dict=None, <del> labels=None, <del> ): <add> input_values: Optional[torch.Tensor], <add> attention_mask: Optional[torch.Tensor] = None, <add> output_attentions: Optional[bool] = None, <add> output_hidden_states: Optional[bool] = None, <add> return_dict: Optional[bool] = None, <add> labels: Optional[torch.Tensor] = None, <add> ) -> Union[Tuple, CausalLMOutput]: <ide> r""" <ide> labels (`torch.LongTensor` of shape `(batch_size, target_length)`, *optional*): <ide> Labels for connectionist temporal classification. Note that `target_length` has to be smaller or equal to <ide> def freeze_base_model(self): <ide> ) <ide> def forward( <ide> self, <del> input_values, <del> attention_mask=None, <del> output_attentions=None, <del> output_hidden_states=None, <del> return_dict=None, <del> labels=None, <del> ): <add> input_values: Optional[torch.Tensor], <add> attention_mask: Optional[torch.Tensor] = None, <add> output_attentions: Optional[bool] = None, <add> output_hidden_states: Optional[bool] = None, <add> return_dict: Optional[bool] = None, <add> labels: Optional[torch.Tensor] = None, <add> ) -> Union[Tuple, SequenceClassifierOutput]: <ide> r""" <ide> labels (`torch.LongTensor` of shape `(batch_size,)`, *optional*): <ide> Labels for computing the sequence classification/regression loss. Indices should be in `[0, ..., <ide> def freeze_base_model(self): <ide> ) <ide> def forward( <ide> self, <del> input_values, <del> attention_mask=None, <del> output_attentions=None, <del> output_hidden_states=None, <del> return_dict=None, <del> ): <add> input_values: Optional[torch.Tensor], <add> attention_mask: Optional[torch.Tensor] = None, <add> output_attentions: Optional[bool] = None, <add> output_hidden_states: Optional[bool] = None, <add> return_dict: Optional[bool] = None, <add> ) -> Union[Tuple, TokenClassifierOutput]: <ide> r""" <ide> labels (`torch.LongTensor` of shape `(batch_size,)`, *optional*): <ide> Labels for computing the sequence classification/regression loss. Indices should be in `[0, ..., <ide> def _conv_out_length(input_length, kernel_size, stride): <ide> ) <ide> def forward( <ide> self, <del> input_values, <del> attention_mask=None, <del> output_attentions=None, <del> output_hidden_states=None, <del> return_dict=None, <del> labels=None, <del> ): <add> input_values: Optional[torch.Tensor], <add> attention_mask: Optional[torch.Tensor] = None, <add> output_attentions: Optional[bool] = None, <add> output_hidden_states: Optional[bool] = None, <add> return_dict: Optional[bool] = None, <add> labels: Optional[torch.Tensor] = None, <add> ) -> Union[Tuple, XVectorOutput]: <ide> r""" <ide> labels (`torch.LongTensor` of shape `(batch_size,)`, *optional*): <ide> Labels for computing the sequence classification/regression loss. Indices should be in `[0, ..., <ide><path>src/transformers/models/wavlm/modeling_wavlm.py <ide> def _mask_hidden_states( <ide> ) <ide> def forward( <ide> self, <del> input_values, <del> attention_mask=None, <del> mask_time_indices=None, <del> output_attentions=None, <del> output_hidden_states=None, <del> return_dict=None, <del> ): <add> input_values: Optional[torch.Tensor], <add> attention_mask: Optional[torch.Tensor] = None, <add> mask_time_indices: Optional[torch.FloatTensor] = None, <add> output_attentions: Optional[bool] = None, <add> output_hidden_states: Optional[bool] = None, <add> return_dict: Optional[bool] = None, <add> ) -> Union[Tuple, WavLMBaseModelOutput]: <ide> output_attentions = output_attentions if output_attentions is not None else self.config.output_attentions <ide> output_hidden_states = ( <ide> output_hidden_states if output_hidden_states is not None else self.config.output_hidden_states <ide> def freeze_feature_encoder(self): <ide> ) <ide> def forward( <ide> self, <del> input_values, <del> attention_mask=None, <del> output_attentions=None, <del> output_hidden_states=None, <del> return_dict=None, <del> labels=None, <del> ): <add> input_values: Optional[torch.Tensor], <add> attention_mask: Optional[torch.Tensor] = None, <add> output_attentions: Optional[bool] = None, <add> output_hidden_states: Optional[bool] = None, <add> return_dict: Optional[bool] = None, <add> labels: Optional[torch.Tensor] = None, <add> ) -> Union[Tuple, CausalLMOutput]: <ide> r""" <ide> labels (`torch.LongTensor` of shape `(batch_size, target_length)`, *optional*): <ide> Labels for connectionist temporal classification. Note that `target_length` has to be smaller or equal to <ide> def freeze_base_model(self): <ide> ) <ide> def forward( <ide> self, <del> input_values, <del> attention_mask=None, <del> output_attentions=None, <del> output_hidden_states=None, <del> return_dict=None, <del> labels=None, <del> ): <add> input_values: Optional[torch.Tensor], <add> attention_mask: Optional[torch.Tensor] = None, <add> output_attentions: Optional[bool] = None, <add> output_hidden_states: Optional[bool] = None, <add> return_dict: Optional[bool] = None, <add> labels: Optional[torch.Tensor] = None, <add> ) -> Union[Tuple, SequenceClassifierOutput]: <ide> r""" <ide> labels (`torch.LongTensor` of shape `(batch_size,)`, *optional*): <ide> Labels for computing the sequence classification/regression loss. Indices should be in `[0, ..., <ide> def freeze_base_model(self): <ide> ) <ide> def forward( <ide> self, <del> input_values, <del> attention_mask=None, <del> output_attentions=None, <del> output_hidden_states=None, <del> return_dict=None, <del> ): <add> input_values: Optional[torch.Tensor], <add> attention_mask: Optional[torch.Tensor] = None, <add> output_attentions: Optional[bool] = None, <add> output_hidden_states: Optional[bool] = None, <add> return_dict: Optional[bool] = None, <add> ) -> Union[Tuple, TokenClassifierOutput]: <ide> r""" <ide> labels (`torch.LongTensor` of shape `(batch_size,)`, *optional*): <ide> Labels for computing the sequence classification/regression loss. Indices should be in `[0, ..., <ide> def _conv_out_length(input_length, kernel_size, stride): <ide> ) <ide> def forward( <ide> self, <del> input_values, <del> attention_mask=None, <del> output_attentions=None, <del> output_hidden_states=None, <del> return_dict=None, <del> labels=None, <del> ): <add> input_values: Optional[torch.Tensor], <add> attention_mask: Optional[torch.Tensor] = None, <add> output_attentions: Optional[bool] = None, <add> output_hidden_states: Optional[bool] = None, <add> return_dict: Optional[bool] = None, <add> labels: Optional[torch.Tensor] = None, <add> ) -> Union[Tuple, XVectorOutput]: <ide> r""" <ide> labels (`torch.LongTensor` of shape `(batch_size,)`, *optional*): <ide> Labels for computing the sequence classification/regression loss. Indices should be in `[0, ...,
8
Javascript
Javascript
use relative imports for container
6aa70081f55feefc106b2c2cfaae369ab8d74d60
<ide><path>packages/container/lib/index.js <ide> The public API, specified on the application namespace should be considered the <ide> @private <ide> */ <ide> <del>import Registry from 'container/registry'; <del>import Container from 'container/container'; <del>import { getOwner, setOwner } from 'container/owner'; <add>import Registry from './registry'; <add>import Container from './container'; <add>import { getOwner, setOwner } from './owner'; <ide> <ide> export { Registry, Container, getOwner, setOwner };
1
Ruby
Ruby
remove unnecessary overriding of `#initialize`
daf0f23b77a582340c0a52a3024069fd21ade633
<ide><path>activerecord/lib/active_record/reflection.rb <ide> def primary_key(klass) <ide> end <ide> <ide> class HasManyReflection < AssociationReflection # :nodoc: <del> def initialize(name, scope, options, active_record) <del> super(name, scope, options, active_record) <del> end <del> <ide> def macro; :has_many; end <ide> <ide> def collection?; true; end <ide> def association_class <ide> end <ide> <ide> class HasOneReflection < AssociationReflection # :nodoc: <del> def initialize(name, scope, options, active_record) <del> super(name, scope, options, active_record) <del> end <del> <ide> def macro; :has_one; end <ide> <ide> def has_one?; true; end <ide> def calculate_constructable(macro, options) <ide> end <ide> <ide> class BelongsToReflection < AssociationReflection # :nodoc: <del> def initialize(name, scope, options, active_record) <del> super(name, scope, options, active_record) <del> end <del> <ide> def macro; :belongs_to; end <ide> <ide> def belongs_to?; true; end
1
Javascript
Javascript
fix custom webpack config in inferno example
6685d633e1f4921c1df92a3dee317e16ffa99085
<ide><path>examples/using-inferno/next.config.js <ide> module.exports = { <ide> } <ide> <ide> config.resolve.alias = { <add> ...config.resolve.alias, <ide> react: 'inferno-compat', <ide> 'react-dom': 'inferno-compat' <ide> }
1
Javascript
Javascript
remove special test entries
357230f4b7174380467edfb0a65a00b65b0af66c
<ide><path>benchmark/assert/deepequal-buffer.js <ide> const bench = common.createBenchmark(main, { <ide> n: [2e4], <ide> len: [1e2, 1e3], <ide> strict: [0, 1], <del> method: [ 'deepEqual', 'notDeepEqual' ], <add> method: ['deepEqual', 'notDeepEqual'], <ide> }); <ide> <ide> function main({ len, n, method, strict }) { <del> if (!method) <del> method = 'deepEqual'; <ide> const data = Buffer.allocUnsafe(len + 1); <ide> const actual = Buffer.alloc(len); <ide> const expected = Buffer.alloc(len); <ide><path>benchmark/assert/deepequal-map.js <ide> function main({ n, len, method, strict }) { <ide> const array = Array(len).fill(1); <ide> <ide> switch (method) { <del> case '': <del> // Empty string falls through to next line as default, mostly for tests. <ide> case 'deepEqual_primitiveOnly': { <ide> const values = array.map((_, i) => [`str_${i}`, 123]); <ide> benchmark(strict ? deepStrictEqual : deepEqual, n, values); <ide><path>benchmark/assert/deepequal-object.js <ide> const bench = common.createBenchmark(main, { <ide> n: [5e3], <ide> size: [1e2, 1e3, 5e4], <ide> strict: [0, 1], <del> method: [ 'deepEqual', 'notDeepEqual' ], <add> method: ['deepEqual', 'notDeepEqual'], <ide> }); <ide> <ide> function createObj(source, add = '') { <ide> function main({ size, n, method, strict }) { <ide> // TODO: Fix this "hack". `n` should not be manipulated. <ide> n = Math.min(Math.ceil(n / size), 20); <ide> <del> if (!method) <del> method = 'deepEqual'; <del> <ide> const source = Array.apply(null, Array(size)); <ide> const actual = createObj(source); <ide> const expected = createObj(source); <ide><path>benchmark/assert/deepequal-prims-and-objs-big-array-set.js <ide> function main({ n, len, primitive, method, strict }) { <ide> const expectedWrongSet = new Set(expectedWrong); <ide> <ide> switch (method) { <del> // Empty string falls through to next line as default, mostly for tests. <del> case '': <ide> case 'deepEqual_Array': <ide> run(strict ? deepStrictEqual : deepEqual, n, actual, expected); <ide> break; <ide><path>benchmark/assert/deepequal-prims-and-objs-big-loop.js <ide> const bench = common.createBenchmark(main, { <ide> primitive: Object.keys(primValues), <ide> n: [2e4], <ide> strict: [0, 1], <del> method: [ 'deepEqual', 'notDeepEqual' ], <add> method: ['deepEqual', 'notDeepEqual'], <ide> }); <ide> <ide> function main({ n, primitive, method, strict }) { <del> if (!method) <del> method = 'deepEqual'; <ide> const prim = primValues[primitive]; <ide> const actual = prim; <ide> const expected = prim; <ide><path>benchmark/assert/deepequal-set.js <ide> function main({ n, len, method, strict }) { <ide> const array = Array(len).fill(1); <ide> <ide> switch (method) { <del> case '': <del> // Empty string falls through to next line as default, mostly for tests. <ide> case 'deepEqual_primitiveOnly': { <ide> const values = array.map((_, i) => `str_${i}`); <ide> benchmark(strict ? deepStrictEqual : deepEqual, n, values); <ide><path>benchmark/assert/deepequal-typedarrays.js <ide> const bench = common.createBenchmark(main, { <ide> }); <ide> <ide> function main({ type, n, len, method, strict }) { <del> if (!method) <del> method = 'deepEqual'; <ide> const clazz = global[type]; <ide> const actual = new clazz(len); <ide> const expected = new clazz(len); <ide><path>benchmark/assert/throws.js <ide> function main({ n, method }) { <ide> const message = 'failure'; <ide> <ide> switch (method) { <del> case '': <del> // Empty string falls through to next line as default, mostly for tests. <ide> case 'doesNotThrow': <ide> bench.start(); <ide> for (let i = 0; i < n; ++i) { <ide><path>benchmark/buffers/buffer-bytelength.js <ide> const chars = [ <ide> <ide> function main({ n, len, encoding }) { <ide> let strings = []; <del> let results = [ len * 16 ]; <add> let results = [len * 16]; <ide> if (encoding === 'buffer') { <del> strings = [ Buffer.alloc(len * 16, 'a') ]; <add> strings = [Buffer.alloc(len * 16, 'a')]; <ide> } else { <ide> for (const string of chars) { <ide> // Strings must be built differently, depending on encoding <ide><path>benchmark/buffers/buffer-creation.js <ide> const bench = common.createBenchmark(main, { <ide> function main({ len, n, type }) { <ide> let fn, i; <ide> switch (type) { <del> case '': <ide> case 'fast-alloc': <ide> fn = Buffer.alloc; <ide> break; <ide><path>benchmark/buffers/buffer-fill.js <ide> function main({ n, type, size }) { <ide> const buffer = Buffer.allocUnsafe(size); <ide> const testFunction = new Function('b', ` <ide> for (var i = 0; i < ${n}; i++) { <del> b.${type || 'fill(0)'}; <add> b.${type}; <ide> } <ide> `); <ide> bench.start(); <ide><path>benchmark/buffers/buffer-iterate.js <ide> function main({ size, type, method, n }) { <ide> Buffer.alloc(size) : <ide> SlowBuffer(size).fill(0); <ide> <del> const fn = methods[method || 'for']; <add> const fn = methods[method]; <ide> <ide> bench.start(); <ide> fn(buffer, n); <ide><path>benchmark/buffers/buffer-read-float.js <ide> const bench = common.createBenchmark(main, { <ide> }); <ide> <ide> function main({ n, type, endian, value }) { <del> type = type || 'Double'; <ide> const buff = Buffer.alloc(8); <ide> const fn = `read${type}${endian}`; <ide> const values = { <ide><path>benchmark/buffers/buffer-read-with-byteLength.js <ide> function main({ n, buf, type, byteLength }) { <ide> const buff = buf === 'fast' ? <ide> Buffer.alloc(8) : <ide> require('buffer').SlowBuffer(8); <del> const fn = `read${type || 'IntBE'}`; <add> const fn = `read${type}`; <ide> <ide> buff.writeDoubleLE(0, 0); <ide> bench.start(); <ide><path>benchmark/buffers/buffer-read.js <ide> function main({ n, buf, type }) { <ide> const buff = buf === 'fast' ? <ide> Buffer.alloc(8) : <ide> require('buffer').SlowBuffer(8); <del> const fn = `read${type || 'UInt8'}`; <add> const fn = `read${type}`; <ide> <ide> buff.writeDoubleLE(0, 0); <ide> bench.start(); <ide><path>benchmark/buffers/buffer-swap.js <ide> function genMethod(method) { <ide> <ide> function main({ method, len, n, aligned = 'true' }) { <ide> const buf = createBuffer(len, aligned === 'true'); <del> const bufferSwap = genMethod(method || 'swap16'); <add> const bufferSwap = genMethod(method); <ide> <ide> bufferSwap(n, buf); <ide> bench.start(); <ide><path>benchmark/buffers/buffer-write.js <ide> function main({ n, buf, type }) { <ide> const buff = buf === 'fast' ? <ide> Buffer.alloc(8) : <ide> require('buffer').SlowBuffer(8); <del> const fn = `write${type || 'UInt8'}`; <add> const fn = `write${type}`; <ide> <ide> if (!/\d/.test(fn)) <ide> benchSpecialInt(buff, fn, n); <ide><path>benchmark/buffers/dataview-set.js <ide> const mod = { <ide> }; <ide> <ide> function main({ n, type }) { <del> type = type || 'Uint8'; <ide> const ab = new ArrayBuffer(8); <ide> const dv = new DataView(ab, 0, 8); <ide> const le = /LE$/.test(type); <ide><path>benchmark/crypto/aes-gcm-throughput.js <ide> const bench = common.createBenchmark(main, { <ide> }); <ide> <ide> function main({ n, len, cipher }) { <del> // Default cipher for tests. <del> if (cipher === '') <del> cipher = 'aes-128-gcm'; <ide> const message = Buffer.alloc(len, 'b'); <ide> const key = crypto.randomBytes(keylen[cipher]); <ide> const iv = crypto.randomBytes(12); <ide><path>benchmark/crypto/cipher-stream.js <ide> const common = require('../common.js'); <ide> <ide> const bench = common.createBenchmark(main, { <ide> writes: [500], <del> cipher: [ 'AES192', 'AES256' ], <add> cipher: ['AES192', 'AES256'], <ide> type: ['asc', 'utf', 'buf'], <ide> len: [2, 1024, 102400, 1024 * 1024], <ide> api: ['legacy', 'stream'] <ide> const bench = common.createBenchmark(main, { <ide> }); <ide> <ide> function main({ api, cipher, type, len, writes }) { <del> // Default cipher for tests. <del> if (cipher === '') <del> cipher = 'AES192'; <ide> if (api === 'stream' && /^v0\.[0-8]\./.test(process.version)) { <ide> console.error('Crypto streams not available until v0.10'); <ide> // Use the legacy, just so that we can compare them. <ide> function main({ api, cipher, type, len, writes }) { <ide> alice.generateKeys(); <ide> bob.generateKeys(); <ide> <del> <ide> const pubEnc = /^v0\.[0-8]/.test(process.version) ? 'binary' : null; <ide> const alice_secret = alice.computeSecret(bob.getPublicKey(), pubEnc, 'hex'); <ide> const bob_secret = bob.computeSecret(alice.getPublicKey(), pubEnc, 'hex'); <ide><path>benchmark/es/defaultparams-bench.js <ide> function runDefaultParams(n) { <ide> <ide> function main({ n, method }) { <ide> switch (method) { <del> case '': <del> // Empty string falls through to next line as default, mostly for tests. <ide> case 'withoutdefaults': <ide> runOldStyleDefaults(n); <ide> break; <ide><path>benchmark/es/destructuring-bench.js <ide> function runSwapDestructured(n) { <ide> <ide> function main({ n, method }) { <ide> switch (method) { <del> case '': <del> // Empty string falls through to next line as default, mostly for tests. <ide> case 'swap': <ide> runSwapManual(n); <ide> break; <ide><path>benchmark/es/destructuring-object-bench.js <ide> function runDestructured(n) { <ide> <ide> function main({ n, method }) { <ide> switch (method) { <del> case '': <del> // Empty string falls through to next line as default, mostly for tests. <ide> case 'normal': <ide> runNormal(n); <ide> break; <ide><path>benchmark/es/foreach-bench.js <ide> function main({ n, count, method }) { <ide> items[i] = i; <ide> <ide> switch (method) { <del> case '': <del> // Empty string falls through to next line as default, mostly for tests. <ide> case 'for': <ide> fn = useFor; <ide> break; <ide><path>benchmark/es/map-bench.js <ide> function runMap(n) { <ide> <ide> function main({ n, method }) { <ide> switch (method) { <del> case '': <del> // Empty string falls through to next line as default, mostly for tests. <ide> case 'object': <ide> runObject(n); <ide> break; <ide><path>benchmark/es/restparams-bench.js <ide> function runUseArguments(n) { <ide> function main({ n, method }) { <ide> let fn; <ide> switch (method) { <del> case '': <del> // Empty string falls through to next line as default, mostly for tests. <ide> case 'copy': <ide> fn = runCopyArguments; <ide> break; <ide><path>benchmark/es/spread-assign.js <ide> function main({ n, context, count, rest, method }) { <ide> let obj; // eslint-disable-line no-unused-vars <ide> <ide> switch (method) { <del> case '': <del> // Empty string falls through to next line as default, mostly for tests. <ide> case '_extend': <ide> bench.start(); <ide> for (let i = 0; i < n; i++) <ide><path>benchmark/es/spread-bench.js <ide> function main({ n, context, count, rest, method }) { <ide> args[i] = i; <ide> <ide> switch (method) { <del> case '': <del> // Empty string falls through to next line as default, mostly for tests. <ide> case 'apply': <ide> bench.start(); <ide> for (let i = 0; i < n; i++) <ide><path>benchmark/es/string-concatenations.js <ide> function main({ n, mode }) { <ide> let string; <ide> <ide> switch (mode) { <del> case '': <del> // Empty string falls through to next line as default, mostly for tests. <ide> case 'multi-concat': <ide> bench.start(); <ide> for (let i = 0; i < n; i++) <ide><path>benchmark/es/string-repeat.js <ide> function main({ n, size, encoding, mode }) { <ide> let str; <ide> <ide> switch (mode) { <del> case '': <del> // Empty string falls through to next line as default, mostly for tests. <ide> case 'Array': <ide> bench.start(); <ide> for (let i = 0; i < n; i++) <ide><path>benchmark/misc/arguments.js <ide> function usingPredefined() { <ide> function main({ n, method, args }) { <ide> let fn; <ide> switch (method) { <del> // '' is a default case for tests <del> case '': <ide> case 'restAndSpread': <ide> fn = usingRestAndSpread; <ide> break; <ide><path>benchmark/misc/getstringwidth.js <ide> const bench = common.createBenchmark(main, { <ide> }); <ide> <ide> function main({ n, type }) { <del> // Default value for testing purposes. <del> type = type || 'ascii'; <ide> const { getStringWidth } = require('internal/util/inspect'); <ide> <ide> const str = ({ <ide><path>benchmark/misc/object-property-bench.js <ide> function runSymbol(n) { <ide> function main({ n, method }) { <ide> <ide> switch (method) { <del> // '' is a default case for tests <del> case '': <ide> case 'property': <ide> runProperty(n); <ide> break; <ide><path>benchmark/misc/punycode.js <ide> function runICU(n, val) { <ide> <ide> function main({ n, val, method }) { <ide> switch (method) { <del> // '' is a default case for tests <del> case '': <ide> case 'punycode': <ide> runPunycode(n, val); <ide> break; <ide><path>benchmark/misc/trace.js <ide> function main({ n, method }) { <ide> } = common.binding('trace_events'); <ide> <ide> switch (method) { <del> case '': <ide> case 'trace': <ide> doTrace(n, trace); <ide> break; <ide><path>benchmark/misc/util-extend-vs-object-assign.js <ide> const bench = common.createBenchmark(main, { <ide> }); <ide> <ide> function main({ n, type }) { <del> // Default value for tests. <del> if (type === '') <del> type = 'extend'; <del> <ide> let fn; <ide> if (type === 'extend') { <ide> fn = util._extend; <ide><path>benchmark/url/url-format.js <ide> const bench = common.createBenchmark(main, { <ide> }); <ide> <ide> function main({ type, n }) { <del> const input = inputs[type] || ''; <add> const input = inputs[type]; <ide> <ide> // Force-optimize url.format() so that the benchmark doesn't get <ide> // disrupted by the optimizer kicking in halfway through. <ide><path>benchmark/url/url-parse.js <ide> const bench = common.createBenchmark(main, { <ide> }); <ide> <ide> function main({ type, n }) { <del> const input = inputs[type] || ''; <add> const input = inputs[type]; <ide> <ide> bench.start(); <ide> for (let i = 0; i < n; i += 1) <ide><path>benchmark/util/format.js <ide> const bench = common.createBenchmark(main, { <ide> }); <ide> <ide> function main({ n, type }) { <del> // For testing, if supplied with an empty type, default to string. <del> const [first, second] = inputs[type || 'string']; <add> const [first, second] = inputs[type]; <ide> <ide> bench.start(); <ide> for (let i = 0; i < n; i++) { <ide><path>benchmark/util/inspect-array.js <ide> function main({ n, len, type }) { <ide> opts = { showHidden: true }; <ide> arr = arr.fill('denseArray'); <ide> break; <del> // For testing, if supplied with an empty type, default to denseArray. <del> case '': <ide> case 'denseArray': <ide> arr = arr.fill('denseArray'); <ide> break; <ide><path>benchmark/util/type-check.js <ide> const bench = common.createBenchmark(main, { <ide> }); <ide> <ide> function main({ type, argument, version, n }) { <del> // For testing, if supplied with an empty type, default to ArrayBufferView. <del> type = type || 'ArrayBufferView'; <del> <ide> const util = common.binding('util'); <ide> const types = require('internal/util/types'); <ide>
41
Javascript
Javascript
fix null pointer err for some collada models
eb3dfab0bb313ca2059b33b6e57c0eeae02a7bc2
<ide><path>src/objects/SkinnedMesh.js <ide> THREE.SkinnedMesh = function ( geometry, material, useVertexTexture ) { <ide> <ide> gbone = this.geometry.bones[ b ]; <ide> <del> if ( gbone.parent !== - 1 ) { <add> if ( gbone.parent !== - 1 && gbone.parent !== null) { <ide> <ide> bones[ gbone.parent ].add( bones[ b ] ); <ide>
1
Javascript
Javascript
put the map in the dist directory
b20f536748300d5aef31ad68cc5adff849a1ee13
<ide><path>Gruntfile.js <ide> module.exports = function( grunt ) { <ide> }, <ide> options: { <ide> banner: "/*! jQuery v<%= pkg.version %> jquery.com | jquery.org/license */", <del> sourceMap: "jquery.min.map", <add> sourceMap: "dist/jquery.min.map", <ide> beautify: { <ide> ascii_only: true <ide> }
1
Javascript
Javascript
add test for escaping require.context id
ed558f2cad107c45fb2b7ca57d5906e9054daeb2
<ide><path>test/configCases/code-generation/require-context-id/folder/a.js <add>module.exports = "a"; <ide><path>test/configCases/code-generation/require-context-id/folder/b.js <add>module.exports = "b"; <ide><path>test/configCases/code-generation/require-context-id/index.js <add>it("should escape require.context id correctly", function() { <add> var context = require.context("./folder"); <add> context("./a").should.be.eql("a"); <add> context.id.should.be.type("string"); <add>}); <ide><path>test/configCases/code-generation/require-context-id/webpack.config.js <add>var webpack = require("../../../../"); <add>module.exports = { <add> plugins: [ <add> new webpack.HashedModuleIdsPlugin() <add> ] <add>};
4
PHP
PHP
update all uses of first()
41b4dd009463bd26c8322857340925692bb83301
<ide><path>src/Illuminate/Database/Eloquent/Collection.php <ide> public function find($key, $default = null) <ide> $key = $key->getKey(); <ide> } <ide> <del> return Arr::first($this->items, function ($itemKey, $model) use ($key) { <add> return Arr::first($this->items, function ($model) use ($key) { <ide> return $model->getKey() == $key; <ide> <ide> }, $default); <ide><path>src/Illuminate/Database/Eloquent/Model.php <ide> public static function getGlobalScope($scope) <ide> return isset($modelScopes[$scope]) ? $modelScopes[$scope] : null; <ide> } <ide> <del> return Arr::first($modelScopes, function ($key, $value) use ($scope) { <add> return Arr::first($modelScopes, function ($value) use ($scope) { <ide> return $scope instanceof $value; <ide> }); <ide> } <ide> protected function getBelongsToManyCaller() <ide> { <ide> $self = __FUNCTION__; <ide> <del> $caller = Arr::first(debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS), function ($key, $trace) use ($self) { <add> $caller = Arr::first(debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS), function ($trace) use ($self) { <ide> $caller = $trace['function']; <ide> <ide> return ! in_array($caller, Model::$manyMethods) && $caller != $self; <ide><path>src/Illuminate/Foundation/Application.php <ide> public function getProvider($provider) <ide> { <ide> $name = is_string($provider) ? $provider : get_class($provider); <ide> <del> return Arr::first($this->serviceProviders, function ($key, $value) use ($name) { <add> return Arr::first($this->serviceProviders, function ($value) use ($name) { <ide> return $value instanceof $name; <ide> }); <ide> } <ide><path>src/Illuminate/Foundation/EnvironmentDetector.php <ide> protected function detectConsoleEnvironment(Closure $callback, array $args) <ide> */ <ide> protected function getEnvironmentArgument(array $args) <ide> { <del> return Arr::first($args, function ($k, $v) { <del> return Str::startsWith($v, '--env'); <add> return Arr::first($args, function ($value) { <add> return Str::startsWith($value, '--env'); <ide> }); <ide> } <ide> } <ide><path>src/Illuminate/Routing/Route.php <ide> protected function parseAction($action) <ide> */ <ide> protected function findCallable(array $action) <ide> { <del> return Arr::first($action, function ($key, $value) { <add> return Arr::first($action, function ($value, $key) { <ide> return is_callable($value) && is_numeric($key); <ide> }); <ide> } <ide><path>src/Illuminate/Routing/RouteCollection.php <ide> protected function methodNotAllowed(array $others) <ide> */ <ide> protected function check(array $routes, $request, $includingMethod = true) <ide> { <del> return Arr::first($routes, function ($key, $value) use ($request, $includingMethod) { <add> return Arr::first($routes, function ($value) use ($request, $includingMethod) { <ide> return $value->matches($request, $includingMethod); <ide> }); <ide> } <ide><path>src/Illuminate/Routing/RouteDependencyResolverTrait.php <ide> protected function transformDependency(ReflectionParameter $parameter, $paramete <ide> */ <ide> protected function alreadyInParameters($class, array $parameters) <ide> { <del> return ! is_null(Arr::first($parameters, function ($key, $value) use ($class) { <add> return ! is_null(Arr::first($parameters, function ($value) use ($class) { <ide> return $value instanceof $class; <ide> })); <ide> } <ide><path>src/Illuminate/View/Factory.php <ide> protected function getExtension($path) <ide> { <ide> $extensions = array_keys($this->extensions); <ide> <del> return Arr::first($extensions, function ($key, $value) use ($path) { <add> return Arr::first($extensions, function ($value) use ($path) { <ide> return Str::endsWith($path, $value); <ide> }); <ide> }
8
Text
Text
make minor corrections in docs
9f07d9edeb5656b13de17ab8f1ca7347bac334b0
<ide><path>docs/community/funding.md <ide> REST framework continues to be open-source and permissively licensed, but we fir <ide> ## What future funding will enable <ide> <ide> * Realtime API support, using WebSockets. This will consist of documentation and support for using REST framework together with Django Channels, plus integrating WebSocket support into the client libraries. <del>* Better authentication defaults, possibly bringing JWT & CORs support into the core package. <add>* Better authentication defaults, possibly bringing JWT & CORS support into the core package. <ide> * Securing the community & operations manager position long-term. <ide> * Opening up and securing a part-time position to focus on ticket triage and resolution. <ide> * Paying for development time on building API client libraries in a range of programming languages. These would be integrated directly into the upcoming API documentation. <ide><path>docs/community/jobs.md <ide> Looking for a new Django REST Framework related role? On this site we provide a <ide> * [https://djangojobs.net/jobs/][django-jobs-net] <ide> * [https://findwork.dev/django-rest-framework-jobs][findwork-dev] <ide> * [https://www.indeed.com/q-Django-jobs.html][indeed-com] <del>* [https://stackoverflow.com/jobs/developer-jobs-using-django][stackoverflow-com] <add>* [https://stackoverflow.com/jobs/companies?tl=django][stackoverflow-com] <ide> * [https://www.upwork.com/o/jobs/browse/skill/django-framework/][upwork-com] <ide> * [https://www.technojobs.co.uk/django-jobs][technobjobs-co-uk] <ide> * [https://remoteok.io/remote-django-jobs][remoteok-io] <ide> Wonder how else you can help? One of the best ways you can help Django REST Fram <ide> [django-jobs-net]: https://djangojobs.net/jobs/ <ide> [findwork-dev]: https://findwork.dev/django-rest-framework-jobs <ide> [indeed-com]: https://www.indeed.com/q-Django-jobs.html <del>[stackoverflow-com]: https://stackoverflow.com/jobs/developer-jobs-using-django <add>[stackoverflow-com]: https://stackoverflow.com/jobs/companies?tl=django <ide> [upwork-com]: https://www.upwork.com/o/jobs/browse/skill/django-framework/ <ide> [technobjobs-co-uk]: https://www.technojobs.co.uk/django-jobs <ide> [remoteok-io]: https://remoteok.io/remote-django-jobs
2
Ruby
Ruby
prefer object/nil over `true`/`false`
bc8cc56a2ae0b73276782d66b7dceba1ecd294a2
<ide><path>activesupport/lib/active_support/message_verifier.rb <ide> def initialize(secret, options = {}) <ide> end <ide> <ide> def valid_message?(signed_message) <del> return false if signed_message.blank? <del> <add> return if signed_message.blank? <add> <ide> data, digest = signed_message.split("--") <ide> data.present? && digest.present? && ActiveSupport::SecurityUtils.secure_compare(digest, generate_digest(data)) <ide> end <ide> def verified(signed_message) <ide> data = signed_message.split("--")[0] <ide> @serializer.load(decode(data)) <ide> rescue ArgumentError => argument_error <del> return false if argument_error.message =~ %r{invalid base64} <add> return if argument_error.message =~ %r{invalid base64} <ide> raise <ide> end <del> else <del> false <ide> end <ide> end <del> <add> <ide> def verify(signed_message) <ide> verified(signed_message) || raise(InvalidSignature) <ide> end
1
PHP
PHP
fix edge case with using now() in query
c049fcb4fb95b2a3c604cec0095ad024c4d07ec7
<ide><path>tests/TestCase/ORM/QueryRegressionTest.php <ide> public function testFunctionInWhereClause() <ide> { <ide> $this->loadFixtures('Comments'); <ide> $table = $this->getTableLocator()->get('Comments'); <del> $table->updateAll(['updated' => Time::tomorrow()], ['id' => 6]); <add> $table->updateAll(['updated' => Time::now()->addDays(2)], ['id' => 6]); <ide> $query = $table->find(); <ide> $result = $query->where(['updated >' => $query->func()->now('datetime')])->first(); <ide> $this->assertSame(6, $result->id);
1
Ruby
Ruby
apply tests to new head format
458f9a008cc5316de9ec18ebae3b0f3990583540
<ide><path>Library/Homebrew/test/test_formula.rb <ide> def test_version_with_revision <ide> assert_equal PkgVersion.parse("1.0_1"), f.pkg_version <ide> end <ide> <del> def test_head_ignores_revisions <add> def test_head_uses_revisions <ide> f = formula("test", Pathname.new(__FILE__).expand_path, :head) do <ide> url "foo-1.0.bar" <ide> revision 1 <ide> head "foo" <ide> end <ide> <del> assert_equal PkgVersion.parse("HEAD"), f.pkg_version <add> assert_equal PkgVersion.parse("HEAD_1"), f.pkg_version <ide> end <ide> <ide> def test_legacy_options <ide><path>Library/Homebrew/test/test_pkg_version.rb <ide> def test_to_s <ide> assert_equal "1.0_1", PkgVersion.new(Version.new("1.0"), 1).to_s <ide> assert_equal "1.0", PkgVersion.new(Version.new("1.0"), 0).to_s <ide> assert_equal "1.0", PkgVersion.new(Version.new("1.0"), 0).to_s <del> assert_equal "HEAD", PkgVersion.new(Version.new("HEAD"), 1).to_s <add> assert_equal "HEAD_1", PkgVersion.new(Version.create("HEAD"), 1).to_s <add> assert_equal "HEAD-ffffff_1", PkgVersion.new(Version.create("HEAD-ffffff"), 1).to_s <ide> end <ide> <ide> def test_hash
2
Ruby
Ruby
fix missing dependency on hash#to_query
399d5338acdebd51648c8ed784e38e7a7c2d8867
<ide><path>actionpack/lib/action_controller/test_case.rb <ide> require 'rack/session/abstract/id' <ide> require 'active_support/core_ext/object/blank' <add>require 'active_support/core_ext/object/to_query' <ide> <ide> module ActionController <ide> module TemplateAssertions
1
Javascript
Javascript
use node_env to enable/disable opbeat frontend
73b8ba96afb85817cde55b35d0e00e93a4db5dd2
<ide><path>client/index.js <del>/* global __OPBEAT__ORG_ID __OPBEAT__APP_ID */ <ide> import initOpbeat from 'opbeat-react'; <ide> import { createOpbeatMiddleware } from 'opbeat-react/redux'; <ide> import Rx from 'rx'; <ide> import { <ide> saveToColdStorage <ide> } from './cold-reload'; <ide> <del>const localhostRE = /^(localhost|127.|0.)/; <del>const enableOpbeat = !localhostRE.test(window.location.hostname); <add>const { <add> __OPBEAT__ORG_ID, <add> __OPBEAT__APP_ID, <add> NODE_ENV <add>} = process.env; <add> <add>const enableOpbeat = NODE_ENV !== 'development'; <ide> <ide> if (enableOpbeat) { <ide> if (!__OPBEAT__ORG_ID || !__OPBEAT__APP_ID) { <ide><path>webpack.config.js <ide> module.exports = { <ide> plugins: [ <ide> new webpack.DefinePlugin({ <ide> 'process.env': { <del> NODE_ENV: JSON.stringify(__DEV__ ? 'development' : 'production') <add> NODE_ENV: JSON.stringify(__DEV__ ? 'development' : 'production'), <add> __OPBEAT__ORG_ID: JSON.stringify(process.env.OPBEAT_FRONTEND_ORG_ID), <add> __OPBEAT__APP_ID: JSON.stringify(process.env.OPBEAT_FRONTEND_APP_ID) <ide> }, <del> __DEVTOOLS__: !__DEV__, <del> __OPBEAT__ORG_ID: JSON.stringify(process.env.OPBEAT_FRONTEND_ORG_ID), <del> __OPBEAT__APP_ID: JSON.stringify(process.env.OPBEAT_FRONTEND_APP_ID) <add> __DEVTOOLS__: !__DEV__ <ide> }), <ide> // Use browser version of visionmedia-debug <ide> new webpack.NormalModuleReplacementPlugin(
2
PHP
PHP
update queue config with sqs example
96237d884e75c9fcadf945c9bf6516bf27c70b2e
<ide><path>app/config/queue.php <ide> | <ide> */ <ide> <del> 'default' => 'sync', <add> 'default' => 'sqs', <ide> <ide> /* <ide> |-------------------------------------------------------------------------- <ide> 'queue' => 'default', <ide> ), <ide> <add> 'sqs' => array( <add> 'driver' => 'sqs', <add> 'key' => 'your-public-key', <add> 'secret' => 'your-secret-key', <add> 'queue' => 'your-queue-url', <add> 'region' => 'us-east-1', <add> ), <add> <ide> ), <ide> <ide> ); <ide>\ No newline at end of file
1
Text
Text
add doc for starting ci job via label
d5e64952fe1697ba7d085ae75dc6839e5975ec59
<ide><path>doc/guides/collaborator-guide.md <ide> Copy/paste the URL for the job into a comment in the pull request. <ide> [`node-test-pull-request`](https://ci.nodejs.org/job/node-test-pull-request/) <ide> is an exception where the GitHub bot will automatically post for you. <ide> <add>The [`node-test-pull-request`](https://ci.nodejs.org/job/node-test-pull-request/) <add>CI job can be started by adding the `request-ci` label into the pull request. <add>Once this label is added, `github-actions bot` will start <add>the `node-test-pull-request` automatically. If the `github-actions bot` <add>is unable to start the job, it will update the label with `request-ci-failed`. <add> <ide> ### Internal vs. public API <ide> <ide> All functionality in the official Node.js documentation is part of the public
1
Javascript
Javascript
remove use of hastemap class
a435fbcbd1cb984ea67a21401ffb11d97d548a76
<ide><path>packager/src/node-haste/index.js <ide> <ide> const Cache = require('./Cache'); <ide> const DependencyGraphHelpers = require('./DependencyGraph/DependencyGraphHelpers'); <del>const HasteMap = require('./DependencyGraph/HasteMap'); <ide> const JestHasteMap = require('jest-haste-map'); <ide> const Module = require('./Module'); <ide> const ModuleCache = require('./ModuleCache'); <ide> import type { <ide> } from './Module'; <ide> import type {HasteFS} from './types'; <ide> <del>const ERROR_BUILDING_DEP_GRAPH = 'DependencyGraphError'; <del> <ide> type Options = { <ide> assetDependencies: Array<string>, <ide> assetExts: Array<string>, <ide> class DependencyGraph extends EventEmitter { <ide> _opts: Options; <ide> _haste: JestHasteMap; <ide> _hasteFS: HasteFS; <del> _hasteMap: HasteMap; <del> _hasteMapError: ?Error; <ide> _helpers: DependencyGraphHelpers; <ide> _moduleCache: ModuleCache; <ide> _moduleMap: ModuleMap; <ide> class DependencyGraph extends EventEmitter { <ide> this._loading = this._haste.build().then(({hasteFS, moduleMap}) => { <ide> this._hasteFS = hasteFS; <ide> this._moduleMap = moduleMap; <del> const hasteFSFiles = hasteFS.getAllFiles(); <ide> <ide> this._moduleCache = new ModuleCache({ <ide> cache: this._opts.cache, <ide> class DependencyGraph extends EventEmitter { <ide> }, <ide> }, this._opts.platforms); <ide> <del> this._hasteMap = new HasteMap({ <del> files: hasteFSFiles, <del> extensions: this._opts.extensions, <del> moduleCache: this._moduleCache, <del> preferNativePlatform: this._opts.preferNativePlatform, <del> helpers: this._helpers, <del> platforms: this._opts.platforms, <del> }); <del> <ide> this._haste.on('change', event => { <ide> this._hasteFS = event.hasteFS; <ide> this._moduleMap = event.moduleMap; <ide> event.eventsQueue.forEach(({type, filePath, stat}) => <del> this._onFileChange(type, filePath, stat) <add> this._moduleCache.processFileChange(type, filePath, stat) <ide> ); <ide> this.emit('change'); <ide> }); <ide> <del> const buildingHasteMapLogEntry = <del> log(createActionStartEntry('Building Haste Map')); <add> log(createActionEndEntry(initializingPackagerLogEntry)); <add> this._opts.reporter.update({type: 'dep_graph_loaded'}); <ide> <del> return this._hasteMap.build().then( <del> map => { <del> log(createActionEndEntry(buildingHasteMapLogEntry)); <del> log(createActionEndEntry(initializingPackagerLogEntry)); <del> this._opts.reporter.update({type: 'dep_graph_loaded'}); <del> }, <del> err => { <del> const error = new Error( <del> `Failed to build DependencyGraph: ${err.message}` <del> ); <del> /* $FlowFixMe: monkey-patching */ <del> error.type = ERROR_BUILDING_DEP_GRAPH; <del> error.stack = err.stack; <del> throw error; <del> } <del> ); <ide> }); <ide> <ide> return this._loading; <ide> class DependencyGraph extends EventEmitter { <ide> ); <ide> } <ide> <del> _onFileChange(type: string, filePath: string, stat: Object) { <del> this._moduleCache.processFileChange(type, filePath, stat); <del> <del> // This code reports failures but doesn't block recovery in the dev server <del> // mode. When the hasteMap is left in an incorrect state, we'll rebuild when <del> // the next file changes. <del> const resolve = () => { <del> if (this._hasteMapError) { <del> console.warn( <del> 'Rebuilding haste map to recover from error:\n' + <del> this._hasteMapError.stack <del> ); <del> this._hasteMapError = null; <del> <del> // Rebuild the entire map if last change resulted in an error. <del> this._loading = this._hasteMap.build().then(() => {}); <del> } else { <del> this._loading = this._hasteMap.processFileChange(type, filePath); <del> this._loading.catch(error => { <del> this._hasteMapError = error; <del> }); <del> } <del> return this._loading; <del> }; <del> <del> this._loading = this._loading.then(resolve, resolve); <del> } <del> <ide> createPolyfill(options: {file: string}) { <ide> return this._moduleCache.createPolyfill(options); <ide> }
1
Text
Text
match text with translation file example
c41576ea45c4b092c6dd105ec6bb1b9c8830016e
<ide><path>guides/source/i18n.md <ide> en: <ide> long: "%B %d, %Y" <ide> ``` <ide> <del>So, all of the following equivalent lookups will return the `:short` date format `"%B %d"`: <add>So, all of the following equivalent lookups will return the `:short` date format `"%b %d"`: <ide> <ide> ```ruby <ide> I18n.t 'date.formats.short'
1
Javascript
Javascript
add test case for process.dlopen with undefined
2355c843ba935323a160bf44da33ccf756086f97
<ide><path>test/parallel/test-process-dlopen-undefined-exports.js <add>'use strict'; <add> <add>require('../common'); <add>const assert = require('assert'); <add> <add>const someBindingPath = './test/addons/hello-world/build/Release/binding.node'; <add> <add>assert.throws(() => { <add> process.dlopen({ exports: undefined }, someBindingPath); <add>}, Error);
1
Text
Text
fix spelling in changelog
f0a8bc3f8411c469a7d80244b843446dfd759a36
<ide><path>CHANGELOG.md <ide> See https://github.com/nodejs/io.js/labels/confirmed-bug for complete and curren <ide> Full details at https://github.com/nodejs/io.js/wiki/Breaking-Changes#200-from-1x <ide> <ide> * V8 upgrade to 4.2, minor changes to C++ API <del>* `os.tmpdir()` is now cross-platform consistent and will no longer returns a path with a trailling slash on any platform <add>* `os.tmpdir()` is now cross-platform consistent and no longer returns a path with a trailing slash on any platform <ide> * While not a *breaking change* the 'smalloc' module has been deprecated in anticipation of it becoming unsupportable with a future upgrade to V8 4.4. See [#1451](https://github.com/nodejs/io.js/issues/1451) for further information. <ide> <ide> _Note: a new version of the 'url' module was reverted prior to release as it was decided the potential for breakage across the npm ecosystem was too great and that more compatibility work needed to be done before releasing it. See [#1602](https://github.com/nodejs/io.js/pull/1602) for further information._
1
Javascript
Javascript
use buffer.from instead of new buffer
7f303e5260734c118005fec331d2ef7e650426af
<ide><path>lib/Compiler.js <ide> class Compiler extends Tapable { <ide> let content = source.source(); <ide> <ide> if(!Buffer.isBuffer(content)) { <del> content = new Buffer(content, "utf8"); // eslint-disable-line <add> content = Buffer.from(content, "utf8"); <ide> } <ide> <ide> source.existsAt = targetPath; <ide><path>lib/EvalSourceMapDevToolModuleTemplatePlugin.js <ide> class EvalSourceMapDevToolModuleTemplatePlugin { <ide> sourceMap.sourceRoot = options.sourceRoot || ""; <ide> sourceMap.file = `${module.id}.js`; <ide> <del> const footer = self.sourceMapComment.replace(/\[url\]/g, `data:application/json;charset=utf-8;base64,${new Buffer(JSON.stringify(sourceMap), "utf8").toString("base64")}`) + //eslint-disable-line <add> const footer = self.sourceMapComment.replace(/\[url\]/g, `data:application/json;charset=utf-8;base64,${Buffer.from(JSON.stringify(sourceMap), "utf8").toString("base64")}`) + <ide> `\n//# sourceURL=webpack-internal:///${module.id}\n`; // workaround for chrome bug <ide> source.__EvalSourceMapDevToolData = new RawSource(`eval(${JSON.stringify(content + footer)});`); <ide> return source.__EvalSourceMapDevToolData; <ide><path>lib/NormalModule.js <ide> const asString = (buf) => { <ide> <ide> const asBuffer = str => { <ide> if(!Buffer.isBuffer(str)) { <del> return new Buffer(str, "utf-8"); // eslint-disable-line <add> return Buffer.from(str, "utf-8"); <ide> } <ide> return str; <ide> }; <ide><path>lib/SourceMapDevToolPlugin.js <ide> class SourceMapDevToolPlugin { <ide> } else { <ide> asset.__SourceMapDevToolData[file] = compilation.assets[file] = new ConcatSource(new RawSource(source), currentSourceMappingURLComment <ide> .replace(/\[map\]/g, () => sourceMapString) <del> .replace(/\[url\]/g, () => `data:application/json;charset=utf-8;base64,${new Buffer(sourceMapString, "utf-8").toString("base64")}`) // eslint-disable-line <add> .replace(/\[url\]/g, () => `data:application/json;charset=utf-8;base64,${Buffer.from(sourceMapString, "utf-8").toString("base64")}`) <ide> ); <ide> } <ide> }); <ide><path>lib/optimize/ConcatenatedModule.js <ide> class ConcatenatedModule extends Module { <ide> exportName = true; <ide> } else { <ide> const exportData = match[2]; <del> exportName = new Buffer(exportData, "hex").toString("utf-8"); // eslint-disable-line node/no-deprecated-api <add> exportName = Buffer.from(exportData, "hex").toString("utf-8"); <ide> } <ide> const asCall = !!match[3]; <ide> const strictHarmonyModule = !!match[4]; <ide> class HarmonyImportSpecifierDependencyConcatenatedTemplate { <ide> } else if(dep.namespaceObjectAsContext) { <ide> content = `__WEBPACK_MODULE_REFERENCE__${info.index}_ns${strictFlag}__[${JSON.stringify(dep.id)}]`; <ide> } else { <del> const exportData = new Buffer(dep.id, "utf-8").toString("hex"); // eslint-disable-line node/no-deprecated-api <add> const exportData = Buffer.from(dep.id, "utf-8").toString("hex"); <ide> content = `__WEBPACK_MODULE_REFERENCE__${info.index}_${exportData}${callFlag}${strictFlag}__`; <ide> } <ide> if(dep.shorthand) { <ide> class HarmonyExportImportedSpecifierDependencyConcatenatedTemplate { <ide> if(def.id === true) { <ide> finalName = `__WEBPACK_MODULE_REFERENCE__${info.index}_ns${strictFlag}__`; <ide> } else { <del> const exportData = new Buffer(def.id, "utf-8").toString("hex"); // eslint-disable-line node/no-deprecated-api <add> const exportData = Buffer.from(def.id, "utf-8").toString("hex"); <ide> finalName = `__WEBPACK_MODULE_REFERENCE__${info.index}_${exportData}${strictFlag}__`; <ide> } <ide> const exportsName = this.rootModule.exportsArgument;
5
PHP
PHP
improve error message for missing shells
bb153ca1074f5b7228c6526d6a90724d75221494
<ide><path>src/Console/Exception/MissingShellException.php <ide> class MissingShellException extends Exception <ide> { <ide> <del> protected $_messageTemplate = 'Shell class for "%s" could not be found.'; <add> protected $_messageTemplate = 'Shell class for "%s" could not be found. If you are trying to use a plugin shell, that was loaded via $this->addPlugin(), you may need to update bin/cake.php to match https://github.com/cakephp/app/tree/master/bin/cake.php'; <ide> }
1
Javascript
Javascript
add missing resizemode prop on image android
f634a0fc2388a34774d9e7dceb0890535c6f7a29
<ide><path>Libraries/Image/Image.android.js <ide> var Image = React.createClass({ <ide> * Used to locate this view in end-to-end tests. <ide> */ <ide> testID: PropTypes.string, <add> /** <add> * Determines how to resize the image when the frame doesn't match the raw <add> * image dimensions. <add> * <add> * 'cover': Scale the image uniformly (maintain the image's aspect ratio) <add> * so that both dimensions (width and height) of the image will be equal <add> * to or larger than the corresponding dimension of the view (minus padding). <add> * <add> * 'contain': Scale the image uniformly (maintain the image's aspect ratio) <add> * so that both dimensions (width and height) of the image will be equal to <add> * or less than the corresponding dimension of the view (minus padding). <add> * <add> * 'stretch': Scale width and height independently, This may change the <add> * aspect ratio of the src. <add> */ <add> resizeMode: PropTypes.oneOf(['cover', 'contain', 'stretch']), <ide> }, <ide> <ide> statics: {
1
Python
Python
handle empty eval results in estimator_benchmark.
7ac267a82d8078bbae58fac87021ed6e4f0e8eb3
<ide><path>official/resnet/estimator_benchmark.py <ide> def _report_benchmark(self, <ide> 'value': exp_per_sec}) <ide> flags_str = flags_core.get_nondefault_flags_as_str() <ide> self.report_benchmark( <del> iters=eval_results['global_step'], <add> iters=eval_results.get('global_step', None), <ide> wall_time=wall_time_sec, <ide> metrics=metrics, <ide> extras={'flags': flags_str}) <ide> def _run_and_report_benchmark(self): <ide> wall_time_sec = time.time() - start_time_sec <ide> print(stats) <ide> # Remove values to skip triggering accuracy check. <del> del stats['eval_results']['accuracy'] <del> del stats['eval_results']['accuracy_top_5'] <add> stats['eval_results'].pop('accuracy', None) <add> stats['eval_results'].pop('accuracy_top_5', None) <ide> <ide> self._report_benchmark(stats, <ide> wall_time_sec)
1
Python
Python
improve tests by designating dtype of sample data
b13326498e7cf7338a397f93a75248509256adc3
<ide><path>keras/utils/np_utils.py <ide> def to_categorical(y, num_classes=None): <ide> if not num_classes: <ide> num_classes = np.max(y) + 1 <ide> n = y.shape[0] <del> categorical = np.zeros((n, num_classes)) <add> categorical = np.zeros((n, num_classes), dtype=np.float32) <ide> categorical[np.arange(n), y] = 1 <ide> output_shape = input_shape + (num_classes,) <ide> categorical = np.reshape(categorical, output_shape) <ide><path>keras/utils/test_utils.py <ide> def get_test_data(num_train=1000, num_test=500, input_shape=(10,), <ide> samples = num_train + num_test <ide> if classification: <ide> y = np.random.randint(0, num_classes, size=(samples,)) <del> X = np.zeros((samples,) + input_shape) <add> X = np.zeros((samples,) + input_shape, dtype=np.float32) <ide> for i in range(samples): <ide> X[i] = np.random.normal(loc=y[i], scale=0.7, size=input_shape) <ide> else: <ide> y_loc = np.random.random((samples,)) <del> X = np.zeros((samples,) + input_shape) <del> y = np.zeros((samples,) + output_shape) <add> X = np.zeros((samples,) + input_shape, dtype=np.float32) <add> y = np.zeros((samples,) + output_shape, dtype=np.float32) <ide> for i in range(samples): <ide> X[i] = np.random.normal(loc=y_loc[i], scale=0.7, size=input_shape) <ide> y[i] = np.random.normal(loc=y_loc[i], scale=0.7, size=output_shape)
2
Text
Text
adjust readme and release notes
2aa33ed54460f016c157cbf13e7e122b7040704b
<ide><path>README.md <ide> There is a live example API for testing purposes, [available here][sandbox]. <ide> # Requirements <ide> <ide> * Python (2.6.5+, 2.7, 3.2, 3.3, 3.4) <del>* Django (1.5.6+, 1.6.3+, 1.7, 1.8) <add>* Django (1.6.3+, 1.7, 1.8) <ide> <ide> # Installation <ide> <ide><path>docs/topics/release-notes.md <ide> You can determine your currently installed version using `pip freeze`: <ide> <ide> --- <ide> <add>## 3.3.x series <add> <add>### 3.0.0 <add> <add>**Date**: NOT YET RELEASED <add> <add>* Removed support for Django Version 1.5 ([#3421][gh3421]) <add> <ide> ## 3.2.x series <ide> <ide> ### 3.2.3 <ide> For older release notes, [please see the version 2.x documentation][old-release- <ide> [gh3321]: https://github.com/tomchristie/django-rest-framework/issues/3321 <ide> <ide> <del> <add><!-- 3.0.0 --> <add>[gh3421]: https://github.com/tomchristie/django-rest-framework/pulls/3421 <ide>
2
Javascript
Javascript
prefer window.getselection for ie
e7299f60393f95b346285181c6ca8e09d8edea1b
<ide><path>src/browser/eventPlugins/SelectEventPlugin.js <ide> function getSelection(node) { <ide> start: node.selectionStart, <ide> end: node.selectionEnd <ide> }; <add> } else if (window.getSelection) { <add> var selection = window.getSelection(); <add> return { <add> anchorNode: selection.anchorNode, <add> anchorOffset: selection.anchorOffset, <add> focusNode: selection.focusNode, <add> focusOffset: selection.focusOffset <add> }; <ide> } else if (document.selection) { <ide> var range = document.selection.createRange(); <ide> return { <ide> function getSelection(node) { <ide> top: range.boundingTop, <ide> left: range.boundingLeft <ide> }; <del> } else { <del> var selection = window.getSelection(); <del> return { <del> anchorNode: selection.anchorNode, <del> anchorOffset: selection.anchorOffset, <del> focusNode: selection.focusNode, <del> focusOffset: selection.focusOffset <del> }; <ide> } <ide> } <ide>
1
Javascript
Javascript
remove ie8 testswarm hacks for offset
3478cbb4d4f59473512891a6ba83158d47f26bf1
<ide><path>test/unit/offset.js <ide> testIframe("offset/relative", "relative", function( $ ) { <ide> testIframe("offset/static", "static", function( $ ) { <ide> <ide> // IE is collapsing the top margin of 1px; detect and adjust accordingly <del> var ie = $("#static-1").offset().top === 6, <del> swarmy = document.documentMode === 8 && window.location.search.indexOf("swarmURL") >= 0; <add> var ie = $("#static-1").offset().top === 6; <ide> <del> expect( swarmy? 68 : 80 ); <add> expect( 80 ); <ide> <ide> // get offset <ide> var tests = [ <ide> { "id": "#static-1", "top": ie ? 6 : 7, "left": 7 }, <ide> { "id": "#static-1-1", "top": ie ? 13 : 15, "left": 15 }, <del> { "id": "#static-1-1-1", "top": ie ? 20 : 23, "left": 23 } <add> { "id": "#static-1-1-1", "top": ie ? 20 : 23, "left": 23 }, <add> { "id": "#static-2", "top": ie ? 121 : 122, left: 7 } <ide> ]; <del> if ( !swarmy ) { <del> tests.push({ "id": "#static-2", "top": ie ? 121 : 122, left: 7 }); <del> } <ide> jQuery.each( tests, function() { <ide> equal( $( this["id"] ).offset().top, this["top"], "jQuery('" + this["id"] + "').offset().top" ); <ide> equal( $( this["id"] ).offset().left, this["left"], "jQuery('" + this["id"] + "').offset().left" ); <ide> testIframe("offset/static", "static", function( $ ) { <ide> tests = [ <ide> { "id": "#static-1", "top": ie ? 5 : 6, "left": 6 }, <ide> { "id": "#static-1-1", "top": ie ? 12 : 14, "left": 14 }, <del> { "id": "#static-1-1-1", "top": ie ? 19 : 22, "left": 22 } <del> <add> { "id": "#static-1-1-1", "top": ie ? 19 : 22, "left": 22 }, <add> { "id": "#static-2", "top": ie ? 120 : 121, "left": 6 } <ide> ]; <del> if ( !swarmy ) { <del> tests.push({ "id": "#static-2", "top": ie ? 120 : 121, "left": 6 }); <del> } <ide> jQuery.each( tests, function() { <ide> equal( $( this["id"] ).position().top, this["top"], "jQuery('" + this["top"] + "').position().top" ); <ide> equal( $( this["id"] ).position().left, this["left"], "jQuery('" + this["left"] +"').position().left" ); <ide> testIframe("offset/static", "static", function( $ ) { <ide> { "id": "#static-1-1", "top": -3, "left": -3 }, <ide> { "id": "#static-1-1", "top": 14, "left": 14 }, <ide> { "id": "#static-1", "top": 30, "left": 30 }, <del> { "id": "#static-1", "top": 2, "left": 2 } <del> <add> { "id": "#static-1", "top": 2, "left": 2 }, <add> { "id": "#static-1", "top": -2, "left": -2 }, <add> { "id": "#static-1", "top": 7, "left": 7 } <ide> ]; <del> if ( !swarmy ) { <del> tests.push( <del> { "id": "#static-1", "top": -2, "left": -2 }, <del> { "id": "#static-1", "top": 7, "left": 7 } <del> ); <del> } <ide> jQuery.each( tests, function() { <ide> $( this["id"] ).offset({ "top": this["top"], "left": this["left"] }); <ide> equal( $( this["id"] ).offset().top, this["top"], "jQuery('" + this["id"] + "').offset({ top: " + this["top"] + " })" );
1
Go
Go
improve handling of rootlesskit_parent_euid
aa4dce742fca6bebe8254a9309364e2cd8f5d76c
<ide><path>daemon/daemon_unix.go <ide> func (daemon *Daemon) setupSeccompProfile() error { <ide> <ide> // RawSysInfo returns *sysinfo.SysInfo . <ide> func (daemon *Daemon) RawSysInfo(quiet bool) *sysinfo.SysInfo { <del> var opts []sysinfo.Opt <add> var siOpts []sysinfo.Opt <ide> if daemon.getCgroupDriver() == cgroupSystemdDriver { <del> rootlesskitParentEUID := os.Getenv("ROOTLESSKIT_PARENT_EUID") <del> if rootlesskitParentEUID != "" { <del> groupPath := fmt.Sprintf("/user.slice/user-%s.slice", rootlesskitParentEUID) <del> opts = append(opts, sysinfo.WithCgroup2GroupPath(groupPath)) <add> if euid := os.Getenv("ROOTLESSKIT_PARENT_EUID"); euid != "" { <add> siOpts = append(siOpts, sysinfo.WithCgroup2GroupPath("/user.slice/user-"+euid+".slice")) <ide> } <ide> } <del> return sysinfo.New(quiet, opts...) <add> return sysinfo.New(quiet, siOpts...) <ide> } <ide> <ide> func recursiveUnmount(target string) error { <ide><path>daemon/oci_linux.go <ide> func WithRootless(daemon *Daemon) coci.SpecOpts { <ide> if rootlesskitParentEUID == "" { <ide> return errors.New("$ROOTLESSKIT_PARENT_EUID is not set (requires RootlessKit v0.8.0)") <ide> } <del> controllersPath := fmt.Sprintf("/sys/fs/cgroup/user.slice/user-%s.slice/cgroup.controllers", rootlesskitParentEUID) <add> euid, err := strconv.Atoi(rootlesskitParentEUID) <add> if err != nil { <add> return errors.Wrap(err, "invalid $ROOTLESSKIT_PARENT_EUID: must be a numeric value") <add> } <add> controllersPath := fmt.Sprintf("/sys/fs/cgroup/user.slice/user-%d.slice/cgroup.controllers", euid) <ide> controllersFile, err := ioutil.ReadFile(controllersPath) <ide> if err != nil { <ide> return err
2
Ruby
Ruby
initialize deprecators before configuring them
3d6a7b2faab61305fc4c8d84780c4d48483464b5
<ide><path>actioncable/lib/action_cable/engine.rb <ide> class Engine < Rails::Engine # :nodoc: <ide> config.action_cable.mount_path = ActionCable::INTERNAL[:default_mount_path] <ide> config.action_cable.precompile_assets = true <ide> <del> initializer "action_cable.deprecator" do |app| <add> initializer "action_cable.deprecator", before: :load_environment_config do |app| <ide> app.deprecators[:action_cable] = ActionCable.deprecator <ide> end <ide> <ide><path>actionmailbox/lib/action_mailbox/engine.rb <ide> class Engine < Rails::Engine <ide> <ide> config.action_mailbox.storage_service = nil <ide> <del> initializer "action_mailbox.deprecator" do |app| <add> initializer "action_mailbox.deprecator", before: :load_environment_config do |app| <ide> app.deprecators[:action_mailbox] = ActionMailbox.deprecator <ide> end <ide> <ide><path>actionmailer/lib/action_mailer/railtie.rb <ide> class Railtie < Rails::Railtie # :nodoc: <ide> config.action_mailer.preview_paths = [] <ide> config.eager_load_namespaces << ActionMailer <ide> <del> initializer "action_mailer.deprecator" do |app| <add> initializer "action_mailer.deprecator", before: :load_environment_config do |app| <ide> app.deprecators[:action_mailer] = ActionMailer.deprecator <ide> end <ide> <ide><path>actionpack/lib/action_controller/railtie.rb <ide> class Railtie < Rails::Railtie # :nodoc: <ide> config.eager_load_namespaces << AbstractController <ide> config.eager_load_namespaces << ActionController <ide> <del> initializer "action_controller.deprecator" do |app| <add> initializer "action_controller.deprecator", before: :load_environment_config do |app| <ide> app.deprecators[:action_controller] = ActionController.deprecator <ide> end <ide> <ide><path>actionpack/lib/action_dispatch/railtie.rb <ide> class Railtie < Rails::Railtie # :nodoc: <ide> <ide> config.eager_load_namespaces << ActionDispatch <ide> <del> initializer "action_dispatch.deprecator" do |app| <add> initializer "action_dispatch.deprecator", before: :load_environment_config do |app| <ide> app.deprecators[:action_dispatch] = ActionDispatch.deprecator <ide> end <ide> <ide><path>actiontext/lib/action_text/engine.rb <ide> class Engine < Rails::Engine <ide> #{root}/app/models <ide> ) <ide> <del> initializer "action_text.deprecator" do |app| <add> initializer "action_text.deprecator", before: :load_environment_config do |app| <ide> app.deprecators[:action_text] = ActionText.deprecator <ide> end <ide> <ide><path>actionview/lib/action_view/railtie.rb <ide> class Railtie < Rails::Engine # :nodoc: <ide> end <ide> end <ide> <del> initializer "action_view.deprecator" do |app| <add> initializer "action_view.deprecator", before: :load_environment_config do |app| <ide> app.deprecators[:action_view] = ActionView.deprecator <ide> end <ide> <ide><path>activejob/lib/active_job/railtie.rb <ide> class Railtie < Rails::Railtie # :nodoc: <ide> config.active_job.custom_serializers = [] <ide> config.active_job.log_query_tags_around_perform = true <ide> <del> initializer "active_job.deprecator" do |app| <add> initializer "active_job.deprecator", before: :load_environment_config do |app| <ide> app.deprecators[:active_job] = ActiveJob.deprecator <ide> end <ide> <ide><path>activemodel/lib/active_model/railtie.rb <ide> class Railtie < Rails::Railtie # :nodoc: <ide> <ide> config.active_model = ActiveSupport::OrderedOptions.new <ide> <del> initializer "active_model.deprecator" do |app| <add> initializer "active_model.deprecator", before: :load_environment_config do |app| <ide> app.deprecators[:active_model] = ActiveModel.deprecator <ide> end <ide> <ide><path>activerecord/lib/active_record/railtie.rb <ide> class Railtie < Rails::Railtie # :nodoc: <ide> require "active_record/base" <ide> end <ide> <del> initializer "active_record.deprecator" do |app| <add> initializer "active_record.deprecator", before: :load_environment_config do |app| <ide> app.deprecators[:active_record] = ActiveRecord.deprecator <ide> end <ide> <ide><path>activestorage/lib/active_storage/engine.rb <ide> class Engine < Rails::Engine # :nodoc: <ide> <ide> config.eager_load_namespaces << ActiveStorage <ide> <del> initializer "active_storage.deprecator" do |app| <add> initializer "active_storage.deprecator", before: :load_environment_config do |app| <ide> app.deprecators[:active_storage] = ActiveStorage.deprecator <ide> end <ide> <ide><path>activesupport/lib/active_support/railtie.rb <ide> class Railtie < Rails::Railtie # :nodoc: <ide> <ide> config.eager_load_namespaces << ActiveSupport <ide> <del> initializer "active_support.deprecator" do |app| <add> initializer "active_support.deprecator", before: :load_environment_config do |app| <ide> app.deprecators[:active_support] = ActiveSupport.deprecator <ide> end <ide>
12
Javascript
Javascript
fix typo in _http-benchmarkers.js
d8965d5b0ec57d628e11bba17d0ff14aad28bf78
<ide><path>benchmark/_http-benchmarkers.js <ide> exports.run = function(options, callback) { <ide> const result = benchmarker.processResults(stdout); <ide> if (result === undefined) { <ide> callback(new Error( <del> `${options.benchmarker} produced strange output: ${stdout}`, code)); <add> `${options.benchmarker} produced strange output: ${stdout}`), code); <ide> return; <ide> } <ide>
1
Python
Python
fix tf 2.0 tf.data api usage
1577ed076cab2d38be4885a1b0678756f7aacd8b
<ide><path>official/recommendation/data_test.py <ide> def drain_dataset(self, dataset, g): <ide> # type: (tf.data.Dataset, tf.Graph) -> list <ide> with self.session(graph=g) as sess: <ide> with g.as_default(): <del> batch = dataset.make_one_shot_iterator().get_next() <add> batch = tf.compat.v1.data.make_one_shot_iterator(dataset).get_next() <ide> output = [] <ide> while True: <ide> try:
1
PHP
PHP
fix error code
cec1b1bf947ce47a2c218a37544dff2b24635db2
<ide><path>app/Exceptions/Handler.php <ide> protected function invalid($request, ValidationException $exception) <ide> $errors = $exception->validator->errors()->messages(); <ide> <ide> return $request->expectsJson() <del> ? response()->json(['message' => $exception->getMessage(), 'errors' => $errors]) <add> ? response()->json(['message' => $exception->getMessage(), 'errors' => $errors], 422) <ide> : redirect()->back()->withInput()->withErrors( <ide> $errors, $exception->errorBag <ide> );
1
Python
Python
remove forgotten log message
8fc5bbf9fef7af5e4bf90d08bd7c5bae0a327815
<ide><path>glances/plugins/glances_sensors.py <ide> def get(self, type='temperature_core'): <ide> """Get sensors list.""" <ide> self.__update__() <ide> if type == 'temperature_core': <del> logger.info(type) <ide> ret = [s for s in self.sensors_list if s['unit'] == SENSOR_TEMP_UNIT] <ide> elif type == 'fan_speed': <del> logger.info(type) <ide> ret = [s for s in self.sensors_list if s['unit'] == SENSOR_FAN_UNIT] <ide> else: <ide> # Unknown type <ide> logger.debug("Unknown sensor type %s" % type) <ide> ret = [] <del> logger.info(ret) <ide> return ret <ide> <ide> def quit(self):
1
Python
Python
add comment explaining _block_dispatcher
024c728ef42d12a2bf10ce3b44791301c4d66f80
<ide><path>numpy/core/shape_base.py <ide> def _block(arrays, max_depth, result_ndim, depth=0): <ide> <ide> <ide> def _block_dispatcher(arrays): <add> # Use type(...) is list to match the behavior of np.block(), which special <add> # cases list specifically rather than allowing for generic iterables or <add> # tuple. Also, we know that list.__array_function__ will never exist. <ide> if type(arrays) is list: <ide> for subarrays in arrays: <ide> for subarray in _block_dispatcher(subarrays):
1
Javascript
Javascript
upgrade dllmodulefactory to es6
af1b2fc8e211722a2b5d512b10521015b2c53be0
<ide><path>lib/DllModuleFactory.js <ide> MIT License http://www.opensource.org/licenses/mit-license.php <ide> Author Tobias Koppers @sokra <ide> */ <add>"use strict"; <add> <ide> var Tapable = require("tapable"); <ide> var DllModule = require("./DllModule"); <ide> <del>function DllModuleFactory() { <del> Tapable.call(this); <add>class DllModuleFactory extends Tapable { <add> constructor() { <add> super(); <add> } <add> create(data, callback) { <add> let dependency = data.dependencies[0]; <add> callback(null, new DllModule(data.context, dependency.dependencies, dependency.name, dependency.type)); <add> } <ide> } <del>module.exports = DllModuleFactory; <ide> <del>DllModuleFactory.prototype = Object.create(Tapable.prototype); <del>DllModuleFactory.prototype.constructor = DllModuleFactory; <del> <del>DllModuleFactory.prototype.create = function(data, callback) { <del> var dependency = data.dependencies[0]; <del> callback(null, new DllModule(data.context, dependency.dependencies, dependency.name, dependency.type)); <del>}; <add>module.exports = DllModuleFactory;
1
Python
Python
add test cases for it
cf884251d98f7a67a5b35055caa4108500dbc654
<ide><path>libcloud/test/storage/test_azure_blobs.py <ide> <ide> import os <ide> import sys <del>import unittest <ide> import tempfile <ide> from io import BytesIO <ide> <ide> from libcloud.utils.py3 import httplib <ide> from libcloud.utils.py3 import urlparse <ide> from libcloud.utils.py3 import parse_qs <ide> from libcloud.utils.py3 import b <add>from libcloud.utils.py3 import basestring <ide> <ide> from libcloud.common.types import InvalidCredsError <ide> from libcloud.common.types import LibcloudError <ide> from libcloud.storage.drivers.azure_blobs import AZURE_BLOCK_MAX_SIZE <ide> from libcloud.storage.drivers.azure_blobs import AZURE_PAGE_CHUNK_SIZE <ide> <add>from libcloud.test import unittest <ide> from libcloud.test import MockHttp, generate_random_data # pylint: disable-msg=E0611 <ide> from libcloud.test.file_fixtures import StorageFileFixtures # pylint: disable-msg=E0611 <ide> from libcloud.test.secrets import STORAGE_AZURE_BLOBS_PARAMS <ide> <ide> <del>class AzureBlobsMockHttp(MockHttp): <add>class AzureBlobsMockHttp(MockHttp, unittest.TestCase): <ide> <ide> fixtures = StorageFileFixtures('azure_blobs') <ide> base_headers = {} <ide> def _foo_bar_container_foo_bar_object_DELETE(self, method, url, body, headers): <ide> <ide> def _foo_bar_container_foo_test_upload(self, method, url, body, headers): <ide> # test_upload_object_success <add> self._assert_content_length_header_is_string(headers=headers) <add> <ide> body = '' <ide> headers = {} <ide> headers['etag'] = '0x8CFB877BB56A6FB' <ide> def _foo_bar_container_foo_test_upload(self, method, url, body, headers): <ide> def _foo_bar_container_foo_test_upload_block(self, method, url, <ide> body, headers): <ide> # test_upload_object_success <add> self._assert_content_length_header_is_string(headers=headers) <add> <ide> body = '' <ide> headers = {} <ide> headers['etag'] = '0x8CFB877BB56A6FB' <ide> def _foo_bar_container_foo_test_upload_page(self, method, url, <ide> def _foo_bar_container_foo_test_upload_blocklist(self, method, url, <ide> body, headers): <ide> # test_upload_object_success <add> self._assert_content_length_header_is_string(headers=headers) <add> <ide> body = '' <ide> headers = {} <ide> headers['etag'] = '0x8CFB877BB56A6FB' <ide> def _foo_bar_container_foo_test_upload_blocklist(self, method, url, <ide> def _foo_bar_container_foo_test_upload_lease(self, method, url, <ide> body, headers): <ide> # test_upload_object_success <add> self._assert_content_length_header_is_string(headers=headers) <add> <ide> action = headers['x-ms-lease-action'] <ide> rheaders = {'x-ms-lease-id': 'someleaseid'} <ide> body = '' <ide> def _foo_bar_container_foo_test_upload_lease(self, method, url, <ide> <ide> def _foo_bar_container_foo_test_upload_INVALID_HASH(self, method, url, <ide> body, headers): <add> # test_upload_object_invalid_hash1 <add> self._assert_content_length_header_is_string(headers=headers) <add> <ide> body = '' <ide> headers = {} <ide> headers['etag'] = '0x8CFB877BB56A6FB' <ide> headers['content-md5'] = 'd4fe4c9829f7ca1cc89db7ad670d2bbd' <ide> <del> # test_upload_object_invalid_hash1 <ide> return (httplib.CREATED, <ide> body, <ide> headers, <ide> httplib.responses[httplib.CREATED]) <ide> <ide> def _foo_bar_container_foo_bar_object(self, method, url, body, headers): <ide> # test_upload_object_invalid_file_size <add> self._assert_content_length_header_is_string(headers=headers) <add> <ide> body = generate_random_data(1000) <ide> return (httplib.OK, <ide> body, <ide> def _foo_bar_container_foo_bar_object(self, method, url, body, headers): <ide> def _foo_bar_container_foo_bar_object_INVALID_SIZE(self, method, url, <ide> body, headers): <ide> # test_upload_object_invalid_file_size <add> self._assert_content_length_header_is_string(headers=headers) <add> <ide> body = '' <ide> return (httplib.OK, <ide> body, <ide> headers, <ide> httplib.responses[httplib.OK]) <ide> <add> def _assert_content_length_header_is_string(self, headers): <add> if 'Content-Length' in headers: <add> self.assertTrue(isinstance(headers['Content-Length'], basestring)) <add> <ide> <ide> class AzureBlobsTests(unittest.TestCase): <ide> driver_type = AzureBlobsStorageDriver
1
Text
Text
fix typos in asset_pipeline.md
f7d825d778062a6a337e9064aabdb0fda7db12d2
<ide><path>guides/source/asset_pipeline.md <ide> gem 'coffee-rails' <ide> ``` <ide> <ide> Using the `--skip-sprockets` option will prevent Rails 4 from adding <del>`sass-rails` and `uglifier` to Gemfile, so if you later want to enable <add>`sass-rails` and `uglifier` to your Gemfile, so if you later want to enable <ide> the asset pipeline you will have to add those gems to your Gemfile. Also, <ide> creating an application with the `--skip-sprockets` option will generate <ide> a slightly different `config/application.rb` file, with a require statement <ide> config.assets.js_compressor = :uglifier <ide> ``` <ide> <ide> NOTE: The `sass-rails` gem is automatically used for CSS compression if included <del>in Gemfile and no `config.assets.css_compressor` option is set. <add>in the Gemfile and no `config.assets.css_compressor` option is set. <ide> <ide> <ide> ### Main Features <ide> Rails 4 no longer sets default config values for Sprockets in `test.rb`, so <ide> environment are: `config.assets.compile = true`, `config.assets.compress = false`, <ide> `config.assets.debug = false` and `config.assets.digest = false`. <ide> <del>The following should also be added to `Gemfile`: <add>The following should also be added to your `Gemfile`: <ide> <ide> ```ruby <ide> gem 'sass-rails', "~> 3.2.3"
1
PHP
PHP
fix annotations around entity
4774e2604470ed3b0d29c554f0afa08ecb53b009
<ide><path>src/ORM/Behavior/Translate/TranslateTrait.php <ide> trait TranslateTrait <ide> * it. <ide> * <ide> * @param string $language Language to return entity for. <del> * @return $this|\Cake\ORM\Entity <add> * @return $this|\Cake\Datasource\EntityInterface <ide> */ <ide> public function translation($language) <ide> { <ide><path>src/ORM/Behavior/TreeBehavior.php <ide> protected function _setChildrenLevel($entity) <ide> 'order' => $config['left'], <ide> ]); <ide> <del> /* @var \Cake\ORM\Entity $node */ <add> /* @var \Cake\Datasource\EntityInterface $node */ <ide> foreach ($children as $node) { <ide> $parentIdValue = $node->get($config['parent']); <ide> $depth = $depths[$parentIdValue] + 1; <ide> public function beforeDelete(Event $event, EntityInterface $entity) <ide> <ide> if ($diff > 2) { <ide> $this->_table->deleteAll(function ($exp) use ($config, $left, $right) { <add> /* @var \Cake\Database\Expression\QueryExpression $exp */ <ide> return $exp <ide> ->gte($config['leftField'], $left + 1) <ide> ->lte($config['leftField'], $right - 1); <ide> protected function _unmarkInternalTree() <ide> $config = $this->getConfig(); <ide> $this->_table->updateAll( <ide> function ($exp) use ($config) { <add> /* @var \Cake\Database\Expression\QueryExpression $exp */ <ide> $leftInverse = clone $exp; <ide> $leftInverse->type('*')->add('-1'); <ide> $rightInverse = clone $leftInverse; <ide> function ($exp) use ($config) { <ide> ->eq($config['rightField'], $rightInverse->add($config['rightField'])); <ide> }, <ide> function ($exp) use ($config) { <add> /* @var \Cake\Database\Expression\QueryExpression $exp */ <ide> return $exp->lt($config['leftField'], 0); <ide> } <ide> ); <ide> public function findTreeList(Query $query, array $options) <ide> public function formatTreeList(Query $query, array $options = []) <ide> { <ide> return $query->formatResults(function ($results) use ($options) { <add> /* @var \Cake\Collection\CollectionTrait $results */ <ide> $options += [ <ide> 'keyPath' => $this->_getPrimaryKey(), <ide> 'valuePath' => $this->_table->getDisplayField(), <ide> public function formatTreeList(Query $query, array $options = []) <ide> * without moving its children with it. <ide> * <ide> * @param \Cake\Datasource\EntityInterface $node The node to remove from the tree <del> * @return \Cake\ORM\Entity|false the node after being removed from the tree or <add> * @return \Cake\Datasource\EntityInterface|false the node after being removed from the tree or <ide> * false on error <ide> */ <ide> public function removeFromTree(EntityInterface $node) <ide> public function removeFromTree(EntityInterface $node) <ide> * Helper function containing the actual code for removeFromTree <ide> * <ide> * @param \Cake\Datasource\EntityInterface $node The node to remove from the tree <del> * @return \Cake\ORM\Entity|false the node after being removed from the tree or <add> * @return \Cake\Datasource\EntityInterface|false the node after being removed from the tree or <ide> * false on error <ide> */ <ide> protected function _removeFromTree($node) <ide> protected function _removeFromTree($node) <ide> * @param \Cake\Datasource\EntityInterface $node The node to move <ide> * @param int|bool $number How many places to move the node, or true to move to first position <ide> * @throws \Cake\Datasource\Exception\RecordNotFoundException When node was not found <del> * @return \Cake\ORM\Entity|bool $node The node after being moved or false on failure <add> * @return \Cake\Datasource\EntityInterface|bool $node The node after being moved or false on failure <ide> */ <ide> public function moveUp(EntityInterface $node, $number = 1) <ide> { <ide> public function moveUp(EntityInterface $node, $number = 1) <ide> * @param \Cake\Datasource\EntityInterface $node The node to move <ide> * @param int|bool $number How many places to move the node, or true to move to first position <ide> * @throws \Cake\Datasource\Exception\RecordNotFoundException When node was not found <del> * @return \Cake\ORM\Entity|bool $node The node after being moved or false on failure <add> * @return \Cake\Datasource\EntityInterface|bool $node The node after being moved or false on failure <ide> */ <ide> protected function _moveUp($node, $number) <ide> { <ide> protected function _moveUp($node, $number) <ide> ->select([$left, $right]) <ide> ->where(["$parent IS" => $nodeParent]) <ide> ->where(function ($exp) use ($config, $nodeLeft) { <add> /* @var \Cake\Database\Expression\QueryExpression $exp */ <ide> return $exp->lt($config['rightField'], $nodeLeft); <ide> }) <ide> ->orderDesc($config['leftField']) <ide> protected function _moveUp($node, $number) <ide> ->select([$left, $right]) <ide> ->where(["$parent IS" => $nodeParent]) <ide> ->where(function ($exp) use ($config, $nodeLeft) { <add> /* @var \Cake\Database\Expression\QueryExpression $exp */ <ide> return $exp->lt($config['rightField'], $nodeLeft); <ide> }) <ide> ->orderAsc($config['leftField']) <ide> protected function _moveUp($node, $number) <ide> * @param \Cake\Datasource\EntityInterface $node The node to move <ide> * @param int|bool $number How many places to move the node or true to move to last position <ide> * @throws \Cake\Datasource\Exception\RecordNotFoundException When node was not found <del> * @return \Cake\ORM\Entity|bool the entity after being moved or false on failure <add> * @return \Cake\Datasource\EntityInterface|bool the entity after being moved or false on failure <ide> */ <ide> public function moveDown(EntityInterface $node, $number = 1) <ide> { <ide> public function moveDown(EntityInterface $node, $number = 1) <ide> * @param \Cake\Datasource\EntityInterface $node The node to move <ide> * @param int|bool $number How many places to move the node, or true to move to last position <ide> * @throws \Cake\Datasource\Exception\RecordNotFoundException When node was not found <del> * @return \Cake\ORM\Entity|bool $node The node after being moved or false on failure <add> * @return \Cake\Datasource\EntityInterface|bool $node The node after being moved or false on failure <ide> */ <ide> protected function _moveDown($node, $number) <ide> { <ide> protected function _moveDown($node, $number) <ide> * Returns a single node from the tree from its primary key <ide> * <ide> * @param mixed $id Record id. <del> * @return \Cake\ORM\Entity <add> * @return \Cake\Datasource\EntityInterface <ide> * @throws \Cake\Datasource\Exception\RecordNotFoundException When node was not found <ide> */ <ide> protected function _getNode($id) <ide><path>src/ORM/Marshaller.php <ide> protected function _buildPropertyMap($data, $options) <ide> * <ide> * @param array $data The data to hydrate. <ide> * @param array $options List of options <del> * @return \Cake\ORM\Entity <add> * @return \Cake\Datasource\EntityInterface <ide> * @see \Cake\ORM\Table::newEntity() <ide> * @see \Cake\ORM\Entity::$_accessible <ide> */ <ide> public function one(array $data, array $options = []) <ide> <ide> $primaryKey = (array)$this->_table->getPrimaryKey(); <ide> $entityClass = $this->_table->getEntityClass(); <del> /* @var Entity $entity */ <add> /* @var \Cake\Datasource\EntityInterface $entity */ <ide> $entity = new $entityClass(); <ide> $entity->setSource($this->_table->getRegistryAlias()); <ide>
3
Python
Python
add linear congruential generator
875c6cde16e21684b96ad5545c68ac1667b157bc
<ide><path>other/LinearCongruentialGenerator.py <add>__author__ = "Tobias Carryer" <add> <add>from time import time <add> <add>class LinearCongruentialGenerator(object): <add> """ <add> A pseudorandom number generator. <add> """ <add> <add> def __init__( self, multiplier, increment, modulo, seed=int(time()) ): <add> """ <add> These parameters are saved and used when nextNumber() is called. <add> <add> modulo is the largest number that can be generated (exclusive). The most <add> efficent values are powers of 2. 2^32 is a common value. <add> """ <add> self.multiplier = multiplier <add> self.increment = increment <add> self.modulo = modulo <add> self.seed = seed <add> <add> def next_number( self ): <add> """ <add> The smallest number that can be generated is zero. <add> The largest number that can be generated is modulo-1. modulo is set in the constructor. <add> """ <add> self.seed = (self.multiplier * self.seed + self.increment) % self.modulo <add> return self.seed <add> <add>if __name__ == "__main__": <add> # Show the LCG in action. <add> lcg = LinearCongruentialGenerator(1664525, 1013904223, 2<<31) <add> while True : <add> print lcg.next_number() <ide>\ No newline at end of file
1
Javascript
Javascript
fix ocean shader for webgl2
d2c7ae35a46970303dbc60911d2085b13cd641f5
<ide><path>examples/js/shaders/OceanShaders.js <ide> THREE.OceanShaders[ 'ocean_initial_spectrum' ] = { <ide> 'return sqrt(G * k * (1.0 + pow2(k / KM)));', <ide> '}', <ide> <add> '#if __VERSION__ == 100', <ide> 'float tanh (float x) {', <ide> 'return (1.0 - exp(-2.0 * x)) / (1.0 + exp(-2.0 * x));', <ide> '}', <add> '#endif', <ide> <ide> 'void main (void) {', <ide> 'vec2 coordinates = gl_FragCoord.xy - 0.5;', <ide><path>examples/jsm/shaders/OceanShaders.js <ide> OceanShaders[ 'ocean_initial_spectrum' ] = { <ide> 'return sqrt(G * k * (1.0 + pow2(k / KM)));', <ide> '}', <ide> <add> '#if __VERSION__ == 100', <ide> 'float tanh (float x) {', <ide> 'return (1.0 - exp(-2.0 * x)) / (1.0 + exp(-2.0 * x));', <ide> '}', <add> '#endif', <ide> <ide> 'void main (void) {', <ide> 'vec2 coordinates = gl_FragCoord.xy - 0.5;',
2
Go
Go
add unit test for swarm labels on containers
6f8d17dad3cf29c2ff2d019204c68227ebadfcc8
<ide><path>daemon/cluster/executor/container/container_test.go <ide> func TestIsolationConversion(t *testing.T) { <ide> }) <ide> } <ide> } <add> <add>func TestContainerLabels(t *testing.T) { <add> c := &containerConfig{ <add> task: &swarmapi.Task{ <add> ID: "real-task.id", <add> Spec: swarmapi.TaskSpec{ <add> Runtime: &swarmapi.TaskSpec_Container{ <add> Container: &swarmapi.ContainerSpec{ <add> Labels: map[string]string{ <add> "com.docker.swarm.task": "user-specified-task", <add> "com.docker.swarm.task.id": "user-specified-task.id", <add> "com.docker.swarm.task.name": "user-specified-task.name", <add> "com.docker.swarm.node.id": "user-specified-node.id", <add> "com.docker.swarm.service.id": "user-specified-service.id", <add> "com.docker.swarm.service.name": "user-specified-service.name", <add> "this-is-a-user-label": "this is a user label's value", <add> }, <add> }, <add> }, <add> }, <add> ServiceID: "real-service.id", <add> Slot: 123, <add> NodeID: "real-node.id", <add> Annotations: swarmapi.Annotations{ <add> Name: "real-service.name.123.real-task.id", <add> }, <add> ServiceAnnotations: swarmapi.Annotations{ <add> Name: "real-service.name", <add> }, <add> }, <add> } <add> <add> expected := map[string]string{ <add> "com.docker.swarm.task": "", <add> "com.docker.swarm.task.id": "real-task.id", <add> "com.docker.swarm.task.name": "real-service.name.123.real-task.id", <add> "com.docker.swarm.node.id": "real-node.id", <add> "com.docker.swarm.service.id": "real-service.id", <add> "com.docker.swarm.service.name": "real-service.name", <add> "this-is-a-user-label": "this is a user label's value", <add> } <add> <add> labels := c.labels() <add> assert.DeepEqual(t, expected, labels) <add>}
1
PHP
PHP
add additional container tests
2154cc9b3ce6b269e12eca52311b988633b8323d
<ide><path>tests/Container/ContainerTest.php <ide> public function testBindIfDoesntRegisterIfServiceAlreadyRegistered() <ide> $this->assertEquals('Taylor', $container->make('name')); <ide> } <ide> <add> public function testBindIfDoesRegisterIfServiceNotRegisteredYet() <add> { <add> $container = new Container; <add> $container->bind('surname', function () { <add> return 'Taylor'; <add> }); <add> $container->bindIf('name', function () { <add> return 'Dayle'; <add> }); <add> <add> $this->assertEquals('Dayle', $container->make('name')); <add> } <add> <ide> public function testSharedClosureResolution() <ide> { <ide> $container = new Container; <ide> public function testGetAlias() <ide> $this->assertEquals($container->getAlias('foo'), 'ConcreteStub'); <ide> } <ide> <add> public function testItThrowsExceptionWhenAbstractIsSameAsAlias() <add> { <add> $container = new Container; <add> $container->alias('name', 'name'); <add> <add> $this->expectException('LogicException'); <add> $this->expectExceptionMessage('[name] is aliased to itself.'); <add> <add> $container->getAlias('name'); <add> } <add> <ide> public function testContainerCanInjectSimpleVariable() <ide> { <ide> $container = new Container; <ide> public function testContainerCanBindAnyWord() <ide> $this->assertInstanceOf(stdClass::class, $container->get('Taylor')); <ide> } <ide> <add> public function testContainerCanDynamicallySetService() <add> { <add> $container = new Container; <add> $this->assertFalse(isset($container['name'])); <add> $container['name'] = 'Taylor'; <add> $this->assertTrue(isset($container['name'])); <add> $this->assertSame('Taylor', $container['name']); <add> } <add> <ide> /** <ide> * @expectedException \Illuminate\Container\EntryNotFoundException <ide> * @expectedExceptionMessage
1
Text
Text
add challenge name to issue template
b834b0675f884041383df20a1e2a61ca7401e767
<ide><path>.github/ISSUE_TEMPLATE.md <del>#### FreeCodeCamp Issue template <del>To Use this Template: <del>* Fill out what you can <del>* Delete what you do not fill out <add><!-- <add>FreeCodeCamp Issue Template <add>NOTE: ISSUES ARE NOT FOR CODE HELP - Ask for Help at <add>https://gitter.im/FreeCodeCamp/Help <add>--> <add> <add>#### Challenge Name <add> <add><!-- Insert link to challenge below --> <ide> <del>NOTE: ISSUES ARE NOT FOR CODE HELP - Ask for Help at https://gitter.im/FreeCodeCamp/Help <ide> <ide> #### Issue Description <del>* When Issue Happens <del>* Steps To Reproduce <add> <add><!-- Describe below when the issue happens and how to reproduce it --> <add> <ide> <ide> #### Browser Information <del>* Browser Name, Version <del>* Operating System <add> <add><!-- Describe your workspace in which you are having issues--> <add> <add>* Browser Name, Version: <add>* Operating System: <add>* Mobile, Desktop, or Tablet: <ide> <ide> #### Your Code <ide> <ide> ```js <del>If relevant, paste all of your challenge code in here <add>// If relevant, paste all of your challenge code in here <add> <ide> ``` <ide> <ide> #### Screenshot <add> <add>
1
Python
Python
add test for astype to stringlength tests
22ee97190db0e2432e21d3d830e04776feb0f0a6
<ide><path>numpy/core/tests/test_array_coercion.py <ide> def test_basic_stringlength(self, obj): <ide> # A nested array is also discovered correctly <ide> arr = np.array(obj, dtype="O") <ide> assert np.array(arr, dtype="S").dtype == expected <add> # Check that .astype() behaves identical <add> assert arr.astype("S").dtype == expected <ide> <ide> @pytest.mark.parametrize("obj", <ide> [object(), 1.2, 10**43, None, "string"],
1
Javascript
Javascript
simplify animation system
ec2a091f937a9b95c1812ca81187b9dc41e2a766
<ide><path>examples/js/loaders/FBXLoader.js <ide> <ide> } <ide> <del> // Parses animation information from nodes in <del> // FBXTree.Objects.subNodes.AnimationCurve: child of an AnimationCurveNode, holds the raw animation data (e.g. x axis rotation ) <del> // FBXTree.Objects.subNodes.AnimationCurveNode: child of an AnimationLayer and connected to whichever node is being animated <del> // FBXTree.Objects.subNodes.AnimationLayer: child of an AnimationStack <del> // FBXTree.Objects.subNodes.AnimationStack <del> // Multiple animation takes are stored in AnimationLayer and AnimationStack <del> // Note: There is also FBXTree.Takes, however this seems to be left over from an older version of the <del> // format and is no longer used <del> function parseAnimations( FBXTree, connections, modelsArray ) { <del> <del> var rawCurves = FBXTree.Objects.subNodes.AnimationCurve; <del> var rawCurveNodes = FBXTree.Objects.subNodes.AnimationCurveNode; <del> var rawLayers = FBXTree.Objects.subNodes.AnimationLayer; <del> var rawStacks = FBXTree.Objects.subNodes.AnimationStack; <add> function parseAnimations( FBXTree, connections ) { <ide> <ide> // since the actual transformation data is stored in FBXTree.Objects.subNodes.AnimationCurve, <ide> // if this is undefined we can safely assume there are no animations <ide> if ( FBXTree.Objects.subNodes.AnimationCurve === undefined ) return undefined; <ide> <del> var animations = { <add> var curveNodesMap = parseAnimationCurveNodes( FBXTree ); <ide> <del> takes: {}, <del> fps: getFrameRate( FBXTree ), <add> parseAnimationCurves( FBXTree, connections, curveNodesMap ); <ide> <del> }; <add> var layersMap = parseAnimationLayers( FBXTree, connections, curveNodesMap ); <add> var rawClips = parseAnimStacks( FBXTree, connections, layersMap ); <add> <add> return rawClips; <add> <add> } <add> <add> // parse nodes in FBXTree.Objects.subNodes.AnimationCurveNode <add> // each AnimationCurveNode holds data for an animation transform for a model (e.g. left arm rotation ) <add> // and is referenced by an AnimationLayer <add> function parseAnimationCurveNodes( FBXTree ) { <add> <add> var rawCurveNodes = FBXTree.Objects.subNodes.AnimationCurveNode; <ide> <ide> var curveNodesMap = new Map(); <ide> <ide> for ( var nodeID in rawCurveNodes ) { <ide> <del> var animationNode = parseAnimationCurveNode( FBXTree, rawCurveNodes[ nodeID ], connections, modelsArray ); <add> var rawCurveNode = rawCurveNodes[ nodeID ]; <add> <add> if ( rawCurveNode.attrName.match( /S|R|T/ ) !== null ) { <add> <add> var curveNode = { <ide> <del> if ( animationNode !== null ) { <add> id: rawCurveNode.id, <add> attr: rawCurveNode.attrName, <add> curves: {}, <ide> <del> curveNodesMap.set( animationNode.id, animationNode ); <add> }; <ide> <ide> } <ide> <add> curveNodesMap.set( curveNode.id, curveNode ); <add> <ide> } <ide> <del> for ( nodeID in rawCurves ) { <add> return curveNodesMap; <add> <add> } <add> <add> // parse nodes in FBXTree.Objects.subNodes.AnimationCurve and connect them up to <add> // previously parsed AnimationCurveNodes. Each AnimationCurve holds data for a single animated <add> // axis ( e.g. times and values of x rotation) <add> function parseAnimationCurves( FBXTree, connections, curveNodesMap ) { <add> <add> var rawCurves = FBXTree.Objects.subNodes.AnimationCurve; <add> <add> for ( var nodeID in rawCurves ) { <ide> <del> var animationCurve = parseAnimationCurve( rawCurves[ nodeID ] ); <add> var animationCurve = { <add> <add> id: rawCurves[ nodeID ].id, <add> times: rawCurves[ nodeID ].subNodes.KeyTime.properties.a.map( convertFBXTimeToSeconds ), <add> values: rawCurves[ nodeID ].subNodes.KeyValueFloat.properties.a, <add> <add> }; <ide> <ide> var conns = connections.get( animationCurve.id ); <ide> <ide> if ( conns !== undefined ) { <ide> <del> var firstParentConn = conns.parents[ 0 ]; <del> var firstParentID = firstParentConn.ID; <del> var firstParentRelationship = firstParentConn.relationship; <add> var animationCurveID = conns.parents[ 0 ].ID; <add> var animationCurveRelationship = conns.parents[ 0 ].relationship; <ide> var axis = ''; <ide> <del> if ( firstParentRelationship.match( /X/ ) ) { <add> if ( animationCurveRelationship.match( /X/ ) ) { <ide> <ide> axis = 'x'; <ide> <del> } else if ( firstParentRelationship.match( /Y/ ) ) { <add> } else if ( animationCurveRelationship.match( /Y/ ) ) { <ide> <ide> axis = 'y'; <ide> <del> } else if ( firstParentRelationship.match( /Z/ ) ) { <add> } else if ( animationCurveRelationship.match( /Z/ ) ) { <ide> <ide> axis = 'z'; <ide> <ide> <ide> } <ide> <del> curveNodesMap.get( firstParentID ).curves[ axis ] = animationCurve; <add> curveNodesMap.get( animationCurveID ).curves[ axis ] = animationCurve; <ide> <ide> } <ide> <ide> } <ide> <del> var emptyCurve = { <del> <del> times: [ 0.0 ], <del> values: [ 0.0 ] <del> <del> }; <del> <del> // loop over rotation values, convert to radians and add any pre rotation <del> curveNodesMap.forEach( function ( curveNode ) { <del> <del> if ( curveNode.attr === 'R' ) { <del> <del> var curves = curveNode.curves; <del> <del> if ( curves.x === null ) curves.x = emptyCurve; <del> if ( curves.y === null ) curves.y = emptyCurve; <del> if ( curves.z === null ) curves.z = emptyCurve; <del> <del> curves.x.values = curves.x.values.map( THREE.Math.degToRad ); <del> curves.y.values = curves.y.values.map( THREE.Math.degToRad ); <del> curves.z.values = curves.z.values.map( THREE.Math.degToRad ); <del> <del> if ( curveNode.preRotations !== null ) { <del> <del> var preRotations = curveNode.preRotations.map( THREE.Math.degToRad ); <del> preRotations.push( 'ZYX' ); <del> preRotations = new THREE.Euler().fromArray( preRotations ); <del> preRotations = new THREE.Quaternion().setFromEuler( preRotations ); <del> <del> var frameRotation = new THREE.Euler(); <del> var frameRotationQuaternion = new THREE.Quaternion(); <del> <del> for ( var frame = 0; frame < curves.x.times.length; ++ frame ) { <del> <del> frameRotation.set( curves.x.values[ frame ], curves.y.values[ frame ], curves.z.values[ frame ], 'ZYX' ); <del> frameRotationQuaternion.setFromEuler( frameRotation ).premultiply( preRotations ); <del> frameRotation.setFromQuaternion( frameRotationQuaternion, 'ZYX' ); <del> curves.x.values[ frame ] = frameRotation.x; <del> curves.y.values[ frame ] = frameRotation.y; <del> curves.z.values[ frame ] = frameRotation.z; <del> <del> } <del> <del> } <add> } <ide> <del> } <add> // parse nodes in FBXTree.Objects.subNodes.AnimationLayer. Each layers holds references <add> // to various AnimationCurveNodes and is referenced by an AnimationStack node <add> // note: theoretically a stack can multiple layers, however in practice there always seems to be one per stack <add> function parseAnimationLayers( FBXTree, connections, curveNodesMap ) { <ide> <del> } ); <add> var rawLayers = FBXTree.Objects.subNodes.AnimationLayer; <ide> <ide> var layersMap = new Map(); <ide> <ide> for ( var nodeID in rawLayers ) { <ide> <del> var layer = []; <add> var layerCurveNodes = []; <ide> <ide> var connection = connections.get( parseInt( nodeID ) ); <ide> <ide> if ( connection !== undefined ) { <ide> <add> // all the animationCurveNodes used in the layer <ide> var children = connection.children; <ide> <del> for ( var childIndex = 0; childIndex < children.length; childIndex ++ ) { <del> <del> // Skip lockInfluenceWeights <del> if ( curveNodesMap.has( children[ childIndex ].ID ) ) { <del> <del> var curveNode = curveNodesMap.get( children[ childIndex ].ID ); <del> var modelIndex = curveNode.modelIndex; <del> <del> if ( layer[ modelIndex ] === undefined ) { <del> <del> layer[ modelIndex ] = { <del> T: null, <del> R: null, <del> S: null <del> }; <del> <del> } <del> <del> layer[ modelIndex ][ curveNode.attr ] = curveNode; <del> <del> } <add> children.forEach( function ( child, i ) { <ide> <del> } <add> if ( curveNodesMap.has( child.ID ) ) { <ide> <del> layersMap.set( parseInt( nodeID ), layer ); <add> var curveNode = curveNodesMap.get( child.ID ); <ide> <del> } <add> if ( layerCurveNodes[ i ] === undefined ) { <ide> <del> } <add> var modelID = connections.get( child.ID ).parents[ 1 ].ID; <ide> <del> for ( var nodeID in rawStacks ) { <add> var rawModel = FBXTree.Objects.subNodes.Model[ modelID.toString() ]; <ide> <del> var layers = []; <del> var children = connections.get( parseInt( nodeID ) ).children; <del> var timestamps = { max: 0, min: Number.MAX_VALUE }; <add> var node = { <ide> <del> for ( var childIndex = 0; childIndex < children.length; ++ childIndex ) { <add> modelName: THREE.PropertyBinding.sanitizeNodeName( rawModel.attrName ), <add> initialPosition: [ 0, 0, 0 ], <add> initialRotation: [ 0, 0, 0 ], <add> initialScale: [ 1, 1, 1 ], <ide> <del> var currentLayer = layersMap.get( children[ childIndex ].ID ); <del> <del> if ( currentLayer !== undefined ) { <add> }; <ide> <del> layers.push( currentLayer ); <add> if ( 'Lcl_Translation' in rawModel.properties ) node.initialPosition = rawModel.properties.Lcl_Translation.value; <ide> <del> for ( var currentLayerIndex = 0, currentLayerLength = currentLayer.length; currentLayerIndex < currentLayerLength; ++ currentLayerIndex ) { <add> if ( 'Lcl_Rotation' in rawModel.properties ) node.initialRotation = rawModel.properties.Lcl_Rotation.value; <ide> <del> var layer = currentLayer[ currentLayerIndex ]; <add> if ( 'Lcl_Scaling' in rawModel.properties ) node.initialScale = rawModel.properties.Lcl_Scaling.value; <ide> <del> if ( layer ) { <add> // if the animated model is pre rotated, we'll have to apply the pre rotations to every <add> // animation value as well <add> if ( 'PreRotation' in rawModel.properties ) node.preRotations = rawModel.properties.PreRotation.value; <ide> <del> getCurveNodeMaxMinTimeStamps( layer, timestamps ); <add> layerCurveNodes[ i ] = node; <ide> <ide> } <ide> <del> } <del> <del> } <del> <del> } <del> <del> // Do we have an animation clip with actual length? <del> if ( timestamps.max > timestamps.min ) { <add> layerCurveNodes[ i ][ curveNode.attr ] = curveNode; <ide> <del> animations.takes[ nodeID ] = { <add> } <ide> <del> name: rawStacks[ nodeID ].attrName, <del> layers: layers, <del> length: timestamps.max - timestamps.min, <del> frames: ( timestamps.max - timestamps.min ) * animations.fps <add> } ); <ide> <del> }; <add> layersMap.set( parseInt( nodeID ), layerCurveNodes ); <ide> <ide> } <ide> <ide> } <ide> <del> return animations; <add> return layersMap; <ide> <ide> } <ide> <del> // parse a node in FBXTree.Objects.subNodes.AnimationCurveNode <del> function parseAnimationCurveNode( FBXTree, animationCurveNode, connections, modelsArray ) { <del> <del> var rawModels = FBXTree.Objects.subNodes.Model; <del> <del> var returnObject = { <del> <del> id: animationCurveNode.id, <del> attr: animationCurveNode.attrName, <del> modelIndex: - 1, <del> curves: { <del> x: null, <del> y: null, <del> z: null <del> }, <del> preRotations: null, <del> <del> }; <del> <del> if ( returnObject.attr.match( /S|R|T/ ) === null ) return null; <del> <del> // get a list of parents - one of these will be the model being animated by this curve <del> var parents = connections.get( returnObject.id ).parents; <add> // parse nodes in FBXTree.Objects.subNodes.AnimationStack. These are the top level node in the animation <add> // hierarchy. Each Stack node will be used to create a THREE.AnimationClip <add> function parseAnimStacks( FBXTree, connections, layersMap ) { <ide> <del> for ( var i = parents.length - 1; i >= 0; -- i ) { <del> <del> // the index of the model in the modelsArray <del> var modelIndex = findIndex( modelsArray, function ( model ) { <add> var rawStacks = FBXTree.Objects.subNodes.AnimationStack; <ide> <del> return model.FBX_ID === parents[ i ].ID; <add> // connect the stacks (clips) up to the layers <add> var rawClips = {}; <ide> <del> } ); <add> for ( var nodeID in rawStacks ) { <ide> <del> if ( modelIndex > - 1 ) { <add> var children = connections.get( parseInt( nodeID ) ).children; <ide> <del> returnObject.modelIndex = modelIndex; <add> if ( children.length > 1 ) { <ide> <del> var model = rawModels[ parents[ i ].ID.toString() ]; <add> // it seems like stacks will always be associated with a single layer. But just in case there are files <add> // where there are multiple layers per stack, we'll display a warning <add> console.warn( 'THREE.FBXLoader: Encountered an animation stack with multiple layers, this is currently not supported. Ignoring subsequent layers.' ); <ide> <del> //if the animated model is pre rotated, we'll have to apply the pre rotations to every <del> // animation value as well <del> if ( 'PreRotation' in model.properties ) { <add> } <ide> <del> returnObject.preRotations = model.properties.PreRotation.value; <add> var layer = layersMap.get( children[ 0 ].ID ); <ide> <del> } <add> rawClips[ nodeID ] = { <ide> <del> break; <add> name: rawStacks[ nodeID ].attrName, <add> layer: layer, <ide> <del> } <add> }; <ide> <ide> } <ide> <del> return returnObject; <add> return rawClips; <ide> <ide> } <ide> <del> // parse single node in FBXTree.Objects.subNodes.AnimationCurve <del> function parseAnimationCurve( animationCurve ) { <add> // take raw animation data from parseAnimations and connect it up to the loaded models <add> function addAnimations( FBXTree, connections, sceneGraph ) { <ide> <del> return { <add> sceneGraph.animations = []; <ide> <del> id: animationCurve.id, <del> times: animationCurve.subNodes.KeyTime.properties.a.map( convertFBXTimeToSeconds ), <del> values: animationCurve.subNodes.KeyValueFloat.properties.a, <add> var rawClips = parseAnimations( FBXTree, connections ); <ide> <del> }; <add> if ( rawClips === undefined ) return; <ide> <del> } <add> for ( var key in rawClips ) { <ide> <del> function getFrameRate( FBXTree ) { <del> <del> var fps = 30; // default framerate <del> <del> if ( 'GlobalSettings' in FBXTree && 'TimeMode' in FBXTree.GlobalSettings.properties ) { <del> <del> /* Autodesk time mode documentation can be found here: <del> * http://docs.autodesk.com/FBX/2014/ENU/FBX-SDK-Documentation/index.html?url=cpp_ref/class_fbx_time.html,topicNumber=cpp_ref_class_fbx_time_html <del> */ <del> var timeModeEnum = [ <del> 30, // 0: eDefaultMode <del> 120, // 1: eFrames120 <del> 100, // 2: eFrames100 <del> 60, // 3: eFrames60 <del> 50, // 4: eFrames50 <del> 48, // 5: eFrames48 <del> 30, // 6: eFrames30 (black and white NTSC ) <del> 30, // 7: eFrames30Drop <del> 29.97, // 8: eNTSCDropFrame <del> 29.97, // 90: eNTSCFullFrame <del> 25, // 10: ePal ( PAL/SECAM ) <del> 24, // 11: eFrames24 (Film/Cinema) <del> 1, // 12: eFrames1000 (use for date time)) <del> 23.976, // 13: eFilmFullFrame <del> 30, // 14: eCustom: use GlobalSettings.properties.CustomFrameRate.value <del> 96, // 15: eFrames96 <del> 72, // 16: eFrames72 <del> 59.94, // 17: eFrames59dot94 <del> ]; <add> var rawClip = rawClips[ key ]; <ide> <del> var eMode = FBXTree.GlobalSettings.properties.TimeMode.value; <add> var clip = addClip( rawClip ); <ide> <del> if ( eMode === 14 ) { <del> <del> if ( 'CustomFrameRate' in FBXTree.GlobalSettings.properties ) { <add> sceneGraph.animations.push( clip ); <ide> <del> fps = FBXTree.GlobalSettings.properties.CustomFrameRate.value; <add> } <ide> <del> fps = ( fps === - 1 ) ? 30 : fps; <add> } <ide> <del> } <add> function addClip( rawClip ) { <ide> <del> } else if ( eMode <= 17 ) { // for future proofing - if more eModes get added, they will default to 30fps <add> var tracks = []; <ide> <del> fps = timeModeEnum[ eMode ]; <add> rawClip.layer.forEach( function ( rawTracks ) { <ide> <del> } <add> tracks = tracks.concat( generateTracks( rawTracks ) ); <ide> <del> } <add> } ); <ide> <del> return fps; <add> return new THREE.AnimationClip( rawClip.name, - 1, tracks ); <ide> <ide> } <ide> <del> // Sets the maxTimeStamp and minTimeStamp variables if it has timeStamps that are either larger or smaller <del> // than the max or min respectively. <del> function getCurveNodeMaxMinTimeStamps( layer, timestamps ) { <add> function generateTracks( rawTracks ) { <ide> <del> if ( layer.R ) { <add> var tracks = []; <ide> <del> getCurveMaxMinTimeStamp( layer.R.curves, timestamps ); <add> if ( rawTracks.T !== undefined ) { <ide> <del> } <del> if ( layer.S ) { <del> <del> getCurveMaxMinTimeStamp( layer.S.curves, timestamps ); <add> var positionTrack = generateVectorTrack( rawTracks.modelName, rawTracks.T.curves, rawTracks.initialPosition, 'position' ); <add> if ( positionTrack !== undefined ) tracks.push( positionTrack ); <ide> <ide> } <del> if ( layer.T ) { <del> <del> getCurveMaxMinTimeStamp( layer.T.curves, timestamps ); <del> <del> } <del> <del> } <del> <del> // Sets the maxTimeStamp and minTimeStamp if one of the curve's time stamps <del> // exceeds the maximum or minimum. <del> function getCurveMaxMinTimeStamp( curve, timestamps ) { <ide> <del> if ( curve.x ) { <add> if ( rawTracks.R !== undefined ) { <ide> <del> getCurveAxisMaxMinTimeStamps( curve.x, timestamps ); <add> var rotationTrack = generateRotationTrack( rawTracks.modelName, rawTracks.R.curves, rawTracks.initialRotation, rawTracks.preRotations ); <add> if ( rotationTrack !== undefined ) tracks.push( rotationTrack ); <ide> <ide> } <del> if ( curve.y ) { <ide> <del> getCurveAxisMaxMinTimeStamps( curve.y, timestamps ); <add> if ( rawTracks.S !== undefined ) { <ide> <del> } <del> if ( curve.z ) { <del> <del> getCurveAxisMaxMinTimeStamps( curve.z, timestamps ); <add> var scaleTrack = generateVectorTrack( rawTracks.modelName, rawTracks.S.curves, rawTracks.initialScale, 'scale' ); <add> if ( scaleTrack !== undefined ) tracks.push( scaleTrack ); <ide> <ide> } <ide> <del> } <del> <del> // Sets the maxTimeStamp and minTimeStamp if one of its timestamps exceeds the maximum or minimum. <del> function getCurveAxisMaxMinTimeStamps( axis, timestamps ) { <del> <del> timestamps.max = axis.times[ axis.times.length - 1 ] > timestamps.max ? axis.times[ axis.times.length - 1 ] : timestamps.max; <del> timestamps.min = axis.times[ 0 ] < timestamps.min ? axis.times[ 0 ] : timestamps.min; <add> return tracks; <ide> <ide> } <ide> <del> function addAnimations( FBXTree, connections, sceneGraph, modelMap ) { <add> function generateVectorTrack( modelName, curves, initialValue, type ) { <ide> <del> // create a flattened array of all models and bones in the scene <del> var modelsArray = Array.from( modelMap.values() ); <add> var times = getTimesForAllAxes( curves ); <add> var values = getKeyframeTrackValues( times, curves, initialValue ); <ide> <del> sceneGraph.animations = []; <add> return new THREE.VectorKeyframeTrack( modelName + '.' + type, times, values ); <ide> <del> var animations = parseAnimations( FBXTree, connections, modelsArray ); <del> <del> if ( animations === undefined ) return; <add> } <ide> <del> // Silly hack with the animation parsing. We're gonna pretend the scene graph has a skeleton <del> // to attach animations to, since FBX treats animations as animations for the entire scene, <del> // not just for individual objects. <del> sceneGraph.skeleton = { <add> function generateRotationTrack( modelName, curves, initialValue, preRotations ) { <ide> <del> bones: modelsArray, <add> if ( curves.x !== undefined ) curves.x.values = curves.x.values.map( THREE.Math.degToRad ); <add> if ( curves.y !== undefined ) curves.y.values = curves.y.values.map( THREE.Math.degToRad ); <add> if ( curves.z !== undefined ) curves.z.values = curves.z.values.map( THREE.Math.degToRad ); <ide> <del> }; <add> var times = getTimesForAllAxes( curves ); <add> var values = getKeyframeTrackValues( times, curves, initialValue ); <ide> <del> for ( var key in animations.takes ) { <add> if ( preRotations !== undefined ) { <ide> <del> var take = animations.takes[ key ]; <add> preRotations = preRotations.map( THREE.Math.degToRad ); <add> preRotations.push( 'ZYX' ); <ide> <del> var clip = addTake( take, animations.fps, modelsArray ); <del> <del> sceneGraph.animations.push( clip ); <add> preRotations = new THREE.Euler().fromArray( preRotations ); <add> preRotations = new THREE.Quaternion().setFromEuler( preRotations ); <ide> <ide> } <ide> <del> } <del> <del> function addTake( take, fps, modelsArray ) { <add> var quaternion = new THREE.Quaternion(); <add> var euler = new THREE.Euler(); <ide> <del> var animationData = { <del> name: take.name, <del> fps: fps, <del> length: take.length, <del> hierarchy: [] <del> }; <add> var quaternionValues = []; <ide> <del> animationData.hierarchy = modelsArray.map( ( model, i ) => { <add> for ( var i = 0; i < values.length; i += 3 ) { <ide> <del> var keys = []; <add> euler.set( values[ i ], values[ i + 1 ], values[ i + 2 ], 'ZYX' ); <ide> <del> // note: assumes that the animation has been baked at one keyframe per frame <del> for ( var frame = 0; frame <= take.frames; frame ++ ) { <add> quaternion.setFromEuler( euler ); <ide> <del> var animationNode = take.layers[ 0 ][ i ]; <del> keys.push( generateKey( fps, animationNode, model, frame ) ); <add> if ( preRotations !== undefined )quaternion.premultiply( preRotations ); <ide> <del> } <add> quaternion.toArray( quaternionValues, ( i / 3 ) * 4 ); <ide> <del> return { name: model.name, keys: keys }; <del> <del> } ); <add> } <ide> <del> return THREE.AnimationClip.parseAnimation( animationData, modelsArray ); <add> return new THREE.QuaternionKeyframeTrack( modelName + '.quaternion', times, quaternionValues ); <ide> <ide> } <ide> <del> var euler = new THREE.Euler(); <del> var quaternion = new THREE.Quaternion(); <del> <del> function generateKey( fps, animationNode, model, frame ) { <del> <del> var key = { <add> function getKeyframeTrackValues( times, curves, initialValue ) { <ide> <del> time: frame / fps, <del> pos: model.position.toArray(), <del> rot: model.quaternion.toArray(), <del> scl: model.scale.toArray(), <add> var prevValue = initialValue; <ide> <del> }; <del> <del> if ( animationNode === undefined ) return key; <del> <del> euler.setFromQuaternion( model.quaternion, 'ZYX', false ); <del> <del> if ( hasCurve( animationNode, 'T' ) && hasKeyOnFrame( animationNode.T, frame ) ) { <del> <del> if ( animationNode.T.curves.x.values[ frame ] ) { <del> <del> key.pos[ 0 ] = animationNode.T.curves.x.values[ frame ]; <del> <del> } <del> <del> if ( animationNode.T.curves.y.values[ frame ] ) { <del> <del> key.pos[ 1 ] = animationNode.T.curves.y.values[ frame ]; <del> <del> } <del> <del> if ( animationNode.T.curves.z.values[ frame ] ) { <del> <del> key.pos[ 2 ] = animationNode.T.curves.z.values[ frame ]; <add> var values = []; <ide> <del> } <del> <del> } <add> var xIndex = - 1; <add> var yIndex = - 1; <add> var zIndex = - 1; <ide> <del> if ( hasCurve( animationNode, 'R' ) && hasKeyOnFrame( animationNode.R, frame ) ) { <add> times.forEach( function ( time ) { <ide> <del> // Only update the euler's values if rotation is defined for the axis on this frame <del> if ( animationNode.R.curves.x.values[ frame ] ) { <add> if ( curves.x ) xIndex = curves.x.times.indexOf( time ); <add> if ( curves.y ) yIndex = curves.y.times.indexOf( time ); <add> if ( curves.z ) zIndex = curves.z.times.indexOf( time ); <ide> <del> euler.x = animationNode.R.curves.x.values[ frame ]; <add> // if there is an x value defined for this frame, use that <add> if ( xIndex !== - 1 ) { <ide> <del> } <del> <del> if ( animationNode.R.curves.y.values[ frame ] ) { <del> <del> euler.y = animationNode.R.curves.y.values[ frame ]; <del> <del> } <add> var xValue = curves.x.values[ xIndex ]; <add> values.push( xValue ); <add> prevValue[ 0 ] = xValue; <ide> <del> if ( animationNode.R.curves.z.values[ frame ] ) { <add> } else { <ide> <del> euler.z = animationNode.R.curves.z.values[ frame ]; <add> // otherwise use the x value from the previous frame <add> values.push( prevValue[ 0 ] ); <ide> <ide> } <ide> <del> quaternion.setFromEuler( euler ); <del> key.rot = quaternion.toArray(); <del> <del> } <add> if ( yIndex !== - 1 ) { <ide> <del> if ( hasCurve( animationNode, 'S' ) && hasKeyOnFrame( animationNode.S, frame ) ) { <add> var yValue = curves.y.values[ yIndex ]; <add> values.push( yValue ); <add> prevValue[ 1 ] = yValue; <ide> <del> if ( animationNode.T.curves.x.values[ frame ] ) { <add> } else { <ide> <del> key.scl[ 0 ] = animationNode.S.curves.x.values[ frame ]; <add> values.push( prevValue[ 1 ] ); <ide> <ide> } <ide> <del> if ( animationNode.T.curves.y.values[ frame ] ) { <add> if ( zIndex !== - 1 ) { <ide> <del> key.scl[ 1 ] = animationNode.S.curves.y.values[ frame ]; <add> var zValue = curves.z.values[ zIndex ]; <add> values.push( zValue ); <add> prevValue[ 2 ] = zValue; <ide> <del> } <del> <del> if ( animationNode.T.curves.z.values[ frame ] ) { <add> } else { <ide> <del> key.scl[ 2 ] = animationNode.S.curves.z.values[ frame ]; <add> values.push( prevValue[ 2 ] ); <ide> <ide> } <ide> <del> } <add> } ); <ide> <del> return key; <add> return values; <ide> <ide> } <ide> <del> var AXES = [ 'x', 'y', 'z' ]; <del> <del> function hasCurve( animationNode, attribute ) { <add> // For all animated objects, times are defined separately for each axis <add> // Here we'll combine the times into one sorted array without duplicates <add> function getTimesForAllAxes( curves ) { <ide> <del> if ( animationNode === undefined ) { <add> var times = []; <ide> <del> return false; <add> // first join together the times for each axis, if defined <add> if ( curves.x !== undefined ) times = times.concat( curves.x.times ); <add> if ( curves.y !== undefined ) times = times.concat( curves.y.times ); <add> if ( curves.z !== undefined ) times = times.concat( curves.z.times ); <ide> <del> } <del> <del> var attributeNode = animationNode[ attribute ]; <del> <del> if ( ! attributeNode ) { <add> // then sort them and remove duplicates <add> times = times.sort( function ( a, b ) { <ide> <del> return false; <add> return a - b; <ide> <del> } <del> <del> return AXES.every( function ( key ) { <add> } ).filter( function ( elem, index, array ) { <ide> <del> return attributeNode.curves[ key ] !== null; <add> return array.indexOf( elem ) == index; <ide> <ide> } ); <ide> <del> } <del> <del> function hasKeyOnFrame( attributeNode, frame ) { <del> <del> return AXES.every( function ( key ) { <del> <del> return attributeNode.curves[ key ].values[ frame ] !== undefined; <del> <del> } ); <add> return times; <ide> <ide> } <ide>
1
Java
Java
check the user of a sockjs request
dc5b5ca8ee09c890352f89b2dae58bc0132d6545
<ide><path>spring-websocket/src/main/java/org/springframework/web/socket/sockjs/transport/TransportHandlingSockJsService.java <ide> package org.springframework.web.socket.sockjs.transport; <ide> <ide> import java.io.IOException; <add>import java.net.InetSocketAddress; <add>import java.security.Principal; <ide> import java.util.ArrayList; <ide> import java.util.Arrays; <ide> import java.util.Collection; <ide> else if (transportType.supportsCors()) { <ide> return; <ide> } <ide> } <add> else { <add> if (session.getPrincipal() != null) { <add> if (!session.getPrincipal().equals(request.getPrincipal())) { <add> logger.debug("The user for the session does not match the user for the request."); <add> response.setStatusCode(HttpStatus.NOT_FOUND); <add> return; <add> } <add> } <add> } <ide> <ide> if (transportType.sendsNoCacheInstruction()) { <ide> addNoCacheHeaders(response); <ide><path>spring-websocket/src/test/java/org/springframework/web/socket/sockjs/transport/handler/DefaultSockJsServiceTests.java <ide> import org.springframework.scheduling.TaskScheduler; <ide> import org.springframework.web.socket.AbstractHttpRequestTests; <ide> import org.springframework.web.socket.WebSocketHandler; <add>import org.springframework.web.socket.handler.TestPrincipal; <ide> import org.springframework.web.socket.server.HandshakeHandler; <ide> import org.springframework.web.socket.server.support.OriginHandshakeInterceptor; <ide> import org.springframework.web.socket.sockjs.transport.SockJsSessionFactory; <ide> public void handleTransportRequestXhrSend() throws Exception { <ide> verify(this.xhrSendHandler).handleRequest(this.request, this.response, this.wsHandler, this.session); <ide> } <ide> <add> @Test <add> public void handleTransportRequestXhrSendWithDifferentUser() throws Exception { <add> String sockJsPath = sessionUrlPrefix + "xhr"; <add> setRequest("POST", sockJsPrefix + sockJsPath); <add> this.service.handleRequest(this.request, this.response, sockJsPath, this.wsHandler); <add> <add> assertEquals(200, this.servletResponse.getStatus()); // session created <add> verify(this.xhrHandler).handleRequest(this.request, this.response, this.wsHandler, this.session); <add> <add> this.session.setPrincipal(new TestPrincipal("little red riding hood")); <add> this.servletRequest.setUserPrincipal(new TestPrincipal("wolf")); <add> <add> resetResponse(); <add> reset(this.xhrSendHandler); <add> sockJsPath = sessionUrlPrefix + "xhr_send"; <add> setRequest("POST", sockJsPrefix + sockJsPath); <add> this.service.handleRequest(this.request, this.response, sockJsPath, this.wsHandler); <add> <add> assertEquals(404, this.servletResponse.getStatus()); <add> verifyNoMoreInteractions(this.xhrSendHandler); <add> } <add> <ide> @Test <ide> public void handleTransportRequestJsonp() throws Exception { <ide> TransportHandlingSockJsService jsonpService = new TransportHandlingSockJsService(this.taskScheduler, this.jsonpHandler, this.jsonpSendHandler);
2
Javascript
Javascript
fix jshint warnings
47b5ad60ae798787bad97f2d478dab396536b752
<ide><path>src/elements/element.line.js <ide> module.exports = function(Chart) { <ide> points.push(points[0]); <ide> } <ide> <add> var index, current, previous, currentVM; <add> <ide> // Fill Line <ide> if (points.length && vm.fill) { <ide> ctx.beginPath(); <ide> <del> for (var index = 0; index < points.length; ++index) { <del> var current = points[index]; <del> var previous = helpers.previousItem(points, index); <del> <del> var currentVM = current._view; <add> for (index = 0; index < points.length; ++index) { <add> current = points[index]; <add> previous = helpers.previousItem(points, index); <add> currentVM = current._view; <ide> <ide> // First point moves to it's starting position no matter what <ide> if (index === 0) { <ide> module.exports = function(Chart) { <ide> // If the first data point is NaN, then there is no real gap to skip <ide> if (spanGaps && lastDrawnIndex !== -1) { <ide> // We are spanning the gap, so simple draw a line to this point <del> lineToPoint(previous, current) <add> lineToPoint(previous, current); <ide> } else { <ide> if (loop) { <ide> ctx.lineTo(currentVM.x, currentVM.y); <ide> module.exports = function(Chart) { <ide> ctx.beginPath(); <ide> lastDrawnIndex = -1; <ide> <del> for (var index = 0; index < points.length; ++index) { <del> var current = points[index]; <del> var previous = helpers.previousItem(points, index); <del> var currentVM = current._view; <add> for (index = 0; index < points.length; ++index) { <add> current = points[index]; <add> previous = helpers.previousItem(points, index); <add> currentVM = current._view; <ide> <ide> // First point moves to it's starting position no matter what <ide> if (index === 0) {
1
Python
Python
fix exception message from 3190abcd. refs
0a0fe8f71d54e8479e3050ef3bb9d545fd734a65
<ide><path>django/db/models/fields/related.py <ide> def __set__(self, instance, value): <ide> related_pk = getattr(instance, self.related.field.rel.get_related_field().attname) <ide> if related_pk is None: <ide> raise ValueError('Cannot assign "%r": "%s" instance isn\'t saved in the database.' % <del> (value, self.related.opts.object_name)) <add> (value, instance._meta.object_name)) <ide> <ide> # Set the value of the related field to the value of the related object's related field <ide> setattr(value, self.related.field.attname, related_pk)
1
Javascript
Javascript
put perf integration behind a feature flag
3b27160f82d9934f7ea9ddf064424634526702ca
<ide><path>packages/react-cs-renderer/src/ReactNativeCSFeatureFlags.js <ide> * @flow <ide> */ <ide> <add>import invariant from 'fbjs/lib/invariant'; <add> <ide> import typeof * as FeatureFlagsType from 'shared/ReactFeatureFlags'; <ide> import typeof * as CSFeatureFlagsType from './ReactNativeCSFeatureFlags'; <ide> <ide> export const enableAsyncSubtreeAPI = true; <ide> export const enableAsyncSchedulingByDefaultInReactDOM = false; <ide> export const enableReactFragment = false; <ide> export const enableCreateRoot = false; <add>export const enableUserTimingAPI = __DEV__; <ide> <ide> // React Native CS uses persistent reconciler. <ide> export const enableMutatingReconciler = false; <ide> export const enableNoopReconciler = false; <ide> export const enablePersistentReconciler = true; <ide> <add>// Only used in www builds. <add>export function addUserTimingListener() { <add> invariant(false, 'Not implemented.'); <add>} <add> <ide> // Flow magic to verify the exports of this file match the original version. <ide> // eslint-disable-next-line no-unused-vars <ide> type Check<_X, Y: _X, X: Y=_X> = null; <ide><path>packages/react-dom/src/client/ReactDOMFB.js <ide> import * as ReactInstanceMap from 'shared/ReactInstanceMap'; <ide> import * as ReactFiberErrorLogger <ide> from 'react-reconciler/src/ReactFiberErrorLogger'; <ide> import ReactErrorUtils from 'shared/ReactErrorUtils'; <add>import {addUserTimingListener} from 'shared/ReactFeatureFlags'; <ide> <ide> import ReactDOM from './ReactDOM'; <ide> import * as ReactBrowserEventEmitter from '../events/ReactBrowserEventEmitter'; <ide> Object.assign( <ide> ReactInstanceMap, <ide> // Used by www msite: <ide> TapEventPlugin, <add> // Perf experiment <add> addUserTimingListener, <ide> }, <ide> ); <ide> <ide><path>packages/react-reconciler/src/ReactDebugFiberPerf.js <ide> <ide> import type {Fiber} from './ReactFiber'; <ide> <add>import {enableUserTimingAPI} from 'shared/ReactFeatureFlags'; <ide> import getComponentName from 'shared/getComponentName'; <ide> import { <ide> HostRoot, <ide> import { <ide> Fragment, <ide> } from 'shared/ReactTypeOfWork'; <ide> <del>// Trust the developer to only use this with a __DEV__ check <del>let ReactDebugFiberPerf = (({}: any): typeof ReactDebugFiberPerf); <del> <ide> type MeasurementPhase = <ide> | 'componentWillMount' <ide> | 'componentWillUnmount' <ide> type MeasurementPhase = <ide> | 'componentDidMount' <ide> | 'getChildContext'; <ide> <del>if (__DEV__) { <del> // Prefix measurements so that it's possible to filter them. <del> // Longer prefixes are hard to read in DevTools. <del> const reactEmoji = '\u269B'; <del> const warningEmoji = '\u26D4'; <del> const supportsUserTiming = <del> typeof performance !== 'undefined' && <del> typeof performance.mark === 'function' && <del> typeof performance.clearMarks === 'function' && <del> typeof performance.measure === 'function' && <del> typeof performance.clearMeasures === 'function'; <del> <del> // Keep track of current fiber so that we know the path to unwind on pause. <del> // TODO: this looks the same as nextUnitOfWork in scheduler. Can we unify them? <del> let currentFiber: Fiber | null = null; <del> // If we're in the middle of user code, which fiber and method is it? <del> // Reusing `currentFiber` would be confusing for this because user code fiber <del> // can change during commit phase too, but we don't need to unwind it (since <del> // lifecycles in the commit phase don't resemble a tree). <del> let currentPhase: MeasurementPhase | null = null; <del> let currentPhaseFiber: Fiber | null = null; <del> // Did lifecycle hook schedule an update? This is often a performance problem, <del> // so we will keep track of it, and include it in the report. <del> // Track commits caused by cascading updates. <del> let isCommitting: boolean = false; <del> let hasScheduledUpdateInCurrentCommit: boolean = false; <del> let hasScheduledUpdateInCurrentPhase: boolean = false; <del> let commitCountInCurrentWorkLoop: number = 0; <del> let effectCountInCurrentCommit: number = 0; <del> // During commits, we only show a measurement once per method name <del> // to avoid stretch the commit phase with measurement overhead. <del> const labelsInCurrentCommit: Set<string> = new Set(); <del> <del> const formatMarkName = (markName: string) => { <del> return `${reactEmoji} ${markName}`; <del> }; <del> <del> const formatLabel = (label: string, warning: string | null) => { <del> const prefix = warning ? `${warningEmoji} ` : `${reactEmoji} `; <del> const suffix = warning ? ` Warning: ${warning}` : ''; <del> return `${prefix}${label}${suffix}`; <del> }; <del> <del> const beginMark = (markName: string) => { <del> performance.mark(formatMarkName(markName)); <del> }; <del> <del> const clearMark = (markName: string) => { <del> performance.clearMarks(formatMarkName(markName)); <del> }; <del> <del> const endMark = (label: string, markName: string, warning: string | null) => { <del> const formattedMarkName = formatMarkName(markName); <del> const formattedLabel = formatLabel(label, warning); <del> try { <del> performance.measure(formattedLabel, formattedMarkName); <del> } catch (err) { <del> // If previous mark was missing for some reason, this will throw. <del> // This could only happen if React crashed in an unexpected place earlier. <del> // Don't pile on with more errors. <add>// Prefix measurements so that it's possible to filter them. <add>// Longer prefixes are hard to read in DevTools. <add>const reactEmoji = '\u269B'; <add>const warningEmoji = '\u26D4'; <add>const supportsUserTiming = <add> typeof performance !== 'undefined' && <add> typeof performance.mark === 'function' && <add> typeof performance.clearMarks === 'function' && <add> typeof performance.measure === 'function' && <add> typeof performance.clearMeasures === 'function'; <add> <add>// Keep track of current fiber so that we know the path to unwind on pause. <add>// TODO: this looks the same as nextUnitOfWork in scheduler. Can we unify them? <add>let currentFiber: Fiber | null = null; <add>// If we're in the middle of user code, which fiber and method is it? <add>// Reusing `currentFiber` would be confusing for this because user code fiber <add>// can change during commit phase too, but we don't need to unwind it (since <add>// lifecycles in the commit phase don't resemble a tree). <add>let currentPhase: MeasurementPhase | null = null; <add>let currentPhaseFiber: Fiber | null = null; <add>// Did lifecycle hook schedule an update? This is often a performance problem, <add>// so we will keep track of it, and include it in the report. <add>// Track commits caused by cascading updates. <add>let isCommitting: boolean = false; <add>let hasScheduledUpdateInCurrentCommit: boolean = false; <add>let hasScheduledUpdateInCurrentPhase: boolean = false; <add>let commitCountInCurrentWorkLoop: number = 0; <add>let effectCountInCurrentCommit: number = 0; <add>// During commits, we only show a measurement once per method name <add>// to avoid stretch the commit phase with measurement overhead. <add>const labelsInCurrentCommit: Set<string> = new Set(); <add> <add>const formatMarkName = (markName: string) => { <add> return `${reactEmoji} ${markName}`; <add>}; <add> <add>const formatLabel = (label: string, warning: string | null) => { <add> const prefix = warning ? `${warningEmoji} ` : `${reactEmoji} `; <add> const suffix = warning ? ` Warning: ${warning}` : ''; <add> return `${prefix}${label}${suffix}`; <add>}; <add> <add>const beginMark = (markName: string) => { <add> performance.mark(formatMarkName(markName)); <add>}; <add> <add>const clearMark = (markName: string) => { <add> performance.clearMarks(formatMarkName(markName)); <add>}; <add> <add>const endMark = (label: string, markName: string, warning: string | null) => { <add> const formattedMarkName = formatMarkName(markName); <add> const formattedLabel = formatLabel(label, warning); <add> try { <add> performance.measure(formattedLabel, formattedMarkName); <add> } catch (err) { <add> // If previous mark was missing for some reason, this will throw. <add> // This could only happen if React crashed in an unexpected place earlier. <add> // Don't pile on with more errors. <add> } <add> // Clear marks immediately to avoid growing buffer. <add> performance.clearMarks(formattedMarkName); <add> performance.clearMeasures(formattedLabel); <add>}; <add> <add>const getFiberMarkName = (label: string, debugID: number) => { <add> return `${label} (#${debugID})`; <add>}; <add> <add>const getFiberLabel = ( <add> componentName: string, <add> isMounted: boolean, <add> phase: MeasurementPhase | null, <add>) => { <add> if (phase === null) { <add> // These are composite component total time measurements. <add> return `${componentName} [${isMounted ? 'update' : 'mount'}]`; <add> } else { <add> // Composite component methods. <add> return `${componentName}.${phase}`; <add> } <add>}; <add> <add>const beginFiberMark = ( <add> fiber: Fiber, <add> phase: MeasurementPhase | null, <add>): boolean => { <add> const componentName = getComponentName(fiber) || 'Unknown'; <add> const debugID = ((fiber._debugID: any): number); <add> const isMounted = fiber.alternate !== null; <add> const label = getFiberLabel(componentName, isMounted, phase); <add> <add> if (isCommitting && labelsInCurrentCommit.has(label)) { <add> // During the commit phase, we don't show duplicate labels because <add> // there is a fixed overhead for every measurement, and we don't <add> // want to stretch the commit phase beyond necessary. <add> return false; <add> } <add> labelsInCurrentCommit.add(label); <add> <add> const markName = getFiberMarkName(label, debugID); <add> beginMark(markName); <add> return true; <add>}; <add> <add>const clearFiberMark = (fiber: Fiber, phase: MeasurementPhase | null) => { <add> const componentName = getComponentName(fiber) || 'Unknown'; <add> const debugID = ((fiber._debugID: any): number); <add> const isMounted = fiber.alternate !== null; <add> const label = getFiberLabel(componentName, isMounted, phase); <add> const markName = getFiberMarkName(label, debugID); <add> clearMark(markName); <add>}; <add> <add>const endFiberMark = ( <add> fiber: Fiber, <add> phase: MeasurementPhase | null, <add> warning: string | null, <add>) => { <add> const componentName = getComponentName(fiber) || 'Unknown'; <add> const debugID = ((fiber._debugID: any): number); <add> const isMounted = fiber.alternate !== null; <add> const label = getFiberLabel(componentName, isMounted, phase); <add> const markName = getFiberMarkName(label, debugID); <add> endMark(label, markName, warning); <add>}; <add> <add>const shouldIgnoreFiber = (fiber: Fiber): boolean => { <add> // Host components should be skipped in the timeline. <add> // We could check typeof fiber.type, but does this work with RN? <add> switch (fiber.tag) { <add> case HostRoot: <add> case HostComponent: <add> case HostText: <add> case HostPortal: <add> case ReturnComponent: <add> case Fragment: <add> return true; <add> default: <add> return false; <add> } <add>}; <add> <add>const clearPendingPhaseMeasurement = () => { <add> if (currentPhase !== null && currentPhaseFiber !== null) { <add> clearFiberMark(currentPhaseFiber, currentPhase); <add> } <add> currentPhaseFiber = null; <add> currentPhase = null; <add> hasScheduledUpdateInCurrentPhase = false; <add>}; <add> <add>const pauseTimers = () => { <add> // Stops all currently active measurements so that they can be resumed <add> // if we continue in a later deferred loop from the same unit of work. <add> let fiber = currentFiber; <add> while (fiber) { <add> if (fiber._debugIsCurrentlyTiming) { <add> endFiberMark(fiber, null, null); <ide> } <del> // Clear marks immediately to avoid growing buffer. <del> performance.clearMarks(formattedMarkName); <del> performance.clearMeasures(formattedLabel); <del> }; <del> <del> const getFiberMarkName = (label: string, debugID: number) => { <del> return `${label} (#${debugID})`; <del> }; <del> <del> const getFiberLabel = ( <del> componentName: string, <del> isMounted: boolean, <del> phase: MeasurementPhase | null, <del> ) => { <del> if (phase === null) { <del> // These are composite component total time measurements. <del> return `${componentName} [${isMounted ? 'update' : 'mount'}]`; <del> } else { <del> // Composite component methods. <del> return `${componentName}.${phase}`; <add> fiber = fiber.return; <add> } <add>}; <add> <add>const resumeTimersRecursively = (fiber: Fiber) => { <add> if (fiber.return !== null) { <add> resumeTimersRecursively(fiber.return); <add> } <add> if (fiber._debugIsCurrentlyTiming) { <add> beginFiberMark(fiber, null); <add> } <add>}; <add> <add>const resumeTimers = () => { <add> // Resumes all measurements that were active during the last deferred loop. <add> if (currentFiber !== null) { <add> resumeTimersRecursively(currentFiber); <add> } <add>}; <add> <add>export function recordEffect(): void { <add> if (enableUserTimingAPI) { <add> effectCountInCurrentCommit++; <add> } <add>} <add> <add>export function recordScheduleUpdate(): void { <add> if (enableUserTimingAPI) { <add> if (isCommitting) { <add> hasScheduledUpdateInCurrentCommit = true; <ide> } <del> }; <del> <del> const beginFiberMark = ( <del> fiber: Fiber, <del> phase: MeasurementPhase | null, <del> ): boolean => { <del> const componentName = getComponentName(fiber) || 'Unknown'; <del> const debugID = ((fiber._debugID: any): number); <del> const isMounted = fiber.alternate !== null; <del> const label = getFiberLabel(componentName, isMounted, phase); <del> <del> if (isCommitting && labelsInCurrentCommit.has(label)) { <del> // During the commit phase, we don't show duplicate labels because <del> // there is a fixed overhead for every measurement, and we don't <del> // want to stretch the commit phase beyond necessary. <del> return false; <add> if ( <add> currentPhase !== null && <add> currentPhase !== 'componentWillMount' && <add> currentPhase !== 'componentWillReceiveProps' <add> ) { <add> hasScheduledUpdateInCurrentPhase = true; <ide> } <del> labelsInCurrentCommit.add(label); <del> <del> const markName = getFiberMarkName(label, debugID); <del> beginMark(markName); <del> return true; <del> }; <del> <del> const clearFiberMark = (fiber: Fiber, phase: MeasurementPhase | null) => { <del> const componentName = getComponentName(fiber) || 'Unknown'; <del> const debugID = ((fiber._debugID: any): number); <del> const isMounted = fiber.alternate !== null; <del> const label = getFiberLabel(componentName, isMounted, phase); <del> const markName = getFiberMarkName(label, debugID); <del> clearMark(markName); <del> }; <del> <del> const endFiberMark = ( <del> fiber: Fiber, <del> phase: MeasurementPhase | null, <del> warning: string | null, <del> ) => { <del> const componentName = getComponentName(fiber) || 'Unknown'; <del> const debugID = ((fiber._debugID: any): number); <del> const isMounted = fiber.alternate !== null; <del> const label = getFiberLabel(componentName, isMounted, phase); <del> const markName = getFiberMarkName(label, debugID); <del> endMark(label, markName, warning); <del> }; <del> <del> const shouldIgnoreFiber = (fiber: Fiber): boolean => { <del> // Host components should be skipped in the timeline. <del> // We could check typeof fiber.type, but does this work with RN? <del> switch (fiber.tag) { <del> case HostRoot: <del> case HostComponent: <del> case HostText: <del> case HostPortal: <del> case ReturnComponent: <del> case Fragment: <del> return true; <del> default: <del> return false; <add> } <add>} <add> <add>export function startWorkTimer(fiber: Fiber): void { <add> if (enableUserTimingAPI) { <add> if (!supportsUserTiming || shouldIgnoreFiber(fiber)) { <add> return; <ide> } <del> }; <add> // If we pause, this is the fiber to unwind from. <add> currentFiber = fiber; <add> if (!beginFiberMark(fiber, null)) { <add> return; <add> } <add> fiber._debugIsCurrentlyTiming = true; <add> } <add>} <add> <add>export function cancelWorkTimer(fiber: Fiber): void { <add> if (enableUserTimingAPI) { <add> if (!supportsUserTiming || shouldIgnoreFiber(fiber)) { <add> return; <add> } <add> // Remember we shouldn't complete measurement for this fiber. <add> // Otherwise flamechart will be deep even for small updates. <add> fiber._debugIsCurrentlyTiming = false; <add> clearFiberMark(fiber, null); <add> } <add>} <ide> <del> const clearPendingPhaseMeasurement = () => { <add>export function stopWorkTimer(fiber: Fiber): void { <add> if (enableUserTimingAPI) { <add> if (!supportsUserTiming || shouldIgnoreFiber(fiber)) { <add> return; <add> } <add> // If we pause, its parent is the fiber to unwind from. <add> currentFiber = fiber.return; <add> if (!fiber._debugIsCurrentlyTiming) { <add> return; <add> } <add> fiber._debugIsCurrentlyTiming = false; <add> endFiberMark(fiber, null, null); <add> } <add>} <add> <add>export function stopFailedWorkTimer(fiber: Fiber): void { <add> if (enableUserTimingAPI) { <add> if (!supportsUserTiming || shouldIgnoreFiber(fiber)) { <add> return; <add> } <add> // If we pause, its parent is the fiber to unwind from. <add> currentFiber = fiber.return; <add> if (!fiber._debugIsCurrentlyTiming) { <add> return; <add> } <add> fiber._debugIsCurrentlyTiming = false; <add> const warning = 'An error was thrown inside this error boundary'; <add> endFiberMark(fiber, null, warning); <add> } <add>} <add> <add>export function startPhaseTimer(fiber: Fiber, phase: MeasurementPhase): void { <add> if (enableUserTimingAPI) { <add> if (!supportsUserTiming) { <add> return; <add> } <add> clearPendingPhaseMeasurement(); <add> if (!beginFiberMark(fiber, phase)) { <add> return; <add> } <add> currentPhaseFiber = fiber; <add> currentPhase = phase; <add> } <add>} <add> <add>export function stopPhaseTimer(): void { <add> if (enableUserTimingAPI) { <add> if (!supportsUserTiming) { <add> return; <add> } <ide> if (currentPhase !== null && currentPhaseFiber !== null) { <del> clearFiberMark(currentPhaseFiber, currentPhase); <add> const warning = hasScheduledUpdateInCurrentPhase <add> ? 'Scheduled a cascading update' <add> : null; <add> endFiberMark(currentPhaseFiber, currentPhase, warning); <ide> } <del> currentPhaseFiber = null; <ide> currentPhase = null; <del> hasScheduledUpdateInCurrentPhase = false; <del> }; <del> <del> const pauseTimers = () => { <del> // Stops all currently active measurements so that they can be resumed <del> // if we continue in a later deferred loop from the same unit of work. <del> let fiber = currentFiber; <del> while (fiber) { <del> if (fiber._debugIsCurrentlyTiming) { <del> endFiberMark(fiber, null, null); <del> } <del> fiber = fiber.return; <add> currentPhaseFiber = null; <add> } <add>} <add> <add>export function startWorkLoopTimer(): void { <add> if (enableUserTimingAPI) { <add> if (!supportsUserTiming) { <add> return; <ide> } <del> }; <add> commitCountInCurrentWorkLoop = 0; <add> // This is top level call. <add> // Any other measurements are performed within. <add> beginMark('(React Tree Reconciliation)'); <add> // Resume any measurements that were in progress during the last loop. <add> resumeTimers(); <add> } <add>} <ide> <del> const resumeTimersRecursively = (fiber: Fiber) => { <del> if (fiber.return !== null) { <del> resumeTimersRecursively(fiber.return); <add>export function stopWorkLoopTimer(): void { <add> if (enableUserTimingAPI) { <add> if (!supportsUserTiming) { <add> return; <ide> } <del> if (fiber._debugIsCurrentlyTiming) { <del> beginFiberMark(fiber, null); <add> const warning = commitCountInCurrentWorkLoop > 1 <add> ? 'There were cascading updates' <add> : null; <add> commitCountInCurrentWorkLoop = 0; <add> // Pause any measurements until the next loop. <add> pauseTimers(); <add> endMark( <add> '(React Tree Reconciliation)', <add> '(React Tree Reconciliation)', <add> warning, <add> ); <add> } <add>} <add> <add>export function startCommitTimer(): void { <add> if (enableUserTimingAPI) { <add> if (!supportsUserTiming) { <add> return; <ide> } <del> }; <add> isCommitting = true; <add> hasScheduledUpdateInCurrentCommit = false; <add> labelsInCurrentCommit.clear(); <add> beginMark('(Committing Changes)'); <add> } <add>} <ide> <del> const resumeTimers = () => { <del> // Resumes all measurements that were active during the last deferred loop. <del> if (currentFiber !== null) { <del> resumeTimersRecursively(currentFiber); <add>export function stopCommitTimer(): void { <add> if (enableUserTimingAPI) { <add> if (!supportsUserTiming) { <add> return; <ide> } <del> }; <del> <del> ReactDebugFiberPerf = { <del> recordEffect(): void { <del> effectCountInCurrentCommit++; <del> }, <del> <del> recordScheduleUpdate(): void { <del> if (isCommitting) { <del> hasScheduledUpdateInCurrentCommit = true; <del> } <del> if ( <del> currentPhase !== null && <del> currentPhase !== 'componentWillMount' && <del> currentPhase !== 'componentWillReceiveProps' <del> ) { <del> hasScheduledUpdateInCurrentPhase = true; <del> } <del> }, <del> <del> startWorkTimer(fiber: Fiber): void { <del> if (!supportsUserTiming || shouldIgnoreFiber(fiber)) { <del> return; <del> } <del> // If we pause, this is the fiber to unwind from. <del> currentFiber = fiber; <del> if (!beginFiberMark(fiber, null)) { <del> return; <del> } <del> fiber._debugIsCurrentlyTiming = true; <del> }, <del> <del> cancelWorkTimer(fiber: Fiber): void { <del> if (!supportsUserTiming || shouldIgnoreFiber(fiber)) { <del> return; <del> } <del> // Remember we shouldn't complete measurement for this fiber. <del> // Otherwise flamechart will be deep even for small updates. <del> fiber._debugIsCurrentlyTiming = false; <del> clearFiberMark(fiber, null); <del> }, <del> <del> stopWorkTimer(fiber: Fiber): void { <del> if (!supportsUserTiming || shouldIgnoreFiber(fiber)) { <del> return; <del> } <del> // If we pause, its parent is the fiber to unwind from. <del> currentFiber = fiber.return; <del> if (!fiber._debugIsCurrentlyTiming) { <del> return; <del> } <del> fiber._debugIsCurrentlyTiming = false; <del> endFiberMark(fiber, null, null); <del> }, <del> <del> stopFailedWorkTimer(fiber: Fiber): void { <del> if (!supportsUserTiming || shouldIgnoreFiber(fiber)) { <del> return; <del> } <del> // If we pause, its parent is the fiber to unwind from. <del> currentFiber = fiber.return; <del> if (!fiber._debugIsCurrentlyTiming) { <del> return; <del> } <del> fiber._debugIsCurrentlyTiming = false; <del> const warning = 'An error was thrown inside this error boundary'; <del> endFiberMark(fiber, null, warning); <del> }, <del> <del> startPhaseTimer(fiber: Fiber, phase: MeasurementPhase): void { <del> if (!supportsUserTiming) { <del> return; <del> } <del> clearPendingPhaseMeasurement(); <del> if (!beginFiberMark(fiber, phase)) { <del> return; <del> } <del> currentPhaseFiber = fiber; <del> currentPhase = phase; <del> }, <del> <del> stopPhaseTimer(): void { <del> if (!supportsUserTiming) { <del> return; <del> } <del> if (currentPhase !== null && currentPhaseFiber !== null) { <del> const warning = hasScheduledUpdateInCurrentPhase <del> ? 'Scheduled a cascading update' <del> : null; <del> endFiberMark(currentPhaseFiber, currentPhase, warning); <del> } <del> currentPhase = null; <del> currentPhaseFiber = null; <del> }, <del> <del> startWorkLoopTimer(): void { <del> if (!supportsUserTiming) { <del> return; <del> } <del> commitCountInCurrentWorkLoop = 0; <del> // This is top level call. <del> // Any other measurements are performed within. <del> beginMark('(React Tree Reconciliation)'); <del> // Resume any measurements that were in progress during the last loop. <del> resumeTimers(); <del> }, <del> <del> stopWorkLoopTimer(): void { <del> if (!supportsUserTiming) { <del> return; <del> } <del> const warning = commitCountInCurrentWorkLoop > 1 <del> ? 'There were cascading updates' <del> : null; <del> commitCountInCurrentWorkLoop = 0; <del> // Pause any measurements until the next loop. <del> pauseTimers(); <del> endMark( <del> '(React Tree Reconciliation)', <del> '(React Tree Reconciliation)', <del> warning, <del> ); <del> }, <del> <del> startCommitTimer(): void { <del> if (!supportsUserTiming) { <del> return; <del> } <del> isCommitting = true; <del> hasScheduledUpdateInCurrentCommit = false; <del> labelsInCurrentCommit.clear(); <del> beginMark('(Committing Changes)'); <del> }, <del> <del> stopCommitTimer(): void { <del> if (!supportsUserTiming) { <del> return; <del> } <del> <del> let warning = null; <del> if (hasScheduledUpdateInCurrentCommit) { <del> warning = 'Lifecycle hook scheduled a cascading update'; <del> } else if (commitCountInCurrentWorkLoop > 0) { <del> warning = 'Caused by a cascading update in earlier commit'; <del> } <del> hasScheduledUpdateInCurrentCommit = false; <del> commitCountInCurrentWorkLoop++; <del> isCommitting = false; <del> labelsInCurrentCommit.clear(); <del> <del> endMark('(Committing Changes)', '(Committing Changes)', warning); <del> }, <del> <del> startCommitHostEffectsTimer(): void { <del> if (!supportsUserTiming) { <del> return; <del> } <del> effectCountInCurrentCommit = 0; <del> beginMark('(Committing Host Effects)'); <del> }, <del> <del> stopCommitHostEffectsTimer(): void { <del> if (!supportsUserTiming) { <del> return; <del> } <del> const count = effectCountInCurrentCommit; <del> effectCountInCurrentCommit = 0; <del> endMark( <del> `(Committing Host Effects: ${count} Total)`, <del> '(Committing Host Effects)', <del> null, <del> ); <del> }, <del> <del> startCommitLifeCyclesTimer(): void { <del> if (!supportsUserTiming) { <del> return; <del> } <del> effectCountInCurrentCommit = 0; <del> beginMark('(Calling Lifecycle Methods)'); <del> }, <del> <del> stopCommitLifeCyclesTimer(): void { <del> if (!supportsUserTiming) { <del> return; <del> } <del> const count = effectCountInCurrentCommit; <del> effectCountInCurrentCommit = 0; <del> endMark( <del> `(Calling Lifecycle Methods: ${count} Total)`, <del> '(Calling Lifecycle Methods)', <del> null, <del> ); <del> }, <del> }; <add> <add> let warning = null; <add> if (hasScheduledUpdateInCurrentCommit) { <add> warning = 'Lifecycle hook scheduled a cascading update'; <add> } else if (commitCountInCurrentWorkLoop > 0) { <add> warning = 'Caused by a cascading update in earlier commit'; <add> } <add> hasScheduledUpdateInCurrentCommit = false; <add> commitCountInCurrentWorkLoop++; <add> isCommitting = false; <add> labelsInCurrentCommit.clear(); <add> <add> endMark('(Committing Changes)', '(Committing Changes)', warning); <add> } <ide> } <ide> <del>// TODO: convert to named exports <del>// if this doesn't inflate the bundle. <del>export default ReactDebugFiberPerf; <add>export function startCommitHostEffectsTimer(): void { <add> if (enableUserTimingAPI) { <add> if (!supportsUserTiming) { <add> return; <add> } <add> effectCountInCurrentCommit = 0; <add> beginMark('(Committing Host Effects)'); <add> } <add>} <add> <add>export function stopCommitHostEffectsTimer(): void { <add> if (enableUserTimingAPI) { <add> if (!supportsUserTiming) { <add> return; <add> } <add> const count = effectCountInCurrentCommit; <add> effectCountInCurrentCommit = 0; <add> endMark( <add> `(Committing Host Effects: ${count} Total)`, <add> '(Committing Host Effects)', <add> null, <add> ); <add> } <add>} <add> <add>export function startCommitLifeCyclesTimer(): void { <add> if (enableUserTimingAPI) { <add> if (!supportsUserTiming) { <add> return; <add> } <add> effectCountInCurrentCommit = 0; <add> beginMark('(Calling Lifecycle Methods)'); <add> } <add>} <add> <add>export function stopCommitLifeCyclesTimer(): void { <add> if (enableUserTimingAPI) { <add> if (!supportsUserTiming) { <add> return; <add> } <add> const count = effectCountInCurrentCommit; <add> effectCountInCurrentCommit = 0; <add> endMark( <add> `(Calling Lifecycle Methods: ${count} Total)`, <add> '(Calling Lifecycle Methods)', <add> null, <add> ); <add> } <add>} <ide><path>packages/react-reconciler/src/ReactFiberBeginWork.js <ide> import invariant from 'fbjs/lib/invariant'; <ide> import getComponentName from 'shared/getComponentName'; <ide> import warning from 'fbjs/lib/warning'; <ide> import ReactDebugCurrentFiber from './ReactDebugCurrentFiber'; <del>import ReactDebugFiberPerf from './ReactDebugFiberPerf'; <add>import {cancelWorkTimer} from './ReactDebugFiberPerf'; <ide> <ide> import ReactFiberClassComponent from './ReactFiberClassComponent'; <ide> import { <ide> import { <ide> } from './ReactFiberContext'; <ide> import {NoWork, Never} from './ReactFiberExpirationTime'; <ide> <del>var {cancelWorkTimer} = ReactDebugFiberPerf; <ide> if (__DEV__) { <ide> var warnedAboutStatelessRefs = {}; <ide> } <ide> export default function<T, P, I, TI, PI, C, CC, CX, PL>( <ide> current, <ide> workInProgress: Fiber, <ide> ): Fiber | null { <del> if (__DEV__) { <del> cancelWorkTimer(workInProgress); <del> } <add> cancelWorkTimer(workInProgress); <ide> <ide> // TODO: We should ideally be able to bail out early if the children have no <ide> // more work to do. However, since we don't have a separation of this <ide> export default function<T, P, I, TI, PI, C, CC, CX, PL>( <ide> } <ide> <ide> function bailoutOnLowPriority(current, workInProgress) { <del> if (__DEV__) { <del> cancelWorkTimer(workInProgress); <del> } <add> cancelWorkTimer(workInProgress); <ide> <ide> // TODO: Handle HostComponent tags here as well and call pushHostContext()? <ide> // See PR 8590 discussion for context <ide><path>packages/react-reconciler/src/ReactFiberClassComponent.js <ide> import shallowEqual from 'fbjs/lib/shallowEqual'; <ide> import invariant from 'fbjs/lib/invariant'; <ide> import warning from 'fbjs/lib/warning'; <ide> <del>import ReactDebugFiberPerf from './ReactDebugFiberPerf'; <add>import {startPhaseTimer, stopPhaseTimer} from './ReactDebugFiberPerf'; <ide> import {AsyncUpdates} from './ReactTypeOfInternalContext'; <ide> import { <ide> cacheContext, <ide> import { <ide> } from './ReactFiberUpdateQueue'; <ide> import {hasContextChanged} from './ReactFiberContext'; <ide> <del>var {startPhaseTimer, stopPhaseTimer} = ReactDebugFiberPerf; <ide> const fakeInternalInstance = {}; <ide> const isArray = Array.isArray; <ide> <ide> export default function( <ide> const instance = workInProgress.stateNode; <ide> const type = workInProgress.type; <ide> if (typeof instance.shouldComponentUpdate === 'function') { <del> if (__DEV__) { <del> startPhaseTimer(workInProgress, 'shouldComponentUpdate'); <del> } <add> startPhaseTimer(workInProgress, 'shouldComponentUpdate'); <ide> const shouldUpdate = instance.shouldComponentUpdate( <ide> newProps, <ide> newState, <ide> newContext, <ide> ); <del> if (__DEV__) { <del> stopPhaseTimer(); <del> } <add> stopPhaseTimer(); <ide> <ide> if (__DEV__) { <ide> warning( <ide> export default function( <ide> } <ide> <ide> function callComponentWillMount(workInProgress, instance) { <del> if (__DEV__) { <del> startPhaseTimer(workInProgress, 'componentWillMount'); <del> } <add> startPhaseTimer(workInProgress, 'componentWillMount'); <ide> const oldState = instance.state; <ide> instance.componentWillMount(); <del> if (__DEV__) { <del> stopPhaseTimer(); <del> } <add> <add> stopPhaseTimer(); <ide> <ide> if (oldState !== instance.state) { <ide> if (__DEV__) { <ide> export default function( <ide> newProps, <ide> newContext, <ide> ) { <del> if (__DEV__) { <del> startPhaseTimer(workInProgress, 'componentWillReceiveProps'); <del> } <add> startPhaseTimer(workInProgress, 'componentWillReceiveProps'); <ide> const oldState = instance.state; <ide> instance.componentWillReceiveProps(newProps, newContext); <del> if (__DEV__) { <del> stopPhaseTimer(); <del> } <add> stopPhaseTimer(); <ide> <ide> if (instance.state !== oldState) { <ide> if (__DEV__) { <ide> export default function( <ide> <ide> if (shouldUpdate) { <ide> if (typeof instance.componentWillUpdate === 'function') { <del> if (__DEV__) { <del> startPhaseTimer(workInProgress, 'componentWillUpdate'); <del> } <add> startPhaseTimer(workInProgress, 'componentWillUpdate'); <ide> instance.componentWillUpdate(newProps, newState, newContext); <del> if (__DEV__) { <del> stopPhaseTimer(); <del> } <add> stopPhaseTimer(); <ide> } <ide> if (typeof instance.componentDidUpdate === 'function') { <ide> workInProgress.effectTag |= Update; <ide><path>packages/react-reconciler/src/ReactFiberCommitWork.js <ide> import invariant from 'fbjs/lib/invariant'; <ide> <ide> import {commitCallbacks} from './ReactFiberUpdateQueue'; <ide> import {onCommitUnmount} from './ReactFiberDevToolsHook'; <del>import ReactDebugFiberPerf from './ReactDebugFiberPerf'; <add>import {startPhaseTimer, stopPhaseTimer} from './ReactDebugFiberPerf'; <ide> <ide> var {invokeGuardedCallback, hasCaughtError, clearCaughtError} = ReactErrorUtils; <del>var {startPhaseTimer, stopPhaseTimer} = ReactDebugFiberPerf; <ide> <ide> export default function<T, P, I, TI, PI, C, CC, CX, PL>( <ide> config: HostConfig<T, P, I, TI, PI, C, CC, CX, PL>, <ide> captureError: (failedFiber: Fiber, error: mixed) => Fiber | null, <ide> ) { <ide> const {getPublicInstance, mutation, persistence} = config; <ide> <del> if (__DEV__) { <del> var callComponentWillUnmountWithTimerInDev = function(current, instance) { <del> startPhaseTimer(current, 'componentWillUnmount'); <del> instance.props = current.memoizedProps; <del> instance.state = current.memoizedState; <del> instance.componentWillUnmount(); <del> stopPhaseTimer(); <del> }; <del> } <add> var callComponentWillUnmountWithTimer = function(current, instance) { <add> startPhaseTimer(current, 'componentWillUnmount'); <add> instance.props = current.memoizedProps; <add> instance.state = current.memoizedState; <add> instance.componentWillUnmount(); <add> stopPhaseTimer(); <add> }; <ide> <ide> // Capture errors so they don't interrupt unmounting. <ide> function safelyCallComponentWillUnmount(current, instance) { <ide> if (__DEV__) { <ide> invokeGuardedCallback( <ide> null, <del> callComponentWillUnmountWithTimerInDev, <add> callComponentWillUnmountWithTimer, <ide> null, <ide> current, <ide> instance, <ide> export default function<T, P, I, TI, PI, C, CC, CX, PL>( <ide> } <ide> } else { <ide> try { <del> instance.props = current.memoizedProps; <del> instance.state = current.memoizedState; <del> instance.componentWillUnmount(); <add> callComponentWillUnmountWithTimer(current, instance); <ide> } catch (unmountError) { <ide> captureError(current, unmountError); <ide> } <ide> export default function<T, P, I, TI, PI, C, CC, CX, PL>( <ide> const instance = finishedWork.stateNode; <ide> if (finishedWork.effectTag & Update) { <ide> if (current === null) { <del> if (__DEV__) { <del> startPhaseTimer(finishedWork, 'componentDidMount'); <del> } <add> startPhaseTimer(finishedWork, 'componentDidMount'); <ide> instance.props = finishedWork.memoizedProps; <ide> instance.state = finishedWork.memoizedState; <ide> instance.componentDidMount(); <del> if (__DEV__) { <del> stopPhaseTimer(); <del> } <add> stopPhaseTimer(); <ide> } else { <ide> const prevProps = current.memoizedProps; <ide> const prevState = current.memoizedState; <del> if (__DEV__) { <del> startPhaseTimer(finishedWork, 'componentDidUpdate'); <del> } <add> startPhaseTimer(finishedWork, 'componentDidUpdate'); <ide> instance.props = finishedWork.memoizedProps; <ide> instance.state = finishedWork.memoizedState; <ide> instance.componentDidUpdate(prevProps, prevState); <del> if (__DEV__) { <del> stopPhaseTimer(); <del> } <add> stopPhaseTimer(); <ide> } <ide> } <ide> const updateQueue = finishedWork.updateQueue; <ide><path>packages/react-reconciler/src/ReactFiberContext.js <ide> import checkPropTypes from 'prop-types/checkPropTypes'; <ide> <ide> import {createCursor, pop, push} from './ReactFiberStack'; <ide> import ReactDebugCurrentFiber from './ReactDebugCurrentFiber'; <del>import ReactDebugFiberPerf from './ReactDebugFiberPerf'; <del> <del>const {startPhaseTimer, stopPhaseTimer} = ReactDebugFiberPerf; <add>import {startPhaseTimer, stopPhaseTimer} from './ReactDebugFiberPerf'; <ide> <ide> if (__DEV__) { <ide> var warnedAboutMissingGetChildContext = {}; <ide> export function processChildContext( <ide> let childContext; <ide> if (__DEV__) { <ide> ReactDebugCurrentFiber.setCurrentPhase('getChildContext'); <del> startPhaseTimer(fiber, 'getChildContext'); <del> childContext = instance.getChildContext(); <del> stopPhaseTimer(); <add> } <add> startPhaseTimer(fiber, 'getChildContext'); <add> childContext = instance.getChildContext(); <add> stopPhaseTimer(); <add> if (__DEV__) { <ide> ReactDebugCurrentFiber.setCurrentPhase(null); <del> } else { <del> childContext = instance.getChildContext(); <ide> } <ide> for (let contextKey in childContext) { <ide> invariant( <ide><path>packages/react-reconciler/src/ReactFiberScheduler.js <ide> import ReactFiberHostContext from './ReactFiberHostContext'; <ide> import ReactFiberHydrationContext from './ReactFiberHydrationContext'; <ide> import ReactFiberInstrumentation from './ReactFiberInstrumentation'; <ide> import ReactDebugCurrentFiber from './ReactDebugCurrentFiber'; <del>import ReactDebugFiberPerf from './ReactDebugFiberPerf'; <add>import { <add> recordEffect, <add> recordScheduleUpdate, <add> startWorkTimer, <add> stopWorkTimer, <add> stopFailedWorkTimer, <add> startWorkLoopTimer, <add> stopWorkLoopTimer, <add> startCommitTimer, <add> stopCommitTimer, <add> startCommitHostEffectsTimer, <add> stopCommitHostEffectsTimer, <add> startCommitLifeCyclesTimer, <add> stopCommitLifeCyclesTimer, <add>} from './ReactDebugFiberPerf'; <ide> import {popContextProvider} from './ReactFiberContext'; <ide> import {reset} from './ReactFiberStack'; <ide> import {logCapturedError} from './ReactFiberErrorLogger'; <ide> import {getUpdateExpirationTime} from './ReactFiberUpdateQueue'; <ide> import {resetContext} from './ReactFiberContext'; <ide> <ide> var {invokeGuardedCallback, hasCaughtError, clearCaughtError} = ReactErrorUtils; <del>var { <del> recordEffect, <del> recordScheduleUpdate, <del> startWorkTimer, <del> stopWorkTimer, <del> stopFailedWorkTimer, <del> startWorkLoopTimer, <del> stopWorkLoopTimer, <del> startCommitTimer, <del> stopCommitTimer, <del> startCommitHostEffectsTimer, <del> stopCommitHostEffectsTimer, <del> startCommitLifeCyclesTimer, <del> stopCommitLifeCyclesTimer, <del>} = ReactDebugFiberPerf; <ide> <ide> export type CapturedError = { <ide> componentName: ?string, <ide> export default function<T, P, I, TI, PI, C, CC, CX, PL>( <ide> while (nextEffect !== null) { <ide> if (__DEV__) { <ide> ReactDebugCurrentFiber.setCurrentFiber(nextEffect); <del> recordEffect(); <ide> } <add> recordEffect(); <ide> <ide> const effectTag = nextEffect.effectTag; <ide> if (effectTag & ContentReset) { <ide> export default function<T, P, I, TI, PI, C, CC, CX, PL>( <ide> const effectTag = nextEffect.effectTag; <ide> <ide> if (effectTag & (Update | Callback)) { <del> if (__DEV__) { <del> recordEffect(); <del> } <add> recordEffect(); <ide> const current = nextEffect.alternate; <ide> commitLifeCycles(current, nextEffect); <ide> } <ide> <ide> if (effectTag & Ref) { <del> if (__DEV__) { <del> recordEffect(); <del> } <add> recordEffect(); <ide> commitAttachRef(nextEffect); <ide> } <ide> <ide> if (effectTag & Err) { <del> if (__DEV__) { <del> recordEffect(); <del> } <add> recordEffect(); <ide> commitErrorHandling(nextEffect); <ide> } <ide> <ide> export default function<T, P, I, TI, PI, C, CC, CX, PL>( <ide> // captured elsewhere, to prevent the unmount from being interrupted. <ide> isWorking = true; <ide> isCommitting = true; <del> if (__DEV__) { <del> startCommitTimer(); <del> } <add> startCommitTimer(); <ide> <ide> const root: FiberRoot = finishedWork.stateNode; <ide> invariant( <ide> export default function<T, P, I, TI, PI, C, CC, CX, PL>( <ide> // The first pass performs all the host insertions, updates, deletions and <ide> // ref unmounts. <ide> nextEffect = firstEffect; <del> if (__DEV__) { <del> startCommitHostEffectsTimer(); <del> } <add> startCommitHostEffectsTimer(); <ide> while (nextEffect !== null) { <ide> let didError = false; <ide> let error; <ide> export default function<T, P, I, TI, PI, C, CC, CX, PL>( <ide> } <ide> } <ide> } <del> if (__DEV__) { <del> stopCommitHostEffectsTimer(); <del> } <add> stopCommitHostEffectsTimer(); <ide> <ide> resetAfterCommit(); <ide> <ide> export default function<T, P, I, TI, PI, C, CC, CX, PL>( <ide> // and deletions in the entire tree have already been invoked. <ide> // This pass also triggers any renderer-specific initial effects. <ide> nextEffect = firstEffect; <del> if (__DEV__) { <del> startCommitLifeCyclesTimer(); <del> } <add> startCommitLifeCyclesTimer(); <ide> while (nextEffect !== null) { <ide> let didError = false; <ide> let error; <ide> export default function<T, P, I, TI, PI, C, CC, CX, PL>( <ide> <ide> isCommitting = false; <ide> isWorking = false; <del> if (__DEV__) { <del> stopCommitLifeCyclesTimer(); <del> stopCommitTimer(); <del> } <add> stopCommitLifeCyclesTimer(); <add> stopCommitTimer(); <ide> if (typeof onCommitRoot === 'function') { <ide> onCommitRoot(finishedWork.stateNode); <ide> } <ide> export default function<T, P, I, TI, PI, C, CC, CX, PL>( <ide> resetExpirationTime(workInProgress, nextRenderExpirationTime); <ide> <ide> if (next !== null) { <del> if (__DEV__) { <del> stopWorkTimer(workInProgress); <del> } <add> stopWorkTimer(workInProgress); <ide> if (__DEV__ && ReactFiberInstrumentation.debugTool) { <ide> ReactFiberInstrumentation.debugTool.onCompleteWork(workInProgress); <ide> } <ide> export default function<T, P, I, TI, PI, C, CC, CX, PL>( <ide> } <ide> } <ide> <del> if (__DEV__) { <del> stopWorkTimer(workInProgress); <del> } <add> stopWorkTimer(workInProgress); <ide> if (__DEV__ && ReactFiberInstrumentation.debugTool) { <ide> ReactFiberInstrumentation.debugTool.onCompleteWork(workInProgress); <ide> } <ide> export default function<T, P, I, TI, PI, C, CC, CX, PL>( <ide> const current = workInProgress.alternate; <ide> <ide> // See if beginning this work spawns more work. <add> startWorkTimer(workInProgress); <ide> if (__DEV__) { <del> startWorkTimer(workInProgress); <ide> ReactDebugCurrentFiber.setCurrentFiber(workInProgress); <ide> } <ide> let next = beginWork(current, workInProgress, nextRenderExpirationTime); <ide> export default function<T, P, I, TI, PI, C, CC, CX, PL>( <ide> const current = workInProgress.alternate; <ide> <ide> // See if beginning this work spawns more work. <add> startWorkTimer(workInProgress); <ide> if (__DEV__) { <del> startWorkTimer(workInProgress); <ide> ReactDebugCurrentFiber.setCurrentFiber(workInProgress); <ide> } <ide> let next = beginFailedWork( <ide> export default function<T, P, I, TI, PI, C, CC, CX, PL>( <ide> root: FiberRoot, <ide> expirationTime: ExpirationTime, <ide> ): Fiber | null { <del> if (__DEV__) { <del> startWorkLoopTimer(); <del> } <add> startWorkLoopTimer(); <ide> <ide> invariant( <ide> !isWorking, <ide> export default function<T, P, I, TI, PI, C, CC, CX, PL>( <ide> didFatal = false; <ide> firstUncaughtError = null; <ide> <del> if (__DEV__) { <del> stopWorkLoopTimer(); <del> } <add> stopWorkLoopTimer(); <ide> <ide> if (uncaughtError !== null) { <ide> onUncaughtError(uncaughtError); <ide> export default function<T, P, I, TI, PI, C, CC, CX, PL>( <ide> break; <ide> } <ide> if (node === to || node.alternate === to) { <del> if (__DEV__) { <del> stopFailedWorkTimer(node); <del> } <add> stopFailedWorkTimer(node); <ide> break; <del> } else if (__DEV__) { <add> } else { <ide> stopWorkTimer(node); <ide> } <ide> node = node.return; <ide> export default function<T, P, I, TI, PI, C, CC, CX, PL>( <ide> expirationTime: ExpirationTime, <ide> isErrorRecovery: boolean, <ide> ) { <del> if (__DEV__) { <del> recordScheduleUpdate(); <del> } <add> recordScheduleUpdate(); <ide> <ide> if (__DEV__) { <ide> if (!isErrorRecovery && fiber.tag === ClassComponent) { <ide><path>packages/shared/ReactFeatureFlags.js <ide> * @flow <ide> */ <ide> <add>import invariant from 'fbjs/lib/invariant'; <add> <ide> export const enableAsyncSubtreeAPI = true; <ide> export const enableAsyncSchedulingByDefaultInReactDOM = false; <ide> // Exports React.Fragment <ide> export const enableReactFragment = false; <ide> // Exports ReactDOM.createRoot <ide> export const enableCreateRoot = false; <add>export const enableUserTimingAPI = __DEV__; <ide> <ide> // Mutating mode (React DOM, React ART, React Native): <ide> export const enableMutatingReconciler = true; <ide> // Experimental noop mode (currently unused): <ide> export const enableNoopReconciler = false; <ide> // Experimental persistent mode (CS): <ide> export const enablePersistentReconciler = false; <add> <add>// Only used in www builds. <add>export function addUserTimingListener() { <add> invariant(false, 'Not implemented.'); <add>} <ide><path>scripts/rollup/shims/rollup/ReactFeatureFlags-www.js <ide> export const { <ide> enableAsyncSchedulingByDefaultInReactDOM, <ide> enableReactFragment, <ide> enableCreateRoot, <add> // Reconciler flags <ide> enableMutatingReconciler, <ide> enableNoopReconciler, <ide> enablePersistentReconciler, <ide> } = require('ReactFeatureFlags'); <ide> <add>export let enableUserTimingAPI = __DEV__; <add> <add>let refCount = 0; <add>export function addUserTimingListener() { <add> if (__DEV__) { <add> // Noop. <add> return () => {}; <add> } <add> refCount++; <add> updateFlagOutsideOfReactCallStack(); <add> return () => { <add> refCount--; <add> updateFlagOutsideOfReactCallStack(); <add> }; <add>} <add> <add>let timeout = null; <add>function updateFlagOutsideOfReactCallStack() { <add> if (!timeout) { <add> timeout = setTimeout(() => { <add> timeout = null; <add> enableUserTimingAPI = refCount > 0; <add> }); <add> } <add>} <add> <ide> // Flow magic to verify the exports of this file match the original version. <ide> // eslint-disable-next-line no-unused-vars <ide> type Check<_X, Y: _X, X: Y=_X> = null;
10
Ruby
Ruby
handle nil newest_committed_revision
0dd004f53d8c513b9b0f5fffcbf07e82bfb567fe
<ide><path>Library/Homebrew/dev-cmd/audit.rb <ide> def audit_revision_and_version_scheme <ide> !previous_revision.nil? && <ide> current_revision < previous_revision <ide> problem "revision should not decrease (from #{previous_revision} to #{current_revision})" <del> elsif current_revision > (newest_committed_revision + 1) <add> elsif newest_committed_revision && <add> current_revision > (newest_committed_revision + 1) <ide> problem "revisions should only increment by 1" <ide> end <ide> end
1
Go
Go
fix copy from a "created" container. fixes
289ee90b04a2315cd36d6ff363b41c89f8ebf2aa
<ide><path>daemon/container.go <ide> import ( <ide> "github.com/docker/docker/image" <ide> "github.com/docker/docker/pkg/archive" <ide> "github.com/docker/docker/pkg/broadcastwriter" <add> "github.com/docker/docker/pkg/fileutils" <ide> "github.com/docker/docker/pkg/ioutils" <ide> "github.com/docker/docker/pkg/jsonlog" <ide> "github.com/docker/docker/pkg/mount" <ide> func (container *Container) Copy(resource string) (io.ReadCloser, error) { <ide> if err != nil { <ide> return nil, err <ide> } <add> var stat os.FileInfo <add> stat, err = os.Stat(m.Source) <add> if err != nil { <add> return nil, err <add> } <add> if err = fileutils.CreateIfNotExists(dest, stat.IsDir()); err != nil { <add> return nil, err <add> } <ide> if err = mount.Mount(m.Source, dest, "bind", "rbind,ro"); err != nil { <ide> return nil, err <ide> } <ide><path>integration-cli/docker_cli_cp_test.go <ide> func (s *DockerSuite) TestCopyAndRestart(c *check.C) { <ide> c.Fatalf("expected %q but got %q", expectedMsg, msg) <ide> } <ide> } <add> <add>func (s *DockerSuite) TestCopyCreatedContainer(c *check.C) { <add> out, err := exec.Command(dockerBinary, "create", "--name", "test_cp", "-v", "/test", "busybox").CombinedOutput() <add> if err != nil { <add> c.Fatalf(string(out), err) <add> } <add> <add> tmpDir, err := ioutil.TempDir("", "test") <add> if err != nil { <add> c.Fatalf("unable to make temporary directory: %s", err) <add> } <add> defer os.RemoveAll(tmpDir) <add> out, err = exec.Command(dockerBinary, "cp", "test_cp:/bin/sh", tmpDir).CombinedOutput() <add> if err != nil { <add> c.Fatalf(string(out), err) <add> } <add>} <ide><path>pkg/fileutils/fileutils.go <ide> func ReadSymlinkedDirectory(path string) (string, error) { <ide> } <ide> return realPath, nil <ide> } <add> <add>// CreateIfNotExists creates a file or a directory only if it does not already exist. <add>func CreateIfNotExists(path string, isDir bool) error { <add> if _, err := os.Stat(path); err != nil { <add> if os.IsNotExist(err) { <add> if isDir { <add> return os.MkdirAll(path, 0755) <add> } <add> if err := os.MkdirAll(filepath.Dir(path), 0755); err != nil { <add> return err <add> } <add> f, err := os.OpenFile(path, os.O_CREATE, 0755) <add> if err != nil { <add> return err <add> } <add> f.Close() <add> } <add> } <add> return nil <add>}
3
Text
Text
add 0.70.2 changelog
3610168bb0fc37d393b10f30e21f66b4eac7d1bd
<ide><path>CHANGELOG.md <ide> # Changelog <ide> <add>## v0.70.2 <add> <add>### Added <add> <add>#### iOS specific <add> <add>- Add support for "Prefer Cross-Fade Transitions" into AccessibilityInfo ([be7c50fefd](https://github.com/facebook/react-native/commit/be7c50fefd7f13201fb538ded93d91b374341173) by [@gabrieldonadel](https://github.com/gabrieldonadel)) <add> <add>### Changed <add> <add>- Bump CLI to 9.1.3 and Metro to 0.72.3 ([f164556037](https://github.com/facebook/react-native/commit/f1645560376b734a87f0eba1fef69f6cba312cc1) by [@kelset](https://github.com/kelset)) <add> <add>### Fixed <add> <add>- Inform ScrollView of Keyboard Events Before Mount ([26d148029c](https://github.com/facebook/react-native/commit/26d148029c7fde117f33b0d6c8b34286c45a0ef2) by [@NickGerleman](https://github.com/NickGerleman)) <add> <add>#### Android specific <add> <add>- Fix port as -1 if dev server without specifying port on Android ([3d7e1380b4](https://github.com/facebook/react-native/commit/3d7e1380b4e609f5340ee80c19d566b17e620427) by [@Kudo](https://github.com/Kudo)) <add> <ide> ## v0.70.1 <ide> <ide> ### Added
1
PHP
PHP
use routable key name
3249c620a19cb97f6f2ff55b9712ac4d3326996a
<ide><path>src/Illuminate/Routing/Router.php <ide> protected function substituteImplicitBindings($route) <ide> <ide> if (array_key_exists($parameter->name, $parameters) && <ide> ! $route->getParameter($parameter->name) instanceof Model) { <del> $method = $parameter->isDefaultValueAvailable() ? 'find' : 'findOrFail'; <add> $method = $parameter->isDefaultValueAvailable() ? 'first' : 'firstOrFail'; <add> <add> $model = $class->newInstance(); <ide> <ide> $route->setParameter( <del> $parameter->name, $class->newInstance()->{$method}($parameters[$parameter->name]) <add> $parameter->name, $model->where( <add> $model->getRouteKeyName(), $parameters[$parameter->name] <add> )->{$method}() <ide> ); <ide> } <ide> }
1
Python
Python
set version to v3.0.0a5
71242327b2c7e27dd76db1235b772176fb4716a3
<ide><path>spacy/about.py <ide> # fmt: off <ide> __title__ = "spacy-nightly" <del>__version__ = "3.0.0a4" <add>__version__ = "3.0.0a5" <ide> __release__ = True <ide> __download_url__ = "https://github.com/explosion/spacy-models/releases/download" <ide> __compatibility__ = "https://raw.githubusercontent.com/explosion/spacy-models/master/compatibility.json"
1
Text
Text
specify request method in guides [ci skip]
867138aa9909e8371340e38db12faf59a43ae31e
<ide><path>guides/source/action_controller_overview.md <ide> NOTE: Support for parsing XML parameters has been extracted into a gem named `ac <ide> The `params` hash will always contain the `:controller` and `:action` keys, but you should use the methods `controller_name` and `action_name` instead to access these values. Any other parameters defined by the routing, such as `:id` will also be available. As an example, consider a listing of clients where the list can show either active or inactive clients. We can add a route which captures the `:status` parameter in a "pretty" URL: <ide> <ide> ```ruby <del>match '/clients/:status' => 'clients#index', foo: 'bar' <add>get '/clients/:status' => 'clients#index', foo: 'bar' <ide> ``` <ide> <ide> In this case, when a user opens the URL `/clients/active`, `params[:status]` will be set to "active". When this route is used, `params[:foo]` will also be set to "bar" just like it was passed in the query string. In the same way `params[:action]` will contain "index". <ide><path>guides/source/i18n.md <ide> You would probably need to map URLs like these: <ide> <ide> ```ruby <ide> # config/routes.rb <del>match '/:locale' => 'dashboard#index' <add>get '/:locale' => 'dashboard#index' <ide> ``` <ide> <ide> Do take special care about the **order of your routes**, so this route declaration does not "eat" other ones. (You may want to add it directly before the `root :to` declaration.)
2
Javascript
Javascript
fix some cors issues in ie
3a51db27f26d8e2c49923566e376938a5f533be1
<ide><path>fixtures/src/components/Header.js <ide> const Header = React.createClass({ <ide> return { version, versions }; <ide> }, <ide> componentWillMount() { <del> fetch('http://api.github.com/repos/facebook/react/tags') <add> fetch('https://api.github.com/repos/facebook/react/tags', { mode: 'cors' }) <ide> .then(res => res.json()) <ide> .then(tags => { <ide> let versions = tags.map(tag => tag.name.slice(1));
1
PHP
PHP
add localizedtime() to datetime object test
52e592e6a1a58504100a16f18c0aa1c6eabec968
<ide><path>tests/TestCase/Validation/ValidationTest.php <ide> public function testDateTimeObject() <ide> $this->assertTrue(Validation::date($dateTime)); <ide> $this->assertTrue(Validation::time($dateTime)); <ide> $this->assertTrue(Validation::dateTime($dateTime)); <add> $this->assertTrue(Validation::localizedTime($dateTime)); <ide> <ide> $dateTime = new \DateTimeImmutable(); <ide> $this->assertTrue(Validation::date($dateTime)); <ide> $this->assertTrue(Validation::time($dateTime)); <ide> $this->assertTrue(Validation::dateTime($dateTime)); <add> $this->assertTrue(Validation::localizedTime($dateTime)); <ide> } <ide> <ide> /**
1
Python
Python
add example for ma.unique function
1d556d97b20d9a6e1d6fa4dbfd6672e4b2bedeff
<ide><path>numpy/ma/extras.py <ide> def unique(ar1, return_index=False, return_inverse=False): <ide> -------- <ide> numpy.unique : Equivalent function for ndarrays. <ide> <add> Examples <add> -------- <add> >>> a = [1, 2, 1000, 2, 3] <add> >>> mask = [0, 0, 1, 0, 0] <add> >>> masked_a = ma.masked_array(a, mask) <add> >>> masked_a <add> masked_array(data=[1, 2, --, 2, 3], <add> mask=[False, False, True, False, False], <add> fill_value=999999) <add> >>> ma.unique(masked_a) <add> masked_array(data=[1, 2, 3, --], <add> mask=[False, False, False, True], <add> fill_value=999999) <add> >>> ma.unique(masked_a, return_index=True) <add> (masked_array(data=[1, 2, 3, --], <add> mask=[False, False, False, True], <add> fill_value=999999), array([0, 1, 4, 2])) <add> >>> ma.unique(masked_a, return_inverse=True) <add> (masked_array(data=[1, 2, 3, --], <add> mask=[False, False, False, True], <add> fill_value=999999), array([0, 1, 3, 1, 2])) <add> >>> ma.unique(masked_a, return_index=True, return_inverse=True) <add> (masked_array(data=[1, 2, 3, --], <add> mask=[False, False, False, True], <add> fill_value=999999), array([0, 1, 4, 2]), array([0, 1, 3, 1, 2])) <ide> """ <ide> output = np.unique(ar1, <ide> return_index=return_index,
1
Text
Text
translate contributing.md to arabic
abb7a626a92c4cee97c071b955e71628000fbaca
<ide><path>CONTRIBUTING.md <ide> <!-- Do not translate this table --> <ide> <td> Read these guidelines in </td> <ide> <td><a href="/CONTRIBUTING.md"> English </a></td> <del> <td><a href="/docs/arabic/CONTRIBUTING.md"> عربى </a></td> <add> <td><a href="/docs/arabic/CONTRIBUTING.md"> عربي </a></td> <ide> <td><a href="/docs/chinese/CONTRIBUTING.md"> 中文 </a></td> <ide> <td><a href="/docs/portuguese/CONTRIBUTING.md"> Português </a></td> <ide> <td><a href="/docs/russian/CONTRIBUTING.md"> русский </a></td> <ide> You can help us translate our Guide articles and Coding challenges for a languag <ide> <ide> - [Chinese (中文)](https://github.com/freeCodeCamp/freeCodeCamp/tree/master/curriculum/challenges/chinese) <ide> - [Russian (русский)](https://github.com/freeCodeCamp/freeCodeCamp/tree/master/curriculum/challenges/russian) <del>- [Arabic (عربى)](https://github.com/freeCodeCamp/freeCodeCamp/tree/master/curriculum/challenges/arabic) <add>- [Arabic (عربي)](https://github.com/freeCodeCamp/freeCodeCamp/tree/master/curriculum/challenges/arabic) <ide> - [Spanish (Español)](https://github.com/freeCodeCamp/freeCodeCamp/tree/master/curriculum/challenges/spanish) <ide> - [Portuguese (Português)](https://github.com/freeCodeCamp/freeCodeCamp/tree/master/curriculum/challenges/portuguese) <ide> <ide><path>docs/README.md <ide> <!-- Do not translate this table --> <ide> <td> Read these guidelines in </td> <ide> <td><a href="/CONTRIBUTING.md"> English </a></td> <del> <td><a href="/docs/arabic/README.md"> عربى </a></td> <add> <td><a href="/docs/arabic/README.md"> عربي </a></td> <ide> <td><a href="/docs/chinese/README.md"> 中文 </a></td> <ide> <td><a href="/docs/russian/README.md"> русский </a></td> <ide> <td><a href="/docs/portuguese/README.md"> Português </a></td> <ide><path>docs/arabic/CONTRIBUTING.md <ide> <td><a href="/CONTRIBUTING.md"> English </a></td> <ide> <td><a href="/docs/chinese/CONTRIBUTING.md"> 中文 </a></td> <ide> <td><a href="/docs/russian/CONTRIBUTING.md"> русский </a></td> <del> <td><a href="/docs/arabic/CONTRIBUTING.md"> عربى </a></td> <add> <td><a href="/docs/arabic/CONTRIBUTING.md"> عربي </a></td> <ide> <td><a href="/docs/spanish/CONTRIBUTING.md"> Español </a></td> <ide> <td><a href="/docs/portuguese/CONTRIBUTING.md"> Português </a></td> <ide> </tr> <ide> </table> <ide> <del># إرشادات المساهمة <add><div dir="rtl" style="direction: rtl" markdown="1"> <ide> <add># قواعد المساهمة <ide> <del>مرحبا 👋 ! <del>توجد هذه المنصة بفضل الآلاف من المتطوعين, نحن ممتنون لمساهماتكم ، ونحن متحمسون للترحيب بكم على متن السفينة <add>مرحبا! 👋 <ide> <del>نحن نفرض بصرامة اتخاذ لحظة لقراءة ["القواعد السلوكية"](https://www.freecodecamp.org/code-of-conduct) <del>. انها بطول 196 كلمة فقط . <add>إن مشروع freeCodeCamp.org هو مشروع قائم بسبب جهود الآلاف من المتطوعين الجيدين! نحن نشعر بالأمتنان لتطوعك, و نحن سعيدين بإنضمامك لنا! <ide> <del>مساهمة سعيدة 🎉! <add>نحن نطبق بشدة [القواعد السلوكية](https://www.freecodecamp.org/code-of-conduct). أقرأ هذه المقالة جيدا, إنها مجرد 196 كلمة. <ide> <del>## فيما يلي بعض الطرق الممتعة التي يمكنك المساعدة بها <add>🎉 <ide> <del>يمكنك اختيار المساهمة في أي منطقة تهمك: <add>## بعض الطرق المساهمة <ide> <del>1. [ساهم في هذا المصدر المفتوح](#contribute-to-this-open-source-codebase). مساعدة في التحرير <del> [مقالات الدليل](https://guide.freecodecamp.org/), [تحديات البرمجة](https://learn.freecodecamp.org/), أو إصلاح الأخطاء على منصة التعلم. <add>1. [تطوع لهذا الcodebase](#تطوع-لهذا-الcodebase). ساعد في إعداد [مقالات الدليل](https://guide.freecodecamp.org/), [تحديات الcoding](https://learn.freecodecamp.org/), أو تشخيص المشاكل في برنامج التعليم. <ide> <add>2. ساعد المخيمين (المستخدمين) على [المنتدى العام](https://www.freecodecamp.org/forum/). [أجب عن أسئلتهم](https://www.freecodecamp.org/forum/?max_posts=1) او [أعطهم رأيك على مشاريعهم](https://www.freecodecamp.org/forum/c/project-feedback?max_posts=1) <ide> <add>3. ساعد في إضافة ترجمة إلى مقاطع الفيديو على [قناتنا على الYouTube](https://www.youtube.com/channel/UC8butISFwT-Wl7EV0hUK0BQ/videos) <ide> <del>These instructions have been translated partially. Please check this issue for details: [`#18312`](https://github.com/freeCodeCamp/freeCodeCamp/issues/18312) <add>## تطوع لهذا الcodebase <add> <add>لدينا codebase ضخمة جدا مفتوحة المصدر مؤلفة من الآلاف من [تحديات البرمجة](https://learn.freecodecamp.org) و [مقالات الدليل](https://guide.freecodecamp.org). <add> <add>يمكنك المساعدة عن طريق: <add> <add>- [📝 القيام بالأبحاث و كتابة و تحديث مقالات الدليل](#القيام-بالأبحاث-و-كتابة-و-تحديث-مقالات-الدليل) <add> <add>- [💻 إنشاء و تحديث و إصلاح الأخطاء في تحديات البرمجة](#إنشاء-و-تحديث-و-إصلاح-الأخطاء-في-تحديات-البرمجة) <add> <add>- [🌐 المساعدة في ترجمة مقالات الدليل و تحديات البرمجة](#المساعدة-في-ترجمة-مقالات-الدليل-و-تحديات-البرمجة) <add> <add>- [🛠 ساعد في إصلاح الأخطاء في برنامج تعليم freeCodeCamp.org](#ساعد-في-إصلاح-الأخطاء-في-برنامج-تعليم-freecodecamporg) <add> <add>### القيام بالأبحاث و كتابة و تحديث مقالات الدليل <add> <add>**ما هي مقالات الدليل؟** <add> <add>مقالات الدليل تساعد في الحصول على فهم سريع لفكرة تقنية معينة. المقالات هي عبارة عن شرح قصير و مكتوب بلغة سهلة و التي يمكنك قرائتها قبل البدء في شروحات اكثر تفصيلا. <add> <add>على سبيل المثال يمكنك أن تجد [مثالا عن ال HTML Elements هنا](./client/src/pages/html/elements/index.md) <add> <add>**عن ماذا يمكنني كتابة مقالة؟** <add> <add>نحن نرحب في مساعدتك لكتابة تلك المقالات. ليس عليك أن تكون خبيرا في الموضوع لكي تكتب مقالة - هذه المقالات مفتوحة المصدر, فمثلا لو كتبت شيئا خاطئا, أي متطوع آخر يمكنه اصلاح الخطأ في النهاية <add> <add>من أجل المساعدة, قم بإيجاد `stub article` على [موقع الدليل](https://www.freecodecamp.org/guide), أكتب المقالة, ثم أنشئ Pull Request لأستبدال ذلك بمقالتك. إن ال [Pull Requests](https://help.github.com/articles/about-pull-requests/) هو الطريقة التي ستقوم بأستعمالها لأقتراح التعديلات, فهي تسمح للآخرين بالأستعلام عن تعديلاتك و مراجعتها و اعتمادها. <add> <add>إذا لم تستطع أن تجد `stub article` حول الموضوع الذي تريد الكتابة عنه, يمكنك ان إنشاء Pull Request تقوم فيه بإنشاء `stub article` الذي يتضمن المسودة التي كتبتها. <add> <add>إذا كنت تريد المساعدة في تحسين مقالات الدليل, أقرا [هذه المقالة عن كيفية القيام ذلك](/docs/how-to-work-on-guide-articles.md). <add> <add>### إنشاء و تحديث و إصلاح الأخطاء في تحديات البرمجة <add> <add>كل التحديات هي مصنوعة من قبل عامة المجتمع, بشكل يضع خبرات عالية من اشخاص مثلك. <add> <add>يمكنك المساعدة في زيادة التوسع في التحديات و تعديلها بشكل تصبح أكثر وضوحا. يمكنك تعديل قصص المستخدمين لتجعل الفكرة أفضل, و حتى إزالة القصص المتكررة. يمكنك أيضا تحسين أختبارات التحديات لتجعلها قادرة على أختبار الcode بشكل أفضل و أكثر دقة. <add> <add>إذا كنت مهتم في تحسين تلك التحديات, أقرأ [هذه المقالة عن كيفية القيام بذلك](/docs/how-to-work-on-coding-challenges.md). <add> <add>### المساعدة في ترجمة مقالات الدليل و تحديات البرمجة <add> <add>يمكنك المساعدة في ترجمة مقالات الدليل و تحديات البرمجة إلى لغة يمكنك التكلم بها. حاليا لدينا إصدارات باللغات التالية: <add> <add>- [Chinese (中文)](https://github.com/freeCodeCamp/freeCodeCamp/tree/master/curriculum/challenges/chinese) <add>- [Russian (русский)](https://github.com/freeCodeCamp/freeCodeCamp/tree/master/curriculum/challenges/russian) <add>- [Arabic (عربي)](https://github.com/freeCodeCamp/freeCodeCamp/tree/master/curriculum/challenges/arabic) <add>- [Spanish (Español)](https://github.com/freeCodeCamp/freeCodeCamp/tree/master/curriculum/challenges/spanish) <add>- [Portuguese (Português)](https://github.com/freeCodeCamp/freeCodeCamp/tree/master/curriculum/challenges/portuguese) <add> <add>نحن نود أن تساعدنا في تحسين جودة هذه الترجمات. الملايين من الأشخاص يستعملون الموقع باللغة الأنكليزية, و نحن نتوقع الملايين الأخرى من المستخدمين أن تستعمل الموقع باللغات الأخرى أيضا. <add> <add>### ساعد في إصلاح الأخطاء في برنامج تعليم freeCodeCamp.org <add> <add>إن برنامجنا التعليمي يعمل على مجموعة برامج JavaScript حديثة. هناك الكثر من المكونات و الأدوات و المكتبات, منها Node.js و MongoDB و LoopBack و OAuth 2.0 و React و Gatsby و Webpack و المزيد ايضا. <add> <add>بشكل عام, <add> <add>- لدينا Node.js API server. <add>- مجموعة من برامج المستخدم المبنية باستخدام React. <add>- Script نستعمله من أجل تقييم برامج ال Front-end. <add> <add>المشاركة في هذا يتطلب بعض المفاهيم حول ال APIs و ES6 Syntax, و الكثير من الشغف. <add> <add>بشكل أساسي, نحن نتوقع معرفة بسيطة معينة حول التقنيات و الأدوات و المكتبات المذكورة سابقا. و مع ذلك, أنت ليس عليك أن تكون خبيرا بهم. <add> <add>يمكنك دوما الأستفسار عن أية أسئلة لديك على الissues المتعلقة بالموضوع و نحن سنكون سعيدين بإجابتنا لأستفسارك. في حال شعرت بالأرتياب حول موضوع ما, يمكنك التحدث مع [`@raisedadead`](https://github.com/raisedadead) أو [`@bouncey`](https://github.com/bouncey) من فريق المطورين لدينا لتقديم المساعدة لك. <add> <add>إذا كنت تريد المساعدة في تحسين الcodebase لدينا, أقرأ [كيف تقوم بتشغيل البرنامج محليا](/docs/how-to-setup-freecodecamp-locally.md). <add> <add>## أسئلة شائعة <add> <add>**كيف يمكنني أن أخبر عن مشكلة و التي هي ليست مطروحة؟** <add> <add>إذا كنت تظن أنك قد وجدت مشكلة, أقرأ اولا مقالة ["Help I've Found a Bug"](https://forum.freecodecamp.org/t/how-to-report-a-bug/19543) و تتبع الخطوات هناك. <add> <add>إذا كنت متيقنا أنها مشكلة جديدة, قم بإنشاء issue جديدة على GitHub. كن متأكدا انها تتضمن أكثر معلومات ممكنة حتى نتمكن من تجريب المشكلة لدينا. لدينا قالب مخصص ليساعدك في ذلك. <add> <add>ننوه إلى أن اي issue مفتوحة لأجل طلب المساعدة في تحدي برمجة سوف يتم إقفالها. ذلك لأن استخدام ال issues محصور في مشاكل و مناقشات الcodebase. قم [بطلب المساعدة على المنتدى](https://www.freecodecamp.org/forum) قبل التبليغ عن المشكلة إن كنت تشعر بالأرتياب. <add> <add>**كيف يمكنني أن أبلغ عن مشكلة أمنية؟** <add> <add>رجاء لا تقم بإنشاء issue على GitHub للمشاكل المتعلقة بالأمن. بدلا من ذلك أرسل إلى بريدنا الألكتروني `security@freecodecamp.org` و سنقوم بإلقاء نظرة مباشرة. <add> <add>**لدي مشكلة في شيئ ما ليس موجودا ضمن هذه المستندات. كيف يمكنني أن أجد المساعدة؟** <add> <add>يمكنك الأتسفسار عن أسئلتك عن طريق: <add> <add>- [فئة "Contributors" في المنتدى العام](https://www.freecodecamp.org/forum/c/contributors) <add>- [المتطوعين على غرفة الدردشة في Gitter](https://gitter.im/FreeCodeCamp/Contributors) <add> <add>نحن متشوقين لمساعدتك في التطوع لأي من المواضيع التي تريد العمل عليها. كن متأكدا أن تقوم بالبحث على سؤالك قبل طرحه. كن مؤدبا و أنتظر الأجابة. إن المتطوعين و المسؤولين لدينا دائما موجودون لمسعادتك في أية مشكلة لديك. <add> <add>**أنا جديد على أستخدام GitHub و حتى على فكرة البرامج مفتوحة المصدر:** <add> <add>أقرأ عن [كيفية التطوع للبرامج المفتوحة المصدر](https://github.com/freeCodeCamp/how-to-contribute-to-open-source) <add> <add>**ماذا تعني مختلف الطوابع الموجودة على الissues؟** <add> <add>إن المسؤولين لدينا يقومون [بتنظيم](https://en.wikipedia.org/wiki/Software_bug#Bug_management) الissues و الPull Requests بحسب الأولوية و الخطورة و عوامل أخرى. يمكنك أن تجد [قاموس المطلحات هنا](https://github.com/freecodecamp/freecodecamp/labels). <add> <add>يجب أن تلق نظرة على الissues ذات الطوابع **`Help Wanted`** أو **`first timers welcome`** من أجل نظرة سريعة على ما هو متوفر و الذي يمكنك العمل عليه. يفضل أن تقوم بالعمل على تلك الissues قبل الأنتقال إلى ما بعد ذلك. <add> <add>إن كانت تلك الissues غير واضحة حول ما هو مطلوب فعله, يمكنك أن تسأل في قسم التعليقات على الissue. <add> <add>**لقد وجدت خطأ كتابي, هل علي أن أقوم بالتبليغ عنه قبل إنشاء Pull Request؟** <add> <add>من أجل أخطاء كتابية و مشاكل مشابهة يمكنك مباشرة أن تقوم بإنشاء Pull Request دون أن تقوم بإنشاء issue مسبقا. إن ال issues هي مخصصة بشكل أكثر للمشاكل الأكبر و المتعلقة بالcode او مشاكل بنيوية في المنهج. <add> <add></div> <ide><path>docs/arabic/README.md <ide> <td><a href="/CONTRIBUTING.md"> English </a></td> <ide> <td><a href="/docs/chinese/README.md"> 中文 </a></td> <ide> <td><a href="/docs/russian/README.md"> русский </a></td> <del> <td><a href="/docs/arabic/README.md"> عربى </a></td> <add> <td><a href="/docs/arabic/README.md"> عربي </a></td> <ide> <td><a href="/docs/spanish/README.md"> Español </a></td> <ide> <td><a href="/docs/portuguese/README.md"> Português </a></td> <ide> <td><a href="/docs/german/README.md"> Deutsch </a></td> <ide><path>docs/arabic/how-to-catch-outgoing-emails-locally.md <ide> <td><a href="/CONTRIBUTING.md"> English </a></td> <ide> <td><a href="/docs/chinese/CONTRIBUTING.md"> 中文 </a></td> <ide> <td><a href="/docs/russian/CONTRIBUTING.md"> русский </a></td> <del> <td><a href="/docs/arabic/CONTRIBUTING.md"> عربى </a></td> <add> <td><a href="/docs/arabic/CONTRIBUTING.md"> عربي </a></td> <ide> <td><a href="/docs/spanish/CONTRIBUTING.md"> Español </a></td> <ide> <td><a href="/docs/portuguese/CONTRIBUTING.md"> Português </a></td> <ide> </tr> <ide><path>docs/arabic/how-to-setup-freecodecamp-locally.md <ide> <td><a href="/CONTRIBUTING.md"> English </a></td> <ide> <td><a href="/docs/chinese/CONTRIBUTING.md"> 中文 </a></td> <ide> <td><a href="/docs/russian/CONTRIBUTING.md"> русский </a></td> <del> <td><a href="/docs/arabic/CONTRIBUTING.md"> عربى </a></td> <add> <td><a href="/docs/arabic/CONTRIBUTING.md"> عربي </a></td> <ide> <td><a href="/docs/spanish/CONTRIBUTING.md"> Español </a></td> <ide> <td><a href="/docs/portuguese/CONTRIBUTING.md"> Português </a></td> <ide> </tr> <ide><path>docs/arabic/how-to-work-on-coding-challenges.md <ide> <td><a href="/CONTRIBUTING.md"> English </a></td> <ide> <td><a href="/docs/chinese/CONTRIBUTING.md"> 中文 </a></td> <ide> <td><a href="/docs/russian/CONTRIBUTING.md"> русский </a></td> <del> <td><a href="/docs/arabic/CONTRIBUTING.md"> عربى </a></td> <add> <td><a href="/docs/arabic/CONTRIBUTING.md"> عربي </a></td> <ide> <td><a href="/docs/spanish/CONTRIBUTING.md"> Español </a></td> <ide> <td><a href="/docs/portuguese/CONTRIBUTING.md"> Português </a></td> <ide> </tr> <ide><path>docs/arabic/how-to-work-on-guide-articles.md <ide> <td><a href="/CONTRIBUTING.md"> English </a></td> <ide> <td><a href="/docs/chinese/CONTRIBUTING.md"> 中文 </a></td> <ide> <td><a href="/docs/russian/CONTRIBUTING.md"> русский </a></td> <del> <td><a href="/docs/arabic/CONTRIBUTING.md"> عربى </a></td> <add> <td><a href="/docs/arabic/CONTRIBUTING.md"> عربي </a></td> <ide> <td><a href="/docs/spanish/CONTRIBUTING.md"> Español </a></td> <ide> <td><a href="/docs/portuguese/CONTRIBUTING.md"> Português </a></td> <ide> </tr> <ide><path>docs/chinese/CONTRIBUTING.md <ide> <td><a href="/CONTRIBUTING.md"> English </a></td> <ide> <td><a href="/docs/chinese/CONTRIBUTING.md"> 中文 </a></td> <ide> <td><a href="/docs/russian/CONTRIBUTING.md"> русский </a></td> <del> <td><a href="/docs/arabic/CONTRIBUTING.md"> عربى </a></td> <add> <td><a href="/docs/arabic/CONTRIBUTING.md"> عربي </a></td> <ide> <td><a href="/docs/spanish/CONTRIBUTING.md"> Español </a></td> <ide> <td><a href="/docs/portuguese/CONTRIBUTING.md"> Português </a></td> <ide> </tr> <ide><path>docs/chinese/README.md <ide> <td><a href="/CONTRIBUTING.md"> English </a></td> <ide> <td><a href="/docs/chinese/README.md"> 中文 </a></td> <ide> <td><a href="/docs/russian/README.md"> русский </a></td> <del> <td><a href="/docs/arabic/README.md"> عربى </a></td> <add> <td><a href="/docs/arabic/README.md"> عربي </a></td> <ide> <td><a href="/docs/spanish/README.md"> Español </a></td> <ide> <td><a href="/docs/portuguese/README.md"> Português </a></td> <ide> <td><a href="/docs/german/README.md"> Deutsch </a></td> <ide><path>docs/chinese/how-to-catch-outgoing-emails-locally.md <add><table> <add> <tr> <add> <!-- Do not translate this table --> <add> <td> Read these guidelines in </td> <add> <td><a href="/CONTRIBUTING.md"> English </a></td> <add> <td><a href="/docs/chinese/CONTRIBUTING.md"> 中文 </a></td> <add> <td><a href="/docs/russian/CONTRIBUTING.md"> русский </a></td> <add> <td><a href="/docs/arabic/CONTRIBUTING.md"> عربي </a></td> <add> <td><a href="/docs/spanish/CONTRIBUTING.md"> Español </a></td> <add> <td><a href="/docs/portuguese/CONTRIBUTING.md"> Português </a></td> <add> </tr> <add></table> <add> <ide> #如何在本地捕获外发电子邮件(用于电子邮件工作流程) <ide> <ide> > **注意:**这是**可选**步骤 - 仅在使用电子邮件工作流程时需要 <ide> mailhog <ide> <ide> ##有用的链接 <ide> <del> - 有关MailHog的任何其他问题或有关自定义配置的说明,请查看[MailHog](https://github.com/mailhog/MailHog)存储库。 <ide>\ No newline at end of file <add> - 有关MailHog的任何其他问题或有关自定义配置的说明,请查看[MailHog](https://github.com/mailhog/MailHog)存储库。 <ide><path>docs/chinese/how-to-setup-freecodecamp-locally.md <add><table> <add> <tr> <add> <!-- Do not translate this table --> <add> <td> Read these guidelines in </td> <add> <td><a href="/CONTRIBUTING.md"> English </a></td> <add> <td><a href="/docs/chinese/CONTRIBUTING.md"> 中文 </a></td> <add> <td><a href="/docs/russian/CONTRIBUTING.md"> русский </a></td> <add> <td><a href="/docs/arabic/CONTRIBUTING.md"> عربي </a></td> <add> <td><a href="/docs/spanish/CONTRIBUTING.md"> Español </a></td> <add> <td><a href="/docs/portuguese/CONTRIBUTING.md"> Português </a></td> <add> </tr> <add></table> <add> <ide> #在本地设置freeCodeCamp <ide> <ide> 请遵循以下准则,以便在系统上本地获取freeCodeCamp。如果您想定期参与,强烈建议您这样做。 <ide><path>docs/chinese/how-to-work-on-coding-challenges.md <add><table> <add> <tr> <add> <!-- Do not translate this table --> <add> <td> Read these guidelines in </td> <add> <td><a href="/CONTRIBUTING.md"> English </a></td> <add> <td><a href="/docs/chinese/CONTRIBUTING.md"> 中文 </a></td> <add> <td><a href="/docs/russian/CONTRIBUTING.md"> русский </a></td> <add> <td><a href="/docs/arabic/CONTRIBUTING.md"> عربي </a></td> <add> <td><a href="/docs/spanish/CONTRIBUTING.md"> Español </a></td> <add> <td><a href="/docs/portuguese/CONTRIBUTING.md"> Português </a></td> <add> </tr> <add></table> <add> <ide> #如何处理编码挑战 <ide> <ide> ###在GitHub上更改 <ide> videoUrl:'视频解释的网址' <ide> <ide> 2. [挑战类型](https://github.com/freeCodeCamp/learn/blob/a5cb25704168aa37f59a582f0bb5a19b7bd89b46/utils/challengeTypes.js) - 数字挑战类型值的含义(枚举)。 <ide> <del>3. [贡献FreeCodeCamp - 编写ES6挑战测试](https://www.youtube.com/watch?v=iOdD84OSfAE#t=2h49m55s) - 视频[Ethan Arrowood](https://twitter.com/ ArrowoodTech)因为他对旧版课程做出了贡献 <ide>\ No newline at end of file <add>3. [贡献FreeCodeCamp - 编写ES6挑战测试](https://www.youtube.com/watch?v=iOdD84OSfAE#t=2h49m55s) - 视频[Ethan Arrowood](https://twitter.com/ ArrowoodTech)因为他对旧版课程做出了贡献 <ide><path>docs/chinese/how-to-work-on-guide-articles.md <add><table> <add> <tr> <add> <!-- Do not translate this table --> <add> <td> Read these guidelines in </td> <add> <td><a href="/CONTRIBUTING.md"> English </a></td> <add> <td><a href="/docs/chinese/CONTRIBUTING.md"> 中文 </a></td> <add> <td><a href="/docs/russian/CONTRIBUTING.md"> русский </a></td> <add> <td><a href="/docs/arabic/CONTRIBUTING.md"> عربي </a></td> <add> <td><a href="/docs/spanish/CONTRIBUTING.md"> Español </a></td> <add> <td><a href="/docs/portuguese/CONTRIBUTING.md"> Português </a></td> <add> </tr> <add></table> <add> <ide> #如何在指南文章工作 <ide> 在您的帮助下,我们可以创造将帮助成千上万人学会未来几年编码的一个全面参考工具。 💛 <ide> 您能: <ide> git pull上游大師 <ide> 你實際上沒有添加任何內容,所以我將無效拉請求此PR並將其標記為“無效”。 😓️ <ide> <ide> 隨意打開另一個公關! 👍 <del>``` <ide>\ No newline at end of file <add>``` <ide><path>docs/portuguese/CONTRIBUTING.md <ide> <!-- Do not translate this table --> <ide> <td> Read these guidelines in </td> <ide> <td><a href="/CONTRIBUTING.md"> English </a></td> <del> <td><a href="/docs/arabic/CONTRIBUTING.md"> عربى </a></td> <add> <td><a href="/docs/arabic/CONTRIBUTING.md"> عربي </a></td> <ide> <td><a href="/docs/chinese/CONTRIBUTING.md"> 中文 </a></td> <ide> <td><a href="/docs/portuguese/CONTRIBUTING.md"> Português </a></td> <ide> <td><a href="/docs/russian/CONTRIBUTING.md"> русский </a></td> <ide> Você pode nos ajudar a traduzir nossos Artigos de guia e Desafios de código pa <ide> <ide> - Chinês (中文) <ide> - Russo (русский) <del>- Árabe (عربى) <add>- Árabe (عربي) <ide> - Espanhol (Español) <ide> - Português (Português) <ide> <ide><path>docs/portuguese/README.md <ide> <td><a href="/CONTRIBUTING.md"> English </a></td> <ide> <td><a href="/docs/chinese/README.md"> 中文 </a></td> <ide> <td><a href="/docs/russian/README.md"> русский </a></td> <del> <td><a href="/docs/arabic/README.md"> عربى </a></td> <add> <td><a href="/docs/arabic/README.md"> عربي </a></td> <ide> <td><a href="/docs/spanish/README.md"> Español </a></td> <ide> <td><a href="/docs/portuguese/README.md"> Português </a></td> <ide> <td><a href="/docs/german/README.md"> Deutsch </a></td> <ide><path>docs/portuguese/how-to-catch-outgoing-emails-locally.md <ide> <td><a href="/CONTRIBUTING.md"> English </a></td> <ide> <td><a href="/docs/chinese/CONTRIBUTING.md"> 中文 </a></td> <ide> <td><a href="/docs/russian/CONTRIBUTING.md"> русский </a></td> <del> <td><a href="/docs/arabic/CONTRIBUTING.md"> عربى </a></td> <add> <td><a href="/docs/arabic/CONTRIBUTING.md"> عربي </a></td> <ide> <td><a href="/docs/spanish/CONTRIBUTING.md"> Español </a></td> <ide> <td><a href="/docs/portuguese/CONTRIBUTING.md"> Português </a></td> <ide> </tr> <ide><path>docs/portuguese/how-to-setup-freecodecamp-locally.md <ide> <td><a href="/CONTRIBUTING.md"> English </a></td> <ide> <td><a href="/docs/chinese/CONTRIBUTING.md"> 中文 </a></td> <ide> <td><a href="/docs/russian/CONTRIBUTING.md"> русский </a></td> <del> <td><a href="/docs/arabic/CONTRIBUTING.md"> عربى </a></td> <add> <td><a href="/docs/arabic/CONTRIBUTING.md"> عربي </a></td> <ide> <td><a href="/docs/spanish/CONTRIBUTING.md"> Español </a></td> <ide> <td><a href="/docs/portuguese/CONTRIBUTING.md"> Português </a></td> <ide> </tr> <ide><path>docs/portuguese/how-to-work-on-coding-challenges.md <ide> <td><a href="/CONTRIBUTING.md"> English </a></td> <ide> <td><a href="/docs/chinese/CONTRIBUTING.md"> 中文 </a></td> <ide> <td><a href="/docs/russian/CONTRIBUTING.md"> русский </a></td> <del> <td><a href="/docs/arabic/CONTRIBUTING.md"> عربى </a></td> <add> <td><a href="/docs/arabic/CONTRIBUTING.md"> عربي </a></td> <ide> <td><a href="/docs/spanish/CONTRIBUTING.md"> Español </a></td> <ide> <td><a href="/docs/portuguese/CONTRIBUTING.md"> Português </a></td> <ide> </tr> <ide><path>docs/portuguese/how-to-work-on-guide-articles.md <add><table> <add> <tr> <add> <!-- Do not translate this table --> <add> <td> Read these guidelines in </td> <add> <td><a href="/CONTRIBUTING.md"> English </a></td> <add> <td><a href="/docs/chinese/CONTRIBUTING.md"> 中文 </a></td> <add> <td><a href="/docs/russian/CONTRIBUTING.md"> русский </a></td> <add> <td><a href="/docs/arabic/CONTRIBUTING.md"> عربي </a></td> <add> <td><a href="/docs/spanish/CONTRIBUTING.md"> Español </a></td> <add> <td><a href="/docs/portuguese/CONTRIBUTING.md"> Português </a></td> <add> </tr> <add></table> <add> <ide> # Como trabalhar em Artigos Guia <ide> <ide> Com a tua ajuda, nós podemos criar uma ferramenta de referência compreensiva que ajudará milhões de pessoas que estão a aprender código nos anos que aí vêm. 💛 <ide> Olá @username <ide> Não adicionaste nenhum conteúdo portanto vou ter de invalidar este <i>pull request</i> e marcá-lo como `invalid`. 😓️ <ide> <ide> Estás à vontade para abrir outro PR! 👍 <del>``` <add>``` <ide>\ No newline at end of file <ide><path>docs/russian/CONTRIBUTING.md <ide> <tr> <ide> <!-- Do not translate this table --> <ide> <td> Read these guidelines in </td> <del> <td><a href='/CONTRIBUTING.md'> English </a></td> <del> <td><a href='/docs/arabic/CONTRIBUTING.md'> عربى </a></td> <del> <td><a href='/docs/chinese/CONTRIBUTING.md'> 中文 </a></td> <del> <td><a href='/docs/portuguese/CONTRIBUTING.md'> Português </a></td> <del> <td><a href='/docs/russian/CONTRIBUTING.md'> русский </a></td> <del> <td><a href='/docs/spanish/CONTRIBUTING.md'> Español </a></td> <add> <td><a href="/CONTRIBUTING.md"> English </a></td> <add> <td><a href="/docs/chinese/CONTRIBUTING.md"> 中文 </a></td> <add> <td><a href="/docs/russian/CONTRIBUTING.md"> русский </a></td> <add> <td><a href="/docs/arabic/CONTRIBUTING.md"> عربي </a></td> <add> <td><a href="/docs/spanish/CONTRIBUTING.md"> Español </a></td> <add> <td><a href="/docs/portuguese/CONTRIBUTING.md"> Português </a></td> <ide> </tr> <ide> </table> <ide> <ide> freeCodeCamp.org возможен благодаря тысячам добров <ide> <ide> - Chinese (中文) <ide> - Russian (русский) <del>- Arabic (عربى) <add>- Arabic (عربي) <ide> - Spanish (Español) <ide> - Portuguese (Português) <ide> <ide><path>docs/russian/README.md <ide> <td><a href="/CONTRIBUTING.md"> English </a></td> <ide> <td><a href="/docs/chinese/README.md"> 中文 </a></td> <ide> <td><a href="/docs/russian/README.md"> русский </a></td> <del> <td><a href="/docs/arabic/README.md"> عربى </a></td> <add> <td><a href="/docs/arabic/README.md"> عربي </a></td> <ide> <td><a href="/docs/spanish/README.md"> Español </a></td> <ide> <td><a href="/docs/portuguese/README.md"> Português </a></td> <ide> <td><a href="/docs/german/README.md"> Deutsch </a></td> <ide><path>docs/russian/how-to-catch-outgoing-emails-locally.md <ide> <table> <ide> <tr> <del> <td> Прочтите эти рекомендации на </td> <del> <td><a href='/CONTRIBUTING.md'> English </a></td> <del> <td><a href='/docs/chinese/CONTRIBUTING.md'> 中文 </a></td> <del> <td><a href='/docs/russian/CONTRIBUTING.md'> Русском </a></td> <del> <td><a href='/docs/arabic/CONTRIBUTING.md'> عربى </a></td> <del> <td><a href='/docs/spanish/CONTRIBUTING.md'> Español </a></td> <del> <td><a href='/docs/portuguese/CONTRIBUTING.md'> Português </a></td> <add> <!-- Do not translate this table --> <add> <td> Read these guidelines in </td> <add> <td><a href="/CONTRIBUTING.md"> English </a></td> <add> <td><a href="/docs/chinese/CONTRIBUTING.md"> 中文 </a></td> <add> <td><a href="/docs/russian/CONTRIBUTING.md"> русский </a></td> <add> <td><a href="/docs/arabic/CONTRIBUTING.md"> عربي </a></td> <add> <td><a href="/docs/spanish/CONTRIBUTING.md"> Español </a></td> <add> <td><a href="/docs/portuguese/CONTRIBUTING.md"> Português </a></td> <ide> </tr> <ide> </table> <ide> <del> <ide> # Как поймать исходящие электронные письма локально (для рабочих процессов электронной почты) <ide> <ide> > **Заметка:** Это **необязательный** шаг - требуется только при работе с рабочими процессами электронной почты <ide><path>docs/russian/how-to-setup-freecodecamp-locally.md <ide> <table> <ide> <tr> <add> <!-- Do not translate this table --> <ide> <td> Read these guidelines in </td> <del> <td><a href="/docs/how-to-setup-freecodecamp-locally.md"> English </a></td> <del> <td><a href="/docs/chinese/how-to-setup-freecodecamp-locally.md"> 中文 </a></td> <del> <td><a href="/docs/russian/how-to-setup-freecodecamp-locally.md"> Русский </a></td> <del> <td><a href="/docs/arabic/how-to-setup-freecodecamp-locally.md"> عربى </a></td> <del> <td><a href="/docs/spanish/how-to-setup-freecodecamp-locally.md"> Español </a></td> <del> <td><a href="/docs/portuguese/how-to-setup-freecodecamp-locally.md"> Português </a></td> <add> <td><a href="/CONTRIBUTING.md"> English </a></td> <add> <td><a href="/docs/chinese/CONTRIBUTING.md"> 中文 </a></td> <add> <td><a href="/docs/russian/CONTRIBUTING.md"> русский </a></td> <add> <td><a href="/docs/arabic/CONTRIBUTING.md"> عربي </a></td> <add> <td><a href="/docs/spanish/CONTRIBUTING.md"> Español </a></td> <add> <td><a href="/docs/portuguese/CONTRIBUTING.md"> Português </a></td> <ide> </tr> <ide> </table> <ide> <ide><path>docs/russian/how-to-work-on-coding-challenges.md <ide> <td><a href="/CONTRIBUTING.md"> English </a></td> <ide> <td><a href="/docs/chinese/CONTRIBUTING.md"> 中文 </a></td> <ide> <td><a href="/docs/russian/CONTRIBUTING.md"> русский </a></td> <del> <td><a href="/docs/arabic/CONTRIBUTING.md"> عربى </a></td> <add> <td><a href="/docs/arabic/CONTRIBUTING.md"> عربي </a></td> <ide> <td><a href="/docs/spanish/CONTRIBUTING.md"> Español </a></td> <ide> <td><a href="/docs/portuguese/CONTRIBUTING.md"> Português </a></td> <ide> </tr> <ide><path>docs/russian/how-to-work-on-guide-articles.md <ide> <td><a href="/CONTRIBUTING.md"> English </a></td> <ide> <td><a href="/docs/chinese/CONTRIBUTING.md"> 中文 </a></td> <ide> <td><a href="/docs/russian/CONTRIBUTING.md"> русский </a></td> <del> <td><a href="/docs/arabic/CONTRIBUTING.md"> عربى </a></td> <add> <td><a href="/docs/arabic/CONTRIBUTING.md"> عربي </a></td> <ide> <td><a href="/docs/spanish/CONTRIBUTING.md"> Español </a></td> <ide> <td><a href="/docs/portuguese/CONTRIBUTING.md"> Português </a></td> <ide> </tr> <ide><path>docs/spanish/CONTRIBUTING.md <ide> <!-- Do not translate this table --> <ide> <td> Read these guidelines in </td> <ide> <td><a href="/CONTRIBUTING.md"> English </a></td> <del> <td><a href="/docs/arabic/CONTRIBUTING.md"> عربى </a></td> <add> <td><a href="/docs/arabic/CONTRIBUTING.md"> عربي </a></td> <ide> <td><a href="/docs/chinese/CONTRIBUTING.md"> 中文 </a></td> <ide> <td><a href="/docs/portuguese/CONTRIBUTING.md"> Português </a></td> <ide> <td><a href="/docs/russian/CONTRIBUTING.md"> русский </a></td> <ide><path>docs/spanish/README.md <ide> <td><a href="/CONTRIBUTING.md"> English </a></td> <ide> <td><a href="/docs/chinese/README.md"> 中文 </a></td> <ide> <td><a href="/docs/russian/README.md"> русский </a></td> <del> <td><a href="/docs/arabic/README.md"> عربى </a></td> <add> <td><a href="/docs/arabic/README.md"> عربي </a></td> <ide> <td><a href="/docs/spanish/README.md"> Español </a></td> <ide> <td><a href="/docs/portuguese/README.md"> Português </a></td> <ide> <td><a href="/docs/german/README.md"> Deutsch </a></td> <ide><path>docs/spanish/how-to-catch-outgoing-emails-locally.md <ide> <td><a href="/CONTRIBUTING.md"> English </a></td> <ide> <td><a href="/docs/chinese/CONTRIBUTING.md"> 中文 </a></td> <ide> <td><a href="/docs/russian/CONTRIBUTING.md"> русский </a></td> <del> <td><a href="/docs/arabic/CONTRIBUTING.md"> عربى </a></td> <add> <td><a href="/docs/arabic/CONTRIBUTING.md"> عربي </a></td> <ide> <td><a href="/docs/spanish/CONTRIBUTING.md"> Español </a></td> <ide> <td><a href="/docs/portuguese/CONTRIBUTING.md"> Português </a></td> <ide> </tr> <ide><path>docs/spanish/how-to-setup-freecodecamp-locally.md <add><table> <add> <tr> <add> <!-- Do not translate this table --> <add> <td> Read these guidelines in </td> <add> <td><a href="/CONTRIBUTING.md"> English </a></td> <add> <td><a href="/docs/chinese/CONTRIBUTING.md"> 中文 </a></td> <add> <td><a href="/docs/russian/CONTRIBUTING.md"> русский </a></td> <add> <td><a href="/docs/arabic/CONTRIBUTING.md"> عربي </a></td> <add> <td><a href="/docs/spanish/CONTRIBUTING.md"> Español </a></td> <add> <td><a href="/docs/portuguese/CONTRIBUTING.md"> Português </a></td> <add> </tr> <add></table> <add> <ide> # Configura freeCodeCamp localmente en tu sistema <ide> <ide> Sigue esta guía para poder configurar freeCodeCamp localmente en tu sistema. Esto es altamente recomendable si quieres realizar contribuciones regularmente. <ide><path>docs/spanish/how-to-work-on-coding-challenges.md <ide> <td><a href="/CONTRIBUTING.md"> English </a></td> <ide> <td><a href="/docs/chinese/CONTRIBUTING.md"> 中文 </a></td> <ide> <td><a href="/docs/russian/CONTRIBUTING.md"> русский </a></td> <del> <td><a href="/docs/arabic/CONTRIBUTING.md"> عربى </a></td> <add> <td><a href="/docs/arabic/CONTRIBUTING.md"> عربي </a></td> <ide> <td><a href="/docs/spanish/CONTRIBUTING.md"> Español </a></td> <ide> <td><a href="/docs/portuguese/CONTRIBUTING.md"> Português </a></td> <ide> </tr> <ide><path>docs/spanish/how-to-work-on-guide-articles.md <add><table> <add> <tr> <add> <!-- Do not translate this table --> <add> <td> Read these guidelines in </td> <add> <td><a href="/CONTRIBUTING.md"> English </a></td> <add> <td><a href="/docs/chinese/CONTRIBUTING.md"> 中文 </a></td> <add> <td><a href="/docs/russian/CONTRIBUTING.md"> русский </a></td> <add> <td><a href="/docs/arabic/CONTRIBUTING.md"> عربي </a></td> <add> <td><a href="/docs/spanish/CONTRIBUTING.md"> Español </a></td> <add> <td><a href="/docs/portuguese/CONTRIBUTING.md"> Português </a></td> <add> </tr> <add></table> <add> <ide> # Cómo trabajar en artículo de la Guía <ide> <ide> Con tu yuda, podemos crear un herramienta de referencia accesible que ayudará a millones de personas que están aprendiendo a programar en los próximos años. 💛
32
Text
Text
add solutions to bootstrap challenges
c08f3785cba163becb98b68ef99ecaab6e0eb80a
<ide><path>curriculum/challenges/english/03-front-end-libraries/bootstrap/add-font-awesome-icons-to-all-of-our-buttons.english.md <ide> tests: <ide> ## Solution <ide> <section id='solution'> <ide> <del>```js <del>// solution required <add>```html <add><link href="https://fonts.googleapis.com/css?family=Lobster" rel="stylesheet" type="text/css"> <add><style> <add> h2 { <add> font-family: Lobster, Monospace; <add> } <add> <add> .thick-green-border { <add> border-color: green; <add> border-width: 10px; <add> border-style: solid; <add> border-radius: 50%; <add> } <add></style> <add> <add><div class="container-fluid"> <add> <div class="row"> <add> <div class="col-xs-8"> <add> <h2 class="text-primary text-center">CatPhotoApp</h2> <add> </div> <add> <div class="col-xs-4"> <add> <a href="#"><img class="img-responsive thick-green-border" src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back."></a> <add> </div> <add> </div> <add> <img src="https://bit.ly/fcc-running-cats" class="img-responsive" alt="Three kittens running towards the camera."> <add> <div class="row"> <add> <div class="col-xs-4"> <add> <button class="btn btn-block btn-primary"><i class="fa fa-thumbs-up"></i> Like</button> <add> </div> <add> <div class="col-xs-4"> <add> <button class="btn btn-block btn-info"><i class="fa fa-info-circle"></i> Info</button> <add> </div> <add> <div class="col-xs-4"> <add> <button class="btn btn-block btn-danger"><i class="fa fa-trash"></i> Delete</button> <add> </div> <add> </div> <add> <p>Things cats <span class="text-danger">love:</span></p> <add> <ul> <add> <li>cat nip</li> <add> <li>laser pointers</li> <add> <li>lasagna</li> <add> </ul> <add> <p>Top 3 things cats hate:</p> <add> <ol> <add> <li>flea treatment</li> <add> <li>thunder</li> <add> <li>other cats</li> <add> </ol> <add> <form action="/submit-cat-photo"> <add> <label><input type="radio" name="indoor-outdoor"> Indoor</label> <add> <label><input type="radio" name="indoor-outdoor"> Outdoor</label> <add> <label><input type="checkbox" name="personality"> Loving</label> <add> <label><input type="checkbox" name="personality"> Lazy</label> <add> <label><input type="checkbox" name="personality"> Crazy</label> <add> <input type="text" placeholder="cat photo URL" required> <add> <button type="submit">Submit</button> <add> </form> <add></div> <ide> ``` <ide> </section> <ide><path>curriculum/challenges/english/03-front-end-libraries/bootstrap/add-font-awesome-icons-to-our-buttons.english.md <ide> tests: <ide> ## Solution <ide> <section id='solution'> <ide> <del>```js <del>// solution required <add>```html <add><link href="https://fonts.googleapis.com/css?family=Lobster" rel="stylesheet" type="text/css"> <add><style> <add> h2 { <add> font-family: Lobster, Monospace; <add> } <add> <add> .thick-green-border { <add> border-color: green; <add> border-width: 10px; <add> border-style: solid; <add> border-radius: 50%; <add> } <add></style> <add> <add><div class="container-fluid"> <add> <div class="row"> <add> <div class="col-xs-8"> <add> <h2 class="text-primary text-center">CatPhotoApp</h2> <add> </div> <add> <div class="col-xs-4"> <add> <a href="#"><img class="img-responsive thick-green-border" src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back."></a> <add> </div> <add> </div> <add> <img src="https://bit.ly/fcc-running-cats" class="img-responsive" alt="Three kittens running towards the camera."> <add> <div class="row"> <add> <div class="col-xs-4"> <add> <button class="btn btn-block btn-primary"><i class="fa fa-thumbs-up"></i> Like</button> <add> </div> <add> <div class="col-xs-4"> <add> <button class="btn btn-block btn-info">Info</button> <add> </div> <add> <div class="col-xs-4"> <add> <button class="btn btn-block btn-danger">Delete</button> <add> </div> <add> </div> <add> <p>Things cats <span class="text-danger">love:</span></p> <add> <ul> <add> <li>cat nip</li> <add> <li>laser pointers</li> <add> <li>lasagna</li> <add> </ul> <add> <p>Top 3 things cats hate:</p> <add> <ol> <add> <li>flea treatment</li> <add> <li>thunder</li> <add> <li>other cats</li> <add> </ol> <add> <form action="/submit-cat-photo"> <add> <label><input type="radio" name="indoor-outdoor"> Indoor</label> <add> <label><input type="radio" name="indoor-outdoor"> Outdoor</label> <add> <label><input type="checkbox" name="personality"> Loving</label> <add> <label><input type="checkbox" name="personality"> Lazy</label> <add> <label><input type="checkbox" name="personality"> Crazy</label> <add> <input type="text" placeholder="cat photo URL" required> <add> <button type="submit">Submit</button> <add> </form> <add></div> <ide> ``` <ide> </section> <ide><path>curriculum/challenges/english/03-front-end-libraries/bootstrap/add-id-attributes-to-bootstrap-elements.english.md <ide> tests: <ide> ## Solution <ide> <section id='solution'> <ide> <del>```js <del>// solution required <add>```html <add><div class="container-fluid"> <add> <h3 class="text-primary text-center">jQuery Playground</h3> <add> <div class="row"> <add> <div class="col-xs-6"> <add> <div class="well" id="left-well"> <add> <button class="btn btn-default target"></button> <add> <button class="btn btn-default target"></button> <add> <button class="btn btn-default target"></button> <add> </div> <add> </div> <add> <div class="col-xs-6"> <add> <div class="well" id="right-well"> <add> <button class="btn btn-default target"></button> <add> <button class="btn btn-default target"></button> <add> <button class="btn btn-default target"></button> <add> </div> <add> </div> <add> </div> <add></div> <ide> ``` <ide> </section>
3
Javascript
Javascript
remove unstable_ prefix from suspense
d75c69e0cf2a842adc47edab87ca5103411e6949
<ide><path>fixtures/dom/src/components/fixtures/suspense/index.js <ide> import TestCase from '../../TestCase'; <ide> const React = window.React; <ide> const ReactDOM = window.ReactDOM; <ide> <del>const Suspense = React.unstable_Suspense; <add>const Suspense = React.Suspense; <ide> <ide> let cache = new Set(); <ide> <ide><path>fixtures/unstable-async/suspense/src/components/App.js <del>import React, {lazy, unstable_Suspense as Suspense, PureComponent} from 'react'; <add>import React, {lazy, Suspense, PureComponent} from 'react'; <ide> import {unstable_scheduleCallback} from 'scheduler'; <ide> import { <ide> unstable_trace as trace, <ide><path>fixtures/unstable-async/suspense/src/components/UserPage.js <del>import React, {unstable_Suspense as Suspense} from 'react'; <add>import React, {Suspense} from 'react'; <ide> import {createResource} from 'react-cache'; <ide> import Spinner from './Spinner'; <ide> import {cache} from '../cache'; <ide><path>packages/react-dom/src/__tests__/ReactDOMServerSuspense-test.internal.js <ide> describe('ReactDOMServerSuspense', () => { <ide> throw new Promise(() => {}); <ide> }; <ide> const e = await serverRender( <del> <React.unstable_Suspense fallback={<div />}> <add> <React.Suspense fallback={<div />}> <ide> <Suspended /> <del> </React.unstable_Suspense>, <add> </React.Suspense>, <ide> ); <ide> <ide> expect(e.tagName).toBe('DIV'); <ide><path>packages/react-dom/src/__tests__/ReactDOMSuspensePlaceholder-test.internal.js <ide> describe('ReactDOMSuspensePlaceholder', () => { <ide> beforeEach(() => { <ide> jest.resetModules(); <ide> ReactFeatureFlags = require('shared/ReactFeatureFlags'); <del> ReactFeatureFlags.enableSuspense = true; <ide> React = require('react'); <ide> ReactDOM = require('react-dom'); <ide> ReactCache = require('react-cache'); <del> Suspense = React.unstable_Suspense; <add> Suspense = React.Suspense; <ide> container = document.createElement('div'); <ide> <ide> function invalidateCache() { <ide><path>packages/react-dom/src/__tests__/ReactServerRendering-test.js <ide> describe('ReactDOMServer', () => { <ide> <ide> it('throws for unsupported types on the server', () => { <ide> expect(() => { <del> ReactDOMServer.renderToString(<React.unstable_Suspense />); <add> ReactDOMServer.renderToString(<React.Suspense />); <ide> }).toThrow('ReactDOMServer does not yet support Suspense.'); <ide> <ide> async function fakeImport(result) { <ide><path>packages/react-dom/src/__tests__/ReactServerRenderingHydration-test.js <ide> describe('ReactDOMServerHydration', () => { <ide> <div> <ide> Hello{' '} <ide> {this.state.isClient && ( <del> <React.unstable_Suspense fallback="loading"> <add> <React.Suspense fallback="loading"> <ide> <Lazy /> <del> </React.unstable_Suspense> <add> </React.Suspense> <ide> )} <ide> </div> <ide> ); <ide><path>packages/react-reconciler/src/__tests__/ReactIncrementalPerf-test.internal.js <ide> describe('ReactDebugFiberPerf', () => { <ide> <ide> ReactNoop.render( <ide> <Parent> <del> <React.unstable_Suspense fallback={<Spinner />}> <add> <React.Suspense fallback={<Spinner />}> <ide> <LazyFoo /> <del> </React.unstable_Suspense> <add> </React.Suspense> <ide> </Parent>, <ide> ); <ide> ReactNoop.flush(); <ide> describe('ReactDebugFiberPerf', () => { <ide> <ide> ReactNoop.render( <ide> <Parent> <del> <React.unstable_Suspense> <add> <React.Suspense> <ide> <LazyFoo /> <del> </React.unstable_Suspense> <add> </React.Suspense> <ide> </Parent>, <ide> ); <ide> ReactNoop.flush(); <ide><path>packages/react-reconciler/src/__tests__/ReactLazy-test.internal.js <ide> describe('ReactLazy', () => { <ide> ReactFeatureFlags.debugRenderPhaseSideEffectsForStrictMode = false; <ide> ReactFeatureFlags.replayFailedUnitOfWorkWithInvokeGuardedCallback = false; <ide> React = require('react'); <del> Suspense = React.unstable_Suspense; <add> Suspense = React.Suspense; <ide> lazy = React.lazy; <ide> ReactTestRenderer = require('react-test-renderer'); <ide> }); <ide><path>packages/react-reconciler/src/__tests__/ReactMemo-test.internal.js <ide> describe('memo', () => { <ide> function sharedTests(label, memo) { <ide> describe(`${label}`, () => { <ide> it('bails out on props equality', async () => { <del> const {unstable_Suspense: Suspense} = React; <add> const {Suspense} = React; <ide> <ide> function Counter({count}) { <ide> return <Text text={count} />; <ide> describe('memo', () => { <ide> }); <ide> <ide> it("does not bail out if there's a context change", async () => { <del> const {unstable_Suspense: Suspense} = React; <add> const {Suspense} = React; <ide> <ide> const CountContext = React.createContext(0); <ide> <ide> describe('memo', () => { <ide> }); <ide> <ide> it('accepts custom comparison function', async () => { <del> const {unstable_Suspense: Suspense} = React; <add> const {Suspense} = React; <ide> <ide> function Counter({count}) { <ide> return <Text text={count} />; <ide> describe('memo', () => { <ide> }); <ide> <ide> it('supports non-pure class components', async () => { <del> const {unstable_Suspense: Suspense} = React; <add> const {Suspense} = React; <ide> <ide> class CounterInner extends React.Component { <ide> static defaultProps = {suffix: '!'}; <ide><path>packages/react-reconciler/src/__tests__/ReactSuspense-test.internal.js <ide> describe('ReactSuspense', () => { <ide> // JestReact = require('jest-react'); <ide> ReactCache = require('react-cache'); <ide> <del> Suspense = React.unstable_Suspense; <add> Suspense = React.Suspense; <ide> <ide> function invalidateCache() { <ide> cache = ReactCache.createCache(invalidateCache); <ide><path>packages/react-reconciler/src/__tests__/ReactSuspensePlaceholder-test.internal.js <ide> function runPlaceholderTests(suiteLabel, loadReactNoop) { <ide> // JestReact = require('jest-react'); <ide> ReactCache = require('react-cache'); <ide> <del> Suspense = React.unstable_Suspense; <add> Suspense = React.Suspense; <ide> <ide> function invalidateCache() { <ide> cache = ReactCache.createCache(invalidateCache); <ide><path>packages/react-reconciler/src/__tests__/ReactSuspenseWithNoopRenderer-test.internal.js <ide> describe('ReactSuspenseWithNoopRenderer', () => { <ide> Fragment = React.Fragment; <ide> ReactNoop = require('react-noop-renderer'); <ide> ReactCache = require('react-cache'); <del> Suspense = React.unstable_Suspense; <add> Suspense = React.Suspense; <ide> StrictMode = React.StrictMode; <ide> ConcurrentMode = React.unstable_ConcurrentMode; <ide> <ide><path>packages/react/src/React.js <ide> const React = { <ide> Fragment: REACT_FRAGMENT_TYPE, <ide> StrictMode: REACT_STRICT_MODE_TYPE, <ide> unstable_ConcurrentMode: REACT_CONCURRENT_MODE_TYPE, <del> unstable_Suspense: REACT_SUSPENSE_TYPE, <add> Suspense: REACT_SUSPENSE_TYPE, <ide> unstable_Profiler: REACT_PROFILER_TYPE, <ide> <ide> createElement: __DEV__ ? createElementWithValidation : createElement, <ide><path>packages/react/src/__tests__/ReactProfiler-test.internal.js <ide> describe('Profiler', () => { <ide> SchedulerTracing.unstable_trace(interaction.name, mockNow(), () => { <ide> ReactNoop.render( <ide> <React.unstable_Profiler id="test-profiler" onRender={onRender}> <del> <React.unstable_Suspense fallback={<Text text="Loading..." />}> <add> <React.Suspense fallback={<Text text="Loading..." />}> <ide> <AsyncText text="Async" ms={20000} /> <del> </React.unstable_Suspense> <add> </React.Suspense> <ide> <Text text="Sync" /> <ide> <Monkey ref={monkey} /> <ide> </React.unstable_Profiler>, <ide> describe('Profiler', () => { <ide> () => { <ide> ReactTestRenderer.create( <ide> <React.unstable_Profiler id="app" onRender={onRender}> <del> <React.unstable_Suspense <add> <React.Suspense <ide> maxDuration={1000} <ide> fallback={<Text text="loading" />}> <ide> <AsyncText text="loaded" ms={2000} /> <del> </React.unstable_Suspense> <add> </React.Suspense> <ide> </React.unstable_Profiler>, <ide> ); <ide> }, <ide> describe('Profiler', () => { <ide> () => { <ide> ReactTestRenderer.create( <ide> <React.unstable_Profiler id="app" onRender={onRender}> <del> <React.unstable_Suspense <add> <React.Suspense <ide> maxDuration={1000} <ide> fallback={<Text text="loading" />}> <ide> <AsyncComponentWithCascadingWork text="loaded" ms={2000} /> <del> </React.unstable_Suspense> <add> </React.Suspense> <ide> </React.unstable_Profiler>, <ide> ); <ide> }, <ide> describe('Profiler', () => { <ide> () => { <ide> renderer = ReactTestRenderer.create( <ide> <React.unstable_Profiler id="app" onRender={onRender}> <del> <React.unstable_Suspense <add> <React.Suspense <ide> maxDuration={1000} <ide> fallback={<Text text="loading" />}> <ide> <AsyncText text="loaded" ms={2000} /> <del> </React.unstable_Suspense> <add> </React.Suspense> <ide> </React.unstable_Profiler>, <ide> { <ide> unstable_isConcurrent: true, <ide> describe('Profiler', () => { <ide> () => { <ide> renderer = ReactTestRenderer.create( <ide> <React.unstable_Profiler id="app" onRender={onRender}> <del> <React.unstable_Suspense <add> <React.Suspense <ide> maxDuration={2000} <ide> fallback={<Text text="loading" />}> <ide> <AsyncText text="loaded" ms={1000} /> <del> </React.unstable_Suspense> <add> </React.Suspense> <ide> </React.unstable_Profiler>, <ide> {unstable_isConcurrent: true}, <ide> ); <ide> describe('Profiler', () => { <ide> () => { <ide> renderer = ReactTestRenderer.create( <ide> <React.unstable_Profiler id="app" onRender={onRender}> <del> <React.unstable_Suspense <add> <React.Suspense <ide> maxDuration={2000} <ide> fallback={<Text text="loading" />}> <ide> <AsyncText text="loaded" ms={1000} /> <del> </React.unstable_Suspense> <add> </React.Suspense> <ide> <Text text="initial" /> <ide> </React.unstable_Profiler>, <ide> ); <ide> describe('Profiler', () => { <ide> () => { <ide> renderer.update( <ide> <React.unstable_Profiler id="app" onRender={onRender}> <del> <React.unstable_Suspense <add> <React.Suspense <ide> maxDuration={2000} <ide> fallback={<Text text="loading" />}> <ide> <AsyncText text="loaded" ms={1000} /> <del> </React.unstable_Suspense> <add> </React.Suspense> <ide> <Text text="updated" /> <ide> </React.unstable_Profiler>, <ide> ); <ide> describe('Profiler', () => { <ide> () => { <ide> renderer = ReactTestRenderer.create( <ide> <React.unstable_Profiler id="app" onRender={onRender}> <del> <React.unstable_Suspense <add> <React.Suspense <ide> maxDuration={2000} <ide> fallback={<Text text="loading" />}> <ide> <AsyncText text="loaded" ms={1000} /> <del> </React.unstable_Suspense> <add> </React.Suspense> <ide> <Text text="initial" /> <ide> </React.unstable_Profiler>, <ide> {unstable_isConcurrent: true}, <ide> describe('Profiler', () => { <ide> () => { <ide> renderer.update( <ide> <React.unstable_Profiler id="app" onRender={onRender}> <del> <React.unstable_Suspense <add> <React.Suspense <ide> maxDuration={2000} <ide> fallback={<Text text="loading" />}> <ide> <AsyncText text="loaded" ms={1000} /> <del> </React.unstable_Suspense> <add> </React.Suspense> <ide> <Text text="updated" /> <ide> </React.unstable_Profiler>, <ide> ); <ide><path>packages/react/src/__tests__/ReactProfilerDOM-test.internal.js <ide> describe('ProfilerDOM', () => { <ide> const root = ReactDOM.unstable_createRoot(element); <ide> batch = root.createBatch(); <ide> batch.render( <del> <React.unstable_Suspense <del> maxDuration={100} <del> fallback={<Text text="Loading..." />}> <add> <React.Suspense maxDuration={100} fallback={<Text text="Loading..." />}> <ide> <AsyncText text="Text" ms={200} /> <del> </React.unstable_Suspense>, <add> </React.Suspense>, <ide> ); <ide> batch.then( <ide> SchedulerTracing.unstable_wrap(() => {
16
PHP
PHP
fix spelling of 'optionally'
dc7c76d28d5dad3ee1223be6019f3cad4afded13
<ide><path>src/Illuminate/Support/helpers.php <ide> function windows_os() <ide> <ide> if (! function_exists('with')) { <ide> /** <del> * Return the given value, optionaly passed through the given callback. <add> * Return the given value, optionally passed through the given callback. <ide> * <ide> * @param mixed $value <ide> * @param callable|null $callback
1
Javascript
Javascript
remove erroneous whitespace
8de83725ac3aa05a12acbbd27012c4282af7635c
<ide><path>lib/util.js <ide> function getPrefix(constructor, tag) { <ide> return ''; <ide> } <ide> <del>function formatValue(ctx, value, recurseTimes, ln) { <add>function formatValue(ctx, value, recurseTimes) { <ide> // Primitive types cannot have properties <ide> if (typeof value !== 'object' && typeof value !== 'function') { <ide> return formatPrimitive(ctx.stylize, value, ctx); <ide> function formatValue(ctx, value, recurseTimes, ln) { <ide> return ctx.stylize(dateToISOString.call(value), 'date'); <ide> } <ide> // Make dates with properties first say the date <del> base = `${dateToISOString.call(value)}`; <add> base = dateToISOString.call(value); <ide> } else if (isError(value)) { <ide> // Make error with message first say the error <ide> base = formatError(value); <ide> function formatValue(ctx, value, recurseTimes, ln) { <ide> } <ide> ctx.seen.pop(); <ide> <del> return reduceToSingleString(ctx, output, base, braces, ln); <add> return reduceToSingleString(ctx, output, base, braces); <ide> } <ide> <ide> function formatNumber(fn, value) { <ide> function formatNamespaceObject(ctx, value, recurseTimes, keys) { <ide> const len = keys.length; <ide> const output = new Array(len); <ide> for (var i = 0; i < len; i++) { <del> output[i] = formatNamespaceProperty(ctx, value, recurseTimes, keys[i]); <add> try { <add> output[i] = formatProperty(ctx, value, recurseTimes, keys[i], 0); <add> } catch (err) { <add> if (!(err instanceof ReferenceError)) { <add> throw err; <add> } <add> // Use the existing functionality. This makes sure the indentation and <add> // line breaks are always correct. Otherwise it is very difficult to keep <add> // this aligned, even though this is a hacky way of dealing with this. <add> const tmp = { [keys[i]]: '' }; <add> output[i] = formatProperty(ctx, tmp, recurseTimes, keys[i], 0); <add> const pos = output[i].lastIndexOf(' '); <add> // We have to find the last whitespace and have to replace that value as <add> // it will be visualized as a regular string. <add> output[i] = output[i].slice(0, pos + 1) + <add> ctx.stylize('<uninitialized>', 'special'); <add> } <ide> } <ide> return output; <ide> } <ide> function formatPromise(ctx, value, recurseTimes, keys) { <ide> return output; <ide> } <ide> <del>function formatKey(ctx, key, enumerable) { <del> if (typeof key === 'symbol') { <del> return `[${ctx.stylize(key.toString(), 'symbol')}]`; <del> } <del> if (enumerable === false) { <del> return `[${key}]`; <del> } <del> if (keyStrRegExp.test(key)) { <del> return ctx.stylize(key, 'name'); <del> } <del> return ctx.stylize(strEscape(key), 'string'); <del>} <del> <del>function formatNamespaceProperty(ctx, ns, recurseTimes, key) { <del> let value; <del> try { <del> value = formatValue(ctx, ns[key], recurseTimes, true); <del> } catch (err) { <del> if (err instanceof ReferenceError) { <del> value = ctx.stylize('<uninitialized>', 'special'); <del> } else { <del> throw err; <del> } <del> } <del> <del> return `${formatKey(ctx, key)}: ${value}`; <del>} <del> <ide> function formatProperty(ctx, value, recurseTimes, key, array) { <del> let str; <add> let name, str; <add> let extra = ' '; <ide> const desc = Object.getOwnPropertyDescriptor(value, key) || <ide> { value: value[key], enumerable: true }; <ide> if (desc.value !== undefined) { <ide> const diff = array !== 0 || ctx.compact === false ? 2 : 3; <ide> ctx.indentationLvl += diff; <del> str = formatValue(ctx, desc.value, recurseTimes, array === 0); <add> str = formatValue(ctx, desc.value, recurseTimes); <add> if (diff === 3) { <add> const len = ctx.colors ? removeColors(str).length : str.length; <add> if (ctx.breakLength < len) { <add> extra = `\n${' '.repeat(ctx.indentationLvl)}`; <add> } <add> } <ide> ctx.indentationLvl -= diff; <ide> } else if (desc.get !== undefined) { <ide> if (desc.set !== undefined) { <ide> function formatProperty(ctx, value, recurseTimes, key, array) { <ide> if (array === 1) { <ide> return str; <ide> } <del> <del> return `${formatKey(ctx, key, desc.enumerable)}: ${str}`; <add> if (typeof key === 'symbol') { <add> name = `[${ctx.stylize(key.toString(), 'symbol')}]`; <add> } else if (desc.enumerable === false) { <add> name = `[${key}]`; <add> } else if (keyStrRegExp.test(key)) { <add> name = ctx.stylize(key, 'name'); <add> } else { <add> name = ctx.stylize(strEscape(key), 'string'); <add> } <add> return `${name}:${extra}${str}`; <ide> } <ide> <del>function reduceToSingleString(ctx, output, base, braces, addLn) { <add>function reduceToSingleString(ctx, output, base, braces) { <ide> const breakLength = ctx.breakLength; <ide> let i = 0; <ide> if (ctx.compact === false) { <ide> function reduceToSingleString(ctx, output, base, braces, addLn) { <ide> // we need to force the first item to be on the next line or the <ide> // items will not line up correctly. <ide> const indentation = ' '.repeat(ctx.indentationLvl); <del> const extraLn = addLn === true ? `\n${indentation}` : ''; <ide> const ln = base === '' && braces[0].length === 1 ? <del> ' ' : `${base ? ` ${base}` : base}\n${indentation} `; <add> ' ' : `${base ? ` ${base}` : ''}\n${indentation} `; <ide> const str = join(output, `,\n${indentation} `); <del> return `${extraLn}${braces[0]}${ln}${str} ${braces[1]}`; <add> return `${braces[0]}${ln}${str} ${braces[1]}`; <ide> } <ide> <ide> function isBoolean(arg) { <ide><path>test/parallel/test-util-format.js <ide> assert.strictEqual( <ide> util.format('%o', obj), <ide> '{ foo: \'bar\',\n' + <ide> ' foobar: 1,\n' + <del> ' func: \n' + <add> ' func:\n' + <ide> ' { [Function: func]\n' + <ide> ' [length]: 0,\n' + <ide> ' [name]: \'func\',\n' + <ide> assert.strictEqual( <ide> util.format('%o', nestedObj2), <ide> '{ foo: \'bar\',\n' + <ide> ' foobar: 1,\n' + <del> ' func: \n' + <del> ' [ { a: \n' + <add> ' func:\n' + <add> ' [ { a:\n' + <ide> ' { [Function: a]\n' + <ide> ' [length]: 0,\n' + <ide> ' [name]: \'a\',\n' + <ide> assert.strictEqual( <ide> assert.strictEqual( <ide> util.format('%o', nestedObj), <ide> '{ foo: \'bar\',\n' + <del> ' foobar: \n' + <add> ' foobar:\n' + <ide> ' { foo: \'bar\',\n' + <del> ' func: \n' + <add> ' func:\n' + <ide> ' { [Function: func]\n' + <ide> ' [length]: 0,\n' + <ide> ' [name]: \'func\',\n' + <ide> assert.strictEqual( <ide> util.format('%o %o', obj, obj), <ide> '{ foo: \'bar\',\n' + <ide> ' foobar: 1,\n' + <del> ' func: \n' + <add> ' func:\n' + <ide> ' { [Function: func]\n' + <ide> ' [length]: 0,\n' + <ide> ' [name]: \'func\',\n' + <ide> ' [prototype]: func { [constructor]: [Circular] } } }' + <ide> ' { foo: \'bar\',\n' + <ide> ' foobar: 1,\n' + <del> ' func: \n' + <add> ' func:\n' + <ide> ' { [Function: func]\n' + <ide> ' [length]: 0,\n' + <ide> ' [name]: \'func\',\n' + <ide> assert.strictEqual( <ide> util.format('%o %o', obj), <ide> '{ foo: \'bar\',\n' + <ide> ' foobar: 1,\n' + <del> ' func: \n' + <add> ' func:\n' + <ide> ' { [Function: func]\n' + <ide> ' [length]: 0,\n' + <ide> ' [name]: \'func\',\n' + <ide><path>test/parallel/test-util-inspect.js <ide> assert.strictEqual(util.inspect(Object.create(Date.prototype)), 'Date {}'); <ide> { <ide> const x = { [util.inspect.custom]: util.inspect }; <ide> assert(util.inspect(x).includes( <del> '[Symbol(util.inspect.custom)]: \n { [Function: inspect]')); <add> '[Symbol(util.inspect.custom)]:\n { [Function: inspect]')); <ide> } <ide> <ide> // `util.inspect` should display the escaped value of a key. <ide> util.inspect(process); <ide> <ide> let out = util.inspect(o, { compact: true, depth: 5, breakLength: 80 }); <ide> let expect = [ <del> '{ a: ', <add> '{ a:', <ide> ' [ 1,', <ide> ' 2,', <ide> " [ [ 'Lorem ipsum dolor\\nsit amet,\\tconsectetur adipiscing elit, " + <ide><path>test/parallel/test-whatwg-url-inspect.js <ide> const url = new URL('https://username:password@host.name:8080/path/name/?que=ry# <ide> assert.strictEqual( <ide> util.inspect(url), <ide> `URL { <del> href: 'https://username:password@host.name:8080/path/name/?que=ry#hash', <add> href: <add> 'https://username:password@host.name:8080/path/name/?que=ry#hash', <ide> origin: 'https://host.name:8080', <ide> protocol: 'https:', <ide> username: 'username', <ide> assert.strictEqual( <ide> assert.strictEqual( <ide> util.inspect(url, { showHidden: true }), <ide> `URL { <del> href: 'https://username:password@host.name:8080/path/name/?que=ry#hash', <add> href: <add> 'https://username:password@host.name:8080/path/name/?que=ry#hash', <ide> origin: 'https://host.name:8080', <ide> protocol: 'https:', <ide> username: 'username', <ide> assert.strictEqual( <ide> hash: '#hash', <ide> cannotBeBase: false, <ide> special: true, <del> [Symbol(context)]:\x20 <add> [Symbol(context)]: <ide> URLContext { <ide> flags: 2032, <ide> scheme: 'https:',
4
Ruby
Ruby
move path utils out of formula.rb
1b372d7840a60c8d592aa03e5c95fb41a6c5fb6b
<ide><path>Library/Homebrew/extend/fileutils.rb <add>require 'fileutils' <add> <add># We enhance FileUtils to make our Formula code more readable. <add>module Homebrew::FileUtils <add> include FileUtils <add> <add> # Create a temporary directory then yield. When the block returns, <add> # recursively delete the temporary directory. <add> def mktemp <add> # I used /tmp rather than `mktemp -td` because that generates a directory <add> # name with exotic characters like + in it, and these break badly written <add> # scripts that don't escape strings before trying to regexp them :( <add> <add> # If the user has FileVault enabled, then we can't mv symlinks from the <add> # /tmp volume to the other volume. So we let the user override the tmp <add> # prefix if they need to. <add> tmp_prefix = ENV['HOMEBREW_TEMP'] || '/tmp' <add> tmp=Pathname.new `/usr/bin/mktemp -d #{tmp_prefix}/homebrew-#{name}-#{version}-XXXX`.strip <add> raise "Couldn't create build sandbox" if not tmp.directory? or $? != 0 <add> begin <add> wd=Dir.pwd <add> chdir tmp <add> yield <add> ensure <add> chdir wd <add> tmp.rmtree <add> end <add> end <add> <add> # A version of mkdir that also changes to that folder in a block. <add> def mkdir name, &block <add> super(name) <add> if block_given? <add> chdir name do <add> yield <add> end <add> end <add> end <add> <add>end <ide><path>Library/Homebrew/formula.rb <ide> require 'download_strategy' <del>require 'fileutils' <ide> require 'formula_support' <ide> require 'hardware' <add>require 'extend/fileutils' <ide> <ide> <ide> # Derive and define at least @url, see Library/Formula for examples <ide> class Formula <del> include FileUtils <add> include Homebrew::FileUtils <ide> <ide> attr_reader :name, :path, :url, :version, :homepage, :specs, :downloader <ide> attr_reader :standard, :unstable <ide> def var; HOMEBREW_PREFIX+'var' end <ide> def plist_name; 'homebrew.mxcl.'+name end <ide> def plist_path; prefix+(plist_name+'.plist') end <ide> <del> # A version of mkdir that also changes to that folder in a block <del> def mkdir name, &block <del> FileUtils.mkdir name <del> if block_given? <del> FileUtils.chdir name do <del> yield <del> end <del> end <del> end <del> <ide> # Use the @spec_to_use to detect the download strategy. <ide> # Can be overriden to force a custom download strategy <ide> def download_strategy <ide> def self.expand_deps f <ide> end <ide> <ide> protected <add> <ide> # Pretty titles the command and buffers stdout/stderr <ide> # Throws if there's an error <ide> def system cmd, *args <ide> def system cmd, *args <ide> raise BuildError.new(self, cmd, args, $?) <ide> end <ide> <del>private <del> # Create a temporary directory then yield. When the block returns, <del> # recursively delete the temporary directory. <del> def mktemp <del> # I used /tmp rather than `mktemp -td` because that generates a directory <del> # name with exotic characters like + in it, and these break badly written <del> # scripts that don't escape strings before trying to regexp them :( <del> <del> # If the user has FileVault enabled, then we can't mv symlinks from the <del> # /tmp volume to the other volume. So we let the user override the tmp <del> # prefix if they need to. <del> tmp_prefix = ENV['HOMEBREW_TEMP'] || '/tmp' <del> tmp=Pathname.new `/usr/bin/mktemp -d #{tmp_prefix}/homebrew-#{name}-#{version}-XXXX`.strip <del> raise "Couldn't create build sandbox" if not tmp.directory? or $? != 0 <del> begin <del> wd=Dir.pwd <del> Dir.chdir tmp <del> yield <del> ensure <del> Dir.chdir wd <del> tmp.rmtree <del> end <del> end <del> <del> CHECKSUM_TYPES=[:md5, :sha1, :sha256].freeze <add>public <ide> <del> public <ide> # For brew-fetch and others. <ide> def fetch <ide> downloader = @downloader <ide> def verify_download_integrity fn, *args <ide> end <ide> end <ide> <del> private <add>private <add> <add> CHECKSUM_TYPES=[:md5, :sha1, :sha256].freeze <ide> <ide> def stage <ide> fetched, downloader = fetch
2
Ruby
Ruby
rescue a specific exception
01dc9c4900b42d8d3556c316dbcb4a8597d8b7f4
<ide><path>Library/Contributions/cmd/brew-pull.rb <ide> def tap arg <ide> <ide> begin <ide> safe_system 'git', 'am', *patch_args <del> rescue => e <add> rescue ErrorDuringExecution <ide> system 'git', 'am', '--abort' <ide> odie 'Patch failed to apply: aborted.' <ide> end
1
Python
Python
remove other color_style override
b3cec920a2a7d547944823c539a7ebd99b3af23a
<ide><path>django/core/management/commands/makemigrations.py <ide> from optparse import make_option <ide> <ide> from django.core.management.base import BaseCommand <del>from django.core.management.color import color_style <ide> from django.core.exceptions import ImproperlyConfigured <ide> from django.db import connections <ide> from django.db.migrations.loader import MigrationLoader <ide> def handle(self, *app_labels, **options): <ide> <ide> self.verbosity = int(options.get('verbosity')) <ide> self.interactive = options.get('interactive') <del> self.style = color_style() <ide> <ide> # Make sure the app they asked for exists <ide> app_labels = set(app_labels)
1
Go
Go
fix ipmask marshalling
1fe48e8608717139d24de937c2d8ea86259769a7
<ide><path>libnetwork/drivers/overlay/peerdb.go <ide> type peerEntry struct { <ide> } <ide> <ide> func (p *peerEntry) MarshalDB() peerEntryDB { <add> ones, bits := p.peerIPMask.Size() <ide> return peerEntryDB{ <del> eid: p.eid, <del> vtep: p.vtep.String(), <del> peerIPMask: p.peerIPMask.String(), <del> isLocal: p.isLocal, <add> eid: p.eid, <add> vtep: p.vtep.String(), <add> peerIPMaskOnes: ones, <add> peerIPMaskBits: bits, <add> isLocal: p.isLocal, <ide> } <ide> } <ide> <ide> // This the structure saved into the set (SetMatrix), due to the implementation of it <ide> // the value inserted in the set has to be Hashable so the []byte had to be converted into <ide> // strings <ide> type peerEntryDB struct { <del> eid string <del> vtep string <del> peerIPMask string <del> isLocal bool <add> eid string <add> vtep string <add> peerIPMaskOnes int <add> peerIPMaskBits int <add> isLocal bool <ide> } <ide> <ide> func (p *peerEntryDB) UnMarshalDB() peerEntry { <ide> return peerEntry{ <ide> eid: p.eid, <ide> vtep: net.ParseIP(p.vtep), <del> peerIPMask: net.IPMask(net.ParseIP(p.peerIPMask)), <add> peerIPMask: net.CIDRMask(p.peerIPMaskOnes, p.peerIPMaskBits), <ide> isLocal: p.isLocal, <ide> } <ide> } <ide><path>libnetwork/drivers/overlay/peerdb_test.go <add>package overlay <add> <add>import ( <add> "net" <add> "testing" <add> <add> _ "github.com/docker/libnetwork/testutils" <add>) <add> <add>func TestPeerMarshal(t *testing.T) { <add> _, ipNet, _ := net.ParseCIDR("192.168.0.1/24") <add> p := &peerEntry{eid: "eid", <add> isLocal: true, <add> peerIPMask: ipNet.Mask, <add> vtep: ipNet.IP} <add> entryDB := p.MarshalDB() <add> x := entryDB.UnMarshalDB() <add> if x.eid != p.eid { <add> t.Fatalf("Incorrect Unmarshalling for eid: %v != %v", x.eid, p.eid) <add> } <add> if x.isLocal != p.isLocal { <add> t.Fatalf("Incorrect Unmarshalling for isLocal: %v != %v", x.isLocal, p.isLocal) <add> } <add> if x.peerIPMask.String() != p.peerIPMask.String() { <add> t.Fatalf("Incorrect Unmarshalling for eid: %v != %v", x.peerIPMask, p.peerIPMask) <add> } <add> if x.vtep.String() != p.vtep.String() { <add> t.Fatalf("Incorrect Unmarshalling for eid: %v != %v", x.vtep, p.vtep) <add> } <add>}
2
Ruby
Ruby
use a lookup table for `assert_response`
908bc79729fdb3cc2acbd346d9ed34c9286d57cc
<ide><path>actionpack/lib/action_dispatch/testing/assertions/response.rb <ide> module ActionDispatch <ide> module Assertions <ide> # A small suite of assertions that test responses from \Rails applications. <ide> module ResponseAssertions <add> RESPONSE_PREDICATES = { # :nodoc: <add> success: :successful?, <add> missing: :not_found?, <add> redirect: :redirection?, <add> error: :server_error?, <add> } <add> <ide> # Asserts that the response is one of the following types: <ide> # <ide> # * <tt>:success</tt> - Status code was in the 200-299 range <ide> module ResponseAssertions <ide> # # assert that the response code was status code 401 (unauthorized) <ide> # assert_response 401 <ide> def assert_response(type, message = nil) <del> message ||= "Expected response to be a <#{type}>, but was <#{@response.response_code}>" <del> <ide> if Symbol === type <ide> if [:success, :missing, :redirect, :error].include?(type) <del> assert @response.send("#{type}?"), message <add> assert_predicate @response, RESPONSE_PREDICATES[type], message <ide> else <ide> code = Rack::Utils::SYMBOL_TO_STATUS_CODE[type] <ide> if code.nil? <ide><path>actionpack/test/assertions/response_assertions_test.rb <ide> class ResponseAssertionsTest < ActiveSupport::TestCase <ide> include ResponseAssertions <ide> <ide> FakeResponse = Struct.new(:response_code) do <del> [:success, :missing, :redirect, :error].each do |sym| <add> [:successful, :not_found, :redirection, :server_error].each do |sym| <ide> define_method("#{sym}?") do <ide> sym == response_code <ide> end <ide> class ResponseAssertionsTest < ActiveSupport::TestCase <ide> <ide> def test_assert_response_predicate_methods <ide> [:success, :missing, :redirect, :error].each do |sym| <del> @response = FakeResponse.new sym <add> @response = FakeResponse.new RESPONSE_PREDICATES[sym].to_s.sub(/\?/, '').to_sym <ide> assert_response sym <ide> <ide> assert_raises(Minitest::Assertion) {
2
Text
Text
add all descriptions in app directory [skip ci]
c1a3ab2227930ee27dc8039ca91091a02833e06d
<ide><path>guides/source/engines.md <ide> important parts about namespacing, and is discussed later in the <ide> <ide> Inside the `app` directory are the standard `assets`, `controllers`, `helpers`, <ide> `jobs`, `mailers`, `models`, and `views` directories that you should be familiar with <del>from an application. The `helpers`, `mailers`, and `models` directories are <del>empty, so they aren't described in this section. We'll look more into models in <del>a future section, when we're writing the engine. <add>from an application. We'll look more into models in a future section, when we're writing the engine. <ide> <ide> Within the `app/assets` directory, there are the `images`, `javascripts` and <ide> `stylesheets` directories which, again, you should be familiar with due to their <ide> WARNING: Don't use `require` because it will break the automatic reloading of cl <ide> in the development environment - using `require_dependency` ensures that classes are <ide> loaded and unloaded in the correct manner. <ide> <add>Within the `app/helpers` directory there is a `blorgh` directory that <add>contains a file called `application_helper.rb`. This file will provide any <add>common functionality for the helpers of the engine. The `blorgh` directory <add>is where the other helpers for the engine will go. By placing them within <add>this namespaced directory, you prevent them from possibly clashing with <add>identically-named helpers within other engines or even within the <add>application. <add> <add>Within the `app/jobs` directory there is a `blorgh` directory that <add>contains a file called `application_job.rb`. This file will provide any <add>common functionality for the jobs of the engine. The `blorgh` directory <add>is where the other jobs for the engine will go. By placing them within <add>this namespaced directory, you prevent them from possibly clashing with <add>identically-named jobs within other engines or even within the <add>application. <add> <add>Within the `app/mailers` directory there is a `blorgh` directory that <add>contains a file called `application_mailer.rb`. This file will provide any <add>common functionality for the mailers of the engine. The `blorgh` directory <add>is where the other mailers for the engine will go. By placing them within <add>this namespaced directory, you prevent them from possibly clashing with <add>identically-named mailers within other engines or even within the <add>application. <add> <ide> Lastly, the `app/views` directory contains a `layouts` folder, which contains a <ide> file at `blorgh/application.html.erb`. This file allows you to specify a layout <ide> for the engine. If this engine is to be used as a stand-alone engine, then you
1
Javascript
Javascript
move progress bar from bundler to server
8fbf0dad1f211af4f020a6f2d71aef9114c25d30
<ide><path>packager/react-packager/src/Bundler/index.js <ide> */ <ide> 'use strict'; <ide> <add>const Promise = require('promise'); <add> <ide> const assert = require('assert'); <ide> const fs = require('fs'); <ide> const path = require('path'); <del>const Promise = require('promise'); <del>const ProgressBar = require('progress'); <ide> const Cache = require('../node-haste').Cache; <ide> const Transformer = require('../JSTransformer'); <ide> const Resolver = require('../Resolver'); <ide> const validateOpts = declareOpts({ <ide> type: 'number', <ide> required: false, <ide> }, <del> silent: { <del> type: 'boolean', <del> default: false, <del> }, <ide> allowBundleUpdates: { <ide> type: 'boolean', <ide> default: false, <ide> class Bundler { <ide> isolateModuleIDs, <ide> generateSourceMaps, <ide> assetPlugins, <add> onProgress, <ide> }) { <ide> const onResolutionResponse = response => { <ide> bundle.setMainModuleId(response.getModuleId(getMainModule(response))); <ide> class Bundler { <ide> isolateModuleIDs, <ide> generateSourceMaps, <ide> assetPlugins, <add> onProgress, <ide> }); <ide> } <ide> <ide> class Bundler { <ide> onResolutionResponse = noop, <ide> onModuleTransformed = noop, <ide> finalizeBundle = noop, <add> onProgress = noop, <ide> }) { <ide> const findEventId = Activity.startEvent( <ide> 'Transforming modules', <ide> class Bundler { <ide> const modulesByName = Object.create(null); <ide> <ide> if (!resolutionResponse) { <del> let onProgress = noop; <del> if (process.stdout.isTTY && !this._opts.silent) { <del> const bar = new ProgressBar('transformed :current/:total (:percent)', { <del> complete: '=', <del> incomplete: ' ', <del> width: 40, <del> total: 1, <del> }); <del> onProgress = debouncedTick(bar); <del> } <del> <ide> resolutionResponse = this.getDependencies({ <ide> entryFile, <ide> dev, <ide> function getMainModule({dependencies, numPrependedDependencies = 0}) { <ide> return dependencies[numPrependedDependencies]; <ide> } <ide> <del>function debouncedTick(progressBar) { <del> let n = 0; <del> let start, total; <del> <del> return (_, t) => { <del> total = t; <del> n += 1; <del> if (start) { <del> if (progressBar.curr + n >= total || Date.now() - start > 200) { <del> progressBar.total = total; <del> progressBar.tick(n); <del> start = n = 0; <del> } <del> } else { <del> start = Date.now(); <del> } <del> }; <del>} <del> <ide> function filterObject(object, blacklist) { <ide> const copied = Object.assign({}, object); <ide> for (const key of blacklist) { <ide><path>packager/react-packager/src/Server/index.js <ide> const AssetServer = require('../AssetServer'); <ide> const FileWatcher = require('../node-haste').FileWatcher; <ide> const getPlatformExtension = require('../node-haste').getPlatformExtension; <ide> const Bundler = require('../Bundler'); <add>const ProgressBar = require('progress'); <ide> const Promise = require('promise'); <ide> const SourceMapConsumer = require('source-map').SourceMapConsumer; <ide> <ide> const bundleOpts = declareOpts({ <ide> type: 'array', <ide> default: [], <ide> }, <add> onProgress: { <add> type: 'function', <add> }, <ide> }); <ide> <ide> const dependencyOpts = declareOpts({ <ide> const NODE_MODULES = `${path.sep}node_modules${path.sep}`; <ide> <ide> class Server { <ide> constructor(options) { <del> const opts = validateOpts(options); <add> const opts = this._opts = validateOpts(options); <ide> <ide> this._projectRoots = opts.projectRoots; <ide> this._bundles = Object.create(null); <ide> class Server { <ide> ).done(() => Activity.endEvent(assetEvent)); <ide> } <ide> <add> optionsHash(options) { <add> // onProgress is a function, can't be serialized <add> return JSON.stringify(Object.assign({}, options, { onProgress: null })); <add> } <add> <ide> _useCachedOrUpdateOrCreateBundle(options) { <del> const optionsJson = JSON.stringify(options); <add> const optionsJson = this.optionsHash(options); <ide> const bundleFromScratch = () => { <ide> const building = this.buildBundle(options); <ide> this._bundles[optionsJson] = building; <ide> class Server { <ide> details: req.url, <ide> }, <ide> ); <add> <add> if (process.stdout.isTTY && !this._opts.silent) { <add> const bar = new ProgressBar('transformed :current/:total (:percent)', { <add> complete: '=', <add> incomplete: ' ', <add> width: 40, <add> total: 1, <add> }); <add> options.onProgress = debouncedTick(bar); <add> } <ide> debug('Getting bundle for request'); <ide> const building = this._useCachedOrUpdateOrCreateBundle(options); <ide> building.then( <ide> class Server { <ide> Activity.endEvent(startReqEventId); <ide> } <ide> }, <del> error => this._handleError(res, JSON.stringify(options), error) <add> error => this._handleError(res, this.optionsHash(options), error) <ide> ).catch(error => { <ide> process.nextTick(() => { <ide> throw error; <ide> function contentsEqual(array, set) { <ide> return array.length === set.size && array.every(set.has, set); <ide> } <ide> <add>function debouncedTick(progressBar) { <add> let n = 0; <add> let start, total; <add> <add> return (_, t) => { <add> total = t; <add> n += 1; <add> if (start) { <add> if (progressBar.curr + n >= total || Date.now() - start > 200) { <add> progressBar.total = total; <add> progressBar.tick(n); <add> start = n = 0; <add> } <add> } else { <add> start = Date.now(); <add> } <add> }; <add>} <add> <ide> module.exports = Server;
2
PHP
PHP
add test for facebook style status line
dda401ea376c628a05632066ed09037010db146d
<ide><path>tests/TestCase/Network/Http/ResponseTest.php <ide> public function testHeaderParsing() { <ide> $response->headers['Content-Type'] <ide> ); <ide> $this->assertTrue(isset($response->headers)); <add> <add> $headers = [ <add> 'HTTP/1.0 200', <add> ]; <add> $response = new Response($headers, 'ok'); <add> <add> $this->assertEquals('1.0', $response->version()); <add> $this->assertEquals(200, $response->statusCode()); <ide> } <ide> <ide> /**
1
PHP
PHP
fix version in docblocks
5a5bdecf9d11cf85fe4689425625223a021a47fe
<ide><path>src/Database/SchemaCache.php <ide> * <ide> * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) <ide> * @link https://cakephp.org CakePHP(tm) Project <del> * @since 3.5.0 <add> * @since 3.6.0 <ide> * @license https://opensource.org/licenses/mit-license.php MIT License <ide> */ <ide> namespace Cake\Database; <ide><path>tests/TestCase/Database/SchemaCacheTest.php <ide> * <ide> * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) <ide> * @link https://cakephp.org CakePHP(tm) Project <del> * @since 3.5.0 <add> * @since 3.6.0 <ide> * @license https://opensource.org/licenses/mit-license.php MIT License <ide> */ <ide> namespace Cake\Test\TestCase\ORM;
2
Javascript
Javascript
fix incorrect wording
36c82fd1275f761232f652c6b8da6c7b03a2fb1b
<ide><path>server/render.js <ide> async function doRender (req, res, pathname, query, { <ide> <ide> if (isResSent(res)) return <ide> <del> if (!Document.prototype || !Document.prototype.isReactComponent) throw new Error('_document.js is not exporting a React element') <add> if (!Document.prototype || !Document.prototype.isReactComponent) throw new Error('_document.js is not exporting a React component') <ide> const doc = createElement(Document, { <ide> __NEXT_DATA__: { <ide> props,
1
Javascript
Javascript
add try and catch for computedstyle
90ce2d7143ff5d5006cc7a9784bc52731ab551f4
<ide><path>src/js/utils/computed-style.js <ide> function computedStyle(el, prop) { <ide> } <ide> <ide> if (typeof window.getComputedStyle === 'function') { <del> const computedStyleValue = window.getComputedStyle(el); <add> let computedStyleValue; <add> <add> try { <add> computedStyleValue = window.getComputedStyle(el); <add> } catch (e) { <add> return ''; <add> } <ide> <ide> return computedStyleValue ? computedStyleValue.getPropertyValue(prop) || computedStyleValue[prop] : ''; <ide> }
1
Javascript
Javascript
replace anonymous function with arrow
ccd1ed9e9199eabdb136908a7676d6eb26198a70
<ide><path>test/parallel/test-tls-peer-certificate-encoding.js <ide> const options = { <ide> ca: [ fixtures.readKey('ca2-cert.pem') ] <ide> }; <ide> <del>const server = tls.createServer(options, function(cleartext) { <add>const server = tls.createServer(options, (cleartext) => { <ide> cleartext.end('World'); <ide> }); <ide> server.listen(0, common.mustCall(function() { <ide> const socket = tls.connect({ <ide> port: this.address().port, <ide> rejectUnauthorized: false <del> }, common.mustCall(function() { <add> }, common.mustCall(() => { <ide> const peerCert = socket.getPeerCertificate(); <ide> <ide> console.error(util.inspect(peerCert));
1
Go
Go
move convertvolumes to composetransform package
7685e80fc9cb79206d81757eee071f0244323600
<ide><path>api/types/mount/mount.go <ide> const ( <ide> PropagationSlave Propagation = "slave" <ide> ) <ide> <add>// Propagations is the list of all valid mount propagations <add>var Propagations = []Propagation{ <add> PropagationRPrivate, <add> PropagationPrivate, <add> PropagationRShared, <add> PropagationShared, <add> PropagationRSlave, <add> PropagationSlave, <add>} <add> <ide> // BindOptions defines options specific to mounts of type "bind". <ide> type BindOptions struct { <ide> Propagation Propagation `json:",omitempty"` <ide><path>cli/command/stack/common.go <ide> import ( <ide> "github.com/docker/docker/api/types/filters" <ide> "github.com/docker/docker/api/types/swarm" <ide> "github.com/docker/docker/client" <add> "github.com/docker/docker/pkg/composetransform" <ide> ) <ide> <ide> func getStackFilter(namespace string) filters.Args { <ide> filter := filters.NewArgs() <del> filter.Add("label", labelNamespace+"="+namespace) <add> filter.Add("label", composetransform.LabelNamespace+"="+namespace) <ide> return filter <ide> } <ide> <ide><path>cli/command/stack/deploy.go <ide> import ( <ide> composetypes "github.com/aanand/compose-file/types" <ide> "github.com/docker/docker/api/types" <ide> "github.com/docker/docker/api/types/container" <del> "github.com/docker/docker/api/types/mount" <del> networktypes "github.com/docker/docker/api/types/network" <ide> "github.com/docker/docker/api/types/swarm" <ide> "github.com/docker/docker/cli" <ide> "github.com/docker/docker/cli/command" <ide> dockerclient "github.com/docker/docker/client" <ide> "github.com/docker/docker/opts" <add> "github.com/docker/docker/pkg/composetransform" <ide> runconfigopts "github.com/docker/docker/runconfig/opts" <ide> "github.com/docker/go-connections/nat" <ide> ) <ide> func deployCompose(ctx context.Context, dockerCli *command.DockerCli, opts deplo <ide> return err <ide> } <ide> <del> namespace := namespace{name: opts.namespace} <add> namespace := composetransform.NewNamespace(opts.namespace) <ide> <del> networks, externalNetworks := convertNetworks(namespace, config.Networks) <add> networks, externalNetworks := composetransform.ConvertNetworks(namespace, config.Networks) <ide> if err := validateExternalNetworks(ctx, dockerCli, externalNetworks); err != nil { <ide> return err <ide> } <ide> func validateExternalNetworks( <ide> func createNetworks( <ide> ctx context.Context, <ide> dockerCli *command.DockerCli, <del> namespace namespace, <add> namespace composetransform.Namespace, <ide> networks map[string]types.NetworkCreate, <ide> ) error { <ide> client := dockerCli.Client() <ide> <del> existingNetworks, err := getStackNetworks(ctx, client, namespace.name) <add> existingNetworks, err := getStackNetworks(ctx, client, namespace.Name()) <ide> if err != nil { <ide> return err <ide> } <ide> func createNetworks( <ide> } <ide> <ide> for internalName, createOpts := range networks { <del> name := namespace.scope(internalName) <add> name := namespace.Scope(internalName) <ide> if _, exists := existingNetworkMap[name]; exists { <ide> continue <ide> } <ide> func createNetworks( <ide> func convertServiceNetworks( <ide> networks map[string]*composetypes.ServiceNetworkConfig, <ide> networkConfigs map[string]composetypes.NetworkConfig, <del> namespace namespace, <add> namespace composetransform.Namespace, <ide> name string, <ide> ) ([]swarm.NetworkAttachmentConfig, error) { <ide> if len(networks) == 0 { <ide> func convertServiceNetworks( <ide> return nets, nil <ide> } <ide> <del>func convertVolumes( <del> serviceVolumes []string, <del> stackVolumes map[string]composetypes.VolumeConfig, <del> namespace namespace, <del>) ([]mount.Mount, error) { <del> var mounts []mount.Mount <del> <del> for _, volumeSpec := range serviceVolumes { <del> mount, err := convertVolumeToMount(volumeSpec, stackVolumes, namespace) <del> if err != nil { <del> return nil, err <del> } <del> mounts = append(mounts, mount) <del> } <del> return mounts, nil <del>} <del> <del>func convertVolumeToMount( <del> volumeSpec string, <del> stackVolumes map[string]composetypes.VolumeConfig, <del> namespace namespace, <del>) (mount.Mount, error) { <del> var source, target string <del> var mode []string <del> <del> // TODO: split Windows path mappings properly <del> parts := strings.SplitN(volumeSpec, ":", 3) <del> <del> switch len(parts) { <del> case 3: <del> source = parts[0] <del> target = parts[1] <del> mode = strings.Split(parts[2], ",") <del> case 2: <del> source = parts[0] <del> target = parts[1] <del> case 1: <del> target = parts[0] <del> default: <del> return mount.Mount{}, fmt.Errorf("invald volume: %s", volumeSpec) <del> } <del> <del> // TODO: catch Windows paths here <del> if strings.HasPrefix(source, "/") { <del> return mount.Mount{ <del> Type: mount.TypeBind, <del> Source: source, <del> Target: target, <del> ReadOnly: isReadOnly(mode), <del> BindOptions: getBindOptions(mode), <del> }, nil <del> } <del> <del> stackVolume, exists := stackVolumes[source] <del> if !exists { <del> return mount.Mount{}, fmt.Errorf("undefined volume: %s", source) <del> } <del> <del> var volumeOptions *mount.VolumeOptions <del> if stackVolume.External.Name != "" { <del> source = stackVolume.External.Name <del> } else { <del> volumeOptions = &mount.VolumeOptions{ <del> Labels: getStackLabels(namespace.name, stackVolume.Labels), <del> NoCopy: isNoCopy(mode), <del> } <del> <del> if stackVolume.Driver != "" { <del> volumeOptions.DriverConfig = &mount.Driver{ <del> Name: stackVolume.Driver, <del> Options: stackVolume.DriverOpts, <del> } <del> } <del> source = namespace.scope(source) <del> } <del> return mount.Mount{ <del> Type: mount.TypeVolume, <del> Source: source, <del> Target: target, <del> ReadOnly: isReadOnly(mode), <del> VolumeOptions: volumeOptions, <del> }, nil <del>} <del> <del>func modeHas(mode []string, field string) bool { <del> for _, item := range mode { <del> if item == field { <del> return true <del> } <del> } <del> return false <del>} <del> <del>func isReadOnly(mode []string) bool { <del> return modeHas(mode, "ro") <del>} <del> <del>func isNoCopy(mode []string) bool { <del> return modeHas(mode, "nocopy") <del>} <del> <del>func getBindOptions(mode []string) *mount.BindOptions { <del> for _, item := range mode { <del> if strings.Contains(item, "private") || strings.Contains(item, "shared") || strings.Contains(item, "slave") { <del> return &mount.BindOptions{Propagation: mount.Propagation(item)} <del> } <del> } <del> return nil <del>} <del> <ide> func deployServices( <ide> ctx context.Context, <ide> dockerCli *command.DockerCli, <ide> func convertService( <ide> return swarm.ServiceSpec{}, err <ide> } <ide> <del> mounts, err := convertVolumes(service.Volumes, volumes, namespace) <add> mounts, err := composetransform.ConvertVolumes(service.Volumes, volumes, namespace) <ide> if err != nil { <ide> // TODO: better error message (include service name) <ide> return swarm.ServiceSpec{}, err <ide><path>pkg/composetransform/compose.go <ide> import ( <ide> ) <ide> <ide> const ( <del> labelNamespace = "com.docker.stack.namespace" <add> // LabelNamespace is the label used to track stack resources <add> LabelNamespace = "com.docker.stack.namespace" <ide> ) <ide> <ide> // Namespace mangles names by prepending the name <ide> func (n Namespace) Scope(name string) string { <ide> return n.name + "_" + name <ide> } <ide> <add>// Name returns the name of the namespace <add>func (n Namespace) Name() string { <add> return n.name <add>} <add> <add>// NewNamespace returns a new Namespace for scoping of names <add>func NewNamespace(name string) Namespace { <add> return Namespace{name: name} <add>} <add> <ide> // AddStackLabel returns labels with the namespace label added <ide> func AddStackLabel(namespace Namespace, labels map[string]string) map[string]string { <ide> if labels == nil { <ide> labels = make(map[string]string) <ide> } <del> labels[labelNamespace] = namespace.name <add> labels[LabelNamespace] = namespace.name <ide> return labels <ide> } <ide> <ide><path>pkg/composetransform/compose_test.go <ide> func TestAddStackLabel(t *testing.T) { <ide> actual := AddStackLabel(Namespace{name: "foo"}, labels) <ide> expected := map[string]string{ <ide> "something": "labeled", <del> labelNamespace: "foo", <add> LabelNamespace: "foo", <ide> } <ide> assert.DeepEqual(t, actual, expected) <ide> } <ide> func TestConvertNetworks(t *testing.T) { <ide> expected := map[string]types.NetworkCreate{ <ide> "default": { <ide> Labels: map[string]string{ <del> labelNamespace: "foo", <add> LabelNamespace: "foo", <ide> }, <ide> }, <ide> "normal": { <ide> func TestConvertNetworks(t *testing.T) { <ide> "opt": "value", <ide> }, <ide> Labels: map[string]string{ <del> labelNamespace: "foo", <add> LabelNamespace: "foo", <ide> "something": "labeled", <ide> }, <ide> }, <ide><path>pkg/composetransform/volume.go <add>package composetransform <add> <add>import ( <add> "fmt" <add> "strings" <add> <add> composetypes "github.com/aanand/compose-file/types" <add> "github.com/docker/docker/api/types/mount" <add>) <add> <add>type volumes map[string]composetypes.VolumeConfig <add> <add>// ConvertVolumes from compose-file types to engine api types <add>func ConvertVolumes(serviceVolumes []string, stackVolumes volumes, namespace Namespace) ([]mount.Mount, error) { <add> var mounts []mount.Mount <add> <add> for _, volumeSpec := range serviceVolumes { <add> mount, err := convertVolumeToMount(volumeSpec, stackVolumes, namespace) <add> if err != nil { <add> return nil, err <add> } <add> mounts = append(mounts, mount) <add> } <add> return mounts, nil <add>} <add> <add>func convertVolumeToMount(volumeSpec string, stackVolumes volumes, namespace Namespace) (mount.Mount, error) { <add> var source, target string <add> var mode []string <add> <add> // TODO: split Windows path mappings properly <add> parts := strings.SplitN(volumeSpec, ":", 3) <add> <add> switch len(parts) { <add> case 3: <add> source = parts[0] <add> target = parts[1] <add> mode = strings.Split(parts[2], ",") <add> case 2: <add> source = parts[0] <add> target = parts[1] <add> case 1: <add> target = parts[0] <add> default: <add> return mount.Mount{}, fmt.Errorf("invald volume: %s", volumeSpec) <add> } <add> <add> // TODO: catch Windows paths here <add> if strings.HasPrefix(source, "/") { <add> return mount.Mount{ <add> Type: mount.TypeBind, <add> Source: source, <add> Target: target, <add> ReadOnly: isReadOnly(mode), <add> BindOptions: getBindOptions(mode), <add> }, nil <add> } <add> <add> stackVolume, exists := stackVolumes[source] <add> if !exists { <add> return mount.Mount{}, fmt.Errorf("undefined volume: %s", source) <add> } <add> <add> var volumeOptions *mount.VolumeOptions <add> if stackVolume.External.Name != "" { <add> source = stackVolume.External.Name <add> } else { <add> volumeOptions = &mount.VolumeOptions{ <add> Labels: AddStackLabel(namespace, stackVolume.Labels), <add> NoCopy: isNoCopy(mode), <add> } <add> <add> if stackVolume.Driver != "" { <add> volumeOptions.DriverConfig = &mount.Driver{ <add> Name: stackVolume.Driver, <add> Options: stackVolume.DriverOpts, <add> } <add> } <add> source = namespace.Scope(source) <add> } <add> return mount.Mount{ <add> Type: mount.TypeVolume, <add> Source: source, <add> Target: target, <add> ReadOnly: isReadOnly(mode), <add> VolumeOptions: volumeOptions, <add> }, nil <add>} <add> <add>func modeHas(mode []string, field string) bool { <add> for _, item := range mode { <add> if item == field { <add> return true <add> } <add> } <add> return false <add>} <add> <add>func isReadOnly(mode []string) bool { <add> return modeHas(mode, "ro") <add>} <add> <add>func isNoCopy(mode []string) bool { <add> return modeHas(mode, "nocopy") <add>} <add> <add>func getBindOptions(mode []string) *mount.BindOptions { <add> for _, item := range mode { <add> for _, propagation := range mount.Propagations { <add> if mount.Propagation(item) == propagation { <add> return &mount.BindOptions{Propagation: mount.Propagation(item)} <add> } <add> } <add> } <add> return nil <add>} <ide><path>pkg/composetransform/volume_test.go <add>package composetransform <add> <add>import ( <add> "testing" <add> <add> composetypes "github.com/aanand/compose-file/types" <add> "github.com/docker/docker/api/types/mount" <add> "github.com/docker/docker/pkg/testutil/assert" <add>) <add> <add>func TestIsReadOnly(t *testing.T) { <add> assert.Equal(t, isReadOnly([]string{"foo", "bar", "ro"}), true) <add> assert.Equal(t, isReadOnly([]string{"ro"}), true) <add> assert.Equal(t, isReadOnly([]string{}), false) <add> assert.Equal(t, isReadOnly([]string{"foo", "rw"}), false) <add> assert.Equal(t, isReadOnly([]string{"foo"}), false) <add>} <add> <add>func TestIsNoCopy(t *testing.T) { <add> assert.Equal(t, isNoCopy([]string{"foo", "bar", "nocopy"}), true) <add> assert.Equal(t, isNoCopy([]string{"nocopy"}), true) <add> assert.Equal(t, isNoCopy([]string{}), false) <add> assert.Equal(t, isNoCopy([]string{"foo", "rw"}), false) <add>} <add> <add>func TesTGetBindOptions(t *testing.T) { <add> opts := getBindOptions([]string{"slave"}) <add> expected := &mount.BindOptions{Propagation: mount.PropagationSlave} <add> assert.Equal(t, opts, expected) <add>} <add> <add>func TesTGetBindOptionsNone(t *testing.T) { <add> opts := getBindOptions([]string{"ro"}) <add> assert.Equal(t, opts, nil) <add>} <add> <add>func TestConvertVolumeToMountNamedVolume(t *testing.T) { <add> stackVolumes := volumes{ <add> "normal": composetypes.VolumeConfig{ <add> Driver: "glusterfs", <add> DriverOpts: map[string]string{ <add> "opt": "value", <add> }, <add> Labels: map[string]string{ <add> "something": "labeled", <add> }, <add> }, <add> } <add> namespace := NewNamespace("foo") <add> expected := mount.Mount{ <add> Type: mount.TypeVolume, <add> Source: "foo_normal", <add> Target: "/foo", <add> ReadOnly: true, <add> VolumeOptions: &mount.VolumeOptions{ <add> Labels: map[string]string{ <add> LabelNamespace: "foo", <add> "something": "labeled", <add> }, <add> DriverConfig: &mount.Driver{ <add> Name: "glusterfs", <add> Options: map[string]string{ <add> "opt": "value", <add> }, <add> }, <add> }, <add> } <add> mount, err := convertVolumeToMount("normal:/foo:ro", stackVolumes, namespace) <add> assert.NilError(t, err) <add> assert.DeepEqual(t, mount, expected) <add>} <add> <add>func TestConvertVolumeToMountNamedVolumeExternal(t *testing.T) { <add> stackVolumes := volumes{ <add> "outside": composetypes.VolumeConfig{ <add> External: composetypes.External{ <add> External: true, <add> Name: "special", <add> }, <add> }, <add> } <add> namespace := NewNamespace("foo") <add> expected := mount.Mount{ <add> Type: mount.TypeVolume, <add> Source: "special", <add> Target: "/foo", <add> } <add> mount, err := convertVolumeToMount("outside:/foo", stackVolumes, namespace) <add> assert.NilError(t, err) <add> assert.DeepEqual(t, mount, expected) <add>} <add> <add>func TestConvertVolumeToMountBind(t *testing.T) { <add> stackVolumes := volumes{} <add> namespace := NewNamespace("foo") <add> expected := mount.Mount{ <add> Type: mount.TypeBind, <add> Source: "/bar", <add> Target: "/foo", <add> ReadOnly: true, <add> BindOptions: &mount.BindOptions{Propagation: mount.PropagationShared}, <add> } <add> mount, err := convertVolumeToMount("/bar:/foo:ro,shared", stackVolumes, namespace) <add> assert.NilError(t, err) <add> assert.DeepEqual(t, mount, expected) <add>} <add> <add>func TestConvertVolumeToMountVolumeDoesNotExist(t *testing.T) { <add> namespace := NewNamespace("foo") <add> _, err := convertVolumeToMount("unknown:/foo:ro", volumes{}, namespace) <add> assert.Error(t, err, "undefined volume: unknown") <add>}
7
Mixed
Ruby
remove warning when overwriting existing scopes
0e8432e97404edf5a259374e6aa0cf47ce009273
<ide><path>activerecord/CHANGELOG.md <add>* Remove warning when overwriting existing scopes <add> <add> Removes the following unnecessary warning message that appeared when overwriting existing scopes <add> <add> ``` <add> Creating scope :my_scope_name. Overwriting existing method "MyClass.my_scope_name" when overwriting existing scopes <add> ``` <add> <add> *Weston Ganger* <add> <ide> * Fix `ActiveRecord::InternalMetadata` to not be broken by `config.active_record.record_timestamps = false` <ide> <ide> Since the model always create the timestamp columns, it has to set them, otherwise it breaks <ide><path>activerecord/lib/active_record/scoping/named.rb <ide> def scope(name, body, &block) <ide> "an instance method with the same name." <ide> end <ide> <del> valid_scope_name?(name) <ide> extension = Module.new(&block) if block <ide> <ide> if body.respond_to?(:to_proc) <ide> def scope(name, body, &block) <ide> def singleton_method_added(name) <ide> generate_relation_method(name) if Kernel.respond_to?(name) && !ActiveRecord::Relation.method_defined?(name) <ide> end <del> <del> def valid_scope_name?(name) <del> if respond_to?(name, true) && logger <del> logger.warn "Creating scope :#{name}. " \ <del> "Overwriting existing method #{self.name}.#{name}." <del> end <del> end <ide> end <ide> end <ide> end <ide><path>activerecord/test/cases/enum_test.rb <ide> def self.name; "Book"; end <ide> " This has caused a conflict with auto generated negative scopes."\ <ide> " Avoid using enum elements starting with 'not' where the positive form is also an element." <ide> <del> # this message comes from ActiveRecord::Scoping::Named, but it's worth noting that both occur in this case <del> expected_message_2 = "Creating scope :not_sent. Overwriting existing method Book.not_sent." <del> <ide> Class.new(ActiveRecord::Base) do <ide> def self.name <ide> "Book" <ide> def self.name <ide> end <ide> <ide> assert_includes(logger.logged(:warn), expected_message_1) <del> assert_includes(logger.logged(:warn), expected_message_2) <ide> ensure <ide> ActiveRecord::Base.logger = old_logger <ide> end <ide> def self.name <ide> " This has caused a conflict with auto generated negative scopes."\ <ide> " Avoid using enum elements starting with 'not' where the positive form is also an element." <ide> <del> # this message comes from ActiveRecord::Scoping::Named, but it's worth noting that both occur in this case <del> expected_message_2 = "Creating scope :not_sent. Overwriting existing method Book.not_sent." <del> <ide> Class.new(ActiveRecord::Base) do <ide> def self.name <ide> "Book" <ide> def self.name <ide> end <ide> <ide> assert_includes(logger.logged(:warn), expected_message_1) <del> assert_includes(logger.logged(:warn), expected_message_2) <ide> ensure <ide> ActiveRecord::Base.logger = old_logger <ide> end <ide><path>activerecord/test/cases/scoping/named_scoping_test.rb <ide> def test_table_names_for_chaining_scopes_with_and_without_table_name_included <ide> end <ide> end <ide> <del> def test_scopes_with_reserved_names <del> class << Topic <del> def public_method; end <del> public :public_method <del> <del> def protected_method; end <del> protected :protected_method <del> <del> def private_method; end <del> private :private_method <del> end <del> <del> [:public_method, :protected_method, :private_method].each do |reserved_method| <del> assert Topic.respond_to?(reserved_method, true) <del> assert_called(ActiveRecord::Base.logger, :warn) do <del> silence_warnings { Topic.scope(reserved_method, -> { }) } <del> end <del> end <del> end <del> <ide> def test_scopes_on_relations <ide> # Topic.replied <ide> approved_topics = Topic.all.approved.order("id DESC")
4
PHP
PHP
add wherekey method
5526aece584c1d21bc6d1a3d9f294aaaa36b3c50
<ide><path>src/Illuminate/Database/Eloquent/Builder.php <ide> public function find($id, $columns = ['*']) <ide> return $this->findMany($id, $columns); <ide> } <ide> <del> $this->query->where($this->model->getQualifiedKeyName(), '=', $id); <del> <del> return $this->first($columns); <add> return $this->whereKey($id)->first($columns); <ide> } <ide> <ide> /** <ide> public function findMany($ids, $columns = ['*']) <ide> return $this->model->newCollection(); <ide> } <ide> <del> $this->query->whereIn($this->model->getQualifiedKeyName(), $ids); <add> return $this->whereKey($ids)->get($columns); <add> } <ide> <del> return $this->get($columns); <add> /** <add> * Add where clause with primary key to the query. <add> * <add> * @param mixed $id <add> * @return $this <add> */ <add> public function whereKey($id) <add> { <add> if (is_array($id)) { <add> $this->query->whereIn($this->model->getQualifiedKeyName(), $id); <add> return $this; <add> } <add> return $this->where($this->model->getQualifiedKeyName(), '=', $id); <ide> } <ide> <ide> /**
1
Go
Go
update verification message
85fd8213afe9497da5df5583d776659ed187c9e9
<ide><path>graph/pull.go <ide> func (s *TagStore) pullV2Tag(eng *engine.Engine, r *registry.Session, out io.Wri <ide> } <ide> <ide> if verified { <del> out.Write(sf.FormatStatus(localName+":"+tag, "The image you are pulling has been digitally signed by Docker, Inc.")) <add> out.Write(sf.FormatStatus(localName+":"+tag, "The image you are pulling has been verified")) <ide> } else { <ide> out.Write(sf.FormatStatus(tag, "Pulling from %s", localName)) <ide> }
1
Text
Text
fix spelling error
e60f2cada59b15010eb63fdf5e86e57e358bda1e
<ide><path>docs/guides/components.md <ide> myComponent.on(otherComponent, 'eventName', myFunc); <ide> <ide> otherComponent.trigger('eventName'); <ide> // logs 'myFunc called' twice <del>myComponent.off(ootherComponent.el(), 'eventName', myFunc); <add>myComponent.off(otherComponent.el(), 'eventName', myFunc); <ide> myComponent.off(otherComponent, 'eventName', myFunc); <ide> otherComponent.trigger('eventName'); <ide> // does nothing
1
Javascript
Javascript
add curly braces around if statements
11206eca7659fb865c81e69c6510468461cf808d
<ide><path>packages/dev-live-reload/lib/package-watcher.js <ide> module.exports = class PackageWatcher extends Watcher { <ide> <ide> const stylesheetsPath = this.pack.getStylesheetsPath() <ide> <del> if (fs.isDirectorySync(stylesheetsPath)) <add> if (fs.isDirectorySync(stylesheetsPath)) { <ide> this.watchDirectory(stylesheetsPath) <add> } <ide> <ide> const stylesheetPaths = new Set(this.pack.getStylesheetPaths()) <ide> const onFile = stylesheetPath => stylesheetPaths.add(stylesheetPath) <ide><path>packages/dev-live-reload/lib/ui-watcher.js <ide> module.exports = class UIWatcher { <ide> } <ide> <ide> watchTheme (theme) { <del> if (PackageWatcher.supportsPackage(theme, 'theme')) <add> if (PackageWatcher.supportsPackage(theme, 'theme')) { <ide> this.watchedThemes.set( <ide> theme.name, <ide> this.createWatcher(new PackageWatcher(theme)) <ide> ) <add> } <ide> } <ide> <ide> watchPackage (pack) { <del> if (PackageWatcher.supportsPackage(pack, 'atom')) <add> if (PackageWatcher.supportsPackage(pack, 'atom')) { <ide> this.watchedPackages.set( <ide> pack.name, <ide> this.createWatcher(new PackageWatcher(pack)) <ide> ) <add> } <ide> } <ide> <ide> createWatcher (watcher) { <ide> module.exports = class UIWatcher { <ide> reloadAll () { <ide> this.baseTheme.loadAllStylesheets() <ide> for (const pack of atom.packages.getActivePackages()) { <del> if (PackageWatcher.supportsPackage(pack, 'atom')) pack.reloadStylesheets() <add> if (PackageWatcher.supportsPackage(pack, 'atom')) { <add> pack.reloadStylesheets() <add> } <ide> } <ide> <ide> for (const theme of atom.themes.getActiveThemes()) { <del> if (PackageWatcher.supportsPackage(theme, 'theme')) <add> if (PackageWatcher.supportsPackage(theme, 'theme')) { <ide> theme.reloadStylesheets() <add> } <ide> } <ide> } <ide> <ide><path>packages/dev-live-reload/spec/ui-watcher-spec.js <ide> describe('UIWatcher', () => { <ide> const pack = atom.packages.getActivePackages()[0] <ide> spyOn(pack, 'reloadStylesheets') <ide> <del> uiWatcher.watchers[ <del> uiWatcher.watchers.length - 1 <del> ].entities[1].emitter.emit('did-change') <add> uiWatcher.watchers[uiWatcher.watchers.length - 1].entities[1].emitter.emit('did-change') <ide> <ide> expect(pack.reloadStylesheets).toHaveBeenCalled() <ide> }) <ide><path>packages/link/lib/link.js <ide> module.exports = { <ide> } <ide> <ide> const { protocol } = url.parse(link) <del> if (protocol === 'http:' || protocol === 'https:' || protocol === 'atom:') <add> if (protocol === 'http:' || protocol === 'https:' || protocol === 'atom:') { <ide> shell.openExternal(link) <add> } <ide> }, <ide> <ide> // Get the link under the cursor in the editor
4
Ruby
Ruby
remove unnecessary scoping
05d1e9e413a87bee5b0c1c200fa9f84dba0e1d15
<ide><path>activerecord/test/cases/persistence_test.rb <ide> def test_update_many_with_invalid_id <ide> topic_data = { 1 => { "content" => "1 updated" }, 2 => { "content" => "2 updated" }, 99999 => {} } <ide> <ide> assert_raise(ActiveRecord::RecordNotFound) do <del> Topic.where("1=0").scoping { Topic.update(topic_data.keys, topic_data.values) } <add> Topic.update(topic_data.keys, topic_data.values) <ide> end <ide> <ide> assert_not_equal "1 updated", Topic.find(1).content
1
Javascript
Javascript
pass errorboundary to logcapturederror
9503abe5c700d0d3be76b45e7841e44ba2eab3ba
<ide><path>src/renderers/shared/fiber/ReactFiberScheduler.js <ide> export type CapturedError = { <ide> componentName : ?string, <ide> componentStack : string, <ide> error : Error, <add> errorBoundary : ?Object, <ide> errorBoundaryFound : boolean, <ide> errorBoundaryName : string | null, <ide> willRetry : boolean, <ide> module.exports = function<T, P, I, TI, PI, C, CX, PL>(config : HostConfig<T, P, <ide> } catch (error) { <ide> // We caught an error during either the begin or complete phases. <ide> const failedWork = nextUnitOfWork; <del> <add> <ide> if (failedWork !== null) { <ide> // Reset the priority context to its value before reconciliation. <ide> priorityContext = priorityContextBeforeReconciliation; <ide> module.exports = function<T, P, I, TI, PI, C, CX, PL>(config : HostConfig<T, P, <ide> componentName, <ide> componentStack, <ide> error, <add> errorBoundary: errorBoundaryFound ? boundary.stateNode : null, <ide> errorBoundaryFound, <ide> errorBoundaryName, <ide> willRetry,
1
Text
Text
update authentication docs to be an examples list.
28501c6af4270937f67c460c1358ac4d3e489b43
<ide><path>docs/authentication.md <ide> Both of these libraries support either authentication pattern. If you're interes <ide> - [with-passport](https://github.com/vercel/next.js/tree/canary/examples/with-passport) <ide> - [with-passport-and-next-connect](https://github.com/vercel/next.js/tree/canary/examples/with-passport-and-next-connect) <ide> <del>### Firebase <add>### Other Providers <ide> <del><details open> <del> <summary><b>Examples</b></summary> <del> <ul> <del> <li><a href="https://github.com/vercel/next.js/tree/canary/examples/with-firebase-authentication">with-firebase-authentication</a></li> <del> </ul> <del></details> <del> <del>When using Firebase Authentication, we recommend using the static generation pattern. <del> <del>It is possible to use the Firebase Client SDK to generate an ID token and forward it directly to Firebase's REST API on the server to log-in. However, requests to Firebase might take some time to resolve, depending on your user's location. <del> <del>You can either use [FirebaseUI](https://github.com/firebase/firebaseui-web-react) for a drop-in UI, or create your own with a [custom React hook](https://usehooks.com/useAuth/). <del> <del>### Magic (Passwordless) <add>To see examples with other authentication providers, check out the [examples folder](https://github.com/vercel/next.js/tree/canary/examples). <ide> <ide> <details open> <ide> <summary><b>Examples</b></summary> <ide> <ul> <add> <li><a href="https://github.com/vercel/next.js/tree/canary/examples/with-firebase-authentication">with-firebase-authentication</a></li> <ide> <li><a href="https://github.com/vercel/next.js/tree/canary/examples/with-magic">with-magic</a></li> <del> </ul> <del></details> <del> <del>[Magic](https://magic.link/), which uses [passwordless login](https://magic.link/), supports the static generation pattern. Similar to Firebase, a [unique identifier](https://w3c-ccg.github.io/did-primer/) has to be created on the client-side and then forwarded as a header to log-in. Then, Magic's Node SDK can be used to exchange the indentifier for a user's information. <del> <del>### Auth0 <del> <del><details open> <del> <summary><b>Examples</b></summary> <del> <ul> <ide> <li><a href="https://github.com/vercel/next.js/tree/canary/examples/auth0">auth0</a></li> <del> </ul> <del></details> <del> <del>[Auth0](https://auth0.com/) can support both authentication patterns. You can also utilize [API routes](/docs/api-routes/introduction.md) for logging in/out and retrieving user information. After logging in using the [Auth0 SDK](https://github.com/auth0/nextjs-auth0), you can utilize static generation or `getServerSideProps` for server-side rendering. <del> <del>### Supabase <del> <del><details open> <del> <summary><b>Examples</b></summary> <del> <ul> <ide> <li><a href="https://github.com/vercel/next.js/tree/canary/examples/with-supabase-auth-realtime-db">with-supabase-auth-realtime-db</a></li> <del> </ul> <del></details> <del> <del>[Supabase](https://supabase.io/) is an open source Firebase alternative that supports many of its features, including authentication. It allows for row level security using JWT tokens and supports third party logins. Either authentication pattern is supported. <del> <del>### Userbase <del> <del><details open> <del> <summary><b>Examples</b></summary> <del> <ul> <ide> <li><a href="https://github.com/vercel/next.js/tree/canary/examples/with-userbase">with-userbase</a></li> <del> </ul> <del></details> <del> <del>[Userbase](https://userbase.com/) supports the static generation pattern for authentication. It's open source and allows for a high level of security with end-to-end encryption. You can learn more about it in their [official site](https://userbase.com/). <del> <del>### SuperTokens <del> <del><details open> <del> <summary><b>Examples</b></summary> <del> <ul> <ide> <li><a href="https://github.com/vercel/next.js/tree/canary/examples/with-supertokens">with-supertokens</a></li> <add> <li><a href="https://github.com/vercel/next.js/tree/canary/examples/with-nhost-auth-realtime-graphql">with-nhost-auth-realtime-graphql</a></li> <ide> </ul> <ide> </details> <ide> <del>[SuperTokens](https://supertokens.io) is a highly customizable, open-source solution split into modules (so you only use what you need). <del>SuperTokens currently supports credentials login, email verification, password reset flows, third-party logins, and cookie based sessions with rotating refresh tokens. <del> <ide> ## Related <ide> <ide> For more information on what to do next, we recommend the following sections:
1
Text
Text
fix links to some headings with special chars
7d3c0834f3b5083e65e186b4d522390aee7b2ff5
<ide><path>docs/faq/Performance.md <ide> hide_title: true <ide> ## Table of Contents <ide> <ide> - [How well does Redux “scale” in terms of performance and architecture?](#how-well-does-redux-scale-in-terms-of-performance-and-architecture) <del>- [Won't calling “all my reducers” for each action be slow?](#won-t-calling-all-my-reducers-for-each-action-be-slow) <add>- [Won't calling “all my reducers” for each action be slow?](#wont-calling-all-my-reducers-for-each-action-be-slow) <ide> - [Do I have to deep-clone my state in a reducer? Isn't copying my state going to be slow?](#do-i-have-to-deep-clone-my-state-in-a-reducer-isnt-copying-my-state-going-to-be-slow) <ide> - [How can I reduce the number of store update events?](#how-can-i-reduce-the-number-of-store-update-events) <ide> - [Will having “one state tree” cause memory problems? Will dispatching many actions take up memory?](#will-having-one-state-tree-cause-memory-problems-will-dispatching-many-actions-take-up-memory) <ide><path>docs/faq/ReactRedux.md <ide> hide_title: true <ide> - [Why isn't my component re-rendering, or my mapStateToProps running?](#why-isnt-my-component-re-rendering-or-my-mapstatetoprops-running) <ide> - [Why is my component re-rendering too often?](#why-is-my-component-re-rendering-too-often) <ide> - [How can I speed up my mapStateToProps?](#how-can-i-speed-up-my-mapstatetoprops) <del>- [Why don't I have this.props.dispatch available in my connected component?](#why-dont-i-have-this-props-dispatch-available-in-my-connected-component) <add>- [Why don't I have this.props.dispatch available in my connected component?](#why-dont-i-have-thispropsdispatch-available-in-my-connected-component) <ide> - [Should I only connect my top component, or can I connect multiple components in my tree?](#should-i-only-connect-my-top-component-or-can-i-connect-multiple-components-in-my-tree) <ide> - [How does Redux compare to the React Context API?](#how-does-redux-compare-to-the-react-context-api) <ide>
2
Ruby
Ruby
use classes instead of strings for exceptions
560408d01b5b2bba26bc0926802246687e48911b
<ide><path>Library/Homebrew/extend/ARGV.rb <ide> class UsageError <RuntimeError; end <ide> class FormulaUnspecifiedError <UsageError; end <ide> class KegUnspecifiedError <UsageError; end <ide> <add>class MultipleVersionsInstalledError <RuntimeError <add> attr :name <add> <add> def initialize name <add> @name = name <add> super "#{name} has multiple installed versions" <add> end <add>end <add> <add>class NoSuchKegError <RuntimeError <add> attr :name <add> <add> def initialize name <add> @name = name <add> super "No such keg: #{HOMEBREW_CELLAR}/#{name}" <add> end <add>end <add> <ide> module HomebrewArgvExtension <ide> def named <ide> @named ||= reject{|arg| arg[0..0] == '-'} <ide> def kegs <ide> @kegs ||= downcased_unique_named.collect do |name| <ide> d = HOMEBREW_CELLAR + Formula.resolve_alias(name) <ide> dirs = d.children.select{ |pn| pn.directory? } rescue [] <del> raise "No such keg: #{HOMEBREW_CELLAR}/#{name}" if not d.directory? or dirs.length == 0 <del> raise "#{name} has multiple installed versions" if dirs.length > 1 <add> raise NoSuchKegError.new(name) if not d.directory? or dirs.length == 0 <add> raise MultipleVersionsInstalledError.new(name) if dirs.length > 1 <ide> Keg.new dirs.first <ide> end <ide> raise KegUnspecifiedError if @kegs.empty?
1
Go
Go
fix tarsum iteration test
8d9e25dbddc189f4094e0f25a90f2b8a25deec9d
<ide><path>pkg/tarsum/tarsum_test.go <ide> func TestIteration(t *testing.T) { <ide> data []byte <ide> }{ <ide> { <del> "tarsum+sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", <add> "tarsum+sha256:626c4a2e9a467d65c33ae81f7f3dedd4de8ccaee72af73223c4bc4718cbc7bbd", <ide> Version0, <ide> &tar.Header{ <ide> Name: "file.txt", <ide> func TestIteration(t *testing.T) { <ide> []byte(""), <ide> }, <ide> { <del> "tarsum.dev+sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", <add> "tarsum.dev+sha256:6ffd43a1573a9913325b4918e124ee982a99c0f3cba90fc032a65f5e20bdd465", <ide> VersionDev, <ide> &tar.Header{ <ide> Name: "file.txt", <ide> func TestIteration(t *testing.T) { <ide> []byte(""), <ide> }, <ide> { <del> "tarsum.dev+sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", <add> "tarsum.dev+sha256:b38166c059e11fb77bef30bf16fba7584446e80fcc156ff46d47e36c5305d8ef", <ide> VersionDev, <ide> &tar.Header{ <ide> Name: "another.txt", <ide> func renderSumForHeader(v Version, h *tar.Header, data []byte) (string, error) { <ide> for { <ide> hdr, err := tr.Next() <ide> if hdr == nil || err == io.EOF { <add> // Signals the end of the archive. <ide> break <ide> } <ide> if err != nil { <ide> func renderSumForHeader(v Version, h *tar.Header, data []byte) (string, error) { <ide> if _, err = io.Copy(ioutil.Discard, tr); err != nil { <ide> return "", err <ide> } <del> break // we're just reading one header ... <ide> } <ide> return ts.Sum(nil), nil <ide> }
1
Javascript
Javascript
remove lookup in favor of passed arg
0c9ea6c67dbc036fde949ce41301c3773ab0f2bc
<ide><path>src/package-transpilation-registry.js <ide> Object.assign(PackageTranspilationRegistry.prototype, { <ide> }, <ide> <ide> transpileWithPackageTranspiler: function (sourceCode, filePath, spec) { <del> var spec = this.specByFilePath[filePath] <del> <ide> Resolve = Resolve || require('resolve') <ide> var transpilerPath = Resolve.sync(spec.transpiler, { <ide> basedir: spec._config.path,
1
Text
Text
add cii best practices badge to readme.md
fea3ba4f4b19044cac75b90d356c39637f7d7b02
<ide><path>README.md <ide> Node.js <ide> ======= <ide> <del>[![Gitter](https://badges.gitter.im/Join Chat.svg)](https://gitter.im/nodejs/node?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) <add>[![Gitter](https://badges.gitter.im/Join Chat.svg)](https://gitter.im/nodejs/node?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/29/badge)](https://bestpractices.coreinfrastructure.org/projects/29) <ide> <ide> Node.js is a JavaScript runtime built on Chrome's V8 JavaScript engine. Node.js <ide> uses an event-driven, non-blocking I/O model that makes it lightweight and
1
Python
Python
add description in docstring
0df57515070ed11020feb1e5f1fa88112ee5e09e
<ide><path>numpy/lib/arraysetops.py <ide> def unique(ar, return_index=False, return_inverse=False, <ide> ----- <ide> When an axis is specified the subarrays indexed by the axis are sorted. <ide> This is done by making the specified axis the first dimension of the array <add> (move the axis to the first dimension to keep the order of the other axes) <ide> and then flattening the subarrays in C order. The flattened subarrays are <ide> then viewed as a structured type with each element given a label, with the <ide> effect that we end up with a 1-D array of structured types that can be
1
Javascript
Javascript
add apollo state func
1e3534e1694f2c59b32025357039cd006d6e3532
<ide><path>examples/with-apollo/lib/apolloClient.js <ide> import { ApolloClient, HttpLink, InMemoryCache } from '@apollo/client' <ide> import { concatPagination } from '@apollo/client/utilities' <ide> import merge from 'deepmerge' <ide> <add>export const APOLLO_STATE_PROP_NAME = '__APOLLO_STATE__' <add> <ide> let apolloClient <ide> <ide> function createApolloClient() { <ide> export function initializeApollo(initialState = null) { <ide> return _apolloClient <ide> } <ide> <del>export function useApollo(initialState) { <del> const store = useMemo(() => initializeApollo(initialState), [initialState]) <add>export function addApolloState(client, pageProps) { <add> if (pageProps?.props) { <add> pageProps.props[APOLLO_STATE_PROP_NAME] = client.cache.extract() <add> } <add> <add> return pageProps <add>} <add> <add>export function useApollo(pageProps) { <add> const state = pageProps[APOLLO_STATE_PROP_NAME] <add> const store = useMemo(() => initializeApollo(state), [state]) <ide> return store <ide> } <ide><path>examples/with-apollo/pages/_app.js <ide> import { ApolloProvider } from '@apollo/client' <ide> import { useApollo } from '../lib/apolloClient' <ide> <ide> export default function App({ Component, pageProps }) { <del> const apolloClient = useApollo(pageProps.initialApolloState) <add> const apolloClient = useApollo(pageProps) <ide> <ide> return ( <ide> <ApolloProvider client={apolloClient}> <ide><path>examples/with-apollo/pages/index.js <ide> import PostList, { <ide> ALL_POSTS_QUERY, <ide> allPostsQueryVars, <ide> } from '../components/PostList' <del>import { initializeApollo } from '../lib/apolloClient' <add>import { initializeApollo, addApolloState } from '../lib/apolloClient' <ide> <ide> const IndexPage = () => ( <ide> <App> <ide> export async function getStaticProps() { <ide> variables: allPostsQueryVars, <ide> }) <ide> <del> return { <del> props: { <del> initialApolloState: apolloClient.cache.extract(), <del> }, <add> return addApolloState(apolloClient, { <add> props: {}, <ide> revalidate: 1, <del> } <add> }) <ide> } <ide> <ide> export default IndexPage
3
Javascript
Javascript
delete unused code in reactdomframescheduling
2d7c754f3ba482d69ee3a06dd101ba12cb4592c9
<ide><path>packages/shared/ReactDOMFrameScheduling.js <ide> if (!ExecutionEnvironment.canUseDOM) { <ide> } else if (typeof requestIdleCallback !== 'function') { <ide> // Polyfill requestIdleCallback. <ide> <del> var scheduledRAFCallback = null; <ide> var scheduledRICCallback = null; <ide> <ide> var isIdleScheduled = false; <ide> if (!ExecutionEnvironment.canUseDOM) { <ide> isIdleScheduled = true; <ide> window.postMessage(messageKey, '*'); <ide> } <del> var callback = scheduledRAFCallback; <del> scheduledRAFCallback = null; <del> if (callback !== null) { <del> callback(rafTime); <del> } <ide> }; <ide> <ide> rIC = function(callback: (deadline: Deadline) => void): number {
1
Javascript
Javascript
remove use of innerhtml
8e3f626f8a0d9b5799633011dc18497d6c03557b
<ide><path>web/viewer.js <ide> var TextLayerBuilder = function textLayerBuilder(textLayerDiv, pageIdx) { <ide> function beginText(begin, className) { <ide> var divIdx = begin.divIdx; <ide> var div = textDivs[divIdx]; <del> div.innerHTML = ''; <add> div.textContent = ''; <ide> <ide> var content = bidiTexts[divIdx].str.substring(0, begin.offset); <ide> var node = document.createTextNode(content);
1
Python
Python
remove unused code from spacy pretrain
0f83b98afad8e533ec482f0b603da9ec18690d6e
<ide><path>spacy/cli/pretrain.py <ide> def pretrain( <ide> pretrained_vectors=pretrained_vectors, <ide> bilstm_depth=0, # Requires PyTorch. Experimental. <ide> cnn_maxout_pieces=3, # You can try setting this higher <del> subword_features=True, <add> subword_features=True, # Set to False for Chinese etc <ide> ), <del> ) # Set to False for character models, e.g. Chinese <add> ) <ide> optimizer = create_default_optimizer(model.ops) <del> tracker = ProgressTracker() <add> tracker = ProgressTracker(frequency=10000) <ide> msg.divider("Pre-training tok2vec layer") <ide> row_settings = {"widths": (3, 10, 10, 6, 4), "aligns": ("r", "r", "r", "r", "r")} <ide> msg.row(("#", "# Words", "Total Loss", "Loss", "w/s"), **row_settings) <ide> def pretrain( <ide> random.shuffle(texts) <ide> <ide> <del>def make_update(model, docs, optimizer, drop=0.0, objective='cosine'): <add>def make_update(model, docs, optimizer, drop=0.0, objective='L2'): <ide> """Perform an update over a single batch of documents. <ide> <ide> docs (iterable): A batch of `Doc` objects. <ide> def make_update(model, docs, optimizer, drop=0.0, objective='cosine'): <ide> RETURNS loss: A float for the loss. <ide> """ <ide> predictions, backprop = model.begin_update(docs, drop=drop) <del> gradients = get_vectors_loss(model.ops, docs, predictions, objective) <add> loss, gradients = get_vectors_loss(model.ops, docs, predictions, objective) <ide> backprop(gradients, sgd=optimizer) <ide> # Don't want to return a cupy object here <ide> # The gradients are modified in-place by the BERT MLM, <ide> # so we get an accurate loss <del> loss = float((gradients ** 2).sum()) <del> return loss <add> return float(loss) <ide> <ide> <ide> def make_docs(nlp, batch, min_length=1, max_length=500): <ide> def make_docs(nlp, batch, min_length=1, max_length=500): <ide> return docs <ide> <ide> <del>def get_vectors_loss(ops, docs, prediction, objective): <add>def get_vectors_loss(ops, docs, prediction, objective='L2'): <ide> """Compute a mean-squared error loss between the documents' vectors and <ide> the prediction. <ide> <ide> def get_vectors_loss(ops, docs, prediction, objective): <ide> target = docs[0].vocab.vectors.data[ids] <ide> if objective == 'L2': <ide> d_scores = prediction - target <del> elif objective == 'nllvmf': <del> d_scores = get_nllvmf_loss(prediction, target) <add> loss = (d_scores**2).sum() <ide> else: <del> d_scores = get_cossim_loss(prediction, target) <del> return d_scores <del> <del> <del>def get_cossim_loss(yh, y): <del> # Add a small constant to avoid 0 vectors <del> yh = yh + 1e-8 <del> y = y + 1e-8 <del> # https://math.stackexchange.com/questions/1923613/partial-derivative-of-cosine-similarity <del> xp = get_array_module(yh) <del> norm_yh = xp.linalg.norm(yh, axis=1, keepdims=True) <del> norm_y = xp.linalg.norm(y, axis=1, keepdims=True) <del> mul_norms = norm_yh * norm_y <del> cosine = (yh * y).sum(axis=1, keepdims=True) / mul_norms <del> d_yh = (y / mul_norms) - (cosine * (yh / norm_yh**2)) <del> return d_yh <del> <del> <del>def get_nllvmf_loss(Yh, Y): <del> """Compute the gradient of the negative log likelihood von Mises-Fisher loss, <del> from Kumar and Tsetskov. <del> Yh: Predicted vectors. <del> Y: True vectors <del> Returns dYh: Gradient of loss with respect to prediction. <del> """ <del> # Warning: Probably wrong? Also needs normalization <del> xp = get_array_module(Yh) <del> assert not xp.isnan(Yh).any() <del> assert not xp.isnan(Y).any() <del> return _backprop_bessel(Yh) * Y <del> <add> raise NotImplementedError(objective) <add> return loss, d_scores <ide> <del>def _backprop_bessel(k, approximate=True): <del> if approximate: <del> return -_ratio(k.shape[1]/2, k) <del> from scipy.special import ive <del> xp = get_array_module(k) <del> if not isinstance(k, numpy.ndarray): <del> k = k.get() <del> k = numpy.asarray(k, dtype='float64') <del> assert not numpy.isnan(k).any() <del> m = k.shape[1] <del> numerator = ive(m/2, k) <del> assert not numpy.isnan(numerator).any() <del> denom = ive(m/2-1, k) <del> assert not numpy.isnan(denom).any() <del> x = -(numerator / (denom+1e-8)) <del> assert not numpy.isnan(x).any() <del> return xp.array(x, dtype='f') <ide> <del> <del>def _ratio(v, z): <del> return z/(v-1+numpy.sqrt((v+1)**2 + z**2, dtype='f')) <del> <del> <del> <del>def create_pretraining_model(nlp, tok2vec, normalized=False): <add>def create_pretraining_model(nlp, tok2vec): <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> """ <del> if normalized: <del> normalize_vectors(nlp.vocab.vectors.data) <ide> output_size = nlp.vocab.vectors.data.shape[1] <ide> output_layer = chain( <ide> LN(Maxout(300, pieces=3)), <ide> Affine(output_size, drop_factor=0.0), <ide> ) <del> if normalized: <del> output_layer = chain(output_layer, normalize) <ide> # This is annoying, but the parser etc have the flatten step after <ide> # the tok2vec. To load the weights in cleanly, we need to match <ide> # the shape of the models' components exactly. So what we cann <ide> def create_pretraining_model(nlp, tok2vec, normalized=False): <ide> return model <ide> <ide> <del>@layerize <del>def normalize(X, drop=0.): <del> xp = get_array_module(X) <del> norms = xp.sqrt((X**2).sum(axis=1, keepdims=True)+1e-8) <del> Y = X / norms <del> def backprop_normalize(dY, sgd=None): <del> d_norms = 2 * norms <del> #dY = (dX * norms - X * d_norms) / norms**2 <del> #dY * norms**2 = dX * norms - X * d_norms <del> #dY * norms**2 + X * d_norms = dX * norms <del> #(dY * norms**2 + X * d_norms) / norms = dX <del> dX = (dY * norms**2 + X * d_norms) / norms <del> return dX <del> return Y, backprop_normalize <del> <del> <del>def normalize_vectors(vectors_data): <del> xp = get_array_module(vectors_data) <del> norms = xp.sqrt((vectors_data**2).sum(axis=1, keepdims=True)+1e-8) <del> vectors_data /= norms <del> <del> <ide> class ProgressTracker(object): <ide> def __init__(self, frequency=1000000): <ide> self.loss = 0.0
1
Text
Text
improve docs radial linear grid
c6120f9e7143c66d5e7a1b4052ae3b0f1165d5da
<ide><path>docs/axes/radial/linear.md <ide> Namespace: `options.scales[scaleId]` <ide> | `pointLabels` | `object` | | Point label configuration. [more...](#point-label-options) <ide> | `startAngle` | `number` | `0` | Starting angle of the scale. In degrees, 0 is at top. <ide> <del>!!!include(axes/_common.md)!!! <add>### Common options to all axes <add> <add>Namespace: `options.scales[scaleId]` <add> <add>| Name | Type | Default | Description <add>| ---- | ---- | ------- | ----------- <add>| `type` | `string` | | Type of scale being employed. Custom scales can be created and registered with a string key. This allows changing the type of an axis for a chart. <add>| `alignToPixels` | `boolean` | `false` | Align pixel values to device pixels. <add>| `backgroundColor` | [`Color`](/general/colors.md) | | Background color of the scale area. <add>| `display` | `boolean`\|`string` | `true` | Controls the axis global visibility (visible when `true`, hidden when `false`). When `display: 'auto'`, the axis is visible only if at least one associated dataset is visible. <add>| `grid` | `object` | | Grid line configuration. [more...](#grid-line-configuration) <add>| `min` | `number` | | User defined minimum number for the scale, overrides minimum value from data. [more...](/axes/index.md#axis-range-settings) <add>| `max` | `number` | | User defined maximum number for the scale, overrides maximum value from data. [more...](/axes/index.md#axis-range-settings) <add>| `reverse` | `boolean` | `false` | Reverse the scale. <add>| `stacked` | `boolean`\|`string` | `false` | Should the data be stacked. [more...](/axes/index.md#stacking) <add>| `suggestedMax` | `number` | | Adjustment used when calculating the maximum data value. [more...](/axes/index.md#axis-range-settings) <add>| `suggestedMin` | `number` | | Adjustment used when calculating the minimum data value. [more...](/axes/index.md#axis-range-settings) <add>| `ticks` | `object` | | Tick configuration. [more...](/axes/index.md#tick-configuration) <add>| `weight` | `number` | `0` | The weight used to sort the axis. Higher weights are further away from the chart area. <ide> <ide> ## Tick Configuration <ide> <ide> Namespace: `options.scales[scaleId].ticks` <ide> <ide> The scriptable context is described in [Options](../../general/options.md#tick) section. <ide> <add>## Grid Line Configuration <add> <add>Namespace: `options.scales[scaleId].grid`, it defines options for the grid lines of the axis. <add> <add>| Name | Type | Scriptable | Indexable | Default | Description <add>| ---- | ---- | :-------------------------------: | :-----------------------------: | ------- | ----------- <add>| `borderDash` | `number[]` | | | `[]` | Length and spacing of dashes on grid lines. See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/setLineDash). <add>| `borderDashOffset` | `number` | Yes | | `0.0` | Offset for line dashes. See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/lineDashOffset). <add>| `circular` | `boolean` | | | `false` | If true, gridlines are circular (on radar and polar area charts only). <add>| `color` | [`Color`](../general/colors.md) | Yes | Yes | `Chart.defaults.borderColor` | The color of the grid lines. If specified as an array, the first color applies to the first grid line, the second to the second grid line, and so on. <add>| `display` | `boolean` | | | `true` | If false, do not display grid lines for this axis. <add>| `lineWidth` | `number` | Yes | Yes | `1` | Stroke width of grid lines. <add> <add>The scriptable context is described in [Options](../general/options.md#tick) section. <add> <ide> ## Axis Range Settings <ide> <ide> Given the number of axis range settings, it is important to understand how they all interact with each other. <ide><path>docs/axes/styling.md <ide> Namespace: `options.scales[scaleId].grid`, it defines options for the grid lines <ide> | `borderWidth` | `number` | | | `1` | The width of the border line. <ide> | `borderDash` | `number[]` | Yes | | `[]` | Length and spacing of dashes on grid lines. See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/setLineDash). <ide> | `borderDashOffset` | `number` | Yes | | `0.0` | Offset for line dashes. See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/lineDashOffset). <del>| `circular` | `boolean` | | | `false` | If true, gridlines are circular (on radar chart only). <add>| `circular` | `boolean` | | | `false` | If true, gridlines are circular (on radar and polar area charts only). <ide> | `color` | [`Color`](../general/colors.md) | Yes | Yes | `Chart.defaults.borderColor` | The color of the grid lines. If specified as an array, the first color applies to the first grid line, the second to the second grid line, and so on. <ide> | `display` | `boolean` | | | `true` | If false, do not display grid lines for this axis. <ide> | `drawBorder` | `boolean` | | | `true` | If true, draw a border at the edge between the axis and the chart area.
2
Javascript
Javascript
fix cancelrequestanimationframe polyfill
bf644ea5ff0f784c8991122692677c30cec39e1d
<ide><path>src/Three.js <ide> if ( ! self.Int32Array ) { <ide> for(var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) { <ide> window.requestAnimationFrame = window[vendors[x]+'RequestAnimationFrame']; <ide> window.cancelAnimationFrame = window[vendors[x]+'CancelAnimationFrame'] <del> || window[vendors[x]+'RequestCancelAnimationFrame']; <add> || window[vendors[x]+'CancelRequestAnimationFrame']; <ide> } <ide> <ide> if (!window.requestAnimationFrame)
1