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 |
|---|---|---|---|---|---|
9de75aed01b5f3ec9ee95566e7a42db479c931dd | diff --git a/minio/policy.py b/minio/policy.py
index <HASH>..<HASH> 100644
--- a/minio/policy.py
+++ b/minio/policy.py
@@ -378,7 +378,7 @@ def _remove_statements(statements, policy, bucket_name, prefix=''):
#
def _merge_dict(d1, d2):
out = collections.defaultdict(list)
- for k, v in itertools.chain(d1.iteritems(), d2.iteritems()):
+ for k, v in itertools.chain(d1.items(), d2.items()):
out[k] = list(set(out[k] + [v] if isinstance(v, basestring) else v))
return dict(out)
@@ -399,7 +399,7 @@ def _merge_dict(d1, d2):
#
def _merge_condition(c1, c2):
out = collections.defaultdict(dict)
- for k, v in itertools.chain(c1.iteritems(), c2.iteritems()):
+ for k, v in itertools.chain(c1.items(), c2.items()):
out.update({k: _merge_dict(out[k], v)})
return dict(out) | Fix: Use dict.items() instead of dict.iteritems() (#<I>)
dict.iteritems() is not supported in python 3 but we can safely use
dict.items() which provides a _view_ of dict elements. | minio_minio-py | train | py |
1b0959de97247bd156727ad87f6061e0262a51e4 | diff --git a/demo.js b/demo.js
index <HASH>..<HASH> 100644
--- a/demo.js
+++ b/demo.js
@@ -12,12 +12,18 @@ const VIDEO_ADDRESS_SIZE = (3**VIDEO_TRYTE_COUNT * TRITS_PER_TRYTE)**TRYTES_PER_
const Memory = require('./memory');
+const MAX_ADDRESS = (3**TRITS_PER_WORD - 1) / 2;
+const MIN_ADDRESS = -MAX_ADDRESS;
+
+const VIDEO_ADDRESS_OFFSET = MAX_ADDRESS - VIDEO_ADDRESS_SIZE; // -3280,
+if (VIDEO_ADDRESS_SIZE + VIDEO_ADDRESS_OFFSET !== MAX_ADDRESS) throw new Error('wrong video address size');
+
const memory = Memory({
tryteCount: MEMORY_SIZE,
map: {
video: {
- start: -3280,
- end: VIDEO_ADDRESS_SIZE,
+ start: VIDEO_ADDRESS_OFFSET, // -3280 00iii iiiii
+ end: VIDEO_ADDRESS_SIZE + VIDEO_ADDRESS_OFFSET, // 29524, end 11111 11111
},
/* TODO
input: { | Clarify video memory map assignment (-<I> to <I>, at upper end of memory space, to fit) | thirdcoder_cpu3502 | train | js |
3628d8f210ef89badf713374a1ff733287f2a23e | diff --git a/src/DocBlox/Core/Abstract.php b/src/DocBlox/Core/Abstract.php
index <HASH>..<HASH> 100644
--- a/src/DocBlox/Core/Abstract.php
+++ b/src/DocBlox/Core/Abstract.php
@@ -27,7 +27,7 @@
abstract class DocBlox_Core_Abstract
{
/** @var string The actual version number of DocBlox. */
- const VERSION = '0.18.0';
+ const VERSION = '0.18.1';
/**
* The logger used to capture all messages send by the log method. | RELEASE: Updated version number to <I> | phpDocumentor_phpDocumentor2 | train | php |
028df2e7473d0f5b64f30119e43df93236128b3a | 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
@@ -7,9 +7,13 @@ unless defined? SPEC_ROOT
when ENV["RADIANT_ENV_FILE"]
require ENV["RADIANT_ENV_FILE"]
when File.dirname(__FILE__) =~ %r{vendor/radiant/vendor/extensions}
- require "#{File.expand_path(File.dirname(__FILE__) + "/../../../../../")}/config/environment"
+ env = "#{File.expand_path(File.dirname(__FILE__) + "/../../../")}/config/environment"
+ puts "requiring #{env}"
+ require env
else
- require "#{File.expand_path(File.dirname(__FILE__) + "/../../../")}/config/environment"
+ env = "#{File.expand_path(File.dirname(__FILE__) + "/../")}/config/environment"
+ puts "requiring #{env}"
+ require env
end
# unless defined? RADIANT_ROOT | alter the environment path when running tests from RADIANT_ROOT | radiant_radiant | train | rb |
0339c4311b7cc20e8d9b7e24e61547bc5ce12f5f | diff --git a/tests/tictactoe/ShuffledDecisionsGameState.php b/tests/tictactoe/ShuffledDecisionsGameState.php
index <HASH>..<HASH> 100644
--- a/tests/tictactoe/ShuffledDecisionsGameState.php
+++ b/tests/tictactoe/ShuffledDecisionsGameState.php
@@ -7,6 +7,17 @@ namespace lucidtaz\minimax\tests\tictactoe;
*
* This is to rule out any tests that accidentally succeed because of
* coincidence.
+ *
+ * Note that this approach uses inheritance rather than applying the arguably
+ * more sensible Decorator pattern. The reason for this is that the code
+ * (currently, perhaps it will be solved) it not really strict with regards to
+ * typing, and will call methods on the TicTacToe GameState class that are not
+ * defined in the GameState interface, such as makeMove(). Until such issues are
+ * resolved by an interface redesign, we must resort to inheritance.
+ *
+ * Furthermore, a decorated object may lose its decoration when passing out
+ * references of itself to other code. This makes the pattern more hassle than
+ * it's worth.
*/
class ShuffledDecisionsGameState extends GameState
{ | Explain why the tests use inheritance instead of a Decorator | LucidTaZ_minimax | train | php |
cd3ff3722ce4fe8d8cafb59d99594185fbd571d1 | diff --git a/src/rabird/core/distutils/downloader.py b/src/rabird/core/distutils/downloader.py
index <HASH>..<HASH> 100644
--- a/src/rabird/core/distutils/downloader.py
+++ b/src/rabird/core/distutils/downloader.py
@@ -115,7 +115,7 @@ def download(url, target=None):
downloader(url, target)
-def download_file_insecure_to_io(url, target_file=None):
+def download_file_insecure_to_io(url, target_file=None, headers=None):
"""
Use Python to download the file, even though it cannot authenticate the
connection.
@@ -123,11 +123,20 @@ def download_file_insecure_to_io(url, target_file=None):
try:
from urllib.request import urlopen
+ from urllib.request import Request
except ImportError:
from urllib2 import urlopen
+ from urllib2 import Request
src = None
try:
- src = urlopen(url)
+ req = Request(
+ url,
+ data=None,
+ headers=headers
+ )
+
+ src = urlopen(req)
+
# Read/write all in one block, so we don't create a corrupt file
# if the download is interrupted.
data = src.read() | Added headers argument for modify something just like "User-Agent" | starofrainnight_rabird.core | train | py |
dac5c7c639db333c9f238b15eeb494b579c6527a | diff --git a/clip.js b/clip.js
index <HASH>..<HASH> 100644
--- a/clip.js
+++ b/clip.js
@@ -165,7 +165,7 @@ Polygon.prototype.collectClipResults = function(subjectList, clipList) {
for (; !crt.visited; crt = crt.neighbor) {
result.push(crt.vec.clone());
- var forward = !crt.entry
+ var forward = crt.entry
while(true) {
crt.visited = true;
crt = forward ? crt.next : crt.prev; | this goes along with a previous commit. Since we fixed phase 2, we can fix phase 3.
In phase 2, the `status_entry` was being initialized using the wrong polygon. | tmpvar_2d-polygon-boolean | train | js |
9e044c1b3e75167d5447e032dfcfd2522a551a45 | diff --git a/test/test_base.rb b/test/test_base.rb
index <HASH>..<HASH> 100644
--- a/test/test_base.rb
+++ b/test/test_base.rb
@@ -162,7 +162,7 @@ class TestBase < Test::Unit::TestCase
SomeModel.delete_all(:id=>2)
end
should "leave non_matching items in table" do
- assert 1,SomeModel.all.size
+ assert_equal 1, SomeModel.all.size
end
should "remove matching items" do
assert SomeModel.where(:id=>2).empty? | that should have been assert_equal. not sure how that ever worked. | tpickett66_archivist | train | rb |
1d46d48c47604c5798f6aa4191f4a5ecaa81c09c | diff --git a/src/diamond/test/testmetric.py b/src/diamond/test/testmetric.py
index <HASH>..<HASH> 100644
--- a/src/diamond/test/testmetric.py
+++ b/src/diamond/test/testmetric.py
@@ -83,3 +83,22 @@ class TestMetric(unittest.TestCase):
message = 'Actual %s, expected %s' % (actual_value, expected_value)
self.assertEqual(actual_value, expected_value, message)
+
+ def test_issue_723(self):
+ metrics = [
+ 9.97143369909e-05,
+ '9.97143369909e-05',
+ 0.0000997143369909,
+ '0.0000997143369909',
+ ]
+
+ for precision in xrange(0, 100):
+ for m in metrics:
+ metric = Metric('test.723', m, timestamp=0)
+
+ actual_value = str(metric).strip()
+ expected_value = 'test.723 0 0'
+
+ message = 'Actual %s, expected %s' % (actual_value,
+ expected_value)
+ self.assertEqual(actual_value, expected_value, message) | Per #<I>, try to duplicate generating a scientific notation metric | python-diamond_Diamond | train | py |
bc17a9b38fa38bcb79e56ef8f356c2b1d92e55f4 | diff --git a/spec/build_tests_spec.rb b/spec/build_tests_spec.rb
index <HASH>..<HASH> 100644
--- a/spec/build_tests_spec.rb
+++ b/spec/build_tests_spec.rb
@@ -372,6 +372,17 @@ EOF
expect(File.exists?('simple.c')).to be_truthy
end
+ it "does not process environments" do
+ test_dir("simple")
+ result = run_rscons(args: %w[clean])
+ expect(result.stderr).to eq ""
+ expect(File.exists?('build/e.1/simple.c.o')).to be_falsey
+ expect(File.exists?('build/e.1')).to be_falsey
+ expect(File.exists?('simple.exe')).to be_falsey
+ expect(File.exists?('simple.c')).to be_truthy
+ expect(result.stdout).to eq ""
+ end
+
it 'does not clean created directories if other non-rscons-generated files reside there' do
test_dir("simple")
result = run_rscons | Test that clean task does not process environments | holtrop_rscons | train | rb |
620aca0ac2390b27fb3919396408bd50cb3beb7c | diff --git a/mod/hotpot/report.php b/mod/hotpot/report.php
index <HASH>..<HASH> 100644
--- a/mod/hotpot/report.php
+++ b/mod/hotpot/report.php
@@ -51,7 +51,7 @@
// assemble array of form data
$formdata = array(
'mode' => $mode,
- 'reportusers' => has_capability('mod/hotpot:viewreport',$modulecontext) ? optional_param('reportusers', get_user_preferences('hotpot_reportusers', 'allusers'), PARAM_ALPHA) : 'this',
+ 'reportusers' => has_capability('mod/hotpot:viewreport',$modulecontext) ? optional_param('reportusers', get_user_preferences('hotpot_reportusers', 'allusers'), PARAM_ALPHANUM) : 'this',
'reportattempts' => optional_param('reportattempts', get_user_preferences('hotpot_reportattempts', 'all'), PARAM_ALPHA),
'reportformat' => optional_param('reportformat', 'htm', PARAM_ALPHA),
'reportshowlegend' => optional_param('reportshowlegend', get_user_preferences('hotpot_reportshowlegend', '0'), PARAM_INT), | set"reportusers" to PARAM_ALPHANUM, so that it can accept userids and group names | moodle_moodle | train | php |
cc562de152099552b6376d8ef28872f0b0e55063 | diff --git a/library/src/main/java/com/jaredrummler/materialspinner/MaterialSpinner.java b/library/src/main/java/com/jaredrummler/materialspinner/MaterialSpinner.java
index <HASH>..<HASH> 100644
--- a/library/src/main/java/com/jaredrummler/materialspinner/MaterialSpinner.java
+++ b/library/src/main/java/com/jaredrummler/materialspinner/MaterialSpinner.java
@@ -478,7 +478,7 @@ public class MaterialSpinner extends TextView {
&& popupWindowHeight <= listViewHeight) {
return popupWindowHeight;
}
- return WindowManager.LayoutParams.WRAP_CONTENT;
+ return (int) listViewHeight;
}
/** | Do not use WRAP_CONTENT for PopupWindow height
The PopupWindow was using WRAP_CONTENT for its height which was showing
the popup below the view in some instances. The listview height is now
used for the PopupWindow height which should fix this issue.
This should resolve #<I> #<I> | jaredrummler_MaterialSpinner | train | java |
03b3c105bb427d6d062f609fe084021dc766f228 | diff --git a/pkg/kvstore/etcd.go b/pkg/kvstore/etcd.go
index <HASH>..<HASH> 100644
--- a/pkg/kvstore/etcd.go
+++ b/pkg/kvstore/etcd.go
@@ -1491,9 +1491,15 @@ func (e *etcdClient) Close() {
}
e.RLock()
defer e.RUnlock()
- e.lockSession.Close()
- e.session.Close()
- e.client.Close()
+ if err := e.lockSession.Close(); err != nil {
+ e.getLogger().WithError(err).Warning("Failed to revoke lock session while closing etcd client")
+ }
+ if err := e.session.Close(); err != nil {
+ e.getLogger().WithError(err).Warning("Failed to revoke main session while closing etcd client")
+ }
+ if err := e.client.Close(); err != nil {
+ e.getLogger().WithError(err).Warning("Failed to close etcd client")
+ }
}
// GetCapabilities returns the capabilities of the backend | kvstore: Log errors while closing etcd client | cilium_cilium | train | go |
539f1e637fb7eda8fa59725e6f4c2d898893589b | diff --git a/example/idp2/idp.py b/example/idp2/idp.py
index <HASH>..<HASH> 100755
--- a/example/idp2/idp.py
+++ b/example/idp2/idp.py
@@ -371,7 +371,7 @@ class SSO(Service):
@staticmethod
def _store_request(saml_msg):
logger.debug("_store_request: %s", saml_msg)
- key = sha1(saml_msg["SAMLRequest"]).hexdigest()
+ key = sha1(saml_msg["SAMLRequest"].encode()).hexdigest()
# store the AuthnRequest
IDP.ticket[key] = saml_msg
return key | Fixed Unicode-objects must be encoded before hashing bug | IdentityPython_pysaml2 | train | py |
e33c84e02c31b20be363f295d6e2d7e3ce1e7d0d | diff --git a/src/Maths.php b/src/Maths.php
index <HASH>..<HASH> 100644
--- a/src/Maths.php
+++ b/src/Maths.php
@@ -3,13 +3,13 @@
class Maths
{
- public static function _double($value, $iterations = 1)
+ public static function double($value, $iterations = 1)
{
$result = $value;
if ($iterations > 0)
{
- $result = self::_double($result * 2, ($iterations - 1));
+ $result = self::double($result * 2, ($iterations - 1));
}
return $result; | Rename _double method to double in Maths library | irwtdvoys_bolt-core | train | php |
625d4fb502a488224a7a3ec7cf9f288ccc675219 | diff --git a/src/dawguk/GarminConnect.php b/src/dawguk/GarminConnect.php
index <HASH>..<HASH> 100755
--- a/src/dawguk/GarminConnect.php
+++ b/src/dawguk/GarminConnect.php
@@ -133,6 +133,7 @@ class GarminConnect {
preg_match("/ticket=([^']+)'/", $strResponse, $arrMatches);
if (!isset($arrMatches[1])) {
+ $this->objConnector->clearCookie();
throw new AuthenticationException("Ticket value wasn't found in response - looks like the authentication failed.");
} | Fixes #5
Fix: Removing cookie from disk if authentication failed | dawguk_php-garmin-connect | train | php |
6fdba19373e6f5f353f8c18a48a78da161faa802 | diff --git a/src/util.js b/src/util.js
index <HASH>..<HASH> 100644
--- a/src/util.js
+++ b/src/util.js
@@ -80,6 +80,17 @@ Bitcoin.Util = {
while (decimalPart.length < 2) decimalPart += "0";
return integerPart+"."+decimalPart;
},
+ parseValue: function (valueString) {
+ var valueComp = valueString.split('.');
+ var integralPart = valueComp[0];
+ var fractionalPart = valueComp[1] || "0";
+ while (fractionalPart.length < 8) fractionalPart += "0";
+ fractionalPart = fractionalPart.replace(/^0+/g, '');
+ var value = BigInteger.valueOf(parseInt(integralPart));
+ value = value.multiply(BigInteger.valueOf(100000000));
+ value = value.add(BigInteger.valueOf(parseInt(fractionalPart)));
+ return value;
+ },
sha256ripe160: function (data) {
return Crypto.RIPEMD160(Crypto.SHA256(data, {asBytes: true}), {asBytes: true});
} | New utility function for parsing value strings. | BitGo_bitgo-utxo-lib | train | js |
cd72c6954f8ce0f67eb3e3740772174954a3ecf3 | diff --git a/tests/spring-cloud-sleuth-instrumentation-feign-tests/src/test/java/org/springframework/cloud/sleuth/instrument/feign/issues/issue502/Issue502Tests.java b/tests/spring-cloud-sleuth-instrumentation-feign-tests/src/test/java/org/springframework/cloud/sleuth/instrument/feign/issues/issue502/Issue502Tests.java
index <HASH>..<HASH> 100644
--- a/tests/spring-cloud-sleuth-instrumentation-feign-tests/src/test/java/org/springframework/cloud/sleuth/instrument/feign/issues/issue502/Issue502Tests.java
+++ b/tests/spring-cloud-sleuth-instrumentation-feign-tests/src/test/java/org/springframework/cloud/sleuth/instrument/feign/issues/issue502/Issue502Tests.java
@@ -82,7 +82,7 @@ public class Issue502Tests {
then(response).isEqualTo("foo");
// retries
then(this.spans).hasSize(1);
- then(this.spans.get(0).tags().get("http.path")).isEqualTo("");
+ //then(this.spans.get(0).tags().get("http.path")).isEqualTo("");
}
} | Comments out failing bit of test.
See gh-<I> | spring-cloud_spring-cloud-sleuth | train | java |
2a78a27cc79c170792fd150bb9313462c15490dd | diff --git a/colorific/__init__.py b/colorific/__init__.py
index <HASH>..<HASH> 100644
--- a/colorific/__init__.py
+++ b/colorific/__init__.py
@@ -21,6 +21,11 @@ def get_version():
__version__ = get_version()
-# import palette modules for backward compatilibity
-from .palette import *
-from .config import *
+# import palette modules for backward compatilibity.
+try:
+ from .palette import *
+ from .config import *
+
+except ImportError:
+ # you should install requirements, see requirements.pip file.
+ pass | don't give an error if you still didn't install requirements. | 99designs_colorific | train | py |
5ba0031992255f7e9ef133cbb47975ace2cf3d24 | diff --git a/datadog_checks_base/datadog_checks/base/checks/base.py b/datadog_checks_base/datadog_checks/base/checks/base.py
index <HASH>..<HASH> 100644
--- a/datadog_checks_base/datadog_checks/base/checks/base.py
+++ b/datadog_checks_base/datadog_checks/base/checks/base.py
@@ -90,6 +90,9 @@ class __AgentCheckPy3(object):
# new-style init: the 3rd argument is `instances`
self.instances = args[2]
+ # Agent 6+ will only have one instance
+ self.instance = self.instances[0] if self.instances else None
+
# `self.hostname` is deprecated, use `datadog_agent.get_hostname()` instead
self.hostname = datadog_agent.get_hostname()
@@ -457,6 +460,9 @@ class __AgentCheckPy2(object):
# new-style init: the 3rd argument is `instances`
self.instances = args[2]
+ # Agent 6+ will only have one instance
+ self.instance = self.instances[0] if self.instances else None
+
# `self.hostname` is deprecated, use `datadog_agent.get_hostname()` instead
self.hostname = datadog_agent.get_hostname() | Expose the single check instance as an attribute (#<I>) | DataDog_integrations-core | train | py |
de3d0622bb36a9b379fe6c82458914e58d0d4f22 | diff --git a/packages/@vue/cli-service/lib/commands/serve.js b/packages/@vue/cli-service/lib/commands/serve.js
index <HASH>..<HASH> 100644
--- a/packages/@vue/cli-service/lib/commands/serve.js
+++ b/packages/@vue/cli-service/lib/commands/serve.js
@@ -51,7 +51,7 @@ module.exports = (api, options) => {
api.chainWebpack(webpackConfig => {
if (process.env.NODE_ENV !== 'production' && process.env.NODE_ENV !== 'test') {
webpackConfig
- .devtool('cheap-module-eval-source-map')
+ .devtool('eval-cheap-module-source-map')
webpackConfig
.plugin('hmr') | refactor(cli-service): webpack `devtool` option (#<I>)
Close: #<I> | vuejs_vue-cli | train | js |
a4b388eddfb395d65b0d5cd688c079f520cd3db9 | diff --git a/src/Factory.php b/src/Factory.php
index <HASH>..<HASH> 100644
--- a/src/Factory.php
+++ b/src/Factory.php
@@ -28,6 +28,23 @@ abstract class Factory
string $password = null,
array $options = []
): EasyDB {
+ return static::fromArray([$dsn, $username, $password, $options]);
+ }
+
+ /**
+ * Create a new EasyDB object from array of parameters
+ *
+ * @param string $dsn
+ * @param string $username
+ * @param string $password
+ * @param array $options
+ * @return \ParagonIE\EasyDB\EasyDB
+ * @throws Issues\ConstructorFailed
+ */
+ public static function fromArray(array $config): EasyDB {
+
+ list($dsn, $username, $password, $options) = $config;
+
$dbEngine = '';
$post_query = null; | Add fromArray() alias for connect()
In case an exception is thrown in coonect(), database credentials are shown in the stack trace.
So an alias fromArray() is added, to put all credentials into array which will appear in the stack trace as a mere word "Array". | paragonie_easydb | train | php |
bdf7cfa7942f37772c0ac75a310e3ad4ef56d483 | diff --git a/src/core/createTemplate.js b/src/core/createTemplate.js
index <HASH>..<HASH> 100644
--- a/src/core/createTemplate.js
+++ b/src/core/createTemplate.js
@@ -4,17 +4,13 @@ import createHTMLStringTree from '../htmlString/createHTMLStringTree';
import { createVariable } from './variables';
import scanTreeForDynamicNodes from './scanTreeForDynamicNodes';
+let uniqueId = Date.now();
+
function createId() {
- if ( ExecutionEnvironment.canUseSymbol) {
+ if ( ExecutionEnvironment.canUseSymbol ) {
return Symbol();
} else {
- let uniqueId = null;
-
- function getUniqueName(prefix) {
- if (!uniqueId) uniqueId = (Date.now());
- return (prefix || 'id') + (uniqueId++);
- };
- return getUniqueName('Inferno');
+ return uniqueId++;
}
} | Reduce and inline the createId fallback | infernojs_inferno | train | js |
45a77295ee4e3f96b1fef2ca3833176eef615c23 | diff --git a/lib/accounting/booking.rb b/lib/accounting/booking.rb
index <HASH>..<HASH> 100644
--- a/lib/accounting/booking.rb
+++ b/lib/accounting/booking.rb
@@ -9,7 +9,17 @@ module Accounting
# Scoping
named_scope :by_account, lambda {|account_id|
{ :conditions => ["debit_account_id = :account_id OR credit_account_id = :account_id", {:account_id => account_id}] }
- }
+ } do
+ # Returns array of all booking titles
+ def titles
+ find(:all, :group => :title).map{|booking| booking.title}
+ end
+ end
+
+ # Returns array of all years we have bookings for
+ def self.fiscal_years
+ find(:all, :select => "year(value_date) AS year", :group => "year(value_date)").map{|booking| booking.year}
+ end
def self.scope_by_value_date(value_date)
scoping = self.default_scoping - [@by_value_scope] | Extend Booking.by_account scope with titles method; Add Booking.fiscal_years | huerlisi_has_accounts | train | rb |
2d8a25851b4a534392e406ba2385a980b85d47f0 | diff --git a/hazelcast/src/test/java/com/hazelcast/replicatedmap/ReplicatedMapStressTest.java b/hazelcast/src/test/java/com/hazelcast/replicatedmap/ReplicatedMapStressTest.java
index <HASH>..<HASH> 100644
--- a/hazelcast/src/test/java/com/hazelcast/replicatedmap/ReplicatedMapStressTest.java
+++ b/hazelcast/src/test/java/com/hazelcast/replicatedmap/ReplicatedMapStressTest.java
@@ -1,7 +1,7 @@
package com.hazelcast.replicatedmap;
import com.hazelcast.test.HazelcastTestSupport;
-import com.hazelcast.test.annotation.SlowTest;
+import com.hazelcast.test.annotation.NightlyTest;
import org.junit.Test;
import org.junit.experimental.categories.Category;
@@ -11,7 +11,7 @@ import java.util.concurrent.atomic.AtomicInteger;
import static org.junit.Assert.assertEquals;
-@Category(SlowTest.class)
+@Category(NightlyTest.class)
public class ReplicatedMapStressTest extends HazelcastTestSupport {
@Test
public void stressTestRemove() throws Exception { | stress tests belongs to a nightly category | hazelcast_hazelcast | train | java |
2d066a340a07ea493d48d7b07c098a7a987528ab | diff --git a/devboard.js b/devboard.js
index <HASH>..<HASH> 100644
--- a/devboard.js
+++ b/devboard.js
@@ -46,6 +46,12 @@ exports.DOMNode = function DOMNode(render, cleanUp) {
/**
* Rendering
*/
+
+var customRender = false;
+exports.customRender = function(fn) {
+ customRender = fn;
+};
+
function getRoot() {
/* eslint-env browser */
var root = document.getElementById(ROOT_DIV_ID);
@@ -62,5 +68,9 @@ function enqueueRender() {
enqueueRender.timer = requestAnimationFrame(renderRoot, 0);
}
function renderRoot() {
- ReactDOM.render($(Devboard, { catalog: catalog }), getRoot());
+ var element = $(Devboard, { catalog: catalog });
+ if (customRender) {
+ element = customRender(element);
+ }
+ ReactDOM.render(element, getRoot());
} | Provide a way to wrap the root component with your own stuff
This was introduced for RHL v3's <AppContainer>, but seems like it
might be generally fairly useful. | glenjamin_devboard | train | js |
16ea0c01a881aa703d97ae3cb55376c7359b1f92 | diff --git a/source/php/BulkImport.php b/source/php/BulkImport.php
index <HASH>..<HASH> 100644
--- a/source/php/BulkImport.php
+++ b/source/php/BulkImport.php
@@ -171,7 +171,7 @@ class BulkImport
$deleteAccounts = $this->diffUserAccounts(false);
//Sanity check, many users to remove?
- $maxDeleteLimit = isset($_GET['maxDeletelimit']) ? (int) $_GET['maxDeletelimit'] : 100;
+ $maxDeleteLimit = isset($_GET['maxDeletelimit']) ? (int) $_GET['maxDeletelimit'] : 1000;
if (count($deleteAccounts) > $maxDeleteLimit) {
if (is_main_site()) { | Update BulkImport.php
Set a higher max delete limit. | helsingborg-stad_active-directory-api-wp-integration | train | php |
4ee70400e8f186ca0057e17c0dc20ea34135a1d0 | diff --git a/reaction.py b/reaction.py
index <HASH>..<HASH> 100644
--- a/reaction.py
+++ b/reaction.py
@@ -74,8 +74,14 @@ def tokenize(rx):
yield token
def parse_compound_number(number):
- '''Parse compound number'''
- return Decimal(number)
+ '''Parse compound number
+
+ Return plain int if possible, otherwise use Decimal.'''
+
+ d = Decimal(number)
+ if d % 1 == 0:
+ return int(d)
+ return d
def parse_compound_count(count):
'''Parse compound count''' | reaction: Prefer integers over Decimal for stoichiometry | zhanglab_psamm | train | py |
e127fae16213bb10567638bf9dc8ab2a1576a716 | diff --git a/lib/sequelize-mocking.js b/lib/sequelize-mocking.js
index <HASH>..<HASH> 100644
--- a/lib/sequelize-mocking.js
+++ b/lib/sequelize-mocking.js
@@ -16,7 +16,7 @@ const _ = require('lodash');
const sequelizeFixtures = require('sequelize-fixtures');
// Constants and variables
-const FAKE_DATABASE_NAME = 'test-database';
+const FAKE_DATABASE_NAME = 'sqlite://test-database';
const AFTER_DEFINE_EVENT = 'afterDefine';
const AFTER_DEFINE_EVENT_NAME = 'sequelizeMockAfterDefine';
const SQLITE_SEQUELIZE_OPTIONS = { | Close #<I>: apply the dialect prefix "sqlite://" | rochejul_sequelize-mocking | train | js |
715f38abbc866583790094b972e3fbf3e66451cc | diff --git a/src/paperwork/backend/common/page.py b/src/paperwork/backend/common/page.py
index <HASH>..<HASH> 100644
--- a/src/paperwork/backend/common/page.py
+++ b/src/paperwork/backend/common/page.py
@@ -21,6 +21,7 @@ import tempfile
import PIL.Image
+from ..util import strip_accents
from ..util import split_words
@@ -218,11 +219,10 @@ class BasicPage(object):
return self.doc == other.doc and self.page_nb == other.page_nb
def __contains__(self, sentence):
- words = split_words(sentence)
- words = [word.lower() for word in words]
+ words = split_words(sentence, keep_short=True)
txt = self.text
for line in txt:
- line = line.lower()
+ line = strip_accents(line.lower())
for word in words:
if word in line:
return True | BasicPage.__contains__: Fix: Don't ignore short words + match correctly keywords, with accents or not | openpaperwork_paperwork-backend | train | py |
a6d0270100abfaca1ce64f146b99e2066cf9467a | diff --git a/message.go b/message.go
index <HASH>..<HASH> 100644
--- a/message.go
+++ b/message.go
@@ -283,6 +283,16 @@ func (m Message) Options(o OptionID) []interface{} {
return rv
}
+// Get the first value for the given option ID.
+func (m Message) Option(o OptionID) interface{} {
+ for _, v := range m.opts {
+ if o == v.ID {
+ return v.Value
+ }
+ }
+ return nil
+}
+
func (m Message) optionStrings(o OptionID) []string {
var rv []string
for _, o := range m.Options(o) { | Added Option as a convenience for a single option | dustin_go-coap | train | go |
e88aafef920ad8eb23ab3a63df78a5a7e29be3fc | diff --git a/cookies.py b/cookies.py
index <HASH>..<HASH> 100644
--- a/cookies.py
+++ b/cookies.py
@@ -750,6 +750,11 @@ class Cookie(object):
if key in ('name', 'value'): continue
parser = cls.attribute_parsers.get(key)
if not parser:
+ # Don't let totally unknown attributes pass silently
+ if not ignore_bad_attributes:
+ raise InvalidCookieAttributeError(key, value,
+ "unknown cookie attribute '%s'" % key)
+ _report_unknown_attribute(key)
continue
parsed[key] = parse(key) | fix: don't let totally unknown attributes pass silently in from_dict
for example, if a dict supposedly representing a Cookie has an attribute 'duh' that is likely to indicate an error.
if the user set ignore_bad_attributes=False they want an exception. even if it's true, the typical behavior elsewhere is to log unknown attribute. | sashahart_cookies | train | py |
29012f4b6637c3b75a2c8c46d339fb8b35e885cd | diff --git a/src/DoctrineServiceProvider.php b/src/DoctrineServiceProvider.php
index <HASH>..<HASH> 100644
--- a/src/DoctrineServiceProvider.php
+++ b/src/DoctrineServiceProvider.php
@@ -147,6 +147,10 @@ class DoctrineServiceProvider extends ServiceProvider
*/
protected function setupCache()
{
+ // Alias the cache, so the class is injectable in Lumen too
+ $this->app->alias('cache', \Illuminate\Cache\CacheManager::class);
+
+ // Bind Doctrine CacheManager
$this->app->singleton(CacheManager::class);
} | Alias CacheManager so the class is injectable in Lumen as well, fixes #<I> | laravel-doctrine_orm | train | php |
acc28c68a41b909f40326114b8a72a82797be349 | diff --git a/lib/express/server.js b/lib/express/server.js
index <HASH>..<HASH> 100644
--- a/lib/express/server.js
+++ b/lib/express/server.js
@@ -231,11 +231,11 @@ Server.prototype.error = function(fn){
Server.prototype.set = function(setting, val){
if (val === undefined) {
- var app = this;
- do {
- if (app.settings.hasOwnProperty(setting))
- return app.settings[setting];
- } while (app = app.parent);
+ if (this.settings.hasOwnProperty(setting)) {
+ return this.settings[setting];
+ } else if (this.parent) {
+ return this.parent.set(setting);
+ }
} else {
this.settings[setting] = val;
return this; | Refactored app.set() | expressjs_express | train | js |
15145bab284954013dcb07de46e58a7123d544b2 | diff --git a/src/frontend/org/voltdb/ProcedureRunner.java b/src/frontend/org/voltdb/ProcedureRunner.java
index <HASH>..<HASH> 100644
--- a/src/frontend/org/voltdb/ProcedureRunner.java
+++ b/src/frontend/org/voltdb/ProcedureRunner.java
@@ -441,8 +441,7 @@ public class ProcedureRunner {
qs.stmt, qs.params, sparams);
}
}
-
- if (m_catProc.getSinglepartition()) {
+ else if (m_catProc.getSinglepartition()) {
results = fastPath(batch);
}
else { | Replace a removed 'else'.
Turns out that if{} else if{} is not replacable with
if{} if{}. | VoltDB_voltdb | train | java |
a49d3eb37b85c36434b312b1cbf9d5bca93c08bb | diff --git a/src/pyshark/packet/common.py b/src/pyshark/packet/common.py
index <HASH>..<HASH> 100644
--- a/src/pyshark/packet/common.py
+++ b/src/pyshark/packet/common.py
@@ -20,5 +20,5 @@ class SlotsPickleable(object):
return ret
def __setstate__(self, data):
- for key, val in data.iteritems():
+ for key, val in data.items():
setattr(self, key, val) | Changed iteritems() in SlotsPicklable, upgraded to Python3 items() | KimiNewt_pyshark | train | py |
671af07d09f0eb7bad4604de89222c3aa0fa7a32 | diff --git a/lib/twat/actions.rb b/lib/twat/actions.rb
index <HASH>..<HASH> 100644
--- a/lib/twat/actions.rb
+++ b/lib/twat/actions.rb
@@ -100,9 +100,13 @@ module Twat
end
def account
- @account ||=
+ @account = config.accounts[account_name]
+ end
+
+ def account_name
+ @account_name ||=
if opts.include?(:account)
- config.accounts[opts[:account]]
+ opts[:account]
else
config.default_account
end | Shimmed around a stupid regression | richo_twat | train | rb |
4d4e3d21c8eec569d3e2d5734b8f6b58da109fe0 | diff --git a/fontbakery-check-ttf.py b/fontbakery-check-ttf.py
index <HASH>..<HASH> 100755
--- a/fontbakery-check-ttf.py
+++ b/fontbakery-check-ttf.py
@@ -840,9 +840,14 @@ def main():
expected_value = "{}-{}".format(fname,
style)
+ # TODO: Figure out if we really need to handle these entries
+ # and what would be the expected format for them.
+# elif name.nameID == NAMEID_COMPATIBLE_FULL_MACONLY:
+# expected_value = "some-rule-here"
+
else:
- # We'll implement support for
- # more name entries later today :-)
+ # This ignores any other nameID that might
+ # be declared in the name table
continue
# This is to allow us to handle more than one choice:
@@ -858,9 +863,6 @@ def main():
"' or '".join(expected_values),
string))
- if name.nameID == NAMEID_COMPATIBLE_FULL_MACONLY:
- pass # FSanches: not sure yet which rule to use here...
-
if failed is False:
fb.ok("Main entries in the name table"
" conform to expected format.") | remove requirement for nameid=<I> (NAMEID_COMPATIBLE_FULL_MACONLY)
and leave a TODO comment to remind us that we need to check this. | googlefonts_fontbakery | train | py |
12262341e9bd09e7b3497b77abe2d763db4a409a | diff --git a/tests/Doctrine/Tests/DBAL/Functional/Driver/SQLSrv/StatementTest.php b/tests/Doctrine/Tests/DBAL/Functional/Driver/SQLSrv/StatementTest.php
index <HASH>..<HASH> 100644
--- a/tests/Doctrine/Tests/DBAL/Functional/Driver/SQLSrv/StatementTest.php
+++ b/tests/Doctrine/Tests/DBAL/Functional/Driver/SQLSrv/StatementTest.php
@@ -3,6 +3,7 @@
namespace Doctrine\Tests\DBAL\Functional\Driver\SQLSrv;
use Doctrine\DBAL\Driver\SQLSrv\Driver;
+use Doctrine\DBAL\Driver\SQLSrv\SQLSrvException;
use Doctrine\Tests\DbalFunctionalTestCase;
class StatementTest extends DbalFunctionalTestCase
@@ -27,7 +28,7 @@ class StatementTest extends DbalFunctionalTestCase
// it's impossible to prepare the statement without bound variables for SQL Server,
// so the preparation happens before the first execution when variables are already in place
- $this->setExpectedException('Doctrine\\DBAL\\Driver\\SQLSrv\\SQLSrvException');
+ $this->expectException('Doctrine\\DBAL\\Driver\\SQLSrv\\SQLSrvException');
$stmt->execute();
}
} | #<I> s/setExpectedException/expectException | doctrine_dbal | train | php |
0bd10a76a9a8bfbdcff57a6516ebe34b7be3522b | diff --git a/lib/oxidized/model/saos.rb b/lib/oxidized/model/saos.rb
index <HASH>..<HASH> 100644
--- a/lib/oxidized/model/saos.rb
+++ b/lib/oxidized/model/saos.rb
@@ -10,6 +10,7 @@ class SAOS < Oxidized::Model
end
cmd 'configuration show' do |cfg|
+ cfg.gsub! /^! Created: [^\n]*\n/, ''
cfg
end | Update saos.rb
This proposed change is to make shure lines starting with "! Created: " are ignored. This preventes a diff in the config every time oxidized runs over Ciena SAOS devices.
This is probably not the most elegant way but it's a start. | ytti_oxidized | train | rb |
d3009a0304f87453d5720e7210a2b15915412844 | diff --git a/src/DumpServerCommand.php b/src/DumpServerCommand.php
index <HASH>..<HASH> 100644
--- a/src/DumpServerCommand.php
+++ b/src/DumpServerCommand.php
@@ -5,13 +5,13 @@ namespace BeyondCode\DumpServer;
use Illuminate\Console\Command;
use InvalidArgumentException;
-use Symfony\Component\Console\Style\SymfonyStyle;
use Symfony\Component\VarDumper\Cloner\Data;
-use Symfony\Component\VarDumper\Command\Descriptor\HtmlDescriptor;
+use Symfony\Component\Console\Style\SymfonyStyle;
use Symfony\Component\VarDumper\Dumper\CliDumper;
use Symfony\Component\VarDumper\Dumper\HtmlDumper;
use Symfony\Component\VarDumper\Server\DumpServer;
use Symfony\Component\VarDumper\Command\Descriptor\CliDescriptor;
+use Symfony\Component\VarDumper\Command\Descriptor\HtmlDescriptor;
class DumpServerCommand extends Command
{ | Enforce Laravel Style imports. | beyondcode_laravel-dump-server | train | php |
2d7fadcb6ae55498c339a817052afd470009cc71 | diff --git a/examples/shell.py b/examples/shell.py
index <HASH>..<HASH> 100644
--- a/examples/shell.py
+++ b/examples/shell.py
@@ -10,7 +10,9 @@ from typing import Text
from six import text_type as text
-from iota import Iota, __version__
+# Import all common IOTA symbols into module scope, so that the user
+# doesn't have to import anything themselves.
+from iota import *
def main(uri):
@@ -24,6 +26,7 @@ def main(uri):
)
)
+
try:
# noinspection PyUnresolvedReferences
import IPython
@@ -35,6 +38,8 @@ def main(uri):
if __name__ == '__main__':
+ from iota import __version__
+
parser = ArgumentParser(
description = __doc__,
epilog = 'PyOTA v{version}'.format(version=__version__), | Made repl script a bit more user-friendly. | iotaledger_iota.lib.py | train | py |
efa41a245c434232f265dc0950a4bd16adae73d3 | diff --git a/lib/transports/polling-xhr.js b/lib/transports/polling-xhr.js
index <HASH>..<HASH> 100644
--- a/lib/transports/polling-xhr.js
+++ b/lib/transports/polling-xhr.js
@@ -177,6 +177,7 @@ Request.prototype.create = function () {
};
this.xhr.onprogress = empty;
} else {
+ this.xhr.withCredentials = true;
this.xhr.onreadystatechange = function () {
try {
if (xhr.readyState != 4) return; | Fixed; make sure to send cookies in cross domain requests. | socketio_engine.io-client | train | js |
91b0aec9455ed24ac58f3a3e676b04a82185124c | diff --git a/lib/improv.js b/lib/improv.js
index <HASH>..<HASH> 100644
--- a/lib/improv.js
+++ b/lib/improv.js
@@ -200,7 +200,7 @@ var ImprovChart = function (chart) {
this.noteList = makeImprovNoteList(chart);
this.midi = function (filename, options) {
- return midi.output('improv', this, filename, options);
+ return midi.output('improvChart', this, filename, options);
};
this.toString = function () {
diff --git a/lib/midi.js b/lib/midi.js
index <HASH>..<HASH> 100644
--- a/lib/midi.js
+++ b/lib/midi.js
@@ -188,7 +188,7 @@ var makeChordTrack = function (chords, options) {
};
// Return MIDI buffer containing an improvisation
-var improv = function (data, options) {
+var improvChart = function (data, options) {
var header = makeHeaderChunk(1, 3);
var tempoTrack = makeTempoTrack(options);
var noteTrack = makeMelodyTrack(data.noteList, options);
@@ -222,7 +222,7 @@ module.exports.output = function (type, data, filename, options) {
};
// Map of type string to function
var types = {
- improv: improv,
+ improvChart: improvChart,
chordChart: chordChart
};
var buffer; | Changed value from `improv` to `improvChart` in midi settings to be consistent. | jsrmath_sharp11 | train | js,js |
a99b07eaa3a1d4f597b521a1ccb5437ca0083fa7 | diff --git a/lib/guard/webrick/runner.rb b/lib/guard/webrick/runner.rb
index <HASH>..<HASH> 100644
--- a/lib/guard/webrick/runner.rb
+++ b/lib/guard/webrick/runner.rb
@@ -21,6 +21,8 @@ module Guard
def stop
Process.kill("HUP", pid)
+ @pid = nil
+ true
end
end
end
diff --git a/spec/guard/webrick/runner_spec.rb b/spec/guard/webrick/runner_spec.rb
index <HASH>..<HASH> 100644
--- a/spec/guard/webrick/runner_spec.rb
+++ b/spec/guard/webrick/runner_spec.rb
@@ -38,20 +38,32 @@ describe Guard::WEBrick::Runner do
it "should kill the process running the HTTPServer" do
Process.stub(:fork).and_return(12345)
Process.should_receive(:kill).with("HUP", 12345)
- new_runner.stop
+ subject = new_runner
+ subject.stop
+ end
+
+ it "should set the pid back to nil" do
+ Process.stub(:fork).and_return(12345)
+ Process.should_receive(:kill).with("HUP", 12345)
+ subject = new_runner
+ subject.stop
+ subject.pid.should be_nil
end
it "should shutdown the WEBrick::HTTPServer instance" do
make_fake_forked_server
Signal.trap("USR1") { @css = true }
- r = new_runner
+ subject = new_runner
sleep 0.05 # wait for HTTPServer to fork and start
- r.stop
+ subject.stop
sleep 0.05 # wait to get USR1 signal from child pid
@css.should be_true
end
end
+
+ describe "restart" do
+ end
end
def new_runner(options = {}) | Set @pid to nil when server is shutdown. | fnichol_guard-webrick | train | rb,rb |
6b80235ed7e9b9ada8f6065d104d15ad174fd5a7 | diff --git a/lib/shopify_app/version.rb b/lib/shopify_app/version.rb
index <HASH>..<HASH> 100644
--- a/lib/shopify_app/version.rb
+++ b/lib/shopify_app/version.rb
@@ -1,3 +1,3 @@
module ShopifyApp
- VERSION = "2.1.0"
+ VERSION = "2.1.1"
end | Bumps version number for release of John T's
LESS compile and image route changes | Shopify_shopify_app | train | rb |
3750fe4a1f48e967a94e297ee14f053e42ec8976 | diff --git a/aeron-driver/src/main/java/uk/co/real_logic/aeron/driver/DriverConductor.java b/aeron-driver/src/main/java/uk/co/real_logic/aeron/driver/DriverConductor.java
index <HASH>..<HASH> 100644
--- a/aeron-driver/src/main/java/uk/co/real_logic/aeron/driver/DriverConductor.java
+++ b/aeron-driver/src/main/java/uk/co/real_logic/aeron/driver/DriverConductor.java
@@ -263,10 +263,9 @@ public class DriverConductor implements Agent
private void onHeartbeatCheckTimeouts()
{
- final long now = nanoClock.nanoTime();
-
toDriverCommands.consumerHeartbeatTime(epochClock.time());
+ final long now = nanoClock.nanoTime();
onCheckClients(now);
onCheckPublications(now);
onCheckPublicationLinks(now); | [Java]: Code ordering for clarity. | real-logic_aeron | train | java |
c1e5b1bf2c09e0532da205d857a4aa15389eec75 | diff --git a/pkg/serviceaccount/jwt.go b/pkg/serviceaccount/jwt.go
index <HASH>..<HASH> 100644
--- a/pkg/serviceaccount/jwt.go
+++ b/pkg/serviceaccount/jwt.go
@@ -22,7 +22,6 @@ import (
"crypto/rsa"
"encoding/base64"
"encoding/json"
- "errors"
"fmt"
"strings"
@@ -140,8 +139,6 @@ type Validator interface {
NewPrivateClaims() interface{}
}
-var errMismatchedSigningMethod = errors.New("invalid signing method")
-
func (j *jwtTokenAuthenticator) AuthenticateToken(tokenData string) (user.Info, bool, error) {
if !j.hasCorrectIssuer(tokenData) {
return nil, false, nil | Clean unused error type variable
The function which invoked this variable
was removed by
<URL> | kubernetes_kubernetes | train | go |
d588d41d1f73a4d6c883ec81995432435300e1c5 | diff --git a/aws/resource_aws_instance_test.go b/aws/resource_aws_instance_test.go
index <HASH>..<HASH> 100644
--- a/aws/resource_aws_instance_test.go
+++ b/aws/resource_aws_instance_test.go
@@ -47,7 +47,7 @@ func testSweepInstances(region string) error {
}
conn := client.(*AWSClient).ec2conn
- err = conn.DescribeInstancesPages(&ec2.DescribeInstancesInput{}, func(page *ec2.DescribeInstancesOutput, isLast bool) bool {
+ err = conn.DescribeInstancesPages(&ec2.DescribeInstancesInput{}, func(page *ec2.DescribeInstancesOutput, lastPage bool) bool {
if len(page.Reservations) == 0 {
log.Print("[DEBUG] No EC2 Instances to sweep")
return false
@@ -87,7 +87,7 @@ func testSweepInstances(region string) error {
}
}
}
- return !isLast
+ return !lastPage
})
if err != nil {
if testSweepSkipSweepError(err) { | tests/r/instance: Use consistent var name | terraform-providers_terraform-provider-aws | train | go |
4362a8611e57d69c2cf326fcd506dc1878bbe342 | diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -28,7 +28,7 @@ long_description = '\n\n'.join([read('README'),
__doc__ = long_description
-requirements = ['stringparser', 'pyvisa>=1.7', 'pyyaml']
+requirements = ['stringparser', 'pyvisa>=1.8', 'pyyaml']
setup(name='PyVISA-sim',
description='Simulated backend for PyVISA implementing TCPIP, GPIB, RS232, and USB resources', | Updated requirements to PyVISA>=<I> | pyvisa_pyvisa-sim | train | py |
fea8458443b13cb54d31daf0e20e0dcd499d714e | diff --git a/ring.go b/ring.go
index <HASH>..<HASH> 100644
--- a/ring.go
+++ b/ring.go
@@ -121,6 +121,7 @@ func (opt *RingOptions) clientOptions() *Options {
OnConnect: opt.OnConnect,
DB: opt.DB,
+ Password: opt.Password,
DialTimeout: opt.DialTimeout,
ReadTimeout: opt.ReadTimeout, | Re-added password support for AUTH purposes | go-redis_redis | train | go |
3531a605bfad9c738bf8a3660754121a2ec56258 | diff --git a/app_test.go b/app_test.go
index <HASH>..<HASH> 100644
--- a/app_test.go
+++ b/app_test.go
@@ -111,8 +111,8 @@ var _ = Describe("Companies", func() {
cfg2 := &gogadgets.Config{
Master: false,
Host: "localhost",
- SubPort: port + 1,
- PubPort: port,
+ SubPort: port,
+ PubPort: port + 1,
}
a := gogadgets.NewApp(cfg)
diff --git a/zmq.go b/zmq.go
index <HASH>..<HASH> 100644
--- a/zmq.go
+++ b/zmq.go
@@ -67,8 +67,8 @@ func NewClientSockets(cfg SocketsConfig) (*Sockets, error) {
master: false,
id: newUUID(),
host: cfg.Host,
- subPort: cfg.PubPort,
- pubPort: cfg.SubPort,
+ subPort: cfg.SubPort,
+ pubPort: cfg.PubPort,
}
return s, nil
} | trying to get zmq ports right | cswank_gogadgets | train | go,go |
77b62d86bc9dc92293db45d5568468407a58c43a | diff --git a/middleware/match.js b/middleware/match.js
index <HASH>..<HASH> 100644
--- a/middleware/match.js
+++ b/middleware/match.js
@@ -1,11 +1,14 @@
var metaRouter = require('../');
var DataHolder = require('raptor-async/DataHolder');
+var nodePath = require('path');
module.exports = function match(routes) {
var matcher;
var matcherDataHolder;
if (typeof routes === 'string') {
+ routes = nodePath.resolve(process.cwd(), routes);
+
matcherDataHolder = new DataHolder();
metaRouter.routesLoader.load(routes, function(err, routes) {
if (err) { | Resolve all paths to CWD | patrick-steele-idem_meta-router | train | js |
8803bed7359d063773b047a5f8b92a626d7652f4 | diff --git a/DrdPlus/Tables/Armaments/Armourer.php b/DrdPlus/Tables/Armaments/Armourer.php
index <HASH>..<HASH> 100644
--- a/DrdPlus/Tables/Armaments/Armourer.php
+++ b/DrdPlus/Tables/Armaments/Armourer.php
@@ -118,6 +118,21 @@ class Armourer extends StrictObject
* @param ArmorCode $armorCode
* @param int $bodySize
* @param int $currentStrength
+ * @return bool
+ * @throws \Granam\Integer\Tools\Exceptions\WrongParameterType
+ * @throws \Granam\Integer\Tools\Exceptions\ValueLostOnCast
+ */
+ public function canUseArmor(ArmorCode $armorCode, $bodySize, $currentStrength)
+ {
+ $missingStrength = $this->getMissingStrengthForArmor($armorCode, $bodySize, $currentStrength);
+
+ return $this->tables->getArmorSanctionsTable()->canMove($missingStrength);
+ }
+
+ /**
+ * @param ArmorCode $armorCode
+ * @param int $bodySize
+ * @param int $currentStrength
* @return int
* @throws CanNotUseArmorBecauseOfMissingStrength
* @throws \Granam\Integer\Tools\Exceptions\WrongParameterType | Armourer can tell if armor can be used | drdplusinfo_tables | train | php |
d31e17676a1d6fa661c17a3094f0b5dd7536da56 | diff --git a/client/html/src/Client/Html/Catalog/Count/Tree/Standard.php b/client/html/src/Client/Html/Catalog/Count/Tree/Standard.php
index <HASH>..<HASH> 100644
--- a/client/html/src/Client/Html/Catalog/Count/Tree/Standard.php
+++ b/client/html/src/Client/Html/Catalog/Count/Tree/Standard.php
@@ -254,7 +254,7 @@ class Standard
$view->treeCountList = $cntl->aggregate( 'index.catalog.id' );
if( $level === \Aimeos\MW\Tree\Manager\Base::LEVEL_TREE ) {
- $view->treeCountList = $this->counts( $this->traverse( $tree, $view->treeCountList ) );
+ $view->treeCountList = $this->counts( $this->traverse( $tree, $view->treeCountList->toArray() ) );
}
} | Adapt to changed aggregate() method signature | aimeos_ai-client-html | train | php |
cd476d9e950b3d7b1c89213e6dd68307c396c82c | diff --git a/schema.go b/schema.go
index <HASH>..<HASH> 100644
--- a/schema.go
+++ b/schema.go
@@ -158,6 +158,12 @@ func (s *Schema) applyParentSchema() {
v.applyParentSchema()
}
+ if props := s.AdditionalProperties; props != nil {
+ if sc := props.Schema; sc != nil {
+ sc.setParent(s)
+ sc.applyParentSchema()
+ }
+ }
if items := s.AdditionalItems; items != nil {
if sc := items.Schema; sc != nil {
sc.setParent(s)
@@ -1031,7 +1037,14 @@ func validate(rv reflect.Value, def *Schema) (err error) {
}
func (s Schema) Scope() string {
+ if pdebug.Enabled {
+ g := pdebug.IPrintf("START Schema.Scope")
+ defer g.IRelease("END Schema.Scope")
+ }
if s.id != "" || s.parent == nil {
+ if pdebug.Enabled {
+ pdebug.Printf("Returning id '%s'", s.id)
+ }
return s.id
} | Don't forget to apply parent to AdditionalProperties | lestrrat-go_jsschema | train | go |
fd7a8290791a59aa954923ae72acfbac5d2a7df1 | diff --git a/lib/less/parser.js b/lib/less/parser.js
index <HASH>..<HASH> 100644
--- a/lib/less/parser.js
+++ b/lib/less/parser.js
@@ -1068,7 +1068,7 @@ less.Parser = function Parser(env) {
save();
if (env.dumpLineNumbers) {
- sourceLineNumber = getLocation(i, input).line;
+ sourceLineNumber = getLocation(i, input).line + 1;
sourceFileName = getFileName(env);
} | getLocation() seems to return lines starting at 0, therefore we have to add 1.
This fixes the off-by-one bug,
and is consistent with what is done at line <I> in 'parser.js'. | less_less.js | train | js |
09219154d358c59595d7791d0dba679143451d83 | diff --git a/html/pfappserver/root/static.alt/src/utils/network.js b/html/pfappserver/root/static.alt/src/utils/network.js
index <HASH>..<HASH> 100644
--- a/html/pfappserver/root/static.alt/src/utils/network.js
+++ b/html/pfappserver/root/static.alt/src/utils/network.js
@@ -42,14 +42,9 @@ const network = {
return subnet.join('.')
},
ipv4Sort (a, b) {
- if (!!a && !b)
- return 1
- else if (!a && !!b)
- return -1
- else if (!a && !b)
- return 0
- const aa = a.split(".")
- const bb = b.split(".")
+ if (!!a && !b) { return 1 } else if (!a && !!b) { return -1 } else if (!a && !b) { return 0 }
+ const aa = a.split('.')
+ const bb = b.split('.')
var resulta = aa[0] * 0x1000000 + aa[1] * 0x10000 + aa[2] * 0x100 + aa[3] * 1
var resultb = bb[0] * 0x1000000 + bb[1] * 0x10000 + bb[2] * 0x100 + bb[3] * 1
return (resulta === resultb) ? 0 : ((resulta > resultb) ? 1 : -1) | (web admin) Improve formatting of network.js | inverse-inc_packetfence | train | js |
9294f37187b8a60b925e48fe54a5576e56672baa | diff --git a/library/Public.php b/library/Public.php
index <HASH>..<HASH> 100644
--- a/library/Public.php
+++ b/library/Public.php
@@ -172,3 +172,25 @@ if (!function_exists('municipio_get_author_full_name')) {
return get_user_meta($author, 'nicename', true);
}
}
+
+if (!function_exists('municipio_post_taxonomies_to_display')) {
+ /**
+ * Gets "public" (set via theme options) taxonomies and terms for a specific post
+ * @param int $postId The id of the post
+ * @return array Taxs and terms
+ */
+ function municipio_post_taxonomies_to_display(int $postId) : array
+ {
+ $taxonomies = array();
+ $post = get_post($postId);
+ $taxonomiesToShow = get_field('archive_' . sanitize_title($post->post_type) . '_post_taxonomy_display', 'option');
+
+ foreach ($taxonomiesToShow as $taxonomy) {
+ $taxonomies[$taxonomy] = wp_get_post_terms($postId, $taxonomy);
+ }
+
+ $taxonomies = array_filter($taxonomies);
+
+ return $taxonomies;
+ }
+} | Public function to get "public" taxs and terms for a post | helsingborg-stad_Municipio | train | php |
da06b790d811d263b96a12de2d5d089e342626c7 | diff --git a/sendgrid-ruby.gemspec b/sendgrid-ruby.gemspec
index <HASH>..<HASH> 100644
--- a/sendgrid-ruby.gemspec
+++ b/sendgrid-ruby.gemspec
@@ -28,4 +28,5 @@ Gem::Specification.new do |spec|
spec.add_development_dependency 'rubocop'
spec.add_development_dependency 'minitest', '~> 5.9'
spec.add_development_dependency 'rack'
+ spec.add_development_dependency 'simplecov'
end
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
@@ -1,3 +1,5 @@
+require 'simplecov'
+SimpleCov.start
require 'rubygems'
require 'bundler/setup'
require 'pry'
diff --git a/test/sendgrid/test_sendgrid-ruby.rb b/test/sendgrid/test_sendgrid-ruby.rb
index <HASH>..<HASH> 100644
--- a/test/sendgrid/test_sendgrid-ruby.rb
+++ b/test/sendgrid/test_sendgrid-ruby.rb
@@ -1,3 +1,5 @@
+require 'simplecov'
+SimpleCov.start
require_relative '../../lib/sendgrid-ruby.rb'
require 'ruby_http_client'
require 'minitest/autorun' | test: add Simplecov Local Enhancements (#<I>)
As a contributor, I'd like to know what baseline code coverage is and how my enhancements affect it.
It was actually fairly difficult to find a good location to insert the SimpleCov.start and keep the results consistent. But after several hours, the final state of this PR seems to be the best.
No documentation was updated because code coverage is now part of the default rake run, with no further action required. | sendgrid_sendgrid-ruby | train | gemspec,rb,rb |
e270ae83d1f68837781149b170f4e04808cf83df | diff --git a/tools/src/main/java/com/orientechnologies/orient/console/OConsoleDatabaseApp.java b/tools/src/main/java/com/orientechnologies/orient/console/OConsoleDatabaseApp.java
index <HASH>..<HASH> 100644
--- a/tools/src/main/java/com/orientechnologies/orient/console/OConsoleDatabaseApp.java
+++ b/tools/src/main/java/com/orientechnologies/orient/console/OConsoleDatabaseApp.java
@@ -711,6 +711,8 @@ public class OConsoleDatabaseApp extends OrientConsole implements OCommandOutput
out.println();
out.println("Class................: " + cls);
+ if (cls.getShortName() != null)
+ out.println("Alias................: " + cls.getShortName());
if (cls.getSuperClass() != null)
out.println("Super class..........: " + cls.getSuperClass());
out.println("Default cluster......: " + currentDatabase.getClusterNameById(cls.getDefaultClusterId()) + " (id=" | Concole: printed class short name as "alias" in command "info class" | orientechnologies_orientdb | train | java |
a537034898ad0161695290bd6434ca9cb27dcca8 | diff --git a/ananas/ananas.py b/ananas/ananas.py
index <HASH>..<HASH> 100644
--- a/ananas/ananas.py
+++ b/ananas/ananas.py
@@ -208,7 +208,8 @@ class PineappleBot(StreamListener):
self._bot.log("config", "Section {} not in {}, aborting.".format(self._name, self._filename))
return False
self._bot.log("config", "Loading configuration from {}".format(self._filename))
- self.update(self._cfg["DEFAULT"])
+ if "DEFAULT" in self._cfg.sections:
+ self.update(self._cfg["DEFAULT"])
self.update(self._cfg[self._name])
return True | Allow DEFAULT section to be absent | chr-1x_ananas | train | py |
6548ce256207fe08820cf20ef21b400541e249a1 | diff --git a/salt/modules/file.py b/salt/modules/file.py
index <HASH>..<HASH> 100644
--- a/salt/modules/file.py
+++ b/salt/modules/file.py
@@ -3319,7 +3319,11 @@ def makedirs_(path,
'''
# walk up the directory structure until we find the first existing
# directory
- dirname = os.path.abspath(path)
+ path = path.rstrip()
+ trailing_slash = path.endswith('/')
+ if not trailing_slash:
+ path = path + '/'
+ dirname = os.path.normpath(os.path.dirname(path))
if os.path.isdir(dirname):
# There's nothing for us to do | Appending trailing slash if not present | saltstack_salt | train | py |
90a795cb530725547130dd706f8084af675376ee | diff --git a/eventsourcing/__init__.py b/eventsourcing/__init__.py
index <HASH>..<HASH> 100644
--- a/eventsourcing/__init__.py
+++ b/eventsourcing/__init__.py
@@ -1 +1 @@
-__version__ = "7.2.4dev0"
+__version__ = "7.2.4rc0" | Increased version number to <I>rc0. | johnbywater_eventsourcing | train | py |
a667e6235dc22169ffbbe0d6dcce664549de2910 | diff --git a/numerapi/numerapi.py b/numerapi/numerapi.py
index <HASH>..<HASH> 100644
--- a/numerapi/numerapi.py
+++ b/numerapi/numerapi.py
@@ -91,6 +91,7 @@ class NumerAPI(object):
return (None, r.status_code)
rj = r.json()
+ print rj
results = rj['submissions']['results']
scores = np.zeros(len(results))
for i in range(len(results)):
@@ -109,8 +110,8 @@ class NumerAPI(object):
sid = user['submission_id']
val_logloss = np.float(user['logloss']['validation'])
val_consistency = np.float(user['logloss']['consistency'])
- career_usd = np.float(user['earnings']['career']['usd'])
- career_nmr = np.float(user['earnings']['career']['nmr'])
+ career_usd = np.float(user['earnings']['career']['usd'].replace(',',''))
+ career_nmr = np.float(user['earnings']['career']['nmr'].replace(',',''))
concordant = user['concordant']
original = user['original']
return (uname, sid, val_logloss, val_consistency, original, concordant, career_usd, career_nmr, status_code) | strip comma from career earnings strings. | uuazed_numerapi | train | py |
c1e5dba9c39af47e5dd13f4f98a08af88c131771 | diff --git a/src/toil/jobStores/aws/utils.py b/src/toil/jobStores/aws/utils.py
index <HASH>..<HASH> 100644
--- a/src/toil/jobStores/aws/utils.py
+++ b/src/toil/jobStores/aws/utils.py
@@ -346,7 +346,7 @@ def connection_reset(e):
def sdb_unavailable(e):
- return isinstance(e, BotoServerError) and e.status == 503
+ return isinstance(e, BotoServerError) and e.status in (500, 503)
def no_such_sdb_domain(e): | Add <I> status to the list of retriable SDB BotoServerErrors. (#<I>) | DataBiosphere_toil | train | py |
5936b4ad5c4e18be9a5b40be6c18a873a027335f | diff --git a/lib/node/attributes.rb b/lib/node/attributes.rb
index <HASH>..<HASH> 100644
--- a/lib/node/attributes.rb
+++ b/lib/node/attributes.rb
@@ -42,7 +42,7 @@ module Bcome::Node::Attributes
instance_data = instance_variable_defined?(instance_var_name) ? instance_variable_get(instance_var_name) : {}
instance_data = {} unless instance_data
if parent.instance_variable_defined?(instance_var_name)
- parent_intance_data = parent.send(parent_key)
+ parent_instance_data = parent.send(parent_key)
else
parent_instance_data = {}
end | Fixed bug in recursing network data | webzakimbo_bcome-kontrol | train | rb |
8fb0e63a5553346cd30fd4060858d1e727cef74f | diff --git a/packages/modal/src/presenters/ModalPresenter.js b/packages/modal/src/presenters/ModalPresenter.js
index <HASH>..<HASH> 100644
--- a/packages/modal/src/presenters/ModalPresenter.js
+++ b/packages/modal/src/presenters/ModalPresenter.js
@@ -7,6 +7,11 @@ import { types } from "../types";
import "./ModalPresenter.scss";
export default class ModalPresenter extends Component {
+ static modifiersByType = {
+ [types.STANDARD]: "hig__modal-V1__window--standard",
+ [types.ALTERNATE]: "hig__modal-V1__window--alternate"
+ };
+
static propTypes = {
/**
* Supports adding any dom content to the body of the modal
@@ -68,10 +73,10 @@ export default class ModalPresenter extends Component {
type
} = this.props;
- const windowClasses = cx([
+ const windowClasses = cx(
"hig__modal-V1__window",
- `hig__modal-V1__window--${type}`
- ]);
+ ModalPresenter.modifiersByType[type]
+ );
const wrapperClasses = cx([
"hig__modal-V1", | refactor: Use dictionary for variant style modifiers | Autodesk_hig | train | js |
2429c8adf7f88f7a10220a5d6df36fa374599df5 | diff --git a/src/Rendering/Name/Name.php b/src/Rendering/Name/Name.php
index <HASH>..<HASH> 100644
--- a/src/Rendering/Name/Name.php
+++ b/src/Rendering/Name/Name.php
@@ -584,7 +584,7 @@ class Name implements HasParent
$text = !empty($given) ? $given . " " . $family : $family;
}
} else {
- $text = $this->form === "long" ? $data->family.$data->given : $data->family;
+ $text = $this->form === "long" ? $data->family . " " . $data->given : $data->family;
}
return $text; | fix issues with no whitespace between given and family names of authors and editors | seboettg_citeproc-php | train | php |
958d7ccb06e49139f3bf720ff3f1bd9dbe33caa9 | diff --git a/tests/TestServer/PhpUnitStartServerListener.php b/tests/TestServer/PhpUnitStartServerListener.php
index <HASH>..<HASH> 100644
--- a/tests/TestServer/PhpUnitStartServerListener.php
+++ b/tests/TestServer/PhpUnitStartServerListener.php
@@ -46,28 +46,19 @@ final class PhpUnitStartServerListener implements TestListener
*/
public function startTestSuite(TestSuite $suite): void
{
- if ($suite->getName() !== $this->suiteName) {
- return;
- }
-
- $process = new Process(
- [
- 'php',
- '-S',
- $this->socket,
- $this->documentRoot
- ]
- );
- $process->start();
+ if ($suite->getName() === $this->suiteName) {
+ $process = new Process(
+ [
+ 'php',
+ '-S',
+ $this->socket,
+ $this->documentRoot
+ ]
+ );
+ $process->start();
- $process->waitUntil(
- function (string $type, string $output) {
- if ($type === Process::ERR) {
- throw new \RuntimeException($output);
- }
-
- return true;
- }
- );
+ // Wait for the server.
+ sleep(1);
+ }
}
} | Revert Wait for the web server to run in the test
This reverts commit <I>a<I>b<I>d3d9f<I>e<I>e<I>f4b<I>bb5c3acd2f.
Reason is that the tests at travis ci fail
and the change is not so urgent. | marein_php-nchan-client | train | php |
a2fcce7e625e9d8962c4a41c269be85477bedc5d | diff --git a/saltapi/netapi/rest_cherrypy/app.py b/saltapi/netapi/rest_cherrypy/app.py
index <HASH>..<HASH> 100644
--- a/saltapi/netapi/rest_cherrypy/app.py
+++ b/saltapi/netapi/rest_cherrypy/app.py
@@ -1414,10 +1414,10 @@ class API(object):
'tools.trailing_slash.on': True,
'tools.gzip.on': True,
+ 'tools.cpstats.on': self.apiopts.get('collect_stats', False),
},
'/stats': {
'request.dispatch': cherrypy.dispatch.Dispatcher(),
- 'tools.cpstats.on': self.apiopts.get('collect_stats', False),
},
} | tools.cpstats.on needs to be placed under root | saltstack_salt | train | py |
5fece517fa7910be3a5fbf127c5b02ac7d861640 | diff --git a/processing/src/main/java/io/druid/jackson/JacksonModule.java b/processing/src/main/java/io/druid/jackson/JacksonModule.java
index <HASH>..<HASH> 100644
--- a/processing/src/main/java/io/druid/jackson/JacksonModule.java
+++ b/processing/src/main/java/io/druid/jackson/JacksonModule.java
@@ -21,6 +21,7 @@ package io.druid.jackson;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.dataformat.smile.SmileFactory;
+import com.fasterxml.jackson.dataformat.smile.SmileGenerator;
import com.google.inject.Binder;
import com.google.inject.Key;
import com.google.inject.Module;
@@ -49,6 +50,7 @@ public class JacksonModule implements Module
public ObjectMapper smileMapper()
{
final SmileFactory smileFactory = new SmileFactory();
+ smileFactory.configure(SmileGenerator.Feature.ENCODE_BINARY_AS_7BIT, false);
smileFactory.delegateToTextual(true);
final ObjectMapper retVal = new DefaultObjectMapper(smileFactory);
retVal.getFactory().setCodec(retVal); | write byte data as is in smile | apache_incubator-druid | train | java |
bf14a8d3ed08167a6f23a274ea885b83b0dc8576 | diff --git a/src/index.js b/src/index.js
index <HASH>..<HASH> 100644
--- a/src/index.js
+++ b/src/index.js
@@ -89,6 +89,7 @@ class SWPrecacheWebpackPlugin {
importScripts,
staticFileGlobsIgnorePatterns,
mergeStaticsConfig,
+ stripPrefixMulti = {},
} = this.options;
// get the output path used by webpack
@@ -110,13 +111,9 @@ class SWPrecacheWebpackPlugin {
(!staticFileGlobsIgnorePatterns.some((regex) => regex.test(text)))
);
- const stripPrefixMulti = {
- ...this.options.stripPrefixMulti,
- };
-
if (outputPath) {
- // strip the webpack config's output.path
- stripPrefixMulti[`${outputPath}${path.sep}`] = publicPath;
+ // strip the webpack config's output.path (replace for windows users)
+ stripPrefixMulti[`${outputPath}${path.sep}`.replace(/\\/g, '/')] = publicPath;
}
this.config = { | Add strip prefix multi windows support (#<I>)
Add strip prefix multi windows support (fixes #<I>) | goldhand_sw-precache-webpack-plugin | train | js |
3baef57f3572652c9ff0753505166e9baafb84fd | diff --git a/py/nupic/algorithms/CLAClassifier.py b/py/nupic/algorithms/CLAClassifier.py
index <HASH>..<HASH> 100644
--- a/py/nupic/algorithms/CLAClassifier.py
+++ b/py/nupic/algorithms/CLAClassifier.py
@@ -197,7 +197,7 @@ class BitHistory(object):
assert isinstance(stats, dict)
maxBucket = max(stats.iterkeys())
self._stats = array.array("f", itertools.repeat(0.0, maxBucket+1))
- for index, value in stats.iteritems():
+ for (index, value) in stats.iteritems():
self._stats[index] = value
elif version == 1:
state.pop("_updateDutyCycles", None)
@@ -497,7 +497,7 @@ class CLAClassifier(object):
# Plug in the iteration number in the old patternNZHistory to make it
# compatible with the new format
historyLen = len(self._patternNZHistory)
- for i, pattern in enumerate(self._patternNZHistory):
+ for (i, pattern) in enumerate(self._patternNZHistory):
self._patternNZHistory[i] = (self._learnIteration-(historyLen-i),
pattern) | Consistent use of parens in for loops that iterator over tuples | numenta_nupic | train | py |
fe5501ccf159d67d4635b31bd44ce6071467ec88 | diff --git a/lib/travis/model/build.rb b/lib/travis/model/build.rb
index <HASH>..<HASH> 100644
--- a/lib/travis/model/build.rb
+++ b/lib/travis/model/build.rb
@@ -76,7 +76,11 @@ class Build < ActiveRecord::Base
end
def on_branch(branch)
- pushes.where(branch.present? ? ['branch IN (?)', normalize_to_array(branch)] : [])
+ if Build.column_names.include?('branch')
+ pushes.where(branch.present? ? ['branch IN (?)', normalize_to_array(branch)] : [])
+ else
+ pushes.joins(:commit).where(branch.present? ? ['commits.branch IN (?)', normalize_to_array(branch)] : [])
+ end
end
def by_event_type(event_type) | Make on_branch method backwards compatible | travis-ci_travis-core | train | rb |
ffb760ccc5ed6d71f9669847d2b2103c0bac99b1 | diff --git a/lib/user.js b/lib/user.js
index <HASH>..<HASH> 100644
--- a/lib/user.js
+++ b/lib/user.js
@@ -106,7 +106,14 @@ module.exports = {
denyTracking: function(){
refs.userMeta.child('trackOk').set( false );
},
+
+ /*
+ * Group Support
+ */
setGroup: function(key, devices) {
+ if (devices === null) { // Just create group without any device.
+ refs.userGroups.child(key).set(false);
+ }
refs.userGroups.child(key).set(devices);
},
deleteGroup: function(key) { | ability to create a group without devices. | matrix-io_matrix-firebase | train | js |
70b4bfff49a5f678cec28d854d5495af82591aff | diff --git a/webpack/webpack.config.development.babel.js b/webpack/webpack.config.development.babel.js
index <HASH>..<HASH> 100644
--- a/webpack/webpack.config.development.babel.js
+++ b/webpack/webpack.config.development.babel.js
@@ -17,7 +17,6 @@ module.exports = {
devServer: {
hot: true,
hotOnly: true,
- noInfo: true,
port: PORT,
publicPath: `http://localhost:${PORT}/`
}, | Show build info in console (#<I>) | getinsomnia_insomnia | train | js |
79d2c344f9ee9945b09434b35cbe63a3816410ad | diff --git a/src/calendar/index.js b/src/calendar/index.js
index <HASH>..<HASH> 100644
--- a/src/calendar/index.js
+++ b/src/calendar/index.js
@@ -281,9 +281,11 @@ export default createComponent({
},
onConfirm() {
- if (this.checkRange()) {
- this.$emit('confirm', this.currentDate);
+ if (this.range && !this.checkRange()) {
+ return;
}
+
+ this.$emit('confirm', this.currentDate);
},
genMonth(date, index) { | fix(Calendar): should not check range in single mode | youzan_vant | train | js |
20ce6640688ade1398f15f1ebca299859d497c8b | diff --git a/src/ol/map.js b/src/ol/map.js
index <HASH>..<HASH> 100644
--- a/src/ol/map.js
+++ b/src/ol/map.js
@@ -265,8 +265,7 @@ ol.Map = function(options) {
goog.events.EventType.TOUCHSTART,
goog.events.EventType.MSPOINTERDOWN,
ol.MapBrowserEvent.EventType.POINTERDOWN,
- // see https://github.com/google/closure-library/pull/308
- goog.userAgent.GECKO ? 'DOMMouseScroll' : 'mousewheel'
+ goog.events.EventType.MOUSEWHEEL
], goog.events.Event.stopPropagation);
goog.dom.appendChild(this.viewport_, this.overlayContainerStopEvent_); | Remove mousewheel event name workaround
Fixed upstream <URL> | openlayers_openlayers | train | js |
cc5e17e61fd31e005eb13f08aec453780ee02dc5 | diff --git a/salt/modules/win_update.py b/salt/modules/win_update.py
index <HASH>..<HASH> 100644
--- a/salt/modules/win_update.py
+++ b/salt/modules/win_update.py
@@ -295,7 +295,7 @@ class PyWinUpdater(object):
if update.InstallationBehavior.CanRequestUserInput:
log.debug('Skipped update {0}'.format(str(update)))
continue
- updates.append(str(update))
+ updates.append(salt.utils.sdecode(update))
log.debug('added update {0}'.format(str(update)))
return updates | attempt to decode win update package
Fixes #<I>. | saltstack_salt | train | py |
175148b1d963e82cdeebfbb4a3f8c70e63f6b73f | diff --git a/railties/lib/rails/generators/rails/app/templates/config/initializers/cookies_serializer.rb b/railties/lib/rails/generators/rails/app/templates/config/initializers/cookies_serializer.rb
index <HASH>..<HASH> 100644
--- a/railties/lib/rails/generators/rails/app/templates/config/initializers/cookies_serializer.rb
+++ b/railties/lib/rails/generators/rails/app/templates/config/initializers/cookies_serializer.rb
@@ -1,4 +1,3 @@
# Be sure to restart your server when you modify this file.
-# This is a new Rails 5.0 default, so introduced as a config to ensure apps made with earlier versions of Rails aren't affected when upgrading.
Rails.application.config.action_dispatch.cookies_serializer = :json | initializers/cookies_serializer is not new to <I>
[ci skip]
The initializer has existed since <I>, for instance see:
<URL> | rails_rails | train | rb |
f4e660cb382184a1fef49f9217c9538be1dd0cc5 | diff --git a/src/footer.php b/src/footer.php
index <HASH>..<HASH> 100755
--- a/src/footer.php
+++ b/src/footer.php
@@ -1,5 +1,5 @@
<footer>
-<p class="credit">site by <a href="http://www.factor1studios.com" target="_blank">factor1</a></p>
+
</footer>
<?php wp_footer(); ?> | Removes factor1 credit from footer | factor1_prelude-wp | train | php |
01c059be0fb1333d04626b2f0851874a6191e258 | diff --git a/test.js b/test.js
index <HASH>..<HASH> 100644
--- a/test.js
+++ b/test.js
@@ -26,6 +26,7 @@ test('get username using NSProcessInfo, convert to javascript string and compare
t.is(String(username), os.userInfo().username);
});
+/* This one fails 100% reprodicible w/ "Misaligned pointer"
test('primitive argument types', t => {
const NSNumber = objc.NSNumber;
@@ -33,3 +34,4 @@ test('primitive argument types', t => {
t.is(Number(number), 5);
});
+*/ | disable the misaligned pointer test | lukaskollmer_objc | train | js |
aa60af3fa03657d9e7271c24c8178d11faa2cae6 | diff --git a/js/base/Exchange.js b/js/base/Exchange.js
index <HASH>..<HASH> 100644
--- a/js/base/Exchange.js
+++ b/js/base/Exchange.js
@@ -1045,7 +1045,7 @@ module.exports = class Exchange {
return array
}
- filterByValueSinceLimit (array, field, value = undefined, since = undefined, limit = undefined, key = 'timestamp') {
+ filterByValueSinceLimit (array, field, value = undefined, since = undefined, limit = undefined, key = 'timestamp', tail = false) {
const valueIsDefined = value !== undefined && value !== null
const sinceIsDefined = since !== undefined && since !== null
@@ -1058,7 +1058,9 @@ module.exports = class Exchange {
}
if (limit !== undefined && limit !== null) {
- array = Object.values (array).slice (0, limit)
+ array = ((tail && !sinceIsDefined) ?
+ Object.values (array).slice (-limit) :
+ Object.values (array).slice (0, limit))
}
return array | Exchange.js filterBySinceLimit with tail fix #<I> | ccxt_ccxt | train | js |
d7c30e0822a8453e6396eae1976263ea74ac20e9 | diff --git a/packages/wpcom.js/test/util.js b/packages/wpcom.js/test/util.js
index <HASH>..<HASH> 100644
--- a/packages/wpcom.js/test/util.js
+++ b/packages/wpcom.js/test/util.js
@@ -5,6 +5,7 @@
var test = require('./data');
var WPCOM = require('../');
+var fs = require('fs');
/**
* `Util` module
@@ -61,7 +62,7 @@ Util.addPost = function(fn){
Util.addMedia = function(fn){
var site = Util.private_site();
- site.addMediaFiles(test.new_media_data.files[0], fn);
+ site.addMediaFiles(fs.createReadStream(test.new_media_data.files[0]), fn);
};
/** | test: fix add media before the test start | Automattic_wp-calypso | train | js |
9769092ee0980fc78cf69d0c2cac067e0807c080 | diff --git a/core/src/main/java/hudson/ProxyConfiguration.java b/core/src/main/java/hudson/ProxyConfiguration.java
index <HASH>..<HASH> 100644
--- a/core/src/main/java/hudson/ProxyConfiguration.java
+++ b/core/src/main/java/hudson/ProxyConfiguration.java
@@ -396,7 +396,7 @@ public final class ProxyConfiguration extends AbstractDescribableImpl<ProxyConfi
GetMethod method = null;
try {
method = new GetMethod(testUrl);
- method.getParams().setParameter("http.socket.timeout", DEFAULT_CONNECT_TIMEOUT_MILLIS > 0 ? DEFAULT_CONNECT_TIMEOUT_MILLIS : TimeUnit.SECONDS.toMillis(30));
+ method.getParams().setParameter("http.socket.timeout", DEFAULT_CONNECT_TIMEOUT_MILLIS > 0 ? DEFAULT_CONNECT_TIMEOUT_MILLIS : (int)TimeUnit.SECONDS.toMillis(30));
HttpClient client = new HttpClient();
if (Util.fixEmptyAndTrim(name) != null && !isNoProxyHost(host, noProxyHost)) { | [JENKINS-<I>] add missing cast (#<I>) | jenkinsci_jenkins | train | java |
90f29405ba4e26f46e0caf21967663233691547f | diff --git a/GPy/kern/src/static.py b/GPy/kern/src/static.py
index <HASH>..<HASH> 100644
--- a/GPy/kern/src/static.py
+++ b/GPy/kern/src/static.py
@@ -104,7 +104,7 @@ class WhiteHeteroscedastic(Static):
return 0.
def K(self, X, X2=None):
- if X2 is None:
+ if X2 is None and X.shape[0]==self.variance.shape[0]:
return np.eye(X.shape[0])*self.variance
else:
return np.zeros((X.shape[0], X2.shape[0])) | [white hetero] additional check for prediction | SheffieldML_GPy | train | py |
a349b90ea6016ec8fbe91583f2bbd9832b41a368 | diff --git a/gitlab/__init__.py b/gitlab/__init__.py
index <HASH>..<HASH> 100644
--- a/gitlab/__init__.py
+++ b/gitlab/__init__.py
@@ -779,10 +779,7 @@ class GitlabList(object):
self._gl = gl
# Preserve kwargs for subsequent queries
- if kwargs is None:
- self._kwargs = {}
- else:
- self._kwargs = kwargs.copy()
+ self._kwargs = kwargs.copy()
self._query(url, query_data, **self._kwargs)
self._get_next = get_next | fix: do not check if kwargs is none | python-gitlab_python-gitlab | train | py |
1096e0434326a36dd34fb89436e1743a0599d676 | diff --git a/helpers/api.py b/helpers/api.py
index <HASH>..<HASH> 100644
--- a/helpers/api.py
+++ b/helpers/api.py
@@ -65,6 +65,6 @@ class RestApiServer(HTTPServer, Thread):
self.daemon = True
def cursor(self):
- if not self._cursor_holder or self._cursor_holder.closed != 0:
+ if not self._cursor_holder or self._cursor_holder.closed:
self._cursor_holder = self.governor.postgresql.connection().cursor()
return self._cursor_holder | Bigfix, cursor.closed contains boolean value | zalando_patroni | train | py |
5486073e2b5198503286ad68403bf4685a68a01d | diff --git a/theanets/layers/recurrent.py b/theanets/layers/recurrent.py
index <HASH>..<HASH> 100644
--- a/theanets/layers/recurrent.py
+++ b/theanets/layers/recurrent.py
@@ -1012,13 +1012,13 @@ class MUT1(Recurrent):
class SCRN(Recurrent):
- r'''Simple Contextual Recurrent Network layer.
+ r'''Structurally Constrained Recurrent Network layer.
Notes
-----
- A Simple Contextual Recurrent Network incorporates an explicitly slow-moving
- hidden context layer with a simple recurrent network.
+ A Structurally Constrained Recurrent Network incorporates an explicitly
+ slow-moving hidden context layer with a simple recurrent network.
The update equations in this layer are largely those given by [Mik15]_,
pages 4 and 5, but this implementation adds a bias term for the output of
@@ -1087,7 +1087,6 @@ class SCRN(Recurrent):
self.add_weights('ho', self.size, self.size)
self.add_weights('so', self.size, self.size)
self.add_bias('b', self.size)
-
if self.rate == 'vector':
self.add_bias('r', self.size) | Fix name of SCRN ("simple" -> "structural" &c). | lmjohns3_theanets | train | py |
d4e5440fb8b4e64bf17f82b4a5abc5b3c5635983 | diff --git a/parser/parser_test.go b/parser/parser_test.go
index <HASH>..<HASH> 100644
--- a/parser/parser_test.go
+++ b/parser/parser_test.go
@@ -499,6 +499,10 @@ var shellTests = []struct {
`1:1: reached EOF without matching $(( with ))`,
},
{
+ `$((& 0 $(`,
+ `1:1: reached EOF without matching $(( with ))`,
+ },
+ {
`$((a'`,
`1:1: reached EOF without matching $(( with ))`,
},
diff --git a/parser/tokenizer.go b/parser/tokenizer.go
index <HASH>..<HASH> 100644
--- a/parser/tokenizer.go
+++ b/parser/tokenizer.go
@@ -46,6 +46,7 @@ func (p *parser) next() {
}
if p.npos >= len(p.src) {
p.errPass(io.EOF)
+ p.tok = token.EOF
return
}
b := p.src[p.npos] | parser: avoid another $(( ambiguity hang
We have to force tok = EOF because our error logic is not working
properly. Leave this in until we fix it in a cleaner way. | mvdan_sh | train | go,go |
cfa90d4c89ca358b23ae6a0bf69c2007cb141201 | diff --git a/src/pixi/core/Circle.js b/src/pixi/core/Circle.js
index <HASH>..<HASH> 100644
--- a/src/pixi/core/Circle.js
+++ b/src/pixi/core/Circle.js
@@ -69,5 +69,6 @@ PIXI.Circle.prototype.contains = function(x, y)
return (dx + dy <= r2);
}
+// constructor
PIXI.Circle.prototype.constructor = PIXI.Circle; | [DOC] Small changes
* add comment for constructor assignment (as in Point, Rectangle ...) | drkibitz_node-pixi | train | js |
8e705ecd9dc79f14dc60e175d0f59423858c67b9 | diff --git a/libraries/common/streams/main.js b/libraries/common/streams/main.js
index <HASH>..<HASH> 100644
--- a/libraries/common/streams/main.js
+++ b/libraries/common/streams/main.js
@@ -4,6 +4,7 @@ import 'rxjs/add/operator/filter';
import 'rxjs/add/operator/first';
import 'rxjs/add/operator/map';
import 'rxjs/add/operator/merge';
+import 'rxjs/add/operator/mergeMap';
import 'rxjs/add/operator/delay';
import 'rxjs/add/operator/zip';
import 'rxjs/add/operator/do'; | PWA-<I>: Added rxjs operator `mergeMap` to the main stream. | shopgate_pwa | train | js |
107eb2f854692bd1ad466596f62b21fcc3fc735c | diff --git a/typescript-generator-core/src/test/java/cz/habarta/typescript/generator/ImmutablesTest.java b/typescript-generator-core/src/test/java/cz/habarta/typescript/generator/ImmutablesTest.java
index <HASH>..<HASH> 100644
--- a/typescript-generator-core/src/test/java/cz/habarta/typescript/generator/ImmutablesTest.java
+++ b/typescript-generator-core/src/test/java/cz/habarta/typescript/generator/ImmutablesTest.java
@@ -1,6 +1,7 @@
package cz.habarta.typescript.generator;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.annotation.JsonSubTypes;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
@@ -59,6 +60,7 @@ public class ImmutablesTest {
@Value.Immutable
@JsonSerialize(as = ImmutableRectangle.class)
+ @JsonPropertyOrder({"width", "height"})
@JsonDeserialize(as = ImmutableRectangle.class)
public static abstract class Rectangle implements Shape {
public abstract double width(); | flaky test is fixed by adding JsonPropertyOrder (#<I>) | vojtechhabarta_typescript-generator | train | java |
97683aa5c6825f9e2ad90de65076e54b3aa67b46 | diff --git a/spec/exodus/exodus_spec.rb b/spec/exodus/exodus_spec.rb
index <HASH>..<HASH> 100644
--- a/spec/exodus/exodus_spec.rb
+++ b/spec/exodus/exodus_spec.rb
@@ -250,12 +250,12 @@ describe Exodus do
describe "Getting migration information" do
it "should successfully print the migrations information" do
migrations = [[Migration_test9, {}], [Migration_test10, {}]]
- Exodus.sort_and_run_migrations('up', migrations, nil, true).should == ["Migration_test9: {}", "Migration_test10: {}"]
+ Exodus.sort_and_run_migrations('up', migrations, nil, true).should == ["Migration_test9: #{{}}", "Migration_test10: #{{}}"]
end
it "should successfully print the first migration information" do
migrations = [[Migration_test9, {}], [Migration_test10, {}]]
- Exodus.sort_and_run_migrations('up', migrations, 1, true).should == ["Migration_test9: {}"]
+ Exodus.sort_and_run_migrations('up', migrations, 1, true).should == ["Migration_test9: #{{}}"]
end
end
end | Modified tests for ruby <I> | ThomasAlxDmy_Exodus | train | rb |
fb556213738ff8ac992f4090068fa1fe7a7e9e64 | diff --git a/jdcp-core/src/main/java/ca/eandb/jdcp/job/ParallelizableJobRunner.java b/jdcp-core/src/main/java/ca/eandb/jdcp/job/ParallelizableJobRunner.java
index <HASH>..<HASH> 100644
--- a/jdcp-core/src/main/java/ca/eandb/jdcp/job/ParallelizableJobRunner.java
+++ b/jdcp-core/src/main/java/ca/eandb/jdcp/job/ParallelizableJobRunner.java
@@ -52,6 +52,11 @@ import ca.eandb.util.progress.ProgressMonitorFactory;
*/
public final class ParallelizableJobRunner implements Runnable {
+ /** Creates a new Builder for initializing a ParallelizableJobRunner. */
+ public static Builder newBuilder() {
+ return new Builder();
+ }
+
/** A Builder for creating ParallelizableJobRunner instances. */
public static class Builder {
private ParallelizableJob job = null;
@@ -65,6 +70,12 @@ public final class ParallelizableJobRunner implements Runnable {
= DummyProgressMonitor.getInstance();
/**
+ * Must be created using static factory method.
+ * @see ParallelizableJobRunner#newBuilder()
+ */
+ private Builder() {}
+
+ /**
* Creates the configured ParallelizableJobRunner instance.
* @throws IllegalStateException If the job has not been set.
* @see #setJob(ParallelizableJob) | Add factory method for creating ParallelizableJobRunner.Builder instances. | bwkimmel_jdcp | train | java |
128553f2593c2cfed1f1492e2d5df3eb8e8998b2 | diff --git a/lib/Model/Table.php b/lib/Model/Table.php
index <HASH>..<HASH> 100644
--- a/lib/Model/Table.php
+++ b/lib/Model/Table.php
@@ -544,12 +544,13 @@ class Model_Table extends Model {
$f->updateInsertQuery($insert);
}
$this->hook('beforeInsert',array($insert));
+ if($this->_save_as===false)$insert->option_insert('ignore');
$id = $insert->do_insert();
if($id==0){
// no auto-increment column present
$id=$this->get($this->id_field);
- if($id===null){
+ if($id===null && $this->_save_as!== false){
throw $this->exception('Please add auto-increment ID column to your table or specify ID manually');
}
} | use insert ignore when we don't care about ID
should we use delayed insert instead? | atk4_atk4 | train | php |
9fd6c33a9d5d6a0e87b3ea567edf61fed40ad3c9 | diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -14,7 +14,7 @@ def read(fname):
setup(
name="Pebble",
- version="3.1.0",
+ version="3.1.1",
author="Matteo Cafasso",
author_email="noxdafox@gmail.com",
description=("Threading and multiprocessing eye-candy."), | release <I>: fix waitforthreads to support Python >= <I> | noxdafox_pebble | train | py |
188c55b654c15d22c4afdbd2ebc50e10b749ab57 | diff --git a/bin/eslint-github-init.js b/bin/eslint-github-init.js
index <HASH>..<HASH> 100755
--- a/bin/eslint-github-init.js
+++ b/bin/eslint-github-init.js
@@ -76,6 +76,18 @@ inquirer.prompt(questions).then(answers => {
eslintrc.extends.push('plugin:github/typescript')
// TODO: Check if tsconfig.json exists, generate it if it doesn't.
+ const tsconfigPath = path.resolve(process.cwd(), 'tsconfig.json')
+ if (!fs.existsSync(tsconfig)) {
+ const tsconfigDefaults = {
+ "compilerOptions": {
+ "target": "es5",
+ "module": "commonjs",
+ "strict": true,
+ "esModuleInterop": true
+ }
+ }
+ fs.writeFileSync(tsconfig, JSON.stringify(tsconfigDefaults, null, ' '), 'utf8')
+ }
const tslintPath = path.resolve(process.cwd(), 'tslint.json')
const tslintrc = fs.existsSync(tslintPath) ? JSON.parse(fs.readFileSync(tslintPath, 'utf8')) : { | create tsconfig is one doesn't exist | github_eslint-plugin-github | train | js |
0153809b1fa7e415fc76544106defa83f28e1219 | diff --git a/Configuration.php b/Configuration.php
index <HASH>..<HASH> 100644
--- a/Configuration.php
+++ b/Configuration.php
@@ -216,6 +216,9 @@ class Configuration
$resolver->setAllowedTypes('cache', 'string');
$resolver->setAllowedTypes('reader', 'string');
$resolver->setAllowedTypes('locations', 'array');
+ $resolver->setNormalizer('cache', function($options, $value) {
+ return rtrim($value, '/');
+ });
return $resolver;
} | normalize cache folder by trimming trailing slash | Innmind_neo4j-onm | train | php |
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.