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
|
---|---|---|---|---|---|
365bf67699e9285c9c59b77d7bd67143f1a6b583 | diff --git a/enrol/imsenterprise/lib.php b/enrol/imsenterprise/lib.php
index <HASH>..<HASH> 100644
--- a/enrol/imsenterprise/lib.php
+++ b/enrol/imsenterprise/lib.php
@@ -748,8 +748,7 @@ function load_role_mappings() {
$this->rolemappings = array();
foreach($imsroles as $imsrolenum=>$imsrolename) {
- $this->rolemappings[$imsrolenum] = $this->rolemappings[$imsrolename]
- = $DB->get_field('config_plugins', 'value', array('name'=>'imsrolemap' . $imsrolenum));
+ $this->rolemappings[$imsrolenum] = $this->rolemappings[$imsrolename] = $this->get_config('imsrolemap' . $imsrolenum);
}
} | MDL-<I> fixed incorrect reading of plugin options in imsenterprise enrol plugin | moodle_moodle | train | php |
fc9df92d52fb1711ce51d2b4e886c4d28a686719 | diff --git a/task/backend/executor/task_executor_test.go b/task/backend/executor/task_executor_test.go
index <HASH>..<HASH> 100644
--- a/task/backend/executor/task_executor_test.go
+++ b/task/backend/executor/task_executor_test.go
@@ -388,8 +388,8 @@ func testMetrics(t *testing.T) {
}
m = promtest.MustFindMetric(t, mg, "task_executor_run_latency_seconds", map[string]string{"task_type": ""})
- if got := *m.Histogram.SampleCount; got != 1 {
- t.Fatalf("expected to count 1 run latency metric, got %v", got)
+ if got := *m.Histogram.SampleCount; got < 1 {
+ t.Fatal("expected to find run latency metric")
}
if got := *m.Histogram.SampleSum; got <= 100 { | fix(tasks): fix flaky run latency metric test (#<I>) | influxdata_influxdb | train | go |
7152a27b96766fe79fbbed0d3766a5e3f8e17f21 | diff --git a/GEOparse/GEOTypes.py b/GEOparse/GEOTypes.py
index <HASH>..<HASH> 100755
--- a/GEOparse/GEOTypes.py
+++ b/GEOparse/GEOTypes.py
@@ -258,7 +258,7 @@ class SimpleGEO(BaseGEO):
summary.append(" " * 40 + "..." + " " * 40 + "\n")
summary.append(" " * 40 + "..." + " " * 40 + "\n")
summary.append(self.table.tail().to_string(header=None) + "\n")
- return "\n".join(summary)
+ return "\n".join([str(s) for s in summary])
def show_columns(self):
"""Print columns in SOFT format.""" | fix: UnicodeDecodeError in head method | guma44_GEOparse | train | py |
05843b903e12e04aae051301b8a6679e003fed88 | diff --git a/src/Illuminate/Notifications/Channels/NexmoSmsChannel.php b/src/Illuminate/Notifications/Channels/NexmoSmsChannel.php
index <HASH>..<HASH> 100644
--- a/src/Illuminate/Notifications/Channels/NexmoSmsChannel.php
+++ b/src/Illuminate/Notifications/Channels/NexmoSmsChannel.php
@@ -55,6 +55,7 @@ class NexmoSmsChannel
}
return $this->nexmo->message()->send([
+ 'type' => 'unicode',
'from' => $message->from ?: $this->from,
'to' => $to,
'text' => trim($message->content), | Adding unicode support
Adding line (type => 'unicode') to support Unicode message for non Latin character | laravel_framework | train | php |
e5427a41dc3bdedb3fa81499bea5507bbaab0293 | diff --git a/spec/server/command_spec.rb b/spec/server/command_spec.rb
index <HASH>..<HASH> 100644
--- a/spec/server/command_spec.rb
+++ b/spec/server/command_spec.rb
@@ -7,7 +7,7 @@ describe Lanes::Command do
let(:app_name) { "appy-app" }
let(:lanes) { Pathname.new(__FILE__).dirname.join('..','..','bin','lanes') }
let(:generated_path) { Pathname.pwd }
- let(:reference_path) { Pathname(__FILE__).dirname.join("command-reference-files") }
+ let(:reference_path) { Pathname(__FILE__).dirname.join("..","command-reference-files") }
around do |test|
Dir.mktmpdir do |dir| | Correct path to testing command skeleton files | argosity_hippo | train | rb |
aebf83b2cd69f5e98d41d797bdcbb138c8eca2ed | diff --git a/client/__init__.py b/client/__init__.py
index <HASH>..<HASH> 100644
--- a/client/__init__.py
+++ b/client/__init__.py
@@ -1,4 +1,4 @@
-__version__ = 'v1.6.16'
+__version__ = 'v1.6.14'
FILE_NAME = 'ok' | Pretend to be <I> for migration | okpy_ok-client | train | py |
0590d9fca80907d8c1583bbdea4dca13a148f590 | diff --git a/Mvc/View.php b/Mvc/View.php
index <HASH>..<HASH> 100644
--- a/Mvc/View.php
+++ b/Mvc/View.php
@@ -181,8 +181,7 @@ class View extends Component implements ViewInterface
try {
$context->content = $this->renderer->render($template, $context->vars);
- if ($context->layout !== false) {
- $layout = $this->findLayout();
+ if (($layout = $this->findLayout()) !== null) {
$context->content = $this->renderer->render($layout, $context->vars);
}
} finally { | refactor ManaPHP\Mvc\View::render | manaphp_framework | train | php |
93faa0c4e8886cee7ee8db3a79c3a09aa9141c10 | diff --git a/course/lib.php b/course/lib.php
index <HASH>..<HASH> 100644
--- a/course/lib.php
+++ b/course/lib.php
@@ -468,7 +468,7 @@ function get_array_of_activities($courseid) {
$mod[$seq]->extra = urlencode("onClick=\"return ".
"openpopup('/mod/resource/view.php?id=".
$mod[$seq]->cm.
- "','resource','$resource->alltext');\"");
+ "','resource$resource->id','$resource->alltext');\"");
}
}
} | Give each popup a resource a unique window | moodle_moodle | train | php |
fc13f5b6cebc25e7cdb7bc72c4a7d3298e2c696a | diff --git a/src/event.js b/src/event.js
index <HASH>..<HASH> 100644
--- a/src/event.js
+++ b/src/event.js
@@ -407,7 +407,7 @@ jQuery.event = {
run_all = !event.exclusive && !event.namespace,
specialHandle = ( jQuery.event.special[ event.type ] || {} ).handle,
handlerQueue = [],
- i, j, cur, ret, selMatch, matches, handleObj, sel, hit, related;
+ i, j, cur, ret, selMatch, matched, matches, handleObj, sel, hit, related;
// Use the fix-ed jQuery.Event rather than the (read-only) native event
args[0] = event; | Fix #<I>. Undeclared `matched` var hosed recursive delegate calls.
Thanks davidmurdoch for staying with this bug! | jquery_jquery | train | js |
b4c7f2cd400625175beea9901a4770b97c3241d8 | diff --git a/lib/svn-fixture.rb b/lib/svn-fixture.rb
index <HASH>..<HASH> 100644
--- a/lib/svn-fixture.rb
+++ b/lib/svn-fixture.rb
@@ -38,10 +38,9 @@ module SvnFixture
val.respond_to?(:strftime) ? svn_time(val) : val
end
- def repo(name, repos_path = nil, &block)
- r = SvnFixture::Repository.get(name, repos_path)
- r.instance_eval(&block) if block_given?
- r
+ # .repo is just a shortcut to +SvnFixture::Repository.get+
+ def repo(*args, &block)
+ SvnFixture::Repository.get(*args, &block)
end
end
end
diff --git a/spec/svn-fixture_spec.rb b/spec/svn-fixture_spec.rb
index <HASH>..<HASH> 100644
--- a/spec/svn-fixture_spec.rb
+++ b/spec/svn-fixture_spec.rb
@@ -35,4 +35,11 @@ describe SvnFixture do
SvnFixture.svn_prop(t).should == 'Test'
end
end
+
+ describe '.repo' do
+ it 'should call Repository.get' do
+ SvnFixture::Repository.should_receive(:get).with('test', '/tmp/repos_test', 'tmp/wc')
+ SvnFixture.repo('test', '/tmp/repos_test', 'tmp/wc')
+ end
+ end
end | Update SvnFixture.repo to simply call SvnFixture::Repository.get
Repository.get now take care of all that .repo had done, but retain the method as a shortcut. | jm81_svn-fixture | train | rb,rb |
5c869227fa3a3248cc30eb6f34c443b75450e9ba | diff --git a/app/models/effective/resources/relation.rb b/app/models/effective/resources/relation.rb
index <HASH>..<HASH> 100644
--- a/app/models/effective/resources/relation.rb
+++ b/app/models/effective/resources/relation.rb
@@ -236,7 +236,7 @@ module Effective
# Order the target model for its matching records / keys
sort_column = (sort unless sort == true) || resource.sort_column
- relation = resource.order(sort_column, direction, limit: limit, reorder: true).limit([limit, 1000].compact.min)
+ relation = resource.order(sort_column, direction, limit: limit, reorder: true).limit(nil)
if association.options[:as] # polymorphic
relation = relation.where(association.type => klass.name) | relation fix for sorting belongs_to columns | code-and-effect_effective_resources | train | rb |
9023f39ca89b2c6326389aa09ed6abfc0898ea87 | diff --git a/web3/providers/ipc.py b/web3/providers/ipc.py
index <HASH>..<HASH> 100644
--- a/web3/providers/ipc.py
+++ b/web3/providers/ipc.py
@@ -218,7 +218,7 @@ class IPCProvider(JSONBaseProvider):
super().__init__()
def __str__(self) -> str:
- return "IPC connection {0}".format(self.ipc_path)
+ return f"<{self.__class__.__name__} {self.ipc_path}>"
def make_request(self, method: RPCEndpoint, params: Any) -> RPCResponse:
self.logger.debug("Making request IPC. Path: %s, Method: %s", | Use f-string and class name | ethereum_web3.py | train | py |
a984f9497bbf80fad088ee241ea4e4e8820e1f2f | diff --git a/frontend-plugin-core/src/main/java/com/github/eirslett/maven/plugins/frontend/lib/ProxyConfig.java b/frontend-plugin-core/src/main/java/com/github/eirslett/maven/plugins/frontend/lib/ProxyConfig.java
index <HASH>..<HASH> 100644
--- a/frontend-plugin-core/src/main/java/com/github/eirslett/maven/plugins/frontend/lib/ProxyConfig.java
+++ b/frontend-plugin-core/src/main/java/com/github/eirslett/maven/plugins/frontend/lib/ProxyConfig.java
@@ -30,11 +30,11 @@ public class ProxyConfig {
}
final URI uri = URI.create(requestUrl);
for (Proxy proxy : proxies) {
- if (proxy.protocol.equals(uri.getScheme()) && !proxy.isNonProxyHost(uri.getHost())) {
+ if (!proxy.isNonProxyHost(uri.getHost())) {
return proxy;
}
}
- LOGGER.info("Could not find matching proxy for protocol {}", uri.getScheme());
+ LOGGER.info("Could not find matching proxy for host: {}" + uri.getHost());
return null;
} | Use proxies more correctly.
ProxyConfig no longer checks the host scheme and compares it to the
configured proxy, it just uses the maven proxy now. | eirslett_frontend-maven-plugin | train | java |
8232204a36712553b9eedb2dacab13b7c38642c6 | diff --git a/src/ruby/bin/interop/test/cpp/interop/test_services.rb b/src/ruby/bin/interop/test/cpp/interop/test_services.rb
index <HASH>..<HASH> 100644
--- a/src/ruby/bin/interop/test/cpp/interop/test_services.rb
+++ b/src/ruby/bin/interop/test/cpp/interop/test_services.rb
@@ -44,6 +44,7 @@ module Grpc
self.marshal_class_method = :encode
self.unmarshal_class_method = :decode
+ self.service_name = 'grpc.testing.TestService'
rpc :EmptyCall, Empty, Empty
rpc :UnaryCall, SimpleRequest, SimpleResponse
diff --git a/src/ruby/bin/math_services.rb b/src/ruby/bin/math_services.rb
index <HASH>..<HASH> 100644
--- a/src/ruby/bin/math_services.rb
+++ b/src/ruby/bin/math_services.rb
@@ -43,6 +43,7 @@ module Math
self.marshal_class_method = :encode
self.unmarshal_class_method = :decode
+ self.service_name = 'math.Math'
rpc :Div, DivArgs, DivReply
rpc :DivMany, stream(DivArgs), stream(DivReply) | Updates the math and interop samples to use the fully-qualified method name.
This bring the ruby GRPC up-to-date with the changes in []
TESTED: math client access math server OK, similarly the passing interop tests continue to pass | grpc_grpc | train | rb,rb |
c301474957d9963689cf4e46eedfb6f16c68c822 | diff --git a/stimela_misc/stimela-test-ngc417.py b/stimela_misc/stimela-test-ngc417.py
index <HASH>..<HASH> 100644
--- a/stimela_misc/stimela-test-ngc417.py
+++ b/stimela_misc/stimela-test-ngc417.py
@@ -498,11 +498,7 @@ recipe.add('cab/casa_plotms', 'plot_amp_phase', {
label='plot_amp_phase:: Plot amplitude vs phase')
-# Remove split target data if it already exists
corr_ms = '12A-405.sb7601493.eb10633016.56086.127048738424-corr.ms'
-if os.path.exists(os.path.join(MSDIR,corr_ms)):
- os.system("rm -rf {0:s}".format(os.path.join(MSDIR,corr_ms)))
-
recipe.add('cab/casa_split', 'split_corr_data',
{
"vis" : MS,
@@ -834,7 +830,6 @@ recipe.run([
"applycal_tar",
"plot_amp_phase",
"split_corr_data",
- "split_corr_data",
'prepms',
'image_target_field_r0',
'image_target_field_r0ddfacet', | remove repeated casa_split call | SpheMakh_Stimela | train | py |
0ff3f914e7e6ce731e45ec1983cd71e241a5ae44 | diff --git a/djed/static/__init__.py b/djed/static/__init__.py
index <HASH>..<HASH> 100644
--- a/djed/static/__init__.py
+++ b/djed/static/__init__.py
@@ -11,21 +11,17 @@ from pyramid.path import AssetResolver
log = logging.getLogger('djed.static')
-class bowerstatic_tween_factory(object):
- def __init__(self, handler, registry):
- self.handler = handler
- self.registry = registry
-
- def __call__(self, request):
- injector_handler = InjectorTween(
- self.registry.bower,
- self.handler)
- publisher_handler = PublisherTween(
- self.registry.bower,
- injector_handler)
+def bowerstatic_tween_factory(handler, registry):
+ bower = registry.bower
+
+ def bowerstatic_tween(request):
+ injector_handler = InjectorTween(bower, handler)
+ publisher_handler = PublisherTween(bower, injector_handler)
return publisher_handler(request)
+ return bowerstatic_tween
+
def init_bower_components(config, path):
resolver = AssetResolver() | closure-returning tween | djedproject_djed.static | train | py |
6f8254afd664e9da5254d8a8bb3aaf191b12b9e0 | diff --git a/test/index-intervals.spec.js b/test/index-intervals.spec.js
index <HASH>..<HASH> 100644
--- a/test/index-intervals.spec.js
+++ b/test/index-intervals.spec.js
@@ -67,7 +67,7 @@ modes.forEach(function(mode) {
.then(function(result) {
expect(result.errors).deep.equal([]);
});
- }, {concurrency: 10})
+ }, {concurrency: 5})
.then(function(results) {
return test_utils.verify_import(points, mode, index);
}) | actually concurrency <I> was too much | juttle_juttle-elastic-adapter | train | js |
5a59cb03cb4b2d3f67f9eada3ddb7f230f8d6716 | diff --git a/test/compat.py b/test/compat.py
index <HASH>..<HASH> 100644
--- a/test/compat.py
+++ b/test/compat.py
@@ -25,8 +25,8 @@ from six import assertCountEqual, PY2
class Py2TestCase(unittest.TestCase):
- def assertCountEqual(self, expected_sequence, actual_sequence):
- return assertCountEqual(self, expected_sequence, actual_sequence)
+ def assertCountEqual(self, expected_sequence, actual_sequence, msg=None):
+ return assertCountEqual(self, expected_sequence, actual_sequence, msg)
if PY2: | Add missing argument to an overridden method
This commit adds msg=None to arguments of
test.compat.Py2TestCase.assertCountEqual method. | piotr-rusin_spam-lists | train | py |
d60ae4af59db1dedcfc000dc045bf2d143b5a46a | diff --git a/src/test/java/org/buildobjects/process/ProcBuilderTest.java b/src/test/java/org/buildobjects/process/ProcBuilderTest.java
index <HASH>..<HASH> 100644
--- a/src/test/java/org/buildobjects/process/ProcBuilderTest.java
+++ b/src/test/java/org/buildobjects/process/ProcBuilderTest.java
@@ -545,7 +545,11 @@ public class ProcBuilderTest {
} catch (ExternalProcessFailureException ex) {
final String[] messageLines = ex.getMessage().split("\n");
- assertEquals("External process `ls` terminated with unexpected exit status 1 after X:", messageLines[0].replaceAll("\\d+ms", "X"));
+ assertEquals("External process `ls` terminated with unexpected exit status X after Yms:",
+ messageLines[0]
+ .replaceAll("status \\d+", "status X") // Exit status differs between gnu and bsd.
+ .replaceAll("\\d+ms", "Yms")
+ );
assertEquals(" $ ls xyz", messageLines[1]);
assertEquals(" STDERR: <Has already been consumed.>", messageLines[2]);
assertTrue(ex.getExitValue() > 0); | Fix build on GNU Linux
ls has different exit status on BSD... | fleipold_jproc | train | java |
d6816a9d4e22664a841e21e60385d65359b60aa0 | diff --git a/spec/random_yiff/cli_spec.rb b/spec/random_yiff/cli_spec.rb
index <HASH>..<HASH> 100644
--- a/spec/random_yiff/cli_spec.rb
+++ b/spec/random_yiff/cli_spec.rb
@@ -47,10 +47,14 @@ describe RandomYiff::Cli do
end
end
- describe '#random_file' do
- it 'rejects flv files' do
- allow(RandomYiff::E621).to receive(:file_ext).and_return('flv')
- expect { RandomYiff::Cli.send(:random_yiff) }.to raise_error
+ describe '#random_image' do
+ subject(:cli) { RandomYiff::Cli.new }
+
+ it 'reinitializes RandomYiff::E621 until it finds an image' do
+ furry_pr0n = double(RandomYiff::E621)
+ expect(RandomYiff::E621).to receive(:new).twice.and_yield(furry_pr0n)
+ expect(furry_pr0n).to receive(:file_ext).twice.and_return('flv', 'jpg')
+ cli.send(:random_image)
end
end
end | Correct tests for RandomYiff::Cli#random_image | JamesAwesome_random_yiff | train | rb |
597a7998963ef88f1eb19a85722fa0eafcfe3f09 | diff --git a/app.go b/app.go
index <HASH>..<HASH> 100644
--- a/app.go
+++ b/app.go
@@ -283,7 +283,7 @@ func (app *App) Set(key, val interface{}) {
app.settings[key] = val
}
-// Env returns app' env. You can set app env with `app.Set(gear.SetEnv, "dome env")`
+// Env returns app' env. You can set app env with `app.Set(gear.SetEnv, "some env")`
// Default to os process "APP_ENV" or "development".
func (app *App) Env() string {
return app.settings[SetEnv].(string) | doc: fix typo
dome => some | teambition_gear | train | go |
a4e5108bac5d45f71d80ea018582a49f87256d8c | diff --git a/couchbase/fulltext.py b/couchbase/fulltext.py
index <HASH>..<HASH> 100644
--- a/couchbase/fulltext.py
+++ b/couchbase/fulltext.py
@@ -926,6 +926,23 @@ class SearchRequest(object):
def raw(self):
return self.__raw
+ def execute(self):
+ """
+ Use this convenience method if you are not actually reading the
+ search hits, for example if you are only using :attr:`facets`.
+
+ Equivalent to::
+
+ def execute(self):
+ [x for x in self]
+ return self
+
+ :return: :class:`SearchRequest` (self)
+ """
+ for _ in self:
+ pass
+ return self
+
@property
def meta(self):
""" | Add SearchRequest.execute()
This allows exhausting the iterator and can be used to do facet-only
queries
Change-Id: I<I>aa<I>a<I>ff0dad<I>a<I>a<I>e5a<I>bc<I>
Reviewed-on: <URL> | couchbase_couchbase-python-client | train | py |
90ac694e99e89df3e7d62157822dbee1842ca98d | diff --git a/ExistingServiceException.php b/ExistingServiceException.php
index <HASH>..<HASH> 100644
--- a/ExistingServiceException.php
+++ b/ExistingServiceException.php
@@ -16,8 +16,6 @@ namespace Sylius\Component\Registry;
/**
* This exception should be thrown by service registry
* when given type already exists.
- *
- * @author Saša Stamenković <[email protected]>
*/
class ExistingServiceException extends \InvalidArgumentException
{
diff --git a/NonExistingServiceException.php b/NonExistingServiceException.php
index <HASH>..<HASH> 100644
--- a/NonExistingServiceException.php
+++ b/NonExistingServiceException.php
@@ -16,8 +16,6 @@ namespace Sylius\Component\Registry;
/**
* This exception should be thrown by service registry
* when given service type does not exist.
- *
- * @author Saša Stamenković <[email protected]>
*/
class NonExistingServiceException extends \InvalidArgumentException
{
diff --git a/ServiceRegistry.php b/ServiceRegistry.php
index <HASH>..<HASH> 100644
--- a/ServiceRegistry.php
+++ b/ServiceRegistry.php
@@ -15,8 +15,6 @@ namespace Sylius\Component\Registry;
/**
* Cannot be final, because it is proxied
- *
- * @author Paweł Jędrzejewski <[email protected]>
*/
class ServiceRegistry implements ServiceRegistryInterface
{ | Remove the remaining author docblocks | Sylius_Registry | train | php,php,php |
52d0c994e2bcd772355c81c09689687f1b74a4c3 | diff --git a/xds/src/main/java/io/grpc/xds/XdsClientImpl.java b/xds/src/main/java/io/grpc/xds/XdsClientImpl.java
index <HASH>..<HASH> 100644
--- a/xds/src/main/java/io/grpc/xds/XdsClientImpl.java
+++ b/xds/src/main/java/io/grpc/xds/XdsClientImpl.java
@@ -699,11 +699,11 @@ final class XdsClientImpl extends XdsClient {
errorMessage = "Cluster without any locality endpoint.";
break;
}
+
// The policy.disable_overprovisioning field must be set to true.
- if (!assignment.getPolicy().getDisableOverprovisioning()) {
- errorMessage = "Cluster requires overprovisioning.";
- break;
- }
+ // TODO(chengyuanzhang): temporarily not requiring this field to be set, should push
+ // server implementors to do this or TBD with design.
+
for (io.envoyproxy.envoy.api.v2.endpoint.LocalityLbEndpoints localityLbEndpoints
: assignment.getEndpointsList()) {
// The lb_endpoints field for LbEndpoint must contain at least one entry. | xds: temporarily allow policy.disable_overprovisioning flag to be not set in EDS responses (#<I>) | grpc_grpc-java | train | java |
cd787f3bd6f1afb2ec170249e9165c2986f88f24 | diff --git a/index.js b/index.js
index <HASH>..<HASH> 100644
--- a/index.js
+++ b/index.js
@@ -38,9 +38,11 @@ module.exports = function(options) {
tools.revReferencesInFile(file, options.rootDir);
}
- var filenameReved = path.basename(tools.revFile(file.path));
- var base = path.dirname(file.path);
- file.path = path.join(base, filenameReved);
+ if (path.extname(file.path) !== '.html') {
+ var filenameReved = path.basename(tools.revFile(file.path));
+ var base = path.dirname(file.path);
+ file.path = path.join(base, filenameReved);
+ }
callback(null, file); | Skip rev of a filename that ends in html | smysnk_gulp-rev-all | train | js |
ab9227d9fde0b1d9d573ca2bf0a54a627da786d9 | diff --git a/autofit/message_passing/fascade.py b/autofit/message_passing/fascade.py
index <HASH>..<HASH> 100644
--- a/autofit/message_passing/fascade.py
+++ b/autofit/message_passing/fascade.py
@@ -6,40 +6,41 @@ from .messages import NormalMessage, AbstractMessage
class VariableGroup:
- def __init__(self, variable, factor, message):
+ def __init__(self, variable, prior):
self.variable = variable
- self.factor = factor
- self.message = message
+ self.factor = Factor(
+ prior,
+ x=variable
+ )
+ self.message = NormalMessage.from_prior(
+ prior
+ )
class MeanFieldPriorModel:
def __init__(
self,
model,
- **priors
+ **kwargs
):
self._model = model
self._variable_groups = dict()
- for name, prior in priors.items():
- variable = getattr(
- model,
- name
- )
- factor = Factor(
- prior,
- x=variable
- )
- message = NormalMessage.from_prior(
- prior
- )
+ for name, item in kwargs.items():
+ if isinstance(item, VariableGroup):
+ group = item
+ else:
+ variable = getattr(
+ model,
+ name
+ )
+ group = VariableGroup(
+ variable,
+ item
+ )
self._variable_groups[
name
- ] = VariableGroup(
- variable,
- factor,
- message
- )
+ ] = group
@property
def model(self): | handle variable groups being passed in as arguments | rhayes777_PyAutoFit | train | py |
954b83e2af0bb2ea39b6f832e93fec1cb43d5f60 | diff --git a/h2o-core/src/main/java/water/fvec/RebalanceDataSet.java b/h2o-core/src/main/java/water/fvec/RebalanceDataSet.java
index <HASH>..<HASH> 100644
--- a/h2o-core/src/main/java/water/fvec/RebalanceDataSet.java
+++ b/h2o-core/src/main/java/water/fvec/RebalanceDataSet.java
@@ -111,7 +111,7 @@ public class RebalanceDataSet extends H2O.H2OCountedCompleter {
assert src.len() == srcRaw.len();
int srcFrom = (int)(chk._start+ dst.len() - src._start);
// check if the result is sparse (not exact since we only take subset of training_frame in general)
- if((src.sparse() && dst.sparse()) || (src.sparseLen() + dst.sparseLen() < NewChunk.MIN_SPARSE_RATIO*(src.len() + dst.len()))){
+ if ((src.sparse() && dst.sparse()) || ((src.sparseLen() + dst.sparseLen()) * NewChunk.MIN_SPARSE_RATIO < (src.len() + dst.len()))) {
src.set_sparse(src.sparseLen());
dst.set_sparse(dst.sparseLen());
} | HEX-<I>: Fix logic to determine whether the chunks are to be treated as sparse. | h2oai_h2o-3 | train | java |
1c4ce586e1f6b016962986267c42e26be2f57c88 | diff --git a/spec/unit/feature_unit_spec.rb b/spec/unit/feature_unit_spec.rb
index <HASH>..<HASH> 100644
--- a/spec/unit/feature_unit_spec.rb
+++ b/spec/unit/feature_unit_spec.rb
@@ -111,6 +111,21 @@ describe 'Feature, Unit' do
feature.test_count.should == 2
end
+ it 'can selectively access its scenarios' do
+ expect(feature).to respond_to(:scenarios)
+ end
+
+ it 'can selectively access its outlines' do
+ expect(feature).to respond_to(:outlines)
+ end
+
+ it 'finds no scenarios or outlines when it has no tests' do
+ feature.tests = []
+
+ expect(feature.scenarios).to be_empty
+ expect(feature.outlines).to be_empty
+ end
+
it 'contains backgrounds and tests' do
tests = [:test_1, :test_2]
background = :a_background | Adding some more tests.
Added some tests that make explicit behavior that was previously only
implied. | enkessler_cuke_modeler | train | rb |
8d224e7d30bc2d8191d282ee977aa889f70bd445 | diff --git a/webdriverwrapper/testcase.py b/webdriverwrapper/testcase.py
index <HASH>..<HASH> 100644
--- a/webdriverwrapper/testcase.py
+++ b/webdriverwrapper/testcase.py
@@ -38,7 +38,7 @@ class WebdriverTestCase(unittest.TestCase):
result = self.defaultTestResult()
result.startTest(self)
test_method = getattr(self, self._testMethodName)
- self.__test_method = test_method
+ self._test_method = test_method
try:
self._set_up()
@@ -113,7 +113,7 @@ class WebdriverTestCase(unittest.TestCase):
self._check_js_errors()
# Check for any error message only if there isn't decorator which
#+ already checked it.
- if not getattr(self.__test_method, '__should_be_error__', False):
+ if not getattr(self._test_method, '__should_be_error__', False):
self._check_error_messages()
def _check_js_errors(self): | Test method can be used in child classes | horejsek_python-webdriverwrapper | train | py |
b81b2fb84972260419d47748674248dbcb963b7e | diff --git a/src/Someline/Model/Foundation/User.php b/src/Someline/Model/Foundation/User.php
index <HASH>..<HASH> 100644
--- a/src/Someline/Model/Foundation/User.php
+++ b/src/Someline/Model/Foundation/User.php
@@ -12,6 +12,8 @@ use Illuminate\Contracts\Auth\Access\Authorizable as AuthorizableContract;
use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract;
use Illuminate\Contracts\Auth\CanResetPassword as CanResetPasswordContract;
use Illuminate\Foundation\Auth\Access\Authorizable;
+use Illuminate\Notifications\Notifiable;
+use Laravel\Passport\HasApiTokens;
use Prettus\Repository\Contracts\Transformable;
use Prettus\Repository\Traits\TransformableTrait;
use Someline\Base\Models\BaseModel;
@@ -25,6 +27,7 @@ class User extends BaseModel implements BaseModelEventsInterface,
{
use Authenticatable, Authorizable, CanResetPassword;
use TransformableTrait;
+ use HasApiTokens, Notifiable;
/**
* Indicates if the model should be auto set user_id. | Update User with support of Laravel/Passport | someline_starter-framework | train | php |
f4b2899f6022e43a124d712c89383eecb6050f50 | diff --git a/tests/test_store_mongodb.py b/tests/test_store_mongodb.py
index <HASH>..<HASH> 100644
--- a/tests/test_store_mongodb.py
+++ b/tests/test_store_mongodb.py
@@ -100,7 +100,7 @@ def test_find():
meta, things = store.find()
assert meta['total'] == 4
assert meta['page'] == 1
- assert meta['pages'] == 0
+ assert meta['pages'] == 1
assert len(things) == 4
meta, things = store.find(page_size=2, paginate_if_longer_than=2)
diff --git a/thingstance/stores/mongodb.py b/thingstance/stores/mongodb.py
index <HASH>..<HASH> 100644
--- a/thingstance/stores/mongodb.py
+++ b/thingstance/stores/mongodb.py
@@ -39,7 +39,7 @@ class MongoStore(Store):
total = self.things.find(query).count()
if total < paginate_if_longer_than:
page_size = total
- pages = 0
+ pages = 1
else:
pages = math.ceil(total/page_size)
if page == 1: | Fix bug in pagination.
Number of pages should be 1, not 0, for datasets that don't paginate. | openregister_openregister-python | train | py,py |
3ada932f1436187d22a91caf93dae4346a3bc3cc | diff --git a/lifxlan/multizonelight.py b/lifxlan/multizonelight.py
index <HASH>..<HASH> 100644
--- a/lifxlan/multizonelight.py
+++ b/lifxlan/multizonelight.py
@@ -11,7 +11,7 @@ from .msgtypes import MultiZoneGetColorZones, MultiZoneSetColorZones, MultiZoneS
class MultiZoneLight(Light):
def __init__(self, mac_addr, ip_addr, service=1, port=56700, source_id=0, verbose=False):
- super(MultiZoneLight, self).__init__(mac_addr, ip_addr)
+ super(MultiZoneLight, self).__init__(mac_addr, ip_addr, service, port, source_id, verbose)
# 0 indexed, inclusive
def get_color_zones(self, start=0, end=255): | Update multizonelight.py
Fix for discovery of multizone lights - without this, the GetStatus response is not recognized and operations on the lamp raise exceptions | mclarkk_lifxlan | train | py |
a9aec3e8fec8e6ab2339fee462dca06bdac9371d | diff --git a/src/DatabaseDriver.php b/src/DatabaseDriver.php
index <HASH>..<HASH> 100644
--- a/src/DatabaseDriver.php
+++ b/src/DatabaseDriver.php
@@ -1885,4 +1885,15 @@ abstract class DatabaseDriver implements DatabaseInterface, Log\LoggerAwareInter
* @throws \RuntimeException
*/
public abstract function unlockTables();
+
+ /**
+ * Method to get the database connection collation, as reported by the driver. If the connector doesn't support
+ * reporting this value please return an empty string.
+ *
+ * @return string
+ */
+ public function getConnectionCollation()
+ {
+ return '';
+ }
} | add to base class
method added to base class | joomla-framework_database | train | php |
b2a3d6583ab669ed57e1d110ae86044028670ba2 | diff --git a/downhill/base.py b/downhill/base.py
index <HASH>..<HASH> 100644
--- a/downhill/base.py
+++ b/downhill/base.py
@@ -1,3 +1,5 @@
+# -*- coding: utf-8 -*-
+
'''This module defines a base class for optimization techniques.'''
import climate | Declare a source encoding. | lmjohns3_downhill | train | py |
82c14453aa0fb589e032728cd242e0625426bd3d | diff --git a/lib/hub/commands.rb b/lib/hub/commands.rb
index <HASH>..<HASH> 100644
--- a/lib/hub/commands.rb
+++ b/lib/hub/commands.rb
@@ -57,6 +57,12 @@ module Hub
args[0, 1] = expanded_args if expanded_args
send(cmd, args)
end
+ rescue Errno::ENOENT
+ if $!.message.include? "No such file or directory - git"
+ abort "Error: `git` command not found"
+ else
+ raise
+ end
end
# $ hub clone rtomayko/tilt | avoid ugly error & stack trace when git is not found on the system | github_hub | train | rb |
59918772c9433f3cfb603deec38ad11744520bf3 | diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -45,7 +45,7 @@ properties = dict(
],
extras_require = {
'raml': [
- 'pyraml-parser>=0.0.5',
+ 'pyraml-parser>=0.1.5',
],
'yaml': [
'PyYAML>=3.11', | fix: update dependencies to support python 3 | salsita_pydataloader | train | py |
31cf182783bef3f057a062a4575cf97f875d08e7 | diff --git a/qiskit/version.py b/qiskit/version.py
index <HASH>..<HASH> 100644
--- a/qiskit/version.py
+++ b/qiskit/version.py
@@ -19,6 +19,7 @@
import os
import subprocess
import sys
+import warnings
ROOT_DIR = os.path.dirname(os.path.abspath(__file__))
@@ -38,10 +39,11 @@ def _minimal_ext_cmd(cmd):
proc = subprocess.Popen(cmd, stdout=subprocess.PIPE,
stderr=subprocess.PIPE, env=env,
cwd=os.path.join(os.path.dirname(ROOT_DIR)))
- out = proc.communicate()[0]
+ stdout, stderr = proc.communicate()
if proc.returncode > 0:
- raise OSError
- return out
+ raise OSError('Command {} exited with code {}: {}'.format(
+ cmd, proc.returncode, stderr.strip().decode('ascii')))
+ return stdout
def git_version():
@@ -110,7 +112,8 @@ def _get_qiskit_versions():
cmd = [sys.executable, '-m', 'pip', 'freeze']
try:
reqs = _minimal_ext_cmd(cmd)
- except Exception:
+ except Exception as exc:
+ warnings.warn(str(exc))
return out_dict
reqs_dict = {}
for req in reqs.split(): | Capture and raise with stderr on minimal_ext_cmd failure. (#<I>)
* Capture and raise with stderr on minimal_ext_cmd failure.
* Output pip failure as warning
* Fix pylint pedantry | Qiskit_qiskit-terra | train | py |
b3612cd9675af1a70675e01f101022fe132e06f6 | diff --git a/src/Target/DrushTarget.php b/src/Target/DrushTarget.php
index <HASH>..<HASH> 100644
--- a/src/Target/DrushTarget.php
+++ b/src/Target/DrushTarget.php
@@ -33,7 +33,8 @@ class DrushTarget extends Target implements DrushInterface, ExecInterface {
$key = str_replace('@', '', $target_data);
$this->options = isset($options[$key]) ? $options[$key] : array_shift($options);
- if (isset($this->options['uri'])) {
+ // Set the URI from the Drush alias if it hasn't been manually set already.
+ if (!isset($this->uri) && isset($this->options['uri'])) {
$this->setGlobalDefaultOption('uri', $this->options['uri']);
} | Allow Drutiny to override drush alias set URIs | drutiny_drutiny | train | php |
246308e5e0dc7744ff7cdf101c0664c01e72cbc6 | diff --git a/src/feat/test/integration/test_simulation_service_discovery.py b/src/feat/test/integration/test_simulation_service_discovery.py
index <HASH>..<HASH> 100644
--- a/src/feat/test/integration/test_simulation_service_discovery.py
+++ b/src/feat/test/integration/test_simulation_service_discovery.py
@@ -52,7 +52,7 @@ class Agent(agent.BaseAgent):
return self.discover_service(Initiator)
[email protected](timescale=0.03)
[email protected](timescale=0.1)
class ServiceDiscoverySimulation(common.SimulationTest):
@defer.inlineCallbacks | Adjust timescale of a test failing replayability on buildbot. | f3at_feat | train | py |
660f3483b0537b97c9aeb0972f305b54e911a8cf | diff --git a/scripts/performance/perf_spike_load.py b/scripts/performance/perf_spike_load.py
index <HASH>..<HASH> 100644
--- a/scripts/performance/perf_spike_load.py
+++ b/scripts/performance/perf_spike_load.py
@@ -54,9 +54,10 @@ def spikes(test_config, spike_fn):
total_test_time = test_config["profile"]["total_time_in_seconds"]
spike_time = test_config["profile"]["spike_time_in_seconds"]
interval = 0
- if spike_fn == "run_stepwise_process":
+ spike_mode = test_config["processes"]["spike"]["mode"]
+ if spike_mode == "stepwise":
interval = test_config["profile"]["rest_time_in_seconds"]
- elif spike_fn == "run_stable_process":
+ elif spike_mode == "stable":
interval = test_config["profile"]["rest_time_in_seconds"] + spike_time
if total_test_time == 0:
while True: | Fixed an error when spikes were called multiple times. | hyperledger_indy-node | train | py |
8136690226b11bf58fcdd6f4d023afbea07e4062 | diff --git a/openquake/baselib/workerpool.py b/openquake/baselib/workerpool.py
index <HASH>..<HASH> 100644
--- a/openquake/baselib/workerpool.py
+++ b/openquake/baselib/workerpool.py
@@ -150,9 +150,11 @@ class WorkerPool(object):
:param sock: a zeromq.Socket of kind PULL receiving (cmd, args)
"""
setproctitle('oq-zworker')
+ taskno = 0
with sock:
- for cmd, args, mon in sock:
- parallel.safely_call(cmd, args, mon)
+ for cmd, args, taskno, mon in sock:
+ parallel.safely_call(cmd, args, taskno, mon)
+ taskno += 1
def start(self):
""" | Fix in the workerpool [skip CI] | gem_oq-engine | train | py |
6345b17d7c610090b76605c977265a4d6c752f59 | diff --git a/pymbar/mbar_solvers.py b/pymbar/mbar_solvers.py
index <HASH>..<HASH> 100644
--- a/pymbar/mbar_solvers.py
+++ b/pymbar/mbar_solvers.py
@@ -277,7 +277,7 @@ def adaptive(u_kn, N_k, f_k, tol=1.0e-10, options = {'verbose':False,'maximum_it
for iteration in range(0, options['maximum_iterations']):
g = mbar_gradient(u_kn, N_k, f_k) # Objective function gradient
H = mbar_hessian(u_kn, N_k, f_k) # Objective function hessian
- Hinvg = np.linalg.lstsq(H, g)[0]
+ Hinvg = np.linalg.lstsq(H, g, rcond=-1)[0]
Hinvg -= Hinvg[0]
f_nr = f_k - gamma * Hinvg | fix for rcond problem on Travis. | choderalab_pymbar | train | py |
bab4b0bcaad2230a870a352e6c43006d172b3473 | diff --git a/pug/miner/forms.py b/pug/miner/forms.py
index <HASH>..<HASH> 100644
--- a/pug/miner/forms.py
+++ b/pug/miner/forms.py
@@ -25,7 +25,7 @@ class GetLagForm(forms.Form):
max_length=256,
label='Refurb Account',
initial='',
- help_text="e.g. 113656, 100479, 105158",
+ help_text="e.g. dealer, 113656, not 100479",
)
exclude = forms.ChoiceField(
@@ -40,7 +40,7 @@ class GetLagForm(forms.Form):
max_length=128,
label='R-Code',
initial='',
- help_text='e.g. "R11, R12, R13"',
+ help_text='e.g. "logistics, not R12, R13"',
)
min_lag = forms.CharField(required=False, | add help text to suggest strings instead of numbers for accounts and R-codes | hobson_pug | train | py |
37eb5ccb62fcf973e55b5dfb19e57028586a1cd4 | diff --git a/tests/testhelpers.py b/tests/testhelpers.py
index <HASH>..<HASH> 100644
--- a/tests/testhelpers.py
+++ b/tests/testhelpers.py
@@ -319,6 +319,7 @@ class SpecSignatureTest(unittest2.TestCase):
@unittest2.expectedFailure
def test_create_autospec_unbound_methods(self):
+ # see issue 128
class Foo(object):
def foo(self):
pass
diff --git a/tests/testmock.py b/tests/testmock.py
index <HASH>..<HASH> 100644
--- a/tests/testmock.py
+++ b/tests/testmock.py
@@ -1186,7 +1186,6 @@ class MockTest(unittest2.TestCase):
self.assertEqual(mock.mock_calls, [call(), call()()])
- @unittest2.expectedFailure
def test_manager_mock(self):
class Foo(object):
one = 'one'
@@ -1200,8 +1199,8 @@ class MockTest(unittest2.TestCase):
mock_two = p2.start()
self.addCleanup(p2.stop)
- manager.one = mock_one
- manager.two = mock_two
+ manager.attach_mock(mock_one, 'one')
+ manager.attach_mock(mock_two, 'two')
Foo.two()
Foo.one() | Removing one expectedFailure and adding one | testing-cabal_mock | train | py,py |
ac5fec9254ca17fc7f8a428493266424b3a1e301 | diff --git a/pyxel/cli.py b/pyxel/cli.py
index <HASH>..<HASH> 100644
--- a/pyxel/cli.py
+++ b/pyxel/cli.py
@@ -59,6 +59,7 @@ def _launch_pyxel_app(pyxel_app_file):
startup_script_file = os.path.join(
os.path.dirname(setting_file), f.read()
)
+ sys.path.append(os.path.dirname(startup_script_file))
runpy.run_path(startup_script_file)
return
@@ -69,6 +70,7 @@ def _launch_pyxel_app(pyxel_app_file):
def _run_python_script(python_script_file):
python_script_file = _complete_extension(python_script_file, ".py")
_check_file_exists(python_script_file)
+ sys.path.append(os.path.dirname(python_script_file))
runpy.run_path(python_script_file) | Changed to add import path when runs scripts | kitao_pyxel | train | py |
30b060d2ce60d6cb5ead4bc4dd127b528618c7ed | diff --git a/tests/test_bot_filter.py b/tests/test_bot_filter.py
index <HASH>..<HASH> 100644
--- a/tests/test_bot_filter.py
+++ b/tests/test_bot_filter.py
@@ -26,7 +26,7 @@ class TestBotFilter(TestBot):
self.bot.filter_users = filter_users
self.bot.filter_business_accounts = filter_business_accounts
self.bot.filter_verified_accounts = filter_verified_accounts
- self.bot.following = [1]
+ self.bot._following = [1]
user_id = TEST_USERNAME_INFO_ITEM['pk']
TEST_USERNAME_INFO_ITEM['is_verified'] = True | Fix tests, self.following cannot be set, instead use self._following | instagrambot_instabot | train | py |
90b992f0959ab7873b904c2ef5b3e9fbd888e66f | diff --git a/core-bundle/src/Resources/contao/dca/tl_content.php b/core-bundle/src/Resources/contao/dca/tl_content.php
index <HASH>..<HASH> 100644
--- a/core-bundle/src/Resources/contao/dca/tl_content.php
+++ b/core-bundle/src/Resources/contao/dca/tl_content.php
@@ -520,7 +520,7 @@ $GLOBALS['TL_DCA']['tl_content'] = array
'label' => &$GLOBALS['TL_LANG']['tl_content']['multiSRC'],
'exclude' => true,
'inputType' => 'fileTree',
- 'eval' => array('multiple'=>true, 'fieldType'=>'checkbox', 'orderField'=>'orderSRC', 'files'=>true, 'mandatory'=>true),
+ 'eval' => array('multiple'=>true, 'fieldType'=>'checkbox', 'orderField'=>'orderSRC', 'files'=>true),
'sql' => "blob NULL",
'load_callback' => array
( | Do not make tl_content.multiSRC mandatory (see #<I>) | contao_contao | train | php |
9022e8a155242d6367026c4272c00238bda241cd | diff --git a/lib/sparkpost_rails/exceptions.rb b/lib/sparkpost_rails/exceptions.rb
index <HASH>..<HASH> 100644
--- a/lib/sparkpost_rails/exceptions.rb
+++ b/lib/sparkpost_rails/exceptions.rb
@@ -1,4 +1,4 @@
module SparkPostRails
- class DeliveryException < Exception
+ class DeliveryException < StandardError
end
end | Use StandardError instead of Exception. Exception will result in bad things like the standard rescue not working and bad things like queue managers dying (delayed_job does for sure) | the-refinery_sparkpost_rails | train | rb |
c174ac15159fe42879845eb7a2ebe2f8e05b6c86 | diff --git a/src/Illuminate/Database/Eloquent/Builder.php b/src/Illuminate/Database/Eloquent/Builder.php
index <HASH>..<HASH> 100755
--- a/src/Illuminate/Database/Eloquent/Builder.php
+++ b/src/Illuminate/Database/Eloquent/Builder.php
@@ -191,7 +191,9 @@ class Builder
}
/**
- * An alias for the "value" method.
+ * Get a single column's value from the first result of a query.
+ *
+ * This is an alias for the "value" method.
*
* @param string $column
* @return mixed
diff --git a/src/Illuminate/Database/Query/Builder.php b/src/Illuminate/Database/Query/Builder.php
index <HASH>..<HASH> 100755
--- a/src/Illuminate/Database/Query/Builder.php
+++ b/src/Illuminate/Database/Query/Builder.php
@@ -1307,7 +1307,9 @@ class Builder
}
/**
- * Alias for the "value" method.
+ * Get a single column's value from the first result of a query.
+ *
+ * This is an alias for the "value" method.
*
* @param string $column
* @return mixed | Corrected the phpdoc for the database pluck methods | laravel_framework | train | php,php |
7403a38ab70610683c93cafdd27ebceaf8206b89 | diff --git a/core/blockchain.go b/core/blockchain.go
index <HASH>..<HASH> 100644
--- a/core/blockchain.go
+++ b/core/blockchain.go
@@ -554,7 +554,7 @@ func (bc *BlockChain) setHeadBeyondRoot(head uint64, root common.Hash, repair bo
// Degrade the chain markers if they are explicitly reverted.
// In theory we should update all in-memory markers in the
// last step, however the direction of SetHead is from high
- // to low, so it's safe the update in-memory markers directly.
+ // to low, so it's safe to update in-memory markers directly.
bc.currentBlock.Store(newHeadBlock)
headBlockGauge.Update(int64(newHeadBlock.NumberU64()))
} | core: fix a typo (#<I>) | ethereum_go-ethereum | train | go |
c75b24ae9c159ca0804554306731774959d4ae61 | diff --git a/examples/mlgtv/main.rb b/examples/mlgtv/main.rb
index <HASH>..<HASH> 100644
--- a/examples/mlgtv/main.rb
+++ b/examples/mlgtv/main.rb
@@ -86,11 +86,11 @@ loop do
"Call of Duty: Modern Warfare Remastered" => "cod4",
"Call of Duty 4: Modern Warfare" => "cod4",
"Call of Duty: Modern Warfare 3" => "codmw3",
- "Call of Duty: Black Ops" => "codbo",
+ "Call of Duty: Black Ops" => "codbo12",
"Call of Duty: Black Ops II" => "codbo2",
"Call of Duty: Black Ops III" => "codbo3",
"Call of Duty: Advanced Warfare" => "codaw",
- "Call of Duty: Ghosts" => "codghosts",
+ "Call of Duty: Ghosts" => "codghosts2",
"Call of Duty: World at War" => "codwaw",
"Call of Duty: WWII" => "codwwii",
"Modern Warfare 2" => "codmw2", | expanding iiEviNii's fix to Twitch half | Nakilon_reddit_bot | train | rb |
5fc14dcb8fd126148378a78352bf59254f1495d7 | diff --git a/Form/InteractionQCMHandler.php b/Form/InteractionQCMHandler.php
index <HASH>..<HASH> 100644
--- a/Form/InteractionQCMHandler.php
+++ b/Form/InteractionQCMHandler.php
@@ -103,6 +103,7 @@ class InteractionQCMHandler
//On persite tous les hints de l'entité interaction
foreach ($interQCM->getInteraction()->getHints() as $hint) {
+ $hint->setPenalty(ltrim($hint->getPenalty(), '-'));
$interQCM->getInteraction()->addHint($hint);
$this->em->persist($hint);
} | [ExoBundle] to delete the caracter "-" in the penalty to record the hints | claroline_Distribution | train | php |
56c67c76bcf583820a77eca7a6a149cecd266ebb | diff --git a/fluent_contents/static/fluent_contents/admin/cp_plugins.js b/fluent_contents/static/fluent_contents/admin/cp_plugins.js
index <HASH>..<HASH> 100644
--- a/fluent_contents/static/fluent_contents/admin/cp_plugins.js
+++ b/fluent_contents/static/fluent_contents/admin/cp_plugins.js
@@ -394,7 +394,8 @@ var cp_plugins = {};
for( var i = 0; i < placeholders.length; i++ )
{
var placeholder = placeholders[i];
- if( placeholder.id == dominfo.placeholder_id || placeholder.slot == dominfo.placeholder_slot )
+ if( (placeholder.id && placeholder.id == dominfo.placeholder_id)
+ || (placeholder.slot && placeholder.slot == dominfo.placeholder_slot) )
continue;
html += '<li><a href="#' + placeholder.slot + '">' + placeholder.title + '</a></li>'; | Fix moving item from orphaned tab to new tab
Both new tab an orphaned tab have no ID,
not should not match as being the same object. | django-fluent_django-fluent-contents | train | js |
87e3b7c61c6cde578a3c04e33f0a0c0fb0c4842c | diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100755
--- a/setup.py
+++ b/setup.py
@@ -23,7 +23,7 @@ from setuptools.command.install import install
DESCRIPTION = "Icetea - test framework"
OWNER_NAMES = "Jussi Vatjus-Anttila"
OWNER_EMAILS = "[email protected]"
-VERSION = "1.2.1"
+VERSION = "1.2.2"
def read(fname): | Updated version number to <I> (#<I>) | ARMmbed_icetea | train | py |
cfcb1d2d24935c1bc60196bc351d9f086f9e9dc8 | diff --git a/SpiffWorkflow/bpmn/specs/event_definitions.py b/SpiffWorkflow/bpmn/specs/event_definitions.py
index <HASH>..<HASH> 100644
--- a/SpiffWorkflow/bpmn/specs/event_definitions.py
+++ b/SpiffWorkflow/bpmn/specs/event_definitions.py
@@ -176,7 +176,6 @@ class CancelEventDefinition(CatchingEventDefinition):
:param message: The message to wait for.
"""
- # breakpoint()
self.message = message
self.name = name
@@ -188,7 +187,10 @@ class CancelEventDefinition(CatchingEventDefinition):
return my_task._get_internal_data('event_fired', False)
def _message_ready(self, my_task):
- return ('CancelEvent', None)
+ waiting_messages = my_task.workflow.task_tree.internal_data.get('cancels',{})
+ if ('TokenReset' in waiting_messages.keys()) :
+ return ('TokenReset', None)
+ return False
def _accept_message(self, my_task, message):
if message != self.message: | Fixed _message_ready. It was set to fire Cancel events all the time, not just when we want | knipknap_SpiffWorkflow | train | py |
bfc5dfc74b20222771e11bfd8aab2b32a2472363 | diff --git a/reformulation-core/src/main/java/it/unibz/inf/ontop/owlrefplatform/core/srcquerygeneration/SQLGenerator.java b/reformulation-core/src/main/java/it/unibz/inf/ontop/owlrefplatform/core/srcquerygeneration/SQLGenerator.java
index <HASH>..<HASH> 100644
--- a/reformulation-core/src/main/java/it/unibz/inf/ontop/owlrefplatform/core/srcquerygeneration/SQLGenerator.java
+++ b/reformulation-core/src/main/java/it/unibz/inf/ontop/owlrefplatform/core/srcquerygeneration/SQLGenerator.java
@@ -679,7 +679,7 @@ public class SQLGenerator implements SQLQueryGenerator {
* Escapes view names.
*/
private static String escapeName(String name) {
- return name.replace('.', '_').replace(':', '_').replace('/', '_');
+ return name.replace('.', '_').replace(':', '_').replace('/', '_').replace(' ', '_');
}
/*** | Replace space in view names by underscore. | ontop_ontop | train | java |
1f023a1614b85782f1840c57005c3fd85e29dfc6 | diff --git a/src/activation.js b/src/activation.js
index <HASH>..<HASH> 100644
--- a/src/activation.js
+++ b/src/activation.js
@@ -183,7 +183,7 @@ function shouldContinue(output, router) {
}
if(typeof output === 'string') {
- return affirmations.indexOf(value.toLowerCase()) !== -1;
+ return affirmations.indexOf(output.toLowerCase()) !== -1;
}
if(typeof output === 'undefined') { | fix(shouldContinue): typo change value to output | aurelia_router | train | js |
b3f94ef40fe2763a44af7e16639d7a221a2f380f | diff --git a/babelfish/country.py b/babelfish/country.py
index <HASH>..<HASH> 100644
--- a/babelfish/country.py
+++ b/babelfish/country.py
@@ -65,7 +65,7 @@ class Country(object):
:rtype: :class:`Country`
"""
- return cls(*get_country_converter(converter).reverse(code))
+ return cls(get_country_converter(converter).reverse(code))
def __getattr__(self, name):
return get_country_converter(name).convert(self.alpha2) | Revert incorrect changes to fromcode in Country | Diaoul_babelfish | train | py |
c74330f75eb4dc79be5ce26a77753ea74c7b0337 | diff --git a/public/js/editors/editors.js b/public/js/editors/editors.js
index <HASH>..<HASH> 100644
--- a/public/js/editors/editors.js
+++ b/public/js/editors/editors.js
@@ -72,7 +72,7 @@ panels.restore = function () {
// the panel name of 'output' and the shortcut 'live'.
// it also strips out prop=value& to avoid bashing the
// panel name
- toopen = (search || hash).replace(/\b([^&=]*)=([^&=]*)\b/g, '').replace(/&/g, '').split(',');
+ toopen = (search || hash).replace(/\b([^&=]*)=([^&=]*)/g, '').replace(/&/g, '').split(',');
if (toopen.indexOf('output') !== -1) {
toopen.push('live'); | fixed embed panel opening when url is dodgy | jsbin_jsbin | train | js |
591aa5a1caadce9b239d7b6d2d727ee09afdd754 | diff --git a/test/config/index.js b/test/config/index.js
index <HASH>..<HASH> 100644
--- a/test/config/index.js
+++ b/test/config/index.js
@@ -1,6 +1,6 @@
var merge = require('deepmerge');
-var env = process.env.TRAVIS && process.env._BROWSER !== 'phantomjs' ? 'travis-ci' : 'local';
+var env = process.env.TRAVIS ? 'travis-ci' : 'local';
var defaults = require('./defaults.js');
var asked = require('./' + env + '.js'); | Really use the Travis configs. | quailjs_quail | train | js |
cbb39be092bc86f8f6ecebfa10a6b0c69c8fbd8d | diff --git a/src/parole.js b/src/parole.js
index <HASH>..<HASH> 100644
--- a/src/parole.js
+++ b/src/parole.js
@@ -2,6 +2,11 @@
var nextTick = typeof process === 'object' && typeof process.nextTick === 'function' ?
process.nextTick :
(function(global, prefixes, i, fn) {
+ // resolved Promise is the fastest nextTick
+ if( 'Promise' in global && typeof global.Promise.resolve === 'function' ) return (function (resolved) {
+ return resolved.then.bind(resolved);
+ })( global.Promise.resolve() );
+ // otherwise using rAF
for( i = prefixes.length - 1; i >= 0 ; i-- ) {
fn = global[prefixes[i++] + 'equestAnimationFrame'];
if( fn instanceof Function ) return fn; | resolved Promise is the fastest nextTick | kiltjs_parole | train | js |
9d887c88b4dc3ae84215d4cde9c25efb0cc7ccfc | diff --git a/test/test_api.rb b/test/test_api.rb
index <HASH>..<HASH> 100644
--- a/test/test_api.rb
+++ b/test/test_api.rb
@@ -68,6 +68,12 @@ class TestApi < Test::Unit::TestCase
assert_xml_fragmentish doc
end
+ def test_loofah_html_document_node_scrub!
+ doc = Loofah.document(HTML)
+ assert(node = doc.at_css("div"))
+ node.scrub!(:strip)
+ end
+
private
def assert_html_documentish(doc) | first failing test for Node.scrub! | flavorjones_loofah-activerecord | train | rb |
55d6ef75cd6a65fd6017daa33f842291f8538e8e | diff --git a/src/Services/Gateways/CreditCard.php b/src/Services/Gateways/CreditCard.php
index <HASH>..<HASH> 100644
--- a/src/Services/Gateways/CreditCard.php
+++ b/src/Services/Gateways/CreditCard.php
@@ -152,5 +152,7 @@ class CreditCard extends BaseGateway
foreach ($this->creditCardConfig->interestRates as $item) {
$this->interestRates[$item->instalmentNumber] = $item->interestRate;
}
+
+ return $this->interestRates;
}
} | Added return for non-cached code path in interest rates | ebanx_benjamin | train | php |
55f74dcd22db624ec0ba6bdf024b035f7d616059 | diff --git a/src/layers/base-layer.js b/src/layers/base-layer.js
index <HASH>..<HASH> 100644
--- a/src/layers/base-layer.js
+++ b/src/layers/base-layer.js
@@ -884,7 +884,8 @@ export default class Layer {
}
let data = [];
- if (!triggerChanged.getData) {
+
+ if (!triggerChanged.getData && oldLayerData && oldLayerData.data) {
// same data
data = oldLayerData.data;
} else {
diff --git a/src/layers/layer-text-label.js b/src/layers/layer-text-label.js
index <HASH>..<HASH> 100644
--- a/src/layers/layer-text-label.js
+++ b/src/layers/layer-text-label.js
@@ -70,7 +70,12 @@ export const formatTextLabelData = ({textLabel, triggerChanged, oldLayerData, da
const getText = textLabelAccessor(tl);
let characterSet;
- if (!triggerChanged[`getLabelCharacterSet-${i}`]) {
+ if (
+ !triggerChanged[`getLabelCharacterSet-${i}`] &&
+ oldLayerData &&
+ oldLayerData.textLabels &&
+ oldLayerData.textLabels[i]
+ ) {
characterSet = oldLayerData.textLabels[i].characterSet;
} else {
const allLabels = tl.field ? data.map(getText) : []; | [Enhancement] added check for oldLayerData (#<I>) | keplergl_kepler.gl | train | js,js |
d2f37b7e519abc5782dca163ea326d2acdd37e01 | diff --git a/intranet/apps/context_processors.py b/intranet/apps/context_processors.py
index <HASH>..<HASH> 100644
--- a/intranet/apps/context_processors.py
+++ b/intranet/apps/context_processors.py
@@ -28,7 +28,7 @@ def nav_categorizer(request):
if p.match(request.path):
cat = category
- if request.user.startpage == "eighth" and re.compile(r"^/$").match(request.path):
+ if request.user.is_authenticated() and request.user.startpage == "eighth" and re.compile(r"^/$").match(request.path):
return {"custom_startpage": True, "nav_category": cat}
return {"nav_category": cat} | check if user is authenticated before checking startpage | tjcsl_ion | train | py |
0b2a8b11089aaaab9854ca5d408405c1be745943 | diff --git a/build_libtcod.py b/build_libtcod.py
index <HASH>..<HASH> 100644
--- a/build_libtcod.py
+++ b/build_libtcod.py
@@ -35,7 +35,7 @@ def _get_libraries_crossplatform():
return ['tcod']
raise ImportError('Operating system "%s" has no supported dynamic link libarary. (%s, %s)' % (sys.platform, bits, linkage))
-include_dirs = ['Release/tcod/', 'tcod/include/libtcod-1.5']
+include_dirs = ['/usr/include/SDL', 'Release/tcod/', 'tcod/include/libtcod-1.5']
extra_compile_args = []
# only include the provided SDL headers if they're missing from the standard system directories | Added /usr/include/SDL to include path | libtcod_python-tcod | train | py |
fd27275665cdd725516d7d3053a271f86be07c4f | diff --git a/app/controllers/concerns/effective/crud_controller/respond.rb b/app/controllers/concerns/effective/crud_controller/respond.rb
index <HASH>..<HASH> 100644
--- a/app/controllers/concerns/effective/crud_controller/respond.rb
+++ b/app/controllers/concerns/effective/crud_controller/respond.rb
@@ -15,7 +15,16 @@ module Effective
format.js do
flash[:success] ||= resource_flash(:success, resource, action)
- render(action, locals: { remote_form_redirect: resource_redirect_path(resource, action)}) # action.js.erb
+
+ if params[:_datatable_action]
+ redirect_to(resource_redirect_path(resource, action))
+ else
+ render(
+ (template_present?(action) ? action : :member_action),
+ locals: { action: action, remote_form_redirect: resource_redirect_path(resource, action)}
+ )
+ end
+
end
end
elsif template_present?(action) | redirect in datatables and forms js properly | code-and-effect_effective_resources | train | rb |
6a680c2f85df69e25d3f7ae30c14132ec90a6915 | diff --git a/src/phpFastCache/Core/DriverAbstract.php b/src/phpFastCache/Core/DriverAbstract.php
index <HASH>..<HASH> 100644
--- a/src/phpFastCache/Core/DriverAbstract.php
+++ b/src/phpFastCache/Core/DriverAbstract.php
@@ -361,7 +361,13 @@ abstract class DriverAbstract implements DriverInterface
} else {
$this->config[ $config_name ] = $value;
}
+ }
+ /**
+ * @param int $time
+ */
+ public function autoCleanExpired($time = 3600)
+ {
}
/** | Added AutoCleanExpired() method to abstract class | PHPSocialNetwork_phpfastcache | train | php |
b09876199f9b118fb64198f45457987c3fb09317 | diff --git a/service/discovery.go b/service/discovery.go
index <HASH>..<HASH> 100644
--- a/service/discovery.go
+++ b/service/discovery.go
@@ -145,11 +145,12 @@ func identifyInitSystem(executable string) (string, bool) {
}
// First fall back to following symlinks (if any).
- executable, err := evalSymlinks(executable)
+ resolved, err := evalSymlinks(executable)
if err != nil {
logger.Errorf("failed to find %q: %v", executable, err)
return "", false
}
+ executable = resolved
initSystem, ok = identifyExecutable(executable)
if ok {
return initSystem, true | Save the original executable for the error message. | juju_juju | train | go |
e5db7f869c228b617c81820314016ab690e44c51 | diff --git a/src/TableRow.js b/src/TableRow.js
index <HASH>..<HASH> 100644
--- a/src/TableRow.js
+++ b/src/TableRow.js
@@ -82,6 +82,7 @@ class TableRow extends Component {
return (
<col.EditComponent
value={this.state.editingRow[col.key]}
+ editingRow={this.state.editingRow}
onChange={(e) => this.onCellChange(col.key, e.target.value)}
{...resolveProps(row, col.editComponentProps, otherProps)}
/> | Added currently editing row as a prop to edit component. | sematext_sematable | train | js |
88a05ceba572264711083196d6ddc8f041952311 | diff --git a/src/wtf/replay/graphics/contextpool.js b/src/wtf/replay/graphics/contextpool.js
index <HASH>..<HASH> 100644
--- a/src/wtf/replay/graphics/contextpool.js
+++ b/src/wtf/replay/graphics/contextpool.js
@@ -121,7 +121,9 @@ wtf.replay.graphics.ContextPool.prototype.getContext =
var retrievedContext;
if (contextList && contextList.length) {
// Since context with desired type and attributes exists, return it.
- retrievedContext = contextList.pop();
+ // Use shift() instead of pop() - First in, First Out ensures that contexts
+ // are returned in the same order that they were released.
+ retrievedContext = contextList.shift();
this.resetWebGLContext_(retrievedContext);
} else {
// Create a new context. | Fixed WebGL restart with multiple identical contexts. | google_tracing-framework | train | js |
f7124e9a69b4313e5aa8c14ef7b6a3be7e883bb3 | diff --git a/vendor/visualmetrics.py b/vendor/visualmetrics.py
index <HASH>..<HASH> 100755
--- a/vendor/visualmetrics.py
+++ b/vendor/visualmetrics.py
@@ -549,9 +549,9 @@ def find_render_start(directory, orange_file, gray_file):
right_margin = 10
bottom_margin = 25
if height > 400 or width > 400:
- top = int(math.ceil(float(height) * 0.03))
- right_margin = int(math.ceil(float(width) * 0.04))
- bottom_margin = int(math.ceil(float(width) * 0.04))
+ top = max(top, int(math.ceil(float(height) * 0.04)))
+ right_margin = max(right_margin, int(math.ceil(float(width) * 0.04)))
+ bottom_margin = max(bottom_margin, int(math.ceil(float(width) * 0.04)))
height = max(height - top - bottom_margin, 1)
left = 0
width = max(width - right_margin, 1) | merging upstream fixes (#<I>) | sitespeedio_browsertime | train | py |
f524ea43efc53aa2d580acc67ee038e21e15cb9f | diff --git a/resources/views/admin/formElements/readability.blade.php b/resources/views/admin/formElements/readability.blade.php
index <HASH>..<HASH> 100644
--- a/resources/views/admin/formElements/readability.blade.php
+++ b/resources/views/admin/formElements/readability.blade.php
@@ -15,8 +15,13 @@
<script type="text/javascript">
$('#seo_readability_list').hide();
+ var editorPosition = {{ $options['editorPosition'] ?? -1 }};
setTimeout(function () {
- makeAjaxCall(tinymce.activeEditor);
+ if (editorPosition !== -1) {
+ makeAjaxCall(tinymce.get()[editorPosition]);
+ } else {
+ makeAjaxCall(tinymce.activeEditor);
+ }
}, 2000);
function wysiwygTextChanged(editor) { | Knowing which is the prefered wysiwyg | despark_ignicms | train | php |
dcd11e92b8b24c5a610bde927169d34a8495fbde | diff --git a/lib/ansiblelint/rules/CommandsInsteadOfModulesRule.py b/lib/ansiblelint/rules/CommandsInsteadOfModulesRule.py
index <HASH>..<HASH> 100644
--- a/lib/ansiblelint/rules/CommandsInsteadOfModulesRule.py
+++ b/lib/ansiblelint/rules/CommandsInsteadOfModulesRule.py
@@ -38,7 +38,8 @@ class CommandsInsteadOfModulesRule(AnsibleLintRule):
_modules = {'git': 'git', 'hg': 'hg', 'curl': 'get_url or uri', 'wget': 'get_url or uri',
'svn': 'subversion', 'service': 'service', 'mount': 'mount',
'rpm': 'yum or rpm_key', 'yum': 'yum', 'apt-get': 'apt-get',
- 'unzip': 'unarchive', 'tar': 'unarchive', 'chkconfig': 'service'}
+ 'unzip': 'unarchive', 'tar': 'unarchive', 'chkconfig': 'service',
+ 'rsync': 'synchronize'}
def matchtask(self, file, task):
if task["action"]["__ansible_module__"] in self._commands and \ | rsync should be synchronize module
Should suggest using synchronize instead of rsync
Thanks to #<I> | ansible_ansible-lint | train | py |
b87cd2812655912ccd55c84770a3d4422b871fca | diff --git a/seed_stage_based_messaging/settings.py b/seed_stage_based_messaging/settings.py
index <HASH>..<HASH> 100644
--- a/seed_stage_based_messaging/settings.py
+++ b/seed_stage_based_messaging/settings.py
@@ -163,7 +163,9 @@ REST_FRAMEWORK = {
CELERY_RESULT_BACKEND = 'djcelery.backends.database:DatabaseBackend'
CELERYBEAT_SCHEDULER = 'djcelery.schedulers.DatabaseScheduler'
-BROKER_URL = os.environ.get('BROKER_URL', 'redis://localhost:6379/0')
+BROKER_URL = os.environ.get(
+ 'BROKER_URL',
+ 'amqp://localhost:5672//seed_stage_based_messaging')
CELERY_DEFAULT_QUEUE = 'seed_stage_based_messaging'
CELERY_QUEUES = ( | Change default BROKER_URL
Everywhere else (production, docker-compose) we use a message queue
like RabbitMQ as the Celery backed rather than Redis. It's possible
to use Redis with Celery but I can't see anywhere that we do that.
Update the default to make it clear that it's normally a message queue. | praekeltfoundation_seed-stage-based-messaging | train | py |
17bc06e436ff57ebb0d296ff72ccff1d3169102c | diff --git a/docs/conf.py b/docs/conf.py
index <HASH>..<HASH> 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -15,7 +15,7 @@
import os
import sys
#sys.path.insert(0, os.path.abspath('.'))
-sys.path.insert(0, os.path.abspath('../src/'))
+sys.path.insert(0, os.path.abspath('../../src/'))
print()
for path in sys.path: | Modified conf.py
Changed folder structure | IrvKalb_pygwidgets | train | py |
812da703a201cf3a765d7b38750be5ed38b9bb68 | diff --git a/version/version.go b/version/version.go
index <HASH>..<HASH> 100644
--- a/version/version.go
+++ b/version/version.go
@@ -10,7 +10,7 @@ var GitCommit string
var GitDescribe string
// The main version number that is being run at the moment.
-const Version = "0.6.0"
+const Version = "0.5.3"
// A pre-release marker for the version. If this is "" (empty string)
// then it means that it is a final release. Otherwise, this is a pre-release | Next version will likely not be <I> | hashicorp_vault | train | go |
83a80a6713c4bbc0028d634490b09d9beed8ffe7 | diff --git a/Collection.php b/Collection.php
index <HASH>..<HASH> 100755
--- a/Collection.php
+++ b/Collection.php
@@ -195,7 +195,7 @@ class Collection implements ArrayAccess, ArrayableInterface, Countable, Iterator
*/
public function get($key, $default = null)
{
- if (array_key_exists($key, $this->items))
+ if ($this->offsetExists($key))
{
return $this->items[$key];
}
@@ -251,7 +251,7 @@ class Collection implements ArrayAccess, ArrayableInterface, Countable, Iterator
*/
public function has($key)
{
- return array_key_exists($key, $this->items);
+ return $this->offsetExists($key);
}
/** | [<I>] Collection - DDRYs up the code a little more | illuminate_support | train | php |
ddc4331b1e9bd558ca077676515f8835554d4829 | diff --git a/fusionbox/forms/models.py b/fusionbox/forms/models.py
index <HASH>..<HASH> 100644
--- a/fusionbox/forms/models.py
+++ b/fusionbox/forms/models.py
@@ -3,8 +3,6 @@ from django import forms
import hashlib
class UncaptchaBase(object):
- uncaptcha = forms.CharField(required = False)
-
def __init__(self, request, *args, **kwargs):
super(UncaptchaBase, self).__init__(*args, **kwargs)
hasher = hashlib.sha256()
@@ -13,12 +11,12 @@ class UncaptchaBase(object):
def clean_uncaptcha(self):
value = self.cleaned_data['uncaptcha']
- if not value = self.uncaptcha_value:
+ if not value == self.uncaptcha_value:
raise forms.ValidationError("Incorrect uncaptcha value")
return value
class UncaptchaForm(UncaptchaBase, forms.Form):
- pass
+ uncaptcha = forms.CharField(required = False)
class UncaptchaModelForm(UncaptchaBase, forms.ModelForm):
- pass
+ uncaptcha = forms.CharField(required = False) | Fixed a syntax error, and adjusted declaration of uncaptcha field to work correctly with Field metaclass inheritance | fusionbox_django-argonauts | train | py |
7aa3b049f46348c9c4bb1267605b918ba08e078f | diff --git a/test/compare-esprima2/export-default-declaration.expected.js b/test/compare-esprima2/export-default-declaration.expected.js
index <HASH>..<HASH> 100644
--- a/test/compare-esprima2/export-default-declaration.expected.js
+++ b/test/compare-esprima2/export-default-declaration.expected.js
@@ -1,2 +1,4 @@
export default function a() {
}
+export default function () {
+}
diff --git a/test/compare-esprima2/export-default-declaration.expected.min.js b/test/compare-esprima2/export-default-declaration.expected.min.js
index <HASH>..<HASH> 100644
--- a/test/compare-esprima2/export-default-declaration.expected.min.js
+++ b/test/compare-esprima2/export-default-declaration.expected.min.js
@@ -1 +1 @@
-export default function a(){}
+export default function a(){}export default function (){}
diff --git a/test/compare-esprima2/export-default-declaration.js b/test/compare-esprima2/export-default-declaration.js
index <HASH>..<HASH> 100644
--- a/test/compare-esprima2/export-default-declaration.js
+++ b/test/compare-esprima2/export-default-declaration.js
@@ -1,3 +1,4 @@
export default function a () { }
// export default var i = 20;
// export default const K = 20;
+export default function () { } | Add the test with default and anonymous function | estools_escodegen | train | js,js,js |
f16fed11160b2d90769ddf30b643f9d0c9ebf692 | diff --git a/tests/test-rest-users-controller.php b/tests/test-rest-users-controller.php
index <HASH>..<HASH> 100644
--- a/tests/test-rest-users-controller.php
+++ b/tests/test-rest-users-controller.php
@@ -50,6 +50,23 @@ class WP_Test_REST_Users_Controller extends WP_Test_REST_Controller_Testcase {
$this->assertEquals( array( 'view', 'embed', 'edit' ), $data['endpoints'][0]['args']['context']['enum'] );
}
+ public function test_registered_query_params() {
+ $request = new WP_REST_Request( 'OPTIONS', '/wp/v2/users' );
+ $response = $this->server->dispatch( $request );
+ $data = $response->get_data();
+ $keys = array_keys( $data['endpoints'][0]['args'] );
+ sort( $keys );
+ $this->assertEquals( array(
+ 'context',
+ 'include',
+ 'order',
+ 'orderby',
+ 'page',
+ 'per_page',
+ 'search',
+ ), $keys );
+ }
+
public function test_get_items() {
wp_set_current_user( $this->user ); | Add test for expected query params | WP-API_WP-API | train | php |
59c6c849b294b1bb24dbded64bd2c738b4dd33fd | diff --git a/pyemu/utils/os_utils.py b/pyemu/utils/os_utils.py
index <HASH>..<HASH> 100644
--- a/pyemu/utils/os_utils.py
+++ b/pyemu/utils/os_utils.py
@@ -165,7 +165,8 @@ def start_workers(
This option is usually not needed unless you are one of those crazy people who
spreads files across countless subdirectories.
local (`bool`, optional): flag for using "localhost" instead of actual hostname/IP address on
- worker command line. Default is True
+ worker command line. Default is True. `local` can also be passed as an `str`, in which
+ case `local` is used as the hostname (for example `local="192.168.10.1"`)
cleanup (`bool`, optional): flag to remove worker directories once processes exit. Default is
True. Set to False for debugging issues
master_dir (`str`): name of directory for master instance. If `master_dir` | first attempt at skipping unwanted rows in csv to ins | jtwhite79_pyemu | train | py |
36df6d1bf92f5500da073b9796f3be1efc6da0a9 | diff --git a/telethon/utils.py b/telethon/utils.py
index <HASH>..<HASH> 100644
--- a/telethon/utils.py
+++ b/telethon/utils.py
@@ -24,9 +24,10 @@ try:
except ImportError:
hachoir = None
-# .webp mimetype is unknown on some operative systems, so stickers won't
-# work. Manually register it here to make sure stickers work everywhere.
+# .webp (stickers) and .ogg (some voice notes) mimetypes are unknown on some
+# operative systems. Manually register them here to make them work everywhere.
mimetypes.add_type('image/webp', '.webp')
+mimetypes.add_type('audio/ogg', '.ogg')
USERNAME_RE = re.compile(
r'@|(?:https?://)?(?:www\.)?(?:telegram\.(?:me|dog)|t\.me)/(joinchat/)?' | Manually register ogg mimetype too (#<I>) | LonamiWebs_Telethon | train | py |
e74a31c48239cdd2b20194eecba2139090b49d2d | diff --git a/GPy/models/ss_gplvm.py b/GPy/models/ss_gplvm.py
index <HASH>..<HASH> 100644
--- a/GPy/models/ss_gplvm.py
+++ b/GPy/models/ss_gplvm.py
@@ -193,7 +193,7 @@ class SSGPLVM(SparseGP_MPI):
self.init = init
self.sharedX = sharedX
- if X == None:
+ if X is None:
from ..util.initialization import initialize_latent
X, fracs = initialize_latent(init, input_dim, Y)
else: | Update ss_gplvm.py
resolve the future warning: FutureWarning:comparison to `None` will result in an elementwise object comparison in the future. | SheffieldML_GPy | train | py |
ebb69c2e0ef3541066db27ada3fc361886220c89 | diff --git a/src/extensions/layout/breadthfirst.js b/src/extensions/layout/breadthfirst.js
index <HASH>..<HASH> 100644
--- a/src/extensions/layout/breadthfirst.js
+++ b/src/extensions/layout/breadthfirst.js
@@ -291,7 +291,7 @@ BreadthFirstLayout.prototype.run = function(){
}
var eleDepth = ele._private.scratch.breadthfirst.depth;
- var neighbors = ele.neighborhood().nodes().not( ':parent' );
+ var neighbors = ele.neighborhood().nodes().not( ':parent' ).intersection(nodes);
var percent = 0;
var samples = 0; | Merge pull request #<I> from markgoffin/breadthfirst_bug_fix
Fix bug in breadthfirst layout for a collection of elements | cytoscape_cytoscape.js | train | js |
784b00a6d59385693f420ea42e756750ba0ba9b1 | diff --git a/api/common/modelstatus.go b/api/common/modelstatus.go
index <HASH>..<HASH> 100644
--- a/api/common/modelstatus.go
+++ b/api/common/modelstatus.go
@@ -37,7 +37,9 @@ func (c *ModelStatusAPI) ModelStatus(tags ...names.ModelTag) ([]base.ModelStatus
if err := c.facade.FacadeCall("ModelStatus", req, &result); err != nil {
return nil, err
}
-
+ if len(result.Results) != len(tags) {
+ return nil, errors.Errorf("%d results, expected %d", len(result.Results), len(tags))
+ }
return c.processModelStatusResults(result.Results)
} | Return error if the size of result is not the size of request.
Help prevent a panic downstream. | juju_juju | train | go |
b54d5bd52d349936c030473d73323bdb4c4da36b | diff --git a/src/PhalconRest/Api/Resource.php b/src/PhalconRest/Api/Resource.php
index <HASH>..<HASH> 100644
--- a/src/PhalconRest/Api/Resource.php
+++ b/src/PhalconRest/Api/Resource.php
@@ -15,8 +15,8 @@ class Resource extends Collection implements MountableInterface, CollectionInter
protected $model;
protected $transformer;
- protected $itemKey = 'item';
- protected $collectionKey = 'items';
+ protected $itemKey;
+ protected $collectionKey;
protected $_modelPrimaryKey;
@@ -178,7 +178,7 @@ class Resource extends Collection implements MountableInterface, CollectionInter
*/
public function getItemKey()
{
- return $this->itemKey;
+ return ($this->itemKey ?: $this->name) ?: 'item';
}
/**
@@ -219,6 +219,6 @@ class Resource extends Collection implements MountableInterface, CollectionInter
*/
public function getCollectionKey()
{
- return $this->collectionKey;
+ return ($this->collectionKey ?: $this->name) ?: 'items';
}
} | Resource returns name as item/collection key if not defined | redound_phalcon-rest | train | php |
3ab9b5784f33f1e938e2be3639bbe3e78cdcbd41 | diff --git a/tests/Client/SilenceTest.php b/tests/Client/SilenceTest.php
index <HASH>..<HASH> 100644
--- a/tests/Client/SilenceTest.php
+++ b/tests/Client/SilenceTest.php
@@ -51,10 +51,16 @@ class SilenceTest extends TestCase
{
$client = new Silence(
new Socket(
- $this->createMock(Sockets::class),
- new Address('/tmp/unknown')
+ $sockets = $this->createMock(Sockets::class),
+ $address = new Address('/tmp/unknown')
)
);
+ $sockets
+ ->expects($this->once())
+ ->method('connectTo')
+ ->will($this->returnCallback(static function() use ($address) {
+ return new UnixClient($address);
+ }));
$this->assertNull($client->send(new Event(
new Event\Name('foo'), | do throw an exception when sending in tests | Innmind_InstallationMonitor | train | php |
781d2c50c9ea7320386536cb37b9b246305b3197 | diff --git a/cmd2.py b/cmd2.py
index <HASH>..<HASH> 100755
--- a/cmd2.py
+++ b/cmd2.py
@@ -1783,22 +1783,26 @@ class Cmd(cmd.Cmd):
else:
# Get the completer function for this command
+ is_shell_command = False
try:
compfunc = getattr(self, 'complete_' + command)
except AttributeError:
+ # Check if this command should be run as a shell command
if self.default_to_shell and command in self._get_exes_in_path(command):
compfunc = functools.partial(path_complete)
+ is_shell_command = True
else:
compfunc = self.completedefault
- # If there are subcommands, then try completing those if the cursor is in
- # the token at index 1, otherwise default to using compfunc
- subcommands = self.get_subcommands(command)
- if subcommands is not None:
- index_dict = {1: subcommands}
- compfunc = functools.partial(index_based_complete,
- index_dict=index_dict,
- all_else=compfunc)
+ if not is_shell_command:
+ # If there are subcommands, then try completing those if the cursor is in
+ # the token at index 1, otherwise default to using compfunc
+ subcommands = self.get_subcommands(command)
+ if subcommands is not None:
+ index_dict = {1: subcommands}
+ compfunc = functools.partial(index_based_complete,
+ index_dict=index_dict,
+ all_else=compfunc)
# Call the completer function
self.completion_matches = compfunc(text, line, begidx, endidx) | Don't try to look for subcommands on something that is running as a shell command | python-cmd2_cmd2 | train | py |
6292ada845bdcd44a8e2db2d3c5e18c96c9ac210 | diff --git a/pointcloud.js b/pointcloud.js
index <HASH>..<HASH> 100644
--- a/pointcloud.js
+++ b/pointcloud.js
@@ -182,9 +182,6 @@ function getClipBounds(bounds) {
}
function drawProject(shader, points, camera, pixelRatio) {
-
- pixelRatio = pixelRatio || 1
-
var axesProject = points.axesProject
var gl = points.gl | no need to fix bad pixel ratio here | gl-vis_gl-scatter3d | train | js |
020c596d2f099cc9446ae142b3b5ce3e805271f8 | diff --git a/test/spec/xml/write.js b/test/spec/xml/write.js
index <HASH>..<HASH> 100644
--- a/test/spec/xml/write.js
+++ b/test/spec/xml/write.js
@@ -583,6 +583,34 @@ describe('bpmn-moddle - write', function() {
describe('should export extensions', function() {
+ it.skip('manually added custom namespace', function(done) {
+
+ // given
+ var definitions = moddle.create('bpmn:Definitions');
+
+ definitions.set('xmlns:foo', 'http://foobar');
+
+ // or alternatively directly assign it to definitions.$attrs
+
+ var expectedXML =
+ '<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" ' +
+ 'xmlns:foo="http://foobar" />';
+
+ // when
+ write(definitions, function(err, result) {
+
+ if (err) {
+ return done(err);
+ }
+
+ // then
+ expect(result).to.eql(expectedXML);
+
+ done(err);
+ });
+ });
+
+
it('attributes on root', function(done) {
// given | test(writer): add failing ns export test | bpmn-io_bpmn-moddle | train | js |
d82c77ef02dbca115f9be8b4a2b084b0135ca303 | diff --git a/src/client.js b/src/client.js
index <HASH>..<HASH> 100644
--- a/src/client.js
+++ b/src/client.js
@@ -104,7 +104,7 @@ function _write(chunk, encoding, callback) {
if (this.writeFailed) {
/* Once a write fails, just call the callback immediately to let the caller
flush any pending writes. */
- callback();
+ setImmediate(callback);
}
try {
message = this.serialize(chunk); | Change write callback to asynchronous to avoid recursion | grpc_grpc-node | train | js |
3924d498de35c3c75e53237dba3522136474f26c | diff --git a/lib/models.js b/lib/models.js
index <HASH>..<HASH> 100644
--- a/lib/models.js
+++ b/lib/models.js
@@ -135,6 +135,7 @@ Model.prototype.validate = function()
} // end if
// TODO: Add support for complex types, like Arrays of a given type, or Enums
+ // TODO: May want to consider switching to value: https://www.npmjs.org/package/value
// Pull put our value for easy access
var val = self.$$values[key]; | added a note about a better type-checking lib. | trivialsoftware_trivialdb | train | js |
de4b749ed4ed97db1a7ef843903eb581b1040b54 | diff --git a/lib/import_js/importer.rb b/lib/import_js/importer.rb
index <HASH>..<HASH> 100644
--- a/lib/import_js/importer.rb
+++ b/lib/import_js/importer.rb
@@ -229,7 +229,7 @@ module ImportJS
# We need to add each line individually because the Vim buffer will
# convert newline characters to `~@`.
import_string.split("\n").reverse_each do |line|
- @editor.append_line(0 + imports_start_at, line)
+ @editor.append_line(imports_start_at, line)
end
end
end | Remove unnecessary `0 +`
This unnecessary addition was leftover from ff<I>c<I> where we started
taking 'use strict' into account when importing. | Galooshi_import-js | train | rb |
7d03800df9cc456b82b542512000de0bc23eeb48 | diff --git a/res/js/GridElementsDD_onReady.js b/res/js/GridElementsDD_onReady.js
index <HASH>..<HASH> 100644
--- a/res/js/GridElementsDD_onReady.js
+++ b/res/js/GridElementsDD_onReady.js
@@ -7,13 +7,11 @@ if(typeof GridElementsDD === "undefined"){
top.geSprites = {};
top.backPath = '';
- if(top.TYPO3.Components !== undefined) {
- top.TYPO3.Components.PageModule = {
- enableDragDrop: function() {
- return true;
- }
+ if(typeof TYPO3.Components.PageModule.init !== 'undefined') {
+ TYPO3.Components.PageModule.init = function() {
+ this.enableHighlighting();
}
- }
+ };
if(Ext.get('ext-cms-layout-db-layout-php')) { | Fix for broken D&D due to changed initalizing of PageModule JS
Change-Id: Ibfe<I>f<I>a<I>cb<I>b0aebe<I>f<I>
Reviewed-on: <URL> | TYPO3-extensions_gridelements | train | js |
42917d707df72631099777d09c61a8fd55313ccc | diff --git a/lib/scanner/blockqueue.go b/lib/scanner/blockqueue.go
index <HASH>..<HASH> 100644
--- a/lib/scanner/blockqueue.go
+++ b/lib/scanner/blockqueue.go
@@ -63,7 +63,6 @@ func HashFile(ctx context.Context, fs fs.Filesystem, path string, blockSize int,
// is closed and all items handled.
type parallelHasher struct {
fs fs.Filesystem
- workers int
outbox chan<- ScanResult
inbox <-chan protocol.FileInfo
counter Counter
@@ -74,7 +73,6 @@ type parallelHasher struct {
func newParallelHasher(ctx context.Context, fs fs.Filesystem, workers int, outbox chan<- ScanResult, inbox <-chan protocol.FileInfo, counter Counter, done chan<- struct{}) {
ph := ¶llelHasher{
fs: fs,
- workers: workers,
outbox: outbox,
inbox: inbox,
counter: counter,
@@ -82,8 +80,8 @@ func newParallelHasher(ctx context.Context, fs fs.Filesystem, workers int, outbo
wg: sync.NewWaitGroup(),
}
+ ph.wg.Add(workers)
for i := 0; i < workers; i++ {
- ph.wg.Add(1)
go ph.hashFiles(ctx)
} | lib/scanner: Remove unused field, move WaitGroup.Add out of loop (#<I>) | syncthing_syncthing | train | go |
d01e25becaa73215b8cf524295fb890ea946cada | diff --git a/widgets/SeoHead.php b/widgets/SeoHead.php
index <HASH>..<HASH> 100644
--- a/widgets/SeoHead.php
+++ b/widgets/SeoHead.php
@@ -105,11 +105,8 @@ class SeoHead extends CWidget
*/
protected function renderCanonical()
{
- $request = Yii::app()->getRequest();
- $url = $request->getUrl();
-
- // Make sure that we do not create a recursive canonical redirect.
- if ($this->_canonical !== $url && $this->_canonical !== $request->getHostInfo().$url)
+ // Make sure the Canonical link is populated before writing it to the page.
+ if ($this->_canonical)
echo '<link rel="canonical" href="'.$this->_canonical.'" />';
}
} | Removing the recursive check
There is no harm in having a canonical tag that says the current page
is the authoritative url. By always rendering it, it is easier to test
for any problems, and there are some SEO experts that say there is
benefit in always having it. | crisu83_yii-seo | train | php |
2ef3059ad3a98e3de1b29e86c82e448364332aa9 | diff --git a/test/test_database.py b/test/test_database.py
index <HASH>..<HASH> 100644
--- a/test/test_database.py
+++ b/test/test_database.py
@@ -17,6 +17,8 @@
import datetime
import random
import sys
+from unittest.case import SkipTest
+
sys.path[0:0] = [""]
import unittest
@@ -180,6 +182,11 @@ class TestDatabase(unittest.TestCase):
info = db.profiling_info()
self.assert_(isinstance(info, list))
+
+ raise SkipTest(
+ "We need SERVER-4754 fixed for the rest of this test to pass"
+ )
+
self.assert_(len(info) >= 1)
# These basically clue us in to server changes.
if version.at_least(db.connection, (1, 9, 1, -1)): | Skip test_profiling_info until SERVER-<I> is fixed | mongodb_mongo-python-driver | train | py |
fc334048329a7360abb1b156609c0ec195b7a7a8 | diff --git a/structr-ui/src/main/resources/structr/js/contents.js b/structr-ui/src/main/resources/structr/js/contents.js
index <HASH>..<HASH> 100644
--- a/structr-ui/src/main/resources/structr/js/contents.js
+++ b/structr-ui/src/main/resources/structr/js/contents.js
@@ -67,7 +67,10 @@ var _Contents = {
var div = Structr.node(entity.id);
_Dragndrop.makeSortable(div);
- _Dragndrop.makeDroppable(div);
+
+ if (isTemplate || isComponent) {
+ _Dragndrop.makeDroppable(div);
+ }
if (isTemplate) {
var hasChildren = entity.childrenIds && entity.childrenIds.length; | removed content-elements as droppable elements. (Templates and Components still work) | structr_structr | train | js |
8ed73ca3bff47c0bd5dbab5cac9a29ccfc39d240 | diff --git a/pakefile.php b/pakefile.php
index <HASH>..<HASH> 100644
--- a/pakefile.php
+++ b/pakefile.php
@@ -1103,6 +1103,11 @@ class eZExtBuilder
$zipext = 'gz';
$target = substr( $archivefile, 0, -3 );
}
+ else if ( substr( $archivefile, -4 ) == '.bz2' )
+ {
+ $zipext = 'bz2';
+ $target = substr( $archivefile, 0, -4 );
+ }
else if ( substr( $archivefile, -6 ) == '.ezpkg' )
{
$zipext = 'ezpkg';
@@ -1137,7 +1142,12 @@ class eZExtBuilder
$tar->close();
if ( $zipext )
{
- $fp = fopen( 'compress.zlib://' . ( $zipext == 'ezpkg' ? substr( $target, 0, -4 ) : $target ) . ".$zipext", 'wb9' );
+ $compress = 'zlib';
+ if ( $zipext == 'bz2' )
+ {
+ $compress = 'bzip2';
+ }
+ $fp = fopen( "compress.$compress://" . ( $zipext == 'ezpkg' ? substr( $target, 0, -4 ) : $target ) . ".$zipext", 'wb9' );
/// @todo read file by small chunks to avoid memory exhaustion
fwrite( $fp, file_get_contents( $target ) );
fclose( $fp ); | Support creation of .bz2 archives | gggeek_ezextensionbuilder | train | php |
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.