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
|
---|---|---|---|---|---|
de475f15a2a88fdc2a4997738a1fe6abbad178a8 | diff --git a/tests/unit/core/oxserialCeTest.php b/tests/unit/core/oxserialCeTest.php
index <HASH>..<HASH> 100644
--- a/tests/unit/core/oxserialCeTest.php
+++ b/tests/unit/core/oxserialCeTest.php
@@ -1,4 +1,5 @@
<?php
+
/**
* This file is part of OXID eShop Community Edition.
*
@@ -16,7 +17,7 @@
* along with OXID eShop Community Edition. If not, see <http://www.gnu.org/licenses/>.
*
* @link http://www.oxid-esales.com
- * @copyright (C) OXID eSales AG 2003-2015
+ * @copyright (C) OXID eSales AG 2003-2016
* @version OXID eShop CE
*/
@@ -29,6 +30,10 @@ class Unit_Core_oxSerialCeTest extends OxidTestCase
//this test makes sure oxSerial class does not exist in CE edition
public function testOxSerialClassDoesNotExist()
{
+ if (!OXID_VERSION_PE_CE) {
+ $this->markTestSkipped('This test is for Community edition only.');
+ }
+
if (class_exists('oxSerial')) {
$this->fail("oxSerial class is not excluded from CE eddition!!");
} | Serial CE test comment updated by removing edition tag | OXID-eSales_oxideshop_ce | train | php |
2eb9dc6a7e1aaa9b8f4f0906af788d67cf886b0a | diff --git a/lib/toto.rb b/lib/toto.rb
index <HASH>..<HASH> 100644
--- a/lib/toto.rb
+++ b/lib/toto.rb
@@ -6,6 +6,9 @@ require 'digest'
require 'rdiscount'
require 'builder'
+
+$:.unshift File.dirname(__FILE__)
+
require 'ext'
module Toto | add dir to path, to properly load files | cloudhead_toto | train | rb |
495dd967a242bdc96936388fa2d634e6c7b2d647 | diff --git a/elasticsearch-api/lib/elasticsearch/api/actions/indices/delete.rb b/elasticsearch-api/lib/elasticsearch/api/actions/indices/delete.rb
index <HASH>..<HASH> 100644
--- a/elasticsearch-api/lib/elasticsearch/api/actions/indices/delete.rb
+++ b/elasticsearch-api/lib/elasticsearch/api/actions/indices/delete.rb
@@ -21,11 +21,10 @@ module Elasticsearch
#
# @example Delete all indices
#
- # client.indices.delete
# client.indices.delete index: '_all'
#
# @option arguments [List] :index A comma-separated list of indices to delete;
- # use `_all` or leave empty to delete all indices
+ # use `_all` to delete all indices
# @option arguments [Time] :timeout Explicit operation timeout
#
# @see http://www.elasticsearch.org/guide/reference/api/admin-indices-delete-index/ | [API] Fixed documentation for indices.delete
Use '_all' to delete all indices and do not leave empty.
Closes #<I> | elastic_elasticsearch-ruby | train | rb |
d6419aa86d6ad385e15d685bf47242bb6c67653e | diff --git a/gitlab/tests/test_gitlab.py b/gitlab/tests/test_gitlab.py
index <HASH>..<HASH> 100644
--- a/gitlab/tests/test_gitlab.py
+++ b/gitlab/tests/test_gitlab.py
@@ -673,14 +673,15 @@ class TestGitlab(unittest.TestCase):
self.assertEqual(status.emoji, "thumbsup")
def test_todo(self):
- todo_content = open(os.path.dirname(__file__) + "/data/todo.json", "r").read()
- json_content = json.loads(todo_content)
+ with open(os.path.dirname(__file__) + "/data/todo.json", "r") as json_file:
+ todo_content = json_file.read()
+ json_content = json.loads(todo_content)
+ encoded_content = todo_content.encode("utf-8")
@urlmatch(scheme="http", netloc="localhost", path="/api/v4/todos", method="get")
def resp_get_todo(url, request):
headers = {"content-type": "application/json"}
- content = todo_content.encode("utf-8")
- return response(200, content, headers, None, 5, request)
+ return response(200, encoded_content, headers, None, 5, request)
@urlmatch(
scheme="http", | test: remove warning about open files from test_todo()
When running unittests python warns that the json file from test_todo()
was still open. Use with to open, read, and create encoded json data
that is used by resp_get_todo(). | python-gitlab_python-gitlab | train | py |
114f60359007c09a464bc2496a8d5735dde63f99 | diff --git a/tests/test_country_converter.py b/tests/test_country_converter.py
index <HASH>..<HASH> 100644
--- a/tests/test_country_converter.py
+++ b/tests/test_country_converter.py
@@ -7,7 +7,7 @@ import collections
TESTPATH = os.path.dirname(os.path.abspath(__file__))
sys.path.append(os.path.join(TESTPATH, '..'))
-import country_converter as coco # nopep8
+import country_converter as coco # noqa
regex_test_files = [nn for nn in os.listdir(TESTPATH)
if (nn[:10] == 'test_regex') and | ignored pep8 error in test with # noqa | konstantinstadler_country_converter | train | py |
81508c06314ba0bb1cfc4ac0eca4f912f2ac76f5 | diff --git a/symphony/lib/toolkit/class.field.php b/symphony/lib/toolkit/class.field.php
index <HASH>..<HASH> 100644
--- a/symphony/lib/toolkit/class.field.php
+++ b/symphony/lib/toolkit/class.field.php
@@ -475,7 +475,11 @@ class Field
{
// Create header
$location = ($this->get('location') ? $this->get('location') : 'main');
- $header = new XMLElement('header', null, array('class' => 'frame-header ' . $location, 'data-name' => $this->name()));
+ $header = new XMLElement('header', null, array(
+ 'class' => 'frame-header ' . $location,
+ 'data-name' => $this->name(),
+ 'title' => $this->get('id'),
+ ));
$label = (($this->get('label')) ? $this->get('label') : __('New Field'));
$header->appendChild(new XMLElement('h4', '<strong>' . $label . '</strong> <span class="type">' . $this->name() . '</span>'));
$wrapper->appendChild($header); | Add id as title attribute
This makes it easier for developers to know the fields id | symphonycms_symphony-2 | train | php |
3b08bbfc56ce85a3a2ad06a8c62ee0fd9a0dc73d | diff --git a/library/pulse/handling.rb b/library/pulse/handling.rb
index <HASH>..<HASH> 100644
--- a/library/pulse/handling.rb
+++ b/library/pulse/handling.rb
@@ -32,7 +32,7 @@ module Pulse
# Someone has changed their nickname
# [email protected] NICK mk_
def got_nick command
- each_user command.sender.nickname do |user|
+ each_instance_of command.sender.nickname do |user|
emit :rename, user, command[0]
user.name = command[0]
end | Critical bugfix for when someone changes their nick | mkroman_blur | train | rb |
695c9433b61b619ad1ab0024030d5eb5e57093d2 | diff --git a/djangocms_spa/forms.py b/djangocms_spa/forms.py
index <HASH>..<HASH> 100644
--- a/djangocms_spa/forms.py
+++ b/djangocms_spa/forms.py
@@ -203,7 +203,6 @@ class SpaApiModelForm(six.with_metaclass(ModelFormMetaclass, BaseModelForm)):
return {
'component': 'cmp-form-submit',
'label': str(self.submit_button_label),
- 'recaptcha_sitekey': False
}
def _get_form_state_and_messages_dict(self): | Remove recaptcha from default model form view | dreipol_djangocms-spa | train | py |
ae680e56e66a6c628f872710c032615e926484f4 | diff --git a/docroot/modules/custom/ymca_mindbody/src/Form/MindbodyPTForm.php b/docroot/modules/custom/ymca_mindbody/src/Form/MindbodyPTForm.php
index <HASH>..<HASH> 100644
--- a/docroot/modules/custom/ymca_mindbody/src/Form/MindbodyPTForm.php
+++ b/docroot/modules/custom/ymca_mindbody/src/Form/MindbodyPTForm.php
@@ -492,7 +492,7 @@ class MindbodyPTForm extends FormBase {
);
}
}
- catch (MindbodyException $e) {
+ catch (\Exception $e) {
$form['disabled'] = $this->resultsSearcher->getDisabledMarkup();
$this->logger->error('Failed to build the form. Message: %msg', ['%msg' => $e->getMessage()]);
} | [YPTF-<I>] Catch PT form exception | ymcatwincities_openy | train | php |
d36d2379f8313e6fdae61a744553aae8a7e881e7 | diff --git a/packages/hw-app-str/src/Str.js b/packages/hw-app-str/src/Str.js
index <HASH>..<HASH> 100644
--- a/packages/hw-app-str/src/Str.js
+++ b/packages/hw-app-str/src/Str.js
@@ -43,6 +43,7 @@ const SW_CANCEL = 0x6985;
const SW_UNKNOWN_OP = 0x6c24;
const SW_MULTI_OP = 0x6c25;
const SW_SAFE_MODE = 0x6c66;
+const SW_UNSUPPORTED = 0x6d00;
/**
* Stellar API
@@ -227,7 +228,8 @@ export default class Str {
.send(CLA, INS_SIGN_TX_HASH, 0x00, 0x00, buffer, [
SW_OK,
SW_CANCEL,
- SW_SAFE_MODE
+ SW_SAFE_MODE,
+ SW_UNSUPPORTED
])
.then(response => {
let status = Buffer.from(
@@ -243,6 +245,8 @@ export default class Str {
throw new Error(
"To sign multi-operation transactions 'Unsafe mode' must be enabled in the app settings"
);
+ } else if (status === SW_UNSUPPORTED) {
+ throw new Error("Multi-operation transactions are not supported");
} else {
throw new Error("Transaction approval request was rejected");
} | Show unsupported message for Stellar app version <I> | LedgerHQ_ledgerjs | train | js |
098f975b4875fc065acc377e9e32e04a246a457e | diff --git a/collector/cpu_darwin.go b/collector/cpu_darwin.go
index <HASH>..<HASH> 100644
--- a/collector/cpu_darwin.go
+++ b/collector/cpu_darwin.go
@@ -31,6 +31,7 @@ import (
/*
#cgo LDFLAGS:
#include <stdlib.h>
+#include <limits.h>
#include <sys/sysctl.h>
#include <sys/mount.h>
#include <mach/mach_init.h>
@@ -45,7 +46,7 @@ import (
import "C"
// ClocksPerSec default value. from time.h
-const ClocksPerSec = float64(128)
+const ClocksPerSec = float64(C.CLK_TCK)
type statCollector struct {
cpu *prometheus.Desc | Correct the ClocksPerSec scaling factor on Darwin (#<I>)
* Update cpu_darwin.go
Change the definition of ClocksPerSec to read from limits.h
* Update cpu_darwin.go | prometheus_node_exporter | train | go |
3a338186e25c5f5ff067e01698ba187f93eba5da | diff --git a/spec/github/repos/contributors_spec.rb b/spec/github/repos/contributors_spec.rb
index <HASH>..<HASH> 100644
--- a/spec/github/repos/contributors_spec.rb
+++ b/spec/github/repos/contributors_spec.rb
@@ -27,6 +27,11 @@ describe Github::Repos, '#contributors' do
expect { subject.contributors user, nil }.to raise_error(ArgumentError)
end
+ it 'filters out unkown parameters' do
+ subject.contributors user, repo, :unknown => true
+ a_get(request_path).with({}).should have_been_made
+ end
+
it "should find resources" do
subject.contributors user, repo
a_get(request_path).should have_been_made | Ensure filters are applied to parameters. | piotrmurach_github | train | rb |
f6a58626ad2cc8fdbb2ceb36b3c9e915291e3567 | diff --git a/lib/event_listeners.js b/lib/event_listeners.js
index <HASH>..<HASH> 100644
--- a/lib/event_listeners.js
+++ b/lib/event_listeners.js
@@ -132,13 +132,13 @@ AWS.EventListeners = {
add('RETRY_DELAY_SEND', 'retry', function RETRY_DELAY_SEND(req, resp) {
var delay = 0;
if (resp.error) {
- delay = req.client.retryDelays()[resp.retryCount] || 0;
+ delay = req.client.retryDelays()[resp.retryCount-1] || 0;
}
- setTimeout(function() {
- resp.error = null;
- resp.data = null;
- req.emitEvents('send');
- }, delay);
+
+ resp.error = null;
+ resp.data = null;
+
+ setTimeout(function() { req.emitEvents('send'); }, delay);
});
}), | Fix off-by-1 error in RETRY_DELAY_SEND event | aws_aws-sdk-js | train | js |
d554dde50ca7760d3f34c1863978b1e9964d3e93 | diff --git a/src/vizabi-gapminder.js b/src/vizabi-gapminder.js
index <HASH>..<HASH> 100644
--- a/src/vizabi-gapminder.js
+++ b/src/vizabi-gapminder.js
@@ -104,7 +104,7 @@ BarChart.define('default_model', {
BarRankChart.define('default_model', {
state: {
time: {
- start: "1800",
+ start: "1950",
end: "2015",
value: "2000",
step: 1,
@@ -172,9 +172,11 @@ BarRankChart.define('default_model', {
},
language: language,
data: {
- //reader: "waffle",
- reader: "csv",
- path: globals.gapminder_paths.baseUrl + "data/waffles/basic-indicators.csv"
+ reader: "waffle",
+ path: "http://waffle-server-dev.gapminderdev.org/api/graphs/stats/vizabi-tools",
+ //reader: "csv",
+ //path: globals.gapminder_paths.baseUrl + "data/waffles/basic-indicators.csv"
+ splash: true
},
ui: {
presentation: false | Hide the bug when loading data from CSV. Worth re-investigating when we are done with loading procedure and racing conditions | vizabi_vizabi | train | js |
35f0ce1966c043136749fb8cbacbf9381cd596c9 | diff --git a/getset.go b/getset.go
index <HASH>..<HASH> 100644
--- a/getset.go
+++ b/getset.go
@@ -1,7 +1,6 @@
package goutil
import (
- "fmt"
"reflect"
) | removing import
forgot to remove this import, thats what i get for trying to commit via a web client | xchapter7x_goutil | train | go |
2fdae3faf26e75b1b74b2e68dd7123ae64d0c325 | diff --git a/openquake/commonlib/parallel.py b/openquake/commonlib/parallel.py
index <HASH>..<HASH> 100644
--- a/openquake/commonlib/parallel.py
+++ b/openquake/commonlib/parallel.py
@@ -199,6 +199,11 @@ class TaskManager(object):
"""
executor = executor
+ @classmethod
+ def restart(cls):
+ cls.executor.shutdown()
+ cls.executor = ProcessPoolExecutor()
+
def __init__(self, oqtask, progress, name=None):
self.oqtask = oqtask
self.progress = progress | Implemented a TaskManager.restart functionality | gem_oq-engine | train | py |
f6e39f571ee25127eb62efe1513629d944b658d5 | diff --git a/telephus/protocol.py b/telephus/protocol.py
index <HASH>..<HASH> 100644
--- a/telephus/protocol.py
+++ b/telephus/protocol.py
@@ -4,6 +4,7 @@ from twisted.internet.protocol import ReconnectingClientFactory
from twisted.internet import defer, reactor
from twisted.internet.error import UserError
from telephus.cassandra import Cassandra
+from telephus.cassandra.ttypes import InvalidRequestException
class ClientBusy(Exception):
pass
@@ -96,7 +97,8 @@ class ManagedCassandraClientFactory(ReconnectingClientFactory):
@defer.inlineCallbacks
def submitRequest(self, proto):
def reqError(err, req, d, r):
- if r < 1:
+ if isinstance(err, InvalidRequestException) or \
+ isinstance(err, InvalidThriftRequest) or r < 1:
d.errback(err)
self._pending.remove(d)
else: | Don't retry on IRE or ITR | driftx_Telephus | train | py |
ad6409bfe02cb920a33c61455a6ee5b174017149 | diff --git a/scapy/sendrecv.py b/scapy/sendrecv.py
index <HASH>..<HASH> 100644
--- a/scapy/sendrecv.py
+++ b/scapy/sendrecv.py
@@ -489,7 +489,7 @@ def sendpfast(x, # type: _PacketIterable
"""Send packets at layer 2 using tcpreplay for performance
:param pps: packets per second
- :param mpbs: MBits per second
+ :param mbps: MBits per second
:param realtime: use packet's timestamp, bending time with real-time value
:param loop: number of times to process the packet list
:param file_cache: cache packets in RAM instead of reading from | Fix a typo in the documentation
This may be my dyslexic moment, but I believe it should read "mbps", not "mpbs". | secdev_scapy | train | py |
83ade52b1b7eef0ed526a3180b507338dd6c74b2 | diff --git a/pymongo/__init__.py b/pymongo/__init__.py
index <HASH>..<HASH> 100644
--- a/pymongo/__init__.py
+++ b/pymongo/__init__.py
@@ -55,7 +55,7 @@ TEXT = "text"
.. _text index: http://mongodb.com/docs/manual/core/index-text/
"""
-version_tuple: Tuple[Union[int, str], ...] = (4, 2, 0, ".dev1")
+version_tuple: Tuple[Union[int, str], ...] = (4, 2, 0, "b0")
def get_version_string() -> str:
diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100755
--- a/setup.py
+++ b/setup.py
@@ -34,7 +34,7 @@ except ImportError:
except ImportError:
_HAVE_SPHINX = False
-version = "4.2.0.dev1"
+version = "4.2.0b0"
f = open("README.rst")
try: | bump to <I>b0 | mongodb_mongo-python-driver | train | py,py |
e089c9cf264a48205787afaf1fb81b80c907c50e | diff --git a/src/components/Popup.js b/src/components/Popup.js
index <HASH>..<HASH> 100644
--- a/src/components/Popup.js
+++ b/src/components/Popup.js
@@ -37,6 +37,8 @@ export default class Popup extends React.Component {
apps: [],
loading: true
}
+
+ this._renderAppItem = this._renderAppItem.bind(this)
}
async componentDidMount () { | Fixing this.props undefined | leanmotherfuckers_react-native-map-link | train | js |
814dc4f107cbc07112da08584ab31abeb90c5df5 | diff --git a/html/pfappserver/root/static/admin/common.js b/html/pfappserver/root/static/admin/common.js
index <HASH>..<HASH> 100644
--- a/html/pfappserver/root/static/admin/common.js
+++ b/html/pfappserver/root/static/admin/common.js
@@ -652,9 +652,9 @@ $(function () { // DOM ready
var index = target.children().length;
dynamic_list_update_all_attributes(copy, base_id, index);
target.append(copy.children());
- target.children().last().trigger('dynamic-list.add');
target_wrapper.removeClass('hidden');
template_control_group.addClass('hidden');
+ target.children().last().trigger('dynamic-list.add');
return false;
}); | (web admin) Trigger event once parent is visible
Fixes #<I> | inverse-inc_packetfence | train | js |
3c90d3654c84f2a5f58564d2243f6a6e83da3fba | diff --git a/flink-runtime/src/main/java/org/apache/flink/runtime/filecache/FileCache.java b/flink-runtime/src/main/java/org/apache/flink/runtime/filecache/FileCache.java
index <HASH>..<HASH> 100644
--- a/flink-runtime/src/main/java/org/apache/flink/runtime/filecache/FileCache.java
+++ b/flink-runtime/src/main/java/org/apache/flink/runtime/filecache/FileCache.java
@@ -77,10 +77,10 @@ public class FileCache {
ConfigConstants.DEFAULT_TASK_MANAGER_TMP_PATH);
String[] directories = tempDirs.split(",|" + File.pathSeparator);
- String cacheDirName = "flink-dist-cache-" + UUID.randomUUID().toString();
storageDirectories = new File[directories.length];
for (int i = 0; i < directories.length; i++) {
+ String cacheDirName = "flink-dist-cache-" + UUID.randomUUID().toString();
storageDirectories[i] = new File(directories[i], cacheDirName);
String path = storageDirectories[i].getAbsolutePath(); | [FLINK-<I>] Fix support multiple identical temp directories in FileCache
This closes #<I> | apache_flink | train | java |
40e1cc550bad168ce57da3cde89fa7a2833525e8 | diff --git a/src/org/parboiled/common/Reference.java b/src/org/parboiled/common/Reference.java
index <HASH>..<HASH> 100644
--- a/src/org/parboiled/common/Reference.java
+++ b/src/org/parboiled/common/Reference.java
@@ -71,12 +71,12 @@ public class Reference<T> {
/**
* Retrieves this references value field and clears it.
- * Equivalent to exchange(null).
+ * Equivalent to getAndSet(null).
*
* @return the target
*/
public T getAndClear() {
- return exchange(null);
+ return getAndSet(null);
}
/**
@@ -85,7 +85,7 @@ public class Reference<T> {
* @param value the new value
* @return the previous value
*/
- public T exchange(T value) {
+ public T getAndSet(T value) {
T t = this.value;
this.value = value;
return t; | Small naming improvement in org.parboiled.common.Reference | sirthias_parboiled | train | java |
d210d791490ffc7d70c970476d3b8a0af128d7af | diff --git a/src/test/java/redis/clients/jedis/commands/unified/SortedSetCommandsTestBase.java b/src/test/java/redis/clients/jedis/commands/unified/SortedSetCommandsTestBase.java
index <HASH>..<HASH> 100644
--- a/src/test/java/redis/clients/jedis/commands/unified/SortedSetCommandsTestBase.java
+++ b/src/test/java/redis/clients/jedis/commands/unified/SortedSetCommandsTestBase.java
@@ -29,7 +29,7 @@ import redis.clients.jedis.resps.ScanResult;
import redis.clients.jedis.resps.Tuple;
import redis.clients.jedis.util.SafeEncoder;
-public class SortedSetCommandsTestBase extends UnifiedJedisCommandsTestBase {
+public abstract class SortedSetCommandsTestBase extends UnifiedJedisCommandsTestBase {
final byte[] bfoo = { 0x01, 0x02, 0x03, 0x04 };
final byte[] bbar = { 0x05, 0x06, 0x07, 0x08 };
final byte[] bcar = { 0x09, 0x0A, 0x0B, 0x0C }; | Prevent test base classes from testing (#<I>)
This PR is in response of #<I>. SortedSetCommandsTestBase is the only class that missed `abstract`. | xetorthio_jedis | train | java |
b06e83afec8e943d923185a1383fde19717ff556 | diff --git a/tests/dummy/app/controllers/nodes/detail/index.js b/tests/dummy/app/controllers/nodes/detail/index.js
index <HASH>..<HASH> 100644
--- a/tests/dummy/app/controllers/nodes/detail/index.js
+++ b/tests/dummy/app/controllers/nodes/detail/index.js
@@ -28,7 +28,12 @@ export default Ember.Controller.extend(CommentableMixin, TaggableMixin, NodeActi
// Would update node properly!
},
updateNode() {
- this.keenTrackFrontEndEvent('button', 'click', 'updateNode');
+ this.keenTrackFrontEndEvent({
+ category:'button',
+ action: 'click',
+ label: 'Update Node'
+ }, this.get('model'));
+
this.set('isSaving', true);
return this._super(...arguments)
.then(() => { | Modify variables passing in in dummy app. | CenterForOpenScience_ember-osf | train | js |
2dab751f615e7bc138a155f38cf79a8061d7c2b9 | diff --git a/lib/hmachine/posh/base.rb b/lib/hmachine/posh/base.rb
index <HASH>..<HASH> 100644
--- a/lib/hmachine/posh/base.rb
+++ b/lib/hmachine/posh/base.rb
@@ -56,17 +56,11 @@ module HMachine
end
def to_h
- return @to_h if @to_h
- @to_h = {}
- has_one = self.class.instance_variable_get(:@has_one)
- properties.each_pair do |key, property|
- @to_h[key] = if (has_one && has_one.include?(property))
- property.parse_first(@first_node)
- else
- property.parse(@first_node)
- end
- end
- @to_h
+ @to_h ||= self.class.property_hash(@first_node, properties)
+ end
+
+ def has_property?(key)
+ to_h.has_key?(key)
end
def to_s | Check if POSH format has a certain property | mwunsch_prism | train | rb |
a103994339fc12e9f52494235379104e7cbf5907 | diff --git a/gffutils/db.py b/gffutils/db.py
index <HASH>..<HASH> 100644
--- a/gffutils/db.py
+++ b/gffutils/db.py
@@ -379,17 +379,27 @@ class FeatureDB:
self.db_fn = db_fn
self.conn = sqlite3.connect(db_fn)
self.conn.text_factory = str
- c = self.conn.cursor()
- c.execute('''
- SELECT filetype FROM meta
- ''')
- self.filetype = c.fetchone()[0]
+ # SELECT statement to use when you want all the fields of a feature,
+ # plus the db ID. Results from this are usually sent right to
+ # self._newfeature()
self.SELECT = """
SELECT id, chrom, source, featuretype, start, stop, score, strand,
frame, attributes
"""
+ c = self.conn.cursor()
+ try:
+ c.execute('''
+ SELECT filetype FROM meta
+ ''')
+ self.filetype = c.fetchone()[0]
+ except sqlite3.OperationalError:
+ c.execute(self.SELECT + ' FROM features LIMIT 1')
+ results = c.fetchone()[0]
+ feature = self._newfeature(results)
+ self.filetype = feature.filetype
+
def _newfeature(self, *args):
feature = Feature(*args[1:])
feature.dbid = args[0] | more robust way to figure out GFF/GTF for backwards compatibility | daler_gffutils | train | py |
51ad2b971cf2d739e07b51b7d6b0983869925c7a | diff --git a/components/header/tray-icon.js b/components/header/tray-icon.js
index <HASH>..<HASH> 100644
--- a/components/header/tray-icon.js
+++ b/components/header/tray-icon.js
@@ -19,7 +19,6 @@ export default class TrayIcon extends Component {
const classes = classnames(styles.icon, className);
return (
<Icon
- hoverColor={Icon.Color.ORANGE}
{...restProps}
className={classes}
/> | RG-<I> Drop not needed state management from Icon component: remove hoverColor usage
Former-commit-id: 5d<I>a<I>da<I>a<I>f<I>c<I>d9b<I>cc0ed5a5 | JetBrains_ring-ui | train | js |
f6d93512d6068f18cc2ec14f7c0906b87ab08967 | diff --git a/tests/examples/examples_report_plugin.py b/tests/examples/examples_report_plugin.py
index <HASH>..<HASH> 100644
--- a/tests/examples/examples_report_plugin.py
+++ b/tests/examples/examples_report_plugin.py
@@ -162,8 +162,7 @@ class ExamplesTestReport(object):
if pytest.config.option.upload:
upload_example_pngs_to_s3()
- write(red('uploading %s' % self.examplereport))
- upload_file_to_s3(self.examplereport)
+ upload_file_to_s3(session.config.option.examplereport, "text/html")
upload_file_to_s3(session.config.option.log_file, "text/text")
def pytest_terminal_summary(self, terminalreporter): | Use the config option for the example report upload | bokeh_bokeh | train | py |
108c5c88ccaf62f2d0532a564d8f2ab859de68d8 | diff --git a/tests/unit/test_protocol_errors.py b/tests/unit/test_protocol_errors.py
index <HASH>..<HASH> 100644
--- a/tests/unit/test_protocol_errors.py
+++ b/tests/unit/test_protocol_errors.py
@@ -83,3 +83,10 @@ class TestFrontendErrors(unittest.TestCase):
request.page_token = badType
self.assertRequestRaises(
exceptions.RequestValidationFailureException, url, request)
+
+ @unittest.skip("TODO: create invalid JSON to test validation")
+ def testInvalidFields(self):
+ for url, requestClass in self.endPointMap.items():
+ request = self._createInvalidInstance(requestClass)
+ self.assertRequestRaises(
+ exceptions.RequestValidationFailureException, url, request) | Worked around some non-working tests. | ga4gh_ga4gh-server | train | py |
b984ca404877e55794facc938d7546b3532f45e1 | diff --git a/src/client/pps.go b/src/client/pps.go
index <HASH>..<HASH> 100644
--- a/src/client/pps.go
+++ b/src/client/pps.go
@@ -158,7 +158,8 @@ func NewUnionInput(input ...*pps.Input) *pps.Input {
// NewCronInput returns an input which will trigger based on a timed schedule.
// It uses cron syntax to specify the schedule. The input will be exposed to
-// jobs as `/pfs/<name>/<timestamp>`.
+// jobs as `/pfs/<name>/<timestamp>`. The timestamp uses the RFC 3339 format,
+// e.g. `2006-01-02T15:04:05Z07:00`.
func NewCronInput(name string, spec string) *pps.Input {
return &pps.Input{
Cron: &pps.CronInput{ | upgrade NewCronInput doc to explain the timestamp format | pachyderm_pachyderm | train | go |
ad1abb58dd1d0d9bf123e760d7105f1d91ae5cd0 | diff --git a/lib/fastfix/nuke.rb b/lib/fastfix/nuke.rb
index <HASH>..<HASH> 100644
--- a/lib/fastfix/nuke.rb
+++ b/lib/fastfix/nuke.rb
@@ -9,7 +9,7 @@ module Fastfix
def run(params)
self.params = params
- self.params[:path] = GitHelper.clone(self.params[:git_url])
+ self.params[:path] = GitHelper.clone(self.params[:git_url]) if self.params[:git_url]
self.params[:app_identifier] = '' # we don't really need a value here
FastlaneCore::PrintTable.print_values(config: params,
hide_keys: [:app_identifier], | Fixed nuke command when not having a git_url | fastlane_fastlane | train | rb |
a40ba18272112e180205910f5c8007e8b1ecbd0d | diff --git a/i3pystatus/network.py b/i3pystatus/network.py
index <HASH>..<HASH> 100644
--- a/i3pystatus/network.py
+++ b/i3pystatus/network.py
@@ -289,6 +289,8 @@ class Network(IntervalModule, ColorRangeModule):
on_leftclick = "nm-connection-editor"
on_rightclick = "cycle_interface"
+ on_upscroll = ['cycle_interface', 1]
+ on_downscroll = ['cycle_interface', -1]
def init(self):
# Don't require importing basiciw unless using the functionality it offers.
@@ -311,10 +313,10 @@ class Network(IntervalModule, ColorRangeModule):
self.colors = self.get_hex_color_range(self.start_color, self.end_color, int(self.upper_limit))
self.kbs_arr = [0.0] * self.graph_width
- def cycle_interface(self):
+ def cycle_interface(self, increment=1):
interfaces = [i for i in netifaces.interfaces() if i not in self.ignore_interfaces]
if self.interface in interfaces:
- next_index = (interfaces.index(self.interface) + 1) % len(interfaces)
+ next_index = (interfaces.index(self.interface) + increment) % len(interfaces)
self.interface = interfaces[next_index]
elif len(interfaces) > 0:
self.interface = interfaces[0] | Allow users to scroll through interfaces. | enkore_i3pystatus | train | py |
0e562af58895b893e301fb968f426be9b4958840 | diff --git a/gnucash_portfolio/pricesaggregate.py b/gnucash_portfolio/pricesaggregate.py
index <HASH>..<HASH> 100644
--- a/gnucash_portfolio/pricesaggregate.py
+++ b/gnucash_portfolio/pricesaggregate.py
@@ -14,7 +14,8 @@ class PricesAggregate:
""" Gets the price for commodity on given date or last known before the date """
query = (
self.book.session.query(Price)
- .filter(Price.date <= on_date)
+ .filter(Price.date <= on_date,
+ Price.commodity == stock)
.order_by(desc(Price.date))
)
return query | getting the correct price, filtering by symbol | MisterY_gnucash-portfolio | train | py |
26f8c2e7bb1bd52438f9a9a6418f90e491c07fbf | diff --git a/library/src/test/java/com/wdullaer/materialdatetimepicker/time/TimepointTest.java b/library/src/test/java/com/wdullaer/materialdatetimepicker/time/TimepointTest.java
index <HASH>..<HASH> 100644
--- a/library/src/test/java/com/wdullaer/materialdatetimepicker/time/TimepointTest.java
+++ b/library/src/test/java/com/wdullaer/materialdatetimepicker/time/TimepointTest.java
@@ -1,4 +1,4 @@
-package com.wdullaer.materialdatetimepicker.date;
+package com.wdullaer.materialdatetimepicker.time;
import com.wdullaer.materialdatetimepicker.time.Timepoint; | Moved Timepoint tests to time subpackage | wdullaer_MaterialDateTimePicker | train | java |
7358a3065aa477d1c4c391e019d0808044a7d25a | diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100755
--- a/setup.py
+++ b/setup.py
@@ -123,8 +123,8 @@ def get_version_info():
vinfo = _version_helper.generate_git_version_info()
except:
vinfo = vdummy()
- vinfo.version = '1.15.3'
- vinfo.release = 'True'
+ vinfo.version = '1.15.dev4'
+ vinfo.release = 'False'
with open('pycbc/version.py', 'w') as f:
f.write("# coding: utf-8\n") | reset back to development (#<I>) | gwastro_pycbc | train | py |
697cdada327059dcac347cc3f7fba66b4064353c | diff --git a/lib/skpm-publish.js b/lib/skpm-publish.js
index <HASH>..<HASH> 100644
--- a/lib/skpm-publish.js
+++ b/lib/skpm-publish.js
@@ -178,7 +178,7 @@ auth.getToken().then(function (_token) {
return exec('rm -f ' + tempZip)
})
.then(function () {
- if (!program.noRegistry && !packageJSON.private) {
+ if (program.registry !== false && !packageJSON.private) {
console.log(chalk.dim('[' + (++step) + '/' + steps + ']') + ' 🔔 Publishing the plugin on the official plugin directory...')
return github.addPluginToPluginsRegistryRepo(token, packageJSON, repo)
} | fix publishing to registry even with -n flag | skpm_skpm | train | js |
d193d04cea862e2db84ac40226cfdbdb39be46d5 | diff --git a/src/structures/Webhook.js b/src/structures/Webhook.js
index <HASH>..<HASH> 100644
--- a/src/structures/Webhook.js
+++ b/src/structures/Webhook.js
@@ -90,7 +90,7 @@ class Webhook {
* The source guild of the webhook
* @type {?(Guild|APIGuild)}
*/
- this.sourceGuild = this.client.guilds?._add(data.source_guild, false) ?? data.source_guild;
+ this.sourceGuild = this.client.guilds?.resolve(data.source_guild.id) ?? data.source_guild;
} else {
this.sourceGuild ??= null;
} | fix(Webhook): Resolve source guild only if cached (#<I>) | discordjs_discord.js | train | js |
17f63d18a59541399795a3c308fbc4e85ffe26e1 | diff --git a/mod/scorm/report/objectives/classes/report.php b/mod/scorm/report/objectives/classes/report.php
index <HASH>..<HASH> 100644
--- a/mod/scorm/report/objectives/classes/report.php
+++ b/mod/scorm/report/objectives/classes/report.php
@@ -665,7 +665,7 @@ function get_scorm_objectives($scormid) {
$params[] = $scormid;
$params[] = "cmi.objectives%.id";
$value = $DB->sql_compare_text('value');
- $rs = $DB->get_recordset_select("scorm_scoes_track", $select, $params, $value, "DISTINCT $value, scoid");
+ $rs = $DB->get_recordset_select("scorm_scoes_track", $select, $params, 'value', "DISTINCT $value AS value, scoid");
if ($rs->valid()) {
foreach ($rs as $record) {
$objectives[$record->scoid][] = $record->value; | MDL-<I> mod_scorm: Apply alias to compare text column | moodle_moodle | train | php |
ebe2012112205bf6992b6a9fa11c9d4c71a0c08d | diff --git a/fireplace/cards/classic/rogue.py b/fireplace/cards/classic/rogue.py
index <HASH>..<HASH> 100644
--- a/fireplace/cards/classic/rogue.py
+++ b/fireplace/cards/classic/rogue.py
@@ -117,9 +117,7 @@ class EX1_145:
play = Buff(FRIENDLY_HERO, "EX1_145o")
class EX1_145o:
- events = OWN_SPELL_PLAY.after(
- lambda self, player, card, *args: card is not self.creator and Destroy(self)
- )
+ events = OWN_SPELL_PLAY.on(Destroy(SELF))
# Shiv | Trigger Preparation buff on() instead of after(), removing the guard | jleclanche_fireplace | train | py |
285dab816f6d87ef318eb35cb5741fa5c7d3b6c7 | diff --git a/lib/rom/processor/transproc.rb b/lib/rom/processor/transproc.rb
index <HASH>..<HASH> 100644
--- a/lib/rom/processor/transproc.rb
+++ b/lib/rom/processor/transproc.rb
@@ -25,7 +25,7 @@ module ROM
end
def to_fn
- fns.compact.reduce(:+) || default
+ fns.reduce(:+) || default
end
end | Remove reduntant call to compact (^5 mutant) | rom-rb_rom | train | rb |
dddda2dce1eba3666999d34eaa0f24b061b19095 | diff --git a/src/Behaviours/CountCache/CountCacheManager.php b/src/Behaviours/CountCache/CountCacheManager.php
index <HASH>..<HASH> 100644
--- a/src/Behaviours/CountCache/CountCacheManager.php
+++ b/src/Behaviours/CountCache/CountCacheManager.php
@@ -106,12 +106,12 @@ class CountCacheManager
protected function countCacheConfig($cacheKey, $cacheOptions)
{
$opts = [];
- $relatedModel = null;
if (is_numeric($cacheKey)) {
if (is_array($cacheOptions)) {
// Most explicit configuration provided
$opts = $cacheOptions;
+ $relatedModel = array_get($opts, 'model');
} else {
// Smallest number of options provided, figure out the rest
$relatedModel = $cacheOptions; | related model required if the explicit array isn't complete | kirkbushell_eloquence | train | php |
ae46ca5fcc8823c446fba6b275daa02f5c8a7973 | diff --git a/lib/classes/plugin_manager.php b/lib/classes/plugin_manager.php
index <HASH>..<HASH> 100644
--- a/lib/classes/plugin_manager.php
+++ b/lib/classes/plugin_manager.php
@@ -1141,7 +1141,7 @@ class core_plugin_manager {
'tool' => array(
'assignmentupgrade', 'availabilityconditions', 'behat', 'capability', 'customlang',
- 'dbtransfer', 'generator', 'health', 'innodb', 'installaddon',
+ 'dbtransfer', 'filetypes', 'generator', 'health', 'innodb', 'installaddon',
'langimport', 'log', 'messageinbound', 'multilangupgrade', 'monitor', 'phpunit', 'profiling',
'replace', 'spamcleaner', 'task', 'timezoneimport',
'unittest', 'uploadcourse', 'uploaduser', 'unsuproles', 'xmldb' | MDL-<I> core: Adding tool_filetypes to the standard plugins list | moodle_moodle | train | php |
f4d005b1afeecb5559b7914e99885a94de0ed453 | diff --git a/cryptographic_fields/settings.py b/cryptographic_fields/settings.py
index <HASH>..<HASH> 100644
--- a/cryptographic_fields/settings.py
+++ b/cryptographic_fields/settings.py
@@ -4,6 +4,6 @@ from django.core.exceptions import ImproperlyConfigured
FIELD_ENCRYPTION_KEY = str(getattr(settings, 'FIELD_ENCRYPTION_KEY'))
-if not FIELD_ENCRYPTION_KEY:
+if FIELD_ENCRYPTION_KEY is None:
raise ImproperlyConfigured(
- 'FIELD_ENCRYPTION_KEY must be defined in settings')
+ 'FIELD_ENCRYPTION_KEY must be defined in settings') | Raise an error in settings.py only when encryption key is None | foundertherapy_django-cryptographic-fields | train | py |
552f548071f4d8eafe9a5176389fcb5fc2ab1c7a | diff --git a/editor/models/file.js b/editor/models/file.js
index <HASH>..<HASH> 100644
--- a/editor/models/file.js
+++ b/editor/models/file.js
@@ -180,11 +180,13 @@ define([
.then(function(_path) {
return rpc.execute("fs/write", {
'path': _path,
- 'content': hash.btoa(content)
+ 'content': hash.btoa(content),
+ 'override': false
})
.then(function() {
return that.stat(_path);
- });
+ })
+ .fail(dialogs.error);
});
});
}
diff --git a/lib/services/fs.js b/lib/services/fs.js
index <HASH>..<HASH> 100644
--- a/lib/services/fs.js
+++ b/lib/services/fs.js
@@ -111,7 +111,7 @@ var mkdir = function(args) {
var write = function(args) {
_.defaults(args, {
'base64': true,
- 'override': false
+ 'override': true
});
if (!args.path || !_.isString(args.content)) throw "Need 'path' and 'content'"; | Fix option override option on write method | CodeboxIDE_codebox | train | js,js |
cea8b8e14d1deb6d3d013c965ed903034930d77f | diff --git a/lib/active_force/association/belongs_to_association.rb b/lib/active_force/association/belongs_to_association.rb
index <HASH>..<HASH> 100644
--- a/lib/active_force/association/belongs_to_association.rb
+++ b/lib/active_force/association/belongs_to_association.rb
@@ -17,6 +17,7 @@ module ActiveForce
end
@parent.send :define_method, "#{_method}=" do |other|
+ send "#{ association.foreign_key }=", other.id
association_cache[_method] = other
end
end
diff --git a/spec/active_force/association_spec.rb b/spec/active_force/association_spec.rb
index <HASH>..<HASH> 100644
--- a/spec/active_force/association_spec.rb
+++ b/spec/active_force/association_spec.rb
@@ -8,7 +8,7 @@ describe ActiveForce::SObject do
end
let :comment do
- Comment.new(id: "1")
+ Comment.new(id: "1", post_id: "1")
end
let :client do
@@ -142,9 +142,11 @@ describe ActiveForce::SObject do
end
it 'accepts assignment of an existing object as an association' do
- expect(client).to_not receive :query
- comment.post = post
- expect(comment.post).to eql post
+ expect(client).to_not receive(:query)
+ other_post = Post.new(id: "2")
+ comment.post = other_post
+ expect(comment.post_id).to eq other_post.id
+ expect(comment.post).to eq other_post
end
context 'when the SObject is namespaced' do | Complete spec and implementation of assigning a belonged object. | ionia-corporation_active_force | train | rb,rb |
a24114aadfa27da0e5b8d30868d89a3180dac7ae | diff --git a/concrete/src/File/Image/BasicThumbnailer.php b/concrete/src/File/Image/BasicThumbnailer.php
index <HASH>..<HASH> 100644
--- a/concrete/src/File/Image/BasicThumbnailer.php
+++ b/concrete/src/File/Image/BasicThumbnailer.php
@@ -310,7 +310,9 @@ class BasicThumbnailer implements ThumbnailerInterface, ApplicationAwareInterfac
$abspath,
$maxWidth,
$maxHeight,
- $crop);
+ $crop,
+ $thumbnailsFormat
+ );
}
}
@@ -424,7 +426,8 @@ class BasicThumbnailer implements ThumbnailerInterface, ApplicationAwareInterfac
$maxWidth,
$maxHeight,
$crop,
- $thumbnailsFormat);
+ $thumbnailsFormat
+ );
} catch (\Exception $e) {
$abspath = false;
} | Aboid recalculating the thumbnail format | concrete5_concrete5 | train | php |
b304d352703e2fc7127ea1f6ef4d80402c44df54 | diff --git a/src/share/classes/com/sun/tools/javac/file/Paths.java b/src/share/classes/com/sun/tools/javac/file/Paths.java
index <HASH>..<HASH> 100644
--- a/src/share/classes/com/sun/tools/javac/file/Paths.java
+++ b/src/share/classes/com/sun/tools/javac/file/Paths.java
@@ -152,7 +152,7 @@ public class Paths {
pathsForLocation.put(location, p);
}
- boolean isDefaultBootClassPath() {
+ public boolean isDefaultBootClassPath() {
lazy();
return isDefaultBootClassPath;
} | <I>: Paths.isDefaultBootClassPath needs to be public
Reviewed-by: mcimadamore | wmdietl_jsr308-langtools | train | java |
cd41dde1facf1927827c94f716926a20c50c2621 | diff --git a/src/Models/MetadataTrait.php b/src/Models/MetadataTrait.php
index <HASH>..<HASH> 100644
--- a/src/Models/MetadataTrait.php
+++ b/src/Models/MetadataTrait.php
@@ -2,7 +2,6 @@
namespace AlgoWeb\PODataLaravel\Models;
use Illuminate\Support\Facades\Schema;
-use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\App;
use Illuminate\Database\Eloquent\Relations\Relation;
use POData\Providers\Metadata\ResourceStreamInfo;
@@ -229,30 +228,30 @@ trait MetadataTrait
*
* @return array
*/
- abstract function getVisible();
+ public abstract function getVisible();
/**
* Get the hidden attributes for the model.
*
* @return array
*/
- abstract function getHidden();
+ public abstract function getHidden();
/**
* Get the primary key for the model.
*
* @return string
*/
- abstract function getKeyName();
+ public abstract function getKeyName();
/**
* Get the current connection name for the model.
*
* @return string
*/
- abstract function getConnectionName();
+ public abstract function getConnectionName();
/**
* Get all of the current attributes on the model.
*
* @return array
*/
- abstract function getAttributes();
+ public abstract function getAttributes();
} | updated trait to explicitly declare the visibility for abstracts | Algo-Web_POData-Laravel | train | php |
70379d77be4908a0b127e2fa12d7a38e87940237 | diff --git a/sure/__init__.py b/sure/__init__.py
index <HASH>..<HASH> 100644
--- a/sure/__init__.py
+++ b/sure/__init__.py
@@ -606,6 +606,7 @@ class AssertionBuilder(object):
eql = equal
equals = equal
+ equal_to = equal
@assertionmethod
def an(self, klass): | Added `equal_to` as an alias for `equal`.
So now you can write `(2).should.be.equal_to(2)`. This reads better than `(2).should.be.equal(2)` | gabrielfalcao_sure | train | py |
9efd04b8ed792e39bbbb1b34f900eca5f54944a6 | diff --git a/lib/anemone/core.rb b/lib/anemone/core.rb
index <HASH>..<HASH> 100644
--- a/lib/anemone/core.rb
+++ b/lib/anemone/core.rb
@@ -50,9 +50,9 @@ module Anemone
:accept_cookies => false,
# skip any link with a query string? e.g. http://foo.com/?u=user
:skip_query_strings => false,
- # proxy address
- :proxy_address => nil,
- # proxy port
+ # proxy server hostname
+ :proxy_host => nil,
+ # proxy server port number
:proxy_port => false
}
diff --git a/lib/anemone/http.rb b/lib/anemone/http.rb
index <HASH>..<HASH> 100644
--- a/lib/anemone/http.rb
+++ b/lib/anemone/http.rb
@@ -77,8 +77,8 @@ module Anemone
#
# The proxy address string
#
- def proxy_address
- @opts[:proxy_address]
+ def proxy_host
+ @opts[:proxy_host]
end
#
@@ -153,7 +153,7 @@ module Anemone
end
def refresh_connection(url)
- http = Net::HTTP::Proxy(proxy_address, proxy_port)
+ http = Net::HTTP::Proxy(proxy_host, proxy_port)
if url.scheme == 'https'
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE | rename proxy_address to proxy_host | chriskite_anemone | train | rb,rb |
96d8261cc00f0c1b949dd19421fb37cec16a31dd | diff --git a/tests/CRUDlexTests/ServiceProviderTest.php b/tests/CRUDlexTests/ServiceProviderTest.php
index <HASH>..<HASH> 100644
--- a/tests/CRUDlexTests/ServiceProviderTest.php
+++ b/tests/CRUDlexTests/ServiceProviderTest.php
@@ -331,4 +331,11 @@ class ServiceProviderTest extends \PHPUnit_Framework_TestCase {
$this->assertSame($expected, $read);
}
+ public function testArrayColumn() {
+ $serviceProvider = new ServiceProvider();
+ $read = $serviceProvider->arrayColumn([['id' => 1], ['id' => 2], ['id' => 3]], 'id');
+ $expected = [1, 2, 3];
+ $this->assertSame($expected, $read);
+ }
+
} | testing ServiceProvider::arrayColumn | philiplb_CRUDlex | train | php |
51191f5d976177f64e61859618555d37c48d1880 | diff --git a/everest/views/base.py b/everest/views/base.py
index <HASH>..<HASH> 100644
--- a/everest/views/base.py
+++ b/everest/views/base.py
@@ -82,7 +82,7 @@ class ResourceView(object):
Respond with a 500 "Internal Server Error".
"""
- self._logger.debug('Request errors\n'
+ self._logger.error('Request errors\n'
'Error message: %s\nTraceback:%s' %
(message, traceback))
http_exc = HTTPInternalServerError(message) | Changed log level to "error" for exception handling in the view classes. | helixyte_everest | train | py |
37d4d29f5181c588ea7ef5b5cb6cbc3fb088a514 | diff --git a/lib/y2r/ast/ruby.rb b/lib/y2r/ast/ruby.rb
index <HASH>..<HASH> 100644
--- a/lib/y2r/ast/ruby.rb
+++ b/lib/y2r/ast/ruby.rb
@@ -753,7 +753,11 @@ module Y2R
end
def to_ruby_multi_line(context)
- wrapped_line_list(elements, "[", ",", "]", context)
+ if !elements.empty?
+ wrapped_line_list(elements, "[", ",", "]", context)
+ else
+ "[]"
+ end
end
end
diff --git a/spec/y2r/ast/ruby_spec.rb b/spec/y2r/ast/ruby_spec.rb
index <HASH>..<HASH> 100644
--- a/spec/y2r/ast/ruby_spec.rb
+++ b/spec/y2r/ast/ruby_spec.rb
@@ -2728,10 +2728,7 @@ module Y2R::AST::Ruby
describe "for multi-line arrays" do
it "emits correct code for empty arrays" do
- @node_empty.to_ruby(@context_narrow).should == [
- "[",
- "]"
- ].join("\n")
+ @node_empty.to_ruby(@context_narrow).should == "[]"
end
it "emits correct code for arrays with one element" do | Formatting: Never split an empty array to multiple lines | yast_y2r | train | rb,rb |
21d51d71bec4ca9ae375ffb24c5028ae83acb008 | diff --git a/examples/rational-pow.js b/examples/rational-pow.js
index <HASH>..<HASH> 100644
--- a/examples/rational-pow.js
+++ b/examples/rational-pow.js
@@ -36,6 +36,6 @@ f(x) = x^d - (a/b)^c
f'(x) = dx^(d-1)
Newton method:
-xp = xn - f(x) / f'(x)
+xp = xn - f(xn) / f'(xn)
*/ | Update rational-pow.js | infusion_Fraction.js | train | js |
e016f4fa98025f99175fad5ee010e049ff6d461e | diff --git a/pyked/chemked.py b/pyked/chemked.py
index <HASH>..<HASH> 100644
--- a/pyked/chemked.py
+++ b/pyked/chemked.py
@@ -14,7 +14,7 @@ import numpy as np
# Local imports
from .validation import schema, OurValidator, yaml
from .utils import Q_
-from .converters import datagroup_properties
+from .converters import datagroup_properties, ReSpecTh_to_ChemKED
VolumeHistory = namedtuple('VolumeHistory', ['time', 'volume'])
VolumeHistory.__doc__ = 'Time history of the volume in an RCM experiment'
@@ -103,6 +103,12 @@ class ChemKED(object):
for prop in ['chemked-version', 'experiment-type', 'file-authors', 'file-version']:
setattr(self, prop.replace('-', '_'), self._properties[prop])
+ @classmethod
+ def from_respecth(cls, filename_xml, file_author='', file_author_orcid=''):
+ properties = ReSpecTh_to_ChemKED(filename_xml, file_author, file_author_orcid,
+ validate=False)
+ return cls(dict_input=properties)
+
def validate_yaml(self, properties):
"""Validate the parsed YAML file for adherance to the ChemKED format. | Add a method to construct a ChemKED class instance from ReSpecTh XML
Utilize the ability of the ReSpecTh class to return a dictionary to
instantiate the ChemKED without writing an intermediate file | pr-omethe-us_PyKED | train | py |
51103159e5bc68f5a64c91656af0e48be8f9ee62 | diff --git a/src/nupic/regions/SDRClassifierRegion.py b/src/nupic/regions/SDRClassifierRegion.py
index <HASH>..<HASH> 100755
--- a/src/nupic/regions/SDRClassifierRegion.py
+++ b/src/nupic/regions/SDRClassifierRegion.py
@@ -470,15 +470,3 @@ class SDRClassifierRegion(PyRegion):
return self.maxCategoryCount
else:
raise ValueError("Unknown output {}.".format(outputName))
-
-
-
-if __name__ == "__main__":
- from nupic.engine import Network
-
- n = Network()
- classifier = n.addRegion(
- 'classifier',
- 'py.SDRClassifierRegion',
- '{steps: "1,2", alpha: 0.001}'
- ) | Remove main function from SDRClassifierRegion | numenta_nupic | train | py |
22b9ea3984d2b2f857008dd2863e4b2ead62eec7 | diff --git a/src/design.js b/src/design.js
index <HASH>..<HASH> 100644
--- a/src/design.js
+++ b/src/design.js
@@ -201,8 +201,8 @@ export class Design {
const ref = getRefFromNode(property);
if (!properties[ref]) {
properties[ref] = property;
+ values(property.propertyLookup).forEach(addUniqueProperty);
}
- values(property.propertyLookup).forEach(addUniqueProperty);
};
const graph = this.classes.map(node => { | should only recurse if property was not added | csenn_schesign-js-graph-utils | train | js |
994f6743316a2465c06d0fb735e743201d5eebe7 | diff --git a/src/Config/ConfigServiceProvider.php b/src/Config/ConfigServiceProvider.php
index <HASH>..<HASH> 100644
--- a/src/Config/ConfigServiceProvider.php
+++ b/src/Config/ConfigServiceProvider.php
@@ -19,9 +19,22 @@ class ConfigServiceProvider extends ServiceProvider
// Provide some compatibility with Themosis
$this->app->alias('config', 'config.factory');
- $this->app->singleton('config.finder', function () {
- return new ConfigFinder();
- });
+ // If we already have a finder available replace it, this is for users who
+ // are just including the library as a provider in their providers config file
+ if ($this->app->bound('config.finder')) {
+ $paths = $this->app['config.finder']->getPaths();
+
+ $this->app->singleton('config.finder', function ($app) use ($paths) {
+ return (new ConfigFinder)->addPaths($paths);
+ });
+ }
+ // Other wise create one, this is for users who are replacing the config service
+ // in it's entirety, before themosis has loaded any service providers.
+ else {
+ $this->app->singleton('config.finder', function () {
+ return new ConfigFinder();
+ });
+ }
}
/** | * Added some logic to detect if there's already a config.finder bound the app as some users will be importing config service provider in their theme's providers config file (as per the instructions, doh!) and not out and out replacing the service provider in a MU plugin like we are.
* TODO: we need a test suite around this otherwise things like this are going to continue getting through unnoticed. | djgadd_themosis-illuminate | train | php |
ff915244b127b88762878b7c57108a2791dd5a51 | diff --git a/examples/load_test/client.js b/examples/load_test/client.js
index <HASH>..<HASH> 100644
--- a/examples/load_test/client.js
+++ b/examples/load_test/client.js
@@ -47,7 +47,7 @@ async.forEachSeries(SIZES, function(n, cb) {
connectThem(n, {
jid: "test@localhost",
password: "test",
- boshURL: "http://localhost:25280"
+ boshURL: "http://127.0.0.1:25280"
}, function(e, clients) {
console.log("Connected",n,"in",getNow() - t1,"ms");
async.forEachSeries(clients, function(cl, cb3) { | examples/load_test client: don't use localhost dns name | xmppjs_xmpp.js | train | js |
f83211c684b0a1031001c448ff7a4cfbac8c1c1f | diff --git a/src/ajax/ajax.js b/src/ajax/ajax.js
index <HASH>..<HASH> 100644
--- a/src/ajax/ajax.js
+++ b/src/ajax/ajax.js
@@ -622,7 +622,7 @@ jQuery.extend({
// Wait for a response to come back
var onreadystatechange = function(isTimeout){
// The transfer is complete and the data is available, or the request timed out
- if ( xml && (xml.readyState == 4 || isTimeout == "timeout") ) {
+ if ( !requestDone && xml && (xml.readyState == 4 || isTimeout == "timeout") ) {
requestDone = true;
// clear poll interval | Added a fix to prevent the completion callback from firing multiple times in Firefox on OSX (fixed bug #<I>). | jquery_jquery | train | js |
efc12c8459d79a0beec105c1a8094f8957f016f7 | diff --git a/lib/brackets.js b/lib/brackets.js
index <HASH>..<HASH> 100644
--- a/lib/brackets.js
+++ b/lib/brackets.js
@@ -15,15 +15,17 @@ const brackets = {
current = [''];
last(stack).push(current);
stack.push(current);
+ continue;
+ }
- } else if (sym === ')') {
+ if (sym === ')') {
stack.pop();
current = last(stack);
current.push('');
-
- } else {
- current[current.length - 1] += sym;
+ continue;
}
+
+ current[current.length - 1] += sym;
}
return stack[0];
@@ -37,9 +39,10 @@ const brackets = {
for (const i of ast) {
if (typeof i === 'object') {
result += `(${brackets.stringify(i)})`;
- } else {
- result += i;
+ continue;
}
+
+ result += i;
}
return result;
} | [Refactor] Removes redundant else structures (#<I>)
Uses early returns (continue inside loops) so else statements are made redundant.
Result: less indentation, less code, more readable, easier to follow | postcss_autoprefixer | train | js |
9a05931b3d2be819196d7e8f1f0c6986d474a304 | diff --git a/lib/wrong/adapters/minitest.rb b/lib/wrong/adapters/minitest.rb
index <HASH>..<HASH> 100644
--- a/lib/wrong/adapters/minitest.rb
+++ b/lib/wrong/adapters/minitest.rb
@@ -9,6 +9,11 @@ class MiniTest::Unit::TestCase
MiniTest::Assertion
end
+ if MiniTest::VERSION >= "5.0.6"
+ alias_method :_assertions, :assertions
+ alias_method :"_assertions=", :"assertions="
+ end
+
def aver(valence, explanation = nil, depth = 0)
self._assertions += 1 # increment minitest's assert count
super(valence, explanation, depth + 1) # apparently this passes along the default block | found this minitest patch in my stash | sconover_wrong | train | rb |
c36f306a1da4e6b09bb472282adcb06fe71aa975 | diff --git a/server/v2/tests/delete_handler_test.go b/server/v2/tests/delete_handler_test.go
index <HASH>..<HASH> 100644
--- a/server/v2/tests/delete_handler_test.go
+++ b/server/v2/tests/delete_handler_test.go
@@ -87,7 +87,7 @@ func TestV2DeleteDirectoryRecursiveImpliesDir(t *testing.T) {
// Ensures that a key is deleted if the previous index matches
//
// $ curl -X PUT localhost:4001/v2/keys/foo -d value=XXX
-// $ curl -X DELETE localhost:4001/v2/keys/foo?prevIndex=1
+// $ curl -X DELETE localhost:4001/v2/keys/foo?prevIndex=2
//
func TestV2DeleteKeyCADOnIndexSuccess(t *testing.T) {
tests.RunServer(func(s *server.Server) {
@@ -97,7 +97,6 @@ func TestV2DeleteKeyCADOnIndexSuccess(t *testing.T) {
tests.ReadBody(resp)
resp, err = tests.DeleteForm(fmt.Sprintf("%s%s", s.URL(), "/v2/keys/foo?prevIndex=2"), url.Values{})
assert.Nil(t, err, "")
- fmt.Println(resp)
body := tests.ReadBodyJSON(resp)
assert.Equal(t, body["action"], "compareAndDelete", "") | test(delete_handler_test.go) fix inconsistent between test case and comments | etcd-io_etcd | train | go |
974ce15910ef815829044bb8973e615c10abb054 | diff --git a/src/wyc/stages/NameResolution.java b/src/wyc/stages/NameResolution.java
index <HASH>..<HASH> 100755
--- a/src/wyc/stages/NameResolution.java
+++ b/src/wyc/stages/NameResolution.java
@@ -58,7 +58,7 @@ import wyc.util.*;
* the first occurrence of a matching symbol, and records this as an attribute
* on the corresponding Abstract Syntax Tree (AST) node.
*
- * @author djp
+ * @author David J. Pearce
*
*/
public class NameResolution { | Ok, I think I've had enough documenting! Still quite a long ways to go ... | Whiley_WhileyCompiler | train | java |
97ff95c5545a05136d871bd3c38c550911d7c19a | diff --git a/src/sos/workflow_executor.py b/src/sos/workflow_executor.py
index <HASH>..<HASH> 100755
--- a/src/sos/workflow_executor.py
+++ b/src/sos/workflow_executor.py
@@ -1003,7 +1003,7 @@ class Base_Executor:
# if the job is failed
elif isinstance(res, Exception):
env.logger.debug(f'{i_am()} received an exception')
- env.logger.error(res)
+ # env.logger.error(res)
runnable._status = 'failed'
dag.save(env.config['output_dag'])
exec_error.append(runnable._node_id, res) | Stop displaying an error message because it will be added to exec_error later #<I> | vatlab_SoS | train | py |
73a1bf799c35fd8ba270987f71024d5ee5c6e165 | diff --git a/lib/cli.js b/lib/cli.js
index <HASH>..<HASH> 100755
--- a/lib/cli.js
+++ b/lib/cli.js
@@ -2,11 +2,18 @@
var install = require('./install');
var command = require('./command');
+var parsedArgv = require('minimist')(process.argv.slice(2));
-if (process.argv[2] === 'install') {
- install(require('minimist')(process.argv.slice(2)));
+if (parsedArgv._[0] === 'install') {
+ install(parsedArgv);
} else {
- command({
+ var options = {
args: process.argv.slice(2)
- });
+ };
+
+ if (parsedArgv.logLevel) {
+ options.logLevel = parsedArgv.logLevel;
+ }
+
+ command(options);
} | Better check for install command (#4)
* use minimist instead
* update to pass logLevel | Shopify_node-themekit | train | js |
3bd4f9bed9d15b5247c19af0de46cc20bf14b82c | diff --git a/src/main/java/org/davidmoten/rx/pool/MemberSingle.java b/src/main/java/org/davidmoten/rx/pool/MemberSingle.java
index <HASH>..<HASH> 100644
--- a/src/main/java/org/davidmoten/rx/pool/MemberSingle.java
+++ b/src/main/java/org/davidmoten/rx/pool/MemberSingle.java
@@ -242,7 +242,7 @@ final class MemberSingle<T> extends Single<Member<T>> implements Subscription, C
return true;
}
} else {
- log.info("insufficient demand to initialize {}", m);
+ log.debug("insufficient demand to initialize {}", m);
// don't need to initialize more so put back on queue and exit the loop
notInitialized.offer(m);
return false; | set log level for one statement to debug | davidmoten_rxjava2-jdbc | train | java |
3385f70fb920effc4018a271ebf6a00985d2fecc | diff --git a/generators/generator-base.js b/generators/generator-base.js
index <HASH>..<HASH> 100644
--- a/generators/generator-base.js
+++ b/generators/generator-base.js
@@ -48,11 +48,6 @@ const SERVER_MAIN_RES_DIR = constants.SERVER_MAIN_RES_DIR;
* The method signatures in public API should not be changed without a major version change
*/
module.exports = class extends PrivateBase {
- constructor(args, opts) {
- super(args, opts);
- this.needleApi = new NeedleApi(this);
- }
-
/**
* Deprecated
* Get the JHipster configuration from the .yo-rc.json file.
@@ -2098,4 +2093,11 @@ module.exports = class extends PrivateBase {
asDto(name) {
return name + this.dtoSuffix;
}
+
+ get needleApi() {
+ if (this._needleApi === undefined || this._needleApi === null) {
+ this._needleApi = new NeedleApi(this);
+ }
+ return this._needleApi;
+ }
}; | Load needleApi with a lazyLoading getter
Instead of initialise needleApi in the constructor we have to
do it in a getter to be sur it's never undefined (backwards
compatibility)
<URL> | jhipster_generator-jhipster | train | js |
d973359b1714536c36cf989278b7be8eff3e30ad | diff --git a/src/Application.php b/src/Application.php
index <HASH>..<HASH> 100644
--- a/src/Application.php
+++ b/src/Application.php
@@ -107,7 +107,7 @@ class Application extends Container
static::setInstance($this);
$this->instance('app', $this);
- $this->instance(static::class, $this);
+ $this->instance(self::class, $this);
$this->instance('path', $this->path());
diff --git a/tests/FullApplicationTest.php b/tests/FullApplicationTest.php
index <HASH>..<HASH> 100644
--- a/tests/FullApplicationTest.php
+++ b/tests/FullApplicationTest.php
@@ -710,6 +710,13 @@ class FullApplicationTest extends TestCase
$app->make(Illuminate\Contracts\Bus\Dispatcher::class)
);
}
+
+ public function testApplicationClassCanBeOverwritten()
+ {
+ $app = new LumenTestApplication();
+
+ $this->assertInstanceOf(LumenTestApplication::class, $app->make(Application::class));
+ }
}
class LumenTestService
@@ -794,6 +801,14 @@ class LumenTestAction
}
}
+class LumenTestApplication extends Application
+{
+ public function version()
+ {
+ return 'Custom Lumen App';
+ }
+}
+
class UserFacade
{
} | Fix overwriting the Application class
Added a test to verify the correct behavior. | laravel_lumen-framework | train | php,php |
410b0ab0ccc043370d6b67a8111c1e7000656620 | diff --git a/geocoder/google.py b/geocoder/google.py
index <HASH>..<HASH> 100644
--- a/geocoder/google.py
+++ b/geocoder/google.py
@@ -47,7 +47,7 @@ class Google(Base):
'key': None if self.client and self.client_secret else kwargs.get('key', google_key),
'client': self.client,
'bounds': kwargs.get('bounds', ''),
- 'language': kwargs.get('language ', ''),
+ 'language': kwargs.get('language', ''),
'region': kwargs.get('region', ''),
'components': kwargs.get('components', ''),
}
@@ -147,6 +147,10 @@ class Google(Base):
@property
def lng(self):
return self.parse['location'].get('lng')
+
+ @property
+ def place(self):
+ return self.parse.get('place_id')
@property
def quality(self): | Added Place_ID field and fix language param | DenisCarriere_geocoder | train | py |
6d080904fac49a7ff48750484220df98c20fd415 | diff --git a/pkg/services/alerting/result_handler.go b/pkg/services/alerting/result_handler.go
index <HASH>..<HASH> 100644
--- a/pkg/services/alerting/result_handler.go
+++ b/pkg/services/alerting/result_handler.go
@@ -29,7 +29,7 @@ func NewResultHandler() *DefaultResultHandler {
func (handler *DefaultResultHandler) Handle(ctx *EvalContext) {
oldState := ctx.Rule.State
- exeuctionError := ""
+ exeuctionError := " "
if ctx.Error != nil {
handler.log.Error("Alert Rule Result Error", "ruleId", ctx.Rule.Id, "error", ctx.Error)
ctx.Rule.State = m.AlertStateExeuctionError
@@ -41,7 +41,6 @@ func (handler *DefaultResultHandler) Handle(ctx *EvalContext) {
}
countSeverity(ctx.Rule.Severity)
-
if ctx.Rule.State != oldState {
handler.log.Info("New state change", "alertId", ctx.Rule.Id, "newState", ctx.Rule.State, "oldState", oldState) | tech(alerting): empty string does not update database | grafana_grafana | train | go |
8e5d501ca2657b1d5ebb46e1c945b87775bbe863 | diff --git a/django_rq/views.py b/django_rq/views.py
index <HASH>..<HASH> 100644
--- a/django_rq/views.py
+++ b/django_rq/views.py
@@ -3,6 +3,7 @@ from django.contrib.admin.views.decorators import staff_member_required
from django.http import Http404
from django.shortcuts import redirect, render
+from redis.exceptions import ResponseError
from rq import requeue_job, Worker
from rq.exceptions import NoSuchJobError
from rq.job import Job
@@ -110,8 +111,14 @@ def clear_queue(request, queue_index):
queue = get_queue_by_index(queue_index)
if request.method == 'POST':
- queue.empty()
- messages.info(request, 'You have successfully cleared the queue %s' % queue.name)
+ try:
+ queue.empty()
+ messages.info(request, 'You have successfully cleared the queue %s' % queue.name)
+ except ResponseError as e:
+ if 'EVALSHA' in e.message:
+ messages.error(request, 'This action is not supported on Redis versions < 2.6.0, please use the bulk delete command instead')
+ else:
+ raise e
return redirect('rq_jobs', queue_index)
context_data = { | Treat EVALSHA errors on Redis < <I>
This closes #<I>. | rq_django-rq | train | py |
391de51d100f619e66d70e6ca214b114d577c46e | diff --git a/code/libraries/koowa/components/com_files/controller/behavior/thumbnailable.php b/code/libraries/koowa/components/com_files/controller/behavior/thumbnailable.php
index <HASH>..<HASH> 100644
--- a/code/libraries/koowa/components/com_files/controller/behavior/thumbnailable.php
+++ b/code/libraries/koowa/components/com_files/controller/behavior/thumbnailable.php
@@ -31,6 +31,10 @@ class ComFilesControllerBehaviorThumbnailable extends KControllerBehaviorAbstrac
}
}
+ if (!count($files)) {
+ return;
+ }
+
$thumbnails = $this->getObject('com:files.controller.thumbnail')
->container($this->getModel()->getState()->container)
->folder($this->getRequest()->query->folder) | Make sure we don't fetch the whole folder when there are no files to generate thumbnails for. | joomlatools_joomlatools-framework | train | php |
5b3fdb5a383583bd1aa7a455fc47b549606b9005 | diff --git a/app/models/bit_player/participant_status.rb b/app/models/bit_player/participant_status.rb
index <HASH>..<HASH> 100644
--- a/app/models/bit_player/participant_status.rb
+++ b/app/models/bit_player/participant_status.rb
@@ -12,6 +12,10 @@ module BitPlayer
)
end
+ def decrement_content_position
+ update(content_position: content_position - 1)
+ end
+
def increment_content_position
update(content_position: content_position + 1)
end | Update participant_status.rb
This method is called by the navigator (i.e., fetch_previous_content) when a user proceeds to previous content. | NU-CBITS_bit_player | train | rb |
c441357101058abecf3abba4d217111237615ff8 | diff --git a/helpers/constants.py b/helpers/constants.py
index <HASH>..<HASH> 100644
--- a/helpers/constants.py
+++ b/helpers/constants.py
@@ -68,7 +68,7 @@ NOTIFICATION CONSTANTS
SOCKETIO_URL = 'https://my.goabode.com'
SOCKETIO_HEADERS = {
- 'Origin': 'https://my.goabode.com'
+ 'Origin': 'https://my.goabode.com/',
}
DEVICE_UPDATE_EVENT = 'com.goabode.device.update' | Add trailing slash to Origin header
This is to avoid an "origin not allowed" response. | MisterWil_abodepy | train | py |
b5e6c77b9f96b04b3bfc9ae8b1330a1a902a75f3 | diff --git a/test/delocalize_test.rb b/test/delocalize_test.rb
index <HASH>..<HASH> 100644
--- a/test/delocalize_test.rb
+++ b/test/delocalize_test.rb
@@ -31,7 +31,7 @@ class DelocalizeActiveRecordTest < ActiveRecord::TestCase
assert_equal date, @product.released_on
end
- test "delocalizes localized datetime" do
+ test "delocalizes localized datetime with year" do
time = Time.local(2009, 3, 1, 12, 0, 0)
@product.published_at = 'Sonntag, 1. März 2009, 12:00 Uhr'
@@ -39,6 +39,10 @@ class DelocalizeActiveRecordTest < ActiveRecord::TestCase
@product.published_at = '1. März 2009, 12:00 Uhr'
assert_equal time, @product.published_at
+ end
+
+ test "delocalizes localized datetime without year" do
+ time = Time.local(Date.today.year, 3, 1, 12, 0, 0)
@product.published_at = '1. März, 12:00 Uhr'
assert_equal time, @product.published_at | Make sure that datetime test runs across years. | clemens_delocalize | train | rb |
a8d4bff552f674dd7944d97c0144409bf7260eaf | diff --git a/test/base.js b/test/base.js
index <HASH>..<HASH> 100644
--- a/test/base.js
+++ b/test/base.js
@@ -9,8 +9,11 @@ describe("base", function () {
it("supports multiple instances", function () {
var
+ path = require("path"),
previousGpf = gpf,
- gpf2 = require("gpf-js");
+ gpf2;
+ gpf2 = require(path.resolve(process.cwd(),
+ "build/gpf-debug.js"));
assert("object" === typeof gpf2);
assert(null !== gpf2);
assert(previousGpf === gpf); | Improved access to latest gpf-debug | ArnaudBuchholz_gpf-js | train | js |
3cfe7e276a1caceff7ebf134b5a3f053687be5ea | diff --git a/__tests__/old-unit/support/RequestBuilder.js b/__tests__/old-unit/support/RequestBuilder.js
index <HASH>..<HASH> 100644
--- a/__tests__/old-unit/support/RequestBuilder.js
+++ b/__tests__/old-unit/support/RequestBuilder.js
@@ -28,16 +28,11 @@ module.exports = class RequestBuilder {
addHeader(key, value) {
this.request.headers[key] = value
-
- this.request.raw.req.rawHeaders = this.request.raw.req.rawHeaders.concat(
- key,
- value,
- )
+ this.request.raw.req.rawHeaders.push(key, value)
}
addBody(body) {
this.request.payload = body
-
// The rawPayload would normally be the string version of the given body
this.request.rawPayload = stringify(body)
} | Simplify adding rawHeaders in RequestBuilder | dherault_serverless-offline | train | js |
eab4f537cb72c67c2cfdc4715eb45ce41d675490 | diff --git a/byte-buddy-dep/src/main/java/net/bytebuddy/description/annotation/AnnotationDescription.java b/byte-buddy-dep/src/main/java/net/bytebuddy/description/annotation/AnnotationDescription.java
index <HASH>..<HASH> 100644
--- a/byte-buddy-dep/src/main/java/net/bytebuddy/description/annotation/AnnotationDescription.java
+++ b/byte-buddy-dep/src/main/java/net/bytebuddy/description/annotation/AnnotationDescription.java
@@ -1963,7 +1963,7 @@ public interface AnnotationDescription {
*/
@SuppressWarnings("unchecked")
public Builder defineTypeArray(String property, TypeDescription... typeDescription) {
- return define(property, AnnotationValue.ForComplexArray.<Class>of(typeDescription));
+ return define(property, AnnotationValue.ForComplexArray.of(typeDescription));
}
/** | Fixed another type inference compatibility issue for JDK 6. | raphw_byte-buddy | train | java |
25966e11484b691b437b19283352b485e87be14a | diff --git a/pkg/controller/garbagecollector/garbagecollector.go b/pkg/controller/garbagecollector/garbagecollector.go
index <HASH>..<HASH> 100644
--- a/pkg/controller/garbagecollector/garbagecollector.go
+++ b/pkg/controller/garbagecollector/garbagecollector.go
@@ -581,6 +581,9 @@ func (gc *GarbageCollector) worker() {
err := gc.processItem(timedItem.Object.(*node))
if err != nil {
utilruntime.HandleError(fmt.Errorf("Error syncing item %#v: %v", timedItem.Object, err))
+ // retry if garbage collection of an object failed.
+ gc.dirtyQueue.Add(timedItem)
+ return
}
DirtyProcessingLatency.Observe(sinceInMicroseconds(gc.clock, timedItem.StartTime))
} | gc retries failed garbage collection | kubernetes_kubernetes | train | go |
fb038cfa6c90fe5f5675abacf70ad4a9a19cdbf9 | diff --git a/src/Codeception/Module/WPDb.php b/src/Codeception/Module/WPDb.php
index <HASH>..<HASH> 100644
--- a/src/Codeception/Module/WPDb.php
+++ b/src/Codeception/Module/WPDb.php
@@ -2538,7 +2538,7 @@ class WPDb extends Db
*/
public function haveUserCapabilitiesInDatabase($userId, $role)
{
- $insert = User::buildCapabilities($role);
+ $insert = User::buildCapabilities($role, $this->grabTablePrefix());
$roleIds = [];
foreach ($insert as $meta_key => $meta_value) {
@@ -2625,7 +2625,7 @@ class WPDb extends Db
*/
public function haveUserLevelsInDatabase($userId, $role)
{
- $roles = User::buildCapabilities($role);
+ $roles = User::buildCapabilities($role, $this->grabTablePrefix());
$ids = [];
foreach ($roles as $roleMetaKey => $roleMetaValue) { | Pass the configured table prefix to the user capability builder. | lucatume_wp-browser | train | php |
cb13abf738709b57b3a481658d7c0226845704f3 | diff --git a/src/Model/Activity.php b/src/Model/Activity.php
index <HASH>..<HASH> 100644
--- a/src/Model/Activity.php
+++ b/src/Model/Activity.php
@@ -120,10 +120,22 @@ class Activity extends Resource
/**
* Get a human-readable description of the activity.
*
+ * @param bool $html Whether to include HTML in the output.
+ *
+ * @deprecated
+ * Use the "description" property instead, for a description wrapped in
+ * HTML tags. Or for plain text, just run it through strip_tags().
+ *
* @return string
*/
- public function getDescription()
+ public function getDescription($html = false)
{
+ if ($this->hasProperty('description')) {
+ $description = $this->getProperty('description');
+
+ return $html ? $description : strip_tags($description);
+ }
+
$type = $this->getProperty('type');
$payload = $this->getProperty('payload');
switch ($type) { | Use the activity description in the API if available | platformsh_platformsh-client-php | train | php |
110b5791284c5390f9908a0ccd058ead65667f2b | diff --git a/lib/parinfer.js b/lib/parinfer.js
index <HASH>..<HASH> 100644
--- a/lib/parinfer.js
+++ b/lib/parinfer.js
@@ -269,12 +269,12 @@ function commitChar(result, origCh) {
// Misc Utils
//------------------------------------------------------------------------------
-function clamp(val, min, max) {
- if (min !== null) {
- val = Math.max(min, val);
+function clamp(val, minN, maxN) {
+ if (minN !== null) {
+ val = Math.max(minN, val);
}
- if (max !== null) {
- val = Math.min(max, val);
+ if (maxN !== null) {
+ val = Math.min(maxN, val);
}
return val;
} | rename min and max (these are often reserved words) | shaunlebron_parinfer | train | js |
8ca8293d111611c8046463238098dbce1709c8f6 | diff --git a/influxql/functions.go b/influxql/functions.go
index <HASH>..<HASH> 100644
--- a/influxql/functions.go
+++ b/influxql/functions.go
@@ -935,28 +935,20 @@ type firstLastMapOutput struct {
}
// MapFirst collects the values to pass to the reducer
+// This function assumes time ordered input
func MapFirst(itr Iterator) interface{} {
- out := &firstLastMapOutput{}
- pointsYielded := false
-
- for k, v := itr.Next(); k != -1; k, v = itr.Next() {
- // Initialize first
- if !pointsYielded {
- out.Time = k
- out.Val = v
- pointsYielded = true
- }
- if k < out.Time {
- out.Time = k
- out.Val = v
- } else if k == out.Time && greaterThan(v, out.Val) {
- out.Val = v
- }
- }
- if pointsYielded {
- return out
+ k, v := itr.Next()
+ if k == -1 {
+ return nil
}
- return nil
+ nextk, nextv := itr.Next()
+ for nextk == k {
+ if greaterThan(nextv, v) {
+ v = nextv
+ }
+ nextk, nextv = itr.Next()
+ }
+ return &firstLastMapOutput{k, v}
}
// ReduceFirst computes the first of value. | only look at the first values for first()
Since we set up the aggregate queries so that iterator is ordered,
we only need to look at the first value. This cuts about <I> seconds
off a large single series query running first. | influxdata_influxdb | train | go |
e59ec3ee9ad7955321195f4c8bb23802fd8dd32e | diff --git a/src/TerminalObject/Helper/Art.php b/src/TerminalObject/Helper/Art.php
index <HASH>..<HASH> 100644
--- a/src/TerminalObject/Helper/Art.php
+++ b/src/TerminalObject/Helper/Art.php
@@ -68,6 +68,7 @@ trait Art
* Find a valid art path
*
* @param string $art
+ *
* @return array
*/
protected function artDir($art)
@@ -79,6 +80,7 @@ trait Art
* Find a valid art path
*
* @param string $art
+ *
* @return string
*/
protected function artFile($art)
@@ -88,19 +90,28 @@ trait Art
return reset($files);
}
+ /**
+ * Find a set of files in the current art directories
+ * based on a pattern
+ *
+ * @param string $art
+ * @param string $pattern
+ *
+ * @return array
+ */
protected function fileSearch($art, $pattern)
{
foreach ($this->art_dirs as $dir) {
// Look for anything that has the $art filename
- $paths = glob($dir . '/' . $art . $pattern);
+ $paths = glob($dir . '/' . $art . $pattern);
// If we've got one, no need to look any further
if (!empty($paths)) {
- break;
+ return $paths;
}
}
- return $paths;
+ return [];
}
/** | more specific about art paths variable, added docs | thephpleague_climate | train | php |
aa4c1aa7b940838576151fdbf140d46827b2e1f9 | diff --git a/index.js b/index.js
index <HASH>..<HASH> 100644
--- a/index.js
+++ b/index.js
@@ -36,11 +36,11 @@ function tileToGeoJSON(tile) {
var poly = {
type: 'Polygon',
coordinates: [[
- [bbox[0], bbox[1]],
[bbox[0], bbox[3]],
- [bbox[2], bbox[3]],
+ [bbox[0], bbox[1]],
[bbox[2], bbox[1]],
- [bbox[0], bbox[1]]
+ [bbox[2], bbox[3]],
+ [bbox[0], bbox[3]]
]]
};
return poly;
diff --git a/test.js b/test.js
index <HASH>..<HASH> 100644
--- a/test.js
+++ b/test.js
@@ -9,6 +9,13 @@ test('tile to geojson', function (t) {
var geojson = tilebelt.tileToGeoJSON(tile1);
t.ok(geojson, 'get geojson representation of tile');
t.equal(geojson.type, 'Polygon');
+ t.deepEqual(geojson.coordinates, [[
+ [-178.2421875, 84.73838712095339],
+ [-178.2421875, 84.7060489350415],
+ [-177.890625, 84.7060489350415],
+ [-177.890625, 84.73838712095339],
+ [-178.2421875, 84.73838712095339]
+ ]], 'Coordinates');
t.end();
}); | - fixes winding of GeoJSON to follow right-hand rule (#<I>) | mapbox_tilebelt | train | js,js |
5685de9c11df582c1d1f8661abc8eaca4111f604 | diff --git a/perceval/backends/mozilla/kitsune.py b/perceval/backends/mozilla/kitsune.py
index <HASH>..<HASH> 100644
--- a/perceval/backends/mozilla/kitsune.py
+++ b/perceval/backends/mozilla/kitsune.py
@@ -29,12 +29,12 @@ import requests
from grimoirelab.toolkit.datetime import str_to_datetime
from grimoirelab.toolkit.uris import urijoin
-from perceval.backend import (Backend,
- BackendCommand,
- BackendCommandArgumentParser,
- metadata)
-from perceval.client import HttpClient
-from perceval.errors import CacheError, ParseError
+from ...backend import (Backend,
+ BackendCommand,
+ BackendCommandArgumentParser,
+ metadata)
+from ...client import HttpClient
+from ...errors import CacheError, ParseError
logger = logging.getLogger(__name__) | [kitsune] Import perceval modules using relative paths
This patch changes the way how perceval modules are imported.
Now absolute paths are replaced by relative ones. | chaoss_grimoirelab-perceval-mozilla | train | py |
ee978362f0a2c423f4fcea31aeb3ae5e5ce8df5f | diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -32,6 +32,9 @@ def parse_requirements(filename):
# If py<=3.6 and opencv-contrib-python has not been installed, install version==3.2.0.7
reqs.remove("opencv-contrib-python")
reqs.append("opencv-contrib-python==3.2.0.7")
+ if sys.version_info.major == 2:
+ # facebook-wda only supports py3
+ reqs.remove("facebook-wda>=1.3.3")
return reqs | if it is py2, do not install facebook-wda
(cherry picked from commit ef9a<I>ae3da9cdc<I>c<I>ff7ce2c<I>bab9b) | AirtestProject_Airtest | train | py |
f8b0999122a52154716a549cdafe7d36190a4a4b | diff --git a/index.js b/index.js
index <HASH>..<HASH> 100644
--- a/index.js
+++ b/index.js
@@ -29,7 +29,6 @@ function PgError(pgErr) {
this.pgErr = pgErr;
}
PgError.prototype = Object.create(Error.prototype);
-// PgError.prototype.constructor = PgError;
function createOrDropDatabase(action) {
action = action.toUpperCase(); | nit: remove commented out code | olalonde_pgtools | train | js |
11efd1943d9333986a008ce908963d80c90b881f | diff --git a/python/bigdl/utils/common.py b/python/bigdl/utils/common.py
index <HASH>..<HASH> 100644
--- a/python/bigdl/utils/common.py
+++ b/python/bigdl/utils/common.py
@@ -600,7 +600,7 @@ def _java2py(gateway, r, encoding="bytes"):
clsName = 'JavaRDD'
if clsName == 'JavaRDD':
- jrdd = gateway.jvm.SerDe.javaToPython(r)
+ jrdd = gateway.jvm.org.apache.spark.bigdl.api.python.BigDLSerDe.javaToPython(r)
return RDD(jrdd, get_spark_context())
if clsName == 'DataFrame': | fix java to python (#<I>) | intel-analytics_BigDL | train | py |
119bf67a61fab939f4bfc9443d3c338ea42ca354 | diff --git a/holoviews/operation/element.py b/holoviews/operation/element.py
index <HASH>..<HASH> 100644
--- a/holoviews/operation/element.py
+++ b/holoviews/operation/element.py
@@ -406,8 +406,11 @@ class contours(ElementOperation):
else:
contour_fn = plt.contour
contour_type = Contours
- if isinstance(element, Raster):
+ if type(element) is Raster:
+ data = [np.flipud(element.data)]
+ elif isinstance(element, Raster):
data = [element.data]
+
elif isinstance(element, QuadMesh):
data = (element.dimension_values(0, True),
element.dimension_values(1, True), | Fixed bug when applying contour operation to Raster
Addresses issue #<I> | pyviz_holoviews | train | py |
8fc98526533e509e8c6cf03a411bf7b76cb65a7a | diff --git a/Kwc/Newsletter/Controller.php b/Kwc/Newsletter/Controller.php
index <HASH>..<HASH> 100644
--- a/Kwc/Newsletter/Controller.php
+++ b/Kwc/Newsletter/Controller.php
@@ -47,6 +47,7 @@ class Kwc_Newsletter_Controller extends Kwc_Directories_Item_Directory_Controlle
$newDetailRow = $newDetail->row;
$newDetailRow->create_date = date('Y-m-d H:i:s');
$newDetailRow->last_sent_date = null;
+ $newDetailRow->count_sent = 0;
$newDetailRow->status = null;
$newDetailRow->save(); | also reset count_sent when duplicating newsletter | koala-framework_koala-framework | train | php |
2db1c6c54cf99ceb5215c85c9948157c0a891edc | diff --git a/remodel/models.py b/remodel/models.py
index <HASH>..<HASH> 100644
--- a/remodel/models.py
+++ b/remodel/models.py
@@ -109,11 +109,11 @@ class Model(object):
if result['errors'] > 0:
raise OperationError(result['first_error'])
- delattr(self.fields, 'id')
# Remove any reference to the deleted object
for field in self.fields.related:
delattr(self.fields, field)
+ delattr(self.fields, 'id')
self._run_callbacks('after_delete')
# TODO: Get rid of this nasty decorator after renaming .get() on ObjectHandler | moved the removal of the id attribute to after the removal of relations | linkyndy_remodel | train | py |
f631057bdc9a95050fa507b5ac0395b59104f810 | diff --git a/Minimal-J/src/main/java/ch/openech/mj/toolkit/ClientToolkit.java b/Minimal-J/src/main/java/ch/openech/mj/toolkit/ClientToolkit.java
index <HASH>..<HASH> 100644
--- a/Minimal-J/src/main/java/ch/openech/mj/toolkit/ClientToolkit.java
+++ b/Minimal-J/src/main/java/ch/openech/mj/toolkit/ClientToolkit.java
@@ -91,10 +91,6 @@ public abstract class ClientToolkit {
void close(Object result);
}
- // Focus
-
-// public abstract void focusFirstComponent(IComponent component);
-
// Up / Dowload
public abstract void export(IComponent parent, String buttonText, ExportHandler exportHandler); | ClientToolkit: removed dead comment about focus first component. Not
part of the Toolkit class anymore but handled by the toolkits
internally. | BrunoEberhard_minimal-j | train | java |
908799d68061a7cd89019471e087d0aef52f4fa9 | diff --git a/src/request.php b/src/request.php
index <HASH>..<HASH> 100644
--- a/src/request.php
+++ b/src/request.php
@@ -53,16 +53,16 @@ public static function get_url() {
* or false for unknown types
*/
public static function get_method() {
- if (empty($_SERVER['HTTP_METHOD'])) {
+ if (empty($_SERVER['REQUEST_METHOD'])) {
return 'GET';
}
$allowed_methods = array('GET', 'PUT', 'POST', 'PATCH', 'DELETE', 'OPTIONS', 'HEAD');
- if (in_array($_SERVER['HTTP_METHOD'], $allowed_methods) == false) {
+ if (in_array($_SERVER['REQUEST_METHOD'], $allowed_methods) == false) {
return false;
}
- return $_SERVER['HTTP_METHOD'];
+ return $_SERVER['REQUEST_METHOD'];
}
/** | Use REQUEST_METHOD to find method of request
Instead op HTTP_METHOD REQUEST_METHOD should be used. | lode_fem | train | php |
71a0f325a12e20d1ab4b824f76bbc98ca82b40ac | diff --git a/src/test/java/io/vlingo/http/resource/RequestHandler0Test.java b/src/test/java/io/vlingo/http/resource/RequestHandler0Test.java
index <HASH>..<HASH> 100644
--- a/src/test/java/io/vlingo/http/resource/RequestHandler0Test.java
+++ b/src/test/java/io/vlingo/http/resource/RequestHandler0Test.java
@@ -37,7 +37,7 @@ public class RequestHandler0Test {
}
@Test()
- public void throwExceptionWhenNoHandlerIsSet() {
+ public void throwExceptionWhenNoHandlerIsDefined() {
thrown.expect(HandlerMissingException.class);
thrown.expectMessage("No handler defined for GET /helloworld"); | changed RequestHandler0Test method renamed | vlingo_vlingo-http | train | java |
43275848f1519d138f7010a2cf644c5dfff13fab | diff --git a/client/gutenberg/extensions/simple-payments/edit.js b/client/gutenberg/extensions/simple-payments/edit.js
index <HASH>..<HASH> 100644
--- a/client/gutenberg/extensions/simple-payments/edit.js
+++ b/client/gutenberg/extensions/simple-payments/edit.js
@@ -111,7 +111,11 @@ class SimplePaymentsEdit extends Component {
this.setState( { isSavingProduct: true }, async () => {
saveEntityRecord( 'postType', SIMPLE_PAYMENTS_PRODUCT_POST_TYPE, this.toApi() )
.then( record => {
- record && setAttributes( { paymentId: record.id } );
+ if ( record ) {
+ setAttributes( { paymentId: record.id } );
+ }
+
+ return record;
} )
.catch( error => {
// @TODO: complete error handling
@@ -462,7 +466,7 @@ const mapSelectToProps = withSelect( ( select, props ) => {
: undefined;
return {
- hasPublishAction: get( getCurrentPost(), [ '_links', 'wp:action-publish' ], false ),
+ hasPublishAction: !! get( getCurrentPost(), [ '_links', 'wp:action-publish' ] ),
isSaving: !! isSavingPost(),
simplePayment,
}; | Simple payments block: fix small code smells (#<I>) | Automattic_wp-calypso | train | js |
9a3e82975252c3bb2930902d3a9e8dc782daa22f | diff --git a/epsilon/hotfixes/trial_assertwarns.py b/epsilon/hotfixes/trial_assertwarns.py
index <HASH>..<HASH> 100644
--- a/epsilon/hotfixes/trial_assertwarns.py
+++ b/epsilon/hotfixes/trial_assertwarns.py
@@ -1,12 +1,9 @@
"""
-failUnlessWarns assertion from twisted.trial in the pending 2.6 release.
-
-This is from r20668; it should be updated as bugfixes are made.
+failUnlessWarns assertion from twisted.trial in Twisted 8.0.
"""
import warnings
-from pprint import pformat
def failUnlessWarns(self, category, message, filename, f,
*args, **kwargs):
@@ -36,8 +33,13 @@ def failUnlessWarns(self, category, message, filename, f,
finally:
warnings.warn_explicit = origExplicit
- self.assertEqual(len(warningsShown), 1, pformat(warningsShown))
- gotMessage, gotCategory, gotFilename, lineno = warningsShown[0][:4]
+ if not warningsShown:
+ self.fail("No warnings emitted")
+ first = warningsShown[0]
+ for other in warningsShown[1:]:
+ if other[:2] != first[:2]:
+ self.fail("Can't handle different warnings")
+ gotMessage, gotCategory, gotFilename, lineno = first[:4]
self.assertEqual(gotMessage, message)
self.assertIdentical(gotCategory, category) | Merge update-assertwarns-<I>
Author: exarkun
Reviewer: moea
Fixes: #<I>
Change the Epsilon hotfix for twisted.trial.unittest.TestCase.assertWarns
so that it matches the code actually released in Twisted <I>. | twisted_epsilon | train | py |
e2c8e691218a1a6346954dc7f5b9a335967655c6 | diff --git a/test/test.py b/test/test.py
index <HASH>..<HASH> 100755
--- a/test/test.py
+++ b/test/test.py
@@ -3,10 +3,17 @@
from __future__ import absolute_import, division, print_function, unicode_literals
-import os, sys, shutil, argparse, subprocess, unittest, io, contextlib
+import os, sys, shutil, argparse, subprocess, unittest, contextlib
import pexpect, pexpect.replwrap
from tempfile import TemporaryFile, NamedTemporaryFile, mkdtemp
+try:
+ # Python 2
+ from cStringIO import StringIO
+except ImportError:
+ # Python 3
+ from io import StringIO
+
TEST_DIR = os.path.abspath(os.path.dirname(__file__)) # noqa
BASE_DIR = os.path.dirname(TEST_DIR) # noqa
sys.path.insert(0, BASE_DIR) # noqa
@@ -1413,7 +1420,7 @@ class Warn(unittest.TestCase):
finally:
argcomplete.debug_stream = debug_stream
- test_stream = io.StringIO()
+ test_stream = StringIO()
with redirect_debug_stream(test_stream):
warn("My hands are tied") | Fix failing test in Python <I> (#<I>) | kislyuk_argcomplete | train | py |
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.