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
|
---|---|---|---|---|---|
ee6c3b670c4a084210daee1b989aae3ba813bdfa | diff --git a/src/Content/Auditor/Result.php b/src/Content/Auditor/Result.php
index <HASH>..<HASH> 100644
--- a/src/Content/Auditor/Result.php
+++ b/src/Content/Auditor/Result.php
@@ -145,4 +145,20 @@ class Result extends Relational
return $this->get('status');
}
+
+ /**
+ * Load a record by scope and scope_id
+ *
+ * @param string $scope
+ * @param integer $scope_id
+ * @return object
+ */
+ public static function oneByScope($scope, $scope_id)
+ {
+ return self::all()
+ ->whereEquals('scope', $scope)
+ ->whereEquals('scope_id', $scope_id)
+ ->ordered()
+ ->row();
+ }
} | Adding helper method for retrieving a record by scope and scope_id (#<I>) | hubzero_framework | train | php |
47f5b5f3f7aeb7dfadfdc0dc1a1882d64d1d74fe | diff --git a/ui/js/directives/treeherder/clonejobs.js b/ui/js/directives/treeherder/clonejobs.js
index <HASH>..<HASH> 100644
--- a/ui/js/directives/treeherder/clonejobs.js
+++ b/ui/js/directives/treeherder/clonejobs.js
@@ -103,7 +103,7 @@ treeherder.directive('thCloneJobs', [
if ($(".selected-job").css('display') === 'none') {
$rootScope.closeJob();
}
- thNotify.send("No more " + jobNavSelector.name + " to select", "warning");
+ thNotify.send("No " + jobNavSelector.name + " to select", "warning");
}, 0);
}); | Bug <I> - Improve the unclassified failure selection message | mozilla_treeherder | train | js |
df7270d8a5509f24d487e26ac00bc17888da259b | diff --git a/smpte-timecode.js b/smpte-timecode.js
index <HASH>..<HASH> 100644
--- a/smpte-timecode.js
+++ b/smpte-timecode.js
@@ -50,7 +50,7 @@
}
else if (typeof timeCode == 'object' && timeCode instanceof Date) {
var midnight = new Date( timeCode.getFullYear(), timeCode.getMonth(), timeCode.getDate(),0,0,0 );
- this.frameCount = Math.floor(((timeCode-midnight)*this.frameRate))/1000;
+ this.frameCount = Math.floor(((timeCode-midnight)*this.frameRate)/1000);
}
else if (typeof timeCode == 'undefined') {
this.frameCount = 0; | Move floor() parenthesis for Date initializer
Instead of using Math.round(), moving the closing parenthesis to encapsulate the whole operation in Math.floor() avoids fractional frame counts while still maintaining the validity of the operation. | CrystalComputerCorp_smpte-timecode | train | js |
ff6b205cd87b68b1e4e32fff88a78225921e4400 | diff --git a/yamcs-client/yamcs/core/client.py b/yamcs-client/yamcs/core/client.py
index <HASH>..<HASH> 100644
--- a/yamcs-client/yamcs/core/client.py
+++ b/yamcs-client/yamcs/core/client.py
@@ -10,7 +10,7 @@ from yamcs.core.exceptions import (ConnectionFailure, NotFound, Unauthorized,
from yamcs.protobuf.web import web_pb2
-def _convert_credentials(token_url, username=None, password=None, refresh_token=None):
+def _convert_credentials(session, token_url, username=None, password=None, refresh_token=None):
"""
Converts username/password credentials to token credentials by
using Yamcs as the authenticaton server.
@@ -22,7 +22,7 @@ def _convert_credentials(token_url, username=None, password=None, refresh_token=
else:
raise NotImplementedError()
- response = requests.post(token_url, data=data)
+ response = session.post(token_url, data=data)
if response.status_code == 401:
raise Unauthorized('401 Client Error: Unauthorized')
elif response.status_code == 200:
@@ -63,6 +63,7 @@ class BaseClient(object):
if self.credentials and self.credentials.username: # Convert u/p to bearer
token_url = self.auth_root + '/token'
self.credentials = _convert_credentials(
+ self.session,
token_url,
username=self.credentials.username,
password=self.credentials.password) | use TLS verify option in credentials related request | yamcs_yamcs-python | train | py |
a8202eb80d6f24afc996288f14873f58963d58bd | diff --git a/test/unit/data/schema/integrity_spec.js b/test/unit/data/schema/integrity_spec.js
index <HASH>..<HASH> 100644
--- a/test/unit/data/schema/integrity_spec.js
+++ b/test/unit/data/schema/integrity_spec.js
@@ -40,7 +40,7 @@ describe('DB version integrity', function () {
// If this test is failing, then it is likely a change has been made that requires a DB version bump,
// and the values above will need updating as confirmation
it('should not change without fixing this test', function () {
- const routesPath = path.join(config.getContentPath('settings'), 'routes.yaml');
+ const routesPath = path.join(config.getContentPath('settings'), 'routes-default.yaml');
const defaultRoutes = validateFrontendSettings(yaml.safeLoad(fs.readFileSync(routesPath, 'utf-8')));
const tablesNoValidation = _.cloneDeep(schema.tables); | Fixed regression test for integrity check
no issue
- The file that is better suited for integrity check is the `*-default.yaml` config because it's the one that gets copied through when there is none or configuration is broken | TryGhost_Ghost | train | js |
440c3a08abc534834f8161a3c53d1fbeb67e50ec | diff --git a/server/libs/mongo.js b/server/libs/mongo.js
index <HASH>..<HASH> 100644
--- a/server/libs/mongo.js
+++ b/server/libs/mongo.js
@@ -86,7 +86,6 @@ export default {
}
}
}
- console.log(url + dbName, ' - db connected')
}
cb()
}) | Only log mongo connections on failure. | OpenNeuroOrg_openneuro | train | js |
93d702e3d2b1032bdc083fba8031be54bfc9e962 | diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -1,10 +1,11 @@
-from setuptools import setup, find_packages
+import glob
+from io import open # for open(..,encoding=...) parameter in python 2
from os import walk
from os.path import join, dirname, sep
import os
-import glob
import re
+from setuptools import setup, find_packages
# NOTE: All package data should also be set in MANIFEST.in
@@ -52,13 +53,19 @@ recursively_include(package_data, 'pythonforandroid/bootstraps/webview',
recursively_include(package_data, 'pythonforandroid',
['liblink', 'biglink', 'liblink.sh'])
-with open(join(dirname(__file__), 'README.md')) as fileh:
+with open(join(dirname(__file__), 'README.md'),
+ encoding="utf-8",
+ errors="replace",
+ ) as fileh:
long_description = fileh.read()
init_filen = join(dirname(__file__), 'pythonforandroid', '__init__.py')
version = None
try:
- with open(init_filen) as fileh:
+ with open(init_filen,
+ encoding="utf-8",
+ errors="replace"
+ ) as fileh:
lines = fileh.readlines()
except IOError:
pass | Fix setup.py breaking when unicode characters are in README.md in Python 3 | kivy_python-for-android | train | py |
c66360ace0aa0e8d9068f9bd4c4c3b206327979e | diff --git a/tests/test_gaussian.py b/tests/test_gaussian.py
index <HASH>..<HASH> 100644
--- a/tests/test_gaussian.py
+++ b/tests/test_gaussian.py
@@ -122,8 +122,8 @@ class TestDiagonalGaussianNonconjNIG(BigDataGibbsTester,GewekeGibbsTester,BasicT
)
def params_close(self,d1,d2):
- return np.linalg.norm(d1.mu - d2.mu) < 0.1*np.sqrt(d1.mu.shape[0]) \
- and np.linalg.norm(d1.sigmas-d2.sigmas) < 0.25*d1.sigmas.shape[0]
+ return np.linalg.norm(d1.mu - d2.mu) < 0.25*np.sqrt(d1.mu.shape[0]) \
+ and np.linalg.norm(d1.sigmas-d2.sigmas) < 0.5*d1.sigmas.shape[0]
def geweke_statistics(self,d,data):
return np.concatenate((d.mu,d.sigmas)) | relax DiagonalGaussianNonconjNIG test (these tests fail randomly) | mattjj_pybasicbayes | train | py |
ad1ccb3517f6016730d29966cb188cec74cfa973 | diff --git a/index.js b/index.js
index <HASH>..<HASH> 100644
--- a/index.js
+++ b/index.js
@@ -159,6 +159,10 @@
if (typeof componentClass === "function" && !componentClass.prototype.render && !componentClass.isReactClass && !React.Component.isPrototypeOf(componentClass)) {
return observer(React.createClass({
displayName: componentClass.name,
+ propTypes: componentClass.propTypes,
+ getDefaultProps: function() {
+ return componentClass.defaultProps;
+ },
render: function() {
return componentClass.call(this, this.props);
} | fixed propTypes and defaultProps on stateless components | mobxjs_mobx-react | train | js |
6f2b4bff34164624a5607d0e93c4c8674d6ccbc2 | diff --git a/lib/Saml2/Response.php b/lib/Saml2/Response.php
index <HASH>..<HASH> 100644
--- a/lib/Saml2/Response.php
+++ b/lib/Saml2/Response.php
@@ -525,6 +525,7 @@ class OneLogin_Saml2_Response
* Gets the Issuers (from Response and Assertion).
*
* @return array @issuers The issuers of the assertion/response
+ * @throws OneLogin_Saml2_ValidationError
*/
public function getIssuers()
{ | Add missing throw tag to \OneLogin_Saml2_Response::getIssuers | onelogin_php-saml | train | php |
7821d93412d11c944ae6ea4078402a65b50809c3 | diff --git a/code/libraries/koowa/libraries/view/abstract.php b/code/libraries/koowa/libraries/view/abstract.php
index <HASH>..<HASH> 100644
--- a/code/libraries/koowa/libraries/view/abstract.php
+++ b/code/libraries/koowa/libraries/view/abstract.php
@@ -413,7 +413,7 @@ abstract class KViewAbstract extends KObject implements KViewInterface
$states = array();
foreach($this->getModel()->getState() as $name => $state)
{
- if($state->default != $state->value) {
+ if($state->default != $state->value && !$state->internal) {
$states[$name] = $state->value;
}
}
@@ -424,8 +424,7 @@ abstract class KViewAbstract extends KObject implements KViewInterface
$url = JRoute::_('index.php?'.http_build_query($parts), $escape);
//Add the host and the schema
- if ($fqr === true)
- {
+ if ($fqr === true) {
$url = $this->getUrl()->toString(KHttpUrl::AUTHORITY) . '/' . $url;
} | re #<I> : Do not include 'internal' state properties in the route. | joomlatools_joomlatools-framework | train | php |
5685e9aed618845d3ef6ba959e054c856456340f | diff --git a/lib50/_api.py b/lib50/_api.py
index <HASH>..<HASH> 100644
--- a/lib50/_api.py
+++ b/lib50/_api.py
@@ -485,12 +485,22 @@ class Slug:
"""Get branches from org/repo."""
if self.offline:
local_path = get_local_path() / self.org / self.repo
- get_refs = f"git -C {shlex.quote(str(local_path))} show-ref --heads"
+ output = _run(f"git -C {shlex.quote(str(local_path))} show-ref --heads").split("\n")
else:
- get_refs = f"git ls-remote --heads https://github.com/{self.org}/{self.repo}"
+ cmd = f"git ls-remote --heads https://github.com/{self.org}/{self.repo}"
+ try:
+ with _spawn(cmd, timeout=3) as child:
+ output = child.read().strip().split("\r\n")
+ except pexpect.TIMEOUT:
+ if "Username for" in child.buffer:
+ return []
+ else:
+ raise TimeoutError(3)
+
# Parse get_refs output for the actual branch names
- return (line.split()[1].replace("refs/heads/", "") for line in _run(get_refs, timeout=3).split("\n"))
+ return (line.split()[1].replace("refs/heads/", "") for line in output)
+ | look for 'Username for' when doing git ls-remote | cs50_lib50 | train | py |
fc85517188bd6be95527b1262ad721f9949444ee | diff --git a/src/components/AutoCompleteInput.js b/src/components/AutoCompleteInput.js
index <HASH>..<HASH> 100644
--- a/src/components/AutoCompleteInput.js
+++ b/src/components/AutoCompleteInput.js
@@ -110,7 +110,6 @@ export default class AutoCompleteInput extends React.Component<AutoCompleteInput
isLoading: true,
open: true,
error: '',
- suggestions: [],
queryValue: query,
userInput: query,
queryTimestamp: Date.now(), | Fix to prevent autocomplete shakiness when updating suggestions (#<I>) | attivio_suit | train | js |
7d0a7f610706c509b87eec1af71e2ab232b3d51f | diff --git a/src/main/java/org/deepsymmetry/beatlink/data/TimeFinder.java b/src/main/java/org/deepsymmetry/beatlink/data/TimeFinder.java
index <HASH>..<HASH> 100644
--- a/src/main/java/org/deepsymmetry/beatlink/data/TimeFinder.java
+++ b/src/main/java/org/deepsymmetry/beatlink/data/TimeFinder.java
@@ -452,7 +452,9 @@ public class TimeFinder extends LifecycleParticipant {
}
/**
- * Reacts to beat messages to update the definitive playback position for that player
+ * Reacts to beat messages to update the definitive playback position for that player. Because we may sometimes get
+ * a beat packet before a corresponding device update containing the actual beat number, don't increment past the
+ * end of the beat grid, because we must be looping if we get an extra beat there.
*/
private final BeatListener beatListener = new BeatListener() {
@Override
@@ -471,7 +473,7 @@ public class TimeFinder extends LifecycleParticipant {
beatNumber = 1;
definitive = false;
} else {
- beatNumber = lastPosition.beatNumber + 1;
+ beatNumber = Math.min(lastPosition.beatNumber + 1, beatGrid.beatCount); // Handle loop at end
definitive = true;
} | More graciously handle looping at end.
It is actually valid to get the beat packet telling us we have looped
before we know where we have looped to (an oversight in the protocol
does not include the beat number in a beat packet!) so assume we are
looping back a beat and don't log a warning. | Deep-Symmetry_beat-link | train | java |
3ca84399d6d3f7a4396ea841297d4155dffe8fb5 | diff --git a/lib/workers/pr/index.js b/lib/workers/pr/index.js
index <HASH>..<HASH> 100644
--- a/lib/workers/pr/index.js
+++ b/lib/workers/pr/index.js
@@ -120,8 +120,8 @@ async function ensurePr(prConfig) {
depName: upgrade.depName,
fromVersion: upgrade.fromVersion,
toVersion: upgrade.toVersion,
- repositoryUrl: config.repositoryUrl,
- releases: config.releases,
+ repositoryUrl: upgrade.repositoryUrl,
+ releases: upgrade.releases,
});
if (logJSON) { | fix(changelog): use upgrade for lookups | renovatebot_renovate | train | js |
d54ef5988129012939b8be26a34a50fa9e719ac5 | diff --git a/tests/test_web.py b/tests/test_web.py
index <HASH>..<HASH> 100644
--- a/tests/test_web.py
+++ b/tests/test_web.py
@@ -677,6 +677,11 @@ class TestWeb():
return_data = json.loads(rv.data)
assert_equal(return_data['error'], "job_id not found")
+ def test_getting_job_data_for_missing_job(self):
+ self.login()
+ rv = app.get('/job/somefoo/data')
+ assert rv.status_code == 404, rv.status
+
def test_z_test_list(self):
# has z because needs some data to be useful | Test getting data from job that does not exist | ckan_ckan-service-provider | train | py |
3c2791c30a1907178f8a82839d446b0d8d0139c2 | diff --git a/angularjs-portal-home/src/main/webapp/js/app-config.js b/angularjs-portal-home/src/main/webapp/js/app-config.js
index <HASH>..<HASH> 100644
--- a/angularjs-portal-home/src/main/webapp/js/app-config.js
+++ b/angularjs-portal-home/src/main/webapp/js/app-config.js
@@ -31,7 +31,7 @@ define(['angular'], function(angular) {
'notificationsURL' : '/web/staticFeeds/notifications.json',
'groupURL' : '/portal/api/groups',
'kvURL' : '/storage/',
- 'googleSearchURL' : '/web/staticFeeds/gcs.json'
+ 'googleSearchURL' : '/web/staticFeeds/gcs.json?firstVariablemock=true'
})
.constant('NAMES', {
'title' : 'MyUW', | mocking out the first variable in gcsURL | uPortal-Project_uportal-home | train | js |
dcb552198da5d76c14afccd33f88f45abff02778 | diff --git a/morango/models/core.py b/morango/models/core.py
index <HASH>..<HASH> 100644
--- a/morango/models/core.py
+++ b/morango/models/core.py
@@ -353,15 +353,19 @@ class Store(AbstractStore):
app_model._morango_dirty_bit = False
try:
+
# validate and return the model
app_model.cached_clean_fields(fk_cache)
return app_model
+
except (exceptions.ValidationError, exceptions.ObjectDoesNotExist) as e:
+
logger.warn(
"Error deserializing instance of {model} with id {id}: {error}".format(
model=klass_model.__name__, id=app_model.id, error=e
)
)
+
# check FKs in store to see if any of those models were deleted or hard_deleted to propagate to this model
fk_ids = [
getattr(app_model, field.attname)
@@ -379,6 +383,8 @@ class Store(AbstractStore):
return None
except Store.DoesNotExist:
pass
+
+ # if we got here, it means the validation error wasn't handled by propagating deletion, so re-raise it
raise e | Add comment to explain why exception is being re-raised | learningequality_morango | train | py |
3e2d120019ded6c4a1573908a345beb21111d111 | diff --git a/src/errors.js b/src/errors.js
index <HASH>..<HASH> 100644
--- a/src/errors.js
+++ b/src/errors.js
@@ -25,7 +25,7 @@ errors.SubstanceError = function(name, code, message) {
this.__stack = util.callstack(1);
};
-errors.SubstanceError.__prototype__ = function() {
+errors.SubstanceError.Prototype = function() {
this.toString = function() {
return this.name+":"+this.message;
@@ -45,7 +45,7 @@ errors.SubstanceError.__prototype__ = function() {
};
};
-errors.SubstanceError.prototype = new errors.SubstanceError.__prototype__();
+errors.SubstanceError.prototype = new errors.SubstanceError.Prototype();
Object.defineProperty(errors.SubstanceError.prototype, "stack", {
get: function() { | rename: __prototype__ => Prototype | substance_util | train | js |
1d1b71e52e25bf7f6b79d1d16a58b49e32a276e8 | diff --git a/tests/unit/Codeception/Util/JsonArrayTest.php b/tests/unit/Codeception/Util/JsonArrayTest.php
index <HASH>..<HASH> 100644
--- a/tests/unit/Codeception/Util/JsonArrayTest.php
+++ b/tests/unit/Codeception/Util/JsonArrayTest.php
@@ -71,8 +71,14 @@ class JsonArrayTest extends \Codeception\TestCase\Test
'data' => [0, 0, 0],
];
- $this->assertFalse($jsonArray->containsArray($expectedArray));
-
+ $this->assertFalse($jsonArray->containsArray($expectedArray));
+ }
+
+ public function testContainsArrayMatchesArrayWithValueRepeatedMultipleTimesCorrectly()
+ {
+ $jsonArray = new JsonArray(json_encode(['foo', 'foo', 'bar']));
+ $expectedArray = ['foo', 'foo', 'foo'];
+ $this->assertFalse($jsonArray->containsArray($expectedArray));
}
}
\ No newline at end of file | Another test for issue #<I> | Codeception_base | train | php |
f483dc474c8c88eb0315489fd211ec819f717b42 | diff --git a/lib/ssh/connection.js b/lib/ssh/connection.js
index <HASH>..<HASH> 100644
--- a/lib/ssh/connection.js
+++ b/lib/ssh/connection.js
@@ -34,7 +34,7 @@ function Connection(options) {
*/
Connection.prototype.spawn = function (command) {
- return sh.spawn('ssh', [this.remote, command]);
+ return sh.spawn('ssh', ['-tt', this.remote, command]);
};
/**
diff --git a/test/unit/ssh/connection.js b/test/unit/ssh/connection.js
index <HASH>..<HASH> 100644
--- a/test/unit/ssh/connection.js
+++ b/test/unit/ssh/connection.js
@@ -47,7 +47,7 @@ describe('SSH Connection', function () {
it('should spawn a new ssh process', function () {
expect(connection.spawn('my-command')).to.equal('spawn');
- expect(childProcess.spawn).to.be.calledWith('ssh', [connection.remote, 'my-command']);
+ expect(childProcess.spawn).to.be.calledWith('ssh', ['-tt', connection.remote, 'my-command']);
});
}); | Use a TTY in ssh command. | shipitjs_grunt-shipit | train | js,js |
e1ac6fa16c1e965891eb6b2ba87c81669648454a | diff --git a/classes/MUtil/Filter/Dutch/Burgerservicenummer.php b/classes/MUtil/Filter/Dutch/Burgerservicenummer.php
index <HASH>..<HASH> 100644
--- a/classes/MUtil/Filter/Dutch/Burgerservicenummer.php
+++ b/classes/MUtil/Filter/Dutch/Burgerservicenummer.php
@@ -55,8 +55,13 @@ class MUtil_Filter_Dutch_Burgerservicenummer extends Zend_Filter_Digits
*/
public function filter($value)
{
- $value = parent::filter($value);
+ $newValue = parent::filter($value);
- return str_pad($value, 9, '0', STR_PAD_LEFT);
+ if (intval($newValue)) {
+ return str_pad($value, 9, '0', STR_PAD_LEFT);
+ }
+
+ // Return as is when e.g. ********* or nothing
+ return $value;
}
} | To greedy in adding zero's | GemsTracker_gemstracker-library | train | php |
da90f46d762f9662036e56676e24ab44571d63b3 | diff --git a/lib/adapters/object.js b/lib/adapters/object.js
index <HASH>..<HASH> 100644
--- a/lib/adapters/object.js
+++ b/lib/adapters/object.js
@@ -243,8 +243,8 @@ var Graph = function (_AncientGraph) {
key: '_generateLink',
value: function _generateLink(document) {
var link = {};
- for (var f in document) {
- if (this.fields[f]) {
+ for (var f in this.fields) {
+ if (document.hasOwnProperty(this.fields[f])) {
link[f] = document[this.fields[f]];
}
}
diff --git a/src/lib/adapters/object.js b/src/lib/adapters/object.js
index <HASH>..<HASH> 100644
--- a/src/lib/adapters/object.js
+++ b/src/lib/adapters/object.js
@@ -190,8 +190,8 @@ export class Graph extends AncientGraph {
*/
_generateLink(document) {
var link = {};
- for (var f in document) {
- if (this.fields[f]) {
+ for (var f in this.fields) {
+ if (document.hasOwnProperty(this.fields[f])) {
link[f] = document[this.fields[f]];
}
} | fix(adapter): Fix document to link generation. | AncientSouls_Graph | train | js,js |
9fb02ed864e7b288c96eda360550cbee46edbddd | diff --git a/translator/src/main/java/com/google/devtools/j2objc/Options.java b/translator/src/main/java/com/google/devtools/j2objc/Options.java
index <HASH>..<HASH> 100644
--- a/translator/src/main/java/com/google/devtools/j2objc/Options.java
+++ b/translator/src/main/java/com/google/devtools/j2objc/Options.java
@@ -76,8 +76,7 @@ public class Options {
private static boolean docCommentsEnabled = false;
private static boolean finalMethodsAsFunctions = true;
private static boolean removeClassMethods = false;
- // TODO(tball): set true again when native code accessing private Java methods is fixed.
- private static boolean hidePrivateMembers = false;
+ private static boolean hidePrivateMembers = true;
private static int batchTranslateMaximum = 0;
private static File proGuardUsageFile = null; | Changed hide-private-members default to true, now that affected code has been updated. | google_j2objc | train | java |
df4076c772b2e5e47c71020bf7d725e50b28a7d5 | diff --git a/src/you_get/extractors/tumblr.py b/src/you_get/extractors/tumblr.py
index <HASH>..<HASH> 100644
--- a/src/you_get/extractors/tumblr.py
+++ b/src/you_get/extractors/tumblr.py
@@ -3,10 +3,13 @@
__all__ = ['tumblr_download']
from ..common import *
-
-import re
+from .universal import *
def tumblr_download(url, output_dir='.', merge=True, info_only=False, **kwargs):
+ if re.match(r'https?://\d+\.media\.tumblr\.com/', url):
+ universal_download(url, output_dir, merge=merge, info_only=info_only)
+ return
+
html = parse.unquote(get_html(url)).replace('\/', '/')
feed = r1(r'<meta property="og:type" content="tumblr-feed:(\w+)" />', html) | [tumblr] support direct URLs | soimort_you-get | train | py |
5d63f5ec92cb966862cb873c048672906c820e68 | diff --git a/packages/xod-espruino/webpack/base.js b/packages/xod-espruino/webpack/base.js
index <HASH>..<HASH> 100644
--- a/packages/xod-espruino/webpack/base.js
+++ b/packages/xod-espruino/webpack/base.js
@@ -20,6 +20,7 @@ module.exports = {
],
resolve: {
modulesDirectories: [
+ 'node_modules',
pkgpath('node_modules'),
pkgpath('node_modules/xod-core/node_modules'),
], | fix(xod-espruino): quick fix for webpack config (cant find isarray package in tests) | xodio_xod | train | js |
2ed4997061c6b9fa4bfc9063cc2f573e95da06c4 | diff --git a/lib/sloe/version.rb b/lib/sloe/version.rb
index <HASH>..<HASH> 100644
--- a/lib/sloe/version.rb
+++ b/lib/sloe/version.rb
@@ -1,3 +1,3 @@
module Sloe
- VERSION = "0.0.2"
+ VERSION = "0.0.3"
end | bumped version to <I> | dgjnpr_Sloe | train | rb |
b27f21b92edcf7b5350e5c03fe12df5426c8dc68 | diff --git a/cmd/runtimetest/main.go b/cmd/runtimetest/main.go
index <HASH>..<HASH> 100644
--- a/cmd/runtimetest/main.go
+++ b/cmd/runtimetest/main.go
@@ -41,7 +41,6 @@ var (
"/dev/random",
"/dev/urandom",
"/dev/tty",
- "/dev/console",
"/dev/ptmx",
}
)
@@ -344,6 +343,9 @@ func validateLinuxDevices(spec *rspec.Spec) error {
func validateDefaultDevices(spec *rspec.Spec) error {
logrus.Debugf("validating linux default devices")
+ if spec.Process.Terminal {
+ defaultDevices = append(defaultDevices, "/dev/console")
+ }
for _, device := range defaultDevices {
fi, err := os.Stat(device)
if err != nil { | runtimetest: fix linux default devices validation
According to runtime SPEC, /dev/console will exist if Terminal is true | opencontainers_runtime-tools | train | go |
1f857f0053606c23cb3f1abd794e3efbf6981e09 | diff --git a/tests/test_commands.py b/tests/test_commands.py
index <HASH>..<HASH> 100644
--- a/tests/test_commands.py
+++ b/tests/test_commands.py
@@ -2656,7 +2656,7 @@ class TestBinarySave(object):
r.rpush(key, *value)
# check that KEYS returns all the keys as they are
- assert sorted(r.keys('*')) == sorted(list(iterkeys(mapping)))
+ assert sorted(r.keys('*')) == sorted(iterkeys(mapping))
# check that it is possible to get list content by key name
for key, value in iteritems(mapping): | Remove unnecessary coerce to list (#<I>)
sorted() takes any iterable and always returns a new list. No need to
eagerly coerce to a list. | andymccurdy_redis-py | train | py |
33e6e5b02b2fbb3cdcbb0163584f65b642d6e691 | diff --git a/Net/OpenID/CryptUtil.php b/Net/OpenID/CryptUtil.php
index <HASH>..<HASH> 100644
--- a/Net/OpenID/CryptUtil.php
+++ b/Net/OpenID/CryptUtil.php
@@ -51,7 +51,7 @@ class Net_OpenID_CryptUtil {
$bytes = '';
$f = @fopen("/dev/urandom", "r");
if ($f === FALSE) {
- if (!defined(Net_OpenID_USE_INSECURE_RAND)) {
+ if (!defined('Net_OpenID_USE_INSECURE_RAND')) {
trigger_error('Set Net_OpenID_USE_INSECURE_RAND to ' .
'continue with insecure random.',
E_USER_ERROR); | [project @ Fixed defined() call] | openid_php-openid | train | php |
c4128be0f944b4c8bcc3dfffe9c3c4444b6b1d97 | diff --git a/ept/config/errors.go b/ept/config/errors.go
index <HASH>..<HASH> 100644
--- a/ept/config/errors.go
+++ b/ept/config/errors.go
@@ -10,4 +10,5 @@ var (
ErrCertCanNotRead = errors.New("cannot read certificate file")
ErrCertNotFound = errors.New("certificate can not be found in the specified path")
ErrCancel = errors.New("canceled sending product config to session server")
+ ErrRetrySec = errors.New("retrySec must be greater than 0")
)
diff --git a/ept/config/server.go b/ept/config/server.go
index <HASH>..<HASH> 100644
--- a/ept/config/server.go
+++ b/ept/config/server.go
@@ -159,6 +159,9 @@ func parseLine(keys map[string]bool,
func PushConfig(ctx context.Context, sessSrvConfig *srv.Config,
logger *util.Logger, username, password, confPath,
caPath string, keys []string, retrySec int64) error {
+ if retrySec <= 0 {
+ return ErrRetrySec
+ }
conf, err := ServerConfig(confPath, false, keys)
if err != nil {
return err | the `retrySec` must be greater than 0 | Privatix_dappctrl | train | go,go |
51cc3de027526c37f968e4cf3f5a05b7b2d4d164 | diff --git a/lib/rubikon/application/instance_methods.rb b/lib/rubikon/application/instance_methods.rb
index <HASH>..<HASH> 100644
--- a/lib/rubikon/application/instance_methods.rb
+++ b/lib/rubikon/application/instance_methods.rb
@@ -88,7 +88,6 @@ module Rubikon
hook.call(:post_execute)
@current_command = nil
- InstanceMethods.instance_method(:reset).bind(self).call
result
rescue
raise $! if @settings[:raise_errors]
@@ -96,6 +95,8 @@ module Rubikon
puts "Error:\n #{$!.message}"
puts " #{$!.backtrace.join("\n ")}" if $DEBUG
exit 1
+ ensure
+ InstanceMethods.instance_method(:reset).bind(self).call
end
end | Ensure resetting the application on errors | koraktor_rubikon | train | rb |
ff7728867b1a71cead4a582a0ee7fe17cf9fdc48 | diff --git a/lib/timezone/zone.rb b/lib/timezone/zone.rb
index <HASH>..<HASH> 100644
--- a/lib/timezone/zone.rb
+++ b/lib/timezone/zone.rb
@@ -83,9 +83,9 @@ module Timezone
# Get a list of specified timezones and the basic information accompanying that zone
#
- # zones = Timezone::Zone.infos(zones)
+ # zones = Timezone::Zone.list(*zones)
#
- # zones - An array of timezone names. (i.e. Timezone::Zones.infos("America/Chicago", "Australia/Sydney"))
+ # zones - An array of timezone names. (i.e. Timezone::Zones.list("America/Chicago", "Australia/Sydney"))
#
# The result is a Hash of timezones with their title, offset in seconds, UTC offset, and if it uses DST.
# | Old method name in the documentation for Timezone::Zone.list | panthomakos_timezone | train | rb |
cd1c7749e030c65d176e0735ff33b97bffeb8240 | diff --git a/extended-cpts.php b/extended-cpts.php
index <HASH>..<HASH> 100644
--- a/extended-cpts.php
+++ b/extended-cpts.php
@@ -212,7 +212,7 @@ class Extended_CPT {
# Rewrite testing:
if ( $this->args['rewrite'] ) {
- add_filter( 'rewrite_testing_tests', array( $this, 'rewrite_testing_tests' ) );
+ add_filter( 'rewrite_testing_tests', array( $this, 'rewrite_testing_tests' ), 1 );
}
# Register post type when WordPress initialises: | Reduce the `rewrite_testing_tests` filter priority so it's more easily overridden. | johnbillion_extended-cpts | train | php |
124c4a7740bc44688fae37f35a0227ef5e399105 | diff --git a/lib/chef/resource/sysctl.rb b/lib/chef/resource/sysctl.rb
index <HASH>..<HASH> 100644
--- a/lib/chef/resource/sysctl.rb
+++ b/lib/chef/resource/sysctl.rb
@@ -25,11 +25,7 @@ class Chef
provides(:sysctl) { true }
provides(:sysctl_param) { true }
- description "Use the **sysctl** resource to set or remove kernel parameters using the sysctl"\
- " command line tool and configuration files in the system's sysctl.d directory. "\
- "Configuration files managed by this resource are named 99-chef-KEYNAME.conf. If"\
- " an existing value was already set for the value it will be backed up to the node"\
- " and restored if the :remove action is used later."
+ description "Use the **sysctl** resource to set or remove kernel parameters using the `sysctl` command line tool and configuration files in the system's `sysctl.d` directory. Configuration files managed by this resource are named `99-chef-KEYNAME.conf`."
examples <<~DOC
**Set vm.swappiness**: | Update sysctl resource description to match reality
We don't do the backup mess anymore and we never did when this resource was in chef-client itself. | chef_chef | train | rb |
5a5a916438d5b6daeb30271a54bdb276ebb3c4bd | diff --git a/gulpfile.js b/gulpfile.js
index <HASH>..<HASH> 100644
--- a/gulpfile.js
+++ b/gulpfile.js
@@ -1,17 +1,21 @@
-var fs = require('fs')
-var exec = require('child_process').exec
-var gulp = require('gulp')
-var bump = require('gulp-bump')
+const f = require('util').format
+const fs = require('fs')
+const exec = require('child_process').exec
+const gulp = require('gulp')
+const bump = require('gulp-bump')
// Basic usage:
// Will patch the version
-gulp.task('bump', function () {
+gulp.task('bump', () => {
gulp.src('./package.json')
.pipe(bump())
.pipe(gulp.dest('./'))
})
-gulp.task('tag', function () {
- var version = JSON.parse(fs.readFileSync('./package.json', 'utf8')).version
- exec('git tag ' + version + ' && git push --tags', err => err)
+gulp.task('tag', () => {
+ const version = JSON.parse(fs.readFileSync('./package.json', 'utf8')).version
+ exec(
+ f(`git tag '%s' && git push --tags`, version),
+ err => console.log(err ? err : f('version "%s" published successfully.', version))
+ )
}) | refactor: gulpfile.js for log result | futurist_replace-css-url | train | js |
40fa692c74002b148d99b65e93c8a43f5f7fbd9b | diff --git a/claripy/claripy.py b/claripy/claripy.py
index <HASH>..<HASH> 100644
--- a/claripy/claripy.py
+++ b/claripy/claripy.py
@@ -308,6 +308,7 @@ Claripy.fpToUBV = op('fpToUBV', (RM, FP, (int, long)), BV, self_is_clrp=True, ca
def _fp_cmp_check(a, b):
return a.length == b.length, "FP lengths must be the same"
Claripy.fpEQ = op('fpEQ', (FP, FP), Bool, self_is_clrp=True, extra_check=_fp_cmp_check)
+FP.__eq__ = Claripy.fpEQ
Claripy.fpGT = op('fpGT', (FP, FP), Bool, self_is_clrp=True, extra_check=_fp_cmp_check)
Claripy.fpGEQ = op('fpGEQ', (FP, FP), Bool, self_is_clrp=True, extra_check=_fp_cmp_check)
Claripy.fpLT = op('fpLT', (FP, FP), Bool, self_is_clrp=True, extra_check=_fp_cmp_check) | add __eq__ to FP | angr_claripy | train | py |
6c44d20194e0a3a7b54a16de5e502b821a7a3d6f | diff --git a/freeze.py b/freeze.py
index <HASH>..<HASH> 100755
--- a/freeze.py
+++ b/freeze.py
@@ -9,7 +9,8 @@ from cx_Freeze import setup, Executable
with open(os.path.join("r128gain", "__init__.py"), "rt") as f:
version = re.search("__version__ = \"([^\"]+)\"", f.read()).group(1)
-build_exe_options = {"optimize": 0}
+build_exe_options = {"optimize": 0,
+ "excludes": ["tkinter"]}
setup(name="r128gain",
version=version, | Windows freeze: Don't include tkinter | desbma_r128gain | train | py |
f08c4e2531965844956fe5c25a65c973a1a02014 | diff --git a/src/stream/pipe.js b/src/stream/pipe.js
index <HASH>..<HASH> 100644
--- a/src/stream/pipe.js
+++ b/src/stream/pipe.js
@@ -38,9 +38,17 @@ function _gpfStreamPipeToFlushableWrite (intermediate, destination) {
iWritableIntermediate = _gpfStreamQueryWritable(intermediate),
iFlushableIntermediate = _gpfStreamPipeToFlushable(intermediate),
iWritableDestination = _gpfStreamQueryWritable(destination),
- iFlushableDestination = _gpfStreamPipeToFlushable(destination);
+ iFlushableDestination = _gpfStreamPipeToFlushable(destination),
+ readingDone = false;
+
+ function _read () {
+ iReadableIntermediate.read(iWritableDestination)
+ .then(function () {
+ readingDone = true;
+ });
+ }
+ _read();
- iReadableIntermediate.read(iWritableDestination);
return {
flush: function () {
@@ -51,7 +59,12 @@ function _gpfStreamPipeToFlushableWrite (intermediate, destination) {
},
write: function (data) {
- return iWritableIntermediate.write(data);
+ return iWritableIntermediate.write(data)
+ .then(function () {
+ if (readingDone) {
+ _read();
+ }
+ });
}
}; | Implements non flushable intermediate streams (#<I>) | ArnaudBuchholz_gpf-js | train | js |
5b9dae5be797e231d941fabbda0517ccf816d2ad | diff --git a/sharding-core/src/main/java/io/shardingsphere/core/executor/sql/execute/row/QueryRow.java b/sharding-core/src/main/java/io/shardingsphere/core/executor/sql/execute/row/QueryRow.java
index <HASH>..<HASH> 100644
--- a/sharding-core/src/main/java/io/shardingsphere/core/executor/sql/execute/row/QueryRow.java
+++ b/sharding-core/src/main/java/io/shardingsphere/core/executor/sql/execute/row/QueryRow.java
@@ -62,10 +62,10 @@ public final class QueryRow {
if (distinctColumnIndexes.isEmpty()) {
return rowData.equals(queryRow.getRowData());
}
- return distinctColumnIndexes.equals(queryRow.getDistinctColumnIndexes()) && isEqualByPart(queryRow);
+ return distinctColumnIndexes.equals(queryRow.getDistinctColumnIndexes()) && isEqualPartly(queryRow);
}
- private boolean isEqualByPart(final QueryRow queryRow) {
+ private boolean isEqualPartly(final QueryRow queryRow) {
for (int i = 0; i < distinctColumnIndexes.size(); i++) {
if (!rowData.get(i).equals(queryRow.getRowData().get(i))) {
return false; | rename to isEqualPartly() | apache_incubator-shardingsphere | train | java |
40cea6b487b40e597bf32dc84067d80d93c79066 | diff --git a/htlcswitch/link_test.go b/htlcswitch/link_test.go
index <HASH>..<HASH> 100644
--- a/htlcswitch/link_test.go
+++ b/htlcswitch/link_test.go
@@ -5697,7 +5697,7 @@ func newHodlInvoiceTestCtx(t *testing.T) (*hodlInvoiceTestCtx, error) {
select {
case err := <-errChan:
t.Fatalf("no payment result expected: %v", err)
- case <-time.After(time.Second):
+ case <-time.After(5 * time.Second):
t.Fatal("timeout")
case h := <-receiver.registry.settleChan:
if hash != h { | htlcswitch/test: increase test timeout for hodl invoice tests | lightningnetwork_lnd | train | go |
6fc09eda3e3e377d2325ef20098ac2e4e798fd33 | diff --git a/dependency-check-core/src/main/java/org/owasp/dependencycheck/utils/Settings.java b/dependency-check-core/src/main/java/org/owasp/dependencycheck/utils/Settings.java
index <HASH>..<HASH> 100644
--- a/dependency-check-core/src/main/java/org/owasp/dependencycheck/utils/Settings.java
+++ b/dependency-check-core/src/main/java/org/owasp/dependencycheck/utils/Settings.java
@@ -68,6 +68,11 @@ public final class Settings {
*/
public static final String DATA_DIRECTORY = "data.directory";
/**
+ * The location of the batch update URL. This is a zip file that
+ * contains the contents of the data directory.
+ */
+ public static final String BATCH_UPDATE_URL = "batch.update.url";
+ /**
* The properties key for the path where the CPE Lucene Index will be
* stored.
*/
@@ -78,14 +83,6 @@ public final class Settings {
*/
public static final String CVE_DATA_DIRECTORY = "data.cve";
/**
- * The properties key for the URL to the CPE.
- */
- public static final String CPE_URL = "cpe.url";
- /**
- * The properties key for the URL to the CPE.
- */
- public static final String CPE_META_URL = "cpe.meta.url";
- /**
* The properties key for the URL to retrieve the "meta" data from about
* the CVE entries.
*/ | removed unused properties and added BATCH_UPDATE_URL
Former-commit-id: <I>a8a2d<I>cf<I>fac<I>d<I>eea1b<I> | jeremylong_DependencyCheck | train | java |
8bec5814436556426990e15e57070425eb1c34c5 | diff --git a/src/main/java/nz/ac/auckland/integration/testing/MorcTest.java b/src/main/java/nz/ac/auckland/integration/testing/MorcTest.java
index <HASH>..<HASH> 100644
--- a/src/main/java/nz/ac/auckland/integration/testing/MorcTest.java
+++ b/src/main/java/nz/ac/auckland/integration/testing/MorcTest.java
@@ -265,8 +265,11 @@ public class MorcTest extends CamelSpringTestSupport {
createdRoutes.add(publishRouteDefinition);
+ logger.trace("Starting sending mock endpoint assertion");
//extra 5s is to give some time for route to boot
- sendingMockEndpoint.assertIsSatisfied(5000l + spec.getMessageAssertTime() * (spec.getTotalPublishMessageCount()+1));
+ sendingMockEndpoint.setResultWaitTime(5000l + spec.getMessageAssertTime() * (spec.getTotalPublishMessageCount()+1));
+ sendingMockEndpoint.assertIsSatisfied();
+ logger.trace("Completed sending mock endpoint assertion");
for (MockEndpoint mockEndpoint : mockEndpoints)
mockEndpoint.assertIsSatisfied(); | fixed assertion time to wait time rather than sleeping for empty test | uoa-group-applications_morc | train | java |
9097a282359fd3cf4a75d9ebbc937746f5290acb | diff --git a/src/Calendar.php b/src/Calendar.php
index <HASH>..<HASH> 100644
--- a/src/Calendar.php
+++ b/src/Calendar.php
@@ -53,6 +53,29 @@ class Calendar extends CalendarAbstract
}
});
+ //Restructure events under their relevant day
+ foreach($this->events as $id_and_date => $event) {
+
+ list($id, $date) = explode('.', $id_and_date);
+
+ $events[$date][] = $event;
+ }
+
+ foreach($events as $date => &$event) {
+ usort($event, function($e1, $e2) use ($date) {
+
+ if($e1->getStartDateFull() == $e2->getStartDateFull()) {
+ return 0;
+ }
+
+ return $e1->getStartDateFull() < $e2->getStartDateFull() ? -1 : 1;
+ });
+ }
+
+ ksort($events);
+
+ $this->events = $events;
+
return $this->events;
}
} | Restructure events under their relevant day and sort them. | benplummer_calendarful | train | php |
e237b4a5f4da8a6d0f2056622d2962bb827b5176 | diff --git a/src/org/opencms/xml/content/CmsDefaultXmlContentHandler.java b/src/org/opencms/xml/content/CmsDefaultXmlContentHandler.java
index <HASH>..<HASH> 100644
--- a/src/org/opencms/xml/content/CmsDefaultXmlContentHandler.java
+++ b/src/org/opencms/xml/content/CmsDefaultXmlContentHandler.java
@@ -2215,7 +2215,7 @@ public class CmsDefaultXmlContentHandler implements I_CmsXmlContentHandler {
}
// if no mapping was defined yet, create a mapping for the element itself
- if ((field.getMappings() != null) && !field.getMappings().isEmpty()) {
+ if ((field.getMappings() == null) || field.getMappings().isEmpty()) {
CmsSearchFieldMapping valueMapping = new CmsSearchFieldMapping(
CmsSearchFieldMappingType.ITEM, | Corrected XSD Solr field configuration when no field mapping is defined
within the XSD. | alkacon_opencms-core | train | java |
c8becb8e3b163dc73acc2cca1581d9e2f34a7fc6 | diff --git a/src/test/java/org/takes/rq/RqWithDefaultHeaderTest.java b/src/test/java/org/takes/rq/RqWithDefaultHeaderTest.java
index <HASH>..<HASH> 100644
--- a/src/test/java/org/takes/rq/RqWithDefaultHeaderTest.java
+++ b/src/test/java/org/takes/rq/RqWithDefaultHeaderTest.java
@@ -73,16 +73,16 @@ public final class RqWithDefaultHeaderTest {
*/
@Test
public void allowsOverrideDefaultHeader() throws IOException {
+ final String header = "X-Default-Header2";
MatcherAssert.assertThat(
new RqPrint(
new RqWithDefaultHeader(
new RqWithHeader(
new RqFake(),
- // @checkstyle MultipleStringLiteralsCheck (1 lines)
- "X-Default-Header2",
+ header,
"Non-Default-Value2"
),
- "X-Default-Header2",
+ header,
"X-Default-Value"
)
).print(), | CR #<I> - introduced variable for string literal | yegor256_takes | train | java |
eeac670391470893d850b098612eb13f5854a398 | diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -1,9 +1,8 @@
# Setup file for feedstail
from setuptools import setup
-long_description = """\
-Feedstail monitor a feed and emits new entries. It aim to be simple,
-hackable and compatible with rsstail, its C brother."""
+with open('README.rst') as readme:
+ long_description = readme.read()
setup( name = "feedstail"
, description = "A tail-f-like utility for feeds" | [doc]: Setup: README.rst becomes the long description. | YoloSwagTeam_feedstail | train | py |
37dc4ba041aeba64c58c2ac510c6d44315b41eaf | diff --git a/test/test_coverer.py b/test/test_coverer.py
index <HASH>..<HASH> 100644
--- a/test/test_coverer.py
+++ b/test/test_coverer.py
@@ -1,3 +1,4 @@
+from __future__ import division
import pytest
import numpy as np
from sklearn import datasets, preprocessing | python <I> has a funny idea of what division means; import from future | scikit-tda_kepler-mapper | train | py |
0237fbc9226dcfb28e1dfb1cc6a831e7f5131ab8 | diff --git a/src/Pool/Flexible.php b/src/Pool/Flexible.php
index <HASH>..<HASH> 100644
--- a/src/Pool/Flexible.php
+++ b/src/Pool/Flexible.php
@@ -67,7 +67,6 @@ class Flexible implements PoolInterface
);
$this->manager->on('ready', function (WorkerInterface $worker) {
if ($this->queue->count() === 0) {
- show_memory('Terminated worker: ' . time());
$worker->terminate();
return;
} | Removed accidently comitted debug code | WyriHaximus_reactphp-child-process-pool | train | php |
1bf612c89584e1f42adc413cce9be16d55634177 | diff --git a/lib/DObject.rb b/lib/DObject.rb
index <HASH>..<HASH> 100644
--- a/lib/DObject.rb
+++ b/lib/DObject.rb
@@ -776,7 +776,7 @@ module DICOM
if bin.length > 0
pos = @tags.index("7FE0,0010")
# Modify element:
- set_value(bin, :label => "7FE0,0010", :create => true, :bin => true)
+ set_value(bin, "7FE0,0010", :create => true, :bin => true)
else
add_msg("Content of file is of zero length. Nothing to store.")
end # of if bin.length > 0
@@ -788,7 +788,7 @@ module DICOM
# Export the RMagick object to a standard Ruby array of numbers:
pixel_array = magick_obj.export_pixels(x=0, y=0, columns=magick_obj.columns, rows=magick_obj.rows, map="I")
# Encode this array using the standard class method:
- set_value(pixel_array, :label => "7FE0,0010", :create => true)
+ set_value(pixel_array, "7FE0,0010", :create => true)
end | Fixed a couple of bugs relating to the previous change of syntax in set_value() | dicom_ruby-dicom | train | rb |
fc42941c4eca96389b9d5eb76124eba60c120069 | diff --git a/helpers/TbHtml.php b/helpers/TbHtml.php
index <HASH>..<HASH> 100755
--- a/helpers/TbHtml.php
+++ b/helpers/TbHtml.php
@@ -4091,13 +4091,14 @@ EOD;
{
$htmlOptions['title'] = $title;
if (TbArray::popValue('animation', $htmlOptions)) {
- $htmlOptions['data-animation'] = true;
+ $htmlOptions['data-animation'] = 'true';
}
if (TbArray::popValue('html', $htmlOptions)) {
- $htmlOptions['data-html'] = true;
+ $htmlOptions['data-html'] = 'true';
}
- if (TbArray::popValue('selector', $htmlOptions)) {
- $htmlOptions['data-selector'] = true;
+ $selector = TbArray::popValue('selector', $htmlOptions);
+ if (!empty($selector)) {
+ $htmlOptions['data-selector'] = $selector;
}
$placement = TbArray::popValue('placement', $htmlOptions);
if (!empty($placement)) { | Fix some issue with tooltip and popover data-attributes | crisu83_yiistrap | train | php |
6d43810e720f0c174d3eaa8dbf10b09abd023aa7 | diff --git a/django_auth_adfs/backend.py b/django_auth_adfs/backend.py
index <HASH>..<HASH> 100644
--- a/django_auth_adfs/backend.py
+++ b/django_auth_adfs/backend.py
@@ -173,13 +173,12 @@ class AdfsBaseBackend(ModelBackend):
"""
if settings.GROUPS_CLAIM is not None:
# Update the user's group memberships
- django_groups = [group.name.lower() for group in user.groups.all()]
+ django_groups = [group.name for group in user.groups.all()]
if settings.GROUPS_CLAIM in claims:
claim_groups = claims[settings.GROUPS_CLAIM]
if not isinstance(claim_groups, list):
claim_groups = [claim_groups, ]
- claim_groups = set(group.lower() for group in claim_groups)
else:
logger.debug("The configured groups claim '%s' was not found in the access token",
settings.GROUPS_CLAIM) | Removed case insensitivity support after a discussion with Jobec | jobec_django-auth-adfs | train | py |
04048c7e484e54efa34dbb4013c61fb071e67b96 | diff --git a/spec/normalize_spec.rb b/spec/normalize_spec.rb
index <HASH>..<HASH> 100644
--- a/spec/normalize_spec.rb
+++ b/spec/normalize_spec.rb
@@ -71,6 +71,10 @@ describe NormalizeUrl do
expect(n("http://example.com/?PHPSESSID=foo")).to eq("http://example.com/")
end
+ it "skips removing tracking params if required" do
+ expect(n("http://example.com/?xtor=foo", remove_tracking: false)).to eq("http://example.com/?xtor=foo")
+ end
+
it "removes repeating slashes in path" do
expect(n("http://example.com/foo///products")).to eq("http://example.com/foo/products")
end | Add test for skipping removing tracking | rwz_normalize_url | train | rb |
fa8a78d12ee470eb29d314a4f9ae5318bad4ae09 | diff --git a/activerecord/test/cases/associations/eager_test.rb b/activerecord/test/cases/associations/eager_test.rb
index <HASH>..<HASH> 100644
--- a/activerecord/test/cases/associations/eager_test.rb
+++ b/activerecord/test/cases/associations/eager_test.rb
@@ -218,7 +218,7 @@ class EagerAssociationTest < ActiveRecord::TestCase
def test_finding_with_includes_on_null_belongs_to_association_with_same_include_includes_only_once
post = posts(:welcome)
post.update!(author: nil)
- post = assert_queries(1) { Post.all.merge!(includes: {author_with_address: :author_address}).find(post.id) }
+ post = assert_queries(1) { Post.all.merge!(includes: {author_with_address: :author_address}).find(post.id) }
# find the post, then find the author which is null so no query for the author or address
assert_no_queries do
assert_equal nil, post.author_with_address | :scissors: | rails_rails | train | rb |
f3493446c203da50c4d510c1801a144fb5468d63 | diff --git a/nes_py/nes_env.py b/nes_py/nes_env.py
index <HASH>..<HASH> 100644
--- a/nes_py/nes_env.py
+++ b/nes_py/nes_env.py
@@ -243,14 +243,21 @@ class NESEnv(gym.Env):
# return the list of seeds used by RNG(s) in the environment
return [seed]
- def reset(self):
+ def reset(self, seed=None, options=None, return_info=None):
"""
Reset the state of the environment and returns an initial observation.
+ Args:
+ seed (int): an optional random number seed for the next episode
+ options (any): unused
+ return_info (any): unused
+
Returns:
state (np.ndarray): next frame as a result of the given action
"""
+ # Set the seed.
+ self.seed(seed)
# call the before reset callback
self._will_reset()
# reset the emulator | update to resolve warnings from newer versions of gym | Kautenja_nes-py | train | py |
83020ccc0385121e325c785d97cac58456a61e5c | diff --git a/core/model/fieldtypes/Time.php b/core/model/fieldtypes/Time.php
index <HASH>..<HASH> 100755
--- a/core/model/fieldtypes/Time.php
+++ b/core/model/fieldtypes/Time.php
@@ -2,7 +2,6 @@
/**
* Represents a column in the database with the type 'Time'
*/
-require_once("DBField.php");
class Time extends DBField { | Removed require_once - it's not needed, and for some reason it makes PHP die on some servers
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@<I> <I>b<I>ca-7a2a-<I>-9d3b-<I>d<I>a<I>a9 | silverstripe_silverstripe-framework | train | php |
7851f7830fb61743d4b75fdcf39a0627fa1cf34a | diff --git a/src/Krystal/Db/Tests/QueryBuilderTest.php b/src/Krystal/Db/Tests/QueryBuilderTest.php
index <HASH>..<HASH> 100644
--- a/src/Krystal/Db/Tests/QueryBuilderTest.php
+++ b/src/Krystal/Db/Tests/QueryBuilderTest.php
@@ -46,6 +46,14 @@ class QueryBuilderTest extends \PHPUnit_Framework_TestCase
$this->verify('SELECT table.column AS `alias`, name');
}
+ public function testCanGenerateSelectWithAvg()
+ {
+ $this->qb->select()
+ ->avg('users');
+
+ $this->verify('SELECT AVG(`users`) ');
+ }
+
public function testCanGenerateSelectFromTable()
{
$this->qb->select('*') | Added test case for AVG function | krystal-framework_krystal.framework | train | php |
db3c91a0e1a108805fd8ab2e9a4ef274be709e42 | diff --git a/openquake/calculators/views.py b/openquake/calculators/views.py
index <HASH>..<HASH> 100644
--- a/openquake/calculators/views.py
+++ b/openquake/calculators/views.py
@@ -1003,3 +1003,19 @@ def view_event_loss_table(token, dstore):
del df['loss_id']
del df['variance']
return df[:20]
+
+
[email protected]('delta_loss')
+def view_delta_loss(token, dstore):
+ """
+ Return |tot0-tot1| / (tot0 + tot1) where tot0 is the total loss
+ computed from even events and tot1 from odd events, for the first
+ loss type.
+ """
+ K = dstore['agg_loss_table'].attrs.get('K', 0)
+ df = dstore.read_df('agg_loss_table', 'event_id',
+ dict(agg_id=K, loss_id=0))
+ mod2 = df.index % 2
+ loss0 = df['loss'][mod2 == 0].sum()
+ loss1 = df['loss'][mod2 == 1].sum()
+ return abs(loss0 - loss1) / (loss0 + loss1) | Added view delta_loss [ci skip] | gem_oq-engine | train | py |
2d6563d184cc5dc89cc093506a3a9f18b3b080d0 | diff --git a/Tests/bootstrap.php b/Tests/bootstrap.php
index <HASH>..<HASH> 100644
--- a/Tests/bootstrap.php
+++ b/Tests/bootstrap.php
@@ -9,8 +9,8 @@ $loader->registerNamespace('Symfony', $_SERVER['SYMFONY']);
$loader->register();
spl_autoload_register(function($class) {
- if (0 === strpos($class, 'Manhattan\\PublishBundle\\ManhattanPublishBundle')) {
- $path = implode('/', array_slice(explode('\\', $class), 3)).'.php';
+ if (0 === strpos($class, 'Manhattan\\PublishBundle')) {
+ $path = implode('/', array_slice(explode('\\', $class), 2)).'.php';
require_once __DIR__.'/../'.$path;
return true;
} | Updated bootstrap for tests to run. | frodosghost_PublishBundle | train | php |
8fc9009e6ea0e20f118375901dd395f7a99b24da | diff --git a/salt/utils/__init__.py b/salt/utils/__init__.py
index <HASH>..<HASH> 100644
--- a/salt/utils/__init__.py
+++ b/salt/utils/__init__.py
@@ -826,7 +826,7 @@ def format_call(fun,
continue
extra[key] = copy.deepcopy(value)
- # We'll be showing errors to the users until Salt Lithium comes out, after
+ # We'll be showing errors to the users until Salt Beryllium comes out, after
# which, errors will be raised instead.
warn_until(
'Beryllium',
@@ -865,8 +865,8 @@ def format_call(fun,
ret.setdefault('warnings', []).append(
'{0}. If you were trying to pass additional data to be used '
'in a template context, please populate \'context\' with '
- '\'key: value\' pairs. Your approach will work until Salt Lithium '
- 'is out.{1}'.format(
+ '\'key: value\' pairs. Your approach will work until Salt '
+ 'Beryllium is out.{1}'.format(
msg,
'' if 'full' not in ret else ' Please update your state files.'
) | Fix missed Lithium to Beryllium references | saltstack_salt | train | py |
16e18845c29e66141ab3a5053bd9cc26c4e5b469 | diff --git a/core/server/master/src/main/java/alluxio/master/file/UfsSyncChecker.java b/core/server/master/src/main/java/alluxio/master/file/UfsSyncChecker.java
index <HASH>..<HASH> 100644
--- a/core/server/master/src/main/java/alluxio/master/file/UfsSyncChecker.java
+++ b/core/server/master/src/main/java/alluxio/master/file/UfsSyncChecker.java
@@ -135,7 +135,9 @@ public final class UfsSyncChecker {
UnderFileStatus[] children =
ufs.listStatus(ufsUri.toString(), ListOptions.defaults().setRecursive(true));
// Assumption: multiple mounted UFSs cannot have the same ufsUri
- mListedDirectories.put(ufsUri.toString(), children);
+ if (children != null) {
+ mListedDirectories.put(ufsUri.toString(), children);
+ }
return children;
}
} | do not store listing results for non-existent dirs | Alluxio_alluxio | train | java |
d5594325409b49b021bfa7bbce83b936f18eb5a4 | diff --git a/src/decoder.js b/src/decoder.js
index <HASH>..<HASH> 100644
--- a/src/decoder.js
+++ b/src/decoder.js
@@ -88,7 +88,7 @@ var decode = function(bytes, mask, names) {
}, {});
}
-if (module) {
+if (typeof module === 'object' && typeof module.exports !== 'undefined') {
module.exports = {
unixtime: unixtime,
uint8: uint8, | fix: work in non-require env | thesolarnomad_lora-serialization | train | js |
f5fbd4e4abd82767f8cad7ca296ff700c2a506ca | diff --git a/types/container/config.go b/types/container/config.go
index <HASH>..<HASH> 100644
--- a/types/container/config.go
+++ b/types/container/config.go
@@ -19,7 +19,6 @@ type Config struct {
AttachStdout bool // Attach the standard output
AttachStderr bool // Attach the standard error
ExposedPorts map[nat.Port]struct{} `json:",omitempty"` // List of exposed ports
- PublishService string `json:",omitempty"` // Name of the network service exposed by the container
Tty bool // Attach standard streams to a tty, including stdin if it is not closed.
OpenStdin bool // Open stdin
StdinOnce bool // If true, close stdin after the 1 attached client disconnects. | types/container: remove PublishService from container.Config
This was never used in a non-experimental branch. It was removed from
docker in <URL> | docker_engine-api | train | go |
be2b626d883789b008b092c50e5201c0861bb296 | diff --git a/five.js b/five.js
index <HASH>..<HASH> 100755
--- a/five.js
+++ b/five.js
@@ -100,7 +100,7 @@
return Math.pow(five(), pointFive) * pointFive + pointFive;
};
- five.negative = function() { return -5; };
+ five.negative = function() { return -five(); };
five.loud = function (lang) { return (lang && typeof five[lang] === 'function') ? five[lang]().toUpperCase() : five.english().toUpperCase();};
five.smooth = function() { return 'S'; }; | Reduce copy-paste to keep DRY | jackdclark_five | train | js |
94870eb3b7406c5ec7ea3a418afbd5c8d16368be | diff --git a/aeron-archive/src/main/java/io/aeron/archive/client/AeronArchive.java b/aeron-archive/src/main/java/io/aeron/archive/client/AeronArchive.java
index <HASH>..<HASH> 100644
--- a/aeron-archive/src/main/java/io/aeron/archive/client/AeronArchive.java
+++ b/aeron-archive/src/main/java/io/aeron/archive/client/AeronArchive.java
@@ -3298,7 +3298,7 @@ public final class AeronArchive implements AutoCloseable
archiveProxy = new ArchiveProxy(
publication,
ctx.idleStrategy(),
- ctx.aeron.context().nanoClock(),
+ ctx.aeron().context().nanoClock(),
ctx.messageTimeoutNs(),
DEFAULT_RETRY_ATTEMPTS,
ctx.credentialsSupplier()); | [Java] Avoid use of bridge methods. | real-logic_aeron | train | java |
d2e85c600665e502e0330033220c90633b7155c4 | diff --git a/framework/caching/CCache.php b/framework/caching/CCache.php
index <HASH>..<HASH> 100644
--- a/framework/caching/CCache.php
+++ b/framework/caching/CCache.php
@@ -79,7 +79,9 @@ abstract class CCache extends CApplicationComponent implements ICache, ArrayAcce
public $autoSerialize=true;
/**
- * @var boolean wether to make use of the {@link http://pecl.php.net/package/igbinary igbinary} serializer for cache entry serialization. Defaults to false.
+ * @var boolean wether to make use of the {@link http://pecl.php.net/package/igbinary igbinary} serializer for cache entry serialization. Defaults to false.
+ * <strong>NOTE:</strong> If this is set to true while the igbinary extension has not been loaded, cache serialization will silently fall back to PHP's default
+ * serializer. Since the two serialization formats are incompatible, caches should be purged before switching this on to prevent errors.
* @since 1.1.11
*/
public $useIgbinarySerializer=false; | Added a warning to the CCache phpdoc regarding usage of the igbinary
serializer | yiisoft_yii | train | php |
1154a53a016a717d16487b1081c66f5ef48d1b10 | diff --git a/topydo/commands/ListCommand.py b/topydo/commands/ListCommand.py
index <HASH>..<HASH> 100644
--- a/topydo/commands/ListCommand.py
+++ b/topydo/commands/ListCommand.py
@@ -163,6 +163,8 @@ When an expression is given, only the todos matching that expression are shown.
E.g. %{(}p{)} will print (C) when the todo item has priority C, or ''
(empty string) when an item has no priority set.
+
+ A tab character serves as a marker to start right alignment.
-s : Sort the list according to a sort expression. Defaults to the expression
in the configuration.
-x : Show all todos (i.e. do not filter on dependencies or relevance). | Extend help text with right alignment with tab characters. | bram85_topydo | train | py |
ee9720038a94bbdce97db5230e19e189893db35d | diff --git a/satpy/tests/modifier_tests/test_parallax.py b/satpy/tests/modifier_tests/test_parallax.py
index <HASH>..<HASH> 100644
--- a/satpy/tests/modifier_tests/test_parallax.py
+++ b/satpy/tests/modifier_tests/test_parallax.py
@@ -395,6 +395,7 @@ def test_correct_area_clearsky_different_resolutions(res1, res2):
fake_area_small.get_lonlats())
[email protected](reason="awaiting pyresample fixes")
def test_correct_area_cloudy_no_overlap():
"""Test cloudy correction when areas have no overlap."""
from ...modifiers.parallax import MissingHeightError, ParallaxCorrection
@@ -415,6 +416,7 @@ def test_correct_area_cloudy_no_overlap():
corrector(sc["CTH_constant"])
[email protected](reason="awaiting pyresample fixes")
def test_correct_area_cloudy_partly_shifted():
"""Test cloudy correction when areas overlap only partly."""
from ...modifiers.parallax import IncompleteHeightWarning, ParallaxCorrection | Mark partly/no overlap as xfail
Mark the partly/no overlap tests as xfail, awaiting fixes in pyresample. | pytroll_satpy | train | py |
2df8def416e822c564f99bb15b75f9472bf55d6e | diff --git a/enforcer.go b/enforcer.go
index <HASH>..<HASH> 100644
--- a/enforcer.go
+++ b/enforcer.go
@@ -47,11 +47,16 @@ type Enforcer struct {
}
// NewEnforcer creates an enforcer via file or DB.
+//
// File:
-// e := casbin.NewEnforcer("path/to/basic_model.conf", "path/to/basic_policy.csv")
+//
+// e := casbin.NewEnforcer("path/to/basic_model.conf", "path/to/basic_policy.csv")
+//
// MySQL DB:
-// a := mysqladapter.NewDBAdapter("mysql", "mysql_username:mysql_password@tcp(127.0.0.1:3306)/")
-// e := casbin.NewEnforcer("path/to/basic_model.conf", a)
+//
+// a := mysqladapter.NewDBAdapter("mysql", "mysql_username:mysql_password@tcp(127.0.0.1:3306)/")
+// e := casbin.NewEnforcer("path/to/basic_model.conf", a)
+//
func NewEnforcer(params ...interface{}) (*Enforcer, error) {
e := &Enforcer{} | Properly indent sample code in doc | casbin_casbin | train | go |
280b938ed3c883a274a178b93c93c9c5129a1abf | diff --git a/app/controllers/deep_unrest/application_controller.rb b/app/controllers/deep_unrest/application_controller.rb
index <HASH>..<HASH> 100644
--- a/app/controllers/deep_unrest/application_controller.rb
+++ b/app/controllers/deep_unrest/application_controller.rb
@@ -74,7 +74,7 @@ module DeepUnrest
context = allowed_write_params[:data][:context] || {}
context[:uuid] = request.uuid
context[:current_user] = current_user
- data = repair_nested_params(allowed_write_params)[:data][:data]
+ data = repair_nested_params(params)[:data][:data]
instance_eval &DeepUnrest.before_update if DeepUnrest.before_update | [bugfix] issue with nested array attributes | graveflex_deep_unrest | train | rb |
2985de6f72a9a01df3c31aabe219c6a8014bb942 | diff --git a/lib/ohai/plugins/linux/platform.rb b/lib/ohai/plugins/linux/platform.rb
index <HASH>..<HASH> 100644
--- a/lib/ohai/plugins/linux/platform.rb
+++ b/lib/ohai/plugins/linux/platform.rb
@@ -33,8 +33,11 @@ if lsb[:id] =~ /RedHat/i
platform "redhat"
platform_version lsb[:release]
elsif lsb[:id] =~ /Amazon/i
- platform "amazon"
- platform_version lsb[:release]
+ platform "amazon"
+ platform_version lsb[:release]
+elsif lsb[:id] =~ /ScientificSL/i
+ platform "scientific"
+ platform_version lsb[:release]
elsif lsb[:id]
platform lsb[:id].downcase
platform_version lsb[:release] | OHAI-<I>: Fix detection of scientific linux out of lsb_release -a | chef_ohai | train | rb |
c5ccf82130804e87908c1f6d68f7e39062a99367 | diff --git a/setup.js b/setup.js
index <HASH>..<HASH> 100644
--- a/setup.js
+++ b/setup.js
@@ -7,9 +7,13 @@ var fs = require('fs');
var mode = process.argv[2];
var fsExists = fs.exists || sysPath.exists;
+var fsExistsSync = fs.existsSync || sysPath.existsSync;
var getBinaryPath = function(binary) {
- return sysPath.join('node_modules', '.bin', binary);
+ var path;
+ if (fsExistsSync(path = sysPath.join('node_modules', '.bin', binary))) return path;
+ if (fsExistsSync(path = sysPath.join('..', '.bin', binary))) return path;
+ return binary;
};
var execute = function(path, params, callback) { | fixed coffee-script compilation on installing from a git repository when coffee-script is a parent dependency and is not linked to node_modules subdirectory | brunch_brunch | train | js |
3396f0364daf57414e25a5619c088e3742cbb079 | diff --git a/client-side/grido.js b/client-side/grido.js
index <HASH>..<HASH> 100644
--- a/client-side/grido.js
+++ b/client-side/grido.js
@@ -22,7 +22,7 @@
var Grido = Grido || {};
- /* GRID CLASS DEFINITION */
+ /* GRID DEFINITION */
/* ========================== */
Grido.Grid = function($element, options)
@@ -152,7 +152,7 @@
}
};
- /* OPERATION CLASS DEFINITION */
+ /* OPERATION DEFINITION */
/* ========================== */
Grido.Operation = function(Grido)
@@ -348,7 +348,7 @@
}
};
- /* AJAX CLASS DEFINITION */
+ /* AJAX DEFINITION */
/* ========================== */
Grido.Ajax = function(Grido)
@@ -475,5 +475,6 @@
};
window.Grido = Grido;
+ return Grido;
})(jQuery, window, document, location); | Client side: Typo; Added returning Grido object | o5_grido | train | js |
763eb715342cfa5356e3a0c9768eaa4f5b071878 | diff --git a/test.js b/test.js
index <HASH>..<HASH> 100644
--- a/test.js
+++ b/test.js
@@ -53,23 +53,21 @@ scenario('widgets', {
// Test: Simple scenario with 1:M mapping {{{
scenario('users', {
- name: 'Wendy User',
+ name: 'Phil User',
role: 'user',
items: ['widget-quz']
});
scenario('widgets', {
- _ref: 'widget-quz',
- name: 'Widget quz',
- content: 'This is the quz widget'
+ _ref: 'widget-quuz',
+ name: 'Widget quuz',
+ content: 'This is the quuz widget'
});
// FIXME: Add assert tests here
// }}}
-
// Test: Complex scenario {{{
-/*
scenario({
users: [
{
@@ -86,20 +84,19 @@ scenario({
widgets: [
{
_ref: 'widget-foo',
- name: 'Widget foo',
+ name: 'Widget Foo',
content: 'This is the foo widget'
},
{
_ref: 'widget-bar',
- name: 'Widget bar',
+ name: 'Widget Bar',
content: 'This is the bar widget'
},
{
_ref: 'widget-baz',
- name: 'Widget foo',
+ name: 'Widget Baz',
content: 'This is the baz widget'
}
]
});
-*/
// }}} | BUGFIX: Buggy tests trying to create the same doc twice | hash-bang_Node-Mongoose-Scenario | train | js |
f53a4d955560ae563dad6d31f954be285014d63d | diff --git a/tests/Zepto/Extension/TwigTest.php b/tests/Zepto/Extension/TwigTest.php
index <HASH>..<HASH> 100644
--- a/tests/Zepto/Extension/TwigTest.php
+++ b/tests/Zepto/Extension/TwigTest.php
@@ -45,20 +45,4 @@ class TwigTest extends \PHPUnit_Framework_TestCase
// $this->twig->write('', 'Test content');
}
- /**
- * @covers Zepto\Extension\Twig::url_for
- */
- public function testUrlFor()
- {
- $this->markTestIncomplete('Not yet implemented');
- }
-
- /**
- * @covers Zepto\Extension\Twig::link_for
- */
- public function testLinkFor()
- {
- $this->markTestIncomplete('Not yet implemented');
- }
-
} | Removed useless tests from test class for ``Zepto\Extension\Twig`` | hassankhan_Sonic | train | php |
186263faa673cd1947823d7ad9af35efaa989f13 | diff --git a/lib/core/topologies/mongos.js b/lib/core/topologies/mongos.js
index <HASH>..<HASH> 100644
--- a/lib/core/topologies/mongos.js
+++ b/lib/core/topologies/mongos.js
@@ -612,7 +612,7 @@ function reconnectProxies(self, proxies, callback) {
})
);
- destroyServer(_server);
+ destroyServer(_server, { force: true });
removeProxyFrom(self.disconnectedProxies, _server);
// Relay the server description change | fix(mongos): force close servers during reconnect flow | mongodb_node-mongodb-native | train | js |
5fc820d3d23cf21bcacb4632beda8ac4ed1f8d3b | diff --git a/lib/src/start.js b/lib/src/start.js
index <HASH>..<HASH> 100644
--- a/lib/src/start.js
+++ b/lib/src/start.js
@@ -127,9 +127,9 @@ const resolveWith = res => contents => {
res.setHeader('Content-Type', 'text/html')
res.end(`${contents}
-<!-- Inserted by Reload -->
+<!-- Inserted by elm-live -->
<script src="/reload/reload.js"></script>
-<!-- End Reload -->
+<!-- Inserted by elm-live - END -->
`)
} | Change the html comment from "Reload" to "elm-live" | wking-io_elm-live | train | js |
54f3137e8bebf26f11858846d46603bb2be1a8c7 | diff --git a/modules/adkernelBidAdapter.js b/modules/adkernelBidAdapter.js
index <HASH>..<HASH> 100644
--- a/modules/adkernelBidAdapter.js
+++ b/modules/adkernelBidAdapter.js
@@ -67,7 +67,8 @@ export const spec = {
{code: 'stringads'},
{code: 'bcm'},
{code: 'engageadx'},
- {code: 'converge_digital', gvlid: 248}
+ {code: 'converge_digital', gvlid: 248},
+ {code: 'adomega'}
],
supportedMediaTypes: [BANNER, VIDEO, NATIVE], | Adkernel: alias for adomega network (#<I>) | prebid_Prebid.js | train | js |
f844a195ce394252f5cc529d92692c3e94475808 | diff --git a/tasks/release.py b/tasks/release.py
index <HASH>..<HASH> 100644
--- a/tasks/release.py
+++ b/tasks/release.py
@@ -182,7 +182,7 @@ def release_prepare(ctx, target, new_version):
update_requirements(req_file, target, get_requirement_line(target, new_version))
# commit the changes
- msg = "Bumped {} version to {}".format(target, new_version)
+ msg = "[ci skip] Bumped {} version to {}".format(target, new_version)
git_commit(ctx, [target, AGENT_REQ_FILE], msg)
# done | add [ci skip] to check bumps (#<I>) | DataDog_integrations-core | train | py |
051b0bf700508913fbba35ae9c5fc8a11f1b976f | diff --git a/src/DbProfilerServiceProvider.php b/src/DbProfilerServiceProvider.php
index <HASH>..<HASH> 100644
--- a/src/DbProfilerServiceProvider.php
+++ b/src/DbProfilerServiceProvider.php
@@ -12,11 +12,20 @@ class DbProfilerServiceProvider extends ServiceProvider
public function boot()
{
- if (!$this->isEnabled()) {
+ if ($this->app->environment('production')) {
+ return;
+ }
+
+ $shouldProceed = $this->app->runningUnitTests() ? true : $this->profilingRequested();
+ if (!$shouldProceed) {
return;
}
DB::listen(function (QueryExecuted $query) {
+ if (!$this->profilingRequested()) {
+ return;
+ }
+
$i = self::tickCounter();
$sql = $this->getSqlWithAppliedBindings($query);
$time = $query->time;
@@ -24,12 +33,8 @@ class DbProfilerServiceProvider extends ServiceProvider
});
}
- private function isEnabled()
+ private function profilingRequested()
{
- if ($this->app->environment('production')) {
- return false;
- }
-
return in_array('-vvv', $_SERVER['argv']) || request()->exists('vvv');
} | DBP: Adopted for tests. | dmitry-ivanov_laravel-db-profiler | train | php |
1b14bff81a9ab6654badf52b552f90c8fc3ab0e3 | diff --git a/actionpack/lib/action_dispatch/http/url.rb b/actionpack/lib/action_dispatch/http/url.rb
index <HASH>..<HASH> 100644
--- a/actionpack/lib/action_dispatch/http/url.rb
+++ b/actionpack/lib/action_dispatch/http/url.rb
@@ -102,10 +102,6 @@ module ActionDispatch
host && IP_HOST_REGEXP !~ host
end
- def same_host?(options)
- (options[:subdomain] == true || !options.key?(:subdomain)) && options[:domain].nil?
- end
-
def normalize_protocol(protocol)
case protocol
when nil
@@ -120,12 +116,14 @@ module ActionDispatch
end
def normalize_host(_host, options)
- return _host if !named_host?(_host) || same_host?(options)
+ return _host if !named_host?(_host)
tld_length = options[:tld_length] || @@tld_length
host = ""
if options[:subdomain] == true || !options.key?(:subdomain)
+ return _host if options[:domain].nil?
+
host << extract_subdomain(_host, tld_length).to_param
elsif options[:subdomain].present?
host << options[:subdomain].to_param | rm `same_host?`. The same conditional is two lines down. | rails_rails | train | rb |
5f8aaafb7f431a85864e1eb8eca09ffcabb7a6c3 | diff --git a/chess/pgn.py b/chess/pgn.py
index <HASH>..<HASH> 100644
--- a/chess/pgn.py
+++ b/chess/pgn.py
@@ -571,7 +571,7 @@ class BaseVisitor(object):
Base class for visitors.
Use with :func:`chess.pgn.Game.accept()` or
- :func:`chess.pgn.GameNode.accept()`.
+ :func:`chess.pgn.GameNode.accept()` or :func:`chess.pgn.read_game()`.
The methods are called in PGN order.
"""
@@ -903,7 +903,9 @@ def read_game(handle, Visitor=GameModelCreator):
headers just fine.
The parser is relatively forgiving when it comes to errors. It skips over
- tokens it can not parse. Any exceptions are logged.
+ tokens it can not parse. Any exceptions are logged and collected in
+ :data:`Game.errors <chess.pgn.Game.errors>`. This behavior can be
+ :func:`overriden <chess.pgn.GameModelCreator.handle_error>`.
Returns the parsed game or ``None`` if the end of file is reached.
""" | Improve chess.pgn error handling docs (#<I>) | niklasf_python-chess | train | py |
3ff1f1a66b8b9990102e87d864b525f56d3b64b5 | diff --git a/lib/plugins/index.js b/lib/plugins/index.js
index <HASH>..<HASH> 100644
--- a/lib/plugins/index.js
+++ b/lib/plugins/index.js
@@ -315,7 +315,6 @@ function loadPlugins(plugins, callback) {
}
function getRulesFromPlugins(type, req, res, plugins, callback) {
- type = type;
loadPlugins(plugins, function(ports) {
ports = ports.map(function(port, i) {
var _port = port && port[type + 'Port']; | refactor: Refine lib/plugins/index.js | avwo_whistle | train | js |
087a3bf1aea5570ee2fb0c50045863a5ff43c628 | diff --git a/js/binance.js b/js/binance.js
index <HASH>..<HASH> 100644
--- a/js/binance.js
+++ b/js/binance.js
@@ -57,8 +57,8 @@ module.exports = class binance extends Exchange {
'api': {
'web': 'https://www.binance.com',
'wapi': 'https://www.binance.com/wapi',
- 'public': 'https://www.binance.com/api',
- 'private': 'https://www.binance.com/api',
+ 'public': 'https://api.binance.com/api',
+ 'private': 'https://api.binance.com/api',
},
'www': 'https://www.binance.com',
'doc': 'https://www.binance.com/restapipub.html', | switched binance to newer urls | ccxt_ccxt | train | js |
cb45a6b70525290371eeb35d725c93c87419ae6d | diff --git a/src/console/Request.php b/src/console/Request.php
index <HASH>..<HASH> 100755
--- a/src/console/Request.php
+++ b/src/console/Request.php
@@ -194,9 +194,9 @@ class Request extends Component
foreach ($data as $prefix => $path) {
if (strpos($ns, $prefix) === 0) {
-
$path[0] .= str_replace('\\', '/', substr($ns, \strlen($prefix) - 1));
$paths[$ns] = $path[0];
+ break;
}
}
} | Fix bug with incorrect console controllers path detection | levmorozov_mii | train | php |
1bf85182305c64a85e8cef92af6d76972c42fd5a | diff --git a/selector-set.js b/selector-set.js
index <HASH>..<HASH> 100644
--- a/selector-set.js
+++ b/selector-set.js
@@ -184,6 +184,20 @@
return indexes;
};
+ // Public: Log when added selector falls under the default index.
+ //
+ // This API should not be considered stable. May change between
+ // minor versions.
+ //
+ // obj - {selector, data} Object
+ //
+ // SelectorSet.prototype.logDefaultIndexUsed = function(obj) {
+ // console.warn(obj.selector, "could not be indexed");
+ // };
+ //
+ // Returns nothing.
+ SelectorSet.prototype.logDefaultIndexUsed = function() {};
+
// Public: Add selector to set.
//
// selector - String CSS selector
@@ -216,6 +230,9 @@
selIndex = indexes[index.name] = Object.create(index);
selIndex.keys = new Map();
}
+ if (index === this.indexes.default) {
+ this.logDefaultIndexUsed(obj);
+ }
objs = selIndex.keys.get(key);
if (!objs) {
objs = []; | Add hook to log when default index is used | josh_selector-set | train | js |
4d37aa069ec32abfd323be1b42f2efe8603646c2 | diff --git a/lxd/instances.go b/lxd/instances.go
index <HASH>..<HASH> 100644
--- a/lxd/instances.go
+++ b/lxd/instances.go
@@ -295,13 +295,13 @@ func instancesRestart(s *state.State) error {
return nil
}
-type containerStopList []instance.Instance
+type instanceStopList []instance.Instance
-func (slice containerStopList) Len() int {
+func (slice instanceStopList) Len() int {
return len(slice)
}
-func (slice containerStopList) Less(i, j int) bool {
+func (slice instanceStopList) Less(i, j int) bool {
iOrder := slice[i].ExpandedConfig()["boot.stop.priority"]
jOrder := slice[j].ExpandedConfig()["boot.stop.priority"]
@@ -314,7 +314,7 @@ func (slice containerStopList) Less(i, j int) bool {
return slice[i].Name() < slice[j].Name()
}
-func (slice containerStopList) Swap(i, j int) {
+func (slice instanceStopList) Swap(i, j int) {
slice[i], slice[j] = slice[j], slice[i]
}
@@ -380,7 +380,7 @@ func instancesShutdown(s *state.State) error {
}
}
- sort.Sort(containerStopList(instances))
+ sort.Sort(instanceStopList(instances))
if dbAvailable {
// Reset all instances states | lxd/instances: containerStopList -> instanceStopList | lxc_lxd | train | go |
5e2561a3be4752ecfee2112021913f2dbe2015e4 | diff --git a/lxd/rbac/server.go b/lxd/rbac/server.go
index <HASH>..<HASH> 100644
--- a/lxd/rbac/server.go
+++ b/lxd/rbac/server.go
@@ -332,7 +332,17 @@ func (r *Server) UserAccess(username string) (*UserAccess, error) {
continue
}
- access.Projects[k] = v
+ // Look for project name.
+ for projectName, resourceID := range r.resources {
+ if k != resourceID {
+ continue
+ }
+
+ access.Projects[projectName] = v
+ break
+ }
+
+ // Ignore unknown projects.
}
return &access, nil | lxd/rbac: Fix checks by matching proper name
The data from RBAC uses resource IDs not project names, so we need to
map things through r.resources. | lxc_lxd | train | go |
82f708dd88bd14bb14442ce0cd80aed3aeb01ea5 | diff --git a/src/ImmutableStore.es6.js b/src/ImmutableStore.es6.js
index <HASH>..<HASH> 100644
--- a/src/ImmutableStore.es6.js
+++ b/src/ImmutableStore.es6.js
@@ -19,6 +19,9 @@ var invariant = require('invariant');
var Immutable = require('immutable');
var ObjectOrientedStore = require('./ObjectOrientedStore.es6');
+const IN_PRODUCTION = process.env.NODE_ENV === 'production';
+const CHECK_IMMUTABILITY = !!process.env.CHECK_IMMUTABILITY;
+
/**
* A Flux Store which is strict on Immutability
*/
@@ -46,6 +49,13 @@ class ImmutableStore extends ObjectOrientedStore {
* debugging
*/
constructor (options) {
+ // If we are in production, then lets skip adding
+ // the immutability checks for performance sake.
+ if (!CHECK_IMMUTABILITY && IN_PRODUCTION) {
+ super(options);
+ return;
+ }
+
invariant(
options,
'Cannot create FluxThis Stores without arguments' | Fixes #<I> - disable immutable checks in production | addthis_fluxthis | train | js |
a8097f2c406bc6d5a16ba520957e72846cfc14c7 | diff --git a/spec/controllers/curation_concerns/admin_controller_spec.rb b/spec/controllers/curation_concerns/admin_controller_spec.rb
index <HASH>..<HASH> 100644
--- a/spec/controllers/curation_concerns/admin_controller_spec.rb
+++ b/spec/controllers/curation_concerns/admin_controller_spec.rb
@@ -27,7 +27,7 @@ RSpec.describe CurationConcerns::AdminController do
it "is successful" do
get :workflow
expect(response).to be_successful
- expect(assigns[:works]).to be_kind_of(Enumerable)
+ expect(assigns[:works]).to respond_to(:each)
end
end | Updating specs to duck type workflows | samvera_hyrax | train | rb |
6a2d9c3b28fb7f1e3ca1b68d2e146ac5a19150f0 | diff --git a/src/index.js b/src/index.js
index <HASH>..<HASH> 100644
--- a/src/index.js
+++ b/src/index.js
@@ -2,11 +2,14 @@ import querystring from 'querystring'
import 'isomorphic-fetch' // eslint-disable-line import/no-unassigned-import
import { required, checkStatus, parseJSON } from './helpers'
+const { localStorge } = window
+const TOKEN_KEY_NAME = 'syncano_client_token'
+
function SyncanoClient(instanceName = required('instanceName'), options = {}) {
client.instanceName = instanceName
client.baseUrl = options.baseUrl || `https://${instanceName}.syncano.space/`
client.loginMethod = options.loginMethod
- client.token = options.token
+ client.token = options.token || localStorge.getItem(TOKEN_KEY_NAME)
let defaults = {
'Content-Type': 'application/json'
@@ -72,6 +75,12 @@ client.logout = function () {
client.setToken = function (token) {
this.token = token
+
+ if (token) {
+ localStorge.setItem(TOKEN_KEY_NAME, token)
+ } else {
+ localStorge.removeItem(TOKEN_KEY_NAME)
+ }
}
client.get = function (endpoint = required('endpoint'), body = {}, options = {}) { | feat(client): save token in localstorage | Syncano_syncano-client-js | train | js |
8549547e8f4b8991609070e6b37a1ff989918376 | diff --git a/order.js b/order.js
index <HASH>..<HASH> 100644
--- a/order.js
+++ b/order.js
@@ -9,25 +9,38 @@ Query.prototype.order = function (options) {
}
var
- key = null,
+ asc = [],
+ desc = [],
self = this,
sort = options.sort || {},
value = null;
- // TODO: Apply sort direction
- //if (sort.desc) {
+ if (sort.desc) {
+ if (!(sort.desc instanceof Array)) {
+ desc.push(sort.desc);
+ } else {
+ desc = sort.desc;
+ }
- //}
+ desc.forEach(function (field) {
+ value = {};
+ value[field] = -1;
+ self.sort(value);
+ });
+ }
- if (sort.fields instanceof Array) {
- for (key in sort.fields) {
- if (sort.fields.hasOwnProperty(key)) {
- value = sort.fields[key];
- self.sort(value);
- }
+ if (sort.asc) {
+ if (!(sort.asc instanceof Array)) {
+ asc.push(sort.asc);
+ } else {
+ asc = sort.asc;
}
- } else {
- self.sort(sort.fields);
+
+ asc.forEach(function (field) {
+ value = {};
+ value[field] = 1;
+ self.sort(value);
+ });
}
return self; | modifying the sorting to allow for desc or asc... the order in which sort is applied is desc first then asc | PlayNetwork_mongoose-middleware | train | js |
038dfe35af2f346045b5b8133291d08825d842bf | diff --git a/lib/yardstick/version.rb b/lib/yardstick/version.rb
index <HASH>..<HASH> 100644
--- a/lib/yardstick/version.rb
+++ b/lib/yardstick/version.rb
@@ -2,5 +2,5 @@
module Yardstick
# Gem version
- VERSION = '0.9.7'.freeze
+ VERSION = '0.9.8'.freeze
end # module Yardstick | Bump to version <I> | dkubb_yardstick | train | rb |
8623a4e669e1a55f1f8f06236d1e381c2c660e16 | diff --git a/messenger.go b/messenger.go
index <HASH>..<HASH> 100644
--- a/messenger.go
+++ b/messenger.go
@@ -76,7 +76,7 @@ func (m *Messenger) handlePOST(rw http.ResponseWriter, req *http.Request) {
}
//Message integrity check
if m.AppSecret != "" {
- if req.Header.Get("x-hub-signature") == "" || !checkIntegrity(m.AppSecret, read, req.Header.Get("x-hub-signature")[5:]) {
+ if len(req.Header.Get("x-hub-signature")) < 6 || !checkIntegrity(m.AppSecret, read, req.Header.Get("x-hub-signature")[5:]) {
rw.WriteHeader(http.StatusBadRequest)
return
} | Fixed panic if forged request contained too short x-hub-signature | maciekmm_messenger-platform-go-sdk | train | go |
177a10ba1668f1319611f2e64e2e63a8bf486f1c | diff --git a/host/logmux/sink.go b/host/logmux/sink.go
index <HASH>..<HASH> 100644
--- a/host/logmux/sink.go
+++ b/host/logmux/sink.go
@@ -419,7 +419,9 @@ func (s *LogAggregatorSink) Connect() error {
}
func (s *LogAggregatorSink) Close() {
- s.conn.Close()
+ if s.conn != nil {
+ s.conn.Close()
+ }
}
func (s *LogAggregatorSink) GetCursor(hostID string) (*utils.HostCursor, error) { | host/logmux: Don't attempt to close nil conn on Close | flynn_flynn | train | go |
04fefc1487693e750ca5e2dd8fe7fe389d63ada0 | diff --git a/tests/system/View/ParserTest.php b/tests/system/View/ParserTest.php
index <HASH>..<HASH> 100644
--- a/tests/system/View/ParserTest.php
+++ b/tests/system/View/ParserTest.php
@@ -860,6 +860,28 @@ class ParserTest extends \CIUnitTestCase
$this->assertEquals('0. foo bar 1. baz 2. foo bar ', $parser->renderString($template));
}
+ /**
+ * @group parserplugins
+ */
+ public function testParserSingleTagWithNamedParams()
+ {
+ $parser = new Parser($this->config, $this->viewsDir, $this->loader);
+ $parser->addPlugin('read_params', function (array $params = []) {
+ $out = '';
+
+ foreach ($params as $index => $param)
+ {
+ $out .= "{$index}: {$param}. ";
+ }
+
+ return $out;
+ }, false);
+
+ $template = '{+ read_params title="Hello world" page=5 [email protected] +}';
+
+ $this->assertEquals('title: Hello world. page: 5. email: [email protected]. ', $parser->renderString($template));
+ }
+
//--------------------------------------------------------------------
/** | add test for parse plugin with named params | codeigniter4_CodeIgniter4 | train | php |
33113e55cb500e71ccb89fe7ffc6861da4cbcb14 | diff --git a/metrics-jetty9/src/main/java/com/codahale/metrics/jetty9/InstrumentedHandler.java b/metrics-jetty9/src/main/java/com/codahale/metrics/jetty9/InstrumentedHandler.java
index <HASH>..<HASH> 100644
--- a/metrics-jetty9/src/main/java/com/codahale/metrics/jetty9/InstrumentedHandler.java
+++ b/metrics-jetty9/src/main/java/com/codahale/metrics/jetty9/InstrumentedHandler.java
@@ -134,7 +134,6 @@ public class InstrumentedHandler extends HandlerWrapper {
public void onComplete(AsyncEvent event) throws IOException {
final HttpChannelState state = (HttpChannelState) event.getAsyncContext();
final Request request = state.getBaseRequest();
- activeRequests.dec();
updateResponses(request);
if (!state.isDispatched()) {
activeSuspended.dec();
@@ -181,7 +180,6 @@ public class InstrumentedHandler extends HandlerWrapper {
}
activeSuspended.inc();
} else if (state.isInitial()) {
- activeRequests.dec();
requests.update(dispatched, TimeUnit.MILLISECONDS);
updateResponses(request);
} | InstrumentedHandler: Remove duplicate calls to activeRequests.dec().
The counter is decremented inside updateResponses(). This caused the
active-requests counter to be negative. | dropwizard_metrics | train | java |
77633366cc6440ef3bed85c7546a187b33e2729f | diff --git a/src/java/com/threerings/media/sound/SoundManager.java b/src/java/com/threerings/media/sound/SoundManager.java
index <HASH>..<HASH> 100644
--- a/src/java/com/threerings/media/sound/SoundManager.java
+++ b/src/java/com/threerings/media/sound/SoundManager.java
@@ -1,5 +1,5 @@
//
-// $Id: SoundManager.java,v 1.58 2003/04/06 04:36:01 mdb Exp $
+// $Id: SoundManager.java,v 1.59 2003/04/08 01:46:16 ray Exp $
package com.threerings.media.sound;
@@ -468,6 +468,13 @@ public class SoundManager
Class playerClass = getMusicPlayerClass(music);
+ // if we don't have a player for this song, play the next song
+ if (playerClass == null) {
+ _musicStack.removeFirst();
+ playTopMusic();
+ return;
+ }
+
// shutdown the old player if we're switching music types
if (! playerClass.isInstance(_musicPlayer)) {
if (_musicPlayer != null) { | Handle not finding a music player for a song gracefully.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@<I> <I>f4-<I>e9-<I>-aa3c-eee0fc<I>fb1 | threerings_narya | train | java |
1d974f5a481539fd427eea00d551fa3af918f80e | diff --git a/cake/console/shells/tasks/db_config.php b/cake/console/shells/tasks/db_config.php
index <HASH>..<HASH> 100644
--- a/cake/console/shells/tasks/db_config.php
+++ b/cake/console/shells/tasks/db_config.php
@@ -305,10 +305,9 @@ class DbConfigTask extends Shell {
$out .= "class DATABASE_CONFIG {\n\n";
foreach ($configs as $config) {
- $config = array_merge($this->__defaultConfig, $config);
- extract($config);
+ $config = array_merge($this->_defaultConfig, $config);
- $out .= "\tvar \${$name} = array(\n";
+ $out .= "\tpublic \${$name} = array(\n";
$out .= "\t\t'driver' => '{$driver}',\n";
$out .= "\t\t'persistent' => {$persistent},\n";
$out .= "\t\t'host' => '{$host}',\n";
@@ -337,7 +336,6 @@ class DbConfigTask extends Shell {
}
$out .= "}\n";
- $out .= "?>";
$filename = $this->path . 'database.php';
return $this->createFile($filename, $out);
} | Fixing issue that caused db config generation to fail. | cakephp_cakephp | train | php |
971c194624ee0736bb2fff94d0dae2cdcaeb3eee | diff --git a/mcex/distributions/distributions.py b/mcex/distributions/distributions.py
index <HASH>..<HASH> 100644
--- a/mcex/distributions/distributions.py
+++ b/mcex/distributions/distributions.py
@@ -94,4 +94,11 @@ def ZeroInflatedPoisson(theta, z):
return switch(z,
Poisson(theta)(value),
ConstantDist(0)(value))
- return dist
\ No newline at end of file
+ return dist
+
+def Bound(dist, lower = -inf, upper = inf):
+ def ndist(value):
+ return switch(ge(value , lower) & le(value , upper),
+ dist(value),
+ -inf)
+ return ndist
\ No newline at end of file | added trunction function for distributions | pymc-devs_pymc | train | py |
Subsets and Splits