content_type
stringclasses
8 values
main_lang
stringclasses
7 values
message
stringlengths
1
50
sha
stringlengths
40
40
patch
stringlengths
52
962k
file_count
int64
1
300
Python
Python
add a initial_best parameter in modelcheckpoint
9b920a8ebdb42b5a518b33fac7eee5ce5519bab1
<ide><path>keras/callbacks.py <ide> class ModelCheckpoint(Callback): <ide> options: Optional `tf.train.CheckpointOptions` object if <ide> `save_weights_only` is true or optional `tf.saved_model.SaveOptions` <ide> object if `save_weights_only` is false. <add> initial_best: Initial best value of the metric to be monitored before <add> training begins. Only overwrites the model weights already saved, if the <add> performance of current model is better than the previous saved model. <ide> **kwargs: Additional arguments for backwards compatibility. Possible key <ide> is `period`. <ide> """ <ide> def __init__(self, <ide> mode='auto', <ide> save_freq='epoch', <ide> options=None, <add> initial_best= None, <ide> **kwargs): <ide> super(ModelCheckpoint, self).__init__() <ide> self._supports_tf_logs = True <ide> def __init__(self, <ide> self.epochs_since_last_save = 0 <ide> self._batches_seen_since_last_saving = 0 <ide> self._last_batch_seen = 0 <add> self.best= initial_best <ide> <ide> if save_weights_only: <ide> if options is None or isinstance( <ide> def __init__(self, <ide> <ide> if mode == 'min': <ide> self.monitor_op = np.less <del> self.best = np.Inf <add> if self.best is None: <add> self.best = np.Inf <ide> elif mode == 'max': <ide> self.monitor_op = np.greater <del> self.best = -np.Inf <add> if self.best is None: <add> self.best = -np.Inf <ide> else: <ide> if 'acc' in self.monitor or self.monitor.startswith('fmeasure'): <ide> self.monitor_op = np.greater <del> self.best = -np.Inf <add> if self.best is None: <add> self.best = -np.Inf <ide> else: <ide> self.monitor_op = np.less <del> self.best = np.Inf <add> if self.best is None: <add> self.best = np.Inf <ide> <ide> if self.save_freq != 'epoch' and not isinstance(self.save_freq, int): <ide> raise ValueError(
1
Python
Python
add fixture for stringstore
9b6784bab52227fc5e0d5bc6ba0f13fcac64f9ff
<ide><path>spacy/tests/conftest.py <ide> from ..sv import Swedish <ide> from ..hu import Hungarian <ide> from ..tokens import Doc <add>from ..strings import StringStore <ide> from ..attrs import ORTH, TAG, HEAD, DEP <ide> <ide> from io import StringIO <ide> def de_tokenizer(): <ide> def hu_tokenizer(): <ide> return Hungarian.Defaults.create_tokenizer() <ide> <add>@pytest.fixture <add>def stringstore(): <add> return StringStore() <ide> <ide> @pytest.fixture <ide> def text_file():
1
Python
Python
use the pytest tmpdir fixture
f7b925a8930ddfc63901fbcdb51be26956096d7e
<ide><path>tests/keras/legacy/models_test.py <ide> epochs = 1 <ide> <ide> <add>@pytest.fixture <add>def in_tmpdir(tmpdir): <add> """Runs a function in a temporary directory. <add> <add> Checks that the directory is empty afterwards. <add> """ <add> with tmpdir.as_cwd(): <add> yield None <add> assert not tmpdir.listdir() <add> <add> <ide> def _get_test_data(): <ide> np.random.seed(1234) <ide> <ide> def _get_test_data(): <ide> <ide> <ide> @keras_test <del>def test_merge_sum(): <add>def test_merge_sum(in_tmpdir): <ide> (x_train, y_train), (x_test, y_test) = _get_test_data() <ide> left = Sequential() <ide> left.add(Dense(num_hidden, input_shape=(input_dim,))) <ide> def test_merge_dot(): <ide> <ide> <ide> @keras_test <del>def test_merge_concat(): <add>def test_merge_concat(in_tmpdir): <ide> (x_train, y_train), (x_test, y_test) = _get_test_data() <ide> <ide> left = Sequential(name='branch_1') <ide> def test_merge_concat(): <ide> <ide> <ide> @keras_test <del>def test_merge_recursivity(): <add>def test_merge_recursivity(in_tmpdir): <ide> (x_train, y_train), (x_test, y_test) = _get_test_data() <ide> left = Sequential() <ide> left.add(Dense(num_hidden, input_shape=(input_dim,))) <ide> def test_merge_recursivity(): <ide> <ide> <ide> @keras_test <del>def test_merge_overlap(): <add>def test_merge_overlap(in_tmpdir): <ide> (x_train, y_train), (x_test, y_test) = _get_test_data() <ide> left = Sequential() <ide> left.add(Dense(num_hidden, input_shape=(input_dim,))) <ide><path>tests/keras/preprocessing/image_test.py <ide> from PIL import Image <ide> import numpy as np <ide> import os <del>import shutil <del>import tempfile <ide> <ide> <ide> class TestImage: <ide> def setup_class(cls): <ide> def teardown_class(cls): <ide> del cls.all_test_images <ide> <del> def test_image_data_generator(self): <add> def test_image_data_generator(self, tmpdir): <ide> for test_images in self.all_test_images: <ide> img_list = [] <ide> for im in test_images: <ide> def test_image_data_generator(self): <ide> vertical_flip=True) <ide> generator.fit(images, augment=True) <ide> <del> tmp_folder = tempfile.mkdtemp(prefix='test_images') <ide> for x, y in generator.flow(images, np.arange(images.shape[0]), <del> shuffle=True, save_to_dir=tmp_folder): <add> shuffle=True, save_to_dir=str(tmpdir)): <ide> assert x.shape[1:] == images.shape[1:] <ide> break <del> shutil.rmtree(tmp_folder) <ide> <ide> def test_image_data_generator_invalid_data(self): <ide> generator = image.ImageDataGenerator( <ide> def test_image_data_generator_fit(self): <ide> x = np.random.random((32, 3, 10, 10)) <ide> generator.fit(x) <ide> <del> def test_directory_iterator(self): <add> def test_directory_iterator(self, tmpdir): <ide> num_classes = 2 <del> tmp_folder = tempfile.mkdtemp(prefix='test_images') <ide> <ide> # create folders and subfolders <ide> paths = [] <ide> def test_directory_iterator(self): <ide> os.path.join(class_directory, 'subfolder-1', 'sub-subfolder') <ide> ] <ide> for path in classpaths: <del> os.mkdir(os.path.join(tmp_folder, path)) <add> tmpdir.join(path).mkdir() <ide> paths.append(classpaths) <ide> <ide> # save the images in the paths <ide> def test_directory_iterator(self): <ide> classpaths = paths[im_class] <ide> filename = os.path.join(classpaths[count % len(classpaths)], 'image-{}.jpg'.format(count)) <ide> filenames.append(filename) <del> im.save(os.path.join(tmp_folder, filename)) <add> im.save(str(tmpdir / filename)) <ide> count += 1 <ide> <ide> # create iterator <ide> generator = image.ImageDataGenerator() <del> dir_iterator = generator.flow_from_directory(tmp_folder) <add> dir_iterator = generator.flow_from_directory(str(tmpdir)) <ide> <ide> # check number of classes and images <ide> assert(len(dir_iterator.class_indices) == num_classes) <ide> assert(len(dir_iterator.classes) == count) <ide> assert(sorted(dir_iterator.filenames) == sorted(filenames)) <del> shutil.rmtree(tmp_folder) <ide> <del> def test_directory_iterator_class_mode_input(self): <del> tmp_folder = tempfile.mkdtemp(prefix='test_images') <del> os.mkdir(os.path.join(tmp_folder, 'class-1')) <add> def test_directory_iterator_class_mode_input(self, tmpdir): <add> tmpdir.join('class-1').mkdir() <ide> <ide> # save the images in the paths <ide> count = 0 <ide> for test_images in self.all_test_images: <ide> for im in test_images: <del> filename = os.path.join(tmp_folder, 'class-1', 'image-{}.jpg'.format(count)) <del> im.save(os.path.join(tmp_folder, filename)) <add> filename = str(tmpdir / 'class-1' / 'image-{}.jpg'.format(count)) <add> im.save(filename) <ide> count += 1 <ide> <ide> # create iterator <ide> generator = image.ImageDataGenerator() <del> dir_iterator = generator.flow_from_directory(tmp_folder, class_mode='input') <add> dir_iterator = generator.flow_from_directory(str(tmpdir), class_mode='input') <ide> batch = next(dir_iterator) <ide> <ide> # check if input and output have the same shape <ide> def test_directory_iterator_class_mode_input(self): <ide> output_img = batch[1][0] <ide> output_img[0][0][0] += 1 <ide> assert(input_img[0][0][0] != output_img[0][0][0]) <del> shutil.rmtree(tmp_folder) <ide> <ide> def test_img_utils(self): <ide> height, width = 10, 8 <ide><path>tests/keras/test_callbacks.py <ide> def test_TerminateOnNaN(): <ide> <ide> <ide> @keras_test <del>def test_ModelCheckpoint(): <add>def test_ModelCheckpoint(tmpdir): <ide> np.random.seed(1337) <del> filepath = 'checkpoint.h5' <add> filepath = str(tmpdir / 'checkpoint.h5') <ide> (X_train, y_train), (X_test, y_test) = get_test_data(num_train=train_samples, <ide> num_test=test_samples, <ide> input_shape=(input_dim,), <ide> def test_ModelCheckpoint(): <ide> save_best_only=save_best_only, mode=mode)] <ide> model.fit(X_train, y_train, batch_size=batch_size, <ide> validation_data=(X_test, y_test), callbacks=cbks, epochs=1) <del> assert os.path.exists(filepath) <add> assert os.path.isfile(filepath) <ide> os.remove(filepath) <ide> <ide> # case 2 <ide> def test_ModelCheckpoint(): <ide> save_best_only=save_best_only, mode=mode)] <ide> model.fit(X_train, y_train, batch_size=batch_size, <ide> validation_data=(X_test, y_test), callbacks=cbks, epochs=1) <del> assert os.path.exists(filepath) <add> assert os.path.isfile(filepath) <ide> os.remove(filepath) <ide> <ide> # case 3 <ide> def test_ModelCheckpoint(): <ide> save_best_only=save_best_only, mode=mode)] <ide> model.fit(X_train, y_train, batch_size=batch_size, <ide> validation_data=(X_test, y_test), callbacks=cbks, epochs=1) <del> assert os.path.exists(filepath) <add> assert os.path.isfile(filepath) <ide> os.remove(filepath) <ide> <ide> # case 4 <ide> def test_ModelCheckpoint(): <ide> save_best_only=save_best_only, mode=mode)] <ide> model.fit(X_train, y_train, batch_size=batch_size, <ide> validation_data=(X_test, y_test), callbacks=cbks, epochs=1) <del> assert os.path.exists(filepath) <add> assert os.path.isfile(filepath) <ide> os.remove(filepath) <ide> <ide> # case 5 <ide> def test_ModelCheckpoint(): <ide> period=period)] <ide> model.fit(X_train, y_train, batch_size=batch_size, <ide> validation_data=(X_test, y_test), callbacks=cbks, epochs=4) <del> assert os.path.exists(filepath.format(epoch=1)) <del> assert os.path.exists(filepath.format(epoch=3)) <add> assert os.path.isfile(filepath.format(epoch=1)) <add> assert os.path.isfile(filepath.format(epoch=3)) <ide> assert not os.path.exists(filepath.format(epoch=0)) <ide> assert not os.path.exists(filepath.format(epoch=2)) <ide> os.remove(filepath.format(epoch=1)) <ide> os.remove(filepath.format(epoch=3)) <add> assert not tmpdir.listdir() <ide> <ide> <ide> @keras_test <ide> def make_model(): <ide> <ide> <ide> @keras_test <del>def test_CSVLogger(): <add>def test_CSVLogger(tmpdir): <ide> np.random.seed(1337) <del> filepath = 'log.tsv' <add> filepath = str(tmpdir / 'log.tsv') <ide> sep = '\t' <ide> (X_train, y_train), (X_test, y_test) = get_test_data(num_train=train_samples, <ide> num_test=test_samples, <ide> def make_model(): <ide> model.fit(X_train, y_train, batch_size=batch_size, <ide> validation_data=(X_test, y_test), callbacks=cbks, epochs=1) <ide> <del> assert os.path.exists(filepath) <add> assert os.path.isfile(filepath) <ide> with open(filepath) as csvfile: <ide> dialect = Sniffer().sniff(csvfile.read()) <ide> assert dialect.delimiter == sep <ide> def make_model(): <ide> assert len(re.findall('epoch', output)) == 1 <ide> <ide> os.remove(filepath) <add> assert not tmpdir.listdir() <ide> <ide> <ide> @keras_test <ide> @pytest.mark.skipif((K.backend() != 'tensorflow'), <ide> reason='Requires tensorflow backend') <del>def test_TensorBoard(): <add>def test_TensorBoard(tmpdir): <ide> np.random.seed(np.random.randint(1, 1e7)) <del> filepath = './logs_' + str(np.random.randint(1, 1e4)) <add> filepath = str(tmpdir / 'logs') <ide> <ide> (X_train, y_train), (X_test, y_test) = get_test_data( <ide> num_train=train_samples, <ide> def data_generator_graph(train): <ide> model.fit_generator(data_generator(True), len(X_train), epochs=2, <ide> callbacks=cbks) <ide> <del> assert os.path.exists(filepath) <add> assert os.path.isdir(filepath) <ide> shutil.rmtree(filepath) <add> assert not tmpdir.listdir() <ide> <ide> <ide> @keras_test <ide> @pytest.mark.skipif((K.backend() != 'tensorflow'), <ide> reason='Requires tensorflow backend') <del>def test_TensorBoard_convnet(): <add>def test_TensorBoard_convnet(tmpdir): <ide> np.random.seed(np.random.randint(1, 1e7)) <del> filepath = './logs_' + str(np.random.randint(1, 1e4)) <add> filepath = str(tmpdir / 'logs') <ide> <ide> input_shape = (16, 16, 3) <ide> (x_train, y_train), (x_test, y_test) = get_test_data(num_train=500, <ide> def test_TensorBoard_convnet(): <ide> validation_data=(x_test, y_test), <ide> callbacks=cbks, <ide> verbose=0) <del> assert os.path.exists(filepath) <add> assert os.path.isdir(filepath) <ide> shutil.rmtree(filepath) <add> assert not tmpdir.listdir() <ide> <ide> <ide> @keras_test <ide> def f(): <ide> @keras_test <ide> @pytest.mark.skipif((K.backend() != 'tensorflow'), <ide> reason="Requires tensorflow backend") <del>def test_TensorBoard_with_ReduceLROnPlateau(): <add>def test_TensorBoard_with_ReduceLROnPlateau(tmpdir): <ide> import shutil <ide> np.random.seed(np.random.randint(1, 1e7)) <del> filepath = './logs_' + str(np.random.randint(1, 1e4)) <add> filepath = str(tmpdir / 'logs') <ide> <ide> (X_train, y_train), (X_test, y_test) = get_test_data(num_train=train_samples, <ide> num_test=test_samples, <ide> def test_TensorBoard_with_ReduceLROnPlateau(): <ide> model.fit(X_train, y_train, batch_size=batch_size, <ide> validation_data=(X_test, y_test), callbacks=cbks, epochs=2) <ide> <del> assert os.path.exists(filepath) <add> assert os.path.isdir(filepath) <ide> shutil.rmtree(filepath) <add> assert not tmpdir.listdir() <ide> <ide> <ide> if __name__ == '__main__': <ide><path>tests/keras/test_sequential_model.py <ide> epochs = 1 <ide> <ide> <add>@pytest.fixture <add>def in_tmpdir(tmpdir): <add> """Runs a function in a temporary directory. <add> <add> Checks that the directory is empty afterwards. <add> """ <add> with tmpdir.as_cwd(): <add> yield None <add> assert not tmpdir.listdir() <add> <add> <ide> @keras_test <ide> def test_sequential_pop(): <ide> model = Sequential() <ide> def data_generator(train): <ide> <ide> <ide> @keras_test <del>def test_sequential(): <add>def test_sequential(in_tmpdir): <ide> (x_train, y_train), (x_test, y_test) = _get_test_data() <ide> <ide> # TODO: factor out <ide> def data_generator(x, y, batch_size=50): <ide> <ide> <ide> @keras_test <del>def test_nested_sequential(): <add>def test_nested_sequential(in_tmpdir): <ide> (x_train, y_train), (x_test, y_test) = _get_test_data() <ide> <ide> inner = Sequential() <ide><path>tests/keras/utils/data_utils_test.py <ide> from keras.utils.data_utils import _hash_file <ide> <ide> <del>def test_data_utils(): <add>@pytest.fixture <add>def in_tmpdir(tmpdir): <add> """Runs a function in a temporary directory. <add> <add> Checks that the directory is empty afterwards. <add> """ <add> with tmpdir.as_cwd(): <add> yield None <add> assert not tmpdir.listdir() <add> <add> <add>def test_data_utils(in_tmpdir): <ide> """Tests get_file from a url, plus extraction and validation. <ide> """ <ide> dirname = 'data_utils' <ide><path>tests/keras/utils/io_utils_test.py <ide> import h5py <ide> <ide> <add>@pytest.fixture <add>def in_tmpdir(tmpdir): <add> """Runs a function in a temporary directory. <add> <add> Checks that the directory is empty afterwards. <add> """ <add> with tmpdir.as_cwd(): <add> yield None <add> assert not tmpdir.listdir() <add> <add> <ide> def create_dataset(h5_path='test.h5'): <ide> X = np.random.randn(200, 10).astype('float32') <ide> y = np.random.randint(0, 2, size=(200, 1)) <ide> def create_dataset(h5_path='test.h5'): <ide> f.close() <ide> <ide> <del>def test_io_utils(): <add>def test_io_utils(in_tmpdir): <ide> '''Tests the HDF5Matrix code using the sample from @jfsantos at <ide> https://gist.github.com/jfsantos/e2ef822c744357a4ed16ec0c885100a3 <ide> ''' <ide><path>tests/test_multiprocessing.py <ide> from keras.utils.test_utils import keras_test <ide> <ide> <add>@pytest.fixture <add>def in_tmpdir(tmpdir): <add> """Runs a function in a temporary directory. <add> <add> Checks that the directory is empty afterwards. <add> """ <add> with tmpdir.as_cwd(): <add> yield None <add> assert not tmpdir.listdir() <add> <add> <ide> @keras_test <ide> def test_multiprocessing_training(): <ide> arr_data = np.random.randint(0, 256, (50, 2)) <ide> def custom_generator(): <ide> <ide> <ide> @keras_test <del>def test_multiprocessing_training_fromfile(): <add>def test_multiprocessing_training_fromfile(in_tmpdir): <ide> arr_data = np.random.randint(0, 256, (50, 2)) <ide> arr_labels = np.random.randint(0, 2, 50) <ide> np.savez('data.npz', **{'data': arr_data, 'labels': arr_labels})
7
Python
Python
make onetoonesource.target nullable
abe655e061871a568cccf473414e350f3eb61d8b
<ide><path>rest_framework/tests/test_relations_nested.py <ide> class OneToOneTarget(models.Model): <ide> <ide> class OneToOneSource(models.Model): <ide> name = models.CharField(max_length=100) <del> target = models.OneToOneField(OneToOneTarget, related_name='source') <add> target = models.OneToOneField(OneToOneTarget, related_name='source', <add> null=True, blank=True) <ide> <ide> <ide> class OneToManyTarget(models.Model): <ide> class OneToManySource(models.Model): <ide> name = models.CharField(max_length=100) <ide> target = models.ForeignKey(OneToManyTarget, related_name='sources') <ide> <del> <add> <ide> class ReverseNestedOneToOneTests(TestCase): <ide> def setUp(self): <ide> class OneToOneSourceSerializer(serializers.ModelSerializer):
1
Ruby
Ruby
fix rubocop warnings
bde8d69d6e1129530fa2bbe1e88cf88e350521af
<ide><path>Library/Homebrew/language/node.rb <ide> def self.std_npm_install_args(libexec) <ide> setup_npm_environment <ide> # tell npm to not install .brew_home by adding it to the .npmignore file <ide> # (or creating a new one if no .npmignore file already exists) <del> open(".npmignore", "a") { |f| f.write( "\n.brew_home\n") } <add> open(".npmignore", "a") { |f| f.write("\n.brew_home\n") } <ide> # npm install args for global style module format installed into libexec <ide> ["--verbose", "--global", "--prefix=#{libexec}", "."] <ide> end
1
Python
Python
add general structure for bert2bert class
75feacf172d5aa26314929c0f3bb54d9e845e00b
<ide><path>transformers/modeling_bert.py <ide> def forward(self, input_ids, attention_mask=None, token_type_ids=None, position_ <ide> outputs = (total_loss,) + outputs <ide> <ide> return outputs # (loss), start_logits, end_logits, (hidden_states), (attentions) <add> <add> <add>@add_start_docstrings("Bert encoder-decoder model", <add> BERT_START_DOCSTRING, <add> BERT_INPUTS_DOCSTRING) <add>class Bert2Bert(BertPreTrainedModel): <add> r""" <add> <add> Outputs: `Tuple` comprising various elements depending on the configuration (config) and inputs: <add> <add> Examples:: <add> <add> tokenizer = BertTokenizer.from_pretrained('bert-base-uncased') <add> model = Bert2Bert.from_pretrained('bert-base-uncased') <add> input = tokenizer.encode("Hello, how are you?") <add> outputs = model(input) <add> output_text = tokenize.decode(outputs[0]) <add> print(output_text) <add> """ <add> <add> def __init__(self, config): <add> super(Bert2Bert, self).__init__(config) <add> self.embeddings = BertEmbeddings(config) <add> self.encoder = BertEncoder(config) <add> self.decoder = BertDecoder(config) <add> <add> def forward(self, inputs, attention_mask=None, token_type_ids=None, position_ids=None, head_mask=None): <add> if attention_mask is None: <add> attention_mask = torch.ones_like(inputs) <add> if token_type_ids is None: <add> token_type_ids = torch.zeros_like(inputs) <add> <add> # We create a 3D attention mask from a 2D tensor mask. <add> # Sizes are [batch_size, 1, 1, to_seq_length] <add> # So we can broadcast to [batch_size, num_heads, from_seq_length, to_seq_length] <add> # this attention mask is more simple than the triangular masking of causal attention <add> # used in OpenAI GPT, we just need to prepare the broadcast dimension here. <add> extended_attention_mask = attention_mask.unsqueeze(1).unsqueeze(2) <add> <add> # Since attention_mask is 1.0 for positions we want to attend and 0.0 for <add> # masked positions, this operation will create a tensor which is 0.0 for <add> # positions we want to attend and -10000.0 for masked positions. <add> # Since we are adding it to the raw scores before the softmax, this is <add> # effectively the same as removing these entirely. <add> extended_attention_mask = extended_attention_mask.to(dtype=next(self.parameters()).dtype) # fp16 compatibility <add> extended_attention_mask = (1.0 - extended_attention_mask) * -10000.0 <add> <add> embedding_output = self.embeddings(inputs, position_ids=position_ids, token_type_ids=token_type_ids) <add> encoder_outputs = self.encoder(embedding_output, <add> extended_attention_mask, <add> head_mask=head_mask) <add> decoder_outputs = self.decoder(embedding_output, <add> encoder_outputs[0], <add> extended_attention_mask, <add> head_mask=head_mask) <add> sequence_output = decoder_outputs[0] <add> pooled_output = self.pooler(sequence_output) <add> <add> outputs = (sequence_output, pooled_output,) + encoder_outputs[1:] # add hidden_states and attentions if they are here <add> return outputs # sequence_output, pooled_output, (hidden_states), (attentions)
1
Text
Text
fix 1.6.0 release name
70490ef71703d970989b52667567a91981011308
<ide><path>CHANGELOG.md <ide> <a name="1.6.0"></a> <del># 1.6.0 XXXXX-YYYYY (2016-12-08) <add># 1.6.0 rainbow-tsunami (2016-12-08) <ide> <ide> **Here are the full changes for the release of 1.6.0 that are not already released in the 1.5.x branch, <ide> consolidating all the changes shown in the previous 1.6.0 release candidates.**
1
Javascript
Javascript
use slice(0) to clone arrays
28273b7f1ef52e46d5bc23c41bc7a1492cf23014
<ide><path>src/Angular.js <ide> function copy(source, destination){ <ide> destination = source; <ide> if (source) { <ide> if (isArray(source)) { <del> destination = copy(source, []); <add> // http://jsperf.com/copy-array-with-slice-vs-for <add> destination = source.slice(0); <ide> } else if (isDate(source)) { <ide> destination = new Date(source.getTime()); <ide> } else if (isObject(source)) {
1
Python
Python
add short aliases for global pooling layers
136f1b429201a298173493f83ee8672421ac6e06
<ide><path>keras/layers/pooling.py <ide> def call(self, inputs): <ide> MaxPool2D = MaxPooling2D <ide> AvgPool3D = AveragePooling3D <ide> MaxPool3D = MaxPooling3D <add>GlobalMaxPool1D = GlobalMaxPooling1D <add>GlobalMaxPool2D = GlobalMaxPooling2D <add>GlobalMaxPool3D = GlobalMaxPooling3D <add>GlobalAvgPool1D = GlobalAveragePooling1D <add>GlobalAvgPool2D = GlobalAveragePooling2D <add>GlobalAvgPool3D = GlobalAveragePooling3D
1
Javascript
Javascript
fix typos in docs
00c92ef2852abcc037091d5b03701586df121b59
<ide><path>packages/ember-routing/lib/router.js <ide> var get = Ember.get, getPath = Ember.getPath, set = Ember.set; <ide> } <ide> <ide> Within `deserialize` you should use this information to retrieve or create an appropriate context <del> object for the given url (e.g. by loading from a remote API or accessing the browser's <del> `localStorage`). This object must be the `return` value for `deserialize` and will be <add> object for the given URL (e.g. by loading from a remote API or accessing the browser's <add> `localStorage`). This object must be the `return` value of `deserialize` and will be <ide> passed to the Route's `connectOutlets` and `serialize` methods. <ide> <ide> When an application's state is changed from within the application itself, the context provided for <del> the transiton will be passed and `deserialize` is not called (see 'Transitions Between States'). <add> the transition will be passed and `deserialize` is not called (see 'Transitions Between States'). <ide> <ide> ### Serializing An Object For URLs with Dynamic Segments <ide> When transitioning into a Route whose `route` property contains dynamic segments the Route's <ide> var get = Ember.get, getPath = Ember.getPath, set = Ember.set; <ide> App.get('router').send('moveElsewhere'); <ide> <ide> Will transition the application's state to 'root.bRoute' and trigger an update of the URL to <del> '#/someOtherLocation <add> '#/someOtherLocation'. <ide> <ide> For URL patterns with dynamic segments a context can be supplied as the second argument to `send`. <ide> The router will match dynamic segments names to keys on this object and fill in the URL with the <ide> var get = Ember.get, getPath = Ember.getPath, set = Ember.set; <ide> During application initialization Ember will detect properties of the application ending in 'Controller', <ide> create singleton instances of each class, and assign them as a properties on the router. The property name <ide> will be the UpperCamel name converted to lowerCamel format. These controller classes should be subclasses <del> of Ember.ObjectController, Ember.ArrayController, or a custom Ember.Object that includes the <add> of Ember.ObjectController, Ember.ArrayController, Ember.Controller, or a custom Ember.Object that includes the <ide> Ember.ControllerMixin mixin. <ide> <ide> App = Ember.Application.create({
1
Java
Java
fix package cycles in spring-test
90c5f226b62503b492167bcd87361842f73d18b1
<ide><path>spring-test/src/main/java/org/springframework/test/context/web/ServletTestExecutionListener.java <ide> <ide> import org.apache.commons.logging.Log; <ide> import org.apache.commons.logging.LogFactory; <add> <ide> import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; <ide> import org.springframework.context.ApplicationContext; <ide> import org.springframework.context.ConfigurableApplicationContext; <ide> import org.springframework.mock.web.MockHttpServletRequest; <ide> import org.springframework.mock.web.MockHttpServletResponse; <ide> import org.springframework.mock.web.MockServletContext; <ide> import org.springframework.test.context.TestContext; <del>import org.springframework.test.context.support.AbstractTestExecutionListener; <add>import org.springframework.test.context.TestExecutionListener; <ide> import org.springframework.web.context.WebApplicationContext; <ide> import org.springframework.web.context.request.RequestContextHolder; <ide> import org.springframework.web.context.request.ServletWebRequest; <ide> * @author Sam Brannen <ide> * @since 3.2 <ide> */ <del>public class ServletTestExecutionListener extends AbstractTestExecutionListener { <add>public class ServletTestExecutionListener implements TestExecutionListener { <ide> <ide> private static final Log logger = LogFactory.getLog(ServletTestExecutionListener.class); <ide> <ide> <add> /** <add> * The default implementation is <em>empty</em>. Can be overridden by <add> * subclasses as necessary. <add> * <add> * @see org.springframework.test.context.TestExecutionListener#beforeTestClass(TestContext) <add> */ <add> public void beforeTestClass(TestContext testContext) throws Exception { <add> /* no-op */ <add> } <add> <ide> /** <ide> * TODO [SPR-9864] Document overridden prepareTestInstance(). <ide> * <del> * @see org.springframework.test.context.support.AbstractTestExecutionListener#prepareTestInstance(org.springframework.test.context.TestContext) <add> * @see org.springframework.test.context.TestExecutionListener#prepareTestInstance(TestContext) <ide> */ <del> @Override <ide> public void prepareTestInstance(TestContext testContext) throws Exception { <ide> setUpRequestContextIfNecessary(testContext); <ide> } <ide> <ide> /** <ide> * TODO [SPR-9864] Document overridden beforeTestMethod(). <ide> * <del> * @see org.springframework.test.context.support.AbstractTestExecutionListener#beforeTestMethod(org.springframework.test.context.TestContext) <add> * @see org.springframework.test.context.TestExecutionListener#beforeTestMethod(TestContext) <ide> */ <del> @Override <ide> public void beforeTestMethod(TestContext testContext) throws Exception { <ide> setUpRequestContextIfNecessary(testContext); <ide> } <ide> <add> /** <add> * TODO [SPR-9864] Document overridden afterTestMethod(). <add> * <add> * @see org.springframework.test.context.TestExecutionListener#afterTestMethod(TestContext) <add> */ <add> public void afterTestMethod(TestContext testContext) throws Exception { <add> if (logger.isDebugEnabled()) { <add> logger.debug(String.format("Resetting RequestContextHolder for test context %s.", testContext)); <add> } <add> RequestContextHolder.resetRequestAttributes(); <add> } <add> <add> /** <add> * The default implementation is <em>empty</em>. Can be overridden by <add> * subclasses as necessary. <add> * <add> * @see org.springframework.test.context.TestExecutionListener#afterTestClass(TestContext) <add> */ <add> public void afterTestClass(TestContext testContext) throws Exception { <add> /* no-op */ <add> } <add> <ide> /** <ide> * TODO [SPR-9864] Document setUpRequestContext(). <ide> * <ide> private void setUpRequestContextIfNecessary(TestContext testContext) { <ide> } <ide> } <ide> <del> /** <del> * TODO [SPR-9864] Document overridden afterTestMethod(). <del> * <del> * @see org.springframework.test.context.support.AbstractTestExecutionListener#afterTestMethod(org.springframework.test.context.TestContext) <del> */ <del> @Override <del> public void afterTestMethod(TestContext testContext) throws Exception { <del> if (logger.isDebugEnabled()) { <del> logger.debug(String.format("Resetting RequestContextHolder for test context %s.", testContext)); <del> } <del> RequestContextHolder.resetRequestAttributes(); <del> } <del> <ide> }
1
PHP
PHP
define an api group as an example
b70dbaf7a1fbcd5204eaa62d9064a8a5ceb6f79c
<ide><path>app/Http/Kernel.php <ide> class Kernel extends HttpKernel <ide> \Illuminate\View\Middleware\ShareErrorsFromSession::class, <ide> \App\Http\Middleware\VerifyCsrfToken::class, <ide> ], <add> <add> 'api' => [ <add> 'throttle:60,1' <add> ], <ide> ]; <ide> <ide> /** <ide><path>app/Http/routes.php <ide> | <ide> */ <ide> <del>Route::group(['middleware' => 'web'], function () { <add>Route::group(['middleware' => ['web']], function () { <ide> // <ide> });
2
Ruby
Ruby
create gem_root and make js_dependencies private
b1f6be8f49102ed7118baf76c02a11aea37fc1cb
<ide><path>actiontext/lib/generators/action_text/install/install_generator.rb <ide> class InstallGenerator < ::Rails::Generators::Base <ide> source_root File.expand_path("templates", __dir__) <ide> <ide> def install_javascript_dependencies <del> template "#{__dir__}/../../../../../railties/lib/rails/generators/rails/app/templates/bin/yarn.tt", <add> template "#{GEM_ROOT}/../railties/lib/rails/generators/rails/app/templates/bin/yarn.tt", <ide> "bin/yarn" <ide> <ide> say "Installing JavaScript dependencies" <ide> def append_dependencies_to_package_file <ide> def create_actiontext_files <ide> template "actiontext.scss", "app/assets/stylesheets/actiontext.scss" <ide> <del> copy_file "#{__dir__}/../../../../app/views/active_storage/blobs/_blob.html.erb", <add> copy_file "#{GEM_ROOT}/app/views/active_storage/blobs/_blob.html.erb", <ide> "app/views/active_storage/blobs/_blob.html.erb" <ide> end <ide> <ide> def create_migrations <ide> run "rake action_text:install:migrations" <ide> end <ide> <add> hook_for :test_framework <add> <add> private <add> <add> GEM_ROOT = "#{__dir__}/../../../.." <add> <ide> def js_dependencies <del> package_contents = File.read(Pathname.new("#{__dir__}/../../../../package.json")) <add> package_contents = File.read(Pathname.new("#{GEM_ROOT}/package.json")) <ide> js_package = JSON.load(package_contents) <ide> <ide> js_package["peerDependencies"].dup.merge \ <ide> js_package["name"] => "^#{js_package["version"]}" <ide> end <del> <del> hook_for :test_framework <ide> end <ide> end <ide> end
1
Text
Text
fix whitespace in line chart documentation
8c2bc34b9c36eb1c79b4aa0313cb01012059444d
<ide><path>docs/02-Line-Chart.md <ide> var data = { <ide> borderColor: "rgba(220,220,220,1)", <ide> <ide> // String - cap style of the line. See https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/lineCap <del> borderCapStyle: 'butt', <add> borderCapStyle: 'butt', <ide> <del> // Array - Length and spacing of dashes. See https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/setLineDash <del> borderDash: [], <add> // Array - Length and spacing of dashes. See https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/setLineDash <add> borderDash: [], <ide> <del> // Number - Offset for line dashes. See https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/lineDashOffset <del> borderDashOffset: 0.0, <add> // Number - Offset for line dashes. See https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/lineDashOffset <add> borderDashOffset: 0.0, <ide> <del> // String - line join style. See https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/lineJoin <del> borderJoinStyle: 'miter', <add> // String - line join style. See https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/lineJoin <add> borderJoinStyle: 'miter', <ide> <ide> // String or array - Point stroke color <ide> pointBorderColor: "rgba(220,220,220,1)",
1
PHP
PHP
apply fixes from styleci
e7fa0b047b401666a50940c722bba762176a556f
<ide><path>src/Illuminate/Database/Eloquent/Model.php <ide> public function fill(array $attributes) <ide> $this->setAttribute($key, $value); <ide> } elseif ($totallyGuarded) { <ide> throw new MassAssignmentException(sprintf( <del> "Add [%s] to fillable property to allow mass assignment on [%s].", <add> 'Add [%s] to fillable property to allow mass assignment on [%s].', <ide> $key, get_class($this) <ide> )); <ide> } <ide><path>tests/Support/SupportCollectionTest.php <ide> public function testDiffUsingWithCollection() <ide> { <ide> $c = new Collection(['en_GB', 'fr', 'HR']); <ide> // demonstrate that diffKeys wont support case insensitivity <del> $this->assertEquals(['en_GB', 'fr', 'HR'], $c->diff(new Collection(['en_gb' , 'hr']))->values()->toArray()); <add> $this->assertEquals(['en_GB', 'fr', 'HR'], $c->diff(new Collection(['en_gb', 'hr']))->values()->toArray()); <ide> // allow for case insensitive difference <del> $this->assertEquals(['fr'], $c->diffUsing(new Collection(['en_gb' , 'hr']), 'strcasecmp')->values()->toArray()); <add> $this->assertEquals(['fr'], $c->diffUsing(new Collection(['en_gb', 'hr']), 'strcasecmp')->values()->toArray()); <ide> } <add> <ide> public function testDiffUsingWithNull() <ide> { <ide> $c = new Collection(['en_GB', 'fr', 'HR']);
2
Javascript
Javascript
restore change of signatures to opts hashes
c1ffb9ff9b827300d2fdcc7f1f9def81368f588e
<ide><path>test/doctool/test-doctool-html.js <ide> testData.forEach(function(item) { <ide> <ide> fs.readFile(item.file, 'utf8', common.mustCall(function(err, input) { <ide> assert.ifError(err); <del> html(input, 'foo', 'doc/template.html', <add> html( <add> { <add> input: input, <add> filename: 'foo', <add> template: 'doc/template.html', <add> nodeVersion: process.version, <add> }, <add> <ide> common.mustCall(function(err, output) { <ide> assert.ifError(err); <ide> <ide> const actual = output.replace(/\s/g, ''); <ide> // Assert that the input stripped of all whitespace contains the <ide> // expected list <ide> assert.notEqual(actual.indexOf(expected), -1); <del> })); <add> }) <add> ); <ide> })); <ide> }); <ide><path>tools/doc/generate.js <ide> function next(er, input) { <ide> break; <ide> <ide> case 'html': <del> require('./html.js')(input, inputFile, template, nodeVersion, <add> require('./html.js')( <add> { <add> input: input, <add> filename: inputFile, <add> template: template, <add> nodeVersion: nodeVersion, <add> }, <add> <ide> function(er, html) { <ide> if (er) throw er; <ide> console.log(html); <del> }); <add> } <add> ); <ide> break; <ide> <ide> default: <ide><path>tools/doc/html.js <ide> var gtocPath = path.resolve(path.join( <ide> var gtocLoading = null; <ide> var gtocData = null; <ide> <del>function toHTML(input, filename, template, nodeVersion, cb) { <del> if (typeof nodeVersion === 'function') { <del> cb = nodeVersion; <del> nodeVersion = null; <del> } <del> nodeVersion = nodeVersion || process.version; <add>/** <add> * opts: input, filename, template, nodeVersion. <add> */ <add>function toHTML(opts, cb) { <add> var template = opts.template; <add> var nodeVersion = opts.nodeVersion || process.version; <ide> <ide> if (gtocData) { <ide> return onGtocLoaded(); <ide> function toHTML(input, filename, template, nodeVersion, cb) { <ide> } <ide> <ide> function onGtocLoaded() { <del> var lexed = marked.lexer(input); <add> var lexed = marked.lexer(opts.input); <ide> fs.readFile(template, 'utf8', function(er, template) { <ide> if (er) return cb(er); <del> render(lexed, filename, template, nodeVersion, cb); <add> render({ <add> lexed: lexed, <add> filename: opts.filename, <add> template: template, <add> nodeVersion: nodeVersion, <add> }, cb); <ide> }); <ide> } <ide> } <ide> function toID(filename) { <ide> .replace(/-+/g, '-'); <ide> } <ide> <del>function render(lexed, filename, template, nodeVersion, cb) { <del> if (typeof nodeVersion === 'function') { <del> cb = nodeVersion; <del> nodeVersion = null; <del> } <del> <del> nodeVersion = nodeVersion || process.version; <add>/** <add> * opts: lexed, filename, template, nodeVersion. <add> */ <add>function render(opts, cb) { <add> var lexed = opts.lexed; <add> var filename = opts.filename; <add> var template = opts.template; <add> var nodeVersion = opts.nodeVersion || process.version; <ide> <ide> // get the section <ide> var section = getSection(lexed);
3
Java
Java
improve javadoc for testcontextbootstrapper
0b054f9fbd1e0fd818e62fcc8de05b2150814ee2
<ide><path>spring-test/src/main/java/org/springframework/test/context/TestContextBootstrapper.java <ide> import java.util.List; <ide> <ide> /** <del> * {@code TestContextBootstrapper} defines a strategy SPI for bootstrapping the <add> * {@code TestContextBootstrapper} defines the SPI for bootstrapping the <ide> * <em>Spring TestContext Framework</em>. <ide> * <del> * <p>A custom bootstrapping strategy can be configured for a test class via <del> * {@link BootstrapWith @BootstrapWith}, either directly or as a meta-annotation. <del> * See {@link org.springframework.test.context.web.WebAppConfiguration @WebAppConfiguration} <del> * for an example. <del> * <del> * <p>The {@link TestContextManager} uses a {@code TestContextBootstrapper} to <add> * <p>A {@code TestContextBootstrapper} is used by the {@link TestContextManager} to <ide> * {@linkplain #getTestExecutionListeners get the TestExecutionListeners} for the <ide> * current test and to {@linkplain #buildTestContext build the TestContext} that <ide> * it manages. <ide> * <add> * <h3>Configuration</h3> <add> * <add> * <p>A custom bootstrapping strategy can be configured for a test class (or <add> * test class hierarchy) via {@link BootstrapWith @BootstrapWith}, either <add> * directly or as a meta-annotation. See <add> * {@link org.springframework.test.context.web.WebAppConfiguration @WebAppConfiguration} <add> * for an example. <add> * <add> * <p>If a bootstrapper is not explicitly configured via {@code @BootstrapWith}, the <add> * {@link org.springframework.test.context.support.DefaultTestContextBootstrapper DefaultTestContextBootstrapper} <add> * will be used. <add> * <add> * <h3>Implementation Notes</h3> <add> * <ide> * <p>Concrete implementations must provide a {@code public} no-args constructor. <ide> * <ide> * <p><strong>WARNING</strong>: this SPI will likely change in the future in
1
Javascript
Javascript
use array.isarray in the loopbackport
438c0b28f212dbf68e695006b677716d5c18025e
<ide><path>src/display/api.js <ide> <ide> import { <ide> assert, createPromiseCapability, deprecated, getVerbosityLevel, <del> info, InvalidPDFException, isArray, isArrayBuffer, isInt, isSameOrigin, <add> info, InvalidPDFException, isArrayBuffer, isInt, isSameOrigin, <ide> loadJpegStream, MessageHandler, MissingPDFException, NativeImageDecoding, <ide> PageViewport, PasswordException, StatTimer, stringToBytes, <ide> UnexpectedResponseException, UnknownErrorException, Util, warn <ide> class LoopbackPort { <ide> cloned.set(value, result); <ide> return result; <ide> } <del> result = isArray(value) ? [] : {}; <add> result = Array.isArray(value) ? [] : {}; <ide> cloned.set(value, result); // adding to cache now for cyclic references <ide> // Cloning all value and object properties, however ignoring properties <ide> // defined via getter.
1
PHP
PHP
fix psalm errors from merge
cbf80ad4ecf281058dcd3cd22cee9a603b3279ca
<ide><path>src/Controller/ComponentRegistry.php <ide> public function __construct(?Controller $controller = null) <ide> /** <ide> * Get the controller associated with the collection. <ide> * <del> * @return \Cake\Controller\Controller|null Controller instance or null if not set. <add> * @return \Cake\Controller\Controller Controller instance or null if not set. <ide> */ <ide> public function getController(): Controller <ide> { <ide><path>src/Utility/CookieCryptTrait.php <ide> protected function _checkCipher(string $encrypt): void <ide> * @param string[]|string $values Values to decrypt <ide> * @param string|false $mode Encryption mode <ide> * @param string|null $key Used as the security salt if specified. <del> * @return string|string[] Decrypted values <add> * @return string|array Decrypted values <ide> */ <ide> protected function _decrypt($values, $mode, ?string $key = null) <ide> {
2
Javascript
Javascript
move resolution logic to shared file
17b2dcda78c5336ac2bc958a3a1b4c82446e60bb
<ide><path>packages/ember-routing/lib/helpers.js <add>require('ember-routing/helpers/shared'); <ide> require('ember-routing/helpers/link_to'); <ide> require('ember-routing/helpers/outlet'); <ide> require('ember-routing/helpers/render'); <ide><path>packages/ember-routing/lib/helpers/action.js <ide> require('ember-handlebars/helpers/view'); <ide> <ide> Ember.onLoad('Ember.Handlebars', function(Handlebars) { <ide> <del> var resolveParams = Ember.Handlebars.resolveParams, <add> var resolveParams = Ember.Router.resolveParams, <ide> isSimpleClick = Ember.ViewUtils.isSimpleClick; <ide> <ide> var EmberHandlebars = Ember.Handlebars, <ide> handlebarsGet = EmberHandlebars.get, <ide> SafeString = EmberHandlebars.SafeString, <ide> get = Ember.get, <del> a_slice = Array.prototype.slice, <del> map = Ember.ArrayPolyfills.map; <del> <del> function resolveAndUnwrap(context, params, options) { <del> var resolved = resolveParams(context, params, options); <del> return map.call(resolved, unwrap); <del> } <del> <del> function unwrap(object) { <del> if (Ember.ControllerMixin.detect(object)) { <del> return unwrap(get(object, 'model')); <del> } else { <del> return object; <del> } <del> } <add> a_slice = Array.prototype.slice; <ide> <ide> function args(options, actionName) { <ide> var ret = []; <ide> Ember.onLoad('Ember.Handlebars', function(Handlebars) { <ide> var types = options.options.types.slice(1), <ide> data = options.options.data; <ide> <del> return ret.concat(resolveAndUnwrap(options.context, options.params, { types: types, data: data })); <add> return ret.concat(resolveParams(options.context, options.params, { types: types, data: data })); <ide> } <ide> <ide> var ActionHelper = EmberHandlebars.ActionHelper = { <ide><path>packages/ember-routing/lib/helpers/shared.js <add>require('ember-routing/system/router'); <add> <add>Ember.onLoad('Ember.Handlebars', function() { <add> var handlebarsResolve = Ember.Handlebars.resolveParams, <add> map = Ember.ArrayPolyfills.map, <add> get = Ember.get; <add> <add> function resolveParams(context, params, options) { <add> var resolved = handlebarsResolve(context, params, options); <add> return map.call(resolved, unwrap); <add> } <add> <add> function unwrap(object) { <add> if (Ember.ControllerMixin.detect(object)) { <add> return unwrap(get(object, 'model')); <add> } else { <add> return object; <add> } <add> } <add> <add> Ember.Router.resolveParams = resolveParams; <add>});
3
Python
Python
fix some failing tests due to name-space issues
727434278079ab9e6f6c50c505f7372379ee4814
<ide><path>numpy/ma/tests/test_core.py <ide> def test_hardmask_again(self): <ide> def test_hardmask_oncemore_yay(self): <ide> "OK, yet another test of hardmask" <ide> "Make sure that harden_mask/soften_mask//unshare_mask retursn self" <del> a = ma.array([1,2,3], mask=[1, 0, 0]) <add> a = array([1,2,3], mask=[1, 0, 0]) <ide> b = a.harden_mask() <ide> assert_equal(a, b) <ide> b[0] = 0 <ide> assert_equal(a, b) <del> assert_equal(b, ma.array([1,2,3], mask=[1, 0, 0])) <add> assert_equal(b, array([1,2,3], mask=[1, 0, 0])) <ide> a = b.soften_mask() <ide> a[0] = 0 <ide> assert_equal(a, b) <del> assert_equal(b, ma.array([0,2,3], mask=[0, 0, 0])) <add> assert_equal(b, array([0,2,3], mask=[0, 0, 0])) <ide> <ide> <ide> def test_smallmask(self): <ide> def test_smallmask(self): <ide> <ide> def test_shrink_mask(self): <ide> "Tests .shrink_mask()" <del> a = ma.array([1,2,3], mask=[0, 0, 0]) <add> a = array([1,2,3], mask=[0, 0, 0]) <ide> b = a.shrink_mask() <ide> assert_equal(a, b) <ide> assert_equal(a.mask, nomask)
1
Javascript
Javascript
make response.settimeout() work
7b26322f6da2910e36febc318c8df249228dcea6
<ide><path>lib/_http_client.js <ide> function socketOnData(d) { <ide> socket.removeListener('end', socketOnEnd); <ide> socket.removeListener('drain', ondrain); <ide> <del> if (req.timeoutCb) <del> socket.removeListener('timeout', req.timeoutCb); <add> if (req.timeoutCb) socket.removeListener('timeout', req.timeoutCb); <add> socket.removeListener('timeout', responseOnTimeout); <ide> <ide> parser.finish(); <ide> freeParser(parser, req, socket); <ide> function parserOnIncomingClient(res, shouldKeepAlive) { <ide> // Add our listener first, so that we guarantee socket cleanup <ide> res.on('end', responseOnEnd); <ide> req.on('prefinish', requestOnPrefinish); <add> socket.on('timeout', responseOnTimeout); <ide> <ide> // If the user did not listen for the 'response' event, then they <ide> // can't possibly read the data, so we ._dump() it into the void <ide> function responseKeepAlive(req) { <ide> <ide> function responseOnEnd() { <ide> const req = this.req; <add> const socket = req.socket; <ide> <del> if (req.socket && req.timeoutCb) { <del> req.socket.removeListener('timeout', emitRequestTimeout); <add> if (socket) { <add> if (req.timeoutCb) socket.removeListener('timeout', emitRequestTimeout); <add> socket.removeListener('timeout', responseOnTimeout); <ide> } <ide> <ide> req._ended = true; <ide> <ide> if (!req.shouldKeepAlive) { <del> const socket = req.socket; <ide> if (socket.writable) { <ide> debug('AGENT socket.destroySoon()'); <ide> if (typeof socket.destroySoon === 'function') <ide> function responseOnEnd() { <ide> } <ide> } <ide> <add>function responseOnTimeout() { <add> const req = this._httpMessage; <add> if (!req) return; <add> const res = req.res; <add> if (!res) return; <add> res.emit('timeout'); <add>} <add> <ide> function requestOnPrefinish() { <ide> const req = this; <ide> <ide><path>test/parallel/test-http-client-response-timeout.js <add>'use strict'; <add>const common = require('../common'); <add>const http = require('http'); <add> <add>const server = http.createServer((req, res) => res.flushHeaders()); <add> <add>server.listen(common.mustCall(() => { <add> const req = <add> http.get({ port: server.address().port }, common.mustCall((res) => { <add> res.on('timeout', common.mustCall(() => req.destroy())); <add> res.setTimeout(1); <add> server.close(); <add> })); <add>})); <ide><path>test/parallel/test-http-client-timeout-option-listeners.js <ide> const options = { <ide> server.listen(0, options.host, common.mustCall(() => { <ide> options.port = server.address().port; <ide> doRequest(common.mustCall((numListeners) => { <del> assert.strictEqual(numListeners, 2); <add> assert.strictEqual(numListeners, 3); <ide> doRequest(common.mustCall((numListeners) => { <del> assert.strictEqual(numListeners, 2); <add> assert.strictEqual(numListeners, 3); <ide> server.close(); <ide> agent.destroy(); <ide> }));
3
Text
Text
fix incorrect link
4aececb645c041532b17eea50c94c0500d7be48f
<ide><path>docs/docs/05-reusable-components.md <ide> var MyComponent = React.createClass({ <ide> <ide> Components are the best way to reuse code in React, but sometimes very different components may share some common functionality. These are sometimes called [cross-cutting concerns](http://en.wikipedia.org/wiki/Cross-cutting_concern). React provides `mixins` to solve this problem. <ide> <del>One common use case is a component wanting to update itself on a time interval. It's easy to use `setInterval()`, but it's important to cancel your interval when you don't need it anymore to save memory. React provides [lifecycle methods](/react/docs/working-with-the-browser.html) that let you know when a component is about to be created or destroyed. Let's create a simple mixin that uses these methods to provide an easy `setInterval()` function that will automatically get cleaned up when your component is destroyed. <add>One common use case is a component wanting to update itself on a time interval. It's easy to use `setInterval()`, but it's important to cancel your interval when you don't need it anymore to save memory. React provides [lifecycle methods](/react/docs/component-specs.html#lifecycle-methods) that let you know when a component is about to be created or destroyed. Let's create a simple mixin that uses these methods to provide an easy `setInterval()` function that will automatically get cleaned up when your component is destroyed. <ide> <ide> ```javascript <ide> /** @jsx React.DOM */
1
Ruby
Ruby
fix comment about env overrides
9bc60b80b6e277050e750132bc775bdc3fb28017
<ide><path>Library/Homebrew/unittest.rb <ide> require 'keg' <ide> require 'utils' <ide> <del># these are defined in env.rb usually, but we don't want to break our actual <add># these are defined in bin/brew, but we don't want to break our actual <ide> # homebrew tree, and we do want to test everything :) <ide> HOMEBREW_PREFIX=Pathname.new '/tmp/testbrew/prefix' <ide> HOMEBREW_CACHE=HOMEBREW_PREFIX.parent+"cache"
1
Java
Java
fix issue with spel in mvc namespace
62f2858f7f6da9eb84366b3c5f4f693838d159f3
<ide><path>spring-webmvc/src/main/java/org/springframework/web/servlet/config/InterceptorsBeanDefinitionParser.java <ide> import org.springframework.beans.factory.config.BeanDefinition; <ide> import org.springframework.beans.factory.parsing.BeanComponentDefinition; <ide> import org.springframework.beans.factory.parsing.CompositeComponentDefinition; <add>import org.springframework.beans.factory.support.ManagedList; <ide> import org.springframework.beans.factory.support.RootBeanDefinition; <ide> import org.springframework.beans.factory.xml.BeanDefinitionParser; <ide> import org.springframework.beans.factory.xml.ParserContext; <ide> public BeanDefinition parse(Element element, ParserContext parserContext) { <ide> mappedInterceptorDef.setSource(parserContext.extractSource(interceptor)); <ide> mappedInterceptorDef.setRole(BeanDefinition.ROLE_INFRASTRUCTURE); <ide> <del> String[] includePatterns = null; <del> String[] excludePatterns = null; <add> ManagedList<String> includePatterns = null; <add> ManagedList<String> excludePatterns = null; <ide> Object interceptorBean; <ide> if ("interceptor".equals(interceptor.getLocalName())) { <ide> includePatterns = getIncludePatterns(interceptor, "mapping"); <ide> public BeanDefinition parse(Element element, ParserContext parserContext) { <ide> return null; <ide> } <ide> <del> private String[] getIncludePatterns(Element interceptor, String elementName) { <add> private ManagedList<String> getIncludePatterns(Element interceptor, String elementName) { <ide> List<Element> paths = DomUtils.getChildElementsByTagName(interceptor, elementName); <del> String[] patterns = new String[paths.size()]; <add> ManagedList<String> patterns = new ManagedList<String>(paths.size()); <ide> for (int i = 0; i < paths.size(); i++) { <del> patterns[i] = paths.get(i).getAttribute("path"); <add> patterns.add(paths.get(i).getAttribute("path")); <ide> } <ide> return patterns; <ide> } <ide><path>spring-webmvc/src/main/java/org/springframework/web/servlet/config/ResourcesBeanDefinitionParser.java <ide> <ide> import org.springframework.beans.factory.config.BeanDefinition; <ide> import org.springframework.beans.factory.parsing.BeanComponentDefinition; <add>import org.springframework.beans.factory.support.ManagedList; <ide> import org.springframework.beans.factory.support.ManagedMap; <ide> import org.springframework.beans.factory.support.RootBeanDefinition; <ide> import org.springframework.beans.factory.xml.BeanDefinitionParser; <ide> /** <ide> * {@link org.springframework.beans.factory.xml.BeanDefinitionParser} that parses a <ide> * {@code resources} element to register a {@link ResourceHttpRequestHandler}. <del> * Will also register a {@link SimpleUrlHandlerMapping} for mapping resource requests, <del> * and a {@link HttpRequestHandlerAdapter}. <add> * Will also register a {@link SimpleUrlHandlerMapping} for mapping resource requests, <add> * and a {@link HttpRequestHandlerAdapter}. <ide> * <ide> * @author Keith Donald <ide> * @author Jeremy Grelle <ide> class ResourcesBeanDefinitionParser implements BeanDefinitionParser { <ide> <ide> public BeanDefinition parse(Element element, ParserContext parserContext) { <ide> Object source = parserContext.extractSource(element); <del> <add> <ide> String resourceHandlerName = registerResourceHandler(parserContext, element, source); <ide> if (resourceHandlerName == null) { <ide> return null; <ide> } <del> <add> <ide> Map<String, String> urlMap = new ManagedMap<String, String>(); <ide> String resourceRequestPath = element.getAttribute("mapping"); <ide> if (!StringUtils.hasText(resourceRequestPath)) { <ide> parserContext.getReaderContext().error("The 'mapping' attribute is required.", parserContext.extractSource(element)); <ide> return null; <ide> } <ide> urlMap.put(resourceRequestPath, resourceHandlerName); <del> <add> <ide> RootBeanDefinition handlerMappingDef = new RootBeanDefinition(SimpleUrlHandlerMapping.class); <ide> handlerMappingDef.setSource(source); <ide> handlerMappingDef.setRole(BeanDefinition.ROLE_INFRASTRUCTURE); <ide> handlerMappingDef.getPropertyValues().add("urlMap", urlMap); <del> <add> <ide> String order = element.getAttribute("order"); <ide> // use a default of near-lowest precedence, still allowing for even lower precedence in other mappings <ide> handlerMappingDef.getPropertyValues().add("order", StringUtils.hasText(order) ? order : Ordered.LOWEST_PRECEDENCE - 1); <del> <add> <ide> String beanName = parserContext.getReaderContext().generateBeanName(handlerMappingDef); <ide> parserContext.getRegistry().registerBeanDefinition(beanName, handlerMappingDef); <del> parserContext.registerComponent(new BeanComponentDefinition(handlerMappingDef, beanName)); <add> parserContext.registerComponent(new BeanComponentDefinition(handlerMappingDef, beanName)); <ide> <del> // Ensure BeanNameUrlHandlerMapping (SPR-8289) and default HandlerAdapters are not "turned off" <add> // Ensure BeanNameUrlHandlerMapping (SPR-8289) and default HandlerAdapters are not "turned off" <ide> // Register HttpRequestHandlerAdapter <ide> MvcNamespaceUtils.registerDefaultComponents(parserContext, source); <ide> <ide> return null; <ide> } <del> <add> <ide> private String registerResourceHandler(ParserContext parserContext, Element element, Object source) { <ide> String locationAttr = element.getAttribute("location"); <ide> if (!StringUtils.hasText(locationAttr)) { <ide> parserContext.getReaderContext().error("The 'location' attribute is required.", parserContext.extractSource(element)); <ide> return null; <del> } <add> } <add> <add> ManagedList<String> locations = new ManagedList<String>(); <add> locations.addAll(StringUtils.commaDelimitedListToSet(locationAttr)); <ide> <ide> RootBeanDefinition resourceHandlerDef = new RootBeanDefinition(ResourceHttpRequestHandler.class); <ide> resourceHandlerDef.setSource(source); <ide> resourceHandlerDef.setRole(BeanDefinition.ROLE_INFRASTRUCTURE); <del> resourceHandlerDef.getPropertyValues().add("locations", StringUtils.commaDelimitedListToStringArray(locationAttr)); <add> resourceHandlerDef.getPropertyValues().add("locations", locations); <ide> <ide> String cacheSeconds = element.getAttribute("cache-period"); <ide> if (StringUtils.hasText(cacheSeconds)) { <ide> private String registerResourceHandler(ParserContext parserContext, Element elem <ide> <ide> String beanName = parserContext.getReaderContext().generateBeanName(resourceHandlerDef); <ide> parserContext.getRegistry().registerBeanDefinition(beanName, resourceHandlerDef); <del> parserContext.registerComponent(new BeanComponentDefinition(resourceHandlerDef, beanName)); <add> parserContext.registerComponent(new BeanComponentDefinition(resourceHandlerDef, beanName)); <ide> return beanName; <ide> } <ide>
2
Javascript
Javascript
add enabletransitiontracing feature flag
811634762a389bce81bdc145f84bdf247910b8dd
<ide><path>packages/shared/ReactFeatureFlags.js <ide> export const consoleManagedByDevToolsDuringStrictMode = true; <ide> <ide> // Only enabled in www builds <ide> export const enableUseMutableSource = false; <add> <add>export const enableTransitionTracing = false; <ide><path>packages/shared/forks/ReactFeatureFlags.native-fb.js <ide> export const enableCustomElementPropertySupport = false; <ide> export const consoleManagedByDevToolsDuringStrictMode = false; <ide> export const enableUseMutableSource = true; <ide> <add>export const enableTransitionTracing = false; <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/shared/forks/ReactFeatureFlags.native-oss.js <ide> export const enableCustomElementPropertySupport = false; <ide> export const consoleManagedByDevToolsDuringStrictMode = false; <ide> export const enableUseMutableSource = false; <ide> <add>export const enableTransitionTracing = false; <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/shared/forks/ReactFeatureFlags.test-renderer.js <ide> export const enableCustomElementPropertySupport = false; <ide> export const consoleManagedByDevToolsDuringStrictMode = false; <ide> export const enableUseMutableSource = false; <ide> <add>export const enableTransitionTracing = false; <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/shared/forks/ReactFeatureFlags.test-renderer.native.js <ide> export const enablePersistentOffscreenHostContainer = false; <ide> export const consoleManagedByDevToolsDuringStrictMode = false; <ide> export const enableUseMutableSource = false; <ide> <add>export const enableTransitionTracing = false; <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/shared/forks/ReactFeatureFlags.test-renderer.www.js <ide> export const consoleManagedByDevToolsDuringStrictMode = false; <ide> // Some www surfaces are still using this. Remove once they have been migrated. <ide> export const enableUseMutableSource = true; <ide> <add>export const enableTransitionTracing = false; <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/shared/forks/ReactFeatureFlags.testing.js <ide> export const enableCustomElementPropertySupport = false; <ide> export const consoleManagedByDevToolsDuringStrictMode = false; <ide> export const enableUseMutableSource = false; <ide> <add>export const enableTransitionTracing = false; <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/shared/forks/ReactFeatureFlags.testing.www.js <ide> export const consoleManagedByDevToolsDuringStrictMode = false; <ide> // Some www surfaces are still using this. Remove once they have been migrated. <ide> export const enableUseMutableSource = true; <ide> <add>export const enableTransitionTracing = false; <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/shared/forks/ReactFeatureFlags.www.js <ide> export const enableUseMutableSource = true; <ide> <ide> export const enableCustomElementPropertySupport = __EXPERIMENTAL__; <ide> <add>export const enableTransitionTracing = false; <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;
9
Mixed
Python
add more len() tests
1e8fe8efcfc499c85079659708f4afefe92ec66b
<ide><path>DIRECTORY.md <ide> * [Boyer Moore Search](https://github.com/TheAlgorithms/Python/blob/master/strings/boyer_moore_search.py) <ide> * [Check Pangram](https://github.com/TheAlgorithms/Python/blob/master/strings/check_pangram.py) <ide> * [Is Palindrome](https://github.com/TheAlgorithms/Python/blob/master/strings/is_palindrome.py) <add> * [Jaro Winkler](https://github.com/TheAlgorithms/Python/blob/master/strings/jaro_winkler.py) <ide> * [Knuth Morris Pratt](https://github.com/TheAlgorithms/Python/blob/master/strings/knuth_morris_pratt.py) <ide> * [Levenshtein Distance](https://github.com/TheAlgorithms/Python/blob/master/strings/levenshtein_distance.py) <ide> * [Lower](https://github.com/TheAlgorithms/Python/blob/master/strings/lower.py) <ide><path>data_structures/linked_list/circular_linked_list.py <ide> def __len__(self) -> int: <ide> >>> cll.append(1) <ide> >>> len(cll) <ide> 1 <add> >>> cll.prepend(0) <add> >>> len(cll) <add> 2 <add> >>> cll.delete_front() <add> >>> len(cll) <add> 1 <add> >>> cll.delete_rear() <add> >>> len(cll) <add> 0 <ide> """ <ide> return self.length <ide> <ide> def delete_front(self) -> None: <ide> >>> cll.delete_front() <ide> >>> print(f"{len(cll)}: {cll}") <ide> 1: <Node data=2> <add> >>> cll.delete_front() <add> >>> print(f"{len(cll)}: {cll}") <add> 0: Empty linked list <ide> """ <ide> if not self.head: <ide> raise IndexError("Deleting from an empty list") <ide> <ide> current_node = self.head <ide> <ide> if current_node.next_ptr == current_node: <del> self.head, self.length = None, 0 <add> self.head = None <ide> else: <ide> while current_node.next_ptr != self.head: <ide> current_node = current_node.next_ptr <ide> def delete_front(self) -> None: <ide> self.head = self.head.next_ptr <ide> <ide> self.length -= 1 <add> if not self.head: <add> assert self.length == 0 <ide> <ide> def delete_rear(self) -> None: <ide> """ <ide> def delete_rear(self) -> None: <ide> >>> cll.delete_rear() <ide> >>> print(f"{len(cll)}: {cll}") <ide> 1: <Node data=1> <add> >>> cll.delete_rear() <add> >>> print(f"{len(cll)}: {cll}") <add> 0: Empty linked list <ide> """ <ide> if not self.head: <ide> raise IndexError("Deleting from an empty list") <ide> <ide> temp_node, current_node = self.head, self.head <ide> <ide> if current_node.next_ptr == current_node: <del> self.head, self.length = None, 0 <add> self.head = None <ide> else: <ide> while current_node.next_ptr != self.head: <ide> temp_node = current_node <ide> def delete_rear(self) -> None: <ide> temp_node.next_ptr = current_node.next_ptr <ide> <ide> self.length -= 1 <add> if not self.head: <add> assert self.length == 0 <ide> <ide> <ide> if __name__ == "__main__": <ide><path>strings/jaro_winkler.py <ide> def get_matched_characters(_str1: str, _str2: str) -> str: <ide> matched.append(l) <ide> _str2 = f"{_str2[0:_str2.index(l)]} {_str2[_str2.index(l) + 1:]}" <ide> <del> return ''.join(matched) <add> return "".join(matched) <ide> <ide> # matching characters <ide> matching_1 = get_matched_characters(str1, str2) <ide> matching_2 = get_matched_characters(str2, str1) <ide> match_count = len(matching_1) <ide> <ide> # transposition <del> transpositions = len( <del> [(c1, c2) for c1, c2 in zip(matching_1, matching_2) if c1 != c2] <del> ) // 2 <add> transpositions = ( <add> len([(c1, c2) for c1, c2 in zip(matching_1, matching_2) if c1 != c2]) // 2 <add> ) <ide> <ide> if not match_count: <ide> jaro = 0.0 <ide> else: <del> jaro = 1 / 3 * ( <del> match_count / len(str1) <del> + match_count / len(str2) <del> + (match_count - transpositions) / match_count) <add> jaro = ( <add> 1 <add> / 3 <add> * ( <add> match_count / len(str1) <add> + match_count / len(str2) <add> + (match_count - transpositions) / match_count <add> ) <add> ) <ide> <ide> # common prefix up to 4 characters <ide> prefix_len = 0 <ide> def get_matched_characters(_str1: str, _str2: str) -> str: <ide> return jaro + 0.1 * prefix_len * (1 - jaro) <ide> <ide> <del>if __name__ == '__main__': <add>if __name__ == "__main__": <ide> import doctest <add> <ide> doctest.testmod() <ide> print(jaro_winkler("hello", "world"))
3
PHP
PHP
unify irregular rules and simply code
d2819137fe5fe10dc54b8ee7f281b3763877fe94
<ide><path>src/Utility/Inflector.php <ide> class Inflector { <ide> * <ide> * @var array <ide> */ <del> protected static $_plural = array( <del> 'rules' => array( <del> '/(s)tatus$/i' => '\1tatuses', <del> '/(quiz)$/i' => '\1zes', <del> '/^(ox)$/i' => '\1\2en', <del> '/([m|l])ouse$/i' => '\1ice', <del> '/(matr|vert|ind)(ix|ex)$/i' => '\1ices', <del> '/(x|ch|ss|sh)$/i' => '\1es', <del> '/([^aeiouy]|qu)y$/i' => '\1ies', <del> '/(hive)$/i' => '\1s', <del> '/(?:([^f])fe|([lre])f)$/i' => '\1\2ves', <del> '/sis$/i' => 'ses', <del> '/([ti])um$/i' => '\1a', <del> '/(p)erson$/i' => '\1eople', <del> '/(m)an$/i' => '\1en', <del> '/(c)hild$/i' => '\1hildren', <del> '/(buffal|tomat)o$/i' => '\1\2oes', <del> '/(alumn|bacill|cact|foc|fung|nucle|radi|stimul|syllab|termin|vir)us$/i' => '\1i', <del> '/us$/i' => 'uses', <del> '/(alias)$/i' => '\1es', <del> '/(ax|cris|test)is$/i' => '\1es', <del> '/s$/' => 's', <del> '/^$/' => '', <del> '/$/' => 's', <del> ), <del> 'irregular' => array( <del> 'atlas' => 'atlases', <del> 'beef' => 'beefs', <del> 'brief' => 'briefs', <del> 'brother' => 'brothers', <del> 'cafe' => 'cafes', <del> 'child' => 'children', <del> 'cookie' => 'cookies', <del> 'corpus' => 'corpuses', <del> 'cow' => 'cows', <del> 'ganglion' => 'ganglions', <del> 'genie' => 'genies', <del> 'genus' => 'genera', <del> 'graffito' => 'graffiti', <del> 'hoof' => 'hoofs', <del> 'loaf' => 'loaves', <del> 'man' => 'men', <del> 'money' => 'monies', <del> 'mongoose' => 'mongooses', <del> 'move' => 'moves', <del> 'mythos' => 'mythoi', <del> 'niche' => 'niches', <del> 'numen' => 'numina', <del> 'occiput' => 'occiputs', <del> 'octopus' => 'octopuses', <del> 'opus' => 'opuses', <del> 'ox' => 'oxen', <del> 'penis' => 'penises', <del> 'person' => 'people', <del> 'sex' => 'sexes', <del> 'soliloquy' => 'soliloquies', <del> 'testis' => 'testes', <del> 'trilby' => 'trilbys', <del> 'turf' => 'turfs', <del> 'potato' => 'potatoes', <del> 'hero' => 'heroes', <del> 'tooth' => 'teeth', <del> 'goose' => 'geese', <del> 'foot' => 'feet' <del> ) <del> ); <add> protected static $_plural = [ <add> '/(s)tatus$/i' => '\1tatuses', <add> '/(quiz)$/i' => '\1zes', <add> '/^(ox)$/i' => '\1\2en', <add> '/([m|l])ouse$/i' => '\1ice', <add> '/(matr|vert|ind)(ix|ex)$/i' => '\1ices', <add> '/(x|ch|ss|sh)$/i' => '\1es', <add> '/([^aeiouy]|qu)y$/i' => '\1ies', <add> '/(hive)$/i' => '\1s', <add> '/(?:([^f])fe|([lre])f)$/i' => '\1\2ves', <add> '/sis$/i' => 'ses', <add> '/([ti])um$/i' => '\1a', <add> '/(p)erson$/i' => '\1eople', <add> '/(m)an$/i' => '\1en', <add> '/(c)hild$/i' => '\1hildren', <add> '/(buffal|tomat)o$/i' => '\1\2oes', <add> '/(alumn|bacill|cact|foc|fung|nucle|radi|stimul|syllab|termin|vir)us$/i' => '\1i', <add> '/us$/i' => 'uses', <add> '/(alias)$/i' => '\1es', <add> '/(ax|cris|test)is$/i' => '\1es', <add> '/s$/' => 's', <add> '/^$/' => '', <add> '/$/' => 's', <add> ]; <ide> <ide> /** <ide> * Singular inflector rules <ide> * <ide> * @var array <ide> */ <del> protected static $_singular = array( <del> 'rules' => array( <del> '/(s)tatuses$/i' => '\1\2tatus', <del> '/^(.*)(menu)s$/i' => '\1\2', <del> '/(quiz)zes$/i' => '\\1', <del> '/(matr)ices$/i' => '\1ix', <del> '/(vert|ind)ices$/i' => '\1ex', <del> '/^(ox)en/i' => '\1', <del> '/(alias)(es)*$/i' => '\1', <del> '/(alumn|bacill|cact|foc|fung|nucle|radi|stimul|syllab|termin|viri?)i$/i' => '\1us', <del> '/([ftw]ax)es/i' => '\1', <del> '/(cris|ax|test)es$/i' => '\1is', <del> '/(shoe)s$/i' => '\1', <del> '/(o)es$/i' => '\1', <del> '/ouses$/' => 'ouse', <del> '/([^a])uses$/' => '\1us', <del> '/([m|l])ice$/i' => '\1ouse', <del> '/(x|ch|ss|sh)es$/i' => '\1', <del> '/(m)ovies$/i' => '\1\2ovie', <del> '/(s)eries$/i' => '\1\2eries', <del> '/([^aeiouy]|qu)ies$/i' => '\1y', <del> '/(tive)s$/i' => '\1', <del> '/(hive)s$/i' => '\1', <del> '/(drive)s$/i' => '\1', <del> '/([le])ves$/i' => '\1f', <del> '/([^rfoa])ves$/i' => '\1fe', <del> '/(^analy)ses$/i' => '\1sis', <del> '/(analy|diagno|^ba|(p)arenthe|(p)rogno|(s)ynop|(t)he)ses$/i' => '\1\2sis', <del> '/([ti])a$/i' => '\1um', <del> '/(p)eople$/i' => '\1\2erson', <del> '/(m)en$/i' => '\1an', <del> '/(c)hildren$/i' => '\1\2hild', <del> '/(n)ews$/i' => '\1\2ews', <del> '/eaus$/' => 'eau', <del> '/^(.*us)$/' => '\\1', <del> '/s$/i' => '' <del> ), <del> 'irregular' => array( <del> 'foes' => 'foe', <del> ) <del> ); <add> protected static $_singular = [ <add> '/(s)tatuses$/i' => '\1\2tatus', <add> '/^(.*)(menu)s$/i' => '\1\2', <add> '/(quiz)zes$/i' => '\\1', <add> '/(matr)ices$/i' => '\1ix', <add> '/(vert|ind)ices$/i' => '\1ex', <add> '/^(ox)en/i' => '\1', <add> '/(alias)(es)*$/i' => '\1', <add> '/(alumn|bacill|cact|foc|fung|nucle|radi|stimul|syllab|termin|viri?)i$/i' => '\1us', <add> '/([ftw]ax)es/i' => '\1', <add> '/(cris|ax|test)es$/i' => '\1is', <add> '/(shoe)s$/i' => '\1', <add> '/(o)es$/i' => '\1', <add> '/ouses$/' => 'ouse', <add> '/([^a])uses$/' => '\1us', <add> '/([m|l])ice$/i' => '\1ouse', <add> '/(x|ch|ss|sh)es$/i' => '\1', <add> '/(m)ovies$/i' => '\1\2ovie', <add> '/(s)eries$/i' => '\1\2eries', <add> '/([^aeiouy]|qu)ies$/i' => '\1y', <add> '/(tive)s$/i' => '\1', <add> '/(hive)s$/i' => '\1', <add> '/(drive)s$/i' => '\1', <add> '/([le])ves$/i' => '\1f', <add> '/([^rfoa])ves$/i' => '\1fe', <add> '/(^analy)ses$/i' => '\1sis', <add> '/(analy|diagno|^ba|(p)arenthe|(p)rogno|(s)ynop|(t)he)ses$/i' => '\1\2sis', <add> '/([ti])a$/i' => '\1um', <add> '/(p)eople$/i' => '\1\2erson', <add> '/(m)en$/i' => '\1an', <add> '/(c)hildren$/i' => '\1\2hild', <add> '/(n)ews$/i' => '\1\2ews', <add> '/eaus$/' => 'eau', <add> '/^(.*us)$/' => '\\1', <add> '/s$/i' => '' <add> ]; <add> <add>/** <add> * Irregular rules <add> * <add> * @var array <add> */ <add> protected static $_irregular = [ <add> 'atlas' => 'atlases', <add> 'beef' => 'beefs', <add> 'brief' => 'briefs', <add> 'brother' => 'brothers', <add> 'cafe' => 'cafes', <add> 'child' => 'children', <add> 'cookie' => 'cookies', <add> 'corpus' => 'corpuses', <add> 'cow' => 'cows', <add> 'ganglion' => 'ganglions', <add> 'genie' => 'genies', <add> 'genus' => 'genera', <add> 'graffito' => 'graffiti', <add> 'hoof' => 'hoofs', <add> 'loaf' => 'loaves', <add> 'man' => 'men', <add> 'money' => 'monies', <add> 'mongoose' => 'mongooses', <add> 'move' => 'moves', <add> 'mythos' => 'mythoi', <add> 'niche' => 'niches', <add> 'numen' => 'numina', <add> 'occiput' => 'occiputs', <add> 'octopus' => 'octopuses', <add> 'opus' => 'opuses', <add> 'ox' => 'oxen', <add> 'penis' => 'penises', <add> 'person' => 'people', <add> 'sex' => 'sexes', <add> 'soliloquy' => 'soliloquies', <add> 'testis' => 'testes', <add> 'trilby' => 'trilbys', <add> 'turf' => 'turfs', <add> 'potato' => 'potatoes', <add> 'hero' => 'heroes', <add> 'tooth' => 'teeth', <add> 'goose' => 'geese', <add> 'foot' => 'feet', <add> 'foe' => 'foes' <add> ]; <ide> <ide> /** <ide> * Words that should not be inflected <ide> public static function reset() { <ide> } <ide> <ide> /** <del> * Adds custom inflection $rules, of either 'plural', 'singular' or 'transliteration' $type. <add> * Adds custom inflection $rules, of either 'plural', 'singular', <add> * 'uninflected', 'irregular' or 'transliteration' $type. <ide> * <ide> * ### Usage: <ide> * <ide> * {{{ <del> * Inflector::rules('plural', array('/^(inflect)or$/i' => '\1ables')); <del> * Inflector::rules('plural', array( <del> * 'rules' => array('/^(inflect)ors$/i' => '\1ables'), <del> * 'irregular' => array('red' => 'redlings') <del> * )); <del> * Inflector::rules('uninflected', array('dontinflectme')); <del> * Inflector::rules('transliteration', array('/å/' => 'aa')); <add> * Inflector::rules('plural', ['/^(inflect)or$/i' => '\1ables']); <add> * Inflector::rules('irregular' => ['red' => 'redlings']); <add> * Inflector::rules('uninflected', ['dontinflectme']); <add> * Inflector::rules('transliteration', ['/å/' => 'aa']); <ide> * }}} <ide> * <ide> * @param string $type The type of inflection, either 'plural', 'singular', <ide> public static function reset() { <ide> public static function rules($type, $rules, $reset = false) { <ide> $var = '_' . $type; <ide> <del> switch ($type) { <del> case 'transliteration': <del> if ($reset) { <del> static::$_transliteration = $rules; <del> } else { <del> static::$_transliteration = $rules + static::$_transliteration; <del> } <del> break; <del> <del> case 'uninflected': <del> if ($reset) { <del> static::$_uninflected = $rules; <del> } else { <del> static::$_uninflected = array_merge( <del> $rules, <del> static::$_transliteration <del> ); <del> } <del> break; <del> <del> default: <del> foreach ($rules as $rule => $pattern) { <del> if (!is_array($pattern)) { <del> continue; <del> } <del> if ($reset) { <del> static::${$var}[$rule] = $pattern; <del> } else { <del> static::${$var}[$rule] = $pattern + static::${$var}[$rule]; <del> } <del> unset($rules[$rule], static::${$var}['cache' . ucfirst($rule)]); <del> if (isset(static::${$var}['merged'][$rule])) { <del> unset(static::${$var}['merged'][$rule]); <del> } <del> if ($type === 'plural') { <del> static::$_cache['pluralize'] = static::$_cache['tableize'] = array(); <del> } elseif ($type === 'singular') { <del> static::$_cache['singularize'] = array(); <del> } <del> } <del> static::${$var}['rules'] = $rules + static::${$var}['rules']; <add> if ($reset) { <add> static::${$var} = $rules; <add> } elseif ($type === 'uninflected') { <add> static::$_uninflected = array_merge( <add> $rules, <add> static::$_uninflected <add> ); <add> } else { <add> static::${$var} = $rules + static::${$var}; <ide> } <add> <add> static::$_cache = []; <ide> } <ide> <ide> /** <ide> public static function pluralize($word) { <ide> return static::$_cache['pluralize'][$word]; <ide> } <ide> <del> if (!isset(static::$_plural['merged']['irregular'])) { <del> static::$_plural['merged']['irregular'] = static::$_plural['irregular']; <del> } <del> <del> if (!isset(static::$_plural['cacheIrregular'])) { <del> static::$_plural['cacheIrregular'] = '(?:' . implode('|', array_keys(static::$_plural['merged']['irregular'])) . ')'; <add> if (!isset(static::$_cache['irregular']['pluralize'])) { <add> static::$_cache['irregular']['pluralize'] = '(?:' . implode('|', array_keys(static::$_irregular)) . ')'; <ide> } <ide> <del> if (preg_match('/(.*)\\b(' . static::$_plural['cacheIrregular'] . ')$/i', $word, $regs)) { <del> static::$_cache['pluralize'][$word] = $regs[1] . substr($word, 0, 1) . substr(static::$_plural['merged']['irregular'][strtolower($regs[2])], 1); <add> if (preg_match('/(.*)\\b(' . static::$_cache['irregular']['pluralize'] . ')$/i', $word, $regs)) { <add> static::$_cache['pluralize'][$word] = $regs[1] . substr($word, 0, 1) . <add> substr(static::$_irregular[strtolower($regs[2])], 1); <ide> return static::$_cache['pluralize'][$word]; <ide> } <ide> <ide> public static function pluralize($word) { <ide> return $word; <ide> } <ide> <del> foreach (static::$_plural['rules'] as $rule => $replacement) { <add> foreach (static::$_plural as $rule => $replacement) { <ide> if (preg_match($rule, $word)) { <ide> static::$_cache['pluralize'][$word] = preg_replace($rule, $replacement, $word); <ide> return static::$_cache['pluralize'][$word]; <ide> public static function singularize($word) { <ide> return static::$_cache['singularize'][$word]; <ide> } <ide> <del> if (!isset(static::$_singular['merged']['irregular'])) { <del> static::$_singular['merged']['irregular'] = array_merge( <del> static::$_singular['irregular'], <del> array_flip(static::$_plural['irregular']) <del> ); <add> if (!isset(static::$_cache['irregular']['singular'])) { <add> static::$_cache['irregular']['singular'] = '(?:' . implode('|', static::$_irregular) . ')'; <ide> } <ide> <del> if (!isset(static::$_singular['cacheIrregular'])) { <del> static::$_singular['cacheIrregular'] = '(?:' . implode('|', array_keys(static::$_singular['merged']['irregular'])) . ')'; <del> } <del> <del> if (preg_match('/(.*)\\b(' . static::$_singular['cacheIrregular'] . ')$/i', $word, $regs)) { <del> static::$_cache['singularize'][$word] = $regs[1] . substr($word, 0, 1) . substr(static::$_singular['merged']['irregular'][strtolower($regs[2])], 1); <add> if (preg_match('/(.*)\\b(' . static::$_cache['irregular']['singular'] . ')$/i', $word, $regs)) { <add> static::$_cache['singularize'][$word] = $regs[1] . substr($word, 0, 1) . <add> substr(array_search(strtolower($regs[2]), static::$_irregular), 1); <ide> return static::$_cache['singularize'][$word]; <ide> } <ide> <ide> public static function singularize($word) { <ide> return $word; <ide> } <ide> <del> foreach (static::$_singular['rules'] as $rule => $replacement) { <add> foreach (static::$_singular as $rule => $replacement) { <ide> if (preg_match($rule, $word)) { <ide> static::$_cache['singularize'][$word] = preg_replace($rule, $replacement, $word); <ide> return static::$_cache['singularize'][$word]; <ide> public static function slug($string, $replacement = '_') { <ide> sprintf('/^[%s]+|[%s]+$/', $quotedReplacement, $quotedReplacement) => '', <ide> ); <ide> <del> $string = str_replace(array_keys(static::$_transliteration), array_values(static::$_transliteration), $string); <add> $string = str_replace( <add> array_keys(static::$_transliteration), <add> array_values(static::$_transliteration), <add> $string <add> ); <ide> return preg_replace(array_keys($map), array_values($map), $string); <ide> } <ide> <ide><path>tests/TestCase/Utility/InflectorTest.php <ide> public function testCustomPluralRule() { <ide> $this->assertEquals(Inflector::pluralize('custom'), 'customizables'); <ide> $this->assertEquals(Inflector::pluralize('uninflectable'), 'uninflectable'); <ide> <del> Inflector::reset(); <del> Inflector::rules('plural', array( <del> 'rules' => array('/^(alert)$/i' => '\1ables'), <del> 'irregular' => array('amaze' => 'amazable', 'phone' => 'phonezes') <del> )); <add> Inflector::rules('plural', array('/^(alert)$/i' => '\1ables')); <add> Inflector::rules('irregular', array('amaze' => 'amazable', 'phone' => 'phonezes')); <ide> Inflector::rules('uninflected', array('noflect', 'abtuse')); <ide> $this->assertEquals(Inflector::pluralize('noflect'), 'noflect'); <ide> $this->assertEquals(Inflector::pluralize('abtuse'), 'abtuse'); <ide> public function testCustomSingularRule() { <ide> $this->assertEquals(Inflector::singularize('epler'), 'eple'); <ide> $this->assertEquals(Inflector::singularize('jenter'), 'jente'); <ide> <del> Inflector::rules('singular', array( <del> 'rules' => array('/^(bil)er$/i' => '\1', '/^(inflec|contribu)tors$/i' => '\1ta'), <del> 'irregular' => array('spins' => 'spinor') <del> )); <add> Inflector::rules('singular', array('/^(bil)er$/i' => '\1', '/^(inflec|contribu)tors$/i' => '\1ta')); <add> Inflector::rules('irregular', array('spinor' => 'spins')); <ide> <add> $this->assertEquals(Inflector::singularize('spins'), 'spinor'); <ide> $this->assertEquals(Inflector::singularize('inflectors'), 'inflecta'); <ide> $this->assertEquals(Inflector::singularize('contributors'), 'contributa'); <del> $this->assertEquals(Inflector::singularize('spins'), 'spinor'); <ide> $this->assertEquals(Inflector::singularize('singulars'), 'singulars'); <ide> } <ide> <ide> public function testRulesClearsCaches() { <ide> $this->assertEquals(Inflector::tableize('Banana'), 'bananas'); <ide> $this->assertEquals(Inflector::pluralize('Banana'), 'Bananas'); <ide> <del> Inflector::rules('singular', array( <del> 'rules' => array('/(.*)nas$/i' => '\1zzz') <del> )); <add> Inflector::rules('singular', array('/(.*)nas$/i' => '\1zzz')); <ide> $this->assertEquals('Banazzz', Inflector::singularize('Bananas'), 'Was inflected with old rules.'); <ide> <del> Inflector::rules('plural', array( <del> 'rules' => array('/(.*)na$/i' => '\1zzz'), <del> 'irregular' => array('corpus' => 'corpora') <del> )); <add> Inflector::rules('plural', array('/(.*)na$/i' => '\1zzz')); <add> Inflector::rules('irregular', array('corpus' => 'corpora')); <ide> $this->assertEquals(Inflector::pluralize('Banana'), 'Banazzz', 'Was inflected with old rules.'); <ide> $this->assertEquals(Inflector::pluralize('corpus'), 'corpora', 'Was inflected with old irregular form.'); <ide> } <ide> public function testCustomRuleWithReset() { <ide> $uninflected = array('atlas', 'lapis', 'onibus', 'pires', 'virus', '.*x'); <ide> $pluralIrregular = array('as' => 'ases'); <ide> <del> Inflector::rules('singular', array( <del> 'rules' => array('/^(.*)(a|e|o|u)is$/i' => '\1\2l') <del> ), true); <del> <del> Inflector::rules('plural', array( <del> 'rules' => array('/^(.*)(a|e|o|u)l$/i' => '\1\2is'), <del> 'irregular' => $pluralIrregular <del> ), true); <del> <add> Inflector::rules('singular', array('/^(.*)(a|e|o|u)is$/i' => '\1\2l'), true); <add> Inflector::rules('plural', array('/^(.*)(a|e|o|u)l$/i' => '\1\2is'), true); <ide> Inflector::rules('uninflected', $uninflected, true); <add> Inflector::rules('irregular', $pluralIrregular, true); <ide> <ide> $this->assertEquals(Inflector::pluralize('Alcool'), 'Alcoois'); <ide> $this->assertEquals(Inflector::pluralize('Atlas'), 'Atlas');
2
Javascript
Javascript
remove unnecessary extra init steps
1934358663ad16773082a44974da91f0be78b4e3
<ide><path>src/core/core.controller.js <ide> module.exports = function(Chart) { <ide> me.resize(true); <ide> } <ide> <del> // Make sure controllers are built first so that each dataset is bound to an axis before the scales <del> // are built <add> // Make sure scales have IDs and are built before we build any controllers. <ide> me.ensureScalesHaveIDs(); <del> me.buildOrUpdateControllers(); <ide> me.buildScales(); <del> me.updateLayout(); <del> me.resetElements(); <ide> me.initToolTip(); <ide> me.update(); <ide> <ide> module.exports = function(Chart) { <ide> Chart.scaleService.addScalesToLayout(this); <ide> }, <ide> <del> updateLayout: function() { <del> Chart.layoutService.update(this, this.chart.width, this.chart.height); <del> }, <del> <ide> buildOrUpdateControllers: function() { <ide> var me = this; <ide> var types = [];
1
Ruby
Ruby
add missing test for blob#purge
267fdcc4a4de0675fb4fffdbc1b711b2146a6ea6
<ide><path>activestorage/test/models/blob_test.rb <ide> class ActiveStorage::BlobTest < ActiveSupport::TestCase <ide> end <ide> end <ide> <add> test "purge removes from external service" do <add> blob = create_blob <add> <add> blob.purge <add> assert_not ActiveStorage::Blob.service.exist?(blob.key) <add> end <add> <ide> private <ide> def expected_url_for(blob, disposition: :inline) <ide> query_string = { content_type: blob.content_type, disposition: disposition }.to_param
1
Python
Python
add s3_log_folder config option
dc1d9db66a36d28db2ca850ffe62833a2e81a18c
<ide><path>airflow/configuration.py <ide> class AirflowConfigException(Exception): <ide> 'plugins_folder': None, <ide> 'security': None, <ide> 'donot_pickle': False, <add> 's3_log_folder': '' <ide> }, <ide> 'webserver': { <ide> 'base_url': 'http://localhost:8080', <ide> class AirflowConfigException(Exception): <ide> # subfolder in a code repository <ide> dags_folder = {AIRFLOW_HOME}/dags <ide> <del># The folder where airflow should store its log files <del># For S3, use the full URL to the base folder (starting with "s3://...") <add># The folder where airflow should store its log files. This location <ide> base_log_folder = {AIRFLOW_HOME}/logs <add># An S3 location can be provided for log backups <add># For S3, use the full URL to the base folder (starting with "s3://...") <add>s3_log_folder = None <ide> <ide> # The executor class that airflow should use. Choices include <ide> # SequentialExecutor, LocalExecutor, CeleryExecutor
1
PHP
PHP
remove dead code from event tests
3a4ba41752327656702de1a30fc4cd48073f05ab
<ide><path>tests/Events/EventsDispatcherTest.php <ide> public function handle() <ide> } <ide> } <ide> <del>class TestDispatcherQueuedHandlerCustomQueue implements ShouldQueue <del>{ <del> public function handle() <del> { <del> // <del> } <del> <del> public function queue($queue, $handler, array $payload) <del> { <del> $queue->push($handler, $payload); <del> } <del>} <del> <ide> class ExampleEvent <ide> { <ide> //
1
Mixed
Javascript
expose original console
19795d83833de7489afec583f8773ee9c0452f70
<ide><path>doc/api/inspector.md <ide> started. <ide> If wait is `true`, will block until a client has connected to the inspect port <ide> and flow control has been passed to the debugger client. <ide> <add>### inspector.console <add> <add>An object to send messages to the remote inspector console. <add> <add>```js <add>require('inspector').console.log('a message'); <add>``` <add> <add>The inspector console does not have API parity with Node.js <add>console. <add> <ide> ### inspector.close() <ide> <ide> Deactivate the inspector. Blocks until there are no active connections. <ide><path>lib/inspector.js <ide> const { <ide> } = require('internal/errors').codes; <ide> const util = require('util'); <ide> const { Connection, open, url } = process.binding('inspector'); <add>const { originalConsole } = require('internal/process/per_thread'); <ide> <ide> if (!Connection || !require('internal/worker').isMainThread) <ide> throw new ERR_INSPECTOR_NOT_AVAILABLE(); <ide> module.exports = { <ide> open: (port, host, wait) => open(port, host, !!wait), <ide> close: process._debugEnd, <ide> url: url, <add> console: originalConsole, <ide> Session <ide> }; <ide><path>lib/internal/bootstrap/node.js <ide> <ide> const browserGlobals = !process._noBrowserGlobals; <ide> if (browserGlobals) { <add> // we are setting this here to foward it to the inspector later <add> perThreadSetup.originalConsole = global.console; <ide> setupGlobalTimeouts(); <ide> setupGlobalConsole(); <ide> setupGlobalURL(); <ide><path>test/common/inspector-helper.js <ide> const fixtures = require('../common/fixtures'); <ide> const { spawn } = require('child_process'); <ide> const { parse: parseURL } = require('url'); <ide> const { getURLFromFilePath } = require('internal/url'); <add>const { EventEmitter } = require('events'); <ide> <ide> const _MAINSCRIPT = fixtures.path('loop.js'); <ide> const DEBUG = false; <ide> class InspectorSession { <ide> } <ide> } <ide> <del>class NodeInstance { <add>class NodeInstance extends EventEmitter { <ide> constructor(inspectorFlags = ['--inspect-brk=0'], <ide> scriptContents = '', <ide> scriptFile = _MAINSCRIPT) { <add> super(); <add> <ide> this._scriptPath = scriptFile; <ide> this._script = scriptFile ? null : scriptContents; <ide> this._portCallback = null; <ide> class NodeInstance { <ide> this._unprocessedStderrLines = []; <ide> <ide> this._process.stdout.on('data', makeBufferingDataCallback( <del> (line) => console.log('[out]', line))); <add> (line) => { <add> this.emit('stdout', line); <add> console.log('[out]', line); <add> })); <ide> <ide> this._process.stderr.on('data', makeBufferingDataCallback( <ide> (message) => this.onStderrLine(message))); <ide><path>test/sequential/test-inspector-console.js <add>// Flags: --expose-internals <add>'use strict'; <add> <add>const common = require('../common'); <add>common.skipIfInspectorDisabled(); <add> <add>const { NodeInstance } = require('../common/inspector-helper.js'); <add>const assert = require('assert'); <add> <add>async function runTest() { <add> const script = 'require(\'inspector\').console.log(\'hello world\');'; <add> const child = new NodeInstance('--inspect-brk=0', script, ''); <add> <add> let out = ''; <add> child.on('stdout', (line) => out += line); <add> <add> const session = await child.connectInspectorSession(); <add> <add> const commands = [ <add> { 'method': 'Runtime.enable' }, <add> { 'method': 'Runtime.runIfWaitingForDebugger' } <add> ]; <add> <add> session.send(commands); <add> <add> const msg = await session.waitForNotification('Runtime.consoleAPICalled'); <add> <add> assert.strictEqual(msg.params.type, 'log'); <add> assert.deepStrictEqual(msg.params.args, [{ <add> type: 'string', <add> value: 'hello world' <add> }]); <add> assert.strictEqual(out, ''); <add> <add> session.disconnect(); <add>} <add> <add>common.crashOnUnhandledRejection(); <add>runTest();
5
Python
Python
remove error message if the server is not running
8069133fe95dde34ca8e3e74310df1466bf74733
<ide><path>glances/stats.py <ide> def _load_plugin(self, plugin_script, args=None, config=None): <ide> else: <ide> self._plugins[name] = plugin.Plugin(args=args) <ide> # Set the disable_<name> to False by default <del> setattr(self.args, <del> 'disable_' + name, <del> getattr(self.args, 'disable_' + name, False)) <add> if self.args is not None: <add> setattr(self.args, <add> 'disable_' + name, <add> getattr(self.args, 'disable_' + name, False)) <ide> except Exception as e: <ide> # If a plugin can not be log, display a critical message <ide> # on the console but do not crash
1
Text
Text
redirect morphnet project to the new repo.
75a3b2f6b59fae11136102ebb1027abc73cbc6ea
<ide><path>research/morph_net/README.md <del># MorphNet: Fast & Simple Resource-Constrained Structure Learning of Deep Networks <add># MorphNet project has moved to https://github.com/google-research/morph-net. <ide> <del>[TOC] <del> <del>## What is MorphNet? <del> <del>MorphNet is a method for learning deep network structure during training. The <del>key principle is continuous relaxation of the network-structure learning <del>problem. Specifically, we use regularizers that induce sparsity in the space of <del>activations of the network. The regularizers can be tailored to target the <del>consumption of specific resources by the network, such as FLOPs or model size. <del>When such a regularizer is added to the training loss and their sum is <del>minimized via stochastic gradient descent or a similar optimizer, the learning <del>problem becomes also a constrained optimization of the structure of the network, <del>under the constraint represented by the regularizer. The method is described in <del>detail in the [this paper](https://arxiv.org/abs/1711.06798), to appear in [CVPR <del>2018](http://cvpr2018.thecvf.com/). <del> <del>## Adding a MorphNet regularizer to your training code <del> <del>Your interaction with the MorphNet codebase will most likely be through <del>subclasses of `NetworkRegularizer`. Each subclass represents a resource that we <del>wish to target/constrain when optimizing the network. The MorphNet package <del>provides several `NetworkRegularizer`s in the `network_regularizers` directory, <del>as well as a framework for writing your own. The framework is described in <del>detail [here](g3doc/regularizers_framework.md). The interface of <del>`NetworkRegularizer` is given <del>[here](g3doc/regularizers_framework.md?#network-regularizers). <del> <del>To apply a `NetworkRegularizer` to your network, your code would look similar to <del>the example below. The example refers to a specific type of `NetworkRegularizer` <del>that targets FLOPs, and to make the discussion simpler we henceforth restrict it <del>to this case, but generalization to an arbitrary constrained resource and an <del>arbitrary regularization method that targets that resource is straightforward. <del> <del>```python <del>my_gamma_threshold = 1e-3 <del>regularizer_strength = 1e-9 <del>network_reg = network_regularizers.GammaFlopsRegularizer( <del> [my_network_output.op], my_gamma_threshold) <del>my_training_loss += regularizer_strength * network_reg.get_regularization_term() <del>tf.summary.scalar('FLOPs', network_reg.get_cost() <del>``` <del> <del>Once you start your training, your TensorBoard will display the effective FLOP <del>count of the model. "Effective" is the sense that as activations are zeroed out <del>by the regularizer, their impact on the FLOP count is discounted. <del> <del>![TensorBoardDisplayOfFlops](g3doc/tensorboard.png "Example of the TensorBoard <del>display of the resource regularized by MorphNet.") <del> <del>The larger the `regularizer_strength`, the smaller the effective FLOP count to <del>which the network will converge. If `regularizer_strength` is large enough, the <del>FLOP count will collapse to zero, whereas if it is small enough, the FLOP count <del>will remain at its initial value and the network structure will not vary. <del>`regularizer_strength` is your knob to control where you want to be on the <del>price-performance curve. The `my_gamma_threshold` parameter is used for <del>determining when an activation is alive. It is described in more detail <del>[here](framework/README.md?#the-opregularizer-interface), including <del>an explanation for how to tune it. <del> <del>## Extracting the architecture learned by MorphNet <del> <del>One way to extract the structure is querying the `network_reg` object created <del>above. To query which activations in a given op were kept alive (as opposed to <del>removed) by MorphNet, your code would look similar to <del> <del>```python <del>alive = sess.run(network_reg.opreg_manager.get_regularizer(op).alive_vector) <del>``` <del> <del>where `op` is the tensorflow op in question, and `sess` is a tf.Session object. <del>The result is a vector of booleans, designating which activations were kept <del>alive (more details can be found <del>[here](framework/README.md?#the-opregularizer-interface)). Typically <del>one would be interested in the number of alive activations, which can be <del>obtained by counting the `True` values in `alive`. Looping over all convolutions <del>and / or fully connected layers (as `op`) is typically sufficient to extract the <del>full structure learned by MorphNet. <del> <del>## Maintainers <del> <del>* Elad Eban <del>* Ariel Gordon, github: [gariel-google](https://github.com/gariel-google). <add>**This directory contains the deprecated version of MorphNet. Please use the [new repo](https://github.com/google-research/morph-net).**
1
Javascript
Javascript
remove test messages for assert.strictequal
f4cab35dd88da512ddc2c82dcb6eda8e3db85774
<ide><path>test/parallel/test-crypto-cipher-decipher.js <ide> function testCipher1(key) { <ide> let txt = decipher.update(ciph, 'hex', 'utf8'); <ide> txt += decipher.final('utf8'); <ide> <del> assert.strictEqual(txt, plaintext, 'encryption and decryption'); <add> assert.strictEqual(txt, plaintext); <ide> <ide> // streaming cipher interface <ide> // NB: In real life, it's not guaranteed that you can get all of it <ide> function testCipher1(key) { <ide> dStream.end(ciph); <ide> txt = dStream.read().toString('utf8'); <ide> <del> assert.strictEqual(txt, plaintext, 'encryption and decryption with streams'); <add> assert.strictEqual(txt, plaintext); <ide> } <ide> <ide> <ide> function testCipher2(key) { <ide> let txt = decipher.update(ciph, 'base64', 'utf8'); <ide> txt += decipher.final('utf8'); <ide> <del> assert.strictEqual(txt, plaintext, 'encryption and decryption with Base64'); <add> assert.strictEqual(txt, plaintext); <ide> } <ide> <ide> testCipher1('MySecretKey123'); <ide> testCipher2(Buffer.from('0123456789abcdef')); <ide> let txt; <ide> assert.doesNotThrow(() => txt = decipher.update(ciph, 'base64', 'ucs2')); <ide> assert.doesNotThrow(() => txt += decipher.final('ucs2')); <del> assert.strictEqual(txt, plaintext, 'decrypted result in ucs2'); <add> assert.strictEqual(txt, plaintext); <ide> <ide> decipher = crypto.createDecipher('aes192', key); <ide> assert.doesNotThrow(() => txt = decipher.update(ciph, 'base64', 'ucs-2')); <ide> assert.doesNotThrow(() => txt += decipher.final('ucs-2')); <del> assert.strictEqual(txt, plaintext, 'decrypted result in ucs-2'); <add> assert.strictEqual(txt, plaintext); <ide> <ide> decipher = crypto.createDecipher('aes192', key); <ide> assert.doesNotThrow(() => txt = decipher.update(ciph, 'base64', 'utf-16le')); <ide> assert.doesNotThrow(() => txt += decipher.final('utf-16le')); <del> assert.strictEqual(txt, plaintext, 'decrypted result in utf-16le'); <add> assert.strictEqual(txt, plaintext); <ide> } <ide> <ide> // setAutoPadding/setAuthTag/setAAD should return `this`
1
Ruby
Ruby
fix a fragile test on `action_view/render`
243e6e4b2a53253d5ca734415564c419c5632f12
<ide><path>actionview/test/template/render_test.rb <ide> def setup_view(paths) <ide> <ide> def test_render_without_options <ide> e = assert_raises(ArgumentError) { @view.render() } <del> assert_match "You invoked render but did not give any of :partial, :template, :inline, :file or :text option.", e.message <add> assert_match(/You invoked render but did not give any of (.+) option./, e.message) <ide> end <ide> <ide> def test_render_file
1
Go
Go
apply context changes to the client
fe53be4e1785ab4d8cadf246e5f2de419f337adc
<ide><path>api/client/build.go <ide> import ( <ide> "runtime" <ide> "strings" <ide> <add> "golang.org/x/net/context" <add> <ide> "github.com/docker/docker/api" <ide> "github.com/docker/docker/builder/dockerignore" <ide> Cli "github.com/docker/docker/cli" <ide> func (cli *DockerCli) CmdBuild(args ...string) error { <ide> cmd.ParseFlags(args, true) <ide> <ide> var ( <del> context io.ReadCloser <del> err error <add> ctx io.ReadCloser <add> err error <ide> ) <ide> <ide> specifiedContext := cmd.Arg(0) <ide> func (cli *DockerCli) CmdBuild(args ...string) error { <ide> <ide> switch { <ide> case specifiedContext == "-": <del> context, relDockerfile, err = getContextFromReader(cli.in, *dockerfileName) <add> ctx, relDockerfile, err = getContextFromReader(cli.in, *dockerfileName) <ide> case urlutil.IsGitURL(specifiedContext): <ide> tempDir, relDockerfile, err = getContextFromGitURL(specifiedContext, *dockerfileName) <ide> case urlutil.IsURL(specifiedContext): <del> context, relDockerfile, err = getContextFromURL(progBuff, specifiedContext, *dockerfileName) <add> ctx, relDockerfile, err = getContextFromURL(progBuff, specifiedContext, *dockerfileName) <ide> default: <ide> contextDir, relDockerfile, err = getContextFromLocalDir(specifiedContext, *dockerfileName) <ide> } <ide> func (cli *DockerCli) CmdBuild(args ...string) error { <ide> contextDir = tempDir <ide> } <ide> <del> if context == nil { <add> if ctx == nil { <ide> // And canonicalize dockerfile name to a platform-independent one <ide> relDockerfile, err = archive.CanonicalTarNameForPath(relDockerfile) <ide> if err != nil { <ide> func (cli *DockerCli) CmdBuild(args ...string) error { <ide> includes = append(includes, ".dockerignore", relDockerfile) <ide> } <ide> <del> context, err = archive.TarWithOptions(contextDir, &archive.TarOptions{ <add> ctx, err = archive.TarWithOptions(contextDir, &archive.TarOptions{ <ide> Compression: archive.Uncompressed, <ide> ExcludePatterns: excludes, <ide> IncludeFiles: includes, <ide> func (cli *DockerCli) CmdBuild(args ...string) error { <ide> if isTrusted() { <ide> // Wrap the tar archive to replace the Dockerfile entry with the rewritten <ide> // Dockerfile which uses trusted pulls. <del> context = replaceDockerfileTarWrapper(context, relDockerfile, cli.trustedReference, &resolvedTags) <add> ctx = replaceDockerfileTarWrapper(ctx, relDockerfile, cli.trustedReference, &resolvedTags) <ide> } <ide> <ide> // Setup an upload progress bar <ide> progressOutput := streamformatter.NewStreamFormatter().NewProgressOutput(progBuff, true) <ide> <del> var body io.Reader = progress.NewProgressReader(context, progressOutput, 0, "", "Sending build context to Docker daemon") <add> var body io.Reader = progress.NewProgressReader(ctx, progressOutput, 0, "", "Sending build context to Docker daemon") <ide> <ide> var memory int64 <ide> if *flMemoryString != "" { <ide> func (cli *DockerCli) CmdBuild(args ...string) error { <ide> AuthConfigs: cli.configFile.AuthConfigs, <ide> } <ide> <del> response, err := cli.client.ImageBuild(options) <add> response, err := cli.client.ImageBuild(context.Background(), options) <ide> if err != nil { <ide> return err <ide> } <ide><path>api/client/cli.go <ide> import ( <ide> "github.com/docker/docker/opts" <ide> "github.com/docker/docker/pkg/term" <ide> "github.com/docker/engine-api/client" <add> "github.com/docker/go-connections/sockets" <ide> "github.com/docker/go-connections/tlsconfig" <ide> ) <ide> <ide> func NewDockerCli(in io.ReadCloser, out, err io.Writer, clientFlags *cli.ClientF <ide> verStr = tmpStr <ide> } <ide> <del> clientTransport, err := newClientTransport(clientFlags.Common.TLSOptions) <add> httpClient, err := newHTTPClient(host, clientFlags.Common.TLSOptions) <ide> if err != nil { <ide> return err <ide> } <ide> <del> client, err := client.NewClient(host, verStr, clientTransport, customHeaders) <add> client, err := client.NewClient(host, verStr, httpClient, customHeaders) <ide> if err != nil { <ide> return err <ide> } <ide> func getServerHost(hosts []string, tlsOptions *tlsconfig.Options) (host string, <ide> return <ide> } <ide> <del>func newClientTransport(tlsOptions *tlsconfig.Options) (*http.Transport, error) { <add>func newHTTPClient(host string, tlsOptions *tlsconfig.Options) (*http.Client, error) { <ide> if tlsOptions == nil { <del> return &http.Transport{}, nil <add> // let the api client configure the default transport. <add> return nil, nil <ide> } <ide> <ide> config, err := tlsconfig.Client(*tlsOptions) <ide> if err != nil { <ide> return nil, err <ide> } <del> return &http.Transport{ <add> tr := &http.Transport{ <ide> TLSClientConfig: config, <add> } <add> proto, addr, _, err := client.ParseHost(host) <add> if err != nil { <add> return nil, err <add> } <add> <add> sockets.ConfigureTransport(tr, proto, addr) <add> <add> return &http.Client{ <add> Transport: tr, <ide> }, nil <ide> } <ide><path>api/client/cp.go <ide> import ( <ide> "path/filepath" <ide> "strings" <ide> <add> "golang.org/x/net/context" <add> <ide> Cli "github.com/docker/docker/cli" <ide> "github.com/docker/docker/pkg/archive" <ide> flag "github.com/docker/docker/pkg/mflag" <ide> func (cli *DockerCli) copyFromContainer(srcContainer, srcPath, dstPath string, c <ide> <ide> } <ide> <del> content, stat, err := cli.client.CopyFromContainer(srcContainer, srcPath) <add> content, stat, err := cli.client.CopyFromContainer(context.Background(), srcContainer, srcPath) <ide> if err != nil { <ide> return err <ide> } <ide> func (cli *DockerCli) copyToContainer(srcPath, dstContainer, dstPath string, cpP <ide> AllowOverwriteDirWithFile: false, <ide> } <ide> <del> return cli.client.CopyToContainer(options) <add> return cli.client.CopyToContainer(context.Background(), options) <ide> } <ide><path>api/client/create.go <ide> import ( <ide> "io" <ide> "os" <ide> <add> "golang.org/x/net/context" <add> <ide> Cli "github.com/docker/docker/cli" <ide> "github.com/docker/docker/pkg/jsonmessage" <ide> "github.com/docker/docker/reference" <ide> func (cli *DockerCli) pullImageCustomOut(image string, out io.Writer) error { <ide> RegistryAuth: encodedAuth, <ide> } <ide> <del> responseBody, err := cli.client.ImageCreate(options) <add> responseBody, err := cli.client.ImageCreate(context.Background(), options) <ide> if err != nil { <ide> return err <ide> } <ide><path>api/client/events.go <ide> import ( <ide> "strings" <ide> "time" <ide> <add> "golang.org/x/net/context" <add> <ide> Cli "github.com/docker/docker/cli" <ide> "github.com/docker/docker/opts" <ide> "github.com/docker/docker/pkg/jsonlog" <ide> func (cli *DockerCli) CmdEvents(args ...string) error { <ide> Filters: eventFilterArgs, <ide> } <ide> <del> responseBody, err := cli.client.Events(options) <add> responseBody, err := cli.client.Events(context.Background(), options) <ide> if err != nil { <ide> return err <ide> } <ide><path>api/client/export.go <ide> import ( <ide> "errors" <ide> "io" <ide> <add> "golang.org/x/net/context" <add> <ide> Cli "github.com/docker/docker/cli" <ide> flag "github.com/docker/docker/pkg/mflag" <ide> ) <ide> func (cli *DockerCli) CmdExport(args ...string) error { <ide> return errors.New("Cowardly refusing to save to a terminal. Use the -o flag or redirect.") <ide> } <ide> <del> responseBody, err := cli.client.ContainerExport(cmd.Arg(0)) <add> responseBody, err := cli.client.ContainerExport(context.Background(), cmd.Arg(0)) <ide> if err != nil { <ide> return err <ide> } <ide><path>api/client/import.go <ide> import ( <ide> "io" <ide> "os" <ide> <add> "golang.org/x/net/context" <add> <ide> Cli "github.com/docker/docker/cli" <ide> "github.com/docker/docker/opts" <ide> "github.com/docker/docker/pkg/jsonmessage" <ide> func (cli *DockerCli) CmdImport(args ...string) error { <ide> Changes: changes, <ide> } <ide> <del> responseBody, err := cli.client.ImageImport(options) <add> responseBody, err := cli.client.ImageImport(context.Background(), options) <ide> if err != nil { <ide> return err <ide> } <ide><path>api/client/load.go <ide> import ( <ide> "io" <ide> "os" <ide> <add> "golang.org/x/net/context" <add> <ide> Cli "github.com/docker/docker/cli" <ide> "github.com/docker/docker/pkg/jsonmessage" <ide> flag "github.com/docker/docker/pkg/mflag" <ide> func (cli *DockerCli) CmdLoad(args ...string) error { <ide> input = file <ide> } <ide> <del> response, err := cli.client.ImageLoad(input) <add> response, err := cli.client.ImageLoad(context.Background(), input, true) <ide> if err != nil { <ide> return err <ide> } <ide><path>api/client/logs.go <ide> import ( <ide> "fmt" <ide> "io" <ide> <add> "golang.org/x/net/context" <add> <ide> Cli "github.com/docker/docker/cli" <ide> flag "github.com/docker/docker/pkg/mflag" <ide> "github.com/docker/docker/pkg/stdcopy" <ide> func (cli *DockerCli) CmdLogs(args ...string) error { <ide> Follow: *follow, <ide> Tail: *tail, <ide> } <del> responseBody, err := cli.client.ContainerLogs(options) <add> responseBody, err := cli.client.ContainerLogs(context.Background(), options) <ide> if err != nil { <ide> return err <ide> } <ide><path>api/client/pull.go <ide> import ( <ide> "errors" <ide> "fmt" <ide> <add> "golang.org/x/net/context" <add> <ide> Cli "github.com/docker/docker/cli" <ide> "github.com/docker/docker/pkg/jsonmessage" <ide> flag "github.com/docker/docker/pkg/mflag" <ide> func (cli *DockerCli) imagePullPrivileged(authConfig types.AuthConfig, imageID, <ide> RegistryAuth: encodedAuth, <ide> } <ide> <del> responseBody, err := cli.client.ImagePull(options, requestPrivilege) <add> responseBody, err := cli.client.ImagePull(context.Background(), options, requestPrivilege) <ide> if err != nil { <ide> return err <ide> } <ide><path>api/client/push.go <ide> import ( <ide> "errors" <ide> "io" <ide> <add> "golang.org/x/net/context" <add> <ide> Cli "github.com/docker/docker/cli" <ide> "github.com/docker/docker/pkg/jsonmessage" <ide> flag "github.com/docker/docker/pkg/mflag" <ide> func (cli *DockerCli) imagePushPrivileged(authConfig types.AuthConfig, imageID, <ide> RegistryAuth: encodedAuth, <ide> } <ide> <del> return cli.client.ImagePush(options, requestPrivilege) <add> return cli.client.ImagePush(context.Background(), options, requestPrivilege) <ide> } <ide><path>api/client/run.go <ide> import ( <ide> "runtime" <ide> "strings" <ide> <add> "golang.org/x/net/context" <add> <ide> "github.com/Sirupsen/logrus" <ide> Cli "github.com/docker/docker/cli" <ide> derr "github.com/docker/docker/errors" <ide> func (cli *DockerCli) CmdRun(args ...string) error { <ide> <ide> // Autoremove: wait for the container to finish, retrieve <ide> // the exit code and remove the container <del> if status, err = cli.client.ContainerWait(createResponse.ID); err != nil { <add> if status, err = cli.client.ContainerWait(context.Background(), createResponse.ID); err != nil { <ide> return runStartContainerErr(err) <ide> } <ide> if _, status, err = getExitCode(cli, createResponse.ID); err != nil { <ide> func (cli *DockerCli) CmdRun(args ...string) error { <ide> // No Autoremove: Simply retrieve the exit code <ide> if !config.Tty { <ide> // In non-TTY mode, we can't detach, so we must wait for container exit <del> if status, err = cli.client.ContainerWait(createResponse.ID); err != nil { <add> if status, err = cli.client.ContainerWait(context.Background(), createResponse.ID); err != nil { <ide> return err <ide> } <ide> } else { <ide><path>api/client/save.go <ide> import ( <ide> "errors" <ide> "io" <ide> <add> "golang.org/x/net/context" <add> <ide> Cli "github.com/docker/docker/cli" <ide> flag "github.com/docker/docker/pkg/mflag" <ide> ) <ide> func (cli *DockerCli) CmdSave(args ...string) error { <ide> return errors.New("Cowardly refusing to save to a terminal. Use the -o flag or redirect.") <ide> } <ide> <del> responseBody, err := cli.client.ImageSave(cmd.Args()) <add> responseBody, err := cli.client.ImageSave(context.Background(), cmd.Args()) <ide> if err != nil { <ide> return err <ide> } <ide><path>api/client/stats.go <ide> import ( <ide> "text/tabwriter" <ide> "time" <ide> <add> "golang.org/x/net/context" <add> <ide> Cli "github.com/docker/docker/cli" <ide> "github.com/docker/engine-api/types" <ide> "github.com/docker/engine-api/types/events" <ide> type stats struct { <ide> } <ide> <ide> func (s *containerStats) Collect(cli *DockerCli, streamStats bool) { <del> responseBody, err := cli.client.ContainerStats(s.Name, streamStats) <add> responseBody, err := cli.client.ContainerStats(context.Background(), s.Name, streamStats) <ide> if err != nil { <ide> s.mu.Lock() <ide> s.err = err <ide> func (cli *DockerCli) CmdStats(args ...string) error { <ide> options := types.EventsOptions{ <ide> Filters: f, <ide> } <del> resBody, err := cli.client.Events(options) <add> resBody, err := cli.client.Events(context.Background(), options) <ide> if err != nil { <ide> c <- watch{err: err} <ide> return <ide><path>api/client/wait.go <ide> import ( <ide> "fmt" <ide> "strings" <ide> <add> "golang.org/x/net/context" <add> <ide> Cli "github.com/docker/docker/cli" <ide> flag "github.com/docker/docker/pkg/mflag" <ide> ) <ide> func (cli *DockerCli) CmdWait(args ...string) error { <ide> <ide> var errs []string <ide> for _, name := range cmd.Args() { <del> status, err := cli.client.ContainerWait(name) <add> status, err := cli.client.ContainerWait(context.Background(), name) <ide> if err != nil { <ide> errs = append(errs, err.Error()) <ide> } else { <ide><path>integration-cli/docker_utils.go <ide> func (d *Daemon) getClientConfig() (*clientConfig, error) { <ide> transport = &http.Transport{} <ide> } <ide> <del> sockets.ConfigureTCPTransport(transport, proto, addr) <add> sockets.ConfigureTransport(transport, proto, addr) <ide> <ide> return &clientConfig{ <ide> transport: transport, <ide><path>pkg/plugins/client.go <ide> func NewClient(addr string, tlsConfig tlsconfig.Options) (*Client, error) { <ide> tr.TLSClientConfig = c <ide> <ide> protoAndAddr := strings.Split(addr, "://") <del> sockets.ConfigureTCPTransport(tr, protoAndAddr[0], protoAndAddr[1]) <add> sockets.ConfigureTransport(tr, protoAndAddr[0], protoAndAddr[1]) <ide> <ide> scheme := protoAndAddr[0] <ide> if scheme != "https" {
17
Text
Text
fix outdated log readme
8e273efdd14e6440f9aab06a15f804b898d8941e
<ide><path>src/Log/README.md <ide> multiple logging backends using a simple interface. With the `Log` class it is <ide> possible to send a single message to multiple logging backends at the same time <ide> or just a subset of them based on the log level or context. <ide> <del>By default, you can use Files or Syslog as logging backends, but you can use any <add>By default, you can use `File` or `Syslog` as logging backends, but you can use any <ide> object implementing `Psr\Log\LoggerInterface` as an engine for the `Log` class. <ide> <ide> ## Usage <ide> <ide> You can define as many or as few loggers as your application needs. Loggers <del>should be configured using `Cake\Core\Log.` An example would be: <add>should be configured using `Cake\Log\Log.` An example would be: <ide> <ide> ```php <ide> use Cake\Log\Log; <ide> <ide> // Short classname <del>Log::config('local', [ <del> 'className' => 'FileLog', <add>Log::setConfig('local', [ <add> 'className' => 'File', <ide> 'levels' => ['notice', 'info', 'debug'], <ide> 'file' => '/path/to/file.log', <ide> ]); <ide> <ide> // Fully namespaced name. <del>Log::config('production', [ <add>Log::setConfig('production', [ <ide> 'className' => \Cake\Log\Engine\SyslogLog::class, <ide> 'levels' => ['warning', 'error', 'critical', 'alert', 'emergency'], <ide> ]); <ide> Log::config('production', [ <ide> It is also possible to create loggers by providing a closure. <ide> <ide> ```php <del>Log::config('special', function () { <add>Log::setConfig('special', function () { <ide> // Return any PSR-3 compatible logger <ide> return new MyPSR3CompatibleLogger(); <ide> }); <ide> Log::config('special', function () { <ide> Or by injecting an instance directly: <ide> <ide> ```php <del>Log::config('special', new MyPSR3CompatibleLogger()); <add>Log::setConfig('special', new MyPSR3CompatibleLogger()); <ide> ``` <ide> <ide> You can then use the `Log` class to pass messages to the logging backends: <ide> you can limit the logging engines that receive a particular message. <ide> ```php <ide> // Configure /logs/payments.log to receive all levels, but only <ide> // those with `payments` scope. <del>Log::config('payments', [ <del> 'className' => 'FileLog', <add>Log::setConfig('payments', [ <add> 'className' => 'File', <ide> 'levels' => ['error', 'info', 'warning'], <ide> 'scopes' => ['payments'], <ide> 'file' => '/logs/payments.log',
1
Text
Text
explain sass extensions in css docs
e0d0c2ebb5c05237103f683982d78f78525b64fb
<ide><path>docs/basic-features/built-in-css-support.md <ide> npm install sass <ide> <ide> Sass support has the same benefits and restrictions as the built-in CSS support detailed above. <ide> <add>> **Note**: Sass supports [two different syntaxes](https://sass-lang.com/documentation/syntax), each with their own extension. <add>> The `.scss` extension requires you use the [SCSS syntax](https://sass-lang.com/documentation/syntax#scss), <add>> while the `.sass` extension requires you use the [Indented Syntax ("Sass")](https://sass-lang.com/documentation/syntax#the-indented-syntax). <add>> <add>> If you're not sure which to choose, start with the `.scss` extension which is a superset of CSS, and doesn't require you learn the <add>> Indented Syntax ("Sass"). <add> <ide> ### Customizing Sass Options <ide> <ide> If you want to configure the Sass compiler you can do so by using `sassOptions` in `next.config.js`.
1
Javascript
Javascript
fix error of ci linter
83c2956679ac6ae6e55c9abfe05a3ab6eb6e6ffa
<ide><path>spec/context-menu-manager-spec.js <del>const ContextMenuManager = require('../src/context-menu-manager'); <del> <del>describe('ContextMenuManager', function() { <del> let [contextMenu, parent, child, grandchild] = []; <del> <del> beforeEach(function() { <del> const { resourcePath } = atom.getLoadSettings(); <del> contextMenu = new ContextMenuManager({ keymapManager: atom.keymaps }); <del> contextMenu.initialize({ resourcePath }); <del> <del> parent = document.createElement('div'); <del> child = document.createElement('div'); <del> grandchild = document.createElement('div'); <del> parent.tabIndex = -1; <del> child.tabIndex = -1; <del> grandchild.tabIndex = -1; <del> parent.classList.add('parent'); <del> child.classList.add('child'); <del> grandchild.classList.add('grandchild'); <del> child.appendChild(grandchild); <del> parent.appendChild(child); <del> <del> document.body.appendChild(parent); <del> }); <del> <del> afterEach(function() { <del> document.body.blur(); <del> document.body.removeChild(parent); <del> }); <del> <del> describe('::add(itemsBySelector)', function() { <del> it('can add top-level menu items that can be removed with the returned disposable', function() { <add>const ContextMenuManager = require("../src/context-menu-manager") <add> <add>describe("ContextMenuManager", function () { <add> let [contextMenu, parent, child, grandchild] = [] <add> <add> beforeEach(function () { <add> const {resourcePath} = atom.getLoadSettings() <add> contextMenu = new ContextMenuManager({keymapManager: atom.keymaps}) <add> contextMenu.initialize({resourcePath}) <add> <add> parent = document.createElement("div") <add> child = document.createElement("div") <add> grandchild = document.createElement("div") <add> parent.tabIndex = -1 <add> child.tabIndex = -1 <add> grandchild.tabIndex = -1 <add> parent.classList.add("parent") <add> child.classList.add("child") <add> grandchild.classList.add("grandchild") <add> child.appendChild(grandchild) <add> parent.appendChild(child) <add> <add> document.body.appendChild(parent) <add> }) <add> <add> afterEach(function () { <add> document.body.blur() <add> document.body.removeChild(parent) <add> }) <add> <add> describe("::add(itemsBySelector)", function () { <add> it("can add top-level menu items that can be removed with the returned disposable", function () { <ide> const disposable = contextMenu.add({ <del> '.parent': [{ label: 'A', command: 'a' }], <del> '.child': [{ label: 'B', command: 'b' }], <del> '.grandchild': [{ label: 'C', command: 'c' }] <del> }); <add> ".parent": [{label: "A", command: "a"}], <add> ".child": [{label: "B", command: "b"}], <add> ".grandchild": [{label: "C", command: "c"}], <add> }) <ide> <ide> expect(contextMenu.templateForElement(grandchild)).toEqual([ <del> { label: 'C', id: 'C', command: 'c' }, <del> { label: 'B', id: 'B', command: 'b' }, <del> { label: 'A', id: 'A', command: 'a' } <del> ]); <add> {label: "C", id: "C", command: "c"}, <add> {label: "B", id: "B", command: "b"}, <add> {label: "A", id: "A", command: "a"}, <add> ]) <ide> <del> disposable.dispose(); <del> expect(contextMenu.templateForElement(grandchild)).toEqual([]); <del> }); <add> disposable.dispose() <add> expect(contextMenu.templateForElement(grandchild)).toEqual([]) <add> }) <ide> <del> it('can add submenu items to existing menus that can be removed with the returned disposable', function() { <add> it("can add submenu items to existing menus that can be removed with the returned disposable", function () { <ide> const disposable1 = contextMenu.add({ <del> '.grandchild': [{ label: 'A', submenu: [{ label: 'B', command: 'b' }] }] <del> }); <add> ".grandchild": [{label: "A", submenu: [{label: "B", command: "b"}]}], <add> }) <ide> const disposable2 = contextMenu.add({ <del> '.grandchild': [{ label: 'A', submenu: [{ label: 'C', command: 'c' }] }] <del> }); <add> ".grandchild": [{label: "A", submenu: [{label: "C", command: "c"}]}], <add> }) <ide> <ide> expect(contextMenu.templateForElement(grandchild)).toEqual([ <ide> { <del> label: 'A', <del> id: 'A', <del> submenu: [{ label: 'B', id: 'B', command: 'b' }, { label: 'C', id: 'C', command: 'c' }] <del> } <del> ]); <add> label: "A", <add> id: "A", <add> submenu: [ <add> {label: "B", id: "B", command: "b"}, <add> {label: "C", id: "C", command: "c"}, <add> ], <add> }, <add> ]) <ide> <del> disposable2.dispose(); <add> disposable2.dispose() <ide> expect(contextMenu.templateForElement(grandchild)).toEqual([ <ide> { <del> label: 'A', <del> id: 'A', <del> submenu: [{ label: 'B', id: 'B', command: 'b' }] <del> } <del> ]); <add> label: "A", <add> id: "A", <add> submenu: [{label: "B", id: "B", command: "b"}], <add> }, <add> ]) <ide> <del> disposable1.dispose(); <del> expect(contextMenu.templateForElement(grandchild)).toEqual([]); <del> }); <add> disposable1.dispose() <add> expect(contextMenu.templateForElement(grandchild)).toEqual([]) <add> }) <ide> <del> it('favors the most specific / recently added item in the case of a duplicate label', function() { <del> grandchild.classList.add('foo'); <add> it("favors the most specific / recently added item in the case of a duplicate label", function () { <add> grandchild.classList.add("foo") <ide> <ide> const disposable1 = contextMenu.add({ <del> '.grandchild': [{ label: 'A', command: 'a' }] <del> }); <add> ".grandchild": [{label: "A", command: "a"}], <add> }) <ide> const disposable2 = contextMenu.add({ <del> '.grandchild.foo': [{ label: 'A', command: 'b' }] <del> }); <add> ".grandchild.foo": [{label: "A", command: "b"}], <add> }) <ide> const disposable3 = contextMenu.add({ <del> '.grandchild': [{ label: 'A', command: 'c' }] <del> }); <add> ".grandchild": [{label: "A", command: "c"}], <add> }) <ide> <ide> contextMenu.add({ <del> '.child': [{ label: 'A', command: 'd' }] <del> }); <add> ".child": [{label: "A", command: "d"}], <add> }) <ide> <del> expect(contextMenu.templateForElement(grandchild)).toEqual([ <del> { label: 'A', id: 'A', command: 'b' } <del> ]); <add> expect(contextMenu.templateForElement(grandchild)).toEqual([{label: "A", id: "A", command: "b"}]) <ide> <del> disposable2.dispose(); <del> expect(contextMenu.templateForElement(grandchild)).toEqual([ <del> { label: 'A', id: 'A', command: 'c' } <del> ]); <add> disposable2.dispose() <add> expect(contextMenu.templateForElement(grandchild)).toEqual([{label: "A", id: "A", command: "c"}]) <ide> <del> disposable3.dispose(); <del> expect(contextMenu.templateForElement(grandchild)).toEqual([ <del> { label: 'A', id: 'A', command: 'a' } <del> ]); <add> disposable3.dispose() <add> expect(contextMenu.templateForElement(grandchild)).toEqual([{label: "A", id: "A", command: "a"}]) <ide> <del> disposable1.dispose(); <del> expect(contextMenu.templateForElement(grandchild)).toEqual([ <del> { label: 'A', id: 'A', command: 'd' } <del> ]); <del> }); <add> disposable1.dispose() <add> expect(contextMenu.templateForElement(grandchild)).toEqual([{label: "A", id: "A", command: "d"}]) <add> }) <ide> <del> it('allows multiple separators, but not adjacent to each other', function() { <add> it("allows multiple separators, but not adjacent to each other", function () { <ide> contextMenu.add({ <del> '.grandchild': [ <del> { label: 'A', command: 'a' }, <del> { type: 'separator' }, <del> { type: 'separator' }, <del> { label: 'B', command: 'b' }, <del> { type: 'separator' }, <del> { type: 'separator' }, <del> { label: 'C', command: 'c' } <del> ] <del> }); <add> ".grandchild": [ <add> {label: "A", command: "a"}, <add> {type: "separator"}, <add> {type: "separator"}, <add> {label: "B", command: "b"}, <add> {type: "separator"}, <add> {type: "separator"}, <add> {label: "C", command: "c"}, <add> ], <add> }) <ide> <ide> expect(contextMenu.templateForElement(grandchild)).toEqual([ <del> { label: 'A', id: 'A', command: 'a' }, <del> { type: 'separator' }, <del> { label: 'B', id: 'B', command: 'b' }, <del> { type: 'separator' }, <del> { label: 'C', id: 'C', command: 'c' } <del> ]); <del> }); <del> <del> it('excludes items marked for display in devMode unless in dev mode', function() { <add> {label: "A", id: "A", command: "a"}, <add> {type: "separator"}, <add> {label: "B", id: "B", command: "b"}, <add> {type: "separator"}, <add> {label: "C", id: "C", command: "c"}, <add> ]) <add> }) <add> <add> it("excludes items marked for display in devMode unless in dev mode", function () { <ide> contextMenu.add({ <del> '.grandchild': [ <del> { label: 'A', command: 'a', devMode: true }, <del> { label: 'B', command: 'b', devMode: false } <del> ] <del> }); <add> ".grandchild": [ <add> {label: "A", command: "a", devMode: true}, <add> {label: "B", command: "b", devMode: false}, <add> ], <add> }) <ide> <del> expect(contextMenu.templateForElement(grandchild)).toEqual([ <del> { label: 'B', id: 'B', command: 'b' } <del> ]); <add> expect(contextMenu.templateForElement(grandchild)).toEqual([{label: "B", id: "B", command: "b"}]) <ide> <del> contextMenu.devMode = true; <add> contextMenu.devMode = true <ide> expect(contextMenu.templateForElement(grandchild)).toEqual([ <del> { label: 'A', id: 'A', command: 'a' }, <del> { label: 'B', id: 'B', command: 'b' } <del> ]); <del> }); <add> {label: "A", id: "A", command: "a"}, <add> {label: "B", id: "B", command: "b"}, <add> ]) <add> }) <ide> <del> it('allows items to be associated with `created` hooks which are invoked on template construction with the item and event', function() { <del> let createdEvent = null; <add> it("allows items to be associated with `created` hooks which are invoked on template construction with the item and event", function () { <add> let createdEvent = null <ide> <ide> const item = { <del> label: 'A', <del> command: 'a', <add> label: "A", <add> command: "a", <ide> created(event) { <del> this.command = 'b'; <del> createdEvent = event; <del> } <del> }; <add> this.command = "b" <add> createdEvent = event <add> }, <add> } <ide> <del> contextMenu.add({ '.grandchild': [item] }); <add> contextMenu.add({".grandchild": [item]}) <ide> <del> const dispatchedEvent = { target: grandchild }; <del> expect(contextMenu.templateForEvent(dispatchedEvent)).toEqual([ <del> { label: 'A', id: 'A', command: 'b' } <del> ]); <del> expect(item.command).toBe('a'); // doesn't modify original item template <del> expect(createdEvent).toBe(dispatchedEvent); <del> }); <add> const dispatchedEvent = {target: grandchild} <add> expect(contextMenu.templateForEvent(dispatchedEvent)).toEqual([{label: "A", id: "A", command: "b"}]) <add> expect(item.command).toBe("a") // doesn't modify original item template <add> expect(createdEvent).toBe(dispatchedEvent) <add> }) <ide> <del> it('allows items to be associated with `shouldDisplay` hooks which are invoked on construction to determine whether the item should be included', function() { <del> let shouldDisplayEvent = null; <del> let shouldDisplay = true; <add> it("allows items to be associated with `shouldDisplay` hooks which are invoked on construction to determine whether the item should be included", function () { <add> let shouldDisplayEvent = null <add> let shouldDisplay = true <ide> <ide> const item = { <del> label: 'A', <del> command: 'a', <add> label: "A", <add> command: "a", <ide> shouldDisplay(event) { <del> this.foo = 'bar'; <del> shouldDisplayEvent = event; <del> return shouldDisplay; <del> } <del> }; <del> contextMenu.add({ '.grandchild': [item] }); <del> <del> const dispatchedEvent = { target: grandchild }; <del> expect(contextMenu.templateForEvent(dispatchedEvent)).toEqual([ <del> { label: 'A', id: 'A', command: 'a' } <del> ]); <del> expect(item.foo).toBeUndefined(); // doesn't modify original item template <del> expect(shouldDisplayEvent).toBe(dispatchedEvent); <add> this.foo = "bar" <add> shouldDisplayEvent = event <add> return shouldDisplay <add> }, <add> } <add> contextMenu.add({".grandchild": [item]}) <add> <add> const dispatchedEvent = {target: grandchild} <add> expect(contextMenu.templateForEvent(dispatchedEvent)).toEqual([{label: "A", id: "A", command: "a"}]) <add> expect(item.foo).toBeUndefined() // doesn't modify original item template <add> expect(shouldDisplayEvent).toBe(dispatchedEvent) <ide> <del> shouldDisplay = false; <del> expect(contextMenu.templateForEvent(dispatchedEvent)).toEqual([]); <del> }); <add> shouldDisplay = false <add> expect(contextMenu.templateForEvent(dispatchedEvent)).toEqual([]) <add> }) <ide> <del> it('prunes a trailing separator', function() { <add> it("prunes a trailing separator", function () { <ide> contextMenu.add({ <del> '.grandchild': [ <del> { label: 'A', command: 'a' }, <del> { type: 'separator' }, <del> { label: 'B', command: 'b' }, <del> { type: 'separator' } <del> ] <del> }); <del> <del> expect(contextMenu.templateForEvent({ target: grandchild }).length).toBe( <del> 3 <del> ); <del> }); <del> <del> it('prunes a leading separator', function() { <add> ".grandchild": [ <add> {label: "A", command: "a"}, <add> {type: "separator"}, <add> {label: "B", command: "b"}, <add> {type: "separator"}, <add> ], <add> }) <add> <add> expect(contextMenu.templateForEvent({target: grandchild}).length).toBe(3) <add> }) <add> <add> it("prunes a leading separator", function () { <ide> contextMenu.add({ <del> '.grandchild': [ <del> { type: 'separator' }, <del> { label: 'A', command: 'a' }, <del> { type: 'separator' }, <del> { label: 'B', command: 'b' } <del> ] <del> }); <del> <del> expect(contextMenu.templateForEvent({ target: grandchild }).length).toBe( <del> 3 <del> ); <del> }); <del> <del> it('prunes duplicate separators', function() { <add> ".grandchild": [ <add> {type: "separator"}, <add> {label: "A", command: "a"}, <add> {type: "separator"}, <add> {label: "B", command: "b"}, <add> ], <add> }) <add> <add> expect(contextMenu.templateForEvent({target: grandchild}).length).toBe(3) <add> }) <add> <add> it("prunes duplicate separators", function () { <ide> contextMenu.add({ <del> '.grandchild': [ <del> { label: 'A', command: 'a' }, <del> { type: 'separator' }, <del> { type: 'separator' }, <del> { label: 'B', command: 'b' } <del> ] <del> }); <del> <del> expect(contextMenu.templateForEvent({ target: grandchild }).length).toBe( <del> 3 <del> ); <del> }); <del> <del> it('prunes all redundant separators', function() { <add> ".grandchild": [ <add> {label: "A", command: "a"}, <add> {type: "separator"}, <add> {type: "separator"}, <add> {label: "B", command: "b"}, <add> ], <add> }) <add> <add> expect(contextMenu.templateForEvent({target: grandchild}).length).toBe(3) <add> }) <add> <add> it("prunes all redundant separators", function () { <ide> contextMenu.add({ <del> '.grandchild': [ <del> { type: 'separator' }, <del> { type: 'separator' }, <del> { label: 'A', command: 'a' }, <del> { type: 'separator' }, <del> { type: 'separator' }, <del> { label: 'B', command: 'b' }, <del> { label: 'C', command: 'c' }, <del> { type: 'separator' }, <del> { type: 'separator' } <del> ] <del> }); <del> <del> expect(contextMenu.templateForEvent({ target: grandchild }).length).toBe( <del> 4 <del> ); <del> }); <del> <del> it('throws an error when the selector is invalid', function() { <del> let addError = null; <add> ".grandchild": [ <add> {type: "separator"}, <add> {type: "separator"}, <add> {label: "A", command: "a"}, <add> {type: "separator"}, <add> {type: "separator"}, <add> {label: "B", command: "b"}, <add> {label: "C", command: "c"}, <add> {type: "separator"}, <add> {type: "separator"}, <add> ], <add> }) <add> <add> expect(contextMenu.templateForEvent({target: grandchild}).length).toBe(4) <add> }) <add> <add> it("throws an error when the selector is invalid", function () { <add> let addError = null <ide> try { <del> contextMenu.add({ '<>': [{ label: 'A', command: 'a' }] }); <add> contextMenu.add({"<>": [{label: "A", command: "a"}]}) <ide> } catch (error) { <del> addError = error; <add> addError = error <ide> } <del> expect(addError.message).toContain('<>'); <del> }); <add> expect(addError.message).toContain("<>") <add> }) <ide> <del> it('calls `created` hooks for submenu items', function() { <add> it("calls `created` hooks for submenu items", function () { <ide> const item = { <del> label: 'A', <del> command: 'B', <add> label: "A", <add> command: "B", <ide> submenu: [ <ide> { <del> label: 'C', <add> label: "C", <ide> created(event) { <del> this.label = 'D'; <del> } <del> } <del> ] <del> }; <del> contextMenu.add({ '.grandchild': [item] }); <del> <del> const dispatchedEvent = { target: grandchild }; <add> this.label = "D" <add> }, <add> }, <add> ], <add> } <add> contextMenu.add({".grandchild": [item]}) <add> <add> const dispatchedEvent = {target: grandchild} <ide> expect(contextMenu.templateForEvent(dispatchedEvent)).toEqual([ <ide> { <del> label: 'A', <del> id: 'A', <del> command: 'B', <add> label: "A", <add> id: "A", <add> command: "B", <ide> submenu: [ <ide> { <del> label: 'D', <del> id: 'D' <del> } <del> ] <del> } <del> ]); <del> }); <del> }); <del> <del> describe('::templateForEvent(target)', function() { <del> let [keymaps, item] = []; <del> <del> beforeEach(function() { <del> keymaps = atom.keymaps.add('source', { <del> '.child': { <del> 'ctrl-a': 'test:my-command', <del> 'shift-b': 'test:my-other-command' <del> } <del> }); <add> label: "D", <add> id: "D", <add> }, <add> ], <add> }, <add> ]) <add> }) <add> }) <add> <add> describe("::templateForEvent(target)", function () { <add> let [keymaps, item] = [] <add> <add> beforeEach(function () { <add> keymaps = atom.keymaps.add("source", { <add> ".child": { <add> "ctrl-a": "test:my-command", <add> "shift-b": "test:my-other-command", <add> }, <add> }) <ide> item = { <del> label: 'My Command', <del> command: 'test:my-command', <add> label: "My Command", <add> command: "test:my-command", <ide> submenu: [ <ide> { <del> label: 'My Other Command', <del> command: 'test:my-other-command' <del> } <del> ] <del> }; <del> contextMenu.add({ '.parent': [item] }); <del> }); <del> <del> afterEach(() => keymaps.dispose()); <del> <del> it('adds Electron-style accelerators to items that have keybindings', function() { <del> child.focus(); <del> const dispatchedEvent = { target: child }; <add> label: "My Other Command", <add> command: "test:my-other-command", <add> }, <add> ], <add> } <add> contextMenu.add({".parent": [item]}) <add> }) <add> <add> afterEach(() => keymaps.dispose()) <add> <add> it("adds Electron-style accelerators to items that have keybindings", function () { <add> child.focus() <add> const dispatchedEvent = {target: child} <ide> expect(contextMenu.templateForEvent(dispatchedEvent)).toEqual([ <ide> { <del> label: 'My Command', <del> id: 'My Command', <del> command: 'test:my-command', <del> accelerator: 'Ctrl+A', <add> label: "My Command", <add> id: "My Command", <add> command: "test:my-command", <add> accelerator: "Ctrl+A", <ide> submenu: [ <ide> { <del> label: 'My Other Command', <del> id: 'My Other Command', <del> command: 'test:my-other-command', <del> accelerator: 'Shift+B' <del> } <del> ] <del> } <del> ]); <del> }); <del> <del> it('adds accelerators when a parent node has key bindings for a given command', function() { <del> grandchild.focus(); <del> const dispatchedEvent = { target: grandchild }; <add> label: "My Other Command", <add> id: "My Other Command", <add> command: "test:my-other-command", <add> accelerator: "Shift+B", <add> }, <add> ], <add> }, <add> ]) <add> }) <add> <add> it("adds accelerators when a parent node has key bindings for a given command", function () { <add> grandchild.focus() <add> const dispatchedEvent = {target: grandchild} <ide> expect(contextMenu.templateForEvent(dispatchedEvent)).toEqual([ <ide> { <del> label: 'My Command', <del> id: 'My Command', <del> command: 'test:my-command', <del> accelerator: 'Ctrl+A', <add> label: "My Command", <add> id: "My Command", <add> command: "test:my-command", <add> accelerator: "Ctrl+A", <ide> submenu: [ <ide> { <del> label: 'My Other Command', <del> id: 'My Other Command', <del> command: 'test:my-other-command', <del> accelerator: 'Shift+B' <del> } <del> ] <del> } <del> ]); <del> }); <del> <del> it('does not add accelerators when a child node has key bindings for a given command', function() { <del> parent.focus(); <del> const dispatchedEvent = { target: parent }; <add> label: "My Other Command", <add> id: "My Other Command", <add> command: "test:my-other-command", <add> accelerator: "Shift+B", <add> }, <add> ], <add> }, <add> ]) <add> }) <add> <add> it("does not add accelerators when a child node has key bindings for a given command", function () { <add> parent.focus() <add> const dispatchedEvent = {target: parent} <ide> expect(contextMenu.templateForEvent(dispatchedEvent)).toEqual([ <ide> { <del> label: 'My Command', <del> id: 'My Command', <del> command: 'test:my-command', <add> label: "My Command", <add> id: "My Command", <add> command: "test:my-command", <ide> submenu: [ <ide> { <del> label: 'My Other Command', <del> id: 'My Other Command', <del> command: 'test:my-other-command' <del> } <del> ] <del> } <del> ]); <del> }); <del> <del> it('adds accelerators based on focus, not context menu target', function() { <del> grandchild.focus(); <del> const dispatchedEvent = { target: parent }; <add> label: "My Other Command", <add> id: "My Other Command", <add> command: "test:my-other-command", <add> }, <add> ], <add> }, <add> ]) <add> }) <add> <add> it("adds accelerators based on focus, not context menu target", function () { <add> grandchild.focus() <add> const dispatchedEvent = {target: parent} <ide> expect(contextMenu.templateForEvent(dispatchedEvent)).toEqual([ <ide> { <del> label: 'My Command', <del> id: 'My Command', <del> command: 'test:my-command', <del> accelerator: 'Ctrl+A', <add> label: "My Command", <add> id: "My Command", <add> command: "test:my-command", <add> accelerator: "Ctrl+A", <ide> submenu: [ <ide> { <del> label: 'My Other Command', <del> id: 'My Other Command', <del> command: 'test:my-other-command', <del> accelerator: 'Shift+B' <del> } <del> ] <del> } <del> ]); <del> }); <del> <del> it('does not add accelerators for multi-keystroke key bindings', function() { <del> atom.keymaps.add('source', { <del> '.child': { <del> 'ctrl-a ctrl-b': 'test:multi-keystroke-command' <del> } <del> }); <del> contextMenu.clear(); <add> label: "My Other Command", <add> id: "My Other Command", <add> command: "test:my-other-command", <add> accelerator: "Shift+B", <add> }, <add> ], <add> }, <add> ]) <add> }) <add> <add> it("does not add accelerators for multi-keystroke key bindings", function () { <add> atom.keymaps.add("source", { <add> ".child": { <add> "ctrl-a ctrl-b": "test:multi-keystroke-command", <add> }, <add> }) <add> contextMenu.clear() <ide> contextMenu.add({ <del> '.parent': [ <add> ".parent": [ <ide> { <del> label: 'Multi-keystroke command', <del> command: 'test:multi-keystroke-command' <del> } <del> ] <del> }); <add> label: "Multi-keystroke command", <add> command: "test:multi-keystroke-command", <add> }, <add> ], <add> }) <ide> <del> child.focus(); <add> child.focus() <ide> <del> const label = process.platform === 'darwin' ? '⌃A ⌃B' : 'Ctrl+A Ctrl+B'; <del> expect(contextMenu.templateForEvent({ target: child })).toEqual([ <add> const label = process.platform === "darwin" ? "⌃A ⌃B" : "Ctrl+A Ctrl+B" <add> expect(contextMenu.templateForEvent({target: child})).toEqual([ <ide> { <ide> label: `Multi-keystroke command [${label}]`, <ide> id: `Multi-keystroke command`, <del> command: 'test:multi-keystroke-command' <del> } <del> ]); <del> }); <del> }); <del> <del> describe('::templateForEvent(target) (sorting)', function() { <del> it('applies simple sorting rules', function() { <add> command: "test:multi-keystroke-command", <add> }, <add> ]) <add> }) <add> }) <add> <add> describe("::templateForEvent(target) (sorting)", function () { <add> it("applies simple sorting rules", function () { <ide> contextMenu.add({ <del> '.parent': [ <add> ".parent": [ <ide> { <del> label: 'My Command', <del> command: 'test:my-command', <del> after: ['test:my-other-command'] <add> label: "My Command", <add> command: "test:my-command", <add> after: ["test:my-other-command"], <ide> }, <ide> { <del> label: 'My Other Command', <del> command: 'test:my-other-command' <del> } <del> ] <del> }); <del> const dispatchedEvent = { target: parent }; <add> label: "My Other Command", <add> command: "test:my-other-command", <add> }, <add> ], <add> }) <add> const dispatchedEvent = {target: parent} <ide> expect(contextMenu.templateForEvent(dispatchedEvent)).toEqual([ <ide> { <del> label: 'My Other Command', <del> id: 'My Other Command', <del> command: 'test:my-other-command' <add> label: "My Other Command", <add> id: "My Other Command", <add> command: "test:my-other-command", <ide> }, <ide> { <del> label: 'My Command', <del> id: 'My Command', <del> command: 'test:my-command', <del> after: ['test:my-other-command'] <del> } <del> ]); <del> }); <del> <del> it('applies sorting rules recursively to submenus', function() { <add> label: "My Command", <add> id: "My Command", <add> command: "test:my-command", <add> after: ["test:my-other-command"], <add> }, <add> ]) <add> }) <add> <add> it("applies sorting rules recursively to submenus", function () { <ide> contextMenu.add({ <del> '.parent': [ <add> ".parent": [ <ide> { <del> label: 'Parent', <add> label: "Parent", <ide> submenu: [ <ide> { <del> label: 'My Command', <del> command: 'test:my-command', <del> after: ['test:my-other-command'] <add> label: "My Command", <add> command: "test:my-command", <add> after: ["test:my-other-command"], <ide> }, <ide> { <del> label: 'My Other Command', <del> command: 'test:my-other-command' <del> } <del> ] <del> } <del> ] <del> }); <del> const dispatchedEvent = { target: parent }; <add> label: "My Other Command", <add> command: "test:my-other-command", <add> }, <add> ], <add> }, <add> ], <add> }) <add> const dispatchedEvent = {target: parent} <ide> expect(contextMenu.templateForEvent(dispatchedEvent)).toEqual([ <ide> { <del> label: 'Parent', <add> label: "Parent", <ide> id: `Parent`, <ide> submenu: [ <ide> { <del> label: 'My Other Command', <del> id: 'My Other Command', <del> command: 'test:my-other-command' <add> label: "My Other Command", <add> id: "My Other Command", <add> command: "test:my-other-command", <ide> }, <ide> { <del> label: 'My Command', <del> id: 'My Command', <del> command: 'test:my-command', <del> after: ['test:my-other-command'] <del> } <del> ] <del> } <del> ]); <del> }); <del> }); <del>}); <add> label: "My Command", <add> id: "My Command", <add> command: "test:my-command", <add> after: ["test:my-other-command"], <add> }, <add> ], <add> }, <add> ]) <add> }) <add> }) <add>}) <ide><path>spec/menu-manager-spec.js <del>const path = require('path'); <del>const MenuManager = require('../src/menu-manager'); <add>const path = require("path") <add>const MenuManager = require("../src/menu-manager") <ide> <del>describe('MenuManager', function() { <del> let menu = null; <add>describe("MenuManager", function () { <add> let menu = null <ide> <del> beforeEach(function() { <add> beforeEach(function () { <ide> menu = new MenuManager({ <ide> keymapManager: atom.keymaps, <del> packageManager: atom.packages <del> }); <del> spyOn(menu, 'sendToBrowserProcess'); // Do not modify Atom's actual menus <del> menu.initialize({ resourcePath: atom.getLoadSettings().resourcePath }); <del> }); <del> <del> describe('::add(items)', function() { <del> it('can add new menus that can be removed with the returned disposable', function() { <del> const disposable = menu.add([ <del> { label: 'A', submenu: [{ label: 'B', command: 'b' }] } <del> ]); <del> expect(menu.template).toEqual([ <del> { label: 'A', id : 'A', submenu: [{ label: 'B', id : 'B', command: 'b' }] } <del> ]); <del> disposable.dispose(); <del> expect(menu.template).toEqual([]); <del> }); <del> <del> it('can add submenu items to existing menus that can be removed with the returned disposable', function() { <del> const disposable1 = menu.add([ <del> { label: 'A', submenu: [{ label: 'B', command: 'b' }] } <del> ]); <add> packageManager: atom.packages, <add> }) <add> spyOn(menu, "sendToBrowserProcess") // Do not modify Atom's actual menus <add> menu.initialize({resourcePath: atom.getLoadSettings().resourcePath}) <add> }) <add> <add> describe("::add(items)", function () { <add> it("can add new menus that can be removed with the returned disposable", function () { <add> const disposable = menu.add([{label: "A", submenu: [{label: "B", command: "b"}]}]) <add> expect(menu.template).toEqual([{label: "A", id: "A", submenu: [{label: "B", id: "B", command: "b"}]}]) <add> disposable.dispose() <add> expect(menu.template).toEqual([]) <add> }) <add> <add> it("can add submenu items to existing menus that can be removed with the returned disposable", function () { <add> const disposable1 = menu.add([{label: "A", submenu: [{label: "B", command: "b"}]}]) <ide> const disposable2 = menu.add([ <ide> { <del> label: 'A', <del> submenu: [{ label: 'C', submenu: [{ label: 'D', command: 'd' }] }] <del> } <del> ]); <add> label: "A", <add> submenu: [{label: "C", submenu: [{label: "D", command: "d"}]}], <add> }, <add> ]) <ide> const disposable3 = menu.add([ <ide> { <del> label: 'A', <del> submenu: [{ label: 'C', submenu: [{ label: 'E', command: 'e' }] }] <del> } <del> ]); <add> label: "A", <add> submenu: [{label: "C", submenu: [{label: "E", command: "e"}]}], <add> }, <add> ]) <ide> <ide> expect(menu.template).toEqual([ <ide> { <del> label: 'A', <del> id : 'A', <add> label: "A", <add> id: "A", <ide> submenu: [ <del> { label: 'B', id : 'B', command: 'b' }, <add> {label: "B", id: "B", command: "b"}, <ide> { <del> label: 'C', <del> id: 'C', <add> label: "C", <add> id: "C", <ide> submenu: [ <del> { label: 'D', id: 'D', command: 'd' }, <del> { label: 'E', id: 'E', command: 'e' } <del> ] <del> } <del> ] <del> } <del> ]); <del> <del> disposable3.dispose(); <add> {label: "D", id: "D", command: "d"}, <add> {label: "E", id: "E", command: "e"}, <add> ], <add> }, <add> ], <add> }, <add> ]) <add> <add> disposable3.dispose() <ide> expect(menu.template).toEqual([ <ide> { <del> label: 'A', <del> id: 'A', <add> label: "A", <add> id: "A", <ide> submenu: [ <del> { label: 'B', id: 'B', command: 'b' }, <del> { label: 'C', id: 'C', <del> submenu: [{ label: 'D', id: 'D', command: 'd' }] } <del> ] <del> } <del> ]); <del> <del> disposable2.dispose(); <del> expect(menu.template).toEqual([ <del> { label: 'A', id: 'A', submenu: [{ label: 'B', id: 'B', command: 'b' }] } <del> ]); <del> <del> disposable1.dispose(); <del> expect(menu.template).toEqual([]); <del> }); <del> <del> it('does not add duplicate labels to the same menu', function() { <del> const originalItemCount = menu.template.length; <del> menu.add([{ label: 'A', submenu: [{ label: 'B', command: 'b' }] }]); <del> menu.add([{ label: 'A', submenu: [{ label: 'B', command: 'b' }] }]); <add> {label: "B", id: "B", command: "b"}, <add> {label: "C", id: "C", submenu: [{label: "D", id: "D", command: "d"}]}, <add> ], <add> }, <add> ]) <add> <add> disposable2.dispose() <add> expect(menu.template).toEqual([{label: "A", id: "A", submenu: [{label: "B", id: "B", command: "b"}]}]) <add> <add> disposable1.dispose() <add> expect(menu.template).toEqual([]) <add> }) <add> <add> it("does not add duplicate labels to the same menu", function () { <add> const originalItemCount = menu.template.length <add> menu.add([{label: "A", submenu: [{label: "B", command: "b"}]}]) <add> menu.add([{label: "A", submenu: [{label: "B", command: "b"}]}]) <ide> expect(menu.template[originalItemCount]).toEqual({ <del> label: 'A', <del> id: 'A', <del> submenu: [{ label: 'B', id: 'B', command: 'b' }] <del> }); <del> }); <del> }); <del> <del> describe('::update()', function() { <del> const originalPlatform = process.platform; <del> afterEach(() => <del> Object.defineProperty(process, 'platform', { value: originalPlatform }) <del> ); <del> <del> it('sends the current menu template and associated key bindings to the browser process', function() { <del> menu.add([{ label: 'A', submenu: [{ label: 'B', command: 'b' }] }]); <del> atom.keymaps.add('test', { 'atom-workspace': { 'ctrl-b': 'b' } }); <del> menu.update(); <del> advanceClock(1); <del> expect(menu.sendToBrowserProcess.argsForCall[0][1]['b']).toEqual([ <del> 'ctrl-b' <del> ]); <del> }); <del> <del> it('omits key bindings that are mapped to unset! in any context', function() { <add> label: "A", <add> id: "A", <add> submenu: [{label: "B", id: "B", command: "b"}], <add> }) <add> }) <add> }) <add> <add> describe("::update()", function () { <add> const originalPlatform = process.platform <add> afterEach(() => Object.defineProperty(process, "platform", {value: originalPlatform})) <add> <add> it("sends the current menu template and associated key bindings to the browser process", function () { <add> menu.add([{label: "A", submenu: [{label: "B", command: "b"}]}]) <add> atom.keymaps.add("test", {"atom-workspace": {"ctrl-b": "b"}}) <add> menu.update() <add> advanceClock(1) <add> expect(menu.sendToBrowserProcess.argsForCall[0][1]["b"]).toEqual(["ctrl-b"]) <add> }) <add> <add> it("omits key bindings that are mapped to unset! in any context", function () { <ide> // it would be nice to be smarter about omitting, but that would require a much <ide> // more dynamic interaction between the currently focused element and the menu <del> menu.add([{ label: 'A', submenu: [{ label: 'B', command: 'b' }] }]); <del> atom.keymaps.add('test', { 'atom-workspace': { 'ctrl-b': 'b' } }); <del> atom.keymaps.add('test', { 'atom-text-editor': { 'ctrl-b': 'unset!' } }); <del> advanceClock(1); <del> expect(menu.sendToBrowserProcess.argsForCall[0][1]['b']).toBeUndefined(); <del> }); <del> <del> it('omits key bindings that could conflict with AltGraph characters on macOS', function() { <del> Object.defineProperty(process, 'platform', { value: 'darwin' }); <add> menu.add([{label: "A", submenu: [{label: "B", command: "b"}]}]) <add> atom.keymaps.add("test", {"atom-workspace": {"ctrl-b": "b"}}) <add> atom.keymaps.add("test", {"atom-text-editor": {"ctrl-b": "unset!"}}) <add> advanceClock(1) <add> expect(menu.sendToBrowserProcess.argsForCall[0][1]["b"]).toBeUndefined() <add> }) <add> <add> it("omits key bindings that could conflict with AltGraph characters on macOS", function () { <add> Object.defineProperty(process, "platform", {value: "darwin"}) <ide> menu.add([ <ide> { <del> label: 'A', <add> label: "A", <ide> submenu: [ <del> { label: 'B', command: 'b' }, <del> { label: 'C', command: 'c' }, <del> { label: 'D', command: 'd' } <del> ] <del> } <del> ]); <del> <del> atom.keymaps.add('test', { <del> 'atom-workspace': { <del> 'alt-b': 'b', <del> 'alt-shift-C': 'c', <del> 'alt-cmd-d': 'd' <del> } <del> }); <del> <del> advanceClock(1); <del> expect(menu.sendToBrowserProcess.argsForCall[0][1]['b']).toBeUndefined(); <del> expect(menu.sendToBrowserProcess.argsForCall[0][1]['c']).toBeUndefined(); <del> expect(menu.sendToBrowserProcess.argsForCall[0][1]['d']).toEqual([ <del> 'alt-cmd-d' <del> ]); <del> }); <del> <del> it('omits key bindings that could conflict with AltGraph characters on Windows', function() { <del> Object.defineProperty(process, 'platform', { value: 'win32' }); <add> {label: "B", command: "b"}, <add> {label: "C", command: "c"}, <add> {label: "D", command: "d"}, <add> ], <add> }, <add> ]) <add> <add> atom.keymaps.add("test", { <add> "atom-workspace": { <add> "alt-b": "b", <add> "alt-shift-C": "c", <add> "alt-cmd-d": "d", <add> }, <add> }) <add> <add> advanceClock(1) <add> expect(menu.sendToBrowserProcess.argsForCall[0][1]["b"]).toBeUndefined() <add> expect(menu.sendToBrowserProcess.argsForCall[0][1]["c"]).toBeUndefined() <add> expect(menu.sendToBrowserProcess.argsForCall[0][1]["d"]).toEqual(["alt-cmd-d"]) <add> }) <add> <add> it("omits key bindings that could conflict with AltGraph characters on Windows", function () { <add> Object.defineProperty(process, "platform", {value: "win32"}) <ide> menu.add([ <ide> { <del> label: 'A', <add> label: "A", <ide> submenu: [ <del> { label: 'B', command: 'b' }, <del> { label: 'C', command: 'c' }, <del> { label: 'D', command: 'd' } <del> ] <del> } <del> ]); <del> <del> atom.keymaps.add('test', { <del> 'atom-workspace': { <del> 'ctrl-alt-b': 'b', <del> 'ctrl-alt-shift-C': 'c', <del> 'ctrl-alt-cmd-d': 'd' <del> } <del> }); <del> <del> advanceClock(1); <del> expect(menu.sendToBrowserProcess.argsForCall[0][1]['b']).toBeUndefined(); <del> expect(menu.sendToBrowserProcess.argsForCall[0][1]['c']).toBeUndefined(); <del> expect(menu.sendToBrowserProcess.argsForCall[0][1]['d']).toEqual([ <del> 'ctrl-alt-cmd-d' <del> ]); <del> }); <del> }); <del> <del> it('updates the application menu when a keymap is reloaded', function() { <del> spyOn(menu, 'update'); <del> const keymapPath = path.join( <del> __dirname, <del> 'fixtures', <del> 'packages', <del> 'package-with-keymaps', <del> 'keymaps', <del> 'keymap-1.cson' <del> ); <del> atom.keymaps.reloadKeymap(keymapPath); <del> expect(menu.update).toHaveBeenCalled(); <del> }); <del>}); <add> {label: "B", command: "b"}, <add> {label: "C", command: "c"}, <add> {label: "D", command: "d"}, <add> ], <add> }, <add> ]) <add> <add> atom.keymaps.add("test", { <add> "atom-workspace": { <add> "ctrl-alt-b": "b", <add> "ctrl-alt-shift-C": "c", <add> "ctrl-alt-cmd-d": "d", <add> }, <add> }) <add> <add> advanceClock(1) <add> expect(menu.sendToBrowserProcess.argsForCall[0][1]["b"]).toBeUndefined() <add> expect(menu.sendToBrowserProcess.argsForCall[0][1]["c"]).toBeUndefined() <add> expect(menu.sendToBrowserProcess.argsForCall[0][1]["d"]).toEqual(["ctrl-alt-cmd-d"]) <add> }) <add> }) <add> <add> it("updates the application menu when a keymap is reloaded", function () { <add> spyOn(menu, "update") <add> const keymapPath = path.join(__dirname, "fixtures", "packages", "package-with-keymaps", "keymaps", "keymap-1.cson") <add> atom.keymaps.reloadKeymap(keymapPath) <add> expect(menu.update).toHaveBeenCalled() <add> }) <add>})
2
Java
Java
replace constant exceptions with inlined ones
9f857c1f16bf634ec2e595d74c0ad39ccaaff98b
<ide><path>spring-webflux/src/main/java/org/springframework/web/reactive/DispatcherHandler.java <ide> protected void initStrategies(ApplicationContext context) { <ide> @Override <ide> public Mono<Void> handle(ServerWebExchange exchange) { <ide> if (this.handlerMappings == null) { <del> return Mono.error(HANDLER_NOT_FOUND_EXCEPTION); <add> return createNotFoundError(); <ide> } <ide> return Flux.fromIterable(this.handlerMappings) <ide> .concatMap(mapping -> mapping.getHandler(exchange)) <ide> .next() <del> .switchIfEmpty(Mono.error(HANDLER_NOT_FOUND_EXCEPTION)) <add> .switchIfEmpty(createNotFoundError()) <ide> .flatMap(handler -> invokeHandler(exchange, handler)) <ide> .flatMap(result -> handleResult(exchange, result)); <ide> } <ide> <add> private <R> Mono<R> createNotFoundError() { <add> return Mono.defer(() -> { <add> Exception ex = new ResponseStatusException(HttpStatus.NOT_FOUND, "No matching handler"); <add> return Mono.error(ex); <add> }); <add> } <add> <ide> private Mono<HandlerResult> invokeHandler(ServerWebExchange exchange, Object handler) { <ide> if (this.handlerAdapters != null) { <ide> for (HandlerAdapter handlerAdapter : this.handlerAdapters) { <ide><path>spring-webflux/src/main/java/org/springframework/web/reactive/resource/ResourceWebHandler.java <ide> public class ResourceWebHandler implements WebHandler, InitializingBean { <ide> <ide> private static final Set<HttpMethod> SUPPORTED_METHODS = EnumSet.of(HttpMethod.GET, HttpMethod.HEAD); <ide> <del> private static final Exception NOT_FOUND_EXCEPTION = new ResponseStatusException(HttpStatus.NOT_FOUND); <del> <ide> private static final Log logger = LogFactory.getLog(ResourceWebHandler.class); <ide> <ide> <ide> public Mono<Void> handle(ServerWebExchange exchange) { <ide> return getResource(exchange) <ide> .switchIfEmpty(Mono.defer(() -> { <ide> logger.debug(exchange.getLogPrefix() + "Resource not found"); <del> return Mono.error(NOT_FOUND_EXCEPTION); <add> return Mono.error(new ResponseStatusException(HttpStatus.NOT_FOUND)); <ide> })) <ide> .flatMap(resource -> { <ide> try { <ide><path>spring-webflux/src/test/java/org/springframework/web/reactive/DispatcherHandlerErrorTests.java <ide> import java.time.Duration; <ide> import java.util.Collections; <ide> import java.util.List; <add>import java.util.concurrent.atomic.AtomicReference; <ide> <ide> import org.junit.Before; <ide> import org.junit.Test; <ide> public void setup() { <ide> @Test <ide> public void noHandler() { <ide> MockServerWebExchange exchange = MockServerWebExchange.from(MockServerHttpRequest.get("/does-not-exist")); <del> Mono<Void> publisher = this.dispatcherHandler.handle(exchange); <add> Mono<Void> mono = this.dispatcherHandler.handle(exchange); <ide> <del> StepVerifier.create(publisher) <del> .consumeErrorWith(error -> { <del> assertThat(error, instanceOf(ResponseStatusException.class)); <del> assertThat(error.getMessage(), <del> is("404 NOT_FOUND \"No matching handler\"")); <add> StepVerifier.create(mono) <add> .consumeErrorWith(ex -> { <add> assertThat(ex, instanceOf(ResponseStatusException.class)); <add> assertThat(ex.getMessage(), is("404 NOT_FOUND \"No matching handler\"")); <ide> }) <ide> .verify(); <add> <add> // SPR-17475 <add> AtomicReference<Throwable> exceptionRef = new AtomicReference<>(); <add> StepVerifier.create(mono).consumeErrorWith(exceptionRef::set).verify(); <add> StepVerifier.create(mono).consumeErrorWith(ex -> assertNotSame(exceptionRef.get(), ex)).verify(); <ide> } <ide> <ide> @Test <ide><path>spring-webflux/src/test/java/org/springframework/web/reactive/resource/ResourceWebHandlerTests.java <ide> import java.util.Collections; <ide> import java.util.List; <ide> import java.util.concurrent.TimeUnit; <add>import java.util.concurrent.atomic.AtomicReference; <ide> <ide> import org.junit.Before; <ide> import org.junit.Test; <ide> public void testInvalidPath() throws Exception { <ide> private void testInvalidPath(String requestPath, ResourceWebHandler handler) { <ide> ServerWebExchange exchange = MockServerWebExchange.from(MockServerHttpRequest.get("")); <ide> setPathWithinHandlerMapping(exchange, requestPath); <add> <ide> StepVerifier.create(handler.handle(exchange)) <ide> .expectErrorSatisfies(err -> { <ide> assertThat(err, instanceOf(ResponseStatusException.class)); <ide> private void resourceNotFound(HttpMethod httpMethod) { <ide> MockServerHttpRequest request = MockServerHttpRequest.method(httpMethod, "").build(); <ide> MockServerWebExchange exchange = MockServerWebExchange.from(request); <ide> setPathWithinHandlerMapping(exchange, "not-there.css"); <del> StepVerifier.create(this.handler.handle(exchange)) <add> Mono<Void> mono = this.handler.handle(exchange); <add> <add> StepVerifier.create(mono) <ide> .expectErrorSatisfies(err -> { <ide> assertThat(err, instanceOf(ResponseStatusException.class)); <ide> assertEquals(HttpStatus.NOT_FOUND, ((ResponseStatusException) err).getStatus()); <ide> }).verify(TIMEOUT); <add> <add> // SPR-17475 <add> AtomicReference<Throwable> exceptionRef = new AtomicReference<>(); <add> StepVerifier.create(mono).consumeErrorWith(exceptionRef::set).verify(); <add> StepVerifier.create(mono).consumeErrorWith(ex -> assertNotSame(exceptionRef.get(), ex)).verify(); <ide> } <ide> <ide> @Test
4
Ruby
Ruby
simplify cask search
3aac0fef7eaeff3cc50b873c921d80dca0ba6810
<ide><path>Library/Homebrew/cask/cask.rb <ide> def self.all <ide> end.compact <ide> end <ide> <del> def self.full_names <del> Tap.flat_map do |tap| <del> next tap.cask_tokens.blank? <del> next tap.cask_tokens if tap.user == "Homebrew" <del> <del> name = tap.name <del> tap.cask_tokens.map { |tok| "#{name}/#{tok}" } <del> end.flatten <del> end <del> <ide> def tap <ide> return super if block_given? # Object#tap <ide> <ide><path>Library/Homebrew/extend/os/mac/search.rb <ide> def search_casks(string_or_regex) <ide> results = cask_tokens.extend(Searchable) <ide> .search(string_or_regex) <ide> <del> cask_names = Cask::Cask.full_names <del> results += DidYouMean::SpellChecker.new(dictionary: cask_names) <add> results += DidYouMean::SpellChecker.new(dictionary: cask_tokens) <ide> .correct(string_or_regex) <ide> <ide> results.sort.map do |name|
2
Javascript
Javascript
add test case for render.compile instrumentation
99cca3ea366ac20ebbba830bcd261b25e420272d
<ide><path>packages/ember-glimmer/lib/environment.js <ide> import { FACTORY_FOR } from 'container'; <ide> import { default as ActionModifierManager } from './modifiers/action'; <ide> <ide> function instrumentationPayload(name) { <del> return { object: name }; <add> return { object: `component:${name}` }; <ide> } <ide> <ide> export default class Environment extends GlimmerEnvironment { <ide><path>packages/ember-glimmer/tests/integration/components/instrumentation-compile-test.js <add>import { moduleFor, RenderingTest } from '../../utils/test-case'; <add>import { Component } from '../../utils/helpers'; <add>import { <add> instrumentationSubscribe, <add> instrumentationReset, <add> set <add>} from 'ember-metal'; <add> <add>moduleFor('Components compile instrumentation', class extends RenderingTest { <add> constructor() { <add> super(); <add> <add> this.resetEvents(); <add> <add> instrumentationSubscribe('render.compile', { <add> before: (name, timestamp, payload) => { <add> if (payload.view !== this.component) { <add> this.actual.before.push(payload); <add> } <add> }, <add> after: (name, timestamp, payload) => { <add> if (payload.view !== this.component) { <add> this.actual.after.push(payload); <add> } <add> } <add> }); <add> } <add> <add> resetEvents() { <add> this.expected = { <add> before: [], <add> after: [] <add> }; <add> <add> this.actual = { <add> before: [], <add> after: [] <add> }; <add> } <add> <add> teardown() { <add> this.assert.deepEqual(this.actual.before, [], 'No unexpected events (before)'); <add> this.assert.deepEqual(this.actual.after, [], 'No unexpected events (after)'); <add> super.teardown(); <add> instrumentationReset(); <add> } <add> <add> ['@test it should only receive an instrumentation event for initial render'](assert) { <add> let testCase = this; <add> <add> let BaseClass = Component.extend({ <add> tagName: '', <add> <add> willRender() { <add> testCase.expected.before.push(this); <add> testCase.expected.after.unshift(this); <add> } <add> }); <add> <add> this.registerComponent('x-bar', { <add> template: '[x-bar: {{bar}}]', <add> ComponentClass: BaseClass.extend() <add> }); <add> <add> this.render(`[-top-level: {{foo}}] {{x-bar bar=bar}}`, { <add> foo: 'foo', bar: 'bar' <add> }); <add> <add> this.assertText('[-top-level: foo] [x-bar: bar]'); <add> <add> this.assertEvents('after initial render'); <add> <add> this.runTask(() => this.rerender()); <add> <add> this.assertEvents('after no-op rerender'); <add> } <add> <add> assertEvents(label) { <add> let { actual, expected } = this; <add> this.assert.strictEqual(actual.before.length, actual.after.length, `${label}: before and after callbacks should be balanced`); <add> <add> this._assertEvents(`${label} (before):`, actual.before, expected.before); <add> this._assertEvents(`${label} (after):`, actual.before, expected.before); <add> <add> this.resetEvents(); <add> } <add> <add> _assertEvents(label, actual, expected) { <add> this.assert.equal(actual.length, expected.length, `${label}: expected ${expected.length} and got ${actual.length}`); <add> <add> actual.forEach((payload, i) => this.assertPayload(payload, expected[i])); <add> } <add> <add> assertPayload(payload, component) { <add> this.assert.equal(payload.object, component._debugContainerKey, 'payload.object'); <add> } <add>});
2
Text
Text
fix changelog entry [ci skip]
0df82a64530ee208fc2a7d1b19af75a39c1a44a0
<ide><path>actioncable/CHANGELOG.md <del>* Add ActiveSupport::Notifications and ActiveSupport::LogSubscriber to ActionCable::Channel <add>* Add ActiveSupport::Notifications to ActionCable::Channel. <ide> <ide> *Matthew Wear* <ide>
1
Javascript
Javascript
use specification order for chunks
d42d52b3889ba1f2cd9b7075011060916272c4c8
<ide><path>lib/Compilation.js <ide> Compilation.prototype._addModuleChain = function process(context, dependency, on <ide> }; <ide> <ide> Compilation.prototype.addEntry = function process(context, entry, name, callback) { <add> var slot = { <add> name: name, <add> module: null <add> }; <add> this.preparedChunks.push(slot); <ide> this._addModuleChain(context, entry, function(module) { <ide> <ide> entry.module = module; <ide> Compilation.prototype.addEntry = function process(context, entry, name, callback <ide> } <ide> <ide> if(module) { <del> this.preparedChunks.push({ <del> name: name, <del> module: module <del> }); <add> slot.module = module; <add> } else { <add> var idx = this.preparedChunks.indexOf(slot); <add> this.preparedChunks.splice(idx, 1); <ide> } <ide> return callback(); <ide> }.bind(this)); <ide> Compilation.prototype.unseal = function unseal() { <ide> <ide> Compilation.prototype.seal = function seal(callback) { <ide> this.applyPlugins("seal"); <del> this.preparedChunks.sort(function(a, b) { <del> if(a.name < b.name) return -1; <del> if(a.name > b.name) return 1; <del> return 0; <del> }); <ide> this.nextFreeModuleIndex = 0; <ide> this.nextFreeModuleIndex2 = 0; <ide> this.preparedChunks.forEach(function(preparedChunk) {
1
Ruby
Ruby
restore useful documentation removed at
1bc30b18b729d2decd626cfa8383ed4eb4ee29b8
<ide><path>activerecord/lib/active_record/model_schema.rb <ide> module ClassMethods <ide> # +table_name_suffix+ is appended. So if you have "myapp_" as a prefix, <ide> # the table name guess for an Invoice class becomes "myapp_invoices". <ide> # Invoice::Lineitem becomes "myapp_invoice_lineitems". <add> # <add> # You can also set your own table name explicitly: <add> # <add> # class Mouse < ActiveRecord::Base <add> # self.table_name = "mice" <add> # end <ide> def table_name <ide> reset_table_name unless defined?(@table_name) <ide> @table_name
1
PHP
PHP
fix cache in mix method.
948666108a51a906ad6787897e8f957ffbc5f833
<ide><path>src/Illuminate/Foundation/helpers.php <ide> function mix($path, $manifestDirectory = '') <ide> $manifestDirectory = "/{$manifestDirectory}"; <ide> } <ide> <del> $manifestKey = $manifestDirectory ? $manifestDirectory : '/'; <del> <ide> if (file_exists(public_path($manifestDirectory.'/hot'))) { <ide> return new HtmlString("//localhost:8080{$path}"); <ide> } <ide> <del> if (in_array($manifestKey, $manifests)) { <del> $manifest = $manifests[$manifestKey]; <del> } else { <del> if (! file_exists($manifestPath = public_path($manifestDirectory.'/mix-manifest.json'))) { <add> $manifestPath = public_path($manifestDirectory.'/mix-manifest.json'); <add> <add> if (! isset($manifests[$manifestPath])) { <add> if (! file_exists($manifestPath)) { <ide> throw new Exception('The Mix manifest does not exist.'); <ide> } <ide> <del> $manifests[$manifestKey] = $manifest = json_decode( <del> file_get_contents($manifestPath), true <del> ); <add> $manifests[$manifestPath] = json_decode(file_get_contents($manifestPath), true); <ide> } <ide> <del> if (! array_key_exists($path, $manifest)) { <add> $manifest = $manifests[$manifestPath]; <add> <add> if (! isset($manifest[$path])) { <ide> throw new Exception( <ide> "Unable to locate Mix file: {$path}. Please check your ". <ide> 'webpack.mix.js output paths and try again.' <ide> ); <ide> } <ide> <del> return new HtmlString($manifestDirectory.$manifest[$path]); <add> return new HtmlString(asset($manifestDirectory.$manifest[$path])); <ide> } <ide> } <ide>
1
Javascript
Javascript
switch `view` to `react.forwardref`
3e534b9aab5156adac67762877b2457408fe8934
<ide><path>Libraries/Animated/src/createAnimatedComponent.js <ide> const invariant = require('fbjs/lib/invariant'); <ide> <ide> function createAnimatedComponent(Component: any): any { <ide> invariant( <del> typeof Component === 'string' || <add> typeof Component !== 'function' || <ide> (Component.prototype && Component.prototype.isReactComponent), <ide> '`createAnimatedComponent` does not support stateless functional components; ' + <ide> 'use a class component instead.', <ide><path>Libraries/Components/View/View.js <ide> * This source code is licensed under the MIT license found in the <ide> * LICENSE file in the root directory of this source tree. <ide> * <del> * @flow <ide> * @format <add> * @flow <ide> */ <ide> <ide> 'use strict'; <ide> <ide> const Platform = require('Platform'); <ide> const React = require('React'); <del>const ReactNative = require('ReactNative'); <ide> const ReactNativeStyleAttributes = require('ReactNativeStyleAttributes'); <del>const ReactNativeViewAttributes = require('ReactNativeViewAttributes'); <ide> const TextAncestor = require('TextAncestor'); <ide> const ViewPropTypes = require('ViewPropTypes'); <ide> <ide> const invariant = require('fbjs/lib/invariant'); <ide> const requireNativeComponent = require('requireNativeComponent'); <ide> <add>import type {NativeComponent} from 'ReactNative'; <ide> import type {ViewProps} from 'ViewPropTypes'; <ide> <ide> export type Props = ViewProps; <ide> export type Props = ViewProps; <ide> * <ide> * @see http://facebook.github.io/react-native/docs/view.html <ide> */ <del>class View extends ReactNative.NativeComponent<Props> { <del> static propTypes = ViewPropTypes; <del> <del> viewConfig = { <del> uiViewClassName: 'RCTView', <del> validAttributes: ReactNativeViewAttributes.RCTView, <del> }; <del> <del> /** <del> * WARNING: This method will not be used in production mode as in that mode we <del> * replace wrapper component View with generated native wrapper RCTView. Avoid <del> * adding functionality this component that you'd want to be available in both <del> * dev and prod modes. <del> */ <del> render() { <del> return ( <del> <TextAncestor.Consumer> <del> {hasTextAncestor => { <del> // TODO: Change iOS to behave the same as Android. <del> invariant( <del> !hasTextAncestor || Platform.OS !== 'android', <del> 'Nesting of <View> within <Text> is not supported on Android.', <del> ); <del> return <RCTView {...this.props} />; <del> }} <del> </TextAncestor.Consumer> <del> ); <del> } <del>} <del> <del>const RCTView = requireNativeComponent('RCTView', View, { <del> nativeOnly: { <del> nativeBackgroundAndroid: true, <del> nativeForegroundAndroid: true, <add>const RCTView = requireNativeComponent( <add> 'RCTView', <add> { <add> propTypes: ViewPropTypes, <add> }, <add> { <add> nativeOnly: { <add> nativeBackgroundAndroid: true, <add> nativeForegroundAndroid: true, <add> }, <ide> }, <del>}); <add>); <ide> <ide> if (__DEV__) { <ide> const UIManager = require('UIManager'); <ide> const viewConfig = <ide> (UIManager.viewConfigs && UIManager.viewConfigs.RCTView) || {}; <ide> for (const prop in viewConfig.nativeProps) { <del> const viewAny: any = View; // Appease flow <del> if (!viewAny.propTypes[prop] && !ReactNativeStyleAttributes[prop]) { <add> if (!ViewPropTypes[prop] && !ReactNativeStyleAttributes[prop]) { <ide> throw new Error( <ide> 'View is missing propType for native prop `' + prop + '`', <ide> ); <ide> if (__DEV__) { <ide> <ide> let ViewToExport = RCTView; <ide> if (__DEV__) { <del> ViewToExport = View; <add> // $FlowFixMe - TODO T29156721 `React.forwardRef` is not defined in Flow, yet. <add> ViewToExport = React.forwardRef((props, ref) => ( <add> <TextAncestor.Consumer> <add> {hasTextAncestor => { <add> // TODO: Change iOS to behave the same as Android. <add> invariant( <add> !hasTextAncestor || Platform.OS !== 'android', <add> 'Nesting of <View> within <Text> is not supported on Android.', <add> ); <add> return <RCTView {...props} ref={ref} />; <add> }} <add> </TextAncestor.Consumer> <add> )); <add> ViewToExport.displayName = 'View'; <ide> } <ide> <del>// No one should depend on the DEV-mode createClass View wrapper. <del>module.exports = ((ViewToExport: any): typeof View); <add>module.exports = ((ViewToExport: any): Class<NativeComponent<ViewProps, any>>); <ide><path>jest/mockComponent.js <ide> * <ide> * This source code is licensed under the MIT license found in the <ide> * LICENSE file in the root directory of this source tree. <add> * <add> * @format <ide> */ <add> <ide> 'use strict'; <ide> <del>module.exports = moduleName => { <add>module.exports = (moduleName, instanceMethods) => { <ide> const RealComponent = require.requireActual(moduleName); <ide> const React = require('react'); <ide> <del> const Component = class extends RealComponent { <add> const SuperClass = <add> typeof RealComponent === 'function' ? RealComponent : React.Component; <add> <add> const Component = class extends SuperClass { <ide> render() { <ide> const name = RealComponent.displayName || RealComponent.name; <ide> <ide> return React.createElement( <del> name.replace(/^(RCT|RK)/,''), <add> name.replace(/^(RCT|RK)/, ''), <ide> this.props, <ide> this.props.children, <ide> ); <ide> } <ide> }; <add> <add> if (instanceMethods != null) { <add> Object.assign(Component.prototype, instanceMethods); <add> } <add> <ide> return Component; <ide> }; <ide><path>jest/setup.js <ide> jest <ide> .mock('Text', () => mockComponent('Text')) <ide> .mock('TextInput', () => mockComponent('TextInput')) <ide> .mock('Modal', () => mockComponent('Modal')) <del> .mock('View', () => mockComponent('View')) <add> .mock('View', () => mockComponent('View', MockNativeMethods)) <ide> .mock('RefreshControl', () => require.requireMock('RefreshControlMock')) <ide> .mock('ScrollView', () => require.requireMock('ScrollViewMock')) <ide> .mock(
4
Javascript
Javascript
fix references to the old reactid syntax
989eb2e7d9d0f58030e1514959113649c6e1a38b
<ide><path>src/core/ReactInstanceHandles.js <ide> var ReactInstanceHandles = { <ide> <ide> /** <ide> * Traverse a node ID, calling the supplied `cb` for each ancestor ID. For <del> * example, passing `.r[0].{row-0}.[1]` would result in `cb` getting called <del> * with `.r[0]`, `.r[0].{row-0}`, and `.r[0].{row-0}.[1]`. <add> * example, passing `.0.$row-0.1` would result in `cb` getting called <add> * with `.0`, `.0.$row-0`, and `.0.$row-0.1`. <ide> * <ide> * NOTE: This traversal happens on IDs without touching the DOM. <ide> * <ide><path>src/core/ReactMount.js <ide> function findDeepestCachedAncestor(targetID) { <ide> * ); <ide> * <ide> * <div id="container"> <-- Supplied `container`. <del> * <div data-reactid=".r[3]"> <-- Rendered reactRoot of React <add> * <div data-reactid=".3"> <-- Rendered reactRoot of React <ide> * // ... component. <ide> * </div> <ide> * </div> <ide><path>src/core/__tests__/ReactEventEmitter-test.js <ide> var ON_CHANGE_KEY = keyOf({onChange: null}); <ide> var CHILD = document.createElement('div'); <ide> var PARENT = document.createElement('div'); <ide> var GRANDPARENT = document.createElement('div'); <del>setID(CHILD, '.reactRoot.[0].[0].[0]'); <del>setID(PARENT, '.reactRoot.[0].[0]'); <del>setID(GRANDPARENT, '.reactRoot.[0]'); <add>setID(CHILD, '.0.0.0.0'); <add>setID(PARENT, '.0.0.0'); <add>setID(GRANDPARENT, '.0.0'); <ide> <ide> function registerSimpleTestHandler() { <ide> ReactEventEmitter.putListener(getID(CHILD), ON_CLICK_KEY, LISTENER); <ide><path>src/core/__tests__/ReactInstanceHandles-test.js <ide> describe('ReactInstanceHandles', function() { <ide> parentNode.appendChild(childNodeA); <ide> parentNode.appendChild(childNodeB); <ide> <del> ReactMount.setID(parentNode, '.react[0]'); <del> ReactMount.setID(childNodeA, '.react[0].0'); <del> ReactMount.setID(childNodeB, '.react[0].0:1'); <add> ReactMount.setID(parentNode, '.0'); <add> ReactMount.setID(childNodeA, '.0.0'); <add> ReactMount.setID(childNodeB, '.0.0:1'); <ide> <ide> expect( <ide> ReactMount.findComponentRoot( <ide> describe('ReactInstanceHandles', function() { <ide> parentNode.appendChild(childNodeA); <ide> parentNode.appendChild(childNodeB); <ide> <del> ReactMount.setID(parentNode, '.react[0]'); <add> ReactMount.setID(parentNode, '.0'); <ide> // No ID on `childNodeA`. <del> ReactMount.setID(childNodeB, '.react[0].0:1'); <add> ReactMount.setID(childNodeB, '.0.0:1'); <ide> <ide> expect( <ide> ReactMount.findComponentRoot( <ide> describe('ReactInstanceHandles', function() { <ide> parentNode.appendChild(childNodeA); <ide> childNodeA.appendChild(childNodeB); <ide> <del> ReactMount.setID(parentNode, '.react[0]'); <add> ReactMount.setID(parentNode, '.0'); <ide> // No ID on `childNodeA`, it was "rendered by the browser". <del> ReactMount.setID(childNodeB, '.react[0].1:0'); <add> ReactMount.setID(childNodeB, '.0.1:0'); <ide> <ide> expect(ReactMount.findComponentRoot( <ide> parentNode, <ide> describe('ReactInstanceHandles', function() { <ide> ReactMount.getID(childNodeB) + ":junk" <ide> ); <ide> }).toThrow( <del> 'Invariant Violation: findComponentRoot(..., .react[0].1:0:junk): ' + <add> 'Invariant Violation: findComponentRoot(..., .0.1:0:junk): ' + <ide> 'Unable to find element. This probably means the DOM was ' + <ide> 'unexpectedly mutated (e.g., by the browser). Try inspecting the ' + <del> 'child nodes of the element with React ID `.react[0]`.' <add> 'child nodes of the element with React ID `.0`.' <ide> ); <ide> }); <ide> }); <ide><path>src/core/__tests__/ReactMultiChildReconcile-test.js <ide> var stripEmptyValues = function(obj) { <ide> }; <ide> <ide> /** <del> * Child key names are wrapped like '{key}[0]'. We strip the extra chars out <add> * Child key names are wrapped like '.$key:0'. We strip the extra chars out <ide> * here. This relies on an implementation detail of the rendering system. <ide> */ <ide> var getOriginalKey = function(childName) { <ide><path>src/eventPlugins/__tests__/ResponderEventPlugin-test.js <ide> var ReactInstanceHandles; <ide> var ResponderEventPlugin; <ide> var SyntheticEvent; <ide> <del>var GRANDPARENT_ID = '.r[0]'; <del>var PARENT_ID = '.r[0].0'; <del>var CHILD_ID = '.r[0].0.0'; <add>var GRANDPARENT_ID = '.0'; <add>var PARENT_ID = '.0.0'; <add>var CHILD_ID = '.0.0.0'; <ide> <ide> var topLevelTypes; <ide> var responderEventTypes; <ide><path>src/test/ReactDefaultPerf.js <ide> if (__DEV__) { <ide> * Runs through the logs and builds an array of arrays, where each array <ide> * walks through the mounting/updating of each component underneath. <ide> * <del> * @param {string} rootID The reactID of the root node, e.g. '.r[2cpyq]' <add> * @param {string} rootID The reactID of the root node, e.g. '.0' <ide> * @return {array<array>} <ide> */ <ide> getRawRenderHistory: function(rootID) { <ide> if (__DEV__) { <ide> * is a multiline formatted way of walking through the mounting/updating <ide> * underneath. <ide> * <del> * @param {string} rootID The reactID of the root node, e.g. '.r[2cpyq]' <add> * @param {string} rootID The reactID of the root node, e.g. '.0' <ide> * @return {array<string>} <ide> */ <ide> getRenderHistory: function(rootID) { <ide> if (__DEV__) { <ide> ); <ide> return headerString + subHistory.map(function(log) { <ide> // Add two spaces for every layer in the reactID. <del> var indents = '\t' + Array(log.reactID.split('.[').length).join(' '); <add> var indents = '\t' + Array(log.reactID.split('.').length).join(' '); <ide> var delta = _microTime(log.timing.delta); <ide> var bloat = _microTime(log.timing.timeToLog); <ide> <ide> if (__DEV__) { <ide> * This is currently the best way to display perf data from <ide> * any React component; working on that. <ide> * <del> * @param {string} rootID The reactID of the root node, e.g. '.r[2cpyq]' <add> * @param {string} rootID The reactID of the root node, e.g. '.0' <ide> * @param {number} index <ide> */ <ide> printRenderHistory: function(rootID, index) {
7
Text
Text
add a deprecation message for removing lttng
740c426b21dde1befa1dbae9bb01174a9e25b525
<ide><path>doc/api/deprecations.md <ide> Type: Runtime <ide> <ide> This was never a documented feature. <ide> <add> <add><a id="DEP0101"></a> <add>### DEP0101: --with-lttng <add> <add>Type: End-of-Life <add> <add>The `--with-lttng` compile time option is removed. <add> <ide> [`--pending-deprecation`]: cli.html#cli_pending_deprecation <ide> [`Buffer.allocUnsafeSlow(size)`]: buffer.html#buffer_class_method_buffer_allocunsafeslow_size <ide> [`Buffer.from(array)`]: buffer.html#buffer_class_method_buffer_from_array
1
Text
Text
clarify instructions for reg form step 26
6185deec06a9da5d923c29ed467d1ae9cf33d606
<ide><path>curriculum/challenges/english/14-responsive-web-design-22/learn-html-forms-by-building-a-registration-form/60fab8367d35de04e5cb7929.md <ide> dashedName: step-26 <ide> <ide> # --description-- <ide> <del>To finish this `fieldset` off, link the text `terms and conditions` to the following location: <add>To finish this `fieldset` off, link the text `terms and conditions` in the third `label` to the following location: <ide> <ide> ```md <ide> https://www.freecodecamp.org/news/terms-of-service/
1
Python
Python
ignore overrides for pipe names in config argument
6f9e2ca81ff541a0ab53b8d77100adaac8699219
<ide><path>spacy/errors.py <ide> class Warnings(metaclass=ErrorsWithCodes): <ide> W118 = ("Term '{term}' not found in glossary. It may however be explained in documentation " <ide> "for the corpora used to train the language. Please check " <ide> "`nlp.meta[\"sources\"]` for any relevant links.") <add> W119 = ("Overriding pipe name in `config` is not supported. Ignoring override '{name_in_config}'.") <ide> <ide> <ide> class Errors(metaclass=ErrorsWithCodes): <ide><path>spacy/language.py <ide> def add_pipe( <ide> name = name if name is not None else factory_name <ide> if name in self.component_names: <ide> raise ValueError(Errors.E007.format(name=name, opts=self.component_names)) <add> # Overriding pipe name in the config is not supported and will be ignored. <add> if "name" in config: <add> warnings.warn(Warnings.W119.format(name_in_config=config.pop("name"))) <ide> if source is not None: <ide> # We're loading the component from a model. After loading the <ide> # component, we know its real factory name <ide><path>spacy/tests/pipeline/test_pipe_factories.py <ide> def __init__( <ide> self.value1 = value1 <ide> self.value2 = value2 <ide> self.is_base = True <add> self.name = name <ide> <ide> def __call__(self, doc: Doc) -> Doc: <ide> return doc <ide> def __call__(self, doc: Doc) -> Doc: <ide> nlp.add_pipe(name) <ide> with pytest.raises(ConfigValidationError): # invalid config <ide> nlp.add_pipe(name, config={"value1": "10", "value2": "hello"}) <del> nlp.add_pipe(name, config={"value1": 10, "value2": "hello"}) <add> with pytest.warns(UserWarning): <add> nlp.add_pipe(name, config={"value1": 10, "value2": "hello", "name": "wrong_name"}) <ide> pipe = nlp.get_pipe(name) <ide> assert isinstance(pipe.nlp, Language) <ide> assert pipe.value1 == 10 <ide> assert pipe.value2 == "hello" <ide> assert pipe.is_base is True <add> assert pipe.name == name <ide> <ide> nlp_en = English() <ide> with pytest.raises(ConfigValidationError): # invalid config
3
Ruby
Ruby
use current bottle versions to calculate new ones
6010763159e2005069328b864ae6daf55b3cb288
<ide><path>Library/Homebrew/bottles.rb <ide> def bottle_current? f <ide> end <ide> <ide> def bottle_new_version f <del> return 0 unless f.bottle_version <add> return 0 unless bottle_current? f <ide> f.bottle_version + 1 <ide> end <ide>
1
Python
Python
handle cyrillic combining diacritics
a9559e7435f99648aa0004f301692f1a2dfe72fe
<ide><path>spacy/lang/bg/__init__.py <ide> from .tokenizer_exceptions import TOKENIZER_EXCEPTIONS <ide> from .lex_attrs import LEX_ATTRS <ide> from ..tokenizer_exceptions import BASE_EXCEPTIONS <del> <add>from ..punctuation import COMBINING_DIACRITICS_TOKENIZER_INFIXES <add>from ..punctuation import COMBINING_DIACRITICS_TOKENIZER_SUFFIXES <ide> from ...language import Language, BaseDefaults <ide> from ...attrs import LANG <ide> from ...util import update_exc <ide> class BulgarianDefaults(BaseDefaults): <ide> <ide> stop_words = STOP_WORDS <ide> tokenizer_exceptions = update_exc(BASE_EXCEPTIONS, TOKENIZER_EXCEPTIONS) <add> suffixes = COMBINING_DIACRITICS_TOKENIZER_SUFFIXES <add> infixes = COMBINING_DIACRITICS_TOKENIZER_INFIXES <ide> <ide> <ide> class Bulgarian(Language): <ide><path>spacy/lang/char_classes.py <ide> ALPHA_LOWER = group_chars(_lower + _uncased) <ide> ALPHA_UPPER = group_chars(_upper + _uncased) <ide> <add>_combining_diacritics = r"\u0300-\u036f" <add> <add>COMBINING_DIACRITICS = _combining_diacritics <add> <ide> _units = ( <ide> "km km² km³ m m² m³ dm dm² dm³ cm cm² cm³ mm mm² mm³ ha µm nm yd in ft " <ide> "kg g mg µg t lb oz m/s km/h kmh mph hPa Pa mbar mb MB kb KB gb GB tb " <ide><path>spacy/lang/punctuation.py <ide> from .char_classes import LIST_PUNCT, LIST_ELLIPSES, LIST_QUOTES, LIST_CURRENCY <del>from .char_classes import LIST_ICONS, HYPHENS, CURRENCY, UNITS <add>from .char_classes import LIST_ICONS, HYPHENS, CURRENCY, UNITS, COMBINING_DIACRITICS <ide> from .char_classes import CONCAT_QUOTES, ALPHA_LOWER, ALPHA_UPPER, ALPHA, PUNCT <ide> <ide> <ide> r"(?<=[{a}0-9])[:<>=/](?=[{a}])".format(a=ALPHA), <ide> ] <ide> ) <add> <add> <add># Some languages e.g. written with the Cyrillic alphabet permit the use of diacritics <add># to mark stressed syllables in words where stress is distinctive. Such languages <add># should use the COMBINING_DIACRITICS... suffix and infix regex lists in <add># place of the standard ones. <add>COMBINING_DIACRITICS_TOKENIZER_SUFFIXES = list(TOKENIZER_SUFFIXES) + [ <add> r"(?<=[{a}][{d}])\.".format(a=ALPHA, d=COMBINING_DIACRITICS), <add>] <add> <add>COMBINING_DIACRITICS_TOKENIZER_INFIXES = list(TOKENIZER_INFIXES) + [ <add> r"(?<=[{al}][{d}])\.(?=[{au}{q}])".format( <add> al=ALPHA_LOWER, au=ALPHA_UPPER, q=CONCAT_QUOTES, d=COMBINING_DIACRITICS <add> ), <add> r"(?<=[{a}][{d}]),(?=[{a}])".format(a=ALPHA, d=COMBINING_DIACRITICS), <add> r"(?<=[{a}][{d}])(?:{h})(?=[{a}])".format( <add> a=ALPHA, d=COMBINING_DIACRITICS, h=HYPHENS <add> ), <add> r"(?<=[{a}][{d}])[:<>=/](?=[{a}])".format(a=ALPHA, d=COMBINING_DIACRITICS), <add>] <ide><path>spacy/lang/ru/__init__.py <ide> from .tokenizer_exceptions import TOKENIZER_EXCEPTIONS <ide> from .lex_attrs import LEX_ATTRS <ide> from .lemmatizer import RussianLemmatizer <add>from ..punctuation import COMBINING_DIACRITICS_TOKENIZER_INFIXES <add>from ..punctuation import COMBINING_DIACRITICS_TOKENIZER_SUFFIXES <ide> from ...language import Language, BaseDefaults <ide> <ide> <ide> class RussianDefaults(BaseDefaults): <ide> tokenizer_exceptions = TOKENIZER_EXCEPTIONS <ide> lex_attr_getters = LEX_ATTRS <ide> stop_words = STOP_WORDS <add> suffixes = COMBINING_DIACRITICS_TOKENIZER_SUFFIXES <add> infixes = COMBINING_DIACRITICS_TOKENIZER_INFIXES <ide> <ide> <ide> class Russian(Language): <ide><path>spacy/lang/uk/__init__.py <ide> from .stop_words import STOP_WORDS <ide> from .lex_attrs import LEX_ATTRS <ide> from .lemmatizer import UkrainianLemmatizer <add>from ..punctuation import COMBINING_DIACRITICS_TOKENIZER_INFIXES <add>from ..punctuation import COMBINING_DIACRITICS_TOKENIZER_SUFFIXES <ide> from ...language import Language, BaseDefaults <ide> <ide> <ide> class UkrainianDefaults(BaseDefaults): <ide> tokenizer_exceptions = TOKENIZER_EXCEPTIONS <ide> lex_attr_getters = LEX_ATTRS <ide> stop_words = STOP_WORDS <add> suffixes = COMBINING_DIACRITICS_TOKENIZER_SUFFIXES <add> infixes = COMBINING_DIACRITICS_TOKENIZER_INFIXES <ide> <ide> <ide> class Ukrainian(Language): <ide><path>spacy/tests/lang/bg/test_tokenizer.py <add>import pytest <add> <add> <add>def test_bg_tokenizer_handles_final_diacritics(bg_tokenizer): <add> text = "Ня̀маше яйца̀. Ня̀маше яйца̀." <add> tokens = bg_tokenizer(text) <add> assert tokens[1].text == "яйца̀" <add> assert tokens[2].text == "." <ide><path>spacy/tests/lang/ru/test_tokenizer.py <add>from string import punctuation <ide> import pytest <ide> <ide> <ide> def test_ru_tokenizer_splits_bracket_period(ru_tokenizer): <ide> text = "(Раз, два, три, проверка)." <ide> tokens = ru_tokenizer(text) <ide> assert tokens[len(tokens) - 1].text == "." <add> <add> <add>@pytest.mark.parametrize( <add> "text", <add> [ <add> "рекоменду́я подда́ть жару́. Самого́ Баргамота", <add> "РЕКОМЕНДУ́Я ПОДДА́ТЬ ЖАРУ́. САМОГО́ БАРГАМОТА", <add> "рекоменду̍я подда̍ть жару̍.Самого̍ Баргамота", <add> "рекоменду̍я подда̍ть жару̍.'Самого̍ Баргамота", <add> "рекоменду̍я подда̍ть жару̍,самого̍ Баргамота", <add> "рекоменду̍я подда̍ть жару̍:самого̍ Баргамота", <add> "рекоменду̍я подда̍ть жару̍. самого̍ Баргамота", <add> "рекоменду̍я подда̍ть жару̍, самого̍ Баргамота", <add> "рекоменду̍я подда̍ть жару̍: самого̍ Баргамота", <add> "рекоменду̍я подда̍ть жару̍-самого̍ Баргамота", <add> ], <add>) <add>def test_ru_tokenizer_handles_final_diacritics(ru_tokenizer, text): <add> tokens = ru_tokenizer(text) <add> assert tokens[2].text in ("жару́", "ЖАРУ́", "жару̍") <add> assert tokens[3].text in punctuation <add> <add> <add>@pytest.mark.parametrize( <add> "text", <add> [ <add> "РЕКОМЕНДУ́Я ПОДДА́ТЬ ЖАРУ́.САМОГО́ БАРГАМОТА", <add> "рекоменду̍я подда̍ть жару́.самого́ Баргамота", <add> ], <add>) <add>def test_ru_tokenizer_handles_final_diacritic_and_period(ru_tokenizer, text): <add> tokens = ru_tokenizer(text) <add> assert tokens[2].text.lower() == "жару́.самого́" <ide><path>spacy/tests/lang/uk/test_tokenizer.py <ide> def test_uk_tokenizer_splits_bracket_period(uk_tokenizer): <ide> text = "(Раз, два, три, проверка)." <ide> tokens = uk_tokenizer(text) <ide> assert tokens[len(tokens) - 1].text == "." <add> <add> <add>def test_uk_tokenizer_handles_final_diacritics(uk_tokenizer): <add> text = "Хлібі́в не було́. Хлібі́в не було́." <add> tokens = uk_tokenizer(text) <add> assert tokens[2].text == "було́" <add> assert tokens[3].text == "."
8
Ruby
Ruby
fix active model errors add documentation
5e3b9f27ce6599d77771cfed7915a4a98a1ed915
<ide><path>activemodel/lib/active_model/errors.rb <ide> def group_by_attribute <ide> # person.errors.messages <ide> # # => {:name=>["can't be blank"]} <ide> # <del> # person.errors.add(:name, :too_long, { count: 25 }) <add> # person.errors.add(:name, :too_long, count: 25) <ide> # person.errors.messages <ide> # # => ["is too long (maximum is 25 characters)"] <ide> # <ide> def add(attribute, type = :invalid, **options) <ide> # If the error requires options, then it returns +true+ with <ide> # the correct options, or +false+ with incorrect or missing options. <ide> # <del> # person.errors.add :name, :too_long, { count: 25 } <add> # person.errors.add :name, :too_long, count: 25 <ide> # person.errors.added? :name, :too_long, count: 25 # => true <ide> # person.errors.added? :name, "is too long (maximum is 25 characters)" # => true <ide> # person.errors.added? :name, :too_long, count: 24 # => false <ide> def added?(attribute, type = :invalid, options = {}) <ide> # present, or +false+ otherwise. +type+ is treated the same as for +add+. <ide> # <ide> # person.errors.add :age <del> # person.errors.add :name, :too_long, { count: 25 } <add> # person.errors.add :name, :too_long, count: 25 <ide> # person.errors.of_kind? :age # => true <ide> # person.errors.of_kind? :name # => false <ide> # person.errors.of_kind? :name, :too_long # => true
1
Javascript
Javascript
fix lint error
e64f50725b4fe726c83f8fb5d26511c7cabf41dc
<ide><path>src/reopen-project-menu-manager.js <ide> export default class ReopenProjectMenuManager { <ide> <ide> this.app.setJumpList([ <ide> { <del> type:'custom', <del> name:'Recent Projects', <add> type: 'custom', <add> name: 'Recent Projects', <ide> items: this.projects.map(p => ({ <ide> type: 'task', <ide> title: ReopenProjectMenuManager.createLabel(p),
1
Python
Python
add regression test for
62ff128888bce33cf87e083a921ddac65a2f1879
<ide><path>spacy/tests/regression/test_issue3951.py <add># coding: utf8 <add>from __future__ import unicode_literals <add> <add>import pytest <add>from spacy.matcher import Matcher <add>from spacy.tokens import Doc <add> <add> <add>@pytest.mark.xfail <add>def test_issue3951(en_vocab): <add> """Test that combinations of optional rules are matched correctly.""" <add> matcher = Matcher(en_vocab) <add> pattern = [ <add> {"LOWER": "hello"}, <add> {"LOWER": "this", "OP": "?"}, <add> {"OP": "?"}, <add> {"LOWER": "world"}, <add> ] <add> matcher.add("TEST", None, pattern) <add> doc = Doc(en_vocab, words=["Hello", "my", "new", "world"]) <add> matches = matcher(doc) <add> assert len(matches) == 0
1
Python
Python
remove erronous print
dc66cce16da6793efe4a4a4dcdd18db62c859abb
<ide><path>rest_framework/utils/representation.py <ide> def smart_repr(value): <ide> <ide> # Representations like u'help text' <ide> # should simply be presented as 'help text' <del> print type(value), value <ide> if value.startswith("u'") and value.endswith("'"): <ide> return value[1:] <ide>
1
Ruby
Ruby
add descriptions to option declarations
e2e4f93f06b37390ec7dbf4f8e6f498a068c1eaa
<ide><path>Library/Homebrew/cmd/search.rb <ide> module Homebrew <ide> }, <ide> }.freeze <ide> <del> def search(argv = ARGV) <del> CLI::Parser.parse(argv) do <del> switch "--desc" <add> def search_args <add> Homebrew::CLI::Parser.new do <add> usage_banner <<~EOS <add> `search`, `-S` [<options>] (<text>|`/`<text>`/`) <add> <add> Perform a substring search of cask tokens and formula names for <text>. If <text> <add> is surrounded with slashes, then it is interpreted as a regular expression. <add> The search for <text> is extended online to `homebrew/core` and `homebrew/cask`. <add> <add> If no <text> is passed, display all locally available formulae (including tapped ones). <add> No online search is performed. <add> EOS <add> switch "--casks", <add> description: "Display all locally available casks (including tapped ones). "\ <add> "No online search is performed." <add> switch "--desc", <add> description: "search formulae with a description matching <text> and casks with "\ <add> "a name matching <text>." <ide> <ide> package_manager_switches = PACKAGE_MANAGERS.keys.map { |name| "--#{name}" } <del> <ide> package_manager_switches.each do |s| <del> switch s <add> switch s, <add> description: "Search for <text> in the given package manager's list." <ide> end <del> <del> switch "--casks" <del> <add> switch :verbose <add> switch :debug <ide> conflicts(*package_manager_switches) <ide> end <add> end <add> <add> def search <add> search_args.parse <ide> <ide> if package_manager = PACKAGE_MANAGERS.find { |name,| args[:"#{name}?"] } <ide> _, url = package_manager
1
Java
Java
ensure result ready in asyncdispatch in mockmvc
6842fd7fb954e751fb6c310f7183527fd1876653
<ide><path>spring-test/src/main/java/org/springframework/test/web/servlet/request/MockMvcRequestBuilders.java <ide> /* <del> * Copyright 2002-2014 the original author or authors. <add> * Copyright 2002-2015 the original author or authors. <ide> * <ide> * Licensed under the Apache License, Version 2.0 (the "License"); <ide> * you may not use this file except in compliance with the License. <ide> public static MockMultipartHttpServletRequestBuilder fileUpload(URI uri) { <ide> * @param mvcResult the result from the request that started async processing <ide> */ <ide> public static RequestBuilder asyncDispatch(final MvcResult mvcResult) { <add> <add> // There must be an async result before dispatching <add> mvcResult.getAsyncResult(); <add> <ide> return new RequestBuilder() { <ide> @Override <ide> public MockHttpServletRequest buildRequest(ServletContext servletContext) {
1
Python
Python
forget parent meta when forgetting a chain
d15286b002d2c840cf77864104a271f0649cda51
<ide><path>celery/backends/base.py <ide> def _store_result(self, task_id, result, state, <ide> <ide> if request and getattr(request, 'group', None): <ide> meta['group_id'] = request.group <add> if request and getattr(request, 'parent_id', None): <add> meta['parent_id'] = request.parent_id <ide> <ide> if self.app.conf.find_value_for_key('extended', 'result'): <ide> if request: <ide><path>celery/backends/mongodb.py <ide> def _store_result(self, task_id, result, state, <ide> self.current_task_children(request), <ide> ), <ide> } <add> if request and getattr(request, 'parent_id', None): <add> meta['parent_id'] = request.parent_id <ide> <ide> try: <ide> self.collection.save(meta) <ide><path>celery/result.py <ide> def as_tuple(self): <ide> return (self.id, parent and parent.as_tuple()), None <ide> <ide> def forget(self): <del> """Forget about (and possibly remove the result of) this task.""" <add> """Forget the result of this task and its parents.""" <ide> self._cache = None <add> if self.parent: <add> self.parent.forget() <ide> self.backend.forget(self.id) <ide> <ide> def revoke(self, connection=None, terminate=False, signal=None, <ide><path>t/unit/backends/test_base.py <ide> def test_get_store_delete_result(self): <ide> self.b.forget(tid) <ide> assert self.b.get_state(tid) == states.PENDING <ide> <add> def test_store_result_parent_id(self): <add> tid = uuid() <add> pid = uuid() <add> state = 'SUCCESS' <add> result = 10 <add> request = Context(parent_id=pid) <add> self.b.store_result( <add> tid, state=state, result=result, request=request, <add> ) <add> stored_meta = self.b.decode(self.b.get(self.b.get_key_for_task(tid))) <add> assert stored_meta['parent_id'] == request.parent_id <add> <ide> def test_store_result_group_id(self): <ide> tid = uuid() <ide> state = 'SUCCESS' <ide><path>t/unit/backends/test_mongodb.py <ide> def test_store_result(self, mock_get_database): <ide> self.backend._store_result( <ide> sentinel.task_id, sentinel.result, sentinel.status) <ide> <add> @patch('celery.backends.mongodb.MongoBackend._get_database') <add> def test_store_result_with_request(self, mock_get_database): <add> self.backend.taskmeta_collection = MONGODB_COLLECTION <add> <add> mock_database = MagicMock(spec=['__getitem__', '__setitem__']) <add> mock_collection = Mock() <add> mock_request = MagicMock(spec=['parent_id']) <add> <add> mock_get_database.return_value = mock_database <add> mock_database.__getitem__.return_value = mock_collection <add> mock_request.parent_id = sentinel.parent_id <add> <add> ret_val = self.backend._store_result( <add> sentinel.task_id, sentinel.result, sentinel.status, <add> request=mock_request) <add> <add> mock_get_database.assert_called_once_with() <add> mock_database.__getitem__.assert_called_once_with(MONGODB_COLLECTION) <add> parameters = mock_collection.save.call_args[0][0] <add> assert parameters['parent_id'] == sentinel.parent_id <add> assert sentinel.result == ret_val <add> <add> mock_collection.save.side_effect = InvalidDocument() <add> with pytest.raises(EncodeError): <add> self.backend._store_result( <add> sentinel.task_id, sentinel.result, sentinel.status) <add> <ide> @patch('celery.backends.mongodb.MongoBackend._get_database') <ide> def test_get_task_meta_for(self, mock_get_database): <ide> self.backend.taskmeta_collection = MONGODB_COLLECTION <ide> def test_delete_group(self, mock_get_database): <ide> {'_id': sentinel.taskset_id}) <ide> <ide> @patch('celery.backends.mongodb.MongoBackend._get_database') <del> def test_forget(self, mock_get_database): <add> def test__forget(self, mock_get_database): <add> # note: here tested _forget method, not forget method <ide> self.backend.taskmeta_collection = MONGODB_COLLECTION <ide> <ide> mock_database = MagicMock(spec=['__getitem__', '__setitem__']) <ide><path>t/unit/tasks/test_result.py <ide> def mytask(): <ide> pass <ide> self.mytask = mytask <ide> <add> def test_forget(self): <add> first = Mock() <add> second = self.app.AsyncResult(self.task1['id'], parent=first) <add> third = self.app.AsyncResult(self.task2['id'], parent=second) <add> last = self.app.AsyncResult(self.task3['id'], parent=third) <add> last.forget() <add> first.forget.assert_called_once() <add> assert last.result is None <add> assert second.result is None <add> <ide> def test_ignored_getter(self): <ide> result = self.app.AsyncResult(uuid()) <ide> assert result.ignored is False
6
Text
Text
add after_commit/after_rollback to callback list
16f481b28bb1299e5aa5c610ca4c90be8482edc7
<ide><path>guides/source/active_record_callbacks.md <ide> Here is a list with all the available Active Record callbacks, listed in the sam <ide> * `around_create` <ide> * `after_create` <ide> * `after_save` <add>* `after_commit/after_rollback` <ide> <ide> ### Updating an Object <ide> <ide> Here is a list with all the available Active Record callbacks, listed in the sam <ide> * `around_update` <ide> * `after_update` <ide> * `after_save` <add>* `after_commit/after_rollback` <ide> <ide> ### Destroying an Object <ide> <ide> * `before_destroy` <ide> * `around_destroy` <ide> * `after_destroy` <add>* `after_commit/after_rollback` <ide> <ide> WARNING. `after_save` runs both on create and update, but always _after_ the more specific callbacks `after_create` and `after_update`, no matter the order in which the macro calls were executed. <ide>
1
PHP
PHP
add setmethod() to route
45474a4a9ca10e7c16db40180d086e4144006a9b
<ide><path>src/Routing/Route/Route.php <ide> <ide> use Cake\Http\ServerRequest; <ide> use Cake\Routing\Router; <add>use InvalidArgumentException; <ide> use Psr\Http\Message\ServerRequestInterface; <ide> <ide> /** <ide> class Route <ide> */ <ide> protected $_extensions = []; <ide> <add> /** <add> * Valid HTTP methods. <add> * <add> * @var array <add> */ <add> const VALID_METHODS = ['GET', 'PUT', 'POST', 'PATCH', 'DELETE', 'OPTIONS', 'HEAD']; <add> <ide> /** <ide> * Constructor for a Route <ide> * <ide> class Route <ide> public function __construct($template, $defaults = [], array $options = []) <ide> { <ide> $this->template = $template; <del> $this->defaults = (array)$defaults; <del> if (isset($this->defaults['[method]'])) { <del> $this->defaults['_method'] = $this->defaults['[method]']; <del> unset($this->defaults['[method]']); <add> // @deprecated The `[method]` format should be removed in 4.0.0 <add> if (isset($defaults['[method]'])) { <add> $defaults['_method'] = $defaults['[method]']; <add> unset($defaults['[method]']); <ide> } <add> $this->defaults = (array)$defaults; <ide> $this->options = $options + ['_ext' => []]; <ide> $this->setExtensions((array)$this->options['_ext']); <ide> } <ide> public function getExtensions() <ide> return $this->_extensions; <ide> } <ide> <add> /** <add> * Set the accepted HTTP methods for this route. <add> * <add> * @param array $methods The HTTP methods to accept. <add> * @return $this <add> * @throws \InvalidArgumentException <add> */ <add> public function setMethods(array $methods) <add> { <add> $methods = array_map('strtoupper', $methods); <add> $diff = array_diff($methods, static::VALID_METHODS); <add> if ($diff !== []) { <add> throw new InvalidArgumentException( <add> sprintf('Invalid HTTP method received. %s is invalid.', implode(', ', $diff)) <add> ); <add> } <add> $this->defaults['_method'] = $methods; <add> <add> return $this; <add> } <add> <ide> /** <ide> * Check if a Route has been compiled into a regular expression. <ide> * <ide> protected function _matchMethod($url) <ide> if (empty($this->defaults['_method'])) { <ide> return true; <ide> } <add> // @deprecated The `[method]` support should be removed in 4.0.0 <ide> if (isset($url['[method]'])) { <ide> $url['_method'] = $url['[method]']; <ide> } <ide><path>tests/TestCase/Routing/Route/RouteTest.php <ide> public function testSetState() <ide> ]; <ide> $this->assertEquals($expected, $route->parse('/', 'GET')); <ide> } <add> <add> /** <add> * Test setting the method on a route. <add> * <add> * @return void <add> */ <add> public function testSetMethods() <add> { <add> $route = new Route('/books/reviews', ['controller' => 'Reviews', 'action' => 'index']); <add> $result = $route->setMethods(['put']); <add> <add> $this->assertSame($result, $route, 'Should return this'); <add> $this->assertSame(['PUT'], $route->defaults['_method'], 'method is wrong'); <add> <add> $route->setMethods(['post', 'get', 'patch']); <add> $this->assertSame(['POST', 'GET', 'PATCH'], $route->defaults['_method']); <add> } <add> <add> /** <add> * Test setting the method on a route to an invalid method <add> * <add> * @expectedException InvalidArgumentException <add> * @expectedExceptionMessage Invalid HTTP method received. NOPE is invalid <add> * @return void <add> */ <add> public function testSetMethodsInvalid() <add> { <add> $route = new Route('/books/reviews', ['controller' => 'Reviews', 'action' => 'index']); <add> $route->setMethods(['nope']); <add> } <ide> }
2
Javascript
Javascript
apply exposure boost to aces filmic tone mapping
c3003c04a185c4d1f6b8c426d4b6520d237f3676
<ide><path>examples/js/shaders/ACESFilmicToneMappingShader.js <ide> console.warn( "THREE.ACESFilmicToneMappingShader: As part of the transition to E <ide> * <ide> * ACES Filmic Tone Mapping Shader by Stephen Hill <ide> * source: https://github.com/selfshadow/ltc_code/blob/master/webgl/shaders/ltc/ltc_blit.fs <add> * <add> * this implementation of ACES is modified to accommodate a brighter viewing environment. <add> * the scale factor of 1/0.6 is subjective. see discussion in #19621. <ide> */ <ide> <ide> THREE.ACESFilmicToneMappingShader = { <ide> THREE.ACESFilmicToneMappingShader = { <ide> <ide> ' vec4 tex = texture2D( tDiffuse, vUv );', <ide> <del> ' tex.rgb *= exposure;', // pre-exposed, outside of the tone mapping function <add> ' tex.rgb *= exposure / 0.6;', // pre-exposed, outside of the tone mapping function <ide> <ide> ' gl_FragColor = vec4( ACESFilmicToneMapping( tex.rgb ), tex.a );', <ide> <ide><path>examples/jsm/shaders/ACESFilmicToneMappingShader.js <ide> * <ide> * ACES Filmic Tone Mapping Shader by Stephen Hill <ide> * source: https://github.com/selfshadow/ltc_code/blob/master/webgl/shaders/ltc/ltc_blit.fs <add> * <add> * this implementation of ACES is modified to accommodate a brighter viewing environment. <add> * the scale factor of 1/0.6 is subjective. see discussion in #19621. <ide> */ <ide> <ide> <ide> var ACESFilmicToneMappingShader = { <ide> <ide> ' vec4 tex = texture2D( tDiffuse, vUv );', <ide> <del> ' tex.rgb *= exposure;', // pre-exposed, outside of the tone mapping function <add> ' tex.rgb *= exposure / 0.6;', // pre-exposed, outside of the tone mapping function <ide> <ide> ' gl_FragColor = vec4( ACESFilmicToneMapping( tex.rgb ), tex.a );', <ide> <ide><path>src/renderers/shaders/ShaderChunk/tonemapping_pars_fragment.glsl.js <ide> vec3 RRTAndODTFit( vec3 v ) { <ide> <ide> } <ide> <add>// this implementation of ACES is modified to accommodate a brighter viewing environment. <add>// the scale factor of 1/0.6 is subjective. see discussion in #19621. <add> <ide> vec3 ACESFilmicToneMapping( vec3 color ) { <ide> <ide> // sRGB => XYZ => D65_2_D60 => AP1 => RRT_SAT <ide> vec3 ACESFilmicToneMapping( vec3 color ) { <ide> vec3( -0.07367, -0.00605, 1.07602 ) <ide> ); <ide> <del> color *= toneMappingExposure; <add> color *= toneMappingExposure / 0.6; <ide> <ide> color = ACESInputMat * color; <ide>
3
Javascript
Javascript
add comment about where to locate grunt todo's
3ffaa0fecb571f1c5a5d2ca212e9a009fe0571a4
<ide><path>Gruntfile.js <ide> module.exports = function( grunt ) { <ide> }, <ide> tests: { <ide> // TODO: Once .jshintignore is supported, use that instead. <add> // issue located here: https://github.com/gruntjs/grunt-contrib-jshint/issues/1 <ide> src: [ "test/data/{test,testinit,testrunner}.js", "test/unit/**/*.js" ], <ide> options: { <ide> jshintrc: "test/.jshintrc"
1
PHP
PHP
add typehints to event classes
6580616bc48421aae3e7bff922f5875e0505bcaf
<ide><path>src/Console/CommandRunner.php <ide> public function getEventManager(): EventManagerInterface <ide> * @param \Cake\Event\EventManagerInterface $events The event manager to set. <ide> * @return $this <ide> */ <del> public function setEventManager(EventManagerInterface $events) <add> public function setEventManager(EventManagerInterface $events): EventDispatcherInterface <ide> { <ide> if ($this->app instanceof PluginApplicationInterface) { <ide> $this->app->setEventManager($events); <ide><path>src/Controller/Component.php <ide> public function __get($name) <ide> * <ide> * @return array <ide> */ <del> public function implementedEvents() <add> public function implementedEvents(): array <ide> { <ide> $eventMap = [ <ide> 'Controller.initialize' => 'beforeFilter', <ide><path>src/Controller/Component/AuthComponent.php <ide> use Cake\Controller\Controller; <ide> use Cake\Core\App; <ide> use Cake\Core\Exception\Exception; <add>use Cake\Event\EventDispatcherInterface; <ide> use Cake\Event\EventDispatcherTrait; <ide> use Cake\Event\EventInterface; <ide> use Cake\Http\Exception\ForbiddenException; <ide> * @property \Cake\Controller\Component\FlashComponent $Flash <ide> * @link https://book.cakephp.org/3.0/en/controllers/components/authentication.html <ide> */ <del>class AuthComponent extends Component <add>class AuthComponent extends Component implements EventDispatcherInterface <ide> { <ide> <ide> use EventDispatcherTrait; <ide> public function authCheck(EventInterface $event) <ide> * <ide> * @return array <ide> */ <del> public function implementedEvents() <add> public function implementedEvents(): array <ide> { <ide> return [ <ide> 'Controller.initialize' => 'authCheck', <ide><path>src/Controller/Component/PaginatorComponent.php <ide> public function __construct(ComponentRegistry $registry, array $config = []) <ide> * <ide> * @return array <ide> */ <del> public function implementedEvents() <add> public function implementedEvents(): array <ide> { <ide> return []; <ide> } <ide><path>src/Controller/Component/RequestHandlerComponent.php <ide> public function __construct(ComponentRegistry $registry, array $config = []) <ide> * <ide> * @return array <ide> */ <del> public function implementedEvents() <add> public function implementedEvents(): array <ide> { <ide> return [ <ide> 'Controller.startup' => 'startup', <ide><path>src/Controller/Component/SecurityComponent.php <ide> public function startup(EventInterface $event) <ide> * <ide> * @return array <ide> */ <del> public function implementedEvents() <add> public function implementedEvents(): array <ide> { <ide> return [ <ide> 'Controller.startup' => 'startup', <ide><path>src/Controller/Controller.php <ide> public function invokeAction() <ide> * <ide> * @return array <ide> */ <del> public function implementedEvents() <add> public function implementedEvents(): array <ide> { <ide> return [ <ide> 'Controller.initialize' => 'beforeFilter', <ide><path>src/Event/Decorator/AbstractDecorator.php <ide> public function __invoke() <ide> * @param array $args Arguments for the callable. <ide> * @return mixed <ide> */ <del> protected function _call($args) <add> protected function _call(array $args) <ide> { <ide> $callable = $this->_callable; <ide> <ide><path>src/Event/Decorator/ConditionDecorator.php <ide> public function __invoke() <ide> * @param \Cake\Event\EventInterface $event Event object. <ide> * @return bool <ide> */ <del> public function canTrigger(EventInterface $event) <add> public function canTrigger(EventInterface $event): bool <ide> { <ide> $if = $this->_evaluateCondition('if', $event); <ide> $unless = $this->_evaluateCondition('unless', $event); <ide> public function canTrigger(EventInterface $event) <ide> * @param \Cake\Event\EventInterface $event Event object <ide> * @return bool <ide> */ <del> protected function _evaluateCondition($condition, EventInterface $event) <add> protected function _evaluateCondition(string $condition, EventInterface $event): bool <ide> { <ide> if (!isset($this->_options[$condition])) { <ide> return $condition !== 'unless'; <ide> protected function _evaluateCondition($condition, EventInterface $event) <ide> throw new RuntimeException(self::class . ' the `' . $condition . '` condition is not a callable!'); <ide> } <ide> <del> return $this->_options[$condition]($event); <add> return (bool)$this->_options[$condition]($event); <ide> } <ide> } <ide><path>src/Event/Decorator/SubjectFilterDecorator.php <ide> public function __invoke() <ide> * @param \Cake\Event\EventInterface $event Event object. <ide> * @return bool <ide> */ <del> public function canTrigger(EventInterface $event) <add> public function canTrigger(EventInterface $event): bool <ide> { <ide> $class = get_class($event->getSubject()); <ide> if (!isset($this->_options['allowedSubject'])) { <ide><path>src/Event/Event.php <ide> class Event implements EventInterface <ide> * @param object|null $subject the object that this event applies to (usually the object that is generating the event) <ide> * @param array|\ArrayAccess|null $data any value you wish to be transported with this event to it can be read by listeners <ide> */ <del> public function __construct($name, $subject = null, $data = null) <add> public function __construct(string $name, $subject = null, $data = null) <ide> { <ide> $this->_name = $name; <ide> $this->_subject = $subject; <ide> public function __construct($name, $subject = null, $data = null) <ide> * <ide> * @return string <ide> */ <del> public function getName() <add> public function getName(): string <ide> { <ide> return $this->_name; <ide> } <ide> public function getSubject() <ide> * <ide> * @return void <ide> */ <del> public function stopPropagation() <add> public function stopPropagation(): void <ide> { <ide> $this->_stopped = true; <ide> } <ide> public function stopPropagation() <ide> * <ide> * @return bool True if the event is stopped <ide> */ <del> public function isStopped() <add> public function isStopped(): bool <ide> { <ide> return $this->_stopped; <ide> } <ide> public function getResult() <ide> * @param mixed $value The value to set. <ide> * @return $this <ide> */ <del> public function setResult($value = null) <add> public function setResult($value = null): self <ide> { <ide> $this->result = $value; <ide> <ide> public function setResult($value = null) <ide> * @return array|mixed|null The data payload if $key is null, or the data value for the given $key. If the $key does not <ide> * exist a null value is returned. <ide> */ <del> public function getData($key = null) <add> public function getData(?string $key = null) <ide> { <ide> if ($key !== null) { <ide> return isset($this->_data[$key]) ? $this->_data[$key] : null; <ide> public function getData($key = null) <ide> * @param mixed $value The value to set. <ide> * @return $this <ide> */ <del> public function setData($key, $value = null) <add> public function setData($key, $value = null): self <ide> { <ide> if (is_array($key)) { <ide> $this->_data = $key; <ide><path>src/Event/EventDispatcherInterface.php <ide> interface EventDispatcherInterface <ide> * <ide> * @return \Cake\Event\EventInterface <ide> */ <del> public function dispatchEvent($name, $data = null, $subject = null); <add> public function dispatchEvent(string $name, $data = null, $subject = null): EventInterface; <ide> <ide> /** <ide> * Sets the Cake\Event\EventManager manager instance for this object. <ide> public function dispatchEvent($name, $data = null, $subject = null); <ide> * @param \Cake\Event\EventManagerInterface $eventManager the eventManager to set <ide> * @return \Cake\Event\EventManagerInterface <ide> */ <del> public function setEventManager(EventManagerInterface $eventManager); <add> public function setEventManager(EventManagerInterface $eventManager): self; <ide> <ide> /** <ide> * Returns the Cake\Event\EventManager manager instance for this object. <ide> * <ide> * @return \Cake\Event\EventManagerInterface <ide> */ <del> public function getEventManager(); <add> public function getEventManager(): EventManagerInterface; <ide> } <ide><path>src/Event/EventDispatcherTrait.php <ide> trait EventDispatcherTrait <ide> * <ide> * @return \Cake\Event\EventManagerInterface <ide> */ <del> public function getEventManager() <add> public function getEventManager(): EventManagerInterface <ide> { <ide> if ($this->_eventManager === null) { <ide> $this->_eventManager = new EventManager(); <ide> public function getEventManager() <ide> * @param \Cake\Event\EventManagerInterface $eventManager the eventManager to set <ide> * @return $this <ide> */ <del> public function setEventManager(EventManagerInterface $eventManager) <add> public function setEventManager(EventManagerInterface $eventManager): EventDispatcherInterface <ide> { <ide> $this->_eventManager = $eventManager; <ide> <ide> public function setEventManager(EventManagerInterface $eventManager) <ide> * <ide> * @return \Cake\Event\EventInterface <ide> */ <del> public function dispatchEvent($name, $data = null, $subject = null) <add> public function dispatchEvent(string $name, $data = null, $subject = null): EventInterface <ide> { <ide> if ($subject === null) { <ide> $subject = $this; <ide><path>src/Event/EventInterface.php <ide> interface EventInterface <ide> * <ide> * @return string <ide> */ <del> public function getName(); <add> public function getName(): string; <ide> <ide> /** <ide> * Returns the subject of this event. <ide> public function getSubject(); <ide> * <ide> * @return void <ide> */ <del> public function stopPropagation(); <add> public function stopPropagation(): void; <ide> <ide> /** <ide> * Checks if the event is stopped. <ide> * <ide> * @return bool True if the event is stopped <ide> */ <del> public function isStopped(); <add> public function isStopped(): bool; <ide> <ide> /** <ide> * The result value of the event listeners. <ide> public function setResult($value = null); <ide> * @return array|mixed|null The data payload if $key is null, or the data value for the given $key. If the $key does not <ide> * exist a null value is returned. <ide> */ <del> public function getData($key = null); <add> public function getData(?string $key = null); <ide> <ide> /** <ide> * Assigns a value to the data/payload of this event. <ide><path>src/Event/EventList.php <ide> public function flush() <ide> * @param \Cake\Event\EventInterface $event An event to the list of dispatched events. <ide> * @return void <ide> */ <del> public function add(EventInterface $event) <add> public function add(EventInterface $event): void <ide> { <ide> $this->_events[] = $event; <ide> } <ide> public function add(EventInterface $event) <ide> * @param mixed $offset An offset to check for. <ide> * @return bool True on success or false on failure. <ide> */ <del> public function offsetExists($offset) <add> public function offsetExists($offset): bool <ide> { <ide> return isset($this->_events[$offset]); <ide> } <ide> public function offsetGet($offset) <ide> * @param mixed $value The value to set. <ide> * @return void <ide> */ <del> public function offsetSet($offset, $value) <add> public function offsetSet($offset, $value): void <ide> { <ide> $this->_events[$offset] = $value; <ide> } <ide> public function offsetSet($offset, $value) <ide> * @param mixed $offset The offset to unset. <ide> * @return void <ide> */ <del> public function offsetUnset($offset) <add> public function offsetUnset($offset): void <ide> { <ide> unset($this->_events[$offset]); <ide> } <ide> public function offsetUnset($offset) <ide> * @link https://secure.php.net/manual/en/countable.count.php <ide> * @return int The custom count as an integer. <ide> */ <del> public function count() <add> public function count(): int <ide> { <ide> return count($this->_events); <ide> } <ide> public function count() <ide> * @param string $name Event name. <ide> * @return bool <ide> */ <del> public function hasEvent($name) <add> public function hasEvent($name): bool <ide> { <ide> foreach ($this->_events as $event) { <ide> if ($event->getName() === $name) { <ide><path>src/Event/EventListenerInterface.php <ide> interface EventListenerInterface <ide> * @return array associative array or event key names pointing to the function <ide> * that should be called in the object when the respective event is fired <ide> */ <del> public function implementedEvents(); <add> public function implementedEvents(): array; <ide> } <ide><path>src/Event/EventManager.php <ide> class EventManager implements EventManagerInterface <ide> * @param \Cake\Event\EventManager|null $manager Event manager instance. <ide> * @return static The global event manager <ide> */ <del> public static function instance($manager = null) <add> public static function instance(?EventManagerInterface $manager = null) <ide> { <del> if ($manager instanceof EventManager) { <add> if ($manager instanceof EventManagerInterface) { <ide> static::$_generalManager = $manager; <ide> } <ide> if (empty(static::$_generalManager)) { <ide> public static function instance($manager = null) <ide> /** <ide> * {@inheritDoc} <ide> */ <del> public function on($eventKey = null, $options = [], $callable = null) <add> public function on($eventKey = null, $options = [], $callable = null): EventManagerInterface <ide> { <ide> if ($eventKey instanceof EventListenerInterface) { <ide> $this->_attachSubscriber($eventKey); <ide> public function on($eventKey = null, $options = [], $callable = null) <ide> * @param \Cake\Event\EventListenerInterface $subscriber Event listener. <ide> * @return void <ide> */ <del> protected function _attachSubscriber(EventListenerInterface $subscriber) <add> protected function _attachSubscriber(EventListenerInterface $subscriber): void <ide> { <ide> foreach ((array)$subscriber->implementedEvents() as $eventKey => $function) { <ide> $options = []; <ide> protected function _attachSubscriber(EventListenerInterface $subscriber) <ide> * @param \Cake\Event\EventListenerInterface $object The handler object <ide> * @return callable <ide> */ <del> protected function _extractCallable($function, $object) <add> protected function _extractCallable(array $function, EventListenerInterface $object) <ide> { <ide> $method = $function['callable']; <ide> $options = $function; <ide> protected function _extractCallable($function, $object) <ide> /** <ide> * {@inheritDoc} <ide> */ <del> public function off($eventKey, $callable = null) <add> public function off($eventKey, $callable = null): EventManagerInterface <ide> { <ide> if ($eventKey instanceof EventListenerInterface) { <ide> $this->_detachSubscriber($eventKey); <ide> public function off($eventKey, $callable = null) <ide> * @param string|null $eventKey optional event key name to unsubscribe the listener from <ide> * @return void <ide> */ <del> protected function _detachSubscriber(EventListenerInterface $subscriber, $eventKey = null) <add> protected function _detachSubscriber(EventListenerInterface $subscriber, ?string $eventKey = null): void <ide> { <ide> $events = (array)$subscriber->implementedEvents(); <ide> if (!empty($eventKey) && empty($events[$eventKey])) { <ide> protected function _detachSubscriber(EventListenerInterface $subscriber, $eventK <ide> /** <ide> * {@inheritDoc} <ide> */ <del> public function dispatch($event) <add> public function dispatch($event): EventInterface <ide> { <ide> if (is_string($event)) { <ide> $event = new Event($event); <ide> protected function _callListener(callable $listener, EventInterface $event) <ide> /** <ide> * {@inheritDoc} <ide> */ <del> public function listeners($eventKey) <add> public function listeners(string $eventKey): array <ide> { <ide> $localListeners = []; <ide> if (!$this->_isGlobal) { <ide><path>src/Event/EventManagerInterface.php <ide> interface EventManagerInterface <ide> * @throws \InvalidArgumentException When event key is missing or callable is not an <ide> * instance of Cake\Event\EventListenerInterface. <ide> */ <del> public function on($eventKey = null, $options = [], $callable = null); <add> public function on($eventKey = null, $options = [], $callable = null): self; <ide> <ide> /** <ide> * Remove a listener from the active listeners. <ide> public function on($eventKey = null, $options = [], $callable = null); <ide> * @param callable|null $callable The callback you want to detach. <ide> * @return $this <ide> */ <del> public function off($eventKey, $callable = null); <add> public function off($eventKey, $callable = null): self; <ide> <ide> /** <ide> * Dispatches a new event to all configured listeners <ide> public function off($eventKey, $callable = null); <ide> * @return \Cake\Event\EventInterface <ide> * @triggers $event <ide> */ <del> public function dispatch($event); <add> public function dispatch($event): EventInterface; <ide> <ide> /** <ide> * Returns a list of all listeners for an eventKey in the order they should be called <ide> * <ide> * @param string $eventKey Event key. <ide> * @return array <ide> */ <del> public function listeners($eventKey); <add> public function listeners(string $eventKey): array; <ide> } <ide><path>src/Form/Form.php <ide> public function __construct(EventManager $eventManager = null) <ide> * <ide> * @return array <ide> */ <del> public function implementedEvents() <add> public function implementedEvents(): array <ide> { <ide> if (method_exists($this, 'buildValidator')) { <ide> return [ <ide><path>src/Http/ActionDispatcher.php <ide> namespace Cake\Http; <ide> <ide> use Cake\Controller\Controller; <add>use Cake\Event\EventDispatcherInterface; <ide> use Cake\Event\EventDispatcherTrait; <ide> use Cake\Routing\Router; <ide> use LogicException; <ide> * Long term this should just be the controller dispatcher, but <ide> * for now it will do a bit more than that. <ide> */ <del>class ActionDispatcher <add>class ActionDispatcher implements EventDispatcherInterface <ide> { <ide> use EventDispatcherTrait; <ide> <ide><path>src/Http/Server.php <ide> public function setRunner(Runner $runner) <ide> * <ide> * @return \Cake\Event\EventManagerInterface <ide> */ <del> public function getEventManager() <add> public function getEventManager(): EventManagerInterface <ide> { <ide> if ($this->app instanceof PluginApplicationInterface) { <ide> return $this->app->getEventManager(); <ide> public function getEventManager() <ide> * @param \Cake\Event\EventManagerInterface $eventManager The event manager to set. <ide> * @return $this <ide> */ <del> public function setEventManager(EventManagerInterface $eventManager) <add> public function setEventManager(EventManagerInterface $eventManager): EventDispatcherInterface <ide> { <ide> if ($this->app instanceof PluginApplicationInterface) { <ide> $this->app->setEventManager($eventManager); <ide><path>src/Mailer/Mailer.php <ide> * registration event: <ide> * <ide> * ``` <del> * public function implementedEvents() <add> * public function implementedEvents(): array <ide> * { <ide> * return [ <ide> * 'Model.afterSave' => 'onRegistration', <ide> protected function reset() <ide> * <ide> * @return array <ide> */ <del> public function implementedEvents() <add> public function implementedEvents(): array <ide> { <ide> return []; <ide> } <ide><path>src/ORM/Behavior.php <ide> public function verifyConfig() <ide> * <ide> * @return array <ide> */ <del> public function implementedEvents() <add> public function implementedEvents(): array <ide> { <ide> $eventMap = [ <ide> 'Model.beforeMarshal' => 'beforeMarshal', <ide><path>src/ORM/Behavior/TimestampBehavior.php <ide> public function handleEvent(EventInterface $event, EntityInterface $entity) <ide> * <ide> * @return array <ide> */ <del> public function implementedEvents() <add> public function implementedEvents(): array <ide> { <ide> return array_fill_keys(array_keys($this->_config['events']), 'handleEvent'); <ide> } <ide><path>src/ORM/Table.php <ide> public function validateUnique($value, array $options, array $context = null) <ide> * <ide> * @return array <ide> */ <del> public function implementedEvents() <add> public function implementedEvents(): array <ide> { <ide> $eventMap = [ <ide> 'Model.beforeMarshal' => 'beforeMarshal', <ide><path>src/View/Cell.php <ide> use BadMethodCallException; <ide> use Cake\Cache\Cache; <ide> use Cake\Datasource\ModelAwareTrait; <add>use Cake\Event\EventDispatcherInterface; <ide> use Cake\Event\EventDispatcherTrait; <del>use Cake\Event\EventManager; <add>use Cake\Event\EventManagerInterface; <ide> use Cake\Http\Response; <ide> use Cake\Http\ServerRequest; <ide> use Cake\ORM\Locator\LocatorAwareTrait; <ide> /** <ide> * Cell base. <ide> */ <del>abstract class Cell <add>abstract class Cell implements EventDispatcherInterface <ide> { <del> <ide> use EventDispatcherTrait; <ide> use LocatorAwareTrait; <ide> use ModelAwareTrait; <ide> abstract class Cell <ide> * <ide> * @param \Cake\Http\ServerRequest|null $request The request to use in the cell. <ide> * @param \Cake\Http\Response|null $response The response to use in the cell. <del> * @param \Cake\Event\EventManager|null $eventManager The eventManager to bind events to. <add> * @param \Cake\Event\EventManagerInterface|null $eventManager The eventManager to bind events to. <ide> * @param array $cellOptions Cell options to apply. <ide> */ <ide> public function __construct( <ide> ServerRequest $request = null, <ide> Response $response = null, <del> EventManager $eventManager = null, <add> EventManagerInterface $eventManager = null, <ide> array $cellOptions = [] <ide> ) { <ide> if ($eventManager !== null) { <ide><path>src/View/Helper.php <ide> public function addClass(array $options = [], $class = null, $key = 'class') <ide> * <ide> * @return array <ide> */ <del> public function implementedEvents() <add> public function implementedEvents(): array <ide> { <ide> $eventMap = [ <ide> 'View.beforeRenderFile' => 'beforeRenderFile', <ide><path>src/View/Helper/FlashHelper.php <ide> public function render($key = 'flash', array $options = []) <ide> * <ide> * @return array <ide> */ <del> public function implementedEvents() <add> public function implementedEvents(): array <ide> { <ide> return []; <ide> } <ide><path>src/View/Helper/FormHelper.php <ide> public function resetTemplates() <ide> * <ide> * @return array <ide> */ <del> public function implementedEvents() <add> public function implementedEvents(): array <ide> { <ide> return []; <ide> } <ide><path>src/View/Helper/HtmlHelper.php <ide> protected function _nestedListItem($items, $options, $itemOptions) <ide> * <ide> * @return array <ide> */ <del> public function implementedEvents() <add> public function implementedEvents(): array <ide> { <ide> return []; <ide> } <ide><path>src/View/Helper/NumberHelper.php <ide> public function defaultCurrency($currency) <ide> * <ide> * @return array <ide> */ <del> public function implementedEvents() <add> public function implementedEvents(): array <ide> { <ide> return []; <ide> } <ide><path>src/View/Helper/PaginatorHelper.php <ide> public function meta(array $options = []) <ide> * <ide> * @return array <ide> */ <del> public function implementedEvents() <add> public function implementedEvents(): array <ide> { <ide> return []; <ide> } <ide><path>src/View/Helper/TextHelper.php <ide> public function toList($list, $and = null, $separator = ', ') <ide> * <ide> * @return array <ide> */ <del> public function implementedEvents() <add> public function implementedEvents(): array <ide> { <ide> return []; <ide> } <ide><path>src/View/Helper/TimeHelper.php <ide> public function i18nFormat($date, $format = null, $invalid = false, $timezone = <ide> * <ide> * @return array <ide> */ <del> public function implementedEvents() <add> public function implementedEvents(): array <ide> { <ide> return []; <ide> } <ide><path>src/View/Helper/UrlHelper.php <ide> protected function _inflectThemeName($name) <ide> * <ide> * @return array <ide> */ <del> public function implementedEvents() <add> public function implementedEvents(): array <ide> { <ide> return []; <ide> } <ide><path>tests/TestCase/Event/EventDispatcherTraitTest.php <ide> * @since 3.0.0 <ide> * @license https://opensource.org/licenses/mit-license.php MIT License <ide> */ <del> <ide> namespace Cake\Test\TestCase\Event; <ide> <ide> use Cake\Event\Event; <ide> public function testGetEventManager() <ide> $this->assertInstanceOf(EventManager::class, $this->subject->getEventManager()); <ide> } <ide> <del> /** <del> * testSetEventManager <del> * <del> * @return void <del> */ <del> public function testSetEventManager() <del> { <del> $eventManager = new EventManager(); <del> <del> $this->subject->setEventManager($eventManager); <del> <del> $this->assertSame($eventManager, $this->subject->getEventManager()); <del> } <del> <ide> /** <ide> * testDispatchEvent <ide> * <ide><path>tests/TestCase/Event/EventManagerTest.php <ide> public function stopListener($event) <ide> class CustomTestEventListenerInterface extends EventTestListener implements EventListenerInterface <ide> { <ide> <del> public function implementedEvents() <add> public function implementedEvents(): array <ide> { <ide> return [ <ide> 'fake.event' => 'listenerFunction', <ide><path>tests/TestCase/ORM/BehaviorTest.php <ide> public function verifyConfig() <ide> * <ide> * @return void <ide> */ <del> public function implementedEvents() <add> public function implementedEvents(): array <ide> { <ide> return ['Model.beforeFind' => 'beforeFind']; <ide> } <ide><path>tests/TestCase/ORM/TableTest.php <ide> public function testDeleteBeforeDeleteAbort() <ide> ->method('dispatch') <ide> ->will($this->returnCallback(function (EventInterface $event) { <ide> $event->stopPropagation(); <add> <add> return $event; <ide> })); <ide> <ide> $table = $this->getTableLocator()->get('users', ['eventManager' => $mock]); <ide> public function testDeleteBeforeDeleteReturnResult() <ide> ->will($this->returnCallback(function (EventInterface $event) { <ide> $event->stopPropagation(); <ide> $event->setResult('got stopped'); <add> <add> return $event; <ide> })); <ide> <ide> $table = $this->getTableLocator()->get('users', ['eventManager' => $mock]); <ide><path>tests/TestCase/View/ViewTest.php <ide> class TestViewEventListenerInterface implements EventListenerInterface <ide> * <ide> * @return array <ide> */ <del> public function implementedEvents() <add> public function implementedEvents(): array <ide> { <ide> return [ <ide> 'View.beforeRender' => 'beforeRender', <ide><path>tests/test_app/TestApp/View/Helper/EventListenerTestHelper.php <ide> public function beforeRender(EventInterface $event, $viewFile) <ide> * <ide> * @return array <ide> */ <del> public function implementedEvents() <add> public function implementedEvents(): array <ide> { <ide> return ['View.beforeRender' => 'beforeRender']; <ide> }
41
Go
Go
use gocheck asserts instead of fatal
eedeeaf49c49cc75ab30a01676736637224ddd8a
<ide><path>integration-cli/docker_cli_inspect_test.go <ide> import ( <ide> "time" <ide> <ide> "github.com/docker/docker/api/types" <add> "github.com/docker/docker/pkg/integration/checker" <ide> "github.com/docker/docker/runconfig" <ide> "github.com/go-check/check" <ide> ) <ide> <add>func checkValidGraphDriver(c *check.C, name string) { <add> if name != "devicemapper" && name != "overlay" && name != "vfs" && name != "zfs" && name != "btrfs" && name != "aufs" { <add> c.Fatalf("%v is not a valid graph driver name", name) <add> } <add>} <add> <ide> func (s *DockerSuite) TestInspectImage(c *check.C) { <ide> testRequires(c, DaemonIsLinux) <ide> imageTest := "emptyfs" <ide> imageTestID := "511136ea3c5a64f264b78b5433614aec563103b4d4702f3ba7d4d2698e22c158" <ide> id, err := inspectField(imageTest, "Id") <del> c.Assert(err, check.IsNil) <add> c.Assert(err, checker.IsNil) <ide> <del> if id != imageTestID { <del> c.Fatalf("Expected id: %s for image: %s but received id: %s", imageTestID, imageTest, id) <del> } <add> c.Assert(id, checker.Equals, imageTestID) <ide> } <ide> <ide> func (s *DockerSuite) TestInspectInt64(c *check.C) { <ide> func (s *DockerSuite) TestInspectInt64(c *check.C) { <ide> dockerCmd(c, "run", "-d", "-m=300M", "--name", "inspectTest", "busybox", "true") <ide> inspectOut, err := inspectField("inspectTest", "HostConfig.Memory") <ide> c.Assert(err, check.IsNil) <del> <del> if inspectOut != "314572800" { <del> c.Fatalf("inspect got wrong value, got: %q, expected: 314572800", inspectOut) <del> } <add> c.Assert(inspectOut, checker.Equals, "314572800") <ide> } <ide> <ide> func (s *DockerSuite) TestInspectDefault(c *check.C) { <ide> func (s *DockerSuite) TestInspectStatus(c *check.C) { <ide> out = strings.TrimSpace(out) <ide> <ide> inspectOut, err := inspectField(out, "State.Status") <del> c.Assert(err, check.IsNil) <del> if inspectOut != "running" { <del> c.Fatalf("inspect got wrong status, got: %q, expected: running", inspectOut) <del> } <add> c.Assert(err, checker.IsNil) <add> c.Assert(inspectOut, checker.Equals, "running") <ide> <ide> dockerCmd(c, "pause", out) <ide> inspectOut, err = inspectField(out, "State.Status") <del> c.Assert(err, check.IsNil) <del> if inspectOut != "paused" { <del> c.Fatalf("inspect got wrong status, got: %q, expected: paused", inspectOut) <del> } <add> c.Assert(err, checker.IsNil) <add> c.Assert(inspectOut, checker.Equals, "paused") <ide> <ide> dockerCmd(c, "unpause", out) <ide> inspectOut, err = inspectField(out, "State.Status") <del> c.Assert(err, check.IsNil) <del> if inspectOut != "running" { <del> c.Fatalf("inspect got wrong status, got: %q, expected: running", inspectOut) <del> } <add> c.Assert(err, checker.IsNil) <add> c.Assert(inspectOut, checker.Equals, "running") <ide> <ide> dockerCmd(c, "stop", out) <ide> inspectOut, err = inspectField(out, "State.Status") <del> c.Assert(err, check.IsNil) <del> if inspectOut != "exited" { <del> c.Fatalf("inspect got wrong status, got: %q, expected: exited", inspectOut) <del> } <add> c.Assert(err, checker.IsNil) <add> c.Assert(inspectOut, checker.Equals, "exited") <add> <ide> } <ide> <ide> func (s *DockerSuite) TestInspectTypeFlagContainer(c *check.C) { <ide> func (s *DockerSuite) TestInspectTypeFlagContainer(c *check.C) { <ide> dockerCmd(c, "run", "--name=busybox", "-d", "busybox", "top") <ide> <ide> formatStr := fmt.Sprintf("--format='{{.State.Running}}'") <del> out, exitCode, err := dockerCmdWithError("inspect", "--type=container", formatStr, "busybox") <del> if exitCode != 0 || err != nil { <del> c.Fatalf("failed to inspect container: %s, %v", out, err) <del> } <del> <del> if out != "true\n" { <del> c.Fatal("not a container JSON") <del> } <add> out, _ := dockerCmd(c, "inspect", "--type=container", formatStr, "busybox") <add> c.Assert(out, checker.Equals, "true\n") // not a container JSON <ide> } <ide> <ide> func (s *DockerSuite) TestInspectTypeFlagWithNoContainer(c *check.C) { <ide> func (s *DockerSuite) TestInspectTypeFlagWithNoContainer(c *check.C) { <ide> <ide> dockerCmd(c, "run", "-d", "busybox", "true") <ide> <del> _, exitCode, err := dockerCmdWithError("inspect", "--type=container", "busybox") <del> if exitCode == 0 || err == nil { <del> c.Fatalf("docker inspect should have failed, as there is no container named busybox") <del> } <add> _, _, err := dockerCmdWithError("inspect", "--type=container", "busybox") <add> // docker inspect should fail, as there is no container named busybox <add> c.Assert(err, checker.NotNil) <ide> } <ide> <ide> func (s *DockerSuite) TestInspectTypeFlagWithImage(c *check.C) { <ide> func (s *DockerSuite) TestInspectTypeFlagWithImage(c *check.C) { <ide> <ide> dockerCmd(c, "run", "--name=busybox", "-d", "busybox", "true") <ide> <del> out, exitCode, err := dockerCmdWithError("inspect", "--type=image", "busybox") <del> if exitCode != 0 || err != nil { <del> c.Fatalf("failed to inspect image: %s, %v", out, err) <del> } <del> <del> if strings.Contains(out, "State") { <del> c.Fatal("not an image JSON") <del> } <add> out, _ := dockerCmd(c, "inspect", "--type=image", "busybox") <add> c.Assert(out, checker.Not(checker.Contains), "State") // not an image JSON <ide> } <ide> <ide> func (s *DockerSuite) TestInspectTypeFlagWithInvalidValue(c *check.C) { <ide> func (s *DockerSuite) TestInspectTypeFlagWithInvalidValue(c *check.C) { <ide> dockerCmd(c, "run", "--name=busybox", "-d", "busybox", "true") <ide> <ide> out, exitCode, err := dockerCmdWithError("inspect", "--type=foobar", "busybox") <del> if exitCode != 0 || err != nil { <del> if !strings.Contains(out, "not a valid value for --type") { <del> c.Fatalf("failed to inspect image: %s, %v", out, err) <del> } <del> } <add> c.Assert(err, checker.NotNil, check.Commentf("%s", exitCode)) <add> c.Assert(exitCode, checker.Equals, 1, check.Commentf("%s", err)) <add> c.Assert(out, checker.Contains, "not a valid value for --type") <ide> } <ide> <ide> func (s *DockerSuite) TestInspectImageFilterInt(c *check.C) { <ide> testRequires(c, DaemonIsLinux) <ide> imageTest := "emptyfs" <ide> out, err := inspectField(imageTest, "Size") <del> c.Assert(err, check.IsNil) <add> c.Assert(err, checker.IsNil) <ide> <ide> size, err := strconv.Atoi(out) <del> if err != nil { <del> c.Fatalf("failed to inspect size of the image: %s, %v", out, err) <del> } <add> c.Assert(err, checker.IsNil, check.Commentf("failed to inspect size of the image: %s, %v", out, err)) <ide> <ide> //now see if the size turns out to be the same <ide> formatStr := fmt.Sprintf("--format='{{eq .Size %d}}'", size) <del> out, exitCode, err := dockerCmdWithError("inspect", formatStr, imageTest) <del> if exitCode != 0 || err != nil { <del> c.Fatalf("failed to inspect image: %s, %v", out, err) <del> } <del> if result, err := strconv.ParseBool(strings.TrimSuffix(out, "\n")); err != nil || !result { <del> c.Fatalf("Expected size: %d for image: %s but received size: %s", size, imageTest, strings.TrimSuffix(out, "\n")) <del> } <add> out, _ = dockerCmd(c, "inspect", formatStr, imageTest) <add> result, err := strconv.ParseBool(strings.TrimSuffix(out, "\n")) <add> c.Assert(err, checker.IsNil) <add> c.Assert(result, checker.Equals, true) <ide> } <ide> <ide> func (s *DockerSuite) TestInspectContainerFilterInt(c *check.C) { <ide> testRequires(c, DaemonIsLinux) <ide> runCmd := exec.Command(dockerBinary, "run", "-i", "-a", "stdin", "busybox", "cat") <ide> runCmd.Stdin = strings.NewReader("blahblah") <ide> out, _, _, err := runCommandWithStdoutStderr(runCmd) <del> if err != nil { <del> c.Fatalf("failed to run container: %v, output: %q", err, out) <del> } <add> c.Assert(err, checker.IsNil, check.Commentf("failed to run container: %v, output: %q", err, out)) <ide> <ide> id := strings.TrimSpace(out) <ide> <ide> out, err = inspectField(id, "State.ExitCode") <del> c.Assert(err, check.IsNil) <add> c.Assert(err, checker.IsNil) <ide> <ide> exitCode, err := strconv.Atoi(out) <del> if err != nil { <del> c.Fatalf("failed to inspect exitcode of the container: %s, %v", out, err) <del> } <add> c.Assert(err, checker.IsNil, check.Commentf("failed to inspect exitcode of the container: %s, %v", out, err)) <ide> <ide> //now get the exit code to verify <ide> formatStr := fmt.Sprintf("--format='{{eq .State.ExitCode %d}}'", exitCode) <ide> out, _ = dockerCmd(c, "inspect", formatStr, id) <del> if result, err := strconv.ParseBool(strings.TrimSuffix(out, "\n")); err != nil || !result { <del> c.Fatalf("Expected exitcode: %d for container: %s", exitCode, id) <del> } <add> result, err := strconv.ParseBool(strings.TrimSuffix(out, "\n")) <add> c.Assert(err, checker.IsNil) <add> c.Assert(result, checker.Equals, true) <ide> } <ide> <ide> func (s *DockerSuite) TestInspectImageGraphDriver(c *check.C) { <ide> testRequires(c, DaemonIsLinux) <ide> imageTest := "emptyfs" <ide> name, err := inspectField(imageTest, "GraphDriver.Name") <del> c.Assert(err, check.IsNil) <add> c.Assert(err, checker.IsNil) <ide> <del> if name != "devicemapper" && name != "overlay" && name != "vfs" && name != "zfs" && name != "btrfs" && name != "aufs" { <del> c.Fatalf("%v is not a valid graph driver name", name) <del> } <add> checkValidGraphDriver(c, name) <ide> <ide> if name != "devicemapper" { <del> return <add> c.Skip("requires devicemapper graphdriver") <ide> } <ide> <ide> deviceID, err := inspectField(imageTest, "GraphDriver.Data.DeviceId") <del> c.Assert(err, check.IsNil) <add> c.Assert(err, checker.IsNil) <ide> <ide> _, err = strconv.Atoi(deviceID) <del> if err != nil { <del> c.Fatalf("failed to inspect DeviceId of the image: %s, %v", deviceID, err) <del> } <add> c.Assert(err, checker.IsNil, check.Commentf("failed to inspect DeviceId of the image: %s, %v", deviceID, err)) <ide> <ide> deviceSize, err := inspectField(imageTest, "GraphDriver.Data.DeviceSize") <del> c.Assert(err, check.IsNil) <add> c.Assert(err, checker.IsNil) <ide> <ide> _, err = strconv.ParseUint(deviceSize, 10, 64) <del> if err != nil { <del> c.Fatalf("failed to inspect DeviceSize of the image: %s, %v", deviceSize, err) <del> } <add> c.Assert(err, checker.IsNil, check.Commentf("failed to inspect DeviceSize of the image: %s, %v", deviceSize, err)) <ide> } <ide> <ide> func (s *DockerSuite) TestInspectContainerGraphDriver(c *check.C) { <ide> func (s *DockerSuite) TestInspectContainerGraphDriver(c *check.C) { <ide> out = strings.TrimSpace(out) <ide> <ide> name, err := inspectField(out, "GraphDriver.Name") <del> c.Assert(err, check.IsNil) <add> c.Assert(err, checker.IsNil) <ide> <del> if name != "devicemapper" && name != "overlay" && name != "vfs" && name != "zfs" && name != "btrfs" && name != "aufs" { <del> c.Fatalf("%v is not a valid graph driver name", name) <del> } <add> checkValidGraphDriver(c, name) <ide> <ide> if name != "devicemapper" { <ide> return <ide> } <ide> <ide> deviceID, err := inspectField(out, "GraphDriver.Data.DeviceId") <del> c.Assert(err, check.IsNil) <add> c.Assert(err, checker.IsNil) <ide> <ide> _, err = strconv.Atoi(deviceID) <del> if err != nil { <del> c.Fatalf("failed to inspect DeviceId of the image: %s, %v", deviceID, err) <del> } <add> c.Assert(err, checker.IsNil, check.Commentf("failed to inspect DeviceId of the image: %s, %v", deviceID, err)) <ide> <ide> deviceSize, err := inspectField(out, "GraphDriver.Data.DeviceSize") <del> c.Assert(err, check.IsNil) <add> c.Assert(err, checker.IsNil) <ide> <ide> _, err = strconv.ParseUint(deviceSize, 10, 64) <del> if err != nil { <del> c.Fatalf("failed to inspect DeviceSize of the image: %s, %v", deviceSize, err) <del> } <add> c.Assert(err, checker.IsNil, check.Commentf("failed to inspect DeviceSize of the image: %s, %v", deviceSize, err)) <ide> } <ide> <ide> func (s *DockerSuite) TestInspectBindMountPoint(c *check.C) { <ide> testRequires(c, DaemonIsLinux) <ide> dockerCmd(c, "run", "-d", "--name", "test", "-v", "/data:/data:ro,z", "busybox", "cat") <ide> <ide> vol, err := inspectFieldJSON("test", "Mounts") <del> c.Assert(err, check.IsNil) <add> c.Assert(err, checker.IsNil) <ide> <ide> var mp []types.MountPoint <ide> err = unmarshalJSON([]byte(vol), &mp) <del> c.Assert(err, check.IsNil) <add> c.Assert(err, checker.IsNil) <ide> <del> if len(mp) != 1 { <del> c.Fatalf("Expected 1 mount point, was %v\n", len(mp)) <del> } <add> // check that there is only one mountpoint <add> c.Assert(mp, check.HasLen, 1) <ide> <ide> m := mp[0] <ide> <del> if m.Name != "" { <del> c.Fatal("Expected name to be empty") <del> } <del> <del> if m.Driver != "" { <del> c.Fatal("Expected driver to be empty") <del> } <del> <del> if m.Source != "/data" { <del> c.Fatalf("Expected source /data, was %s\n", m.Source) <del> } <del> <del> if m.Destination != "/data" { <del> c.Fatalf("Expected destination /data, was %s\n", m.Destination) <del> } <del> <del> if m.Mode != "ro,z" { <del> c.Fatalf("Expected mode `ro,z`, was %s\n", m.Mode) <del> } <del> <del> if m.RW != false { <del> c.Fatalf("Expected rw to be false") <del> } <add> c.Assert(m.Name, checker.Equals, "") <add> c.Assert(m.Driver, checker.Equals, "") <add> c.Assert(m.Source, checker.Equals, "/data") <add> c.Assert(m.Destination, checker.Equals, "/data") <add> c.Assert(m.Mode, checker.Equals, "ro,z") <add> c.Assert(m.RW, checker.Equals, false) <ide> } <ide> <ide> // #14947 <ide> func (s *DockerSuite) TestInspectTimesAsRFC3339Nano(c *check.C) { <ide> out, _ := dockerCmd(c, "run", "-d", "busybox", "true") <ide> id := strings.TrimSpace(out) <ide> startedAt, err := inspectField(id, "State.StartedAt") <del> c.Assert(err, check.IsNil) <add> c.Assert(err, checker.IsNil) <ide> finishedAt, err := inspectField(id, "State.FinishedAt") <del> c.Assert(err, check.IsNil) <add> c.Assert(err, checker.IsNil) <ide> created, err := inspectField(id, "Created") <del> c.Assert(err, check.IsNil) <add> c.Assert(err, checker.IsNil) <ide> <ide> _, err = time.Parse(time.RFC3339Nano, startedAt) <del> c.Assert(err, check.IsNil) <add> c.Assert(err, checker.IsNil) <ide> _, err = time.Parse(time.RFC3339Nano, finishedAt) <del> c.Assert(err, check.IsNil) <add> c.Assert(err, checker.IsNil) <ide> _, err = time.Parse(time.RFC3339Nano, created) <del> c.Assert(err, check.IsNil) <add> c.Assert(err, checker.IsNil) <ide> <ide> created, err = inspectField("busybox", "Created") <del> c.Assert(err, check.IsNil) <add> c.Assert(err, checker.IsNil) <ide> <ide> _, err = time.Parse(time.RFC3339Nano, created) <del> c.Assert(err, check.IsNil) <add> c.Assert(err, checker.IsNil) <ide> } <ide> <ide> // #15633 <ide> func (s *DockerSuite) TestInspectLogConfigNoType(c *check.C) { <ide> var logConfig runconfig.LogConfig <ide> <ide> out, err := inspectFieldJSON("test", "HostConfig.LogConfig") <del> c.Assert(err, check.IsNil) <add> c.Assert(err, checker.IsNil, check.Commentf("%v", out)) <ide> <ide> err = json.NewDecoder(strings.NewReader(out)).Decode(&logConfig) <del> c.Assert(err, check.IsNil) <add> c.Assert(err, checker.IsNil, check.Commentf("%v", out)) <ide> <del> c.Assert(logConfig.Type, check.Equals, "json-file") <del> c.Assert(logConfig.Config["max-file"], check.Equals, "42", check.Commentf("%v", logConfig)) <add> c.Assert(logConfig.Type, checker.Equals, "json-file") <add> c.Assert(logConfig.Config["max-file"], checker.Equals, "42", check.Commentf("%v", logConfig)) <ide> } <ide> <ide> func (s *DockerSuite) TestInspectNoSizeFlagContainer(c *check.C) {
1
Go
Go
move some `api` package functions away
565aa41392b01251dfc9398eb69c23bdd8ea64e6
<ide><path>api/common.go <ide> import ( <ide> "encoding/json" <ide> "encoding/pem" <ide> "fmt" <del> "mime" <ide> "os" <ide> "path/filepath" <del> "sort" <del> "strconv" <del> "strings" <ide> <del> "github.com/Sirupsen/logrus" <del> "github.com/docker/docker/api/types" <ide> "github.com/docker/docker/pkg/ioutils" <ide> "github.com/docker/docker/pkg/system" <ide> "github.com/docker/libtrust" <ide> const ( <ide> NoBaseImageSpecifier string = "scratch" <ide> ) <ide> <del>// byPortInfo is a temporary type used to sort types.Port by its fields <del>type byPortInfo []types.Port <del> <del>func (r byPortInfo) Len() int { return len(r) } <del>func (r byPortInfo) Swap(i, j int) { r[i], r[j] = r[j], r[i] } <del>func (r byPortInfo) Less(i, j int) bool { <del> if r[i].PrivatePort != r[j].PrivatePort { <del> return r[i].PrivatePort < r[j].PrivatePort <del> } <del> <del> if r[i].IP != r[j].IP { <del> return r[i].IP < r[j].IP <del> } <del> <del> if r[i].PublicPort != r[j].PublicPort { <del> return r[i].PublicPort < r[j].PublicPort <del> } <del> <del> return r[i].Type < r[j].Type <del>} <del> <del>// DisplayablePorts returns formatted string representing open ports of container <del>// e.g. "0.0.0.0:80->9090/tcp, 9988/tcp" <del>// it's used by command 'docker ps' <del>func DisplayablePorts(ports []types.Port) string { <del> type portGroup struct { <del> first uint16 <del> last uint16 <del> } <del> groupMap := make(map[string]*portGroup) <del> var result []string <del> var hostMappings []string <del> var groupMapKeys []string <del> sort.Sort(byPortInfo(ports)) <del> for _, port := range ports { <del> current := port.PrivatePort <del> portKey := port.Type <del> if port.IP != "" { <del> if port.PublicPort != current { <del> hostMappings = append(hostMappings, fmt.Sprintf("%s:%d->%d/%s", port.IP, port.PublicPort, port.PrivatePort, port.Type)) <del> continue <del> } <del> portKey = fmt.Sprintf("%s/%s", port.IP, port.Type) <del> } <del> group := groupMap[portKey] <del> <del> if group == nil { <del> groupMap[portKey] = &portGroup{first: current, last: current} <del> // record order that groupMap keys are created <del> groupMapKeys = append(groupMapKeys, portKey) <del> continue <del> } <del> if current == (group.last + 1) { <del> group.last = current <del> continue <del> } <del> <del> result = append(result, formGroup(portKey, group.first, group.last)) <del> groupMap[portKey] = &portGroup{first: current, last: current} <del> } <del> for _, portKey := range groupMapKeys { <del> g := groupMap[portKey] <del> result = append(result, formGroup(portKey, g.first, g.last)) <del> } <del> result = append(result, hostMappings...) <del> return strings.Join(result, ", ") <del>} <del> <del>func formGroup(key string, start, last uint16) string { <del> parts := strings.Split(key, "/") <del> groupType := parts[0] <del> var ip string <del> if len(parts) > 1 { <del> ip = parts[0] <del> groupType = parts[1] <del> } <del> group := strconv.Itoa(int(start)) <del> if start != last { <del> group = fmt.Sprintf("%s-%d", group, last) <del> } <del> if ip != "" { <del> group = fmt.Sprintf("%s:%s->%s", ip, group, group) <del> } <del> return fmt.Sprintf("%s/%s", group, groupType) <del>} <del> <del>// MatchesContentType validates the content type against the expected one <del>func MatchesContentType(contentType, expectedType string) bool { <del> mimetype, _, err := mime.ParseMediaType(contentType) <del> if err != nil { <del> logrus.Errorf("Error parsing media type: %s error: %v", contentType, err) <del> } <del> return err == nil && mimetype == expectedType <del>} <del> <ide> // LoadOrCreateTrustKey attempts to load the libtrust key at the given path, <ide> // otherwise generates a new one <ide> func LoadOrCreateTrustKey(trustKeyPath string) (libtrust.PrivateKey, error) { <ide><path>api/common_test.go <ide> import ( <ide> "testing" <ide> <ide> "os" <del> <del> "github.com/docker/docker/api/types" <ide> ) <ide> <del>type ports struct { <del> ports []types.Port <del> expected string <del>} <del> <del>// DisplayablePorts <del>func TestDisplayablePorts(t *testing.T) { <del> cases := []ports{ <del> { <del> []types.Port{ <del> { <del> PrivatePort: 9988, <del> Type: "tcp", <del> }, <del> }, <del> "9988/tcp"}, <del> { <del> []types.Port{ <del> { <del> PrivatePort: 9988, <del> Type: "udp", <del> }, <del> }, <del> "9988/udp", <del> }, <del> { <del> []types.Port{ <del> { <del> IP: "0.0.0.0", <del> PrivatePort: 9988, <del> Type: "tcp", <del> }, <del> }, <del> "0.0.0.0:0->9988/tcp", <del> }, <del> { <del> []types.Port{ <del> { <del> PrivatePort: 9988, <del> PublicPort: 8899, <del> Type: "tcp", <del> }, <del> }, <del> "9988/tcp", <del> }, <del> { <del> []types.Port{ <del> { <del> IP: "4.3.2.1", <del> PrivatePort: 9988, <del> PublicPort: 8899, <del> Type: "tcp", <del> }, <del> }, <del> "4.3.2.1:8899->9988/tcp", <del> }, <del> { <del> []types.Port{ <del> { <del> IP: "4.3.2.1", <del> PrivatePort: 9988, <del> PublicPort: 9988, <del> Type: "tcp", <del> }, <del> }, <del> "4.3.2.1:9988->9988/tcp", <del> }, <del> { <del> []types.Port{ <del> { <del> PrivatePort: 9988, <del> Type: "udp", <del> }, { <del> PrivatePort: 9988, <del> Type: "udp", <del> }, <del> }, <del> "9988/udp, 9988/udp", <del> }, <del> { <del> []types.Port{ <del> { <del> IP: "1.2.3.4", <del> PublicPort: 9998, <del> PrivatePort: 9998, <del> Type: "udp", <del> }, { <del> IP: "1.2.3.4", <del> PublicPort: 9999, <del> PrivatePort: 9999, <del> Type: "udp", <del> }, <del> }, <del> "1.2.3.4:9998-9999->9998-9999/udp", <del> }, <del> { <del> []types.Port{ <del> { <del> IP: "1.2.3.4", <del> PublicPort: 8887, <del> PrivatePort: 9998, <del> Type: "udp", <del> }, { <del> IP: "1.2.3.4", <del> PublicPort: 8888, <del> PrivatePort: 9999, <del> Type: "udp", <del> }, <del> }, <del> "1.2.3.4:8887->9998/udp, 1.2.3.4:8888->9999/udp", <del> }, <del> { <del> []types.Port{ <del> { <del> PrivatePort: 9998, <del> Type: "udp", <del> }, { <del> PrivatePort: 9999, <del> Type: "udp", <del> }, <del> }, <del> "9998-9999/udp", <del> }, <del> { <del> []types.Port{ <del> { <del> IP: "1.2.3.4", <del> PrivatePort: 6677, <del> PublicPort: 7766, <del> Type: "tcp", <del> }, { <del> PrivatePort: 9988, <del> PublicPort: 8899, <del> Type: "udp", <del> }, <del> }, <del> "9988/udp, 1.2.3.4:7766->6677/tcp", <del> }, <del> { <del> []types.Port{ <del> { <del> IP: "1.2.3.4", <del> PrivatePort: 9988, <del> PublicPort: 8899, <del> Type: "udp", <del> }, { <del> IP: "1.2.3.4", <del> PrivatePort: 9988, <del> PublicPort: 8899, <del> Type: "tcp", <del> }, { <del> IP: "4.3.2.1", <del> PrivatePort: 2233, <del> PublicPort: 3322, <del> Type: "tcp", <del> }, <del> }, <del> "4.3.2.1:3322->2233/tcp, 1.2.3.4:8899->9988/tcp, 1.2.3.4:8899->9988/udp", <del> }, <del> { <del> []types.Port{ <del> { <del> PrivatePort: 9988, <del> PublicPort: 8899, <del> Type: "udp", <del> }, { <del> IP: "1.2.3.4", <del> PrivatePort: 6677, <del> PublicPort: 7766, <del> Type: "tcp", <del> }, { <del> IP: "4.3.2.1", <del> PrivatePort: 2233, <del> PublicPort: 3322, <del> Type: "tcp", <del> }, <del> }, <del> "9988/udp, 4.3.2.1:3322->2233/tcp, 1.2.3.4:7766->6677/tcp", <del> }, <del> { <del> []types.Port{ <del> { <del> PrivatePort: 80, <del> Type: "tcp", <del> }, { <del> PrivatePort: 1024, <del> Type: "tcp", <del> }, { <del> PrivatePort: 80, <del> Type: "udp", <del> }, { <del> PrivatePort: 1024, <del> Type: "udp", <del> }, { <del> IP: "1.1.1.1", <del> PublicPort: 80, <del> PrivatePort: 1024, <del> Type: "tcp", <del> }, { <del> IP: "1.1.1.1", <del> PublicPort: 80, <del> PrivatePort: 1024, <del> Type: "udp", <del> }, { <del> IP: "1.1.1.1", <del> PublicPort: 1024, <del> PrivatePort: 80, <del> Type: "tcp", <del> }, { <del> IP: "1.1.1.1", <del> PublicPort: 1024, <del> PrivatePort: 80, <del> Type: "udp", <del> }, { <del> IP: "2.1.1.1", <del> PublicPort: 80, <del> PrivatePort: 1024, <del> Type: "tcp", <del> }, { <del> IP: "2.1.1.1", <del> PublicPort: 80, <del> PrivatePort: 1024, <del> Type: "udp", <del> }, { <del> IP: "2.1.1.1", <del> PublicPort: 1024, <del> PrivatePort: 80, <del> Type: "tcp", <del> }, { <del> IP: "2.1.1.1", <del> PublicPort: 1024, <del> PrivatePort: 80, <del> Type: "udp", <del> }, <del> }, <del> "80/tcp, 80/udp, 1024/tcp, 1024/udp, 1.1.1.1:1024->80/tcp, 1.1.1.1:1024->80/udp, 2.1.1.1:1024->80/tcp, 2.1.1.1:1024->80/udp, 1.1.1.1:80->1024/tcp, 1.1.1.1:80->1024/udp, 2.1.1.1:80->1024/tcp, 2.1.1.1:80->1024/udp", <del> }, <del> } <del> <del> for _, port := range cases { <del> actual := DisplayablePorts(port.ports) <del> if port.expected != actual { <del> t.Fatalf("Expected %s, got %s.", port.expected, actual) <del> } <del> } <del>} <del> <del>// MatchesContentType <del>func TestJsonContentType(t *testing.T) { <del> if !MatchesContentType("application/json", "application/json") { <del> t.Fail() <del> } <del> <del> if !MatchesContentType("application/json; charset=utf-8", "application/json") { <del> t.Fail() <del> } <del> <del> if MatchesContentType("dockerapplication/json", "application/json") { <del> t.Fail() <del> } <del>} <del> <ide> // LoadOrCreateTrustKey <ide> func TestLoadOrCreateTrustKeyInvalidKeyFile(t *testing.T) { <ide> tmpKeyFolderPath, err := ioutil.TempDir("", "api-trustkey-test") <ide><path>api/server/httputils/httputils.go <ide> package httputils <ide> import ( <ide> "fmt" <ide> "io" <add> "mime" <ide> "net/http" <ide> "strings" <ide> <add> "github.com/Sirupsen/logrus" <ide> "golang.org/x/net/context" <del> <del> "github.com/docker/docker/api" <ide> ) <ide> <ide> // APIVersionKey is the client's requested API version. <ide> func CheckForJSON(r *http.Request) error { <ide> } <ide> <ide> // Otherwise it better be json <del> if api.MatchesContentType(ct, "application/json") { <add> if matchesContentType(ct, "application/json") { <ide> return nil <ide> } <ide> return fmt.Errorf("Content-Type specified (%s) must be 'application/json'", ct) <ide> func VersionFromContext(ctx context.Context) string { <ide> <ide> return "" <ide> } <add> <add>// matchesContentType validates the content type against the expected one <add>func matchesContentType(contentType, expectedType string) bool { <add> mimetype, _, err := mime.ParseMediaType(contentType) <add> if err != nil { <add> logrus.Errorf("Error parsing media type: %s error: %v", contentType, err) <add> } <add> return err == nil && mimetype == expectedType <add>} <ide><path>api/server/httputils/httputils_test.go <add>package httputils <add> <add>import "testing" <add> <add>// matchesContentType <add>func TestJsonContentType(t *testing.T) { <add> if !matchesContentType("application/json", "application/json") { <add> t.Fail() <add> } <add> <add> if !matchesContentType("application/json; charset=utf-8", "application/json") { <add> t.Fail() <add> } <add> <add> if matchesContentType("dockerapplication/json", "application/json") { <add> t.Fail() <add> } <add>}
4
Javascript
Javascript
add extra checks
31d0d5af8e30362bb46a177afa4d74c2474c8e46
<ide><path>test/simple/test-http-client-escape-path.js <ide> var common = require('../common'); <ide> var assert = require('assert'); <ide> var http = require('http'); <add>var util = require('util'); <ide> <ide> first(); <ide> <ide> function third() { <ide> } <ide> <ide> function test(path, expected, next) { <del> var server = http.createServer(function(req, res) { <del> assert.equal(req.url, expected); <del> res.end('OK'); <del> server.close(function() { <del> if (next) next(); <add> function helper(arg, next) { <add> var server = http.createServer(function(req, res) { <add> assert.equal(req.url, expected); <add> res.end('OK'); <add> server.close(next); <ide> }); <del> }); <del> server.on('clientError', function(err) { <del> throw err; <del> }); <del> var options = { <del> host: '127.0.0.1', <del> port: common.PORT, <del> path: path <del> }; <del> server.listen(options.port, options.host, function() { <del> http.get(options); <del> }); <add> server.on('clientError', function(err) { <add> throw err; <add> }); <add> server.listen(common.PORT, '127.0.0.1', function() { <add> http.get(arg); <add> }); <add> } <add> <add> // Go the extra mile to ensure that the behavior of <add> // http.get("http://example.com/...") matches http.get({ path: ... }). <add> test1(); <add> <add> function test1() { <add> console.log('as url: ' + util.inspect(path)); <add> helper('http://127.0.0.1:' + common.PORT + path, test2); <add> } <add> function test2() { <add> var options = { <add> host: '127.0.0.1', <add> port: common.PORT, <add> path: path <add> }; <add> console.log('as options: ' + util.inspect(options)); <add> helper(options, done); <add> } <add> function done() { <add> if (next) next(); <add> } <ide> }
1
Text
Text
fix typo on readme.md
398dcd42813dc4074bfc319259d543e77fd1d090
<ide><path>packages/next/README.md <ide> You can use [micro proxy](https://github.com/zeit/micro-proxy) as your local pro <ide> } <ide> ``` <ide> <del>For the production deployment, you can use the [path alias](https://zeit.co/docs/features/path-aliases) feature if you are using [ZEIT now](https://zeit.co/now). Otherwise, you can configure your existing proxy server to route HTML pages using a set of rules as show above. <add>For the production deployment, you can use the [path alias](https://zeit.co/docs/features/path-aliases) feature if you are using [ZEIT now](https://zeit.co/now). Otherwise, you can configure your existing proxy server to route HTML pages using a set of rules as shown above. <ide> <ide> ## Recipes <ide>
1
PHP
PHP
fix typo in class name
9dd8090268421ded5d58acdec7a208a3091b2da3
<ide><path>src/Cache/Engine/ApcEngine.php <ide> public function clear($check) <ide> if ($check) { <ide> return true; <ide> } <del> if (class_exists('APCIterator', false)) { <add> if (class_exists('APCUIterator', false)) { <ide> $iterator = new APCUIterator( <ide> '/^' . preg_quote($this->_config['prefix'], '/') . '/', <ide> APC_ITER_NONE
1
Text
Text
fix a typo in fs.md
e24fc95398e89759b132d07352b55941e7fb8474
<ide><path>doc/api/fs.md <ide> On Windows, opening an existing hidden file using the `'w'` flag (either <ide> through `fs.open()` or `fs.writeFile()` or `fsPromises.open()`) will fail with <ide> `EPERM`. Existing hidden files can be opened for writing with the `'r+'` flag. <ide> <del>A call to `fs.ftruncate()` or `fsPromises.ftruncate()` can be used to reset <add>A call to `fs.ftruncate()` or `filehandle.truncate()` can be used to reset <ide> the file contents. <ide> <ide> [`AHAFS`]: https://www.ibm.com/developerworks/aix/library/au-aix_event_infrastructure/
1
PHP
PHP
implement foreign key generation in sqlite
160fd0445903ca629986c6b78d2bfa11e63a87bb
<ide><path>lib/Cake/Database/Schema/SqliteSchema.php <ide> public function columnSql(Table $table, $name) { <ide> public function constraintSql(Table $table, $name) { <ide> $data = $table->constraint($name); <ide> if ( <add> $data['type'] === Table::CONSTRAINT_PRIMARY && <ide> count($data['columns']) === 1 && <ide> $table->column($data['columns'][0])['type'] === 'integer' <ide> ) { <ide> return ''; <ide> } <add> $clause = ''; <ide> if ($data['type'] === Table::CONSTRAINT_PRIMARY) { <ide> $type = 'PRIMARY KEY'; <ide> } <ide> if ($data['type'] === Table::CONSTRAINT_UNIQUE) { <ide> $type = 'UNIQUE'; <ide> } <add> if ($data['type'] === Table::CONSTRAINT_FOREIGN) { <add> $type = 'FOREIGN KEY'; <add> $clause = sprintf( <add> ' REFERENCES %s (%s) ON UPDATE %s ON DELETE %s', <add> $this->_driver->quoteIdentifier($data['references'][0]), <add> $this->_driver->quoteIdentifier($data['references'][1]), <add> $this->_foreignOnClause($data['update']), <add> $this->_foreignOnClause($data['delete']) <add> ); <add> } <ide> $columns = array_map( <ide> [$this->_driver, 'quoteIdentifier'], <ide> $data['columns'] <ide> ); <del> return sprintf('CONSTRAINT %s %s (%s)', <add> return sprintf('CONSTRAINT %s %s (%s)%s', <ide> $this->_driver->quoteIdentifier($name), <ide> $type, <del> implode(', ', $columns) <add> implode(', ', $columns), <add> $clause <ide> ); <ide> } <ide> <add>/** <add> * Generate an ON clause for a foreign key. <add> * <add> * @param string|null $on The on clause <add> * @return string <add> */ <add> protected function _foreignOnClause($on) { <add> if ($on === null) { <add> return 'SET NULL'; <add> } <add> if ($on === 'cascade') { <add> return 'CASCADE'; <add> } <add> if ($on === 'restrict') { <add> return 'RESTRICT'; <add> } <add> if ($on === 'none') { <add> return 'NO ACTION'; <add> } <add> } <add> <ide> /** <ide> * Generate the SQL fragment for a single index. <ide> * <ide><path>lib/Cake/Test/TestCase/Database/Schema/SqliteSchemaTest.php <ide> public static function constraintSqlProvider() { <ide> ['type' => 'unique', 'columns' => ['title', 'author_id']], <ide> 'CONSTRAINT "unique_idx" UNIQUE ("title", "author_id")' <ide> ], <add> [ <add> 'author_id_idx', <add> ['type' => 'foreign', 'columns' => ['author_id'], 'references' => ['authors', 'id']], <add> 'CONSTRAINT "author_id_idx" FOREIGN KEY ("author_id") ' . <add> 'REFERENCES "authors" ("id") ON UPDATE CASCADE ON DELETE CASCADE' <add> ], <add> [ <add> 'author_id_idx', <add> ['type' => 'foreign', 'columns' => ['author_id'], 'references' => ['authors', 'id'], 'update' => 'restrict'], <add> 'CONSTRAINT "author_id_idx" FOREIGN KEY ("author_id") ' . <add> 'REFERENCES "authors" ("id") ON UPDATE RESTRICT ON DELETE CASCADE' <add> ], <add> [ <add> 'author_id_idx', <add> ['type' => 'foreign', 'columns' => ['author_id'], 'references' => ['authors', 'id'], 'update' => null], <add> 'CONSTRAINT "author_id_idx" FOREIGN KEY ("author_id") ' . <add> 'REFERENCES "authors" ("id") ON UPDATE SET NULL ON DELETE CASCADE' <add> ], <add> [ <add> 'author_id_idx', <add> ['type' => 'foreign', 'columns' => ['author_id'], 'references' => ['authors', 'id'], 'update' => 'none'], <add> 'CONSTRAINT "author_id_idx" FOREIGN KEY ("author_id") ' . <add> 'REFERENCES "authors" ("id") ON UPDATE NO ACTION ON DELETE CASCADE' <add> ], <ide> ]; <ide> } <ide>
2
Text
Text
add information about memory leaks
72fe8fc5193ec31ea84208236b731d93e68eef69
<ide><path>client/src/pages/guide/english/cplusplus/dynamic-memory-allocation/index.md <ide> title: Dynamic Memory Allocation <ide> `delete ptr2`; <ide> <ide> ### Memory Leaks <del> Leaks are caused when you fail to deallocate dynamic memory you allocated via `New` operator at the end of your program. If you do not deallocate it with the Delete operator, your computer will keep creating new memory in the heap every time the program runs. This causes your computer to slow down because memory is not deleted and your available memory decreases. <add> Leaks are caused when you fail to deallocate dynamic memory you allocated via `New` operator at the end of your program. If you do not deallocate it with the Delete operator, your computer will keep creating new memory in the heap every time the program runs. This causes your computer to slow down because memory is not deleted and your available memory decreases. Many computer programs cause memory leaks over time. However, when you reboot the machine, it will resolve the issue. This is because rebooting releases those spaces in heap memory that were causing memory leaks. <ide>
1
Ruby
Ruby
fix argument error in valid use case
16141e7effe453cfe94ae274dadaf4b3ecf6767a
<ide><path>Library/Homebrew/extend/os/mac/software_spec.rb <ide> def uses_from_macos(deps, bounds = {}) <ide> deps = Hash[*bounds.shift] <ide> end <ide> <del> bounds.transform_values! { |v| MacOS::Version.from_symbol(v) } <add> bounds = bounds.transform_values { |v| MacOS::Version.from_symbol(v) } <ide> if MacOS.version >= bounds[:since] <ide> @uses_from_macos_elements << deps <ide> else <ide><path>Library/Homebrew/test/os/mac/formula_spec.rb <ide> require "formula" <ide> <ide> describe Formula do <add> describe "#uses_from_macos" do <add> before do <add> allow(OS).to receive(:mac?).and_return(true) <add> allow(OS::Mac).to receive(:version).and_return(OS::Mac::Version.from_symbol(:sierra)) <add> end <add> <add> it "adds a macOS dependency to all specs if the OS version meets requirements" do <add> f = formula "foo" do <add> url "foo-1.0" <add> <add> uses_from_macos("foo", since: :el_capitan) <add> end <add> <add> expect(f.class.stable.deps).to be_empty <add> expect(f.class.devel.deps).to be_empty <add> expect(f.class.head.deps).to be_empty <add> expect(f.class.stable.uses_from_macos_elements.first).to eq("foo") <add> expect(f.class.devel.uses_from_macos_elements.first).to eq("foo") <add> expect(f.class.head.uses_from_macos_elements.first).to eq("foo") <add> end <add> <add> it "doesn't add a macOS dependency to any spec if the OS version doesn't meet requirements" do <add> f = formula "foo" do <add> url "foo-1.0" <add> <add> uses_from_macos("foo", since: :high_sierra) <add> end <add> <add> expect(f.class.stable.deps.first.name).to eq("foo") <add> expect(f.class.devel.deps.first.name).to eq("foo") <add> expect(f.class.head.deps.first.name).to eq("foo") <add> expect(f.class.stable.uses_from_macos_elements).to be_empty <add> expect(f.class.devel.uses_from_macos_elements).to be_empty <add> expect(f.class.head.uses_from_macos_elements).to be_empty <add> end <add> end <add> <ide> describe "#on_macos" do <ide> it "defines an url on macos only" do <ide> f = formula do
2
Mixed
Javascript
fix deprecation code
4afd503465b5dd3b5d58d07043a99e9557bbfd53
<ide><path>doc/api/deprecations.md <ide> Type: Runtime <ide> Setting the TLS ServerName to an IP address is not permitted by <ide> [RFC 6066][]. This will be ignored in a future version. <ide> <del><a id="DEP0XXX"></a> <del>### DEP0XXX: using REPLServer.rli <add><a id="DEP0124"></a> <add>### DEP0124: using REPLServer.rli <ide> <!-- YAML <ide> changes: <ide> - version: REPLACEME <ide><path>lib/repl.js <ide> function REPLServer(prompt, <ide> let rli = self; <ide> Object.defineProperty(self, 'rli', { <ide> get: util.deprecate(() => rli, <del> 'REPLServer.rli is deprecated', 'DEP0XXX'), <add> 'REPLServer.rli is deprecated', 'DEP0124'), <ide> set: util.deprecate((val) => rli = val, <del> 'REPLServer.rli is deprecated', 'DEP0XXX'), <add> 'REPLServer.rli is deprecated', 'DEP0124'), <ide> enumerable: true, <ide> configurable: true <ide> }); <ide><path>test/parallel/test-repl-options.js <ide> const repl = require('repl'); <ide> <ide> common.expectWarning({ <ide> DeprecationWarning: { <del> DEP0XXX: 'REPLServer.rli is deprecated' <add> DEP0124: 'REPLServer.rli is deprecated' <ide> } <ide> }); <ide>
3
Text
Text
update changelog [ci skip]
d5b9345a01f94f80953088c56d2e64058784afe9
<ide><path>CHANGELOG.md <ide> # Ember Changelog <ide> <add>### v3.10.0-beta.2 (UNRELEASED) <add> <add>- [#17846](https://github.com/emberjs/ember.js/pull/17846) [BUGFIX] Fix issues with template-only components causing errors in subsequent updates. <add> <ide> ### v3.10.0-beta.1 (April 02, 2019) <ide> <ide> - [#17836](https://github.com/emberjs/ember.js/pull/17836) [BREAKING] Explicitly drop support for Node 6 <del>- [#17719](https://github.com/emberjs/ember.js/pull/17719) / [#17745](https://github.com/emberjs/ember.js/pull/17745) [FEATURE] Support for nested components in angle bracket invocation syntax (see [emberjs/rfcs#0457](https://github.com/emberjs/rfcs/blob/master/text/0457-nested-lookups.md)). <add>- [#17719](https://github.com/emberjs/ember.js/pull/17719) / [#17745](https://github.com/emberjs/ember.js/pull/17745) [FEATURE] Support for nested components in angle bracket invocation syntax (see [emberjs/rfcs#0457](https://github.com/emberjs/rfcs/blob/master/text/0457-nested-lookups.md)). <ide> - [#17735](https://github.com/emberjs/ember.js/pull/17735) / [#17772](https://github.com/emberjs/ember.js/pull/17772) / [#17811](https://github.com/emberjs/ember.js/pull/17811) / [#17814](https://github.com/emberjs/ember.js/pull/17814) [FEATURE] Implement the Angle Bracket Invocations For Built-in Components RFC (see [emberjs/rfcs#0459](https://github.com/emberjs/rfcs/blob/master/text/0459-angle-bracket-built-in-components.md)). <ide> - [#17548](https://github.com/emberjs/ember.js/pull/17548) / [#17604](https://github.com/emberjs/ember.js/pull/17604) / [#17690](https://github.com/emberjs/ember.js/pull/17690) / [#17827](https://github.com/emberjs/ember.js/pull/17827) / [#17828](https://github.com/emberjs/ember.js/pull/17828) [FEATURE] Implement the Decorators RFC (see [emberjs/rfcs#0408](https://github.com/emberjs/rfcs/blob/master/text/0408-decorators.md)). <ide> - [#17256](https://github.com/emberjs/ember.js/pull/17256) / [#17664](https://github.com/emberjs/ember.js/pull/17664) [FEATURE] Implement RouteInfo Metadata RFC (see [emberjs/rfcs#0398](https://github.com/emberjs/rfcs/blob/master/text/0398-RouteInfo-Metadata.md)). <ide> - [#17747](https://github.com/emberjs/ember.js/pull/17747) [BUGFIX] Correct component-test blueprint for ember-cli-mocha <ide> - [#17788](https://github.com/emberjs/ember.js/pull/17788) [BUGFIX] Fix native DOM events in Glimmer Angle Brackets <ide> - [#17833](https://github.com/emberjs/ember.js/pull/17833) [BUGFIX] Reverts the naming of setClassicDecorator externally <ide> - [#17841](https://github.com/emberjs/ember.js/pull/17841) [BUGFIX] Ensure @sort works on non-Ember.Objects. <del>- [#17818](https://github.com/emberjs/ember.js/pull/17818) [BUGFIX] Fix event dispatcher (part 1) <add>- [#17818](https://github.com/emberjs/ember.js/pull/17818) [BUGFIX] Fix event dispatcher to not rely on `elementId`. <add>- [#17818](https://github.com/emberjs/ember.js/pull/17818) [BUGFIX] Fix event dispatcher to not rely on `elementId`. <ide> - [#17411](https://github.com/emberjs/ember.js/pull/17411) / [#17732](https://github.com/emberjs/ember.js/pull/17732) / [#17412](https://github.com/emberjs/ember.js/pull/17412) Update initializer blueprints for ember-mocha 0.14 <ide> - [#17702](https://github.com/emberjs/ember.js/pull/17702) Extend from glimmer component for octane blueprint <ide> - [#17740](https://github.com/emberjs/ember.js/pull/17740) Fix octane component blueprint and octane blueprint tests <ide> - [#17470](https://github.com/emberjs/ember.js/pull/17470) [DEPRECATION] Implements the Computed Property Modifier deprecation RFCs <ide> * Deprecates `.property()` (see [emberjs/rfcs#0375](https://github.com/emberjs/rfcs/blob/master/text/0375-deprecate-computed-property-modifier.md) <ide> * Deprecates `.volatile()` (see [emberjs/rfcs#0370](https://github.com/emberjs/rfcs/blob/master/text/0370-deprecate-computed-volatile.md) <del> * Deprecates computed overridability (see [emberjs/rfcs#0369](https://github.com/emberjs/rfcs/blob/master/text/0369-deprecate-computed-clobberability.md) <add> * Deprecates computed overridability (see [emberjs/rfcs#0369](https://github.com/emberjs/rfcs/blob/master/text/0369-deprecate-computed-clobberability.md) <ide> - [#17488](https://github.com/emberjs/ember.js/pull/17488) [DEPRECATION] Deprecate this.$() in curly components (see [emberjs/rfcs#0386](https://github.com/emberjs/rfcs/blob/master/text/0386-remove-jquery.md)) <ide> - [#17489](https://github.com/emberjs/ember.js/pull/17489) [DEPRECATION] Deprecate Ember.$() (see [emberjs/rfcs#0386](https://github.com/emberjs/rfcs/blob/master/text/0386-remove-jquery.md)) <ide> - [#17540](https://github.com/emberjs/ember.js/pull/17540) [DEPRECATION] Deprecate aliasMethod <ide> Fixes a few issues: <ide> <ide> - [#17025](https://github.com/emberjs/ember.js/pull/17025) / [#17034](https://github.com/emberjs/ember.js/pull/17034) / [#17036](https://github.com/emberjs/ember.js/pull/17036) / [#17038](https://github.com/emberjs/ember.js/pull/17038) / [#17040](https://github.com/emberjs/ember.js/pull/17040) / [#17041](https://github.com/emberjs/ember.js/pull/17041) / [#17061](https://github.com/emberjs/ember.js/pull/17061) [FEATURE] Final stage of the router service RFC (see [emberjs/rfcs#95](https://github.com/emberjs/rfcs/blob/master/text/0095-router-service.md) <ide> - [#16795](https://github.com/emberjs/ember.js/pull/16795) [FEATURE] Native Class Constructor Update (see [emberjs/rfcs#337](https://github.com/emberjs/rfcs/blob/master/text/0337-native-class-constructor-update.md) <del>- [#17188](https://github.com/emberjs/ember.js/pull/17188) / [#17246](https://github.com/emberjs/ember.js/pull/17246) [BUGFIX] Adds a second dist build which targets IE and early Android versions. Enables avoiding errors when using native classes without transpilation. <add>- [#17188](https://github.com/emberjs/ember.js/pull/17188) / [#17246](https://github.com/emberjs/ember.js/pull/17246) [BUGFIX] Adds a second dist build which targets IE and early Android versions. Enables avoiding errors when using native classes without transpilation. <ide> - [#17238](https://github.com/emberjs/ember.js/pull/17238) [DEPRECATION] Deprecate calling `A` as a constructor <ide> - [#16956](https://github.com/emberjs/ember.js/pull/16956) [DEPRECATION] Deprecate Ember.merge <ide> - [#17220](https://github.com/emberjs/ember.js/pull/17220) [BUGFIX] Fix cycle detection in Ember.copy
1
Javascript
Javascript
make section key optional
8d373f3186be28fecb2798f8f8d3f23f5147b7ea
<ide><path>Libraries/Lists/SectionList.js <ide> import type {Props as VirtualizedSectionListProps} from 'VirtualizedSectionList' <ide> type Item = any; <ide> <ide> type SectionBase<SectionItemT> = { <del> // Must be provided directly on each section. <add> /** <add> * The data for rendering items in this section. <add> */ <ide> data: Array<SectionItemT>, <del> key: string, <add> /** <add> * Optional key to keep track of section re-ordering. If you don't plan on re-ordering sections, <add> * the array index will be used by default. <add> */ <add> key?: string, <ide> <ide> // Optional props will override list-wide props just for this section. <ide> renderItem?: ?(info: { <ide> type RequiredProps<SectionT: SectionBase<any>> = { <ide> * <ide> * sections: Array<{ <ide> * data: Array<SectionItem>, <del> * key: string, <ide> * renderItem?: ({item: SectionItem, ...}) => ?React.Element<*>, <ide> * ItemSeparatorComponent?: ?ReactClass<{highlighted: boolean, ...}>, <ide> * }> <ide> type DefaultProps = typeof defaultProps; <ide> * <ide> * <SectionList <ide> * renderItem={({item}) => <ListItem title={item.title} />} <del> * renderSectionHeader={({section}) => <H1 title={section.key} />} <add> * renderSectionHeader={({section}) => <H1 title={section.title} />} <ide> * sections={[ // homogenous rendering between sections <del> * {data: [...], key: ...}, <del> * {data: [...], key: ...}, <del> * {data: [...], key: ...}, <add> * {data: [...], title: ...}, <add> * {data: [...], title: ...}, <add> * {data: [...], title: ...}, <ide> * ]} <ide> * /> <ide> * <ide> * <SectionList <ide> * sections={[ // heterogeneous rendering between sections <del> * {data: [...], key: ..., renderItem: ...}, <del> * {data: [...], key: ..., renderItem: ...}, <del> * {data: [...], key: ..., renderItem: ...}, <add> * {data: [...], title: ..., renderItem: ...}, <add> * {data: [...], title: ..., renderItem: ...}, <add> * {data: [...], title: ..., renderItem: ...}, <ide> * ]} <ide> * /> <ide> * <ide><path>Libraries/Lists/VirtualizedSectionList.js <ide> const View = require('View'); <ide> const VirtualizedList = require('VirtualizedList'); <ide> <ide> const invariant = require('fbjs/lib/invariant'); <del>const warning = require('fbjs/lib/warning'); <ide> <ide> import type {ViewToken} from 'ViewabilityHelper'; <ide> import type {Props as VirtualizedListProps} from 'VirtualizedList'; <ide> type SectionItem = any; <ide> type SectionBase = { <ide> // Must be provided directly on each section. <ide> data: Array<SectionItem>, <del> key: string, <add> key?: string, <ide> <ide> // Optional props will override list-wide props just for this section. <ide> renderItem?: ?({ <ide> class VirtualizedSectionList<SectionT: SectionBase> <ide> const defaultKeyExtractor = this.props.keyExtractor; <ide> for (let ii = 0; ii < this.props.sections.length; ii++) { <ide> const section = this.props.sections[ii]; <del> const key = section.key; <del> warning( <del> key != null, <del> 'VirtualizedSectionList: A `section` you supplied is missing the `key` property.' <del> ); <add> const key = section.key || String(ii); <ide> itemIndex -= 1; // The section itself is an item <ide> if (itemIndex >= section.data.length) { <ide> itemIndex -= section.data.length;
2
Javascript
Javascript
fix reftests after
7bb65bab7ffd6cf65083c59115c87f30d38c4c55
<ide><path>src/pdf.js <ide> import { <ide> VerbosityLevel, <ide> } from "./shared/util.js"; <ide> import { AnnotationLayer } from "./display/annotation_layer.js"; <add>import { AnnotationStorage } from "./display/annotation_storage.js"; <ide> import { apiCompatibilityParams } from "./display/api_compatibility.js"; <ide> import { GlobalWorkerOptions } from "./display/worker_options.js"; <ide> import { renderTextLayer } from "./display/text_layer.js"; <ide> export { <ide> VerbosityLevel, <ide> // From "./display/annotation_layer.js": <ide> AnnotationLayer, <add> // From "./display/annotation_storage.js": <add> AnnotationStorage, <ide> // From "./display/api_compatibility.js": <ide> apiCompatibilityParams, <ide> // From "./display/worker_options.js": <ide><path>test/driver.js <ide> var rasterizeAnnotationLayer = (function rasterizeAnnotationLayerClosure() { <ide> linkService: new pdfjsViewer.SimpleLinkService(), <ide> imageResourcesPath, <ide> renderInteractiveForms, <add> annotationStorage: new pdfjsLib.AnnotationStorage(), <ide> }; <ide> pdfjsLib.AnnotationLayer.render(parameters); <ide>
2
Javascript
Javascript
update extrudegeometry.js
bf50f022aa2d209070e1d50801c8534c9553b3da
<ide><path>src/extras/geometries/ExtrudeGeometry.js <ide> ExtrudeGeometry.prototype.addShape = function ( shape, options ) { <ide> //for ( b = bevelSegments; b > 0; b -- ) { <ide> <ide> t = b / bevelSegments; <del> z = bevelThickness * ( 1 - t ); <add> z = bevelThickness * Math.cos ( t * Math.PI / 2 ); // curved <add> //z = bevelThickness * ( 1 - t ); //linear <ide> <del> //z = bevelThickness * t; <del> bs = bevelSize * ( Math.sin ( t * Math.PI / 2 ) ); // curved <add> bs = bevelSize * Math.sin ( t * Math.PI / 2 ); // curved <ide> //bs = bevelSize * t; // linear <ide> <ide> // contract shape <ide> ExtrudeGeometry.prototype.addShape = function ( shape, options ) { <ide> for ( b = bevelSegments - 1; b >= 0; b -- ) { <ide> <ide> t = b / bevelSegments; <del> z = bevelThickness * ( 1 - t ); <del> //bs = bevelSize * ( 1-Math.sin ( ( 1 - t ) * Math.PI/2 ) ); <add> z = bevelThickness * Math.cos ( t * Math.PI / 2 ); // curved <add> //z = bevelThickness * ( 1 - t ); //linear <add> <ide> bs = bevelSize * Math.sin ( t * Math.PI / 2 ); <add> //bs = bevelSize * t; // linear <ide> <ide> // contract shape <ide>
1
PHP
PHP
add the ability to pass parameters to seeders call
4d5c8cafda2f6b143b530f51bc62c3c841724342
<ide><path>src/Illuminate/Database/Seeder.php <ide> abstract class Seeder <ide> * <ide> * @param array|string $class <ide> * @param bool $silent <add> * @param mixed ...$params <ide> * @return $this <ide> */ <del> public function call($class, $silent = false) <add> public function call($class, $silent = false, ...$params) <ide> { <ide> $classes = Arr::wrap($class); <ide> <ide> public function call($class, $silent = false) <ide> <ide> $startTime = microtime(true); <ide> <del> $seeder->__invoke(); <add> $seeder->__invoke(...$params); <ide> <ide> $runTime = round(microtime(true) - $startTime, 2); <ide> <ide> public function call($class, $silent = false) <ide> * Silently seed the given connection from the given path. <ide> * <ide> * @param array|string $class <add> * @param mixed ...$params <ide> * @return void <ide> */ <del> public function callSilent($class) <add> public function callSilent($class, ...$params) <ide> { <del> $this->call($class, true); <add> $this->call($class, true, ...$params); <ide> } <ide> <ide> /** <ide> public function setCommand(Command $command) <ide> /** <ide> * Run the database seeds. <ide> * <add> * @param mixed ...$params <ide> * @return mixed <ide> * <ide> * @throws \InvalidArgumentException <ide> */ <del> public function __invoke() <add> public function __invoke(...$params) <ide> { <ide> if (! method_exists($this, 'run')) { <ide> throw new InvalidArgumentException('Method [run] missing from '.get_class($this)); <ide> } <ide> <ide> return isset($this->container) <del> ? $this->container->call([$this, 'run']) <del> : $this->run(); <add> ? $this->container->call([$this, 'run'], $params) <add> : $this->run(...$params); <ide> } <ide> } <ide><path>tests/Database/DatabaseSeederTest.php <ide> public function run() <ide> <ide> class TestDepsSeeder extends Seeder <ide> { <del> public function run(Mock $someDependency) <add> public function run(Mock $someDependency, $someParam = '') <ide> { <ide> // <ide> } <ide> public function testInjectDependenciesOnRunMethod() <ide> <ide> $seeder->__invoke(); <ide> <del> $container->shouldHaveReceived('call')->once()->with([$seeder, 'run']); <add> $container->shouldHaveReceived('call')->once()->with([$seeder, 'run'], []); <add> } <add> <add> public function testSendParamsOnCallMethodWithDeps() <add> { <add> $container = m::mock(Container::class); <add> $container->shouldReceive('call'); <add> <add> $seeder = new TestDepsSeeder; <add> $seeder->setContainer($container); <add> <add> $seeder->__invoke('test1', 'test2'); <add> <add> $container->shouldHaveReceived('call')->once()->with([$seeder, 'run'], ['test1', 'test2']); <ide> } <ide> }
2
Javascript
Javascript
fix flaky test-zlib-unused-weak.js
f96dffb7aef50aa46531577ec24eb19474207d96
<ide><path>test/parallel/test-zlib-unused-weak.js <ide> const zlib = require('zlib'); <ide> <ide> // Tests that native zlib handles start out their life as weak handles. <ide> <add>global.gc(); <ide> const before = process.memoryUsage().external; <ide> for (let i = 0; i < 100; ++i) <ide> zlib.createGzip();
1
Text
Text
add typescript 'abstract classes' guide.
e5de964ff54e6ee6b4dd02bf577e8559ab3d0c94
<ide><path>guide/english/typescript/abstract-classes/index.md <add>--- <add>title: Abstract Classes <add>--- <add> <add># Abstract Classes <add> <add>Abstract classes are super classes which can be derived by other classes.The class marked with the `abstract` keyword is the abstract class and it can't be instantiate directly. The Abstract class may contain `abstract` or `non-abstract` member functions. <add> <add>```typescript <add>abstract class FCC{ <add> abstract makeSkill(): void; <add> getSound():void{ <add> console.log("Coding..."); <add> } <add>} <add>``` <add> <add>Methods enclosed to abstract class which are marked `abstract` do not contain a method body and must be implemented in the derived class. <add> <add>```typescript <add>abstract class FCC{ <add> private name:string; <add> constructor(name:string){ <add> this.name = name; <add> } <add> abstract makeSkill(skillName:string):void; <add> displayName():void{ <add> console.log(`Hi, ${this.name} welcome to FreeCodeCamp!`); <add> } <add>} <add> <add>class Camper extends FCC{ <add> constructor(name:string){ <add> super(name); <add> } <add> makeSkill(skillName:string):void{ <add> console.log(`Hey, ${this.name} you made the ${skillName} skills`); <add> } <add>} <add> <add>let jack = new Camper('Jack Smith'); <add>jack.displayName(); <add>jack.makeSkill('Front-End Library'); <add>```
1
Python
Python
add comment on how to get exact msvcr version
ff611feb90d7bd130aa94634ba6e370f9227bf47
<ide><path>numpy/distutils/mingw32ccompiler.py <ide> def build_import_library(): <ide> # system. <ide> <ide> # XXX: ideally, we should use exactly the same version as used by python, but I <del># have no idea how to obtain the exact version. <add># have no idea how to obtain the exact version from python. We could use the <add># strings utility on python.exe, maybe ? <ide> _MSVCRVER_TO_FULLVER = {'90': "9.0.21022.8"} <ide> <ide> def msvc_manifest_xml(maj, min):
1
Python
Python
fix simple typo, optionnal -> optional
a6dbea1e25351bc60298bf40b2edaaad1276259e
<ide><path>glances/static_list.py <ide> def load(self, config): <ide> for s in ['name', 'port', 'alias']: <ide> new_server[s] = config.get_value(self._section, '%s%s' % (postfix, s)) <ide> if new_server['name'] is not None: <del> # Manage optionnal information <add> # Manage optional information <ide> if new_server['port'] is None: <ide> new_server['port'] = '61209' <ide> new_server['username'] = 'glances'
1
Text
Text
update remote api responses and minor fixes
286fe69d5376add77dc31833dc3c2fcc9639dd17
<ide><path>docs/reference/api/docker_remote_api.md <ide> list of DNS options to be used in the container. <ide> * `GET /containers/json` will return `ImageID` of the image used by container. <ide> * `POST /exec/(name)/start` will now return an HTTP 409 when the container is either stopped or paused. <ide> * `GET /containers/(name)/json` now accepts a `size` parameter. Setting this parameter to '1' returns container size information in the `SizeRw` and `SizeRootFs` fields. <add>* `GET /containers/(name)/json` now returns a `NetworkSettings.Networks` field, <add> detailing network settings per network. This field deprecates the <add> `NetworkSettings.Gateway`, `NetworkSettings.IPAddress`, <add> `NetworkSettings.IPPrefixLen`, and `NetworkSettings.MacAddress` fields, which <add> are still returned for backward-compatibility, but will be removed in a future version. <add>* `GET /exec/(id)/json` now returns a `NetworkSettings.Networks` field, <add> detailing networksettings per network. This field deprecates the <add> `NetworkSettings.Gateway`, `NetworkSettings.IPAddress`, <add> `NetworkSettings.IPPrefixLen`, and `NetworkSettings.MacAddress` fields, which <add> are still returned for backward-compatibility, but will be removed in a future version. <ide> <ide> ### v1.20 API changes <ide> <ide><path>docs/reference/api/docker_remote_api_v1.20.md <ide> Json Parameters: <ide> for the container. <ide> - **User** - A string value specifying the user inside the container. <ide> - **Memory** - Memory limit in bytes. <del>- **MemorySwap**- Total memory limit (memory + swap); set `-1` to disable swap <add>- **MemorySwap** - Total memory limit (memory + swap); set `-1` to disable swap <ide> You must use this with `memory` and make the swap value larger than `memory`. <ide> - **CpuShares** - An integer value containing the container's CPU Shares <ide> (ie. the relative weight vs other containers). <ide> Status Codes: <ide> <ide> `POST /exec/(id)/resize` <ide> <del>Resizes the `tty` session used by the `exec` command `id`. <add>Resizes the `tty` session used by the `exec` command `id`. The unit is number of characters. <ide> This API is valid only if `tty` was specified as part of creating and starting the `exec` command. <ide> <ide> **Example request**: <ide> <del> POST /exec/e90e34656806/resize HTTP/1.1 <add> POST /exec/e90e34656806/resize?h=40&w=80 HTTP/1.1 <ide> Content-Type: text/plain <ide> <ide> **Example response**: <ide> Return low-level information about the `exec` command `id`. <ide> "ProcessLabel" : "", <ide> "AppArmorProfile" : "", <ide> "RestartCount" : 0, <del> "Mounts" : [], <add> "Mounts" : [] <ide> } <ide> } <ide> <ide><path>docs/reference/api/docker_remote_api_v1.21.md <ide> List containers <ide> "Id": "8dfafdbc3a40", <ide> "Names":["/boring_feynman"], <ide> "Image": "ubuntu:latest", <del> "ImageID": "d74508fb6632491cea586a1fd7d748dfc5274cd6fdfedee309ecdcbc2bf5cb82", <add> "ImageID": "d74508fb6632491cea586a1fd7d748dfc5274cd6fdfedee309ecdcbc2bf5cb82", <ide> "Command": "echo 1", <ide> "Created": 1367854155, <ide> "Status": "Exit 0", <ide> List containers <ide> "Id": "9cd87474be90", <ide> "Names":["/coolName"], <ide> "Image": "ubuntu:latest", <del> "ImageID": "d74508fb6632491cea586a1fd7d748dfc5274cd6fdfedee309ecdcbc2bf5cb82", <add> "ImageID": "d74508fb6632491cea586a1fd7d748dfc5274cd6fdfedee309ecdcbc2bf5cb82", <ide> "Command": "echo 222222", <ide> "Created": 1367854155, <ide> "Status": "Exit 0", <ide> List containers <ide> "Id": "3176a2479c92", <ide> "Names":["/sleepy_dog"], <ide> "Image": "ubuntu:latest", <del> "ImageID": "d74508fb6632491cea586a1fd7d748dfc5274cd6fdfedee309ecdcbc2bf5cb82", <add> "ImageID": "d74508fb6632491cea586a1fd7d748dfc5274cd6fdfedee309ecdcbc2bf5cb82", <ide> "Command": "echo 3333333333333333", <ide> "Created": 1367854154, <ide> "Status": "Exit 0", <ide> List containers <ide> "Id": "4cb07b47f9fb", <ide> "Names":["/running_cat"], <ide> "Image": "ubuntu:latest", <del> "ImageID": "d74508fb6632491cea586a1fd7d748dfc5274cd6fdfedee309ecdcbc2bf5cb82", <add> "ImageID": "d74508fb6632491cea586a1fd7d748dfc5274cd6fdfedee309ecdcbc2bf5cb82", <ide> "Command": "echo 444444444444444444444444444444444", <ide> "Created": 1367854152, <ide> "Status": "Exit 0", <ide> Create a container <ide> "LogConfig": { "Type": "json-file", "Config": {} }, <ide> "SecurityOpt": [""], <ide> "CgroupParent": "", <del> "VolumeDriver": "" <add> "VolumeDriver": "" <ide> } <ide> } <ide> <ide> Return low-level information on the container `id` <ide> "HairpinMode": false, <ide> "LinkLocalIPv6Address": "", <ide> "LinkLocalIPv6PrefixLen": 0, <del> "SandboxKey": "", <del> "SecondaryIPAddresses": [], <del> "SecondaryIPv6Addresses": [], <ide> "Ports": null, <add> "SandboxKey": "", <add> "SecondaryIPAddresses": null, <add> "SecondaryIPv6Addresses": null, <add> "EndpointID": "", <add> "Gateway": "", <add> "GlobalIPv6Address": "", <add> "GlobalIPv6PrefixLen": 0, <add> "IPAddress": "", <add> "IPPrefixLen": 0, <add> "IPv6Gateway": "", <add> "MacAddress": "", <ide> "Networks": { <ide> "bridge": { <ide> "EndpointID": "", <ide> "Gateway": "", <del> "IPAdress": "", <add> "IPAddress": "", <ide> "IPPrefixLen": 0, <ide> "IPv6Gateway": "", <ide> "GlobalIPv6Address": "", <ide> Status Codes: <ide> Get `stdout` and `stderr` logs from the container ``id`` <ide> <ide> > **Note**: <del>> This endpoint works only for containers with `json-file` logging driver. <add>> This endpoint works only for containers with the `json-file` or `journald` logging drivers. <ide> <ide> **Example request**: <ide> <ide> Query Parameters: <ide> <ide> **Example request**: <ide> <del> PUT /containers/8cce319429b2/archive?path=/vol1 HTTP/1.1 <del> Content-Type: application/x-tar <add> PUT /containers/8cce319429b2/archive?path=/vol1 HTTP/1.1 <add> Content-Type: application/x-tar <ide> <del> {{ TAR STREAM }} <add> {{ TAR STREAM }} <ide> <ide> **Example response**: <ide> <del> HTTP/1.1 200 OK <add> HTTP/1.1 200 OK <ide> <ide> Status Codes: <ide> <ide> Return low-level information about the `exec` command `id`. <ide> "SecurityOpt" : null <ide> }, <ide> "Image" : "5506de2b643be1e6febbf3b8a240760c6843244c41e12aa2f60ccbb7153d17f5", <del> "NetworkSettings": { <del> "Bridge": "", <del> "SandboxID": "", <del> "HairpinMode": false, <del> "LinkLocalIPv6Address": "", <del> "LinkLocalIPv6PrefixLen": 0, <del> "SandboxKey": "", <del> "SecondaryIPAddresses": [], <del> "SecondaryIPv6Addresses": [], <del> "Ports": null, <del> "Networks": { <del> "bridge": { <del> "EndpointID": "", <del> "Gateway": "", <del> "IPAdress": "", <del> "IPPrefixLen": 0, <del> "IPv6Gateway": "", <del> "GlobalIPv6Address": "", <del> "GlobalIPv6PrefixLen": 0, <del> "MacAddress": "" <del> } <del> } <del> }, <add> "NetworkSettings": { <add> "Bridge": "", <add> "SandboxID": "", <add> "HairpinMode": false, <add> "LinkLocalIPv6Address": "", <add> "LinkLocalIPv6PrefixLen": 0, <add> "Ports": null, <add> "SandboxKey": "", <add> "SecondaryIPAddresses": null, <add> "SecondaryIPv6Addresses": null, <add> "EndpointID": "", <add> "Gateway": "", <add> "GlobalIPv6Address": "", <add> "GlobalIPv6PrefixLen": 0, <add> "IPAddress": "", <add> "IPPrefixLen": 0, <add> "IPv6Gateway": "", <add> "MacAddress": "", <add> "Networks": { <add> "bridge": { <add> "EndpointID": "", <add> "Gateway": "", <add> "IPAddress": "", <add> "IPPrefixLen": 0, <add> "IPv6Gateway": "", <add> "GlobalIPv6Address": "", <add> "GlobalIPv6PrefixLen": 0, <add> "MacAddress": "" <add> } <add> } <add> }, <ide> "ResolvConfPath" : "/var/lib/docker/containers/8f177a186b977fb451136e0fdf182abff5599a08b3c7f6ef0d36a55aaf89634c/resolv.conf", <ide> "HostnamePath" : "/var/lib/docker/containers/8f177a186b977fb451136e0fdf182abff5599a08b3c7f6ef0d36a55aaf89634c/hostname", <ide> "HostsPath" : "/var/lib/docker/containers/8f177a186b977fb451136e0fdf182abff5599a08b3c7f6ef0d36a55aaf89634c/hosts", <ide> Status Codes: <ide> <ide> **Example request**: <ide> <del> GET /volumes HTTP/1.1 <add> GET /volumes HTTP/1.1 <ide> <ide> **Example response**: <ide> <del> HTTP/1.1 200 OK <del> Content-Type: application/json <add> HTTP/1.1 200 OK <add> Content-Type: application/json <ide> <del> { <del> "Volumes": [ <del> { <del> "Name": "tardis", <del> "Driver": "local", <del> "Mountpoint": "/var/lib/docker/volumes/tardis" <del> } <del> ] <del> } <add> { <add> "Volumes": [ <add> { <add> "Name": "tardis", <add> "Driver": "local", <add> "Mountpoint": "/var/lib/docker/volumes/tardis" <add> } <add> ] <add> } <ide> <ide> Query Parameters: <ide> <ide> Create a volume <ide> <ide> **Example request**: <ide> <del> POST /volumes/create HTTP/1.1 <del> Content-Type: application/json <add> POST /volumes/create HTTP/1.1 <add> Content-Type: application/json <ide> <del> { <del> "Name": "tardis" <del> } <add> { <add> "Name": "tardis" <add> } <ide> <ide> **Example response**: <ide> <del> HTTP/1.1 201 Created <del> Content-Type: application/json <add> HTTP/1.1 201 Created <add> Content-Type: application/json <ide> <del> { <del> "Name": "tardis" <del> "Driver": "local", <del> "Mountpoint": "/var/lib/docker/volumes/tardis" <del> } <add> { <add> "Name": "tardis", <add> "Driver": "local", <add> "Mountpoint": "/var/lib/docker/volumes/tardis" <add> } <ide> <ide> Status Codes: <ide> <ide> Return low-level information on the volume `name` <ide> <ide> **Example response**: <ide> <del> HTTP/1.1 200 OK <del> Content-Type: application/json <add> HTTP/1.1 200 OK <add> Content-Type: application/json <ide> <del> { <del> "Name": "tardis", <del> "Driver": "local", <del> "Mountpoint": "/var/lib/docker/volumes/tardis" <del> } <add> { <add> "Name": "tardis", <add> "Driver": "local", <add> "Mountpoint": "/var/lib/docker/volumes/tardis" <add> } <ide> <ide> Status Codes: <ide> <ide> Instruct the driver to remove the volume (`name`). <ide> <ide> **Example request**: <ide> <del> DELETE /volumes/local/tardis HTTP/1.1 <add> DELETE /volumes/local/tardis HTTP/1.1 <ide> <ide> **Example response**: <ide> <del> HTTP/1.1 204 No Content <add> HTTP/1.1 204 No Content <ide> <ide> Status Codes <ide> <ide> Status Codes <ide> <ide> **Example request**: <ide> <del> GET /networks HTTP/1.1 <add> GET /networks HTTP/1.1 <ide> <ide> **Example response**: <ide> <del> HTTP/1.1 200 OK <del> Content-Type: application/json <del> <ide> ``` <del> [ <del> { <del> "name": "bridge", <del> "id": "f995e41e471c833266786a64df584fbe4dc654ac99f63a4ee7495842aa093fc4", <del> "driver": "bridge", <del> "containers": {} <add>HTTP/1.1 200 OK <add>Content-Type: application/json <add> <add>[ <add> { <add> "Name": "bridge", <add> "Id": "f2de39df4171b0dc801e8002d1d999b77256983dfc63041c0f34030aa3977566", <add> "Scope": "local", <add> "Driver": "bridge", <add> "IPAM": { <add> "Driver": "default", <add> "Config": [ <add> { <add> "Subnet": "172.17.0.0/16" <add> } <add> ] <ide> }, <del> { <del> "name": "none", <del> "id": "21e34df9b29c74ae45ba312f8e9f83c02433c9a877cfebebcf57be78f69b77c8", <del> "driver": "null", <del> "containers": {} <add> "Containers": { <add> "39b69226f9d79f5634485fb236a23b2fe4e96a0a94128390a7fbbcc167065867": { <add> "EndpointID": "ed2419a97c1d9954d05b46e462e7002ea552f216e9b136b80a7db8d98b442eda", <add> "MacAddress": "02:42:ac:11:00:02", <add> "IPv4Address": "172.17.0.2/16", <add> "IPv6Address": "" <add> } <ide> }, <del> { <del> "name": "host", <del> "id": "3f43a0873f00310a71cd6a71e2e60c113cf17d1812be2ec22fd519fbac68ec91", <del> "driver": "host", <del> "containers": {} <add> "Options": { <add> "com.docker.network.bridge.default_bridge": "true", <add> "com.docker.network.bridge.enable_icc": "true", <add> "com.docker.network.bridge.enable_ip_masquerade": "true", <add> "com.docker.network.bridge.host_binding_ipv4": "0.0.0.0", <add> "com.docker.network.bridge.name": "docker0", <add> "com.docker.network.driver.mtu": "1500" <ide> } <del> ] <add> }, <add> { <add> "Name": "none", <add> "Id": "e086a3893b05ab69242d3c44e49483a3bbbd3a26b46baa8f61ab797c1088d794", <add> "Scope": "local", <add> "Driver": "null", <add> "IPAM": { <add> "Driver": "default", <add> "Config": [] <add> }, <add> "Containers": {}, <add> "Options": {} <add> }, <add> { <add> "Name": "host", <add> "Id": "13e871235c677f196c4e1ecebb9dc733b9b2d2ab589e30c539efeda84a24215e", <add> "Scope": "local", <add> "Driver": "host", <add> "IPAM": { <add> "Driver": "default", <add> "Config": [] <add> }, <add> "Containers": {}, <add> "Options": {} <add> } <add>] <ide> ``` <ide> <ide> <ide> Status Codes: <ide> <ide> **Example request**: <ide> <del> GET /networks/f995e41e471c833266786a64df584fbe4dc654ac99f63a4ee7495842aa093fc4 HTTP/1.1 <add> GET /networks/f2de39df4171b0dc801e8002d1d999b77256983dfc63041c0f34030aa3977566 HTTP/1.1 <ide> <ide> **Example response**: <ide> <del> HTTP/1.1 200 OK <del> Content-Type: application/json <del> <ide> ``` <del> { <del> "name": "bridge", <del> "id": "f995e41e471c833266786a64df584fbe4dc654ac99f63a4ee7495842aa093fc4", <del> "driver": "bridge", <del> "containers": { <del> "931d29e96e63022a3691f55ca18b28600239acf53878451975f77054b05ba559": { <del> "endpoint": "aa79321e2899e6d72fcd46e6a4ad7f81ab9a19c3b06e384ef4ce51fea35827f9", <del> "mac_address": "02:42:ac:11:00:04", <del> "ipv4_address": "172.17.0.4/16", <del> "ipv6_address": "" <del> }, <del> "961249b4ae6c764b11eed923e8463c102689111fffd933627b2e7e359c7d0f7c": { <del> "endpoint": "4f62c5aea6b9a70512210be7db976bd4ec2cdba47125e4fe514d18c81b1624b1", <del> "mac_address": "02:42:ac:11:00:02", <del> "ipv4_address": "172.17.0.2/16", <del> "ipv6_address": "" <del> }, <del> "9f6e0fec4449f42a173ed85be96dc2253b6719edd850d8169bc31bdc45db675c": { <del> "endpoint": "352b512a5bccdfc77d16c2c04d04408e718f879a16f9ce3913a4733139e4f98d", <del> "mac_address": "02:42:ac:11:00:03", <del> "ipv4_address": "172.17.0.3/16", <del> "ipv6_address": "" <add>HTTP/1.1 200 OK <add>Content-Type: application/json <add> <add>{ <add> "Name": "bridge", <add> "Id": "f2de39df4171b0dc801e8002d1d999b77256983dfc63041c0f34030aa3977566", <add> "Scope": "local", <add> "Driver": "bridge", <add> "IPAM": { <add> "Driver": "default", <add> "Config": [ <add> { <add> "Subnet": "172.17.0.0/16" <ide> } <add> ] <add> }, <add> "Containers": { <add> "39b69226f9d79f5634485fb236a23b2fe4e96a0a94128390a7fbbcc167065867": { <add> "EndpointID": "ed2419a97c1d9954d05b46e462e7002ea552f216e9b136b80a7db8d98b442eda", <add> "MacAddress": "02:42:ac:11:00:02", <add> "IPv4Address": "172.17.0.2/16", <add> "IPv6Address": "" <ide> } <add> }, <add> "Options": { <add> "com.docker.network.bridge.default_bridge": "true", <add> "com.docker.network.bridge.enable_icc": "true", <add> "com.docker.network.bridge.enable_ip_masquerade": "true", <add> "com.docker.network.bridge.host_binding_ipv4": "0.0.0.0", <add> "com.docker.network.bridge.name": "docker0", <add> "com.docker.network.driver.mtu": "1500" <ide> } <add>} <ide> ``` <ide> <ide> Status Codes: <ide> Create a network <ide> <ide> **Example request**: <ide> <del> POST /networks/create HTTP/1.1 <del> Content-Type: application/json <del> <ide> ``` <del> { <del> "name":"isolated_nw", <del> "driver":"bridge" <del> } <add>POST /networks/create HTTP/1.1 <add>Content-Type: application/json <add> <add>{ <add> "Name":"isolated_nw", <add> "Driver":"bridge" <add>} <ide> ``` <ide> <ide> **Example response**: <ide> <del> HTTP/1.1 201 Created <del> Content-Type: application/json <del> <ide> ``` <del> { <del> "id": "22be93d5babb089c5aab8dbc369042fad48ff791584ca2da2100db837a1c7c30", <del> "warning": "" <del> } <add>HTTP/1.1 201 Created <add>Content-Type: application/json <add> <add>{ <add> "Id": "22be93d5babb089c5aab8dbc369042fad48ff791584ca2da2100db837a1c7c30", <add> "Warning": "" <add>} <ide> ``` <ide> <ide> Status Codes: <ide> Status Codes: <ide> <ide> JSON Parameters: <ide> <del>- **name** - The new network's name. this is a mandatory field <del>- **driver** - Name of the network driver to use. Defaults to `bridge` driver <del>- **options** - Network specific options to be used by the drivers <del>- **check_duplicate** - Requests daemon to check for networks with same name <add>- **Name** - The new network's name. this is a mandatory field <add>- **Driver** - Name of the network driver to use. Defaults to `bridge` driver <add>- **Options** - Network specific options to be used by the drivers <add>- **CheckDuplicate** - Requests daemon to check for networks with same name <ide> <ide> ### Connect a container to a network <ide> <ide> Connects a container to a network <ide> <ide> **Example request**: <ide> <del> POST /networks/22be93d5babb089c5aab8dbc369042fad48ff791584ca2da2100db837a1c7c30/connect HTTP/1.1 <del> Content-Type: application/json <del> <ide> ``` <del> { <del> "container":"3613f73ba0e4" <del> } <add>POST /networks/22be93d5babb089c5aab8dbc369042fad48ff791584ca2da2100db837a1c7c30/connect HTTP/1.1 <add>Content-Type: application/json <add> <add>{ <add> "Container":"3613f73ba0e4" <add>} <ide> ``` <ide> <ide> **Example response**: <ide> <del> HTTP/1.1 200 OK <add> HTTP/1.1 200 OK <ide> <ide> Status Codes: <ide> <ide> Disconnects a container from a network <ide> <ide> **Example request**: <ide> <del> POST /networks/22be93d5babb089c5aab8dbc369042fad48ff791584ca2da2100db837a1c7c30/disconnect HTTP/1.1 <del> Content-Type: application/json <del> <ide> ``` <del> { <del> "container":"3613f73ba0e4" <del> } <add>POST /networks/22be93d5babb089c5aab8dbc369042fad48ff791584ca2da2100db837a1c7c30/disconnect HTTP/1.1 <add>Content-Type: application/json <add> <add>{ <add> "Container":"3613f73ba0e4" <add>} <ide> ``` <ide> <ide> **Example response**: <ide> <del> HTTP/1.1 200 OK <add> HTTP/1.1 200 OK <ide> <ide> Status Codes: <ide> <ide> Status Codes: <ide> <ide> JSON Parameters: <ide> <del>- **container** - container-id/name to be disconnected from a network <add>- **Container** - container-id/name to be disconnected from a network <ide> <ide> ### Remove a network <ide> <ide> Instruct the driver to remove the network (`id`). <ide> <ide> **Example request**: <ide> <del> DELETE /networks/22be93d5babb089c5aab8dbc369042fad48ff791584ca2da2100db837a1c7c30 HTTP/1.1 <add> DELETE /networks/22be93d5babb089c5aab8dbc369042fad48ff791584ca2da2100db837a1c7c30 HTTP/1.1 <ide> <ide> **Example response**: <ide> <del> HTTP/1.1 204 No Content <add> HTTP/1.1 204 No Content <ide> <ide> Status Codes <ide> <ide><path>docs/reference/api/docker_remote_api_v1.22.md <ide> List containers <ide> "Id": "8dfafdbc3a40", <ide> "Names":["/boring_feynman"], <ide> "Image": "ubuntu:latest", <del> "ImageID": "d74508fb6632491cea586a1fd7d748dfc5274cd6fdfedee309ecdcbc2bf5cb82", <add> "ImageID": "d74508fb6632491cea586a1fd7d748dfc5274cd6fdfedee309ecdcbc2bf5cb82", <ide> "Command": "echo 1", <ide> "Created": 1367854155, <ide> "Status": "Exit 0", <ide> List containers <ide> "Id": "9cd87474be90", <ide> "Names":["/coolName"], <ide> "Image": "ubuntu:latest", <del> "ImageID": "d74508fb6632491cea586a1fd7d748dfc5274cd6fdfedee309ecdcbc2bf5cb82", <add> "ImageID": "d74508fb6632491cea586a1fd7d748dfc5274cd6fdfedee309ecdcbc2bf5cb82", <ide> "Command": "echo 222222", <ide> "Created": 1367854155, <ide> "Status": "Exit 0", <ide> List containers <ide> "Id": "3176a2479c92", <ide> "Names":["/sleepy_dog"], <ide> "Image": "ubuntu:latest", <del> "ImageID": "d74508fb6632491cea586a1fd7d748dfc5274cd6fdfedee309ecdcbc2bf5cb82", <add> "ImageID": "d74508fb6632491cea586a1fd7d748dfc5274cd6fdfedee309ecdcbc2bf5cb82", <ide> "Command": "echo 3333333333333333", <ide> "Created": 1367854154, <ide> "Status": "Exit 0", <ide> List containers <ide> "Id": "4cb07b47f9fb", <ide> "Names":["/running_cat"], <ide> "Image": "ubuntu:latest", <del> "ImageID": "d74508fb6632491cea586a1fd7d748dfc5274cd6fdfedee309ecdcbc2bf5cb82", <add> "ImageID": "d74508fb6632491cea586a1fd7d748dfc5274cd6fdfedee309ecdcbc2bf5cb82", <ide> "Command": "echo 444444444444444444444444444444444", <ide> "Created": 1367854152, <ide> "Status": "Exit 0", <ide> Create a container <ide> "LogConfig": { "Type": "json-file", "Config": {} }, <ide> "SecurityOpt": [""], <ide> "CgroupParent": "", <del> "VolumeDriver": "" <add> "VolumeDriver": "" <ide> } <ide> } <ide> <ide> Json Parameters: <ide> + `container_path` to create a new volume for the container <ide> + `host_path:container_path` to bind-mount a host path into the container <ide> + `host_path:container_path:ro` to make the bind-mount read-only inside the container. <add> + `volume_name:container_path` to bind-mount a volume managed by a volume plugin into the container. <add> + `volume_name:container_path:ro` to make the bind mount read-only inside the container. <ide> - **Links** - A list of links for the container. Each link entry should be <ide> in the form of `container_name:alias`. <ide> - **LxcConf** - LXC specific configurations. These configurations only <ide> Return low-level information on the container `id` <ide> "HairpinMode": false, <ide> "LinkLocalIPv6Address": "", <ide> "LinkLocalIPv6PrefixLen": 0, <del> "SandboxKey": "", <del> "SecondaryIPAddresses": [], <del> "SecondaryIPv6Addresses": [], <ide> "Ports": null, <add> "SandboxKey": "", <add> "SecondaryIPAddresses": null, <add> "SecondaryIPv6Addresses": null, <add> "EndpointID": "", <add> "Gateway": "", <add> "GlobalIPv6Address": "", <add> "GlobalIPv6PrefixLen": 0, <add> "IPAddress": "", <add> "IPPrefixLen": 0, <add> "IPv6Gateway": "", <add> "MacAddress": "", <ide> "Networks": { <ide> "bridge": { <ide> "EndpointID": "", <ide> "Gateway": "", <del> "IPAdress": "", <add> "IPAddress": "", <ide> "IPPrefixLen": 0, <ide> "IPv6Gateway": "", <ide> "GlobalIPv6Address": "", <ide> Status Codes: <ide> Get `stdout` and `stderr` logs from the container ``id`` <ide> <ide> > **Note**: <del>> This endpoint works only for containers with `json-file` logging driver. <add>> This endpoint works only for containers with the `json-file` or `journald` logging drivers. <ide> <ide> **Example request**: <ide> <ide> Query Parameters: <ide> <ide> **Example request**: <ide> <del> PUT /containers/8cce319429b2/archive?path=/vol1 HTTP/1.1 <del> Content-Type: application/x-tar <add> PUT /containers/8cce319429b2/archive?path=/vol1 HTTP/1.1 <add> Content-Type: application/x-tar <ide> <del> {{ TAR STREAM }} <add> {{ TAR STREAM }} <ide> <ide> **Example response**: <ide> <del> HTTP/1.1 200 OK <add> HTTP/1.1 200 OK <ide> <ide> Status Codes: <ide> <ide> a base64-encoded AuthConfig object. <ide> <ide> Query Parameters: <ide> <del>- **fromImage** – Name of the image to pull. <add>- **fromImage** – Name of the image to pull. The name may include a tag or <add> digest. This parameter may only be used when pulling an image. <ide> - **fromSrc** – Source to import. The value may be a URL from which the image <ide> can be retrieved or `-` to read the image from the request body. <del>- **repo** – Repository name. <del>- **tag** – Tag. <del>- **registry** – The registry to pull from. <add> This parameter may only be used when importing an image. <add>- **repo** – Repository name given to an image when it is imported. <add> The repo may include a tag. This parameter may only be used when importing <add> an image. <add>- **tag** – Tag or digest. <ide> <ide> Request Headers: <ide> <ide> Return low-level information about the `exec` command `id`. <ide> "SecurityOpt" : null <ide> }, <ide> "Image" : "5506de2b643be1e6febbf3b8a240760c6843244c41e12aa2f60ccbb7153d17f5", <del> "NetworkSettings": { <del> "Bridge": "", <del> "SandboxID": "", <del> "HairpinMode": false, <del> "LinkLocalIPv6Address": "", <del> "LinkLocalIPv6PrefixLen": 0, <del> "SandboxKey": "", <del> "SecondaryIPAddresses": [], <del> "SecondaryIPv6Addresses": [], <del> "Ports": null, <del> "Networks": { <del> "bridge": { <del> "EndpointID": "", <del> "Gateway": "", <del> "IPAdress": "", <del> "IPPrefixLen": 0, <del> "IPv6Gateway": "", <del> "GlobalIPv6Address": "", <del> "GlobalIPv6PrefixLen": 0, <del> "MacAddress": "" <del> } <del> } <del> }, <add> "NetworkSettings": { <add> "Bridge": "", <add> "SandboxID": "", <add> "HairpinMode": false, <add> "LinkLocalIPv6Address": "", <add> "LinkLocalIPv6PrefixLen": 0, <add> "Ports": null, <add> "SandboxKey": "", <add> "SecondaryIPAddresses": null, <add> "SecondaryIPv6Addresses": null, <add> "EndpointID": "", <add> "Gateway": "", <add> "GlobalIPv6Address": "", <add> "GlobalIPv6PrefixLen": 0, <add> "IPAddress": "", <add> "IPPrefixLen": 0, <add> "IPv6Gateway": "", <add> "MacAddress": "", <add> "Networks": { <add> "bridge": { <add> "EndpointID": "", <add> "Gateway": "", <add> "IPAddress": "", <add> "IPPrefixLen": 0, <add> "IPv6Gateway": "", <add> "GlobalIPv6Address": "", <add> "GlobalIPv6PrefixLen": 0, <add> "MacAddress": "" <add> } <add> } <add> }, <ide> "ResolvConfPath" : "/var/lib/docker/containers/8f177a186b977fb451136e0fdf182abff5599a08b3c7f6ef0d36a55aaf89634c/resolv.conf", <ide> "HostnamePath" : "/var/lib/docker/containers/8f177a186b977fb451136e0fdf182abff5599a08b3c7f6ef0d36a55aaf89634c/hostname", <ide> "HostsPath" : "/var/lib/docker/containers/8f177a186b977fb451136e0fdf182abff5599a08b3c7f6ef0d36a55aaf89634c/hosts", <ide> Status Codes: <ide> <ide> **Example request**: <ide> <del> GET /volumes HTTP/1.1 <add> GET /volumes HTTP/1.1 <ide> <ide> **Example response**: <ide> <del> HTTP/1.1 200 OK <del> Content-Type: application/json <add> HTTP/1.1 200 OK <add> Content-Type: application/json <ide> <del> { <del> "Volumes": [ <del> { <del> "Name": "tardis", <del> "Driver": "local", <del> "Mountpoint": "/var/lib/docker/volumes/tardis" <del> } <del> ] <del> } <add> { <add> "Volumes": [ <add> { <add> "Name": "tardis", <add> "Driver": "local", <add> "Mountpoint": "/var/lib/docker/volumes/tardis" <add> } <add> ] <add> } <ide> <ide> Query Parameters: <ide> <del>- **filter** - JSON encoded value of the filters (a `map[string][]string`) to process on the volumes list. There is one available filter: `dangling=true` <add>- **filters** - JSON encoded value of the filters (a `map[string][]string`) to process on the volumes list. There is one available filter: `dangling=true` <ide> <ide> Status Codes: <ide> <ide> Create a volume <ide> <ide> **Example request**: <ide> <del> POST /volumes/create HTTP/1.1 <del> Content-Type: application/json <add> POST /volumes/create HTTP/1.1 <add> Content-Type: application/json <ide> <del> { <del> "Name": "tardis" <del> } <add> { <add> "Name": "tardis" <add> } <ide> <ide> **Example response**: <ide> <del> HTTP/1.1 201 Created <del> Content-Type: application/json <add> HTTP/1.1 201 Created <add> Content-Type: application/json <ide> <del> { <del> "Name": "tardis" <del> "Driver": "local", <del> "Mountpoint": "/var/lib/docker/volumes/tardis" <del> } <add> { <add> "Name": "tardis", <add> "Driver": "local", <add> "Mountpoint": "/var/lib/docker/volumes/tardis" <add> } <ide> <ide> Status Codes: <ide> <ide> Return low-level information on the volume `name` <ide> <ide> **Example response**: <ide> <del> HTTP/1.1 200 OK <del> Content-Type: application/json <add> HTTP/1.1 200 OK <add> Content-Type: application/json <ide> <del> { <del> "Name": "tardis", <del> "Driver": "local", <del> "Mountpoint": "/var/lib/docker/volumes/tardis" <del> } <add> { <add> "Name": "tardis", <add> "Driver": "local", <add> "Mountpoint": "/var/lib/docker/volumes/tardis" <add> } <ide> <ide> Status Codes: <ide> <ide> Instruct the driver to remove the volume (`name`). <ide> <ide> **Example request**: <ide> <del> DELETE /volumes/local/tardis HTTP/1.1 <add> DELETE /volumes/local/tardis HTTP/1.1 <ide> <ide> **Example response**: <ide> <del> HTTP/1.1 204 No Content <add> HTTP/1.1 204 No Content <ide> <ide> Status Codes <ide> <ide> Status Codes <ide> <ide> **Example request**: <ide> <del> GET /networks HTTP/1.1 <add> GET /networks HTTP/1.1 <ide> <ide> **Example response**: <ide> <del> HTTP/1.1 200 OK <del> Content-Type: application/json <del> <ide> ``` <del> [ <del> { <del> "name": "bridge", <del> "id": "f995e41e471c833266786a64df584fbe4dc654ac99f63a4ee7495842aa093fc4", <del> "driver": "bridge", <del> "containers": {} <add>HTTP/1.1 200 OK <add>Content-Type: application/json <add> <add>[ <add> { <add> "Name": "bridge", <add> "Id": "f2de39df4171b0dc801e8002d1d999b77256983dfc63041c0f34030aa3977566", <add> "Scope": "local", <add> "Driver": "bridge", <add> "IPAM": { <add> "Driver": "default", <add> "Config": [ <add> { <add> "Subnet": "172.17.0.0/16" <add> } <add> ] <ide> }, <del> { <del> "name": "none", <del> "id": "21e34df9b29c74ae45ba312f8e9f83c02433c9a877cfebebcf57be78f69b77c8", <del> "driver": "null", <del> "containers": {} <add> "Containers": { <add> "39b69226f9d79f5634485fb236a23b2fe4e96a0a94128390a7fbbcc167065867": { <add> "EndpointID": "ed2419a97c1d9954d05b46e462e7002ea552f216e9b136b80a7db8d98b442eda", <add> "MacAddress": "02:42:ac:11:00:02", <add> "IPv4Address": "172.17.0.2/16", <add> "IPv6Address": "" <add> } <ide> }, <del> { <del> "name": "host", <del> "id": "3f43a0873f00310a71cd6a71e2e60c113cf17d1812be2ec22fd519fbac68ec91", <del> "driver": "host", <del> "containers": {} <add> "Options": { <add> "com.docker.network.bridge.default_bridge": "true", <add> "com.docker.network.bridge.enable_icc": "true", <add> "com.docker.network.bridge.enable_ip_masquerade": "true", <add> "com.docker.network.bridge.host_binding_ipv4": "0.0.0.0", <add> "com.docker.network.bridge.name": "docker0", <add> "com.docker.network.driver.mtu": "1500" <ide> } <del> ] <add> }, <add> { <add> "Name": "none", <add> "Id": "e086a3893b05ab69242d3c44e49483a3bbbd3a26b46baa8f61ab797c1088d794", <add> "Scope": "local", <add> "Driver": "null", <add> "IPAM": { <add> "Driver": "default", <add> "Config": [] <add> }, <add> "Containers": {}, <add> "Options": {} <add> }, <add> { <add> "Name": "host", <add> "Id": "13e871235c677f196c4e1ecebb9dc733b9b2d2ab589e30c539efeda84a24215e", <add> "Scope": "local", <add> "Driver": "host", <add> "IPAM": { <add> "Driver": "default", <add> "Config": [] <add> }, <add> "Containers": {}, <add> "Options": {} <add> } <add>] <ide> ``` <ide> <ide> <ide> <ide> Query Parameters: <ide> <del>- **filter** - JSON encoded value of the filters (a `map[string][]string`) to process on the volumes list. Available filters: `name=[network-names]` , `id=[network-ids]` <add>- **filters** - JSON encoded value of the filters (a `map[string][]string`) to process on the networks list. Available filters: `name=[network-names]` , `id=[network-ids]` <ide> <ide> Status Codes: <ide> <ide> Status Codes: <ide> <ide> **Example request**: <ide> <del> GET /networks/f995e41e471c833266786a64df584fbe4dc654ac99f63a4ee7495842aa093fc4 HTTP/1.1 <add> GET /networks/f2de39df4171b0dc801e8002d1d999b77256983dfc63041c0f34030aa3977566 HTTP/1.1 <ide> <ide> **Example response**: <ide> <del> HTTP/1.1 200 OK <del> Content-Type: application/json <del> <ide> ``` <del> { <del> "name": "bridge", <del> "id": "f995e41e471c833266786a64df584fbe4dc654ac99f63a4ee7495842aa093fc4", <del> "driver": "bridge", <del> "containers": { <del> "931d29e96e63022a3691f55ca18b28600239acf53878451975f77054b05ba559": { <del> "endpoint": "aa79321e2899e6d72fcd46e6a4ad7f81ab9a19c3b06e384ef4ce51fea35827f9", <del> "mac_address": "02:42:ac:11:00:04", <del> "ipv4_address": "172.17.0.4/16", <del> "ipv6_address": "" <del> }, <del> "961249b4ae6c764b11eed923e8463c102689111fffd933627b2e7e359c7d0f7c": { <del> "endpoint": "4f62c5aea6b9a70512210be7db976bd4ec2cdba47125e4fe514d18c81b1624b1", <del> "mac_address": "02:42:ac:11:00:02", <del> "ipv4_address": "172.17.0.2/16", <del> "ipv6_address": "" <del> }, <del> "9f6e0fec4449f42a173ed85be96dc2253b6719edd850d8169bc31bdc45db675c": { <del> "endpoint": "352b512a5bccdfc77d16c2c04d04408e718f879a16f9ce3913a4733139e4f98d", <del> "mac_address": "02:42:ac:11:00:03", <del> "ipv4_address": "172.17.0.3/16", <del> "ipv6_address": "" <add>HTTP/1.1 200 OK <add>Content-Type: application/json <add> <add>{ <add> "Name": "bridge", <add> "Id": "f2de39df4171b0dc801e8002d1d999b77256983dfc63041c0f34030aa3977566", <add> "Scope": "local", <add> "Driver": "bridge", <add> "IPAM": { <add> "Driver": "default", <add> "Config": [ <add> { <add> "Subnet": "172.17.0.0/16" <ide> } <add> ] <add> }, <add> "Containers": { <add> "39b69226f9d79f5634485fb236a23b2fe4e96a0a94128390a7fbbcc167065867": { <add> "EndpointID": "ed2419a97c1d9954d05b46e462e7002ea552f216e9b136b80a7db8d98b442eda", <add> "MacAddress": "02:42:ac:11:00:02", <add> "IPv4Address": "172.17.0.2/16", <add> "IPv6Address": "" <ide> } <add> }, <add> "Options": { <add> "com.docker.network.bridge.default_bridge": "true", <add> "com.docker.network.bridge.enable_icc": "true", <add> "com.docker.network.bridge.enable_ip_masquerade": "true", <add> "com.docker.network.bridge.host_binding_ipv4": "0.0.0.0", <add> "com.docker.network.bridge.name": "docker0", <add> "com.docker.network.driver.mtu": "1500" <ide> } <add>} <ide> ``` <ide> <ide> Status Codes: <ide> Create a network <ide> <ide> **Example request**: <ide> <del> POST /networks/create HTTP/1.1 <del> Content-Type: application/json <del> <ide> ``` <del> { <del> "name":"isolated_nw", <del> "driver":"bridge" <del> } <add>POST /networks/create HTTP/1.1 <add>Content-Type: application/json <add> <add>{ <add> "Name":"isolated_nw", <add> "Driver":"bridge" <add>} <ide> ``` <ide> <ide> **Example response**: <ide> <del> HTTP/1.1 201 Created <del> Content-Type: application/json <del> <ide> ``` <del> { <del> "id": "22be93d5babb089c5aab8dbc369042fad48ff791584ca2da2100db837a1c7c30", <del> "warning": "" <del> } <add>HTTP/1.1 201 Created <add>Content-Type: application/json <add> <add>{ <add> "Id": "22be93d5babb089c5aab8dbc369042fad48ff791584ca2da2100db837a1c7c30", <add> "Warning": "" <add>} <ide> ``` <ide> <ide> Status Codes: <ide> Status Codes: <ide> <ide> JSON Parameters: <ide> <del>- **name** - The new network's name. this is a mandatory field <del>- **driver** - Name of the network driver to use. Defaults to `bridge` driver <del>- **options** - Network specific options to be used by the drivers <del>- **check_duplicate** - Requests daemon to check for networks with same name <add>- **Name** - The new network's name. this is a mandatory field <add>- **Driver** - Name of the network driver to use. Defaults to `bridge` driver <add>- **Options** - Network specific options to be used by the drivers <add>- **CheckDuplicate** - Requests daemon to check for networks with same name <ide> <ide> ### Connect a container to a network <ide> <ide> Connects a container to a network <ide> <ide> **Example request**: <ide> <del> POST /networks/22be93d5babb089c5aab8dbc369042fad48ff791584ca2da2100db837a1c7c30/connect HTTP/1.1 <del> Content-Type: application/json <del> <ide> ``` <del> { <del> "container":"3613f73ba0e4" <del> } <add>POST /networks/22be93d5babb089c5aab8dbc369042fad48ff791584ca2da2100db837a1c7c30/connect HTTP/1.1 <add>Content-Type: application/json <add> <add>{ <add> "Container":"3613f73ba0e4" <add>} <ide> ``` <ide> <ide> **Example response**: <ide> <del> HTTP/1.1 200 OK <add> HTTP/1.1 200 OK <ide> <ide> Status Codes: <ide> <ide> Disconnects a container from a network <ide> <ide> **Example request**: <ide> <del> POST /networks/22be93d5babb089c5aab8dbc369042fad48ff791584ca2da2100db837a1c7c30/disconnect HTTP/1.1 <del> Content-Type: application/json <del> <ide> ``` <del> { <del> "container":"3613f73ba0e4" <del> } <add>POST /networks/22be93d5babb089c5aab8dbc369042fad48ff791584ca2da2100db837a1c7c30/disconnect HTTP/1.1 <add>Content-Type: application/json <add> <add>{ <add> "Container":"3613f73ba0e4" <add>} <ide> ``` <ide> <ide> **Example response**: <ide> <del> HTTP/1.1 200 OK <add> HTTP/1.1 200 OK <ide> <ide> Status Codes: <ide> <ide> Status Codes: <ide> <ide> JSON Parameters: <ide> <del>- **container** - container-id/name to be disconnected from a network <add>- **Container** - container-id/name to be disconnected from a network <ide> <ide> ### Remove a network <ide> <ide> Instruct the driver to remove the network (`id`). <ide> <ide> **Example request**: <ide> <del> DELETE /networks/22be93d5babb089c5aab8dbc369042fad48ff791584ca2da2100db837a1c7c30 HTTP/1.1 <add> DELETE /networks/22be93d5babb089c5aab8dbc369042fad48ff791584ca2da2100db837a1c7c30 HTTP/1.1 <ide> <ide> **Example response**: <ide> <del> HTTP/1.1 204 No Content <add> HTTP/1.1 204 No Content <ide> <ide> Status Codes <ide>
4
PHP
PHP
remove new setter
d3c0063fb728b0586318e38669267c5b4ad115a3
<ide><path>src/Datasource/QueryTrait.php <ide> public function getEagerLoaded() <ide> return $this->_eagerLoaded; <ide> } <ide> <del> /** <del> * Sets the query instance to be an eager loaded query. <del> * <del> * @param bool $value Whether or not to eager load. <del> * @return $this <del> */ <del> public function setEagerLoaded($value) <del> { <del> $this->_eagerLoaded = $value; <del> <del> return $this; <del> } <del> <ide> /** <ide> * Sets the query instance to be an eager loaded query. If no argument is <ide> * passed, the current configured query `_eagerLoaded` value is returned. <ide> * <del> * @deprecated 3.5.0 Use getEagerLoaded()/setEagerLoaded() instead. <add> * @deprecated 3.5.0 Use getEagerLoaded() for the getter part instead. <ide> * @param bool|null $value Whether or not to eager load. <ide> * @return $this|\Cake\ORM\Query <ide> */ <ide><path>src/ORM/Association.php <ide> public function attachTo(Query $query, array $options = []) <ide> list($finder, $opts) = $this->_extractFinder($options['finder']); <ide> $dummy = $this <ide> ->find($finder, $opts) <del> ->setEagerLoaded(true); <add> ->eagerLoaded(true); <ide> <ide> if (!empty($options['queryBuilder'])) { <ide> $dummy = $options['queryBuilder']($dummy); <ide><path>src/ORM/Association/Loader/SelectLoader.php <ide> protected function _buildQuery($options) <ide> $fetchQuery = $finder() <ide> ->select($options['fields']) <ide> ->where($options['conditions']) <del> ->setEagerLoaded(true) <add> ->eagerLoaded(true) <ide> ->enableHydration($options['query']->isHydrationEnabled()); <ide> <ide> if ($useSubquery) {
3
Go
Go
avoid double close of agentinitdone
b29ba21551d65e525b7bc819a40eac2c636fab1f
<ide><path>libnetwork/agent.go <ide> func (c *controller) agentSetup() error { <ide> } <ide> } <ide> <del> if c.agent != nil { <add> c.Lock() <add> if c.agent != nil && c.agentInitDone != nil { <ide> close(c.agentInitDone) <add> c.agentInitDone = nil <ide> } <add> c.Unlock() <ide> <ide> return nil <ide> } <ide><path>libnetwork/controller.go <ide> func (c *controller) clusterAgentInit() { <ide> // AgentInitWait waits for agent initialization to be completed in the <ide> // controller. <ide> func (c *controller) AgentInitWait() { <del> <-c.agentInitDone <add> c.Lock() <add> agentInitDone := c.agentInitDone <add> c.Unlock() <add> <add> if agentInitDone != nil { <add> <-agentInitDone <add> } <ide> } <ide> <ide> func (c *controller) makeDriverConfig(ntype string) map[string]interface{} {
2
Ruby
Ruby
fix cleanup check
f7d3710d12247c0c5bb07264834d6503216cba6b
<ide><path>Library/Homebrew/cmd/test-bot.rb <ide> def cleanup_before <ide> git "rebase", "--abort" <ide> git "reset", "--hard" <ide> git "checkout", "-f", "master" <del> git "clean", "-ffdx" unless ENV["HOMEBREW_RUBY_PATH"] <add> git "clean", "-ffdx" unless ENV["HOMEBREW_RUBY"] == "1.8.7" <ide> pr_locks = "#{HOMEBREW_REPOSITORY}/.git/refs/remotes/*/pr/*/*.lock" <ide> Dir.glob(pr_locks) { |lock| FileUtils.rm_rf lock } <ide> end
1
Mixed
PHP
pass console command to database seeders
de37fe0e07eba65c276c13bcb09e2be5ff956b1b
<ide><path>readme.md <ide> - Added `pop` and `shift` methods to Eloquent collection. <ide> - Allow `Input::get` to be used on JSON requests to give unified API across request types. <ide> - Allow `sync` to also update the other pivot table attributes. <add>- Pass console `Command` instance to database seeders. <ide> <ide> ## Beta 3 <ide> <ide><path>src/Illuminate/Console/Command.php <ide> public function call($command, array $arguments = array()) <ide> * @param string $key <ide> * @return string|array <ide> */ <del> protected function argument($key = null) <add> public function argument($key = null) <ide> { <ide> if (is_null($key)) return $this->input->getArguments(); <ide> <ide> protected function argument($key = null) <ide> * @param string $key <ide> * @return string|array <ide> */ <del> protected function option($key = null) <add> public function option($key = null) <ide> { <ide> if (is_null($key)) return $this->input->getOptions(); <ide> <ide> protected function option($key = null) <ide> * @param bool $default <ide> * @return bool <ide> */ <del> protected function confirm($question, $default = true) <add> public function confirm($question, $default = true) <ide> { <ide> $dialog = $this->getHelperSet()->get('dialog'); <ide> <ide> protected function confirm($question, $default = true) <ide> * @param string $default <ide> * @return string <ide> */ <del> protected function ask($question, $default = null) <add> public function ask($question, $default = null) <ide> { <ide> $dialog = $this->getHelperSet()->get('dialog'); <ide> <ide> protected function ask($question, $default = null) <ide> * @param string $default <ide> * @return string <ide> */ <del> protected function secret($question, $default = null) <add> public function secret($question, $default = null) <ide> { <ide> $dialog = $this->getHelperSet()->get('dialog'); <ide> <ide> protected function secret($question, $default = null) <ide> * @param string $string <ide> * @return void <ide> */ <del> protected function line($string) <add> public function line($string) <ide> { <ide> $this->output->writeln($string); <ide> } <ide> protected function line($string) <ide> * @param string $string <ide> * @return void <ide> */ <del> protected function info($string) <add> public function info($string) <ide> { <ide> $this->output->writeln("<info>$string</info>"); <ide> } <ide> protected function info($string) <ide> * @param string $string <ide> * @return void <ide> */ <del> protected function comment($string) <add> public function comment($string) <ide> { <ide> $this->output->writeln("<comment>$string</comment>"); <ide> } <ide> protected function comment($string) <ide> * @param string $string <ide> * @return void <ide> */ <del> protected function question($string) <add> public function question($string) <ide> { <ide> $this->output->writeln("<question>$string</question>"); <ide> } <ide> protected function question($string) <ide> * @param string $string <ide> * @return void <ide> */ <del> protected function error($string) <add> public function error($string) <ide> { <ide> $this->output->writeln("<error>$string</error>"); <ide> } <ide><path>src/Illuminate/Database/Console/SeedCommand.php <ide> public function fire() <ide> */ <ide> protected function getSeeder() <ide> { <del> return $this->laravel->make($this->input->getOption('class')); <add> $class = $this->laravel->make($this->input->getOption('class')); <add> <add> return $class->setContainer($this->laravel)->setCommand($this); <ide> } <ide> <ide> /** <ide><path>src/Illuminate/Database/Seeder.php <ide> <?php namespace Illuminate\Database; <ide> <add>use Illuminate\Console\Command; <ide> use Illuminate\Container\Container; <ide> use Illuminate\Filesystem\Filesystem; <ide> <ide> class Seeder { <ide> */ <ide> protected $container; <ide> <add> /** <add> * The console command instance. <add> * <add> * @var Illuminate\Console\Command <add> */ <add> protected $command; <add> <ide> /** <ide> * Run the database seeds. <ide> * <ide> protected function resolve($class) <ide> { <ide> $instance = $this->container->make($class); <ide> <del> return $instance->setContainer($this->container); <add> return $instance->setContainer($this->container)->setCommand($this->command); <ide> } <ide> else <ide> { <ide> public function setContainer(Container $container) <ide> return $this; <ide> } <ide> <add> /** <add> * Set the console command instance. <add> * <add> * @param Illuminate\Console\Command $command <add> * @return void <add> */ <add> public function setCommand(Command $command) <add> { <add> $this->command = $command; <add> <add> return $this; <add> } <add> <ide> } <ide>\ No newline at end of file <ide><path>tests/Database/DatabaseSeederTest.php <ide> public function testCallResolveTheClassAndCallsRun() <ide> { <ide> $seeder = new Seeder; <ide> $seeder->setContainer($container = m::mock('Illuminate\Container\Container')); <add> $seeder->setCommand($command = m::mock('Illuminate\Console\Command')); <ide> $container->shouldReceive('make')->once()->with('ClassName')->andReturn($child = m::mock('StdClass')); <ide> $child->shouldReceive('setContainer')->once()->with($container)->andReturn($child); <add> $child->shouldReceive('setCommand')->once()->with($command)->andReturn($child); <ide> $child->shouldReceive('run')->once(); <ide> <ide> $seeder->call('ClassName');
5
Text
Text
add lundibundi to collaborators
a65c633738e3f7f7818065e7ea67ad05032e0096
<ide><path>README.md <ide> For more information about the governance of the Node.js project, see <ide> **Luigi Pinca** &lt;[email protected]&gt; (he/him) <ide> * [lucamaraschi](https://github.com/lucamaraschi) - <ide> **Luca Maraschi** &lt;[email protected]&gt; (he/him) <add>* [lundibundi](https://github.com/lundibundi) - <add>**Denys Otrishko** &lt;[email protected]&gt; (he/him) <ide> * [maclover7](https://github.com/maclover7) - <ide> **Jon Moss** &lt;[email protected]&gt; (he/him) <ide> * [mafintosh](https://github.com/mafintosh)
1
Javascript
Javascript
use errno constant with err_fs_eisdir
275153ddc4fe0e49d5f73807edaa6eca0c3041cb
<ide><path>lib/internal/fs/utils.js <ide> const kStats = Symbol('stats'); <ide> const assert = require('internal/assert'); <ide> <ide> const { <del> F_OK = 0, <del> W_OK = 0, <del> R_OK = 0, <del> X_OK = 0, <del> COPYFILE_EXCL, <del> COPYFILE_FICLONE, <del> COPYFILE_FICLONE_FORCE, <del> O_APPEND, <del> O_CREAT, <del> O_EXCL, <del> O_RDONLY, <del> O_RDWR, <del> O_SYNC, <del> O_TRUNC, <del> O_WRONLY, <del> S_IFBLK, <del> S_IFCHR, <del> S_IFDIR, <del> S_IFIFO, <del> S_IFLNK, <del> S_IFMT, <del> S_IFREG, <del> S_IFSOCK, <del> UV_FS_SYMLINK_DIR, <del> UV_FS_SYMLINK_JUNCTION, <del> UV_DIRENT_UNKNOWN, <del> UV_DIRENT_FILE, <del> UV_DIRENT_DIR, <del> UV_DIRENT_LINK, <del> UV_DIRENT_FIFO, <del> UV_DIRENT_SOCKET, <del> UV_DIRENT_CHAR, <del> UV_DIRENT_BLOCK <del>} = internalBinding('constants').fs; <add> fs: { <add> F_OK = 0, <add> W_OK = 0, <add> R_OK = 0, <add> X_OK = 0, <add> COPYFILE_EXCL, <add> COPYFILE_FICLONE, <add> COPYFILE_FICLONE_FORCE, <add> O_APPEND, <add> O_CREAT, <add> O_EXCL, <add> O_RDONLY, <add> O_RDWR, <add> O_SYNC, <add> O_TRUNC, <add> O_WRONLY, <add> S_IFBLK, <add> S_IFCHR, <add> S_IFDIR, <add> S_IFIFO, <add> S_IFLNK, <add> S_IFMT, <add> S_IFREG, <add> S_IFSOCK, <add> UV_FS_SYMLINK_DIR, <add> UV_FS_SYMLINK_JUNCTION, <add> UV_DIRENT_UNKNOWN, <add> UV_DIRENT_FILE, <add> UV_DIRENT_DIR, <add> UV_DIRENT_LINK, <add> UV_DIRENT_FIFO, <add> UV_DIRENT_SOCKET, <add> UV_DIRENT_CHAR, <add> UV_DIRENT_BLOCK <add> }, <add> os: { <add> errno: { <add> EISDIR <add> } <add> } <add>} = internalBinding('constants'); <ide> <ide> // The access modes can be any of F_OK, R_OK, W_OK or X_OK. Some might not be <ide> // available on specific systems. They can be used in combination as well <ide> const validateRmOptions = hideStackFrames((path, options, callback) => { <ide> message: 'is a directory', <ide> path, <ide> syscall: 'rm', <del> errno: -21 <add> errno: EISDIR <ide> })); <ide> } <ide> return callback(null, options); <ide> const validateRmOptionsSync = hideStackFrames((path, options) => { <ide> message: 'is a directory', <ide> path, <ide> syscall: 'rm', <del> errno: -21 <add> errno: EISDIR <ide> }); <ide> } <ide> } catch (err) {
1
Text
Text
fix broken markup in changelog [ci skip]
378dd7a4a8f00aee7c2a00c66e66c2cf12a402fe
<ide><path>activesupport/CHANGELOG.md <ide> <ide> Before: <ide> <del> 'foobar'.truncate(5).frozen? <del> => true <del> 'foobar'.truncate(6).frozen? <del> => false <add> 'foobar'.truncate(5).frozen? <add> # => true <add> 'foobar'.truncate(6).frozen? <add> # => false <ide> <ide> After: <ide> <del> 'foobar'.truncate(5).frozen? <del> => false <del> 'foobar'.truncate(6).frozen? <del> => false <add> 'foobar'.truncate(5).frozen? <add> # => false <add> 'foobar'.truncate(6).frozen? <add> # => false <ide> <ide> *Jordan Thomas* <ide> <add> <ide> Please check [6-0-stable](https://github.com/rails/rails/blob/6-0-stable/activesupport/CHANGELOG.md) for previous changes.
1
Python
Python
add files via upload (#396)
5be32f4022135a10585cf094b6fb8118dd87a2f6
<ide><path>ciphers/Atbash.py <add>def Atbash(): <add> inp=raw_input("Enter the sentence to be encrypted ") <add> output="" <add> for i in inp: <add> extract=ord(i) <add> if extract>=65 and extract<=90: <add> output+=(unichr(155-extract)) <add> elif extract>=97 and extract<=122: <add> output+=(unichr(219-extract)) <add> else: <add> output+=i <add> print output <add> <add>Atbash() ; <ide>\ No newline at end of file
1
PHP
PHP
use https for various other urls
8d4a13a3d1e3adf6d8d4f2d086386ca9bfa1259c
<ide><path>src/Cache/Engine/ApcEngine.php <ide> public function clear($check) <ide> * @param string $key Identifier for the data. <ide> * @param mixed $value Data to be cached. <ide> * @return bool True if the data was successfully cached, false on failure. <del> * @link http://php.net/manual/en/function.apc-add.php <add> * @link https://secure.php.net/manual/en/function.apc-add.php <ide> */ <ide> public function add($key, $value) <ide> { <ide><path>src/Cache/Engine/MemcachedEngine.php <ide> protected function _parseServerString($server) <ide> * @param string $key Identifier for the data <ide> * @param mixed $value Data to be cached <ide> * @return bool True if the data was successfully cached, false on failure <del> * @see http://php.net/manual/en/memcache.set.php <add> * @see https://secure.php.net/manual/en/memcache.set.php <ide> */ <ide> public function write($key, $value) <ide> { <ide><path>src/Console/ConsoleErrorHandler.php <ide> public function __construct($options = []) <ide> * @param \Exception $exception Exception instance. <ide> * @return void <ide> * @throws \Exception When renderer class not found <del> * @see http://php.net/manual/en/function.set-exception-handler.php <add> * @see https://secure.php.net/manual/en/function.set-exception-handler.php <ide> */ <ide> public function handleException(Exception $exception) <ide> { <ide><path>src/Console/Shell.php <ide> public function helper($name, array $settings = []) <ide> * Stop execution of the current script. <ide> * Raises a StopException to try and halt the execution. <ide> * <del> * @param int|string $status see http://php.net/exit for values <add> * @param int|string $status see https://secure.php.net/exit for values <ide> * @throws \Cake\Console\Exception\StopException <ide> * @return void <ide> */ <ide><path>src/Core/Configure/Engine/IniConfig.php <ide> * 'yes', 'no', 'on', 'off', 'null' are handled. These values will be <ide> * converted to their boolean equivalents. <ide> * <del> * @see http://php.net/parse_ini_file <add> * @see https://secure.php.net/parse_ini_file <ide> */ <ide> class IniConfig implements ConfigEngineInterface <ide> { <ide><path>src/Database/Schema/SqlserverSchema.php <ide> public function describeColumnSql($tableName, $config) <ide> * @param int|null $precision The column precision <ide> * @param int|null $scale The column scale <ide> * @return array Array of column information. <del> * @link http://technet.microsoft.com/en-us/library/ms187752.aspx <add> * @link https://technet.microsoft.com/en-us/library/ms187752.aspx <ide> */ <ide> protected function _convertColumn($col, $length = null, $precision = null, $scale = null) <ide> { <ide><path>src/Error/BaseErrorHandler.php <ide> public function wrapAndHandleException($exception) <ide> * @param \Exception $exception Exception instance. <ide> * @return void <ide> * @throws \Exception When renderer class not found <del> * @see http://php.net/manual/en/function.set-exception-handler.php <add> * @see https://secure.php.net/manual/en/function.set-exception-handler.php <ide> */ <ide> public function handleException(Exception $exception) <ide> { <ide><path>src/Error/Debugger.php <ide> public function __construct() <ide> $docRef = ini_get('docref_root'); <ide> <ide> if (empty($docRef) && function_exists('ini_set')) { <del> ini_set('docref_root', 'http://php.net/'); <add> ini_set('docref_root', 'https://secure.php.net/'); <ide> } <ide> if (!defined('E_RECOVERABLE_ERROR')) { <ide> define('E_RECOVERABLE_ERROR', 4096); <ide> public static function trimPath($path) <ide> * @param int $line Line number to highlight. <ide> * @param int $context Number of lines of context to extract above and below $line. <ide> * @return array Set of lines highlighted <del> * @see http://php.net/highlight_string <add> * @see https://secure.php.net/highlight_string <ide> * @link https://book.cakephp.org/3.0/en/development/debugging.html#getting-an-excerpt-from-a-file <ide> */ <ide> public static function excerpt($file, $line, $context = 2) <ide><path>src/Event/Decorator/AbstractDecorator.php <ide> public function __construct(callable $callable, array $options = []) <ide> /** <ide> * Invoke <ide> * <del> * @link http://php.net/manual/en/language.oop5.magic.php#object.invoke <add> * @link https://secure.php.net/manual/en/language.oop5.magic.php#object.invoke <ide> * @return mixed <ide> */ <ide> public function __invoke() <ide><path>src/Event/EventList.php <ide> public function add(Event $event) <ide> /** <ide> * Whether a offset exists <ide> * <del> * @link http://php.net/manual/en/arrayaccess.offsetexists.php <add> * @link https://secure.php.net/manual/en/arrayaccess.offsetexists.php <ide> * @param mixed $offset An offset to check for. <ide> * @return bool True on success or false on failure. <ide> */ <ide> public function offsetExists($offset) <ide> /** <ide> * Offset to retrieve <ide> * <del> * @link http://php.net/manual/en/arrayaccess.offsetget.php <add> * @link https://secure.php.net/manual/en/arrayaccess.offsetget.php <ide> * @param mixed $offset The offset to retrieve. <ide> * @return mixed Can return all value types. <ide> */ <ide> public function offsetGet($offset) <ide> /** <ide> * Offset to set <ide> * <del> * @link http://php.net/manual/en/arrayaccess.offsetset.php <add> * @link https://secure.php.net/manual/en/arrayaccess.offsetset.php <ide> * @param mixed $offset The offset to assign the value to. <ide> * @param mixed $value The value to set. <ide> * @return void <ide> public function offsetSet($offset, $value) <ide> /** <ide> * Offset to unset <ide> * <del> * @link http://php.net/manual/en/arrayaccess.offsetunset.php <add> * @link https://secure.php.net/manual/en/arrayaccess.offsetunset.php <ide> * @param mixed $offset The offset to unset. <ide> * @return void <ide> */ <ide> public function offsetUnset($offset) <ide> /** <ide> * Count elements of an object <ide> * <del> * @link http://php.net/manual/en/countable.count.php <add> * @link https://secure.php.net/manual/en/countable.count.php <ide> * @return int The custom count as an integer. <ide> */ <ide> public function count() <ide><path>src/Filesystem/File.php <ide> public static function prepare($data, $forceWindows = false) <ide> * Write given data to this file. <ide> * <ide> * @param string $data Data to write to this File. <del> * @param string $mode Mode of writing. {@link http://php.net/fwrite See fwrite()}. <add> * @param string $mode Mode of writing. {@link https://secure.php.net/fwrite See fwrite()}. <ide> * @param bool $force Force the file to open <ide> * @return bool Success <ide> */ <ide> public function safe($name = null, $ext = null) <ide> * Get md5 Checksum of file with previous check of Filesize <ide> * <ide> * @param int|bool $maxsize in MB or true to force <del> * @return string|false md5 Checksum {@link http://php.net/md5_file See md5_file()}, or false in case of an error <add> * @return string|false md5 Checksum {@link https://secure.php.net/md5_file See md5_file()}, or false in case of an error <ide> */ <ide> public function md5($maxsize = 5) <ide> { <ide><path>src/Http/Client/Auth/Basic.php <ide> class Basic <ide> * @param \Cake\Http\Client\Request $request Request instance. <ide> * @param array $credentials Credentials. <ide> * @return \Cake\Http\Client\Request The updated request. <del> * @see http://www.ietf.org/rfc/rfc2617.txt <add> * @see https://www.ietf.org/rfc/rfc2617.txt <ide> */ <ide> public function authentication(Request $request, array $credentials) <ide> { <ide> public function authentication(Request $request, array $credentials) <ide> * @param \Cake\Http\Client\Request $request Request instance. <ide> * @param array $credentials Credentials. <ide> * @return \Cake\Http\Client\Request The updated request. <del> * @see http://www.ietf.org/rfc/rfc2617.txt <add> * @see https://www.ietf.org/rfc/rfc2617.txt <ide> */ <ide> public function proxyAuthentication(Request $request, array $credentials) <ide> { <ide><path>src/Http/Client/Auth/Digest.php <ide> public function __construct(Client $client, $options = null) <ide> * @param \Cake\Http\Client\Request $request The request object. <ide> * @param array $credentials Authentication credentials. <ide> * @return \Cake\Http\Client\Request The updated request. <del> * @see http://www.ietf.org/rfc/rfc2617.txt <add> * @see https://www.ietf.org/rfc/rfc2617.txt <ide> */ <ide> public function authentication(Request $request, array $credentials) <ide> { <ide><path>src/Http/Response.php <ide> public function getStatusCode() <ide> * If the status code is 304 or 204, the existing Content-Type header <ide> * will be cleared, as these response codes have no body. <ide> * <del> * @link http://tools.ietf.org/html/rfc7231#section-6 <del> * @link http://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml <add> * @link https://tools.ietf.org/html/rfc7231#section-6 <add> * @link https://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml <ide> * @param int $code The 3-digit integer result code to set. <ide> * @param string $reasonPhrase The reason phrase to use with the <ide> * provided status code; if none is provided, implementations MAY <ide> public function withStatus($code, $reasonPhrase = '') <ide> * listed in the IANA HTTP Status Code Registry) for the response's <ide> * status code. <ide> * <del> * @link http://tools.ietf.org/html/rfc7231#section-6 <add> * @link https://tools.ietf.org/html/rfc7231#section-6 <ide> * @link http://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml <ide> * @return string Reason phrase; must return an empty string if none present. <ide> */ <ide> protected function _flushBuffer() <ide> * Stop execution of the current script. Wraps exit() making <ide> * testing easier. <ide> * <del> * @param int|string $status See http://php.net/exit for values <add> * @param int|string $status See https://secure.php.net/exit for values <ide> * @return void <ide> * @deprecated 3.4.0 Will be removed in 4.0.0 <ide> */ <ide><path>src/Http/ResponseEmitter.php <ide> * <ide> * Parts of this file are derived from Zend-Diactoros <ide> * <del> * @copyright Copyright (c) 2015-2016 Zend Technologies USA Inc. (http://www.zend.com) <add> * @copyright Copyright (c) 2015-2016 Zend Technologies USA Inc. (https://www.zend.com/) <ide> * @license https://github.com/zendframework/zend-diactoros/blob/master/LICENSE.md New BSD License <ide> */ <ide> namespace Cake\Http; <ide> protected function flush($maxBufferLevel = null) <ide> <ide> /** <ide> * Parse content-range header <del> * http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.16 <add> * https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.16 <ide> * <ide> * @param string $header The Content-Range header to parse. <ide> * @return false|array [unit, first, last, length]; returns false if no <ide><path>src/Http/ServerRequest.php <ide> public function withUri(UriInterface $uri, $preserveHost = false) <ide> * inferred from the request's Uri. This also lets you change the request <ide> * target's form to an absolute-form, authority-form or asterisk-form <ide> * <del> * @link http://tools.ietf.org/html/rfc7230#section-2.7 (for the various <add> * @link https://tools.ietf.org/html/rfc7230#section-2.7 (for the various <ide> * request-target forms allowed in request messages) <ide> * @param string $target The request target. <ide> * @return static <ide><path>src/I18n/Date.php <ide> class Date extends MutableDate implements JsonSerializable <ide> * and `__toString` <ide> * <ide> * The format should be either the formatting constants from IntlDateFormatter as <del> * described in (http://www.php.net/manual/en/class.intldateformatter.php) or a pattern <add> * described in (https://secure.php.net/manual/en/class.intldateformatter.php) or a pattern <ide> * as specified in (http://www.icu-project.org/apiref/icu4c/classSimpleDateFormat.html#details) <ide> * <ide> * It is possible to provide an array of 2 constants. In this case, the first position <ide> class Date extends MutableDate implements JsonSerializable <ide> * The format to use when formatting a time using `Cake\I18n\Date::nice()` <ide> * <ide> * The format should be either the formatting constants from IntlDateFormatter as <del> * described in (http://www.php.net/manual/en/class.intldateformatter.php) or a pattern <add> * described in (https://secure.php.net/manual/en/class.intldateformatter.php) or a pattern <ide> * as specified in (http://www.icu-project.org/apiref/icu4c/classSimpleDateFormat.html#details) <ide> * <ide> * It is possible to provide an array of 2 constants. In this case, the first position <ide><path>src/I18n/DateFormatTrait.php <ide> trait DateFormatTrait <ide> * The format to use when when converting this object to json <ide> * <ide> * The format should be either the formatting constants from IntlDateFormatter as <del> * described in (http://www.php.net/manual/en/class.intldateformatter.php) or a pattern <add> * described in (https://secure.php.net/manual/en/class.intldateformatter.php) or a pattern <ide> * as specified in (http://www.icu-project.org/apiref/icu4c/classSimpleDateFormat.html#details) <ide> * <ide> * It is possible to provide an array of 2 constants. In this case, the first position <ide> public function nice($timezone = null, $locale = null) <ide> * possible formats accepted by this function. <ide> * <ide> * You can read about the available IntlDateFormatter constants at <del> * http://www.php.net/manual/en/class.intldateformatter.php <add> * https://secure.php.net/manual/en/class.intldateformatter.php <ide> * <ide> * If you need to display the date in a different timezone than the one being used for <ide> * this Time object without altering its internal state, you can pass a timezone <ide><path>src/I18n/FrozenDate.php <ide> class FrozenDate extends ChronosDate implements JsonSerializable <ide> * and `__toString` <ide> * <ide> * The format should be either the formatting constants from IntlDateFormatter as <del> * described in (http://www.php.net/manual/en/class.intldateformatter.php) or a pattern <add> * described in (https://secure.php.net/manual/en/class.intldateformatter.php) or a pattern <ide> * as specified in (http://www.icu-project.org/apiref/icu4c/classSimpleDateFormat.html#details) <ide> * <ide> * It is possible to provide an array of 2 constants. In this case, the first position <ide> class FrozenDate extends ChronosDate implements JsonSerializable <ide> * The format to use when formatting a time using `Cake\I18n\Date::nice()` <ide> * <ide> * The format should be either the formatting constants from IntlDateFormatter as <del> * described in (http://www.php.net/manual/en/class.intldateformatter.php) or a pattern <add> * described in (https://secure.php.net/manual/en/class.intldateformatter.php) or a pattern <ide> * as specified in (http://www.icu-project.org/apiref/icu4c/classSimpleDateFormat.html#details) <ide> * <ide> * It is possible to provide an array of 2 constants. In this case, the first position <ide><path>src/I18n/FrozenTime.php <ide> class FrozenTime extends Chronos implements JsonSerializable <ide> * and `__toString` <ide> * <ide> * The format should be either the formatting constants from IntlDateFormatter as <del> * described in (http://www.php.net/manual/en/class.intldateformatter.php) or a pattern <add> * described in (https://secure.php.net/manual/en/class.intldateformatter.php) or a pattern <ide> * as specified in (http://www.icu-project.org/apiref/icu4c/classSimpleDateFormat.html#details) <ide> * <ide> * It is possible to provide an array of 2 constants. In this case, the first position <ide> class FrozenTime extends Chronos implements JsonSerializable <ide> * The format to use when formatting a time using `Cake\I18n\FrozenTime::nice()` <ide> * <ide> * The format should be either the formatting constants from IntlDateFormatter as <del> * described in (http://www.php.net/manual/en/class.intldateformatter.php) or a pattern <add> * described in (https://secure.php.net/manual/en/class.intldateformatter.php) or a pattern <ide> * as specified in (http://www.icu-project.org/apiref/icu4c/classSimpleDateFormat.html#details) <ide> * <ide> * It is possible to provide an array of 2 constants. In this case, the first position <ide><path>src/I18n/Parser/PoFileParser.php <ide> class PoFileParser <ide> /** <ide> * Parses portable object (PO) format. <ide> * <del> * From http://www.gnu.org/software/gettext/manual/gettext.html#PO-Files <add> * From https://www.gnu.org/software/gettext/manual/gettext.html#PO-Files <ide> * we should be able to parse files having: <ide> * <ide> * white-space <ide><path>src/I18n/Time.php <ide> class Time extends MutableDateTime implements JsonSerializable <ide> * and `__toString` <ide> * <ide> * The format should be either the formatting constants from IntlDateFormatter as <del> * described in (http://www.php.net/manual/en/class.intldateformatter.php) or a pattern <add> * described in (https://secure.php.net/manual/en/class.intldateformatter.php) or a pattern <ide> * as specified in (http://www.icu-project.org/apiref/icu4c/classSimpleDateFormat.html#details) <ide> * <ide> * It is possible to provide an array of 2 constants. In this case, the first position <ide> class Time extends MutableDateTime implements JsonSerializable <ide> * The format to use when formatting a time using `Cake\I18n\Time::nice()` <ide> * <ide> * The format should be either the formatting constants from IntlDateFormatter as <del> * described in (http://www.php.net/manual/en/class.intldateformatter.php) or a pattern <add> * described in (https://secure.php.net/manual/en/class.intldateformatter.php) or a pattern <ide> * as specified in (http://www.icu-project.org/apiref/icu4c/classSimpleDateFormat.html#details) <ide> * <ide> * It is possible to provide an array of 2 constants. In this case, the first position <ide><path>src/I18n/Translator.php <ide> * The Aura Project for PHP. <ide> * <ide> * @package Aura.Intl <del> * @license http://opensource.org/licenses/bsd-license.php BSD <add> * @license https://opensource.org/licenses/bsd-license.php BSD <ide> */ <ide> namespace Cake\I18n; <ide> <ide><path>src/Log/Engine/BaseLog.php <ide> * Redistributions of files must retain the above copyright notice. <ide> * <ide> * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) <del> * @link http://www.cakefoundation.org/projects/info/cakephp CakePHP(tm) Project <add> * @link https://cakefoundation.org CakePHP(tm) Project <ide> * @since 2.2.0 <ide> * @license https://opensource.org/licenses/mit-license.php MIT License <ide> */ <ide><path>src/Log/Engine/ConsoleLog.php <ide> * Redistributions of files must retain the above copyright notice. <ide> * <ide> * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) <del> * @link http://www.cakefoundation.org/projects/info/cakephp CakePHP(tm) Project <add> * @link https://cakefoundation.org CakePHP(tm) Project <ide> * @since 2.2.0 <ide> * @license https://opensource.org/licenses/mit-license.php MIT License <ide> */ <ide><path>src/Log/Engine/FileLog.php <ide> * Redistributions of files must retain the above copyright notice. <ide> * <ide> * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) <del> * @link http://www.cakefoundation.org/projects/info/cakephp CakePHP(tm) Project <add> * @link https://cakefoundation.org CakePHP(tm) Project <ide> * @since 1.3.0 <ide> * @license https://opensource.org/licenses/mit-license.php MIT License <ide> */ <ide><path>src/Log/Engine/SyslogLog.php <ide> * Redistributions of files must retain the above copyright notice. <ide> * <ide> * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) <del> * @link http://www.cakefoundation.org/projects/info/cakephp CakePHP(tm) Project <add> * @link https://cakefoundation.org CakePHP(tm) Project <ide> * @since 2.4.0 <ide> * @license https://opensource.org/licenses/mit-license.php MIT License <ide> */ <ide><path>src/Log/Log.php <ide> class Log <ide> <ide> /** <ide> * Log levels as detailed in RFC 5424 <del> * http://tools.ietf.org/html/rfc5424 <add> * https://tools.ietf.org/html/rfc5424 <ide> * <ide> * @var array <ide> */ <ide><path>src/Mailer/Email.php <ide> * CakePHP Email class. <ide> * <ide> * This class is used for sending Internet Message Format based <del> * on the standard outlined in http://www.rfc-editor.org/rfc/rfc2822.txt <add> * on the standard outlined in https://www.rfc-editor.org/rfc/rfc2822.txt <ide> * <ide> * ### Configuration <ide> * <ide><path>src/ORM/Behavior/TreeBehavior.php <ide> * order will be cached. <ide> * <ide> * For more information on what is a nested set and a how it works refer to <del> * http://www.sitepoint.com/hierarchical-data-database-2/ <add> * https://www.sitepoint.com/hierarchical-data-database-2/ <ide> */ <ide> class TreeBehavior extends Behavior <ide> { <ide><path>src/Utility/Text.php <ide> class Text <ide> * Warning: This method should not be used as a random seed for any cryptographic operations. <ide> * Instead you should use the openssl or mcrypt extensions. <ide> * <del> * @see http://www.ietf.org/rfc/rfc4122.txt <add> * @see https://www.ietf.org/rfc/rfc4122.txt <ide> * @return string RFC 4122 UUID <ide> * @copyright Matt Farina MIT License https://github.com/lootils/uuid/blob/master/LICENSE <ide> */ <ide> public static function setTransliteratorId($transliteratorId) <ide> * @param string|null $transliteratorId Transliterator identifier. If null <ide> * Text::$_defaultTransliteratorId will be used. <ide> * @return string <del> * @see http://php.net/manual/en/transliterator.transliterate.php <add> * @see https://secure.php.net/manual/en/transliterator.transliterate.php <ide> */ <ide> public static function transliterate($string, $transliteratorId = null) <ide> { <ide><path>src/Utility/Xml.php <ide> protected static function _fromArray($dom, $node, &$data, $format) <ide> if ($key[0] !== '@' && $format === 'tags') { <ide> if (!is_numeric($value)) { <ide> // Escape special characters <del> // http://www.w3.org/TR/REC-xml/#syntax <add> // https://www.w3.org/TR/REC-xml/#syntax <ide> // https://bugs.php.net/bug.php?id=36795 <ide> $child = $dom->createElement($key, ''); <ide> $child->appendChild(new DOMText($value)); <ide><path>src/Validation/Validation.php <ide> public static function numeric($check) <ide> * @param string $check Value to check <ide> * @param bool $allowZero Set true to allow zero, defaults to false <ide> * @return bool Success <del> * @see http://en.wikipedia.org/wiki/Natural_number <add> * @see https://en.wikipedia.org/wiki/Natural_number <ide> */ <ide> public static function naturalNumber($check, $allowZero = false) <ide> { <ide> public static function range($check, $lower = null, $upper = null) <ide> } <ide> <ide> /** <del> * Checks that a value is a valid URL according to http://www.w3.org/Addressing/URL/url-spec.txt <add> * Checks that a value is a valid URL according to https://www.w3.org/Addressing/URL/url-spec.txt <ide> * <ide> * The regex checks for the following component parts: <ide> * <ide> * - a valid, optional, scheme <ide> * - a valid ip address OR <del> * a valid domain name as defined by section 2.3.1 of http://www.ietf.org/rfc/rfc1035.txt <add> * a valid domain name as defined by section 2.3.1 of https://www.ietf.org/rfc/rfc1035.txt <ide> * with an optional port number <ide> * - an optional valid path <ide> * - an optional query string (get parameters) <ide> public static function userDefined($check, $object, $method, $args = null) <ide> } <ide> <ide> /** <del> * Checks that a value is a valid UUID - http://tools.ietf.org/html/rfc4122 <add> * Checks that a value is a valid UUID - https://tools.ietf.org/html/rfc4122 <ide> * <ide> * @param string $check Value to check <ide> * @return bool Success <ide> protected static function _check($check, $regex) <ide> * <ide> * @param string|array $check Value to check. <ide> * @return bool Success <del> * @see http://en.wikipedia.org/wiki/Luhn_algorithm <add> * @see https://en.wikipedia.org/wiki/Luhn_algorithm <ide> */ <ide> public static function luhn($check) <ide> { <ide> public static function fileSize($check, $operator = null, $size = null) <ide> * @param string|array|\Psr\Http\Message\UploadedFileInterface $check Value to check. <ide> * @param bool $allowNoFile Set to true to allow UPLOAD_ERR_NO_FILE as a pass. <ide> * @return bool <del> * @see http://www.php.net/manual/en/features.file-upload.errors.php <add> * @see https://secure.php.net/manual/en/features.file-upload.errors.php <ide> */ <ide> public static function uploadError($check, $allowNoFile = false) <ide> { <ide><path>tests/TestCase/Error/DebuggerTest.php <ide> public function testDocRef() <ide> ini_set('docref_root', ''); <ide> $this->assertEquals(ini_get('docref_root'), ''); <ide> new Debugger(); <del> $this->assertEquals(ini_get('docref_root'), 'http://php.net/'); <add> $this->assertEquals(ini_get('docref_root'), 'https://secure.php.net/'); <ide> } <ide> <ide> /**
34
Ruby
Ruby
convert metafiles class to module
5b64fa6fb179bee5e45e16bb4f860579d76d4210
<ide><path>Library/Homebrew/metafiles.rb <ide> require "set" <ide> <del>class Metafiles <add>module Metafiles <ide> # https://github.com/github/markup#markups <ide> EXTENSIONS = Set.new %w[ <ide> .adoc .asc .asciidoc .creole .html .markdown .md .mdown .mediawiki .mkdn <ide> class Metafiles <ide> news notes notice readme todo <ide> ].freeze <ide> <del> def self.list?(file) <add> module_function <add> <add> def list?(file) <ide> return false if %w[.DS_Store INSTALL_RECEIPT.json].include?(file) <ide> !copy?(file) <ide> end <ide> <del> def self.copy?(file) <add> def copy?(file) <ide> file = file.downcase <ide> ext = File.extname(file) <ide> file = File.basename(file, ext) if EXTENSIONS.include?(ext)
1
Ruby
Ruby
simplify parts and tests
b2f98c13a3308e6db618d6f3f9f706cbc19f13fd
<ide><path>actionpack/lib/action_view/body_parts/future.rb <ide> module ActionView <ide> module BodyParts <ide> class Future <del> def initialize(&block) <del> @block = block <del> @parts = [] <del> end <del> <ide> def to_s <ide> finish <ide> body <ide> end <del> <del> protected <del> def work <del> @block.call(@parts) <del> end <del> <del> def body <del> str = '' <del> @parts.each { |part| str << part.to_s } <del> str <del> end <ide> end <ide> end <ide> end <ide><path>actionpack/lib/action_view/body_parts/queued.rb <ide> module ActionView <ide> module BodyParts <ide> class Queued < Future <del> def initialize(job, &block) <del> super(&block) <del> enqueue(job) <add> attr_reader :body <add> <add> def initialize(job) <add> @receipt = enqueue(job) <ide> end <ide> <ide> protected <del> def enqueue(job) <del> @receipt = submit(job) <del> end <del> <ide> def finish <del> @parts << redeem(@receipt) <add> @body = redeem(@receipt) <ide> end <ide> end <ide> end <ide><path>actionpack/lib/action_view/body_parts/threaded.rb <ide> module ActionView <ide> module BodyParts <ide> class Threaded < Future <ide> def initialize(concurrent = false, &block) <del> super(&block) <add> @block = block <add> @parts = [] <ide> concurrent ? start : work <ide> end <ide> <ide> protected <add> def work <add> @block.call(@parts) <add> end <add> <add> def body <add> str = '' <add> @parts.each { |part| str << part.to_s } <add> str <add> end <add> <ide> def start <ide> @worker = Thread.new { work } <ide> end <ide><path>actionpack/test/template/body_parts_test.rb <ide> def self.redemption_tag(receipt) <ide> end <ide> <ide> protected <del> def submit(job) <add> def enqueue(job) <ide> job.reverse <ide> end <ide> <ide> def future_render(&block) <ide> def test_concurrent_threaded_parts <ide> get :index <ide> <del> before = Time.now.to_i <del> thread_ids = @response.body.split('-').map { |part| part.split('::').first.to_i } <del> elapsed = Time.now.to_i - before <del> <del> assert_equal thread_ids.size, thread_ids.uniq.size <del> assert elapsed < 1.1 <add> elapsed = Benchmark.ms do <add> thread_ids = @response.body.split('-').map { |part| part.split('::').first.to_i } <add> assert_equal thread_ids.size, thread_ids.uniq.size <add> end <add> assert (elapsed - 1000).abs < 100, elapsed <ide> end <ide> end <ide> <ide> def index <ide> <ide> def render_url(url) <ide> url = URI.parse(url) <del> def url.read; path end <add> def url.read; sleep 1; path end <ide> response.template.punctuate_body! OpenUriPart.new(url) <ide> end <ide> end <ide> def test_concurrent_open_uri_parts <ide> elapsed = Benchmark.ms do <ide> assert_equal '/foo/bar/baz', @response.body <ide> end <del> assert elapsed < 1.1 <add> assert (elapsed - 1000).abs < 100, elapsed <ide> end <ide> end
4
PHP
PHP
add exception handling to integrationtestcase
45b93ef78e72c34d4ead6dba976cebaa4a9d1ee3
<ide><path>src/TestSuite/IntegrationTestCase.php <ide> protected function _sendRequest($url, $method, $data = null) { <ide> $request = $this->_buildRequest($url, $method, $data); <ide> $response = new Response(); <ide> $dispatcher = DispatcherFactory::create(); <del> $dispatcher->dispatch($request, $response); <del> $this->_response = $response; <add> try { <add> $dispatcher->dispatch($request, $response); <add> $this->_response = $response; <add> } catch (\PHPUnit_Exception $e) { <add> throw $e; <add> } catch (\Exception $e) { <add> $this->_handleError($e); <add> } <add> } <add> <add>/** <add> * Attempt to render an error response for a given exception. <add> * <add> * This method will attempt to use the configured exception renderer. <add> * If that class does not exist, the built-in renderer will be used. <add> * <add> * @param \Exception $exception Exception to handle. <add> * @return void <add> * @throws \Exception <add> */ <add> protected function _handleError($exception) { <add> $class = Configure::read('Error.exceptionRenderer'); <add> if (empty($class) || !class_exists($class)) { <add> $class = 'Cake\Error\ExceptionRenderer'; <add> } <add> $instance = new $class($exception); <add> $this->_response = $instance->render(); <ide> } <ide> <ide> /** <ide><path>tests/TestCase/TestSuite/IntegrationTestCaseTest.php <ide> public function testRequestBuilding() { <ide> * <ide> * @return void <ide> */ <del> public function testSendingGet() { <add> public function testGet() { <ide> $this->assertNull($this->_response); <ide> <ide> $this->get('/request_action/test_request_action'); <ide> public function testSendingGet() { <ide> $this->assertEquals('This is a test', $this->_response->body()); <ide> } <ide> <add>/** <add> * <add> */ <add> public function testPostAndErrorHandling() { <add> $this->post('/request_action/error_method'); <add> $this->assertResponseContains('Not there or here'); <add> $this->assertResponseContains('<!DOCTYPE html>'); <add> } <add> <ide> /** <ide> * Test the responseOk status assertion <ide> * <ide><path>tests/test_app/TestApp/Controller/RequestActionController.php <ide> */ <ide> namespace TestApp\Controller; <ide> <add>use Cake\Network\Exception\NotFoundException; <add> <ide> /** <ide> * RequestActionController class <ide> * <ide> public function session_test() { <ide> return $this->response; <ide> } <ide> <add>/** <add> * Tests exception handling <add> * <add> * @throws \Cake\Network\Exception\NotFoundException <add> * @return void <add> */ <add> public function error_method() { <add> throw new NotFoundException('Not there or here.'); <add> } <add> <ide> }
3
Ruby
Ruby
add docs to collectionassociation#any?
d029d50d48aa90655877749a57f316f6063fccf8
<ide><path>activerecord/lib/active_record/associations/collection_association.rb <ide> def empty? <ide> size.zero? <ide> end <ide> <add> # Returns true if the collections is not empty. <add> # Equivalent to +!collection.empty?+. <add> # <add> # class Person < ActiveRecord::Base <add> # has_many :pets <add> # end <add> # <add> # person.pets.count # => 0 <add> # person.pets.any? # => false <add> # <add> # person.pets << Pet.new(name: 'Snoop') <add> # person.pets.count # => 0 <add> # person.pets.any? # => true <add> # <add> # Also, you can pass a block to define a criteria. The behaviour <add> # is the same, it returns true if the collection based on the <add> # criteria is not empty. <add> # <add> # person.pets <add> # # => [#<Pet name: "Snoop", group: "dogs">] <add> # <add> # person.pets.any? do |pet| <add> # pet.group == 'cats' <add> # end <add> # # => false <add> # <add> # person.pets.any? do |pet| <add> # pet.group == 'dogs' <add> # end <add> # # => true <ide> def any? <ide> if block_given? <ide> load_target.any? { |*block_args| yield(*block_args) }
1