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 |
|---|---|---|---|---|---|
488fb3cf05fb07f01d47fbd3712d761379e1e5d0 | diff --git a/PBB_Core.py b/PBB_Core.py
index <HASH>..<HASH> 100755
--- a/PBB_Core.py
+++ b/PBB_Core.py
@@ -2253,13 +2253,13 @@ class MergeError(Exception):
class FormatterWithHeader(logging.Formatter):
# http://stackoverflow.com/questions/33468174/write-header-to-a-python-log-file-but-only-if-a-record-gets-written
def __init__(self, header, **kwargs):
- super().__init__(**kwargs)
+ super(FormatterWithHeader, self).__init__(**kwargs)
self.header = header
# Override the normal format method
self.format = self.first_line_format
def first_line_format(self, record):
# First time in, switch back to the normal format function
- self.format = super().format
+ self.format = super(FormatterWithHeader, self).format
return self.header + "\n" + self.format(record) | made superclass calls Python<I> compatible | SuLab_WikidataIntegrator | train | py |
18ba112872242d0da50f82e95e78d254f0c1baf4 | diff --git a/moco-core/src/main/java/com/github/dreamhead/moco/resource/ResourceConfigApplierFactory.java b/moco-core/src/main/java/com/github/dreamhead/moco/resource/ResourceConfigApplierFactory.java
index <HASH>..<HASH> 100644
--- a/moco-core/src/main/java/com/github/dreamhead/moco/resource/ResourceConfigApplierFactory.java
+++ b/moco-core/src/main/java/com/github/dreamhead/moco/resource/ResourceConfigApplierFactory.java
@@ -67,7 +67,7 @@ public final class ResourceConfigApplierFactory {
}
private abstract static class SelfResourceConfigApplier extends BaseResourceConfigApplier {
- private String id;
+ private final String id;
private SelfResourceConfigApplier(final String id) {
this.id = id;
@@ -80,7 +80,7 @@ public final class ResourceConfigApplierFactory {
}
private abstract static class EmbeddedResourceConfigApplier extends BaseResourceConfigApplier {
- private Resource resource;
+ private final Resource resource;
private EmbeddedResourceConfigApplier(final Resource resource) {
this.resource = resource; | added missing final to resource config applier factory | dreamhead_moco | train | java |
47056d0ede56ebb95b248da1ee91920cfaf67aa1 | diff --git a/okdownload/src/test/java/com/liulishuo/okdownload/core/file/DownloadUriOutputStreamTest.java b/okdownload/src/test/java/com/liulishuo/okdownload/core/file/DownloadUriOutputStreamTest.java
index <HASH>..<HASH> 100644
--- a/okdownload/src/test/java/com/liulishuo/okdownload/core/file/DownloadUriOutputStreamTest.java
+++ b/okdownload/src/test/java/com/liulishuo/okdownload/core/file/DownloadUriOutputStreamTest.java
@@ -152,8 +152,8 @@ public class DownloadUriOutputStreamTest {
when(pdf.getFileDescriptor()).thenReturn(fd);
final File file = new File("/test");
- DownloadUriOutputStream outputStream = (DownloadUriOutputStream) new DownloadUriOutputStream.Factory()
- .create(context, file, 1);
+ DownloadUriOutputStream outputStream = (DownloadUriOutputStream) new DownloadUriOutputStream
+ .Factory().create(context, file, 1);
assertThat(outputStream.pdf).isEqualTo(pdf);
assertThat(outputStream.out).isNotNull();
assertThat(outputStream.fos.getFD()).isEqualTo(fd); | chore: fix stylecheck issue on download-uri-output-stream | lingochamp_okdownload | train | java |
fcfeb205089a5538db76e260db8fa71aea3cb5f0 | diff --git a/pods/testing/datasets_tests.py b/pods/testing/datasets_tests.py
index <HASH>..<HASH> 100644
--- a/pods/testing/datasets_tests.py
+++ b/pods/testing/datasets_tests.py
@@ -17,6 +17,8 @@ dataset_helpers = [
"download_rogers_girolami_data",
"downloard_url",
"datenum",
+ "date2num",
+ "num2date",
"datetime64_",
"data_details_return",
"download_data",
@@ -30,7 +32,6 @@ dataset_helpers = [
"cmu_urls_files",
"kepler_telescope_urls_files",
"kepler_telescope",
- "datenum",
"decimalyear",
"permute",
"categorical",
diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -17,11 +17,11 @@ from setuptools import find_packages, setup, Command
# Package meta-data.
NAME = "pods"
DESCRIPTION = "Python software for Open Data Science"
-URL = "https://github.com/lawrennd/ods"
+URL = "https://github.com/sods/ods"
EMAIL = "lawrennd@gmail.com"
AUTHOR = "Neil D. Lawrence"
REQUIRES_PYTHON = ">=3.6.0"
-VERSION = "v0.0.21-alpha"
+VERSION = "v0.0.31a0"
# What packages are required for this module to be executed?
REQUIRED = [ | Update ready for pypi release. | sods_ods | train | py,py |
c15d8260ea3f3bf782b254006fd6d418feffe1f9 | diff --git a/test/test_svtyper.py b/test/test_svtyper.py
index <HASH>..<HASH> 100644
--- a/test/test_svtyper.py
+++ b/test/test_svtyper.py
@@ -44,7 +44,7 @@ class TestCigarParsing(TestCase):
self.assertEqual(get_end_diagonal(split_piece), 34 - (2 + 8))
split_piece2 = SplitRead.SplitPiece(1, 25, False, cigarstring_to_tuple(cigar_string), 60)
split_piece2.set_reference_end(34)
- self.assertEqual(get_start_diagonal(split_piece2), 32 - (2 + 8))
+ self.assertEqual(get_end_diagonal(split_piece2), 34 - (2 + 8))
if __name__ == '__main__':
unittest.main() | reference length is the same, either way | hall-lab_svtyper | train | py |
aabad840e002da262ec6183202477201f5144103 | diff --git a/src/kff.View.js b/src/kff.View.js
index <HASH>..<HASH> 100644
--- a/src/kff.View.js
+++ b/src/kff.View.js
@@ -769,12 +769,12 @@ kff.View = kff.createClass(
if(oldModels)
{
- for(key in oldModels)
+ var keys = Object.keys(oldModels);
+ for(i = 0, l = keys.length; i < l; i++)
{
- if(oldModels.hasOwnProperty(key))
- {
- this.models[key] = oldModels[key];
- }
+ key = keys[i];
+ this.models[key] = oldModels[key];
+
}
}
@@ -784,12 +784,12 @@ kff.View = kff.createClass(
if(oldHelpers)
{
- for(key in oldHelpers)
+ var keys = Object.keys(oldHelpers);
+ for(i = 0, l = keys.length; i < l; i++)
{
- if(oldHelpers.hasOwnProperty(key))
- {
- this.helpers[key] = oldHelpers[key];
- }
+ key = keys[i];
+ this.helpers[key] = oldHelpers[key];
+
}
} | refactor(kff.View): use Object.keys instead of for in loops | karfcz_kff | train | js |
42cd23ced66e8931785451e30df5882242b43ab7 | diff --git a/bin/webpack-dev-server.js b/bin/webpack-dev-server.js
index <HASH>..<HASH> 100755
--- a/bin/webpack-dev-server.js
+++ b/bin/webpack-dev-server.js
@@ -361,6 +361,14 @@ function startDevServer(wpOpt, options) {
throw e;
}
+ ["SIGINT", "SIGTERM"].forEach(function(sig) {
+ process.on(sig, function() {
+ console.log(`Gracefully shutting down server after ${sig}...`);
+ server.close();
+ process.exit(); // eslint-disable-line no-process-exit
+ });
+ });
+
if(options.socket) {
server.listeningApp.on("error", function(e) {
if(e.code === "EADDRINUSE") { | Explicitely but gracefully handle SIGINT and SIGTERM signals. (#<I>)
Fixes #<I>. | webpack_webpack-dev-server | train | js |
a0d4d4750a9c42ef415428413d3ee3963bc083b1 | diff --git a/test/data_set_test.rb b/test/data_set_test.rb
index <HASH>..<HASH> 100644
--- a/test/data_set_test.rb
+++ b/test/data_set_test.rb
@@ -38,8 +38,8 @@ class DataSetTest < Minitest::Test
sets = [
{
name: "FullTestT#{one}",
- code: "FTT#{one}",
- short_name: "FTT#{one}",
+ code: "FullTestT#{one}",
+ short_name: "FullTestT#{one}",
data_element_ids: data_elements.map(&:id),
organisation_unit_ids: org_units.map(&:id)
}
@@ -48,7 +48,7 @@ class DataSetTest < Minitest::Test
assert_equal true, status.success?
assert_equal 1, status.total_imported
- created_set = Dhis2.client.data_sets.list(filter:"code:eq:FTT#{one}", fields: ":all").first
+ created_set = Dhis2.client.data_sets.list(filter:"code:eq:FullTestT#{one}", fields: ":all").first
refute_empty created_set.organisation_units
data_element1 = Dhis2.client.data_elements.find(data_elements.first.id) | Adapt find by code to match dataset created. | BLSQ_dhis2 | train | rb |
e33db19b34021bf9958ce31e6def96697ec0ddda | diff --git a/pyvim/commands/commands.py b/pyvim/commands/commands.py
index <HASH>..<HASH> 100644
--- a/pyvim/commands/commands.py
+++ b/pyvim/commands/commands.py
@@ -331,6 +331,7 @@ def _(editor):
quit(editor, all_=True, force=False)
+@cmd('h')
@cmd('help')
def _(editor):
""" | Added ':h' alias for ':help' | prompt-toolkit_pyvim | train | py |
658f8506c655b2dd22ea1f25b3f7335cc05dc031 | diff --git a/alot/command.py b/alot/command.py
index <HASH>..<HASH> 100644
--- a/alot/command.py
+++ b/alot/command.py
@@ -523,6 +523,8 @@ class ReplyCommand(Command):
references = old_references[:1] + references
references.append(msg.get_message_id())
reply['References'] = ' '.join(references)
+ else:
+ reply['References'] = msg.get_message_id()
ui.apply_command(ComposeCommand(mail=reply)) | forgot to set References on first replies | pazz_alot | train | py |
e77eb29d88514e3c66d540dd8c50979c18a9c236 | diff --git a/tests/HashTest.php b/tests/HashTest.php
index <HASH>..<HASH> 100644
--- a/tests/HashTest.php
+++ b/tests/HashTest.php
@@ -9,6 +9,12 @@ class HashTest extends PHPUnit_Framework_TestCase
public function testValidHash()
{
+ $s = new Stringizer("1260fc5e");
+ $this->assertEquals(true, $s->isHash("crc32"));
+
+ $s = new Stringizer("d87f7e0c");
+ $this->assertEquals(true, $s->isHash("crc32b"));
+
$s = new Stringizer("3ca25ae354e192b26879f651a51d92aa8a34d8d3");
$this->assertEquals(true, $s->isHash("sha1")); | Added basic tests for crc<I> and crc<I>b | jasonlam604_Stringizer | train | php |
502a7b83fd36635aadb767db0ecfa57ba7ba211d | diff --git a/tasks/fetchpages.js b/tasks/fetchpages.js
index <HASH>..<HASH> 100644
--- a/tasks/fetchpages.js
+++ b/tasks/fetchpages.js
@@ -70,13 +70,15 @@ module.exports = function (grunt) {
'urls': []
});
- if ((typeof options.baseURL === 'undefined') || (options.baseURL === '')) {
- grunt.log.error('"baseURL" option is mandatory!');
- return false;
- }
+ if (this.files && this.files.length) {
+ if ((typeof options.baseURL === 'undefined') || (options.baseURL === '')) {
+ grunt.log.error('"baseURL" option is mandatory when files feature is used!');
+ done(false);
+ }
- if (options.baseURL.substr(options.baseURL.length - 1) !== '/') {
- options.baseURL += '/';
+ if (options.baseURL.substr(options.baseURL.length - 1) !== '/') {
+ options.baseURL += '/';
+ }
}
if ((options.target !== '') && (options.target.substr(options.target.length - 1) !== '/')) { | allow omitting of "baseURL" option when no "files" are defined | olihel_grunt-fetch-pages | train | js |
6ca5b89aed072e0b6a5eae00c3a89fe633af3cf1 | diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -17,7 +17,7 @@ os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir)))
setup(
name='soundscrape',
- version='0.20.0',
+ version='0.21.0',
packages=['soundscrape'],
install_requires=required,
include_package_data=True, | <I> - adds set title as album when downloading sets | Miserlou_SoundScrape | train | py |
732bdd4df1c4c04e7a1fcd28015e319c886b3a5f | diff --git a/classes/Boom/Asset/Finder.php b/classes/Boom/Asset/Finder.php
index <HASH>..<HASH> 100644
--- a/classes/Boom/Asset/Finder.php
+++ b/classes/Boom/Asset/Finder.php
@@ -32,28 +32,6 @@ class Finder extends Boom\Finder\Finder
return new Finder\Result($assets);
}
- /**
- *
- * @return array
- */
-// public function get_count_and_total_size()
-// {
-// $query = clone $this->_query;
-// $query->reset();
-//
-// $this->_applyFilters($query);
-//
-// $result = $query
-// ->select(array(DB::expr('sum(filesize)'), 'filesize'))
-// ->select(array(DB::expr('count(*)'), 'count'))
-// ->find();
-//
-// return array(
-// 'count' => $result->get('count'),
-// 'filesize' => $result->get('filesize')
-// );
-// }
-
public function setOrderBy($field, $direction = null)
{
in_array($field, $this->_allowedOrderByColumns) || $field = 'title'; | Deleted commented code in asset finder | boomcms_boom-core | train | php |
35ebfba529c9cfcfef53b2b66f1476c295387942 | diff --git a/master/buildbot/data/resultspec.py b/master/buildbot/data/resultspec.py
index <HASH>..<HASH> 100644
--- a/master/buildbot/data/resultspec.py
+++ b/master/buildbot/data/resultspec.py
@@ -152,14 +152,14 @@ class NoneComparator:
def __ne__(self, other):
return self.value != other.value
- def __gt_(self, other):
+ def __gt__(self, other):
if self.value is None and other.value is None:
return False
elif self.value is None:
return False
elif other.value is None:
return True
- return self.value < other.value
+ return self.value > other.value
class ReverseComparator: | data: Fix __gt__() comparison operator in NoneComparator | buildbot_buildbot | train | py |
9f2fc9df32ea319825305c86c3f6ac70796ef463 | diff --git a/elki-clustering/src/main/java/elki/evaluation/clustering/Entropy.java b/elki-clustering/src/main/java/elki/evaluation/clustering/Entropy.java
index <HASH>..<HASH> 100644
--- a/elki-clustering/src/main/java/elki/evaluation/clustering/Entropy.java
+++ b/elki-clustering/src/main/java/elki/evaluation/clustering/Entropy.java
@@ -203,9 +203,9 @@ public class Entropy {
*/
private void computeMIFull(int[][] contingency, int r, int c, int n, int m, double byn, double mlogn, double[] logs) {
// Precompute log(factorial) table:
- double[] lfacs = new double[n];
+ double[] lfacs = new double[Math.max(n, 1)];
double tmp = 0.;
- for(int i = 2, e = n - m; i <= e; i++) {
+ for(int i = 2, e = Math.max(n - m, 2); i <= e; i++) {
lfacs[i - 2] = tmp += log(i, logs);
}
final int[] lastrow = contingency[r]; | Fix potential corner case in Entropy when n=m | elki-project_elki | train | java |
362b933b49885950557c3706e8d9df065161d66e | diff --git a/tools.py b/tools.py
index <HASH>..<HASH> 100644
--- a/tools.py
+++ b/tools.py
@@ -6,9 +6,9 @@ tools.py:
"""
__author__ = 'Jason R. Coombs <jaraco@sandia.gov>'
-__version__ = '$Revision: 25 $'[11:-2]
+__version__ = '$Revision: 26 $'[11:-2]
__vssauthor__ = '$Author: Jaraco $'[9:-2]
-__date__ = '$Modtime: 04-05-14 11:29 $'[10:-2]
+__date__ = '$Modtime: 04-05-14 12:24 $'[10:-2]
import string, urllib, os
import logging
@@ -627,7 +627,7 @@ class hashSplit( dict ):
self.__getNext__()
return self[ i ]
-class iterQueue( iter ):
+class iterQueue( object ):
def __init__( self, getNext ):
self.queued = []
self.getNext = getNext
@@ -642,11 +642,6 @@ class iterQueue( iter ):
def enqueue( self, item ):
self.queued.insert( 0, item )
-def callbackIter( getNext ):
- queue = []
- while 1:
-
-
def ordinalth(n):
"""Return the ordinal with 'st', 'th', or 'nd' appended as appropriate.
>>> map( ordinalth, xrange( -5, 22 ) ) | Fixed some syntax errors in iter split code. | jaraco_tempora | train | py |
cdb298301a67551f99e43cf2a3f2ae4b8151f05b | diff --git a/pyxel/examples/05_color_palette.py b/pyxel/examples/05_color_palette.py
index <HASH>..<HASH> 100755
--- a/pyxel/examples/05_color_palette.py
+++ b/pyxel/examples/05_color_palette.py
@@ -3,13 +3,13 @@ import pyxel
def draw_palette(x, y, col):
col_val = pyxel.colors[col]
- hex_col = "#{:06X}".format(col_val)
- rgb_col = "{},{},{}".format(col_val >> 16, (col_val >> 8) & 0xFF, col_val & 0xFF)
+ hex_col = f"#{col_val:06X}"
+ rgb_col = f"{col_val >> 16},{(col_val >> 8) & 0xFF},{col_val & 0xFF}"
pyxel.rect(x, y, 13, 13, col)
pyxel.text(x + 16, y + 1, hex_col, 7)
pyxel.text(x + 16, y + 8, rgb_col, 7)
- pyxel.text(x + 5 - (col // 10) * 2, y + 4, "{}".format(col), 7 if col < 6 else 0)
+ pyxel.text(x + 5 - (col // 10) * 2, y + 4, f"{col}", 7 if col < 6 else 0)
if col == 0:
pyxel.rectb(x, y, 13, 13, 13) | Changed to use f-strings | kitao_pyxel | train | py |
e0290d2564cc891935a42bee381b06089dddd6de | diff --git a/lib/active_record/connection_adapters/oracle_enhanced/quoting.rb b/lib/active_record/connection_adapters/oracle_enhanced/quoting.rb
index <HASH>..<HASH> 100644
--- a/lib/active_record/connection_adapters/oracle_enhanced/quoting.rb
+++ b/lib/active_record/connection_adapters/oracle_enhanced/quoting.rb
@@ -150,7 +150,7 @@ module ActiveRecord
end
# Cast a +value+ to a type that the database understands.
- def type_cast(value, column)
+ def type_cast(value, column = nil)
if column && column.cast_type.is_a?(Type::Serialized)
super
else | type_cast arity change
refer <URL> | rsim_oracle-enhanced | train | rb |
1f67322284b54d1ec7e8806fc1f355afed5f40b5 | diff --git a/src/Application.php b/src/Application.php
index <HASH>..<HASH> 100644
--- a/src/Application.php
+++ b/src/Application.php
@@ -21,6 +21,7 @@ use Symfony\Component\Console\Input\InputInterface;
use Illuminate\Console\Application as BaseApplication;
use Illuminate\Contracts\Events\Dispatcher as DispatcherContract;
use Illuminate\Contracts\Container\Container as ContainerContract;
+use NunoMaduro\LaravelDesktopNotifier\LaravelDesktopNotifierServiceProvider;
/**
* This is the Zero Framework application class.
@@ -64,6 +65,7 @@ class Application extends BaseApplication implements ArrayAccess
protected $providers = [
\Illuminate\Events\EventServiceProvider::class,
Providers\Composer\ServiceProvider::class,
+ LaravelDesktopNotifierServiceProvider::class,
];
/** | Adds desktop notifier into the core | laravel-zero_framework | train | php |
5e06d16fe9712727e7f629e8f4e0c9e1951f4540 | diff --git a/index.js b/index.js
index <HASH>..<HASH> 100644
--- a/index.js
+++ b/index.js
@@ -53,8 +53,11 @@ const kernelsBound = Observable.bindCallback(kernels)
const getKernelResourcesBound = Observable.bindCallback(getKernelResources)
function asObservable() {
- var potentialKernelDirs = jp.dataDirs().map(dir => path.join(dir, 'kernels'))
- var o = Observable.fromArray(potentialKernelDirs)
+ return Observable.fromPromise(jp.dataDirs({ withSysPrefix: true }))
+ .flatMap(x => {
+ return Observable.fromArray(x)
+ })
+ .map(d => path.join(d, 'kernels'))
.flatMap(x => {return kernelsBound(x)})
.filter(x => x !== {})
.flatMap(x => {
@@ -66,7 +69,6 @@ function asObservable() {
.filter(x => !x.err)
.publish()
.refCount()
- return o
}
function asPromise() { | Problem: we weren't providing the sys.prefix paths
Solution: Ask for them from jupyter-paths | nteract_kernelspecs | train | js |
e73880ffaff2c3a61cbe739854c60deec50c7bb2 | diff --git a/tasks/run-command.js b/tasks/run-command.js
index <HASH>..<HASH> 100644
--- a/tasks/run-command.js
+++ b/tasks/run-command.js
@@ -4,7 +4,7 @@ module.exports = function(gulp, config) {
return function(command, cb) {
var _ = require('lodash');
var spawn = require('child_process').spawn;
- var env = _.extend({}, process.env, config.server.environmentVariables);
+ var env = _.extend({}, config.server.environmentVariables, process.env);
var argv = process.argv.slice(2);
var proc = spawn('node', [command].concat(argv), { env: env, stdio: 'inherit' }); | feat(run-command): allow environment to override variables defined in tasks config | emartech_boar-tasks-server | train | js |
1a2567e19ee71ea23073a91de721d747fc6d2506 | diff --git a/src/Symfony/Bundle/SecurityBundle/Templating/Helper/LogoutUrlHelper.php b/src/Symfony/Bundle/SecurityBundle/Templating/Helper/LogoutUrlHelper.php
index <HASH>..<HASH> 100644
--- a/src/Symfony/Bundle/SecurityBundle/Templating/Helper/LogoutUrlHelper.php
+++ b/src/Symfony/Bundle/SecurityBundle/Templating/Helper/LogoutUrlHelper.php
@@ -101,7 +101,7 @@ class LogoutUrlHelper extends Helper
if ('/' === $logoutPath[0]) {
$request = $this->container->get('request');
- $url = UrlGeneratorInterface::ABSOLUTE_URL === $referenceType ? $request->getUriForPath($logoutPath) : $request->getBasePath().$logoutPath;
+ $url = UrlGeneratorInterface::ABSOLUTE_URL === $referenceType ? $request->getUriForPath($logoutPath) : $request->getBaseUrl().$logoutPath;
if (!empty($parameters)) {
$url .= '?'.http_build_query($parameters); | Fix the logout path when not using the router
This needs to use the base url, not the base path, so that it goes
through the front controller when not using url rewriting. | symfony_symfony | train | php |
e66d636c0354cc2fd9e4df2914e33c4778699c8b | diff --git a/lib/filter/jade.js b/lib/filter/jade.js
index <HASH>..<HASH> 100644
--- a/lib/filter/jade.js
+++ b/lib/filter/jade.js
@@ -15,6 +15,7 @@ module.exports = function (src, dst, opts, callback) {
DEBUG && debug('jade', src, '-->', dst);
opts = opts || {};
opts.filename = src;
+ opts.pretty = true;// XXX: make configurable!
jade.render(srcData, opts, function (err, dstData) {
if (err) {
DEBUG && debug('jade err', err); | turn on jade's pretty option. | iolo_express-webapp-assets | train | js |
48069d65d3159f62b4dfb443d5b9c670ca65b93e | diff --git a/src/resources/views/api/detail.blade.php b/src/resources/views/api/detail.blade.php
index <HASH>..<HASH> 100644
--- a/src/resources/views/api/detail.blade.php
+++ b/src/resources/views/api/detail.blade.php
@@ -143,7 +143,7 @@
<div class="checkbox-inline">
<label>
- @if(array_key_exists($key_type, $current_workers))
+ @if(!is_null($current_workers) && array_key_exists($key_type, $current_workers))
@if(!is_null($current_workers[$key_type]) && in_array($worker, $current_workers[$key_type])) | Add a check for cases where api keys may have `null` constraints. | eveseat_web | train | php |
3bfd15878442ed97a7c768a09ccd51571d4e1d47 | diff --git a/grunt.js b/grunt.js
index <HASH>..<HASH> 100644
--- a/grunt.js
+++ b/grunt.js
@@ -437,11 +437,6 @@ module.exports = function( grunt ) {
created = path + filename.replace( "dist/", "" );
- if ( !/^\//.test( path ) ) {
- log.error( "File '" + created + "' was NOT created." );
- return;
- }
-
file.write( created, file.read(filename) );
log.writeln( "File '" + created + "' created." ); | Don't be so picky about path separators | jquery_jquery | train | js |
f1c1cbb07b48a71f34d686c29edbcf5eba20cc64 | diff --git a/wafer/talks/views.py b/wafer/talks/views.py
index <HASH>..<HASH> 100644
--- a/wafer/talks/views.py
+++ b/wafer/talks/views.py
@@ -81,7 +81,8 @@ class TalkCreate(LoginRequiredMixin, CreateView):
@revisions.create_revision()
def form_valid(self, form):
if not getattr(settings, 'WAFER_TALKS_OPEN', True):
- raise ValidationError # Should this be SuspiciousOperation?
+ # Should this be SuspiciousOperation?
+ raise ValidationError("Talk submission isn't open")
# Eaaargh we have to do the work of CreateView if we want to set values
# before saving
self.object = form.save(commit=False) | ValidationError must be instantiated | CTPUG_wafer | train | py |
78215cd14f3e9a35b45b0b699b3fc8b667459f46 | diff --git a/lib/FSi/DoctrineExtensions/Translatable/Entity/Repository/TranslatableRepository.php b/lib/FSi/DoctrineExtensions/Translatable/Entity/Repository/TranslatableRepository.php
index <HASH>..<HASH> 100644
--- a/lib/FSi/DoctrineExtensions/Translatable/Entity/Repository/TranslatableRepository.php
+++ b/lib/FSi/DoctrineExtensions/Translatable/Entity/Repository/TranslatableRepository.php
@@ -341,12 +341,11 @@ class TranslatableRepository extends EntityRepository
protected function areTranslationsIndexedByLocale($translationAssociation)
{
$translationAssociationMapping = $this->getClassMetadata()->getAssociationMapping($translationAssociation);
- $translationExtendedMeta = $this->getTranslationExtendedMetadata($translationAssociation);
-
if (!isset($translationAssociationMapping['indexBy'])) {
return false;
}
+ $translationExtendedMeta = $this->getTranslationExtendedMetadata($translationAssociation);
return ($translationAssociationMapping['indexBy'] == $translationExtendedMeta->localeProperty);
} | Micro-optimization in TranslatableRepository | fsi-open_doctrine-extensions | train | php |
2e8d83b8cb0951866537feb6a1a9a27898cadfa5 | diff --git a/Context/CurrencyContext.php b/Context/CurrencyContext.php
index <HASH>..<HASH> 100644
--- a/Context/CurrencyContext.php
+++ b/Context/CurrencyContext.php
@@ -4,6 +4,7 @@ namespace Netgen\Bundle\EzSyliusBundle\Context;
use Sylius\Bundle\CoreBundle\Context\CurrencyContext as BaseCurrencyContext;
use Doctrine\DBAL\Exception\TableNotFoundException;
+use Sylius\Component\Core\Model\UserInterface;
class CurrencyContext extends BaseCurrencyContext
{
@@ -18,4 +19,17 @@ class CurrencyContext extends BaseCurrencyContext
return null;
}
}
+
+ protected function getUser()
+ {
+ if (
+ $this->securityContext->getToken() &&
+ $this->securityContext->getToken()->getUser() instanceof UserInterface
+ )
+ {
+ return parent::getUser();
+ }
+
+ return null;
+ }
} | Override getUser method in currency context to return null if we are not dealing with eZ user | netgen_NetgenEzSyliusBundle | train | php |
7e33ec8532e31950b173fc05e778efe0c1f837db | diff --git a/visidata/selection.py b/visidata/selection.py
index <HASH>..<HASH> 100644
--- a/visidata/selection.py
+++ b/visidata/selection.py
@@ -78,7 +78,7 @@ def unselectByIdx(self, rowIdxs):
@Sheet.api
def gatherBy(self, func, gerund='gathering'):
'Generate only rows for which the given func returns True.'
- for i in Progress(rotateRange(self.nRows, self.cursorRowIndex), total=self.nRows, gerund=gerund):
+ for i in Progress(rotateRange(self.nRows, self.cursorRowIndex-1), total=self.nRows, gerund=gerund):
try:
r = self.rows[i]
if func(r): | [selection] mass select starts with current row | saulpw_visidata | train | py |
904b2a92022867cd2fee03f6d94ecfe78276aeba | diff --git a/grimoire_elk/elk/telegram.py b/grimoire_elk/elk/telegram.py
index <HASH>..<HASH> 100644
--- a/grimoire_elk/elk/telegram.py
+++ b/grimoire_elk/elk/telegram.py
@@ -40,15 +40,22 @@ class TelegramEnrich(Enrich):
def get_elastic_mappings(self):
+ from grimoire_elk.utils import kibiter_version
+
+ fielddata = ''
+ if kibiter_version == '5':
+ fielddata = ', "fielddata": true'
+
mapping = """
{
"properties": {
"text_analyzed": {
"type": "string",
"index":"analyzed"
+ %s
}
}
- } """
+ } """ % (fielddata)
return {"items":mapping} | [enrich][telegram] Update text_analyzed so it exists as aggregatable | chaoss_grimoirelab-elk | train | py |
5456ee41d906883ca6fba772c7a605e826acb5af | diff --git a/lib/pdf/reader/object_cache.rb b/lib/pdf/reader/object_cache.rb
index <HASH>..<HASH> 100644
--- a/lib/pdf/reader/object_cache.rb
+++ b/lib/pdf/reader/object_cache.rb
@@ -6,7 +6,7 @@ class PDF::Reader
# A Hash-like object for caching commonly used objects from a PDF file.
#
- # This is an internal class used by PDF::Reader::ObjectHash
+ # This is an internal class, no promises about a stable API.
#
class ObjectCache # nodoc
diff --git a/lib/pdf/reader/object_hash.rb b/lib/pdf/reader/object_hash.rb
index <HASH>..<HASH> 100644
--- a/lib/pdf/reader/object_hash.rb
+++ b/lib/pdf/reader/object_hash.rb
@@ -44,7 +44,7 @@ class PDF::Reader
@pdf_version = read_version
@xref = PDF::Reader::XRef.new(@io)
@trailer = @xref.trailer
- @cache = PDF::Reader::ObjectCache.new
+ @cache = opts[:cache] || PDF::Reader::ObjectCache.new
@sec_handler = build_security_handler(opts)
end | make ObjectCache available document-wide
* to experiment with caching 'stuff' at a higher level than just PDF
objects
* prime candidates are PDF::Reader::Page and PDF::Reader::FormXObject's
that can memoize expensive parsing calls | yob_pdf-reader | train | rb,rb |
409101840a9e95f47d354146c745be182736007c | diff --git a/blackjack.py b/blackjack.py
index <HASH>..<HASH> 100644
--- a/blackjack.py
+++ b/blackjack.py
@@ -253,7 +253,7 @@ class BJ(object):
root = NULL
def __init__(self, iterable=None, comparator=cmp):
- self._comparator = cmp
+ self._comparator = comparator
if iterable is not None:
for item in iterable:
@@ -312,6 +312,26 @@ class Deck(object):
def __delitem__(self, key):
self._bj.discard(key)
+ def iteritems(self):
+ return iter(self._bj)
+
+ def iterkeys(self):
+ for k, v in self.iteritems():
+ yield k
+
+ def itervalues(self):
+ for k, v in self.iteritems():
+ yield v
+
+ def items(self):
+ return list(self.iteritems())
+
+ def keys(self):
+ return list(self.iterkeys())
+
+ def values(self):
+ return list(self.itervalues())
+
from unittest import TestCase | Well, that more or less works. Sort of. | MostAwesomeDude_blackjack | train | py |
51df567311febda79db818875b60e8552f082644 | diff --git a/src/components/popup/popup.js b/src/components/popup/popup.js
index <HASH>..<HASH> 100644
--- a/src/components/popup/popup.js
+++ b/src/components/popup/popup.js
@@ -54,7 +54,7 @@ popupDialog.prototype.hide = function (shouldCallback = true) {
if (!document.querySelector('.vux-popup-dialog.vux-popup-show')) {
this.mask.classList.remove('vux-popup-show')
}
- shouldCallback === false && this.params.onClose && this.params.onClose(this)
+ shouldCallback === false && this.params.onClose && this.params.hideOnBlur && this.params.onClose(this)
}
popupDialog.prototype.html = function (html) { | Popup: Call onClose only when hideOnBlur is true | airyland_vux | train | js |
e0abb930f5c9f3a3822712df16ed55d4aaf4b656 | diff --git a/lib/ledger_web/price_lookup.rb b/lib/ledger_web/price_lookup.rb
index <HASH>..<HASH> 100644
--- a/lib/ledger_web/price_lookup.rb
+++ b/lib/ledger_web/price_lookup.rb
@@ -12,14 +12,14 @@ module LedgerWeb
def lookup
params = {
- a: @min_date.month - 1,
- b: @min_date.day,
- c: @min_date.year,
- d: @max_date.month - 1,
- e: @max_date.day,
- f: @max_date.year,
- s: @symbol,
- ignore: '.csv',
+ 'a' => @min_date.month - 1,
+ 'b' => @min_date.day,
+ 'c' => @min_date.year,
+ 'd' => @max_date.month - 1,
+ 'e' => @max_date.day,
+ 'f' => @max_date.year,
+ 's' => @symbol,
+ 'ignore' => '.csv',
}
query = params.map { |k,v| "#{k}=#{v}" }.join("&") | Remove some <I>isms | peterkeen_ledger-web | train | rb |
54caaa8a04f174c8dc1bb33bb6bfc7ff679e90c7 | diff --git a/src/Illuminate/Queue/Console/ListenCommand.php b/src/Illuminate/Queue/Console/ListenCommand.php
index <HASH>..<HASH> 100644
--- a/src/Illuminate/Queue/Console/ListenCommand.php
+++ b/src/Illuminate/Queue/Console/ListenCommand.php
@@ -72,6 +72,11 @@ class ListenCommand extends Command {
*/
protected function getQueue($connection)
{
+ if ($connection === NULL)
+ {
+ $connection = $this->laravel['config']->get("queue.default");
+ }
+
$queue = $this->laravel['config']->get("queue.connections.{$connection}.queue", 'default');
return $this->input->getOption('queue') ?: $queue;
@@ -107,4 +112,4 @@ class ListenCommand extends Command {
);
}
-}
\ No newline at end of file
+} | Sane default connection/queue if none specified
If you execute the command `php artisan queue:listen` then queue the system uses will end up as `default` even if the real default queue for your selected queue driver is different. This should fix that. | laravel_framework | train | php |
a3dab5ec13525ca3d83c4e123aa180993e893228 | diff --git a/base/serialize.go b/base/serialize.go
index <HASH>..<HASH> 100644
--- a/base/serialize.go
+++ b/base/serialize.go
@@ -383,7 +383,7 @@ func (c *ClassifierSerializer) WriteMetadataAtPrefix(prefix string, metadata Cla
func CreateSerializedClassifierStub(filePath string, metadata ClassifierMetadataV1) (*ClassifierSerializer, error) {
// Open the filePath
- f, err := os.OpenFile(filePath, os.O_RDWR|os.O_TRUNC, 0600)
+ f, err := os.OpenFile(filePath, os.O_RDWR|os.O_TRUNC|os.O_CREAT, 0600)
if err != nil {
return nil, err
} | base: try to correct 'no such file or directory' error | sjwhitworth_golearn | train | go |
e3c3959f48844de77e4799f61d4f6b0c3ba12a13 | diff --git a/graphite_influxdb.py b/graphite_influxdb.py
index <HASH>..<HASH> 100644
--- a/graphite_influxdb.py
+++ b/graphite_influxdb.py
@@ -52,7 +52,21 @@ class InfluxdbReader(object):
start = points[0][0]
end = points[-1][0]
step = points[1][0] - start
- datapoints = [p[2] for p in points]
+ steps = int((end - start) / step)
+ if len(points) == steps + 1:
+ logger.debug("No steps missing")
+ datapoints = [p[2] for p in points]
+ else:
+ logger.debug("Fill missing steps with None values")
+ next_point = 0
+ for s in range(0, steps):
+ if points[next_point][0] <= start + step * s:
+ datapoints.append(points[next_point][2])
+ if next_point < len(points):
+ next_point += 1
+ else:
+ datapoints.append(None)
+
except Exception:
pass
time_info = start, end, step | Fill missing values (within the step interval) with None values
Provide functional compatibility to whisper db, where missing
values generate None (null).
Without filling the gaps, Graphite-Web is generating wrong graphics. | vimeo_graphite-influxdb | train | py |
d000ba3ed3280942fbbe59a83601b65986f86e57 | diff --git a/etcd/etcd.go b/etcd/etcd.go
index <HASH>..<HASH> 100644
--- a/etcd/etcd.go
+++ b/etcd/etcd.go
@@ -82,6 +82,7 @@ func (e *Etcd) Run() {
} else if e.Config.Verbose {
log.Verbose = true
}
+
if e.Config.CPUProfileFile != "" {
profile(e.Config.CPUProfileFile)
} | chore(main): add a space line between the two if statements | etcd-io_etcd | train | go |
a254d2f8acf57a3e595462d864cc22e0aa49f53c | diff --git a/ps_alchemy/resources.py b/ps_alchemy/resources.py
index <HASH>..<HASH> 100644
--- a/ps_alchemy/resources.py
+++ b/ps_alchemy/resources.py
@@ -150,17 +150,11 @@ class ListResource(BaseResource):
@property
def items_per_page(self):
- default = 5
-
- if not getattr(self, '__parent__', True):
- registry = get_current_registry()
- return int(
- registry.settings.get(
- 'ps_alchemy.items_per_page',
- default
- )
+ return int(
+ get_current_registry().settings.get(
+ 'ps_alchemy.items_per_page', 5
)
- return default
+ )
def __getitem__(self, name):
if name == 'create': | fix up sacrud/pyramid_sacrud#<I> | sacrud_ps_alchemy | train | py |
d29ea657a94fc289af14bf422ad934840c3f76fd | diff --git a/compliance_checker/suite.py b/compliance_checker/suite.py
index <HASH>..<HASH> 100644
--- a/compliance_checker/suite.py
+++ b/compliance_checker/suite.py
@@ -330,7 +330,7 @@ class CheckSuite(object):
textchars = ''.join(map(chr, [7,8,9,10,12,13,27] + range(0x20, 0x100)))
is_binary_string = lambda bytes: bool(bytes.translate(None, textchars))
- with open(ds_str) as f:
+ with open(ds_str, 'rb') as f:
first_chunk = f.read(1024)
if is_binary_string(first_chunk):
# likely netcdf file | Open files in binary mode, fixes #<I> | ioos_compliance-checker | train | py |
f2663a672ec37ac3833c28589db507b8ae1b1f7b | diff --git a/pyqode/python/widgets/interactive.py b/pyqode/python/widgets/interactive.py
index <HASH>..<HASH> 100644
--- a/pyqode/python/widgets/interactive.py
+++ b/pyqode/python/widgets/interactive.py
@@ -30,9 +30,8 @@ class PyInteractiveConsole(InteractiveConsole):
self.set_writer(self._write)
self.setMouseTracking(True)
self.PROG = QtCore.QRegExp(
- r'\s*File "[a-zA-Z\/_\d:\\\.]*((.\.[a-zA-Z\/_\d:\\]*")|(")), '
- r'line [0-9]*.*')
- self.FILENAME_PROG = QtCore.QRegExp(r'"[a-zA-Z\/_\.\d:\\]*"')
+ r'\s*File ".*", line [0-9]*, in ')
+ self.FILENAME_PROG = QtCore.QRegExp(r'".*"')
self.LINE_PROG = QtCore.QRegExp(r'line [0-9]*')
self.setLineWrapMode(self.NoWrap)
self._module_color = QtGui.QColor('blue') | Simplify PyInteractiveConsole file regex
and fix bug if exception occur in dist-packages (there was an issue with the previous regex which did not take '-' into account) | pyQode_pyqode.python | train | py |
53564e0cd1c38035af4d3756e27ba9e0ea9009cb | diff --git a/lib/merb-core/logger.rb b/lib/merb-core/logger.rb
index <HASH>..<HASH> 100644
--- a/lib/merb-core/logger.rb
+++ b/lib/merb-core/logger.rb
@@ -97,11 +97,13 @@ module Merb
# The idea here is that instead of performing an 'if' conditional check
# on each logging we do it once when the log object is setup
- undef write_method if defined? write_method
- if aio
- alias :write_method :write_nonblock
- else
- alias :write_method :write
+ @log.instance_eval do
+ undef write_method if defined? write_method
+ if @aio
+ alias :write_method :write_nonblock
+ else
+ alias :write_method :write
+ end
end
Merb.logger = self | Changed alias of write_method to operate on the @log instance. | wycats_merb | train | rb |
63ff6cb8e94425f664a6503e1c5cde4cc9c0534a | diff --git a/jax/lax/lax_control_flow.py b/jax/lax/lax_control_flow.py
index <HASH>..<HASH> 100644
--- a/jax/lax/lax_control_flow.py
+++ b/jax/lax/lax_control_flow.py
@@ -621,6 +621,17 @@ def cond(*args, **kwargs):
Pred must be a scalar type.
+ Note that true_fun/false_fun may not need to refer to an `operand` to compute
+ their result, but one must still be provided to the `cond` call and be
+ accepted by both the branch functions, e.g.:
+
+ jax.lax.cond(
+ get_predicate_value(),
+ lambda _: 23,
+ lambda _: 42,
+ operand=None)
+
+
Arguments:
pred: Boolean scalar type, indicating which branch function to
apply. Collections (list, tuple) are not supported. | Clarify docs on jax.lax.cond. (#<I>) | tensorflow_probability | train | py |
ccbf22a5b320898797ef8baca9938aa1441b277e | diff --git a/boblib/composer.php b/boblib/composer.php
index <HASH>..<HASH> 100644
--- a/boblib/composer.php
+++ b/boblib/composer.php
@@ -88,7 +88,7 @@ task('composer.json', array('composer_spec.php'), function($task) {
$pkg = include($task->prerequisites[0]);
if (!is_array($pkg)) {
- printLn('ERROR: composer_spec.php MUST return an array');
+ println('Error: composer_spec.php MUST return an array');
exit(1);
}
@@ -104,7 +104,7 @@ task('composer.json', array('composer_spec.php'), function($task) {
$json = json_encode($pkg, $jsonOptions);
- printLn('Writing composer.json');
+ println('Writing composer.json');
@file_put_contents($task->name, $json);
}); | Changed printLn -> println | CHH_bob | train | php |
48fce919aa2ee989484b88168dd5a9e2f7486ddc | diff --git a/src/com/google/bitcoin/core/BlockChain.java b/src/com/google/bitcoin/core/BlockChain.java
index <HASH>..<HASH> 100644
--- a/src/com/google/bitcoin/core/BlockChain.java
+++ b/src/com/google/bitcoin/core/BlockChain.java
@@ -308,11 +308,11 @@ public class BlockChain {
private void sendTransactionsToWallet(StoredBlock block, NewBlockType blockType,
HashMap<Wallet, List<Transaction>> newTransactions) throws VerificationException {
- for (Wallet wallet : newTransactions.keySet()) {
+ for (Map.Entry<Wallet, List<Transaction>> entry : newTransactions.entrySet()) {
try {
- List<Transaction> txns = newTransactions.get(wallet);
+ List<Transaction> txns = entry.getValue();
for (Transaction tx : txns) {
- wallet.receive(tx, block, blockType);
+ entry.getKey().receive(tx, block, blockType);
}
} catch (ScriptException e) {
// We don't want scripts we don't understand to break the block chain so just note that this tx was | Minor efficiency improvement: use entrySet() instead of keySet()+get(). Clears out a FindBugs warning. | bitcoinj_bitcoinj | train | java |
d0901a36de4d7ef71bf615131f48e6333d93c2b0 | diff --git a/tests/project/settings.py b/tests/project/settings.py
index <HASH>..<HASH> 100644
--- a/tests/project/settings.py
+++ b/tests/project/settings.py
@@ -7,7 +7,26 @@ INSTALLED_APPS = [
'markitup',
]
-TEMPLATE_DIRS = [join(BASE_DIR, 'templates')]
+TEMPLATES = [
+ {
+ 'BACKEND': 'django.template.backends.django.DjangoTemplates',
+ 'DIRS': [
+ join(BASE_DIR, 'templates'),
+ ],
+ 'APP_DIRS': True,
+ 'OPTIONS': {
+ 'context_processors': [
+ 'django.contrib.auth.context_processors.auth',
+ 'django.template.context_processors.debug',
+ 'django.template.context_processors.i18n',
+ 'django.template.context_processors.media',
+ 'django.template.context_processors.static',
+ 'django.template.context_processors.tz',
+ 'django.contrib.messages.context_processors.messages',
+ ],
+ },
+ },
+]
ROOT_URLCONF = 'tests.project.urls' | Use TEMPLATES setting in tests. | zsiciarz_django-markitup | train | py |
862d4af274c97d2586832714f54c1a17170d209a | diff --git a/src/Composer/Util/Svn.php b/src/Composer/Util/Svn.php
index <HASH>..<HASH> 100644
--- a/src/Composer/Util/Svn.php
+++ b/src/Composer/Util/Svn.php
@@ -43,7 +43,7 @@ class Svn
/**
* @var bool
*/
- protected $cacheCredentials = false;
+ protected $cacheCredentials = true;
/**
* @param string $url
@@ -70,7 +70,7 @@ class Svn
$this->credentials['username'] = $this->io->ask("Username: ");
$this->credentials['password'] = $this->io->askAndHideAnswer("Password: ");
- $this->cacheCredentials = $this->io->askConfirmation("Should Subversion cache these credentials? (yes/no) ", false);
+ $this->cacheCredentials = $this->io->askConfirmation("Should Subversion cache these credentials? (yes/no) ", true);
return $this;
} | Cache credentials by default since that's the default svn behavior | mothership-ec_composer | train | php |
efc3d5ffb6050e9d24efe275843d6f3886bec860 | diff --git a/src/tuwien/auto/calimero/knxnetip/KNXnetIPTunnel.java b/src/tuwien/auto/calimero/knxnetip/KNXnetIPTunnel.java
index <HASH>..<HASH> 100644
--- a/src/tuwien/auto/calimero/knxnetip/KNXnetIPTunnel.java
+++ b/src/tuwien/auto/calimero/knxnetip/KNXnetIPTunnel.java
@@ -177,7 +177,9 @@ public class KNXnetIPTunnel extends ClientConnection
layer = Objects.requireNonNull(knxLayer, "Tunneling Layer");
if (knxLayer == RawLayer)
throw new KNXIllegalArgumentException("Raw tunnel to KNX network not supported");
- connect(localEP, serverCtrlEP, new TunnelCRI(knxLayer, tunnelingAddress), useNAT);
+ final var cri = tunnelingAddress.equals(KNXMediumSettings.BackboneRouter) ? new TunnelCRI(knxLayer)
+ : new TunnelCRI(knxLayer, tunnelingAddress);
+ connect(localEP, serverCtrlEP, cri, useNAT);
}
protected KNXnetIPTunnel(final TunnelingLayer knxLayer, final Connection connection, | Distinguish basic/extended cri | calimero-project_calimero-core | train | java |
9bb3c5f74f77613ccc93776b5f7130c65443e21c | diff --git a/components/lib/fileupload/FileUpload.js b/components/lib/fileupload/FileUpload.js
index <HASH>..<HASH> 100644
--- a/components/lib/fileupload/FileUpload.js
+++ b/components/lib/fileupload/FileUpload.js
@@ -74,7 +74,11 @@ export const FileUpload = React.memo(React.forwardRef((props, ref) => {
return;
}
- let currentFiles = filesState ? [...filesState] : [];
+ let currentFiles = [];
+ if (props.multiple) {
+ currentFiles = filesState ? [...filesState] : [];
+ }
+
let selectedFiles = event.dataTransfer ? event.dataTransfer.files : event.target.files;
for (let i = 0; i < selectedFiles.length; i++) {
let file = selectedFiles[i]; | Fix #<I>: FileUpload single mode only allow 1 file (#<I>) | primefaces_primereact | train | js |
bd55d199fd4b537ef0e8f70a26ecb3e93f9606ae | diff --git a/src/Resources/skeleton/security/UserProvider.tpl.php b/src/Resources/skeleton/security/UserProvider.tpl.php
index <HASH>..<HASH> 100644
--- a/src/Resources/skeleton/security/UserProvider.tpl.php
+++ b/src/Resources/skeleton/security/UserProvider.tpl.php
@@ -36,8 +36,8 @@ class <?= $class_name ?> implements UserProviderInterface<?= $password_upgrader
{
return $this->loadUserByIdentifier($username);
}
-<?php endif ?>
+<?php endif ?>
/**
* Refreshes the user after being reloaded from the session.
* | Update src/Resources/skeleton/security/UserProvider.tpl.php | symfony_maker-bundle | train | php |
7fd4aef9dc318093aa3a75fc7f6941beeb304800 | diff --git a/rules/readfile.go b/rules/readfile.go
index <HASH>..<HASH> 100644
--- a/rules/readfile.go
+++ b/rules/readfile.go
@@ -122,6 +122,7 @@ func NewReadFile(id string, conf gosec.Config) (gosec.Rule, []ast.Node) {
rule.clean.Add("path/filepath", "Clean")
rule.clean.Add("path/filepath", "Rel")
rule.Add("io/ioutil", "ReadFile")
+ rule.Add("os", "ReadFile")
rule.Add("os", "Open")
rule.Add("os", "OpenFile")
return rule, []ast.Node{(*ast.CallExpr)(nil)}
diff --git a/testutils/source.go b/testutils/source.go
index <HASH>..<HASH> 100644
--- a/testutils/source.go
+++ b/testutils/source.go
@@ -1788,6 +1788,22 @@ func main() {
package main
import (
+"os"
+"log"
+)
+
+func main() {
+ f := os.Getenv("tainted_file")
+ body, err := os.ReadFile(f)
+ if err != nil {
+ log.Printf("Error: %v\n", err)
+ }
+ log.Print(body)
+
+}`}, 1, gosec.NewConfig()}, {[]string{`
+package main
+
+import (
"fmt"
"log"
"net/http" | feat: add os.ReadFile to G<I> (#<I>)
In Go <I> or higher, the `io/ioutil` has been deprecated and the
`ioutil.ReadFile` function now calls `os.ReadFile`. | securego_gosec | train | go,go |
b3f0ca10024ea7e31585d17d93472341c5115754 | diff --git a/test/marketing.unit.js b/test/marketing.unit.js
index <HASH>..<HASH> 100644
--- a/test/marketing.unit.js
+++ b/test/marketing.unit.js
@@ -1,6 +1,5 @@
'use strict';
-const errors = require('storj-service-error-types');
const chai = require('chai');
const expect = chai.expect;
const chaiDate = require('chai-datetime');
diff --git a/test/referral.unit.js b/test/referral.unit.js
index <HASH>..<HASH> 100644
--- a/test/referral.unit.js
+++ b/test/referral.unit.js
@@ -1,6 +1,5 @@
'use strict';
-const errors = require('storj-service-error-types');
const chai = require('chai');
const expect = chai.expect;
const chaiDate = require('chai-datetime'); | Remove error types. Accidentally added and removed on wrong files | storj_service-storage-models | train | js,js |
2c3344b8b72f0202d671c0abeccb73669f1539a8 | diff --git a/src/Symfony/Component/HttpKernel/Kernel.php b/src/Symfony/Component/HttpKernel/Kernel.php
index <HASH>..<HASH> 100644
--- a/src/Symfony/Component/HttpKernel/Kernel.php
+++ b/src/Symfony/Component/HttpKernel/Kernel.php
@@ -58,12 +58,12 @@ abstract class Kernel implements KernelInterface, TerminableInterface
protected $startTime;
protected $loadClassCache;
- const VERSION = '2.7.39';
- const VERSION_ID = 20739;
+ const VERSION = '2.7.40-DEV';
+ const VERSION_ID = 20740;
const MAJOR_VERSION = 2;
const MINOR_VERSION = 7;
- const RELEASE_VERSION = 39;
- const EXTRA_VERSION = '';
+ const RELEASE_VERSION = 40;
+ const EXTRA_VERSION = 'DEV';
const END_OF_MAINTENANCE = '05/2018';
const END_OF_LIFE = '05/2019'; | bumped Symfony version to <I> | symfony_symfony | train | php |
ce6a6fb2ce685a1f5960aae9ef34d5fcc06ecce1 | diff --git a/rxjava-core/src/test/java/rx/ObservableTests.java b/rxjava-core/src/test/java/rx/ObservableTests.java
index <HASH>..<HASH> 100644
--- a/rxjava-core/src/test/java/rx/ObservableTests.java
+++ b/rxjava-core/src/test/java/rx/ObservableTests.java
@@ -1027,4 +1027,29 @@ public class ObservableTests {
});
o.subscribe();
}
+
+ @Test
+ public void testTakeWhileToList() {
+ int[] nums = {1, 2, 3};
+ final AtomicInteger count = new AtomicInteger();
+ for(final int n: nums) {
+ Observable
+ .from(Boolean.TRUE, Boolean.FALSE)
+ .takeWhile(new Func1<Boolean, Boolean>() {
+ @Override
+ public Boolean call(Boolean value) {
+ return value;
+ }
+ })
+ .toList()
+ .doOnNext(new Action1<List<Boolean>>() {
+ @Override
+ public void call(List<Boolean> booleans) {
+ count.incrementAndGet();
+ }
+ })
+ .subscribe();
+ }
+ assertEquals(nums.length, count.get());
+ }
} | New test case for takeWhile that currently fails | ReactiveX_RxJava | train | java |
e7873093ada02ad6c9d6e190b7184775ab3686ce | diff --git a/lib/runner.js b/lib/runner.js
index <HASH>..<HASH> 100644
--- a/lib/runner.js
+++ b/lib/runner.js
@@ -334,6 +334,8 @@ Runner.prototype.run = function() {
pluginPostTestPromises.push(plugins.postTest(false, testInfo));
});
+ log.debug('Running with spec files ' + self.config_.specs);
+
return require(frameworkPath).run(self, self.config_.specs).
then(function(testResults) {
return q.all(pluginPostTestPromises).then(function(postTestResultList) { | chore(debugging): add info about current spec file list when troubleshooting
Running with the `--troubleshoot` flag will now list the spec files
for each runner instance. | angular_protractor | train | js |
9f0c7ff3fe3b0e7d53274ff05c53d4fd32908bb2 | diff --git a/nfc/dev/__init__.py b/nfc/dev/__init__.py
index <HASH>..<HASH> 100644
--- a/nfc/dev/__init__.py
+++ b/nfc/dev/__init__.py
@@ -34,6 +34,7 @@ usb_device_map = {
(0x04cc, 0x0531) : "pn53x_usb", # Philips demo board
(0x054c, 0x0193) : "pn53x_usb", # Sony demo board
(0x04cc, 0x2533) : "pn53x_usb", # NXP PN533 demo board
+ (0x04cc, 0x0531) : "pn53x_usb", # SCM SCL3710
(0x04e6, 0x5591) : "pn53x_usb", # SCM SCL3711
(0x04e6, 0x5593) : "pn53x_usb", # SCM SCL3712
(0x054c, 0x02e1) : "rcs956_usb", # Sony RC-S330/360/370 | added usb vendor/product id for SCM SCL<I> | nfcpy_nfcpy | train | py |
8d2a746f871ebd7f3bf70b5ccff2fa16bee6cd62 | diff --git a/Tests/AdminFactoryTest.php b/Tests/AdminFactoryTest.php
index <HASH>..<HASH> 100644
--- a/Tests/AdminFactoryTest.php
+++ b/Tests/AdminFactoryTest.php
@@ -96,7 +96,17 @@ class AdminFactoryTest extends Base
]
]);
$admin = $adminFactory->getAdminFromRequest($request);
+ // test fake admin name
+ $this->assertExceptionRaised('Exception', function () use ($adminFactory) {
+ $adminFactory->getAdmin('invalid_test');
+ });
+ $admin->createEntity();
$this->assertInstanceOf('BlueBear\AdminBundle\Admin\Admin', $admin, 'Admin not found in request');
+ $this->assertInstanceOf('BlueBear\AdminBundle\Admin\Admin', $adminFactory->getAdmin('test'), 'Invalid admin');
+ $this->assertEquals($admin, $adminFactory->getAdmin('test'), 'Invalid admin');
+ $this->assertEquals('test', $admin->getName(), 'Invalid admin name');
+ $this->assertEquals('Test\TestBundle\Entity\TestEntity', $admin->getEntityNamespace(), 'Invalid admin namespace');
+ $this->assertTrue($admin->getEntity() || count($admin->getEntities()), 'No entities were found');
}
protected function getFakeAdminsConfiguration() | Improve AdminFactory tests | larriereguichet_AdminBundle | train | php |
db1f6bcafa0bff6a35b37700cba5115177ec9d45 | diff --git a/MenuItem.php b/MenuItem.php
index <HASH>..<HASH> 100644
--- a/MenuItem.php
+++ b/MenuItem.php
@@ -876,7 +876,7 @@ class MenuItem implements \ArrayAccess, \Countable, \IteratorAggregate
{
$class[] = 'current';
}
- elseif ($this->getIsCurrent($depth))
+ elseif ($this->getIsCurrentAncestor($depth))
{
$class[] = 'current_ancestor';
}
@@ -1160,15 +1160,10 @@ class MenuItem implements \ArrayAccess, \Countable, \IteratorAggregate
*/
public function getIsCurrent()
{
- $currentUri = $this->getCurrentUri();
-
- if(null === $currentUri) {
- return false;
- }
-
- if ($this->isCurrent === null)
+ if (null === $this->isCurrent)
{
- $this->isCurrent = ($this->getUri() === $currentUri);
+ $currentUri = $this->getCurrentUri();
+ $this->isCurrent = null !== $currentUri && ($this->getUri() === $currentUri);
}
return $this->isCurrent; | Fix current item and ancestor item detection | KnpLabs_KnpMenuBundle | train | php |
d2df7584468485fd0bd4d5083792eb46825b9695 | diff --git a/azurerm/resource_arm_storage_account.go b/azurerm/resource_arm_storage_account.go
index <HASH>..<HASH> 100644
--- a/azurerm/resource_arm_storage_account.go
+++ b/azurerm/resource_arm_storage_account.go
@@ -505,6 +505,7 @@ func resourceArmStorageAccountRead(d *schema.ResourceData, meta interface{}) err
d.Set("enable_file_encryption", file.Enabled)
}
}
+ d.Set("account_encryption_source", string(encryption.KeySource))
}
// Computed | Ensuring we set the encryption source | terraform-providers_terraform-provider-azurerm | train | go |
4d6f4c09a9b80a6755e068dd318badc5d1492c17 | diff --git a/sos/report/plugins/foreman.py b/sos/report/plugins/foreman.py
index <HASH>..<HASH> 100644
--- a/sos/report/plugins/foreman.py
+++ b/sos/report/plugins/foreman.py
@@ -84,6 +84,7 @@ class Foreman(Plugin):
"/etc/foreman-proxy/",
"/etc/sysconfig/foreman",
"/etc/sysconfig/dynflowd",
+ "/etc/smart_proxy_dynflow_core/settings.yml",
"/etc/default/foreman",
"/etc/foreman-installer/",
"/var/log/foreman/dynflow_executor*log*", | [foreman] collect /etc/smart_proxy_dynflow_core/settings.yml
Resolves: #<I> | sosreport_sos | train | py |
74ee133f46600affd7cf78ee99f0029cf378828f | diff --git a/packages/ember-htmlbars/lib/helpers/-concat.js b/packages/ember-htmlbars/lib/helpers/-concat.js
index <HASH>..<HASH> 100644
--- a/packages/ember-htmlbars/lib/helpers/-concat.js
+++ b/packages/ember-htmlbars/lib/helpers/-concat.js
@@ -1,4 +1,9 @@
/**
+@module ember
+@submodule ember-templates
+*/
+
+/**
Concatenates input params together.
Example:
@@ -11,7 +16,7 @@
@public
@method concat
- @for Ember.HTMLBars
+ @for Ember.Templates.helpers
*/
export default function concat(params) {
return params.join(''); | [DOC release] move concat helper to the right spot | emberjs_ember.js | train | js |
3cd4c7c0ffc3e00004a238304e903a140fcbcd67 | diff --git a/activerecord/lib/active_record/associations.rb b/activerecord/lib/active_record/associations.rb
index <HASH>..<HASH> 100644
--- a/activerecord/lib/active_record/associations.rb
+++ b/activerecord/lib/active_record/associations.rb
@@ -1827,7 +1827,7 @@ module ActiveRecord
builder = Builder::HasAndBelongsToMany.new name, self, options
- join_model = builder.through_model
+ join_model = ActiveSupport::Deprecation.silence { builder.through_model }
const_set join_model.name, join_model
private_constant join_model.name
@@ -1856,7 +1856,7 @@ module ActiveRecord
hm_options[k] = options[k] if options.key? k
end
- has_many name, scope, hm_options, &extension
+ ActiveSupport::Deprecation.silence { has_many name, scope, hm_options, &extension }
_reflections[name.to_s].parent_reflection = habtm_reflection
end
end | Suppress deprecation message to `has_and_belongs_to_many` only once
Passing a class to `has_and_belongs_to_many` show deprecation message
three times. It is enough only once. | rails_rails | train | rb |
709c1f93d92236ab1c7514ac46ab96539497f1e4 | diff --git a/lib/assets/Asset.js b/lib/assets/Asset.js
index <HASH>..<HASH> 100644
--- a/lib/assets/Asset.js
+++ b/lib/assets/Asset.js
@@ -204,6 +204,9 @@ class Asset extends EventEmitter {
commonTargetType !== incomingRelation.targetType &&
!AssetGraph[commonTargetType].prototype[
'is' + incomingRelation.targetType
+ ] &&
+ !AssetGraph[incomingRelation.targetType].prototype[
+ 'is' + commonTargetType
]
) {
this._warnIncompatibleTypes([ | Don't complain that eg. an SVG is "used as both Image and Svg" | assetgraph_assetgraph | train | js |
e34e37d65012e563a41026c37f52c68ba36e4bab | diff --git a/currency.go b/currency.go
index <HASH>..<HASH> 100644
--- a/currency.go
+++ b/currency.go
@@ -9,6 +9,7 @@ type Currency struct {
Disabled int `json:"disabled"`
Frozen int `json:"frozen"`
Delisted int `json:"delisted"`
+ IsGeofenced int `json:"isGeofenced"`
}
type Currencies struct { | Add IsGeofenced field | jyap808_go-poloniex | train | go |
e3576426eaee63d297b20889c1dae8e624c57503 | diff --git a/app/models/staypuft/deployment/vips.rb b/app/models/staypuft/deployment/vips.rb
index <HASH>..<HASH> 100644
--- a/app/models/staypuft/deployment/vips.rb
+++ b/app/models/staypuft/deployment/vips.rb
@@ -2,7 +2,7 @@ module Staypuft
class Deployment::VIPS < Deployment::AbstractParamScope
VIP_NAMES = [:ceilometer, :cinder, :db, :glance, :heat, :horizon, :keystone, :loadbalancer,
- :nova, :neutron, :qpid, :swift]
+ :nova, :neutron, :amqp, :swift]
COUNT = VIP_NAMES.size
def self.param_scope | Rename :quid vip to :amqp vip | theforeman_staypuft | train | rb |
08bbcb42510ee353f6cbb7c4edae33665873ad28 | diff --git a/tests/integration/store/test_version_store.py b/tests/integration/store/test_version_store.py
index <HASH>..<HASH> 100644
--- a/tests/integration/store/test_version_store.py
+++ b/tests/integration/store/test_version_store.py
@@ -1005,6 +1005,10 @@ def test_write_metadata_followed_by_append(library):
library.write_metadata(symbol, metadata={'field_b': 1}) # creates version 2 (only metadata)
library.append(symbol, data=mydf_b,metadata={'field_c': 1}) # creates version 3
+ # Trigger GC now
+ library._prune_previous_versions(symbol, 0)
+ time.sleep(2)
+
v = library.read(symbol)
assert_frame_equal(v.data, mydf_a.append(mydf_b))
assert v.metadata == {'field_c': 1}
@@ -1139,6 +1143,10 @@ def test_restore_version_followed_by_append(library):
library.restore_version(symbol, as_of=1) # creates version 3
library.append(symbol, data=mydf_c, metadata={'field_c': 3}) # creates version 4
+ # Trigger GC now
+ library._prune_previous_versions(symbol, 0)
+ time.sleep(2)
+
v = library.read(symbol)
assert_frame_equal(v.data, mydf_a.append(mydf_c))
assert v.metadata == {'field_c': 3} | trigger gc in the tests after the append | manahl_arctic | train | py |
ae09e27716cc26038fccb4889347b8c2d3aa5904 | diff --git a/console-util/src/main/java/net/morimekta/console/chr/CharUtil.java b/console-util/src/main/java/net/morimekta/console/chr/CharUtil.java
index <HASH>..<HASH> 100644
--- a/console-util/src/main/java/net/morimekta/console/chr/CharUtil.java
+++ b/console-util/src/main/java/net/morimekta/console/chr/CharUtil.java
@@ -485,7 +485,7 @@ public class CharUtil {
if ((Character) c == Char.ESC) {
tmp.write(Char.ESC);
}
- tmp.write((Character) c);
+ tmp.write(new Unicode((Character) c).toString().getBytes(UTF_8));
} else if (c instanceof Integer) {
if ((Integer) c == (int) Char.ESC) {
tmp.write(Char.ESC);
@@ -499,6 +499,14 @@ public class CharUtil {
} else {
tmp.write(c.toString().getBytes(UTF_8));
}
+ } else if (c instanceof CharSequence) {
+ CharStream.stream((CharSequence) c).forEach(ch -> {
+ try {
+ tmp.write(ch.toString().getBytes(UTF_8));
+ } catch (IOException e) {
+ throw new UncheckedIOException(e);
+ }
+ });
} else {
tmp.write(c.toString().getBytes(UTF_8));
} | iValisate char and string input to ensure UTF-8 and control encoding. | morimekta_utils | train | java |
05ab0c1b648f614524bc84d6a77181c1619a222a | diff --git a/src/main/java/com/github/noraui/application/steps/MailSteps.java b/src/main/java/com/github/noraui/application/steps/MailSteps.java
index <HASH>..<HASH> 100644
--- a/src/main/java/com/github/noraui/application/steps/MailSteps.java
+++ b/src/main/java/com/github/noraui/application/steps/MailSteps.java
@@ -106,6 +106,7 @@ public class MailSteps extends Step {
Element link = doc.selectFirst(firstCssQuery);
try {
String response = httpService.get(link.attr("href"));
+ logger.debug("response is {}.", response);
} catch (HttpServiceException e) {
logger.error(Messages.format(Messages.getMessage(Messages.FAIL_MESSAGE_MAIL_ACTIVATION), subjectMail), e);
new Result.Failure<>("", Messages.format(Messages.getMessage(Messages.FAIL_MESSAGE_MAIL_ACTIVATION), subjectMail), false, Context.getCallBack(Callbacks.RESTART_WEB_DRIVER)); | Sonar: add logs on response (mail feature) | NoraUi_NoraUi | train | java |
ab162423c16f51ee4d8951ab535eaff090ed50d0 | diff --git a/lib/timer.js b/lib/timer.js
index <HASH>..<HASH> 100644
--- a/lib/timer.js
+++ b/lib/timer.js
@@ -125,6 +125,11 @@ timers.create(id, options, (err) => {
create(id, body, cb) {
const payload = body;
const transport = this.transports[payload.callback.transport];
+ if (!transport) {
+ const err = new Error(`Unknown transport ${payload.callback.transport}`)
+ err.code = 'ENOTRANSPORT'
+ return setImmediate(cb, err)
+ }
if ( this.has( id ) ) {
const err = new Error(`Timer with id ${id} already exists` );
err.code = 'EKEYEXISTS'; | timer: add error handler for case when a transport isn't defined | esatterwhite_skyring | train | js |
8d0020a666b26cbc577a19d82d3ae16153602f6f | diff --git a/ui/EditInlineNodeCommand.js b/ui/EditInlineNodeCommand.js
index <HASH>..<HASH> 100644
--- a/ui/EditInlineNodeCommand.js
+++ b/ui/EditInlineNodeCommand.js
@@ -17,7 +17,7 @@ class EditInlineNodeCommand extends Command {
let annos = this._getAnnotationsForSelection(params)
if (annos.length === 1 && annos[0].getSelection().equals(sel)) {
newState.disabled = false
- newState.node = annos[0]
+ newState.nodeId = annos[0].id
}
return newState
} | Use primitive command state for EditInlineCommand. | substance_substance | train | js |
996f393a86a3b472687759e9e9c188676d0e956b | diff --git a/src/transformers/tokenization_utils.py b/src/transformers/tokenization_utils.py
index <HASH>..<HASH> 100644
--- a/src/transformers/tokenization_utils.py
+++ b/src/transformers/tokenization_utils.py
@@ -22,6 +22,7 @@ import logging
import operator
import os
import re
+import warnings
from collections import UserDict, defaultdict
from contextlib import contextmanager
from typing import Any, Dict, List, NamedTuple, Optional, Sequence, Tuple, Union
@@ -822,7 +823,14 @@ class PreTrainedTokenizer(SpecialTokensMixin):
super().__init__(**kwargs)
# For backward compatibility we fallback to set model_max_length from max_len if provided
- model_max_length = model_max_length if model_max_length is not None else kwargs.pop("max_len", None)
+ if "max_len" in kwargs:
+ warnings.warn(
+ "Parameter max_len is deprecated and will be removed in a future release. "
+ "Use model_max_length instead.",
+ category=FutureWarning,
+ )
+
+ model_max_length = kwargs.pop("max_len")
self.model_max_length = model_max_length if model_max_length is not None else VERY_LARGE_INTEGER
# Padding side is right by default and overridden in subclasses. If specified in the kwargs, it is changed. | Warn the user about max_len being on the path to be deprecated. (#<I>)
* Warn the user about max_len being on the path to be deprecated.
* Ensure better backward compatibility when max_len is provided to a tokenizer.
* Make sure to override the parameter and not the actual instance value.
* Format & quality | huggingface_pytorch-pretrained-BERT | train | py |
c226833b01ac5b56c499344014fe6dc90d402681 | diff --git a/Model/Api.php b/Model/Api.php
index <HASH>..<HASH> 100644
--- a/Model/Api.php
+++ b/Model/Api.php
@@ -11,6 +11,7 @@
namespace MauticPlugin\MauticContactSourceBundle\Model;
+use Doctrine\DBAL\Connection;
use Doctrine\ORM\EntityManager;
use FOS\RestBundle\Util\Codes;
use Mautic\CampaignBundle\Entity\Campaign;
@@ -1834,10 +1835,19 @@ class Api
}
// Commit any MySQL changes and close the connection/s to prepare for a process fork.
+ /** @var Connection $connection */
$connection = $this->em->getConnection();
- if ($connection->isConnected()) {
- if ($connection->isTransactionActive()) {
- $connection->commit();
+ if ($connection) {
+ while (0 !== $connection->getTransactionNestingLevel()) {
+ // Check for RollBackOnly to avoid exceptions.
+ if (!$connection->isRollbackOnly()) {
+ // Follow behavior of the private commitAll method, in case there are nested transactions.
+ if (false === $connection->isAutoCommit() && 1 === $connection->getTransactionNestingLevel()) {
+ $connection->commit();
+ break;
+ }
+ $connection->commit();
+ }
}
$connection->close();
} | [ENG-<I>] Recursively commit nested transactions.
This code looks a little funky, but it’s following the pattern of the
DBAL connection logic as much as possible. I’m supporting
non-autocommit and rollback-only even though those modes *shouldn’t* be
used in this project. With this the buffer errors do not occur. | TheDMSGroup_mautic-contact-source | train | php |
2ecbf619b00af89634bd4d1eed557d1cde7a0e2b | diff --git a/orbiter.js b/orbiter.js
index <HASH>..<HASH> 100644
--- a/orbiter.js
+++ b/orbiter.js
@@ -266,7 +266,7 @@ Orbiter.prototype.setup = function () {
}
function onMouseDown (e) {
- const pos = offset(e, window)
+ const pos = offset(e, orbiter.element)
down(
pos[0],
pos[1],
@@ -275,7 +275,7 @@ Orbiter.prototype.setup = function () {
}
function onMouseMove (e) {
- const pos = offset(e, window)
+ const pos = offset(e, orbiter.element)
move(
pos[0],
pos[1], | Use position relative to orbiter element instead of window for offset computation | pex-gl_pex-renderer | train | js |
bcf9e505844843a9f88a25ff95f0301e6aec4210 | diff --git a/colly.go b/colly.go
index <HASH>..<HASH> 100644
--- a/colly.go
+++ b/colly.go
@@ -178,6 +178,7 @@ func (c *Collector) scrape(u, method string, depth int, requestData io.Reader, c
return err
}
req.Header.Set("User-Agent", c.UserAgent)
+
if ctx == nil {
ctx = NewContext()
}
@@ -369,8 +370,16 @@ func (c *Collector) checkRedirectFunc() func(req *http.Request, via []*http.Requ
return http.ErrUseLastResponse
}
+ lastRequest := via[len(via)-1]
+
// Copy the headers from last request
- req.Header = via[len(via)-1].Header
+ req.Header = lastRequest.Header
+
+ // If domain has changed, remove the Authorization-header if it exists
+ if req.URL.Host != lastRequest.URL.Host {
+ req.Header.Del("Authorization")
+ }
+
return nil
}
} | Removes the Authorization header if it exists and host has changed after a redirect | gocolly_colly | train | go |
2939b6b1a32629675942e2cfbd96f979884b2f24 | diff --git a/Eloquent/Relations/MorphPivot.php b/Eloquent/Relations/MorphPivot.php
index <HASH>..<HASH> 100644
--- a/Eloquent/Relations/MorphPivot.php
+++ b/Eloquent/Relations/MorphPivot.php
@@ -45,6 +45,10 @@ class MorphPivot extends Pivot
*/
public function delete()
{
+ if (isset($this->attributes[$this->getKeyName()])) {
+ return (int) parent::delete();
+ }
+
if ($this->fireModelEvent('deleting') === false) {
return 0;
} | [6.x] Fix missing statement preventing deletion (#<I>)
* Fix missing statement preventing deletion
The delete method was missing a statement which prevented the deletion of many to many polymorphic pivot models.
* style change | illuminate_database | train | php |
8d2f88cb528038b7427082a625dad95b7e1db6cb | diff --git a/service/routes/meta.js b/service/routes/meta.js
index <HASH>..<HASH> 100644
--- a/service/routes/meta.js
+++ b/service/routes/meta.js
@@ -7,8 +7,8 @@ const path = require('path');
const router = express.Router(); // eslint-disable-line new-cap
-const serviceInfo = Object.assign({}, require(path.join(__dirname, '../../about.json')), {
- appVersion: require(path.join(__dirname,'../../package.json')).version,
+const serviceInfo = Object.assign({}, require('../../about.json'), {
+ appVersion: require('../../package.json').version,
hostname: require("os").hostname(),
dateDeployed: require('graceful-fs').statSync(path.join(__dirname,'../../package.json')).mtime
}); | Require handles relative paths (#<I>) | Financial-Times_polyfill-service | train | js |
b7000481f28a606f59071eeba14bcd5e9640a3dd | diff --git a/lib/flipper/adapters/redis_cache.rb b/lib/flipper/adapters/redis_cache.rb
index <HASH>..<HASH> 100644
--- a/lib/flipper/adapters/redis_cache.rb
+++ b/lib/flipper/adapters/redis_cache.rb
@@ -148,7 +148,7 @@ module Flipper
return [] if keys.empty?
cache_keys = keys.map { |key| key_for(key) }
- @cache.mget(cache_keys).map do |value|
+ @cache.mget(*cache_keys).map do |value|
value ? Marshal.load(value) : nil
end
end | Spread cache keys when using `Redis#mget`
The [signature of `Redis#mget` actually requires a splatted array of keys to fetch](<URL> does not work with `redis-store`. This patch should fix that. | jnunemaker_flipper | train | rb |
844b88d93116e8ac871d497d0a9a1861585fea31 | diff --git a/tests/test_interface.rb b/tests/test_interface.rb
index <HASH>..<HASH> 100755
--- a/tests/test_interface.rb
+++ b/tests/test_interface.rb
@@ -1412,12 +1412,18 @@ class TestInterface < CiscoTestCase
assert_raises(Cisco::UnsupportedError) { i.ipv4_pim_sparse_mode = true }
return
end
+ begin
+ i.switchport_mode = :disabled
+ rescue Cisco::CliError => e
+ skip_message = 'Interface does not support switchport disable'
+ skip(skip_message) if e.message['requested config change not allowed']
+ raise
+ end
# Sample cli:
#
# interface Ethernet1/1
# ip pim sparse-mode
#
- i.switchport_mode = :disabled
i.ipv4_pim_sparse_mode = false
refute(i.ipv4_pim_sparse_mode) | Skip when intf does not support switchport disable | cisco_cisco-network-node-utils | train | rb |
de1ccf0eabf79f00101c0d865fc68fe3c90c2853 | diff --git a/lib/wasabi/core_ext/string.rb b/lib/wasabi/core_ext/string.rb
index <HASH>..<HASH> 100644
--- a/lib/wasabi/core_ext/string.rb
+++ b/lib/wasabi/core_ext/string.rb
@@ -5,9 +5,9 @@ module Wasabi
# Returns the String in snakecase.
def snakecase
str = dup
- str.gsub! /::/, '/'
- str.gsub! /([A-Z]+)([A-Z][a-z])/, '\1_\2'
- str.gsub! /([a-z\d])([A-Z])/, '\1_\2'
+ str.gsub!(/::/, '/')
+ str.gsub!(/([A-Z]+)([A-Z][a-z])/, '\1_\2')
+ str.gsub!(/([a-z\d])([A-Z])/, '\1_\2')
str.tr! ".", "_"
str.tr! "-", "_"
str.downcase!
diff --git a/lib/wasabi/document.rb b/lib/wasabi/document.rb
index <HASH>..<HASH> 100644
--- a/lib/wasabi/document.rb
+++ b/lib/wasabi/document.rb
@@ -25,7 +25,9 @@ module Wasabi
self.document = document
end
- attr_accessor :document, :request, :xml
+ attr_accessor :document, :request
+
+ attr_writer :xml
alias_method :document?, :document | Fixed the lines that caused warnings when running in debug mode | savonrb_wasabi | train | rb,rb |
e66aa2b43622f42b57007d8de9e70e21fa1cec4a | diff --git a/includes/class-freemius.php b/includes/class-freemius.php
index <HASH>..<HASH> 100755
--- a/includes/class-freemius.php
+++ b/includes/class-freemius.php
@@ -1712,6 +1712,16 @@
);
}
+ /**
+ * @author Leo Fajardo (@leorw)
+ * @since 1.2.3.1
+ *
+ * @return bool
+ */
+ private function is_network_activation_mode() {
+ return ( $this->_is_network_active && $this->is_activation_mode() );
+ }
+
/**
* Check if current page is the opt-in/pending-activation page.
*
@@ -4529,6 +4539,12 @@
return;
}
+ if ( ! is_network_admin() &&
+ $this->is_network_activation_mode()
+ ) {
+ return;
+ }
+
if ( $this->is_plugin_new_install() || $this->is_only_premium() ) {
// Show notice for new plugin installations.
$this->_admin_notices->add(
@@ -9495,7 +9511,9 @@
// return;
// }
- if ( ! $this->has_api_connectivity() && ! $this->is_enable_anonymous() ) {
+ if ( ( ! $this->has_api_connectivity() && ! $this->is_enable_anonymous() ) ||
+ ( ! is_network_admin() && $this->is_network_activation_mode() )
+ ) {
$this->_menu->remove_menu_item();
} else {
$this->do_action( 'before_admin_menu_init' ); | [multisite] [optin] [admin-notice] During network activation mode, do not show the optin screen and optin admin notice on the sites. | Freemius_wordpress-sdk | train | php |
4103ce96fb07bd04be535d2dc6dca5f743482644 | diff --git a/pandas/core/frame.py b/pandas/core/frame.py
index <HASH>..<HASH> 100644
--- a/pandas/core/frame.py
+++ b/pandas/core/frame.py
@@ -462,6 +462,9 @@ class DataFrame(NDFrame):
return com.console_encode(value)
return com.console_encode(buf.getvalue())
+ def _repr_html_(self):
+ return self.to_html()
+
def __iter__(self):
"""
Iterate over columns of the frame. | Add _repr_html method to make DataFrames nice in IPython notebook. | pandas-dev_pandas | train | py |
566bd3d854d47e49d89b3195e3e6ddd1f584b46b | diff --git a/lib/Gregwar/Image.php b/lib/Gregwar/Image.php
index <HASH>..<HASH> 100644
--- a/lib/Gregwar/Image.php
+++ b/lib/Gregwar/Image.php
@@ -468,7 +468,7 @@ class Image
$this->save($file, $type, $quality);
}
- return $this->getFilename($this->file);
+ return $this->getFilename($file);
}
/** | Fix a mistake on file caching | Gregwar_Image | train | php |
260f5ca328b1a626102917e27e660a6491bbb879 | diff --git a/src/crypto.js b/src/crypto.js
index <HASH>..<HASH> 100644
--- a/src/crypto.js
+++ b/src/crypto.js
@@ -2,9 +2,9 @@ var crypto = require('crypto');
function base64UrlSafeEncode(string) {
return string.toString('base64')
- .replace(/\+/g, '-')
- .replace(/\//g, '_')
- .replace(/=/g, '');
+ .replace(/\+/g, '-')
+ .replace(/\//g, '_')
+ .replace(/=/g, '');
}
function sha256(buffer) { | fix linter indentation issues | auth0_auth0-cordova | train | js |
2c4b106d281ed22c7fa5bf20d85cf133139633fb | diff --git a/message.go b/message.go
index <HASH>..<HASH> 100644
--- a/message.go
+++ b/message.go
@@ -169,7 +169,7 @@ func ParseMessage(raw string) (m *Message) {
j = i + strings.IndexByte(raw[i:], space)
// Extract command
- if j > 0 {
+ if j > i {
m.Command = raw[i:j]
} else {
m.Command = raw[i:] | Fix panic when parsing messages with only a command. | sorcix_irc | train | go |
048a3669b8fc9e4f3fb0fabdf805ab0f02a7a1c9 | diff --git a/lib/gcli/ui/view.js b/lib/gcli/ui/view.js
index <HASH>..<HASH> 100644
--- a/lib/gcli/ui/view.js
+++ b/lib/gcli/ui/view.js
@@ -77,6 +77,7 @@ exports.createView = function(options) {
*/
exports.populateWithOutputData = function(outputData, element) {
util.clearElement(element);
+ var document = element.ownerDocument;
var output = outputData.output;
if (output == null) {
@@ -88,16 +89,16 @@ exports.populateWithOutputData = function(outputData, element) {
node = output;
}
else if (output.isView) {
- node = output.toDom(element.ownerDocument);
+ node = output.toDom(document);
}
else {
if (outputData.command.returnType === 'terminal') {
- node = util.createElement(element.ownerDocument, 'textarea');
+ node = util.createElement(document, 'textarea');
node.classList.add('gcli-row-terminal');
node.readOnly = true;
}
else {
- node = util.createElement(element.ownerDocument, 'p');
+ node = util.createElement(document, 'p');
}
util.setContents(node, output.toString()); | Bug <I> (intro): Don't lookup element.ownerDocument repeatedly | joewalker_gcli | train | js |
7266c96297697827ed9f8da85656300b6fdcc3d8 | diff --git a/lib/proxy.js b/lib/proxy.js
index <HASH>..<HASH> 100644
--- a/lib/proxy.js
+++ b/lib/proxy.js
@@ -68,15 +68,10 @@ function proxyRequest(req, res, rule) {
};
// get a ProxyServer from the cache
- router = createRouter(target);
-
- // handle any errors returned by the target server
- router.on('error', errorCallback);
+ router = createRouter(target);
// proxy the request
- router.web(req, res);
-
- router.removeListener('error', errorCallback);
+ router.web(req, res, errorCallback);
}
// factory method to cache/fetch HttpProxy instances | fix for handling network errors when proxying | steve-jansen_json-proxy | train | js |
fd0cb73550caebd70079f369317822643ae00d31 | diff --git a/tests/test_simulator.py b/tests/test_simulator.py
index <HASH>..<HASH> 100644
--- a/tests/test_simulator.py
+++ b/tests/test_simulator.py
@@ -47,7 +47,7 @@ class TestSimulationCell(unittest.TestCase):
self.assertTupleEqual(state_size, sz)
def test_interm_size(self):
- expected = [((8,), (8,), (8,)), ()]
+ expected = [((8,), (8,), (8,), (8,)), ()]
cells = [self.cell1, self.cell2]
for cell, sz in zip(cells, expected):
interm_size = cell.interm_size | Refactor test_simualtor to handle changed Reservoir domain | thiagopbueno_tf-rddlsim | train | py |
7ccf4936ae9d22968feba11b18e082e3a3e17216 | diff --git a/core/Pimf/Util/Validator.php b/core/Pimf/Util/Validator.php
index <HASH>..<HASH> 100644
--- a/core/Pimf/Util/Validator.php
+++ b/core/Pimf/Util/Validator.php
@@ -298,7 +298,7 @@ class Validator
$func = function($a,$b) use ($operator) {
switch ($operator){
case "<":
- return ($a > $b);
+ return ($a < $b);
case ">":
return ($a > $b);
case "==": | fix: refactoring of create_function() | gjerokrsteski_pimf-framework | train | php |
2c118356126228801bce0f49921a834eca89562a | diff --git a/pkg/kubectl/resource/builder.go b/pkg/kubectl/resource/builder.go
index <HASH>..<HASH> 100644
--- a/pkg/kubectl/resource/builder.go
+++ b/pkg/kubectl/resource/builder.go
@@ -587,8 +587,16 @@ func (b *Builder) Do() *Result {
return r
}
+// SplitResourceArgument splits the argument with commas and returns unique
+// strings in the original order.
func SplitResourceArgument(arg string) []string {
+ out := []string{}
set := util.NewStringSet()
- set.Insert(strings.Split(arg, ",")...)
- return set.List()
+ for _, s := range strings.Split(arg, ",") {
+ if set.Has(s) {
+ continue
+ }
+ out = append(out, s)
+ }
+ return out
} | `kubectl get rc,pods` should invoke in that order
SplitResourceArguments should not use a golang map | kubernetes_kubernetes | train | go |
f97594cc7b37a7602b1b7634486b92a028ed287e | diff --git a/DataGrid/Extension/View/ColumnTypeExtension/ColumnViewOptionsExtension.php b/DataGrid/Extension/View/ColumnTypeExtension/ColumnViewOptionsExtension.php
index <HASH>..<HASH> 100644
--- a/DataGrid/Extension/View/ColumnTypeExtension/ColumnViewOptionsExtension.php
+++ b/DataGrid/Extension/View/ColumnTypeExtension/ColumnViewOptionsExtension.php
@@ -55,6 +55,22 @@ class ColumnViewOptionsExtension extends ColumnAbstractTypeExtension
/**
* {@inheritDoc}
*/
+ public function setDefaultOptions(ColumnTypeInterface $column)
+ {
+ $column->getOptionsResolver()->setDefaults(array(
+ 'translation_domain' => null,
+ ));
+
+ $column->getOptionsResolver()->setAllowedTypes(array(
+ 'translation_domain' => array(
+ 'string' ,
+ 'null'
+ ),
+ ));
+ }
+
+ /**
+ * {@inheritDoc}
public function getDefaultOptionsValues(ColumnTypeInterface $column)
{
return array(
@@ -64,9 +80,9 @@ class ColumnViewOptionsExtension extends ColumnAbstractTypeExtension
/**
* {@inheritDoc}
- */
public function getAvailableOptions(ColumnTypeInterface $column)
{
return array('translation_domain');
}
+ */
}
\ No newline at end of file | Added OptionsResolver to handle column extension options | fsi-open_datagrid-bundle | train | php |
6c8fcb3af252f6dfc76021b5acb10ac672dd8ca4 | diff --git a/models/wiki.go b/models/wiki.go
index <HASH>..<HASH> 100644
--- a/models/wiki.go
+++ b/models/wiki.go
@@ -76,7 +76,9 @@ func (repo *Repository) LocalWikiPath() string {
// UpdateLocalWiki makes sure the local copy of repository wiki is up-to-date.
func (repo *Repository) UpdateLocalWiki() error {
- return UpdateLocalCopyBranch(repo.WikiPath(), repo.LocalWikiPath(), "master")
+ // Don't pass branch name here because it fails to clone and
+ // checkout to a specific branch when wiki is an empty repository.
+ return UpdateLocalCopyBranch(repo.WikiPath(), repo.LocalWikiPath(), "")
}
func discardLocalWikiChanges(localPath string) error { | #<I> fix clone fail when wiki is empty | gogs_gogs | train | go |
0257f99b42695384ac08fe613fdba43e7abc2bc2 | diff --git a/WebPConvert.php b/WebPConvert.php
index <HASH>..<HASH> 100755
--- a/WebPConvert.php
+++ b/WebPConvert.php
@@ -224,25 +224,14 @@ class WebPConvert
}
// Save converters in the `Converters` directory to array ..
- $files = array_filter(scandir(__DIR__ . '/Converters'), function ($file) {
- return is_file($file);
- });
+ $files = array_map(function($e) { return basename($e, '.php'); }, glob(__DIR__ . '/Converters/*.php'));
// .. and merge it with the $converters array, keeping the updated order of execution
foreach ($files as $file) {
- if (is_dir('Converters/' . $file)) {
- if ($file == '.') {
- continue;
- }
- if ($file == '..') {
- continue;
- }
- if (in_array($file, $converters)) {
- continue;
- }
-
- $converters[] = $file;
+ if (in_array($file, $converters)) {
+ continue;
}
+ $converters[] = $file;
}
self::logMessage('Order of converters to be tried: <i>' . implode('</i>, <i>', $converters) . '</i>'); | Fixing array
.. so it only contains filenames, thus making directory check obsolete | rosell-dk_webp-convert | train | php |
3fedd8524c9419ed31b3a65e31bcb62000c2d7d2 | diff --git a/web3/main.py b/web3/main.py
index <HASH>..<HASH> 100644
--- a/web3/main.py
+++ b/web3/main.py
@@ -169,7 +169,7 @@ class Web3(object):
def positive_int_to_hex(value, bit_size=None):
hex_value = remove_0x_prefix(hex(value))
if bit_size:
- return hex_value.zfill(bit_size / 4)
+ return hex_value.zfill(int(bit_size / 4))
return ('0' * (len(hex_value) % 2)) + hex_value | [issue <I>] cast arg to int for python3 testing error | ethereum_web3.py | train | py |
3b7ef5e1e896a3845af23ac72d643610732b8533 | diff --git a/docs/src/pages/versions/LatestVersion.js b/docs/src/pages/versions/LatestVersion.js
index <HASH>..<HASH> 100644
--- a/docs/src/pages/versions/LatestVersion.js
+++ b/docs/src/pages/versions/LatestVersion.js
@@ -33,7 +33,7 @@ function LatestVersion(props) {
<Link
{...props2}
variant="secondary"
- href="https://material-ui-ci.netlify.com/"
+ href="https://material-ui.netlify.com/"
/>
)}
> | [docs] Update master branch docs preview URL | mui-org_material-ui | train | js |
399623fe9ee40f9e692d8b31e58c59f0641aecdd | diff --git a/factory/src/test/java/com/google/auto/factory/processor/AutoFactoryProcessorTest.java b/factory/src/test/java/com/google/auto/factory/processor/AutoFactoryProcessorTest.java
index <HASH>..<HASH> 100644
--- a/factory/src/test/java/com/google/auto/factory/processor/AutoFactoryProcessorTest.java
+++ b/factory/src/test/java/com/google/auto/factory/processor/AutoFactoryProcessorTest.java
@@ -129,7 +129,7 @@ public class AutoFactoryProcessorTest {
.processedWith(new AutoFactoryProcessor())
.failsToCompile()
.withErrorContaining("AutoFactory does not support generic types")
- .in(file).onLine(6).atColumn(14);
+ .in(file).onLine(21).atColumn(14);
}
@Test public void providedButNoAutoFactory() { | Fix a line number on a test | google_auto | train | java |
7da523f3362dc26f74015b41f7bce392b3189129 | diff --git a/lib/ohai/plugins/python.rb b/lib/ohai/plugins/python.rb
index <HASH>..<HASH> 100644
--- a/lib/ohai/plugins/python.rb
+++ b/lib/ohai/plugins/python.rb
@@ -19,16 +19,12 @@
require_plugin "languages"
output = nil
+python = Mash.new
status = popen4("python -c \"import sys; print sys.version\"") do |pid, stdin, stdout, stderr|
stdin.close
output = stdout.gets.split if stdout
+ python[:version] = output[0]
+ python[:builddate] = "%s %s %s %s" % [output[2],output[3],output[4],output[5].gsub!(/\)/,'')]
end
-if status == 0
- languages[:python] = Mash.new
- version = output[0]
- builddate = "%s %s %s %s" % [output[2],output[3],output[4],output[5].gsub!(/\)/,'')]
- languages[:python][:version] = version
- languages[:python][:builddate] = builddate
-end
-
+languages[:python] = python if python[:version] and python[:builddate] | make the python plugin match the java plugin in style a little more closely | chef_ohai | train | rb |
3c867c3ace61fec33089d88cda89a8d04901324c | diff --git a/src/DigitalOcean/CLI/SSHKeys/AddCommand.php b/src/DigitalOcean/CLI/SSHKeys/AddCommand.php
index <HASH>..<HASH> 100644
--- a/src/DigitalOcean/CLI/SSHKeys/AddCommand.php
+++ b/src/DigitalOcean/CLI/SSHKeys/AddCommand.php
@@ -29,7 +29,7 @@ class AddCommand extends Command
{
$this
->setName('ssh-keys:add')
- ->addArgument('name', InputArgument::REQUIRED, 'The SSH key id')
+ ->addArgument('name', InputArgument::REQUIRED, 'The name of the new SSH key')
->addArgument('ssh_pub_key', InputArgument::REQUIRED, 'The SSH key string')
->setDescription('Add a new public SSH key to your account')
->addOption('credentials', null, InputOption::VALUE_REQUIRED, | Updated: add command help text in CLI | toin0u_DigitalOcean | train | php |
35f0b15707a4a03c6de24d29ce4ed953196eed6a | diff --git a/gdown/download.py b/gdown/download.py
index <HASH>..<HASH> 100644
--- a/gdown/download.py
+++ b/gdown/download.py
@@ -106,7 +106,7 @@ def download(url, output, quiet):
pbar.close()
if tmp_file:
f.close()
- shutil.copy(tmp_file, output)
+ shutil.move(tmp_file, output)
except IOError as e:
print(e, file=sys.stderr)
return | Move tmp file instead of copying | wkentaro_gdown | train | py |
3294654c210ef32b5760de98b8fb28baecc262f9 | diff --git a/andes/core/model/model.py b/andes/core/model/model.py
index <HASH>..<HASH> 100644
--- a/andes/core/model/model.py
+++ b/andes/core/model/model.py
@@ -1323,7 +1323,7 @@ class Model:
def post_init_check(self):
"""
- Post init checking. Warns if values of `InitChecker` is not True.
+ Post init checking. Warns if values of `InitChecker` are not True.
"""
self.get_inputs(refresh=True) | A minor grammatical error was corrected. | cuihantao_andes | train | py |
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.