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
|
---|---|---|---|---|---|
389dd37962bc399a66cd86f8a5c9bf37f236f8e1 | diff --git a/index.js b/index.js
index <HASH>..<HASH> 100644
--- a/index.js
+++ b/index.js
@@ -64,7 +64,7 @@ module.exports = function(db) {
if (err) return cb(err);
get(key, function(err, entry) {
- if (err) return cb(err);
+ if (err && err.code !== 'ENOENT') return cb(err);
if (entry) return cb(errno.EEXIST(key));
put(key, stat({ | mkdir issue with enoent fixed | mafintosh_level-filesystem | train | js |
84c1e73727cc6004783c057c83e881f371965541 | diff --git a/svg/charts/plot.py b/svg/charts/plot.py
index <HASH>..<HASH> 100644
--- a/svg/charts/plot.py
+++ b/svg/charts/plot.py
@@ -2,21 +2,20 @@
"plot.py"
+import functools
from itertools import count, chain
import six
from six.moves import map
from lxml import etree
+import more_itertools
from svg.charts.graph import Graph
from .util import float_range
-def get_pairs(i):
- i = iter(i)
- while True:
- yield next(i), next(i)
+get_pairs = functools.partial(more_itertools.chunked, n=2)
class Plot(Graph): | Use chunked from more_itertools instead of bespoke function, which has errors on Python <I>. | jaraco_svg.charts | train | py |
55dd27f62c98c87870c45f7230b9d190ce28399e | diff --git a/Test/Unit/ComponentContentEntityType8Test.php b/Test/Unit/ComponentContentEntityType8Test.php
index <HASH>..<HASH> 100644
--- a/Test/Unit/ComponentContentEntityType8Test.php
+++ b/Test/Unit/ComponentContentEntityType8Test.php
@@ -32,6 +32,7 @@ class ComponentContentEntityType8Test extends TestBaseComponentGeneration {
'interface_parents' => [
'EntityOwnerInterface',
],
+ 'handler_list_builder' => 'core',
'base_fields' => [
0 => [
'name' => 'breed', | Added handler to content entity test. | drupal-code-builder_drupal-code-builder | train | php |
c74782097556740b75563f43d7f8c351fc01a375 | diff --git a/src/Illuminate/Foundation/Bootstrap/LoadEnvironmentVariables.php b/src/Illuminate/Foundation/Bootstrap/LoadEnvironmentVariables.php
index <HASH>..<HASH> 100644
--- a/src/Illuminate/Foundation/Bootstrap/LoadEnvironmentVariables.php
+++ b/src/Illuminate/Foundation/Bootstrap/LoadEnvironmentVariables.php
@@ -44,7 +44,7 @@ class LoadEnvironmentVariables
);
}
- if (! env('APP_ENV') || empty($file)) {
+ if (! env('APP_ENV')) {
return;
} | Fix Testing environment file load (#<I>)
`.env.testing` was not loading while running phpunit
Appeared in [this commit](<URL>) | laravel_framework | train | php |
ecd13f86c23da5d5059dccc7f3b59e00fc66529f | diff --git a/nomad/server.go b/nomad/server.go
index <HASH>..<HASH> 100644
--- a/nomad/server.go
+++ b/nomad/server.go
@@ -469,7 +469,9 @@ func (s *Server) setupConsulSyncer() error {
return nil
}
- s.consulSyncer.AddPeriodicHandler("Nomad Server Fallback Server Handler", bootstrapFn)
+ if s.config.ConsulConfig.ServerAutoJoin {
+ s.consulSyncer.AddPeriodicHandler("Nomad Server Fallback Server Handler", bootstrapFn)
+ }
return nil
} | Guard the auto-join functionality behind its `consul.server_auto_join` tunable | hashicorp_nomad | train | go |
a72ec6d2a291e2c362f5b939f217c15c54a6683b | diff --git a/apiserver/facades/client/client/client_test.go b/apiserver/facades/client/client/client_test.go
index <HASH>..<HASH> 100644
--- a/apiserver/facades/client/client/client_test.go
+++ b/apiserver/facades/client/client/client_test.go
@@ -526,11 +526,13 @@ type clientSuite struct {
}
func (s *clientSuite) SetUpTest(c *gc.C) {
- if s.ControllerConfigAttrs == nil {
- s.ControllerConfigAttrs = make(map[string]interface{})
- }
- s.ControllerConfigAttrs[controller.JujuManagementSpace] = "mgmt01"
s.baseSuite.SetUpTest(c)
+
+ _, err := s.State.AddSpace("mgmt01", "", nil, false)
+ c.Assert(err, jc.ErrorIsNil)
+
+ err = s.State.UpdateControllerConfig(map[string]interface{}{controller.JujuManagementSpace: "mgmt01"}, nil)
+ c.Assert(err, jc.ErrorIsNil)
}
var _ = gc.Suite(&clientSuite{}) | Ensures space corresponding to configured management space exists in apiserver client test setup. | juju_juju | train | go |
2d55130604040fbe26b29e71e1cf2c231fd4a715 | diff --git a/src/tsd/RpcHandler.java b/src/tsd/RpcHandler.java
index <HASH>..<HASH> 100644
--- a/src/tsd/RpcHandler.java
+++ b/src/tsd/RpcHandler.java
@@ -70,7 +70,6 @@ final class RpcHandler extends IdleStateAwareChannelUpstreamHandler {
* Constructor that loads the CORS domain list and prepares for
* handling requests. This constructor creates its own {@link RpcManager}.
* @param tsdb The TSDB to use.
- * @param manager instance of a ready-to-use {@link RpcManager}.
* @throws IllegalArgumentException if there was an error with the CORS domain
* list
*/ | Remove excess param in javadoc for RpcHandler | OpenTSDB_opentsdb | train | java |
b07ec856d9aabdee0ce7f18d39180952316da407 | diff --git a/addon/services/websockets.js b/addon/services/websockets.js
index <HASH>..<HASH> 100644
--- a/addon/services/websockets.js
+++ b/addon/services/websockets.js
@@ -73,6 +73,7 @@ export default Service.extend({
closeSocketFor(url) {
const cleanedUrl = cleanURL(normalizeURL(url));
get(this, `sockets.${cleanedUrl}`).socket.close();
+ delete get(this, 'sockets')[cleanedUrl];
},
isWebSocketOpen(websocket) { | Fix websocket proxy object is not removed from cache
Fix #<I> | thoov_ember-websockets | train | js |
13960f231dc19b66acf28fb5d42d68ec9501dcc1 | diff --git a/lib/blimpy/version.rb b/lib/blimpy/version.rb
index <HASH>..<HASH> 100644
--- a/lib/blimpy/version.rb
+++ b/lib/blimpy/version.rb
@@ -1,3 +1,3 @@
module Blimpy
- VERSION = "0.3.2"
+ VERSION = "0.3.3"
end | Minor version bump while we're at it | rtyler_blimpy | train | rb |
ee2e55843b99443291779de98d631c306c743db6 | diff --git a/django_tenants/staticfiles/storage.py b/django_tenants/staticfiles/storage.py
index <HASH>..<HASH> 100644
--- a/django_tenants/staticfiles/storage.py
+++ b/django_tenants/staticfiles/storage.py
@@ -40,11 +40,14 @@ class TenantStaticFilesStorage(TenantFileSystemStorage):
@cached_property
def relative_static_url(self):
url = settings.STATIC_URL
+ rewrite_on = False
+
if not url.endswith('/'):
url += '/'
try:
if settings.REWRITE_STATIC_URLS is True:
+ rewrite_on = True
try:
multitenant_relative_url = settings.MULTITENANT_RELATIVE_STATIC_ROOT
except AttributeError:
@@ -58,7 +61,7 @@ class TenantStaticFilesStorage(TenantFileSystemStorage):
# REWRITE_STATIC_URLS not set - ignore
pass
- return url
+ return rewrite_on, url
@property # Not cached like in parent class
def base_location(self):
@@ -66,7 +69,9 @@ class TenantStaticFilesStorage(TenantFileSystemStorage):
@property # Not cached like in parent class
def base_url(self):
- url = self.relative_static_url % connection.schema_name
+ rewrite_on, url = self.relative_static_url
+ if rewrite_on:
+ url = url % connection.schema_name
if not url.endswith('/'):
url += '/' | Don't try to rewrite URLs on every request. | tomturner_django-tenants | train | py |
6fe2249bcdd94bfd560b37ecb680937ec1f20ae1 | diff --git a/integration/v3_auth_test.go b/integration/v3_auth_test.go
index <HASH>..<HASH> 100644
--- a/integration/v3_auth_test.go
+++ b/integration/v3_auth_test.go
@@ -270,3 +270,25 @@ func authSetupRoot(t *testing.T, auth pb.AuthClient) {
t.Fatal(err)
}
}
+
+func TestV3AuthNonAuthorizedRPCs(t *testing.T) {
+ defer testutil.AfterTest(t)
+ clus := NewClusterV3(t, &ClusterConfig{Size: 1})
+ defer clus.Terminate(t)
+
+ nonAuthedKV := clus.Client(0).KV
+
+ key := "foo"
+ val := "bar"
+ _, err := nonAuthedKV.Put(context.TODO(), key, val)
+ if err != nil {
+ t.Fatalf("couldn't put key (%v)", err)
+ }
+
+ authSetupRoot(t, toGRPC(clus.Client(0)).Auth)
+
+ respput, err := nonAuthedKV.Put(context.TODO(), key, val)
+ if !eqErrGRPC(err, rpctypes.ErrGRPCUserEmpty) {
+ t.Fatalf("could put key (%v), it should cause an error of permission denied", respput)
+ }
+} | integration: add a test case for non authorized RPCs
This commit add a new test case which ensures that non authorized RPCs
failed with ErrUserEmpty. The case can happen in a schedule like
below:
1. create a cluster
2. create clients
3. enable authentication of the cluster
4. the clients issue RPCs
Fix <URL> | etcd-io_etcd | train | go |
687fa4d38db5c0bfd9d0cf3db763a6c97f3df35f | diff --git a/framework/mail/BaseMailer.php b/framework/mail/BaseMailer.php
index <HASH>..<HASH> 100644
--- a/framework/mail/BaseMailer.php
+++ b/framework/mail/BaseMailer.php
@@ -186,6 +186,7 @@ abstract class BaseMailer extends Component implements MailerInterface, ViewCont
if (isset($text)) {
$message->setTextBody($text);
} elseif (isset($html)) {
+ $html = preg_replace('|<style[^>]*>(.*)</style>|is', '', $html);
$message->setTextBody(strip_tags($html));
}
} | BaseMailer: strip <style> content from TextBody fix
If ```$htmlLayout``` contains <style> tags with CSS rules,
strip_tags here: <URL>,
I believe people will stumble in this for sure, without even knowing that their emails can be penalized.
You can reproduce it by placing CSS styles in email view or layout
and test it here: <URL>. | yiisoft_yii-core | train | php |
30e777d10d8d974ac561de4f9f17a514e1cdc4f9 | diff --git a/storage/tsdb/tsdb.go b/storage/tsdb/tsdb.go
index <HASH>..<HASH> 100644
--- a/storage/tsdb/tsdb.go
+++ b/storage/tsdb/tsdb.go
@@ -127,8 +127,7 @@ type Options struct {
// Open returns a new storage backed by a TSDB database that is configured for Prometheus.
func Open(path string, l log.Logger, r prometheus.Registerer, opts *Options) (*tsdb.DB, error) {
if opts.MinBlockDuration > opts.MaxBlockDuration {
- return nil, errors.Errorf("tsdb max block duration (%v) must be larger than min block duration (%v)",
- opts.MaxBlockDuration, opts.MinBlockDuration)
+ opts.MaxBlockDuration = opts.MinBlockDuration
}
// Start with smallest block duration and create exponential buckets until the exceed the
// configured maximum block duration. | tsdb: default too small max block duration | prometheus_prometheus | train | go |
39f4a7cf5fbae7588e92dc4bf7021802d8f8c3e2 | diff --git a/src/lib/page.php b/src/lib/page.php
index <HASH>..<HASH> 100644
--- a/src/lib/page.php
+++ b/src/lib/page.php
@@ -152,17 +152,10 @@ function papi_get_number_of_pages( $page_type ) {
return 0;
}
- $value = papi_cache_get( 'page_type', $page_type );
+ $sql = "SELECT COUNT(*) FROM {$wpdb->prefix}postmeta WHERE `meta_key` = '%s' AND `meta_value` = '%s'";
+ $sql = $wpdb->prepare( $sql, papi_get_page_type_key(), $page_type );
- if ( $value === false ) {
- $sql = "SELECT COUNT(*) FROM {$wpdb->prefix}postmeta WHERE `meta_key` = '%s' AND `meta_value` = '%s'";
- $sql = $wpdb->prepare( $sql, papi_get_page_type_key(), $page_type );
-
- $value = intval( $wpdb->get_var( $sql ) );
- papi_cache_set( 'page_type', $page_type, $value );
- }
-
- return $value;
+ return intval( $wpdb->get_var( $sql ) );
}
/** | Remove cache from papi_get_number_of_pages | wp-papi_papi | train | php |
6ddd79eaeb0f1f0f58cb81f1206dfd2e74c3c946 | diff --git a/openquake/engine/calculators/base.py b/openquake/engine/calculators/base.py
index <HASH>..<HASH> 100644
--- a/openquake/engine/calculators/base.py
+++ b/openquake/engine/calculators/base.py
@@ -136,7 +136,7 @@ class Calculator(object):
def log_percent(self, dummy):
"""Log the percentage of tasks completed"""
self.tasksdone += 1
- percent = math.ceil(float(self.tasksdone) / self.num_tasks * 100)
+ percent = int(float(self.tasksdone) / self.num_tasks * 100)
if percent > self.percent:
logs.LOG.progress('> %s %3d%% complete', self.taskname, percent)
self.percent = percent | The percentage must be approximated from below to avoid getting a fake <I>% | gem_oq-engine | train | py |
cc7183ce53f1173395435362c74da80990799b8c | diff --git a/lib/player.js b/lib/player.js
index <HASH>..<HASH> 100644
--- a/lib/player.js
+++ b/lib/player.js
@@ -1663,10 +1663,11 @@ function parseFloatOrNull(n) {
function grooveFileToDbFile(file, filenameHint, object) {
object = object || {key: uuid()};
var parsedTrack = parseTrackString(file.getMetadata("track"));
- var parsedDisc = parseTrackString(file.getMetadata("disc"));
+ var parsedDisc = parseTrackString(file.getMetadata("disc") || file.getMetadata("TPA"));
object.name = file.getMetadata("title") || trackNameFromFile(filenameHint);
object.artistName = (file.getMetadata("artist") || "").trim();
- object.composerName = (file.getMetadata("composer") || "").trim();
+ object.composerName = (file.getMetadata("composer") ||
+ file.getMetadata("TCM") || "").trim();
object.performerName = (file.getMetadata("performer") || "").trim();
object.albumArtistName = (file.getMetadata("album_artist") || "").trim();
object.albumName = (file.getMetadata("album") || "").trim(); | recognize TPA and TCM tags
TPA is an alternate "disc" tag
TCM is an alternate "composer" tag | andrewrk_groovebasin | train | js |
f41208658b7d2498d75dfe7a7388d77ef40eb203 | diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100755
--- a/setup.py
+++ b/setup.py
@@ -10,7 +10,7 @@ ver_file = os.path.join('bids', 'version.py')
with open(ver_file) as f:
exec(f.read())
-opts = dict(name=NAME,
+opts = dict(name="pybids",
maintainer=MAINTAINER,
maintainer_email=MAINTAINER_EMAIL,
description=DESCRIPTION, | fix name in setup.py so used-by count works; h/t @effigies | bids-standard_pybids | train | py |
701e4eaa10e9ed0b73723001ba0eaf7a2a1098db | diff --git a/src/Model/Write/EavIterator.php b/src/Model/Write/EavIterator.php
index <HASH>..<HASH> 100644
--- a/src/Model/Write/EavIterator.php
+++ b/src/Model/Write/EavIterator.php
@@ -262,7 +262,7 @@ class EavIterator implements IteratorAggregate
foreach ($this->attributes as $attribute) {
if ($attribute->isStatic()) {
$select = $this->getStaticAttributeSelect($attribute);
- } elseif ($this->productMetadata->getEdition() == CommunityProductMetadata::PRODUCT_NAME) {
+ } elseif ($this->productMetadata->getEdition() == CommunityProductMetadata::EDITION_NAME) {
$select = $this->getAttributeSelectCommunity($attribute);
} else {
$select = $this->getAttributeSelectEnterprise($attribute); | Added fix from #2 was lost due to invalid merge | EmicoEcommerce_Magento2TweakwiseExport | train | php |
ab279a5b0a1dfea338898ab2200e09f512a1a739 | diff --git a/classes/ModelModel.php b/classes/ModelModel.php
index <HASH>..<HASH> 100644
--- a/classes/ModelModel.php
+++ b/classes/ModelModel.php
@@ -1,6 +1,7 @@
<?php namespace RainLab\Builder\Classes;
use DirectoryIterator;
+use ApplicationException;
use SystemException;
use Validator;
use Lang; | Import missing ApplicationException class (#<I>)
When attempting to add database columns when the table does not exist, an ApplicationException is thrown but the class is not imported. This quick fix resolves the issue. | rainlab_builder-plugin | train | php |
57bbff698996faa480a3e7df4be2e971f7bf18aa | diff --git a/Core/Executor/UserGroupManager.php b/Core/Executor/UserGroupManager.php
index <HASH>..<HASH> 100644
--- a/Core/Executor/UserGroupManager.php
+++ b/Core/Executor/UserGroupManager.php
@@ -49,6 +49,9 @@ class UserGroupManager extends RepositoryExecutor
$roleService = $this->repository->getRoleService();
// we support both Ids and Identifiers
foreach ($this->dsl['roles'] as $roleId) {
+ if($this->referenceResolver->isReference($roleId)) {
+ $roleId = $this->referenceResolver->resolveReference($roleId);
+ }
$role = $this->roleMatcher->matchOneByKey($roleId);
$roleService->assignRoleToUserGroup($role, $userGroup);
} | Allow roles in user_group create to be references | kaliop-uk_ezmigrationbundle | train | php |
0ae709b5bde3b2c39673629257b81345e7d1e8a0 | diff --git a/kucoin/client.py b/kucoin/client.py
index <HASH>..<HASH> 100644
--- a/kucoin/client.py
+++ b/kucoin/client.py
@@ -2292,6 +2292,48 @@ class Client(object):
# finally return our converted klines
return klines
+ def get_coin_info(self, coin=None):
+ """Get info about all coins or a coin
+
+ https://kucoinapidocs.docs.apiary.io/#reference/0/market/get-coin-info(open)
+
+ .. code:: python
+
+ # all coin info
+ info = client.get_coin_info()
+
+ # EOS coin info
+ info = client.get_coin_info('EOS')
+
+ :returns: ApiResponse
+
+ .. code:: python
+
+ {
+ "withdrawMinFee": 100000,
+ "withdrawMinAmount": 200000,
+ "withdrawFeeRate": 0.001,
+ "confirmationCount": 12,
+ "name": "Bitcoin",
+ "tradePrecision": 7,
+ "coin": "BTC",
+ "infoUrl": null,
+ "enableWithdraw": true,
+ "enableDeposit": true,
+ "depositRemark": "",
+ "withdrawRemark": ""
+ }
+
+ :raises: KucoinResponseException, KucoinAPIException
+
+ """
+
+ data = {}
+ if coin:
+ data['coin'] = coin
+
+ return self._get('market/open/coin-info', False, data=data)
+
def get_coin_list(self):
"""Get a list of coins with trade and withdrawal information | Add function for get coin info endpoint | sammchardy_python-kucoin | train | py |
a49e057428bc76a1f7bcf3dbbea4b170a2b686a8 | diff --git a/delorean/dates.py b/delorean/dates.py
index <HASH>..<HASH> 100644
--- a/delorean/dates.py
+++ b/delorean/dates.py
@@ -12,6 +12,14 @@ UTC = "UTC"
utc = timezone("UTC")
+def get_total_second(td):
+ """
+ This method takes a timedelta and return the number of seconds it
+ represents with the resolution of 10 **6
+ """
+ return (td.microseconds + (td.seconds + td.days * 24 * 3600) * 1e6) / 1e6
+
+
def is_datetime_naive(dt):
"""
This method returns true if the datetime is naive else returns false
@@ -309,7 +317,7 @@ class Delorean(object):
epoch = utc.localize(datetime.utcfromtimestamp(0))
dt = utc.normalize(self._dt)
delta = dt - epoch
- return delta.total_seconds()
+ return get_total_second(delta)
@property
def date(self): | fixing it so it works with python<I> | myusuf3_delorean | train | py |
75f9b8c5fd3680e6f2bb704b3062544ccae16817 | diff --git a/test/specs/requests.spec.js b/test/specs/requests.spec.js
index <HASH>..<HASH> 100644
--- a/test/specs/requests.spec.js
+++ b/test/specs/requests.spec.js
@@ -36,6 +36,35 @@ describe('requests', function () {
});
});
+ it('should reject on adapter errors', function (done) {
+ // disable jasmine.Ajax since we're hitting a non-existant server anyway
+ jasmine.Ajax.uninstall();
+
+ var resolveSpy = jasmine.createSpy('resolve');
+ var rejectSpy = jasmine.createSpy('reject');
+
+ var adapterError = new Error('adapter error');
+ var adapterThatFails = function () {
+ throw adapterError;
+ };
+
+ var finish = function () {
+ expect(resolveSpy).not.toHaveBeenCalled();
+ expect(rejectSpy).toHaveBeenCalled();
+ var reason = rejectSpy.calls.first().args[0];
+ expect(reason).toBe(adapterError);
+ expect(reason.config.method).toBe('get');
+ expect(reason.config.url).toBe('/foo');
+
+ done();
+ };
+
+ axios('/foo', {
+ adapter: adapterThatFails
+ }).then(resolveSpy, rejectSpy)
+ .then(finish, finish);
+ });
+
it('should reject on network errors', function (done) {
// disable jasmine.Ajax since we're hitting a non-existant server anyway
jasmine.Ajax.uninstall(); | Adding failing test for adapter errors | axios_axios | train | js |
7e497133540a5ac271a5ecb4d26d9efd0bccee7c | diff --git a/code/ProductGroup.php b/code/ProductGroup.php
index <HASH>..<HASH> 100644
--- a/code/ProductGroup.php
+++ b/code/ProductGroup.php
@@ -256,7 +256,8 @@ class ProductGroup_Controller extends Page_Controller {
* Return the products for this group.
*/
public function Products($recursive = true){
- return $this->ProductsShowable("\"FeaturedProduct\" = 1",$recursive);
+ // return $this->ProductsShowable("\"FeaturedProduct\" = 1",$recursive);
+ return $this->ProductsShowable('',$recursive);
}
/** | ProductGroup->Products should NOT be requesting FeaturedProduct. This reverts to orig (correct) bahaviour but honours recursive flag. | silvershop_silvershop-core | train | php |
5a313a3b4e716f073f55e79363e439623c0fb7ff | diff --git a/mobly/utils.py b/mobly/utils.py
index <HASH>..<HASH> 100644
--- a/mobly/utils.py
+++ b/mobly/utils.py
@@ -477,7 +477,7 @@ def run_command(cmd,
if timer is not None:
timer.cancel()
if timer_triggered.is_set():
- raise subprocess.TimeoutExpired(cmd=cwd,
+ raise subprocess.TimeoutExpired(cmd=cmd,
timeout=timeout,
output=out,
stderr=err)
diff --git a/tests/mobly/utils_test.py b/tests/mobly/utils_test.py
index <HASH>..<HASH> 100755
--- a/tests/mobly/utils_test.py
+++ b/tests/mobly/utils_test.py
@@ -223,7 +223,7 @@ class UtilsTest(unittest.TestCase):
self.assertEqual(ret, 0)
def test_run_command_with_timeout_expired(self):
- with self.assertRaises(subprocess.TimeoutExpired):
+ with self.assertRaisesRegex(subprocess.TimeoutExpired, 'sleep'):
_ = utils.run_command(self.sleep_cmd(4), timeout=0.01)
@mock.patch('threading.Timer') | Fix typo in run_command (#<I>) | google_mobly | train | py,py |
edb032b96df8581440d4fb450dc470e47c5c4859 | diff --git a/extensions-core/hdfs-storage/src/main/java/io/druid/storage/hdfs/HdfsDataSegmentPusher.java b/extensions-core/hdfs-storage/src/main/java/io/druid/storage/hdfs/HdfsDataSegmentPusher.java
index <HASH>..<HASH> 100644
--- a/extensions-core/hdfs-storage/src/main/java/io/druid/storage/hdfs/HdfsDataSegmentPusher.java
+++ b/extensions-core/hdfs-storage/src/main/java/io/druid/storage/hdfs/HdfsDataSegmentPusher.java
@@ -94,8 +94,9 @@ public class HdfsDataSegmentPusher implements DataSegmentPusher
);
Path tmpFile = new Path(String.format(
- "%s/%s/index.zip",
+ "%s/%s/%s/index.zip",
fullyQualifiedStorageDirectory,
+ segment.getDataSource(),
UUIDUtils.generateUuid()
));
FileSystem fs = tmpFile.getFileSystem(hadoopConfig); | add datasource in intermediate segment path (#<I>) | apache_incubator-druid | train | java |
bd12e11bcef9bc3941e7c6765029cbbf332c998c | diff --git a/platform/android/build/android_tools.rb b/platform/android/build/android_tools.rb
index <HASH>..<HASH> 100644
--- a/platform/android/build/android_tools.rb
+++ b/platform/android/build/android_tools.rb
@@ -358,7 +358,9 @@ def restart_adb
# system ('killall -9 adb')
#end
sleep 3
+ puts 'Starting adb server again'
system("#{$adb} start-server")
+ sleep 3
end
module_function :restart_adb | Android: fix "device not found" problem | rhomobile_rhodes | train | rb |
2a15b76dfc1194d470a76728d3769aac55be803c | diff --git a/lib/aruba/matchers/file.rb b/lib/aruba/matchers/file.rb
index <HASH>..<HASH> 100644
--- a/lib/aruba/matchers/file.rb
+++ b/lib/aruba/matchers/file.rb
@@ -143,10 +143,10 @@ RSpec::Matchers.define :have_file_size do |expected|
end
failure_message do |actual|
- format("expected that file \"%s\" has size \"%s\"", actual)
+ format("expected that file \"%s\" has size \"%s\", but has \"%s\"", actual, File.size(expand_path(actual)), expected)
end
failure_message_when_negated do |actual|
- format("expected that file \"%s\" does not have size \"%s\"", actual)
+ format("expected that file \"%s\" does not have size \"%s\", but has \"%s\"", actual, File.size(expand_path(actual)), expected)
end
end | Fixed failure messages for file size matcher | cucumber_aruba | train | rb |
dac95b0804208a32b20750f93b8e887d9ede3b2b | diff --git a/tests/timing.py b/tests/timing.py
index <HASH>..<HASH> 100644
--- a/tests/timing.py
+++ b/tests/timing.py
@@ -1,3 +1,5 @@
+"""Compute time needed to run proselint over entire corpus."""
+
import subprocess
import os
import time
diff --git a/worker.py b/worker.py
index <HASH>..<HASH> 100644
--- a/worker.py
+++ b/worker.py
@@ -1,5 +1,6 @@
-import os
+"""Heroku web worker."""
+import os
import redis
from rq import Worker, Queue, Connection | Reinstate compliance with PEP8 and PEP<I> | amperser_proselint | train | py,py |
1bb6bbe9af09115cb1fc2522239a07256f0e2714 | diff --git a/structr-core/src/main/java/org/structr/core/script/Scripting.java b/structr-core/src/main/java/org/structr/core/script/Scripting.java
index <HASH>..<HASH> 100644
--- a/structr-core/src/main/java/org/structr/core/script/Scripting.java
+++ b/structr-core/src/main/java/org/structr/core/script/Scripting.java
@@ -345,10 +345,9 @@ public class Scripting {
// enable some optimizations..
scriptingContext.setLanguageVersion(Context.VERSION_ES6);
- scriptingContext.setOptimizationLevel(9);
scriptingContext.setInstructionObserverThreshold(0);
scriptingContext.setGenerateObserverCount(false);
- scriptingContext.setGeneratingDebug(false);
+ scriptingContext.setGeneratingDebug(true);
return scriptingContext;
} | Re-enables JavaScript debug information for increased logging verbosity. | structr_structr | train | java |
7860db53b410e642742792a0f5746ea3249f1e27 | diff --git a/src/NumericalAnalysis/NumericalIntegration/SimpsonsRule.php b/src/NumericalAnalysis/NumericalIntegration/SimpsonsRule.php
index <HASH>..<HASH> 100644
--- a/src/NumericalAnalysis/NumericalIntegration/SimpsonsRule.php
+++ b/src/NumericalAnalysis/NumericalIntegration/SimpsonsRule.php
@@ -44,7 +44,7 @@ class SimpsonsRule extends NumericalIntegration
* integral of the function that produces these coordinates with a lower
* bound of 0, and an upper bound of 10.
*
- * Example: approximate(function($x) {return $x**2;}, [0, 4 ,5]) will produce
+ * Example: approximate(function($x) {return $x**2;}, 0, 4 ,5) will produce
* a set of arrays by evaluating the callback at 5 evenly spaced points
* between 0 and 4. Then, this array will be used in our approximation.
* | Updated comments in SimpsonsRule | markrogoyski_math-php | train | php |
7820ca3c215afdd500bff0f58deabd341cad89a1 | diff --git a/lib/rest.rb b/lib/rest.rb
index <HASH>..<HASH> 100644
--- a/lib/rest.rb
+++ b/lib/rest.rb
@@ -3,6 +3,9 @@ require 'uri'
# REST is basically a convenience wrapper around Net::HTTP. It defines a simple and consistant API for doing REST-style
# HTTP calls.
module REST
+ # Library version
+ VERSION = '0.7.0pre0'
+
# Raised when the remote server disconnects when reading the response
class DisconnectedError < StandardError; end | Add version to code and set to <I>pre0. | Fingertips_nap | train | rb |
42c9bb95a6cfa708172e5a4976c43083fca3a711 | diff --git a/spec/dummy/config/routes.rb b/spec/dummy/config/routes.rb
index <HASH>..<HASH> 100644
--- a/spec/dummy/config/routes.rb
+++ b/spec/dummy/config/routes.rb
@@ -1,4 +1,4 @@
Rails.application.routes.draw do
- mount Peoplefinder::Engine => "/peoplefinder"
+ mount Peoplefinder::Engine => "/"
end | Mount the engine at /
some of the tests have hard-coded expectations about urls generated, so
we need to mount the engine at / otherwise the generated urls will
differ from those expectations. | ministryofjustice_peoplefinder | train | rb |
c0c4f92f12bf1b71fd44782de8bee3a8249ec71a | diff --git a/lib/jets/commands/db/tasks.rb b/lib/jets/commands/db/tasks.rb
index <HASH>..<HASH> 100644
--- a/lib/jets/commands/db/tasks.rb
+++ b/lib/jets/commands/db/tasks.rb
@@ -5,7 +5,6 @@ require "recursive-open-struct"
class Jets::Commands::Db::Tasks
# Ugly but it loads ActiveRecord database tasks
def self.load!
- Jets.boot
db_configs = Jets.application.config.database
ActiveRecord::Tasks::DatabaseTasks.database_configuration = db_configs
ActiveRecord::Tasks::DatabaseTasks.migrations_paths = ["db/migrate"] | remove Jets.boot from db tasks, fixes jets -h outside of project | tongueroo_jets | train | rb |
5e4f4d4a371fab6b267da5631c946f74c6feb816 | diff --git a/src/Symfony/Component/Form/FormTypeGuesserChain.php b/src/Symfony/Component/Form/FormTypeGuesserChain.php
index <HASH>..<HASH> 100644
--- a/src/Symfony/Component/Form/FormTypeGuesserChain.php
+++ b/src/Symfony/Component/Form/FormTypeGuesserChain.php
@@ -25,8 +25,12 @@ class FormTypeGuesserChain implements FormTypeGuesserInterface
*
* @throws UnexpectedTypeException if any guesser does not implement FormTypeGuesserInterface
*/
- public function __construct(array $guessers)
+ public function __construct($guessers)
{
+ if (!is_array($guessers) && !$guessers instanceof \Traversable) {
+ throw new UnexpectedTypeException($guessers, 'array or Traversable');
+ }
+
foreach ($guessers as $guesser) {
if (!$guesser instanceof FormTypeGuesserInterface) {
throw new UnexpectedTypeException($guesser, 'Symfony\Component\Form\FormTypeGuesserInterface'); | [Form] Change FormTypeGuesserChain to accept Traversable | symfony_symfony | train | php |
2e72fc6725d47d86f105886cd6452e7e7e5640f8 | diff --git a/test/unit/lifecycle.spec.js b/test/unit/lifecycle.spec.js
index <HASH>..<HASH> 100644
--- a/test/unit/lifecycle.spec.js
+++ b/test/unit/lifecycle.spec.js
@@ -181,7 +181,7 @@ describe('Unit: lifecycle.js', function () {
it('should should populate child process', function () {
const sevenFake = new Readable({ read () {} })
- sevenFake._bin = 'cd'
+ sevenFake._bin = 'npm'
sevenFake._args = []
const r = Seven.run(sevenFake)
expect(isChildProcess(r._childProcess)).to.eql(true) | ci: Use npm command as mock because it's cross platform | quentinrossetti_node-7z | train | js |
1d9c3f629954a7d723e703d11c977f737a6ad778 | diff --git a/pyam_analysis/core.py b/pyam_analysis/core.py
index <HASH>..<HASH> 100644
--- a/pyam_analysis/core.py
+++ b/pyam_analysis/core.py
@@ -148,7 +148,18 @@ class IamDataFrame(object):
"""
return list(self.select(filters, ['scenario']).scenario)
- def variables(self, filters={}):
+ def regions(self, filters={}):
+ """Get a list of regions filtered by specific characteristics
+
+ Parameters
+ ----------
+ filters: dict, optional
+ filter by model, scenario, region, variable, year, or category
+ see function select() for details
+ """
+ return list(self.select(filters, ['region']).region)
+
+ def variables(self, filters={}, include_units=False):
"""Get a list of variables filtered by specific characteristics
Parameters | add standard function to get list of regions | IAMconsortium_pyam | train | py |
3d0f700ad478babc9c98a26feb3e97ffdcc02f29 | diff --git a/delocate/delocating.py b/delocate/delocating.py
index <HASH>..<HASH> 100644
--- a/delocate/delocating.py
+++ b/delocate/delocating.py
@@ -109,7 +109,7 @@ def delocate_tree_libs(
# Update lib_dict with the new file paths.
lib_dict[new_path] = lib_dict[old_path]
del lib_dict[old_path]
- for required in list(lib_dict):
+ for required in lib_dict:
if old_path not in lib_dict[required]:
continue
lib_dict[required][new_path] = lib_dict[required][old_path]
@@ -296,7 +296,7 @@ def filter_system_libs(libname):
def delocate_path(
tree_path, # type: Text
lib_path, # type: Text
- lib_filt_func=None, # type: Union[None, str, Callable[[Text], bool]]
+ lib_filt_func=None, # type: Optional[Union[str, Callable[[Text], bool]]]
copy_filt_func=filter_system_libs # type: Optional[Callable[[Text], bool]]
):
# type: (...) -> Dict[Text, Dict[Text, Text]] | Apply suggestions from code review.
The list copy of lib_dict wasn't needed.
Use an alternative type-hint for lib_filt_func. | matthew-brett_delocate | train | py |
8593011aa3c829c52cd0355f500a3e1dc0fbe25e | diff --git a/src/index.js b/src/index.js
index <HASH>..<HASH> 100644
--- a/src/index.js
+++ b/src/index.js
@@ -40,6 +40,10 @@ function findExistingRule(doc, styleSheet, className) {
let cssRule;
let i;
+ if (!cssRules) {
+ return null;
+ }
+
for (i = 0; i < cssRules.length; i++) {
cssRule = cssRules[i]; | Return early if `cssRules` doesn't exist | bebraw_stylesheet-helpers | train | js |
4ce0c9c58093aba5ac74685e98ba860fde1a097c | diff --git a/keanu-python/keanu/python_hanging_on_windows.py b/keanu-python/keanu/python_hanging_on_windows.py
index <HASH>..<HASH> 100644
--- a/keanu-python/keanu/python_hanging_on_windows.py
+++ b/keanu-python/keanu/python_hanging_on_windows.py
@@ -4,7 +4,7 @@ import os.path
from py4j.java_gateway import JavaGateway, JavaObject, CallbackServerParameters
PATH = os.path.abspath(os.path.dirname(__file__))
-CLASSPATH = os.path.join(PATH, "keanu-python-all.jar")
+CLASSPATH = os.path.join(PATH, "classpath", "*")
print("classpath=", CLASSPATH) | changed classpath in python_hanging_on_windows | improbable-research_keanu | train | py |
e8b155fefe5c0518b652c8ca8b5fe85842ff6665 | diff --git a/image.go b/image.go
index <HASH>..<HASH> 100644
--- a/image.go
+++ b/image.go
@@ -65,7 +65,6 @@ func (i *images) remove(img *Image) {
i.m.Lock()
defer i.m.Unlock()
delete(i.images, r)
- runtime.SetFinalizer(img, nil)
}
func (i *images) resolveStalePixels(context *opengl.Context) error { | graphics: Remove duplicated runtime.SetFinalizer | hajimehoshi_ebiten | train | go |
41aebb98ac4d87045bb489d8b4d039ff2209a725 | diff --git a/tests/AssertTraitTest.php b/tests/AssertTraitTest.php
index <HASH>..<HASH> 100644
--- a/tests/AssertTraitTest.php
+++ b/tests/AssertTraitTest.php
@@ -56,6 +56,14 @@ class AssertTraitTest extends \PHPUnit_Framework_TestCase
self::assertInstanceOf('PHPUnit_Framework_ExpectationFailedException', $exception);
}
+ public function testAssertJsonMatchesSchemaString()
+ {
+ $content = json_decode('{"foo":123}');
+ $schema = file_get_contents(self::getSchema('test.schema.json'));
+
+ AssertTraitImpl::assertJsonMatchesSchemaString($schema, $content);
+ }
+
/**
* Tests assertJsonValueEquals().
* | Add test for assertJsonMatchesSchemaString | estahn_phpunit-json-assertions | train | php |
3c642f0b9c3c1e084411d772f6749cae55a9f430 | diff --git a/framework/yii/widgets/DetailView.php b/framework/yii/widgets/DetailView.php
index <HASH>..<HASH> 100644
--- a/framework/yii/widgets/DetailView.php
+++ b/framework/yii/widgets/DetailView.php
@@ -30,7 +30,7 @@ use yii\helpers\Inflector;
* A typical usage of DetailView is as follows:
*
* ~~~
- * \yii\widgets\DetailView::widget(array(
+ * echo DetailView::widget(array(
* 'model' => $model,
* 'attributes' => array(
* 'title', // title attribute (in plain text)
@@ -90,7 +90,7 @@ class DetailView extends Widget
* @var array the HTML attributes for the container tag of this widget. The "tag" option specifies
* what container tag should be used. It defaults to "table" if not set.
*/
- public $options = array('class' => 'table table-striped');
+ public $options = array('class' => 'table table-striped table-bordered');
/**
* @var array|Formatter the formatter used to format model attribute values into displayable texts.
* This can be either an instance of [[Formatter]] or an configuration array for creating the [[Formatter]] | Example usage consistent with other widgets [skip ci] | yiisoft_yii2-debug | train | php |
9beb012d20c77650ed3faced03fa2efb7f7685a9 | diff --git a/lib/handler.js b/lib/handler.js
index <HASH>..<HASH> 100644
--- a/lib/handler.js
+++ b/lib/handler.js
@@ -370,12 +370,17 @@ module.exports = class Handler {
} else {
console.error(ex);
}
+ } finally {
+ try {
+ await page.close();
+ } catch {
+ // don't care about an error here
+ }
}
if (mSettings.output !== undefined) {
settings.input = mSettings.output;
}
- await page.close();
}
}; | Do not crash if page cannot be closed | kapouer_express-dom | train | js |
357317d75ae62e1495561e6035522afef1cda101 | diff --git a/src/Watchers/RedisWatcher.php b/src/Watchers/RedisWatcher.php
index <HASH>..<HASH> 100644
--- a/src/Watchers/RedisWatcher.php
+++ b/src/Watchers/RedisWatcher.php
@@ -56,6 +56,10 @@ class RedisWatcher extends Watcher
$parameters = collect($parameters)->map(function ($parameter) {
if (is_array($parameter)) {
return collect($parameter)->map(function ($value, $key) {
+ if (is_array($value)) {
+ return json_encode($value);
+ }
+
return is_int($key) ? $value : "{$key} {$value}";
})->implode(' ');
} | Encode array for logging (#<I>) | laravel_telescope | train | php |
5ed7f5c04f1ba5427871221fda01b72a4e792bea | diff --git a/anndata/_core/anndata.py b/anndata/_core/anndata.py
index <HASH>..<HASH> 100644
--- a/anndata/_core/anndata.py
+++ b/anndata/_core/anndata.py
@@ -1752,11 +1752,12 @@ class AnnData(metaclass=utils.DeprecationMixinMeta):
else:
layers[key] = np.concatenate(layers[key])
- for key in shared_obsm_keys:
- if any(issparse(a.obsm[key]) for a in all_adatas):
- obsm[key] = vstack(obsm[key])
- else:
- obsm[key] = np.concatenate(obsm[key])
+ # obsm
+ for key in shared_obsm_keys:
+ if any(issparse(a.obsm[key]) for a in all_adatas):
+ obsm[key] = vstack(obsm[key])
+ else:
+ obsm[key] = np.concatenate(obsm[key])
obs = pd.concat(out_obss, sort=True) | fix obsm concat for join=outer | theislab_anndata | train | py |
dbe98116b3906d5d30b9e1a05e72731ac17a9e03 | diff --git a/dse/auth.py b/dse/auth.py
index <HASH>..<HASH> 100644
--- a/dse/auth.py
+++ b/dse/auth.py
@@ -1,9 +1,16 @@
from cassandra.auth import AuthProvider, Authenticator
try:
+ import kerberos
+ _have_kerberos = True
+except ImportError:
+ _have_kerberos = False
+
+try:
from puresasl.client import SASLClient
+ _have_puresasl = True
except ImportError:
- SASLClient = None
+ _have_puresasl = False
class DSEPlainTextAuthProvider(AuthProvider):
@@ -17,8 +24,10 @@ class DSEPlainTextAuthProvider(AuthProvider):
class DSEGSSAPIAuthProvider(AuthProvider):
def __init__(self, service=None, qops=None):
- if SASLClient is None:
+ if not _have_puresasl:
raise ImportError('The puresasl library has not been installed')
+ if not _have_kerberos:
+ raise ImportError('The kerberos library has not been installed')
self.service = service
self.qops = qops | Check for kerberos library before attempting GSSAPI | datastax_python-driver | train | py |
88de5e1dfbfa07da1f666a5ec0ba5c39a96a4122 | diff --git a/lib/chef/provider/package.rb b/lib/chef/provider/package.rb
index <HASH>..<HASH> 100644
--- a/lib/chef/provider/package.rb
+++ b/lib/chef/provider/package.rb
@@ -251,6 +251,10 @@ class Chef
end
end
+ def package_locked(name, version)
+ raise Chef::Exceptions::UnsupportedAction, "#{self} has no way to detect if package is locked"
+ end
+
# @todo use composition rather than inheritance
def multipackage_api_adapter(name, version) | Declare package_locked inside the Package provider
The Package provider uses this method in its code, but it doesn't
enforce it's existence. For sanity we should at least raise an error
to ensure all the providers that support locking/unlocking a package
have the method to determine whether the package is locked. | chef_chef | train | rb |
8a203072cee102aa64a3f74d8918f55bc723985f | diff --git a/raiden/utils/nursery.py b/raiden/utils/nursery.py
index <HASH>..<HASH> 100644
--- a/raiden/utils/nursery.py
+++ b/raiden/utils/nursery.py
@@ -43,6 +43,7 @@ class Janitor:
self.stop_timeout = stop_timeout
self._stop = AsyncResult()
self._processes: Set[Popen] = set()
+ self._exit_in_progress = False
# Lock to protect changes to `_stop` and `_processes`. The `_stop`
# synchronization is necessary to fix the race described below,
@@ -77,6 +78,11 @@ class Janitor:
assert not kwargs.get("shell", False), "Janitor does not work with shell=True"
def subprocess_stopped(result: AsyncResult) -> None:
+ if janitor._exit_in_progress:
+ # During __exit__ we expect processes to stop, since
+ # they are killed by the janitor.
+ return
+
with janitor._processes_lock:
# Processes are expected to quit while the nursery is
# active, remove them from the track list to clear memory
@@ -146,6 +152,7 @@ class Janitor:
exc_value: Optional[BaseException],
traceback: Optional[TracebackType],
) -> Optional[bool]:
+ self._exit_in_progress = True
with self._processes_lock:
# Make sure to signal that we are exiting.
if not self._stop.done(): | Silence nodes killed by janitor
When the janitor reaches `__exit__`, it kills all nodes. We do not want
error messages for those, unless they fail at shutting down cleanly.
Closes <URL> | raiden-network_raiden | train | py |
54909296bca57f9bb74d4d00a6d08c91911e3b24 | diff --git a/tornado_botocore/base.py b/tornado_botocore/base.py
index <HASH>..<HASH> 100644
--- a/tornado_botocore/base.py
+++ b/tornado_botocore/base.py
@@ -1,8 +1,14 @@
import logging
from functools import partial
-from urlparse import urlparse
+try:
+ #python2
+ from urlparse import urlparse
+except ImportError:
+ #python3
+ from urllib.parse import urlparse
+
from requests.utils import get_environ_proxies
from tornado.httpclient import HTTPClient, AsyncHTTPClient, HTTPRequest, HTTPError | fix urlparse dependency to support python3
Addresses issue #<I> | nanvel_tornado-botocore | train | py |
58434d982571d9205ae1b3384016dec93aa74fea | diff --git a/src/main/java/com/rackspace/cloud/api/docs/WebHelpMojo.java b/src/main/java/com/rackspace/cloud/api/docs/WebHelpMojo.java
index <HASH>..<HASH> 100644
--- a/src/main/java/com/rackspace/cloud/api/docs/WebHelpMojo.java
+++ b/src/main/java/com/rackspace/cloud/api/docs/WebHelpMojo.java
@@ -274,7 +274,7 @@ public abstract class WebHelpMojo extends AbstractWebhelpMojo {
*
* @parameter
* expression="${generate-webhelp.security}"
- * default-value=""
+ * default-value="external"
*/
private String security;
@@ -523,7 +523,7 @@ public abstract class WebHelpMojo extends AbstractWebhelpMojo {
// if(null == webhelpWar || webhelpWar.equals("0")){
//TODO: Move dir to add warsuffix/security value
String sourceDir = result.getParentFile().getParentFile() + "/" + warBasename ;
- File webhelpDirWithSecurity = new File(result.getParentFile().getParentFile() + "/" + warBasename + properties.getProperty("warsuffix",""));
+ File webhelpDirWithSecurity = new File(result.getParentFile().getParentFile() + "/" + warBasename + "-" + this.security);
File webhelpOrigDir = new File(result.getParentFile().getParentFile() + "/" + warBasename );
boolean success = webhelpOrigDir.renameTo(webhelpDirWithSecurity);
//} | Add security value to webhelp dir name in all cases
to avoid situation where building an internal after an external
causes the external to be overwritten. | rackerlabs_clouddocs-maven-plugin | train | java |
8487a5571fe0d8f10efe33d024f9581bf27e8ee5 | diff --git a/src/pyrocore/scripts/base.py b/src/pyrocore/scripts/base.py
index <HASH>..<HASH> 100644
--- a/src/pyrocore/scripts/base.py
+++ b/src/pyrocore/scripts/base.py
@@ -327,7 +327,7 @@ class PromptDecorator(object):
"""
# Return code for Q)uit choice
- QUIT_RC = 3
+ QUIT_RC = error.EX_TEMPFAIL
def __init__(self, script_obj): | use exit code from 'error' | pyroscope_pyrocore | train | py |
1d63421c48e300bb10efc7ab7aa759e61ce8db3a | diff --git a/lib/srv/sess.go b/lib/srv/sess.go
index <HASH>..<HASH> 100644
--- a/lib/srv/sess.go
+++ b/lib/srv/sess.go
@@ -49,7 +49,7 @@ const (
var (
serverSessions = prometheus.NewGauge(
prometheus.GaugeOpts{
- Name: "server_interactive_sessions_total",
+ Name: teleport.MetricServerInteractiveSessions,
Help: "Number of active sessions",
},
)
@@ -563,8 +563,8 @@ func (s *session) PID() int {
// Close ends the active session forcing all clients to disconnect and freeing all resources
func (s *session) Close() error {
- serverSessions.Dec()
s.closeOnce.Do(func() {
+ serverSessions.Dec()
// closing needs to happen asynchronously because the last client
// (session writer) will try to close this session, causing a deadlock
// because of closeOnce | Only decrement server_interactive_sessions_total once per session
`session.Close` can get called multiple times, from different deferred
cleanups. The associated metric decrement should only happen on the
first call, to map 1:1 with increments.
Without this, we could end up with negative
`server_interactive_sessions_total` counts.
Fixes <URL> | gravitational_teleport | train | go |
bfc1bee061838c36eda3dd22db22d6996246a4ba | diff --git a/spec/integration/sqlite3_adapter_spec.rb b/spec/integration/sqlite3_adapter_spec.rb
index <HASH>..<HASH> 100644
--- a/spec/integration/sqlite3_adapter_spec.rb
+++ b/spec/integration/sqlite3_adapter_spec.rb
@@ -3,10 +3,14 @@ require Pathname(__FILE__).dirname.expand_path.parent + 'spec_helper'
require ROOT_DIR + 'lib/data_mapper'
+DB_PATH = __DIR__ + 'integration_test.db'
+
begin
require 'do_sqlite3'
- DataMapper.setup(:sqlite3, "sqlite3://#{__DIR__}/integration_test.db")
+ FileUtils.touch DB_PATH
+
+ DataMapper.setup(:sqlite3, "sqlite3://#{DB_PATH}")
describe DataMapper::Adapters::DataObjectsAdapter do | Updated specs to create the SQLite DB if it doesn't exist | datamapper_dm-core | train | rb |
71da423e4e2906dd7e7deab5bf0ec05aed0e3328 | diff --git a/packages/embark-ui/src/components/Console.js b/packages/embark-ui/src/components/Console.js
index <HASH>..<HASH> 100644
--- a/packages/embark-ui/src/components/Console.js
+++ b/packages/embark-ui/src/components/Console.js
@@ -108,7 +108,7 @@ class Console extends Component {
emptyLabel={false}
labelKey="value"
multiple={false}
- maxResults={10}
+ maxResults={20}
isLoading={this.state.isLoading}
onInputChange={(text) => this.handleChange(text)}
onChange={(text) => { | fix(cockpit/console): increase number of suggestions | embark-framework_embark | train | js |
9c5d75029a67a67fd564eea8cbc8117b81916692 | diff --git a/packages/browser/tests/processor/stacktracejs.test.js b/packages/browser/tests/processor/stacktracejs.test.js
index <HASH>..<HASH> 100644
--- a/packages/browser/tests/processor/stacktracejs.test.js
+++ b/packages/browser/tests/processor/stacktracejs.test.js
@@ -5,12 +5,16 @@ describe('stacktracejs processor', () => {
let error;
describe('Error', () => {
- beforeEach(() => {
+ function throwTestError() {
try {
throw new Error('BOOM');
} catch (err) {
error = espProcessor(err);
}
+ }
+
+ beforeEach(() => {
+ throwTestError();
});
it('provides type and message', () => {
@@ -24,7 +28,7 @@ describe('stacktracejs processor', () => {
let frame = backtrace[0];
expect(frame.file).toContain('tests/processor/stacktracejs.test');
- expect(frame.function).toBe('Object.<anonymous>');
+ expect(frame.function).toBe('throwTestError');
expect(frame.line).toEqual(expect.any(Number));
expect(frame.column).toEqual(expect.any(Number));
}); | Fix stacktrace test for node <I>
Node.js <I> is returning the function name as `'Object.beforeEach'`
rather than `'Object.<anonymous>'`. By moving the code that throws the
error out of an anonymous function and into a named function, we can
avoid this ambiguity. | airbrake_airbrake-js | train | js |
653ab2cc1f97df8f05c466e1d757e1c81fcc58f8 | diff --git a/commands/commandeer.go b/commands/commandeer.go
index <HASH>..<HASH> 100644
--- a/commands/commandeer.go
+++ b/commands/commandeer.go
@@ -369,12 +369,13 @@ func (c *commandeer) loadConfig() error {
c.configFiles = configFiles
var ok bool
+ loc := time.Local
c.languages, ok = c.Cfg.Get("languagesSorted").(langs.Languages)
- if !ok {
- panic("languages not configured")
+ if ok {
+ loc = langs.GetLocation(c.languages[0])
}
- err = c.initClock(langs.GetLocation(c.languages[0]))
+ err = c.initClock(loc)
if err != nil {
return err
} | commands: Fix case where languages cannot be configured
There are some commands that needs to complete without a complete configuration. | gohugoio_hugo | train | go |
75f1a8406908b62240dee0a4d805bedbf77b34b4 | diff --git a/lib/Cake/Controller/Component.php b/lib/Cake/Controller/Component.php
index <HASH>..<HASH> 100644
--- a/lib/Cake/Controller/Component.php
+++ b/lib/Cake/Controller/Component.php
@@ -120,8 +120,8 @@ class Component extends Object {
}
/**
- * Called after the Controller::beforeRender(), after the view class is loaded, and before the
- * Controller::render()
+ * Called before the Controller::beforeRender(), and before
+ * the view class is loaded, and before Controller::render()
*
* @param Controller $controller Controller with components to beforeRender
* @return void | Fix docs about ordering of callbacks.
Refs #GH-<I> | cakephp_cakephp | train | php |
afc1e0cce38e3c06473756ad2b1c5d16fdd50d98 | diff --git a/src/photoswipe.js b/src/photoswipe.js
index <HASH>..<HASH> 100644
--- a/src/photoswipe.js
+++ b/src/photoswipe.js
@@ -436,9 +436,9 @@
return;
}
- this.documentOverlay.resetPosition();
this.viewport.resetPosition();
this.slider.resetPosition();
+ this.documentOverlay.resetPosition();
this.caption.resetPosition();
this.toolbar.resetPosition(); | Very odd fix to get the orientation / resizing working in iPad. Changed to order in which re-positionning of sub elements works | dimsemenov_PhotoSwipe | train | js |
0191c65c2fb6dd9daa0a5c3b8759eadac4ada42f | diff --git a/src/main/java/org/rapidpm/ddi/scopes/InjectionScopeManager.java b/src/main/java/org/rapidpm/ddi/scopes/InjectionScopeManager.java
index <HASH>..<HASH> 100644
--- a/src/main/java/org/rapidpm/ddi/scopes/InjectionScopeManager.java
+++ b/src/main/java/org/rapidpm/ddi/scopes/InjectionScopeManager.java
@@ -108,6 +108,7 @@ public class InjectionScopeManager {
activeScopeNames.stream()
.forEach(InjectionScopeManager::removeScope);
+ // TODO: clean CLASS_NAME_2_SCOPENAME_MAP
}
public static void registerClassForScope(final Class clazz, final String scopeName) {
@@ -136,6 +137,7 @@ public class InjectionScopeManager {
public static void clearScope(final String scopeName) {
INJECTION_SCOPE_MAP.computeIfPresent(scopeName, (s, injectionScope) -> {
injectionScope.clear();
+ // TODO: clean CLASS_NAME_2_SCOPENAME_MAP
return injectionScope;
});
} | - added TODOs for Scope-Cleaning | svenruppert_dynamic-cdi | train | java |
a5758fbcfb413787d388ccf9112716d7104da5c0 | diff --git a/app/search_engines/bento_search/scopus_engine.rb b/app/search_engines/bento_search/scopus_engine.rb
index <HASH>..<HASH> 100644
--- a/app/search_engines/bento_search/scopus_engine.rb
+++ b/app/search_engines/bento_search/scopus_engine.rb
@@ -4,7 +4,7 @@ require 'nokogiri'
require 'http_client_patch/include_client'
require 'httpclient'
module BentoSearch
- # TODO: Sorting, Facets.
+ # Supports fielded searching, sorting, pagination.
#
# Required configuration:
# * api_key | comment fix, scopus supports more features now | jrochkind_bento_search | train | rb |
d71f62ec82eda83627b1a8978ccb1923889d8bba | diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -22,7 +22,7 @@ setup(
url='http://pyinvoke.org',
# Release requirements. See dev-requirements.txt for dev version reqs.
- requirements=['invoke>=0.6.0'],
+ requirements=['invoke>=0.6.0,<=0.9.0'],
packages=['invocations'], | Pin invoke requirement pending upcoming rejigger of config stuff | pyinvoke_invocations | train | py |
522eb49a853d6355d64a37f14eb2d9254c4527d4 | diff --git a/lib/rake.rb b/lib/rake.rb
index <HASH>..<HASH> 100755
--- a/lib/rake.rb
+++ b/lib/rake.rb
@@ -2037,10 +2037,10 @@ module Rake
yield
rescue SystemExit => ex
# Exit silently with current status
- exit(ex.status)
- rescue SystemExit, OptionParser::InvalidOption => ex
+ raise
+ rescue OptionParser::InvalidOption => ex
# Exit silently
- exit(1)
+ exit(false)
rescue Exception => ex
# Exit with error message
$stderr.puts "#{name} aborted!"
@@ -2051,7 +2051,7 @@ module Rake
$stderr.puts ex.backtrace.find {|str| str =~ /#{@rakefile}/ } || ""
$stderr.puts "(See full trace by running task with --trace)"
end
- exit(1)
+ exit(false)
end
end | Cleaned up the system exception handling and exit code. | ruby_rake | train | rb |
a6017a05067c84464f84c7d289aa3bd1ac2814b0 | diff --git a/control/HTTPResponse.php b/control/HTTPResponse.php
index <HASH>..<HASH> 100644
--- a/control/HTTPResponse.php
+++ b/control/HTTPResponse.php
@@ -44,6 +44,7 @@ class SS_HTTPResponse {
416 => 'Request Range Not Satisfiable',
417 => 'Expectation Failed',
422 => 'Unprocessable Entity',
+ 429 => 'Too Many Requests',
500 => 'Internal Server Error',
501 => 'Not Implemented',
502 => 'Bad Gateway', | API HTTP <I> Allowed for use with rate limiting methods | silverstripe_silverstripe-framework | train | php |
0ff25ac435d0e5996c33225de4796e46968acdbd | diff --git a/src/Moxl/Xec/Action/PubsubSubscription/Get.php b/src/Moxl/Xec/Action/PubsubSubscription/Get.php
index <HASH>..<HASH> 100644
--- a/src/Moxl/Xec/Action/PubsubSubscription/Get.php
+++ b/src/Moxl/Xec/Action/PubsubSubscription/Get.php
@@ -14,7 +14,7 @@ class Get extends Errors
public function request()
{
$this->store();
- Pubsub::getItems($this->_to, $this->_pepnode);
+ Pubsub::getItems($this->_to, $this->_pepnode, 1000);
}
public function setTo($to) | Don't paginate when getting the subscriptions | movim_moxl | train | php |
69d3929ae068a56a786adb1ec1e1aad6f49794ed | diff --git a/example/client/main.go b/example/client/main.go
index <HASH>..<HASH> 100644
--- a/example/client/main.go
+++ b/example/client/main.go
@@ -16,6 +16,7 @@ import (
func main() {
verbose := flag.Bool("v", false, "verbose")
tls := flag.Bool("tls", false, "activate support for IETF QUIC (work in progress)")
+ quiet := flag.Bool("q", false, "don't print the data")
flag.Parse()
urls := flag.Args()
@@ -57,8 +58,12 @@ func main() {
if err != nil {
panic(err)
}
- logger.Infof("Request Body:")
- logger.Infof("%s", body.Bytes())
+ if *quiet {
+ logger.Infof("Request Body: %d bytes", body.Len())
+ } else {
+ logger.Infof("Request Body:")
+ logger.Infof("%s", body.Bytes())
+ }
wg.Done()
}(addr)
} | add a quiet flag to the example client | lucas-clemente_quic-go | train | go |
8adbdb29e47cbb020f1a701cbaeaaee061dc8db2 | diff --git a/tests/server/blueprints/cases/test_cases_views.py b/tests/server/blueprints/cases/test_cases_views.py
index <HASH>..<HASH> 100644
--- a/tests/server/blueprints/cases/test_cases_views.py
+++ b/tests/server/blueprints/cases/test_cases_views.py
@@ -89,7 +89,7 @@ def test_reanalysis(app, institute_obj, case_obj, mocker, mock_redirect):
assert resp.status_code == 302
-def test_monitor(app, institute_obj, mocker, mock_redirect):
+def test_rerun_monitor(app, institute_obj, mocker, mock_redirect):
"""test case rerun monitoring function"""
mocker.patch("scout.server.blueprints.cases.views.redirect", return_value=mock_redirect) | Update tests/server/blueprints/cases/test_cases_views.py | Clinical-Genomics_scout | train | py |
2bc97a5748f053d57994acb01b78f8295ba27946 | diff --git a/pysat/_files.py b/pysat/_files.py
index <HASH>..<HASH> 100644
--- a/pysat/_files.py
+++ b/pysat/_files.py
@@ -336,15 +336,18 @@ class Files(object):
"""
keep_index = []
- for i, fi in enumerate(self.files):
+ for i, fname in enumerate(self.files):
# Create full path for each file
- full_name = os.path.join(path, fi)
+ full_fname = os.path.join(path, fname)
+
# Ensure it exists
- if os.path.exists(full_name) and (os.path.getsize(full_name) > 0):
- # Store if not empty
- keep_index.append(i)
+ if os.path.isfile(full_fname):
+ # Check for size
+ if os.path.getsize(full_fname) > 0:
+ # Store if not empty
+ keep_index.append(i)
- # Remove filenames for empty files as needed
+ # Remove filenames as needed
dropped_num = len(self.files.index) - len(keep_index)
if dropped_num > 0:
logger.warning(' '.join(('Removing {:d}'.format(dropped_num), | STY: Restored code clarity improvements | rstoneback_pysat | train | py |
5e484893a07bb478c0625ebf9c9ee9c7f10eb3e5 | diff --git a/lib/rack/handler/mongrel2.rb b/lib/rack/handler/mongrel2.rb
index <HASH>..<HASH> 100644
--- a/lib/rack/handler/mongrel2.rb
+++ b/lib/rack/handler/mongrel2.rb
@@ -42,9 +42,10 @@ module Rack
'rack.run_once' => false,
'mongrel2.pattern' => req.headers['PATTERN'],
'REQUEST_METHOD' => req.headers['METHOD'],
+ 'CONTENT_TYPE' => req.headers['content-type'],
'SCRIPT_NAME' => script_name,
'PATH_INFO' => req.headers['PATH'].gsub(script_name, ''),
- 'QUERY_STRING' => req.headers['QUERY'] || req.body || ''
+ 'QUERY_STRING' => req.headers['QUERY'] || ''
}
env['SERVER_NAME'], env['SERVER_PORT'] = req.headers['host'].split(':', 2) | forward content type header to rack request so put requests are properly handled | darkhelmet_rack-mongrel2 | train | rb |
d419efbe7186a2c0fcb6c4a056794a7b137cde5d | diff --git a/pkg/kubelet/config/file_linux_test.go b/pkg/kubelet/config/file_linux_test.go
index <HASH>..<HASH> 100644
--- a/pkg/kubelet/config/file_linux_test.go
+++ b/pkg/kubelet/config/file_linux_test.go
@@ -208,6 +208,10 @@ func getTestCases(hostname types.NodeName) []*testCase {
RestartPolicy: v1.RestartPolicyAlways,
DNSPolicy: v1.DNSClusterFirst,
TerminationGracePeriodSeconds: &grace,
+ Tolerations: []v1.Toleration{{
+ Operator: "Exists",
+ Effect: "NoExecute",
+ }},
Containers: []v1.Container{{
Name: "image",
Image: "test/image", | Fix unittest reflecting the default taint tolerations change for static
pods. | kubernetes_kubernetes | train | go |
6e17eb0b84c3b79335b7d8f7d7d9bd3a9d23d9ed | diff --git a/lib/resources/posts.js b/lib/resources/posts.js
index <HASH>..<HASH> 100644
--- a/lib/resources/posts.js
+++ b/lib/resources/posts.js
@@ -34,8 +34,7 @@ exports.index = function index(req, res) {
var next, prev;
var link = req.url + '?page=';
var query = req.xhr && req.session ? db.posts.all : db.posts.allPublished;
- var page = req.query.page ? parseInt(req.query.page, 10) : 1;
-
+ var page = req.query.page ? Number(req.query.page) : 1;
query(page, function(err, result) {
next = result.count - (result.limit + result.offset) > 0; | Refactored parseInt -> Number | shinuza_captain-core | train | js |
2b123ca913bf611682496974620bd423c382731d | diff --git a/test/test_base.rb b/test/test_base.rb
index <HASH>..<HASH> 100644
--- a/test/test_base.rb
+++ b/test/test_base.rb
@@ -35,7 +35,7 @@ class TestBase < Test::Unit::TestCase
@project_id = @config['iron_worker']['project_id']
# new style
IronWorker.configure do |config|
- config.beta=true
+ config.beta=false
config.token = @token
config.project_id = @project_id
config.host = @config['iron_worker']['host'] if @config['iron_worker']['host'] | Turned off beta by default. | iron-io_iron_worker_ruby | train | rb |
f94a8ccadf4305e748875e429f3fea11a1616648 | diff --git a/werkzeug/wrappers.py b/werkzeug/wrappers.py
index <HASH>..<HASH> 100644
--- a/werkzeug/wrappers.py
+++ b/werkzeug/wrappers.py
@@ -1010,6 +1010,10 @@ class BaseResponse(object):
be readable by the domain that set it.
:param path: limits the cookie to a given path, per default it will
span the whole domain.
+ :param secure: If `True`, the cookie will only be available via HTTPS
+ :param httponly: disallow JavaScript to access the cookie. This is an
+ extension to the cookie standard and probably not
+ supported by all browsers.
"""
self.headers.add('Set-Cookie', dump_cookie(key,
value=value, | Add missing param docs for BaseResponse.set_cookie
The `secure` and `httponly` params were undocumented, resulting in
incomplete documentation, for example, for Flask:
<URL> | pallets_werkzeug | train | py |
d78a95ac2990de598d54bf1120a6666e79483c98 | diff --git a/src/com/aoindustries/io/FileUtils.java b/src/com/aoindustries/io/FileUtils.java
index <HASH>..<HASH> 100644
--- a/src/com/aoindustries/io/FileUtils.java
+++ b/src/com/aoindustries/io/FileUtils.java
@@ -23,10 +23,12 @@
package com.aoindustries.io;
import java.io.BufferedInputStream;
+import java.io.BufferedReader;
import java.io.File;
import java.io.FileFilter;
import java.io.FileInputStream;
import java.io.FileOutputStream;
+import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InterruptedIOException;
@@ -361,4 +363,20 @@ final public class FileUtils {
}
}
}
+
+ /**
+ * Reads the contents of a File and returns as a String.
+ */
+ public static String readFileAsString(File file) throws IOException {
+ long len = file.length();
+ StringBuilder SB = len>0 && len<=Integer.MAX_VALUE ? new StringBuilder((int)len) : new StringBuilder();
+ BufferedReader in = new BufferedReader(new FileReader(file));
+ try {
+ int ch;
+ while((ch=in.read())!=-1) SB.append((char)ch);
+ } finally {
+ in.close();
+ }
+ return SB.toString();
+ }
} | Now null routing on FIFO errors (overruns) as well. | aoindustries_aocode-public | train | java |
03368ea8cc9b3e00634ee2c246f455053562b1d3 | diff --git a/treebeard/admin.py b/treebeard/admin.py
index <HASH>..<HASH> 100644
--- a/treebeard/admin.py
+++ b/treebeard/admin.py
@@ -3,7 +3,7 @@
import sys
from django.conf import settings
-from django.conf.urls import patterns, url
+from django.conf.urls import url
from django.contrib import admin, messages
from django.http import HttpResponse, HttpResponseBadRequest
diff --git a/treebeard/tests/urls.py b/treebeard/tests/urls.py
index <HASH>..<HASH> 100644
--- a/treebeard/tests/urls.py
+++ b/treebeard/tests/urls.py
@@ -1,10 +1,8 @@
-from django.conf.urls import patterns, include, url
+from django.conf.urls import include, url
from django.contrib import admin
admin.autodiscover()
-urlpatterns = patterns(
- '',
- # Uncomment the next line to enable the admin:
+urlpatterns = [
url(r'^admin/', include(admin.site.urls)),
-)
+] | Replace django.conf.urls.patterns with lists.
Django <I> dropped support for it and it has been deprecated since <I>:
<URL> | django-treebeard_django-treebeard | train | py,py |
bb23856754e8f07f132bbde33d26db9a73861248 | diff --git a/lib/daru/dataframe.rb b/lib/daru/dataframe.rb
index <HASH>..<HASH> 100644
--- a/lib/daru/dataframe.rb
+++ b/lib/daru/dataframe.rb
@@ -865,6 +865,13 @@ module Daru
self
end
+ # Deletes a list of vectors
+ def delete_vectors *vectors
+ Array(vectors).each { |vec| delete_vector vec }
+
+ self
+ end
+
# Delete a row
def delete_row index
idx = named_index_for index
diff --git a/spec/dataframe_spec.rb b/spec/dataframe_spec.rb
index <HASH>..<HASH> 100644
--- a/spec/dataframe_spec.rb
+++ b/spec/dataframe_spec.rb
@@ -1124,6 +1124,18 @@ describe Daru::DataFrame do
end
end
+ context "#delete_vectors" do
+ context Daru::Index do
+ it "deletes the specified vectors" do
+ @data_frame.delete_vectors :a, :b
+
+ expect(@data_frame).to eq(Daru::DataFrame.new({
+ c: [11,22,33,44,55]}, order: [:c],
+ index: [:one, :two, :three, :four, :five]))
+ end
+ end
+ end
+
context "#delete_row" do
it "deletes the specified row" do
@data_frame.delete_row :three | Adds a #delete_vectors method to DataFrame | SciRuby_daru | train | rb,rb |
0caff7cde422abeed2c30ab3007dd55460df922e | diff --git a/src/js/datePicker.js b/src/js/datePicker.js
index <HASH>..<HASH> 100644
--- a/src/js/datePicker.js
+++ b/src/js/datePicker.js
@@ -92,7 +92,9 @@ ch.datePicker = function (conf) {
"format": conf.format,
"from": conf.from,
"to": conf.to,
- "selected": conf.selected
+ "selected": conf.selected,
+ "monthsNames": conf.monthsNames,
+ "weekdays": conf.weekdays
});
/** | GH-<I> conf.monthsNames and conf.weekdays now reach to Calendar from Date Picker | mercadolibre_chico | train | js |
b5d897607ecbf06a6dcda12b8454fa4a702f7889 | diff --git a/taskw/warrior.py b/taskw/warrior.py
index <HASH>..<HASH> 100644
--- a/taskw/warrior.py
+++ b/taskw/warrior.py
@@ -501,6 +501,26 @@ class TaskWarriorShellout(TaskWarriorBase):
return results
def filter_tasks(self, filter_dict):
+ """ Return a filtered list of tasks from taskwarrior.
+
+ Filter dict should be a dictionary mapping filter constraints
+ with their values. For example, to return only pending tasks,
+ you could use::
+
+ {'status': 'pending'}
+
+ Or, to return tasks that have the word "Abjad" in their description
+ that are also pending::
+
+ {
+ 'status': 'pending',
+ 'description.contains': 'Abjad',
+ }
+
+ Filters can be quite complex, and are documented on Taskwarrior's
+ website.
+
+ """
query_args = taskw.utils.encode_query(filter_dict)
return self._get_json(
'export', | Adding a docstring. | ralphbean_taskw | train | py |
2d9fc44a1f79c4dec6849a1a6436a85eed8881a0 | diff --git a/tasks/lib/compress.js b/tasks/lib/compress.js
index <HASH>..<HASH> 100644
--- a/tasks/lib/compress.js
+++ b/tasks/lib/compress.js
@@ -82,6 +82,7 @@ module.exports = function(grunt) {
exports.tar = function(files, done) {
if (typeof exports.options.archive !== 'string' || exports.options.archive.length === 0) {
grunt.fail.warn('Unable to compress; no valid archive file was specified.');
+ return;
}
var mode = exports.options.mode;
@@ -132,7 +133,8 @@ module.exports = function(grunt) {
var fstat = fileStatSync(srcFile);
if (!fstat) {
- grunt.fail.fatal('unable to stat srcFile (' + srcFile + ')');
+ grunt.fail.warn('unable to stat srcFile (' + srcFile + ')');
+ return;
}
var internalFileName = (isExpandedPair) ? file.dest : exports.unixifyPath(path.join(file.dest || '', srcFile));
@@ -164,6 +166,7 @@ module.exports = function(grunt) {
archive.append(null, fileData);
} else {
grunt.fail.warn('srcFile (' + srcFile + ') should be a valid file or directory');
+ return;
}
sourcePaths[internalFileName] = srcFile; | allow for forcing through fail.warn within loop. | gruntjs_grunt-contrib-compress | train | js |
37e30171b919134aa29657a35f29148127ad1552 | diff --git a/lib/utils.js b/lib/utils.js
index <HASH>..<HASH> 100644
--- a/lib/utils.js
+++ b/lib/utils.js
@@ -160,6 +160,29 @@ exports.getFreeSpace = function(path, callback) {
};
/**
+ * Checks whether a port is currently in use or open
+ * Callback is of form (err, result)
+ * @param {Number} port
+ */
+exports.portIsOpen = function(port, callback) {
+ let testServer = net.createServer()
+ .once('error', function(err) {
+ if(err.code === 'EADDRINUSE') {
+ callback(null, false);
+ } else {
+ callback(err);
+ }
+ })
+ .once('listening', function() {
+ testServer.once('close', function() {
+ callback(null, true);
+ })
+ .close();
+ })
+ .listen(port);
+};
+
+/**
* Checks the status of the daemon RPC server
* @param {Number} port
*/ | Added util method portIsOpen | storj_storjshare-daemon | train | js |
dc1785d39d0015b0d41676c7eddc304beee6bbb4 | diff --git a/examples/laravel-api/config/laravel-auth0.php b/examples/laravel-api/config/laravel-auth0.php
index <HASH>..<HASH> 100644
--- a/examples/laravel-api/config/laravel-auth0.php
+++ b/examples/laravel-api/config/laravel-auth0.php
@@ -10,7 +10,7 @@ return array(
|
*/
- // 'domain' => 'XXXX.auth0.com',
+ 'domain' => getenv('AUTH0_DOMAIN'),
/*
|--------------------------------------------------------------------------
| Your APP id
@@ -19,7 +19,7 @@ return array(
|
*/
- // 'client_id' => 'XXXX',
+ 'client_id' => getenv('AUTH0_CLIENT_ID'),
/*
|--------------------------------------------------------------------------
@@ -28,7 +28,7 @@ return array(
| As set in the auth0 administration page
|
*/
- // 'client_secret' => 'XXXXX',
+ 'client_secret' => getenv('AUTH0_CLIENT_SECRET'),
/*
@@ -40,7 +40,7 @@ return array(
|
*/
- // 'redirect_uri' => 'http://<host>/auth0/callback'
+ 'redirect_uri' => getenv('AUTH0_CALLBACK_URL') | changed to load the .env file | auth0_laravel-auth0 | train | php |
eb0858a1627f8d58456020d20c74c75830c67c11 | diff --git a/oauthlib/oauth1/rfc5849/signature.py b/oauthlib/oauth1/rfc5849/signature.py
index <HASH>..<HASH> 100644
--- a/oauthlib/oauth1/rfc5849/signature.py
+++ b/oauthlib/oauth1/rfc5849/signature.py
@@ -157,8 +157,9 @@ def sign_hmac_sha1(base_string, client_secret, resource_owner_secret):
.. _`section 3.4.2`: http://tools.ietf.org/html/rfc5849#section-3.4.2
"""
- key = '&'.join((utils.escape(client_secret),
- utils.escape(resource_owner_secret)))
+ key = '&'.join((utils.escape(client_secret or u''),
+ utils.escape(resource_owner_secret or u'')))
+
signature = hmac.new(key, base_string, hashlib.sha1)
return binascii.b2a_base64(signature.digest())[:-1].decode('utf-8') | Allow empty secrets when generating the OAuth1 HMAC SHA1 Signature.
Previously the secrets would be 'None' and would cause utils.escape
to throw an except. | oauthlib_oauthlib | train | py |
ef045b971834a34e5181f8e2eeac34644e2ede41 | diff --git a/acorn_loose.js b/acorn_loose.js
index <HASH>..<HASH> 100644
--- a/acorn_loose.js
+++ b/acorn_loose.js
@@ -131,22 +131,9 @@
fetchToken.jumpTo(pos, reAllowed);
}
- function copyToken(token) {
- var copy = {start: token.start, end: token.end, type: token.type, value: token.value};
- if (options.locations) {
- copy.startLoc = token.startLoc;
- copy.endLoc = token.endLoc;
- }
- return copy;
- }
-
function lookAhead(n) {
- // Copy token objects, because fetchToken will overwrite the one
- // it returns, and in this case we still need it
- if (!ahead.length)
- token = copyToken(token);
while (n > ahead.length)
- ahead.push(copyToken(readToken()));
+ ahead.push(readToken());
return ahead[n-1];
} | Remove `copyToken` from acorn_loose (not needed anymore). | babel_babylon | train | js |
546f47edcc4f6ccf4e4ffc049e5db74ee8462dfd | diff --git a/escpos/escpos.py b/escpos/escpos.py
index <HASH>..<HASH> 100644
--- a/escpos/escpos.py
+++ b/escpos/escpos.py
@@ -146,6 +146,7 @@ class Escpos:
i = 0
temp = 0
self._raw(binascii.unhexlify(bytes(buf, "ascii")))
+ self._raw('\n')
def qr(self,text): | Fix text wrapping error after image
* After an image the text wrapping was disturbed. | python-escpos_python-escpos | train | py |
6b61723ae2f4acbe35367b94cc5bd34ff72b8af7 | diff --git a/experiments/templatetags/experiments.py b/experiments/templatetags/experiments.py
index <HASH>..<HASH> 100644
--- a/experiments/templatetags/experiments.py
+++ b/experiments/templatetags/experiments.py
@@ -101,7 +101,7 @@ def experiment(parser, token):
return ExperimentNode(node_list, experiment_name, alternative, weight, user_variable)
[email protected]_tag(takes_context=True)
[email protected]_tag(takes_context=True)
def experiment_enroll(context, experiment_name, *alternatives, **kwargs):
if 'user' in kwargs:
user = participant(user=kwargs['user']) | Replace assignment_tag with simple_tag | mixcloud_django-experiments | train | py |
02a0f642da07123023bd34ce78fd785e92ed611a | diff --git a/templates/releaf/installer.rb b/templates/releaf/installer.rb
index <HASH>..<HASH> 100644
--- a/templates/releaf/installer.rb
+++ b/templates/releaf/installer.rb
@@ -35,6 +35,7 @@ gsub_file "config/database.yml", /database: dummy_/, "database: #{db_name}_"
gsub_file "config/database.yml", /password:/, "password: #{db_password}" if db_password.present?
gsub_file 'config/boot.rb', "'../../Gemfile'", "'../../../../Gemfile'"
+append_file 'config/initializers/assets.rb', "Rails.application.config.assets.precompile += %w( releaf/*.css releaf/*.js )"
files_to_remove = %w[
public/index.html | Append releaf precompile assets for dummy application | cubesystems_releaf | train | rb |
e69edf72a9cc592bd00e06234d2f08c6c496f50e | diff --git a/textract/parsers/__init__.py b/textract/parsers/__init__.py
index <HASH>..<HASH> 100644
--- a/textract/parsers/__init__.py
+++ b/textract/parsers/__init__.py
@@ -18,11 +18,16 @@ def process(filename, **kwargs):
# is a relative import so the name of the package is necessary
root, ext = os.path.splitext(filename)
ext = ext.lower()
-
- # to avoid conflicts with packages that are installed globally
- # (e.g. python's json module), all extension parser modules have
- # the _parser extension
- module = ext + '_parser'
+
+ # if the extension is a known image type, use the tesseract parser
+ if(ext in ['.gif','.png','.jpg','.jpeg']):
+ module = '.tesseract_parser'
+ else:
+ # to avoid conflicts with packages that are installed globally
+ # (e.g. python's json module), all extension parser modules have
+ # the _parser extension
+ module = ext + '_parser'
+
try:
filetype_module = importlib.import_module(module, 'textract.parsers')
except ImportError, e: | tesseract for gif,png,jpg support | deanmalmgren_textract | train | py |
2e18ad82ab5ebae4c1dc6b83d14c125b7cdbc176 | diff --git a/src/share/classes/javax/lang/model/type/IntersectionType.java b/src/share/classes/javax/lang/model/type/IntersectionType.java
index <HASH>..<HASH> 100644
--- a/src/share/classes/javax/lang/model/type/IntersectionType.java
+++ b/src/share/classes/javax/lang/model/type/IntersectionType.java
@@ -37,7 +37,9 @@ import java.util.List;
* RELEASE_8}, this is represented by an {@code IntersectionType} with
* {@code Number} and {@code Runnable} as its bounds.
*
- * @implNote Also as of {@link
+ * <!-- "@implNote" changed to "Implementation note:" in jsr308-langtools
+ * because javadoc fails with a warning about @implNote -->
+ * Implementation note: Also as of {@link
* javax.lang.model.SourceVersion#RELEASE_8 RELEASE_8}, in the
* reference implementation an {@code IntersectionType} is used to
* model the explicit target type of a cast expression. | Don't just Java-8-only Javadoc tag | wmdietl_jsr308-langtools | train | java |
a4d10299dc23d92c57aff5b1e46b0ebc63f4464e | diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -68,6 +68,8 @@ setup(
'Intended Audience :: Developers',
'Intended Audience :: System Administrators',
'Operating System :: OS Independent',
+ 'Programming Language :: Python :: 2',
+ 'Programming Language :: Python :: 3',
'Topic :: Software Development'
],
) | Indicate Python 3 support in setup.py | getsentry_responses | train | py |
d167e0d22cad2dbde7f078f33a67329bb93fca3d | diff --git a/src/JoomlaBrowser.php b/src/JoomlaBrowser.php
index <HASH>..<HASH> 100644
--- a/src/JoomlaBrowser.php
+++ b/src/JoomlaBrowser.php
@@ -123,6 +123,7 @@ class JoomlaBrowser extends WebDriver
$I->amOnPage('/index.php?option=com_users&view=login');
$this->debug('I click Logout button');
$I->click(['xpath' => "//div[@class='logout']//button[contains(text(), 'Log out')]"]);
+ $I->amOnPage('/index.php?option=com_users&view=login');
$this->debug('I wait to see Login form');
$I->waitForElement(['xpath' => "//div[@class='login']//button[contains(text(), 'Log in')]"], 30);
$I->seeElement(['xpath' => "//div[@class='login']//button[contains(text(), 'Log in')]"]); | [Fix] doFrontendLogout()
Fixes redirect issue after logging out in J<I>.x | joomla-projects_joomla-browser | train | php |
7024d1e52181424191b81ebcae036af8216bcc5a | diff --git a/src/main/groovy/util/GroovyTestCase.java b/src/main/groovy/util/GroovyTestCase.java
index <HASH>..<HASH> 100644
--- a/src/main/groovy/util/GroovyTestCase.java
+++ b/src/main/groovy/util/GroovyTestCase.java
@@ -65,6 +65,7 @@ import org.codehaus.groovy.runtime.InvokerHelper;
*/
public class GroovyTestCase extends TestCase {
+ protected Logger log = Logger.getLogger(getClass().getName());
private static int counter;
private boolean useAgileDoxNaming = false; | Oops, the logger was needed :-)
git-svn-id: <URL> | apache_groovy | train | java |
f40b6015f04504fd6142c8a1230d1b24d038ba20 | diff --git a/lib/fluent/configurable.rb b/lib/fluent/configurable.rb
index <HASH>..<HASH> 100644
--- a/lib/fluent/configurable.rb
+++ b/lib/fluent/configurable.rb
@@ -105,6 +105,10 @@ module Fluent
configure_proxy(self.name).config_set_default(name, defval)
end
+ def config_set_desc(name, desc)
+ configure_proxy(self.name).config_set_desc(name, desc)
+ end
+
def config_section(name, *args, &block)
configure_proxy(self.name).config_section(name, *args, &block)
attr_accessor configure_proxy(self.name).sections[name].param_name | Add `config_set_desc`
We can write description of plugin parameter as following:
```
class Fluent::SomeInput < Fluent::Input
config_set_desc :tag, "This value is the tag assigned to the generated events."
config_param :tag, :string
end
``` | fluent_fluentd | train | rb |
63d921b8d037d4aea8d702fe83eea2eaedf6077b | diff --git a/invenio_app/celery.py b/invenio_app/celery.py
index <HASH>..<HASH> 100644
--- a/invenio_app/celery.py
+++ b/invenio_app/celery.py
@@ -15,7 +15,8 @@ from flask_celeryext import create_celery_app
from .factory import create_ui
celery = create_celery_app(create_ui(
- SENTRY_TRANSPORT='raven.transport.http.HTTPTransport'
+ SENTRY_TRANSPORT='raven.transport.http.HTTPTransport',
+ RATELIMIT_ENABLED=False,
))
"""Celery application for Invenio. | fix: disable ratelimit for celery
When ratelimit is enabled celery tasks that simulate request context i.e oaiserver will fail. | inveniosoftware_invenio-app | train | py |
41f69337f82fc81a379620d433765e742b672166 | diff --git a/hazelcast/src/main/java/com/hazelcast/config/PartitionGroupConfig.java b/hazelcast/src/main/java/com/hazelcast/config/PartitionGroupConfig.java
index <HASH>..<HASH> 100644
--- a/hazelcast/src/main/java/com/hazelcast/config/PartitionGroupConfig.java
+++ b/hazelcast/src/main/java/com/hazelcast/config/PartitionGroupConfig.java
@@ -87,7 +87,9 @@ import static com.hazelcast.util.ValidationUtil.isNotNull;
* </code>
*
* <h1>Per Member Partition Groups</h1>
- * In this partition group configuration, no effort is made to put the primary and backups on a separate physical Member.
+ * The default partition scheme. This means each Member is in a group of its own.
+ * <p/>
+ * Partitions (primaries and backups) will be distributed randomly but on the same physical Member.
*/
public class PartitionGroupConfig { | Put in descripton for PER_MEMBER | hazelcast_hazelcast | train | java |
239e50f30d251fbaf662477b854c36c34284ad1f | diff --git a/salt/cloud/clouds/digital_ocean_v2.py b/salt/cloud/clouds/digital_ocean_v2.py
index <HASH>..<HASH> 100644
--- a/salt/cloud/clouds/digital_ocean_v2.py
+++ b/salt/cloud/clouds/digital_ocean_v2.py
@@ -169,7 +169,11 @@ def list_nodes(call=None):
'state': str(node['status']),
}
page += 1
- fetch = 'next' in items['links']['pages']
+ try:
+ fetch = 'next' in items['links']['pages']
+ except KeyError:
+ fetch = False
+
return ret | Fixing KeyError when there are no additional pages | saltstack_salt | train | py |
acb1ad9fd9555daec098ff9186279ade76f2c040 | diff --git a/lib/modules/migration/lib/migrationState.js b/lib/modules/migration/lib/migrationState.js
index <HASH>..<HASH> 100644
--- a/lib/modules/migration/lib/migrationState.js
+++ b/lib/modules/migration/lib/migrationState.js
@@ -27,7 +27,7 @@ module.exports = function(self,deps){
this.err = dbModel.errors;
}
var ddlSyncOne = function(dbname, scheme){
- return deps.databases.getDatabase(dbname).then(function(db){
+ return deps.database.getDatabase(dbname).then(function(db){
var def = Q.defer();
if (dbg) console.log("Syncing "+dbname);
var sync = new Sync({ | migrationState.js err in getDatabase | Kreees_muon | train | js |
f01d53b20f1f31aad3d3a1ca6b27f02a25cfc03d | diff --git a/cmd/disk-cache-backend.go b/cmd/disk-cache-backend.go
index <HASH>..<HASH> 100644
--- a/cmd/disk-cache-backend.go
+++ b/cmd/disk-cache-backend.go
@@ -583,8 +583,9 @@ func (c *diskCache) bitrotReadFromCache(ctx context.Context, filePath string, of
if _, err := io.Copy(writer, bytes.NewReader((*bufp)[blockOffset:blockOffset+blockLength])); err != nil {
if err != io.ErrClosedPipe {
logger.LogIf(ctx, err)
+ return err
}
- return err
+ eof = true
}
if eof {
break | cache: do not evict entry on ErrClosedPipe (#<I>)
Fixes: #<I>. If client prematurely closes the read end of the pipe,
cache entry should not be evicted. | minio_minio | train | go |
dee8e51118879bb233e4f212b45f0c37e42dae79 | diff --git a/src/extensions/layout/cose.js b/src/extensions/layout/cose.js
index <HASH>..<HASH> 100644
--- a/src/extensions/layout/cose.js
+++ b/src/extensions/layout/cose.js
@@ -503,7 +503,7 @@ CoseLayout.prototype.run = function(){
// If both centers are the same, do nothing.
// A random force has already been applied as node repulsion
if( 0 === directionX && 0 === directionY ){
- return;
+ continue;
}
// Get clipping points for both nodes | Merge pull request #<I> from khalwa/cose-layout-fix
Changed return statement to continue in order to not break calculatio… | cytoscape_cytoscape.js | train | js |
0169970ce1101a546f65ee55995073ade8d656b5 | diff --git a/test/unit/TestIOSXRDriver.py b/test/unit/TestIOSXRDriver.py
index <HASH>..<HASH> 100644
--- a/test/unit/TestIOSXRDriver.py
+++ b/test/unit/TestIOSXRDriver.py
@@ -27,9 +27,7 @@ class TestConfigIOSXRDriver(unittest.TestCase, TestConfigNetworkDriver):
password = 'vagrant'
cls.vendor = 'iosxr'
- optional_args = {
- 'port': 12202,
- }
+ optional_args = {'port': 12202,}
cls.device = IOSXRDriver(hostname, username, password, timeout=60, optional_args=optional_args)
cls.device.open()
cls.device.load_replace_candidate(filename='%s/initial.conf' % cls.vendor)
@@ -56,6 +54,7 @@ class TestGetterIOSXRDriver(unittest.TestCase, TestGettersNetworkDriver):
class FakeIOSXRDevice:
+
@staticmethod
def read_txt_file(filename):
with open(filename) as data_file: | Files have been YAPFed | napalm-automation_napalm | train | py |
6ae95aa6aaaa1ddc625fc55d1091754341783484 | diff --git a/aws/structure.go b/aws/structure.go
index <HASH>..<HASH> 100644
--- a/aws/structure.go
+++ b/aws/structure.go
@@ -3021,8 +3021,22 @@ func flattenCognitoUserPoolSchema(configuredAttributes, inputs []*cognitoidentit
}
}
}
- if !configured && cognitoUserPoolSchemaAttributeMatchesStandardAttribute(input) {
- continue
+ if !configured {
+ if cognitoUserPoolSchemaAttributeMatchesStandardAttribute(input) {
+ continue
+ }
+ // When adding a Cognito Identity Provider, the API will automatically add an "identities" attribute
+ identitiesAttribute := cognitoidentityprovider.SchemaAttributeType{
+ AttributeDataType: aws.String(cognitoidentityprovider.AttributeDataTypeString),
+ DeveloperOnlyAttribute: aws.Bool(false),
+ Mutable: aws.Bool(true),
+ Name: aws.String("identities"),
+ Required: aws.Bool(false),
+ StringAttributeConstraints: &cognitoidentityprovider.StringAttributeConstraintsType{},
+ }
+ if reflect.DeepEqual(*input, identitiesAttribute) {
+ continue
+ }
}
var value = map[string]interface{}{ | resource/aws_cognito_user_pool: Ignore automatically added identities attribute in schema attributes | terraform-providers_terraform-provider-aws | train | go |
Subsets and Splits