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
|
---|---|---|---|---|---|
397b717ea601aaa4c2c9e503cbfc957b569bf636 | diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -70,6 +70,7 @@ setup(
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
+ 'Programming Language :: Python :: 3.6',
'Environment :: Console',
'Intended Audience :: End Users/Desktop', | added python <I> support | DC23_scriptabit | train | py |
3de2668ad61b59db9aad5aabcf37d4db85b06498 | diff --git a/server/src/main/java/io/atomix/copycat/server/state/ServerSession.java b/server/src/main/java/io/atomix/copycat/server/state/ServerSession.java
index <HASH>..<HASH> 100644
--- a/server/src/main/java/io/atomix/copycat/server/state/ServerSession.java
+++ b/server/src/main/java/io/atomix/copycat/server/state/ServerSession.java
@@ -521,7 +521,6 @@ class ServerSession implements Session {
resendEvents(response.version(), response.sequence());
}
}
- request.release();
});
} | Don't release PublishRequest after publishing session events as it is automatically released. | atomix_copycat | train | java |
80b637ac0db61068920ae462d57d7d086ec814b4 | diff --git a/examples/attiny85.js b/examples/attiny85.js
index <HASH>..<HASH> 100644
--- a/examples/attiny85.js
+++ b/examples/attiny85.js
@@ -46,11 +46,9 @@ var bootload = function(cb){
}
function close(){
- return when.promise(function(resolve, reject) {
- tinyAVR.close(function(err){
- if(err){ return reject(err); }
- return resolve();
- });
+ return when.promise(function(resolve) {
+ tinyAVR.close();
+ return resolve();
});
}
@@ -216,4 +214,7 @@ var bootload = function(cb){
}), cb);
};
-bootload(console.log.bind(console));
+bootload(function(error){
+ if(error) { console.log(error); }
+ console.log('Success');
+}); | close doesnt have a callback | jacobrosenthal_usbtinyisp | train | js |
4dc649fd2241f72194b10c9f6606855d5a2b0738 | diff --git a/lib/deploy/update-stack-step.js b/lib/deploy/update-stack-step.js
index <HASH>..<HASH> 100644
--- a/lib/deploy/update-stack-step.js
+++ b/lib/deploy/update-stack-step.js
@@ -129,7 +129,7 @@ function updateStack(context) {
CF.updateStack({
StackName: existingStack.StackId,
- TemplateBody: JSON.stringify(stackCF),
+ TemplateBody: JSON.stringify(stackCF, null, 4),
Parameters: parameters,
Capabilities: [
'CAPABILITY_IAM'
@@ -159,12 +159,12 @@ function updateStack(context) {
CF.createStack({
StackName: stackName,
- TemplateBody: JSON.stringify(stackCF),
+ TemplateBody: JSON.stringify(stackCF, null, 4),
Parameters: parameters,
Capabilities: [
'CAPABILITY_IAM'
],
- OnFailure: 'ROLLBACK'
+ OnFailure: 'DO_NOTHING'
}, function(err, result) {
if (err) {
console.log(' ✖'.red); | Improve template appearance on CF
Also, make sure to leave any failures as they are when creating a new stack to ease with debugging. | Testlio_lambda-tools | train | js |
a1840c1805a5735d9e6e9de355e5eec5e9ce3e63 | diff --git a/src/test/java/com/turn/ttorrent/client/network/ConnectionManagerTest.java b/src/test/java/com/turn/ttorrent/client/network/ConnectionManagerTest.java
index <HASH>..<HASH> 100644
--- a/src/test/java/com/turn/ttorrent/client/network/ConnectionManagerTest.java
+++ b/src/test/java/com/turn/ttorrent/client/network/ConnectionManagerTest.java
@@ -77,6 +77,7 @@ public class ConnectionManagerTest {
while (serverPort < ConnectionManager.PORT_RANGE_END) {
try {
socket.connect(new InetSocketAddress("127.0.0.1", serverPort));
+ if (socket.isConnected()) break;
} catch (ConnectException ignored) {}
serverPort++;
} | fixed reconnection when socket is connected | mpetazzoni_ttorrent | train | java |
72bb1185bccdde77011f1c8330744b1f82070ea5 | diff --git a/src/events.js b/src/events.js
index <HASH>..<HASH> 100644
--- a/src/events.js
+++ b/src/events.js
@@ -106,6 +106,8 @@ module.exports = function(ctx) {
};
function changeMode(modename, nextModeOptions, eventOptions = {}) {
+ if (modename === currentModeName) return;
+
currentMode.stop();
var modebuilder = modes[modename]; | Disallow modechanges that do not actually change the mode | mapbox_mapbox-gl-draw | train | js |
e3cb1c5b35c626b352629af700d5d5ef871a8a84 | diff --git a/openquake/hazardlib/gsim/climent_1994.py b/openquake/hazardlib/gsim/climent_1994.py
index <HASH>..<HASH> 100644
--- a/openquake/hazardlib/gsim/climent_1994.py
+++ b/openquake/hazardlib/gsim/climent_1994.py
@@ -1,5 +1,5 @@
# The Hazard Library
-# Copyright (C) 2013 GEM Foundation
+# Copyright (C) 2014 GEM Foundation
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as | Update climent_<I>.py | gem_oq-engine | train | py |
715d74a53103c40454c1492eecd05aa7bef06bbb | diff --git a/Configuration/Configurator.php b/Configuration/Configurator.php
index <HASH>..<HASH> 100644
--- a/Configuration/Configurator.php
+++ b/Configuration/Configurator.php
@@ -20,6 +20,7 @@ class Configurator
{
private $backendConfig = array();
private $entitiesConfig = array();
+ private $inspector;
private $reflector;
private $defaultEntityFields = array(); | Declare a private property used by the Configurator class | EasyCorp_EasyAdminBundle | train | php |
e3d6d10e1ff669430c3d8678c196c52397c850ea | diff --git a/activemodel/lib/active_model/serializers/json.rb b/activemodel/lib/active_model/serializers/json.rb
index <HASH>..<HASH> 100644
--- a/activemodel/lib/active_model/serializers/json.rb
+++ b/activemodel/lib/active_model/serializers/json.rb
@@ -10,6 +10,8 @@ module ActiveModel
include ActiveModel::Attributes
included do
+ extend ActiveModel::Naming
+
cattr_accessor :include_root_in_json, :instance_writer => false
end
diff --git a/activemodel/test/cases/json_serialization_test.rb b/activemodel/test/cases/json_serialization_test.rb
index <HASH>..<HASH> 100644
--- a/activemodel/test/cases/json_serialization_test.rb
+++ b/activemodel/test/cases/json_serialization_test.rb
@@ -2,7 +2,6 @@ require 'cases/helper'
class JsonSerializationTest < ActiveModel::TestCase
class Contact
- extend ActiveModel::Naming
include ActiveModel::Serializers::JSON
attr_accessor :name, :age, :created_at, :awesome, :preferences
end | Ensure JSON serializer includes model naming | rails_rails | train | rb,rb |
9d35196cca0e82df58bffffc3f7621646d7114d3 | diff --git a/cmd/torrent/main.go b/cmd/torrent/main.go
index <HASH>..<HASH> 100644
--- a/cmd/torrent/main.go
+++ b/cmd/torrent/main.go
@@ -98,6 +98,9 @@ func addTorrents(client *torrent.Client) {
log.Fatal(err)
}
return t
+ } else if strings.HasPrefix(arg, "infohash:") {
+ t, _ := client.AddTorrentInfoHash(metainfo.NewHashFromHex(strings.TrimPrefix(arg, "infohash:")))
+ return t
} else {
metaInfo, err := metainfo.LoadFromFile(arg)
if err != nil { | cmd/torrent: Accept infohash: scheme torrents | anacrolix_torrent | train | go |
b47702d4b1faac1af86aa9ee271db281061deb68 | diff --git a/Lib/fontbakery/specifications/googlefonts_test.py b/Lib/fontbakery/specifications/googlefonts_test.py
index <HASH>..<HASH> 100644
--- a/Lib/fontbakery/specifications/googlefonts_test.py
+++ b/Lib/fontbakery/specifications/googlefonts_test.py
@@ -2235,3 +2235,24 @@ def test_id_164():
ttFont['name'].names[i].string = bad_entry.encode(entry.getEncoding())
status, message = list(test(ttFont))[-1]
assert status == FAIL
+
+
+def test_id_165():
+ """ Familyname is unique according to namecheck.fontdata.com """
+ from fontbakery.specifications.googlefonts import com_google_fonts_test_165 as test
+
+ print('Test INFO with an already used name...')
+ # We dont FAIL because this is meant as a merely informative check
+ # There may be frequent cases when fonts are being updated and thus
+ # already have a public family name registered on the
+ # namecheck.fontdata.com database.
+ ttFont = TTFont("data/test/cabin/Cabin-Regular.ttf")
+ status, message = list(test(ttFont))[-1]
+ assert status == INFO
+
+ print('Test PASS with a unique family name...')
+ # Here we know that FamilySans has not been (and will not be)
+ # registered as a real family.
+ ttFont = TTFont("data/test/familysans/FamilySans-Regular.ttf")
+ status, message = list(test(ttFont))[-1]
+ assert status == PASS | pytest: test/<I> (Familyname is unique according to...
... namecheck.fontdata.com)
(issue #<I>) | googlefonts_fontbakery | train | py |
9b9106ef7fd81e678a3456a6a8910339cdb72a92 | diff --git a/qtpylib/algo.py b/qtpylib/algo.py
index <HASH>..<HASH> 100644
--- a/qtpylib/algo.py
+++ b/qtpylib/algo.py
@@ -359,7 +359,10 @@ class Algo(Broker):
% of trailing stop distance from current price
ticksize : float
If using traling stop, pass the tick size for the instruments so you won't try to buy ES at 2200.128230 :)
-
+ fillorkill: bool
+ fill entire quantiry or none at all
+ iceberg: bool
+ is this an iceberg (hidden) order
"""
if signal.upper() == "EXIT" or signal.upper() == "FLATTEN":
position = self.get_positions(symbol)
diff --git a/qtpylib/instrument.py b/qtpylib/instrument.py
index <HASH>..<HASH> 100644
--- a/qtpylib/instrument.py
+++ b/qtpylib/instrument.py
@@ -136,6 +136,10 @@ class Instrument(str):
% of trailing stop distance from current price
ticksize : float
If using traling stop, pass the tick size for the instruments so you won't try to buy ES at 2200.128230 :)
+ fillorkill: bool
+ fill entire quantiry or none at all
+ iceberg: bool
+ is this an iceberg (hidden) order
"""
self.parent.order(direction.upper(), self, quantity, **kwargs) | exposed support for FillOrKill and Iceberg orders | ranaroussi_qtpylib | train | py,py |
568ea3f7ab6412ca32ca2a2e6de55baed2e72000 | diff --git a/pages/db/migrate/20110329222114_attach_seo_meta.rb b/pages/db/migrate/20110329222114_attach_seo_meta.rb
index <HASH>..<HASH> 100644
--- a/pages/db/migrate/20110329222114_attach_seo_meta.rb
+++ b/pages/db/migrate/20110329222114_attach_seo_meta.rb
@@ -12,7 +12,10 @@ class AttachSeoMeta < ActiveRecord::Migration
end
# Reset column information because otherwise the old columns will still exist.
- ::Refinery::Page.translation_class.reset_column_information
+ [::Refinery::Page, ::Refinery::Page.translation_class].each do |model|
+ ActiveRecord::Base.connection.schema_cache.clear_table_cache!(model.table_name)
+ model.reset_column_information
+ end
# Re-attach seo_meta
::Refinery::Page.translation_class.send :is_seo_meta | Completely clear table cache after messing with meta information. | refinery_refinerycms | train | rb |
88856b765c91e212c96669342d897e8dd334183d | diff --git a/src/TestSuite/IntegrationTestTrait.php b/src/TestSuite/IntegrationTestTrait.php
index <HASH>..<HASH> 100644
--- a/src/TestSuite/IntegrationTestTrait.php
+++ b/src/TestSuite/IntegrationTestTrait.php
@@ -674,7 +674,7 @@ trait IntegrationTestTrait
$token = $middleware->createToken();
} elseif (isset($this->_cookie['csrfToken'])) {
$token = $this->_cookie['csrfToken'];
- } elseif (isset($this->_session['csrfToken'])) {
+ } else {
$token = $this->_session['csrfToken'];
} | Fix condition to appease psalm | cakephp_cakephp | train | php |
189ddc5d063ab59f561b186ee3f3c06646d9d0cc | diff --git a/tests/test_timedated.py b/tests/test_timedated.py
index <HASH>..<HASH> 100644
--- a/tests/test_timedated.py
+++ b/tests/test_timedated.py
@@ -52,13 +52,15 @@ class TestTimedated(dbusmock.DBusTestCase):
def test_default_timezone(self):
out = self.run_timedatectl()
- self.assertRegex(out, 'Timezone: Etc/Utc \(GMT, \+0000\)')
+ # timedatectl doesn't get the timezone offset information over dbus so
+ # we can't mock that.
+ self.assertRegex(out, 'Timezone: Etc/Utc')
def test_changing_timezone(self):
self.obj_timedated.SetTimezone('Africa/Johannesburg', False)
out = self.run_timedatectl()
- # timedatectl doesn't get the timezone information over dbus so we
- # can't mock that.
+ # timedatectl doesn't get the timezone offset information over dbus so
+ # we can't mock that.
self.assertRegex(out, 'Timezone: Africa/Johannesburg')
def test_default_ntp(self): | Don't test the timezone offset in the Etc/Utc case either | martinpitt_python-dbusmock | train | py |
90d17b6bdf70dd8019eb869a2ae53f0a744940a4 | diff --git a/lib/data_mapper/adapters/data_objects_adapter.rb b/lib/data_mapper/adapters/data_objects_adapter.rb
index <HASH>..<HASH> 100644
--- a/lib/data_mapper/adapters/data_objects_adapter.rb
+++ b/lib/data_mapper/adapters/data_objects_adapter.rb
@@ -60,7 +60,11 @@ module DataMapper
def close_connection(connection)
connection.close unless within_transaction?
end
-
+
+ def create_with_returning?
+ false
+ end
+
# all of our CRUD
# Methods dealing with a single instance object
def create(repository, instance)
@@ -68,7 +72,7 @@ module DataMapper
properties = instance.class.properties(name).select { |property| dirty_attributes.key?(property.name) }
connection = create_connection
- sql = create_statement(instance.class, properties)
+ sql = send(create_with_returning? ? :create_statement_with_returning : :create_statement, instance.class, properties)
values = properties.map { |property| dirty_attributes[property.name] }
DataMapper.logger.debug { "CREATE: #{sql} PARAMETERS: #{values.inspect}" } | Added simple switch to use returning syntax. | datamapper_dm-core | train | rb |
e300fd99ae2d0a4717e576bcddd606b46aa8b484 | diff --git a/website/pages/en/index.js b/website/pages/en/index.js
index <HASH>..<HASH> 100755
--- a/website/pages/en/index.js
+++ b/website/pages/en/index.js
@@ -222,6 +222,9 @@ const Querying = props => {
<div className="blockContentHighlight">
<MarkdownBlock>{sh`http get :8080/user \$limit==2 \$sort==email \$embed==role`}</MarkdownBlock>
</div>
+ <MarkdownBlock>
+ (Using [httpie](https://httpie.org/))
+ </MarkdownBlock>
</span>
</div>
</div> | - Added reference to httpie | JKHeadley_rest-hapi | train | js |
566ca024ab405888efe61e2fdd9184e45385d7de | diff --git a/colab/super_archives/models.py b/colab/super_archives/models.py
index <HASH>..<HASH> 100644
--- a/colab/super_archives/models.py
+++ b/colab/super_archives/models.py
@@ -45,10 +45,12 @@ class EmailAddressValidation(models.Model):
@classmethod
def verify_email(cls, email_address_validation, verification_url):
- email.send_verification_email(email_address_validation.address,
- email_address_validation.user,
- email_address_validation.validation_key,
- verification_url)
+ return email.send_verification_email(
+ email_address_validation.address,
+ email_address_validation.user,
+ email_address_validation.validation_key,
+ verification_url
+ )
class EmailAddress(models.Model): | Made sending verification email return status
It returns whether the email was sent or not. | colab_colab | train | py |
5ac74ea5c502d844ea6b71bdf465c4377bd41fa6 | diff --git a/pyapns/server.py b/pyapns/server.py
index <HASH>..<HASH> 100644
--- a/pyapns/server.py
+++ b/pyapns/server.py
@@ -50,7 +50,10 @@ class IAPNSService(Interface):
class APNSClientContextFactory(ClientContextFactory):
def __init__(self, ssl_cert_file):
- log.msg('APNSClientContextFactory ssl_cert_file=%s' % ssl_cert_file)
+ if 'BEGIN CERTIFICATE' not in ssl_cert_file:
+ log.msg('APNSClientContextFactory ssl_cert_file=%s' % ssl_cert_file)
+ else:
+ log.msg('APNSClientContextFactory ssl_cert_file={FROM_STRING}')
self.ctx = SSL.Context(SSL.SSLv3_METHOD)
if 'BEGIN CERTIFICATE' in ssl_cert_file:
cer = crypto.load_certificate(crypto.FILETYPE_PEM, ssl_cert_file) | address #<I> - do not log the pem file | samuraisam_pyapns | train | py |
2925e486b4c498555782edfb506a727dd5707726 | diff --git a/src/Illuminate/Support/ServiceProvider.php b/src/Illuminate/Support/ServiceProvider.php
index <HASH>..<HASH> 100755
--- a/src/Illuminate/Support/ServiceProvider.php
+++ b/src/Illuminate/Support/ServiceProvider.php
@@ -113,7 +113,12 @@ abstract class ServiceProvider {
if ($group)
{
- static::$publishGroups[$group] = $paths;
+ if ( ! array_key_exists($group, static::$publishGroups))
+ {
+ static::$publishGroups[$group] = [];
+ }
+
+ static::$publishGroups[$group] = array_merge(static::$publishGroups[$group], $paths);
}
}
@@ -126,6 +131,19 @@ abstract class ServiceProvider {
*/
public static function pathsToPublish($provider = null, $group = null)
{
+ if ($provider and $group)
+ {
+ if (empty(static::$publishes[$provider]))
+ {
+ return [];
+ }
+ if (empty(static::$publishGroups[$group]))
+ {
+ return [];
+ }
+ return array_intersect(static::$publishes[$provider], static::$publishGroups[$group]);
+ }
+
if ($group && array_key_exists($group, static::$publishGroups))
{
return static::$publishGroups[$group]; | Bugfix for Support: ServiceProvider
- method publish() - merging tagged (marked with group) paths with already registered ones
- method pathsToPublish() - added support for selecting by both provider and group | laravel_framework | train | php |
68ab344bfce754b08a31798c05da83ffcc13a4da | diff --git a/client/deis.py b/client/deis.py
index <HASH>..<HASH> 100755
--- a/client/deis.py
+++ b/client/deis.py
@@ -492,8 +492,10 @@ class DeisClient(object):
name for the application.
"""
app = args.get('--app')
+ delete_remote = False
if not app:
app = self._session.app
+ delete_remote = True
confirm = args.get('--confirm')
if confirm == app:
pass
@@ -520,8 +522,9 @@ class DeisClient(object):
requests.codes.not_found):
self._logger.info('done in {}s'.format(int(time.time() - before)))
try:
- # If the requested app is a heroku app, delete the git remote
- if self._session.is_git_app():
+ # If the requested app is a heroku app and the app
+ # was inferred from session, delete the git remote
+ if self._session.is_git_app() and delete_remote:
subprocess.check_call(
['git', 'remote', 'rm', 'deis'],
stdout=subprocess.PIPE, stderr=subprocess.PIPE) | fix(client): avoid git remote deletion for apps specified by -a | deis_deis | train | py |
f38ea583870f9c4649a720eebfebefa3b7181d8b | diff --git a/heron/tracker/src/python/handlers/basehandler.py b/heron/tracker/src/python/handlers/basehandler.py
index <HASH>..<HASH> 100644
--- a/heron/tracker/src/python/handlers/basehandler.py
+++ b/heron/tracker/src/python/handlers/basehandler.py
@@ -49,7 +49,7 @@ class BaseHandler(tornado.web.RequestHandler):
now = time.time()
spent = now - self.basehandler_starttime
response[constants.RESPONSE_KEY_EXECUTION_TIME] = spent
- self.write(tornado.escape.json_encode(response))
+ self.write_json_response(response)
def write_error_response(self, message):
"""
@@ -60,7 +60,11 @@ class BaseHandler(tornado.web.RequestHandler):
now = time.time()
spent = now - self.basehandler_starttime
response[constants.RESPONSE_KEY_EXECUTION_TIME] = spent
+ self.write_json_response(response)
+
+ def write_json_response(self, response):
self.write(tornado.escape.json_encode(response))
+ self.set_header("Content-Type", "application/json")
def make_response(self, status):
""" | Set correct response type HTTP header for tracker (#<I>) | apache_incubator-heron | train | py |
cc195c44dc83d0c3b6a59a3f39ebf7999342c570 | diff --git a/distributions.py b/distributions.py
index <HASH>..<HASH> 100644
--- a/distributions.py
+++ b/distributions.py
@@ -8,6 +8,7 @@ import scipy.stats as stats
import scipy.special as special
import matplotlib.pyplot as plt
import abc
+import copy
from warnings import warn
from abstractions import Distribution, GibbsSampling,\
@@ -172,6 +173,12 @@ class Gaussian(_GaussianBase, GibbsSampling, MeanField, Collapsed, MaxLikelihood
self._mu_mf, self._sigma_mf = self.mu, self.sigma = \
sample_niw(*self._posterior_hypparams(*self._get_statistics(data,self.D)))
+ def copy_sample(self):
+ new = copy.copy(self)
+ new.mu = self.mu.copy()
+ new.sigma = self.sigma.copy()
+ return new
+
### Mean Field
# NOTE my sumsq is Bishop's Nk*Sk | added Gaussian.copy_sample() | mattjj_pybasicbayes | train | py |
45eab8452eb724e302e7254bce82a0b6f804afbd | diff --git a/statistics.php b/statistics.php
index <HASH>..<HASH> 100644
--- a/statistics.php
+++ b/statistics.php
@@ -405,8 +405,6 @@ if (!$ajax) {
</table>
</fieldset>';
} else if ($tab==3) {
- require_once WT_ROOT.'includes/functions/functions_places.php';
-
echo '<fieldset>
<legend>', WT_I18N::translate('Create your own chart'), '</legend>';
?> | Remove old "require_once" for functions_places.php | fisharebest_webtrees | train | php |
72d61d11b23bbf8fd484b683cb1afb971c199aed | diff --git a/lib/mia-js.js b/lib/mia-js.js
index <HASH>..<HASH> 100644
--- a/lib/mia-js.js
+++ b/lib/mia-js.js
@@ -49,7 +49,7 @@ function MiaJs() {
* @returns {*}
* @private
*/
- var _initApplication = function () {
+ var _initApplication = async function () {
Shared.initialize('/config', process.argv[2]);
Shared.setAppHttp(appHttp);
Shared.setAppHttps(appHttps);
@@ -59,7 +59,7 @@ function MiaJs() {
var memcached = Shared.memcached();
// Init redis cache
- var redis = Shared.redis(true);
+ var redis = await Shared.redis(true);
//Enable gzip compression
appHttp.use(compression()); | added promise await to redis init on startup | mia-js_mia-js-core | train | js |
6373fd93345740fc045eab648524bcbb65c3e690 | diff --git a/prometheus/histogram_test.go b/prometheus/histogram_test.go
index <HASH>..<HASH> 100644
--- a/prometheus/histogram_test.go
+++ b/prometheus/histogram_test.go
@@ -119,6 +119,28 @@ func BenchmarkHistogramWrite8(b *testing.B) {
benchmarkHistogramWrite(8, b)
}
+func TestHistogramNonMonotonicBuckets(t *testing.T) {
+ testCases := map[string][]float64{
+ "not strictly monotonic": {1, 2, 2, 3},
+ "not monotonic at all": {1, 2, 4, 3, 5},
+ "have +Inf in the middle": {1, 2, math.Inf(+1), 3},
+ }
+ for name, buckets := range testCases {
+ func() {
+ defer func() {
+ if r := recover(); r == nil {
+ t.Errorf("Buckets %v are %s but NewHistogram did not panic.", buckets, name)
+ }
+ }()
+ _ = NewHistogram(HistogramOpts{
+ Name: "test_histogram",
+ Help: "helpless",
+ Buckets: buckets,
+ })
+ }()
+ }
+}
+
// Intentionally adding +Inf here to test if that case is handled correctly.
// Also, getCumulativeCounts depends on it.
var testBuckets = []float64{-2, -1, -0.5, 0, 0.5, 1, 2, math.Inf(+1)} | Adding a test for non-monotonic buckets | prometheus_client_golang | train | go |
f0590f4278e865e8ff953d05c634ca4f70d08a66 | diff --git a/cmd/ping.go b/cmd/ping.go
index <HASH>..<HASH> 100644
--- a/cmd/ping.go
+++ b/cmd/ping.go
@@ -200,12 +200,17 @@ func (p *pingCommand) chart() string {
return p.times[i] < p.times[j]
})
- latest := p.times[len(p.times)-1]
+ ftimes := make([]int64, len(p.times))
+ for i, d := range p.times {
+ ftimes[i] = d.Milliseconds()
+ }
+
+ latest := ftimes[len(ftimes)-1]
bcount := int(latest/50) + 1
buckets := make([]float64, bcount)
- for _, t := range p.times {
- b := t / 50.0
+ for _, t := range ftimes {
+ b := t / 50
buckets[int(b)]++
} | (#<I>) fix ping graph rendering | choria-io_go-choria | train | go |
7856b6b37d7b1e084978b8e1796160a4cb0b620c | diff --git a/src/grid/CurrencyColumn.php b/src/grid/CurrencyColumn.php
index <HASH>..<HASH> 100644
--- a/src/grid/CurrencyColumn.php
+++ b/src/grid/CurrencyColumn.php
@@ -66,7 +66,7 @@ class CurrencyColumn extends DataColumn
$url = $this->getUrl($model, $key, $index);
$txt = Yii::$app->formatter->format($value, ['currency', $model->currency]);
- $ops = ['class' => 'text-' . $this->getColor($color)];
+ $ops = ['class' => 'text-nowrap text-' . $this->getColor($color)];
return $url ? Html::a($txt, $url, $ops) : Html::tag('span', $txt, $ops);
}
} | fixed minus sign wrapping in CurrencyColumn with text-nowrap | hiqdev_hipanel-core | train | php |
e635c8d271ed77830ce69b4e35494d982e862eef | diff --git a/Model/Newsletter/Observer.php b/Model/Newsletter/Observer.php
index <HASH>..<HASH> 100755
--- a/Model/Newsletter/Observer.php
+++ b/Model/Newsletter/Observer.php
@@ -100,7 +100,7 @@ class Observer
$client->deleteAddressBookContact( $this->_helper->getSubscriberAddressBook( $websiteId ), $contactId );
}
$contactEmail->setIsSubscriber(null)
- ->setSubscriberStatus(Mage_Newsletter_Model_Subscriber::STATUS_UNSUBSCRIBED);
+ ->setSubscriberStatus(\Magento\Newsletter\Model\Subscriber::STATUS_UNSUBSCRIBED);
}
//add subscriber to automation | #<I> Mage_ not found | dotmailer_dotmailer-magento2-extension | train | php |
a523ef756bac4b51626a1f6b5d8604770782ae2d | diff --git a/code/libraries/koowa/libraries/template/filter/form.php b/code/libraries/koowa/libraries/template/filter/form.php
index <HASH>..<HASH> 100644
--- a/code/libraries/koowa/libraries/template/filter/form.php
+++ b/code/libraries/koowa/libraries/template/filter/form.php
@@ -140,7 +140,7 @@ class KTemplateFilterForm extends KTemplateFilterAbstract
protected function _addQueryParameters(&$text)
{
$matches = array();
- if (preg_match_all('#<form.*action=".*\?(.*)".*method="get".*>(.*)</form>#isU', $text, $matches))
+ if (preg_match_all('#<form.*action="[^"]*\?(.*)".*method="get".*>(.*)</form>#isU', $text, $matches))
{
foreach ($matches[1] as $key => $query)
{ | Fixed regular expression.
Avoid query match from going out of the action property. | joomlatools_joomlatools-framework | train | php |
a1eb57fbf3544686d393807478ceb0e38531f874 | diff --git a/src/Operation/Search.php b/src/Operation/Search.php
index <HASH>..<HASH> 100644
--- a/src/Operation/Search.php
+++ b/src/Operation/Search.php
@@ -60,8 +60,10 @@ class Search implements SearchInterface
/** @var \Psr\Cache\CacheItemInterface $value */
foreach ($cacheItemGenerator as $key => $value) {
- $itemData = $value->get();
- $fieldDiff = array_diff($fieldList, array_keys($itemData));
+ $itemData = $value->get();
+ $itemFieldList = is_array($itemData) ? array_keys($itemData) : [];
+ $fieldDiff = array_diff($fieldList, $itemFieldList);
+
if (!is_null($itemData) && !$fieldDiff) {
$data[] = $value;
continue; | Fixed issue: array_keys error in search operation | picamator_CacheManager | train | php |
0f3ccbc4929310a25f3f4ccd20e5b6f0f2b34876 | diff --git a/msmbuilder/utils/divergence.py b/msmbuilder/utils/divergence.py
index <HASH>..<HASH> 100644
--- a/msmbuilder/utils/divergence.py
+++ b/msmbuilder/utils/divergence.py
@@ -41,3 +41,20 @@ def symmetric_kl_divergence(target, ref, i):
def js_divergence(target, ref, i):
return np.array([_jsd(ref[i],t) for t in target])
+
+
+def _make_square(mat):
+ n_states = np.sqrt(len(mat))
+ return mat.reshape(n_states, n_states)
+
+
+def kl_divergence_msm(target, ref, i):
+ return kl_divergence(_make_square(target), _make_square(ref), i)
+
+
+def symmetric_kl_divergence_msm(target, ref, i):
+ return symmetric_kl_divergence(_make_square(target), _make_square(ref), i)
+
+
+def js_divergence_msm(target, ref, i):
+ return js_divergence(_make_square(target), _make_square(ref), i) | update for flattened msm | msmbuilder_msmbuilder | train | py |
b2c6402dc13c4769ce80326aa1de6aac49b32278 | diff --git a/framework/messages/de/yii.php b/framework/messages/de/yii.php
index <HASH>..<HASH> 100644
--- a/framework/messages/de/yii.php
+++ b/framework/messages/de/yii.php
@@ -201,7 +201,7 @@ return array (
'{attribute} is not a valid URL.' => '{attribute} ist keine gültige URL.',
'{attribute} is not a valid email address.' => '{attribute} ist keine gültige E-Mail-Adresse.',
'{attribute} is not in the list.' => '{attribute} ist nicht in der Liste.',
- '{attribute} is of the wrong length (should be {length} characters).' => '{attribut} hat die falsche Länge (Es sollten {length} Zeichen sein).',
+ '{attribute} is of the wrong length (should be {length} characters).' => '{attribute} hat die falsche Länge (Es sollten {length} Zeichen sein).',
'{attribute} is too big (maximum is {max}).' => '{attribute} ist zu groß (Maximum ist {max}).',
'{attribute} is too long (maximum is {max} characters).' => '{attribute} ist zu lang (Maximal {max} Zeichen).',
'{attribute} is too short (minimum is {min} characters).' => '{attribute} ist zu kurz (Mindestens {min} Zeichen).', | (Fixes issue <I>) | yiisoft_yii | train | php |
240d1d52abc5a48b8b66a1efe968b7763e99aef5 | diff --git a/juju/conn.go b/juju/conn.go
index <HASH>..<HASH> 100644
--- a/juju/conn.go
+++ b/juju/conn.go
@@ -91,11 +91,7 @@ func (c *Conn) updateSecrets() error {
// in the state with the local secrets. To fix this properly
// we need to ensure that the config, minus secrets, is always
// pushed on bootstrap, then we can fill in the secrets here.
- secrets, err := c.Environ.Provider().SecretAttrs(cfg)
- if err != nil {
- return err
- }
- env.Update(secrets)
+ env.Update(cfg.AllAttrs())
n, err := env.Write()
if err != nil {
return err | Push the entire environment when conn.State is called.
This is a poor substitute for the more sophisticated version which will
pass the non sensitive keys on bootstrap. | juju_juju | train | go |
15d283509a5de12d96dae7eb7eb7a9bf690e3690 | diff --git a/src/main/org/codehaus/groovy/transform/stc/StaticTypeCheckingSupport.java b/src/main/org/codehaus/groovy/transform/stc/StaticTypeCheckingSupport.java
index <HASH>..<HASH> 100644
--- a/src/main/org/codehaus/groovy/transform/stc/StaticTypeCheckingSupport.java
+++ b/src/main/org/codehaus/groovy/transform/stc/StaticTypeCheckingSupport.java
@@ -1832,9 +1832,9 @@ public abstract class StaticTypeCheckingSupport {
scanner.scanClasspathModules();
cachedMethods = getDGMMethods(modules);
origin = new WeakReference<ClassLoader>(loader);
+ lock.readLock().lock();
} finally {
lock.writeLock().unlock();
- lock.readLock().lock();
}
}
try { | GROOVY-<I>: Fixed possible infinite wait during extension module scanning if an error occurs during contruction of the meta-model of a class | apache_groovy | train | java |
2b5ef2df22a25ba4f35f0f451455ff679b636792 | diff --git a/index.js b/index.js
index <HASH>..<HASH> 100644
--- a/index.js
+++ b/index.js
@@ -95,7 +95,7 @@ function difflet (opts, prev, next) {
set('updated');
}
- if (opts.diff && !Array.isArray(prevNode)) {
+ if (opts.comment && !Array.isArray(prevNode)) {
indent = 0;
}
@@ -122,7 +122,7 @@ function difflet (opts, prev, next) {
}
var prev = prevNode && prevNode[child.key];
- if (indent && opts.diff && child.node !== prev
+ if (indent && opts.comment && child.node !== prev
&& (typeof child.node !== 'object' || typeof prev !== 'object')
) {
set('comment'); | now calling it opts.comment | substack_difflet | train | js |
ce9a0a24fd99387d532ad6ae705772b11f71aeb6 | diff --git a/dotsite/getch.py b/dotsite/getch.py
index <HASH>..<HASH> 100644
--- a/dotsite/getch.py
+++ b/dotsite/getch.py
@@ -259,5 +259,9 @@ def yield_asciis_old():
yield k
-if __name__ == '__main__':
- show_get_key()
+def ask_user(prompt, default=None):
+ prompt_default = str('[%s]' % default) if default else ''
+ print '%s %s? ' % (prompt, prompt_default),
+ result = getch().lower().strip()
+ print
+ return result or default | Add method to ask user a question | jalanb_pysyte | train | py |
8e4ba233b07a15f2046d2f7a7fb208f275478f0a | diff --git a/bin/gulp-dynamic-routing.js b/bin/gulp-dynamic-routing.js
index <HASH>..<HASH> 100644
--- a/bin/gulp-dynamic-routing.js
+++ b/bin/gulp-dynamic-routing.js
@@ -47,7 +47,10 @@ module.exports = function(options) {
});
if (options.angular) {
- content = "angular.module('foundation.dynamicRouting').config(" +
+ content = "angular.module('base.dynamicRouting').config(" +
+ "['$FoundationStateProvider', function(FoundationStateProvider)" +
+ "{ FoundationStateProvider.registerDynamicRoutes(" + JSON.stringify(configs) + "); }]); \n";
+ content += "angular.module('foundation.dynamicRouting').config(" +
"['$FoundationStateProvider', function(FoundationStateProvider)" +
"{ FoundationStateProvider.registerDynamicRoutes(" + JSON.stringify(configs) + "); }]); \n";
} else { | export routes using base.dynamicRouting | base-apps_angular-base-apps | train | js |
60e614b10ce31bf84b43efd06d77d47991c39bf0 | diff --git a/script/cpplint.py b/script/cpplint.py
index <HASH>..<HASH> 100755
--- a/script/cpplint.py
+++ b/script/cpplint.py
@@ -38,6 +38,10 @@ SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
def main():
+ if not os.path.isfile(cpplint_path()):
+ print("[INFO] Skipping cpplint, dependencies has not been bootstrapped")
+ return
+
os.chdir(SOURCE_ROOT)
atom_files = list_files('atom',
['app', 'browser', 'common', 'renderer', 'utility'],
@@ -60,9 +64,13 @@ def list_files(parent, directories, filters):
def call_cpplint(files):
- cpplint = os.path.join(SOURCE_ROOT, 'vendor', 'depot_tools', 'cpplint.py')
+ cpplint = cpplint_path()
execute([sys.executable, cpplint] + files)
+def cpplint_path():
+ return os.path.join(SOURCE_ROOT, 'vendor', 'depot_tools', 'cpplint.py')
+
+
if __name__ == '__main__':
sys.exit(main()) | cpplint skip to run if dependencies has not been bootstrapped
See #<I> for the discussion regarding this | electron_electron | train | py |
10429947bedf4dea907ccca8994b3a4180079bcf | diff --git a/consensus/poet/sgx/setup.py b/consensus/poet/sgx/setup.py
index <HASH>..<HASH> 100644
--- a/consensus/poet/sgx/setup.py
+++ b/consensus/poet/sgx/setup.py
@@ -166,6 +166,7 @@ setup(name='sawtooth-poet-sgx',
install_requires=[
'toml',
'ecdsa',
+ 'sawtooth-ias-client',
'sawtooth-poet-common'
],
ext_modules=[enclavemod], | Fix sawtooth-poet-sgx package to be dependent upon sawtooth-ias-client | hyperledger_sawtooth-core | train | py |
955d02cbca6f5b5cc4a80819bb6176605e04d609 | diff --git a/string.php b/string.php
index <HASH>..<HASH> 100644
--- a/string.php
+++ b/string.php
@@ -3,5 +3,5 @@
function string_starts_with($haystack, $needle)
{
$length = strlen($needle);
- return ((substr($haystack, 0, $length) === $needle);
+ return (substr($haystack, 0, $length) === $needle);
} | Fixed extra paren that was causing syntax error. | giant-rabbit_php-util | train | php |
0f3fe34802dd3f6103cca820b320d29d53d416b1 | diff --git a/src/component.js b/src/component.js
index <HASH>..<HASH> 100644
--- a/src/component.js
+++ b/src/component.js
@@ -63,6 +63,10 @@ export default function getComponentClass() {
}
addSubcomponent(subcomponent) {
+ if (subcomponent.parent !== this) {
+ throw new Error(`Subcomponent has different parent`);
+ }
+
let subcomponentName = subcomponent.name;
if (this.state.__subcomponents.hasOwnProperty(subcomponentName)) {
diff --git a/test/componentTest.js b/test/componentTest.js
index <HASH>..<HASH> 100644
--- a/test/componentTest.js
+++ b/test/componentTest.js
@@ -387,6 +387,18 @@ test('Component', function (t) {
t.end();
});
+ t.test('with wrong parent', function (t) {
+ t.test('should throw error', function (t) {
+ t.throws(function () {
+ subcomponent.addSubcomponent(anotherSubcomponent);
+ }, /Subcomponent has different parent/);
+
+ t.end();
+ });
+
+ t.end();
+ });
+
t.end();
}); | Component: addSubcomponent: Check if I am the parent | kuraga_rotorjs | train | js,js |
3c5faaea32808f060dd6c617933a60b89c561a3d | diff --git a/lib/evendoors/particle.rb b/lib/evendoors/particle.rb
index <HASH>..<HASH> 100644
--- a/lib/evendoors/particle.rb
+++ b/lib/evendoors/particle.rb
@@ -45,7 +45,9 @@ module EvenDoors
#
def add_dsts paths
paths.split(EvenDoors::LINK_SEP).each do |path|
- @dsts << path.sub(/^\/+/,'').sub(/\/+$/,'').gsub(/\/{2,}/,'/').gsub(/\s+/,'')
+ d = path.sub(/^\/+/,'').sub(/\/+$/,'').gsub(/\/{2,}/,'/').gsub(/\s+/,'')
+ next if d.empty? or d==EvenDoors::ACT_SEP
+ @dsts << d
end
end
#
@@ -58,8 +60,7 @@ module EvenDoors
#
def split_dst!
@dst = @room = @door = @action = nil
- n = next_dst
- return if n.nil? or n.empty? or n==EvenDoors::ACT_SEP
+ return if (n = next_dst).nil?
p, @action = n.split EvenDoors::ACT_SEP
i = p.rindex EvenDoors::PATH_SEP
if i.nil? | Particle: do not accept empty destinations | jeremyz_edoors-ruby | train | rb |
9a6491566a8f0e43a887b3f9f7663f9d005d4955 | diff --git a/spinoff/tests/actor_test.py b/spinoff/tests/actor_test.py
index <HASH>..<HASH> 100644
--- a/spinoff/tests/actor_test.py
+++ b/spinoff/tests/actor_test.py
@@ -10,7 +10,7 @@ import weakref
from nose.tools import eq_, ok_, set_trace
from nose.twistedtools import deferred
-from twisted.internet.defer import Deferred, inlineCallbacks, DeferredQueue, fail, CancelledError, DebugInfo
+from twisted.internet.defer import Deferred, inlineCallbacks, DeferredQueue, fail, CancelledError, DebugInfo, returnValue
from twisted.internet.task import Clock
from spinoff.actor import (
@@ -2792,6 +2792,16 @@ def test_process_run_is_a_coroutine():
assert step2_reached
+def test_warning_is_emitted_if_process_run_returns_a_value():
+ class ProcThatReturnsValue(Process):
+ def run(self):
+ yield
+ returnValue('foo')
+
+ with assert_one_warning():
+ spawn(ProcThatReturnsValue)
+
+
def test_process_run_is_paused_and_unpaused_if_the_actor_is_suspended_and_resumed():
release = Trigger()
after_release = Latch() | Added test for when a process foolishly returns a value | eallik_spinoff | train | py |
95e6e471a63513292e62da77620d30ce18e40909 | diff --git a/mangopay/resources.py b/mangopay/resources.py
index <HASH>..<HASH> 100644
--- a/mangopay/resources.py
+++ b/mangopay/resources.py
@@ -531,7 +531,8 @@ class RecurringPayInCIT(RecurringPayIn):
verbose_name = 'recurring_payin'
verbose_name_plural = 'recurring_payins'
url = {
- InsertQuery.identifier: '/payins/recurring/card/direct'
+ InsertQuery.identifier: '/payins/recurring/card/direct',
+ SelectQuery.identifier: '/payins'
}
@python_2_unicode_compatible
@@ -545,7 +546,8 @@ class RecurringPayInMIT(RecurringPayIn):
verbose_name = 'recurring_payin'
verbose_name_plural = 'recurring_payins'
url = {
- InsertQuery.identifier: '/payins/recurring/card/direct'
+ InsertQuery.identifier: '/payins/recurring/card/direct',
+ SelectQuery.identifier: '/payins'
}
@python_2_unicode_compatible | MPSDK-<I>: fixed this issue | Mangopay_mangopay2-python-sdk | train | py |
aafeb37d2bca75bb301a6b2f44e9ffea956c798f | diff --git a/delphi/program_analysis/autoTranslate/scripts/genPGM.py b/delphi/program_analysis/autoTranslate/scripts/genPGM.py
index <HASH>..<HASH> 100755
--- a/delphi/program_analysis/autoTranslate/scripts/genPGM.py
+++ b/delphi/program_analysis/autoTranslate/scripts/genPGM.py
@@ -711,7 +711,6 @@ def genPgm(node, state, fnNames):
if "var" in src:
source_list.append(src["var"]["variable"])
elif "call" in src:
- source_list.append(src["call"]["function"])
for ip in src["call"]["inputs"][0]:
if "var" in ip:
source_list.append(ip["var"]["variable"]) | Removing functions as arguments to lambda functions | ml4ai_delphi | train | py |
610a5fb7f779d360c52fb8444c72bac08a39ec02 | diff --git a/lib/pipe.js b/lib/pipe.js
index <HASH>..<HASH> 100644
--- a/lib/pipe.js
+++ b/lib/pipe.js
@@ -74,7 +74,7 @@
function getBody(readStream, callback) {
var sended, body = '';
- assert(readStram, 'could not be empty!');
+ assert(readStream, 'could not be empty!');
assert(callback, 'could not be empty!');
readStream.on('data', function(chunk) { | fix(pipe) getBody: readstram -> readStream | coderaiser_pipe-io | train | js |
f9d54331d274aceb8a8b24f36f8f5de79a7ad38a | diff --git a/src/Jobs/Form/Import.php b/src/Jobs/Form/Import.php
index <HASH>..<HASH> 100644
--- a/src/Jobs/Form/Import.php
+++ b/src/Jobs/Form/Import.php
@@ -70,7 +70,7 @@ class Import extends Form
}
return parent::setData($data);
- }
+ } | [General] jet another phpcbf commit | yawik_jobs | train | php |
b9f54c62060f7552e6615812e7653f38878dabec | diff --git a/test/HardwareSource_test.py b/test/HardwareSource_test.py
index <HASH>..<HASH> 100644
--- a/test/HardwareSource_test.py
+++ b/test/HardwareSource_test.py
@@ -1,5 +1,6 @@
import datetime
import logging
+import threading
import time
import unittest
@@ -50,6 +51,7 @@ class ScanHardwareSource(HardwareSource.HardwareSource):
self.top = True
self.scanning = False
self.suspended = False
+ self.suspend_event = threading.Event()
self.channel_count = 2
self.channel_ids = ["a", "b"]
self.channel_names = ["A", "B"]
@@ -116,6 +118,7 @@ class ScanHardwareSource(HardwareSource.HardwareSource):
def suspend_acquisition(self):
self.suspended = True
+ self.suspend_event.set()
def resume_acquisition(self):
self.suspended = False
@@ -411,7 +414,7 @@ class TestHardwareSourceClass(unittest.TestCase):
# now start recording
hardware_source.sleep = 0.06
hardware_source.start_recording()
- time.sleep(0.04) # give recording a chance to start
+ hardware_source.suspend_event.wait(3.0)
self.assertTrue(hardware_source.suspended)
start_time = time.time()
while hardware_source.is_recording: | Make test for view suspend during record more robust.
svn r<I> | nion-software_nionswift | train | py |
a642d0cf5baec5c307992e1d5f80e3b2c3e56f79 | diff --git a/generator/lib/builder/om/ExtensionQueryBuilder.php b/generator/lib/builder/om/ExtensionQueryBuilder.php
index <HASH>..<HASH> 100644
--- a/generator/lib/builder/om/ExtensionQueryBuilder.php
+++ b/generator/lib/builder/om/ExtensionQueryBuilder.php
@@ -169,7 +169,10 @@ class ".$this->getClassname()." extends $baseClassname {
if (\$criteria instanceof " . $this->getClassname() . ") {
return \$criteria;
}
- \$query = new self('" . $this->getTable()->getDatabase()->getName() . "', '" . $this->getTable()->getPhpName() . "', \$modelAlias);
+ \$query = new self();
+ if (null !== \$modelAlias) {
+ \$query->setModelalias(\$modelAlias);
+ }
if (\$criteria instanceof Criteria) {
\$query->mergeWith(\$criteria);
} | [<I>] Removed hardcoded database connection name in stub query factory (closes #<I>) | propelorm_Propel | train | php |
99aaf537197b8f652780cbbb16fb2090e448ecc5 | diff --git a/tmuxp/__about__.py b/tmuxp/__about__.py
index <HASH>..<HASH> 100644
--- a/tmuxp/__about__.py
+++ b/tmuxp/__about__.py
@@ -1,6 +1,6 @@
__title__ = 'tmuxp'
__package_name__ = 'tmuxp'
-__version__ = '1.7.0a3'
+__version__ = '1.8.0'
__description__ = 'tmux session manager'
__email__ = '[email protected]'
__author__ = 'Tony Narlock' | increment minor version to <I> | tmux-python_tmuxp | train | py |
ebe03d768760a0b1a3fde74de09a3d069ef8cd1b | diff --git a/cmd/minikube/cmd/delete_test.go b/cmd/minikube/cmd/delete_test.go
index <HASH>..<HASH> 100644
--- a/cmd/minikube/cmd/delete_test.go
+++ b/cmd/minikube/cmd/delete_test.go
@@ -117,6 +117,7 @@ func TestDeleteProfile(t *testing.T) {
t.Logf("load failure: %v", err)
}
+ DeleteHostAndDirectoriesGetter = DeleteHostAndDirectoriesMock
errs := DeleteProfiles([]*config.Profile{profile})
if len(errs) > 0 {
HandleDeletionErrors(errs) | Added Mock to DeleteProfile Test. | kubernetes_minikube | train | go |
176487b1efce587c397370a2b75c4aad3ab4a7d9 | diff --git a/graylog2-server/src/main/java/org/graylog2/plugin/DocsHelper.java b/graylog2-server/src/main/java/org/graylog2/plugin/DocsHelper.java
index <HASH>..<HASH> 100644
--- a/graylog2-server/src/main/java/org/graylog2/plugin/DocsHelper.java
+++ b/graylog2-server/src/main/java/org/graylog2/plugin/DocsHelper.java
@@ -19,7 +19,7 @@ package org.graylog2.plugin;
public enum DocsHelper {
PAGE_SENDING_JSONPATH("sending_data.html#json-path-from-http-api-input"),
PAGE_ES_CONFIGURATION("configuring_es.html"),
- PAGE_LDAP_TROUBLESHOOTING("users_and_roles.html#troubleshooting");
+ PAGE_LDAP_TROUBLESHOOTING("users_and_roles/external_auth.html#troubleshooting");
private static final String DOCS_URL = "http://docs.graylog.org/en/"; | Really use correct link to Users & Roles docs
Refs c<I>ff6f<I>ec5fdfdd0e2f7c5baa<I>f7af7f6
(cherry picked from commit b<I>c0fc4c<I>dd<I>cf<I>b<I>ee<I>f<I>) | Graylog2_graylog2-server | train | java |
cedffd31679e4375c55846bbe23f2b52d306af4a | diff --git a/belpy/statements.py b/belpy/statements.py
index <HASH>..<HASH> 100644
--- a/belpy/statements.py
+++ b/belpy/statements.py
@@ -380,22 +380,22 @@ class Complex(Statement):
def __init__(self, members):
self.members = members
- def monomers(self, model):
+ def monomers(self, model, agent_set):
"""In this (very simple) implementation, proteins in a complex are
each given site names corresponding to each of the other members
of the complex. So the resulting complex is "fully connected" in
that each is specified as bound to all the others."""
for gene_name in self.members:
- gene_mono = get_create_monomer(model, gene_name)
+ gene_mono = agent_set.get_create_agent(gene_name)
# Specify a binding site for each of the other complex members
# bp = abbreviation for "binding partner"
for bp_name in self.members:
# The protein doesn't bind to itself!
if gene_name == bp_name:
continue
- create_site(gene_mono, bp_name)
+ gene_mono.create_site(bp_name)
- def assemble(self, model):
+ def assemble(self, model, agent_set):
# Get the rate parameter
try:
kf_bind = model.parameters['kf_bind'] | Updated monomers/assemble for Complex stmt | sorgerlab_indra | train | py |
15f2e564436ebd04fd6ed7c02c1ce2284f4860f0 | diff --git a/Form/Badge/Tool/BadgeRuleType.php b/Form/Badge/Tool/BadgeRuleType.php
index <HASH>..<HASH> 100644
--- a/Form/Badge/Tool/BadgeRuleType.php
+++ b/Form/Badge/Tool/BadgeRuleType.php
@@ -1,5 +1,14 @@
<?php
+/*
+ * This file is part of the Claroline Connect package.
+ *
+ * (c) Claroline Consortium <[email protected]>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
namespace Claroline\CoreBundle\Form\Badge\Tool;
use Claroline\CoreBundle\Entity\Badge\BadgeRule;
diff --git a/Form/Badge/Tool/BadgeType.php b/Form/Badge/Tool/BadgeType.php
index <HASH>..<HASH> 100644
--- a/Form/Badge/Tool/BadgeType.php
+++ b/Form/Badge/Tool/BadgeType.php
@@ -1,5 +1,14 @@
<?php
+/*
+ * This file is part of the Claroline Connect package.
+ *
+ * (c) Claroline Consortium <[email protected]>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
namespace Claroline\CoreBundle\Form\Badge\Tool;
use Claroline\CoreBundle\Form\Badge\BadgeTranslationType; | [CoreBundle] Adding missing license information | claroline_Distribution | train | php,php |
93527fe379d52dbf54fab164d9ea535748b1f006 | diff --git a/test/middleware/consumer-pipeline.tests.js b/test/middleware/consumer-pipeline.tests.js
index <HASH>..<HASH> 100644
--- a/test/middleware/consumer-pipeline.tests.js
+++ b/test/middleware/consumer-pipeline.tests.js
@@ -36,7 +36,7 @@ describe('ConsumerPipeline', function() {
});
it('should call middleware function once when it is given one', function(done){
consumerPipeline.use(simpleMiddleware);
- consumerPipeline.execute(message).then(() => {
+ consumerPipeline.execute(message).then(function() {
expect(message.properties.headers.length).to.equal(1);
expect(message.properties.headers[0]).to.equal('first: true');
done(); | Don't use lambdas yet since our builder doesn't support them | twindagger_magicbus | train | js |
e597daa7dacf818ec1923800a07648a5994cb23d | diff --git a/test/test_wordcloud.py b/test/test_wordcloud.py
index <HASH>..<HASH> 100644
--- a/test/test_wordcloud.py
+++ b/test/test_wordcloud.py
@@ -230,3 +230,9 @@ def test_generate_from_frequencies():
result = wc.generate_from_frequencies(words)
assert_true(isinstance(result, WordCloud))
+
+
+def test_relative_scaling_zero():
+ # non-regression test for non-integer font size
+ wc = WordCloud(relative_scaling=0)
+ wc.generate(THIS)
diff --git a/wordcloud/wordcloud.py b/wordcloud/wordcloud.py
index <HASH>..<HASH> 100644
--- a/wordcloud/wordcloud.py
+++ b/wordcloud/wordcloud.py
@@ -404,7 +404,7 @@ class WordCloud(object):
max_font_size=self.height)
# find font sizes
sizes = [x[1] for x in self.layout_]
- font_size = 2 * sizes[0] * sizes[1] / (sizes[0] + sizes[1])
+ font_size = int(2 * sizes[0] * sizes[1] / (sizes[0] + sizes[1]))
else:
font_size = max_font_size | fix relative_scaling=0 issue | amueller_word_cloud | train | py,py |
7fc1a04d641dc7e357aa2b51cc188dbe25e72b16 | diff --git a/classes/Sledge/Chunk/Linkset.php b/classes/Sledge/Chunk/Linkset.php
index <HASH>..<HASH> 100644
--- a/classes/Sledge/Chunk/Linkset.php
+++ b/classes/Sledge/Chunk/Linkset.php
@@ -29,8 +29,6 @@ class Sledge_Chunk_Linkset extends Chunk
public function has_content()
{
- $links = $this->_chunk->links();
-
- return ! empty($links);
+ return $this->_chunk->links->count_all() > 0;
}
}
\ No newline at end of file | Fixed call to deleted function Model_Chunk::links() | boomcms_boom-core | train | php |
42d1f237d5f76636052be26b38310f13c1a78df2 | diff --git a/plugins/ScheduledReports/API.php b/plugins/ScheduledReports/API.php
index <HASH>..<HASH> 100644
--- a/plugins/ScheduledReports/API.php
+++ b/plugins/ScheduledReports/API.php
@@ -478,7 +478,7 @@ class API extends \Piwik\Plugin\API
$reportRenderer->setReport($report);
// render report
- $description = str_replace(array("\r", "\n"), ' ', $report['description']);
+ $description = str_replace(array("\r", "\n"), ' ', Common::unsanitizeInputValue($report['description']));
list($reportSubject, $reportTitle) = self::getReportSubjectAndReportTitle(Common::unsanitizeInputValue(Site::getNameFor($idSite)), $report['reports']); | unsantisize report description to prevent double encoding (#<I>) | matomo-org_matomo | train | php |
b926cebaa8489eddedda98eedaf1580c01e6b4a8 | diff --git a/lib/parse_resource/base.rb b/lib/parse_resource/base.rb
index <HASH>..<HASH> 100644
--- a/lib/parse_resource/base.rb
+++ b/lib/parse_resource/base.rb
@@ -276,7 +276,16 @@ module ParseResource
@@settings ||= begin
path = "config/parse_resource.yml"
environment = defined?(Rails) && Rails.respond_to?(:env) ? Rails.env : ENV["RACK_ENV"]
- YAML.load(ERB.new(File.new(path).read).result)[environment]
+ if FileTest.exist? (path)
+ YAML.load(ERB.new(File.new(path).read).result)[environment]
+ elsif ENV['app_id'] && ENV['master_key']
+ settings = HashWithIndifferentAccess.new
+ settings['app_id'] = ENV['app_id']
+ settings['master_key'] = ENV['master_key']
+ settings
+ else
+ raise "Cannot load parse_resource.yml and API keys are not set in environment"
+ end
end
@@settings
end | Look for api keys in ENV if parse_resource.yml not present | adelevie_parse_resource | train | rb |
493a99a207dad166e72d2b18572615515eb911f4 | diff --git a/SpiffWorkflow/serializer/dict.py b/SpiffWorkflow/serializer/dict.py
index <HASH>..<HASH> 100644
--- a/SpiffWorkflow/serializer/dict.py
+++ b/SpiffWorkflow/serializer/dict.py
@@ -145,6 +145,7 @@ class DictionarySerializer(Serializer):
s_state['inputs'] = [t.id for t in spec.inputs]
s_state['outputs'] = [t.id for t in spec.outputs]
s_state['data'] = self.serialize_dict(spec.data)
+ s_state['position'] = self.serialize_dict(spec.position)
if hasattr(spec,'lane'):
s_state['lane'] = spec.lane
@@ -174,6 +175,7 @@ class DictionarySerializer(Serializer):
if 'lane' in s_state.keys():
spec.lane = s_state.get('lane',None)
spec.defines = self.deserialize_dict(s_state.get('defines', {}))
+ spec.position = self.deserialize_dict(s_state.get('position', {}))
spec.pre_assign = self.deserialize_list(s_state.get('pre_assign', []))
spec.post_assign = self.deserialize_list(
s_state.get('post_assign', [])) | Needed to serialize the position variable so that nav_list gets the same ordering when deserializing | knipknap_SpiffWorkflow | train | py |
0a804793e662d7fa6f5c8d2e7cfe742646277754 | diff --git a/past/tests/test_translation.py b/past/tests/test_translation.py
index <HASH>..<HASH> 100644
--- a/past/tests/test_translation.py
+++ b/past/tests/test_translation.py
@@ -83,7 +83,6 @@ class TestTranslate(unittest.TestCase):
module = self.write_and_import(code, 'execer')
self.assertEqual(module.x, 7)
- @expectedFailurePY3
def test_div(self):
code = """
x = 3 / 2 | Mark test_div() in past.tests.test_translation as now working on Py3
- past.translation feature now understands "3 / 2" in Py2 code as integer
division. | PythonCharmers_python-future | train | py |
2a6ed2ec8ad8fc8b3090e547066d046b5cb6f9c3 | diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -26,15 +26,18 @@ setup(
'static/js/*',
],
},
- #install_requires=[
+ install_requires=[
+ # Django, Scrapy and Celery requirements are commented out here and have
+ # to be installed manually to avoid side-effects when updating the software.
+ # Version numbers are updated accordingly though.
# 'Django>=1.7,<1.9',
# 'Scrapy>=0.22.0,<0.25',
# 'scrapyd',
- # 'jsonpath-rw>=1.4',
+ 'jsonpath-rw>=1.4',
# 'django-celery==3.1.16', # Scheduling
- # 'future>=0.15,<0.16',
- # 'pillow',
- #],
+ 'future>=0.15,<0.16',
+ 'pillow',
+ ],
classifiers=[
'Development Status :: 4 - Beta',
'Environment :: Web Environment', | Un-comment the unproblematic requirements in setup.py | holgerd77_django-dynamic-scraper | train | py |
4900beb3c7fbf14931a5b7833a305cffa5cceb28 | diff --git a/resources/js/controllers/listener_controller.js b/resources/js/controllers/listener_controller.js
index <HASH>..<HASH> 100644
--- a/resources/js/controllers/listener_controller.js
+++ b/resources/js/controllers/listener_controller.js
@@ -44,7 +44,15 @@ export default class extends ApplicationController {
}
}));
- this.asyncLoadData(params);
+ this.asyncLoadData(params).then(() => {
+ document.dispatchEvent(
+ new CustomEvent("orchid:listener:after-render", {
+ detail: {
+ params: params,
+ },
+ })
+ );
+ });
}
/**
@@ -57,7 +65,7 @@ export default class extends ApplicationController {
return;
}
- window.axios.post(this.data.get('async-route'), params, {
+ return window.axios.post(this.data.get('async-route'), params, {
headers: {
'ORCHID-ASYNC-REFERER': window.location.href,
}, | Add a custom event orchid:listener:post-render (#<I>)
* Add a custom event orchid:listener:post-render
Add a custom event triggered when listener has finished updating the elements
* changed event name | orchidsoftware_platform | train | js |
f6e1cfa180fdf2b54a77451cfb665fecc1ee2c7d | diff --git a/index.js b/index.js
index <HASH>..<HASH> 100644
--- a/index.js
+++ b/index.js
@@ -36,6 +36,13 @@ function apply(options, compiler) {
} else {
done();
}
+ }).catch(function(e) {
+ if (options.failOnError && errors.length) {
+ done(new Error('Failed because of a stylelint error.\n'));
+ } else {
+ done();
+ }
+ console.log(chalk.red(e));
});
compilation.plugin && compilation.plugin('compilation', function(compilation) {
diff --git a/lib/linter.js b/lib/linter.js
index <HASH>..<HASH> 100644
--- a/lib/linter.js
+++ b/lib/linter.js
@@ -6,7 +6,6 @@ function lint(options) {
stylelint.lint(options).then(function(data) {
resolve(data);
}).catch(function(e) {
- console.log(e);
reject(e);
});
}); | fix: don’t break webpack compilation on syntax errors | webpack-contrib_stylelint-webpack-plugin | train | js,js |
387cff88067ff10d4901bb883bebd322604c860a | diff --git a/wallet.js b/wallet.js
index <HASH>..<HASH> 100644
--- a/wallet.js
+++ b/wallet.js
@@ -1294,7 +1294,9 @@ function readTransactionHistory(opts, handleHistory){
db.query(
"SELECT DISTINCT address FROM inputs WHERE unit=? AND "+asset_condition+" ORDER BY address",
[unit],
- function(address_rows){
+ async function (address_rows) {
+ if (address_rows.length === 0 && conf.bLight) // pull from authors then
+ address_rows = await db.query("SELECT address FROM unit_authors WHERE unit=? ORDER BY address", [unit]);
var arrPayerAddresses = address_rows.map(function(address_row){ return address_row.address; });
var arrTransactionsOnUnit = [];
movement.arrMyRecipients.forEach(function(objRecipient){ | get the from addresses from authors for light if not found in inputs | byteball_ocore | train | js |
5b0f5bc676f5a3122ebca9de6a9cdd16c246e2ff | diff --git a/lib/vra/catalog_request.rb b/lib/vra/catalog_request.rb
index <HASH>..<HASH> 100644
--- a/lib/vra/catalog_request.rb
+++ b/lib/vra/catalog_request.rb
@@ -22,7 +22,7 @@ module Vra
attr_writer :subtenant_id
attr_accessor :cpus, :memory, :requested_for, :lease_days, :notes
- def initialize(client, catalog_id, opts)
+ def initialize(client, catalog_id, opts={})
@client = client
@catalog_id = catalog_id
@cpus = opts[:cpus]
@@ -114,6 +114,7 @@ module Vra
end
def submit
+ fetch_catalog_item
validate_params!
begin | catalog_request initialization should allow an empty options array to allow accessor use, and catalog item must be fetched before validating params | chef-partners_vmware-vra-gem | train | rb |
082ec753b5ef42e99982f4eae4cdc04564d76d7d | diff --git a/auth/mnet/auth.php b/auth/mnet/auth.php
index <HASH>..<HASH> 100644
--- a/auth/mnet/auth.php
+++ b/auth/mnet/auth.php
@@ -80,10 +80,13 @@ class auth_plugin_mnet extends auth_plugin_base {
$userdata['session.gc_maxlifetime'] = ini_get('session.gc_maxlifetime');
if (array_key_exists('picture', $userdata) && !empty($user->picture)) {
+ //TODO: rewrite to use new file storage
+ /*
$imagefile = make_user_directory($user->id, true) . "/f1.jpg";
if (file_exists($imagefile)) {
$userdata['imagehash'] = sha1(file_get_contents($imagefile));
}
+ */
}
$userdata['myhosts'] = array(); | MDL-<I> commenting out non-working code - we need to use new file api to get user pix | moodle_moodle | train | php |
a276f145cb98e6384204250e2c7805b035b91adb | diff --git a/mautrix/bridge/commands/handler.py b/mautrix/bridge/commands/handler.py
index <HASH>..<HASH> 100644
--- a/mautrix/bridge/commands/handler.py
+++ b/mautrix/bridge/commands/handler.py
@@ -10,6 +10,7 @@ import logging
import traceback
from mautrix.util import markdown
+from mautrix.util.logging import TraceLogger
from mautrix.types import RoomID, EventID, MessageEventContent
from mautrix.appservice import AppService, IntentAPI
@@ -57,7 +58,7 @@ class CommandEvent:
bridge: 'Bridge'
az: AppService
- log: logging.Logger
+ log: TraceLogger
loop: asyncio.AbstractEventLoop
config: BaseBridgeConfig
processor: 'CommandProcessor'
@@ -324,7 +325,7 @@ def command_handler(_func: Optional[CommandHandlerFunc] = None, *, management_on
class CommandProcessor:
"""Handles the raw commands issued by a user to the Matrix bot."""
- log = logging.getLogger("mau.commands")
+ log: TraceLogger = logging.getLogger("mau.commands")
az: AppService
config: BaseBridgeConfig
loop: asyncio.AbstractEventLoop | Add TraceLogger type hint to command stuff | tulir_mautrix-python | train | py |
8711f3c781657ec6f640678452f3c5ed49bea70b | diff --git a/backbone.js b/backbone.js
index <HASH>..<HASH> 100644
--- a/backbone.js
+++ b/backbone.js
@@ -1399,7 +1399,7 @@
}
// Ensure that we have the appropriate request data.
- if (!options.data && model && (method === 'create' || method === 'update')) {
+ if (options.data == null && model && (method === 'create' || method === 'update')) {
params.contentType = 'application/json';
params.data = JSON.stringify(model.toJSON(options));
} | Fixes #<I> -- allow empty bodies for difficult endpoints. | jashkenas_backbone | train | js |
f45a6db6ceea206f4bfb88c9f839203f406052a0 | diff --git a/lib/validatorRules.spec.js b/lib/validatorRules.spec.js
index <HASH>..<HASH> 100644
--- a/lib/validatorRules.spec.js
+++ b/lib/validatorRules.spec.js
@@ -44,4 +44,19 @@ test('validatorRules', (t) => {
});
});
+ t.test('adb version', (t) => {
+ const checkSystem = setupChecker(
+ { engines: { adb: "1.0.36" } },
+ "Android Debug Bridge version 1.0.36\nRevision 09a0d98bebce-android"
+ );
+
+ checkSystem().then((result) => {
+ t.equal(result.packages[0].name, 'adb');
+ t.equal(result.packages[0].type, 'success');
+ t.equal(result.packages[0].validatorFound, true);
+ t.equal(result.packages[0].expectedVersion, result.packages[0].foundVersion);
+ t.end();
+ });
+ });
+
}); | added a unit tests for the validator | mohlsen_check-engine | train | js |
45b8782080836a40da8381dc6f470c5372d544a1 | diff --git a/src/python/test/test_dxclient.py b/src/python/test/test_dxclient.py
index <HASH>..<HASH> 100755
--- a/src/python/test/test_dxclient.py
+++ b/src/python/test/test_dxclient.py
@@ -3939,6 +3939,8 @@ class TestDXClientFind(DXTestCase):
self.assertIn(category, category_help_workflows)
run("dx find globalworkflows --category foo") # any category can be searched
+ @unittest.skipUnless(testutil.TEST_ISOLATED_ENV,
+ 'skipping test that requires presence of test org and creates global workflows')
def test_dx_find_globalworkflows(self):
org_id = "org-piratelabs"
test_applet_id = dxpy.api.applet_new({"name": "my_find_applet", | Fix a failing test from 9fe<I>fc (#<I>) | dnanexus_dx-toolkit | train | py |
0f40fdb1895b3cccad6b44c32fdfb2fae47e2b32 | diff --git a/test.js b/test.js
index <HASH>..<HASH> 100644
--- a/test.js
+++ b/test.js
@@ -35,6 +35,23 @@ test('payload is returned instead of pattern if it exists', function (t) {
t.deepEqual(instance.lookup(pattern), payload)
})
+test('deep pattern matching', function (t) {
+ t.plan(1)
+
+ var instance = bloomrun()
+ var pattern = { role: 'sum', tnx: { side: 'buy' } }
+ var payload = '1234'
+
+ instance.add(pattern, payload)
+
+ t.deepEqual(instance.lookup({
+ role: 'sum',
+ tnx: {
+ side: 'buy'
+ }
+ }), payload)
+})
+
test('functions are supported as payloads', function (t) {
t.plan(1) | Added test about deep pattern matching. | mcollina_bloomrun | train | js |
655511c5c83aedc214200897719352103cd5d3a0 | diff --git a/src/image/image.js b/src/image/image.js
index <HASH>..<HASH> 100644
--- a/src/image/image.js
+++ b/src/image/image.js
@@ -26,7 +26,7 @@ ImageNode.type = {
ImageNode.example = {
"type": "image",
"id": "image_1",
- "url": "http://elife.elifesciences.org/content/elife/1/e00311/F3.medium.gif"
+ "url": "http://substance.io/image_1.png"
};
// This is used for the auto-generated docs | Shorter image url for example. | substance_nodes | train | js |
ee169a6e3f35241e32a179a8aacfedaa2afd7ae8 | diff --git a/release.py b/release.py
index <HASH>..<HASH> 100755
--- a/release.py
+++ b/release.py
@@ -20,9 +20,9 @@ def check_git():
system("git diff --cached --exit-code")
system("git fetch origin")
- behind = subprocess.check_output(["git", "rev-list", "--count", "master..origin/master"])
- if int(behind) > 0:
- print(f"master is {int(behind)} commits behind origin/master")
+ behind = int(subprocess.check_output(["git", "rev-list", "--count", "master..origin/master"]))
+ if behind > 0:
+ print(f"master is {behind} commit(s) behind origin/master")
sys.exit(1)
def test(): | Simplify release.py (thanks @PedanticHacker, closes #<I>) | niklasf_python-chess | train | py |
09be4ed93656cb2a4bdf160fd500de76348451b3 | diff --git a/src/Composer/Repository/PlatformRepository.php b/src/Composer/Repository/PlatformRepository.php
index <HASH>..<HASH> 100644
--- a/src/Composer/Repository/PlatformRepository.php
+++ b/src/Composer/Repository/PlatformRepository.php
@@ -90,7 +90,7 @@ class PlatformRepository extends ArrayRepository
break;
case 'uuid':
- $prettyVersion = UUID_VERSION;
+ $prettyVersion = phpversion('uuid');
break;
case 'xsl': | PECL-UUID does not define a version constant, so we should use phpversion() to fetch the required information | mothership-ec_composer | train | php |
9c6d5180269b2dc0c7ddee62eb20f2570c99cace | diff --git a/indra/tests/test_pathfinding.py b/indra/tests/test_pathfinding.py
index <HASH>..<HASH> 100644
--- a/indra/tests/test_pathfinding.py
+++ b/indra/tests/test_pathfinding.py
@@ -198,6 +198,22 @@ def test_bfs():
f'got {len(paths)} paths'
assert set(paths) == expected_paths
+ # Test edge_filter and allowed_edges
+ def _alwd_edges(u, v):
+ # Edges should not be reversed!
+ return (u, v) in {('C1', 'D1'), ('B1', 'C1'), ('A1', 'B1')}
+ expected_paths = {('D1', 'C1'), ('D1', 'C1', 'B1'),
+ ('D1', 'C1', 'B1', 'A1')}
+ some_new_gen = bfs_search(g=dg, source_node='D1', depth_limit=5,
+ reverse=True, edge_filter=_filter_func,
+ allow_edge=_alwd_edges, hashes=[123456897],
+ strict_mesh_id_filtering=True)
+ paths = list(some_new_gen)
+ assert len(paths) == len(expected_paths), f'Expected ' \
+ f'{len(expected_paths)}, ' \
+ f'got {len(paths)} paths'
+ assert set(paths) == expected_paths
+
def test_signed_bfs():
seg, sng, all_ns = _setup_signed_graph() | Add test capturing context search and edge filter | sorgerlab_indra | train | py |
c99beeafc6c7f4e92d8c4dabc4d9782964b9684e | diff --git a/lib/display_case/enumerable_exhibit.rb b/lib/display_case/enumerable_exhibit.rb
index <HASH>..<HASH> 100644
--- a/lib/display_case/enumerable_exhibit.rb
+++ b/lib/display_case/enumerable_exhibit.rb
@@ -47,8 +47,8 @@ module DisplayCase
end
# See https://github.com/objects-on-rails/display-case/issues/27
- def to_json
- as_json.to_json
+ def to_json(*args)
+ as_json(*args).to_json(*args)
end
def render(template, options = {}) | closes #<I>: EnumerableExhibit#to_json should accept args | objects-on-rails_display-case | train | rb |
2779a7f5e926d2b753f48d6ce952eb052aa2b1a8 | diff --git a/src/Underscore/Underscore.php b/src/Underscore/Underscore.php
index <HASH>..<HASH> 100644
--- a/src/Underscore/Underscore.php
+++ b/src/Underscore/Underscore.php
@@ -2470,7 +2470,7 @@ class Underscore
if ($max === null)
list($min, $max) = [0, $min];
- return rand($min, $max);
+ return mt_rand($min, $max);
}
/** | Use mt_rand() instead of rand() for better randomness. | bdelespierre_php-underscore | train | php |
3532f171c6be2a4d9dc96a0103fc9ba7be2ff0d0 | diff --git a/lib/suites/draft-04/keywords/anyOf.js b/lib/suites/draft-04/keywords/anyOf.js
index <HASH>..<HASH> 100644
--- a/lib/suites/draft-04/keywords/anyOf.js
+++ b/lib/suites/draft-04/keywords/anyOf.js
@@ -22,7 +22,7 @@ module.exports = function(config) {
if (nestedErrors.length === 0) {
return errors;
} else {
- var key;
+ var key = undefined;
if (Object.prototype.hasOwnProperty.call(config.schema.anyOf[index],
'$ref'))
{
diff --git a/lib/suites/draft-04/keywords/oneOf.js b/lib/suites/draft-04/keywords/oneOf.js
index <HASH>..<HASH> 100644
--- a/lib/suites/draft-04/keywords/oneOf.js
+++ b/lib/suites/draft-04/keywords/oneOf.js
@@ -20,7 +20,7 @@ module.exports = function(config) {
if (nestedErrors.length === 0) {
validAgainst.push(config.resolutionScope + '/oneOf/' + index);
} else {
- var key;
+ var key = undefined;
if (Object.prototype.hasOwnProperty.call(config.schema.oneOf[index],
'$ref'))
{ | fix subschema key being overridden in oneof/anyof keyword | natesilva_jayschema | train | js,js |
f46af4508b6ecc713527b912d0a84039b4990c15 | diff --git a/cmd/geth/js_test.go b/cmd/geth/js_test.go
index <HASH>..<HASH> 100644
--- a/cmd/geth/js_test.go
+++ b/cmd/geth/js_test.go
@@ -175,7 +175,7 @@ func TestBlockChain(t *testing.T) {
defer ethereum.Stop()
// should get current block
- val0, err := repl.re.Run("admin.dumpBlock()")
+ val0, err := repl.re.Run("admin.debug.dumpBlock()")
if err != nil {
t.Errorf("expected no error, got %v", err)
}
@@ -197,7 +197,7 @@ func TestBlockChain(t *testing.T) {
var val1 otto.Value
// should get current block
- val1, err = repl.re.Run("admin.dumpBlock()")
+ val1, err = repl.re.Run("admin.debug.dumpBlock()")
if err != nil {
t.Errorf("expected no error, got %v", err)
} | geth: fixed failing cli tests | ethereum_go-ethereum | train | go |
5da459b95be6708940d1a48e197f1e79a0313920 | diff --git a/watson_developer_cloud/speech_to_text_v1.py b/watson_developer_cloud/speech_to_text_v1.py
index <HASH>..<HASH> 100644
--- a/watson_developer_cloud/speech_to_text_v1.py
+++ b/watson_developer_cloud/speech_to_text_v1.py
@@ -34,7 +34,8 @@ class SpeechToTextV1(WatsonDeveloperCloudService):
word_alternatives_threshold=None,
word_confidence=None, timestamps=None, interim_results=None,
profanity_filter=None,
- smart_formatting=None):
+ smart_formatting=None,
+ speaker_labels=None):
"""
Returns the recognized text from the audio input
"""
@@ -50,7 +51,8 @@ class SpeechToTextV1(WatsonDeveloperCloudService):
'timestamps': timestamps,
'interim_results': interim_results,
'profanity_filter': profanity_filter,
- 'smart_formatting': smart_formatting}
+ 'smart_formatting': smart_formatting,
+ 'speaker_labels': speaker_labels}
return self.request(method='POST', url='/v1/recognize',
headers=headers, | Added speaker_labe param to recognize
Added speaker_labe param to recognize | watson-developer-cloud_python-sdk | train | py |
1bc4b3444a8ca38f0792a725d3f2db301d22eb93 | diff --git a/src/index.js b/src/index.js
index <HASH>..<HASH> 100644
--- a/src/index.js
+++ b/src/index.js
@@ -17,7 +17,7 @@ function SymlinkWebpackPlugin (config = []) {
const originPath = path.join(outputPath, option.origin);
if (fs.existsSync(originPath)) {
- const baseDir = __dirname;
+ const baseDir = process.cwd();
process.chdir(outputPath);
const symlink = path.join(outputPath, option.symlink);
const origin = path.relative(path.dirname(symlink), originPath);
diff --git a/test/index.js b/test/index.js
index <HASH>..<HASH> 100644
--- a/test/index.js
+++ b/test/index.js
@@ -56,4 +56,16 @@ describe('SymlinkWebpackPlugin', () => {
});
});
});
+
+ it('should not pollute process.cwd()', (done) => {
+ const cwd = process.cwd();
+
+ const plugin = new SymlinkWebpackPlugin(
+ [{ origin: 'app.js', symlink: 'symlink.js' }]
+ );
+ webpack(webpackOption(plugin)).run((err, stats) => {
+ expect(process.cwd()).to.eq(cwd);
+ done();
+ });
+ });
}); | restore process.cwd() after symlinking | hmsk_symlink-webpack-plugin | train | js,js |
cd16d3cee6a0395958da294d93ff816c2157a92f | diff --git a/app/assets/javascripts/pageflow/editor/models/page.js b/app/assets/javascripts/pageflow/editor/models/page.js
index <HASH>..<HASH> 100644
--- a/app/assets/javascripts/pageflow/editor/models/page.js
+++ b/app/assets/javascripts/pageflow/editor/models/page.js
@@ -48,7 +48,9 @@ pageflow.Page = Backbone.Model.extend({
},
title: function() {
- return this.configuration.get('title') || this.configuration.get('additional_title');
+ return this.configuration.get('title') ||
+ this.configuration.get('additional_title') ||
+ '';
},
thumbnailFile: function() { | Fix page title hysteresis
On choosing a page link, properly update title when it should be an
empty string. Without this, e.g. in ReferenceInputView, `title` will
not update in certain situations, because page#title() returns
`'undefined'` due to `''` falsiness in Javascript.
To reproduce:
```
this.configuration.get('title') === ''
this.configuration.get('additional_title') === undefined
``` | codevise_pageflow | train | js |
dd028d275f578cfe17629d0053842ddeeb636c7f | diff --git a/jsonerror.go b/jsonerror.go
index <HASH>..<HASH> 100644
--- a/jsonerror.go
+++ b/jsonerror.go
@@ -16,7 +16,7 @@ type JE struct {
//Creates a new JE struct.
//Domain is optional but can be at most 1 string.
-func New(code int, error string, message string, domain ...string) *JE {
+func New(code int, error string, message string, domain ...string) JE {
if len(domain) == 0 {
return &JE{Code: code, error: error, message: message}
} else { | Changed from pointer to struct. | pjebs_jsonerror | train | go |
b8dfeab5dcdc4b1005515d37708efdf97b90ee3f | diff --git a/niworkflows/interfaces/mni.py b/niworkflows/interfaces/mni.py
index <HASH>..<HASH> 100644
--- a/niworkflows/interfaces/mni.py
+++ b/niworkflows/interfaces/mni.py
@@ -355,16 +355,16 @@ class RobustMNINormalization(BaseInterface):
def mask(in_file, mask_file, new_name):
"""
- Applies a binary mask to an image.
+ Apply a binary mask to an image.
Parameters
----------
in_file : str
- Path to a NIfTI file.
+ Path to a NIfTI file to mask
mask_file : str
- Path to a NIfTI file.
+ Path to a binary mask
new_name : str
- Path/filename for the masked output image.
+ Path/filename for the masked output image.
Returns
-------
@@ -436,7 +436,7 @@ def create_cfm(in_file, lesion_mask=None, global_mask=True, out_path=None):
in_img = nb.load(in_file)
# If we want a global mask, create one based on the input image.
- if global_mask is True:
+ if global_mask:
# Create a mask of ones with the shape of the input image.
data = np.ones(in_img.shape, dtype=np.uint8)
else: | STY: Update docstring, check bool implicitly | poldracklab_niworkflows | train | py |
9288a80a0a281733d812ccfe95aed069b3194f8c | diff --git a/lib/Models/KmlCatalogItem.js b/lib/Models/KmlCatalogItem.js
index <HASH>..<HASH> 100644
--- a/lib/Models/KmlCatalogItem.js
+++ b/lib/Models/KmlCatalogItem.js
@@ -143,7 +143,12 @@ KmlCatalogItem.prototype._load = function() {
}
} else if (data instanceof String || typeof data === 'string') {
var parser = new DOMParser();
- var xml = parser.parseFromString(data, 'text/xml');
+ var xml;
+ try {
+ xml = parser.parseFromString(data, 'text/xml');
+ } catch (e) {
+ }
+
if (!xml || !xml.documentElement || xml.getElementsByTagName('parsererror').length > 0) {
errorLoading(that);
} | Fix last failing test in IE<I> and <I>. | TerriaJS_terriajs | train | js |
b76e2cce0fc5b3ff30061daf2e70b40ae8e77ec4 | diff --git a/src/test/java/com/ibm/watson/developer_cloud/service/GenericServiceTest.java b/src/test/java/com/ibm/watson/developer_cloud/service/GenericServiceTest.java
index <HASH>..<HASH> 100644
--- a/src/test/java/com/ibm/watson/developer_cloud/service/GenericServiceTest.java
+++ b/src/test/java/com/ibm/watson/developer_cloud/service/GenericServiceTest.java
@@ -139,6 +139,15 @@ public class GenericServiceTest extends WatsonServiceUnitTest {
}
/**
+ * Test service conflict exception.
+ */
+ @Test(expected = ConflictException.class)
+ public void testConflictException() {
+ mockAPICallWithError(409, "Conflict Exception");
+ service.getProfile(sampleText);
+ }
+
+ /**
* Test too many requests exception.
*/
@Test(expected = TooManyRequestsException.class) | Added test for <I> Conflict Exceptions | watson-developer-cloud_java-sdk | train | java |
71fcf3b1ccf875eee971be5b365fd5f4aad65aaa | diff --git a/lib/waterfall.rb b/lib/waterfall.rb
index <HASH>..<HASH> 100644
--- a/lib/waterfall.rb
+++ b/lib/waterfall.rb
@@ -93,5 +93,6 @@ class Wf
include Waterfall
def initialize
@outflow = OpenStruct.new({})
+ @flowing = true
end
end | a Wf is flowing directly, per construction | apneadiving_waterfall | train | rb |
af8a7ba73fc71714824733e2cf7673c58f4154a9 | diff --git a/lendingclub/filters.py b/lendingclub/filters.py
index <HASH>..<HASH> 100644
--- a/lendingclub/filters.py
+++ b/lendingclub/filters.py
@@ -478,7 +478,7 @@ class SavedFilter(Filter):
self.response = response
json_response = response.json()
- if self.lc.session.json_success(json_response):
+ if self.lc.session.json_success(json_response) and json_response['filterName'] != 'No filters':
self.name = json_response['filterName']
#
@@ -540,6 +540,9 @@ class SavedFilter(Filter):
# Verify valid JSON
try:
+ if json_text.strip() == '':
+ raise SavedFilterError('A saved filter could not be found for ID {0}'.format(self.id), response)
+
json_test = json.loads(json_text)
# Make sure it looks right | Better error handling when a SavedFilter cannot be found. | jgillick_LendingClub | train | py |
4dcbc92496c03fb58e26e6675586f78b11d03062 | diff --git a/pybar/fei4_run_base.py b/pybar/fei4_run_base.py
index <HASH>..<HASH> 100644
--- a/pybar/fei4_run_base.py
+++ b/pybar/fei4_run_base.py
@@ -466,7 +466,7 @@ def interval_timer(interval, func, *args, **kwargs):
return stopped.set
-def namedtuple_with_defaults(typename, field_names, default_values=[]):
+def namedtuple_with_defaults(typename, field_names, default_values=None):
'''
Namedtuple with defaults
@@ -487,6 +487,8 @@ def namedtuple_with_defaults(typename, field_names, default_values=[]):
>>> Node(4)
Node(val=4, left=None, right=7)
'''
+ if default_values is None:
+ default_values = []
T = namedtuple(typename, field_names)
T.__new__.__defaults__ = (None,) * len(T._fields)
if isinstance(default_values, Mapping): | MAINT: no list as default argument | SiLab-Bonn_pyBAR | train | py |
af201763b6e975fe96d95236d0521b75d8599be2 | diff --git a/src/QRCode.php b/src/QRCode.php
index <HASH>..<HASH> 100755
--- a/src/QRCode.php
+++ b/src/QRCode.php
@@ -20,7 +20,7 @@ use chillerlan\QRCode\Output\{
};
use chillerlan\Settings\SettingsContainerInterface;
-use function call_user_func_array, class_exists, in_array, mb_internal_encoding, ord, strlen, strtolower;
+use function call_user_func_array, class_exists, in_array, mb_internal_encoding, ord, strlen, strtolower, str_split;
/**
* Turns a text string into a Model 2 QR Code
@@ -288,10 +288,9 @@ class QRCode{
* checks is a given $string matches the characters of a given $charmap, returns false on the first invalid occurence.
*/
protected function checkString(string $string, array $charmap):bool{
- $len = strlen($string);
- for($i = 0; $i < $len; $i++){
- if(!isset($charmap[$string[$i]])){
+ foreach(str_split($string) as $chr){
+ if(!isset($charmap[$chr])){
return false;
}
} | :shower: clean up QRCode::checkString() | chillerlan_php-qrcode | train | php |
317f2f6c7c72c3aa99694d712e239b18fe8b1e69 | diff --git a/python/dllib/src/test/dev/modules.py b/python/dllib/src/test/dev/modules.py
index <HASH>..<HASH> 100644
--- a/python/dllib/src/test/dev/modules.py
+++ b/python/dllib/src/test/dev/modules.py
@@ -83,3 +83,10 @@ test_simple_integration_test = Module(
"test.simple_integration_test"
]
)
+
+test_load_caffe = Module(
+ name="load_caffe_test",
+ python_test_goals=[
+ "test.load_caffe_test"
+ ]
+) | load caffe, torch, bigdl model
add load caffe test
move load_caffe_test location
Final Commit of 4 optimization algorithms, RMSprop, Adam, Adadelta, Adamax. Unit Test Passed.
@whatbeg <I>
fix SoftmaxWithCriterion
move new optim methods from wrong place | intel-analytics_BigDL | train | py |
b7a04d699a3e9310a2e251b76b8949fa92532733 | diff --git a/index.js b/index.js
index <HASH>..<HASH> 100644
--- a/index.js
+++ b/index.js
@@ -11,9 +11,16 @@ function isEmpty (o) {
return true
}
+function isFunction (f) {
+ return 'function' === typeof f
+}
+
function id (e) { return e }
-module.exports = function (reduce, map) {
+module.exports = function (version, reduce, map) {
+ if(isFunction(version))
+ throw new Error('version must be a number')
+
map = map || id
var notify = Notify()
return function (log, name) { //name is where this view is mounted
@@ -51,6 +58,9 @@ module.exports = function (reduce, map) {
state = AtomicFile(path.join(dir, name+'.json'))
state.get(function (err, data) {
if(err || isEmpty(data)) since.set(-1)
+ else if(data.version !== version) {
+ since.set(-1) //overwrite old data.
+ }
else {
value.set(_value = data.value)
since.set(data.seq)
@@ -103,3 +113,4 @@ module.exports = function (reduce, map) {
}
}
+ | set a version number, so is upgradable | flumedb_flumeview-reduce | train | js |
1897d6bf98c16384e06a3e0edbc3d3341431f57c | diff --git a/spec/lib/sequent/generator/project_spec.rb b/spec/lib/sequent/generator/project_spec.rb
index <HASH>..<HASH> 100644
--- a/spec/lib/sequent/generator/project_spec.rb
+++ b/spec/lib/sequent/generator/project_spec.rb
@@ -56,16 +56,16 @@ describe Sequent::Generator::Project do
expect(File.read('blog-with_special-symbols/Rakefile')).to include("require './blog_with_special_symbols'")
end
- xit 'has working example with specs' do
+ it 'has working example with specs' do
execute
- Bundler.with_clean_env do
+ Bundler.with_unbundled_env do
system 'bash', '-cex', <<~SCRIPT
cd blog-with_special-symbols
export RACK_ENV=test
- source ~/.bash_profile
if which rbenv; then
+ eval "$(rbenv init - bash)"
rbenv shell $(cat ./.ruby-version)
rbenv install --skip-existing
fi
@@ -74,6 +74,7 @@ describe Sequent::Generator::Project do
bundle install
bundle exec rake sequent:db:drop
bundle exec rake sequent:db:create
+ bundle exec rake sequent:db:create_view_schema
bundle exec rake sequent:migrate:online
bundle exec rake sequent:migrate:offline
bundle exec rspec spec | Fix spec for setting up new project | zilverline_sequent | train | rb |
948170cbf03570af6f4494964ae10f09ed0028f8 | diff --git a/c7n/resources/ecr.py b/c7n/resources/ecr.py
index <HASH>..<HASH> 100644
--- a/c7n/resources/ecr.py
+++ b/c7n/resources/ecr.py
@@ -32,6 +32,8 @@ class ECR(QueryResourceManager):
name = "repositoryName"
id = "repositoryArn"
dimension = None
+ filter_name = 'repositoryNames'
+ filter_type = 'list'
ErrPolicyNotFound = 'RepositoryPolicyNotFoundException' | ecr - add filter_name on resource meta (#<I>) | cloud-custodian_cloud-custodian | train | py |
2d27f66aca9932e68346b7321c1ecdc43e009c54 | diff --git a/libaio/__init__.py b/libaio/__init__.py
index <HASH>..<HASH> 100644
--- a/libaio/__init__.py
+++ b/libaio/__init__.py
@@ -114,7 +114,7 @@ class AIOBlock(object):
self._buffer_list = tuple(buffer_list)
self._iovec = (libaio.iovec * len(buffer_list))(*[
libaio.iovec(
- cast((c_char * len(x)).from_buffer(x), c_void_p),
+ c_void_p(addressof(c_char.from_buffer(x))),
len(x),
)
for x in buffer_list | AIOBlock: Simplify buffer casting to void pointer.
No need to create an array type, as all we need is the address of the first
byte. | vpelletier_python-libaio | train | py |
9d9de9b4d6cfd50fbe4dc11795760d9405c5fc60 | diff --git a/enums.go b/enums.go
index <HASH>..<HASH> 100644
--- a/enums.go
+++ b/enums.go
@@ -256,14 +256,14 @@ func (ct *ClientType) UnmarshalText(text []byte) error {
type DeviceType uint
const (
- DeviceUnknown DeviceType = iota
+ DeviceOther DeviceType = iota
DeviceMobileBrowser
DeviceBrowser
DeviceEmail
)
var deviceTypes = []string{
- "unknown",
+ "other",
"desktop",
"mobile",
"tablet", | Rename device type unknown to other to match data received from api | mailgun_mailgun-go | train | go |
4f91f62979799219686aaa7513854d7652ea71dd | diff --git a/moment.js b/moment.js
index <HASH>..<HASH> 100644
--- a/moment.js
+++ b/moment.js
@@ -305,7 +305,7 @@
moment = function (input, format) {
if (input === null) {
- return null
+ return null;
}
var date;
// parse UnderscoreDate object | Missing semicolon
Build not included | moment_moment | train | js |
f912263748f5e4ed81cfd2530a6942de8ba4e59c | diff --git a/src/protocol/requests/deleteRecords/v0/response.spec.js b/src/protocol/requests/deleteRecords/v0/response.spec.js
index <HASH>..<HASH> 100644
--- a/src/protocol/requests/deleteRecords/v0/response.spec.js
+++ b/src/protocol/requests/deleteRecords/v0/response.spec.js
@@ -1,7 +1,8 @@
-const { decode, parse } = require('./response')
+const response = require('./response')
describe('Protocol > Requests > DeleteRecords > v0', () => {
test('response - success', async () => {
+ const { decode, parse } = response({})
const data = await decode(Buffer.from(require('../fixtures/v0_response.json')))
expect(data).toEqual({
throttleTime: 0, | deleteRecords Protocol - update test to call response fn | tulios_kafkajs | train | js |
Subsets and Splits