content_type
stringclasses
8 values
main_lang
stringclasses
7 values
message
stringlengths
1
50
sha
stringlengths
40
40
patch
stringlengths
52
962k
file_count
int64
1
300
Text
Text
add link to validators
a57ad0767421a86bd35bf5a72c337d6857ad5f42
<ide><path>docs/api-guide/fields.md <ide> Defaults to `False` <ide> <ide> If set, this gives the default value that will be used for the field if no input value is supplied. If not set the default behavior is to not populate the attribute at all. <ide> <del>May be set to a function or other callable, in which case the value will be evaluated each time it is used. When called, it will receive no arguments. If the callable has a `set_context` method, that will be called each time before getting the value with the field instance as only argument. <add>May be set to a function or other callable, in which case the value will be evaluated each time it is used. When called, it will receive no arguments. If the callable has a `set_context` method, that will be called each time before getting the value with the field instance as only argument. This works the same way as for [validators](validators.md#using-set_context). <ide> <ide> Note that setting a `default` value implies that the field is not required. Including both the `default` and `required` keyword arguments is invalid and will raise an error. <ide>
1
Text
Text
move firedfox to collaborator emeriti list
5dd611339f9f571d0faa83f57b85a20f074437d4
<ide><path>README.md <ide> For information about the governance of the Node.js project, see <ide> **Evan Lucas** &lt;[email protected]&gt; (he/him) <ide> * [fhinkel](https://github.com/fhinkel) - <ide> **Franziska Hinkelmann** &lt;[email protected]&gt; (she/her) <del>* [firedfox](https://github.com/firedfox) - <del>**Daniel Wang** &lt;[email protected]&gt; <ide> * [Fishrock123](https://github.com/Fishrock123) - <ide> **Jeremiah Senkpiel** &lt;[email protected]&gt; <ide> * [gabrielschulhof](https://github.com/gabrielschulhof) - <ide> For information about the governance of the Node.js project, see <ide> **Andras** &lt;[email protected]&gt; <ide> * [AnnaMag](https://github.com/AnnaMag) - <ide> **Anna M. Kedzierska** &lt;[email protected]&gt; <add>* [firedfox](https://github.com/firedfox) - <add>**Daniel Wang** &lt;[email protected]&gt; <ide> * [imran-iq](https://github.com/imran-iq) - <ide> **Imran Iqbal** &lt;[email protected]&gt; <ide> * [isaacs](https://github.com/isaacs) -
1
PHP
PHP
highlight utf8 compatible, fixes
3204ced2ed7812db291d3e7ed95f6c86c1d2f4ed
<ide><path>cake/libs/view/helpers/text.php <ide> function highlight($text, $phrase, $highlighter = '<span class="highlight">\1</s <ide> if ($considerHtml) { <ide> $key = '(?![^<]+>)' . $key . '(?![^<]+>)'; <ide> } <del> $replace[] = '|' . $key . '|i'; <add> $replace[] = '|' . $key . '|iu'; <ide> $with[] = empty($value) ? $highlighter : $value; <ide> } <ide> <ide> function highlight($text, $phrase, $highlighter = '<span class="highlight">\1</s <ide> $phrase = '(?![^<]+>)' . $phrase . '(?![^<]+>)'; <ide> } <ide> <del> return preg_replace('|'.$phrase.'|i', $highlighter, $text); <add> return preg_replace('|'.$phrase.'|iu', $highlighter, $text); <ide> } <ide> } <ide> /** <ide><path>cake/tests/cases/libs/view/helpers/text.test.php <ide> function testHighlight() { <ide> $phrases = null; <ide> $result = $this->Text->highlight($text, $phrases, '<b>\1</b>'); <ide> $this->assertEqual($result, $text); <add> <add> $text = 'Ich saß in einem Café am Übergang'; <add> $expected = 'Ich <b>saß</b> in einem <b>Café</b> am <b>Übergang</b>'; <add> $phrases = array('saß', 'café', 'übergang'); <add> $result = $this->Text->highlight($text, $phrases, '<b>\1</b>'); <add> $this->assertEqual($result, $expected); <ide> } <ide> <ide> function testHighlightConsiderHtml() {
2
Javascript
Javascript
fix formatting and test for correct error
9dd8ef4777957138ace4c9728d15283e2c2d85e8
<ide><path>src/core/__tests__/ReactComponentLifeCycle-test.js <ide> describe('ReactComponentLifeCycle', function() { <ide> .toThrow(); <ide> }); <ide> <del> it('should throw when calling setProps() on an unmounted component', function() { <add> it('should throw when calling setProps() on an unmounted component', <add> function() { <ide> var PropsToUpdate = React.createClass({ <ide> render: function() { <ide> return ( <ide> describe('ReactComponentLifeCycle', function() { <ide> ); <ide> } <ide> }); <del> var instance = <del> <PropsToUpdate <del> value="hello" <del> />; <add> var instance = <PropsToUpdate value="hello" />; <ide> expect(function() { <ide> instance.setProps({value: "goodbye"}); <del> }).toThrow(); <add> }).toThrow( <add> 'Invariant Violation: replaceProps(...): Can only update a ' + <add> 'mounted component.' <add> ); <ide> }); <ide> <ide> it('should allow state updates in componentDidMount', function() {
1
PHP
PHP
update encrypter comment
b7c147c77a44133e36893fbe5c88051ba392b113
<ide><path>app/config/app.php <ide> |-------------------------------------------------------------------------- <ide> | <ide> | This key is used by the Illuminate encrypter service and should be set <del> | to a random, long string, otherwise these encrypted values will not <del> | be safe. Make sure to change it before deploying any application! <add> | to a random, 32 character string, otherwise these encrypted strings <add> | will not be safe. Please do this before deploying an application! <ide> | <ide> */ <ide>
1
Ruby
Ruby
log the remote ip addr of clients behind a proxy
7e40e9585a5596558d71f76c61bb35316cb17a53
<ide><path>railties/lib/rails/rack/logger.rb <ide> def started_request_message(request) # :doc: <ide> 'Started %s "%s" for %s at %s' % [ <ide> request.request_method, <ide> request.filtered_path, <del> request.ip, <add> request.remote_ip, <ide> Time.now.to_default_s ] <ide> end <ide> <ide><path>railties/test/application/rack/logger_test.rb <ide> def logs <ide> wait <ide> assert_match 'Started HEAD "/"', logs <ide> end <add> <add> test "logger logs correct remote IP address" do <add> get "/", {}, { "REMOTE_ADDR" => "127.0.0.1", "HTTP_X_FORWARDED_FOR" => "1.2.3.4" } <add> wait <add> assert_match 'Started GET "/" for 1.2.3.4', logs <add> end <ide> end <ide> end <ide> end
2
Python
Python
fix model templates
36a19915ea4fc3dc337a310e4a1af43eb3c81c9a
<ide><path>src/transformers/commands/add_new_model.py <ide> def run(self): <ide> path_to_transformer_root = ( <ide> Path(__file__).parent.parent.parent.parent if self._path is None else Path(self._path).parent.parent <ide> ) <del> path_to_cookiecutter = path_to_transformer_root / "templates" / "cookiecutter" <add> path_to_cookiecutter = path_to_transformer_root / "templates" / "adding_a_new_model" <ide> <ide> # Execute cookiecutter <ide> if not self._testing: <ide> def run(self): <ide> output_pytorch = "PyTorch" in pytorch_or_tensorflow <ide> output_tensorflow = "TensorFlow" in pytorch_or_tensorflow <ide> <add> model_dir = f"{path_to_transformer_root}/src/transformers/models/{lowercase_model_name}" <add> os.makedirs(model_dir, exist_ok=True) <add> <add> shutil.move( <add> f"{directory}/__init__.py", <add> f"{model_dir}/__init__.py", <add> ) <ide> shutil.move( <ide> f"{directory}/configuration_{lowercase_model_name}.py", <del> f"{path_to_transformer_root}/src/transformers/configuration_{lowercase_model_name}.py", <add> f"{model_dir}/configuration_{lowercase_model_name}.py", <ide> ) <ide> <ide> def remove_copy_lines(path): <ide> def remove_copy_lines(path): <ide> <ide> shutil.move( <ide> f"{directory}/modeling_{lowercase_model_name}.py", <del> f"{path_to_transformer_root}/src/transformers/modeling_{lowercase_model_name}.py", <add> f"{model_dir}/modeling_{lowercase_model_name}.py", <ide> ) <ide> <ide> shutil.move( <ide> def remove_copy_lines(path): <ide> <ide> shutil.move( <ide> f"{directory}/modeling_tf_{lowercase_model_name}.py", <del> f"{path_to_transformer_root}/src/transformers/modeling_tf_{lowercase_model_name}.py", <add> f"{model_dir}/modeling_tf_{lowercase_model_name}.py", <ide> ) <ide> <ide> shutil.move( <ide> def remove_copy_lines(path): <ide> <ide> shutil.move( <ide> f"{directory}/tokenization_{lowercase_model_name}.py", <del> f"{path_to_transformer_root}/src/transformers/tokenization_{lowercase_model_name}.py", <add> f"{model_dir}/tokenization_{lowercase_model_name}.py", <ide> ) <ide> <ide> from os import fdopen, remove <ide><path>src/transformers/models/auto/modeling_auto.py <ide> from ...configuration_utils import PretrainedConfig <ide> from ...file_utils import add_start_docstrings <ide> from ...utils import logging <add> <add># Add modeling imports here <ide> from ..albert.modeling_albert import ( <ide> AlbertForMaskedLM, <ide> AlbertForMultipleChoice, <ide> ) <ide> <ide> <del># Add modeling imports here <del> <ide> logger = logging.get_logger(__name__) <ide> <ide> <ide><path>src/transformers/models/auto/modeling_tf_auto.py <ide> from ...configuration_utils import PretrainedConfig <ide> from ...file_utils import add_start_docstrings <ide> from ...utils import logging <add> <add># Add modeling imports here <ide> from ..albert.modeling_tf_albert import ( <ide> TFAlbertForMaskedLM, <ide> TFAlbertForMultipleChoice, <ide> ) <ide> <ide> <del># Add modeling imports here <del> <ide> logger = logging.get_logger(__name__) <ide> <ide> <ide><path>templates/adding_a_new_model/cookiecutter-template-{{cookiecutter.modelname}}/__init__.py <add># flake8: noqa <add># There's no way to ignore "F401 '...' imported but unused" warnings in this <add># module, but to preserve other warnings. So, don't check this module at all. <add> <add>{%- if cookiecutter.generate_tensorflow_and_pytorch == "PyTorch & TensorFlow" %} <add>from ...file_utils import is_tf_available, is_torch_available <add>{%- elif cookiecutter.generate_tensorflow_and_pytorch == "PyTorch" %} <add>from ...file_utils import is_torch_available <add>{%- elif cookiecutter.generate_tensorflow_and_pytorch == "TensorFlow" %} <add>from ...file_utils import is_tf_available <add>{% endif %} <add>from .configuration_{{cookiecutter.lowercase_modelname}} import {{cookiecutter.uppercase_modelname}}_PRETRAINED_CONFIG_ARCHIVE_MAP, {{cookiecutter.camelcase_modelname}}Config <add>from .tokenization_{{cookiecutter.lowercase_modelname}} import {{cookiecutter.camelcase_modelname}}Tokenizer <add> <add>{%- if (cookiecutter.generate_tensorflow_and_pytorch == "PyTorch & TensorFlow" or cookiecutter.generate_tensorflow_and_pytorch == "PyTorch") %} <add>if is_torch_available(): <add> from .modeling_{{cookiecutter.lowercase_modelname}} import ( <add> {{cookiecutter.uppercase_modelname}}_PRETRAINED_MODEL_ARCHIVE_LIST, <add> {{cookiecutter.camelcase_modelname}}ForMaskedLM, <add> {{cookiecutter.camelcase_modelname}}ForMultipleChoice, <add> {{cookiecutter.camelcase_modelname}}ForQuestionAnswering, <add> {{cookiecutter.camelcase_modelname}}ForSequenceClassification, <add> {{cookiecutter.camelcase_modelname}}ForTokenClassification, <add> {{cookiecutter.camelcase_modelname}}Layer, <add> {{cookiecutter.camelcase_modelname}}Model, <add> {{cookiecutter.camelcase_modelname}}PreTrainedModel, <add> load_tf_weights_in_{{cookiecutter.lowercase_modelname}}, <add> ) <add>{% endif %} <add>{%- if (cookiecutter.generate_tensorflow_and_pytorch == "PyTorch & TensorFlow" or cookiecutter.generate_tensorflow_and_pytorch == "TensorFlow") %} <add>if is_tf_available(): <add> from .modeling_tf_{{cookiecutter.lowercase_modelname}} import ( <add> TF_{{cookiecutter.uppercase_modelname}}_PRETRAINED_MODEL_ARCHIVE_LIST, <add> TF{{cookiecutter.camelcase_modelname}}ForMaskedLM, <add> TF{{cookiecutter.camelcase_modelname}}ForMultipleChoice, <add> TF{{cookiecutter.camelcase_modelname}}ForQuestionAnswering, <add> TF{{cookiecutter.camelcase_modelname}}ForSequenceClassification, <add> TF{{cookiecutter.camelcase_modelname}}ForTokenClassification, <add> TF{{cookiecutter.camelcase_modelname}}Layer, <add> TF{{cookiecutter.camelcase_modelname}}Model, <add> TF{{cookiecutter.camelcase_modelname}}PreTrainedModel, <add> ) <add>{% endif %} <ide>\ No newline at end of file <ide><path>templates/adding_a_new_model/cookiecutter-template-{{cookiecutter.modelname}}/configuration_{{cookiecutter.lowercase_modelname}}.py <ide> # limitations under the License. <ide> """ {{cookiecutter.modelname}} model configuration """ <ide> <del>from .configuration_utils import PretrainedConfig <del>from .utils import logging <add>from ...configuration_utils import PretrainedConfig <add>from ...utils import logging <ide> <ide> <ide> logger = logging.get_logger(__name__) <ide><path>templates/adding_a_new_model/cookiecutter-template-{{cookiecutter.modelname}}/modeling_tf_{{cookiecutter.lowercase_modelname}}.py <ide> <ide> import tensorflow as tf <ide> <del>from .activations_tf import get_tf_activation <del>from .configuration_{{cookiecutter.lowercase_modelname}} import {{cookiecutter.camelcase_modelname}}Config <del>from .file_utils import ( <add>from ...activations_tf import get_tf_activation <add>from ...file_utils import ( <ide> MULTIPLE_CHOICE_DUMMY_INPUTS, <ide> add_code_sample_docstrings, <ide> add_start_docstrings, <ide> add_start_docstrings_to_model_forward, <ide> ) <del>from .modeling_tf_outputs import ( <add>from ...modeling_tf_outputs import ( <ide> TFBaseModelOutput, <ide> TFBaseModelOutputWithPooling, <ide> TFMaskedLMOutput, <ide> TFSequenceClassifierOutput, <ide> TFTokenClassifierOutput, <ide> ) <del>from .modeling_tf_utils import ( <add>from ...modeling_tf_utils import ( <ide> TFMaskedLanguageModelingLoss, <ide> TFMultipleChoiceLoss, <ide> TFPreTrainedModel, <ide> keras_serializable, <ide> shape_list, <ide> ) <del>from .tokenization_utils import BatchEncoding <del>from .utils import logging <add>from ...tokenization_utils import BatchEncoding <add>from ...utils import logging <add>from .configuration_{{cookiecutter.lowercase_modelname}} import {{cookiecutter.camelcase_modelname}}Config <ide> <ide> <ide> logger = logging.get_logger(__name__) <ide><path>templates/adding_a_new_model/cookiecutter-template-{{cookiecutter.modelname}}/modeling_{{cookiecutter.lowercase_modelname}}.py <ide> from torch import nn <ide> from torch.nn import CrossEntropyLoss, MSELoss <ide> <del>from .configuration_{{cookiecutter.lowercase_modelname}} import {{cookiecutter.camelcase_modelname}}Config <del>from .file_utils import ( <add>from ...file_utils import ( <ide> add_code_sample_docstrings, <ide> add_start_docstrings, <ide> add_start_docstrings_to_model_forward, <ide> ) <del>from .modeling_outputs import ( <add>from ...modeling_outputs import ( <ide> BaseModelOutput, <ide> BaseModelOutputWithPooling, <ide> MaskedLMOutput, <ide> SequenceClassifierOutput, <ide> TokenClassifierOutput, <ide> ) <del>from .modeling_utils import ( <add>from ...modeling_utils import ( <ide> PreTrainedModel, <ide> SequenceSummary, <ide> apply_chunking_to_forward, <ide> find_pruneable_heads_and_indices, <ide> prune_linear_layer, <ide> ) <del>from .utils import logging <del>from .activations import ACT2FN <add>from ...utils import logging <add>from ...activations import ACT2FN <add>from .configuration_{{cookiecutter.lowercase_modelname}} import {{cookiecutter.camelcase_modelname}}Config <ide> <ide> <ide> logger = logging.get_logger(__name__) <ide><path>templates/adding_a_new_model/cookiecutter-template-{{cookiecutter.modelname}}/to_replace_{{cookiecutter.lowercase_modelname}}.py <ide> # To replace in: "src/transformers/__init__.py" <ide> # Below: "if is_torch_available():" if generating PyTorch <ide> # Replace with: <del> from .modeling_{{cookiecutter.lowercase_modelname}} import ( <add> from .models.{{cookiecutter.lowercase_modelname}} import ( <ide> {{cookiecutter.uppercase_modelname}}_PRETRAINED_MODEL_ARCHIVE_LIST, <ide> {{cookiecutter.camelcase_modelname}}ForMaskedLM, <ide> {{cookiecutter.camelcase_modelname}}ForMultipleChoice, <ide> <ide> # Below: "if is_tf_available():" if generating TensorFlow <ide> # Replace with: <del> from .modeling_tf_{{cookiecutter.lowercase_modelname}} import ( <add> from .models.{{cookiecutter.lowercase_modelname}} import ( <ide> TF_{{cookiecutter.uppercase_modelname}}_PRETRAINED_MODEL_ARCHIVE_LIST, <ide> TF{{cookiecutter.camelcase_modelname}}ForMaskedLM, <ide> TF{{cookiecutter.camelcase_modelname}}ForMultipleChoice, <ide> # End. <ide> <ide> <del># Below: "from .configuration_albert import ALBERT_PRETRAINED_CONFIG_ARCHIVE_MAP, AlbertConfig" <add># Below: "from .models.albert import ALBERT_PRETRAINED_CONFIG_ARCHIVE_MAP, AlbertConfig" <ide> # Replace with: <del>from .configuration_{{cookiecutter.lowercase_modelname}} import {{cookiecutter.uppercase_modelname}}_PRETRAINED_CONFIG_ARCHIVE_MAP, {{cookiecutter.camelcase_modelname}}Config <add>from .models.{{cookiecutter.lowercase_modelname}} import {{cookiecutter.uppercase_modelname}}_PRETRAINED_CONFIG_ARCHIVE_MAP, {{cookiecutter.camelcase_modelname}}Config <ide> # End. <ide> <ide> <ide> <del># To replace in: "src/transformers/configuration_auto.py" <add># To replace in: "src/transformers/models/auto/configuration_auto.py" <ide> # Below: "# Add configs here" <ide> # Replace with: <ide> ("{{cookiecutter.lowercase_modelname}}", {{cookiecutter.camelcase_modelname}}Config), <ide> {{cookiecutter.uppercase_modelname}}_PRETRAINED_CONFIG_ARCHIVE_MAP, <ide> # End. <ide> <del># Below: "from .configuration_albert import ALBERT_PRETRAINED_CONFIG_ARCHIVE_MAP, AlbertConfig", <add># Below: "from ..albert.configuration_albert import ALBERT_PRETRAINED_CONFIG_ARCHIVE_MAP, AlbertConfig", <ide> # Replace with: <del>from .configuration_{{cookiecutter.lowercase_modelname}} import {{cookiecutter.uppercase_modelname}}_PRETRAINED_CONFIG_ARCHIVE_MAP, {{cookiecutter.camelcase_modelname}}Config <add>from ..{{cookiecutter.lowercase_modelname}}.configuration_{{cookiecutter.lowercase_modelname}} import {{cookiecutter.uppercase_modelname}}_PRETRAINED_CONFIG_ARCHIVE_MAP, {{cookiecutter.camelcase_modelname}}Config <ide> # End. <ide> <ide> # Below: "# Add full (and cased) model names here" <ide> # Below: "# Add modeling imports here" <ide> # Replace with: <ide> <del>from .modeling_{{cookiecutter.lowercase_modelname}} import ( <add>from ..{{cookiecutter.lowercase_modelname}}.modeling_{{cookiecutter.lowercase_modelname}} import ( <ide> {{cookiecutter.camelcase_modelname}}ForMaskedLM, <ide> {{cookiecutter.camelcase_modelname}}ForMultipleChoice, <ide> {{cookiecutter.camelcase_modelname}}ForQuestionAnswering, <ide> # Below: "# Add modeling imports here" <ide> # Replace with: <ide> <del>from .modeling_tf_{{cookiecutter.lowercase_modelname}} import ( <add>from ..{{cookiecutter.lowercase_modelname}}.modeling_tf_{{cookiecutter.lowercase_modelname}} import ( <ide> TF{{cookiecutter.camelcase_modelname}}ForMaskedLM, <ide> TF{{cookiecutter.camelcase_modelname}}ForMultipleChoice, <ide> TF{{cookiecutter.camelcase_modelname}}ForQuestionAnswering, <ide><path>templates/adding_a_new_model/cookiecutter-template-{{cookiecutter.modelname}}/tokenization_{{cookiecutter.lowercase_modelname}}.py <ide> """Tokenization classes for {{cookiecutter.modelname}}.""" <ide> <ide> {%- if cookiecutter.tokenizer_type == "Based on BERT" %} <del>from .tokenization_bert import BertTokenizer, BertTokenizerFast <del>from .utils import logging <add>from ...utils import logging <add>from ..bert.tokenization_bert import BertTokenizer <add>from ..bert.tokenization_bert_fast import BertTokenizerFast <ide> <ide> <ide> logger = logging.get_logger(__name__) <ide> class {{cookiecutter.camelcase_modelname}}TokenizerFast(BertTokenizerFast): <ide> pretrained_init_configuration = PRETRAINED_INIT_CONFIGURATION <ide> {%- elif cookiecutter.tokenizer_type == "Standalone" %} <ide> import warnings <add>from typing import List, Optional <ide> <ide> from tokenizers import ByteLevelBPETokenizer <ide> <del>from .tokenization_utils import AddedToken, PreTrainedTokenizer <del>from .tokenization_utils_base import BatchEncoding <del>from .tokenization_utils_fast import PreTrainedTokenizerFast <del>from typing import List, Optional <del>from .utils import logging <add>from ...tokenization_utils import AddedToken, PreTrainedTokenizer <add>from ...tokenization_utils_base import BatchEncoding <add>from ...tokenization_utils_fast import PreTrainedTokenizerFast <add>from ...utils import logging <ide> <ide> <ide> logger = logging.get_logger(__name__)
9
PHP
PHP
skip more tests when openssl is not enabled
12e2e1363d529ac8e70caf4334ba2735091c8cfb
<ide><path>lib/Cake/Test/Case/Network/Http/HttpSocketTest.php <ide> public function testConfigContext() { <ide> * @return void <ide> */ <ide> public function testVerifyPeer() { <add> $this->skipIf(!extension_loaded('openssl'), 'OpenSSL is not enabled cannot test SSL.'); <ide> $socket = new HttpSocket(); <ide> try { <ide> $result = $socket->get('https://typography.com');
1
Ruby
Ruby
give `e` helper in utiltests a better name
5480a84114243fcd0aedda3a650b23b59ae91b2c
<ide><path>Library/Homebrew/test/utils_test.rb <ide> def setup <ide> @dir = Pathname.new(mktmpdir) <ide> end <ide> <del> # Helper for matching escape sequences. <del> def e(code) <add> def esc(code) <ide> /(\e\[\d+m)*\e\[#{code}m/ <ide> end <ide> <del> # Helper for matching that style is reset at the end of a string. <del> Z = /(\e\[\d+m)*\e\[0m\Z/ <del> <ide> def test_ofail <ide> shutup { ofail "foo" } <ide> assert Homebrew.failed? <ide> def test_odie <ide> def test_pretty_installed <ide> $stdout.stubs(:tty?).returns true <ide> ENV.delete("HOMEBREW_NO_EMOJI") <del> assert_match(/\A#{e 1}foo #{e 32}✔#{Z}/, pretty_installed("foo")) <add> tty_with_emoji_output = /\A#{esc 1}foo #{esc 32}✔#{esc 0}\Z/ <add> assert_match tty_with_emoji_output, pretty_installed("foo") <ide> <ide> ENV["HOMEBREW_NO_EMOJI"] = "1" <del> assert_match(/\A#{e 1}foo \(installed\)#{Z}/, pretty_installed("foo")) <add> tty_no_emoji_output = /\A#{esc 1}foo \(installed\)#{esc 0}\Z/ <add> assert_match tty_no_emoji_output, pretty_installed("foo") <ide> <ide> $stdout.stubs(:tty?).returns false <ide> assert_equal "foo", pretty_installed("foo") <ide> def test_pretty_installed <ide> def test_pretty_uninstalled <ide> $stdout.stubs(:tty?).returns true <ide> ENV.delete("HOMEBREW_NO_EMOJI") <del> assert_match(/\A#{e 1}foo #{e 31}✘#{Z}/, pretty_uninstalled("foo")) <add> tty_with_emoji_output = /\A#{esc 1}foo #{esc 31}✘#{esc 0}\Z/ <add> assert_match tty_with_emoji_output, pretty_uninstalled("foo") <ide> <ide> ENV["HOMEBREW_NO_EMOJI"] = "1" <del> assert_match(/\A#{e 1}foo \(uninstalled\)#{Z}/, pretty_uninstalled("foo")) <add> tty_no_emoji_output = /\A#{esc 1}foo \(uninstalled\)#{esc 0}\Z/ <add> assert_match tty_no_emoji_output, pretty_uninstalled("foo") <ide> <ide> $stdout.stubs(:tty?).returns false <ide> assert_equal "foo", pretty_uninstalled("foo")
1
Mixed
Javascript
add console.count() and console.clear()
cc43c8fb54c872fbce2a795d089aa111eccdfb89
<ide><path>doc/api/console.md <ide> console.assert(false, 'this message will print, but no error thrown'); <ide> console.log('this will also print'); <ide> ``` <ide> <add>### console.clear() <add><!-- YAML <add>added: REPLACEME <add>--> <add> <add>When `stdout` is a TTY, calling `console.clear()` will attempt to clear the <add>TTY. When `stdout` is not a TTY, this method does nothing. <add> <add>*Note*: The specific operation of `console.clear()` can vary across operating <add>systems and terminal types. For most Linux operating systems, `console.clear()` <add>operates similarly to the `clear` shell command. On Windows, `console.clear()` <add>will clear only the output in the current terminal viewport for the Node.js <add>binary. <add> <add>### console.count([label]) <add><!-- YAML <add>added: REPLACEME <add>--> <add> <add>* `label` {string} The display label for the counter. Defaults to `'default'`. <add> <add>Maintains an internal counter specific to `label` and outputs to `stdout` the <add>number of times `console.count()` has been called with the given `label`. <add> <add><!-- eslint-skip --> <add>```js <add>> console.count() <add>default: 1 <add>undefined <add>> console.count('default') <add>default: 2 <add>undefined <add>> console.count('abc') <add>abc: 1 <add>undefined <add>> console.count('xyz') <add>xyz: 1 <add>undefined <add>> console.count('abc') <add>abc: 2 <add>undefined <add>> console.count() <add>default: 3 <add>undefined <add>> <add>``` <add> <add>### console.countReset([label = 'default']) <add><!-- YAML <add>added: REPLACEME <add>--> <add> <add>* `label` {string} The display label for the counter. Defaults to `'default'`. <add> <add>Resets the internal counter specific to `label`. <add> <add><!-- eslint-skip --> <add>```js <add>> console.count('abc'); <add>abc: 1 <add>undefined <add>> console.countReset('abc'); <add>undefined <add>> console.count('abc'); <add>abc: 1 <add>undefined <add>> <add>``` <add><!-- eslint-enable --> <add> <ide> ### console.dir(obj[, options]) <ide> <!-- YAML <ide> added: v0.1.101 <ide><path>lib/console.js <ide> <ide> const errors = require('internal/errors'); <ide> const util = require('util'); <add>const kCounts = Symbol('counts'); <ide> <ide> function Console(stdout, stderr, ignoreErrors = true) { <ide> if (!(this instanceof Console)) { <ide> function Console(stdout, stderr, ignoreErrors = true) { <ide> prop.value = createWriteErrorHandler(stderr); <ide> Object.defineProperty(this, '_stderrErrorHandler', prop); <ide> <add> this[kCounts] = new Map(); <add> <ide> // bind the prototype functions to this Console instance <ide> var keys = Object.keys(Console.prototype); <ide> for (var v = 0; v < keys.length; v++) { <ide> Console.prototype.assert = function assert(expression, ...args) { <ide> } <ide> }; <ide> <add>// Defined by: https://console.spec.whatwg.org/#clear <add>Console.prototype.clear = function clear() { <add> // It only makes sense to clear if _stdout is a TTY. <add> // Otherwise, do nothing. <add> if (this._stdout.isTTY) { <add> // The require is here intentionally to avoid readline being <add> // required too early when console is first loaded. <add> const { cursorTo, clearScreenDown } = require('readline'); <add> cursorTo(this._stdout, 0, 0); <add> clearScreenDown(this._stdout); <add> } <add>}; <add> <add>// Defined by: https://console.spec.whatwg.org/#count <add>Console.prototype.count = function count(label = 'default') { <add> // Ensures that label is a string, and only things that can be <add> // coerced to strings. e.g. Symbol is not allowed <add> label = `${label}`; <add> const counts = this[kCounts]; <add> let count = counts.get(label); <add> if (count === undefined) <add> count = 1; <add> else <add> count++; <add> counts.set(label, count); <add> this.log(`${label}: ${count}`); <add>}; <add> <add>// Not yet defined by the https://console.spec.whatwg.org, but <add>// proposed to be added and currently implemented by Edge. Having <add>// the ability to reset counters is important to help prevent <add>// the counter from being a memory leak. <add>Console.prototype.countReset = function countReset(label = 'default') { <add> const counts = this[kCounts]; <add> counts.delete(`${label}`); <add>}; <ide> <ide> module.exports = new Console(process.stdout, process.stderr); <ide> module.exports.Console = Console; <ide><path>test/parallel/test-console-clear.js <add>'use strict'; <add> <add>require('../common'); <add>const assert = require('assert'); <add> <add>const stdoutWrite = process.stdout.write; <add> <add>// The sequence for moving the cursor to 0,0 and clearing screen down <add>const check = '\u001b[1;1H\u001b[0J'; <add> <add>function doTest(isTTY, check) { <add> let buf = ''; <add> process.stdout.isTTY = isTTY; <add> process.stdout.write = (string) => buf += string; <add> console.clear(); <add> process.stdout.write = stdoutWrite; <add> assert.strictEqual(buf, check); <add>} <add> <add>// Fake TTY <add>doTest(true, check); <add>doTest(false, ''); <ide><path>test/parallel/test-console-count.js <add>'use strict'; <add> <add>require('../common'); <add>const assert = require('assert'); <add> <add>const stdoutWrite = process.stdout.write; <add> <add>let buf = ''; <add> <add>process.stdout.write = (string) => buf = string; <add> <add>console.count(); <add>assert.strictEqual(buf, 'default: 1\n'); <add> <add>// 'default' and undefined are equivalent <add>console.count('default'); <add>assert.strictEqual(buf, 'default: 2\n'); <add> <add>console.count('a'); <add>assert.strictEqual(buf, 'a: 1\n'); <add> <add>console.count('b'); <add>assert.strictEqual(buf, 'b: 1\n'); <add> <add>console.count('a'); <add>assert.strictEqual(buf, 'a: 2\n'); <add> <add>console.count(); <add>assert.strictEqual(buf, 'default: 3\n'); <add> <add>console.count({}); <add>assert.strictEqual(buf, '[object Object]: 1\n'); <add> <add>console.count(1); <add>assert.strictEqual(buf, '1: 1\n'); <add> <add>console.count(null); <add>assert.strictEqual(buf, 'null: 1\n'); <add> <add>console.count('null'); <add>assert.strictEqual(buf, 'null: 2\n'); <add> <add>console.countReset(); <add>console.count(); <add>assert.strictEqual(buf, 'default: 1\n'); <add> <add>console.countReset('a'); <add>console.count('a'); <add>assert.strictEqual(buf, 'a: 1\n'); <add> <add>// countReset('a') only reset the a counter <add>console.count(); <add>assert.strictEqual(buf, 'default: 2\n'); <add> <add>process.stdout.write = stdoutWrite; <add> <add>// Symbol labels do not work <add>assert.throws( <add> () => console.count(Symbol('test')), <add> /^TypeError: Cannot convert a Symbol value to a string$/); <add>assert.throws( <add> () => console.countReset(Symbol('test')), <add> /^TypeError: Cannot convert a Symbol value to a string$/);
4
Javascript
Javascript
fix typo in script function name
a8845587a35c1a7fcadc94c1baa400962775185d
<ide><path>scripts/bench/stats.js <ide> function addBenchmarkResults(table, localResults, remoteMasterResults) { <ide> }); <ide> } <ide> <del>function addBundleSizeComparions(table, localResults, remoteMasterResults) { <add>function addBundleSizeComparsions(table, localResults, remoteMasterResults) { <ide> const bundlesRowHeader = [chalk.white.bold('Bundles')]; <ide> if (remoteMasterResults) { <ide> bundlesRowHeader.push(chalk.white.bold('Size')); <ide> function printResults(localResults, remoteMasterResults) { <ide> } <ide> const table = new Table({head}); <ide> <del> addBundleSizeComparions(table, localResults, remoteMasterResults); <add> addBundleSizeComparsions(table, localResults, remoteMasterResults); <ide> addBenchmarkResults(table, localResults, remoteMasterResults); <ide> <ide> console.log(table.toString());
1
Text
Text
add status badges
ac5e966877fc4b95140d4c20345b274c4f5c0d84
<ide><path>docs/devops.md <ide> Once one of the staff members approves a release, the pipeline will push the cha <ide> <ide> Here is the current test, build and deployment status of the codebase. <ide> <del>| Type | Branch | Status | Dashboard | <del>| :--------------- | :------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------------------------- | :---------------------------------------------------------------------------------------- | <del>| CI Tests | [`master`](https://github.com/freeCodeCamp/freeCodeCamp/tree/master) | ![Travis CI Build Status](https://travis-ci.com/freeCodeCamp/freeCodeCamp.svg?branch=master) | [Go to status dashboard](https://travis-ci.com/github/freeCodeCamp/freeCodeCamp/branches) | <del>| CI Tests | [`production-staging`](https://github.com/freeCodeCamp/freeCodeCamp/tree/production-staging) | ![Travis CI Build Status](https://travis-ci.com/freeCodeCamp/freeCodeCamp.svg?branch=production-staging) | [Go to status dashboard](https://travis-ci.com/github/freeCodeCamp/freeCodeCamp/branches) | <del>| CI Tests | [`production-current`](https://github.com/freeCodeCamp/freeCodeCamp/tree/production-current) | ![Travis CI Build Status](https://travis-ci.com/freeCodeCamp/freeCodeCamp.svg?branch=production-current) | [Go to status dashboard](https://travis-ci.com/github/freeCodeCamp/freeCodeCamp/branches) | <del>| Build Pipeline | [`production-staging`](https://github.com/freeCodeCamp/freeCodeCamp/tree/production-staging) | | [Go to status dashboard](https://dev.azure.com/freeCodeCamp-org/freeCodeCamp/_build) | <del>| Build Pipeline | [`production-current`](https://github.com/freeCodeCamp/freeCodeCamp/tree/production-staging) | | [Go to status dashboard](https://dev.azure.com/freeCodeCamp-org/freeCodeCamp/_build) | <del>| Release Pipeline | [`production-staging`](https://github.com/freeCodeCamp/freeCodeCamp/tree/production-staging) | | [Go to status dashboard](https://dev.azure.com/freeCodeCamp-org/freeCodeCamp/_release) | <del>| Release Pipeline | [`production-current`](https://github.com/freeCodeCamp/freeCodeCamp/tree/production-staging) | | [Go to status dashboard](https://dev.azure.com/freeCodeCamp-org/freeCodeCamp/_release) | <add>| Type | Branch | Status | Dashboard | <add>| :--------------- | :------------------------------------------------------------------------------------------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :---------------------------------------------------------------------------------------- | <add>| CI Tests | [`master`](https://github.com/freeCodeCamp/freeCodeCamp/tree/master) | ![Travis CI Build Status](https://travis-ci.com/freeCodeCamp/freeCodeCamp.svg?branch=master) | [Go to status dashboard](https://travis-ci.com/github/freeCodeCamp/freeCodeCamp/branches) | <add>| CI Tests | [`production-staging`](https://github.com/freeCodeCamp/freeCodeCamp/tree/production-staging) | ![Travis CI Build Status](https://travis-ci.com/freeCodeCamp/freeCodeCamp.svg?branch=production-staging) | [Go to status dashboard](https://travis-ci.com/github/freeCodeCamp/freeCodeCamp/branches) | <add>| Build Pipeline | [`production-staging`](https://github.com/freeCodeCamp/freeCodeCamp/tree/production-staging) | [![Build Status](https://dev.azure.com/freeCodeCamp-org/freeCodeCamp/_apis/build/status/dot-dev-ci?branchName=production-staging)](https://dev.azure.com/freeCodeCamp-org/freeCodeCamp/_build/latest?definitionId=15&branchName=production-staging) | [Go to status dashboard](https://dev.azure.com/freeCodeCamp-org/freeCodeCamp/_build) | <add>| Release Pipeline | [`production-staging`](https://github.com/freeCodeCamp/freeCodeCamp/tree/production-staging) | | [Go to status dashboard](https://dev.azure.com/freeCodeCamp-org/freeCodeCamp/_release) | <add>| CI Tests | [`production-current`](https://github.com/freeCodeCamp/freeCodeCamp/tree/production-current) | ![Travis CI Build Status](https://travis-ci.com/freeCodeCamp/freeCodeCamp.svg?branch=production-current) | [Go to status dashboard](https://travis-ci.com/github/freeCodeCamp/freeCodeCamp/branches) | <add>| Build Pipeline | [`production-current`](https://github.com/freeCodeCamp/freeCodeCamp/tree/production-staging) | [![Build Status](https://dev.azure.com/freeCodeCamp-org/freeCodeCamp/_apis/build/status/dot-org-ci?branchName=production-current)](https://dev.azure.com/freeCodeCamp-org/freeCodeCamp/_build/latest?definitionId=17&branchName=production-current) | [Go to status dashboard](https://dev.azure.com/freeCodeCamp-org/freeCodeCamp/_build) | <add>| Release Pipeline | [`production-current`](https://github.com/freeCodeCamp/freeCodeCamp/tree/production-staging) | | [Go to status dashboard](https://dev.azure.com/freeCodeCamp-org/freeCodeCamp/_release) | <ide> <ide> ## Early access and beta testing <ide>
1
Python
Python
allow pathlib.path in dagbag and various util fns
6e99ae05642758691361dfe9d7b767cfc9a2b616
<ide><path>airflow/models/dagbag.py <ide> import warnings <ide> import zipfile <ide> from datetime import datetime, timedelta <del>from typing import Dict, List, NamedTuple, Optional <add>from typing import TYPE_CHECKING, Dict, List, NamedTuple, Optional, Union <ide> <ide> from croniter import CroniterBadCronError, CroniterBadDateError, CroniterNotAlphaError, croniter <ide> from sqlalchemy.exc import OperationalError <ide> from airflow.utils.session import provide_session <ide> from airflow.utils.timeout import timeout <ide> <add>if TYPE_CHECKING: <add> import pathlib <add> <ide> <ide> class FileLoadStat(NamedTuple): <ide> """Information about single file""" <ide> class DagBag(LoggingMixin): <ide> <ide> def __init__( <ide> self, <del> dag_folder: Optional[str] = None, <add> dag_folder: Union[str, "pathlib.Path", None] = None, <ide> include_examples: bool = conf.getboolean('core', 'LOAD_EXAMPLES'), <ide> include_smart_sensor: bool = conf.getboolean('smart_sensor', 'USE_SMART_SENSOR'), <ide> safe_mode: bool = conf.getboolean('core', 'DAG_DISCOVERY_SAFE_MODE'), <ide> def bag_dag(self, dag, root_dag): <ide> <ide> def collect_dags( <ide> self, <del> dag_folder=None, <del> only_if_updated=True, <del> include_examples=conf.getboolean('core', 'LOAD_EXAMPLES'), <del> include_smart_sensor=conf.getboolean('smart_sensor', 'USE_SMART_SENSOR'), <del> safe_mode=conf.getboolean('core', 'DAG_DISCOVERY_SAFE_MODE'), <add> dag_folder: Union[str, "pathlib.Path", None] = None, <add> only_if_updated: bool = True, <add> include_examples: bool = conf.getboolean('core', 'LOAD_EXAMPLES'), <add> include_smart_sensor: bool = conf.getboolean('smart_sensor', 'USE_SMART_SENSOR'), <add> safe_mode: bool = conf.getboolean('core', 'DAG_DISCOVERY_SAFE_MODE'), <ide> ): <ide> """ <ide> Given a file path or a folder, this method looks for python modules, <ide> def collect_dags( <ide> # Used to store stats around DagBag processing <ide> stats = [] <ide> <del> dag_folder = correct_maybe_zipped(dag_folder) <add> # Ensure dag_folder is a str -- it may have been a pathlib.Path <add> dag_folder = correct_maybe_zipped(str(dag_folder)) <ide> for filepath in list_py_file_paths( <ide> dag_folder, <ide> safe_mode=safe_mode, <ide><path>airflow/utils/dag_processing.py <ide> from datetime import datetime, timedelta <ide> from importlib import import_module <ide> from multiprocessing.connection import Connection as MultiprocessingConnection <del>from typing import Any, Callable, Dict, List, NamedTuple, Optional, Tuple, Union, cast <add>from typing import TYPE_CHECKING, Any, Callable, Dict, List, NamedTuple, Optional, Tuple, Union, cast <ide> <ide> from setproctitle import setproctitle # pylint: disable=no-name-in-module <ide> from sqlalchemy import or_ <ide> from airflow.utils.session import provide_session <ide> from airflow.utils.state import State <ide> <add>if TYPE_CHECKING: <add> import pathlib <add> <ide> <ide> class AbstractDagFileProcessorProcess(metaclass=ABCMeta): <ide> """Processes a DAG file. See SchedulerJob.process_file() for more details.""" <ide> class DagFileProcessorManager(LoggingMixin): # pylint: disable=too-many-instanc <ide> <ide> def __init__( <ide> self, <del> dag_directory: str, <add> dag_directory: Union[str, "pathlib.Path"], <ide> max_runs: int, <ide> processor_factory: Callable[[str, List[CallbackRequest]], AbstractDagFileProcessorProcess], <ide> processor_timeout: timedelta, <ide><path>airflow/utils/file.py <ide> import re <ide> import zipfile <ide> from pathlib import Path <del>from typing import Dict, Generator, List, Optional, Pattern <add>from typing import TYPE_CHECKING, Dict, Generator, List, Optional, Pattern, Union <ide> <ide> from airflow.configuration import conf <ide> <add>if TYPE_CHECKING: <add> import pathlib <add> <ide> log = logging.getLogger(__name__) <ide> <ide> <ide> def find_path_from_directory(base_dir_path: str, ignore_file_name: str) -> Gener <ide> <ide> <ide> def list_py_file_paths( <del> directory: str, <add> directory: Union[str, "pathlib.Path"], <ide> safe_mode: bool = conf.getboolean('core', 'DAG_DISCOVERY_SAFE_MODE', fallback=True), <ide> include_examples: Optional[bool] = None, <ide> include_smart_sensor: Optional[bool] = conf.getboolean('smart_sensor', 'use_smart_sensor'), <ide> def list_py_file_paths( <ide> if directory is None: <ide> file_paths = [] <ide> elif os.path.isfile(directory): <del> file_paths = [directory] <add> file_paths = [str(directory)] <ide> elif os.path.isdir(directory): <ide> file_paths.extend(find_dag_file_paths(directory, safe_mode)) <ide> if include_examples: <ide> def list_py_file_paths( <ide> return file_paths <ide> <ide> <del>def find_dag_file_paths(directory: str, safe_mode: bool) -> List[str]: <add>def find_dag_file_paths(directory: Union[str, "pathlib.Path"], safe_mode: bool) -> List[str]: <ide> """Finds file paths of all DAG files.""" <ide> file_paths = [] <ide> <del> for file_path in find_path_from_directory(directory, ".airflowignore"): <add> for file_path in find_path_from_directory(str(directory), ".airflowignore"): <ide> try: <ide> if not os.path.isfile(file_path): <ide> continue <ide><path>tests/utils/test_dag_processing.py <ide> <ide> import multiprocessing <ide> import os <add>import pathlib <ide> import random <ide> import sys <ide> import unittest <ide> from tests.test_utils.config import conf_vars <ide> from tests.test_utils.db import clear_db_dags, clear_db_runs, clear_db_serialized_dags <ide> <del>TEST_DAG_FOLDER = os.path.join(os.path.dirname(os.path.realpath(__file__)), os.pardir, 'dags') <add>TEST_DAG_FOLDER = pathlib.Path(__file__).parent.parent / 'dags' <ide> <ide> DEFAULT_DATE = timezone.datetime(2016, 1, 1) <ide> <ide> def test_handle_failure_callback_with_zombies_are_correctly_passed_to_dag_file_p <ide> Check that the same set of failure callback with zombies are passed to the dag <ide> file processors until the next zombie detection logic is invoked. <ide> """ <del> test_dag_path = os.path.join(TEST_DAG_FOLDER, 'test_example_bash_operator.py') <add> test_dag_path = TEST_DAG_FOLDER / 'test_example_bash_operator.py' <ide> with conf_vars({('scheduler', 'parsing_processes'): '1', ('core', 'load_examples'): 'False'}): <ide> dagbag = DagBag(test_dag_path, read_dags_from_db=False) <ide> with create_session() as session: <ide> def test_handle_failure_callback_with_zombies_are_correctly_passed_to_dag_file_p <ide> ) <ide> ] <ide> <del> test_dag_path = os.path.join(TEST_DAG_FOLDER, 'test_example_bash_operator.py') <add> test_dag_path = TEST_DAG_FOLDER / 'test_example_bash_operator.py' <ide> <ide> child_pipe, parent_pipe = multiprocessing.Pipe() <ide> async_mode = 'sqlite' not in conf.get('core', 'sql_alchemy_conn') <ide> def fake_processor_factory(*args, **kwargs): <ide> if async_mode: <ide> # Once for initial parse, and then again for the add_callback_to_queue <ide> assert len(fake_processors) == 2 <del> assert fake_processors[0]._file_path == test_dag_path <add> assert fake_processors[0]._file_path == str(test_dag_path) <ide> assert fake_processors[0]._callback_requests == [] <ide> else: <ide> assert len(fake_processors) == 1 <ide> <del> assert fake_processors[-1]._file_path == test_dag_path <add> assert fake_processors[-1]._file_path == str(test_dag_path) <ide> callback_requests = fake_processors[-1]._callback_requests <ide> assert {zombie.simple_task_instance.key for zombie in expected_failure_callback_requests} == { <ide> result.simple_task_instance.key for result in callback_requests <ide> def test_dag_with_system_exit(self): <ide> from airflow.jobs.scheduler_job import SchedulerJob <ide> <ide> dag_id = 'exit_test_dag' <del> dag_directory = os.path.normpath(os.path.join(TEST_DAG_FOLDER, os.pardir, "dags_with_system_exit")) <add> dag_directory = TEST_DAG_FOLDER.parent / 'dags_with_system_exit' <ide> <ide> # Delete the one valid DAG/SerializedDAG, and check that it gets re-created <ide> clear_db_dags() <ide> class path, thus when reloading logging module the airflow.processor_manager <ide> with settings_context(SETTINGS_FILE_VALID): <ide> # Launch a process through DagFileProcessorAgent, which will try <ide> # reload the logging module. <del> test_dag_path = os.path.join(TEST_DAG_FOLDER, 'test_scheduler_dags.py') <add> test_dag_path = TEST_DAG_FOLDER / 'test_scheduler_dags.py' <ide> async_mode = 'sqlite' not in conf.get('core', 'sql_alchemy_conn') <ide> log_file_loc = conf.get('logging', 'DAG_PROCESSOR_MANAGER_LOG_LOCATION') <ide> <ide> def test_parse_once(self): <ide> clear_db_serialized_dags() <ide> clear_db_dags() <ide> <del> test_dag_path = os.path.join(TEST_DAG_FOLDER, 'test_scheduler_dags.py') <add> test_dag_path = TEST_DAG_FOLDER / 'test_scheduler_dags.py' <ide> async_mode = 'sqlite' not in conf.get('core', 'sql_alchemy_conn') <ide> processor_agent = DagFileProcessorAgent( <ide> test_dag_path, 1, type(self)._processor_factory, timedelta.max, [], False, async_mode <ide> def test_parse_once(self): <ide> assert dag_ids == [('test_start_date_scheduling',), ('test_task_start_date_scheduling',)] <ide> <ide> def test_launch_process(self): <del> test_dag_path = os.path.join(TEST_DAG_FOLDER, 'test_scheduler_dags.py') <add> test_dag_path = TEST_DAG_FOLDER / 'test_scheduler_dags.py' <ide> async_mode = 'sqlite' not in conf.get('core', 'sql_alchemy_conn') <ide> <ide> log_file_loc = conf.get('logging', 'DAG_PROCESSOR_MANAGER_LOG_LOCATION')
4
Javascript
Javascript
add support for "input" event handlers
a4e9d88d1ffac8fb86cebe8362d3c55be4dc9fb6
<ide><path>packages/ember-views/lib/system/event_dispatcher.js <ide> Ember.EventDispatcher = Ember.Object.extend( <ide> mouseenter : 'mouseEnter', <ide> mouseleave : 'mouseLeave', <ide> submit : 'submit', <add> input : 'input', <ide> change : 'change', <ide> dragstart : 'dragStart', <ide> drag : 'drag',
1
Python
Python
update links to weights
36fc52a3b4b50885d5ec3bf259f81740e19d8b3c
<ide><path>transformers/configuration_bert.py <ide> 'bert-base-cased-finetuned-mrpc': "https://s3.amazonaws.com/models.huggingface.co/bert/bert-base-cased-finetuned-mrpc-config.json", <ide> 'bert-base-german-dbmdz-cased': "https://s3.amazonaws.com/models.huggingface.co/bert/bert-base-german-dbmdz-cased-config.json", <ide> 'bert-base-german-dbmdz-uncased': "https://s3.amazonaws.com/models.huggingface.co/bert/bert-base-german-dbmdz-uncased-config.json", <del> 'bert-base-japanese': "https://www.nlp.ecei.tohoku.ac.jp/~m-suzuki/bert-japanese/bert-base-japanese-config.json", <del> 'bert-base-japanese-whole-word-masking': "https://www.nlp.ecei.tohoku.ac.jp/~m-suzuki/bert-japanese/bert-base-japanese-whole-word-masking-config.json", <del> 'bert-base-japanese-char': "https://www.nlp.ecei.tohoku.ac.jp/~m-suzuki/bert-japanese/bert-base-japanese-char-config.json", <del> 'bert-base-japanese-char-whole-word-masking': "https://www.nlp.ecei.tohoku.ac.jp/~m-suzuki/bert-japanese/bert-base-japanese-char-whole-word-masking-config.json" <add> 'bert-base-japanese': "https://s3.amazonaws.com/models.huggingface.co/bert/cl-tohoku/bert-base-japanese-config.json", <add> 'bert-base-japanese-whole-word-masking': "https://s3.amazonaws.com/models.huggingface.co/bert/cl-tohoku/bert-base-japanese-whole-word-masking-config.json", <add> 'bert-base-japanese-char': "https://s3.amazonaws.com/models.huggingface.co/bert/cl-tohoku/bert-base-japanese-char-config.json", <add> 'bert-base-japanese-char-whole-word-masking': "https://s3.amazonaws.com/models.huggingface.co/bert/cl-tohoku/bert-base-japanese-char-whole-word-masking-config.json" <ide> } <ide> <ide> <ide><path>transformers/modeling_bert.py <ide> 'bert-base-cased-finetuned-mrpc': "https://s3.amazonaws.com/models.huggingface.co/bert/bert-base-cased-finetuned-mrpc-pytorch_model.bin", <ide> 'bert-base-german-dbmdz-cased': "https://s3.amazonaws.com/models.huggingface.co/bert/bert-base-german-dbmdz-cased-pytorch_model.bin", <ide> 'bert-base-german-dbmdz-uncased': "https://s3.amazonaws.com/models.huggingface.co/bert/bert-base-german-dbmdz-uncased-pytorch_model.bin", <del> 'bert-base-japanese': "https://www.nlp.ecei.tohoku.ac.jp/~m-suzuki/bert-japanese/bert-base-japanese-pytorch_model.bin", <del> 'bert-base-japanese-whole-word-masking': "https://www.nlp.ecei.tohoku.ac.jp/~m-suzuki/bert-japanese/bert-base-japanese-whole-word-masking-pytorch_model.bin", <del> 'bert-base-japanese-char': "https://www.nlp.ecei.tohoku.ac.jp/~m-suzuki/bert-japanese/bert-base-japanese-char-pytorch_model.bin", <del> 'bert-base-japanese-char-whole-word-masking': "https://www.nlp.ecei.tohoku.ac.jp/~m-suzuki/bert-japanese/bert-base-japanese-char-whole-word-masking-pytorch_model.bin" <add> 'bert-base-japanese': "https://s3.amazonaws.com/models.huggingface.co/bert/cl-tohoku/bert-base-japanese-pytorch_model.bin", <add> 'bert-base-japanese-whole-word-masking': "https://s3.amazonaws.com/models.huggingface.co/bert/cl-tohoku/bert-base-japanese-whole-word-masking-pytorch_model.bin", <add> 'bert-base-japanese-char': "https://s3.amazonaws.com/models.huggingface.co/bert/cl-tohoku/bert-base-japanese-char-pytorch_model.bin", <add> 'bert-base-japanese-char-whole-word-masking': "https://s3.amazonaws.com/models.huggingface.co/bert/cl-tohoku/bert-base-japanese-char-whole-word-masking-pytorch_model.bin" <ide> } <ide> <ide> <ide><path>transformers/modeling_tf_bert.py <ide> 'bert-large-uncased-whole-word-masking-finetuned-squad': "https://s3.amazonaws.com/models.huggingface.co/bert/bert-large-uncased-whole-word-masking-finetuned-squad-tf_model.h5", <ide> 'bert-large-cased-whole-word-masking-finetuned-squad': "https://s3.amazonaws.com/models.huggingface.co/bert/bert-large-cased-whole-word-masking-finetuned-squad-tf_model.h5", <ide> 'bert-base-cased-finetuned-mrpc': "https://s3.amazonaws.com/models.huggingface.co/bert/bert-base-cased-finetuned-mrpc-tf_model.h5", <del> 'bert-base-japanese': "https://www.nlp.ecei.tohoku.ac.jp/~m-suzuki/bert-japanese/bert-base-japanese-tf_model.h5", <del> 'bert-base-japanese-whole-word-masking': "https://www.nlp.ecei.tohoku.ac.jp/~m-suzuki/bert-japanese/bert-base-japanese-whole-word-masking-tf_model.h5", <del> 'bert-base-japanese-char': "https://www.nlp.ecei.tohoku.ac.jp/~m-suzuki/bert-japanese/bert-base-japanese-char-tf_model.h5", <del> 'bert-base-japanese-char-whole-word-masking': "https://www.nlp.ecei.tohoku.ac.jp/~m-suzuki/bert-japanese/bert-base-japanese-char-whole-word-masking-tf_model.h5" <add> 'bert-base-japanese': "https://s3.amazonaws.com/models.huggingface.co/bert/cl-tohoku/bert-base-japanese-tf_model.h5", <add> 'bert-base-japanese-whole-word-masking': "https://s3.amazonaws.com/models.huggingface.co/bert/cl-tohoku/bert-base-japanese-whole-word-masking-tf_model.h5", <add> 'bert-base-japanese-char': "https://s3.amazonaws.com/models.huggingface.co/bert/cl-tohoku/bert-base-japanese-char-tf_model.h5", <add> 'bert-base-japanese-char-whole-word-masking': "https://s3.amazonaws.com/models.huggingface.co/bert/cl-tohoku/bert-base-japanese-char-whole-word-masking-tf_model.h5" <ide> } <ide> <ide> <ide><path>transformers/tokenization_bert_japanese.py <ide> PRETRAINED_VOCAB_FILES_MAP = { <ide> 'vocab_file': <ide> { <del> 'bert-base-japanese': "https://www.nlp.ecei.tohoku.ac.jp/~m-suzuki/bert-japanese/bert-base-japanese-vocab.txt", <del> 'bert-base-japanese-whole-word-masking': "https://www.nlp.ecei.tohoku.ac.jp/~m-suzuki/bert-japanese/bert-base-japanese-whole-word-masking-vocab.txt", <del> 'bert-base-japanese-char': "https://www.nlp.ecei.tohoku.ac.jp/~m-suzuki/bert-japanese/bert-base-japanese-char-vocab.txt", <del> 'bert-base-japanese-char-whole-word-masking': "https://www.nlp.ecei.tohoku.ac.jp/~m-suzuki/bert-japanese/bert-base-japanese-char-whole-word-masking-vocab.txt" <add> 'bert-base-japanese': "https://s3.amazonaws.com/models.huggingface.co/bert/cl-tohoku/bert-base-japanese-vocab.txt", <add> 'bert-base-japanese-whole-word-masking': "https://s3.amazonaws.com/models.huggingface.co/bert/cl-tohoku/bert-base-japanese-whole-word-masking-vocab.txt", <add> 'bert-base-japanese-char': "https://s3.amazonaws.com/models.huggingface.co/bert/cl-tohoku/bert-base-japanese-char-vocab.txt", <add> 'bert-base-japanese-char-whole-word-masking': "https://s3.amazonaws.com/models.huggingface.co/bert/cl-tohoku/bert-base-japanese-char-whole-word-masking-vocab.txt" <ide> } <ide> } <ide>
4
PHP
PHP
remove accessors that are never used
712b99df85c7a9daf8fb9f0a9a34fa90cbe99f44
<ide><path>src/Illuminate/Queue/Worker.php <ide> public function setCache(CacheContract $cache) <ide> { <ide> $this->cache = $cache; <ide> } <del> <del> /** <del> * Get the queue manager instance. <del> * <del> * @return \Illuminate\Queue\QueueManager <del> */ <del> public function getManager() <del> { <del> return $this->manager; <del> } <del> <del> /** <del> * Set the queue manager instance. <del> * <del> * @param \Illuminate\Queue\QueueManager $manager <del> * @return void <del> */ <del> public function setManager(QueueManager $manager) <del> { <del> $this->manager = $manager; <del> } <ide> }
1
Python
Python
add backticks to linalg
10cefa453c3414ca49a6b5f911ffd14f539c8e96
<ide><path>numpy/linalg/linalg.py <ide> def solve(a, b): <ide> Broadcasting rules apply, see the `numpy.linalg` documentation for <ide> details. <ide> <del> The solutions are computed using LAPACK routine _gesv <add> The solutions are computed using LAPACK routine ``_gesv``. <ide> <ide> `a` must be square and of full-rank, i.e., all rows (or, equivalently, <ide> columns) must be linearly independent; if either is not true, use <ide> def qr(a, mode='reduced'): <ide> <ide> Notes <ide> ----- <del> This is an interface to the LAPACK routines dgeqrf, zgeqrf, <del> dorgqr, and zungqr. <add> This is an interface to the LAPACK routines ``dgeqrf``, ``zgeqrf``, <add> ``dorgqr``, and ``zungqr``. <ide> <ide> For more information on the qr factorization, see for example: <ide> https://en.wikipedia.org/wiki/QR_factorization <ide> def eigvals(a): <ide> Broadcasting rules apply, see the `numpy.linalg` documentation for <ide> details. <ide> <del> This is implemented using the _geev LAPACK routines which compute <add> This is implemented using the ``_geev`` LAPACK routines which compute <ide> the eigenvalues and eigenvectors of general square arrays. <ide> <ide> Examples <ide> def eigvals(a): <ide> >>> LA.norm(Q[0, :]), LA.norm(Q[1, :]), np.dot(Q[0, :],Q[1, :]) <ide> (1.0, 1.0, 0.0) <ide> <del> Now multiply a diagonal matrix by Q on one side and by Q.T on the other: <add> Now multiply a diagonal matrix by `Q` on one side and by `Q.T` on the other: <ide> <ide> >>> D = np.diag((-1,1)) <ide> >>> LA.eigvals(D) <ide> def eigvalsh(a, UPLO='L'): <ide> Broadcasting rules apply, see the `numpy.linalg` documentation for <ide> details. <ide> <del> The eigenvalues are computed using LAPACK routines _syevd, _heevd <add> The eigenvalues are computed using LAPACK routines ``_syevd``, ``_heevd``. <ide> <ide> Examples <ide> -------- <ide> def eig(a): <ide> Broadcasting rules apply, see the `numpy.linalg` documentation for <ide> details. <ide> <del> This is implemented using the _geev LAPACK routines which compute <add> This is implemented using the ``_geev`` LAPACK routines which compute <ide> the eigenvalues and eigenvectors of general square arrays. <ide> <ide> The number `w` is an eigenvalue of `a` if there exists a vector <ide> def eig(a): <ide> [0. -0.70710678j, 0. +0.70710678j]]) <ide> <ide> Complex-valued matrix with real e-values (but complex-valued e-vectors); <del> note that a.conj().T = a, i.e., a is Hermitian. <add> note that ``a.conj().T = a``, i.e., `a` is Hermitian. <ide> <ide> >>> a = np.array([[1, 1j], [-1j, 1]]) <ide> >>> w, v = LA.eig(a) <ide> def eigh(a, UPLO='L'): <ide> Broadcasting rules apply, see the `numpy.linalg` documentation for <ide> details. <ide> <del> The eigenvalues/eigenvectors are computed using LAPACK routines _syevd, <del> _heevd <add> The eigenvalues/eigenvectors are computed using LAPACK routines ``_syevd``, <add> ``_heevd``. <ide> <ide> The eigenvalues of real symmetric or complex Hermitian matrices are <ide> always real. [1]_ The array `v` of (column) eigenvectors is unitary <ide> def slogdet(a): <ide> .. versionadded:: 1.6.0 <ide> <ide> The determinant is computed via LU factorization using the LAPACK <del> routine z/dgetrf. <add> routine ``z/dgetrf``. <ide> <ide> <ide> Examples <ide> def det(a): <ide> details. <ide> <ide> The determinant is computed via LU factorization using the LAPACK <del> routine z/dgetrf. <add> routine ``z/dgetrf``. <ide> <ide> Examples <ide> -------- <ide> def lstsq(a, b, rcond="warn"): <ide> def _multi_svd_norm(x, row_axis, col_axis, op): <ide> """Compute a function of the singular values of the 2-D matrices in `x`. <ide> <del> This is a private utility function used by numpy.linalg.norm(). <add> This is a private utility function used by ``numpy.linalg.norm()``. <ide> <ide> Parameters <ide> ---------- <ide> x : ndarray <ide> row_axis, col_axis : int <ide> The axes of `x` that hold the 2-D matrices. <ide> op : callable <del> This should be either numpy.amin or numpy.amax or numpy.sum. <add> This should be either numpy.amin or ``numpy.amax`` or ``numpy.sum``. <ide> <ide> Returns <ide> -------
1
Go
Go
clean dead code
c9db9e4ff1ca2e563328c6c618184d9aa8393ac5
<ide><path>oci/defaults_linux.go <ide> func DefaultSpec() specs.Spec { <ide> UID: u32Ptr(0), <ide> GID: u32Ptr(0), <ide> }, <del> // { <del> // Type: "c", <del> // Path: "/dev/tty", <del> // Major: 5, <del> // Minor: 0, <del> // FileMode: fmPtr(0666), <del> // UID: u32Ptr(0), <del> // GID: u32Ptr(0), <del> // }, <del> // { <del> // Type: "c", <del> // Path: "/dev/console", <del> // Major: 5, <del> // Minor: 1, <del> // FileMode: fmPtr(0666), <del> // UID: u32Ptr(0), <del> // GID: u32Ptr(0), <del> // }, <ide> { <ide> Type: "c", <ide> Path: "/dev/fuse",
1
Go
Go
decrease timeouts in testeventsstreaming
e45bf8d2e9b43a4f5c5ed844b333733f95ccbafb
<ide><path>integration-cli/docker_cli_events_test.go <ide> func TestEventsStreaming(t *testing.T) { <ide> id <- cleanedContainerID <ide> <ide> select { <del> case <-time.After(30 * time.Second): <add> case <-time.After(5 * time.Second): <ide> t.Fatal("failed to observe container create in timely fashion") <ide> case <-eventCreate: <ide> // ignore, done <ide> } <ide> <ide> select { <del> case <-time.After(30 * time.Second): <add> case <-time.After(5 * time.Second): <ide> t.Fatal("failed to observe container start in timely fashion") <ide> case <-eventStart: <ide> // ignore, done <ide> } <ide> <ide> select { <del> case <-time.After(30 * time.Second): <add> case <-time.After(5 * time.Second): <ide> t.Fatal("failed to observe container die in timely fashion") <ide> case <-eventDie: <ide> // ignore, done <ide> func TestEventsStreaming(t *testing.T) { <ide> } <ide> <ide> select { <del> case <-time.After(30 * time.Second): <add> case <-time.After(5 * time.Second): <ide> t.Fatal("failed to observe container destroy in timely fashion") <ide> case <-eventDestroy: <ide> // ignore, done
1
PHP
PHP
fix doc block
0f4433caf3d147b125b1407b85b23eff4d4eaf07
<ide><path>src/Database/TypeMap.php <ide> public function setDefaults(array $defaults) <ide> /** <ide> * Returns the currently configured types. <ide> * <del> * @return self|array <add> * @return array <ide> */ <ide> public function getDefaults() <ide> {
1
Ruby
Ruby
use a hash to cache compiler version lookups
237fa3164dcb56f6de3b875ed9fe9b47c7b0712b
<ide><path>Library/Homebrew/os/mac.rb <ide> def clang_build_version <ide> end <ide> <ide> def non_apple_gcc_version(cc) <del> path = HOMEBREW_PREFIX.join("opt/gcc/bin/#{cc}") <del> path = nil unless path.exist? <del> <del> return unless path ||= locate(cc) <del> <del> ivar = "@#{cc.gsub(/(-|\.)/, '')}_version" <del> return instance_variable_get(ivar) if instance_variable_defined?(ivar) <del> <del> `#{path} --version` =~ /gcc(-\d\.\d \(.+\))? (\d\.\d\.\d)/ <del> instance_variable_set(ivar, $2) <add> (@non_apple_gcc_version ||= {}).fetch(cc) do <add> path = HOMEBREW_PREFIX.join("opt", "gcc", "bin", cc) <add> path = locate(cc) unless path.exist? <add> version = %x{#{path} --version}[/gcc(?:-\d\.\d \(.+\))? (\d\.\d\.\d)/, 1] if path <add> @non_apple_gcc_version[cc] = version <add> end <ide> end <ide> <ide> # See these issues for some history:
1
Javascript
Javascript
remove bad tests from linear scale
7aa1463c1570507b337a14faa9166f78ddfa4f25
<ide><path>test/scale.linear.tests.js <ide> describe('Linear Scale', function() { <ide> }); <ide> <ide> var xScale = chartInstance.scales.xScale0; <del> expect(xScale.paddingTop).toBe(0); <del> expect(xScale.paddingBottom).toBe(0); <del> expect(xScale.paddingLeft).toBe(0); <del> expect(xScale.paddingRight).toBe(13.5); <add> expect(xScale.paddingTop).toBeCloseToPixel(0); <add> expect(xScale.paddingBottom).toBeCloseToPixel(0); <add> expect(xScale.paddingLeft).toBeCloseToPixel(0); <add> expect(xScale.paddingRight).toBeCloseToPixel(13.5); <ide> expect(xScale.width).toBeCloseToPixel(471); <ide> expect(xScale.height).toBeCloseToPixel(28); <ide> <ide> var yScale = chartInstance.scales.yScale0; <del> expect(yScale.paddingTop).toBe(0); <del> expect(yScale.paddingBottom).toBe(0); <del> expect(yScale.paddingLeft).toBe(0); <del> expect(yScale.paddingRight).toBe(0); <add> expect(yScale.paddingTop).toBeCloseToPixel(0); <add> expect(yScale.paddingBottom).toBeCloseToPixel(0); <add> expect(yScale.paddingLeft).toBeCloseToPixel(0); <add> expect(yScale.paddingRight).toBeCloseToPixel(0); <ide> expect(yScale.width).toBeCloseToPixel(41); <ide> expect(yScale.height).toBeCloseToPixel(452); <ide> <ide> describe('Linear Scale', function() { <ide> yScale.options.scaleLabel.display = true; <ide> chartInstance.update(); <ide> <del> expect(xScale.paddingTop).toBe(0); <del> expect(xScale.paddingBottom).toBe(0); <del> expect(xScale.paddingLeft).toBe(0); <del> expect(xScale.paddingRight).toBe(13.5); <add> expect(xScale.paddingTop).toBeCloseToPixel(0); <add> expect(xScale.paddingBottom).toBeCloseToPixel(0); <add> expect(xScale.paddingLeft).toBeCloseToPixel(0); <add> expect(xScale.paddingRight).toBeCloseToPixel(13.5); <ide> expect(xScale.width).toBeCloseToPixel(453); <ide> expect(xScale.height).toBeCloseToPixel(46); <ide> <del> expect(yScale.paddingTop).toBe(0); <del> expect(yScale.paddingBottom).toBe(0); <del> expect(yScale.paddingLeft).toBe(0); <del> expect(yScale.paddingRight).toBe(0); <add> expect(yScale.paddingTop).toBeCloseToPixel(0); <add> expect(yScale.paddingBottom).toBeCloseToPixel(0); <add> expect(yScale.paddingLeft).toBeCloseToPixel(0); <add> expect(yScale.paddingRight).toBeCloseToPixel(0); <ide> expect(yScale.width).toBeCloseToPixel(59); <ide> expect(yScale.height).toBeCloseToPixel(434); <ide> }); <del> <del> it('Should draw correctly horizontally', function() { <del> chartInstance = window.acquireChart({ <del> type: 'line', <del> data: { <del> datasets: [{ <del> xAxisID: 'xScale0', <del> yAxisID: 'yScale0', <del> data: [{ <del> x: 10, <del> y: -5 <del> }, { <del> x: -10, <del> y: 0 <del> }, { <del> x: 0, <del> y: 2 <del> }, { <del> x: 99, <del> y: -3 <del> }] <del> }], <del> }, <del> options: { <del> scales: { <del> xAxes: [{ <del> id: 'xScale0', <del> type: 'linear', <del> position: 'bottom' <del> }], <del> yAxes: [{ <del> id: 'yScale0', <del> type: 'linear' <del> }] <del> } <del> } <del> }); <del> <del> var xScale = chartInstance.scales.xScale0; <del> var mockContext = window.createMockContext(); <del> xScale.ctx = mockContext; <del> <del> chartInstance.draw(); <del> <del> var expected = [{ <del> "name": "setFillStyle", <del> "args": ["#666"] <del> }, { <del> "name": "setLineWidth", <del> "args": [1] <del> }, { <del> "name": "setStrokeStyle", <del> "args": ["rgba(0, 0, 0, 0.1)"] <del> }, { <del> "name": "beginPath", <del> "args": [] <del> }, { <del> "name": "moveTo", <del> "args": [31.5, 484] <del> }, { <del> "name": "lineTo", <del> "args": [31.5, 494] <del> }, { <del> "name": "moveTo", <del> "args": [31.5, 32] <del> }, { <del> "name": "lineTo", <del> "args": [31.5, 484] <del> }, { <del> "name": "stroke", <del> "args": [] <del> }, { <del> "name": "save", <del> "args": [] <del> }, { <del> "name": "translate", <del> "args": [31, 494] <del> }, { <del> "name": "rotate", <del> "args": [-0] <del> }, { <del> "name": "fillText", <del> "args": ["-20", 0, 0] <del> }, { <del> "name": "restore", <del> "args": [] <del> }, { <del> "name": "setLineWidth", <del> "args": [1] <del> }, { <del> "name": "setStrokeStyle", <del> "args": ["rgba(0,0,0,0.25)"] <del> }, { <del> "name": "beginPath", <del> "args": [] <del> }, { <del> "name": "moveTo", <del> "args": [109.5, 484] <del> }, { <del> "name": "lineTo", <del> "args": [109.5, 494] <del> }, { <del> "name": "moveTo", <del> "args": [109.5, 32] <del> }, { <del> "name": "lineTo", <del> "args": [109.5, 484] <del> }, { <del> "name": "stroke", <del> "args": [] <del> }, { <del> "name": "save", <del> "args": [] <del> }, { <del> "name": "translate", <del> "args": [109, 494] <del> }, { <del> "name": "rotate", <del> "args": [-0] <del> }, { <del> "name": "fillText", <del> "args": ["0", 0, 0] <del> }, { <del> "name": "restore", <del> "args": [] <del> }, { <del> "name": "setLineWidth", <del> "args": [1] <del> }, { <del> "name": "setStrokeStyle", <del> "args": ["rgba(0, 0, 0, 0.1)"] <del> }, { <del> "name": "beginPath", <del> "args": [] <del> }, { <del> "name": "moveTo", <del> "args": [187.5, 484] <del> }, { <del> "name": "lineTo", <del> "args": [187.5, 494] <del> }, { <del> "name": "moveTo", <del> "args": [187.5, 32] <del> }, { <del> "name": "lineTo", <del> "args": [187.5, 484] <del> }, { <del> "name": "stroke", <del> "args": [] <del> }, { <del> "name": "save", <del> "args": [] <del> }, { <del> "name": "translate", <del> "args": [187, 494] <del> }, { <del> "name": "rotate", <del> "args": [-0] <del> }, { <del> "name": "fillText", <del> "args": ["20", 0, 0] <del> }, { <del> "name": "restore", <del> "args": [] <del> }, { <del> "name": "beginPath", <del> "args": [] <del> }, { <del> "name": "moveTo", <del> "args": [265.5, 484] <del> }, { <del> "name": "lineTo", <del> "args": [265.5, 494] <del> }, { <del> "name": "moveTo", <del> "args": [265.5, 32] <del> }, { <del> "name": "lineTo", <del> "args": [265.5, 484] <del> }, { <del> "name": "stroke", <del> "args": [] <del> }, { <del> "name": "save", <del> "args": [] <del> }, { <del> "name": "translate", <del> "args": [265, 494] <del> }, { <del> "name": "rotate", <del> "args": [-0] <del> }, { <del> "name": "fillText", <del> "args": ["40", 0, 0] <del> }, { <del> "name": "restore", <del> "args": [] <del> }, { <del> "name": "beginPath", <del> "args": [] <del> }, { <del> "name": "moveTo", <del> "args": [343.5, 484] <del> }, { <del> "name": "lineTo", <del> "args": [343.5, 494] <del> }, { <del> "name": "moveTo", <del> "args": [343.5, 32] <del> }, { <del> "name": "lineTo", <del> "args": [343.5, 484] <del> }, { <del> "name": "stroke", <del> "args": [] <del> }, { <del> "name": "save", <del> "args": [] <del> }, { <del> "name": "translate", <del> "args": [343, 494] <del> }, { <del> "name": "rotate", <del> "args": [-0] <del> }, { <del> "name": "fillText", <del> "args": ["60", 0, 0] <del> }, { <del> "name": "restore", <del> "args": [] <del> }, { <del> "name": "beginPath", <del> "args": [] <del> }, { <del> "name": "moveTo", <del> "args": [421.5, 484] <del> }, { <del> "name": "lineTo", <del> "args": [421.5, 494] <del> }, { <del> "name": "moveTo", <del> "args": [421.5, 32] <del> }, { <del> "name": "lineTo", <del> "args": [421.5, 484] <del> }, { <del> "name": "stroke", <del> "args": [] <del> }, { <del> "name": "save", <del> "args": [] <del> }, { <del> "name": "translate", <del> "args": [421, 494] <del> }, { <del> "name": "rotate", <del> "args": [-0] <del> }, { <del> "name": "fillText", <del> "args": ["80", 0, 0] <del> }, { <del> "name": "restore", <del> "args": [] <del> }, { <del> "name": "beginPath", <del> "args": [] <del> }, { <del> "name": "moveTo", <del> "args": [499.5, 484] <del> }, { <del> "name": "lineTo", <del> "args": [499.5, 494] <del> }, { <del> "name": "moveTo", <del> "args": [499.5, 32] <del> }, { <del> "name": "lineTo", <del> "args": [499.5, 484] <del> }, { <del> "name": "stroke", <del> "args": [] <del> }, { <del> "name": "save", <del> "args": [] <del> }, { <del> "name": "translate", <del> "args": [499, 494] <del> }, { <del> "name": "rotate", <del> "args": [-0] <del> }, { <del> "name": "fillText", <del> "args": ["100", 0, 0] <del> }, { <del> "name": "restore", <del> "args": [] <del> }, { <del> "name": "setLineWidth", <del> "args": [1] <del> }, { <del> "name": "setStrokeStyle", <del> "args": ["rgba(0, 0, 0, 0.1)"] <del> }, { <del> "name": "beginPath", <del> "args": [] <del> }, { <del> "name": "moveTo", <del> "args": [31, 484.5] <del> }, { <del> "name": "lineTo", <del> "args": [512, 484.5] <del> }, { <del> "name": "stroke", <del> "args": [] <del> }]; <del> expect(mockContext.getCalls()).toEqual(expected); <del> <del> // Turn off some drawing <del> xScale.options.gridLines.drawTicks = false; <del> xScale.options.gridLines.drawOnChartArea = false; <del> xScale.options.ticks.display = false; <del> xScale.options.scaleLabel.display = true; <del> xScale.options.scaleLabel.labelString = 'myLabel'; <del> <del> mockContext.resetCalls(); <del> <del> chartInstance.draw(); <del> expect(mockContext.getCalls()).toEqual([{ <del> "name": "setFillStyle", <del> "args": ["#666"] <del> }, { <del> "name": "setLineWidth", <del> "args": [1] <del> }, { <del> "name": "setStrokeStyle", <del> "args": ["rgba(0, 0, 0, 0.1)"] <del> }, { <del> "name": "beginPath", <del> "args": [] <del> }, { <del> "name": "stroke", <del> "args": [] <del> }, { <del> "name": "setLineWidth", <del> "args": [1] <del> }, { <del> "name": "setStrokeStyle", <del> "args": ["rgba(0,0,0,0.25)"] <del> }, { <del> "name": "beginPath", <del> "args": [] <del> }, { <del> "name": "stroke", <del> "args": [] <del> }, { <del> "name": "setLineWidth", <del> "args": [1] <del> }, { <del> "name": "setStrokeStyle", <del> "args": ["rgba(0, 0, 0, 0.1)"] <del> }, { <del> "name": "beginPath", <del> "args": [] <del> }, { <del> "name": "stroke", <del> "args": [] <del> }, { <del> "name": "beginPath", <del> "args": [] <del> }, { <del> "name": "stroke", <del> "args": [] <del> }, { <del> "name": "beginPath", <del> "args": [] <del> }, { <del> "name": "stroke", <del> "args": [] <del> }, { <del> "name": "beginPath", <del> "args": [] <del> }, { <del> "name": "stroke", <del> "args": [] <del> }, { <del> "name": "beginPath", <del> "args": [] <del> }, { <del> "name": "stroke", <del> "args": [] <del> }, { <del> "name": "setFillStyle", <del> "args": ["#666"] <del> }, { <del> "name": "fillText", <del> "args": ["myLabel", 271.5, 506] <del> }, { <del> "name": "setLineWidth", <del> "args": [1] <del> }, { <del> "name": "setStrokeStyle", <del> "args": ["rgba(0, 0, 0, 0.1)"] <del> }, { <del> "name": "beginPath", <del> "args": [] <del> }, { <del> "name": "moveTo", <del> "args": [31, 484.5] <del> }, { <del> "name": "lineTo", <del> "args": [512, 484.5] <del> }, { <del> "name": "stroke", <del> "args": [] <del> }]); <del> <del> // Turn off display <del> <del> mockContext.resetCalls(); <del> xScale.options.display = false; <del> chartInstance.draw(); <del> expect(mockContext.getCalls()).toEqual([]); <del> }); <del> <del> it('Should draw correctly vertically', function() { <del> chartInstance = window.acquireChart({ <del> type: 'line', <del> data: { <del> datasets: [{ <del> xAxisID: 'xScale0', <del> yAxisID: 'yScale0', <del> data: [{ <del> x: 10, <del> y: -5 <del> }, { <del> x: -10, <del> y: 0 <del> }, { <del> x: 0, <del> y: 2 <del> }, { <del> x: 99, <del> y: -3 <del> }] <del> }], <del> }, <del> options: { <del> scales: { <del> xAxes: [{ <del> id: 'xScale0', <del> type: 'linear', <del> position: 'bottom' <del> }], <del> yAxes: [{ <del> id: 'yScale0', <del> type: 'linear' <del> }] <del> } <del> } <del> }); <del> <del> var yScale = chartInstance.scales.yScale0; <del> var mockContext = window.createMockContext(); <del> yScale.ctx = mockContext; <del> <del> chartInstance.draw(); <del> <del> expect(mockContext.getCalls()).toEqual([{ <del> "name": "setFillStyle", <del> "args": ["#666"] <del> }, { <del> "name": "setLineWidth", <del> "args": [1] <del> }, { <del> "name": "setStrokeStyle", <del> "args": ["rgba(0, 0, 0, 0.1)"] <del> }, { <del> "name": "beginPath", <del> "args": [] <del> }, { <del> "name": "moveTo", <del> "args": [26, 32.5] <del> }, { <del> "name": "lineTo", <del> "args": [31, 32.5] <del> }, { <del> "name": "moveTo", <del> "args": [31, 32.5] <del> }, { <del> "name": "lineTo", <del> "args": [512, 32.5] <del> }, { <del> "name": "stroke", <del> "args": [] <del> }, { <del> "name": "save", <del> "args": [] <del> }, { <del> "name": "translate", <del> "args": [21, 32] <del> }, { <del> "name": "rotate", <del> "args": [-0] <del> }, { <del> "name": "fillText", <del> "args": ["2", 0, 0] <del> }, { <del> "name": "restore", <del> "args": [] <del> }, { <del> "name": "beginPath", <del> "args": [] <del> }, { <del> "name": "moveTo", <del> "args": [26, 97.5] <del> }, { <del> "name": "lineTo", <del> "args": [31, 97.5] <del> }, { <del> "name": "moveTo", <del> "args": [31, 97.5] <del> }, { <del> "name": "lineTo", <del> "args": [512, 97.5] <del> }, { <del> "name": "stroke", <del> "args": [] <del> }, { <del> "name": "save", <del> "args": [] <del> }, { <del> "name": "translate", <del> "args": [21, 97] <del> }, { <del> "name": "rotate", <del> "args": [-0] <del> }, { <del> "name": "fillText", <del> "args": ["1", 0, 0] <del> }, { <del> "name": "restore", <del> "args": [] <del> }, { <del> "name": "setLineWidth", <del> "args": [1] <del> }, { <del> "name": "setStrokeStyle", <del> "args": ["rgba(0,0,0,0.25)"] <del> }, { <del> "name": "beginPath", <del> "args": [] <del> }, { <del> "name": "moveTo", <del> "args": [26, 161.5] <del> }, { <del> "name": "lineTo", <del> "args": [31, 161.5] <del> }, { <del> "name": "moveTo", <del> "args": [31, 161.5] <del> }, { <del> "name": "lineTo", <del> "args": [512, 161.5] <del> }, { <del> "name": "stroke", <del> "args": [] <del> }, { <del> "name": "save", <del> "args": [] <del> }, { <del> "name": "translate", <del> "args": [21, 161] <del> }, { <del> "name": "rotate", <del> "args": [-0] <del> }, { <del> "name": "fillText", <del> "args": ["0", 0, 0] <del> }, { <del> "name": "restore", <del> "args": [] <del> }, { <del> "name": "setLineWidth", <del> "args": [1] <del> }, { <del> "name": "setStrokeStyle", <del> "args": ["rgba(0, 0, 0, 0.1)"] <del> }, { <del> "name": "beginPath", <del> "args": [] <del> }, { <del> "name": "moveTo", <del> "args": [26, 226.5] <del> }, { <del> "name": "lineTo", <del> "args": [31, 226.5] <del> }, { <del> "name": "moveTo", <del> "args": [31, 226.5] <del> }, { <del> "name": "lineTo", <del> "args": [512, 226.5] <del> }, { <del> "name": "stroke", <del> "args": [] <del> }, { <del> "name": "save", <del> "args": [] <del> }, { <del> "name": "translate", <del> "args": [21, 226] <del> }, { <del> "name": "rotate", <del> "args": [-0] <del> }, { <del> "name": "fillText", <del> "args": ["-1", 0, 0] <del> }, { <del> "name": "restore", <del> "args": [] <del> }, { <del> "name": "beginPath", <del> "args": [] <del> }, { <del> "name": "moveTo", <del> "args": [26, 290.5] <del> }, { <del> "name": "lineTo", <del> "args": [31, 290.5] <del> }, { <del> "name": "moveTo", <del> "args": [31, 290.5] <del> }, { <del> "name": "lineTo", <del> "args": [512, 290.5] <del> }, { <del> "name": "stroke", <del> "args": [] <del> }, { <del> "name": "save", <del> "args": [] <del> }, { <del> "name": "translate", <del> "args": [21, 290] <del> }, { <del> "name": "rotate", <del> "args": [-0] <del> }, { <del> "name": "fillText", <del> "args": ["-2", 0, 0] <del> }, { <del> "name": "restore", <del> "args": [] <del> }, { <del> "name": "beginPath", <del> "args": [] <del> }, { <del> "name": "moveTo", <del> "args": [26, 355.5] <del> }, { <del> "name": "lineTo", <del> "args": [31, 355.5] <del> }, { <del> "name": "moveTo", <del> "args": [31, 355.5] <del> }, { <del> "name": "lineTo", <del> "args": [512, 355.5] <del> }, { <del> "name": "stroke", <del> "args": [] <del> }, { <del> "name": "save", <del> "args": [] <del> }, { <del> "name": "translate", <del> "args": [21, 355] <del> }, { <del> "name": "rotate", <del> "args": [-0] <del> }, { <del> "name": "fillText", <del> "args": ["-3", 0, 0] <del> }, { <del> "name": "restore", <del> "args": [] <del> }, { <del> "name": "beginPath", <del> "args": [] <del> }, { <del> "name": "moveTo", <del> "args": [26, 419.5] <del> }, { <del> "name": "lineTo", <del> "args": [31, 419.5] <del> }, { <del> "name": "moveTo", <del> "args": [31, 419.5] <del> }, { <del> "name": "lineTo", <del> "args": [512, 419.5] <del> }, { <del> "name": "stroke", <del> "args": [] <del> }, { <del> "name": "save", <del> "args": [] <del> }, { <del> "name": "translate", <del> "args": [21, 419] <del> }, { <del> "name": "rotate", <del> "args": [-0] <del> }, { <del> "name": "fillText", <del> "args": ["-4", 0, 0] <del> }, { <del> "name": "restore", <del> "args": [] <del> }, { <del> "name": "beginPath", <del> "args": [] <del> }, { <del> "name": "moveTo", <del> "args": [26, 484.5] <del> }, { <del> "name": "lineTo", <del> "args": [31, 484.5] <del> }, { <del> "name": "moveTo", <del> "args": [31, 484.5] <del> }, { <del> "name": "lineTo", <del> "args": [512, 484.5] <del> }, { <del> "name": "stroke", <del> "args": [] <del> }, { <del> "name": "save", <del> "args": [] <del> }, { <del> "name": "translate", <del> "args": [21, 484] <del> }, { <del> "name": "rotate", <del> "args": [-0] <del> }, { <del> "name": "fillText", <del> "args": ["-5", 0, 0] <del> }, { <del> "name": "restore", <del> "args": [] <del> }, { <del> "name": "setLineWidth", <del> "args": [1] <del> }, { <del> "name": "setStrokeStyle", <del> "args": ["rgba(0, 0, 0, 0.1)"] <del> }, { <del> "name": "beginPath", <del> "args": [] <del> }, { <del> "name": "moveTo", <del> "args": [31.5, 32] <del> }, { <del> "name": "lineTo", <del> "args": [31.5, 484] <del> }, { <del> "name": "stroke", <del> "args": [] <del> }]); <del> <del> // Turn off some drawing <del> yScale.options.gridLines.drawTicks = false; <del> yScale.options.gridLines.drawOnChartArea = false; <del> yScale.options.ticks.display = false; <del> yScale.options.scaleLabel.display = true; <del> <del> mockContext.resetCalls(); <del> chartInstance.draw(); <del> <del> expect(mockContext.getCalls()).toEqual([{ <del> "name": "setFillStyle", <del> "args": ["#666"] <del> }, { <del> "name": "setLineWidth", <del> "args": [1] <del> }, { <del> "name": "setStrokeStyle", <del> "args": ["rgba(0, 0, 0, 0.1)"] <del> }, { <del> "name": "beginPath", <del> "args": [] <del> }, { <del> "name": "stroke", <del> "args": [] <del> }, { <del> "name": "beginPath", <del> "args": [] <del> }, { <del> "name": "stroke", <del> "args": [] <del> }, { <del> "name": "setLineWidth", <del> "args": [1] <del> }, { <del> "name": "setStrokeStyle", <del> "args": ["rgba(0,0,0,0.25)"] <del> }, { <del> "name": "beginPath", <del> "args": [] <del> }, { <del> "name": "stroke", <del> "args": [] <del> }, { <del> "name": "setLineWidth", <del> "args": [1] <del> }, { <del> "name": "setStrokeStyle", <del> "args": ["rgba(0, 0, 0, 0.1)"] <del> }, { <del> "name": "beginPath", <del> "args": [] <del> }, { <del> "name": "stroke", <del> "args": [] <del> }, { <del> "name": "beginPath", <del> "args": [] <del> }, { <del> "name": "stroke", <del> "args": [] <del> }, { <del> "name": "beginPath", <del> "args": [] <del> }, { <del> "name": "stroke", <del> "args": [] <del> }, { <del> "name": "beginPath", <del> "args": [] <del> }, { <del> "name": "stroke", <del> "args": [] <del> }, { <del> "name": "beginPath", <del> "args": [] <del> }, { <del> "name": "stroke", <del> "args": [] <del> }, { <del> "name": "save", <del> "args": [] <del> }, { <del> "name": "translate", <del> "args": [6, 258] <del> }, { <del> "name": "rotate", <del> "args": [-1.5707963267948966] <del> }, { <del> "name": "setFillStyle", <del> "args": ["#666"] <del> }, { <del> "name": "fillText", <del> "args": ["", 0, 0] <del> }, { <del> "name": "restore", <del> "args": [] <del> }, { <del> "name": "setLineWidth", <del> "args": [1] <del> }, { <del> "name": "setStrokeStyle", <del> "args": ["rgba(0, 0, 0, 0.1)"] <del> }, { <del> "name": "beginPath", <del> "args": [] <del> }, { <del> "name": "moveTo", <del> "args": [31.5, 32] <del> }, { <del> "name": "lineTo", <del> "args": [31.5, 484] <del> }, { <del> "name": "stroke", <del> "args": [] <del> }]); <del> }); <del> <del> it("should not draw lines where the callback function returned null or undefined", function() { <del> chartInstance = window.acquireChart({ <del> type: 'line', <del> data: { <del> datasets: [{ <del> xAxisID: 'xScale0', <del> yAxisID: 'yScale0', <del> data: [{ <del> x: 10, <del> y: -5 <del> }, { <del> x: -10, <del> y: 0 <del> }, { <del> x: 0, <del> y: 2 <del> }, { <del> x: 99, <del> y: -3 <del> }] <del> }], <del> }, <del> options: { <del> scales: { <del> xAxes: [{ <del> id: 'xScale0', <del> type: 'linear', <del> position: 'bottom' <del> }], <del> yAxes: [{ <del> id: 'yScale0', <del> type: 'linear', <del> ticks: { <del> callback: function(tickValue, index) { <del> return index % 2 === 0 ? null : tickValue.toString(); <del> } <del> } <del> }] <del> } <del> } <del> }); <del> <del> var yScale = chartInstance.scales.yScale0; <del> var mockContext = window.createMockContext(); <del> yScale.ctx = mockContext; <del> <del> chartInstance.draw(); <del> <del> expect(mockContext.getCalls()).toEqual([{ <del> "name": "setFillStyle", <del> "args": ["#666"] <del> }, { <del> "name": "setLineWidth", <del> "args": [1] <del> }, { <del> "name": "setStrokeStyle", <del> "args": ["rgba(0, 0, 0, 0.1)"] <del> }, { <del> "name": "beginPath", <del> "args": [] <del> }, { <del> "name": "moveTo", <del> "args": [26, 97.5] <del> }, { <del> "name": "lineTo", <del> "args": [31, 97.5] <del> }, { <del> "name": "moveTo", <del> "args": [31, 97.5] <del> }, { <del> "name": "lineTo", <del> "args": [512, 97.5] <del> }, { <del> "name": "stroke", <del> "args": [] <del> }, { <del> "name": "save", <del> "args": [] <del> }, { <del> "name": "translate", <del> "args": [21, 97] <del> }, { <del> "name": "rotate", <del> "args": [-0] <del> }, { <del> "name": "fillText", <del> "args": ["1", 0, 0] <del> }, { <del> "name": "restore", <del> "args": [] <del> }, { <del> "name": "beginPath", <del> "args": [] <del> }, { <del> "name": "moveTo", <del> "args": [26, 226.5] <del> }, { <del> "name": "lineTo", <del> "args": [31, 226.5] <del> }, { <del> "name": "moveTo", <del> "args": [31, 226.5] <del> }, { <del> "name": "lineTo", <del> "args": [512, 226.5] <del> }, { <del> "name": "stroke", <del> "args": [] <del> }, { <del> "name": "save", <del> "args": [] <del> }, { <del> "name": "translate", <del> "args": [21, 226] <del> }, { <del> "name": "rotate", <del> "args": [-0] <del> }, { <del> "name": "fillText", <del> "args": ["-1", 0, 0] <del> }, { <del> "name": "restore", <del> "args": [] <del> }, { <del> "name": "beginPath", <del> "args": [] <del> }, { <del> "name": "moveTo", <del> "args": [26, 355.5] <del> }, { <del> "name": "lineTo", <del> "args": [31, 355.5] <del> }, { <del> "name": "moveTo", <del> "args": [31, 355.5] <del> }, { <del> "name": "lineTo", <del> "args": [512, 355.5] <del> }, { <del> "name": "stroke", <del> "args": [] <del> }, { <del> "name": "save", <del> "args": [] <del> }, { <del> "name": "translate", <del> "args": [21, 355] <del> }, { <del> "name": "rotate", <del> "args": [-0] <del> }, { <del> "name": "fillText", <del> "args": ["-3", 0, 0] <del> }, { <del> "name": "restore", <del> "args": [] <del> }, { <del> "name": "beginPath", <del> "args": [] <del> }, { <del> "name": "moveTo", <del> "args": [26, 484.5] <del> }, { <del> "name": "lineTo", <del> "args": [31, 484.5] <del> }, { <del> "name": "moveTo", <del> "args": [31, 484.5] <del> }, { <del> "name": "lineTo", <del> "args": [512, 484.5] <del> }, { <del> "name": "stroke", <del> "args": [] <del> }, { <del> "name": "save", <del> "args": [] <del> }, { <del> "name": "translate", <del> "args": [21, 484] <del> }, { <del> "name": "rotate", <del> "args": [-0] <del> }, { <del> "name": "fillText", <del> "args": ["-5", 0, 0] <del> }, { <del> "name": "restore", <del> "args": [] <del> }, { <del> "name": "setLineWidth", <del> "args": [1] <del> }, { <del> "name": "setStrokeStyle", <del> "args": ["rgba(0, 0, 0, 0.1)"] <del> }, { <del> "name": "beginPath", <del> "args": [] <del> }, { <del> "name": "moveTo", <del> "args": [31.5, 32] <del> }, { <del> "name": "lineTo", <del> "args": [31.5, 484] <del> }, { <del> "name": "stroke", <del> "args": [] <del> }]) <del> }); <ide> });
1
PHP
PHP
remove unneede code
7027526abd809080e9211c9ea7c9f134b0b2b45e
<ide><path>tests/Database/DatabaseEloquentFactoryTest.php <ide> public function test_sequences() <ide> <ide> $user = FactoryTestUserFactory::new() <ide> ->hasAttached( <del> FactoryTestRoleFactory::times(4)->afterCreating(function ($role, $user) { <del> $_SERVER['__test.role.creating-role'] = $role; <del> $_SERVER['__test.role.creating-user'] = $user; <del> }), <add> FactoryTestRoleFactory::times(4), <ide> new Sequence(['admin' => 'Y'], ['admin' => 'N']), <ide> 'roles' <ide> )
1
Text
Text
add new notebook links in the docs
1aed2b908ea21de8e04be206d739e16b290b44c6
<ide><path>notebooks/README.md <ide> Pull Request so it can be included under the Community notebooks. <ide> | [How to fine-tune a model on language modeling](https://github.com/huggingface/notebooks/blob/master/examples/language_modeling.ipynb) | Show how to preprocess the data and fine-tune a pretrained model on a causal or masked LM task. | [![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/huggingface/notebooks/blob/master/examples/language_modeling.ipynb)| <ide> | [How to fine-tune a model on token classification](https://github.com/huggingface/notebooks/blob/master/examples/token_classification.ipynb) | Show how to preprocess the data and fine-tune a pretrained model on a token classification task (NER, PoS). | [![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/huggingface/notebooks/blob/master/examples/token_classification.ipynb)| <ide> | [How to fine-tune a model on question answering](https://github.com/huggingface/notebooks/blob/master/examples/question_answering.ipynb) | Show how to preprocess the data and fine-tune a pretrained model on SQUAD. | [![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/huggingface/notebooks/blob/master/examples/question_answering.ipynb)| <add>| [How to fine-tune a model on multiple choice](https://github.com/huggingface/notebooks/blob/master/examples/multiple_choice.ipynb) | Show how to preprocess the data and fine-tune a pretrained model on SWAG. | [![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/huggingface/notebooks/blob/master/examples/multiple_choice.ipynb)| <add>| [How to fine-tune a model on translation](https://github.com/huggingface/notebooks/blob/master/examples/translation.ipynb) | Show how to preprocess the data and fine-tune a pretrained model on WMT. | [![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/huggingface/notebooks/blob/master/examples/translation.ipynb)| <add>| [How to fine-tune a model on summarization](https://github.com/huggingface/notebooks/blob/master/examples/question_answering.ipynb) | Show how to preprocess the data and fine-tune a pretrained model on XSUM. | [![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/huggingface/notebooks/blob/master/examples/summarization.ipynb)| <ide> | [How to train a language model from scratch](https://github.com/huggingface/blog/blob/master/notebooks/01_how_to_train.ipynb)| Highlight all the steps to effectively train Transformer model on custom data | [![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/huggingface/blog/blob/master/notebooks/01_how_to_train.ipynb)| <ide> | [How to generate text](https://github.com/huggingface/blog/blob/master/notebooks/02_how_to_generate.ipynb)| How to use different decoding methods for language generation with transformers | [![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/huggingface/blog/blob/master/notebooks/02_how_to_generate.ipynb)| <ide> | [How to export model to ONNX](https://github.com/huggingface/transformers/blob/master/notebooks/04-onnx-export.ipynb) | Highlight how to export and run inference workloads through ONNX |
1
PHP
PHP
use a class constant instead of a string
9fcef63e67f60f88f35da341fc452de929e8fcf2
<ide><path>src/Console/CommandCollection.php <ide> namespace Cake\Console; <ide> <ide> use ArrayIterator; <add>use Cake\Console\Shell; <ide> use Countable; <ide> use InvalidArgumentException; <ide> use IteratorAggregate; <ide> public function add($name, $command) <ide> { <ide> // Once we have a new Command class this should check <ide> // against that interface. <del> if (!is_subclass_of($command, 'Cake\Console\Shell')) { <add> if (!is_subclass_of($command, Shell::class)) { <ide> throw new InvalidArgumentException( <ide> "'$name' is not a subclass of Cake\Console\Shell or a valid command." <ide> );
1
Go
Go
remove unused func
0e9769ab62ec15d56541dfbbe72316630a98b6e2
<ide><path>container/container_unix.go <ide> func (container *Container) ShmResourcePath() (string, error) { <ide> return container.GetRootResourcePath("shm") <ide> } <ide> <del>// MqueueResourcePath returns path to mqueue <del>func (container *Container) MqueueResourcePath() (string, error) { <del> return container.GetRootResourcePath("mqueue") <del>} <del> <ide> // HasMountFor checks if path is a mountpoint <ide> func (container *Container) HasMountFor(path string) bool { <ide> _, exists := container.MountPoints[path]
1
PHP
PHP
update validation generation to be simpler
6a801b4503ad495102f96ea6db1da0457a98e488
<ide><path>src/Console/Command/Task/ModelTask.php <ide> public function generate($name) { <ide> $primaryKey = $this->getPrimaryKey($model); <ide> $displayField = $this->getDisplayField($model); <ide> $fields = $this->getFields($model); <add> $validation = $this->getValidation($model); <ide> <ide> $this->bake($object, false); <ide> $this->bakeFixture($model, $useTable); <ide> public function getFields($model) { <ide> return array_diff($columns, $exclude); <ide> } <ide> <add>/** <add> * Generate default validation rules. <add> * <add> * @param Cake\ORM\Table $model The model to introspect. <add> * @return array The validation rules. <add> */ <add> public function getValidation($model) { <add> if (!empty($this->params['no-validation'])) { <add> return []; <add> } <add> $schema = $model->schema(); <add> $fields = $schema->columns(); <add> if (empty($fields)) { <add> return false; <add> } <add> <add> $skipFields = false; <add> $validate = []; <add> $primaryKey = (array)$schema->primaryKey(); <add> <add> foreach ($fields as $fieldName) { <add> $field = $schema->column($fieldName); <add> $validation = $this->fieldValidation($fieldName, $field, $primaryKey); <add> if (!empty($validation)) { <add> $validate[$fieldName] = $validation; <add> } <add> } <add> return $validate; <add> } <add> <add>/** <add> * Does individual field validation handling. <add> * <add> * @param string $fieldName Name of field to be validated. <add> * @param array $metaData metadata for field <add> * @param string $primaryKey <add> * @return array Array of validation for the field. <add> */ <add> public function fieldValidation($fieldName, $metaData, $primaryKey) { <add> $ignoreFields = array_merge($primaryKey, ['created', 'modified', 'updated']); <add> if ($metaData['null'] == true && in_array($fieldName, $ignoreFields)) { <add> return false; <add> } <add> <add> if ($fieldName === 'email') { <add> $rule = 'email'; <add> } elseif ($metaData['type'] === 'uuid') { <add> $rule = 'uuid'; <add> } elseif ($metaData['type'] === 'string') { <add> $rule = 'notEmpty'; <add> } elseif ($metaData['type'] === 'text') { <add> $rule = 'notEmpty'; <add> } elseif ($metaData['type'] === 'integer') { <add> $rule = 'numeric'; <add> } elseif ($metaData['type'] === 'float') { <add> $rule = 'numeric'; <add> } elseif ($metaData['type'] === 'decimal') { <add> $rule = 'decimal'; <add> } elseif ($metaData['type'] === 'boolean') { <add> $rule = 'boolean'; <add> } elseif ($metaData['type'] === 'date') { <add> $rule = 'date'; <add> } elseif ($metaData['type'] === 'time') { <add> $rule = 'time'; <add> } elseif ($metaData['type'] === 'datetime') { <add> $rule = 'datetime'; <add> } elseif ($metaData['type'] === 'inet') { <add> $rule = 'ip'; <add> } <add> <add> $allowEmpty = false; <add> if ($rule !== 'notEmpty' && $metaData['null'] === false) { <add> $allowEmpty = true; <add> } <add> <add> return [ <add> 'rule' => $rule, <add> 'allowEmpty' => $allowEmpty, <add> ]; <add> } <add> <add> <ide> /** <ide> * Generate a key value list of options and a prompt. <ide> * <ide> protected function _interactive() { <ide> } <ide> } <ide> <del>/** <del> * Print out all the associations of a particular type <del> * <del> * @param string $modelName Name of the model relations belong to. <del> * @param string $type Name of association you want to see. i.e. 'belongsTo' <del> * @param string $associations Collection of associations. <del> * @return void <del> */ <del> protected function _printAssociation($modelName, $type, $associations) { <del> if (!empty($associations[$type])) { <del> for ($i = 0, $len = count($associations[$type]); $i < $len; $i++) { <del> $out = "\t" . $modelName . ' ' . $type . ' ' . $associations[$type][$i]['alias']; <del> $this->out($out); <del> } <del> } <del> } <del> <del>/** <del> * Handles Generation and user interaction for creating validation. <del> * <del> * @param Model $model Model to have validations generated for. <del> * @return array $validate Array of user selected validations. <del> */ <del> public function doValidation($model) { <del> if (!$model instanceof Model) { <del> return false; <del> } <del> <del> $fields = $model->schema(); <del> if (empty($fields)) { <del> return false; <del> } <del> <del> $skipFields = false; <del> $validate = array(); <del> $this->initValidations(); <del> foreach ($fields as $fieldName => $field) { <del> $validation = $this->fieldValidation($fieldName, $field, $model->primaryKey); <del> if (isset($validation['_skipFields'])) { <del> unset($validation['_skipFields']); <del> $skipFields = true; <del> } <del> if (!empty($validation)) { <del> $validate[$fieldName] = $validation; <del> } <del> if ($skipFields) { <del> return $validate; <del> } <del> } <del> return $validate; <del> } <del> <del>/** <del> * Populate the _validations array <del> * <del> * @return void <del> */ <del> public function initValidations() { <del> $options = $choices = []; <del> if (class_exists('Cake\Validation\Validation')) { <del> $options = get_class_methods('Cake\Validation\Validation'); <del> } <del> sort($options); <del> $default = 1; <del> foreach ($options as $option) { <del> if ($option{0} !== '_') { <del> $choices[$default] = $option; <del> $default++; <del> } <del> } <del> $choices[$default] = 'none'; // Needed since index starts at 1 <del> $this->_validations = $choices; <del> return $choices; <del> } <del> <del>/** <del> * Does individual field validation handling. <del> * <del> * @param string $fieldName Name of field to be validated. <del> * @param array $metaData metadata for field <del> * @param string $primaryKey <del> * @return array Array of validation for the field. <del> */ <del> public function fieldValidation($fieldName, $metaData, $primaryKey = 'id') { <del> $defaultChoice = count($this->_validations); <del> $validate = $alreadyChosen = []; <del> <del> $prompt = __d('cake_console', <del> "or enter in a valid regex validation string.\nAlternatively [s] skip the rest of the fields.\n" <del> ); <del> $methods = array_flip($this->_validations); <del> <del> $anotherValidator = 'y'; <del> while ($anotherValidator === 'y') { <del> if ($this->interactive) { <del> $this->out(); <del> $this->out(__d('cake_console', 'Field: <info>%s</info>', $fieldName)); <del> $this->out(__d('cake_console', 'Type: <info>%s</info>', $metaData['type'])); <del> $this->hr(); <del> $this->out(__d('cake_console', 'Please select one of the following validation options:')); <del> $this->hr(); <del> <del> $optionText = ''; <del> for ($i = 1, $m = $defaultChoice / 2; $i <= $m; $i++) { <del> $line = sprintf("%2d. %s", $i, $this->_validations[$i]); <del> $optionText .= $line . str_repeat(" ", 31 - strlen($line)); <del> if ($m + $i !== $defaultChoice) { <del> $optionText .= sprintf("%2d. %s\n", $m + $i, $this->_validations[$m + $i]); <del> } <del> } <del> $this->out($optionText); <del> $this->out(__d('cake_console', "%s - Do not do any validation on this field.", $defaultChoice)); <del> $this->hr(); <del> } <del> <del> $guess = $defaultChoice; <del> if ($metaData['null'] != 1 && !in_array($fieldName, [$primaryKey, 'created', 'modified', 'updated'])) { <del> if ($fieldName === 'email') { <del> $guess = $methods['email']; <del> } elseif ($metaData['type'] === 'string' && $metaData['length'] == 36) { <del> $guess = $methods['uuid']; <del> } elseif ($metaData['type'] === 'string') { <del> $guess = $methods['notEmpty']; <del> } elseif ($metaData['type'] === 'text') { <del> $guess = $methods['notEmpty']; <del> } elseif ($metaData['type'] === 'integer') { <del> $guess = $methods['numeric']; <del> } elseif ($metaData['type'] === 'float') { <del> $guess = $methods['numeric']; <del> } elseif ($metaData['type'] === 'boolean') { <del> $guess = $methods['boolean']; <del> } elseif ($metaData['type'] === 'date') { <del> $guess = $methods['date']; <del> } elseif ($metaData['type'] === 'time') { <del> $guess = $methods['time']; <del> } elseif ($metaData['type'] === 'datetime') { <del> $guess = $methods['datetime']; <del> } elseif ($metaData['type'] === 'inet') { <del> $guess = $methods['ip']; <del> } <del> } <del> <del> if ($this->interactive === true) { <del> $choice = $this->in($prompt, null, $guess); <del> if ($choice === 's') { <del> $validate['_skipFields'] = true; <del> return $validate; <del> } <del> if (in_array($choice, $alreadyChosen)) { <del> $this->out(__d('cake_console', "You have already chosen that validation rule,\nplease choose again")); <del> continue; <del> } <del> if (!isset($this->_validations[$choice]) && is_numeric($choice)) { <del> $this->out(__d('cake_console', 'Please make a valid selection.')); <del> continue; <del> } <del> $alreadyChosen[] = $choice; <del> } else { <del> $choice = $guess; <del> } <del> <del> if (isset($this->_validations[$choice])) { <del> $validatorName = $this->_validations[$choice]; <del> } else { <del> $validatorName = Inflector::slug($choice); <del> } <del> <del> if ($choice != $defaultChoice) { <del> $validate[$validatorName] = $choice; <del> if (is_numeric($choice) && isset($this->_validations[$choice])) { <del> $validate[$validatorName] = $this->_validations[$choice]; <del> } <del> } <del> $anotherValidator = 'n'; <del> if ($this->interactive && $choice != $defaultChoice) { <del> $anotherValidator = $this->in(__d('cake_console', "Would you like to add another validation rule\n" . <del> "or skip the rest of the fields?"), array('y', 'n', 's'), 'n'); <del> if ($anotherValidator === 's') { <del> $validate['_skipFields'] = true; <del> return $validate; <del> } <del> } <del> } <del> return $validate; <del> } <del> <ide> /** <ide> * Handles behaviors <ide> * <ide><path>tests/Fixture/BakeArticleFixture.php <ide> class BakeArticleFixture extends TestFixture { <ide> 'bake_user_id' => ['type' => 'integer', 'null' => false], <ide> 'title' => ['type' => 'string', 'null' => false], <ide> 'body' => 'text', <del> 'published' => ['type' => 'string', 'length' => 1, 'default' => 'N'], <add> 'published' => ['type' => 'boolean', 'length' => 1, 'default' => 0], <ide> 'created' => 'datetime', <ide> 'updated' => 'datetime', <ide> '_constraints' => ['primary' => ['type' => 'primary', 'columns' => ['id']]] <ide><path>tests/TestCase/Console/Command/Task/ModelTaskTest.php <ide> public function testFieldsWhiteList() { <ide> } <ide> <ide> /** <del> * test that initializing the validations works. <add> * test getting validation rules with the no-validation rule. <ide> * <ide> * @return void <ide> */ <del> public function testInitValidations() { <del> $result = $this->Task->initValidations(); <del> $this->assertTrue(in_array('notEmpty', $result)); <add> public function testGetValidationDisabled() { <add> $model = TableRegistry::get('BakeArticles'); <add> $this->Task->params['no-validation'] = true; <add> $result = $this->Task->getValidation($model); <add> $this->assertEquals([], $result); <add> } <add> <add>/** <add> * test getting validation rules. <add> * <add> * @return void <add> */ <add> public function testGetValidation() { <add> $model = TableRegistry::get('BakeArticles'); <add> $result = $this->Task->getValidation($model); <add> $expected = [ <add> 'id' => ['rule' => 'numeric', 'allowEmpty' => true], <add> 'bake_user_id' => ['rule' => 'numeric', 'allowEmpty' => true], <add> 'title' => ['rule' => 'notEmpty', 'allowEmpty' => false], <add> 'body' => ['rule' => 'notEmpty', 'allowEmpty' => false], <add> 'published' => ['rule' => 'boolean', 'allowEmpty' => false], <add> ]; <add> $this->assertEquals($expected, $result); <ide> } <ide> <ide> /**
3
Python
Python
add regression test for back to test suite
0f28418446581dd5df8807f44dcfa72371bdbd98
<ide><path>spacy/tests/regression/test_issue1001-1500.py <ide> from spacy.symbols import ORTH, LEMMA, POS, VERB, VerbForm_part <ide> <ide> <add>@pytest.mark.xfail <add>def test_issue1061(): <add> '''Test special-case works after tokenizing. Was caching problem.''' <add> text = 'I like _MATH_ even _MATH_ when _MATH_, except when _MATH_ is _MATH_! but not _MATH_.' <add> tokenizer = English.Defaults.create_tokenizer() <add> doc = tokenizer(text) <add> assert 'MATH' in [w.text for w in doc] <add> assert '_MATH_' not in [w.text for w in doc] <add> <add> tokenizer.add_special_case('_MATH_', [{ORTH: '_MATH_'}]) <add> doc = tokenizer(text) <add> assert '_MATH_' in [w.text for w in doc] <add> assert 'MATH' not in [w.text for w in doc] <add> <add> # For sanity, check it works when pipeline is clean. <add> tokenizer = English.Defaults.create_tokenizer() <add> tokenizer.add_special_case('_MATH_', [{ORTH: '_MATH_'}]) <add> doc = tokenizer(text) <add> assert '_MATH_' in [w.text for w in doc] <add> assert 'MATH' not in [w.text for w in doc] <add> <add> <ide> @pytest.mark.xfail( <ide> reason="g is split of as a unit, as the suffix regular expression can not look back further (variable-width)" <ide> )
1
PHP
PHP
update a few paths
16ec03e27a9505948a8a6e3bf82c1ba437b372f6
<ide><path>src/Illuminate/Foundation/Console/AppNameCommand.php <ide> protected function coreIsReady() <ide> */ <ide> protected function getUserClassPath() <ide> { <del> return $this->laravel['path.src'].'/Core/User.php'; <add> return $this->laravel['path'].'/Core/User.php'; <ide> } <ide> <ide> /** <ide><path>src/Illuminate/Foundation/Console/ProviderMakeCommand.php <ide> protected function buildProviderClass($name) <ide> */ <ide> protected function getPath($name) <ide> { <del> return $this->laravel['path.src'].'/Providers/'.$name.'.php'; <add> return $this->laravel['path.providers'].'/'.$name.'.php'; <ide> } <ide> <ide> /**
2
Ruby
Ruby
follow form from actioncable
a1a363a8aa0f0717ef329eba4a5fe57705fb6b2f
<ide><path>activestorage/lib/active_storage/engine.rb <del>require "rails/engine" <add># frozen_string_literal: true <add> <add>require "rails" <add>require "active_storage" <ide> <ide> module ActiveStorage <ide> class Engine < Rails::Engine # :nodoc:
1
Python
Python
add example for issue
f762d52b2419e1388229d64753f40fc5351ced39
<ide><path>examples/pipeline/custom_sentence_segmentation.py <add>'''Example of adding a pipeline component to prohibit sentence boundaries <add>before certain tokens. <add> <add>What we do is write to the token.is_sent_start attribute, which <add>takes values in {True, False, None}. The default value None allows the parser <add>to predict sentence segments. The value False prohibits the parser from inserting <add>a sentence boundary before that token. Note that fixing the sentence segmentation <add>should also improve the parse quality. <add> <add>The specific example here is drawn from https://github.com/explosion/spaCy/issues/2627 <add>Other versions of the model may not make the original mistake, so the specific <add>example might not be apt for future versions. <add>''' <add>import plac <add>import spacy <add> <add>def prevent_sentence_boundaries(doc): <add> for token in doc: <add> if not can_be_sentence_start(token): <add> token.is_sent_start = False <add> return doc <add> <add>def can_be_sentence_start(token): <add> if token.i == 0: <add> return True <add> elif token.is_title: <add> return True <add> elif token.nbor(-1).is_punct: <add> return True <add> elif token.nbor(-1).is_space: <add> return True <add> else: <add> return False <add> <add>def main(): <add> nlp = spacy.load('en_core_web_lg') <add> raw_text = "Been here and I'm loving it." <add> doc = nlp(raw_text) <add> sentences = [sent.string.strip() for sent in doc.sents] <add> print(sentences) <add> nlp.add_pipe(prevent_sentence_boundaries, before='parser') <add> doc = nlp(raw_text) <add> sentences = [sent.string.strip() for sent in doc.sents] <add> print(sentences) <add> <add> <add>if __name__ == '__main__': <add> plac.call(main)
1
Python
Python
set version to v2.2.0.dev5
f8ce9dde0fb07bdbcfa7699a91ad5cbe064e3fcd
<ide><path>spacy/about.py <ide> # fmt: off <ide> <ide> __title__ = "spacy" <del>__version__ = "2.2.0.dev4" <add>__version__ = "2.2.0.dev5" <ide> __summary__ = "Industrial-strength Natural Language Processing (NLP) with Python and Cython" <ide> __uri__ = "https://spacy.io" <ide> __author__ = "Explosion AI"
1
Java
Java
add suppress warning in settablelistenablefuture
bb4a9cca1bfa5d5e887b98ec13d4a9f553dace06
<ide><path>spring-core/src/main/java/org/springframework/util/concurrent/SettableListenableFuture.java <ide> public boolean set(T value) { <ide> */ <ide> public boolean setException(Throwable exception) { <ide> Assert.notNull(exception, "'exception' must not be null"); <del> boolean success = this.settableTask.setValue(exception); <add> boolean success = this.settableTask.setException(exception); <ide> if (success) { <ide> this.listenableFuture.run(); <ide> } <ide> protected void interruptTask() { <ide> private volatile boolean cancelled = false; <ide> <ide> <del> public boolean setValue(Object value) { <add> public boolean setValue(T value) { <ide> if (this.cancelled) { <ide> return false; <ide> } <ide> return this.value.compareAndSet(NO_VALUE, value); <ide> } <ide> <add> public boolean setException(Throwable exception) { <add> if (this.cancelled) { <add> return false; <add> } <add> return this.value.compareAndSet(NO_VALUE, exception); <add> } <add> <ide> public void setCancelled() { <ide> this.cancelled = true; <ide> } <ide> <add> @SuppressWarnings("unchecked") <ide> @Override <ide> public T call() throws Exception { <ide> if (value.get() instanceof Exception) {
1
PHP
PHP
fix contextual var docblock
02d41da1a8013b98d69a7295f239d5f180a6ad4e
<ide><path>src/Illuminate/Container/ContextualBindingBuilder.php <ide> class ContextualBindingBuilder implements ContextualBindingBuilderContract <ide> /** <ide> * The concrete instance. <ide> * <del> * @var string <add> * @var string|array <ide> */ <ide> protected $concrete; <ide>
1
Python
Python
prevent traceback chaining in _wrapfunc
352b7871a072a51f32bcb6bc1541cabbc447d5c4
<ide><path>numpy/core/fromnumeric.py <ide> def _wrapit(obj, method, *args, **kwds): <ide> <ide> <ide> def _wrapfunc(obj, method, *args, **kwds): <del> try: <del> return getattr(obj, method)(*args, **kwds) <del> <del> # An AttributeError occurs if the object does not have <del> # such a method in its class. <add> bound = getattr(obj, method, None) <add> if bound is None: <add> return _wrapit(obj, method, *args, **kwds) <ide> <del> # A TypeError occurs if the object does have such a method <del> # in its class, but its signature is not identical to that <del> # of NumPy's. This situation has occurred in the case of <del> # a downstream library like 'pandas'. <del> except (AttributeError, TypeError): <add> try: <add> return bound(*args, **kwds) <add> except TypeError: <add> # A TypeError occurs if the object does have such a method in its <add> # class, but its signature is not identical to that of NumPy's. This <add> # situation has occurred in the case of a downstream library like <add> # 'pandas'. <add> # <add> # Call _wrapit from within the except clause to ensure a potential <add> # exception has a traceback chain. <ide> return _wrapit(obj, method, *args, **kwds) <ide> <ide>
1
Ruby
Ruby
add spec for nested directories
85f76e312a6171dceab69b1163dede2f903092fa
<ide><path>Library/Homebrew/test/unpack_strategy_spec.rb <ide> <ide> describe UnpackStrategy do <ide> describe "#extract_nestedly" do <del> let(:file_name) { "file" } <del> let(:nested_archive) { <del> dir = mktmpdir <add> subject(:strategy) { described_class.detect(path) } <ide> <del> (dir/"file").write "This file was inside a GZIP inside a BZIP2." <del> system "gzip", dir.children.first <del> system "bzip2", dir.children.first <del> <del> dir.children.first <del> } <ide> let(:unpack_dir) { mktmpdir } <del> subject(:strategy) { described_class.detect(nested_archive) } <ide> <del> it "can extract nested archives" do <del> strategy.extract_nestedly(to: unpack_dir) <add> context "when extracting a GZIP nested in a BZIP2" do <add> let(:file_name) { "file" } <add> let(:path) { <add> dir = mktmpdir <add> <add> (dir/"file").write "This file was inside a GZIP inside a BZIP2." <add> system "gzip", dir.children.first <add> system "bzip2", dir.children.first <add> <add> dir.children.first <add> } <add> <add> it "can extract nested archives" do <add> strategy.extract_nestedly(to: unpack_dir) <ide> <del> expect(File.read(unpack_dir/file_name)).to eq("This file was inside a GZIP inside a BZIP2.") <add> expect(File.read(unpack_dir/file_name)).to eq("This file was inside a GZIP inside a BZIP2.") <add> end <add> end <add> <add> context "when extracting a directory with nested directories" do <add> let(:directories) { "A/B/C" } <add> let(:path) { <add> (mktmpdir/"file.tar").tap do |path| <add> mktmpdir do |dir| <add> (dir/directories).mkpath <add> system "tar", "-c", "-f", path, "-C", dir, "A/" <add> end <add> end <add> } <add> <add> it "does not recurse into nested directories" do <add> strategy.extract_nestedly(to: unpack_dir) <add> expect(Pathname.glob(unpack_dir/"**/*")).to include unpack_dir/directories <add> end <ide> end <ide> end <ide> end
1
Ruby
Ruby
allocate new responses rather than recycling them
2b5d309aeb68e9d30d6e090a9c603efe780e50c7
<ide><path>actionpack/lib/action_controller/test_case.rb <ide> def default_env <ide> end <ide> <ide> class TestResponse < ActionDispatch::TestResponse <del> def recycle! <del> initialize <del> end <ide> end <ide> <ide> class LiveTestResponse < Live::Response <del> def recycle! <del> @body = nil <del> initialize <del> end <del> <ide> def body <ide> @body ||= super <ide> end <ide> def process(action, *args) <ide> @request.env['action_dispatch.cookies'] = nil <ide> <ide> @request.recycle! <del> @response.recycle! <add> @response = build_response @response_klass <add> @response.request = @request <ide> @controller.recycle! <ide> <ide> @request.env['REQUEST_METHOD'] = http_method <ide> def process(action, *args) <ide> def setup_controller_request_and_response <ide> @controller = nil unless defined? @controller <ide> <del> response_klass = TestResponse <add> @response_klass = TestResponse <ide> <ide> if klass = self.class.controller_class <ide> if klass < ActionController::Live <del> response_klass = LiveTestResponse <add> @response_klass = LiveTestResponse <ide> end <ide> unless @controller <ide> begin <ide> def setup_controller_request_and_response <ide> <ide> @request = build_request <ide> @request.env["rack.request.cookie_hash"] = {}.with_indifferent_access <del> @response = build_response response_klass <add> @response = build_response @response_klass <ide> @response.request = @request <ide> <ide> if @controller
1
Javascript
Javascript
improve `event` compatibility
3f7f62f6bc1e1d449137a42801fd89608237c677
<ide><path>lib/internal/event_target.js <ide> class Event { <ide> * composed?: boolean, <ide> * }} [options] <ide> */ <del> constructor(type, options = null) { <add> constructor(type, options = kEmptyObject) { <ide> if (arguments.length === 0) <ide> throw new ERR_MISSING_ARGS('type'); <del> validateObject(options, 'options', { <del> allowArray: true, allowFunction: true, nullable: true, <del> }); <del> const { cancelable, bubbles, composed } = { ...options }; <add> validateObject(options, 'options'); <add> const { bubbles, cancelable, composed } = options; <ide> this.#cancelable = !!cancelable; <ide> this.#bubbles = !!bubbles; <ide> this.#composed = !!composed; <ide><path>test/parallel/test-whatwg-events-event-constructors.js <add>'use strict'; <add> <add>require('../common'); <add>const { test, assert_equals, assert_array_equals } = <add> require('../common/wpt').harness; <add> <add>// Source: https://github.com/web-platform-tests/wpt/blob/6cef1d2087d6a07d7cc6cee8cf207eec92e27c5f/dom/events/Event-constructors.any.js#L91-L112 <add>test(function() { <add> const called = []; <add> const ev = new Event('Xx', { <add> get cancelable() { <add> called.push('cancelable'); <add> return false; <add> }, <add> get bubbles() { <add> called.push('bubbles'); <add> return true; <add> }, <add> get sweet() { <add> called.push('sweet'); <add> return 'x'; <add> }, <add> }); <add> assert_array_equals(called, ['bubbles', 'cancelable']); <add> assert_equals(ev.type, 'Xx'); <add> assert_equals(ev.bubbles, true); <add> assert_equals(ev.cancelable, false); <add> assert_equals(ev.sweet, undefined); <add>});
2
Python
Python
fix conv2d behavior with dim_ordering='tf'
7401f47da4d438927b982c3dcecf07313c05ffd7
<ide><path>keras/layers/convolutional.py <ide> def get_output(self, train=False): <ide> dim_ordering=self.dim_ordering, <ide> image_shape=self.input_shape, <ide> filter_shape=self.W_shape) <del> <del> output = conv_out + K.reshape(self.b, (1, self.nb_filter, 1, 1)) <add> if self.dim_ordering == 'th': <add> output = conv_out + K.reshape(self.b, (1, self.nb_filter, 1, 1)) <add> elif self.dim_ordering == 'tf': <add> output = conv_out + K.reshape(self.b, (1, 1, 1, self.nb_filter)) <add> else: <add> raise Exception('Invalid dim_ordering: ' + self.dim_ordering) <ide> output = self.activation(output) <ide> return output <ide>
1
Java
Java
apply value formatting to resolved exceptions
e8f6cd10a543d4f03da8e8a9750091ec9291e703
<ide><path>spring-core/src/main/java/org/springframework/core/log/LogFormatUtils.java <ide> public abstract class LogFormatUtils { <ide> * @return the formatted value <ide> */ <ide> public static String formatValue(@Nullable Object value, boolean limitLength) { <del> return formatValue(value, 100, limitLength); <add> return formatValue(value, (limitLength ? 100 : -1), limitLength); <ide> } <ide> <ide> /** <ide><path>spring-web/src/main/java/org/springframework/web/server/handler/ResponseStatusExceptionHandler.java <ide> import org.apache.commons.logging.LogFactory; <ide> import reactor.core.publisher.Mono; <ide> <add>import org.springframework.core.log.LogFormatUtils; <ide> import org.springframework.http.HttpStatus; <ide> import org.springframework.http.server.reactive.ServerHttpRequest; <ide> import org.springframework.http.server.reactive.ServerHttpResponse; <ide> else if (logger.isDebugEnabled()) { <ide> <ide> <ide> private String formatError(Throwable ex, ServerHttpRequest request) { <del> String reason = ex.getClass().getSimpleName() + ": " + ex.getMessage(); <add> String className = ex.getClass().getSimpleName(); <add> String message = LogFormatUtils.formatValue(ex.getMessage(), -1, true); <ide> String path = request.getURI().getRawPath(); <del> return "Resolved [" + reason + "] for HTTP " + request.getMethod() + " " + path; <add> return "Resolved [" + className + ": " + message + "] for HTTP " + request.getMethod() + " " + path; <ide> } <ide> <ide> private boolean updateResponse(ServerHttpResponse response, Throwable ex) { <ide><path>spring-webmvc/src/main/java/org/springframework/web/servlet/handler/AbstractHandlerExceptionResolver.java <ide> /* <del> * Copyright 2002-2020 the original author or authors. <add> * Copyright 2002-2021 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> import org.apache.commons.logging.LogFactory; <ide> <ide> import org.springframework.core.Ordered; <add>import org.springframework.core.log.LogFormatUtils; <ide> import org.springframework.lang.Nullable; <ide> import org.springframework.util.StringUtils; <ide> import org.springframework.web.servlet.HandlerExceptionResolver; <ide> public ModelAndView resolveException( <ide> if (result != null) { <ide> // Print debug message when warn logger is not enabled. <ide> if (logger.isDebugEnabled() && (this.warnLogger == null || !this.warnLogger.isWarnEnabled())) { <del> logger.debug("Resolved [" + ex + "]" + (result.isEmpty() ? "" : " to " + result)); <add> logger.debug(buildLogMessage(ex, request) + (result.isEmpty() ? "" : " to " + result)); <ide> } <ide> // Explicitly configured warn logger in logException method. <ide> logException(ex, request); <ide> protected void logException(Exception ex, HttpServletRequest request) { <ide> * @return the log message to use <ide> */ <ide> protected String buildLogMessage(Exception ex, HttpServletRequest request) { <del> return "Resolved [" + ex + "]"; <add> return "Resolved [" + LogFormatUtils.formatValue(ex, -1, true) + "]"; <ide> } <ide> <ide> /**
3
Text
Text
clarify endpoint definition in documentation
95f63361577e6309671cd0e4e21953ac130a1abe
<ide><path>libnetwork/docs/design.md <ide> A Sandbox may contain *many* endpoints from *multiple* networks. <ide> <ide> An Endpoint joins a Sandbox to a Network. <ide> An implementation of an Endpoint could be a `veth` pair, an Open vSwitch internal port or similar. <del>An Endpoint can belong to *only one* network and *one* Sandbox. <add>An Endpoint can belong to only one network and it can belong to only one Sandbox, if connected. <ide> <ide> **Network** <ide>
1
Javascript
Javascript
remove vestigial code left over from 9afcb3e
b79623463e2da7155327136e487ace3612dc6c2a
<ide><path>packages/ember-handlebars/lib/helpers/binding.js <ide> EmberHandlebars.bindClasses = function(context, classBindings, view, bindAttrId, <ide> // If value is a Boolean and true, return the dasherized property <ide> // name. <ide> } else if (val === true) { <del> if (className) { return className; } <del> <ide> // Normalize property path to be suitable for use <ide> // as a class name. For exaple, content.foo.barBaz <ide> // becomes bar-baz. <ide><path>packages/ember-views/lib/views/view.js <ide> Ember.View = Ember.Object.extend(Ember.Evented, <ide> <ide> // If value is a Boolean and true, return the dasherized property <ide> // name. <del> } else if (val === true) { <del> if (className) { return className; } <del> <add> } else if (val === true) { <ide> // Normalize property path to be suitable for use <ide> // as a class name. For exaple, content.foo.barBaz <ide> // becomes bar-baz.
2
Text
Text
remove erronous html in example. closes
0fe0a91aed0c479fed29c8123a6ba63de6575eaf
<ide><path>docs/topics/3.6-announcement.md <ide> Here's a brief example that demonstrates: <ide> <html> <ide> <head> <ide> <script src="/static/rest_framework/js/coreapi-0.1.0.js"></script> <del> <script src="/docs/schema.js' %}"></script> <add> <script src="/docs/schema.js"></script> <ide> <script> <ide> const coreapi = window.coreapi <ide> const schema = window.schema
1
Text
Text
remove the extra comma in association_basics.md
3910002deaec89e9af73f37a963eef719e7e0f5d
<ide><path>guides/source/association_basics.md <ide> The `limit` method lets you restrict the total number of objects that will be fe <ide> class Author < ApplicationRecord <ide> has_many :recent_books, <ide> -> { order('published_at desc').limit(100) }, <del> class_name: "Book", <add> class_name: "Book" <ide> end <ide> ``` <ide>
1
Text
Text
fix broken link for macos
3f3832174e347e4335f6b32c614feeb0d82cccd9
<ide><path>README.md <ide> repeat these steps to upgrade to future releases. <ide> ## Building <ide> <ide> * [Linux](./docs/build-instructions/linux.md) <del>* [macOS](./docs/build-instructions/macos.md) <add>* [macOS](./docs/build-instructions/macOS.md) <ide> * [FreeBSD](./docs/build-instructions/freebsd.md) <ide> * [Windows](./docs/build-instructions/windows.md) <ide>
1
Text
Text
add a note about the abi flag as well
d6b78425a982ec41370cc2125bfd919ace21d162
<ide><path>street/README.md <ide> TF_INC=$(python -c 'import tensorflow as tf; print(tf.sysconfig.get_include())') <ide> g++ -std=c++11 -shared rnn_ops.cc -o rnn_ops.so -fPIC -I $TF_INC -O3 -mavx <ide> ``` <ide> <del>(Note: if running on Mac, add `-undefined dynamic_lookup` to the end of your <del>`g++` command.) <add>(Note: if running on Mac, add `-undefined dynamic_lookup` to your `g++` command. <add>If you are running a newer version of gcc, you may also need to add <add>`-D_GLIBCXX_USE_CXX11_ABI=0`.) <ide> <ide> Run the unittests: <ide>
1
Python
Python
add test for boolean indexing and boolean ufunc
5dea4ca1d3c6185a530e40a6ea7099e3eb3fd46c
<ide><path>numpy/core/tests/test_ufunc.py <ide> def test_inplace_fancy_indexing(self): <ide> np.power.at(a, [1,2,3,2], 3.5) <ide> assert_equal(a, [0, 1, 4414, 46, 4, 5, 6, 7, 8, 9]) <ide> <add> # Test boolean indexing and boolean ufuncs <add> a = np.arange(10) <add> index = a % 2 == 0 <add> np.equal.at(a, index, [0, 2, 4, 6, 8]) <add> assert_equal(a, [1, 1, 1, 3, 1, 5, 1, 7, 1, 9]) <ide> <ide> if __name__ == "__main__": <ide> run_module_suite()
1
Ruby
Ruby
check virtualenv and setuptools resource
346d68eb04013d2322796ed1a0edd7de007a156d
<ide><path>Library/Homebrew/dev-cmd/audit.rb <ide> def audit_text <ide> problem "Formulae should not depend on both OpenSSL and LibreSSL (even optionally)." <ide> end <ide> <add> if text =~ /virtualenv_(create|install_with_resources)/ && <add> text =~ /resource\s+['"]setuptools['"]\s+do/ <add> problem "Formulae using virtualenvs do not need a `setuptools` resource." <add> end <add> <ide> return unless text.include?('require "language/go"') && !text.include?("go_resource") <ide> problem "require \"language/go\" is unnecessary unless using `go_resource`s" <ide> end
1
Java
Java
reject user names with "%2f" in stomp
30d68f2de78ef70ebcb02c2d40c85587f384f618
<ide><path>spring-messaging/src/main/java/org/springframework/messaging/simp/SimpMessagingTemplate.java <ide> /* <del> * Copyright 2002-2018 the original author or authors. <add> * Copyright 2002-2019 the original author or authors. <ide> * <ide> * Licensed under the Apache License, Version 2.0 (the "License"); <ide> * you may not use this file except in compliance with the License. <ide> public void convertAndSendToUser(String user, String destination, Object payload <ide> throws MessagingException { <ide> <ide> Assert.notNull(user, "User must not be null"); <add> Assert.isTrue(!user.contains("%2F"), "Invalid sequence \"%2F\" in user name: " + user); <ide> user = StringUtils.replace(user, "/", "%2F"); <ide> destination = destination.startsWith("/") ? destination : "/" + destination; <ide> super.convertAndSend(this.destinationPrefix + user + destination, payload, headers, postProcessor); <ide><path>spring-messaging/src/main/java/org/springframework/messaging/simp/user/DefaultUserDestinationResolver.java <ide> /* <del> * Copyright 2002-2018 the original author or authors. <add> * Copyright 2002-2019 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> private ParseResult parseSubscriptionMessage(Message<?> message, String sourceDe <ide> } <ide> Principal principal = SimpMessageHeaderAccessor.getUser(headers); <ide> String user = (principal != null ? principal.getName() : null); <add> Assert.isTrue(user == null || !user.contains("%2F"), "Invalid sequence \"%2F\" in user name: " + user); <ide> Set<String> sessionIds = Collections.singleton(sessionId); <ide> return new ParseResult(sourceDestination, actualDestination, sourceDestination, sessionIds, user); <ide> } <ide><path>spring-messaging/src/test/java/org/springframework/messaging/simp/SimpMessagingTemplateTests.java <ide> import org.springframework.util.LinkedMultiValueMap; <ide> <ide> import static org.assertj.core.api.Assertions.assertThat; <add>import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; <ide> <ide> /** <ide> * Unit tests for {@link org.springframework.messaging.simp.SimpMessagingTemplate}. <ide> public void convertAndSendToUserWithEncoding() { <ide> assertThat(headerAccessor.getDestination()).isEqualTo("/user/https:%2F%2Fjoe.openid.example.org%2F/queue/foo"); <ide> } <ide> <add> @Test // gh-23836 <add> public void convertAndSendToUserWithInvalidSequence() { <add> assertThatIllegalArgumentException().isThrownBy(() -> <add> this.messagingTemplate.convertAndSendToUser("joe%2F", "/queue/foo", "data")); <add> } <add> <ide> @Test <ide> public void convertAndSendWithCustomHeader() { <ide> Map<String, Object> headers = Collections.<String, Object>singletonMap("key", "value"); <ide><path>spring-messaging/src/test/java/org/springframework/messaging/simp/user/DefaultUserDestinationResolverTests.java <ide> import org.springframework.util.StringUtils; <ide> <ide> import static org.assertj.core.api.Assertions.assertThat; <add>import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; <ide> import static org.mockito.BDDMockito.given; <ide> import static org.mockito.Mockito.mock; <ide> <ide> public void handleSubscribeNoUser() { <ide> assertThat(actual.getUser()).isNull(); <ide> } <ide> <add> @Test // gh-23836 <add> public void handleSubscribeInvalidUserName() { <add> TestPrincipal user = new TestPrincipal("joe%2F"); <add> String sourceDestination = "/user/queue/foo"; <add> <add> Message<?> message = createMessage(SimpMessageType.SUBSCRIBE, user, "123", sourceDestination); <add> assertThatIllegalArgumentException().isThrownBy(() -> this.resolver.resolveDestination(message)); <add> } <add> <ide> @Test <ide> public void handleUnsubscribe() { <ide> TestPrincipal user = new TestPrincipal("joe");
4
PHP
PHP
fix typo in variable description
ba9fc949779fdae78266b5dfba2d46a2f6c401f8
<ide><path>cake/libs/validation.php <ide> class Validation extends Object { <ide> <ide> /** <del> * Set the the value of methods $check param. <add> * Set the value of methods $check param. <ide> * <ide> * @var string <ide> * @access public
1
Javascript
Javascript
fix datepickerandroid flow errors
0b1f74712f6c912635702e23604bfcca2e538c9d
<ide><path>Libraries/Components/DatePickerAndroid/DatePickerAndroid.android.js <ide> 'use strict'; <ide> <ide> const DatePickerModule = require('NativeModules').DatePickerAndroid; <del> <del>type Options = $ReadOnly<{| <del> date?: ?(Date | number), <del> minDate?: ?(Date | number), <del> maxDate?: ?(Date | number), <del> mode?: ?('calender' | 'spinner' | 'default'), <del>|}>; <del> <del>type DatePickerOpenAction = <del> | {| <del> action: 'dateSetAction', <del> year: number, <del> month: number, <del> day: number, <del> |} <del> | {| <del> action: 'dismissedAction', <del> year: typeof undefined, <del> month: typeof undefined, <del> day: typeof undefined, <del> |}; <add>import type {Options, DatePickerOpenAction} from 'DatePickerAndroidTypes'; <ide> <ide> /** <ide> * Convert a Date to a timestamp. <ide> class DatePickerAndroid { <ide> * Note the native date picker dialog has some UI glitches on Android 4 and lower <ide> * when using the `minDate` and `maxDate` options. <ide> */ <del> static async open(options: Options): Promise<DatePickerOpenAction> { <add> static async open(options: ?Options): Promise<DatePickerOpenAction> { <ide> const optionsMs = options; <del> if (optionsMs) { <del> _toMillis(options, 'date'); <del> _toMillis(options, 'minDate'); <del> _toMillis(options, 'maxDate'); <add> if (optionsMs != null) { <add> _toMillis(optionsMs, 'date'); <add> _toMillis(optionsMs, 'minDate'); <add> _toMillis(optionsMs, 'maxDate'); <ide> } <ide> return DatePickerModule.open(options); <ide> } <ide> <ide> /** <ide> * A date has been selected. <ide> */ <del> static dateSetAction = 'dateSetAction'; <add> static +dateSetAction: 'dateSetAction' = 'dateSetAction'; <ide> /** <ide> * The dialog has been dismissed. <ide> */ <del> static dismissedAction = 'dismissedAction'; <add> static +dismissedAction: 'dismissedAction' = 'dismissedAction'; <ide> } <ide> <ide> module.exports = DatePickerAndroid; <ide><path>Libraries/Components/DatePickerAndroid/DatePickerAndroid.ios.js <ide> <ide> 'use strict'; <ide> <del>type Options = $ReadOnly<{| <del> date?: ?(Date | number), <del> minDate?: ?(Date | number), <del> maxDate?: ?(Date | number), <del> mode?: ?('calender' | 'spinner' | 'default'), <del>|}>; <add>import type {Options, DatePickerOpenAction} from 'DatePickerAndroidTypes'; <ide> <del>const DatePickerAndroid = { <del> async open(options: Options): Promise<void> { <del> return Promise.reject({ <del> message: 'DatePickerAndroid is not supported on this platform.', <del> }); <del> }, <del>}; <add>class DatePickerAndroid { <add> static async open(options: ?Options): Promise<DatePickerOpenAction> { <add> throw new Error('DatePickerAndroid is not supported on this platform.'); <add> } <add> <add> /** <add> * A date has been selected. <add> */ <add> static +dateSetAction: 'dateSetAction' = 'dateSetAction'; <add> /** <add> * The dialog has been dismissed. <add> */ <add> static +dismissedAction: 'dismissedAction' = 'dismissedAction'; <add>} <ide> <ide> module.exports = DatePickerAndroid; <ide><path>Libraries/Components/DatePickerAndroid/DatePickerAndroidTypes.js <add>/** <add> * Copyright (c) Facebook, Inc. and its affiliates. <add> * <add> * This source code is licensed under the MIT license found in the <add> * LICENSE file in the root directory of this source tree. <add> * <add> * @format <add> * @flow strict-local <add> */ <add> <add>export type Options = $ReadOnly<{| <add> date?: ?(Date | number), <add> minDate?: ?(Date | number), <add> maxDate?: ?(Date | number), <add> mode?: ?('calender' | 'spinner' | 'default'), <add>|}>; <add> <add>export type DatePickerOpenAction = <add> | {| <add> action: 'dateSetAction', <add> year: number, <add> month: number, <add> day: number, <add> |} <add> | {| <add> action: 'dismissedAction', <add> year: void, <add> month: void, <add> day: void, <add> |};
3
Javascript
Javascript
remove var in libraries/vendor/core/merge.js
3f069f333477de3b42fd222e43bd66adf23a8e5d
<ide><path>Libraries/vendor/core/merge.js <ide> <ide> "use strict"; <ide> <del>var mergeInto = require('mergeInto'); <add>const mergeInto = require('mergeInto'); <ide> <ide> /** <ide> * Shallow merges two structures into a return value, without mutating either. <ide> var mergeInto = require('mergeInto'); <ide> * @param {?object} two Optional object with properties to merge from. <ide> * @return {object} The shallow extension of one by two. <ide> */ <del>var merge = function(one, two) { <del> var result = {}; <add>const merge = function(one, two) { <add> const result = {}; <ide> mergeInto(result, one); <ide> mergeInto(result, two); <ide> return result;
1
Mixed
Text
add mounts to docker ps
bd4fb00fb6241d35537b460a2d9f48256111ae7a
<ide><path>api/client/formatter/custom.go <ide> const ( <ide> repositoryHeader = "REPOSITORY" <ide> tagHeader = "TAG" <ide> digestHeader = "DIGEST" <add> mountsHeader = "MOUNTS" <ide> ) <ide> <ide> type containerContext struct { <ide> func (c *containerContext) Label(name string) string { <ide> return c.c.Labels[name] <ide> } <ide> <add>func (c *containerContext) Mounts() string { <add> c.addHeader(mountsHeader) <add> <add> var mounts []string <add> for _, m := range c.c.Mounts { <add> name := m.Name <add> if c.trunc { <add> name = stringutils.Truncate(name, 15) <add> } <add> mounts = append(mounts, name) <add> } <add> return strings.Join(mounts, ",") <add>} <add> <ide> type imageContext struct { <ide> baseSubContext <ide> trunc bool <ide><path>daemon/list.go <ide> import ( <ide> "github.com/Sirupsen/logrus" <ide> "github.com/docker/docker/container" <ide> "github.com/docker/docker/image" <add> "github.com/docker/docker/volume" <ide> "github.com/docker/engine-api/types" <ide> "github.com/docker/engine-api/types/filters" <ide> networktypes "github.com/docker/engine-api/types/network" <ide> func includeContainerInList(container *container.Container, ctx *listContext) it <ide> return excludeContainer <ide> } <ide> <add> if ctx.filters.Include("volume") { <add> volumesByName := make(map[string]*volume.MountPoint) <add> for _, m := range container.MountPoints { <add> volumesByName[m.Name] = m <add> } <add> <add> volumeExist := fmt.Errorf("volume mounted in container") <add> err := ctx.filters.WalkValues("volume", func(value string) error { <add> if _, exist := container.MountPoints[value]; exist { <add> return volumeExist <add> } <add> if _, exist := volumesByName[value]; exist { <add> return volumeExist <add> } <add> return nil <add> }) <add> if err != volumeExist { <add> return excludeContainer <add> } <add> } <add> <ide> if ctx.ancestorFilter { <ide> if len(ctx.images) == 0 { <ide> return excludeContainer <ide> func (daemon *Daemon) transformContainer(container *container.Container, ctx *li <ide> newC.SizeRootFs = sizeRootFs <ide> } <ide> newC.Labels = container.Config.Labels <add> newC.Mounts = addMountPoints(container) <ide> <ide> return newC, nil <ide> } <ide><path>docs/reference/api/docker_remote_api.md <ide> This section lists each version from latest to oldest. Each listing includes a <ide> [Docker Remote API v1.23](docker_remote_api_v1.23.md) documentation <ide> <ide> * `GET /containers/json` returns the state of the container, one of `created`, `restarting`, `running`, `paused`, `exited` or `dead`. <add>* `GET /containers/json` returns the mount points for the container. <ide> * `GET /networks/(name)` now returns an `Internal` field showing whether the network is internal or not. <ide> <ide> <ide><path>docs/reference/api/docker_remote_api_v1.23.md <ide> List containers <ide> "MacAddress": "02:42:ac:11:00:02" <ide> } <ide> } <del> } <add> }, <add> "Mounts": [ <add> { <add> "Name": "fac362...80535", <add> "Source": "/data", <add> "Destination": "/data", <add> "Driver": "local", <add> "Mode": "ro,Z", <add> "RW": false, <add> "Propagation": "" <add> } <add> ] <ide> }, <ide> { <ide> "Id": "9cd87474be90", <ide> List containers <ide> "MacAddress": "02:42:ac:11:00:08" <ide> } <ide> } <del> } <del> <add> }, <add> "Mounts": [] <ide> }, <ide> { <ide> "Id": "3176a2479c92", <ide> List containers <ide> "MacAddress": "02:42:ac:11:00:06" <ide> } <ide> } <del> } <del> <add> }, <add> "Mounts": [] <ide> }, <ide> { <ide> "Id": "4cb07b47f9fb", <ide> List containers <ide> "MacAddress": "02:42:ac:11:00:05" <ide> } <ide> } <del> } <del> <add> }, <add> "Mounts": [] <ide> } <ide> ] <ide> <ide> Query Parameters: <ide> - `status=`(`created`|`restarting`|`running`|`paused`|`exited`|`dead`) <ide> - `label=key` or `label="key=value"` of a container label <ide> - `isolation=`(`default`|`process`|`hyperv`) (Windows daemon only) <add> - `ancestor`=(`<image-name>[:<tag>]`, `<image id>` or `<image@digest>`) <add> - `before`=(`<container id>` or `<container name>`) <add> - `since`=(`<container id>` or `<container name>`) <add> - `volume`=(`<volume name>` or `<mount point destination>`) <ide> <ide> Status Codes: <ide> <ide><path>docs/reference/commandline/ps.md <ide> The currently supported filters are: <ide> * before (container's id or name) - filters containers created before given id or name <ide> * since (container's id or name) - filters containers created since given id or name <ide> * isolation (default|process|hyperv) (Windows daemon only) <add>* volume (volume name or mount point) - filters containers that mount volumes. <ide> <ide> <ide> #### Label <ide> with the same containers as in `before` filter: <ide> 9c3527ed70ce busybox "top" 10 minutes ago Up 10 minutes desperate_dubinsky <ide> 4aace5031105 busybox "top" 10 minutes ago Up 10 minutes focused_hamilton <ide> <add>#### Volume <add> <add>The `volume` filter shows only containers that mount a specific volume or have a volume mounted in a specific path: <add> <add> $ docker ps --filter volume=remote-volume --format "table {{.ID}}\t{{.Mounts}}" <add> CONTAINER ID MOUNTS <add> 9c3527ed70ce remote-volume <add> <add> $ docker ps --filter volume=/data --format "table {{.ID}}\t{{.Mounts}}" <add> CONTAINER ID MOUNTS <add> 9c3527ed70ce remote-volume <add> <ide> <ide> ## Formatting <ide> <ide> Placeholder | Description <ide> `.Names` | Container names. <ide> `.Labels` | All labels assigned to the container. <ide> `.Label` | Value of a specific label for this container. For example `{{.Label "com.docker.swarm.cpu"}}` <add>`.Mounts` | Names of the volumes mounted in this container. <ide> <ide> When using the `--format` option, the `ps` command will either output the data exactly as the template <ide> declares or, when using the `table` directive, will include column headers as well. <ide><path>integration-cli/docker_cli_ps_test.go <ide> func (s *DockerSuite) TestPsNotShowPortsOfStoppedContainer(c *check.C) { <ide> fields = strings.Fields(lines[1]) <ide> c.Assert(fields[len(fields)-2], checker.Not(checker.Equals), expected, check.Commentf("Should not got %v", expected)) <ide> } <add> <add>func (s *DockerSuite) TestPsShowMounts(c *check.C) { <add> prefix, slash := getPrefixAndSlashFromDaemonPlatform() <add> <add> mp := prefix + slash + "test" <add> <add> dockerCmd(c, "volume", "create", "--name", "ps-volume-test") <add> runSleepingContainer(c, "--name=volume-test-1", "--volume", "ps-volume-test:"+mp) <add> c.Assert(waitRun("volume-test-1"), checker.IsNil) <add> runSleepingContainer(c, "--name=volume-test-2", "--volume", mp) <add> c.Assert(waitRun("volume-test-2"), checker.IsNil) <add> <add> out, _ := dockerCmd(c, "ps", "--format", "{{.Names}} {{.Mounts}}") <add> <add> lines := strings.Split(strings.TrimSpace(string(out)), "\n") <add> c.Assert(lines, checker.HasLen, 2) <add> <add> fields := strings.Fields(lines[0]) <add> c.Assert(fields, checker.HasLen, 2) <add> <add> annonymounsVolumeID := fields[1] <add> <add> fields = strings.Fields(lines[1]) <add> c.Assert(fields[1], checker.Equals, "ps-volume-test") <add> <add> // filter by volume name <add> out, _ = dockerCmd(c, "ps", "--format", "{{.Names}} {{.Mounts}}", "--filter", "volume=ps-volume-test") <add> <add> lines = strings.Split(strings.TrimSpace(string(out)), "\n") <add> c.Assert(lines, checker.HasLen, 1) <add> <add> fields = strings.Fields(lines[0]) <add> c.Assert(fields[1], checker.Equals, "ps-volume-test") <add> <add> // empty results filtering by unknown volume <add> out, _ = dockerCmd(c, "ps", "--format", "{{.Names}} {{.Mounts}}", "--filter", "volume=this-volume-should-not-exist") <add> c.Assert(strings.TrimSpace(string(out)), checker.HasLen, 0) <add> <add> // filter by mount destination <add> out, _ = dockerCmd(c, "ps", "--format", "{{.Names}} {{.Mounts}}", "--filter", "volume="+mp) <add> <add> lines = strings.Split(strings.TrimSpace(string(out)), "\n") <add> c.Assert(lines, checker.HasLen, 2) <add> <add> fields = strings.Fields(lines[0]) <add> c.Assert(fields[1], checker.Equals, annonymounsVolumeID) <add> fields = strings.Fields(lines[1]) <add> c.Assert(fields[1], checker.Equals, "ps-volume-test") <add> <add> // empty results filtering by unknown mount point <add> out, _ = dockerCmd(c, "ps", "--format", "{{.Names}} {{.Mounts}}", "--filter", "volume="+prefix+slash+"this-path-was-never-mounted") <add> c.Assert(strings.TrimSpace(string(out)), checker.HasLen, 0) <add>} <ide><path>man/docker-ps.1.md <ide> the running containers. <ide> - before=(<container-name>|<container-id>) <ide> - since=(<container-name>|<container-id>) <ide> - ancestor=(<image-name>[:tag]|<image-id>|<image@digest>) - containers created from an image or a descendant. <add> - volume=(<volume-name>|<mount-point-destination>) <ide> <ide> **--format**="*TEMPLATE*" <ide> Pretty-print containers using a Go template. <ide> the running containers. <ide> .Names - Container names. <ide> .Labels - All labels assigned to the container. <ide> .Label - Value of a specific label for this container. For example `{{.Label "com.docker.swarm.cpu"}}` <add> .Mounts - Names of the volumes mounted in this container. <ide> <ide> **--help** <ide> Print usage statement <ide> the running containers. <ide> c1d3b0166030 debian <ide> 41d50ecd2f57 fedora <ide> <add># Display containers with `remote-volume` mounted <add> <add> $ docker ps --filter volume=remote-volume --format "table {{.ID}}\t{{.Mounts}}" <add> CONTAINER ID MOUNTS <add> 9c3527ed70ce remote-volume <add> <add># Display containers with a volume mounted in `/data` <add> <add> $ docker ps --filter volume=/data --format "table {{.ID}}\t{{.Mounts}}" <add> CONTAINER ID MOUNTS <add> 9c3527ed70ce remote-volume <add> <ide> # HISTORY <ide> April 2014, Originally compiled by William Henry (whenry at redhat dot com) <ide> based on docker.com source material and internal work.
7
Text
Text
add note about removelistener order
b049d55cd882a9d3e8a2f5be69dd9fdb6623eab7
<ide><path>doc/api/events.md <ide> being removed. This will not impact the order in which listeners are called, <ide> but it means that any copies of the listener array as returned by <ide> the `emitter.listeners()` method will need to be recreated. <ide> <add>When a single function has been added as a handler multiple times for a single <add>event (as in the example below), `removeListener()` will remove the most <add>recently added instance. In the example the `once('ping')` <add>listener is removed: <add> <add>```js <add>const ee = new EventEmitter(); <add> <add>function pong() { <add> console.log('pong'); <add>} <add> <add>ee.on('ping', pong); <add>ee.once('ping', pong); <add>ee.removeListener('ping', pong); <add> <add>ee.emit('ping'); <add>ee.emit('ping'); <add>``` <add> <ide> Returns a reference to the `EventEmitter`, so that calls can be chained. <ide> <ide> ### emitter.setMaxListeners(n)
1
Mixed
Go
modify reponame to plugin and fix some typos
c394034f5978862b75770a036364f806bbcd8920
<ide><path>cli/command/plugin/create.go <ide> func newCreateCommand(dockerCli *command.DockerCli) *cobra.Command { <ide> options := pluginCreateOptions{} <ide> <ide> cmd := &cobra.Command{ <del> Use: "create [OPTIONS] reponame[:tag] PATH-TO-ROOTFS (rootfs + config.json)", <add> Use: "create [OPTIONS] PLUGIN[:tag] PATH-TO-ROOTFS(rootfs + config.json)", <ide> Short: "Create a plugin from a rootfs and config", <ide> Args: cli.RequiresMinArgs(2), <ide> RunE: func(cmd *cobra.Command, args []string) error { <ide><path>cli/command/plugin/push.go <ide> import ( <ide> <ide> func newPushCommand(dockerCli *command.DockerCli) *cobra.Command { <ide> cmd := &cobra.Command{ <del> Use: "push NAME[:TAG]", <add> Use: "push PLUGIN[:TAG]", <ide> Short: "Push a plugin to a registry", <ide> Args: cli.ExactArgs(1), <ide> RunE: func(cmd *cobra.Command, args []string) error { <ide><path>docs/reference/commandline/plugin_create.md <ide> keywords: "plugin, create" <ide> # plugin create <ide> <ide> ```markdown <del>Usage: docker plugin create [OPTIONS] reponame[:tag] PATH-TO-ROOTFS <add>Usage: docker plugin create [OPTIONS] PLUGIN[:tag] PATH-TO-ROOTFS(rootfs + config.json) <ide> <ide> Create a plugin from a rootfs and configuration <ide> <ide><path>docs/reference/commandline/plugin_push.md <ide> keywords: "plugin, push" <ide> --> <ide> <ide> ```markdown <del>Usage: docker plugin push NAME[:TAG] <add>Usage: docker plugin push PLUGIN[:TAG] <ide> <ide> Push a plugin to a registry <ide>
4
PHP
PHP
fix missing parameter in routing error
181d3b928c53cc87e63650bfbdbcfa016823c1df
<ide><path>src/Routing/RouteCollection.php <ide> public function match(array $url, array $context): string <ide> throw new MissingRouteException([ <ide> 'url' => $name, <ide> 'context' => $context, <del> 'message' => 'A named route was found for "%s", but matching failed.', <add> 'message' => "A named route was found for `{$name}`, but matching failed.", <ide> ]); <ide> } <ide> throw new MissingRouteException(['url' => $name, 'context' => $context]);
1
Python
Python
fix brightbox testing
d95474e097accb1d7482c8c8b60ee06f7d1441f0
<ide><path>libcloud/test/__init__.py <ide> def __init__(self, status, body=None, headers=None, reason=None): <ide> self.reason = reason or self.reason <ide> <ide> def read(self, *args, **kwargs): <del> return self.body.read(*args, **kwargs) <add> return self.body <ide> <ide> def next(self): <ide> if sys.version_info >= (2, 5) and sys.version_info <= (2, 6): <ide><path>libcloud/test/compute/test_brightbox.py <ide> class BrightboxTest(unittest.TestCase, TestCaseMixin): <ide> def setUp(self): <ide> BrightboxNodeDriver.connectionCls.conn_class = BrightboxMockHttp <ide> BrightboxMockHttp.type = None <add> BrightboxNodeDriver.connectionCls.token = 'test' <ide> self.driver = BrightboxNodeDriver(*BRIGHTBOX_PARAMS) <ide> <ide> def test_authentication(self): <ide> class BrightboxMockHttp(MockHttp): <ide> <ide> def _token(self, method, url, body, headers): <ide> if method == 'POST': <del> return self.response(httplib.OK, self.fixtures.load('token.json')) <add> return self.test_response(httplib.OK, self.fixtures.load('token.json')) <ide> <ide> def _token_INVALID_CLIENT(self, method, url, body, headers): <ide> if method == 'POST': <del> return self.response(httplib.BAD_REQUEST, '{"error":"invalid_client"}') <add> return self.test_response(httplib.BAD_REQUEST, '{"error":"invalid_client"}') <ide> <ide> def _token_UNAUTHORIZED_CLIENT(self, method, url, body, headers): <ide> if method == 'POST': <del> return self.response(httplib.UNAUTHORIZED, '{"error":"unauthorized_client"}') <add> return self.test_response(httplib.UNAUTHORIZED, '{"error":"unauthorized_client"}') <add> <add> def _1_0_servers_INVALID_CLIENT(self, method, url, body, headers): <add> return self.test_response(httplib.BAD_REQUEST, '{"error":"invalid_client"}') <add> <add> def _1_0_servers_UNAUTHORIZED_CLIENT(self, method, url, body, headers): <add> return self.test_response(httplib.UNAUTHORIZED, '{"error":"unauthorized_client"}') <ide> <ide> def _1_0_images(self, method, url, body, headers): <ide> if method == 'GET': <del> return self.response(httplib.OK, self.fixtures.load('list_images.json')) <add> return self.test_response(httplib.OK, self.fixtures.load('list_images.json')) <ide> <ide> def _1_0_servers(self, method, url, body, headers): <ide> if method == 'GET': <del> return self.response(httplib.OK, self.fixtures.load('list_servers.json')) <add> return self.test_response(httplib.OK, self.fixtures.load('list_servers.json')) <ide> elif method == 'POST': <ide> body = json.loads(body) <ide> encoded = base64.b64encode(b(USER_DATA)).decode('ascii') <ide> <ide> if 'user_data' in body and body['user_data'] != encoded: <ide> data = '{"error_name":"dodgy user data", "errors": ["User data not encoded properly"]}' <del> return self.response(httplib.BAD_REQUEST, data) <add> return self.test_response(httplib.BAD_REQUEST, data) <ide> if body.get('zone', '') == 'zon-remk1': <ide> node = json.loads( <ide> self.fixtures.load('create_server_gb1_b.json')) <ide> def _1_0_servers(self, method, url, body, headers): <ide> for x in body['server_groups']] <ide> if 'user_data' in body: <ide> node['user_data'] = body['user_data'] <del> return self.response(httplib.ACCEPTED, json.dumps(node)) <add> return self.test_response(httplib.ACCEPTED, json.dumps(node)) <ide> <ide> def _1_0_servers_srv_xvpn7(self, method, url, body, headers): <ide> if method == 'DELETE': <del> return self.response(httplib.ACCEPTED, '') <add> return self.test_response(httplib.ACCEPTED, '') <ide> <ide> def _1_0_server_types(self, method, url, body, headers): <ide> if method == 'GET': <del> return self.response(httplib.OK, self.fixtures.load('list_server_types.json')) <add> return self.test_response(httplib.OK, self.fixtures.load('list_server_types.json')) <ide> <ide> def _1_0_zones(self, method, url, body, headers): <ide> if method == 'GET': <ide> if headers['Host'] == 'api.gbt.brightbox.com': <del> return self.response(httplib.OK, "{}") <add> return self.test_response(httplib.OK, "{}") <ide> else: <del> return self.response(httplib.OK, self.fixtures.load('list_zones.json')) <add> return self.test_response(httplib.OK, self.fixtures.load('list_zones.json')) <ide> <ide> def _2_0_zones(self, method, url, body, headers): <ide> data = '{"error_name":"unrecognised_endpoint", "errors": ["The request was for an unrecognised API endpoint"]}' <del> return self.response(httplib.BAD_REQUEST, data) <add> return self.test_response(httplib.BAD_REQUEST, data) <ide> <ide> def _1_0_cloud_ips(self, method, url, body, headers): <ide> if method == 'GET': <del> return self.response(httplib.OK, self.fixtures.load('list_cloud_ips.json')) <add> return self.test_response(httplib.OK, self.fixtures.load('list_cloud_ips.json')) <ide> elif method == 'POST': <ide> if body: <ide> body = json.loads(body) <ide> def _1_0_cloud_ips(self, method, url, body, headers): <ide> <ide> if 'reverse_dns' in body: <ide> node['reverse_dns'] = body['reverse_dns'] <del> return self.response(httplib.ACCEPTED, json.dumps(node)) <add> return self.test_response(httplib.ACCEPTED, json.dumps(node)) <ide> <ide> def _1_0_cloud_ips_cip_jsjc5(self, method, url, body, headers): <ide> if method == 'DELETE': <del> return self.response(httplib.OK, '') <add> return self.test_response(httplib.OK, '') <ide> elif method == 'PUT': <ide> body = json.loads(body) <ide> if body.get('reverse_dns', None) == 'fred.co.uk': <del> return self.response(httplib.OK, '') <add> return self.test_response(httplib.OK, '') <ide> else: <del> return self.response(httplib.BAD_REQUEST, '{"error_name":"bad dns", "errors": ["Bad dns"]}') <add> return self.test_response(httplib.BAD_REQUEST, '{"error_name":"bad dns", "errors": ["Bad dns"]}') <ide> <ide> def _1_0_cloud_ips_cip_jsjc5_map(self, method, url, body, headers): <ide> if method == 'POST': <ide> body = json.loads(body) <ide> if 'destination' in body: <del> return self.response(httplib.ACCEPTED, '') <add> return self.test_response(httplib.ACCEPTED, '') <ide> else: <ide> data = '{"error_name":"bad destination", "errors": ["Bad destination"]}' <del> return self.response(httplib.BAD_REQUEST, data) <add> return self.test_response(httplib.BAD_REQUEST, data) <ide> <ide> def _1_0_cloud_ips_cip_jsjc5_unmap(self, method, url, body, headers): <ide> if method == 'POST': <del> return self.response(httplib.ACCEPTED, '') <add> return self.test_response(httplib.ACCEPTED, '') <ide> <del> def response(self, status, body): <add> def test_response(self, status, body): <ide> return (status, body, {'content-type': 'application/json'}, httplib.responses[status]) <ide> <ide>
2
Text
Text
run tests before landing changes
1e7f6b157133d89b841de9bbc3348c474717b83d
<ide><path>COLLABORATOR_GUIDE.md <ide> commit logs, ensure that they are properly formatted, and add <ide> * The commit message text must conform to the <ide> [commit message guidelines](./CONTRIBUTING.md#step-3-commit). <ide> <add>Run tests (`make -j4 test` or `vcbuild test`). Even though there was a <add>successful continuous integration run, other changes may have landed on master <add>since then, so running the tests one last time locally is a good practice. <add> <ide> Time to push it: <ide> <ide> ```text <ide> your pull request shows the purple merged status then you should still <ide> add the "Landed in <commit hash>..<commit hash>" comment if you added <ide> multiple commits. <ide> <del>* `./configure && make -j8 test` <del> * `-j8` builds node in parallel with 8 threads. Adjust to the number <del> of cores or processor-level threads your processor has (or slightly <del> more) for best results. <del> <ide> ### I Just Made a Mistake <ide> <ide> * Ping a CTC member.
1
Text
Text
add range in for loop
23ae994d405ea167703291b919a265753f9494d8
<ide><path>guide/chinese/ruby/ruby-for-loop/index.md <ide> for element in array do <ide> end <ide> ``` <ide> <add>for循环也可以利用Range的方式来执行,1..10 代表 1~10 包含 10,1...10 代表 1~10 不包含 10: <add>``` <add>for element in 1..10 <add> puts element <add>end <add>``` <add> <ide> 在Ruby中有许多不同的方法可以执行for循环或循环,另一个例子是: <ide> ``` <ide> element.each do |element| <ide> element.each do |element| <ide> ``` <ide> element.each do { |element| puts element } <ide> <del>``` <ide>\ No newline at end of file <add>```
1
Ruby
Ruby
place api_parser code into util module
05d7c40ea5fb14243bdba939ab9ef86196269468
<ide><path>Library/Homebrew/utils/update.rb <ide> require 'json' <ide> <ide> module Utils <del> <add> class ApiParser <add> def call_api(url) <add> puts "- Calling API #{url}" <add> uri = URI(url) <add> response = Net::HTTP.get(uri) <add> <add> puts "- Parsing response" <add> JSON.parse(response) <add> end <add> <add> def query_repology_api(last_package_in_response = '') <add> url = 'https://repology.org/api/v1/projects/' + last_package_in_response + '?inrepo=homebrew&outdated=1' <add> <add> self.call_api(url) <add> end <add> <add> def parse_repology_api() <add> puts "\n-------- Query outdated packages from Repology --------" <add> page_no = 1 <add> puts "\n- Paginating repology api page: #{page_no}" <add> <add> outdated_packages = self.query_repology_api('') <add> last_pacakge_index = outdated_packages.size - 1 <add> response_size = outdated_packages.size <add> <add> while response_size > 1 do <add> page_no += 1 <add> puts "\n- Paginating repology api page: #{page_no}" <add> <add> last_package_in_response = outdated_packages.keys[last_pacakge_index] <add> response = self.query_repology_api("#{last_package_in_response}/") <add> <add> response_size = response.size <add> outdated_packages.merge!(response) <add> last_pacakge_index = outdated_packages.size - 1 <add> end <add> <add> puts "\n- #{outdated_packages.size} outdated pacakges identified by repology" <add> outdated_packages <add> end <add> end <add> <add> def query_homebrew <add> puts "\n-------- Get Homebrew Formulas --------" <add> self.call_api('https://formulae.brew.sh/api/formula.json') <add> end <add> <add> def parse_homebrew_formulas() <add> formulas = self.query_homebrew() <add> parsed_homebrew_formulas = {} <add> <add> formulas.each do |formula| <add> parsed_homebrew_formulas[formula['name']] = { <add> "fullname" => formula["full_name"], <add> "oldname" => formula["oldname"], <add> "version" => formula["versions"]['stable'], <add> "download_url" => formula["urls"]['stable']['url'], <add> } <add> end <add> <add> parsed_homebrew_formulas <add> end <add> <add> def validate_packages(outdated_repology_packages, brew_formulas) <add> puts "\n-------- Verify Outdated Repology packages as Homebrew Formulas --------" <add> packages = {} <add> <add> outdated_repology_packages.each do |package_name, repo_using_package| <add> # Identify homebrew repo <add> repology_homebrew_repo = repo_using_package.select { |repo| repo['repo'] == 'homebrew' }[0] <add> next if repology_homebrew_repo.empty? <add> <add> latest_version = nil <add> <add> # Identify latest version amongst repos <add> repo_using_package.each do |repo| <add> latest_version = repo['version'] if repo['status'] == 'newest' <add> end <add> <add> repology_homebrew_repo['latest_version'] = latest_version if latest_version <add> homebrew_package_details = brew_formulas[repology_homebrew_repo['srcname']] <add> <add> # Format package <add> packages[repology_homebrew_repo['srcname']] = format_package(homebrew_package_details, repology_homebrew_repo) <add> end <add> <add> packages <add> end <add> <add> <add> def format_package(homebrew_details, repology_details) <add> puts "- Formatting package: #{repology_details['srcname']}" <add> <add> homebrew_formula = HomebrewFormula.new <add> new_download_url = homebrew_formula.generate_new_download_url(homebrew_details['download_url'], homebrew_details['version'], repology_details['latest_version']) <add> <add> brew_commands = BrewCommands.new <add> livecheck_response = brew_commands.livecheck_check_formula(repology_details['srcname']) <add> has_open_pr = brew_commands.check_for_open_pr(repology_details['srcname'], new_download_url) <add> <add> formatted_package = { <add> 'fullname'=> homebrew_details['fullname'], <add> 'repology_version' => repology_details['latest_version'], <add> 'homebrew_version' => homebrew_details['version'], <add> 'livecheck_latest_version' => livecheck_response['livecheck_latest_version'], <add> 'current_download_url' => homebrew_details['download_url'], <add> 'latest_download_url' => new_download_url, <add> 'repology_latest_version' => repology_details['latest_version'], <add> 'has_open_pr' => has_open_pr <add> } <add> <add> formatted_package <add> end <add> <add> def display_version_data(outdated_packages) <add> puts "==============Formatted outdated packages============\n" <add> <add> outdated_packages.each do |package_name, package_details| <add> puts "" <add> puts "Package: #{package_name}" <add> puts "Brew current: #{package_details['homebrew_version']}" <add> puts "Repology latest: #{package_details['repology_version']}" <add> puts "Livecheck latest: #{package_details['livecheck_latest_version']}" <add> puts "Has Open PR?: #{package_details['has_open_pr']}" <add> end <add> end <ide> end
1
Text
Text
update documentation styleguide
945345b0c7c6f1aef4e763fc09d9448d1ffa37d8
<ide><path>CONTRIBUTING.md <ide> For more information on how to work with Atom's official packages, see <ide> <ide> ## Documentation Styleguide <ide> <del>* Use [TomDoc](http://tomdoc.org). <add>* Use [AtomDoc](https://github.com/atom/atomdoc). <ide> * Use [Markdown](https://daringfireball.net/projects/markdown). <ide> * Reference methods and classes in markdown with the custom `{}` notation: <ide> * Reference classes with `{ClassName}` <ide> * Reference instance methods with `{ClassName::methodName}` <ide> * Reference class methods with `{ClassName.methodName}` <del> * Delegate to comments elsewhere with `{Delegates to: ClassName.methodName}` <del> style notation. <ide> <ide> ### Example <ide> <ide> ```coffee <ide> # Public: Disable the package with the given name. <ide> # <del># This method emits multiple events: <del># <del># * `package-will-be-disabled` - before the package is disabled. <del># * `package-disabled` - after the package is disabled. <del># <del># name - The {String} name of the package to disable. <del># options - The {Object} with disable options (default: {}): <del># :trackTime - `true` to track the amount of time disabling took. <del># :ignoreErrors - `true` to catch and ignore errors thrown. <del># callback - The {Function} to call after the package has been disabled. <add># * `name` The {String} name of the package to disable. <add># * `options` (optional) The {Object} with disable options (default: {}): <add># * `trackTime` A {Boolean}, `true` to track the amount of time taken. <add># * `ignoreErrors` A {Boolean}, `true` to catch and ignore errors thrown. <add># * `callback` The {Function} to call after the package has been disabled. <ide> # <ide> # Returns `undefined`. <ide> disablePackage: (name, options, callback) ->
1
Ruby
Ruby
fix rubocop warnings
b42f646cec2f8d2ced09e98e9cd37375a183f94d
<ide><path>Library/Homebrew/extend/pathname.rb <ide> def abv <ide> out = "" <ide> compute_disk_usage <ide> out << "#{number_readable(@file_count)} files, " if @file_count > 1 <del> out << "#{disk_usage_readable(@disk_usage)}" <add> out << disk_usage_readable(@disk_usage).to_s <ide> end <ide> <ide> private <ide> def binwrite(contents, *open_args) <ide> end unless method_defined?(:binwrite) <ide> <ide> def binread(*open_args) <del> open("rb", *open_args) { |f| f.read } <add> open("rb", *open_args, &:read) <ide> end unless method_defined?(:binread) <ide> <ide> # NOTE always overwrites <ide> def default_stat <ide> <ide> # @private <ide> def cp_path_sub(pattern, replacement) <del> raise "#{self} does not exist" unless self.exist? <add> raise "#{self} does not exist" unless exist? <ide> <ide> dst = sub(pattern, replacement) <ide> <ide> def compression_type <ide> <ide> # @private <ide> def text_executable? <del> /^#!\s*\S+/ === open("r") { |f| f.read(1024) } <add> /^#!\s*\S+/ =~ open("r") { |f| f.read(1024) } <ide> end <ide> <ide> # @private <ide> def subdirs <ide> <ide> # @private <ide> def resolved_path <del> self.symlink? ? dirname+readlink : self <add> symlink? ? dirname+readlink : self <ide> end <ide> <ide> # @private
1
PHP
PHP
use getter instead of property
d1a52d4809105716c668a20260bed722bf386062
<ide><path>src/Illuminate/Database/Schema/Blueprint.php <ide> public function foreignIdFor($model, $column = null) <ide> $model = new $model; <ide> } <ide> <del> return $model->getKeyType() === 'int' && $model->incrementing <add> return $model->getKeyType() === 'int' && $model->getIncrementing() <ide> ? $this->foreignId($column ?: $model->getForeignKey()) <ide> : $this->foreignUuid($column ?: $model->getForeignKey()); <ide> }
1
Ruby
Ruby
switch structure to if/else instead of rescue
14a7ef591b68ebb4d901c2f2a9a1553be0e7af03
<ide><path>Library/Homebrew/test/gpg_spec.rb <ide> <ide> shutup do <ide> subject.create_test_key(dir) <add> gpg = subject::GPG_EXECUTABLE <add> @version = Utils.popen_read(gpg, "--version")[/\d\.\d/, 0] <ide> end <ide> <del> begin <add> if @version.to_s.start_with?("2.1") <ide> expect(dir/".gnupg/pubring.kbx").to be_file <del> rescue RSpec::Expectations::ExpectationNotMetError <add> else <ide> expect(dir/".gnupg/secring.gpg").to be_file <ide> end <ide> end
1
Text
Text
add video at the bottom of the front page
e4909d0f2e42ec093d75454a1dad16a305b1fb99
<ide><path>docs/index.md <ide> id: home <ide> <script type="text/javascript" src="js/examples/markdown.js"></script> <ide> </section> <ide> <hr class="home-divider" /> <add><section class="home-section home-presentation"> <add> <h3>Presentation</h3> <add> <p>Watch this 30-minute presentation followed by a Q&A to learn more about React.</p> <add> <figure><iframe width="650" height="400" src="//www.youtube.com/embed/XxVg_s8xAms" frameborder="0" allowfullscreen></iframe></figure> <add></section> <add><hr class="home-divider" /> <ide> <section class="home-bottom-section"> <ide> <div class="buttons-unit"> <ide> <a href="docs/getting-started.html" class="button">Get Started</a>
1
Javascript
Javascript
update user model for migration
ca812f09ae2de1d91d3f7b59c2c283c39466dd56
<ide><path>models/User.js <ide> var userSchema = new mongoose.Schema({ <ide> type: Number, <ide> default: 0 <ide> }, <del> needsMigration: { type: Boolean, default: true } <add> needsMigration: { type: Boolean, default: true }, <add> challengesHash: {} <ide> }); <ide> <ide> /**
1
Python
Python
add tests for qs_exists
0a496a423d8c2812d1f79931b71bcb9015452a20
<ide><path>tests/test_validators.py <ide> import datetime <ide> <del>from django.db import models <add>from django.db import DataError, models <ide> from django.test import TestCase <ide> <ide> from rest_framework import serializers <del>from rest_framework.validators import UniqueValidator <add>from rest_framework.validators import UniqueValidator, qs_exists <ide> <ide> <ide> def dedent(blocktext): <ide> class Meta: <ide> validators = [<UniqueForDateValidator(queryset=HiddenFieldUniqueForDateModel.objects.all(), field='slug', date_field='published')>] <ide> """) <ide> assert repr(serializer) == expected <add> <add> <add>class ValidatorsTests(TestCase): <add> <add> def test_qs_exists_handles_type_error(self): <add> class TypeErrorQueryset(object): <add> def exists(self): <add> raise TypeError <add> assert qs_exists(TypeErrorQueryset()) is False <add> <add> def test_qs_exists_handles_value_error(self): <add> class ValueErrorQueryset(object): <add> def exists(self): <add> raise ValueError <add> assert qs_exists(ValueErrorQueryset()) is False <add> <add> def test_qs_exists_handles_data_error(self): <add> class DataErrorQueryset(object): <add> def exists(self): <add> raise DataError <add> assert qs_exists(DataErrorQueryset()) is False
1
Ruby
Ruby
fix rubocop warnings
cefaef75e1f7f8a4332ad5bd7468be7b3eead104
<ide><path>Library/Homebrew/os/mac.rb <ide> def preferred_arch <ide> "7.3" => { :clang => "7.3", :clang_build => 703 }, <ide> "7.3.1" => { :clang => "7.3", :clang_build => 703 }, <ide> "8.0" => { :clang => "8.0", :clang_build => 800 }, <del> } <add> }.freeze <ide> <ide> def compilers_standard? <ide> STANDARD_COMPILERS.fetch(Xcode.version.to_s).all? do |method, build|
1
Ruby
Ruby
update bundled rack for ruby 1.9 spec changes
524d8edf68ab94315a128cbd7570d1cf4faf7d7a
<ide><path>actionpack/lib/action_controller/integration.rb <ide> def process(method, path, parameters = nil, headers = nil) <ide> <ide> @headers = Rack::Utils::HeaderHash.new(headers) <ide> <del> (@headers['Set-Cookie'] || []).each do |cookie| <add> (@headers['Set-Cookie'] || "").split("\n").each do |cookie| <ide> name, value = cookie.match(/^([^=]*)=([^;]*);/)[1,2] <ide> @cookies[name] = value <ide> end <ide><path>actionpack/lib/action_controller/response.rb <ide> class Response < Rack::Response <ide> <ide> def initialize <ide> @status = 200 <del> @header = DEFAULT_HEADERS.dup <add> @header = Rack::Utils::HeaderHash.new(DEFAULT_HEADERS) <ide> <ide> @writer = lambda { |x| @body << x } <ide> @block = nil <ide><path>actionpack/lib/action_controller/session/abstract_store.rb <ide> def call(env) <ide> cookie << "; HttpOnly" if options[:httponly] <ide> <ide> headers = response[1] <del> case a = headers[SET_COOKIE] <del> when Array <del> a << cookie <del> when String <del> headers[SET_COOKIE] = [a, cookie] <del> when nil <add> unless headers[SET_COOKIE].blank? <add> headers[SET_COOKIE] << "\n#{cookie}" <add> else <ide> headers[SET_COOKIE] = cookie <ide> end <ide> end <ide><path>actionpack/lib/action_controller/session/cookie_store.rb <ide> def call(env) <ide> end <ide> <ide> cookie = build_cookie(@key, cookie.merge(options)) <del> case headers[HTTP_SET_COOKIE] <del> when Array <del> headers[HTTP_SET_COOKIE] << cookie <del> when String <del> headers[HTTP_SET_COOKIE] = [headers[HTTP_SET_COOKIE], cookie] <del> when nil <add> unless headers[HTTP_SET_COOKIE].blank? <add> headers[HTTP_SET_COOKIE] << "\n#{cookie}" <add> else <ide> headers[HTTP_SET_COOKIE] = cookie <ide> end <ide> end <ide><path>actionpack/lib/action_controller/streaming.rb <ide> def send_file_headers!(options) <ide> end <ide> content_type = content_type.to_s.strip # fixes a problem with extra '\r' with some browsers <ide> <del> headers.update( <add> headers.merge!( <ide> 'Content-Length' => options[:length], <ide> 'Content-Type' => content_type, <ide> 'Content-Disposition' => disposition, <ide><path>actionpack/lib/action_controller/vendor/rack-1.0/rack/deflater.rb <ide> def call(env) <ide> mtime = headers.key?("Last-Modified") ? <ide> Time.httpdate(headers["Last-Modified"]) : Time.now <ide> body = self.class.gzip(body, mtime) <del> headers = headers.merge("Content-Encoding" => "gzip", "Content-Length" => body.length.to_s) <add> size = body.respond_to?(:bytesize) ? body.bytesize : body.size <add> headers = headers.merge("Content-Encoding" => "gzip", "Content-Length" => size.to_s) <ide> [status, headers, [body]] <ide> when "deflate" <ide> body = self.class.deflate(body) <del> headers = headers.merge("Content-Encoding" => "deflate", "Content-Length" => body.length.to_s) <add> size = body.respond_to?(:bytesize) ? body.bytesize : body.size <add> headers = headers.merge("Content-Encoding" => "deflate", "Content-Length" => size.to_s) <ide> [status, headers, [body]] <ide> when "identity" <ide> [status, headers, body] <ide> when nil <del> message = ["An acceptable encoding for the requested resource #{request.fullpath} could not be found."] <del> [406, {"Content-Type" => "text/plain", "Content-Length" => message[0].length.to_s}, message] <add> message = "An acceptable encoding for the requested resource #{request.fullpath} could not be found." <add> [406, {"Content-Type" => "text/plain", "Content-Length" => message.length.to_s}, [message]] <ide> end <ide> end <ide> <ide><path>actionpack/lib/action_controller/vendor/rack-1.0/rack/handler/cgi.rb <ide> def self.serve(app) <ide> def self.send_headers(status, headers) <ide> STDOUT.print "Status: #{status}\r\n" <ide> headers.each { |k, vs| <del> vs.each { |v| <add> vs.split("\n").each { |v| <ide> STDOUT.print "#{k}: #{v}\r\n" <ide> } <ide> } <ide><path>actionpack/lib/action_controller/vendor/rack-1.0/rack/handler/fastcgi.rb <ide> def self.serve(request, app) <ide> def self.send_headers(out, status, headers) <ide> out.print "Status: #{status}\r\n" <ide> headers.each { |k, vs| <del> vs.each { |v| <add> vs.split("\n").each { |v| <ide> out.print "#{k}: #{v}\r\n" <ide> } <ide> } <ide><path>actionpack/lib/action_controller/vendor/rack-1.0/rack/handler/lsws.rb <ide> def self.serve(app) <ide> def self.send_headers(status, headers) <ide> print "Status: #{status}\r\n" <ide> headers.each { |k, vs| <del> vs.each { |v| <add> vs.split("\n").each { |v| <ide> print "#{k}: #{v}\r\n" <ide> } <ide> } <ide><path>actionpack/lib/action_controller/vendor/rack-1.0/rack/handler/mongrel.rb <ide> def process(request, response) <ide> response.send_status(nil) <ide> <ide> headers.each { |k, vs| <del> vs.each { |v| <add> vs.split("\n").each { |v| <ide> response.header[k] = v <ide> } <ide> } <ide><path>actionpack/lib/action_controller/vendor/rack-1.0/rack/handler/scgi.rb <ide> def process_request(request, input_body, socket) <ide> begin <ide> socket.write("Status: #{status}\r\n") <ide> headers.each do |k, vs| <del> vs.each {|v| socket.write("#{k}: #{v}\r\n")} <add> vs.split("\n").each { |v| socket.write("#{k}: #{v}\r\n")} <ide> end <ide> socket.write("\r\n") <ide> body.each {|s| socket.write(s)} <ide><path>actionpack/lib/action_controller/vendor/rack-1.0/rack/handler/webrick.rb <ide> def service(req, res) <ide> res.status = status.to_i <ide> headers.each { |k, vs| <ide> if k.downcase == "set-cookie" <del> res.cookies.concat Array(vs) <add> res.cookies.concat vs.split("\n") <ide> else <del> vs.each { |v| <add> vs.split("\n").each { |v| <ide> res[k] = v <ide> } <ide> end <ide><path>actionpack/lib/action_controller/vendor/rack-1.0/rack/lint.rb <ide> def check_headers(header) <ide> ## but only contain keys that consist of <ide> ## letters, digits, <tt>_</tt> or <tt>-</tt> and start with a letter. <ide> assert("invalid header name: #{key}") { key =~ /\A[a-zA-Z][a-zA-Z0-9_-]*\z/ } <del> ## <del> ## The values of the header must respond to #each. <del> assert("header values must respond to #each, but the value of " + <del> "'#{key}' doesn't (is #{value.class})") { value.respond_to? :each } <del> value.each { |item| <del> ## The values passed on #each must be Strings <del> assert("header values must consist of Strings, but '#{key}' also contains a #{item.class}") { <del> item.instance_of?(String) <del> } <del> ## and not contain characters below 037. <add> <add> ## The values of the header must be Strings, <add> assert("a header value must be a String, but the value of " + <add> "'#{key}' is a #{value.class}") { value.kind_of? String } <add> ## consisting of lines (for multiple header values) seperated by "\n". <add> value.split("\n").each { |item| <add> ## The lines must not contain characters below 037. <ide> assert("invalid header value #{key}: #{item.inspect}") { <ide> item !~ /[\000-\037]/ <ide> } <ide><path>actionpack/lib/action_controller/vendor/rack-1.0/rack/mock.rb <ide> def initialize(status, headers, body, errors=StringIO.new("")) <ide> @original_headers = headers <ide> @headers = Rack::Utils::HeaderHash.new <ide> headers.each { |field, values| <del> values.each { |value| <del> @headers[field] = value <del> } <add> @headers[field] = values <ide> @headers[field] = "" if values.empty? <ide> } <ide> <ide><path>actionpack/lib/action_controller/vendor/rack-1.0/rack/utils.rb <ide> def initialize(hash={}) <ide> end <ide> <ide> def to_hash <del> {}.replace(self) <add> inject({}) do |hash, (k,v)| <add> if v.respond_to? :to_ary <add> hash[k] = v.to_ary.join("\n") <add> else <add> hash[k] = v <add> end <add> hash <add> end <ide> end <ide> <ide> def [](k) <ide><path>actionpack/lib/action_controller/verification.rb <ide> def verify(options={}) <ide> def verify_action(options) #:nodoc: <ide> if prereqs_invalid?(options) <ide> flash.update(options[:add_flash]) if options[:add_flash] <del> response.headers.update(options[:add_headers]) if options[:add_headers] <add> response.headers.merge!(options[:add_headers]) if options[:add_headers] <ide> apply_remaining_actions(options) unless performed? <ide> end <ide> end <ide><path>actionpack/test/controller/integration_test.rb <ide> def test_cookie_monster <ide> assert_equal "Gone", status_message <ide> assert_response 410 <ide> assert_response :gone <del> assert_equal ["cookie_1=; path=/", "cookie_3=chocolate; path=/"], headers["Set-Cookie"] <add> assert_equal "cookie_1=; path=/\ncookie_3=chocolate; path=/", headers["Set-Cookie"] <ide> assert_equal({"cookie_1"=>"", "cookie_2"=>"oatmeal", "cookie_3"=>"chocolate"}, cookies) <ide> assert_equal "Gone", response.body <ide> end <ide><path>actionpack/test/controller/rack_test.rb <ide> def test_simple_output <ide> "Content-Type" => "text/html; charset=utf-8", <ide> "Cache-Control" => "private, max-age=0, must-revalidate", <ide> "ETag" => '"65a8e27d8879283831b664bd8b7f0ad4"', <del> "Set-Cookie" => [], <add> "Set-Cookie" => "", <ide> "Content-Length" => "13" <ide> }, headers) <ide> <ide> def test_utf8_output <ide> "Content-Type" => "text/html; charset=utf-8", <ide> "Cache-Control" => "private, max-age=0, must-revalidate", <ide> "ETag" => '"ebb5e89e8a94e9dd22abf5d915d112b2"', <del> "Set-Cookie" => [], <add> "Set-Cookie" => "", <ide> "Content-Length" => "8" <ide> }, headers) <ide> end <ide> def test_streaming_block <ide> assert_equal({ <ide> "Content-Type" => "text/html; charset=utf-8", <ide> "Cache-Control" => "no-cache", <del> "Set-Cookie" => [] <add> "Set-Cookie" => "" <ide> }, headers) <ide> <ide> parts = [] <ide><path>actionpack/test/controller/session/cookie_store_test.rb <ide> def test_setting_session_value <ide> with_test_route_set do <ide> get '/set_session_value' <ide> assert_response :success <del> assert_equal ["_myapp_session=#{response.body}; path=/; HttpOnly"], <add> assert_equal "_myapp_session=#{response.body}; path=/; HttpOnly", <ide> headers['Set-Cookie'] <ide> end <ide> end <ide> def test_doesnt_write_session_cookie_if_session_is_not_accessed <ide> with_test_route_set do <ide> get '/no_session_access' <ide> assert_response :success <del> assert_equal [], headers['Set-Cookie'] <add> assert_equal "", headers['Set-Cookie'] <ide> end <ide> end <ide> <ide> def test_doesnt_write_session_cookie_if_session_is_unchanged <ide> "fef868465920f415f2c0652d6910d3af288a0367" <ide> get '/no_session_access' <ide> assert_response :success <del> assert_equal [], headers['Set-Cookie'] <add> assert_equal "", headers['Set-Cookie'] <ide> end <ide> end <ide> <ide> def test_setting_session_value_after_session_reset <ide> get '/set_session_value' <ide> assert_response :success <ide> session_payload = response.body <del> assert_equal ["_myapp_session=#{response.body}; path=/; HttpOnly"], <add> assert_equal "_myapp_session=#{response.body}; path=/; HttpOnly", <ide> headers['Set-Cookie'] <ide> <ide> get '/call_reset_session' <ide> def test_session_store_with_expire_after <ide> assert_response :success <ide> <ide> cookie_body = response.body <del> assert_equal ["_myapp_session=#{cookie_body}; path=/; expires=#{expected_expiry}; HttpOnly"], headers['Set-Cookie'] <add> assert_equal "_myapp_session=#{cookie_body}; path=/; expires=#{expected_expiry}; HttpOnly", <add> headers['Set-Cookie'] <ide> <ide> # Second request does not access the session <ide> time = Time.local(2008, 4, 25) <ide> def test_session_store_with_expire_after <ide> get '/no_session_access' <ide> assert_response :success <ide> <del> assert_equal ["_myapp_session=#{cookie_body}; path=/; expires=#{expected_expiry}; HttpOnly"], headers['Set-Cookie'] <add> assert_equal "_myapp_session=#{cookie_body}; path=/; expires=#{expected_expiry}; HttpOnly", <add> headers['Set-Cookie'] <ide> end <ide> end <ide>
19
Javascript
Javascript
add more tests for inherited listeners.
32bac7b4c751f4f5bc774ea05d0a85b8087de7c7
<ide><path>packages/@ember/-internals/meta/tests/listeners_test.js <ide> moduleFor( <ide> } <ide> <ide> ['@test inheritance'](assert) { <add> let matching; <ide> let target = {}; <ide> let parent = {}; <ide> let parentMeta = meta(parent); <ide> parentMeta.addToListeners('hello', target, 'm', 0); <ide> <del> let child = Object.create(parent); <del> let m = meta(child); <add> let child1 = Object.create(parent); <add> let m1 = meta(child1); <add> <add> let child2 = Object.create(parent); <add> let m2 = meta(child2); <add> <add> let child3 = Object.create(parent); <add> let m3 = meta(child3); <add> <add> m3.removeFromListeners('hello', target, 'm'); <add> <add> matching = m3.matchingListeners('hello'); <add> assert.deepEqual(matching, undefined, 'no listeners for child3'); <add> <add> m3.addToListeners('hello', target, 'm', 0); <add> <add> matching = m3.matchingListeners('hello'); <add> assert.deepEqual(matching, [target, 'm', false], 'listener still exists for child1'); <add> <add> m3.removeFromListeners('hello', target, 'm'); <add> <add> matching = m3.matchingListeners('hello'); <add> assert.deepEqual(matching, undefined, 'no listeners for child3'); <add> <add> matching = m1.matchingListeners('hello'); <add> assert.deepEqual(matching, [target, 'm', false], 'listener still exists for child1'); <add> <add> matching = m2.matchingListeners('hello'); <add> assert.deepEqual(matching, [target, 'm', false], 'listener still exists for child2'); <add> <add> m1.removeFromListeners('hello', target, 'm'); <add> <add> matching = m1.matchingListeners('hello'); <add> assert.equal(matching, undefined, 'listener removed from child1'); <add> <add> matching = m2.matchingListeners('hello'); <add> assert.deepEqual(matching, [target, 'm', false], 'listener still exists for child2'); <ide> <del> let matching = m.matchingListeners('hello'); <del> assert.equal(matching.length, 3); <del> assert.equal(matching[0], target); <del> assert.equal(matching[1], 'm'); <del> assert.equal(matching[2], 0); <del> m.removeFromListeners('hello', target, 'm'); <del> matching = m.matchingListeners('hello'); <del> assert.equal(matching, undefined); <ide> matching = parentMeta.matchingListeners('hello'); <del> assert.equal(matching.length, 3); <add> assert.deepEqual(matching, [target, 'm', false], 'listener still present for parent'); <ide> } <ide> <ide> ['@test deduplication'](assert) {
1
PHP
PHP
add lists method to collection class
6055f9f595f16c06881d72f5d5c6186cf03cc031
<ide><path>src/Illuminate/Support/Collection.php <ide> public function slice($offset, $length = null, $preserveKeys = false) <ide> return new static(array_slice($this->items, $offset, $length, $preserveKeys)); <ide> } <ide> <add> /** <add> * Get an array with the values of a given key. <add> * <add> * @param string $column <add> * @param string $key <add> * @return array <add> */ <add> public function lists($value, $key = null) <add> { <add> $results = array(); <add> <add> foreach ($this->items as $item) <add> { <add> $itemValue = is_object($item) ? $item->{$value} : $item[$value]; <add> <add> // If the key is "null", we will just append the value to the array and keep <add> // looping. Otherwise we will key the array using the value of the key we <add> // received from the developer. Then we'll return the final array form. <add> if (is_null($key)) <add> { <add> $results[] = $itemValue; <add> } <add> else <add> { <add> $itemKey = is_object($item) ? $item->{$key} : $item[$key]; <add> $results[$itemKey] = $itemValue; <add> } <add> } <add> <add> return $results; <add> } <add> <ide> /** <ide> * Determine if the collection is empty or not. <ide> * <ide><path>tests/Support/SupportCollectionTest.php <ide> public function testReverse() <ide> $this->assertEquals(array('alan', 'zaeed'), array_values($reversed->all())); <ide> } <ide> <add> <add> public function testListsWithArrayAndObjectValues() <add> { <add> $data = new Collection(array((object) array('name' => 'taylor', 'email' => 'foo'), array('name' => 'dayle', 'email' => 'bar'))); <add> $this->assertEquals(array('taylor' => 'foo', 'dayle' => 'bar'), $data->lists('email', 'name')); <add> $this->assertEquals(array('foo', 'bar'), $data->lists('email')); <add> } <add> <ide> }
2
PHP
PHP
get default parameter
65ffe0b6103fe93a1a19f471405d6530379e9887
<ide><path>system/arr.php <ide> class Arr { <ide> * <ide> * @param array $array <ide> * @param string $key <del> * @param array $default <add> * @param mixed $default <ide> * @return mixed <ide> */ <ide> public static function get($array, $key, $default = null) <ide> public static function get($array, $key, $default = null) <ide> return $array; <ide> } <ide> <del> return (array_key_exists($key, $array)) ? $array[$key] : $default; <add> if (array_key_exists($key, $array)) <add> { <add> return $array[$key]; <add> } <add> <add> return is_callable($default) ? call_user_func($default) : $default; <ide> } <ide> <ide> } <ide>\ No newline at end of file
1
Javascript
Javascript
do the same for the rest of the plugins
bf020dfe7b58f6f08ac43327b93c364b8cd89a12
<ide><path>lib/WebpackOptionsApply.js <ide> const RequireContextPlugin = require("./dependencies/RequireContextPlugin"); <ide> const RequireEnsurePlugin = require("./dependencies/RequireEnsurePlugin"); <ide> const RequireIncludePlugin = require("./dependencies/RequireIncludePlugin"); <ide> <del>const WarnNoModeSetPlugin = require("./WarnNoModeSetPlugin"); <del> <del>const EnsureChunkConditionsPlugin = require("./optimize/EnsureChunkConditionsPlugin"); <del>const RemoveParentModulesPlugin = require("./optimize/RemoveParentModulesPlugin"); <del>const RemoveEmptyChunksPlugin = require("./optimize/RemoveEmptyChunksPlugin"); <del>const MergeDuplicateChunksPlugin = require("./optimize/MergeDuplicateChunksPlugin"); <del> <ide> /** @typedef {import("../declarations/WebpackOptions").WebpackOptions} WebpackOptions */ <ide> /** @typedef {import("./Compiler")} Compiler */ <ide> <ide> class WebpackOptionsApply extends OptionsApply { <ide> new SystemPlugin(options.module).apply(compiler); <ide> <ide> if (typeof options.mode !== "string") { <add> const WarnNoModeSetPlugin = require("./WarnNoModeSetPlugin"); <ide> new WarnNoModeSetPlugin().apply(compiler); <ide> } <ide> <add> const EnsureChunkConditionsPlugin = require("./optimize/EnsureChunkConditionsPlugin"); <ide> new EnsureChunkConditionsPlugin().apply(compiler); <ide> if (options.optimization.removeAvailableModules) { <add> const RemoveParentModulesPlugin = require("./optimize/RemoveParentModulesPlugin"); <ide> new RemoveParentModulesPlugin().apply(compiler); <ide> } <ide> if (options.optimization.removeEmptyChunks) { <add> const RemoveEmptyChunksPlugin = require("./optimize/RemoveEmptyChunksPlugin"); <ide> new RemoveEmptyChunksPlugin().apply(compiler); <ide> } <ide> if (options.optimization.mergeDuplicateChunks) {
1
Go
Go
use chrootarchive for plugin rootfs
6f3f907cdba0ba1aa4eb1320595d155bab3467af
<ide><path>plugin/blobstore.go <ide> import ( <ide> "github.com/docker/docker/image" <ide> "github.com/docker/docker/layer" <ide> "github.com/docker/docker/pkg/archive" <add> "github.com/docker/docker/pkg/chrootarchive" <ide> "github.com/docker/docker/pkg/progress" <ide> "github.com/opencontainers/go-digest" <ide> "github.com/pkg/errors" <ide> func (dm *downloadManager) Download(ctx context.Context, initialRootFS image.Roo <ide> return initialRootFS, nil, err <ide> } <ide> digester := digest.Canonical.Digester() <del> if _, err := archive.ApplyLayer(dm.tmpDir, io.TeeReader(inflatedLayerData, digester.Hash())); err != nil { <add> if _, err := chrootarchive.ApplyLayer(dm.tmpDir, io.TeeReader(inflatedLayerData, digester.Hash())); err != nil { <ide> return initialRootFS, nil, err <ide> } <ide> initialRootFS.Append(layer.DiffID(digester.Digest()))
1
Javascript
Javascript
add info about angular-cookies.js
380854fd2ce4541aec7970066a0e93ccfb5943cb
<ide><path>src/ngCookies/cookies.js <ide> angular.module('ngCookies', ['ng']). <ide> * Only a simple Object is exposed and by adding or removing properties to/from <ide> * this object, new cookies are created/deleted at the end of current $eval. <ide> * <add> * # Installation <add> * To use $cookies make sure you have included the `angular-cookies.js` that comes in Angular <add> * package. You can also find this file on Google CDN, bower as well as at <add> * {@link http://code.angularjs.org/ code.angularjs.org}. <add> * <add> * Finally load the module in your application: <add> * <add> * angular.module('app', ['ngCookies']); <add> * <add> * and you are ready to get started! <add> * <ide> * @example <ide> <doc:example> <ide> <doc:source>
1
Text
Text
add brew livecheck documentation
94f900ea87f30461730ce3ca0065ef582e180c29
<ide><path>docs/Brew-Livecheck.md <add># Brew Livecheck <add> <add>**NOTE: This document is a work in progress and will be revised and expanded as time permits.** <add> <add>**NOTE: `livecheck` blocks are currently found in separate files in the [Homebrew/homebrew-livecheck](https://github.com/Homebrew/homebrew-livecheck) repository's `Livecheckables` folder. These will be migrated to their respective formulae in Homebrew/homebrew-core in the near future and this document is written as if this migration has already happened.** <add> <add>The general purpose of the `brew livecheck` command is to find the newest version of a formula's software by checking an upstream source. Livecheck has [built-in strategies](#built-in-strategies) that can identify versions from some popular sources, such as Git repositories, certain websites, etc. <add> <add>## Default behavior <add> <add>When livecheck isn't given instructions for how to check for upstream versions of a formula's software, it does the following by default: <add> <add>1. Collect the `head`, `stable`, and `homepage` URLs from the formula, in that order. <add>2. Determine if any of the available strategies can be applied to the first URL. Move on to the next URL if no strategies apply. <add>3. If a strategy can be applied, use it to check for new versions. <add>4. Return the newest version (or an error if versions could not be found at any available URLs). <add> <add>This approach works fine for a number of formulae without requiring any manual intervention. However, it's sometimes necessary to change livecheck's default behavior to create a working check for a formula. <add> <add>It may be that the source livecheck is using doesn't provide the newest version and we need to check a different one instead. In another case, livecheck may be matching a version it shouldn't and we need to provide a regex to only match what's appropriate. <add> <add>## The `livecheck` block <add> <add>We can control livecheck's behavior by providing a `livecheck` block in the formula. Here is a simple example to check a "downloads" page for links containing a filename like `example-1.2.tar.gz`: <add> <add>```ruby <add>livecheck do <add> url "https://www.example.com/downloads/" <add> regex(/href=.*?example[._-]v?(\d+(?:\.\d+)+)\.t/i) <add>end <add>``` <add> <add>At the moment, it's only necessary to create a `livecheck` block in a formula when the default check doesn't work properly. <add> <add>## Creating a check <add> <add>1. **Use the debug output to understand the current situation**. Running `brew livecheck --debug <formula>` (where `<formula>` is the formula name) will provide more information about which URL livecheck is using and any strategy that applies. <add> <add>2. **Research available sources**. It's generally preferable to check for a new version at the same source as the `stable` URL, when possible. With this in mind, it may be a good idea to start by removing the file name from the `stable` URL, to see if this is a directory listing page. If that doesn't work, the website may have a downloads page we can check for versions. If it's not possible to find the newest version at this source through any means, try checking other sources from the formula (e.g. an upstream Git repository or the homepage). It's also sometimes necessary to search for other sources outside of the formula. <add> <add>3. **Compare available versions between sources**. If the latest version is available from the `stable` source, it's best to use that. Otherwise, check the other sources to identify where the latest version is available. <add> <add>4. **Select a source**. After researching and comparing sources, decide which one is the best available option and use it as the `url` in the `livecheck` block. <add> <add>5. **Create a regex, if necessary or beneficial**. If the check works fine without a regex and wouldn't benefit from having one, it's fine to omit it. However, when a default check isn't working properly and we need to create a `livecheck` block, a regex is almost always necessary as well. More information on creating regexes can be found in the [regex guidelines](#regex-guidelines) section. <add> <add>6. **Verify the check is working as intended**. Run `brew livecheck --debug <formula>` again to ensure livecheck is identifying all the versions it should and properly returning the newest version at the end. <add> <add>### URL guidelines <add> <add>* **A `url` is a required part of a `livecheck` block** and can either be a string containing a URL (e.g. `"https://www.example.com/downloads/"`) or a symbol referencing one of the supported formula URLs (i.e. `:stable`, `:homepage`, or `:head`). <add> <add>* **Use a symbol for a formula URL (i.e. `:homepage`, `:stable`, and `:head`) when appropriate**, to avoid duplicating formula URLs in the livecheckable. <add> <add>* **It's generally preferable to check for versions in the same location as the stable archive, when possible**. This preference is stronger for first-party sources (websites, repositories, etc.) and becomes weaker for third-party sources (e.g. mirrors, another software package manager, etc.). <add> <add>### Regex guidelines <add> <add>The regex in a `livecheck` block is used within a strategy to restrict matching to only relevant text (or strings) and to establish what part of the matched text is the version (using a capture group). <add> <add>Creating a good regex is a balance between being too strict (breaking easily) and too loose (matching more than it should). <add> <add>* For technical reasons, **the `regex` call in the `livecheck` block should always use parentheses** (e.g. `regex(/example/)`). <add> <add>* **Regex literals should follow the established Homebrew style**, where the `/.../` syntax is the default and the `%r{...}` syntax is used when a forward slash (`/`) is present. <add> <add>* **Regexes should adequately represent their intention.** This requires an understanding of basic regex syntax, so we avoid issues like using `.` (match any character) instead of `\.` when we only want to match a period. We also try to be careful about our use of generic catch-alls like `.*` or `.+`, as it's often better to use something non-greedy and contextually appropriate. For example, if we wanted to match a variety of characters while trying to stay within the bounds of an HTML attribute, we could use something like `[^"' >]*?`. <add> <add>* **Try not to be too specific in some parts of the regex.** For example, if a file name uses a hyphen (`-`) between the software name and version (e.g. `example-1.2.3.tar.gz`), we may want to use something like `example[._-]v?(\d+(?:\.\d+)+)\.t` instead. This would allow the regex to continue matching if the upstream file name format changes to `example.1.2.3.tar.gz` or `example_1.2.3.tar.gz`. <add> <add>* **Regexes should be case insensitive unless case sensitivity is explicitly required for matching to work properly**. Case insensitivity is enabled by adding the `i` flag at the end of the regex literal (e.g. `/.../i` or `%r{...}i`). This helps to improve reliability and reduce maintenance, as a case-insensitive regex doesn't need to be manually updated if there are any upstream changes in letter case. <add> <add>* **Regexes should only use a capturing group around the part of the matched text that corresponds to the version**. For example, in `/href=.*?example-v?(\d+(?:\.\d+)+)(?:-src)?\.t/i`, we're only using a capturing group around the version part (matching a version like `1.2`, `1.2.3`, etc.) and we're using non-capturing groups elsewhere (e.g. `(?:-src)?`). This allows livecheck to rely on the first capture group being the version string. <add> <add>* **Regexes should only match stable versions**. Regexes should be written to avoid prerelease versions like `1.2-alpha1`, `1.2-beta1`, `1.2-rc1`, etc. <add> <add>* **Restrict matching to `href` attributes when targeting file names in an HTML page (or `url` attributes in an RSS feed)**. Using `href=.*?` (or `url=.*?`) at the start of the regex will take care of any opening delimiter for the attribute (`"`, `'`, or nothing) as well as any leading part of the URL. This helps to keep the regex from being overly specific, reducing the need for maintenance in the future. A regex like `href=.*?example-...` is often fine but sometimes it's necessary to have something explicit before the file name to limit matching to only what's appropriate (e.g. `href=.*?/example-...` or `href=["']?example-...`). Similarly, `["' >]` can be used to target the end of the attribute, when needed. <add> <add>* **Use `\.t` in place of `\.tgz`, `\.tar\.gz`, etc.** There are a number of different file extensions for tarballs (e.g. `.tar.bz2`, `tbz2`, `.tar.gz`, `.tgz`, `.tar.xz`, `.txz`, etc.) and the upstream source may switch from one compression format to another over time. `\.t` avoids this issue by matching current and future formats starting with `t`. Outside of tarballs, it's fine to use full file extensions in the regex like `\.zip`, `\.jar`, etc. <add> <add>* **When matching versions like `1.2`, `1.2.3`, `v1.2`, etc., use the standard snippet for this in the regex: `v?(\d+(?:\.\d+)+)`**. This is often copy-pasted into the regex but it can also be modified to suit the circumstances. For example, if the version uses underscores instead, the standard regex could be modified to something like `v?(\d+(?:[._]\d+)+)`. [The general idea behind this standard snippet is that it better represents our intention compared to older, looser snippets that we now avoid (e.g. `[0-9.]+`).] <add> <add>* **Similarly, when matching Git tags with a version like `1.2`, `1.2.3`, `v1.2.3`, etc., start with the standard regex for this (`/^v?(\d+(?:\.\d+)+)$/i`) and modify it as needed**. Sometimes it's necessary to modify the regex to add a prefix, like `/^example-v?(\d+(?:\.\d+)+)$/i` for an `example-1.2.3` tag format. The general idea here is that Git tags are strings, so we can avoid unrelated software by restricting the start of the string (`^`) and unstable versions by restricting the end of the string (`$`). <add> <add>## Built-in strategies <add> <add>Livecheck's strategies are established methods for finding versions at either a specific source or a general type of source. The available strategies are as follows: <add> <add>* `Apache` <add>* `Bitbucket` <add>* `Git` <add>* `Gnome` <add>* `Gnu` <add>* `Hackage` <add>* `Launchpad` <add>* `Npm` <add>* `PageMatch` <add>* `Pypi` <add>* `Sourceforge` <add> <add>Each strategy has a `#match?(url)` method which determines whether the strategy can be applied to the provided URL. The `PageMatch` strategy is used as a fallback when a regex is provided and no other strategies apply. `PageMatch` simply uses the regex to match content on a page, so it's the desired strategy for URLs where a more-specific strategy doesn't apply. <add> <add>Some of the strategies generate a URL and regex internally. In these cases, the strategy often derives information from the provided URL and uses it to create the URL it will check and the regex used for matching. However, if a `regex` is provided in the `livecheck` block, it will be used instead of any generated regex. <add> <add>Livecheck also has a simple numeric priority system, where 5 is the default unless a strategy has defined its own `PRIORITY` constant. Currently, the `Git` strategy has a higher priority (8) and the `PageMatch` strategy has a low priority (0). In practice, this means that when more than one strategy applies to a URL (usually a specific strategy and `PageMatch`), the higher priority strategy is the one that's used. <add> <add>### Tap strategies <add> <add>Taps can add strategies to apply to their formulae by creating a `livecheck_strategy` folder in the root directory and placing strategy files within. At a minimum, strategies must provide a `#match?(url)` method and a `#find_versions(url, regex)` method. <add> <add>The `#match?(url)` method takes a URL string and returns `true` or `false` to indicate whether the strategy can be applied to the URL. <add> <add>`#find_versions(url, regex)` takes a URL and an optional regex and returns a `Hash` with a format like `{ :matches => {}, :regex => regex, :url => url }`. The `:matches` `Hash` uses version strings as the keys (e.g. `"1.2.3"`) and `Version` objects as the values. `:regex` is either the strategy-generated regex (if applicable), the regex provided as an argument, or `nil`. The `:url` is either the strategy-generated URL (if applicable) or the original URL provided. <add> <add>The built-in strategies in Homebrew's `livecheck_strategy` folder may serve as examples to follow when creating tap strategies. Many of the built-in strategies simply generate a URL and regex before using the `PageMatch` strategy to do the heavy lifting (e.g. `PageMatch.find_versions(page_url, regex)`). When a strategy is checking a text page of some sort (e.g. HTML, RSS, etc.), it may be able to do the same thing. If a strategy needs to do something more complex, the `Git` and `PageMatch` strategies can be referenced as standalone examples. <ide><path>docs/README.md <ide> - [Deprecating, Disabling, and Removing Formulae](Deprecating-Disabling-and-Removing-Formulae.md) <ide> - [Node for Formula Authors](Node-for-Formula-Authors.md) <ide> - [Python for Formula Authors](Python-for-Formula-Authors.md) <add>- [Brew Livecheck](Brew-Livecheck.md) <ide> - [Migrating A Formula To A Tap](Migrating-A-Formula-To-A-Tap.md) <ide> - [Rename A Formula](Rename-A-Formula.md) <ide> - [Building Against Non-Homebrew Dependencies](Building-Against-Non-Homebrew-Dependencies.md)
2
Java
Java
fix viewpager behavior with nodes
5f41769485e72570e94dd95fdfa46b8f446f788d
<ide><path>ReactAndroid/src/main/java/com/facebook/react/uimanager/ViewGroupManager.java <ide> <ide> package com.facebook.react.uimanager; <ide> <del>import android.view.View; <del>import android.view.ViewGroup; <del> <ide> import java.util.ArrayList; <ide> import java.util.Collection; <ide> import java.util.Collections; <ide> import java.util.Comparator; <add>import java.util.List; <ide> import java.util.WeakHashMap; <ide> <add>import android.view.View; <add>import android.view.ViewGroup; <add> <ide> /** <ide> * Class providing children management API for view managers of classes extending ViewGroup. <ide> */ <ide> public void addView(T parent, View child, int index) { <ide> reorderChildrenByZIndex(parent); <ide> } <ide> <add> /** <add> * Convenience method for batching a set of addView calls <add> * Note that this adds the views to the beginning of the ViewGroup <add> * <add> * @param parent the parent ViewGroup <add> * @param views the set of views to add <add> */ <add> public void addViews(T parent, List<View> views) { <add> for (int i = 0, size = views.size(); i < size; i++) { <add> addView(parent, views.get(i), i); <add> } <add> } <add> <ide> public static void setViewZIndex(View view, int zIndex) { <ide> mZIndexHash.put(view, zIndex); <ide> // zIndex prop gets set BEFORE the view is added, so parent may be null. <ide><path>ReactAndroid/src/main/java/com/facebook/react/views/viewpager/ReactViewPager.java <ide> * views to custom {@link PagerAdapter} instance which is used by {@link NativeViewHierarchyManager} <ide> * to add children nodes according to react views hierarchy. <ide> */ <del>/* package */ class ReactViewPager extends ViewPager { <add>public class ReactViewPager extends ViewPager { <ide> <ide> private class Adapter extends PagerAdapter { <ide> <ide> private final List<View> mViews = new ArrayList<>(); <add> private boolean mIsViewPagerInIntentionallyInconsistentState = false; <ide> <ide> void addView(View child, int index) { <ide> mViews.add(index, child); <ide> void removeViewAt(int index) { <ide> setOffscreenPageLimit(mViews.size()); <ide> } <ide> <add> /** <add> * Replace a set of views to the ViewPager adapter and update the ViewPager <add> */ <add> void setViews(List<View> views) { <add> mViews.clear(); <add> mViews.addAll(views); <add> notifyDataSetChanged(); <add> <add> // we want to make sure we return POSITION_NONE for every view here, since this is only <add> // called after a removeAllViewsFromAdapter <add> mIsViewPagerInIntentionallyInconsistentState = false; <add> } <add> <add> /** <add> * Remove all the views from the adapter and de-parents them from the ViewPager <add> * After calling this, it is expected that notifyDataSetChanged should be called soon <add> * afterwards. <add> */ <add> void removeAllViewsFromAdapter(ViewPager pager) { <add> mViews.clear(); <add> pager.removeAllViews(); <add> // set this, so that when the next addViews is called, we return POSITION_NONE for every <add> // entry so we can remove whichever views we need to and add the ones that we need to. <add> mIsViewPagerInIntentionallyInconsistentState = true; <add> } <add> <ide> View getViewAt(int index) { <ide> return mViews.get(index); <ide> } <ide> public int getCount() { <ide> <ide> @Override <ide> public int getItemPosition(Object object) { <del> return mViews.contains(object) ? mViews.indexOf(object) : POSITION_NONE; <add> // if we've removed all views, we want to return POSITION_NONE intentionally <add> return mIsViewPagerInIntentionallyInconsistentState || !mViews.contains(object) ? <add> POSITION_NONE : mViews.indexOf(object); <ide> } <ide> <ide> @Override <ide> public void setScrollEnabled(boolean scrollEnabled) { <ide> /*package*/ View getViewFromAdapter(int index) { <ide> return getAdapter().getViewAt(index); <ide> } <add> <add> public void setViews(List<View> views) { <add> getAdapter().setViews(views); <add> } <add> <add> public void removeAllViewsFromAdapter() { <add> getAdapter().removeAllViewsFromAdapter(this); <add> } <ide> }
2
Javascript
Javascript
remove string literal message in assertions
2b5320130bf3aeb2f57e79eb95cb69e39d2d6da8
<ide><path>test/async-hooks/test-async-await.js <ide> const timeout = common.platformTimeout(10); <ide> <ide> function checkPromisesInitState() { <ide> for (const initState of promisesInitState.values()) { <del> assert.strictEqual(initState, 'resolved', <del> 'promise initialized without being resolved'); <add> // Promise should not be initialized without being resolved. <add> assert.strictEqual(initState, 'resolved'); <ide> } <ide> } <ide> <ide> function checkPromisesExecutionState() { <ide> for (const executionState of promisesExecutionState.values()) { <del> assert.strictEqual(executionState, 'after', <del> 'mismatch between before and after hook calls'); <add> // Check for mismatch between before and after hook calls. <add> assert.strictEqual(executionState, 'after'); <ide> } <ide> } <ide>
1
Text
Text
update documentation links
0ed815285857f2210271f02635b3b713f051b28d
<ide><path>docs/advanced-features/i18n-routing.md <ide> When `localeDetection` is set to `false` Next.js will no longer automatically re <ide> <ide> ## Accessing the locale information <ide> <del>You can access the locale information via the Next.js router. For example, using the [`useRouter()`](https://nextjs.org/docs/api-reference/next/router#userouter) hook the following properties are available: <add>You can access the locale information via the Next.js router. For example, using the [`useRouter()`](/docs/api-reference/next/router.md#userouter) hook the following properties are available: <ide> <ide> - `locale` contains the currently active locale. <ide> - `locales` contains all configured locales. <ide> - `defaultLocale` contains the configured default locale. <ide> <del>When [pre-rendering](/docs/basic-features/pages#static-generation-recommended) pages with `getStaticProps` or `getServerSideProps`, the locale information is provided in [the context](https://nextjs.org/docs/basic-features/data-fetching#getstaticprops-static-generation) provided to the function. <add>When [pre-rendering](/docs/basic-features/pages.md#static-generation-recommended) pages with `getStaticProps` or `getServerSideProps`, the locale information is provided in [the context](/docs/basic-features/data-fetching.md#getstaticprops-static-generation) provided to the function. <ide> <ide> When leveraging `getStaticPaths`, the configured locales are provided in the context parameter of the function under `locales` and the configured defaultLocale under `defaultLocale`. <ide> <ide> export async function getStaticProps({ locale }) { <ide> <ide> ### Dynamic getStaticProps Pages <ide> <del>For dynamic `getStaticProps` pages, any locale variants of the page that is desired to be prerendered needs to be returned from [`getStaticPaths`](/docs/basic-features/data-fetching#getstaticpaths-static-generation). Along with the `params` object that can be returned for the `paths`, you can also return a `locale` field specifying which locale you want to render. For example: <add>For dynamic `getStaticProps` pages, any locale variants of the page that is desired to be prerendered needs to be returned from [`getStaticPaths`](/docs/basic-features/data-fetching.md#getstaticpaths-static-generation). Along with the `params` object that can be returned for the `paths`, you can also return a `locale` field specifying which locale you want to render. For example: <ide> <ide> ```js <ide> // pages/blog/[slug].js <ide><path>docs/advanced-features/static-html-export.md <ide> By default, `next export` will generate an `out` directory, which can be served <ide> - [API Routes](/docs/api-routes/introduction.md) are not supported by this method because they can't be prerendered to HTML. <ide> - [`getServerSideProps`](/docs/basic-features/data-fetching.md#getserversideprops-server-side-rendering) cannot be used within pages because the method requires a server. Consider using [`getStaticProps`](/docs/basic-features/data-fetching.md#getstaticprops-static-generation) instead. <ide> - [Internationalized Routing](/docs/advanced-features/i18n-routing.md) is not supported as it requires Next.js' server-side routing. <del>- The [`next/image`](/docs/api-reference/next/image) component's default loader is not supported when using `next export`. However, other [loader](https://nextjs.org/docs/basic-features/image-optimization#loader) options will work. <add>- The [`next/image`](/docs/api-reference/next/image.md) component's default loader is not supported when using `next export`. However, other [loader](/docs/basic-features/image-optimization.md#loader) options will work. <ide><path>docs/api-reference/next.config.js/redirects.md <ide> module.exports = { <ide> <ide> ### Regex Path Matching <ide> <del>To match a regex path you can wrap the regex in parenthesis after a parameter, for example `/blog/:slug(\\d{1,})` will match `/blog/123` but not `/blog/abc`: <add>To match a regex path you can wrap the regex in parenthesis after a parameter, for example `/post/:slug(\\d{1,})` will match `/post/123` but not `/post/abc`: <ide> <ide> ```js <ide> module.exports = { <ide> async redirects() { <ide> return [ <ide> { <del> source: '/old-blog/:post(\\d{1,})', <del> destination: '/blog/:post', // Matched parameters can be used in the destination <add> source: '/post/:slug(\\d{1,})', <add> destination: '/news/:slug', // Matched parameters can be used in the destination <ide> permanent: false, <ide> }, <ide> ] <ide><path>docs/api-reference/next/router.md <ide> The following is the definition of the `router` object returned by both [`useRou <ide> - `pathname`: `String` - Current route. That is the path of the page in `/pages` <ide> - `query`: `Object` - The query string parsed to an object. It will be an empty object during prerendering if the page doesn't have [data fetching requirements](/docs/basic-features/data-fetching.md). Defaults to `{}` <ide> - `asPath`: `String` - The path (including the query) shown in the browser without the configured `basePath` or `locale`. <del>- `isFallback`: `boolean` - Whether the current page is in [fallback mode](/docs/basic-features/data-fetching#fallback-pages). <del>- `basePath`: `String` - The active [basePath](/docs/api-reference/next.config.js/basepath) (if enabled). <add>- `isFallback`: `boolean` - Whether the current page is in [fallback mode](/docs/basic-features/data-fetching.md#fallback-pages). <add>- `basePath`: `String` - The active [basePath](/docs/api-reference/next.config.js/basepath.md) (if enabled). <ide> - `locale`: `String` - The active locale (if enabled). <ide> - `locales`: `String[]` - All supported locales (if enabled). <ide> - `defaultLocale`: `String` - The current default locale (if enabled). <ide><path>docs/upgrading.md <ide> npm install next@latest <ide> <ide> #### Production Deployment on Vercel <ide> <del>If you previously configured `routes` in your `vercel.json` file for dynamic routes, these rules can be removed when leveraging Next.js 9's new [Dynamic Routing feature](https://nextjs.org/docs/routing/dynamic-routes). <add>If you previously configured `routes` in your `vercel.json` file for dynamic routes, these rules can be removed when leveraging Next.js 9's new [Dynamic Routing feature](/docs/routing/dynamic-routes.md). <ide> <ide> Next.js 9's dynamic routes are **automatically configured on [Vercel](https://vercel.com/)** and do not require any `vercel.json` customization. <ide> <del>You can read more about [Dynamic Routing here](https://nextjs.org/docs/routing/dynamic-routes). <add>You can read more about [Dynamic Routing here](/docs/routing/dynamic-routes.md). <ide> <ide> #### Check your Custom <App> (`pages/_app.js`) <ide> <del>If you previously copied the [Custom `<App>`](https://nextjs.org/docs/advanced-features/custom-app) example, you may be able to remove your `getInitialProps`. <add>If you previously copied the [Custom `<App>`](/docs/advanced-features/custom-app.md) example, you may be able to remove your `getInitialProps`. <ide> <ide> Removing `getInitialProps` from `pages/_app.js` (when possible) is important to leverage new Next.js features! <ide>
5
Python
Python
remove unnecessary check
75f08ad62d9d0b9ea8ecf0454da332f99b00ec45
<ide><path>spacy/util.py <ide> def get_model_meta(path): <ide> raise ValueError(Errors.E054.format(setting=setting)) <ide> if "spacy_version" in meta: <ide> about_major_minor = ".".join(about.__version__.split(".")[:2]) <del> if about_major_minor is not None and not meta["spacy_version"].startswith( <del> ">=" + about_major_minor <del> ): <add> if not meta["spacy_version"].startswith(">=" + about_major_minor): <ide> # try to simplify version requirements from model meta to vx.x <ide> # for warning message <ide> meta_spacy_version = "v" + ".".join(
1
Go
Go
fix interactive exec over tls
266a1044deb9a085ed43dccdc6cfa0723e5142b0
<ide><path>api/server/server.go <ide> func postContainerExecStart(eng *engine.Engine, version version.Version, w http. <ide> } <ide> <ide> defer func() { <del> if tcpc, ok := inStream.(*net.TCPConn); ok { <del> tcpc.CloseWrite() <add> if cw, ok := inStream.(interface { <add> CloseWrite() error <add> }); ok { <add> cw.CloseWrite() <ide> } else { <ide> inStream.Close() <ide> } <ide> }() <ide> defer func() { <del> if tcpc, ok := outStream.(*net.TCPConn); ok { <del> tcpc.CloseWrite() <add> if cw, ok := outStream.(interface { <add> CloseWrite() error <add> }); ok { <add> cw.CloseWrite() <ide> } else if closer, ok := outStream.(io.Closer); ok { <ide> closer.Close() <ide> }
1
Mixed
Ruby
adjust macos version logic
444c3858dfc79a51cd48312bf65bccb23525a87f
<ide><path>Library/Homebrew/os/mac.rb <ide> def latest_sdk_version <ide> Version.new "11.0" <ide> end <ide> <del> def latest_stable_version <del> # TODO: bump version when new macOS is released and also update <del> # references in docs/Installation.md and <del> # https://github.com/Homebrew/install/blob/HEAD/install.sh <del> Version.new "11.0" <del> end <del> <ide> def outdated_release? <ide> # TODO: bump version when new macOS is released and also update <ide> # references in docs/Installation.md and <ide> def outdated_release? <ide> end <ide> <ide> def prerelease? <del> version > latest_stable_version <add> # TODO: bump version when new macOS is released or announced <add> # and also update references in docs/Installation.md and <add> # https://github.com/Homebrew/install/blob/HEAD/install.sh <add> version >= "12.0" <ide> end <ide> <ide> def languages <ide><path>Library/Homebrew/os/mac/xcode.rb <ide> module Xcode <ide> def latest_version <ide> latest_stable = "12.2" <ide> case MacOS.version <del> when "11.0" then latest_stable <add> when /^11\./ then latest_stable <ide> when "10.15" then "12.2" <ide> when "10.14" then "11.3.1" <ide> when "10.13" then "10.1" <ide> def latest_version <ide> sig { returns(String) } <ide> def minimum_version <ide> case MacOS.version <del> when "11.0" then "12.2" <add> when /^11\./ then "12.2" <ide> when "10.15" then "11.0" <ide> when "10.14" then "10.2" <ide> when "10.13" then "9.0" <ide> def update_instructions <ide> sig { returns(String) } <ide> def latest_clang_version <ide> case MacOS.version <del> when "11.0", "10.15" then "1200.0.32.27" <add> when /^11\./, "10.15" then "1200.0.32.27" <ide> when "10.14" then "1100.0.33.17" <ide> when "10.13" then "1000.10.44.2" <ide> when "10.12" then "900.0.39.2" <ide> def latest_clang_version <ide> sig { returns(String) } <ide> def minimum_version <ide> case MacOS.version <del> when "11.0" then "12.0.0" <add> when /^11\./ then "12.0.0" <ide> when "10.15" then "11.0.0" <ide> when "10.14" then "10.0.0" <ide> when "10.13" then "9.0.0" <ide><path>docs/Installation.md <ide> it does it too. You have to confirm everything it will do before it starts. <ide> ## macOS Requirements <ide> <ide> * A 64-bit Intel CPU <sup>[1](#1)</sup> <del>* macOS High Sierra (10.13) (or higher) <sup>[2](#2)</sup> <add>* macOS Mojave (10.14) (or higher) <sup>[2](#2)</sup> <ide> * Command Line Tools (CLT) for Xcode: `xcode-select --install`, <ide> [developer.apple.com/downloads](https://developer.apple.com/downloads) or <ide> [Xcode](https://itunes.apple.com/us/app/xcode/id497799835) <sup>[3](#3)</sup> <ide> Uninstallation is documented in the [FAQ](FAQ.md). <ide> <a name="1"><sup>1</sup></a> For 32-bit or PPC support see <ide> [Tigerbrew](https://github.com/mistydemeo/tigerbrew). <ide> <del><a name="2"><sup>2</sup></a> 10.13 or higher is recommended. 10.9–10.12 are <add><a name="2"><sup>2</sup></a> 10.14 or higher is recommended. 10.9–10.13 are <ide> supported on a best-effort basis. For 10.4-10.6 see <ide> [Tigerbrew](https://github.com/mistydemeo/tigerbrew). <ide>
3
Javascript
Javascript
ensure that jqlite->jqlite and dom->dom
75292a6cb5e17d618902f7996e80eb3118eff7b0
<ide><path>src/Angular.js <ide> function baseExtend(dst, objs, deep) { <ide> dst[key] = new Date(src.valueOf()); <ide> } else if (isRegExp(src)) { <ide> dst[key] = new RegExp(src); <add> } else if (src.nodeName) { <add> dst[key] = src.cloneNode(true); <ide> } else if (isElement(src)) { <del> dst[key] = src[0] ? jqLite(src).clone()[0] : jqLite(src).clone(); <add> dst[key] = jqLite(src).clone(); <ide> } else { <ide> if (!isObject(dst[key])) dst[key] = isArray(src) ? [] : {}; <ide> baseExtend(dst[key], [src], true); <ide><path>test/AngularSpec.js <ide> describe('angular', function() { <ide> expect(dst.jqObject).not.toBe(src.jqObject); <ide> <ide> expect(isElement(dst.element)).toBeTruthy(); <add> expect(jqLite(dst.element)).not.toBe(dst.element); // i.e it is a DOM element <ide> expect(isElement(dst.jqObject)).toBeTruthy(); <add> expect(jqLite(dst.jqObject)).toBe(dst.jqObject); // i.e it is a jqLite/jquery object <ide> }); <ide> }); <ide>
2
Python
Python
fix save_weights fnk when none is dumped
f6d6de8922af4b4a157cfc9869bb5501a05966b1
<ide><path>keras/models.py <ide> def save_weights(self, filepath): <ide> param_dset = g.create_dataset(param_name, param.shape, dtype='float64') <ide> param_dset[:] = param <ide> for k, v in l.get_config().items(): <del> g.attrs[k] = v <add> if v is not None: <add> g.attrs[k] = v <ide> f.flush() <ide> f.close() <ide>
1
Python
Python
update error message in rollaxis
fa369d17e110717535860d8caea5bec44da53f42
<ide><path>numpy/core/numeric.py <ide> def rollaxis(a, axis, start=0): <ide> axis += n <ide> if start < 0: <ide> start += n <del> msg = 'rollaxis: %s (%d) must be >=0 and < %d' <add> msg = "'%s' arg requires %d <= %s < %d, but %d was passed in" <ide> if not (0 <= axis < n): <del> raise ValueError(msg % ('axis', axis, n)) <add> raise ValueError(msg % ('axis', -n, 'axis', n, axis)) <ide> if not (0 <= start < n + 1): <del> raise ValueError(msg % ('start', start, n + 1)) <del> if (axis < start): <add> raise ValueError(msg % ('start', -n, 'start', n + 1, start)) <add> if axis < start: <ide> # it's been removed <ide> start -= 1 <ide> if axis == start:
1
Text
Text
fix typos in action view overview guide
8116770c7ba1be7b9f6744e4e807c6233958a23c
<ide><path>guides/source/action_view_overview.md <ide> With the `as` option we can specify a different name for the local variable. For <ide> <%= render partial: "product", as: "item" %> <ide> ``` <ide> <del>The `object` option can be used to directly specify which object is rendered into the partial; useful when the template's object is elsewhere (eg. in a different instance variable or in a local variable). <add>The `object` option can be used to directly specify which object is rendered into the partial; useful when the template's object is elsewhere (e.g. in a different instance variable or in a local variable). <ide> <ide> For example, instead of: <ide> <ide> image_path("edit.png") # => /assets/edit-2d1a2db63fc738690021fedb5a65b68e.png <ide> <ide> #### image_url <ide> <del>Computes the url to an image asset in the `app/assets/images` directory. This will call `image_path` internally and merge with your current host or your asset host. <add>Computes the URL to an image asset in the `app/assets/images` directory. This will call `image_path` internally and merge with your current host or your asset host. <ide> <ide> ```ruby <ide> image_url("edit.png") # => http://www.example.com/assets/edit.png <ide> javascript_path "common" # => /assets/common.js <ide> <ide> #### javascript_url <ide> <del>Computes the url to a JavaScript asset in the `app/assets/javascripts` directory. This will call `javascript_path` internally and merge with your current host or your asset host. <add>Computes the URL to a JavaScript asset in the `app/assets/javascripts` directory. This will call `javascript_path` internally and merge with your current host or your asset host. <ide> <ide> ```ruby <ide> javascript_url "common" # => http://www.example.com/assets/common.js <ide> stylesheet_path "application" # => /assets/application.css <ide> <ide> #### stylesheet_url <ide> <del>Computes the url to a stylesheet asset in the `app/assets/stylesheets` directory. This will call `stylesheet_path` internally and merge with your current host or your asset host. <add>Computes the URL to a stylesheet asset in the `app/assets/stylesheets` directory. This will call `stylesheet_path` internally and merge with your current host or your asset host. <ide> <ide> ```ruby <ide> stylesheet_url "application" # => http://www.example.com/assets/application.css <ide> file_field_tag 'attachment' <ide> <ide> #### form_tag <ide> <del>Starts a form tag that points the action to a url configured with `url_for_options` just like `ActionController::Base#url_for`. <add>Starts a form tag that points the action to a URL configured with `url_for_options` just like `ActionController::Base#url_for`. <ide> <ide> ```html+erb <ide> <%= form_tag '/articles' do %>
1
Javascript
Javascript
simplify fs.stat mocks
f117533f8227e0ca1140829e8e3eed09c06494b0
<ide><path>packager/src/node-haste/__mocks__/graceful-fs.js <ide> fs.readFileSync.mockImplementation(function(filepath, encoding) { <ide> return node; <ide> }); <ide> <add>function makeStatResult(node) { <add> const isSymlink = node != null && node.SYMLINK != null; <add> return { <add> isDirectory: () => node != null && typeof node === 'object' && !isSymlink, <add> isSymbolicLink: () => isSymlink, <add> mtime, <add> }; <add>} <add> <add>function statSync(filepath) { <add> const node = getToNode(filepath); <add> if (node.SYMLINK) { <add> return statSync(node.SYMLINK); <add> } <add> return makeStatResult(node); <add>} <add> <ide> fs.stat.mockImplementation((filepath, callback) => { <ide> callback = asyncCallback(callback); <del> let node; <add> let result; <ide> try { <del> node = getToNode(filepath); <add> result = statSync(filepath); <ide> } catch (e) { <ide> callback(e); <ide> return; <ide> } <del> <del> if (node.SYMLINK) { <del> fs.stat(node.SYMLINK, callback); <del> return; <del> } <del> <del> if (node && typeof node === 'object') { <del> callback(null, { <del> isDirectory: () => true, <del> isSymbolicLink: () => false, <del> mtime, <del> }); <del> } else { <del> callback(null, { <del> isDirectory: () => false, <del> isSymbolicLink: () => false, <del> mtime, <del> }); <del> } <add> callback(null, result); <ide> }); <ide> <del>fs.statSync.mockImplementation((filepath) => { <del> const node = getToNode(filepath); <del> <del> if (node.SYMLINK) { <del> return fs.statSync(node.SYMLINK); <del> } <add>fs.statSync.mockImplementation(statSync); <ide> <del> return { <del> isDirectory: () => node && typeof node === 'object', <del> isSymbolicLink: () => false, <del> mtime, <del> }; <del>}); <add>function lstatSync(filepath) { <add> const node = getToNode(filepath); <add> return makeStatResult(node); <add>} <ide> <ide> fs.lstat.mockImplementation((filepath, callback) => { <ide> callback = asyncCallback(callback); <del> let node; <add> let result; <ide> try { <del> node = getToNode(filepath); <add> result = lstatSync(filepath); <ide> } catch (e) { <ide> callback(e); <ide> return; <ide> } <del> <del> if (node && typeof node === 'object') { <del> callback(null, { <del> isDirectory: () => true, <del> isSymbolicLink: () => false, <del> mtime, <del> }); <del> } else { <del> callback(null, { <del> isDirectory: () => false, <del> isSymbolicLink: () => false, <del> mtime, <del> }); <del> } <add> callback(null, result); <ide> }); <ide> <del>fs.lstatSync.mockImplementation((filepath) => { <del> const node = getToNode(filepath); <del> <del> if (node.SYMLINK) { <del> return { <del> isDirectory: () => false, <del> isSymbolicLink: () => true, <del> mtime, <del> }; <del> } <del> <del> return { <del> isDirectory: () => node && typeof node === 'object', <del> isSymbolicLink: () => false, <del> mtime, <del> }; <del>}); <add>fs.lstatSync.mockImplementation(lstatSync); <ide> <ide> fs.open.mockImplementation(function(filepath) { <ide> const callback = arguments[arguments.length - 1] || noop; <ide> fs.createWriteStream.mockImplementation(file => { <ide> }); <ide> fs.createWriteStream.mock.returned = []; <ide> <del> <ide> fs.__setMockFilesystem = (object) => (filesystem = object); <ide> <ide> function getToNode(filepath) { <ide><path>packager/src/node-haste/__tests__/DependencyGraph-test.js <ide> describe('DependencyGraph', function() { <ide> }); <ide> }); <ide> <del> it('should work with packages with symlinked subdirs', function() { <del> var root = '/root'; <del> setMockFileSystem({ <del> 'symlinkedPackage': { <del> 'package.json': JSON.stringify({ <del> name: 'aPackage', <del> main: 'main.js', <del> }), <del> 'main.js': 'lol', <del> 'subdir': { <del> 'lolynot.js': 'lolynot', <del> }, <del> }, <del> 'root': { <del> 'index.js': [ <del> '/**', <del> ' * @providesModule index', <del> ' */', <del> 'require("aPackage/subdir/lolynot")', <del> ].join('\n'), <del> 'aPackage': { SYMLINK: '/symlinkedPackage' }, <del> }, <del> }); <del> <del> var dgraph = new DependencyGraph({ <del> ...defaults, <del> roots: [root], <del> }); <del> return getOrderedDependenciesAsJSON(dgraph, '/root/index.js').then(function(deps) { <del> expect(deps) <del> .toEqual([ <del> { <del> id: 'index', <del> path: '/root/index.js', <del> dependencies: ['aPackage/subdir/lolynot'], <del> isAsset: false, <del> isJSON: false, <del> isPolyfill: false, <del> resolution: undefined, <del> resolveDependency: undefined, <del> }, <del> { <del> id: 'aPackage/subdir/lolynot.js', <del> path: '/root/aPackage/subdir/lolynot.js', <del> dependencies: [], <del> isAsset: false, <del> isJSON: false, <del> isPolyfill: false, <del> resolution: undefined, <del> resolveDependency: undefined, <del> }, <del> ]); <del> }); <del> }); <del> <ide> it('should work with relative modules in packages', function() { <ide> var root = '/root'; <ide> setMockFileSystem({
2
PHP
PHP
use request socket if passed
e2da63875bd44d9359dd69a9aeebcba648e195bf
<ide><path>src/Illuminate/Broadcasting/BroadcastManager.php <ide> public function socket($request = null) <ide> <ide> $request = $request ?: $this->app['request']; <ide> <add> if ($request->has('socket')) { <add> return $request->input('socket'); <add> } <add> <ide> return $this->app['cache']->get( <ide> 'pusher:socket:'.$request->session()->getId() <ide> );
1
Javascript
Javascript
fix typo in test
e751cd09930240155b3a51e23b3bd4831b06b4d3
<ide><path>packages/ember-metal/tests/accessors/get_test.js <ide> test('warn on attempts to get a property path of undefined', function() { <ide> }, /Cannot call get with 'aProperty.on.aPath' on an undefined object/); <ide> }); <ide> <del>test('warn on attemps to get a falsy property', function() { <add>test('warn on attempts to get a falsy property', function() { <ide> var obj = {}; <ide> expectAssertion(function() { <ide> get(obj, null);
1
Ruby
Ruby
remove dead code from tests
d65320714ede42cc1e20a2da65dc6409758228f8
<ide><path>activerecord/test/cases/dirty_test.rb <ide> require 'models/person' # For optimistic locking <ide> require 'models/aircraft' <ide> <del>class Pirate # Just reopening it, not defining it <del> attr_accessor :detected_changes_in_after_update # Boolean for if changes are detected <del> attr_accessor :changes_detected_in_after_update # Actual changes <del> <del> after_update :check_changes <del> <del>private <del> # after_save/update and the model itself <del> # can end up checking dirty status and acting on the results <del> def check_changes <del> if self.changed? <del> self.detected_changes_in_after_update = true <del> self.changes_detected_in_after_update = self.changes <del> end <del> end <del>end <del> <ide> class NumericData < ActiveRecord::Base <ide> self.table_name = 'numeric_data' <ide> end
1
Mixed
Javascript
remove deprecated api
1cc6b993b9683d4adda9525ce3e96779db246658
<ide><path>doc/api/deprecations.md <ide> code modification is necessary if that is done. <ide> <a id="DEP0085"></a> <ide> ### DEP0085: AsyncHooks Sensitive API <ide> <del>Type: Runtime <add>Type: End-of-Life <ide> <ide> The AsyncHooks Sensitive API was never documented and had various of minor <ide> issues, see https://github.com/nodejs/node/issues/15572. Use the `AsyncResource` <ide> API instead. <ide> <a id="DEP0086"></a> <ide> ### DEP0086: Remove runInAsyncIdScope <ide> <del>Type: Runtime <add>Type: End-of-Life <ide> <ide> `runInAsyncIdScope` doesn't emit the `before` or `after` event and can thus <ide> cause a lot of issues. See https://github.com/nodejs/node/issues/14328 for more <ide><path>lib/async_hooks.js <ide> 'use strict'; <ide> <ide> const errors = require('internal/errors'); <del>const internalUtil = require('internal/util'); <ide> const async_wrap = process.binding('async_wrap'); <ide> const internal_async_hooks = require('internal/async_hooks'); <ide> <ide> // Get functions <del>// Only used to support a deprecated API. pushAsyncIds, popAsyncIds should <del>// never be directly in this manner. <del>const { pushAsyncIds, popAsyncIds } = async_wrap; <ide> // For userland AsyncResources, make sure to emit a destroy event when the <ide> // resource gets gced. <ide> const { registerDestroyHook } = async_wrap; <ide> const { <ide> getHookArrays, <ide> enableHooks, <ide> disableHooks, <del> // Sensitive Embedder API <add> // Internal Embedder API <ide> newUid, <ide> initTriggerId, <del> setInitTriggerId, <ide> emitInit, <ide> emitBefore, <ide> emitAfter, <ide> class AsyncResource { <ide> } <ide> <ide> <del>function runInAsyncIdScope(asyncId, cb) { <del> // Store the async id now to make sure the stack is still good when the ids <del> // are popped off the stack. <del> const prevId = executionAsyncId(); <del> pushAsyncIds(asyncId, prevId); <del> try { <del> cb(); <del> } finally { <del> popAsyncIds(asyncId); <del> } <del>} <del> <ide> // Placing all exports down here because the exported classes won't export <ide> // otherwise. <ide> module.exports = { <ide> module.exports = { <ide> // Embedder API <ide> AsyncResource, <ide> }; <del> <del>// Deprecated API // <del> <del>Object.defineProperty(module.exports, 'runInAsyncIdScope', { <del> get: internalUtil.deprecate(function() { <del> return runInAsyncIdScope; <del> }, 'async_hooks.runInAsyncIdScope is deprecated. ' + <del> 'Create an AsyncResource instead.', 'DEP0086') <del>}); <del> <del>Object.defineProperty(module.exports, 'newUid', { <del> get: internalUtil.deprecate(function() { <del> return newUid; <del> }, 'async_hooks.newUid is deprecated. ' + <del> 'Use AsyncResource instead.', 'DEP0085') <del>}); <del> <del>Object.defineProperty(module.exports, 'initTriggerId', { <del> get: internalUtil.deprecate(function() { <del> return initTriggerId; <del> }, 'async_hooks.initTriggerId is deprecated. ' + <del> 'Use the AsyncResource default instead.', 'DEP0085') <del>}); <del> <del>Object.defineProperty(module.exports, 'setInitTriggerId', { <del> get: internalUtil.deprecate(function() { <del> return setInitTriggerId; <del> }, 'async_hooks.setInitTriggerId is deprecated. ' + <del> 'Use the triggerAsyncId parameter in AsyncResource instead.', 'DEP0085') <del>}); <del> <del>Object.defineProperty(module.exports, 'emitInit', { <del> get: internalUtil.deprecate(function() { <del> return emitInit; <del> }, 'async_hooks.emitInit is deprecated. ' + <del> 'Use AsyncResource constructor instead.', 'DEP0085') <del>}); <del> <del>Object.defineProperty(module.exports, 'emitBefore', { <del> get: internalUtil.deprecate(function() { <del> return emitBefore; <del> }, 'async_hooks.emitBefore is deprecated. ' + <del> 'Use AsyncResource.emitBefore instead.', 'DEP0085') <del>}); <del> <del>Object.defineProperty(module.exports, 'emitAfter', { <del> get: internalUtil.deprecate(function() { <del> return emitAfter; <del> }, 'async_hooks.emitAfter is deprecated. ' + <del> 'Use AsyncResource.emitAfter instead.', 'DEP0085') <del>}); <del> <del>Object.defineProperty(module.exports, 'emitDestroy', { <del> get: internalUtil.deprecate(function() { <del> return emitDestroy; <del> }, 'async_hooks.emitDestroy is deprecated. ' + <del> 'Use AsyncResource.emitDestroy instead.', 'DEP0085') <del>}); <ide><path>lib/internal/async_hooks.js <ide> function disableHooks() { <ide> async_hook_fields[kCheck] -= 1; <ide> } <ide> <del>// Sensitive Embedder API // <add>// Internal Embedder API // <ide> <ide> // Increment the internal id counter and return the value. Important that the <ide> // counter increment first. Since it's done the same way in <ide> module.exports = { <ide> }, <ide> enableHooks, <ide> disableHooks, <del> // Sensitive Embedder API <add> // Internal Embedder API <ide> newUid, <ide> initTriggerId, <ide> setInitTriggerId, <ide><path>test/async-hooks/test-no-assert-when-disabled.js <ide> // Flags: --no-force-async-hooks-checks --expose-internals <ide> const common = require('../common'); <ide> <del>const async_hooks = require('async_hooks'); <add>const async_hooks = require('internal/async_hooks'); <ide> const internal = require('internal/process/next_tick'); <ide> <ide> // Using undefined as the triggerAsyncId. <ide><path>test/parallel/test-async-hooks-run-in-async-id-scope.js <del>'use strict'; <del> <del>const common = require('../common'); <del>const assert = require('assert'); <del>const async_hooks = require('async_hooks'); <del> <del>const asyncId = new async_hooks.AsyncResource('test').asyncId(); <del> <del>assert.notStrictEqual(async_hooks.executionAsyncId(), asyncId); <del> <del>async_hooks.runInAsyncIdScope(asyncId, common.mustCall(() => { <del> assert.strictEqual(async_hooks.executionAsyncId(), asyncId); <del>}));
5
Javascript
Javascript
update enzyme adapter for react tests (#80)
cb9358243d02e48ea8a23aa4ebbd9b4a3eaae881
<ide><path>packages/learn/src/templates/Challenges/utils/frame.js <ide> import { toString, flow } from 'lodash'; <ide> import Rx, { Observable } from 'rxjs'; <ide> import { ShallowWrapper, ReactWrapper } from 'enzyme'; <del>import Adapter15 from 'enzyme-adapter-react-15'; <add>import Adapter16 from 'enzyme-adapter-react-16'; <ide> import { isJSEnabledSelector } from '../redux'; <ide> import 'chai'; <ide> <ide> const writeTestDepsToDocument = frameReady => ctx => { <ide> shallow: (node, options) => <ide> new ShallowWrapper(node, null, { <ide> ...options, <del> adapter: new Adapter15() <add> adapter: new Adapter16() <ide> }), <ide> mount: (node, options) => <ide> new ReactWrapper(node, null, { <ide> ...options, <del> adapter: new Adapter15() <add> adapter: new Adapter16() <ide> }) <ide> }; <ide> // default for classic challenges
1
Python
Python
remove redundant parentheses
96626260dc8017e5cdc8506e35e7936b80d09c9d
<ide><path>airflow/migrations/versions/952da73b5eff_add_dag_code_table.py <ide> class SerializedDagModel(Base): <ide> sa.Column('last_updated', sa.TIMESTAMP(timezone=True), nullable=False)) <ide> <ide> conn = op.get_bind() <del> if conn.dialect.name not in ('sqlite'): <add> if conn.dialect.name != 'sqlite': <ide> if conn.dialect.name == "mssql": <ide> op.drop_index('idx_fileloc_hash', 'serialized_dag') <ide> <ide><path>backport_packages/setup_backport_packages.py <ide> def get_long_description(provider_package_id: str) -> str: <ide> """ <ide> package_folder = get_target_providers_package_folder(provider_package_id) <ide> readme_file = os.path.join(package_folder, "README.md") <del> if not(os.path.exists(readme_file)): <add> if not os.path.exists(readme_file): <ide> return "" <ide> with open(os.path.join(package_folder, "README.md"), encoding='utf-8', mode="r") as file: <ide> readme_contents = file.read()
2
Go
Go
pass tty master to exec
332755b99d345a8ffbf4fb636ca8fed604a233c0
<ide><path>pkg/libcontainer/nsinit/exec.go <ide> import ( <ide> <ide> // Exec performes setup outside of a namespace so that a container can be <ide> // executed. Exec is a high level function for working with container namespaces. <del>func Exec(container *libcontainer.Container, stdin io.Reader, stdout, stderr io.Writer, logFile string, args []string) (int, error) { <add>func Exec(container *libcontainer.Container, stdin io.Reader, stdout, stderr io.Writer, master *os.File, logFile string, args []string) (int, error) { <ide> var ( <del> master *os.File <ide> console string <ide> err error <ide> <ide><path>pkg/libcontainer/nsinit/nsinit/main.go <ide> func main() { <ide> exitCode, err = nsinit.ExecIn(container, nspid, flag.Args()[1:]) <ide> } else { <ide> exitCode, err = nsinit.Exec(container, <del> os.Stdin, os.Stdout, os.Stderr, <add> os.Stdin, os.Stdout, os.Stderr, nil, <ide> logFile, flag.Args()[1:]) <ide> } <ide> if err != nil {
2
Javascript
Javascript
move slow path to separate function too
630f63633490f60a292e62bb7a82bd9ea4de68c4
<ide><path>lib/events.js <ide> function emitThree(handler, isFn, self, arg1, arg2, arg3) { <ide> } <ide> } <ide> <add>function emitMany(handler, isFn, self, args) { <add> if (isFn) <add> handler.apply(self, args); <add> else { <add> var len = handler.length; <add> var listeners = arrayClone(handler, len); <add> for (var i = 0; i < len; ++i) <add> listeners[i].apply(self, args); <add> } <add>} <add> <ide> EventEmitter.prototype.emit = function emit(type) { <del> var er, handler, len, args, i, listeners, events, domain; <add> var er, handler, len, args, i, events, domain; <ide> var needDomainExit = false; <ide> <ide> events = this._events; <ide> EventEmitter.prototype.emit = function emit(type) { <ide> args = new Array(len - 1); <ide> for (i = 1; i < len; i++) <ide> args[i - 1] = arguments[i]; <del> if (isFn) <del> handler.apply(this, args); <del> else { <del> len = handler.length; <del> listeners = arrayClone(handler, len); <del> for (i = 0; i < len; ++i) <del> listeners[i].apply(this, args); <del> } <add> emitMany(handler, isFn, this, args); <ide> } <ide> <ide> if (needDomainExit)
1
Python
Python
fix twodim tests
99df3daf134808115b458d90c4c6fa676a02e6f2
<ide><path>numpy/lib/tests/test_index_tricks.py <ide> from numpy.testing import * <ide> from numpy import ( array, ones, r_, mgrid, unravel_index, zeros, where, <del> fill_diagonal, diag_indices, diag_indices_from ) <add> ndenumerate, fill_diagonal, diag_indices, <add> diag_indices_from ) <ide> <ide> class TestUnravelIndex(TestCase): <ide> def test_basic(self): <ide><path>numpy/lib/tests/test_twodim_base.py <ide> def test_triu_indices(): <ide> <ide> # Both for indexing: <ide> yield (assert_array_equal, a[iu1], <del> array([ 1, 5, 6, 9, 10, 11, 13, 14, 15, 16]) ) <add> array([1, 2, 3, 4, 6, 7, 8, 11, 12, 16])) <ide> <ide> # And for assigning values: <ide> a[iu1] = -1
2
PHP
PHP
add cartesianproduct to collection
ec02c023ede6da9fbb9c8f71a574b102ae6fbaab
<ide><path>src/Collection/CollectionTrait.php <ide> public function _unwrap() <ide> return $this->unwrap(); <ide> } <ide> <add> /** <add> * {@inheritDoc} <add> * <add> * @return \Cake\Collection\CollectionInterface <add> */ <add> public function cartesianProduct(callable $operation = null, callable $filter = null) <add> { <add> if ($this->isEmpty()) { <add> return new Collection([]); <add> } <add> <add> $result = []; <add> $counts = $this->map(function ($arr) { <add> return count($arr); <add> })->toList(); <add> $allArr = $this->toList(); <add> $lastIndex = count($allArr) - 1; <add> // holds the indexes of the arrays that generate the current combination <add> $currentIndexes = array_fill(0, $lastIndex + 1, 0); <add> $changeIndex = $lastIndex; <add> <add> while (!($changeIndex === 0 AND $currentIndexes[0] === $counts[0])) { <add> $currentCombination = array_map(function ($arr, $index) { <add> return $arr[$index]; <add> }, $allArr, $currentIndexes); <add> <add> if ($filter === null OR $filter(...$currentCombination)) { <add> $result[] = ($operation === null) ? $currentCombination : $operation(...$currentCombination); <add> } <add> <add> $currentIndexes[$lastIndex]++; <add> <add> for ($changeIndex = $lastIndex; $currentIndexes[$changeIndex] === $counts[$changeIndex] AND $changeIndex > 0; $changeIndex--) { <add> $currentIndexes[$changeIndex] = 0; <add> $currentIndexes[$changeIndex - 1]++; <add> } <add> } <add> <add> return new Collection($result); <add> } <add> <ide> /** <ide> * {@inheritDoc} <ide> * <ide><path>tests/TestCase/Collection/CollectionTest.php <ide> public function testChunkNested() <ide> $this->assertEquals($expected, $chunked); <ide> } <ide> <add> /** <add> * Tests cartesianProduct <add> * <add> * @return void <add> */ <add> public function testCartesianProduct() <add> { <add> $collection = new Collection([['A', 'B', 'C'], [1, 2, 3]]); <add> <add> $result = $collection->cartesianProduct(); <add> <add> $expected = [ <add> ['A', 1], <add> ['A', 2], <add> ['A', 3], <add> ['B', 1], <add> ['B', 2], <add> ['B', 3], <add> ['C', 1], <add> ['C', 2], <add> ['C', 3], <add> ]; <add> <add> $this->assertEquals($expected, $result->toList()); <add> <add> $collection = new Collection([[1, 2, 3], ['A', 'B', 'C'], ['a', 'b', 'c']]); <add> <add> $result = $collection->cartesianProduct(function ($val1, $val2, $val3) { <add> return [strval($val1) . $val2 . $val3]; <add> }, function ($val1, $val2, $val3) { <add> return $val1 >= 2; <add> }); <add> <add> $expected = [ <add> ['2Aa'], <add> ['2Ab'], <add> ['2Ac'], <add> ['2Ba'], <add> ['2Bb'], <add> ['2Bc'], <add> ['2Ca'], <add> ['2Cb'], <add> ['2Cc'], <add> ['3Aa'], <add> ['3Ab'], <add> ['3Ac'], <add> ['3Ba'], <add> ['3Bb'], <add> ['3Bc'], <add> ['3Ca'], <add> ['3Cb'], <add> ['3Cc'], <add> ]; <add> <add> $this->assertEquals($expected, $result->toList()); <add> <add> $collection = new Collection([['1', '2', '3', '4'], ['A', 'B', 'C'], ['name', 'surname', 'telephone']]); <add> <add> $result = $collection->cartesianProduct(function ($val1, $val2, $val3) { <add> return [$val1 => [$val2 => $val3]]; <add> }, function ($val1, $val2, $val3) { <add> return $val3 !== 'surname'; <add> }); <add> <add> $expected = [ <add> [1 => ['A' => 'name']], <add> [1 => ['A' => 'telephone']], <add> [1 => ['B' => 'name']], <add> [1 => ['B' => 'telephone']], <add> [1 => ['C' => 'name']], <add> [1 => ['C' => 'telephone']], <add> [2 => ['A' => 'name']], <add> [2 => ['A' => 'telephone']], <add> [2 => ['B' => 'name']], <add> [2 => ['B' => 'telephone']], <add> [2 => ['C' => 'name']], <add> [2 => ['C' => 'telephone']], <add> [3 => ['A' => 'name']], <add> [3 => ['A' => 'telephone']], <add> [3 => ['B' => 'name']], <add> [3 => ['B' => 'telephone']], <add> [3 => ['C' => 'name']], <add> [3 => ['C' => 'telephone']], <add> [4 => ['A' => 'name']], <add> [4 => ['A' => 'telephone']], <add> [4 => ['B' => 'name']], <add> [4 => ['B' => 'telephone']], <add> [4 => ['C' => 'name']], <add> [4 => ['C' => 'telephone']] <add> ]; <add> <add> $this->assertEquals($expected, $result->toList()); <add> } <add> <ide> public function testTranspose() <ide> { <ide> $collection = new Collection([
2
Python
Python
add win32 hash
5210048e95a2d2c433c12dd0d9b95fade98bd705
<ide><path>tools/openblas_support.py <ide> sha256_vals = { <ide> "openblas-v0.3.7-527-g79fd006c-win_amd64-gcc_7_1_0.zip": "7249d68c02e6b6339e06edfeab1fecddf29ee1e67a3afaa77917c320c43de840", <ide> "openblas64_-v0.3.7-527-g79fd006c-win_amd64-gcc_7_1_0.zip": "6488e0961a5926e47242f63b63b41cfdd661e6f1d267e8e313e397cde4775c17", <add>"openblas-v0.3.7-527-g79fd006c-win32-gcc_7_1_0.zip": "5fb0867ca70b1d0fdbf68dd387c0211f26903d74631420e4aabb49e94aa3930d", <ide> "openblas-v0.3.7-527-g79fd006c-macosx_10_9_x86_64-gf_1becaaa.tar.gz": "69434bd626bbc495da9ce8c36b005d140c75e3c47f94e88c764a199e820f9259", <ide> "openblas64_-v0.3.7-527-g79fd006c-macosx_10_9_x86_64-gf_1becaaa.tar.gz": "093f6d953e3fa76a86809be67bd1f0b27656671b5a55b233169cfaa43fd63e22", <ide> "openblas-v0.3.7-527-g79fd006c-manylinux2014_aarch64.tar.gz": "42676c69dc48cd6e412251b39da6b955a5a0e00323ddd77f9137f7c259d35319",
1
Python
Python
pass cfg through loading, for training
a2f55e701551fc5616083daec0c54f3fc8343478
<ide><path>spacy/language.py <ide> from .syntax.parser import get_templates <ide> from .syntax.nonproj import PseudoProjectivity <ide> from .pipeline import DependencyParser, EntityRecognizer <add>from .syntax.arc_eager import ArcEager <add>from .syntax.ner import BiluoPushDown <ide> <ide> <ide> class BaseDefaults(object): <ide> def create_tokenizer(cls, nlp=None): <ide> prefix_search = util.compile_prefix_regex(cls.prefixes).search <ide> suffix_search = util.compile_suffix_regex(cls.suffixes).search <ide> infix_finditer = util.compile_infix_regex(cls.infixes).finditer <del> vocab = nlp.vocab if nlp is not None else cls.create_vocab(nlp) <add> vocab = nlp.vocab if nlp is not None else cls.Default.create_vocab(nlp) <ide> return Tokenizer(nlp.vocab, rules=rules, <ide> prefix_search=prefix_search, suffix_search=suffix_search, <ide> infix_finditer=infix_finditer) <ide> def create_tagger(cls, nlp=None): <ide> return Tagger.load(nlp.path / 'pos', nlp.vocab) <ide> <ide> @classmethod <del> def create_parser(cls, nlp=None): <add> def create_parser(cls, nlp=None, **cfg): <ide> if nlp is None: <del> return DependencyParser(cls.create_vocab(), features=cls.parser_features) <add> return DependencyParser(cls.create_vocab(), features=cls.parser_features, <add> **cfg) <ide> elif nlp.path is False: <del> return DependencyParser(nlp.vocab, features=cls.parser_features) <add> return DependencyParser(nlp.vocab, features=cls.parser_features, **cfg) <ide> elif nlp.path is None or not (nlp.path / 'deps').exists(): <ide> return None <ide> else: <del> return DependencyParser.load(nlp.path / 'deps', nlp.vocab) <add> return DependencyParser.load(nlp.path / 'deps', nlp.vocab, **cfg) <ide> <ide> @classmethod <del> def create_entity(cls, nlp=None): <add> def create_entity(cls, nlp=None, **cfg): <ide> if nlp is None: <del> return EntityRecognizer(cls.create_vocab(), features=cls.entity_features) <add> return EntityRecognizer(cls.create_vocab(), features=cls.entity_features, **cfg) <ide> elif nlp.path is False: <del> return EntityRecognizer(nlp.vocab, features=cls.entity_features) <add> return EntityRecognizer(nlp.vocab, features=cls.entity_features, **cfg) <ide> elif nlp.path is None or not (nlp.path / 'ner').exists(): <ide> return None <ide> else: <del> return EntityRecognizer.load(nlp.path / 'ner', nlp.vocab) <add> return EntityRecognizer.load(nlp.path / 'ner', nlp.vocab, **cfg) <ide> <ide> @classmethod <ide> def create_matcher(cls, nlp=None): <ide> def train(cls, path, gold_tuples, *configs): <ide> # preprocess training data here before ArcEager.get_labels() is called <ide> gold_tuples = PseudoProjectivity.preprocess_training_data(gold_tuples) <ide> <del> parser_cfg['labels'] = ArcEager.get_labels(gold_tuples) <del> entity_cfg['labels'] = BiluoPushDown.get_labels(gold_tuples) <add> parser_cfg['actions'] = ArcEager.get_actions(gold_parses=gold_tuples) <add> entity_cfg['actions'] = BiluoPushDown.get_actions(gold_parses=gold_tuples) <ide> <ide> with (dep_model_dir / 'config.json').open('wb') as file_: <ide> json.dump(parser_cfg, file_) <ide> def train(cls, path, gold_tuples, *configs): <ide> vectors=False, <ide> pipeline=False) <ide> <del> self.defaults.parser_labels = parser_cfg['labels'] <del> self.defaults.entity_labels = entity_cfg['labels'] <del> <del> self.vocab = self.defaults.Vocab() <del> self.tokenizer = self.defaults.Tokenizer(self.vocab) <del> self.tagger = self.defaults.Tagger(self.vocab, **tagger_cfg) <del> self.parser = self.defaults.Parser(self.vocab, **parser_cfg) <del> self.entity = self.defaults.Entity(self.vocab, **entity_cfg) <del> self.pipeline = self.defaults.Pipeline(self) <add> self.vocab = self.Defaults.create_vocab(self) <add> self.tokenizer = self.Defaults.create_tokenizer(self) <add> self.tagger = self.Defaults.create_tagger(self) <add> self.parser = self.Defaults.create_parser(self) <add> self.entity = self.Defaults.create_entity(self) <add> self.pipeline = self.Defaults.create_pipeline(self) <ide> yield Trainer(self, gold_tuples) <ide> self.end_training() <ide> <ide> def __init__(self, path=True, **overrides): <del> if 'data_dir' in overrides and 'path' not in overrides: <add> if 'data_dir' in overrides and 'path' is True: <ide> raise ValueError("The argument 'data_dir' has been renamed to 'path'") <del> path = overrides.get('path', True) <ide> if isinstance(path, basestring): <ide> path = pathlib.Path(path) <ide> if path is True: <ide> def __init__(self, path=True, **overrides): <ide> add_vectors = self.Defaults.add_vectors(self) \ <ide> if 'add_vectors' not in overrides \ <ide> else overrides['add_vectors'] <del> if add_vectors: <add> if self.vocab and add_vectors: <ide> add_vectors(self.vocab) <ide> self.tokenizer = self.Defaults.create_tokenizer(self) \ <ide> if 'tokenizer' not in overrides \
1
PHP
PHP
add a method to add multiple crumbs at once
27db8688b2e625dbcf357dca021d87a115d028b9
<ide><path>src/View/Helper/BreadcrumbsHelper.php <ide> class BreadcrumbsHelper extends Helper <ide> /** <ide> * Add a crumb to the trail. <ide> * <del> * @param string $title Title of the crumb <add> * @param string|array $title Title of the crumb. If provided as an array, it will add each values of the array <add> * as a single crumb. This allows you to add multiple crumbs in the trail at once. Arrays are expected to be of this <add> * form: <add> * - *title* The title of the crumb <add> * - *link* The link of the crumb. If not provided, no link will be made <add> * - *options* Options of the crumb. See description of params option of this method. <ide> * @param string|array|null $link Link of the crumb. Either a string, an array of route params to pass to <ide> * Url::build() or null / empty if the crumb does not have a link <del> * @param array $options Array of options <add> * @param array $options Array of options. These options will be used as attributes HTML attribute the crumb will <add> * be rendered in (a <li> tag by default). It accepts two special keys: <add> * - *innerAttrs*: An array that allows you to define attributes for the inner element of the crumb (by default, to <add> * the link) <add> * - *templateVars*: Specific template vars in case you override the templates provided <ide> * @return $this <ide> */ <ide> public function add($title, $link = null, array $options = []) <ide> { <add> if (is_array($title)) { <add> foreach ($title as $crumb) { <add> $crumb = array_merge(['title' => '', 'link' => null, 'options' => []], $crumb); <add> $this->crumbs[] = $crumb; <add> } <add> <add> return $this; <add> } <add> <ide> $this->crumbs[] = ['title' => $title, 'link' => $link, 'options' => $options]; <ide> <ide> return $this; <ide> public function add($title, $link = null, array $options = []) <ide> * @param string $title Title of the crumb <ide> * @param string|array|null $link Link of the crumb. Either a string, an array of route params to pass to <ide> * Url::build() or null / empty if the crumb does not have a link <del> * @param array $options Array of options <add> * @param array $options Array of options. These options will be used as attributes HTML attribute the crumb will <add> * be rendered in (a <li> tag by default). It accepts two special keys: <add> * - *innerAttrs*: An array that allows you to define attributes for the inner element of the crumb (by default, to <add> * the link) <add> * - *templateVars*: Specific template vars in case you override the templates provided <ide> * @return $this <ide> */ <ide> public function prepend($title, $link = null, array $options = []) <ide> public function prepend($title, $link = null, array $options = []) <ide> * @param string $title Title of the crumb <ide> * @param string|array|null $link Link of the crumb. Either a string, an array of route params to pass to <ide> * Url::build() or null / empty if the crumb does not have a link <del> * @param array $options Array of options <add> * @param array $options Array of options. These options will be used as attributes HTML attribute the crumb will <add> * be rendered in (a <li> tag by default). It accepts two special keys: <add> * - *innerAttrs*: An array that allows you to define attributes for the inner element of the crumb (by default, to <add> * the link) <add> * - *templateVars*: Specific template vars in case you override the templates provided <ide> * @return $this <ide> */ <ide> public function insertAt($index, $title, $link = null, array $options = []) <ide> public function insertAt($index, $title, $link = null, array $options = []) <ide> * @param string $title Title of the crumb <ide> * @param string|array|null $link Link of the crumb. Either a string, an array of route params to pass to <ide> * Url::build() or null / empty if the crumb does not have a link <del> * @param array $options Array of options <add> * @param array $options Array of options. These options will be used as attributes HTML attribute the crumb will <add> * be rendered in (a <li> tag by default). It accepts two special keys: <add> * - *innerAttrs*: An array that allows you to define attributes for the inner element of the crumb (by default, to <add> * the link) <add> * - *templateVars*: Specific template vars in case you override the templates provided <ide> * @return $this <ide> */ <ide> public function insertBefore($matchingTitle, $title, $link = null, array $options = []) <ide> public function insertBefore($matchingTitle, $title, $link = null, array $option <ide> * @param string $title Title of the crumb <ide> * @param string|array|null $link Link of the crumb. Either a string, an array of route params to pass to <ide> * Url::build() or null / empty if the crumb does not have a link <del> * @param array $options Array of options <add> * @param array $options Array of options. These options will be used as attributes HTML attribute the crumb will <add> * be rendered in (a <li> tag by default). It accepts two special keys: <add> * - *innerAttrs*: An array that allows you to define attributes for the inner element of the crumb (by default, to <add> * the link) <add> * - *templateVars*: Specific template vars in case you override the templates provided <ide> * @return $this <ide> */ <ide> public function insertAfter($matchingTitle, $title, $link = null, array $options = []) <ide> public function getCrumbs() <ide> /** <ide> * Renders the breadcrumbs trail <ide> * <del> * @param array $attributes Array of attributes applied to the wrapper element <del> * @param array $separator Array of attributes for the `separator` template <add> * @param array $attributes Array of attributes applied to the `wrapper` template. Accepts the `templateVars` key to <add> * allow the insertion of custom template variable in the template. <add> * @param array $separator Array of attributes for the `separator` template. <add> * Possible properties are : <add> * - *separator* The string to be displayed as a separator <add> * - *templateVars* Allows the insertion of custom template variable in the template <add> * - *innerAttrs* To provide attributes in case your separator is divided in two elements <add> * All other properties will be converted as HTML attributes and will replace the *attrs* key in the template <add> * If you use the default for this option (empty), it will not render a separator. <ide> * @return string The breadcrumbs trail <ide> */ <ide> public function render(array $attributes = [], array $separator = []) <ide><path>tests/TestCase/View/Helper/BreadcrumbsHelperTest.php <ide> public function testAdd() <ide> $this->assertEquals($expected, $result); <ide> } <ide> <add> <add> /** <add> * Test adding multiple crumbs at once to the trail using add() <add> * @return void <add> */ <add> public function testAddMultiple() <add> { <add> $this->breadcrumbs <add> ->add([ <add> [ <add> 'title' => 'Home', <add> 'link' => '/', <add> 'options' => ['class' => 'first'] <add> ], <add> [ <add> 'title' => 'Some text', <add> 'link' => ['controller' => 'Some', 'action' => 'text'] <add> ], <add> [ <add> 'title' => 'Final', <add> ], <add> ]); <add> <add> $result = $this->breadcrumbs->getCrumbs(); <add> $expected = [ <add> [ <add> 'title' => 'Home', <add> 'link' => '/', <add> 'options' => [ <add> 'class' => 'first' <add> ] <add> ], <add> [ <add> 'title' => 'Some text', <add> 'link' => [ <add> 'controller' => 'Some', <add> 'action' => 'text' <add> ], <add> 'options' => [] <add> ], <add> [ <add> 'title' => 'Final', <add> 'link' => null, <add> 'options' => [] <add> ] <add> ]; <add> $this->assertEquals($expected, $result); <add> } <add> <ide> /** <ide> * Test adding crumbs to the trail using prepend() <ide> * @return void <ide> public function testRender() <ide> <ide> $result = $this->breadcrumbs->render( <ide> ['data-stuff' => 'foo and bar'], <del> ['separator' => ' > ', 'class' => 'separator', 'templateVars' => ['custom' => 'custom']] <add> ['separator' => '<i class="fa fa-angle-right"></i>', 'class' => 'separator', 'templateVars' => ['custom' => 'custom']] <ide> ); <ide> $expected = [ <ide> ['ul' => ['data-stuff' => 'foo and bar']], <ide> public function testRender() <ide> '/li', <ide> ['li' => ['class' => 'separator']], <ide> ['span' => []], <del> 'custom > ', <add> 'custom<i class="fa fa-angle-right"></i>', <ide> '/span', <ide> '/li', <ide> ['li' => []], <ide> public function testRender() <ide> '/li', <ide> ['li' => ['class' => 'separator']], <ide> ['span' => []], <del> 'custom > ', <add> 'custom<i class="fa fa-angle-right"></i>', <ide> '/span', <ide> '/li', <ide> ['li' => ['class' => 'final']],
2