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 |
|---|---|---|---|---|---|
52d5154c9b3ed9af2e078067ae0cf53523e3bb54 | diff --git a/test/TestUtils.js b/test/TestUtils.js
index <HASH>..<HASH> 100644
--- a/test/TestUtils.js
+++ b/test/TestUtils.js
@@ -4,8 +4,9 @@ var _ = require("lodash");
function assertJsonEqual(first, second) {
if (typeof first === "object" && typeof second === "object" && first !== null && second !== null) {
- assert.deepEqual(_.keys(first).sort(), _.keys(second).sort());
- _.each(first, function(key, value) {
+ var keys = _.keys(first).sort();
+ assert.deepEqual(keys, _.keys(second).sort());
+ _.each(keys, function(key) {
assertJsonEqual(first[key], second[key]);
});
} else { | Make assertJsonEqual use sorted keys for iteration as well. | rtfeldman_seamless-immutable | train | js |
510dbb7d036461c1d8b53e631d3760d60b62f62b | diff --git a/tests/Fixtures/JsonMocker.php b/tests/Fixtures/JsonMocker.php
index <HASH>..<HASH> 100644
--- a/tests/Fixtures/JsonMocker.php
+++ b/tests/Fixtures/JsonMocker.php
@@ -2,6 +2,8 @@
namespace Bolt\Common\Tests\Fixtures;
+use Bolt\Common\Json;
+
// @codingStandardsIgnoreFile
/**
@@ -46,6 +48,10 @@ class JsonMocker
*/
private static function register()
{
+ if (class_exists(Json::class, false)) {
+ throw new \LogicException(sprintf('%s() must be called before %s is loaded', __METHOD__, Json::class));
+ }
+
$code = <<<'PHP'
namespace Bolt\Common; | Added check for JsonMocker just to be sure. | bolt_common | train | php |
3d34c8c9f49df5abfbefc6be2a893b792d4cb982 | diff --git a/lib/sham_rack/http.rb b/lib/sham_rack/http.rb
index <HASH>..<HASH> 100644
--- a/lib/sham_rack/http.rb
+++ b/lib/sham_rack/http.rb
@@ -6,9 +6,6 @@ module ShamRack
attr_accessor :rack_app
- attr_accessor :read_timeout, :open_timeout
- attr_accessor :use_ssl,:key, :cert, :ca_file, :ca_path, :verify_mode, :verify_callback, :verify_depth, :cert_store
-
def start
yield self
end | Remove some accessors that are now redundant. | mdub_sham_rack | train | rb |
499856ec0a95637cf96fcf4f6f1427b7092db683 | diff --git a/holoviews/core/tree.py b/holoviews/core/tree.py
index <HASH>..<HASH> 100644
--- a/holoviews/core/tree.py
+++ b/holoviews/core/tree.py
@@ -1,8 +1,6 @@
from collections import OrderedDict
-from .layer import Grid
-from .layout import GridLayout
-from .view import View, Map
+from .view import View
class AttrTree(object):
@@ -55,24 +53,6 @@ class AttrTree(object):
def fixed(self, val):
self.__dict__['_fixed'] = val
- def grid(self, ordering='alphanumeric'):
- """
- Turn the AttrTree into a GridLayout with the available View
- objects ordering specified by a list of labels or by the
- specified ordering mode ('alphanumeric' or 'insertion').
- """
- if ordering == 'alphanumeric':
- child_ordering = sorted(self.children)
- elif ordering == 'insertion':
- child_ordering = self.children
- else:
- child_ordering = ordering
-
- children = [self.__dict__[l] for l in child_ordering]
- dataview_types = (View, Map, GridLayout, Grid)
- return GridLayout(list(child for child in children
- if isinstance(child, dataview_types)))
-
def update(self, other):
""" | Removed AttrTree grid method | pyviz_holoviews | train | py |
65a99ab168f37e9a007d47e242cc5770e8c403d4 | diff --git a/Kwf/Exception/Abstract.php b/Kwf/Exception/Abstract.php
index <HASH>..<HASH> 100644
--- a/Kwf/Exception/Abstract.php
+++ b/Kwf/Exception/Abstract.php
@@ -184,7 +184,7 @@ abstract class Kwf_Exception_Abstract extends Exception
$data = array(
'error' => array(
'code' => $exception->code,
- 'errorId' => $exception->getLogId(),
+ 'errorId' => $this->getLogId(),
'message' => 'An Error occured. Please try again later',
)
);
@@ -198,7 +198,7 @@ abstract class Kwf_Exception_Abstract extends Exception
$data = array(
'error' => array(
'code' => $exception->code,
- 'errorId' => $exception->getLogId(),
+ 'errorId' => $this->getLogId(),
'message' => $exception->message,
'exception' => array(array(
'message' => $exception->message, | Fix logId when exception is not an Kwf_Exception | koala-framework_koala-framework | train | php |
8688c7a2dd6a7f118d47f9e2148d2066414749f2 | diff --git a/andes/models/governor.py b/andes/models/governor.py
index <HASH>..<HASH> 100644
--- a/andes/models/governor.py
+++ b/andes/models/governor.py
@@ -350,7 +350,9 @@ class IEEEG1Data(TGBaseData):
TGBaseData.__init__(self)
self.K = NumParam(default=20, tex_name='K',
info='Gain (1/R) in mach. base',
- unit='p.u. (power)', power=True, vrange=(5, 30),
+ unit='p.u. (power)',
+ power=True,
+ vrange=(5, 30),
)
self.T1 = NumParam(default=1, tex_name='T_1',
info='Gov. lag time const.',
@@ -470,7 +472,7 @@ class IEEEG1Model(TGBase):
)
# `P0` == `tm0`
- self.vs = Algeb(info='Valve move speed',
+ self.vs = Algeb(info='Valve speed',
tex_name='V_s',
v_str='0',
e_str='(LL_y + tm0 + paux - IAW_y) / T3 - vs', | Minor reformatting to IEEEG1 | cuihantao_andes | train | py |
3cfaf2c2a6cae66d00b9e10e8fcd1e26a94967c2 | diff --git a/apitools/base/py/credentials_lib.py b/apitools/base/py/credentials_lib.py
index <HASH>..<HASH> 100644
--- a/apitools/base/py/credentials_lib.py
+++ b/apitools/base/py/credentials_lib.py
@@ -302,6 +302,9 @@ class GceAssertionCredentials(gce.AppAssertionCredentials):
if (creds['scopes'] in
(None, cached_creds['scopes'])):
scopes = cached_creds['scopes']
+ except: # pylint: disable=bare-except
+ # Treat exceptions as a cache miss.
+ pass
finally:
cache_file.unlock_and_close()
return scopes
@@ -331,6 +334,9 @@ class GceAssertionCredentials(gce.AppAssertionCredentials):
# If it's not locked, the locking process will
# write the same data to the file, so just
# continue.
+ except: # pylint: disable=bare-except
+ # Treat exceptions as a cache miss.
+ pass
finally:
cache_file.unlock_and_close() | Treat exceptions accessing GCE credential cache file as a cache miss
This fixes an issue where problems accessing the cache file on
the filesystem (for example, in a container with no mounted
filesystem) would cause apitools to abort entirely, as opposed to
simply not caching the credentials.
Fixes <URL> | google_apitools | train | py |
1f34b85a44d8bc49c4a06afc4d54245144eb679e | diff --git a/src/test/caseHolder.js b/src/test/caseHolder.js
index <HASH>..<HASH> 100644
--- a/src/test/caseHolder.js
+++ b/src/test/caseHolder.js
@@ -15,7 +15,10 @@ var gpii = fluid.registerNamespace("gpii");
fluid.registerNamespace("gpii.test.pouch.caseHolder");
-gpii.test.pouch.caseHolder.standardSequenceEnd = [
+// A series of test sequence steps that will clear out any existing data. Designed for use with caseHolders that extend
+// gpii.test.express.caseHolder, which have the ability to wire "start" and "end" sequence steps before and after each
+// test's "body".
+gpii.test.pouch.caseHolder.cleanupSequence = [
{
func: "{testEnvironment}.events.onCleanup.fire",
args: []
@@ -33,5 +36,5 @@ fluid.defaults("gpii.test.pouch.caseHolder.base", {
fluid.defaults("gpii.test.pouch.caseHolder", {
gradeNames: ["gpii.test.pouch.caseHolder.base"],
- sequenceEnd: gpii.test.pouch.caseHolder.standardSequenceEnd
+ sequenceEnd: gpii.test.pouch.caseHolder.cleanupSequence
}); | GPII-<I>: Renamed standard end sequence steps and added a comment to explain their purpose. | GPII_gpii-pouchdb | train | js |
c5c37d5aa404bf59a5da3bbe91a8766e34a30175 | diff --git a/src/javascript/core/utils/Mime.js b/src/javascript/core/utils/Mime.js
index <HASH>..<HASH> 100644
--- a/src/javascript/core/utils/Mime.js
+++ b/src/javascript/core/utils/Mime.js
@@ -137,6 +137,14 @@ define("moxie/core/utils/Mime", [
accept.mimes = mimes;
return accept;
+ },
+
+ getFileExtension: function(fileName) {
+ return fileName.replace(/^.+\.([^\.]+)$/, "$1").toLowerCase();
+ },
+
+ getFileMime: function(fileName) {
+ return this.mimes[this.getFileExtension(fileName)] || '';
}
}; | Mime: Add convenient methods to get file's extension and mime type by it's name. | moxiecode_moxie | train | js |
9ca20b73d3ee9e1aa1c83336854bb5ac6aca5f99 | diff --git a/transport/src/test/java/io/netty/channel/DefaultChannelPipelineTest.java b/transport/src/test/java/io/netty/channel/DefaultChannelPipelineTest.java
index <HASH>..<HASH> 100644
--- a/transport/src/test/java/io/netty/channel/DefaultChannelPipelineTest.java
+++ b/transport/src/test/java/io/netty/channel/DefaultChannelPipelineTest.java
@@ -189,6 +189,26 @@ public class DefaultChannelPipelineTest {
}
@Test
+ public void testFireChannelRegistered() throws Exception {
+ ChannelPipeline pipeline = new LocalChannel().pipeline();
+ group.register(pipeline.channel());
+ final CountDownLatch latch = new CountDownLatch(1);
+ pipeline.addLast(new ChannelInitializer<Channel>() {
+ @Override
+ protected void initChannel(Channel ch) throws Exception {
+ ch.pipeline().addLast(new ChannelInboundHandlerAdapter() {
+ @Override
+ public void channelRegistered(ChannelHandlerContext ctx) throws Exception {
+ latch.countDown();
+ }
+ });
+ }
+ });
+ pipeline.fireChannelRegistered();
+ assertTrue(latch.await(2, TimeUnit.SECONDS));
+ }
+
+ @Test
public void testPipelineOperation() {
ChannelPipeline pipeline = new LocalChannel().pipeline(); | Add testcase to show channelRegistered is called | netty_netty | train | java |
f567f7629a834bf32911ff3216e3e0bbc76b0f27 | diff --git a/lib/excon/response.rb b/lib/excon/response.rb
index <HASH>..<HASH> 100644
--- a/lib/excon/response.rb
+++ b/lib/excon/response.rb
@@ -83,7 +83,10 @@ module Excon
chunk_size -= chunk.bytesize
response_block.call(chunk, nil, nil)
end
- socket.read(2) # 2 == "\r\n".length
+ new_line_size = 2 # 2 == "\r\n".length
+ while new_line_size > 0
+ new_line_size -= socket.read(new_line_size).length
+ end
end
else
while (chunk_size = socket.readline.chomp!.to_i(16)) > 0
@@ -92,7 +95,10 @@ module Excon
chunk_size -= chunk.bytesize
datum[:response][:body] << chunk
end
- socket.read(2) # 2 == "\r\n".length
+ new_line_size = 2 # 2 == "\r\n".length
+ while new_line_size > 0
+ new_line_size -= socket.read(new_line_size).length
+ end
end
end
parse_headers(socket, datum) # merge trailers into headers | Make sure we actually get both new line characters | excon_excon | train | rb |
ff7461b3cd5d9e6c8f0c8f56f79585052ec89ae5 | diff --git a/salt/grains/core.py b/salt/grains/core.py
index <HASH>..<HASH> 100644
--- a/salt/grains/core.py
+++ b/salt/grains/core.py
@@ -161,7 +161,7 @@ def _linux_gpu_data():
devs = []
try:
- lspci_out = __salt__['cmd.run']('lspci -vmm')
+ lspci_out = __salt__['cmd.run']('{0} -vmm'.format(lspci))
cur_dev = {}
error = False
@@ -495,7 +495,7 @@ def _virtual(osdata):
if not cmd:
continue
- cmd = '{0} {1}'.format(command, ' '.join(args))
+ cmd = '{0} {1}'.format(cmd, ' '.join(args))
try:
ret = __salt__['cmd.run_all'](cmd) | Use path found by salt.utils.which
I ran into this problem running `salt-ssh '*' test.ping` with a
XenServer <I> node as the target. Even though the `lspci` and
`dmidecode` (after I installed it) commands are found by
`salt.utils.which`, because they're not actually in the `$PATH`, they
fail to execute. | saltstack_salt | train | py |
9fa1b3275c07495b3c36dbd431c735555f20056f | diff --git a/js/binance.js b/js/binance.js
index <HASH>..<HASH> 100644
--- a/js/binance.js
+++ b/js/binance.js
@@ -4959,10 +4959,10 @@ module.exports = class binance extends Exchange {
async fetchBorrowRateHistory (code, since = undefined, limit = undefined, params = {}) {
await this.loadMarkets ();
if (limit === undefined) {
- limit = 93;
- } else if (limit > 93) {
- // Binance API says the limit is 100, but illegal parameter errors are returned when limit is > 93
- throw new BadRequest (this.id + ' fetchBorrowRateHistory limit parameter cannot exceed 93');
+ limit = 92;
+ } else if (limit > 92) {
+ // Binance API says the limit is 100, but "Illegal characters found in a parameter." is returned when limit is > 92
+ throw new BadRequest (this.id + ' fetchBorrowRateHistory limit parameter cannot exceed 92');
}
const currency = this.currency (code);
const request = {
@@ -4970,8 +4970,9 @@ module.exports = class binance extends Exchange {
'limit': limit,
};
if (since !== undefined) {
+ since = since - 1;
request['startTime'] = since;
- const endTime = this.sum (since, limit * 86400000); // required when startTime is further than 93 days in the past
+ const endTime = this.sum (since, limit * 86400000); // required when startTime is further than 92 days in the past
const now = this.milliseconds ();
request['endTime'] = Math.min (endTime, now); // cannot have an endTime later than current time
} | fetchBorrowRateHistory subtract 1 from since, limit = <I> | ccxt_ccxt | train | js |
517ca8771c15d2ca0d7e15e76ad37e57f6492d2b | diff --git a/activerecord/test/cases/helper.rb b/activerecord/test/cases/helper.rb
index <HASH>..<HASH> 100644
--- a/activerecord/test/cases/helper.rb
+++ b/activerecord/test/cases/helper.rb
@@ -1,11 +1,5 @@
require File.expand_path('../../../../load_paths', __FILE__)
-test = File.expand_path('../..', __FILE__)
-$:.unshift(test) unless $:.include?('test') || $:.include?(test)
-
-lib = File.expand_path("#{File.dirname(__FILE__)}/../../lib")
-$:.unshift(lib) unless $:.include?('lib') || $:.include?(lib)
-
require 'config'
require 'test/unit' | do not muck with the load path, that is the test task responsibility | rails_rails | train | rb |
2d86420e77eed28d7b7dc235ec76e3a99a467438 | diff --git a/pkg/model/components/clusterautoscaler.go b/pkg/model/components/clusterautoscaler.go
index <HASH>..<HASH> 100644
--- a/pkg/model/components/clusterautoscaler.go
+++ b/pkg/model/components/clusterautoscaler.go
@@ -43,6 +43,8 @@ func (b *ClusterAutoscalerOptionsBuilder) BuildOptions(o interface{}) error {
v, err := util.ParseKubernetesVersion(clusterSpec.KubernetesVersion)
if err == nil {
switch v.Minor {
+ case 24:
+ image = "registry.k8s.io/autoscaling/cluster-autoscaler:v1.23.0"
case 23:
image = "registry.k8s.io/autoscaling/cluster-autoscaler:v1.23.0"
case 22: | Use Cluster Autoscaler <I> for k8s <I>
We made this explicitly fail before because there is a risk of us forgetting to bump. I think, however, history has shown this risk is not very real | kubernetes_kops | train | go |
cd6d35239636eec48f24f267522c138f357fa537 | diff --git a/lib/dml/moodle_database.php b/lib/dml/moodle_database.php
index <HASH>..<HASH> 100644
--- a/lib/dml/moodle_database.php
+++ b/lib/dml/moodle_database.php
@@ -485,9 +485,10 @@ abstract class moodle_database {
$where[] = "$key IS NULL";
} else {
if ($allowed_types & SQL_PARAMS_NAMED) {
- $where[] = "$key = :$key";
- $params[$key] = $value;
- } else {
+ $normkey = trim(preg_replace('/[^a-zA-Z0-9-_]/', '_', $key), '-_'); // Need to normalize key names
+ $where[] = "$key = :$normkey"; // because they can contain, originally,
+ $params[$normkey] = $value; // spaces and other forbiden chars when
+ } else { // using sql_xxx() functions and friends.
$where[] = "$key = ?";
$params[] = $value;
} | NOBUG: Normalise generated param names so we can safely use sql_xxx() helper functions everywhere. | moodle_moodle | train | php |
daac9b82d1f30ef36a4272a13bfe024cd571ac94 | diff --git a/LiSE/character.py b/LiSE/character.py
index <HASH>..<HASH> 100644
--- a/LiSE/character.py
+++ b/LiSE/character.py
@@ -107,17 +107,17 @@ class CharacterThingMapping(MutableMapping, RuleFollower):
self._cache = {}
self._keycache = {}
if self.engine.caching:
+ self.engine.time_listener(self._recache)
- @self.engine.time_listener
- def recache(branch_then, tick_then, b, t):
- if b not in self._keycache:
- self._keycache[b] = {}
- if branch_then == b and tick_then == t - 1:
- self._keycache[b][t] = self._keycache[b][t-1]
- else:
- self._keycache[b][t] = set(
- self._iter_thing_names()
- )
+ def _recache(self, branch_then, tick_then, b, t):
+ if b not in self._keycache:
+ self._keycache[b] = {}
+ if branch_then == b and tick_then == t - 1:
+ self._keycache[b][t] = self._keycache[b][t-1]
+ else:
+ self._keycache[b][t] = set(
+ self._iter_thing_names()
+ )
def _dispatch_thing(self, k, v):
(b, t) = self.engine.time | tweak that seems to make Character friendlier when used in a subprocess | LogicalDash_LiSE | train | py |
7b2ad4f0957f23e7f13e0aa965febd3d97ee17a2 | diff --git a/src/Sylius/Bundle/CoreBundle/DependencyInjection/Configuration.php b/src/Sylius/Bundle/CoreBundle/DependencyInjection/Configuration.php
index <HASH>..<HASH> 100644
--- a/src/Sylius/Bundle/CoreBundle/DependencyInjection/Configuration.php
+++ b/src/Sylius/Bundle/CoreBundle/DependencyInjection/Configuration.php
@@ -49,7 +49,10 @@ final class Configuration implements ConfigurationInterface
->children()
->scalarNode('driver')->defaultValue(SyliusResourceBundle::DRIVER_DOCTRINE_ORM)->end()
->booleanNode('prepend_doctrine_migrations')->defaultTrue()->end()
- ->booleanNode('process_shipments_before_recalculating_prices')->defaultFalse()->end()
+ ->booleanNode('process_shipments_before_recalculating_prices')
+ ->setDeprecated('sylius/sylius', '1.10', 'The "%path%.%node%" parameter is deprecated and will be removed in 2.0.')
+ ->defaultFalse()
+ ->end()
->end()
; | [Core][Shipping] Deprecate processing shipments before recalculating prices | Sylius_Sylius | train | php |
5b46e6c0d853810dc10e7624ed7e562f3772b5e7 | diff --git a/nupic/research/monitor_mixin/trace.py b/nupic/research/monitor_mixin/trace.py
index <HASH>..<HASH> 100644
--- a/nupic/research/monitor_mixin/trace.py
+++ b/nupic/research/monitor_mixin/trace.py
@@ -99,7 +99,7 @@ class IndicesTrace(Trace):
@staticmethod
def prettyPrintDatum(datum):
- return str(list(datum))
+ return str(sorted(list(datum))) | Sort the indices while pretty-printing a trace | numenta_nupic | train | py |
8ae7f31e36a298804435565e0cae584aac90f6d5 | diff --git a/parquet-hadoop/src/main/java/org/apache/parquet/hadoop/ParquetOutputFormat.java b/parquet-hadoop/src/main/java/org/apache/parquet/hadoop/ParquetOutputFormat.java
index <HASH>..<HASH> 100644
--- a/parquet-hadoop/src/main/java/org/apache/parquet/hadoop/ParquetOutputFormat.java
+++ b/parquet-hadoop/src/main/java/org/apache/parquet/hadoop/ParquetOutputFormat.java
@@ -73,7 +73,7 @@ import org.slf4j.LoggerFactory;
* parquet.dictionary.page.size=1048576 # in bytes, default = 1 * 1024 * 1024
*
* # The compression algorithm used to compress pages
- * parquet.compression=UNCOMPRESSED # one of: UNCOMPRESSED, SNAPPY, GZIP, LZO. Default: UNCOMPRESSED. Supersedes mapred.output.compress*
+ * parquet.compression=UNCOMPRESSED # one of: UNCOMPRESSED, SNAPPY, GZIP, LZO, ZSTD. Default: UNCOMPRESSED. Supersedes mapred.output.compress*
*
* # The write support class to convert the records written to the OutputFormat into the events accepted by the record consumer
* # Usually provided by a specific ParquetOutputFormat subclass | PARQUET-<I>: Add zstd to `parquet.compression` description of ParquetOutputFormat Javadoc (#<I>)
The current Javadoc doesn't mention zstd.
<URL> | apache_parquet-mr | train | java |
5d9153a935d027b70fc383ebd2fed45ef4da7cf4 | diff --git a/src/sap.ui.rta/test/sap/ui/rta/qunit/util/adaptationStarter.qunit.js b/src/sap.ui.rta/test/sap/ui/rta/qunit/util/adaptationStarter.qunit.js
index <HASH>..<HASH> 100644
--- a/src/sap.ui.rta/test/sap/ui/rta/qunit/util/adaptationStarter.qunit.js
+++ b/src/sap.ui.rta/test/sap/ui/rta/qunit/util/adaptationStarter.qunit.js
@@ -54,6 +54,10 @@ sap.ui.define([
oResourceBundle.getText("TIT_ADAPTATION_STARTER_MIXED_CHANGES_TITLE"),
"then the title of the mixed changes message is shown correctly"
);
+ /**
+ * TODO: This test should be integrated again after the automatic translations have refreshed the messagebundle
+ * the translations have not implemented the new link syntax yet because of that the test is failing
+ *
assert.strictEqual(
this.fnMessageBoxStub.lastCall.args[0].mAggregations.content.map(function(item, index) {
if (index === 1) {
@@ -63,7 +67,7 @@ sap.ui.define([
}).join(""),
oResourceBundle.getText("MSG_ADAPTATION_STARTER_MIXED_CHANGES_WARNING"),
"then the text of the mixed changes message is shown correctly"
- );
+ );*/
}.bind(this));
}); | [INTERNAL][Fix] sap.ui.rta: Failing Qunit Test in adaptationStarter
- commenting out the failing quint test until the automatic translations has updated the messagebundle with the new link syntax
Change-Id: I3a<I>e<I>bc6c<I>f<I>c6b2b2dd0c<I>fea5 | SAP_openui5 | train | js |
6bbcf63d0bd8176377c4e0196dcb2372ea199bdb | diff --git a/test/rfc_test.rb b/test/rfc_test.rb
index <HASH>..<HASH> 100644
--- a/test/rfc_test.rb
+++ b/test/rfc_test.rb
@@ -269,4 +269,17 @@ describe "RFC Recurrence Rules" do # http://www.kanzaki.com/docs/ical/rrule.html
dates.must_pair_with expected_dates
dates.size.must_equal expected_dates.size
end
+
+ it "monthly on the 2nd and 15th of the month for 10 occurrences" do
+ schedule = new_schedule(every: :month, day: [2, 15], total: 10)
+
+ expected_dates = cherry_pick(
+ 2015 => { 9 => [2, 15], 10 => [2, 15], 11 => [2, 15], 12 => [2, 15] },
+ 2016 => { 1 => [2, 15] }).map { |t| t + 12.hours }
+
+ dates = schedule.events.to_a
+
+ dates.must_pair_with expected_dates
+ dates.size.must_equal expected_dates.size
+ end
end | Test for monthly 2nd and <I>th for <I> occurrences | rossta_montrose | train | rb |
47d6c9576f1635bffd617ef75c79c3db50333dc1 | diff --git a/dsdev_utils/paths.py b/dsdev_utils/paths.py
index <HASH>..<HASH> 100644
--- a/dsdev_utils/paths.py
+++ b/dsdev_utils/paths.py
@@ -78,7 +78,7 @@ def remove_any(path):
class ChDir(object):
def __init__(self, path):
- if six.PY2 or sys.version_info[1] == 5:
+ if six.PY2 or sys.version_info[1] in [4, 5]:
path = str(path)
self.old_dir = os.getcwd() | reg path for python <I> and <I> | JMSwag_dsdev-utils | train | py |
86a4b9fc6c8f4e1b59cdae1809be1eb80d06d162 | diff --git a/inc/i18n.php b/inc/i18n.php
index <HASH>..<HASH> 100644
--- a/inc/i18n.php
+++ b/inc/i18n.php
@@ -10,6 +10,11 @@
namespace Inpsyde\Validator;
+// Exit early in case multiple Composer autoloaders try to include this file.
+if ( function_exists( __NAMESPACE__ . '\\' . 'load_translations' ) ) {
+ return;
+}
+
/**
* @param string $path
* | Return early if the `load_translations()` function has already been declared.
Resolves #5 | inpsyde_inpsyde-validator | train | php |
da48eb5f2e66e0364e41a9a4e4212db3c80d20ac | diff --git a/src/console.js b/src/console.js
index <HASH>..<HASH> 100644
--- a/src/console.js
+++ b/src/console.js
@@ -2,8 +2,6 @@
const huey = require('huey')
-const {stdout} = process
-
// Equals true if the console is mocked.
let mocking = false
@@ -61,11 +59,15 @@ function performCalls() {
args[j] = JSON.stringify(arg)
}
}
- if (key == 'warn') {
- args.unshift(huey.yellow('warn:'))
- } else if (key == 'error') {
- args.unshift(huey.red('error:'))
+ if (typeof process != 'undefined') {
+ if (key == 'warn') {
+ args.unshift(huey.yellow('warn:'))
+ } else if (key == 'error') {
+ args.unshift(huey.red('error:'))
+ }
+ process.stdout.write('\n' + args.join(' '))
+ } else {
+ console[key](args.join(' '))
}
- stdout.write('\n' + args.join(' '))
}
} | fix: don't assume process.stdout exists | aleclarson_testpass | train | js |
4d9f2fac0581167493a666c6f72babe94beb7aa1 | diff --git a/lib/target.js b/lib/target.js
index <HASH>..<HASH> 100644
--- a/lib/target.js
+++ b/lib/target.js
@@ -296,7 +296,7 @@ class Target {
bootstrap: this.bootstrap,
boilerplate: this.boilerplate,
includeHeader: this.modular,
- includeHelpers: this.modular,
+ includeHelpers: !this.hasParent && this.modular,
watching
}; | fix include of helpers for child targets; closes #<I> | popeindustries_buddy | train | js |
4014950cc3c2d0e229d203a3f113fe534ed9b628 | diff --git a/addon/models/preprint-provider.js b/addon/models/preprint-provider.js
index <HASH>..<HASH> 100644
--- a/addon/models/preprint-provider.js
+++ b/addon/models/preprint-provider.js
@@ -12,6 +12,7 @@ export default OsfModel.extend({
footerLinks: DS.attr('string'),
allowSubmissions: DS.attr('boolean'),
additionalProviders: DS.attr(),
+ shareSource: DS.attr('string'),
// Relationships
taxonomies: DS.hasMany('taxonomy'),
preprints: DS.hasMany('preprint', { inverse: 'provider', async: true }), | Add shareSource property to preprint-provider model | CenterForOpenScience_ember-osf | train | js |
b65441316d27c0a6404886521fe24d0a55a1389b | diff --git a/simpleldap/__init__.py b/simpleldap/__init__.py
index <HASH>..<HASH> 100644
--- a/simpleldap/__init__.py
+++ b/simpleldap/__init__.py
@@ -99,20 +99,23 @@ class Connection(object):
# this to a class of their liking.
result_item_class = LDAPItem
- def __init__(self, hostname, port=None, dn='', password='',
+ def __init__(self, hostname='localhost', port=None, dn='', password='',
encryption=None, require_cert=None, debug=False,
initialize_kwargs=None, options=None):
"""
Bind to hostname:port using the passed distinguished name (DN), as
``dn``, and password.
+ If ``hostname`` is not given, default to ``'localhost'``.
+
If no user and password is given, try to connect anonymously with a
blank DN and password.
``encryption`` should be one of ``'tls'``, ``'ssl'``, or ``None``.
If ``'tls'``, then the standard port 389 is used by default and after
binding, tls is started. If ``'ssl'``, then port 636 is used by
- default.
+ default. ``port`` can optionally be given for connecting to a
+ non-default port.
``require_cert`` is None by default. Set this to ``True`` or
``False`` to set the ``OPT_X_TLS_REQUIRE_CERT`` ldap option. | Default hostname argument to 'localhost'. Thanks to Adriano Ribeiro (drr<I>t) for the suggestion. | gdub_python-simpleldap | train | py |
404e14aae4dbb687896463fb430d400dc3209a58 | diff --git a/lib/fgraph.rb b/lib/fgraph.rb
index <HASH>..<HASH> 100644
--- a/lib/fgraph.rb
+++ b/lib/fgraph.rb
@@ -391,7 +391,7 @@ module FGraph
#
def get_id(id)
return unless id
- id = id['id'] if id.is_a?(Hash)
+ id = id['id'] || id[:id] if id.is_a?(Hash)
id
end
end | Accept symbol as well. (Corresponding to usage in readme file.) | jugend_fgraph | train | rb |
226195195f1881951c6da4bdd5af4b69dca5f5e1 | diff --git a/routingtable/routingtable.go b/routingtable/routingtable.go
index <HASH>..<HASH> 100644
--- a/routingtable/routingtable.go
+++ b/routingtable/routingtable.go
@@ -599,6 +599,10 @@ func (table *routingTable) messages(routesDiff routesDiff, endpointDiff endpoint
}
func (table *routingTable) RemoveRoutes(desiredLRP *models.DesiredLRPSchedulingInfo) (TCPRouteMappings, MessagesToEmit) {
+ logger := table.logger.Session("RemoveRoutes", lager.Data{"desired_lrp": DesiredLRPData(desiredLRP)})
+ logger.Debug("starting")
+ defer logger.Debug("completed")
+
return table.SetRoutes(desiredLRP, nil)
} | Put back the RemoveRoutes logging to make the test happy | cloudfoundry_route-emitter | train | go |
786674f1717ada6f1ec9c2151f75b7c82902f422 | diff --git a/src/renderer/canvas.js b/src/renderer/canvas.js
index <HASH>..<HASH> 100644
--- a/src/renderer/canvas.js
+++ b/src/renderer/canvas.js
@@ -9,7 +9,7 @@ var CanvasRenderer = function(el, options) {
el.appendChild(canvas);
- if (typeof(G_vmlCanvasManager) == 'object') {
+ if (typeof(G_vmlCanvasManager) === 'object') {
G_vmlCanvasManager.initElement(canvas);
} | Replace `==` by `===` | rendro_easy-pie-chart | train | js |
fb6bb3430004de0c33e357ee68a5a7dd424dcfee | diff --git a/lib/colocated-babel-plugin.js b/lib/colocated-babel-plugin.js
index <HASH>..<HASH> 100644
--- a/lib/colocated-babel-plugin.js
+++ b/lib/colocated-babel-plugin.js
@@ -24,7 +24,7 @@ module.exports = function (babel) {
ExportDefaultDeclaration(path, state) {
let defaultExportDeclarationPath = path.get('declaration');
let defaultExportIsExpressionOrClass =
- defaultExportDeclarationPath.isClass() || defaultExportDeclarationPath.isExpression();
+ defaultExportDeclarationPath.isClass() || defaultExportDeclarationPath.isExpression() || defaultExportDeclarationPath.isFunction();
if (
state.colocatedTemplateFound !== true || | Update lib/colocated-babel-plugin.js | ember-cli_ember-cli-htmlbars | train | js |
b28bcaf04b832abc80b00de76b519d683f6911aa | diff --git a/lib/doorkeeper/oauth/authorization_code_request.rb b/lib/doorkeeper/oauth/authorization_code_request.rb
index <HASH>..<HASH> 100644
--- a/lib/doorkeeper/oauth/authorization_code_request.rb
+++ b/lib/doorkeeper/oauth/authorization_code_request.rb
@@ -2,7 +2,6 @@ module Doorkeeper
module OAuth
class AuthorizationCodeRequest
include Doorkeeper::Validations
- include Doorkeeper::OAuth::Helpers
validate :attributes, error: :invalid_request
validate :client, error: :invalid_client | Doorkeeper::OAuth::Helpers is no longer necessary for find_or_create. | doorkeeper-gem_doorkeeper | train | rb |
a47c18d30ac87a42db5b35a525a46985f843d843 | diff --git a/client/v3/client_test.go b/client/v3/client_test.go
index <HASH>..<HASH> 100644
--- a/client/v3/client_test.go
+++ b/client/v3/client_test.go
@@ -80,7 +80,7 @@ func TestDialCancel(t *testing.T) {
}
func TestDialTimeout(t *testing.T) {
- defer testutil.AfterTest(t)
+ testutil.BeforeTest(t)
wantError := context.DeadlineExceeded
diff --git a/tests/integration/v3_alarm_test.go b/tests/integration/v3_alarm_test.go
index <HASH>..<HASH> 100644
--- a/tests/integration/v3_alarm_test.go
+++ b/tests/integration/v3_alarm_test.go
@@ -35,7 +35,7 @@ import (
// TestV3StorageQuotaApply tests the V3 server respects quotas during apply
func TestV3StorageQuotaApply(t *testing.T) {
- testutil.AfterTest(t)
+ testutil.BeforeTest(t)
quotasize := int64(16 * os.Getpagesize())
clus := NewClusterV3(t, &ClusterConfig{Size: 2}) | Fix 2 remaining 'defer AfterTest' calls. | etcd-io_etcd | train | go,go |
4488979ad394306011be42cec0e47936e08075b1 | diff --git a/src/Orders/OrdersAWBInfo.php b/src/Orders/OrdersAWBInfo.php
index <HASH>..<HASH> 100644
--- a/src/Orders/OrdersAWBInfo.php
+++ b/src/Orders/OrdersAWBInfo.php
@@ -17,7 +17,7 @@ class OrdersAWBInfo {
* @return \Psr\Http\Message\ResponseInterface
* @throws \Exception
*/
- public function setAwbInfo($cmd, $courier, $plic = null, $packages = null, $kg = null){
+ public function setAwbInfo($cmd, $courier, $plic = null, $packages = null, $kg = null, $sambata = 0){
// Sanity check
if(!isset($cmd) || !is_int($cmd)) throw new \Exception('Specificati comanda');
if(!isset($courier) || trim($courier) == '') throw new \Exception('Specificati curierul');
@@ -41,6 +41,7 @@ class OrdersAWBInfo {
$data['packages'] = $packages;
$data['kg'] = $kg;
}
+ $data['sambata'] = $sambata;
// Send request and retrieve response
$result = Dispatcher::send($method, $action, $data); | Added parameter for Saturday delivery
modified: src/Orders/OrdersAWBInfo.php | celdotro_marketplace | train | php |
788335acd4645ab6ca23d773e0f5f0e4f71cef16 | diff --git a/mod/workshop/renderer.php b/mod/workshop/renderer.php
index <HASH>..<HASH> 100644
--- a/mod/workshop/renderer.php
+++ b/mod/workshop/renderer.php
@@ -237,7 +237,7 @@ class mod_workshop_renderer extends plugin_renderer_base {
$type = mimeinfo_from_type("type", $type);
$image = html_writer::empty_tag('img', array('src'=>$this->output->pix_url(file_mimetype_icon($type)), 'alt'=>$type, 'class'=>'icon'));
- $linkhtml = html_writer::link($fileurl, $image) . html_writer::link($fileurl, $filename);
+ $linkhtml = html_writer::link($fileurl, $image) . substr($filepath, 1) . html_writer::link($fileurl, $filename);
$linktxt = "$filename [$fileurl]";
if ($format == "html") { | NOBUG: Workshop submission attachments are displayed with the path, not just filename | moodle_moodle | train | php |
d5530ee940a672cc7a6ca3c606b654ad8f5e8963 | diff --git a/src/module-elasticsuite-core/view/frontend/web/js/form-mini.js b/src/module-elasticsuite-core/view/frontend/web/js/form-mini.js
index <HASH>..<HASH> 100644
--- a/src/module-elasticsuite-core/view/frontend/web/js/form-mini.js
+++ b/src/module-elasticsuite-core/view/frontend/web/js/form-mini.js
@@ -5,7 +5,7 @@ define([
'underscore',
'mage/template',
'Magento_Catalog/js/price-utils',
- 'Magento_Ui/js/lib/ko/template/loader',
+ 'Magento_Ui/js/lib/knockout/template/loader',
'jquery/ui',
'mage/translate',
'mageQuickSearch' | Repair broken autocomplete - Knockout JS libs path have changed in Magento <I>-rc* | Smile-SA_elasticsuite | train | js |
92b583b0c150e24cbd99553a0415baab7898bc0d | diff --git a/packages/ember-metal/lib/get_properties.js b/packages/ember-metal/lib/get_properties.js
index <HASH>..<HASH> 100644
--- a/packages/ember-metal/lib/get_properties.js
+++ b/packages/ember-metal/lib/get_properties.js
@@ -18,9 +18,10 @@ import { typeOf } from "ember-metal/utils";
```
@method getProperties
- @param obj
+ @for Ember
+ @param {Object} obj
@param {String...|Array} list of keys to get
- @return {Hash}
+ @return {Object}
*/
export default function getProperties(obj) {
var ret = {}; | [DOC beta] Fix the namespace of the Ember.getProperties method.
Previously it was incorrectly being rendered on the
Ember.InjectedProperty page. | emberjs_ember.js | train | js |
7a6a9e88514198c57a3dadd0c68281aaffe7219d | diff --git a/src/Browser.php b/src/Browser.php
index <HASH>..<HASH> 100644
--- a/src/Browser.php
+++ b/src/Browser.php
@@ -519,6 +519,20 @@ class Browser
}
/**
+ * Execute a Closure outside of the current browser scope when the selector is available.
+ *
+ * @param string $selector
+ * @param \Closure $callback
+ * @return $this
+ */
+ public function elsewhereWhenAvailable($selector, Closure $callback)
+ {
+ return $this->elsewhere('', function ($browser) use ($selector, $callback) {
+ $this->whenAvailable($selector, $callback);
+ });
+ }
+
+ /**
* Set the current component state.
*
* @param \Laravel\Dusk\Component $component | [6.x] Add Browser::elsewhereWhenAvailable(). (#<I>) | laravel_dusk | train | php |
cf39e1f969a975b29f1be859d40e048e153a34ad | diff --git a/src/test/java/io/ddavison/conductor/FrameworkTest.java b/src/test/java/io/ddavison/conductor/FrameworkTest.java
index <HASH>..<HASH> 100644
--- a/src/test/java/io/ddavison/conductor/FrameworkTest.java
+++ b/src/test/java/io/ddavison/conductor/FrameworkTest.java
@@ -27,7 +27,8 @@ public class FrameworkTest extends Locomotive {
@Test
public void testSetAndValidateText() throws Exception {
- setAndValidateText("#setTextField", "set and validate text test");
+ setAndValidateText("#setTextField", "set and validate text test")
+ .validateText("#setTextField", "set and validate text test");
}
@Test | Add .validateText(...) in unit test as suggested. | conductor-framework_conductor | train | java |
8006102cb6ca6ed179712a42fe5a64cd84072829 | diff --git a/lib/jubilee/version.rb b/lib/jubilee/version.rb
index <HASH>..<HASH> 100644
--- a/lib/jubilee/version.rb
+++ b/lib/jubilee/version.rb
@@ -3,7 +3,7 @@ module Jubilee
MAJOR = 2
MINOR = 1
PATCH = 0
- BUILD = "Alpha1"
+ BUILD = "beta"
STRING = [MAJOR, MINOR, PATCH, BUILD].compact.join('.')
end | bump to <I>.beta | isaiah_jubilee | train | rb |
a19c30a2c29cb3059b71e8e5e664e6addb118f55 | diff --git a/examples/gen_ooaofooa_schema.py b/examples/gen_ooaofooa_schema.py
index <HASH>..<HASH> 100644
--- a/examples/gen_ooaofooa_schema.py
+++ b/examples/gen_ooaofooa_schema.py
@@ -45,12 +45,14 @@ def main():
m = loader.build_metamodel()
c = loader.build_component(derived_attributes=True)
-
+
for o_obj in m.select_many('O_OBJ'):
for o_attr in many(o_obj).O_ATTR[102](o_attr_filter):
logger.info('Filtering %s.%s' % (o_obj.Key_Lett, o_attr.Name))
metaclass = c.find_metaclass(o_obj.Key_Lett)
metaclass.delete_attribute(o_attr.Name)
+ if o_obj.Key_Lett == 'ACT_ACT':
+ metaclass.insert_attribute(index=5, name='return_value', type_name='INTEGER')
xtuml.persist_schema(c, '/dev/stdout') | job: #<I> Automating the re-insertion of return_type into ACT_ACT which is of an unsupported special type (instance) and coercing it to INTEGER. | xtuml_pyxtuml | train | py |
34e5278b6c1b20483d80c9969b1d0c2f112d6794 | diff --git a/index.js b/index.js
index <HASH>..<HASH> 100644
--- a/index.js
+++ b/index.js
@@ -384,6 +384,7 @@ function onCaptcha (options, response, body) {
// Prioritize the explicit fallback siteKey over other matches
if (match[0].indexOf('fallback') !== -1) {
keys.unshift(match[1]);
+ if (!debugging) break;
} else {
keys.push(match[1]);
} | Bail sooner when not debugging | codemanki_cloudscraper | train | js |
f8e89c1cf9a60b70e4f81055048ae0c6fe9454aa | diff --git a/example/rakefile.rb b/example/rakefile.rb
index <HASH>..<HASH> 100644
--- a/example/rakefile.rb
+++ b/example/rakefile.rb
@@ -1,13 +1,21 @@
+desc 'clean all examples'
+task :clean_all do
+ run_rakefiles("rake clean")
+end
+
desc 'build all examples'
task :all_examples do
+ run_rakefiles("rake")
+end
+
+task :default => :all_examples
+
+def run_rakefiles(c)
Dir.glob('**/Rakefile.rb').each do |p|
dir = File.dirname(p)
cd dir do
- puts "running rake in #{dir}"
- sh "rake"
+ sh "#{c}"
end
end
end
-
-task :default => :all_examples | easy way to execute all example rake tasks and clean up again | marcmo_cxxproject | train | rb |
18dd1a059877931ff575658e8d261d04ed3bc676 | diff --git a/utils/data-plotter/LeapDataPlotter.js b/utils/data-plotter/LeapDataPlotter.js
index <HASH>..<HASH> 100644
--- a/utils/data-plotter/LeapDataPlotter.js
+++ b/utils/data-plotter/LeapDataPlotter.js
@@ -85,6 +85,8 @@
LeapDataPlotter.prototype.plot = function (id, data, opts) {
console.assert(data, "No plotting data received");
+ opts || (opts = {});
+
if (data.length) {
for (var i = 0, c = 120; i < data.length; i++, c=++c>122?97:c) { | Fix issue where not giving options to #plot would crash | leapmotion_leapjs-plugins | train | js |
e659d931638808ed47eeb3b65eb308acee614c20 | diff --git a/command/meta.go b/command/meta.go
index <HASH>..<HASH> 100644
--- a/command/meta.go
+++ b/command/meta.go
@@ -96,7 +96,7 @@ func (m *Meta) Client() (*api.Client, error) {
}
}
// If we need custom TLS configuration, then set it
- if m.flagCACert != "" || m.flagCAPath != "" || m.flagInsecure {
+ if m.flagCACert != "" || m.flagCAPath != "" || m.flagClientCert != "" || m.flagClientKey != "" || m.flagInsecure {
var certPool *x509.CertPool
var err error
if m.flagCACert != "" { | command: Fixing setup of client certificates | hashicorp_vault | train | go |
3a654c012592cf7c3b304aa5a4812c46e3a62282 | diff --git a/src/Comparator.php b/src/Comparator.php
index <HASH>..<HASH> 100644
--- a/src/Comparator.php
+++ b/src/Comparator.php
@@ -45,7 +45,9 @@ class Comparator
}, $definedApi->getAllClasses());
foreach ($definedApiClassNames as $apiClassName) {
- $changelog = $this->examineClass($changelog, $oldApi->reflect($apiClassName), $newApi);
+ /** @var ReflectionClass $oldClass */
+ $oldClass = $newApi->reflect($apiClassName);
+ $changelog = $this->examineClass($changelog, $oldClass, $newApi);
}
return $changelog; | Documented `$oldClass` type, since otherwise PHPStan chokes on it | Roave_BackwardCompatibilityCheck | train | php |
876a2239e3684b5c03a98d523d2d0c41907e6a74 | diff --git a/mapchete/io_utils.py b/mapchete/io_utils.py
index <HASH>..<HASH> 100644
--- a/mapchete/io_utils.py
+++ b/mapchete/io_utils.py
@@ -4,13 +4,11 @@ import numpy as np
import mapchete
from tilematrix import *
-from rasterio.warp import RESAMPLING
def read_vector(
process,
input_file,
- pixelbuffer=0,
- resampling=RESAMPLING.nearest
+ pixelbuffer=0
):
"""
This is a wrapper around the read_vector_window function of tilematrix.
@@ -35,7 +33,7 @@ def read_raster(
process,
input_file,
pixelbuffer=0,
- resampling=RESAMPLING.nearest
+ resampling="nearest"
):
"""
This is a wrapper around the read_raster_window function of tilematrix.
@@ -58,6 +56,7 @@ def read_raster(
return metadata, data
+
def write_raster(
process,
metadata, | making resampling method configurable | ungarj_mapchete | train | py |
e530108b6ac2e5cac6c1979782725e5aea6c8038 | diff --git a/lib/vagrant/machine.rb b/lib/vagrant/machine.rb
index <HASH>..<HASH> 100644
--- a/lib/vagrant/machine.rb
+++ b/lib/vagrant/machine.rb
@@ -230,7 +230,7 @@ module Vagrant
end
# Store the ID locally
- @id = value.to_s
+ @id = value.nil? ? nil : value.to_s
# Notify the provider that the ID changed in case it needs to do
# any accounting from it. | Do not to_s the machine id if it is nil
When destroying a machine, the machine id is set to nil, the to_s causes it to be set to empty string. This can cause inconsistent behavior in anything (such as plugins) that tests the machine id. | hashicorp_vagrant | train | rb |
77c1f1605f6977b8d46a33a44698104e37e7b21d | diff --git a/question/format.php b/question/format.php
index <HASH>..<HASH> 100644
--- a/question/format.php
+++ b/question/format.php
@@ -539,7 +539,10 @@ class qformat_default {
if (is_readable($filename)) {
$filearray = file($filename);
- /// Check for Macintosh OS line returns (ie file on one line), and fix
+ // If the first line of the file starts with a UTF-8 BOM, remove it.
+ $filearray[0] = textlib::trim_utf8_bom($filearray[0]);
+
+ // Check for Macintosh OS line returns (ie file on one line), and fix.
if (preg_match("~\r~", $filearray[0]) AND !preg_match("~\n~", $filearray[0])) {
return explode("\r", $filearray[0]);
} else { | MDL-<I> question import: strip UTF8 BOM
Previously, if there was a byte-order mark at the start of the file, the
import would just break, which was silly. Much better to just strip it
off. | moodle_moodle | train | php |
9c7878117f4fa881175520264695e8bd9c135b6a | diff --git a/errors.go b/errors.go
index <HASH>..<HASH> 100644
--- a/errors.go
+++ b/errors.go
@@ -1,12 +1,40 @@
package plugins
-import (
- "errors"
+type Error int
+
+func (e Error) Error() string {
+ if s, ok := errors[e]; ok {
+ return s
+ }
+
+ if e < 100 {
+ return "Unknown transmission error"
+ } else if e < 200 {
+ return "Unknown server error"
+ } else if e < 300 {
+ return "Unknown client error"
+ } else {
+ return "Unknown error"
+ }
+}
+
+var errors = map[Error]string{
+ Success: "No error. Everything is fine.",
+ NoSupportedFormat: "No supported formats in common",
+ Unblocking: "This is a unblocking recieve",
+ NotImplemented: "Operation is not implemented",
+ NotDirectory: "Path supplied is not a directory",
+}
+
+//Transmission errors
+const (
+ Success Error = iota
+ NoSupportedFormat
)
-var (
- NoSupportedFormat = errors.New("No supported formats in common")
- Unblocking = errors.New("This is a unblocking recieve")
- NotImplemented = errors.New("Operation is not implemented")
- NotDirectory = errors.New("Path supplied is not a directory")
+//Server errors
+const (
+ Unblocking Error = 100 + iota
+ NotImplemented
+ NotDirectory
) | Remade how errors is represented in preparation for sending them over the wire. | zephyyrr_plugins | train | go |
7450891119259cc250cae8a2616dbc6f6b316486 | diff --git a/palladium/tests/test_util.py b/palladium/tests/test_util.py
index <HASH>..<HASH> 100644
--- a/palladium/tests/test_util.py
+++ b/palladium/tests/test_util.py
@@ -315,9 +315,11 @@ class TestProcessStore:
def test_mtime_setitem(self, store):
dt0 = datetime.now()
store['somekey'] = '1'
+ sleep(0.001) # make sure that we're not too fast
dt1 = datetime.now()
assert dt0 < store.mtime['somekey'] < dt1
store['somekey'] = '2'
+ sleep(0.001) # make sure that we're not too fast
dt2 = datetime.now()
assert dt1 < store.mtime['somekey'] < dt2 | Test for mtime of ProcessStore is somtimes too fast, added sleep. | ottogroup_palladium | train | py |
ddc0bfdd30ced8880604ec81e9b87b9771ec994a | diff --git a/daemon_unix.go b/daemon_unix.go
index <HASH>..<HASH> 100644
--- a/daemon_unix.go
+++ b/daemon_unix.go
@@ -68,6 +68,13 @@ func (d *Context) search() (daemon *os.Process, err error) {
return
}
daemon, err = os.FindProcess(pid)
+ if err == nil && daemon != nil {
+ // Send a test signal to test if this daemon is actually alive or dead
+ // An error means it is dead
+ if daemon.Signal(syscall.Signal(0)) != nil {
+ daemon = nil
+ }
+ }
}
return
} | Fix search. Now it will only return a daemon pointer if it is live | sevlyar_go-daemon | train | go |
c5d15b87ae27bbead2713e2c0c2c791cb374f709 | diff --git a/libre/apps/data_drivers/exceptions.py b/libre/apps/data_drivers/exceptions.py
index <HASH>..<HASH> 100644
--- a/libre/apps/data_drivers/exceptions.py
+++ b/libre/apps/data_drivers/exceptions.py
@@ -1,2 +1,5 @@
-class Http400(Exception):
+from rest_framework.exceptions import ParseError
+
+
+class Http400(ParseError):
pass | Subclass rest framework ParseError and use it to drive LIBRE's Http<I> until it is renamed to LIBREParseError | commonwealth-of-puerto-rico_libre | train | py |
0a3b51ca4d4372b4c7eb26110eb85dd2dd87d2a6 | diff --git a/src/Controller/Component/AuthorizationComponent.php b/src/Controller/Component/AuthorizationComponent.php
index <HASH>..<HASH> 100644
--- a/src/Controller/Component/AuthorizationComponent.php
+++ b/src/Controller/Component/AuthorizationComponent.php
@@ -69,7 +69,14 @@ class AuthorizationComponent extends Component
return;
}
- throw new ForbiddenException([$action, is_object($resource) ? get_class($resource) : (is_string($resource) ? $resource : gettype($resource))]);
+ if (is_object($resource)) {
+ $name = get_class($resource);
+ } else if (is_string($resource)) {
+ $name = $resource;
+ } else {
+ $name = gettype($resource);
+ }
+ throw new ForbiddenException([$action, $name]);
}
/** | Split nested ternary operator into if else | cakephp_authorization | train | php |
a205cf84a0e1f4027bd200037d4056eed6980da6 | diff --git a/plugins/providers/virtualbox/action.rb b/plugins/providers/virtualbox/action.rb
index <HASH>..<HASH> 100644
--- a/plugins/providers/virtualbox/action.rb
+++ b/plugins/providers/virtualbox/action.rb
@@ -88,7 +88,6 @@ module VagrantPlugins
b2.use Call, DestroyConfirm do |env2, b3|
if env2[:result]
- b3.use ConfigValidate
b3.use CheckAccessible
b3.use EnvSet, :force_halt => true
b3.use action_halt | providers/virtualbox: don't require valid config on destroy [GH-<I>] | hashicorp_vagrant | train | rb |
f049ae440ea0f589edc9603bbe51ee5a89cd337e | diff --git a/test/constants.js b/test/constants.js
index <HASH>..<HASH> 100644
--- a/test/constants.js
+++ b/test/constants.js
@@ -38,6 +38,7 @@ describe("constants", function () {
// Must be one of these
assert(-1 !== [
gpf.hosts.browser,
+ gpf.hosts.nashorn,
gpf.hosts.nodejs,
gpf.hosts.phantomjs,
gpf.hosts.rhino, | Nashorn support (#<I>) | ArnaudBuchholz_gpf-js | train | js |
e5903f8a98bf14713fa47705938f6da675f33207 | diff --git a/lib/thumbsniper/shared/Target.php b/lib/thumbsniper/shared/Target.php
index <HASH>..<HASH> 100644
--- a/lib/thumbsniper/shared/Target.php
+++ b/lib/thumbsniper/shared/Target.php
@@ -48,6 +48,9 @@ class Target
private $tsLastRequested;
/** @var int */
+ private $tsLastFailed;
+
+ /** @var int */
private $tsCheckedOut;
/** @var int */
@@ -278,6 +281,22 @@ class Target
/**
* @return int
*/
+ public function getTsLastFailed()
+ {
+ return $this->tsLastFailed;
+ }
+
+ /**
+ * @param int $tsLastFailed
+ */
+ public function setTsLastFailed($tsLastFailed)
+ {
+ $this->tsLastFailed = $tsLastFailed;
+ }
+
+ /**
+ * @return int
+ */
public function getTsCheckedOut()
{
return $this->tsCheckedOut; | add tsLastFailed field | thumbsniper_shared-libs | train | php |
dac23ccfdc6314b048c83b7e0e5a5237121f46a2 | diff --git a/webapps/webapp/src/test/js/e2e/ci.conf.js b/webapps/webapp/src/test/js/e2e/ci.conf.js
index <HASH>..<HASH> 100644
--- a/webapps/webapp/src/test/js/e2e/ci.conf.js
+++ b/webapps/webapp/src/test/js/e2e/ci.conf.js
@@ -39,7 +39,7 @@ exports.config = {
'tasklist/specs/filter-spec.js',
'tasklist/specs/process-start-spec.js',
'tasklist/specs/tasklist-sorting-spec.js'
- 'tasklist/specs/tasklist-search-spec.js',
+ 'tasklist/specs/tasklist-search-spec.js'
],
// A base URL for your application under test. Calls to protractor.get() | fix(e2e): remove wasted comma in ci.conf | camunda_camunda-bpm-platform | train | js |
d4681907e9413a91c2cdb6b097a6be7cf1a1b183 | diff --git a/aioftp/__main__.py b/aioftp/__main__.py
index <HASH>..<HASH> 100644
--- a/aioftp/__main__.py
+++ b/aioftp/__main__.py
@@ -58,7 +58,7 @@ family = {
async def main():
server = aioftp.Server([user], path_io_factory=path_io_factory)
- await server.run()
+ await server.run(args.host, args.port, family=family)
with contextlib.suppress(KeyboardInterrupt): | server: add missed host, port and family args | aio-libs_aioftp | train | py |
f5f666eb8466554ec4184c46d0862c50878959f8 | diff --git a/LeanMapper/Reflection/PropertyFactory.php b/LeanMapper/Reflection/PropertyFactory.php
index <HASH>..<HASH> 100644
--- a/LeanMapper/Reflection/PropertyFactory.php
+++ b/LeanMapper/Reflection/PropertyFactory.php
@@ -68,6 +68,9 @@ class PropertyFactory
$propertyType = new PropertyType($matches[2], $aliases);
$isWritable = $annotationType === 'property';
$containsCollection = $matches[3] !== '';
+ if ($propertyType->isBasicType() and $containsCollection) {
+ throw new InvalidAnnotationException("Invalid property type definition given: @$annotationType $annotation in entity {$entityReflection->getName()}. Lean Mapper doesn't support <type>[] notation for basic types.");
+ }
$isNullable = ($matches[1] !== '' or $matches[4] !== '');
$name = substr($matches[5], 1); | Improved error message when [] notation is used with basic type in @property annotation | Tharos_LeanMapper | train | php |
14fb680891f02ff92250b18ac3b8f18c1069bda1 | diff --git a/py/h2o_glm.py b/py/h2o_glm.py
index <HASH>..<HASH> 100644
--- a/py/h2o_glm.py
+++ b/py/h2o_glm.py
@@ -17,12 +17,17 @@ def pickRandGlmParams(paramDict, params):
maxCase = max(paramDict['case'])
minCase = min(paramDict['case'])
# make sure the combo of case and case_mode makes sense
+ # there needs to be some entries in both effective cases
if ('case_mode' in params):
if ('case' not in params) or (params['case'] is None):
params['case'] = 1
- if params['case_mode']=="<" and params['case']==minCase:
+ elif params['case_mode']=="<" and params['case']==minCase:
params['case'] += 1
- if params['case_mode']==">" and params['case']==maxCase:
+ elif params['case_mode']==">" and params['case']==maxCase:
+ params['case'] -= 1
+ elif params['case_mode']==">=" and params['case']==minCase:
+ params['case'] += 1
+ elif params['case_mode']=="<=" and params['case']==maxCase:
params['case'] -= 1
return colX | eliminate more case/case_num combos that result in only one value of effective output | h2oai_h2o-2 | train | py |
8dd80df90cd29f0b911bf2984bcb9ee2f627029d | diff --git a/tests/SensioLabs/Connect/Tests/Api/Entity/AbstractEntityTest.php b/tests/SensioLabs/Connect/Tests/Api/Entity/AbstractEntityTest.php
index <HASH>..<HASH> 100644
--- a/tests/SensioLabs/Connect/Tests/Api/Entity/AbstractEntityTest.php
+++ b/tests/SensioLabs/Connect/Tests/Api/Entity/AbstractEntityTest.php
@@ -39,6 +39,20 @@ class AbstractEntityTest extends \PHPUnit_Framework_TestCase
$this->assertSame($api, $this->entity->get('clone')->getApi());
}
+ public function testApiIsNotSerialized()
+ {
+ $api = $this->getMockBuilder('SensioLabs\Connect\Api\Api')
+ ->disableOriginalConstructor()
+ ->getMock();
+
+ $this->entity->setApi($api);
+
+ $unserializedEntity = unserialize(serialize($this->entity));
+
+ $this->assertInstanceOf(get_class($this->entity), $unserializedEntity);
+ $this->assertNull($unserializedEntity->getApi());
+ }
+
public function testHas()
{
$this->assertFalse($this->entity->has('foobar')); | Added tests for entities serialization (related to #<I>) | symfonycorp_connect | train | php |
124fdb84abe7e0ef5e9ffde874e1e8ca2ed9af59 | diff --git a/sprd/view/svg/BendingTextConfigurationUploadRendererClass.js b/sprd/view/svg/BendingTextConfigurationUploadRendererClass.js
index <HASH>..<HASH> 100644
--- a/sprd/view/svg/BendingTextConfigurationUploadRendererClass.js
+++ b/sprd/view/svg/BendingTextConfigurationUploadRendererClass.js
@@ -4,7 +4,7 @@ define(['js/svg/Svg'], function(Svg) {
defaults: {
configuration: null,
- width: "{width()}mm"
+ width: "{widthInMM()}mm"
},
ctor: function() { | Fix uploading bending text to designer service. Renamed width partly. | spreadshirt_rAppid.js-sprd | train | js |
8de2f091aa589e345aab2f596edc05312d6cf058 | diff --git a/src/Controller/DashboardPluginsController.php b/src/Controller/DashboardPluginsController.php
index <HASH>..<HASH> 100644
--- a/src/Controller/DashboardPluginsController.php
+++ b/src/Controller/DashboardPluginsController.php
@@ -155,7 +155,7 @@ class DashboardPluginsController extends MelisAbstractActionController
{
// return plugin view
$request = $this->getRequest();
- $pluginConfigPost = get_object_vars($request->getPost());
+ $pluginConfigPost = $request->getPost()->toArray();
/**
* decode the string | get_object_vars on post fixed | melisplatform_melis-core | train | php |
9fcf7021f5fd13d2b0cebc16c763818e4bf182d3 | diff --git a/src/helpers.php b/src/helpers.php
index <HASH>..<HASH> 100644
--- a/src/helpers.php
+++ b/src/helpers.php
@@ -12,7 +12,7 @@ if (! function_exists('assetic')) {
{
try {
return elixir($file);
- } catch (InvalidArgumentException $e) {
+ } catch (Exception $e) {
return $file;
}
} | assetic() method should handle both InvalidArgumentException and
ErrorException. | orchestral_foundation | train | php |
b841f3094d6976dffc03e2469771e73c17e57f84 | diff --git a/ciscosparkapi/api/memberships.py b/ciscosparkapi/api/memberships.py
index <HASH>..<HASH> 100644
--- a/ciscosparkapi/api/memberships.py
+++ b/ciscosparkapi/api/memberships.py
@@ -251,11 +251,13 @@ class MembershipsAPI(object):
return Membership(json_data)
def update(self, membershipId, isModerator=None, **request_parameters):
- """Updates properties for a membership, by ID.
+ """Update properties for a membership, by ID.
Args:
membershipId(basestring): The membership ID.
isModerator(bool): Set to True to make the person a room moderator.
+ **request_parameters: Additional request parameters (provides
+ support for parameters that may be added in the future).
Returns:
Membership: A Membership object with the updated Spark membership
@@ -276,7 +278,7 @@ class MembershipsAPI(object):
# API request
json_data = self._session.put('memberships/' + membershipId,
- json=put_data)
+ json=put_data)
# Return a Membership object created from the response JSON data
return Membership(json_data) | Update indentation and docstrings | CiscoDevNet_webexteamssdk | train | py |
766900b9f3757da543262bbd23946b54811822f0 | diff --git a/src/server/pfs/server/server_test.go b/src/server/pfs/server/server_test.go
index <HASH>..<HASH> 100644
--- a/src/server/pfs/server/server_test.go
+++ b/src/server/pfs/server/server_test.go
@@ -1231,7 +1231,10 @@ func TestFlush(t *testing.T) {
}()
// Flush ACommit
- commitInfos, err := client.FlushCommit(
+ commitInfos, err := client.FlushCommit([]*pfsclient.Commit{pclient.NewCommit("A", ACommit.ID)}, nil)
+ require.NoError(t, err)
+ require.Equal(t, 3, len(commitInfos))
+ commitInfos, err = client.FlushCommit(
[]*pfsclient.Commit{pclient.NewCommit("A", ACommit.ID)},
[]*pfsclient.Repo{pclient.NewRepo("C")},
) | Extend test for Flush a bit. | pachyderm_pachyderm | train | go |
e87ea9c790f1733b4eeea45b732bcaa70de442aa | diff --git a/notify.go b/notify.go
index <HASH>..<HASH> 100644
--- a/notify.go
+++ b/notify.go
@@ -7,11 +7,9 @@ type notifier interface {
Stop(chan<- EventInfo)
}
-func newNotifier(w watcher, c <-chan EventInfo) notifier {
+func newNotifier(w watcher, c chan EventInfo) notifier {
if rw, ok := w.(recursiveWatcher); ok {
- // return NewRecursiveTree(rw, c)
- _ = rw // TODO
- return newTree(w, c)
+ return newRecursiveTree(rw, c)
}
return newTree(w, c)
} | use recursiveTree by default for recursive wathers
closes #6 | rjeczalik_notify | train | go |
f7a1cbb4d9f8a6a95886a9914493f85cb5de6c78 | diff --git a/bugwarrior/db.py b/bugwarrior/db.py
index <HASH>..<HASH> 100644
--- a/bugwarrior/db.py
+++ b/bugwarrior/db.py
@@ -227,7 +227,6 @@ def merge_left(field, local_task, remote_issue, hamming=False):
# If a remote does not appear in local, add it to the local task
new_count = 0
for remote in remote_field:
- found = False
for local in local_field:
if (
# For annotations, they don't have to match *exactly*.
@@ -240,9 +239,8 @@ def merge_left(field, local_task, remote_issue, hamming=False):
remote == local
)
):
- found = True
break
- if not found:
+ else:
log.debug("%s not found in %r" % (remote, local_field))
local_task[field].append(remote)
new_count += 1 | Don't re-implement for/else control flow. | ralphbean_bugwarrior | train | py |
b4bb1ed8e4ceed859f61ce09de81b45d4ce5f94a | diff --git a/reactor-core/src/main/java/reactor/core/publisher/Operators.java b/reactor-core/src/main/java/reactor/core/publisher/Operators.java
index <HASH>..<HASH> 100644
--- a/reactor-core/src/main/java/reactor/core/publisher/Operators.java
+++ b/reactor-core/src/main/java/reactor/core/publisher/Operators.java
@@ -786,14 +786,12 @@ public abstract class Operators {
@SuppressWarnings("unchecked")
public static <T> CorePublisher<T> onLastAssembly(CorePublisher<T> source) {
Function<Publisher, Publisher> hook = Hooks.onLastOperatorHook;
- final Publisher<T> publisher;
if (hook == null) {
- publisher = source;
- }
- else {
- publisher = Objects.requireNonNull(hook.apply(source),"LastOperator hook returned null");
+ return source;
}
+ Publisher<T> publisher = Objects.requireNonNull(hook.apply(source),"LastOperator hook returned null");
+
if (publisher instanceof CorePublisher) {
return (CorePublisher<T>) publisher;
} | Avoid `instanceof` check in `onLastAssembly` if the hook is null (#<I>)
Since if the hook is null we're not changing the publisher,
we can return it "as is" without any additional check and avoid the instanceof check. | reactor_reactor-core | train | java |
f9d5e4bab4b69dbfbb92a4140028e4455b4bb421 | diff --git a/lib/dexter/indexer.rb b/lib/dexter/indexer.rb
index <HASH>..<HASH> 100644
--- a/lib/dexter/indexer.rb
+++ b/lib/dexter/indexer.rb
@@ -527,7 +527,7 @@ module Dexter
# as an extra defense against SQL-injection attacks.
# https://www.postgresql.org/docs/current/static/libpq-exec.html
query = squish(query) if pretty
- log colorize("SQL: #{query}", :cyan) if @log_sql
+ log colorize("[sql] #{query}", :cyan) if @log_sql
@mutex.synchronize do
conn.exec_params(query, []).to_a | Improved SQL output [skip ci] | ankane_dexter | train | rb |
352932653b588f9646d4a8697544b6063d6ddf4e | diff --git a/spec/javascripts/unit/connection/protocol_wrapper_spec.js b/spec/javascripts/unit/connection/protocol_wrapper_spec.js
index <HASH>..<HASH> 100644
--- a/spec/javascripts/unit/connection/protocol_wrapper_spec.js
+++ b/spec/javascripts/unit/connection/protocol_wrapper_spec.js
@@ -244,8 +244,12 @@ describe("ProtocolWrapper", function() {
});
it("should emit an error after receiving invalid JSON", function() {
+ var error = {};
+
var onMessage = jasmine.createSpy("onMessage");
- var onError = jasmine.createSpy("onError");
+ var onError = jasmine.createSpy("onError").andCallFake(function(e) {
+ error = e;
+ });
this.wrapper.bind("message", onMessage);
this.wrapper.bind("error", onError);
@@ -253,11 +257,8 @@ describe("ProtocolWrapper", function() {
data: "this is not json"
})
expect(onMessage).not.toHaveBeenCalled();
- expect(onError).toHaveBeenCalledWith({
- type: "MessageParseError",
- error: {},
- data: "this is not json"
- });
+ expect(error.type).toEqual("MessageParseError");
+ expect(error.data).toEqual("this is not json");
});
}); | Fix JSON error test to work on all browsers | pusher_pusher-js | train | js |
869dac775e07638429a7022493e8ccfd4a1f4411 | diff --git a/ActiveRecord.php b/ActiveRecord.php
index <HASH>..<HASH> 100644
--- a/ActiveRecord.php
+++ b/ActiveRecord.php
@@ -4,6 +4,28 @@ namespace kato;
class ActiveRecord extends \yii\db\ActiveRecord
{
+
+ /**
+ * Attached Content Media, by type
+ * @return static
+ */
+ public function getContentMedia()
+ {
+ return $this->hasMany(\backend\models\ContentMedia::className(), ['content_id' => 'id'])
+ ->where('media_type = :type', [':type' => $this->className()]);
+ }
+
+ /**
+ * Relate Media
+ * Usage: $model->media();
+ * @return static
+ */
+ public function getMedia()
+ {
+ return $this->hasMany(\backend\models\Media::className(), ['id' => 'media_id'])
+ ->via('contentMedia');
+ }
+
/**
* Actions to be taken before saving the record.
* @param bool $insert | Added model relation to activerecords | perminder-klair_kato-core | train | php |
8dba93210c61823d4845cbff2f35cace6d0a93bd | diff --git a/law/decorator.py b/law/decorator.py
index <HASH>..<HASH> 100644
--- a/law/decorator.py
+++ b/law/decorator.py
@@ -476,10 +476,14 @@ def localize(fn, opts, task, *args, **kwargs):
input_kwargs = opts["input_kwargs"] or {}
output_kwargs = opts["output_kwargs"] or {}
+ # default modes
+ input_kwargs.setdefault("mode", "r")
+ output_kwargs.setdefault("mode", "w")
+
try:
# localize both target structs
- with localize_file_targets(input_struct, "r", **input_kwargs) as localized_inputs, \
- localize_file_targets(output_struct, "w", **output_kwargs) as localized_outputs:
+ with localize_file_targets(input_struct, **input_kwargs) as localized_inputs, \
+ localize_file_targets(output_struct, **output_kwargs) as localized_outputs:
# patch the input method to always return the localized inputs
if opts["input"]:
def input_patched(self): | Make file modes in localize decorator configurable. | riga_law | train | py |
0d798319179f6bda5866f904c5b9768ee56972e9 | diff --git a/spec/pcore/arith_spec.rb b/spec/pcore/arith_spec.rb
index <HASH>..<HASH> 100644
--- a/spec/pcore/arith_spec.rb
+++ b/spec/pcore/arith_spec.rb
@@ -70,9 +70,12 @@ describe 'Flor procedures' do
+ 1 "nada"
})
- expect(r['point']).to eq('failed')
- expect(r['error']['kla']).to eq('TypeError')
- expect(r['error']['msg']).to eq("String can't be coerced into Integer")
+ expect(r['point']
+ ).to eq('failed')
+ expect(r['error']['kla']
+ ).to eq('TypeError')
+ expect(r['error']['msg']
+ ).to match(/\AString can't be coerced into (Integer|Fixnum)\z/)
end
it 'turns numbers intro strings when adding to a strings' do | Tighten "+" fail spec | floraison_flor | train | rb |
52e3eb6874d04fcb9677bef90c3b1bcc7f3c8f54 | diff --git a/pyghmi/ipmi/oem/lookup.py b/pyghmi/ipmi/oem/lookup.py
index <HASH>..<HASH> 100755
--- a/pyghmi/ipmi/oem/lookup.py
+++ b/pyghmi/ipmi/oem/lookup.py
@@ -21,8 +21,6 @@ import pyghmi.ipmi.oem.lenovo.handler as lenovo
oemmap = {
20301: lenovo, # IBM x86 (and System X at Lenovo)
19046: lenovo, # Lenovo x86 (e.g. Thinkserver)
- 7154: lenovo, # Technically, standard IPMI, but give lenovo a chance
- # to check for MegaRAC
} | Do not hook generic vendor identifier
A prerelease system was using <I> vendor id internally,
but this is not going to be the case when released. Stop
hooking generic value to avoid being overly aggressive.
Change-Id: I<I>e<I>c<I>b<I>c9a4a<I>eaa1de<I>c<I> | openstack_pyghmi | train | py |
f38da0342f3f800706815f1440e9b18d223d1c48 | diff --git a/search/documents/user_document.php b/search/documents/user_document.php
index <HASH>..<HASH> 100644
--- a/search/documents/user_document.php
+++ b/search/documents/user_document.php
@@ -284,14 +284,14 @@ function user_single_document($id, $itemtype) {
return new UserSearchDocument($userhash, $user->id, 'user', null);
}
} elseif ($itemtype == 'post') {
- if ($post = $DB->get_records('post', array('id' => $id))){
+ if ($post = $DB->get_record('post', array('id' => $id))){
$texts = array();
$texts[] = $post->subject;
$texts[] = $post->summary;
$texts[] = $post->content;
$post->description = implode(" ", $texts);
$posthash = get_object_vars($post);
- return new UserPostSearchDocument($posthash, $user->id, 'post', null);
+ return new UserPostSearchDocument($posthash, $post->userid, 'post', null);
}
} elseif ($itemtype == 'attachment' && @$CFG->block_search_enable_file_indexing) {
if ($post = $DB->get_records('post', array('id' => $id))){ | global search MDL-<I> fixes to blog posts search documents so that it will add new posts into the search index successfully | moodle_moodle | train | php |
495ad6654643ee7cfc500a174d36fe67eb8970b1 | diff --git a/spec/unit/util/filetype.rb b/spec/unit/util/filetype.rb
index <HASH>..<HASH> 100644
--- a/spec/unit/util/filetype.rb
+++ b/spec/unit/util/filetype.rb
@@ -27,20 +27,10 @@ describe Puppet::Util::FileType do
@file.backup
end
- it "should use the filebucket named 'puppet' if it finds one" do
+ it "should use the default filebucket" do
bucket = mock 'bucket'
bucket.expects(:bucket).returns "mybucket"
- Puppet::Type.type(:filebucket).expects(:[]).with("puppet").returns bucket
-
- @file.bucket.should == "mybucket"
- end
-
- it "should use the default filebucket if none named 'puppet' is found" do
- bucket = mock 'bucket'
- bucket.expects(:bucket).returns "mybucket"
-
- Puppet::Type.type(:filebucket).expects(:[]).with("puppet").returns nil
Puppet::Type.type(:filebucket).expects(:mkdefaultbucket).returns bucket
@file.bucket.should == "mybucket" | Fixing broken filetype tests resulting from the loss of Type[] | puppetlabs_puppet | train | rb |
a03ff8d09ef2f1d55284b8797dd5b9a95b19f917 | diff --git a/NewIntegrationTest.py b/NewIntegrationTest.py
index <HASH>..<HASH> 100644
--- a/NewIntegrationTest.py
+++ b/NewIntegrationTest.py
@@ -226,7 +226,7 @@ class Repository( TestCase ):
self.assertEqual( self.r.html_url, "https://github.com/jacquev6/PyGithub" )
self.assertEqual( self.r.id, 3544490 )
self.assertEqual( self.r.language, "Python" )
- self.assertEqual( self.r.master_branch, None ) ### @todo Why does this trigger a new request to github ?
+ self.assertEqual( self.r.master_branch, None ) ### @todo Why does this trigger a new request to github ? Because the object does not know that it is already completed, and it tries to de-None-ify master_branch
self.assertEqual( self.r.mirror_url, None )
self.assertEqual( self.r.name, "PyGithub" )
self.assertEqual( self.r.open_issues, 15 ) | Explanation about a todo | PyGithub_PyGithub | train | py |
2c75e1f6cae30c8d6f44eabf4dc2863bcfe4ced0 | diff --git a/lib/classes/Variables.js b/lib/classes/Variables.js
index <HASH>..<HASH> 100644
--- a/lib/classes/Variables.js
+++ b/lib/classes/Variables.js
@@ -828,10 +828,10 @@ class Variables {
}
getValueToBool(variableString) {
- if (/^true$/.test(variableString)) {
+ if (/^toBool:true$/.test(variableString)) {
return BbPromise.resolve(true);
}
- else if (/^false$/.test(variableString)) {
+ else if (/^toBool:false$/.test(variableString)) {
return BbPromise.resolve(false);
}
return BbPromise.resolve(true); | Bug fix in toBool casting | serverless_serverless | train | js |
6cfd5b674f7bc8060cf0c8acabe24d4ec9b0bd79 | diff --git a/blueflood-kafka/src/main/java/com/rackspacecloud/blueflood/kafkaproducer/KafkaConfig.java b/blueflood-kafka/src/main/java/com/rackspacecloud/blueflood/kafkaproducer/KafkaConfig.java
index <HASH>..<HASH> 100644
--- a/blueflood-kafka/src/main/java/com/rackspacecloud/blueflood/kafkaproducer/KafkaConfig.java
+++ b/blueflood-kafka/src/main/java/com/rackspacecloud/blueflood/kafkaproducer/KafkaConfig.java
@@ -31,7 +31,7 @@ class KafkaConfig {
try {
init();
} catch (IOException ex) {
- log.error("Error encountered while loading the Kafka Config");
+ log.error("Error encountered while loading the Kafka Config", ex);
throw new RuntimeException(ex);
}
} | Log exceptions while loading configs | rackerlabs_blueflood | train | java |
8c4162f0bbb111699dd38705994ea00c9627a872 | diff --git a/src/js/Node.js b/src/js/Node.js
index <HASH>..<HASH> 100644
--- a/src/js/Node.js
+++ b/src/js/Node.js
@@ -68,7 +68,7 @@ define(['./ContextMenu', './appendNodeFactory', './util'], function (ContextMenu
var node = this;
var path = [];
while (node) {
- var field = node.field || node.index;
+ var field = node.field != undefined ? node.field : node.index;
if (field !== undefined) {
path.unshift(field);
} | Use `""` as valid path in JSON - fix for josdejong/jsoneditor#<I> | josdejong_jsoneditor | train | js |
2a0c96273e2f187dc5eff1e173cff004e6d6e192 | diff --git a/core/src/main/java/org/xillium/core/util/RemoteService.java b/core/src/main/java/org/xillium/core/util/RemoteService.java
index <HASH>..<HASH> 100644
--- a/core/src/main/java/org/xillium/core/util/RemoteService.java
+++ b/core/src/main/java/org/xillium/core/util/RemoteService.java
@@ -74,6 +74,7 @@ public class RemoteService {
URL url = new URL(server + '/' + service);
URLConnection connection = url.openConnection();
connection.setDoOutput(true);
+ connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded;charset=utf-8");
PrintWriter pw = new PrintWriter(connection.getOutputStream());
for (String param: params) {
_logger.fine(param); | force charset=utf-8 when making URLConnection | brianwhu_xillium | train | java |
8e88594c039c8ee5c08449ad257c3f2420df8d40 | diff --git a/pbs.py b/pbs.py
index <HASH>..<HASH> 100644
--- a/pbs.py
+++ b/pbs.py
@@ -362,7 +362,7 @@ def run_repl(env):
try: line = raw_input("pbs> ")
except (ValueError, EOFError): break
- try: exec compile(line, "<dummy>", "single") in env, env
+ try: exec(compile(line, "<dummy>", "single"), env, env)
except SystemExit: break
except: print(traceback.format_exc())
@@ -428,7 +428,7 @@ from anywhere other than a stand-alone script. Do a 'from pbs import program' i
source = "".join(source)
exit_code = 0
- try: exec source in env, env
+ try: exec(source, env, env)
except SystemExit, e: exit_code = e.code
except: print(traceback.format_exc()) | exec -> py2/3 | amoffat_sh | train | py |
73175a138690cf2570ce11c24a6c384b14fd1a4f | diff --git a/Raven/Raven.php b/Raven/Raven.php
index <HASH>..<HASH> 100644
--- a/Raven/Raven.php
+++ b/Raven/Raven.php
@@ -2,6 +2,7 @@
namespace Kunstmaan\SentryBundle\Raven;
use Raven_Client;
+use Symfony\Component\HttpKernel\Kernel;
/**
* Raven
@@ -26,6 +27,11 @@ class Raven extends Raven_Client
if (isset($_SERVER["SERVER_NAME"])) {
$options['name'] = $_SERVER["SERVER_NAME"];
}
+ $options['tags'] = array(
+ 'php_version' => phpversion(),
+ 'symfony_version' => Kernel::VERSION
+ );
+ $options['trace'] = true;
parent::__construct($dsn, $options);
} | Update the integration with raven to use the latest features in Raven | KunstmaanLegacy_KunstmaanSentryBundle | train | php |
995a4c3fe00b7d7cb69cf1e76ed9183c86c3316b | diff --git a/freemius/includes/class-freemius.php b/freemius/includes/class-freemius.php
index <HASH>..<HASH> 100644
--- a/freemius/includes/class-freemius.php
+++ b/freemius/includes/class-freemius.php
@@ -5082,6 +5082,9 @@
// Sync licenses.
$this->_sync_licenses();
+ // Sync plans.
+ $this->_sync_plans();
+
// Check if plan / license changed.
if ( ! FS_Entity::equals( $site->plan, $this->_site->plan ) ||
// Check if trial started. | [plans] [caching] [bug-fix] Sync plans once in <I> hours, otherwise dashboard changes are never populated to the plugin's licensing logic. | Freemius_wordpress-sdk | train | php |
0df69b7d3e05c9e2b0eb74e75c63e60deffd4558 | diff --git a/src/PasswordHasherFactory.php b/src/PasswordHasherFactory.php
index <HASH>..<HASH> 100644
--- a/src/PasswordHasherFactory.php
+++ b/src/PasswordHasherFactory.php
@@ -14,7 +14,8 @@
*/
namespace Auth;
-use Auth\PasswordHasher\PasswordHasherInterface;
+use Auth\PasswordHasher\AbstractPasswordHasher;
+use Cake\Core\App;
use RuntimeException;
/**
@@ -43,9 +44,14 @@ class PasswordHasherFactory
unset($config['className']);
}
- $hasher = new $class($config);
- if (!($hasher instanceof PasswordHasherInterface)) {
- throw new RuntimeException('Password hasher must implment PasswordHasherInterface.');
+ $className = App::className($class, 'Auth\PasswordHasher', 'PasswordHasher');
+ if ($className === false) {
+ throw new RuntimeException(sprintf('Password hasher class "%s" was not found.', $class));
+ }
+
+ $hasher = new $className($config);
+ if (!($hasher instanceof AbstractPasswordHasher)) {
+ throw new RuntimeException('Password hasher must extend AbstractPasswordHasher class.');
}
return $hasher; | Updating the PasswordHasherFactory | cakephp_authentication | train | php |
63b1e8e59b9a4cc2772c378ac20998b04e90bb21 | diff --git a/src/test/java/org/cactoos/iterator/PartitionedTest.java b/src/test/java/org/cactoos/iterator/PartitionedTest.java
index <HASH>..<HASH> 100644
--- a/src/test/java/org/cactoos/iterator/PartitionedTest.java
+++ b/src/test/java/org/cactoos/iterator/PartitionedTest.java
@@ -55,6 +55,7 @@ public final class PartitionedTest {
}
@Test
+ @SuppressWarnings("unchecked")
public void partitionedOne() {
MatcherAssert.assertThat(
"Can't generate a Partitioned of partition size 1.",
@@ -73,6 +74,7 @@ public final class PartitionedTest {
}
@Test
+ @SuppressWarnings("unchecked")
public void partitionedEqualSize() {
MatcherAssert.assertThat(
"Can't generate a Partitioned of partition size 2.", | fix remaining checkstyle warnings with suppress annotation | yegor256_cactoos | train | java |
944a3c9c2d45fc32520a0f78c68db29adc0e6752 | diff --git a/Branch-SDK/src/io/branch/referral/SystemObserver.java b/Branch-SDK/src/io/branch/referral/SystemObserver.java
index <HASH>..<HASH> 100644
--- a/Branch-SDK/src/io/branch/referral/SystemObserver.java
+++ b/Branch-SDK/src/io/branch/referral/SystemObserver.java
@@ -533,7 +533,7 @@ public class SystemObserver {
public int getUpdateState(boolean updatePrefs) {
PrefHelper pHelper = PrefHelper.getInstance(context_);
String currAppVersion = getAppVersion();
- if (pHelper.getAppVersion() == PrefHelper.NO_STRING_VALUE) {
+ if (PrefHelper.NO_STRING_VALUE.equals(pHelper.getAppVersion())) {
// if no app version is in storage, this must be the first time Branch is here
if (updatePrefs) {
pHelper.setAppVersion(currAppVersion); | Never. Ever. Do. This.
Equality check in Java will do a reference equality on == for strings.
You almost always want to use .equals which calls into value equality
check. | BranchMetrics_android-branch-deep-linking | train | java |
9df025c0530d6347ebf84e5a8e9558707c620484 | diff --git a/classes/ServiceProvider.php b/classes/ServiceProvider.php
index <HASH>..<HASH> 100644
--- a/classes/ServiceProvider.php
+++ b/classes/ServiceProvider.php
@@ -29,7 +29,8 @@ class ServiceProvider extends BaseServiceProvider {
$this->registerDirectories();
// Register the routes.
- if (!$this->app->routesAreCached()) {
+ if (config('decoy.core.register_routes')
+ && !$this->app->routesAreCached()) {
$this->app['decoy.router']->registerAll();
}
diff --git a/config/core.php b/config/core.php
index <HASH>..<HASH> 100644
--- a/config/core.php
+++ b/config/core.php
@@ -25,4 +25,9 @@
// Allow regex in redirect rules
'allow_regex_in_redirects' => false,
+ // Register routes automatically in ServiceProvider->boot(). You might set
+ // this to false if the App needed to register some /admin routes and didn't
+ // want them to get trampled by the Decoy wildcard capture.
+ 'register_routes' => true,
+
); | Adding a config that can be used to disable the automatic registration of routes
#<I> | BKWLD_decoy | train | php,php |
67eb9a9efba5e67a8a36748ebb7c44d50791edf8 | diff --git a/src/Controller/Controller.php b/src/Controller/Controller.php
index <HASH>..<HASH> 100644
--- a/src/Controller/Controller.php
+++ b/src/Controller/Controller.php
@@ -62,7 +62,6 @@ use Cake\View\ViewVarsTrait;
* a redirect is done.
* - `afterFilter(Event $event)` - Called after each action is complete and after the view is rendered.
*
- * @property \Cake\Controller\Component\AclComponent $Acl
* @property \Cake\Controller\Component\AuthComponent $Auth
* @property \Cake\Controller\Component\CookieComponent $Cookie
* @property \Cake\Controller\Component\CsrfComponent $Csrf | Deleted @property reference to removed AclComponent
Was forgotten in <URL> | cakephp_cakephp | train | php |
be29193c5d74e6b95d32bb18b3abebf3ba10d2e6 | diff --git a/src/main/java/skadistats/clarity/processor/entities/Entities.java b/src/main/java/skadistats/clarity/processor/entities/Entities.java
index <HASH>..<HASH> 100644
--- a/src/main/java/skadistats/clarity/processor/entities/Entities.java
+++ b/src/main/java/skadistats/clarity/processor/entities/Entities.java
@@ -418,7 +418,7 @@ public class Entities {
}
private void emitCreatedEvent(Entity entity) {
- if (resetInProgress || !evUpdated.isListenedTo()) return;
+ if (resetInProgress || !evCreated.isListenedTo()) return;
debugUpdateEvent("CREATE", entity);
evCreated.raise(entity);
} | Fix bug where EntityCreated would only be raised if EntityUpdated was listened to | skadistats_clarity | train | java |
f3f700a90f5c03300331f0ef55616ee211bbe423 | diff --git a/datatableview/helpers.py b/datatableview/helpers.py
index <HASH>..<HASH> 100644
--- a/datatableview/helpers.py
+++ b/datatableview/helpers.py
@@ -88,6 +88,7 @@ def link_to_model(instance, text=None, *args, **kwargs):
@keyed_helper
def make_boolean_checkmark(value, true_value="✔", false_value="✘", *args, **kwargs):
+ value = kwargs.get('default_value', value)
if value:
return true_value
return false_value | Fix bug with make_boolean_checkmark's value
One had to always use a key function to get the right value from it as
a column callback. | pivotal-energy-solutions_django-datatable-view | train | py |
412d4c70b330e849726b0e042afbf00003a4037b | diff --git a/packages/origin.js/src/index.js b/packages/origin.js/src/index.js
index <HASH>..<HASH> 100644
--- a/packages/origin.js/src/index.js
+++ b/packages/origin.js/src/index.js
@@ -9,13 +9,6 @@ var resources = {
class Origin {
constructor() {
- // Give each resource access to the origin services.
- // By having a single origin, its configuration can be changed
- // and all contracts will follow it
- for (let resourceName in resources) {
- resources[resourceName].origin = this
- this[resourceName] = resources[resourceName]
- }
this.contractService = new ContractService()
this.ipfsService = new IpfsService()
this.originService = new OriginService({
@@ -23,6 +16,15 @@ class Origin {
ipfsService: this.ipfsService
})
this.userRegistryService = new UserRegistryService()
+
+ // Instantiate each resource and give it access to contracts and IPFS
+ for (let resourceName in resources) {
+ let Resource = resources[resourceName]
+ this[resourceName] = new Resource({
+ contractService: this.contractService,
+ ipfsService: this.ipfsService
+ })
+ }
}
} | Instantiate each resource with access to ipfs and contract services
This no longer gives resources access to a global `origin` object.
Shared global objects are generally a bad idea, creating a cluttered
design that implies that all of these things will be used together. This
makes things more modular which will make it more extensible and also
simplify testing. | OriginProtocol_origin-js | train | js |
a23ec6ff648f95cfd23b99c1caf6e399c43b8560 | diff --git a/router.go b/router.go
index <HASH>..<HASH> 100644
--- a/router.go
+++ b/router.go
@@ -68,12 +68,21 @@ func (r *Router) addRoute(m, p, t string, fn Handle) {
// needed
if r.parent != nil {
// We have a subrouter, let the main router handle it
- r.parent.router.Handle(m, path, wf)
+ r.getRoot().router.Handle(m, path, wf)
} else {
r.router.Handle(m, path, wf)
}
}
+// getRoot returns the root router
+func (r *Router) getRoot() *Router {
+ if r.parent != nil {
+ return r.parent.getRoot()
+ }
+
+ return r
+}
+
// Get adds a GET route
func (r *Router) Get(path, title string, fn Handle) {
r.addRoute("GET", path, title, fn) | Add getRoot to get top level router | bahlo_goat | train | go |
89a036a375abef71c1fdf014d5f2e22f9de29504 | diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -1,10 +1,14 @@
from setuptools import setup
+from sys import version_info
with open('README.rst') as f:
long_description = f.read()
+install_requires = ['futures >== 3.0.0'] if version_info.major == 2 else []
+
+
setup(
name='tornado_sqlalchemy',
version='0.1.0',
@@ -15,5 +19,6 @@ setup(
license='MIT',
url='https://github.com/siddhantgoel/tornado-sqlalchemy',
packages=['tornado_sqlalchemy'],
- keywords=['tornado', 'sqlalchemy']
+ keywords=['tornado', 'sqlalchemy'],
+ install_requires=install_requires
) | use sys.version_info to detect futures requirement | siddhantgoel_tornado-sqlalchemy | train | py |
a261094731585b70e81a699dba21a92188da7048 | diff --git a/lib/svtplay_dl/service/oppetarkiv.py b/lib/svtplay_dl/service/oppetarkiv.py
index <HASH>..<HASH> 100644
--- a/lib/svtplay_dl/service/oppetarkiv.py
+++ b/lib/svtplay_dl/service/oppetarkiv.py
@@ -40,7 +40,7 @@ class OppetArkiv(Service, OpenGraphThumbMixin):
if "subtitleReferences" in data:
for i in data["subtitleReferences"]:
if i["format"] == "websrt":
- yield subtitle(copy.copy(self.config), "wrst", i["url"])
+ yield subtitle(copy.copy(self.config), "wrst", i["url"], output=self.output)
if len(data["videoReferences"]) == 0:
yield ServiceError("Media doesn't have any associated videos (yet?)") | öppetarkiv: this need to have output set | spaam_svtplay-dl | train | py |
e1ebf5be458e5fac0cc146cfa9c53e2cb04c38a0 | diff --git a/build-support/bin/generate_docs.py b/build-support/bin/generate_docs.py
index <HASH>..<HASH> 100644
--- a/build-support/bin/generate_docs.py
+++ b/build-support/bin/generate_docs.py
@@ -308,7 +308,9 @@ class ReferenceGenerator:
for goal, goal_info in help_info["name_to_goal_info"].items():
consumed_scopes = sorted(goal_info["consumed_scopes"])
linked_consumed_scopes = [
- f"[{cs}]({cls._link(cs, sync=sync)})" for cs in consumed_scopes if cs
+ f"[{cs}]({cls._link(cs, sync=sync)})"
+ for cs in consumed_scopes
+ if cs and cs != goal_info.name
]
comma_separated_consumed_scopes = ", ".join(linked_consumed_scopes)
scope_to_help_info[goal][ | [Docs] Filter out self from list of related subsystems. (#<I>)
[ci skip-rust]
[ci skip-build-wheels] | pantsbuild_pants | train | py |
34c0dd7eadaebb1329fb4f3185f2dc20eb28da27 | diff --git a/builtin/providers/azurerm/resource_arm_virtual_machine_test.go b/builtin/providers/azurerm/resource_arm_virtual_machine_test.go
index <HASH>..<HASH> 100644
--- a/builtin/providers/azurerm/resource_arm_virtual_machine_test.go
+++ b/builtin/providers/azurerm/resource_arm_virtual_machine_test.go
@@ -3031,7 +3031,7 @@ resource "azurerm_virtual_machine" "test" {
location = "West US 2"
resource_group_name = "${azurerm_resource_group.test.name}"
network_interface_ids = ["${azurerm_network_interface.test.id}"]
- vm_size = "Standard_DS1_v2_v2"
+ vm_size = "Standard_DS1_v2"
storage_image_reference {
publisher = "kemptech" | fixed typo in vm_size | hashicorp_terraform | train | go |
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.