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 |
|---|---|---|---|---|---|
64d4fb15bf8a9eb62caf3e79b9cf193db3b5e8dd | diff --git a/src/Producer.php b/src/Producer.php
index <HASH>..<HASH> 100644
--- a/src/Producer.php
+++ b/src/Producer.php
@@ -31,6 +31,13 @@ class Producer
$queue = $this->queues->create($queueName);
$queue->enqueue($envelope = new Envelope($message));
- $this->dispatcher->dispatch(BernardEvents::PRODUCE, new EnvelopeEvent($envelope, $queue));
+ $this->dispatch(BernardEvents::PRODUCE, new EnvelopeEvent($envelope, $queue));
+ }
+
+ private function dispatch($eventName, EnvelopeEvent $event)
+ {
+ $this->dispatcher instanceof \Symfony\Contracts\EventDispatcher\EventDispatcherInterface
+ ? $this->dispatcher->dispatch($event, $eventName)
+ : $this->dispatcher->dispatch($eventName, $event);
}
} | Increase compatibility with Symfony <I> by using proper order of parameters | bernardphp_bernard | train | php |
00e30f3106cdd3e1e0728af3046b7a002454a31c | diff --git a/discord/ext/commands/bot.py b/discord/ext/commands/bot.py
index <HASH>..<HASH> 100644
--- a/discord/ext/commands/bot.py
+++ b/discord/ext/commands/bot.py
@@ -268,13 +268,13 @@ class Bot(GroupMixin, discord.Client):
@asyncio.coroutine
def close(self):
- for extension in self.extensions:
+ for extension in tuple(self.extensions):
try:
self.unload_extension(extension)
except:
pass
- for cog in self.cogs:
+ for cog in tuple(self.cogs):
try:
self.remove_cog(cog)
except: | [commands] Shield against dictionary resize in Bot.close | Rapptz_discord.py | train | py |
0049a9745be5ad1b72e6bd24bc3aeb8c1218c451 | diff --git a/lxd/storage/drivers/driver_cephfs_volumes.go b/lxd/storage/drivers/driver_cephfs_volumes.go
index <HASH>..<HASH> 100644
--- a/lxd/storage/drivers/driver_cephfs_volumes.go
+++ b/lxd/storage/drivers/driver_cephfs_volumes.go
@@ -343,7 +343,8 @@ func (d *cephfs) MountVolume(vol Volume, op *operations.Operation) (bool, error)
}
// UnmountVolume clears any runtime state for the volume.
-func (d *cephfs) UnmountVolume(vol Volume, op *operations.Operation) (bool, error) {
+// As driver doesn't have volumes to unmount it returns false indicating the volume was already unmounted.
+func (d *cephfs) UnmountVolume(vol Volume, keepBlockDev bool, op *operations.Operation) (bool, error) {
return false, nil
} | lxd/storage/drivers/driver/cephfs/volumes: Adds keepBlockDev arg to UnmountVolume | lxc_lxd | train | go |
ab42ba5de3d40a0edaed38e9f61ab52cedf1a873 | diff --git a/lib/parse/push.rb b/lib/parse/push.rb
index <HASH>..<HASH> 100755
--- a/lib/parse/push.rb
+++ b/lib/parse/push.rb
@@ -13,7 +13,7 @@ module Parse
attr_accessor :push_time
attr_accessor :data
- def initialize(data, channel = "")
+ def initialize(data, channel = "", client=nil)
@data = data
if !channel || channel.empty?
@@ -22,6 +22,8 @@ module Parse
else
@channel = channel
end
+
+ @client = client || Parse.client
end
def save
@@ -52,7 +54,7 @@ module Parse
body.merge!({ :expiration_time => @expiration_time }) if @expiration_time
body.merge!({ :push_time => @push_time }) if @push_time
- response = Parse.client.request uri, :post, body.to_json, nil
+ response = @client.request uri, :post, body.to_json, nil
end
end | Added support for specified Parse client instantiation in push initializer | adelevie_parse-ruby-client | train | rb |
5ee82f38b98f553682c06d5c19fdf51b3a7b4229 | diff --git a/sdk/cognitivelanguage/azure-ai-language-conversations/setup.py b/sdk/cognitivelanguage/azure-ai-language-conversations/setup.py
index <HASH>..<HASH> 100644
--- a/sdk/cognitivelanguage/azure-ai-language-conversations/setup.py
+++ b/sdk/cognitivelanguage/azure-ai-language-conversations/setup.py
@@ -74,6 +74,7 @@ setup(
},
install_requires=[
"azure-core<2.0.0,>=1.24.0",
+ "isodate>=0.6.0",
],
project_urls={
'Bug Reports': 'https://github.com/Azure/azure-sdk-for-python/issues', | add dependency on isodate since we removed msrest (#<I>) | Azure_azure-sdk-for-python | train | py |
09ff35983547f681997b8721761b7be9fcfea8ab | diff --git a/seleniumbase/core/log_helper.py b/seleniumbase/core/log_helper.py
index <HASH>..<HASH> 100755
--- a/seleniumbase/core/log_helper.py
+++ b/seleniumbase/core/log_helper.py
@@ -10,7 +10,10 @@ from seleniumbase.config import settings
def log_screenshot(test_logpath, driver):
screenshot_name = settings.SCREENSHOT_NAME
screenshot_path = "%s/%s" % (test_logpath, screenshot_name)
- driver.get_screenshot_as_file(screenshot_path)
+ try:
+ driver.get_screenshot_as_file(screenshot_path)
+ except Exception:
+ print("WARNING: Unable to get screenshot for failure logs!")
def log_test_failure_data(test, test_logpath, driver, browser): | Better handling of failure screenshots for logs | seleniumbase_SeleniumBase | train | py |
74ef9dd0581ce1618dfb57e50be49cdf0ea2445f | diff --git a/src/geo/leaflet/torque.js b/src/geo/leaflet/torque.js
index <HASH>..<HASH> 100644
--- a/src/geo/leaflet/torque.js
+++ b/src/geo/leaflet/torque.js
@@ -46,6 +46,7 @@ var LeafLetTorqueLayer = L.TorqueLayer.extend({
auth_token: layerModel.get('auth_token'),
no_cdn: layerModel.get('no_cdn'),
dynamic_cdn: layerModel.get('dynamic_cdn'),
+ loop: layerModel.get('loop'),
instanciateCallback: function() {
var cartocss = layerModel.get('cartocss') || layerModel.get('tile_style'); | registers the loop option on the torque layer when called from cdbjs | CartoDB_carto.js | train | js |
f7e475811b297ced783f48f128b2a940a894ba6d | diff --git a/launch_control/dashboard_app/admin.py b/launch_control/dashboard_app/admin.py
index <HASH>..<HASH> 100644
--- a/launch_control/dashboard_app/admin.py
+++ b/launch_control/dashboard_app/admin.py
@@ -39,7 +39,6 @@ class BundleStreamAdminForm(forms.ModelForm):
def clean(self):
cleaned_data = self.cleaned_data
- print cleaned_data
if (cleaned_data.get('user', '') is not None and
cleaned_data.get('group') is not None):
raise forms.ValidationError('BundleStream cannot have both user ' | Remove debugging print statement from admin panel | zyga_json-schema-validator | train | py |
23b9b4815677c1b4912de61c8289c7a0ec0d183e | diff --git a/scripts/deploy-gh-pages.js b/scripts/deploy-gh-pages.js
index <HASH>..<HASH> 100644
--- a/scripts/deploy-gh-pages.js
+++ b/scripts/deploy-gh-pages.js
@@ -1,6 +1,6 @@
var path = require('path');
var ghpages = require('gh-pages');
-var basePath = path.join(__dirname, '../dist');
+var basePath = path.join(__dirname, '../docs/dist');
var repoUrl = require('../package.json').repository.url;
var GH_PAGES_TOKEN = process.env.GH_PAGES_TOKEN; | docs(site): Fix GitHub Pages deployment (#<I>) | seek-oss_seek-style-guide | train | js |
7f7942f357d97a911dc820fdb6de2ece6deaf362 | diff --git a/test/src/Provider/GoogleTest.php b/test/src/Provider/GoogleTest.php
index <HASH>..<HASH> 100644
--- a/test/src/Provider/GoogleTest.php
+++ b/test/src/Provider/GoogleTest.php
@@ -44,7 +44,10 @@ class GoogleTest extends \PHPUnit_Framework_TestCase
$this->assertEquals('mock_access_type', $query['access_type']);
$this->assertEquals('mock_domain', $query['hd']);
- $this->assertEquals('profile email', $query['scope']);
+
+ $this->assertContains('email', $query['scope']);
+ $this->assertContains('profile', $query['scope']);
+ $this->assertContains('openid', $query['scope']);
$this->assertAttributeNotEmpty('state', $this->provider);
} | Update test for new scope definition
Refs #2 | osufpp_oauth2-ifsta | train | php |
04882e0d196c384bcacfaa5a8a1df731b0e0d37c | diff --git a/js/waves.js b/js/waves.js
index <HASH>..<HASH> 100644
--- a/js/waves.js
+++ b/js/waves.js
@@ -262,7 +262,7 @@
if (!(target instanceof SVGElement) && target.className.indexOf('waves-effect') !== -1) {
element = target;
break;
- } else if (target.classList.contains('waves-effect')) {
+ } else if (target.className.indexOf('waves-effect') !== -1) {
element = target;
break;
} | Changed classList to className for better compatibility | Dogfalo_materialize | train | js |
5342d3d5d8feb3cc6b3c38a149b4199cf9cde7df | diff --git a/test/model.js b/test/model.js
index <HASH>..<HASH> 100644
--- a/test/model.js
+++ b/test/model.js
@@ -384,17 +384,6 @@ $(document).ready(function() {
equal(lastError, "Can't change admin status.");
});
- test("isValid", function() {
- var model = new Backbone.Model({valid: true});
- model.validate = function(attrs) {
- if (!attrs.valid) return "invalid";
- };
- equal(model.isValid(), true);
- equal(model.set({valid: false}), false);
- equal(model.isValid(), true);
- ok(!model.set('valid', false, {silent: true}));
- });
-
test("save", 2, function() {
doc.save({title : "Henry V"});
equal(this.syncArgs.method, 'update');
@@ -818,12 +807,6 @@ $(document).ready(function() {
model.set({a: true});
});
- test("#1179 - isValid returns true in the absence of validate.", 1, function() {
- var model = new Backbone.Model();
- model.validate = null;
- ok(model.isValid());
- });
-
test("#1122 - clear does not alter options.", 1, function() {
var model = new Backbone.Model();
var options = {}; | removing old isValid tests | jashkenas_backbone | train | js |
63ab600c7100a1563e0c9dda124799e654d56609 | diff --git a/server/helpers/link-to-record.js b/server/helpers/link-to-record.js
index <HASH>..<HASH> 100644
--- a/server/helpers/link-to-record.js
+++ b/server/helpers/link-to-record.js
@@ -3,7 +3,6 @@
*
* usage: {{#link-to-record record=record class="btn btn-default"}}Text inside the link{{/link-to-record}}
*/
-var hbs = require('hbs');
module.exports = function(we) {
return function linkTo() {
@@ -23,6 +22,6 @@ module.exports = function(we) {
l += options.fn(this);
l += '</a>';
- return new hbs.SafeString(l);
+ return new we.hbs.SafeString(l);
}
}
\ No newline at end of file | remove uneed require hbs from link-to-record helper | wejs_we-core | train | js |
0d6d184a8535d1befd3477b14c236430ae02ab9b | diff --git a/Gruntfile.js b/Gruntfile.js
index <HASH>..<HASH> 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -72,6 +72,18 @@ module.exports = function(grunt) {
// Copy folders and files
copy: {
+ cssAsScss: {
+ files: [
+ {
+ expand: true,
+ cwd: 'src/assets/_components',
+ src: ['**/*.css'],
+ dest: 'src/assets/_components',
+ filter: 'isFile',
+ ext: ".scss"
+ }
+ ]
+ },
jekyllBuildToDist: {
files: [
{ | Add task to transform css into scss. | happyplan_happyplan | train | js |
ec0a526e16f809c22e7729b55fa98a4b348f3ced | diff --git a/src/js/components/LoginForm.js b/src/js/components/LoginForm.js
index <HASH>..<HASH> 100644
--- a/src/js/components/LoginForm.js
+++ b/src/js/components/LoginForm.js
@@ -97,7 +97,7 @@ var LoginForm = React.createClass({
</FormField>
</fieldset>
{errors}
- <Button className={CLASS_ROOT + "__submit"} primary={true} strong={true}
+ <Button id="login_button" className={CLASS_ROOT + "__submit"} primary={true} strong={true}
label={this.getGrommetIntlMessage('Log In')}
onClick={this._onSubmit} />
{footer} | Added ID to login button for test automation | grommet_grommet | train | js |
6c5c3a51c9174e4c996e8bb8d3456040a88ec6db | diff --git a/src/core/body.js b/src/core/body.js
index <HASH>..<HASH> 100644
--- a/src/core/body.js
+++ b/src/core/body.js
@@ -495,6 +495,28 @@
},
/**
+ * Body#toBodyCoords( v ) -> Physics.vector
+ * - v (Physics.vector): The vector to transform
+ * + (Physics.vector): The transformed vector
+ *
+ * Transform a vector into coordinates relative to this body.
+ **/
+ toBodyCoords: function( v ){
+ return v.vsub( this.state.pos ).rotate( -this.state.angular.pos );
+ },
+
+ /**
+ * Body#toWorldCoords( v ) -> Physics.vector
+ * - v (Physics.vector): The vector to transform
+ * + (Physics.vector): The transformed vector
+ *
+ * Transform a vector from body coordinates into world coordinates.
+ **/
+ toWorldCoords: function( v ){
+ return v.rotate( this.state.angular.pos ).vadd( this.state.pos );
+ },
+
+ /**
* Body#recalc() -> this
*
* Recalculate properties. | feature re #<I> methods transform world/body coords | wellcaffeinated_PhysicsJS | train | js |
66fec362943ce608432bf8e62d38a0bcf001d12e | diff --git a/lib/evalhook.rb b/lib/evalhook.rb
index <HASH>..<HASH> 100644
--- a/lib/evalhook.rb
+++ b/lib/evalhook.rb
@@ -139,8 +139,15 @@ module EvalHook
def hooked_method(receiver, mname, klass = nil) #:nodoc:
m = nil
+ is_method_missing = false
+
unless klass
- m = receiver.method(mname)
+ m = begin
+ receiver.method(mname)
+ rescue
+ is_method_missing = true
+ receiver.public_method(:method_missing)
+ end
klass = m.owner
else
m = klass.instance_method(mname).bind(receiver)
@@ -160,6 +167,10 @@ module EvalHook
end
end
+ if is_method_missing
+ orig_m = m
+ m = lambda{|*x| orig_m.call(mname,*x) }
+ end
m
end | <I> test pass: method missing with one argument | tario_evalhook | train | rb |
d59431761382e4cf28299418eb5c4a47c62aee80 | diff --git a/src/Maple.js b/src/Maple.js
index <HASH>..<HASH> 100644
--- a/src/Maple.js
+++ b/src/Maple.js
@@ -113,7 +113,7 @@ import events from './helpers/Events.js';
mutations.forEach((mutation) => {
- var addedNodes = utility.toArray(mutation.addedNodes);
+ let addedNodes = utility.toArray(mutation.addedNodes);
addedNodes.forEach((node) => {
diff --git a/src/helpers/Utility.js b/src/helpers/Utility.js
index <HASH>..<HASH> 100644
--- a/src/helpers/Utility.js
+++ b/src/helpers/Utility.js
@@ -227,7 +227,7 @@ export default (function main($document) {
*/
isHTMLImport(htmlElement) {
- var isInstance = htmlElement instanceof HTMLLinkElement,
+ let isInstance = htmlElement instanceof HTMLLinkElement,
isImport = String(htmlElement.getAttribute('rel')).toLowerCase() === 'import',
hasHrefAttr = htmlElement.hasAttribute('href'),
hasTypeHtml = String(htmlElement.getAttribute('type')).toLowerCase() === 'text/html'; | Changed from 'var' to 'let' :zzz: | Wildhoney_Maple.js | train | js,js |
1b036d11380741555c57d06fa3d3f4c55a26472f | diff --git a/src/components/notebook.js b/src/components/notebook.js
index <HASH>..<HASH> 100644
--- a/src/components/notebook.js
+++ b/src/components/notebook.js
@@ -1,5 +1,5 @@
import React from 'react';
-import { DragDropContext } from 'react-dnd';
+import { DragDropContext as dragDropContext } from 'react-dnd';
import HTML5Backend from 'react-dnd-html5-backend';
import DraggableCell from './cell/draggable-cell';
@@ -97,4 +97,4 @@ class Notebook extends React.Component {
}
}
-export default DragDropContext(HTML5Backend)(Notebook);
+export default dragDropContext(HTML5Backend)(Notebook); | Appease the linter and myself. | nteract_nteract | train | js |
77729dcff733f708154d4a0afb009b90520189f7 | diff --git a/src/Message/AIMResponse.php b/src/Message/AIMResponse.php
index <HASH>..<HASH> 100644
--- a/src/Message/AIMResponse.php
+++ b/src/Message/AIMResponse.php
@@ -24,7 +24,7 @@ class AIMResponse extends AbstractResponse
$xml = preg_replace('/<createTransactionResponse[^>]+>/', '<createTransactionResponse>', (string)$data);
try {
- $xml = simplexml_load_string($xml);
+ $xml = simplexml_load_string($xml, 'SimpleXMLElement', LIBXML_NOWARNING);
} catch (\Exception $e) {
throw new InvalidResponseException();
} | Forgot to save file before last commit. | thephpleague_omnipay-authorizenet | train | php |
79b9c1597706293e61cec465d08fff9f14db2781 | diff --git a/lib/svtplay_dl/__init__.py b/lib/svtplay_dl/__init__.py
index <HASH>..<HASH> 100644
--- a/lib/svtplay_dl/__init__.py
+++ b/lib/svtplay_dl/__init__.py
@@ -14,7 +14,7 @@ from svtplay_dl.log import log
from svtplay_dl.utils import decode_html_entities, filenamify, select_quality
from svtplay_dl.service import service_handler, Generic
from svtplay_dl.fetcher import VideoRetriever
-from svtplay_dl.subtitle import subtitle, subtitle_json, subtitle_sami, subtitle_smi, subtitle_tt, subtitle_wsrt
+from svtplay_dl.subtitle import subtitle
__version__ = "0.9.2014.04.27" | init: removing unused imports. | spaam_svtplay-dl | train | py |
0fb6ca94be4a471bb36be0c3c90dbb901d1f46ec | diff --git a/src/rest/Response.php b/src/rest/Response.php
index <HASH>..<HASH> 100644
--- a/src/rest/Response.php
+++ b/src/rest/Response.php
@@ -20,7 +20,7 @@ class Response {
function __construct (ResponseInterface $response) {
$this->status_code = $response->getStatusCode();
$this->headers = $response->getHeaders();
- $this->body = $response->getBody();
+ $this->body = $response->getBody()->getContents();
$this->ok = 400 <= $this->status_code && $this->status_code < 600;
$this->json = json_decode($this->body);
} | TSMD-<I> return body as string | TeleSign_php_telesign | train | php |
735451af3baea4bef62dd18b7b1d0b78c3b3418d | diff --git a/tests/spec/Inheritance.js b/tests/spec/Inheritance.js
index <HASH>..<HASH> 100644
--- a/tests/spec/Inheritance.js
+++ b/tests/spec/Inheritance.js
@@ -25,6 +25,22 @@ describe("John Resig Simple Inheritance", function () {
var p = new Person(true);
var n = new Ninja();
+ it("p is an instance of Person", function () {
+ expect(p).toBeInstanceOf(Person);
+ });
+
+ it("p is not an instance of Ninja", function () {
+ expect(p).not.toBeInstanceOf(Ninja);
+ });
+
+ it("n is an instance of Ninja", function () {
+ expect(n).toBeInstanceOf(Ninja);
+ });
+
+ it("n is also an instance of Person", function () {
+ expect(n).toBeInstanceOf(Person);
+ });
+
it("p can dance", function () {
expect(p.dance()).toEqual(true);
}); | added more test cases to the inheritance test unit | melonjs_melonJS | train | js |
f98592eeabcaa445b88ed25fa6fa5acd45ac8af3 | diff --git a/gwpy/io/cache.py b/gwpy/io/cache.py
index <HASH>..<HASH> 100644
--- a/gwpy/io/cache.py
+++ b/gwpy/io/cache.py
@@ -70,7 +70,7 @@ except NameError: # python3.x
# -- cache I/O ----------------------------------------------------------------
def read_cache(cachefile, coltype=LIGOTimeGPS):
- """Read a LAL- for FFL-format cache file as a list of file paths
+ """Read a LAL- or FFL-format cache file as a list of file paths
Parameters
---------- | gwpy.io: fixed typo in docstring
[skip ci] [skip appveyor] | gwpy_gwpy | train | py |
07c2f556219fef2c135e4cdf09c95dca3a90806e | diff --git a/src/routerComponent.js b/src/routerComponent.js
index <HASH>..<HASH> 100644
--- a/src/routerComponent.js
+++ b/src/routerComponent.js
@@ -83,7 +83,7 @@ export default class RouterComponent extends Component {
});
}
- if (this.currentComponent !== null) {
+ if (this.currentComponent !== undefined && this.currentComponent !== null) {
this.currentComponent.activate();
}
}; | routerComponent: FIX: exception if initial path is incorrect | kuraga_rotorjs | train | js |
36097a57efb7b1339b33af4aa8ee508b395a6037 | diff --git a/session.go b/session.go
index <HASH>..<HASH> 100644
--- a/session.go
+++ b/session.go
@@ -944,7 +944,7 @@ func (q *Query) DefaultTimestamp(enable bool) *Query {
// WithTimestamp will enable the with default timestamp flag on the query
// like DefaultTimestamp does. But also allows to define value for timestamp.
// It works the same way as USING TIMESTAMP in the query itself, but
-// should not break prepared query optimization
+// should not break prepared query optimization.
//
// Only available on protocol >= 3
func (q *Query) WithTimestamp(timestamp int64) *Query {
@@ -1722,7 +1722,7 @@ func (b *Batch) DefaultTimestamp(enable bool) *Batch {
// WithTimestamp will enable the with default timestamp flag on the query
// like DefaultTimestamp does. But also allows to define value for timestamp.
// It works the same way as USING TIMESTAMP in the query itself, but
-// should not break prepared query optimization
+// should not break prepared query optimization.
//
// Only available on protocol >= 3
func (b *Batch) WithTimestamp(timestamp int64) *Batch { | docs(session): add missing full stop (#<I>)
...for full sentence comment. This makes the comment consistent with the
rest of the documentation. | gocql_gocql | train | go |
91cbd826a9fae3d001c63be845784ca9215cd963 | diff --git a/ExternalModule.php b/ExternalModule.php
index <HASH>..<HASH> 100644
--- a/ExternalModule.php
+++ b/ExternalModule.php
@@ -245,7 +245,7 @@ class ExternalModule extends Module implements iExternalModule
if(!isset($this->vendor)) {
// Generate vendor from namespace
$reflector = new \ReflectionClass(get_class($this));
- $vendor = str_replace('samson\\', '', $reflector->getNamespaceName());
+ $vendor = str_replace( '\\', '_', str_replace('samson\\', '', $reflector->getNamespaceName()));
}
// Default license | Changed composer @name field generation to support subnamespaces | samsonos_php_core | train | php |
8c48841980e3d71c631b8698bbbe2ff7c1c2873b | diff --git a/app/models/dj_mon/dj_report.rb b/app/models/dj_mon/dj_report.rb
index <HASH>..<HASH> 100644
--- a/app/models/dj_mon/dj_report.rb
+++ b/app/models/dj_mon/dj_report.rb
@@ -82,8 +82,8 @@ module DjMon
end
private
- def l_datetime date
- date.present? ? I18n.l(date) : ""
+ def l_datetime time
+ time.present? ? time.strftime("%b %d %H:%M:%S") : ""
end
end | format time in a fixed format, instead of the localized one | akshayrawat_dj_mon | train | rb |
0c8efdb7ed19ce2676eccbfc3ceecc45a423e167 | diff --git a/demo/boot.php b/demo/boot.php
index <HASH>..<HASH> 100644
--- a/demo/boot.php
+++ b/demo/boot.php
@@ -15,11 +15,9 @@
$pinterest->auth->setOAuthToken($token->access_token);
setcookie("access_token", $token->access_token);
- }
- else if (isset($_GET["access_token"])) {
+ } else if (isset($_GET["access_token"])) {
$pinterest->auth->setOAuthToken($_GET["access_token"]);
- }
- else if (isset($_COOKIE["access_token"])) {
+ } else if (isset($_COOKIE["access_token"])) {
$pinterest->auth->setOAuthToken($_COOKIE["access_token"]);
} | Scrutinizer Auto-Fixes
This commit consists of patches automatically generated for this project on <URL> | dirkgroenen_Pinterest-API-PHP | train | php |
91554a0ce9ef2af2c58957584830e5319b16f353 | diff --git a/addok/debug.py b/addok/debug.py
index <HASH>..<HASH> 100644
--- a/addok/debug.py
+++ b/addok/debug.py
@@ -250,10 +250,10 @@ class Cli(object):
if not doc:
print(red('Not found.'))
return
- self._print_field_index_details(doc[b'name'].decode(), _id)
- self._print_field_index_details(doc[b'postcode'].decode(), _id)
- self._print_field_index_details(doc[b'city'].decode(), _id)
- self._print_field_index_details(doc[b'context'].decode(), _id)
+ for field in config.FIELDS:
+ key = field['key'].encode()
+ if key in doc:
+ self._print_field_index_details(doc[key].decode(), _id)
def do_bestscore(self, word):
"""Return document linked to word with higher score. | Loop over config.FIELDS in debug INDEX command | addok_addok | train | py |
8653297ec1c3442ec102186eddd9b4bf202a998e | diff --git a/security/src/main/java/org/jboss/as/security/service/SecurityActions.java b/security/src/main/java/org/jboss/as/security/service/SecurityActions.java
index <HASH>..<HASH> 100644
--- a/security/src/main/java/org/jboss/as/security/service/SecurityActions.java
+++ b/security/src/main/java/org/jboss/as/security/service/SecurityActions.java
@@ -43,7 +43,7 @@ class SecurityActions {
try {
return AccessController.doPrivileged(new PrivilegedExceptionAction<ModuleClassLoader>() {
public ModuleClassLoader run() throws ModuleLoadException {
- ModuleLoader loader = Module.getCurrentModuleLoader();
+ ModuleLoader loader = Module.getCallerModuleLoader();
ModuleIdentifier identifier = ModuleIdentifier.fromString(moduleSpec);
return loader.loadModule(identifier).getClassLoader();
} | Getting rid of deprecated method | wildfly_wildfly | train | java |
4d145f8ac576ccac3652c1d0806832a0496ab67f | diff --git a/cmd/rqlited/main.go b/cmd/rqlited/main.go
index <HASH>..<HASH> 100644
--- a/cmd/rqlited/main.go
+++ b/cmd/rqlited/main.go
@@ -139,6 +139,7 @@ func main() {
// Configure logging and pump out initial message.
log.SetFlags(log.LstdFlags)
+ log.SetOutput(os.Stderr)
log.SetPrefix("[rqlited] ")
log.Printf("rqlited starting, version %s, commit %s, branch %s", version, commit, branch)
log.Printf("architecture target is %s, operating system target is %s", runtime.GOARCH, runtime.GOOS) | main code should also log to stderr | rqlite_rqlite | train | go |
1bf49dda8d0d285058234f1508b5abc5c5b75e29 | diff --git a/src/Router.php b/src/Router.php
index <HASH>..<HASH> 100644
--- a/src/Router.php
+++ b/src/Router.php
@@ -206,13 +206,13 @@ class Router extends Core
$sGets = str_replace("index.php?", "", $sGets);
parse_str($sGets, $output);
- $_GET['NAME_CONTROLLER'] = !empty($output['NAME_CONTROLLER'])?$output['NAME_CONTROLLER']:$routerConfig->get('NAME_CONTROLLER');;
- $_GET['NAME_MODEL'] = !empty($output['NAME_MODEL'])?$output['NAME_MODEL']:$routerConfig->get('NAME_MODEL');;
+ $_GET['task'] = !empty($output['task'])?$output['task']:$routerConfig->get('NAME_CONTROLLER');;
+ $_GET['action'] = !empty($output['action'])?$output['action']:$routerConfig->get('NAME_MODEL');;
}
}
-
+
private function parseUrl($sRequest){
$sVars = null;
foreach($this->aRoutingParse AS $k => $v){ | Bugfix router without friendlyUrl | dframe_dframe | train | php |
df277b2fe0b32a38ba144dbf73a8c5c5e7ee573f | diff --git a/CGRtools/reactor.py b/CGRtools/reactor.py
index <HASH>..<HASH> 100644
--- a/CGRtools/reactor.py
+++ b/CGRtools/reactor.py
@@ -20,7 +20,7 @@
from collections import defaultdict
from functools import reduce
from itertools import chain, count, islice, permutations, product
-from logging import warning
+from logging import warning, info
from operator import or_
from .containers import QueryContainer, QueryCGRContainer, MoleculeContainer, CGRContainer, ReactionContainer
@@ -317,6 +317,8 @@ class Reactor:
if intersection:
mapping = {k: v for k, v in zip(intersection, count(max(checked_atoms) + 1))}
structure = structure.remap(mapping, copy=True)
+ info("some atoms in input structures had the same numbers.\n"
+ f"atoms {list(mapping)} were remapped to {list(mapping.values())}")
checked_atoms.update(structure.atoms_numbers)
checked.append(structure)
return checked | logging info added (#<I>)
* logging info added | cimm-kzn_CGRtools | train | py |
6d3f0f653b55420bad3a3f69ee22afd3a30bb081 | diff --git a/src/crypto/store/indexeddb-crypto-store.js b/src/crypto/store/indexeddb-crypto-store.js
index <HASH>..<HASH> 100644
--- a/src/crypto/store/indexeddb-crypto-store.js
+++ b/src/crypto/store/indexeddb-crypto-store.js
@@ -312,6 +312,7 @@ export class IndexedDBCryptoStore {
* @param {*} txn An active transaction. See doTxn().
* @param {function(string)} func Called with the private key
* @param {string} type A key type
+ * @returns {Promise} a promise
*/
async getCrossSigningPrivateKey(txn, func, type) {
return this._backend.getCrossSigningPrivateKey(txn, func, type);
@@ -333,6 +334,7 @@ export class IndexedDBCryptoStore {
* @param {*} txn An active transaction. See doTxn().
* @param {string} type The type of cross-signing private key to store
* @param {string} key keys object as getCrossSigningKeys()
+ * @returns {Promise} a promise
*/
storeCrossSigningPrivateKey(txn, type, key) {
return this._backend.storeCrossSigningPrivateKey(txn, type, key); | there's some days that the linter and i, we just really don't see eye-to-eye | matrix-org_matrix-js-sdk | train | js |
db4d6f7f2e1da4b19c23d88be6e3cac2d989f876 | diff --git a/galpy/potential_src/TwoPowerSphericalPotential.py b/galpy/potential_src/TwoPowerSphericalPotential.py
index <HASH>..<HASH> 100644
--- a/galpy/potential_src/TwoPowerSphericalPotential.py
+++ b/galpy/potential_src/TwoPowerSphericalPotential.py
@@ -420,6 +420,7 @@ class JaffePotential(TwoPowerIntegerSphericalPotential):
self.beta= 4
if normalize:
self.normalize(normalize)
+ self.hasC= True
return None
def _evaluate(self,R,z,phi=0.,t=0.,dR=0,dphi=0): | added C implementation of JaffePotential | jobovy_galpy | train | py |
f0f45a262153dffe023101bf9e284130722ac881 | diff --git a/scripts/release/steps/post-publish-steps.js b/scripts/release/steps/post-publish-steps.js
index <HASH>..<HASH> 100644
--- a/scripts/release/steps/post-publish-steps.js
+++ b/scripts/release/steps/post-publish-steps.js
@@ -14,7 +14,7 @@ const EDIT_URL = `https://github.com/${SCHEMA_REPO}/edit/master/${SCHEMA_PATH}`;
// Any optional or manual step can be warned in this script.
async function checkSchema() {
- const schema = await execa.stdout("node scripts/generate-schema.js");
+ const schema = await execa.stdout("node", ["scripts/generate-schema.js"]);
const remoteSchema = await logPromise(
"Checking current schema in SchemaStore",
fetch(RAW_URL) | chore(scripts): fix checkSchema command | josephfrazier_prettier_d | train | js |
ecdbc3bb985dc881b31f02895815420d23d438f3 | diff --git a/lib/rest-core/middleware.rb b/lib/rest-core/middleware.rb
index <HASH>..<HASH> 100644
--- a/lib/rest-core/middleware.rb
+++ b/lib/rest-core/middleware.rb
@@ -10,7 +10,7 @@ module RestCore::Middleware
mod.send(:include, RestCore)
mod.send(:attr_reader, :app)
return unless mod.respond_to?(:members)
- accessors = mod.members.map{ |member| <<-RUBY }.join("\n")
+ src = mod.members.map{ |member| <<-RUBY }
def #{member} env
if env.key?('#{member}')
env['#{member}']
@@ -24,12 +24,15 @@ module RestCore::Middleware
args = [:app] + mod.members
args_list = args.join(', ')
ivar_list = args.map{ |a| "@#{a}" }.join(', ')
- initialize = <<-RUBY
+ src << <<-RUBY
def initialize #{args_list}
#{ivar_list} = #{args_list}
end
+ self
RUBY
- mod.module_eval("#{accessors}\n#{initialize}")
+ accessor = Module.new.module_eval(src.join("\n"))
+ mod.const_set(:Accessor, accessor)
+ mod.send(:include, accessor)
end
def call env ; app.call(env) ; end | middleware.rb: create Accessor to make initialize overridable | godfat_rest-core | train | rb |
dc7b9db905a2bf78fc4286dd71173663d2d4e088 | diff --git a/src/main/javascript/webpack/CopyAssets.js b/src/main/javascript/webpack/CopyAssets.js
index <HASH>..<HASH> 100644
--- a/src/main/javascript/webpack/CopyAssets.js
+++ b/src/main/javascript/webpack/CopyAssets.js
@@ -61,6 +61,11 @@ function getCopyPatterns(destination, projectRoot)
force: true
},
{
+ from: path.resolve(projectRoot, 'src', 'main', 'docs', 'README.md'),
+ to: path.join(projectRoot, destination, 'README.md'),
+ force: true
+ },
+ {
from: path.resolve(projectRoot, 'manifest.json'),
to: path.join(projectRoot, destination, 'manifest.json'),
force: true | copy src/docs/README.md to bundle root | deskpro_apps-dpat | train | js |
92f30164db809abf2f72e20181963cdde17570a3 | diff --git a/lib/ohai/plugins/linux/platform.rb b/lib/ohai/plugins/linux/platform.rb
index <HASH>..<HASH> 100644
--- a/lib/ohai/plugins/linux/platform.rb
+++ b/lib/ohai/plugins/linux/platform.rb
@@ -95,7 +95,7 @@ elsif lsb[:id] =~ /ScientificSL/i
platform "scientific"
platform_version lsb[:release]
elsif lsb[:id] =~ /XenServer/i
- platform " xenserver"
+ platform "xenserver"
platform_version lsb[:release]
elsif lsb[:id] # LSB can provide odd data that changes between releases, so we currently fall back on it rather than dealing with its subtleties
platform lsb[:id].downcase
@@ -108,7 +108,7 @@ case platform
platform_family "debian"
when /fedora/
platform_family "fedora"
- when /oracle/, /centos/, /redhat/, /scientific/, /enterprise/, /amazon/, /xenserver/
+ when /oracle/, /centos/, /redhat/, /scientific/, /enterpriseenterprise/, /amazon/, /xenserver/ # Note that 'enterpriseenterprise' is oracle's LSB "distributor ID"
platform_family "rhel"
when /suse/
platform_family "suse" | Removed an additional space and reverted the name enterprise to enterpriseenterprise. Also added a comment to inform that this is oracle's LSB "distributor ID" | chef_ohai | train | rb |
4ae0db14f780d8491a64ddfa8267e98dd95c6b54 | diff --git a/tests/Backend/FileTest.php b/tests/Backend/FileTest.php
index <HASH>..<HASH> 100644
--- a/tests/Backend/FileTest.php
+++ b/tests/Backend/FileTest.php
@@ -85,4 +85,23 @@ class FileTest extends \PHPUnit_Framework_TestCase
$this->assertLessThan(time() + 550, $contents['lifetime']);
}
+ /**
+ * @dataProvider getTestDataForGetFilename
+ */
+ public function test_getFilename_shouldConstructFilenameFromId($id, $expectedFilename)
+ {
+ $this->assertEquals($expectedFilename, $this->cache->getFilename($id));
+ }
+
+ public function getTestDataForGetFilename()
+ {
+ $dir = realpath($this->getPath());
+
+ return [
+ ['genericid', $dir . '/genericid.php'],
+ ['id with space', $dir . '/id with space.php'],
+ ['id \/ with :"?_ spe<>cial cha|rs', $dir . '/id with _ special chars.php'],
+ ['with % allowed & special chars', $dir . '/with % allowed & special chars.php'],
+ ];
+ }
}
\ No newline at end of file | Adding unit test for getFilename() since it is public now. | matomo-org_component-cache | train | php |
a139c06a446cd7aba842652639e41cf261ddb9cf | diff --git a/src/system/modules/metamodels/dca/tl_metamodel_filtersetting.php b/src/system/modules/metamodels/dca/tl_metamodel_filtersetting.php
index <HASH>..<HASH> 100644
--- a/src/system/modules/metamodels/dca/tl_metamodel_filtersetting.php
+++ b/src/system/modules/metamodels/dca/tl_metamodel_filtersetting.php
@@ -64,7 +64,7 @@ $GLOBALS['TL_DCA']['tl_metamodel_filtersetting'] = array
(
'label' => &$GLOBALS['TL_LANG']['MSC']['backBT'],
// TODO: this is an evil hack, replace with something better.
- 'href' => str_replace(array('contao/main.php?do=metamodel', $this->Environment->url), '', $this->getReferer(false, 'tl_metamodel_filter')),
+ 'href' => str_replace(array('contao/main.php?do=metamodels', $this->Environment->url), '', $this->getReferer(false, 'tl_metamodel_filter')),
'class' => 'header_back',
'attributes' => 'onclick="Backend.getScrollOffset();"'
) | Fix issue #<I> - back path in BE is calculated wrong and appends an "&s" at the end for each iteration. | MetaModels_core | train | php |
0d1f0143f36d15a7cb173bce3181b375e3ca6188 | diff --git a/inspire_schemas/builders.py b/inspire_schemas/builders.py
index <HASH>..<HASH> 100644
--- a/inspire_schemas/builders.py
+++ b/inspire_schemas/builders.py
@@ -645,7 +645,8 @@ class LiteratureBuilder(object):
material=None,
holder=None,
statement=None,
- url=None
+ url=None,
+ year=None
):
"""Add Copyright.
@@ -656,6 +657,8 @@ class LiteratureBuilder(object):
:type statement: string
:type url: string
+
+ :type year: int
"""
copyright = {}
for key in ('holder', 'statement', 'url'):
@@ -665,6 +668,9 @@ class LiteratureBuilder(object):
if material is not None:
copyright['material'] = material.lower()
+ if year is not None:
+ copyright['year'] = int(year)
+
self._append_to('copyright', copyright)
@filter_empty_parameters | builder: add `copyright.year` field to the builder
* Adds missing `copyright.year` field to the `builders.add_copyright`.
Closes #<I> | inspirehep_inspire-schemas | train | py |
af6f079c3cd34ab90dec42a9e67f9f5a7fed6b57 | diff --git a/mod/resource/type/ims/resource.class.php b/mod/resource/type/ims/resource.class.php
index <HASH>..<HASH> 100644
--- a/mod/resource/type/ims/resource.class.php
+++ b/mod/resource/type/ims/resource.class.php
@@ -454,25 +454,13 @@ class resource_ims extends resource_base {
/// differs depending on some php variables.
echo "
<style type='text/css'>
- #ims-menudiv {
- position:absolute;
- left:5px;
- width:300px;
- overflow:auto;
- float:left;
- }
-
- #ims-containerdiv {
- width:100%;
-
- }
#ims-contentframe {
position:absolute;
";
if (!empty($this->parameters->navigationmenu)) {
- echo "left:310px;";
+ echo "left:260px;";
}
echo "
border:0px;
@@ -495,6 +483,7 @@ class resource_ims extends resource_base {
echo "</div></div></body></html>";
}
else {
+ /// Putting the footer inside one div to be able to handle it
print_footer();
} | Moving some harcoded styles in ims cp to standard | moodle_moodle | train | php |
1b5a25c0ef351113c169c72a61c1522cd7c3d788 | diff --git a/scanner.go b/scanner.go
index <HASH>..<HASH> 100644
--- a/scanner.go
+++ b/scanner.go
@@ -242,6 +242,14 @@ func scanMultilineBasicString(b []byte) ([]byte, bool, []byte, error) {
}
escaped = true
i++ // skip the next character
+ case '\r':
+ if len(b) < i+2 {
+ return nil, escaped, nil, newDecodeError(b[len(b):], `need a \n after \r`)
+ }
+ if b[i+1] != '\n' {
+ return nil, escaped, nil, newDecodeError(b[i:i+2], `need a \n after \r`)
+ }
+ i++ // skip the \n
}
}
diff --git a/unmarshaler_test.go b/unmarshaler_test.go
index <HASH>..<HASH> 100644
--- a/unmarshaler_test.go
+++ b/unmarshaler_test.go
@@ -2591,6 +2591,14 @@ world'`,
data: "A = \"\r\"",
},
{
+ desc: `carriage return inside basic multiline string`,
+ data: "a=\"\"\"\r\"\"\"",
+ },
+ {
+ desc: `carriage return at the trail of basic multiline string`,
+ data: "a=\"\"\"\r",
+ },
+ {
desc: `carriage return inside literal string`,
data: "A = '\r'",
}, | Decoder: fail on unescaped \r not followed by \n (#<I>)
Fixes #<I> | pelletier_go-toml | train | go,go |
7bc91531d7cc80b259e3d8cb8077850a2dc03d9c | diff --git a/drivers/ruby/lib/func.rb b/drivers/ruby/lib/func.rb
index <HASH>..<HASH> 100644
--- a/drivers/ruby/lib/func.rb
+++ b/drivers/ruby/lib/func.rb
@@ -11,6 +11,7 @@ module RethinkDB
:replace => :non_atomic, :update => :non_atomic, :insert => :upsert
}
@@opt_off = {
+ :replace => -1, :update => -1, :insert => -1, :delete => -1,
:reduce => -1, :between => -1, :grouped_map_reduce => -1,
:table => -1, :table_create => -1,
:get_all => -1, :eq_join => -1, | Made a change to the ruby driver that might make it support the durability option in insert, replace, update, and delete, properly. Or maybe not. | rethinkdb_rethinkdb | train | rb |
d83cce29ffbfc2b38cba59583847b059ac35e959 | diff --git a/termtool.py b/termtool.py
index <HASH>..<HASH> 100644
--- a/termtool.py
+++ b/termtool.py
@@ -216,16 +216,14 @@ class Termtool(object):
return parser
- def _configure_logging(self, args):
- """Configure the `logging` module to the log level requested in the
- specified `argparse.Namespace` instance.
+ def configure(self, args):
+ """Configure the tool according to the command line arguments.
- The `args` namespace's ``verbosity`` should be a list of integers, the
- sum of which specifies which log level to use: sums from 0 to 4
- inclusive map to the standard `logging` log levels from
- `logging.CRITICAL` to `logging.DEBUG`. If the ``verbosity`` list sums
- to less than 0, level `logging.CRITICAL` is still used; for more than
- 4, `logging.DEBUG`.
+ Override this method to configure your tool with the values of any
+ other options it supports.
+
+ This implementation configures the `logging` module to the log level
+ requested by the user through the ``-v`` and ``-q`` options.
"""
log_level = args.loglevel
@@ -255,7 +253,7 @@ class Termtool(object):
parser = self.build_arg_parser()
args = parser.parse_args(args)
- self._configure_logging(args)
+ self.configure(args)
# The callable subcommand is parsed out as the "func" arg.
try: | Expose the configure() method as overridable | markpasc_arghlog | train | py |
40c36cf13b75484da3bdf38acbf7fa0f293b534c | diff --git a/lib/perfectqueue/backend/rdb_compat.rb b/lib/perfectqueue/backend/rdb_compat.rb
index <HASH>..<HASH> 100644
--- a/lib/perfectqueue/backend/rdb_compat.rb
+++ b/lib/perfectqueue/backend/rdb_compat.rb
@@ -319,8 +319,6 @@ SQL
raise PreemptedError, "task key=#{key} does not exist or preempted."
elsif row[:created_at] == nil
raise PreemptedError, "task key=#{key} preempted."
- elsif row[:created_at] <= 0
- raise CancelRequestedError, "task key=#{key} is cancel requested."
else # row[:timeout] == next_timeout
# ok
end
diff --git a/spec/rdb_compat_backend_spec.rb b/spec/rdb_compat_backend_spec.rb
index <HASH>..<HASH> 100644
--- a/spec/rdb_compat_backend_spec.rb
+++ b/spec/rdb_compat_backend_spec.rb
@@ -329,8 +329,8 @@ describe Backend::RDBCompatBackend do
db.submit(key, 'test', nil, {})
db.cancel_request(key, options)
end
- it 'raises PreemptedError' do
- expect{db.heartbeat(task_token, 0, {})}.to raise_error(CancelRequestedError)
+ it 'returns nil' do
+ expect( db.heartbeat(task_token, 0, {}) ).to be_nil
end
end
end | Remove dead code in RDBCompatBackend#heartbeat
it updates rows WHERE id=key AND created_at IS NOT NULL,
but excluding created_at = 0, which means cancel_request.
Therefore the path won't be used. | treasure-data_perfectqueue | train | rb,rb |
45e1b1ce3f6dc169b5ef6fbd69977026aa6f2fc8 | diff --git a/pronto/serializers/_fastobo.py b/pronto/serializers/_fastobo.py
index <HASH>..<HASH> 100644
--- a/pronto/serializers/_fastobo.py
+++ b/pronto/serializers/_fastobo.py
@@ -205,11 +205,11 @@ class FastoboSerializer:
if r.symmetric:
frame.append(fastobo.typedef.IsSymmetricClause(True))
if r.transitive:
- frame.append(fastobo.typedef.IsTransitive(True))
+ frame.append(fastobo.typedef.IsTransitiveClause(True))
if r.functional:
- frame.append(fastobo.typedef.IsFunctional(True))
+ frame.append(fastobo.typedef.IsFunctionalClause(True))
if r.inverse_functional:
- frame.append(fastobo.typedef.IsInverseFunctional(True))
+ frame.append(fastobo.typedef.IsInverseFunctionalClause(True))
for superclass in sorted(r.relationships.get('is_a', ())):
frame.append(fastobo.typedef.IsAClause(fastobo.id.parse(superclass)))
for i in sorted(r.intersection_of): | Fix issues with typedef serialization in `FastoboSerializer` | althonos_pronto | train | py |
3fe066f0fa1b6b0de2e3807c3c1eb868a7f16ad2 | diff --git a/spyderlib/widgets/externalshell/baseshell.py b/spyderlib/widgets/externalshell/baseshell.py
index <HASH>..<HASH> 100644
--- a/spyderlib/widgets/externalshell/baseshell.py
+++ b/spyderlib/widgets/externalshell/baseshell.py
@@ -229,6 +229,13 @@ class ExternalShellBase(QWidget):
if ask_for_arguments and not self.get_arguments():
self.set_running_state(False)
return
+ try:
+ self.disconnect(self.terminate_button, SIGNAL("clicked()"),
+ self.process.terminate)
+ self.disconnect(self.kill_button, SIGNAL("clicked()"),
+ self.process.terminate)
+ except:
+ pass
self.create_process()
def get_arguments(self): | External Console: Disconnect signals from kill and terminate buttons before creating a new process
Fixes issue <I>
- This was slowing down creating a new process after several times of killing
the previous one. | spyder-ide_spyder | train | py |
fce601469b369c09b876de3d1f068207781ef791 | diff --git a/holoviews/plotting/renderer.py b/holoviews/plotting/renderer.py
index <HASH>..<HASH> 100644
--- a/holoviews/plotting/renderer.py
+++ b/holoviews/plotting/renderer.py
@@ -276,6 +276,8 @@ class Renderer(Exporter):
html = tag.format(src=src, mime_type=mime_type, css=css)
if comm and plot.comm is not None:
comm, msg_handler = self.comms[self.mode]
+ if msg_handler is None:
+ return html
msg_handler = msg_handler.format(comm_id=plot.comm.id)
return comm.template.format(init_frame=html,
msg_handler=msg_handler, | Ensure Renderer.html works with comms msg_handler (#<I>) | pyviz_holoviews | train | py |
78c9e45291f8af81b7116e66ec98b1408cee625c | diff --git a/master/buildbot/process/build.py b/master/buildbot/process/build.py
index <HASH>..<HASH> 100644
--- a/master/buildbot/process/build.py
+++ b/master/buildbot/process/build.py
@@ -184,13 +184,15 @@ class Build(properties.PropertiesMixin):
def setupSlaveBuilder(self, slavebuilder):
self.slavebuilder = slavebuilder
+ self.path_module = slavebuilder.slave.path_module
+
# navigate our way back to the L{buildbot.buildslave.BuildSlave}
# object that came from the config, and get its properties
buildslave_properties = slavebuilder.slave.properties
self.getProperties().updateFromProperties(buildslave_properties)
if slavebuilder.slave.slave_basedir:
self.setProperty("workdir",
- slavebuilder.slave.path_module.join(
+ self.path_module.join(
slavebuilder.slave.slave_basedir,
self.builder.config.slavebuilddir),
"slave") | Store a copy of the slave's path module on Build.
This is saves navigating to through the slavebuilder
and slave each time this is needed. | buildbot_buildbot | train | py |
e4470b556f735f26f8d369f9f74643cb3585c81f | diff --git a/src/asphalt/core/context.py b/src/asphalt/core/context.py
index <HASH>..<HASH> 100644
--- a/src/asphalt/core/context.py
+++ b/src/asphalt/core/context.py
@@ -915,12 +915,12 @@ def current_context() -> Context:
def get_resource(type: Type[T_Resource], name: str = "default") -> T_Resource | None:
- """Shortcut for ``current_context().get_resource(...)."""
+ """Shortcut for ``current_context().get_resource(...)``."""
return current_context().get_resource(type, name)
def require_resource(type: Type[T_Resource], name: str = "default") -> T_Resource:
- """Shortcut for ``current_context().require_resource(...)."""
+ """Shortcut for ``current_context().require_resource(...)``."""
return current_context().require_resource(type, name) | Fixed missing backticks in some docstrings | asphalt-framework_asphalt | train | py |
f7c96856534fafa07c91e2c015d51bcf8ed3c056 | diff --git a/test.py b/test.py
index <HASH>..<HASH> 100644
--- a/test.py
+++ b/test.py
@@ -7,6 +7,7 @@ from IPython.nbformat.current import read
from runipy.notebook_runner import NotebookRunner
+
class TestRunipy(unittest.TestCase):
maxDiff = 100000 | test.py: Add another newline after imports. | paulgb_runipy | train | py |
5e9e3d774a3f1cfe3e73e746061ff1592ba87010 | diff --git a/version.php b/version.php
index <HASH>..<HASH> 100644
--- a/version.php
+++ b/version.php
@@ -6,7 +6,7 @@
// This is compared against the values stored in the database to determine
// whether upgrades should be performed (see lib/db/*.php)
- $version = 2008063002; // YYYYMMDD = date of the last version bump
+ $version = 2008070300; // YYYYMMDD = date of the last version bump
// XX = daily increments
$release = '2.0 dev (Build: 20080703)'; // Human-friendly version name | Bump to clean empty role names. MDL-<I> | moodle_moodle | train | php |
caf89f7566e50570347e42131609fc14490705fd | diff --git a/lib/fastlane/actions/cert.rb b/lib/fastlane/actions/cert.rb
index <HASH>..<HASH> 100644
--- a/lib/fastlane/actions/cert.rb
+++ b/lib/fastlane/actions/cert.rb
@@ -16,7 +16,7 @@ module Fastlane
# This should be executed in the fastlane folder
values = params.first
- if values.kind_of?Array
+ unless values.kind_of?Hash
# Old syntax
values = {}
params.each do |val|
diff --git a/lib/fastlane/actions/sigh.rb b/lib/fastlane/actions/sigh.rb
index <HASH>..<HASH> 100644
--- a/lib/fastlane/actions/sigh.rb
+++ b/lib/fastlane/actions/sigh.rb
@@ -13,7 +13,8 @@ module Fastlane
require 'credentials_manager/appfile_config'
values = params.first
- if values.kind_of?Array
+
+ unless values.kind_of?Hash
# Old syntax
values = {}
params.each do |val| | Added support for hashes and arrays when using cert and sigh integration | fastlane_fastlane | train | rb,rb |
8d6803f06ff1ac2c65aaddd11af000fa1caab2e6 | diff --git a/lib/coverband/collectors/view_tracker.rb b/lib/coverband/collectors/view_tracker.rb
index <HASH>..<HASH> 100644
--- a/lib/coverband/collectors/view_tracker.rb
+++ b/lib/coverband/collectors/view_tracker.rb
@@ -130,7 +130,7 @@ module Coverband
redis_store.set(tracker_time_key, Time.now.to_i) unless @one_time_timestamp || tracker_time_key_exists?
@one_time_timestamp = true
reported_time = Time.now.to_i
- @views_to_record.each do |file|
+ @views_to_record.to_a.each do |file|
redis_store.hset(tracker_key, file, reported_time)
end
@views_to_record.clear | avoid race condition between threads reporting views and adding to them | danmayer_coverband | train | rb |
1ce4d21a30d271691958a9709116a7c10bbe3256 | diff --git a/lib/mongoid/composable.rb b/lib/mongoid/composable.rb
index <HASH>..<HASH> 100644
--- a/lib/mongoid/composable.rb
+++ b/lib/mongoid/composable.rb
@@ -84,6 +84,7 @@ module Mongoid
Validatable,
Equality,
Association::Referenced::Syncable,
+ Association::Macros,
ActiveModel::Model,
ActiveModel::Validations
]
diff --git a/spec/mongoid/association/macros_spec.rb b/spec/mongoid/association/macros_spec.rb
index <HASH>..<HASH> 100644
--- a/spec/mongoid/association/macros_spec.rb
+++ b/spec/mongoid/association/macros_spec.rb
@@ -20,6 +20,26 @@ describe Mongoid::Association::Macros do
klass.validators.clear
end
+ describe 'Model loading' do
+
+ let(:model_associations) do
+ class TestModel
+ include Mongoid::Document
+ field :associations
+ end
+ end
+
+ after do
+ Object.send(:remove_const, :TestModel)
+ end
+
+ it 'prohibits the use of :associations as an attribute' do
+ expect {
+ model_associations
+ }.to raise_exception(Mongoid::Errors::InvalidField)
+ end
+ end
+
describe ".embedded_in" do
it "defines the macro" do | MONGOID-<I> Don't allow Relations::Marcros methods to be field names | mongodb_mongoid | train | rb,rb |
1d154c85ac367083b8792092ed6208d1b71d3152 | diff --git a/packages/react-ui-components/src/index.js b/packages/react-ui-components/src/index.js
index <HASH>..<HASH> 100644
--- a/packages/react-ui-components/src/index.js
+++ b/packages/react-ui-components/src/index.js
@@ -1,3 +1,4 @@
+/* eslint-disable camelcase, react/jsx-pascal-case */
import Badge from './Badge/index';
import Bar from './Bar/index';
import Button from './Button/index'; | Disable camelcase linting for index.js | neos_neos-ui | train | js |
13fdd9f0c5a825640dff73adac7159eb480c4719 | diff --git a/proxy/proxy.go b/proxy/proxy.go
index <HASH>..<HASH> 100644
--- a/proxy/proxy.go
+++ b/proxy/proxy.go
@@ -71,10 +71,14 @@ func Copy(to net.Conn, from net.Conn, complete chan bool) {
complete <- true
}
-func CloseWrite(rwc net.Conn) {
- if tcpc, ok := rwc.(*net.TCPConn); ok {
- tcpc.CloseWrite()
- } else if unixc, ok := rwc.(*net.UnixConn); ok {
- unixc.CloseWrite()
+func CloseWrite(conn net.Conn) {
+ cwConn, ok := conn.(interface {
+ CloseWrite() error
+ })
+
+ if ok {
+ cwConn.CloseWrite()
+ } else {
+ fmt.Fprintf(os.Stderr, "Connection doesn't implement CloseWrite()\n")
}
} | Proxy calls CloseWrite() iff it's implemented by the connection | orchardup_go-orchard | train | go |
809b14c610c49ca4ae58c883c37ec82babc853ac | diff --git a/src/HelpScout/model/Conversation.php b/src/HelpScout/model/Conversation.php
index <HASH>..<HASH> 100644
--- a/src/HelpScout/model/Conversation.php
+++ b/src/HelpScout/model/Conversation.php
@@ -77,7 +77,7 @@ class Conversation {
$this->bccList = isset($data->bcc) ? $data->bcc : null;
$this->tags = isset($data->tags) ? $data->tags : null;
- if ($data->closedBy) {
+ if (isset($data->closedBy)) {
$this->closedBy = new \HelpScout\model\ref\PersonRef($data->closedBy);
} | Add an `isset` wrapper around the `$data->closedBy` in `Conversation` to avoid errors | helpscout_helpscout-api-php | train | php |
b5aa22cda2c89b72ec67ea2d1836772bb7a421db | diff --git a/setuptools_markdown.py b/setuptools_markdown.py
index <HASH>..<HASH> 100644
--- a/setuptools_markdown.py
+++ b/setuptools_markdown.py
@@ -18,7 +18,10 @@ def long_description_markdown_filename(dist, attr, value):
setup_py_path = inspect.getsourcefile(frame)
markdown_filename = os.path.join(os.path.dirname(setup_py_path), value)
logger.debug('markdown_filename = %r', markdown_filename)
- output = pypandoc.convert(markdown_filename, 'rst')
+ try:
+ output = pypandoc.convert(markdown_filename, 'rst')
+ except OSError:
+ output = open(markdown_filename).read()
dist.metadata.long_description = output | Don't fail if pandoc is not installed
Closes #2 | msabramo_setuptools-markdown | train | py |
329dbaa9fb092115f31194dce378b093ec108c35 | diff --git a/public/js/plugins/plugins.edition.js b/public/js/plugins/plugins.edition.js
index <HASH>..<HASH> 100644
--- a/public/js/plugins/plugins.edition.js
+++ b/public/js/plugins/plugins.edition.js
@@ -15,7 +15,17 @@ var melisPluginEdition = (function($, window) {
$("body").on("click", ".m-trash-handle", removePlugins);
- $body.on("click", "#pluginModalBtnApply", submitPluginForms); // $body because it is modal and it's located in parent
+ // Checking parent body events handler to avoid multiple events of the button
+ var cerateEventHalder = true;
+ $.each($body.data("events").click, function(i, val){
+ if (val.selector == "#pluginModalBtnApply") {
+ cerateEventHalder = false;
+ }
+ });
+
+ if (cerateEventHalder) {
+ $body.on("click", "#pluginModalBtnApply", submitPluginForms); // $body because it is modal and it's located in parent
+ }
$("body").on("focus", ".melis-ui-outlined .melis-editable", function() {
$(this).closest(".melis-ui-outlined").addClass("melis-focus"); | Plugin modal apply button mutliple request issue fixed | melisplatform_melis-cms | train | js |
d759f213ae59af6c365f8ad23d458c9de85fbe1e | diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -56,6 +56,7 @@ setup(
# https://packaging.python.org/en/latest/requirements.html
install_requires=['numpy',
'pandas',
+ 'pygments',
'requests[security]>=2.6',
],
) | Add pygments to install_requires list
Add pygments to install_requires list to fix import error | datacratic_pymldb | train | py |
c3c57b2a42c1c77a2d8cb5d66393d8796f42cfc0 | diff --git a/rest/response.go b/rest/response.go
index <HASH>..<HASH> 100644
--- a/rest/response.go
+++ b/rest/response.go
@@ -29,12 +29,17 @@ type ResponseWriter interface {
WriteHeader(int)
}
+// This allows to customize the field name used in the error response payload.
+// It defaults to "Error" for compatibility reason, but can be changed before starting the server.
+// eg: rest.ErrorFieldName = "errorMessage"
+var ErrorFieldName = "Error"
+
// Error produces an error response in JSON with the following structure, '{"Error":"My error message"}'
// The standard plain text net/http Error helper can still be called like this:
// http.Error(w, "error message", code)
func Error(w ResponseWriter, error string, code int) {
w.WriteHeader(code)
- err := w.WriteJson(map[string]string{"Error": error})
+ err := w.WriteJson(map[string]string{ErrorFieldName: error})
if err != nil {
panic(err)
} | Add the ability to customize the field name in the error response.
"Error", capitalized, was not a good choice, but will stay the default
until the next major version (strict compat, see semver.org)
This variable allows the user to customize this field name. | ant0ine_go-json-rest | train | go |
d09c9443edf0588f372a07a21a507031fa1ecada | diff --git a/src/ai/backend/common/logging.py b/src/ai/backend/common/logging.py
index <HASH>..<HASH> 100644
--- a/src/ai/backend/common/logging.py
+++ b/src/ai/backend/common/logging.py
@@ -340,6 +340,8 @@ class Logger():
}
def __enter__(self):
+ if is_active.get():
+ raise RuntimeError('You cannot activate two or more loggers at the same time.')
self.log_config['handlers']['relay'] = {
'class': 'ai.backend.common.logging.RelayHandler',
'level': self.daemon_config['level'], | Prevent overlapping of loggers (lablup/backend.ai#<I>) | lablup_backend.ai-common | train | py |
03cac5f3a8513f6580d9987a0fa635149158db6b | diff --git a/core/src/test/java/org/bitcoinj/utils/AppDataDirectoryTest.java b/core/src/test/java/org/bitcoinj/utils/AppDataDirectoryTest.java
index <HASH>..<HASH> 100644
--- a/core/src/test/java/org/bitcoinj/utils/AppDataDirectoryTest.java
+++ b/core/src/test/java/org/bitcoinj/utils/AppDataDirectoryTest.java
@@ -34,7 +34,7 @@ public class AppDataDirectoryTest {
final String appName = "bitcoinj";
String path = AppDataDirectory.get(appName).toString();
if (Utils.isWindows()) {
- assertEquals("Path wrong on Mac", winPath(appName), path);
+ assertEquals("Path wrong on Windows", winPath(appName), path);
} else if (Utils.isMac()) {
assertEquals("Path wrong on Mac", macPath(appName), path);
} else if (Utils.isLinux()) {
@@ -49,7 +49,7 @@ public class AppDataDirectoryTest {
final String appName = "Bitcoin";
String path = AppDataDirectory.get(appName).toString();
if (Utils.isWindows()) {
- assertEquals("Path wrong on Mac", winPath(appName), path);
+ assertEquals("Path wrong on Windows", winPath(appName), path);
} else if (Utils.isMac()) {
assertEquals("Path wrong on Mac", macPath(appName), path);
} else if (Utils.isLinux()) { | AppDataDirectoryTest: Fix two assert messages. | bitcoinj_bitcoinj | train | java |
26f49c36673ce1331174ec3ad5f9f96dd55fd674 | diff --git a/collectors/assets.php b/collectors/assets.php
index <HASH>..<HASH> 100644
--- a/collectors/assets.php
+++ b/collectors/assets.php
@@ -227,8 +227,8 @@ class QM_Collector_Assets extends QM_Collector {
/** This filter is documented in wp-includes/class.wp-scripts.php */
$source = apply_filters( "{$loader}_loader_src", $src, $dependency->handle );
- $host = (string) wp_parse_url( $source, PHP_URL_HOST );
- $scheme = (string) wp_parse_url( $source, PHP_URL_SCHEME );
+ $host = (string) parse_url( $source, PHP_URL_HOST );
+ $scheme = (string) parse_url( $source, PHP_URL_SCHEME );
$http_host = $data['host'];
if ( empty( $host ) && ! empty( $http_host ) ) {
@@ -244,7 +244,7 @@ class QM_Collector_Assets extends QM_Collector {
if ( is_wp_error( $source ) ) {
$error_data = $source->get_error_data();
if ( $error_data && isset( $error_data['src'] ) ) {
- $host = (string) wp_parse_url( $error_data['src'], PHP_URL_HOST );
+ $host = (string) parse_url( $error_data['src'], PHP_URL_HOST );
}
} elseif ( empty( $source ) ) {
$source = ''; | Avoid using `wp_parse_url()` as it was only introduced in WP <I>. See #<I>. | johnbillion_query-monitor | train | php |
c9dc6cdbc9fa06f0e97ed4ed7c5d56c79307ea6c | diff --git a/simuvex/procedures/syscalls/__init__.py b/simuvex/procedures/syscalls/__init__.py
index <HASH>..<HASH> 100644
--- a/simuvex/procedures/syscalls/__init__.py
+++ b/simuvex/procedures/syscalls/__init__.py
@@ -36,10 +36,11 @@ class SimStateSystem(simuvex.SimStatePlugin):
self.state.add_constraints(*constraints)
return expr
- @simuvex.helpers.concretize_args
def write(self, fd, content, length, pos=None):
# TODO: error handling
# TODO: symbolic support
+ fd = self.state.make_concrete_int(fd)
+ length = self.state.make_concrete_int(fd)
return self.files[fd].write(content, length, pos)
@simuvex.helpers.concretize_args | don't concretize content on write | angr_angr | train | py |
cc5fc25276a4d9a541b75bb41aab8233ff54630b | diff --git a/lib/tire/model/import.rb b/lib/tire/model/import.rb
index <HASH>..<HASH> 100644
--- a/lib/tire/model/import.rb
+++ b/lib/tire/model/import.rb
@@ -15,6 +15,7 @@ module Tire
def import options={}, &block
options = { :method => 'paginate' }.update options
+ index = options[:index] ? Tire::Index.new(options.delete(:index)) : self.index
index.import klass, options, &block
end
diff --git a/test/unit/model_import_test.rb b/test/unit/model_import_test.rb
index <HASH>..<HASH> 100644
--- a/test/unit/model_import_test.rb
+++ b/test/unit/model_import_test.rb
@@ -60,7 +60,11 @@ module Tire
# Add 1 to every "document" and return them
documents.map { |d| d + 1 }
end
+ end
+ should "store the documents in a different index" do
+ Tire::Index.expects(:new).with('new_index').returns( mock('index') { expects(:import) } )
+ ImportModel.import :index => 'new_index'
end
end | [ACTIVEMODEL] Allow passing `:index` option to `MyModel.import`
Allows to index the data into a different index:
Article.import index: 'new_articles' | karmi_retire | train | rb,rb |
8999ceaafbc04d63d5c919a4fb0de8d420b27560 | diff --git a/allure-cli/src/main/java/ru/yandex/qatools/allure/AllureCli.java b/allure-cli/src/main/java/ru/yandex/qatools/allure/AllureCli.java
index <HASH>..<HASH> 100644
--- a/allure-cli/src/main/java/ru/yandex/qatools/allure/AllureCli.java
+++ b/allure-cli/src/main/java/ru/yandex/qatools/allure/AllureCli.java
@@ -37,7 +37,7 @@ public class AllureCli {
@Arguments(title = "input directories",
description = "A list of input directories to be processed")
- public List<String> inputPaths;
+ public List<String> inputPaths = new ArrayList<>();
@Option(name = {"--version"})
public boolean version; | Fixed NPE in AllureCLI | allure-framework_allure1 | train | java |
447cb673027ac826e96dfb55ee21d4d6b5909453 | diff --git a/Branch-SDK/src/io/branch/referral/Branch.java b/Branch-SDK/src/io/branch/referral/Branch.java
index <HASH>..<HASH> 100644
--- a/Branch-SDK/src/io/branch/referral/Branch.java
+++ b/Branch-SDK/src/io/branch/referral/Branch.java
@@ -340,7 +340,7 @@ public class Branch {
debugHandler_ = new Handler();
debugStarted_ = false;
linkCache_ = new HashMap<BranchLinkData, String>();
- activityLifeCycleObserver_ = new BranchActivityLifeCycleObserver();
+
}
@@ -2610,6 +2610,7 @@ public class Branch {
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
private void setActivityLifeCycleObserver(Application application) {
try {
+ activityLifeCycleObserver_ = new BranchActivityLifeCycleObserver();
/* Set an observer for activity life cycle events. */
application.unregisterActivityLifecycleCallbacks(activityLifeCycleObserver_);
application.registerActivityLifecycleCallbacks(activityLifeCycleObserver_);
@@ -2645,7 +2646,9 @@ public class Branch {
@Override
public void onActivityResumed(Activity activity) {
//Set the activity for touch debug
- setTouchDebugInternal(activity);
+ if (prefHelper_.getTouchDebugging()) {
+ setTouchDebugInternal(activity);
+ }
}
@Override | Fixing sdks crashing when used below API level <I>
Hot fix for SDK crash on Api level <<I> | BranchMetrics_android-branch-deep-linking | train | java |
199cb36334643fab599bce30c59ac4f83c931d46 | diff --git a/src/main/java/rx/lang/groovy/GroovyAdaptor.java b/src/main/java/rx/lang/groovy/GroovyAdaptor.java
index <HASH>..<HASH> 100644
--- a/src/main/java/rx/lang/groovy/GroovyAdaptor.java
+++ b/src/main/java/rx/lang/groovy/GroovyAdaptor.java
@@ -33,7 +33,7 @@ import rx.observables.Notification;
import rx.observables.Observable;
import rx.observables.Observer;
import rx.observables.Subscription;
-import rx.util.FunctionLanguageAdaptor;
+import rx.util.functions.FunctionLanguageAdaptor;
public class GroovyAdaptor implements FunctionLanguageAdaptor { | Refactoring towards performance improvements
- Convert operators to implement Func1 instead of extend Observable
- Change Observable to concete instead of abstract
- subscribe is now controlled by the concrete class so we can control the wrapping of a Func to be executed when subscribe is called
- removed most wrapping inside operators with AtomicObservable except for complex operators like Zip that appear to still need it
While doing these changes the util/function packages got moved a little as well to make more sense for where the Atomic* classes should go | ReactiveX_RxGroovy | train | java |
4a42afbb2f32853abfe9df47530c618636de4fc5 | diff --git a/pycm/pycm_util.py b/pycm/pycm_util.py
index <HASH>..<HASH> 100644
--- a/pycm/pycm_util.py
+++ b/pycm/pycm_util.py
@@ -1,4 +1,5 @@
# -*- coding: utf-8 -*-
+from __future__ import division
import sys
import numpy | fix : division from __future__ imported in pycm_util.py for Python <I> | sepandhaghighi_pycm | train | py |
e9da283799c6454f24bf1d423ec3b895bcece506 | diff --git a/packages/core/src/PlayerContextProvider.js b/packages/core/src/PlayerContextProvider.js
index <HASH>..<HASH> 100644
--- a/packages/core/src/PlayerContextProvider.js
+++ b/packages/core/src/PlayerContextProvider.js
@@ -107,7 +107,8 @@ function getGoToTrackState({
loop: shouldLoadAsNew ? false : prevState.loop,
shouldRequestPlayOnNextUpdate: Boolean(shouldPlay),
awaitingPlayAfterTrackLoad: Boolean(shouldPlay),
- awaitingForceLoad: Boolean(shouldForceLoad)
+ awaitingForceLoad: Boolean(shouldForceLoad),
+ maxKnownTime: shouldLoadAsNew ? 0 : prevState.maxKnownTime
};
} | Reset maxKnownTime on new track load. | benwiley4000_cassette | train | js |
f7743435e17f6625b7cc2da38119a0483d1eda9c | diff --git a/packages/micro-journeys/src/micro-journeys-dropdown.schema.js b/packages/micro-journeys/src/micro-journeys-dropdown.schema.js
index <HASH>..<HASH> 100644
--- a/packages/micro-journeys/src/micro-journeys-dropdown.schema.js
+++ b/packages/micro-journeys/src/micro-journeys-dropdown.schema.js
@@ -20,7 +20,8 @@ module.exports = {
},
content: {
type: 'any',
- description: '**All of the items in the dropdown** -- generally works by including `@bolt-components-nav/nav.twig` with `links` array of objects containing `text` & `url`',
+ description:
+ '**All of the items in the dropdown** -- generally works by including `@bolt-components-nav/nav.twig` with `links` array of objects containing `text` & `url`',
},
iconBackgroundColor: {
type: 'string', | style(micro-journeys): eslinting | bolt-design-system_bolt | train | js |
b0f02256d1575c1d658b5ccc207da9d6670bbbed | diff --git a/src/js/choropleth.js b/src/js/choropleth.js
index <HASH>..<HASH> 100644
--- a/src/js/choropleth.js
+++ b/src/js/choropleth.js
@@ -51,8 +51,6 @@ class Choropleth extends Geomap {
unit.select('title').text(`${text}\n\n${self.properties.column}: ${val}`);
}
-
-
// Make sure postUpdate function is run if set.
super.update();
}
diff --git a/src/js/geomap.js b/src/js/geomap.js
index <HASH>..<HASH> 100644
--- a/src/js/geomap.js
+++ b/src/js/geomap.js
@@ -39,7 +39,7 @@ class Geomap {
x = x0,
y = y0;
- if (d && this._.centered !== d) {
+ if (d && d.hasOwnProperty('geometry') && this._.centered !== d) {
let centroid = this.path.centroid(d);
x = centroid[0];
y = centroid[1];
@@ -48,7 +48,6 @@ class Geomap {
} else {
this._.centered = null;
}
-
this.svg.selectAll('path.unit')
.classed('active', this._.centered && ((d) => d === this._.centered)); | Fixed zooming out when no unit was clicked. | yaph_d3-geomap | train | js,js |
4b8f36815f36547295ed67ec379c0136ccc0492a | diff --git a/lib/reform/form.rb b/lib/reform/form.rb
index <HASH>..<HASH> 100644
--- a/lib/reform/form.rb
+++ b/lib/reform/form.rb
@@ -78,6 +78,7 @@ module Reform
require 'reform/form/validate'
include Validate
+
require 'reform/form/multi_parameter_attributes'
include MultiParameterAttributes # TODO: make features dynamic.
@@ -220,17 +221,6 @@ module Reform
@options = options
end
- include Form::Validate
-
- # TODO: make valid?(errors) the only public method.
- def valid?
- res= validate_cardinality & validate_items
- end
-
- def errors
- @errors ||= Form::Errors.new(self)
- end
-
# this gives us each { to_hash }
include Representable::Hash::Collection
items :parse_strategy => :sync, :instance => true | remove more methods from Forms as this is all implemented with the recursive #validate!. | trailblazer_reform | train | rb |
d3115e3a374ec96a22c754f82616480558f54d14 | diff --git a/flask_boost/project/application/utils/assets.py b/flask_boost/project/application/utils/assets.py
index <HASH>..<HASH> 100644
--- a/flask_boost/project/application/utils/assets.py
+++ b/flask_boost/project/application/utils/assets.py
@@ -92,14 +92,15 @@ def build_js(app):
Include libs.js and page.js.
"""
static_path = app.static_folder
- libs_path = G.js_config['libs']
+ libs = G.js_config['libs']
layout = G.js_config['layout']
page_root_path = G.js_config['page']
# Build libs.js
libs_js_string = ""
- for lib_path in libs_path:
- with open(os.path.join(static_path, lib_path)) as js_file:
+ for lib in libs:
+ lib_path = os.path.join(static_path, lib)
+ with open(lib_path) as js_file:
file_content = js_file.read()
# Rewrite relative path to absolute path
file_content = _rewrite_relative_url(file_content, lib_path, static_path) | Fix a bug in build_js. | hustlzp_Flask-Boost | train | py |
f5b6573017d46370cca4f298fba06f104c668bd7 | diff --git a/lib/supervisor.js b/lib/supervisor.js
index <HASH>..<HASH> 100644
--- a/lib/supervisor.js
+++ b/lib/supervisor.js
@@ -26,7 +26,7 @@ function run(
// Only print any results if we're ready - that is, nextResultToPrint
// is no longer null. (BEGIN changes it from null to 0.)
if (nextResultToPrint !== null) {
- var result = results[String(nextResultToPrint)];
+ var result = results[nextResultToPrint];
while (
// If there are no more results to print, then we're done.
@@ -36,7 +36,7 @@ function run(
) {
printResult(format, result);
nextResultToPrint++;
- result = results[String(nextResultToPrint)];
+ result = results[nextResultToPrint];
}
}
} | Don't call String unnecessarily. | rtfeldman_node-test-runner | train | js |
57d26fc3f68e5c8eb7234fcd5cb70dbe8d795750 | diff --git a/core/selection.js b/core/selection.js
index <HASH>..<HASH> 100644
--- a/core/selection.js
+++ b/core/selection.js
@@ -92,18 +92,16 @@ class Selection {
}
handleDragging() {
- let mouseCount = 0;
+ this.isMouseDown = false;
this.emitter.listenDOM('mousedown', document.body, () => {
- mouseCount += 1;
+ this.isMouseDown = true;
});
this.emitter.listenDOM('mouseup', document.body, () => {
- mouseCount -= 1;
- if (mouseCount === 0) {
- this.update(Emitter.sources.USER);
- }
+ this.isMouseDown = false;
+ this.update(Emitter.sources.USER);
});
this.emitter.listenDOM('selectionchange', document, () => {
- if (mouseCount === 0) {
+ if (!this.isMouseDown) {
setTimeout(this.update.bind(this, Emitter.sources.USER), 1);
}
}); | change to boolean, fixes #<I> | quilljs_quill | train | js |
aa2ebacd53be6dc08465a6ba1bb7123aa5a38973 | diff --git a/worker.js b/worker.js
index <HASH>..<HASH> 100644
--- a/worker.js
+++ b/worker.js
@@ -105,7 +105,6 @@ function test(ctx, cb) {
check({url:"http://localhost:"+HTTP_PORT+"/", log:log}, function(err) {
if (err) {
- clearInterval(intervalId)
return cb(1)
}
serverUp() | don't need to clear interval in error path anymore. | Strider-CD_strider-sauce | train | js |
029731d6bfbe9adc190f648f3106474edf1eedef | diff --git a/test/Elastica/ClientTest.php b/test/Elastica/ClientTest.php
index <HASH>..<HASH> 100644
--- a/test/Elastica/ClientTest.php
+++ b/test/Elastica/ClientTest.php
@@ -33,6 +33,36 @@ class ClientTest extends BaseTest
/**
* @group functional
+ * @expectedException Elastica\Exception\Connection\HttpException
+ */
+ public function testConnectionErrors()
+ {
+ $client = $this->_getClient(['host' => 'foo.bar', 'port' => '9201']);
+ $client->getVersion();
+ }
+
+ /**
+ * @group functional
+ * @expectedException Elastica\Exception\Connection\HttpException
+ */
+ public function testClientBadHost()
+ {
+ $client = $this->_getClient(['host' => 'localhost', 'port' => '9201']);
+ $client->getVersion();
+ }
+
+ /**
+ * @group functional
+ * @expectedException Elastica\Exception\Connection\HttpException
+ */
+ public function testClientBadHostWithtimeout()
+ {
+ $client = $this->_getClient(['host' => 'foo.bar', 'timeout' => 10]);
+ $client->getVersion();
+ }
+
+ /**
+ * @group functional
*/
public function testGetVersion()
{ | test connection error (#<I>) | ruflin_Elastica | train | php |
e4ab78d02586226a4cc92fce75dd5604f87301ae | diff --git a/pmxbot/core.py b/pmxbot/core.py
index <HASH>..<HASH> 100644
--- a/pmxbot/core.py
+++ b/pmxbot/core.py
@@ -49,6 +49,14 @@ class WarnHistory(dict):
def _expired(self, last, now):
return now - last > self.warn_every
+ def warn(self, nick, connection):
+ if not self.needs_warning(nick):
+ return
+ msg = self.warn_message.format(
+ logged_channels_string=', '.join(pmxbot.config.log_channels))
+ for line in msg.splitlines():
+ connection.notice(nick, line)
+
class AugmentableMessage(six.text_type):
"""
@@ -264,12 +272,7 @@ class LoggingCommandBot(irc.bot.SingleServerIRCBot):
return
if nick == self._nickname:
return
- if not self.warn_history.needs_warning(nick):
- return
- msg = self.warn_history.warn_message.format(
- logged_channels_string=', '.join(pmxbot.config.log_channels))
- for line in msg.splitlines():
- connection.notice(nick, line)
+ self.warn_history.warn(nick, connection)
def on_leave(self, connection, event):
nick = event.source.nick | Move transmission of warning to WarnHistory for better encapsulation. | yougov_pmxbot | train | py |
8006cedfa91d333f2c0a873a72f9b3c9317282e4 | diff --git a/lib/parser.js b/lib/parser.js
index <HASH>..<HASH> 100644
--- a/lib/parser.js
+++ b/lib/parser.js
@@ -226,7 +226,7 @@ module.exports = function schemaFilesParser (schemaFiles) {
// TEMPORARY FIX
// TODO: What if there's no primary key defined, but it does already use an ID column? Use that? Add a different named UUID column?
- if (columns.id) {
+ if (columns.id && columns.id.dataType === 'uuid') {
columns.id = {
array: false,
dataType: 'uuid', | a better kind-of fix for the uuid issue | wmfs_relationize | train | js |
4f0c10bd2d423a5363e4bb571aef8f57f247be70 | diff --git a/core/src/main/java/com/google/bitcoin/core/Peer.java b/core/src/main/java/com/google/bitcoin/core/Peer.java
index <HASH>..<HASH> 100644
--- a/core/src/main/java/com/google/bitcoin/core/Peer.java
+++ b/core/src/main/java/com/google/bitcoin/core/Peer.java
@@ -729,7 +729,7 @@ public class Peer {
* @return various version numbers claimed by peer.
*/
public VersionMessage getVersionMessage() {
- return versionMessage;
+ return conn.getVersionMessage();
}
/** | Expose correct version message.
Resolve issue <I>. | bitcoinj_bitcoinj | train | java |
ad4e5cff87ae224dcbb0e5c3834915de8a6f72b2 | diff --git a/index.js b/index.js
index <HASH>..<HASH> 100644
--- a/index.js
+++ b/index.js
@@ -16,6 +16,7 @@ Resizer.prototype.attach = function (preset) {
if (!preset instanceof Preset) throw "Resizer expects a Preset";
this.generateRoute(preset);
+ this.addHelper(preset);
};
diff --git a/preset.js b/preset.js
index <HASH>..<HASH> 100644
--- a/preset.js
+++ b/preset.js
@@ -14,12 +14,13 @@ Preset.prototype.from = function (from) {
return this;
};
-Preset.prototype.write = function (target) {
+Preset.prototype.to = function (target) {
this.targets.push(target);
this.tasks.push({
type: "write",
target: target
});
+ Object.freeze(this);
return this;
}; | freeze ojbect when write is called | thomaspeklak_express-resizer | train | js,js |
266c450691c188fa01d3bcd0bb7218d49c2a8203 | diff --git a/store/src/main/java/com/buschmais/jqassistant/core/store/impl/AbstractGraphStore.java b/store/src/main/java/com/buschmais/jqassistant/core/store/impl/AbstractGraphStore.java
index <HASH>..<HASH> 100644
--- a/store/src/main/java/com/buschmais/jqassistant/core/store/impl/AbstractGraphStore.java
+++ b/store/src/main/java/com/buschmais/jqassistant/core/store/impl/AbstractGraphStore.java
@@ -198,7 +198,7 @@ public abstract class AbstractGraphStore implements Store {
public void reset() {
LOGGER.info("Resetting store.");
Map<String, Object> params = new HashMap<>();
- params.put("batchSize", 100000);
+ params.put("batchSize", 65536);
long totalNodes = 0;
long nodes;
Instant start = Instant.now();
@@ -208,8 +208,9 @@ public abstract class AbstractGraphStore implements Store {
"OPTIONAL MATCH (n)-[r]-() " + //
"WITH n, r " + //
"LIMIT $batchSize " + //
+ "WITH distinct n " + //
"DETACH DELETE n " + //
- "RETURN count(distinct n) as nodes", params).getSingleResult();
+ "RETURN count(n) as nodes", params).getSingleResult();
nodes = result.get("nodes", Long.class);
totalNodes = totalNodes + nodes;
commitTransaction(); | - optimized query used for resetting the store. | buschmais_jqa-core-framework | train | java |
a5eac9fc3ccb756df4198156af4f6515b6e4c281 | diff --git a/src/ValidationResultSet.php b/src/ValidationResultSet.php
index <HASH>..<HASH> 100644
--- a/src/ValidationResultSet.php
+++ b/src/ValidationResultSet.php
@@ -35,7 +35,7 @@ class ValidationResultSet implements \Iterator, \Countable {
*
* @var ValidationResult[]
*/
- private $entries = array();
+ protected $entries = array();
/**
* Internal Iterator index
diff --git a/src/Validator/SanitorMatch.php b/src/Validator/SanitorMatch.php
index <HASH>..<HASH> 100644
--- a/src/Validator/SanitorMatch.php
+++ b/src/Validator/SanitorMatch.php
@@ -41,7 +41,7 @@ class SanitorMatch implements ValidatorInterface {
*
* @var type
*/
- private $sanitizable;
+ protected $sanitizable;
/**
* Constructor | changed private properties to protected to allow easier extension | broeser_wellid | train | php,php |
9c6207c31264e75be119895340c8f1ba2434072e | diff --git a/ontrack-model/src/main/java/net/nemerosa/ontrack/model/support/JobConfigProperties.java b/ontrack-model/src/main/java/net/nemerosa/ontrack/model/support/JobConfigProperties.java
index <HASH>..<HASH> 100644
--- a/ontrack-model/src/main/java/net/nemerosa/ontrack/model/support/JobConfigProperties.java
+++ b/ontrack-model/src/main/java/net/nemerosa/ontrack/model/support/JobConfigProperties.java
@@ -24,7 +24,7 @@ public class JobConfigProperties {
/**
* Using scattering of jobs
*/
- private boolean scattering = false;
+ private boolean scattering = true;
/**
* Scattering ratio (must be between 0.0 and 1.0 inclusive). | #<I> Scattering by default | nemerosa_ontrack | train | java |
407da7db91a50850bd01ef181cc2a9ced375880c | diff --git a/ToolkitApi/ToolkitServiceXML.php b/ToolkitApi/ToolkitServiceXML.php
index <HASH>..<HASH> 100644
--- a/ToolkitApi/ToolkitServiceXML.php
+++ b/ToolkitApi/ToolkitServiceXML.php
@@ -34,7 +34,7 @@ class XMLWrapper
* @param string $options
* @param ToolkitService $ToolkitSrvObj
*/
- public function __construct($options ='', ToolkitService $ToolkitSrvObj = null)
+ public function __construct($options ='', $ToolkitSrvObj = null)
{
if (is_string($options)) {
// $options is a string so it must be encoding (assumption for backwards compatibility) | Removed type hint for ToolkitService in ToolkitServiceXML since ToolkitService cannot be namespaced at this point. | zendtech_IbmiToolkit | train | php |
9df4b2143463fe53c35391aeed2e4500ac9a8822 | diff --git a/benchexec/tablegenerator/columns.py b/benchexec/tablegenerator/columns.py
index <HASH>..<HASH> 100644
--- a/benchexec/tablegenerator/columns.py
+++ b/benchexec/tablegenerator/columns.py
@@ -417,7 +417,7 @@ def _format_number(
# Cut the 0 in front of the decimal point for values < 1.
# Example: 0.002 => .002
- if _is_to_cut(formatted_value, format_target, isToAlign):
+ if _is_to_cut(formatted_value, format_target):
assert formatted_value.startswith("0.")
formatted_value = formatted_value[1:]
@@ -429,11 +429,8 @@ def _format_number(
return formatted_value
-def _is_to_cut(value, format_target, is_to_align):
- correct_target = format_target == "html_cell" or (
- format_target == "csv" and is_to_align
- )
-
+def _is_to_cut(value, format_target):
+ correct_target = format_target == "html_cell"
return correct_target and "." in value and 1 > Decimal(value) >= 0 | Remove weird unused case in tablegenerator
We trimmed the leading 0 of values like <I> in format_number
either if the value is to be printed in a cell of the HTML tables,
or in CSV tables with alignment.
Such CSV tables are not even produced by tablegenerator,
and it is not clear why alignment should have an effect on whether to
trim leading zeros. | sosy-lab_benchexec | train | py |
10c1b906e42b0b196bcfc34e6960705b25ec4fdb | diff --git a/core/src/main/java/lucee/runtime/config/XMLConfigAdmin.java b/core/src/main/java/lucee/runtime/config/XMLConfigAdmin.java
index <HASH>..<HASH> 100755
--- a/core/src/main/java/lucee/runtime/config/XMLConfigAdmin.java
+++ b/core/src/main/java/lucee/runtime/config/XMLConfigAdmin.java
@@ -6666,7 +6666,9 @@ public final class XMLConfigAdmin {
if(extensions[i].hasAttribute("start-bundles")) continue;
// this will load the data from the .lex file
try {
- Manifest mf = RHExtension.getManifestFromFile(config, RHExtension.toResource(config, extensions[i]));
+
+ Resource res = RHExtension.toResource(config, extensions[i],null);
+ Manifest mf = (res==null) ? null : RHExtension.getManifestFromFile(config, res);
if(mf!=null) {
RHExtension.populate(extensions[i],mf);
fixed=true; | when extension does not exist ignore it in fix | lucee_Lucee | train | java |
6dbde55f9f66789dcd40680b6ae6198f31ba78b8 | diff --git a/lib/webaccount.py b/lib/webaccount.py
index <HASH>..<HASH> 100644
--- a/lib/webaccount.py
+++ b/lib/webaccount.py
@@ -63,7 +63,7 @@ def perform_youradminactivities(uid, ln):
your_admin_activities.append(action)
if "superadmin" in your_roles:
- for action in ["cfgbibformat", "cfgbibrank", "cfgbibindex", "cfgwebaccess", "cfgwebsearch", "cfgwebsubmit"]:
+ for action in ["cfgbibformat", "cfgbibharvest", "cfgbibrank", "cfgbibindex", "cfgwebaccess", "cfgwebsearch", "cfgwebsubmit"]:
if action not in your_admin_activities:
your_admin_activities.append(action) | Added "cfgbibharvest" to the list of superadmin activities. | inveniosoftware_invenio-accounts | train | py |
439360262e0dddac4e01f8e829d673d03c230fa9 | diff --git a/test/WireMock/Client/WireMockTest.php b/test/WireMock/Client/WireMockTest.php
index <HASH>..<HASH> 100644
--- a/test/WireMock/Client/WireMockTest.php
+++ b/test/WireMock/Client/WireMockTest.php
@@ -57,6 +57,8 @@ class WireMockTest extends \PHPUnit_Framework_TestCase
/** @var MappingBuilder $mockMappingBuilder */
$mockMappingBuilder = mock('WireMock\Client\MappingBuilder');
when($mockMappingBuilder->build())->return($mockStubMapping);
+ when($this->_mockCurl->post('http://localhost:8080/__admin/mappings', $stubMappingArray))
+ ->return(json_encode(array('id' => 'some-long-guid')));
// when
$this->_wireMock->stubFor($mockMappingBuilder); | Stub out WireMock stubbing result in unit test
This test passes locally, but fails on Travis, oddly! Hopefully this
will fix it. | rowanhill_wiremock-php | train | php |
3cb808f09adccca5ffa7668b0a591b3a9b01469b | diff --git a/core/optimization/src/test/java/it/unibz/inf/ontop/iq/executor/FunctionalDependencyTest.java b/core/optimization/src/test/java/it/unibz/inf/ontop/iq/executor/FunctionalDependencyTest.java
index <HASH>..<HASH> 100644
--- a/core/optimization/src/test/java/it/unibz/inf/ontop/iq/executor/FunctionalDependencyTest.java
+++ b/core/optimization/src/test/java/it/unibz/inf/ontop/iq/executor/FunctionalDependencyTest.java
@@ -1045,6 +1045,7 @@ public class FunctionalDependencyTest {
optimizeAndCompare(query, expectedQuery);
}
+ @Ignore("TODO: optimize the redundant self-lj (no variable on the right is used")
@Test
public void testLJRedundantSelfLeftJoin1() throws EmptyQueryException {
DistinctVariableOnlyDataAtom projectionAtom = ATOM_FACTORY.getDistinctVariableOnlyDataAtom(ANS1_PREDICATE_AR_3, X, Y, Z); | One test re-disabled in FunctionalDependencyTest (not for this opt). | ontop_ontop | train | java |
9caf8ff1251c449f44c469532165dcd3fc248957 | diff --git a/src/DataObjects/AbstractCmisObject.php b/src/DataObjects/AbstractCmisObject.php
index <HASH>..<HASH> 100644
--- a/src/DataObjects/AbstractCmisObject.php
+++ b/src/DataObjects/AbstractCmisObject.php
@@ -459,12 +459,12 @@ abstract class AbstractCmisObject implements CmisObjectInterface
*/
public function getBaseTypeId()
{
- $baseType = $this->getProperty(PropertyIds::BASE_TYPE_ID);
- if ($baseType === null) {
+ $baseTypeProperty = $this->getProperty(PropertyIds::BASE_TYPE_ID);
+ if ($baseTypeProperty === null) {
return null;
}
- return BaseTypeId::cast($baseType);
+ return BaseTypeId::cast($baseTypeProperty->getFirstValue());
}
/** | Fix bug in AbstractCmisObject::getBaseTypeId
Summary:
In `AbstractCmisObject::getBaseTypeId` the property object
has been passed to the `BaseTypeId` enumeration and not the expected
string value of the property.
Reviewers: dkd-ebert, #forgetit-dev
Reviewed By: dkd-ebert, #forgetit-dev
Differential Revision: <URL> | dkd_php-cmis-client | train | php |
0ab967c856243aa81057fc25dfd5b1601786534b | diff --git a/src/SearchApi.js b/src/SearchApi.js
index <HASH>..<HASH> 100644
--- a/src/SearchApi.js
+++ b/src/SearchApi.js
@@ -62,8 +62,6 @@ export class SubscribableSearchApi {
const search = this._createSearch()
if (Array.isArray(fieldNamesOrIndexFunction)) {
- // TODO Document the requirement that all resources have an :id attribute
- // TODO Document the requirement that all resources must be Objects or Records (with getters)
if (resources.forEach instanceof Function) {
resources.forEach(resource => {
fieldNamesOrIndexFunction.forEach(field => { | Removed TODOs since they have been addressed by documentation | bvaughn_redux-search | train | js |
a8d8b8708d5d463d68443733e60565eed06b730c | diff --git a/src/index.js b/src/index.js
index <HASH>..<HASH> 100644
--- a/src/index.js
+++ b/src/index.js
@@ -53,9 +53,9 @@ class Service {
return Proto.extend(obj, this)
}
- extractIdsFromString (id) {
+ extractIds (id) {
+ if (typeof id === 'object') { return Object.values(id) }
if (id[0] === '[' && id[id.length - 1] === ']') { return JSON.parse(id) }
-
if (id[0] === '{' && id[id.length - 1] === '}') { return Object.values(JSON.parse(id)) }
return id.split(this.idSeparator)
@@ -69,7 +69,7 @@ class Service {
let ids = id
if (id && !Array.isArray(id)) {
- ids = this.extractIdsFromString(id.toString())
+ ids = this.extractIds(id)
}
this.id.forEach((idKey, index) => { | Added support for passing an object type as `id` in internal call | feathersjs-ecosystem_feathers-objection | train | js |
49598b52c0d1be75bca418ec88580f64fa1ef4c2 | diff --git a/gwpy/plotter/histogram.py b/gwpy/plotter/histogram.py
index <HASH>..<HASH> 100644
--- a/gwpy/plotter/histogram.py
+++ b/gwpy/plotter/histogram.py
@@ -83,7 +83,7 @@ class HistogramAxes(Axes):
return self.hist(table[column], **kwargs)
def hist(self, x, **kwargs): # pylint: disable=arguments-differ
- if iterable(x) and not x:
+ if iterable(x) and not numpy.size(x):
x = numpy.ndarray((0,))
logbins = kwargs.pop('logbins', False)
bins = kwargs.get('bins', 30) | plotter.histogram: fixed bug in 'not x'
numpy arrays can't handle it | gwpy_gwpy | 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.