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
|
---|---|---|---|---|---|
27f75942cc657518ddf2e271c9347215658ed2b3 | diff --git a/doc/scripts/header.js b/doc/scripts/header.js
index <HASH>..<HASH> 100644
--- a/doc/scripts/header.js
+++ b/doc/scripts/header.js
@@ -13,7 +13,7 @@ domReady(function () {
projectname.text = 'comparison-sorting/heap-sort';
projectname.href = './index.html';
- const header = document.querySelectorAll('header')[0];
+ const header = document.querySelector('header');
header.insertBefore(projectname, header.firstChild);
const testlink = document.querySelector('header > a[data-ice="testLink"]'); | :robot: docs: Simplify scripts.
Replace querySelectorAll(...)[0] by querySelector(...) in docs scripts.
These changes were automatically generated by a transform whose code can be found at:
- <URL> | aureooms_js-heapsort | train | js |
eb82bbbbe55382a05fe256688efdf7beb7f375a9 | diff --git a/src/CallbackLater.php b/src/CallbackLater.php
index <HASH>..<HASH> 100644
--- a/src/CallbackLater.php
+++ b/src/CallbackLater.php
@@ -17,7 +17,8 @@ class CallbackLater extends Callback
}
if ($this->app->is_rendering) {
- $hook = 'beforeOutput';
+ return parent::set($callback, $args);
+ //$hook = 'beforeOutput';
} else {
$hook = 'beforeRender';
} | If CallbackLater is executed from another CallbackLater, don't delay it until too late. Execute immediatelly. | atk4_ui | train | php |
60fd777806527bb4601819cb733edc2087bce481 | diff --git a/plugins/providers/virtualbox/action/prepare_nfs_settings.rb b/plugins/providers/virtualbox/action/prepare_nfs_settings.rb
index <HASH>..<HASH> 100644
--- a/plugins/providers/virtualbox/action/prepare_nfs_settings.rb
+++ b/plugins/providers/virtualbox/action/prepare_nfs_settings.rb
@@ -90,6 +90,8 @@ module VagrantPlugins
def read_static_machine_ips
ips = []
@machine.config.vm.networks.each do |type, options|
+ options = scoped_hash_override(options, :virtualbox)
+
if type == :private_network && options[:type] != :dhcp && options[:ip].is_a?(String)
ips << options[:ip]
end | prepare_nfs_settings: Use scoped hash override when reading static IPs. | hashicorp_vagrant | train | rb |
f1f3f2c73728fede1835d457b0c5e78ac9b30aa4 | diff --git a/sinon-spy-react.js b/sinon-spy-react.js
index <HASH>..<HASH> 100644
--- a/sinon-spy-react.js
+++ b/sinon-spy-react.js
@@ -8,8 +8,12 @@ function spyOnComponentMethod(reactClass, methodName) {
var on;
var idx;
- if (classProto.__reactAutoBindMap) { // React 0.14.x
- spy = classProto.__reactAutoBindMap[methodName] = sinon.spy(classProto.__reactAutoBindMap[methodName]);
+ if (classProto.__reactAutoBindMap) { // React 0.14.x1
+ if(typeof classProto.__reactAutoBindMap[methodName] !== 'undefined' ){
+ spy = classProto.__reactAutoBindMap[methodName] = sinon.spy(classProto.__reactAutoBindMap[methodName]);
+ } else {
+ throw new Error('Cannot spy on a function that does not exist');
+ }
} else if (classProto.__reactAutoBindPairs) { // React 15.x
idx = classProto.__reactAutoBindPairs.indexOf(methodName);
if(idx !== -1){ | Throw if spy doesnt have what to spy on | levrik_sinon-spy-react | train | js |
2bfaa756f4f80716df3b6349444bc31185e354be | diff --git a/tests/highlights/test_command.py b/tests/highlights/test_command.py
index <HASH>..<HASH> 100644
--- a/tests/highlights/test_command.py
+++ b/tests/highlights/test_command.py
@@ -8,13 +8,12 @@ if sys.version_info < (2, 7):
else:
import unittest
-try:
+if sys.version_info > (2, 4):
from mock import patch
-except:
- pass
+else:
+ patch = lambda *args: lambda fn: None
[email protected](sys.version_info < (2, 5), "python 2.4 is not supported")
class TestHighlightCommand(unittest.TestCase):
@patch("highlights.command.sys")
def test_highlight_main(self, sys): | Fix @skipIf to class is not supported on py<I> and py<I> | tk0miya_diff-highlight | train | py |
c53cebc331d9e5d5a8b14f735c4c77c7b474e12e | diff --git a/src/main/java/com/codeborne/selenide/impl/Waiter.java b/src/main/java/com/codeborne/selenide/impl/Waiter.java
index <HASH>..<HASH> 100644
--- a/src/main/java/com/codeborne/selenide/impl/Waiter.java
+++ b/src/main/java/com/codeborne/selenide/impl/Waiter.java
@@ -63,7 +63,7 @@ public class Waiter {
}
private <T> void waitWhile(Driver driver, T subject, ObjectCondition<T> condition, long timeout, long pollingInterval) {
- SelenideLog log = SelenideLogger.beginStep(subject.toString(), condition.description());
+ SelenideLog log = SelenideLogger.beginStep(subject.toString(), condition.negativeDescription());
for (long start = currentTimeMillis(); !isTimeoutExceeded(timeout, start); ) {
if (!checkUnThrowable(subject, condition)) {
SelenideLogger.commitStep(log, PASS); | #<I> fixup: write "should not" instead of "should" in report | selenide_selenide | train | java |
de546b53b15243c28e9bc011d32296ebab3dc77d | diff --git a/lib/r6502/cpu_instructions.rb b/lib/r6502/cpu_instructions.rb
index <HASH>..<HASH> 100644
--- a/lib/r6502/cpu_instructions.rb
+++ b/lib/r6502/cpu_instructions.rb
@@ -330,14 +330,7 @@ module R6502
inc_pc_by_mode(mode)
end
def jmp(arg, mode)
- case mode
- when :abs
- @pc = arg
- else #indirect
- lsb = @mem.get( arg )
- msb = @mem.get( arg + 1)
- @pc = lsb + msb<<8
- end
+ @pc = arg
end
def lda(arg, mode)
case mode
diff --git a/spec/r6502/cpu_instructions_spec.rb b/spec/r6502/cpu_instructions_spec.rb
index <HASH>..<HASH> 100644
--- a/spec/r6502/cpu_instructions_spec.rb
+++ b/spec/r6502/cpu_instructions_spec.rb
@@ -983,10 +983,8 @@ module R6502
@cpu.pc.should == 0x2000
@cpu.pc = 0x1000
- @mem.set( 0x2000, 0x00 )
- @mem.set( 0x2001, 0x11 )
@cpu.jmp(0x2000, :ind)
- @cpu.pc.should == 0x1100
+ @cpu.pc.should == 0x2000
end
it "jsr" do
@cpu.s = 0xff | fix indirect jmp resolve indirect twice. | joelanders_r6502 | train | rb,rb |
1d15757a6136408b7a5c67a85d8b96401e74de71 | diff --git a/dynamic_dynamodb/__init__.py b/dynamic_dynamodb/__init__.py
index <HASH>..<HASH> 100644
--- a/dynamic_dynamodb/__init__.py
+++ b/dynamic_dynamodb/__init__.py
@@ -164,13 +164,13 @@ def execute():
for gsi_name, gsi_key in sorted(gsi_names):
try:
gsi_num_consec_read_checks = \
- CHECK_STATUS['tables'][table_name]['reads']
+ CHECK_STATUS['gsis'][gsi_name]['reads']
except KeyError:
gsi_num_consec_read_checks = 0
try:
gsi_num_consec_write_checks = \
- CHECK_STATUS['tables'][table_name]['writes']
+ CHECK_STATUS['gsis'][gsi_name]['writes']
except KeyError:
gsi_num_consec_write_checks = 0 | Fixed consecutive check issue for GSIs #<I> | sebdah_dynamic-dynamodb | train | py |
afd78d7086d51c8f47f0588f921e3418e728260a | diff --git a/lxd/db/cluster/update.go b/lxd/db/cluster/update.go
index <HASH>..<HASH> 100644
--- a/lxd/db/cluster/update.go
+++ b/lxd/db/cluster/update.go
@@ -2421,11 +2421,18 @@ INSERT INTO images_profiles (image_id, profile_id)
// Add a new "arch" column to the "nodes" table.
func updateFromV19(tx *sql.Tx) error {
+ _, err := tx.Exec("PRAGMA ignore_check_constraints=on")
+ if err != nil {
+ return err
+ }
+
+ defer tx.Exec("PRAGMA ignore_check_constraints=off")
+
// The column has a not-null constraint and a default value of
// 0. However, leaving the 0 default won't effectively be accepted when
// creating a new, due to the check constraint, so we are sure to end
// up with a valid value.
- _, err := tx.Exec("ALTER TABLE nodes ADD COLUMN arch INTEGER NOT NULL DEFAULT 0 CHECK (arch > 0)")
+ _, err = tx.Exec("ALTER TABLE nodes ADD COLUMN arch INTEGER NOT NULL DEFAULT 0 CHECK (arch > 0)")
if err != nil {
return err
}
@@ -2437,6 +2444,7 @@ func updateFromV19(tx *sql.Tx) error {
if err != nil {
return err
}
+
return nil
} | lxd/db/cluster: Fixes <I> migration for sqlite <I>.
SQLite <I> introduced a change in which the CHECK constraint is checked
immediately when adding a new column. Since the default value of the
arch is not allowed under the check constraint, this operation fails.
This change turns on the ignore_check_constraints pragma before applying
the changes. | lxc_lxd | train | go |
7cb5143eb8e221b26bb8b8f78f4673a218aaca65 | diff --git a/lib/Doctrine/Manager.php b/lib/Doctrine/Manager.php
index <HASH>..<HASH> 100644
--- a/lib/Doctrine/Manager.php
+++ b/lib/Doctrine/Manager.php
@@ -253,6 +253,38 @@ class Doctrine_Manager extends Doctrine_Configurable implements Countable, Itera
return $this->connections[$name];
}
+ /**
+ * getComponentAlias
+ * retrieves the alias for given component name
+ * if the alias couldn't be found, this method returns the given
+ * component name
+ *
+ * @param string $componentName
+ * @return string the component alias
+ */
+ public function getComponentAlias($componentName)
+ {
+ if (isset($this->componentAliases[$componentName])) {
+ return $this->componentAliases[$componentName];
+ }
+
+ return $componentName;
+ }
+ /**
+ * sets an alias for given component name
+ * very useful when building a large framework with a possibility
+ * to override any given class
+ *
+ * @param string $componentName the name of the component
+ * @param string $alias
+ * @return Doctrine_Manager
+ */
+ public function setComponentAlias($componentName, $alias)
+ {
+ $this->componentAliases[$componentName] = $alias;
+
+ return $this;
+ }
/**
* bindComponent
* binds given component to given connection | little draft for introducing DI into Doctrine | doctrine_annotations | train | php |
a0d8ff6b1cc0cb11b6f0e2fccacf94643d856261 | diff --git a/lib/things/instance.js b/lib/things/instance.js
index <HASH>..<HASH> 100644
--- a/lib/things/instance.js
+++ b/lib/things/instance.js
@@ -134,7 +134,9 @@ module.exports = class Instance {
callAll(action, args) {
let promises = [];
for(const service of this.services) {
- promises.push(service.call(action, args));
+ promises.push(service.call(action, args)
+ .then(result => values.fromJSON('mixed', result))
+ );
}
return new CallResolver(Array.from(this.services), promises);
} | callAll should convert results from JSON | tinkerhub_tinkerhub | train | js |
7821addfe78091b4d75334011f8c758b3382c6b8 | diff --git a/openstack-api/src/main/java/org/openstack/client/common/SimpleLinkResolver.java b/openstack-api/src/main/java/org/openstack/client/common/SimpleLinkResolver.java
index <HASH>..<HASH> 100644
--- a/openstack-api/src/main/java/org/openstack/client/common/SimpleLinkResolver.java
+++ b/openstack-api/src/main/java/org/openstack/client/common/SimpleLinkResolver.java
@@ -45,6 +45,9 @@ public class SimpleLinkResolver implements LinkResolver {
// may this is fixed in the current revision
// so simply comment this
+ // This may actually be because the link shouldn't embed the client version?
+ // If this isn't just a hack, we should probably avoid changing the Link URI!
+
try {
URI uri = URI.create(link.getHref());
String path = uri.getPath(); | Added note about possible reason for why link URLs are wrong | woorea_openstack-java-sdk | train | java |
3e5a8acc8533d0280f4c22aa8c1c1c289c1ff5df | diff --git a/lib/outputcomponents.php b/lib/outputcomponents.php
index <HASH>..<HASH> 100644
--- a/lib/outputcomponents.php
+++ b/lib/outputcomponents.php
@@ -3092,7 +3092,7 @@ class paging_bar implements renderable, templatable {
if ($this->page > 0) {
$data->previous = [
- 'page' => $this->page - 1,
+ 'page' => $this->page,
'url' => (new moodle_url($this->baseurl, [$this->pagevar => $this->page - 1]))->out(false)
];
}
@@ -3138,7 +3138,7 @@ class paging_bar implements renderable, templatable {
if ($this->page + 1 != $lastpage) {
$data->next = [
- 'page' => $this->page + 1,
+ 'page' => $this->page + 2,
'url' => (new moodle_url($this->baseurl, [$this->pagevar => $this->page + 1]))->out(false)
];
} | MDL-<I> core: Correct previous/next page in paging bar | moodle_moodle | train | php |
f7c7e32b250cdec46350464f7a985fc0113280c1 | diff --git a/dummy/spec/spec_helper.rb b/dummy/spec/spec_helper.rb
index <HASH>..<HASH> 100644
--- a/dummy/spec/spec_helper.rb
+++ b/dummy/spec/spec_helper.rb
@@ -14,8 +14,7 @@ Spork.prefork do
require 'rspec/autorun'
require 'database_cleaner'
require 'factory_girl'
- require Rails.root.join("spec/factories")
-
+
# Requires supporting ruby files with custom matchers and macros, etc,
# in spec/support/ and its subdirectories.
Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f} | Remove factories include from spec helper. refs #<I> | volontariat_voluntary_classified_advertisement | train | rb |
be1fae6d19949fc1ce6e62088bb5c5e52996f598 | diff --git a/src/Browscap/Generator/BuildFullFileOnlyGenerator.php b/src/Browscap/Generator/BuildFullFileOnlyGenerator.php
index <HASH>..<HASH> 100644
--- a/src/Browscap/Generator/BuildFullFileOnlyGenerator.php
+++ b/src/Browscap/Generator/BuildFullFileOnlyGenerator.php
@@ -72,7 +72,7 @@ class BuildFullFileOnlyGenerator
/**
* @param \Psr\Log\LoggerInterface $logger
*
- * @return \Browscap\Generator\BuildGenerator
+ * @return BuildFullFileOnlyGenerator
*/
public function setLogger(LoggerInterface $logger)
{
@@ -119,7 +119,7 @@ class BuildFullFileOnlyGenerator
* Entry point for generating builds for a specified version
*
* @param string $version
- * @param boolean $createZipFile
+ * @param string $iniFile
*/
public function run($version, $iniFile)
{ | Scrutinizer Auto-Fixes
This patch was automatically generated as part of the following inspection:
<URL> | browscap_browscap | train | php |
00d0734c85e5e7d6915243c22dca51a9695bd8f3 | diff --git a/spec/taxonomy-genome/GenomeTaxonomySpec.js b/spec/taxonomy-genome/GenomeTaxonomySpec.js
index <HASH>..<HASH> 100644
--- a/spec/taxonomy-genome/GenomeTaxonomySpec.js
+++ b/spec/taxonomy-genome/GenomeTaxonomySpec.js
@@ -122,6 +122,29 @@ describe('Taxonomy with Binned Genomes', function () {
);
});
+ pit('should be able to get results for each bin on a genome', function() {
+ var testSearch = require('gramene-search-client').client._testSearch;
+
+ return Q.all([
+ gtaxPromise,
+ testSearch('binned')
+ ]).spread(function (taxonomy, exampleSearchResults) {
+ var nodeModel;
+
+ taxonomy.setBinType('fixed', 200);
+ taxonomy.setResults(exampleSearchResults.fixed_200_bin);
+
+ nodeModel = taxonomy.speciesWithResults()[0];
+ nodeModel.genome.eachRegion(function(region) {
+ return region.eachBin(function(bin) {
+ expect(bin.results).toBeDefined();
+ expect(bin.results.count).toBeNumber();
+ });
+ });
+ }
+ );
+ });
+
pit('species should have name and genome', function() {
return gtaxPromise.then(function(taxonomy) {
taxonomy.setBinType('fixed', 200); | every bin has results if they have been set. | warelab_gramene-taxonomy-with-genomes | train | js |
79aa4c6f5976f48c726e537a1b377d528cb743f1 | diff --git a/app/src/Bolt/Config.php b/app/src/Bolt/Config.php
index <HASH>..<HASH> 100644
--- a/app/src/Bolt/Config.php
+++ b/app/src/Bolt/Config.php
@@ -357,7 +357,7 @@ class Config extends \Bolt\RecursiveArrayAccess
$dboptions = array(
'driver' => 'pdo_sqlite',
- 'path' => __DIR__ . "/../database/" . $basename,
+ 'path' => __DIR__ . "/../../database/" . $basename,
'randomfunction' => "RANDOM()"
); | Fixing path to sqlite DB. Resolves #<I>. | bolt_bolt | train | php |
4ed42db0e466ec146ffb39bc65f5ee87a1d73f04 | diff --git a/findbugs/src/java/edu/umd/cs/findbugs/ba/AbstractClassMember.java b/findbugs/src/java/edu/umd/cs/findbugs/ba/AbstractClassMember.java
index <HASH>..<HASH> 100644
--- a/findbugs/src/java/edu/umd/cs/findbugs/ba/AbstractClassMember.java
+++ b/findbugs/src/java/edu/umd/cs/findbugs/ba/AbstractClassMember.java
@@ -62,9 +62,9 @@ public abstract class AbstractClassMember implements ClassMember {
}
public String getPackageName() {
- int lastDot = name.lastIndexOf('.');
- if (lastDot == -1) return name;
- return name.substring(0,lastDot);
+ int lastDot = className.lastIndexOf('.');
+ if (lastDot == -1) return className;
+ return className.substring(0,lastDot);
}
public String getSignature() {
return signature; | trying to calculate package name from member name; didn't work too well
git-svn-id: <URL> | spotbugs_spotbugs | train | java |
0ba05476a5ed551c80938c73db437893817ff781 | diff --git a/callhorizons/callhorizons.py b/callhorizons/callhorizons.py
index <HASH>..<HASH> 100644
--- a/callhorizons/callhorizons.py
+++ b/callhorizons/callhorizons.py
@@ -130,7 +130,8 @@ class query():
def __len__(self):
"""returns total number of epochs that have been queried"""
try:
- return self.data.shape[0]
+ # Cast to int because a long is returned from shape on Windows.
+ return int(self.data.shape[0])
except AttributeError:
return 0 | Explicitly cast len as an integer | mommermi_callhorizons | train | py |
7e708fdbbf2870c1c99b9ee97e92b5d392438e4a | diff --git a/app/lib/webpack/inject.style-rules.js b/app/lib/webpack/inject.style-rules.js
index <HASH>..<HASH> 100644
--- a/app/lib/webpack/inject.style-rules.js
+++ b/app/lib/webpack/inject.style-rules.js
@@ -4,7 +4,7 @@ const path = require('path')
const appPaths = require('../app-paths')
const cssVariables = require('../helpers/css-variables')
-const postCssConfig = require(appPaths.resolve.app('.postcssrc.js'))
+const postCssConfigFile = appPaths.resolve.app('.postcssrc.js')
const quasarCssPaths = [ path.join('node_modules', 'quasar'), path.join('node_modules', '@quasar') ]
@@ -80,7 +80,10 @@ function injectRule (chain, pref, lang, test, loader, loaderOptions) {
})
}
- const postCssOpts = { sourceMap: pref.sourceMap, ...postCssConfig }
+ // need a fresh copy, otherwise plugins
+ // will keep on adding making N duplicates for each one
+ delete require.cache[postCssConfigFile]
+ const postCssOpts = { sourceMap: pref.sourceMap, ...require(postCssConfigFile) }
if (pref.rtl) {
const postcssRTL = require('postcss-rtl') | fix(app): Backport "duplicate postcss plugins" fix from Qv2 | quasarframework_quasar | train | js |
399dd8fbe95a0689d78833563bc24b9dd505a3b1 | diff --git a/ui/plugins/controller.js b/ui/plugins/controller.js
index <HASH>..<HASH> 100644
--- a/ui/plugins/controller.js
+++ b/ui/plugins/controller.js
@@ -111,6 +111,9 @@ treeherder.controller('PluginCtrl', [
var selectJobPromise = null;
var selectJob = function(job) {
+ // make super-extra sure that the autoclassify tab shows up when it should
+ showAutoClassifyTab();
+
// set the scope variables needed for the job detail panel
if (job.id) {
$scope.job_detail_loading = true; | Bug <I> - Make sure autoclassify tab is shown when it should (#<I>)
* Bug <I> - Make sure autoclassify tab is shown when it should
If you're a sheriff (is_staff=true) and load treeherder with a selected
job in the url, the autoclasify tab doesn't show up like it should.
This patch double-checks the conditions for showing the autoclassify panel
whenever a job gets selected. | mozilla_treeherder | train | js |
a0d9c12c447c883a35c9992f8646fc11b677df15 | diff --git a/lib/PHPCfg/Visitor/CallFinder.php b/lib/PHPCfg/Visitor/CallFinder.php
index <HASH>..<HASH> 100644
--- a/lib/PHPCfg/Visitor/CallFinder.php
+++ b/lib/PHPCfg/Visitor/CallFinder.php
@@ -14,6 +14,7 @@ class CallFinder implements Visitor {
protected $func;
public function getCallsForFunction($func) {
+ $func = strtolower($func);
return isset($this->calls[$func]) ? $this->calls[$func] : [];
}
@@ -26,7 +27,7 @@ class CallFinder implements Visitor {
}
if ($op instanceof Op\Expr\FuncCall) {
if ($op->name instanceof Operand\Literal) {
- $this->calls[$op->name->value][] = [
+ $this->calls[strtolower($op->name->value)][] = [
$op,
$this->func
]; | Add support for resolving the types | ircmaxell_php-cfg | train | php |
45a589e280ad07ec19741f3abe95b634218e2fd6 | diff --git a/src/binders/kff.StyleBinder.js b/src/binders/kff.StyleBinder.js
index <HASH>..<HASH> 100644
--- a/src/binders/kff.StyleBinder.js
+++ b/src/binders/kff.StyleBinder.js
@@ -35,7 +35,10 @@ kff.StyleBinder = kff.createClass(
else
{
if(this.styleUnit) value += this.styleUnit;
- this.$element[0].style[this.styleProperty] = value;
+ try {
+ this.$element[0].style[this.styleProperty] = value;
+ }
+ catch(e) {}
}
}
} | refactor(kff.StyleBinder): wrap setting of style property in try/catch block
IE8 throws an error if vale is not valid for given CSS property | karfcz_kff | train | js |
67f1956d0768dddcb7ee0bdd495303d7239efc8d | diff --git a/test/test_autopep8.py b/test/test_autopep8.py
index <HASH>..<HASH> 100755
--- a/test/test_autopep8.py
+++ b/test/test_autopep8.py
@@ -1329,7 +1329,7 @@ sql = 'update %s set %s %s' % (from_table,
sql = 'update %s set %s %s' % (from_table,
','.join(['%s=%s' % (col, col)
- for col in cols]),
+ for col in cols]),
where_clause)
"""
with autopep8_context(line) as result: | Update test_autopep8.py after continued_indentation fix
While I'm not a pep8-laywer, pycodestyle seems to allow either styles. | hhatto_autopep8 | train | py |
2e45e4d0151e893574acdef5b61cb2ef9b31556c | diff --git a/ethereum/main.go b/ethereum/main.go
index <HASH>..<HASH> 100644
--- a/ethereum/main.go
+++ b/ethereum/main.go
@@ -42,7 +42,7 @@ func main() {
db := utils.NewDatabase()
err := utils.DBSanityCheck(db)
if err != nil {
- logger.Errorln(err)
+ fmt.Println(err)
os.Exit(1)
} | Print error using regular println. Fixes #<I>
We can't use our own logger because it hasn't been set up properly at
that point. | ethereum_go-ethereum | train | go |
6f4772ba7bd3ea35c280a9933a0f3f34ee7cf0cc | diff --git a/tokenstore.go b/tokenstore.go
index <HASH>..<HASH> 100644
--- a/tokenstore.go
+++ b/tokenstore.go
@@ -82,6 +82,7 @@ func (s *TokenStore) NewToken() string {
hash.Write([]byte(s.salt))
hash.Write(getRandomBytes(64 + time.Now().Second()))
strSum := base64.URLEncoding.EncodeToString(hash.Sum(nil))
+ s.salt = strSum
s.tstore.AddValue(strSum, nil)
return strSum | Fixed salt implementation, was lacking randomness | skarllot_raiqub | train | go |
d5e680ea9decd3210f1fb45f21a702d69bf0f38b | diff --git a/Kwf/Model/Abstract.php b/Kwf/Model/Abstract.php
index <HASH>..<HASH> 100644
--- a/Kwf/Model/Abstract.php
+++ b/Kwf/Model/Abstract.php
@@ -803,7 +803,7 @@ abstract class Kwf_Model_Abstract implements Kwf_Model_Interface
$ret = null;
foreach ($expr->getExpressions() as $e) {
$value = $this->getExprValue($row, $e);
- if ($ret == null) {
+ if ($ret === null) {
$ret = $value;
} else {
if ($value == 0) {
@@ -819,7 +819,7 @@ abstract class Kwf_Model_Abstract implements Kwf_Model_Interface
$ret = null;
foreach ($expr->getExpressions() as $e) {
$value = $this->getExprValue($row, $e);
- if ($ret == null) {
+ if ($ret === null) {
$ret = $value;
} else {
$ret *= $value;
@@ -831,7 +831,7 @@ abstract class Kwf_Model_Abstract implements Kwf_Model_Interface
$ret = null;
foreach ($expr->getExpressions() as $e) {
$value = $this->getExprValue($row, $e);
- if ($ret == null) {
+ if ($ret === null) {
$ret = $value;
} else {
$ret -= $value; | fixed multiply, divide and subtract in model abstract
check for null interprets int(0) also as null, changed operator to check type also | koala-framework_koala-framework | train | php |
8f3ea7380a74ce064bc15d2aa78dcfbd1d70127b | diff --git a/lib/proxy.js b/lib/proxy.js
index <HASH>..<HASH> 100644
--- a/lib/proxy.js
+++ b/lib/proxy.js
@@ -114,7 +114,7 @@
case 'server' :
this.options.debug && console.log('emmiting %s event on %s'.grey, parsedEvent.type, parsedEvent.source);
- console.log(JSON.stringify(args));
+ self.options.debug && console.log(JSON.stringify(args));
self.proxy.phantom.emit.apply(self.proxy.phantom, args);
break;
default :
@@ -135,7 +135,7 @@
}
};
- console.log(self.proxy.phantom.addCookie);
+ self.options.debug && console.log(self.proxy.phantom.addCookie);
//create event stream
fs.open(options.eventStreamPath, 'w+', function (err, fd) {
@@ -209,7 +209,7 @@
self.options.debug && console.log('creating a new server, waiting for servercreated event on %s',self.proxy.phantom);
self.proxy.phantom.on('serverCreated', function (result) {
- console.log('server created callback fired with value:%s'.yellow.bold, result);
+ self.options.debug && console.log('server created callback fired with value:%s'.yellow.bold, result);
callbackFn(self.proxy);
}); | Hide a few console messages behind debug flag | sheebz_phantom-proxy | train | js |
8286c5ec35720138345c6750b44afd8e37e5262c | diff --git a/lib/textbringer/modes/programming_mode.rb b/lib/textbringer/modes/programming_mode.rb
index <HASH>..<HASH> 100644
--- a/lib/textbringer/modes/programming_mode.rb
+++ b/lib/textbringer/modes/programming_mode.rb
@@ -95,7 +95,7 @@ module Textbringer
end
s = @buffer.save_excursion {
@buffer.beginning_of_line
- if @buffer.looking_at?(/^[ \t]*#{comment_start}+[ \t]*/)
+ if @buffer.looking_at?(/[ \t]*#{comment_start}+[ \t]*/)
@buffer.match_string(0)
else
"" | ^ is not necessary for looking_at? | shugo_textbringer | train | rb |
aa49cda753eceabd85cd0bbdacef456e667f0913 | diff --git a/h2o-py/tests/testdir_algos/glm/pyunit_glm_regularization_path.py b/h2o-py/tests/testdir_algos/glm/pyunit_glm_regularization_path.py
index <HASH>..<HASH> 100644
--- a/h2o-py/tests/testdir_algos/glm/pyunit_glm_regularization_path.py
+++ b/h2o-py/tests/testdir_algos/glm/pyunit_glm_regularization_path.py
@@ -32,7 +32,6 @@ def reg_path_glm():
print(diff2)
assert diff < 1e-3
assert diff2 < 1e-3
-
if __name__ == "__main__":
pyunit_utils.standalone_test(reg_path_glm)
else: | Added makeGLMModel call to python. | h2oai_h2o-3 | train | py |
97fd2fb575b396710c107a183391034c34cd34ce | diff --git a/course/classes/output/activity_navigation.php b/course/classes/output/activity_navigation.php
index <HASH>..<HASH> 100644
--- a/course/classes/output/activity_navigation.php
+++ b/course/classes/output/activity_navigation.php
@@ -72,7 +72,7 @@ class activity_navigation implements renderable, templatable {
}
$attributes = [
- 'classes' => 'btn btn-link',
+ 'class' => 'btn btn-link',
'id' => 'prev-activity-link',
'title' => $linkname,
];
@@ -88,7 +88,7 @@ class activity_navigation implements renderable, templatable {
}
$attributes = [
- 'classes' => 'btn btn-link',
+ 'class' => 'btn btn-link',
'id' => 'next-activity-link',
'title' => $linkname,
]; | MDL-<I> course: Fixed wrong classes key in activity_navigation class
Replaced "classes" by "class" attribute, when the prev and next links are builded into the activity navigation. | moodle_moodle | train | php |
e71367154ad7af07e09f1b0c6c75154daa8e4d71 | diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -9,7 +9,7 @@ setup(
name='httpie-edgegrid',
description='Edgegrid plugin for HTTPie.',
long_description=open('README.rst').read().strip(),
- version='1.0.0',
+ version='1.0.1',
author='Kirsten Hunter',
author_email='[email protected]',
license='Apache 2.0', | Fixing the hostname stuff in the edgerc | akamai_httpie-edgegrid | train | py |
c0f518acd1714d76ffee51f63ac38b0e3f561e50 | diff --git a/lib/rfd/windows.rb b/lib/rfd/windows.rb
index <HASH>..<HASH> 100644
--- a/lib/rfd/windows.rb
+++ b/lib/rfd/windows.rb
@@ -138,7 +138,10 @@ module Rfd
end
def close_all
- @panes.each {|p| Curses.delwin p}
+ @panes.each do |p|
+ Curses.wclear p
+ Curses.delwin p
+ end
end
def include_point?(pane: pane, y: nil, x: nil) | Clear all existing panes before deleting | amatsuda_rfd | train | rb |
ac03bc708b0ef1de058b66b2736f8cabe4cfadd3 | diff --git a/raven/utils/serializer/base.py b/raven/utils/serializer/base.py
index <HASH>..<HASH> 100644
--- a/raven/utils/serializer/base.py
+++ b/raven/utils/serializer/base.py
@@ -113,8 +113,11 @@ class StringSerializer(Serializer):
def serialize(self, value, **kwargs):
string_max_length = kwargs.get('string_max_length', None)
- return repr(six.binary_type('%s')) % (
- value.decode('utf-8').encode('utf-8')[:string_max_length],)
+ if not six.PY3:
+ return repr(six.binary_type('%s')) % (
+ value.decode('utf-8').encode('utf-8')[:string_max_length],)
+ else:
+ return repr(value[:string_max_length])
class TypeSerializer(Serializer): | Fixed unicode issue with python3. | getsentry_raven-python | train | py |
20bbb80772d760fad224b41fdb5ee297ba1ce333 | diff --git a/src/Kunstmaan/GeneratorBundle/Command/GeneratePagePartCommand.php b/src/Kunstmaan/GeneratorBundle/Command/GeneratePagePartCommand.php
index <HASH>..<HASH> 100644
--- a/src/Kunstmaan/GeneratorBundle/Command/GeneratePagePartCommand.php
+++ b/src/Kunstmaan/GeneratorBundle/Command/GeneratePagePartCommand.php
@@ -484,7 +484,7 @@ EOT
$bundle = $this->getContainer()->get('kernel')->getBundle($this->bundleName);
list($project, $tmp) = explode("\\", $bundle->getNameSpace());
$parts = explode("\\", $entityName);
- $joinTableName = strtolower($project.'__'.$this->pagepartName.'_'.$parts[count($parts)-1]);
+ $joinTableName = strtolower($project.'_'.$this->pagepartName.'_'.$parts[count($parts)-1]);
$fields[$type][] = array(
'fieldName' => lcfirst(Container::camelize($name)),
'type' => 'entity', | This is also needed for the no double underscores in pagepart generator | Kunstmaan_KunstmaanBundlesCMS | train | php |
810c00875ab459571670bd3dbb4b29fa5bf76fd5 | diff --git a/shoebot/gui/var_window.py b/shoebot/gui/var_window.py
index <HASH>..<HASH> 100644
--- a/shoebot/gui/var_window.py
+++ b/shoebot/gui/var_window.py
@@ -80,10 +80,15 @@ class VarWindow(object):
label = Gtk.Label(pretty_name(v.name))
sliderbox.pack_start(label, False, True, 20)
+ if v.min != v.max:
+ step = (max(v.min, v.max) - min(v.min, v.max)) / 50.
+ else:
+ step = 0
+
if v.max - v.min > 2:
- adj = Gtk.Adjustment(v.value, v.min, v.max, .1, 2, 1)
+ adj = Gtk.Adjustment(v.value, v.min, v.max, step, 2, 1)
else:
- adj = Gtk.Adjustment(v.value, v.min, v.max, .1)
+ adj = Gtk.Adjustment(v.value, v.min, v.max, step)
adj.connect("value_changed", self.widget_changed, v)
hscale = Gtk.HScale(adjustment=adj)
#hscale.set_value_pos(Gtk.POS_RIGHT) | Attempt to make the step smaller for number vars | shoebot_shoebot | train | py |
ac874dca8fda104b25fb9bbb24a0f1ba2089fba2 | diff --git a/Resources/Public/JavaScript/search_controller.js b/Resources/Public/JavaScript/search_controller.js
index <HASH>..<HASH> 100644
--- a/Resources/Public/JavaScript/search_controller.js
+++ b/Resources/Public/JavaScript/search_controller.js
@@ -27,6 +27,7 @@ function SearchController() {
_this.scrollToTopOfElement(solrParent, 50);
jQuery("body").trigger("tx_solr_updated");
loader.fadeOut().remove();
+ history.replaceState({}, null, uri.removeQuery("type").href());
}
);
return false; | Replace URL with new filter URL (#<I>)
If a user clicks on a search result the appropriate page/content is loaded. When going back (browser back) the search page is loaded, but without the chosen filter options. By replacing the current browser URL is is possible to go back to the search page with the chosen filter options already set. | TYPO3-Solr_ext-solr | train | js |
7ea1da65d7e14e420cdb5957618db37f092badda | diff --git a/activerecord/lib/active_record/relation/finder_methods.rb b/activerecord/lib/active_record/relation/finder_methods.rb
index <HASH>..<HASH> 100644
--- a/activerecord/lib/active_record/relation/finder_methods.rb
+++ b/activerecord/lib/active_record/relation/finder_methods.rb
@@ -565,7 +565,12 @@ module ActiveRecord
if loaded?
@records[-index]
else
- reverse_order.offset(index-1).first
+ to_a[-index]
+ # TODO: can be made more performant on large result sets by
+ # for instance, last(index)[-index] (which would require
+ # refactoring the last(n) finder method to make test suite pass),
+ # or by using a combination of reverse_order, limit, and offset,
+ # e.g., reverse_order.offset(index-1).first
end
end | refactor AR second_to_last to use array methods | rails_rails | train | rb |
c92773c8ac183ba867aaf5da20e08a7452ff4443 | diff --git a/lib/format_engine/format_spec/set.rb b/lib/format_engine/format_spec/set.rb
index <HASH>..<HASH> 100644
--- a/lib/format_engine/format_spec/set.rb
+++ b/lib/format_engine/format_spec/set.rb
@@ -49,7 +49,7 @@ module FormatEngine
#Inspect for debugging.
def inspect
- "Set(#{format.inspect}, #{regex.inspect})"
+ "Set(#{@raw.inspect}, #{regex.inspect})"
end
end | Corrected FormatSet inspect method. | PeterCamilleri_format_engine | train | rb |
e9a2b72ddb0a5d069e72aceabb36337e5b9e9dcd | diff --git a/models/repo.go b/models/repo.go
index <HASH>..<HASH> 100644
--- a/models/repo.go
+++ b/models/repo.go
@@ -1646,7 +1646,7 @@ func SearchRepositoryByName(opts *SearchRepoOptions) (repos []*Repository, _ int
}
}
if len(opts.Keyword) > 0 {
- sess.And("repo.lower_name LIKE ?", "%"+strings.ToLower(opts.Keyword)+"%")
+ sess.And("repo.lower_name LIKE ? OR repo.description LIKE ?", "%"+strings.ToLower(opts.Keyword)+"%", "%"+strings.ToLower(opts.Keyword)+"%")
}
if opts.OwnerID > 0 {
sess.And("repo.owner_id = ?", opts.OwnerID) | models/repo: modify keyword search to include description for #<I> (#<I>)
* Modified repository keyword search to include description for #<I>
* Replacing Where with And for #<I> | gogs_gogs | train | go |
eb0dfe4c75e1c7f9d7bea7ec6332dcc73007ad83 | diff --git a/lib/jsonapi/link_builder.rb b/lib/jsonapi/link_builder.rb
index <HASH>..<HASH> 100644
--- a/lib/jsonapi/link_builder.rb
+++ b/lib/jsonapi/link_builder.rb
@@ -116,7 +116,7 @@ module JSONAPI
def regular_primary_resources_path
[
formatted_module_path_from_class(primary_resource_klass),
- route_formatter.format(primary_resource_klass._type.to_s),
+ format_route(primary_resource_klass._type.to_s),
].join
end
@@ -127,7 +127,7 @@ module JSONAPI
def regular_resource_path(source)
[
formatted_module_path_from_class(source.class),
- route_formatter.format(source.class._type.to_s),
+ format_route(source.class._type.to_s),
"/#{ source.id }",
].join
end | Keep knowledge of route_formatter within #format_route | cerebris_jsonapi-resources | train | rb |
306b964ce39ddf031b61b89e7e71621fa8f022f7 | diff --git a/spring-boot-project/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/TestJarCreator.java b/spring-boot-project/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/TestJarCreator.java
index <HASH>..<HASH> 100644
--- a/spring-boot-project/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/TestJarCreator.java
+++ b/spring-boot-project/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/TestJarCreator.java
@@ -98,6 +98,7 @@ public abstract class TestJarCreator {
writeEntry(jarOutputStream, "META-INF/versions/13/multi-release.dat", 13);
writeEntry(jarOutputStream, "META-INF/versions/14/multi-release.dat", 14);
writeEntry(jarOutputStream, "META-INF/versions/15/multi-release.dat", 15);
+ writeEntry(jarOutputStream, "META-INF/versions/16/multi-release.dat", 16);
}
else {
writeEntry(jarOutputStream, "3.dat", 3); | Fix multi-release JAR test on JDK <I>
See gh-<I> | spring-projects_spring-boot | train | java |
8d25c03c8dee8ed801ea74982fd49badc901bec0 | diff --git a/pyres/__init__.py b/pyres/__init__.py
index <HASH>..<HASH> 100644
--- a/pyres/__init__.py
+++ b/pyres/__init__.py
@@ -226,7 +226,7 @@ class ResQ(object):
"""Close the underlying redis connection.
"""
- self.redis.disconnect()
+ self.redis.connection.disconnect()
def enqueue_at(self, datetime, klass, *args, **kwargs):
class_name = '%s.%s' % (klass.__module__, klass.__name__)
diff --git a/tests/test_resq.py b/tests/test_resq.py
index <HASH>..<HASH> 100644
--- a/tests/test_resq.py
+++ b/tests/test_resq.py
@@ -99,4 +99,7 @@ class ResQTests(PyResTests):
self.resq.enqueue_from_string('tests.Basic','basic2','test1')
assert len(self.resq.queues()) == 2
assert 'test' not in self.resq.queues()
- assert 'basic' in self.resq.queues()
\ No newline at end of file
+ assert 'basic' in self.resq.queues()
+
+ def test_close(self):
+ self.resq.close() | fixing bug with old redis-py api call | binarydud_pyres | train | py,py |
22b8ddc9406f950dfa04ff8cf61796e0b8e5919c | diff --git a/src/Commands/InstallCommand.php b/src/Commands/InstallCommand.php
index <HASH>..<HASH> 100644
--- a/src/Commands/InstallCommand.php
+++ b/src/Commands/InstallCommand.php
@@ -72,13 +72,13 @@ class InstallCommand extends Command
$str = file_get_contents(app_path('User.php'));
if ($str !== false) {
- $str = str_replace("extends Authenticatable", "extends TCG\Voyager\models\User", $str);
+ $str = str_replace("extends Authenticatable", "extends \TCG\Voyager\models\User", $str);
file_put_contents(app_path('User.php'), $str);
}
} else {
$this->warn('Unable to locate "app/User.php". Did you move this file?');
- $this->warn('You will need to update this manually. Change "extends Authenticatable" to "extends TCG\Voyager\Models\User" in your User model');
+ $this->warn('You will need to update this manually. Change "extends Authenticatable" to "extends \TCG\Voyager\Models\User" in your User model');
}
$this->info('Dumping the autoloaded files and reloading all new files'); | Apparently the leading slash is needed | the-control-group_voyager | train | php |
10b8ddf1ff49238ae2c046e2f6d54b88f536e5ff | diff --git a/app/autoload.php b/app/autoload.php
index <HASH>..<HASH> 100644
--- a/app/autoload.php
+++ b/app/autoload.php
@@ -19,9 +19,14 @@ $loader->registerPrefixes(array(
'Twig_Extensions_' => __DIR__.'/../vendor/twig-extensions/lib',
'Twig_' => __DIR__.'/../vendor/twig/lib',
));
-$loader->registerPrefixFallbacks(array(
- __DIR__.'/../vendor/symfony/src/Symfony/Component/Locale/Resources/stubs',
-));
+
+// intl
+if (!function_exists('intl_get_error_code')) {
+ require_once __DIR__.'/../vendor/symfony/src/Symfony/Component/Locale/Resources/stubs/functions.php';
+
+ $loader->registerPrefixFallbacks(array(__DIR__.'/../vendor/symfony/src/Symfony/Component/Locale/Resources/stubs'));
+}
+
$loader->registerNamespaceFallbacks(array(
__DIR__.'/../src',
)); | fixed intl functions when intl is not enabled | symfony_symfony-standard | train | php |
683e7e3c46b3d22e9e6be00e5a8fbe0e825c2986 | diff --git a/algoliasearch/search_index.py b/algoliasearch/search_index.py
index <HASH>..<HASH> 100644
--- a/algoliasearch/search_index.py
+++ b/algoliasearch/search_index.py
@@ -75,7 +75,7 @@ class SearchIndex(object):
"Algolia is also able to generate objectIDs " \
"automatically but *it's not recommended*. " \
"To do it, use `save_objects(objects, " \
- "{'autoGenerateObjectIDIfNotExist' => True})`."
+ "{'autoGenerateObjectIDIfNotExist': True})`."
raise MissingObjectIdException(message, e.obj) | Fixes exception while working with save_objects | algolia_algoliasearch-client-python | train | py |
94be56593a43101abc21b30b187d340e7ef8c3f0 | diff --git a/runtests.py b/runtests.py
index <HASH>..<HASH> 100644
--- a/runtests.py
+++ b/runtests.py
@@ -13,6 +13,12 @@ if not settings.configured:
'NAME': ':memory:',
}
},
+ MIDDLEWARE_CLASSES=(
+ 'django.middleware.common.CommonMiddleware',
+ 'django.contrib.sessions.middleware.SessionMiddleware',
+ 'django.middleware.csrf.CsrfViewMiddleware',
+ 'django.contrib.auth.middleware.AuthenticationMiddleware',
+ ),
INSTALLED_APPS=(
'django.contrib.auth',
'django.contrib.contenttypes',
@@ -31,6 +37,8 @@ from django.test.utils import get_runner
def runtests():
+ if hasattr(django, 'setup'):
+ django.setup()
TestRunner = get_runner(settings)
test_runner = TestRunner(verbosity=1, interactive=True, failfast=False)
failures = test_runner.run_tests(['stickyuploads', ]) | Fix tests for Django <I> by calling the new setup and explicitly including MIDDLEWARE_CLASSES. | caktus_django-sticky-uploads | train | py |
c5b93a9ba97cd93dc36390bf9484f39179af6974 | diff --git a/lib/data.js b/lib/data.js
index <HASH>..<HASH> 100644
--- a/lib/data.js
+++ b/lib/data.js
@@ -18,20 +18,23 @@ const utils = require("./utils")
* @return {Object|Array} JSONAPI compliant data payload.
*/
class Data_Payload_Generator {
+
constructor(generator) {
- // Set the generator.
- this.generator = generator
+ if (!generator) {
+ throw new ReferenceError("Data_Payload_Generator: No generator passed in.")
+ }
// Generate the payload(s)
- return generator.run(this.generate, this)
- }
-
- generate(document) {
- return Data_Payload_Generator.resource_object(this.generator, document) || {}
+ return generator.run(document => Data_Payload_Generator.resource_object(generator, document), this)
}
- static resource_object(generator, values, no_relationships) {
- const document = utils.clone(values)
+ static resource_object(generator, document, no_relationships) {
+ // If the document doesn't have an id,
+ // we should assume that the data element
+ // in the response will just be null.
+ if (!document.hasOwnProperty("id")) {
+ return null
+ }
// Relationships aren't always populated,
// check if we got an object of document | Fixed issue where a related item might not exist/have an id. | newworldcode_waterline-jsonapi | train | js |
a623a9d951004a983baf475bd315b955830cf8ee | diff --git a/libES2015/reactComponentElement.js b/libES2015/reactComponentElement.js
index <HASH>..<HASH> 100644
--- a/libES2015/reactComponentElement.js
+++ b/libES2015/reactComponentElement.js
@@ -27,8 +27,8 @@ class ReactComponentElement extends ReactElement {
this.reactComponent.componentDidMount.apply(this);
}
- componentWillUnMount() {
- this.reactComponent.componentWillUnMount.apply(this);
+ componentWillUnmount() {
+ this.reactComponent.componentWillUnmount.apply(this);
}
} | Correction to the ReactComponentElement class. | djalbat_reaction | train | js |
50c4161d832153bb9e7264fd4bfc87941b0e8558 | diff --git a/api/client.go b/api/client.go
index <HASH>..<HASH> 100644
--- a/api/client.go
+++ b/api/client.go
@@ -790,10 +790,15 @@ START:
return nil, LastOutputStringError
}
- var cancel context.CancelFunc
if timeout != 0 {
- ctx, cancel = context.WithTimeout(ctx, timeout)
- defer cancel()
+ // NOTE: this leaks a timer. But when we defer a cancel call here for
+ // the returned function we see errors in tests with contxt canceled.
+ // Although the request is done by the time we exit this function it is
+ // still causing something else to go wrong. Maybe it ends up being
+ // tied to the response somehow and reading the response body ends up
+ // checking it, or something. I don't know, but until we can chase this
+ // down, keep it not-canceled even though vet complains.
+ ctx, _ = context.WithTimeout(ctx, timeout)
}
req.Request = req.Request.WithContext(ctx) | Revert change suggested by vet. See the comment for details. (#<I>) | hashicorp_vault | train | go |
6938ac4f6d6f89284c8b27f9095e299d40d978cb | diff --git a/library/src/main/java/com/mikepenz/materialdrawer/DrawerBuilder.java b/library/src/main/java/com/mikepenz/materialdrawer/DrawerBuilder.java
index <HASH>..<HASH> 100644
--- a/library/src/main/java/com/mikepenz/materialdrawer/DrawerBuilder.java
+++ b/library/src/main/java/com/mikepenz/materialdrawer/DrawerBuilder.java
@@ -864,6 +864,7 @@ public class DrawerBuilder {
protected FastAdapter<IDrawerItem> getAdapter() {
if (mAdapter == null) {
mAdapter = new FastAdapter<>();
+ mAdapter.withSelectable(true);
mAdapter.withAllowDeselection(false);
mAdapter.setHasStableIds(mHasStableIds); | * fix wrong selection state after updating to `FastAdapter` <I>
* FIX #<I> | mikepenz_MaterialDrawer | train | java |
b95270b24d9e864093302864fb7d487f1d823e74 | diff --git a/packages/core/src/lib/markdown-it/index.js b/packages/core/src/lib/markdown-it/index.js
index <HASH>..<HASH> 100644
--- a/packages/core/src/lib/markdown-it/index.js
+++ b/packages/core/src/lib/markdown-it/index.js
@@ -164,7 +164,7 @@ markdownIt.renderer.rules.code_inline = (tokens, idx, options, env, slf) => {
if (lang && hljs.getLanguage(lang)) {
token.attrSet('class', `${inlineClass} ${lang}`);
return `<code${slf.renderAttrs(token)}>${
- hljs.highlight(lang, token.content, true).value
+ hljs.highlight(token.content, { language: lang, ignoreIllegals: true }).value
}</code>`;
}
token.attrSet('class', `${inlineClass} no-lang`); | Update highlightjs method call syntax for inline code (#<I>) | MarkBind_markbind | train | js |
012a220dd32ad37c5f575d52de1bdfa0b032de06 | diff --git a/test/test_inspect.rb b/test/test_inspect.rb
index <HASH>..<HASH> 100644
--- a/test/test_inspect.rb
+++ b/test/test_inspect.rb
@@ -52,8 +52,11 @@ class TestInspect < Test::Unit::TestCase
def test_dcmes_inspect_includes_class_name
meta = Package::Metadata::Title.new
+ meta.content = 'Book Title'
- assert_match /Package::Metadata::Title/, meta.inspect
+ title_pattern = RUBY_VERSION >= '2.0' ? '#<EPUB::Publication::Package::Metadata::Title' : 'Book Title'
+
+ assert_match title_pattern, meta.inspect
end
def test_dcmes_inspect_includes_instance_variables
@@ -61,10 +64,14 @@ class TestInspect < Test::Unit::TestCase
meta.lang = 'en-US'
meta.dir = 'rtl'
- assert_match /@lang/, meta.inspect
- assert_match /en\-US/, meta.inspect
- assert_match /@dir/, meta.inspect
- assert_match /rtl/, meta.inspect
+ if RUBY_VERSION >= '2.0'
+ assert_match /@lang/, meta.inspect
+ assert_match /en\-US/, meta.inspect
+ assert_match /@dir/, meta.inspect
+ assert_match /rtl/, meta.inspect
+ else
+ assert_equal '', meta.inspect
+ end
end
def test_meta_inspect_includes_class_name | Handle with difference of #inspect | KitaitiMakoto_epub-parser | train | rb |
2caeed548e213705e85eca9f4dacdf2645bdf231 | diff --git a/crafter-security-provider/src/main/java/org/craftercms/security/authentication/impl/AuthenticationCookie.java b/crafter-security-provider/src/main/java/org/craftercms/security/authentication/impl/AuthenticationCookie.java
index <HASH>..<HASH> 100644
--- a/crafter-security-provider/src/main/java/org/craftercms/security/authentication/impl/AuthenticationCookie.java
+++ b/crafter-security-provider/src/main/java/org/craftercms/security/authentication/impl/AuthenticationCookie.java
@@ -75,12 +75,9 @@ public class AuthenticationCookie {
* @param cookieMaxAge the max age of the cookie.
*/
public void save(RequestContext context, int cookieMaxAge) {
- String contextPath = context.getRequest().getContextPath();
-
Cookie cookie = new Cookie(COOKIE, toCookieValue());
- cookie.setPath(StringUtils.isNotEmpty(contextPath)? contextPath: "/");
+ cookie.setPath("/");
cookie.setMaxAge(cookieMaxAge);
-
context.getResponse().addCookie(cookie);
} | Managed issue related to cookie in cross application request | craftercms_profile | train | java |
68700b494fd0b20a111070844426aeef5113711c | diff --git a/vendor/plugins/refinery/app/helpers/application_helper.rb b/vendor/plugins/refinery/app/helpers/application_helper.rb
index <HASH>..<HASH> 100644
--- a/vendor/plugins/refinery/app/helpers/application_helper.rb
+++ b/vendor/plugins/refinery/app/helpers/application_helper.rb
@@ -39,9 +39,9 @@ module ApplicationHelper
selected = current_page?(page) or (request.path =~ Regexp.new(page.menu_match) unless page.menu_match.blank?) or (request.path == page.link_url)
end
- def image_fu(image, thumbnail, options={})
+ def image_fu(image, thumbnail = nil , options={})
begin
- image_thumbnail = image.thumbnails.collect {|t| t if t.thumbnail == thumbnail.to_s}.compact.first unless thumbnail.nil?
+ image_thumbnail = thumbnail.nil? ? image : image.thumbnails.collect {|t| t if t.thumbnail == thumbnail.to_s}.compact.first
image_tag image_thumbnail.public_filename, {:width => image_thumbnail.width, :height => image_thumbnail.height}.merge!(options)
rescue
image_tag image.public_filename(thumbnail), options | make image_fu work without specifying a thumbnail and if the thumbnail is not specified then still give the browser the width and height optimisations | refinery_refinerycms | train | rb |
dbb2bd5effeb4f0035e443d9f5b9d7c83a9f8544 | diff --git a/lib/Thelia/Core/Template/Smarty/Plugins/Module.php b/lib/Thelia/Core/Template/Smarty/Plugins/Module.php
index <HASH>..<HASH> 100644
--- a/lib/Thelia/Core/Template/Smarty/Plugins/Module.php
+++ b/lib/Thelia/Core/Template/Smarty/Plugins/Module.php
@@ -67,7 +67,7 @@ class Module extends AbstractSmartyPlugin
if (false !== $location = $this->getParam($params, 'location', false)) {
if ($this->debug === true && $this->request->get('SHOW_INCLUDE')) {
- echo sprintf('<div style="background-color: #C82D26; border-color: #000000; border: solid;">%s</div>', $location);
+ echo sprintf('<div style="background-color: #C82D26; color: #fff; border-color: #000000; border: solid;">%s</div>', $location);
}
$moduleLimit = $this->getParam($params, 'module', null);
@@ -83,9 +83,14 @@ class Module extends AbstractSmartyPlugin
$file = sprintf("%s/AdminIncludes/%s.html", $module->getAbsoluteBaseDir(), $location);
if (file_exists($file)) {
- $content .= file_get_contents($file);
- $count++;
+ $output = trim(file_get_contents($file));
+
+ if (! empty($output)) {
+ $content .= $output;
+
+ $count++;
+ }
}
}
} | Improved the dismmay on modules tab | thelia_core | train | php |
fefd2ed137c59830fb3f8872beec8cac8c8e5cc7 | diff --git a/aiohttp/signals.py b/aiohttp/signals.py
index <HASH>..<HASH> 100644
--- a/aiohttp/signals.py
+++ b/aiohttp/signals.py
@@ -20,7 +20,7 @@ class Signal(object):
for receiver in self._receivers:
receiver(**kwargs)
-class AsyncSignal(Signal):
+class CoroutineSignal(Signal):
def connect(self, receiver):
assert asyncio.iscoroutinefunction(receiver), receiver
super().connect(receiver) | Rename AsyncSignal to CoroutineSignal for clarity of purpose | aio-libs_aiohttp | train | py |
936b2f4ef660d5b6f6d1123e39af95e2f353164d | diff --git a/config/karma/shared.karma.conf.js b/config/karma/shared.karma.conf.js
index <HASH>..<HASH> 100644
--- a/config/karma/shared.karma.conf.js
+++ b/config/karma/shared.karma.conf.js
@@ -53,6 +53,10 @@ function getConfig(config) {
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
+ browserDisconnectTimeout: 3e5,
+ browserDisconnectTolerance: 3,
+ browserNoActivityTimeout: 3e5,
+ captureTimeout: 3e5,
autoWatch: false,
singleRun: true,
failOnEmptyTestSuite: false | Updated karma timeouts (#<I>) | blackbaud_skyux-builder | train | js |
b6b8b6d0748d80a681a442e1935382083a34cc5f | diff --git a/src/zepto.js b/src/zepto.js
index <HASH>..<HASH> 100644
--- a/src/zepto.js
+++ b/src/zepto.js
@@ -152,7 +152,7 @@ var Zepto = (function() {
return slice.call(el.parentNode.children).filter(function(child){ return child!==el });
})), selector);
},
- empty: function() { return this.each(function() { $(this).children().remove(); })},
+ empty: function(){ return this.each(function(){ this.innerHTML = '' }) },
pluck: function(property){ return this.map(function(element){ return element[property] }) },
show: function(){
return this.each(function() { | clear out with innerHTML, faster | madrobby_zepto | train | js |
9a59ee5f8ccca77e84d5be29a8f3a4c6b71bf803 | diff --git a/django_tenants/migration_executors/base.py b/django_tenants/migration_executors/base.py
index <HASH>..<HASH> 100644
--- a/django_tenants/migration_executors/base.py
+++ b/django_tenants/migration_executors/base.py
@@ -9,8 +9,6 @@ def run_migrations(args, options, schema_name):
from django.core.management.base import OutputWrapper
from django.db import connection
- connection.close()
-
style = color.color_style()
def style_func(msg):
diff --git a/django_tenants/migration_executors/multiproc.py b/django_tenants/migration_executors/multiproc.py
index <HASH>..<HASH> 100644
--- a/django_tenants/migration_executors/multiproc.py
+++ b/django_tenants/migration_executors/multiproc.py
@@ -28,6 +28,13 @@ class MultiprocessingExecutor(MigrationExecutor):
2
)
+ from django.db import connection
+
+ # Let every process make its connection, but don't close the
+ # main connection
+ c = connection.connection
+ connection.connection = None
+
run_migrations_p = functools.partial(
run_migrations,
self.args,
@@ -39,3 +46,6 @@ class MultiprocessingExecutor(MigrationExecutor):
tenants,
chunks
)
+
+ # Revert the original connection
+ connection.connection = c | Executors: fix that cruel connection.close
This made tests fail btw. | tomturner_django-tenants | train | py,py |
01d3841dc9257d19b19ba0f5049fe903f9730ac8 | diff --git a/src/main/java/org/apache/datasketches/hll/HllSketch.java b/src/main/java/org/apache/datasketches/hll/HllSketch.java
index <HASH>..<HASH> 100644
--- a/src/main/java/org/apache/datasketches/hll/HllSketch.java
+++ b/src/main/java/org/apache/datasketches/hll/HllSketch.java
@@ -34,9 +34,10 @@ import org.apache.datasketches.memory.WritableMemory;
/**
* This is a high performance implementation of Phillipe Flajolet’s HLL sketch but with
* significantly improved error behavior. If the ONLY use case for sketching is counting
- * uniques and merging, the HLL sketch is the highest performing in terms of accuracy for
- * storage space consumed. For large enough counts, this HLL version (with HLL_4) can be 2 to
- * 16 times smaller than the Theta sketch family for the same accuracy.
+ * uniques and merging, the HLL sketch the HLL sketch is a reasonable choice, although the highest
+ * performing in terms of accuracy for storage space consumed is CPC (Compressed Probabilistic Counting).
+ * For large enough counts, this HLL version (with HLL_4) can be 2 to 16 times smaller than the
+ * Theta sketch family for the same accuracy.
*
* <p>This implementation offers three different types of HLL sketch, each with different
* trade-offs with accuracy, space and performance. These types are specified with the | update hll documentation
Notes that CPC has better accuracy-per-byte than HLL, while acknowledging that HLL is still a reasonable thing to use. | DataSketches_sketches-core | train | java |
335f0d48cb85451556674735fb5b22100d9adec3 | diff --git a/lib/chef/resource/chef_client_cron.rb b/lib/chef/resource/chef_client_cron.rb
index <HASH>..<HASH> 100644
--- a/lib/chef/resource/chef_client_cron.rb
+++ b/lib/chef/resource/chef_client_cron.rb
@@ -163,7 +163,7 @@ class Chef
end
action :remove do
- cron_d new_resource.job_name do
+ declare_resource(cron_resource_type, new_resource.job_name) do
action :delete
end
end | chef_client_cron: cleanup the appropriate cron job
This makes it so we cleanup the right cron job on Solaris / AIX systems
that don't support cron_d | chef_chef | train | rb |
486d3bd53a3b55bd600a7fac205ca38a0ba999ed | diff --git a/spiketoolkit/validation/metric_calculator.py b/spiketoolkit/validation/metric_calculator.py
index <HASH>..<HASH> 100644
--- a/spiketoolkit/validation/metric_calculator.py
+++ b/spiketoolkit/validation/metric_calculator.py
@@ -43,15 +43,20 @@ class MetricCalculator:
if unit_ids is None:
unit_ids = sorting.get_unit_ids()
-
+
# only use units with spikes to avoid breaking metric calculation
- num_spikes_per_unit = [len(sorting.get_unit_spike_train(u)) for u in unit_ids]
+ num_spikes_per_unit = [len(sorting.get_unit_spike_train(unit_id)) for unit_id in sorting.get_unit_ids()]
sorting = ThresholdCurator(sorting=sorting, metrics_epoch=num_spikes_per_unit)
sorting.threshold_sorting(0, 'less_or_equal')
- unit_ids = sorting.get_unit_ids()
+ if unit_ids is None:
+ unit_ids = sorting.get_unit_ids()
+ else:
+ unit_ids = set(unit_ids)
+ unit_ids = list(unit_ids.intersection(sorting.get_unit_ids()))
+
if len(unit_ids)==0:
- raise ValueError("No spikes found.")
+ raise ValueError("No units found.")
spike_times, spike_clusters = st.validation.validation_tools.get_firing_times_ids(sorting,
self._sampling_frequency) | updated unit ids to work with arbitrary list | SpikeInterface_spiketoolkit | train | py |
8956819bb9179192bb412e0e013ca30052362e81 | diff --git a/benchexec/containerexecutor.py b/benchexec/containerexecutor.py
index <HASH>..<HASH> 100644
--- a/benchexec/containerexecutor.py
+++ b/benchexec/containerexecutor.py
@@ -121,10 +121,13 @@ def handle_basic_container_args(options, parser=None):
"host lookups will fail despite --network-access. "
"Consider using --keep-system-config.")
else:
+ # /etc/resolv.conf is necessary for DNS lookups and on many systems is a symlink
+ # to either /run/resolvconf/resolv.conf or /run/systemd/resolve/sub-resolve.conf,
+ # so we keep that directory accessible as well.
if not "/run/resolvconf" in dir_modes and os.path.isdir("/run/resolvconf"):
- # /etc/resolv.conf is necessary for DNS lookups and on many systems is a symlink
- # to /run/resolvconf/resolv.conf, so we keep that directory accessible as well.
dir_modes["/run/resolvconf"] = DIR_READ_ONLY
+ if not "/run/systemd/resolve" in dir_modes and os.path.isdir("/run/systemd/resolve"):
+ dir_modes["/run/systemd/resolve"] = DIR_READ_ONLY
return {
'network_access': options.network_access, | Keep /run/systemd/resolve visible if it exists and --keep-system-config is used.
On systems with systemd-resolved, /etc/resolv.conf is a symlink to a
file in this directory, so if it is hidden, DNS lookups do not work. | sosy-lab_benchexec | train | py |
73d730210428af4941b19061ae22ec178e4af3a9 | diff --git a/tests/Imgix/Tests/UrlBuilderTest.php b/tests/Imgix/Tests/UrlBuilderTest.php
index <HASH>..<HASH> 100644
--- a/tests/Imgix/Tests/UrlBuilderTest.php
+++ b/tests/Imgix/Tests/UrlBuilderTest.php
@@ -597,4 +597,3 @@ https://demos.imgix.net/image.jpg?ixlib=php-3.3.1&w=535 535w';
}
}
-?> | Remove from UrlBuilderTest closing php useless | imgix_imgix-php | train | php |
952570d88760dca7e2a1273c3ac8e0ded980a9ba | diff --git a/lib/index.js b/lib/index.js
index <HASH>..<HASH> 100644
--- a/lib/index.js
+++ b/lib/index.js
@@ -160,7 +160,7 @@ util.inherits(Client, events.EventEmitter);
var requestMethod = instanceMethod.toUpperCase();
var data = body;
var statusCode = response && response.statusCode || err && err.code || 'unknown';
- this.emit('response', und.extend({statusCode: statusCode, duration: requestDuration, method: requestMethod}, und.pick(originalArgs, ['url'])));
+ this.emit('response', und.extend({params: params, statusCode: statusCode, duration: requestDuration, method: requestMethod}, und.pick(originalArgs, ['url'])));
// attempt deserialization | adding params to response event callback | shutterstock_armrest | train | js |
1cda4d65fc5cf8c276f1d202e136b9e8cdf66702 | diff --git a/src/pydocstyle/checker.py b/src/pydocstyle/checker.py
index <HASH>..<HASH> 100644
--- a/src/pydocstyle/checker.py
+++ b/src/pydocstyle/checker.py
@@ -520,7 +520,6 @@ class ConventionChecker(object):
else:
yield violations.D414(section_name)
-
@classmethod
def _check_section(cls, docstring, definition, context):
"""D4{05,06,10,11,13}, D214: Section name checks. | #<I> - Great shame upon my family | PyCQA_pydocstyle | train | py |
1715cbd5defc283f2d71bdb1545c33d0fa4aac72 | diff --git a/command/forceleave/forceleave.go b/command/forceleave/forceleave.go
index <HASH>..<HASH> 100644
--- a/command/forceleave/forceleave.go
+++ b/command/forceleave/forceleave.go
@@ -25,8 +25,7 @@ func (c *cmd) init() {
c.flags = flag.NewFlagSet("", flag.ContinueOnError)
c.http = &flags.HTTPFlags{}
flags.Merge(c.flags, c.http.ClientFlags())
- flags.Merge(c.flags, c.http.ServerFlags())
- c.help = flags.Usage(help, c.flags, c.http.ClientFlags(), c.http.ServerFlags())
+ c.help = flags.Usage(help, c.flags, c.http.ClientFlags(), nil)
}
func (c *cmd) Run(args []string) int { | commands: drop http server flags from force-leave command | hashicorp_consul | train | go |
0962621325ef4fcdf77ff9de9ed743da13c1118e | diff --git a/nfc/clf/pn53x.py b/nfc/clf/pn53x.py
index <HASH>..<HASH> 100644
--- a/nfc/clf/pn53x.py
+++ b/nfc/clf/pn53x.py
@@ -164,7 +164,6 @@ class Chipset(object):
error was received.
"""
- # Send a chip command and return the response.
assert len(cmd_data) <= self.host_command_frame_max_size - 2
self.log.log(logging.DEBUG-1, self.CMD[cmd_code]+" "+hexlify(cmd_data)) | removed comment that is now captured as docstring | nfcpy_nfcpy | train | py |
b193fc99039be9fde70ae9b1a816bdcd20bd780f | diff --git a/src/tooltip.js b/src/tooltip.js
index <HASH>..<HASH> 100644
--- a/src/tooltip.js
+++ b/src/tooltip.js
@@ -4,8 +4,7 @@
vizwhiz.tooltip.create = function(data) {
- var tooltip_width = 200,
- window_width = parseInt(data.svg.attr("width"),10),
+ var window_width = parseInt(data.svg.attr("width"),10),
padding = 10,
triangle_size = 20,
stroke_width = 2
@@ -13,6 +12,9 @@ vizwhiz.tooltip.create = function(data) {
if (data.arrow) var triangle_size = 20
else var triangle_size = 0
+ if (data.width) var tooltip_width = data.width
+ else var tooltip_width = 200
+
var group = data.svg.append("g")
.attr("class","vizwhiz_tooltip") | added the ability to change the tooltip width on creation | alexandersimoes_d3plus | train | js |
1e574d09de70af3b8d15cbd1d8ecde19af9e5c85 | diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -29,10 +29,14 @@ else:
if hasattr(pip, '__version__') and LooseVersion(pip.__version__) >= LooseVersion('6.0.0'):
from pip.req import parse_requirements
else:
- from pip.req import parse_requirements as parse_requirements_
+ class FakeReq(object):
+ link = None
+
+ def __init__(self, req):
+ self.req = req
def parse_requirements(reqs_path, *args, **kwargs):
- return parse_requirements_(reqs_path)
+ return [line.strip() for line in open(reqs_path).readlines()]
def first_path_exist(paths): | Common pip < <I> support. | Nekmo_simple-monitor-alert | train | py |
d6ea072ccc75c42030a1b8a380d7bbf32b6e1e52 | diff --git a/src/main/java/org/jboss/netty/handler/codec/http/MixedFileUpload.java b/src/main/java/org/jboss/netty/handler/codec/http/MixedFileUpload.java
index <HASH>..<HASH> 100644
--- a/src/main/java/org/jboss/netty/handler/codec/http/MixedFileUpload.java
+++ b/src/main/java/org/jboss/netty/handler/codec/http/MixedFileUpload.java
@@ -62,8 +62,10 @@ public class MixedFileUpload implements FileUpload {
.getContentType(), fileUpload
.getContentTransferEncoding(), fileUpload.getCharset(),
definedSize);
- diskFileUpload.addContent(((MemoryFileUpload) fileUpload)
+ if (((MemoryFileUpload) fileUpload).getChannelBuffer() != null){
+ diskFileUpload.addContent(((MemoryFileUpload) fileUpload)
.getChannelBuffer(), last);
+ }
fileUpload = diskFileUpload;
}
} | Fix NPE when non chunked message with a large variable | netty_netty | train | java |
f3f76e72c7d610759097921405e88782a19129fe | diff --git a/secure_smtpd/smtp_server.py b/secure_smtpd/smtp_server.py
index <HASH>..<HASH> 100644
--- a/secure_smtpd/smtp_server.py
+++ b/secure_smtpd/smtp_server.py
@@ -34,6 +34,7 @@ class SMTPServer(smtpd.SMTPServer):
def _accept_subprocess(self, queue):
while True:
try:
+ newsocket = None
self.socket.setblocking(1)
pair = self.accept()
map = {}
@@ -71,7 +72,8 @@ class SMTPServer(smtpd.SMTPServer):
self._shutdown_socket(newsocket)
self.logger.info('_accept_subprocess(): smtp channel terminated asyncore.')
except Exception as e:
- self._shutdown_socket(newsocket)
+ if newsocket is not None:
+ self._shutdown_socket(newsocket)
self.logger.error('_accept_subprocess(): uncaught exception: %s' % str(e))
def _shutdown_socket(self, s): | fix: crasher if waiting for accept (#<I>) | bcoe_secure-smtpd | train | py |
400fb01ddd7673743c1cf47f175e905983e575f3 | diff --git a/state/payloads_test.go b/state/payloads_test.go
index <HASH>..<HASH> 100644
--- a/state/payloads_test.go
+++ b/state/payloads_test.go
@@ -163,12 +163,20 @@ func (s *unitPayloadsSuite) TestFunctional(c *gc.C) {
},
}})
- // Ensure duplicates are a noop.
- err = st.Track(pl)
+ // Ensure existing ones are replaced.
+ update := pl
+ update.ID = "abc"
+ err = st.Track(update)
c.Check(err, jc.ErrorIsNil)
results, err = st.List()
c.Assert(err, jc.ErrorIsNil)
- c.Check(results, gc.HasLen, 1)
+ c.Check(results, jc.DeepEquals, []payload.Result{{
+ ID: id,
+ Payload: &payload.FullPayloadInfo{
+ Payload: update,
+ Machine: machine,
+ },
+ }})
err = st.Untrack(id)
c.Assert(err, jc.ErrorIsNil) | Test more specifically that replacements work. | juju_juju | train | go |
cecfc910b865abffd97d98fad317e950e7ac2b05 | diff --git a/tests/test_valid_edtf.py b/tests/test_valid_edtf.py
index <HASH>..<HASH> 100644
--- a/tests/test_valid_edtf.py
+++ b/tests/test_valid_edtf.py
@@ -273,6 +273,8 @@ invalid_edtf_intervals = [
'2004-06-11%/2004-%06',
'2004-06-11%/2004-06~',
'2005-07-25T10:10:10Z/2006-01-01T10:10:10Z',
+ '2005-07-25T10:10:10Z/2006-01',
+ '2005-07-25/2006-01-01T10:10:10Z',
]
invalid_edtf_datetimes = [ | Add a couple more tests to check valueError in to and from of date interval | unt-libraries_edtf-validate | train | py |
f5537b4845e6148ef77c1f563d95ada62d35f337 | diff --git a/lib/formalist/elements/standard/multi_upload_field.rb b/lib/formalist/elements/standard/multi_upload_field.rb
index <HASH>..<HASH> 100644
--- a/lib/formalist/elements/standard/multi_upload_field.rb
+++ b/lib/formalist/elements/standard/multi_upload_field.rb
@@ -6,6 +6,7 @@ module Formalist
class Elements
class MultiUploadField < Field
attribute :presign_url, Types::String
+ attribute :render_uploaded_as, Types::String
end
register :multi_upload_field, MultiUploadField
diff --git a/lib/formalist/elements/standard/upload_field.rb b/lib/formalist/elements/standard/upload_field.rb
index <HASH>..<HASH> 100644
--- a/lib/formalist/elements/standard/upload_field.rb
+++ b/lib/formalist/elements/standard/upload_field.rb
@@ -6,6 +6,7 @@ module Formalist
class Elements
class UploadField < Field
attribute :presign_url, Types::String
+ attribute :render_uploaded_as, Types::String
end
register :upload_field, UploadField | Add `render_uploaded_as` attribute to the upload fields. | team-formalist_formalist-rb | train | rb,rb |
f35497e132c5f17dc24e4d92b8f4a65c39df8478 | diff --git a/src/Local/Toolstack/ToolstackBase.php b/src/Local/Toolstack/ToolstackBase.php
index <HASH>..<HASH> 100644
--- a/src/Local/Toolstack/ToolstackBase.php
+++ b/src/Local/Toolstack/ToolstackBase.php
@@ -301,8 +301,7 @@ abstract class ToolstackBase implements ToolstackInterface
$targetRelative = $sharedDirRelative . '/' . $sharedPath;
$link = $this->buildDir . '/' . $appPath;
if (file_exists($link) && !is_link($link)) {
- $this->output->writeln(' Failed to symlink <comment>' . $appPath . '</comment> to <comment>' . $targetRelative . '</comment> (the source already exists in the build)');
- continue;
+ $this->output->writeln(' Overwriting existing file <comment>' . $appPath . '</comment>');
}
if (!file_exists($target)) {
$this->fsHelper->mkdir($target, 0775); | Allow overwriting files with shared file mount symlinks | platformsh_platformsh-cli | train | php |
3f70d7a44a1cbbeebf942b54bd3b50cc69e5f22d | diff --git a/rockstar/RockStar.py b/rockstar/RockStar.py
index <HASH>..<HASH> 100644
--- a/rockstar/RockStar.py
+++ b/rockstar/RockStar.py
@@ -73,10 +73,10 @@ class RockStar:
def dates():
today = date.today()
for day_delta in range(self.days):
+ day = today - timedelta(days=day_delta)
+ if day.strftime('%A') in self.days_off:
+ continue
for i in range(randint(1, 10)):
- day = today - timedelta(days=day_delta)
- if day.strftime('%A') in self.days_off:
- continue
yield day
return [datetime.combine(d, self._get_random_time())
for d in dates()] | Update rockstar
Move the `days_off` condition outside `for` loop, since we can check
before generating `N` times for day | avinassh_rockstar | train | py |
78ad437f5856ef9105dc770bb6633daf274a5163 | diff --git a/rootpy/core.py b/rootpy/core.py
index <HASH>..<HASH> 100644
--- a/rootpy/core.py
+++ b/rootpy/core.py
@@ -139,6 +139,16 @@ class Object(object):
clone._post_init(**kwargs)
return clone
+ @property
+ def name(self):
+
+ return self.GetName()
+
+ @property
+ def title(self):
+
+ return self.GetTitle()
+
def __copy__(self):
return self.Clone() | name and title properties for Objects | rootpy_rootpy | train | py |
598bb5b5256a7ded6103772c551d8b9fa8a7f194 | diff --git a/app/Http/RequestHandlers/MapDataImportAction.php b/app/Http/RequestHandlers/MapDataImportAction.php
index <HASH>..<HASH> 100644
--- a/app/Http/RequestHandlers/MapDataImportAction.php
+++ b/app/Http/RequestHandlers/MapDataImportAction.php
@@ -58,6 +58,18 @@ use const UPLOAD_ERR_OK;
*/
class MapDataImportAction implements RequestHandlerInterface
{
+ private MapDataService $map_data_service;
+
+ /**
+ * MapDataImportAction constructor.
+ *
+ * @param MapDataService $map_data_service
+ */
+ public function __construct(MapDataService $map_data_service)
+ {
+ $this->map_data_service = $map_data_service;
+ }
+
/**
* This function assumes the input file layout is
* level followed by a variable number of placename fields
@@ -148,6 +160,9 @@ class MapDataImportAction implements RequestHandlerInterface
DB::table('place_location')
->whereNull('parent_id')
->delete();
+
+ // Automatically import any new/missing places.
+ $this->map_data_service->importMissingLocations();
}
$added = 0; | Fix: #<I> - delete-all option broken when importing co-ordinates | fisharebest_webtrees | train | php |
e18dced49393ea89cdf632620d9398cd533e48eb | diff --git a/hyperv/__init__.py b/hyperv/__init__.py
index <HASH>..<HASH> 100644
--- a/hyperv/__init__.py
+++ b/hyperv/__init__.py
@@ -0,0 +1,15 @@
+# Copyright (c) 2016 Cloudbase Solutions Srl
+#
+# 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
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+__import__('pkg_resources').declare_namespace(__name__) | Declare hyperv namespace
Both compute-hyperv and networking-hyperv projects use the 'hyperv'
namespace, but this is not declared in networking-hyperv.
This causes import errors if the projects are not installed in the
same place.
Change-Id: I<I>dff7a<I>a8ba4c3daa<I>e<I>a<I> | openstack_networking-hyperv | train | py |
a945fa8d67adb4f2fa9e6e9cabb6bf2e9003e62a | diff --git a/astor/rtrip.py b/astor/rtrip.py
index <HASH>..<HASH> 100755
--- a/astor/rtrip.py
+++ b/astor/rtrip.py
@@ -86,6 +86,7 @@ dsttree = 'tmp_rtrip'
# TODO: Remove this workaround once we remove version 2 support
+
def out_prep(s, pre_encoded=(sys.version_info[0] == 2)):
return s if pre_encoded else s.encode('utf-8') | Fix rtrip PEP8 issue | berkerpeksag_astor | train | py |
7a1cfbd6131abae0e055fd07ca2117300ffa8e89 | diff --git a/src/Illuminate/Broadcasting/Broadcasters/PusherBroadcaster.php b/src/Illuminate/Broadcasting/Broadcasters/PusherBroadcaster.php
index <HASH>..<HASH> 100644
--- a/src/Illuminate/Broadcasting/Broadcasters/PusherBroadcaster.php
+++ b/src/Illuminate/Broadcasting/Broadcasters/PusherBroadcaster.php
@@ -32,4 +32,14 @@ class PusherBroadcaster implements Broadcaster
{
$this->pusher->trigger($channels, $event, $payload);
}
+
+ /**
+ * Get the Pusher SDK instance.
+ *
+ * @return \Pusher
+ */
+ public function getPusher()
+ {
+ return $this->pusher;
+ }
} | Added ability to use Pusher SDK
Pusher SDK doesn't only have a trigger method.
There are another methods that can be useful like `get_channel_info` and `get_channels`. | laravel_framework | train | php |
e7e8856d243e6e0558c70b6a7a4cc195653d42f3 | diff --git a/stagpy/processing.py b/stagpy/processing.py
index <HASH>..<HASH> 100644
--- a/stagpy/processing.py
+++ b/stagpy/processing.py
@@ -10,8 +10,8 @@ def dt_dt(sdat, tstart=None, tend=None):
tseries = sdat.tseries_between(tstart, tend)
time = tseries['t'].values
temp = tseries['Tmean'].values
- dtdt = (temp[2:] - temp[:-2]) / (time[2:] - time[:-2])
- return dtdt, time[1:-1]
+ dtdt = (temp[1:] - temp[:-1]) / (time[1:] - time[:-1])
+ return dtdt, time[:-1]
def ebalance(sdat, tstart=None, tend=None):
@@ -27,7 +27,7 @@ def ebalance(sdat, tstart=None, tend=None):
dtdt, time = dt_dt(sdat, tstart, tend)
ftop = tseries['ftop'].values * coefsurf
fbot = tseries['fbot'].values
- ebal = ftop[1:-1] - fbot[1:-1] - volume * dtdt
+ ebal = ftop[:-1] - fbot[:-1] - volume * dtdt
return ebal, time | Use first order t-derivative to compute ebalance
StagYY uses a first order Euler scheme to transport heat, dt_dt (used by
ebalance) was computed using a second order scheme. | StagPython_StagPy | train | py |
a76ab03263e9fe3e0a82acd44c63e86d853c7eb7 | diff --git a/safe_qgis/utilities.py b/safe_qgis/utilities.py
index <HASH>..<HASH> 100644
--- a/safe_qgis/utilities.py
+++ b/safe_qgis/utilities.py
@@ -540,7 +540,7 @@ class QgsLogHandler(logging.Handler):
# like line number etc. you can get from the log message.
QgsMessageLog.logMessage(theRecord.getMessage(), 'InaSAFE', 0)
- except MethodUnavailableError:
+ except (MethodUnavailableError, ImportError):
pass | Added ImportError to exceptions caught in case QgsMessageLog is unavailable. Otherwise, this failed on my home installation using QGIS <I>. See issue #<I> | inasafe_inasafe | train | py |
c4f55b22e4e0a284b3a3203b2b6bafa44ed3e877 | diff --git a/google/Sender.js b/google/Sender.js
index <HASH>..<HASH> 100644
--- a/google/Sender.js
+++ b/google/Sender.js
@@ -125,7 +125,7 @@ Sender.prototype._send = function (json) {
if (this.draining) {
this.queued.push(json);
} else {
- var message = new xmpp.Stanza.Element('message').c('gcm', {xmlns: 'google:mobile:data'}).t(JSON.stringify(json));
+ var message = new xmpp.Message().c('gcm', {xmlns: 'google:mobile:data'}).t(JSON.stringify(json));
this.client.send(message);
}
}; | Changed xmpp.Stanza.Element to xmpp.Message because it was throwing function not defined error | guness_node-xcs | train | js |
4ab2acec8d1f29bfbbf1615e1a22cf6e16985459 | diff --git a/validator/sawtooth_validator/metrics/wrappers.py b/validator/sawtooth_validator/metrics/wrappers.py
index <HASH>..<HASH> 100644
--- a/validator/sawtooth_validator/metrics/wrappers.py
+++ b/validator/sawtooth_validator/metrics/wrappers.py
@@ -40,9 +40,9 @@ class CounterWrapper():
def __init__(self, counter=None):
self._counter = counter
- def inc(self):
+ def inc(self, val=1):
if self._counter:
- self._counter.inc()
+ self._counter.inc(val)
class NoopTimerContext(): | Make metrics CounterWrapper support increment by value | hyperledger_sawtooth-core | train | py |
f70f855182e0c0cec96716b603256ae56c16c517 | diff --git a/src/main/java/org/lightcouch/CouchDbClientBase.java b/src/main/java/org/lightcouch/CouchDbClientBase.java
index <HASH>..<HASH> 100644
--- a/src/main/java/org/lightcouch/CouchDbClientBase.java
+++ b/src/main/java/org/lightcouch/CouchDbClientBase.java
@@ -1,3 +1,20 @@
+/*
+ * Copyright (C) 2011 lightcouch.org
+ *
+ * Modifications for this distribution by IBM Cloudant, Copyright (c) 2015 IBM Corp.
+ *
+ * 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
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package org.lightcouch;
import static org.lightcouch.internal.CouchDbUtil.assertNotEmpty; | Reinstate copyright header for CouchDBClientBase
Reinstate copyright header for CouchDBClientBase, with note of modification by IBM | cloudant_java-cloudant | train | java |
0f529b9792c21e16dffbe90b549dcee5cc98d9f5 | diff --git a/upload/catalog/controller/common/seo_url.php b/upload/catalog/controller/common/seo_url.php
index <HASH>..<HASH> 100644
--- a/upload/catalog/controller/common/seo_url.php
+++ b/upload/catalog/controller/common/seo_url.php
@@ -9,6 +9,7 @@ class ControllerCommonSeoUrl extends Controller {
// Decode URL
if (isset($this->request->get['_route_'])) {
$parts = explode('/', $this->request->get['_route_']);
+ if (strlen(end($parts))==0) array_pop($parts); // rmove any empty arrays from trailing /
foreach ($parts as $part) {
$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "url_alias WHERE keyword = '" . $this->db->escape($part) . "'");
@@ -112,4 +113,4 @@ class ControllerCommonSeoUrl extends Controller {
}
}
}
-?>
\ No newline at end of file
+?> | Update upload/catalog/controller/common/seo_url.php
// rmove any empty arrays from trailing / | opencart_opencart | train | php |
9b4379b17dbd5cf626b584a4658fcdb63477f6dc | diff --git a/lib/Cake/Routing/Router.php b/lib/Cake/Routing/Router.php
index <HASH>..<HASH> 100644
--- a/lib/Cake/Routing/Router.php
+++ b/lib/Cake/Routing/Router.php
@@ -355,9 +355,8 @@ class Router {
break;
}
}
- if (isset($defaults['prefix'])) {
+ if (isset($defaults['prefix']) && !in_array($defaults['prefix'], self::$_prefixes)) {
self::$_prefixes[] = $defaults['prefix'];
- self::$_prefixes = array_keys(array_flip(self::$_prefixes));
}
$defaults += array('plugin' => null);
if (empty($options['action'])) { | Simplified way to add new prefixes to the router | cakephp_cakephp | train | php |
c8dfa3cee2dbb823876a83bbd45849b6f1b0c6c4 | diff --git a/dpark/job.py b/dpark/job.py
index <HASH>..<HASH> 100644
--- a/dpark/job.py
+++ b/dpark/job.py
@@ -42,7 +42,7 @@ class Job:
return cls.nextJobId
LOCALITY_WAIT = 0
-WAIT_FOR_RUNNING = 15
+WAIT_FOR_RUNNING = 10
MAX_TASK_FAILURES = 4
MAX_TASK_MEMORY = 15 << 10 # 15GB
@@ -278,6 +278,7 @@ class SimpleJob(Job):
logger.warning("task %d timeout %.1f (at %s), re-assign it",
task.id, now - task.start, task.host)
self.launched[i] = False
+ self.blacklist[i].append(task.host)
self.tasksLaunched -= 1
if self.tasksFinished > self.numTasks / 3: | add non-responsable slaves into blacklist | douban_dpark | train | py |
ecffc9d43577f9e7abba94e3aca649d877a924bd | diff --git a/djohno/middleware.py b/djohno/middleware.py
index <HASH>..<HASH> 100644
--- a/djohno/middleware.py
+++ b/djohno/middleware.py
@@ -17,8 +17,6 @@ def replace_insensitive(string, target, replacement):
class DjohnoMiddleware(object):
- tag = '</body>'
-
def get_djohno(self):
return render_to_string('djohno/_djohno_dose.html',
{'STATIC_URL': settings.STATIC_URL})
@@ -48,10 +46,12 @@ class DjohnoMiddleware(object):
if not self.should_process_response(request, response):
return response
+ tag = '</body>'
+
response.content = replace_insensitive(
smart_unicode(response.content),
- self.tag,
- smart_unicode(self.get_djohno() + self.tag)
+ tag,
+ smart_unicode(self.get_djohno() + tag)
)
if 'Content-Length' in response: | tag doesn't need to be a member of DjohnoMiddleware | dominicrodger_djohno | train | py |
e4e68b7183538f977325a11d5cc6cce9e6b81edc | diff --git a/hotdoc/core/tree.py b/hotdoc/core/tree.py
index <HASH>..<HASH> 100644
--- a/hotdoc/core/tree.py
+++ b/hotdoc/core/tree.py
@@ -543,7 +543,7 @@ class Tree:
if len(split) == 2:
contents = split[1]
try:
- blocks = yaml.load_all(split[0])
+ blocks = yaml.load_all(split[0], Loader=yaml.FullLoader)
for block in blocks:
if block:
meta.update(block)
diff --git a/hotdoc/parsers/gtk_doc.py b/hotdoc/parsers/gtk_doc.py
index <HASH>..<HASH> 100644
--- a/hotdoc/parsers/gtk_doc.py
+++ b/hotdoc/parsers/gtk_doc.py
@@ -271,7 +271,7 @@ class GtkDocParser:
def __parse_yaml_comment(self, comment, filename):
res = {}
try:
- blocks = yaml.load_all(comment.raw_comment)
+ blocks = yaml.load_all(comment.raw_comment, Loader=yaml.SafeLoader)
for block in blocks:
if block:
res.update(block) | Avoid using deprecated and unsafe yaml loader | hotdoc_hotdoc | train | py,py |
295918ac2cb6a1f3a0a663e31ed4b5e5b3e835c0 | diff --git a/src/resources/views/print.blade.php b/src/resources/views/print.blade.php
index <HASH>..<HASH> 100644
--- a/src/resources/views/print.blade.php
+++ b/src/resources/views/print.blade.php
@@ -15,7 +15,7 @@
<body>
<table class="table table-bordered table-condensed table-striped">
@foreach($data as $row)
- @if ($row == reset($data))
+ @if ($loop->first)
<tr>
@foreach($row as $key => $value)
<th>{!! $key !!}</th> | Use Blade's helper to check for the first row | yajra_laravel-datatables-buttons | train | php |
d47a0133f10485dc3cf797efed9b84de3a7d445d | diff --git a/pyrogram/__init__.py b/pyrogram/__init__.py
index <HASH>..<HASH> 100644
--- a/pyrogram/__init__.py
+++ b/pyrogram/__init__.py
@@ -16,7 +16,7 @@
# You should have received a copy of the GNU Lesser General Public License
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
-__version__ = "1.1.0"
+__version__ = "1.1.1"
__license__ = "GNU Lesser General Public License v3 or later (LGPLv3+)"
__copyright__ = "Copyright (C) 2017-2020 Dan <https://github.com/delivrance>" | Update Pyrogram to <I> | pyrogram_pyrogram | train | py |
de1e2ed728db744335fe825e003456a90601639b | diff --git a/test/model_test.js b/test/model_test.js
index <HASH>..<HASH> 100644
--- a/test/model_test.js
+++ b/test/model_test.js
@@ -10,7 +10,7 @@ describe('Seraph Model', function() {
var neo;
var db;
before(function(done) {
- seraph({ version: "2.3.1" }, function(err, _db, _neo) {
+ seraph({ version: "3.0.3" }, function(err, _db, _neo) {
if (err) return done(err);
db = _db;
neo = _neo;
@@ -360,7 +360,7 @@ describe('Seraph Model', function() {
beer.findAll({
include: {hop: { model: hop, rel: 'hopped_with', direction: 'out' }}
}, function(err, nodes) {
- assert(!err);
+ assert(!err, err && err.message);
assert(nodes.length == 2);
assert(nodes[0].hop.name == 'centennial');
assert(nodes[1].hop.name == 'centennial'); | neo4j 3: bump test version | brikteknologier_seraph-model | train | js |
a43fd26a6c6a2d875c1deab4eeeddfa65e0128cb | diff --git a/install/js/api.js b/install/js/api.js
index <HASH>..<HASH> 100644
--- a/install/js/api.js
+++ b/install/js/api.js
@@ -304,7 +304,7 @@ TaoInstall.prototype.getValidator = function(element, options){
case 'email':
element.isValid = function(){
- var reg = new RegExp("^[a-zA-Z0-9\-_]+[a-zA-Z0-9\.\-_]*@[a-zA-Z0-9\-_]+\.[a-zA-Z\.\-_]{1,}[a-zA-Z\-_]+", "i");
+ var reg = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/i;
if (mandatory == false && $element[0].getData() == null){
return true; | email validation was not restrictive enough.
git-svn-id: <URL> | oat-sa_tao-core | train | js |
f2ef8398dc8e9854c152b9ec041e4dc7f684ecb1 | diff --git a/rocketchat_API/rocketchat.py b/rocketchat_API/rocketchat.py
index <HASH>..<HASH> 100644
--- a/rocketchat_API/rocketchat.py
+++ b/rocketchat_API/rocketchat.py
@@ -221,9 +221,14 @@ class RocketChat:
"""Removes the role of moderator from a user in the current channel."""
return self.__call_api_post('channels.removeModerator', roomId=room_id, userId=user_id, kwargs=kwargs)
- def channels_add_owner(self, room_id, user_id, **kwargs):
+ def channels_add_owner(self, room_id, user_id=None, username=None, **kwargs):
"""Gives the role of owner for a user in the current channel."""
- return self.__call_api_post('channels.addOwner', roomId=room_id, userId=user_id, kwargs=kwargs)
+ if user_id:
+ return self.__call_api_post('channels.addOwner', roomId=room_id, userId=user_id, kwargs=kwargs)
+ elif username:
+ return self.__call_api_post('channels.addOwner', roomId=room_id, username=username, kwargs=kwargs)
+ else:
+ raise RocketMissingParamException('userID or username required')
def channels_remove_owner(self, room_id, user_id, **kwargs):
"""Removes the role of owner from a user in the current channel.""" | add owner can be called with username too | jadolg_rocketchat_API | train | py |
162c3a45034fb6008d43a700b50b1eb756052156 | diff --git a/salt/config/__init__.py b/salt/config/__init__.py
index <HASH>..<HASH> 100644
--- a/salt/config/__init__.py
+++ b/salt/config/__init__.py
@@ -2852,7 +2852,7 @@ def is_profile_configured(opts, provider, profile_name, vm_=None):
non_size_drivers.append('linode')
# If cloning on VMware, specifying image is not necessary.
- if driver == 'vmware' and profile_key.get('image', True):
+ if driver == 'vmware' and profile_key.get('clonefrom', False):
non_image_drivers.append('vmware')
if driver not in non_image_drivers: | Fix for clonefrom/image settings | saltstack_salt | train | py |
a34003e06c344e18c431b86608d85a8ccb68e952 | diff --git a/cartoframes/context.py b/cartoframes/context.py
index <HASH>..<HASH> 100644
--- a/cartoframes/context.py
+++ b/cartoframes/context.py
@@ -749,7 +749,12 @@ class CartoContext(object):
ax.axis('off')
return ax
else:
- return IPython.display.HTML(html)
+ return IPython.display.Image(url=static_url,
+ embed=True,
+ format='png',
+ width=size[0],
+ height=size[1],
+ metadata=dict(origin_url=static_url))
def data_boundaries(self, df=None, table_name=None):
"""Not currently implemented""" | moves non matplotlib to be embedded in notebook | CartoDB_cartoframes | train | py |
Subsets and Splits