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
ebd77d00d42fdfaef08bc770e308d10752ac496b
diff --git a/gwpy/timeseries/io/gwf/framecpp.py b/gwpy/timeseries/io/gwf/framecpp.py index <HASH>..<HASH> 100644 --- a/gwpy/timeseries/io/gwf/framecpp.py +++ b/gwpy/timeseries/io/gwf/framecpp.py @@ -21,6 +21,8 @@ from __future__ import division +from math import ceil + from six import PY2 import numpy @@ -200,7 +202,7 @@ def read_gwf(framefile, channels, start=None, end=None, ctype=None, dimend = dimstart + arr.size * dx a = int(max(0., float(start-dimstart)) / dx) if end: - b = arr.size - int(max(0., float(dimend-end)) / dx) + b = int(arr.size - ceil(max(0., float(dimend-end)) / dx)) else: b = None # if file only has ony frame, error on overlap problems
timeseries.io.gwf.framecpp: fixed rounding error need to round array sample index down (not up)
gwpy_gwpy
train
py
ded42485b2dacbdcf6d8a4fe811d252c1d389f97
diff --git a/bfg9000/build_inputs.py b/bfg9000/build_inputs.py index <HASH>..<HASH> 100644 --- a/bfg9000/build_inputs.py +++ b/bfg9000/build_inputs.py @@ -2,10 +2,7 @@ from . import path from . import utils class Node(object): - install_root = path.Path.basedir - - def __init__(self, name, source): - self.path = path.Path(name, source, self.install_root) + def __init__(self): self.creator = None def __repr__(self): @@ -14,14 +11,19 @@ class Node(object): ) class File(Node): - pass + install_root = path.Path.basedir + + def __init__(self, name, source): + Node.__init__(self) + self.path = path.Path(name, source, self.install_root) class Directory(File): pass class Phony(Node): def __init__(self, name): - Node.__init__(self, name, path.Path.builddir) + Node.__init__(self) + self.path = name class Edge(object): def __init__(self, target, extra_deps=None):
Move the Path constructor from Nodes to Files Now, Phony objects' path attribute is just a string, since they don't actually refer to things with paths anyway.
jimporter_bfg9000
train
py
25a819d4ed25ea439afacfdf41e3f4a4a944c1dc
diff --git a/src/helpers.php b/src/helpers.php index <HASH>..<HASH> 100644 --- a/src/helpers.php +++ b/src/helpers.php @@ -25,7 +25,7 @@ if (!function_exists('asset')) { */ function asset(string $path = null): string { - return sprintf('%s/%s', get_template_directory_uri(), ltrim($path, '/')); + return sprintf('%s/%s', get_stylesheet_directory_uri(), ltrim($path, '/')); } } @@ -87,7 +87,7 @@ if (!function_exists('mix')) { $manifestDirectory = "/{$manifestDirectory}"; } - if (file_exists(template_path($manifestDirectory.'/hot'))) { + if (file_exists(stylesheet_path($manifestDirectory.'/hot'))) { return new HtmlString("//localhost:8080{$path}"); }
Make asset() and mix() read from child theme instead
wordplate_framework
train
php
b01c6c836c0e6b75203f87476c9b20e5637066e2
diff --git a/lib/active_record/connection_adapters/jdbc_adapter.rb b/lib/active_record/connection_adapters/jdbc_adapter.rb index <HASH>..<HASH> 100644 --- a/lib/active_record/connection_adapters/jdbc_adapter.rb +++ b/lib/active_record/connection_adapters/jdbc_adapter.rb @@ -74,7 +74,9 @@ module JdbcSpec alias :#{meth}_pre_pk :#{meth} def #{meth}(include_primary_key = true, *args) #:nodoc: aq = #{meth}_pre_pk(include_primary_key, *args) - aq[#{pk_hash_key}] = #{pk_hash_value} if include_primary_key && aq[#{pk_hash_key}].nil? + if connection.is_a?(JdbcSpec::Oracle) || connection.is_a?(JdbcSpec::Mimer) + aq[#{pk_hash_key}] = #{pk_hash_value} if include_primary_key && aq[#{pk_hash_key}].nil? + end aq end }
For QuotedPrimaryKeyExtension, still guard on each call in case multiple DBs are present
jruby_activerecord-jdbc-adapter
train
rb
c9f3ff9c3d4f3608edc186506e55fb63e49b81fb
diff --git a/library/src/com/nineoldandroids/view/animation/AnimatorProxy.java b/library/src/com/nineoldandroids/view/animation/AnimatorProxy.java index <HASH>..<HASH> 100644 --- a/library/src/com/nineoldandroids/view/animation/AnimatorProxy.java +++ b/library/src/com/nineoldandroids/view/animation/AnimatorProxy.java @@ -1,7 +1,5 @@ package com.nineoldandroids.view.animation; -import java.lang.ref.WeakReference; -import java.util.WeakHashMap; import android.graphics.Camera; import android.graphics.Matrix; import android.graphics.RectF; @@ -10,6 +8,9 @@ import android.view.View; import android.view.animation.Animation; import android.view.animation.Transformation; +import java.lang.ref.WeakReference; +import java.util.WeakHashMap; + /** * A proxy class to allow for modifying post-3.0 view properties on all pre-3.0 * platforms. <strong>DO NOT</strong> wrap your views with this class if you @@ -249,7 +250,7 @@ public final class AnimatorProxy extends Animation { } private void invalidateAfterUpdate() { View view = mView.get(); - if (view == null) { + if (view == null || view.getParent() == null) { return; }
Do not invalidate parent if view is not attached to anything. Closes #<I>.
JakeWharton_NineOldAndroids
train
java
2ee2b12792228e2de9cd2e0baf8efd3c6f50ed01
diff --git a/library/BrowserDetector/Detector/Os/Ios.php b/library/BrowserDetector/Detector/Os/Ios.php index <HASH>..<HASH> 100644 --- a/library/BrowserDetector/Detector/Os/Ios.php +++ b/library/BrowserDetector/Detector/Os/Ios.php @@ -174,7 +174,8 @@ class Ios new \BrowserDetector\Detector\Browser\Mobile\GooglePlus(), new \BrowserDetector\Detector\Browser\Mobile\NetNewsWire(), new \BrowserDetector\Detector\Browser\Mobile\Incredimail(), - new \BrowserDetector\Detector\Browser\Mobile\Lunascape() + new \BrowserDetector\Detector\Browser\Mobile\Lunascape(), + new \BrowserDetector\Detector\Browser\Mobile\MqqBrowser() ); $chain = new \BrowserDetector\Detector\Chain();
added MQQBrowser to Browser Chain for iOS
mimmi20_BrowserDetector
train
php
c2c0b86c3a6ded6fb8ccbd85d2faa5e2221d5c23
diff --git a/lib/cancan/inherited_resource.rb b/lib/cancan/inherited_resource.rb index <HASH>..<HASH> 100644 --- a/lib/cancan/inherited_resource.rb +++ b/lib/cancan/inherited_resource.rb @@ -6,7 +6,13 @@ module CanCan @controller.send :association_chain @controller.instance_variable_get("@#{instance_name}") elsif new_actions.include? @params[:action].to_sym - @controller.send :build_resource + + resource = @controller.send :build_resource + initial_attributes.each do |attr_name, value| + resource.send("#{attr_name}=", value) + end + resource + else @controller.send :resource end
initialise attributes after a resource is created by an InheritedResources controller
ryanb_cancan
train
rb
4dc334863d42e23d92b4098721d7fe49874dec4d
diff --git a/test/web-platform-tests/index.js b/test/web-platform-tests/index.js index <HASH>..<HASH> 100644 --- a/test/web-platform-tests/index.js +++ b/test/web-platform-tests/index.js @@ -86,7 +86,7 @@ const runWebPlatformTest = require("./run-web-platform-test")(exports, path.reso "html/dom/dynamic-markup-insertion/document-writeln/document.writeln-02.html", "html/dom/dynamic-markup-insertion/document-writeln/document.writeln-03.html", "html/dom/elements/global-attributes/classlist-nonstring.html", - "html/infrastructure/urls/terminology-0/document-base-url.html", + // "html/infrastructure/urls/terminology-0/document-base-url.html", // we don't support srcdoc <base> correctly "html/semantics/forms/the-input-element/input-textselection-01.html", // "html/semantics/scripting-1/the-template-element/additions-to-parsing-xhtml-documents/node-document.html", // templates in XHTML are totally messed up // "html/semantics/scripting-1/the-template-element/additions-to-parsing-xhtml-documents/template-child-nodes.html", // templates in XHTML are totally messed up
Comment out base URL WPT for now We don't support srcdoc very well.
jsdom_jsdom
train
js
5975c431907d9f47ed4765546b2b9ec91bb01188
diff --git a/checkers/exceptions.py b/checkers/exceptions.py index <HASH>..<HASH> 100644 --- a/checkers/exceptions.py +++ b/checkers/exceptions.py @@ -68,7 +68,7 @@ MSGS = { 'Used when except clauses are not in the correct order (from the ' 'more specific to the more generic). If you don\'t fix the order, ' 'some exceptions may not be catched by the most specific handler.'), - 'E0702': ('Raising %s while only classes, instances or string are allowed', + 'E0702': ('Raising %s while only classes or instances are allowed', 'raising-bad-type', 'Used when something which is neither a class, an instance or a \ string is raised (i.e. a `TypeError` will be raised).'),
Amend the message for raising-bad-type, by not specifying strings.
PyCQA_pylint
train
py
553777eadc88ae348b2d8733ee0135500a6c4abb
diff --git a/bin/build.js b/bin/build.js index <HASH>..<HASH> 100644 --- a/bin/build.js +++ b/bin/build.js @@ -181,17 +181,20 @@ var build = function (args, callback) { } fs.writeFileSync(configPath, JSON.stringify(config)); - - global.libxml = require("libxml"); - - // start optimizing - requirejs.optimize(optimizeConfig, function (results) { + var writeBackConfig = function(){ // write back normal config delete config['optimizedXAML']; config.baseUrl = realBaseUrl; fs.writeFileSync(configPath, JSON.stringify(config)); + }; + + global.libxml = require("libxml"); + // start optimizing + requirejs.optimize(optimizeConfig, function (results) { + // write back normal config + writeBackConfig(); var indexFilePath = path.join(buildDirPath, buildConfig.indexFile || "index.html"); var indexFile = fs.readFileSync(indexFilePath, "utf8"); @@ -207,10 +210,13 @@ var build = function (args, callback) { } fs.writeFileSync(indexFilePath, content); }, function(err){ + writeBackConfig(); + console.log(err); }); }; + build.usage = "rappidjs build"; module.exports = build;
fixed writing back config when error happens
rappid_rAppid.js
train
js
1835f2712389d995356c1c93ade3b6844580ad1b
diff --git a/erizo_controller/erizoController/roomController.js b/erizo_controller/erizoController/roomController.js index <HASH>..<HASH> 100644 --- a/erizo_controller/erizoController/roomController.js +++ b/erizo_controller/erizoController/roomController.js @@ -23,7 +23,7 @@ exports.RoomController = function (spec) { var rpc = spec.rpc; - var KEELALIVE_INTERVAL = 5*1000; + var KEEPLALIVE_INTERVAL = 5*1000; var eventListeners = []; @@ -39,13 +39,13 @@ exports.RoomController = function (spec) { }; var sendKeepAlive = function() { - for (var publisher_id in erizos) { + for (var publisher_id in erizos) {º var erizo_id = erizos[publisher_id]; rpc.callRpc(getErizoQueue(publisher_id), "keepAlive", [], {callback: callbackFor(erizo_id, publisher_id)}); } }; - var keepAliveLoop = setInterval(sendKeepAlive, KEELALIVE_INTERVAL); + var keepAliveLoop = setInterval(sendKeepAlive, KEEPLALIVE_INTERVAL); var createErizoJS = function(publisher_id, callback) { rpc.callRpc("ErizoAgent", "createErizoJS", [publisher_id], {callback: function(erizo_id) {
Changed KEEPALIVE variable name
lynckia_licode
train
js
d2b7178b4a2daf9cf6c9bf434c10df29ca54da0b
diff --git a/lib/jsduck/event_table.rb b/lib/jsduck/event_table.rb index <HASH>..<HASH> 100644 --- a/lib/jsduck/event_table.rb +++ b/lib/jsduck/event_table.rb @@ -11,7 +11,7 @@ module JsDuck @id = @cls.full_name + "-events" @title = "Public Events" @column_title = "Event" - @row_class = "method-row" + @row_class = "event-row" @short_params = ShortParams.new @long_params = LongParams.new(@cls) end
Fix CSS class name for events table rows. Because this class name was used as part of the cache key, a class having method and event with same name would wrongly use the cached version of method in place of event. Now fixed.
senchalabs_jsduck
train
rb
d71092e6beb2343b35415fa828cc9d074462b636
diff --git a/src/sap.ui.table/src/sap/ui/table/Table.js b/src/sap.ui.table/src/sap/ui/table/Table.js index <HASH>..<HASH> 100644 --- a/src/sap.ui.table/src/sap/ui/table/Table.js +++ b/src/sap.ui.table/src/sap/ui/table/Table.js @@ -2015,7 +2015,7 @@ sap.ui.define([ var iVisibleRowCount = this.getVisibleRowCount(); if (iFixedBottomRowCount > 0 && (iVisibleRowCount - iFixedBottomRowCount) < iBindingLength) { - aContexts = this._getContexts(iBindingLength - iFixedBottomRowCount, iFixedBottomRowCount, 1); + aContexts = this._getContexts(iBindingLength - iFixedBottomRowCount, iFixedBottomRowCount); } return aContexts;
[INTERNAL][FIX] Table: Get fixed bottom contexts without a threshold Getting the contexts of the fixed bottom rows does not require a threshold. Change-Id: I6bfbb<I>b4e2e3fbb7a5c<I>b<I>a<I>
SAP_openui5
train
js
4ff6c38a889cdab3c7e498efd53a015805909026
diff --git a/tests/Large/Entity/Fields/Traits/String/IsbnFieldTraitTest.php b/tests/Large/Entity/Fields/Traits/String/IsbnFieldTraitTest.php index <HASH>..<HASH> 100644 --- a/tests/Large/Entity/Fields/Traits/String/IsbnFieldTraitTest.php +++ b/tests/Large/Entity/Fields/Traits/String/IsbnFieldTraitTest.php @@ -36,7 +36,7 @@ class IsbnFieldTraitTest extends AbstractFieldTraitLargeTest /** * @var IsbnFieldInterface $entity */ - $entity = new $entityFqn($this->container->get(EntityValidatorFactory::class)); + $entity = $this->createEntity($entityFqn); $this->expectException(ValidationException::class); $entity->setIsbn($invalidIsbn); }
need to use teh factory
edmondscommerce_doctrine-static-meta
train
php
e11f5886306fb3d9e985ea55de3e97b0ce878b85
diff --git a/jws/jws.go b/jws/jws.go index <HASH>..<HASH> 100644 --- a/jws/jws.go +++ b/jws/jws.go @@ -268,7 +268,7 @@ func Verify(buf []byte, alg jwa.SignatureAlgorithm, key interface{}) (ret []byte return nil, errors.New(`invalid JWS message format (missing payload)`) } - // if we're using the flattened serialization format, then m.Signature + // if we're using the compact serialization format, then m.Signature // will be non-nil if len(proxy.Signature) > 0 { if len(proxy.Signatures) > 0 { @@ -466,7 +466,7 @@ func parseJSON(src io.Reader) (result *Message, err error) { if len(proxy.Signature) > 0 { if len(proxy.Signatures) > 0 { - return nil, errors.New("invalid message: mixed flattened/full json serialization") + return nil, errors.New("invalid message: mixed compact/full json serialization") } encodedSig, err := proxy.encodedSignature()
I probably didn't know the right terminology back then
lestrrat-go_jwx
train
go
dbc9f9cd8dd17b3d09ab140a2596f64c6d9c0c22
diff --git a/src/events.js b/src/events.js index <HASH>..<HASH> 100644 --- a/src/events.js +++ b/src/events.js @@ -69,14 +69,18 @@ export default class EventHandler { const bundle = packet.value return bundle.bundleElements.forEach((bundleItem) => { - if (packet.value instanceof Bundle) { + if (bundleItem instanceof Bundle) { if (bundle.timetag.value.timestamp() < bundleItem.timetag.value.timestamp()) { throw new Error('OSC Bundle timestamp is older than the timestamp of enclosed Bundles') } return this.dispatch(bundleItem) } else if (bundleItem instanceof Message) { const message = bundleItem - return this.notify(message.address, message, bundle.timetag.value.timestamp()) + return this.notify( + message.address, + message, + bundle.timetag.value.timestamp() + ) } throw new Error('OSC EventHander dispatch() can\'t dispatch unknown Packet value')
Correctly distinct between Bundle and Message instances
adzialocha_osc-js
train
js
afc09c8784262ef540e61b241128fe957eaabe79
diff --git a/test/ArrayAuthenticatorTest.php b/test/ArrayAuthenticatorTest.php index <HASH>..<HASH> 100644 --- a/test/ArrayAuthenticatorTest.php +++ b/test/ArrayAuthenticatorTest.php @@ -47,5 +47,11 @@ class ArrayAuthenticatorTest extends \PHPUnit_Framework_TestCase ]); $this->assertFalse($authenticator(["user" => "root", "password" => "nosuch"])); $this->assertFalse($authenticator(["user" => "nosuch", "password" => "nosuch"])); + + /* Should handle as hash and not cleartext */ + $this->assertFalse($authenticator([ + "user" => "luser", + "password" => '$2y$10$Tm03qGT4FLqobzbZcfLDcOVIwZEpg20QZYffleeA2jfcClLpufYpy' + ])); } }
Make sure hash is not handled as cleartext
tuupola_slim-basic-auth
train
php
61b5740ab65196eb874dbe32f6bbd883b3e7c6de
diff --git a/lib/rudy/cli/disks.rb b/lib/rudy/cli/disks.rb index <HASH>..<HASH> 100644 --- a/lib/rudy/cli/disks.rb +++ b/lib/rudy/cli/disks.rb @@ -29,7 +29,7 @@ module Rudy if @option.backups d.list_backups.each_with_index do |b, index| puts ' %s' % b.name - break if @option.all.nil? && index >= 2 # display only 3, unless all + ##break if @option.all.nil? && index >= 2 # display only 3, unless all end end end
Now displays all backups for each disk
solutious_rudy
train
rb
714a72cdd4c808db48facae64d43d06f2bf98444
diff --git a/fs/torrentfs_test.go b/fs/torrentfs_test.go index <HASH>..<HASH> 100644 --- a/fs/torrentfs_test.go +++ b/fs/torrentfs_test.go @@ -8,7 +8,6 @@ import ( _ "net/http/pprof" "os" "path/filepath" - "strings" "testing" "time" @@ -102,11 +101,11 @@ func TestUnmountWedged(t *testing.T) { fs := New(client) fuseConn, err := fuse.Mount(layout.MountDir) if err != nil { - msg := fmt.Sprintf("error mounting: %s", err) - if strings.Contains(err.Error(), "fuse") || err.Error() == "exit status 71" { - t.Skip(msg) + switch err.Error() { + case "cannot locate OSXFUSE": + t.Skip(err) } - t.Fatal(msg) + t.Fatal(err) } go func() { server := fusefs.New(fuseConn, &fusefs.Config{
Tighten FUSE test skipping
anacrolix_torrent
train
go
2a40fc2cd5728fe2e507ee39579c6fee1b79738b
diff --git a/src/flexicarousel.es6.js b/src/flexicarousel.es6.js index <HASH>..<HASH> 100644 --- a/src/flexicarousel.es6.js +++ b/src/flexicarousel.es6.js @@ -170,6 +170,30 @@ export default class Carousel { this.current = to; } + // ------------------------------------- Event Listeners ------------------------------------- // + + _createHandleBindings() { + + return { + 'touchstart': this._dragStart.bind(this), + 'touchmove': this._drag.bind(this), + 'touchend': this._dragEnd.bind(this), + 'touchcancel': this._dragEnd.bind(this), + 'mousedown': this._dragStart.bind(this), + 'mousemove': this._drag.bind(this), + 'mouseup': this._dragEnd.bind(this), + 'mouseleave': this._dragEnd.bind(this), + 'click': this._checkDragThreshold.bind(this) + }; + + } + + _createWindowBindings() { + return { + 'resize': this._updateView.bind(this), + 'orientationchange': this._updateView.bind(this) + }; + } // ------------------------------------- Drag Events ------------------------------------- //
adding functions that create bound functions as listeners for window and the carousel handle
hugeinc_component-carousel
train
js
bceb5a2bf80c1a2cc18fb2975e20336695992b2c
diff --git a/cablemap.core/cablemap/core/c14n.py b/cablemap.core/cablemap/core/c14n.py index <HASH>..<HASH> 100644 --- a/cablemap.core/cablemap/core/c14n.py +++ b/cablemap.core/cablemap/core/c14n.py @@ -272,6 +272,7 @@ _SIGNER_C14N = { u'SHLICHER': u'SCHLICHER', u'BERYLE': u'BEYRLE', u'BYERLE': u'BEYRLE', + u'CULBERSTON': u'CULBERTSON', } def canonicalize_signer(signer):
Added more names to c<I>n
heuer_cablemap
train
py
2719e990b139fa4d6b440968d9a35a6419991622
diff --git a/lib/generators/cucumber/install/install_generator.rb b/lib/generators/cucumber/install/install_generator.rb index <HASH>..<HASH> 100644 --- a/lib/generators/cucumber/install/install_generator.rb +++ b/lib/generators/cucumber/install/install_generator.rb @@ -41,7 +41,7 @@ module Cucumber return unless File.exist?('config/database.yml') unless File.read('config/database.yml').include? 'cucumber:' gsub_file 'config/database.yml', /^test:.*\n/, "test: &test\n" - gsub_file 'config/database.yml', /\z/, "\ncucumber:\n <<: *test" + gsub_file 'config/database.yml', /\z/, "\ncucumber:\n <<: *test\n" # Since gsub_file doesn't ask the user, just inform user that the file was overwritten. puts ' force config/database.yml'
Add new line to end of generated database.yml Be a good Unix citizen and end with a newline - <URL>
cucumber_cucumber-rails
train
rb
1824d0251737a9c4915f9f9594db4fd92755b12b
diff --git a/src/findUnused.js b/src/findUnused.js index <HASH>..<HASH> 100644 --- a/src/findUnused.js +++ b/src/findUnused.js @@ -8,7 +8,7 @@ export default function findUnused(locale, keysUsed) { keysUsed.forEach((keyUsed) => { // Dynamic key if (keyUsed.includes('*')) { - const regExp = new RegExp(keyUsed.replace('*', '(.+)')); + const regExp = new RegExp(`^${keyUsed.replace('*', '(.+)')}$`); Object.keys(locale) .forEach((localeKey) => { diff --git a/src/findUnused.spec.js b/src/findUnused.spec.js index <HASH>..<HASH> 100644 --- a/src/findUnused.spec.js +++ b/src/findUnused.spec.js @@ -52,5 +52,18 @@ describe('#findUnused()', () => { }, ], unused, 'Should report one unused key.'); }); + + it('should do an exact match even with dynamic keys', () => { + const missing = findUnused({ + 'bar.key.foo': 'Key 1', + }, ['key.*']); + + assert.deepEqual([ + { + key: 'bar.key.foo', + type: 'UNUSED', + }, + ], missing, 'Should report one missing key.'); + }); }); });
[findUnused] Do an exact match even with dynamic keys
oliviertassinari_i18n-extract
train
js,js
1119b502597b29a14fdebe9108d799fcd4d4d559
diff --git a/src/Association/HasManyViaAssociation.php b/src/Association/HasManyViaAssociation.php index <HASH>..<HASH> 100644 --- a/src/Association/HasManyViaAssociation.php +++ b/src/Association/HasManyViaAssociation.php @@ -53,7 +53,7 @@ class HasManyViaAssociation extends HasManyAssociation implements AssociationInt $result[] = ' */'; $result[] = ' private function ' . $this->getFinderMethodName() . '()'; $result[] = ' {'; - $result[] = ' return $this->pool->find(' . var_export($this->getInstanceClassFrom($namespace, $target_type), true) . ')->join(' . var_export($this->getInstanceClassFrom($namespace, $intermediary_type), true) . ')->where("`' . $this->getFkFieldNameFrom($source_type) . '` = ?", $this->getId());'; + $result[] = ' return $this->pool->find(' . var_export($this->getInstanceClassFrom($namespace, $target_type), true) . ')->join(' . var_export($this->getInstanceClassFrom($namespace, $intermediary_type), true) . ')->where("`' . $intermediary_type->getTableName() . '`.`' . $this->getFkFieldNameFrom($source_type) . '` = ?", $this->getId());'; $result[] = ' }'; } }
Prepare finder for has many via association
activecollab_databasestructure
train
php
d733cd0c16363c9786f377353e14f10de6b6fe64
diff --git a/Gruntfile.js b/Gruntfile.js index <HASH>..<HASH> 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -32,10 +32,18 @@ module.exports = function ( grunt ) { '!package.json', '!package-lock.json', '!phpcs.ruleset.xml', + '!phpcs.xml', + '!phpcs.xml.dist', '!phpunit.xml.dist', '!README.md', + '!phpcs-report-full.txt', '!report-full.txt', + '!report-full-2.7.txt', + '!report-full-after.txt', + '!phpcs-report-source.txt', '!report-source.txt', + '!report-source-2.7.txt', + '!report-source-after.txt', '!rollup.config.js' ];
Update grunt release exclusions
pods-framework_pods
train
js
3fe5c1096027aef711cc465e821373d1600803f7
diff --git a/kernel/classes/ezcontentclass.php b/kernel/classes/ezcontentclass.php index <HASH>..<HASH> 100644 --- a/kernel/classes/ezcontentclass.php +++ b/kernel/classes/ezcontentclass.php @@ -121,7 +121,7 @@ class eZContentClass extends eZPersistentObject 'object_count' => 'objectCount', 'version_count' => 'versionCount', 'version_status' => 'versionStatus', - 'remote_id' => 'remoteID', + 'remote_id' => 'remoteID', // Note: This overrides remote_id field 'ingroup_list' => 'fetchGroupList', 'ingroup_id_list' => 'fetchGroupIDList', 'match_ingroup_id_list' => 'fetchMatchGroupIDList', @@ -367,23 +367,6 @@ class eZContentClass extends eZPersistentObject return $classList; } - function attribute( $attr ) - { - switch( $attr ) - { - case 'remote_id': - { - return $this->remoteID(); - } break; - - default: - { - return eZPersistentObject::attribute( $attr ); - } break; - } - return null; - } - /*! \return The creator of the class as an eZUser object by using the $CreatorID as user ID. */
- Removed code for remote_id attribute in attribute(), it is now handled by eZPersistentObject which will check function_attributes before fields. git-svn-id: file:///home/patrick.allaert/svn-git/ezp-repo/ezpublish/trunk@<I> a<I>eee8c-daba-<I>-acae-fa<I>f<I>
ezsystems_ezpublish-legacy
train
php
5fd16ea9f1c8f259c4826ef78b08f1c1ad62225a
diff --git a/zipfs/file.go b/zipfs/file.go index <HASH>..<HASH> 100644 --- a/zipfs/file.go +++ b/zipfs/file.go @@ -130,7 +130,7 @@ func (f *File) Readdir(count int) (fi []os.FileInfo, err error) { } for _, zipfile := range zipfiles { fi = append(fi, zipfile.FileInfo()) - if count >= 0 && len(fi) >= count { + if count > 0 && len(fi) >= count { break } } @@ -144,7 +144,7 @@ func (f *File) Readdirnames(count int) (names []string, err error) { } for filename := range zipfiles { names = append(names, filename) - if count >= 0 && len(names) >= count { + if count > 0 && len(names) >= count { break } }
Fix zipfs.Readdir and zipfs.Readdirnames If count == 0 all files should be returned as of <URL>
spf13_afero
train
go
83217f02adc8eee695c874d0032ef14c940b52a5
diff --git a/lib/collection/response.js b/lib/collection/response.js index <HASH>..<HASH> 100644 --- a/lib/collection/response.js +++ b/lib/collection/response.js @@ -386,6 +386,17 @@ _.assign(Response, /** @lends Response */ { _postman_propertyName: 'Response', /** + * Check whether an object is an instance of {@link ItemGroup}. + * + * @param {*} obj + * @returns {Boolean} + */ + isResponse: function (obj) { + return obj && ((obj instanceof Response) || + _.inSuperChain(obj.constructor, '_postman_propertyName', Response._postman_propertyName)); + }, + + /** * Converts the response object from the request module to the postman responseBody format * * @param {Object} response The response object, as received from the request module
Added Response.isResponse
postmanlabs_postman-collection
train
js
0f28090fa05b181423961bc9170b1195153127c0
diff --git a/tests/jobs.py b/tests/jobs.py index <HASH>..<HASH> 100644 --- a/tests/jobs.py +++ b/tests/jobs.py @@ -105,7 +105,7 @@ class BackfillJobTest(unittest.TestCase): # run with timeout because this creates an infinite loop if not # caught - with timeout(seconds=15): + with timeout(seconds=30): job.run() ti = TI(
Increase timeout time for unit test Travis runs are occasionally failing this test. Increasing the timeout should help.
apache_airflow
train
py
1e11436b7344de04c3ff73ab1dd0d32ea4d7298e
diff --git a/lib/express-useragent.js b/lib/express-useragent.js index <HASH>..<HASH> 100644 --- a/lib/express-useragent.js +++ b/lib/express-useragent.js @@ -24,7 +24,9 @@ 'pingdom', 'tumblr ', 'Embedly', - 'spbot' + 'spbot', + 'apex', + 'gsa-crawler' ]; var IS_BOT_REGEXP = new RegExp('^.*(' + BOTS.join('|') + ').*$');
Add apex and gsa-crawler to list of BOTS
biggora_express-useragent
train
js
d48c673c2bf6203f164f7dff8ed06ca616caf475
diff --git a/src/http-server/src/Router/HandlerMapping.php b/src/http-server/src/Router/HandlerMapping.php index <HASH>..<HASH> 100644 --- a/src/http-server/src/Router/HandlerMapping.php +++ b/src/http-server/src/Router/HandlerMapping.php @@ -164,7 +164,7 @@ class HandlerMapping extends AbstractRouter implements HandlerMappingInterface protected function collectParamRoute(string $route, array $methods, array $conf) { $conf['original'] = $route; - $params = $this->getAvailableParams($opts['params'] ?? []); + $params = $this->getAvailableParams($conf['option']['params'] ?? []); list($first, $conf) = $this->parseParamRoute($route, $params, $conf); // route string have regular @@ -366,7 +366,10 @@ class HandlerMapping extends AbstractRouter implements HandlerMappingInterface } } - return [self::NOT_FOUND, \explode(',', \trim($allowedMethods, ','))]; + return [ + self::NOT_FOUND, + $allowedMethods ? \explode(',', \rtrim($allowedMethods, ',')) : [] + ]; } /**
fix: cannot setting params. Sometimes 'notFound' would be considered 'notAllowed'
swoft-cloud_swoft-http-message
train
php
4ebe3fc59aaed2693efbf4128c14dbfe356495f7
diff --git a/lib/brancher/database_rename_service.rb b/lib/brancher/database_rename_service.rb index <HASH>..<HASH> 100644 --- a/lib/brancher/database_rename_service.rb +++ b/lib/brancher/database_rename_service.rb @@ -9,7 +9,7 @@ module Brancher database_extname = File.extname(configuration["database"]) database_name = configuration["database"].gsub(%r{#{database_extname}$}) { "" } database_name += suffix unless database_name =~ %r{#{suffix}$} - configuration["database"] = database_name + database_extname + configuration["database"] = cap_length(database_name + database_extname) configurations end @@ -22,6 +22,12 @@ module Brancher private + def cap_length(database_full_name) + max_length = 63 + database_full_name = database_full_name.slice(0,max_length-22) + [Digest::MD5.digest(database_full_name)].pack("m0").slice(0,22) if database_full_name.length > max_length + database_full_name + end + def env Rails.env end
cap database name length cap database name length to <I> characters, this conforms to mysql and postgres default limitations for name lengths.
naoty_brancher
train
rb
34ff1a2964bb2be1db5f13dcc58478ea4a4561a5
diff --git a/lib/driver.js b/lib/driver.js index <HASH>..<HASH> 100644 --- a/lib/driver.js +++ b/lib/driver.js @@ -263,7 +263,7 @@ class XCUITestDriver extends BaseDriver { this.jwpProxyActive = false; this.proxyReqRes = null; - if (this.wda) { + if (this.wda && this.wda.jwproxy) { await this.proxyCommand(`/session/${this.sessionId}`, 'DELETE'); await this.wda.quit(); }
Make sure wda proxy is there when we delete session
appium_appium-xcuitest-driver
train
js
e062d125e6f0d18be7d6b016ba2945bf48c2f959
diff --git a/src/Providers/Composer/Composer.php b/src/Providers/Composer/Composer.php index <HASH>..<HASH> 100644 --- a/src/Providers/Composer/Composer.php +++ b/src/Providers/Composer/Composer.php @@ -88,7 +88,7 @@ final class Composer implements ComposerContract /** * Runs the provided command on the provided folder. */ - private function run(string $cmd, string $cwd = npull): bool + private function run(string $cmd, string $cwd = null): bool { $process = new Process($cmd, $cwd);
Mistype npull indavertised
laravel-zero_framework
train
php
ab764c9bf42639f4a0c5d1cbdd9d6f5e385142f1
diff --git a/framework/core/src/Api/Serializers/UserSerializer.php b/framework/core/src/Api/Serializers/UserSerializer.php index <HASH>..<HASH> 100644 --- a/framework/core/src/Api/Serializers/UserSerializer.php +++ b/framework/core/src/Api/Serializers/UserSerializer.php @@ -26,7 +26,7 @@ class UserSerializer extends UserBasicSerializer ]; } - if ($canEdit) { + if ($canEdit || $this->actor->id === $user->id) { $attributes += [ 'isActivated' => $user->is_activated, 'email' => $user->email
Let users see their own email/activation status
flarum_core
train
php
5cf47b847ba50dc04253d77b65cf63a9b7347890
diff --git a/spacy/cli/converters/iob2json.py b/spacy/cli/converters/iob2json.py index <HASH>..<HASH> 100644 --- a/spacy/cli/converters/iob2json.py +++ b/spacy/cli/converters/iob2json.py @@ -12,7 +12,7 @@ def iob2json(input_path, output_path, n_sents=10, *a, **k): """ # TODO: This isn't complete yet -- need to map from IOB to # BILUO - with input_path.open() as file_: + with input_path.open('r', encoding='utf8') as file_: docs = read_iob(file_) output_filename = input_path.parts[-1].replace(".iob", ".json") @@ -28,8 +28,12 @@ def read_iob(file_): for line in file_: if not line.strip(): continue - tokens = [t.rsplit('|', 2) for t in line.split()] - words, pos, iob = zip(*tokens) + tokens = [t.split('|') for t in line.split()] + if len(tokens[0]) == 3: + words, pos, iob = zip(*tokens) + else: + words, iob = zip(*tokens) + pos = ['-'] * len(words) biluo = iob_to_biluo(iob) sentences.append([ {'orth': w, 'tag': p, 'ner': ent}
Handle iob with no tag in converter
explosion_spaCy
train
py
4a44b30293d4ac4e4954b4021150123323e142ad
diff --git a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/util/iterator/MultiIteratorTest.java b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/util/iterator/MultiIteratorTest.java index <HASH>..<HASH> 100644 --- a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/util/iterator/MultiIteratorTest.java +++ b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/util/iterator/MultiIteratorTest.java @@ -25,6 +25,8 @@ import java.util.ArrayList; import java.util.Iterator; import java.util.List; +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.MatcherAssert.assertThat; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; @@ -89,6 +91,7 @@ public class MultiIteratorTest { itty.addIterator(EmptyIterator.instance()); itty.addIterator(list.iterator()); + assertThat(itty.hasNext(), is(true)); assertEquals("test1", itty.next()); assertEquals("test2", itty.next()); assertEquals("test3", itty.next());
Add assertion to ensure hasNext on MultiIterator returns true.
apache_tinkerpop
train
java
1c2a8702fd31325008a1e961cec5eb6287637283
diff --git a/src/Renderer/BlockSnippetRenderer.php b/src/Renderer/BlockSnippetRenderer.php index <HASH>..<HASH> 100644 --- a/src/Renderer/BlockSnippetRenderer.php +++ b/src/Renderer/BlockSnippetRenderer.php @@ -56,7 +56,7 @@ abstract class BlockSnippetRenderer implements SnippetRenderer } if (!class_exists($blockClass)) { - throw new CanNotInstantiateBlockException(sprintf('Class %s does not exist.')); + throw new CanNotInstantiateBlockException(sprintf('Class %s does not exist.', $blockClass)); } /** @var Block $blockInstance */
Issue #<I>: Add missing variable
lizards-and-pumpkins_catalog
train
php
a82307d2af71cc0726b833c667d397ab740c5b21
diff --git a/django_deployer/providers.py b/django_deployer/providers.py index <HASH>..<HASH> 100644 --- a/django_deployer/providers.py +++ b/django_deployer/providers.py @@ -163,6 +163,23 @@ class AppEngine(PaaSProvider): "Python2.7": "v2.7" } + setup_instructions = """ +Just a few more steps before you're ready to deploy your app! + +1. Run this command to create the virtualenv with all the packages: + + $ fab deploy + +2. Once you've done that, run the deploy command + + $ sh manage.sh deploy + +3. You can run other commands that will execute on your remotely deployed app, such as: + + $ sh manage.sh dbshell + +""" + provider_yml_name = "app.yaml" @classmethod
provide some setup instructions, so the user knows what s/he needs to do next
natea_django-deployer
train
py
789e1c8fdc27c80726d63bccad9d0afbbf2d8136
diff --git a/flask_resty/api.py b/flask_resty/api.py index <HASH>..<HASH> 100644 --- a/flask_resty/api.py +++ b/flask_resty/api.py @@ -19,14 +19,7 @@ def handle_api_error(error): def handle_http_exception(error): - # Flask calls the InternalServerError handler with any uncaught app - # exceptions. Re-raise those as generic internal server errors. - if not isinstance(error, HTTPException): - error = ApiError(500) - else: - error = ApiError.from_http_exception(error) - - return error.response + return ApiError.from_http_exception(error).response # ----------------------------------------------------------------------------- diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -28,7 +28,7 @@ setup( keywords="rest flask", packages=("flask_resty",), install_requires=( - "Flask>=1.0.3", + "Flask>=1.1.0", "Flask-SQLAlchemy>=1.0", "marshmallow>=3.0.0", "SQLAlchemy>=1.0.0",
chore: Update minimum Flask version to <I> (#<I>)
4Catalyzer_flask-resty
train
py,py
57c24f8ba763b3a33411901cc019a499847268dd
diff --git a/app/setup.php b/app/setup.php index <HASH>..<HASH> 100755 --- a/app/setup.php +++ b/app/setup.php @@ -89,7 +89,7 @@ add_action('after_setup_theme', function () { * Register relative length units in the editor. * @link https://developer.wordpress.org/block-editor/developers/themes/theme-support/#support-custom-units */ - add_theme_support('custom-units', 'rem', 'vw'); + add_theme_support('custom-units'); /** * Enable support for custom line heights in the editor.
chore(theme): Remove specificity from `custom-units` theme support
roots_sage
train
php
ac09f2fe74667a23b171178dd277b5e1abe716d0
diff --git a/src/GizzlePlugins/ExtensionRepositoryReleasePlugin.php b/src/GizzlePlugins/ExtensionRepositoryReleasePlugin.php index <HASH>..<HASH> 100644 --- a/src/GizzlePlugins/ExtensionRepositoryReleasePlugin.php +++ b/src/GizzlePlugins/ExtensionRepositoryReleasePlugin.php @@ -22,6 +22,7 @@ class ExtensionRepositoryReleasePlugin extends AbstractPlugin implements PluginI const OPTION_URL = 'url'; const OPTION_REMOVEBUILD = 'removeBuild'; const OPTION_GITCOMMAND = 'gitCommand'; + const OPTION_EXTENSIONKEY = 'extensionKey'; const CREDENTIALS_FILE = '.typo3credentials'; const PATTERN_EXTENSION_FOLDER = '/[^a-z0-9_]/'; const PATTERN_TAG_HEAD = 'refs/tags/'; @@ -96,7 +97,7 @@ class ExtensionRepositoryReleasePlugin extends AbstractPlugin implements PluginI * @return string */ protected function getWorkingDirectoryName(Payload $payload) { - return $payload->getRepository()->getName(); + return $this->getSettingValue(self::OPTION_EXTENSIONKEY, $payload->getRepository()->getName()); } /**
[FEATURE] Allow `extensionKey` as setting for plugin
NamelessCoder_gizzle-typo3-plugins
train
php
f7ce8f44e9dbc89b9efbd733c91c4a0ce5e94824
diff --git a/tests/test_main.py b/tests/test_main.py index <HASH>..<HASH> 100644 --- a/tests/test_main.py +++ b/tests/test_main.py @@ -791,13 +791,18 @@ def test_user_words(resources, outdir): sidecar_before = outdir / 'sidecar_before.txt' sidecar_after = outdir / 'sidecar_after.txt' - check_ocrmypdf( - resources / 'crom.png', outdir / 'out.pdf', - '--image-dpi', 150, - '--sidecar', sidecar_before - ) + # Don't know how to make this test pass on various versions and platforms + # so weaken to merely testing that the argument is accepted + consistent = False + + if consistent: + check_ocrmypdf( + resources / 'crom.png', outdir / 'out.pdf', + '--image-dpi', 150, + '--sidecar', sidecar_before + ) - assert 'cromulent' not in sidecar_before.open().read() + assert 'cromulent' not in sidecar_before.open().read() with word_list.open('w') as f: f.write('cromulent\n') # a perfectly cromulent word @@ -809,7 +814,8 @@ def test_user_words(resources, outdir): '--user-words', word_list ) - assert 'cromulent' in sidecar_after.open().read() + if consistent: + assert 'cromulent' in sidecar_after.open().read() def test_form_xobject(spoof_tesseract_noop, resources, outpdf):
Weaken the --user-words test so it will pass on Travis
jbarlow83_OCRmyPDF
train
py
3f06b196f100889f1d84cf78e3654bcda425e6e6
diff --git a/jenkins.go b/jenkins.go index <HASH>..<HASH> 100644 --- a/jenkins.go +++ b/jenkins.go @@ -42,7 +42,9 @@ func (jenkins *Jenkins) buildUrl(path string, params url.Values) (requestUrl str } func (jenkins *Jenkins) sendRequest(req *http.Request) (*http.Response, error) { - req.SetBasicAuth(jenkins.auth.Username, jenkins.auth.ApiToken) + if jenkins.auth != nil { + req.SetBasicAuth(jenkins.auth.Username, jenkins.auth.ApiToken) + } return http.DefaultClient.Do(req) }
Allow Auth to be nil for jenkins to enable systems which support some level of anonymous access
yosida95_golang-jenkins
train
go
dd23ee5abf891b0aa92eafb05cd690fd890e97ac
diff --git a/lib/mongoid/fields/validators/macro.rb b/lib/mongoid/fields/validators/macro.rb index <HASH>..<HASH> 100644 --- a/lib/mongoid/fields/validators/macro.rb +++ b/lib/mongoid/fields/validators/macro.rb @@ -56,7 +56,7 @@ module Mongoid end # if field alredy defined - if ! options[:overwrite] && klass.fields.keys.include?(name.to_s) + if !options[:overwrite] && klass.fields.keys.include?(name.to_s) if Mongoid.duplicate_fields_exception raise Errors::InvalidField.new(klass, name) else
:scissors:
mongodb_mongoid
train
rb
45f6657582d63e0c1ab21976540d3c5b47fad2f5
diff --git a/config/swagger-lume.php b/config/swagger-lume.php index <HASH>..<HASH> 100644 --- a/config/swagger-lume.php +++ b/config/swagger-lume.php @@ -161,6 +161,6 @@ return [ */ 'constants' => [ //'SWAGGER_LUME_CONST_HOST' => env('SWAGGER_LUME_CONST_HOST', 'http://my-default-host.com'), - ] + ], ]; diff --git a/src/Generator.php b/src/Generator.php index <HASH>..<HASH> 100644 --- a/src/Generator.php +++ b/src/Generator.php @@ -29,7 +29,7 @@ class Generator protected static function defineConstants(array $constants) { - if (!empty($constants)) { + if (! empty($constants)) { foreach ($constants as $key => $value) { defined($key) || define($key, $value); }
Applied fixes from StyleCI (#<I>) [ci skip] [skip ci]
DarkaOnLine_SwaggerLume
train
php,php
a1f4b15b862db6d9eaf700be419f17d15e7910d2
diff --git a/pyinfra/api/operation.py b/pyinfra/api/operation.py index <HASH>..<HASH> 100644 --- a/pyinfra/api/operation.py +++ b/pyinfra/api/operation.py @@ -160,21 +160,15 @@ def operation(func=None, pipeline_facts=None): state = kwargs['state'] = pseudo_state._module host = kwargs['host'] = pseudo_host._module - if not state or not host: - if not state: - raise PyinfraError(( - 'API operation called without state/host: {0} ({1})' - ).format(op_name, get_call_location())) - - if state.in_op: - raise PyinfraError(( - 'Nested operation called without state/host: {0} ({1})' - ).format(op_name, get_call_location())) - - if state.in_deploy: - raise PyinfraError(( - 'Nested deploy operation called without state/host: {0} ({1})' - ).format(op_name, get_call_location())) + if state.in_op: + raise PyinfraError(( + 'Nested operation called without state/host: {0} ({1})' + ).format(op_name, get_call_location())) + + if state.in_deploy: + raise PyinfraError(( + 'Nested deploy operation called without state/host: {0} ({1})' + ).format(op_name, get_call_location())) else: raise PyinfraError((
Fix CLI checking for nested operation calls w/o state & host.
Fizzadar_pyinfra
train
py
140c5e10c595ca2ca183495f3dff9e95f8835b08
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -29,6 +29,7 @@ setup( 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3.7', 'Topic :: Documentation', 'Topic :: Utilities', ],
Added py<I> support to setup.py
useblocks_sphinxcontrib-needs
train
py
d834a4a42633a3ab816d34cab57428bffbececf2
diff --git a/spyderlib/plugins/inspector.py b/spyderlib/plugins/inspector.py index <HASH>..<HASH> 100644 --- a/spyderlib/plugins/inspector.py +++ b/spyderlib/plugins/inspector.py @@ -335,5 +335,9 @@ class ObjectInspector(ReadOnlyEditor): is_code = True self.editor.set_highlight_current_line(is_code) self.editor.set_occurence_highlighting(is_code) + if is_code: + self.editor.set_language('py') + else: + self.editor.set_language(None) self.editor.set_text(hlp_text) self.editor.set_cursor_position('sof') diff --git a/spyderlib/widgets/codeeditor/codeeditor.py b/spyderlib/widgets/codeeditor/codeeditor.py index <HASH>..<HASH> 100644 --- a/spyderlib/widgets/codeeditor/codeeditor.py +++ b/spyderlib/widgets/codeeditor/codeeditor.py @@ -304,7 +304,12 @@ class CodeEditor(TextEditBaseWidget): self.tab_indents = language in self.TAB_ALWAYS_INDENTS self.supported_language = False self.comment_string = '' - if language is not None: + if language is None: + if self.highlighter is not None: + self.highlighter.setDocument(None) + self.highlighter = None + self.highlighter_class = None + else: for key in self.LANGUAGES: if language.lower() in key: self.supported_language = True
Fixed Issue <I>: don't do syntax highlighting in the "Object Inspector" when not showing the source
spyder-ide_spyder
train
py,py
5fb74bfc06c9e2d466e7ecb2ec1c5518ca13de15
diff --git a/logging/unit_tests/test_client.py b/logging/unit_tests/test_client.py index <HASH>..<HASH> 100644 --- a/logging/unit_tests/test_client.py +++ b/logging/unit_tests/test_client.py @@ -553,6 +553,7 @@ class TestClient(unittest.TestCase): def test_get_default_handler_app_engine(self): import os + import tempfile from google.cloud._testing import _Monkey from google.cloud.logging.client import _APPENGINE_FLEXIBLE_ENV_VM from google.cloud.logging.handlers import app_engine as _MUT @@ -562,7 +563,8 @@ class TestClient(unittest.TestCase): credentials=_make_credentials(), use_gax=False) - with _Monkey(_MUT, _LOG_PATH_TEMPLATE='{pid}'): + temp_log_path = os.path.join(tempfile.mkdtemp(), '{pid}') + with _Monkey(_MUT, _LOG_PATH_TEMPLATE=temp_log_path): with _Monkey(os, environ={_APPENGINE_FLEXIBLE_ENV_VM: 'True'}): handler = client.get_default_handler()
Make logging unit test file a temp file
googleapis_google-cloud-python
train
py
28049a10469fe7ee62f035d6cc70a2093699dc6a
diff --git a/Entity/Page.php b/Entity/Page.php index <HASH>..<HASH> 100644 --- a/Entity/Page.php +++ b/Entity/Page.php @@ -161,7 +161,11 @@ class Page extends Node return $this->author; } - + /** + * builds autogenerated route + * + * @return \MandarinMedien\MMCmfRoutingBundle\Entity\NodeRoute|null + */ public function getAutoNodeRoute() { foreach($this->getRoutes() as $route) @@ -174,5 +178,14 @@ class Page extends Node return null; } + /** + * to string function + * + * @return string + */ + function __toString() + { + return $this->getTitle(); + } }
added Page::__toString function
Mandarin-Medien_MMCmfContentBundle
train
php
65c1adadd61348799f8b14516e3cf671dda41323
diff --git a/structr-ui/src/main/resources/structr/js/schema.js b/structr-ui/src/main/resources/structr/js/schema.js index <HASH>..<HASH> 100644 --- a/structr-ui/src/main/resources/structr/js/schema.js +++ b/structr-ui/src/main/resources/structr/js/schema.js @@ -2060,7 +2060,12 @@ var _Schema = { return; } + _Schema.ignoreNextSchemaRecompileNotification = true; + Command.setProperty(entity.id, key, text2, false, function() { + + _Schema.ignoreNextSchemaRecompileNotification = false; + Structr.showAndHideInfoBoxMessage('Code saved.', 'success', 2000, 200); _Schema.reload(); dialogSaveButton.prop("disabled", true).addClass('disabled');
Bugfix: Ignore the schema recompile notification when user triggered a schema recompile by editing a function property.
structr_structr
train
js
701c810a852124ca07f92df2dd747f1a55492b8d
diff --git a/src/Model/PaperclipTrait.php b/src/Model/PaperclipTrait.php index <HASH>..<HASH> 100644 --- a/src/Model/PaperclipTrait.php +++ b/src/Model/PaperclipTrait.php @@ -160,13 +160,13 @@ trait PaperclipTrait * * {@inheritdoc} */ - public function originalIsEquivalent($key, $current) + public function originalIsEquivalent($key) { if (array_key_exists($key, $this->attachedFiles)) { return true; } - return parent::originalIsEquivalent($key, $current); + return parent::originalIsEquivalent($key); } /**
Updated originalIsEquivalent method for changed signature in Laravel 7
czim_laravel-paperclip
train
php
5292a3509e719782d47cb18f49d770ac4aa08533
diff --git a/sd.go b/sd.go index <HASH>..<HASH> 100644 --- a/sd.go +++ b/sd.go @@ -65,7 +65,7 @@ func LookupSidByName(name string) (sid string, err error) { if err != nil { return "", &AccountLookupError{name, err} } - sid = syscall.UTF16ToString((*[1 << 30]uint16)(unsafe.Pointer(strBuffer))[:]) + sid = syscall.UTF16ToString((*[0xffff]uint16)(unsafe.Pointer(strBuffer))[:]) localFree(uintptr(unsafe.Pointer(strBuffer))) return sid, nil }
Fix build on windows/<I>
Microsoft_go-winio
train
go
5be74ec2d7d9085397abdf8a6cc1417b035e7e33
diff --git a/extensions/imagine/BaseImage.php b/extensions/imagine/BaseImage.php index <HASH>..<HASH> 100644 --- a/extensions/imagine/BaseImage.php +++ b/extensions/imagine/BaseImage.php @@ -14,7 +14,6 @@ use Imagine\Image\ImageInterface; use Imagine\Image\ImagineInterface; use Imagine\Image\ManipulatorInterface; use Imagine\Image\Point; -use Imagine\Image\Palette\RGB; use yii\base\InvalidConfigException; use yii\base\InvalidParamException; use yii\helpers\ArrayHelper; @@ -156,8 +155,7 @@ class BaseImage $img = $img->thumbnail($box, $mode); // create empty image to preserve aspect ratio of thumbnail - $color = (new RGB())->color('#FFF', 100); - $thumb = static::getImagine()->create($box, $color); + $thumb = static::getImagine()->create($box, new Color('FFF', 100)); // calculate points $size = $img->getSize();
For Imagine <I> (previous code was for <I> dev)
yiisoft_yii-core
train
php
d40b60f147653b4924fe0acf908a7f1b220d1eeb
diff --git a/heron/api/src/java/org/apache/heron/streamlet/impl/groupings/RemapCustomGrouping.java b/heron/api/src/java/org/apache/heron/streamlet/impl/groupings/RemapCustomGrouping.java index <HASH>..<HASH> 100644 --- a/heron/api/src/java/org/apache/heron/streamlet/impl/groupings/RemapCustomGrouping.java +++ b/heron/api/src/java/org/apache/heron/streamlet/impl/groupings/RemapCustomGrouping.java @@ -53,7 +53,7 @@ public class RemapCustomGrouping<R> implements CustomStreamGrouping { public List<Integer> chooseTasks(List<Object> values) { List<Integer> ret = new ArrayList<>(); R obj = (R) values.get(0); - List<Integer> targets = remapFn.apply(obj, ret.size()); + List<Integer> targets = remapFn.apply(obj, taskIds.size()); for (Integer target : targets) { ret.add(Utils.assignKeyToTask(target, taskIds)); }
Fix number of tasks in Streamlet RemapCustomGrouping (#<I>)
apache_incubator-heron
train
java
a9551c5d3ddb5cfffa76da0a5a9758b0d20b79fb
diff --git a/src/Client.php b/src/Client.php index <HASH>..<HASH> 100644 --- a/src/Client.php +++ b/src/Client.php @@ -25,6 +25,11 @@ final class Client implements HttpClient, HttpAsyncClient */ private $client; + /** + * If you pass a Guzzle instance as $client, make sure to configure Guzzle to not + * throw exceptions on HTTP error status codes, or this adapter will violate PSR-18. + * See also self::buildClient at the bottom of this class. + */ public function __construct(?ClientInterface $client = null) { if (!$client) {
explain in phpdoc that guzzle instance must not throw exceptions
php-http_guzzle6-adapter
train
php
d9ae6dd87166a541454cc89bccfa0208e7db6faa
diff --git a/main.go b/main.go index <HASH>..<HASH> 100644 --- a/main.go +++ b/main.go @@ -12,6 +12,26 @@ import ( "github.com/docker/machine/version" ) +var AppHelpTemplate = ` +Usage: {{.Name}} {{if .Flags}}[OPTIONS] {{end}}COMMAND [arg...] + +{{.Usage}} + +Version: {{.Version}}{{if or .Author .Email}} + +Author:{{if .Author}} + {{.Author}}{{if .Email}} - <{{.Email}}>{{end}}{{else}} + {{.Email}}{{end}}{{end}} +{{if .Flags}} +Options: + {{range .Flags}}{{.}} + {{end}}{{end}} +Commands: + {{range .Commands}}{{.Name}}{{with .ShortName}}, {{.}}{{end}}{{ "\t" }}{{.Usage}} + {{end}} +Run '{{.Name}} COMMAND --help' for more information on a command. +` + func main() { for _, f := range os.Args { if f == "-D" || f == "--debug" || f == "-debug" { @@ -20,6 +40,7 @@ func main() { } } + cli.AppHelpTemplate = AppHelpTemplate app := cli.NewApp() app.Name = path.Base(os.Args[0]) app.Author = "Docker Machine Contributors"
Reformatting usage message to look more like docker's
docker_machine
train
go
694642dfbde566ae529c9a7b4d2f27d70d71b0ff
diff --git a/lib/rscons/environment.rb b/lib/rscons/environment.rb index <HASH>..<HASH> 100644 --- a/lib/rscons/environment.rb +++ b/lib/rscons/environment.rb @@ -17,6 +17,11 @@ module Rscons # @return [String] The build root. attr_reader :build_root + # @return [Integer] + # The number of threads to use for this Environment. If nil (the + # default), the global Rscons.n_threads default value will be used. + attr_writer :n_threads + # Set the build root. # # @param build_root [String] The build root. @@ -331,7 +336,7 @@ module Rscons # If needed, do a blocking wait. if (@threaded_commands.size > 0) and - ((completed_tcs.empty? and job.nil?) or (@threaded_commands.size >= Rscons.n_threads)) + ((completed_tcs.empty? and job.nil?) or (@threaded_commands.size >= n_threads)) completed_tcs << wait_for_threaded_commands end @@ -828,6 +833,15 @@ module Rscons end end + # Get the number of threads to use for parallelized builds in this + # Environment. + # + # @return [Integer] + # Number of threads to use for parallelized builds in this Environment. + def n_threads + @n_threads || Rscons.n_threads + end + private # Add a build target.
Allow overriding n_threads on a per-Environment level - close #<I>
holtrop_rscons
train
rb
359061f1500e9f4cabc9b08bb4f3f0b2601e5d54
diff --git a/Concerns/ManagesTransactions.php b/Concerns/ManagesTransactions.php index <HASH>..<HASH> 100644 --- a/Concerns/ManagesTransactions.php +++ b/Concerns/ManagesTransactions.php @@ -41,13 +41,13 @@ trait ManagesTransactions } try { - if ($this->transactions == 1) { + $this->transactions = max(0, $this->transactions - 1); + + if ($this->transactions == 0) { $this->getPdo()->commit(); optional($this->transactionsManager)->commit($this->getName()); } - - $this->transactions = max(0, $this->transactions - 1); } catch (Throwable $e) { $this->handleCommitTransactionException( $e, $currentAttempt, $attempts
call transaction callbacks after updating the transaction levels (#<I>)
illuminate_database
train
php
ca9ab2835f88a6cf933878eeb3300767e64c9765
diff --git a/drivers/python/rethinkdb/net.py b/drivers/python/rethinkdb/net.py index <HASH>..<HASH> 100644 --- a/drivers/python/rethinkdb/net.py +++ b/drivers/python/rethinkdb/net.py @@ -218,8 +218,10 @@ class Connection(object): self._handle_cursor_response(self._read_response(cursor.query.token)) def _async_continue_cursor(self, cursor): - self.cursor_cache[cursor.query.token].outstanding_requests += 1 + if cursor.outstanding_requests != 0: + return + cursor.outstanding_requests = 1 query = Query(p.Query.CONTINUE, cursor.query.token, None, None) self._send_query(query, cursor.opts, async=True)
Do not have more than one outstanding CONTINUE request Related #<I> Review <I> by @Tryneus
rethinkdb_rethinkdb
train
py
7bca6aa3578e6e0915922d58c670c7b16fc9183e
diff --git a/src/Common/Model/Base.php b/src/Common/Model/Base.php index <HASH>..<HASH> 100644 --- a/src/Common/Model/Base.php +++ b/src/Common/Model/Base.php @@ -2087,8 +2087,12 @@ abstract class Base protected function describeFieldsPrepareLabel($sLabel) { $aPatterns = [ - '/\bid\b/i' => 'ID', - '/\burl\b/i' => 'URL', + // Common words + '/\bid\b/i' => 'ID', + '/\burl\b/i' => 'URL', + '/\bhtml\b/i' => 'HTML', + // Common file extensions + '/\bpdf\b/i' => 'PDF', ]; $sLabel = ucwords(preg_replace('/[\-_]/', ' ', $sLabel));
Added more items to `describeFieldsPrepareLabel`
nails_common
train
php
083ef6d47403f4589a269b7f912662cb66c74f88
diff --git a/system/src/Grav/Common/Page/Page.php b/system/src/Grav/Common/Page/Page.php index <HASH>..<HASH> 100644 --- a/system/src/Grav/Common/Page/Page.php +++ b/system/src/Grav/Common/Page/Page.php @@ -101,7 +101,7 @@ class Page /** @var Config $config */ $config = self::getGrav()['config']; - $this->routable = true; + $this->taxonomy = array(); $this->process = $config->get('system.pages.process'); $this->published = true; @@ -127,6 +127,14 @@ class Page $this->setPublishState(); $this->published(); + // some routable logic + if (empty($this->routable) && $this->modular()) { + $this->routable = false; + } else { + $this->routable = true; + } + + // some extension logic if (empty($extension)) { $this->extension('.'.$file->getExtension()); } else { @@ -1089,6 +1097,7 @@ class Page if ($var !== null) { $this->routable = (bool) $var; } + return $this->routable && $this->published(); }
Added routable logic so modular pages are not routable by default (as intended!)
getgrav_grav
train
php
a7148bed56113064b43b1e4b5ffdcb22b7d02bdf
diff --git a/Event.php b/Event.php index <HASH>..<HASH> 100644 --- a/Event.php +++ b/Event.php @@ -587,11 +587,15 @@ class Event extends Component */ protected function emailOutput(MailerInterface $mailer, $addresses) { - $mailer->compose() - ->setTextBody(file_get_contents($this->_output)) - ->setSubject($this->getEmailSubject()) - ->setTo($addresses) - ->send(); + $textBody = file_get_contents($this->_output); + + if (trim($textBody) != '' ) { + $mailer->compose() + ->setTextBody(file_get_contents($this->_output)) + ->setSubject($this->getEmailSubject()) + ->setTo($addresses) + ->send(); + } } /**
Prevent sending of empty mails When a task produces no output, no mail should be sent.
omnilight_yii2-scheduling
train
php
297ee657371040e4ea50e7e411179946e95adb83
diff --git a/test/runtime/samples/action-this/_config.js b/test/runtime/samples/action-this/_config.js index <HASH>..<HASH> 100644 --- a/test/runtime/samples/action-this/_config.js +++ b/test/runtime/samples/action-this/_config.js @@ -1,10 +1,9 @@ export default { - html: `<button>0</button>`, - test ( assert, component, target, window ) { const button = target.querySelector( 'button' ); const click = new window.MouseEvent( 'click' ); + assert.htmlEqual( target.innerHTML, `<button>0</button>` ); button.dispatchEvent( click ); assert.htmlEqual( target.innerHTML, `<button>1</button>` ); }
Make tests work when running all of them together. They were only passing when running just the runtime tests, but failing with `<button>undefined</button>` when running all the tests.
sveltejs_svelte
train
js
2ad0ebd46267f234ffb9af36f6daa1947f94f087
diff --git a/test/index.js b/test/index.js index <HASH>..<HASH> 100644 --- a/test/index.js +++ b/test/index.js @@ -44,8 +44,8 @@ app.on('ready', function() { mainWindow = new BrowserWindow({ 'width': 416, 'height': 400, - 'web-preferences': {'plugins': true} // Do not forget to add this option - // when creating BrowserWindow + 'webPreferences': {'plugins': true} // Do not forget to add this option + // when creating BrowserWindow }); var url; url = 'file://' + __dirname + '/index.html';
Updated sample app to get rid of the 'deprecated' warning
alvin-777_flash-player-loader-for-electron
train
js
e870954dc23f43ece39bdc1ce29c2cd457a2668d
diff --git a/lib/jshint/cli.rb b/lib/jshint/cli.rb index <HASH>..<HASH> 100644 --- a/lib/jshint/cli.rb +++ b/lib/jshint/cli.rb @@ -1,6 +1,6 @@ module Jshint module Cli - def run(reporter_name = :Default, result_file = nil) + def self.run(reporter_name = :Default, result_file = nil) linter = Jshint::Lint.new linter.lint reporter = Jshint::Reporters.const_get(reporter_name).new(linter.errors) @@ -10,8 +10,8 @@ module Jshint end if result_file - Dir.mkdir(File.dirname(file)) - File.open(file, 'w') do |stream| + Dir.mkdir(File.dirname(result_file)) + File.open(result_file, 'w') do |stream| printer.call(stream) end else
This needs to be run without including.
damian_jshint
train
rb
eeb1f0283a89f065b500b0c9856a432680a8387b
diff --git a/robolectric/src/main/java/org/robolectric/android/internal/AndroidTestEnvironment.java b/robolectric/src/main/java/org/robolectric/android/internal/AndroidTestEnvironment.java index <HASH>..<HASH> 100755 --- a/robolectric/src/main/java/org/robolectric/android/internal/AndroidTestEnvironment.java +++ b/robolectric/src/main/java/org/robolectric/android/internal/AndroidTestEnvironment.java @@ -176,6 +176,8 @@ public class AndroidTestEnvironment implements TestEnvironment { RuntimeEnvironment.setAndroidFrameworkJarPath(sdkJarPath); Bootstrap.setDisplayConfiguration(androidConfiguration, displayMetrics); RuntimeEnvironment.setActivityThread(ReflectionHelpers.newInstance(ActivityThread.class)); + ReflectionHelpers.setStaticField( + ActivityThread.class, "sMainThreadHandler", new Handler(Looper.myLooper())); Instrumentation instrumentation = createInstrumentation(); InstrumentationRegistry.registerInstance(instrumentation, new Bundle()); @@ -278,9 +280,6 @@ public class AndroidTestEnvironment implements TestEnvironment { shadowActivityThread.setCompatConfiguration(androidConfiguration); - ReflectionHelpers.setStaticField( - ActivityThread.class, "sMainThreadHandler", new Handler(Looper.myLooper())); - Bootstrap.setUpDisplay(); activityThread.applyConfigurationToResources(androidConfiguration);
Eagerly instantiate ActivityThread's main handler Instantiating it inside installAndCreateApplication is no longer necessarily correct, as that can be called from a background thread PiperOrigin-RevId: <I>
robolectric_robolectric
train
java
714d910edf802b8d183f156d04a72ba47316713c
diff --git a/src/loader/loader.js b/src/loader/loader.js index <HASH>..<HASH> 100644 --- a/src/loader/loader.js +++ b/src/loader/loader.js @@ -29,18 +29,29 @@ // flag to know if we need to refresh the display this.invalidate = false; + // handle for the susbcribe function + this.handle = null; + // load progress in percent this.loadPercent = 0; + + }, + // call when the loader is resetted + onResetEvent : function() { // setup a callback - me.loader.onProgress = this.onProgressUpdate.bind(this); - + this.handle = me.event.subscribe(me.event.LOADER_PROGRESS, this.onProgressUpdate.bind(this)); }, - + // destroy object at end of loading onDestroyEvent : function() { // "nullify" all fonts this.logo1 = this.logo2 = null; + // cancel the callback + if (this.handle) { + me.event.unsubscribe(this.handle); + this.handle = null; + } }, // make sure the screen is refreshed every frame
Use the new suscribe messaging function in the default loading screen Because that's cool :)
melonjs_melonJS
train
js
9ac286bf65fe5d43288d4a405d4eb4677ac5963c
diff --git a/sprockets/mixins/metrics/influxdb.py b/sprockets/mixins/metrics/influxdb.py index <HASH>..<HASH> 100644 --- a/sprockets/mixins/metrics/influxdb.py +++ b/sprockets/mixins/metrics/influxdb.py @@ -127,7 +127,6 @@ class InfluxDBCollector(object): io_loop=None, submission_interval=SUBMISSION_INTERVAL, max_batch_size=MAX_BATCH_SIZE, tags=None): self._buffer = list() - self._client = httpclient.AsyncHTTPClient(force_instance=True) self._client.configure(None, defaults={'user_agent': _USER_AGENT}) self._database = database self._influxdb_url = '{}?db={}'.format(url, database) @@ -137,6 +136,9 @@ class InfluxDBCollector(object): self._pending = 0 self._tags = tags or {} + self._client = httpclient.AsyncHTTPClient(force_instance=True, + io_loop=self._io_loop) + # Add the periodic callback for submitting metrics LOGGER.info('Starting PeriodicCallback for writing InfluxDB metrics') self._callback = ioloop.PeriodicCallback(self._write_metrics,
Pass the IOLoop into the HTTPClient
sprockets_sprockets.mixins.metrics
train
py
cb7883398223ef27a230cd521b39104610729e76
diff --git a/tests/automated/ListView.js b/tests/automated/ListView.js index <HASH>..<HASH> 100644 --- a/tests/automated/ListView.js +++ b/tests/automated/ListView.js @@ -39,6 +39,16 @@ describe('ListView rendering', function() { expect(events[1].title).toBe('event 2'); expect(events[1].timeText).toBe('all-day'); }); + + it('filters events through eventRender', function() { + options.eventRender = function(event, el) { + el.find('.fc-event-dot').replaceWith('<span class="custom-icon" />'); + }; + + $('#cal').fullCalendar(options); + + expect($('.custom-icon').length).toBe(2); + }); }); describe('with timed events', function() {
test that listview uses eventRender
fullcalendar_fullcalendar
train
js
84e8c9a0e3ddf3411fa1ef1e3da70973c2ee71fa
diff --git a/src/phpDocumentor/Application/Console/Command/Phar/UpdateCommand.php b/src/phpDocumentor/Application/Console/Command/Phar/UpdateCommand.php index <HASH>..<HASH> 100644 --- a/src/phpDocumentor/Application/Console/Command/Phar/UpdateCommand.php +++ b/src/phpDocumentor/Application/Console/Command/Phar/UpdateCommand.php @@ -30,6 +30,8 @@ use Symfony\Component\Console\Output\OutputInterface; * ``` * $ php phpDocumentor.phar phar:update [-m|--major] [-p|--pre] [version] * ``` + * + * @codeCoverageIgnore file should be refactored first before it is testable and not high on prio listing */ class UpdateCommand extends Command {
Do not cover UpdateCommand with tests for now
phpDocumentor_phpDocumentor2
train
php
5522c22a40dec74920f2f637758516172b0932be
diff --git a/src/asynqp/connection.py b/src/asynqp/connection.py index <HASH>..<HASH> 100644 --- a/src/asynqp/connection.py +++ b/src/asynqp/connection.py @@ -32,7 +32,6 @@ class Connection(object): The :class:`~asyncio.Protocol` which is paired with the transport """ def __init__(self, loop, transport, protocol, synchroniser, sender, dispatcher, connection_info): - self._loop = loop self.synchroniser = synchroniser self.sender = sender self.channel_factory = channel.ChannelFactory(loop, protocol, dispatcher, connection_info)
Removed unneded local `_loop` veriable in Connection
benjamin-hodgson_asynqp
train
py
effacbd973eaf51c9fbf471b383bbd642e6d1609
diff --git a/lib/haibu/core/spawner.js b/lib/haibu/core/spawner.js index <HASH>..<HASH> 100644 --- a/lib/haibu/core/spawner.js +++ b/lib/haibu/core/spawner.js @@ -128,6 +128,14 @@ Spawner.prototype.spawn = function spawn (repo, callback) { drone = new forever.Monitor(script, foreverOptions); // + // TODO this is only workaround! + // + drone.on('error', function() { + // 'error' event needs to be catched, otherwise nodejitsu process + // will die + }); + + // // Log data from `drone.stdout` to haibu // TODO (indexzero): This output should be in its own Loggly input (i.e. log.user instead of log.drone) //
[core/spawner] listen to drone's 'error' event, workaround for crashing app problem
nodejitsu_haibu
train
js
79e8dd42d3dbcd6d66576381d11dd204e0b5483d
diff --git a/controller/worker/deployment/context.go b/controller/worker/deployment/context.go index <HASH>..<HASH> 100644 --- a/controller/worker/deployment/context.go +++ b/controller/worker/deployment/context.go @@ -79,7 +79,12 @@ func (c *context) HandleDeployment(job *que.Job) (e error) { // rollback failed deploy if e != nil { errMsg := e.Error() - if !IsSkipRollback(e) { + if IsSkipRollback(e) { + // ErrSkipRollback indicates the deploy failed in some way + // but no further action should be taken, so set the error + // to nil to avoid retrying the deploy + e = nil + } else { log.Warn("rolling back deployment due to error", "err", e) e = c.rollback(log, deployment, f) }
worker: Don't retry deploys when ErrSkipRollback is returned Fixes #<I>.
flynn_flynn
train
go
1c0ff6cff86d8c675c60a4255f91e900f352f8cd
diff --git a/salt/states/saltmod.py b/salt/states/saltmod.py index <HASH>..<HASH> 100644 --- a/salt/states/saltmod.py +++ b/salt/states/saltmod.py @@ -245,6 +245,9 @@ def state( m_ret = False + if 'return' in mdata and 'ret' not in mdata: + mdata['ret'] = mdata.pop('return') + if mdata.get('failed', False): m_state = False else:
Salt SSH orchestration returns `ret` as `return`. Adapt.
saltstack_salt
train
py
1796548f84346099a66ef1a6c1432bfecb678a11
diff --git a/webwhatsapi/__init__.py b/webwhatsapi/__init__.py index <HASH>..<HASH> 100755 --- a/webwhatsapi/__init__.py +++ b/webwhatsapi/__init__.py @@ -415,7 +415,7 @@ class WhatsAPIDriver(object): raise ChatNotFoundError("Chat {0} not found".format(chat_id)) - def get_chat_from_phone_number(self, number): + def get_chat_from_phone_number(self, number, createIfNotFound = False): """ Gets chat by phone number Number format should be as it appears in Whatsapp ID @@ -431,13 +431,13 @@ class WhatsAPIDriver(object): if not isinstance(chat, UserChat) or number not in chat.id: continue return chat - - self.create_chat_by_number(number) - self.wait_for_login() - for chat in self.get_all_chats(): - if not isinstance(chat, UserChat) or number not in chat.id: - continue - return chat + if(createIfNotFound): + self.create_chat_by_number(number) + self.wait_for_login() + for chat in self.get_all_chats(): + if not isinstance(chat, UserChat) or number not in chat.id: + continue + return chat raise ChatNotFoundError('Chat for phone {0} not found'.format(number)) def reload_qr(self):
change get_chat_from_phone_number Possibilite to create new chat if no one found if you need this
mukulhase_WebWhatsapp-Wrapper
train
py
4a33b50f744ac39355b8e1636a6ca89a551da439
diff --git a/lib/sprockets/directive_processor.rb b/lib/sprockets/directive_processor.rb index <HASH>..<HASH> 100644 --- a/lib/sprockets/directive_processor.rb +++ b/lib/sprockets/directive_processor.rb @@ -1,7 +1,5 @@ -require 'pathname' require 'set' require 'shellwords' -require 'yaml' module Sprockets # The `DirectiveProcessor` is responsible for parsing and evaluating
Directive processor doesn't use pathname or yaml
rails_sprockets
train
rb
ee5398368e419de9aa11207dcfa330c262dbfdf0
diff --git a/lib/core/topologies/mongos.js b/lib/core/topologies/mongos.js index <HASH>..<HASH> 100644 --- a/lib/core/topologies/mongos.js +++ b/lib/core/topologies/mongos.js @@ -366,7 +366,8 @@ function handleInitialConnectEvent(self, event) { self.s.logger.warn(f(message, _this.name)); } - // This is not a mongos proxy, remove it completely + // This is not a mongos proxy, destroy and remove it completely + _this.destroy(true); removeProxyFrom(self.connectingProxies, _this); // Emit the left event self.emit('left', 'server', _this); @@ -445,10 +446,9 @@ function connectProxies(self, servers) { server.connect(self.s.connectOptions); }, timeoutInterval); } + // Start all the servers - while (servers.length > 0) { - connect(servers.shift(), timeoutInterval++); - } + servers.forEach(server => connect(server, timeoutInterval++)); } function pickProxy(self, session) {
fix(mongos): disconnect proxies which are not mongos instances NODE-<I>
mongodb_node-mongodb-native
train
js
25d101c6c5aad57add8c2c42447163f332d87cf5
diff --git a/py/dynesty/utils.py b/py/dynesty/utils.py index <HASH>..<HASH> 100644 --- a/py/dynesty/utils.py +++ b/py/dynesty/utils.py @@ -348,11 +348,13 @@ def resample_equal(samples, weights, rstate=None): if rstate is None: rstate = get_random_generator() - if abs(np.sum(weights) - 1.) > SQRTEPS: + cumulative_sum = np.cumsum(weights) + if abs(cumulative_sum[-1] - 1.) > SQRTEPS: # same tol as in numpy's random.choice. # Guarantee that the weights will sum to 1. warnings.warn("Weights do not sum to 1 and have been renormalized.") - weights = np.asarray(weights) / np.sum(weights) + cumulative_sum /= cumulative_sum[-1] + # this ensures that the last element is strictly == 1 # Make N subdivisions and choose positions with a consistent random offset. nsamples = len(weights) @@ -360,7 +362,6 @@ def resample_equal(samples, weights, rstate=None): # Resample the data. idx = np.zeros(nsamples, dtype=int) - cumulative_sum = np.cumsum(weights) i, j = 0, 0 while i < nsamples: if positions[i] < cumulative_sum[j]:
make resample_equal more numerically stable. solve #<I>
joshspeagle_dynesty
train
py
652a008c5c9206e2a301549470811b6a5017e809
diff --git a/src/Commands/BotLimit.js b/src/Commands/BotLimit.js index <HASH>..<HASH> 100644 --- a/src/Commands/BotLimit.js +++ b/src/Commands/BotLimit.js @@ -27,7 +27,7 @@ var botlimit = { } return; } - value = arguments[1] + value = arguments[1]; if (value >= 0) { this.gameState.botDepartLimit = value; } else { diff --git a/src/Server.js b/src/Server.js index <HASH>..<HASH> 100644 --- a/src/Server.js +++ b/src/Server.js @@ -765,7 +765,7 @@ Server.prototype.addBot = function (player) { if (player.active) { return false; } - bot = player + bot = player; } else { // Haetaan seuraava vapaa paikka botille playerIds = Object.keys(this.players);
Fix the last two jshint errors! Woot!
cb-hackers_node-NetMatch
train
js,js
cad6581cb5522f607d1b9e3a43ae9574d36e2320
diff --git a/email_confirm_la/admin.py b/email_confirm_la/admin.py index <HASH>..<HASH> 100644 --- a/email_confirm_la/admin.py +++ b/email_confirm_la/admin.py @@ -7,11 +7,21 @@ from django.contrib import admin from email_confirm_la.models import EmailConfirmation +def resend_confirmation_email(modeladmin, request, queryset): + for confirmation in queryset: + if not confirmation.is_verified: + confirmation.send() + +resend_confirmation_email.short_description = 'Re-send selected %(verbose_name_plural)s' + + class EmailConfirmationAdmin(admin.ModelAdmin): + def show_content_type(self, obj): return obj.content_object._meta.object_name show_content_type.short_description = 'Content type' + actions = [resend_confirmation_email, ] list_display = ('show_content_type', 'content_object', 'email_field_name', 'email', 'is_verified', 'is_primary', 'send_at', 'confirmed_at') list_display_links = list_display search_fields = ('email', )
admin action: resend_confirmation_email Fixes #5
vinta_django-email-confirm-la
train
py
7882eac4f647256828d08cb3fe78580092d28c88
diff --git a/src/extensions/default/JavaScriptCodeHints/Session.js b/src/extensions/default/JavaScriptCodeHints/Session.js index <HASH>..<HASH> 100644 --- a/src/extensions/default/JavaScriptCodeHints/Session.js +++ b/src/extensions/default/JavaScriptCodeHints/Session.js @@ -456,7 +456,12 @@ define(function (require, exports, module) { cursor = sessionType.functionCallPos, token = cursor ? this.getToken(cursor) : undefined, varName; - if (token) { + if (token && + // only change the 'fn' when the token looks like a function + // name, and isn't some other kind of expression + (token.type === "variable" || + token.type === "variable-2" || + token.type === "property")) { varName = token.string; if (varName) { fnHint = varName + fnHint.substr(2);
Fix Issue #<I> Only replace the 'fn' in the function type hint if the token that was called looks like an identifier/property. If it is an expression, resulting in a function call, then just display 'fn' since we don't have a way to determine a 'name' for the called function.
adobe_brackets
train
js
5f8a2a1ce90960ba79157b21b34ece5adf4e09e0
diff --git a/salt/ssh/__init__.py b/salt/ssh/__init__.py index <HASH>..<HASH> 100644 --- a/salt/ssh/__init__.py +++ b/salt/ssh/__init__.py @@ -101,10 +101,13 @@ class SSH(object): ''' running = {} target_iter = self.targets.__iter__() + done = set() while True: - done = set() if len(running) < self.opts.get('ssh_max_procs', 5): - host = next(target_iter) + try: + host = next(target_iter) + except StopIteration: + pass for default in self.defaults: if not default in self.targets[host]: self.targets[host][default] = self.defaults[default] @@ -138,7 +141,10 @@ class SSH(object): yield {running[host]['single'].id: 'Bad Return'} done.add(host) for host in done: - running.pop(host) + if host in running: + running.pop(host) + if len(done) >= len(self.targets): + break def run(self): '''
Fix error where iteration was breaking too soon
saltstack_salt
train
py
0bb3081fea56dea5fee5d052036dfe0053dfa3ed
diff --git a/src/http-auth-interceptor.js b/src/http-auth-interceptor.js index <HASH>..<HASH> 100644 --- a/src/http-auth-interceptor.js +++ b/src/http-auth-interceptor.js @@ -12,8 +12,8 @@ .factory('authService', ['$rootScope','httpBuffer', function($rootScope, httpBuffer) { return { - loginConfirmed: function() { - $rootScope.$broadcast('event:auth-loginConfirmed'); + loginConfirmed: function(data) { + $rootScope.$broadcast('event:auth-loginConfirmed', data); httpBuffer.retryAll(); } };
cherry-pick: Added ability to pass data along with login confirmation This is quite useful if you want to listen out for login confirmation and have access to *who* logged in (for presentation purposes) Conflicts: src/angular-http-auth.js
witoldsz_angular-http-auth
train
js
cf6e6482f0f87b482adae695883882c5ef0fb898
diff --git a/datadog_checks_base/setup.py b/datadog_checks_base/setup.py index <HASH>..<HASH> 100644 --- a/datadog_checks_base/setup.py +++ b/datadog_checks_base/setup.py @@ -51,5 +51,7 @@ setup( packages=['datadog_checks'], include_package_data=True, - install_requires=[], + extras_require={ + 'deps': get_requirements('requirements.in'), + }, )
Allow installation of base dependencies (#<I>)
DataDog_integrations-core
train
py
67d6bb0aac1f3f584945df2f183a0760dc0e1a18
diff --git a/spec/dummy/lib/test_receiver.rb b/spec/dummy/lib/test_receiver.rb index <HASH>..<HASH> 100644 --- a/spec/dummy/lib/test_receiver.rb +++ b/spec/dummy/lib/test_receiver.rb @@ -1,6 +1,5 @@ class TestReceiver def receive(_env, _claims) - [600, {}, ['Claims were not handled.']] end def logout(_env)
Removed unused line of test code
ausaccessfed_rapid-rack
train
rb
e04c3969b495ef836979381865c811d0a10113a0
diff --git a/tests/test_utils_autoingest.py b/tests/test_utils_autoingest.py index <HASH>..<HASH> 100644 --- a/tests/test_utils_autoingest.py +++ b/tests/test_utils_autoingest.py @@ -5,7 +5,7 @@ import ndio.utils.autoingest as AutoIngest import numpy import datetime -SERVER_SITE = 'http://http://ec2-54-200-94-232.us-west-2.compute.amazonaws.com/' +SERVER_SITE = 'http://ec2-54-200-94-232.us-west-2.compute.amazonaws.com/' DATA_SITE = 'http://ec2-54-200-215-161.us-west-2.compute.amazonaws.com/' class TestAutoIngest(unittest.TestCase):
Nginx now can support this
jhuapl-boss_intern
train
py
9fc4a6244b1520284e19e84f03c38c320114aeb6
diff --git a/features/extra/no-mail.php b/features/extra/no-mail.php index <HASH>..<HASH> 100644 --- a/features/extra/no-mail.php +++ b/features/extra/no-mail.php @@ -1,6 +1,7 @@ <?php -function wp_mail() { - // do nothing +function wp_mail( $to ) { + // Log for testing purposes + WP_CLI::log( "WP-CLI test suite: Sent email to {$to}." ); }
Prevent email notifications when users are created Email notifications should only be sent when `--send-email` is provided.
wp-cli_wp-cli-tests
train
php
8b521168c32528be0e53363fa314938f9a6a6d22
diff --git a/java/client/test/org/openqa/selenium/html5/LocalStorageTest.java b/java/client/test/org/openqa/selenium/html5/LocalStorageTest.java index <HASH>..<HASH> 100644 --- a/java/client/test/org/openqa/selenium/html5/LocalStorageTest.java +++ b/java/client/test/org/openqa/selenium/html5/LocalStorageTest.java @@ -20,13 +20,16 @@ package org.openqa.selenium.html5; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import static org.junit.Assume.assumeTrue; +import static org.openqa.selenium.testing.Driver.FIREFOX; import org.junit.Before; import org.junit.Test; +import org.openqa.selenium.testing.Ignore; import org.openqa.selenium.testing.JUnit4TestBase; import java.util.Set; +@Ignore(FIREFOX) public class LocalStorageTest extends JUnit4TestBase { @Before public void checkHasWebStorage() {
Ignoring a test in legacy FirefoxDriver
SeleniumHQ_selenium
train
java
abaa61d75bc33d1bf71a2e1735c962c250bcbf5e
diff --git a/thingy.py b/thingy.py index <HASH>..<HASH> 100644 --- a/thingy.py +++ b/thingy.py @@ -89,8 +89,8 @@ class Thingy(object): def update(self, *args, **kwargs): self._update(*args, **kwargs) - def view(self, name="defaults", *args, **kwargs): - return self._views[name](self, *args, **kwargs) + def view(self, name="defaults"): + return self._views[name](self) names_regex = re.compile("([A-Z][a-z]+)")
Simplify Thingy.view for now
numberly_thingy
train
py
dace7ab27b51fe67ed98b0328c80c8eea9da3a87
diff --git a/sos/plugins/postgresql.py b/sos/plugins/postgresql.py index <HASH>..<HASH> 100644 --- a/sos/plugins/postgresql.py +++ b/sos/plugins/postgresql.py @@ -92,13 +92,6 @@ class PostgreSQL(Plugin): self.add_alert( "WARN: password must be supplied to dump a database." ) - else: - self.soslog.warning( - "dbname must be supplied to dump a database." - ) - self.add_alert( - "WARN: dbname must be supplied to dump a database." - ) def postproc(self): import shutil
[postgresql] don't warn if dbname is not set Fixes #<I>.
sosreport_sos
train
py
0594a9bdfd1d7c633e0b23c9cf340829f99e1503
diff --git a/class/StateMachine/FlupdoCrudMachine.php b/class/StateMachine/FlupdoCrudMachine.php index <HASH>..<HASH> 100644 --- a/class/StateMachine/FlupdoCrudMachine.php +++ b/class/StateMachine/FlupdoCrudMachine.php @@ -37,12 +37,6 @@ class FlupdoCrudMachine extends FlupdoMachine { parent::initializeMachine($config); - // Name of inputs and outputs with properties - $io_name = (string) $config['io_name']; - if ($io_name == '') { - $io_name = 'item'; - } - // user_id table column & auth property if (isset($config['user_id_table_column'])) { $this->user_id_table_column = $config['user_id_table_column']; @@ -73,6 +67,21 @@ class FlupdoCrudMachine extends FlupdoMachine $this->scanTableColumns(); } + $this->setupDefaultMachine($config); + } + + + /** + * Setup basic CRUD machine. + */ + protected function setupDefaultMachine($config) + { + // Name of inputs and outputs with properties + $io_name = (string) $config['io_name']; + if ($io_name == '') { + $io_name = 'item'; + } + // Exists state only $this->states = array( 'exists' => array(
FlupdoCrudMachine: Move definition of default state and transitions to overridable method.
smalldb_libSmalldb
train
php
49d13fcb4ac7c9c5d1cdbf01a0846bda703370ed
diff --git a/src/Command/ChainCommand.php b/src/Command/ChainCommand.php index <HASH>..<HASH> 100644 --- a/src/Command/ChainCommand.php +++ b/src/Command/ChainCommand.php @@ -87,7 +87,7 @@ class ChainCommand extends ContainerAwareCommand } $this->getHelper('chain') - ->addCommand($command['command'], $moduleInputs, $interactive, $learning); + ->addCommand($command['name'], $moduleInputs, $interactive, $learning); } } }
#<I>: [ChainCommand] Add "name" to the yaml definition reguirement. fixes #<I>.
hechoendrupal_drupal-console
train
php
0739e85c7d85c3b1fa53b157ec9ac6af27688a77
diff --git a/core-bundle/tests/DependencyInjection/ContaoCoreExtensionTest.php b/core-bundle/tests/DependencyInjection/ContaoCoreExtensionTest.php index <HASH>..<HASH> 100644 --- a/core-bundle/tests/DependencyInjection/ContaoCoreExtensionTest.php +++ b/core-bundle/tests/DependencyInjection/ContaoCoreExtensionTest.php @@ -646,7 +646,6 @@ class ContaoCoreExtensionTest extends TestCase $definition = $this->container->getDefinition('contao.image.resize_calculator'); $this->assertSame(ResizeCalculator::class, $definition->getClass()); - $this->assertFalse($definition->isPublic()); } /** @@ -789,7 +788,6 @@ class ContaoCoreExtensionTest extends TestCase $definition = $this->container->getDefinition('contao.menu.renderer'); $this->assertSame(ListRenderer::class, $definition->getClass()); - $this->assertTrue($definition->isPublic()); $this->assertSame('contao.menu.matcher', (string) $definition->getArgument(0)); }
[Core] Fix the tests.
contao_contao
train
php
aa37c4d33801a12be688bdeb72a9fe01ef8fbed2
diff --git a/lib/l20n/resolver.js b/lib/l20n/resolver.js index <HASH>..<HASH> 100644 --- a/lib/l20n/resolver.js +++ b/lib/l20n/resolver.js @@ -162,9 +162,10 @@ function interpolate(ctxdata, env, arr) { } function resolveSelector(ctxdata, env, expr, index) { - var selector = resolveIdentifier(ctxdata, env, index[0].v); + var selectorName = index[0].v; + var selector = resolveIdentifier(ctxdata, env, selectorName); if (selector === undefined) { - throw new L10nError('Unknown selector: ' + index[0].v); + throw new L10nError('Unknown selector: ' + selectorName); } if (typeof selector !== 'function') { @@ -174,7 +175,7 @@ function resolveSelector(ctxdata, env, expr, index) { var argLength = index.length - 1; if (selector.length !== argLength) { - throw new L10nError('Macro ' + index[0] + ' expects ' + + throw new L10nError('Macro ' + selectorName + ' expects ' + selector.length + ' argument(s), yet ' + argLength + ' given'); }
Bug <I> - Use selector name in resolver's error message. r=gandalf
l20n_l20n.js
train
js
f92cd7771b53057c37e280ad223eaac906556faa
diff --git a/tests/Relation/OneToOneTestCase.php b/tests/Relation/OneToOneTestCase.php index <HASH>..<HASH> 100644 --- a/tests/Relation/OneToOneTestCase.php +++ b/tests/Relation/OneToOneTestCase.php @@ -69,4 +69,18 @@ class Doctrine_Relation_OneToOne_TestCase extends Doctrine_UnitTestCase $this->assertEqual($ref->name, 'ref 1'); $this->assertEqual($ref->createdBy->name, 'ref 2'); } + + public function testUnsetRelation() + { + $user = new User(); + $user->name = "test"; + $email = new Email(); + $email->address = "test@test.com"; + $user->Email = $email; + $user->save(); + $this->assertTrue($user->Email instanceOf Email); + $user->Email = Email::getNullObject(); + $user->save(); + $this->assertTrue($user->Email instanceOf Doctrine_Null); + } }
added test to ensure that a link to a hasOne resource can be unset
doctrine_annotations
train
php
67391f76b327864ace0745dae624d62c17110f55
diff --git a/libraries/mako/Mako.php b/libraries/mako/Mako.php index <HASH>..<HASH> 100644 --- a/libraries/mako/Mako.php +++ b/libraries/mako/Mako.php @@ -346,10 +346,10 @@ namespace mako $highlight = function($string) { - $search = array("\n", '<code>', '</code>', '<span style="color: #0000BB">&lt;?php&nbsp;'); - $replace = array('', '', '', '<span style="color: #0000BB">'); + $search = array("\n", '<code>', '</code>', '<span style="color: #0000BB">&lt;?php&nbsp;', '#$@r4!/*'); + $replace = array('', '', '', '<span style="color: #0000BB">', '/*'); - return str_replace($search, $replace, highlight_string('<?php ' . $string, true)); + return str_replace($search, $replace, highlight_string('<?php ' . str_replace('/*', '#$@r4!/*', $string), true)); }; $handle = fopen($file, 'r');
Fix for compile errors when highlighting the first line of a multi line comment
mako-framework_framework
train
php
23c9c1111cfb226c23a539a143c26daca365ab40
diff --git a/classes/Poll.php b/classes/Poll.php index <HASH>..<HASH> 100644 --- a/classes/Poll.php +++ b/classes/Poll.php @@ -113,6 +113,9 @@ class Poll extends ElggObject { $this->deleteChoices(); + // Ignore access (necessary in case a group admin is editing the poll of another group member) + $ia = elgg_set_ignore_access(true); + $i = 0; foreach ($choices as $choice) { $poll_choice = new ElggObject(); @@ -127,6 +130,8 @@ class Poll extends ElggObject { add_entity_relationship($poll_choice->guid, 'poll_choice', $this->guid); $i += 1; } + + elgg_set_ignore_access($ia); } /**
Ignore access for adding poll choices to allow for group admins editing polls of other group members
iionly_poll
train
php
9d55a6cb13bc2e662425baff60a9add2557ded6e
diff --git a/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/dsl/internal/PodOperationsImpl.java b/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/dsl/internal/PodOperationsImpl.java index <HASH>..<HASH> 100644 --- a/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/dsl/internal/PodOperationsImpl.java +++ b/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/dsl/internal/PodOperationsImpl.java @@ -154,7 +154,9 @@ public class PodOperationsImpl extends HasMetadataOperation<Pod, PodList, Doneab URL url = new URL(URLUtils.join(getResourceUrl().toString(), getLogParameters() + "&follow=true")); Request request = new Request.Builder().url(url).get().build(); final LogWatchCallback callback = new LogWatchCallback(out); - client.newCall(request).enqueue(callback); + OkHttpClient clone = client.clone(); + clone.setReadTimeout(0, TimeUnit.MILLISECONDS); + clone.newCall(request).enqueue(callback); callback.waitUntilReady(); return callback; } catch (Throwable t) {
Disable read timeout for log watching
fabric8io_kubernetes-client
train
java