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 |
|---|---|---|---|---|---|
6dfe504a5c6e7f1927be92b99724dd4565bbd945 | diff --git a/src/jquery.fancytree.clones.js b/src/jquery.fancytree.clones.js
index <HASH>..<HASH> 100644
--- a/src/jquery.fancytree.clones.js
+++ b/src/jquery.fancytree.clones.js
@@ -230,7 +230,7 @@ $.ui.fancytree._FancytreeNodeClass.prototype.reRegister = function(key, refKey){
// Key has changed: update all references
if( key != null && key !== this.key ) {
if( keyMap[key] ) {
- $.error("[ext-clones] reRegister(" + key + "): already exists.");
+ $.error("[ext-clones] reRegister(" + key + "): already exists: " + this);
}
// Update keyMap
delete keyMap[prevKey];
@@ -371,7 +371,7 @@ $.ui.fancytree.registerExtension({
if( add ) {
if( keyMap[node.key] != null ) {
- $.error("clones.treeRegisterNode: node.key already exists: " + node.key);
+ $.error("clones.treeRegisterNode: node.key already exists: " + node);
}
keyMap[key] = node;
if( refKey ) { | Improve logging for ext-clones | mar10_fancytree | train | js |
fc807acc0400e2693b3adc06900de89337a4c93c | diff --git a/contrib/benchmark.py b/contrib/benchmark.py
index <HASH>..<HASH> 100755
--- a/contrib/benchmark.py
+++ b/contrib/benchmark.py
@@ -19,12 +19,6 @@ from benchexec import __version__ # noqa E402
import benchexec.benchexec # noqa E402
import benchexec.tools # noqa E402
-# Add ./benchmark/tools to __path__ of benchexec.tools package
-# such that additional tool-wrapper modules can be placed in this directory.
-benchexec.tools.__path__ = [
- os.path.join(os.path.dirname(__file__), "benchmark", "tools")
-] + benchexec.tools.__path__
-
class Benchmark(BenchmarkBase):
"""
@@ -32,16 +26,13 @@ class Benchmark(BenchmarkBase):
"""
def load_executor(self):
- if self.config.cloud:
- import vcloud.benchmarkclient_executor as executor
-
- logging.debug(
- "This is vcloud-benchmark.py (based on benchexec %s) "
- "using the VerifierCloud internal API.",
- __version__,
- )
- else:
- executor = super(Benchmark, self).load_executor()
+ import vcloud.benchmarkclient_executor as executor
+
+ logging.debug(
+ "This is vcloud-benchmark.py (based on benchexec %s) "
+ "using the VerifierCloud internal API.",
+ __version__,
+ )
return executor | removed explicit tool paths, and using only cloud executor | sosy-lab_benchexec | train | py |
aa8eddadf82d4a3c64cfcd6771813ede2bd6b0b4 | diff --git a/src/Client.php b/src/Client.php
index <HASH>..<HASH> 100644
--- a/src/Client.php
+++ b/src/Client.php
@@ -11,7 +11,6 @@ use Interop\Container\ContainerInterface;
use Psr\Http\Message\RequestInterface;
use Psr\Http\Message\ResponseInterface;
use React\EventLoop\LoopInterface;
-use React\EventLoop\Timer\TimerInterface;
use React\Promise\CancellablePromiseInterface;
use React\Promise\PromiseInterface;
use function React\Promise\reject;
@@ -150,25 +149,6 @@ class Client
});
}
- protected function streamBody(Response $response)
- {
- $stream = $response->getResponse()->getBody();
- $this->loop->addPeriodicTimer(0.001, function (TimerInterface $timer) use ($stream, $response) {
- if ($stream->eof()) {
- $timer->cancel();
- $response->emit('end');
- return;
- }
-
- $size = $stream->getSize();
- if ($size === 0) {
- return;
- }
-
- $response->emit('data', [$stream->read($size)]);
- });
- }
-
protected function applyApiSettingsToRequest(RequestInterface $request): RequestInterface
{
$uri = $request->getUri(); | Removed streamBody since we stream by default now | php-api-clients_transport | train | php |
47445e7b0d91587e8b53be5d52cc4f695e908cd7 | diff --git a/lib/groupme/client.rb b/lib/groupme/client.rb
index <HASH>..<HASH> 100644
--- a/lib/groupme/client.rb
+++ b/lib/groupme/client.rb
@@ -3,13 +3,11 @@
module GroupMe
class Client
API_BASE_URL = 'https://api.groupme.com/v3/'
+ API_DEFAULT_HEADER = { 'Content-Type': 'application/json' }.freeze
def initialize(access_token:)
@access_token = access_token
- @client = HTTPClient.new do |config|
- config.base_url = API_BASE_URL
- config.default_header = { 'Content-Type': 'application/json' }
- end
+ @client = HTTPClient.new(base_url: API_BASE_URL, default_header: API_DEFAULT_HEADER)
end
def request(method, path, query: {}, body: {}) | Update client class to be more readable | kinnell_groupme-ruby-gem | train | rb |
c7b9b30e3d7388f3f9d607281986c98c63bb2739 | diff --git a/src/Enum.php b/src/Enum.php
index <HASH>..<HASH> 100644
--- a/src/Enum.php
+++ b/src/Enum.php
@@ -188,7 +188,7 @@ abstract class Enum
*/
final public static function byValue($value)
{
- if (!isset(self::$names[static::class])) {
+ if (!isset(self::$constants[static::class])) {
self::detectConstants(static::class);
} | Less diff var usage on Enum::byValue() | marc-mabe_php-enum | train | php |
a13710bb3b0bb4409dd3d1f3dd7f02731ddb8d38 | diff --git a/src/layertree/component.js b/src/layertree/component.js
index <HASH>..<HASH> 100644
--- a/src/layertree/component.js
+++ b/src/layertree/component.js
@@ -2,6 +2,7 @@ goog.provide('ngeo.layertree.component');
goog.require('ngeo'); // nowebpack
goog.require('ngeo.layertree.Controller');
+// webpack: import 'bootstrap/js/collapse.js'; // needed to collapse a layertree
/** | Add missing dependency on Bootstrap collapse | camptocamp_ngeo | train | js |
d3f69d95e03840bc462620cfbcd56843fc5aff0c | diff --git a/tests/test_sklearn_transform.py b/tests/test_sklearn_transform.py
index <HASH>..<HASH> 100644
--- a/tests/test_sklearn_transform.py
+++ b/tests/test_sklearn_transform.py
@@ -5,11 +5,8 @@ import numpy as np
from sklearn.base import BaseEstimator, TransformerMixin
from sklearn.feature_selection import SelectPercentile, SelectKBest
from sklearn.pipeline import FeatureUnion
-from sklearn.datasets import load_iris
from eli5 import transform_feature_names
-iris_X, iris_y = load_iris(return_X_y=True)
-
class MyFeatureExtractor(BaseEstimator, TransformerMixin):
def fit(self, X, y=None):
@@ -36,8 +33,9 @@ def selection_score_func(X, y):
('p', SelectPercentile(selection_score_func, 40))]),
['k:<NAME1>', 'k:<NAME2>', 'p:<NAME2>']),
])
-def test_transform_feature_names_iris(transformer, expected):
- transformer.fit(iris_X, iris_y)
+def test_transform_feature_names_iris(transformer, expected, iris_train):
+ X, y, _, _ = iris_train
+ transformer.fit(X, y)
# Test in_names being provided
assert (transform_feature_names(transformer,
['<NAME0>', '<NAME1>', '<NAME2>']) | TST small cleanup: use pytest fixtures. See GH-<I>. | TeamHG-Memex_eli5 | train | py |
f15ff0596c0fdca3857411908b30d8c4bccec817 | diff --git a/src/Plugin.php b/src/Plugin.php
index <HASH>..<HASH> 100644
--- a/src/Plugin.php
+++ b/src/Plugin.php
@@ -151,6 +151,13 @@ class Plugin implements PluginInterface, EventSubscriberInterface
return;
}
+ $workingDir = dirname($composerFile);
+ $grumPhpFile = $workingDir . DIRECTORY_SEPARATOR . 'grumphp.yml';
+
+ if (file_exists($grumPhpFile)) {
+ unlink($grumPhpFile);
+ }
+
if (!array_key_exists('extra', $definition)) {
$definition['extra'] = [];
} | Make sure fresh installs do not have a grumphp.yml in the project root | mediact_testing-suite | train | php |
e600edccf14a45411ce59585c46353316bb94b39 | diff --git a/src/Event/EventLDProjector.php b/src/Event/EventLDProjector.php
index <HASH>..<HASH> 100644
--- a/src/Event/EventLDProjector.php
+++ b/src/Event/EventLDProjector.php
@@ -121,12 +121,16 @@ class EventLDProjector extends Projector
$document = $this->loadDocumentFromRepository($tagErased);
$eventLd = $document->getBody();
- $eventLd->concept = (object)array_filter(
- (array)$eventLd->concept,
+
+ $eventLd->concept = array_filter(
+ $eventLd->concept,
function ($keyword) use ($tagErased) {
return $keyword !== (string)$tagErased->getKeyword();
}
);
+ // Ensure array keys start with 0 so json_encode() does encode it
+ // as an array and not as an object.
+ $eventLd->concept = array_values($eventLd->concept);
$this->repository->save($document->withBody($eventLd));
} | Slightly better fix for the concept object vs. array encoding problem | cultuurnet_udb3-php | train | php |
717e8563efd815a9dd4a5e94badb94376c21d3df | diff --git a/django_extensions/db/fields/json.py b/django_extensions/db/fields/json.py
index <HASH>..<HASH> 100644
--- a/django_extensions/db/fields/json.py
+++ b/django_extensions/db/fields/json.py
@@ -17,12 +17,12 @@ from django.conf import settings
from django.core.serializers.json import DjangoJSONEncoder
try:
- # Django <= 1.6 backwards compatibility
- from django.utils import simplejson as json
-except ImportError:
# Django >= 1.7
import json
-
+except ImportError:
+ # Django <= 1.6 backwards compatibility
+ from django.utils import simplejson as json
+
def dumps(value):
return DjangoJSONEncoder().encode(value) | Try to import json before simplejson
Follow up for #<I> and #<I>
So that we don't get the deprecation warning on django <I> and python >= <I> (since it supports json) | django-extensions_django-extensions | train | py |
499893352f7ae2fa8046370aa56adced4bfb74e7 | diff --git a/src/Core/Framework/DataAbstractionLayer/Dbal/EntityAggregator.php b/src/Core/Framework/DataAbstractionLayer/Dbal/EntityAggregator.php
index <HASH>..<HASH> 100644
--- a/src/Core/Framework/DataAbstractionLayer/Dbal/EntityAggregator.php
+++ b/src/Core/Framework/DataAbstractionLayer/Dbal/EntityAggregator.php
@@ -167,6 +167,8 @@ class EntityAggregator implements EntityAggregatorInterface
$query = new QueryBuilder($this->connection);
$query = $this->buildQueryByCriteria($query, $definition, $clone, $context);
+ $query->resetQueryPart('orderBy');
+
$this->addIdCondition($criteria, $definition, $query);
$table = $definition->getEntityName(); | NEXT-<I> - Reset _score sorting when fetching aggregations | shopware_platform | train | php |
1401d14eb673074c2a6a021af89768e2fc7a7b71 | diff --git a/server/bin.js b/server/bin.js
index <HASH>..<HASH> 100644
--- a/server/bin.js
+++ b/server/bin.js
@@ -6,10 +6,10 @@ var express = require('express'),
path = require('path'),
socket = require('./socket'),
api = require('./')
+ .use(express.static(path.join(__dirname, '../dist')))
.use(express.static(path.join(__dirname, '../.tmp')))
- .use(express.static(path.join(__dirname, '../app')))
- .use(express.static(path.join(__dirname, '../dist')));
+ .use(express.static(path.join(__dirname, '../app')));
var server = http.createServer(api);
socket(server);
-server.listen(9000);
\ No newline at end of file
+server.listen(9000); | prioritize `dist` over source files | asapach_peerflix-server | train | js |
f4d797f7ab7cb3b33e7d46654d97de01cdf4ab2b | diff --git a/tests/Bitpay/PrivateKeyTest.php b/tests/Bitpay/PrivateKeyTest.php
index <HASH>..<HASH> 100644
--- a/tests/Bitpay/PrivateKeyTest.php
+++ b/tests/Bitpay/PrivateKeyTest.php
@@ -111,10 +111,13 @@ class PrivateKeyTest extends \PHPUnit_Framework_TestCase
$priKey = new PrivateKey();
$this->assertNotNull($priKey);
+ $auth = new BitAuth();
+
$priKey->generate();
- $signature = $priKey->sign('BitPay');
-
+ //$signature = $priKey->sign('BitPay');
+
+ $signature = $auth->sign('BitPay', $priKey);
$this->assertNotNull($signature);
} | Use Bitauth signature method in test | bitpay_php-bitpay-client | train | php |
72d82f54cba715a506ba02c146ff75b321242d81 | diff --git a/models/ExampleUser.php b/models/ExampleUser.php
index <HASH>..<HASH> 100644
--- a/models/ExampleUser.php
+++ b/models/ExampleUser.php
@@ -331,7 +331,7 @@ abstract class ExampleUser extends \yii\db\ActiveRecord implements components\Id
*/
public function getActivationKey()
{
- $this->activation_key = md5(time().mt_rand().$this->username);
+ $this->activation_key = Security::generateRandomKey();
return $this->save(false) ? $this->activation_key : false;
} | resolves #<I>, use Security::generateRandomKey() to generate activation_key instead of md5 | nineinchnick_yii2-usr | train | php |
1db26e73f4b9363bb15d59ac312968e6866dc9c0 | diff --git a/builtin/logical/nomad/backend.go b/builtin/logical/nomad/backend.go
index <HASH>..<HASH> 100644
--- a/builtin/logical/nomad/backend.go
+++ b/builtin/logical/nomad/backend.go
@@ -44,6 +44,10 @@ func (b *backend) client(s logical.Storage) (*api.Client, error) {
return nil, err
}
+ if conf == nil {
+ return nil, err
+ }
+
nomadConf := api.DefaultConfig()
nomadConf.Address = conf.Address
nomadConf.SecretID = conf.Token | Return error before creating a client if conf is nil | hashicorp_vault | train | go |
d5a39d42fe1aa681c9efd31b79e090dc7a9e1f13 | diff --git a/src/renderer/tilelayer/Renderer.TileLayer.Dom.js b/src/renderer/tilelayer/Renderer.TileLayer.Dom.js
index <HASH>..<HASH> 100644
--- a/src/renderer/tilelayer/Renderer.TileLayer.Dom.js
+++ b/src/renderer/tilelayer/Renderer.TileLayer.Dom.js
@@ -201,8 +201,9 @@ Z.renderer.tilelayer.Dom = Z.Class.extend(/** @lends Z.renderer.tilelayer.Dom.pr
if (this._pruneTimeout) {
clearTimeout(this._pruneTimeout);
}
- var timeout = this.getMap() ? this.getMap().options['zoomAnimationDuration'] : 250,
- pruneLevels = this.getMap() ? !this.getMap().options['zoomBackground'] : true;
+ var map = this.getMap();
+ var timeout = map ? map.options['zoomAnimationDuration'] : 250,
+ pruneLevels = (map && this.layer === map.getBaseLayer()) ? !map.options['zoomBackground'] : true;
// Wait a bit more than 0.2 secs (the duration of the tile fade-in)
// to trigger a pruning.
this._pruneTimeout = setTimeout(Z.Util.bind(this._pruneTiles, this, pruneLevels), timeout + 100); | fix #<I>, always prune tiles when zooming a tilelayer other than the baselayer | maptalks_maptalks.js | train | js |
0fabb046521c00d18d0f33cb4d57992920f95edd | diff --git a/src/components/swipe-action/index.js b/src/components/swipe-action/index.js
index <HASH>..<HASH> 100644
--- a/src/components/swipe-action/index.js
+++ b/src/components/swipe-action/index.js
@@ -219,7 +219,7 @@ export default class AtSwipeAction extends AtComponent {
>
{options.map((item, key) => (
<View
- key={key}
+ key={`${item.text}-${key}`}
style={item.style}
onClick={this.handleClick.bind(this, item, key)}
className={classNames( | fix(swipe-action): 修复 AtSwipeAction 循环 key 反优化 | NervJS_taro-ui | train | js |
ceb27b7ea49c763b224788c063793c33367c5790 | diff --git a/src/watch.js b/src/watch.js
index <HASH>..<HASH> 100644
--- a/src/watch.js
+++ b/src/watch.js
@@ -44,18 +44,14 @@ function watch(context, options) {
context.execute(paths).then(function(ctx) {
context = ctx;
paths.forEach(function(path) {
- console.log("[changed]", path);
+ console.log("[updated]", path);
});
- inProgress = false;
-
- var pendingPaths = Object.keys(nextPaths);
-
- if (pendingPaths.length) {
- nextPaths = {};
- onChange(pendingPaths);
- }
- }, logError);
+ executePending();
+ }, function(err) {
+ logError(err);
+ executePending();
+ });
}
}
@@ -70,6 +66,17 @@ function watch(context, options) {
console.warn("[removed]", path);
}
}
+
+ function executePending() {
+ inProgress = false;
+
+ var pendingPaths = Object.keys(nextPaths);
+
+ if (pendingPaths.length) {
+ nextPaths = {};
+ onChange(pendingPaths);
+ }
+ }
}
module.exports = watch; | Added logic in watcher to recover from errors | MiguelCastillo_bit-bundler | train | js |
d148d7a4396e1f86c5e7d07d0bd2ebfc5ecbd159 | diff --git a/code/plugins/system/koowa/controller/form.php b/code/plugins/system/koowa/controller/form.php
index <HASH>..<HASH> 100644
--- a/code/plugins/system/koowa/controller/form.php
+++ b/code/plugins/system/koowa/controller/form.php
@@ -130,11 +130,11 @@ class KControllerForm extends KControllerBread
*/
protected function _actionBrowse()
{
- $layout = KRequest::get('get.layout', 'cmd', 'form' );
+ if(!KRequest::get('get.layout', 'cmd')) {
+ KRequest::set('get.layout', $layout);
+ }
- $this->getView()
- ->setLayout($layout)
- ->display();
+ return parent::_actionBrowse();
}
/**
@@ -144,11 +144,10 @@ class KControllerForm extends KControllerBread
*/
protected function _actionRead()
{
- $layout = KRequest::get('get.layout', 'cmd', 'form' );
-
- $this->getView()
- ->setLayout($layout)
- ->display();
+ if(!KRequest::get('get.layout', 'cmd')) {
+ KRequest::set('get.layout', $layout);
+ }
+ return parent::_actionRead();
}
/* | Reduced duplication, KControllerForm::_actionRead and Browse now properly extends their parent methods | joomlatools_joomlatools-framework | train | php |
2b352dc71061ba327a1f62f39532480eb711e230 | diff --git a/bin/index.js b/bin/index.js
index <HASH>..<HASH> 100644
--- a/bin/index.js
+++ b/bin/index.js
@@ -51,7 +51,7 @@ function randomName(num) {
var joined = ads.length > 1 ? ads.join(' ') : ads[0];
return joined + ' ' + an;
} else {
- return randomName();
+ return randomName(num);
}
}
diff --git a/package.json b/package.json
index <HASH>..<HASH> 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "randanimal",
- "version": "1.0.3",
+ "version": "1.0.4",
"description": "Generates a random combination of adjective and animal name.",
"main": "bin/index.js",
"repository": "git@github.com:jgnewman/randanimal",
diff --git a/src/index.js b/src/index.js
index <HASH>..<HASH> 100644
--- a/src/index.js
+++ b/src/index.js
@@ -42,7 +42,7 @@ function randomName(num) {
const joined = ads.length > 1 ? ads.join(' ') : ads[0];
return joined + ' ' + an;
} else {
- return randomName();
+ return randomName(num);
}
} | fix a bug where sometimes the amount of adjectives requested wasn't honored | jgnewman_randanimal | train | js,json,js |
bc6c92104c7f1d3f5a5f6e91d713b76aa22daa47 | diff --git a/appveyor/build_glpk.py b/appveyor/build_glpk.py
index <HASH>..<HASH> 100644
--- a/appveyor/build_glpk.py
+++ b/appveyor/build_glpk.py
@@ -11,8 +11,8 @@ except ImportError: # python 3
import urllib.request as urllib2
# these need to be set to the latest glpk version
-glpk_version = "4.59"
-glpk_md5 = "c84ce7b8286ab91f2e871cd82050e2fe"
+glpk_version = "4.60"
+glpk_md5 = "eda7965907f6919ffc69801646f13c3e"
glpk_build_dir = "glpk_build/glpk-%s" % glpk_version
url = "http://ftp.gnu.org/gnu/glpk/glpk-%s.tar.gz" % glpk_version | bump appveyor glpk to <I> | opencobra_cobrapy | train | py |
c676de4e312e04cb674516722cc124a0b07be1d7 | diff --git a/openid.js b/openid.js
index <HASH>..<HASH> 100644
--- a/openid.js
+++ b/openid.js
@@ -1254,7 +1254,7 @@ var _checkSignatureUsingAssociation = function(params, callback)
message += param + ':' + value + '\n';
}
- var hmac = crypto.createHmac(association.type, _fromBase64(association.secret));
+ var hmac = crypto.createHmac(association.type, convert.base64.decode(association.secret));
hmac.update(message, 'utf8');
var ourSignature = hmac.digest('base64'); | keep associate secret unchanged when verifying signature | havard_node-openid | train | js |
5293415ae3ba27c7b65b74160dbf20640aa5935b | diff --git a/wpull/http/connection.py b/wpull/http/connection.py
index <HASH>..<HASH> 100644
--- a/wpull/http/connection.py
+++ b/wpull/http/connection.py
@@ -230,6 +230,9 @@ class Connection(object):
else:
error_class = (ConnectionError, StreamClosedError, ssl.SSLError)
+ if not self._keep_alive and 'Connection' not in request.fields:
+ request.fields['Connection'] = 'close'
+
try:
yield self._send_request_header(request)
yield self._send_request_body(request) | connection.py: Sets connection close on request header if not keep-alive. | ArchiveTeam_wpull | train | py |
5cf61dd6c5db9d9ba8f835f4da098f6acf8d5d05 | diff --git a/src/selection.js b/src/selection.js
index <HASH>..<HASH> 100644
--- a/src/selection.js
+++ b/src/selection.js
@@ -146,7 +146,7 @@ export default class FeatureSelection {
}
// No feature found, but still need to resolve promise
else {
- this.finishRead({ id: request.id, feature: null });
+ this.finishRead({ id: request.id });
}
request.sent = true; | consistent undefined results when no feature found in selection buffer
(was either null or undefined depending on code path) | tangrams_tangram | train | js |
53e4620936bffef6fd1f2b176bf2709e96ca45ee | diff --git a/Kwf/Exception/NotFound.php b/Kwf/Exception/NotFound.php
index <HASH>..<HASH> 100644
--- a/Kwf/Exception/NotFound.php
+++ b/Kwf/Exception/NotFound.php
@@ -21,6 +21,9 @@ class Kwf_Exception_NotFound extends Kwf_Exception_Abstract
if (in_array($requestUri, $ignore)) {
return false;
}
+ if (substr($requestUri, 0, 8) == '/files/' || substr($requestUri, 0, 12) == '/monitoring/') { //TODO: don't hardcode here
+ return false;
+ }
$body = '';
$body .= $this->_format('REQUEST_URI', isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : '(none)'); | don't log <I> errors starting with /files or /monitoring
this just floods the <I> log | koala-framework_koala-framework | train | php |
4ea4cbe0abea633478a2a8210428f9020803f1bd | diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index <HASH>..<HASH> 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -10,7 +10,6 @@ SimpleCov.start
require 'xmldsig'
RSpec.configure do |config|
- config.treat_symbols_as_metadata_keys_with_true_values = true
config.run_all_when_everything_filtered = true
config.filter_run :focus | remove old configuration.
Remove the following warning:
RSpec::Core::Configuration#treat_symbols_as_metadata_keys_with_true_values=
is deprecated, it is now set to true as default and setting it to
false has no effect. | benoist_xmldsig | train | rb |
1485da863b148b75ba41fc3420922c66674c4ec8 | diff --git a/iamine/api.py b/iamine/api.py
index <HASH>..<HASH> 100644
--- a/iamine/api.py
+++ b/iamine/api.py
@@ -30,11 +30,10 @@ def search(query=None, params=None, mine_ids=None, info_only=None, **kwargs):
try:
loop.add_signal_handler(signal.SIGINT, loop.stop)
+ loop.run_until_complete(miner.search(query, params=params, mine_ids=mine_ids))
except RuntimeError:
pass
- loop.run_until_complete(miner.search(query, params=params, mine_ids=mine_ids))
-
def mine_items(identifiers, params=None, callback=None, **kwargs):
"""Concurrently retrieve metadata from Archive.org items.
@@ -55,6 +54,6 @@ def mine_items(identifiers, params=None, callback=None, **kwargs):
miner = Miner(loop, **kwargs)
try:
loop.add_signal_handler(signal.SIGINT, loop.stop)
+ loop.run_until_complete(miner.mine_items(identifiers, callback))
except RuntimeError:
pass
- loop.run_until_complete(miner.mine_items(identifiers, callback)) | Ignore RuntimeError exceptions. | jjjake_iamine | train | py |
783991bff3ae21d527567c54e72a19ce934c4c56 | diff --git a/tarbell/s3.py b/tarbell/s3.py
index <HASH>..<HASH> 100644
--- a/tarbell/s3.py
+++ b/tarbell/s3.py
@@ -17,7 +17,7 @@ from clint.textui import puts
from .utils import show_error
EXCLUDES = ['.git', '^\.']
-
+GZIP_TIMESTAMP = 326073600 # Timestamp of Eads' birthday
class S3Url(str):
def __new__(self, content):
@@ -70,7 +70,7 @@ class S3Sync:
key_parts = keyname.split('/')
filename = key_parts.pop()
temp_path = os.path.join(self.tempdir, filename)
- gzfile = gzip.open(temp_path, 'wb')
+ gzfile = gzip.GzipFile(temp_path, 'wb', 9, None, GZIP_TIMESTAMP)
gzfile.write(upload.read())
gzfile.close()
absolute_path = temp_path | use arbitrary, constant timestamp (my birthdate) to avoid re-uploading gzipped assets | tarbell-project_tarbell | train | py |
846d6debff96c644ea11db33d0cc307fd2b5041f | diff --git a/lib/bullet/detector/counter.rb b/lib/bullet/detector/counter.rb
index <HASH>..<HASH> 100644
--- a/lib/bullet/detector/counter.rb
+++ b/lib/bullet/detector/counter.rb
@@ -32,11 +32,6 @@ module Bullet
Bullet.add_notification notice
end
- def self.unique(array)
- array.flatten!
- array.uniq!
- end
-
def self.possible_objects
@@possible_objects ||= {}
end | Remove unique method - already in Base | flyerhzm_bullet | train | rb |
b16ea523e2bdb58b0a8c29e343be20b8c386342a | diff --git a/ReText/window.py b/ReText/window.py
index <HASH>..<HASH> 100644
--- a/ReText/window.py
+++ b/ReText/window.py
@@ -409,6 +409,8 @@ class ReTextWindow(QMainWindow):
urlstr = url.toString()
if urlstr.startswith('file://') or ':/' not in urlstr:
self.previewBoxes[self.ind].load(url)
+ elif urlstr.startswith('#'):
+ self.previewBoxes[self.ind].page().mainFrame().scrollToAnchor(urlstr[1:])
elif urlstr.startswith('about:blank#'):
self.previewBoxes[self.ind].page().mainFrame().scrollToAnchor(urlstr[12:])
else: | Extend linkClicked() anchor handling to work with Qt 5
(cherry picked from commit bb<I>f<I>f7aff<I>e<I>f<I>c<I>bb<I>d<I>a0) | retext-project_retext | train | py |
c9bb8e41cb8245c2f70929e7a80fd27086b777c4 | diff --git a/java/client/src/org/openqa/selenium/os/WindowsUtils.java b/java/client/src/org/openqa/selenium/os/WindowsUtils.java
index <HASH>..<HASH> 100644
--- a/java/client/src/org/openqa/selenium/os/WindowsUtils.java
+++ b/java/client/src/org/openqa/selenium/os/WindowsUtils.java
@@ -173,7 +173,7 @@ public class WindowsUtils {
cmd.execute();
String output = cmd.getStdOut();
- if (cmd.getExitCode() == 0 || cmd.getExitCode() == 128) {
+ if (cmd.getExitCode() == 0 || cmd.getExitCode() == 128 || cmd.getExitCode() == 255) {
return;
}
throw new RuntimeException("exec return code " + cmd.getExitCode() + ": " + output); | Error code <I> returned by taskkill means that the process or one of its children is already dead and can't be killed. | SeleniumHQ_selenium | train | java |
75fb8348859871c86b7727416a30e26e9266e623 | diff --git a/fusesoc/edatools/modelsim.py b/fusesoc/edatools/modelsim.py
index <HASH>..<HASH> 100644
--- a/fusesoc/edatools/modelsim.py
+++ b/fusesoc/edatools/modelsim.py
@@ -159,11 +159,14 @@ class Modelsim(Simulator):
cwd = self.work_root,
errormsg = "Failed to build simulation model. Log is available in '{}'".format(os.path.join(self.work_root, 'transcript'))).run()
if self.vpi_modules:
+ f = open(os.path.join(self.work_root, 'vpi_build.log'),'w')
args = ['all']
Launcher('make', args,
cwd = self.work_root,
- stdout = open(os.path.join(self.work_root, 'vpi_build.log'),'w'),
+ stdout = f,
+ stderr = f,
errormsg = " vpi build failed. log is available in '{}'".format(os.path.join(self.work_root, 'vpi_build.log'))).run()
+ f.close()
def run(self, args):
self.model_tech = os.getenv('MODEL_TECH') | Merged stderr and stdout for vpi build | olofk_fusesoc | train | py |
0867c3a4aee488fbcab38b58f895c8232f0d1876 | diff --git a/lib/cocoapods-amimono/integrator.rb b/lib/cocoapods-amimono/integrator.rb
index <HASH>..<HASH> 100644
--- a/lib/cocoapods-amimono/integrator.rb
+++ b/lib/cocoapods-amimono/integrator.rb
@@ -40,11 +40,13 @@ module Amimono
configuration = ENV['CONFIGURATION']
platform = ENV['EFFECTIVE_PLATFORM_NAME']
archs = ENV['ARCHS']
+ target_name = ENV['TARGET_NAME']
archs.split(" ").each do |architecture|
Dir.chdir("\#{intermediates_directory}/Pods.build") do
filelist = ""
Dir.glob("\#{configuration}\#{platform}/*.build/Objects-normal/\#{architecture}/*.o") do |object_file|
+ next if ["Pods-\#{target_name}-dummy", "Pods_\#{target_name}_vers"].any? { |dummy_object| object_file.include? dummy_object }
filelist += File.absolute_path(object_file) + "\\n"
end
File.write("\#{configuration}\#{platform}-\#{architecture}.objects.filelist", filelist) | Exclude CocoaPods dummy symbols from the filelist | Ruenzuo_cocoapods-amimono | train | rb |
190ed628bc14f8da67b21e77ded01ab060a09574 | diff --git a/Assets/ImageManipulation.php b/Assets/ImageManipulation.php
index <HASH>..<HASH> 100644
--- a/Assets/ImageManipulation.php
+++ b/Assets/ImageManipulation.php
@@ -486,7 +486,7 @@ trait ImageManipulation {
*/
public function PreviewThumbnail() {
$width = (int)Config::inst()->get(get_class($this), 'asset_preview_width');
- return $this->ScaleWidth($width) ?: $this->IconTag();
+ return $this->ScaleMaxWidth($width) ?: $this->IconTag();
}
/** | API PreviewThumbnail now uses ScaleMaxWidth
This will mean that if a thumbnail image is smaller than the preview_width defined, then it will no longer get blown up to the defined size. | silverstripe_silverstripe-framework | train | php |
02f91ab825b0deac72b30a6e31b95faeeb154831 | diff --git a/lib/volt/cli/generate.rb b/lib/volt/cli/generate.rb
index <HASH>..<HASH> 100644
--- a/lib/volt/cli/generate.rb
+++ b/lib/volt/cli/generate.rb
@@ -30,6 +30,11 @@ class Generate < Thor
def gem(name)
require 'volt/cli/new_gem'
+ if name =~ /[-]/
+ Volt.logger.error("Gem names should use underscores for their names. Currently volt only supports a single namespace for a compoennt.")
+ return
+ end
+
NewGem.new(self, name, options)
end | Restrict component gems to only have _’s in them for now. | voltrb_volt | train | rb |
3154d3343ca9cee2fd1ae1c1ce18e0a67ff7e6be | diff --git a/flat/style/flat.editor.js b/flat/style/flat.editor.js
index <HASH>..<HASH> 100644
--- a/flat/style/flat.editor.js
+++ b/flat/style/flat.editor.js
@@ -1337,7 +1337,7 @@ function editor_submit(addtoqueue) {
//delete
queries.push(useclause + " DELETE " + editdata[i].higherorder[j].type + " WHERE text = \"" + escape_fql_value(editdata[i].higherorder[j].oldvalue) + "\" FORMAT flat RETURN ancestor-focus");
}
- } else {
+ } else if (editdata[i].higherorder[j].value !== "") {
//add
if (editdata[i].id !== undefined) {
queries.push(useclause + " ADD " + editdata[i].higherorder[j].type + " WITH text \"" + escape_fql_value(editdata[i].higherorder[j].value) + "\" annotator \"" + escape_fql_value(username) + "\" annotatortype \"manual\" datetime now FOR ID " + editdata[i].id + " FORMAT flat RETURN ancestor-focus"); | Do not add comments/descriptions with empty text (should solve issue #<I>) | proycon_flat | train | js |
fce75ec91196c9174f2b296f20c18034cea0fac9 | diff --git a/index.js b/index.js
index <HASH>..<HASH> 100644
--- a/index.js
+++ b/index.js
@@ -23,7 +23,11 @@ function Launcher(dotEnsime, ensimeVersion, installDir, sbtCmd) {
* @return nothing */
Launcher.prototype.update = function(output, callback) {
console.log("Updating ensime-server.");
- fs.unlinkSync(this.classpathFile);
+ try {
+ fs.unlinkSync(this.classpathFile);
+ } catch (e) {
+ //didn't exist
+ }
this.install(output, callback);
}; | Update handles missing classpathFiles. | msiegenthaler_ensime-launcher-js | train | js |
162801bb3c1a23e513411ceede10e4665416c53a | diff --git a/azurerm/resource_arm_app_service_plan.go b/azurerm/resource_arm_app_service_plan.go
index <HASH>..<HASH> 100644
--- a/azurerm/resource_arm_app_service_plan.go
+++ b/azurerm/resource_arm_app_service_plan.go
@@ -270,8 +270,10 @@ func expandAppServicePlanProperties(d *schema.ResourceData, name string) *web.Ap
config := configs[0].(map[string]interface{})
appServiceEnvironmentId := config["app_service_environment_id"].(string)
- properties.HostingEnvironmentProfile = &web.HostingEnvironmentProfile{
- ID: utils.String(appServiceEnvironmentId),
+ if appServiceEnvironmentId != "" {
+ properties.HostingEnvironmentProfile = &web.HostingEnvironmentProfile{
+ ID: utils.String(appServiceEnvironmentId),
+ }
}
perSiteScaling := config["per_site_scaling"].(bool) | Only setting the App Service Environment ID if it's specified | terraform-providers_terraform-provider-azurerm | train | go |
f852acab290105da2c3e5f05d735d23b8217630d | diff --git a/tests/LinkORB/Tests/Component/Etcd/ClientTest.php b/tests/LinkORB/Tests/Component/Etcd/ClientTest.php
index <HASH>..<HASH> 100644
--- a/tests/LinkORB/Tests/Component/Etcd/ClientTest.php
+++ b/tests/LinkORB/Tests/Component/Etcd/ClientTest.php
@@ -33,7 +33,7 @@ class ClientTest extends PHPUnit_Framework_TestCase
public function testDoRequest()
{
$version = $this->client->doRequest('/version');
- $this->assertArrayHasKey('releaseVersion', json_decode($version, true));
+ $this->assertArrayHasKey('etcdserver', json_decode($version, true));
}
/** | Fixing broken test that expected old response from /version | linkorb_etcd-php | train | php |
b1dee08b9062644368783f0900b75d66b44d1ca1 | diff --git a/config/default.go b/config/default.go
index <HASH>..<HASH> 100644
--- a/config/default.go
+++ b/config/default.go
@@ -205,7 +205,7 @@ func setDefaultNeighborConfigValuesWithViper(v *viper.Viper, n *Neighbor, asn ui
vv.Set("afi-safi", afs[i])
}
af.State.AfiSafiName = af.Config.AfiSafiName
- if !vv.IsSet("afi-safi.config") {
+ if !vv.IsSet("afi-safi.config.enabled") {
af.Config.Enabled = true
}
af.MpGracefulRestart.State.Enabled = af.MpGracefulRestart.Config.Enabled | config/default: Fix unfilled "neighbors.afi-safis.config.enabled"
Currently, if "neighbors.afi-safis.config.enabled" is omitted, this
field will not initialised as expected when GoBGPd reads config file,
but will initialised when AddNeighbor API is called.
This cause the miss comparison whether reloaded neighbor config is
updated or not (always determined updated).
This patch fixes the condition more strictly and solves this problem. | osrg_gobgp | train | go |
2297bae0e07e87719f1744d55c5f0247d6040931 | diff --git a/tests/DatastoreTest.php b/tests/DatastoreTest.php
index <HASH>..<HASH> 100644
--- a/tests/DatastoreTest.php
+++ b/tests/DatastoreTest.php
@@ -207,18 +207,33 @@ class DatastoreTest extends PHPUnit_Framework_TestCase
}
}
- sleep(10);
+ sleep(5);
foreach ($tests as $test)
{
- $t2 = json_decode(
- Guzzlehttp\get('http://127.0.0.1:8080/test/'.$test->id)
- ->getBody()
- );
-
- foreach ($test as $key => $val)
+ // Really lame way to avoid problems with App Engine SDK
+ // and the asynchronous nature of Datastore.
+ do
{
- $this->assertEquals($val, $t2->{$key}, "Test[$idx]: Incorrectly retrieved value for {$key}");
+ try
+ {
+ $t2 = json_decode(
+ Guzzlehttp\get('http://127.0.0.1:8080/test/'.$test->id)
+ ->getBody()
+ );
+
+ foreach ($test as $key => $val)
+ {
+ $this->assertEquals($val, $t2->{$key}, "Test[$idx]: Incorrectly retrieved value for {$key}");
+ }
+ }
+ catch (Exception $e)
+ {
+ continue;
+ }
+ break;
}
+ while (1);
+
}
} | Make the async fix (on saving/then querying) for DatastoreTest a little more resilient.
... It might be best to get rid of this test in the future. | pwhelan_datachore | train | php |
8b76077a2284a57f4e245ba4462c060f81faec78 | diff --git a/client.go b/client.go
index <HASH>..<HASH> 100644
--- a/client.go
+++ b/client.go
@@ -35,6 +35,9 @@ func (this *Client) Send(pn *PushNotification) (resp *PushNotificationResponse)
resp.Error = err
}
+ resp.Success = true
+ resp.Error = nil
+
return
} | Setting response values accordingly at the end of the request. | Coccodrillo_apns | train | go |
0ab2704c7ba19c8a41c97910a6adf537c9f38044 | diff --git a/hazelcast-client-new/src/main/java/com/hazelcast/client/cache/impl/AbstractClientCacheProxy.java b/hazelcast-client-new/src/main/java/com/hazelcast/client/cache/impl/AbstractClientCacheProxy.java
index <HASH>..<HASH> 100644
--- a/hazelcast-client-new/src/main/java/com/hazelcast/client/cache/impl/AbstractClientCacheProxy.java
+++ b/hazelcast-client-new/src/main/java/com/hazelcast/client/cache/impl/AbstractClientCacheProxy.java
@@ -398,7 +398,7 @@ abstract class AbstractClientCacheProxy<K, V>
int completionId = nextCompletionId();
// TODO If there is a single entry, we could make use of a put operation since that is a bit cheaper
ClientMessage request =
- CachePutAllCodec.encodeRequest(nameWithPrefix, entries, expiryPolicyData, partitionId);
+ CachePutAllCodec.encodeRequest(nameWithPrefix, entries, expiryPolicyData, completionId);
Future f = invoke(request, partitionId, completionId);
futureEntriesTuples.add(new FutureEntriesTuple(f, entries));
if (nearCache != null) { | `CachePutAllCodec.encodeRequest` fixed by passing `completionId` instead of `partitionId` for putAll operation on new-client | hazelcast_hazelcast | train | java |
a8844f3b42701afac2620dfcfc50fff80ed8f01e | diff --git a/alot/helper.py b/alot/helper.py
index <HASH>..<HASH> 100644
--- a/alot/helper.py
+++ b/alot/helper.py
@@ -295,7 +295,7 @@ def call_cmd(cmdlist, stdin=None):
:type cmdlist: list of str
:param stdin: string to pipe to the process
:type stdin: str
- :return: triple of stdout, error msg, return value of the shell command
+ :return: triple of stdout, stderr, return value of the shell command
:rtype: str, str, int
"""
@@ -308,11 +308,14 @@ def call_cmd(cmdlist, stdin=None):
out, err = proc.communicate(stdin)
ret = proc.poll()
else:
- out = subprocess.check_output(cmdlist)
- # todo: get error msg. rval
- except (subprocess.CalledProcessError, OSError), e:
- err = str(e)
- ret = -1
+ try:
+ out = subprocess.check_output(cmdlist)
+ except subprocess.CalledProcessError as e:
+ err = e.output
+ ret = -1
+ except OSError as e:
+ err = e.strerror
+ ret = e.errno
out = string_decode(out, urwid.util.detected_encoding)
err = string_decode(err, urwid.util.detected_encoding) | properly read stderr in call_command helper | pazz_alot | train | py |
cae38b2c736c596f45242efd757dc1d13be1c4c2 | diff --git a/lib/evidence/mongo.rb b/lib/evidence/mongo.rb
index <HASH>..<HASH> 100644
--- a/lib/evidence/mongo.rb
+++ b/lib/evidence/mongo.rb
@@ -20,7 +20,7 @@ module OpenBEL
end
def create_evidence(evidence)
- @evidence.insert(evidence.to_h)
+ @evidence.insert(evidence.to_h, :j => true)
end
def find_evidence_by_id(value)
@@ -41,13 +41,16 @@ module OpenBEL
def update_evidence_by_id(value, evidence)
evidence_h = evidence.to_h
evidence_h[:_id] = BSON::ObjectId(value)
- @evidence.save(evidence_h)
+ @evidence.save(evidence_h, :j => true)
end
def delete_evidence_by_id(value)
- @evidence.remove({
- :_id => to_id(value)
- })
+ @evidence.remove(
+ {
+ :_id => to_id(value)
+ },
+ :j => true
+ )
end
private | block while evidence is committed to mongo journal
this change was made to ensure modifications to mongo blocked while
committing to the journal | OpenBEL_openbel-api | train | rb |
97779d11409ecb2e0fcec63410aca8baef519ae1 | diff --git a/wallet.js b/wallet.js
index <HASH>..<HASH> 100644
--- a/wallet.js
+++ b/wallet.js
@@ -129,7 +129,7 @@ function sendSignature(device_address, signed_text, signature, signing_path, add
function handleMessageFromHub(ws, json, device_pubkey, bIndirectCorrespondent, callbacks){
var subject = json.subject;
var body = json.body;
- if (!subject || !body)
+ if (!subject || typeof body == "undefined")
return callbacks.ifError("no subject or body");
//if (bIndirectCorrespondent && ["cancel_new_wallet", "my_xpubkey", "new_wallet_address"].indexOf(subject) === -1)
// return callbacks.ifError("you're indirect correspondent, cannot trust "+subject+" from you"); | fix chat recording OFF not being handling | byteball_ocore | train | js |
0ab77148a814c2003a94c517b69e909b049aa3cb | diff --git a/lib/chef/deprecated.rb b/lib/chef/deprecated.rb
index <HASH>..<HASH> 100644
--- a/lib/chef/deprecated.rb
+++ b/lib/chef/deprecated.rb
@@ -206,6 +206,8 @@ class Chef
# Returned when using the deprecated option on a property
class Property < Base
+ target 24
+
def to_s
"#{message}\n#{location}"
end | Give property deprecations an ID just for tracking if nothing else, even if they don't have a docs page. | chef_chef | train | rb |
00c0c49454513627f4d701d96600d5eed6efd730 | diff --git a/did/cli.py b/did/cli.py
index <HASH>..<HASH> 100644
--- a/did/cli.py
+++ b/did/cli.py
@@ -91,6 +91,9 @@ class Options(object):
if (self.arguments is not None
and isinstance(self.arguments, basestring)):
self.arguments = self.arguments.split()
+ # Otherwise properly decode command line arguments
+ if self.arguments is None:
+ self.arguments = [arg.decode("utf-8") for arg in sys.argv[1:]]
(opt, arg) = self.parser.parse_args(self.arguments)
self.opt = opt
self.arg = arg | Decode command line arguments from utf-8 | psss_did | train | py |
536882a4a7f6a4ad53b1854835a4e3fd0be84edd | diff --git a/examples/glyphs/maps.py b/examples/glyphs/maps.py
index <HASH>..<HASH> 100644
--- a/examples/glyphs/maps.py
+++ b/examples/glyphs/maps.py
@@ -7,7 +7,8 @@ from bokeh.models.glyphs import Circle
from bokeh.models import (
GMapPlot, Range1d, ColumnDataSource, LinearAxis,
PanTool, WheelZoomTool, BoxSelectTool,
- BoxSelectionOverlay, GMapOptions)
+ BoxSelectionOverlay, GMapOptions,
+ NumeralTickFormatter, PrintfTickFormatter)
from bokeh.resources import INLINE
x_range = Range1d()
@@ -39,10 +40,10 @@ box_select = BoxSelectTool()
plot.add_tools(pan, wheel_zoom, box_select)
-xaxis = LinearAxis(axis_label="lat", major_tick_in=0)
+xaxis = LinearAxis(axis_label="lat", major_tick_in=0, formatter=NumeralTickFormatter(format="0.00"))
plot.add_layout(xaxis, 'below')
-yaxis = LinearAxis(axis_label="lon", major_tick_in=0)
+yaxis = LinearAxis(axis_label="lon", major_tick_in=0, formatter=PrintfTickFormatter(format="%.2f"))
plot.add_layout(yaxis, 'left')
overlay = BoxSelectionOverlay(tool=box_select) | Use new formatters in glyphs/maps example | bokeh_bokeh | train | py |
9174e70af373d27dea52bc5f19144d62c23a7fd7 | diff --git a/pmml-converter/src/main/java/org/jpmml/converter/PMMLUtil.java b/pmml-converter/src/main/java/org/jpmml/converter/PMMLUtil.java
index <HASH>..<HASH> 100644
--- a/pmml-converter/src/main/java/org/jpmml/converter/PMMLUtil.java
+++ b/pmml-converter/src/main/java/org/jpmml/converter/PMMLUtil.java
@@ -38,6 +38,7 @@ import org.dmg.pmml.Array;
import org.dmg.pmml.ComplexArray;
import org.dmg.pmml.Constant;
import org.dmg.pmml.DataType;
+import org.dmg.pmml.DefineFunction;
import org.dmg.pmml.Expression;
import org.dmg.pmml.Extension;
import org.dmg.pmml.Field;
@@ -159,6 +160,11 @@ public class PMMLUtil {
}
static
+ public Apply createApply(DefineFunction defineFunction, Expression... expressions){
+ return createApply(defineFunction.requireName(), expressions);
+ }
+
+ static
public Apply createApply(String function, Expression... expressions){
Apply apply = new Apply(function)
.addExpressions(expressions); | Added PMMLUtil#createApply(DefineFunction, Expression[]) utility method | jpmml_jpmml-converter | train | java |
4d63e785e1ddffe9a4f47913cfb601f9b7c9f099 | diff --git a/pyws/protocols/__init__.py b/pyws/protocols/__init__.py
index <HASH>..<HASH> 100644
--- a/pyws/protocols/__init__.py
+++ b/pyws/protocols/__init__.py
@@ -26,8 +26,6 @@ class Protocol(object):
'type': error_type_name,
'name': error_type.__name__,
'prefix': error_type.__module__,
- 'full_name': '%s.%s' % (
- error_type.__module__, error_type.__name__),
'message': unicode(error),
'params': error.args,
}
@@ -50,7 +48,9 @@ class SoapProtocol(Protocol):
class RestProtocol(Protocol):
def get_function(self, request):
- return request.tail, request.GET
+ return (request.tail,
+ dict((k, len(v) > 1 and v or v[0])
+ for k, v in request.GET.iteritems()))
def get_response(self, result):
return Response(json.dumps({'result': result})) | REST protocol extracts single values as single values, not lists | stepank_pyws | train | py |
b8031413f652c4a2559e44f90dea081523696eb2 | diff --git a/app/auto_scale.go b/app/auto_scale.go
index <HASH>..<HASH> 100644
--- a/app/auto_scale.go
+++ b/app/auto_scale.go
@@ -23,7 +23,7 @@ type Action struct {
}
func NewAction(expression string, units uint, wait time.Duration) (*Action, error) {
- if validateExpression(expression) {
+ if expressionIsValid(expression) {
return &Action{Wait: wait, Expression: expression, Units: units}, nil
}
return nil, errors.New("Expression is not valid.")
@@ -31,7 +31,7 @@ func NewAction(expression string, units uint, wait time.Duration) (*Action, erro
var expressionRegex = regexp.MustCompile("{(.*)} ([><=]) ([0-9]+)")
-func validateExpression(expression string) bool {
+func expressionIsValid(expression string) bool {
return expressionRegex.MatchString(expression)
}
diff --git a/app/auto_scale_test.go b/app/auto_scale_test.go
index <HASH>..<HASH> 100644
--- a/app/auto_scale_test.go
+++ b/app/auto_scale_test.go
@@ -181,7 +181,7 @@ func (s *S) TestValidateExpression(c *gocheck.C) {
"100": false,
}
for expression, expected := range cases {
- c.Assert(validateExpression(expression), gocheck.Equals, expected)
+ c.Assert(expressionIsValid(expression), gocheck.Equals, expected)
}
} | aut scale: renamed validateExpression to expressionIsValid.
related to #<I>. | tsuru_tsuru | train | go,go |
edb6091ae539789e1d35bd41d84bbc82bf9aa247 | diff --git a/src/Bkwld/Decoy/Controllers/Elements.php b/src/Bkwld/Decoy/Controllers/Elements.php
index <HASH>..<HASH> 100644
--- a/src/Bkwld/Decoy/Controllers/Elements.php
+++ b/src/Bkwld/Decoy/Controllers/Elements.php
@@ -160,7 +160,7 @@ class Elements extends Base {
$elements->clearCache();
// Redirect back to index
- return Redirect::to(URL::current());;
+ return Redirect::to(URL::current())->with('success', '<b>Elements</b> were successfully saved.');
} | Showing a success notification on elements save | BKWLD_decoy | train | php |
2d6c2eefa43cf170b87a58346a1eab4ee968800b | diff --git a/revel/build.go b/revel/build.go
index <HASH>..<HASH> 100644
--- a/revel/build.go
+++ b/revel/build.go
@@ -62,6 +62,7 @@ func buildApp(c *model.CommandConfig) (err error) {
// Convert target to absolute path
c.Build.TargetPath, _ = filepath.Abs(destPath)
c.Build.Mode = mode
+ c.Build.ImportPath = appImportPath
revel_paths, err := model.NewRevelPaths(mode, appImportPath, "", model.NewWrappedRevelCallback(nil, c.PackageResolver))
if err != nil { | Update build.go
add missing c.Build.ImportPath, which is required to generate run.sh and run.bat | revel_cmd | train | go |
1b18056341121b968a049ed280b85ca55a638fc5 | diff --git a/transloadit.go b/transloadit.go
index <HASH>..<HASH> 100755
--- a/transloadit.go
+++ b/transloadit.go
@@ -10,6 +10,7 @@ import (
"fmt"
"io"
"io/ioutil"
+ "math/rand"
"net/http"
"net/url"
"strings"
@@ -98,7 +99,9 @@ func (client *Client) sign(params map[string]interface{}) (string, string, error
Key: client.config.AuthKey,
Expires: getExpireString(),
}
-
+ // Add a random nonce to make signatures unique and prevent error about
+ // signature reuse: https://github.com/transloadit/go-sdk/pull/35
+ params["nonce"] = rand.Int()
b, err := json.Marshal(params)
if err != nil {
return "", "", fmt.Errorf("unable to create signature: %s", err) | Add a random element in the payload to prevent Signature reuse (#<I>)
* Add a random element in the payload to prevent Signature reuse
* Update transloadit.go | transloadit_go-sdk | train | go |
54dc3c2c1197109c04f2583297c546f61c46e84b | diff --git a/src/utils/resolvers/docs.js b/src/utils/resolvers/docs.js
index <HASH>..<HASH> 100644
--- a/src/utils/resolvers/docs.js
+++ b/src/utils/resolvers/docs.js
@@ -1,6 +1,12 @@
import { getFileContents } from 'ochre-liberator';
+function getDocInfo(file, cb) {
+ getFileContents(file, (err, contents) => {
+ cb(err, { contents });
+ });
+}
+
module.exports = {
- resolve: getFileContents,
- types: ['doc', 'docx', 'txt', 'rtf', 'ppt', 'pptx', 'xls', 'xlsx']
+ resolve: getDocInfo,
+ types: ['.doc', '.docx', '.txt', '.rtf', '.ppt', '.pptx', '.xls', '.xlsx']
}; | sends the file contents in an object to match object.assign | corevo_info.js | train | js |
52ef6117ba90803846172f69c1f62e31dbb1e578 | diff --git a/src/helpers/form-data.js b/src/helpers/form-data.js
index <HASH>..<HASH> 100644
--- a/src/helpers/form-data.js
+++ b/src/helpers/form-data.js
@@ -26,7 +26,6 @@
const carriage = '\r\n'
const dashes = '-'.repeat(2)
-const carriageLength = Buffer.byteLength(carriage)
const NAME = Symbol.toStringTag
@@ -101,28 +100,4 @@ module.exports.formDataIterator = function * (form, boundary) {
yield getFooter(boundary)
}
-/**
- * @param {FormData} form
- * @param {string} boundary
- */
-module.exports.getFormDataLength = function (form, boundary) {
- let length = 0
-
- for (const [name, value] of form) {
- length += Buffer.byteLength(getHeader(boundary, name, value))
-
- if (isBlob(value)) {
- length += value.size
- } else {
- length += Buffer.byteLength(String(value))
- }
-
- length += carriageLength
- }
-
- length += Buffer.byteLength(getFooter(boundary))
-
- return length
-}
-
module.exports.isBlob = isBlob | style: removing some unused code | Kong_httpsnippet | train | js |
4b70aafa2053bca8e6ebc32b3b313b7ae942e1cc | diff --git a/src/main/java/net/openhft/chronicle/map/VanillaChronicleMap.java b/src/main/java/net/openhft/chronicle/map/VanillaChronicleMap.java
index <HASH>..<HASH> 100644
--- a/src/main/java/net/openhft/chronicle/map/VanillaChronicleMap.java
+++ b/src/main/java/net/openhft/chronicle/map/VanillaChronicleMap.java
@@ -770,7 +770,16 @@ class VanillaChronicleMap<K, V> extends AbstractMap<K, V>
return usingValue;
} else {
try {
- return valueFactory.create();
+ usingValue = valueFactory.create();
+ if (usingValue == null) {
+ throw new IllegalStateException("acquireUsing() method requires" +
+ "valueFactory.create() result to be non-null. " +
+ "By default it is so when value class is" +
+ "a Byteable/BytesMarshallable/Externalizable subclass." +
+ "Note that acquireUsing() anyway makes very little sense " +
+ "when value class is not a Byteable subclass.");
+ }
+ return usingValue;
} catch (Exception e) {
throw new IllegalStateException(e);
} | Ensure acquireUsing() doesn't return null | OpenHFT_Chronicle-Map | train | java |
ebb39f7c3d4b715128713ba8805452039a64636c | diff --git a/tests/test_common.py b/tests/test_common.py
index <HASH>..<HASH> 100644
--- a/tests/test_common.py
+++ b/tests/test_common.py
@@ -31,11 +31,13 @@ class TestClasses(object):
assert _class is not eval(repr(_class))
def test_equality(self, _class, _copy):
- _copy.foo = 'bar'
- assert not _class == _copy
+ copy_ = _copy(_class)
+ copy_.foo = 'bar'
+ assert not _class == copy_
assert not _class == "not a class instance"
def test_inequality(self, _class, _copy):
- _copy.foo = 'bar'
- assert not _class != _copy
+ copy_ = _copy(_class)
+ copy_.foo = 'bar'
+ assert not _class != copy_
assert _class != "not a class instance" | Fix original not passed to deepcopy fixture | royi1000_py-libhdate | train | py |
2483dabb0c56a45744232d5611db615bedcf11cb | diff --git a/src/index.js b/src/index.js
index <HASH>..<HASH> 100644
--- a/src/index.js
+++ b/src/index.js
@@ -11,7 +11,7 @@ function genForeachArray(t, loopVar, arrayVar, loopStatement) {
return t.forStatement(
t.variableDeclaration("var", [ t.variableDeclarator(loopVar, t.numericLiteral(0)) ]),
t.binaryExpression("<", loopVar, t.memberExpression(arrayVar, t.identifier("length"))),
- t.unaryExpression("++", loopVar),
+ t.updateExpression("++", loopVar),
loopStatement
);
} | fix #2 issue - TypeError crush in babel 7 | christensson_babel-plugin-transform-es2017-object-entries | train | js |
aa9bdae995a5a4e4998cecce3f3b4b8264c6f057 | diff --git a/stripe.go b/stripe.go
index <HASH>..<HASH> 100644
--- a/stripe.go
+++ b/stripe.go
@@ -23,7 +23,7 @@ const (
)
// apiversion is the currently supported API version
-const apiversion = "2017-04-06"
+const apiversion = "2017-05-25"
// clientversion is the binding version
const clientversion = "21.5.1" | Bump the supported API version to <I>-<I>-<I>
All the necessary changes are already in master. | stripe_stripe-go | train | go |
25a74189dd2d250de2765c98bdd66e03d41897b2 | diff --git a/spec/dotenv_spec.rb b/spec/dotenv_spec.rb
index <HASH>..<HASH> 100644
--- a/spec/dotenv_spec.rb
+++ b/spec/dotenv_spec.rb
@@ -141,7 +141,7 @@ describe Dotenv do
it "fixture file has UTF-8 BOM" do
contents = File.open(subject, "rb", &:read).force_encoding("UTF-8")
- expect(contents).to start_with("\xEF\xBB\xBF")
+ expect(contents).to start_with("\xEF\xBB\xBF".force_encoding("UTF-8"))
end
end | Fix a failure spec at Ruby <I>
By default, Strings with non-ASCII 8bit character in Ruby <I> are tagged with the "ASCII-8BIT" encoding. | bkeepers_dotenv | train | rb |
062e0d789f46dc3a8a4ca2d740cd4948533c877b | diff --git a/pkg/datapath/maps/map.go b/pkg/datapath/maps/map.go
index <HASH>..<HASH> 100644
--- a/pkg/datapath/maps/map.go
+++ b/pkg/datapath/maps/map.go
@@ -169,6 +169,9 @@ func RemoveDisabledMaps() {
"cilium_lb6_reverse_nat",
"cilium_lb6_rr_seq",
"cilium_lb6_services",
+ "cilium_lb6_services_v2",
+ "cilium_lb6_rr_seq_v2",
+ "cilium_lb6_backends",
"cilium_snat_v6_external",
"cilium_proxy6"}...)
}
@@ -180,6 +183,9 @@ func RemoveDisabledMaps() {
"cilium_lb4_reverse_nat",
"cilium_lb4_rr_seq",
"cilium_lb4_services",
+ "cilium_lb4_services_v2",
+ "cilium_lb4_rr_seq_v2",
+ "cilium_lb4_backends",
"cilium_snat_v4_external",
"cilium_proxy4"}...)
} | maps: Remove disabled svc v2 maps
Previously, the svc v2 related maps were not removed when ipv4 or ipv6
services were disabled. | cilium_cilium | train | go |
bee6a3b780617a292bc4e635892be71d03baab4f | diff --git a/lib/review/htmlutils.rb b/lib/review/htmlutils.rb
index <HASH>..<HASH> 100644
--- a/lib/review/htmlutils.rb
+++ b/lib/review/htmlutils.rb
@@ -39,16 +39,20 @@ module ReVIEW
begin
require 'pygments'
- Pygments.highlight(
- unescape_html(body),
- :options => {
- :nowrap => true,
- :noclasses => true
- },
- :formatter => format,
- :lexer => lexer)
- rescue LoadError, MentosError
- body
+ begin
+ Pygments.highlight(
+ unescape_html(body),
+ :options => {
+ :nowrap => true,
+ :noclasses => true
+ },
+ :formatter => format,
+ :lexer => lexer)
+ rescue MentosError
+ body
+ end
+ rescue LoadError
+ body
end
end
end | supported not exists pygments on Ruby <I> | kmuto_review | train | rb |
c70bd4c5cf23a35398846d3ad39e5e5ead341c8f | diff --git a/tests/testviews.py b/tests/testviews.py
index <HASH>..<HASH> 100644
--- a/tests/testviews.py
+++ b/tests/testviews.py
@@ -179,8 +179,6 @@ class GridLayoutTest(CompositeTest):
grid = GridLayout([self.view1, self.view2, self.view3, self.view2])
self.assertEqual(grid.shape, (1,4))
- def test_gridlayout_cols(self):
- GridLayout([self.view1, self.view2,self.view3, self.view2]) | Removed incomplete unit test of GridLayout | pyviz_holoviews | train | py |
666400eb6f43f97165d6926a19245dd0f59587a2 | diff --git a/visidata/movement.py b/visidata/movement.py
index <HASH>..<HASH> 100644
--- a/visidata/movement.py
+++ b/visidata/movement.py
@@ -1,7 +1,7 @@
import itertools
import re
-from visidata import vd, VisiData, error, status, Sheet, Column, regex_flags, rotate_range
+from visidata import vd, VisiData, error, status, Sheet, Column, regex_flags, rotate_range, warning
vd.searchContext = {} # regex, columns, backward to kwargs from previous search
@@ -75,7 +75,7 @@ def searchRegex(vd, sheet, moveCursor=False, reverse=False, **kwargs):
if regex:
vd.searchContext["regex"] = re.compile(regex, regex_flags()) or error('invalid regex: %s' % regex)
- regex = vd.searchContext.get("regex") or error("no regex")
+ regex = vd.searchContext.get("regex") or warning("no regex")
columns = vd.searchContext.get("columns")
if columns == "cursorCol": | [warning] change prompt invoked when n, N are pressed before /,? into a warning | saulpw_visidata | train | py |
6bd70dab9de849074d02e3e15e579f499187d8c0 | diff --git a/tests/polysh_tests.py b/tests/polysh_tests.py
index <HASH>..<HASH> 100755
--- a/tests/polysh_tests.py
+++ b/tests/polysh_tests.py
@@ -65,7 +65,7 @@ def parse_cmdline():
default=False, help='include coverage tests')
parser.add_option('--log', type='str', dest='log',
help='log all pexpect I/O and polysh debug info')
- parser.add_option('--python', type='str', dest='python', default='python',
+ parser.add_option('--python', type='str', dest='python', default='python3',
help='python binary to use')
options, args = parser.parse_args()
return options, args | PY3: Use python3 as python for tests by default | innogames_polysh | train | py |
0ba535d179c7c0aa4e1bff3a00682267848f2adf | diff --git a/src/Psalm/Codebase.php b/src/Psalm/Codebase.php
index <HASH>..<HASH> 100644
--- a/src/Psalm/Codebase.php
+++ b/src/Psalm/Codebase.php
@@ -1170,10 +1170,6 @@ class Codebase
break;
}
}
-
- if ($offset - $end_pos > 3) {
- break;
- }
}
if (!$recent_type
diff --git a/tests/LanguageServer/CompletionTest.php b/tests/LanguageServer/CompletionTest.php
index <HASH>..<HASH> 100644
--- a/tests/LanguageServer/CompletionTest.php
+++ b/tests/LanguageServer/CompletionTest.php
@@ -621,8 +621,6 @@ class CompletionTest extends \Psalm\Tests\TestCase
$codebase->scanFiles();
$this->analyzeFile('somefile.php', new Context());
- $this->markTestSkipped();
-
$this->assertSame(['B\Collection', '->'], $codebase->getCompletionDataAtPosition('somefile.php', new Position(10, 61)));
}
} | Fix problem locating end of completion area | vimeo_psalm | train | php,php |
247a5586d5900eabd0584af13319eb9d50b6e9ce | diff --git a/lib/axlsx/workbook/worksheet/cell.rb b/lib/axlsx/workbook/worksheet/cell.rb
index <HASH>..<HASH> 100644
--- a/lib/axlsx/workbook/worksheet/cell.rb
+++ b/lib/axlsx/workbook/worksheet/cell.rb
@@ -67,7 +67,7 @@ module Axlsx
# Indicates if the cell is good for shared string table
def plain_string?
@type == :string && # String typed
- !@is_text_run && # No inline styles
+ !is_text_run? && # No inline styles
!@value.nil? && # Not nil
!@value.empty? && # Not empty
!@value.start_with?('=') # Not a formula | use method not instance variable for determining if cell level style customizations have been made and the cell is now a text run. | randym_axlsx | train | rb |
cf233ea8fa2f56d4aab47fc486bd2671f5c71330 | diff --git a/src/main/java/org/takes/facets/auth/PsByFlag.java b/src/main/java/org/takes/facets/auth/PsByFlag.java
index <HASH>..<HASH> 100644
--- a/src/main/java/org/takes/facets/auth/PsByFlag.java
+++ b/src/main/java/org/takes/facets/auth/PsByFlag.java
@@ -106,6 +106,7 @@ public final class PsByFlag implements Pass {
for (final Map.Entry<Pattern, Pass> ent : this.passes.entrySet()) {
if (ent.getKey().matcher(value).matches()) {
user = ent.getValue().enter(req);
+ break;
}
}
} | Added a break clause that was removed by mistake. | yegor256_takes | train | java |
206e04183c17fc49f2437edf9f5e832a85f749de | diff --git a/test/extended/authorization/rbac/groups_default_rules.go b/test/extended/authorization/rbac/groups_default_rules.go
index <HASH>..<HASH> 100644
--- a/test/extended/authorization/rbac/groups_default_rules.go
+++ b/test/extended/authorization/rbac/groups_default_rules.go
@@ -93,7 +93,7 @@ var (
// this is from upstream kube
rbacv1helpers.NewRule("get").URLs(
- "/healthz",
+ "/healthz", "/livez",
"/version",
"/version/",
).RuleOrDie(), | extended: add /livez endpoint to RBAC coverage test | openshift_origin | train | go |
5fac9a89ec836f989d0910e712b2fa9078fd396b | diff --git a/src/configure.js b/src/configure.js
index <HASH>..<HASH> 100644
--- a/src/configure.js
+++ b/src/configure.js
@@ -23,11 +23,11 @@ export class Configure {
.then(data => this.obj = data);
}
- directory(path) {
+ setDirectory(path) {
this.directory = path;
}
- file(name) {
+ setConfig(name) {
this.config = name;
} | Renamed methods that were clashing with class variables. | Vheissu_aurelia-configuration | train | js |
86f7ee28e88dddd81b50d06744ad3aee8914141b | diff --git a/src/main/java/org/redisson/command/CommandAsyncService.java b/src/main/java/org/redisson/command/CommandAsyncService.java
index <HASH>..<HASH> 100644
--- a/src/main/java/org/redisson/command/CommandAsyncService.java
+++ b/src/main/java/org/redisson/command/CommandAsyncService.java
@@ -511,15 +511,14 @@ public class CommandAsyncService implements CommandAsyncExecutor {
int timeoutTime = connectionManager.getConfig().getTimeout();
if (QueueCommand.TIMEOUTLESS_COMMANDS.contains(details.getCommand().getName())) {
- // add 1.5 second due to issue https://github.com/antirez/redis/issues/874
- timeoutTime += Math.max(0, 1500 - timeoutTime);
-
Integer popTimeout = Integer.valueOf(details.getParams()[details.getParams().length - 1].toString());
handleBlockingOperations(details, connection, popTimeout);
if (popTimeout == 0) {
return;
}
timeoutTime += popTimeout*1000;
+ // add 1 second due to issue https://github.com/antirez/redis/issues/874
+ timeoutTime += 1000;
}
final int timeoutAmount = timeoutTime; | Add exactly 1 second to blpop timeout. #<I> | redisson_redisson | train | java |
e6aa8b0b44b99133d41fa5d391b1e482b8a732e4 | diff --git a/definitions/npm/express_v4.x.x/flow_v0.32.x-/express_v4.x.x.js b/definitions/npm/express_v4.x.x/flow_v0.32.x-/express_v4.x.x.js
index <HASH>..<HASH> 100644
--- a/definitions/npm/express_v4.x.x/flow_v0.32.x-/express_v4.x.x.js
+++ b/definitions/npm/express_v4.x.x/flow_v0.32.x-/express_v4.x.x.js
@@ -13,7 +13,7 @@ declare class express$RequestResponseBase {
declare class express$Request extends http$IncomingMessage mixins express$RequestResponseBase {
baseUrl: string;
- body: mixed;
+ body: any;
cookies: {[cookie: string]: string};
fresh: boolean;
hostname: string; | change req.body to any (#<I>) | flow-typed_flow-typed | train | js |
8020b9ec6227ab174a2ed21dd50716fce48a8e05 | diff --git a/library/CM/Usertext/Filter/Striptags.php b/library/CM/Usertext/Filter/Striptags.php
index <HASH>..<HASH> 100644
--- a/library/CM/Usertext/Filter/Striptags.php
+++ b/library/CM/Usertext/Filter/Striptags.php
@@ -2,20 +2,22 @@
class CM_Usertext_Filter_Striptags extends CM_Usertext_Filter_Abstract {
- private $_preserveParagraph;
+ private $_allowedTags;
/**
- * @param boolean $preserveParagraph
+ * @param array $allowedTags
*/
- function __construct($preserveParagraph = null) {
- $this->_preserveParagraph = (boolean) $preserveParagraph;
+ function __construct($allowedTags = null) {
+ $this->_allowedTags = (array) $allowedTags;
}
public function transform($text) {
$text = (string) $text;
- $allowedTags = null;
- if ($this->_preserveParagraph) {
- $allowedTags = '<p>';
+ $allowedTags = '';
+ if ($this->_allowedTags){
+ foreach($this->_allowedTags as $tag){
+ $allowedTags .= '<'.$tag.'>';
+ }
}
return strip_tags($text, $allowedTags);
} | CM_Usertext_Filter_Striptags: configurable as array of tags | cargomedia_cm | train | php |
61e9039abc956f0af71380ace7e5b0700d238a15 | diff --git a/para-server/src/main/java/com/erudika/para/security/JWTRestfulAuthFilter.java b/para-server/src/main/java/com/erudika/para/security/JWTRestfulAuthFilter.java
index <HASH>..<HASH> 100644
--- a/para-server/src/main/java/com/erudika/para/security/JWTRestfulAuthFilter.java
+++ b/para-server/src/main/java/com/erudika/para/security/JWTRestfulAuthFilter.java
@@ -167,7 +167,8 @@ public class JWTRestfulAuthFilter extends GenericFilterBean {
}
} else {
RestUtils.returnStatusResponse(response, HttpServletResponse.SC_BAD_REQUEST,
- "User belongs to an app that does not exist.");
+ "User belongs to app '" + appid + "' which does not exist. " +
+ (App.isRoot(appid) ? "Make sure you have initialized Para." : ""));
return false;
}
} else { | added more verbose log message for when a user belongs to an app that doesn't exist | Erudika_para | train | java |
ebf97fac198f0c62efa3d91f0804463b55ba1a7e | diff --git a/guake/customcommands.py b/guake/customcommands.py
index <HASH>..<HASH> 100644
--- a/guake/customcommands.py
+++ b/guake/customcommands.py
@@ -49,6 +49,9 @@ class CustomCommands():
return os.path.expanduser(self.settings.general.get_string('custom-command-file'))
def _load_json(self, file_name):
+ if not os.path.exists(file_name):
+ log.error("Custom file does not exit: %s", file_name)
+ return None
try:
with open(file_name) as f:
data_file = f.read() | error on non existing custom file
instead of exception in logs | Guake_guake | train | py |
47255485913cf8b61ac810b4368c94a1e04036d6 | diff --git a/Gruntfile.js b/Gruntfile.js
index <HASH>..<HASH> 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -53,7 +53,7 @@ module.exports = function(grunt) {
mochacli: {
options: {
require: ['should'],
- reporter: 'nyan',
+ reporter: 'spec',
bail: true
},
all: ['test/**/*.js'] | test: remove ASCII art (#<I>)
Closes #<I> | dequelabs_grunt-axe-webdriver | train | js |
0b906ff47f5fad4e4b1ffb9a42513d27ef9ea5e9 | diff --git a/corelib/kernel.rb b/corelib/kernel.rb
index <HASH>..<HASH> 100644
--- a/corelib/kernel.rb
+++ b/corelib/kernel.rb
@@ -439,6 +439,7 @@ module Kernel
meta._proto = #{self}.constructor.prototype;
meta._isSingleton = true;
meta.__inc__ = [];
+ meta._methods = [];
meta._scope = #{self}._scope; | meta classes need _methods property to allow singleton def methods | opal_opal | train | rb |
f027da608882919b3d543326d5125296c9bcd006 | diff --git a/lib/jwt/decode.rb b/lib/jwt/decode.rb
index <HASH>..<HASH> 100644
--- a/lib/jwt/decode.rb
+++ b/lib/jwt/decode.rb
@@ -22,7 +22,7 @@ module JWT
end
def decode_segments
- header_segment, payload_segment, crypto_segment = raw_segments(@jwt, @verify)
+ header_segment, payload_segment, crypto_segment = raw_segments
@header, @payload = decode_header_and_payload(header_segment, payload_segment)
@signature = Decode.base64url_decode(crypto_segment.to_s) if @verify
signing_input = [header_segment, payload_segment].join('.')
@@ -31,9 +31,9 @@ module JWT
private
- def raw_segments(jwt, verify)
- segments = jwt.split('.')
- required_num_segments = verify ? [3] : [2, 3]
+ def raw_segments
+ segments = @jwt.split('.')
+ required_num_segments = @verify ? [3] : [2, 3]
raise(JWT::DecodeError, 'Not enough or too many segments') unless required_num_segments.include? segments.length
segments
end | Refactor raw_segments.raw_segments
Remove parameters as they are already instance vars. | jwt_ruby-jwt | train | rb |
1eddd63e59c56cf732a9f525b736689df7eae008 | diff --git a/src/index.js b/src/index.js
index <HASH>..<HASH> 100644
--- a/src/index.js
+++ b/src/index.js
@@ -37,7 +37,7 @@
};
v.prototype.for = (iterator, func)=>{
for (let i = iterator.length - 1; i >= 0; i--) {
- func.apply(this, [iterator[i], arguments]);
+ func.apply(this, [iterator[i], i, arguments]);
}
};
v.prototype.forIn = (props, func)=>{ | Add the index itself to the for method arguments | jaszhix_vquery | train | js |
3986ea8d3588ad0b238b44e95fc453909f948d6d | diff --git a/config-templates/authsources.php b/config-templates/authsources.php
index <HASH>..<HASH> 100644
--- a/config-templates/authsources.php
+++ b/config-templates/authsources.php
@@ -74,7 +74,7 @@ $config = array(
* An authentication source which can authenticate against both SAML 2.0
* and Shibboleth 1.3 IdPs.
*/
- 'example-saml' => array(
+ 'saml' => array(
'saml:SP',
/* | Renaming SAML auth source to be saml and not saml-example | simplesamlphp_saml2 | train | php |
7b00a3cd1eedf449f0d08f63efc544ffb566ed08 | diff --git a/dygraph-canvas.js b/dygraph-canvas.js
index <HASH>..<HASH> 100644
--- a/dygraph-canvas.js
+++ b/dygraph-canvas.js
@@ -39,7 +39,7 @@
* The chart canvas has already been created by the Dygraph object. The
* renderer simply gets a drawing context.
*
- * @param {Dyraph} dygraph The chart to which this renderer belongs.
+ * @param {Dygraph} dygraph The chart to which this renderer belongs.
* @param {Canvas} element The <canvas> DOM element on which to draw.
* @param {CanvasRenderingContext2D} elementContext The drawing context.
* @param {DygraphLayout} layout The chart's DygraphLayout object. | Closure fix type Dyraph->Dygraph. | danvk_dygraphs | train | js |
ee905d0fe7a5f956d2d611f7d7c633c24a4e3cae | diff --git a/Facades/Route.php b/Facades/Route.php
index <HASH>..<HASH> 100755
--- a/Facades/Route.php
+++ b/Facades/Route.php
@@ -5,7 +5,6 @@ namespace Illuminate\Support\Facades;
/**
* @method static \Illuminate\Routing\Route fallback(\Closure|array|string|callable|null $action = null)
* @method static \Illuminate\Routing\Route get(string $uri, \Closure|array|string|callable|null $action = null)
- * @method static \Illuminate\Routing\Route head(string $uri, \Closure|array|string|callable|null $action = null)
* @method static \Illuminate\Routing\Route post(string $uri, \Closure|array|string|callable|null $action = null)
* @method static \Illuminate\Routing\Route put(string $uri, \Closure|array|string|callable|null $action = null)
* @method static \Illuminate\Routing\Route delete(string $uri, \Closure|array|string|callable|null $action = null) | Revert adding head method to router (#<I>)
This reverts <URL> | illuminate_support | train | php |
839fd3809bb41f8f3f5000a3b47780e8ee700f67 | diff --git a/formats/cql.py b/formats/cql.py
index <HASH>..<HASH> 100644
--- a/formats/cql.py
+++ b/formats/cql.py
@@ -108,6 +108,8 @@ class TokenExpression(object):
attribexprs.append(attribexpr)
else:
raise SyntaxError("Unexpected char whilst parsing token expression, position " + str(i) + ": " + s[i])
+ else:
+ raise SyntaxError("Expected token expression starting with either \" or [, got: " + s[i])
if i == len(s):
interval = None #end of query!
diff --git a/formats/folia.py b/formats/folia.py
index <HASH>..<HASH> 100644
--- a/formats/folia.py
+++ b/formats/folia.py
@@ -600,7 +600,7 @@ class AbstractElement(object):
return self.text(cls,retaintokenisation=True)
def text(self, cls='current', retaintokenisation=False, previousdelimiter="",strict=False):
- """Get the text associated with this element (of the specified class), will always be a unicode instance.
+ """Get the text associated with this element (of the specified class) (will always be a unicode instance in python 2)
The text will be constructed from child-elements whereever possible, as they are more specific.
If no text can be obtained from the children and the element has itself text associated with | Fixed major CQL parse bug that caused and infinite loop and memory drain on invalid input | proycon_pynlpl | train | py,py |
a13552d46fce4e4092453c14863131a785a87e14 | diff --git a/searchtweets/result_stream.py b/searchtweets/result_stream.py
index <HASH>..<HASH> 100644
--- a/searchtweets/result_stream.py
+++ b/searchtweets/result_stream.py
@@ -155,7 +155,7 @@ class ResultStream:
session_request_counter = 0
def __init__(self, endpoint, rule_payload, username=None, password=None,
- bearer_token=None, max_results=1000,
+ bearer_token=None, max_results=500,
tweetify=True, max_requests=None, **kwargs):
self.username = username | chagned max_results default value for ResultStream object to be inline with elsewhere in the library | twitterdev_search-tweets-python | train | py |
776b13f2ee30f72a3407bc28fe46f2518d1174dd | diff --git a/examples/qidle/qidle/main_window.py b/examples/qidle/qidle/main_window.py
index <HASH>..<HASH> 100644
--- a/examples/qidle/qidle/main_window.py
+++ b/examples/qidle/qidle/main_window.py
@@ -150,7 +150,7 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
"""
editor = PyCodeEdit(self)
self.setup_editor(editor)
- self.tabWidget.add_code_edit(editor, 'New document')
+ self.tabWidget.add_code_edit(editor, 'New document.py')
self.actionRun.setDisabled(True)
self.actionConfigure_run.setDisabled(True) | QIdle: Use "New document.py" (so that mimetype and tab icon are properly detected) | pyQode_pyqode.python | train | py |
1b6ab8924f702412e0396a5392f3f00a51660db0 | diff --git a/lib/grade/grade_item.php b/lib/grade/grade_item.php
index <HASH>..<HASH> 100644
--- a/lib/grade/grade_item.php
+++ b/lib/grade/grade_item.php
@@ -1331,7 +1331,7 @@ class grade_item extends grade_object {
if ($grade_category->aggregatesubcats) {
// return all children excluding category items
- $params[] = $grade_category->id;
+ $params[] = '%/' . $grade_category->id . '/%';
$sql = "SELECT gi.id
FROM {grade_items} gi
WHERE $gtypes
@@ -1339,8 +1339,7 @@ class grade_item extends grade_object {
AND gi.categoryid IN (
SELECT gc.id
FROM {grade_categories} gc
- WHERE gc.path LIKE '%/?/%')";
-
+ WHERE gc.path LIKE ?)";
} else {
$params[] = $grade_category->id;
$params[] = $grade_category->id; | MDL-<I> Re-fixing a regression in dependency calculation
Sorry for the last commit. This should be the proper way. The problem
was with the question mark within quotes - it was not considered as a
placeholder. | moodle_moodle | train | php |
b700f0546dbc07a2aff9e0deb634a8f9ce83524f | diff --git a/lib/manager.js b/lib/manager.js
index <HASH>..<HASH> 100644
--- a/lib/manager.js
+++ b/lib/manager.js
@@ -82,6 +82,8 @@ function Manager (server) {
, 'browser client handler': false
};
+ this.initStore();
+
// reset listeners
this.oldListeners = server.listeners('request');
server.removeAllListeners('request'); | Added call to `initStore` to initialize subscriptions. | socketio_socket.io | train | js |
f7647f93252ee8c33d87806fe1ba595ec386817a | diff --git a/src/Symfony/Component/Routing/RouteCollection.php b/src/Symfony/Component/Routing/RouteCollection.php
index <HASH>..<HASH> 100644
--- a/src/Symfony/Component/Routing/RouteCollection.php
+++ b/src/Symfony/Component/Routing/RouteCollection.php
@@ -95,7 +95,7 @@ class RouteCollection implements \IteratorAggregate
public function add($name, Route $route)
{
if (!preg_match('/^[a-z0-9A-Z_.]+$/', $name)) {
- throw new \InvalidArgumentException(sprintf('Name "%s" contains non valid characters for a route name.', $name));
+ throw new \InvalidArgumentException(sprintf('The provided route name "%s" contains non valid characters. A route name must only contain digits (0-9), letters (A-Z), underscores (_) and dots (.).', $name));
}
$parent = $this; | [Routing] improved exception message when giving an invalid route name. | symfony_symfony | train | php |
37ccee273fef76a6fa89ed268aaa22414af88bb4 | diff --git a/shared/reducers/chat2.js b/shared/reducers/chat2.js
index <HASH>..<HASH> 100644
--- a/shared/reducers/chat2.js
+++ b/shared/reducers/chat2.js
@@ -462,14 +462,17 @@ const rootReducer = (state: Types.State = initialState, action: Chat2Gen.Actions
} else if (message.type === 'placeholder') {
// sometimes we send then get a placeholder for that send. Lets see if we already have the message id for the sent
// and ignore the placeholder in that instance
+ logger.info(`Got placeholder message with id: ${message.id}`)
const existingOrdinal = messageIDToOrdinal(
- messageMap,
+ state.messageMap,
pendingOutboxToOrdinal,
conversationIDKey,
message.id
)
if (!existingOrdinal) {
arr.push(message.ordinal)
+ } else {
+ logger.info(`Skipping placeholder for message with id ${message.id} because already exists`)
}
} else {
arr.push(message.ordinal) | fix undefined var (#<I>) | keybase_client | train | js |
9c63e9156336cf3dc42ecb8f237962c8bf54fb54 | diff --git a/gnsq/stream/stream.py b/gnsq/stream/stream.py
index <HASH>..<HASH> 100644
--- a/gnsq/stream/stream.py
+++ b/gnsq/stream/stream.py
@@ -104,7 +104,6 @@ class Stream(object):
self.state = DISCONNECTED
self.queue.put(StopIteration)
- self.socket.close()
def send_loop(self):
for data, result in self.queue:
@@ -122,6 +121,8 @@ class Stream(object):
except Exception as error:
result.set_exception(error)
+ self.socket.close()
+
def upgrade_to_tls(
self,
keyfile=None, | Close socket only after all the messages have been sent. | wtolson_gnsq | train | py |
b4bbd2f4416e6e2b6ce51f04e00563efdd4b38f7 | diff --git a/testutil/wait.go b/testutil/wait.go
index <HASH>..<HASH> 100644
--- a/testutil/wait.go
+++ b/testutil/wait.go
@@ -11,7 +11,7 @@ type testFn func() (bool, error)
type errorFn func(error)
func WaitForResult(test testFn, error errorFn) {
- retries := 100
+ retries := 200
for retries > 0 {
time.Sleep(100 * time.Millisecond) | Adds more time to WaitForResult.
The last change here made the time overall theoretically the same, but the overhead of running so quickly before probably meant that we were spending longer. Tests seemed marginal in Travis so doubling this to see how things go. | hashicorp_consul | train | go |
ce34b373e20040aedd0d2745f43b5bf40b5bdb8c | diff --git a/owslib/swe/common.py b/owslib/swe/common.py
index <HASH>..<HASH> 100644
--- a/owslib/swe/common.py
+++ b/owslib/swe/common.py
@@ -109,7 +109,7 @@ class AbstractSimpleComponent(AbstractDataComponent):
self.axisID = testXMLAttribute(element,"axisID") # string, optional
# Elements
- self.quality = filter(None, [Quality(e) for e in element.findall(nspv("swe20:quality"))])
+ self.quality = filter(None, [Quality(q) for q in [e.find('*') for e in element.findall(nspv("swe20:quality"))] if q is not None])
try:
self.nilValues = NilValues(element.find(nspv("swe20:nilValues")))
except:
@@ -119,13 +119,13 @@ class Quality(object):
def __new__(cls, element):
t = element.tag.split("}")[-1]
if t == "Quantity":
- return Quantity.__new__(element)
+ return Quantity(element)
elif t == "QuantityRange":
- return QuantityRange.__new__(element)
+ return QuantityRange(element)
elif t == "Category":
- return Category.__new__(element)
+ return Category(element)
elif t == "Text":
- return Text.__new__(element)
+ return Text(element)
else:
return None | Fix Quality factory
The factory was incorrectly defined, but masked by the fact it was never getting the correct elements anyway. | geopython_OWSLib | train | py |
a94933f76b6d2a2543a8b1f96dc6c00af0e7a6f3 | diff --git a/emma2/msm/analysis/dense/fingerprints.py b/emma2/msm/analysis/dense/fingerprints.py
index <HASH>..<HASH> 100644
--- a/emma2/msm/analysis/dense/fingerprints.py
+++ b/emma2/msm/analysis/dense/fingerprints.py
@@ -32,7 +32,6 @@ def fingerprint_correlation(P, obs1, obs2=None, tau=1):
Returns
-------
- (timescales, amplitudes)
timescales : ndarray, shape=(n-1)
timescales of the relaxation processes of P
amplitudes : ndarray, shape=(n-1) | [msm/analysis/dense] Slight modifications to the fingerprint_correlation and fingerprint_relaxation functions | markovmodel_PyEMMA | train | py |
b7a7dd064e5e1c05f1390a66e196e1ebb79b15fa | diff --git a/select2.js b/select2.js
index <HASH>..<HASH> 100644
--- a/select2.js
+++ b/select2.js
@@ -1714,7 +1714,7 @@ the specific language governing permissions and limitations under the Apache Lic
self.liveRegion.text(results.text());
}
else {
- self.liveRegion.text(self.opts.formatMatches(results.find('.select2-result-selectable').length));
+ self.liveRegion.text(self.opts.formatMatches(results.find('.select2-result-selectable:not(".select2-selected")').length));
}
} | Fixes results count in accessible text
Only counts the selectable items in the list. (filter out selected item) | select2_select2 | train | js |
2ac6dd56aa48cd0a297f7978394d69e8fe9ee47f | diff --git a/test/run_all.rb b/test/run_all.rb
index <HASH>..<HASH> 100644
--- a/test/run_all.rb
+++ b/test/run_all.rb
@@ -1,3 +1,15 @@
-Dir.glob("#{__dir__}/*_spec.rb").each do |spec_file|
- require_relative spec_file
+# Because of needing to isolate processes, I can't run all tests in one call.
+# This means that I have multiple sets of results which isn't nice, but the
+# tests are largely for the sake of TDD anyway.
+
+def run_test(component)
+ test_path = File.expand_path __dir__
+ IO.popen("ruby #{test_path}/#{component}_spec.rb") do |data|
+ while line = data.gets
+ puts line
+ end
+ end
end
+
+run_test 'input'
+run_test 'conveyor' | Committed to never running the tests together due to process initialization | JScott_robot_sweatshop | train | rb |
5eb11afe91d139475b642e28e5bed0f0f42a0af0 | diff --git a/jre_emul/android/platform/libcore/ojluni/src/test/java/time/test/java/time/format/TestDateTimeFormatterBuilder.java b/jre_emul/android/platform/libcore/ojluni/src/test/java/time/test/java/time/format/TestDateTimeFormatterBuilder.java
index <HASH>..<HASH> 100644
--- a/jre_emul/android/platform/libcore/ojluni/src/test/java/time/test/java/time/format/TestDateTimeFormatterBuilder.java
+++ b/jre_emul/android/platform/libcore/ojluni/src/test/java/time/test/java/time/format/TestDateTimeFormatterBuilder.java
@@ -979,7 +979,7 @@ public class TestDateTimeFormatterBuilder {
public void test_getLocalizedDateTimePattern(FormatStyle dateStyle, FormatStyle timeStyle,
Chronology chrono, Locale locale, String expected) {
String actual = DateTimeFormatterBuilder.getLocalizedDateTimePattern(dateStyle, timeStyle, chrono, locale);
- assertEquals(actual, expected, "Pattern " + convertNonAscii(actual));
+ assertEquals("Pattern " + convertNonAscii(actual), actual, expected);
}
@Test(expected=java.lang.IllegalArgumentException.class) | java.time: fix order of arguments after converting from testng to junit. | google_j2objc | train | java |
9f5ecdfe23159b82f0e5828aa8420fa7fa8e46dd | diff --git a/src/Console/Commands/DebugBarAssetsCommand.php b/src/Console/Commands/DebugBarAssetsCommand.php
index <HASH>..<HASH> 100644
--- a/src/Console/Commands/DebugBarAssetsCommand.php
+++ b/src/Console/Commands/DebugBarAssetsCommand.php
@@ -80,8 +80,9 @@ class DebugBarAssetsCommand extends QtCommand
}
}
}
+
+ closedir($dir);
}
- closedir($dir);
}
} | Checking the directory for closedir() funcntion | softberg_quantum-core | train | php |
b5859d4b4361c8dc338edb4df9efed641bc12dd1 | diff --git a/wandb/board/ui/src/util/query.js b/wandb/board/ui/src/util/query.js
index <HASH>..<HASH> 100644
--- a/wandb/board/ui/src/util/query.js
+++ b/wandb/board/ui/src/util/query.js
@@ -53,9 +53,22 @@ export function merge(base, apply) {
result.strategy = apply.strategy;
result.entity = apply.entity || base.entity;
result.model = apply.model || base.model;
- result.filters = {...base.filters, ...apply.filters};
+
+ // base and apply may share keys, so we rekey
+ result.filters = {};
+ let filterIndex = 0;
+ for (var key of _.keys(base.filters)) {
+ result.filters[filterIndex] = base.filters[key];
+ filterIndex++;
+ }
+ for (var key of _.keys(apply.filters)) {
+ result.filters[filterIndex] = apply.filters[key];
+ filterIndex++;
+ }
+
// TODO: probably not the right thing to do
result.selections = {...base.selections};
+
result.sort = apply.sort || base.sort;
result.num_histories = apply.num_histories || base.num_histories;
return result; | Fix incorrect filter merge from page to panel | wandb_client | train | js |
Subsets and Splits
Java Commits in Train Set
Queries for all entries where the diff_languages column is 'java', providing a filtered dataset but without deeper analysis.
Java Commits Test Data
Returns a subset of 5000 entries from the dataset where the programming language difference is Java, providing basic filtering for exploration.
Java Commits Sample
Retrieves the first 1,000 records where the 'diff_languages' column is 'java', providing limited insight into the specific data entries.
Java Commits Validation Sample
Retrieves a sample of entries from the validation dataset where the diff languages are Java, providing limited insight into specific Java-related data points.
Java Commits in Validation
This query retrieves a limited sample of entries from the validation dataset where the programming language difference is Java, providing basic filtering with minimal insight.
Java Commits Sample
This query retrieves a sample of 100 records where the 'diff_languages' is 'java', providing basic filtering but limited analytical value.
Java Commits Sample
Retrieves 100 samples where the language difference is Java, providing basic filtering but minimal analytical value.
Java Commits Sample
Retrieves 10 samples where the diff_languages column is 'java', providing basic examples of data entries with this specific language.
Java Commits Validation Sample
Retrieves 1,000 records where the differences in languages are marked as Java, providing a snapshot of that specific subset but limited to raw data.
Java Commits Sample
This query retrieves 1000 random samples from the dataset where the programming language is Java, offering limited insight beyond raw data.