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
652cab9bc82543a822331ecf069eae1b1a01240c
diff --git a/ceph_deploy/tests/unit/util/test_net.py b/ceph_deploy/tests/unit/util/test_net.py index <HASH>..<HASH> 100644 --- a/ceph_deploy/tests/unit/util/test_net.py +++ b/ceph_deploy/tests/unit/util/test_net.py @@ -1,3 +1,13 @@ +try: + from urllib.error import HTTPError +except ImportError: + from urllib2 import HTTPError + +try: + from StringIO import StringIO +except ImportError: + from io import StringIO + from ceph_deploy.util import net from ceph_deploy.tests import util import pytest @@ -30,3 +40,14 @@ class TestIpInSubnet(object): @pytest.mark.parametrize('ip', util.generate_ips("10.9.8.0", "10.9.8.255")) def test_false_for_24_subnets(self, ip): assert net.ip_in_subnet(ip, "10.9.1.0/24") is False + + +class TestGetRequest(object): + + def test_urlopen_fails(self, monkeypatch): + def bad_urlopen(url): + raise HTTPError('url', 500, 'error', '', StringIO()) + + monkeypatch.setattr(net, 'urlopen', bad_urlopen) + with pytest.raises(RuntimeError): + net.get_request('https://example.ceph.com')
[RM-<I>] tests: add a unit test for the url utility
ceph_ceph-deploy
train
py
423afb678341d7b7e00cbade0314d61a5c4a116d
diff --git a/btfxwss/client.py b/btfxwss/client.py index <HASH>..<HASH> 100644 --- a/btfxwss/client.py +++ b/btfxwss/client.py @@ -1,5 +1,6 @@ # Import Built-Ins import logging +import time # Import Homebrew from btfxwss.connection import WebSocketConnection @@ -333,6 +334,10 @@ class BtfxWss: :return: """ self.conn.reconnect() + while not self.conn.connected.is_set(): + log.info("reset(): Waiting for connection to be set up..") + time.sleep(1) + for key in self.channel_configs: self.conn.send(**self.channel_configs[key]) diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -1,7 +1,7 @@ from distutils.core import setup -setup(name='btfxwss', version='1.1.12', author='Nils Diefenbach', +setup(name='btfxwss', version='1.1.13', author='Nils Diefenbach', author_email='[email protected]', url="https://github.com/nlsdfnbch/bitfinex_wss", license='LICENCSE', packages=['btfxwss'], install_requires=['websocket-client'],
#<I> fix for subscription before connection was established
Crypto-toolbox_btfxwss
train
py,py
421bde0bad667fc4fdf9ccaf7f057222ce19c9ad
diff --git a/src/index.js b/src/index.js index <HASH>..<HASH> 100644 --- a/src/index.js +++ b/src/index.js @@ -37,7 +37,11 @@ var V = function(selector) { // Assign the selector by calling this.query if its an element, otherwise assign it to this.nodes directly. if (selector) { if (this.typeOf(selector) === 'string') { - assignNodes(Array.prototype.slice.call(this.query(document, selector))); + try { + assignNodes(Array.prototype.slice.call(this.query(document, selector))); + } catch (e) { + this.string = selector; + } if (typeof this.node === 'undefined') { this.string = selector; }
Add a catcher if a node is not valid, and hand the selector off to this.string
jaszhix_vquery
train
js
77b3b4dfc5f9c54637dea84a83bb503189a17346
diff --git a/src/main/java/com/premiumminds/webapp/wicket/testing/AbstractComponentTest.java b/src/main/java/com/premiumminds/webapp/wicket/testing/AbstractComponentTest.java index <HASH>..<HASH> 100644 --- a/src/main/java/com/premiumminds/webapp/wicket/testing/AbstractComponentTest.java +++ b/src/main/java/com/premiumminds/webapp/wicket/testing/AbstractComponentTest.java @@ -203,10 +203,7 @@ public abstract class AbstractComponentTest extends EasyMockSupport implements I */ @After public void tearDown() { - if (running) { - running = false; - wicketApp.setAjaxRequestTargetProvider(orig); - } + resetTest(); } /** @@ -308,6 +305,16 @@ public abstract class AbstractComponentTest extends EasyMockSupport implements I } /** + * Resets the test. Useful for running multiple components in the same test method. + */ + protected void resetTest() { + if (running) { + running = false; + wicketApp.setAjaxRequestTargetProvider(orig); + } + } + + /** * This method is a part of <tt>IContextProvider&lt;AjaxRequestTarget, Page&gt;</tt> implementation and is not * meant to be called by user code. *
New method resetTest, resets the test. Useful to run multiple component tests in the same test method.
premium-minds_pm-wicket-utils
train
java
51a15d23bdeec9bc6dd91eab3fa5caf9abe7089d
diff --git a/plugins/commands/box/command/list.rb b/plugins/commands/box/command/list.rb index <HASH>..<HASH> 100644 --- a/plugins/commands/box/command/list.rb +++ b/plugins/commands/box/command/list.rb @@ -22,7 +22,7 @@ module VagrantPlugins argv = parse_options(opts) return if !argv - boxes = @env.boxes.all.sort + boxes = @env.boxes.all if boxes.empty? return @env.ui.warn(I18n.t("vagrant.commands.box.no_installed_boxes"), prefix: false) end
Correct box version sorting of box list command. Boxes are already correctly sorted as a result of PRs #<I> and #<I>. The extra sort here breaks.
hashicorp_vagrant
train
rb
63c4b53b098ada3397ece1c636b490d67058feda
diff --git a/src/engine/target.js b/src/engine/target.js index <HASH>..<HASH> 100644 --- a/src/engine/target.js +++ b/src/engine/target.js @@ -319,11 +319,13 @@ class Target extends EventEmitter { */ deleteVariable (id) { if (this.variables.hasOwnProperty(id)) { - const variable = this.variables[id]; + // Get info about the variable before deleting it + const deletedVariableName = this.variables[id].name; + const deletedVariableWasCloud = this.variables[id].isCloud; delete this.variables[id]; if (this.runtime) { - if (variable.isCloud && this.isStage) { - this.runtime.ioDevices.cloud.requestDeleteVariable(variable.name); + if (deletedVariableWasCloud && this.isStage) { + this.runtime.ioDevices.cloud.requestDeleteVariable(deletedVariableName); } this.runtime.monitorBlocks.deleteBlock(id); this.runtime.requestRemoveMonitor(id);
Replace reference to deleted variable with specific variable info needed.
LLK_scratch-vm
train
js
33cc6c77bc789a6d957272b1fec4a15a7d6ffb2b
diff --git a/plugins/CoreHome/javascripts/dataTable.js b/plugins/CoreHome/javascripts/dataTable.js index <HASH>..<HASH> 100644 --- a/plugins/CoreHome/javascripts/dataTable.js +++ b/plugins/CoreHome/javascripts/dataTable.js @@ -576,7 +576,7 @@ $.extend(DataTable.prototype, UIControl.prototype, { // we change the style of the column currently used as sort column // adding an image and the class columnSorted to the TD - $("th#" + self.param.filter_sort_column + ' #thDIV', domElem).parent() + $("th#" + self.param.filter_sort_column.replace(/([^a-zA-Z_-])/g, "\\$1") + ' #thDIV', domElem).parent() .addClass('columnSorted') .prepend('<div class="sortIconContainer sortIconContainer' + ImageSortClass + ' ' + imageSortClassType + '"><span class="sortIcon" width="' + imageSortWidth + '" height="' + imageSortHeight + '" /></div>'); }
Refs #<I>, make sure sorting doesn't break if column has special characters.
matomo-org_matomo
train
js
21f882c117b6f6b5f19fcc06184f6cdc401f8c3a
diff --git a/tests/cli/IncludedCest.php b/tests/cli/IncludedCest.php index <HASH>..<HASH> 100644 --- a/tests/cli/IncludedCest.php +++ b/tests/cli/IncludedCest.php @@ -147,9 +147,9 @@ class IncludedCest $I->executeCommand('run --coverage-xml'); $I->amInPath('_log'); $I->seeFileFound('coverage.xml'); - $I->seeInThisFile('<class name="BillEvans" namespace="Jazz\Pianist">'); - $I->seeInThisFile('<class name="Musician" namespace="Jazz">'); - $I->seeInThisFile('<class name="Hobbit" namespace="Shire">'); + $I->seeInThisFile('BillEvans" namespace="Jazz\Pianist">'); + $I->seeInThisFile('Musician" namespace="Jazz">'); + $I->seeInThisFile('Hobbit" namespace="Shire">'); } /**
Fix test broken by php-code-coverage <I>
Codeception_base
train
php
2ce0a4e839a602c6a322d604108c33b4ecd181f1
diff --git a/sitetree/sitetreeapp.py b/sitetree/sitetreeapp.py index <HASH>..<HASH> 100644 --- a/sitetree/sitetreeapp.py +++ b/sitetree/sitetreeapp.py @@ -368,6 +368,8 @@ class SiteTree(object): tree_alias = self.resolve_var(tree_alias) # Get tree. self.get_sitetree(tree_alias) + # Mark path to current item. + self.tree_climber(tree_alias, self.get_tree_current_item(tree_alias)) tree_items = self.get_children(tree_alias, parent_item) tree_items = self.filter_items(tree_items, navigation_type) my_template = template.loader.get_template(use_template)
* Added 'in_current_branch' item attribute resolution into 'children' method.
idlesign_django-sitetree
train
py
8ef452a5b813986ce95b590fc2d51ec510a7ca3c
diff --git a/test/configCases/cache-dependencies/managed-items/webpack.config.js b/test/configCases/cache-dependencies/managed-items/webpack.config.js index <HASH>..<HASH> 100644 --- a/test/configCases/cache-dependencies/managed-items/webpack.config.js +++ b/test/configCases/cache-dependencies/managed-items/webpack.config.js @@ -23,5 +23,8 @@ module.exports = { expect(fileDeps).toContain(path.resolve(__dirname, "index.js")); }); } - ] + ], + module: { + unsafeCache: false + } }; diff --git a/test/watchCases/snapshot/unable-to-snapshot/webpack.config.js b/test/watchCases/snapshot/unable-to-snapshot/webpack.config.js index <HASH>..<HASH> 100644 --- a/test/watchCases/snapshot/unable-to-snapshot/webpack.config.js +++ b/test/watchCases/snapshot/unable-to-snapshot/webpack.config.js @@ -6,5 +6,8 @@ module.exports = (env, { srcPath }) => ({ }, snapshot: { managedPaths: [path.resolve(srcPath, "node_modules")] + }, + module: { + unsafeCache: false } });
disable unsafeCache in test case as changes won't be detected otherwise
webpack_webpack
train
js,js
8905165f97449e960fcc85a6d847f96a38b503a8
diff --git a/treebeard/forms.py b/treebeard/forms.py index <HASH>..<HASH> 100644 --- a/treebeard/forms.py +++ b/treebeard/forms.py @@ -162,7 +162,7 @@ class MoveNodeForm(forms.ModelForm): pos = 'first-sibling' self.instance.move(self._meta.model.get_first_root_node(), pos) # Reload the instance - self.instance = self._meta.model.objects.get(pk=self.instance.pk) + self.instance.refresh_from_db() super().save(commit=commit) return self.instance
Rely on refresh_from_db instead of low level _meta calls Let's use these new fancy Django <I> features
django-treebeard_django-treebeard
train
py
181fa3269dca5307b97a70647d30ded256d10040
diff --git a/src/java/com/threerings/cast/CharacterSprite.java b/src/java/com/threerings/cast/CharacterSprite.java index <HASH>..<HASH> 100644 --- a/src/java/com/threerings/cast/CharacterSprite.java +++ b/src/java/com/threerings/cast/CharacterSprite.java @@ -1,5 +1,5 @@ // -// $Id: CharacterSprite.java,v 1.28 2002/05/04 19:38:13 mdb Exp $ +// $Id: CharacterSprite.java,v 1.29 2002/05/06 23:24:15 mdb Exp $ package com.threerings.cast; @@ -192,10 +192,13 @@ public class CharacterSprite extends ImageSprite */ protected void halt () { - // disable animation - setAnimationMode(NO_ANIMATION); - // come to a halt looking settled and at peace - setActionSequence(getRestingAction()); + // only do something if we're actually animating + if (_animMode != NO_ANIMATION) { + // disable animation + setAnimationMode(NO_ANIMATION); + // come to a halt looking settled and at peace + setActionSequence(getRestingAction()); + } } /** The action to use when at rest. */
Only update ourselves in halt() if we actually stopped something. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@<I> <I>f4-<I>e9-<I>-aa3c-eee0fc<I>fb1
threerings_narya
train
java
a1ba153ade3b4f9681a3b4d4a7db889b1deb3c89
diff --git a/lease/multi_read_proxy_test.go b/lease/multi_read_proxy_test.go index <HASH>..<HASH> 100644 --- a/lease/multi_read_proxy_test.go +++ b/lease/multi_read_proxy_test.go @@ -205,7 +205,22 @@ func (t *MultiReadProxyTest) SizeZero_NoRefreshers() { } func (t *MultiReadProxyTest) SizeZero_WithRefreshers() { - AssertTrue(false, "TODO") + t.refresherContents = []string{"", "", "", ""} + t.refresherErrors = make([]error, len(t.refresherContents)) + t.resetProxy() + + // Size + ExpectEq(0, t.proxy.Size()) + + // ReadAt + eofMatcher := Equals(io.EOF) + testCases := []readAtTestCase{ + readAtTestCase{0, 0, eofMatcher, ""}, + readAtTestCase{0, 10, eofMatcher, ""}, + readAtTestCase{5, 10, eofMatcher, ""}, + } + + runReadAtTestCases(t.proxy, testCases) } func (t *MultiReadProxyTest) Size() {
MultiReadProxyTest.SizeZero_WithRefreshers
jacobsa_timeutil
train
go
0a45897b5bd088b3fa3e0ecf6364a0d52c4d2f35
diff --git a/Kwc/Basic/ImageParent/Component.php b/Kwc/Basic/ImageParent/Component.php index <HASH>..<HASH> 100644 --- a/Kwc/Basic/ImageParent/Component.php +++ b/Kwc/Basic/ImageParent/Component.php @@ -39,7 +39,7 @@ class Kwc_Basic_ImageParent_Component extends Kwc_Abstract $ret['defineWidth'] = $this->_getSetting('defineWidth'); $ret['lazyLoadOutOfViewport'] = $this->_getSetting('lazyLoadOutOfViewport'); - $ret['style'] = 'max-width:'.$ret['width'].'px;'; + if (isset($ret['width'])) $ret['style'] = 'max-width:'.$ret['width'].'px;'; if ($this->_getSetting('defineWidth')) $ret['style'] .= 'width:'.$ret['width'].'px;'; $ret['containerClass'] = 'container';
fix for undefined width property in ImageParent
koala-framework_koala-framework
train
php
4fef8dbc2fec4fdaa84860d2011ca4bc781108a4
diff --git a/test/routing.js b/test/routing.js index <HASH>..<HASH> 100644 --- a/test/routing.js +++ b/test/routing.js @@ -60,7 +60,7 @@ describe('tork', function () { it('should be put in the stack', function () { app.get(function () {}) - should.not.exist(app.stack[0].method) + app.stack[0].method.should.equal('get') should.not.exist(app.stack[0].route) app.stack[0].handler.should.be.a('function') })
Fixed a bug with a test, it now passes.
leeola_tork
train
js
c54f674f78c01d439faad41785b79b6fafd974bf
diff --git a/html-element.js b/html-element.js index <HASH>..<HASH> 100644 --- a/html-element.js +++ b/html-element.js @@ -174,7 +174,8 @@ function isText (value) { } function isNode (value) { - return value instanceof Node + // for some reason, img elements are not instances of Node + return value instanceof global.Node || (global.HTMLElement && value instanceof global.HTMLElement) } function getNode (document, nodeOrText) {
html-element: handle image tags passed into attributes field
mmckegg_mutant
train
js
3114f8afecee3f9f1805364e1770011b260add6a
diff --git a/src/BaseModel.php b/src/BaseModel.php index <HASH>..<HASH> 100644 --- a/src/BaseModel.php +++ b/src/BaseModel.php @@ -417,6 +417,36 @@ abstract class BaseModel } /** + * Model Join + * + * Construct a join statement from a model object. The method automatically + * obtains the primary key column name from the joining model, construcing a + * basic join statement for that models table automagically. If the joining + * model does not have a primary key column name set an exception is thrown. + * + * @param \SlaxWeb\Database\BaseModel $model Joining model instance + * @param string $forKey Foreign key against which the joining models primary key is matched + * @param string $type Join type, default string("INNER JOIN") + * @param string $cOpr Comparison operator for the two keys + * @return self + * + * @exceptions \SlaxWeb\Database\Exception\NoPrimKeyException + */ + public function joinModel( + BaseModel $model, + string $forKey, + string $type = "INNER JOIN", + string $cOpr = "=" + ): self { + $primKey = $model->getPrimKey(); + if (empty($primKey)) { + throw new Exception\NoPrimKeyException; + } + + return $this->join($model->table, $type)->joinCond($primKey, $forKey, $cOpr); + } + + /** * Add join condition * * Adds a JOIN condition to the last join added. If no join was yet added, an
add join model method and construct join from external model
SlaxWeb_Database
train
php
f7ecbfeede29e231015f4b419a6547ff3062b5f1
diff --git a/lib/detectTerminal.js b/lib/detectTerminal.js index <HASH>..<HASH> 100644 --- a/lib/detectTerminal.js +++ b/lib/detectTerminal.js @@ -43,7 +43,8 @@ exports.guessTerminal = function guessTerminal() var safe = ( process.env.COLORTERM || ( process.env.TERM !== 'xterm' && process.env.TERM !== 'xterm-256color' ) ) ? true : false ; - var t256color = process.env.TERM.match( /256/ ) || process.env.COLORTERM.match( /256/ ) ; + var t256color = ( process.env.TERM && process.env.TERM.match( /256/ ) ) || + ( process.env.COLORTERM && process.env.COLORTERM.match( /256/ ) ) ; switch ( appId ) {
Bugfix when COLORTERM is not defined, it causes a crash :/
cronvel_terminal-kit
train
js
18fae5312435ffe79f36af8428f0acdb5552b237
diff --git a/controllers/request.js b/controllers/request.js index <HASH>..<HASH> 100644 --- a/controllers/request.js +++ b/controllers/request.js @@ -51,7 +51,8 @@ class RequestController { let sockets = [] let request = { id: process.hrtime().join('').toString(), - url: req.url + url: req.url, + method: req.method } // Send check to root nsp
fix: Add RESTful method to initial file check
cubic-js_cubic
train
js
7948a7ef0830143c108fb833dab262a73c1ad4e2
diff --git a/isort/settings.py b/isort/settings.py index <HASH>..<HASH> 100644 --- a/isort/settings.py +++ b/isort/settings.py @@ -62,7 +62,7 @@ default = {'force_to_top': [], "sysconfig", "tabnanny", "tarfile", "tempfile", "textwrap", "threading", "time", "timeit", "trace", "traceback", "unittest", "urllib", "urllib2", "urlparse", "usercustomize", "uuid", "warnings", "weakref", "webbrowser", "whichdb", "xml", - "xmlrpclib", "zipfile", "zipimport", "zlib", 'builtins', '__builtin__'], + "xmlrpclib", "zipfile", "zipimport", "zlib", 'builtins', '__builtin__', 'thread'], 'known_third_party': ['google.appengine.api'], 'known_first_party': [], 'multi_line_output': WrapModes.GRID,
Fix first problem stated in issue #<I>: make thread explicitly defined as part of the known_standard_library
timothycrosley_isort
train
py
acbb8b2fdda75eb42ea7997acce41f58a7c16f14
diff --git a/chorus-sikulix/src/test/junit/org/chorusbdd/chorus/sikulix/JythonStepRegexBuilderTest.java b/chorus-sikulix/src/test/junit/org/chorusbdd/chorus/sikulix/JythonStepRegexBuilderTest.java index <HASH>..<HASH> 100644 --- a/chorus-sikulix/src/test/junit/org/chorusbdd/chorus/sikulix/JythonStepRegexBuilderTest.java +++ b/chorus-sikulix/src/test/junit/org/chorusbdd/chorus/sikulix/JythonStepRegexBuilderTest.java @@ -24,7 +24,7 @@ public class JythonStepRegexBuilderTest { @Before public void setup() { - InputStream resourceAsStream = this.getClass().getClassLoader().getResourceAsStream("org\\chorusbdd\\chorus\\sikulix\\stepRegexTest.py"); + InputStream resourceAsStream = this.getClass().getResourceAsStream("stepRegexTest.py"); interpreter.execfile(resourceAsStream); }
Remove the dependency on path slashes that prevent working on Mac. Former-commit-id: c3c6b4f<I>fbddc6e<I>b<I>b3c<I>a<I>a<I>
Chorus-bdd_Chorus
train
java
db8f7f6d814dd109ab143a09e9a984355ac69427
diff --git a/spyder/plugins/ipythonconsole/widgets/client.py b/spyder/plugins/ipythonconsole/widgets/client.py index <HASH>..<HASH> 100644 --- a/spyder/plugins/ipythonconsole/widgets/client.py +++ b/spyder/plugins/ipythonconsole/widgets/client.py @@ -484,9 +484,7 @@ class ClientWidget(QWidget, SaveHistoryMixin, SpyderWidgetMixin): def show_kernel_error(self, error): """Show kernel initialization errors in infowidget.""" self.error_text = error - if "issue1666807" not in error: - # The installer has some strange relative python - InstallerIPythonKernelError(error) + InstallerIPythonKernelError(error) # Replace end of line chars with <br> eol = sourcecode.get_eol_chars(error)
revert fix for issue<I>
spyder-ide_spyder
train
py
7a3aa1067f0b80f74cae3c3b0a98d36b662cb9d9
diff --git a/aioxmpp/testutils.py b/aioxmpp/testutils.py index <HASH>..<HASH> 100644 --- a/aioxmpp/testutils.py +++ b/aioxmpp/testutils.py @@ -39,6 +39,11 @@ import aioxmpp.nonza as nonza from aioxmpp.utils import etree +# FIXME: find a way to detect Travis CI and use 2.0 there, 1.0 otherwise. +# 1.0 is sufficient normally, but on Travis we sometimes get spurious failures. +DEFAULT_TIMEOUT = 2.0 + + def make_protocol_mock(): return unittest.mock.Mock([ "connection_made", @@ -50,7 +55,7 @@ def make_protocol_mock(): ]) -def run_coroutine(coroutine, timeout=1.0, loop=None): +def run_coroutine(coroutine, timeout=DEFAULT_TIMEOUT, loop=None): if not loop: loop = asyncio.get_event_loop() return loop.run_until_complete(
testutils: Increase the run_coroutine timeout This is to help stabilising tests on Travis CI, we’re seeing quite a few spurious failures there.
horazont_aioxmpp
train
py
0223c61fc0fe5010a82051cbd6ca6a9c637bd4ce
diff --git a/lib/active_record_doctor/version.rb b/lib/active_record_doctor/version.rb index <HASH>..<HASH> 100644 --- a/lib/active_record_doctor/version.rb +++ b/lib/active_record_doctor/version.rb @@ -1,3 +1,3 @@ module ActiveRecordDoctor - VERSION = "1.0.2" + VERSION = "1.0.3" end
Bump the version number to <I>
gregnavis_active_record_doctor
train
rb
a07bd96a101034a6944e3a58dc50d9936a20e2f9
diff --git a/src/Illuminate/Contracts/Routing/ResponseFactory.php b/src/Illuminate/Contracts/Routing/ResponseFactory.php index <HASH>..<HASH> 100644 --- a/src/Illuminate/Contracts/Routing/ResponseFactory.php +++ b/src/Illuminate/Contracts/Routing/ResponseFactory.php @@ -26,7 +26,7 @@ interface ResponseFactory /** * Create a new response for a given view. * - * @param string $view + * @param string|array $view * @param array $data * @param int $status * @param array $headers
accept a string or array of views (#<I>) this goes along with PR #<I> . I'm not sure what our practice is for changes like this on an interface.... I'm not technically changing any of the code, just a docblock, so is it safe to send to 6.x?
laravel_framework
train
php
1a811cfaf0bef3c0e05d42206e9d9a53ffeb1409
diff --git a/Kwf_js/EyeCandy/Lightbox/Lightbox.js b/Kwf_js/EyeCandy/Lightbox/Lightbox.js index <HASH>..<HASH> 100644 --- a/Kwf_js/EyeCandy/Lightbox/Lightbox.js +++ b/Kwf_js/EyeCandy/Lightbox/Lightbox.js @@ -40,6 +40,7 @@ $(document).on('click', 'a[data-kwc-lightbox]', function(event) { }); historyState.currentState.lightbox = href; historyState.pushState(document.title, href); + statistics.trackView(href); event.preventDefault(); }); @@ -388,8 +389,6 @@ Lightbox.prototype = { } this.lightboxEl.addClass('kwfUp-kwfLightboxOpen'); this.style.afterShow(options); - - statistics.trackView(this.href); }, close: function(options) { lightboxHelper.currentOpen = null;
Fire trackView when opening lightbox after setting lightbox url
koala-framework_koala-framework
train
js
c20247dd4adae73a603e11126fdcd8e6e80b1a0f
diff --git a/luaparser/asttokens.py b/luaparser/asttokens.py index <HASH>..<HASH> 100644 --- a/luaparser/asttokens.py +++ b/luaparser/asttokens.py @@ -264,6 +264,11 @@ class LineEditor(GroupEditor): t.lineNumber = first.lineNumber - 1 nextLine = nextLine.next() + def toSource(self): + line = TokenPrinter().toStr(self._tokens) + return line.strip() + + class TokenPrinter(): """Class to render a token list to a string. """
asttokens: strip source returned by line editor.
boolangery_py-lua-parser
train
py
d4539d2abbb7e41658e5c6ba5935d4c612a18678
diff --git a/polyfills/Object/keys/polyfill.js b/polyfills/Object/keys/polyfill.js index <HASH>..<HASH> 100644 --- a/polyfills/Object/keys/polyfill.js +++ b/polyfills/Object/keys/polyfill.js @@ -88,7 +88,6 @@ Object.keys = (function() { }; return function keys(object) { - var isObject = object !== null && typeof object === 'object'; var isFunction = toStr.call(object) === '[object Function]'; var isArguments = isArgumentsObject(object); var isString = toStr.call(object) === '[object String]';
Remove unused variable (#<I>)
Financial-Times_polyfill-service
train
js
5547cca779b73557dcbda80e1baacb7508be6cf7
diff --git a/zipline/data/data_portal.py b/zipline/data/data_portal.py index <HASH>..<HASH> 100644 --- a/zipline/data/data_portal.py +++ b/zipline/data/data_portal.py @@ -887,11 +887,15 @@ class DataPortal(object): ) df.fillna(method='ffill', inplace=True) + # forward-filling will incorrectly produce values after the end of + # an asset's lifetime, so write NaNs back over the asset's + # end_date. + normed_index = df.index.normalize() for asset in df.columns: - if df.index[-1] >= asset.end_date: + if history_end >= asset.end_date: # if the window extends past the asset's end date, set # all post-end-date values to NaN in that asset's series - df.loc[df.index.normalize() > asset.end_date, asset] = nan + df.loc[normed_index > asset.end_date, asset] = nan return df def _get_minute_window_for_assets(self, assets, field, minutes_for_window):
PERF: Pull out loop-invariant code. This shaves off <I> out of <I> seconds for an algorithm that makes a large number of large universe, short window_length `history()` calls.
quantopian_zipline
train
py
72310b71c349418e70abf71ab93fc9dbdec51a70
diff --git a/packages/workflow/settings/index.js b/packages/workflow/settings/index.js index <HASH>..<HASH> 100644 --- a/packages/workflow/settings/index.js +++ b/packages/workflow/settings/index.js @@ -68,7 +68,7 @@ const settings = { }, css() { - return '[name]-[contenthash:8].chunk.css'; + return this.isProduction() ? '[name]-[contenthash:8].chunk.css' : '[name].chunk.css'; }, // Returns the JSON object from contents or the JSON object from @@ -85,11 +85,11 @@ const settings = { // If the contents of a file don't change, the file should be cached in the browser. // https://webpack.js.org/guides/caching/#output-filenames fileName() { - return '[name]-[contenthash:8].chunk.js'; + return this.isProduction() ? '[name]-[contenthash:8].chunk.js' : '[name].js'; }, chunkFileName() { - return '[name]-[contenthash:8].chunk.js'; + return this.isProduction() ? '[name]-[contenthash:8].chunk.js' : '[name].chunk.js'; }, output() {
refactor(workflow): only uses contenthash in production <URL>
Availity_availity-workflow
train
js
17e08143e3497338f9231841c61b801867ecec3c
diff --git a/flask_user/views.py b/flask_user/views.py index <HASH>..<HASH> 100644 --- a/flask_user/views.py +++ b/flask_user/views.py @@ -324,6 +324,9 @@ def register(): user_invite = db_adapter.find_first_object(db_adapter.UserInvitationClass, token=invite_token) if user_invite: register_form.invite_token.data = invite_token + else: + flash("Invalid invitation token", "error") + return redirect(url_for('user.login')) if request.method!='POST': login_form.next.data = register_form.next.data = next
redirect to login when invalid token is given
lingthio_Flask-User
train
py
3f88320595023696fdbd30af625f325dac444a57
diff --git a/tests/unit/framework/caching/CacheTestCase.php b/tests/unit/framework/caching/CacheTestCase.php index <HASH>..<HASH> 100644 --- a/tests/unit/framework/caching/CacheTestCase.php +++ b/tests/unit/framework/caching/CacheTestCase.php @@ -145,14 +145,9 @@ abstract class CacheTestCase extends TestCase $cache = $this->getCacheInstance(); $this->assertTrue($cache->set('expire_test', 'expire_test', 2)); - sleep(1); + usleep(500000); $this->assertEquals('expire_test', $cache->get('expire_test')); - // wait a bit more than 2 sec to avoid random test failure - if (isset($_ENV['TRAVIS']) && substr(StringHelper::basename(get_class($this)), 0, 8) == 'MemCache') { - sleep(3); // usleep with 2,5 seconds does not work well on travis and memcache - } else { - usleep(2500000); - } + usleep(2500000); $this->assertFalse($cache->get('expire_test')); }
second try to fix random memcache failure on travis issue #<I>
yiisoft_yii2-debug
train
php
a65b444ab872c16e08fc756d3b1716e6bfc0d192
diff --git a/lib/rspec/illustrate.rb b/lib/rspec/illustrate.rb index <HASH>..<HASH> 100644 --- a/lib/rspec/illustrate.rb +++ b/lib/rspec/illustrate.rb @@ -12,7 +12,7 @@ module RSpec # @param args [Array<Hash, Symbol>] Additional options. # @return The given illustration object. def illustrate(content, *args) - illustration = { :text => content, + illustration = { :text => content.to_s, :show_when_passed => true, :show_when_failed => true, :show_when_pending => true }
Force text content to be a string.
ErikSchlyter_rspec-illustrate
train
rb
67a0c7e2fd442f77830a2ebceabaea0070083eb2
diff --git a/mousetrap.js b/mousetrap.js index <HASH>..<HASH> 100644 --- a/mousetrap.js +++ b/mousetrap.js @@ -124,7 +124,8 @@ 'option': 'alt', 'command': 'meta', 'return': 'enter', - 'escape': 'esc' + 'escape': 'esc', + 'mod': /Mac|iPod|iPhone|iPad/.test(navigator.platform) ? 'meta' : 'ctrl' }, /**
Add generic `mod` alias for command/ctrl The `mod` modifier is an alias for `command` on OS X and iOS, and `ctrl` everywhere else.
ccampbell_mousetrap
train
js
eeb66410469cd729eb14e030a2a74b3471aac49f
diff --git a/executor/adapter.go b/executor/adapter.go index <HASH>..<HASH> 100644 --- a/executor/adapter.go +++ b/executor/adapter.go @@ -816,6 +816,7 @@ var ( // 2. record summary statement. // 3. record execute duration metric. // 4. update the `PrevStmt` in session variable. +// 5. reset `DurationParse` in session variable. func (a *ExecStmt) FinishExecuteStmt(txnTS uint64, succ bool, hasMoreResults bool) { sessVars := a.Ctx.GetSessionVars() execDetail := sessVars.StmtCtx.GetExecDetails() @@ -853,6 +854,8 @@ func (a *ExecStmt) FinishExecuteStmt(txnTS uint64, succ bool, hasMoreResults boo } else { sessionExecuteRunDurationGeneral.Observe(executeDuration.Seconds()) } + // Reset DurationParse due to the next statement may not need to be parsed (not a text protocol query). + sessVars.DurationParse = 0 } // CloseRecordSet will finish the execution of current statement and do some record work
*: fix missing reset for `DurationParse` (#<I>)
pingcap_tidb
train
go
e3015de0d46c506a0a516a3a0ad2839a7d47ef1c
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -1,6 +1,6 @@ """setup.py - install script for pandoc-eqnos.""" -# Copyright 2015-2019 Thomas J. Duck. +# Copyright 2015-2020 Thomas J. Duck. # All rights reserved. # # This program is free software: you can redistribute it and/or modify @@ -17,9 +17,14 @@ import re import io +import textwrap +import sys +import shutil from setuptools import setup +# pylint: disable=invalid-name + DESCRIPTION = """\ A pandoc filter for numbering equations and their references when converting markdown to other formats. @@ -58,3 +63,12 @@ setup( 'Programming Language :: Python' ] ) + +# Check that the pandoc-eqnos script is on the PATH +if not shutil.which('pandoc-xnos'): + msg = """ + ERROR: `pandoc-eqnos` script not found. You will need to find + the script and ensure it is on your PATH. Please file an Issue at + https://github.com/tomduck/pandoc-eqnos/issues.\n""" + print(textwrap.dedent(msg)) + sys.exit(-1)
Check that pandoc-eqnos is on path.
tomduck_pandoc-eqnos
train
py
117f0bbce8b3db735b8deedddb8871acc88f8c51
diff --git a/pulsar/apps/rpc/handlers.py b/pulsar/apps/rpc/handlers.py index <HASH>..<HASH> 100755 --- a/pulsar/apps/rpc/handlers.py +++ b/pulsar/apps/rpc/handlers.py @@ -23,7 +23,7 @@ def wrap_object_call(fname,namefunc): def wrap_function_call(func,namefunc): - + #TODO: remove def _(self,*args,**kwargs): return func(self,*args,**kwargs) diff --git a/pulsar/apps/rpc/jsonrpc.py b/pulsar/apps/rpc/jsonrpc.py index <HASH>..<HASH> 100755 --- a/pulsar/apps/rpc/jsonrpc.py +++ b/pulsar/apps/rpc/jsonrpc.py @@ -246,7 +246,8 @@ usage is simple:: class LocalJsonProxy(JsonProxy): - + '''A proxy class to use when accessing the rpc within the rpc application +domain.''' def setup(self, handler = None, environ = None, **kwargs): self.local['handler'] = handler self.local['environ'] = environ
comments on rpc handlers
quantmind_pulsar
train
py,py
5a46cf1d48c015e154b38bba4258bc060d3c045d
diff --git a/test/httpstress_test.go b/test/httpstress_test.go index <HASH>..<HASH> 100644 --- a/test/httpstress_test.go +++ b/test/httpstress_test.go @@ -53,12 +53,12 @@ func TestStressHTTP(t *testing.T) { tr := &http.Transport{ TLSClientConfig: tc, DisableKeepAlives: true, - ResponseHeaderTimeout: time.Second, - TLSHandshakeTimeout: time.Second, + ResponseHeaderTimeout: 10 * time.Second, + TLSHandshakeTimeout: 10 * time.Second, } client := &http.Client{ Transport: tr, - Timeout: 2 * time.Second, + Timeout: 10 * time.Second, } var wg sync.WaitGroup t0 := time.Now()
Be a little more generous with HTTP timeouts
syncthing_syncthing
train
go
ff7f83e74bbc6d2ecaa93fc6da2843d11b84b923
diff --git a/tests/unit/test_streamingresources.py b/tests/unit/test_streamingresources.py index <HASH>..<HASH> 100644 --- a/tests/unit/test_streamingresources.py +++ b/tests/unit/test_streamingresources.py @@ -130,6 +130,12 @@ class TestMarketDefinition(unittest.TestCase): assert self.market_definition.market_base_rate == 5 assert len(self.market_definition.key_line_definitions.key_line) == 2 + def test_missing_open_date(self): + response_json = dict(self.mock_response.json()) + response_json.pop('openDate') + market_definition = MarketDefinition(**response_json) + assert market_definition.open_date is None + class TestMarketDefinitionRunner(unittest.TestCase):
Create MarketDefinition missing openDate unit test This fails because openDate is a positional (required) arg when creating a MarketDefinition resource.
liampauling_betfair
train
py
d26fc5d36005030e816fef8302990e9cc0fcfd36
diff --git a/src/ResultTablePane.js b/src/ResultTablePane.js index <HASH>..<HASH> 100644 --- a/src/ResultTablePane.js +++ b/src/ResultTablePane.js @@ -12,7 +12,7 @@ trackerdash.views.ResultTablePane = Backbone.View.extend({ render: function () { _.each(this.results, function (result) { - result.id = result.dataset.replace(".","_"); + result.id = result.dataset.replace(/\./g, "_"); }); var resultsByDataset = _.groupBy(this.results, function (result) {
Replace all occurrences of dot, not just the first
Kitware_candela
train
js
fb31464d4b147cc2cf8cea19eca2013f112c2116
diff --git a/lib/hoptoad_notifier/railtie.rb b/lib/hoptoad_notifier/railtie.rb index <HASH>..<HASH> 100644 --- a/lib/hoptoad_notifier/railtie.rb +++ b/lib/hoptoad_notifier/railtie.rb @@ -3,8 +3,6 @@ require 'rails' module HoptoadNotifier class Railtie < Rails::Railtie - railtie_name :hoptoad_notifier - rake_tasks do require "hoptoad_notifier/rails3_tasks" end
railtie_name is deprecated
airbrake_airbrake
train
rb
da4e333d66cb55e610e83df5811539af605acc4b
diff --git a/android/src/com/google/zxing/client/android/result/WifiResultHandler.java b/android/src/com/google/zxing/client/android/result/WifiResultHandler.java index <HASH>..<HASH> 100644 --- a/android/src/com/google/zxing/client/android/result/WifiResultHandler.java +++ b/android/src/com/google/zxing/client/android/result/WifiResultHandler.java @@ -61,7 +61,7 @@ public final class WifiResultHandler extends ResultHandler { public void handleButtonPress(int index) { if (index == 0) { WifiParsedResult wifiResult = (WifiParsedResult) getResult(); - WifiManager wifiManager = (WifiManager) getActivity().getSystemService(Context.WIFI_SERVICE); + WifiManager wifiManager = (WifiManager) getActivity().getApplicationContext().getSystemService(Context.WIFI_SERVICE); if (wifiManager == null) { Log.w(TAG, "No WifiManager available from device"); return;
Fixed Wifi mangager memory leak on devices < N (#<I>) AndroidStudio reported the error: Error: The WIFI_SERVICE must be looked up on the Application context or memory will leak on devices < Android N. Try changing to .getApplicationContext() [WifiManagerLeak]
zxing_zxing
train
java
be099d30147f4c3b36eb55d3bae2ef1d079e146f
diff --git a/subprojects/groovy-xml/src/main/java/groovy/util/slurpersupport/GPathResult.java b/subprojects/groovy-xml/src/main/java/groovy/util/slurpersupport/GPathResult.java index <HASH>..<HASH> 100644 --- a/subprojects/groovy-xml/src/main/java/groovy/util/slurpersupport/GPathResult.java +++ b/subprojects/groovy-xml/src/main/java/groovy/util/slurpersupport/GPathResult.java @@ -43,6 +43,7 @@ import java.util.Iterator; import java.util.LinkedList; import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.Stack; /** @@ -369,11 +370,18 @@ public abstract class GPathResult extends GroovyObjectSupport implements Writabl return this; } - /* (non-Javadoc) - * @see java.lang.Object#equals(java.lang.Object) - */ + @Override + public int hashCode() { + return Objects.hash(text()); + } + + @Override public boolean equals(Object obj) { - return text().equals(obj.toString()); + if (!(obj instanceof GPathResult)) { + return false; + } + + return text().equals(((GPathResult) obj).text()); } /**
Refine GPathResult's equals and hashCode
apache_groovy
train
java
642e2da81022857a1a23591f55649a285934b156
diff --git a/formats/folia.py b/formats/folia.py index <HASH>..<HASH> 100644 --- a/formats/folia.py +++ b/formats/folia.py @@ -3435,12 +3435,14 @@ class Document(object): return l def xml(self): - global LIBVERSION + global LIBVERSION, FOLIAVERSION E = ElementMaker(namespace="http://ilk.uvt.nl/folia",nsmap={None: "http://ilk.uvt.nl/folia", 'xml' : "http://www.w3.org/XML/1998/namespace", 'xlink':"http://www.w3.org/1999/xlink"}) attribs = {} attribs['{http://www.w3.org/XML/1998/namespace}id'] = self.id if self.version: attribs['version'] = self.version + else: + attribs['version'] = FOLIAVERSION attribs['generator'] = 'pynlpl.formats.folia-v' + LIBVERSION
on xml output, set version of library if no version is known
proycon_pynlpl
train
py
3c586b0ba6e9dacecdd82e26bbf1ad77f424081f
diff --git a/lib/secretary/gem_version.rb b/lib/secretary/gem_version.rb index <HASH>..<HASH> 100644 --- a/lib/secretary/gem_version.rb +++ b/lib/secretary/gem_version.rb @@ -1,3 +1,3 @@ module Secretary - GEM_VERSION = "1.0.0.beta5" + GEM_VERSION = "1.0.0.beta6" end
Bump gem version to <I>.beta6
SCPR_secretary-rails
train
rb
92a99829883a2479eaa1645fa488bda47f7784f1
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 @@ -246,7 +246,6 @@ module Rscons end end - alias_method :orig_method_missing, :method_missing def method_missing(method, *args) if @builders.has_key?(method.to_s) target, source, vars, *rest = args @@ -261,7 +260,7 @@ module Rscons args: rest, } else - orig_method_missing(method, *args) + super end end diff --git a/spec/rscons/environment_spec.rb b/spec/rscons/environment_spec.rb index <HASH>..<HASH> 100644 --- a/spec/rscons/environment_spec.rb +++ b/spec/rscons/environment_spec.rb @@ -249,8 +249,7 @@ module Rscons describe "#method_missing" do it "calls the original method missing when the target method is not a known builder" do env = Environment.new - env.should_receive(:orig_method_missing).with(:foobar) - env.foobar + expect {env.foobar}.to raise_error /undefined method .foobar./ end it "records the target when the target method is a known builder" do
use #super from #method_missing instead of method aliasing
holtrop_rscons
train
rb,rb
a831c3dc675a7b02752da4ef0a21426d3df9b275
diff --git a/Resources/public/js/simplerights.js b/Resources/public/js/simplerights.js index <HASH>..<HASH> 100644 --- a/Resources/public/js/simplerights.js +++ b/Resources/public/js/simplerights.js @@ -75,7 +75,7 @@ $('input#everyone', simpleRights.getTable(element)).prop('checked', false); } - if (simpleRights.getValue($('input#anonymous', simpleRights.getTable(element))) && + if ( simpleRights.getValue($('input#workspace', simpleRights.getTable(element))) && simpleRights.getValue($('input#platform', simpleRights.getTable(element))) ) {
Fixing "to everyone" right checkbox.
claroline_CoreBundle
train
js
35e929af3530fdc5080e6dae6d4ddc7d0c7bdd7f
diff --git a/hypermap/search/views.py b/hypermap/search/views.py index <HASH>..<HASH> 100644 --- a/hypermap/search/views.py +++ b/hypermap/search/views.py @@ -37,6 +37,14 @@ def csw_global_dispatch(request): return HttpResponseForbidden(template.render(context), content_type='application/xml') env = request.META.copy() + + # TODO: remove this workaround + # HH should be able to pass env['wsgi.input'] without hanging + # details at https://github.com/cga-harvard/HHypermap/issues/94 + if request.method == 'POST': + from StringIO import StringIO + env['wsgi.input'] = StringIO(request.body) + env.update({'local.app_root': os.path.dirname(__file__), 'REQUEST_URI': request.build_absolute_uri()})
apply workaround to HTTP POST handling via wsgi.input (#<I>)
cga-harvard_Hypermap-Registry
train
py
3607ada229fb8828df0f70a04c1a701f7a1837e6
diff --git a/support/design/index.js b/support/design/index.js index <HASH>..<HASH> 100644 --- a/support/design/index.js +++ b/support/design/index.js @@ -264,7 +264,7 @@ ClientSettings.fetchClientSettings = function(clientID, assetsUrl, cb) { id: "L9kBZOpEbLizzCGv6N8n9wNfQhbvREw0" }; - setTimeout(() => cb(null, Immutable.fromJS(settings)), 180); + setTimeout(() => cb(null, settings), 180); } ReactDOM.render(React.createElement(Control), document.getElementById("control-container"));
Fix design page Update the overriden function that simulates retriving the client settings to use the new format.
auth0_lock
train
js
02cd42a3397b635080131b3875b55952606c3099
diff --git a/aiogram/utils/text_decorations.py b/aiogram/utils/text_decorations.py index <HASH>..<HASH> 100644 --- a/aiogram/utils/text_decorations.py +++ b/aiogram/utils/text_decorations.py @@ -185,7 +185,7 @@ class MarkdownDecoration(TextDecoration): return f"`{value}`" def pre(self, value: str) -> str: - return f"```{value}```" + return f"```\n{value}\n```" def pre_language(self, value: str, language: str) -> str: return f"```{language}\n{value}\n```"
Update text_decorations.py (#<I>)
aiogram_aiogram
train
py
f6d973daddd68191ad12cbfe44f7c7ba298d8898
diff --git a/view/frontend/web/js/view/payment/method-renderer/embedded.js b/view/frontend/web/js/view/payment/method-renderer/embedded.js index <HASH>..<HASH> 100755 --- a/view/frontend/web/js/view/payment/method-renderer/embedded.js +++ b/view/frontend/web/js/view/payment/method-renderer/embedded.js @@ -78,7 +78,8 @@ define( * @returns {string} */ getQuoteValue: function() { - return CheckoutCom.getPaymentConfig()['quote_value']; + //return CheckoutCom.getPaymentConfig()['quote_value']; + return quote.getTotals(); }, /**
Bug fix update Corrected quote amount calculation in frontend.
checkout_checkout-magento2-plugin
train
js
91b41f0f47e2bebb5dbd94d979780e7030ad8046
diff --git a/moco-runner/src/main/java/com/github/dreamhead/moco/runner/watcher/WatcherService.java b/moco-runner/src/main/java/com/github/dreamhead/moco/runner/watcher/WatcherService.java index <HASH>..<HASH> 100644 --- a/moco-runner/src/main/java/com/github/dreamhead/moco/runner/watcher/WatcherService.java +++ b/moco-runner/src/main/java/com/github/dreamhead/moco/runner/watcher/WatcherService.java @@ -31,7 +31,7 @@ public class WatcherService { private final Multimap<WatchKey, Path> keys = HashMultimap.create(); private final Multimap<Path, Function<File, Void>> listeners = HashMultimap.create(); - public void start() throws IOException { + public synchronized void start() throws IOException { if (running) { throw new IllegalStateException(); } @@ -72,7 +72,7 @@ public class WatcherService { } } - public void stop() { + public synchronized void stop() { if (this.running) { this.running = false; }
added synchronized to watcher service
dreamhead_moco
train
java
85f7b1568c8538ba22a5207c57aa1a5654bae139
diff --git a/lib/fog/vcloud_director/models/compute/organizations.rb b/lib/fog/vcloud_director/models/compute/organizations.rb index <HASH>..<HASH> 100644 --- a/lib/fog/vcloud_director/models/compute/organizations.rb +++ b/lib/fog/vcloud_director/models/compute/organizations.rb @@ -20,12 +20,12 @@ module Fog def item_list data = service.get_organizations.body - org = data[:Org] # there is only a single Org - service.add_id_from_href!(org) - [org] + orgs = data[:Org].is_a?(Array) ? data[:Org] : [data[:Org]] + orgs.each {|org| service.add_id_from_href!(org)} + orgs end end end end -end \ No newline at end of file +end
[vcloud_director] Allow for multiple Orgs.
fog_fog
train
rb
e9dc0e784dd69e899dc64b6676436d2c83427d6e
diff --git a/src/Vendor/Laravel/Middlewares/Tracker.php b/src/Vendor/Laravel/Middlewares/Tracker.php index <HASH>..<HASH> 100644 --- a/src/Vendor/Laravel/Middlewares/Tracker.php +++ b/src/Vendor/Laravel/Middlewares/Tracker.php @@ -2,6 +2,7 @@ namespace PragmaRX\Tracker\Vendor\Laravel\Middlewares; +use Config; use Closure; class Tracker @@ -16,7 +17,10 @@ class Tracker */ public function handle($request, Closure $next) { - app('tracker')->boot(); + if (Config::get('tracker.enabled')) + { + app('tracker')->boot(); + } return $next($request); }
Fix tracker disabled state when using middleware
antonioribeiro_tracker
train
php
35f9895a789c568eeaa386cc9bcd382ba6792cd8
diff --git a/pymongo/collection.py b/pymongo/collection.py index <HASH>..<HASH> 100644 --- a/pymongo/collection.py +++ b/pymongo/collection.py @@ -16,6 +16,7 @@ import collections import warnings +from types import GeneratorType from bson.code import Code from bson.objectid import ObjectId @@ -468,7 +469,7 @@ class Collection(common.BaseObject): self.write_concern.acknowledged) def insert_many(self, documents, ordered=True): - """Insert a list of documents. + """Insert a list or generator of documents. >>> db.test.count() 0 @@ -479,7 +480,7 @@ class Collection(common.BaseObject): 2 :Parameters: - - `documents`: A list of documents to insert. + - `documents`: A list or generator of documents to insert. - `ordered` (optional): If ``True`` (the default) documents will be inserted on the server serially, in the order provided. If an error occurs all remaining inserts are aborted. If ``False``, documents @@ -491,7 +492,7 @@ class Collection(common.BaseObject): .. versionadded:: 3.0 """ - if not isinstance(documents, list) or not documents: + if not isinstance(documents, (list, GeneratorType)) or not documents: raise TypeError("documents must be a non-empty list") inserted_ids = [] def gen():
insert_many(): Added support for generators
mongodb_mongo-python-driver
train
py
3a1bed21060ae5591b7adab93597dd567a0df527
diff --git a/lib/fog/ninefold/storage.rb b/lib/fog/ninefold/storage.rb index <HASH>..<HASH> 100644 --- a/lib/fog/ninefold/storage.rb +++ b/lib/fog/ninefold/storage.rb @@ -107,9 +107,10 @@ module Fog customheaders = {} params[:headers].each { |key,value| - if key == "x-emc-date" + case key + when 'x-emc-date', 'x-emc-signature' #skip - elsif key =~ /^x-emc-/ + when /^x-emc-/ customheaders[ key.downcase ] = value end }
[ninefold|storage] omit signature in stringtosign better facilitates retries
fog_fog
train
rb
414ae4246df3c92c893cc366fc74e6dd4b2503a6
diff --git a/lib/grooveshark/client.rb b/lib/grooveshark/client.rb index <HASH>..<HASH> 100644 --- a/lib/grooveshark/client.rb +++ b/lib/grooveshark/client.rb @@ -20,8 +20,10 @@ module Grooveshark # Obtain new session from Grooveshark def get_session - resp = RestClient.get('http://listen.grooveshark.com') - resp.headers[:set_cookie].to_s.scan(/PHPSESSID=([a-z\d]{32});/i).flatten.first + # Avoid an extra request + # resp = RestClient.get('http://listen.grooveshark.com') + # resp.headers[:set_cookie].to_s.scan(/PHPSESSID=([a-z\d]{32});/i).flatten.first + get_random_hex_chars(32) end # Get communication token @@ -39,6 +41,11 @@ module Grooveshark hash = Digest::SHA1.hexdigest(plain) "#{rnd}#{hash}" end + + def get_random_hex_chars(length) + chars = ('a'..'f').to_a | (0..9).to_a + (0...length).map { chars[rand(chars.length)] }.join + end public
Avoid the request that gets the session id
sosedoff_grooveshark
train
rb
ac3efe587f455c518b1d28a34e8a999494a38b4d
diff --git a/pyasn1/codec/ber/decoder.py b/pyasn1/codec/ber/decoder.py index <HASH>..<HASH> 100644 --- a/pyasn1/codec/ber/decoder.py +++ b/pyasn1/codec/ber/decoder.py @@ -71,12 +71,6 @@ class IntegerDecoder(AbstractSimpleDecoder): '\xfb': -5 } - def _valueFilter(self, value): - try: - return int(value) - except OverflowError: - return value - def valueDecoder(self, fullSubstrate, substrate, asn1Spec, tagSet, length, state, decodeFun): substrate = substrate[:length] @@ -92,16 +86,12 @@ class IntegerDecoder(AbstractSimpleDecoder): value = 0 for octet in substrate: value = value << 8 | oct2int(octet) - value = self._valueFilter(value) return self._createComponent(asn1Spec, tagSet, value), substrate class BooleanDecoder(IntegerDecoder): protoComponent = univ.Boolean(0) - def _valueFilter(self, value): - if value: - return 1 - else: - return 0 + def _createComponent(self, asn1Spec, tagSet, value=None): + return IntegerDecoder._createComponent(self, asn1Spec, tagSet, value and 1 or 0) class BitStringDecoder(AbstractSimpleDecoder): protoComponent = univ.BitString(())
better fix for negatively encoded Booleans
etingof_pyasn1
train
py
3dfea62fd47f337b5752bd98b8cd7a125c3132ac
diff --git a/cmd/minikube/cmd/start.go b/cmd/minikube/cmd/start.go index <HASH>..<HASH> 100644 --- a/cmd/minikube/cmd/start.go +++ b/cmd/minikube/cmd/start.go @@ -211,7 +211,7 @@ func runStart(cmd *cobra.Command, args []string) { kubernetesConfig := cfg.KubernetesConfig{ KubernetesVersion: selectedKubernetesVersion, NodeIP: ip, - NodeName: cfg.GetMachineName(), + NodeName: constants.DefaultNodeName, APIServerName: viper.GetString(apiServerName), APIServerNames: apiServerNames, APIServerIPs: apiServerIPs, diff --git a/pkg/minikube/constants/constants.go b/pkg/minikube/constants/constants.go index <HASH>..<HASH> 100644 --- a/pkg/minikube/constants/constants.go +++ b/pkg/minikube/constants/constants.go @@ -79,6 +79,9 @@ const MinikubeEnvPrefix = "MINIKUBE" // DefaultMachineName is the default name for the VM const DefaultMachineName = "minikube" +// DefaultNodeName is the default name for the kubeadm node within the VM +const DefaultNodeName = "minikube" + // The name of the default storage class provisioner const DefaultStorageClassProvisioner = "standard"
Changed the nodes within the VM to use a NodeName variable that is seperate from the VM Machine Name to ensure proper functionality when using different profile names.
kubernetes_minikube
train
go,go
23f654a3a43091ffa1f0fc9186057edf77d9b037
diff --git a/master/buildbot/scripts/runner.py b/master/buildbot/scripts/runner.py index <HASH>..<HASH> 100644 --- a/master/buildbot/scripts/runner.py +++ b/master/buildbot/scripts/runner.py @@ -146,7 +146,7 @@ class MakerBase(OptionsWithOptionsFile): ["quiet", "q", "Do not emit the commands being run"], ] - longdesc = """ + usage.Options.longdesc = """ Operates upon the specified <basedir> (or the current directory, if not specified). """
Fix bug #<I> buildbot usage/help message doesn't include longdescription. Set usage.Options.longdescription explicitly in runner.py.
buildbot_buildbot
train
py
f3166a589b0f75a38db02652942a1ed2c8ede1d4
diff --git a/packages/fireplace/lib/model/model_mixin.js b/packages/fireplace/lib/model/model_mixin.js index <HASH>..<HASH> 100644 --- a/packages/fireplace/lib/model/model_mixin.js +++ b/packages/fireplace/lib/model/model_mixin.js @@ -89,7 +89,17 @@ FP.ModelMixin = Ember.Mixin.create(FP.LiveMixin, FP.AttributesMixin, FP.Relation var attribute = this.attributeNameFromKey(key); if (!attribute) { return; } - get(this, "snapshot").set(key, snapshot.val()); + var current = get(this, "snapshot"), + currentData = current.val(), + newVal = snapshot.val(); + + // don't bother triggering a property change if nothing has changed + // eg if we've got a snapshot & then started listening + if (currentData.hasOwnProperty(key) && currentData[key] === newVal) { + return; + } + + current.set(key, newVal); this.settingFromFirebase(function(){ this.notifyPropertyChange(attribute);
Try and avoid triggering property changes if nothing has changed Especially when we've set snapshot from `value` and then start listening for changes which then triggers all the `child_added` events with the same data
rlivsey_fireplace
train
js
5c9868090219d8227058615b7653ec8c6a92d42e
diff --git a/parse_this.py b/parse_this.py index <HASH>..<HASH> 100644 --- a/parse_this.py +++ b/parse_this.py @@ -31,7 +31,7 @@ def _prepare_doc(func_doc, args): help message. Args: - func_doc: the method docstring + func_doc: the function docstring args: name of the function arguments """ description = [] @@ -49,10 +49,10 @@ def _prepare_doc(func_doc, args): def _get_arg_parser(func, types, args_and_defaults): """Return an ArgumentParser for the given function. Arguments are defined - from the method arguments and their associated defaults. + from the function arguments and their associated defaults. Args: - func: method for which we want an ArgumentParser + func: function for which we want an ArgumentParser types: types to which the command line arguments should be converted to args_and_defaults: list of 2-tuples (arg_name, arg_default) """ @@ -119,7 +119,7 @@ def parse_this(func, types, args=None): arguments according to the list of types. Args: - func: the method for which the command line arguments to be parsed + func: the function for which the command line arguments to be parsed types: a list of types - as accepted by argparse - that will be used to convert the command line arguments args: a list of arguments to be parsed if None sys.argv is used
Replace the word method with function since methods are not handled
bertrandvidal_parse_this
train
py
6630adc3f253eb81e2ba9813155fa70f8a875459
diff --git a/lib/migration.rb b/lib/migration.rb index <HASH>..<HASH> 100644 --- a/lib/migration.rb +++ b/lib/migration.rb @@ -157,7 +157,7 @@ module DataMapper end def migration_info_table_exists? - adapter.exists?('migration_info') + adapter.storage_exists?('migration_info') end # Fetch the record for this migration out of the migration_info table diff --git a/lib/spec/matchers/migration_matchers.rb b/lib/spec/matchers/migration_matchers.rb index <HASH>..<HASH> 100644 --- a/lib/spec/matchers/migration_matchers.rb +++ b/lib/spec/matchers/migration_matchers.rb @@ -28,7 +28,7 @@ module Spec end def matches?(repository) - repository.adapter.exists?(table_name) + repository.adapter.storage_exists?(table_name) end def failure_message
Changed migrations to use Adapter #storage_exists? instead of #exists?
datamapper_dm-migrations
train
rb,rb
bd262ca86fdf26d0ce0855321b6c58dfbaef3cb6
diff --git a/src/main/java/com/cloudbees/jenkins/support/impl/JenkinsLogs.java b/src/main/java/com/cloudbees/jenkins/support/impl/JenkinsLogs.java index <HASH>..<HASH> 100644 --- a/src/main/java/com/cloudbees/jenkins/support/impl/JenkinsLogs.java +++ b/src/main/java/com/cloudbees/jenkins/support/impl/JenkinsLogs.java @@ -127,7 +127,7 @@ public class JenkinsLogs extends Component { } } File taskLogs = new File(logs, "tasks"); - if (taskLogs.isDirectory()) { + if (taskLogs.exists() && taskLogs.isDirectory()) { files = taskLogs.listFiles(ROTATED_LOGFILE_FILTER); if (files != null) { for (File f : files) {
[JENKINS-<I>] Add exists check to task log folder
jenkinsci_support-core-plugin
train
java
1fa2515c970dab4d14234c0829ec209e2c227dc5
diff --git a/src/pusher.js b/src/pusher.js index <HASH>..<HASH> 100644 --- a/src/pusher.js +++ b/src/pusher.js @@ -18,7 +18,7 @@ var Pusher = function(application_key, channel_name) { this.secure = false; this.connected = false; this.retry_counter = 0; - // this.connect(); + if(Pusher.ready) this.connect(); Pusher.instances.push(this); if (channel_name) this.subscribe(channel_name); @@ -232,9 +232,11 @@ Pusher.parser = function(data) { } }; +Pusher.ready = false; Pusher.ready = function () { + Pusher.ready = true; for(var i = 0; i < Pusher.instances.length; i++) { - Pusher.instances[i].connect(); + if(!Pusher.instances[i].connected) Pusher.instances[i].connect(); } }
Pusher instances connect inmediatly if dependencies are loaded.
pusher_pusher-js
train
js
4370dc437e2be657976fe789c4801bfe1b9cc67a
diff --git a/lib/linguist/generated.rb b/lib/linguist/generated.rb index <HASH>..<HASH> 100644 --- a/lib/linguist/generated.rb +++ b/lib/linguist/generated.rb @@ -83,6 +83,7 @@ module Linguist generated_apache_thrift? || generated_jni_header? || vcr_cassette? || + generated_antlr? || generated_module? || generated_unity3d_meta? || generated_racc? || @@ -442,6 +443,14 @@ module Linguist return lines[-2].include?("recorded_with: VCR") end + # Is this a generated ANTLR file? + # + # Returns true or false + def generated_antlr? + return false unless extname == '.g' + return lines[1].include?("generated by Xtest") + end + # Internal: Is this a compiled C/C++ file from Cython? # # Cython-compiled C/C++ files typically contain:
Add generated ANTLR files as such (#<I>) (#<I>)
github_linguist
train
rb
c0cac3de2fa4409f8cf16233707febe17ba5e336
diff --git a/index.js b/index.js index <HASH>..<HASH> 100644 --- a/index.js +++ b/index.js @@ -38,7 +38,7 @@ module.exports = ({ directoryUrl, publicUrl, cookieName, cookieDomain, privateDi else res.send(req.user) }) router.post('/logout', logout) - router.post('/keepalive', _auth(privateDirectoryUrl, publicUrl, jwksClient, cookieName, cookieDomain, true), (req, res) => res.status(204).send()) + router.post('/keepalive', _auth(privateDirectoryUrl, publicUrl, jwksClient, cookieName, cookieDomain, true), (req, res) => res.status(204).send(req.user)) return { auth, requiredAuth, decode, loginCallback, login, logout, cors, router } }
feat: return req.user after keepalive
koumoul-dev_sd-express
train
js
399968528850814b7415a7cef9d031f4eb73ad6e
diff --git a/openstack_dashboard/dashboards/project/static/dashboard/project/containers/containers.module.js b/openstack_dashboard/dashboards/project/static/dashboard/project/containers/containers.module.js index <HASH>..<HASH> 100644 --- a/openstack_dashboard/dashboards/project/static/dashboard/project/containers/containers.module.js +++ b/openstack_dashboard/dashboards/project/static/dashboard/project/containers/containers.module.js @@ -46,6 +46,8 @@ var baseRoute = 'project/containers/'; $provide.constant('horizon.dashboard.project.containers.baseRoute', baseRoute); + // we include an additional level of URL here to allow for swift service + // user interaction outside of the scope of containers var containerRoute = baseRoute + 'container/'; $provide.constant('horizon.dashboard.project.containers.containerRoute', containerRoute); @@ -53,6 +55,9 @@ .when('/' + baseRoute, { templateUrl: path + 'select-container.html' }) + .when('/' + containerRoute, { + templateUrl: path + 'select-container.html' + }) .when('/' + containerRoute + ':container', { templateUrl: path + 'objects.html' })
Fix constant redirect on missing container name The routing rules were missing a handler for the absence of the container name in the /project/containers/container/ URL form. This caused AngularJS to issue a redirect when the container name is empty. Change-Id: I<I>ecfaa<I>dc8d<I>cc3a0d<I> Closes-Bug: <I>
openstack_horizon
train
js
26fd0e8a943898a7d89a8b5529498da7387f8387
diff --git a/Godeps/_workspace/src/github.com/GoogleCloudPlatform/kubernetes/pkg/kubelet/kubelet.go b/Godeps/_workspace/src/github.com/GoogleCloudPlatform/kubernetes/pkg/kubelet/kubelet.go index <HASH>..<HASH> 100644 --- a/Godeps/_workspace/src/github.com/GoogleCloudPlatform/kubernetes/pkg/kubelet/kubelet.go +++ b/Godeps/_workspace/src/github.com/GoogleCloudPlatform/kubernetes/pkg/kubelet/kubelet.go @@ -1667,7 +1667,7 @@ func getHostPortConflicts(pods []api.Pod) []api.Pod { func (kl *Kubelet) getPodsExceedingCapacity(pods []api.Pod) []api.Pod { info, err := kl.GetCachedMachineInfo() if err != nil { - glog.Error("error getting machine info: %v", err) + glog.V(5).Infof("error getting machine info: %v", err) return []api.Pod{} }
UPSTREAM: Tone down logging in Kubelet for cAdvisor being dead
openshift_origin
train
go
977ede2150e5e62669b0d08e78c955ecfc7f92ff
diff --git a/ignite/engines/engine.py b/ignite/engines/engine.py index <HASH>..<HASH> 100644 --- a/ignite/engines/engine.py +++ b/ignite/engines/engine.py @@ -1,6 +1,5 @@ import logging import time -from abc import ABCMeta, abstractmethod from enum import Enum from ignite._utils import _to_hours_mins_secs
Update engine.py (#<I>) Remove useless imports
pytorch_ignite
train
py
d896acf12654c0eb9d4b1b3fcd308a3e4514682c
diff --git a/src/Kunstmaan/NodeBundle/Entity/NodeIterator.php b/src/Kunstmaan/NodeBundle/Entity/NodeIterator.php index <HASH>..<HASH> 100644 --- a/src/Kunstmaan/NodeBundle/Entity/NodeIterator.php +++ b/src/Kunstmaan/NodeBundle/Entity/NodeIterator.php @@ -23,7 +23,7 @@ class NodeIterator implements \RecursiveIterator } /** - * @return \?RecursiveIterator + * @return \RecursiveIterator */ #[\ReturnTypeWillChange] public function getChildren() @@ -31,26 +31,41 @@ class NodeIterator implements \RecursiveIterator return new NodeIterator($this->_data->current()->getChildren()); } + /** + * @return Node + */ public function current() { return $this->_data->current(); } + /** + * @return void + */ public function next() { $this->_data->next(); } + /** + * @return int + */ public function key() { return $this->_data->key(); } + /** + * @return bool + */ public function valid() { return $this->_data->current() instanceof Node; } + /** + * @return void + */ public function rewind() { $this->_data->first();
[NodeBundle] Add docblock return types for node iterator class
Kunstmaan_KunstmaanBundlesCMS
train
php
aa8bc0a6a7ea60f121ecf46d116f23d3916fab49
diff --git a/src/Bitflag.php b/src/Bitflag.php index <HASH>..<HASH> 100644 --- a/src/Bitflag.php +++ b/src/Bitflag.php @@ -99,9 +99,11 @@ class Bitflag extends Checkbox\Group public function & getValue() : array { $array = []; - foreach ($this->value as $key => $value) { - if ($this->hasBit($key)) { - $array[] = $key; + if ($this->value) { + foreach ($this->value as $key => $value) { + if ($this->hasBit($key)) { + $array[] = $key; + } } } return $array;
this is sometimes still null, no idea but checking cannot harm
monolyth-php_formulaic
train
php
d3ab653eee511efcc35f1f39a825561f27999b01
diff --git a/src/validator.js b/src/validator.js index <HASH>..<HASH> 100644 --- a/src/validator.js +++ b/src/validator.js @@ -490,7 +490,7 @@ export default class Validator { * @param {String} scope The name of the field scope. */ detach (name, scope) { - const field = this._resolveField(name, scope); + let field = name instanceof Field ? name : this._resolveField(name, scope); if (field) { field.destroy(); this.fields.remove(field);
allow validator to detach field instances
baianat_vee-validate
train
js
7b8da4b908588d2652f8749f297614e1aba71814
diff --git a/SpiffWorkflow/bpmn/workflow.py b/SpiffWorkflow/bpmn/workflow.py index <HASH>..<HASH> 100644 --- a/SpiffWorkflow/bpmn/workflow.py +++ b/SpiffWorkflow/bpmn/workflow.py @@ -57,9 +57,10 @@ class BpmnWorkflow(Workflow): while outer_workflow: script_engine = outer_workflow.__script_engine - outer_workflow = outer_workflow.outer_workflow if outer_workflow == outer_workflow.outer_workflow: break + else: + outer_workflow = outer_workflow.outer_workflow return script_engine @script_engine.setter
Fixing a terrible logic mistake when caluclating the correct script engine to use, which resulted in some situations where the the parent script engine is not used in a sub-process or call activity.
knipknap_SpiffWorkflow
train
py
036d2f8e59793056dcde2ac5ef8e86bdecc29d62
diff --git a/toytree/tree.py b/toytree/tree.py index <HASH>..<HASH> 100644 --- a/toytree/tree.py +++ b/toytree/tree.py @@ -573,7 +573,7 @@ class Toytree(object): if not self._kwargs["node_size"]: self._kwargs["node_size"] = [15] * len(self.get_node_values()) if isinstance(self._kwargs["node_size"], (int, str)): - self._kwargs["node_size"] = [ns] * len(self.get_node_values()) + self._kwargs["node_size"] = [int(self._kwargs["node_size"])] * len(self.get_node_values()) ## user list else:
Zsailor's fix for ns bad val
eaton-lab_toytree
train
py
0da618ede8b60c52f5ca5fd1c624de50768044f1
diff --git a/source/rafcon/statemachine/id_generator.py b/source/rafcon/statemachine/id_generator.py index <HASH>..<HASH> 100644 --- a/source/rafcon/statemachine/id_generator.py +++ b/source/rafcon/statemachine/id_generator.py @@ -82,7 +82,7 @@ def run_id_generator(): return final_run_id -def state_id_generator(size=RUN_ID_LENGTH, chars=string.ascii_uppercase): +def state_id_generator(size=STATE_ID_LENGTH, chars=string.ascii_uppercase): """ Generates an id for a state. It randomly samples from random ascii uppercase letters size times and concatenates them. If the id already exists it draws a new one.
undo change affecting state id length
DLR-RM_RAFCON
train
py
aabfc5278c1fa34a6266a8d6b6877cabae21a8f5
diff --git a/gsh/buffered_dispatcher.py b/gsh/buffered_dispatcher.py index <HASH>..<HASH> 100644 --- a/gsh/buffered_dispatcher.py +++ b/gsh/buffered_dispatcher.py @@ -22,7 +22,7 @@ import sys from console import console_output -class buffered_dispatcher(object, asyncore.file_dispatcher): +class buffered_dispatcher(asyncore.file_dispatcher): """A dispatcher with a write buffer to allow asynchronous writers, and a read buffer to permit line oriented manipulations"""
Not needed anymore for the moment, so avoid the complexity
innogames_polysh
train
py
5b39e743695a799459076b2c1e84eed248340a8b
diff --git a/lib/rbvmomi/vim/OvfManager.rb b/lib/rbvmomi/vim/OvfManager.rb index <HASH>..<HASH> 100644 --- a/lib/rbvmomi/vim/OvfManager.rb +++ b/lib/rbvmomi/vim/OvfManager.rb @@ -81,7 +81,11 @@ class RbVmomi::VIM::OvfManager href = deviceUrl.url.gsub("*", opts[:host].config.network.vnic[0].spec.ip.ipAddress) downloadCmd = "#{CURLBIN} -L '#{URI::escape(filename)}'" - uploadCmd = "#{CURLBIN} -X #{method} --insecure -T - -H 'Content-Type: application/x-vnd.vmware-streamVmdk' -H 'Content-Length: #{fileItem.size}' '#{URI::escape(href)}'" + uploadCmd = "#{CURLBIN} -X #{method} --insecure -T - -H 'Content-Type: application/x-vnd.vmware-streamVmdk' '#{URI::escape(href)}'" + # Previously we used to append "-H 'Content-Length: #{fileItem.size}'" + # to the uploadCmd. It is not clear to me why, but that leads to + # trucation of the uploaded disk. Without this option curl can't tell + # the progress, but who cares system("#{downloadCmd} | #{uploadCmd}", STDOUT => "/dev/null") keepAliveThread.kill
Previously we used to append "-H 'Content-Length: #{fileItem.size}'"to the uploadCmd. It is not clear to me why, but that leads to trucation of the uploaded disk.
vmware_rbvmomi
train
rb
9b5da88d6d16568a482fc99318d16e05931e8965
diff --git a/markov/graph.py b/markov/graph.py index <HASH>..<HASH> 100644 --- a/markov/graph.py +++ b/markov/graph.py @@ -52,12 +52,12 @@ class Graph: def add_nodes(self, node): """ - Adds a given node or list of nodes to self.node_list. + Add a given node or list of nodes to self.node_list. If a node already exists in the network, merge them Args: - node: Node instance or list of Node instances - + node (Node or list[node]): + Returns: None """ if not isinstance(node, list): @@ -95,7 +95,11 @@ class Graph: Go through every node in the network, adding noise to every link scaled to its weight and max_factor - Args: max_factor (float): + TODO: alow a custom noise profile (in the form of a weight list) + to be passed + + Args: + max_factor (float): Returns: None """ diff --git a/markov/nodes.py b/markov/nodes.py index <HASH>..<HASH> 100644 --- a/markov/nodes.py +++ b/markov/nodes.py @@ -67,6 +67,7 @@ class Node: def add_link_to_self(self, source, weight): """ Add a link from source node to self at given weight + Args: source (Node):
pep8 and google docstrings
ajyoon_blur
train
py,py
09b0bb73c3b8722f7b4f1fd374a29d2ed90dbf32
diff --git a/src/datetime.js b/src/datetime.js index <HASH>..<HASH> 100644 --- a/src/datetime.js +++ b/src/datetime.js @@ -1114,7 +1114,7 @@ export default class DateTime { * @type {number} */ get offset() { - return this.isValid ? this.zone.offset(this.ts) : NaN; + return this.isValid ? +this.o : NaN; } /**
[feature] caching of offset in DateTime moment#<I> (#<I>) Cache offset in DateTime #<I>
moment_luxon
train
js
a7efa12fb6f19017d5bcd2a79edf7bab06335740
diff --git a/property_serializers.go b/property_serializers.go index <HASH>..<HASH> 100644 --- a/property_serializers.go +++ b/property_serializers.go @@ -110,8 +110,10 @@ func (pst *PropertySerializerTable) GetPropertySerializerByName(name string) *Pr switch { case hasPrefix(name, "CHandle"): decoder = decodeHandle + case hasPrefix(name, "CUtlVector< "): + decoder = pst.GetPropertySerializerByName(name[12:]).Decode default: - _debugf("No decoder for type %s", name) + //_debugf("No decoder for type %s", name) } } @@ -130,6 +132,7 @@ func (pst *PropertySerializerTable) GetPropertySerializerByName(name string) *Pr } ps := &PropertySerializer{ + Decode: serializer.Decode, IsArray: true, Length: uint32(length), ArraySerializer: serializer, @@ -140,6 +143,7 @@ func (pst *PropertySerializerTable) GetPropertySerializerByName(name string) *Pr if match := matchVector.FindStringSubmatch(name); match != nil { ps := &PropertySerializer{ + Decode: decoder, IsArray: true, Length: uint32(128), ArraySerializer: &PropertySerializer{},
Propagate decoders to array members, parse vector as array for now
dotabuff_manta
train
go
a53478c51e35d349fd6fdaf3e3b56f5ffb7485ec
diff --git a/src/hcl/api.py b/src/hcl/api.py index <HASH>..<HASH> 100644 --- a/src/hcl/api.py +++ b/src/hcl/api.py @@ -27,9 +27,8 @@ def loads(s): TODO: Multiple threads ''' + s = s.decode('utf-8') if isHcl(s): - if sys.version_info[0] < 3 and isinstance(s, unicode): - s = unicode(s, 'utf-8') return HclParser().parse(s) else: return json.loads(s)
Decode all input as utf-8 (fixes python3 issue with hcltool)
virtuald_pyhcl
train
py
1c6b68f3cbbaeab0f9d486d155912be260a3eada
diff --git a/plugin/tls/tls.go b/plugin/tls/tls.go index <HASH>..<HASH> 100644 --- a/plugin/tls/tls.go +++ b/plugin/tls/tls.go @@ -33,7 +33,6 @@ func setTLSDefaults(tls *ctls.Config) { ctls.TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384, ctls.TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, } - tls.PreferServerCipherSuites = true } func parseTLS(c *caddy.Controller) error {
tls.PreferServerCipherSuites is ignored as of go <I> (#<I>)
coredns_coredns
train
go
45e4f360f8918f6f16cf00fc176152341c3e9883
diff --git a/packages/dva/src/dynamic.js b/packages/dva/src/dynamic.js index <HASH>..<HASH> 100644 --- a/packages/dva/src/dynamic.js +++ b/packages/dva/src/dynamic.js @@ -29,6 +29,10 @@ function asyncComponent(config) { this.mounted = true; } + componentWillUnmount() { + this.mounted = false; + } + load() { resolve().then((m) => { const AsyncComponent = m.default || m;
fix: dva/dynamic report setState warning when component is unmount before load is complete, Close #<I>
dvajs_dva
train
js
03aa5ad7a04694f1e2f9ad031886f0161df5069e
diff --git a/lib/request.js b/lib/request.js index <HASH>..<HASH> 100644 --- a/lib/request.js +++ b/lib/request.js @@ -24,12 +24,14 @@ class Request extends EventEmitter { context.requests.push(this); let request = context.connection.queryRaw(this.sql, (err, results) => { if (err) { - // HACK: Close connection because query errors can lock up the connection. + // HACK: Close connection because error may have put connection in invalid state. context.removeRequest(this, err); context.close(); - } else if (done && typeof this.callback === 'function') { + } else if (done) { context.removeRequest(this); - this.callback(err, results); + if (typeof this.callback === 'function') { + this.callback(err, results); + } } }); request.on('meta', (meta) => {
request: Make sure request is removed after query is done
ratanakvlun_sequelize-msnodesqlv8
train
js
133db59ad42ad7c35f35fc2c082e468e1b6ec002
diff --git a/bundle/DependencyInjection/Compiler/TwigThemePass.php b/bundle/DependencyInjection/Compiler/TwigThemePass.php index <HASH>..<HASH> 100644 --- a/bundle/DependencyInjection/Compiler/TwigThemePass.php +++ b/bundle/DependencyInjection/Compiler/TwigThemePass.php @@ -35,10 +35,7 @@ class TwigThemePass implements CompilerPassInterface (new Filesystem())->mkdir($globalViewsDir); } $themesPathMap = [ - '_override' => array_merge( - [$globalViewsDir], - $container->getParameter('ezdesign.templates_override_paths') - ), + '_override' => $container->getParameter('ezdesign.templates_override_paths'), ]; $finder = new Finder(); // Look for themes in bundles.
EZP-<I>: Dropped app/Resources/views as a theme override directory (#<I>)
ezsystems_ezplatform-design-engine
train
php
8a6c07326950e2a27f668135cb4ade91ecc094a0
diff --git a/pycm/pycm_obj.py b/pycm/pycm_obj.py index <HASH>..<HASH> 100644 --- a/pycm/pycm_obj.py +++ b/pycm/pycm_obj.py @@ -695,7 +695,7 @@ class ConfusionMatrix(): except Exception: return "None" - def weighted_kappa(self,weight): + def weighted_kappa(self,weight=None): """ Calculate weighted kappa. @@ -705,8 +705,8 @@ class ConfusionMatrix(): """ if matrix_check(weight) is False: warn(WEIGHTED_KAPPA_WARNING, RuntimeWarning) - return cm.Kappa + return self.Kappa if set(weight.keys()) != set(self.classes): warn(WEIGHTED_KAPPA_WARNING, RuntimeWarning) - return cm.Kappa + return self.Kappa return weighted_kappa_calc(self.classes,self.table,self.P,self.TOP,self.POP,weight)
fix : minor eidt in weighted_kappa method #<I>
sepandhaghighi_pycm
train
py
c52efb4a123c21ad1a25705d4969f2b4d04c42b3
diff --git a/lib/config.js b/lib/config.js index <HASH>..<HASH> 100644 --- a/lib/config.js +++ b/lib/config.js @@ -591,7 +591,7 @@ exports.extend = function(newConf) { maxSockets: config.sockets, keepAlive: config.keepAlive, keepAliveMsecs: config.keepAliveMsecs, - maxFreeSockets: 8 + maxFreeSockets: 60 }; config.httpAgent = config.debug ? false : createAgent(agentConfig); config.httpsAgent = config.debug ? false : createAgent(agentConfig, true);
refactor: auto clean free sockets
avwo_whistle
train
js
5fb93535f090fd30b6359021276b521552a6b80d
diff --git a/core/server/adapters/scheduling/post-scheduling/scheduler-intergation.js b/core/server/adapters/scheduling/post-scheduling/scheduler-intergation.js index <HASH>..<HASH> 100644 --- a/core/server/adapters/scheduling/post-scheduling/scheduler-intergation.js +++ b/core/server/adapters/scheduling/post-scheduling/scheduler-intergation.js @@ -1,7 +1,11 @@ const models = require('../../../models'); -const i18n = require('../../../../shared/i18n'); +const tpl = require('@tryghost/tpl'); const errors = require('@tryghost/errors'); +const messages = { + resourceNotFound: '{resource} not found.' +}; + /** * @description Load the internal scheduler integration * @@ -12,9 +16,7 @@ const getSchedulerIntegration = function () { .then((integration) => { if (!integration) { throw new errors.NotFoundError({ - message: i18n.t('errors.api.resource.resourceNotFound', { - resource: 'Integration' - }) + message: tpl(messages.resourceNotFound, {resource: 'Integration'}) }); } return integration.toJSON();
Replaced i<I>n.t w/ tpl helper in scheduler-intergation (#<I>) refs: #<I> The i<I>n package is deprecated. It is being replaced with the tpl package.
TryGhost_Ghost
train
js
23a0777516f91d6cd0123837f123a1887c11dd95
diff --git a/molnctrl/__init__.py b/molnctrl/__init__.py index <HASH>..<HASH> 100644 --- a/molnctrl/__init__.py +++ b/molnctrl/__init__.py @@ -1,9 +1,11 @@ +#!/usr/bin/env python +# −*− coding: UTF−8 −*− from cloudmonkey.precache import precached_verbs from connection import CSApi # # usage: -# import pycs -# cs = pycs.Initialize("apikey", "api_secret") +# import molnctrl +# cs = molnctrl.Initialize("apikey", "api_secret") # # __version__ = "0.1"
Added python shebang
redbridge_molnctrl
train
py
9a9ebb2182bb1708a23b04b2950363f5fb82108b
diff --git a/js/btcmarkets.js b/js/btcmarkets.js index <HASH>..<HASH> 100644 --- a/js/btcmarkets.js +++ b/js/btcmarkets.js @@ -745,13 +745,9 @@ module.exports = class btcmarkets extends Exchange { if ('success' in response) { if (!response['success']) { const error = this.safeString (response, 'errorCode'); - const message = this.id + ' ' + this.json (response); - if (error in this.exceptions) { - const ExceptionClass = this.exceptions[error]; - throw new ExceptionClass (message); - } else { - throw new ExchangeError (message); - } + const feedback = this.id + ' ' + body; + this.throwExactlyMatchedException (this.exceptions, error, feedback); + throw new ExchangeError (feedback); } } }
btcmarkets throwExactlyMatchedException
ccxt_ccxt
train
js
57052d520fe9c5db226a9c2259a74fd141b225d1
diff --git a/test/e2e/general-usecase/app.js b/test/e2e/general-usecase/app.js index <HASH>..<HASH> 100644 --- a/test/e2e/general-usecase/app.js +++ b/test/e2e/general-usecase/app.js @@ -1,7 +1,11 @@ var initElasticApm = require('../../..').init // import init as initElasticApm from '../../..' var createApmBase = require('../e2e') + +var active = Math.random() < 1 + var elasticApm = createApmBase({ + active: active, debug: true, serviceName: 'apm-agent-js-base-test-e2e-general-usecase', serviceVersion: '0.0.1'
chore: add active to general use-case
elastic_apm-agent-rum-js
train
js
5100506ae6da80668d5637b4b0ac9cefafb7a232
diff --git a/estnltk/taggers/tagger.py b/estnltk/taggers/tagger.py index <HASH>..<HASH> 100644 --- a/estnltk/taggers/tagger.py +++ b/estnltk/taggers/tagger.py @@ -36,6 +36,7 @@ class Tagger: if status is None: status = {} layer = self._make_layer(raw_text, layers, status) + assert layer.attributes == self.output_attributes, '{} != {}'.format(layer.attributes, self.output_attributes) assert isinstance(layer, Layer), 'make_layer must return Layer' assert layer.name == self.output_layer, 'incorrect layer name: {} != {}'.format(layer.name, self.output_layer) return layer
in Tagger assert that layer.attributes are the expected output_attributes
estnltk_estnltk
train
py
0301def28bb3d3aeb30080b7b18e16816fe9a8b7
diff --git a/alphalens/utils.py b/alphalens/utils.py index <HASH>..<HASH> 100644 --- a/alphalens/utils.py +++ b/alphalens/utils.py @@ -278,11 +278,8 @@ def compute_forward_returns(factor, # # build forward returns # - fwdret = (prices - .pct_change(period) - .shift(-period) - .reindex(factor_dateindex) - ) + fwdret = prices.shift(-period) / prices - 1 + fwdret = fwdret.reindex(factor_dateindex) if filter_zscore is not None: mask = abs(fwdret - fwdret.mean()) > (filter_zscore * fwdret.std())
ENH Speed up fwdret computation by computing directly from prices rather than using pct_change().
quantopian_alphalens
train
py
36f0b30530a96a36632c170031bed0e657989fa8
diff --git a/backend/controllers/SiteController.php b/backend/controllers/SiteController.php index <HASH>..<HASH> 100644 --- a/backend/controllers/SiteController.php +++ b/backend/controllers/SiteController.php @@ -50,7 +50,7 @@ class SiteController extends Controller $model = new LoginForm(); if ($model->load($_POST) && $model->login()) { - return $this->goHome(); + return $this->goBack(); } else { return $this->render('login', [ 'model' => $model, diff --git a/frontend/controllers/SiteController.php b/frontend/controllers/SiteController.php index <HASH>..<HASH> 100644 --- a/frontend/controllers/SiteController.php +++ b/frontend/controllers/SiteController.php @@ -60,7 +60,7 @@ class SiteController extends Controller $model = new LoginForm(); if ($model->load($_POST) && $model->login()) { - return $this->goHome(); + return $this->goBack(); } else { return $this->render('login', [ 'model' => $model,
advanced app: go back after login, not home
yiisoft_yii2-app-advanced
train
php,php
db1e030da68965335afdd925c0d3c6606fa4f153
diff --git a/src/Visible.js b/src/Visible.js index <HASH>..<HASH> 100644 --- a/src/Visible.js +++ b/src/Visible.js @@ -4,7 +4,7 @@ function Visible(visible) { var self = this; - this.applyCallback = function(element, display) { + this.applyCallback = function(element) { self.assignUpdater(function() { @@ -14,7 +14,7 @@ function Visible(visible) { if(visible.call(model, element)) { - element.style.display = display; + element.style.display = null; } else { @@ -36,8 +36,6 @@ function Visible(visible) { if (this.isInScope(element, scope)) { - var display = getComputedStyle(element).getPropertyValue("display"); - this.requestRegistrations(); if(!visible.call(model, element)) { @@ -45,7 +43,7 @@ function Visible(visible) { element.style.display = "none"; } - this.applyCallback(element, display); + this.applyCallback(element); } } };
Visible binding removes display style to reshow.
MartinRixham_Datum
train
js
c352b700223e534781e8971631c73566be3205e6
diff --git a/version.php b/version.php index <HASH>..<HASH> 100644 --- a/version.php +++ b/version.php @@ -29,9 +29,9 @@ defined('MOODLE_INTERNAL') || die(); -$version = 2022012900.00; // YYYYMMDD = weekly release date of this DEV branch. +$version = 2022020200.00; // YYYYMMDD = weekly release date of this DEV branch. // RR = release increments - 00 in DEV branches. // .XX = incremental changes. -$release = '4.0dev+ (Build: 20220129)'; // Human-friendly version name +$release = '4.0dev+ (Build: 20220202)'; // Human-friendly version name $branch = '400'; // This version's branch. $maturity = MATURITY_ALPHA; // This version's maturity level.
on-demand release <I>dev+
moodle_moodle
train
php
1efb106e838585930fe6849cbefff32f34964ea8
diff --git a/src/org/jgroups/mux/MuxChannel.java b/src/org/jgroups/mux/MuxChannel.java index <HASH>..<HASH> 100644 --- a/src/org/jgroups/mux/MuxChannel.java +++ b/src/org/jgroups/mux/MuxChannel.java @@ -25,7 +25,7 @@ import java.util.Map; * @see JChannelFactory#createMultiplexerChannel(String, String) * @see Multiplexer * @since 2.4 - * @version $Id: MuxChannel.java,v 1.45 2008/01/16 06:55:08 vlada Exp $ + * @version $Id: MuxChannel.java,v 1.46 2008/01/24 13:53:37 belaban Exp $ */ public class MuxChannel extends JChannel { @@ -321,6 +321,10 @@ public class MuxChannel extends JChannel { public void send(Message msg) throws ChannelNotConnectedException, ChannelClosedException { msg.putHeader(name, hdr); mux.getChannel().send(msg); + if(stats) { + sent_msgs++; + sent_bytes+=msg.getLength(); + } } public void send(Address dst, Address src, Serializable obj) throws ChannelNotConnectedException, ChannelClosedException {
updating sent msgs stats on send()
belaban_JGroups
train
java
5f4e08c68aa0f49ab3b083a60f94b8b9966f9eca
diff --git a/test_xbee1.py b/test_xbee1.py index <HASH>..<HASH> 100755 --- a/test_xbee1.py +++ b/test_xbee1.py @@ -216,6 +216,26 @@ class TestParseIOData(unittest.TestCase): results = XBee1.parse_samples(data) self.assertEqual(results, expected_results) + + def test_parse_single_dio_subset_again(self): + """ + parse_samples should properly parse a packet containing a single + sample of only digital io data for only a subset of the available + pins + """ + # One sample, ADC disabled + # DIO 0 enabled + header = '\x01\x00\x01' + + # First 7 bits ignored, DIO8 low, DIO 0-7 alternating + sample = '\x00\xAA' + data = header + sample + + expected_results = [{'dio-0':False}] + + results = XBee1.parse_samples(data) + + self.assertEqual(results, expected_results) class TestWriteToDevice(unittest.TestCase): """
Added another test for checking a subset of all available digital pins
niolabs_python-xbee
train
py
a88740f9f943534141134ca896b70df4c0f59e13
diff --git a/jbpm-designer-api/src/main/java/org/jbpm/designer/type/Bpmn2TypeDefinition.java b/jbpm-designer-api/src/main/java/org/jbpm/designer/type/Bpmn2TypeDefinition.java index <HASH>..<HASH> 100644 --- a/jbpm-designer-api/src/main/java/org/jbpm/designer/type/Bpmn2TypeDefinition.java +++ b/jbpm-designer-api/src/main/java/org/jbpm/designer/type/Bpmn2TypeDefinition.java @@ -19,6 +19,7 @@ package org.jbpm.designer.type; import javax.enterprise.context.ApplicationScoped; import org.uberfire.backend.vfs.Path; +import org.uberfire.workbench.type.Category; import org.uberfire.workbench.type.ResourceTypeDefinition; @ApplicationScoped @@ -55,6 +56,11 @@ public class Bpmn2TypeDefinition implements ResourceTypeDefinition { } @Override + public Category getCategory() { + return Category.PROCESS; + } + + @Override public String getSimpleWildcardPattern() { return "*." + getSuffix(); }
[AF-<I>]: Changed category to BPMN Type Definition. (#<I>)
kiegroup_jbpm-designer
train
java