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
9cd0d852b63563a6327356941a555b2d380bd0fa
diff --git a/lib/dragonfly/file_data_store.rb b/lib/dragonfly/file_data_store.rb index <HASH>..<HASH> 100644 --- a/lib/dragonfly/file_data_store.rb +++ b/lib/dragonfly/file_data_store.rb @@ -168,7 +168,7 @@ module Dragonfly end def directory_empty?(path) - Dir.entries(path) == ['.','..'] + Dir.entries(path).sort == ['.','..'].sort end def root_path?(dir) diff --git a/spec/support/simple_matchers.rb b/spec/support/simple_matchers.rb index <HASH>..<HASH> 100644 --- a/spec/support/simple_matchers.rb +++ b/spec/support/simple_matchers.rb @@ -9,7 +9,7 @@ end RSpec::Matchers.define :be_an_empty_directory do match do |given| - !!ENV['TRAVIS'] || (Dir.entries(given) == ['.','..']) + !!ENV['TRAVIS'] || (Dir.entries(given).sort == ['.','..'].sort) end end
fix ruby <I> regression by not considering order of '.' and '..' nodes when checking for empty directory
markevans_dragonfly
train
rb,rb
38760c6f71ecfa476a6c8a0236ca1f9f82cbf142
diff --git a/lib/Instance.js b/lib/Instance.js index <HASH>..<HASH> 100644 --- a/lib/Instance.js +++ b/lib/Instance.js @@ -238,7 +238,7 @@ function Instance(opts) { for (var k in opts.properties) { if (opts.properties.hasOwnProperty(k) && !opts.data.hasOwnProperty(k) && k != opts.id) { - opts.data[k] = null; + opts.data[k] = undefined; } }
Changes undefined instance properties initialization to undefined instead of null (#<I>)
dresende_node-orm2
train
js
bd75e63abf0a11f790ce1d27f41ed0dccf9545e1
diff --git a/pastml/ml.py b/pastml/ml.py index <HASH>..<HASH> 100755 --- a/pastml/ml.py +++ b/pastml/ml.py @@ -897,7 +897,7 @@ def optimise_likelihood(forest, avg_br_len, tree_len, num_edges, character, stat optimise_kappa=optimise_kappa, avg_br_len=avg_br_len, tree_len=tree_len, num_edges=num_edges, model=model, observed_frequencies=observed_frequencies, - tau=tau, optimise_tau=optimise_tau) + tau=tau, optimise_tau=False) if np.any(np.isnan(likelihood) or likelihood == -np.inf): raise PastMLLikelihoodError('Failed to calculate the likelihood for your tree, ' 'please check that you do not have contradicting {} states specified '
preoptimise tau with sf (frequencies fixed) then fix it for further optimisations
evolbioinfo_pastml
train
py
6f6285e128b5c81398538d25ece8a9af988bfb4a
diff --git a/__init__.py b/__init__.py index <HASH>..<HASH> 100644 --- a/__init__.py +++ b/__init__.py @@ -20,5 +20,5 @@ __revision__ = "$Id$" # #--start constants-- -__version__ = "3.0a5" +__version__ = "3.0b1" #--end constants--
Bump to <I>b1
pypa_setuptools
train
py
22d5c7ac044b0a07afb9a860105cb66099573ac9
diff --git a/automation.py b/automation.py index <HASH>..<HASH> 100644 --- a/automation.py +++ b/automation.py @@ -2520,7 +2520,7 @@ class RangeValuePattern(): '''Return bool''' return _automationClient.dll.GetElementPattern(self.Element, PatternId.UIA_RangeValuePatternId) != 0 - def CurrentValue(self): + def RangeValuePatternCurrentValue(self): pattern = _automationClient.dll.GetElementPattern(self.Element, PatternId.UIA_RangeValuePatternId) if pattern: value = _automationClient.dll.RangeValuePatternCurrentValue(pattern) @@ -2529,7 +2529,7 @@ class RangeValuePattern(): else: Logger.WriteLine('RangeValuePattern is not supported!', ConsoleColor.Yellow) - def SetValue(self, value): + def RangeValuePatternSetValue(self, value): pattern = _automationClient.dll.GetElementPattern(self.Element, PatternId.UIA_RangeValuePatternId) if pattern: _automationClient.dll.RangeValuePatternSetValue(pattern, value)
rename RangeValuePattern's methods
yinkaisheng_Python-UIAutomation-for-Windows
train
py
2f88afec7d1afe54ee897c4e1e61c5593efcc46c
diff --git a/js/tests/unit/wee.js b/js/tests/unit/wee.js index <HASH>..<HASH> 100644 --- a/js/tests/unit/wee.js +++ b/js/tests/unit/wee.js @@ -373,6 +373,25 @@ define(function(require) { ); } }, + '$unobserve': function() { + var returnVal3; + + Wee.controller.$set('testCtrlObserve', {}); + + Wee.controller.$observe('testCtrlObserve.key1', function(data) { + returnVal3 = data; + }, { + recursive: true + }); + + Wee.controller.$set('testCtrlObserve.key1', 5); + + Wee.controller.$unobserve('testCtrlObserve.key1'); + + Wee.controller.$set('testCtrlObserve.key1', 25); + + assert.strictEqual(returnVal3, 5, + 'Value of "returnVal3" did not remain 5 as expected' ); }, 'ready': function() {
Add test for ‘$unobserve’ method
weepower_wee-core
train
js
500a7d6138b2865a9ab596d11000250b6ed48a2a
diff --git a/src/plugins/remove_button/plugin.js b/src/plugins/remove_button/plugin.js index <HASH>..<HASH> 100644 --- a/src/plugins/remove_button/plugin.js +++ b/src/plugins/remove_button/plugin.js @@ -57,7 +57,7 @@ Selectize.define('remove_button', function(options) { e.preventDefault(); if (self.isLocked) return; - var $item = $(e.target).parent(); + var $item = $(e.currentTarget).parent(); self.setActiveItem($item); if (self.deleteSelection()) { self.setCaret(self.items.length);
remove_button: fix event handler when label contains html
selectize_selectize.js
train
js
e0e8538bfccf699391bbe6a83173b643c31f5980
diff --git a/servlet/src/main/java/io/undertow/servlet/spec/AsyncContextImpl.java b/servlet/src/main/java/io/undertow/servlet/spec/AsyncContextImpl.java index <HASH>..<HASH> 100644 --- a/servlet/src/main/java/io/undertow/servlet/spec/AsyncContextImpl.java +++ b/servlet/src/main/java/io/undertow/servlet/spec/AsyncContextImpl.java @@ -280,7 +280,7 @@ public class AsyncContextImpl implements AsyncContext { timeoutKey.remove(); timeoutKey = null; } - + servletRequestContext.getOriginalRequest().asyncRequestDispatched(); Thread currentThread = Thread.currentThread(); if (!initialRequestDone && currentThread == initiatingThread) { //the context was stopped in the same request context it was started, we don't do anything
Make sure isAsyncStarted() returns false after complete() is called
undertow-io_undertow
train
java
a89cd369335c617f649dce12ff84045d8a2edc53
diff --git a/examples/plot_features.py b/examples/plot_features.py index <HASH>..<HASH> 100755 --- a/examples/plot_features.py +++ b/examples/plot_features.py @@ -38,6 +38,7 @@ import json import argparse import numpy as np import scipy.stats as _st +from matplotlib.backends.backend_pdf import PdfPages DISTS = { @@ -135,14 +136,19 @@ def parse_args(): parser = argparse.ArgumentParser( description='Morphology feature plotter', epilog='Note: Makes plots of various features and superimposes\ - input distributions') + input distributions. Plots are saved to PDF file.', + formatter_class=argparse.ArgumentDefaultsHelpFormatter) parser.add_argument('datapath', help='Morphology data directory path') parser.add_argument('--mtypeconfig', + required=True, help='Get mtype JSON configuration file') + parser.add_argument('--output', + default='plots.pdf', + help='Output PDF file name') return parser.parse_args() @@ -189,3 +195,8 @@ if __name__ == '__main__': args = parse_args() print 'MTYPE FILE:', args.mtypeconfig plots = main(args.datapath, args.mtypeconfig) + + pp = PdfPages(args.output) + for p in plots: + pp.savefig(p.fig) + pp.close()
Feature plotter: save all plots to PDF file.
BlueBrain_NeuroM
train
py
8ce4ef91706fcfe53426b67b109ae154d1efaf2d
diff --git a/pandas/tests/test_frame.py b/pandas/tests/test_frame.py index <HASH>..<HASH> 100644 --- a/pandas/tests/test_frame.py +++ b/pandas/tests/test_frame.py @@ -4847,22 +4847,6 @@ class TestDataFrame(unittest.TestCase, CheckIndexing, lines = f.readlines() self.assert_(lines[1].split(',')[2] == '999') - @slow - def test_to_csv_boundry_conditions(self): - from pandas.util.testing import makeTimeDataFrame - - with ensure_clean() as path: - - df = makeTimeDataFrame(25000) - df.to_csv(path) - rs = pan.read_csv(path, index_col=0, parse_dates=True) - assert_frame_equal(rs, df) - - df = makeTimeDataFrame(25001) - df.to_csv(path) - rs = pan.read_csv(path, index_col=0, parse_dates=True) - assert_frame_equal(rs, df) - def test_to_csv_withcommas(self): # Commas inside fields should be correctly escaped when saving as CSV.
TST: remove slow test duplicating an even slower test to reduce test time
pandas-dev_pandas
train
py
c9bb4f560e13ad7bf8437e0cf32039805f6bc1e9
diff --git a/aeron-cluster/src/test/java/io/aeron/cluster/MultiNodeTest.java b/aeron-cluster/src/test/java/io/aeron/cluster/MultiNodeTest.java index <HASH>..<HASH> 100644 --- a/aeron-cluster/src/test/java/io/aeron/cluster/MultiNodeTest.java +++ b/aeron-cluster/src/test/java/io/aeron/cluster/MultiNodeTest.java @@ -34,8 +34,7 @@ public class MultiNodeTest "2,localhost:9012,localhost:9022,localhost:9032,localhost:8012"; private final MemberStatusListener[] mockMemberStatusListeners = new MemberStatusListener[3]; - final MemberStatusListener[] printStatusListeners = - ConsensusModuleHarness.printMemberStatusMixIn(System.out, mockMemberStatusListeners); + private final MemberStatusListener[] printStatusListeners = new MemberStatusListener[3]; @Before public void before() @@ -43,6 +42,8 @@ public class MultiNodeTest for (int i = 0; i < mockMemberStatusListeners.length; i++) { mockMemberStatusListeners[i] = mock(MemberStatusListener.class); + printStatusListeners[i] = + ConsensusModuleHarness.printMemberStatusMixIn(System.out, mockMemberStatusListeners[i]); } }
[Java]: fix printing mixins.
real-logic_aeron
train
java
7cddb5fdbdaee8136909c8cbea2af6b5c57a08bb
diff --git a/src/Web/Routing/LocaleControllerCollection.php b/src/Web/Routing/LocaleControllerCollection.php index <HASH>..<HASH> 100644 --- a/src/Web/Routing/LocaleControllerCollection.php +++ b/src/Web/Routing/LocaleControllerCollection.php @@ -12,8 +12,15 @@ use Silex\Route; */ class LocaleControllerCollection extends PrefixedVariableControllerCollection { - public function __construct(Route $defaultRoute, $supportedLocales = array()) { - parent::__construct($defaultRoute, implode('|', $supportedLocales)); + /** + * LocaleControllerCollection constructor. + * + * @param Route $defaultRoute + * @param array|string $supportedLocales Regex requirement for locale, or a list of locales + */ + public function __construct(Route $defaultRoute, $supportedLocales = '[a-zA-Z]{2}') { + $requirement = is_array($supportedLocales) ? implode('|', $supportedLocales) : $supportedLocales; + parent::__construct($defaultRoute, $requirement); } /**
[ControllerCollection] Updated default requirement for locale to a two letter regex. Locale list can still be passed in.
gmo_common
train
php
323a6b76bef4c68fadb3867726fd988924f25c58
diff --git a/src/Store/MockStore.php b/src/Store/MockStore.php index <HASH>..<HASH> 100644 --- a/src/Store/MockStore.php +++ b/src/Store/MockStore.php @@ -16,7 +16,7 @@ class MockStore implements ValueStoreInterface, LockStoreInterface public function get($key) { - if (!isset($this->values[$key])) { + if (!$this->exists($key)) { return false; } @@ -25,7 +25,7 @@ class MockStore implements ValueStoreInterface, LockStoreInterface public function add($key, $value, $ttl) { - if (isset($this->values[$key])) { + if ($this->exists($key)) { return false; } @@ -35,11 +35,16 @@ class MockStore implements ValueStoreInterface, LockStoreInterface public function delete($key) { - if (!isset($this->values[$key])) { + if (!$this->exists($key)) { return false; } unset($this->values[$key]); return true; } + + protected function exists($key) + { + return isset($this->values[$key]); + } }
MockStore: introduce exists() method to limit code duplication
sobstel_metaphore
train
php
6da8bb7c89360456884945154bdef440ee849006
diff --git a/cat/__init__.py b/cat/__init__.py index <HASH>..<HASH> 100755 --- a/cat/__init__.py +++ b/cat/__init__.py @@ -8,7 +8,7 @@ cat is a amazing modul to get cat images. This Project won't be posible without the great Cat API (http://thecatapi.com). Big thanks! -Project on github https://github.com/gravmatt/py-random-kitten +Project on github https://github.com/gravmatt/random-cat """ import urllib, uuid, os, sys diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -25,7 +25,6 @@ setup( author_email = '[email protected]', keywords = 'cat kitten hacking hack fun', packages = find_packages(), - install_requires = ['setuptools'], entry_points=""" [console_scripts] randomcat = cat:main
change setup and github url in source
gravmatt_random-cat
train
py,py
d8ecdc582f5d21dd5b0e3784929d35ec3ed6debe
diff --git a/src/events/http/lambda-events/LambdaProxyIntegrationEvent.js b/src/events/http/lambda-events/LambdaProxyIntegrationEvent.js index <HASH>..<HASH> 100644 --- a/src/events/http/lambda-events/LambdaProxyIntegrationEvent.js +++ b/src/events/http/lambda-events/LambdaProxyIntegrationEvent.js @@ -175,13 +175,13 @@ export default class LambdaProxyIntegrationEvent { userAgent: _headers['user-agent'] || '', userArn: 'offlineContext_userArn', }, - path: route.path, + path: this.#path, protocol: 'HTTP/1.1', requestId: createUniqueId(), requestTime, requestTimeEpoch, resourceId: 'offlineContext_resourceId', - resourcePath: this.#path, + resourcePath: route.path, stage: this.#stage, }, resource: this.#path,
Fixed the path and resourcePath in http event lambda proxy
dherault_serverless-offline
train
js
db5febb6a7a10ee5748009c212b77b1d61725dc4
diff --git a/core/codegen/src/main/java/org/overture/codegen/visitor/ExpVisitorCG.java b/core/codegen/src/main/java/org/overture/codegen/visitor/ExpVisitorCG.java index <HASH>..<HASH> 100644 --- a/core/codegen/src/main/java/org/overture/codegen/visitor/ExpVisitorCG.java +++ b/core/codegen/src/main/java/org/overture/codegen/visitor/ExpVisitorCG.java @@ -1102,7 +1102,7 @@ public class ExpVisitorCG extends AbstractVisitorCG<OoAstInfo, PExpCG> PTypeCG typeCg = node.getType().apply(question.getTypeVisitor(), question); - if (owningClass == null || isDefInOwningClass || isImplicit) + if (owningClass == null || nodeParentClass == null || isDefInOwningClass || isImplicit) { AIdentifierVarExpCG varExp = new AIdentifierVarExpCG();
Added fix for generation of variable expressions. When the node parent cannot be found the variable expression is generated as an identifier variable expression (instead of an explicit variable expression).
overturetool_overture
train
java
91003a67e130488e829450b02bfb64bd6e57f6ce
diff --git a/code/buttons/BetterButton_New.php b/code/buttons/BetterButton_New.php index <HASH>..<HASH> 100755 --- a/code/buttons/BetterButton_New.php +++ b/code/buttons/BetterButton_New.php @@ -37,6 +37,10 @@ class BetterButton_New extends BetterButton { * @return boolean */ public function shouldDisplay() { + // Do not show create new within create new + if($this->gridFieldRequest->getRequest()->param('ID') == 'new') { + return false; + } return $this->gridFieldRequest->record->canCreate(); } }
no need to show new record when creating a new record
unclecheese_silverstripe-gridfield-betterbuttons
train
php
78596b2089479982b21be499058bf8bd5de1cb16
diff --git a/nodeconductor/template/tasks.py b/nodeconductor/template/tasks.py index <HASH>..<HASH> 100644 --- a/nodeconductor/template/tasks.py +++ b/nodeconductor/template/tasks.py @@ -59,7 +59,7 @@ def template_group_execution_failed(self, task_uuid, template_group_result_uuid) task_result = self.app.AsyncResult(task_uuid) error = models.TemplateActionException.deserialize(str(task_result.result)) template_group_result = models.TemplateGroupResult.objects.get(uuid=template_group_result_uuid) - template_group_result.state_message = 'Template group execution has been failed.' + template_group_result.state_message = 'Execution of a template group has failed.' template_group_result.error_message = error['message'] template_group_result.error_details = error.get('details', '') template_group_result.is_finished = True
Fixed wording - NC-<I>
opennode_waldur-core
train
py
8933503f8397d5eb1edcbe495858eaed831d57bc
diff --git a/Eloquent/Concerns/HasAttributes.php b/Eloquent/Concerns/HasAttributes.php index <HASH>..<HASH> 100644 --- a/Eloquent/Concerns/HasAttributes.php +++ b/Eloquent/Concerns/HasAttributes.php @@ -543,9 +543,7 @@ trait HasAttributes // which simply lets the developers tweak the attribute as it is set on // the model, such as "json_encoding" an listing of data for storage. if ($this->hasSetMutator($key)) { - $method = 'set'.Str::studly($key).'Attribute'; - - return $this->{$method}($value); + return $this->setMutatedAttributeValue($key, $value); } // If an attribute is listed as a "date", we'll convert it from a DateTime @@ -583,6 +581,18 @@ trait HasAttributes } /** + * Set the value of an attribute using its mutator. + * + * @param string $key + * @param mixed $value + * @return mixed + */ + protected function setMutatedAttributeValue($key, $value) + { + return $this->{'set'.Str::studly($key).'Attribute'}($value); + } + + /** * Determine if the given attribute is a date or date castable. * * @param string $key
Extract setting mutated attribute into method
illuminate_database
train
php
b28ec3e9b03f1595eaf4bb82ef1f01c3c4d1c2b6
diff --git a/tasklib/task.py b/tasklib/task.py index <HASH>..<HASH> 100644 --- a/tasklib/task.py +++ b/tasklib/task.py @@ -52,6 +52,19 @@ class Task(object): return None return datetime.datetime.strptime(date_str, DATE_FORMAT) + def serialize_annotations(self, annotations): + ann_list = list(annotations) + for ann in ann_list: + ann['entry'] = ann['entry'].strftime(DATE_FORMAT) + return ann_list + + def deserialize_annotations(self, annotations): + ann_list = list(annotations) + for ann in ann_list: + ann['entry'] = datetime.datetime.strptime( + ann['entry'], DATE_FORMAT) + return ann_list + def regenerate_uuid(self): self['uuid'] = str(uuid.uuid4())
Add serialize/deserialize methods for annotations
robgolding_tasklib
train
py
2e492029fa22f0f2611fd28bfa692a10b0642fa8
diff --git a/java/server/src/org/openqa/selenium/remote/server/SeleniumServer.java b/java/server/src/org/openqa/selenium/remote/server/SeleniumServer.java index <HASH>..<HASH> 100644 --- a/java/server/src/org/openqa/selenium/remote/server/SeleniumServer.java +++ b/java/server/src/org/openqa/selenium/remote/server/SeleniumServer.java @@ -85,7 +85,7 @@ public class SeleniumServer implements GridNodeServer { public int getRealPort() { if (server.isStarted()) { - ServerConnector socket = (ServerConnector)server.getConnectors()[0]; + ServerConnector socket = (ServerConnector) server.getConnectors()[0]; return socket.getPort(); } return configuration.port;
Fix up a spacing issue. No logical changes
SeleniumHQ_selenium
train
java
b8d67fbcaf654cfe7a10c62d604d95d87e3bf3c2
diff --git a/hiyapyco/__init__.py b/hiyapyco/__init__.py index <HASH>..<HASH> 100644 --- a/hiyapyco/__init__.py +++ b/hiyapyco/__init__.py @@ -320,6 +320,7 @@ class HiYaPyCo: elif isinstance(b, listTypes): logger.debug('simplemerge: listTypes a "%s" w/ b "%s"' % (a, b,)) if isinstance(a, listTypes): + # pylint: disable=unused-variable for k, v in enumerate(b): try: a[k] = self._simplemerge(a[k], b[k])
make pylint silent on unused-variable
zerwes_hiyapyco
train
py
9c16fe03c15c0fee5632ca12aa7cc9fed8d8f3a4
diff --git a/publish_docs.py b/publish_docs.py index <HASH>..<HASH> 100644 --- a/publish_docs.py +++ b/publish_docs.py @@ -41,6 +41,6 @@ for line in lines: force=True, nojekyll=True, ) - break + break else: print_("No push to GitHub-Pages.")
Fix `publish_docs.py`. So far, it published only when the current branch was the first branch listed in `relevant_branches.txt`.
hydpy-dev_hydpy
train
py
3208e8c458a53b817a2f40562f2528670bb1a0d7
diff --git a/modules/core/src/main/java/org/projectodd/wunderboss/ec/ConcreteDaemonContext.java b/modules/core/src/main/java/org/projectodd/wunderboss/ec/ConcreteDaemonContext.java index <HASH>..<HASH> 100644 --- a/modules/core/src/main/java/org/projectodd/wunderboss/ec/ConcreteDaemonContext.java +++ b/modules/core/src/main/java/org/projectodd/wunderboss/ec/ConcreteDaemonContext.java @@ -103,11 +103,12 @@ public class ConcreteDaemonContext extends ConcreteExecutionContext implements D @Override public synchronized void stop() throws TimeoutException, InterruptedException { + if (this.stopCallback != null) { + this.stopCallback.notify(this.name); + } + if (isRunning()) { this.isRunning = false; - if (this.stopCallback != null) { - this.stopCallback.notify(this.name); - } this.thread.join(threadTimeout); if (this.thread.isAlive()) {
Notify stop callback whenever stop is called even if the daemon is no longer running.
projectodd_wunderboss-release
train
java
67b329e3e370f481da545a4c95577f60c9be08b6
diff --git a/providers/dns/ovh/ovh.go b/providers/dns/ovh/ovh.go index <HASH>..<HASH> 100644 --- a/providers/dns/ovh/ovh.go +++ b/providers/dns/ovh/ovh.go @@ -173,6 +173,13 @@ func (d *DNSProvider) CleanUp(domain, token, keyAuth string) error { return fmt.Errorf("ovh: error when call OVH api to delete challenge record (%s): %v", reqURL, err) } + // Apply the change + reqURL = fmt.Sprintf("/domain/zone/%s/refresh", authZone) + err = d.client.Post(reqURL, nil, nil) + if err != nil { + return fmt.Errorf("ovh: error when call api to refresh zone (%s): %v", reqURL, err) + } + // Delete record ID from map d.recordIDsMu.Lock() delete(d.recordIDs, fqdn)
OVH: Refresh zone after deleting challenge record (#<I>) After removing the challenge record from OVH, the zone itself does not get refreshed and leaving the obsolete record in place. Calling '/domain/zone/ZONE/refresh' after deleting the record will apply the changes to the zone.
go-acme_lego
train
go
06fbcefa3a080c283821e6d6ff392b1d189270ee
diff --git a/cloudant-client/src/main/java/com/cloudant/client/org/lightcouch/CouchDbClient.java b/cloudant-client/src/main/java/com/cloudant/client/org/lightcouch/CouchDbClient.java index <HASH>..<HASH> 100644 --- a/cloudant-client/src/main/java/com/cloudant/client/org/lightcouch/CouchDbClient.java +++ b/cloudant-client/src/main/java/com/cloudant/client/org/lightcouch/CouchDbClient.java @@ -504,9 +504,9 @@ public class CouchDbClient { ex = new PreconditionFailedException(response); break; case 429: - // The RequestLimitInterceptor will check for 429 and retry with a doubling - // duration wait. If the default 10 retries are exceeded before the request - // succeeds we end up here and throw a TooManyRequestsException. + // If a Replay429Interceptor is present it will check for 429 and retry at + // intervals. If the retries do not succeed or no 429 replay was configured + // we end up here and throw a TooManyRequestsException. ex = new TooManyRequestsException(response); break; default:
Updated comments on <I> in CouchDbClient
cloudant_java-cloudant
train
java
5e9c6c527902fd8361391f111a88a8f4b4ce71df
diff --git a/aospy/proj.py b/aospy/proj.py index <HASH>..<HASH> 100644 --- a/aospy/proj.py +++ b/aospy/proj.py @@ -16,7 +16,6 @@ class Proj(object): self.direc_out = direc_out self.nc_dir_struc = nc_dir_struc - self.vars = dict_name_keys(vars) if models: self.models = dict_name_keys(models) else: @@ -32,7 +31,7 @@ class Proj(object): else: self.regions = {} - for obj_dict in (self.vars, self.models, self.regions): + for obj_dict in (self.models, self.regions): for obj in obj_dict.values(): setattr(obj, 'proj', self)
Delete unnecessary vars attr of Proj
spencerahill_aospy
train
py
0effbc5f563fd63844181b45b759c5a14f4abb18
diff --git a/lib/cfa/augeas_parser.rb b/lib/cfa/augeas_parser.rb index <HASH>..<HASH> 100644 --- a/lib/cfa/augeas_parser.rb +++ b/lib/cfa/augeas_parser.rb @@ -217,7 +217,7 @@ module CFA # @param matcher [Matcher] # @return [Array<AugeasElement>] matching elements def select(matcher) - @data.select(&matcher) + data.select(&matcher) end def ==(other) diff --git a/spec/augeas_tree_spec.rb b/spec/augeas_tree_spec.rb index <HASH>..<HASH> 100644 --- a/spec/augeas_tree_spec.rb +++ b/spec/augeas_tree_spec.rb @@ -87,6 +87,21 @@ describe CFA::AugeasTree do end end + describe "#select" do + it "selects entries according to passed block" do + matcher = CFA::Matcher.new(collection: "spec") + expect(tree.select(matcher).size).to eq 2 + end + + it "never returns deleted entries" do + collection = tree.collection("spec") + collection.delete(collection[0]) + + matcher = CFA::Matcher.new(collection: "spec") + expect(tree.select(matcher).size).to eq 1 + end + end + describe "#==" do let(:example_tree) do tree = CFA::AugeasTree.new
fix AugeasTree#select to skip already deleted items
config-files-api_config_files_api
train
rb,rb
fd5bda76e4d72c718a89819e481f5116385e1ab6
diff --git a/numprops.py b/numprops.py index <HASH>..<HASH> 100644 --- a/numprops.py +++ b/numprops.py @@ -29,7 +29,7 @@ from traitlets import TraitType, TraitError import numpy as np -__version__ = '0.3.dev' +__version__ = '0.3.dev0' ASTROPY = 'astropy' PINT = 'pint'
Minor change in the versioning (changed after a warning issued by setup.py).
astrofrog_numtraits
train
py
bfa606f75084a0c3aa25a2578c5c3d8dc8cbc256
diff --git a/common/src/rb/lib/selenium/webdriver/zip_helper.rb b/common/src/rb/lib/selenium/webdriver/zip_helper.rb index <HASH>..<HASH> 100644 --- a/common/src/rb/lib/selenium/webdriver/zip_helper.rb +++ b/common/src/rb/lib/selenium/webdriver/zip_helper.rb @@ -13,9 +13,10 @@ module Selenium Zip::ZipFile.open(path) do |zip| zip.each do |entry| - to = File.join(destination, entry.name) - FileUtils.mkdir_p File.dirname(to) + to = File.join(destination, entry.name) + dirname = File.dirname(to) + FileUtils.mkdir_p dirname unless File.exist? dirname zip.extract(entry, to) end end
JariBakken: Only create directory if it doesn't exist while unzipping r<I>
SeleniumHQ_selenium
train
rb
a4901a39cf8181f52b31e6eb28acba30c3c41aa9
diff --git a/locator/locator_test.go b/locator/locator_test.go index <HASH>..<HASH> 100644 --- a/locator/locator_test.go +++ b/locator/locator_test.go @@ -35,8 +35,11 @@ var _ = Describe("Locator", func() { }) It("should have the correct import path", func() { - Expect(model.ImportPath).To(HavePrefix("github.com")) - Expect(model.ImportPath).To(HaveSuffix("counterfeiter/fixtures")) + // Make the code testable even in forked repos :) + // e.g.: you fork counterfeiter to make a change, + // the repo is now github.com/pizzabandit/counterfeiter + // you should expect these assertions to still pass + Expect(model.ImportPath).To(MatchRegexp("^github\\.com/[^/]+/counterfeiter/fixtures$")) }) It("should have the correct methods", func() {
Add better assertions to locator tests This can be a much stronger assertion if we use a regex. Optionally we could also pass in the expected directory if we were not testing exported functions, but had a type that we could configure.
maxbrunsfeld_counterfeiter
train
go
1d3439d80833296eaca2e1c06b510d3f5bb5b301
diff --git a/jbehave-core/src/main/java/org/jbehave/core/embedder/PerformableTree.java b/jbehave-core/src/main/java/org/jbehave/core/embedder/PerformableTree.java index <HASH>..<HASH> 100644 --- a/jbehave-core/src/main/java/org/jbehave/core/embedder/PerformableTree.java +++ b/jbehave-core/src/main/java/org/jbehave/core/embedder/PerformableTree.java @@ -110,8 +110,10 @@ public class PerformableTree { // Add Given stories only if story contains scenarios if (!performableStory.getScenarios().isEmpty()) { + Map<String, String> givenStoryParameters = new HashMap<>(storyParameters); + addMetaParameters(givenStoryParameters, storyMeta); performableStory.addGivenStories(performableGivenStories(context, story.getGivenStories(), - storyParameters)); + givenStoryParameters)); } performableStory.addAfterSteps(context.lifecycleSteps(story.getLifecycle(), storyMeta, Stage.AFTER, Scope.STORY));
JBEHAVE-<I> Pass parent story meta to given stories
jbehave_jbehave-core
train
java
0d9c7dcfe38023215caaa897b8762109aa7a5e9a
diff --git a/src/Reform/Validation/Rule/After.php b/src/Reform/Validation/Rule/After.php index <HASH>..<HASH> 100644 --- a/src/Reform/Validation/Rule/After.php +++ b/src/Reform/Validation/Rule/After.php @@ -12,6 +12,7 @@ use Reform\Validation\Result; class After extends AbstractRule { protected $datetime; + protected $message = ':name must be after :date'; public function __construct(\DateTime $datetime = null) { @@ -24,6 +25,8 @@ class After extends AbstractRule return true; } - return $this->fail($result, $name, $value); + return $this->fail($result, $name, $value, array( + ':date' => $this->datetime->format('F j, Y') + )); } }
Adding descriptive error to After rule.
glynnforrest_reform
train
php
418014027d5595d21bb8f467370954002a52d3ad
diff --git a/spec/puppet-lint/check_whitespace_spec.rb b/spec/puppet-lint/check_whitespace_spec.rb index <HASH>..<HASH> 100644 --- a/spec/puppet-lint/check_whitespace_spec.rb +++ b/spec/puppet-lint/check_whitespace_spec.rb @@ -78,4 +78,36 @@ describe PuppetLint::Plugins::CheckWhitespace do its(:warnings) { should be_empty } its(:errors) { should be_empty } end + + describe 'issue #37' do + let(:code) { " + class { 'lvs::base': + virtualeservers => { + '192.168.2.13' => { + vport => '11025', + service => 'smtp', + scheduler => 'wlc', + protocol => 'tcp', + checktype => 'external', + checkcommand => '/path/to/checkscript', + real_servers => { + 'server01' => { + real_server => '192.168.2.14', + real_port => '25', + forwarding => 'masq', + }, + 'server02' => { + real_server => '192.168.2.15', + real_port => '25', + forwarding => 'masq', + } + } + } + } + }" + } + + its(:warnings) { should be_empty } + its(:errors) { should be_empty } + end end
Add test case for issue #<I>
rodjek_puppet-lint
train
rb
b58de6aeee37afa8cc182c0b3303ad22b3d80f96
diff --git a/examples/image2video.js b/examples/image2video.js index <HASH>..<HASH> 100644 --- a/examples/image2video.js +++ b/examples/image2video.js @@ -1,4 +1,4 @@ -var ffmpeg = require('../index'); +var ffmpeg = require('fluent-ffmpeg'); // make sure you set the correct path to your video file var proc = new ffmpeg({ source: '/path/to/your_image.jpg', nolog: true }) @@ -14,4 +14,4 @@ var proc = new ffmpeg({ source: '/path/to/your_image.jpg', nolog: true }) console.log('an error happened: ' + err.message); }) // save to file - .saveToFile('/path/to/your_target.m4v'); \ No newline at end of file + .saveToFile('/path/to/your_target.m4v');
Update image2video.js Better to get the library by its name rather then the relative path
fluent-ffmpeg_node-fluent-ffmpeg
train
js
5b2ff8a1475258472753755792f54298e785e66f
diff --git a/sshtunnel.py b/sshtunnel.py index <HASH>..<HASH> 100644 --- a/sshtunnel.py +++ b/sshtunnel.py @@ -1183,12 +1183,17 @@ class SSHTunnelForwarder(object): _socket.settimeout(SSH_TIMEOUT) _socket.connect((self.ssh_host, self.ssh_port)) transport = paramiko.Transport(_socket) - if isinstance(transport.sock, socket.socket): - transport.sock.settimeout(SSH_TIMEOUT) + sock = transport.sock + if isinstance(sock, socket.socket): + sock.settimeout(SSH_TIMEOUT) transport.set_keepalive(self.set_keepalive) transport.use_compression(compress=self.compression) transport.daemon = self.daemon_transport - + if isinstance(sock, socket.socket): + sock_timeout = sock.gettimeout() + sock_info = repr((sock.family, sock.type, sock.proto)) + self.logger.debug('Transport socket info: {0}, timeout={1}' + .format(sock_info, sock_timeout)) return transport def _create_tunnels(self):
sshtunnel: log transport socket info
pahaz_sshtunnel
train
py
302d0dfd058ff255a2608aa181722c9f6423ea84
diff --git a/src/main/java/org/graylog2/inputs/syslog/SyslogUDPInput.java b/src/main/java/org/graylog2/inputs/syslog/SyslogUDPInput.java index <HASH>..<HASH> 100644 --- a/src/main/java/org/graylog2/inputs/syslog/SyslogUDPInput.java +++ b/src/main/java/org/graylog2/inputs/syslog/SyslogUDPInput.java @@ -63,6 +63,7 @@ public class SyslogUDPInput implements MessageInput { final ExecutorService workerThreadPool = Executors.newCachedThreadPool(); final ConnectionlessBootstrap bootstrap = new ConnectionlessBootstrap(new NioDatagramChannelFactory(workerThreadPool)); + bootstrap.setOption("receiveBufferSize", 1048576); bootstrap.setOption("receiveBufferSizePredictorFactory", new FixedReceiveBufferSizePredictorFactory(8192)); bootstrap.setPipelineFactory(new SyslogPipelineFactory(graylogServer));
also set ReceiveBufferSize for syslog udp
Graylog2_graylog2-server
train
java
5039456c38766383d26db962d884edd940dc3134
diff --git a/lib/em-hiredis/lock.rb b/lib/em-hiredis/lock.rb index <HASH>..<HASH> 100644 --- a/lib/em-hiredis/lock.rb +++ b/lib/em-hiredis/lock.rb @@ -29,15 +29,23 @@ module EM::Hiredis end # Release the lock + # + # Returns a deferrable def unlock EM.cancel_timer(@expire_timer) if @expire_timer - if @locked && Time.now.to_i < @expiry - EM::Hiredis.logger.debug "Lock: released #{@key}" - @redis.del(@key) - else - EM::Hiredis.logger.debug "Lock: could not release #{@key}" + unless active + df = EM::DefaultDeferrable.new + df.fail Error.new("Cannot unlock, lock not active") + return df end + + @redis.del(@key) + end + + # Lock has been acquired and we're within it's expiry time + def active + @locked && Time.now.to_i < @expiry end # This should not be used in normal operation - force clear
Lock: New returns a deferrable Removed logging, find out what happened via df
mloughran_em-hiredis
train
rb
d26423362e1ca17432dc874cab6b210e3454c31c
diff --git a/Handler/ProcessHandler.php b/Handler/ProcessHandler.php index <HASH>..<HASH> 100644 --- a/Handler/ProcessHandler.php +++ b/Handler/ProcessHandler.php @@ -140,6 +140,19 @@ class ProcessHandler implements ProcessHandlerInterface } /** + * Returns the current model state. + * + * @param ModelInterface $model + * @param string $processName + * + * @return FreeAgent\WorkflowBundle\Entity\ModelState + */ + public function getCurrentState(ModelInterface $model, $processName) + { + return $this->storage->findCurrentModelState($model, $processName); + } + + /** * Returns a step by its name. * * @param string $stepName diff --git a/Model/ModelStorage.php b/Model/ModelStorage.php index <HASH>..<HASH> 100644 --- a/Model/ModelStorage.php +++ b/Model/ModelStorage.php @@ -44,12 +44,10 @@ class ModelStorage */ public function findCurrentModelState(ModelInterface $model, $processName) { - $modelState = $this->repository->findLatestModelState( + return $this->repository->findLatestModelState( $model->getWorkflowIdentifier(), $processName ); - - return $modelState; } /**
can get current model state from process handler
lexik_LexikWorkflowBundle
train
php,php
f2684271fe2bec1c55d20100d8ab50611bb4aacf
diff --git a/src/feat/agencies/replay.py b/src/feat/agencies/replay.py index <HASH>..<HASH> 100644 --- a/src/feat/agencies/replay.py +++ b/src/feat/agencies/replay.py @@ -380,6 +380,9 @@ class Replay(log.FluLogKeeper, log.Logger): if self.medium is not None: raise ReplayError( 'Replay instance already has the medium reference') + + self.log_category = agent_factory.descriptor_type + self.log_name = dummy_id[0] self.medium = AgencyAgent(self, dummy_id) self.register_dummy(dummy_id, self.medium) self.agent = agent_factory(self.medium)
Set log name and category in replay mode. This fixes replayability issues.
f3at_feat
train
py
b190afa49a6b0939d692adcaee2396c619e632ff
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -1,12 +1,13 @@ from distutils.core import setup import os +import io import inflect here = os.path.dirname(__file__) readme_path = os.path.join(here, 'README.rst') -readme = open(readme_path, 'rb').read().decode('utf-8') +readme = io.open(readme_path, encoding='utf-8').read() setup( name='inflect',
Use io module for simplicity and closer alignment to recommended usage.
jazzband_inflect
train
py
d174809b5437cc1c32b726a49355170305683497
diff --git a/modules/ve/ce/ve.ce.Surface.js b/modules/ve/ce/ve.ce.Surface.js index <HASH>..<HASH> 100644 --- a/modules/ve/ce/ve.ce.Surface.js +++ b/modules/ve/ce/ve.ce.Surface.js @@ -760,7 +760,7 @@ ve.ce.Surface.prototype.handleDelete = function( backspace, isPartial ) { cursorAt = selection.start; } this.documentView.renderContent(); - this.showCursorAt(cursorAt); + this.showCursor(cursorAt); var _this = this; setTimeout( function() { _this.poll.prevText = _this.poll.prevHash = _this.poll.prevOffset = _this.poll.node = null; @@ -819,7 +819,7 @@ ve.ce.Surface.prototype.handleEnter = function() { this.model.getDocument().getRelativeContentOffset( selection.to, 1 ); } this.documentView.renderContent(); - this.showCursorAt(selection.to); + this.showCursor(selection.to); var _this = this; setTimeout( function() { _this.poll.prevText = _this.poll.prevHash = _this.poll.prevOffset = _this.poll.node = null;
replacing showCursorAt calls with correct showCursor method
wikimedia_parsoid
train
js
228331a6a4658f3c34206c421ddbfa65ba000ce9
diff --git a/lib/perpetuity/mongodb.rb b/lib/perpetuity/mongodb.rb index <HASH>..<HASH> 100644 --- a/lib/perpetuity/mongodb.rb +++ b/lib/perpetuity/mongodb.rb @@ -60,8 +60,6 @@ module Perpetuity end def retrieve klass, criteria, options = {} - objects = [] - # MongoDB uses '_id' as its ID field. if criteria.has_key?(:id) if criteria[:id].is_a? String @@ -71,20 +69,26 @@ module Perpetuity end end - sort_field = options[:attribute] - sort_direction = options[:direction] - sort_criteria = [[sort_field, sort_direction]] other_options = { limit: options[:limit] } if options[:page] other_options = other_options.merge skip: (options[:page] - 1) * options[:limit] end + cursor = database.collection(klass.to_s).find(criteria, other_options) - database.collection(klass.to_s).find(criteria, other_options).sort(sort_criteria).each do |document| + sort_cursor(cursor, options).map do |document| document[:id] = document.delete("_id") - objects << document + document end + end - objects + def sort_cursor cursor, options + return cursor unless options.has_key?(:attribute) && + options.has_key?(:direction) + + sort_field = options[:attribute] + sort_direction = options[:direction] + sort_criteria = [[sort_field, sort_direction]] + cursor.sort(sort_criteria) end def all klass
Refactor MongoDB#retrieve
jgaskins_perpetuity
train
rb
b81dc37620431a181e54e6214eb0fcccff184836
diff --git a/src/Sylius/Bundle/CoreBundle/Application/Kernel.php b/src/Sylius/Bundle/CoreBundle/Application/Kernel.php index <HASH>..<HASH> 100644 --- a/src/Sylius/Bundle/CoreBundle/Application/Kernel.php +++ b/src/Sylius/Bundle/CoreBundle/Application/Kernel.php @@ -31,12 +31,12 @@ use Webmozart\Assert\Assert; class Kernel extends HttpKernel { - public const VERSION = '1.4.7-DEV'; + public const VERSION = '1.4.7'; public const VERSION_ID = '10407'; public const MAJOR_VERSION = '1'; public const MINOR_VERSION = '4'; public const RELEASE_VERSION = '7'; - public const EXTRA_VERSION = 'DEV'; + public const EXTRA_VERSION = ''; public function __construct(string $environment, bool $debug) {
Change application's version to <I>
Sylius_Sylius
train
php
d944c3dacc673e8b125c2b039d65c7a84e14189f
diff --git a/src/Discord/Parts/User/Member.php b/src/Discord/Parts/User/Member.php index <HASH>..<HASH> 100644 --- a/src/Discord/Parts/User/Member.php +++ b/src/Discord/Parts/User/Member.php @@ -295,7 +295,7 @@ class Member extends Part public function __toString() { if ($this->nick) { - return "<@!{$this->user->id}"; + return "<@!{$this->user->id}>"; } return "<@{$this->user->id}>";
Fixing nickname mention, closes #<I>
teamreflex_DiscordPHP
train
php
27beb103f10ca5ebe9021ab826607245c6b160d1
diff --git a/app/models/lit/localization.rb b/app/models/lit/localization.rb index <HASH>..<HASH> 100644 --- a/app/models/lit/localization.rb +++ b/app/models/lit/localization.rb @@ -14,7 +14,7 @@ module Lit ## ASSOCIATIONS belongs_to :locale - belongs_to :localization_key, touch: true + belongs_to :localization_key has_many :localization_versions, dependent: :destroy has_many :versions, class_name: '::Lit::LocalizationVersion' @@ -31,7 +31,8 @@ module Lit with_options if: :translated_value_changed? do |o| o.before_update :create_version end - after_update :update_cache + after_commit :update_cache, on: :update + after_commit :update_localization_key, on: :update def to_s get_value @@ -77,6 +78,10 @@ module Lit Lit.init.cache.update_cache full_key, get_value end + def update_localization_key + localization_key.touch + end + def create_version if translated_value.present? l = localization_versions.new
Moves touch out of belongs to relation
prograils_lit
train
rb
41a2b5ed73aa5e39a6cd207a61c1aaaa69b8171e
diff --git a/discord/gateway.py b/discord/gateway.py index <HASH>..<HASH> 100644 --- a/discord/gateway.py +++ b/discord/gateway.py @@ -549,7 +549,7 @@ class DiscordVoiceWebSocket(websockets.client.WebSocketClientProtocol): data = msg.get('d') if op == self.READY: - interval = (data['heartbeat_interval'] / 100.0) - 5 + interval = data['heartbeat_interval'] / 1000.0 self._keep_alive = VoiceKeepAliveHandler(ws=self, interval=interval) self._keep_alive.start() yield from self.initial_connection(data) diff --git a/discord/voice_client.py b/discord/voice_client.py index <HASH>..<HASH> 100644 --- a/discord/voice_client.py +++ b/discord/voice_client.py @@ -225,6 +225,16 @@ class VoiceClient: self._connected.set() break + self.loop.create_task(self.poll_voice_ws()) + + @asyncio.coroutine + def poll_voice_ws(self): + """|coro| + Reads from the voice websocket while connected. + """ + while self._connected.is_set(): + yield from self.ws.poll_event() + @asyncio.coroutine def disconnect(self): """|coro|
Actually read from the voice websocket & fix heartbeat. This change makes it so that the buffer doesn't fill and the voice server drops the socket. Also, use correct interval for voice websocket heartbeat.
Rapptz_discord.py
train
py,py
369ed6782dad8de22efbb6fd55cb860546a12f22
diff --git a/picotui/widgets.py b/picotui/widgets.py index <HASH>..<HASH> 100644 --- a/picotui/widgets.py +++ b/picotui/widgets.py @@ -41,6 +41,13 @@ class Dialog(Widget): self.h = max(self.h, h + self.border_h - 1) + extra_h def redraw(self): + # Init some state on first redraw + if self.focus_idx == -1: + self.autosize() + self.focus_idx, self.focus_w = self.find_focusable_by_idx(0, 1) + if self.focus_w: + self.focus_w.focus = True + # Redraw widgets with cursor off self.cursor(False) self.dialog_box(self.x, self.y, self.w, self.h, self.title) @@ -66,13 +73,6 @@ class Dialog(Widget): i += 1 return None, None - def loop(self): - self.autosize() - self.focus_idx, self.focus_w = self.find_focusable_by_idx(0, 1) - if self.focus_w: - self.focus_w.focus = True - return super().loop() - def change_focus(self, widget): if widget is self.focus_w: return
widgets: Dialog: Init some internal state on 1st call to redraw(). Instead of in overriden loop(). Generally, avoid overriding loop() (there's no guarantee it will be called, input handling is done with handle_input()).
pfalcon_picotui
train
py
89d5ca3462e55f3cbf15b169f7587b2d52691fc8
diff --git a/api.js b/api.js index <HASH>..<HASH> 100644 --- a/api.js +++ b/api.js @@ -202,7 +202,7 @@ app.post('/api/v1/validate', upload.single('filename'), function(req,res){ if (!req.body.source && !req.file) payload.status = 200; // Dredd } var obj = getObj(body,payload); - var options = { resolve:true }; + var options = { resolve:false }; try { result.status = validator.validateSync(obj,options); if (result.status === true) payload.status = 200; @@ -291,7 +291,7 @@ app.post('/api/v1/convert', upload.single('filename'), function(req,res) { var obj = getObj(body,payload); var options = {}; options.patch = true; - options.resolve = true; + options.resolve = false; try { converter.convert(obj,options,function(err,options){ if (err) {
Don't try to resolve POST requests
Mermade_openapi-webconverter
train
js
9af89ff534f86f7243b28bcbe4d6a36fab6fddd7
diff --git a/javascript/firefox-driver/js/syntheticMouse.js b/javascript/firefox-driver/js/syntheticMouse.js index <HASH>..<HASH> 100644 --- a/javascript/firefox-driver/js/syntheticMouse.js +++ b/javascript/firefox-driver/js/syntheticMouse.js @@ -116,7 +116,7 @@ SyntheticMouse.prototype.isElementClickable = function(element) { parent = parent.parentNode; } - if (parent && parent.tagName.toLowerCase() == 'select' && !parent.multiple) { + if (parent && parent.tagName.toLowerCase() == 'select') { return this.isElementClickable(parent); } }
multiple selects when checking for clickability should be treated similarly to regular selects
SeleniumHQ_selenium
train
js
cb3be113406df0fc9fe20f2f12f7a27368277aee
diff --git a/src/RouterCommand.php b/src/RouterCommand.php index <HASH>..<HASH> 100644 --- a/src/RouterCommand.php +++ b/src/RouterCommand.php @@ -363,7 +363,7 @@ class RouterCommand if (is_array($response) || strpos($this->request->headers->get('Accept'), 'application/json') !== false) { $this->response->headers->set('Content-Type', 'application/json'); return $this->response - ->setContent(json_encode($response)) + ->setContent($response instanceof Response ? $response->getContent() : json_encode($response)) ->send(); }
Fixed issue related with returning Response instance to json.
izniburak_php-router
train
php
dae7875389ac64f861383fdfecac989ae3b042b2
diff --git a/tinytag/tinytag.py b/tinytag/tinytag.py index <HASH>..<HASH> 100644 --- a/tinytag/tinytag.py +++ b/tinytag/tinytag.py @@ -450,6 +450,7 @@ class ID3(TinyTag): 'WXXX': 'extra.url', 'TXXX': 'extra.text', 'TKEY': 'extra.initial_key', + 'USLT': 'extra.lyrics', } IMAGE_FRAME_IDS = {'APIC', 'PIC'} PARSABLE_FRAME_IDS = set(FRAME_ID_TO_FIELD.keys()).union(IMAGE_FRAME_IDS)
added support for USLT lyrics data as part of the `extra` field #<I>
devsnd_tinytag
train
py
38c5e4cea65995e38ca24370d1d523cedd2c7247
diff --git a/tests/unit/py2/nupic/encoders/utility_test.py b/tests/unit/py2/nupic/encoders/utility_test.py index <HASH>..<HASH> 100644 --- a/tests/unit/py2/nupic/encoders/utility_test.py +++ b/tests/unit/py2/nupic/encoders/utility_test.py @@ -38,7 +38,7 @@ class UtilityEncoderTest(unittest.TestCase): self.scoreEnc = ScalarEncoder(3, 0, 100, resolution=0.5, name='score') # encoder for the input (data) part - elem = ScalarEncoder(5,-5,50,resolution=1, forced=True) + elem = ScalarEncoder(5,-5,50,resolution=1) self.dataEnc = VectorEncoder(len(self.data), elem, typeCastFn=float, name='data') # utility encoder
rm forced (not yet)
numenta_nupic
train
py
081d18750d5d0fb5c20f916eb3149a646f0cabbf
diff --git a/javamelody-spring-boot-starter/src/main/java/net/bull/javamelody/JavaMelodyConfigurationProperties.java b/javamelody-spring-boot-starter/src/main/java/net/bull/javamelody/JavaMelodyConfigurationProperties.java index <HASH>..<HASH> 100644 --- a/javamelody-spring-boot-starter/src/main/java/net/bull/javamelody/JavaMelodyConfigurationProperties.java +++ b/javamelody-spring-boot-starter/src/main/java/net/bull/javamelody/JavaMelodyConfigurationProperties.java @@ -37,7 +37,7 @@ public class JavaMelodyConfigurationProperties { public static final String PREFIX = "javamelody"; /** - * If JavaMelody should be enabled within the application. Default: <code>true</code> + * If JavaMelody should be enabled within the application. */ private boolean enabled = true; /**
follow-up to #<I>
javamelody_javamelody
train
java
c2e88c3e9f778b36fce3af48f8fe6a1530087bf8
diff --git a/ws-connect.js b/ws-connect.js index <HASH>..<HASH> 100644 --- a/ws-connect.js +++ b/ws-connect.js @@ -14,7 +14,7 @@ function connect(signalhost) { return new WebSocket(signalhost); } -module.exports = function(signalhost, callback) { +module.exports = function(signalhost, opts, callback) { var ws = connect(signalhost); ws.once('open', function() {
Update vanilla websocket connector to accept an opts argument
rtc-io_rtc-signaller
train
js
5dffbf0a87432d71d8a880ebaf506f05c5487242
diff --git a/AdvancedHTTPServer.py b/AdvancedHTTPServer.py index <HASH>..<HASH> 100644 --- a/AdvancedHTTPServer.py +++ b/AdvancedHTTPServer.py @@ -65,7 +65,7 @@ ExecStop=/bin/kill -INT $MAINPID WantedBy=multi-user.target """ -__version__ = '0.2.73' +__version__ = '0.2.74' __all__ = [ 'AdvancedHTTPServer', 'AdvancedHTTPServerRegisterPath', @@ -297,8 +297,11 @@ class AdvancedHTTPServerRPCClient(object): return (self.__class__, (address, self.use_ssl, self.username, self.password, self.uri_base, self.hmac_key)) def set_serializer(self, serializer_name): + if not serializer_name in SERIALIZER_DRIVERS: + raise ValueError('unknown serializer: ' + serializer_name) self.serializer = SERIALIZER_DRIVERS[serializer_name] self.serializer_name = serializer_name + self.logger.debug('using serializer: ' + serializer_name) def __call__(self, *args, **kwargs): return self.call(*args, **kwargs)
Check and log the rpc clients serializer
zeroSteiner_AdvancedHTTPServer
train
py
2cd55dffc2e05892f08aa45fb585d3a0c2904991
diff --git a/src/naarad/utils.py b/src/naarad/utils.py index <HASH>..<HASH> 100644 --- a/src/naarad/utils.py +++ b/src/naarad/utils.py @@ -589,7 +589,6 @@ def check_slas(obj): """ if not hasattr(obj, 'sla_map'): return 0 - ret = 0 for sub_metric in obj.sla_map.keys(): for stat_name in obj.sla_map[sub_metric].keys():
add CDF support to Naarad: add CDF diff graph support and print failed SLA summaries
linkedin_naarad
train
py
86e7c18c07d7e37613e2b5b56a52a32d0540321f
diff --git a/src/ScnSocialAuth/Authentication/Adapter/HybridAuth.php b/src/ScnSocialAuth/Authentication/Adapter/HybridAuth.php index <HASH>..<HASH> 100644 --- a/src/ScnSocialAuth/Authentication/Adapter/HybridAuth.php +++ b/src/ScnSocialAuth/Authentication/Adapter/HybridAuth.php @@ -124,6 +124,20 @@ class HybridAuth extends AbstractAdapter implements ServiceManagerAwareInterface $this->getMapper()->insert($localUserProvider); } + $zfcUserOptions = $this->getZfcUserOptions(); + + if ($zfcUserOptions->getEnableUserState()) { + // Don't allow user to login if state is not in allowed list + $mapper = $this->getZfcUserMapper(); + $user = $mapper->findById($localUserProvider->getUserId()); + if (!in_array($user->getState(), $zfcUserOptions->getAllowedLoginStates())) { + $authEvent->setCode(Result::FAILURE_UNCATEGORIZED) + ->setMessages(array('A record with the supplied identity is not active.')); + $this->setSatisfied(false); + return false; + } + } + $authEvent->setIdentity($localUserProvider->getUserId()); $this->setSatisfied(true);
Check for allowed user state if enabled.
SocalNick_ScnSocialAuth
train
php
6341de025e18b118bb467e3ed8f06130c09c13d5
diff --git a/src/Symfony/Bundle/TwigBundle/TwigEngine.php b/src/Symfony/Bundle/TwigBundle/TwigEngine.php index <HASH>..<HASH> 100644 --- a/src/Symfony/Bundle/TwigBundle/TwigEngine.php +++ b/src/Symfony/Bundle/TwigBundle/TwigEngine.php @@ -17,7 +17,7 @@ use Symfony\Component\Templating\TemplateNameParserInterface; use Symfony\Component\HttpFoundation\Response; /** - * This engine knows how to render Twig templates. + * This engine renders Twig templates. * * @author Fabien Potencier <[email protected]> */
Be more specific in phpdoc (Fixes #<I>)
symfony_symfony
train
php
83f187fa7e255898e94a7f46c3573e2d97a62832
diff --git a/tests/test_cloudformation/test_stack_parsing.py b/tests/test_cloudformation/test_stack_parsing.py index <HASH>..<HASH> 100644 --- a/tests/test_cloudformation/test_stack_parsing.py +++ b/tests/test_cloudformation/test_stack_parsing.py @@ -66,8 +66,8 @@ get_attribute_output = { } } -outputs_template = dict(dummy_template.items() + output_dict.items()) -bad_outputs_template = dict(dummy_template.items() + bad_output.items()) +outputs_template = dict(list(dummy_template.items()) + list(output_dict.items())) +bad_outputs_template = dict(list(dummy_template.items()) + list(bad_output.items())) get_attribute_outputs_template = dict(dummy_template.items() + get_attribute_output.items()) dummy_template_json = json.dumps(dummy_template)
fix python 3 issue merging dicts
spulec_moto
train
py
d7394e62ab8b374bcdd1dbeaedec0f6c35624571
diff --git a/src/Charcoal/Admin/Script/Tools/CopyAssetsScript.php b/src/Charcoal/Admin/Script/Tools/CopyAssetsScript.php index <HASH>..<HASH> 100644 --- a/src/Charcoal/Admin/Script/Tools/CopyAssetsScript.php +++ b/src/Charcoal/Admin/Script/Tools/CopyAssetsScript.php @@ -106,10 +106,10 @@ class CopyAssetsScript extends AdminScript * @author Aidan Lister <[email protected]> * @version 1.0.1 * @link http://aidanlister.com/2004/04/recursively-copying-directories-in-php/ - * @param string $source Source path - * @param string $dest Destination path - * @param int $permissions New folder creation permissions - * @return bool Returns true on success, false on failure + * @param string $source Source path. + * @param string $dest Destination path. + * @param integer $permissions New folder creation permissions. + * @return boolean Returns true on success, false on failure. */ private function copy($source, $dest, $permissions = 0755) { @@ -137,7 +137,7 @@ class CopyAssetsScript extends AdminScript } // Deep copy directories - $this->copy("$source/$entry", "$dest/$entry", $permissions); + $this->copy($source.'/'.$entry, $dest.'/'.$entry, $permissions); } // Clean up
Fixed phpcs errors in CopyAssetsScript
locomotivemtl_charcoal-admin
train
php
6ebd4e9072e32aa86905da5b96056664d7d34f10
diff --git a/amazon/api.py b/amazon/api.py index <HASH>..<HASH> 100644 --- a/amazon/api.py +++ b/amazon/api.py @@ -1253,6 +1253,14 @@ class AmazonProduct(LXMLWrapper): """ return self._safe_get_element_text('ItemAttributes.ProductTypeName') + @property + def formatted_price(self): + """FormattedPrice. + + :return: + FormattedPrice (string) + """ + return self._safe_get_element_text('OfferSummary.LowestNewPrice.FormattedPrice') class AmazonCart(LXMLWrapper): """Wrapper around Amazon shopping cart.
Add support for product formatted price property parsing in the AmazonProduct class
yoavaviram_python-amazon-simple-product-api
train
py
4adad4bf1d7a07ab7b07c3c19e3019ce3628a067
diff --git a/src/Symfony/Component/HttpKernel/Kernel.php b/src/Symfony/Component/HttpKernel/Kernel.php index <HASH>..<HASH> 100644 --- a/src/Symfony/Component/HttpKernel/Kernel.php +++ b/src/Symfony/Component/HttpKernel/Kernel.php @@ -59,12 +59,12 @@ abstract class Kernel implements KernelInterface, TerminableInterface protected $startTime; protected $loadClassCache; - const VERSION = '3.0.8'; - const VERSION_ID = 30008; + const VERSION = '3.0.9-DEV'; + const VERSION_ID = 30009; const MAJOR_VERSION = 3; const MINOR_VERSION = 0; - const RELEASE_VERSION = 8; - const EXTRA_VERSION = ''; + const RELEASE_VERSION = 9; + const EXTRA_VERSION = 'DEV'; const END_OF_MAINTENANCE = '07/2016'; const END_OF_LIFE = '01/2017';
bumped Symfony version to <I>
symfony_symfony
train
php
6c1f304d676a796be1fe9db0ec02d503a41913fd
diff --git a/webgl.go b/webgl.go index <HASH>..<HASH> 100644 --- a/webgl.go +++ b/webgl.go @@ -6,6 +6,7 @@ package webgl import ( "errors" + "github.com/gopherjs/gopherjs/js" ) @@ -340,7 +341,7 @@ type Context struct { // If an error is returned it means you won't have access to WebGL // functionality. func NewContext(canvas js.Object, ca *ContextAttributes) (*Context, error) { - if js.Global.Get("WebGLRenderingContext").IsUndefined() { + if js.Global.Get("WebGLRenderingContext") == js.Undefined { return nil, errors.New("Your browser doesn't appear to support webgl.") } @@ -357,9 +358,9 @@ func NewContext(canvas js.Object, ca *ContextAttributes) (*Context, error) { "preserveDrawingBuffer": ca.PreserveDrawingBuffer, } gl := canvas.Call("getContext", "webgl", attrs) - if gl.IsNull() { + if gl == nil { gl = canvas.Call("getContext", "experimental-webgl", attrs) - if gl.IsNull() { + if gl == nil { return nil, errors.New("Creating a webgl context has failed.") } }
Update to new gopherjs/js API for null and undefined.
gopherjs_webgl
train
go
df1b79ff937e4a5dfe639f8d044cfd0188c9c52d
diff --git a/lib/cronofy/errors.rb b/lib/cronofy/errors.rb index <HASH>..<HASH> 100644 --- a/lib/cronofy/errors.rb +++ b/lib/cronofy/errors.rb @@ -42,6 +42,10 @@ module Cronofy end class InvalidRequestError < APIError + def message + "#{super} - #{errors.inspect}" + end + def errors @errors ||= begin json = JSON.parse(self.body) diff --git a/spec/lib/cronofy/errors_spec.rb b/spec/lib/cronofy/errors_spec.rb index <HASH>..<HASH> 100644 --- a/spec/lib/cronofy/errors_spec.rb +++ b/spec/lib/cronofy/errors_spec.rb @@ -50,6 +50,10 @@ describe Cronofy::Errors do expect(subject.errors).to eq(deserialized_errors) end + + it "includes the errors in the message" do + expect(subject.message).to eq('message - {"event_id"=>[{"key"=>"errors.required", "description"=>"required"}]}') + end end context "errors field missing" do
Changes invalid request message to include errors Makes the source of the error more visible to developers so that they may be able to resolve the problem more easily.
cronofy_cronofy-ruby
train
rb,rb
5067a03f61c33808a63446887144cca266dd8756
diff --git a/spyder/utils/syntaxhighlighters.py b/spyder/utils/syntaxhighlighters.py index <HASH>..<HASH> 100644 --- a/spyder/utils/syntaxhighlighters.py +++ b/spyder/utils/syntaxhighlighters.py @@ -515,9 +515,9 @@ class CythonSH(PythonSH): """Cython Syntax Highlighter""" ADDITIONAL_KEYWORDS = [ "cdef", "ctypedef", "cpdef", "inline", "cimport", "extern", - "include", "begin", "end", "by", "gil", "nogil", "const", "public", - "readonly", "fused", "static", "api", "DEF", "IF", "ELIF", "ELSE"] - + "include", "begin", "end", "by", "gil", "nogil", "const", "public", + "readonly", "fused", "static", "api", "DEF", "IF", "ELIF", "ELSE"] + ADDITIONAL_BUILTINS = C_TYPES.split() + [ "array", "bint", "Py_ssize_t", "intern", "reload", "sizeof", "NULL"] PROG = re.compile(make_python_patterns(ADDITIONAL_KEYWORDS,
Remove tabs from utils/syntaxhighlighters
spyder-ide_spyder
train
py
731658a6b778e7dd010de601f7c80dc1a22044e8
diff --git a/tests/React/FunctionalTests/Stomp/AckTest.php b/tests/React/FunctionalTests/Stomp/AckTest.php index <HASH>..<HASH> 100644 --- a/tests/React/FunctionalTests/Stomp/AckTest.php +++ b/tests/React/FunctionalTests/Stomp/AckTest.php @@ -7,7 +7,9 @@ class AckTest extends FunctionalTestCase /** @test */ public function itShouldReceiveAgainNackedMessages() { - $this->markTestSkipped('Temporary disabling this test as Apollo hang on it'); + if ('apollo' === getenv('STOMP_PROVIDER')) { + $this->markTestSkipped('Temporary disabling this test as Apollo hang on it'); + } $loop = $this->getEventLoop(); $client = $this->getClient($loop);
Disable AckTest functional test only for apollo
friends-of-reactphp_stomp
train
php
3e7556be6435611fb50d16c031316197236f8b9a
diff --git a/bcbio/pipeline/qcsummary.py b/bcbio/pipeline/qcsummary.py index <HASH>..<HASH> 100644 --- a/bcbio/pipeline/qcsummary.py +++ b/bcbio/pipeline/qcsummary.py @@ -324,9 +324,9 @@ def _run_coverage_qc(bam_file, data, out_dir): if dd.get_coverage_interval(data) != "genome": target_name = "variant_regions" else: - target_name = None + target_name = "genome" - if target_name: + if target_name != "genome": ontarget = sambamba.number_mapped_reads_on_target( data, merged_bed_file, bam_file, keep_dups=False, target_name=target_name) if mapped_unique:
QC: another bug fix for genome coverage
bcbio_bcbio-nextgen
train
py
8d066ce41cb2c7d3123314586d86f83738cdf6a5
diff --git a/sentry-core/src/main/java/io/sentry/core/transport/AsyncConnection.java b/sentry-core/src/main/java/io/sentry/core/transport/AsyncConnection.java index <HASH>..<HASH> 100644 --- a/sentry-core/src/main/java/io/sentry/core/transport/AsyncConnection.java +++ b/sentry-core/src/main/java/io/sentry/core/transport/AsyncConnection.java @@ -117,9 +117,9 @@ public final class AsyncConnection implements Closeable, Connection { public void send(@NotNull SentryEnvelope envelope, final @Nullable Object hint) throws IOException { // For now no caching on envelopes - IEnvelopeCache currentEventCache = sessionCache; + IEnvelopeCache currentEnvelopeCache = sessionCache; if (hint instanceof Cached) { - currentEventCache = NoOpEnvelopeCache.getInstance(); + currentEnvelopeCache = NoOpEnvelopeCache.getInstance(); } // Optimize for/No allocations if no items are under 429 @@ -150,7 +150,7 @@ public final class AsyncConnection implements Closeable, Connection { envelope = new SentryEnvelope(envelope.getHeader(), toSend); } - executor.submit(new SessionSender(envelope, hint, currentEventCache)); + executor.submit(new SessionSender(envelope, hint, currentEnvelopeCache)); } @Override
ref: Rename currentEventCache to currentEnvelopeCache (getsentry/sentry-android#<I>) In AsyncConnection.send the variable for IEnvelopeCache was named currentEventCache. It was renamed to currentEnvelopeCache.
getsentry_sentry-java
train
java
1a9bfe22f534e676d604e13b132c440023f34685
diff --git a/bin/ris.js b/bin/ris.js index <HASH>..<HASH> 100755 --- a/bin/ris.js +++ b/bin/ris.js @@ -91,7 +91,7 @@ const getYarnPrefix = () => { return path.join(process.env.LOCALAPPDATA, 'Yarn', 'config', 'global') } - return path.join(os.homedir(), 'config', 'yarn', 'global') + return path.join(os.homedir(), '.config', 'yarn', 'global') } const inGlobalYarn = fullpath => fullpath.indexOf(getYarnPrefix()) === 0
Fix path to yarn globals on non-Windows systems
rispa-io_rispa-cli
train
js
5453b4298d3d9abf580bb2bb41a9f54da435076d
diff --git a/lib/twitter-bootstrap-rails-cdn.rb b/lib/twitter-bootstrap-rails-cdn.rb index <HASH>..<HASH> 100644 --- a/lib/twitter-bootstrap-rails-cdn.rb +++ b/lib/twitter-bootstrap-rails-cdn.rb @@ -1,4 +1,4 @@ -require 'twitter-bootstrap-rails-cdn/engine' if ::Rails.version >= 3.1 +require 'twitter-bootstrap-rails-cdn/engine' if ::Rails.version >= '3.1' require 'twitter-bootstrap-rails-cdn/railtie' require 'twitter-bootstrap-rails-cdn/version'
Can't compare string with float - whoops!
nbarthelemy_twitter-bootstrap-rails-cdn
train
rb
80db2333e52ffff09cd6df68f5942771165e2125
diff --git a/lib/docker_cloud.rb b/lib/docker_cloud.rb index <HASH>..<HASH> 100644 --- a/lib/docker_cloud.rb +++ b/lib/docker_cloud.rb @@ -31,6 +31,9 @@ require 'docker_cloud/api/container_api' require 'docker_cloud/api/stack_api' require 'docker_cloud/api/registry_api' +# ruby libs +require 'base64' + module DockerCloud class Client attr_reader :username diff --git a/spec/docker_cloud_spec.rb b/spec/docker_cloud_spec.rb index <HASH>..<HASH> 100644 --- a/spec/docker_cloud_spec.rb +++ b/spec/docker_cloud_spec.rb @@ -9,3 +9,15 @@ describe DockerCloud do expect(false).to eq(true) end end + +describe DockerCloud::Client do + describe "#headers" do + subject { described_class.new('foo', 'bar').headers } + + context "Authorization header" do + it "base64 encodes username and api_key" do + expect(subject["Authorization"]).to eq("Basic Zm9vOmJhcg==") + end + end + end +end
Add a spec around the headers and the base<I> require
jntullo_ruby-docker-cloud
train
rb,rb
f2f462280774ec8d327fc1a449d35b7508a6aa76
diff --git a/packages/tyranid/src/core/path.js b/packages/tyranid/src/core/path.js index <HASH>..<HASH> 100644 --- a/packages/tyranid/src/core/path.js +++ b/packages/tyranid/src/core/path.js @@ -675,16 +675,31 @@ Object.defineProperties(Path.prototype, { let pi = 0, denormal; - for (; pi < plen; pi) { + while (pi < plen) { const field = fields[pi++]; denormal = field.def.denormal; if (denormal) break; } - for (; pi < plen; pi++) { + while (pi < plen) { const field = fields[pi++]; - denormal = denormal[field.name]; - if (!denormal) break; + let denormalPath = field.name; + let newDenormal = denormal[denormalPath]; + if (!newDenormal) { + // look for a compound denormal + for (; pi < plen; ) { + const field = fields[pi++]; + const fname = field.name; + if (fname === '_') continue; + denormalPath += '.' + fname; + newDenormal = denormal[denormalPath]; + if (newDenormal) break; + } + + if (!newDenormal) return undefined; + } + + denormal = newDenormal; } return denormal;
fix for processing denormals in paths when a denormal has an embedded compound name
tyranid-org_tyranid
train
js
43f06de45c62c31e5cd45d8f4394bbd335f9db8f
diff --git a/devices/lellki.js b/devices/lellki.js index <HASH>..<HASH> 100644 --- a/devices/lellki.js +++ b/devices/lellki.js @@ -99,7 +99,7 @@ module.exports = [ device.save(); }, options: [exposes.options.measurement_poll_interval()], - exposes: [e.switch().withEndpoint('l1'), e.power(), e.current(), e.voltage().withAccess(ea.STATE), + exposes: [e.switch(), e.power(), e.current(), e.voltage().withAccess(ea.STATE), e.energy(), exposes.enum('power_outage_memory', ea.STATE_SET, ['on', 'off', 'restore']) .withDescription('Recover state after power outage')], onEvent: tuya.onEventMeasurementPoll,
Fix LELLKI XF-EU-S<I>-1-M not controllable (#<I>) fix swtich dont work Touch switch 1 gang (with power monitoring) XF-EU-S<I>-1-M
Koenkk_zigbee-shepherd-converters
train
js
10369ff2d4fd1423f2a478c1d51171e90466c59b
diff --git a/angr/analyses/cfg_fast.py b/angr/analyses/cfg_fast.py index <HASH>..<HASH> 100644 --- a/angr/analyses/cfg_fast.py +++ b/angr/analyses/cfg_fast.py @@ -294,10 +294,6 @@ class CFGFast(Analysis): # All IRSBs with an indirect exit target self._indirect_jumps = set() - self._unassured_functions = set() - - self.base_address = None - self.function_manager = FunctionManager(self.project, self) # Start working!
CFGFast: remove two unused members.
angr_angr
train
py
836eb4d2245fc54c0f49d530fe2888e04c66b184
diff --git a/core-bundle/src/Resources/contao/dca/tl_article.php b/core-bundle/src/Resources/contao/dca/tl_article.php index <HASH>..<HASH> 100644 --- a/core-bundle/src/Resources/contao/dca/tl_article.php +++ b/core-bundle/src/Resources/contao/dca/tl_article.php @@ -687,7 +687,7 @@ class tl_article extends Backend $arrSections = array_merge($arrSections, $arrCustom); } - return array_unique($arrSections); + return array_values(array_unique($arrSections)); }
[Core] Correctly assign articles to columns (see #<I>)
contao_contao
train
php
e5160ba1ae29a6106f5f6ef020a99d64d0c4723c
diff --git a/src/Illuminate/Auth/Guard.php b/src/Illuminate/Auth/Guard.php index <HASH>..<HASH> 100755 --- a/src/Illuminate/Auth/Guard.php +++ b/src/Illuminate/Auth/Guard.php @@ -280,10 +280,11 @@ class Guard { $this->lastAttempted = $user = $this->provider->retrieveByCredentials($credentials); - // If an implementation of UserInterface was returned, we'll ask the provider - // to validate the user against the given credentials, and if they are in - // fact valid we'll log the users into the application and return true. - if ($user instanceof UserInterface) + // If something was returned, we can assume it implements UserInterface + // and ask the provider to validate it against the given credentials, + // and if they are in fact valid we'll log the users into the + // application and return true. + if ( ! is_null($user)) { if ($this->provider->validateCredentials($user, $credentials)) {
check for null instead of instanceof UserInterface
laravel_framework
train
php
034fbe915ab76c59237d3a12e711020e06537f73
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ Coins from setuptools import setup setup( - name='Coins', + name='coins', version='0.1.3', url='https://github.com/halfmoonlabs/coins', license='MIT',
change the name of the package so it is all lowercase
blockstack_pybitcoin
train
py
38a96c359faa18000837cbffe319ba219873b3c2
diff --git a/xkcd.py b/xkcd.py index <HASH>..<HASH> 100644 --- a/xkcd.py +++ b/xkcd.py @@ -17,6 +17,8 @@ import random import urllib2 as urllib import webbrowser +explanationUrl = "http://explainxkcd.com/" + class Comic: def __init__(self, number): @@ -60,6 +62,11 @@ class Comic: def getImageName(self): """Returns the name of the comic's image""" return self.imageName + + def getExplanation(self): + """Returns an explain xkcd link for the comic.""" + global explanationUrl + return explanationUrl + str(self.number) def show(self): """Uses the webbrowser module to open the comic"""
Added basic getExplanation function for explain xkcd.
TC01_python-xkcd
train
py
13f329aeaf713fb87a62c1d0c390959cea4d58e5
diff --git a/packages/create-resolve-app/bin/index.js b/packages/create-resolve-app/bin/index.js index <HASH>..<HASH> 100755 --- a/packages/create-resolve-app/bin/index.js +++ b/packages/create-resolve-app/bin/index.js @@ -11,7 +11,7 @@ const EOL = require('os').EOL const optionDefinitions = [ { name: 'scripts', type: String }, - { name: 'sample', type: Boolean }, + { name: 'todo', type: Boolean }, { name: 'exact-versions', type: Boolean }, { name: 'version', alias: 'V', type: Boolean }, { name: 'help', alias: 'h', type: Boolean } @@ -20,7 +20,7 @@ const optionDefinitions = [ const optionsInfo = `Options:${EOL}` + EOL + - ' --sample creates a single page application representing a typical Todo List' + + ' --todo creates a single page application representing a typical Todo List' + EOL + ` -V, --version outputs the version number${EOL}` + ` -h, --help outputs usage information${EOL}` @@ -77,7 +77,7 @@ if (unknownOptions && unknownOptions.length) { moduleCreator( appName, options.scripts, - !options.sample, + !options.todo, resolveVersion, !!options['exact-versions'] )
fix(create-resolve-app): rename sample -> todo (#<I>)
reimagined_resolve
train
js
b1681c3c81476cc03b1f465b7c3d50bacf64322e
diff --git a/spec/unit/interface_spec.rb b/spec/unit/interface_spec.rb index <HASH>..<HASH> 100644 --- a/spec/unit/interface_spec.rb +++ b/spec/unit/interface_spec.rb @@ -180,7 +180,7 @@ describe Puppet::Interface do display_global_options "modulepath" end end - face.display_global_options =~ ["environment"] + expect(face.display_global_options).to match(["environment"]) end it "should not fail when a face d_g_o duplicates an action d_g_o" do @@ -200,8 +200,8 @@ describe Puppet::Interface do action :foo do when_invoked {|_| true} ; display_global_options "environment" end action :bar do when_invoked {|_| true} ; display_global_options "environment" end end - face.get_action(:foo).display_global_options =~ ["environment"] - face.get_action(:bar).display_global_options =~ ["environment"] + expect(face.get_action(:foo).display_global_options).to match(["environment"]) + expect(face.get_action(:bar).display_global_options).to match(["environment"]) end end
(PUP-<I>) Ruby <I> warning: Object#=~ `warning: deprecated Object#=~ is called on Puppet::Type::File; it always returns nil`
puppetlabs_puppet
train
rb
91fe7024c1a264ec07ff9686a6ebb08914422d40
diff --git a/Client/Tests/Api/StatementsApiClientTest.php b/Client/Tests/Api/StatementsApiClientTest.php index <HASH>..<HASH> 100644 --- a/Client/Tests/Api/StatementsApiClientTest.php +++ b/Client/Tests/Api/StatementsApiClientTest.php @@ -71,6 +71,24 @@ class StatementsApiClientTest extends ApiClientTest $this->assertEquals($statement, $this->client->storeStatement($statement)); } + public function testStoreStatementWithIdEnsureThatTheIdIsNotOverwritten() + { + $statementId = '12345678-1234-5678-1234-567812345678'; + $statement = $this->createStatement(); + $statement->setId($statementId); + $this->validateStoreApiCall( + 'put', + 'statements', + array('statementId' => $statementId), + 204, + '', + $statement + ); + $storedStatement = $this->client->storeStatement($statement); + + $this->assertEquals($statementId, $storedStatement->getId()); + } + public function testStoreStatements() { $statementId1 = '12345678-1234-5678-1234-567812345678';
add a test case to ensure that a statement's id is not overwritten when it is stored in a learning record store (for #1)
php-xapi_serializer
train
php
df30fad2a681801700a2fcb18d18943b0d9f9960
diff --git a/libre/apps/data_drivers/renderers.py b/libre/apps/data_drivers/renderers.py index <HASH>..<HASH> 100644 --- a/libre/apps/data_drivers/renderers.py +++ b/libre/apps/data_drivers/renderers.py @@ -126,7 +126,7 @@ class LeafletRenderer(renderers.TemplateHTMLRenderer): return template.render(context) def determine_extents(self, features): - bounds_generator = (geometry.shape(feature['geometry']).bounds for feature in features) + bounds_generator = (feature['geometry'].bounds for feature in features) iterator = iter(bounds_generator) first_feature_bounds = iterator.next()
Don't parse again binary geometries
commonwealth-of-puerto-rico_libre
train
py
dfd66dc21488ee0e1575e6cde92868dfd9917a72
diff --git a/src/viz/shapes/area.js b/src/viz/shapes/area.js index <HASH>..<HASH> 100644 --- a/src/viz/shapes/area.js +++ b/src/viz/shapes/area.js @@ -55,21 +55,21 @@ d3plus.shape.area = function(vars,selection,enter,exit) { "angle": d3.range(-70,71,1), "aspectRatio": ratio, "tolerance": 0 - })[0] + }) - if (lr) { + if (lr && lr[0]) { var label = { - "w": Math.floor(lr.width), - "h": Math.floor(lr.height), - "x": Math.floor(lr.cx), - "y": Math.floor(lr.cy), - "angle": lr.angle*-1, + "w": Math.floor(lr[0].width), + "h": Math.floor(lr[0].height), + "x": Math.floor(lr[0].cx), + "y": Math.floor(lr[0].cy), + "angle": lr[0].angle*-1, "padding": 2, "names": names } - if (lr.angle !== 0) { + if (lr[0].angle !== 0) { label.translate = { "x":label.x, "y":label.y
fixed stacked area for null paths
alexandersimoes_d3plus
train
js
f14fb6ea0b49e19dfa1b9940980c768cbd7b05c8
diff --git a/src/com/google/javascript/jscomp/colors/ObjectColor.java b/src/com/google/javascript/jscomp/colors/ObjectColor.java index <HASH>..<HASH> 100644 --- a/src/com/google/javascript/jscomp/colors/ObjectColor.java +++ b/src/com/google/javascript/jscomp/colors/ObjectColor.java @@ -18,6 +18,7 @@ package com.google.javascript.jscomp.colors; import com.google.auto.value.AutoValue; import com.google.common.collect.ImmutableCollection; +import javax.annotation.Nullable; /** * A user-defined object type. For now each type is defined by a unique class name and file source. @@ -49,6 +50,13 @@ public abstract class ObjectColor implements Color { public abstract String getFilename(); + // given `function Foo() {}` or `class Foo {}`, color of Foo.prototype. null otherwise. + @Nullable + public abstract Color getPrototype(); + + @Nullable + public abstract Color getInstanceColor(); + @Override public abstract boolean isInvalidating(); @@ -61,6 +69,10 @@ public abstract class ObjectColor implements Color { public abstract Builder setInvalidating(boolean value); + public abstract Builder setPrototype(Color prototype); + + public abstract Builder setInstanceColor(Color instanceColor); + public abstract ObjectColor build(); }
Serialize prototype and instance type instead of implicit prototype Ambiguation needs to access a class's prototype to know the owner type of its member functions, and needs to know instance type and prototypes of constructors that are never explicitly new'd in the AST PiperOrigin-RevId: <I>
google_closure-compiler
train
java
ba20c34962d6322bcd439c0cb95bb7319f1c31df
diff --git a/dist/sandbox.js b/dist/sandbox.js index <HASH>..<HASH> 100644 --- a/dist/sandbox.js +++ b/dist/sandbox.js @@ -36,7 +36,7 @@ map2.bind().log("map2 changed"); var list1 = new can.List([1,2,3]); var list2 = list1.bind().toCanList(new can.List([1,2,3])); // This one doesn't work quite as well as one would hope. -list2.bind().toCanList(list1); +// list2.bind().toCanList(list1); list1.bind().log("list1 changed"); list2.bind().log("list2 changed"); diff --git a/src/bacon.js b/src/bacon.js index <HASH>..<HASH> 100644 --- a/src/bacon.js +++ b/src/bacon.js @@ -111,8 +111,9 @@ function syncAsList(list, val) { list.attr(val.index, val.value); break; case "add": - // TODO - is there any way to support two-way binding with this working - // the way it does?... Probably not without hacking Can internals. + // TODO - tag lists and/or events with some magical number (like.. a + // batchnum-style thing) to prevent circular additions when two-way + // binding. Please name it: "___PRAISE_THE_SUN___" list.splice.apply(list, [val.index, 0].concat(val.value)); break; case "remove":
Gotta fix this two-way bindig bug at some point
canjs_can-bacon
train
js,js
3144620d2eb37b86a10f004c7b3efefd9f3f4688
diff --git a/index.js b/index.js index <HASH>..<HASH> 100644 --- a/index.js +++ b/index.js @@ -83,7 +83,7 @@ JazzUpdateSitePlugin.prototype.apply = function(compiler) { + ` <plugin download-size="0" id="${projectId}" install-size="0" version="${version}" />\n` + `</feature>`; - compiler.plugin('emit', (compilation, callback) => { + compiler.plugin('after-emit', (compilation, callback) => { var featureData = [{source: new Buffer(feature), name: nestedFeatureXml}]; var artifactData = [
run plugin on after-emit to make sure that all emit plugins have completed
innerjoin_jazz-update-site-webpack-plugin
train
js
194a38b0a35d51ebc248412d14fb979d2a788405
diff --git a/mod/wiki/files.php b/mod/wiki/files.php index <HASH>..<HASH> 100644 --- a/mod/wiki/files.php +++ b/mod/wiki/files.php @@ -88,6 +88,13 @@ $PAGE->set_heading($course->fullname); $PAGE->navbar->add(format_string(get_string('wikifiles', 'wiki'))); echo $OUTPUT->header(); echo $OUTPUT->heading(format_string($wiki->name)); + +// Render the activity information. +$cminfo = cm_info::create($cm); +$completiondetails = \core_completion\cm_completion_details::get_instance($cminfo, $USER->id); +$activitydates = \core\activity_dates::get_dates_for_module($cminfo, $USER->id); +echo $OUTPUT->activity_information($cminfo, $completiondetails, $activitydates); + echo $OUTPUT->box(format_module_intro('wiki', $wiki, $PAGE->cm->id), 'generalbox', 'intro'); $renderer = $PAGE->get_renderer('mod_wiki');
MDL-<I> mod_wiki: Ensure completion conditions displayed on all tabs
moodle_moodle
train
php
8278f031367df98929387a7918a833702bbe3a18
diff --git a/src/includes/admin/class-papi-admin.php b/src/includes/admin/class-papi-admin.php index <HASH>..<HASH> 100644 --- a/src/includes/admin/class-papi-admin.php +++ b/src/includes/admin/class-papi-admin.php @@ -443,21 +443,6 @@ final class Papi_Admin { } /** - * Setup globals. - * - * @since 1.0.0 - */ - - private function setup_globals() { - $this->view = new Papi_Admin_View; - $this->meta_boxes = new Papi_Admin_Meta_Boxes; - $this->management_pages = new Papi_Admin_Management_Pages; - $this->post_type = papi_get_wp_post_type(); - $this->post_id = papi_get_post_id(); - $this->page_type = papi_get_page_type_meta_value( $this->post_id ); - } - - /** * Setup actions. * * @since 1.0.0 @@ -499,7 +484,6 @@ final class Papi_Admin { * Setup globals. * * @since 1.0.0 - * @access private */ private function setup_globals() {
Removed dublicated setup_globals from Papi_Admin
wp-papi_papi
train
php
7b67e3ae1769e81e8d9dba209df565a7baf65fb5
diff --git a/devices.js b/devices.js index <HASH>..<HASH> 100755 --- a/devices.js +++ b/devices.js @@ -828,6 +828,13 @@ const devices = [ extend: hue.light_onoff_brightness_colortemp_colorxy, }, { + zigbeeModel: ['LCG002'], + model: '929001953101', + vendor: 'Philips', + description: 'Hue White and Color Ambiance GU10', + extend: hue.light_onoff_brightness_colortemp_colorxy, + }, + { zigbeeModel: ['LWA004'], model: '8718699688820', vendor: 'Philips',
Added support for LCG<I> Hue GU<I> White + Color (#<I>) * Added support for LCG<I> Hue GU<I> White + Color * Added support for LCG<I> Hue GU<I> White + Color
Koenkk_zigbee-shepherd-converters
train
js
9c0beaa4c5ad3c0b81c4ea36c91ee3353642b8f8
diff --git a/lib/oneview-sdk/resource/api200/volume.rb b/lib/oneview-sdk/resource/api200/volume.rb index <HASH>..<HASH> 100644 --- a/lib/oneview-sdk/resource/api200/volume.rb +++ b/lib/oneview-sdk/resource/api200/volume.rb @@ -123,7 +123,7 @@ module OneviewSDK # @return [true] if snapshot was created successfully def delete_snapshot(name) result = get_snapshot(name) - response = @client.rest_delete(result['uri'], { 'If-Match' => @data['eTag'] }, @api_version) + response = @client.rest_delete(result['uri'], { 'If-Match' => result['eTag'] }, @api_version) @client.response_handler(response) true end
Resolving issue with removing snapshot as etag doesnot match
HewlettPackard_oneview-sdk-ruby
train
rb
22fbfd72911b6d3af9afa5e79b30f533f7a62fa5
diff --git a/spec/high_chart_spec.rb b/spec/high_chart_spec.rb index <HASH>..<HASH> 100644 --- a/spec/high_chart_spec.rb +++ b/spec/high_chart_spec.rb @@ -22,11 +22,11 @@ describe "HighChart" do it "should take an optional 'placeholder' argument" do LazyHighCharts::HighChart.new(@placeholder).placeholder.should == @placeholder LazyHighCharts::HighChart.new.placeholder.should == nil - end + end it "should take an optional html_options argument (defaulting to 300px height)" do LazyHighCharts::HighChart.new(@html_options).placeholder.should == @html_options - end + end it "should set options by default" do LazyHighCharts::HighChart.new.options.should == { @@ -51,7 +51,7 @@ describe "HighChart" do :credits=>{:enabled=>false} } - end + end it "should set data empty by default" do LazyHighCharts::HighChart.new.data.should == []
merging xiaods branch fro gem support
michelson_lazy_high_charts
train
rb
7b190e6a2be0ae339049d1afafb4d99d7bf98c0a
diff --git a/value.go b/value.go index <HASH>..<HASH> 100644 --- a/value.go +++ b/value.go @@ -36,6 +36,11 @@ func (v *Value) IsString() bool { return v.getResolvedValue().Kind() == reflect.String } +// Checks whether the underlying value is a bool +func (v *Value) IsBool() bool { + return v.getResolvedValue().Kind() == reflect.Bool +} + // Checks whether the underlying value is a float func (v *Value) IsFloat() bool { return v.getResolvedValue().Kind() == reflect.Float32 ||
Value.IsBool() added
flosch_pongo2
train
go
91e002e31eb50329a5936dab3286b41571868653
diff --git a/activesupport/lib/active_support/callbacks.rb b/activesupport/lib/active_support/callbacks.rb index <HASH>..<HASH> 100644 --- a/activesupport/lib/active_support/callbacks.rb +++ b/activesupport/lib/active_support/callbacks.rb @@ -120,13 +120,12 @@ module ActiveSupport end end - def clone(chain) - obj = super() - obj.chain = chain - obj.options = @options.dup - obj.options[:if] = @options[:if].dup - obj.options[:unless] = @options[:unless].dup - obj + def initialize_copy(other) + super + @options = { + :if => other.options[:if].dup, + :unless => other.options[:unless].dup + } end def normalize_options!(options) @@ -493,7 +492,8 @@ module ActiveSupport filter = chain.find {|c| c.matches?(type, filter) } if filter && options.any? - new_filter = filter.clone(chain) + new_filter = filter.dup + new_filter.chain = chain chain.insert(chain.index(filter), new_filter) new_filter.recompile!(options) end
dup the callback and set the chain
rails_rails
train
rb
f258de49c1a6080c1f1209e28ce9d08c77749982
diff --git a/fastimport/commands.py b/fastimport/commands.py index <HASH>..<HASH> 100644 --- a/fastimport/commands.py +++ b/fastimport/commands.py @@ -382,6 +382,20 @@ class FileDeleteAllCommand(FileCommand): def __repr__(self): return "deleteall" +class NoteModifyCommand(FileCommand): + + def __init__(self, from_, data): + super(NoteModifyCommand, self).__init__('notemodify') + self.from_ = from_ + self.data = data + self._binary = ['data'] + + def __str__(self): + return "N inline :%s" % self.from_ + + def __repr__(self): + return "%s\ndata %d\n%s" % (self, len(self.data), self.data) + def check_path(path): """Check that a path is legal.
Add NoteModify command No parsing support, but can at least be used to generate a note and attach it to a commit.
jelmer_python-fastimport
train
py
a26aa501df52aa99c95ab4dbd747158418593ba3
diff --git a/karma-base.conf.js b/karma-base.conf.js index <HASH>..<HASH> 100644 --- a/karma-base.conf.js +++ b/karma-base.conf.js @@ -74,7 +74,8 @@ module.exports = config => { width: 768, webPreferences: { pageVisibility: true - } + }, + flags: ['--no-sandbox'] }, // If browser does not capture in given timeout [ms], kill it
add '--no-sandbox' flag for electron since it is now required when running under root
JetBrains_ring-ui
train
js
24f2e657df2b06b9c59a431df3877410b5f69f35
diff --git a/src/main/java/io/github/lukehutch/fastclasspathscanner/utils/LogNode.java b/src/main/java/io/github/lukehutch/fastclasspathscanner/utils/LogNode.java index <HASH>..<HASH> 100644 --- a/src/main/java/io/github/lukehutch/fastclasspathscanner/utils/LogNode.java +++ b/src/main/java/io/github/lukehutch/fastclasspathscanner/utils/LogNode.java @@ -70,7 +70,7 @@ public class LogNode { private static AtomicInteger sortKeyUniqueSuffix = new AtomicInteger(0); /** The date/time formatter (not threadsafe). */ - private static final SimpleDateFormat dateTimeFormatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mmX"); + private static final SimpleDateFormat dateTimeFormatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZZ"); /** The elapsed time formatter. */ private static final DecimalFormat nanoFormatter = new DecimalFormat("0.000000");
Add seconds and milliseconds to log timestamp
classgraph_classgraph
train
java
ab6e899c7e3151f693d7ccf2d559c8b2c933629d
diff --git a/extensions/mentions/src/Listener/AddPostMentionedByRelationship.php b/extensions/mentions/src/Listener/AddPostMentionedByRelationship.php index <HASH>..<HASH> 100755 --- a/extensions/mentions/src/Listener/AddPostMentionedByRelationship.php +++ b/extensions/mentions/src/Listener/AddPostMentionedByRelationship.php @@ -142,6 +142,10 @@ class AddPostMentionedByRelationship } if (isset($posts)) { + $posts = array_filter($posts, function ($post) { + return is_object($post); + }); + $ids = []; // Once we have the posts, construct a list of the IDs of all of
Fix fatal error when viewing a discussion with multiple pages of posts
flarum_core
train
php
c4c35a25aac9bc2fcb2778a51f5dcdeea54dc579
diff --git a/tests/utils/test_config_utils.py b/tests/utils/test_config_utils.py index <HASH>..<HASH> 100644 --- a/tests/utils/test_config_utils.py +++ b/tests/utils/test_config_utils.py @@ -197,7 +197,7 @@ def test_update_config(monkeypatch): 'database': {'host': 'test-host', 'name': 'bigchaindb', 'port': 28015} } monkeypatch.setattr('bigchaindb.config_utils.file_config', lambda *args, **kwargs: file_config) - config_utils.autoconfigure() + config_utils.autoconfigure(config=file_config) # update configuration, retaining previous changes config_utils.update_config({'database': {'port': 28016, 'name': 'bigchaindb_other'}}) @@ -205,4 +205,3 @@ def test_update_config(monkeypatch): assert bigchaindb.config['database']['host'] == 'test-host' assert bigchaindb.config['database']['name'] == 'bigchaindb_other' assert bigchaindb.config['database']['port'] == 28016 -
Fix #<I> (#<I>)
bigchaindb_bigchaindb
train
py
a3cd451931f4f1b4d6400d2e34d88042ae789a16
diff --git a/gwpy/tests/test_plotter.py b/gwpy/tests/test_plotter.py index <HASH>..<HASH> 100644 --- a/gwpy/tests/test_plotter.py +++ b/gwpy/tests/test_plotter.py @@ -249,6 +249,8 @@ class TimeSeriesPlotTestCase(TimeSeriesMixin, PlotTestCase): for ax in fig.axes: self.assertEqual(len(ax.lines), 1) self.assertIs(fig.axes[1]._sharex, fig.axes[0]) + # test kwarg parsing + fig = self.FIGURE_CLASS(self.ts, figsize=[12, 6], rasterized=True) def test_add_colorbar(self): def make_fig():
tests: added regression test for bug #<I>
gwpy_gwpy
train
py