content_type
stringclasses
8 values
main_lang
stringclasses
7 values
message
stringlengths
1
50
sha
stringlengths
40
40
patch
stringlengths
52
962k
file_count
int64
1
300
Python
Python
make numpy/f2py/crackfortran docstring read better
cabc07e185a0ffad5f8055760b385aa5cca85896
<ide><path>numpy/f2py/crackfortran.py <ide> #!/usr/bin/env python <ide> """ <add>crackfortran --- read fortran (77,90) code and extract declaration information. <add> <add>Copyright 1999-2004 Pearu Peterson all rights reserved, <add>Pearu Peterson <pearu@ioc.ee> <add>Permission to use, modify, and distribute this software is given under the <add>terms of the NumPy License. <add> <add>NO WARRANTY IS EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK. <add>$Date: 2005/09/27 07:13:49 $ <add>Pearu Peterson <add> <add> <ide> Usage of crackfortran: <ide> ====================== <ide> Command line keys: -quiet,-verbose,-fix,-f77,-f90,-show,-h <pyffilename> <ide> -> 'real x(2)') <ide> The above may be solved by creating appropriate preprocessor program, for example. <ide> <del>crackfortran --- read fortran (77,90) code and extract declaration information. <del> Usage is explained in the comment block below. <del> <del> <del>Copyright 1999-2004 Pearu Peterson all rights reserved, <del>Pearu Peterson <pearu@ioc.ee> <del>Permission to use, modify, and distribute this software is given under the <del>terms of the NumPy License. <del> <del>NO WARRANTY IS EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK. <del>$Date: 2005/09/27 07:13:49 $ <del>Pearu Peterson <del> <ide> """ <ide> from __future__ import division <ide>
1
Python
Python
remove unused model_dir option
c031c677ccfcf0c425c4ad838ddf1f795add9b5d
<ide><path>examples/keras_parikh_entailment/__main__.py <ide> import pickle <ide> <ide> <del>def train(model_dir, train_loc, dev_loc, shape, settings): <add>def train(train_loc, dev_loc, shape, settings): <ide> train_texts1, train_texts2, train_labels = read_snli(train_loc) <ide> dev_texts1, dev_texts2, dev_labels = read_snli(dev_loc) <ide> <ide> def train(model_dir, train_loc, dev_loc, shape, settings): <ide> batch_size=settings['batch_size']) <ide> if not (nlp.path / 'similarity').exists(): <ide> (nlp.path / 'similarity').mkdir() <del> print("Saving to", model_dir / 'similarity') <add> print("Saving to", nlp.path / 'similarity') <ide> weights = model.get_weights() <ide> with (nlp.path / 'similarity' / 'model').open('wb') as file_: <ide> pickle.dump(weights[1:], file_) <ide> def evaluate(model_dir, dev_loc): <ide> return correct, total <ide> <ide> <del>def demo(model_dir): <del> nlp = spacy.load('en', path=model_dir, <add>def demo(): <add> nlp = spacy.load('en', <ide> create_pipeline=create_similarity_pipeline) <ide> doc1 = nlp(u'What were the best crime fiction books in 2016?') <ide> doc2 = nlp( <ide> def read_snli(path): <ide> <ide> @plac.annotations( <ide> mode=("Mode to execute", "positional", None, str, ["train", "evaluate", "demo"]), <del> model_dir=("Path to spaCy model directory", "positional", None, Path), <ide> train_loc=("Path to training data", "positional", None, Path), <ide> dev_loc=("Path to development data", "positional", None, Path), <ide> max_length=("Length to truncate sentences", "option", "L", int), <ide> def read_snli(path): <ide> tree_truncate=("Truncate sentences by tree distance", "flag", "T", bool), <ide> gru_encode=("Encode sentences with bidirectional GRU", "flag", "E", bool), <ide> ) <del>def main(mode, model_dir, train_loc, dev_loc, <add>def main(mode, train_loc, dev_loc, <ide> tree_truncate=False, <ide> gru_encode=False, <ide> max_length=100, <ide> def main(mode, model_dir, train_loc, dev_loc, <ide> 'gru_encode': gru_encode <ide> } <ide> if mode == 'train': <del> train(model_dir, train_loc, dev_loc, shape, settings) <add> train(train_loc, dev_loc, shape, settings) <ide> elif mode == 'evaluate': <del> correct, total = evaluate(model_dir, dev_loc) <add> correct, total = evaluate(dev_loc) <ide> print(correct, '/', total, correct / total) <ide> else: <del> demo(model_dir) <add> demo() <ide> <ide> if __name__ == '__main__': <ide> plac.call(main)
1
Ruby
Ruby
use quiet_system to silence some useless warnings
581e1b2c7eef68a25f73f95a6bcc50d6fa22af68
<ide><path>Library/Homebrew/extend/pathname.rb <ide> def ensure_writable <ide> end <ide> <ide> def install_info <del> system '/usr/bin/install-info', '--quiet', self.to_s, (self.dirname+'dir').to_s <add> quiet_system "/usr/bin/install-info", "--quiet", to_s, "#{dirname}/dir" <ide> end <ide> <ide> def uninstall_info <del> system '/usr/bin/install-info', '--delete', '--quiet', self.to_s, (self.dirname+'dir').to_s <add> quiet_system "/usr/bin/install-info", "--delete", "--quiet", to_s, "#{dirname}/dir" <ide> end <ide> <ide> def find_formula
1
Javascript
Javascript
replace string concatenation with template
1dba1620bb43a6479207d57c904ce80a6c10a43d
<ide><path>test/fixtures/cluster-preload-test.js <ide> const cluster = require('cluster'); <ide> if (cluster.isMaster) { <ide> cluster.fork(); // one child <ide> cluster.on('exit', function(worker, code, signal) { <del> console.log('worker terminated with code ' + code); <add> console.log(`worker terminated with code ${code}`); <ide> }); <ide> }
1
Javascript
Javascript
remove unnecessary param
e41c0f0485bd5cadc55c279a39fd422c0c74399d
<ide><path>lib/IgnorePlugin.js <ide> class IgnorePlugin { <ide> * Not that if "contextRegExp" is given, both the "resourceRegExp" <ide> * and "contextRegExp" have to match. <ide> */ <del> checkResult(result, callback) { <add> checkResult(result) { <ide> if(!result) { <ide> return true; <ide> }
1
Python
Python
use new file paths
6a3d9ed9476a80d62d78590c567c1d77439188d9
<ide><path>libcloud/test/backup/test_dimensiondata.py <ide> def _oec_0_9_myaccount_NOJOB(self, method, url, body, headers): <ide> <ide> def _caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_server_e75ead52_692f_4314_8725_c8a4f4d13a87(self, method, url, body, headers): <ide> body = self.fixtures.load( <del> 'caas_2_1_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_server_e75ead52_692f_4314_8725_c8a4f4d13a87.xml') <add> 'caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_server_e75ead52_692f_4314_8725_c8a4f4d13a87.xml') <ide> return (httplib.OK, body, {}, httplib.responses[httplib.OK]) <ide> <ide> def _caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_server_e75ead52_692f_4314_8725_c8a4f4d13a87_DEFAULT(self, method, url, body, headers): <ide> body = self.fixtures.load( <del> 'caas_2_1_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_server_e75ead52_692f_4314_8725_c8a4f4d13a87_DEFAULT.xml') <add> 'caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_server_e75ead52_692f_4314_8725_c8a4f4d13a87_DEFAULT.xml') <ide> return (httplib.OK, body, {}, httplib.responses[httplib.OK]) <ide> <ide> def _caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_server_e75ead52_692f_4314_8725_c8a4f4d13a87_NOCLIENT(self, method, url, body, headers): <ide> body = self.fixtures.load( <del> 'caas_2_1_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_server_e75ead52_692f_4314_8725_c8a4f4d13a87_DEFAULT.xml') <add> 'caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_server_e75ead52_692f_4314_8725_c8a4f4d13a87_DEFAULT.xml') <ide> return (httplib.OK, body, {}, httplib.responses[httplib.OK]) <ide> <ide> def _caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_server_e75ead52_692f_4314_8725_c8a4f4d13a87_NOJOB(self, method, url, body, headers): <ide> body = self.fixtures.load( <del> 'caas_2_1_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_server_e75ead52_692f_4314_8725_c8a4f4d13a87_DEFAULT.xml') <add> 'caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_server_e75ead52_692f_4314_8725_c8a4f4d13a87_DEFAULT.xml') <ide> return (httplib.OK, body, {}, httplib.responses[httplib.OK]) <ide> <ide> def _caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_server_e75ead52_692f_4314_8725_c8a4f4d13a87_DISABLED(self, method, url, body, headers): <ide> body = self.fixtures.load( <del> 'caas_2_1_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_server_e75ead52_692f_4314_8725_c8a4f4d13a87_DEFAULT.xml') <add> 'caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_server_e75ead52_692f_4314_8725_c8a4f4d13a87_DEFAULT.xml') <ide> return (httplib.OK, body, {}, httplib.responses[httplib.OK]) <ide> <ide> def _caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_server(self, method, url, body, headers): <ide> body = self.fixtures.load( <del> 'caas_2_1_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_server.xml') <add> 'caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_server.xml') <ide> return (httplib.OK, body, {}, httplib.responses[httplib.OK]) <ide> <ide> def _oec_0_9_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_e75ead52_692f_4314_8725_c8a4f4d13a87_backup_client_type(self, method, url, body, headers): <ide><path>libcloud/test/compute/test_dimensiondata.py <ide> def test_paginated_mcp2_call_with_page_size(self): <ide> self.assertTrue(isinstance(node_list_generator, GeneratorType)) <ide> <ide> # We're making sure here the filters make it to the URL <del> # See _caas_2_1_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_server_ALLFILTERS for asserts <add> # See _caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_server_ALLFILTERS for asserts <ide> def test_list_nodes_response_strings_ALLFILTERS(self): <ide> DimensionDataMockHttp.type = 'ALLFILTERS' <ide> ret = self.driver.list_nodes(ex_location='fake_loc', ex_name='fake_name', <ide> def _oec_0_9_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_antiAffinityRule_07e3621a_a920 <ide> <ide> def _caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server(self, method, url, body, headers): <ide> body = self.fixtures.load( <del> 'caas_2_1_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server.xml') <add> 'caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server.xml') <ide> return (httplib.OK, body, {}, httplib.responses[httplib.OK]) <ide> <ide> def _caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_deleteServer(self, method, url, body, headers): <ide> request = ET.fromstring(body) <ide> if request.tag != "{urn:didata.com:api:cloud:types}deleteServer": <ide> raise InvalidRequestError(request.tag) <ide> body = self.fixtures.load( <del> 'caas_2_1_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_deleteServer.xml') <add> 'caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_deleteServer.xml') <ide> return (httplib.OK, body, {}, httplib.responses[httplib.OK]) <ide> <ide> def _caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_deleteServer_INPROGRESS(self, method, url, body, headers): <ide> request = ET.fromstring(body) <ide> if request.tag != "{urn:didata.com:api:cloud:types}deleteServer": <ide> raise InvalidRequestError(request.tag) <ide> body = self.fixtures.load( <del> 'caas_2_1_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_deleteServer_RESOURCEBUSY.xml') <add> 'caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_deleteServer_RESOURCEBUSY.xml') <ide> return (httplib.BAD_REQUEST, body, {}, httplib.responses[httplib.OK]) <ide> <ide> def _caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_rebootServer(self, method, url, body, headers): <ide> request = ET.fromstring(body) <ide> if request.tag != "{urn:didata.com:api:cloud:types}rebootServer": <ide> raise InvalidRequestError(request.tag) <ide> body = self.fixtures.load( <del> 'caas_2_1_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_rebootServer.xml') <add> 'caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_rebootServer.xml') <ide> return (httplib.OK, body, {}, httplib.responses[httplib.OK]) <ide> <ide> def _caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_rebootServer_INPROGRESS(self, method, url, body, headers): <ide> request = ET.fromstring(body) <ide> if request.tag != "{urn:didata.com:api:cloud:types}rebootServer": <ide> raise InvalidRequestError(request.tag) <ide> body = self.fixtures.load( <del> 'caas_2_1_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_rebootServer_RESOURCEBUSY.xml') <add> 'caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_rebootServer_RESOURCEBUSY.xml') <ide> return (httplib.BAD_REQUEST, body, {}, httplib.responses[httplib.OK]) <ide> <ide> def _caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_server(self, method, url, body, headers): <ide> if url.endswith('datacenterId=NA3'): <ide> body = self.fixtures.load( <del> 'caas_2_1_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_server_NA3.xml') <add> 'caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_server_NA3.xml') <ide> return (httplib.OK, body, {}, httplib.responses[httplib.OK]) <ide> <ide> body = self.fixtures.load( <del> 'caas_2_1_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_server.xml') <add> 'caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_server.xml') <ide> return (httplib.OK, body, {}, httplib.responses[httplib.OK]) <ide> <ide> def _caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_server_PAGESIZE50(self, method, url, body, headers): <ide> if not url.endswith('pageSize=50'): <ide> raise ValueError("pageSize is not set as expected") <ide> body = self.fixtures.load( <del> 'caas_2_1_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_server.xml') <add> 'caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_server.xml') <ide> return (httplib.OK, body, {}, httplib.responses[httplib.OK]) <ide> <ide> def _caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_server_PAGINATED(self, method, url, body, headers): <ide> if 'pageNumber=2' in url: <ide> body = self.fixtures.load( <del> 'caas_2_1_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_server.xml') <add> 'caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_server.xml') <ide> return (httplib.OK, body, {}, httplib.responses[httplib.OK]) <ide> else: <ide> body = self.fixtures.load( <del> 'caas_2_1_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_server_paginated.xml') <add> 'caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_server_paginated.xml') <ide> return (httplib.OK, body, {}, httplib.responses[httplib.OK]) <ide> <ide> def _caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_server_ALLFILTERS(self, method, url, body, headers): <ide> def _caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_server_ALLFILTERS(self <ide> else: <ide> raise ValueError("Could not find in url parameters {0}:{1}".format(key, value)) <ide> body = self.fixtures.load( <del> 'caas_2_1_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_server.xml') <add> 'caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_server.xml') <ide> return (httplib.OK, body, {}, httplib.responses[httplib.OK]) <ide> <ide> def _caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_antiAffinityRule(self, method, url, body, headers): <ide> body = self.fixtures.load( <del> 'caas_2_1_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_antiAffinityRule_list.xml' <add> 'caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_antiAffinityRule_list.xml' <ide> ) <ide> return (httplib.OK, body, {}, httplib.responses[httplib.OK]) <ide> <ide> def _caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_antiAffinityRule_ALLFI <ide> else: <ide> raise ValueError("Could not find in url parameters {0}:{1}".format(key, value)) <ide> body = self.fixtures.load( <del> 'caas_2_1_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_antiAffinityRule_list.xml' <add> 'caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_antiAffinityRule_list.xml' <ide> ) <ide> return (httplib.OK, body, {}, httplib.responses[httplib.OK]) <ide> <ide> def _caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_antiAffinityRule_PAGINATED(self, method, url, body, headers): <ide> if 'pageNumber=2' in url: <ide> body = self.fixtures.load( <del> 'caas_2_1_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_antiAffinityRule_list.xml') <add> 'caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_antiAffinityRule_list.xml') <ide> return (httplib.OK, body, {}, httplib.responses[httplib.OK]) <ide> else: <ide> body = self.fixtures.load( <del> 'caas_2_1_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_antiAffinityRule_list_PAGINATED.xml') <add> 'caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_antiAffinityRule_list_PAGINATED.xml') <ide> return (httplib.OK, body, {}, httplib.responses[httplib.OK]) <ide> <ide> def _caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_infrastructure_datacenter(self, method, url, body, headers): <ide> if url.endswith('id=NA9'): <ide> body = self.fixtures.load( <del> 'caas_2_1_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_infrastructure_datacenter_NA9.xml') <add> 'caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_infrastructure_datacenter_NA9.xml') <ide> return (httplib.OK, body, {}, httplib.responses[httplib.OK]) <ide> <ide> body = self.fixtures.load( <del> 'caas_2_1_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_infrastructure_datacenter.xml') <add> 'caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_infrastructure_datacenter.xml') <ide> return (httplib.OK, body, {}, httplib.responses[httplib.OK]) <ide> <ide> def _caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_infrastructure_datacenter_ALLFILTERS(self, method, url, body, headers): <ide> if url.endswith('id=NA9'): <ide> body = self.fixtures.load( <del> 'caas_2_1_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_infrastructure_datacenter_NA9.xml') <add> 'caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_infrastructure_datacenter_NA9.xml') <ide> return (httplib.OK, body, {}, httplib.responses[httplib.OK]) <ide> <ide> body = self.fixtures.load( <del> 'caas_2_1_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_infrastructure_datacenter.xml') <add> 'caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_infrastructure_datacenter.xml') <ide> return (httplib.OK, body, {}, httplib.responses[httplib.OK]) <ide> <ide> def _caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_updateVmwareTools(self, method, url, body, headers): <ide> request = ET.fromstring(body) <ide> if request.tag != "{urn:didata.com:api:cloud:types}updateVmwareTools": <ide> raise InvalidRequestError(request.tag) <ide> body = self.fixtures.load( <del> 'caas_2_1_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_updateVmwareTools.xml') <add> 'caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_updateVmwareTools.xml') <ide> return (httplib.OK, body, {}, httplib.responses[httplib.OK]) <ide> <ide> def _caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_startServer(self, method, url, body, headers): <ide> request = ET.fromstring(body) <ide> if request.tag != "{urn:didata.com:api:cloud:types}startServer": <ide> raise InvalidRequestError(request.tag) <ide> body = self.fixtures.load( <del> 'caas_2_1_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_startServer.xml') <add> 'caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_startServer.xml') <ide> return (httplib.OK, body, {}, httplib.responses[httplib.OK]) <ide> <ide> def _caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_startServer_INPROGRESS(self, method, url, body, headers): <ide> request = ET.fromstring(body) <ide> if request.tag != "{urn:didata.com:api:cloud:types}startServer": <ide> raise InvalidRequestError(request.tag) <ide> body = self.fixtures.load( <del> 'caas_2_1_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_startServer_INPROGRESS.xml') <add> 'caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_startServer_INPROGRESS.xml') <ide> return (httplib.BAD_REQUEST, body, {}, httplib.responses[httplib.OK]) <ide> <ide> def _caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_shutdownServer(self, method, url, body, headers): <ide> request = ET.fromstring(body) <ide> if request.tag != "{urn:didata.com:api:cloud:types}shutdownServer": <ide> raise InvalidRequestError(request.tag) <ide> body = self.fixtures.load( <del> 'caas_2_1_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_shutdownServer.xml') <add> 'caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_shutdownServer.xml') <ide> return (httplib.OK, body, {}, httplib.responses[httplib.OK]) <ide> <ide> def _caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_shutdownServer_INPROGRESS(self, method, url, body, headers): <ide> request = ET.fromstring(body) <ide> if request.tag != "{urn:didata.com:api:cloud:types}shutdownServer": <ide> raise InvalidRequestError(request.tag) <ide> body = self.fixtures.load( <del> 'caas_2_1_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_shutdownServer_INPROGRESS.xml') <add> 'caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_shutdownServer_INPROGRESS.xml') <ide> return (httplib.BAD_REQUEST, body, {}, httplib.responses[httplib.OK]) <ide> <ide> def _caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_resetServer(self, method, url, body, headers): <ide> request = ET.fromstring(body) <ide> if request.tag != "{urn:didata.com:api:cloud:types}resetServer": <ide> raise InvalidRequestError(request.tag) <ide> body = self.fixtures.load( <del> 'caas_2_1_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_resetServer.xml') <add> 'caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_resetServer.xml') <ide> return (httplib.OK, body, {}, httplib.responses[httplib.OK]) <ide> <ide> def _caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_powerOffServer(self, method, url, body, headers): <ide> request = ET.fromstring(body) <ide> if request.tag != "{urn:didata.com:api:cloud:types}powerOffServer": <ide> raise InvalidRequestError(request.tag) <ide> body = self.fixtures.load( <del> 'caas_2_1_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_powerOffServer.xml') <add> 'caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_powerOffServer.xml') <ide> return (httplib.OK, body, {}, httplib.responses[httplib.OK]) <ide> <ide> def _caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_powerOffServer_INPROGRESS(self, method, url, body, headers): <ide> request = ET.fromstring(body) <ide> if request.tag != "{urn:didata.com:api:cloud:types}powerOffServer": <ide> raise InvalidRequestError(request.tag) <ide> body = self.fixtures.load( <del> 'caas_2_1_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_powerOffServer_INPROGRESS.xml') <add> 'caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_powerOffServer_INPROGRESS.xml') <ide> return (httplib.BAD_REQUEST, body, {}, httplib.responses[httplib.OK]) <ide> <ide> def _caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_network_networkDomain(self, method, url, body, headers): <ide> body = self.fixtures.load( <del> 'caas_2_1_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_network_networkDomain.xml') <add> 'caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_network_networkDomain.xml') <ide> return (httplib.OK, body, {}, httplib.responses[httplib.OK]) <ide> <ide> def _caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_network_networkDomain_ALLFILTERS(self, method, url, body, headers): <ide> def _caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_network_networkDomain_ALLFILT <ide> else: <ide> raise ValueError("Could not find in url parameters {0}:{1}".format(key, value)) <ide> body = self.fixtures.load( <del> 'caas_2_1_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_network_networkDomain.xml') <add> 'caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_network_networkDomain.xml') <ide> return (httplib.OK, body, {}, httplib.responses[httplib.OK]) <ide> <ide> def _caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_network_vlan(self, method, url, body, headers): <ide> body = self.fixtures.load( <del> 'caas_2_1_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_network_vlan.xml') <add> 'caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_network_vlan.xml') <ide> return (httplib.OK, body, {}, httplib.responses[httplib.OK]) <ide> <ide> def _caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_network_vlan_ALLFILTERS(self, method, url, body, headers): <ide> def _caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_network_vlan_ALLFILTERS(self, <ide> else: <ide> raise ValueError("Could not find in url parameters {0}:{1}".format(key, value)) <ide> body = self.fixtures.load( <del> 'caas_2_1_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_network_vlan.xml') <add> 'caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_network_vlan.xml') <ide> return (httplib.OK, body, {}, httplib.responses[httplib.OK]) <ide> <ide> def _caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_deployServer(self, method, url, body, headers): <ide> def _caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_deployServer(self, met <ide> raise InvalidRequestError('Invalid request, does not have network or network_info in XML') <ide> <ide> body = self.fixtures.load( <del> 'caas_2_1_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_deployServer.xml') <add> 'caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_deployServer.xml') <ide> return (httplib.OK, body, {}, httplib.responses[httplib.OK]) <ide> <ide> def _caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_server_e75ead52_692f_4314_8725_c8a4f4d13a87(self, method, url, body, headers): <ide> body = self.fixtures.load( <del> 'caas_2_1_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_server_e75ead52_692f_4314_8725_c8a4f4d13a87.xml') <add> 'caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_server_e75ead52_692f_4314_8725_c8a4f4d13a87.xml') <ide> return (httplib.OK, body, {}, httplib.responses[httplib.OK]) <ide> <ide> def _caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_network_deployNetworkDomain(self, method, url, body, headers): <ide> request = ET.fromstring(body) <ide> if request.tag != "{urn:didata.com:api:cloud:types}deployNetworkDomain": <ide> raise InvalidRequestError(request.tag) <ide> body = self.fixtures.load( <del> 'caas_2_1_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_network_deployNetworkDomain.xml') <add> 'caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_network_deployNetworkDomain.xml') <ide> return (httplib.OK, body, {}, httplib.responses[httplib.OK]) <ide> <ide> def _caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_network_networkDomain_8cdfd607_f429_4df6_9352_162cfc0891be(self, method, url, body, headers): <ide> body = self.fixtures.load( <del> 'caas_2_1_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_network_networkDomain_8cdfd607_f429_4df6_9352_162cfc0891be.xml') <add> 'caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_network_networkDomain_8cdfd607_f429_4df6_9352_162cfc0891be.xml') <ide> return (httplib.OK, body, {}, httplib.responses[httplib.OK]) <ide> <ide> def _caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_network_networkDomain_8cdfd607_f429_4df6_9352_162cfc0891be_ALLFILTERS(self, method, url, body, headers): <ide> body = self.fixtures.load( <del> 'caas_2_1_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_network_networkDomain_8cdfd607_f429_4df6_9352_162cfc0891be.xml') <add> 'caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_network_networkDomain_8cdfd607_f429_4df6_9352_162cfc0891be.xml') <ide> return (httplib.OK, body, {}, httplib.responses[httplib.OK]) <ide> <ide> def _caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_network_editNetworkDomain(self, method, url, body, headers): <ide> request = ET.fromstring(body) <ide> if request.tag != "{urn:didata.com:api:cloud:types}editNetworkDomain": <ide> raise InvalidRequestError(request.tag) <ide> body = self.fixtures.load( <del> 'caas_2_1_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_network_editNetworkDomain.xml') <add> 'caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_network_editNetworkDomain.xml') <ide> return (httplib.OK, body, {}, httplib.responses[httplib.OK]) <ide> <ide> def _caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_network_deleteNetworkDomain(self, method, url, body, headers): <ide> request = ET.fromstring(body) <ide> if request.tag != "{urn:didata.com:api:cloud:types}deleteNetworkDomain": <ide> raise InvalidRequestError(request.tag) <ide> body = self.fixtures.load( <del> 'caas_2_1_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_network_deleteNetworkDomain.xml') <add> 'caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_network_deleteNetworkDomain.xml') <ide> return (httplib.OK, body, {}, httplib.responses[httplib.OK]) <ide> <ide> def _caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_network_deployVlan(self, method, url, body, headers): <ide> request = ET.fromstring(body) <ide> if request.tag != "{urn:didata.com:api:cloud:types}deployVlan": <ide> raise InvalidRequestError(request.tag) <ide> body = self.fixtures.load( <del> 'caas_2_1_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_network_deployVlan.xml') <add> 'caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_network_deployVlan.xml') <ide> return (httplib.OK, body, {}, httplib.responses[httplib.OK]) <ide> <ide> def _caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_network_vlan_0e56433f_d808_4669_821d_812769517ff8(self, method, url, body, headers): <ide> body = self.fixtures.load( <del> 'caas_2_1_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_network_vlan_0e56433f_d808_4669_821d_812769517ff8.xml') <add> 'caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_network_vlan_0e56433f_d808_4669_821d_812769517ff8.xml') <ide> return (httplib.OK, body, {}, httplib.responses[httplib.OK]) <ide> <ide> def _caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_network_editVlan(self, method, url, body, headers): <ide> request = ET.fromstring(body) <ide> if request.tag != "{urn:didata.com:api:cloud:types}editVlan": <ide> raise InvalidRequestError(request.tag) <ide> body = self.fixtures.load( <del> 'caas_2_1_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_network_editVlan.xml') <add> 'caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_network_editVlan.xml') <ide> return (httplib.OK, body, {}, httplib.responses[httplib.OK]) <ide> <ide> def _caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_network_deleteVlan(self, method, url, body, headers): <ide> request = ET.fromstring(body) <ide> if request.tag != "{urn:didata.com:api:cloud:types}deleteVlan": <ide> raise InvalidRequestError(request.tag) <ide> body = self.fixtures.load( <del> 'caas_2_1_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_network_deleteVlan.xml') <add> 'caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_network_deleteVlan.xml') <ide> return (httplib.OK, body, {}, httplib.responses[httplib.OK]) <ide> <ide> def _caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_network_expandVlan(self, method, url, body, headers): <ide> request = ET.fromstring(body) <ide> if request.tag != "{urn:didata.com:api:cloud:types}expandVlan": <ide> raise InvalidRequestError(request.tag) <ide> body = self.fixtures.load( <del> 'caas_2_1_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_network_expandVlan.xml') <add> 'caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_network_expandVlan.xml') <ide> return (httplib.OK, body, {}, httplib.responses[httplib.OK]) <ide> <ide> def _caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_network_addPublicIpBlock(self, method, url, body, headers): <ide> request = ET.fromstring(body) <ide> if request.tag != "{urn:didata.com:api:cloud:types}addPublicIpBlock": <ide> raise InvalidRequestError(request.tag) <ide> body = self.fixtures.load( <del> 'caas_2_1_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_network_addPublicIpBlock.xml') <add> 'caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_network_addPublicIpBlock.xml') <ide> return (httplib.OK, body, {}, httplib.responses[httplib.OK]) <ide> <ide> def _caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_network_publicIpBlock_4487241a_f0ca_11e3_9315_d4bed9b167ba(self, method, url, body, headers): <ide> body = self.fixtures.load( <del> 'caas_2_1_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_network_publicIpBlock_4487241a_f0ca_11e3_9315_d4bed9b167ba.xml') <add> 'caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_network_publicIpBlock_4487241a_f0ca_11e3_9315_d4bed9b167ba.xml') <ide> return (httplib.OK, body, {}, httplib.responses[httplib.OK]) <ide> <ide> def _caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_network_publicIpBlock(self, method, url, body, headers): <ide> body = self.fixtures.load( <del> 'caas_2_1_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_network_publicIpBlock.xml') <add> 'caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_network_publicIpBlock.xml') <ide> return (httplib.OK, body, {}, httplib.responses[httplib.OK]) <ide> <ide> def _caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_network_publicIpBlock_9945dc4a_bdce_11e4_8c14_b8ca3a5d9ef8(self, method, url, body, headers): <ide> body = self.fixtures.load( <del> 'caas_2_1_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_network_publicIpBlock_9945dc4a_bdce_11e4_8c14_b8ca3a5d9ef8.xml') <add> 'caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_network_publicIpBlock_9945dc4a_bdce_11e4_8c14_b8ca3a5d9ef8.xml') <ide> return (httplib.OK, body, {}, httplib.responses[httplib.OK]) <ide> <ide> def _caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_network_removePublicIpBlock(self, method, url, body, headers): <ide> request = ET.fromstring(body) <ide> if request.tag != "{urn:didata.com:api:cloud:types}removePublicIpBlock": <ide> raise InvalidRequestError(request.tag) <ide> body = self.fixtures.load( <del> 'caas_2_1_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_network_removePublicIpBlock.xml') <add> 'caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_network_removePublicIpBlock.xml') <ide> return (httplib.OK, body, {}, httplib.responses[httplib.OK]) <ide> <ide> def _caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_network_firewallRule(self, method, url, body, headers): <ide> body = self.fixtures.load( <del> 'caas_2_1_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_network_firewallRule.xml') <add> 'caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_network_firewallRule.xml') <ide> return (httplib.OK, body, {}, httplib.responses[httplib.OK]) <ide> <ide> def _caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_network_createFirewallRule(self, method, url, body, headers): <ide> request = ET.fromstring(body) <ide> if request.tag != "{urn:didata.com:api:cloud:types}createFirewallRule": <ide> raise InvalidRequestError(request.tag) <ide> body = self.fixtures.load( <del> 'caas_2_1_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_network_createFirewallRule.xml') <add> 'caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_network_createFirewallRule.xml') <ide> return (httplib.OK, body, {}, httplib.responses[httplib.OK]) <ide> <ide> def _caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_network_firewallRule_d0a20f59_77b9_4f28_a63b_e58496b73a6c(self, method, url, body, headers): <ide> body = self.fixtures.load( <del> 'caas_2_1_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_network_firewallRule_d0a20f59_77b9_4f28_a63b_e58496b73a6c.xml') <add> 'caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_network_firewallRule_d0a20f59_77b9_4f28_a63b_e58496b73a6c.xml') <ide> return (httplib.OK, body, {}, httplib.responses[httplib.OK]) <ide> <ide> def _caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_network_editFirewallRule(self, method, url, body, headers): <ide> request = ET.fromstring(body) <ide> if request.tag != "{urn:didata.com:api:cloud:types}editFirewallRule": <ide> raise InvalidRequestError(request.tag) <ide> body = self.fixtures.load( <del> 'caas_2_1_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_network_editFirewallRule.xml') <add> 'caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_network_editFirewallRule.xml') <ide> return (httplib.OK, body, {}, httplib.responses[httplib.OK]) <ide> <ide> def _caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_network_deleteFirewallRule(self, method, url, body, headers): <ide> request = ET.fromstring(body) <ide> if request.tag != "{urn:didata.com:api:cloud:types}deleteFirewallRule": <ide> raise InvalidRequestError(request.tag) <ide> body = self.fixtures.load( <del> 'caas_2_1_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_network_deleteFirewallRule.xml') <add> 'caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_network_deleteFirewallRule.xml') <ide> return (httplib.OK, body, {}, httplib.responses[httplib.OK]) <ide> <ide> def _caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_network_createNatRule(self, method, url, body, headers): <ide> request = ET.fromstring(body) <ide> if request.tag != "{urn:didata.com:api:cloud:types}createNatRule": <ide> raise InvalidRequestError(request.tag) <ide> body = self.fixtures.load( <del> 'caas_2_1_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_network_createNatRule.xml') <add> 'caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_network_createNatRule.xml') <ide> return (httplib.OK, body, {}, httplib.responses[httplib.OK]) <ide> <ide> def _caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_network_natRule(self, method, url, body, headers): <ide> body = self.fixtures.load( <del> 'caas_2_1_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_network_natRule.xml') <add> 'caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_network_natRule.xml') <ide> return (httplib.OK, body, {}, httplib.responses[httplib.OK]) <ide> <ide> def _caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_network_natRule_2187a636_7ebb_49a1_a2ff_5d617f496dce(self, method, url, body, headers): <ide> body = self.fixtures.load( <del> 'caas_2_1_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_network_natRule_2187a636_7ebb_49a1_a2ff_5d617f496dce.xml') <add> 'caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_network_natRule_2187a636_7ebb_49a1_a2ff_5d617f496dce.xml') <ide> return (httplib.OK, body, {}, httplib.responses[httplib.OK]) <ide> <ide> def _caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_network_deleteNatRule(self, method, url, body, headers): <ide> request = ET.fromstring(body) <ide> if request.tag != "{urn:didata.com:api:cloud:types}deleteNatRule": <ide> raise InvalidRequestError(request.tag) <ide> body = self.fixtures.load( <del> 'caas_2_1_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_network_deleteNatRule.xml') <add> 'caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_network_deleteNatRule.xml') <ide> return (httplib.OK, body, {}, httplib.responses[httplib.OK]) <ide> <ide> def _caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_addNic(self, method, url, body, headers): <ide> request = ET.fromstring(body) <ide> if request.tag != "{urn:didata.com:api:cloud:types}addNic": <ide> raise InvalidRequestError(request.tag) <ide> body = self.fixtures.load( <del> 'caas_2_1_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_addNic.xml') <add> 'caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_addNic.xml') <ide> return (httplib.OK, body, {}, httplib.responses[httplib.OK]) <ide> <ide> def _caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_removeNic(self, method, url, body, headers): <ide> request = ET.fromstring(body) <ide> if request.tag != "{urn:didata.com:api:cloud:types}removeNic": <ide> raise InvalidRequestError(request.tag) <ide> body = self.fixtures.load( <del> 'caas_2_1_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_removeNic.xml') <add> 'caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_removeNic.xml') <ide> return (httplib.OK, body, {}, httplib.responses[httplib.OK]) <ide> <ide> def _caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_disableServerMonitoring(self, method, url, body, headers): <ide> request = ET.fromstring(body) <ide> if request.tag != "{urn:didata.com:api:cloud:types}disableServerMonitoring": <ide> raise InvalidRequestError(request.tag) <ide> body = self.fixtures.load( <del> 'caas_2_1_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_disableServerMonitoring.xml') <add> 'caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_disableServerMonitoring.xml') <ide> return (httplib.OK, body, {}, httplib.responses[httplib.OK]) <ide> <ide> def _caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_enableServerMonitoring(self, method, url, body, headers): <ide> request = ET.fromstring(body) <ide> if request.tag != "{urn:didata.com:api:cloud:types}enableServerMonitoring": <ide> raise InvalidRequestError(request.tag) <ide> body = self.fixtures.load( <del> 'caas_2_1_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_enableServerMonitoring.xml') <add> 'caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_enableServerMonitoring.xml') <ide> return (httplib.OK, body, {}, httplib.responses[httplib.OK]) <ide> <ide> def _caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_changeServerMonitoringPlan(self, method, url, body, headers): <ide> request = ET.fromstring(body) <ide> if request.tag != "{urn:didata.com:api:cloud:types}changeServerMonitoringPlan": <ide> raise InvalidRequestError(request.tag) <ide> body = self.fixtures.load( <del> 'caas_2_1_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_changeServerMonitoringPlan.xml') <add> 'caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_changeServerMonitoringPlan.xml') <ide> return (httplib.OK, body, {}, httplib.responses[httplib.OK]) <ide> <ide> def _caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_image_osImage(self, method, url, body, headers): <ide> body = self.fixtures.load( <del> 'caas_2_1_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_image_osImage.xml') <add> 'caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_image_osImage.xml') <ide> return (httplib.OK, body, {}, httplib.responses[httplib.OK]) <ide> <ide> def _caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_image_osImage_c14b1a46_2428_44c1_9c1a_b20e6418d08c(self, method, url, body, headers): <ide> body = self.fixtures.load( <del> 'caas_2_1_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_image_osImage_c14b1a46_2428_44c1_9c1a_b20e6418d08c.xml') <add> 'caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_image_osImage_c14b1a46_2428_44c1_9c1a_b20e6418d08c.xml') <ide> return (httplib.OK, body, {}, httplib.responses[httplib.OK]) <ide> <ide> def _caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_image_osImage_6b4fb0c7_a57b_4f58_b59c_9958f94f971a(self, method, url, body, headers): <ide> body = self.fixtures.load( <del> 'caas_2_1_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_image_osImage_6b4fb0c7_a57b_4f58_b59c_9958f94f971a.xml') <add> 'caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_image_osImage_6b4fb0c7_a57b_4f58_b59c_9958f94f971a.xml') <ide> return (httplib.OK, body, {}, httplib.responses[httplib.OK]) <ide> <ide> def _caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_image_osImage_5234e5c7_01de_4411_8b6e_baeb8d91cf5d(self, method, url, body, headers): <ide> body = self.fixtures.load( <del> 'caas_2_1_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_image_osImage_BAD_REQUEST.xml') <add> 'caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_image_osImage_BAD_REQUEST.xml') <ide> return (httplib.BAD_REQUEST, body, {}, httplib.responses[httplib.OK]) <ide> <ide> def _caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_image_osImage_2ffa36c8_1848_49eb_b4fa_9d908775f68c(self, method, url, body, headers): <ide> body = self.fixtures.load( <del> 'caas_2_1_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_image_osImage_BAD_REQUEST.xml') <add> 'caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_image_osImage_BAD_REQUEST.xml') <ide> return (httplib.BAD_REQUEST, body, {}, httplib.responses[httplib.OK]) <ide> <ide> def _caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_image_osImage_FAKE_IMAGE_ID(self, method, url, body, headers): <ide> body = self.fixtures.load( <del> 'caas_2_1_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_image_osImage_BAD_REQUEST.xml') <add> 'caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_image_osImage_BAD_REQUEST.xml') <ide> return (httplib.BAD_REQUEST, body, {}, httplib.responses[httplib.OK]) <ide> <ide> def _caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_image_customerImage(self, method, url, body, headers): <ide> body = self.fixtures.load( <del> 'caas_2_1_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_image_customerImage.xml') <add> 'caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_image_customerImage.xml') <ide> return (httplib.OK, body, {}, httplib.responses[httplib.OK]) <ide> <ide> def _caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_image_customerImage_5234e5c7_01de_4411_8b6e_baeb8d91cf5d(self, method, url, body, headers): <ide> body = self.fixtures.load( <del> 'caas_2_1_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_image_customerImage_5234e5c7_01de_4411_8b6e_baeb8d91cf5d.xml') <add> 'caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_image_customerImage_5234e5c7_01de_4411_8b6e_baeb8d91cf5d.xml') <ide> return (httplib.OK, body, {}, httplib.responses[httplib.OK]) <ide> <ide> def _caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_image_customerImage_2ffa36c8_1848_49eb_b4fa_9d908775f68c(self, method, url, body, headers): <ide> body = self.fixtures.load( <del> 'caas_2_1_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_image_customerImage_2ffa36c8_1848_49eb_b4fa_9d908775f68c.xml') <add> 'caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_image_customerImage_2ffa36c8_1848_49eb_b4fa_9d908775f68c.xml') <ide> return (httplib.OK, body, {}, httplib.responses[httplib.OK]) <ide> <ide> def _caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_image_customerImage_FAKE_IMAGE_ID(self, method, url, body, headers): <ide> body = self.fixtures.load( <del> 'caas_2_1_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_image_customerImage_BAD_REQUEST.xml') <add> 'caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_image_customerImage_BAD_REQUEST.xml') <ide> return (httplib.BAD_REQUEST, body, {}, httplib.responses[httplib.OK]) <ide> <ide> def _caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_reconfigureServer(self, method, url, body, headers): <ide> request = ET.fromstring(body) <ide> if request.tag != "{urn:didata.com:api:cloud:types}reconfigureServer": <ide> raise InvalidRequestError(request.tag) <ide> body = self.fixtures.load( <del> 'caas_2_1_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_reconfigureServer.xml') <add> 'caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_reconfigureServer.xml') <ide> return (httplib.OK, body, {}, httplib.responses[httplib.OK]) <ide> <ide> def _caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_cleanServer(self, method, url, body, headers): <ide> body = self.fixtures.load( <del> 'caas_2_1_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_cleanServer.xml') <add> 'caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_cleanServer.xml') <ide> return (httplib.OK, body, {}, httplib.responses[httplib.OK]) <ide> <ide> if __name__ == '__main__': <ide><path>libcloud/test/loadbalancer/test_dimensiondata.py <ide> def _oec_0_9_myaccount_INPROGRESS(self, method, url, body, headers): <ide> <ide> def _caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_networkDomainVip_virtualListener(self, method, url, body, headers): <ide> body = self.fixtures.load( <del> 'caas_2_1_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_networkDomainVip_virtualListener.xml') <add> 'caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_networkDomainVip_virtualListener.xml') <ide> return (httplib.OK, body, {}, httplib.responses[httplib.OK]) <ide> <ide> def _caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_networkDomainVip_virtualListener_6115469d_a8bb_445b_bb23_d23b5283f2b9(self, method, url, body, headers): <ide> body = self.fixtures.load( <del> 'caas_2_1_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_networkDomainVip_virtualListener_6115469d_a8bb_445b_bb23_d23b5283f2b9.xml') <add> 'caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_networkDomainVip_virtualListener_6115469d_a8bb_445b_bb23_d23b5283f2b9.xml') <ide> return (httplib.OK, body, {}, httplib.responses[httplib.OK]) <ide> <ide> def _caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_networkDomainVip_pool(self, method, url, body, headers): <ide> body = self.fixtures.load( <del> 'caas_2_1_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_networkDomainVip_pool.xml') <add> 'caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_networkDomainVip_pool.xml') <ide> return (httplib.OK, body, {}, httplib.responses[httplib.OK]) <ide> <ide> def _caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_networkDomainVip_pool_4d360b1f_bc2c_4ab7_9884_1f03ba2768f7(self, method, url, body, headers): <ide> body = self.fixtures.load( <del> 'caas_2_1_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_networkDomainVip_pool_4d360b1f_bc2c_4ab7_9884_1f03ba2768f7.xml') <add> 'caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_networkDomainVip_pool_4d360b1f_bc2c_4ab7_9884_1f03ba2768f7.xml') <ide> return (httplib.OK, body, {}, httplib.responses[httplib.OK]) <ide> <ide> def _caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_networkDomainVip_poolMember(self, method, url, body, headers): <ide> body = self.fixtures.load( <del> 'caas_2_1_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_networkDomainVip_poolMember.xml') <add> 'caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_networkDomainVip_poolMember.xml') <ide> return (httplib.OK, body, {}, httplib.responses[httplib.OK]) <ide> <ide> def _caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_networkDomainVip_poolMember_3dd806a2_c2c8_4c0c_9a4f_5219ea9266c0(self, method, url, body, headers): <ide> body = self.fixtures.load( <del> 'caas_2_1_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_networkDomainVip_poolMember_3dd806a2_c2c8_4c0c_9a4f_5219ea9266c0.xml') <add> 'caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_networkDomainVip_poolMember_3dd806a2_c2c8_4c0c_9a4f_5219ea9266c0.xml') <ide> return (httplib.OK, body, {}, httplib.responses[httplib.OK]) <ide> <ide> def _caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_networkDomainVip_createPool(self, method, url, body, headers): <ide> body = self.fixtures.load( <del> 'caas_2_1_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_networkDomainVip_createPool.xml') <add> 'caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_networkDomainVip_createPool.xml') <ide> return (httplib.OK, body, {}, httplib.responses[httplib.OK]) <ide> <ide> def _caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_networkDomainVip_createNode(self, method, url, body, headers): <ide> body = self.fixtures.load( <del> 'caas_2_1_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_networkDomainVip_createNode.xml') <add> 'caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_networkDomainVip_createNode.xml') <ide> return (httplib.OK, body, {}, httplib.responses[httplib.OK]) <ide> <ide> def _caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_networkDomainVip_addPoolMember(self, method, url, body, headers): <ide> body = self.fixtures.load( <del> 'caas_2_1_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_networkDomainVip_addPoolMember.xml') <add> 'caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_networkDomainVip_addPoolMember.xml') <ide> return (httplib.OK, body, {}, httplib.responses[httplib.OK]) <ide> <ide> def _caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_networkDomainVip_createVirtualListener(self, method, url, body, headers): <ide> body = self.fixtures.load( <del> 'caas_2_1_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_networkDomainVip_createVirtualListener.xml') <add> 'caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_networkDomainVip_createVirtualListener.xml') <ide> return (httplib.OK, body, {}, httplib.responses[httplib.OK]) <ide> <ide> def _caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_networkDomainVip_removePoolMember(self, method, url, body, headers): <ide> body = self.fixtures.load( <del> 'caas_2_1_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_networkDomainVip_removePoolMember.xml') <add> 'caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_networkDomainVip_removePoolMember.xml') <ide> return (httplib.OK, body, {}, httplib.responses[httplib.OK]) <ide> <ide> def _caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_networkDomainVip_deleteVirtualListener(self, method, url, body, headers): <ide> body = self.fixtures.load( <del> 'caas_2_1_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_networkDomainVip_deleteVirtualListener.xml') <add> 'caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_networkDomainVip_deleteVirtualListener.xml') <ide> return (httplib.OK, body, {}, httplib.responses[httplib.OK]) <ide> <ide> def _caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_networkDomainVip_deletePool(self, method, url, body, headers): <ide> body = self.fixtures.load( <del> 'caas_2_1_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_networkDomainVip_deletePool.xml') <add> 'caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_networkDomainVip_deletePool.xml') <ide> return (httplib.OK, body, {}, httplib.responses[httplib.OK]) <ide> <ide> def _caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_networkDomainVip_deleteNode(self, method, url, body, headers): <ide> body = self.fixtures.load( <del> 'caas_2_1_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_networkDomainVip_deleteNode.xml') <add> 'caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_networkDomainVip_deleteNode.xml') <ide> return (httplib.OK, body, {}, httplib.responses[httplib.OK]) <ide> <ide> def _caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_networkDomainVip_node(self, method, url, body, headers): <ide> body = self.fixtures.load( <del> 'caas_2_1_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_networkDomainVip_node.xml') <add> 'caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_networkDomainVip_node.xml') <ide> return (httplib.OK, body, {}, httplib.responses[httplib.OK]) <ide> <ide> def _caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_networkDomainVip_node_34de6ed6_46a4_4dae_a753_2f8d3840c6f9(self, method, url, body, headers): <ide> body = self.fixtures.load( <del> 'caas_2_1_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_networkDomainVip_node_34de6ed6_46a4_4dae_a753_2f8d3840c6f9.xml') <add> 'caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_networkDomainVip_node_34de6ed6_46a4_4dae_a753_2f8d3840c6f9.xml') <ide> return (httplib.OK, body, {}, httplib.responses[httplib.OK]) <ide> <ide> def _caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_networkDomainVip_editNode(self, method, url, body, headers): <ide> body = self.fixtures.load( <del> 'caas_2_1_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_networkDomainVip_editNode.xml') <add> 'caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_networkDomainVip_editNode.xml') <ide> return (httplib.OK, body, {}, httplib.responses[httplib.OK]) <ide> <ide> def _caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_networkDomainVip_editPool(self, method, url, body, headers): <ide> body = self.fixtures.load( <del> 'caas_2_1_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_networkDomainVip_editPool.xml') <add> 'caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_networkDomainVip_editPool.xml') <ide> return (httplib.OK, body, {}, httplib.responses[httplib.OK]) <ide> <ide> def _caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_networkDomainVip_editPoolMember(self, method, url, body, headers): <ide> body = self.fixtures.load( <del> 'caas_2_1_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_networkDomainVip_editPoolMember.xml') <add> 'caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_networkDomainVip_editPoolMember.xml') <ide> return (httplib.OK, body, {}, httplib.responses[httplib.OK]) <ide> <ide> def _caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_networkDomainVip_defaultHealthMonitor(self, method, url, body, headers): <ide> body = self.fixtures.load( <del> 'caas_2_1_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_networkDomainVip_defaultHealthMonitor.xml') <add> 'caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_networkDomainVip_defaultHealthMonitor.xml') <ide> return (httplib.OK, body, {}, httplib.responses[httplib.OK]) <ide> <ide> def _caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_networkDomainVip_defaultPersistenceProfile(self, method, url, body, headers): <ide> body = self.fixtures.load( <del> 'caas_2_1_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_networkDomainVip_defaultPersistenceProfile.xml') <add> 'caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_networkDomainVip_defaultPersistenceProfile.xml') <ide> return (httplib.OK, body, {}, httplib.responses[httplib.OK]) <ide> <ide> def _caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_networkDomainVip_defaultIrule(self, method, url, body, headers): <ide> body = self.fixtures.load( <del> 'caas_2_1_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_networkDomainVip_defaultIrule.xml') <add> 'caas_2_2_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_networkDomainVip_defaultIrule.xml') <ide> return (httplib.OK, body, {}, httplib.responses[httplib.OK]) <ide> <ide> if __name__ == '__main__':
3
PHP
PHP
expand docs for marshalling methods
1cc4b06db0cb1f31c8719bbb48ed05134e621349
<ide><path>Cake/ORM/Table.php <ide> public function marshaller($safe = false) { <ide> * on the primary key data existing in the database when the entity <ide> * is saved. Until the entity is saved, it will be a detached record. <ide> * <add> * By default all the associations on this table will be hydrated. You can <add> * limit which associations are built, or include deeper associations <add> * using the associations parameter: <add> * <add> * {{{ <add> * $articles = $this->Articles->newEntity( <add> * $this->request->data(), <add> * ['Tags', 'Comments' => ['User']] <add> * ); <add> * }}} <add> * <ide> * @param array $data The data to build an entity with. <ide> * @param array $associations A whitelist of associations <ide> * to hydrate. Defaults to all associations <ide> public function newEntity(array $data, $associations = null) { <ide> * $articles = $this->Articles->newEntities($this->request->data()); <ide> * }}} <ide> * <del> * The hydrated entities can the be iterated and saved. <add> * The hydrated entities can then be iterated and saved. By default <add> * all the associations on this table will be hydrated. You can <add> * limit which associations are built, or include deeper associations <add> * using the associations parameter: <add> * <add> * {{{ <add> * $articles = $this->Articles->newEntities( <add> * $this->request->data(), <add> * ['Tags', 'Comments' => ['User']] <add> * ); <add> * }}} <ide> * <ide> * @param array $data The data to build an entity with. <ide> * @param array $associations A whitelist of associations
1
Java
Java
add s/c retryuntil + marbles
0ed3572c8961dfdfa7dc73dd0419b5f789d1d1ad
<ide><path>src/main/java/io/reactivex/rxjava3/core/Completable.java <ide> public final Completable retry(@NonNull Predicate<? super Throwable> predicate) <ide> return fromPublisher(toFlowable().retry(predicate)); <ide> } <ide> <add> /** <add> * Retries until the given stop function returns {@code true}. <add> * <p> <add> * <img width="640" height="354" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/Completable.retryUntil.png" alt=""> <add> * <dl> <add> * <dt><b>Scheduler:</b></dt> <add> * <dd>{@code retryUntil} does not operate by default on a particular {@link Scheduler}.</dd> <add> * </dl> <add> * @param stop the function that should return {@code true} to stop retrying <add> * @return the new {@code Completable} instance <add> * @throws NullPointerException if {@code stop} is {@code null} <add> */ <add> @CheckReturnValue <add> @NonNull <add> @SchedulerSupport(SchedulerSupport.NONE) <add> public final Completable retryUntil(@NonNull BooleanSupplier stop) { <add> Objects.requireNonNull(stop, "stop is null"); <add> return retry(Long.MAX_VALUE, Functions.predicateReverseFor(stop)); <add> } <add> <ide> /** <ide> * Returns a {@code Completable} which given a {@link Publisher} and when this {@code Completable} emits an error, delivers <ide> * that error through a {@link Flowable} and the {@code Publisher} should signal a value indicating a retry in response <ide><path>src/main/java/io/reactivex/rxjava3/core/Maybe.java <ide> public final Maybe<T> retry(@NonNull Predicate<? super Throwable> predicate) { <ide> <ide> /** <ide> * Retries until the given stop function returns {@code true}. <add> * <p> <add> * <img width="640" height="285" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/Maybe.retryUntil.png" alt=""> <ide> * <dl> <ide> * <dt><b>Scheduler:</b></dt> <ide> * <dd>{@code retryUntil} does not operate by default on a particular {@link Scheduler}.</dd> <ide><path>src/main/java/io/reactivex/rxjava3/core/Single.java <ide> public final Single<T> retry(@NonNull Predicate<? super Throwable> predicate) { <ide> return toSingle(toFlowable().retry(predicate)); <ide> } <ide> <add> /** <add> * Retries until the given stop function returns {@code true}. <add> * <p> <add> * <img width="640" height="364" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/Single.retryUntil.png" alt=""> <add> * <dl> <add> * <dt><b>Scheduler:</b></dt> <add> * <dd>{@code retryUntil} does not operate by default on a particular {@link Scheduler}.</dd> <add> * </dl> <add> * @param stop the function that should return {@code true} to stop retrying <add> * @return the new {@code Single} instance <add> * @throws NullPointerException if {@code stop} is {@code null} <add> */ <add> @CheckReturnValue <add> @NonNull <add> @SchedulerSupport(SchedulerSupport.NONE) <add> public final Single<T> retryUntil(@NonNull BooleanSupplier stop) { <add> Objects.requireNonNull(stop, "stop is null"); <add> return retry(Long.MAX_VALUE, Functions.predicateReverseFor(stop)); <add> } <add> <ide> /** <ide> * Re-subscribes to the current {@code Single} if and when the {@link Publisher} returned by the handler <ide> * function signals a value. <ide><path>src/test/java/io/reactivex/rxjava3/completable/CompletableRetryTest.java <ide> import org.junit.Test; <ide> <ide> import io.reactivex.rxjava3.core.*; <add>import io.reactivex.rxjava3.exceptions.TestException; <ide> import io.reactivex.rxjava3.functions.*; <ide> import io.reactivex.rxjava3.internal.functions.Functions; <ide> <ide> public void retryTimesPredicateWithZeroRetries() { <ide> <ide> assertEquals(1, numberOfSubscribeCalls.get()); <ide> } <add> <add> @Test <add> public void untilTrueEmpty() { <add> Completable.complete() <add> .retryUntil(() -> true) <add> .test() <add> .assertResult(); <add> } <add> <add> @Test <add> public void untilFalseEmpty() { <add> Completable.complete() <add> .retryUntil(() -> false) <add> .test() <add> .assertResult(); <add> } <add> <add> @Test <add> public void untilTrueError() { <add> Completable.error(new TestException()) <add> .retryUntil(() -> true) <add> .test() <add> .assertFailure(TestException.class); <add> } <add> <add> @Test <add> public void untilFalseError() { <add> AtomicInteger counter = new AtomicInteger(); <add> Completable.defer(() -> { <add> if (counter.getAndIncrement() == 0) { <add> return Completable.error(new TestException()); <add> } <add> return Completable.complete(); <add> }) <add> .retryUntil(() -> false) <add> .test() <add> .assertResult(); <add> } <ide> } <ide><path>src/test/java/io/reactivex/rxjava3/maybe/MaybeRetryTest.java <ide> import org.junit.Test; <ide> <ide> import io.reactivex.rxjava3.core.*; <add>import io.reactivex.rxjava3.exceptions.TestException; <ide> import io.reactivex.rxjava3.functions.Predicate; <ide> import io.reactivex.rxjava3.internal.functions.Functions; <ide> <ide> public void retryTimesPredicateWithZeroRetries() { <ide> <ide> assertEquals(1, numberOfSubscribeCalls.get()); <ide> } <add> <add> @Test <add> public void untilTrueJust() { <add> Maybe.just(1) <add> .retryUntil(() -> true) <add> .test() <add> .assertResult(1); <add> } <add> <add> @Test <add> public void untilFalseJust() { <add> Maybe.just(1) <add> .retryUntil(() -> false) <add> .test() <add> .assertResult(1); <add> } <add> <add> @Test <add> public void untilTrueEmpty() { <add> Maybe.empty() <add> .retryUntil(() -> true) <add> .test() <add> .assertResult(); <add> } <add> <add> @Test <add> public void untilFalseEmpty() { <add> Maybe.empty() <add> .retryUntil(() -> false) <add> .test() <add> .assertResult(); <add> } <add> <add> @Test <add> public void untilTrueError() { <add> Maybe.error(new TestException()) <add> .retryUntil(() -> true) <add> .test() <add> .assertFailure(TestException.class); <add> } <add> <add> @Test <add> public void untilFalseError() { <add> AtomicInteger counter = new AtomicInteger(); <add> Maybe.defer(() -> { <add> if (counter.getAndIncrement() == 0) { <add> return Maybe.error(new TestException()); <add> } <add> return Maybe.just(1); <add> }) <add> .retryUntil(() -> false) <add> .test() <add> .assertResult(1); <add> } <ide> } <ide><path>src/test/java/io/reactivex/rxjava3/single/SingleRetryTest.java <ide> import org.junit.Test; <ide> <ide> import io.reactivex.rxjava3.core.*; <add>import io.reactivex.rxjava3.exceptions.TestException; <ide> import io.reactivex.rxjava3.functions.Predicate; <ide> import io.reactivex.rxjava3.internal.functions.Functions; <ide> <ide> public void retryTimesPredicateWithZeroRetries() { <ide> <ide> assertEquals(1, numberOfSubscribeCalls.get()); <ide> } <add> <add> @Test <add> public void untilTrueJust() { <add> Single.just(1) <add> .retryUntil(() -> true) <add> .test() <add> .assertResult(1); <add> } <add> <add> @Test <add> public void untilFalseJust() { <add> Single.just(1) <add> .retryUntil(() -> false) <add> .test() <add> .assertResult(1); <add> } <add> <add> @Test <add> public void untilTrueError() { <add> Single.error(new TestException()) <add> .retryUntil(() -> true) <add> .test() <add> .assertFailure(TestException.class); <add> } <add> <add> @Test <add> public void untilFalseError() { <add> AtomicInteger counter = new AtomicInteger(); <add> Single.defer(() -> { <add> if (counter.getAndIncrement() == 0) { <add> return Single.error(new TestException()); <add> } <add> return Single.just(1); <add> }) <add> .retryUntil(() -> false) <add> .test() <add> .assertResult(1); <add> } <ide> }
6
Text
Text
fix typos, change 'ctrk' to 'ctrl'
3df4ee421c4679e0d11dc6f6a843c6428b046078
<ide><path>CHANGELOG.md <ide> If you rely on the $modelValue validation, you can overwrite the `min`/`max` val <ide> link: function(scope, element, attrs, ctrl) { <ide> var maxValidator = ctrl.$validators.max; <ide> <del> ctrk.$validators.max = function(modelValue, viewValue) { <add> ctrl.$validators.max = function(modelValue, viewValue) { <ide> return maxValidator(modelValue, modelValue); <ide> }; <ide> } <ide> If you rely on the $modelValue validation, you can overwrite the `min`/`max` val <ide> link: function(scope, element, attrs, ctrl) { <ide> var maxValidator = ctrl.$validators.max; <ide> <del> ctrk.$validators.max = function(modelValue, viewValue) { <add> ctrl.$validators.max = function(modelValue, viewValue) { <ide> return maxValidator(modelValue, modelValue); <ide> }; <ide> }
1
Python
Python
remove unnecessary bytes() calls
b37aa284eb4aee17f5c6659e7533427ffcc5a2c8
<ide><path>rest_framework/renderers.py <ide> def render(self, data, accepted_media_type=None, renderer_context=None): <ide> Render `data` into JSON, returning a bytestring. <ide> """ <ide> if data is None: <del> return bytes() <add> return b'' <ide> <ide> renderer_context = renderer_context or {} <ide> indent = self.get_indent(accepted_media_type, renderer_context) <ide><path>rest_framework/response.py <ide> def rendered_content(self): <ide> 'renderer returned unicode, and did not specify ' <ide> 'a charset value.' <ide> ) <del> return bytes(ret.encode(charset)) <add> return ret.encode(charset) <ide> <ide> if not ret: <ide> del self['Content-Type'] <ide><path>rest_framework/test.py <ide> def _encode_data(self, data, format=None, content_type=None): <ide> <ide> # Coerce text to bytes if required. <ide> if isinstance(ret, str): <del> ret = bytes(ret.encode(renderer.charset)) <add> ret = ret.encode(renderer.charset) <ide> <ide> return ret, content_type <ide>
3
Java
Java
fix behavior of blockingobservable.last
997546f4b5906cbea94dbd5c9fb05408724c61f3
<ide><path>rxjava-core/src/main/java/rx/observables/BlockingObservable.java <ide> public Iterator<T> getIterator() { <ide> * <img width="640" src="https://github.com/Netflix/RxJava/wiki/images/rx-operators/B.last.png"> <ide> * <ide> * @return the last item emitted by the source {@link Observable} <add> * @throws IllegalArgumentException if source contains no elements <ide> */ <ide> public T last() { <del> T result = null; <del> for (T value : toIterable()) { <del> result = value; <del> } <del> return result; <add> return new BlockingObservable<T>(o.last()).single(); <ide> } <ide> <ide> /** <ide><path>rxjava-core/src/test/java/rx/observables/BlockingObservableTest.java <ide> public void testLast() { <ide> assertEquals("three", obs.last()); <ide> } <ide> <del> @Test <add> @Test(expected = IllegalArgumentException.class) <ide> public void testLastEmptyObservable() { <ide> BlockingObservable<Object> obs = BlockingObservable.from(Observable.empty()); <del> <del> assertNull(obs.last()); <add> obs.last(); <ide> } <ide> <ide> @Test
2
Javascript
Javascript
update user challenge map on challenge complete
8be0d194a5a4f0e00b3639f7e98aea80dfe9dee9
<ide><path>common/app/redux/actions.js <ide> export const updateUserLang = createAction( <ide> types.updateUserLang, <ide> (username, lang) => ({ username, lang }) <ide> ); <add> <add>// updateUserChallenge( <add>// username: String, <add>// challengeInfo: Object <add>// ) => Action <add>export const updateUserChallenge = createAction( <add> types.updateUserChallenge, <add> (username, challengeInfo) => ({ username, challengeInfo }) <add>); <add> <ide> export const updateAppLang = createAction(types.updateAppLang); <ide> <ide> // used when server needs client to redirect <ide><path>common/app/redux/entities-reducer.js <ide> export default function entities(state = initialState, action) { <ide> } <ide> }; <ide> } <add> <add> if (action.type === types.updateUserChallenge) { <add> const { challengeInfo } = action.payload; <add> return { <add> ...state, <add> user: { <add> ...state.user, <add> [username]: { <add> ...state.user[username], <add> challengeMap: { <add> ...state.user[username].challengeMap, <add> [challengeInfo.id]: challengeInfo <add> } <add> } <add> } <add> }; <add> } <ide> return state; <ide> } <ide><path>common/app/redux/types.js <ide> export default createTypes([ <ide> 'updateUserFlag', <ide> 'updateUserEmail', <ide> 'updateUserLang', <add> 'updateUserChallenge', <ide> 'showSignIn', <ide> 'loadCurrentChallenge', <ide> 'updateMyCurrentChallenge', <ide><path>common/app/routes/challenges/redux/actions.js <ide> export const updateFile = createAction( <ide> export const updateFiles = createAction(types.updateFiles); <ide> <ide> // rechallenge <del>export const executeChallenge = createAction(types.executeChallenge); <add>export const executeChallenge = createAction( <add> types.executeChallenge, <add> () => null <add>); <ide> <ide> export const updateMain = createAction(types.updateMain); <ide> export const frameMain = createAction(types.frameMain); <ide><path>common/app/routes/challenges/redux/completion-saga.js <ide> import { Observable } from 'rx'; <ide> <ide> import types from './types'; <ide> import { moveToNextChallenge } from './actions'; <del>import { <del> createErrorObservable, <del> updateUserPoints <del>} from '../../../redux/actions'; <del>import { makeToast } from '../../../toasts/redux/actions'; <ide> <ide> import { challengeSelector } from './selectors'; <ide> import { randomCompliment } from '../../../utils/get-words'; <add>import { <add> createErrorObservable, <add> updateUserPoints, <add> updateUserChallenge <add>} from '../../../redux/actions'; <ide> import { backEndProject } from '../../../utils/challengeTypes'; <add>import { makeToast } from '../../../toasts/redux/actions'; <ide> import { postJSON$ } from '../../../../utils/ajax-stream'; <ide> <del>function postChallenge(url, body, username) { <add>function postChallenge(url, username, _csrf, challengeInfo) { <add> const body = { ...challengeInfo, _csrf }; <ide> const saveChallenge$ = postJSON$(url, body) <ide> .retry(3) <del> .map(({ points }) => { <del> return updateUserPoints(username, points); <add> .flatMap(({ points, lastUpdated, completedDate }) => { <add> return Observable.of( <add> updateUserPoints(username, points), <add> updateUserChallenge( <add> username, <add> { ...challengeInfo, lastUpdated, completedDate } <add> ) <add> ); <ide> }) <ide> .catch(createErrorObservable); <ide> const challengeCompleted$ = Observable.of(moveToNextChallenge()); <ide> function submitModern(type, state) { <ide> app: { user, csrfToken }, <ide> challengesApp: { files } <ide> } = state; <del> const body = { <del> id, <del> _csrf: csrfToken, <del> files <del> }; <del> return postChallenge('/modern-challenge-completed', body, user); <add> const challengeInfo = { id, files }; <add> return postChallenge( <add> '/modern-challenge-completed', <add> user, <add> csrfToken, <add> challengeInfo <add> ); <ide> } <ide> } <ide> return Observable.just(makeToast({ message: 'Not quite there, yet.' })); <ide> function submitProject(type, state, { solution, githubLink }) { <ide> const { <ide> app: { user, csrfToken } <ide> } = state; <del> const body = { <del> id, <del> challengeType, <del> solution, <del> _csrf: csrfToken <del> }; <add> const challengeInfo = { id, challengeType, solution }; <ide> if (challengeType === backEndProject) { <del> body.githubLink = githubLink; <add> challengeInfo.githubLink = githubLink; <ide> } <del> return postChallenge('/project-completed', body, user); <add> return postChallenge( <add> '/project-completed', <add> user, <add> csrfToken, <add> challengeInfo <add> ); <ide> } <ide> <ide> function submitSimpleChallenge(type, state) { <ide> function submitSimpleChallenge(type, state) { <ide> const { <ide> app: { user, csrfToken } <ide> } = state; <del> const body = { <del> id, <del> _csrf: csrfToken <del> }; <del> return postChallenge('/challenge-completed', body, user); <add> const challengeInfo = { id }; <add> return postChallenge( <add> '/challenge-completed', <add> user, <add> csrfToken, <add> challengeInfo <add> ); <ide> } <ide> <ide> const submitTypes = { <ide><path>server/boot/challenge.js <ide> function buildUserUpdate( <ide> <ide> log('user update data', updateData); <ide> <del> return { alreadyCompleted, updateData }; <add> return { <add> alreadyCompleted, <add> updateData, <add> completedDate: finalChallenge.completedDate, <add> lastUpdated: finalChallenge.lastUpdated <add> }; <ide> } <ide> <ide> export default function(app) { <ide> export default function(app) { <ide> files <ide> } = req.body; <ide> <del> const { alreadyCompleted, updateData } = buildUserUpdate( <add> const { <add> alreadyCompleted, <add> updateData, <add> lastUpdated <add> } = buildUserUpdate( <ide> user, <ide> id, <del> { <del> id, <del> files, <del> completedDate <del> } <add> { id, files, completedDate } <ide> ); <ide> <ide> const points = alreadyCompleted ? user.points : user.points + 1; <ide> export default function(app) { <ide> if (type === 'json') { <ide> return res.json({ <ide> points, <del> alreadyCompleted <add> alreadyCompleted, <add> completedDate, <add> lastUpdated <ide> }); <ide> } <ide> return res.sendStatus(200); <ide> export default function(app) { <ide> const completedDate = Date.now(); <ide> const { id, solution, timezone } = req.body; <ide> <del> const { alreadyCompleted, updateData } = buildUserUpdate( <add> const { <add> alreadyCompleted, <add> updateData, <add> lastUpdated <add> } = buildUserUpdate( <ide> req.user, <ide> id, <ide> { id, solution, completedDate }, <ide> export default function(app) { <ide> if (type === 'json') { <ide> return res.json({ <ide> points, <del> alreadyCompleted <add> alreadyCompleted, <add> completedDate, <add> lastUpdated <ide> }); <ide> } <ide> return res.sendStatus(200); <ide> export default function(app) { <ide> .flatMap(() => { <ide> const { <ide> alreadyCompleted, <del> updateData <add> updateData, <add> lastUpdated <ide> } = buildUserUpdate(user, completedChallenge.id, completedChallenge); <ide> <ide> return user.update$(updateData) <ide> export default function(app) { <ide> if (type === 'json') { <ide> return res.send({ <ide> alreadyCompleted, <del> points: alreadyCompleted ? user.points : user.points + 1 <add> points: alreadyCompleted ? user.points : user.points + 1, <add> completedDate: completedChallenge.completedDate, <add> lastUpdated <ide> }); <ide> } <ide> return res.status(200).send(true);
6
Text
Text
update next doc path
9c8fdafecc1f061dd35124f93fc63fe3c2da1f4b
<ide><path>docs/Testing.md <ide> title: Testing <ide> layout: docs <ide> category: Guides <ide> permalink: docs/testing.html <del>next: activityindicatorios <add>next: embeded-app <ide> --- <ide> <ide> ## Running Tests and Contributing
1
Javascript
Javascript
simplify size calculation
63f0930161f94c46d1ff5932ed1d09d4ed35d4f3
<ide><path>lib/Chunk.js <ide> class Chunk { <ide> this.modules.forEach(m => m.updateHash(hash)); <ide> } <ide> <del> size(options) { <del> const CHUNK_OVERHEAD = typeof options.chunkOverhead === "number" ? options.chunkOverhead : 10000; <del> const ENTRY_CHUNK_MULTIPLICATOR = options.entryChunkMultiplicator || 10; <del> <del> const modulesSize = this.modules.reduce((a, b) => { <del> return a + b.size(); <del> }, 0); <del> return modulesSize * (this.isInitial() ? ENTRY_CHUNK_MULTIPLICATOR : 1) + CHUNK_OVERHEAD; <del> } <del> <ide> canBeIntegrated(other) { <ide> if(other.isInitial()) { <ide> return false; <ide> class Chunk { <ide> return true; <ide> } <ide> <add> addMultiplierAndOverhead(size, options) { <add> const overhead = typeof options.chunkOverhead === "number" ? options.chunkOverhead : 10000; <add> const multiplicator = this.isInitial() ? (options.entryChunkMultiplicator || 10) : 1; <add> <add> return size * multiplicator + overhead; <add> } <add> <add> modulesSize() { <add> let count = 0; <add> for(let i = 0; i < this.modules.length; i++) { <add> count += this.modules[i].size(); <add> } <add> return count; <add> } <add> <add> size(options) { <add> return this.addMultiplierAndOverhead(this.modulesSize(), options); <add> } <add> <ide> integratedSize(other, options) { <ide> // Chunk if it's possible to integrate this chunk <ide> if(!this.canBeIntegrated(other)) { <ide> return false; <ide> } <ide> <del> const CHUNK_OVERHEAD = typeof options.chunkOverhead === "number" ? options.chunkOverhead : 10000; <del> const ENTRY_CHUNK_MULTIPLICATOR = options.entryChunkMultiplicator || 10; <del> <del> const mergedModules = this.modules.slice(); <del> other.modules.forEach(m => { <del> if(this.modules.indexOf(m) < 0) { <del> mergedModules.push(m); <del> } <del> }, this); <del> <del> const modulesSize = mergedModules.reduce((a, m) => { <del> return a + m.size(); <del> }, 0); <del> return modulesSize * (this.isInitial() || other.isInitial() ? ENTRY_CHUNK_MULTIPLICATOR : 1) + CHUNK_OVERHEAD; <add> const modulesSize = this.modulesSize() + other.modulesSize(); <add> return this.addMultiplierAndOverhead(modulesSize, options); <ide> } <ide> <ide> getChunkMaps(includeEntries, realHash) {
1
Python
Python
create fractionalknapsack.py (#438)
94324e91b439fb24704707f3ed20ff2e607acee4
<ide><path>dynamic_programming/FractionalKnapsack.py <add>from itertools import accumulate <add>from bisect import bisect <add> <add>def fracKnapsack(vl, wt, W, n): <add> <add> r = list(sorted(zip(vl,wt), key=lambda x:x[0]/x[1],reverse=True)) <add> vl , wt = [i[0] for i in r],[i[1] for i in r] <add> acc=list(accumulate(wt)) <add> k = bisect(acc,W) <add> return 0 if k == 0 else sum(vl[:k])+(W-acc[k-1])*(vl[k])/(wt[k]) if k!=n else sum(vl[:k]) <add> <add>print("%.0f"%fracKnapsack([60, 100, 120],[10, 20, 30],50,3))
1
Javascript
Javascript
remove deprecation messages
a5ae7f57f179df2f9223cca6cd3706b110d6e5be
<ide><path>Libraries/react-native/react-native-implementation.js <ide> module.exports = { <ide> get ViewPropTypes() { <ide> return require('DeprecatedViewPropTypes'); <ide> }, <del> <del> // Deprecated <del> get BackAndroid() { <del> invariant( <del> false, <del> 'BackAndroid is deprecated and has been removed from this package. ' + <del> 'Use BackHandler instead', <del> ); <del> }, <del> <del> get Navigator() { <del> invariant( <del> false, <del> 'Navigator is deprecated and has been removed from this package. It can now be installed ' + <del> 'and imported from `react-native-deprecated-custom-components` instead of `react-native`. ' + <del> 'Learn about alternative navigation solutions at http://facebook.github.io/react-native/docs/navigation.html', <del> ); <del> }, <del> get NavigatorIOS() { <del> invariant( <del> false, <del> 'NavigatorIOS is deprecated and has been removed from this package. ' + <del> 'Learn about alternative navigation solutions at http://facebook.github.io/react-native/docs/navigation.html', <del> ); <del> }, <ide> };
1
Javascript
Javascript
remove instrumentation and nesting warning
4073dc79d7534e58e7a13d1f05c184b66b5f6aa7
<ide><path>src/renderers/dom/fiber/ReactDOMFiberComponent.js <ide> var ReactDOMFiberInput = require('ReactDOMFiberInput'); <ide> var ReactDOMFiberOption = require('ReactDOMFiberOption'); <ide> var ReactDOMFiberSelect = require('ReactDOMFiberSelect'); <ide> var ReactDOMFiberTextarea = require('ReactDOMFiberTextarea'); <del>var ReactInstrumentation = require('ReactInstrumentation'); <ide> var ReactMultiChild = require('ReactMultiChild'); <ide> var ReactServerRenderingTransaction = require('ReactServerRenderingTransaction'); <ide> <ide> var invariant = require('invariant'); <ide> var isEventSupported = require('isEventSupported'); <ide> var shallowEqual = require('shallowEqual'); <ide> var inputValueTracking = require('inputValueTracking'); <del>var validateDOMNesting = require('validateDOMNesting'); <ide> var warning = require('warning'); <ide> var didWarnShadyDOM = false; <ide> <ide> function optionPostMount() { <ide> ReactDOMFiberOption.postMountWrapper(inst); <ide> } <ide> <del>var setAndValidateContentChildDev = emptyFunction; <del>if (__DEV__) { <del> setAndValidateContentChildDev = function(content) { <del> var hasExistingContent = this._contentDebugID != null; <del> var debugID = this._debugID; <del> // This ID represents the inlined child that has no backing instance: <del> var contentDebugID = -debugID; <del> <del> if (content == null) { <del> if (hasExistingContent) { <del> ReactInstrumentation.debugTool.onUnmountComponent(this._contentDebugID); <del> } <del> this._contentDebugID = null; <del> return; <del> } <del> <del> validateDOMNesting(null, String(content), this, this._ancestorInfo); <del> this._contentDebugID = contentDebugID; <del> if (hasExistingContent) { <del> ReactInstrumentation.debugTool.onBeforeUpdateComponent(contentDebugID, content); <del> ReactInstrumentation.debugTool.onUpdateComponent(contentDebugID); <del> } else { <del> ReactInstrumentation.debugTool.onBeforeMountComponent(contentDebugID, content, debugID); <del> ReactInstrumentation.debugTool.onMountComponent(contentDebugID); <del> ReactInstrumentation.debugTool.onSetChildren(debugID, [contentDebugID]); <del> } <del> }; <del>} <del> <ide> // There are so many media events, it makes sense to just <ide> // maintain a list rather than create a `trapBubbledEvent` for each <ide> var mediaEvents = { <ide> function createInitialChildren(workInProgress, transaction, props, context, lazy <ide> // show within the textarea until it has been focused and blurred again. <ide> // https://github.com/facebook/react/issues/6731#issuecomment-254874553 <ide> if (contentToUse !== '') { <del> if (__DEV__) { <del> setAndValidateContentChildDev.call(workInProgress, contentToUse); <del> } <ide> DOMLazyTree.queueText(lazyTree, contentToUse); <ide> } <ide> } else if (childrenToUse != null) { <ide> function updateDOMChildren(workInProgress, lastProps, nextProps, transaction, co <ide> workInProgress.updateChildren(null, transaction, context); <ide> } else if (lastHasContentOrHtml && !nextHasContentOrHtml) { <ide> workInProgress.updateTextContent(''); <del> if (__DEV__) { <del> ReactInstrumentation.debugTool.onSetChildren(workInProgress._debugID, []); <del> } <ide> } <ide> <ide> if (nextContent != null) { <ide> if (lastContent !== nextContent) { <ide> workInProgress.updateTextContent('' + nextContent); <del> if (__DEV__) { <del> setAndValidateContentChildDev.call(workInProgress, nextContent); <del> } <ide> } <ide> } else if (nextHtml != null) { <ide> if (lastHtml !== nextHtml) { <ide> workInProgress.updateMarkup('' + nextHtml); <ide> } <del> if (__DEV__) { <del> ReactInstrumentation.debugTool.onSetChildren(workInProgress._debugID, []); <del> } <ide> } else if (nextChildren != null) { <del> if (__DEV__) { <del> setAndValidateContentChildDev.call(workInProgress, null); <del> } <del> <ide> workInProgress.updateChildren(nextChildren, transaction, context); <ide> } <ide> } <ide> var ReactDOMFiberComponent = { <ide> ) { <ide> // validateDangerousTag(tag); <ide> // workInProgress._tag = tag.toLowerCase(); <del> // setAndValidateContentChildDev.call(workInProgress, null); <ide> <ide> workInProgress._domID = hostContainerInfo._idCounter++; <ide> workInProgress._hostParent = hostParent; <ide> var ReactDOMFiberComponent = { <ide> } <ide> workInProgress._namespaceURI = namespaceURI; <ide> <del> if (__DEV__) { <del> var parentInfo; <del> if (hostParent != null) { <del> parentInfo = hostParent._ancestorInfo; <del> } else if (hostContainerInfo._tag) { <del> parentInfo = hostContainerInfo._ancestorInfo; <del> } <del> if (parentInfo) { <del> // parentInfo should always be present except for the top-level <del> // component when server rendering <del> validateDOMNesting(workInProgress._tag, null, workInProgress, parentInfo); <del> } <del> workInProgress._ancestorInfo = <del> validateDOMNesting.updatedAncestorInfo(parentInfo, workInProgress._tag, workInProgress); <del> } <del> <ide> var mountImage; <ide> var type = workInProgress._currentElement.type; <ide> var ownerDocument = hostContainerInfo._ownerDocument; <ide> var ReactDOMFiberComponent = { <ide> ReactDOMComponentTree.uncacheNode(workInProgress); <ide> workInProgress._domID = 0; <ide> workInProgress._wrapperState = null; <del> <del> if (__DEV__) { <del> setAndValidateContentChildDev.call(workInProgress, null); <del> } <ide> }, <ide> <ide> restoreControlledState: function(finishedWork : Fiber) {
1
Javascript
Javascript
cover image redirect to undefined
797dca5913446c15ea7787f05ec3cf8b27edb845
<ide><path>examples/cms-strapi/components/cover-image.js <ide> export default function CoverImage({ title, url, slug }) { <ide> ) <ide> return ( <ide> <div className="sm:mx-0"> <del> <Link href={`/posts/${slug}`}> <del> {slug ? <a aria-label={title}>{image}</a> : image} <del> </Link> <add> {slug ? ( <add> <Link href={`/posts/${slug}`}> <add> <a aria-label={title}>{image}</a> <add> </Link> <add> ) : ( <add> image <add> )} <ide> </div> <ide> ) <ide> }
1
Ruby
Ruby
replace map.flatten with flat_map in actionpack
817fe31196dd59ee31f71ef1740122b6759cf16d
<ide><path>actionpack/lib/action_dispatch/journey/gtg/builder.rb <ide> def transition_table <ide> marked[s] = true # mark s <ide> <ide> s.group_by { |state| symbol(state) }.each do |sym, ps| <del> u = ps.map { |l| followpos(l) }.flatten <add> u = ps.flat_map { |l| followpos(l) } <ide> next if u.empty? <ide> <ide> if u.uniq == [DUMMY] <ide> def firstpos(node) <ide> firstpos(node.left) <ide> end <ide> when Nodes::Or <del> node.children.map { |c| firstpos(c) }.flatten.uniq <add> node.children.flat_map { |c| firstpos(c) }.uniq <ide> when Nodes::Unary <ide> firstpos(node.left) <ide> when Nodes::Terminal <ide> def lastpos(node) <ide> when Nodes::Star <ide> firstpos(node.left) <ide> when Nodes::Or <del> node.children.map { |c| lastpos(c) }.flatten.uniq <add> node.children.flat_map { |c| lastpos(c) }.uniq <ide> when Nodes::Cat <ide> if nullable?(node.right) <ide> lastpos(node.left) | lastpos(node.right) <ide><path>actionpack/lib/action_dispatch/journey/gtg/simulator.rb <ide> def simulate(string) <ide> <ide> return if acceptance_states.empty? <ide> <del> memos = acceptance_states.map { |x| tt.memo(x) }.flatten.compact <add> memos = acceptance_states.flat_map { |x| tt.memo(x) }.compact <ide> <ide> MatchData.new(memos) <ide> end <ide><path>actionpack/lib/action_dispatch/journey/gtg/transition_table.rb <ide> def []=(from, to, sym) <ide> end <ide> <ide> def states <del> ss = @string_states.keys + @string_states.values.map(&:values).flatten <del> rs = @regexp_states.keys + @regexp_states.values.map(&:values).flatten <add> ss = @string_states.keys + @string_states.values.flat_map(&:values) <add> rs = @regexp_states.keys + @regexp_states.values.flat_map(&:values) <ide> (ss + rs).uniq <ide> end <ide> <ide> def states_hash_for(sym) <ide> def move_regexp(t, a) <ide> return [] if t.empty? <ide> <del> t.map { |s| <add> t.flat_map { |s| <ide> if states = @regexp_states[s] <ide> states.map { |re, v| re === a ? v : nil } <ide> end <del> }.flatten.compact.uniq <add> }.compact.uniq <ide> end <ide> <ide> def move_string(t, a) <ide><path>actionpack/lib/action_dispatch/journey/nfa/dot.rb <ide> def to_dot <ide> # end <ide> # " #{n.object_id} [label=\"#{label}\", shape=box];" <ide> #} <del> #memo_edges = memos.map { |k, memos| <add> #memo_edges = memos.flat_map { |k, memos| <ide> # (memos || []).map { |v| " #{k} -> #{v.object_id};" } <del> #}.flatten.uniq <add> #}.uniq <ide> <ide> <<-eodot <ide> digraph nfa { <ide><path>actionpack/lib/action_dispatch/journey/nfa/simulator.rb <ide> def simulate(string) <ide> <ide> return if acceptance_states.empty? <ide> <del> memos = acceptance_states.map { |x| tt.memo(x) }.flatten.compact <add> memos = acceptance_states.flat_map { |x| tt.memo(x) }.compact <ide> <ide> MatchData.new(memos) <ide> end <ide><path>actionpack/lib/action_dispatch/journey/nfa/transition_table.rb <ide> def merge(left, right) <ide> end <ide> <ide> def states <del> (@table.keys + @table.values.map(&:keys).flatten).uniq <add> (@table.keys + @table.values.flat_map(&:keys)).uniq <ide> end <ide> <ide> # Returns a generalized transition graph with reduced states. The states <ide> def generalized_table <ide> # Returns set of NFA states to which there is a transition on ast symbol <ide> # +a+ from some state +s+ in +t+. <ide> def following_states(t, a) <del> Array(t).map { |s| inverted[s][a] }.flatten.uniq <add> Array(t).flat_map { |s| inverted[s][a] }.uniq <ide> end <ide> <ide> # Returns set of NFA states to which there is a transition on ast symbol <ide> def move(t, a) <ide> end <ide> <ide> def alphabet <del> inverted.values.map(&:keys).flatten.compact.uniq.sort_by { |x| x.to_s } <add> inverted.values.flat_map(&:keys).compact.uniq.sort_by { |x| x.to_s } <ide> end <ide> <ide> # Returns a set of NFA states reachable from some NFA state +s+ in set <ide> def eclosure(t) <ide> end <ide> <ide> def transitions <del> @table.map { |to, hash| <add> @table.flat_map { |to, hash| <ide> hash.map { |from, sym| [from, sym, to] } <del> }.flatten(1) <add> } <ide> end <ide> <ide> private <ide><path>actionpack/lib/action_dispatch/journey/path/pattern.rb <ide> def required_names <ide> end <ide> <ide> def optional_names <del> @optional_names ||= spec.grep(Nodes::Group).map { |group| <add> @optional_names ||= spec.grep(Nodes::Group).flat_map { |group| <ide> group.grep(Nodes::Symbol) <del> }.flatten.map { |n| n.name }.uniq <add> }.map { |n| n.name }.uniq <ide> end <ide> <ide> class RegexpOffsets < Journey::Visitors::Visitor # :nodoc:
7
Text
Text
fix the link for squashing-instructions
720f13d8d588156dc85229af3c3820c5bf0f1362
<ide><path>share/doc/homebrew/Formula-Cookbook.md <ide> Now, please open a Pull Request (on your github repo page) for new and updated b <ide> <ide> * One formula per commit; one commit per formula <ide> * Keep merge commits out of the request <del>* If you have any merge or mixup commits, please [squash](http://www.gitready.com/advanced/2009/02/10/squashing-commits-with-rebase.html) them. <add>* If you have any merge or mixup commits, please [squash](http://gitready.com/advanced/2009/02/10/squashing-commits-with-rebase.html) them. <ide> <ide> If a commit touches multiple files, or isn’t one logical bug fix, or a file is touched in multiple commits, we’ll probably ask you to `rebase` and `squash` your commits. For this reason, you should avoid pushing to your `master` branch. Note, after rebase and/or squash, you'll need to push with `--force` to your remote. <ide>
1
Javascript
Javascript
use an ellipsis character instead
904619509e9ea2de60fccafe19b5d3aa1634d107
<ide><path>test/integration/preload-viewport/pages/invalid-prefetch.js <ide> import Link from 'next/link' <ide> export default () => ( <ide> <> <ide> <Link href="/something-invalid-oops"> <del> <a id="invalid-link">I'm broken...</a> <add> <a id="invalid-link">I'm broken…</a> <ide> </Link> <ide> </> <ide> )
1
Javascript
Javascript
remove tests relying on !process.features.uv
9631e29933c3ac8a568ee8af6f0500e381d88d23
<ide><path>test/internet/test-dns.js <ide> var assert = require('assert'), <ide> net = require('net_uv'), <ide> isIP = net.isIP, <ide> isIPv4 = net.isIPv4, <del> isIPv6 = net.isIPv6, <del> uv = process.features.uv; <add> isIPv6 = net.isIPv6; <ide> <ide> var expected = 0, <ide> completed = 0, <ide> function TEST(f) { <ide> <ide> <ide> process.on('exit', function() { <del> console.log(completed + ' tests completed (using libuv: ' + (!!uv) + ')'); <add> console.log(completed + ' tests completed'); <ide> assert.equal(running, false); <ide> assert.strictEqual(expected, completed); <ide> }); <ide> <ide> <ide> function checkWrap(req) { <del> if (uv) { <del> assert.ok(typeof req === 'object'); <del> } <add> assert.ok(typeof req === 'object'); <ide> } <ide> <ide> <ide> TEST(function test_reverse_bogus(done) { <ide> } <ide> <ide> assert.ok(error instanceof Error); <del> uv && assert.strictEqual(error.errno, 'ENOTIMP'); <add> assert.strictEqual(error.errno, 'ENOTIMP'); <ide> <ide> done(); <ide> }); <ide> TEST(function test_lookup_failure(done) { <ide> var req = dns.lookup('does.not.exist', 4, function(err, ip, family) { <ide> assert.ok(err instanceof Error); <ide> assert.strictEqual(err.errno, dns.NOTFOUND); <del> uv && assert.strictEqual(err.errno, 'ENOTFOUND'); <add> assert.strictEqual(err.errno, 'ENOTFOUND'); <ide> <ide> done(); <ide> }); <ide><path>test/simple/test-child-process-deprecated-api.js <del>// Copyright Joyent, Inc. and other Node contributors. <del>// <del>// Permission is hereby granted, free of charge, to any person obtaining a <del>// copy of this software and associated documentation files (the <del>// "Software"), to deal in the Software without restriction, including <del>// without limitation the rights to use, copy, modify, merge, publish, <del>// distribute, sublicense, and/or sell copies of the Software, and to permit <del>// persons to whom the Software is furnished to do so, subject to the <del>// following conditions: <del>// <del>// The above copyright notice and this permission notice shall be included <del>// in all copies or substantial portions of the Software. <del>// <del>// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS <del>// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF <del>// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN <del>// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, <del>// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR <del>// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE <del>// USE OR OTHER DEALINGS IN THE SOFTWARE. <del> <del>// We do not support this API with the libuv backend. <del>if (process.features.uv) return; <del> <del>var common = require('../common'); <del>var assert = require('assert'); <del>var spawn = require('child_process').spawn; <del>var path = require('path'); <del>var fs = require('fs'); <del>var exits = 0; <del> <del>// Test `env` parameter <del>// for child_process.spawn(path, args, env, customFds) deprecated api <del>(function() { <del> var response = ''; <del> var child = spawn('/usr/bin/env', [], {'HELLO': 'WORLD'}); <del> <del> child.stdout.setEncoding('utf8'); <del> <del> child.stdout.addListener('data', function(chunk) { <del> response += chunk; <del> }); <del> <del> process.addListener('exit', function() { <del> assert.ok(response.indexOf('HELLO=WORLD') >= 0); <del> exits++; <del> }); <del>})(); <del> <del>// Test `customFds` parameter <del>// for child_process.spawn(path, args, env, customFds) deprecated api <del>(function() { <del> var expected = 'hello world'; <del> var helloPath = path.join(common.tmpDir, 'hello.txt'); <del> <del> fs.open(helloPath, 'w', 400, function(err, fd) { <del> if (err) throw err; <del> <del> var child = spawn('/bin/echo', [expected], undefined, [-1, fd]); <del> <del> assert.notEqual(child.stdin, null); <del> assert.equal(child.stdout, null); <del> assert.notEqual(child.stderr, null); <del> <del> child.addListener('exit', function(err) { <del> if (err) throw err; <del> <del> fs.close(fd, function(err) { <del> if (err) throw err; <del> <del> fs.readFile(helloPath, function(err, data) { <del> if (err) throw err; <del> <del> assert.equal(data.toString(), expected + '\n'); <del> exits++; <del> }); <del> }); <del> }); <del> }); <del>})(); <del> <del>// Check if all child processes exited <del>process.addListener('exit', function() { <del> assert.equal(2, exits); <del>}); <ide><path>test/simple/test-module-load-list.js <ide> checkExpected(); <ide> console.log('load console.log. process.stdout._type is ' + <ide> process.stdout._type); <ide> <del>if (!process.features.uv) { <del> // legacy <del> expected = expected.concat([ <del> 'NativeModule console', <del> 'NativeModule net_legacy', <del> 'NativeModule timers_legacy', <del> 'Binding timer', <del> 'NativeModule _linklist', <del> 'Binding net', <del> 'NativeModule freelist', <del> 'Binding io_watcher', <del> 'NativeModule tty', <del> 'NativeModule tty_posix', <del> 'NativeModule readline' <del> ]); <del>} else { <del> switch (process.stdout._type) { <del> case 'fs': <del> expected = expected.concat([ <del> 'NativeModule console', <del> 'Binding stdio', <del> 'Binding tty_wrap' <del> ]); <del> break; <add>switch (process.stdout._type) { <add> case 'fs': <add> expected = expected.concat([ <add> 'NativeModule console', <add> 'Binding stdio', <add> 'Binding tty_wrap' <add> ]); <add> break; <ide> <del> case 'tty': <del> expected = expected.concat([ <del> 'NativeModule console', <del> 'Binding stdio', <del> 'Binding tty_wrap', <del> 'NativeModule tty_uv', <del> 'NativeModule net_uv', <del> 'NativeModule timers_uv', <del> 'Binding timer_wrap', <del> 'NativeModule _linklist' <del> ]); <del> break; <add> case 'tty': <add> expected = expected.concat([ <add> 'NativeModule console', <add> 'Binding stdio', <add> 'Binding tty_wrap', <add> 'NativeModule tty_uv', <add> 'NativeModule net_uv', <add> 'NativeModule timers_uv', <add> 'Binding timer_wrap', <add> 'NativeModule _linklist' <add> ]); <add> break; <ide> <del> case 'pipe': <del> expected = expected.concat([ <del> 'NativeModule console', <del> 'Binding stdio', <del> 'Binding tty_wrap', <del> 'NativeModule net_uv', <del> 'NativeModule timers_uv', <del> 'Binding timer_wrap', <del> 'NativeModule _linklist', <del> 'Binding pipe_wrap' <del> ]); <del> break; <add> case 'pipe': <add> expected = expected.concat([ <add> 'NativeModule console', <add> 'Binding stdio', <add> 'Binding tty_wrap', <add> 'NativeModule net_uv', <add> 'NativeModule timers_uv', <add> 'Binding timer_wrap', <add> 'NativeModule _linklist', <add> 'Binding pipe_wrap' <add> ]); <add> break; <ide> <del> default: <del> assert.ok(0, 'prcoess.stdout._type is bad'); <del> } <add> default: <add> assert.ok(0, 'prcoess.stdout._type is bad'); <ide> } <ide> <ide> console.error('process.moduleLoadList', process.moduleLoadList);
3
Ruby
Ruby
reset ld when switching compilers
5dc15272d9fa925bd801e4b54b8fe91040ae2b21
<ide><path>Library/Homebrew/extend/ENV.rb <ide> def O1 <ide> <ide> def gcc_4_0_1 <ide> # we don't use xcrun because gcc 4.0 has not been provided since Xcode 4 <del> self['CC'] = "#{MacOS.dev_tools_path}/gcc-4.0" <add> self['CC'] = "#{MacOS.dev_tools_path}/gcc-4.0" <add> self['LD'] = self['CC'] <ide> self['CXX'] = "#{MacOS.dev_tools_path}/g++-4.0" <ide> self['OBJC'] = self['CC'] <ide> replace_in_cflags '-O4', '-O3' <ide> def expand_xcrun <ide> self['CC'] = `/usr/bin/xcrun -find #{$1}`.chomp if $1 <ide> self['CXX'] =~ %r{/usr/bin/xcrun (.*)} <ide> self['CXX'] = `/usr/bin/xcrun -find #{$1}`.chomp if $1 <add> self['LD'] = self['CC'] <ide> self['OBJC'] = self['CC'] <ide> end <ide> <ide> def gcc <ide> # But we don't want LLVM of course. <ide> <ide> self['CC'] = xcrun "gcc-4.2" <add> self['LD'] = self['CC'] <ide> self['CXX'] = xcrun "g++-4.2" <ide> self['OBJC'] = self['CC'] <ide> <ide> unless self['CC'] <ide> self['CC'] = "#{HOMEBREW_PREFIX}/bin/gcc-4.2" <add> self['LD'] = self['CC'] <ide> self['CXX'] = "#{HOMEBREW_PREFIX}/bin/g++-4.2" <ide> self['OBJC'] = self['CC'] <ide> raise "GCC could not be found" if not File.exist? self['CC'] <ide> def gcc <ide> alias_method :gcc_4_2, :gcc <ide> <ide> def llvm <del> self['CC'] = xcrun "llvm-gcc" <add> self['CC'] = xcrun "llvm-gcc" <add> self['LD'] = self['CC'] <ide> self['CXX'] = xcrun "llvm-g++" <ide> self['OBJC'] = self['CC'] <ide> set_cpu_cflags 'core2 -msse4', :penryn => 'core2 -msse4.1', :core2 => 'core2', :core => 'prescott' <ide> @compiler = :llvm <ide> end <ide> <ide> def clang <del> self['CC'] = xcrun "clang" <add> self['CC'] = xcrun "clang" <add> self['LD'] = self['CC'] <ide> self['CXX'] = xcrun "clang++" <ide> self['OBJC'] = self['CC'] <ide> replace_in_cflags(/-Xarch_i386 (-march=\S*)/, '\1') <ide><path>Library/Homebrew/test/test_ENV.rb <ide> def test_ENV_options <ide> assert !ENV.cc.empty? <ide> assert !ENV.cxx.empty? <ide> end <add> <add> def test_switching_compilers <add> ENV.llvm <add> ENV.clang <add> assert_equal ENV['LD'], ENV['CC'] <add> assert_equal ENV['OBJC'], ENV['CC'] <add> end <ide> end
2
Python
Python
add test for public role permissions.
a52e77d0b41edd775d962111d419b1d2a44f5c2d
<ide><path>tests/www/test_security.py <ide> def test_update_and_verify_permission_role(self): <ide> <ide> assert role_perms_len == new_role_perms_len <ide> <add> def test_verify_public_role_has_no_permissions(self): <add> with self.app.app_context(): <add> public = self.appbuilder.sm.find_role("Public") <add> <add> assert public.permissions == [] <add> <ide> def test_get_user_roles(self): <ide> user = mock.MagicMock() <ide> user.is_anonymous = False
1
Javascript
Javascript
remove downloadmanager dependency
4c6ca1c78f1f0e5ebf5cc06f14cd173f19d0edeb
<ide><path>web/pdf_attachment_view.js <ide> * See the License for the specific language governing permissions and <ide> * limitations under the License. <ide> */ <del>/* globals DownloadManager, getFileName */ <add>/* globals getFileName */ <ide> <ide> 'use strict'; <ide> <ide> var PDFAttachmentView = (function PDFAttachmentViewClosure() { <ide> function PDFAttachmentView(options) { <ide> this.container = options.container; <ide> this.attachments = options.attachments; <add> this.downloadManager = options.downloadManager; <ide> } <ide> <ide> PDFAttachmentView.prototype = { <ide> var PDFAttachmentView = (function PDFAttachmentViewClosure() { <ide> <ide> _bindLink: function PDFAttachmentView_bindLink(button, item) { <ide> button.onclick = function downloadFile(e) { <del> var downloadManager = new DownloadManager(); <ide> var content = item.content; <ide> var filename = item.filename; <del> downloadManager.downloadData(content, getFileName(filename), ''); <add> this.downloadManager.downloadData(content, getFileName(filename), ''); <ide> return false; <del> }; <add> }.bind(this); <ide> }, <ide> <ide> render: function PDFAttachmentView_render() { <ide><path>web/viewer.js <ide> var PDFViewerApplication = { <ide> var container = document.getElementById('attachmentsView'); <ide> self.attachments = new PDFAttachmentView({ <ide> container: container, <del> attachments: attachments <add> attachments: attachments, <add> downloadManager: new DownloadManager() <ide> }); <ide> self.attachments.render(); <ide> document.getElementById('viewAttachments').disabled = !attachments;
2
Text
Text
fix misleading `console.log` output example
54d70a0f532f39e00720928194876c0d4166c9de
<ide><path>docs/api-reference/edge-runtime.md <ide> Running `console.log` on `process.env` **will not** show all your Environment Va <ide> console.log(process.env) <ide> // { NEXT_RUNTIME: 'edge' } <ide> console.log(process.env.TEST_VARIABLE) <del>// { NEXT_RUNTIME: 'edge', TEST_VARIABLE: 'value' } <add>// value <ide> ``` <ide> <ide> ## Unsupported APIs
1
Python
Python
add specific notebook progresscalback
62b5622e6b6477ca345d1e774a99c4a9f8bc98bc
<ide><path>src/transformers/file_utils.py <ide> except (AttributeError, ImportError): <ide> _has_sklearn = False <ide> <add>try: <add> # Test copied from tqdm.autonotebook: https://github.com/tqdm/tqdm/blob/master/tqdm/autonotebook.py <add> get_ipython = sys.modules["IPython"].get_ipython <add> if "IPKernelApp" not in get_ipython().config: <add> raise ImportError("console") <add> if "VSCODE_PID" in os.environ: <add> raise ImportError("vscode") <add> <add> import IPython # noqa: F401 <add> <add> _in_notebook = True <add>except (ImportError, KeyError): <add> _in_notebook = False <add> <ide> <ide> default_cache_path = os.path.join(torch_cache_home, "transformers") <ide> <ide> def is_faiss_available(): <ide> return _faiss_available <ide> <ide> <add>def is_in_notebook(): <add> return _in_notebook <add> <add> <ide> def torch_only_method(fn): <ide> def wrapper(*args, **kwargs): <ide> if not _torch_available: <ide><path>src/transformers/trainer.py <ide> from torch.utils.data.sampler import RandomSampler, SequentialSampler <ide> <ide> from .data.data_collator import DataCollator, DataCollatorWithPadding, default_data_collator <del>from .file_utils import WEIGHTS_NAME, is_datasets_available, is_torch_tpu_available <add>from .file_utils import WEIGHTS_NAME, is_datasets_available, is_in_notebook, is_torch_tpu_available <ide> from .integrations import ( <ide> default_hp_search_backend, <ide> is_comet_available, <ide> _use_apex = False <ide> <ide> DEFAULT_CALLBACKS = [DefaultFlowCallback] <add>DEFAULT_PROGRESS_CALLBACK = ProgressCallback <ide> <add>if is_in_notebook(): <add> from .utils.notebook import NotebookProgressCallback <add> <add> DEFAULT_PROGRESS_CALLBACK = NotebookProgressCallback <ide> <ide> # Check if Pytorch version >= 1.6 to switch between Native AMP and Apex <ide> if version.parse(torch.__version__) < version.parse("1.6"): <ide> def __init__( <ide> ) <ide> callbacks = DEFAULT_CALLBACKS if callbacks is None else DEFAULT_CALLBACKS + callbacks <ide> self.callback_handler = CallbackHandler(callbacks, self.model, self.optimizer, self.lr_scheduler) <del> self.add_callback(PrinterCallback if self.args.disable_tqdm else ProgressCallback) <add> self.add_callback(PrinterCallback if self.args.disable_tqdm else DEFAULT_PROGRESS_CALLBACK) <ide> <ide> # Deprecated arguments <ide> if "tb_writer" in kwargs: <ide><path>src/transformers/utils/notebook.py <add># coding=utf-8 <add># Copyright 2020 Hugging Face <add># <add># Licensed under the Apache License, Version 2.0 (the "License"); <add># you may not use this file except in compliance with the License. <add># You may obtain a copy of the License at <add># <add># http://www.apache.org/licenses/LICENSE-2.0 <add># <add># Unless required by applicable law or agreed to in writing, software <add># distributed under the License is distributed on an "AS IS" BASIS, <add># WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <add># See the License for the specific language governing permissions and <add># limitations under the License. <add> <add>import time <add>from typing import Optional <add> <add>import IPython.display as disp <add> <add>from ..trainer_callback import TrainerCallback <add> <add> <add>def format_time(t): <add> "Format `t` (in seconds) to (h):mm:ss" <add> t = int(t) <add> h, m, s = t // 3600, (t // 60) % 60, t % 60 <add> return f"{h}:{m:02d}:{s:02d}" if h != 0 else f"{m:02d}:{s:02d}" <add> <add> <add>def html_progress_bar(value, total, prefix, label, width=300): <add> "Html code for a progress bar `value`/`total` with `label` on the right, `prefix` on the left." <add> return f""" <add> <div> <add> <style> <add> /* Turns off some styling */ <add> progress {{ <add> /* gets rid of default border in Firefox and Opera. */ <add> border: none; <add> /* Needs to be in here for Safari polyfill so background images work as expected. */ <add> background-size: auto; <add> }} <add> </style> <add> {prefix} <add> <progress value='{value}' max='{total}' style='width:{width}px; height:20px; vertical-align: middle;'></progress> <add> {label} <add> </div> <add> """ <add> <add> <add>def text_to_html_table(items): <add> "Put the texts in `items` in an HTML table." <add> html_code = """<table border="1" class="dataframe">\n""" <add> html_code += """ <thead>\n <tr style="text-align: left;">\n""" <add> for i in items[0]: <add> html_code += f" <th>{i}</th>\n" <add> html_code += " </tr>\n </thead>\n <tbody>\n" <add> for line in items[1:]: <add> html_code += " <tr>\n" <add> for elt in line: <add> elt = f"{elt:.6f}" if isinstance(elt, float) else str(elt) <add> html_code += f" <td>{elt}</td>\n" <add> html_code += " </tr>\n" <add> html_code += " </tbody>\n</table><p>" <add> return html_code <add> <add> <add>class NotebookProgressBar: <add> """ <add> A progress par for display in a notebook. <add> <add> Class attributes (overridden by derived classes) <add> - **warmup** (:obj:`int`) -- The number of iterations to do at the beginning while ignoring <add> :obj:`update_every`. <add> - **update_every** (:obj:`float`) -- Since calling the time takes some time, we only do it <add> every presumed :obj:`update_every` seconds. The progress bar uses the average time passed <add> up until now to guess the next value for which it will call the update. <add> <add> Args: <add> total (:obj:`int`): <add> The total number of iterations to reach. <add> prefix (:obj:`str`, `optional`): <add> A prefix to add before the progress bar. <add> leave (:obj:`bool`, `optional`, defaults to :obj:`True`): <add> Whether or not to leave the progress bar once it's completed. You can always call the <add> :meth:`~transformers.utils.notebook.NotebookProgressBar.close` method to make the bar disappear. <add> parent (:class:`~transformers.notebook.NotebookTrainingTracker`, `optional`): <add> A parent object (like :class:`~transformers.utils.notebook.NotebookTrainingTracker`) that spawns progress <add> bars and handle their display. If set, the object passed must have a :obj:`display()` method. <add> width (:obj:`int`, `optional`, defaults to 300): <add> The width (in pixels) that the bar will take. <add> <add> Example:: <add> <add> import time <add> <add> pbar = NotebookProgressBar(100) <add> for val in range(100): <add> pbar.update(val) <add> time.sleep(0.07) <add> pbar.update(100) <add> """ <add> <add> warmup = 5 <add> update_every = 0.2 <add> <add> def __init__( <add> self, <add> total: int, <add> prefix: Optional[str] = None, <add> leave: bool = True, <add> parent: Optional["NotebookTrainingTracker"] = None, <add> width: int = 300, <add> ): <add> self.total = total <add> self.prefix = "" if prefix is None else prefix <add> self.leave = leave <add> self.parent = parent <add> self.width = width <add> self.last_value = None <add> self.comment = None <add> self.output = None <add> <add> def update(self, value: int, force_update: bool = False, comment: str = None): <add> """ <add> The main method to update the progress bar to :obj:`value`. <add> <add> Args: <add> <add> value (:obj:`int`): <add> The value to use. Must be between 0 and :obj:`total`. <add> force_update (:obj:`bool`, `optional`, defaults to :obj:`False`): <add> Whether or not to force and update of the internal state and display (by default, the bar will wait for <add> :obj:`value` to reach the value it predicted corresponds to a time of more than the :obj:`update_every` <add> attribute since the last update to avoid adding boilerplate). <add> comment (:obj:`str`, `optional`): <add> A comment to add on the left of the progress bar. <add> """ <add> self.value = value <add> if comment is not None: <add> self.comment = comment <add> if self.last_value is None: <add> self.start_time = self.last_time = time.time() <add> self.start_value = self.last_value = value <add> self.elapsed_time = self.predicted_remaining = None <add> self.first_calls = self.warmup <add> self.wait_for = 1 <add> self.update_bar(value) <add> elif value <= self.last_value: <add> return <add> elif force_update or self.first_calls > 0 or value >= min(self.last_value + self.wait_for, self.total): <add> if self.first_calls > 0: <add> self.first_calls -= 1 <add> current_time = time.time() <add> self.elapsed_time = current_time - self.start_time <add> self.average_time_per_item = self.elapsed_time / (value - self.start_value) <add> if value >= self.total: <add> value = self.total <add> self.predicted_remaining = None <add> if not self.leave: <add> self.close() <add> else: <add> self.predicted_remaining = self.average_time_per_item * (self.total - value) <add> self.update_bar(value) <add> self.last_value = value <add> self.last_time = current_time <add> self.wait_for = max(int(self.update_every / self.average_time_per_item), 1) <add> <add> def update_bar(self, value, comment=None): <add> spaced_value = " " * (len(str(self.total)) - len(str(value))) + str(value) <add> if self.elapsed_time is None: <add> self.label = f"[{spaced_value}/{self.total} : < :" <add> elif self.predicted_remaining is None: <add> self.label = f"[{spaced_value}/{self.total} {format_time(self.elapsed_time)}" <add> else: <add> self.label = f"[{spaced_value}/{self.total} {format_time(self.elapsed_time)} < {format_time(self.predicted_remaining)}" <add> self.label += f", {1/self.average_time_per_item:.2f} it/s" <add> self.label += "]" if self.comment is None or len(self.comment) == 0 else f", {self.comment}]" <add> self.display() <add> <add> def display(self): <add> self.html_code = html_progress_bar(self.value, self.total, self.prefix, self.label, self.width) <add> if self.parent is not None: <add> # If this is a child bar, the parent will take care of the display. <add> self.parent.display() <add> return <add> if self.output is None: <add> self.output = disp.display(disp.HTML(self.html_code), display_id=True) <add> else: <add> self.output.update(disp.HTML(self.html_code)) <add> <add> def close(self): <add> "Closes the progress bar." <add> if self.parent is None and self.output is not None: <add> self.output.update(disp.HTML("")) <add> <add> <add>class NotebookTrainingTracker(NotebookProgressBar): <add> """ <add> An object tracking the updates of an ongoing training with progress bars and a nice table reporting metrics. <add> <add> Args: <add> <add> num_steps (:obj:`int`): The number of steps during training. <add> column_names (:obj:`List[str]`, `optional`): <add> The list of column names for the metrics table (will be infered from the first call to <add> :meth:`~transformers.utils.notebook.NotebookTrainingTracker.write_line` if not set). <add> """ <add> <add> def __init__(self, num_steps, column_names=None): <add> super().__init__(num_steps) <add> self.inner_table = None if column_names is None else [column_names] <add> self.child_bar = None <add> <add> def display(self): <add> self.html_code = html_progress_bar(self.value, self.total, self.prefix, self.label, self.width) <add> if self.inner_table is not None: <add> self.html_code += text_to_html_table(self.inner_table) <add> if self.child_bar is not None: <add> self.html_code += self.child_bar.html_code <add> if self.output is None: <add> self.output = disp.display(disp.HTML(self.html_code), display_id=True) <add> else: <add> self.output.update(disp.HTML(self.html_code)) <add> <add> def write_line(self, values): <add> """ <add> Write the values in the inner table. <add> <add> Args: <add> values (:obj:`Dict[str, float]`): The values to display. <add> """ <add> if self.inner_table is None: <add> self.inner_table = [list(values.keys()), list(values.values())] <add> else: <add> columns = self.inner_table[0] <add> if len(self.inner_table) == 1: <add> # We give a chance to update the column names at the first iteration <add> for key in values.keys(): <add> if key not in columns: <add> columns.append(key) <add> self.inner_table[0] = columns <add> self.inner_table.append([values[c] for c in columns]) <add> <add> def add_child(self, total, prefix=None, width=300): <add> """ <add> Add a child progress bar disaplyed under the table of metrics. The child progress bar is returned (so it can <add> be easily updated). <add> <add> Args: <add> total (:obj:`int`): The number of iterations for the child progress bar. <add> prefix (:obj:`str`, `optional`): A prefix to write on the left of the progress bar. <add> width (:obj:`int`, `optional`, defaults to 300): The width (in pixels) of the progress bar. <add> """ <add> self.child_bar = NotebookProgressBar(total, prefix=prefix, parent=self, width=width) <add> return self.child_bar <add> <add> def remove_child(self): <add> """ <add> Closes the child progress bar. <add> """ <add> self.child_bar = None <add> self.display() <add> <add> <add>class NotebookProgressCallback(TrainerCallback): <add> """ <add> A :class:`~transformers.TrainerCallback` that displays the progress of training or evaluation, optimized for <add> Jupyter Notebooks or Google colab. <add> """ <add> <add> def __init__(self): <add> self.training_tracker = None <add> self.prediction_bar = None <add> <add> def on_train_begin(self, args, state, control, **kwargs): <add> self.first_column = "Epoch" if args.max_steps <= 0 else "Step" <add> self.training_loss = 0 <add> self.last_log = 0 <add> column_names = [self.first_column] + ["Training Loss", "Validation Loss"] <add> self.training_tracker = NotebookTrainingTracker(state.max_steps, column_names) <add> <add> def on_step_end(self, args, state, control, **kwargs): <add> epoch = int(state.epoch) if int(state.epoch) == state.epoch else f"{state.epoch:.2f}" <add> self.training_tracker.update(state.global_step + 1, comment=f"Epoch {epoch}/{state.num_train_epochs}") <add> <add> def on_prediction_step(self, args, state, control, eval_dataloader=None, **kwargs): <add> if self.prediction_bar is None: <add> if self.training_tracker is not None: <add> self.prediction_bar = self.training_tracker.add_child(len(eval_dataloader)) <add> else: <add> self.prediction_bar = NotebookProgressBar(len(eval_dataloader)) <add> self.prediction_bar.update(1) <add> else: <add> self.prediction_bar.update(self.prediction_bar.value + 1) <add> <add> def on_evaluate(self, args, state, control, metrics=None, **kwargs): <add> if self.training_tracker is not None: <add> values = {"Training Loss": "No log"} <add> for log in reversed(state.log_history): <add> if "loss" in log: <add> values["Training Loss"] = log["loss"] <add> break <add> <add> if self.first_column == "Epoch": <add> values["Epoch"] = int(state.epoch) <add> else: <add> values["Step"] = state.global_step <add> values["Validation Loss"] = metrics["eval_loss"] <add> _ = metrics.pop("total_flos", None) <add> _ = metrics.pop("epoch", None) <add> for k, v in metrics.items(): <add> if k == "eval_loss": <add> values["Validation Loss"] = v <add> else: <add> splits = k.split("_") <add> name = " ".join([part.capitalize() for part in splits[1:]]) <add> values[name] = v <add> self.training_tracker.write_line(values) <add> self.training_tracker.remove_child() <add> self.prediction_bar = None <add> <add> def on_train_end(self, args, state, control, **kwargs): <add> self.training_tracker.update( <add> state.global_step, comment=f"Epoch {int(state.epoch)}/{state.num_train_epochs}", force_update=True <add> ) <add> self.training_tracker = None
3
Ruby
Ruby
add example for unknownattributeerror
25f829e43fbae0c29a3f2e54f5f0c7ebd7c9b46e
<ide><path>activemodel/lib/active_model/errors.rb <ide> class StrictValidationFailed < StandardError <ide> end <ide> <ide> # Raised when unknown attributes are supplied via mass assignment. <add> # <add> # class Person <add> # include ActiveModel::AttributeAssignment <add> # include ActiveModel::Validations <add> # end <add> # <add> # person = Person.new <add> # person.assign_attributes(name: 'Gorby') <add> # # => ActiveModel::UnknownAttributeError: unknown attribute 'name' for Person. <ide> class UnknownAttributeError < NoMethodError <ide> attr_reader :record, :attribute <ide>
1
Javascript
Javascript
add coverage for spawnsync() killsignal
01db04bd304c39f222cf71e5b16e2e26d1bdf8d5
<ide><path>test/parallel/test-child-process-spawnsync-kill-signal.js <add>'use strict'; <add>const common = require('../common'); <add>const assert = require('assert'); <add>const cp = require('child_process'); <add> <add>if (process.argv[2] === 'child') { <add> setInterval(() => {}, 1000); <add>} else { <add> const exitCode = common.isWindows ? 1 : 0; <add> const { SIGKILL } = process.binding('constants').os.signals; <add> <add> function spawn(killSignal) { <add> const child = cp.spawnSync(process.execPath, <add> [__filename, 'child'], <add> {killSignal, timeout: 100}); <add> <add> assert.strictEqual(child.status, exitCode); <add> assert.strictEqual(child.error.code, 'ETIMEDOUT'); <add> return child; <add> } <add> <add> // Verify that an error is thrown for unknown signals. <add> assert.throws(() => { <add> spawn('SIG_NOT_A_REAL_SIGNAL'); <add> }, /Error: Unknown signal: SIG_NOT_A_REAL_SIGNAL/); <add> <add> // Verify that the default kill signal is SIGTERM. <add> { <add> const child = spawn(); <add> <add> assert.strictEqual(child.signal, 'SIGTERM'); <add> assert.strictEqual(child.options.killSignal, undefined); <add> } <add> <add> // Verify that a string signal name is handled properly. <add> { <add> const child = spawn('SIGKILL'); <add> <add> assert.strictEqual(child.signal, 'SIGKILL'); <add> assert.strictEqual(child.options.killSignal, SIGKILL); <add> } <add> <add> // Verify that a numeric signal is handled properly. <add> { <add> const child = spawn(SIGKILL); <add> <add> assert.strictEqual(typeof SIGKILL, 'number'); <add> assert.strictEqual(child.signal, 'SIGKILL'); <add> assert.strictEqual(child.options.killSignal, SIGKILL); <add> } <add>}
1
Javascript
Javascript
add test coverage of helper unit test
cb8dc6c82bde289f4339d65c0c0a53ddf1a233ca
<ide><path>node-tests/blueprints/helper-test.js <ide> describe('Acceptance: ember generate and destroy helper', function() { <ide> })); <ide> }); <ide> <add> it('helper foo/bar-baz unit', function() { <add> var args = ['helper', '--test-type=unit', 'foo/bar-baz']; <add> <add> return emberNew() <add> .then(() => emberGenerateDestroy(args, _file => { <add> expect(_file('app/helpers/foo/bar-baz.js')) <add> .to.contain("import { helper } from '@ember/component/helper';\n\n" + <add> "export function fooBarBaz(params/*, hash*/) {\n" + <add> " return params;\n" + <add> "}\n\n" + <add> "export default helper(fooBarBaz);"); <add> <add> expect(_file('tests/unit/helpers/foo/bar-baz-test.js')) <add> .to.equal(file('helper-test/unit.js')); <add> })); <add> }); <add> <ide> it('in-addon helper foo/bar-baz', function() { <ide> var args = ['helper', 'foo/bar-baz']; <ide> <ide><path>node-tests/fixtures/helper-test/unit.js <add> <add>import { fooBarBaz } from 'my-app/helpers/foo/bar-baz'; <add>import { module, test } from 'qunit'; <add> <add>module('Unit | Helper | foo/bar baz'); <add> <add>// Replace this with your real tests. <add>test('it works', function(assert) { <add> let result = fooBarBaz([42]); <add> assert.ok(result); <add>}); <add>
2
Text
Text
clarify definition of "symmetric difference"
38ef6d68e5fad64519f74922bdcec7a2fd236ce8
<ide><path>curriculum/challenges/english/08-coding-interview-prep/algorithms/find-the-symmetric-difference.english.md <ide> forumTopicId: 301611 <ide> <ide> ## Description <ide> <section id='description'> <del>Create a function that takes two or more arrays and returns an array of the <dfn>symmetric difference</dfn> (<code>&xutri;</code> or <code>&oplus;</code>) of the provided arrays. <del>Given two sets (for example set <code>A = {1, 2, 3}</code> and set <code>B = {2, 3, 4}</code>), the mathematical term "symmetric difference" of two sets is the set of elements which are in either of the two sets, but not in both (<code>A &xutri; B = C = {1, 4}</code>). For every additional symmetric difference you take (say on a set <code>D = {2, 3}</code>), you should get the set with elements which are in either of the two the sets but not both (<code>C &xutri; D = {1, 4} &xutri; {2, 3} = {1, 2, 3, 4}</code>). The resulting array must contain only unique values (<em>no duplicates</em>). <add>The mathematical term <dfn>symmetric difference</dfn> (<code>&xutri;</code> or <code>&oplus;</code>) of two sets is the set of elements which are in either of the two sets but not in both. For example, for sets <code>A = {1, 2, 3}</code> and <code>B = {2, 3, 4}</code>, <code>A &xutri; B = {1, 4}</code>. <add> <add>Symmetric difference is a binary operation, which means it operates on only two elements. So to evaluate an expression involving symmetric differences among <em>three</em> elements (<code>A &xutri; B &xutri; C</code>), you must complete one operation at a time. Thus, for sets <code>A</code> and <code>B</code> above, and <code>C = {2, 3}</code>, <code>A &xutri; B &xutri; C = (A &xutri; B) &xutri; C = {1, 4} &xutri; {2, 3} = {1, 2, 3, 4}</code>. <ide> </section> <ide> <ide> ## Instructions <ide> <section id='instructions'> <del> <add>Create a function that takes two or more arrays and returns an array of their symmetric difference. The returned array must contain only unique values (<em>no duplicates</em>). <ide> </section> <ide> <ide> ## Tests
1
Java
Java
fix dispatch of onlayout event for first render
844e11967d9292bd5cfe423d0fd57e34388f2337
<ide><path>ReactAndroid/src/main/java/com/facebook/react/uimanager/events/EventDispatcher.java <ide> public void dispatchEvent(Event event) { <ide> for (EventDispatcherListener listener : mListeners) { <ide> listener.onEventDispatch(event); <ide> } <del> <add> <ide> synchronized (mEventsStagingLock) { <ide> mEventStaging.add(event); <ide> Systrace.startAsyncFlow( <ide> public void dispatchEvent(Event event) { <ide> } <ide> } <ide> <add> public void dispatchAllEvents() { <add> mCurrentFrameCallback.maybePostFromNonUI(); <add> } <add> <ide> /** <ide> * Add a listener to this EventDispatcher. <ide> */ <ide> public void doFrame(long frameTimeNanos) { <ide> try { <ide> moveStagedEventsToDispatchQueue(); <ide> <del> if (mEventsToDispatchSize > 0 && !mHasDispatchScheduled) { <add> if (!mHasDispatchScheduled) { <ide> mHasDispatchScheduled = true; <ide> Systrace.startAsyncFlow( <ide> Systrace.TRACE_TAG_REACT_JAVA_BRIDGE, <ide> public void run() { <ide> mHasDispatchScheduled = false; <ide> Assertions.assertNotNull(mReactEventEmitter); <ide> synchronized (mEventsToDispatchLock) { <del> // We avoid allocating an array and iterator, and "sorting" if we don't need to. <del> // This occurs when the size of mEventsToDispatch is zero or one. <del> if (mEventsToDispatchSize > 1) { <del> Arrays.sort(mEventsToDispatch, 0, mEventsToDispatchSize, EVENT_COMPARATOR); <del> } <del> for (int eventIdx = 0; eventIdx < mEventsToDispatchSize; eventIdx++) { <del> Event event = mEventsToDispatch[eventIdx]; <del> // Event can be null if it has been coalesced into another event. <del> if (event == null) { <del> continue; <add> if (mEventsToDispatchSize > 0) { <add> // We avoid allocating an array and iterator, and "sorting" if we don't need to. <add> // This occurs when the size of mEventsToDispatch is zero or one. <add> if (mEventsToDispatchSize > 1) { <add> Arrays.sort(mEventsToDispatch, 0, mEventsToDispatchSize, EVENT_COMPARATOR); <add> } <add> for (int eventIdx = 0; eventIdx < mEventsToDispatchSize; eventIdx++) { <add> Event event = mEventsToDispatch[eventIdx]; <add> // Event can be null if it has been coalesced into another event. <add> if (event == null) { <add> continue; <add> } <add> Systrace.endAsyncFlow( <add> Systrace.TRACE_TAG_REACT_JAVA_BRIDGE, event.getEventName(), event.getUniqueID()); <add> event.dispatch(mReactEventEmitter); <add> event.dispose(); <ide> } <del> Systrace.endAsyncFlow( <del> Systrace.TRACE_TAG_REACT_JAVA_BRIDGE, <del> event.getEventName(), <del> event.getUniqueID()); <del> event.dispatch(mReactEventEmitter); <del> event.dispose(); <add> clearEventsToDispatch(); <add> mEventCookieToLastEventIdx.clear(); <ide> } <del> clearEventsToDispatch(); <del> mEventCookieToLastEventIdx.clear(); <ide> } <ide> for (BatchEventDispatchedListener listener : mPostEventDispatchListeners) { <ide> listener.onBatchEventDispatched();
1
Javascript
Javascript
remove old process list
09758fa71385f6de75efa172785ff2af1b4906f9
<ide><path>glances/outputs/static/js/services/plugins/processlist.js <del>glancesApp.service('GlancesPluginProcessList', function($filter, GlancesPlugin) { <del> var _pluginName = "processlist"; <del> var _maxProcessesToDisplay = undefined; <del> this.processes = []; <del> this.ioReadWritePresent = false; <del> <del> this.setData = function(data, views, config) { <del> this.processes = []; <del> this.ioReadWritePresent = false; <del> _maxProcessesToDisplay = config.outputs !== undefined ? config.outputs.max_processes_display : undefined;; <del> <del> for (var i = 0; i < data[_pluginName].length; i++) { <del> var process = data[_pluginName][i]; <del> <del> process.memvirt = process.memory_info[1]; <del> process.memres = process.memory_info[0]; <del> process.timeplus = $filter('timedelta')(process.cpu_times); <del> process.timemillis = $filter('timemillis')(process.cpu_times); <del> <del> process.ioRead = null; <del> process.ioWrite = null; <del> <del> if (process.io_counters) { <del> this.ioReadWritePresent = true; <del> <del> process.ioRead = (process.io_counters[0] - process.io_counters[2]) / process.time_since_update; <del> <del> if (process.ioRead != 0) { <del> process.ioRead = $filter('bytes')(process.ioRead); <del> } <del> <del> process.ioWrite = (process.io_counters[1] - process.io_counters[3]) / process.time_since_update; <del> <del> if (process.ioWrite != 0) { <del> process.ioWrite = $filter('bytes')(process.ioWrite); <del> } <del> } <del> <del> process.isNice = process.nice !== undefined && ((data['system'].os_name === 'Windows' && process.nice != 32) || (data['system'].os_name !== 'Windows' && process.nice != 0)); <del> <del> if (Array.isArray(process.cmdline)) { <del> process.cmdline = process.cmdline.join(' '); <del> } <del> <del> if (data['system'].os_name === 'Windows') { <del> process.username = _.last(process.username.split('\\')); <del> } <del> <del> this.processes.push(process); <del> } <del> }; <del> <del> this.getCpuPercentAlert = function(process) { <del> return GlancesPlugin.getAlert(_pluginName, 'processlist_cpu_', process.cpu_percent); <del> }; <del> <del> this.getMemoryPercentAlert = function(process) { <del> return GlancesPlugin.getAlert(_pluginName, 'processlist_mem_', process.cpu_percent); <del> }; <del> <del> this.getLimit = function() { <del> return _maxProcessesToDisplay; <del> }; <del>});
1
Text
Text
update new maintainer checklist
ac6b4dbe6e6921f6cb33fbbd87d4f39416a6af90
<ide><path>docs/New-Maintainer-Checklist.md <ide> contribute to Homebrew, but we will ask you to step down as a maintainer. <ide> <ide> A few requests: <ide> <del>- Please make pull requests on any changes to Homebrew/brew code or any <del> non-trivial (e.g. not a test or audit improvement or version bump) changes <del> to formulae code and don't merge them unless you get at least one approval <add>- Please make pull requests for any changes in the Homebrew repositories (instead <add> of committing directly) and don't merge them unless you get at least one approval <ide> and passing tests. <del>- In Homebrew/brew, close pull requests using GitHub's "Merge pull request" <del> button in "Create a merge commit" mode. <del>- In Homebrew/homebrew-core, use `brew pr-publish` to close pull requests <del> that require new bottles or change multiple formulae. Note that an approving <del> review on a pull request for an existing formula will trigger this automatically. <del> If commits need to be amended use `brew pr-pull` instead. Let these commands <del> auto-close issues whenever possible (it may take up to 5 minutes). If in doubt, <del> check with e.g. Fork.app that you've not accidentally added merge commits. <del> If bottles are unnecessary, use GitHub's "Merge pull request" button in <del> "Squash and merge" mode for a single formula change. <add>- Please review the Maintainer Guidelines at https://docs.brew.sh/Maintainer-Guidelines <add>- Please review the team-specific guides for whichever teams you will be a part of. <add> Here are links to these guides: <add> - Homebrew/brew: https://docs.brew.sh/Homebrew-brew-Maintainer-Guide <add> - Homebrew/homebrew-core: https://docs.brew.sh/Homebrew-homebrew-core-Maintainer-Guide <add> - Homebrew/linuxbrew-core: https://docs.brew.sh/Homebrew-linuxbrew-core-Maintainer-Guide <add> - Homebrew/homebrew-cask: https://docs.brew.sh/Homebrew-homebrew-cask-Maintainer-Guide <ide> - Still create your branches on your fork rather than in the main repository. <ide> Note GitHub's UI will create edits and reverts on the main repository if you <ide> make edits or click "Revert" on the Homebrew/brew repository rather than your <ide> own fork. <ide> - If still in doubt please ask for help and we'll help you out. <ide> - Please read: <del> - https://docs.brew.sh/Brew-Test-Bot-For-Core-Contributors <ide> - https://docs.brew.sh/Maintainer-Guidelines <add> - the team-specific guides linked above and in the maintainer guidelines <ide> - anything else you haven't read on https://docs.brew.sh <ide> <ide> How does that sound?
1
Javascript
Javascript
freeze more intrinsics
7264dbd038c90ca5524974d7d4705d1d4b692e15
<ide><path>lib/internal/freeze_intrinsics.js <ide> 'use strict'; <ide> <ide> const { <add> AggregateError, <add> AggregateErrorPrototype, <ide> Array, <ide> ArrayBuffer, <ide> ArrayBufferPrototype, <add> ArrayIteratorPrototype, <ide> ArrayPrototype, <ide> ArrayPrototypeForEach, <ide> ArrayPrototypePush, <ide> const { <ide> ErrorPrototype, <ide> EvalError, <ide> EvalErrorPrototype, <add> FinalizationRegistry, <add> FinalizationRegistryPrototype, <ide> Float32Array, <ide> Float32ArrayPrototype, <ide> Float64Array, <ide> const { <ide> Set, <ide> SetPrototype, <ide> String, <add> StringIteratorPrototype, <ide> StringPrototype, <ide> Symbol, <ide> SymbolIterator, <add> SymbolMatchAll, <add> SymbolPrototype, <ide> SyntaxError, <ide> SyntaxErrorPrototype, <ide> TypeError, <ide> const { <ide> URIErrorPrototype, <ide> WeakMap, <ide> WeakMapPrototype, <add> WeakRef, <add> WeakRefPrototype, <ide> WeakSet, <ide> WeakSetPrototype, <ide> decodeURI, <ide> decodeURIComponent, <ide> encodeURI, <ide> encodeURIComponent, <add> globalThis, <ide> } = primordials; <ide> <ide> module.exports = function() { <ide> module.exports = function() { <ide> } = require('timers'); <ide> <ide> const intrinsicPrototypes = [ <del> // Anonymous Intrinsics <del> // IteratorPrototype <del> ObjectGetPrototypeOf( <del> ObjectGetPrototypeOf(new Array()[SymbolIterator]()) <del> ), <del> // ArrayIteratorPrototype <del> ObjectGetPrototypeOf(new Array()[SymbolIterator]()), <del> // StringIteratorPrototype <del> ObjectGetPrototypeOf(new String()[SymbolIterator]()), <del> // MapIteratorPrototype <del> ObjectGetPrototypeOf(new Map()[SymbolIterator]()), <del> // SetIteratorPrototype <del> ObjectGetPrototypeOf(new Set()[SymbolIterator]()), <del> // GeneratorFunction <del> ObjectGetPrototypeOf(function* () {}), <del> // AsyncFunction <del> ObjectGetPrototypeOf(async function() {}), <del> // AsyncGeneratorFunction <del> ObjectGetPrototypeOf(async function* () {}), <del> // TypedArray <del> TypedArrayPrototype, <del> <del> // 19 Fundamental Objects <del> ObjectPrototype, // 19.1 <del> FunctionPrototype, // 19.2 <del> BooleanPrototype, // 19.3 <del> <del> ErrorPrototype, // 19.5 <add> // 20 Fundamental Objects <add> ObjectPrototype, // 20.1 <add> FunctionPrototype, // 20.2 <add> BooleanPrototype, // 20.3 <add> SymbolPrototype, // 20.4 <add> <add> ErrorPrototype, // 20.5 <add> AggregateErrorPrototype, <ide> EvalErrorPrototype, <ide> RangeErrorPrototype, <ide> ReferenceErrorPrototype, <ide> SyntaxErrorPrototype, <ide> TypeErrorPrototype, <ide> URIErrorPrototype, <ide> <del> // 20 Numbers and Dates <del> NumberPrototype, // 20.1 <del> DatePrototype, // 20.3 <add> // 21 Numbers and Dates <add> NumberPrototype, // 21.1 <add> BigIntPrototype, // 21.2 <add> DatePrototype, // 21.4 <ide> <del> // 21 Text Processing <del> StringPrototype, // 21.1 <del> RegExpPrototype, // 21.2 <add> // 22 Text Processing <add> StringPrototype, // 22.1 <add> StringIteratorPrototype, // 22.1.5 <add> RegExpPrototype, // 22.2 <add> // 22.2.7 RegExpStringIteratorPrototype <add> ObjectGetPrototypeOf(/e/[SymbolMatchAll]()), <ide> <del> // 22 Indexed Collections <del> ArrayPrototype, // 22.1 <add> // 23 Indexed Collections <add> ArrayPrototype, // 23.1 <add> ArrayIteratorPrototype, // 23.1.5 <ide> <add> TypedArrayPrototype, // 23.2 <ide> Int8ArrayPrototype, <ide> Uint8ArrayPrototype, <ide> Uint8ClampedArrayPrototype, <ide> module.exports = function() { <ide> BigInt64ArrayPrototype, <ide> BigUint64ArrayPrototype, <ide> <del> // 23 Keyed Collections <del> MapPrototype, // 23.1 <del> SetPrototype, // 23.2 <del> WeakMapPrototype, // 23.3 <del> WeakSetPrototype, // 23.4 <del> <del> // 24 Structured Data <del> ArrayBufferPrototype, // 24.1 <del> DataViewPrototype, // 24.3 <del> PromisePrototype, // 25.4 <add> // 24 Keyed Collections <add> MapPrototype, // 24.1 <add> // 24.1.5 MapIteratorPrototype <add> ObjectGetPrototypeOf(new Map()[SymbolIterator]()), <add> SetPrototype, // 24.2 <add> // 24.2.5 SetIteratorPrototype <add> ObjectGetPrototypeOf(new Set()[SymbolIterator]()), <add> WeakMapPrototype, // 24.3 <add> WeakSetPrototype, // 24.4 <add> <add> // 25 Structured Data <add> ArrayBufferPrototype, // 25.1 <add> SharedArrayBuffer.prototype, // 25.2 <add> DataViewPrototype, // 25.3 <add> <add> // 26 Managing Memory <add> WeakRefPrototype, // 26.1 <add> FinalizationRegistryPrototype, // 26.2 <add> <add> // 27 Control Abstraction Objects <add> // 27.1 Iteration <add> ObjectGetPrototypeOf(ArrayIteratorPrototype), // 27.1.2 IteratorPrototype <add> // 27.1.3 AsyncIteratorPrototype <add> ObjectGetPrototypeOf(ObjectGetPrototypeOf(ObjectGetPrototypeOf( <add> (async function*() {})() <add> ))), <add> PromisePrototype, // 27.2 <ide> <ide> // Other APIs / Web Compatibility <ide> console.Console.prototype, <del> BigIntPrototype, <ide> WebAssembly.Module.prototype, <ide> WebAssembly.Instance.prototype, <ide> WebAssembly.Table.prototype, <ide> WebAssembly.Memory.prototype, <ide> WebAssembly.CompileError.prototype, <ide> WebAssembly.LinkError.prototype, <ide> WebAssembly.RuntimeError.prototype, <del> SharedArrayBuffer.prototype, <ide> ]; <ide> const intrinsics = [ <del> // Anonymous Intrinsics <del> // ThrowTypeError <add> // 10.2.4.1 ThrowTypeError <ide> ObjectGetOwnPropertyDescriptor(FunctionPrototype, 'caller').get, <del> // IteratorPrototype <del> ObjectGetPrototypeOf( <del> ObjectGetPrototypeOf(new Array()[SymbolIterator]()) <del> ), <del> // ArrayIteratorPrototype <del> ObjectGetPrototypeOf(new Array()[SymbolIterator]()), <del> // StringIteratorPrototype <del> ObjectGetPrototypeOf(new String()[SymbolIterator]()), <del> // MapIteratorPrototype <del> ObjectGetPrototypeOf(new Map()[SymbolIterator]()), <del> // SetIteratorPrototype <del> ObjectGetPrototypeOf(new Set()[SymbolIterator]()), <del> // GeneratorFunction <del> ObjectGetPrototypeOf(function* () {}), <del> // AsyncFunction <del> ObjectGetPrototypeOf(async function() {}), <del> // AsyncGeneratorFunction <del> ObjectGetPrototypeOf(async function* () {}), <del> // TypedArray <del> TypedArray, <ide> <del> // 18 The Global Object <add> // 19 The Global Object <add> // 19.2 Function Properties of the Global Object <ide> eval, <ide> // eslint-disable-next-line node-core/prefer-primordials <ide> isFinite, <ide> module.exports = function() { <ide> parseFloat, <ide> // eslint-disable-next-line node-core/prefer-primordials <ide> parseInt, <add> // 19.2.6 URI Handling Functions <ide> decodeURI, <ide> decodeURIComponent, <ide> encodeURI, <ide> encodeURIComponent, <ide> <del> // 19 Fundamental Objects <del> Object, // 19.1 <del> Function, // 19.2 <del> Boolean, // 19.3 <del> Symbol, // 19.4 <add> // 20 Fundamental Objects <add> Object, // 20.1 <add> Function, // 20.2 <add> Boolean, // 20.3 <add> Symbol, // 20.4 <ide> <del> Error, // 19.5 <add> Error, // 20.5 <add> AggregateError, <ide> EvalError, <ide> RangeError, <ide> ReferenceError, <ide> SyntaxError, <ide> TypeError, <ide> URIError, <ide> <del> // 20 Numbers and Dates <del> Number, // 20.1 <add> // 21 Numbers and Dates <add> Number, // 21.1 <add> BigInt, // 21.2 <ide> // eslint-disable-next-line node-core/prefer-primordials <del> Math, // 20.2 <del> Date, // 20.3 <del> <del> // 21 Text Processing <del> String, // 21.1 <del> RegExp, // 21.2 <del> <del> // 22 Indexed Collections <del> Array, // 22.1 <del> <add> Math, // 21.3 <add> Date, // 21.4 <add> <add> // 22 Text Processing <add> String, // 22.1 <add> StringIteratorPrototype, // 22.1.5 <add> RegExp, // 22.2 <add> // 22.2.7 RegExpStringIteratorPrototype <add> ObjectGetPrototypeOf(/e/[SymbolMatchAll]()), <add> <add> // 23 Indexed Collections <add> Array, // 23.1 <add> ArrayIteratorPrototype, // 23.1.5 <add> // 23.2 TypedArray <add> TypedArray, <ide> Int8Array, <ide> Uint8Array, <ide> Uint8ClampedArray, <ide> module.exports = function() { <ide> BigInt64Array, <ide> BigUint64Array, <ide> <del> // 23 Keyed Collections <del> Map, // 23.1 <del> Set, // 23.2 <del> WeakMap, // 23.3 <del> WeakSet, // 23.4 <del> <del> // 24 Structured Data <del> ArrayBuffer, // 24.1 <del> DataView, // 24.3 <add> // 24 Keyed Collections <add> Map, // 24.1 <add> // 24.1.5 MapIteratorPrototype <add> ObjectGetPrototypeOf(new Map()[SymbolIterator]()), <add> Set, // 24.2 <add> // 24.2.5 SetIteratorPrototype <add> ObjectGetPrototypeOf(new Set()[SymbolIterator]()), <add> WeakMap, // 24.3 <add> WeakSet, // 24.4 <add> <add> // 25 Structured Data <add> ArrayBuffer, // 25.1 <add> SharedArrayBuffer, // 25.2 <add> DataView, // 25.3 <add> Atomics, // 25.4 <ide> // eslint-disable-next-line node-core/prefer-primordials <del> JSON, // 24.5 <del> Promise, // 25.4 <add> JSON, // 25.5 <add> <add> // 26 Managing Memory <add> WeakRef, // 26.1 <add> FinalizationRegistry, // 26.2 <add> <add> // 27 Control Abstraction Objects <add> // 27.1 Iteration <add> ObjectGetPrototypeOf(ArrayIteratorPrototype), // 27.1.2 IteratorPrototype <add> // 27.1.3 AsyncIteratorPrototype <add> ObjectGetPrototypeOf(ObjectGetPrototypeOf(ObjectGetPrototypeOf( <add> (async function*() {})() <add> ))), <add> Promise, // 27.2 <add> // 27.3 GeneratorFunction <add> ObjectGetPrototypeOf(function* () {}), <add> // 27.4 AsyncGeneratorFunction <add> ObjectGetPrototypeOf(async function* () {}), <add> // 27.7 AsyncFunction <add> ObjectGetPrototypeOf(async function() {}), <ide> <del> // 26 Reflection <add> // 28 Reflection <ide> // eslint-disable-next-line node-core/prefer-primordials <del> Reflect, // 26.1 <del> Proxy, // 26.2 <add> Reflect, // 28.1 <add> Proxy, // 28.2 <ide> <ide> // B.2.1 <ide> escape, <ide> module.exports = function() { <ide> setInterval, <ide> setTimeout, <ide> console, <del> BigInt, <del> Atomics, <ide> WebAssembly, <del> SharedArrayBuffer, <ide> ]; <ide> <ide> if (typeof Intl !== 'undefined') { <ide> module.exports = function() { <ide> const frozenSet = new WeakSet(); <ide> ArrayPrototypeForEach(intrinsics, deepFreeze); <ide> <add> // 19.1 Value Properties of the Global Object <add> ObjectDefineProperty(globalThis, 'globalThis', { <add> configurable: false, <add> writable: false, <add> value: globalThis, <add> }); <add> <ide> // Objects that are deeply frozen. <ide> function deepFreeze(root) { <ide> /** <ide><path>test/parallel/test-freeze-intrinsics.js <ide> assert.throws( <ide> assert.strictEqual(Object.getOwnPropertyDescriptor(o, 'toString').enumerable, <ide> true); <ide> } <add> <add>// Ensure we can not override globalThis <add>{ <add> assert.throws(() => { globalThis.globalThis = null; }, <add> { name: 'TypeError' }); <add> assert.strictEqual(globalThis.globalThis, globalThis); <add>}
2
Java
Java
rewrite concurrentlrucache implementation
c470262c8ea733fd0846a50232599715ec2d2b83
<ide><path>spring-core/src/jmh/java/org/springframework/util/ConcurrentLruCacheBenchmark.java <add>/* <add> * Copyright 2002-2022 the original author or authors. <add> * <add> * Licensed under the Apache License, Version 2.0 (the "License"); <add> * you may not use this file except in compliance with the License. <add> * You may obtain a copy of the License at <add> * <add> * https://www.apache.org/licenses/LICENSE-2.0 <add> * <add> * Unless required by applicable law or agreed to in writing, software <add> * distributed under the License is distributed on an "AS IS" BASIS, <add> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <add> * See the License for the specific language governing permissions and <add> * limitations under the License. <add> */ <add> <add>package org.springframework.util; <add> <add>import java.util.ArrayList; <add>import java.util.List; <add>import java.util.Random; <add>import java.util.function.Function; <add> <add>import org.openjdk.jmh.annotations.Benchmark; <add>import org.openjdk.jmh.annotations.BenchmarkMode; <add>import org.openjdk.jmh.annotations.Level; <add>import org.openjdk.jmh.annotations.Mode; <add>import org.openjdk.jmh.annotations.Param; <add>import org.openjdk.jmh.annotations.Scope; <add>import org.openjdk.jmh.annotations.Setup; <add>import org.openjdk.jmh.annotations.State; <add>import org.openjdk.jmh.infra.Blackhole; <add> <add>/** <add> * Benchmarks for {@link ConcurrentLruCache}. <add> * @author Brian Clozel <add> */ <add>@BenchmarkMode(Mode.Throughput) <add>public class ConcurrentLruCacheBenchmark { <add> <add> @Benchmark <add> public void lruCache(BenchmarkData data, Blackhole bh) { <add> for (String element : data.elements) { <add> String value = data.lruCache.get(element); <add> bh.consume(value); <add> } <add> } <add> <add> @State(Scope.Benchmark) <add> public static class BenchmarkData { <add> <add> ConcurrentLruCache<String, String> lruCache; <add> <add> @Param({"100"}) <add> public int capacity; <add> <add> @Param({"0.1"}) <add> public float cacheMissRate; <add> <add> public List<String> elements; <add> <add> public Function<String, String> generator; <add> <add> @Setup(Level.Iteration) <add> public void setup() { <add> this.generator = key -> key + "value"; <add> this.lruCache = new ConcurrentLruCache<>(this.capacity, this.generator); <add> Assert.isTrue(this.cacheMissRate < 1, "cache miss rate should be < 1"); <add> Random random = new Random(); <add> int elementsCount = Math.round(this.capacity * (1 + this.cacheMissRate)); <add> this.elements = new ArrayList<>(elementsCount); <add> random.ints(elementsCount).forEach(value -> this.elements.add(String.valueOf(value))); <add> this.elements.sort(String::compareTo); <add> } <add> } <add>} <ide><path>spring-core/src/main/java/org/springframework/util/ConcurrentLruCache.java <ide> /* <del> * Copyright 2002-2021 the original author or authors. <add> * Copyright 2002-2022 the original author or authors. <ide> * <ide> * Licensed under the Apache License, Version 2.0 (the "License"); <ide> * you may not use this file except in compliance with the License. <ide> <ide> package org.springframework.util; <ide> <add>import java.util.Queue; <ide> import java.util.concurrent.ConcurrentHashMap; <del>import java.util.concurrent.ConcurrentLinkedDeque; <del>import java.util.concurrent.locks.ReadWriteLock; <del>import java.util.concurrent.locks.ReentrantReadWriteLock; <add>import java.util.concurrent.ConcurrentLinkedQueue; <add>import java.util.concurrent.ConcurrentMap; <add>import java.util.concurrent.atomic.AtomicInteger; <add>import java.util.concurrent.atomic.AtomicLong; <add>import java.util.concurrent.atomic.AtomicReference; <add>import java.util.concurrent.locks.Lock; <add>import java.util.concurrent.locks.ReentrantLock; <ide> import java.util.function.Function; <ide> <add>import org.springframework.lang.Nullable; <add> <add> <ide> /** <del> * Simple LRU (Least Recently Used) cache, bounded by a specified cache limit. <del> * <del> * <p>This implementation is backed by a {@code ConcurrentHashMap} for storing <del> * the cached values and a {@code ConcurrentLinkedDeque} for ordering the keys <del> * and choosing the least recently used key when the cache is at full capacity. <add> * Simple LRU (Least Recently Used) cache, bounded by a specified cache capacity. <add> * <p>This is a simplified, opinionated implementation of a LRU cache for internal <add> * use in Spring Framework. It is inspired from <add> * <a href="https://github.com/ben-manes/concurrentlinkedhashmap">ConcurrentLinkedHashMap</a>. <add> * <p>Read and write operations are internally recorded in dedicated buffers, <add> * then drained at chosen times to avoid contention. <ide> * <ide> * @author Brian Clozel <del> * @author Juergen Hoeller <add> * @author Ben Manes <ide> * @since 5.3 <ide> * @param <K> the type of the key used for cache retrieval <del> * @param <V> the type of the cached values <del> * @see #get <add> * @param <V> the type of the cached values, does not allow null values <add> * @see #get(Object) <ide> */ <del>public class ConcurrentLruCache<K, V> { <add>@SuppressWarnings({"unchecked"}) <add>public final class ConcurrentLruCache<K, V> { <add> <add> private final int capacity; <ide> <del> private final int sizeLimit; <add> private final AtomicInteger currentSize = new AtomicInteger(); <add> <add> private final ConcurrentMap<K, Node<K, V>> cache; <ide> <ide> private final Function<K, V> generator; <ide> <del> private final ConcurrentHashMap<K, V> cache = new ConcurrentHashMap<>(); <add> private final ReadOperations<K, V> readOperations; <ide> <del> private final ConcurrentLinkedDeque<K> queue = new ConcurrentLinkedDeque<>(); <add> private final WriteOperations writeOperations; <ide> <del> private final ReadWriteLock lock = new ReentrantReadWriteLock(); <add> private final Lock evictionLock = new ReentrantLock(); <ide> <del> private volatile int size; <add> /* <add> * Queue that contains all ACTIVE cache entries, ordered with least recently used entries first. <add> * Read and write operations are buffered and periodically processed to reorder the queue. <add> */ <add> private final EvictionQueue<K, V> evictionQueue = new EvictionQueue<>(); <ide> <add> private final AtomicReference<DrainStatus> drainStatus = new AtomicReference<>(DrainStatus.IDLE); <ide> <ide> /** <del> * Create a new cache instance with the given limit and generator function. <del> * @param sizeLimit the maximum number of entries in the cache <add> * Create a new cache instance with the given capacity and generator function. <add> * @param capacity the maximum number of entries in the cache <ide> * (0 indicates no caching, always generating a new value) <ide> * @param generator a function to generate a new value for a given key <ide> */ <del> public ConcurrentLruCache(int sizeLimit, Function<K, V> generator) { <del> Assert.isTrue(sizeLimit >= 0, "Cache size limit must not be negative"); <del> Assert.notNull(generator, "Generator function must not be null"); <del> this.sizeLimit = sizeLimit; <del> this.generator = generator; <add> public ConcurrentLruCache(int capacity, Function<K, V> generator) { <add> this(capacity, generator, 16); <ide> } <ide> <add> private ConcurrentLruCache(int capacity, Function<K, V> generator, int concurrencyLevel) { <add> Assert.isTrue(capacity > 0, "Capacity should be > 0"); <add> this.capacity = capacity; <add> this.cache = new ConcurrentHashMap<>(16, 0.75f, concurrencyLevel); <add> this.generator = generator; <add> this.readOperations = new ReadOperations<>(this.evictionQueue); <add> this.writeOperations = new WriteOperations(); <add> } <ide> <ide> /** <del> * Retrieve an entry from the cache, potentially triggering generation <del> * of the value. <add> * Retrieve an entry from the cache, potentially triggering generation of the value. <ide> * @param key the key to retrieve the entry for <ide> * @return the cached or newly generated value <ide> */ <ide> public V get(K key) { <del> if (this.sizeLimit == 0) { <del> return this.generator.apply(key); <add> final Node<K, V> node = this.cache.get(key); <add> if (node == null) { <add> V value = this.generator.apply(key); <add> put(key, value); <add> return value; <ide> } <add> processRead(node); <add> return node.getValue(); <add> } <ide> <del> V cached = this.cache.get(key); <del> if (cached != null) { <del> if (this.size < this.sizeLimit) { <del> return cached; <del> } <del> this.lock.readLock().lock(); <add> private void put(K key, V value) { <add> Assert.notNull(key, "key should not be null"); <add> Assert.notNull(value, "value should not be null"); <add> final CacheEntry<V> cacheEntry = new CacheEntry<>(value, CacheEntryState.ACTIVE); <add> final Node<K, V> node = new Node<>(key, cacheEntry); <add> final Node<K, V> prior = this.cache.put(node.key, node); <add> if (prior == null) { <add> processWrite(new AddTask(node)); <add> } <add> else { <add> processRead(prior); <add> } <add> } <add> <add> private void processRead(Node<K, V> node) { <add> boolean drainRequested = this.readOperations.recordRead(node); <add> final DrainStatus status = this.drainStatus.get(); <add> if (status.shouldDrainBuffers(drainRequested)) { <add> drainOperations(); <add> } <add> } <add> <add> private void processWrite(Runnable task) { <add> this.writeOperations.add(task); <add> this.drainStatus.lazySet(DrainStatus.REQUIRED); <add> drainOperations(); <add> } <add> <add> private void drainOperations() { <add> if (this.evictionLock.tryLock()) { <ide> try { <del> if (this.queue.removeLastOccurrence(key)) { <del> this.queue.offer(key); <del> } <del> return cached; <add> this.drainStatus.lazySet(DrainStatus.PROCESSING); <add> this.readOperations.drain(); <add> this.writeOperations.drain(); <ide> } <ide> finally { <del> this.lock.readLock().unlock(); <add> this.drainStatus.compareAndSet(DrainStatus.PROCESSING, DrainStatus.IDLE); <add> this.evictionLock.unlock(); <ide> } <ide> } <add> } <add> <add> /** <add> * Return the maximum number of entries in the cache. <add> * @see #size() <add> */ <add> public int capacity() { <add> return this.capacity; <add> } <ide> <del> this.lock.writeLock().lock(); <add> /** <add> * Return the maximum number of entries in the cache. <add> * @deprecated in favor of {@link #capacity()} as of 6.0. <add> */ <add> @Deprecated <add> public int sizeLimit() { <add> return this.capacity; <add> } <add> <add> /** <add> * Return the current size of the cache. <add> * @see #capacity() <add> */ <add> public int size() { <add> return this.cache.size(); <add> } <add> <add> /** <add> * Immediately remove all entries from this cache. <add> */ <add> public void clear() { <add> this.evictionLock.lock(); <ide> try { <del> // Retrying in case of concurrent reads on the same key <del> cached = this.cache.get(key); <del> if (cached != null) { <del> if (this.queue.removeLastOccurrence(key)) { <del> this.queue.offer(key); <del> } <del> return cached; <del> } <del> // Generate value first, to prevent size inconsistency <del> V value = this.generator.apply(key); <del> if (this.size == this.sizeLimit) { <del> K leastUsed = this.queue.poll(); <del> if (leastUsed != null) { <del> this.cache.remove(leastUsed); <del> } <add> Node<K, V> node; <add> while ((node = this.evictionQueue.poll()) != null) { <add> this.cache.remove(node.key, node); <add> markAsRemoved(node); <ide> } <del> this.queue.offer(key); <del> this.cache.put(key, value); <del> this.size = this.cache.size(); <del> return value; <add> this.readOperations.clear(); <add> this.writeOperations.drainAll(); <ide> } <ide> finally { <del> this.lock.writeLock().unlock(); <add> this.evictionLock.unlock(); <add> } <add> } <add> <add> /* <add> * Transition the node to the {@code removed} state and decrement the current size of the cache. <add> */ <add> private void markAsRemoved(Node<K, V> node) { <add> for (; ; ) { <add> CacheEntry<V> current = node.get(); <add> CacheEntry<V> removed = new CacheEntry<>(current.value, CacheEntryState.REMOVED); <add> if (node.compareAndSet(current, removed)) { <add> this.currentSize.lazySet(this.currentSize.get() - 1); <add> return; <add> } <ide> } <ide> } <ide> <ide> /** <ide> * Determine whether the given key is present in this cache. <ide> * @param key the key to check for <del> * @return {@code true} if the key is present, <del> * {@code false} if there was no matching key <add> * @return {@code true} if the key is present, {@code false} if there was no matching key <ide> */ <ide> public boolean contains(K key) { <ide> return this.cache.containsKey(key); <ide> public boolean contains(K key) { <ide> * @return {@code true} if the key was present before, <ide> * {@code false} if there was no matching key <ide> */ <add> @Nullable <ide> public boolean remove(K key) { <del> this.lock.writeLock().lock(); <del> try { <del> boolean wasPresent = (this.cache.remove(key) != null); <del> this.queue.remove(key); <del> this.size = this.cache.size(); <del> return wasPresent; <add> final Node<K, V> node = this.cache.remove(key); <add> if (node == null) { <add> return false; <ide> } <del> finally { <del> this.lock.writeLock().unlock(); <add> markForRemoval(node); <add> processWrite(new RemovalTask(node)); <add> return true; <add> } <add> <add> /* <add> * Transition the node from the {@code active} state to the {@code pending removal} state, <add> * if the transition is valid. <add> */ <add> private void markForRemoval(Node<K, V> node) { <add> for (; ; ) { <add> final CacheEntry<V> current = node.get(); <add> if (!current.isActive()) { <add> return; <add> } <add> final CacheEntry<V> pendingRemoval = new CacheEntry<>(current.value, CacheEntryState.PENDING_REMOVAL); <add> if (node.compareAndSet(current, pendingRemoval)) { <add> return; <add> } <ide> } <ide> } <ide> <ide> /** <del> * Immediately remove all entries from this cache. <add> * Write operation recorded when a new entry is added to the cache. <ide> */ <del> public void clear() { <del> this.lock.writeLock().lock(); <del> try { <del> this.cache.clear(); <del> this.queue.clear(); <del> this.size = 0; <add> private final class AddTask implements Runnable { <add> final Node<K, V> node; <add> <add> AddTask(Node<K, V> node) { <add> this.node = node; <ide> } <del> finally { <del> this.lock.writeLock().unlock(); <add> <add> @Override <add> public void run() { <add> currentSize.lazySet(currentSize.get() + 1); <add> if (this.node.get().isActive()) { <add> evictionQueue.add(this.node); <add> evictEntries(); <add> } <ide> } <add> <add> private void evictEntries() { <add> while (currentSize.get() > capacity) { <add> final Node<K, V> node = evictionQueue.poll(); <add> if (node == null) { <add> return; <add> } <add> cache.remove(node.key, node); <add> markAsRemoved(node); <add> } <add> } <add> <ide> } <ide> <add> <ide> /** <del> * Return the current size of the cache. <del> * @see #sizeLimit() <add> * Write operation recorded when an entry is removed to the cache. <ide> */ <del> public int size() { <del> return this.size; <add> private final class RemovalTask implements Runnable { <add> final Node<K, V> node; <add> <add> RemovalTask(Node<K, V> node) { <add> this.node = node; <add> } <add> <add> @Override <add> public void run() { <add> evictionQueue.remove(this.node); <add> markAsRemoved(this.node); <add> } <ide> } <ide> <del> /** <del> * Return the maximum number of entries in the cache <del> * (0 indicates no caching, always generating a new value). <del> * @see #size() <add> <add> /* <add> * Draining status for the read/write buffers. <ide> */ <del> public int sizeLimit() { <del> return this.sizeLimit; <add> private enum DrainStatus { <add> <add> /* <add> * No drain operation currently running. <add> */ <add> IDLE { <add> @Override <add> boolean shouldDrainBuffers(boolean delayable) { <add> return !delayable; <add> } <add> }, <add> <add> /* <add> * A drain operation is required due to a pending write modification. <add> */ <add> REQUIRED { <add> @Override <add> boolean shouldDrainBuffers(boolean delayable) { <add> return true; <add> } <add> }, <add> <add> /* <add> * A drain operation is in progress. <add> */ <add> PROCESSING { <add> @Override <add> boolean shouldDrainBuffers(boolean delayable) { <add> return false; <add> } <add> }; <add> <add> /** <add> * Determine whether the buffers should be drained. <add> * @param delayable if a drain should be delayed until required <add> * @return if a drain should be attempted <add> */ <add> abstract boolean shouldDrainBuffers(boolean delayable); <add> } <add> <add> private enum CacheEntryState { <add> ACTIVE, PENDING_REMOVAL, REMOVED <add> } <add> <add> private record CacheEntry<V>(V value, CacheEntryState state) { <add> <add> boolean isActive() { <add> return this.state == CacheEntryState.ACTIVE; <add> } <add> } <add> <add> private static final class ReadOperations<K, V> { <add> <add> private static final int BUFFER_COUNT = detectNumberOfBuffers(); <add> <add> private static int detectNumberOfBuffers() { <add> int availableProcessors = Runtime.getRuntime().availableProcessors(); <add> return 1 << (Integer.SIZE - Integer.numberOfLeadingZeros(availableProcessors - 1)); <add> } <add> <add> private static final int BUFFERS_MASK = BUFFER_COUNT - 1; <add> <add> private static final int MAX_PENDING_OPERATIONS = 32; <add> <add> private static final int MAX_DRAIN_COUNT = 2 * MAX_PENDING_OPERATIONS; <add> <add> private static final int BUFFER_SIZE = 2 * MAX_DRAIN_COUNT; <add> <add> private static final int BUFFER_INDEX_MASK = BUFFER_SIZE - 1; <add> <add> /* <add> * Number of operations recorded, for each buffer <add> */ <add> private final AtomicLong[] recordedCount = new AtomicLong[BUFFER_COUNT]; <add> <add> /* <add> * Number of operations read, for each buffer <add> */ <add> private final long[] readCount = new long[BUFFER_COUNT]; <add> <add> /* <add> * Number of operations processed, for each buffer <add> */ <add> private final AtomicLong[] processedCount = new AtomicLong[BUFFER_COUNT]; <add> <add> @SuppressWarnings("rawtypes") <add> private final AtomicReference<Node<K, V>>[][] buffers = new AtomicReference[BUFFER_COUNT][BUFFER_SIZE]; <add> <add> private final EvictionQueue<K, V> evictionQueue; <add> <add> @SuppressWarnings("rawtypes") <add> ReadOperations(EvictionQueue<K, V> evictionQueue) { <add> this.evictionQueue = evictionQueue; <add> for (int i = 0; i < BUFFER_COUNT; i++) { <add> this.recordedCount[i] = new AtomicLong(); <add> this.processedCount[i] = new AtomicLong(); <add> this.buffers[i] = new AtomicReference[BUFFER_SIZE]; <add> for (int j = 0; j < BUFFER_SIZE; j++) { <add> this.buffers[i][j] = new AtomicReference<>(); <add> } <add> } <add> } <add> <add> private static int getBufferIndex() { <add> return ((int) Thread.currentThread().getId()) & BUFFERS_MASK; <add> } <add> <add> boolean recordRead(Node<K, V> node) { <add> int bufferIndex = getBufferIndex(); <add> final AtomicLong counter = this.recordedCount[bufferIndex]; <add> final long writeCount = counter.get(); <add> counter.lazySet(writeCount + 1); <add> final int index = (int) (writeCount & BUFFER_INDEX_MASK); <add> this.buffers[bufferIndex][index].lazySet(node); <add> final long pending = (writeCount - this.processedCount[bufferIndex].get()); <add> return (pending < MAX_PENDING_OPERATIONS); <add> } <add> <add> void drain() { <add> final int start = (int) Thread.currentThread().getId(); <add> final int end = start + BUFFER_COUNT; <add> for (int i = start; i < end; i++) { <add> drainReadBuffer(i & BUFFERS_MASK); <add> } <add> } <add> <add> void clear() { <add> for (AtomicReference<Node<K, V>>[] buffer : this.buffers) { <add> for (AtomicReference<Node<K, V>> slot : buffer) { <add> slot.lazySet(null); <add> } <add> } <add> } <add> <add> private void drainReadBuffer(int bufferIndex) { <add> final long writeCount = this.recordedCount[bufferIndex].get(); <add> for (int i = 0; i < MAX_DRAIN_COUNT; i++) { <add> final int index = (int) (this.readCount[bufferIndex] & BUFFER_INDEX_MASK); <add> final AtomicReference<Node<K, V>> slot = this.buffers[bufferIndex][index]; <add> final Node<K, V> node = slot.get(); <add> if (node == null) { <add> break; <add> } <add> slot.lazySet(null); <add> this.evictionQueue.moveToBack(node); <add> this.readCount[bufferIndex]++; <add> } <add> this.processedCount[bufferIndex].lazySet(writeCount); <add> } <add> } <add> <add> private static final class WriteOperations { <add> <add> private static final int DRAIN_THRESHOLD = 16; <add> <add> private final Queue<Runnable> operations = new ConcurrentLinkedQueue<>(); <add> <add> public void add(Runnable task) { <add> this.operations.add(task); <add> } <add> <add> public void drain() { <add> for (int i = 0; i < DRAIN_THRESHOLD; i++) { <add> final Runnable task = this.operations.poll(); <add> if (task == null) { <add> break; <add> } <add> task.run(); <add> } <add> } <add> <add> public void drainAll() { <add> Runnable task; <add> while ((task = this.operations.poll()) != null) { <add> task.run(); <add> } <add> } <add> <add> } <add> <add> @SuppressWarnings("serial") <add> private static final class Node<K, V> extends AtomicReference<CacheEntry<V>> { <add> final K key; <add> <add> @Nullable <add> Node<K, V> prev; <add> <add> @Nullable <add> Node<K, V> next; <add> <add> Node(K key, CacheEntry<V> cacheEntry) { <add> super(cacheEntry); <add> this.key = key; <add> } <add> <add> @Nullable <add> public Node<K, V> getPrevious() { <add> return this.prev; <add> } <add> <add> public void setPrevious(@Nullable Node<K, V> prev) { <add> this.prev = prev; <add> } <add> <add> @Nullable <add> public Node<K, V> getNext() { <add> return this.next; <add> } <add> <add> public void setNext(@Nullable Node<K, V> next) { <add> this.next = next; <add> } <add> <add> V getValue() { <add> return get().value; <add> } <add> } <add> <add> <add> private static final class EvictionQueue<K, V> { <add> <add> @Nullable <add> Node<K, V> first; <add> <add> @Nullable <add> Node<K, V> last; <add> <add> <add> @Nullable <add> Node<K, V> poll() { <add> if (this.first == null) { <add> return null; <add> } <add> final Node<K, V> f = this.first; <add> final Node<K, V> next = f.getNext(); <add> f.setNext(null); <add> <add> this.first = next; <add> if (next == null) { <add> this.last = null; <add> } <add> else { <add> next.setPrevious(null); <add> } <add> return f; <add> } <add> <add> void add(Node<K, V> e) { <add> if (contains(e)) { <add> return; <add> } <add> linkLast(e); <add> } <add> <add> private boolean contains(Node<K, V> e) { <add> return (e.getPrevious() != null) <add> || (e.getNext() != null) <add> || (e == this.first); <add> } <add> <add> private void linkLast(final Node<K, V> e) { <add> final Node<K, V> l = this.last; <add> this.last = e; <add> <add> if (l == null) { <add> this.first = e; <add> } <add> else { <add> l.setNext(e); <add> e.setPrevious(l); <add> } <add> } <add> <add> private void unlink(Node<K, V> e) { <add> final Node<K, V> prev = e.getPrevious(); <add> final Node<K, V> next = e.getNext(); <add> if (prev == null) { <add> this.first = next; <add> } <add> else { <add> prev.setNext(next); <add> e.setPrevious(null); <add> } <add> if (next == null) { <add> this.last = prev; <add> } <add> else { <add> next.setPrevious(prev); <add> e.setNext(null); <add> } <add> } <add> <add> void moveToBack(Node<K, V> e) { <add> if (contains(e) && e != this.last) { <add> unlink(e); <add> linkLast(e); <add> } <add> } <add> <add> void remove(Node<K, V> e) { <add> if (contains(e)) { <add> unlink(e); <add> } <add> } <add> <ide> } <ide> <ide> } <ide><path>spring-core/src/test/java/org/springframework/util/ConcurrentLruCacheTests.java <ide> /* <del> * Copyright 2002-2020 the original author or authors. <add> * Copyright 2002-2022 the original author or authors. <ide> * <ide> * Licensed under the Apache License, Version 2.0 (the "License"); <ide> * you may not use this file except in compliance with the License. <ide> import static org.assertj.core.api.Assertions.assertThat; <ide> <ide> /** <add> * Tests for {@link ConcurrentLruCache}. <ide> * @author Juergen Hoeller <ide> */ <ide> class ConcurrentLruCacheTests { <ide> class ConcurrentLruCacheTests { <ide> <ide> @Test <ide> void getAndSize() { <del> assertThat(this.cache.sizeLimit()).isEqualTo(2); <add> assertThat(this.cache.capacity()).isEqualTo(2); <ide> assertThat(this.cache.size()).isEqualTo(0); <ide> assertThat(this.cache.get("k1")).isEqualTo("k1value"); <ide> assertThat(this.cache.size()).isEqualTo(1); <ide><path>spring-jdbc/src/main/java/org/springframework/jdbc/core/namedparam/NamedParameterJdbcTemplate.java <ide> public void setCacheLimit(int cacheLimit) { <ide> * Return the maximum number of entries for this template's SQL cache. <ide> */ <ide> public int getCacheLimit() { <del> return this.parsedSqlCache.sizeLimit(); <add> return this.parsedSqlCache.capacity(); <ide> } <ide> <ide>
4
Go
Go
fix minor linting issues
417eac47a093369a6a7db7a65570de7c5187eb8e
<ide><path>integration-cli/docker_cli_external_volume_driver_test.go <ide> func newVolumePlugin(c *testing.T, name string) *volumePlugin { <ide> <ide> v.Mountpoint = hostVolumePath(pr.Name) <ide> send(w, map[string]vol{"Volume": v}) <del> return <ide> }) <ide> <ide> mux.HandleFunc("/VolumeDriver.Remove", func(w http.ResponseWriter, r *http.Request) { <ide><path>integration-cli/docker_cli_images_test.go <ide> func (s *DockerSuite) TestImagesFilterSpaceTrimCase(c *testing.T) { <ide> "dangling = true", <ide> } <ide> <del> imageListings := make([][]string, 5, 5) <add> imageListings := make([][]string, 5) <ide> for idx, filter := range filters { <ide> out, _ := dockerCmd(c, "images", "-q", "-f", filter) <ide> listing := strings.Split(out, "\n")
2
Ruby
Ruby
remove more flaky tests."
af2c57dbeb9143262c7a95618793e15b91ff60c1
<ide><path>Library/Homebrew/test/cask/cmd/upgrade_spec.rb <ide> end <ide> end <ide> <add> context "dry run upgrade" do <add> let(:installed) { <add> [ <add> "outdated/local-caffeine", <add> "outdated/local-transmission", <add> "outdated/auto-updates", <add> "outdated/version-latest", <add> ] <add> } <add> <add> before do <add> installed.each { |cask| Cask::Cmd::Install.run(cask) } <add> <add> allow_any_instance_of(described_class).to receive(:verbose?).and_return(true) <add> end <add> <add> describe 'without --greedy it ignores the Casks with "version latest" or "auto_updates true"' do <add> it "would update all the installed Casks when no token is provided" do <add> local_caffeine = Cask::CaskLoader.load("local-caffeine") <add> local_caffeine_path = Cask::Config.global.appdir.join("Caffeine.app") <add> local_transmission = Cask::CaskLoader.load("local-transmission") <add> local_transmission_path = Cask::Config.global.appdir.join("Transmission.app") <add> <add> expect(local_caffeine).to be_installed <add> expect(local_caffeine_path).to be_a_directory <add> expect(local_caffeine.versions).to include("1.2.2") <add> <add> expect(local_transmission).to be_installed <add> expect(local_transmission_path).to be_a_directory <add> expect(local_transmission.versions).to include("2.60") <add> <add> described_class.run("--dry-run") <add> <add> expect(local_caffeine).to be_installed <add> expect(local_caffeine_path).to be_a_directory <add> expect(local_caffeine.versions).to include("1.2.2") <add> expect(local_caffeine.versions).not_to include("1.2.3") <add> <add> expect(local_transmission).to be_installed <add> expect(local_transmission_path).to be_a_directory <add> expect(local_transmission.versions).to include("2.60") <add> expect(local_transmission.versions).not_to include("2.61") <add> end <add> <add> it "would update only the Casks specified in the command line" do <add> local_caffeine = Cask::CaskLoader.load("local-caffeine") <add> local_caffeine_path = Cask::Config.global.appdir.join("Caffeine.app") <add> local_transmission = Cask::CaskLoader.load("local-transmission") <add> local_transmission_path = Cask::Config.global.appdir.join("Transmission.app") <add> <add> expect(local_caffeine).to be_installed <add> expect(local_caffeine_path).to be_a_directory <add> expect(local_caffeine.versions).to include("1.2.2") <add> <add> expect(local_transmission).to be_installed <add> expect(local_transmission_path).to be_a_directory <add> expect(local_transmission.versions).to include("2.60") <add> <add> described_class.run("--dry-run", "local-caffeine") <add> <add> expect(local_caffeine).to be_installed <add> expect(local_caffeine_path).to be_a_directory <add> expect(local_caffeine.versions).to include("1.2.2") <add> expect(local_caffeine.versions).not_to include("1.2.3") <add> <add> expect(local_transmission).to be_installed <add> expect(local_transmission_path).to be_a_directory <add> expect(local_transmission.versions).to include("2.60") <add> expect(local_transmission.versions).not_to include("2.61") <add> end <add> end <add> <add> describe "with --greedy it checks additional Casks" do <add> it 'would include the Casks with "auto_updates true" or "version latest"' do <add> local_caffeine = Cask::CaskLoader.load("local-caffeine") <add> local_caffeine_path = Cask::Config.global.appdir.join("Caffeine.app") <add> auto_updates = Cask::CaskLoader.load("auto-updates") <add> auto_updates_path = Cask::Config.global.appdir.join("MyFancyApp.app") <add> local_transmission = Cask::CaskLoader.load("local-transmission") <add> local_transmission_path = Cask::Config.global.appdir.join("Transmission.app") <add> version_latest = Cask::CaskLoader.load("version-latest") <add> version_latest_path_1 = Cask::Config.global.appdir.join("Caffeine Mini.app") <add> version_latest_path_2 = Cask::Config.global.appdir.join("Caffeine Pro.app") <add> <add> expect(local_caffeine).to be_installed <add> expect(local_caffeine_path).to be_a_directory <add> expect(local_caffeine.versions).to include("1.2.2") <add> <add> expect(auto_updates).to be_installed <add> expect(auto_updates_path).to be_a_directory <add> expect(auto_updates.versions).to include("2.57") <add> <add> expect(local_transmission).to be_installed <add> expect(local_transmission_path).to be_a_directory <add> expect(local_transmission.versions).to include("2.60") <add> <add> expect(version_latest).to be_installed <add> expect(version_latest_path_1).to be_a_directory <add> expect(version_latest.versions).to include("latest") <add> <add> described_class.run("--greedy", "--dry-run") <add> <add> expect(local_caffeine).to be_installed <add> expect(local_caffeine_path).to be_a_directory <add> expect(local_caffeine.versions).to include("1.2.2") <add> expect(local_caffeine.versions).not_to include("1.2.3") <add> <add> expect(auto_updates).to be_installed <add> expect(auto_updates_path).to be_a_directory <add> expect(auto_updates.versions).to include("2.57") <add> expect(auto_updates.versions).not_to include("2.61") <add> <add> expect(local_transmission).to be_installed <add> expect(local_transmission_path).to be_a_directory <add> expect(local_transmission.versions).to include("2.60") <add> expect(local_transmission.versions).not_to include("2.61") <add> <add> expect(version_latest).to be_installed <add> expect(version_latest_path_2).to be_a_directory <add> end <add> <add> it 'does not include the Casks with "auto_updates true" when the version did not change' do <add> cask = Cask::CaskLoader.load("auto-updates") <add> cask_path = cask.config.appdir.join("MyFancyApp.app") <add> <add> expect(cask).to be_installed <add> expect(cask_path).to be_a_directory <add> expect(cask.versions).to include("2.57") <add> <add> described_class.run("--dry-run", "auto-updates", "--greedy") <add> <add> expect(cask).to be_installed <add> expect(cask_path).to be_a_directory <add> expect(cask.versions).to include("2.57") <add> expect(cask.versions).not_to include("2.61") <add> <add> described_class.run("--dry-run", "auto-updates", "--greedy") <add> <add> expect(cask).to be_installed <add> expect(cask_path).to be_a_directory <add> expect(cask.versions).to include("2.57") <add> expect(cask.versions).not_to include("2.61") <add> end <add> end <add> end <add> <ide> context "failed upgrade" do <ide> let(:installed) { <ide> [
1
Python
Python
add function create_default_optimizer to spacy._ml
2eb11d60f2640f20ed4c7df901194961958890fb
<ide><path>spacy/_ml.py <ide> def cosine(vec1, vec2): <ide> return vec1.dot(vec2) / (norm1 * norm2) <ide> <ide> <add>def create_default_optimizer(ops, **cfg): <add> learn_rate = util.env_opt('learn_rate', 0.001) <add> beta1 = util.env_opt('optimizer_B1', 0.9) <add> beta2 = util.env_opt('optimizer_B2', 0.999) <add> eps = util.env_opt('optimizer_eps', 1e-08) <add> L2 = util.env_opt('L2_penalty', 1e-6) <add> max_grad_norm = util.env_opt('grad_norm_clip', 1.) <add> optimizer = Adam(ops, learn_rate, L2=L2, beta1=beta1, <add> beta2=beta2, eps=eps) <add> optimizer.max_grad_norm = max_grad_norm <add> optimizer.device = device <add> return optimizer <add> <ide> @layerize <ide> def _flatten_add_lengths(seqs, pad=0, drop=0.): <ide> ops = Model.ops
1
Ruby
Ruby
fix code style
ecc8f283cfc1b002b5141c527a827e74b770f2f0
<ide><path>actionpack/lib/action_dispatch/middleware/debug_exceptions.rb <ide> def render(status, body, format) <ide> def log_error(request, wrapper) <ide> logger = logger(request) <ide> return unless logger <add> <ide> exception = wrapper.exception <ide> <ide> trace = wrapper.application_trace <ide> def log_error(request, wrapper) <ide> end <ide> end <ide> <del> def log_array logger, array <del> array.map { |line| logger.fatal line} <add> def log_array(logger, array) <add> array.map { |line| logger.fatal line } <ide> end <ide> <del> def logger request <add> def logger(request) <ide> request.logger || ActionView::Base.logger || stderr_logger <ide> end <ide>
1
Mixed
Text
fix typos [ci skip]
53331b478d32e42a8155414379b2edbe4277a3a4
<ide><path>activejob/CHANGELOG.md <ide> ``` <ide> <ide> A new message will be logged in case a job couldn't be enqueued, either because the callback chain was halted or <del> because an exception happened during enqueing. (i.e. Redis is down when you try to enqueue your job) <add> because an exception happened during enqueuing. (i.e. Redis is down when you try to enqueue your job) <ide> <ide> *Edouard Chin* <ide> <ide><path>activerecord/lib/active_record/railtie.rb <ide> class Railtie < Rails::Railtie # :nodoc: <ide> end <ide> end <ide> rescue ActiveRecordError => error <del> # Regardless of wether there was already a connection or not, we rescue any database <add> # Regardless of whether there was already a connection or not, we rescue any database <ide> # error because it is critical that the application can boot even if the database <ide> # is unhealthy. <ide> warn "Failed to define attribute methods because of #{error.class}: #{error.message}"
2
Javascript
Javascript
calculate correct checksum for the field header
0a7531cb33c465e53532be4af039af24e5a37106
<ide><path>fonts.js <ide> var Font = (function () { <ide> var length = data.length; <ide> <ide> // checksum <del> var checksum = tag.charCodeAt(0) + <del> tag.charCodeAt(1) + <del> tag.charCodeAt(2) + <del> tag.charCodeAt(3) + <del> offset + <del> length; <add> var checksum = 0; <add> for (var i = 0; i < length; i+=4) <add> checksum += FontsUtils.bytesToInteger([data[i], data[i+1], data[i+2], data[i+3]]); <ide> <ide> var tableEntry = tag + string32(checksum) + string32(offset) + string32(length); <ide> tableEntry = stringToArray(tableEntry);
1
Javascript
Javascript
add dom fixture for unmasking passwords
dbeb37fe69e3de7bee43695531d58f761c5633a4
<ide><path>fixtures/dom/src/components/Header.js <ide> const Header = React.createClass({ <ide> <option value="/range-inputs">Range Inputs</option> <ide> <option value="/text-inputs">Text Inputs</option> <ide> <option value="/number-inputs">Number Input</option> <add> <option value="/password-inputs">Password Input</option> <ide> <option value="/selects">Selects</option> <ide> <option value="/textareas">Textareas</option> <ide> <option value="/input-change-events">Input change events</option> <ide><path>fixtures/dom/src/components/fixtures/index.js <ide> import TextInputFixtures from './text-inputs'; <ide> import SelectFixtures from './selects'; <ide> import TextAreaFixtures from './textareas'; <ide> import InputChangeEvents from './input-change-events'; <del>import NumberInputFixtures from './number-inputs/'; <add>import NumberInputFixtures from './number-inputs'; <add>import PasswordInputFixtures from './password-inputs'; <ide> import ButtonFixtures from './buttons'; <ide> <ide> /** <ide> const FixturesPage = React.createClass({ <ide> return <InputChangeEvents />; <ide> case '/number-inputs': <ide> return <NumberInputFixtures />; <add> case '/password-inputs': <add> return <PasswordInputFixtures />; <ide> case '/buttons': <ide> return <ButtonFixtures /> <ide> default: <ide><path>fixtures/dom/src/components/fixtures/password-inputs/PasswordTestCase.js <add>const React = window.React; <add> <add>import Fixture from '../../Fixture'; <add> <add>const PasswordTestCase = React.createClass({ <add> getInitialState() { <add> return { value: '' }; <add> }, <add> onChange(event) { <add> this.setState({ value: event.target.value }) <add> }, <add> render() { <add> return ( <add> <Fixture> <add> <div>{this.props.children}</div> <add> <add> <div className="control-box"> <add> <fieldset> <add> <legend>Controlled</legend> <add> <input type="password" value={this.state.value} onChange={this.onChange} /> <add> <span className="hint"> Value: {JSON.stringify(this.state.value)}</span> <add> </fieldset> <add> <add> <fieldset> <add> <legend>Uncontrolled</legend> <add> <input type="password" defaultValue="" /> <add> </fieldset> <add> </div> <add> </Fixture> <add> ); <add> }, <add>}); <add> <add>export default PasswordTestCase; <ide><path>fixtures/dom/src/components/fixtures/password-inputs/index.js <add>const React = window.React; <add> <add>import FixtureSet from '../../FixtureSet'; <add>import TestCase from '../../TestCase'; <add>import PasswordTestCase from './PasswordTestCase' <add> <add>const NumberInputs = React.createClass({ <add> render() { <add> return ( <add> <FixtureSet title="Password inputs" description=""> <add> <TestCase <add> title="The show password icon" <add> description={` <add> Some browsers have an unmask password icon that React accidentally <add> prevents the display of. <add> `} <add> affectedBrowsers="IE Edge, IE 11"> <add> <TestCase.Steps> <add> <li>Type any string (not an actual password</li> <add> </TestCase.Steps> <add> <add> <TestCase.ExpectedResult> <add> The field should include the "unmasking password" icon. <add> </TestCase.ExpectedResult> <add> <add> <PasswordTestCase /> <add> </TestCase> <add> </FixtureSet> <add> ); <add> }, <add>}); <add> <add>export default NumberInputs;
4
Python
Python
fix isort errors
4c8efed81cb9f1058f8c710833b84adf12bcaac9
<ide><path>celery/bin/migrate.py <ide> <ide> from celery.bin.base import Command <ide> <del> <ide> MIGRATE_PROGRESS_FMT = """\ <ide> Migrating task {state.count}/{state.strtotal}: \ <ide> {body[task]}[{body[id]}]\ <ide><path>celery/utils/deprecated.py <ide> def _inner(fun): <ide> <ide> @wraps(fun) <ide> def __inner(*args, **kwargs): <del> from .imports import qualname <add> from . imports import qualname <ide> warn(description=description or qualname(fun), <ide> deprecation=deprecation, <ide> removal=removal, <ide><path>t/unit/tasks/test_result.py <ide> assert_will_not_block, result_from_tuple) <ide> from celery.utils.serialization import pickle <ide> <del> <ide> PYTRACEBACK = """\ <ide> Traceback (most recent call last): <ide> File "foo.py", line 2, in foofunc
3
Javascript
Javascript
change bindingcontext to context
4df1d40e5b650fa20c598b36f5da14e7ab2aa5e9
<ide><path>packages/ember-handlebars/lib/helpers/view.js <ide> EmberHandlebars.ViewHelper = Ember.Object.create({ <ide> // <ide> // is converted to this: <ide> // <del> // classNameBinding="bindingContext.isGreen:green" <add> // classNameBinding="context.isGreen:green" <ide> var parsedPath = Ember.View._parsePropertyPath(full); <ide> path = this.contextualizeBindingPath(parsedPath.path, data); <ide> if (path) { extensions.classNameBindings[b] = path + parsedPath.classNames; } <ide> } <ide> } <ide> } <ide> <del> // Make the current template context available to the view <del> // for the bindings set up above. <del> extensions.bindingContext = thisContext; <del> <ide> return Ember.$.extend(hash, extensions); <ide> }, <ide> <ide> EmberHandlebars.ViewHelper = Ember.Object.create({ <ide> } else if (Ember.isGlobalPath(path)) { <ide> return null; <ide> } else if (path === 'this') { <del> return 'bindingContext'; <add> return 'context'; <ide> } else { <del> return 'bindingContext.' + path; <add> return 'context.' + path; <ide> } <ide> }, <ide> <ide><path>packages/ember-handlebars/tests/handlebars_test.js <ide> test("should accept bindings as a string or an Ember.Binding", function() { <ide> <ide> Ember.Handlebars.registerHelper('boogie', function(id, options) { <ide> options.hash = options.hash || {}; <del> options.hash.bindingTestBinding = Ember.Binding.oneWay('bindingContext.' + id); <add> options.hash.bindingTestBinding = Ember.Binding.oneWay('context.' + id); <ide> options.hash.stringTestBinding = id; <ide> return Ember.Handlebars.ViewHelper.helper(this, viewClass, options); <ide> });
2
Text
Text
update devops docs
506f250599969ad81bc321d4a3bf64ad39ffb9fe
<ide><path>docs/devops.md <ide> Currently, only members on the developer team can push to the production branche <ide> <ide> And that's it, this will automatically trigger a build on the build pipeline for the `production-staging` branch. Typically this takes ~20-25 minutes for the all the applications. Once the build is complete, it will save the artifacts as `.zip` files in a cold storage to be retrieved and used by the release pipeline. <ide> <del>The release pipeline automatically triggers itself when a fresh artifact is available from the connected build pipeline. For the staging applications this is completely automated and the artifacts are pushed to the client CDN servers and the API servers. They typically take ~15-20 mins for the client, and ~5 mins for the API servers to be available live. <add>The release pipeline automatically triggers itself when a fresh artifact is available from the connected build pipeline. For the staging applications this is completely automated and the artifacts are pushed to the client CDN and the API servers. They typically take ~15-20 mins for the client, and ~5 mins for the API servers to be available live. <ide> <ide> This makes each release from code push to being available on the staging applications ~60 mins. <ide> <ide> The process is mostly the same as the staging applications, with a few extra che <ide> <ide> You will not be able to force push and if you have re-written the history in anyway these commands will error out. If they do, you may have done something incorrectly and you should just start over. <ide> <del>And that's it, this will automatically trigger a build on the build pipeline for the `production-current` branch. Typically this also takes ~20-25 minutes for the all the applications like previously. <add>And that's it, this will automatically trigger a build on the build pipeline for the `production-current` branch. Typically this also takes ~20-25 minutes for the all the applications like explained previously. <ide> <del>Here are some additional steps that need to be followed by a freeCodeCamp.org Staff developer. To prevent any accidental pushed we have a couple of manual approval steps configured on the pipelines. <add>Here are some additional steps that need to be followed by a freeCodeCamp.org Staff developer. To prevent any accidental pushes we have a couple of manual approval steps configured on the pipelines. <ide> <del>Once a build artifact is ready on the `production-current` branch, it will trigger a release on the release pipeline. Next, freeCodeCamp.org developer staff team will receive and email. They can approve the release or reject it. Approval or rejection depends on if changes were nicely working and tested on the staging application. Each approval lasts only for 4 hours to avoid queuing up. Post that limit it gets auto rejected. <add>Once a build artifact is ready on the `production-current` branch, it will trigger a release on the release pipeline. Next, freeCodeCamp.org developer staff team will receive an email. They can either *approve* or *reject* the release. Approval or rejection depends, if changes were nicely working and tested on the staging application. Each approval lasts only for 4 hours to avoid queuing up. Post the limit it gets auto rejected, wherein a staff will re-trigger the release pipeline manually. <ide> <ide> For staff use: <ide> <ide> | Approve Release | Publish or Rollback on Netlify | <ide> | :-------------: | :----------------------------: | <ide> | Check your email for a direct link or [Open release dashboard](https://dev.azure.com/freeCodeCamp-org/freeCodeCamp/_release?_a=releases&view=mine&definitionId=6) | [Open Netlify deployments](https://app.netlify.com/sites/freecodecamp-org/deploys) | <ide> <del>Once one of the members approves a release, the pipeline will push the changes live to freeCodeCamp.org's production CDN servers and API servers. They typically take ~15-20 mins for the client, and ~5 mins for the API servers to be available live. <add>Once one of the members approves a release, the pipeline will push the changes live to freeCodeCamp.org's production CDN and API servers. They typically take ~15-20 mins for the client, and ~5 mins for the API servers to be available live. <ide> <ide> As a final step, a staff member will also manually click the publish deploy button on Netlify's deployment's dashboard. <ide>
1
Ruby
Ruby
simplify auxiliary command files directory finding
993c0696e61f3449c97e31c54088ee7578953307
<ide><path>railties/lib/rails/command/base.rb <ide> def usage_path <ide> # For a `Rails::Command::TestCommand` placed in `rails/command/test_command.rb` <ide> # would return `rails/test`. <ide> def default_command_root <del> path = File.expand_path(File.join(base_name, command_name), __dir__) <add> path = File.expand_path(File.join("../commands", command_name), __dir__) <ide> path if File.exist?(path) <ide> end <ide>
1
Javascript
Javascript
update the title of the sign in view
3a2f53fdb73188147ba320426f1596858eb839d8
<ide><path>server/boot/user.js <ide> module.exports = function(app) { <ide> return res.redirect('/'); <ide> } <ide> return res.render('account/signin', { <del> title: 'Sign in to Free Code Camp using a Social Media Account' <add> title: 'Sign in to Free Code Camp' <ide> }); <ide> } <ide>
1
Python
Python
remove dup lines
ef997dfa2feb16f3933acb9692e20956aa6f2a62
<ide><path>libcloud/compute/drivers/openstack.py <ide> def ex_create_subnet(self, name, network, cidr, ip_version=4, **kwargs): <ide> :param ip_version: ip_version of subnet which should be used <ide> :type ip_version: ``int`` <ide> <del> :param ip_version: ip_version of subnet which should be used <del> :type ip_version: ``int`` <del> <ide> :rtype: :class:`OpenStack_2_SubNet` <ide> """ <ide> data = {'subnet': {'cidr': cidr, 'network_id': network.id,
1
Javascript
Javascript
remove www builds of fetch
2e7cc949ae7c7ed5a583d15b4ea32c68c7730dab
<ide><path>scripts/rollup/bundles.js <ide> const bundles = [ <ide> <ide> /******* React Fetch Browser (experimental, new) *******/ <ide> { <del> bundleTypes: [ <del> NODE_DEV, <del> NODE_PROD, <del> NODE_PROFILING, <del> FB_WWW_DEV, <del> FB_WWW_PROD, <del> FB_WWW_PROFILING, <del> ], <add> bundleTypes: [NODE_DEV, NODE_PROD], <ide> moduleType: ISOMORPHIC, <ide> entry: 'react-fetch/index.browser', <ide> global: 'ReactFetch',
1
Javascript
Javascript
prevent unwanted opening of the soft keyboard
0bbd20f255b2954b5c41617fe718cf6eca36a972
<ide><path>src/ngMobile/directive/ngClick.js <ide> ngMobile.directive('ngClick', ['$parse', '$timeout', '$rootElement', <ide> // If we didn't find an allowable region, bust the click. <ide> event.stopPropagation(); <ide> event.preventDefault(); <add> <add> // Blur focused form elements <add> event.target && event.target.blur(); <ide> } <ide> <ide> <ide><path>test/ngMobile/directive/ngClickSpec.js <ide> describe('ngClick (mobile)', function() { <ide> expect($rootScope.count1).toBe(1); <ide> <ide> time = 90; <add> // Verify that it is blured so we don't get soft-keyboard <add> element1[0].blur = jasmine.createSpy('blur'); <ide> browserTrigger(element1, 'click', [], 10, 10); <add> expect(element1[0].blur).toHaveBeenCalled(); <ide> <ide> expect($rootScope.count1).toBe(1); <ide>
2
Javascript
Javascript
fix whitespace in util.js
6789c921f52b5be713a9fb84f6ef6203c8c9b649
<ide><path>src/js/util.js <ide> vjs.util = {}; <ide> <ide> /** <del> * Merge two options objects, <del> * recursively merging any plain object properties as well. <del> * Previously `deepMerge` <del> * <add> * Merge two options objects, recursively merging any plain object properties as <add> * well. Previously `deepMerge` <add> * <ide> * @param {Object} obj1 Object to override values in <ide> * @param {Object} obj2 Overriding object <ide> * @return {Object} New object -- obj1 and obj2 will be untouched
1
PHP
PHP
fix cs error
35a24369e9b5d357a3d83ac0d57ffa9b3e7a0994
<ide><path>src/Event/EventManager.php <ide> public function __debugInfo() <ide> $properties['_listeners'][$key] = $listenerCount . ' listener(s)'; <ide> } <ide> if ($this->_eventList) { <del> for ($i = 0; $i < count($this->_eventList); $i++) { <add> $count = count($this->_eventList); <add> for ($i = 0; $i < $count; $i++) { <ide> $event = $this->_eventList[$i]; <ide> $properties['_dispatchedEvents'][] = $event->getName() . ' with subject ' . get_class($event->getSubject()); <ide> }
1
PHP
PHP
fix wrong indention
8e211ead462c96929fd31392a000c417840955bc
<ide><path>src/Illuminate/Database/Schema/Builder.php <ide> <ide> class Builder { <ide> <del> /** <del> * The database connection instance. <del> * <del> * @var \Illuminate\Database\Connection <del> */ <del> protected $connection; <del> <del> /** <del> * The schema grammar instance. <del> * <del> * @var \Illuminate\Database\Schema\Grammars\Grammar <del> */ <del> protected $grammar; <del> <del> /** <del> * The Blueprint resolver callback. <del> * <del> * @var \Closure <del> */ <del> protected $resolver; <del> <del> /** <del> * Create a new database Schema manager. <del> * <del> * @param \Illuminate\Database\Connection $connection <del> * @return void <del> */ <del> public function __construct(Connection $connection) <del> { <del> $this->connection = $connection; <del> $this->grammar = $connection->getSchemaGrammar(); <del> } <del> <del> /** <del> * Determine if the given table exists. <del> * <del> * @param string $table <del> * @return bool <del> */ <del> public function hasTable($table) <del> { <del> $sql = $this->grammar->compileTableExists(); <del> <del> $table = $this->connection->getTablePrefix().$table; <del> <del> return count($this->connection->select($sql, array($table))) > 0; <del> } <del> <del> /** <del> * Determine if the given table has a given column. <del> * <del> * @param string $table <del> * @param string $column <del> * @return bool <del> */ <del> public function hasColumn($table, $column) <del> { <del> $column = strtolower($column); <del> <del> return in_array($column, array_map('strtolower', $this->getColumnListing($table))); <del> } <del> <del> /** <del> * Determine if the given table has given columns. <del> * <del> * @param string $table <del> * @param array $columns <del> * @return bool <del> */ <del> public function hasColumns($table, array $columns) <del> { <del> $tableColumns = $this->getColumnListing($table); <del> <del> array_map('strtolower', $tableColumns); <del> <del> foreach ($columns as $column) <del> { <del> if ( ! in_array(strtolower($column), $tableColumns)) return false; <del> } <del> <del> return true; <del> } <del> <del> /** <del> * Get the column listing for a given table. <del> * <del> * @param string $table <del> * @return array <del> */ <del> public function getColumnListing($table) <del> { <del> $table = $this->connection->getTablePrefix().$table; <del> <del> $results = $this->connection->select($this->grammar->compileColumnExists($table)); <del> <del> return $this->connection->getPostProcessor()->processColumnListing($results); <del> } <del> <del> /** <del> * Modify a table on the schema. <del> * <del> * @param string $table <del> * @param \Closure $callback <del> * @return \Illuminate\Database\Schema\Blueprint <del> */ <del> public function table($table, Closure $callback) <del> { <del> $this->build($this->createBlueprint($table, $callback)); <del> } <del> <del> /** <del> * Create a new table on the schema. <del> * <del> * @param string $table <del> * @param \Closure $callback <del> * @return \Illuminate\Database\Schema\Blueprint <del> */ <del> public function create($table, Closure $callback) <del> { <del> $blueprint = $this->createBlueprint($table); <del> <del> $blueprint->create(); <del> <del> $callback($blueprint); <del> <del> $this->build($blueprint); <del> } <del> <del> /** <del> * Drop a table from the schema. <del> * <del> * @param string $table <del> * @return \Illuminate\Database\Schema\Blueprint <del> */ <del> public function drop($table) <del> { <del> $blueprint = $this->createBlueprint($table); <del> <del> $blueprint->drop(); <del> <del> $this->build($blueprint); <del> } <del> <del> /** <del> * Drop a table from the schema if it exists. <del> * <del> * @param string $table <del> * @return \Illuminate\Database\Schema\Blueprint <del> */ <del> public function dropIfExists($table) <del> { <del> $blueprint = $this->createBlueprint($table); <del> <del> $blueprint->dropIfExists(); <del> <del> $this->build($blueprint); <del> } <del> <del> /** <del> * Rename a table on the schema. <del> * <del> * @param string $from <del> * @param string $to <del> * @return \Illuminate\Database\Schema\Blueprint <del> */ <del> public function rename($from, $to) <del> { <del> $blueprint = $this->createBlueprint($from); <del> <del> $blueprint->rename($to); <del> <del> $this->build($blueprint); <del> } <del> <del> /** <del> * Execute the blueprint to build / modify the table. <del> * <del> * @param \Illuminate\Database\Schema\Blueprint $blueprint <del> * @return void <del> */ <del> protected function build(Blueprint $blueprint) <del> { <del> $blueprint->build($this->connection, $this->grammar); <del> } <del> <del> /** <del> * Create a new command set with a Closure. <del> * <del> * @param string $table <del> * @param \Closure|null $callback <del> * @return \Illuminate\Database\Schema\Blueprint <del> */ <del> protected function createBlueprint($table, Closure $callback = null) <del> { <del> if (isset($this->resolver)) <del> { <del> return call_user_func($this->resolver, $table, $callback); <del> } <del> <del> return new Blueprint($table, $callback); <del> } <del> <del> /** <del> * Get the database connection instance. <del> * <del> * @return \Illuminate\Database\Connection <del> */ <del> public function getConnection() <del> { <del> return $this->connection; <del> } <del> <del> /** <del> * Set the database connection instance. <del> * <del> * @param \Illuminate\Database\Connection <del> * @return $this <del> */ <del> public function setConnection(Connection $connection) <del> { <del> $this->connection = $connection; <del> <del> return $this; <del> } <del> <del> /** <del> * Set the Schema Blueprint resolver callback. <del> * <del> * @param \Closure $resolver <del> * @return void <del> */ <del> public function blueprintResolver(Closure $resolver) <del> { <del> $this->resolver = $resolver; <del> } <add> /** <add> * The database connection instance. <add> * <add> * @var \Illuminate\Database\Connection <add> */ <add> protected $connection; <add> <add> /** <add> * The schema grammar instance. <add> * <add> * @var \Illuminate\Database\Schema\Grammars\Grammar <add> */ <add> protected $grammar; <add> <add> /** <add> * The Blueprint resolver callback. <add> * <add> * @var \Closure <add> */ <add> protected $resolver; <add> <add> /** <add> * Create a new database Schema manager. <add> * <add> * @param \Illuminate\Database\Connection $connection <add> * @return void <add> */ <add> public function __construct(Connection $connection) <add> { <add> $this->connection = $connection; <add> $this->grammar = $connection->getSchemaGrammar(); <add> } <add> <add> /** <add> * Determine if the given table exists. <add> * <add> * @param string $table <add> * @return bool <add> */ <add> public function hasTable($table) <add> { <add> $sql = $this->grammar->compileTableExists(); <add> <add> $table = $this->connection->getTablePrefix().$table; <add> <add> return count($this->connection->select($sql, array($table))) > 0; <add> } <add> <add> /** <add> * Determine if the given table has a given column. <add> * <add> * @param string $table <add> * @param string $column <add> * @return bool <add> */ <add> public function hasColumn($table, $column) <add> { <add> $column = strtolower($column); <add> <add> return in_array($column, array_map('strtolower', $this->getColumnListing($table))); <add> } <add> <add> /** <add> * Determine if the given table has given columns. <add> * <add> * @param string $table <add> * @param array $columns <add> * @return bool <add> */ <add> public function hasColumns($table, array $columns) <add> { <add> $tableColumns = $this->getColumnListing($table); <add> <add> array_map('strtolower', $tableColumns); <add> <add> foreach ($columns as $column) <add> { <add> if ( ! in_array(strtolower($column), $tableColumns)) return false; <add> } <add> <add> return true; <add> } <add> <add> /** <add> * Get the column listing for a given table. <add> * <add> * @param string $table <add> * @return array <add> */ <add> public function getColumnListing($table) <add> { <add> $table = $this->connection->getTablePrefix().$table; <add> <add> $results = $this->connection->select($this->grammar->compileColumnExists($table)); <add> <add> return $this->connection->getPostProcessor()->processColumnListing($results); <add> } <add> <add> /** <add> * Modify a table on the schema. <add> * <add> * @param string $table <add> * @param \Closure $callback <add> * @return \Illuminate\Database\Schema\Blueprint <add> */ <add> public function table($table, Closure $callback) <add> { <add> $this->build($this->createBlueprint($table, $callback)); <add> } <add> <add> /** <add> * Create a new table on the schema. <add> * <add> * @param string $table <add> * @param \Closure $callback <add> * @return \Illuminate\Database\Schema\Blueprint <add> */ <add> public function create($table, Closure $callback) <add> { <add> $blueprint = $this->createBlueprint($table); <add> <add> $blueprint->create(); <add> <add> $callback($blueprint); <add> <add> $this->build($blueprint); <add> } <add> <add> /** <add> * Drop a table from the schema. <add> * <add> * @param string $table <add> * @return \Illuminate\Database\Schema\Blueprint <add> */ <add> public function drop($table) <add> { <add> $blueprint = $this->createBlueprint($table); <add> <add> $blueprint->drop(); <add> <add> $this->build($blueprint); <add> } <add> <add> /** <add> * Drop a table from the schema if it exists. <add> * <add> * @param string $table <add> * @return \Illuminate\Database\Schema\Blueprint <add> */ <add> public function dropIfExists($table) <add> { <add> $blueprint = $this->createBlueprint($table); <add> <add> $blueprint->dropIfExists(); <add> <add> $this->build($blueprint); <add> } <add> <add> /** <add> * Rename a table on the schema. <add> * <add> * @param string $from <add> * @param string $to <add> * @return \Illuminate\Database\Schema\Blueprint <add> */ <add> public function rename($from, $to) <add> { <add> $blueprint = $this->createBlueprint($from); <add> <add> $blueprint->rename($to); <add> <add> $this->build($blueprint); <add> } <add> <add> /** <add> * Execute the blueprint to build / modify the table. <add> * <add> * @param \Illuminate\Database\Schema\Blueprint $blueprint <add> * @return void <add> */ <add> protected function build(Blueprint $blueprint) <add> { <add> $blueprint->build($this->connection, $this->grammar); <add> } <add> <add> /** <add> * Create a new command set with a Closure. <add> * <add> * @param string $table <add> * @param \Closure|null $callback <add> * @return \Illuminate\Database\Schema\Blueprint <add> */ <add> protected function createBlueprint($table, Closure $callback = null) <add> { <add> if (isset($this->resolver)) <add> { <add> return call_user_func($this->resolver, $table, $callback); <add> } <add> <add> return new Blueprint($table, $callback); <add> } <add> <add> /** <add> * Get the database connection instance. <add> * <add> * @return \Illuminate\Database\Connection <add> */ <add> public function getConnection() <add> { <add> return $this->connection; <add> } <add> <add> /** <add> * Set the database connection instance. <add> * <add> * @param \Illuminate\Database\Connection <add> * @return $this <add> */ <add> public function setConnection(Connection $connection) <add> { <add> $this->connection = $connection; <add> <add> return $this; <add> } <add> <add> /** <add> * Set the Schema Blueprint resolver callback. <add> * <add> * @param \Closure $resolver <add> * @return void <add> */ <add> public function blueprintResolver(Closure $resolver) <add> { <add> $this->resolver = $resolver; <add> } <ide> <ide> } <ide>\ No newline at end of file
1
Javascript
Javascript
upgrade newwatchingplugin to es6
938072f0ebd6943920440510abb1071eea9010e6
<ide><path>lib/NewWatchingPlugin.js <ide> MIT License http://www.opensource.org/licenses/mit-license.php <ide> Author Tobias Koppers @sokra <ide> */ <del>function NewWatchingPlugin() {} <del>module.exports = NewWatchingPlugin; <add>'use strict'; <add> <add>class NewWatchingPlugin { <add> apply(compiler) { <add> compiler.plugin("compilation", function(compilation) { <add> compilation.warnings.push(new Error("The 'NewWatchingPlugin' is no longer necessary (now default)")); <add> }); <add> } <add>} <ide> <del>NewWatchingPlugin.prototype.apply = function(compiler) { <del> compiler.plugin("compilation", function(compilation) { <del> compilation.warnings.push(new Error("The 'NewWatchingPlugin' is no longer necessary (now default)")); <del> }); <del>}; <add>module.exports = NewWatchingPlugin;
1
Ruby
Ruby
improve documentation comments for livecheck dsl
05b3518b0cb3dac595531014326858016a622ae2
<ide><path>Library/Homebrew/livecheck.rb <ide> # frozen_string_literal: true <ide> <del># Livecheck can be used to check for newer versions of the software. <del># The livecheck DSL specified in the formula is evaluated the methods <del># of this class, which set the instance variables accordingly. The <del># information is used by brew livecheck when checking for newer versions <del># of the software. <add># The `Livecheck` class implements the DSL methods used in a formula's <add># `livecheck` block and stores related instance variables. Most of these methods <add># also return the related instance variable when no argument is provided. <add># <add># This information is used by the `brew livecheck` command to control its <add># behavior. <ide> class Livecheck <del> # The reason for skipping livecheck for the formula. <del> # e.g. `Not maintained` <add> # A very brief description of why the formula is skipped (e.g., `No longer <add> # developed or maintained`). <add> # @return [String, nil] <ide> attr_reader :skip_msg <ide> <ide> def initialize(formula) <ide> def initialize(formula) <ide> @url = nil <ide> end <ide> <del> # Sets the regex instance variable to the argument given, returns the <del> # regex instance variable when no argument is given. <add> # Sets the `@regex` instance variable to the provided `Regexp` or returns the <add> # `@regex` instance variable when no argument is provided. <add> # @param pattern [Regexp] regex to use for matching versions in content <add> # @return [Regexp, nil] <ide> def regex(pattern = nil) <ide> case pattern <ide> when nil <ide> def regex(pattern = nil) <ide> end <ide> end <ide> <del> # Sets the skip instance variable to true, indicating that livecheck <del> # must be skipped for the formula. If an argument is given and present, <del> # its value is assigned to the skip_msg instance variable, else nil is <del> # assigned. <add> # Sets the `@skip` instance variable to `true` and sets the `@skip_msg` <add> # instance variable if a `String` is provided. `@skip` is used to indicate <add> # that the formula should be skipped and the `skip_msg` very briefly describes <add> # why the formula is skipped (e.g., `No longer developed or maintained`). <add> # @param skip_msg [String] string describing why the formula is skipped <add> # @return [Boolean] <ide> def skip(skip_msg = nil) <ide> if skip_msg.is_a?(String) <ide> @skip_msg = skip_msg <ide> def skip(skip_msg = nil) <ide> @skip = true <ide> end <ide> <del> # Should livecheck be skipped for the formula? <add> # Should `livecheck` skip this formula? <ide> def skip? <ide> @skip <ide> end <ide> <del> # Sets the strategy instance variable to the provided symbol or returns the <del> # strategy instance variable when no argument is provided. The strategy <add> # Sets the `@strategy` instance variable to the provided `Symbol` or returns <add> # the `@strategy` instance variable when no argument is provided. The strategy <ide> # symbols use snake case (e.g., `:page_match`) and correspond to the strategy <ide> # file name. <ide> # @param symbol [Symbol] symbol for the desired strategy <add> # @return [Symbol, nil] <ide> def strategy(symbol = nil) <ide> case symbol <ide> when nil <ide> def strategy(symbol = nil) <ide> end <ide> end <ide> <del> # Sets the url instance variable to the argument given, returns the url <del> # instance variable when no argument is given. <add> # Sets the `@url` instance variable to the provided argument or returns the <add> # `@url` instance variable when no argument is provided. The argument can be <add> # a `String` (a URL) or a supported `Symbol` corresponding to a URL in the <add> # formula (e.g., `:stable`, `:homepage`, or `:head`). <add> # @param val [String, Symbol] URL to check for version information <add> # @return [String, nil] <ide> def url(val = nil) <ide> @url = case val <ide> when nil <ide> def url(val = nil) <ide> end <ide> end <ide> <del> # Returns a Hash of all instance variable values. <add> # Returns a `Hash` of all instance variable values. <add> # @return [Hash] <ide> def to_hash <ide> { <ide> "regex" => @regex,
1
Python
Python
correct an issue on percpu display
00bd5aad2b5f16f5a70626fc5231707b3bbe33dc
<ide><path>glances/glances.py <ide> def displayCpu(self, cpu, percpu, proclist): <ide> <ide> # Display CPU stats <ide> if screen_y > self.cpu_y + 5 and tag_percpu: <del> # display per-CPU stats when space is available <add> # Display per-CPU <ide> self.term_window.addnstr(self.cpu_y, self.cpu_x, _("PerCPU"), 6, <ide> self.title_color if self.hascolors else <ide> curses.A_UNDERLINE) <ide> def displayCpu(self, cpu, percpu, proclist): <ide> format((100 - percpu[i]['idle']) / 100, '>6.1%'), 6) <ide> <ide> # user <del> alert = self.__getCpuAlert(percpu[i]['user']) <ide> self.term_window.addnstr( <ide> self.cpu_y + 1, self.cpu_x + 8 + i * 8, <ide> format(percpu[i]['user'] / 100, '>6.1%'), 6, <del> self.__colors_list2[alert]) <add> self.__getCpuColor2(percpu[i]['user'], stat = 'user')) <ide> <ide> # system <del> alert = self.__getCpuAlert(percpu[i]['system']) <ide> self.term_window.addnstr( <ide> self.cpu_y + 2, self.cpu_x + 8 + i * 8, <ide> format(percpu[i]['system'] / 100, '>6.1%'), 6, <del> self.__colors_list2[alert]) <add> self.__getCpuColor2(percpu[i]['system'], stat = 'system')) <ide> <ide> # idle <ide> self.term_window.addnstr( <ide> self.cpu_y + 3, self.cpu_x + 8 + i * 8, <ide> format(percpu[i]['idle'] / 100, '>6.1%'), 6) <del> # display CPU summary information <add> <ide> elif screen_y > self.cpu_y + 5 and screen_x > self.cpu_x + 18: <add> # display CPU summary information <ide> self.term_window.addnstr(self.cpu_y, self.cpu_x, _("CPU"), 3, <ide> self.title_color if self.hascolors else <ide> curses.A_UNDERLINE)
1
Text
Text
add the text "comparison" to the article
d4b8acfbde34aeb55a938f4a2cc4fb0e1be92c16
<ide><path>client/src/pages/guide/english/python/basic-operators/index.md <ide> Operators are symbols which tells the interpreter to do a specific operation (vi <ide> The different types of operators in Python are listed below: <ide> <ide> 1. Arithmetic Operators <del>2. Relational Operators <add>2. Comparison (Relational) Operators <ide> 3. Bitwise Operators <ide> 4. Assignment Operators <ide> 5. Logical Operators <ide> Consider the expression, <b>“a = 2 + 3”</b>. Here, `2` and `3` are the <i>op <ide> <ide> Note: To get the result in floating type, one of the operands must also be of float type. <ide> <del>#### Relational Operators <add>#### Comparison (Relational) Operators <ide> <del>A relational operator is used to compare two operands to decide a relation between them. It returns a boolean value based on the condition. <add>A comparison or relational operator is used to compare two operands to decide a relation between them. It returns a boolean value based on the condition. <ide> <ide> <table style="width:100%"> <ide> <tr>
1
Ruby
Ruby
remove some code dups
69fdfab4871473866a9021b9750d788c8d9964df
<ide><path>actionpack/lib/action_view/helpers/form_options_helper.rb <ide> class InstanceTag #:nodoc: <ide> include FormOptionsHelper <ide> <ide> def to_select_tag(choices, options, html_options) <del> html_options = html_options.stringify_keys <del> add_default_name_and_id(html_options) <del> value = value(object) <del> selected_value = options.has_key?(:selected) ? options[:selected] : value <del> disabled_value = options.has_key?(:disabled) ? options[:disabled] : nil <del> select_content_tag(add_options(options_for_select(choices, :selected => selected_value, :disabled => disabled_value), options, selected_value), html_options) <add> selected_value = options.has_key?(:selected) ? options[:selected] : value(object) <add> select_content_tag(options_for_select(choices, :selected => selected_value, :disabled => options[:disabled]), options, html_options) <ide> end <ide> <ide> def to_collection_select_tag(collection, value_method, text_method, options, html_options) <del> html_options = html_options.stringify_keys <del> add_default_name_and_id(html_options) <del> value = value(object) <del> disabled_value = options.has_key?(:disabled) ? options[:disabled] : nil <del> selected_value = options.has_key?(:selected) ? options[:selected] : value <add> selected_value = options.has_key?(:selected) ? options[:selected] : value(object) <ide> select_content_tag( <del> add_options(options_from_collection_for_select(collection, value_method, text_method, :selected => selected_value, :disabled => disabled_value), options, value), html_options <add> options_from_collection_for_select(collection, value_method, text_method, :selected => selected_value, :disabled => options[:disabled]), options, html_options <ide> ) <ide> end <ide> <ide> def to_grouped_collection_select_tag(collection, group_method, group_label_method, option_key_method, option_value_method, options, html_options) <del> html_options = html_options.stringify_keys <del> add_default_name_and_id(html_options) <del> value = value(object) <ide> select_content_tag( <del> add_options(option_groups_from_collection_for_select(collection, group_method, group_label_method, option_key_method, option_value_method, value), options, value), html_options <add> option_groups_from_collection_for_select(collection, group_method, group_label_method, option_key_method, option_value_method, value(object)), options, html_options <ide> ) <ide> end <ide> <ide> def to_time_zone_select_tag(priority_zones, options, html_options) <del> html_options = html_options.stringify_keys <del> add_default_name_and_id(html_options) <del> value = value(object) <ide> select_content_tag( <del> add_options( <del> time_zone_options_for_select(value || options[:default], priority_zones, options[:model] || ActiveSupport::TimeZone), <del> options, value <del> ), html_options <add> time_zone_options_for_select(value(object) || options[:default], priority_zones, options[:model] || ActiveSupport::TimeZone), options, html_options <ide> ) <ide> end <ide> <ide> def add_options(option_tags, options, value = nil) <ide> option_tags.html_safe <ide> end <ide> <del> def select_content_tag(content, html_options) <del> select = content_tag("select", content, html_options) <add> def select_content_tag(option_tags, options, html_options) <add> html_options = html_options.stringify_keys <add> add_default_name_and_id(html_options) <add> select = content_tag("select", add_options(option_tags, options, value(object)), html_options) <ide> if html_options["multiple"] <ide> tag("input", :disabled => html_options["disabled"], :name => html_options["name"], :type => "hidden", :value => "") + select <ide> else
1
Ruby
Ruby
allow pluralize_table_names for individual model
6a3b3fba5a173dc8cd308c30426247e93e5fc97e
<ide><path>activerecord/lib/active_record/base.rb <ide> class Base <ide> # Indicates whether table names should be the pluralized versions of the corresponding class names. <ide> # If true, the default table name for a Product class will be +products+. If false, it would just be +product+. <ide> # See table_name for the full rules on table/class naming. This is true, by default. <del> cattr_accessor :pluralize_table_names, :instance_writer => false <del> @@pluralize_table_names = true <add> class_attribute :pluralize_table_names, :instance_writer => false <add> self.pluralize_table_names = true <ide> <ide> ## <ide> # :singleton-method: <ide><path>activerecord/test/cases/base_test.rb <ide> def test_table_name_guesses_with_inherited_prefixes_and_suffixes <ide> GUESSED_CLASSES.each(&:reset_table_name) <ide> end <ide> <add> def test_singular_table_name_guesses_for_individual_table <add> CreditCard.pluralize_table_names = false <add> CreditCard.reset_table_name <add> assert_equal "credit_card", CreditCard.table_name <add> assert_equal "categories", Category.table_name <add> ensure <add> CreditCard.pluralize_table_names = true <add> CreditCard.reset_table_name <add> end <ide> <ide> if current_adapter?(:MysqlAdapter) or current_adapter?(:Mysql2Adapter) <ide> def test_update_all_with_order_and_limit
2
Text
Text
add an article about redux saga
9ac2f23facd3748e4a0ec6fcd328b93e1fd3acf5
<ide><path>docs/introduction/Ecosystem.md <ide> On this page we will only feature a few of them that the Redux maintainers have <ide> * [Getting Started with React, Redux, and Immutable](http://www.theodo.fr/blog/2016/03/getting-started-with-react-redux-and-immutable-a-test-driven-tutorial-part-2/) — A test-driven intro to refactoring a React app to use Redux <ide> * [Secure Your React and Redux App with JWT Authentication](https://auth0.com/blog/2016/01/04/secure-your-react-and-redux-app-with-jwt-authentication/) — Learn how to add JWT authentication to your React and Redux app <ide> * [Understanding Redux Middleware](https://medium.com/@meagle/understanding-87566abcfb7a#.l033pyr02) — In-depth guide to implementing Redux middleware <add>* [Build an Image Gallery Using Redux Saga](http://joelhooks.com/blog/2016/03/20/build-an-image-gallery-using-redux-saga) — An intro to using Redux with Redux Saga <ide> * [Angular 2 — Introduction to Redux](https://medium.com/google-developer-experts/angular-2-introduction-to-redux-1cf18af27e6e) — An introduction to Redux fundamental concepts with an example in Angular 2 <ide> * [Working with VK API (in Russian)](https://www.gitbook.com/book/maxfarseer/redux-course-ru/details) — A tutorial in Russian that demonstrates creating an app that consumes VK API <ide>
1
Javascript
Javascript
add ondidreplaceatomproject api
f2eede833e3121bd1e0e73bb8d8f9d9217ef5b57
<ide><path>src/project.js <ide> class Project extends Model { <ide> replaceAtomProject (newSettings) { <ide> atom.config.resetProjectSettings(newSettings.config) <ide> this.projectFilePath = newSettings.originPath <add> this.emitter.emit('replaced-atom-project', newSettings) <add> } <add> <add> onDidReplaceAtomProject () { <add> return this.emitter.on('replaced-atom-project') <ide> } <ide> <ide> clearAtomProject () { <ide> atom.config.clearProjectSettings() <add> this.emitter.emit('replaced-atom-project', {}) <ide> } <ide> <ide> getProjectFilePath () {
1
Python
Python
redo the changes in [7773] in a better way
6dd2b5468fa275d53aa60fdcaff8c28bdc5e9c25
<ide><path>django/db/models/sql/query.py <ide> def add_filter(self, filter_expr, connector=AND, negate=False, trim=False, <ide> # that's harmless. <ide> self.promote_alias(table) <ide> <del> # To save memory and copying time, convert the value from the Python <del> # object to the actual value used in the SQL query. <del> if field: <del> params = field.get_db_prep_lookup(lookup_type, value) <del> else: <del> params = Field().get_db_prep_lookup(lookup_type, value) <del> if isinstance(value, datetime.datetime): <del> annotation = datetime.datetime <del> else: <del> annotation = bool(value) <del> <del> self.where.add((alias, col, field.db_type(), lookup_type, annotation, <del> params), connector) <add> self.where.add((alias, col, field, lookup_type, value), connector) <ide> <ide> if negate: <ide> for alias in join_list: <ide> def add_filter(self, filter_expr, connector=AND, negate=False, trim=False, <ide> for alias in join_list: <ide> if self.alias_map[alias][JOIN_TYPE] == self.LOUTER: <ide> j_col = self.alias_map[alias][RHS_JOIN_COL] <del> entry = Node([(alias, j_col, None, 'isnull', True, <del> [True])]) <add> entry = self.where_class() <add> entry.add((alias, j_col, None, 'isnull', True), AND) <ide> entry.negate() <ide> self.where.add(entry, AND) <ide> break <ide> elif not (lookup_type == 'in' and not value) and field.null: <ide> # Leaky abstraction artifact: We have to specifically <ide> # exclude the "foo__in=[]" case from this handling, because <ide> # it's short-circuited in the Where class. <del> entry = Node([(alias, col, None, 'isnull', True, [True])]) <add> entry = self.where_class() <add> entry.add((alias, col, None, 'isnull', True), AND) <ide> entry.negate() <ide> self.where.add(entry, AND) <ide> <ide><path>django/db/models/sql/subqueries.py <ide> def delete_batch_related(self, pk_list): <ide> for offset in range(0, len(pk_list), GET_ITERATOR_CHUNK_SIZE): <ide> where = self.where_class() <ide> where.add((None, related.field.m2m_reverse_name(), <del> related.field.db_type(), 'in', True, <add> related.field, 'in', <ide> pk_list[offset : offset+GET_ITERATOR_CHUNK_SIZE]), <ide> AND) <ide> self.do_query(related.field.m2m_db_table(), where) <ide> def delete_batch_related(self, pk_list): <ide> if isinstance(f, generic.GenericRelation): <ide> from django.contrib.contenttypes.models import ContentType <ide> field = f.rel.to._meta.get_field(f.content_type_field_name) <del> w1.add((None, field.column, field.db_type(), 'exact', True, <del> [ContentType.objects.get_for_model(cls).id]), AND) <add> w1.add((None, field.column, field, 'exact', <add> ContentType.objects.get_for_model(cls).id), AND) <ide> for offset in range(0, len(pk_list), GET_ITERATOR_CHUNK_SIZE): <ide> where = self.where_class() <del> where.add((None, f.m2m_column_name(), f.db_type(), 'in', True, <add> where.add((None, f.m2m_column_name(), f, 'in', <ide> pk_list[offset : offset + GET_ITERATOR_CHUNK_SIZE]), <ide> AND) <ide> if w1: <ide> def delete_batch(self, pk_list): <ide> for offset in range(0, len(pk_list), GET_ITERATOR_CHUNK_SIZE): <ide> where = self.where_class() <ide> field = self.model._meta.pk <del> where.add((None, field.column, field.db_type(), 'in', True, <add> where.add((None, field.column, field, 'in', <ide> pk_list[offset : offset + GET_ITERATOR_CHUNK_SIZE]), AND) <ide> self.do_query(self.model._meta.db_table, where) <ide> <ide> def clear_related(self, related_field, pk_list): <ide> for offset in range(0, len(pk_list), GET_ITERATOR_CHUNK_SIZE): <ide> self.where = self.where_class() <ide> f = self.model._meta.pk <del> self.where.add((None, f.column, f.db_type(), 'in', True, <add> self.where.add((None, f.column, f, 'in', <ide> pk_list[offset : offset + GET_ITERATOR_CHUNK_SIZE]), <ide> AND) <ide> self.values = [(related_field.column, None, '%s')] <ide><path>django/db/models/sql/where.py <ide> class WhereNode(tree.Node): <ide> """ <ide> default = AND <ide> <del> def as_sql(self, node=None, qn=None): <add> def add(self, data, connector): <add> """ <add> Add a node to the where-tree. If the data is a list or tuple, it is <add> expected to be of the form (alias, col_name, field_obj, lookup_type, <add> value), which is then slightly munged before being stored (to avoid <add> storing any reference to field objects). Otherwise, the 'data' is <add> stored unchanged and can be anything with an 'as_sql()' method. <add> """ <add> if not isinstance(data, (list, tuple)): <add> super(WhereNode, self).add(data, connector) <add> return <add> <add> alias, col, field, lookup_type, value = data <add> if field: <add> params = field.get_db_prep_lookup(lookup_type, value) <add> db_type = field.db_type() <add> else: <add> # This is possible when we add a comparison to NULL sometimes (we <add> # don't really need to waste time looking up the associated field <add> # object). <add> params = Field().get_db_prep_lookup(lookup_type, value) <add> db_type = None <add> if isinstance(value, datetime.datetime): <add> annotation = datetime.datetime <add> else: <add> annotation = bool(value) <add> super(WhereNode, self).add((alias, col, db_type, lookup_type, <add> annotation, params), connector) <add> <add> def as_sql(self, qn=None): <ide> """ <ide> Returns the SQL version of the where clause and the value to be <ide> substituted in. Returns None, None if this node is empty. <ide> def as_sql(self, node=None, qn=None): <ide> (generally not needed except by the internal implementation for <ide> recursion). <ide> """ <del> if node is None: <del> node = self <ide> if not qn: <ide> qn = connection.ops.quote_name <del> if not node.children: <add> if not self.children: <ide> return None, [] <ide> result = [] <ide> result_params = [] <ide> empty = True <del> for child in node.children: <add> for child in self.children: <ide> try: <ide> if hasattr(child, 'as_sql'): <ide> sql, params = child.as_sql(qn=qn) <del> format = '(%s)' <del> elif isinstance(child, tree.Node): <del> sql, params = self.as_sql(child, qn) <del> if child.negated: <del> format = 'NOT (%s)' <del> elif len(child.children) == 1: <del> format = '%s' <del> else: <del> format = '(%s)' <ide> else: <add> # A leaf node in the tree. <ide> sql, params = self.make_atom(child, qn) <del> format = '%s' <ide> except EmptyResultSet: <del> if node.connector == AND and not node.negated: <add> if self.connector == AND and not self.negated: <ide> # We can bail out early in this particular case (only). <ide> raise <del> elif node.negated: <add> elif self.negated: <ide> empty = False <ide> continue <ide> except FullResultSet: <ide> if self.connector == OR: <del> if node.negated: <add> if self.negated: <ide> empty = True <ide> break <ide> # We match everything. No need for any constraints. <ide> return '', [] <del> if node.negated: <add> if self.negated: <ide> empty = True <ide> continue <ide> empty = False <ide> if sql: <del> result.append(format % sql) <add> result.append(sql) <ide> result_params.extend(params) <ide> if empty: <ide> raise EmptyResultSet <del> conn = ' %s ' % node.connector <del> return conn.join(result), result_params <add> <add> conn = ' %s ' % self.connector <add> sql_string = conn.join(result) <add> if sql_string: <add> if self.negated: <add> sql_string = 'NOT (%s)' % sql_string <add> elif len(self.children) != 1: <add> sql_string = '(%s)' % sql_string <add> return sql_string, result_params <ide> <ide> def make_atom(self, child, qn): <ide> """ <del> Turn a tuple (table_alias, field_name, db_type, lookup_type, <add> Turn a tuple (table_alias, column_name, db_type, lookup_type, <ide> value_annot, params) into valid SQL. <ide> <ide> Returns the string for the SQL fragment and the parameters to use for <ide><path>django/utils/tree.py <ide> def __init__(self, children=None, connector=None, negated=False): <ide> self.subtree_parents = [] <ide> self.negated = negated <ide> <add> # We need this because of django.db.models.query_utils.Q. Q. __init__() is <add> # problematic, but it is a natural Node subclass in all other respects. <add> def _new_instance(cls, children=None, connector=None, negated=False): <add> """ <add> This is called to create a new instance of this class when we need new <add> Nodes (or subclasses) in the internal code in this class. Normally, it <add> just shadows __init__(). However, subclasses with an __init__ signature <add> that is not an extension of Node.__init__ might need to implement this <add> method to allow a Node to create a new instance of them (if they have <add> any extra setting up to do). <add> """ <add> obj = Node(children, connector, negated) <add> obj.__class__ = cls <add> return obj <add> _new_instance = classmethod(_new_instance) <add> <ide> def __str__(self): <ide> if self.negated: <ide> return '(NOT (%s: %s))' % (self.connector, ', '.join([str(c) for c <ide> def add(self, node, conn_type): <ide> else: <ide> self.children.append(node) <ide> else: <del> obj = Node(self.children, self.connector, self.negated) <add> obj = self._new_instance(self.children, self.connector, <add> self.negated) <ide> self.connector = conn_type <ide> self.children = [obj, node] <ide> <ide> def negate(self): <ide> Interpreting the meaning of this negate is up to client code. This <ide> method is useful for implementing "not" arrangements. <ide> """ <del> self.children = [Node(self.children, self.connector, not self.negated)] <add> self.children = [self._new_instance(self.children, self.connector, <add> not self.negated)] <ide> self.connector = self.default <ide> <ide> def start_subtree(self, conn_type): <ide> def start_subtree(self, conn_type): <ide> if len(self.children) == 1: <ide> self.connector = conn_type <ide> elif self.connector != conn_type: <del> self.children = [Node(self.children, self.connector, self.negated)] <add> self.children = [self._new_instance(self.children, self.connector, <add> self.negated)] <ide> self.connector = conn_type <ide> self.negated = False <ide> <del> self.subtree_parents.append(Node(self.children, self.connector, <del> self.negated)) <add> self.subtree_parents.append(self.__class__(self.children, <add> self.connector, self.negated)) <ide> self.connector = self.default <ide> self.negated = False <ide> self.children = [] <ide> def end_subtree(self): <ide> the current instances state to be the parent. <ide> """ <ide> obj = self.subtree_parents.pop() <del> node = Node(self.children, self.connector) <add> node = self.__class__(self.children, self.connector) <ide> self.connector = obj.connector <ide> self.negated = obj.negated <ide> self.children = obj.children
4
Text
Text
create overview for python's enumerate function
fe2d44a6ad0f532ef088272e13028094a0d98215
<ide><path>guide/english/python/enumerate/index.md <add>--- <add>title: Python's Enumerate Function <add>--- <add> <add>## Overview <add>`enumerate()` is a built-in function in Python. It is useful for iteration over a list or any other iterable. <add> <add>## Arguments <add>`enumerate()` requires an iterable, and `start` as an optional parameter (it defines where the indexing starts). <add> <add>## Return Value <add>Returns an enumerate object. If you call `list()` on it, you can see that each item in the object is a tuple – an index followed by the item in the iterable. <add> <add>## Usage Example <add> animals = ['cat', 'dog', 'rabbit', 'fox', 'wolf'] # A list of animals. <add> for index, item in enumerate(animals, start=20): <add> print(index, item) <add>### Output <add> 20 cat <add> 21 dog <add> 22 rabbit <add> 23 fox <add> 24 wolf <add> <add><a href='https://repl.it/repls/DarksalmonMajesticDecagons'>Try it out!</a> <add> <add>#### More Information <add> <add>- <a href='https://docs.python.org/3/library/functions.html#enumerate'>Python's Docs</a>
1
Javascript
Javascript
move language methods into externs
eec1fc13fe9822a3aee7284b4580029fadc0b6bf
<ide><path>src/js/exports.js <ide> goog.exportProperty(vjs.Player.prototype, 'preload', vjs.Player.prototype.preloa <ide> goog.exportProperty(vjs.Player.prototype, 'remainingTime', vjs.Player.prototype.remainingTime); <ide> goog.exportProperty(vjs.Player.prototype, 'supportsFullScreen', vjs.Player.prototype.supportsFullScreen); <ide> goog.exportProperty(vjs.Player.prototype, 'currentType', vjs.Player.prototype.currentType); <del>goog.exportProperty(vjs.Player.prototype, 'language', vjs.Player.prototype.language); <del>goog.exportProperty(vjs.Player.prototype, 'languages', vjs.Player.prototype.languages); <ide> <ide> goog.exportSymbol('videojs.MediaLoader', vjs.MediaLoader); <ide> goog.exportSymbol('videojs.TextTrackDisplay', vjs.TextTrackDisplay); <ide><path>src/js/player.externs.js <ide> videojs.Player.prototype.cancelFullScreen = function(){}; /* deprecated */ <ide> */ <ide> videojs.Player.prototype.textTracks = function(){}; <ide> <add>/** <add> * Language support <add> */ <add>videojs.Player.prototype.language = function(){}; <add>videojs.Player.prototype.languages = function(){}; <add> <ide> /** <ide> * Component functions <ide> */ <ide><path>test/unit/api.js <ide> test('fullscreenToggle does not depend on minified player methods', function(){ <ide> <ide> ok(exitFullscreen, 'exitFullscreen called'); <ide> }); <add> <add>test('component can be subclassed externally', function(){ <add> var player = new (videojs.Component.extend({ <add> languages: function(){}, <add> reportUserActivity: function(){}, <add> language: function(){}, <add> textTracks: function(){ return []; } <add> }))({ <add> id: function(){}, <add> reportUserActivity: function(){} <add> }); <add> ok(new videojs.ControlBar(player), 'created a control bar without throwing'); <add>});
3
Javascript
Javascript
update navigator component doc
4ec53ee8fa2183fdeef52f0cb03c40bd6c56c451
<ide><path>Libraries/CustomComponents/Navigator/Navigator.js <ide> var GESTURE_ACTIONS = [ <ide> ]; <ide> <ide> /** <del> * Use `Navigator` to transition between different scenes in your app. To <del> * accomplish this, provide route objects to the navigator to identify each <del> * scene, and also a `renderScene` function that the navigator can use to <del> * render the scene for a given route. <add> * `Navigator` handles the transition between different scenes in your app. <add> * You should consider using this component instead of `NavigatorIOS` if you're <add> * building a cross-platform app. `Navigator` is implemented in JavaScript <add> * whereas `NavigatorIOS` is a wrapper around `UINavigationController`. <ide> * <del> * To change the animation or gesture properties of the scene, provide a <del> * `configureScene` prop to get the config object for a given route. See <del> * `Navigator.SceneConfigs` for default animations and more info on <del> * scene config options. <add> * To set up the `Navigator` you provide one or more objects called routes, <add> * to identify each scene. You also provide a `renderScene` function that <add> * renders the scene for each route object. <add> * <add> * ``` <add> * import React, { Component } from 'react'; <add> * import { Text, Navigator } from 'react-native'; <add> * <add> * class NavAllDay extends Component { <add> * render() { <add> * return ( <add> * <Navigator <add> * initialRoute={{name: 'Awesome Scene'}} <add> * renderScene={(route, navigator) => <add> * <Text>Hello {route.name}!</Text> <add> * } <add> * style={{padding: 100}} <add> * /> <add> * ); <add> * } <add> * } <add> * ``` <add> * <add> * In the above example, `initialRoute` is used to specify the first route. It <add> * contains a `name` property that identifies the route. The `renderScene` <add> * prop returns a function that displays text based on the route's name. <add> * <add> * ### Additional Scenes <ide> * <del> * ### Basic Usage <add> * The first example demonstrated one scene. To set up multiple scenes, you pass <add> * the `initialRouteStack` prop to `Navigator`: <ide> * <ide> * ``` <del> * <Navigator <del> * initialRoute={{name: 'My First Scene', index: 0}} <del> * renderScene={(route, navigator) => <del> * <MySceneComponent <del> * name={route.name} <del> * onForward={() => { <del> * var nextIndex = route.index + 1; <del> * navigator.push({ <del> * name: 'Scene ' + nextIndex, <del> * index: nextIndex, <del> * }); <del> * }} <del> * onBack={() => { <del> * if (route.index > 0) { <add> * render() { <add> * const routes = [ <add> * {name: 'First Scene', index: 0}, <add> * {name: 'Second Scene', index: 1}, <add> * ]; <add> * return ( <add> * <Navigator <add> * initialRoute={routes[0]} <add> * initialRouteStack={routes} <add> * renderScene={(route, navigator) => <add> * <TouchableHighlight onPress={() => { <add> * if (route.index === 0) { <add> * navigator.push(routes[1]); <add> * } else { <ide> * navigator.pop(); <ide> * } <del> * }} <del> * /> <add> * }}> <add> * <Text>Hello {route.name}!</Text> <add> * </TouchableHighlight> <add> * } <add> * style={{padding: 100}} <add> * /> <add> * ); <add> * } <add> * ``` <add> * <add> * In the above example, a `routes` variable is defined with two route objects <add> * representing two scenes. Each route has an `index` property that is used to <add> * manage the scene being rendered. The `renderScene` method is changed to <add> * either push or pop the navigator depending on the current route's index. <add> * Finally, the `Text` component in the scene is now wrapped in a <add> * `TouchableHighlight` component to help trigger the navigator transitions. <add> * <add> * ### Navigation Bar <add> * <add> * You can optionally pass in your own navigation bar by returning a <add> * `Navigator.NavigationBar` component to the `navigationBar` prop in <add> * `Navigator`. You can configure the navigation bar properties, through <add> * the `routeMapper` prop. There you set up the left, right, and title <add> * properties of the navigation bar: <add> * <add> * ``` <add> * <Navigator <add> * renderScene={(route, navigator) => <add> * // ... <add> * } <add> * navigationBar={ <add> * <Navigator.NavigationBar <add> * routeMapper={{ <add> * LeftButton: (route, navigator, index, navState) => <add> * { return (<Text>Cancel</Text>); }, <add> * RightButton: (route, navigator, index, navState) => <add> * { return (<Text>Done</Text>); }, <add> * Title: (route, navigator, index, navState) => <add> * { return (<Text>Awesome Nav Bar</Text>); }, <add> * }} <add> * style={{backgroundColor: 'gray'}} <add> * /> <add> * } <add> * /> <add> * ``` <add> * <add> * When configuring the left, right, and title items for the navigation bar, <add> * you have access to info such as the current route object and navigation <add> * state. This allows you to customize the title for each scene as well as <add> * the buttons. For example, you can choose to hide the left button for one of <add> * the scenes. <add> * <add> * Typically you want buttons to represent the left and right buttons. Building <add> * on the previous example, you can set this up as follows: <add> * <add> * ``` <add> * LeftButton: (route, navigator, index, navState) => <add> * { <add> * if (route.index === 0) { <add> * return null; <add> * } else { <add> * return ( <add> * <TouchableHighlight onPress={() => navigator.pop()}> <add> * <Text>Back</Text> <add> * </TouchableHighlight> <add> * ); <ide> * } <del> * /> <add> * }, <ide> * ``` <add> * <add> * This sets up a left navigator bar button that's visible on scenes after the <add> * the first one. When the button is tapped the navigator is popped. <add> * <add> * ### Scene Transitions <add> * <add> * To change the animation or gesture properties of the scene, provide a <add> * `configureScene` prop to get the config object for a given route: <add> * <add> * ``` <add> * <Navigator <add> * renderScene={(route, navigator) => <add> * // ... <add> * } <add> * configureScene={(route, routeStack) => <add> * Navigator.SceneConfigs.FloatFromBottom} <add> * /> <add> * ``` <add> * In the above example, the newly pushed scene will float up from the bottom. <add> * See `Navigator.SceneConfigs` for default animations and more info on <add> * available [scene config options](/react-native/docs/navigator.html#configurescene). <ide> */ <ide> var Navigator = React.createClass({ <ide> <ide> propTypes: { <ide> /** <del> * Optional function that allows configuration about scene animations and <del> * gestures. Will be invoked with the route and the routeStack and should <del> * return a scene configuration object <add> * Optional function where you can configure scene animations and <add> * gestures. Will be invoked with `route` and `routeStack` parameters, <add> * where `route` corresponds to the current scene being rendered by the <add> * `Navigator` and `routeStack` is the set of currently mounted routes <add> * that the navigator could transition to. <add> * <add> * The function should return a scene configuration object. <ide> * <ide> * ``` <ide> * (route, routeStack) => Navigator.SceneConfigs.FloatFromRight <ide> * ``` <ide> * <del> * Available options are: <add> * Available scene configutation options are: <ide> * <ide> * - Navigator.SceneConfigs.PushFromRight (default) <ide> * - Navigator.SceneConfigs.FloatFromRight <ide> var Navigator = React.createClass({ <ide> <ide> /** <ide> * Required function which renders the scene for a given route. Will be <del> * invoked with the route and the navigator object <add> * invoked with the `route` and the `navigator` object. <ide> * <ide> * ``` <ide> * (route, navigator) => <ide> var Navigator = React.createClass({ <ide> renderScene: PropTypes.func.isRequired, <ide> <ide> /** <del> * Specify a route to start on. A route is an object that the navigator <del> * will use to identify each scene to render. `initialRoute` must be <del> * a route in the `initialRouteStack` if both props are provided. The <del> * `initialRoute` will default to the last item in the `initialRouteStack`. <add> * The initial route for navigation. A route is an object that the navigator <add> * will use to identify each scene it renders. <add> * <add> * If both `initialRoute` and `initialRouteStack` props are passed to <add> * `Navigator`, then `initialRoute` must be in a route in <add> * `initialRouteStack`. If `initialRouteStack` is passed as a prop but <add> * `initialRoute` is not, then `initialRoute` will default internally to <add> * the last item in `initialRouteStack`. <ide> */ <ide> initialRoute: PropTypes.object, <ide> <ide> /** <del> * Provide a set of routes to initially mount. Required if no initialRoute <del> * is provided. Otherwise, it will default to an array containing only the <del> * `initialRoute` <add> * Pass this in to provide a set of routes to initially mount. This prop <add> * is required if `initialRoute` is not provided to the navigator. If this <add> * prop is not passed in, it will default internally to an array <add> * containing only `initialRoute`. <ide> */ <ide> initialRouteStack: PropTypes.arrayOf(PropTypes.object), <ide> <ide> /** <del> * Will emit the target route upon mounting and before each nav transition <add> * Pass in a function to get notified with the target route when <add> * the navigator component is mounted and before each navigator transition. <ide> */ <ide> onWillFocus: PropTypes.func, <ide> <ide> /** <ide> * Will be called with the new route of each scene after the transition is <del> * complete or after the initial mounting <add> * complete or after the initial mounting. <ide> */ <ide> onDidFocus: PropTypes.func, <ide> <ide> /** <del> * Optionally provide a component as navigation bar that persists across scene <del> * transitions. The component will receive two props: `navigator` and `navState`. <del> * It will be rerendered when the routes change. <add> * Use this to provide an optional component representing a navigation bar <add> * that is persisted across scene transitions. This component will receive <add> * two props: `navigator` and `navState` representing the navigator <add> * component and its state. The component is re-rendered when the route <add> * changes. <ide> */ <ide> navigationBar: PropTypes.node, <ide> <ide> /** <del> * Optionally provide the navigator object from a parent Navigator <add> * Optionally pass in the navigator object from a parent `Navigator`. <ide> */ <ide> navigator: PropTypes.object, <ide> <ide> /** <del> * Styles to apply to the container of each scene <add> * Styles to apply to the container of each scene. <ide> */ <ide> sceneStyle: View.propTypes.style, <ide> }, <ide> var Navigator = React.createClass({ <ide> /** <ide> * Reset every scene with an array of routes. <ide> * <del> * @param {RouteStack} nextRouteStack Next route stack to reinitialize. This <del> * doesn't accept stack item `id`s, which implies that all existing items are <del> * destroyed, and then potentially recreated according to `routeStack`. Does <del> * not animate, immediately replaces and rerenders navigation bar and stack <del> * items. <add> * @param {RouteStack} nextRouteStack Next route stack to reinitialize. <add> * All existing route stacks are destroyed an potentially recreated. There <add> * is no accompanying animation and this method immediately replaces and <add> * re-renders the navigation bar and the stack items. <ide> */ <ide> immediatelyResetRouteStack: function(nextRouteStack) { <ide> var destIndex = nextRouteStack.length - 1; <ide> var Navigator = React.createClass({ <ide> }, <ide> <ide> /** <del> * Transition to an existing scene without unmounting <add> * Transition to an existing scene without unmounting. <add> * @param {object} route Route to transition to. The specified route must <add> * be in the currently mounted set of routes defined in `routeStack`. <ide> */ <ide> jumpTo: function(route) { <ide> var destIndex = this.state.routeStack.indexOf(route); <ide> var Navigator = React.createClass({ <ide> <ide> /** <ide> * Navigate forward to a new scene, squashing any scenes that you could <del> * `jumpForward` to. <add> * jump forward to. <add> * @param {object} route Route to push into the navigator stack. <ide> */ <ide> push: function(route) { <ide> invariant(!!route, 'Must supply route to push'); <ide> var Navigator = React.createClass({ <ide> }, <ide> <ide> /** <del> * Replace a scene as specified by an index <del> * <del> * `index` specifies the route in the stack that should be replaced. <del> * If it's negative, it counts from the back. <add> * Replace a scene as specified by an index. <add> * @param {object} route Route representing the new scene to render. <add> * @param {number} index The route in the stack that should be replaced. <add> * If negative, it counts from the back of the stack. <add> * @param {Function} cb Callback function when the scene has been replaced. <ide> */ <ide> replaceAtIndex: function(route, index, cb) { <ide> invariant(!!route, 'Must supply route to replace'); <ide> var Navigator = React.createClass({ <ide> <ide> /** <ide> * Replace the current scene with a new route. <add> * @param {object} route Route that replaces the current scene. <ide> */ <ide> replace: function(route) { <ide> this.replaceAtIndex(route, this.state.presentedIndex); <ide> }, <ide> <ide> /** <ide> * Replace the previous scene. <add> * @param {object} route Route that replaces the previous scene. <ide> */ <ide> replacePrevious: function(route) { <ide> this.replaceAtIndex(route, this.state.presentedIndex - 1); <ide> var Navigator = React.createClass({ <ide> /** <ide> * Pop to a particular scene, as specified by its route. <ide> * All scenes after it will be unmounted. <add> * @param {object} route Route to pop to. <ide> */ <ide> popToRoute: function(route) { <ide> var indexOfRoute = this.state.routeStack.indexOf(route); <ide> var Navigator = React.createClass({ <ide> <ide> /** <ide> * Replace the previous scene and pop to it. <add> * @param {object} route Route that replaces the previous scene. <ide> */ <ide> replacePreviousAndPop: function(route) { <ide> if (this.state.routeStack.length < 2) { <ide> var Navigator = React.createClass({ <ide> <ide> /** <ide> * Navigate to a new scene and reset route stack. <add> * @param {object} route Route to navigate to. <ide> */ <ide> resetTo: function(route) { <ide> invariant(!!route, 'Must supply route to push');
1
Python
Python
add an extra example in runtests.py help test
e372d06eb8b4cf8e156e2a5b177f5bf222b4584a
<ide><path>runtests.py <ide> <ide> $ python runtests.py <ide> $ python runtests.py -s {SAMPLE_SUBMODULE} <add> $ # Run a standalone test function: <ide> $ python runtests.py -t {SAMPLE_TEST} <add> $ # Run a test defined as a method of a TestXXX class: <add> $ python runtests.py -t {SAMPLE_TEST2} <ide> $ python runtests.py --ipython <ide> $ python runtests.py --python somescript.py <ide> $ python runtests.py --bench <ide> PROJECT_MODULE = "numpy" <ide> PROJECT_ROOT_FILES = ['numpy', 'LICENSE.txt', 'setup.py'] <ide> SAMPLE_TEST = "numpy/linalg/tests/test_linalg.py::test_byteorder_check" <add>SAMPLE_TEST2 = "numpy/core/tests/test_memmap.py::TestMemmap::test_open_with_filename" <ide> SAMPLE_SUBMODULE = "linalg" <ide> <ide> EXTRA_PATH = ['/usr/lib/ccache', '/usr/lib/f90cache',
1
PHP
PHP
use single quote / no comparison
2e85ba230073c7498bbcbe99db7489fcc1224836
<ide><path>src/TestSuite/Constraint/Email/MailSubjectContains.php <ide> public function matches($other): bool <ide> $subject = $message->getOriginalSubject(); <ide> <ide> $other = preg_quote($other, '/'); <del> if (preg_match("/$other/", $subject) > 0) { <add> preg_match('/$other/', $subject, $matches); <add> if ($matches) { <ide> return true; <ide> } <ide> }
1
PHP
PHP
fix subtle error in regex matching uri scheme
1ff77f2363eb7403bb994bd78f18c0793a3d00c9
<ide><path>lib/Cake/Routing/Router.php <ide> public static function url($url = null, $full = false) { <ide> $output .= Inflector::underscore($params['controller']) . '/' . $url; <ide> } <ide> } <del> $protocol = preg_match('#^[a-z][a-z0-9+-.]*\://#i', $output); <add> $protocol = preg_match('#^[a-z][a-z0-9+\-.]*\://#i', $output); <ide> if ($protocol === 0) { <ide> $output = str_replace('//', '/', $base . '/' . $output); <ide>
1
Javascript
Javascript
replace hasownproperty() with object.hasown()
0018ee1f687f01d477d6a0f4d4657a1220f27d61
<ide><path>benchmark/common.js <ide> class Benchmark { <ide> this.config = this.queue[0]; <ide> <ide> process.nextTick(() => { <del> if (process.env.hasOwnProperty('NODE_RUN_BENCHMARK_FN')) { <add> if (Object.hasOwn(process.env, 'NODE_RUN_BENCHMARK_FN')) { <ide> fn(this.config); <ide> } else { <ide> // _run will use fork() to create a new process for each configuration
1
Text
Text
add note that seccomp 2.2.1 or higher is required
6ab52f9f00968e15e8dcae145dbaea04da394d83
<ide><path>docs/security/seccomp.md <ide> feature to restrict your application's access. <ide> This feature is available only if the kernel is configured with `CONFIG_SECCOMP` <ide> enabled. <ide> <add>> **Note**: On Ubuntu 14.04, Debian Wheezy, and Debian Jessie, you must download <add>> the [latest static Docker Linux binary](../installation/binaries.md) to use <add>> seccomp. <add> <ide> ## Passing a profile for a container <ide> <ide> The default seccomp profile provides a sane default for running containers with
1
Go
Go
add test to detect data races
9080e5a1f7e764a05237e876b20cd1abc2d6ff89
<ide><path>daemon/logger/loggerutils/logfile_race_test.go <add>//go:build race <add>// +build race <add> <add>package loggerutils // import "github.com/docker/docker/daemon/logger/loggerutils" <add> <add>import ( <add> "context" <add> "fmt" <add> "io" <add> "path/filepath" <add> "testing" <add> "time" <add> <add> "github.com/docker/docker/api/types/backend" <add> "github.com/docker/docker/daemon/logger" <add> "github.com/docker/docker/pkg/tailfile" <add> "golang.org/x/sync/errgroup" <add> "gotest.tools/v3/assert" <add>) <add> <add>func TestConcurrentLogging(t *testing.T) { <add> const ( <add> containers = 5 <add> loggers = 3 // loggers per container <add> messages = 50 // messages per logger <add> <add> capacity = 256 <add> maxFiles = 3 <add> compress = true <add> ) <add> getTailReader := func(ctx context.Context, r SizeReaderAt, lines int) (io.Reader, int, error) { <add> return tailfile.NewTailReader(ctx, r, lines) <add> } <add> createDecoder := func(io.Reader) Decoder { <add> return dummyDecoder{} <add> } <add> marshal := func(msg *logger.Message) ([]byte, error) { <add> return []byte(fmt.Sprintf( <add> "Line=%q Source=%q Timestamp=%v Attrs=%v PLogMetaData=%#v Err=%v", <add> msg.Line, msg.Source, msg.Timestamp, msg.Attrs, msg.PLogMetaData, msg.Err, <add> )), nil <add> } <add> g, ctx := errgroup.WithContext(context.Background()) <add> for ct := 0; ct < containers; ct++ { <add> ct := ct <add> dir := t.TempDir() <add> g.Go(func() (err error) { <add> logfile, err := NewLogFile(filepath.Join(dir, "log.log"), capacity, maxFiles, compress, marshal, createDecoder, 0644, getTailReader) <add> if err != nil { <add> return err <add> } <add> defer func() { <add> if cErr := logfile.Close(); cErr != nil && err == nil { <add> err = cErr <add> } <add> }() <add> lg, ctx := errgroup.WithContext(ctx) <add> for ln := 0; ln < loggers; ln++ { <add> ln := ln <add> lg.Go(func() error { <add> for m := 0; m < messages; m++ { <add> select { <add> case <-ctx.Done(): <add> return ctx.Err() <add> default: <add> } <add> msg := logger.NewMessage() <add> msg.Line = append(msg.Line, fmt.Sprintf("container=%v logger=%v msg=%v", ct, ln, m)...) <add> msg.Source = "stdout" <add> msg.Timestamp = time.Now() <add> msg.Attrs = append(msg.Attrs, backend.LogAttr{Key: "foo", Value: "bar"}) <add> msg.PLogMetaData = &backend.PartialLogMetaData{ID: fmt.Sprintf("%v %v %v", ct, ln, m), Ordinal: 1, Last: true} <add> if err := logfile.WriteLogEntry(msg); err != nil { <add> return err <add> } <add> } <add> return nil <add> }) <add> } <add> return lg.Wait() <add> }) <add> } <add> assert.NilError(t, g.Wait()) <add>}
1
Python
Python
replace extra links value
17d3e78e1b4011267e81846b5d496769934a5bcc
<ide><path>airflow/www/views.py <ide> def task_group_to_tree(task_item_or_group, dag, dag_runs, tis, session): <ide> if ti.task_id == task_item_or_group.task_id <ide> ], <ide> 'label': task_item_or_group.label, <del> 'extra_links': [], <add> 'extra_links': task_item_or_group.extra_links, <ide> 'is_mapped': task_item_or_group.is_mapped, <ide> } <ide>
1
Python
Python
fix func signature
d9a81fc0c5d8339357a42435009a5be3a190b305
<ide><path>tests/test_trainer.py <ide> def __init__(self, a=0, b=0, double_output=False): <ide> self.double_output = double_output <ide> self.config = None <ide> <del> def forward(self, input_x=None, labels=None, **kwargs): <add> def forward(self, input_x, labels=None, **kwargs): <ide> y = input_x * self.a + self.b <ide> if labels is None: <ide> return (y, y) if self.double_output else (y,) <ide> def __init__(self, a=0, b=0): <ide> self.b = torch.nn.Parameter(torch.tensor(b).float()) <ide> self.config = None <ide> <del> def forward(self, input_x=None, labels=None, **kwargs): <add> def forward(self, input_x, labels=None, **kwargs): <ide> y = input_x * self.a + self.b <ide> result = {"output": y} <ide> if labels is not None: <ide> def __init__(self, config): <ide> self.b = torch.nn.Parameter(torch.tensor(config.b).float()) <ide> self.double_output = config.double_output <ide> <del> def forward(self, input_x=None, labels=None, **kwargs): <add> def forward(self, input_x, labels=None, **kwargs): <ide> y = input_x * self.a + self.b <ide> if labels is None: <ide> return (y, y) if self.double_output else (y,)
1
Text
Text
add v3.12.0 to changelog
1479f4aa2b101ce94314527fa096eed74cff2126
<ide><path>CHANGELOG.md <ide> # Ember Changelog <ide> <del># v3.12.0-beta.1 (June 27, 2019) <add>### v3.12.0 (August 5, 2019) <ide> <add>- [#18159](https://github.com/emberjs/ember.js/pull/18159) [BUGFIX] Update router.js to ensure buildRouteInfoMetadata does not eagerly cache routes in lazy Engines <add>- [#18226](https://github.com/emberjs/ember.js/pull/18226) [BUGFIX] Fix routing path with double slash (#18226) <ide> - [#17406](https://github.com/emberjs/ember.js/pull/17406) [BUGFIX] Properties observed through `Ember.Observer` can be set to `undefined` <ide> - [#18150](https://github.com/emberjs/ember.js/pull/18150) [BUGFIX] Fix a memory retention issue with string-based event listeners <ide> - [#18124](https://github.com/emberjs/ember.js/pull/18124) [CLEANUP] Remove deprecated `NAME_KEY`
1
PHP
PHP
apply fixes from styleci
6d1da017689c004efece0bde8c3790202c359a31
<ide><path>tests/Routing/RouteRegistrarTest.php <ide> public function testCanRegisterResourceWithMissingOption() <ide> { <ide> $this->router->middleware('resource-middleware') <ide> ->resource('users', RouteRegistrarControllerStub::class) <del> ->missing(function () { return 'missing'; }); <add> ->missing(function () { <add> return 'missing'; <add> }); <ide> <ide> $this->assertIsCallable($this->router->getRoutes()->getByName('users.show')->getMissing()); <ide> $this->assertIsCallable($this->router->getRoutes()->getByName('users.edit')->getMissing());
1
Javascript
Javascript
fix duplicate head tags
3be175b4663da23c08596428f99857fff869a8d8
<ide><path>examples/with-apollo-and-redux/lib/withData.js <ide> import React from 'react' <ide> import PropTypes from 'prop-types' <ide> import { ApolloProvider, getDataFromTree } from 'react-apollo' <add>import Head from 'next/head' <ide> import initApollo from './initApollo' <ide> import initRedux from './initRedux' <ide> <ide> export default ComposedComponent => { <ide> </ApolloProvider> <ide> ) <ide> await getDataFromTree(app) <add> // getDataFromTree does not call componentWillUnmount <add> // head side effect therefore need to be cleared manually <add> Head.rewind() <ide> <ide> // Extract query data from the store <ide> const state = redux.getState() <ide><path>examples/with-apollo/lib/withData.js <ide> import React from 'react' <ide> import PropTypes from 'prop-types' <ide> import { ApolloProvider, getDataFromTree } from 'react-apollo' <add>import Head from 'next/head' <ide> import initApollo from './initApollo' <ide> <ide> export default ComposedComponent => { <ide> export default ComposedComponent => { <ide> </ApolloProvider> <ide> ) <ide> await getDataFromTree(app) <add> // getDataFromTree does not call componentWillUnmount <add> // head side effect therefore need to be cleared manually <add> Head.rewind() <ide> <ide> // Extract query data from the Apollo's store <ide> const state = apollo.getInitialState()
2
Javascript
Javascript
return stacktrace button in yellow box
8159b2cd2a32f81ef0421386e454fa049cc8c54f
<ide><path>Libraries/ReactNative/YellowBox.js <ide> const WarningInspector = ({ <ide> <View style={styles.inspector}> <ide> <View style={styles.inspectorCount}> <ide> <Text style={styles.inspectorCountText}>{countSentence}</Text> <del> <TouchableHighlight <del> activeOpacity={0.5} <del> onPress={toggleStacktrace} <del> style={styles.toggleStacktraceButton} <del> underlayColor="transparent"> <add> <TouchableHighlight onPress={toggleStacktrace} underlayColor="transparent"> <ide> <Text style={styles.inspectorButtonText}> <del> {stacktraceVisible ? 'Hide' : 'Show'} Stacktrace <add> {stacktraceVisible ? '▼' : '▶' } Stacktrace <ide> </Text> <ide> </TouchableHighlight> <ide> </View> <ide> var styles = StyleSheet.create({ <ide> paddingVertical: 22, <ide> backgroundColor: backgroundColor(1), <ide> }, <del> toggleStacktraceButton: { <del> flex: 1, <del> padding: 5, <del> }, <ide> stacktraceList: { <ide> paddingBottom: 5, <ide> }, <ide> var styles = StyleSheet.create({ <ide> inspectorCount: { <ide> padding: 15, <ide> paddingBottom: 0, <add> flexDirection: 'row', <add> justifyContent: 'space-between', <ide> }, <ide> inspectorCountText: { <ide> color: textColor,
1
Ruby
Ruby
assert correct response body
8ae38dab5251613a7e7f5af5289e524abca20efd
<ide><path>activestorage/test/controllers/disk_controller_test.rb <ide> class ActiveStorage::DiskControllerTest < ActionDispatch::IntegrationTest <ide> blob = create_blob <ide> <ide> get blob.service_url <del> assert_equal "inline; filename=\"hello.txt\"; filename*=UTF-8''hello.txt", @response.headers["Content-Disposition"] <del> assert_equal "text/plain", @response.headers["Content-Type"] <add> assert_equal "inline; filename=\"hello.txt\"; filename*=UTF-8''hello.txt", response.headers["Content-Disposition"] <add> assert_equal "text/plain", response.headers["Content-Type"] <add> assert_equal "Hello world!", response.body <ide> end <ide> <ide> test "showing blob as attachment" do <ide> blob = create_blob <ide> <ide> get blob.service_url(disposition: :attachment) <del> assert_equal "attachment; filename=\"hello.txt\"; filename*=UTF-8''hello.txt", @response.headers["Content-Disposition"] <del> assert_equal "text/plain", @response.headers["Content-Type"] <add> assert_equal "attachment; filename=\"hello.txt\"; filename*=UTF-8''hello.txt", response.headers["Content-Disposition"] <add> assert_equal "text/plain", response.headers["Content-Type"] <add> assert_equal "Hello world!", response.body <ide> end <ide> <ide>
1
PHP
PHP
add skip for test that fails on sqlserver
f22c80e9ec4964b6d5068c260ceef5af81eab239
<ide><path>lib/Cake/Test/Case/Console/Command/Task/FixtureTaskTest.php <ide> public function testImportOptionsAlternateConnection() { <ide> * @return void <ide> */ <ide> function testImportRecordsNoEscaping() { <add> $db = ConnectionManager::getDataSource('test'); <add> if ($db instanceof Sqlserver) { <add> $this->markTestSkipped('This test does not run on SQLServer'); <add> } <add> <ide> $Article = ClassRegistry::init('Article'); <ide> $Article->updateAll(array('body' => "'Body \"value\"'")); <ide>
1
Python
Python
set celery_executor to use queue name as exchange
828419ede1330402e79e68451ad0554a4e6342ea
<ide><path>airflow/executors/celery_executor.py <ide> class CeleryConfig(object): <ide> CELERY_RESULT_BACKEND = configuration.get('celery', 'CELERY_RESULT_BACKEND') <ide> CELERYD_CONCURRENCY = configuration.getint('celery', 'CELERYD_CONCURRENCY') <ide> CELERY_DEFAULT_QUEUE = DEFAULT_QUEUE <add> CELERY_DEFAULT_EXCHANGE = DEFAULT_QUEUE <ide> <ide> app = Celery( <ide> configuration.get('celery', 'CELERY_APP_NAME'),
1
PHP
PHP
add assertion for soft deleted models
7b84baa5093e18fe988724bd27e1a58f191e000a
<ide><path>src/Illuminate/Foundation/Testing/Concerns/InteractsWithDatabase.php <ide> <ide> namespace Illuminate\Foundation\Testing\Concerns; <ide> <add>use Illuminate\Foundation\Testing\Constraints\HasSoftDeletedInDatabase; <ide> use PHPUnit_Framework_Constraint_Not as ReverseConstraint; <ide> use Illuminate\Foundation\Testing\Constraints\HasInDatabase; <ide> <ide> protected function assertDatabaseMissing($table, array $data, $connection = null <ide> return $this; <ide> } <ide> <add> /** <add> * Assert that a given where condition exists in the database. <add> * <add> * @param string $table <add> * @param array $data <add> * @param string $connection <add> * @return $this <add> */ <add> protected function assertDatabaseHasSoftDelete($table, array $data, $connection = null) <add> { <add> $this->assertThat( <add> $table, new HasSoftDeletedInDatabase($this->getConnection($connection), $data) <add> ); <add> <add> return $this; <add> } <add> <ide> /** <ide> * Get the database connection. <ide> * <ide><path>src/Illuminate/Foundation/Testing/Constraints/HasSoftDeletedInDatabase.php <add><?php <add> <add>namespace Illuminate\Foundation\Testing\Constraints; <add> <add>use PHPUnit_Framework_Constraint; <add>use Illuminate\Database\Connection; <add> <add>class HasSoftDeletedInDatabase extends PHPUnit_Framework_Constraint <add>{ <add> /** <add> * Number of records that will be shown in the console in case of failure. <add> * <add> * @var int <add> */ <add> protected $show = 3; <add> <add> /** <add> * The database connection. <add> * <add> * @var \Illuminate\Database\Connection <add> */ <add> protected $database; <add> <add> /** <add> * The data that will be used to narrow the search in the database table. <add> * <add> * @var array <add> */ <add> protected $data; <add> <add> /** <add> * Create a new constraint instance. <add> * <add> * @param \Illuminate\Database\Connection $database <add> * @param array $data <add> * @return void <add> */ <add> public function __construct(Connection $database, array $data) <add> { <add> $this->data = $data; <add> <add> $this->database = $database; <add> } <add> <add> /** <add> * Check if the data is found in the given table. <add> * <add> * @param string $table <add> * @return bool <add> */ <add> public function matches($table) <add> { <add> return $this->database->table($table)->where($this->data)->whereNotNull('deleted_at')->count() > 0; <add> } <add> <add> /** <add> * Get the description of the failure. <add> * <add> * @param string $table <add> * @return string <add> */ <add> public function failureDescription($table) <add> { <add> return sprintf( <add> "a soft deleted row in the table [%s] matches the attributes %s.\n\n%s", <add> $table, $this->toString(), $this->getAdditionalInfo($table) <add> ); <add> } <add> <add> /** <add> * Get additional info about the records found in the database table. <add> * <add> * @param string $table <add> * @return string <add> */ <add> protected function getAdditionalInfo($table) <add> { <add> $results = $this->database->table($table)->get(); <add> <add> if ($results->isEmpty()) { <add> return 'The table is empty'; <add> } <add> <add> $description = 'Found: '.json_encode($results->take($this->show), JSON_PRETTY_PRINT); <add> <add> if ($results->count() > $this->show) { <add> $description .= sprintf(' and %s others', $results->count() - $this->show); <add> } <add> <add> return $description; <add> } <add> <add> /** <add> * Get a string representation of the object. <add> * <add> * @return string <add> */ <add> public function toString() <add> { <add> return json_encode($this->data); <add> } <add>} <ide><path>tests/Foundation/FoundationInteractsWithDatabaseTest.php <ide> public function testDontSeeInDatabaseFindsResults() <ide> $this->assertDatabaseMissing($this->table, $this->data); <ide> } <ide> <add> public function testSeeSoftDeletedInDatabaseFindsResults() <add> { <add> $this->mockCountBuilder(1); <add> <add> $this->assertDatabaseHasSoftDelete($this->table, $this->data); <add> } <add> <add> /** <add> * @expectedException \PHPUnit_Framework_ExpectationFailedException <add> * @expectedExceptionMessage The table is empty. <add> */ <add> public function testSeeSoftDeletedInDatabaseDoesNotFindResults() <add> { <add> $builder = $this->mockCountBuilder(0); <add> <add> $builder->shouldReceive('get')->andReturn(collect()); <add> <add> $this->assertDatabaseHasSoftDelete($this->table, $this->data); <add> } <add> <ide> protected function mockCountBuilder($countResult) <ide> { <ide> $builder = m::mock(Builder::class); <ide> <ide> $builder->shouldReceive('where')->with($this->data)->andReturnSelf(); <ide> <add> $builder->shouldReceive('whereNotNull')->with('deleted_at')->andReturnSelf(); <add> <ide> $builder->shouldReceive('count')->andReturn($countResult); <ide> <ide> $this->connection->shouldReceive('table') <del> ->with($this->table) <del> ->andReturn($builder); <add> ->with($this->table) <add> ->andReturn($builder); <ide> <ide> return $builder; <ide> }
3
Ruby
Ruby
fix broken dylib spacing
93051b27d6886dae6df01544c86df579f21f6410
<ide><path>Library/Homebrew/extend/os/mac/formula_cellar_checks.rb <ide> def check_linkage <ide> return unless checker.broken_dylibs? <ide> output = <<-EOS.undent <ide> #{formula} has broken dynamic library links: <del> #{checker.broken_dylibs.to_a * "\n "} <add> #{checker.broken_dylibs.to_a * "\n "} <ide> EOS <ide> tab = Tab.for_keg(keg) <ide> if tab.poured_from_bottle
1
Go
Go
handle compressed tars in applylayer
a96a26c62f6333e61134759256db43a7f5946631
<ide><path>archive/archive.go <ide> package archive <ide> import ( <ide> "archive/tar" <ide> "bytes" <add> "compress/gzip" <add> "compress/bzip2" <ide> "fmt" <ide> "github.com/dotcloud/docker/utils" <ide> "io" <ide> func DetectCompression(source []byte) Compression { <ide> return Uncompressed <ide> } <ide> <add>func DecompressStream(archive io.Reader) (io.Reader, error) { <add> buf := make([]byte, 10) <add> totalN := 0 <add> for totalN < 10 { <add> n, err := archive.Read(buf[totalN:]) <add> if err != nil { <add> if err == io.EOF { <add> return nil, fmt.Errorf("Tarball too short") <add> } <add> return nil, err <add> } <add> totalN += n <add> utils.Debugf("[tar autodetect] n: %d", n) <add> } <add> compression := DetectCompression(buf) <add> wrap := io.MultiReader(bytes.NewReader(buf), archive) <add> <add> switch compression { <add> case Uncompressed: <add> return wrap, nil <add> case Gzip: <add> return gzip.NewReader(wrap) <add> case Bzip2: <add> return bzip2.NewReader(wrap), nil <add> default: <add> return nil, fmt.Errorf("Unsupported compression format %s", (&compression).Extension()) <add> } <add>} <add> <ide> func (compression *Compression) Flag() string { <ide> switch *compression { <ide> case Bzip2: <ide><path>archive/diff.go <ide> func ApplyLayer(dest string, layer Archive) error { <ide> oldmask := syscall.Umask(0) <ide> defer syscall.Umask(oldmask) <ide> <add> layer, err := DecompressStream(layer) <add> if err != nil { <add> return err <add> } <add> <ide> tr := tar.NewReader(layer) <ide> <ide> var dirs []*tar.Header
2
Python
Python
add type hints for luke in pytorch
6c2f3ed74c9b73eb389bffd0aea9c9358470220b
<ide><path>src/transformers/models/luke/modeling_luke.py <ide> <ide> import math <ide> from dataclasses import dataclass <del>from typing import Optional, Tuple <add>from typing import Optional, Tuple, Union <ide> <ide> import torch <ide> import torch.utils.checkpoint <ide> class LukeModel(LukePreTrainedModel): <ide> <ide> _keys_to_ignore_on_load_missing = [r"position_ids"] <ide> <del> def __init__(self, config, add_pooling_layer=True): <add> def __init__(self, config: LukeConfig, add_pooling_layer: bool = True): <ide> super().__init__(config) <ide> self.config = config <ide> <ide> def _prune_heads(self, heads_to_prune): <ide> @replace_return_docstrings(output_type=BaseLukeModelOutputWithPooling, config_class=_CONFIG_FOR_DOC) <ide> def forward( <ide> self, <del> input_ids=None, <del> attention_mask=None, <del> token_type_ids=None, <del> position_ids=None, <del> entity_ids=None, <del> entity_attention_mask=None, <del> entity_token_type_ids=None, <del> entity_position_ids=None, <del> head_mask=None, <del> inputs_embeds=None, <del> output_attentions=None, <del> output_hidden_states=None, <del> return_dict=None, <del> ): <add> input_ids: Optional[torch.LongTensor] = None, <add> attention_mask: Optional[torch.FloatTensor] = None, <add> token_type_ids: Optional[torch.LongTensor] = None, <add> position_ids: Optional[torch.LongTensor] = None, <add> entity_ids: Optional[torch.LongTensor] = None, <add> entity_attention_mask: Optional[torch.FloatTensor] = None, <add> entity_token_type_ids: Optional[torch.LongTensor] = None, <add> entity_position_ids: Optional[torch.LongTensor] = None, <add> head_mask: Optional[torch.FloatTensor] = None, <add> inputs_embeds: Optional[torch.FloatTensor] = None, <add> output_attentions: Optional[bool] = None, <add> output_hidden_states: Optional[bool] = None, <add> return_dict: Optional[bool] = None, <add> ) -> Union[Tuple, BaseLukeModelOutputWithPooling]: <ide> r""" <ide> <ide> Returns: <ide> def set_output_embeddings(self, new_embeddings): <ide> @replace_return_docstrings(output_type=LukeMaskedLMOutput, config_class=_CONFIG_FOR_DOC) <ide> def forward( <ide> self, <del> input_ids=None, <del> attention_mask=None, <del> token_type_ids=None, <del> position_ids=None, <del> entity_ids=None, <del> entity_attention_mask=None, <del> entity_token_type_ids=None, <del> entity_position_ids=None, <del> labels=None, <del> entity_labels=None, <del> head_mask=None, <del> inputs_embeds=None, <del> output_attentions=None, <del> output_hidden_states=None, <del> return_dict=None, <del> ): <add> input_ids: Optional[torch.LongTensor] = None, <add> attention_mask: Optional[torch.FloatTensor] = None, <add> token_type_ids: Optional[torch.LongTensor] = None, <add> position_ids: Optional[torch.LongTensor] = None, <add> entity_ids: Optional[torch.LongTensor] = None, <add> entity_attention_mask: Optional[torch.LongTensor] = None, <add> entity_token_type_ids: Optional[torch.LongTensor] = None, <add> entity_position_ids: Optional[torch.LongTensor] = None, <add> labels: Optional[torch.LongTensor] = None, <add> entity_labels: Optional[torch.LongTensor] = None, <add> head_mask: Optional[torch.FloatTensor] = None, <add> inputs_embeds: Optional[torch.FloatTensor] = None, <add> output_attentions: Optional[bool] = None, <add> output_hidden_states: Optional[bool] = None, <add> return_dict: Optional[bool] = None, <add> ) -> Union[Tuple, LukeMaskedLMOutput]: <ide> r""" <ide> labels (`torch.LongTensor` of shape `(batch_size, sequence_length)`, *optional*): <ide> Labels for computing the masked language modeling loss. Indices should be in `[-100, 0, ..., <ide> def __init__(self, config): <ide> @replace_return_docstrings(output_type=EntityClassificationOutput, config_class=_CONFIG_FOR_DOC) <ide> def forward( <ide> self, <del> input_ids=None, <del> attention_mask=None, <del> token_type_ids=None, <del> position_ids=None, <del> entity_ids=None, <del> entity_attention_mask=None, <del> entity_token_type_ids=None, <del> entity_position_ids=None, <del> head_mask=None, <del> inputs_embeds=None, <del> labels=None, <del> output_attentions=None, <del> output_hidden_states=None, <del> return_dict=None, <del> ): <add> input_ids: Optional[torch.LongTensor] = None, <add> attention_mask: Optional[torch.FloatTensor] = None, <add> token_type_ids: Optional[torch.LongTensor] = None, <add> position_ids: Optional[torch.LongTensor] = None, <add> entity_ids: Optional[torch.LongTensor] = None, <add> entity_attention_mask: Optional[torch.FloatTensor] = None, <add> entity_token_type_ids: Optional[torch.LongTensor] = None, <add> entity_position_ids: Optional[torch.LongTensor] = None, <add> head_mask: Optional[torch.FloatTensor] = None, <add> inputs_embeds: Optional[torch.FloatTensor] = None, <add> labels: Optional[torch.FloatTensor] = None, <add> output_attentions: Optional[bool] = None, <add> output_hidden_states: Optional[bool] = None, <add> return_dict: Optional[bool] = None, <add> ) -> Union[Tuple, EntityClassificationOutput]: <ide> r""" <ide> labels (`torch.LongTensor` of shape `(batch_size,)` or `(batch_size, num_labels)`, *optional*): <ide> Labels for computing the classification loss. If the shape is `(batch_size,)`, the cross entropy loss is <ide> def __init__(self, config): <ide> @replace_return_docstrings(output_type=EntityPairClassificationOutput, config_class=_CONFIG_FOR_DOC) <ide> def forward( <ide> self, <del> input_ids=None, <del> attention_mask=None, <del> token_type_ids=None, <del> position_ids=None, <del> entity_ids=None, <del> entity_attention_mask=None, <del> entity_token_type_ids=None, <del> entity_position_ids=None, <del> head_mask=None, <del> inputs_embeds=None, <del> labels=None, <del> output_attentions=None, <del> output_hidden_states=None, <del> return_dict=None, <del> ): <add> input_ids: Optional[torch.LongTensor] = None, <add> attention_mask: Optional[torch.FloatTensor] = None, <add> token_type_ids: Optional[torch.LongTensor] = None, <add> position_ids: Optional[torch.LongTensor] = None, <add> entity_ids: Optional[torch.LongTensor] = None, <add> entity_attention_mask: Optional[torch.FloatTensor] = None, <add> entity_token_type_ids: Optional[torch.LongTensor] = None, <add> entity_position_ids: Optional[torch.LongTensor] = None, <add> head_mask: Optional[torch.FloatTensor] = None, <add> inputs_embeds: Optional[torch.FloatTensor] = None, <add> labels: Optional[torch.LongTensor] = None, <add> output_attentions: Optional[bool] = None, <add> output_hidden_states: Optional[bool] = None, <add> return_dict: Optional[bool] = None, <add> ) -> Union[Tuple, EntityPairClassificationOutput]: <ide> r""" <ide> labels (`torch.LongTensor` of shape `(batch_size,)` or `(batch_size, num_labels)`, *optional*): <ide> Labels for computing the classification loss. If the shape is `(batch_size,)`, the cross entropy loss is <ide> def __init__(self, config): <ide> @replace_return_docstrings(output_type=EntitySpanClassificationOutput, config_class=_CONFIG_FOR_DOC) <ide> def forward( <ide> self, <del> input_ids=None, <add> input_ids: Optional[torch.LongTensor] = None, <ide> attention_mask=None, <del> token_type_ids=None, <del> position_ids=None, <del> entity_ids=None, <del> entity_attention_mask=None, <del> entity_token_type_ids=None, <del> entity_position_ids=None, <del> entity_start_positions=None, <del> entity_end_positions=None, <del> head_mask=None, <del> inputs_embeds=None, <del> labels=None, <del> output_attentions=None, <del> output_hidden_states=None, <del> return_dict=None, <del> ): <add> token_type_ids: Optional[torch.LongTensor] = None, <add> position_ids: Optional[torch.LongTensor] = None, <add> entity_ids: Optional[torch.LongTensor] = None, <add> entity_attention_mask: Optional[torch.LongTensor] = None, <add> entity_token_type_ids: Optional[torch.LongTensor] = None, <add> entity_position_ids: Optional[torch.LongTensor] = None, <add> entity_start_positions: Optional[torch.LongTensor] = None, <add> entity_end_positions: Optional[torch.LongTensor] = None, <add> head_mask: Optional[torch.FloatTensor] = None, <add> inputs_embeds: Optional[torch.FloatTensor] = None, <add> labels: Optional[torch.LongTensor] = None, <add> output_attentions: Optional[bool] = None, <add> output_hidden_states: Optional[bool] = None, <add> return_dict: Optional[bool] = None, <add> ) -> Union[Tuple, EntitySpanClassificationOutput]: <ide> r""" <ide> entity_start_positions (`torch.LongTensor`): <ide> The start positions of entities in the word token sequence.
1
Text
Text
add arabic translation for bash-touch
e1c47c3de88adb02e116749eefc7dd9bbb59af03
<ide><path>guide/arabic/bash/bash-touch/index.md <add>--- <add>title: Bash touch <add>localeTitle: باش touch <add>--- <add> <add>## ايعاز باش: touch (لمس) <add> <add>**تغير تاريخ ووقت الملفات.** <add> <add>``` <add>touch [options] filename <add>``` <add> <add>بإمكان الايعاز انشاء ملف جديد او اذا استخدمنا الايعاز على اي ملف فسيقوم بتحديث تاريخ الملف للوقت الحالي. <add> <add>بعض الخيارات الاكثر استخداما: <add>- `-t` تعديل التاريخ والوقت، بادخال الوقت بالشكل التالي (YYYYMMDDHHMM.SS). <add>- `-r` نسخ الوقت والتاريخ من ملف الى اخر. <add> <add>أمثلة: <add> <add>``` <add>touch -t YYYYMMDDHHMM.SS filename <add>touch -r file1 file2 <add>``` <add> <add>### للمزيد من المعلومات: <add>* [صفحة الكتيب](http://man7.org/linux/man-pages/man1/touch.1.html)
1
Mixed
Javascript
undo previous edit when get key code 0x1f
271725a36359003b9a26ad8522688c3a319a750d
<ide><path>doc/api/readline.md <ide> const { createInterface } = require('readline'); <ide> <td>Previous history item</td> <ide> <td></td> <ide> </tr> <add> <tr> <add> <td><kbd>Ctrl</kbd>+<kbd>-</kbd></td> <add> <td>Undo previous change</td> <add> <td>Any keystroke emits key code <code>0x1F</code> would do this action.</td> <add> <td></td> <add> </tr> <ide> <tr> <ide> <td><kbd>Ctrl</kbd>+<kbd>Z</kbd></td> <ide> <td>Moves running process into background. Type <ide><path>lib/internal/readline/interface.js <ide> const { <ide> ArrayPrototypeJoin, <ide> ArrayPrototypeMap, <ide> ArrayPrototypePop, <add> ArrayPrototypePush, <ide> ArrayPrototypeReverse, <ide> ArrayPrototypeSplice, <add> ArrayPrototypeShift, <ide> ArrayPrototypeUnshift, <ide> DateNow, <ide> FunctionPrototypeCall, <ide> const { StringDecoder } = require('string_decoder'); <ide> let Readable; <ide> <ide> const kHistorySize = 30; <add>const kMaxUndoRedoStackSize = 2048; <ide> const kMincrlfDelay = 100; <ide> // \r\n, \n, or \r followed by something other than \n <ide> const lineEnding = /\r?\n|\r(?!\n)/; <ide> const kQuestionCancel = Symbol('kQuestionCancel'); <ide> const ESCAPE_CODE_TIMEOUT = 500; <ide> <ide> const kAddHistory = Symbol('_addHistory'); <add>const kBeforeEdit = Symbol('_beforeEdit'); <ide> const kDecoder = Symbol('_decoder'); <ide> const kDeleteLeft = Symbol('_deleteLeft'); <ide> const kDeleteLineLeft = Symbol('_deleteLineLeft'); <ide> const kOldPrompt = Symbol('_oldPrompt'); <ide> const kOnLine = Symbol('_onLine'); <ide> const kPreviousKey = Symbol('_previousKey'); <ide> const kPrompt = Symbol('_prompt'); <add>const kPushToUndoStack = Symbol('_pushToUndoStack'); <ide> const kQuestionCallback = Symbol('_questionCallback'); <add>const kRedo = Symbol('_redo'); <add>const kRedoStack = Symbol('_redoStack'); <ide> const kRefreshLine = Symbol('_refreshLine'); <ide> const kSawKeyPress = Symbol('_sawKeyPress'); <ide> const kSawReturnAt = Symbol('_sawReturnAt'); <ide> const kSetRawMode = Symbol('_setRawMode'); <ide> const kTabComplete = Symbol('_tabComplete'); <ide> const kTabCompleter = Symbol('_tabCompleter'); <ide> const kTtyWrite = Symbol('_ttyWrite'); <add>const kUndo = Symbol('_undo'); <add>const kUndoStack = Symbol('_undoStack'); <ide> const kWordLeft = Symbol('_wordLeft'); <ide> const kWordRight = Symbol('_wordRight'); <ide> const kWriteToOutput = Symbol('_writeToOutput'); <ide> function InterfaceConstructor(input, output, completer, terminal) { <ide> this[kSubstringSearch] = null; <ide> this.output = output; <ide> this.input = input; <add> this[kUndoStack] = []; <add> this[kRedoStack] = []; <ide> this.history = history; <ide> this.historySize = historySize; <ide> this.removeHistoryDuplicates = !!removeHistoryDuplicates; <ide> class Interface extends InterfaceConstructor { <ide> } <ide> } <ide> <add> [kBeforeEdit](oldText, oldCursor) { <add> this[kPushToUndoStack](oldText, oldCursor); <add> } <add> <ide> [kQuestionCancel]() { <ide> if (this[kQuestionCallback]) { <ide> this[kQuestionCallback] = null; <ide> class Interface extends InterfaceConstructor { <ide> } <ide> <ide> [kInsertString](c) { <add> this[kBeforeEdit](this.line, this.cursor); <ide> if (this.cursor < this.line.length) { <ide> const beg = StringPrototypeSlice(this.line, 0, this.cursor); <ide> const end = StringPrototypeSlice( <ide> class Interface extends InterfaceConstructor { <ide> return; <ide> } <ide> <add> this[kBeforeEdit](this.line, this.cursor); <add> <ide> // Apply/show completions. <ide> const completionsWidth = ArrayPrototypeMap(completions, (e) => <ide> getStringWidth(e) <ide> class Interface extends InterfaceConstructor { <ide> <ide> [kDeleteLeft]() { <ide> if (this.cursor > 0 && this.line.length > 0) { <add> this[kBeforeEdit](this.line, this.cursor); <ide> // The number of UTF-16 units comprising the character to the left <ide> const charSize = charLengthLeft(this.line, this.cursor); <ide> this.line = <ide> class Interface extends InterfaceConstructor { <ide> <ide> [kDeleteRight]() { <ide> if (this.cursor < this.line.length) { <add> this[kBeforeEdit](this.line, this.cursor); <ide> // The number of UTF-16 units comprising the character to the left <ide> const charSize = charLengthAt(this.line, this.cursor); <ide> this.line = <ide> class Interface extends InterfaceConstructor { <ide> <ide> [kDeleteWordLeft]() { <ide> if (this.cursor > 0) { <add> this[kBeforeEdit](this.line, this.cursor); <ide> // Reverse the string and match a word near beginning <ide> // to avoid quadratic time complexity <ide> let leading = StringPrototypeSlice(this.line, 0, this.cursor); <ide> class Interface extends InterfaceConstructor { <ide> <ide> [kDeleteWordRight]() { <ide> if (this.cursor < this.line.length) { <add> this[kBeforeEdit](this.line, this.cursor); <ide> const trailing = StringPrototypeSlice(this.line, this.cursor); <ide> const match = StringPrototypeMatch(trailing, /^(?:\s+|\W+|\w+)\s*/); <ide> this.line = <ide> class Interface extends InterfaceConstructor { <ide> } <ide> <ide> [kDeleteLineLeft]() { <add> this[kBeforeEdit](this.line, this.cursor); <ide> this.line = StringPrototypeSlice(this.line, this.cursor); <ide> this.cursor = 0; <ide> this[kRefreshLine](); <ide> } <ide> <ide> [kDeleteLineRight]() { <add> this[kBeforeEdit](this.line, this.cursor); <ide> this.line = StringPrototypeSlice(this.line, 0, this.cursor); <ide> this[kRefreshLine](); <ide> } <ide> class Interface extends InterfaceConstructor { <ide> <ide> [kLine]() { <ide> const line = this[kAddHistory](); <add> this[kUndoStack] = []; <add> this[kRedoStack] = []; <ide> this.clearLine(); <ide> this[kOnLine](line); <ide> } <ide> <add> [kPushToUndoStack](text, cursor) { <add> if (ArrayPrototypePush(this[kUndoStack], { text, cursor }) > <add> kMaxUndoRedoStackSize) { <add> ArrayPrototypeShift(this[kUndoStack]); <add> } <add> } <add> <add> [kUndo]() { <add> if (this[kUndoStack].length <= 0) return; <add> <add> const entry = this[kUndoStack].pop(); <add> <add> this.line = entry.text; <add> this.cursor = entry.cursor; <add> <add> ArrayPrototypePush(this[kRedoStack], entry); <add> this[kRefreshLine](); <add> } <add> <add> [kRedo]() { <add> if (this[kRedoStack].length <= 0) return; <add> <add> const entry = this[kRedoStack].pop(); <add> <add> this.line = entry.text; <add> this.cursor = entry.cursor; <add> <add> ArrayPrototypePush(this[kUndoStack], entry); <add> this[kRefreshLine](); <add> } <add> <ide> // TODO(BridgeAR): Add underscores to the search part and a red background in <ide> // case no match is found. This should only be the visual part and not the <ide> // actual line content! <ide> class Interface extends InterfaceConstructor { <ide> // one. <ide> [kHistoryNext]() { <ide> if (this.historyIndex >= 0) { <add> this[kBeforeEdit](this.line, this.cursor); <ide> const search = this[kSubstringSearch] || ''; <ide> let index = this.historyIndex - 1; <ide> while ( <ide> class Interface extends InterfaceConstructor { <ide> <ide> [kHistoryPrev]() { <ide> if (this.historyIndex < this.history.length && this.history.length) { <add> this[kBeforeEdit](this.line, this.cursor); <ide> const search = this[kSubstringSearch] || ''; <ide> let index = this.historyIndex + 1; <ide> while ( <ide> class Interface extends InterfaceConstructor { <ide> } <ide> } <ide> <add> // Undo <add> if (typeof key.sequence === 'string' && <add> StringPrototypeCodePointAt(key.sequence, 0) === 0x1f) { <add> this[kUndo](); <add> return; <add> } <add> <ide> // Ignore escape key, fixes <ide> // https://github.com/nodejs/node-v0.x-archive/issues/2876. <ide> if (key.name === 'escape') return; <ide><path>test/parallel/test-readline-interface.js <ide> function assertCursorRowsAndCols(rli, rows, cols) { <ide> rli.close(); <ide> } <ide> <add>// Undo <add>{ <add> const [rli, fi] = getInterface({ terminal: true, prompt: '' }); <add> fi.emit('data', 'the quick brown fox'); <add> assertCursorRowsAndCols(rli, 0, 19); <add> <add> // Delete right line from the 5th char <add> fi.emit('keypress', '.', { ctrl: true, shift: false, name: 'b' }); <add> fi.emit('keypress', '.', { ctrl: true, shift: false, name: 'b' }); <add> fi.emit('keypress', '.', { ctrl: true, shift: false, name: 'b' }); <add> fi.emit('keypress', '.', { ctrl: true, shift: false, name: 'b' }); <add> fi.emit('keypress', ',', { ctrl: true, shift: false, name: 'k' }); <add> fi.emit('keypress', ',', { ctrl: true, shift: false, name: 'u' }); <add> assertCursorRowsAndCols(rli, 0, 0); <add> fi.emit('keypress', ',', { sequence: '\x1F' }); <add> assert.strictEqual(rli.line, 'the quick brown'); <add> fi.emit('keypress', ',', { sequence: '\x1F' }); <add> assert.strictEqual(rli.line, 'the quick brown fox'); <add> fi.emit('data', '\n'); <add> rli.close(); <add>} <add> <ide> // Clear the whole screen <ide> { <ide> const [rli, fi] = getInterface({ terminal: true, prompt: '' });
3
PHP
PHP
fix url parsing
ffb4034631a3840273b33b7d1031afaf4d1d80e3
<ide><path>application/config/application.php <ide> | <ide> */ <ide> <del> 'profiler' => true, <add> 'profiler' => false, <ide> <ide> /* <ide> |-------------------------------------------------------------------------- <ide><path>laravel/url.php <ide> public static function base() <ide> <ide> $base = 'http://localhost'; <ide> <del> // If the application URL configuration is set, we will just use that <add> // If the application's URL configuration is set, we will just use that <ide> // instead of trying to guess the URL from the $_SERVER array's host <ide> // and script variables as this is more reliable. <ide> if (($url = Config::get('application.url')) !== '') <ide> public static function base() <ide> { <ide> $f = Request::foundation(); <ide> <del> $base = $f->getScheme().'://'.$f->getHttpHost().$f->getBaseUrl(); <add> $base = $f->getScheme().'://'.$f->getHttpHost().$f->getBasePath(); <ide> } <ide> <ide> return static::$base = $base;
2
Python
Python
return rawresponse instance
5a7204822b5f91bf698fbd564d7c46a611bfff26
<ide><path>libcloud/storage/base.py <ide> def _upload_object(self, object_name, content_type, upload_func, <ide> raise LibcloudError(value='Object upload failed, Perhaps a timeout?', <ide> driver=self) <ide> <del> result_dict = { 'response': response.response, 'data_hash': data_hash, <add> result_dict = { 'response': response, 'data_hash': data_hash, <ide> 'bytes_transferred': bytes_transferred } <ide> return result_dict <ide> <ide> def _stream_data(self, response, iterator, chunked=False, <ide> else: <ide> response.connection.connection.send(chunk) <ide> except Exception: <del> # @@TR: this wildcard try/except block looks like it <del> # could mask unexpected errors. It should be narrowed <del> # down to expected exceptions. <del> <add> # TODO: let this exception propagate <ide> # Timeout, etc. <ide> return False, None, bytes_transferred <ide> <ide><path>libcloud/storage/drivers/cloudfiles.py <ide> def _put_object(self, container, object_name, upload_func, <ide> headers=headers, file_path=file_path, <ide> iterator=iterator) <ide> <del> response = result_dict['response'] <add> response = result_dict['response'].response <ide> bytes_transferred = result_dict['bytes_transferred'] <ide> <ide> if response.status == httplib.EXPECTATION_FAILED:
2
Python
Python
fix spelling of execution.
0a8abbfd64f6be245472808773bbde96bd0fb91f
<ide><path>airflow/executors/kubernetes_executor.py <ide> def clear_not_launched_queued_tasks(self, session=None) -> None: <ide> if pod_list.items: <ide> continue <ide> # Fallback to old style of using execution_date <del> kwargs['label_selector'] = dict_string + ',exectuion_date={}'.format( <add> kwargs['label_selector'] = dict_string + ',execution_date={}'.format( <ide> pod_generator.datetime_to_label_safe_datestring(task.execution_date) <ide> ) <ide> pod_list = self.kube_client.list_namespaced_pod(self.kube_config.kube_namespace, **kwargs)
1
Ruby
Ruby
add missing option on numbers helper
2ebed7a36e74ab4609d20152a09b69abf7b94397
<ide><path>actionview/lib/action_view/helpers/number_helper.rb <ide> def number_to_percentage(number, options = {}) <ide> # to ","). <ide> # * <tt>:separator</tt> - Sets the separator between the <ide> # fractional and integer digits (defaults to "."). <add> # * <tt>:delimiter_pattern</tt> - Sets a custom regular expression used for <add> # deriving the placement of delimiter. Helpful when using currency formats <add> # like INR. <ide> # * <tt>:raise</tt> - If true, raises +InvalidNumberError+ when <ide> # the argument is invalid. <ide> # <ide> def number_to_percentage(number, options = {}) <ide> # number_with_delimiter(98765432.98, delimiter: " ", separator: ",") <ide> # # => 98 765 432,98 <ide> # <add> # number_with_delimiter("123456.78", <add> # delimiter_pattern: /(\d+?)(?=(\d\d)+(\d)(?!\d))/) # => "1,23,456.78" <add> # <ide> # number_with_delimiter("112a", raise: true) # => raise InvalidNumberError <ide> def number_with_delimiter(number, options = {}) <ide> delegate_number_helper_method(:number_to_delimited, number, options)
1
Javascript
Javascript
fix docs generation
9965642ebc888bf7dbe735200f3bb68fa370c3fa
<ide><path>Libraries/Animated/src/AnimatedImplementation.js <ide> function createAnimatedComponent(Component: any): any { <ide> class AnimatedComponent extends React.Component { <ide> _component: any; <ide> _propsAnimated: AnimatedProps; <add> _setComponentRef: Function; <add> <add> constructor(props: Object) { <add> super(props); <add> this._setComponentRef = this._setComponentRef.bind(this); <add> } <ide> <ide> componentWillUnmount() { <ide> this._propsAnimated && this._propsAnimated.__detach(); <ide> function createAnimatedComponent(Component: any): any { <ide> ); <ide> } <ide> <del> _setComponentRef = c => { <add> _setComponentRef(c) { <ide> this._component = c; <ide> } <ide> }
1
Javascript
Javascript
update upgrade command with 0.26 breaking changes
e3bbd300f6eb93c6734976ae6de1219793e1b5ff
<ide><path>local-cli/upgrade/upgrade.js <ide> module.exports = function upgrade(args, config) { <ide> ); <ide> return Promise.resolve(); <ide> } <add> <add> if (semver.satisfies(v, '~0.26.0')) { <add> console.log( <add> chalk.yellow( <add> 'React Native 0.26 introduced some breaking changes to the native files on iOS. You can\n' + <add> 'perform them manually by checking the release notes or use \'rnpm\' to do it automatically.\n' + <add> 'Just run:\n' + <add> '\'npm install -g rnpm && npm install rnpm-plugin-upgrade@0.26 --save-dev\', then run \'rnpm upgrade\'' <add> ) <add> ); <add> } <ide> } else { <ide> console.log( <ide> chalk.yellow(
1
Python
Python
add tests for doc creation
2c118ab3a6b516fae87280dac69cb9c5d7caa5a9
<ide><path>spacy/tests/doc/test_creation.py <add>'''Test Doc sets up tokens correctly.''' <add>from __future__ import unicode_literals <add>import pytest <add> <add>from ...vocab import Vocab <add>from ...tokens.doc import Doc <add>from ...lemmatizerlookup import Lemmatizer <add> <add> <add>@pytest.fixture <add>def lemmatizer(): <add> return Lemmatizer({'dogs': 'dog', 'boxen': 'box', 'mice': 'mouse'}) <add> <add> <add>@pytest.fixture <add>def vocab(lemmatizer): <add> return Vocab(lemmatizer=lemmatizer) <add> <add> <add>def test_empty_doc(vocab): <add> doc = Doc(vocab) <add> assert len(doc) == 0 <add> <add> <add>def test_single_word(vocab): <add> doc = Doc(vocab, words=['a']) <add> assert doc.text == 'a ' <add> doc = Doc(vocab, words=['a'], spaces=[False]) <add> assert doc.text == 'a' <add> <add> <add>def test_lookup_lemmatization(vocab): <add> doc = Doc(vocab, words=['dogs', 'dogses']) <add> assert doc[0].text == 'dogs' <add> assert doc[0].lemma_ == 'dog' <add> assert doc[1].text == 'dogses' <add> assert doc[1].lemma_ == 'dogses'
1
Ruby
Ruby
use systemcommand.run instead of custom wrapper
5d606dd0a275446f00f31884ac042572f3a620ad
<ide><path>Library/Homebrew/cask/lib/hbc/caskroom.rb <ide> def migrate_caskroom_from_repo_to_prefix <ide> FileUtils.mv repo_caskroom, Hbc.caskroom <ide> else <ide> opoo "#{Hbc.caskroom.parent} is not writable, sudo is needed to move the Caskroom." <del> command "/bin/mv", repo_caskroom, Hbc.caskroom.parent, :use_sudo => true <add> SystemCommand.run("/bin/mv", :args => [repo_caskroom, Hbc.caskroom.parent], :sudo => true) <ide> end <ide> end <ide> <ide> def ensure_caskroom_exists <ide> <ide> ohai "Creating Caskroom at #{Hbc.caskroom}" <ide> ohai "We'll set permissions properly so we won't need sudo in the future" <del> use_sudo = !Hbc.caskroom.parent.writable? <add> sudo = !Hbc.caskroom.parent.writable? <ide> <del> command "/bin/mkdir", "-p", Hbc.caskroom, :use_sudo => use_sudo <del> command "/bin/chmod", "g+rwx", Hbc.caskroom, :use_sudo => use_sudo <del> command "/usr/sbin/chown", Utils.current_user, Hbc.caskroom, :use_sudo => use_sudo <del> command "/usr/bin/chgrp", "admin", Hbc.caskroom, :use_sudo => use_sudo <del> end <del> <del> def command(*args) <del> options = args.last.is_a?(Hash) ? args.pop : {} <del> <del> if options[:use_sudo] <del> args.unshift "/usr/bin/sudo" <del> end <del> <del> ohai args.join(" ") <del> system *args <add> SystemCommand.run("/bin/mkdir", :args => ["-p", Hbc.caskroom], :sudo => sudo) <add> SystemCommand.run("/bin/chmod", :args => ["g+rwx", Hbc.caskroom], :sudo => sudo) <add> SystemCommand.run("/usr/sbin/chown", :args => [Utils.current_user, Hbc.caskroom], :sudo => sudo) <add> SystemCommand.run("/usr/bin/chgrp", :args => ["admin", Hbc.caskroom], :sudo => sudo) <ide> end <ide> end <ide> end
1
Javascript
Javascript
clarify a test description
d077966ff1ac18262f4615ff1a533db24d4432a7
<ide><path>test/ng/directive/ngOptionsSpec.js <ide> describe('ngOptions', function() { <ide> expect(option.text()).toBe('is blank'); <ide> }); <ide> <del> it('should support option without a value attribute', function() { <add> it('should be ignored when it has no value attribute', function() { <add> // The option value is set to the textContent if there's no value attribute, <add> // so in that case it doesn't count as a blank option <ide> createSingleSelect('<option>--select--</option>'); <ide> scope.$apply(function() { <ide> scope.values = [{name: 'A'}, {name: 'B'}, {name: 'C'}];
1
Javascript
Javascript
add detailed message for assertion failure
2336df1b502d55261baf3ebd6e22c011c619b069
<ide><path>test/addons-napi/test_typedarray/test.js <ide> arrayTypes.forEach((currentType) => { <ide> const theArray = test_typedarray.CreateTypedArray(template, buffer); <ide> <ide> assert.ok(theArray instanceof currentType, <del> 'Type of new array should match that of the template'); <add> 'Type of new array should match that of the template. ' + <add> `Expected type: ${currentType.name}, ` + <add> `actual type: ${template.constructor.name}`); <ide> assert.notStrictEqual(theArray, template); <ide> assert.strictEqual(theArray.buffer, buffer); <ide> });
1
Ruby
Ruby
fix callbacks on actionpack
af5b12c64c878f08336d38e91cc64137a30fb8da
<ide><path>actionpack/lib/abstract_controller/callbacks.rb <ide> module Callbacks <ide> include ActiveSupport::NewCallbacks <ide> <ide> included do <del> define_callbacks :process_action, "response_body" <add> define_callbacks :process_action, :terminator => "response_body" <ide> end <ide> <ide> # Override AbstractController::Base's process_action to run the
1
Text
Text
add smap energy to list of companies using airflow
6dc474fc82aa9325081b0c5f2b92c948e2f16f74
<ide><path>INTHEWILD.md <ide> Currently, **officially** using Airflow: <ide> 1. [Simply Business](https://www.simplybusiness.com/) [[@simplybusiness](https://github.com/simplybusiness)] <ide> 1. [Skai](https://www.skai.io/) [[@kenshoo](https://github.com/kenshoo)] <ide> 1. [Skyscanner](https://www.skyscanner.net/) [[@skyscanner](https://github.com/Skyscanner)] <add>1. [SMAP Energy Ltd.](https://smapenergy.com) [[@camenergydatalab](https://github.com/camenergydatalab)] <ide> 1. [SmartNews](https://www.smartnews.com/) [[@takus](https://github.com/takus)] <ide> 1. [SnapTravel](https://www.snaptravel.com/) <ide> 1. [SocialCops](https://www.socialcops.com/) [[@vinayak-mehta](https://github.com/vinayak-mehta) & [@sharky93](https://github.com/sharky93)]
1
PHP
PHP
fix failing test, caused by postgres ordering
97f48dcdb35b407d6af86348345ebfd217cd8678
<ide><path>lib/Cake/Test/Case/Model/ModelWriteTest.php <ide> public function testSaveManyTransaction() { <ide> <ide> $result = $TestModel->find('all', array( <ide> 'recursive' => -1, <del> 'fields' => array('author_id', 'title','body','published') <add> 'fields' => array('author_id', 'title','body','published'), <add> 'order' => array('Post.created' => 'ASC') <ide> )); <ide> <ide> $expected = array(
1