hash
stringlengths
40
40
diff
stringlengths
131
26.7k
message
stringlengths
7
694
project
stringlengths
5
67
split
stringclasses
1 value
diff_languages
stringlengths
2
24
224be6d120e4ec9e81ae6cfeaee74785c68bd4f6
diff --git a/lib/branch_io_cli/command/report_command.rb b/lib/branch_io_cli/command/report_command.rb index <HASH>..<HASH> 100644 --- a/lib/branch_io_cli/command/report_command.rb +++ b/lib/branch_io_cli/command/report_command.rb @@ -294,16 +294,9 @@ EOF # String containing information relevant to Branch setup def branch_report - bundle_identifier = helper.expanded_build_setting config.target, "PRODUCT_BUNDLE_IDENTIFIER", config.configuration - dev_team = helper.expanded_build_setting config.target, "DEVELOPMENT_TEAM", config.configuration infoplist_path = helper.expanded_build_setting config.target, "INFOPLIST_FILE", config.configuration - entitlements_path = helper.expanded_build_setting config.target, "CODE_SIGN_ENTITLEMENTS", config.configuration report = "Branch configuration:\n" - report += " PRODUCT_BUNDLE_IDENTIFIER = #{bundle_identifier.inspect}\n" - report += " DEVELOPMENT_TEAM = #{dev_team.inspect}\n" - report += " INFOPLIST_PATH = #{infoplist_path.inspect}\n" - report += " CODE_SIGN_ENTITLEMENTS = #{entitlements_path.inspect}\n" begin info_plist = File.open(infoplist_path) { |f| Plist.parse_xml f }
Removed some things from the Branch report
BranchMetrics_branch_io_cli
train
rb
2ea14349ce87a7353ca77d5501ce571b552c17ae
diff --git a/lib/launchy/application.rb b/lib/launchy/application.rb index <HASH>..<HASH> 100644 --- a/lib/launchy/application.rb +++ b/lib/launchy/application.rb @@ -148,14 +148,11 @@ module Launchy if my_os_family == :windows then # NOTE: the command is purposely omitted here because - # running the filename via "cmd /c" is the same as - # running "start filename" at the command-prompt - # - # furthermore, when "cmd /c start filename" is + # When "cmd /c start filename" is # run, the shell interprets it as two commands: # (1) "start" opens a new terminal, and (2) # "filename" causes the file to be launched. - system 'cmd', '/c', *args + system 'cmd', '/c', cmd, *args else # fork, and the child process should NOT run any exit handlers child_pid = fork do
Fixed a bug in launching a browser in Windows
copiousfreetime_launchy
train
rb
431dc2c6b0ad17b2bbc9aca2fc03f4b065f1fdd8
diff --git a/lib/picker.js b/lib/picker.js index <HASH>..<HASH> 100644 --- a/lib/picker.js +++ b/lib/picker.js @@ -274,7 +274,9 @@ function PickerConstructor( ELEMENT, NAME, COMPONENT, OPTIONS ) { // * In Firefox stopPropagation() doesn’t prevent right-click events from bubbling, // which causes the picker to unexpectedly close when right-clicking it. So make // sure the event wasn’t a right-click. - if ( target != ELEMENT && target != document && event.which != 3 ) { + // * In Chrome 62 and up, password autofill causes a simulated focusin event which + // closes the picker. + if ( ! event.isSimulated && target != ELEMENT && target != document && event.which != 3 ) { // If the target was the holder that covers the screen, // keep the element focused to maintain tabindex.
Prevent Chrome <I> autofill from closing the picker Closes #<I> Thanks go to @Mwni for finding a solution
amsul_pickadate.js
train
js
70ce862955852c8de6fbb152db869d72d81bc394
diff --git a/pkg/registry/service/rest_test.go b/pkg/registry/service/rest_test.go index <HASH>..<HASH> 100644 --- a/pkg/registry/service/rest_test.go +++ b/pkg/registry/service/rest_test.go @@ -569,6 +569,7 @@ func TestServiceRegistryIPAllocation(t *testing.T) { for _, ip := range testIPs { if !rest.serviceIPs.(*ipallocator.Range).Has(net.ParseIP(ip)) { testIP = ip + break } } @@ -687,9 +688,18 @@ func TestServiceRegistryIPUpdate(t *testing.T) { t.Errorf("Expected port 6503, but got %v", updated_service.Spec.Ports[0].Port) } + testIPs := []string{"1.2.3.93", "1.2.3.94", "1.2.3.95", "1.2.3.96"} + testIP := "" + for _, ip := range testIPs { + if !rest.serviceIPs.(*ipallocator.Range).Has(net.ParseIP(ip)) { + testIP = ip + break + } + } + update = deepCloneService(created_service) update.Spec.Ports[0].Port = 6503 - update.Spec.ClusterIP = "1.2.3.76" // error + update.Spec.ClusterIP = testIP // Error: Cluster IP is immutable _, _, err := rest.Update(ctx, update) if err == nil || !errors.IsInvalid(err) {
Fix the issue which TestServiceRegistryIPUpdate will randomly run failed.
kubernetes_kubernetes
train
go
faff4e211330bca572bdcd5265aac750051e33af
diff --git a/lib/active_mocker/display_errors.rb b/lib/active_mocker/display_errors.rb index <HASH>..<HASH> 100644 --- a/lib/active_mocker/display_errors.rb +++ b/lib/active_mocker/display_errors.rb @@ -68,12 +68,3 @@ module ActiveMocker end end end - -class String - def colorize(*args) - require "colorize" - super(*args) - rescue LoadError - self - end -end
Remove hack for String#colorize that would cause the error: "NoMethodError: super: no superclass method `colorize' for #<String>"
zeisler_active_mocker
train
rb
d82374f6881fb5a12b1056972d5ad70f358b8598
diff --git a/go/test/endtoend/vtgate/queries/union/main_test.go b/go/test/endtoend/vtgate/queries/union/main_test.go index <HASH>..<HASH> 100644 --- a/go/test/endtoend/vtgate/queries/union/main_test.go +++ b/go/test/endtoend/vtgate/queries/union/main_test.go @@ -28,8 +28,8 @@ import ( var ( clusterInstance *cluster.LocalProcessCluster vtParams mysql.ConnParams - KeyspaceName = "ks" - Cell = "test" + KeyspaceName = "ks_union" + Cell = "test_union" SchemaSQL = `create table t1( id1 bigint, id2 bigint, @@ -156,11 +156,6 @@ func TestMain(m *testing.M) { return 1 } - err = clusterInstance.VtctlclientProcess.ExecuteCommand("RebuildVSchemaGraph") - if err != nil { - return 1 - } - clusterInstance.VtGateExtraArgs = append(clusterInstance.VtGateExtraArgs, "-enable_system_settings=true") // Start vtgate err = clusterInstance.StartVtgate()
Removed build keyspace graph from union main test
vitessio_vitess
train
go
d3bc0ad0f1a8aebd5d39485e5ad8f9379767558a
diff --git a/config/configuration.js b/config/configuration.js index <HASH>..<HASH> 100644 --- a/config/configuration.js +++ b/config/configuration.js @@ -7,7 +7,7 @@ var node_env = process.env.NODE_ENV || "development"; var default_port = 8000; var default_tika_version = '1.4'; -var default_tika_path = "/etc/tika-" + default_tika_version; +var default_tika_path = "/etc/tika-" + default_tika_version + "tika-app-" + default_tika_version + ".jar"; if(node_env === "production") { default_port = 80;
Updated default tika_path
AnyFetch_anyfetch-hydrater.js
train
js
b81555beeac8eda71e8150cc9d63631aaa756965
diff --git a/infrastructure.go b/infrastructure.go index <HASH>..<HASH> 100644 --- a/infrastructure.go +++ b/infrastructure.go @@ -1211,8 +1211,6 @@ func New(config *ConnConfig, ntfnHandlers *NotificationHandlers) (*Client, error start = true } } - log.Infof("Established connection to RPC server %s", - config.Host) client := &Client{ config: config, @@ -1230,6 +1228,8 @@ func New(config *ConnConfig, ntfnHandlers *NotificationHandlers) (*Client, error } if start { + log.Infof("Established connection to RPC server %s", + config.Host) close(connEstablished) client.start() if !client.config.HTTPPostMode && !client.config.DisableAutoReconnect { @@ -1282,6 +1282,8 @@ func (c *Client) Connect(tries int) error { // Connection was established. Set the websocket connection // member of the client and start the goroutines necessary // to run the client. + log.Infof("Established connection to RPC server %s", + c.config.Host) c.wsConn = wsConn close(c.connEstablished) c.start()
Fix "Established connection" log message. Don't log "Established connection" message on new when DisableConnectOnNew is set and no connection was actually established. Do log that same message when Connect() successfully connects.
btcsuite_btcd
train
go
985b2b1ff34c860cc1ae34bff62d5f809cf2bc99
diff --git a/lib/celerity/element_locator.rb b/lib/celerity/element_locator.rb index <HASH>..<HASH> 100644 --- a/lib/celerity/element_locator.rb +++ b/lib/celerity/element_locator.rb @@ -77,13 +77,13 @@ module Celerity def find_by_id(what) case what when Regexp - elements_by_tag_names.find { |elem| elem.getIdAttribute =~ what } + elements_by_tag_names.find { |elem| elem.getId =~ what } when String obj = @object.getHtmlElementById(what) return obj if @tags.include?(obj.getTagName) $stderr.puts "warning: multiple elements with identical id? (#{what.inspect})" if $VERBOSE - elements_by_tag_names.find { |elem| elem.getIdAttribute == what } + elements_by_tag_names.find { |elem| elem.getId == what } else raise TypeError, "expected String or Regexp, got #{what.inspect}:#{what.class}" end
Fix spec failure when locating elements by id (caused by <I> API changes)
jarib_celerity
train
rb
512bfc4305a7607f63514dc734663c973ed954b2
diff --git a/tests/func/experiments/test_queue.py b/tests/func/experiments/test_queue.py index <HASH>..<HASH> 100644 --- a/tests/func/experiments/test_queue.py +++ b/tests/func/experiments/test_queue.py @@ -42,6 +42,7 @@ def failed_tasks(tmp_dir, dvc, scm, test_queue, failed_exp_stage): return name_list +@pytest.mark.xfail(strict=False, reason="pytest-celery flaky") @pytest.mark.parametrize("follow", [True, False]) def test_celery_logs( tmp_dir, @@ -64,7 +65,7 @@ def test_celery_logs( assert "failed to reproduce 'failed-copy-file'" in captured.out -@pytest.mark.flaky(max_runs=3, min_passes=1) +@pytest.mark.xfail(strict=False, reason="pytest-celery flaky") def test_queue_remove_done(dvc, failed_tasks, success_tasks): assert len(dvc.experiments.celery_queue.failed_stash) == 3 status = to_dict(dvc.experiments.celery_queue.status())
tests: mark exp queue func tests xfail (#<I>)
iterative_dvc
train
py
f0978e9dc2a3d70e0577285adfb8f24a1ba99a3c
diff --git a/src/java/liquibase/ext/mssql/change/LoadDataChangeMSSQL.java b/src/java/liquibase/ext/mssql/change/LoadDataChangeMSSQL.java index <HASH>..<HASH> 100644 --- a/src/java/liquibase/ext/mssql/change/LoadDataChangeMSSQL.java +++ b/src/java/liquibase/ext/mssql/change/LoadDataChangeMSSQL.java @@ -10,7 +10,7 @@ import liquibase.ext.mssql.statement.InsertStatementMSSQL; import liquibase.statement.SqlStatement; import liquibase.statement.core.InsertStatement; -@DatabaseChange(name = "loadData", description = "Load Data", priority = ChangeMetaData.PRIORITY_DEFAULT, appliesTo = "table") +@DatabaseChange(name = "loadData", description = "Load Data", priority = ChangeMetaData.PRIORITY_DATABASE, appliesTo = "table") public class LoadDataChangeMSSQL extends liquibase.change.core.LoadDataChange { private Boolean identityInsertEnabled;
bugfix: increased LoadDataChangeMSSQL priority
sabomichal_liquibase-mssql
train
java
6cdebe48f2934002de6e55a49a2d4f2303a0517f
diff --git a/src/Ups.php b/src/Ups.php index <HASH>..<HASH> 100644 --- a/src/Ups.php +++ b/src/Ups.php @@ -139,7 +139,11 @@ abstract class Ups implements LoggerAwareInterface $accessRequest->appendChild($xml->createElement('AccessLicenseNumber', $this->accessKey)); $accessRequest->appendChild($xml->createElement('UserId', $this->userId)); - $accessRequest->appendChild($xml->createElement('Password', $this->password)); + //$accessRequest->appendChild($xml->createElement('Password')); + // $accessRequest->appendChild($xml->createTextNode($this->password)); + + $p = $accessRequest->appendChild($xml->createElement('Password')); + $p->appendChild($xml->createTextNode($this->password)); return $xml->saveXML(); }
Fixed issue with passwords contains !
gabrielbull_php-ups-api
train
php
6ee24140e50cc55cd05f68e833929ad00ff04326
diff --git a/test/HTMLCollection.test.php b/test/HTMLCollection.test.php index <HASH>..<HASH> 100644 --- a/test/HTMLCollection.test.php +++ b/test/HTMLCollection.test.php @@ -20,4 +20,14 @@ public function testNonElementsRemoved() { $this->assertInstanceOf("\phpgt\dom\Element", $bodyChildren->item(0)); } +public function testFormsPropertyWhenNoForms() { + $documentWithout = new HTMLDocument(test\Helper::HTML); + $this->assertEquals(0, $documentWithout->forms->length); +} + +public function testFormsPropertyWhenForms() { + $documentWith = new HTMLDocument(test\Helper::HTML_MORE); + $this->assertEquals(2, $documentWith->forms->length); +} + }# \ No newline at end of file diff --git a/test/Helper.php b/test/Helper.php index <HASH>..<HASH> 100644 --- a/test/Helper.php +++ b/test/Helper.php @@ -21,6 +21,13 @@ const HTML_MORE = <<<HTML <a href="https://twitter.com/g105b">Greg Bowler</a> started this project to bring modern DOM techniques to the server side. </p> + <form> + <input name="fieldA" type="text"> + <button type="submit">Submit</button> + </form> + <form> + <input name="fieldB" type="text"> + </form> </body> HTML;
Add tests for HTMLDocument->forms property
PhpGt_Dom
train
php,php
5b3b823e1b16d79f4990dc124aec4de1e7ee8819
diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/RxDocumentClientImpl.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/RxDocumentClientImpl.java index <HASH>..<HASH> 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/RxDocumentClientImpl.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/RxDocumentClientImpl.java @@ -467,7 +467,6 @@ public class RxDocumentClientImpl implements AsyncDocumentClient, IAuthorization } else { this.initializeDirectConnectivity(); } - this.queryPlanCache = new ConcurrentHashMap<>(); this.retryPolicy.setRxCollectionCache(this.collectionCache); } catch (Exception e) { logger.error("unexpected failure in initializing client.", e);
Fix query plan cache initialization (#<I>) * Fix query plan cache initialization * Update sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/RxDocumentClientImpl.java Removing the cache intialization from init method.
Azure_azure-sdk-for-java
train
java
c5b2fb0e8f2d5169d77a65dc64e89a901c54645b
diff --git a/vendor/seahorse/spec/seahorse/client/configuration_spec.rb b/vendor/seahorse/spec/seahorse/client/configuration_spec.rb index <HASH>..<HASH> 100644 --- a/vendor/seahorse/spec/seahorse/client/configuration_spec.rb +++ b/vendor/seahorse/spec/seahorse/client/configuration_spec.rb @@ -103,6 +103,19 @@ module Seahorse expect(config.build!.proc).to be(value) end + it 'resolves defaults in LIFO order until a non-nil value is found' do + # default cost is 10 + config.add_option(:cost) { 10 } + + # increase cost for red items + config.add_option(:cost) { |cfg| cfg.color == 'red' ? 9001 : nil } + + config.add_option(:color) + + expect(config.build!(color: 'green').cost).to eq(10) + expect(config.build!(color: 'red').cost).to eq(9001) # over 9000! + end + end end end
Added a spec for ensuring default configuration values resolve until a non-nil value is found.
aws_aws-sdk-ruby
train
rb
e27354865b8a79e386377c3078993298fa689da1
diff --git a/Malmo/samples/Python_examples/tabular_q_learning.py b/Malmo/samples/Python_examples/tabular_q_learning.py index <HASH>..<HASH> 100755 --- a/Malmo/samples/Python_examples/tabular_q_learning.py +++ b/Malmo/samples/Python_examples/tabular_q_learning.py @@ -126,7 +126,9 @@ class TabQAgent: world_state = agent_host.peekWorldState() while world_state.is_mission_running and all(e.text=='{}' for e in world_state.observations): world_state = agent_host.peekWorldState() - world_state = agent_host.getWorldState() + world_state = agent_host.getWorldState() + for err in world_state.errors: + print err if not world_state.is_mission_running: return 0 # mission already ended @@ -158,6 +160,8 @@ class TabQAgent: break world_state = agent_host.getWorldState() + for err in world_state.errors: + print err current_r = sum(r.getValue() for r in world_state.rewards) if world_state.is_mission_running:
Minor: printing any errors received is good practice.
Microsoft_malmo
train
py
328866e899b794880b94cc894f7ec2ebc0688ab9
diff --git a/spec/researches/fleschReadingSpec.js b/spec/researches/fleschReadingSpec.js index <HASH>..<HASH> 100644 --- a/spec/researches/fleschReadingSpec.js +++ b/spec/researches/fleschReadingSpec.js @@ -7,7 +7,6 @@ describe("a test to calculate the fleschReading score", function(){ var mockPaper = new Paper( "A piece of text to calculate scores." ); expect( fleschFunction( mockPaper ) ).toBe( 78.9 ); -// todo This spec is currently disabled, because the fleschreading still runs a cleantext, that removes capitals. This is fixed in #496 of YoastSEO mockPaper = new Paper( "One question we get quite often in our website reviews is whether we can help people recover from the drop they noticed in their rankings or traffic. A lot of the times, this is a legitimate drop and people were actually in a bit of trouble" ); expect( fleschFunction( mockPaper )).toBe( 63.9 );
Removes todo from spec
Yoast_YoastSEO.js
train
js
d5a6a3ba63f1f03139b41db22dba3099b4ec63e3
diff --git a/openid/consumer/consumer.py b/openid/consumer/consumer.py index <HASH>..<HASH> 100644 --- a/openid/consumer/consumer.py +++ b/openid/consumer/consumer.py @@ -446,10 +446,12 @@ class GenericConsumer(object): (identity_url, delegate, server_url) = pieces - if yadis_available and xri.identifierScheme(identity_url) == 'XRI': + if (identity_url and yadis_available + and xri.identifierScheme(identity_url) == 'XRI'): identity_url = unicode(identity_url, 'utf-8') - if yadis_available and xri.identifierScheme(delegate) == 'XRI': + if (delegate and yadis_available + and xri.identifierScheme(delegate) == 'XRI'): delegate = unicode(delegate, 'utf-8') if mode == 'cancel':
[project @ Handle error conditions better in complete.]
openid_python-openid
train
py
a25bd605218c0a7c26a2ab8120499db81fe8b1c2
diff --git a/Repository/ResourceQueryBuilder.php b/Repository/ResourceQueryBuilder.php index <HASH>..<HASH> 100644 --- a/Repository/ResourceQueryBuilder.php +++ b/Repository/ResourceQueryBuilder.php @@ -399,10 +399,10 @@ class ResourceQueryBuilder /** * Filters nodes that are published. * - * @param $user + * @param $user (not typing because we don't want anon. to crash everything) * @return ResourceQueryBuilder */ - public function whereIsAccessible(UserInterface $user) + public function whereIsAccessible($user) { $currentDate = new \DateTime(); $clause = '(
[CoreBundle] Fixing view as for resource manager.
claroline_Distribution
train
php
c7578896036bc07bb1edc2d79f699968c25ca89e
diff --git a/bika/lims/upgrade/to1117.py b/bika/lims/upgrade/to1117.py index <HASH>..<HASH> 100644 --- a/bika/lims/upgrade/to1117.py +++ b/bika/lims/upgrade/to1117.py @@ -9,4 +9,5 @@ def upgrade(tool): portal = aq_parent(aq_inner(tool)) setup = portal.portal_setup - setup.runImportStepFromProfile('profile-bika.lims:default', 'portlets') + setup.runImportStepFromProfile('profile-bika.lims:default', 'portlets', + run_dependencies=False)
Upgrade <I> - add run_dependencies=False Somehow re-importing the 'portlets' step, causes a beforeDelete handler to fail a HoldingReference check.
senaite_senaite.core
train
py
c6ae37cdb4345946b87d163d3d28fc20083ea21c
diff --git a/src/Illuminate/Support/helpers.php b/src/Illuminate/Support/helpers.php index <HASH>..<HASH> 100755 --- a/src/Illuminate/Support/helpers.php +++ b/src/Illuminate/Support/helpers.php @@ -476,18 +476,23 @@ if ( ! function_exists('env')) { $value = getenv($key); - switch (strtolower($value)) { + switch (strtolower($value)) + { case 'true': case '(true)': return true; + case 'false': case '(false)': return false; + case '(null)': return null; + case '(empty)': return ''; } + return $value; } }
Fixing a few formatting things.
laravel_framework
train
php
3662bb512c967d222457318f7e3231eef725c27e
diff --git a/test/daemon_runner/shell_out_test.rb b/test/daemon_runner/shell_out_test.rb index <HASH>..<HASH> 100644 --- a/test/daemon_runner/shell_out_test.rb +++ b/test/daemon_runner/shell_out_test.rb @@ -94,7 +94,7 @@ class ShellOutTest < Minitest::Test assert_equal [1], shellout.valid_exit_codes end - def test_returns_nil_if_waiting_without_child_process + def test_wait2_returns_nil_if_waiting_without_child_process wait2 = lambda { |pid, flags| raise Errno::ECHILD } Process.stub :wait2, wait2 do @@ -103,7 +103,7 @@ class ShellOutTest < Minitest::Test end end - def test_returns_nil_if_pid_is_not_provided + def test_wait2_returns_nil_if_pid_is_not_provided result = ::DaemonRunner::ShellOut.wait2 assert_equal nil, result end
Provide better test names for wait2 tests.
rapid7_daemon_runner
train
rb
c4366124c7e600800d48ce47b3a3b856b33c489a
diff --git a/lib/Doctrine/ORM/Persisters/ManyToManyPersister.php b/lib/Doctrine/ORM/Persisters/ManyToManyPersister.php index <HASH>..<HASH> 100644 --- a/lib/Doctrine/ORM/Persisters/ManyToManyPersister.php +++ b/lib/Doctrine/ORM/Persisters/ManyToManyPersister.php @@ -289,8 +289,9 @@ class ManyToManyPersister extends AbstractCollectionPersister } } - $sql = implode(' AND ', $filterClauses); - return $sql ? '(' . $sql . ')' : ''; + return $filterClauses + ? '(' . implode(' AND ', $filterClauses) . ')' + : ''; } /**
#<I> DDC-<I> - removed unused assignment, direct return instead
doctrine_orm
train
php
11ef853745335cf6302fe51565ecf3b2a159fd3e
diff --git a/test/test.js b/test/test.js index <HASH>..<HASH> 100644 --- a/test/test.js +++ b/test/test.js @@ -551,6 +551,22 @@ describe('S3rver Tests', function () { }); }); + + it('should list objects in a bucket filtered by a prefix 2', function (done) { + s3Client.listObjectsV2({ 'Bucket': buckets[1], Prefix: 'key' }, function (err, objects) { + if (err) { + return done(err) + } + should(objects.Contents.length).equal(4); + should.exist(_.find(objects.Contents, {'Key': 'key1'})); + should.exist(_.find(objects.Contents, {'Key': 'key2'})); + should.exist(_.find(objects.Contents, {'Key': 'key3'})); + should.exist(_.find(objects.Contents, {'Key': 'key/key1'})); + done(); + }) + }) + + it('should list objects in a bucket filtered by a marker', function (done) { s3Client.listObjects({'Bucket': buckets[1], Marker: 'akey3'}, function (err, objects) { if (err) {
test(listObjects): Adds test for issue #<I>
jamhall_s3rver
train
js
167b5ad00c4aca087e56d91663fbf12700958ad4
diff --git a/terms/html.py b/terms/html.py index <HASH>..<HASH> 100644 --- a/terms/html.py +++ b/terms/html.py @@ -73,8 +73,8 @@ def get_interesting_contents(parent_node, replace_regexp): if TERMS_ENABLED: - def replace_terms(html): - html = force_text(html) + def replace_terms(original_html): + html = force_text(original_html) if not html: return html remove_body = False @@ -93,7 +93,12 @@ if TERMS_ENABLED: replace_regexp__sub = replace_regexp.sub translate = get_translate_function(replace_dict, variants_dict) - for node in get_interesting_contents(root_node, replace_regexp): + interesting_contents = list(get_interesting_contents(root_node, + replace_regexp)) + if not interesting_contents: + return original_html + + for node in interesting_contents: new_content = replace_regexp__sub( translate, tostring(node, encoding='unicode')) new_node = parse(StringIO(new_content)).getroot().getchildren()[0]
If nothing interesting is found, return the original HTML instead of rebuilding it.
BertrandBordage_django-terms
train
py
a1830793ee5ccf6a87c832329718d080ed39865e
diff --git a/storage/src/main/java/de/citec/jul/storage/registry/Registry.java b/storage/src/main/java/de/citec/jul/storage/registry/Registry.java index <HASH>..<HASH> 100644 --- a/storage/src/main/java/de/citec/jul/storage/registry/Registry.java +++ b/storage/src/main/java/de/citec/jul/storage/registry/Registry.java @@ -159,7 +159,7 @@ public class Registry<KEY, VALUE extends Identifiable<KEY>> extends Observable<M synchronized (SYNC) { int interationCounter = 0; boolean valid = false; - while (!valid) { + while (!valid && !consistencyHandlerList.isEmpty()) { for (ConsistencyHandler consistencyHandler : consistencyHandlerList) { try { valid &= !consistencyHandler.processData(registry, this);
handle wrong consistency handling in case no handler is registered.
openbase_jul
train
java
5dc676bea721e29c449b30a67c3718c8efc08373
diff --git a/escpos/config.py b/escpos/config.py index <HASH>..<HASH> 100644 --- a/escpos/config.py +++ b/escpos/config.py @@ -27,8 +27,7 @@ class Config(object): ) try: - with open(config_path) as f: - config = yaml.load(f) + config = yaml.safe_load(f) except EnvironmentError as e: raise exceptions.ConfigNotFoundError('Couldn\'t read config at one or more of {config_path}'.format( config_path="\n".join(config_path),
Convert to safe load. Also now allows loading everyting pyyaml supports
python-escpos_python-escpos
train
py
7f8f1ad4e3e7b3eb93ec0cf11cf7cb02a947f293
diff --git a/cmd/daily-lifecycle-ops.go b/cmd/daily-lifecycle-ops.go index <HASH>..<HASH> 100644 --- a/cmd/daily-lifecycle-ops.go +++ b/cmd/daily-lifecycle-ops.go @@ -44,22 +44,12 @@ func startDailyLifecycle(ctx context.Context, objAPI ObjectLayer) { return case <-time.NewTimer(bgLifecycleInterval).C: // Perform one lifecycle operation - err := lifecycleRound(ctx, objAPI) - switch err.(type) { - case OperationTimedOut: - // Unable to hold a lock means there is another - // caller holding write lock, ignore and try next round. - continue - default: - logger.LogIf(ctx, err) - } + logger.LogIf(ctx, lifecycleRound(ctx, objAPI)) } } } -var lifecycleLockTimeout = newDynamicTimeout(60*time.Second, time.Second) - func lifecycleRound(ctx context.Context, objAPI ObjectLayer) error { buckets, err := objAPI.ListBuckets(ctx) if err != nil {
fix: cleanup lifecycle unused code (#<I>)
minio_minio
train
go
e2565e66c6f4b7955bafb6faa4d2b2766e3b56b4
diff --git a/Zebra_Database.php b/Zebra_Database.php index <HASH>..<HASH> 100644 --- a/Zebra_Database.php +++ b/Zebra_Database.php @@ -633,6 +633,8 @@ class Zebra_Database 'user' => $user, 'password' => $password, 'database' => $database, + 'port' => $port == '' ? ini_get('mysqli.default_port') : $port, + 'socket' => $socket == '' ? ini_get('mysqli.default_socket') : $socket, ); // connect now, if we need to connect right away @@ -4184,7 +4186,9 @@ class Zebra_Database $this->credentials['host'], $this->credentials['user'], $this->credentials['password'], - $this->credentials['database'] + $this->credentials['database'], + $this->credentials['port'], + $this->credentials['socket'] ); // tries to connect to the MySQL database
Fixed port and socket not used even if set Thanks to Nam Trung for reporting
stefangabos_Zebra_Database
train
php
c5ad9d6fdb3ec8880658fef5c0c905dcda399ddd
diff --git a/lib/minify.js b/lib/minify.js index <HASH>..<HASH> 100644 --- a/lib/minify.js +++ b/lib/minify.js @@ -30,10 +30,10 @@ function check(name, callback) { if (!name) - throw(Error('name could not be empty!')); + throw Error('name could not be empty!'); if (typeof callback !== 'function') - throw(Error('callback should be function!')); + throw Error('callback should be function!'); } function minify(name, options, callback) {
chore(minify) throw() -> throw
coderaiser_minify
train
js
04258d28f5eb57d2f769eb3b2b3db35aeb4e139d
diff --git a/tests/asm/test_risks.py b/tests/asm/test_risks.py index <HASH>..<HASH> 100644 --- a/tests/asm/test_risks.py +++ b/tests/asm/test_risks.py @@ -125,7 +125,7 @@ TEST_RISK_TYPE_JSON = { "type": "string", } TEST_RISK_TYPES_JSON = { - "constants": [TEST_RISK_TYPE_JSON], + "type": [TEST_RISK_TYPE_JSON], } TEST_PATCH_RISK_TYPE_JSON = { "changes": 0,
fix:update language to match pipeline/discover
censys_censys-python
train
py
b1060c903e6d5a4d101113911dd48da5f13b056a
diff --git a/demo/http.php b/demo/http.php index <HASH>..<HASH> 100644 --- a/demo/http.php +++ b/demo/http.php @@ -6,4 +6,24 @@ if (isset($_GET['sleep'])) { sleep(10); } +if (isset($_GET['img'])) { + $fp = fopen(__DIR__ . '/../website/template/img/logo-small.png', 'rb'); + header('Content-Type: image/png'); + header('Content-Length: ' . filesize(__DIR__ . '/logo.png')); + fpassthru($fp); + exit(0); +} + +if (isset($_GET['json'])) { + header('Content-Type: application/json'); + echo json_encode(['Hello' => '🌍']); + exit(0); +} + +if (isset($_GET['weird'])) { + header('Content-Type: foo/bar'); + echo 'Hello 🌍'; + exit(0); +} + echo 'Hello world!';
Add cases to manually test #<I>
mnapoli_bref
train
php
0efd1925bff45f8721c63ee13266efb21412a8dc
diff --git a/gui/src/main/java/org/jboss/as/console/client/domain/model/impl/HostInfoStoreImpl.java b/gui/src/main/java/org/jboss/as/console/client/domain/model/impl/HostInfoStoreImpl.java index <HASH>..<HASH> 100644 --- a/gui/src/main/java/org/jboss/as/console/client/domain/model/impl/HostInfoStoreImpl.java +++ b/gui/src/main/java/org/jboss/as/console/client/domain/model/impl/HostInfoStoreImpl.java @@ -329,7 +329,7 @@ public class HostInfoStoreImpl implements HostInformationStore { numRequests++; - dispatcher.execute(new DMRAction(operation), new SimpleCallback<DMRResponse>() { + dispatcher.execute(new DMRAction(operation, false), new SimpleCallback<DMRResponse>() { @Override
don't use caching when fetching server instances
hal_core
train
java
41fd4b8f52a5ec2a3e3a754f3ba7f1321fb60e02
diff --git a/Core/Listener/PackageInstalledListener.php b/Core/Listener/PackageInstalledListener.php index <HASH>..<HASH> 100644 --- a/Core/Listener/PackageInstalledListener.php +++ b/Core/Listener/PackageInstalledListener.php @@ -28,13 +28,14 @@ use Symfony\Component\Process\Process; class PackageInstalledListener { public function onPackageInstalled(PackageInstalledEvent $event) - { + { chdir(__DIR__ . '/../../'); $process = new Process('git submodule init'); $process->run(); $process = new Process('git submodule update'); - $process->run(); + $res = $process->run(); + if($res === 0) $event->setSuccess (true); } }
Valorized the event listener success param, according with the operation result
alphalemon_ElFinderBundle
train
php
18847575d5b6afefa98356489dde278895b711b0
diff --git a/src/zgor/ZSprite.js b/src/zgor/ZSprite.js index <HASH>..<HASH> 100644 --- a/src/zgor/ZSprite.js +++ b/src/zgor/ZSprite.js @@ -390,36 +390,6 @@ zgor.ZSprite.prototype.getElement = function() }; /** - * @override - * @public - */ -zgor.ZSprite.prototype.onAddedToStage = function() -{ - // inherited from interface -}; - -/** - * @override - * @public - */ -zgor.ZSprite.prototype.onRemovedFromStage = function() -{ - // inherited from interface -}; - -/** - * @public - * @param {boolean} aValue whether to use event bubbling - */ -zgor.ZSprite.prototype.setEventBubbling = function( aValue ) -{ - this._useEventBubbling = aValue; - - // will update event bubbling status in case Sprite has a parent container - this.setParent( this._parent, this._useEventBubbling ); -}; - -/** * set a reference to the parent sprite containing this one * * @override
removed rudimentary event methods from zSprite
igorski_zCanvas
train
js
d7c549d2e42de8498a021500857cbbd48b0c3ea4
diff --git a/torrent.go b/torrent.go index <HASH>..<HASH> 100644 --- a/torrent.go +++ b/torrent.go @@ -387,6 +387,8 @@ func (t *Torrent) cacheLength() { t.length = &l } +// TODO: This shouldn't fail for storage reasons. Instead we should handle storage failure +// separately. func (t *Torrent) setInfo(info *metainfo.Info) error { if err := validateInfo(info); err != nil { return fmt.Errorf("bad info: %s", err) @@ -1193,8 +1195,9 @@ func (t *Torrent) readAt(b []byte, off int64) (n int, err error) { return } -// Returns an error if the metadata was completed, but couldn't be set for -// some reason. Blame it on the last peer to contribute. +// Returns an error if the metadata was completed, but couldn't be set for some reason. Blame it on +// the last peer to contribute. TODO: Actually we shouldn't blame peers for failure to open storage +// etc. Also we should probably cached metadata pieces per-Peer, to isolate failure appropriately. func (t *Torrent) maybeCompleteMetadata() error { if t.haveInfo() { // Nothing to do.
Add TODOs around setting info bytes
anacrolix_torrent
train
go
1d81c1998ed4abcf48ac0cb6b8e2fbc65e80a4f0
diff --git a/biocommons/seqrepo/fastadir/fastadir.py b/biocommons/seqrepo/fastadir/fastadir.py index <HASH>..<HASH> 100644 --- a/biocommons/seqrepo/fastadir/fastadir.py +++ b/biocommons/seqrepo/fastadir/fastadir.py @@ -88,7 +88,7 @@ class FastaDir(BaseReader, BaseWriter): yield recd def __len__(self): - return self.stats()["n_seqs"] + return self.stats()["n_sequences"] # ############################################################################ # Public methods diff --git a/tests/test_fastadir.py b/tests/test_fastadir.py index <HASH>..<HASH> 100644 --- a/tests/test_fastadir.py +++ b/tests/test_fastadir.py @@ -23,6 +23,8 @@ def test_write_reread(): assert "3" in fd + assert len(fd) == 3 + assert fd["3"] == "seq3", "test __getitem__ lookup" with pytest.raises(KeyError):
fixed KeyError in FastaDir.__len__ and added test
biocommons_biocommons.seqrepo
train
py,py
2a740752924a425cedf75607cc5de1505f3154db
diff --git a/lib/config.js b/lib/config.js index <HASH>..<HASH> 100644 --- a/lib/config.js +++ b/lib/config.js @@ -64,9 +64,9 @@ function importEnvVars(collection, envPrefix) { envValue = process.env[envKey]; if ((typeof(value) == 'number') || (typeof(value) == 'string') || (typeof(value) == 'boolean') || (value == null)) { if (envValue && typeof(envValue == 'string')) { - if (envValue.match(/\s*(true|on)\s*/i)) { + if (envValue.match(/^\s*(true|on)\s*$/i)) { envValue = true; - } else if (envValue.match(/\s*(false|off)\s*/i)) { + } else if (envValue.match(/^\s*(false|off)\s*$/i)) { envValue = false; } collection[key] = envValue; @@ -79,4 +79,4 @@ function importEnvVars(collection, envPrefix) { } importEnvVars(config, 'JSBIN'); -module.exports = config; \ No newline at end of file +module.exports = config;
Make the config environment variable override mechanism support environment variables that contain true/on or false/off.
jsbin_jsbin
train
js
2fe1b7ae320f339d736a10cab86e49a5da19f116
diff --git a/pygccxml/parser/scanner.py b/pygccxml/parser/scanner.py index <HASH>..<HASH> 100644 --- a/pygccxml/parser/scanner.py +++ b/pygccxml/parser/scanner.py @@ -218,11 +218,9 @@ class scanner_t(xml.sax.handler.ContentHandler): file_text = self.__files_text.get(file_decl) # Use lines and columns to capture only comment text for indx in range(comm_decl.begin_line - 1, comm_decl.end_line): - # Col data only useful on first and last lines - strt_idx = 0 + # Col data only different on the last line end_idx = -1 - if indx == comm_decl.begin_line - 1: - strt_idx = comm_decl.begin_column - 1 + strt_idx = comm_decl.begin_column - 1 if indx == comm_decl.end_line - 1: end_idx = comm_decl.end_column comm_line = file_text[indx]
Revert part of column change Use the start column of the comment on each line. Use the end column only on the last line.
gccxml_pygccxml
train
py
a54b00e770093f8d38e05dd8892b5664a5bd859c
diff --git a/session.go b/session.go index <HASH>..<HASH> 100644 --- a/session.go +++ b/session.go @@ -590,7 +590,9 @@ runLoop: default: } } - } else if !processedUndecryptablePacket { + } + // If we processed any undecryptable packets, jump to the resetting of the timers directly. + if !processedUndecryptablePacket { select { case closeErr = <-s.closeChan: break runLoop
enter the regular run loop if no undecryptable packet was processed
lucas-clemente_quic-go
train
go
eccecf0470298a7dbe3f2a5058d9ff2a333dcec4
diff --git a/lib/plucky/criteria_hash.rb b/lib/plucky/criteria_hash.rb index <HASH>..<HASH> 100644 --- a/lib/plucky/criteria_hash.rb +++ b/lib/plucky/criteria_hash.rb @@ -72,7 +72,7 @@ module Plucky end def object_ids=(value) - raise ArgumentError unless value.respond_to?(:flatten) + raise ArgumentError unless value.is_a?(Array) @options[:object_ids] = value.flatten end diff --git a/test/plucky/test_criteria_hash.rb b/test/plucky/test_criteria_hash.rb index <HASH>..<HASH> 100644 --- a/test/plucky/test_criteria_hash.rb +++ b/test/plucky/test_criteria_hash.rb @@ -37,7 +37,7 @@ class CriteriaHashTest < Test::Unit::TestCase criteria.object_ids.should == [:_id] end - should "raise argument error if does not respond to flatten" do + should "raise argument error if not array" do assert_raises(ArgumentError) { CriteriaHash.new.object_ids = {} } assert_raises(ArgumentError) { CriteriaHash.new.object_ids = nil } assert_raises(ArgumentError) { CriteriaHash.new.object_ids = 'foo' }
Ruby <I> fix. Hashes respond to flatten so just allowing arrays which should be fine.
mongomapper_plucky
train
rb,rb
18461ca62c29ff01b6a4b2e300d95a92fd42c70a
diff --git a/src/clusterpost-provider/executionserver.handlers.js b/src/clusterpost-provider/executionserver.handlers.js index <HASH>..<HASH> 100644 --- a/src/clusterpost-provider/executionserver.handlers.js +++ b/src/clusterpost-provider/executionserver.handlers.js @@ -14,6 +14,23 @@ module.exports = function (server, conf) { var LinkedList = require('linkedlist'); var remotedeletequeue = new LinkedList(); + const validate = function(req, decodedToken){ + var exs = server.methods.executionserver.getExecutionServer(decodedToken.executionserver); + if(exs){ + exs.scope = ['executionserver']; + return Promise.resolve(exs); + }else{ + return Promise.reject(Boom.unauthorized(exs)); + } + } + + if(server.methods.jwtauth){ + server.methods.jwtauth.addValidationFunction(validate); + }else{ + throw "Please update hapi-jwt-couch to version >= 3.0.0"; + } + + const startExecutionServers = function(){ return Promise.map(_.keys(conf.executionservers), function(eskey){ return new Promise(function(resolve, reject){
ENH: Add validation function logic here The package clusterpost-auth is deprecated now The token validation for the execution server is performed here
juanprietob_clusterpost
train
js
6e732b0cef3c120224a6bd5cc7839a55bbb753fe
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -85,7 +85,7 @@ setup( # your project is installed. For an analysis of "install_requires" vs pip's # requirements files see: # https://packaging.python.org/en/latest/requirements.html - install_requires=['requests', 'envparse', 'typing', 'jsonschema'], + install_requires=['requests', 'envparse', 'typing', 'six', 'jsonschema'], setup_requires=['pytest-runner'], tests_require=['pytest', 'pytz', 'betamax', 'six'],
adding six to the setup see also #<I>
KE-works_pykechain
train
py
27641b28ec6e5818867624969cb0573d28abfd43
diff --git a/src/Administration/Resources/e2e/routes/cypress.js b/src/Administration/Resources/e2e/routes/cypress.js index <HASH>..<HASH> 100644 --- a/src/Administration/Resources/e2e/routes/cypress.js +++ b/src/Administration/Resources/e2e/routes/cypress.js @@ -4,7 +4,7 @@ const childProcess = require('child_process'); const app = express(); app.get('/cleanup', (req, res) => { - return childProcess.exec('./psh.phar e2e:cleanup', (err, stdin, stderr) => { + return childProcess.exec('./psh.phar e2e:cleanup', { maxBuffer: 2000 * 1024 }, (err, stdin, stderr) => { if (err) { console.log('stderr: ', stderr);
NTR - increase maxBuffer
shopware_platform
train
js
be79c77ce8f4ce3ce3bde6d893277361f1ff430a
diff --git a/chess/uci.py b/chess/uci.py index <HASH>..<HASH> 100644 --- a/chess/uci.py +++ b/chess/uci.py @@ -901,7 +901,13 @@ class Engine(object): future.add_done_callback(async_callback) return future else: - return future.result() + # Avoid calling future.result() without a timeout. In Python 2 + # such a call cannot be interrupted. + while not future.done(): + try: + return future.result(timeout=60) + except concurrent.futures.TimeoutError: + pass def uci(self, async_callback=None): """
Avoid calling future.result() without a timeout (#<I>)
niklasf_python-chess
train
py
910f3021b054c52cb8bde1ab1964eae3eceb84fd
diff --git a/head.go b/head.go index <HASH>..<HASH> 100644 --- a/head.go +++ b/head.go @@ -1364,7 +1364,6 @@ type memSeries struct { firstChunkID int nextAt int64 // Timestamp at which to cut the next chunk. - lastValue float64 sampleBuf [4]sample pendingCommit bool // Whether there are samples waiting to be committed to this series. @@ -1432,7 +1431,7 @@ func (s *memSeries) appendable(t int64, v float64) error { } // We are allowing exact duplicates as we can encounter them in valid cases // like federation and erroring out at that time would be extremely noisy. - if math.Float64bits(s.lastValue) != math.Float64bits(v) { + if math.Float64bits(s.sampleBuf[3].v) != math.Float64bits(v) { return ErrAmendSample } return nil @@ -1504,8 +1503,6 @@ func (s *memSeries) append(t int64, v float64) (success, chunkCreated bool) { c.maxTime = t - s.lastValue = v - s.sampleBuf[0] = s.sampleBuf[1] s.sampleBuf[1] = s.sampleBuf[2] s.sampleBuf[2] = s.sampleBuf[3]
Use sampleBuf instead of maintaining lastValue. (#<I>) This cuts the size of memSize by 8B.
prometheus_prometheus
train
go
2a172377ea5bb161579ebc875d56958ba8a25404
diff --git a/ceph_deploy/tests/unit/hosts/test_suse.py b/ceph_deploy/tests/unit/hosts/test_suse.py index <HASH>..<HASH> 100644 --- a/ceph_deploy/tests/unit/hosts/test_suse.py +++ b/ceph_deploy/tests/unit/hosts/test_suse.py @@ -19,7 +19,7 @@ class TestSuseInit(object): init_type = self.host.choose_init() assert ( init_type == "systemd") - def test_choose_init_openSUSE_13.1(self): + def test_choose_init_openSUSE_13_1(self): self.host.release = '13.1' init_type = self.host.choose_init() assert ( init_type == "systemd")
functionnames cant have '.' in the name
ceph_ceph-deploy
train
py
b82ed669f25b525075a7edc459d3205028d083d0
diff --git a/Trustly/Data/jsonrpcresponse.php b/Trustly/Data/jsonrpcresponse.php index <HASH>..<HASH> 100644 --- a/Trustly/Data/jsonrpcresponse.php +++ b/Trustly/Data/jsonrpcresponse.php @@ -33,15 +33,15 @@ class Trustly_Data_JSONRPCResponse extends Trustly_Data_Response { } public function getErrorCode() { - if($this->isError() && isset($this->result['data']['code'])) { - return $this->result['data']['code']; + if($this->isError() && isset($this->result['error']['code'])) { + return $this->result['error']['code']; } return NULL; } public function getErrorMessage() { - if($this->isError() && isset($this->result['data']['message'])) { - return $this->result['data']['message']; + if($this->isError() && isset($this->result['error']['message'])) { + return $this->result['error']['message']; } return NULL; }
Collect the error in the correct location
trustly_trustly-client-php
train
php
4bfae0dab7b98f13313ed92cf61562f9d39d052e
diff --git a/lib/functions/image.js b/lib/functions/image.js index <HASH>..<HASH> 100644 --- a/lib/functions/image.js +++ b/lib/functions/image.js @@ -62,16 +62,18 @@ Image.prototype.close = function(){ Image.prototype.type = function(){ var type - , chunk = fs.readSync(this.fd, 10, 0)[0]; + , buf = new Buffer(4); + + fs.readSync(this.fd, buf, 0, 4, 0); // GIF - if ('GIF' == chunk.slice(0, 3)) type = 'gif'; + if (0x47 == buf[0] && 0x49 == buf[1] && 0x46 == buf[2]) type = 'gif'; // PNG - if ('PNG' == chunk.slice(1, 4)) type = 'png'; + else if (0x50 == buf[1] && 0x4E == buf[2] && 0x47 == buf[3]) type = 'png'; // JPEG - if ('JFIF' == chunk.slice(6, 10)) type = 'jpeg'; + else if (0xff == buf[0] && 0xd8 == buf[1]) type = 'jpeg'; return type; };
Refactored Image#type()
stylus_stylus
train
js
09f4bcaa6af1de82b4f57b80043ddaffb386cf44
diff --git a/lib/compiler.js b/lib/compiler.js index <HASH>..<HASH> 100644 --- a/lib/compiler.js +++ b/lib/compiler.js @@ -1,6 +1,5 @@ 'use strict'; -var fs = require('fs'); var utils = require('./utils'); /**
Compiler no longer uses fs, removing require
krg7880_json-schema-generator
train
js
2f53cc9c122012390b9f453e55f7a606b8f9dd02
diff --git a/Tests/Functional/FunctionalTest.php b/Tests/Functional/FunctionalTest.php index <HASH>..<HASH> 100644 --- a/Tests/Functional/FunctionalTest.php +++ b/Tests/Functional/FunctionalTest.php @@ -223,7 +223,7 @@ class FunctionalTest extends WebTestCase 'dateAsInterface' => [ 'type' => 'string', 'format' => 'date-time', - ] + ], ], ], $this->getModel('User')->toArray()
Add ',' in the end of array
nelmio_NelmioApiDocBundle
train
php
90b95ada1990d978470de9e1f826390d7b5ec130
diff --git a/tests/scripts/install_odoo.py b/tests/scripts/install_odoo.py index <HASH>..<HASH> 100755 --- a/tests/scripts/install_odoo.py +++ b/tests/scripts/install_odoo.py @@ -50,6 +50,8 @@ def install_odoo(): subprocess.check_call(["pip", "install", "pyyaml<4"]) # Odoo not compatible with werkzeug 1.0: https://github.com/odoo/odoo/issues/45914 subprocess.check_call(["pip", "install", "werkzeug<1"]) + # Odoo not compatible with Jinja2 >= 2.11 + subprocess.check_call(["pip", "install", "jinja2<2.11"]) subprocess.check_call(["pip", "install", "-e", odoo_dir])
Workaround Odoo jinja2 compatibility issue
acsone_click-odoo
train
py
2f5a9833e0bb1469a7b60e7b6cd71f69d8881fec
diff --git a/lib/model/precondition.rb b/lib/model/precondition.rb index <HASH>..<HASH> 100644 --- a/lib/model/precondition.rb +++ b/lib/model/precondition.rb @@ -43,7 +43,7 @@ module SimpleXml handle_temporal elsif attr_val('@type') == DATETIMEDIFF handle_grouping_functional - elsif attr_val('@type') == SATISFIES_ALL || attr_val('@type') == SATISFIES_ANY + elsif (attr_val('@type') == SATISFIES_ALL || attr_val('@type') == SATISFIES_ANY) && @subset.nil? handle_satisfies elsif @entry.name == DATA_CRITERIA_OP || @subset handle_data_criteria
Correctly handle SATISFIES clauses within subset operators
projecttacoma_simplexml_parser
train
rb
ee07a7badd7a67d6c71253aa353925ca4ed3adcc
diff --git a/Kwc/Form/Component.defer.js b/Kwc/Form/Component.defer.js index <HASH>..<HASH> 100644 --- a/Kwc/Form/Component.defer.js +++ b/Kwc/Form/Component.defer.js @@ -52,6 +52,8 @@ Kwc.Form.Component = function(form) } }, this); + this.errorStyle = new Kwf.FrontendForm.errorStyles[this.config.errorStyle](this); + this.fields.forEach(function(f) { f.initField(); }); @@ -84,8 +86,6 @@ Kwc.Form.Component = function(form) this.fireEvent('fieldChange', f); }, this); }, this); - - this.errorStyle = new Kwf.FrontendForm.errorStyles[this.config.errorStyle](this); }; Ext2.extend(Kwc.Form.Component, Ext2.util.Observable, { getFieldConfig: function(fieldName)
moved code for errorStyle before form fields init in frontendForm
koala-framework_koala-framework
train
js
f42177983fb2c9896748402fd482a3eb572914a6
diff --git a/drivers/virtualbox/virtualbox.go b/drivers/virtualbox/virtualbox.go index <HASH>..<HASH> 100644 --- a/drivers/virtualbox/virtualbox.go +++ b/drivers/virtualbox/virtualbox.go @@ -656,9 +656,7 @@ func getAvailableTCPPort(port int) (int, error) { port = 0 // Throw away the port hint before trying again time.Sleep(1) } - time.Sleep(1) return 0, fmt.Errorf("unable to allocate tcp port") - } // Setup a NAT port forwarding entry.
Remove stray sleep() This is just a bit of development debris.
docker_machine
train
go
85a140ffcc920812e7ae2bcaafec5672f8dea905
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -70,7 +70,7 @@ http://<thumbor-server>/300x200/smart/s.glbimg.com/et/bb/f/original/2011/03/24/V install_requires=[ "tornado>=2.1.1,<2.2.0", - "pyCrypto>=2.4.1,<2.5.0", + "pyCrypto>=2.4.1", "pycurl>=7.19.0,<7.20.0", "Pillow>=1.7.5,<1.8.0", "derpconf>=0.2.0",
as ubuntu <I> comes with python-crypto <I>-2, Thumbor does not want starting
thumbor_thumbor
train
py
f9d6c8ca0faa4fe9a7b7a2f9107b545a4ae910da
diff --git a/djangui/backend/ast/source_parser.py b/djangui/backend/ast/source_parser.py index <HASH>..<HASH> 100644 --- a/djangui/backend/ast/source_parser.py +++ b/djangui/backend/ast/source_parser.py @@ -123,9 +123,9 @@ def walk_tree(node): for key, value in d.items(): if isinstance(value, list): for val in value: - for _ in walk_tree(val): + for _ in ast.walk(val): yield _ - elif 'ast' in str(type(value)): + elif issubclass(type(value), ast.AST): for _ in walk_tree(value): yield _ else:
fix for argparse being defined inside the __main__ statement
Chris7_django-djangui
train
py
74686a0c642840340bc65e35a40f63ef79463b61
diff --git a/spec/lib/bootstrap_forms/form_builder_spec.rb b/spec/lib/bootstrap_forms/form_builder_spec.rb index <HASH>..<HASH> 100644 --- a/spec/lib/bootstrap_forms/form_builder_spec.rb +++ b/spec/lib/bootstrap_forms/form_builder_spec.rb @@ -97,7 +97,7 @@ describe 'BootstrapForms::FormBuilder' do end it "does not add the required attribute if required: false" do - @builder.text_field('owner', required: false).should_not match /<input .*required="required"/ + @builder.text_field('owner', :required => false).should_not match /<input .*required="required"/ end it "not require if or unless validators" do
use hashrockets for < Ruby <I>
sethvargo_bootstrap_forms
train
rb
a6f6414855dbbc02501d7ff87c1ed8a93ae81c3f
diff --git a/src/service.js b/src/service.js index <HASH>..<HASH> 100644 --- a/src/service.js +++ b/src/service.js @@ -139,9 +139,9 @@ class Service { if (this.id === '_id') { // We can not update default mongo ids delete data[this.id]; - } else if (data[this.id] === undefined) { - // If not using the default Mongo _id field and you haven't passed a new id field - // then set the id to its previous value. This prevents orphaned documents. + } else { + // If not using the default Mongo _id field set the id to its + // previous value. This prevents orphaned documents. data[this.id] = id; } @@ -172,9 +172,9 @@ class Service { if (this.id === '_id') { // We can not update default mongo ids delete data[this.id]; - } else if (data[this.id] === undefined) { - // If not using the default Mongo _id field and you haven't passed a new id field - // then set the id to its previous value. This prevents orphaned documents. + } else { + // If not using the default Mongo _id field set the id to its + // previous value. This prevents orphaned documents. data[this.id] = id; }
enforcing that you shouldn't be able to change ids
feathersjs-ecosystem_feathers-mongoose
train
js
614c047f12ae20852207adb0c9bd104089932a8a
diff --git a/nrrd.py b/nrrd.py index <HASH>..<HASH> 100644 --- a/nrrd.py +++ b/nrrd.py @@ -288,11 +288,12 @@ def read_header(nrrdfile): it = iter(nrrdfile) - headerSize += _validate_magic_line(it.next()) + headerSize += _validate_magic_line(next(it).decode('ascii')) header = { 'keyvaluepairs': {} } for raw_line in it: headerSize += len(raw_line) + raw_line = raw_line.decode('ascii') # Trailing whitespace ignored per the NRRD spec line = raw_line.rstrip()
Python 3 compatibility - Decode header as ASCII to work with Python 3 (as is assumed in NRRD format, <URL>) - next(it) instead of it.next() Changes work for Python 2 & 3
mhe_pynrrd
train
py
128a195a2012bdc7fb8012ae9b38d54f7bbfeeaf
diff --git a/code/Helpers/ConfigParser.php b/code/Helpers/ConfigParser.php index <HASH>..<HASH> 100644 --- a/code/Helpers/ConfigParser.php +++ b/code/Helpers/ConfigParser.php @@ -201,7 +201,10 @@ class ConfigParser $arguments = isset($matches[2]) ? $matches[2] : ''; foreach ($this->config->providers as $provider) { - if (isset($provider::$shorthand)) { + if (!class_exists($provider)) { + // todo log somewhere else? this would log every time parser options are checked + SS_Log::log("provider class '{$provider}' cannot be found"); + } else if (isset($provider::$shorthand)) { if (strtolower($provider::$shorthand) === $shorthand) { $options = $provider::parseOptions($arguments); $options['provider'] = $provider;
BUGFIX: check for provider class exists
littlegiant_silverstripe-seeder
train
php
8249e5fdd0c9c3c9719a4d996045dca4d1c3a6ff
diff --git a/craftai/client.py b/craftai/client.py index <HASH>..<HASH> 100644 --- a/craftai/client.py +++ b/craftai/client.py @@ -32,7 +32,7 @@ class CraftAIClient(object): """ or invalid token provided.""") if (not isinstance(cfg.get("project"), six.string_types)): raise CraftAICredentialsError("""Unable to create client with no""" - """ or invalid owner provided.""") + """ or invalid project provided.""") else: splittedProject = cfg.get("project").split('/') if (len(splittedProject) == 2):
Fix the error message when the project is badly set
craft-ai_craft-ai-client-python
train
py
81b33de54998ead8454a2d62ce52a77ae8c393d1
diff --git a/lib/plugins/processor/index.js b/lib/plugins/processor/index.js index <HASH>..<HASH> 100644 --- a/lib/plugins/processor/index.js +++ b/lib/plugins/processor/index.js @@ -315,7 +315,8 @@ extend.processor.register(/^([^_].*)\.(\w+)/, function(file, callback){ if (renderer.indexOf(extname) === -1){ route.set(path, function(fn){ - fn(null, content); + var rs = fs.createReadStream(source); + fn(null, rs); }); callback(); } else {
Processor: Write source file with stream
hexojs_hexo
train
js
bab1314d149c1df549d40162aa17f9f0dfe7f610
diff --git a/src/test/java/org/reflections/ReflectionsTest.java b/src/test/java/org/reflections/ReflectionsTest.java index <HASH>..<HASH> 100644 --- a/src/test/java/org/reflections/ReflectionsTest.java +++ b/src/test/java/org/reflections/ReflectionsTest.java @@ -214,7 +214,7 @@ public class ReflectionsTest { @Test public void testResourcesScanner() { - Predicate<String> filter = new FilterBuilder().include(".*\\.xml"); + Predicate<String> filter = new FilterBuilder().include(".*\\.xml").exclude(".*testModel-reflections\\.xml"); Reflections reflections = new Reflections(new ConfigurationBuilder() .filterInputsBy(filter) .setScanners(new ResourcesScanner()) @@ -224,8 +224,7 @@ public class ReflectionsTest { assertThat(resolved, are("META-INF/reflections/resource1-reflections.xml")); Set<String> resources = reflections.getStore().get(ResourcesScanner.class.getSimpleName()).keySet(); - assertThat(resources, are("resource1-reflections.xml", "resource2-reflections.xml", - "testModel-reflections.xml")); + assertThat(resources, are("resource1-reflections.xml", "resource2-reflections.xml")); } @Test
Fix inconsistency in unit tests related to testModel-reflections.xml The META-INF/reflections/testModel-reflections.xml file is created by ReflectionsCollectTest, and its presence was expected in ReflectionsTest.testResourcesScanner(). The assertion wasn't always satisfied, depending on the order of execution of tests. Make testResourcesScanner() exclude testModel-reflections.xml from scanned resources and change the assertion not to expect the excluded file.
ronmamo_reflections
train
java
c141196e964a3ed22ffb4ae446bda5ac97c063a4
diff --git a/src/FeedIo/FeedIo.php b/src/FeedIo/FeedIo.php index <HASH>..<HASH> 100644 --- a/src/FeedIo/FeedIo.php +++ b/src/FeedIo/FeedIo.php @@ -45,9 +45,8 @@ class FeedIo public function __construct(ClientInterface $client, LoggerInterface $logger) { $this->logger = $logger; - $this->reader = new Reader($client, $logger); $this->dateTimeBuilder = new DateTimeBuilder; - + $this->setReader(new Reader($client, $logger)); $this->loadCommonStandards(); } @@ -74,7 +73,7 @@ class FeedIo 'rss' => new Rss($this->dateTimeBuilder), ); } - + /** * @param string $name * @param \FeedIo\StandardAbstract $standard @@ -92,6 +91,33 @@ class FeedIo } /** + * @return \FeedIo\Rule\DateTimeBuilder + */ + public function getDateTimeBuilder() + { + return $this->dateTimeBuilder; + } + + /** + * @return \FeedIo\Reader + */ + public function getReader() + { + return $this->reader; + } + + /** + * @param \FeedIo\Reader + * @return $this + */ + public function setReader(Reader $reader) + { + $this->reader = $reader; + + return $this: + } + + /** * @param $url * @param FeedInterface $feed * @param \DateTime $modifiedSince
getter and setter for the reader attribute
alexdebril_feed-io
train
php
291be20a3de31a5c3cb3a39b85dc98ec04076173
diff --git a/test/TestCases.template.js b/test/TestCases.template.js index <HASH>..<HASH> 100644 --- a/test/TestCases.template.js +++ b/test/TestCases.template.js @@ -199,7 +199,7 @@ const describeCases = config => { return; function _it(title, fn) { - exportedTests.push({ title, fn, timeout: 5000 }); + exportedTests.push({ title, fn, timeout: 10000 }); } function _require(module) {
increase timeout for TestCases to <I>s
webpack_webpack
train
js
806ff7315905e7d5f4f05179c15e7df9c9ad1401
diff --git a/src/java/org/archive/wayback/http11resourcestore/Http11ResourceStore.java b/src/java/org/archive/wayback/http11resourcestore/Http11ResourceStore.java index <HASH>..<HASH> 100644 --- a/src/java/org/archive/wayback/http11resourcestore/Http11ResourceStore.java +++ b/src/java/org/archive/wayback/http11resourcestore/Http11ResourceStore.java @@ -104,9 +104,15 @@ public class Http11ResourceStore implements ResourceStore { // for now, we'll just grab the first one: String arcUrl = arcUrls[0]; - ARCReader ar = ARCReaderFactory.get(new URL(arcUrl),offset); - ARCRecord rec = ar.get(); - Resource r = new Resource(rec,ar); + Resource r = null; + try { + ARCReader ar = ARCReaderFactory.get(new URL(arcUrl),offset); + ARCRecord rec = ar.get(); + r = new Resource(rec,ar); + } catch (IOException e) { + throw new ResourceNotAvailableException("Unable to retrieve", + e.getLocalizedMessage()); + } return r;
BUGFIX: IOExceptions including HTTP errors, no route to host, etc were not being handled and wrapped as ResourceNotAvailable exceptions. git-svn-id: <URL>
iipc_openwayback
train
java
345a91b019a94455e6095a5deb7646bccf1c1256
diff --git a/src/Core/Builder/Request/ShippingMethodRequestBuilder.php b/src/Core/Builder/Request/ShippingMethodRequestBuilder.php index <HASH>..<HASH> 100644 --- a/src/Core/Builder/Request/ShippingMethodRequestBuilder.php +++ b/src/Core/Builder/Request/ShippingMethodRequestBuilder.php @@ -98,7 +98,7 @@ class ShippingMethodRequestBuilder */ public function getMatchingOrderEdit($orderEditId, Location $location) { - $request = ShippingMethodByMatchingOrderEditGetRequest::ofOrderEditAndCountry($orderEditId, $location->getCountry()); + $request = ShippingMethodByMatchingOrderEditGetRequest::ofOrderEditAndCountry($orderEditId, $location); return $request; }
WIP: add requestbuilder not added by the git add
commercetools_commercetools-php-sdk
train
php
50e0cbd0675be48a003a35059042befbdaaed41c
diff --git a/pymongo/collection.py b/pymongo/collection.py index <HASH>..<HASH> 100644 --- a/pymongo/collection.py +++ b/pymongo/collection.py @@ -1007,7 +1007,8 @@ class Collection(common.BaseObject): response = self.__database.command("mapreduce", self.__name, map=map, reduce=reduce, out=out_conf, **kwargs) - if full_response: + + if full_response or not response.get('result'): return response elif isinstance(response['result'], dict): dbase = response['result']['db']
Handle no 'result' field in M/R PYTHON-<I> For now this only happens with inline map reduce which we provide a separate method to handle.
mongodb_mongo-python-driver
train
py
322eff3663241c0346c71301e1ebaf83085ea18b
diff --git a/pyani/pyani_graphics.py b/pyani/pyani_graphics.py index <HASH>..<HASH> 100644 --- a/pyani/pyani_graphics.py +++ b/pyani/pyani_graphics.py @@ -207,7 +207,7 @@ def heatmap_mpl(df, outfilename=None, title=None, cmap=None, width_ratios = [1, 0.15]) rowdend_axes = fig.add_subplot(rowGS[0, 0]) rowdend = sch.dendrogram(rowclusters, color_threshold=np.inf, - orientation="left") + orientation="right") clean_axis(rowdend_axes) # Create heatmap axis
Corrected row dendrogram orientation in MPL
widdowquinn_pyani
train
py
cb65c921c3ad29c7a964e6f8b8b4212853bc240e
diff --git a/machina/apps/conversation/views.py b/machina/apps/conversation/views.py index <HASH>..<HASH> 100644 --- a/machina/apps/conversation/views.py +++ b/machina/apps/conversation/views.py @@ -73,7 +73,7 @@ class TopicView(PermissionRequiredMixin, ListView): def get_queryset(self): self.topic = self.get_topic() - qs = self.topic.posts.all().exclude(approved=False) + qs = self.topic.posts.all().exclude(approved=False).prefetch_related('attachments') return qs def get_controlled_object(self): @@ -145,6 +145,7 @@ class PostEditMixin(object): def form_valid(self, form): preview = 'preview' in self.request.POST + save_attachment_formset = False if perm_handler.can_attach_files(self.get_forum(), self.request.user): attachment_formset = self.attachment_formset_class(
Fixed PostEdit mixin form_valid method
ellmetha_django-machina
train
py
0a42dd1c207d236d869a2c001edd64a530ade3d0
diff --git a/stripe/__init__.py b/stripe/__init__.py index <HASH>..<HASH> 100644 --- a/stripe/__init__.py +++ b/stripe/__init__.py @@ -329,7 +329,9 @@ class APIRequestor(object): # However, that's ok because the CA bundle they use recognizes # api.stripe.com. args['validate_certificate'] = verify_ssl_certs - args['deadline'] = 10 + # GAE requests time out after 60 seconds, so make sure we leave + # some time for the application to handle a slow Stripe + args['deadline'] = 55 try: result = urlfetch.fetch(**args)
Time out GAE requests after <I> seconds
stripe_stripe-python
train
py
f52f2397af0a3dda05bf52d4aee9d22f9891f643
diff --git a/crispy_forms/tests/test_settings_bootstrap.py b/crispy_forms/tests/test_settings_bootstrap.py index <HASH>..<HASH> 100644 --- a/crispy_forms/tests/test_settings_bootstrap.py +++ b/crispy_forms/tests/test_settings_bootstrap.py @@ -25,3 +25,4 @@ MIDDLEWARE_CLASSES = ( ROOT_URLCONF = 'urls' CRISPY_TEMPLATE_PACK = 'bootstrap' +SECRET_KEY = 'secretkey'
Added compulsory SECRET_KEY to test settings
django-crispy-forms_django-crispy-forms
train
py
aa16a17ddb950056f2e0c29ac1151c6dd6f8e17b
diff --git a/lib/guard/coffeelint.rb b/lib/guard/coffeelint.rb index <HASH>..<HASH> 100644 --- a/lib/guard/coffeelint.rb +++ b/lib/guard/coffeelint.rb @@ -44,7 +44,13 @@ module Guard "#{error_count} errors in #{paths.length} files" end - Notifier.notify(message, title: "Coffeelint", image: :failed) + image = if error_count > 0 + :failed + else + :success + end + + Notifier.notify(message, title: "Coffeelint", image: image) end
Show the "success" image when error count equals 0.
meagar_guard-coffeelint
train
rb
72d85272e62b24ae370532a3b06e3993bf88c843
diff --git a/pyvisa-py/serial.py b/pyvisa-py/serial.py index <HASH>..<HASH> 100644 --- a/pyvisa-py/serial.py +++ b/pyvisa-py/serial.py @@ -65,7 +65,7 @@ class SerialSession(Session): else: cls = Serial - self.interface = cls(port=self.parsed.board, timeout=2000, writeTimeout=2000) + self.interface = cls(port=self.parsed.board, timeout=2000, write_timeout=2000) for name in ('ASRL_END_IN', 'ASRL_END_OUT', 'SEND_END_EN', 'TERMCHAR', 'TERMCHAR_EN', 'SUPPRESS_END_EN'): @@ -93,7 +93,7 @@ class SerialSession(Session): value = value / 1000. self.interface.timeout = value - self.interface.writeTimeout = value + self.interface.write_timeout = value def close(self): self.interface.close()
pyserial renamed writeTimeout to write_timeout in version <I>
pyvisa_pyvisa-py
train
py
9dd2401b8ac688e7115285538f8ceed0a54ff605
diff --git a/src/main/java/com/orientechnologies/security/auditing/ODefaultAuditing.java b/src/main/java/com/orientechnologies/security/auditing/ODefaultAuditing.java index <HASH>..<HASH> 100644 --- a/src/main/java/com/orientechnologies/security/auditing/ODefaultAuditing.java +++ b/src/main/java/com/orientechnologies/security/auditing/ODefaultAuditing.java @@ -231,13 +231,7 @@ public class ODefaultAuditing implements OAuditingService, ODatabaseLifecycleLis } private File getConfigFile(String iDatabaseName) { - String storagePath = server.getDatabases().getDatabasePath(iDatabaseName); - - if (storagePath != null) { - return new File(storagePath + File.separator + FILE_AUDITING_DB_CONFIG); - } - - return null; + return new File(server.getDatabaseDirectory() + iDatabaseName + File.separator + FILE_AUDITING_DB_CONFIG); } @Override
Fixed ODefaultAuditing.getConfigFile() so it would compile.
orientechnologies_orientdb
train
java
10d7c1c91b44c0fda2fe46fc4647deadaff0f441
diff --git a/collectors/build/sonar/src/main/java/com/capitalone/dashboard/collector/DefaultSonar6Client.java b/collectors/build/sonar/src/main/java/com/capitalone/dashboard/collector/DefaultSonar6Client.java index <HASH>..<HASH> 100644 --- a/collectors/build/sonar/src/main/java/com/capitalone/dashboard/collector/DefaultSonar6Client.java +++ b/collectors/build/sonar/src/main/java/com/capitalone/dashboard/collector/DefaultSonar6Client.java @@ -201,7 +201,7 @@ public class DefaultSonar6Client implements SonarClient { public JSONArray getQualityProfileConfigurationChanges(String instanceUrl,String qualityProfile) throws ParseException{ String url = instanceUrl + URL_QUALITY_PROFILE_CHANGES + qualityProfile; try { - JSONArray qualityProfileConfigChanges = this.parseAsArray(instanceUrl, "events"); + JSONArray qualityProfileConfigChanges = this.parseAsArray(url, "events"); return qualityProfileConfigChanges; } catch (ParseException e) { LOG.error("Could not parse response from: " + url, e);
Fix sonar CodeQuallity collector parse error (#<I>) (#<I>)
Hygieia_Hygieia
train
java
24c8deac0451e7340d517f204c256c4c9e9c7d11
diff --git a/great_expectations/dataset/dataset.py b/great_expectations/dataset/dataset.py index <HASH>..<HASH> 100644 --- a/great_expectations/dataset/dataset.py +++ b/great_expectations/dataset/dataset.py @@ -3564,7 +3564,7 @@ class Dataset(MetaDataset): """ if partition_object is None: - partition_object = build_continuous_partition_object(dataset=self, column=column, bins='auto') + partition_object = build_continuous_partition_object(dataset=self, column=column, bins='uniform') if not is_valid_partition_object(partition_object): raise ValueError("Invalid partition object.")
Return to default of "uniform" bins for profiling
great-expectations_great_expectations
train
py
26164a45832f17114518c68df8f5888d9aa53c82
diff --git a/lib/redis-search.js b/lib/redis-search.js index <HASH>..<HASH> 100644 --- a/lib/redis-search.js +++ b/lib/redis-search.js @@ -55,16 +55,18 @@ Search.prototype.query = function(data, start, stop, callback) { for(var index in keyMap) { if (keyMap.hasOwnProperty(index)) { var keys = keyMap[index]; - if (keys.length === 1) { - tmpKeys.push(keys[0]); - } else if (keys.length > 1) { - var tmpKeyName = namespace + ':' + index + ':temp'; - tmpKeys.push(tmpKeyName); - var command = commands.and; - if (index === 'content' && data.matchWords === 'any') { - command = commands.or; + if (Array.isArray(keys)) { + if (keys.length === 1) { + tmpKeys.push(keys[0]); + } else if (keys.length > 1) { + var tmpKeyName = namespace + ':' + index + ':temp'; + tmpKeys.push(tmpKeyName); + var command = commands.and; + if (index === 'content' && data.matchWords === 'any') { + command = commands.or; + } + cmds.push([command, tmpKeyName, keys.length].concat(keys)); } - cmds.push([command, tmpKeyName, keys.length].concat(keys)); } } }
don't crash if keys is undefined
barisusakli_redis-search
train
js
83b52b5b7ffd70ccd3e7a5ab2f5922b4c5caf5d7
diff --git a/src/Composer/Autoload/AutoloadGenerator.php b/src/Composer/Autoload/AutoloadGenerator.php index <HASH>..<HASH> 100644 --- a/src/Composer/Autoload/AutoloadGenerator.php +++ b/src/Composer/Autoload/AutoloadGenerator.php @@ -148,6 +148,10 @@ EOF; } foreach ($package->getAutoload() as $type => $mapping) { + // skip misconfigured packages + if (!is_array($mapping)) { + continue; + } foreach ($mapping as $namespace => $paths) { foreach ((array) $paths as $path) { $autoloads[$type][$namespace][] = empty($installPath) ? $path : $installPath.'/'.$path;
Avoid blowing up on misconfigured autoload entries
mothership-ec_composer
train
php
afd49c7b0ada1d75d8e5702c179021b87d4efde1
diff --git a/bootstrap/run_app_action.go b/bootstrap/run_app_action.go index <HASH>..<HASH> 100644 --- a/bootstrap/run_app_action.go +++ b/bootstrap/run_app_action.go @@ -117,6 +117,9 @@ func (a *RunAppAction) Run(s *State) error { if err != nil { return err } + if len(hosts) == 0 { + return errors.New("bootstrap: no running hosts found") + } sort.Sort(schedutil.HostSlice(hosts)) for i := 0; i < count; i++ { hostID := hosts[i%len(hosts)].ID
bootstrap: Avoid divide by zero in host selection If there are no hosts running at this point, the host selection will panic with a divide by zero. Instead, if there are no hosts, return an error.
flynn_flynn
train
go
7d64c540056ef7bec73edb9cd58173c645ba4c7c
diff --git a/settings/default.includes.settings.php b/settings/default.includes.settings.php index <HASH>..<HASH> 100644 --- a/settings/default.includes.settings.php +++ b/settings/default.includes.settings.php @@ -2,13 +2,13 @@ /** * @file - * Generated by BLT. Serves as a central aggregation point for adding settings - * files. + * Generated by BLT. A central aggregation point for adding settings files. */ /** - * Use this file to add any addition settings files which should be required by - * your application. To use, rename this file to be `includes.settings.php and + * Adds any additional settings files required by your application. + * + * To use, rename this file to be `includes.settings.php and * add file references to the `additionalSettingsFiles` array below. * * Files required into this file are included into the blt.settings.php file diff --git a/settings/global.settings.default.php b/settings/global.settings.default.php index <HASH>..<HASH> 100644 --- a/settings/global.settings.default.php +++ b/settings/global.settings.default.php @@ -6,11 +6,12 @@ */ /** + * An example global include file. + * * Any file placed directly in the docroot/sites/settings directory whose name * matches a glob pattern of *.settings.php will be incorporated to the settings * of every defined site. * * If instead you want to add settings to a specific site, see BLT's includes * file in docroot/sites/{site-name}/settings/default.includes.settings.php. - * */
Fix code style standards in settings files. (#<I>)
acquia_blt
train
php,php
23dd3505928c5bd9a3b82695f3b6c3bce838cd36
diff --git a/daemon/k8s_watcher.go b/daemon/k8s_watcher.go index <HASH>..<HASH> 100644 --- a/daemon/k8s_watcher.go +++ b/daemon/k8s_watcher.go @@ -233,7 +233,14 @@ func (d *Daemon) serviceAddFn(obj interface{}) { } if svc.Spec.Type != v1.ServiceTypeClusterIP { - log.Infof("Ignoring service %s/%s since its type is %s", svc.Namespace, svc.Name, svc.Spec.Type) + log.Infof("Ignoring k8s service %s/%s, reason unsupported type %s", + svc.Namespace, svc.Name, svc.Spec.Type) + return + } + + if strings.ToLower(svc.Spec.ClusterIP) == "none" || svc.Spec.ClusterIP == "" { + log.Infof("Ignoring k8s service %s/%s, reason: headless", + svc.Namespace, svc.Name, svc.Spec.Type) return }
k8s: Ignore headless services
cilium_cilium
train
go
9fe4f110eae858d6dd18154ce0e69c5d595121c9
diff --git a/lib/dashboard.js b/lib/dashboard.js index <HASH>..<HASH> 100644 --- a/lib/dashboard.js +++ b/lib/dashboard.js @@ -475,18 +475,24 @@ async function findRecord(ctx, next) { async function _getContentSections() { return Section.scope('content').findAll({ - where: { - fields: { - [Sequelize.Op.ne]: {}, - }, - }, + /* + * BUG: Postgresql can't compare equality in where clause, + * so for now we'll just filter the sections after SQL + * + * https://github.com/vapid/vapid/issues/149 + */ + // where: { + // fields: { + // [Sequelize.Op.ne]: {}, + // }, + // }, order: [ [Sequelize.literal(`CASE WHEN name = '${Section.DEFAULT_NAME}' THEN 1 ELSE 0 END`), 'DESC'], ['multiple', 'ASC'], [Sequelize.cast(Sequelize.json('options.priority'), 'integer'), 'ASC'], ['name', 'ASC'], ], - }); + }).then(sections => Utils.filter(sections, section => !Utils.isEmpty(section.fields))); } async function _newRecordAction(ctx, errors = {}) {
Filter out sections that don't have fields (#<I>) Resolves #<I>
vapid_vapid
train
js
b1c206014486aa95701eb39b664622a649a713aa
diff --git a/test/lib/system/index_spec.js b/test/lib/system/index_spec.js index <HASH>..<HASH> 100644 --- a/test/lib/system/index_spec.js +++ b/test/lib/system/index_spec.js @@ -77,6 +77,30 @@ describe('lib/system/index_spec.js', function(){ }); }); + describe('get_os_name', function(){ + + it('should get os name', function(done) { + index.get_os_name(function(err, name) { + should.not.exist(err); + name.should.be.a('string'); + done(); + }); + }); + + }); + + describe('get_os_version', function(){ + + it('should get os version', function(done) { + index.get_os_name(function(err, version) { + should.not.exist(err); + version.should.be.a('string'); + done(); + }); + }); + + }); + describe('set_interval()', function(){ describe('when there is NOT an interval set', function(){
Added a few things in system/index testse.
prey_prey-node-client
train
js
fa0c464d3948fa871d08310b6527dea234262e55
diff --git a/clustering/infinispan/extension/src/main/java/org/jboss/as/clustering/infinispan/subsystem/LocalCacheBuilder.java b/clustering/infinispan/extension/src/main/java/org/jboss/as/clustering/infinispan/subsystem/LocalCacheBuilder.java index <HASH>..<HASH> 100644 --- a/clustering/infinispan/extension/src/main/java/org/jboss/as/clustering/infinispan/subsystem/LocalCacheBuilder.java +++ b/clustering/infinispan/extension/src/main/java/org/jboss/as/clustering/infinispan/subsystem/LocalCacheBuilder.java @@ -72,7 +72,8 @@ public class LocalCacheBuilder extends CacheConfigurationBuilder { PersistenceConfiguration persistence = this.persistence.getValue(); // Auto-enable simple cache optimization if cache is non-transactional and non-persistent - builder.simpleCache(!transaction.transactionMode().isTransactional() && !persistence.usingStores()); + // ISPN-5957 workaround - this doesn't work when statistics are enabled + builder.simpleCache(!transaction.transactionMode().isTransactional() && !persistence.usingStores() && !builder.jmxStatistics().create().available()); if ((transaction.lockingMode() == LockingMode.OPTIMISTIC) && (locking.isolationLevel() == IsolationLevel.REPEATABLE_READ)) { builder.locking().writeSkewCheck(true);
Add workaround for ISPN-<I>.
wildfly_wildfly
train
java
dfd67971c3d06ed8df0ffe17b8a50eec71130c87
diff --git a/lib/build/jake.rb b/lib/build/jake.rb index <HASH>..<HASH> 100644 --- a/lib/build/jake.rb +++ b/lib/build/jake.rb @@ -153,6 +153,17 @@ class Jake return server, addr, port end + def self.run_local_server_with_logger(port, log_file) + addr = localip + log = WEBrick::Log.new log_file + access_log = [[log_file, WEBrick::AccessLog::COMBINED_LOG_FORMAT]] + server = WEBrick::HTTPServer.new :Port => port, :Logger => log, :AccessLog => access_log + port = server.config[:Port] + # puts "LOCAL SERVER STARTED ON #{addr}:#{port}" + Thread.new { server.start } + return server, addr, port + end + def self.reset_spec_server(platform) require 'rest_client' require 'json'
Added to Jake a method to run it with custom logger
rhomobile_rhodes
train
rb
872d91a48dd7938f69b9efe352d566e5fdea99eb
diff --git a/packages/cli/src/commands/server/middleware/getSecurityHeadersMiddleware.js b/packages/cli/src/commands/server/middleware/getSecurityHeadersMiddleware.js index <HASH>..<HASH> 100644 --- a/packages/cli/src/commands/server/middleware/getSecurityHeadersMiddleware.js +++ b/packages/cli/src/commands/server/middleware/getSecurityHeadersMiddleware.js @@ -16,7 +16,13 @@ export default function getSecurityHeadersMiddleware(req, res, next) { req.headers.origin && req.headers.origin !== `http://localhost:${address.port}` ) { - next(new Error('Unauthorized')); + next( + new Error( + 'Unauthorized request from ' + + req.headers.origin + + '. This may happen because of a conflicting browser extension. Please try to disable it and try again.', + ), + ); return; }
feat: Add hint for browser extensions that may break debug (#<I>) * Add hint for browser extensions that may break debug * Update getSecurityHeadersMiddleware.js * Fix lint error
react-native-community_cli
train
js
a6a003d0a711e69c4921bd43545da70ff942e93f
diff --git a/BraintreeApi/src/main/java/com/braintreepayments/api/BraintreeApi.java b/BraintreeApi/src/main/java/com/braintreepayments/api/BraintreeApi.java index <HASH>..<HASH> 100644 --- a/BraintreeApi/src/main/java/com/braintreepayments/api/BraintreeApi.java +++ b/BraintreeApi/src/main/java/com/braintreepayments/api/BraintreeApi.java @@ -318,7 +318,9 @@ public class BraintreeApi { coinbaseAccount.storeInVault(true); } - return create(coinbaseAccount); + return create(new CoinbaseAccountBuilder() + .source("coinbase-browser") + .code(mCoinbase.parseResponse(redirectUri))); } return null; }
Send metadata source as coinbase-browser on coinbase tokenization
braintree_braintree_android
train
java
5c0723f2d5c96588faae192756ffa4b7de53fc9e
diff --git a/convert_to_ejml31.py b/convert_to_ejml31.py index <HASH>..<HASH> 100755 --- a/convert_to_ejml31.py +++ b/convert_to_ejml31.py @@ -64,13 +64,13 @@ F("_D32","_R32") F("_CD64","_CR64") F("_CD32","_CR32") -F("CommonOps.","CommonOps_R64") -F("CovarianceOps.","CovarianceOps_R64") -F("EigenOps.","EigenOps_R64") -F("MatrixFeatures.","MatrixFeatures_R64") -F("NormOps.","NormOps_R64") -F("RandomMatrices.","RandomMatrices_R64") -F("SingularOps.","SingularOps_R64") -F("SpecializedOps.","SpecializedOps_R64") +F("CommonOps\.","CommonOps_R64") +F("CovarianceOps\.","CovarianceOps_R64") +F("EigenOps\.","EigenOps_R64") +F("MatrixFeatures\.","MatrixFeatures_R64") +F("NormOps\.","NormOps_R64") +F("RandomMatrices\.","RandomMatrices_R64") +F("SingularOps\.","SingularOps_R64") +F("SpecializedOps\.","SpecializedOps_R64") print "Finished!"
- covering more situations in convert script
lessthanoptimal_ejml
train
py
0f0a7cf5604fbc09e5cee30ec28d4f284303963d
diff --git a/tests/unit/utils/verify_test.py b/tests/unit/utils/verify_test.py index <HASH>..<HASH> 100644 --- a/tests/unit/utils/verify_test.py +++ b/tests/unit/utils/verify_test.py @@ -10,6 +10,7 @@ import stat import shutil import resource import tempfile +import socket # Import Salt libs import salt.utils @@ -75,6 +76,10 @@ class TestVerify(TestCase): def test_verify_socket(self): self.assertTrue(verify_socket('', 18000, 18001)) + if socket.has_ipv6: + # Only run if Python is built with IPv6 support; otherwise + # this will just fail. + self.assertTrue(verify_socket('[::]', 18000, 18001)) @skipIf(os.environ.get('TRAVIS_PYTHON_VERSION', None) is not None, 'Travis environment does not like too many open files')
Add a unit test for passing IPv6-formatted addresses to verify_socket.
saltstack_salt
train
py
023e3391b36a2d7a99a8e02295eb4d2161c842d8
diff --git a/src/Gzero/Repository/ContentRepository.php b/src/Gzero/Repository/ContentRepository.php index <HASH>..<HASH> 100644 --- a/src/Gzero/Repository/ContentRepository.php +++ b/src/Gzero/Repository/ContentRepository.php @@ -155,7 +155,7 @@ class ContentRepository extends BaseRepository { */ /** - * Get all node ancestors + * Get all ancestors nodes to specific node * * @param Tree $node Tree node * @param array $criteria Array of conditions
KMS-<I>_getAncestors fix function desc
GrupaZero_cms
train
php
fce366894dc548312666ddef8fab9f179380c86b
diff --git a/rpcserver.go b/rpcserver.go index <HASH>..<HASH> 100644 --- a/rpcserver.go +++ b/rpcserver.go @@ -965,13 +965,21 @@ func (r *rpcServer) AddInvoice(ctx context.Context, return nil, err } - // Finally generate the payment hash itself from the pre-image. This - // will be used by clients to query for the state of a particular - // invoice. + // Next, generate the payment hash itself from the pre-image. This will + // be used by clients to query for the state of a particular invoice. rHash := fastsha256.Sum256(paymentPreimage[:]) + // Finally we also create an encoded payment request which allows the + // caller to comactly send the invoice to the payer. + payReqString := zpay32.Encode(&zpay32.PaymentRequest{ + Destination: r.server.identityPriv.PubKey(), + PaymentHash: rHash, + Amount: btcutil.Amount(invoice.Value), + }) + return &lnrpc.AddInvoiceResponse{ - RHash: rHash[:], + RHash: rHash[:], + PaymentRequest: payReqString, }, nil }
rpcserver: return an encoded payment request in AddInvoice This commit modifies the generated response to an “AddInvoice” RPC by including an encoded payment request in the response. This change gives callers a new atomic piece of information that they can present to the payee, to allow completion of the payment in a seamless manner.
lightningnetwork_lnd
train
go
21930081506972a7a4cee7fee0614fe44362dc8c
diff --git a/vcr/cassette.py b/vcr/cassette.py index <HASH>..<HASH> 100644 --- a/vcr/cassette.py +++ b/vcr/cassette.py @@ -38,20 +38,18 @@ class CassetteContextDecorator(object): with contextlib2.ExitStack() as exit_stack: for patcher in build_patchers(cassette): exit_stack.enter_context(patcher) - yield + yield cassette # TODO(@IvanMalison): Hmmm. it kind of feels like this should be somewhere else. cassette._save() def __enter__(self): assert self.__finish is None path, kwargs = self._args_getter() - cassette = self.cls.load(path, **kwargs) - self.__finish = self._patch_generator(cassette) - self.__finish.__next__() - return cassette + self.__finish = self._patch_generator(self.cls.load(path, **kwargs)) + return next(self.__finish) def __exit__(self, *args): - [_ for _ in self.__finish] # this exits the context created by the call to _patch_generator. + next(self.__finish, None) self.__finish = None def __call__(self, function):
Python version agnostic way of getting the next item in the generator.
kevin1024_vcrpy
train
py
067f48473db1c467471aaf0fada14e32a3e86d14
diff --git a/src/Tonic/Exception.php b/src/Tonic/Exception.php index <HASH>..<HASH> 100644 --- a/src/Tonic/Exception.php +++ b/src/Tonic/Exception.php @@ -7,5 +7,6 @@ namespace Tonic; */ class Exception extends \Exception { - protected $message = 'An unknown Tonic exception occurred'; + protected $message = 'An unknown Tonic exception occurred'; + protected $code = 500; }
Default Error code in Tonic\Exception Moving the default error code of <I> from dispatch.php to Tonic\Exception.php
peej_tonic
train
php
2a323e719208f0bff230ec7fa3694557fa8778b0
diff --git a/lib/server.js b/lib/server.js index <HASH>..<HASH> 100644 --- a/lib/server.js +++ b/lib/server.js @@ -45,6 +45,7 @@ var Server = exports.Server = function (root, config, components) { , body_parser: true , cookie_parser: true , method_override: true + , cleanup_response: false }; this.useragent_redirects = []; this.error_handler = null; @@ -89,6 +90,24 @@ Server.prototype.create = function () { app = express(); } + //Cleanup cyclic references and certain objects that may cause leaks + if (this.components.cleanup_response) { + var cleanupResponse = function() { + if (this.req) { + delete this.req.next; + delete this.req.res; + delete this.req.query; + delete this.req.trailers; + } + delete this.next; + delete this.req; + }; + app.use(function (request, response, next) { + response.on('end', cleanupResponse); + response.on('close', cleanupResponse); + }); + } + //Send 400 when a malformed url is encountered app.use(function (request, response, next) { try {
Add an experimental middleware to cleanup the response object
sydneystockholm_shoes
train
js
75c9c7dd4a2ac48c65552013adc2c290ec00931d
diff --git a/lib/fase-2/commonality.js b/lib/fase-2/commonality.js index <HASH>..<HASH> 100644 --- a/lib/fase-2/commonality.js +++ b/lib/fase-2/commonality.js @@ -19,6 +19,11 @@ Commonality.prototype.collect = function (nodelist) { this.matrix.summarise(); }; +var ttest_options = { + alpha: 0.05, + alternative: "greater" +}; + Commonality.prototype.reduce = function () { var maxRemoval = this.top.getText().length * 0.35; @@ -36,8 +41,6 @@ Commonality.prototype.reduce = function () { } else if (this.matrix.cellTextLength(a, b) > maxRemoval) { - console.log('skip: ' + this.matrix.cellName(a, b)); - console.log('cause: ' + this.matrix.cellTextLength(a, b) + ' < ' + maxRemoval); continue; } @@ -58,10 +61,7 @@ Commonality.prototype.reduce = function () { } // Check if the maxdataset mean is greater than the current tagname - else if (ttest(best, compare, { - alpha: 0.05, - alternative: "greater" - }).valid() === false) { + else if (ttest(best, compare, ttest_options).valid() === false) { this.matrix.removeCell(a, b); } }
[cleanup] t-test with alpha = <I> looks good
AndreasMadsen_article
train
js
c7c55399bee62a7178a60ca2ff320078b2df4ff2
diff --git a/zipline/examples/dual_ema_talib.py b/zipline/examples/dual_ema_talib.py index <HASH>..<HASH> 100644 --- a/zipline/examples/dual_ema_talib.py +++ b/zipline/examples/dual_ema_talib.py @@ -38,8 +38,8 @@ class DualEMATaLib(TradingAlgorithm): def initialize(self, short_window=20, long_window=40): # Add 2 mavg transforms, one with a long window, one # with a short window. - self.short_ema_trans = EMA('AAPL', window_length=short_window) - self.long_ema_trans = EMA('AAPL', window_length=long_window) + self.short_ema_trans = EMA(window_length=short_window) + self.long_ema_trans = EMA(window_length=long_window) # To keep track of whether we invested in the stock or not self.invested = False
BUG: Fix TALib example due to parameter changes. Remove use of `sid` parameter, which was recently removed.
quantopian_zipline
train
py
5538af98a43fb7198907cad10ec73c5378e59bb5
diff --git a/desktop/app/menu-bar.js b/desktop/app/menu-bar.js index <HASH>..<HASH> 100644 --- a/desktop/app/menu-bar.js +++ b/desktop/app/menu-bar.js @@ -28,7 +28,10 @@ export default function () { resizable: false, preloadWindow: true, icon: icon, - showDockIcon: true, // This causes menubar to not touch dock icon, yeah it's weird + // Without this flag set, menubar will hide the dock icon when the app + // ready event fires. We manage the dock icon ourselves, so this flag + // prevents menubar from changing the state. + 'show-dock-icon': true, }) ipcMain.on('showTrayLoading', () => {
Update showDockIcon option to reflect upstream rename
keybase_client
train
js
217a40d1bd7c1eabef6674ab1a3e0b2146d795a9
diff --git a/src/Http/FormAuthenticationHook.php b/src/Http/FormAuthenticationHook.php index <HASH>..<HASH> 100644 --- a/src/Http/FormAuthenticationHook.php +++ b/src/Http/FormAuthenticationHook.php @@ -36,10 +36,6 @@ class FormAuthenticationHook implements BeforeHookInterface if ('/_form/auth/verify' === $request->getPathInfo()) { return; } - // ignore POST to token endpoint - if ('/_oauth/token' === $request->getPathInfo()) { - return; - } } if ($this->session->has('_form_auth_user')) { diff --git a/src/Http/TwoFactorHook.php b/src/Http/TwoFactorHook.php index <HASH>..<HASH> 100644 --- a/src/Http/TwoFactorHook.php +++ b/src/Http/TwoFactorHook.php @@ -41,7 +41,6 @@ class TwoFactorHook implements BeforeHookInterface '/_form/auth/logout', '/_two_factor/auth/verify/totp', '/_two_factor/auth/verify/yubi', - '/_oauth/token', ]; if (in_array($request->getPathInfo(), $allowedUris, true) && 'POST' === $request->getRequestMethod()) {
oauth token path is obsolete, remove it from ignored URLs
eduvpn_vpn-lib-common
train
php,php