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 |
|---|---|---|---|---|---|
5787a3978c1a6d88a5946c5c092ce8d752feff85 | diff --git a/lib/ffaker/version.rb b/lib/ffaker/version.rb
index <HASH>..<HASH> 100644
--- a/lib/ffaker/version.rb
+++ b/lib/ffaker/version.rb
@@ -2,7 +2,7 @@ module Faker #:nodoc:
module VERSION #:nodoc:
MAJOR = 0
MINOR = 3
- TINY = 4
+ TINY = 5
STRING = [MAJOR, MINOR, TINY].join('.')
end | oops, forgot to update the version | ffaker_ffaker | train | rb |
c501eeb5a2ee164e656742903953cc93e45a9da9 | diff --git a/pyrogram/__init__.py b/pyrogram/__init__.py
index <HASH>..<HASH> 100644
--- a/pyrogram/__init__.py
+++ b/pyrogram/__init__.py
@@ -23,7 +23,7 @@ __copyright__ = "Copyright (C) 2017-2018 Dan Tès <https://github.com/delivrance
"e" if sys.getfilesystemencoding() != "utf-8" else "\xe8"
)
__license__ = "GNU Lesser General Public License v3 or later (LGPLv3+)"
-__version__ = "0.7.6dev1"
+__version__ = "0.8.0dev1"
from .api.errors import Error
from .client.types import ( | Update to <I>dev1
There are a quite lot of changes it deserves a new "minor" update. | pyrogram_pyrogram | train | py |
cbc27f03c8b5cc140f648c42976722a0ccc9cc52 | diff --git a/peppy/project.py b/peppy/project.py
index <HASH>..<HASH> 100644
--- a/peppy/project.py
+++ b/peppy/project.py
@@ -1179,7 +1179,7 @@ class Project(PathExAttMap):
st = self[SAMPLE_TABLE_FILE_KEY]
else:
if CONFIG_KEY not in self:
- _LOGGER.warning("No config key in Project")
+ _LOGGER.info("No config key in Project, or reading project from dict")
return
if CFG_SAMPLE_TABLE_KEY not in self[CONFIG_KEY]:
_LOGGER.debug("no {} found".format(CFG_SAMPLE_TABLE_KEY)) | Deleted warning, if project is empty | pepkit_peppy | train | py |
fc859f0306b7a11df468095a1997e77a74c7e352 | diff --git a/pyontutils/ilx_utils.py b/pyontutils/ilx_utils.py
index <HASH>..<HASH> 100755
--- a/pyontutils/ilx_utils.py
+++ b/pyontutils/ilx_utils.py
@@ -196,7 +196,6 @@ def readFile(filename, existing):
#ilxAddTempId(qn, ontid=mg.ontid)
if qn in existing:
existing[qn]['files'].append(filename)
- existing[qn]['rec'].update(rec) # XXX probably want warnings on change here, esp if from something to nothing...
newrec = {}
for k, v in existing[qn]['rec'].items():
if v: | ilx utils yep it was indeed that obvious | tgbugs_pyontutils | train | py |
a793e1308ea688d0a55c60619ef803b327760b9f | diff --git a/holoviews/plotting/raster.py b/holoviews/plotting/raster.py
index <HASH>..<HASH> 100644
--- a/holoviews/plotting/raster.py
+++ b/holoviews/plotting/raster.py
@@ -33,7 +33,7 @@ class RasterPlot(ElementPlot):
def __init__(self, *args, **kwargs):
super(RasterPlot, self).__init__(*args, **kwargs)
if self.map.type == Raster:
- self.invert_yaxis = True
+ self.invert_yaxis = not self.invert_yaxis
def get_extents(self, view, ranges): | Inverted RasterPlot.invert_yaxis for Raster plotting | pyviz_holoviews | train | py |
00102fd62e7ce534f4accf4697542e4e54a20d32 | diff --git a/phpfastcache/3.0.0/drivers/files.php b/phpfastcache/3.0.0/drivers/files.php
index <HASH>..<HASH> 100644
--- a/phpfastcache/3.0.0/drivers/files.php
+++ b/phpfastcache/3.0.0/drivers/files.php
@@ -118,7 +118,7 @@ class phpfastcache_files extends BasePhpFastCache implements phpfastcache_drive
function driver_delete($keyword, $option = array()) {
$file_path = $this->getFilePath($keyword,true);
- if(@unlink($file_path)) {
+ if(file_exists($file_path) && @unlink($file_path)) {
return true;
} else {
return false; | add file_exists check for cache delete
need to eliminate php warnings | PHPSocialNetwork_phpfastcache | train | php |
b787cdd52b332be978d696433fc205ce2ccfdc9d | diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -2,11 +2,13 @@
from setuptools import setup, find_packages
+version_t=None
+
with open("__conda_version__.h") as w:
for line in w:
version_t=line.strip()
-if None in version:
+if version_t is None:
print("Failed to get version number in setup.py.")
raise | Correct error handling in setup.py. | jochym_Elastic | train | py |
59804d8f5f6ab652f597f3132781c9d27ca7c70a | diff --git a/jaraco/util/itertools.py b/jaraco/util/itertools.py
index <HASH>..<HASH> 100644
--- a/jaraco/util/itertools.py
+++ b/jaraco/util/itertools.py
@@ -198,10 +198,15 @@ class islice(object):
"""May be applied to an iterable to limit the number of items returned.
Works similarly to count, except is called only once on an iterable.
Functionality is identical to islice, except for __str__ and reusability.
+
>>> tuple(islice(5).apply(range(20)))
(0, 1, 2, 3, 4)
+
>>> tuple(islice(None).apply(range(20)))
(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19)
+
+ >>> print(islice(3, 10, 2))
+ every 2nd item from 4 to 10
"""
def __init__(self, *sliceArgs):
self.sliceArgs = sliceArgs | Capture expectation of _formatArgs. | jaraco_jaraco.itertools | train | py |
6453aa38f8ea2cc924e06cad8e98fb23b89049c4 | diff --git a/bonsai/model.py b/bonsai/model.py
index <HASH>..<HASH> 100644
--- a/bonsai/model.py
+++ b/bonsai/model.py
@@ -533,6 +533,10 @@ class CodeGlobalScope(CodeEntity):
for codeobj in self.children
)
+ def __repr__(self):
+ """Return a string representation of this object."""
+ return 'CodeGlobalScope({})'.format(self.children)
+
# ----- Expression Entities ---------------------------------------------------
diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -8,7 +8,7 @@ def read(fname):
setup(
name = "bonsai-code",
- version = "0.4.5",
+ version = "0.4.6",
author = "Andre Santos",
author_email = "andre.f.santos@inesctec.pt",
description = "Static analysis library.", | fixed CodeGlobalScope having no repr string | git-afsantos_bonsai | train | py,py |
51aaaaf1ed2f567f2d58f2c86144c741c9049b18 | diff --git a/cli/api/daemon.go b/cli/api/daemon.go
index <HASH>..<HASH> 100644
--- a/cli/api/daemon.go
+++ b/cli/api/daemon.go
@@ -817,12 +817,12 @@ func (d *daemon) startAgent() error {
updatedHost, err := host.UpdateHostInfo(*myHost)
if err != nil {
log.WithError(err).Warn("Unable to acquire delegate host information")
- return poolID
+ return "" // Try again
}
err = masterClient.UpdateHost(updatedHost)
if err != nil {
log.WithError(err).Warn("Unable to update master with delegate host information")
- return poolID
+ return "" // Try again
}
log.Info("Updated master with delegate host information")
return poolID | Keep trying to update host info on startup | control-center_serviced | train | go |
42c62a7a344e2139f285c571930d179866167bd5 | diff --git a/ez_setup.py b/ez_setup.py
index <HASH>..<HASH> 100644
--- a/ez_setup.py
+++ b/ez_setup.py
@@ -30,7 +30,7 @@ try:
except ImportError:
USER_SITE = None
-DEFAULT_VERSION = "15.2"
+DEFAULT_VERSION = "15.3"
DEFAULT_URL = "https://pypi.python.org/packages/source/s/setuptools/"
DEFAULT_SAVE_DIR = os.curdir
diff --git a/setuptools/version.py b/setuptools/version.py
index <HASH>..<HASH> 100644
--- a/setuptools/version.py
+++ b/setuptools/version.py
@@ -1 +1 @@
-__version__ = '15.2'
+__version__ = '15.3' | Bumped to <I> in preparation for next release. | pypa_setuptools | train | py,py |
b5a78fd826aa1d3e3a45cbee4bcb24a86bff8adf | diff --git a/zcl/diagnostic.go b/zcl/diagnostic.go
index <HASH>..<HASH> 100644
--- a/zcl/diagnostic.go
+++ b/zcl/diagnostic.go
@@ -84,3 +84,14 @@ func (d Diagnostics) Append(diag *Diagnostic) Diagnostics {
func (d Diagnostics) Extend(diags Diagnostics) Diagnostics {
return append(d, diags...)
}
+
+// HasErrors returns true if the receiver contains any diagnostics of
+// severity DiagError.
+func (d Diagnostics) HasErrors() bool {
+ for _, diag := range d {
+ if diag.Severity == DiagError {
+ return true
+ }
+ }
+ return false
+} | Helper for determining if a Diagnostics contains errors
Checking if it's non-nil, as we would for Go errors, doesn't work here
because there may be warnings. | hashicorp_hcl | train | go |
acadcc1f17a8aaac2b931629270486d1ddad04b2 | diff --git a/examples/PaymentExample.php b/examples/PaymentExample.php
index <HASH>..<HASH> 100644
--- a/examples/PaymentExample.php
+++ b/examples/PaymentExample.php
@@ -2,10 +2,10 @@
/**
* This file is part of the PHP Rebilly API package.
*
- * (c) Veaceslav Medvedev <slavcopost@gmail.com>
- *
- * For the full copyright and license information, please view the LICENSE.md
+ * For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
+ *
+ * @see http://rebilly.com
*/
namespace Rebilly\Test;
@@ -18,9 +18,6 @@ use RebillyHttpStatusCode;
/**
* Class PaymentExample.
- *
- * @author Veaceslav Medvedev <slavcopost@gmail.com>
- * @version 0.1
*/
final class PaymentExample
{ | Update PaymentExample docs | Rebilly_rebilly-php | train | php |
8edef828e9e936bbe3135137e1ba4084f003e3f8 | diff --git a/gbdxtools/images/ipe_image.py b/gbdxtools/images/ipe_image.py
index <HASH>..<HASH> 100644
--- a/gbdxtools/images/ipe_image.py
+++ b/gbdxtools/images/ipe_image.py
@@ -41,7 +41,4 @@ class IpeImage(DaskImage, Container):
return super(IpeImage, self).__getitem__(geometry)
def __contains__(self, geometry):
- if isinstance(geometry, BaseGeometry):
- return shape(self).contains(geometry)
- else:
- return shape(self).contains(shape(geometry))
+ return shape(self).contains(shape(geometry)) | shape called on geometry works just fine, no need to do the BaseGeometry check | DigitalGlobe_gbdxtools | train | py |
7891337ae8d082c7ff0487ff51a54d7013ade47e | diff --git a/swipe.js b/swipe.js
index <HASH>..<HASH> 100644
--- a/swipe.js
+++ b/swipe.js
@@ -32,7 +32,7 @@ function Swipe(container, options) {
options = options || {};
var index = parseInt(options.startSlide, 10) || 0;
var speed = options.speed || 300;
- options.continuous = options.continuous ? options.continuous : true;
+ options.continuous = options.continuous !== undefined ? options.continuous : true;
function setup() { | Fix bug causing continuous to always be true. | lyfeyaj_swipe | train | js |
ac2076a68e8ed015966364daf7d6a1ba0f8ca1ad | diff --git a/test.py b/test.py
index <HASH>..<HASH> 100755
--- a/test.py
+++ b/test.py
@@ -12,10 +12,11 @@ try:
except ImportError:
# required for python3
# python2.7 works with this module too!
- try:
+ if sys.version_info >= (2, 1, 7):
import unittest
- except ImportError:
+ else:
print("Please install unittest2 from pypi to run tests!")
+ sys.exit(1)
# Alternate this to your setup
# Make sure you have at least one song on your playlist | test.py print error if unittest module is too old
Before it only test, if unittest is avaible, which will always be the
case. | Mic92_python-mpd2 | train | py |
13d72f5ba9c1fcc7a8d5de1d9560412281b916eb | diff --git a/js/stringProcessing/getSentences.js b/js/stringProcessing/getSentences.js
index <HASH>..<HASH> 100644
--- a/js/stringProcessing/getSentences.js
+++ b/js/stringProcessing/getSentences.js
@@ -140,7 +140,7 @@ function getSentencesFromTokens( tokens ) {
// Only split on sentence delimiters when the next sentence looks like the start of a sentence.
if (
( hasNextSentence && ( isCapitalLetter( nextSentenceStart ) || isNumber( nextSentenceStart ) ) )
- || ( nextToken && ( "html-start" === nextToken.type || "html-end" === nextToken.type ) )
+ || ( ! isUndefined( nextToken ) && ( "html-start" === nextToken.type || "html-end" === nextToken.type ) )
) {
tokenSentences.push( currentSentence );
currentSentence = "";
@@ -174,8 +174,7 @@ function getSentencesFromTokens( tokens ) {
function getSentencesFromBlock( block ) {
var tokens = tokenizeSentences( block );
- return getSentencesFromTokens( tokens );
-
+ return tokens.length === 0 ? [] : getSentencesFromTokens( tokens );
}
var getSentencesFromBlockCached = memoize( getSentencesFromBlock ); | Fix error when there are not tokens | Yoast_YoastSEO.js | train | js |
733f1ca77e707d9207a2cdec05c1c140b452b118 | diff --git a/webpack.common.js b/webpack.common.js
index <HASH>..<HASH> 100644
--- a/webpack.common.js
+++ b/webpack.common.js
@@ -7,7 +7,11 @@ const webpack = require('webpack');
module.exports = (argv) => ({
entry: './src/mojs.babel.js',
output: {
- path: path.resolve(__dirname, 'dist')
+ path: path.resolve(__dirname, 'dist'),
+ library: 'mojs',
+ libraryExport: 'default',
+ libraryTarget: 'umd',
+ umdNamedDefine: true
},
resolve: {
extensions: [
diff --git a/webpack.umd.js b/webpack.umd.js
index <HASH>..<HASH> 100644
--- a/webpack.umd.js
+++ b/webpack.umd.js
@@ -11,11 +11,7 @@ module.exports = (argv) => merge(require('./webpack.common.js')(argv), {
mode: 'production',
watch: false,
output: {
- filename: 'mo.umd.js',
- library: 'mojs',
- libraryExport: 'default',
- libraryTarget: 'umd',
- umdNamedDefine: true
+ filename: 'mo.umd.js'
},
optimization: {
minimizer: [ | Use UMD build on the common webpack configuration | mojs_mojs | train | js,js |
430b17271343d7db90dca351de89fa1a1a60bb26 | diff --git a/scripts/validate_docstrings.py b/scripts/validate_docstrings.py
index <HASH>..<HASH> 100755
--- a/scripts/validate_docstrings.py
+++ b/scripts/validate_docstrings.py
@@ -610,11 +610,11 @@ def main(func_name, fd):
fd.write('{}\n'.format(doc_info['docstring']))
fd.write(header('Validation'))
if doc_info['errors']:
- fd.write('Errors found:\n')
+ fd.write('{} Errors found:\n'.format(len(doc_info['errors'])))
for err in doc_info['errors']:
fd.write('\t{}\n'.format(err))
if doc_info['warnings']:
- fd.write('Warnings found:\n')
+ fd.write('{} Warnings found:\n'.format(len(doc_info['warnings'])))
for wrn in doc_info['warnings']:
fd.write('\t{}\n'.format(wrn)) | add number of Errors, Warnings to scripts/validate_docstrings.py (#<I>) | pandas-dev_pandas | train | py |
9fb32418a7c611ee2cb3053995d5db5b1faa1e96 | diff --git a/question/type/shortanswer/questiontype.php b/question/type/shortanswer/questiontype.php
index <HASH>..<HASH> 100644
--- a/question/type/shortanswer/questiontype.php
+++ b/question/type/shortanswer/questiontype.php
@@ -97,7 +97,6 @@ class question_shortanswer_qtype extends default_questiontype {
}
function print_question_formulation_and_controls(&$question, &$state, $cmoptions, $options) {
- global $CFG;
/// This implementation is also used by question type 'numerical'
$readonly = empty($options->readonly) ? '' : 'readonly="readonly"';
$formatoptions = new stdClass;
@@ -144,7 +143,12 @@ class question_shortanswer_qtype extends default_questiontype {
}
/// Removed correct answer, to be displayed later MDL-7496
- include("$CFG->dirroot/question/type/shortanswer/display.html");
+ include($this->get_display_html_path());
+ }
+
+ function get_display_html_path() {
+ global $CFG;
+ return $CFG->dirroot.'/question/type/shortanswer/display.html';
}
function check_response(&$question, &$state) { | qtype shortanswer MDL-<I> small refactoring to help subclasses. Thanks to Oleg Sychev. | moodle_moodle | train | php |
370d7c8a22010dc37ced5be5d4ecf52975fd1cd1 | diff --git a/plugins/PluginCertInfo.py b/plugins/PluginCertInfo.py
index <HASH>..<HASH> 100644
--- a/plugins/PluginCertInfo.py
+++ b/plugins/PluginCertInfo.py
@@ -124,7 +124,8 @@ class PluginCertInfo(PluginBase.PluginBase):
argument = arg, title = cmd_title)
trust_xml_attr = {'trusted-by-mozilla' : str(cert_trusted)}
trust_xml = Element('certificate', attrib = trust_xml_attr)
- trust_xml.extend(cert_xml)
+ for elem_xml in cert_xml:
+ trust_xml.append(elem_xml)
xml_result.append(trust_xml)
ctSSL_cleanup() | Fixes issue <I> | nabla-c0d3_sslyze | train | py |
d1f24ce4a7bd833737b1f8ba5ae27ed27e5a691f | diff --git a/src/Tests/RuleSet/Loader/FileLoaderTest.php b/src/Tests/RuleSet/Loader/FileLoaderTest.php
index <HASH>..<HASH> 100644
--- a/src/Tests/RuleSet/Loader/FileLoaderTest.php
+++ b/src/Tests/RuleSet/Loader/FileLoaderTest.php
@@ -12,10 +12,16 @@ class FileLoaderTest extends \PHPUnit_Framework_TestCase
$this->assertInstanceOf('SensioLabs\DeprecationDetector\RuleSet\Loader\FileLoader', $loader);
}
+ /**
+ * @expectedException \RuntimeException
+ * @expectedExceptionMessage Rule set file "no_such.file" does not exist.
+ */
public function testLoadingNotExistingFileThrowsAnException()
{
- //@TODO: is_file is untestable
- $this->markTestSkipped();
+ $dispatcher = $this->prophesize('Symfony\Component\EventDispatcher\EventDispatcher');
+ $loader = new \SensioLabs\DeprecationDetector\RuleSet\Loader\FileLoader($dispatcher->reveal());
+
+ $loader->loadRuleSet('no_such.file');
}
public function testLoadRuleSetThrowsExceptionIfCachedIsNotAnInstanceOfRuleset() | implemented skipped test (is_file) | sensiolabs-de_deprecation-detector | train | php |
e035b495de57b842adc3cc58fc7820b80233823f | diff --git a/CorsSlim.php b/CorsSlim.php
index <HASH>..<HASH> 100644
--- a/CorsSlim.php
+++ b/CorsSlim.php
@@ -20,6 +20,24 @@ class CorsSlim extends \Slim\Middleware {
$req->headers->get("Origin")
);
}
+
+ // handle multiple allowed origins
+ if(is_array($origin)) {
+
+ $allowedOrigins = $origin;
+
+ // default to the first allowed origin
+ $origin = reset($allowedOrigins);
+
+ // but use a specific origin if there is a match
+ foreach($allowedOrigins as $allowedOrigin) {
+ if($allowedOrigin === $req->headers->get("Origin")) {
+ $origin = $allowedOrigin;
+ break;
+ }
+ }
+ }
+
$rsp->headers->set('Access-Control-Allow-Origin', $origin);
} | Add support for multiple origins if an array is passed in for the 'origin' setting. This works by returning the first value to match the actual origin of the request, or defaulting to the first value in the array. | palanik_CorsSlim | train | php |
40f728a3263c33e4fe9ba0681711a38799621405 | diff --git a/internal/restorable/image.go b/internal/restorable/image.go
index <HASH>..<HASH> 100644
--- a/internal/restorable/image.go
+++ b/internal/restorable/image.go
@@ -103,6 +103,11 @@ func NewScreenFramebufferImage(width, height int) *Image {
return i
}
+func (i *Image) Clear() {
+ theImages.makeStaleIfDependingOn(i)
+ i.clear()
+}
+
func (i *Image) clear() {
if i.priority {
panic("restorable: clear cannot be called on a priority image")
diff --git a/internal/shareable/shareable.go b/internal/shareable/shareable.go
index <HASH>..<HASH> 100644
--- a/internal/shareable/shareable.go
+++ b/internal/shareable/shareable.go
@@ -278,6 +278,11 @@ func (i *Image) Fill(r, g, b, a uint8) {
i.ensureNotShared()
backendsM.Unlock()
+ if r == 0 && g == 0 && b == 0 && a == 0 {
+ i.backend.restorable.Clear()
+ return
+ }
+
rf := float32(0)
gf := float32(0)
bf := float32(0) | shareable: Call (*restorable.Image).Clear() when possible
This is a kind of relanding of c<I>c<I>b0b<I>e<I>af1d<I>eb8e2d<I>fa<I>.
Clearing the restorable.Image state can reduce the operations for
restoring. | hajimehoshi_ebiten | train | go,go |
3731a3b805811d23917084230c274d64bd8575cf | diff --git a/client/jquery.shotgunConsole.js b/client/jquery.shotgunConsole.js
index <HASH>..<HASH> 100644
--- a/client/jquery.shotgunConsole.js
+++ b/client/jquery.shotgunConsole.js
@@ -63,7 +63,7 @@
$line.appendTo($display);
var dontType = !line.options || !line.options.dontType;
if ('coolType' in $.fn && text.length > 0 && dontType) {
- typeOptions = {
+ var typeOptions = {
typeSpeed: 0,
delayBeforeType: 0,
delayAfterType: 0, | Even veteran programmers forget a 'var' keyword now and then :/ | chevex-archived_shotgun-client | train | js |
8b0b95c58f3c82d00d0f81ed19eb593f7f931370 | diff --git a/test/unit/Command/AssertBackwardsCompatibleTest.php b/test/unit/Command/AssertBackwardsCompatibleTest.php
index <HASH>..<HASH> 100644
--- a/test/unit/Command/AssertBackwardsCompatibleTest.php
+++ b/test/unit/Command/AssertBackwardsCompatibleTest.php
@@ -278,7 +278,6 @@ final class AssertBackwardsCompatibleTest extends TestCase
$this
->locateDependencies
- ->expects(self::any())
->method('__invoke')
->with((string) $this->sourceRepository)
->willReturn($this->dependencies);
@@ -288,13 +287,14 @@ final class AssertBackwardsCompatibleTest extends TestCase
Change::removed($changeToExpect, true)
));
- $this->compare->execute($this->input, $this->output);
-
- $this->output->expects(self::any())
+ $this->output
+ ->expects(self::once())
->method('writeln')
->willReturnCallback(static function (string $output) use ($changeToExpect) : void {
- self::assertStringContainsString($changeToExpect, $output);
+ self::assertStringContainsString(' [BC] ' . $changeToExpect, $output);
});
+
+ $this->compare->execute($this->input, $this->output);
}
public function testExecuteWithDefaultRevisionsNotProvidedAndNoDetectedTags() : void | Ensure that markdown output is printed during CLI execution | Roave_BackwardCompatibilityCheck | train | php |
bee3b2748c175d0c74622325d463a9f717ffa509 | diff --git a/scripts/plink_to_vcf.py b/scripts/plink_to_vcf.py
index <HASH>..<HASH> 100644
--- a/scripts/plink_to_vcf.py
+++ b/scripts/plink_to_vcf.py
@@ -97,7 +97,7 @@ def fix_vcf_line(parts, ref_base):
varinfo[4] = ref
genotypes = [swap[x] for x in genotypes]
# reference is on alternate strand
- elif ref_base != ref and complements[ref] == ref_base:
+ elif ref_base != ref and complements.get(ref) == ref_base:
varinfo[3] = complements[ref]
varinfo[4] = complements[var]
# unspecified alternative base
@@ -106,7 +106,7 @@ def fix_vcf_line(parts, ref_base):
varinfo[4] = ref
genotypes = [swap[x] for x in genotypes]
# swapped and on alternate strand
- elif ref_base != ref and complements[var] == ref_base:
+ elif ref_base != ref and complements.get(var) == ref_base:
varinfo[3] = complements[var]
varinfo[4] = complements[ref]
genotypes = [swap[x] for x in genotypes] | Do not fail on non-GATC reference or variant bases. These will pass through unchanged without attempting to swap strands, but will no longer error out. Fixes #<I> | bcbio_bcbio-nextgen | train | py |
174de850ef640433b6b69a890ce5a558f1518d59 | diff --git a/bin/download-node-tests.js b/bin/download-node-tests.js
index <HASH>..<HASH> 100755
--- a/bin/download-node-tests.js
+++ b/bin/download-node-tests.js
@@ -38,11 +38,18 @@ function downloadBufferTests (dir, files) {
files.forEach(function (file) {
if (!/test-buffer.*/.test(file.name)) return
- if (file.name === 'test-buffer-fakes.js') {
- // These teses only apply to node, where they're calling into C++ and need to
- // ensure the prototype can't be faked, or else there will be a segfault.
- return
- }
+ const skipFileNames = [
+ // Only applies to node. Calls into C++ and needs to ensure the prototype can't
+ // be faked, or else there will be a segfault.
+ 'test-buffer-fakes.js',
+ // This test file is testing the SharedArrayBuffer support, which is obscure
+ // and now temporarily disabled in all browsers due to the Spectre/Meltdown
+ // security issue.
+ 'test-buffer-sharedarraybuffer.js'
+ ]
+
+ // Skip test files with these names
+ if (skipFileNames.includes(file.name)) return
console.log(file.download_url) | skip irrelevant test file: test-buffer-sharedarraybuffer.js | feross_buffer | train | js |
dda80900378b60ea286bce3dea24439d30f61fac | diff --git a/test/integration/scheduler_perf/util.go b/test/integration/scheduler_perf/util.go
index <HASH>..<HASH> 100644
--- a/test/integration/scheduler_perf/util.go
+++ b/test/integration/scheduler_perf/util.go
@@ -17,6 +17,7 @@ limitations under the License.
package benchmark
import (
+ "bytes"
"context"
"encoding/json"
"flag"
@@ -173,8 +174,11 @@ func dataItems2JSONFile(dataItems DataItems, namePrefix string) error {
}
destFile = path.Join(*dataItemsDir, destFile)
}
-
- return ioutil.WriteFile(destFile, b, 0644)
+ formatted := &bytes.Buffer{}
+ if err := json.Indent(formatted, b, "", " "); err != nil {
+ return fmt.Errorf("indenting error: %v", err)
+ }
+ return ioutil.WriteFile(destFile, formatted.Bytes(), 0644)
}
type labelValues struct { | Format json file with proper indentation | kubernetes_kubernetes | train | go |
23e534683d0a605ec31b9337dbff9fadb5615540 | diff --git a/tdiary.rb b/tdiary.rb
index <HASH>..<HASH> 100644
--- a/tdiary.rb
+++ b/tdiary.rb
@@ -125,7 +125,7 @@ module TDiary
# directory where the server was started
def server_root
- Dir.pwd
+ Dir.pwd.untaint
end
def configuration | fix error in plugin because TDiary.server_root was tainted | tdiary_tdiary-core | train | rb |
563136665b6689d7d98c08b830aa3a8e646aa67e | diff --git a/src/Renderer/TwigExtensionFilters.php b/src/Renderer/TwigExtensionFilters.php
index <HASH>..<HASH> 100644
--- a/src/Renderer/TwigExtensionFilters.php
+++ b/src/Renderer/TwigExtensionFilters.php
@@ -58,9 +58,9 @@ class TwigExtensionFilters extends \Twig_Extension
* @param string $variable
* @param string $value
*
- * @return array
- *
* @throws \Exception
+ *
+ * @return array
*/
public function filterBy($pages, $variable, $value)
{ | Applied fixes from StyleCI (#<I>) | Cecilapp_PHPoole | train | php |
3063aebbd6c3020837eb5bd263c21e69411eb3c5 | diff --git a/Admin/Traits/Mapper.php b/Admin/Traits/Mapper.php
index <HASH>..<HASH> 100644
--- a/Admin/Traits/Mapper.php
+++ b/Admin/Traits/Mapper.php
@@ -2,6 +2,10 @@
namespace Librinfo\CoreBundle\Admin\Traits;
+use Sonata\AdminBundle\Mapper\BaseMapper;
+use Sonata\AdminBundle\Mapper\BaseGroupedMapper;
+use Librinfo\CoreBundle\Tools\Reflection\ClassAnalyzer;
+
trait Mapper
{
private function configureMapper(BaseMapper $mapper)
@@ -62,7 +66,7 @@ trait Mapper
private function addContent(BaseMapper $mapper, $group)
{
- // flat organization
+ // flat organization (DatagridMapper / ListMapper...)
if ( ! $mapper instanceof BaseGroupedMapper )
{
// options pre-treatment | correcting the usage of the new Mapper trait, adding needed "use"s | blast-project_CoreBundle | train | php |
50e537c2d620f537ac0994873b9791b574a33a5b | diff --git a/fbchat/models.py b/fbchat/models.py
index <HASH>..<HASH> 100644
--- a/fbchat/models.py
+++ b/fbchat/models.py
@@ -1,8 +1,10 @@
from __future__ import unicode_literals
+import sys
class Base():
def __repr__(self):
- return self.__unicode__().encode('utf-8')
+ uni = self.__unicode__()
+ return uni.encode('utf-8') if sys.version_info < (3, 0) else uni
def __unicode__(self):
return u'<%s %s (%s)>' % (self.type.upper(), self.name, self.url)
@@ -16,8 +18,7 @@ class User(Base):
self.photo = data['photo']
self.url = data['path']
self.name = data['text']
- #self.score = jsoin['score']
- #self.tokens = data['tokens']
+ self.score = data['score']
self.data = data | bugfix to make Users compatible for python2 and 3 | carpedm20_fbchat | train | py |
5f6a06f46de2de9fa6663bf5b7b29b27446e8d31 | diff --git a/js/hitbtc3.js b/js/hitbtc3.js
index <HASH>..<HASH> 100644
--- a/js/hitbtc3.js
+++ b/js/hitbtc3.js
@@ -1284,7 +1284,12 @@ module.exports = class hitbtc3 extends Exchange {
if (symbol !== undefined) {
market = this.market (symbol);
}
- const response = await this.privateDeleteSpotOrderClientOrderId (this.extend (request, params));
+ const [ marketType, query ] = this.handleMarketTypeAndParams ('cancelOrder', market, params);
+ const method = this.getSupportedMapping (marketType, {
+ 'spot': 'privateDeleteSpotOrderClientOrderId',
+ 'swap': 'privateDeleteFuturesOrderClientOrderId',
+ });
+ const response = await this[method] (this.extend (request, query));
return this.parseOrder (response, market);
} | Hitbtc3 cancelOrder
Added swap functionality to cancelOrder | ccxt_ccxt | train | js |
1ee61b48f6e1f9c300b6fa1bc8e2ca7d0a0ba244 | diff --git a/lib/express/collection.js b/lib/express/collection.js
index <HASH>..<HASH> 100644
--- a/lib/express/collection.js
+++ b/lib/express/collection.js
@@ -377,6 +377,17 @@ Collection = Class({
},
/**
+ * Clone the collection.
+ *
+ * @return {Collection}
+ * @api public
+ */
+
+ clone: function() {
+ return this.merge({})
+ },
+
+ /**
* Convert collection to a string.
*
* @return {string}
diff --git a/spec/spec.collection.js b/spec/spec.collection.js
index <HASH>..<HASH> 100644
--- a/spec/spec.collection.js
+++ b/spec/spec.collection.js
@@ -296,6 +296,22 @@ describe 'Express'
end
end
+ describe '#clone()'
+ it 'should clone an array collection'
+ var a = $([1,2,3])
+ var b = a.clone()
+ a.should.not.equal b
+ b.arr.should.eql [1,2,3]
+ end
+
+ it 'should clone an object collection'
+ var a = $({ foo: 'bar' })
+ var b = a.clone()
+ a.should.not.equal b
+ b.arr.should.eql { foo: 'bar' }
+ end
+ end
+
describe '#toString()'
it 'should output [Collection ...] for array'
$([1,2,3]).toString().should.eql '[Collection 1,2,3]' | Added Collection#clone() | expressjs_express | train | js,js |
dae849b950409905415e4d640630baf084d1759c | diff --git a/lib/relations/CssUrlTokenRelation.js b/lib/relations/CssUrlTokenRelation.js
index <HASH>..<HASH> 100644
--- a/lib/relations/CssUrlTokenRelation.js
+++ b/lib/relations/CssUrlTokenRelation.js
@@ -89,7 +89,7 @@ extendWithGettersAndSetters(CssUrlTokenRelation.prototype, {
} else {
return $0;
}
- }.bind(this));
+ }.bind(this)).trim();
}
}
this.node = undefined; | CssUrlTokenRelation.detach: Avoid leaving traling whitespace. | assetgraph_assetgraph | train | js |
08349289ab78e0f10af851728c5c32ae03dc2995 | diff --git a/ci/tests/puppeteer/cas.js b/ci/tests/puppeteer/cas.js
index <HASH>..<HASH> 100644
--- a/ci/tests/puppeteer/cas.js
+++ b/ci/tests/puppeteer/cas.js
@@ -260,16 +260,21 @@ exports.assertInnerText = async (page, selector, value) => {
exports.assertPageTitle = async (page, value) => {
const title = await page.title();
- console.log(title);
+ console.log("Page Title: " + title);
assert(title === value)
}
-exports.decodeJwt = async (token) => {
+exports.decodeJwt = async (token, complete = false) => {
console.log(`Decoding token ${token}`);
- let decoded = jwt.decode(token, {complete: true});
- console.log("Decoded token header: " + colors.green(decoded.header));
- console.log("Decoded token payload:");
- console.log(colors.green(decoded.payload));
+ let decoded = jwt.decode(token, {complete: complete});
+ if (complete) {
+ console.log("Decoded token header: " + colors.green(decoded.header));
+ console.log("Decoded token payload:");
+ console.log(colors.green(decoded.payload));
+ } else {
+ console.log("Decoded token payload:");
+ console.log(colors.green(decoded));
+ }
return decoded;
} | clean up JS tests for puppeteer | apereo_cas | train | js |
4c0c73cc0428d8106b9cc6aabacb9678c13a61b4 | diff --git a/lib/rubocop/config_loader.rb b/lib/rubocop/config_loader.rb
index <HASH>..<HASH> 100644
--- a/lib/rubocop/config_loader.rb
+++ b/lib/rubocop/config_loader.rb
@@ -28,13 +28,13 @@ module RuboCop
# Psych can give an error when reading an empty file, so we use syck in
# Ruby versions where it's available. Also, the problem with empty
# files does not appear in Ruby 2 or in JRuby 1.9 mode.
- original_yamler = YAML::ENGINE.yamler
if RUBY_VERSION < '2.0.0' && RUBY_PLATFORM != 'java'
+ original_yamler = YAML::ENGINE.yamler
YAML::ENGINE.yamler = 'syck'
end
hash = YAML.load_file(path) || {}
# Restore yamler for applications using RuboCop as a library.
- YAML::ENGINE.yamler = original_yamler
+ YAML::ENGINE.yamler = original_yamler if original_yamler
puts "configuration from #{path}" if debug? | Fix problem with Psych::ENGINE for ruby-head | rubocop-hq_rubocop | train | rb |
b62f2e60b10663ae35bb755141fd78b6a7236488 | diff --git a/tests/conftest.py b/tests/conftest.py
index <HASH>..<HASH> 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -315,7 +315,7 @@ def parsed_institute(request):
institute = {
'institute_id': 'cust000',
'display_name': 'test_institute',
- 'sanger_recipients': ['john@doe.com', 'jane@doe.com']
+ 'sanger_recipients': ['john@doe.com', 'jane@doe.com'],
}
return institute
@@ -330,6 +330,8 @@ def institute_obj(request, parsed_institute):
display_name=parsed_institute['display_name'],
sanger_recipients=parsed_institute['sanger_recipients'],
)
+ # move institute created time 1 day back in time
+ institute['created_at'] = datetime.datetime.now() - datetime.timedelta(days=1)
return institute | institute creation date 1 day back in the past | Clinical-Genomics_scout | train | py |
07e0d7694938edb06bca6ec04893898ce3345584 | diff --git a/umis/umis.py b/umis/umis.py
index <HASH>..<HASH> 100644
--- a/umis/umis.py
+++ b/umis/umis.py
@@ -258,7 +258,7 @@ def fastqtransform(transform, fastq1, fastq2, fastq3, fastq4, keep_fastq_tags,
read1_dict = _extract_readnum(read1_dict)
read2_dict = _extract_readnum(read2_dict)
- tooshort = (len(read1_dict['seq']) < min_length and
+ tooshort = (len(read1_dict['seq']) < min_length or
len(read2_dict['seq']) < min_length)
if not tooshort: | Fix for min length and paired transformation.
Previous version needed only one read to be longer than min_length,
this swaps it to be both reads need to be longer then min_length. | vals_umis | train | py |
6c50ecd28ab04bde6324e9482d95ccaa812b6f91 | diff --git a/bika/lims/browser/fields/aranalysesfield.py b/bika/lims/browser/fields/aranalysesfield.py
index <HASH>..<HASH> 100644
--- a/bika/lims/browser/fields/aranalysesfield.py
+++ b/bika/lims/browser/fields/aranalysesfield.py
@@ -102,14 +102,17 @@ class ARAnalysesField(ObjectField):
'sample_due', 'sample_received',
'attachment_due', 'to_be_verified')
- # Modify existing AR specs with new form values for selected analyses
+ # Modify existing AR specs with new form values for selected analyses.
+ new_specs = []
rr = instance.getResultsRange()
- for i, spec in enumerate(specs):
- for r in rr:
- if spec['keyword'] == rr['keyword']:
- for k,v in specs[i].items():
- rr[k] = v
- instance.setResultsRange(specs)
+ rr = rr if rr else []
+ rr = dicts_to_dict(rr)
+ for r in rr:
+ for s in specs:
+ if s['keyword'] == r['keyword']:
+ r.update(s)
+ new_specs.append(r)
+ instance.setResultsRange(new_specs)
new_analyses = []
proxies = bsc(UID=service_uids) | ar analyses field - oops this was using specs from form, but ignoring ResultsRange for existing ARs. | senaite_senaite.core | train | py |
42ea1761b568aa5a2ebc4b4986bc26e49581229d | diff --git a/salt/engines/slack.py b/salt/engines/slack.py
index <HASH>..<HASH> 100644
--- a/salt/engines/slack.py
+++ b/salt/engines/slack.py
@@ -97,6 +97,8 @@ import re
import traceback
import yaml
+log = logging.getLogger(__name__)
+
try:
import slackclient
HAS_SLACKCLIENT = True
@@ -118,9 +120,6 @@ from salt.utils.yamldumper import OrderedDumper
def __virtual__():
return HAS_SLACKCLIENT
-log = logging.getLogger(__name__)
-
-
def get_slack_users(token):
'''
Get all users from Slack | Init logging before its first invocation | saltstack_salt | train | py |
966db9c9dd536057d0f9825756b0ebaf7559f2c1 | diff --git a/tests/test_odcs_util.py b/tests/test_odcs_util.py
index <HASH>..<HASH> 100644
--- a/tests/test_odcs_util.py
+++ b/tests/test_odcs_util.py
@@ -9,10 +9,12 @@ of the BSD license. See the LICENSE file for details.
from atomic_reactor.odcs_util import ODCSClient
from tests.retry_mock import mock_get_retry_session
+import flexmock
import pytest
import responses
import six
import json
+import time
MODULE_NAME = 'eog'
@@ -133,6 +135,10 @@ def test_wait_for_compose(odcs_client, final_state_id, final_state_name, expect_
content_type='application/json',
callback=handle_composes_get)
+ (flexmock(time)
+ .should_receive('sleep')
+ .and_return(None))
+
if expect_exc:
with pytest.raises(RuntimeError) as exc_info:
odcs_client.wait_for_compose(COMPOSE_ID) | Speed up test cases for odcs_util
This saves about <I>s per environment. | projectatomic_atomic-reactor | train | py |
a056b92deabbe628378cee4f2029d203c718b7d9 | diff --git a/repairbox/artefact.py b/repairbox/artefact.py
index <HASH>..<HASH> 100644
--- a/repairbox/artefact.py
+++ b/repairbox/artefact.py
@@ -91,9 +91,13 @@ class Artefact(object):
self.__source = source
- # TODO
@property
- def source_dir(self):
+ def source_dir(self) -> str:
+ """
+ The absolute path of the source directory (within the container) for
+ this artefact.
+ """
+ # TODO
return "/experiment/src"
@@ -103,7 +107,7 @@ class Artefact(object):
@property
- def harness(self):
+ def harness(self) -> TestHarness:
"""
The test harness used by this artefact.
"""
@@ -177,7 +181,14 @@ class Artefact(object):
def download(self, force=False) -> None:
"""
- Attempts to download the Docker image for this artefact from DockerHub.
+ Attempts to download the image for this artefact from DockerHub.
+ """
+ pass
+
+
+ def upload(self) -> None:
+ """
+ Attempts to upload the image for this artefact to DockerHub.
"""
pass | updated docs and added upload method to Artefact | squaresLab_BugZoo | train | py |
a7e1530ae093daa61105b1d334aba8197409e921 | diff --git a/src/contributor/contributor.js b/src/contributor/contributor.js
index <HASH>..<HASH> 100644
--- a/src/contributor/contributor.js
+++ b/src/contributor/contributor.js
@@ -22,7 +22,8 @@ Contributor.type = {
"name": "string", // full author name
"role": "string",
"organization": "string",
- "image": "string", // optional
+ "image": "blob", // optional
+ "url": "string", // TODO: rename to image_url
"email": "string",
"contribution": "string"
}
@@ -63,6 +64,23 @@ Contributor.Prototype = function() {
return this.document.get(affId);
}, this);
};
+
+ this.getBlob = function() {
+ return this.document.getBlob(this.properties.image);
+ };
+
+ // Depending on wheter there is a blob it returns either the blob url or a regular image url
+ // --------
+ //
+
+ this.getUrl = function() {
+ var blob = this.getBlob();
+ if (blob) {
+ return window.URL.createObjectURL(blob);
+ } else {
+ return this.properties.url || "styles/contributor-image-placeholder.png";
+ }
+ };
};
Contributor.Prototype.prototype = DocumentNode.prototype; | Blob support for collab images. | substance_nodes | train | js |
23f52301160090ca97934cf49cf8f83cd8a9f0a2 | diff --git a/QuickBooks/Payments.php b/QuickBooks/Payments.php
index <HASH>..<HASH> 100755
--- a/QuickBooks/Payments.php
+++ b/QuickBooks/Payments.php
@@ -629,16 +629,17 @@ class Quickbooks_Payments
*/
protected function _http($Context, $url_path, $raw_body = null, $operation = null)
{
- if($operation !== null)
+ if($operation !== null)
{
- $method = $operation;
+ $method = $operation;
}
- else
- {
- $method = 'GET';
- if ($raw_body)
+ else
{
- $method = 'POST';
+ $method = 'GET';
+ if ($raw_body)
+ {
+ $method = 'POST';
+ }
}
$url = $this->_getBaseURL() . $url_path; | Fixed end paren problem
Fixed missing end paren problem, some whitespace cleanup. | consolibyte_quickbooks-php | train | php |
eb67148b569ad72817ee09b220002e062e30520f | diff --git a/lib/paru/pandoc.rb b/lib/paru/pandoc.rb
index <HASH>..<HASH> 100644
--- a/lib/paru/pandoc.rb
+++ b/lib/paru/pandoc.rb
@@ -240,7 +240,7 @@ module Paru
if not [1, 2].include? major_version
throw Error.new "Unknown major pandoc version: '#{major_version}'. Expected the major version to be '1' or '2'. Please check the pandoc path: '#{@@pandoc_exec}'."
# defaults to version 1
- major_version = 1
+ major_version = 2
end
# For each pandoc command line option a method is defined as follows: | Keep support for version 1 (just not in the tests) | htdebeer_paru | train | rb |
5c3ad583a226d2e8fe386e40458e0a7e711d188c | diff --git a/src/controllers/ServerController.php b/src/controllers/ServerController.php
index <HASH>..<HASH> 100644
--- a/src/controllers/ServerController.php
+++ b/src/controllers/ServerController.php
@@ -170,6 +170,9 @@ class ServerController extends CrudController
'tariff_like' => 'server.server.tariff',
'wizzarded_eq' => 'server.server.wizzarded',
+
+ 'hide_nic' => 'server.server.hide_hic',
+ 'hide_vds' => 'server.server.hide_vds',
],
],
'search' => [ | Add filter attribute `hide_nic` and `hide_vds` to storage map in order to save it after bulk operaion | hiqdev_hipanel-module-server | train | php |
12b754800c5bc56bd0b757e335d70cee439400b7 | diff --git a/js/src/collapse.js b/js/src/collapse.js
index <HASH>..<HASH> 100644
--- a/js/src/collapse.js
+++ b/js/src/collapse.js
@@ -318,21 +318,21 @@ class Collapse {
}
_addAriaAndCollapsedClass(element, triggerArray) {
- if (element) {
- const isOpen = element.classList.contains(CLASS_NAME_SHOW)
-
- if (triggerArray.length) {
- triggerArray.forEach(elem => {
- if (isOpen) {
- elem.classList.remove(CLASS_NAME_COLLAPSED)
- } else {
- elem.classList.add(CLASS_NAME_COLLAPSED)
- }
+ if (!element || !triggerArray.length) {
+ return
+ }
- elem.setAttribute('aria-expanded', isOpen)
- })
+ const isOpen = element.classList.contains(CLASS_NAME_SHOW)
+
+ triggerArray.forEach(elem => {
+ if (isOpen) {
+ elem.classList.remove(CLASS_NAME_COLLAPSED)
+ } else {
+ elem.classList.add(CLASS_NAME_COLLAPSED)
}
- }
+
+ elem.setAttribute('aria-expanded', isOpen)
+ })
}
// Static | collapse.js: return early. | twbs_bootstrap | train | js |
9e72a2ad9cfe3e9e63411de65ecae4a2f2f707eb | diff --git a/pkg/minikube/download/iso.go b/pkg/minikube/download/iso.go
index <HASH>..<HASH> 100644
--- a/pkg/minikube/download/iso.go
+++ b/pkg/minikube/download/iso.go
@@ -79,7 +79,6 @@ func localISOPath(u *url.URL) string {
// ISO downloads and returns the path to the downloaded ISO
func ISO(urls []string, skipChecksum bool) (string, error) {
- out.T(out.ISODownload, "Downloading VM boot image ...")
errs := map[string]string{}
for _, url := range urls {
@@ -128,6 +127,8 @@ func downloadISO(isoURL string, skipChecksum bool) error {
return nil
}
+ out.T(out.ISODownload, "Downloading VM boot image ...")
+
urlWithChecksum := isoURL + "?checksum=file:" + isoURL + ".sha256"
if skipChecksum {
urlWithChecksum = isoURL | Don't show download message until downloading
For instance if the boot image already exists | kubernetes_minikube | train | go |
b04d67e41f48573215f5b92d823dcc72ac97b903 | diff --git a/src/lib/release-executor.js b/src/lib/release-executor.js
index <HASH>..<HASH> 100644
--- a/src/lib/release-executor.js
+++ b/src/lib/release-executor.js
@@ -68,7 +68,7 @@ export default class ReleaseExecutor {
this.exec('rm .npmignore')
this.exec('rm .npmrc')
- return code === 0 ? stdout.split('@')[1] : null
+ return code === 0 ? stdout.trim().split('@')[1] : null
}
/** | remove LF from npm publish result | CureApp_node-circleci-autorelease | train | js |
0b8ee2474005ac7b8e9d3f4846039344bcfe7319 | diff --git a/spec/examples/regression_spec.rb b/spec/examples/regression_spec.rb
index <HASH>..<HASH> 100644
--- a/spec/examples/regression_spec.rb
+++ b/spec/examples/regression_spec.rb
@@ -113,6 +113,12 @@ describe IceCube do
require 'active_support/time'
+ it 'should not hang over DST [#53]' do
+ schedule = IceCube::Schedule.new Time.now, :end_time => 4.years.from_now.end_of_year
+ schedule.rrule IceCube::Rule.monthly
+ schedule.occurrences 2.years.from_now
+ end
+
it 'should not hang next_time on DST boundary [#98]' do # set local to Sweden
schedule = IceCube::Schedule.from_yaml <<-EOS
:start_date: 2012-09-03 0:00:00.000000000 +00:00 | Added regression test for [#<I>] | seejohnrun_ice_cube | train | rb |
7cf85c5e71a442aafa812763b74e30868d1b3c7f | diff --git a/consensus/state.go b/consensus/state.go
index <HASH>..<HASH> 100644
--- a/consensus/state.go
+++ b/consensus/state.go
@@ -24,7 +24,7 @@ var (
timeoutPrevoteDelta = 0500 * time.Millisecond // timeoutPrevoteN is timeoutPrevote0 + timeoutPrevoteDelta*N
timeoutPrecommit0 = 1000 * time.Millisecond // After any +2/3 precommits received, wait this long for stragglers.
timeoutPrecommitDelta = 0500 * time.Millisecond // timeoutPrecommitN is timeoutPrecommit0 + timeoutPrecommitDelta*N
- timeoutCommit = 100 * time.Millisecond // After +2/3 commits received for committed block, wait this long for stragglers in the next height's RoundStepNewHeight.
+ timeoutCommit = 1000 * time.Millisecond // After +2/3 commits received for committed block, wait this long for stragglers in the next height's RoundStepNewHeight.
) | Change commit timeout to 1 sec for testing | tendermint_tendermint | train | go |
338f2c1a691f11b402b8ef8a7c4ea87c0017080c | diff --git a/src/Console/ConsoleApplication.php b/src/Console/ConsoleApplication.php
index <HASH>..<HASH> 100644
--- a/src/Console/ConsoleApplication.php
+++ b/src/Console/ConsoleApplication.php
@@ -57,6 +57,8 @@ final class ConsoleApplication extends Application
$this->addCommands($commands);
$this->noRectorsLoadedReporter = $noRectorsLoadedReporter;
+
+ $this->setDefaultCommand('process');
}
public function doRun(InputInterface $input, OutputInterface $output): int | make process the default command (#<I>) | rectorphp_rector | train | php |
e904894983cfcad69138775dc359dbaa8b467eb3 | diff --git a/code/extensions/CDNFile.php b/code/extensions/CDNFile.php
index <HASH>..<HASH> 100644
--- a/code/extensions/CDNFile.php
+++ b/code/extensions/CDNFile.php
@@ -147,6 +147,7 @@ class CDNFile extends DataExtension {
if ($this->owner->ParentID) {
return $this->owner->Parent()->getViewType();
} else {
+ $member = Member::currentUser();
return $this->owner->defaultPermissions($member);
}
} else { | BUGFIX: get member object before passing it as a param | symbiote_silverstripe-cdncontent | train | php |
d4611b6a0fe48420f79f16869fd8c97c96b195f0 | diff --git a/src/render-to-layer.js b/src/render-to-layer.js
index <HASH>..<HASH> 100644
--- a/src/render-to-layer.js
+++ b/src/render-to-layer.js
@@ -89,12 +89,12 @@ const RenderToLayer = React.createClass({
},
_unrenderLayer: function() {
- if (this.layerWillUnmount) {
- this.layerWillUnmount(this._layer);
- }
if (!this.reactUnmount)
this.reactUnmount = debounce(() => {
if (this._layer) {
+ if (this.layerWillUnmount) {
+ this.layerWillUnmount(this._layer);
+ }
ReactDOM.unmountComponentAtNode(this._layer);
document.body.removeChild(this._layer);
this._layer = null; | routed dialog unrender layer being called twice | mui-org_material-ui | train | js |
b51151de6543772b4f1c51e208d5ad454bdbae6e | diff --git a/src/frontend/org/voltdb/export/ExportDataSource.java b/src/frontend/org/voltdb/export/ExportDataSource.java
index <HASH>..<HASH> 100644
--- a/src/frontend/org/voltdb/export/ExportDataSource.java
+++ b/src/frontend/org/voltdb/export/ExportDataSource.java
@@ -864,9 +864,13 @@ public class ExportDataSource implements Comparable<ExportDataSource> {
private void forwardAckToOtherReplicas(long uso) {
if (m_runEveryWhere && m_replicaRunning) {
- //we dont forward if we are running as replica in replicated export
- return;
+ //we dont forward if we are running as replica in replicated export
+ return;
+ } else if (!m_runEveryWhere && !m_mastershipAccepted.get()) {
+ // Don't forward acks if we are a replica in non-replicated export mode.
+ return;
}
+
Pair<Mailbox, ImmutableList<Long>> p = m_ackMailboxRefs.get();
Mailbox mbx = p.getFirst();
if (mbx != null && p.getSecond().size() > 0) { | ENG-<I>: Don't send acks from an export replica.
Only send acks from master to replicas, never from a replica to other
replicas. This could happen when a node rejoins and drains its on-disk
generations. Other replicas don't expect to receive these acks with Long.MIN as
the USO. If the receiving replica gets promoted due to master failure, the new
master will fail to roll its generation.
All replicas will either receive the acks from the master or drain the
generations themselves. | VoltDB_voltdb | train | java |
833ab401d8a7dd17c2f5ca02d71cf0c9e80d9e29 | diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/rules_configuration_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/rules_configuration_controller.rb
index <HASH>..<HASH> 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/rules_configuration_controller.rb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/rules_configuration_controller.rb
@@ -246,7 +246,7 @@ class RulesConfigurationController < ApplicationController
def delete
rule=Rule.find(params[:rule_id])
if rule.editable?
- rule.status=RULE::STATUS_REMOVED
+ rule.status=Rule::STATUS_REMOVED
rule.save
# it's mandatory to execute 'destroy_all' but not 'delete_all' because active_rule_parameters must | Fix issue when deleting copy of rule | SonarSource_sonarqube | train | rb |
52e9b1186b2a2bb3e48865dfd9cbbd544db341cb | diff --git a/pandas/conftest.py b/pandas/conftest.py
index <HASH>..<HASH> 100644
--- a/pandas/conftest.py
+++ b/pandas/conftest.py
@@ -61,8 +61,10 @@ def pytest_runtest_setup(item):
"skipping high memory test since --run-high-memory was not set")
# if "db" not explicitly set in the -m pattern, we skip the db tests
- if 'db' in item.keywords:
- pattern = item.config.getoption('-m')
+ pattern = item.config.getoption('-m')
+ if 'db' in item.keywords and not pattern:
+ pytest.skip('skipping db unless -m "db" is specified')
+ elif 'db' in item.keywords and pattern:
markers = collections.defaultdict(bool)
for marker in item.iter_markers():
markers[marker.name] = True | TST: Fixing bug in skipping db tests by default (#<I>) | pandas-dev_pandas | train | py |
723563e38958c770c2ed768ce4e23a680144aee2 | diff --git a/sendgrid/message.py b/sendgrid/message.py
index <HASH>..<HASH> 100644
--- a/sendgrid/message.py
+++ b/sendgrid/message.py
@@ -8,7 +8,7 @@ except Exception as e:
from smtpapi import SMTPAPIHeader
-class Mail():
+class Mail(object):
"""SendGrid Message.""" | Upgrade Mail to new-style class, on Python 2.x.
May help with issue #<I>. | sendgrid_sendgrid-python | train | py |
65b473697644517bf961d90a3973d4ea2cdda78a | diff --git a/anyconfig/backend/bson.py b/anyconfig/backend/bson.py
index <HASH>..<HASH> 100644
--- a/anyconfig/backend/bson.py
+++ b/anyconfig/backend/bson.py
@@ -50,6 +50,7 @@ class Parser(anyconfig.backend.base.FromStringLoader,
_dump_opts = ["check_keys", "uuid_subtype"]
_open_flags = ('rb', 'wb')
_ordered = not bson.has_c()
+ _dict_options = ["as_class"]
dump_to_string = anyconfig.backend.base.to_method(bson.BSON.encode) | fix: [bson] add member _dict_options to the parser | ssato_python-anyconfig | train | py |
7de66a99b51ba5c20673693f0bc67eca67af8076 | diff --git a/limitlessled/group/commands/v6.py b/limitlessled/group/commands/v6.py
index <HASH>..<HASH> 100644
--- a/limitlessled/group/commands/v6.py
+++ b/limitlessled/group/commands/v6.py
@@ -63,7 +63,7 @@ class CommandSetV6(CommandSet):
:param color: The RGB color tuple.
:return: The color in byte representation (best-effort basis).
"""
- hue = rgb_to_hsv(*color)
+ hue = rgb_to_hsv(*color)[0]
return math.floor(hue * self.MAX_COLOR)
def _build_command(self, cmd_1, cmd_2): | Fixed bug in color conversion for v6. | happyleavesaoc_python-limitlessled | train | py |
cdfcc9e42f6b7194008619dbc48a226402717539 | diff --git a/box-content-sdk/src/main/java/com/box/androidsdk/content/models/BoxRecentItem.java b/box-content-sdk/src/main/java/com/box/androidsdk/content/models/BoxRecentItem.java
index <HASH>..<HASH> 100644
--- a/box-content-sdk/src/main/java/com/box/androidsdk/content/models/BoxRecentItem.java
+++ b/box-content-sdk/src/main/java/com/box/androidsdk/content/models/BoxRecentItem.java
@@ -12,10 +12,10 @@ public class BoxRecentItem extends BoxJsonObject {
private static final String TYPE = "recent_item";
- private static final String FIELD_INTERACTION_TYPE = "interaction_type";
- private static final String FIELD_INTERACTED_AT = "interacted_at";
- private static final String FIELD_ITEM = "item";
- private static final String FIELD_ITERACTION_SHARED_LINK = "interaction_shared_link";
+ protected static final String FIELD_INTERACTION_TYPE = "interaction_type";
+ protected static final String FIELD_INTERACTED_AT = "interacted_at";
+ protected static final String FIELD_ITEM = "item";
+ protected static final String FIELD_ITERACTION_SHARED_LINK = "interaction_shared_link";
public BoxRecentItem() {
super(); | AND-<I> - Allow child classes to read static recent definitions | box_box-android-sdk | train | java |
76f03f000a1b0d94fd20d24a9f0f63ae939c8fc8 | diff --git a/staging/src/k8s.io/legacy-cloud-providers/vsphere/vsphere_util.go b/staging/src/k8s.io/legacy-cloud-providers/vsphere/vsphere_util.go
index <HASH>..<HASH> 100644
--- a/staging/src/k8s.io/legacy-cloud-providers/vsphere/vsphere_util.go
+++ b/staging/src/k8s.io/legacy-cloud-providers/vsphere/vsphere_util.go
@@ -639,7 +639,7 @@ func (vs *VSphere) BuildMissingVolumeNodeMap(ctx context.Context) {
// Start go routines per VC-DC to check disks are attached
wg.Add(1)
go func(nodes []k8stypes.NodeName) {
- err := vs.checkNodeDisks(ctx, nodeNames)
+ err := vs.checkNodeDisks(ctx, nodes)
if err != nil {
klog.Errorf("Failed to check disk attached for nodes: %+v. err: %+v", nodes, err)
} | Fix use variables in the loop in vsphere_util | kubernetes_kubernetes | train | go |
894778b296214c57ee84706280f6622c7d05a8eb | diff --git a/src/plugins/GoogleDrive.js b/src/plugins/GoogleDrive.js
index <HASH>..<HASH> 100644
--- a/src/plugins/GoogleDrive.js
+++ b/src/plugins/GoogleDrive.js
@@ -140,13 +140,22 @@ export default class Google extends Plugin {
}
renderAuth () {
- return `<div><h1>Authenticate With Google Drive</h1><a href=${this.authUrl || '#'}>Authenticate</a></div>`
+ return yo`
+ <div>
+ <h1>Authenticate With Google Drive</h1>
+ <a href=${this.authUrl || '#'}>Authenticate</a>
+ </div>
+ `
}
renderBrowser (state) {
const folders = state.folders.map((folder) => `<li>Folder<button class="GoogleDriveFolder" data-id="${folder.id}" data-title="${folder.title}">${folder.title}</button></li>`)
const files = state.files.map((file) => `<li><button class="GoogleDriveFile" data-id="${file.id}" data-title="${file.title}">${file.title}</button></li>`)
- return `<ul>${folders}</ul><ul>${files}</ul>`
+
+ return yo`
+ <ul>${folders}</ul>
+ <ul>${files}</ul>
+ `
}
renderError (err) { | Added yo to template strings | transloadit_uppy | train | js |
b32b965e40ef03aefc2efd92368fda799222d0fe | diff --git a/lib/odba/persistable.rb b/lib/odba/persistable.rb
index <HASH>..<HASH> 100644
--- a/lib/odba/persistable.rb
+++ b/lib/odba/persistable.rb
@@ -603,7 +603,6 @@ class Hash # :nodoc: all
replace dup
true
else
- puts "returning false"
false
end
end | Remove debugging output that shouldn't be there... | zdavatz_odba | train | rb |
f75dd8f72b32bccbb731127dfe72f69986870d79 | diff --git a/lib/couchbase/collection_options.rb b/lib/couchbase/collection_options.rb
index <HASH>..<HASH> 100644
--- a/lib/couchbase/collection_options.rb
+++ b/lib/couchbase/collection_options.rb
@@ -91,6 +91,7 @@ module Couchbase
attr_accessor :expiry
# @return [String] The encoded content when loading the document
+ # @api private
attr_accessor :encoded
# Decodes the content of the document using given (or default transcoder)
@@ -108,6 +109,7 @@ module Couchbase
end
# @return [Integer] The flags from the operation
+ # @api private
attr_accessor :flags
# @return [JsonTranscoder] The default transcoder which should be used | 📝 RCBC-<I>: mark parts of GetResult API as private
Change-Id: I<I>c<I>d<I>ab5ff<I>b<I>bf<I>a<I>
Reviewed-on: <URL> | couchbase_couchbase-ruby-client | train | rb |
d540f8d5c5dcf67fc34328a3b400333af423ab34 | diff --git a/pydle/client.py b/pydle/client.py
index <HASH>..<HASH> 100644
--- a/pydle/client.py
+++ b/pydle/client.py
@@ -104,7 +104,8 @@ class BasicClient:
# Schedule pinger.
self._ping_checker_handle = self.eventloop.schedule_periodically(PING_TIMEOUT / 2, self._check_ping_timeout)
# Set logger name.
- self.logger = logging.getLogger(self.__class__.__name__ + ':' + self.server_tag)
+ if self.server_tag:
+ self.logger = logging.getLogger(self.__class__.__name__ + ':' + self.server_tag)
def disconnect(self, expected=True):
""" Disconnect from server. """ | Only set server tag if it's valid. | Shizmob_pydle | train | py |
37f532cc0afe9271aea9b99b4261dd6729daa546 | diff --git a/App/App.php b/App/App.php
index <HASH>..<HASH> 100644
--- a/App/App.php
+++ b/App/App.php
@@ -451,7 +451,7 @@ class App
return $this->moduleTypes[$type];
}
- return null;
+ return array();
}
/** @return Module */ | App: getModulesByType now returns empty array when no module has been found | cyantree_grout | train | php |
35c2bd7bccfd68c87d339e734dd572d52572be29 | diff --git a/upload/catalog/controller/api/sale/order.php b/upload/catalog/controller/api/sale/order.php
index <HASH>..<HASH> 100644
--- a/upload/catalog/controller/api/sale/order.php
+++ b/upload/catalog/controller/api/sale/order.php
@@ -129,7 +129,7 @@ class Order extends \Opencart\System\Engine\Controller {
foreach ($vouchers as $voucher) {
$this->session->data['vouchers'][] = [
'code' => $voucher['code'],
- 'description' => sprintf($this->language->get('text_for'), $this->currency->format($voucher['amount'], $this->session->data['currency'], 1.0),$voucher['to_name']),
+ 'description' => sprintf($this->language->get('text_for'), $this->currency->format($voucher['amount'], $this->session->data['currency'], 1.0), $voucher['to_name']),
'to_name' => $voucher['to_name'],
'to_email' => $voucher['to_email'],
'from_name' => $voucher['from_name'], | Pushed variable from comma | opencart_opencart | train | php |
96c46b26230b6f0f4a52236fe275bef5e3942147 | diff --git a/scripts/release.js b/scripts/release.js
index <HASH>..<HASH> 100755
--- a/scripts/release.js
+++ b/scripts/release.js
@@ -52,7 +52,10 @@ function main() {
});
insertBanner(config.bannerFiles, banner);
- gitAdd(config.files)
+ gitAdd(config.bannerFiles)
+ .then(funciton() {
+ return gitAdd(config.files);
+ })
.then(function() {
var message = Mustache.render(config.releaseMessage, {
version: newVersion | Add dist files to commit banners in them | kimmobrunfeldt_progressbar.js | train | js |
38cf13c8862274d4662226a653b968b407148f8e | diff --git a/bl/string.py b/bl/string.py
index <HASH>..<HASH> 100644
--- a/bl/string.py
+++ b/bl/string.py
@@ -51,6 +51,10 @@ class String(str):
else:
return h.hexdigest()
+ def base64(self):
+ import base64 as b64
+ return b64.urlsafe_b64encode(bytes(self, encoding='utf-8'))
+
def camelify(self):
"""turn a string to CamelCase, omitting non-word characters"""
outstring = self.titleify(allwords=True) | String.base<I>() is now a thing | BlackEarth_bl | train | py |
83614aa97fb0937e24a879288f2cb26b68b091e0 | diff --git a/grunt/tasks/serve.js b/grunt/tasks/serve.js
index <HASH>..<HASH> 100644
--- a/grunt/tasks/serve.js
+++ b/grunt/tasks/serve.js
@@ -14,7 +14,7 @@ module.exports = function (grunt) {
}, BOUNCE_DELAY);
grunt.event.on("watch", function (action, filepath) {
- if (action !== "deleted" && filepath.indexOf("sources.json") === -1) {
+ if (action !== "deleted" && !filepath.includes("sources.json")) {
changedFiles[filepath] = action;
onChange();
} else { | no-magic-numbers (#<I>) | ArnaudBuchholz_gpf-js | train | js |
7d189814cbf6d4c55e8a47b06234736cb1e03457 | diff --git a/tree.go b/tree.go
index <HASH>..<HASH> 100644
--- a/tree.go
+++ b/tree.go
@@ -535,7 +535,7 @@ walk: // Outer loop for walking the tree
// No handle found. Check if a handle for this path + a
// trailing slash exists for TSR recommendation
n = n.children[0]
- value.tsr = n.path == "/" && n.handlers != nil
+ value.tsr = (n.path == "/" && n.handlers != nil) || (n.path == "" && n.indices == "/")
}
return
diff --git a/tree_test.go b/tree_test.go
index <HASH>..<HASH> 100644
--- a/tree_test.go
+++ b/tree_test.go
@@ -595,6 +595,7 @@ func TestTreeTrailingSlashRedirect(t *testing.T) {
"/blog/:p",
"/posts/:b/:c",
"/posts/b/:c/d/",
+ "/vendor/:x/*y",
}
for _, route := range routes {
recv := catchPanic(func() {
@@ -631,6 +632,7 @@ func TestTreeTrailingSlashRedirect(t *testing.T) {
"/api/world/abc/",
"/blog/pp/",
"/posts/b/c/d",
+ "/vendor/x",
}
for _, route := range tsrRoutes { | fix: wrong when wildcard follows named param (#<I>) | gin-gonic_gin | train | go,go |
e7dd7509682824157f1d390c2c1a37dcef3b9891 | diff --git a/mockserver-core/src/main/java/org/mockserver/matchers/RegexStringMatcher.java b/mockserver-core/src/main/java/org/mockserver/matchers/RegexStringMatcher.java
index <HASH>..<HASH> 100644
--- a/mockserver-core/src/main/java/org/mockserver/matchers/RegexStringMatcher.java
+++ b/mockserver-core/src/main/java/org/mockserver/matchers/RegexStringMatcher.java
@@ -91,7 +91,7 @@ public class RegexStringMatcher extends BodyMatcher<NottableString> {
return true;
}
} catch (PatternSyntaxException pse) {
- if (MockServerLogger.isEnabled(DEBUG)) {
+ if (MockServerLogger.isEnabled(DEBUG) && mockServerLogger != null) {
mockServerLogger.logEvent(
new LogEntry()
.setLogLevel(DEBUG)
@@ -104,7 +104,7 @@ public class RegexStringMatcher extends BodyMatcher<NottableString> {
try {
if (controlPlaneMatcher && matched.matches(matcherValue)) {
return true;
- } else if (MockServerLogger.isEnabled(DEBUG) && matched.matches(matcherValue)) {
+ } else if (MockServerLogger.isEnabled(DEBUG) && matched.matches(matcherValue) && mockServerLogger != null) {
mockServerLogger.logEvent(
new LogEntry()
.setLogLevel(DEBUG) | #<I> added extra null pointer checks | jamesdbloom_mockserver | train | java |
7b10828ee30aa07e3434afae2dc1dfcc60433375 | diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -4,7 +4,7 @@ from setuptools import setup
setup(
name='zerotk.reraiseit',
- version='2.0.2',
+ use_scm_version=True,
author='Alexandre Andrade',
author_email='kaniabi@gmail.com',
@@ -45,6 +45,7 @@ setup(
'six',
],
setup_requires=[
+ 'setuptools_scm',
'pytest_runner',
],
tests_require=[ | Using setuptools_scm to manage version numbers. | zerotk_reraiseit | train | py |
8cb931ed4da75ff2d84cfa352bd12d94c98a4257 | diff --git a/tests-arquillian/src/test/java/org/jboss/weld/tests/proxy/enterprise/EnterpriseBeanProxyTest.java b/tests-arquillian/src/test/java/org/jboss/weld/tests/proxy/enterprise/EnterpriseBeanProxyTest.java
index <HASH>..<HASH> 100644
--- a/tests-arquillian/src/test/java/org/jboss/weld/tests/proxy/enterprise/EnterpriseBeanProxyTest.java
+++ b/tests-arquillian/src/test/java/org/jboss/weld/tests/proxy/enterprise/EnterpriseBeanProxyTest.java
@@ -38,6 +38,7 @@ public class EnterpriseBeanProxyTest {
.addPackage(EnterpriseBeanProxyTest.class.getPackage())
.addClass(Utils.class)
.addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml")
+ .addClass(Utils.class)
);
}
@@ -46,7 +47,7 @@ public class EnterpriseBeanProxyTest {
*
* <a href="https://jira.jboss.org/jira/browse/WBRI-109">WBRI-109</a>
*/
- // Broken due to WELDINT-45
+ // WELDINT-45
@Test
public void testNoInterfaceView(Mouse mouse) throws Exception {
Assert.assertTrue(Utils.isProxy(mouse)); | WELD-<I> EnterpriseBeanProxyTest also works and has issues resolved (though one out-of-date) | weld_core | train | java |
2421d5b6d3dffef48162f191242bbc44f8da3767 | diff --git a/docs/conf.py b/docs/conf.py
index <HASH>..<HASH> 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -15,8 +15,7 @@
#
import os
import sys
-sys.path.insert(0, os.path.join(os.path.abspath('..'), 'twilio'))
-sys.path.append('..')
+sys.path.insert(0, os.path.abspath('..'))
from twilio import __version__ | Prepend the repo root to the system paths during doc generation (#<I>) | twilio_twilio-python | train | py |
3eae7c5a776c4c9f0a1deb08b95b20eec0d23351 | diff --git a/plugin/lib/tools.js b/plugin/lib/tools.js
index <HASH>..<HASH> 100644
--- a/plugin/lib/tools.js
+++ b/plugin/lib/tools.js
@@ -1219,7 +1219,6 @@ function getArtInd(pkg,mainArticleName){
function unlinkList(toUnlink,callback){
async.each(toUnlink,
function(file,cb){
- console.log(file);
fs.unlink(file,function(err){
if(err) return cb(err);
cb(null);
diff --git a/plugin/oapmc.js b/plugin/oapmc.js
index <HASH>..<HASH> 100644
--- a/plugin/oapmc.js
+++ b/plugin/oapmc.js
@@ -77,6 +77,10 @@ function oapmc(uri, opts, callback){
var res = JSON.parse(idConversionBody);
var doi = res['records'][0]['doi'];
var pmid = res['records'][0]['pmid'];
+ if(pmid==undefined){
+ // OAPMC entries do not all have a PMID (eg PMC3875093)
+ opts.noPubmed = true;
+ }
// 1. Fetch : resources, xml, and pubmed metadata
// a. resources | oapmc entries may not have a pmid | sballesteros_dcat | train | js,js |
362fd7d7d268904d2b7ed4a5d5c9aa988357112d | diff --git a/test/hierarchy_test.rb b/test/hierarchy_test.rb
index <HASH>..<HASH> 100644
--- a/test/hierarchy_test.rb
+++ b/test/hierarchy_test.rb
@@ -217,13 +217,14 @@ class HierarchyTest < MiniTest::Unit::TestCase
end
def test_finds_all_leaves
- root = TreeNode.create!
- child1 = TreeNode.create!(parent: root)
- child2 = TreeNode.create!(parent: root)
- child3 = TreeNode.create!(parent: root)
+ root1 = TreeNode.create!
+ child1 = TreeNode.create!(parent: root1)
+ child2 = TreeNode.create!(parent: root1)
+ child3 = TreeNode.create!(parent: root1)
grandchild1 = TreeNode.create!(parent: child1)
+ root2 = TreeNode.create!
- assert_equal [child2, child3, grandchild1], TreeNode.leaves.order(:created_at).to_a
+ assert_equal [child2, child3, grandchild1, root2], TreeNode.leaves.order(:created_at).to_a
end
def test_lowest_common_ancestor_paths | Adjust the test when root is also a leaf | cfabianski_ltree_hierarchy | train | rb |
759ffe5a7f0994805901c6ab7580ed44209421e4 | diff --git a/eztemplate.py b/eztemplate.py
index <HASH>..<HASH> 100755
--- a/eztemplate.py
+++ b/eztemplate.py
@@ -4,6 +4,7 @@
from __future__ import print_function
import argparse
+import errno
import os
import os.path
import re
@@ -326,7 +327,11 @@ def process_combinations(combinations, engine):
with open(outfile, 'w') as f:
f.write(result)
else:
- os.remove(outfile)
+ try:
+ os.remove(outfile)
+ except OSError as e:
+ if e.errno != errno.ENOENT:
+ raise
def main(args): | Don't fail on removing nonexistent files. | blubberdiblub_eztemplate | train | py |
de8c826919b641d7d8ec4c2453421417b57c7440 | diff --git a/openquake/hazardlib/tests/gsim/check_gsim.py b/openquake/hazardlib/tests/gsim/check_gsim.py
index <HASH>..<HASH> 100755
--- a/openquake/hazardlib/tests/gsim/check_gsim.py
+++ b/openquake/hazardlib/tests/gsim/check_gsim.py
@@ -143,9 +143,12 @@ def _format_stats(time_spent, discrepancies, errors, ctxs):
for discrep in discrepancies))
yes_no = {False: 'yes', True: 'no'}
+ # NB: on a windows virtual machine the clock can be buggy and
+ # the time spent can be zero: Daniele has seen that
+ checks_per_sec = (total_checks / time_spent) if time_spent else '?'
stats = '''\
total of %d checks done, %d were successful and %d failed.
-%.1f seconds spent, avg rate is %.1f checks per seconds.
+%.1f seconds spent, avg rate is %s checks per seconds.
success rate = %.1f%%
average discrepancy = %.4f%%
maximum discrepancy = %.4f%%
@@ -153,7 +156,7 @@ standard deviation = %.4f%%
context objects changed = %s'''
successes = total_checks - errors
stats %= (total_checks, successes, errors,
- time_spent, total_checks / float(time_spent),
+ time_spent, checks_per_sec,
success_rate,
avg_discrep,
max_discrep, | Fixed windows issue with time_spent=0 | gem_oq-engine | train | py |
e47d0bd5e2511799180d569cfde18fc816eea2ba | diff --git a/src/actionFn.js b/src/actionFn.js
index <HASH>..<HASH> 100644
--- a/src/actionFn.js
+++ b/src/actionFn.js
@@ -259,6 +259,7 @@ export default function actionFn(url, name, options, ACTIONS={}, meta={}) {
)(dispatch, getState);
}
});
+ result.catch(none);
return result;
};
return memo; | Revert catch promise uncatched errors | lexich_redux-api | train | js |
3f696190da9332d779d510493c3c44223d6d970d | diff --git a/fluent_contents/templatetags/placeholder_tags.py b/fluent_contents/templatetags/placeholder_tags.py
index <HASH>..<HASH> 100644
--- a/fluent_contents/templatetags/placeholder_tags.py
+++ b/fluent_contents/templatetags/placeholder_tags.py
@@ -1,14 +1,32 @@
import warnings
+from django.template import Library
+
from .fluent_contents_tags import (
PagePlaceholderNode,
RenderPlaceholderNode,
- page_placeholder,
- register,
- render_placeholder,
+ page_placeholder as new_page_placeholder,
+ render_placeholder as new_render_placeholder,
)
-warnings.warn(
- "fluent_contents.templatetags.placeholder_tags is deprecated; use fluent_contents_tags instead",
- DeprecationWarning,
-)
+
+register = Library()
+
+
+def warn():
+ warnings.warn(
+ "fluent_contents.templatetags.placeholder_tags is deprecated; use fluent_contents_tags instead",
+ DeprecationWarning,
+ )
+
+
+@register.tag
+def page_placeholder(parser, token):
+ warn()
+ return new_page_placeholder(parser, token)
+
+
+@register.tag
+def render_placeholder(parser, token):
+ warn()
+ return new_render_placeholder(parser, token) | Improved warning from placeholder_tags usage
The previous deprecation warning mechanism in placeholder_tags.py threw a
warning whether it was used or not, so I adjusted it slightly
to only emit the warning if a template tag is used. | django-fluent_django-fluent-contents | train | py |
53b2fb634d3b971dc2068a589149995e918b2f1b | diff --git a/examples/server/server.py b/examples/server/server.py
index <HASH>..<HASH> 100644
--- a/examples/server/server.py
+++ b/examples/server/server.py
@@ -1,3 +1,4 @@
+import asyncio
import json
import logging
import os
@@ -21,6 +22,7 @@ async def offer(request):
type=offer['type'])
pc = RTCPeerConnection()
+ pcs.append(pc)
@pc.on('datachannel')
def on_datachannel(channel):
@@ -40,8 +42,15 @@ async def offer(request):
}))
+pcs = []
+
+async def on_shutdown(app):
+ coros = [pc.close() for pc in pcs]
+ await asyncio.gather(*coros)
+
logging.basicConfig(level=logging.DEBUG)
app = web.Application()
+app.on_shutdown.append(on_shutdown)
app.router.add_get('/', index)
app.router.add_post('/offer', offer)
web.run_app(app, host='127.0.0.1', port=8080) | [examples] shutdown cleanly | aiortc_aiortc | train | py |
a93b127aca94c6a6be4d9b103328df64c44906c7 | diff --git a/identitytoolkit/gitkitclient.py b/identitytoolkit/gitkitclient.py
index <HASH>..<HASH> 100644
--- a/identitytoolkit/gitkitclient.py
+++ b/identitytoolkit/gitkitclient.py
@@ -192,7 +192,7 @@ class GitkitClient(object):
def FromConfigFile(cls, config):
json_data = simplejson.load(open(config))
- key_file = file(json_data['serviceAccountPrivateKeyFile'], 'rb')
+ key_file = open(json_data['serviceAccountPrivateKeyFile'], 'rb')
key = key_file.read()
key_file.close() | changed to use open() instead of file() | google_identity-toolkit-python-client | train | py |
d4e3f47d239cbd4d169e394772d78667182865af | diff --git a/mixins/observe.js b/mixins/observe.js
index <HASH>..<HASH> 100644
--- a/mixins/observe.js
+++ b/mixins/observe.js
@@ -145,6 +145,9 @@ module.exports = {
if(opts.populate)
this.populate();
+
+ if(opts.extract)
+ this.extract();
},
unobserve: function(clear) {
@@ -161,6 +164,15 @@ module.exports = {
delete this._bindings;
},
+ extract: function(clear) {
+ var self = this;
+
+ this._bindings.forEach(function(binding) {
+ binding.getter && self.$(binding.selector).trigger(binding.getter.events[0]);
+ //binding.getter && binding.setter.call(self, null, self.model.get(binding.key));
+ });
+ },
+
populate: function(clear) {
var self = this; | Implement extract functionality in mixins/observe, which extract information from the
DOM (does a get). | thecodebureau_ridge | train | js |
41e38990fee22e7d31071024f1896e9b7376750f | diff --git a/lib/media/media_source_engine.js b/lib/media/media_source_engine.js
index <HASH>..<HASH> 100644
--- a/lib/media/media_source_engine.js
+++ b/lib/media/media_source_engine.js
@@ -664,8 +664,7 @@ shaka.media.MediaSourceEngine.prototype.setTimestampOffset_ =
*/
shaka.media.MediaSourceEngine.prototype.setAppendWindowEnd_ =
function(contentType, appendWindowEnd) {
- var fudge = 1 / 25; // one frame, assuming a low framerate
- this.sourceBuffers_[contentType].appendWindowEnd = appendWindowEnd + fudge;
+ this.sourceBuffers_[contentType].appendWindowEnd = appendWindowEnd;
// Fake 'updateend' event to resolve the operation.
this.onUpdateEnd_(contentType); | Revert MediaSource append window fudge factor
This hack is no longer needed to avoid gaps, since we now have a
gap-jumping implementation in the player.
The fudge factor was causing rounding errors in presentation duration
after an end-of-stream event, which could lead to playback hangs in
certain content.
Closes #<I>
Change-Id: I<I>c8da8da<I>e1ebfb6daf7f<I>e7d<I> | google_shaka-player | train | js |
a14f5e6051f6314b77815fd4f2bf6b1ba3ed08fd | diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -1,7 +1,7 @@
import tfrddlsim
import os
-from setuptools import setup
+from setuptools import setup, find_packages
def read(filename):
@@ -20,10 +20,11 @@ setup(
license='GNU General Public License v3.0',
keywords=['rddl', 'tensorflow', 'probabilistic-planning', 'mdp', 'simulator'],
url='https://github.com/thiagopbueno/tf-rddlsim',
- packages=['tfrddlsim', 'tests'],
+ packages=find_packages(),
scripts=['scripts/tfrddlsim'],
install_requires=[
'pyrddl',
+ 'matplotlib',
'numpy',
'tensorflow',
'tensorflow-tensorboard',
diff --git a/tfrddlsim/__init__.py b/tfrddlsim/__init__.py
index <HASH>..<HASH> 100644
--- a/tfrddlsim/__init__.py
+++ b/tfrddlsim/__init__.py
@@ -1,2 +1,2 @@
-__version__ = '0.4.8'
-__release__ = 'v0.4.8-alpha'
+__version__ = '0.4.9'
+__release__ = 'v0.4.9-alpha' | Automatically find_packages() in setup.py | thiagopbueno_tf-rddlsim | train | py,py |
8298f2319fb3cc0838143d8a982dfa16b433dcc0 | diff --git a/django_q/conf.py b/django_q/conf.py
index <HASH>..<HASH> 100644
--- a/django_q/conf.py
+++ b/django_q/conf.py
@@ -1,4 +1,5 @@
import logging
+from copy import deepcopy
from signal import signal
from multiprocessing import cpu_count, Queue
@@ -50,6 +51,9 @@ class Conf(object):
# ORM broker
ORM = conf.get('orm', None)
+ # Custom broker
+ BROKER = conf.get('broker', None)
+
# Database Poll
POLL = conf.get('poll', 0.2)
@@ -169,7 +173,7 @@ if not logger.handlers:
# rollbar
if Conf.ROLLBAR:
- rollbar_conf = Conf.ROLLBAR
+ rollbar_conf = deepcopy(Conf.ROLLBAR)
try:
import rollbar
rollbar.init(rollbar_conf.pop('access_token'), environment=rollbar_conf.pop('environment'), **rollbar_conf)
@@ -180,9 +184,6 @@ else:
rollbar = None
-
-
-
# get parent pid compatibility
def get_ppid():
if hasattr(os, 'getppid'): | Fixes issue with rollbar configuration | Koed00_django-q | train | py |
2e79bd8e051e4f9848b1e19dffe728193927cf33 | diff --git a/test/common/testcase.rb b/test/common/testcase.rb
index <HASH>..<HASH> 100644
--- a/test/common/testcase.rb
+++ b/test/common/testcase.rb
@@ -28,9 +28,11 @@ module OpenSCAP
FileUtils.rm_rf workdir
Dir.mkdir workdir
Dir.chdir workdir
+ @s = nil
end
def cleanup
+ @s.destroy if @s
Dir.chdir "../.."
OpenSCAP.raise! if OpenSCAP.error?
end | tests: Make sure to clean session after each test. | OpenSCAP_ruby-openscap | train | rb |
e636e9ff69d950b1d1185b28d859f38eb9fffd9c | diff --git a/src/Cart/Helpers/CartConditionHelper.php b/src/Cart/Helpers/CartConditionHelper.php
index <HASH>..<HASH> 100644
--- a/src/Cart/Helpers/CartConditionHelper.php
+++ b/src/Cart/Helpers/CartConditionHelper.php
@@ -41,6 +41,7 @@ trait CartConditionHelper
{
$action = $this->parseAction($action);
$actionValue = array_get($action, 'value', 0);
+ $actionValuePrecision = (int)array_get($action, 'valuePrecision', 2);
if ($this->valueIsPercentage($actionValue)) {
$cleanValue = $this->cleanValue($actionValue);
@@ -50,6 +51,8 @@ trait CartConditionHelper
$value = (float)$this->cleanValue($actionValue);
}
+ $value = round($value, $actionValuePrecision);
+
$this->calculatedValue += $value;
$action['cleanValue'] = $value; | Round cart condition values (#<I>)
* Round cart conditions
* Use initial approach and make precision configurable | tastyigniter_flame | train | php |
fda902a6371667fdad357f2f2050760b864c5e54 | diff --git a/save.php b/save.php
index <HASH>..<HASH> 100644
--- a/save.php
+++ b/save.php
@@ -65,6 +65,13 @@ case 'site_setting':
// Validation
switch ($id1) {
case 'MAX_EXECUTION_TIME':
+ if ($value=='') {
+ // Delete the existing value
+ $value=null;
+ } elseif (!is_numeric($value)) {
+ fail();
+ }
+ break;
case 'SESSION_TIME':
case 'SMTP_PORT':
if (!is_numeric($value)) {
@@ -77,8 +84,11 @@ case 'site_setting':
}
break;
case 'MEMORY_LIMIT':
- // Must specify K, M or G.
- if (!preg_match('/^[0-9]+[KMG]$/', $value)) {
+ if ($value=='') {
+ // Delete the existing value
+ $value=null;
+ } elseif (!preg_match('/^[0-9]+[KMG]$/', $value)) {
+ // A number must be followed by K, M or G.
fail();
}
break; | Allow the ability to delete the memory_limit and max_execution_time settings, so we can revert to PHP defaults. | fisharebest_webtrees | train | php |
27012cbdda9fb01a17c13a652cc94e0ed0d6e3ab | diff --git a/test/active_model_test.rb b/test/active_model_test.rb
index <HASH>..<HASH> 100644
--- a/test/active_model_test.rb
+++ b/test/active_model_test.rb
@@ -51,6 +51,7 @@ class ActiveModelTest < ActiveModel::TestCase
end
def setup
+ Related.redis.flushall
@model = Related::Entity.new
end | Added missing Related.redis.flushall to ActiveModelTest#setup. | niho_related | train | rb |
e93f66284702674762ec7a6d2f3612adb3657894 | diff --git a/yagocd/exception.py b/yagocd/exception.py
index <HASH>..<HASH> 100644
--- a/yagocd/exception.py
+++ b/yagocd/exception.py
@@ -41,7 +41,13 @@ class RequestError(YagocdException):
"""
def __init__(self, summary, response):
+ """
+ :type summary: str
+ :type response: requests.models.Response
+ """
self.summary = summary
+ self.response = response
+
# noinspection PyBroadException
try:
self.json = response.json() | Save response object in the exception for extracting valuable information. | grundic_yagocd | train | py |
21bc81da6ff23ddd2059525e15e33f70ea8b01ec | diff --git a/lib/demeteorizer.js b/lib/demeteorizer.js
index <HASH>..<HASH> 100644
--- a/lib/demeteorizer.js
+++ b/lib/demeteorizer.js
@@ -13,13 +13,14 @@ const modulesNotInRegistry = [
];
/**
- * Escapes spaces out of the specified path.
+ * Escapes special characters out of the specified path.
* @param {String} filePath The path to escape.
*/
var escapePath = function (filePath) {
if (!filePath || filePath.length === 0) return filePath;
filePath = filePath.replace(/ /g, '\\ ');
+ filePath = filePath.replace(/\&/g, '\\&');
filePath = filePath.replace(/\(/g, '\\(');
filePath = filePath.replace(/\)/g, '\\)');
return filePath; | updated to escape ampersands from paths
Replace ampersands in file paths with \& to allow the shell to correctly
access the directories.
Closes #<I>. | XervoIO_demeteorizer | train | js |
b07bc142aa6b9b6624e5a1f0934ca53ec0bbcdfc | diff --git a/lib/authlogic/controller_adapters/sinatra_adapter.rb b/lib/authlogic/controller_adapters/sinatra_adapter.rb
index <HASH>..<HASH> 100644
--- a/lib/authlogic/controller_adapters/sinatra_adapter.rb
+++ b/lib/authlogic/controller_adapters/sinatra_adapter.rb
@@ -11,7 +11,7 @@ module Authlogic
end
def delete(key, options = {})
- @request.cookies.delete(key)
+ @response.delete_cookie(key, options)
end
def []=(key, options) | Fixed destroying cookies on sinatra | binarylogic_authlogic | train | rb |
0948a5d94f209110936f9dbfaf86fab5bb455d3d | diff --git a/fandjango/middleware.py b/fandjango/middleware.py
index <HASH>..<HASH> 100644
--- a/fandjango/middleware.py
+++ b/fandjango/middleware.py
@@ -72,10 +72,10 @@ class FacebookMiddleware():
# User has not authorized the application...
else:
- request.facebook_user = False
+ request.facebook_user = None
# No signed request found
else:
- request.facebook_user = False
+ request.facebook_user = None
def process_response(self, request, response): | Set request.facebook_user to None as advertised if no signed request is available | jgorset_fandjango | train | py |
d2b51a6bd52d4d3b9bcc9458884051abf49950d2 | diff --git a/tasks/clean.js b/tasks/clean.js
index <HASH>..<HASH> 100644
--- a/tasks/clean.js
+++ b/tasks/clean.js
@@ -21,10 +21,7 @@ module.exports = function(grunt) {
// cleaning outside cwd?
grunt.helper('cleanOutsideCWD', this.data);
- // cleaning actual cwd!?
- // grunt.helper('cleanCWD', this.data);
-
- // grunt.helper('clean', this.data);
+ grunt.helper('clean', this.data);
grunt.log.writeln("Folder \"" + this.data + "\" contents removed.");
}); | add test and helper to identify when cleaning outside current working dir | reputationdefender_grunt-clean | train | js |
2c084ea20136d19bd974c32e9e56638a408968ed | diff --git a/lib/chef/providers.rb b/lib/chef/providers.rb
index <HASH>..<HASH> 100644
--- a/lib/chef/providers.rb
+++ b/lib/chef/providers.rb
@@ -27,7 +27,7 @@ undef :daemonize if methods.include?('daemonize')
begin
expanded_lib_path = File.expand_path(File.join(File.dirname(__FILE__), '..'))
normalized_lib_path = File.normalize_path(expanded_lib_path)
- $:.delete_if { |i| i == expanded_lib_path || i == normalized_lib_path || i == "lib" }
+ $:.delete_if { |i| i == expanded_lib_path || File.normalize_path(i) == normalized_lib_path || i == "lib" }
end
require 'chef' | compare normalized path to normalized path | rightscale_right_link | train | rb |
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.