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 |
|---|---|---|---|---|---|
851f102b30992a5d0b6992346dfc04ce19b8afc9 | diff --git a/charmhelpers/contrib/templating/jinja.py b/charmhelpers/contrib/templating/jinja.py
index <HASH>..<HASH> 100644
--- a/charmhelpers/contrib/templating/jinja.py
+++ b/charmhelpers/contrib/templating/jinja.py
@@ -3,7 +3,6 @@ Templating using the python-jinja2 package.
"""
from charmhelpers.fetch import (
apt_install,
- filter_installed_packages
)
@@ -13,7 +12,7 @@ DEFAULT_TEMPLATES_DIR = 'templates'
try:
import jinja2
except ImportError:
- apt_install(filter_installed_packages(["python-jinja2"]))
+ apt_install(["python-jinja2"])
import jinja2 | Removed useless filtering of installed packages. | juju_charm-helpers | train | py |
f9c95f1dbcc1a61090c7277efb59553dad139f1c | diff --git a/index.js b/index.js
index <HASH>..<HASH> 100644
--- a/index.js
+++ b/index.js
@@ -195,24 +195,24 @@ function onmessage (e) {
var params = requests[id];
delete requests[id];
- var res = data[0];
+ var body = data[0];
var statusCode = data[1];
var headers = data[2];
debug('got %s status code for URL: %s', statusCode, params.path);
- if (res && headers) {
- res._headers = headers;
+ if (body && headers) {
+ body._headers = headers;
}
if (null == statusCode || 2 === Math.floor(statusCode / 100)) {
// 2xx status code, success
- params.resolve(res);
+ params.resolve(body);
} else {
// any other status code is a failure
var err = new Error();
err.statusCode = statusCode;
- for (var i in res) err[i] = res[i];
- if (res.error) err.name = toTitle(res.error) + 'Error';
+ for (var i in body) err[i] = body[i];
+ if (body.error) err.name = toTitle(body.error) + 'Error';
params.reject(err);
} | index: rename `res` variable to `body`
Matches the `wpcom-xhr-request` logic is the only reason :p | Automattic_wpcom-proxy-request | train | js |
67233e39847429b880602eb4ebd56320bc4f8e2f | diff --git a/lib/arel/engines/sql/compilers/sqlserver_compiler.rb b/lib/arel/engines/sql/compilers/sqlserver_compiler.rb
index <HASH>..<HASH> 100644
--- a/lib/arel/engines/sql/compilers/sqlserver_compiler.rb
+++ b/lib/arel/engines/sql/compilers/sqlserver_compiler.rb
@@ -50,7 +50,7 @@ module Arel
end
def single_distinct_select?
- relation.select_clauses.size == 1 && relation.select_clauses.first.include?('DISTINCT')
+ relation.select_clauses.size == 1 && relation.select_clauses.first.to_s.include?('DISTINCT')
end
def all_select_clauses_aliased? | [Rails3] Account for symbols passed to :select option. | rails-sqlserver_activerecord-sqlserver-adapter | train | rb |
f272987fa37b260f26521c238092e0a66b24143a | diff --git a/core/pyauto/core/__init__.py b/core/pyauto/core/__init__.py
index <HASH>..<HASH> 100644
--- a/core/pyauto/core/__init__.py
+++ b/core/pyauto/core/__init__.py
@@ -1 +1 @@
-__version__ = '0.1.4'
+__version__ = '0.1.5a1' | version core-<I>a1 | adamjaso_pyauto | train | py |
0c4a107dcca0b8d22d7404e71a89355845c6ffc1 | diff --git a/tasklib/serializing.py b/tasklib/serializing.py
index <HASH>..<HASH> 100644
--- a/tasklib/serializing.py
+++ b/tasklib/serializing.py
@@ -1,4 +1,5 @@
import datetime
+import importlib
import json
import pytz
import six
@@ -164,6 +165,8 @@ class SerializingObject(object):
return serialized_annotations if serialized_annotations else ''
def deserialize_annotations(self, data):
+ task_module = importlib.import_module('tasklib.task')
+ TaskAnnotation = getattr(task_module, 'TaskAnnotation')
return [TaskAnnotation(self, d) for d in data] if data else []
def serialize_tags(self, tags): | SerializingObject: Fetch TaskAnnotation class dynamically | robgolding_tasklib | train | py |
00c4b26fd20a2ce439ea7538ccf112fa5226b60b | diff --git a/frontend/lib/mno_enterprise/frontend/engine.rb b/frontend/lib/mno_enterprise/frontend/engine.rb
index <HASH>..<HASH> 100644
--- a/frontend/lib/mno_enterprise/frontend/engine.rb
+++ b/frontend/lib/mno_enterprise/frontend/engine.rb
@@ -11,10 +11,10 @@ module MnoEnterprise
# I18n management
# Internally rewrite /en/dashboard/#/apps to /dashboard/#/apps
- if MnoEnterprise.i18n_enabled && (Rails.env.development? || Rails.env.test?)
- require 'rack-rewrite'
+ initializer "mnoe.middleware" do |app|
+ if MnoEnterprise.i18n_enabled && (Rails.env.development? || Rails.env.test?)
+ require 'rack-rewrite'
- initializer "mnoe.middleware" do |app|
app.middleware.insert_before(0, Rack::Rewrite) do
rewrite %r{/[a-z]{2}/dashboard/(.*)}, '/dashboard/$1'
end | [i<I>n] Fix frontend routing in dev | maestrano_mno-enterprise | train | rb |
72501d5426363b040e3410d2bb3497ca561a9f1b | diff --git a/example/myapp/middleware/core.io-auth/protocols/basic.js b/example/myapp/middleware/core.io-auth/protocols/basic.js
index <HASH>..<HASH> 100644
--- a/example/myapp/middleware/core.io-auth/protocols/basic.js
+++ b/example/myapp/middleware/core.io-auth/protocols/basic.js
@@ -0,0 +1,13 @@
+/*jshint esversion:6, node:true*/
+'use strict';
+
+const localProtocol = require('./local');
+
+module.exports = function(passport, config){
+
+ return function $basic(req, identifier, password, next){
+ config.logger.info('Using basic auth strategy for user %s', identifier);
+
+ return localProtocol.login(req, identifier, password, next);
+ };
+}; | core.io-auth: adding basic protocol imp; | goliatone_core.io-express-server | train | js |
e898906eab3764a2b9189323427515ce2449384e | diff --git a/lib/parslet/source/line_cache.rb b/lib/parslet/source/line_cache.rb
index <HASH>..<HASH> 100644
--- a/lib/parslet/source/line_cache.rb
+++ b/lib/parslet/source/line_cache.rb
@@ -70,7 +70,6 @@ class Parslet::Source
left = 0
right = size - 1
- n = 10
loop do
mid = left + (right - left) / 2
@@ -87,4 +86,4 @@ class Parslet::Source
end
end
end
-end
\ No newline at end of file
+end | Remove useless unused variable in lbound in line_cache.rb | kschiess_parslet | train | rb |
92886dbf14114faee09a013b549bc800c953fd12 | diff --git a/scanpy/plotting/_baseplot_class.py b/scanpy/plotting/_baseplot_class.py
index <HASH>..<HASH> 100644
--- a/scanpy/plotting/_baseplot_class.py
+++ b/scanpy/plotting/_baseplot_class.py
@@ -505,10 +505,14 @@ class BasePlot(object):
"""
cmap = pl.get_cmap(self.cmap)
+
import matplotlib.colorbar
+ from matplotlib.cm import ScalarMappable
+
+ mappable = ScalarMappable(norm=normalize, cmap=cmap)
matplotlib.colorbar.Colorbar(
- color_legend_ax, orientation='horizontal', cmap=cmap, norm=normalize
+ color_legend_ax, mappable=mappable, orientation='horizontal'
)
color_legend_ax.set_title(self.color_legend_title, fontsize='small') | fix mappable error for older mpl (#<I>) | theislab_scanpy | train | py |
f10e1471764bac9b1b564b95f83ffd4085308199 | diff --git a/regxform.rb b/regxform.rb
index <HASH>..<HASH> 100644
--- a/regxform.rb
+++ b/regxform.rb
@@ -50,6 +50,7 @@ module Reg
end
def formula_value(other,session)
+ warn "warning: BoundRef #{inspect} value missing" if !session.has_key?(name) and session["final"]
session.fetch(name,session["final"] ? nil : self)
end
end | warn about missing BoundRef value at final resolve time | coatl_reg | train | rb |
13aec608e6a20c1292de139298130dfb5b76dc2a | diff --git a/lib/serf/command.rb b/lib/serf/command.rb
index <HASH>..<HASH> 100644
--- a/lib/serf/command.rb
+++ b/lib/serf/command.rb
@@ -20,6 +20,7 @@ module Serf
include Serf::Util::WithOptionsExtraction
attr_reader :request
+ attr_reader :args
def initialize(request, *args)
extract_options! args | Add attr_reader for args in Command.
Details:
* We have the reader for the set request, but we also want it for
the remaining args. | byu_serf | train | rb |
2772d3e79d66925cf4adeaffd8be610f0ab177b6 | diff --git a/src/transformers/models/auto/tokenization_auto.py b/src/transformers/models/auto/tokenization_auto.py
index <HASH>..<HASH> 100644
--- a/src/transformers/models/auto/tokenization_auto.py
+++ b/src/transformers/models/auto/tokenization_auto.py
@@ -199,6 +199,13 @@ else:
"MBart50TokenizerFast" if is_tokenizers_available() else None,
),
),
+ (
+ "rembert",
+ (
+ "RemBertTokenizer" if is_sentencepiece_available() else None,
+ "RemBertTokenizerFast" if is_tokenizers_available() else None,
+ ),
+ ),
]
) | Add RemBert to AutoTokenizer (#<I>) | huggingface_pytorch-pretrained-BERT | train | py |
ae1b7595f090a481deb0f6b85c04d356c49d5b04 | diff --git a/pebble/pool/base_pool.py b/pebble/pool/base_pool.py
index <HASH>..<HASH> 100644
--- a/pebble/pool/base_pool.py
+++ b/pebble/pool/base_pool.py
@@ -95,8 +95,9 @@ class BasePool(object):
raise RuntimeError('The Pool is not active')
def _update_pool_state(self):
- if self._context.state == CREATED:
- self._start_pool()
+ with self._context.state_mutex:
+ if self._context.state == CREATED:
+ self._start_pool()
for loop in self._loops:
if not loop.is_alive():
@@ -112,7 +113,7 @@ class BasePool(object):
class PoolContext(object):
def __init__(self, max_workers, max_tasks, initializer, initargs):
self._state = CREATED
- self._state_mutex = RLock()
+ self.state_mutex = RLock()
self.task_queue = Queue()
self.workers = max_workers
@@ -125,7 +126,7 @@ class PoolContext(object):
@state.setter
def state(self, state):
- with self._state_mutex:
+ with self.state_mutex:
if self.alive:
self._state = state | issue #<I>: make pool start thread safe
If a `pool` is used for the first time in a multi-threading context,
several threads might start the same `pool` seriously corrupting its
internal mechanisms. | noxdafox_pebble | train | py |
d8d30911359d7cc1b20a82ca1279d770beee6e98 | diff --git a/classes/fields/file.php b/classes/fields/file.php
index <HASH>..<HASH> 100644
--- a/classes/fields/file.php
+++ b/classes/fields/file.php
@@ -562,7 +562,7 @@ class PodsField_File extends PodsField {
$data[] = array(
'id' => esc_html( $id ),
'icon' => esc_attr( $icon ),
- 'name' => esc_html( $title ),
+ 'name' => html_entity_decode( esc_html( $title ) ),
'edit_link' => esc_url( $edit_link ),
'link' => esc_url( $link ),
'download' => esc_url( $download ),
diff --git a/classes/fields/pick.php b/classes/fields/pick.php
index <HASH>..<HASH> 100644
--- a/classes/fields/pick.php
+++ b/classes/fields/pick.php
@@ -1388,7 +1388,7 @@ class PodsField_Pick extends PodsField {
$item = array(
'id' => esc_html( $item_id ),
'icon' => esc_attr( $icon ),
- 'name' => esc_html( $item_title ),
+ 'name' => html_entity_decode( esc_html( $item_title ) ),
'edit_link' => esc_url( $edit_link ),
'link' => esc_url( $link ),
'selected' => $selected, | Decode html entities for DFV fields. | pods-framework_pods | train | php,php |
4b47493e4d08bb13f3a4f9032f29417b214652c6 | diff --git a/Controller/ImagineController.php b/Controller/ImagineController.php
index <HASH>..<HASH> 100644
--- a/Controller/ImagineController.php
+++ b/Controller/ImagineController.php
@@ -77,7 +77,7 @@ class ImagineController
*
* @return Response
*/
- public function filter($path, $filter)
+ public function filterAction($path, $filter)
{
$path = '/'.ltrim($path, '/');
diff --git a/Routing/ImagineLoader.php b/Routing/ImagineLoader.php
index <HASH>..<HASH> 100644
--- a/Routing/ImagineLoader.php
+++ b/Routing/ImagineLoader.php
@@ -26,7 +26,7 @@ class ImagineLoader extends Loader
public function load($resource, $type = null)
{
$requirements = array('_method' => 'GET', 'filter' => '[A-z0-9_\-]*', 'path' => '.+');
- $defaults = array('_controller' => 'imagine.controller:filter');
+ $defaults = array('_controller' => 'imagine.controller:filterAction');
$routes = new RouteCollection();
if (count($this->filters) > 0) { | renamed filter() to filterAction() | liip_LiipImagineBundle | train | php,php |
3c01258c19db565d2ae012e15befe080284cf4e6 | diff --git a/lib/flapjack/executive.rb b/lib/flapjack/executive.rb
index <HASH>..<HASH> 100644
--- a/lib/flapjack/executive.rb
+++ b/lib/flapjack/executive.rb
@@ -24,7 +24,6 @@ module Flapjack
def initialize(options={})
@options = options
@persistence = ::Redis.new
- @events = Flapjack::Events.new
@log = Log4r::Logger.new("executive")
@log.add(Log4r::StdoutOutputter.new("executive"))
@@ -120,7 +119,7 @@ module Flapjack
# Process any events we have until there's none left
def process_events
loop do
- event = @events.next(:block => false)
+ event = Event.next(:block => false)
break unless event
process_event(event)
end
@@ -219,7 +218,7 @@ module Flapjack
end
def process_event(event)
- @log.debug("#{@events.size} events waiting on the queue")
+ @log.debug("#{Event.pending_count} events waiting on the queue")
@log.debug("Raw event received: #{event.inspect}")
@log.info("Processing Event: #{event.id}, #{event.type}, #{event.state}, #{event.summary}")
@@ -246,7 +245,7 @@ module Flapjack
@log.info("Booting main loop.")
loop do
@log.info("Waiting for event...")
- event = @events.next
+ event = Event.next
process_result(event)
end
end | Use the new class methods for getting events, and querying the queue | flapjack_flapjack | train | rb |
a05f4744cb6ed9851e5bb943e65d83898b9ce45e | diff --git a/src/Psalm/IssueBuffer.php b/src/Psalm/IssueBuffer.php
index <HASH>..<HASH> 100644
--- a/src/Psalm/IssueBuffer.php
+++ b/src/Psalm/IssueBuffer.php
@@ -178,6 +178,10 @@ class IssueBuffer
return false;
}
+ if ($project_analyzer->getCodebase()->taint && $issue_type !== 'TaintedInput') {
+ return false;
+ }
+
$reporting_level = $config->getReportingLevelForIssue($e);
if ($reporting_level === Config::REPORT_SUPPRESS) { | Only show taint issues when tracking tainted input | vimeo_psalm | train | php |
1035a2062237f9bd9a64f2c3ba50026a918fd8d0 | diff --git a/ext/nio4r/org/nio4r/Nio4r.java b/ext/nio4r/org/nio4r/Nio4r.java
index <HASH>..<HASH> 100644
--- a/ext/nio4r/org/nio4r/Nio4r.java
+++ b/ext/nio4r/org/nio4r/Nio4r.java
@@ -173,6 +173,29 @@ public class Nio4r implements Library {
return monitor;
}
+ @JRubyMethod(name = "registered?")
+ public IRubyObject isRegistered(ThreadContext context, IRubyObject io) {
+ Ruby runtime = context.getRuntime();
+ Channel raw_channel = ((RubyIO)io).getChannel();
+
+ if(!(raw_channel instanceof SelectableChannel)) {
+ throw runtime.newArgumentError("not a selectable IO object");
+ }
+
+ SelectableChannel channel = (SelectableChannel)raw_channel;
+ SelectionKey key = channel.keyFor(selector);
+
+ if(key == null)
+ return context.nil;
+
+
+ if(((Monitor)key.attachment()).isClosed(context) == runtime.getTrue()) {
+ return runtime.getFalse();
+ } else {
+ return runtime.getTrue();
+ }
+ }
+
@JRubyMethod
public synchronized IRubyObject select(ThreadContext context) {
return select(context, context.nil); | Java NIO::Selector#registered? | socketry_nio4r | train | java |
d7a959e7006cee879e44ab0199f1474eb1ed4011 | diff --git a/skyfield/constants.py b/skyfield/constants.py
index <HASH>..<HASH> 100644
--- a/skyfield/constants.py
+++ b/skyfield/constants.py
@@ -1,7 +1,5 @@
"""Various constants required by Skyfield."""
-from numpy import array
-
# Definitions.
AU_M = 149597870700 # per IAU 2012 Resolution B2
AU_KM = 149597870.700 | Removed unused "import" | skyfielders_python-skyfield | train | py |
a7d46307c7a44f5d03c738b1ce2d607ff56d73d4 | diff --git a/param/ipython.py b/param/ipython.py
index <HASH>..<HASH> 100644
--- a/param/ipython.py
+++ b/param/ipython.py
@@ -265,8 +265,7 @@ class ParamPager(object):
heading_text = 'Parameter docstrings:'
heading_string = "%s\n%s" % (heading_text, '=' * len(heading_text))
docstring_heading = (green % heading_string)
- page.page("%s\n\n%s\n\n%s\n\n%s" % (top_heading, table,
- docstring_heading, docstrings))
+ return "%s\n\n%s\n\n%s\n\n%s" % (top_heading, table, docstring_heading, docstrings)
@@ -301,7 +300,7 @@ class ParamMagics(Magics):
print("Object %r not found in the namespace." % parameter_s)
return
- return self.param_pager(obj.obj)
+ page.page(self.param_pager(obj.obj))
message = """Welcome to the param IPython extension! (http://ioam.github.io/param/)""" | Minor change to IPython extension to enable testing | pyviz_param | train | py |
43c12905fbdb553b2e22689faeade4793b4e0806 | diff --git a/src/Patch/Constraints.php b/src/Patch/Constraints.php
index <HASH>..<HASH> 100644
--- a/src/Patch/Constraints.php
+++ b/src/Patch/Constraints.php
@@ -37,12 +37,12 @@ class Constraints
$extra = $this->composer->getPackage()->getExtra();
if (isset($extra['excluded-patches'])) {
- foreach ($extra['excluded-patches'] as $patchOwner => $patches) {
+ foreach ($extra['excluded-patches'] as $patchOwner => $patchPaths) {
if (!isset($excludedPatches[$patchOwner])) {
$excludedPatches[$patchOwner] = array();
}
- $excludedPatches[$patchOwner] = array_flip($patches);
+ $excludedPatches[$patchOwner] = array_flip($patchPaths);
}
}
@@ -63,7 +63,10 @@ class Constraints
}
}
- if (isset($excludedPatches[$patchData['owner']][$patchData['source']])) {
+ $owner = $patchData['owner'];
+ $source = $patchData['source'];
+
+ if (isset($excludedPatches[$owner][$source])) {
$patchData = false;
}
} | Bugfix to patch exclusion where the loop that collects the exclusion was using same variable name as the main constraints applied code a moment later | vaimo_composer-patches | train | php |
c3a8e5b77a5344c0fb0eb9e981d079c2ca573621 | diff --git a/pymola/ast.py b/pymola/ast.py
index <HASH>..<HASH> 100644
--- a/pymola/ast.py
+++ b/pymola/ast.py
@@ -257,7 +257,7 @@ Symbol.ast_spec = {
'outer': Field([bool], False),
'dimensions': FieldList([int], [1]),
'comment': Field([str], ''),
- 'start': Field([Primary], Primary(value=0)),
+ 'start': Field([Primary, ComponentRef], Primary(value=0)),
'id': Field([int], 0),
'order': Field([int], 0),
} | Allow ComponentRefs as start attributes | pymoca_pymoca | train | py |
198f4015e4c14b0b1c94a9db0ad6ccb48d39ae19 | diff --git a/allauth/account/views.py b/allauth/account/views.py
index <HASH>..<HASH> 100644
--- a/allauth/account/views.py
+++ b/allauth/account/views.py
@@ -55,7 +55,7 @@ class RedirectAuthenticatedUserMixin(object):
if request.user.is_authenticated():
redirect_to = self.get_authenticated_redirect_url()
response = HttpResponseRedirect(redirect_to)
- return response
+ return _ajax_response(request, response)
else:
response = super(RedirectAuthenticatedUserMixin,
self).dispatch(request, | RedirectAuthenticatedUserMixin now handles ajax request correctly when user is authenticated | pennersr_django-allauth | train | py |
131e0491f4a5254af5f07a3bbb26370785c079d7 | diff --git a/seaglass/trunk/seaglass/src/main/java/com/seaglasslookandfeel/state/ScrollBarButtonsTogetherState.java b/seaglass/trunk/seaglass/src/main/java/com/seaglasslookandfeel/state/ScrollBarButtonsTogetherState.java
index <HASH>..<HASH> 100644
--- a/seaglass/trunk/seaglass/src/main/java/com/seaglasslookandfeel/state/ScrollBarButtonsTogetherState.java
+++ b/seaglass/trunk/seaglass/src/main/java/com/seaglasslookandfeel/state/ScrollBarButtonsTogetherState.java
@@ -20,6 +20,7 @@
package com.seaglasslookandfeel.state;
import javax.swing.JComponent;
+import javax.swing.UIManager;
/**
* Are scroll bar buttons to be placed together or apart?
@@ -30,9 +31,11 @@ public class ScrollBarButtonsTogetherState extends State {
}
public boolean isInState(JComponent c) {
- if (false) {
- return true;
+ Object clientProperty = c.getClientProperty("SeaGlass.Override.ScrollBarButtonsTogether");
+ if (clientProperty != null && clientProperty instanceof Boolean) {
+ return (Boolean) clientProperty;
}
- return false;
+
+ return UIManager.getBoolean("SeaGlass.ScrollBarButtonsTogether");
}
} | Set "buttons together" state from client property for override, otherwise from global UI property. | khuxtable_seaglass | train | java |
b3ce38f88360d00256a590f9eff984e97c562997 | diff --git a/tests/Mandango/Tests/ConnectionTest.php b/tests/Mandango/Tests/ConnectionTest.php
index <HASH>..<HASH> 100644
--- a/tests/Mandango/Tests/ConnectionTest.php
+++ b/tests/Mandango/Tests/ConnectionTest.php
@@ -23,11 +23,9 @@ class ConnectionTest extends TestCase
$mongoDB = $connection->getMongoDB();
if ( class_exists('MongoClient') ) {
- $this->assertNotInstanceOf('\Mongo', $mongo);
$this->assertInstanceOf('\MongoClient', $mongo);
} else {
$this->assertInstanceOf('\Mongo', $mongo);
- $this->assertNotInstanceOf('\MongoClient', $mongo);
}
$this->assertInstanceOf('\MongoDB', $mongoDB); | Added LoggableMongoClient | mongator_mongator | train | php |
6628cd1a8d321a5a126694ad34a813111300f46e | diff --git a/lib/bugsnag/code_extractor.rb b/lib/bugsnag/code_extractor.rb
index <HASH>..<HASH> 100644
--- a/lib/bugsnag/code_extractor.rb
+++ b/lib/bugsnag/code_extractor.rb
@@ -2,8 +2,11 @@ module Bugsnag
class CodeExtractor
MAXIMUM_LINES_TO_KEEP = 7
- def initialize
+ ##
+ # @param [Configuration] configuration
+ def initialize(configuration)
@files = {}
+ @configuration = configuration
end
##
diff --git a/lib/bugsnag/stacktrace.rb b/lib/bugsnag/stacktrace.rb
index <HASH>..<HASH> 100644
--- a/lib/bugsnag/stacktrace.rb
+++ b/lib/bugsnag/stacktrace.rb
@@ -17,7 +17,7 @@ module Bugsnag
#
# rubocop:todo Metrics/CyclomaticComplexity
def self.process(backtrace, configuration)
- code_extractor = CodeExtractor.new
+ code_extractor = CodeExtractor.new(configuration)
backtrace = caller if !backtrace || backtrace.empty? | Give CodeExtractor access to configuration | bugsnag_bugsnag-ruby | train | rb,rb |
ffeea9bed19d179ef8ed05304e8eb601981d7ae2 | diff --git a/tests/Collector/RouterCollectorTest.php b/tests/Collector/RouterCollectorTest.php
index <HASH>..<HASH> 100644
--- a/tests/Collector/RouterCollectorTest.php
+++ b/tests/Collector/RouterCollectorTest.php
@@ -9,6 +9,9 @@ use Awesomite\Chariot\LinkInterface;
use Awesomite\Chariot\Pattern\PatternRouter;
use Awesomite\Chariot\TestBase;
+/**
+ * @internal
+ */
class RouterCollectorTest extends TestBase
{
public function testAll()
diff --git a/tests/Reflections/ObjectsTest.php b/tests/Reflections/ObjectsTest.php
index <HASH>..<HASH> 100644
--- a/tests/Reflections/ObjectsTest.php
+++ b/tests/Reflections/ObjectsTest.php
@@ -4,6 +4,9 @@ namespace Awesomite\Chariot\Reflections;
use Awesomite\Chariot\TestBase;
+/**
+ * @internal
+ */
class ObjectsTest extends TestBase
{
public function testGetProperty() | Added missing "internal" tags | awesomite_chariot | train | php,php |
f555499dd4cf4895c1909e6a44c17db7da6a7e6e | diff --git a/HistogramPanel.py b/HistogramPanel.py
index <HASH>..<HASH> 100644
--- a/HistogramPanel.py
+++ b/HistogramPanel.py
@@ -235,22 +235,21 @@ class HistogramPanel(Panel.Panel):
self.stats_column1_label = self.ui.create_label_widget()
self.stats_column2_label = self.ui.create_label_widget()
self.stats_column1.add(self.stats_column1_label)
- self.stats_column1.add_stretch()
self.stats_column2.add(self.stats_column2_label)
- self.stats_column2.add_stretch()
- stats_section = self.ui.create_row_widget(properties={"spacing": 6})
+ stats_section = self.ui.create_row_widget()
stats_section.add_spacing(13)
stats_section.add(self.stats_column1)
stats_section.add_stretch()
stats_section.add(self.stats_column2)
stats_section.add_spacing(13)
- column = self.ui.create_column_widget(properties={"min-height": 18 * 3, "max-height": 18 * 3})
+ column = self.ui.create_column_widget(properties={"height": 80 + 18 * 3})
column.add(self.root_canvas_item.canvas_widget)
column.add_spacing(6)
column.add(stats_section)
column.add_spacing(6)
+ column.add_stretch()
self.widget = column | Improve sizing of histogram panel.
svn r<I> | nion-software_nionswift | train | py |
048b8ca4d0a01a1dc53c91bf3360a856937426b7 | diff --git a/backtrader/brokers/bbroker.py b/backtrader/brokers/bbroker.py
index <HASH>..<HASH> 100644
--- a/backtrader/brokers/bbroker.py
+++ b/backtrader/brokers/bbroker.py
@@ -694,6 +694,17 @@ class BackBroker(bt.BrokerBase):
if self.p.checksubmit:
self.check_submitted()
+ # Discount any cash for positions hold
+ credit = 0.0
+ for data, pos in self.positions.items():
+ if pos:
+ comminfo = self.getcommissioninfo(data)
+ dt0 = data.datetime.datetime()
+ credit += comminfo.get_credit_interest(data, pos, dt0)
+ pos.datetime = dt0 # mark last credit operation
+
+ self.cash -= credit
+
# Iterate once over all elements of the pending queue
for i in range(len(self.pending)): | Add calculation of credit interest rate. Addresses #<I> | backtrader_backtrader | train | py |
80075fbc9b33288fb908561ed5d2fcb14fd64437 | diff --git a/v1/workflow.go b/v1/workflow.go
index <HASH>..<HASH> 100644
--- a/v1/workflow.go
+++ b/v1/workflow.go
@@ -60,7 +60,9 @@ func NewGroup(tasks ...*signatures.TaskSignature) *Group {
// Auto generate task UUIDs
// Group tasks by common UUID
for _, task := range tasks {
- task.UUID = fmt.Sprintf("task_%v", uuid.New())
+ if task.UUID == "" {
+ task.UUID = fmt.Sprintf("task_%v", uuid.New())
+ }
task.GroupUUID = groupUUID
task.GroupTaskCount = len(tasks)
} | Keep the existing task UUID if included in a group | RichardKnop_machinery | train | go |
3893e7b0529ba87deaacd388958204a6e7d22069 | diff --git a/javascript/GridFieldSortableRows.js b/javascript/GridFieldSortableRows.js
index <HASH>..<HASH> 100644
--- a/javascript/GridFieldSortableRows.js
+++ b/javascript/GridFieldSortableRows.js
@@ -29,6 +29,7 @@
},
start: function(event, ui) {
pageArrows.show();
+ pageArrows.redraw();
pageArrows.startMoveTracking();
},
stop: function(event, ui) { | Redraw is now called when sorting starts | UndefinedOffset_SortableGridField | train | js |
c26452b2321b49300e5a5d880f1c14a398662365 | diff --git a/railties/lib/rails/code_statistics.rb b/railties/lib/rails/code_statistics.rb
index <HASH>..<HASH> 100644
--- a/railties/lib/rails/code_statistics.rb
+++ b/railties/lib/rails/code_statistics.rb
@@ -7,7 +7,8 @@ class CodeStatistics #:nodoc:
"Model tests",
"Mailer tests",
"Job tests",
- "Integration tests"]
+ "Integration tests",
+ "System tests"]
HEADERS = { lines: " Lines", code_lines: " LOC", classes: "Classes", methods: "Methods" } | Make code statistics task handle system tests properly
If it is not added to `TEST_TYPES`, it is not regarded as a test
when counting the total count. | rails_rails | train | rb |
632a40445de101de7852f45976c3c8d6733c0b40 | diff --git a/memberlist.go b/memberlist.go
index <HASH>..<HASH> 100644
--- a/memberlist.go
+++ b/memberlist.go
@@ -261,9 +261,9 @@ func (m *Memberlist) setAlive() error {
// Members is used to return a list of all known live nodes
func (m *Memberlist) Members() []*Node {
- nodes := make([]*Node, 0, len(m.nodes))
m.nodeLock.RLock()
defer m.nodeLock.RUnlock()
+ nodes := make([]*Node, 0, len(m.nodes))
for _, n := range m.nodes {
if n.State != stateDead {
nodes = append(nodes, &n.Node) | Move the make() into the RLock, because we're reading the len() | hashicorp_memberlist | train | go |
51e1287ef3e02db2a0294f5130c0abaa7bdd1387 | diff --git a/test/qha/test_QHA_Si.py b/test/qha/test_QHA_Si.py
index <HASH>..<HASH> 100644
--- a/test/qha/test_QHA_Si.py
+++ b/test/qha/test_QHA_Si.py
@@ -103,7 +103,7 @@ def test_QHA_Si():
np.testing.assert_allclose(
np.array(phonopy_qha.heat_capacity_P_numerical)[t_indices],
cp_temperature,
- atol=1e-5)
+ atol=1e-4)
# Cp vs temperature by polynomial fittings of Cv and S
np.testing.assert_allclose( | Loosen tolerance of a QHA test | atztogo_phonopy | train | py |
0dd81d7b9bb7bd9fdce5c3f05e5976a0dfd97e89 | diff --git a/bitcoin/tools.py b/bitcoin/tools.py
index <HASH>..<HASH> 100644
--- a/bitcoin/tools.py
+++ b/bitcoin/tools.py
@@ -16,6 +16,7 @@ __all__ = [
'compress_amount',
'decompress_amount',
'target_from_compact',
+ 'compact_from_target',
'icmp',
]
@@ -87,8 +88,31 @@ def decompress_amount(x):
# ===----------------------------------------------------------------------===
def target_from_compact(bits):
- len_ = (bits >> 24) & 0xff
- return (bits & 0xffffffL) << (8 * (len_ - 3))
+ size = bits >> 24
+ word = bits & 0x007fffff
+ if size < 3:
+ word >>= 8 * (3 - size)
+ else:
+ word <<= 8 * (size - 3)
+ if bits & 0x00800000:
+ word = -word
+ return word
+
+from .serialize import serialize_beint
+def compact_from_target(target):
+ bn = serialize_beint(target)
+ size = len(bn)
+ if size <= 3:
+ word = target << 8 * (3 - size)
+ else:
+ word = target >> 8 * (size - 3)
+ if word & 0x00800000:
+ word >>= 8
+ size += 1
+ word |= size << 24
+ if target < 0:
+ word |= 0x00800000
+ return word
# ===----------------------------------------------------------------------=== | Add translation from target to compact, and add support for sign bit. | maaku_python-bitcoin | train | py |
65604803789a547d1a26f99e2c51a7b2ae4a0f00 | diff --git a/src/components/laser-controls.js b/src/components/laser-controls.js
index <HASH>..<HASH> 100644
--- a/src/components/laser-controls.js
+++ b/src/components/laser-controls.js
@@ -71,12 +71,12 @@ registerComponent('laser-controls', {
},
'gearvr-controls': {
- cursor: {downEvents: ['trackpaddown', 'triggerdown'], upEvents: ['trackpadup', 'triggerup']},
+ cursor: {downEvents: ['triggerdown'], upEvents: ['triggerup']},
raycaster: {origin: {x: 0, y: 0.0005, z: 0}}
},
'oculus-go-controls': {
- cursor: {downEvents: ['trackpaddown', 'triggerdown'], upEvents: ['trackpadup', 'triggerup']},
+ cursor: {downEvents: ['triggerdown'], upEvents: ['triggerup']},
raycaster: {origin: {x: 0, y: 0.0005, z: 0}}
}, | Remove trackpaddown event from the downEvents to not monopolize all buttons on GearVR and Oculus Go and make it consistent with other controllers | aframevr_aframe | train | js |
1c334a3d7d6d6b83e90f0dd842254c4d05176a3d | diff --git a/src/build/buildApp.js b/src/build/buildApp.js
index <HASH>..<HASH> 100644
--- a/src/build/buildApp.js
+++ b/src/build/buildApp.js
@@ -37,6 +37,11 @@ function buildApp(src, dest, options, callback) {
}
function maybeCopyScripts(srcs, dest) {
+ if (!srcs) {
+ return new Promise(resolve => {
+ resolve();
+ });
+ }
const promises = srcs.map(src => {
return new Promise((resolve, reject) => {
if (!fs.existsSync(src)) { | Fix bug when no injection scripts is passed | jiahaog_nativefier | train | js |
74a9e8d12ce08dada186418eee67856d16542b36 | diff --git a/lib/unobtrusive_flash.rb b/lib/unobtrusive_flash.rb
index <HASH>..<HASH> 100644
--- a/lib/unobtrusive_flash.rb
+++ b/lib/unobtrusive_flash.rb
@@ -12,7 +12,7 @@ module UnobtrusiveFlash
end
cookie_flash += flash.to_a
- cookies['flash'] = {:value => cookie_flash.to_json, :domain => ".#{request.host.split('.')[-2,2].join('.')}"}
+ cookies['flash'] = {:value => cookie_flash.to_json, :domain => '.' << request.domain}
flash.discard
end
end | Fix #1 localhost causing nil exception.
Use Rails method for finding domain. It will be more accurate if user
sets up the tld_length correctly in Rails. | leonid-shevtsov_unobtrusive_flash | train | rb |
582d7aed230ee027d389f0d920ebabde1018618e | diff --git a/src/Drupal/Driver/DrushDriver.php b/src/Drupal/Driver/DrushDriver.php
index <HASH>..<HASH> 100644
--- a/src/Drupal/Driver/DrushDriver.php
+++ b/src/Drupal/Driver/DrushDriver.php
@@ -80,8 +80,8 @@ class DrushDriver implements DriverInterface {
*/
public function userAddRole(\stdClass $user, $role) {
$arguments = array(
- $user->name,
- $role,
+ sprintf('"%s"', $role),
+ $user->name
);
$this->drush('user-add-role', $arguments);
} | Issue #<I> by raspberryman: Fixed DrushDriver.php unable to assign roles. | jhedstrom_DrupalDriver | train | php |
2cd06fb100368ba7e4c711158db5a671f2daa54c | diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -1,7 +1,6 @@
#!/usr/bin/env python
from setuptools import setup, find_packages
-import glob
import re
@@ -43,6 +42,6 @@ setup(
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
- # 'Programming Language :: Python :: 3.7',
+ 'Programming Language :: Python :: 3.7',
],
) | removed mpi4py which pip fails to install well | dereneaton_ipyrad | train | py |
0431c980f241f401cda85511c84a5a480aca1d4f | diff --git a/Gruntfile.js b/Gruntfile.js
index <HASH>..<HASH> 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -64,9 +64,7 @@ module.exports = function (grunt) {
all : ["test/**/*.js"]
},
jshint: {
- all: ["Gruntfile.js", "moment.js", "lang/**/*.js"],
- test: ["test/moment/*.js"],
- langtest: ["test/lang/*.js"],
+ all: ["Gruntfile.js", "moment.js", "lang/**/*.js", "test/**/*.js"],
options: {
"node" : true,
"browser" : true, | Move all jshint files to all target | moment_moment | train | js |
c3b0c65c64cde1f92329d61b65615d95aa6c6f9d | diff --git a/src/request.js b/src/request.js
index <HASH>..<HASH> 100644
--- a/src/request.js
+++ b/src/request.js
@@ -116,7 +116,7 @@ const request = ({
method,
path,
query,
- data = {},
+ data,
authOptions,
signKey = true,
}) => {
@@ -160,7 +160,7 @@ const _request = (
className,
objectId,
method,
- data = {},
+ data,
authOptions,
query
) => { | fix: keep the undefined `data` for AV.request
cocos2d-x-lite throws if we send {} | leancloud_javascript-sdk | train | js |
1f085a0e7989d51537c3ae5a0da78892a018482f | diff --git a/torchvision/models/vgg.py b/torchvision/models/vgg.py
index <HASH>..<HASH> 100644
--- a/torchvision/models/vgg.py
+++ b/torchvision/models/vgg.py
@@ -19,7 +19,7 @@ model_urls = {
class VGG(nn.Module):
- def __init__(self, features):
+ def __init__(self, features, num_classes=1000):
super(VGG, self).__init__()
self.features = features
self.classifier = nn.Sequential(
@@ -29,7 +29,7 @@ class VGG(nn.Module):
nn.Linear(4096, 4096),
nn.ReLU(True),
nn.Dropout(),
- nn.Linear(4096, 1000),
+ nn.Linear(4096, num_classes),
)
self._initialize_weights() | Add num_classes (#<I>) | pytorch_vision | train | py |
9afede6deb197731aa7a492538fcfa8229df9b03 | diff --git a/routes.php b/routes.php
index <HASH>..<HASH> 100644
--- a/routes.php
+++ b/routes.php
@@ -6,5 +6,8 @@ Route::get('/js-localization/messages', 'JsLocalizationController@createJsMessag
Route::get('/js-localization/localization.js', function()
{
- return new StaticFileResponse( __DIR__."/public/js/localization.min.js" );
+ $response = new StaticFileResponse( __DIR__."/public/js/localization.min.js" );
+ $response->setPublic();
+
+ return $response;
}); | Now setting StaticFileResponse to public (for improved caching). | andywer_laravel-js-localization | train | php |
ecb4ab3ca7babc23c4133de5a3207b72f47e64a0 | diff --git a/core/src/test/java/tachyon/master/MasterFaultToleranceTest.java b/core/src/test/java/tachyon/master/MasterFaultToleranceTest.java
index <HASH>..<HASH> 100644
--- a/core/src/test/java/tachyon/master/MasterFaultToleranceTest.java
+++ b/core/src/test/java/tachyon/master/MasterFaultToleranceTest.java
@@ -121,7 +121,7 @@ public class MasterFaultToleranceTest {
Assert.assertTrue(mLocalTachyonClusterMultiMaster.killLeader());
CommonUtils.sleepMs(null, Constants.SECOND_MS * 2);
faultTestDataCheck(answer);
- faultTestDataCreation("/data" + (clients + kills + 1), answer);
+// faultTestDataCreation("/data" + (clients + kills + 1), answer);
}
} | revert MFT test as the previous version | Alluxio_alluxio | train | java |
7c34548fe0c7c5078fe9672e236630597be50d13 | diff --git a/activesupport/lib/active_support/core_ext/enumerable.rb b/activesupport/lib/active_support/core_ext/enumerable.rb
index <HASH>..<HASH> 100644
--- a/activesupport/lib/active_support/core_ext/enumerable.rb
+++ b/activesupport/lib/active_support/core_ext/enumerable.rb
@@ -69,7 +69,7 @@ module Enumerable
# {foo: 1, bar: 2, baz: 3}.without :bar
# => {foo: 1, baz: 3}
def without(*elements)
- reject { |element| element.in?(elements) }
+ reject { |element| elements.include?(element) }
end
end
diff --git a/activesupport/test/core_ext/enumerable_test.rb b/activesupport/test/core_ext/enumerable_test.rb
index <HASH>..<HASH> 100644
--- a/activesupport/test/core_ext/enumerable_test.rb
+++ b/activesupport/test/core_ext/enumerable_test.rb
@@ -1,7 +1,6 @@
require 'abstract_unit'
require 'active_support/core_ext/array'
require 'active_support/core_ext/enumerable'
-require 'active_support/core_ext/object/inclusion'
Payment = Struct.new(:price)
class SummablePayment < Payment | Use include? instead of in? for Enumerable#without.
[egilburg] | rails_rails | train | rb,rb |
d8db0964c68fa49cda2d4f33d982fbda34d88aac | diff --git a/coupons/models.py b/coupons/models.py
index <HASH>..<HASH> 100644
--- a/coupons/models.py
+++ b/coupons/models.py
@@ -122,7 +122,11 @@ class Coupon(models.Model):
try:
coupon_user = self.users.get(user=user)
except CouponUser.DoesNotExist:
- coupon_user = CouponUser(coupon=self, user=user)
+ try: # silently fix unbouned or nulled coupon users
+ coupon_user = self.users.get(user__isnull=True)
+ coupon_user.user = user
+ except CouponUser.DoesNotExist:
+ coupon_user = CouponUser(coupon=self, user=user)
coupon_user.redeemed_at = timezone.now()
coupon_user.save()
redeem_done.send(sender=self.__class__, coupon=self) | redeem coupons which have a nulled user value | byteweaver_django-coupons | train | py |
4b5ff9f67d39e19d96b97ddf15b8a3c7351cd9b9 | diff --git a/buildozer/targets/ios.py b/buildozer/targets/ios.py
index <HASH>..<HASH> 100644
--- a/buildozer/targets/ios.py
+++ b/buildozer/targets/ios.py
@@ -252,7 +252,7 @@ class TargetIos(Target):
ios_dir = ios_dir = join(self.buildozer.platform_dir, 'kivy-ios')
self.buildozer.cmd('open {}.xcodeproj'.format(
- app_name), cwd=join(ios_dir, 'app-{}'.format(app_name)))
+ app_name), cwd=join(ios_dir, '{}-ios'.format(app_name)))
def _run_ios_deploy(self, lldb=False):
state = self.buildozer.state | fix ios targets xcode command | kivy_buildozer | train | py |
3a1a0ed1e368c48b6bdfcf10df8f7fc55de215f3 | diff --git a/index.js b/index.js
index <HASH>..<HASH> 100644
--- a/index.js
+++ b/index.js
@@ -101,8 +101,7 @@ module.exports = function (timeout) {
return function (abort, cb) {
//if there is anything still in the queue,
if(reading || state.has(1)) {
- if(abort)
- return read.abort(abort, cb)
+ if(abort) return read(abort, cb)
queue.push({length: null, cb: cb})
more()
} | once in streaming mode, abort the source normally | dominictarr_pull-reader | train | js |
88cd8e1aa74ae16e551a3487b660b5234f57208b | diff --git a/wallet/database.go b/wallet/database.go
index <HASH>..<HASH> 100644
--- a/wallet/database.go
+++ b/wallet/database.go
@@ -102,6 +102,9 @@ func NewEncryptedBoltDBWalletAwaitingPassphrase(path string) (*Wallet, error) {
// Close closes a Factom Wallet Database
func (w *Wallet) Close() error {
+ if w.WalletDatabaseOverlay == nil {
+ return nil
+ }
return w.DBO.Close()
} | FD-<I> shut down gracefully when closing a wallet that has never been unlocked | FactomProject_factom | train | go |
946bd5493f3d9a11e379d79d5818ec05ff01487e | diff --git a/vocabulary/responselib.py b/vocabulary/responselib.py
index <HASH>..<HASH> 100644
--- a/vocabulary/responselib.py
+++ b/vocabulary/responselib.py
@@ -61,7 +61,7 @@ class Response(object):
values = self.__respond_with_dict(item)
# print("\nThe item is:", values)
- if isinstance(item, dict) and len(values) == 1:
+ if isinstance(values, dict) and len(values) == 1:
(key, values), = values.items()
response[index] = values
@@ -74,7 +74,23 @@ class Response(object):
:param data: the json object
:returns: a nested list
"""
- pass
+ response = []
+ if isinstance(data, dict):
+ data.pop('seq', None)
+ data = list(data.values())
+
+ for item in data:
+ values = item
+ if isinstance(item, list) or isinstance(item, dict):
+ values = self.__respond_with_list(item)
+
+ # print "\nThe values: ", values
+ if isinstance(values, list) and len(values) == 1:
+ response.extend(values)
+ else:
+ response.append(values)
+
+ return response
def respond(self, data, format='json'):
""" | Updated responselib to add support for 'list' response
* Fixed 'dict' response check | tasdikrahman_vocabulary | train | py |
e4ab762dd58b99cd0051254c2da39d58c8f59659 | diff --git a/familybook.php b/familybook.php
index <HASH>..<HASH> 100644
--- a/familybook.php
+++ b/familybook.php
@@ -41,7 +41,7 @@ $controller
<?php echo WT_I18N::translate('Individual'); ?>
</td>
<td class="optionbox">
- <input class="pedigree_form" data-autocomplete-type="INDI" type="text" name="rootid" id="rootid" size="3" value="<?php echo $controller->rootid; ?>">
+ <input class="pedigree_form" data-autocomplete-type="INDI" type="text" name="rootid" id="rootid" size="3" value="<?php echo $controller->root->getXref(); ?>">
<?php echo print_findindi_link('rootid'); ?>
</td>
<td class="descriptionbox">
diff --git a/pedigree.php b/pedigree.php
index <HASH>..<HASH> 100644
--- a/pedigree.php
+++ b/pedigree.php
@@ -64,7 +64,7 @@ $controller
<tr>
<td class="optionbox">
<input class="pedigree_form" data-autocomplete-type="INDI" type="text" id="rootid" name="rootid"
- size="3" value="<?php echo $controller->rootid; ?>">
+ size="3" value="<?php echo $controller->root->getXref(); ?>">
<?php echo print_findindi_link('rootid'); ?>
</td>
<td class="optionbox center"> | Missing XREF on pedigree/family book charts | fisharebest_webtrees | train | php,php |
e0198766ae8b266a0ec6af4c8f27d50c23cdbacf | diff --git a/core/src/main/java/io/atomix/core/election/LeaderElection.java b/core/src/main/java/io/atomix/core/election/LeaderElection.java
index <HASH>..<HASH> 100644
--- a/core/src/main/java/io/atomix/core/election/LeaderElection.java
+++ b/core/src/main/java/io/atomix/core/election/LeaderElection.java
@@ -79,7 +79,7 @@ public interface LeaderElection<T> extends SyncPrimitive {
*
* @return current Leadership state of the topic
*/
- Leadership getLeadership();
+ Leadership<T> getLeadership();
/**
* Registers a listener to be notified of Leadership changes for all topics. | Add generic type to Leadership in LeaderElection. | atomix_atomix | train | java |
49315045a0b0e450a6877712e84577f5b11a7703 | diff --git a/torrent.go b/torrent.go
index <HASH>..<HASH> 100644
--- a/torrent.go
+++ b/torrent.go
@@ -2,6 +2,7 @@ package torrent
import (
"container/heap"
+ "crypto/sha1"
"errors"
"fmt"
"io"
@@ -202,8 +203,8 @@ func (t *Torrent) metadataSize() int {
}
func infoPieceHashes(info *metainfo.Info) (ret []string) {
- for i := 0; i < len(info.Pieces); i += 20 {
- ret = append(ret, string(info.Pieces[i:i+20]))
+ for i := 0; i < len(info.Pieces); i += sha1.Size {
+ ret = append(ret, string(info.Pieces[i:i+sha1.Size]))
}
return
} | it is actually sha1 hash size | anacrolix_torrent | train | go |
21c11bf6129daf3b19c6f87b96a72f12ade403d6 | diff --git a/config/config-server/src/main/java/com/thoughtworks/go/service/ConfigRepository.java b/config/config-server/src/main/java/com/thoughtworks/go/service/ConfigRepository.java
index <HASH>..<HASH> 100644
--- a/config/config-server/src/main/java/com/thoughtworks/go/service/ConfigRepository.java
+++ b/config/config-server/src/main/java/com/thoughtworks/go/service/ConfigRepository.java
@@ -59,7 +59,7 @@ import static java.nio.charset.StandardCharsets.UTF_8;
@Component
public class ConfigRepository {
private static final String CRUISE_CONFIG_XML = "cruise-config.xml";
- private static final String STUDIOS_PRODUCT = "support@thoughtworks.com";
+ private static final String COMMIT_EMAIL = "go-cd-dev@googlegroups.com";
static final String BRANCH_AT_REVISION = "branch-at-revision";
static final String BRANCH_AT_HEAD = "branch-at-head";
public static final String CURRENT = "current";
@@ -126,7 +126,7 @@ public class ConfigRepository {
@Override
public void run() throws Exception {
addCommand.addFilepattern(CRUISE_CONFIG_XML).call();
- git.commit().setAuthor(rev.getUsername(), STUDIOS_PRODUCT).setMessage(rev.getComment()).call();
+ git.commit().setAuthor(rev.getUsername(), COMMIT_EMAIL).setMessage(rev.getComment()).call();
}
});
} catch (Exception e) { | Make config repository commits as a non-Thoughtworks email address | gocd_gocd | train | java |
81e3d562cfb0de4ab0028be26473ea0620e4759a | diff --git a/src/kg/apc/jmeter/charting/GraphPanelChart.java b/src/kg/apc/jmeter/charting/GraphPanelChart.java
index <HASH>..<HASH> 100644
--- a/src/kg/apc/jmeter/charting/GraphPanelChart.java
+++ b/src/kg/apc/jmeter/charting/GraphPanelChart.java
@@ -505,7 +505,8 @@ public class GraphPanelChart
g.setColor(Color.black);
// draw label
- xAxisLabelRenderer.setValue(minXVal + n * (maxXVal - minXVal) / gridLinesCount);
+ xAxisLabelRenderer.setValue(minXVal + n * (double)(maxXVal - minXVal) / gridLinesCount);
+
valueLabel = xAxisLabelRenderer.getText();
labelXPos = gridLineX - fm.stringWidth(valueLabel) / 2;
g.drawString(valueLabel, labelXPos, xAxisRect.y + fm.getAscent() + spacing); | Fix bug of precision loss for x axis labels do to integer implicit cast | undera_jmeter-plugins | train | java |
f712129e221bc95bbb0660ad1b87a85e50f2421b | diff --git a/lib/celluloid/task.rb b/lib/celluloid/task.rb
index <HASH>..<HASH> 100644
--- a/lib/celluloid/task.rb
+++ b/lib/celluloid/task.rb
@@ -58,10 +58,6 @@ module Celluloid
nil
rescue FiberError
raise DeadTaskError, "cannot resume a dead task"
- rescue RuntimeError => ex
- # These occur spuriously on 1.9.3 if we shut down an actor with running tasks
- return if ex.message == ""
- raise
end
# Terminate this task | Remove hax
The shutdown ordering issues should hopefully be sufficiently resolved
to where this is no longer needed | celluloid_celluloid | train | rb |
0adb0fa384ddcad696caab227e5051e3c1a80e0c | diff --git a/tests/GatewayTest.php b/tests/GatewayTest.php
index <HASH>..<HASH> 100644
--- a/tests/GatewayTest.php
+++ b/tests/GatewayTest.php
@@ -4,6 +4,9 @@ namespace Omnipay\Stripe;
use Omnipay\Tests\GatewayTestCase;
+/**
+ * @property Gateway gateway
+ */
class GatewayTest extends GatewayTestCase
{
public function setUp()
@@ -73,6 +76,15 @@ class GatewayTest extends GatewayTestCase
$this->assertInstanceOf('Omnipay\Stripe\Message\FetchTokenRequest', $request);
}
+ public function testCreateToken()
+ {
+ $request = $this->gateway->createToken(array('customer' => 'cus_foo'));
+
+ $this->assertInstanceOf('Omnipay\Stripe\Message\CreateTokenRequest', $request);
+ $params = $request->getParameters();
+ $this->assertSame('cus_foo', $params['customer']);
+ }
+
public function testCreateCard()
{
$request = $this->gateway->createCard(array('description' => 'foo')); | Adding tests for new CreateToken method on gateway. | thephpleague_omnipay-stripe | train | php |
e1f71f7041190a93cd3e6c43013efb663f33fd7f | diff --git a/filterpy/kalman/kalman_filter.py b/filterpy/kalman/kalman_filter.py
index <HASH>..<HASH> 100644
--- a/filterpy/kalman/kalman_filter.py
+++ b/filterpy/kalman/kalman_filter.py
@@ -113,8 +113,8 @@ class KalmanFilter(object):
self.P = eye(dim_x) # uncertainty covariance
self.Q = eye(dim_x) # process uncertainty
self.B = 0. # control transition matrix
- self.F = 0. # state transition matrix
- self.H = 0. # Measurement function
+ self.F = eye(dim_x) # state transition matrix
+ self.H = zeros((dim_z, dim_x)) # Measurement function
self.R = eye(dim_z) # state uncertainty
self._alpha_sq = 1. # fading memory control
self.M = 0. # process-measurement cross correlation | Reasonble default values for F and H.
I was setting them to zero; if you call predit() or update()
you get an exception because the rest of the variables are
properly initialized. | rlabbe_filterpy | train | py |
0630539aa382bc3434c9906488ec2383b9585445 | diff --git a/spec/coercion.spec.js b/spec/coercion.spec.js
index <HASH>..<HASH> 100644
--- a/spec/coercion.spec.js
+++ b/spec/coercion.spec.js
@@ -142,7 +142,9 @@ var coercionRules = {
var coercionArrayRules = JSON.parse(JSON.stringify(coercionRules));
coercionArrayRules.string.array = [
- { from: ['abc'], to: 'abc' }
+ { from: ['abc'], to: 'abc' },
+ { from: ['abc', 'def'], to: undefined },
+ { from: [], to: undefined }
];
coercionArrayRules.number.array = [
{ from: [1.5], to: 1.5 } | test: coerceTypes: "array" coercion should fail if array length != 1, #<I> | epoberezkin_ajv | train | js |
6f3e646965386933b767db8bb91c6fb424d74698 | diff --git a/src/index.js b/src/index.js
index <HASH>..<HASH> 100644
--- a/src/index.js
+++ b/src/index.js
@@ -115,7 +115,7 @@ export default class Base extends EventEmitter {
title: title,
transitionName: screen.transitionName(m)
};
- render(props, l.ui.containerID(m), l.ui.appendContainer(m));
+ render(l.ui.containerID(m), props);
} else {
remove(l.ui.containerID(m));
}
diff --git a/src/widget/render.js b/src/widget/render.js
index <HASH>..<HASH> 100644
--- a/src/widget/render.js
+++ b/src/widget/render.js
@@ -39,8 +39,8 @@ class Renderer {
this.modals = {};
}
- render(props, containerId, isModal) {
- // TODO: take containerId and isModal from props.
+ render(containerId, props) {
+ const { isModal } = props;
const container = this.containerManager.ensure(containerId, isModal);
if (isModal && !this.modals[containerId]) { | Improve render arguments
- No need to specify `isModal` twice
- Take container id as the first argument and props as the last to
improve readability. | auth0_lock | train | js,js |
6070f93295896ec4e07c002a1e7069dc8f650a4c | diff --git a/orderable/models.py b/orderable/models.py
index <HASH>..<HASH> 100644
--- a/orderable/models.py
+++ b/orderable/models.py
@@ -109,7 +109,7 @@ class Orderable(models.Model):
_move_back()
# self.sort_order increased.
- elif new_pos > old_pos:
+ elif old_pos and new_pos > old_pos:
_move_to_end()
# Decrement sort_order on objects with:
# sort_order <= new_pos and sort_order > old_pos. | Only compare to old_pos if it's relevant. | incuna_django-orderable | train | py |
de2bed648acd870d95de0a3040409394bb0c5067 | diff --git a/src/funnies.js b/src/funnies.js
index <HASH>..<HASH> 100644
--- a/src/funnies.js
+++ b/src/funnies.js
@@ -232,7 +232,11 @@ export default [
"Work, work...",
"Patience! This is difficult, you know...",
"Discovering new ways of making you wait...",
+ "Your time is very important to us. Please wait while we ignore you...",
+ "Time flies like an arrow; fruit flies like a banana",
+ "Two men walked into a bar; the third ducked...",
+ "Sooooo... Have you seen my vacation photos yet?",
"Sorry we are busy catching em' all, we're done soon",
"TODO: Insert elevator music",
- "Still faster than Windows update"
+ "Still faster than Windows update",
]; | #6 - Add funny phrases (#<I>)
* Add some "jokes"
* Made joke funnier!
* Reverse accidental change of double- to singel-quotes | 1egoman_funnies | train | js |
84769c48386c13c053b2ebb4516258a97031439c | diff --git a/librarypaste/pastebin.py b/librarypaste/pastebin.py
index <HASH>..<HASH> 100644
--- a/librarypaste/pastebin.py
+++ b/librarypaste/pastebin.py
@@ -11,11 +11,6 @@ from mako.lookup import TemplateLookup
import imghdr
-try:
- unicode
-except NameError:
- unicode = str
-
BASE = os.path.abspath(os.path.dirname(__file__))
lookup = TemplateLookup(directories=[os.path.join(BASE, 'templates')])
@@ -65,7 +60,7 @@ class Server(object):
data = file is not None and file.fullvalue()
if data:
filename = file.filename
- mime = unicode(file.content_type)
+ mime = str(file.content_type)
content.update(
type = 'file',
mime = mime, | Remove superfluous compatibility for deprecated unicode. | yougov_librarypaste | train | py |
9cff81b40fbc71e2455a00ef50f10bc200784af2 | diff --git a/spec/rails_app/config/application.rb b/spec/rails_app/config/application.rb
index <HASH>..<HASH> 100644
--- a/spec/rails_app/config/application.rb
+++ b/spec/rails_app/config/application.rb
@@ -6,3 +6,8 @@ module RailsApp
config.i18n.enforce_available_locales = true
end
end
+
+require 'active_record/connection_adapters/sqlite3_adapter'
+if ActiveRecord::ConnectionAdapters::SQLite3Adapter.respond_to?(:represent_boolean_as_integer)
+ ActiveRecord::ConnectionAdapters::SQLite3Adapter.represent_boolean_as_integer = true
+end
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
@@ -1,6 +1,6 @@
ENV['RAILS_ENV'] = 'test'
-$:.unshift File.dirname(__FILE__)
+$LOAD_PATH.unshift File.dirname(__FILE__)
require File.expand_path('../../spec/rails_app/config/environment', __FILE__)
require 'rails/test_help'
@@ -8,7 +8,6 @@ require 'rails/test_help'
require 'audited'
class ActiveSupport::TestCase
-
setup do
ActiveRecord::Migration.verbose = false
end | fix test failing and being noisy on ruby <I> | collectiveidea_audited | train | rb,rb |
6815ebdefbc0998e5a98c8ecc7ed4720e22903de | diff --git a/timepiece/entries/tests/test_timesheet.py b/timepiece/entries/tests/test_timesheet.py
index <HASH>..<HASH> 100644
--- a/timepiece/entries/tests/test_timesheet.py
+++ b/timepiece/entries/tests/test_timesheet.py
@@ -1317,7 +1317,14 @@ class CreateEditEntry(ViewTestMixin, TestCase):
response = self.client.post(url, data=data)
self.assertEqual(response.status_code, 404)
- def test_edit_invoiced_entry(self):
+ def test_user_cannot_edit_invoiced_entry(self):
+ """User should not be able to edit an invoiced entry"""
+ url, entry, data = self.edit_entry_helper(Entry.INVOICED)
+
+ response = self.client.post(url, data=data, follow=True)
+ self.assertEqual(response.status_code, 404)
+
+ def test_superuser_can_edit_invoiced_entry(self):
"""Superuser should be able to edit an invoiced entry"""
self.client.logout()
self.login_user(self.superuser) | fixed tests to account for super user and non attempting to edit invoiced entry | caktus_django-timepiece | train | py |
377b4ac03934e1cb7e302cf613367d559f44fd58 | diff --git a/toolkit/srm/__init__.py b/toolkit/srm/__init__.py
index <HASH>..<HASH> 100644
--- a/toolkit/srm/__init__.py
+++ b/toolkit/srm/__init__.py
@@ -1,2 +1,3 @@
-from srm import SRM
+from toolkit.srm.srm import SRM
+
__all__ = ["SRM"]
diff --git a/toolkit/srm/srm.py b/toolkit/srm/srm.py
index <HASH>..<HASH> 100644
--- a/toolkit/srm/srm.py
+++ b/toolkit/srm/srm.py
@@ -73,7 +73,7 @@ class SRM(BaseEstimator):
Given multi-subject data, factorize it as a shared response S among all subjects and an orthogonal transform W
per subject:
- .. math:: X_i \sim W_i * S , \~\~ for \~\~ all \~\~ i=1\dots N
+ .. math:: X_i \sim W_i * S ,~for~all~i=1\dots N
Parameters
---------- | Fixes to make srm importable under Python <I>, and fixed a math layout problem | brainiak_brainiak | train | py,py |
52e7e25d37d3df2e04e50bc64254547a4c4ab190 | diff --git a/lib/oneview-sdk/resource/api300/synergy/volume_attachment.rb b/lib/oneview-sdk/resource/api300/synergy/volume_attachment.rb
index <HASH>..<HASH> 100644
--- a/lib/oneview-sdk/resource/api300/synergy/volume_attachment.rb
+++ b/lib/oneview-sdk/resource/api300/synergy/volume_attachment.rb
@@ -14,7 +14,7 @@ require_relative '../../api200/volume_attachment'
module OneviewSDK
module API300
module Synergy
- # Storage volume attachment resource implementation for API300 Thunderbird
+ # Storage volume attachment resource implementation for API300 Synergy
class VolumeAttachment < OneviewSDK::API200::VolumeAttachment
end
end | The references of thundebird was replaced to synergy for Volume Attachment | HewlettPackard_oneview-sdk-ruby | train | rb |
b3bf01d066e7aaa8f0c6451d6fbf37d07de4900f | diff --git a/cherrypy/wsgiserver/wsgiserver2.py b/cherrypy/wsgiserver/wsgiserver2.py
index <HASH>..<HASH> 100644
--- a/cherrypy/wsgiserver/wsgiserver2.py
+++ b/cherrypy/wsgiserver/wsgiserver2.py
@@ -547,17 +547,6 @@ class ChunkedRFile(object):
def close(self):
self.rfile.close()
- def __iter__(self):
- # Shamelessly stolen from StringIO
- total = 0
- line = self.readline(sizehint)
- while line:
- yield line
- total += len(line)
- if 0 < sizehint <= total:
- break
- line = self.readline(sizehint)
-
class HTTPRequest(object):
diff --git a/cherrypy/wsgiserver/wsgiserver3.py b/cherrypy/wsgiserver/wsgiserver3.py
index <HASH>..<HASH> 100644
--- a/cherrypy/wsgiserver/wsgiserver3.py
+++ b/cherrypy/wsgiserver/wsgiserver3.py
@@ -534,17 +534,6 @@ class ChunkedRFile(object):
def close(self):
self.rfile.close()
- def __iter__(self):
- # Shamelessly stolen from StringIO
- total = 0
- line = self.readline(sizehint)
- while line:
- yield line
- total += len(line)
- if 0 < sizehint <= total:
- break
- line = self.readline(sizehint)
-
class HTTPRequest(object): | Remove __iter__ method, which couldn't have possibly worked due to 'sizehint' name missing from the namespace. | cherrypy_cheroot | train | py,py |
17e580b0e361e3f4f386ae6ec67d8bf7eb6b13cb | diff --git a/system/modules/generalDriver/GeneralControllerDefault.php b/system/modules/generalDriver/GeneralControllerDefault.php
index <HASH>..<HASH> 100644
--- a/system/modules/generalDriver/GeneralControllerDefault.php
+++ b/system/modules/generalDriver/GeneralControllerDefault.php
@@ -1067,7 +1067,7 @@ class GeneralControllerDefault extends Controller implements InterfaceGeneralCon
}
catch (Exception $exc)
{
- $_SESSION['TL_ERROR'][] = $exc->getMessage();
+ $_SESSION['TL_ERROR'][] = sprintf('Exception: %s in file %s on line %s', $exc->getMessage(), $exc->getFile(), $exc->getLine());
}
}
} | Provide better error message in case of exception. | contao-community-alliance_dc-general | train | php |
de3749ebd9bb0ec3d8c71e9f4e409ec7750e4743 | diff --git a/index.js b/index.js
index <HASH>..<HASH> 100644
--- a/index.js
+++ b/index.js
@@ -58,12 +58,6 @@ function downloadVideo(url, ext, downloadPath) {
download.on("error", reject);
download.pipe(fs.createWriteStream(downloadPath)); // TODO: Check if I should leave this part to the user, instead of doing it in the module.
-
- process.on("unhandledRejection", (reason, promise) => {
- if (reason.message.includes("The progress percentage can't be lower than the last progress event")) {
- promise.catch(() => Promise.resolve());
- }
- });
});
}
@@ -100,6 +94,12 @@ module.exports = (url, apiKey, videosPath, opts) => { // TODO: Suport using an O
opts.max = Math.min(Math.max((opts.max || 5), 0), 50); // TODO: Maybe limit `opts.max` to be between 1 and 50 instead of 0 and 50 and `opts.start` to be between 0 and 49 instead of 0 and 50.
opts.start = Math.min(Math.max((opts.start || 0), 0), 50);
+ process.on("unhandledRejection", (reason, promise) => {
+ if (reason.message.includes("The progress percentage can't be lower than the last progress event")) {
+ promise.catch(() => Promise.resolve());
+ }
+ });
+
return getUrlInfo(url, videoInfo, apiKey, opts)
.then(res => {
const downloads = []; | Listen to “unhandledRejection” event only once | itaisteinherz_videos | train | js |
409f5a656d5e48c4c1f57ff17b9a2078fc604a89 | diff --git a/rangeparser.py b/rangeparser.py
index <HASH>..<HASH> 100644
--- a/rangeparser.py
+++ b/rangeparser.py
@@ -63,9 +63,6 @@ class Rank:
def __eq__(self, other):
return self._rank == other._rank
- def __ne__(self, other):
- return not self.__eq__(other)
-
def __lt__(self, other):
return RANKS.index(self._rank) < RANKS.index(other._rank)
diff --git a/tests/test_rank.py b/tests/test_rank.py
index <HASH>..<HASH> 100644
--- a/tests/test_rank.py
+++ b/tests/test_rank.py
@@ -28,8 +28,18 @@ def test_equality_comparisons():
assert Rank('2') == Rank('2')
+def test_not_equal_comparisons():
+ assert (Rank('A') != Rank('A')) is False
+ assert (Rank('T') != Rank('T')) is False
+ assert (Rank('2') != Rank('2')) is False
+
+ assert Rank('A') != Rank('K')
+ assert Rank('6') != Rank('2')
+
+
def test_case_insensitive():
assert Rank('A') == Rank('a')
+ assert (Rank('A') != Rank('a')) is False
def test_invalid_rank_raises_InvalidRank_Exception(): | No need to define __ne__. New tests to prove. | pokerregion_poker | train | py,py |
ffe58c2e8ea1cf71765695b1c1c73897c1b7ea5e | diff --git a/src/jquery.contextMenu.js b/src/jquery.contextMenu.js
index <HASH>..<HASH> 100755
--- a/src/jquery.contextMenu.js
+++ b/src/jquery.contextMenu.js
@@ -1428,7 +1428,7 @@
break;
case 'select':
- item.$input.val(item.selected || '');
+ item.$input.val((item.selected === 0 ? "0" : item.selected) || '');
break;
}
} | check if given selected value is a 0, if it is a zero so return it as
string to prevent that jquery think its a boolean | swisnl_jQuery-contextMenu | train | js |
c502128c50ac4085127bd195bc128ca8b2d60562 | diff --git a/pkg/cmd/openshift-kube-apiserver/kubeadmission/register.go b/pkg/cmd/openshift-kube-apiserver/kubeadmission/register.go
index <HASH>..<HASH> 100644
--- a/pkg/cmd/openshift-kube-apiserver/kubeadmission/register.go
+++ b/pkg/cmd/openshift-kube-apiserver/kubeadmission/register.go
@@ -96,6 +96,8 @@ func NewDefaultOffPluginsFunc(kubeDefaultOffAdmission sets.String) func() sets.S
kubeOff.Delete(additionalDefaultOnPlugins.List()...)
kubeOff.Delete(openshiftAdmissionPluginsForKube...)
kubeOff.Delete(customresourcevalidationregistration.AllCustomResourceValidators...)
+ // temporarily disable RBR until we move it to a CRD (it is causing install timeout failures)
+ kubeOff.Insert("authorization.openshift.io/RestrictSubjectBindings")
return kubeOff
}
} | Temporarily disable RBR until we move it to a CRD | openshift_origin | train | go |
ba6b0e425fbebdb47c5c8ccb52c5b9bae3aedb79 | diff --git a/openquake/hazardlib/calc/hazard_curve.py b/openquake/hazardlib/calc/hazard_curve.py
index <HASH>..<HASH> 100644
--- a/openquake/hazardlib/calc/hazard_curve.py
+++ b/openquake/hazardlib/calc/hazard_curve.py
@@ -43,10 +43,12 @@ the engine manages all the realizations at once.
"""
import operator
+import numpy
from openquake.baselib.performance import Monitor
from openquake.baselib.parallel import sequential_apply
from openquake.baselib.general import DictArray, groupby
-from openquake.hazardlib.probability_map import ProbabilityMap
+from openquake.hazardlib.probability_map import (
+ ProbabilityMap, ProbabilityCurve)
from openquake.hazardlib.gsim.base import ContextMaker, PmapMaker
from openquake.hazardlib.calc.filters import SourceFilter
from openquake.hazardlib.sourceconverter import SourceGroup
@@ -217,4 +219,7 @@ def calc_hazard_curve(site1, src, gsim, oqparam):
srcfilter = SourceFilter(site1, oqparam.maximum_distance)
pmap, rup_data, calc_times, extra = PmapMaker(
cmaker, srcfilter, [src]).make()
+ if not pmap: # filtered away
+ zero = numpy.zeros((len(oqparam.imtls.array), 1))
+ return ProbabilityCurve(zero)
return pmap[0] # pcurve with shape (L, G) on site 0 | Managed the case of zero curves | gem_oq-engine | train | py |
d89e5a4ff49b1345255435a8a945e43934064b83 | diff --git a/docs/conf.py b/docs/conf.py
index <HASH>..<HASH> 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -24,6 +24,8 @@ author = 'Grove Co'
# -- General configuration ---------------------------------------------------
+master_doc = 'index.rst'
+
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones. | Add config for master doc for sphinx RTD build | groveco_django-sql-explorer | train | py |
90eca60d810b3748107e1bc5d8a9eb31391697f6 | diff --git a/src/Generator.php b/src/Generator.php
index <HASH>..<HASH> 100644
--- a/src/Generator.php
+++ b/src/Generator.php
@@ -162,7 +162,7 @@ class Generator
*
* @param string $text
* @param string|null $filename
- * @return void|string
+ * @return void|Illuminate\Support\HtmlString|string
* @throws WriterException
* @throws InvalidArgumentException
*/
@@ -181,6 +181,10 @@ class Generator
return;
}
+ if(class_exists(\Illuminate\Support\HtmlString::class)){
+ return new \Illuminate\Support\HtmlString($qrCode);
+ }
+
return $qrCode;
}
diff --git a/tests/GeneratorTest.php b/tests/GeneratorTest.php
index <HASH>..<HASH> 100644
--- a/tests/GeneratorTest.php
+++ b/tests/GeneratorTest.php
@@ -205,4 +205,10 @@ class GeneratorTest extends TestCase
$this->expectException(BadMethodCallException::class);
(new Generator)->notReal('fooBar');
}
+
+ public function test_generator_can_return_illuminate_support_htmlstring()
+ {
+ $this->getMockBuilder(\Illuminate\Support\HtmlString::class)->getMock();
+ $this->assertInstanceOf(\Illuminate\Support\HtmlString::class, (new Generator)->generate('fooBar'));
+ }
} | Add support for returning Illuminate\Support\HtmlString in generate function | SimpleSoftwareIO_simple-qrcode | train | php,php |
bb2a1723bab176e487c38fae2328346e3291409b | diff --git a/library/SimplePie.php b/library/SimplePie.php
index <HASH>..<HASH> 100755
--- a/library/SimplePie.php
+++ b/library/SimplePie.php
@@ -1467,7 +1467,14 @@ class SimplePie
}
else
{
- $this->error = 'The data could not be converted to UTF-8. You MUST have either the iconv or mbstring extension installed. Upgrading to PHP 5.x (which includes iconv) is highly recommended.';
+ $this->error = 'The data could not be converted to UTF-8.';
+ if (!extension_loaded('mbstring') && !extension_loaded('iconv')) {
+ $this->error .= ' You MUST have either the iconv or mbstring extension installed.';
+ } elseif (!extension_loaded('mbstring')) {
+ $this->error .= ' Try installing the mbstring extension.';
+ } elseif (!extension_loaded('mbstring')) {
+ $this->error .= ' Try installing the iconv extension.';
+ }
}
$this->registry->call('Misc', 'error', array($this->error, E_USER_NOTICE, __FILE__, __LINE__)); | Refactored "The data could not be converted to UTF-8. (...)" error message
- No longer complains about (not) missing extensions
- Removed solicitation about upgrading to PHP 5.x, Simplepie already requires PHP <I>, so this is just nuts!
See also #<I> (at the bottom of the first post) | simplepie_simplepie | train | php |
2c69e7c45422afa8556c2dc84de929a5cf1c2fb7 | diff --git a/test/integration/generated_path_test.rb b/test/integration/generated_path_test.rb
index <HASH>..<HASH> 100644
--- a/test/integration/generated_path_test.rb
+++ b/test/integration/generated_path_test.rb
@@ -65,24 +65,24 @@ class GeneratedPathTest < ActionDispatch::IntegrationTest
def test_with_suffix
get '/10-suffix'
assert_response :success
- assert_equal(response.body, '10')
+ assert_equal '10', response.body
end
def test_path_translated_with_suffix
get '/es/10-sufijo'
assert_response :success
- assert_equal(response.body, '10')
+ assert_equal '10', response.body
end
def test_with_engine_inside_localized_block
get '/engine_es'
assert_response :success
- assert_equal(response.body, '/blorgh/posts')
+ assert_equal '/blorgh/posts', response.body
end
def test_with_engine_outside_localized_block
get '/engine'
assert_response :success
- assert_equal(response.body, '/blorgh/posts')
+ assert_equal '/blorgh/posts', response.body
end
end | Fix tests
Expected value should come first | enriclluelles_route_translator | train | rb |
c52002c7b5958d11ce62c4b40c2450099f571e5e | diff --git a/biodata-models/src/main/java/org/opencb/biodata/models/core/Transcript.java b/biodata-models/src/main/java/org/opencb/biodata/models/core/Transcript.java
index <HASH>..<HASH> 100644
--- a/biodata-models/src/main/java/org/opencb/biodata/models/core/Transcript.java
+++ b/biodata-models/src/main/java/org/opencb/biodata/models/core/Transcript.java
@@ -27,6 +27,8 @@ public class Transcript implements Serializable {
private int cdsLength;
private String proteinID;
private String description;
+ private String proteinSequence;
+ private String cDnaSequence;
private List<Xref> xrefs;
private List<TranscriptTfbs> tfbs;
private List<Exon> exons;
@@ -219,4 +221,12 @@ public class Transcript implements Serializable {
public Set<String> getAnnotationFlags() { return annotationFlags; }
public void setAnnotationFlags(Set<String> annotationFlags) { this.annotationFlags = annotationFlags; }
+
+ public String getProteinSequence() { return proteinSequence; }
+
+ public void setProteinSequence(String proteinSequence) { this.proteinSequence = proteinSequence; }
+
+ public String getcDnaSequence() { return cDnaSequence; }
+
+ public void setcDnaSequence(String cDnaSequence) { this.cDnaSequence = cDnaSequence; }
} | develop: Transcript now includes protein and cdna sequences | opencb_biodata | train | java |
9c8bfd8b62bb7d0fa4c923773e63b445ff13a6bd | diff --git a/glue/ligolw/lsctables.py b/glue/ligolw/lsctables.py
index <HASH>..<HASH> 100644
--- a/glue/ligolw/lsctables.py
+++ b/glue/ligolw/lsctables.py
@@ -1517,7 +1517,7 @@ class CoincDefTable(table.Table):
tableName = "coinc_definer:table"
validcolumns = {
"coinc_def_id": "ilwd:char",
- "table_name": "lstring"
+ "table_name": "char_v"
}
ids = CoincDefIDs() | Change table_name column's type from lstring to char_v in coinc_definer table. | gwastro_pycbc-glue | train | py |
9fcb7cc66c1317d4cd6060d91ad23b530ebe0df1 | diff --git a/omego/upgrade.py b/omego/upgrade.py
index <HASH>..<HASH> 100644
--- a/omego/upgrade.py
+++ b/omego/upgrade.py
@@ -316,7 +316,7 @@ class WindowsInstall(Install):
except AttributeError:
with tempfile.NamedTemporaryFile(dir=targetdir) as test:
return os.path.exists(
- os.path.join(link), os.path.basename(test.name))
+ os.path.join(link, os.path.basename(test.name)))
# Symlinks are a bit more complicated on Windows:
# - You must have (elevated) administrator privileges | Fix typo in constructing temp file name | ome_omego | train | py |
a8d78b18bfc4780dc81e23f4926d8beffb077e35 | diff --git a/pmagpy/ipmag.py b/pmagpy/ipmag.py
index <HASH>..<HASH> 100755
--- a/pmagpy/ipmag.py
+++ b/pmagpy/ipmag.py
@@ -2713,6 +2713,8 @@ def upload_magic3(concat=0, dir_path='.', dmodel=None, vocab=""):
"criteria", "contribution", "images"]
file_names = [os.path.join(dir_path, dtype + ".txt") for dtype in dtypes]
con = Contribution(dir_path, vocabulary=vocab)
+ # take out any extra added columns
+ con.remove_non_magic_cols()
# begin the upload process
up = os.path.join(dir_path, "upload.txt")
if os.path.exists(up): | fix merge problem (must remove incorrect columns before ipmag.upload_magic) | PmagPy_PmagPy | train | py |
418bb65d9db9fa26482344be5d4faa03b9a4c29a | diff --git a/core/corehttp/commands.go b/core/corehttp/commands.go
index <HASH>..<HASH> 100644
--- a/core/corehttp/commands.go
+++ b/core/corehttp/commands.go
@@ -140,7 +140,7 @@ func CommandsOption(cctx oldcmds.Context) ServeOption {
return commandsOption(cctx, corecommands.Root)
}
-// CommandsOption constructs a ServerOption for hooking the read-only commands
+// CommandsROOption constructs a ServerOption for hooking the read-only commands
// into the HTTP server.
func CommandsROOption(cctx oldcmds.Context) ServeOption {
return commandsOption(cctx, corecommands.RootRO) | fix doc comment on CommandsROOption
License: MIT | ipfs_go-ipfs | train | go |
3cf3aa5acf84de2f653e96469e2f9c42813df50a | diff --git a/custard/builder.py b/custard/builder.py
index <HASH>..<HASH> 100644
--- a/custard/builder.py
+++ b/custard/builder.py
@@ -565,3 +565,9 @@ class CustomFieldsBuilder(object):
form.save_custom_fields()
return CustomFieldModelBaseAdmin
+
+
+#===============================================================================
+# This class is an empty class to avoid migrations errors
+class CustomModelMixin(object):
+ pass | - create a small class to avoid migrations errors | kunitoki_django-custard | train | py |
9611046471411677e624cf44d875891d966523c3 | diff --git a/ella/core/views.py b/ella/core/views.py
index <HASH>..<HASH> 100755
--- a/ella/core/views.py
+++ b/ella/core/views.py
@@ -59,6 +59,10 @@ class EllaCoreView(object):
context = self.get_context(request, **kwargs)
return self.render(request, context, self.get_templates(context))
+
+def archive_year_cache_key(func, self, category):
+ return 'archive_year:%d' % category.pk
+
class CategoryDetail(EllaCoreView):
"""
Homepage of a category. Renders a templates using context containing:
@@ -76,6 +80,7 @@ class CategoryDetail(EllaCoreView):
"""
template_name = 'category.html'
+ @cache_this(archive_year_cache_key, timeout=60*60*24)
def _archive_entry_year(self, category):
" Return ARCHIVE_ENTRY_YEAR from settings (if exists) or year of the newest object in category "
year = getattr(settings, 'ARCHIVE_ENTRY_YEAR', None) | Added caching for CategoryDetail._archive_entry_year | ella_ella | train | py |
526a482a131275fdc175de1f03293be6abc0dd9f | diff --git a/src/FormObject/Form.php b/src/FormObject/Form.php
index <HASH>..<HASH> 100644
--- a/src/FormObject/Form.php
+++ b/src/FormObject/Form.php
@@ -381,6 +381,8 @@ class Form extends FormItem implements ArrayAccess{
public function getData($prefix=NULL){
+ $this->wasSubmitted();
+
$data = array();
foreach($this->getDataFields() as $field){ | Fill form before trying to build data array | mtils_formobject | train | php |
2a9b3f08795c66cfde774cd6e6d9079a80c72aea | diff --git a/src/pymoca/backends/casadi/api.py b/src/pymoca/backends/casadi/api.py
index <HASH>..<HASH> 100644
--- a/src/pymoca/backends/casadi/api.py
+++ b/src/pymoca/backends/casadi/api.py
@@ -305,7 +305,7 @@ def load_model(model_folder: str, model_name: str, compiler_options: Dict[str, s
try:
db = pickle.load(f)
except RuntimeError as e:
- if "DeserializingStream" in str(e):
+ if "DeserializingStream" in str(e) or "deserialization" in str(e).lower():
raise InvalidCacheError('Cache generated for incompatible CasADi version')
else:
raise | CasADi/API: Fix invalid cache check due to CasADi version mismatch
A recent CasADi version changed the error message when a pickled MX
function cannot be unpickled due to a version mismatch. This commit
updates the check so that instead of (re)raising the respective
RuntimeError from CasADi, we just recompile the model. | pymoca_pymoca | train | py |
4b519b32123b81d9ec42bc8576fa14313a03d776 | diff --git a/src/geshi.php b/src/geshi.php
index <HASH>..<HASH> 100644
--- a/src/geshi.php
+++ b/src/geshi.php
@@ -2034,7 +2034,7 @@ class GeSHi {
preg_match($delimiters, $code, $matches_rx, PREG_OFFSET_CAPTURE, $i)) {
//We got a match ...
$matches[$dk] = array(
- 'next_match' => $matches_rx[0][1],
+ 'next_match' => $matches_rx[1][1],
'dk' => $dk,
'close_strlen' => strlen($matches_rx[2][0]), | fix: use the opener pos as start position for regexp strict blocks | GeSHi_geshi-1.0 | train | php |
80565b9a13195376ea745ec8629dfa4ed7029896 | diff --git a/cmsplugin_cascade/bootstrap4/image.py b/cmsplugin_cascade/bootstrap4/image.py
index <HASH>..<HASH> 100644
--- a/cmsplugin_cascade/bootstrap4/image.py
+++ b/cmsplugin_cascade/bootstrap4/image.py
@@ -138,7 +138,7 @@ class BootstrapImagePlugin(ImageAnnotationMixin, LinkPluginBase):
def sanitize_model(cls, obj):
sanitized = False
parent = obj.parent
- if parent:
+ try:
while parent.plugin_type != 'BootstrapColumnPlugin':
parent = parent.parent
grid_column = parent.get_bound_plugin().get_grid_instance()
@@ -152,7 +152,7 @@ class BootstrapImagePlugin(ImageAnnotationMixin, LinkPluginBase):
if obj.glossary['media_queries'].get(bp.name) != media_query:
obj.glossary['media_queries'][bp.name] = media_query
sanitized = True
- else:
+ except AttributeError:
logger.warning("ImagePlugin(pk={}) has no ColumnPlugin as ancestor.".format(obj.pk))
return
return sanitized | handle edge case when adopting image size to breakpoints | jrief_djangocms-cascade | train | py |
2e4896dd5585b25ce5d739decb929d4fe596e3d4 | diff --git a/staging/src/k8s.io/mount-utils/mount_windows.go b/staging/src/k8s.io/mount-utils/mount_windows.go
index <HASH>..<HASH> 100644
--- a/staging/src/k8s.io/mount-utils/mount_windows.go
+++ b/staging/src/k8s.io/mount-utils/mount_windows.go
@@ -164,7 +164,7 @@ func newSMBMapping(username, password, remotepath string) (string, error) {
// https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_environment_variables?view=powershell-5.1
cmdLine := `$PWord = ConvertTo-SecureString -String $Env:smbpassword -AsPlainText -Force` +
`;$Credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $Env:smbuser, $PWord` +
- `;New-SmbGlobalMapping -RemotePath $Env:smbremotepath -Credential $Credential`
+ `;New-SmbGlobalMapping -RemotePath $Env:smbremotepath -Credential $Credential -RequirePrivacy $true`
cmd := exec.Command("powershell", "/c", cmdLine)
cmd.Env = append(os.Environ(),
fmt.Sprintf("smbuser=%s", username), | fix smb mount issue on Windows | kubernetes_kubernetes | train | go |
b7d9d71523bab2544ec1b423c1a3c61a76fffba8 | diff --git a/src/sos/preview.py b/src/sos/preview.py
index <HASH>..<HASH> 100644
--- a/src/sos/preview.py
+++ b/src/sos/preview.py
@@ -256,9 +256,9 @@ def preview_dot(filename, kernel=None, style=None):
images = [imageio.imread(x) for x in pngFiles]
maxWidth = max([x.shape[0] for x in images])
maxHeight = max([x.shape[1] for x in images])
- if images[0].shape[0] <= maxWidth or images[1].shape[1] <= maxHeight:
+ if images[0].shape[0] < maxWidth or images[0].shape[1] < maxHeight:
from PIL import Image, ImageOps
- newFirstImg = ImageOps.expand(Image.open(pngFiles[0]), border=(0,0, (maxHeight - images[1].shape[1]), (maxWidth - images[0].shape[0])), fill=0xFFFFFF)
+ newFirstImg = ImageOps.expand(Image.open(pngFiles[0]), border=(0,0, (maxHeight - images[0].shape[1]), (maxWidth - images[0].shape[0])), fill=0xFFFFFF)
newFirstImg.save(pngFiles[0], directory=tempDirectory)
# replace the original small one to the expanded one
images[0] = imageio.imread(pngFiles[0]) | fix errors with comparsion and width of 1st pic #<I> | vatlab_SoS | train | py |
6996a32004c2048b765ddfcb25419697e50bafe6 | diff --git a/src/components/Exchange/LightweightChart/LightweightChartOptions.js b/src/components/Exchange/LightweightChart/LightweightChartOptions.js
index <HASH>..<HASH> 100644
--- a/src/components/Exchange/LightweightChart/LightweightChartOptions.js
+++ b/src/components/Exchange/LightweightChart/LightweightChartOptions.js
@@ -69,6 +69,9 @@ export function createLightChart(element, cursorMode) {
localization: {
locale: 'en-US',
},
+ handleScale: {
+ axisPressedMouseMove: false,
+ },
});
}
diff --git a/src/lib/driver/Orderbook.js b/src/lib/driver/Orderbook.js
index <HASH>..<HASH> 100644
--- a/src/lib/driver/Orderbook.js
+++ b/src/lib/driver/Orderbook.js
@@ -18,6 +18,7 @@ export default class Orderbook {
});
},
setOrderbook: (baseBuying, counterSelling) => {
+ this.event.trigger();
// If orderbook is already set, then this is a no-op
// Expects baseBuying and counterSelling to StellarSdk.Asset objects
base = baseBuying; | Fixed chart-bug based on change asset-pair, fixed price scaling chart bug | stellarterm_stellarterm | train | js,js |
5983acd36fb8d20cde8f0b8382d95fa8727fc362 | diff --git a/js/gateio.js b/js/gateio.js
index <HASH>..<HASH> 100755
--- a/js/gateio.js
+++ b/js/gateio.js
@@ -292,6 +292,7 @@ module.exports = class gateio extends Exchange {
'GTC_HT': 'Game.com HT',
'GTC_BSC': 'Game.com BSC',
'HIT': 'HitChain',
+ 'MM': 'Million', // conflict with MilliMeter
'MPH': 'Morpher', // conflict with 88MPH
'RAI': 'Rai Reflex Index', // conflict with RAI Finance
'SBTC': 'Super Bitcoin', | gate MM > Million conflict with MilliMeter | ccxt_ccxt | train | js |
8b4832fc0231602868a0db83922fecc13af44ed2 | diff --git a/doc/conf.py b/doc/conf.py
index <HASH>..<HASH> 100644
--- a/doc/conf.py
+++ b/doc/conf.py
@@ -306,7 +306,7 @@ MOCK_MODULES = [
'pybel.language', 'pybel.dsl', 'pybel.resources',
'pybel.resources.definitions',
'pybel.resources.definitions.definitions', 'pybel.utils',
- 'pybel.io',
+ 'pybel.io', 'pybel.io.sbel',
'pygraphviz', 'jnius', 'jnius_config', 'flask',
'objectpath', 'lxml', 'lxml.etree', 'lxml.builder',
'functools32', 'ndex2', 'ndex2.client', 'ndex2.nice_cx_network', | Add more pybel mocks to config | sorgerlab_indra | train | py |
1780a943fd316dcd4af9bde354f02aeff67faa4f | diff --git a/buffalo/cmd/app_generators.go b/buffalo/cmd/app_generators.go
index <HASH>..<HASH> 100644
--- a/buffalo/cmd/app_generators.go
+++ b/buffalo/cmd/app_generators.go
@@ -71,12 +71,14 @@ import (
{{end -}}
)
+var ENV = defaults.String(os.Getenv("GO_ENV"), "development")
+
// App is where all routes and middleware for buffalo
// should be defined. This is the nerve center of your
// application.
func App() http.Handler {
a := buffalo.Automatic(buffalo.Options{
- Env: "development",
+ Env: ENV,
})
{{if .withPop -}} | define ENV at the top of actions/app.go closes #<I> | gobuffalo_buffalo | train | go |
04843b2ce5eefa1d2cf6349b4b8c9713ad8b4186 | diff --git a/master/buildbot/process/buildrequest.py b/master/buildbot/process/buildrequest.py
index <HASH>..<HASH> 100644
--- a/master/buildbot/process/buildrequest.py
+++ b/master/buildbot/process/buildrequest.py
@@ -22,7 +22,7 @@ from buildbot.process import properties
from buildbot.status.results import FAILURE
from buildbot.db import buildrequests
-class SourceStamp(object):
+class TempSourceStamp(object):
# temporary fake sourcestamp; attributes are added below
pass
@@ -107,7 +107,7 @@ class BuildRequest(object):
assert bsdata['sourcestamps'], "buildset must have at least one sourcestamp"
buildrequest.sources = {}
for ssdata in bsdata['sourcestamps']:
- ss = buildrequest.sources[ssdata['codebase']] = SourceStamp()
+ ss = buildrequest.sources[ssdata['codebase']] = TempSourceStamp()
ss.ssid = ssdata['ssid']
ss.branch = ssdata['branch']
ss.revision = ssdata['revision'] | make the temporary SourceStamp more obvious | buildbot_buildbot | train | py |
1fcdbb7d730b5e029e3d8eb9d93d51bb7bf8c8b4 | diff --git a/lib/hydro.js b/lib/hydro.js
index <HASH>..<HASH> 100644
--- a/lib/hydro.js
+++ b/lib/hydro.js
@@ -274,7 +274,7 @@ Hydro.prototype.loadPlugins = function() {
? require(plugins[i])
: plugins[i];
- plugin(this);
+ plugin(this, util);
this.plugins.push(plugin);
}
}; | Supply the utils to plugins, similar to Chai.js | vesln_hydro | train | js |
21be31a19acc1ea9834d49db7eafa97f1e2bd671 | diff --git a/src/datetime-input.js b/src/datetime-input.js
index <HASH>..<HASH> 100644
--- a/src/datetime-input.js
+++ b/src/datetime-input.js
@@ -12,7 +12,9 @@ directive('datetimeInput', ['$document', '$timeout', function ($document, $timeo
format: '=?',
minDate:'=?',
maxDate:'=?',
+ hourStep:'=?',
minuteStep:'=?',
+ secondStep:'=?',
onChange: '&',
placeholder: '@',
cssClass:'@',
diff --git a/src/time-input.js b/src/time-input.js
index <HASH>..<HASH> 100644
--- a/src/time-input.js
+++ b/src/time-input.js
@@ -12,7 +12,9 @@ directive('timeInput', ['$document', '$timeout', function ($document, $timeout)
format: '=?',
minDate:'=?',
maxDate:'=?',
+ hourStep : '=?',
minuteStep : '=?',
+ secondStep : '=?',
onChange: '&',
placeholder: '@',
cssClass:'@', | Added optional hourStep and secondStep attributes to time and datetime directives. | g1eb_angular-datetime-inputs | train | js,js |
fdc6fdfbe6861f424268baf11db678717ee0bf83 | diff --git a/index.js b/index.js
index <HASH>..<HASH> 100644
--- a/index.js
+++ b/index.js
@@ -18,15 +18,13 @@ exports.sync = function (store, router, options) {
var storeUnwatch = store.watch(
function (state) { return state[moduleName] },
function (route) {
- if (route.fullPath === currentPath) {
- return
+ var fullPath = route.fullPath
+ if (fullPath === currentPath) { return }
+ if (currentPath != null) {
+ isTimeTraveling = true
+ router.push(route)
}
- isTimeTraveling = true
- var methodToUse = currentPath == null
- ? 'replace'
- : 'push'
- currentPath = route.fullPath
- router[methodToUse](route)
+ currentPath = fullPath
},
{ sync: true }
) | Avoid calling replace on initial render, fix #<I> (#<I>) | vuejs_vuex-router-sync | train | js |
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.