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 |
|---|---|---|---|---|---|
1dfe9fbc4ea76dbf4ba49d168a8ba5fcd2f23cf2 | diff --git a/lib/chef/provider/mount.rb b/lib/chef/provider/mount.rb
index <HASH>..<HASH> 100644
--- a/lib/chef/provider/mount.rb
+++ b/lib/chef/provider/mount.rb
@@ -80,7 +80,7 @@ class Chef
def action_enable
unless @current_resource.enabled && mount_options_unchanged?
- converge_by("remount #{@current_resource.device}") do
+ converge_by("enable #{@current_resource.device}") do
status = enable_fs
if status
Chef::Log.info("#{@new_resource} enabled")
@@ -93,7 +93,7 @@ class Chef
def action_disable
if @current_resource.enabled
- converge_by("remount #{@current_resource.device}") do
+ converge_by("disable #{@current_resource.device}") do
status = disable_fs
if status
Chef::Log.info("#{@new_resource} disabled") | fix copypasta output issues in enable/disable actions
these were copied from "remount" without changing. | chef_chef | train | rb |
1a1562ca9c791bd57d1db847e80d14018f96315b | diff --git a/lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/page_properties.rb b/lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/page_properties.rb
index <HASH>..<HASH> 100644
--- a/lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/page_properties.rb
+++ b/lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/page_properties.rb
@@ -23,10 +23,7 @@ module OoxmlParser
def self.parse(sect_pr, default_paragraph, default_character)
page_properties = PageProperties.new
sect_pr.xpath('w:pgSz').each do |pg_sz|
- page_properties.size = Size.new
- page_properties.size.orientation = pg_sz.attribute('orient').value.to_sym unless pg_sz.attribute('orient').nil?
- page_properties.size.height = pg_sz.attribute('h').value
- page_properties.size.width = pg_sz.attribute('w').value
+ page_properties.size = Size.parse(pg_sz)
end
sect_pr.xpath('w:pgBorders').each do |pg_borders|
page_borders = Borders.new | Use internal parsing of `Size` | ONLYOFFICE_ooxml_parser | train | rb |
193e2b7586873b44d1b9deea6447911b30b28536 | diff --git a/lib/ronin/platform/overlay.rb b/lib/ronin/platform/overlay.rb
index <HASH>..<HASH> 100644
--- a/lib/ronin/platform/overlay.rb
+++ b/lib/ronin/platform/overlay.rb
@@ -36,6 +36,9 @@ module Ronin
# Overlay Format version
VERSION = 1
+ # A list of backwards compatible Overlay Format versions
+ COMPATIBILITY = [1]
+
# Overlay metadata XML file name
METADATA_FILE = 'ronin.xml'
@@ -145,6 +148,25 @@ module Ronin
end
#
+ # Determines if the given Overlay Format version is backwards
+ # compatible with {Ronin::Platform::Overlay}.
+ #
+ # @param [Integer] version
+ # The version to check for backwards compatibility.
+ #
+ # @return [Boolean]
+ # Specifies whether the given version is supported by
+ # {Ronin::Platform::Overlay}.
+ #
+ def Overlay.compatible?(version)
+ COMPATIBILITY.each do |compat|
+ return true if compat === version
+ end
+
+ return false
+ end
+
+ #
# @return [Symbol]
# The media type of the overlay.
# | Added Overlay::COMPATIBILITY and Overlay.compatible? to test for backwards compatibility of overlays. | ronin-ruby_ronin | train | rb |
98a4c72c504942340a53a91365c4549be40441d4 | diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/PublicMetrics.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/PublicMetrics.java
index <HASH>..<HASH> 100644
--- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/PublicMetrics.java
+++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/PublicMetrics.java
@@ -22,9 +22,12 @@ import org.springframework.boot.actuate.metrics.Metric;
/**
* Interface to expose specific {@link Metric}s via a {@link MetricsEndpoint}.
+ * Implementations should take care that the metrics they provide have unique names in the
+ * application context, but they shouldn't have to care about global uniqueness in the JVM
+ * or across a distributed system.
*
* @author Dave Syer
- * @see SystemPublicMetrics
+ * @see SystemPublicMetrics SystemPublicMetrics for an example implementation
*/
public interface PublicMetrics { | Clarify PublicMetrics (uniqueness of metric names)
See gh-<I> | spring-projects_spring-boot | train | java |
343e2f069eae6ea840083c8a845cc49e843eb654 | diff --git a/resources/views/roles/index.blade.php b/resources/views/roles/index.blade.php
index <HASH>..<HASH> 100644
--- a/resources/views/roles/index.blade.php
+++ b/resources/views/roles/index.blade.php
@@ -37,7 +37,7 @@
</div>
<div class="row">
- <div class="col-md-10 col-md-offset-1">
+ <div>
<table class="table table-striped table-hover records-table">
diff --git a/resources/views/users/index.blade.php b/resources/views/users/index.blade.php
index <HASH>..<HASH> 100644
--- a/resources/views/users/index.blade.php
+++ b/resources/views/users/index.blade.php
@@ -37,7 +37,7 @@
</div>
<div class="row">
- <div class="col-md-10 col-md-offset-1">
+ <div>
<table class="table table-striped table-hover records-table"> | Minor listing view adjustment to conform to models module listings | czim_laravel-cms-acl-module | train | php,php |
3f013c7826f71df850f85b657eb52435a6d2aab4 | diff --git a/core/console/commands/views/block/create_block_view.php b/core/console/commands/views/block/create_block_view.php
index <HASH>..<HASH> 100644
--- a/core/console/commands/views/block/create_block_view.php
+++ b/core/console/commands/views/block/create_block_view.php
@@ -1,9 +1,6 @@
<?php
echo "<?php\n";
?>
-
-use Yii;
-
/**
* View file for block: <?= $blockClassName; ?>
*
diff --git a/tests/core/console/controllers/BlockControllerTest.php b/tests/core/console/controllers/BlockControllerTest.php
index <HASH>..<HASH> 100644
--- a/tests/core/console/controllers/BlockControllerTest.php
+++ b/tests/core/console/controllers/BlockControllerTest.php
@@ -249,9 +249,6 @@ EOT;
$view = <<<'EOT'
<?php
-
-use Yii;
-
/**
* View file for block: MySuperBlock
* | remove use Yii in view files. | luyadev_luya | train | php,php |
a71dc66e97c796d4e9006e8037933bc13c5e2a37 | diff --git a/bigchaindb/models.py b/bigchaindb/models.py
index <HASH>..<HASH> 100644
--- a/bigchaindb/models.py
+++ b/bigchaindb/models.py
@@ -262,7 +262,7 @@ class Block(object):
DoubleSpend: if the transaction is a double spend
InvalidHash: if the hash of the transaction is wrong
InvalidSignature: if the signature of the transaction is wrong
- ValidationError: If the block contains a duplicated TX
+ DuplicateTransaction: If the block contains a duplicated TX
"""
txids = [tx.id for tx in self.transactions]
if len(txids) != len(set(txids)):
diff --git a/tests/pipelines/test_block_creation.py b/tests/pipelines/test_block_creation.py
index <HASH>..<HASH> 100644
--- a/tests/pipelines/test_block_creation.py
+++ b/tests/pipelines/test_block_creation.py
@@ -231,7 +231,7 @@ def test_full_pipeline(b, user_pk):
def test_block_snowflake(create_tx, signed_transfer_tx):
from bigchaindb.pipelines.block import tx_collector
snowflake = tx_collector()
- snowflake.send(create_tx)
+ assert snowflake.send(create_tx) == [create_tx]
snowflake.send(signed_transfer_tx)
snowflake.send(create_tx)
assert snowflake.send(None) == [create_tx, signed_transfer_tx] | extra test for tx_collector and docs fix | bigchaindb_bigchaindb | train | py,py |
90c67daec1aaac22e0c105dff4f36279e4cd232f | diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/session/JdbcSessionDatabaseInitializer.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/session/JdbcSessionDatabaseInitializer.java
index <HASH>..<HASH> 100644
--- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/session/JdbcSessionDatabaseInitializer.java
+++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/session/JdbcSessionDatabaseInitializer.java
@@ -45,6 +45,7 @@ public class JdbcSessionDatabaseInitializer {
aliases.put("apache derby", "derby");
aliases.put("hsql database engine", "hsqldb");
aliases.put("microsoft sql server", "sqlserver");
+ aliases.put("postgres", "postgresql");
ALIASES = Collections.unmodifiableMap(aliases);
} | Polish contribution
Closes gh-<I> | spring-projects_spring-boot | train | java |
27b32b469524529b9235fbe2769fa63c00fe38b4 | diff --git a/wffweb/src/main/java/com/webfirmframework/wffweb/css/css3/WebkitColumnGap.java b/wffweb/src/main/java/com/webfirmframework/wffweb/css/css3/WebkitColumnGap.java
index <HASH>..<HASH> 100644
--- a/wffweb/src/main/java/com/webfirmframework/wffweb/css/css3/WebkitColumnGap.java
+++ b/wffweb/src/main/java/com/webfirmframework/wffweb/css/css3/WebkitColumnGap.java
@@ -310,9 +310,7 @@ public class WebkitColumnGap extends AbstractCssProperty<WebkitColumnGap> {
return true;
}
}
- if (PREDEFINED_CONSTANTS.contains(trimmedCssValue)) {
- return true;
- }
- return false;
+
+ return PREDEFINED_CONSTANTS.contains(trimmedCssValue);
}
} | Code improvement
Avoided unnecessary if..then..else statements when returning booleans | webfirmframework_wff | train | java |
d07147ffd5966707bcac08c75ff68c72a1767274 | diff --git a/lib/rails_admin/config/labelable.rb b/lib/rails_admin/config/labelable.rb
index <HASH>..<HASH> 100644
--- a/lib/rails_admin/config/labelable.rb
+++ b/lib/rails_admin/config/labelable.rb
@@ -4,7 +4,7 @@ module RailsAdmin
module Labelable
def self.included(klass)
klass.register_instance_option(:label) do
- abstract_model.model.model_name.titleize
+ abstract_model.model.model_name.human(:default => abstract_model.model.model_name.titleize)
end
klass.register_instance_option(:object_label) do
if bindings[:object].respond_to?(:name) && bindings[:object].name | Make model's label to try human method first (which queries translation
backend) and fallback to titleized name. Fixes dropped I<I>n support in
commit c3cea<I>d<I>ecdb<I>b<I>fbb<I>b4c<I>e9af<I>d. | sferik_rails_admin | train | rb |
913bdb4fe654fc2c566eea11855fe96ebd6b95f1 | diff --git a/lxd/network/driver_ovn.go b/lxd/network/driver_ovn.go
index <HASH>..<HASH> 100644
--- a/lxd/network/driver_ovn.go
+++ b/lxd/network/driver_ovn.go
@@ -141,7 +141,7 @@ func (n *ovn) validateExternalSubnet(uplinkRoutes []*net.IPNet, projectRestricte
if projectRestrictedSubnets != nil {
foundMatch := false
for _, projectRestrictedSubnet := range projectRestrictedSubnets {
- if !SubnetContains(projectRestrictedSubnet, ipNet) {
+ if SubnetContains(projectRestrictedSubnet, ipNet) {
foundMatch = true
break
} | lxd/network/driver/ovn: Fix project restricted subnets check in validateExternalSubnet | lxc_lxd | train | go |
db69d8e67b99570b16e8cd5f78c423ed1167cb21 | diff --git a/src/Cors.php b/src/Cors.php
index <HASH>..<HASH> 100644
--- a/src/Cors.php
+++ b/src/Cors.php
@@ -83,6 +83,7 @@ class Cors
return $next($request, $response);
default:
/* Actual CORS request. */
+ $response = $next($request, $response);
$cors_headers = $cors->getResponseHeaders();
foreach ($cors_headers as $header => $value) {
/* Diactoros errors on integer values. */
@@ -91,7 +92,7 @@ class Cors
}
$response = $response->withHeader($header, $value);
}
- return $next($request, $response);
+ return $response;
}
} | Work on returned response instead, fixes #1 | tuupola_cors-middleware | train | php |
db48473bee565106320a28f846db8677a7aeaa2a | diff --git a/src/Relationships/IRelationshipContainer.php b/src/Relationships/IRelationshipContainer.php
index <HASH>..<HASH> 100644
--- a/src/Relationships/IRelationshipContainer.php
+++ b/src/Relationships/IRelationshipContainer.php
@@ -10,12 +10,10 @@
namespace Nextras\Orm\Relationships;
-use Countable;
-use IteratorAggregate;
use Nextras\Orm\Entity\IEntity;
-interface IRelationshipContainer extends IteratorAggregate, Countable
+interface IRelationshipContainer
{
/** | [relationships] fixed interface definition | nextras_orm | train | php |
45cc3cb0efd79d8cecee0676a0951d1f9a30bab1 | diff --git a/alot/commands/globals.py b/alot/commands/globals.py
index <HASH>..<HASH> 100644
--- a/alot/commands/globals.py
+++ b/alot/commands/globals.py
@@ -38,8 +38,10 @@ class ExitCommand(Command):
"""shut down cleanly"""
@inlineCallbacks
def apply(self, ui):
- if settings.get('bug_on_exit'):
- if (yield ui.choice('realy quit?', select='yes', cancel='no',
+ msg = 'index not fully synced. ' if ui.db_was_locked else ''
+ if settings.get('bug_on_exit') or ui.db_was_locked:
+ msg += 'really quit?'
+ if (yield ui.choice(msg, select='yes', cancel='no',
msg_position='left')) == 'no':
return
for b in ui.buffers: | bug on exit if index not synced | pazz_alot | train | py |
4f40f5147f3234696cd67b1cc639b37f7494e708 | diff --git a/fedmsg/core.py b/fedmsg/core.py
index <HASH>..<HASH> 100644
--- a/fedmsg/core.py
+++ b/fedmsg/core.py
@@ -333,7 +333,7 @@ class FedMsgContext(object):
import moksha.hub
# First, a quick sanity check.
if not getattr(moksha.hub, '_hub', None):
- raise AttributeError("Unable to publish non-zeromq msg"
+ raise AttributeError("Unable to publish non-zeromq msg "
"without moksha-hub initialization.")
# Let moksha.hub do our work.
moksha.hub._hub.send_message( | Add missing space to error message
Add a missing space in error message in FedMsgContext.publish when
moksha-hub has not been initialized. | fedora-infra_fedmsg | train | py |
b131f5d67076b97b3186c820760df839bf796ad5 | diff --git a/src/main/launch.js b/src/main/launch.js
index <HASH>..<HASH> 100644
--- a/src/main/launch.js
+++ b/src/main/launch.js
@@ -18,7 +18,7 @@ export function deferURL(event, url) {
}
}
-const iconPath = path.join(__dirname, '../../static/icon.png');
+const iconPath = path.join(__dirname, '..', '..', 'static', 'icon.png');
export function launch(filename) {
let win = new BrowserWindow({
@@ -57,4 +57,3 @@ export function launchNewNotebook(kernelSpecName) {
});
return win;
}
- | fix(icon): load icon on windows by fixing path join | nteract_nteract | train | js |
e67c819a2579abb0daf49436effd5633eda3554c | diff --git a/worker/task.go b/worker/task.go
index <HASH>..<HASH> 100644
--- a/worker/task.go
+++ b/worker/task.go
@@ -37,6 +37,9 @@ func NewTask(lifecycle Lifecycle, payload []byte) *Task {
// worked on.
func (t *Task) Bytes() []byte { return t.payload }
+// SetBytes sets the bytes that this task is holding.
+func (t *Task) SetBytes(bytes []byte) { t.payload = bytes }
+
// Succeed signals the lifecycle that work on this task has been completed,
// and removes the task from the worker queue.
func (t *Task) Succeed() error { | feat(lifecycle): added ability to alter payload of a task (#<I>) | mixer_redutil | train | go |
b5d9f5b48aa047cd37ab910f7872dc74c4302f28 | diff --git a/lib/cc/cli/runner.rb b/lib/cc/cli/runner.rb
index <HASH>..<HASH> 100644
--- a/lib/cc/cli/runner.rb
+++ b/lib/cc/cli/runner.rb
@@ -11,6 +11,7 @@ module CC
$stderr.puts("error: (#{ex.class}) #{ex.message}")
CLI.debug("backtrace: #{ex.backtrace.join("\n\t")}")
+ exit 1
end
def initialize(args)
diff --git a/spec/cc/cli/runner_spec.rb b/spec/cc/cli/runner_spec.rb
index <HASH>..<HASH> 100644
--- a/spec/cc/cli/runner_spec.rb
+++ b/spec/cc/cli/runner_spec.rb
@@ -30,11 +30,12 @@ module CC::CLI
end
end
- _, stderr = capture_io do
+ _, stderr, exit_code = capture_io_and_exit_code do
Runner.run(["explode"])
end
expect(stderr).to match(/error: \(StandardError\) boom/)
+ expect(exit_code).to eq(1)
end
it "doesn't check for new version when --no-check-version is passed" do | Exit 1 when due to an unexpected error
We exit 0 in `Runner` when handling exceptions. That's pretty surprising, and is
very problematic for any attempt to use the CLI within a script or an editor
plugin or anything of that kind: it can lead to accidentally think everything
went fine & found no issues when in fact analysis just didn't run. I'm shocked
we've made it this long without this being a problem, actually. | codeclimate_codeclimate | train | rb,rb |
c518b36d572588a14e42cebaeb15345a8013ac4c | diff --git a/src/NewCommand.php b/src/NewCommand.php
index <HASH>..<HASH> 100644
--- a/src/NewCommand.php
+++ b/src/NewCommand.php
@@ -44,7 +44,9 @@ class NewCommand extends Command
throw new RuntimeException('The Zip PHP extension is not installed. Please install it and try again.');
}
- $directory = ($input->getArgument('name')) ? getcwd().'/'.$input->getArgument('name') : getcwd();
+ $name = $input->getArgument('name');
+
+ $directory = $name && $name !== '.' ? getcwd().'/'.$name : getcwd();
if (! $input->getOption('force')) {
$this->verifyApplicationDoesntExist($directory); | Create a new project in the current directory using "laravel new ." | laravel_installer | train | php |
420cd427cfb1f292565c7df5c24d5e2895d2694b | diff --git a/lib/onebox/engine.rb b/lib/onebox/engine.rb
index <HASH>..<HASH> 100644
--- a/lib/onebox/engine.rb
+++ b/lib/onebox/engine.rb
@@ -59,7 +59,13 @@ module Onebox
end
def link
- @url.gsub(/['\"<>]/, CGI::TABLE_FOR_ESCAPE_HTML__)
+ @url.gsub(/['\"<>]/, {
+ "'" => ''',
+ '&' => '&',
+ '"' => '"',
+ '<' => '<',
+ '>' => '>',
+ })
end
module ClassMethods | Don't use CGI::TABLE_FOR_ESCAPE_HTML__. | discourse_onebox | train | rb |
4204f3841d9c1192fef9ea89fd0d4d84d9423a2b | diff --git a/tests/ManagerTest.php b/tests/ManagerTest.php
index <HASH>..<HASH> 100644
--- a/tests/ManagerTest.php
+++ b/tests/ManagerTest.php
@@ -106,8 +106,8 @@ class ManagerStub extends \Orchestra\Support\Manager
return new ManagerFoobar($this->app, $name);
}
- public function createDefaultDriver()
+ public function getDefaultDriver()
{
- return $this->createFooDriver();
+ return 'foo';
}
} | Fixes missing abstract class causing the testcase to fail. | orchestral_support | train | php |
a67f9a60762527ae3472c4128c3a2c82f1c78e35 | diff --git a/lib/actions/field-trip.js b/lib/actions/field-trip.js
index <HASH>..<HASH> 100644
--- a/lib/actions/field-trip.js
+++ b/lib/actions/field-trip.js
@@ -305,7 +305,7 @@ function makeSaveFieldTripItinerariesData (request, outbound, state) {
}
}
- // itierate through itineraries to construct itinerary and gtfsTrip data to
+ // iterate through itineraries to construct itinerary and gtfsTrip data to
// save the itineraries to otp-datastore.
itineraries.forEach((itinerary, itinIdx) => {
const itineraryDataToSave = { | Update lib/actions/field-trip.js | opentripplanner_otp-react-redux | train | js |
27437a808d129242e52fe784ca778375f6c4c39b | diff --git a/cake/libs/folder.php b/cake/libs/folder.php
index <HASH>..<HASH> 100644
--- a/cake/libs/folder.php
+++ b/cake/libs/folder.php
@@ -431,9 +431,6 @@ class Folder extends Object {
* @access public
*/
function tree($path, $exceptions = true, $type = null) {
- if (!$this->pwd()) {
- return array();
- }
$original = $this->path;
$path = rtrim($path, DS);
$this->__files = array(); | rmoving path check from Folder::tree fixes issues with classes not beign found in App::import | cakephp_cakephp | train | php |
03ba4dac88af917501d04b4f7d1aab780e446cb0 | diff --git a/lib/OpenLayers/Layer.js b/lib/OpenLayers/Layer.js
index <HASH>..<HASH> 100644
--- a/lib/OpenLayers/Layer.js
+++ b/lib/OpenLayers/Layer.js
@@ -102,7 +102,6 @@ OpenLayers.Layer = OpenLayers.Class({
* will receive an object with a *map* property referencing the map and
* a *layer* property referencing the layer.
*/
- */
events: null,
/** | Remove superfluous comment closing (*/), thanks @mprins. | openlayers_openlayers | train | js |
c3ce525c6ce18556ed28625c4a8e9382badf3bb2 | diff --git a/src/diagrams/sequence/sequenceDb.js b/src/diagrams/sequence/sequenceDb.js
index <HASH>..<HASH> 100644
--- a/src/diagrams/sequence/sequenceDb.js
+++ b/src/diagrams/sequence/sequenceDb.js
@@ -1,6 +1,5 @@
import mermaidAPI from '../../mermaidAPI';
import * as configApi from '../../config';
-import common from '../common/common';
import { logger } from '../../logger';
let prevActor = undefined;
@@ -138,9 +137,7 @@ export const parseMessage = function(str) {
const message = {
text: _str.replace(/^[:]?(?:no)?wrap:/, '').trim(),
wrap:
- _str.match(/^[:]?(?:no)?wrap:/) === null
- ? common.hasBreaks(_str) || undefined
- : _str.match(/^[:]?wrap:/) !== null
+ _str.match(/^[:]?wrap:/) !== null
? true
: _str.match(/^[:]?nowrap:/) !== null
? false | fix: exclude text with line breaks when parsing wrap setting | knsv_mermaid | train | js |
e20eac812a332004ab534d2cc004680b1ceb4a5e | diff --git a/index.js b/index.js
index <HASH>..<HASH> 100644
--- a/index.js
+++ b/index.js
@@ -1,10 +1,17 @@
var _ = require('lodash');
var loaderUtils = require('loader-utils');
+function getOptions(context) {
+ if (context.options && context.options.ejsLoader) {
+ return context.options.ejsLoader;
+ }
+ return {};
+}
+
module.exports = function(source) {
this.cacheable && this.cacheable();
var query = loaderUtils.parseQuery(this.query);
- var options = this.options ? this.options.ejsLoader || {} : {};
+ var options = getOptions(this);
['escape', 'interpolate', 'evaluate'].forEach(function(templateSetting) {
var setting = query[templateSetting]; | refactor: make code more readable and remove ternary | difelice_ejs-loader | train | js |
ffe778392caed315fc1b2e657ab2f7d104ab8ade | diff --git a/misc.go b/misc.go
index <HASH>..<HASH> 100644
--- a/misc.go
+++ b/misc.go
@@ -23,7 +23,7 @@ func newRequest(index, begin, length pp.Integer) request {
func newRequestFromMessage(msg *pp.Message) request {
switch msg.Type {
- case pp.Request:
+ case pp.Request, pp.Cancel, pp.Reject:
return newRequest(msg.Index, msg.Begin, msg.Length)
case pp.Piece:
return newRequest(msg.Index, msg.Begin, pp.Integer(len(msg.Piece))) | request can be made from Reject and Cancel messages too | anacrolix_torrent | train | go |
0961586e8b67c907b7fa54191c1434facd31e55d | diff --git a/src/Mpociot/BotMan/Drivers/BotFrameworkDriver.php b/src/Mpociot/BotMan/Drivers/BotFrameworkDriver.php
index <HASH>..<HASH> 100644
--- a/src/Mpociot/BotMan/Drivers/BotFrameworkDriver.php
+++ b/src/Mpociot/BotMan/Drivers/BotFrameworkDriver.php
@@ -185,7 +185,7 @@ class BotFrameworkDriver extends Driver
'Authorization:Bearer '.$this->getAccessToken(),
];
- $apiURL = Collection::make($matchingMessage->getPayload())->get('serviceUrl', 'https://skype.botframework.com');
+ $apiURL = Collection::make($matchingMessage->getPayload())->get('serviceUrl', Collection::make($additionalParameters)->get('serviceUrl'));
if (strstr($apiURL, 'webchat.botframework')) {
$parameters['from'] = [ | Allow passing the serviceUrl to BotFramework drivers say method | botman_botman | train | php |
8d1eeed6e9f61939fee65b78748248f17ce919e4 | diff --git a/trunk/ipaddr.py b/trunk/ipaddr.py
index <HASH>..<HASH> 100644
--- a/trunk/ipaddr.py
+++ b/trunk/ipaddr.py
@@ -1490,6 +1490,8 @@ class _BaseV6(object):
# Whitelist the characters, since int() allows a lot of bizarre stuff.
if not self._HEX_DIGITS.issuperset(hextet_str):
raise ValueError
+ if len(hextet_str) > 4:
+ raise ValueError
hextet_int = int(hextet_str, 16)
if hextet_int > 0xFFFF:
raise ValueError
diff --git a/trunk/ipaddr_test.py b/trunk/ipaddr_test.py
index <HASH>..<HASH> 100755
--- a/trunk/ipaddr_test.py
+++ b/trunk/ipaddr_test.py
@@ -133,6 +133,7 @@ class IpaddrUnitTest(unittest.TestCase):
AssertInvalidIP(":1:2:3:4:5:6:")
AssertInvalidIP("192.0.2.1/32")
AssertInvalidIP("2001:db8::1/128")
+ AssertInvalidIP("02001:db8::")
self.assertRaises(ipaddr.AddressValueError, ipaddr.IPv4Network, '')
self.assertRaises(ipaddr.AddressValueError, ipaddr.IPv4Network, | ipaddr incorrectly parses some V6 addresses.
issue<I>. | google_ipaddr-py | train | py,py |
31b53a7430ac99d30adbeba6e48c51bd2f38a296 | diff --git a/src/components/Site/SiteHeader.react.js b/src/components/Site/SiteHeader.react.js
index <HASH>..<HASH> 100644
--- a/src/components/Site/SiteHeader.react.js
+++ b/src/components/Site/SiteHeader.react.js
@@ -8,7 +8,11 @@ import type { Props as AccountDropdownProps } from "../AccountDropdown/AccountDr
export type Props = {|
+children?: React.Node,
/**
- * href attributefor the logo
+ * href attribute for the logo
+ */
+ +align?: string,
+ /**
+ * header alignment
*/
+href?: string,
/**
@@ -34,6 +38,7 @@ export type Props = {|
const SiteHeader = ({
children,
href,
+ align,
imageURL,
alt,
notificationsTray: notificationsTrayFromProps,
@@ -50,7 +55,7 @@ const SiteHeader = ({
return (
<div className="header py-4">
- <Container>
+ <Container className={align}>
<div className="d-flex">
{children || (
<React.Fragment> | feat(SiteHeader): header optional alignment
Add an alignment tag for header component to put content on the center of the container | tabler_tabler-react | train | js |
75bf838ba807720d93009dfca22fa7f146154464 | diff --git a/src/python/dxpy/scripts/dx_reads_to_fastq.py b/src/python/dxpy/scripts/dx_reads_to_fastq.py
index <HASH>..<HASH> 100755
--- a/src/python/dxpy/scripts/dx_reads_to_fastq.py
+++ b/src/python/dxpy/scripts/dx_reads_to_fastq.py
@@ -75,7 +75,7 @@ def main(**kwargs):
exportToFile(columns=col2, table=table, output_file=out_fh2, hasName=hasName, hasQual=hasQual, FASTA=kwargs['output_FASTA'])
def exportToFile(columns, table, output_file, hasName = True, hasQual = True, FASTA = False):
- for row in table.iterate_query_rows(columns=columns):
+ for row in table.iterate_rows(columns=columns):
if FASTA == True:
if hasName == True:
# change comment character for FASTA | use iterate_rows, which is currently faster | dnanexus_dx-toolkit | train | py |
06a36f68eb16d0d056d4d00b7be455b0aa793667 | diff --git a/Gruntfile.js b/Gruntfile.js
index <HASH>..<HASH> 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -22,8 +22,8 @@ module.exports = function(grunt) {
js: {
src: 'tasks/',
options: {
- collectData: true,
- dataStore: 'beaker.json'
+ collectData: true,
+ dataStore: 'beaker.json'
}
}
} | Corrected a tab/space formatting issue | kmulvey_grunt-beaker | train | js |
bf4d6b42730b4ef3ff063f8a12b88b9b7686c91b | diff --git a/lib/puppet/provider/package/pkgin.rb b/lib/puppet/provider/package/pkgin.rb
index <HASH>..<HASH> 100644
--- a/lib/puppet/provider/package/pkgin.rb
+++ b/lib/puppet/provider/package/pkgin.rb
@@ -25,7 +25,7 @@ Puppet::Type.type(:package).provide :pkgin, :parent => Puppet::Provider::Package
def self.prefetch(packages)
super
- # Withouth -f, no fresh pkg_summary files are downloaded
+ # Without -f, no fresh pkg_summary files are downloaded
pkgin("-yf", :update)
end | (maint) Spell-check package/pkgin.rb. | puppetlabs_puppet | train | rb |
1353f833ea2a808a9646278247bcb79faaee55eb | diff --git a/source/library/pattern/pattern/apply-transforms.js b/source/library/pattern/pattern/apply-transforms.js
index <HASH>..<HASH> 100644
--- a/source/library/pattern/pattern/apply-transforms.js
+++ b/source/library/pattern/pattern/apply-transforms.js
@@ -1,3 +1,5 @@
+import path from 'path';
+
export default applyTransforms;
function applyTransforms(file, transformNames, options) {
@@ -41,14 +43,15 @@ async function applyTransform(fn, file, config) {
}
function augmentTransformError(error, file, transformName) {
- error.message = [
- `${error.pattern}:${error.file} [${error.transform}]`,
- error.message
- ].join('\n');
-
error.pattern = error.pattern || file.pattern.id;
error.file = error.file || error.fileName || file.path;
error.fileName = error.file;
error.transform = error.transform || transformName;
+
+ error.message = [
+ `${error.pattern}:${path.basename(error.file)} [${error.transform}]`,
+ error.message
+ ].join('\n');
+
return error;
} | fix: do not print confusing undefined for transform errors | patternplate-archive_patternplate-server | train | js |
547a2187338c433e51c64c422213c294724ab7e8 | diff --git a/lib/github/auth/cli.rb b/lib/github/auth/cli.rb
index <HASH>..<HASH> 100644
--- a/lib/github/auth/cli.rb
+++ b/lib/github/auth/cli.rb
@@ -1,4 +1,5 @@
module Github::Auth
+ # Command Line Interface for parsing and executing commands
class CLI
attr_reader :command, :usernames
diff --git a/lib/github/auth/keys_client.rb b/lib/github/auth/keys_client.rb
index <HASH>..<HASH> 100644
--- a/lib/github/auth/keys_client.rb
+++ b/lib/github/auth/keys_client.rb
@@ -1,6 +1,7 @@
require 'httparty'
module Github::Auth
+ # Client for fetching public SSH keys using the Github API
class KeysClient
attr_reader :username, :hostname
diff --git a/lib/github/auth/keys_file.rb b/lib/github/auth/keys_file.rb
index <HASH>..<HASH> 100644
--- a/lib/github/auth/keys_file.rb
+++ b/lib/github/auth/keys_file.rb
@@ -1,4 +1,5 @@
module Github::Auth
+ # Write and delete keys from the authorized_keys file
class KeysFile
attr_reader :path | Fix style violations for KeysFile, KeysClient, CLI | chrishunt_github-auth | train | rb,rb,rb |
90fe864a45de66cccf8c6fe1dc1540bef9fcc599 | diff --git a/stsci/tools/check_files.py b/stsci/tools/check_files.py
index <HASH>..<HASH> 100644
--- a/stsci/tools/check_files.py
+++ b/stsci/tools/check_files.py
@@ -66,7 +66,7 @@ def checkPhotKeywords(filelist):
This only moves keywords from the PRIMARY header if the keywords
do not already exist in the SCI header.
"""
- PHOTKEYS = ['PHOTFLAM','PHOTPLAM','PHOTBW','PHOTZPT','PHOTMODE']
+ PHOTKEYS = ['PHOTFLAM','PHOTPLAM','PHOTBW','PHOTZPT','PHOTMODE','PHOTFNU']
for f in filelist:
handle = fileutil.openImage(f,mode='update',memmap=0)
phdr = handle['PRIMARY'].header | added PHOTFNU to the checkPhotKeywords so IR instruments headers would be updated similar to UVIS
git-svn-id: <URL> | spacetelescope_stsci.tools | train | py |
963d997b37f4336fe831238dd8b641a17dd050ae | diff --git a/logging/nox.py b/logging/nox.py
index <HASH>..<HASH> 100644
--- a/logging/nox.py
+++ b/logging/nox.py
@@ -71,7 +71,13 @@ def system_tests(session, python_version):
session.install('.')
# Run py.test against the system tests.
- session.run('py.test', '-vvv', 'tests/system.py', *session.posargs)
+ session.run(
+ 'py.test',
+ '-vvv',
+ 'tests/system.py',
+ *session.posargs,
+ success_codes=range(0, 100),
+ )
@nox.session | Allowing logging system tests to fail. (#<I>)
These hose our builds. | googleapis_google-cloud-python | train | py |
970b1ef91d4598f0969e9eced25bc67df3324bc5 | diff --git a/tests/library/CM/Db/Query/CountTest.php b/tests/library/CM/Db/Query/CountTest.php
index <HASH>..<HASH> 100644
--- a/tests/library/CM/Db/Query/CountTest.php
+++ b/tests/library/CM/Db/Query/CountTest.php
@@ -3,7 +3,8 @@
class CM_Db_Query_CountTest extends CMTest_TestCase {
public function testAll() {
- $query = new CM_Db_Query_Count('t`est', array('foo' => 'foo1', 'bar' => 'bar1'));
+ $client = CMTest_TH::createClient(false);
+ $query = new CM_Db_Query_Count($client, 't`est', array('foo' => 'foo1', 'bar' => 'bar1'));
$this->assertSame('SELECT COUNT(*) FROM `t``est` WHERE `foo` = ? AND `bar` = ?', $query->getSqlTemplate());
$this->assertEquals(array('foo1', 'bar1'), $query->getParameters());
} | add CMTest_TH::createClient in CM_Db_Query_CountTest | cargomedia_cm | train | php |
23440258b95bbbd2c008b3b4a1e8d3e9aade278c | diff --git a/subdownloader/languages/language.py b/subdownloader/languages/language.py
index <HASH>..<HASH> 100644
--- a/subdownloader/languages/language.py
+++ b/subdownloader/languages/language.py
@@ -102,8 +102,6 @@ class Language:
:return: Language instance with instance.xx() == xx
"""
xx = str(xx).lower()
- if xx == 'gr':
- xx = 'el'
return cls._from_XYZ('ISO639', xx)
@classmethod
@@ -383,8 +381,8 @@ LANGUAGES = [
'LanguageID': ['ger'],
'LanguageName': [_('German')]
}, {
- 'locale': ['el'],
- 'ISO639': ['el'],
+ 'locale': ['el', 'gr'],
+ 'ISO639': ['el', 'gr'],
'LanguageID': ['ell'],
'LanguageName': [_('Greek')]
}, { | lang: add alternative (illegal) language code gr for Greek (el) | subdownloader_subdownloader | train | py |
926b87c80f1aaad5cbeabc7b7c6d4a3fd220d157 | diff --git a/raiden/encoding.py b/raiden/encoding.py
index <HASH>..<HASH> 100644
--- a/raiden/encoding.py
+++ b/raiden/encoding.py
@@ -5,11 +5,6 @@ from rlp import DecodingError
from c_secp256k1 import ecdsa_recover_compact as c_ecdsa_recover_compact
from c_secp256k1 import ecdsa_sign_compact as c_ecdsa_sign_compact
import warnings
-from rlp.sedes import Binary
-from rlp.sedes import big_endian_int as t_int
-t_address = Binary.fixed_length(20, allow_empty=False)
-t_hash = Binary.fixed_length(32, allow_empty=False)
-t_hash_optional = Binary.fixed_length(32, allow_empty=True)
class ByteSerializer(object): | Remove code which is overwritten after all | raiden-network_raiden | train | py |
32064e56bc41e5c5862892b347bee1430151a386 | diff --git a/djangocms_text_ckeditor/__init__.py b/djangocms_text_ckeditor/__init__.py
index <HASH>..<HASH> 100644
--- a/djangocms_text_ckeditor/__init__.py
+++ b/djangocms_text_ckeditor/__init__.py
@@ -1,3 +1,3 @@
# -*- coding: utf-8 -*-
-__version__ = "3.2.0rc2"
+__version__ = "3.2.0rc3"
default_app_config = 'djangocms_text_ckeditor.apps.TextCkeditorConfig' | Bumped version to <I>rc3 | divio_djangocms-text-ckeditor | train | py |
91a2e8bc53a76a31d78542ceec5216943bc9781d | diff --git a/lib/cloud_crowd/models/node_record.rb b/lib/cloud_crowd/models/node_record.rb
index <HASH>..<HASH> 100644
--- a/lib/cloud_crowd/models/node_record.rb
+++ b/lib/cloud_crowd/models/node_record.rb
@@ -42,7 +42,7 @@ module CloudCrowd
end
def self.available_actions
- all.map(&:actions).flatten.uniq - BlackListedAction.all.pluck(:action)
+ available.map(&:actions).flatten.uniq - BlackListedAction.all.pluck(:action)
end
# Dispatch a WorkUnit to this node. Places the node at back at the end of | Only consider actions from available nodes when distributing work. | documentcloud_cloud-crowd | train | rb |
8faf8347c9d3e3d08daf26ffae189d1ef6adc838 | diff --git a/webdriver_test_tools/classes/page_object_prototypes.py b/webdriver_test_tools/classes/page_object_prototypes.py
index <HASH>..<HASH> 100644
--- a/webdriver_test_tools/classes/page_object_prototypes.py
+++ b/webdriver_test_tools/classes/page_object_prototypes.py
@@ -60,7 +60,7 @@ class NavObject(BasePage):
if link_map_key in self.HOVER_MAP:
link_tuple = self.HOVER_MAP[link_map_key]
link = self.find_element(link_tuple[0])
- action_chain = ActionChains(driver)
+ action_chain = ActionChains(self.driver)
action_chain.move_to_element(link).perform()
# Initialize the target page object and return it
return None if link_tuple[1] is None else link_tuple[1](self.driver)
diff --git a/webdriver_test_tools/version.py b/webdriver_test_tools/version.py
index <HASH>..<HASH> 100644
--- a/webdriver_test_tools/version.py
+++ b/webdriver_test_tools/version.py
@@ -1 +1 @@
-__version__ = '0.10.0'
+__version__ = '0.10.1' | Fixed an error with NavObject
Fixed reference to driver that should've been self.driver | connordelacruz_webdriver-test-tools | train | py,py |
d26924c4ec1410f7493b2048399e2ebadb16fc89 | diff --git a/lib/javascript.php b/lib/javascript.php
index <HASH>..<HASH> 100644
--- a/lib/javascript.php
+++ b/lib/javascript.php
@@ -1,3 +1,5 @@
+<script language="JavaScript" type="text/javascript"
+ src="<?php echo "$CFG->wwwroot/lib/overlib.js" ?>"></script>
<script language="JavaScript">
<!-- //hide | Load overlib.js as an external Javascript file, on all pages | moodle_moodle | train | php |
0131ff21c5d3c9831f57bf3da5f2eef648968ece | diff --git a/src/Symfony/Component/Translation/Loader/ArrayLoader.php b/src/Symfony/Component/Translation/Loader/ArrayLoader.php
index <HASH>..<HASH> 100644
--- a/src/Symfony/Component/Translation/Loader/ArrayLoader.php
+++ b/src/Symfony/Component/Translation/Loader/ArrayLoader.php
@@ -25,7 +25,7 @@ class ArrayLoader implements LoaderInterface
*/
public function load($resource, $locale, $domain = 'messages')
{
- $catalogue = $this->flatten($resource);
+ $this->flatten($resource);
$catalogue = new MessageCatalogue($locale);
$catalogue->addMessages($resource, $domain); | [Translation] removed unneeded assignement | symfony_symfony | train | php |
3b8e3df11a647c52482d6175588219e2c734d575 | diff --git a/test/test_helper.rb b/test/test_helper.rb
index <HASH>..<HASH> 100644
--- a/test/test_helper.rb
+++ b/test/test_helper.rb
@@ -70,7 +70,6 @@ class TestApp
current.create!
current.load!
current.migrate!
- reload_constant("Flipflop::Feature")
end
end
end
@@ -119,9 +118,9 @@ class TestApp
load File.expand_path("../../#{path}/config/application.rb", __FILE__)
load File.expand_path("../../#{path}/config/environments/test.rb", __FILE__)
+ Rails.application.config.cache_classes = false
Rails.application.initialize!
- ActiveSupport::Dependencies.mechanism = :load
require "capybara/rails"
end
@@ -141,6 +140,7 @@ class TestApp
Rails.instance_variable_set(:@application, nil)
ActiveSupport::Dependencies.remove_constant(name.camelize)
+ ActiveSupport::Dependencies.remove_constant("Flipflop::Feature")
end
private | Test improvements for Rails 4.x. | voormedia_flipflop | train | rb |
ac1ecd125f1f98c5f324f1ed4b19e42a997abb8e | diff --git a/polyfills/Element/polyfill-ie7.js b/polyfills/Element/polyfill-ie7.js
index <HASH>..<HASH> 100644
--- a/polyfills/Element/polyfill-ie7.js
+++ b/polyfills/Element/polyfill-ie7.js
@@ -44,7 +44,8 @@
},
elements = document.getElementsByTagName('*'),
- nativeCreateElement = document.createElement;
+ nativeCreateElement = document.createElement,
+ interval;
prototype.attachEvent('onpropertychange', function (event) {
var
@@ -75,6 +76,21 @@
};
}
+ // Apply Element prototype to the pre-existing DOM as soon as the body element appears.
+ function bodyCheck(e) {
+ if (document.body && !document.body.prototype && /(complete|interactive)/.test(document.readyState)) {
+ shiv(document, true);
+ if (interval && document.body.prototype) clearTimeout(interval);
+ return (!!document.body.prototype);
+ }
+ return false;
+ }
+ if (!bodyCheck(true)) {
+ document.onreadystatechange = bodyCheck;
+ interval = setInterval(bodyCheck, 1);
+ }
+
+ // Apply to any new elements created after load
document.createElement = function createElement(nodeName) {
var element = nativeCreateElement(String(nodeName).toLowerCase());
return shiv(element); | Apply Element prototype polyfill to existing elements in the DOM on page load | Financial-Times_polyfill-service | train | js |
425507b6e064cfb6cbdbcb87c333885dc663b171 | diff --git a/scapy.py b/scapy.py
index <HASH>..<HASH> 100755
--- a/scapy.py
+++ b/scapy.py
@@ -1421,6 +1421,9 @@ class ASN1_force(ASN1_Object):
return self.val.enc(codec)
return self.val
+class ASN1_BADTAG(ASN1_force):
+ pass
+
class ASN1_INTEGER(ASN1_Object):
tag = ASN1_Class_UNIVERSAL.INTEGER
@@ -1608,7 +1611,8 @@ class BERcodec_Object:
try:
return cls.do_dec(s, context, safe)
except BER_BadTag_Decoding_Error,e:
- return BERcodec_Object.dec(e.remaining, context, safe)
+ o,remain = BERcodec_Object.dec(e.remaining, context, safe)
+ return ASN1_BADTAG(o),remain
except BER_Decoding_Error, e:
return ASN1_DECODING_ERROR(s, exc=e),""
except ASN1_Error, e: | Added ASN1_BADTAG() object and used it
ASN1_BADTAG is used when decoding an ASN1 object (syntax is ok)
with another tag than the expected one (grammar is bad) | secdev_scapy | train | py |
c6c0a06d47f0e71d8465f53f1fb78d1bbcd7f5cc | diff --git a/version.go b/version.go
index <HASH>..<HASH> 100644
--- a/version.go
+++ b/version.go
@@ -19,4 +19,4 @@
package grpc
// Version is the current grpc version.
-const Version = "1.47.0-dev"
+const Version = "1.48.0-dev" | Change version to <I>-dev (#<I>) | grpc_grpc-go | train | go |
23fbbc9905b4d4a5acca8fe394c56d6ac5a5341f | diff --git a/lib/mediator.js b/lib/mediator.js
index <HASH>..<HASH> 100644
--- a/lib/mediator.js
+++ b/lib/mediator.js
@@ -154,7 +154,7 @@
for(; x<y; x++) {
if (this._subscribers[x].id === identifier || this._subscribers[x].fn === identifier){
- this._subscribers[x].priority = priority;
+ this._subscribers[x].options.priority = priority;
break;
}
} | Update mediator.js
Priority is a property of options. Priority was being set on subscriber objects. | ajacksified_Mediator.js | train | js |
9d6757f5c3aae6ac3691deee78f4d3e6b7e8b324 | diff --git a/salt/fileclient.py b/salt/fileclient.py
index <HASH>..<HASH> 100644
--- a/salt/fileclient.py
+++ b/salt/fileclient.py
@@ -249,14 +249,13 @@ class Client(object):
else:
return ''
else:
- dest = os.path.join(
- self.opts['cachedir'],
- 'extrn_files',
- env,
- os.path.join(
+ dest = os.path.normpath(
+ os.sep.join([
+ self.opts['cachedir'],
+ 'extrn_files',
+ env,
url_data.netloc,
- os.path.relpath(os.path.relpath(url_data.path, '/'), '..')
- ))
+ url_data.path]))
destdir = os.path.dirname(dest)
if not os.path.isdir(destdir):
os.makedirs(destdir) | Work around Python <I> bug involving relative paths from root
* In Python <I>, calling `os.path.relpath('/foo/bar', '/')` incorrectly
returns a path `../foo/bar`. In Python <I> this is fixed, but this
commit adds a workaround that works in both <I> and <I>. | saltstack_salt | train | py |
65353bd81ef0118decaa08b9ddc4145c3bf1586c | diff --git a/src/Symfony/Component/Form/Form.php b/src/Symfony/Component/Form/Form.php
index <HASH>..<HASH> 100644
--- a/src/Symfony/Component/Form/Form.php
+++ b/src/Symfony/Component/Form/Form.php
@@ -201,7 +201,7 @@ class Form extends Field implements \IteratorAggregate, FormInterface
$this->extraFields = array();
- foreach ($data as $name => $value) {
+ foreach ((array)$data as $name => $value) {
if (!$this->has($name)) {
$this->extraFields[] = $name;
} | [Form] Fixed failing choice field tests | symfony_symfony | train | php |
bb7c714d88c05ff4a8dae4e31e22b8685d3e1c22 | diff --git a/python/neuroglancer/webdriver.py b/python/neuroglancer/webdriver.py
index <HASH>..<HASH> 100644
--- a/python/neuroglancer/webdriver.py
+++ b/python/neuroglancer/webdriver.py
@@ -233,7 +233,7 @@ class Webdriver:
@property
def root_element(self):
- return self.driver.find_element_by_xpath('//body')
+ return self.driver.find_element('xpath', '//body')
def action_chain(self):
import selenium.webdriver | fix(python/webdriver): support Selenium <I> | google_neuroglancer | train | py |
c0a83a42a1103f63d8da819f946d4ea4adea70a6 | diff --git a/views/js/layout/logout-event.js b/views/js/layout/logout-event.js
index <HASH>..<HASH> 100644
--- a/views/js/layout/logout-event.js
+++ b/views/js/layout/logout-event.js
@@ -26,7 +26,7 @@ define(['jquery', 'i18n', 'helpers', 'ui/dialog/alert'],
function ($, __, helpers, alert) {
'use strict';
- return function LogoutEvent() {
+ return function logoutEvent() {
alert(__('You have been logged out. Please login again'), function () {
window.location = helpers._url('logout', 'Main', 'tao'); | first letter in function name is never capitalized - fixed | oat-sa_tao-core | train | js |
dc55efbf5ef5fcdb982e711abe36f63c029182d6 | diff --git a/includes/modules/export/epub3/class-pb-epub3.php b/includes/modules/export/epub3/class-pb-epub3.php
index <HASH>..<HASH> 100644
--- a/includes/modules/export/epub3/class-pb-epub3.php
+++ b/includes/modules/export/epub3/class-pb-epub3.php
@@ -145,7 +145,7 @@ class Epub3 extends Epub\Epub201 {
$config = array (
'valid_xhtml' => 1,
'no_deprecated_attr' => 2,
- 'deny_attribute' => 'cellpadding,cellspacing,frameborder,marginwidth,marginheight,scrolling',
+ 'deny_attribute' => 'cellpadding,cellspacing,frameborder,marginwidth,marginheight,scrolling,itemscope,itemtype,itemref,itemprop',
'unique_ids' => 'fixme-',
'hook' => '\PressBooks\Sanitize\html5_to_xhtml5',
'tidy' => -1, | epub3 does not like microdata attributes | pressbooks_pressbooks | train | php |
f570e7873952828d33de9b963f508b6e3f18919b | diff --git a/tests/FullApplicationTest.php b/tests/FullApplicationTest.php
index <HASH>..<HASH> 100644
--- a/tests/FullApplicationTest.php
+++ b/tests/FullApplicationTest.php
@@ -437,6 +437,8 @@ class FullApplicationTest extends PHPUnit_Framework_TestCase
public function testRequestUser()
{
+ $this->markTestIncomplete('This test has not been implemented yet.');
+
$app = new Application();
$app['auth']->viaRequest('api', function ($request) { | Mark testRequestUser as incomplete. | orchestral_lumen | train | php |
5e3cc47375a52e110b2c5cca7f9d28f91fb68153 | diff --git a/lib/formtastic/inputs/boolean_input.rb b/lib/formtastic/inputs/boolean_input.rb
index <HASH>..<HASH> 100644
--- a/lib/formtastic/inputs/boolean_input.rb
+++ b/lib/formtastic/inputs/boolean_input.rb
@@ -102,7 +102,9 @@ module Formtastic
value
when NilClass
false
- when Integer, String
+ when Integer
+ value == checked_value.to_i
+ when String
value == checked_value
when Array
value.include?(checked_value) | fix bug by ensuring we're comparing Integers | justinfrench_formtastic | train | rb |
84c3bd70694aecf0a87a4c6e5935b40d2ac7426a | diff --git a/retrofit/src/main/java/retrofit2/Utils.java b/retrofit/src/main/java/retrofit2/Utils.java
index <HASH>..<HASH> 100644
--- a/retrofit/src/main/java/retrofit2/Utils.java
+++ b/retrofit/src/main/java/retrofit2/Utils.java
@@ -376,14 +376,14 @@ final class Utils {
throw new IllegalArgumentException();
}
- this.ownerType = ownerType;
- this.rawType = rawType;
- this.typeArguments = typeArguments.clone();
-
- for (Type typeArgument : this.typeArguments) {
+ for (Type typeArgument : typeArguments) {
checkNotNull(typeArgument, "typeArgument == null");
checkNotPrimitive(typeArgument);
}
+
+ this.ownerType = ownerType;
+ this.rawType = rawType;
+ this.typeArguments = typeArguments.clone();
}
@Override public Type[] getActualTypeArguments() { | Moved validation first before cloning | square_retrofit | train | java |
e544c2d7cd936b1b7bc564500b605c8270b98088 | diff --git a/aeron-cluster/src/main/java/io/aeron/cluster/service/ClusteredServiceAgent.java b/aeron-cluster/src/main/java/io/aeron/cluster/service/ClusteredServiceAgent.java
index <HASH>..<HASH> 100644
--- a/aeron-cluster/src/main/java/io/aeron/cluster/service/ClusteredServiceAgent.java
+++ b/aeron-cluster/src/main/java/io/aeron/cluster/service/ClusteredServiceAgent.java
@@ -43,9 +43,6 @@ public class ClusteredServiceAgent implements ControlledFragmentHandler, Agent,
private static final int FRAGMENT_LIMIT = 10;
private static final int INITIAL_BUFFER_LENGTH = 4096;
- private long leadershipTermBeginPosition = 0;
- private long messageIndex;
- private long timestampMs;
private final boolean shouldCloseResources;
private final Aeron aeron;
private final ClusteredService service;
@@ -62,11 +59,13 @@ public class ClusteredServiceAgent implements ControlledFragmentHandler, Agent,
private final Long2ObjectHashMap<ClientSession> sessionByIdMap = new Long2ObjectHashMap<>();
private final IdleStrategy idleStrategy;
-
private final RecordingLog recordingLog;
private final AeronArchive.Context archiveCtx;
private final ClusteredServiceContainer.Context ctx;
+ private long leadershipTermBeginPosition = 0;
+ private long messageIndex;
+ private long timestampMs;
private long currentRecordingId;
private ReadableCounter consensusPosition;
private Image logImage; | [Java] Field grouping. | real-logic_aeron | train | java |
2c68e7a22ed10c4d27aad743c639d8c67b26d6cf | diff --git a/src/Venturecraft/Revisionable/RevisionableTrait.php b/src/Venturecraft/Revisionable/RevisionableTrait.php
index <HASH>..<HASH> 100644
--- a/src/Venturecraft/Revisionable/RevisionableTrait.php
+++ b/src/Venturecraft/Revisionable/RevisionableTrait.php
@@ -126,7 +126,7 @@ trait RevisionableTrait
// we can only safely compare basic items,
// so for now we drop any object based items, like DateTime
foreach ($this->updatedData as $key => $val) {
- $castCheck = ['object', 'array'];
+ $castCheck = ['object', 'array'];
if (isset($this->casts[$key]) && in_array(gettype($val), $castCheck) && in_array($this->casts[$key], $castCheck) && isset($this->originalData[$key])) {
// Sorts the keys of a JSON object due Normalization performed by MySQL
// So it doesn't set false flag if it is changed only order of key or whitespace after comma | fixed indentation to match original format | VentureCraft_revisionable | train | php |
7af71e0b1ece0768297f59794c64db4f0b1a22d2 | diff --git a/pymatgen/io/exciting/tests/test_inputs.py b/pymatgen/io/exciting/tests/test_inputs.py
index <HASH>..<HASH> 100644
--- a/pymatgen/io/exciting/tests/test_inputs.py
+++ b/pymatgen/io/exciting/tests/test_inputs.py
@@ -117,7 +117,7 @@ class ExcitingInputTest(PymatgenTest):
'BSE': {'bsetype': 'singlet', 'nstlbse': '1 5 1 4'}}}
test_input = ExcitingInput(struct)
- test_string = test_input.write_string('unchanged', paramdict=paradir)
+ test_string = test_input.write_string('unchanged', **paradir)
# read reference file
filepath = os.path.join(test_dir, 'input_exciting2.xml') | Update test with new paramdict kwarg format | materialsproject_pymatgen | train | py |
e4009b3eae56d38dd51a1cac1ee01433754e46a6 | diff --git a/lib/Boris/ShallowParser.php b/lib/Boris/ShallowParser.php
index <HASH>..<HASH> 100644
--- a/lib/Boris/ShallowParser.php
+++ b/lib/Boris/ShallowParser.php
@@ -207,7 +207,7 @@ class Boris_ShallowParser {
}
private function _prepareDebugStmt($input) {
- if ($this->_isReturnable($input) && !preg_match('/\s*return/i', $input)) {
+ if ($this->_isReturnable($input) && !preg_match('/^\s*return/i', $input)) {
$input = sprintf('return %s', $input);
} | Fix issue with regex for return statements | borisrepl_boris | train | php |
21f359bff9457f00c4e650e91cd6a7176ab3db7f | diff --git a/cake/libs/view/helpers/form.php b/cake/libs/view/helpers/form.php
index <HASH>..<HASH> 100644
--- a/cake/libs/view/helpers/form.php
+++ b/cake/libs/view/helpers/form.php
@@ -260,7 +260,7 @@ class FormHelper extends AppHelper {
0 => $id
);
if (!empty($options['action']) && !isset($options['id'])) {
- $options['id'] = $this->domId(Inflector::camelize($options['action']) . 'Form');
+ $options['id'] = $this->domId($options['action'] . 'Form');
}
$options['action'] = array_merge($actionDefaults, (array)$options['url']);
} elseif (is_string($options['url'])) { | Removing additional call to camelize(). Fixes #<I> | cakephp_cakephp | train | php |
46c88e56366d9527892b4c8f1b6d2342f41728b6 | diff --git a/cloudant-http/src/main/java/com/cloudant/http/internal/interceptors/CookieInterceptorBase.java b/cloudant-http/src/main/java/com/cloudant/http/internal/interceptors/CookieInterceptorBase.java
index <HASH>..<HASH> 100644
--- a/cloudant-http/src/main/java/com/cloudant/http/internal/interceptors/CookieInterceptorBase.java
+++ b/cloudant-http/src/main/java/com/cloudant/http/internal/interceptors/CookieInterceptorBase.java
@@ -30,7 +30,6 @@ import java.net.MalformedURLException;
import java.net.URISyntaxException;
import java.net.URL;
import java.util.List;
-import java.util.Locale;
import java.util.Map;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.logging.Level;
@@ -54,6 +53,8 @@ public abstract class CookieInterceptorBase implements HttpConnectionRequestInte
CookieInterceptorBase(String sessionRequestMimeType, String baseUrl, String endpoint) {
this.sessionRequestMimeType = sessionRequestMimeType;
try {
+ baseUrl = baseUrl.endsWith("/") ? baseUrl.substring(0, baseUrl.length()-1): baseUrl;
+ endpoint = endpoint.startsWith("/") ? endpoint : "/" + endpoint;
this.sessionURL = new URL(String.format("%s%s", baseUrl, endpoint));
} catch (MalformedURLException e) {
// this should be a valid URL since the builder is passing it in | Added handling for baseUrl vs endpoint / | cloudant_java-cloudant | train | java |
47cde71c78560dc0ab80b244b568fe675e76db67 | diff --git a/lib/finder.rb b/lib/finder.rb
index <HASH>..<HASH> 100644
--- a/lib/finder.rb
+++ b/lib/finder.rb
@@ -70,11 +70,9 @@ module ActiveScaffold
def self.condition_for_datetime_column(column, value, like_pattern)
conversion = value['from']['hour'].blank? && value['to']['hour'].blank? ? 'to_date' : 'to_time'
- ['from', 'to'].each do |field|
- value[field] = ['year', 'month', 'day', 'hour', 'minutes', 'seconds'].collect {|part| value[field][part].to_i}
+ from_value, to_value = ['from', 'to'].collect do |field|
+ Time.zone.local(*['year', 'month', 'day', 'hour', 'minutes', 'seconds'].collect {|part| value[field][part].to_i}) rescue nil
end
- from_value = Time.zone.local(*value['from']) rescue nil
- to_value = Time.zone.local(*value['to']) rescue nil
if from_value.nil? and to_value.nil?
nil | Fix FieldSearch without javascript, date parameters were broken after redirect | activescaffold_active_scaffold | train | rb |
ba24625808af823a78c578445202158c512ff246 | diff --git a/spec/mvcli/router_spec.rb b/spec/mvcli/router_spec.rb
index <HASH>..<HASH> 100644
--- a/spec/mvcli/router_spec.rb
+++ b/spec/mvcli/router_spec.rb
@@ -14,6 +14,10 @@ describe "MVCLI::Router" do
end
end
+ def invoke(route = '')
+ router.call mock(:Command, :argv => route.split(/\s+/))
+ end
+
context "without any routes" do
When(:result) {invoke}
Then {result.should have_failed self.Router::RoutingError}
@@ -53,8 +57,4 @@ describe "MVCLI::Router" do
When { invoke "--help me" }
Then { @action == 'help#me' }
end
-
- def invoke(route = '')
- router.call mock(:Command, :argv => route.split(/\s+/))
- end
end | out of sight, out of mind is not a good thing in code.
thanks @marcusmateus! | cowboyd_mvcli | train | rb |
407225056f5a98478b4051a94ad79a8284650dd4 | diff --git a/treeherder/client/thclient/client.py b/treeherder/client/thclient/client.py
index <HASH>..<HASH> 100644
--- a/treeherder/client/thclient/client.py
+++ b/treeherder/client/thclient/client.py
@@ -8,6 +8,9 @@ import requests
import logging
import json
+# When releasing a new version to PyPI please also file a bug to request
+# that it is uploaded to http://pypi.pub.build.mozilla.org/pub/ too.
+# See bug 1191498 for an example of this.
__version__ = '1.6.0'
logger = logging.getLogger(__name__) | Python Client: Add a comment about uploading to the internal PyPI mirror | mozilla_treeherder | train | py |
d6886fe6ddf348b2196c952e8a631da7b0616333 | diff --git a/src/js/select2/i18n/ru.js b/src/js/select2/i18n/ru.js
index <HASH>..<HASH> 100644
--- a/src/js/select2/i18n/ru.js
+++ b/src/js/select2/i18n/ru.js
@@ -14,6 +14,9 @@ define(function () {
}
return {
+ errorLoading: function () {
+ return 'Невозможно загрузить результаты';
+ },
inputTooLong: function (args) {
var overChars = args.input.length - args.maximum; | added translation for errorLoading | select2_select2 | train | js |
113301b6a7edca36b72a21427cbbf610e0ea2aec | diff --git a/library/src/main/java/com/balysv/materialripple/MaterialRippleLayout.java b/library/src/main/java/com/balysv/materialripple/MaterialRippleLayout.java
index <HASH>..<HASH> 100644
--- a/library/src/main/java/com/balysv/materialripple/MaterialRippleLayout.java
+++ b/library/src/main/java/com/balysv/materialripple/MaterialRippleLayout.java
@@ -537,6 +537,10 @@ public class MaterialRippleLayout extends FrameLayout {
ViewGroup parent = (ViewGroup) child.getParent();
int index = 0;
+ if (parent != null && parent instanceof MaterialRippleLayout) {
+ throw new IllegalStateException("MaterialRippleLayout could not be created: parent of the view already is a MaterialRippleLayout");
+ }
+
if (parent != null) {
index = parent.indexOfChild(child);
parent.removeView(child); | Do not allow stacking MaterialRippleLayouts
Contributed by @joaogouveia | balysv_material-ripple | train | java |
6d60e401e5bdf61fa2ef6f2f23bb736beb8a83c8 | diff --git a/invenio_files_rest/models.py b/invenio_files_rest/models.py
index <HASH>..<HASH> 100644
--- a/invenio_files_rest/models.py
+++ b/invenio_files_rest/models.py
@@ -278,7 +278,7 @@ class Location(db.Model, Timestamp):
"""Validate name."""
if not slug_pattern.match(name) or len(name) > 20:
raise ValueError(
- 'Invalid location name (lower-case alphanumeric + danshes).')
+ 'Invalid location name (lower-case alphanumeric + dashes).')
return name
@classmethod | typo: danshes -> dashes | inveniosoftware_invenio-files-rest | train | py |
1355df47a04e558319faef5d2e280177554678ea | diff --git a/src/Models/Repository/SubscriptionTypesMetaRepository.php b/src/Models/Repository/SubscriptionTypesMetaRepository.php
index <HASH>..<HASH> 100644
--- a/src/Models/Repository/SubscriptionTypesMetaRepository.php
+++ b/src/Models/Repository/SubscriptionTypesMetaRepository.php
@@ -30,7 +30,7 @@ class SubscriptionTypesMetaRepository extends Repository
final public function getMeta(IRow $subscriptionType, string $key): Selection
{
- return $this->getTable()->where(['subscription_type_id' => $subscriptionType->id, 'key' => $key]);
+ return $subscriptionType->related('subscription_types_meta')->where(['key' => $key]);
}
final public function subscriptionTypeMeta(IRow $subscriptionType): array | Correctly utilize Nette's magic of related() method | remp2020_crm-subscriptions-module | train | php |
0bf353179a0c2e68e2c2cf800ab5bf1be7a65cae | diff --git a/modules/pulsestorm/magento2/cli/magento2/generate/ui/grid/module.php b/modules/pulsestorm/magento2/cli/magento2/generate/ui/grid/module.php
index <HASH>..<HASH> 100644
--- a/modules/pulsestorm/magento2/cli/magento2/generate/ui/grid/module.php
+++ b/modules/pulsestorm/magento2/cli/magento2/generate/ui/grid/module.php
@@ -124,7 +124,7 @@ function generateListingToolbar($xml)
$listingToolbar = $xml->addChild('listingToolbar');
$listingToolbar->addAttribute('name', 'listing_top');
- $settings = $xml->addChild('settings');
+ $settings = $listingToolbar->addChild('settings');
$settings->addChild('sticky', 'true');
$paging = $listingToolbar->addChild('paging'); | Fix settings error in ui component | astorm_pestle | train | php |
01ebdc9d4448bc973c9aae42d73c3c4d2c0cb71e | diff --git a/angr/analyses/disassembly.py b/angr/analyses/disassembly.py
index <HASH>..<HASH> 100644
--- a/angr/analyses/disassembly.py
+++ b/angr/analyses/disassembly.py
@@ -268,10 +268,6 @@ class Instruction(DisassemblyPiece):
else:
in_word = True
pieces.append(c)
- elif c == '%':
- in_word = False
- pieces.append('%%')
-
else:
in_word = False
pieces.append(c) | Fix %% register prefix (#<I>)
When register names start with %, split_op_string() replaces % with %%,
which then leaks into the UI. I could not find a place where this is
used as a format string, so it appears superfluous. | angr_angr | train | py |
f5c7aa09415953d356e533cbf3f195e0475276ad | diff --git a/src/Riak/Node/Config.php b/src/Riak/Node/Config.php
index <HASH>..<HASH> 100644
--- a/src/Riak/Node/Config.php
+++ b/src/Riak/Node/Config.php
@@ -87,11 +87,12 @@ class Config
protected $connection_timeout = 10;
/**
- * Client side stream (socket read/write) timeout
+ * Client side stream (socket read/write) timeout. Default is 60
+ * seconds as that is the default operation timeout in Riak
*
* @var int
*/
- protected $stream_timeout = 5;
+ protected $stream_timeout = 60;
/**
* @return int | Increase stream timeout to <I> seconds to match Riak default. | basho_riak-php-client | train | php |
fb961a19777074daef058e852c1b4f50b5c805e8 | diff --git a/notify/notification_hms.go b/notify/notification_hms.go
index <HASH>..<HASH> 100644
--- a/notify/notification_hms.go
+++ b/notify/notification_hms.go
@@ -123,7 +123,7 @@ func GetHuaweiNotification(req *PushNotification) (*model.MessageRequest, error)
}
setDefaultAndroidNotification := func() {
- if msgRequest.Message.Android == nil {
+ if msgRequest.Message.Android.Notification == nil {
msgRequest.Message.Android.Notification = model.GetDefaultAndroidNotification()
}
} | Fix Huawei issue on nil pointer dereference (#<I>) | appleboy_gorush | train | go |
dce1b4db2de7f4d302164dacb593fcab351135a6 | diff --git a/lib/fasterer/cli.rb b/lib/fasterer/cli.rb
index <HASH>..<HASH> 100644
--- a/lib/fasterer/cli.rb
+++ b/lib/fasterer/cli.rb
@@ -5,6 +5,7 @@ module Fasterer
def self.execute
file_traverser = Fasterer::FileTraverser.new('.')
file_traverser.traverse
+ abort if file_traverser.offenses_found?
end
end
end
diff --git a/lib/fasterer/file_traverser.rb b/lib/fasterer/file_traverser.rb
index <HASH>..<HASH> 100644
--- a/lib/fasterer/file_traverser.rb
+++ b/lib/fasterer/file_traverser.rb
@@ -43,9 +43,14 @@ module Fasterer
end
end
+ def offenses_found?
+ !!offenses_found
+ end
+
private
attr_reader :parse_error_paths
+ attr_accessor :offenses_found
def nil_config_file
{ SPEEDUPS_KEY => {}, EXCLUDE_PATHS_KEY => [] }
@@ -57,7 +62,10 @@ module Fasterer
rescue RubyParser::SyntaxError, Racc::ParseError, Timeout::Error
parse_error_paths.push(path)
else
- output(analyzer) if offenses_grouped_by_type(analyzer).any?
+ if offenses_grouped_by_type(analyzer).any?
+ output(analyzer)
+ self.offenses_found = true
+ end
end
def scannable_files | Abort if the file traverser found an offense
By exiting the application with a nonzero status when an offense is
found, fasterer can be integrated into continuous integration to prevent slow
code from being committed. | DamirSvrtan_fasterer | train | rb,rb |
15e5ff33c15bb4c3fc46a52d65fe903b79e2fbfd | diff --git a/src/loader/loadingscreen.js b/src/loader/loadingscreen.js
index <HASH>..<HASH> 100644
--- a/src/loader/loadingscreen.js
+++ b/src/loader/loadingscreen.js
@@ -128,7 +128,7 @@
// call when the loader is resetted
onResetEvent : function () {
// background color
- me.game.world.addChild(new me.ColorLayer("background", "#202020", 0));
+ me.game.world.addChild(new me.ColorLayer("background", "#202020", 0), 0);
// progress bar
var progressBar = new ProgressBar( | [#<I>] Fix loading screen while debug panel is enabled
- This was caused by the container auto-sorting after the debug panel is added to the scene graph.
- Fixed it by forcing the object-z position to use zero instead of auto-increment | melonjs_melonJS | train | js |
7c69acb6b77b9b281c4ada1383bcdbee1e2f8649 | diff --git a/artist/plot.py b/artist/plot.py
index <HASH>..<HASH> 100644
--- a/artist/plot.py
+++ b/artist/plot.py
@@ -561,16 +561,29 @@ class SubPlot(object):
y = lower + upper
self.shaded_regions_list.append({'data': zip(x, y), 'color': color})
- def draw_image(self, image, xmin, ymin, xmax, ymax):
+ def draw_image(self, image, xmin=0, ymin=0, xmax=None, ymax=None):
"""Draw an image.
Do not forget to use :meth:`set_axis_equal` to preserve the
- aspect ratio of the image.
+ aspect ratio of the image, or change the aspect ratio of the
+ plot to the aspect ratio of the image.
- :param image: Pillow Image.
+ :param image: Pillow Image object.
:param xmin,ymin,xmax,ymax: the x, y image bounds.
+ Example::
+
+ >>> from PIL import Image
+ >>> image = Image.open('background.png')
+ >>> height_ratio = (.67 * image.size[1]) / image.size[0]
+ >>> plot = artist.Plot(height=r'%.2f\linewidth' % height_ratio)
+ >>> plot.draw_image(image)
+
"""
+ if xmax is None:
+ xmax = xmin + image.size[0]
+ if ymax is None:
+ ymax = ymin + image.size[1]
self.bitmap_list.append({'image': image,
'xmin': xmin,
'xmax': xmax, | Improve draw_image
Add example and defaults for x, y bounds. | davidfokkema_artist | train | py |
6e297a8c5d2c692acfc662c479eee2f56f1fdab3 | diff --git a/index.js b/index.js
index <HASH>..<HASH> 100644
--- a/index.js
+++ b/index.js
@@ -5,6 +5,28 @@ var loaderUtils = require('loader-utils');
var path = require('path');
var _ = require('lodash');
+function matches (oldRef, newRef) {
+ return _(oldRef).split(':').first() === _(newRef).split(':').first();
+}
+
+/**
+ * Merge new references with old references; ignore old references from the same file.
+ */
+function mergeReferences (oldRefs, newRefs) {
+ var _newRefs = _(newRefs);
+
+ return _(oldRefs)
+ .reject(function (oldRef) {
+ return _newRefs.any(function (newRef) {
+ return matches(oldRef, newRef);
+ });
+ })
+ .concat(newRefs)
+ .uniq()
+ .sort()
+ .value();
+}
+
module.exports = function (source) {
this.cacheable();
@@ -46,7 +68,7 @@ module.exports = function (source) {
if (existing) {
existing.comments = _.uniq(existing.comments.concat(item.comments)).sort();
- existing.references = _.uniq(existing.references.concat(item.references)).sort();
+ existing.references = mergeReferences(item.references, existing.references);
} else {
extractor.strings[item.msgid][context] = item;
} | Automagically kill old references from the same file. | wombleton_angular-gettext-extract-loader | train | js |
9fd9ad3fbbc2bc75fd05c8da258573267424cfd0 | diff --git a/core/server/helpers/utils.js b/core/server/helpers/utils.js
index <HASH>..<HASH> 100644
--- a/core/server/helpers/utils.js
+++ b/core/server/helpers/utils.js
@@ -9,6 +9,9 @@ const _ = require('lodash');
* with extra diacritics character matching.
**/
module.exports.wordCount = function wordCount(html) {
+ if (!html) {
+ return 0;
+ }
html = html.replace(/<(.|\n)*?>/g, ' '); // strip tags
const pattern = /[a-zA-ZÀ-ÿ0-9_\u0392-\u03c9\u0410-\u04F9]+|[\u4E00-\u9FFF\u3400-\u4dbf\uf900-\ufaff\u3040-\u309f\uac00-\ud7af]+/g;
@@ -34,7 +37,7 @@ module.exports.wordCount = function wordCount(html) {
* @description Takes an HTML string and returns the number of images
**/
module.exports.imageCount = function wordCount(html) {
- return (html.match(/<img(.|\n)*?>/g) || []).length;
+ return html ? (html.match(/<img(.|\n)*?>/g) || []).length : 0;
};
module.exports.findKey = function findKey(key /* ...objects... */) { | 🐛 Returned 0 for word/image count when html is null
refs #<I> | TryGhost_Ghost | train | js |
170f3a63b9ab397b8b1aa5ba3f777b2009c80f24 | diff --git a/ansible_runner/interface.py b/ansible_runner/interface.py
index <HASH>..<HASH> 100644
--- a/ansible_runner/interface.py
+++ b/ansible_runner/interface.py
@@ -93,9 +93,8 @@ def init_runner(**kwargs):
event_callback_handler = kwargs.pop('event_handler', None)
status_callback_handler = kwargs.pop('status_handler', None)
artifacts_handler = kwargs.pop('artifacts_handler', None)
- if kwargs.get('cancel_callback'):
- cancel_callback = kwargs.pop('cancel_callback')
- else:
+ cancel_callback = kwargs.pop('cancel_callback', None)
+ if cancel_callback is None:
# attempt to load signal handler. will return None and
# issue warning if we are not in the main thread
cancel_callback = signal_handler() | pop cancel_callback, set to sig. handler if needed | ansible_ansible-runner | train | py |
042cb0539bbf55706467eb624f93c5722c193d66 | diff --git a/src/Bulletin.php b/src/Bulletin.php
index <HASH>..<HASH> 100644
--- a/src/Bulletin.php
+++ b/src/Bulletin.php
@@ -234,15 +234,17 @@ class Bulletin extends AbstractModel
$bulletin = (new BulletinFeedback([
'bulletin' => $this,
'receiver' => $member
- ]))->save();
+ ]));
app()->dispatch(new MessageNeedsToBeSent(
- $member->getEmail(),
+ $member,
$this->getTitle(),
'有一条关于您的新通知 [ ' . $this->getTitle() . ' ]' . "\n"
. $this->getAbstract() . "\n\n"
. '详情请登录系统查阅' . "\n"
. env('BASE_URL') . '/bulletin/' . $this->getId() . '/view?token=' . $bulletin->getId()
));
+ // make sure the mail sent out, then save to db
+ $bulletin->save();
}
$this->draft(false)->save();
return $this; | upgrade with core (change to receivers to array of Member); save feedback after sending email | teamelf_ext-bulletin | train | php |
98293a4397801fab1186f750ddc693cb3989bc3b | diff --git a/code/libraries/koowa/libraries/controller/view.php b/code/libraries/koowa/libraries/controller/view.php
index <HASH>..<HASH> 100644
--- a/code/libraries/koowa/libraries/controller/view.php
+++ b/code/libraries/koowa/libraries/controller/view.php
@@ -110,6 +110,7 @@ abstract class KControllerView extends KControllerAbstract implements KControlle
//Create the view
$config = array(
+ 'url' => KRequest::url(),
'model' => $this->getModel(),
'auto_assign' => $this instanceof KControllerModellable
); | re #<I> Pass current URL to view. | joomlatools_joomlatools-framework | train | php |
8ec608644d8b39816503acab4b1bbfc21dfea306 | diff --git a/spec/integration/configurer_spec.rb b/spec/integration/configurer_spec.rb
index <HASH>..<HASH> 100755
--- a/spec/integration/configurer_spec.rb
+++ b/spec/integration/configurer_spec.rb
@@ -57,7 +57,9 @@ describe Puppet::Configurer do
@configurer.run :catalog => @catalog, :report => report
t2 = Time.now.tv_sec
- File.stat(Puppet[:lastrunfile]).mode.to_s(8).should == "100666"
+ file_mode = Puppet.features.microsoft_windows? ? '100644' : '100666'
+
+ File.stat(Puppet[:lastrunfile]).mode.to_s(8).should == file_mode
summary = nil
File.open(Puppet[:lastrunfile], "r") do |fd| | Account for Windows file mode translation for lastrunfile
Windows file modes do not directly translate to POSIX file modes, so
we can't use the same file mode on Windows to check that setting the
mode worked correctly. | puppetlabs_puppet | train | rb |
7b12f7d53e8941dbdc4cb50dbe2dae3818f392d1 | diff --git a/icekit/project/settings/_base.py b/icekit/project/settings/_base.py
index <HASH>..<HASH> 100644
--- a/icekit/project/settings/_base.py
+++ b/icekit/project/settings/_base.py
@@ -705,7 +705,7 @@ INSTALLED_APPS += (
'icekit.plugins.links',
'icekit.plugins.map',
'icekit.plugins.map_with_text',
- 'icekit.plugins.oembed_with_caption.apps.OEmbedWithCaptionAppConfig',
+ 'icekit.plugins.oembed_with_caption',
# Replaces 'icekit.plugins.oembed_with_caption',
# Includes fix for https://github.com/django-fluent/django-fluent-contents/issues/65 | fix oembed installed app | ic-labs_django-icekit | train | py |
2d38a47dac7b856c7b29a7908a811a6a8d001078 | diff --git a/wfe/wfe.go b/wfe/wfe.go
index <HASH>..<HASH> 100644
--- a/wfe/wfe.go
+++ b/wfe/wfe.go
@@ -602,7 +602,11 @@ func (wfe *WebFrontEndImpl) sendError(response http.ResponseWriter, logEvent *re
// Only audit log internal errors so users cannot purposefully cause
// auditable events.
if prob.Type == probs.ServerInternalProblem {
- wfe.log.AuditErr(fmt.Sprintf("Internal error - %s - %s", prob.Detail, ierr))
+ if ierr != nil {
+ wfe.log.AuditErr(fmt.Sprintf("Internal error - %s - %s", prob.Detail, ierr))
+ } else {
+ wfe.log.AuditErr(fmt.Sprintf("Internal error - %s", prob.Detail))
+ }
}
problemDoc, err := marshalIndent(prob) | Don't print %!s(nil) when ierr is nil. (#<I>)
Sometimes sendError gets a nil argument for ierr (internal error). When this
happens we print a line like:
[AUDIT] Internal error - Failed to get registration by key - %!s(<nil>)
This is fine but distracting, since it looks like a logging bug.
Instead, print a shorter message with just the external-facing problem. | letsencrypt_boulder | train | go |
e5b1031772695be5bf20e1fc3eabe31092def0df | diff --git a/foolbox/ext/native/attacks/basic_iterative_method.py b/foolbox/ext/native/attacks/basic_iterative_method.py
index <HASH>..<HASH> 100644
--- a/foolbox/ext/native/attacks/basic_iterative_method.py
+++ b/foolbox/ext/native/attacks/basic_iterative_method.py
@@ -35,7 +35,14 @@ class L2BasicIterativeAttack:
self.model = model
def __call__(
- self, inputs, labels, *, rescale=True, epsilon=0.3, step_size=0.05, num_steps=10
+ self,
+ inputs,
+ labels,
+ *,
+ rescale=False,
+ epsilon=0.3,
+ step_size=0.05,
+ num_steps=10,
):
if rescale:
min_, max_ = self.model.bounds()
@@ -67,7 +74,14 @@ class LinfinityBasicIterativeAttack:
self.model = model
def __call__(
- self, inputs, labels, *, rescale=True, epsilon=0.3, step_size=0.05, num_steps=10
+ self,
+ inputs,
+ labels,
+ *,
+ rescale=False,
+ epsilon=0.3,
+ step_size=0.05,
+ num_steps=10,
):
if rescale:
min_, max_ = self.model.bounds() | rescale = False by default | bethgelab_foolbox | train | py |
695a9b56738e6ab00498fac8ba8de1e14f161a94 | diff --git a/structr/structr-rest/src/main/java/org/structr/rest/resource/TypeResource.java b/structr/structr-rest/src/main/java/org/structr/rest/resource/TypeResource.java
index <HASH>..<HASH> 100644
--- a/structr/structr-rest/src/main/java/org/structr/rest/resource/TypeResource.java
+++ b/structr/structr-rest/src/main/java/org/structr/rest/resource/TypeResource.java
@@ -274,10 +274,10 @@ public class TypeResource extends SortableResource {
}
- checkForIllegalSearchKeys(searchableProperties);
-
if (searchableProperties != null) {
+ checkForIllegalSearchKeys(searchableProperties);
+
for (String key : searchableProperties) {
String searchValue = request.getParameter(key); | added np check for searchable properties | structr_structr | train | java |
b30cd1f8fe090669af31e569c5ace38844147ffc | diff --git a/Annis-Service/src/main/java/annis/dao/GraphExtractor.java b/Annis-Service/src/main/java/annis/dao/GraphExtractor.java
index <HASH>..<HASH> 100644
--- a/Annis-Service/src/main/java/annis/dao/GraphExtractor.java
+++ b/Annis-Service/src/main/java/annis/dao/GraphExtractor.java
@@ -36,9 +36,7 @@ import java.util.Map;
import java.util.Properties;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.Validate;
-import org.apache.log4j.Level;
import org.apache.log4j.Logger;
-import org.apache.log4j.Priority;
import org.springframework.dao.DataAccessException;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.ResultSetExtractor;
@@ -54,7 +52,6 @@ public class GraphExtractor implements ResultSetExtractor
public enum IslandPolicies
{
context,
- number,
none
} | - removing "number" until it is clear howto implement this | korpling_ANNIS | train | java |
c072ea186d59cb55474a870747a6fac17be72d29 | diff --git a/remote.go b/remote.go
index <HASH>..<HASH> 100644
--- a/remote.go
+++ b/remote.go
@@ -193,6 +193,17 @@ func (wd *remoteWD) execute(method, url string, data []byte) ([]byte, error) {
}
buf, err := ioutil.ReadAll(response.Body)
+
+ // Are we in debug mode, and did we read the response Body successfully?
+ if debugFlag && err == nil {
+ // Pretty print the JSON response
+ prettyBuf := bytes.NewBufferString("")
+ err = json.Indent(prettyBuf, buf, "", " ")
+ if prettyBuf.Len() > 0 {
+ buf = prettyBuf.Bytes()
+ }
+ }
+
debugLog("<- %s [%s]\n%s",
response.Status, response.Header["Content-Type"], buf)
if err != nil { | Added pretty printing of json responses. | tebeka_selenium | train | go |
7da5833c957ccfb52c82fe6073476c81c7e88b87 | diff --git a/register.js b/register.js
index <HASH>..<HASH> 100644
--- a/register.js
+++ b/register.js
@@ -24,6 +24,20 @@ var options = {
}
};
+function configTransform (transforms, enabled) {
+ options.transforms = options.transforms || {};
+ transforms.forEach(function (transform) {
+ options.transforms[transform.trim()] = enabled;
+ });
+}
+
+if (process.env.BUBLE_OPTION_YES) {
+ configTransform(process.env.BUBLE_OPTION_YES.split(','), true);
+}
+if (process.env.BUBLE_OPTION_NO) {
+ configTransform(process.env.BUBLE_OPTION_NO.split(','), false);
+}
+
function mkdirp ( dir ) {
var parent = path.dirname( dir );
if ( dir === parent ) return;
@@ -38,7 +52,7 @@ function mkdirp ( dir ) {
var home = homedir();
if ( home ) {
- var cachedir = path.join( home, '.buble-cache', nodeVersion );
+ var cachedir = path.join( home, '.buble-cache', '' + nodeVersion );
mkdirp( cachedir );
fs.writeFileSync( path.join( home, '.buble-cache/README.txt' ), 'These files enable a faster startup when using buble/register. You can safely delete this folder at any time. See https://buble.surge.sh/guide/ for more information.' );
} | Fix path.join error in Node <I>; added support for enabling/disabling transforms via env variables | bublejs_buble | train | js |
52005606a87bfca03407f70f3bc552668f2893d2 | diff --git a/py/testdir_multi_jvm/test_KMeans_params_rand2.py b/py/testdir_multi_jvm/test_KMeans_params_rand2.py
index <HASH>..<HASH> 100644
--- a/py/testdir_multi_jvm/test_KMeans_params_rand2.py
+++ b/py/testdir_multi_jvm/test_KMeans_params_rand2.py
@@ -9,7 +9,7 @@ import h2o_kmeans, h2o_import as h2i
def define_params():
print "Restricting epsilon to 1e-6 and up. Too slow otherwise and no stopping condition?"
paramDict = {
- 'k': [2, 12],
+ 'k': [2, 5], # seems two slow tih 12 clusters if all cols
'epsilon': [1e-6, 1e-2, 1, 10],
'cols': [None, "0", "3", "0,1,2,3,4,5,6"],
} | reduce max k to 5 (takes too long with <I> and all cols) | h2oai_h2o-2 | train | py |
300993e4dff3f695025f1aa4999a2d5b08ddca33 | diff --git a/navigation/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/navigation/NavigationConstants.java b/navigation/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/navigation/NavigationConstants.java
index <HASH>..<HASH> 100644
--- a/navigation/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/navigation/NavigationConstants.java
+++ b/navigation/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/navigation/NavigationConstants.java
@@ -36,7 +36,7 @@ public class NavigationConstants {
* Maximum number of meters the user can travel away from step before the
* {@link OffRouteListener}'s called.
*/
- static final double MAXIMUM_DISTANCE_BEFORE_OFF_ROUTE = 50;
+ static final double MAXIMUM_DISTANCE_BEFORE_OFF_ROUTE = 20;
/**
* Seconds used before a reroute occurs. | Reduce Reroute Threshold (#<I>) | mapbox_mapbox-navigation-android | train | java |
49167082d655d07141622bced1f8ac98bf9f5904 | diff --git a/spec/flipper/ui/actions/feature_spec.rb b/spec/flipper/ui/actions/feature_spec.rb
index <HASH>..<HASH> 100644
--- a/spec/flipper/ui/actions/feature_spec.rb
+++ b/spec/flipper/ui/actions/feature_spec.rb
@@ -31,10 +31,13 @@ RSpec.describe Flipper::UI::Actions::Feature do
context 'when feature_removal_enabled is set to false' do
around do |example|
- @original_feature_removal_enabled = Flipper::UI.feature_removal_enabled
- Flipper::UI.feature_removal_enabled = false
- example.run
- Flipper::UI.feature_removal_enabled = @original_feature_removal_enabled
+ begin
+ @original_feature_removal_enabled = Flipper::UI.feature_removal_enabled
+ Flipper::UI.feature_removal_enabled = false
+ example.run
+ ensure
+ Flipper::UI.feature_removal_enabled = @original_feature_removal_enabled
+ end
end
it 'returns with 403 status' do | Ensure that default config is reset regardless of what happens in example.run | jnunemaker_flipper | train | rb |
988475b12e82db5b2711e3dead9bd0154398e7bf | diff --git a/src/com/esotericsoftware/kryo/Kryo.java b/src/com/esotericsoftware/kryo/Kryo.java
index <HASH>..<HASH> 100644
--- a/src/com/esotericsoftware/kryo/Kryo.java
+++ b/src/com/esotericsoftware/kryo/Kryo.java
@@ -723,8 +723,8 @@ public class Kryo {
}
}
- /** Returns true if null or a reference to a previously read object was read. In this case, the object is stored in
- * {@link #readObject}. Returns false if the object was not a reference and needs to be read. */
+ /** Returns {@link #REF} if a reference to a previously read object was read, which is stored in {@link #readObject}. Returns a
+ * stack size > 0 if a reference ID has been put on the stack. */
int readReferenceOrNull (Input input, Class type, boolean mayBeNull) {
if (type.isPrimitive()) type = getWrapperClass(type);
boolean referencesSupported = referenceResolver.useReferences(type);
@@ -738,12 +738,12 @@ public class Kryo {
}
if (!referencesSupported) {
readReferenceIds.add(NO_REF);
- return NO_REF;
+ return readReferenceIds.size;
}
} else {
if (!referencesSupported) {
readReferenceIds.add(NO_REF);
- return NO_REF;
+ return readReferenceIds.size;
}
id = input.readInt(true);
} | Fixed references. Ermahgerhd! | EsotericSoftware_kryo | train | java |
e96a47cdde95757a19efaec06093bf8d53b70627 | diff --git a/webpack.config.js b/webpack.config.js
index <HASH>..<HASH> 100644
--- a/webpack.config.js
+++ b/webpack.config.js
@@ -23,6 +23,7 @@ if (args[0] === '-p') {
output = {
path: dirDist,
filename: 'all.min.js',
+ libraryTarget: 'umd',
};
plugins = [
new webpack.optimize.DedupePlugin(), | feat(lib): Export public API as UMD | jonathanweiss_sk-progress-circle | train | js |
0e4af546d06a5e7dcbdcb0f25d3727fbbbb9281b | diff --git a/module/index.js b/module/index.js
index <HASH>..<HASH> 100644
--- a/module/index.js
+++ b/module/index.js
@@ -61,7 +61,8 @@ Generator.prototype.moduleTest = function moduleTest() {
var testFW = this.bbb.testFramework;
var specFolder = (testFW === "jasmine") ? "spec" : "tests";
- var dest = path.join("test", testFW, specFolder, this.moduleName + ".js");
+ var ext = (testFW === "jasmine") ? ".spec.js" : ".js";
+ var dest = path.join("test", testFW, specFolder, this.moduleName + ext);
var srcText = this.src.read("test." + testFW + ".js");
var script = _.template(srcText)({ | Add '.spec.js' as Jasmine test extension to match the FW style | backbone-boilerplate_generator-bbb | train | js |
b172337e851275c73e07bde5935c8b69b03f6e51 | diff --git a/lib/bud/lattice-lib.rb b/lib/bud/lattice-lib.rb
index <HASH>..<HASH> 100644
--- a/lib/bud/lattice-lib.rb
+++ b/lib/bud/lattice-lib.rb
@@ -1,5 +1,10 @@
require 'bud/lattice-core'
+# Float::INFINITY only defined in MRI 1.9.2+
+unless defined? Float::INFINITY
+ Float::INFINITY = 1.0/0.0
+end
+
class Bud::MaxLattice < Bud::Lattice
wrapper_name :lmax | Restore MRI <I> compatibility.
Define Float::INFINITY manually if needed, since it is only defined starting
with MRI <I> | bloom-lang_bud | train | rb |
bd8e4b2bae4587f3959cc2cc3607bffa25c66a9e | diff --git a/lib/api.js b/lib/api.js
index <HASH>..<HASH> 100755
--- a/lib/api.js
+++ b/lib/api.js
@@ -1,5 +1,5 @@
var Resource = require('./resource'),
- sys = require('sys'),
+ util = require('util'),
fs = require('fs'),
capitalize = require('./helpers').capitalize,
underscore = require('underscore'),
diff --git a/lib/request.js b/lib/request.js
index <HASH>..<HASH> 100755
--- a/lib/request.js
+++ b/lib/request.js
@@ -1,6 +1,5 @@
var http = require('http'),
querystring = require('querystring'),
- sys = require('sys'),
underscore = require('underscore'),
helpers = require('./helpers'),
oauthHelper = require('./oauth-helper'), | Remove unneeded dependency on deprecated sys module | 7digital_7digital-api | train | js,js |
4ebe4e1abec32bf47c0a9079c072c42c9f36d305 | diff --git a/pkg/adaptor/mongodb/mongodb.go b/pkg/adaptor/mongodb/mongodb.go
index <HASH>..<HASH> 100644
--- a/pkg/adaptor/mongodb/mongodb.go
+++ b/pkg/adaptor/mongodb/mongodb.go
@@ -366,7 +366,7 @@ func (m *MongoDB) catData() (err error) {
}
// set up the message
- msg := message.MustUseAdaptor("mongodb").From(ops.Insert, m.computeNamespace(collection), result)
+ msg := message.MustUseAdaptor("mongo").From(ops.Insert, m.computeNamespace(collection), result)
m.pipe.Send(msg)
result = bson.M{}
@@ -437,7 +437,7 @@ func (m *MongoDB) tailData() (err error) {
continue
}
- msg := message.MustUseAdaptor("mongodb").From(ops.OpTypeFromString(result.Op), m.computeNamespace(coll), doc).(*mongodb.MongoMessage)
+ msg := message.MustUseAdaptor("mongo").From(ops.OpTypeFromString(result.Op), m.computeNamespace(coll), doc).(*mongodb.MongoMessage)
msg.TS = int64(result.Ts) >> 32
m.oplogTime = result.Ts | use mongo in adaptor naming | compose_transporter | train | go |
Subsets and Splits
Java Commits in Train Set
Queries for all entries where the diff_languages column is 'java', providing a filtered dataset but without deeper analysis.
Java Commits Test Data
Returns a subset of 5000 entries from the dataset where the programming language difference is Java, providing basic filtering for exploration.
Java Commits Sample
Retrieves the first 1,000 records where the 'diff_languages' column is 'java', providing limited insight into the specific data entries.
Java Commits Validation Sample
Retrieves a sample of entries from the validation dataset where the diff languages are Java, providing limited insight into specific Java-related data points.
Java Commits in Validation
This query retrieves a limited sample of entries from the validation dataset where the programming language difference is Java, providing basic filtering with minimal insight.
Java Commits Sample
This query retrieves a sample of 100 records where the 'diff_languages' is 'java', providing basic filtering but limited analytical value.
Java Commits Sample
Retrieves 100 samples where the language difference is Java, providing basic filtering but minimal analytical value.
Java Commits Sample
Retrieves 10 samples where the diff_languages column is 'java', providing basic examples of data entries with this specific language.
Java Commits Validation Sample
Retrieves 1,000 records where the differences in languages are marked as Java, providing a snapshot of that specific subset but limited to raw data.
Java Commits Sample
This query retrieves 1000 random samples from the dataset where the programming language is Java, offering limited insight beyond raw data.