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
|
---|---|---|---|---|---|
5d1bc7c848180f4adc0fc2da133044740e902b91 | diff --git a/src/Illuminate/View/Compilers/BladeCompiler.php b/src/Illuminate/View/Compilers/BladeCompiler.php
index <HASH>..<HASH> 100644
--- a/src/Illuminate/View/Compilers/BladeCompiler.php
+++ b/src/Illuminate/View/Compilers/BladeCompiler.php
@@ -693,10 +693,10 @@ class BladeCompiler extends Compiler implements CompilerInterface {
/**
- * Gets the content tags used for the compiler.
+ * Gets the tags used for the compiler.
*
* @param bool $escaped
- * @return string
+ * @return array
*/
protected function getTags($escaped = false)
{ | Ensure content and escaped tags are not quotted when accessed | laravel_framework | train | php |
22646ffb18c7e39353a0b159a1c1b34faa4fe232 | diff --git a/index.js b/index.js
index <HASH>..<HASH> 100644
--- a/index.js
+++ b/index.js
@@ -2,9 +2,10 @@
var pull = require('pull-stream')
module.exports = function (prob) {
+
return pull.map(function (data) {
- if(Math.random() < prob) {
+ if(Number.isInteger(prob) && --prob===0 || Math.random() < prob) {
var rbit = 1<<(8*Math.random())
var i = ~~(Math.random()*data.length)
data[i] = data[i]^rbit | support a counter until the packet which will be tampered with | dominictarr_pull-bitflipper | train | js |
4453e92665aeb840b66c982d20367eb6f045c968 | diff --git a/spec/support/vcr_localhost_server.rb b/spec/support/vcr_localhost_server.rb
index <HASH>..<HASH> 100644
--- a/spec/support/vcr_localhost_server.rb
+++ b/spec/support/vcr_localhost_server.rb
@@ -13,7 +13,7 @@ module VCR
def call(env)
if env["PATH_INFO"] == "/__identify__"
- [200, {}, @app.object_id.to_s]
+ [200, {}, [@app.object_id.to_s]]
else
@app.call(env)
end | Ensure rack response body responds to each. | vcr_vcr | train | rb |
9c4275f129f038f0bf73a3e3791eecb38e878454 | diff --git a/spec/with_model_spec.rb b/spec/with_model_spec.rb
index <HASH>..<HASH> 100644
--- a/spec/with_model_spec.rb
+++ b/spec/with_model_spec.rb
@@ -150,4 +150,38 @@ describe "a temporary ActiveRecord model created with with_model" do
end
end
+ context "without a model block" do
+ with_model :blog_post do
+ table do |t|
+ t.string 'title'
+ t.text 'content'
+ t.timestamps
+ end
+ end
+
+ it "should act like a normal ActiveRecord model" do
+ record = BlogPost.create!(:title => 'New blog post', :content => "Hello, world!")
+
+ record.reload
+
+ record.title.should == 'New blog post'
+ record.content.should == 'Hello, world!'
+ record.updated_at.should be_present
+
+ record.destroy
+
+ lambda {
+ record.reload
+ }.should raise_error(ActiveRecord::RecordNotFound)
+ end
+
+ if defined?(ActiveModel)
+ describe "the class" do
+ subject { BlogPost.new }
+ it_should_behave_like "ActiveModel"
+ end
+ end
+
+ end
+
end | Add test coverage for omitted model block. | Casecommons_with_model | train | rb |
cb42b85f53337517c6ae62bd7b388bf17d8b7aad | diff --git a/lib/customUtils.js b/lib/customUtils.js
index <HASH>..<HASH> 100644
--- a/lib/customUtils.js
+++ b/lib/customUtils.js
@@ -24,9 +24,10 @@ function ensureDirectoryExists (dir, cb) {
* Return a random string of length len
*/
function uid (len) {
- return crypto.randomBytes(Math.ceil(len * 3 / 4))
+ return crypto.randomBytes(Math.ceil(len * 5 / 4))
.toString('base64')
- //.slice(0, len);
+ .replace(/[+\/]/g, '')
+ .slice(0, len);
}
console.log(uid(5)); | Able to load and understand a database | louischatriot_nedb | train | js |
6b1921f59e1105499a329ab3aaf6134e7fb0ff6c | diff --git a/lib/cli/resolve-input.js b/lib/cli/resolve-input.js
index <HASH>..<HASH> 100644
--- a/lib/cli/resolve-input.js
+++ b/lib/cli/resolve-input.js
@@ -7,7 +7,7 @@ const parseArgs = require('./parse-args');
const baseArgsSchema = {
boolean: new Set(['version', 'help', 'help-interactive', 'v']),
- string: new Set(['config']),
+ string: new Set(['app', 'config', 'org']),
alias: new Map([
['c', 'config'],
['h', 'help'], | refactor(CLI): Recognize "app" and "org" params | serverless_serverless | train | js |
626421d8f1c009cec977f0f002c0083c5ce40981 | diff --git a/library/cerebrum.js b/library/cerebrum.js
index <HASH>..<HASH> 100644
--- a/library/cerebrum.js
+++ b/library/cerebrum.js
@@ -89,10 +89,6 @@ Cerebrum.prototype = {
}
).network;
mind.query(queryingPatterns, callback);
- },
-
- query: function(queryingPatterns, callback) {
-
}
} | Removed unused method from the Cerebrum module. | antoniodeluca_dn2a.js | train | js |
5b9f983c65dcca590d5ff309cea4def61209790d | diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb
index <HASH>..<HASH> 100644
--- a/actionpack/lib/action_dispatch/routing/mapper.rb
+++ b/actionpack/lib/action_dispatch/routing/mapper.rb
@@ -641,19 +641,16 @@ module ActionDispatch
# resources :posts
# end
def scope(*args)
- options = args.extract_options!
- options = options.dup
-
- options[:path] = args.flatten.join('/') if args.any?
+ options = args.extract_options!.dup
recover = {}
+ options[:path] = args.flatten.join('/') if args.any?
options[:constraints] ||= {}
- unless options[:constraints].is_a?(Hash)
- block, options[:constraints] = options[:constraints], {}
- end
if options[:constraints].is_a?(Hash)
(options[:defaults] ||= {}).reverse_merge!(defaults_from_constraints(options[:constraints]))
+ else
+ block, options[:constraints] = options[:constraints], {}
end
scope_options.each do |option| | Simplify constraints condition in scope when checking for Hash | rails_rails | train | rb |
49bb7e58693aaa7c3039768be34cf12adc9bfb99 | diff --git a/lib/dimples/version.rb b/lib/dimples/version.rb
index <HASH>..<HASH> 100644
--- a/lib/dimples/version.rb
+++ b/lib/dimples/version.rb
@@ -1,3 +1,3 @@
module Dimples
- VERSION = "1.2.2"
+ VERSION = "1.2.3"
end
\ No newline at end of file | Bumped to <I>. | waferbaby_dimples | train | rb |
f14d074cc8b9a1bf4c3e49bfe6f56fc54750440f | diff --git a/src/epubcheck/cli.py b/src/epubcheck/cli.py
index <HASH>..<HASH> 100644
--- a/src/epubcheck/cli.py
+++ b/src/epubcheck/cli.py
@@ -97,11 +97,13 @@ def main(argv=None):
print(message.short)
if args.csv:
- args.csv.write(messages.export('csv', delimiter=b';'))
+ args.csv.write(messages.export('csv', delimiter=compat.text_type(';')).encode())
+ args.csv.close()
if args.xls:
databook = tablib.Databook((metas, messages))
args.xls.write(databook.xls)
+ args.xls.close()
if all_valid:
return 0 | Fix CSV report
* Tablib CSV writer expects delimiter as string, not bytes.
* File handle needs manual closing for test to pass.
See <URL> | titusz_epubcheck | train | py |
bfe24ba48d99902af74a9e1bdf0b89926d9286a7 | diff --git a/css.js b/css.js
index <HASH>..<HASH> 100644
--- a/css.js
+++ b/css.js
@@ -68,13 +68,14 @@ if(isProduction) {
});
} else {
if(typeof document !== "undefined") {
- link = getExistingAsset(load, document.head);
+ var head = document.head || document.getElementsByTagName("head")[0];
+ link = getExistingAsset(load, head);
if(!link) {
link = document.createElement('link');
link.rel = 'stylesheet';
link.href = cssFile;
- document.head.appendChild(link);
+ head.appendChild(link);
}
}
} | Fixes #<I>. Get header via getElementsByTagName for IE8 compatibility
Check for document.head as to not have to always traverse the DOM | donejs_css | train | js |
9c662acd58dafcf551d88c353f9d38ed36a3997b | diff --git a/lib/espresso-runner.js b/lib/espresso-runner.js
index <HASH>..<HASH> 100644
--- a/lib/espresso-runner.js
+++ b/lib/espresso-runner.js
@@ -243,6 +243,10 @@ class EspressoRunner {
let hasSocketError = false;
// start the instrumentation process
+ this.jwproxy.instrumentationState = {
+ exited: false,
+ crashed: false,
+ };
this.instProcess = this.adb.createSubProcess(cmd);
this.instProcess.on('exit', (code, signal) => {
logger.info(`Instrumentation process exited with code ${code} from signal ${signal}`); | fix: Reset instrumentation state before starting a new instance (#<I>) | appium_appium-espresso-driver | train | js |
9afb06dabb9dd24d18391ebd0a479350bf7323bc | diff --git a/lib/bitbucket_rest_api/team.rb b/lib/bitbucket_rest_api/team.rb
index <HASH>..<HASH> 100644
--- a/lib/bitbucket_rest_api/team.rb
+++ b/lib/bitbucket_rest_api/team.rb
@@ -30,5 +30,11 @@ module BitBucket
response["values"].each { |el| yield el }
end
+ def following(team_name)
+ response = get_request("/2.0/teams/#{team_name.to_s}/following")
+ return response unless block_given?
+ response["values"].each { |el| yield el }
+ end
+
end # Users
end # BitBucket | Implement .following in team.rb | bitbucket-rest-api_bitbucket | train | rb |
a84d2b26ec9a61ba7a79c91f7e2d435ae709353c | diff --git a/telsh/telnet_handler.go b/telsh/telnet_handler.go
index <HASH>..<HASH> 100644
--- a/telsh/telnet_handler.go
+++ b/telsh/telnet_handler.go
@@ -14,7 +14,7 @@ import (
const (
defaultExitCommandName = "exit"
- defaultPrompt = "$ "
+ defaultPrompt = "§ "
defaultWelcomeMessage = "Welcome!\r\n"
defaultExitMessage = "Goodbye!\r\n"
) | changed the default prompt string. "$ " -> "§ ". kind of looks similar, but I think the sematics of the latter is more accurate. | reiver_go-telnet | train | go |
38fa94f03ba7f3d0961a081ca816e6926e607dfa | diff --git a/lib/archivers/zip/zip-archive-output-stream.js b/lib/archivers/zip/zip-archive-output-stream.js
index <HASH>..<HASH> 100644
--- a/lib/archivers/zip/zip-archive-output-stream.js
+++ b/lib/archivers/zip/zip-archive-output-stream.js
@@ -96,10 +96,6 @@ ZipArchiveOutputStream.prototype._defaults = function(o) {
o = {};
}
- if (typeof o.zip64 !== 'boolean') {
- o.zip64 = false;
- }
-
if (typeof o.zlib !== 'object') {
o.zlib = {};
} | zip: remove zip<I> option as it should only impact cases where things were already unparseable. | archiverjs_node-compress-commons | train | js |
bd4b2a5b158f7a8fc1e0b8ac0a04fd2e0a2a389b | diff --git a/lib/asciidoctor/standoc/section.rb b/lib/asciidoctor/standoc/section.rb
index <HASH>..<HASH> 100644
--- a/lib/asciidoctor/standoc/section.rb
+++ b/lib/asciidoctor/standoc/section.rb
@@ -33,8 +33,8 @@ module Asciidoctor
def section_attributes(node)
{ id: Utils::anchor_or_uuid(node),
- language: node.attr("language"),
- script: node.attr("script") }
+ language: node.attributes["language"],
+ script: node.attributes["script"] }
end
def section(node) | do not propagate language/script into sections from document attributes | metanorma_metanorma-standoc | train | rb |
69f3a39c1c96ba024ed332dd12f86f8f5cf7ba33 | diff --git a/txscript/sign.go b/txscript/sign.go
index <HASH>..<HASH> 100644
--- a/txscript/sign.go
+++ b/txscript/sign.go
@@ -22,12 +22,7 @@ func RawTxInWitnessSignature(tx *wire.MsgTx, sigHashes *TxSigHashes, idx int,
amt int64, subScript []byte, hashType SigHashType,
key *btcec.PrivateKey) ([]byte, error) {
- parsedScript, err := parseScript(subScript)
- if err != nil {
- return nil, fmt.Errorf("cannot parse output script: %v", err)
- }
-
- hash, err := calcWitnessSignatureHash(parsedScript, sigHashes, hashType, tx,
+ hash, err := calcWitnessSignatureHashRaw(subScript, sigHashes, hashType, tx,
idx, amt)
if err != nil {
return nil, err | txscript/sign: Use calcWitnessSigHashRaw for witness sigs | btcsuite_btcd | train | go |
4171fbb4384a1697e5c70c38b1d4a4b67349dd75 | diff --git a/sos/jupyter/test/test_convert.py b/sos/jupyter/test/test_convert.py
index <HASH>..<HASH> 100644
--- a/sos/jupyter/test/test_convert.py
+++ b/sos/jupyter/test/test_convert.py
@@ -65,6 +65,8 @@ report('this is action report')
notebook_to_script(script_file + '.ipynb', script_file)
def testConvertAll(self):
+ olddir = os.getcwd()
+ os.chdir(os.path.split(__file__)[0])
subprocess.call('sos convert test.ipynb test_wf.sos --all', shell=True)
self.assertTrue(os.path.isfile('test_wf.sos'))
subprocess.call('sos convert test_wf.sos test2.ipynb', shell=True)
@@ -72,6 +74,7 @@ report('this is action report')
# --execute does not yet work
os.remove('test_wf.sos')
os.remove('test2.ipynb')
+ os.chdir(olddir)
if __name__ == '__main__':
#suite = unittest.defaultTestLoader.loadTestsFromTestCase(TestConvert) | Fix a test caused by chdir | vatlab_SoS | train | py |
9df19e8bc862901884c97eb8dec2acbbe3641603 | diff --git a/src/global/money/money.test.js b/src/global/money/money.test.js
index <HASH>..<HASH> 100644
--- a/src/global/money/money.test.js
+++ b/src/global/money/money.test.js
@@ -70,12 +70,12 @@ describe('ui-money-mask', function() {
it('shold allow string as definition of decimals', angular.mock.inject(function($rootScope) {
var input = TestUtil.compile('<input ng-model="model" ui-money-mask="decimals">', {
model: '3456.79',
- decimals: "2"
+ decimals: '2'
});
var model = input.controller('ngModel');
expect(model.$viewValue).toBe('$ 3,456.79');
- $rootScope.decimals = "3";
+ $rootScope.decimals = '3';
$rootScope.$digest();
expect(model.$viewValue).toBe('$ 345.679');
})); | style(uiMoneyMask): change double quotes to single quotes | assisrafael_angular-input-masks | train | js |
a56c445dffe81bde5729e4561739f8bc9f41e123 | diff --git a/src/main/java/org/sakaiproject/nakamura/lite/CachingManager.java b/src/main/java/org/sakaiproject/nakamura/lite/CachingManager.java
index <HASH>..<HASH> 100644
--- a/src/main/java/org/sakaiproject/nakamura/lite/CachingManager.java
+++ b/src/main/java/org/sakaiproject/nakamura/lite/CachingManager.java
@@ -63,9 +63,10 @@ public abstract class CachingManager {
if (sharedCache != null && sharedCache.containsKey(cacheKey)) {
- CacheHolder aclCacheHolder = sharedCache.get(cacheKey);
- if (aclCacheHolder != null) {
- m = aclCacheHolder.get();
+ CacheHolder cacheHolder = sharedCache.get(cacheKey);
+ if (cacheHolder != null) {
+ m = cacheHolder.get();
+ LOGGER.debug("Cache Hit {} {} {} ",new Object[]{cacheKey, cacheHolder, m});
hit++;
}
}
@@ -74,7 +75,7 @@ public abstract class CachingManager {
miss++;
if (sharedCache != null) {
if (m != null) {
- LOGGER.debug("Found Map {} {}", cacheKey, m);
+ LOGGER.debug("Cache Miss, Found Map {} {}", cacheKey, m);
}
sharedCache.put(cacheKey, new CacheHolder(m));
} | Improved Logging in the Caching Manager for debug level | ieb_sparsemapcontent | train | java |
df8bd551d29937a4c0da48de4a806b633b198fb5 | diff --git a/src/main/java/io/nats/client/impl/MemoryAuthHandler.java b/src/main/java/io/nats/client/impl/MemoryAuthHandler.java
index <HASH>..<HASH> 100644
--- a/src/main/java/io/nats/client/impl/MemoryAuthHandler.java
+++ b/src/main/java/io/nats/client/impl/MemoryAuthHandler.java
@@ -1,4 +1,4 @@
-// Copyright 2018 The NATS Authors
+// Copyright 2022 The NATS Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at: | adding test for MemoryAuthHandler and improving other coverage | nats-io_java-nats | train | java |
8379d81f2ecab1d0a79102a499e2a0c4ce96ac79 | diff --git a/lib/build/helpers/cjs.js b/lib/build/helpers/cjs.js
index <HASH>..<HASH> 100644
--- a/lib/build/helpers/cjs.js
+++ b/lib/build/helpers/cjs.js
@@ -164,7 +164,7 @@ module.exports = baseHelper.makeHelper({
*/
ignore: function(additional){
return [function(name, load){
- if(load.address.search(/node_modules/) >= 0 || load.metadata.format === "defined") {
+ if(load.address.indexOf("node_modules") >= 0 || load.metadata.format === "defined") {
return true;
}
}].concat(additional || []);
diff --git a/test/test.js b/test/test.js
index <HASH>..<HASH> 100644
--- a/test/test.js
+++ b/test/test.js
@@ -1611,7 +1611,7 @@ describe("export", function(){
});
- it.only("+global-css +global-js", function(done){
+ it("+global-css +global-js", function(done){
this.timeout(10000);
stealExport({ | Removed .only from tests; Changing .search back to .indexOf since we decided to remove slashes from the check. | stealjs_steal-tools | train | js,js |
6acd9b15d0db2adb547f70647a813171df53618e | diff --git a/addon/mixins/models-navigation.js b/addon/mixins/models-navigation.js
index <HASH>..<HASH> 100644
--- a/addon/mixins/models-navigation.js
+++ b/addon/mixins/models-navigation.js
@@ -10,7 +10,7 @@ export default Ember.Mixin.create({
disableNext: Ember.computed.and('lastModel', 'disableCycling'),
disablePrevious: Ember.computed.and('firstModel', 'disableCycling'),
- lastModel: Ember.computed('navigationIndex', function() {
+ lastModel: Ember.computed('navigationIndex', 'navigableModels.[]', function() {
return this.get('navigationIndex') === this.get('navigableModels.length') - 1;
}),
@@ -20,7 +20,7 @@ export default Ember.Mixin.create({
}
}.observes('navigableModel'),
- resetIndex: function() {
+ resetNavigationIndex: function() {
this.set('navigationIndex', null);
}.observes('navigableModels.[]'), | Update lastModel when the navigable models change | alphasights_ember-cli-paint | train | js |
31897fc532045060bd8e9b77535bafbf0215ca74 | diff --git a/LiSE/LiSE/proxy.py b/LiSE/LiSE/proxy.py
index <HASH>..<HASH> 100644
--- a/LiSE/LiSE/proxy.py
+++ b/LiSE/LiSE/proxy.py
@@ -2231,7 +2231,8 @@ class EngineProxy(AbstractEngine):
def _upd_and_cb(self, cb, *args, **kwargs):
self._upd_caches(*args, **kwargs, no_del=True)
self._set_time(*args, **kwargs)
- cb(*args, **kwargs)
+ if cb:
+ cb(*args, **kwargs)
# TODO: make this into a Signal, like it is in the LiSE core
def next_turn(self, cb=None, block=False): | Make EngineProxy.next_turn work without callback or block | LogicalDash_LiSE | train | py |
960856dbdd7811fddc0f34396c363ce83c737e6c | diff --git a/lib/dentaku/ast/combinators.rb b/lib/dentaku/ast/combinators.rb
index <HASH>..<HASH> 100644
--- a/lib/dentaku/ast/combinators.rb
+++ b/lib/dentaku/ast/combinators.rb
@@ -17,7 +17,7 @@ module Dentaku
private
def valid_node?(node)
- node.dependencies.any? || node.type == :logical
+ !node.nil? && (node.dependencies.any? || node.type == :logical)
end
end
diff --git a/spec/calculator_spec.rb b/spec/calculator_spec.rb
index <HASH>..<HASH> 100644
--- a/spec/calculator_spec.rb
+++ b/spec/calculator_spec.rb
@@ -180,6 +180,11 @@ describe Dentaku::Calculator do
expect(calculator.evaluate(unbound) { |e| e }).to eq unbound
end
+ it 'fails to evaluate incomplete statements' do
+ incomplete = 'true AND'
+ expect { calculator.evaluate!(incomplete) }.to raise_error(Dentaku::ParseError)
+ end
+
it 'evaluates unbound statements given a binding in memory' do
expect(calculator.evaluate('foo * 1.5', foo: 2)).to eq(3)
expect(calculator.bind(monkeys: 3).evaluate('monkeys < 7')).to be_truthy | Fix Combinator failing on nil nodes | rubysolo_dentaku | train | rb,rb |
612fdb98df0ff84c81603a5c8d66a5f2f4395bd5 | diff --git a/cmd/web.go b/cmd/web.go
index <HASH>..<HASH> 100644
--- a/cmd/web.go
+++ b/cmd/web.go
@@ -356,6 +356,7 @@ func runWeb(*cli.Context) {
r.Get("/commit/:branchname/*", repo.Diff)
r.Get("/releases", repo.Releases)
r.Get("/archive/:branchname/*.*", repo.Download)
+ r.Get("/archive/*.*", repo.Download)
r.Get("/compare/:before([a-z0-9]+)...:after([a-z0-9]+)", repo.CompareDiff)
}, ignSignIn, middleware.RepoAssignment(true, true)) | bug fixed for download <I> from repo's home page | gogs_gogs | train | go |
ad4cc1175d10f16ccd00eff4ec372b667af839e3 | diff --git a/lib/Doctrine/DBAL/Query/QueryBuilder.php b/lib/Doctrine/DBAL/Query/QueryBuilder.php
index <HASH>..<HASH> 100644
--- a/lib/Doctrine/DBAL/Query/QueryBuilder.php
+++ b/lib/Doctrine/DBAL/Query/QueryBuilder.php
@@ -1137,7 +1137,7 @@ class QueryBuilder
private function isLimitQuery()
{
- return $this->maxResults !== null || $this->firstResult != null;
+ return $this->maxResults !== null || $this->firstResult !== null;
}
/** | Use a strict check against null | doctrine_dbal | train | php |
4daec2e23b6f28f6f3f9aef8b34110520d39765c | diff --git a/salt/utils/templates.py b/salt/utils/templates.py
index <HASH>..<HASH> 100644
--- a/salt/utils/templates.py
+++ b/salt/utils/templates.py
@@ -55,6 +55,8 @@ def wrap_tmpl_func(render_str):
tmplstr = tmplsrc
else:
try:
+ if tmplpath is not None:
+ tmplsrc = os.path.join(tmplpath, tmplsrc)
with codecs.open(tmplsrc, 'r', SLS_ENCODING) as _tmplsrc:
tmplstr = _tmplsrc.read()
except (UnicodeDecodeError, ValueError) as exc: | Honor tmplpath in wrapped template renderers
Before this change you had to directly use `render_*_tmpl()` in order to
use `tmplpath`. Failing that, by using the renderers wrapped with
`wrap_tmpl_func()` the `tmplpath` argument was not used.
Fixes saltstack/salt#<I> | saltstack_salt | train | py |
39473184895132f9899a4f07ac5863b9b21dd3ec | diff --git a/index.js b/index.js
index <HASH>..<HASH> 100644
--- a/index.js
+++ b/index.js
@@ -2,32 +2,8 @@
// handles keeping the connection open and
// dealing with reconnections.
//
-// In Node.js applications MongoDB connections
-// are meant to be opened once and kept opened
-// while the Node.js app is running
-// (http://stackoverflow.com/a/15688610/446681).
-// This code encapsulates the logic required to
-// do this.
+// More info: https://github.com/hectorcorrea/mongoConnect
//
-// Be aware that currently only one database can
-// be handled through this code. As such, only the
-// first call to setup is honored, subsequent calls
-// are ignored.
-//
-// Typical usage is:
-//
-// // In your main server.js
-// var mongoConnect = require('./mongoConnect');
-// mongoConnect.setup('mongodb://localhost:27017/yourDB');
-//
-// // In your database access code
-// var mongoConnect = require('./mongoConnect');
-// mongoConnect.execute(function(err, db) {
-// Your code to do something with the db goes here
-// e.g. db.collection('xxx').find(...)
-// })
-//
-
var MongoClient = require('mongodb').MongoClient;
var dbUrl = null;
var isConnected = false; | Added link to github repo | hectorcorrea_mongoConnect | train | js |
1d21806198c8cb949e32be7e4acb46b34acb1d9c | diff --git a/pyt/ast_helper.py b/pyt/ast_helper.py
index <HASH>..<HASH> 100644
--- a/pyt/ast_helper.py
+++ b/pyt/ast_helper.py
@@ -3,6 +3,10 @@ Useful when working with the ast module."""
import ast
import os
+
+BLACK_LISTED_CALL_NAMES = ['self']
+
+
def generate_ast(path):
"""Generate an Abstract Syntax Tree using the ast module."""
if os.path.isfile(path):
@@ -19,7 +23,8 @@ def list_to_dotted_string(list_of_components):
def get_call_names_helper(node, result):
"""Recursively finds all function names."""
if isinstance(node, ast.Name):
- result.append(node.id)
+ if node.id not in BLACK_LISTED_CALL_NAMES:
+ result.append(node.id)
return result
elif isinstance(node, ast.Call):
return result | Added blacklisted keywords to get call names | python-security_pyt | train | py |
005a6d9d3d2e3be4cff8d7d1c5fc5b6058536496 | diff --git a/raven/processors.py b/raven/processors.py
index <HASH>..<HASH> 100644
--- a/raven/processors.py
+++ b/raven/processors.py
@@ -9,7 +9,7 @@ from __future__ import absolute_import
import re
-from raven._compat import string_types
+from raven._compat import string_types, text_type
from raven.utils import varmap
@@ -98,6 +98,8 @@ class SanitizePasswordsProcessor(Processor):
# properly without failing so we can perform our check.
if isinstance(key, bytes):
key = key.decode('utf-8', 'replace')
+ else:
+ key = text_type(key)
key = key.lower()
for field in self.FIELDS: | Fixed a regression in key handling in the sanitizer. | getsentry_raven-python | train | py |
dbdc5c11cdec8798f7bad6b61ba81a12c2f07e9c | diff --git a/cloudfoundry-client/src/main/lombok/org/cloudfoundry/client/v2/buildpacks/GetBuildpackResponse.java b/cloudfoundry-client/src/main/lombok/org/cloudfoundry/client/v2/buildpacks/GetBuildpackResponse.java
index <HASH>..<HASH> 100644
--- a/cloudfoundry-client/src/main/lombok/org/cloudfoundry/client/v2/buildpacks/GetBuildpackResponse.java
+++ b/cloudfoundry-client/src/main/lombok/org/cloudfoundry/client/v2/buildpacks/GetBuildpackResponse.java
@@ -33,6 +33,7 @@ public final class GetBuildpackResponse extends AbstractBuildpackResource {
@Builder
GetBuildpackResponse(@JsonProperty("entity") BuildpackEntity entity,
@JsonProperty("metadata") Metadata metadata) {
+
super(entity, metadata);
} | Polishing
[#<I>][resolves #<I>] | cloudfoundry_cf-java-client | train | java |
a5e40fc42739130e7adc8a841ead7dd064b34256 | diff --git a/lib/Elastica/Aggregation/AbstractAggregation.php b/lib/Elastica/Aggregation/AbstractAggregation.php
index <HASH>..<HASH> 100755
--- a/lib/Elastica/Aggregation/AbstractAggregation.php
+++ b/lib/Elastica/Aggregation/AbstractAggregation.php
@@ -73,7 +73,10 @@ abstract class AbstractAggregation extends Param
$array = parent::toArray();
if (array_key_exists('global_aggregation', $array)) {
// compensate for class name GlobalAggregation
- $array = array('global' => $array['global_aggregation']);
+ if(empty($array['global_aggregation']))
+ $array = array('global' => new \stdClass());
+ else
+ $array = array('global' => $array['global_aggregation']);
}
if (sizeof($this->_aggs)) {
$array['aggs'] = $this->_aggs; | Global/Aggregation - empty array is retuned in JSON as [] insetad of {} | ruflin_Elastica | train | php |
b80d36b791f9634903b831bafd54149b112968f8 | diff --git a/digitalocean/Action.py b/digitalocean/Action.py
index <HASH>..<HASH> 100644
--- a/digitalocean/Action.py
+++ b/digitalocean/Action.py
@@ -1,17 +1,20 @@
from .baseapi import BaseAPI
class Action(BaseAPI):
+ id = action_id
+ token = None
+ status = None
+ type = None
+ started_at = None
+ completed_at = None
+ resource_id = None
+ resource_type = None
+ region = None
+
def __init__(self, action_id=""):
super(Action, self).__init__()
- self.id = action_id
- self.token = None
- self.status = None
- self.type = None
- self.started_at = None
- self.completed_at = None
- self.resource_id = None
- self.resource_type = None
- self.region = None
+ if action_id:
+ self.id = action_id
def load(self):
action = self.get_data("actions/%s" % self.id) | Improved Action class using a better class "style" | koalalorenzo_python-digitalocean | train | py |
701b3e65630378bfa6637887b9661ef4250430ff | diff --git a/code/libraries/koowa/components/com_activities/views/activities/html.php b/code/libraries/koowa/components/com_activities/views/activities/html.php
index <HASH>..<HASH> 100644
--- a/code/libraries/koowa/components/com_activities/views/activities/html.php
+++ b/code/libraries/koowa/components/com_activities/views/activities/html.php
@@ -15,18 +15,18 @@
*/
class ComActivitiesViewActivitiesHtml extends ComKoowaViewHtml
{
- public function display()
+ public function fetchData(KViewContext $context)
{
if ($this->getLayout() == 'default')
{
$model = $this->getObject($this->getModel()->getIdentifier());
- $this->packages = $model
+ $context->data->packages = $model
->distinct(true)
->column('package')
->getList();
}
- return parent::display();
+ return parent::fetchData($context);
}
} | Synced with changes in framework | joomlatools_joomlatools-framework | train | php |
4afd32526e5b5eaa1303f4c023f5daf3621913d7 | diff --git a/state/settings.go b/state/settings.go
index <HASH>..<HASH> 100644
--- a/state/settings.go
+++ b/state/settings.go
@@ -222,9 +222,11 @@ func (s *Settings) write(ops []txn.Op) error {
// overwriting unrelated changes made to the node since it was last read.
func (s *Settings) Write() ([]ItemChange, error) {
changes, ops := s.settingsUpdateOps()
- err := s.write(ops)
- if err != nil {
- return nil, err
+ if len(ops) > 0 {
+ err := s.write(ops)
+ if err != nil {
+ return nil, err
+ }
}
return changes, nil
} | Don't issue no-op txn on settings write | juju_juju | train | go |
ebafcdf5ec8c9f35606a5b970aee61d507eac6b9 | diff --git a/lib/models/datastores/SqlDatabase.php b/lib/models/datastores/SqlDatabase.php
index <HASH>..<HASH> 100644
--- a/lib/models/datastores/SqlDatabase.php
+++ b/lib/models/datastores/SqlDatabase.php
@@ -745,7 +745,7 @@ abstract class SqlDatabase extends DataStore
public function countAllItems()
{
- $result = $this->query("SELECT COUNT(id) as count FROM {$this->table}");
+ $result = $this->query("SELECT COUNT(id) as count FROM {$this->schema}.{$this->table}");
return $result[0]['count'];
} | Fixed a bug in the count all | ntentan_ntentan | train | php |
c1237c0aaf302c2329f67d32eb1f381313d84f96 | diff --git a/lib/deliver/app_metadata.rb b/lib/deliver/app_metadata.rb
index <HASH>..<HASH> 100644
--- a/lib/deliver/app_metadata.rb
+++ b/lib/deliver/app_metadata.rb
@@ -456,6 +456,9 @@ module Deliver
# Remove all GameCenter related code
fetch_value("//x:game_center").remove
+ # Remove all InApp purchases
+ fetch_value("//x:in_app_purchases").remove
+
fetch_value("//x:software_screenshots").remove
end | Fixed problems when in app purchases are enabled | fastlane_fastlane | train | rb |
4415bd1d060158ca3bf8c94037aac48c7f531603 | diff --git a/lib/coverband/reporter.rb b/lib/coverband/reporter.rb
index <HASH>..<HASH> 100644
--- a/lib/coverband/reporter.rb
+++ b/lib/coverband/reporter.rb
@@ -1,5 +1,3 @@
-require 'simplecov'
-
module Coverband
class Reporter
@@ -16,6 +14,12 @@ module Coverband
end
def self.report(options = {})
+ begin
+ require 'simplecov' if Coverband.configuration.reporter=='scov'
+ rescue
+ puts "coverband requires simplecov in order to generate a report, when configured for the scov report style."
+ return
+ end
redis = Coverband.configuration.redis
roots = Coverband.configuration.root_paths
existing_coverage = Coverband.configuration.coverage_baseline
diff --git a/lib/coverband/version.rb b/lib/coverband/version.rb
index <HASH>..<HASH> 100644
--- a/lib/coverband/version.rb
+++ b/lib/coverband/version.rb
@@ -1,3 +1,3 @@
module Coverband
- VERSION = "0.0.23"
+ VERSION = "0.0.24"
end | only require simplecov when generating a report not for recording. | danmayer_coverband | train | rb,rb |
08257c2858d4db3ab911f2c91f88cfeecef73396 | diff --git a/app/controllers/api/v1/direct_uploads_controller.rb b/app/controllers/api/v1/direct_uploads_controller.rb
index <HASH>..<HASH> 100644
--- a/app/controllers/api/v1/direct_uploads_controller.rb
+++ b/app/controllers/api/v1/direct_uploads_controller.rb
@@ -12,7 +12,7 @@ private
def direct_upload_json(blob)
blob.as_json(root: false, methods: :signed_id)
- .merge(service_url: url_for(blob))
+ .merge(service_url: rails_blob_path(blob))
.merge(direct_upload:{
url: blob.service_url_for_direct_upload,
headers: blob.service_headers_for_direct_upload | Update direct_uploads_controller.rb
use relative route | michelson_chaskiq | train | rb |
3d31f3b3e24675c6cf2d1c6e2931c1c104975cfe | diff --git a/lxc/copy.go b/lxc/copy.go
index <HASH>..<HASH> 100644
--- a/lxc/copy.go
+++ b/lxc/copy.go
@@ -23,9 +23,9 @@ func (c *copyCmd) showByDefault() bool {
func (c *copyCmd) usage() string {
return i18n.G(
- `Copy containers within or in between LXD instances.
+ `Usage: lxc copy [<remote>:]<source>[/<snapshot>] [[<remote>:]<destination>] [--ephemeral|e] [--profile|-p <profile>...] [--config|-c <key=value>...]
-lxc copy [<remote>:]<source>[/<snapshot>] [[<remote>:]<destination>] [--ephemeral|e] [--profile|-p <profile>...] [--config|-c <key=value>...]`)
+Copy containers within or in between LXD instances.`)
}
func (c *copyCmd) flags() { | lxc/copy: Rework usage to be parsable by help2man | lxc_lxd | train | go |
1f2d82cc19db9be3e129ee9c7ef84870246487cc | diff --git a/dropwizard-testing/src/main/java/io/dropwizard/testing/DropwizardTestSupport.java b/dropwizard-testing/src/main/java/io/dropwizard/testing/DropwizardTestSupport.java
index <HASH>..<HASH> 100644
--- a/dropwizard-testing/src/main/java/io/dropwizard/testing/DropwizardTestSupport.java
+++ b/dropwizard-testing/src/main/java/io/dropwizard/testing/DropwizardTestSupport.java
@@ -72,8 +72,12 @@ public class DropwizardTestSupport<C extends Configuration> {
}
public void after() {
- stopIfRequired();
- resetConfigOverrides();
+ try {
+ stopIfRequired();
+ }
+ finally {
+ resetConfigOverrides();
+ }
}
private void stopIfRequired() { | DropwizardTestSupport.after: Ensure config overrides are always reset. | dropwizard_dropwizard | train | java |
e046e5ca38522a997ff9d605beeaf92a9971699e | diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/profiles/ProfileExporter.java b/sonar-plugin-api/src/main/java/org/sonar/api/profiles/ProfileExporter.java
index <HASH>..<HASH> 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/profiles/ProfileExporter.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/profiles/ProfileExporter.java
@@ -24,7 +24,6 @@ import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;
import org.sonar.api.ExtensionPoint;
-import org.sonar.api.batch.ScannerSide;
import org.sonar.api.server.ServerSide;
/**
@@ -32,7 +31,6 @@ import org.sonar.api.server.ServerSide;
*
* @since 2.3
*/
-@ScannerSide
@ServerSide
@ExtensionPoint
public abstract class ProfileExporter { | SONAR-<I> Remove @ScannerSide annotation from ProfileExporter | SonarSource_sonarqube | train | java |
8bd9217e8aee12f34107e50b75afa74701415f9b | diff --git a/eZ/Publish/Core/REST/Client/Tests/HttpClient/StreamTest.php b/eZ/Publish/Core/REST/Client/Tests/HttpClient/StreamTest.php
index <HASH>..<HASH> 100644
--- a/eZ/Publish/Core/REST/Client/Tests/HttpClient/StreamTest.php
+++ b/eZ/Publish/Core/REST/Client/Tests/HttpClient/StreamTest.php
@@ -46,7 +46,7 @@ class StreamTest extends \PHPUnit_Framework_TestCase
{
$response = $this->client->request( 'GET', '/' );
- $this->assertSame( 200, $response->headers['status'] );
+ $this->assertSame( 500, $response->headers['status'] );
}
/** | Fixed: Expected error code.
Missing authentication in test mode gives <I>. | ezsystems_ezpublish-kernel | train | php |
62b04e088d8652e8abe6dadc6623255376bbf53b | diff --git a/mod/forum/view.php b/mod/forum/view.php
index <HASH>..<HASH> 100644
--- a/mod/forum/view.php
+++ b/mod/forum/view.php
@@ -219,10 +219,19 @@
if ($mode) {
set_user_preference("forum_displaymode", $mode);
}
+
+ $groupmode = groups_get_activity_groupmode($cm, $course);
+ $canreply = NULL;
+ if ($groupmode == SEPARATEGROUPS) {
+ if (!has_capability('moodle/site:accessallgroups', $context)) {
+ $canreply = false;
+ }
+ }
+
$displaymode = get_user_preferences("forum_displaymode", $CFG->forum_displaymode);
$canrate = has_capability('mod/forum:rate', $context);
echo ' '; // this should fix the floating in FF
- forum_print_discussion($course, $cm, $forum, $discussion, $post, $displaymode, NULL, $canrate);
+ forum_print_discussion($course, $cm, $forum, $discussion, $post, $displaymode, $canreply, $canrate);
break;
case 'eachuser': | MDL-<I> separate groups mode and single discussion forums == normal students can not reply; merged from MOODLE_<I>_STABLE | moodle_moodle | train | php |
5acc1178685fcc639e317aabb61170f09970522c | diff --git a/src/server/pachyderm_test.go b/src/server/pachyderm_test.go
index <HASH>..<HASH> 100644
--- a/src/server/pachyderm_test.go
+++ b/src/server/pachyderm_test.go
@@ -8285,3 +8285,33 @@ func getEtcdClient(t testing.TB) *etcd.Client {
})
return etcdClient
}
+
+func TestSpout(t *testing.T) {
+ if testing.Short() {
+ t.Skip("Skipping integration tests in short mode")
+ }
+ c := getPachClient(t)
+ require.NoError(t, c.DeleteAll())
+
+ dataRepo := tu.UniqueString("TestService_data")
+ require.NoError(t, c.CreateRepo(dataRepo))
+
+ _, err := c.PutFile(dataRepo, "master", "file1", strings.NewReader("foo"))
+ require.NoError(t, err)
+
+ pipeline := tu.UniqueString("pipelinespout")
+ // This pipeline sleeps for 10 secs per datum
+ require.NoError(t, c.CreatePipelineService(
+ pipeline,
+ "",
+ []string{"/bin/sh"},
+ []string{"date > date", "tar -cvf /pfs/out ./"},
+ &pps.ParallelismSpec{
+ Constant: 1,
+ },
+ client.NewPFSInput(dataRepo, "/"),
+ false,
+ 8000,
+ 31800,
+ ))
+} | write test for spout pipelines | pachyderm_pachyderm | train | go |
0fc2282fc2242f0ecb4b13437383d9f62cb5bd6b | diff --git a/src/Symfony/Component/Form/FormEvents.php b/src/Symfony/Component/Form/FormEvents.php
index <HASH>..<HASH> 100644
--- a/src/Symfony/Component/Form/FormEvents.php
+++ b/src/Symfony/Component/Form/FormEvents.php
@@ -31,7 +31,7 @@ final class FormEvents
*
* @Event("Symfony\Component\Form\FormEvent")
*/
- const PRE_SUBMIT = 'form.pre_bind';
+ const PRE_SUBMIT = 'form.pre_submit';
/**
* The SUBMIT event is dispatched just before the Form::submit() method
@@ -41,7 +41,7 @@ final class FormEvents
*
* @Event("Symfony\Component\Form\FormEvent")
*/
- const SUBMIT = 'form.bind';
+ const SUBMIT = 'form.submit';
/**
* The FormEvents::POST_SUBMIT event is dispatched after the Form::submit()
@@ -51,7 +51,7 @@ final class FormEvents
*
* @Event("Symfony\Component\Form\FormEvent")
*/
- const POST_SUBMIT = 'form.post_bind';
+ const POST_SUBMIT = 'form.post_submit';
/**
* The FormEvents::PRE_SET_DATA event is dispatched at the beginning of the Form::setData() method. | fix the constant value to be consistent with the name | symfony_symfony | train | php |
28acaa1f4657e2dfafb4631b0bf1eb6065a296df | diff --git a/lib/indico.js b/lib/indico.js
index <HASH>..<HASH> 100644
--- a/lib/indico.js
+++ b/lib/indico.js
@@ -25,7 +25,6 @@ var public_api = 'http://apiv2.indico.io/'
indico.apiKey = false;
indico.cloud = false;
-
function service(name, privateCloud, apiKey) {
if (privateCloud) {
var prefix = 'http://' + privateCloud + '.indico.domains/';
@@ -50,12 +49,26 @@ var api_request = function(api) {
var options = {
method: 'POST',
url: service(api, privateCloud, apiKey),
- body: JSON.stringify(body)
+ body: JSON.stringify(body),
+ // TODO: Change headers to final tracking headers names
+ headers: {
+ 'client-lib': 'node',
+ 'version-number': '1.3.0'
+ }
};
return request(options).then(function(results){
var res = results[0];
var body = results[1];
+ /*
+ TODO: Make sure this matches the API headers
+ */
+ var warning = res.headers['X-warning'];
+
+ if (warning) {
+ console.warn(warning);
+ }
+
if (res.statusCode !== 200) {
return body;
} | Tiny if statmenets for x-warning header and client-lib/version-number headers | IndicoDataSolutions_IndicoIo-node | train | js |
0c70f81c0dc62dbde062bee379c36c08127355e0 | diff --git a/auth/ldap/lib.php b/auth/ldap/lib.php
index <HASH>..<HASH> 100644
--- a/auth/ldap/lib.php
+++ b/auth/ldap/lib.php
@@ -79,7 +79,9 @@ function auth_get_userinfo($username){
$search_attribs = array();
foreach ($attrmap as $key=>$value) {
- array_push($search_attribs, $value);
+ if (!in_array($value, $search_attribs) {
+ array_push($search_attribs, $value);
+ }
}
$user_dn = auth_ldap_find_userdn($ldap_connection, $username); | To fix authentication issue when same ldap-attribute is used multiple fields in Moodle. | moodle_moodle | train | php |
8dc208c27db83f539c7beb10b2104b9c3ded49d6 | diff --git a/spec/rubycards/deck_spec.rb b/spec/rubycards/deck_spec.rb
index <HASH>..<HASH> 100644
--- a/spec/rubycards/deck_spec.rb
+++ b/spec/rubycards/deck_spec.rb
@@ -1,12 +1,17 @@
require 'spec_helper'
-describe RubyCards::Deck do
- subject(:deck) { RubyCards::Deck.new }
+include RubyCards
+
+describe Deck do
+ subject(:deck) { Deck.new }
describe '#initialize' do
it 'initializes 52 cards' do
deck.cards.count.should == 52
- deck.cards.each { |card| card.should be_a RubyCards::Card }
+ # test indexing
+ deck[0].should be_a Card
+ # test enumerability
+ deck.each { |card| card.should be_a Card }
end
end | Added spec actions to check indexing and enumerability | jdan_rubycards | train | rb |
dca98fada6c71943e3b09743ddfc56d111323456 | diff --git a/Gruntfile.js b/Gruntfile.js
index <HASH>..<HASH> 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -8,17 +8,18 @@ module.exports = function (grunt) {
windows = /^win/.test(process.platform),
bin = windows ? "venv/Scripts/" : "venv/bin/",
lib = windows ? "venv/Lib/" : "venv/lib/",
+ exe = windows ? ".exe" : "",
zipExt = windows ? ".zip" : ".tar.gz",
config,
python = path.resolve(bin + "python"),
pip = path.resolve(bin + "pip"),
sphinx = path.resolve(bin + "sphinx-build"),
pep8 = path.resolve(bin + "pep8"),
- nosetests = path.resolve(bin + "nosetests"),
+ nosetests = path.resolve(bin + "nosetests" + exe),
coverage = path.resolve(bin + "coverage"),
tangelo_script = path.resolve(bin + "tangelo"),
tangelo = windows ? python : tangelo_script,
- tangelo_dir = path.resolve(lib + "python-2.7/site-packages/tangelo"),
+ tangelo_dir = path.resolve(lib + windows ? "" : "python-2.7/" + "site-packages/tangelo"),
version = grunt.file.readJSON("package.json").version,
tangeloArgs; | Adding .exe to manually invoked executable | Kitware_tangelo | train | js |
f1cc0d8fb30c700a4748fd9118d2f706f97536e9 | diff --git a/src/Helpers/Layouts.php b/src/Helpers/Layouts.php
index <HASH>..<HASH> 100644
--- a/src/Helpers/Layouts.php
+++ b/src/Helpers/Layouts.php
@@ -9,18 +9,18 @@ class Layouts
* @param string $module
* @return array
*/
- public static function getLayouts($module)
+ public static function getLayouts($module, $directory = 'layouts')
{
$layouts = array();
// Get list of layouts from module
- $vendorLayoutsDir = base_path("vendor/pvtl/$module/resources/views/layouts");
+ $vendorLayoutsDir = base_path("vendor/pvtl/$module/resources/views/$directory");
if (is_dir($vendorLayoutsDir)) {
$layouts = scandir($vendorLayoutsDir);
}
// Get list of layouts from project
- $projectLayoutsDir = resource_path("views/vendor/$module/layouts");
+ $projectLayoutsDir = resource_path("views/vendor/$module/$directory");
if (is_dir($projectLayoutsDir)) {
$layouts = array_merge($layouts, scandir($projectLayoutsDir));
} | All the use of other view directories | pvtl_voyager-frontend | train | php |
5c17b497a3e9392f8228a99783ccb3fffcea5bd1 | diff --git a/spec/remote_settings_spec.rb b/spec/remote_settings_spec.rb
index <HASH>..<HASH> 100644
--- a/spec/remote_settings_spec.rb
+++ b/spec/remote_settings_spec.rb
@@ -163,6 +163,7 @@ RSpec.describe Airbrake::RemoteSettings do
remote_settings.stop_polling
expect(Airbrake::Loggable.instance).not_to have_received(:error)
+ expect(stub).to have_been_requested.once
end
end | rubocop: fix offences of RSpec/LetSetup cop | airbrake_airbrake-ruby | train | rb |
51d7cb28207bb1dadb4a2738461a55b4dced1a88 | diff --git a/src/ol/mapbrowserevent.js b/src/ol/mapbrowserevent.js
index <HASH>..<HASH> 100644
--- a/src/ol/mapbrowserevent.js
+++ b/src/ol/mapbrowserevent.js
@@ -199,7 +199,7 @@ ol.MapBrowserEventHandler = function(map) {
this.handlePointerDown_, false, this);
this.relayedListenerKey_ = goog.events.listen(this.pointerEventHandler_,
- [ol.pointer.EventType.POINTERMOVE],
+ ol.pointer.EventType.POINTERMOVE,
this.relayEvent_, false, this);
if (ol.LEGACY_IE_SUPPORT && ol.IS_LEGACY_IE) { | Make goog.events.listen return proper listener key
When goog.events.listen receives an array of event types,
it only return null as listener key. So that calling
goog.events.unlistenByKey does not work. | openlayers_openlayers | train | js |
d44ccba0b630cdad73379005fe09ce4e2337d835 | diff --git a/src/test/org/openscience/cdk/qsar/DescriptorNamesTest.java b/src/test/org/openscience/cdk/qsar/DescriptorNamesTest.java
index <HASH>..<HASH> 100644
--- a/src/test/org/openscience/cdk/qsar/DescriptorNamesTest.java
+++ b/src/test/org/openscience/cdk/qsar/DescriptorNamesTest.java
@@ -70,7 +70,7 @@ public class DescriptorNamesTest extends CDKTestCase {
List<String> descNames = new ArrayList<String>();
for (IImplementationSpecification spec : specs) {
DescriptorValue value = (DescriptorValue) ac.getProperty(spec);
- if (value == null) continue;
+ if (value == null) Assert.fail(spec.getImplementationTitle() + " was not calculated.");
ncalc++;
String[] names = value.getNames();
descNames.addAll(Arrays.asList(names)); | Report descriptors which were not calculated. | cdk_cdk | train | java |
3a494bf6c53238d1ea155184154f7feaf5d399b1 | diff --git a/lib/json-patch-schema.js b/lib/json-patch-schema.js
index <HASH>..<HASH> 100644
--- a/lib/json-patch-schema.js
+++ b/lib/json-patch-schema.js
@@ -11,6 +11,6 @@ internals.opSchema = {
from: joi.string().when('op', { is: ['copy', 'move'], otherwise: joi.forbidden()})
};
-internals.schema = joi.array().includes(internals.opSchema);
+internals.schema = joi.array().items(internals.opSchema).default([]);
module.exports = internals.schema;
\ No newline at end of file | changes to json patch schema:
- array.includes --> items
- added default([]) | entrinsik-org_utils | train | js |
31ed49c5d8e81f5d68a2cd561c2a51d7cc31712f | diff --git a/core/Updates/3.7.0-b1.php b/core/Updates/3.7.0-b1.php
index <HASH>..<HASH> 100644
--- a/core/Updates/3.7.0-b1.php
+++ b/core/Updates/3.7.0-b1.php
@@ -29,8 +29,8 @@ class Updates_3_7_0_b1 extends PiwikUpdates
public function getMigrations(Updater $updater)
{
return [
- $this->migration->db->addColumn(Model::$rawPrefix, 'evolution_graph_within_period', 'TINYINT(4) NOT NULL DEFAULT 0'),
- $this->migration->db->addColumn(Model::$rawPrefix, 'evolution_graph_period_n', 'INT(11) NULL'),
+ $this->migration->db->addColumn('report', 'evolution_graph_within_period', 'TINYINT(4) NOT NULL DEFAULT 0'),
+ $this->migration->db->addColumn('report', 'evolution_graph_period_n', 'INT(11) NULL'),
];
} | Prevent possible fatal during update (#<I>) | matomo-org_matomo | train | php |
65b893874f195f21a138c781ff260eb14206bfe3 | diff --git a/rux/generator.py b/rux/generator.py
index <HASH>..<HASH> 100644
--- a/rux/generator.py
+++ b/rux/generator.py
@@ -52,7 +52,7 @@ class Generator(object):
Build objects at first, and fill in them with data(file contents) one
by one.
"""
- POSTS_COUNT_EACH_PAGE = 15 # each page has 9 posts at most
+ POSTS_COUNT_EACH_PAGE = 15 # each page has 15 posts at most
BUILDER_PROCESS_COUNT = 4 # at most 4 processes to build posts
def __init__(self):
@@ -89,7 +89,7 @@ class Generator(object):
def get_pages(self):
"""Sort source files by its created time, and then chunk all posts into
- 9 pages"""
+ 15 pages"""
if not exists(Post.src_dir):
logger.error(SourceDirectoryNotFound.__doc__)
@@ -112,7 +112,7 @@ class Generator(object):
posts.sort(key=lambda post: post.datetime.timetuple(),
reverse=True)
- # each page has 9 posts
+ # each page has 15 posts
groups = chunks(posts, self.POSTS_COUNT_EACH_PAGE)
pages = [Page(number=idx, posts=list(group))
for idx, group in enumerate(groups, 1)] | docstings and comments typofix {9}={<I>} | hit9_rux | train | py |
db0928fa6f3a3e309cc7860ae525e13d0502107e | diff --git a/chancloser.go b/chancloser.go
index <HASH>..<HASH> 100644
--- a/chancloser.go
+++ b/chancloser.go
@@ -2,7 +2,6 @@ package main
import (
"fmt"
- "strings"
"github.com/davecgh/go-spew/spew"
"github.com/lightningnetwork/lnd/channeldb"
@@ -439,19 +438,7 @@ func (c *channelCloser) ProcessCloseMsg(msg lnwire.Message) ([]lnwire.Message, b
return spew.Sdump(closeTx)
}))
if err := c.cfg.broadcastTx(closeTx); err != nil {
- // TODO(halseth): add relevant error types to the
- // WalletController interface as this is quite fragile.
- switch {
- case strings.Contains(err.Error(), "already exists"):
- fallthrough
- case strings.Contains(err.Error(), "already have"):
- peerLog.Debugf("channel close tx from "+
- "ChannelPoint(%v) already exist, "+
- "probably broadcast by peer: %v",
- c.chanPoint, err)
- default:
- return nil, false, err
- }
+ return nil, false, err
}
// Clear out the current channel state, marking the channel as | chancloser: don't check error returned from broadcastTx
This commit removes the inspection of the return error
from broadcastTx. This is done since the new error
checking added to PublishTransaction will return a nil
error in case the transaction already exists in the
mempool. | lightningnetwork_lnd | train | go |
ec352d01980efa04a8bb44b0147d909949fabc40 | diff --git a/lib/haml/exec.rb b/lib/haml/exec.rb
index <HASH>..<HASH> 100644
--- a/lib/haml/exec.rb
+++ b/lib/haml/exec.rb
@@ -312,7 +312,7 @@ END
case e
when ::Haml::SyntaxError; raise "Syntax error on line #{get_line e}: #{e.message}"
when ::Haml::Error; raise "Haml error on line #{get_line e}: #{e.message}"
- else raise "Exception on line #{get_line e}: #{e.message}\n Use --trace for backtrace."
+ else raise "Exception on line #{get_line e}: #{e.message}"
end
end | Delete duplicated trace message in command line | haml_haml | train | rb |
385edae81eae4ee17b25af9f20de946327089a72 | diff --git a/asphalt/core/context.py b/asphalt/core/context.py
index <HASH>..<HASH> 100644
--- a/asphalt/core/context.py
+++ b/asphalt/core/context.py
@@ -139,9 +139,6 @@ class Context:
:param parent: the parent context, if any
:ivar Context parent: the parent context, if any
- :ivar loop: the event loop associated with the context (comes from the parent context, or
- :func:`~asyncio.get_event_loop()` when no parent context is given)
- :vartype loop: asyncio.AbstractEventLoop
:var Signal resource_added: a signal (:class:`ResourceEvent`) dispatched when a resource
has been published in this context
""" | Removed obsolete instance variable docstring | asphalt-framework_asphalt | train | py |
62340a292e26982a8460afb0cb185198eb9d4362 | diff --git a/upload/catalog/controller/checkout/register.php b/upload/catalog/controller/checkout/register.php
index <HASH>..<HASH> 100644
--- a/upload/catalog/controller/checkout/register.php
+++ b/upload/catalog/controller/checkout/register.php
@@ -387,7 +387,7 @@ class Register extends \Opencart\System\Engine\Controller {
'lastname' => $this->request->post['lastname'],
'email' => $this->request->post['email'],
'telephone' => $this->request->post['telephone'],
- 'custom_field' => isset($this->request->post['custom_field']['account']) ? $this->request->post['custom_field'] : []
+ 'custom_field' => isset($this->request->post['custom_field']) ? $this->request->post['custom_field'] : []
];
// Register | Removed account key from custom_field | opencart_opencart | train | php |
bfdac27358d82a2d248c6543ec32ece3c66fd34d | diff --git a/latex/build.py b/latex/build.py
index <HASH>..<HASH> 100644
--- a/latex/build.py
+++ b/latex/build.py
@@ -97,7 +97,7 @@ class LatexMkBuilder(LatexBuilder):
except CalledProcessError as e:
raise_from(LatexBuildError(base_fn + '.log'), e)
- return I(open(output_fn, 'rb'), encoding=None)
+ return I(open(output_fn, 'rb').read(), encoding=None)
def is_available(self):
return bool(which(self.pdflatex)) and bool(which(self.latexmk))
@@ -171,10 +171,7 @@ class PdfLatexBuilder(LatexBuilder):
'reached.'.format(self.max_runs)
)
- # by opening the file, a handle will be kept open, even though the
- # tempdir gets removed. upon garbage collection, it will disappear,
- # unless the caller used it somehow
- return I(open(output_fn, 'rb'), encoding=None)
+ return I(open(output_fn, 'rb').read(), encoding=None)
def is_available(self):
return bool(which(self.pdflatex)) | Don't keep handle open while removing temp dir (issue #7 on Windows) | mbr_latex | train | py |
2bfcb2e331f5ede1b82609d58ae0519d7e8fd261 | diff --git a/common/lib/common/util/jsonify.rb b/common/lib/common/util/jsonify.rb
index <HASH>..<HASH> 100644
--- a/common/lib/common/util/jsonify.rb
+++ b/common/lib/common/util/jsonify.rb
@@ -2,7 +2,7 @@
require 'json'
module Jsonify
- def to_json
+ def to_json(options = nil)
self.to_json_properties.inject({}) { |h,k| h[k[1,k.length]] = self.instance_eval(k); h }.to_json
end
def to_json_properties | added a dummpy param for to_json to satisfy rails | chetan_bixby-agent | train | rb |
1e26c649129376c1986e70f5a59bd8cc3f9b7ba1 | diff --git a/lib/routes/admin-api/util.js b/lib/routes/admin-api/util.js
index <HASH>..<HASH> 100644
--- a/lib/routes/admin-api/util.js
+++ b/lib/routes/admin-api/util.js
@@ -26,13 +26,17 @@ const nameType = customJoi
const handleErrors = (res, logger, error) => {
logger.warn(error.message);
+ // eslint-disable-next-line no-param-reassign
+ error.isJoi = true;
switch (error.name) {
case 'NotFoundError':
return res.status(404).end();
case 'NameExistsError':
+ return res
+ .status(409)
+ .json(error)
+ .end();
case 'ValidationError':
- // eslint-disable-next-line no-param-reassign
- error.isJoi = true;
return res
.status(400)
.json(error) | fix: Name conflict should return <I>
closes #<I> | Unleash_unleash | train | js |
f6ad1e0c1fd4826c42a16626caa81f4ad6826d1a | diff --git a/lib/signore/signature.rb b/lib/signore/signature.rb
index <HASH>..<HASH> 100644
--- a/lib/signore/signature.rb
+++ b/lib/signore/signature.rb
@@ -1,13 +1,13 @@
require 'lovely_rufus'
module Signore
- Signature = Struct.new(*%i(text author source subject tags)) do
+ Signature = Struct.new(*%i(author source subject tags text)) do
def self.from_h(hash)
Signature.new(hash.map { |key, value| [key.to_sym, value] }.to_h)
end
- def initialize(author: nil, source: nil, subject: nil, tags: nil, text: '')
- super text, author, source, subject, tags
+ def initialize(author: nil, source: nil, subject: nil, tags: nil, text: nil)
+ super author, source, subject, tags, text
each_pair { |key, value| self[key] = nil if value and value.empty? }
end | Signature: there is order and there are mistakes | chastell_signore | train | rb |
91e648c902c31915fb46b3d8d3320af0586418c2 | diff --git a/app/src/Helpers/Magic.php b/app/src/Helpers/Magic.php
index <HASH>..<HASH> 100644
--- a/app/src/Helpers/Magic.php
+++ b/app/src/Helpers/Magic.php
@@ -238,10 +238,14 @@ trait Magic
/**
* toArray
- *
+ *
+ * @param boolean $asAlias
+ *
* @throws TException
+ *
+ * @return array
*/
- public function toArray()
+ public function toArray($asAlias = false)
{
if (!property_exists(
@@ -257,11 +261,13 @@ trait Magic
);
}
+ $method = !empty($asAlias) ? "getAlias" : "getProperty";
+
$dados = [];
foreach ($this->schema->getProperties() as $item) {
- $value = $this->{$item->getProperty()};
+ $value = $this->{$item->{$method}()};
if(!empty($value)){
- $dados[$item->getProperty()] = is_object($value) ? $value->toArray() : $value;
+ $dados[$item->{$method}()] = is_object($value) ? $value->toArray() : $value;
}
} | [UPD] added asAlias in toArray method | rafaelbeecker_phpmagic | train | php |
69a4c9c2eb21138a0a63cc5239aca6b5174e0b61 | diff --git a/markdown_to_presentation.py b/markdown_to_presentation.py
index <HASH>..<HASH> 100644
--- a/markdown_to_presentation.py
+++ b/markdown_to_presentation.py
@@ -169,6 +169,7 @@ def _make_node_modules(target: str) -> int:
def _make_presentation_css(target: str) -> int:
return subprocess.call((
sys.executable, '-m', 'sassc',
+ '--import-extensions', '.css',
'-t', 'compressed',
'.mtp/style.scss', target,
)) | Allow for css file imports so we can import reveal | anthonywritescode_markdown-to-presentation | train | py |
b87f9ea2b1d71aa71c211e61c782c4e77a7f25d3 | diff --git a/lib/helpers/plural.js b/lib/helpers/plural.js
index <HASH>..<HASH> 100644
--- a/lib/helpers/plural.js
+++ b/lib/helpers/plural.js
@@ -26,19 +26,7 @@ module.exports = function(app, collection) {
* @api public
*/
- app.asyncHelper(plural, function listHelper(options, cb) {
- if (typeof options === 'function') {
- cb = options;
- options = {};
- }
-
- options = options || {};
- if (typeof options === 'string') {
- var singular = this.app.getAsyncHelper(collection.options.inflection)
- || app.getAsyncHelper(collection.options.inflection);
- return singular.apply(this, arguments);
- }
-
+ app.helper(plural, function listHelper(options) {
debug('list helper "%s", "%j"', plural, options);
var list = new List(collection);
@@ -48,12 +36,11 @@ module.exports = function(app, collection) {
}
// render block helper with list as context
- if (typeof options.fn === 'function' && options.hash) {
- cb(null, options.fn(list));
- return;
+ if (options && typeof options.fn === 'function' && options.hash) {
+ return options.fn(list)
}
// return list when not used as a block helper
- cb(null, list);
+ return list;
});
}; | make collection helper sync
we initially did rendering in this helper, we don't need it to be async now | jonschlinkert_templates | train | js |
5402670fa1c7b2660afc2b901410d67506788810 | diff --git a/tls_socket.js b/tls_socket.js
index <HASH>..<HASH> 100644
--- a/tls_socket.js
+++ b/tls_socket.js
@@ -472,7 +472,7 @@ exports.get_certs_dir = (tlsDir, done) => {
return;
}
- log.logdebug(cert);
+ // log.logdebug(cert); // DANGER: Also logs private key!
cert.names.forEach(name => {
tlss.applySocketOpts(name); | Don't log TLS private keys (#<I>) | haraka_Haraka | train | js |
45446965a2e72396f5660a4a877958fbd9b3568d | diff --git a/riak/transports/pbc/connection.py b/riak/transports/pbc/connection.py
index <HASH>..<HASH> 100644
--- a/riak/transports/pbc/connection.py
+++ b/riak/transports/pbc/connection.py
@@ -62,7 +62,7 @@ class RiakPbcConnection(object):
Similar to self._send, but doesn't try to initiate a connection,
thus preventing an infinite loop.
"""
- self._socket.send(self._encode_msg(msg_code, msg))
+ self._socket.sendall(self._encode_msg(msg_code, msg))
def _send_msg(self, msg_code, msg):
self._connect() | fixes incorrect socket.send usage in PBC connection. Socket.sendall is used instead | basho_riak-python-client | train | py |
00b61a661afc442ba88c9d2c0f5513d86c4fc2ae | diff --git a/blocks/social_activities/block_social_activities.php b/blocks/social_activities/block_social_activities.php
index <HASH>..<HASH> 100644
--- a/blocks/social_activities/block_social_activities.php
+++ b/blocks/social_activities/block_social_activities.php
@@ -51,7 +51,7 @@ class block_social_activities extends block_list {
if ($ismoving) {
$this->content->icons[] = ' <img align="bottom" src="'.$CFG->pixpath.'/t/move.gif" height="11" width="11" alt=\"\" />';
- $this->content->items[] = $USER->activitycopyname.' (<a href="'.$CFG->wwwroot.'/course/mod.php?cancelcopy=true">'.$strcancel.'</a>)';
+ $this->content->items[] = $USER->activitycopyname.' (<a href="'.$CFG->wwwroot.'/course/mod.php?cancelcopy=true&sesskey='.$USER->sesskey.'">'.$strcancel.'</a>)';
}
if (!empty($section->sequence)) { | fixed bug <I> - canceling of activity movement thanks to jcodina; merged from MOODLE_<I>_STABLE | moodle_moodle | train | php |
a898b44e08e68139864f1ef7a618c7cdff091a76 | diff --git a/asyncpg/connection.py b/asyncpg/connection.py
index <HASH>..<HASH> 100644
--- a/asyncpg/connection.py
+++ b/asyncpg/connection.py
@@ -793,7 +793,7 @@ class Connection(metaclass=ConnectionMeta):
async def set_type_codec(self, typename, *,
schema='public', encoder, decoder,
- binary=None, format='text'):
+ format='text'):
"""Set an encoder/decoder pair for the specified data type.
:param typename: | Actually remove the `binary` argument from `set_type_codec` signature.
Compatibility support was removed in <I>. | MagicStack_asyncpg | train | py |
a32da46c25da4a54f819cc01f7821d43d7dbb285 | diff --git a/src/main/java/org/dynjs/parser/ast/SwitchStatement.java b/src/main/java/org/dynjs/parser/ast/SwitchStatement.java
index <HASH>..<HASH> 100644
--- a/src/main/java/org/dynjs/parser/ast/SwitchStatement.java
+++ b/src/main/java/org/dynjs/parser/ast/SwitchStatement.java
@@ -109,6 +109,8 @@ public class SwitchStatement extends BaseStatement {
if (completion.type == Completion.Type.BREAK) {
break;
+ } else if (completion.type == Completion.Type.CONTINUE) {
+ return (completion);
} else if (completion.type == Completion.Type.RETURN) {
return (completion); | Arrange for continue statements inside a switch block not to fall through to next case. | dynjs_dynjs | train | java |
327f800aac000f37c7a0f82049fa194de6d3bd3d | diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index <HASH>..<HASH> 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -1,5 +1,6 @@
+require 'coveralls'
+Coveralls.wear!
+
require 'action_controller/railtie'
require 'rails/test_unit/railtie'
require 'podlove-web-player-rails'
-require 'coveralls'
-Coveralls.wear! | move coveralls to the top of the spec_helper | coding-chimp_podlove-web-player-rails | train | rb |
31a85096aa29a16168cce019cabccfc524c76da8 | diff --git a/lib/build/webpack-config.js b/lib/build/webpack-config.js
index <HASH>..<HASH> 100644
--- a/lib/build/webpack-config.js
+++ b/lib/build/webpack-config.js
@@ -3,6 +3,7 @@ const
path = require('path'),
chalk = require('chalk'),
webpack = require('webpack'),
+ merge = require('webpack-merge'),
ProgressBarPlugin = require('progress-bar-webpack-plugin'),
HtmlWebpackPlugin = require('html-webpack-plugin') | fix: Add missing dep in webpack-config | quasarframework_quasar-cli | train | js |
eebc4337878bc6ee84c9e2f89d25ca5b818f34a2 | diff --git a/azure-mgmt/tests/test_mgmt_apps.py b/azure-mgmt/tests/test_mgmt_apps.py
index <HASH>..<HASH> 100644
--- a/azure-mgmt/tests/test_mgmt_apps.py
+++ b/azure-mgmt/tests/test_mgmt_apps.py
@@ -18,6 +18,7 @@ import unittest
import azure.mgmt.logic
import azure.mgmt.web
+from msrest.version import msrest_version
from testutils.common_recordingtestcase import record
from tests.mgmt_testcase import HttpStatusCode, AzureMgmtTestCase
@@ -35,6 +36,7 @@ class MgmtAppsTest(AzureMgmtTestCase):
azure.mgmt.web.WebSiteManagementClient
)
+ @unittest.skipIf(msrest_version.startswith("0.1."), "Fixed in msrest 0.2.0")
@record
def test_logic(self):
self.create_resource_group() | At short term, skip this test if msrest <I> is not on Pypi | Azure_azure-sdk-for-python | train | py |
6bec6346677a939ec94320ce05d3cae1d9068989 | diff --git a/wayback-core/src/main/java/org/archive/wayback/webapp/LiveWebRedirector.java b/wayback-core/src/main/java/org/archive/wayback/webapp/LiveWebRedirector.java
index <HASH>..<HASH> 100644
--- a/wayback-core/src/main/java/org/archive/wayback/webapp/LiveWebRedirector.java
+++ b/wayback-core/src/main/java/org/archive/wayback/webapp/LiveWebRedirector.java
@@ -89,14 +89,7 @@ public class LiveWebRedirector {
if (state == RedirectType.NONE) {
return LiveWebState.NOT_FOUND;
}
-
- redirUrl = liveWebHandler.getLiveWebRedirect(httpRequest, wbRequest, e);
-
- // Don't redirect if redirUrl null
- if (redirUrl == null) {
- return LiveWebState.NOT_FOUND;
- }
-
+
// If embeds_only and not embed return if it was found
if (state == RedirectType.EMBEDS_ONLY) {
// boolean allowRedirect = wbRequest.isAnyEmbeddedContext();
@@ -119,6 +112,12 @@ public class LiveWebRedirector {
}
// Now try to do a redirect
+ redirUrl = liveWebHandler.getLiveWebRedirect(httpRequest, wbRequest, e);
+
+ // Don't redirect if redirUrl null
+ if (redirUrl == null) {
+ return LiveWebState.NOT_FOUND;
+ }
// If set to DEFAULT then compute the standard redir url
if (redirUrl.equals(DEFAULT)) { | FIX: LiveWebRedirector move embeds-only check before url validity check to avoid extra call for non-embeds | iipc_openwayback | train | java |
cc20d9466a2a9bc665dba4a6a697c93ebdf1bf28 | diff --git a/spec/report_spec.rb b/spec/report_spec.rb
index <HASH>..<HASH> 100644
--- a/spec/report_spec.rb
+++ b/spec/report_spec.rb
@@ -1,6 +1,15 @@
require 'spec_helper'
+require 'tmpdir'
describe Pick::Report do
+ def tmpdir
+ @tmpdir ||= Dir.mktmpdir
+ end
+
+ after(:each) do
+ FileUtils.remove_entry_secure(@tmpdir) if @tmpdir
+ end
+
it 'should include formats junit and text' do
expect(Pick::Report.formats).to eq(%w(junit text))
end
@@ -10,7 +19,7 @@ describe Pick::Report do
end
context 'when no format is specified' do
- let(:report) { Pick::Report.new('foo') }
+ let(:report) { Pick::Report.new(File.join(tmpdir, 'report')) }
it 'should instantiate its format to junit' do
expect(report).to receive(:prepare_junit).with('cmd output')
@@ -19,7 +28,7 @@ describe Pick::Report do
end
context 'when a format is specified' do
- let(:report) { Pick::Report.new('foo', 'text') }
+ let(:report) { Pick::Report.new(File.join(tmpdir, 'report.txt'), 'text') }
it 'should instantiate its format to text' do
expect(report).to receive(:prepare_text).with('cmd output') | (MAINT) Update Pick::Report specs to use and clean up a tmpdir. | puppetlabs_pdk | train | rb |
79b6340d6ced0ad62628de6e51dce18d50a5be9f | diff --git a/lib/cli-engine/cli-engine.js b/lib/cli-engine/cli-engine.js
index <HASH>..<HASH> 100644
--- a/lib/cli-engine/cli-engine.js
+++ b/lib/cli-engine/cli-engine.js
@@ -408,7 +408,7 @@ function isErrorMessage(message) {
* a directory or looks like a directory (ends in `path.sep`), in which case the file
* name will be the `cacheFile/.cache_hashOfCWD`
*
- * if cacheFile points to a file or looks like a file then in will just use that file
+ * if cacheFile points to a file or looks like a file then it will just use that file
* @param {string} cacheFile The name of file to be used to store the cache
* @param {string} cwd Current working directory
* @returns {string} the resolved path to the cache file | chore: fixed typo in client-Engine (#<I>) | eslint_eslint | train | js |
159928822cf1f7cf6376b054344b91f9e51b334b | diff --git a/lib/navigationlib.php b/lib/navigationlib.php
index <HASH>..<HASH> 100644
--- a/lib/navigationlib.php
+++ b/lib/navigationlib.php
@@ -4419,7 +4419,8 @@ class settings_navigation extends navigation_node {
}
// Assign local roles
- if (!empty(get_assignable_roles($catcontext))) {
+ $assignableroles = get_assignable_roles($catcontext);
+ if (!empty($assignableroles)) {
$assignurl = new moodle_url('/'.$CFG->admin.'/roles/assign.php', array('contextid' => $catcontext->id));
$categorynode->add(get_string('assignroles', 'role'), $assignurl, self::TYPE_SETTING, null, 'roles', new pix_icon('i/assignroles', ''));
} | MDL-<I> navigation: fixed php<I>ism | moodle_moodle | train | php |
5f2374e872be4d4436617ecbf16161f3877e2bb9 | diff --git a/tabu_sampler.py b/tabu_sampler.py
index <HASH>..<HASH> 100644
--- a/tabu_sampler.py
+++ b/tabu_sampler.py
@@ -83,8 +83,7 @@ class TabuSampler(Sampler):
if num_reads < 1:
raise ValueError("'samples' should be a positive integer")
- bqm = bqm.change_vartype(Vartype.BINARY, inplace=False)
- qubo = self._bqm_to_tabu_qubo(bqm)
+ qubo = self._bqm_to_tabu_qubo(bqm.binary)
# run Tabu search
samples = []
@@ -95,8 +94,8 @@ class TabuSampler(Sampler):
else:
init_sample = init_solution
r = tabu_solver.TabuSearch(qubo, init_sample, tenure, scale_factor, timeout)
- sample = self._tabu_sample_to_bqm_sample(list(r.bestSolution()), bqm)
- energy = bqm.energy(sample)
+ sample = self._tabu_sample_to_bqm_sample(list(r.bestSolution()), bqm.binary)
+ energy = bqm.binary.energy(sample)
samples.append(sample)
energies.append(energy) | Speed-up TabuSampler by <I>% (avoid vartype changes) | dwavesystems_dwave-tabu | train | py |
2b70f92d8529234a6f04b4df10e09a0361675122 | diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -9,4 +9,5 @@ setup(
url='https://github.com/bunchesofdonald/django-hermes',
license='MIT',
long_description=open('README.rst').read(),
+ description='A light-weight blogging app for Django.',
) | Update setup.py
Having a `description` in `setup.py` prevents project being listed as `UNKNOWN` as description on search results from `pypi` | bunchesofdonald_django-hermes | train | py |
6d936e16a5b8bcc431296ccb3094a982169bdd3f | diff --git a/click_shell/version.py b/click_shell/version.py
index <HASH>..<HASH> 100644
--- a/click_shell/version.py
+++ b/click_shell/version.py
@@ -9,7 +9,7 @@ import os
import subprocess
-VERSION = (0, 3, 0, 'final', 0)
+VERSION = (0, 4, 0, 'dev', 0)
def get_version(version): | Updating version for <I> development | clarkperkins_click-shell | train | py |
5dd020439d13cc9eb8a106a8f8a464fded84aa9e | diff --git a/ores/api.py b/ores/api.py
index <HASH>..<HASH> 100644
--- a/ores/api.py
+++ b/ores/api.py
@@ -1,6 +1,8 @@
"""
This module provides a :class:`ores.api.Session` class that can maintain a
-connection to an instance of ORES and efficiently generate scores.
+client connection to an instance of ORES and efficiently generate scores.
+
+Batching and parallelism are set by constructor arguments.
.. autoclass:: ores.api.Session
:members:
@@ -107,7 +109,8 @@ class Session:
start = time.time()
response = requests.get(url, params=params,
headers=self.headers,
- verify=True, stream=True)
+ verify=True)
+
try:
doc = response.json()
except ValueError: | Make sure the ORES client always closes sockets
The requests `stream` parameter is probably unnecessary in our case, and can
cause issues where the socket isn't closed if an exception or other issue
causes us to not fully read the response.
Bug: T<I> | wikimedia_ores | train | py |
5b83b71b1d9504ccc4b5f7bf72731703fd5420c8 | diff --git a/java/client/test/org/openqa/selenium/FrameSwitchingTest.java b/java/client/test/org/openqa/selenium/FrameSwitchingTest.java
index <HASH>..<HASH> 100644
--- a/java/client/test/org/openqa/selenium/FrameSwitchingTest.java
+++ b/java/client/test/org/openqa/selenium/FrameSwitchingTest.java
@@ -258,8 +258,6 @@ public class FrameSwitchingTest extends AbstractDriverTestCase {
String expectedTitle = "XHTML Test Page";
waitFor(pageTitleToBe(driver, expectedTitle));
- String javascriptTitle = (String)((JavascriptExecutor)driver).executeScript("return document.title;");
- assertEquals(expectedTitle, javascriptTitle);
waitFor(elementToExist(driver, "only-exists-on-xhtmltest"));
} | DanielWagnerHall: Let's not rely on javascript in this test
r<I> | SeleniumHQ_selenium | train | java |
41ef267c1bb5514f1277ed41d730ca2c8fe02bd1 | diff --git a/storage/sqlite/sqlite-storage.go b/storage/sqlite/sqlite-storage.go
index <HASH>..<HASH> 100644
--- a/storage/sqlite/sqlite-storage.go
+++ b/storage/sqlite/sqlite-storage.go
@@ -319,9 +319,11 @@ func (p *provider) WriteConsecutiveChunks(prefix string, w io.Writer) (written i
where name like ?||'%'
order by offset`,
func(stmt *sqlite.Stmt) error {
+ offset := stmt.ColumnInt64(1)
+ if offset != written {
+ return fmt.Errorf("got chunk at offset %v, expected offset %v", offset, written)
+ }
r := stmt.ColumnReader(0)
- //offset := stmt.ColumnInt64(1)
- //log.Printf("got %v bytes at offset %v", r.Len(), offset)
w1, err := io.Copy(w, r)
written += w1
return err | sqlite storage: Ensure that chunks are consecutive | anacrolix_torrent | train | go |
bccc8430bcb48037144f7f8f439f2a4dfddbed39 | diff --git a/router/testing/router.go b/router/testing/router.go
index <HASH>..<HASH> 100644
--- a/router/testing/router.go
+++ b/router/testing/router.go
@@ -10,12 +10,12 @@ import (
"sync"
)
-var Instance = fakeRouter{backends: make(map[string][]string)}
+var FakeRouter = fakeRouter{backends: make(map[string][]string)}
var ErrBackendNotFound = errors.New("Backend not found")
func init() {
- router.Register("fake", &Instance)
+ router.Register("fake", &FakeRouter)
}
type fakeRouter struct { | router/testing: rename Instance to FakeRouter
Now that the type is unexported, we can export the variable. | tsuru_tsuru | train | go |
f6983133adafa2015d07fa0205f893dcfe6c2ec9 | diff --git a/js/forum/dist/extension.js b/js/forum/dist/extension.js
index <HASH>..<HASH> 100644
--- a/js/forum/dist/extension.js
+++ b/js/forum/dist/extension.js
@@ -78,7 +78,7 @@ System.register('flagrow/remote-image-upload/components/UploadButton', ['flarum/
imageObject.onload = function () {
// evaluate the scalingFactor to keep aspect ratio
- if (button.mustResize) {
+ if (button.mustResize == true) {
button.scalingFactor = Math.min(button.maxWidth / imageObject.width, button.maxHeight / imageObject.height, 1);
}
diff --git a/js/forum/src/components/UploadButton.js b/js/forum/src/components/UploadButton.js
index <HASH>..<HASH> 100644
--- a/js/forum/src/components/UploadButton.js
+++ b/js/forum/src/components/UploadButton.js
@@ -61,7 +61,7 @@ export default class UploadButton extends Component {
imageObject.onload = function() {
// evaluate the scalingFactor to keep aspect ratio
- if(button.mustResize) {
+ if(button.mustResize == true) {
button.scalingFactor = Math.min((button.maxWidth/imageObject.width), (button.maxHeight/imageObject.height), 1);
} | now it doesn't resize if not needed | flagrow_flarum-ext-image-upload | train | js,js |
cccef22117b2666c365c7fd305d30fb10546116d | diff --git a/src/cal-heatmap.js b/src/cal-heatmap.js
index <HASH>..<HASH> 100755
--- a/src/cal-heatmap.js
+++ b/src/cal-heatmap.js
@@ -531,7 +531,7 @@ var CalHeatMap = function() {
column: d.row,
position: {
x: d.position.y,
- y: d.position.x,
+ y: d.position.x
},
format: d.format,
extractUnit: d.extractUnit | Remove trailing comma in object literal
While a trailing comma is valid since ES5, they are not well supported by old IE versions.
Also, some js optimizers can complain about them, and even refuse to generate an output.
It is the only occurence, and removing it did allow the google-closure compiler to process the file. | wa0x6e_cal-heatmap | train | js |
333a81e1941fd6aa2bd7e7a7e6fe0bed3020be33 | diff --git a/tests/QATools/QATools/TestCase.php b/tests/QATools/QATools/TestCase.php
index <HASH>..<HASH> 100644
--- a/tests/QATools/QATools/TestCase.php
+++ b/tests/QATools/QATools/TestCase.php
@@ -72,9 +72,9 @@ class TestCase extends \PHPUnit_Framework_TestCase
*
* @return void
*/
- protected function expectDriverGetTagName($tag_name)
+ protected function expectDriverGetTagName($tag_name, $xpath = 'XPATH')
{
- $this->driver->shouldReceive('getTagName')->with('XPATH')->andReturn($tag_name);
+ $this->driver->shouldReceive('getTagName')->with($xpath)->andReturn($tag_name);
}
/**
@@ -84,10 +84,10 @@ class TestCase extends \PHPUnit_Framework_TestCase
*
* @return void
*/
- protected function expectDriverGetAttribute(array $attributes)
+ protected function expectDriverGetAttribute(array $attributes, $xpath = 'XPATH')
{
foreach ( $attributes as $attribute => $value ) {
- $this->driver->shouldReceive('getAttribute')->with('XPATH', $attribute)->andReturn($value);
+ $this->driver->shouldReceive('getAttribute')->with($xpath, $attribute)->andReturn($value);
}
} | Allow to use custom Xpath, when creating session driver expectations | qa-tools_qa-tools | train | php |
162c7c1908946cfb48c201cfc5a4976a33c8bff1 | diff --git a/actionpack/lib/action_controller/rescue.rb b/actionpack/lib/action_controller/rescue.rb
index <HASH>..<HASH> 100644
--- a/actionpack/lib/action_controller/rescue.rb
+++ b/actionpack/lib/action_controller/rescue.rb
@@ -165,7 +165,7 @@ module ActionController #:nodoc:
# method if you wish to redefine the meaning of a local request to
# include remote IP addresses or other criteria.
def local_request? #:doc:
- request.remote_addr == LOCALHOST and request.remote_ip == LOCALHOST
+ request.remote_addr == LOCALHOST && request.remote_ip == LOCALHOST
end
# Render detailed diagnostics for unhandled exceptions rescued from | Changing "and" to && whereever I catch it | rails_rails | train | rb |
d98cd8ad31b765ce6477193e02e737d26c9558eb | diff --git a/examples/with-sentry-simple/next.config.js b/examples/with-sentry-simple/next.config.js
index <HASH>..<HASH> 100644
--- a/examples/with-sentry-simple/next.config.js
+++ b/examples/with-sentry-simple/next.config.js
@@ -51,6 +51,7 @@ module.exports = withSourceMaps({
include: '.next',
ignore: ['node_modules'],
urlPrefix: '~/_next',
+ release: options.buildId,
})
)
} | Add release argument to SentryWebpackPlugin (#<I>) | zeit_next.js | train | js |
c06a2162bc2bb4b13e000b2506b0c00cbdb4dc84 | diff --git a/cfg4j-core/src/main/java/org/cfg4j/source/reload/Reloadable.java b/cfg4j-core/src/main/java/org/cfg4j/source/reload/Reloadable.java
index <HASH>..<HASH> 100644
--- a/cfg4j-core/src/main/java/org/cfg4j/source/reload/Reloadable.java
+++ b/cfg4j-core/src/main/java/org/cfg4j/source/reload/Reloadable.java
@@ -15,6 +15,8 @@
*/
package org.cfg4j.source.reload;
+import org.cfg4j.source.context.environment.Environment;
+
/**
* Identifies resource that can be reloaded.
*/
@@ -25,6 +27,6 @@ public interface Reloadable {
*
* @throws IllegalStateException when unable to reload resource
*/
- void reload();
+ void reload(Environment environment);
} | make reload granular on the environment level | cfg4j_cfg4j | train | java |
8654db479b774dceb5338bcfed9232e38b6a3fd4 | diff --git a/docs/conf.py b/docs/conf.py
index <HASH>..<HASH> 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -98,7 +98,7 @@ html_theme = 'flask_small'
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
-html_theme_options = dict(github_fork=False, index_logo=False)
+html_theme_options = dict(github_fork='maxcountryman/flask-login', index_logo=False)
# Add any paths that contain custom themes here, relative to this directory.
html_theme_path = ['_themes'] | Added link to github mirror | maxcountryman_flask-login | train | py |
6987279633e2bcf2494d67137692f13c636fc301 | diff --git a/src/guake/prefs.py b/src/guake/prefs.py
index <HASH>..<HASH> 100644
--- a/src/guake/prefs.py
+++ b/src/guake/prefs.py
@@ -408,7 +408,7 @@ class PrefsCallbacks(object):
ERASE_BINDINGS[val])
def on_custom_command_file_chooser_file_changed(self, filechooser):
- self.client.set_string(KEY('/general/custom_command_file'), filechooser.get_uri())
+ self.client.set_string(KEY('/general/custom_command_file'), filechooser.get_filename())
class PrefsDialog(SimpleGladeApp): | changed method get_uri in filechooser to get_filename | Guake_guake | train | py |
122c7fc949450a0a7b7b1df6eb4d84c5ab39587e | diff --git a/src/org/opencms/ade/configuration/formatters/CmsFormatterBeanParser.java b/src/org/opencms/ade/configuration/formatters/CmsFormatterBeanParser.java
index <HASH>..<HASH> 100644
--- a/src/org/opencms/ade/configuration/formatters/CmsFormatterBeanParser.java
+++ b/src/org/opencms/ade/configuration/formatters/CmsFormatterBeanParser.java
@@ -46,8 +46,8 @@ import org.opencms.xml.types.CmsXmlVfsFileValue;
import org.opencms.xml.types.I_CmsXmlContentValue;
import java.util.ArrayList;
-import java.util.HashMap;
import java.util.HashSet;
+import java.util.LinkedHashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
@@ -194,7 +194,7 @@ public class CmsFormatterBeanParser {
private String m_resourceType;
/** Parsed field. */
- private Map<String, CmsXmlContentProperty> m_settings = new HashMap<String, CmsXmlContentProperty>();
+ private Map<String, CmsXmlContentProperty> m_settings = new LinkedHashMap<String, CmsXmlContentProperty>();
/**
* Creates a new parser instance.<p> | Fixed problem with order of settings from formatter configuration not being used. | alkacon_opencms-core | train | java |
4461c78621d87e931909c29aae2f0f10730fa123 | diff --git a/pyang/plugins/tree.py b/pyang/plugins/tree.py
index <HASH>..<HASH> 100644
--- a/pyang/plugins/tree.py
+++ b/pyang/plugins/tree.py
@@ -79,7 +79,7 @@ Each node is printed as:
<opts> is one of:
? for an optional leaf or presence container
- * for a leaf-list
+ * for a leaf-list or list
[<keys>] for a list's keys
<type> is the name of the type for leafs and leaf-lists
@@ -177,6 +177,7 @@ def print_node(s, module, fd, prefix, path, depth, width):
name = s.i_module.i_prefix + ':' + s.arg
flags = get_flags_str(s)
if s.keyword == 'list':
+ name += '*'
fd.write(flags + " " + name)
elif s.keyword == 'container':
p = s.search_one('presence') | mark lists with '*' in tree output | mbj4668_pyang | train | py |
22461b6b60ecdec57528f1b1ec156aa594723e49 | diff --git a/admin/resource.go b/admin/resource.go
index <HASH>..<HASH> 100644
--- a/admin/resource.go
+++ b/admin/resource.go
@@ -3,6 +3,7 @@ package admin
import (
"fmt"
"reflect"
+ "strconv"
"strings"
"github.com/jinzhu/gorm"
@@ -121,12 +122,15 @@ func (res *Resource) SearchAttrs(columns ...string) []string {
if field, ok := scope.FieldByName(column); ok {
if field.Field.Kind() == reflect.String {
conditions = append(conditions, fmt.Sprintf("upper(%v) like upper(?)", scope.Quote(field.DBName)))
+ keywords = append(keywords, "%"+keyword+"%")
} else {
+ if _, err := strconv.Atoi(keyword); err != nil {
+ continue
+ }
conditions = append(conditions, fmt.Sprintf("%v = ?", scope.Quote(field.DBName)))
+ keywords = append(keywords, keyword)
}
}
-
- keywords = append(keywords, "%"+keyword+"%")
}
return context.GetDB().Where(strings.Join(conditions, " OR "), keywords...)
} | fix string to int conversion issue for arguments
had
pq: invalid input syntax for integer: "%!d(MISSING)ude%!"(MISSING)
so don't search with strings on int fields
use "%keyword%" only for string keywords | qor_qor | train | go |
79a40cd93beab16295ad35770c40f58013b9ed12 | diff --git a/lib/util/connect/connector.js b/lib/util/connect/connector.js
index <HASH>..<HASH> 100644
--- a/lib/util/connect/connector.js
+++ b/lib/util/connect/connector.js
@@ -87,6 +87,10 @@ Connection.prototype.connect = function() {
}.bind(this));
}.bind(this));
+ this.script.addEventListener('error', function(ev) {
+ deferred.reject('Error from SCRIPT tag to ' + this.script.src);
+ }.bind(this));
+
exports.document.head.appendChild(this.script);
return deferred.promise; | refactor-<I>: Track websocket errors better
Now we report <I> errors (server not started with --websocket) to the
web page properly. | joewalker_gcli | 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.