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
|
---|---|---|---|---|---|
9be6f6242e23ff533e5784a72724501c29ac78d8 | diff --git a/psphere/managedobjects.py b/psphere/managedobjects.py
index <HASH>..<HASH> 100644
--- a/psphere/managedobjects.py
+++ b/psphere/managedobjects.py
@@ -360,6 +360,30 @@ class ManagedEntity(ExtensibleManagedObject):
def __init__(self, mo_ref, server):
super(ManagedEntity, self).__init__(mo_ref, server)
+ @classmethod
+ def find(self, filter=None):
+ """Find ManagedEntity's of this type using the given filter.
+
+ :param filter: Find ManagedEntity's matching these key/value pairs
+ :type filter: dict
+ :returns: A list of ManagedEntity's matching the filter or None
+ :rtype: list
+ """
+ return self.vim.find_entity_view(view_type=self.__class__.__name__,
+ filter=filter)
+ @classmethod
+ def find_one(self, filter=None):
+ """Find a ManagedEntity of this type using the given filter.
+
+ If multiple ManagedEntity's are found, only the first is returned.
+
+ :param filter: Find ManagedEntity's matching these key/value pairs
+ :type filter: dict
+ :returns: A ManagedEntity's matching the filter or None
+ :rtype: ManagedEntity
+ """
+ return self.find(filter=filter)[0]
+
def find_datacenter(self, parent=None):
"""Find the datacenter which this ManagedEntity belongs to."""
# If the parent hasn't been set, use the parent of the | Provide a find and find_one method for ManagedEntity's. | psphere-project_psphere | train | py |
b6ffedb25c3040bc6a8345a5e2b006abc6f413c5 | diff --git a/src/df.js b/src/df.js
index <HASH>..<HASH> 100644
--- a/src/df.js
+++ b/src/df.js
@@ -1,3 +1,4 @@
+import * as LogManager from 'aurelia-logging';
import {I18N} from './i18n';
export class DfValueConverter {
@@ -17,7 +18,8 @@ export class DfValueConverter {
if (dfOrOptions && (typeof dfOrOptions.format === 'function')) {
return dfOrOptions.format(value);
} else if (df) {
- console.warn('This ValueConverter signature is depcrecated and will be removed in future releases. Please use the signature [dfOrOptions, locale]'); // eslint-disable-line no-console
+ let i18nLogger = LogManager.getLogger('i18n');
+ i18nLogger.warn('This ValueConverter signature is depcrecated and will be removed in future releases. Please use the signature [dfOrOptions, locale]');
} else {
df = this.service.df(dfOrOptions, locale || this.service.getLocale());
} | fix(logger): use LogManager instead console
uses the aurelia-logging service instead of direct usage of console.warn | aurelia_i18n | train | js |
c5e74234e004fbd953289609bbba077f41c425bc | diff --git a/ReText/window.py b/ReText/window.py
index <HASH>..<HASH> 100644
--- a/ReText/window.py
+++ b/ReText/window.py
@@ -111,7 +111,7 @@ class ReTextWindow(QMainWindow):
self.actionChangeFont = self.act(self.tr('Change default font'), trig=self.changeFont)
self.actionSearch = self.act(self.tr('Find text'), 'edit-find', shct=QKeySequence.Find)
self.actionSearch.setCheckable(True)
- self.actionSearch.triggered.connect(self.searchBar.setVisible)
+ self.actionSearch.triggered[bool].connect(self.searchBar.setVisible)
self.searchBar.visibilityChanged.connect(self.searchBarVisibilityChanged)
self.actionPreview = self.act(self.tr('Preview'), shct=Qt.CTRL+Qt.Key_E, trigbool=self.preview)
if QIcon.hasThemeIcon('document-preview'):
@@ -349,7 +349,7 @@ class ReTextWindow(QMainWindow):
action.triggered.connect(trig)
elif trigbool:
action.setCheckable(True)
- action.triggered.connect(trigbool)
+ action.triggered[bool].connect(trigbool)
if shct:
action.setShortcut(shct)
return action | Fix triggering boolean actions in PySide | retext-project_retext | train | py |
78ad889835b2b57e91d5a2903b23a92409d1cc9a | diff --git a/src/Codeception/Command/Run.php b/src/Codeception/Command/Run.php
index <HASH>..<HASH> 100644
--- a/src/Codeception/Command/Run.php
+++ b/src/Codeception/Command/Run.php
@@ -398,9 +398,15 @@ class Run extends Command
$tokens = explode(' ', $request);
foreach ($tokens as $token) {
$token = preg_replace('~=.*~', '', $token); // strip = from options
+
+ if (empty($token)) {
+ continue;
+ }
+
if ($token == '--') {
break; // there should be no options after ' -- ', only arguments
}
+
if (substr($token, 0, 2) === '--') {
$options[] = substr($token, 2);
} elseif ($token[0] === '-') { | Fixed uninitialized string offset (#<I>) | Codeception_base | train | php |
231a7b9bf4ebdcaae52ea6417099a0d40821e4b7 | diff --git a/core/server/api/canary/utils/serializers/output/products.js b/core/server/api/canary/utils/serializers/output/products.js
index <HASH>..<HASH> 100644
--- a/core/server/api/canary/utils/serializers/output/products.js
+++ b/core/server/api/canary/utils/serializers/output/products.js
@@ -73,6 +73,7 @@ function serializeProduct(product, options, apiType) {
name: json.name,
description: json.description,
slug: json.slug,
+ active: json.active,
type: json.type,
created_at: json.created_at,
updated_at: json.updated_at,
@@ -161,6 +162,8 @@ function createSerializer(debugString, serialize) {
* @prop {string} name
* @prop {string} slug
* @prop {string} description
+ * @prop {boolean} active
+ * @prop {string} type
* @prop {Date} created_at
* @prop {Date} updated_at
* @prop {StripePrice[]} [stripe_prices] | Added active flag to products API (#<I>)
refs <URL> as
active or archived | TryGhost_Ghost | train | js |
17499e430c9d594fafa6e2e53638c502aff2380b | diff --git a/resources/views/previewLinkPopup.blade.php b/resources/views/previewLinkPopup.blade.php
index <HASH>..<HASH> 100644
--- a/resources/views/previewLinkPopup.blade.php
+++ b/resources/views/previewLinkPopup.blade.php
@@ -1,6 +1,7 @@
<div id="MailPreviewDriverBox" style="
position:absolute;
- top:0;
+ top:10px;
+ right:10px;
z-index:99999;
background:#fff;
border:solid 1px #ccc;
@@ -15,9 +16,19 @@
<a style="text-decoration: underline" href="{{ $previewUrl }}&file_type=eml">Open mail in email client</a>
</li>
</ul>
+ <span onclick="closePopup()" id="close" style="
+ cursor: pointer;
+ font-size: smaller;
+ position: absolute;
+ top: 2px;
+ right: 6px;
+ font-family: monospace;">X</span>
</div>
<script type="text/javascript">
- setTimeout(function () {
+ function closePopup() {
document.body.removeChild(document.getElementById('MailPreviewDriverBox'));
- }, $timeoutInSeconds * 1000);
+ }
+ @if($timeoutInSeconds)
+ setTimeout(closePopup(), {{ $timeoutInSeconds }} * 1000);
+ @endif
</script> | fix: make setTimeoutInSeconds works
In previous version, variable $timeoutInSeconds wasn't scaped by double braces, so blade puts it like a string.
Now, it is fixed, and as a plus, added a X button to close manually | themsaid_laravel-mail-preview | train | php |
47029fc8d851ab05988e8fbef6c0ba3bd91fe6eb | diff --git a/lib/bibliothecary/parsers/npm.rb b/lib/bibliothecary/parsers/npm.rb
index <HASH>..<HASH> 100644
--- a/lib/bibliothecary/parsers/npm.rb
+++ b/lib/bibliothecary/parsers/npm.rb
@@ -25,7 +25,7 @@ module Bibliothecary
},
match_filename("npm-ls.json") => {
kind: 'lockfile',
- parser: :parse_tree
+ parser: :parse_ls
}
}
end
@@ -80,7 +80,7 @@ module Bibliothecary
end
end
- def self.parse_tree(file_contents)
+ def self.parse_ls(file_contents)
manifest = JSON.parse(file_contents)
transform_tree_to_array(manifest.fetch('dependencies', {})) | Also rename method to be more consistent. | librariesio_bibliothecary | train | rb |
a89e7ae3aec51a9cfe1615af3c09c082b2a622ac | diff --git a/tests/Kernel/Http/StreamResponseTest.php b/tests/Kernel/Http/StreamResponseTest.php
index <HASH>..<HASH> 100644
--- a/tests/Kernel/Http/StreamResponseTest.php
+++ b/tests/Kernel/Http/StreamResponseTest.php
@@ -1,12 +1,20 @@
<?php
+/*
+ * This file is part of the overtrue/wechat.
+ *
+ * (c) overtrue <[email protected]>
+ *
+ * This source file is subject to the MIT license that is bundled
+ * with this source code in the file LICENSE.
+ */
+
use EasyWeChat\Kernel\Http\StreamResponse;
use EasyWeChat\Tests\TestCase;
use org\bovigo\vfs\vfsStream;
use org\bovigo\vfs\vfsStreamDirectory;
use org\bovigo\vfs\vfsStreamWrapper;
-
class StreamResponseTest extends TestCase
{
public function setUp() | Apply fixes from StyleCI (#<I>)
[ci skip] [skip ci] | overtrue_wechat | train | php |
1734064d3d0c2d73c2c512bad86a32a711a02625 | diff --git a/cleanse.js b/cleanse.js
index <HASH>..<HASH> 100644
--- a/cleanse.js
+++ b/cleanse.js
@@ -60,8 +60,10 @@ function cleanseHtml(str, options){
str = str.replace(/<head\b[^<]*(?:(?!<\/head>)<[^<]*)*<\/head>/gi,' '); //removes head section entirely
if(options.style)
str = str.replace(/<style\b[^<]*(?:(?!<\/style>)<[^<]*)*<\/style>/gi,' '); //removes style section entirely
- if(options.html)
+ if(options.html){
+ str = str.replace(/='.*?'/gm,'=""');
str = str.replace(/<(?:.|\n)*?>/gm,' '); //remove all remaining tags
+ }
//cleanup
str = str.replace(/\s{2,}/g, ' '); //replace more than one space with a single space
str = str.replace(/^\s+/,''); //remove lead space | fixed mid attribute '>' usage
by completely clearing out attributes first before removing the tag | dprior_cleanse-html | train | js |
0645ac50049ac2f7223ad953cba25bd0f16f1b85 | diff --git a/errors.js b/errors.js
index <HASH>..<HASH> 100644
--- a/errors.js
+++ b/errors.js
@@ -462,6 +462,7 @@ module.exports.classify = function classify(err) {
case 'tchannel-thrift-handler.parse-error.head-failed':
case 'tchannel.checksum':
case 'tchannel.duplicate-header-key':
+ case 'tchannel.null-key':
return 'BadRequest';
case 'tchannel.init.call-request-before-init-request':
@@ -480,7 +481,6 @@ module.exports.classify = function classify(err) {
case 'tchannel.invalid-error-code':
case 'tchannel.invalid-frame-type':
case 'tchannel.missing-init-header':
- case 'tchannel.null-key':
case 'tchannel.protocol.read-failed':
case 'tchannel.protocol.write-failed':
case 'tchannel.unhandled-frame-type': | errors: move null key to bad request | uber_tchannel-node | train | js |
8da1859758490f032871eabd2aef632de4362cce | diff --git a/tests/test.js b/tests/test.js
index <HASH>..<HASH> 100644
--- a/tests/test.js
+++ b/tests/test.js
@@ -55,6 +55,12 @@ describe('lessWatchCompilerUtils Module API', function(){
lessWatchCompilerUtils.config.sourceMap = true;
assert.equal("lessc --source-map test testFolder/test.css", lessWatchCompilerUtils.compileCSS("test", true));
});
+ it('should run the correct command with minified flag', function(){
+ lessWatchCompilerUtils.config.outputFolder = "testFolder";
+ lessWatchCompilerUtils.config.minified = true;
+ lessWatchCompilerUtils.config.sourceMap = false;
+ assert.equal("lessc -x test testFolder/test.min.css", lessWatchCompilerUtils.compileCSS("test", true));
+ });
})
describe('filterFiles()', function(){
it('filterFiles() function should be there', function(){ | test: Add test for minified flag | jonycheung_deadsimple-less-watch-compiler | train | js |
6fd5d41eaa81d79ae0923e159d350873c3187133 | diff --git a/estnltk/storage/postgres/where_clause.py b/estnltk/storage/postgres/where_clause.py
index <HASH>..<HASH> 100644
--- a/estnltk/storage/postgres/where_clause.py
+++ b/estnltk/storage/postgres/where_clause.py
@@ -23,13 +23,16 @@ class WhereClause(Composed):
else:
super().__init__([])
+ # We omit layers inside a Text object.
+ self._required_layers = sorted(set(layer_query or []) | set(layer_ngram_query or []))
+ self.collection = collection
+
def __bool__(self):
return bool(self.seq)
- # TODO
@property
- def required_tables(self):
- return self.required_layer_tables
+ def required_layers(self):
+ return self._required_layers
# TODO
@property | added property WhereClause.required_layers | estnltk_estnltk | train | py |
3a069a6921092726bc6ee5044dc7d8331d424d87 | diff --git a/Doctrine/Mapper/MetaInformationFactory.php b/Doctrine/Mapper/MetaInformationFactory.php
index <HASH>..<HASH> 100644
--- a/Doctrine/Mapper/MetaInformationFactory.php
+++ b/Doctrine/Mapper/MetaInformationFactory.php
@@ -55,7 +55,7 @@ class MetaInformationFactory
}
if (!$this->annotationReader->hasDocumentDeclaration($entity)) {
- throw new \RuntimeException(sprintf('no declaration for document found in entity %s', $className));
+ return null;
}
$metaInformation = new MetaInformation(); | do not throw exception if a entity has no document annotation | floriansemm_SolrBundle | train | php |
0d69e039064ab2c0451a57dce06a508d6fdbd91f | diff --git a/rrecur.js b/rrecur.js
index <HASH>..<HASH> 100644
--- a/rrecur.js
+++ b/rrecur.js
@@ -118,6 +118,11 @@
}
if ('UNTIL' === k || 'DTSTART' === k) {
+ if ('number' === typeof v) {
+ v = new Date(v).toISOString();
+ } else if ('object' === typeof v) {
+ v = v.toISOString();
+ }
v = v.replace(/\-|:/g, '').replace(/\.\d+/, '');
} | fix #2 convert date object and integer timestamp to iso string for until and dtstart | solderjs_rrecurjs | train | js |
db022830a645dca8273d1fe42cd41ea58f5e608a | diff --git a/h5p.classes.php b/h5p.classes.php
index <HASH>..<HASH> 100644
--- a/h5p.classes.php
+++ b/h5p.classes.php
@@ -1864,7 +1864,7 @@ class H5PCore {
'js/h5p-utils.js',
);
- public static $defaultContentWhitelist = 'json png jpg jpeg gif bmp tif tiff svg eot ttf woff woff2 otf webm mp4 ogg mp3 wav txt pdf rtf doc docx xls xlsx ppt pptx odt ods odp xml csv diff patch swf md textile vtt webvtt';
+ public static $defaultContentWhitelist = 'json png jpg jpeg gif bmp tif tiff svg eot ttf woff woff2 otf webm mp4 ogg mp3 m4a wav txt pdf rtf doc docx xls xlsx ppt pptx odt ods odp xml csv diff patch swf md textile vtt webvtt';
public static $defaultLibraryWhitelistExtras = 'js css';
public $librariesJsonData, $contentJsonData, $mainJsonData, $h5pF, $fs, $h5pD, $disableFileCheck; | Add m4a extension to content files whitelist | h5p_h5p-php-library | train | php |
b764ac1c55fb5d4b7f155fdddce87bd03aef6899 | diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -2,13 +2,13 @@ from setuptools import setup
setup(
name="tyoi.OAuth2",
- version="0.1.0",
+ version="0.2.0",
author="Ryan Horn",
author_email="[email protected]",
description=("Implements the client side of the OAuth 2 protocol"),
keywords="oauth oauth2 auth authentication",
url="https://github.com/ryanhorn/tyoiOAuth2",
- packages=["tyoi", "tyoi.oauth2"],
+ packages=["tyoi", "tyoi.oauth2", "tyoi.oauth2.grants", "tyoi.oauth2.authenticators"],
test_suite="tests",
tests_require=["mox"]
) | Updated setup.py with new version and packages | ryanhorn_tyoiOAuth2 | train | py |
ccd492c37139e676256afcfa8a12803fe75530ee | diff --git a/lib/conceptql/rdbms/postgres.rb b/lib/conceptql/rdbms/postgres.rb
index <HASH>..<HASH> 100644
--- a/lib/conceptql/rdbms/postgres.rb
+++ b/lib/conceptql/rdbms/postgres.rb
@@ -32,6 +32,10 @@ module ConceptQL
def explain_temp_tables?
ENV["CONCEPTQL_PG_EXPLAIN_TEMP_TABLES"] == "true"
end
+
+ def preferred_formatter
+ SqlFormatters::PgFormat
+ end
end
end
end | Introduce RDBMS#preferred_formatter
sql_format doesn't format our commented PostgreSQL SQL very nicely,
so we'll use pg_format when we're formatting PostgreSQL-oriented SQL
This is a quick hack to allow an RDBMS to list a preferred formatter
and I'd really like to refactor this some day | outcomesinsights_conceptql | train | rb |
4f6189bee6eef3f9f347dca6589093580a221ab9 | diff --git a/benchexec/tablegenerator/__init__.py b/benchexec/tablegenerator/__init__.py
index <HASH>..<HASH> 100755
--- a/benchexec/tablegenerator/__init__.py
+++ b/benchexec/tablegenerator/__init__.py
@@ -1159,11 +1159,8 @@ def basename_without_ending(file):
name = name[:-4]
return name
-def main(args=None):
-
- if args is None:
- args = sys.argv
+def create_argument_parser():
parser = argparse.ArgumentParser(
fromfile_prefix_chars='@',
description=
@@ -1247,8 +1244,10 @@ def main(args=None):
parser.add_argument("--version",
action="version", version="%(prog)s " + __version__
)
+ return parser
- options = parser.parse_args(args[1:])
+def main(args=None):
+ options = create_argument_parser().parse_args((args or sys.argv)[1:])
logging.basicConfig(format="%(levelname)s: %(message)s",
level=logging.WARNING if options.quiet else logging.INFO) | Refactoring: extract method in table-generator | sosy-lab_benchexec | train | py |
3435f39bab7731e1600a0e3d422c2baa5040d2e9 | diff --git a/course/jumpto.php b/course/jumpto.php
index <HASH>..<HASH> 100644
--- a/course/jumpto.php
+++ b/course/jumpto.php
@@ -10,6 +10,10 @@
$jump = optional_param('jump', '', PARAM_RAW);
+ if (!confirm_sesskey()) {
+ print_error('confirmsesskeybad');
+ }
+
if (strpos($jump, $CFG->wwwroot) === 0) { // Anything on this site
redirect(urldecode($jump));
} else if (preg_match('/^[a-z]+\.php\?/', $jump)) {
diff --git a/lib/weblib.php b/lib/weblib.php
index <HASH>..<HASH> 100644
--- a/lib/weblib.php
+++ b/lib/weblib.php
@@ -1053,6 +1053,7 @@ function popup_form($common, $options, $formname, $selected='', $nothing='choose
}
$output .= '</select>';
+ $output .= '<input type="hidden" name="sesskey" value="'.sesskey().'" />';
$output .= '<noscript id="noscript'.$formname.'" style="display: inline;">';
$output .= '<input type="submit" value="'.$go.'" /></noscript>';
$output .= '<script type="text/javascript">'. | validate local redirection actions in jumpto.php SC#<I> | moodle_moodle | train | php,php |
68e55239c8e099ea8e5b473767f4f84f28b8e28e | diff --git a/notario/decorators.py b/notario/decorators.py
index <HASH>..<HASH> 100644
--- a/notario/decorators.py
+++ b/notario/decorators.py
@@ -58,7 +58,8 @@ def not_empty(_object):
@instance_of()
def decorated(value):
- assert value, "is empty"
+ name = getattr(value, '__name__', getattr(value.__class__, '__name__'))
+ assert value, "%s is empty" % name
return _validator(value)
return decorated
assert _object, "is empty" | is_empty has a better failure message | alfredodeza_notario | train | py |
b89999ad1fe357121d471b15ea8ee297cd2583f4 | diff --git a/tests/job/validation_test.py b/tests/job/validation_test.py
index <HASH>..<HASH> 100644
--- a/tests/job/validation_test.py
+++ b/tests/job/validation_test.py
@@ -262,7 +262,7 @@ class ClassicalHazardFormTestCase(unittest.TestCase):
'Number of logic tree samples must be >= 0',
],
'poes': [
- 'PoEs for hazard maps must be in the range [0, 1]',
+ '`poes` values must be in the range [0, 1]',
],
'quantile_hazard_curves': [
'Quantile hazard curve values must in the range [0, 1]' | tests/job/validation_test:
Updated expected error message string in reference to a `poes` param error. | gem_oq-engine | train | py |
f53f416561b90de1bdcadfcabcfdf8b0e307622f | diff --git a/src/Data/ListController.js b/src/Data/ListController.js
index <HASH>..<HASH> 100644
--- a/src/Data/ListController.js
+++ b/src/Data/ListController.js
@@ -1,14 +1,24 @@
"use strict";
+let route;
+
class ListController {
- constructor(app, Module, $routeParams) {
+ constructor(app, Module, $routeParams, $route) {
this.app = app;
+ route = $route;
var elements = Module.retrieve(app);
for (let name in elements) {
this[name] = elements[name];
}
+ var setup = {};
+ this.Meta.fieldsets.map(fieldset => {
+ if (fieldset.primary) {
+ fieldset.fields.map(field => setup[field] = undefined);
+ }
+ });
+ this.Model.$load(setup);
this.items = [];
this.page($routeParams);
}
@@ -16,9 +26,20 @@ class ListController {
page(params) {
this.Service.list(params).success(items => this.items = items);
}
+
+ create() {
+ this.Meta.$create(this.Model).success(() => {
+ this.form = false;
+ route.reload();
+ });
+ }
+
+ reset() {
+ this.Model.$load({});
+ }
};
-ListController.$inject = ['app', 'Module', '$routeParams'];
+ListController.$inject = ['app', 'Module', '$routeParams', '$route'];
export {ListController}; | empty model needs setup; add create method | monomelodies_monad | train | js |
3cd26eabd8947dc60b894b5324d14a78114f087f | diff --git a/api/config.go b/api/config.go
index <HASH>..<HASH> 100644
--- a/api/config.go
+++ b/api/config.go
@@ -3,6 +3,7 @@ package api
import (
"flag"
"net"
+ "net/http"
"net/http/httputil"
"net/url"
@@ -58,4 +59,11 @@ func ConfigProcess() {
log.Fatal(4, "API Cannot parse fallback-graphite-addr: %s", err)
}
graphiteProxy = httputil.NewSingleHostReverseProxy(u)
+ // remove these headers from upstream
+ // we will set our own correct ones (and duplicate headers are illegal)
+ graphiteProxy.ModifyResponse = func(resp *http.Response) error {
+ resp.Header.Del("access-control-allow-credentials")
+ resp.Header.Del("Access-Control-Allow-Origin")
+ return nil
+ }
} | fix duplicate access control headers leading to browser blocking
requests
we can now successfully use MT directly from browser, with dynamic
proxying! | grafana_metrictank | train | go |
49b47dc41ea071e293f1974049b126a6817a4f4b | diff --git a/core/src/main/java/hudson/tasks/MailSender.java b/core/src/main/java/hudson/tasks/MailSender.java
index <HASH>..<HASH> 100644
--- a/core/src/main/java/hudson/tasks/MailSender.java
+++ b/core/src/main/java/hudson/tasks/MailSender.java
@@ -312,7 +312,12 @@ public class MailSender {
rcp.addAll(buildCulpritList(listener,b.getCulprits()));
} else {
// ordinary address
- rcp.add(new InternetAddress(address));
+ try {
+ rcp.add(new InternetAddress(address));
+ } catch (AddressException e) {
+ // report bad address, but try to send to other addresses
+ e.printStackTrace(listener.error(e.getMessage()));
+ }
}
} | [FIXED HUDSON-<I>] Send build status email to valid addresses rather than aborting
for one invalid address
git-svn-id: <URL> | jenkinsci_jenkins | train | java |
a105a0e78137879c4f548f35bb7800a7f0eb51d1 | diff --git a/python/mxboard/event_file_writer.py b/python/mxboard/event_file_writer.py
index <HASH>..<HASH> 100644
--- a/python/mxboard/event_file_writer.py
+++ b/python/mxboard/event_file_writer.py
@@ -32,6 +32,8 @@ import six
from .proto import event_pb2
from .record_writer import RecordWriter
+logging.basicConfig()
+
class EventsWriter(object):
"""Writes `Event` protocol buffers to an event file. This class is ported from | Fix logging problem in py<I> | awslabs_mxboard | train | py |
b108019f4d5f818205f43b78cbece04c1cd25749 | diff --git a/protocols/primary-backup/src/main/java/io/atomix/protocols/backup/proxy/PrimaryBackupProxy.java b/protocols/primary-backup/src/main/java/io/atomix/protocols/backup/proxy/PrimaryBackupProxy.java
index <HASH>..<HASH> 100644
--- a/protocols/primary-backup/src/main/java/io/atomix/protocols/backup/proxy/PrimaryBackupProxy.java
+++ b/protocols/primary-backup/src/main/java/io/atomix/protocols/backup/proxy/PrimaryBackupProxy.java
@@ -229,6 +229,7 @@ public class PrimaryBackupProxy extends AbstractPrimitiveProxy {
.whenCompleteAsync((response, error) -> {
protocol.unregisterEventListener(sessionId);
clusterService.removeListener(clusterEventListener);
+ future.complete(null);
}, threadContext);
} else {
future.complete(null); | Ensure PrimaryBackupProxy.close future is properly completed. | atomix_atomix | train | java |
b630d82fc03cd43ed34fe586297c97e63e4d1e2b | diff --git a/robjects/tests.py b/robjects/tests.py
index <HASH>..<HASH> 100644
--- a/robjects/tests.py
+++ b/robjects/tests.py
@@ -2,6 +2,8 @@ import unittest
import redis
from robjects.base import BaseObject
+from robjects.objects import JsonObject, HashObject
+
r = redis.Redis()
r.flushdb()
@@ -65,5 +67,23 @@ class ObjectTestMixin(object):
self.assertEquals(self.CLS.count(), 0)
+class TestJsonObject(JsonObject):
+ redis = r
+ HASH_KEY = 'testjson'
+
+
+class JsonObjectTest(ObjectTestCase, ObjectTestMixin):
+ CLS = TestJsonObject
+
+
+class TestHashObject(HashObject):
+ redis = r
+ HASH_KEY = 'testhash%s'
+
+
+class HashObjectTest(ObjectTestCase, ObjectTestMixin):
+ CLS = TestHashObject
+
+
if __name__ == '__main__':
unittest.main() | add tests for JsonObject and HashObject | relekang_rob | train | py |
ef08dd9082e3de7bcae3c274adaf1a08015dd858 | diff --git a/index.js b/index.js
index <HASH>..<HASH> 100644
--- a/index.js
+++ b/index.js
@@ -135,7 +135,7 @@ HtmlWebpackPugPlugin.prototype.injectAssetsIntoSlim = function (file, styles, sc
*/
HtmlWebpackPugPlugin.prototype.injectAssets = function (file, head, body, assets) {
var self = this;
- var bodyRegExp = /( *)(%?body)/i;
+ var bodyRegExp = /^( *)(%?body)\b/im;
var match = bodyRegExp.exec(file);
if (match) { | Fix adding link tag to head when word 'body' is present in content | negibouze_html-webpack-pug-plugin | train | js |
16b0bc7c3beea94c2f11cd241003a2f1297c2aec | diff --git a/crypto/secp256k1/secp256.go b/crypto/secp256k1/secp256.go
index <HASH>..<HASH> 100644
--- a/crypto/secp256k1/secp256.go
+++ b/crypto/secp256k1/secp256.go
@@ -20,11 +20,11 @@ package secp256k1
/*
#cgo CFLAGS: -I./libsecp256k1
-#cgo darwin CFLAGS: -I/usr/local/include
+#cgo darwin CFLAGS: -I/usr/local/include -I/opt/pkg/include
#cgo freebsd CFLAGS: -I/usr/local/include
#cgo linux,arm CFLAGS: -I/usr/local/arm/include
#cgo LDFLAGS: -lgmp
-#cgo darwin LDFLAGS: -L/usr/local/lib
+#cgo darwin LDFLAGS: -L/usr/local/lib -L/opt/pkg/lib
#cgo freebsd LDFLAGS: -L/usr/local/lib
#cgo linux,arm LDFLAGS: -L/usr/local/arm/lib
#define USE_NUM_GMP | crypto/secp<I>k1: add C compiler flags for pkgsrc
pkgsrc is a cross-platform package manager that also
supports OS X. | ethereum_go-ethereum | train | go |
1ea2eff23229d3647b52605b1484d2bea6a3a948 | diff --git a/java/client/test/org/openqa/selenium/RenderedWebElementTest.java b/java/client/test/org/openqa/selenium/RenderedWebElementTest.java
index <HASH>..<HASH> 100644
--- a/java/client/test/org/openqa/selenium/RenderedWebElementTest.java
+++ b/java/client/test/org/openqa/selenium/RenderedWebElementTest.java
@@ -141,6 +141,7 @@ public class RenderedWebElementTest extends AbstractDriverTestCase {
assertTrue("The element and the enclosing map should be considered shown.", isShown);
}
+ @Ignore
@JavascriptEnabled
public void testCanClickOnSuckerFishMenuItem() throws Exception {
if (!hasInputDevices()) { | JasonLeyba: @Ignoring test that fails for all configs.
r<I> | SeleniumHQ_selenium | train | java |
b7bf295274856b754102bc1789176b5f2ab34cb5 | diff --git a/lxd-agent/exec.go b/lxd-agent/exec.go
index <HASH>..<HASH> 100644
--- a/lxd-agent/exec.go
+++ b/lxd-agent/exec.go
@@ -235,7 +235,7 @@ func (s *execWs) Do(op *operations.Operation) error {
stderr = ttys[2]
}
- controlExit := make(chan bool)
+ controlExit := make(chan bool, 1)
attachedChildIsBorn := make(chan int)
attachedChildIsDead := make(chan bool, 1)
var wgEOF sync.WaitGroup | lxd-agent/exec: Add buffered channel to prevent deadlock on cmd exit | lxc_lxd | train | go |
979a04482036632b4670a9eb067f642514f6dc39 | diff --git a/hanlp/components/sts/transformer_sts.py b/hanlp/components/sts/transformer_sts.py
index <HASH>..<HASH> 100644
--- a/hanlp/components/sts/transformer_sts.py
+++ b/hanlp/components/sts/transformer_sts.py
@@ -161,7 +161,10 @@ class TransformerSemanticTextualSimilarity(TorchComponent):
# noinspection PyMethodOverriding
def build_model(self, transformer, training=True, **kwargs) -> torch.nn.Module:
config = AutoConfig_.from_pretrained(transformer, num_labels=1)
- model = AutoModelForSequenceClassification.from_pretrained(transformer, config=config)
+ if training:
+ model = AutoModelForSequenceClassification.from_pretrained(transformer, config=config)
+ else:
+ model = AutoModelForSequenceClassification.from_config(config)
return model
def predict(self, data: Union[List[str], List[List[str]]], batch_size: int = None, **kwargs) -> Union[
diff --git a/hanlp/version.py b/hanlp/version.py
index <HASH>..<HASH> 100644
--- a/hanlp/version.py
+++ b/hanlp/version.py
@@ -2,5 +2,5 @@
# Author: hankcs
# Date: 2019-12-28 19:26
-__version__ = '2.1.0-alpha.45'
+__version__ = '2.1.0-alpha.46'
"""HanLP version""" | Avoid re-downloading Electra model | hankcs_HanLP | train | py,py |
3cdd7cb1bd766359fc8d650d43cf4197eefa9b64 | diff --git a/src/gitgraph.js b/src/gitgraph.js
index <HASH>..<HASH> 100644
--- a/src/gitgraph.js
+++ b/src/gitgraph.js
@@ -538,11 +538,19 @@
// Add start point
if (this.parentBranch) {
- this.startPoint = {
- x: this.parentBranch.offsetX - this.parent.commitOffsetX + this.template.commit.spacingX,
- y: this.parentBranch.offsetY - this.parent.commitOffsetY + this.template.commit.spacingY,
- type: "start"
- };
+ if ( this.parentCommit === this.parentBranch.commits.slice( -1 )[ 0 ] ) {
+ this.startPoint = {
+ x: this.parentBranch.offsetX - this.parent.commitOffsetX + this.template.commit.spacingX,
+ y: this.parentBranch.offsetY - this.parent.commitOffsetY + this.template.commit.spacingY,
+ type: "start"
+ };
+ } else {
+ this.startPoint = {
+ x: this.parentCommit.x,
+ y: this.parentCommit.y,
+ type: "start"
+ };
+ }
} else {
this.startPoint = null;
} | Branch from the latest point instead of parent commit when parent commit is the head of parent branch | nicoespeon_gitgraph.js | train | js |
d2d4882968913ae87c340c622721299bd5278b19 | diff --git a/timepiece/forms.py b/timepiece/forms.py
index <HASH>..<HASH> 100644
--- a/timepiece/forms.py
+++ b/timepiece/forms.py
@@ -77,12 +77,12 @@ class EditPersonForm(auth_forms.UserChangeForm):
label=_(u'Repeat Password'),
widget=forms.PasswordInput(render_value=False))
- class Meta:
- model = auth_models.User
- fields = (
- "username", "first_name", "last_name",
- "email", "is_active", "is_staff"
- )
+ def __init__(self, *args, **kwargs):
+ super(EditPersonForm, self).__init__(*args, **kwargs)
+
+ # In 1.4 this field is created even if it is excluded in Meta.
+ if 'password' in self.fields:
+ del(self.fields['password'])
def clean_password(self):
return self.cleaned_data.get('password_one', None)
@@ -106,6 +106,11 @@ class EditPersonForm(auth_forms.UserChangeForm):
instance.save()
return instance
+ class Meta:
+ model = auth_models.User
+ fields = ('username', 'first_name', 'last_name', 'email', 'is_active',
+ 'is_staff')
+
class QuickSearchForm(forms.Form):
quick_search = selectable_forms.AutoCompleteSelectField( | refs #<I> - Removed extra password field from Edit Person form | caktus_django-timepiece | train | py |
a758daed7064797ceebfab7a1ae29b3bd475b5c1 | diff --git a/resources/config/default.php b/resources/config/default.php
index <HASH>..<HASH> 100644
--- a/resources/config/default.php
+++ b/resources/config/default.php
@@ -58,7 +58,8 @@ return function (CM_Config_Node $config) {
);
$config->CM_Http_Response_View_Abstract->exceptionsToCatch = array(
- 'CM_Exception_Nonexistent' => [],
+ 'CM_Exception_Nonexistent' => ['log' => 'CM_Paging_Log_NotFound'],
+ 'CM_Exception_InvalidParam' => ['log' => 'CM_Paging_Log_NotFound'],
'CM_Exception_AuthRequired' => [],
'CM_Exception_NotAllowed' => [],
'CM_Exception_Blocked' => [], | Log "nonexistent" and "invalid param" in view responses | cargomedia_cm | train | php |
894073fb8bbbb42c13efac02caab0c019ca24639 | diff --git a/tools/upload_website.js b/tools/upload_website.js
index <HASH>..<HASH> 100755
--- a/tools/upload_website.js
+++ b/tools/upload_website.js
@@ -1,4 +1,6 @@
#!/usr/bin/env node
-const run = require('./run');
-// pip install aws
-run.sh(`aws s3 sync website/ s3://propelml.org --follow-symlinks --delete`);
+const { execSync } = require("child_process");
+// pip install awscli
+execSync("aws s3 sync website/ s3://propelml.org --follow-symlinks --delete", {
+ stdio: "inherit"
+}); | tools: make upload_website work on windows | propelml_propel | train | js |
02db783124d145b80d4a89f587133cf9ff8cf3b8 | diff --git a/addon/components/flexberry-layers-attributes-panel.js b/addon/components/flexberry-layers-attributes-panel.js
index <HASH>..<HASH> 100644
--- a/addon/components/flexberry-layers-attributes-panel.js
+++ b/addon/components/flexberry-layers-attributes-panel.js
@@ -667,7 +667,7 @@ export default Ember.Component.extend(LeafletZoomToFeatureMixin, {
case 'MultiSurfacePropertyType':
case 'PolygonPropertyType':
case 'MultiPolygonPropertyType':
- return ['circle', 'rectangle', 'polygon'];
+ return ['rectangle', 'polygon'];
}
} | Remove 'circle' from available draw tools for polygon layer. | Flexberry_ember-flexberry-gis | train | js |
62f6a42dfc0b068fec5955a1ea9223d3741c2bf0 | diff --git a/pandas/core/series.py b/pandas/core/series.py
index <HASH>..<HASH> 100644
--- a/pandas/core/series.py
+++ b/pandas/core/series.py
@@ -166,6 +166,8 @@ class Series(base.IndexOpsMixin, generic.NDFrame):
Data type for the output Series. If not specified, this will be
inferred from `data`.
See the :ref:`user guide <basics.dtypes>` for more usages.
+ name : str, optional
+ The name to give to the Series.
copy : bool, default False
Copy input data.
""" | added names, fastpath parameters explanation to pandas.Series (#<I>) | pandas-dev_pandas | train | py |
e31c9c7bc67da2b50a230b771090bcb5ace2c692 | diff --git a/test/index.js b/test/index.js
index <HASH>..<HASH> 100644
--- a/test/index.js
+++ b/test/index.js
@@ -92,8 +92,20 @@ infos.inbox[1] = infos.tasks[0]
infos.inbox[2] = infos.tasks[1]
infos.inbox[3] = infos.tasks[1]
+console.log(infos)
+
+assert(infos.inbox[0] === infos.tasks[0])
+assert(infos.inbox[1] === infos.tasks[0])
+assert(infos.inbox[2] === infos.tasks[1])
+assert(infos.inbox[3] === infos.tasks[1])
+
var result4 = JSON.stringify(infos, decycle())
console.log(result4)
result4 = JSON.parse(result4, retrocycle())
console.log(result4)
+
+assert(result4.inbox[0] === result4.tasks[0])
+assert(result4.inbox[1] === result4.tasks[0])
+assert(result4.inbox[2] === result4.tasks[1])
+assert(result4.inbox[3] === result4.tasks[1]) | add asserts for infos and result4 | YChebotaev_json-decycle | train | js |
0bb3998a6a7a82b4c4269f3c57a9fcbe7229b162 | diff --git a/src/event.js b/src/event.js
index <HASH>..<HASH> 100644
--- a/src/event.js
+++ b/src/event.js
@@ -133,7 +133,7 @@ jQuery.event = {
var namespaces = type.split(".");
type = namespaces.shift();
var all = !namespaces.length,
- namespace = new RegExp("(^|\\.)" + namespaces.slice().sort().join("\\.(?:.*\\.)?") + "(\\.|$)"),
+ namespace = new RegExp("(^|\\.)" + namespaces.slice(0).sort().join("\\.(?:.*\\.)?") + "(\\.|$)"),
special = this.special[ type ] || {};
if ( events[ type ] ) {
@@ -291,7 +291,7 @@ jQuery.event = {
// Cache this now, all = true means, any handler
all = !namespaces.length && !event.exclusive;
- var namespace = new RegExp("(^|\\.)" + namespaces.slice().sort().join("\\.(?:.*\\.)?") + "(\\.|$)");
+ var namespace = new RegExp("(^|\\.)" + namespaces.slice(0).sort().join("\\.(?:.*\\.)?") + "(\\.|$)");
handlers = ( jQuery.data(this, "events") || {} )[ event.type ]; | Re-adding zeros removed from slice calls in last commit. | jquery_jquery | train | js |
1458729646f070702e705f94fee838e81bd01a24 | diff --git a/salt/engines/stalekey.py b/salt/engines/stalekey.py
index <HASH>..<HASH> 100644
--- a/salt/engines/stalekey.py
+++ b/salt/engines/stalekey.py
@@ -51,7 +51,7 @@ def _get_keys():
def start(interval=3600, expire=604800):
ck = salt.utils.minions.CkMinions(__opts__)
- presence_file = '{0}/minions/presence.p'.format(__opts__['cachedir'])
+ presence_file = '{0}/presence.p'.format(__opts__['cachedir'])
wheel = salt.wheel.WheelClient(__opts__)
while True: | Create presence.p directly in cachedir
salt-key was stacktracing when finding the presence.p file
in /var/cache/salt/master/minions | saltstack_salt | train | py |
c3eb5106c52d449404cfa7846265a1d6b15c4379 | diff --git a/pydsl/Grammar/Checker.py b/pydsl/Grammar/Checker.py
index <HASH>..<HASH> 100644
--- a/pydsl/Grammar/Checker.py
+++ b/pydsl/Grammar/Checker.py
@@ -65,16 +65,12 @@ class BNFChecker(Checker):
def __init__(self, bnf, parser = "auto"):
Checker.__init__(self)
parser = bnf.options.get("parser",parser)
- if parser == "descent":
+ if parser == "descent" or parser == "auto" or parser == "default":
from .Parser.RecursiveDescent import RecursiveDescentParser
self.__parser = RecursiveDescentParser(bnf)
elif parser == "weighted":
self.__parser = WeightedParser(bnf)
raise Exception
- elif parser == "auto" or parser == "default":
- #TODO Guess best parser
- from .Parser.Weighted import WeightedParser
- self.__parser = WeightedParser(bnf)
else:
LOG.error("Wrong parser name: " + parser)
raise Exception | default parser is recursivedescent | nesaro_pydsl | train | py |
fab9a3c818f2797267c6b8920feb49c1b9881968 | diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index <HASH>..<HASH> 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -17,6 +17,7 @@ Dir[File.join(File.dirname(__FILE__), "support/shared_examples/**/*.rb")].each d
end
RSpec.configure do |config|
+ config.color = true
config.order = "random"
config.disable_monkey_patching!
config.filter_run_when_matching :focus | Updated RSpec spec helper to enable color output.
- This used to be a global setting that is now configured at the
project level.
- Provides improved transparency for the project. | bkuhlmann_navigator | train | rb |
909344415ef1f31615a725b1430bdbc0e7942975 | diff --git a/spec/api-browser-window-spec.js b/spec/api-browser-window-spec.js
index <HASH>..<HASH> 100644
--- a/spec/api-browser-window-spec.js
+++ b/spec/api-browser-window-spec.js
@@ -1973,12 +1973,12 @@ describe('BrowserWindow module', function () {
it('should keep window hidden if already in hidden state', function (done) {
w.webContents.once('did-finish-load', function () {
- w.setFullScreen(false)
- setTimeout(() => {
+ w.once('leave-full-screen', () => {
assert.equal(w.isVisible(), false)
assert.equal(w.isFullScreen(), false)
done()
- }, 1000)
+ })
+ w.setFullScreen(false)
})
w.loadURL('about:blank')
}) | :art: Use leave-full-screen event instead of setTimeout() | electron_electron | train | js |
2ee4be7a7002d3228cd7fdb32a58c2b6ca021482 | diff --git a/lib/qunited/qunit_test_result.rb b/lib/qunited/qunit_test_result.rb
index <HASH>..<HASH> 100644
--- a/lib/qunited/qunit_test_result.rb
+++ b/lib/qunited/qunit_test_result.rb
@@ -74,14 +74,21 @@ module QUnited
def self.clean_up_result(test_result)
test_result = symbolize_keys(test_result)
test_result[:start] = DateTime.parse(test_result[:start])
- test_result[:assertion_data].map! { |data| symbolize_keys data }
test_result
end
- def self.symbolize_keys(hash)
- new_hash = {}
- hash.keys.each { |key| new_hash[key.to_sym] = hash[key] }
- new_hash
+ def self.symbolize_keys(obj)
+ case obj
+ when Hash
+ obj.inject({}) do |new_hash, (key, value)|
+ new_hash[key.to_sym] = symbolize_keys(value)
+ new_hash
+ end
+ when Array
+ obj.map { |x| symbolize_keys(x) }
+ else
+ obj
+ end
end
end
end | Refactor QUnitTestResult.symbolize_keys to change keys in nested hashes & arrays | aaronroyer_qunited | train | rb |
0e0398d43095681201b976801f28c1d4815d19b6 | diff --git a/assess_constraints.py b/assess_constraints.py
index <HASH>..<HASH> 100755
--- a/assess_constraints.py
+++ b/assess_constraints.py
@@ -155,8 +155,7 @@ def assess_instance_type_constraints(client):
"""Assess deployment with instance-type constraints."""
provider = client.env.config.get('type')
if provider not in INSTANCE_TYPES:
- raise ValueError('Provider does not implement instance-type '
- 'constraint.')
+ return
for instance_type in INSTANCE_TYPES[provider]:
assess_instance_type(client, provider, instance_type)
diff --git a/tests/test_assess_constraints.py b/tests/test_assess_constraints.py
index <HASH>..<HASH> 100644
--- a/tests/test_assess_constraints.py
+++ b/tests/test_assess_constraints.py
@@ -124,8 +124,9 @@ class TestAssess(TestCase):
def test_instance_type_constraints_missing(self):
fake_client = Mock(wraps=fake_juju_client())
- with self.assertRaises(ValueError):
+ with self.prepare_deploy_mock() as (fake_client, deploy_mock):
assess_instance_type_constraints(fake_client)
+ self.assertFalse(deploy_mock.called)
class TestDeploy(TestCase): | Made testing a provider with no instance-types a no-op for assess_instance_type_constraints rather than an error. | juju_juju | train | py,py |
dfd6c8d51d4af5ebd65f0cc71fb09ae395791f92 | diff --git a/cmd/main.js b/cmd/main.js
index <HASH>..<HASH> 100755
--- a/cmd/main.js
+++ b/cmd/main.js
@@ -17,14 +17,15 @@ var req = require('lazreq')({
Installer: '../lib/installer.js',
inquirer: 'inquirer',
path: 'path',
- pipelines: '../lib/pipelines.js'
+ pipelines: '../lib/pipelines.js',
+ userHome: 'user-home'
});
var Workspace = require("../lib/workspace");
var rc = Workspace.getDappleRC();
if (cli.config || typeof(rc.path) === 'undefined') {
- var homeRC = req.path.join(userHome, '.dapplerc');
+ var homeRC = req.path.join(req.userHome, '.dapplerc');
var confirmed;
var chosen = false;
@@ -47,7 +48,7 @@ if (cli.config || typeof(rc.path) === 'undefined') {
} else {
console.log("No configuration found! Generating...");
- Workspace.writeDappleRC(homeRC, DappleRCPrompter.prompt());
+ Workspace.writeDappleRC(homeRC, req.DappleRCPrompter.prompt());
}
rc = Workspace.getDappleRC();
} | Fix errors introduced during the lazy-loading rewrite. | dapphub_dapple | train | js |
e1d599d5db7d649a13dfe62f8829574315c919ce | diff --git a/src/models/BusinessHourGenerator.js b/src/models/BusinessHourGenerator.js
index <HASH>..<HASH> 100644
--- a/src/models/BusinessHourGenerator.js
+++ b/src/models/BusinessHourGenerator.js
@@ -8,7 +8,7 @@ var BUSINESS_HOUR_EVENT_DEFAULTS = {
};
-var BusinessHourGenerator = Class.extend({
+var BusinessHourGenerator = FC.BusinessHourGenerator = Class.extend({
rawComplexDef: null,
calendar: null, // for anonymous EventSource | make BusinessHourGenerator public | fullcalendar_fullcalendar | train | js |
36a537c61a15710c290e225932de22f9ffad0e10 | diff --git a/Classes/Application/FLOW3Distribution.php b/Classes/Application/FLOW3Distribution.php
index <HASH>..<HASH> 100644
--- a/Classes/Application/FLOW3Distribution.php
+++ b/Classes/Application/FLOW3Distribution.php
@@ -123,7 +123,7 @@ class FLOW3Distribution extends \TYPO3\Deploy\Domain\Model\Application {
'Data/*',
'Web/_Resources/*',
'Build/Reports',
- 'Cache/',
+ './Cache',
'Configuration/PackageStates.php'
); | [+BUGFIX] Fix inclusion of empty Cache/ directory | TYPO3_Surf | train | php |
fc85c9acec679db123e2a4a1c5a45e678593c7a3 | diff --git a/tests/QueryBuilderTest.php b/tests/QueryBuilderTest.php
index <HASH>..<HASH> 100644
--- a/tests/QueryBuilderTest.php
+++ b/tests/QueryBuilderTest.php
@@ -361,12 +361,12 @@ class QueryBuilderTest extends \PHPUnit_Extensions_Database_TestCase
$this->queryBuilder->select(['value']);
- $this->assertEquals(array(
- array('value' => 'foo'),
- array('value' => 'bar'),
- array('value' => 'baz'),
- array('value' => 'xyz'),
- ), $this->queryBuilder->get_arrays());
+ $values = array();
+ foreach($testtable as $v){
+ $values[] = array('value' => $v['value']);
+ }
+
+ $this->assertEquals($values, $this->queryBuilder->get_arrays());
$this->queryBuilder->select(['id']); | FIX: unittest for uid as primary key & order values | pragma-framework_core | train | php |
60f8e73fb7295d746265abce9a1f3d5ad8bd3db7 | diff --git a/src/Exscript/protocols/drivers/junos_erx.py b/src/Exscript/protocols/drivers/junos_erx.py
index <HASH>..<HASH> 100644
--- a/src/Exscript/protocols/drivers/junos_erx.py
+++ b/src/Exscript/protocols/drivers/junos_erx.py
@@ -37,7 +37,7 @@ class JunOSERXDriver(Driver):
def init_terminal(self, conn):
conn.execute('terminal length 0')
- conn.execute('terminal width 0')
+ conn.execute('terminal width 512')
def auto_authorize(self, conn, account, flush, bailout):
conn.send('enable 15\r') | exscript: Fixed bug: Set terminal width to highest value possible for ERX driver. | knipknap_exscript | train | py |
afac2b98b0b931084d554a62bf60c4a779c58316 | diff --git a/lib/api/utils.js b/lib/api/utils.js
index <HASH>..<HASH> 100644
--- a/lib/api/utils.js
+++ b/lib/api/utils.js
@@ -262,7 +262,8 @@ var load = exports.load = function(html, options) {
};
var html = exports.html = function(dom) {
- if (dom !== undefined) {
+ if (dom) {
+ dom = (type(dom) === 'string') ? this(dom) : dom;
return $.render(dom);
} else if (this._root && this._root.children) {
return $.render(this._root.children);
@@ -270,7 +271,6 @@ var html = exports.html = function(dom) {
return '';
}
};
-
// TODO: Add me to .html above
var tidy = exports.tidy = function(dom) {
if (dom !== undefined) { | $.html(selector) now works to select outer html | oyyd_cheerio-without-node-native | train | js |
dacd79a6b393d0d2338c3f29c2b904f626685efd | diff --git a/lib/Models/getAncestors.js b/lib/Models/getAncestors.js
index <HASH>..<HASH> 100644
--- a/lib/Models/getAncestors.js
+++ b/lib/Models/getAncestors.js
@@ -10,10 +10,13 @@ var defined = require('terriajs-cesium/Source/Core/defined');
* @return {CatalogMember[]} The members' ancestors in its parent tree, starting at the top, not including this member.
*/
function getAncestors(member) {
- if (defined(member.parent) && defined(member.parent.parent)) {
- return getAncestors(member.parent).concat([member.parent]);
+ var parent = member.parent;
+ var ancestors = [];
+ while (defined(parent) && defined(parent.parent)) {
+ ancestors = [parent].concat(ancestors);
+ parent = parent.parent;
}
- return [];
+ return ancestors;
}
module.exports = getAncestors; | replace recursive getAncestors with loop | TerriaJS_terriajs | train | js |
7881aa53bc48fa35c517d421358543334f4cb0a5 | diff --git a/src/spec/integration/links/export_release_spec.rb b/src/spec/integration/links/export_release_spec.rb
index <HASH>..<HASH> 100644
--- a/src/spec/integration/links/export_release_spec.rb
+++ b/src/spec/integration/links/export_release_spec.rb
@@ -101,7 +101,6 @@ describe 'exporting release with templates that have links', type: :integration
expect(out).to match(%r{Compiling packages: pkg_2\/[a-f0-9]+})
expect(out).to match(%r{Compiling packages: pkg_3_depends_on_2\/[a-f0-9]+})
expect(out).to match(%r{copying packages: pkg_1\/[a-f0-9]+})
- expect(out).to match(%r{copying packages: pkg_2\/[a-f0-9]+})
expect(out).to match(%r{copying packages: pkg_3_depends_on_2\/[a-f0-9]+})
expect(out).to match(%r{copying jobs: addon\/[a-f0-9]+})
expect(out).to match(%r{copying jobs: api_server\/[a-f0-9]+}) | Update integration tests to match new export-release behavior | cloudfoundry_bosh | train | rb |
e9ba5f81ae2333aab8b5911cab2832f858d823d5 | diff --git a/lib/table_setter/command.rb b/lib/table_setter/command.rb
index <HASH>..<HASH> 100644
--- a/lib/table_setter/command.rb
+++ b/lib/table_setter/command.rb
@@ -24,7 +24,7 @@ options:
def initialize
@prefix = ""
parse_options
- @prefix = "/#{@prefix}/".gsub(/^\/\//, "")
+ @prefix = "/#{@prefix}/".gsub(/^\/\//, "/")
command = ARGV.shift
@directory = ARGV.shift || '.'
TableSetter.configure @directory
@@ -73,8 +73,9 @@ options:
end
def build_rack
+ prefix = @prefix
Rack::Builder.app do
- map "/#{@prefix}" do
+ map prefix do
use Rack::CommonLogger, STDERR
use Rack::ShowExceptions
use Rack::Lint | prefix for rack works now as well | propublica_table-setter | train | rb |
4e3217379d64a01dcc561f51bd551fc49a0a511c | diff --git a/lib/devise-authy/controllers/helpers.rb b/lib/devise-authy/controllers/helpers.rb
index <HASH>..<HASH> 100644
--- a/lib/devise-authy/controllers/helpers.rb
+++ b/lib/devise-authy/controllers/helpers.rb
@@ -11,7 +11,8 @@ module DeviseAuthy
def remember_device
cookies.signed[:remember_device] = {
:value => Time.now.to_i,
- :secure => !(Rails.env.test? || Rails.env.development?)
+ :secure => !(Rails.env.test? || Rails.env.development?),
+ :expires => resource_class.authy_remember_device.from_now
}
end | add exires to cookie remember_device, otherwise, cookie is expired when the browser session ends | twilio_authy-devise | train | rb |
d9e95796b8c42df01e8650f5bde38180143a367e | diff --git a/src/commons/org/codehaus/groovy/grails/commons/spring/DefaultBeanConfiguration.java b/src/commons/org/codehaus/groovy/grails/commons/spring/DefaultBeanConfiguration.java
index <HASH>..<HASH> 100644
--- a/src/commons/org/codehaus/groovy/grails/commons/spring/DefaultBeanConfiguration.java
+++ b/src/commons/org/codehaus/groovy/grails/commons/spring/DefaultBeanConfiguration.java
@@ -202,18 +202,16 @@ public class DefaultBeanConfiguration extends GroovyObjectSupport implements Bea
else {
bd = new ChildBeanDefinition(parentName,clazz,cav, null);
}
- bd.setSingleton(singleton);
}
else {
if(parentName == null) {
- bd = new RootBeanDefinition(clazz,singleton);
+ bd = new RootBeanDefinition(clazz);
}
else {
bd = new ChildBeanDefinition(parentName,clazz, null,null);
- bd.setSingleton(singleton);
}
-
}
+ bd.setScope(singleton ? AbstractBeanDefinition.SCOPE_SINGLETON : AbstractBeanDefinition.SCOPE_PROTOTYPE);
wrapper = new BeanWrapperImpl(bd);
return bd;
} | Fix for some deprecation warnings which appeared after upgrade to Spring <I>.
git-svn-id: <URL> | grails_grails-core | train | java |
1354fba2ab544839ab107b8e57aa9efa0d734b3a | diff --git a/lib/bot.js b/lib/bot.js
index <HASH>..<HASH> 100644
--- a/lib/bot.js
+++ b/lib/bot.js
@@ -108,14 +108,22 @@ Bot.prototype = {
continueParams = { continue: '' };
let titles, pageids = params.pageids;
if ( params.titles ) {
- if ( params.titles.length === 0 ) { delete params.titles; }
- else { titles = params.titles; }
+ if ( params.titles.length === 0 ) {
+ delete params.titles;
+ }
+ else {
+ titles = params.titles;
+ }
}
if ( params.pageids ) {
- if ( params.pageids.length === 0 ) { delete params.pageids; }
+ if ( params.pageids.length === 0 ) {
+ delete params.pageids;
+ }
else {
pageids = params.pageids;
- if ( titles ) { delete params.pageids; }
+ if ( titles ) {
+ delete params.pageids;
+ }
}
} | Work on linting issues. | macbre_nodemw | train | js |
94ac6120e9a74fba141f6333de195ffcd8938a2a | diff --git a/lib/ohm.rb b/lib/ohm.rb
index <HASH>..<HASH> 100644
--- a/lib/ohm.rb
+++ b/lib/ohm.rb
@@ -105,9 +105,10 @@ module Ohm
self << model
end
- def sort(options = {})
+ def sort(_options = {})
return [] unless key.exists
+ options = _options.dup
options[:start] ||= 0
options[:limit] = [options[:start], options[:limit]] if options[:limit]
@@ -124,9 +125,10 @@ module Ohm
# user = User.all.sort_by(:name, :order => "ALPHA").first
# user.name == "A"
# # => true
- def sort_by(att, options = {})
+ def sort_by(att, _options = {})
return [] unless key.exists
+ options = _options.dup
options.merge!(:by => model.key["*->#{att}"])
if options[:get]
@@ -195,7 +197,8 @@ module Ohm
apply(:sdiffstore, key, source, target)
end
- def first(options = {})
+ def first(_options = {})
+ options = _options.dup
options.merge!(:limit => 1)
if options[:by] | Avoid overriding the passed options. | soveran_ohm | train | rb |
b6c2e4230096374ace225eedb8f5838e80c87d10 | diff --git a/test/dhis2_test.rb b/test/dhis2_test.rb
index <HASH>..<HASH> 100644
--- a/test/dhis2_test.rb
+++ b/test/dhis2_test.rb
@@ -14,8 +14,19 @@ class Dhis2Test < Minitest::Test
assert_equal 50, org_units.size
end
+ def test_get_org_units_all_fields
+ org_units = Dhis2.org_units(fields: [":all"], page_size: 1)
+ assert_equal 1, org_units.size
+ org_unit = org_units.first
+
+ refute_nil org_unit.level
+ refute_nil org_unit.shortName
+ refute_nil org_unit.shortName
+ refute_nil org_unit.lastUpdated
+ end
+
def test_get_data_elements
- data_elements = Dhis2.data_elements(fields: %w(id displayName code), page_size: 1 )
+ data_elements = Dhis2.data_elements(fields: %w(id displayName code), page_size: 1)
assert_equal 1, data_elements.size
data_element = data_elements.first
@@ -44,7 +55,6 @@ class Dhis2Test < Minitest::Test
refute_nil data_element.display_name
refute_nil data_element.id
refute_nil data_element.code
- refute_nil data_element.shortName
end
def test_get_org_units_pagination | Add a test requesting all fields | BLSQ_dhis2 | train | rb |
d807000c8a3e9bc743bd2b6dfae50a48349d21fc | diff --git a/lib/blazing/cli/create.rb b/lib/blazing/cli/create.rb
index <HASH>..<HASH> 100644
--- a/lib/blazing/cli/create.rb
+++ b/lib/blazing/cli/create.rb
@@ -7,7 +7,7 @@ module Blazing
include Thor::Actions
argument :repository
- argument :remote
+ argument :target
def self.source_root
File.dirname(__FILE__)
@@ -25,4 +25,4 @@ module Blazing
end
end
-end
\ No newline at end of file
+end | remote has been renamed to target | effkay_blazing | train | rb |
f93b2dc880c0c2c8065481d4b987014c062aaa0a | diff --git a/src/RoundingMode.php b/src/RoundingMode.php
index <HASH>..<HASH> 100644
--- a/src/RoundingMode.php
+++ b/src/RoundingMode.php
@@ -17,6 +17,8 @@ final class RoundingMode
{
/**
* Private constructor. This class is not instantiable.
+ *
+ * @codeCoverageIgnore
*/
private function __construct()
{ | Ignore code coverage on private constructor for non-instantiable class | brick_math | train | php |
00abf84b5ddc86138cf056065379d6bcdc806d91 | diff --git a/pushtx/broadcaster.go b/pushtx/broadcaster.go
index <HASH>..<HASH> 100644
--- a/pushtx/broadcaster.go
+++ b/pushtx/broadcaster.go
@@ -137,7 +137,7 @@ func (b *Broadcaster) broadcastHandler(sub *blockntfns.Subscription) {
// new goroutine to exectue a rebroadcast.
case <-rebroadcastSem:
default:
- log.Debugf("Existing rebroadcast still in " +
+ log.Tracef("Existing rebroadcast still in " +
"progress")
return
} | pushtx: demote existing rebroadcast log to trace
It would log on every block, which during initial sync would fill the
logs. | lightninglabs_neutrino | train | go |
6bfbdb67db0d87eded258ef9b8f2b8cef5b4be55 | diff --git a/molgenis-data/src/main/java/org/molgenis/data/util/UniqueId.java b/molgenis-data/src/main/java/org/molgenis/data/util/UniqueId.java
index <HASH>..<HASH> 100644
--- a/molgenis-data/src/main/java/org/molgenis/data/util/UniqueId.java
+++ b/molgenis-data/src/main/java/org/molgenis/data/util/UniqueId.java
@@ -22,8 +22,6 @@ public class UniqueId {
(byte) ((CLOCK_SEQ_AND_NODE >> 8) & 0xff),
(byte) ((CLOCK_SEQ_AND_NODE) & 0xff),
};
- private final ThreadLocal<ByteBuffer> tlbb =
- ThreadLocal.withInitial(() -> ByteBuffer.allocate(16));
private volatile int seq;
private volatile long lastTimestamp;
@@ -44,8 +42,7 @@ public class UniqueId {
seq = 0;
}
seq++;
- ByteBuffer bb = tlbb.get();
- bb.rewind();
+ ByteBuffer bb = ByteBuffer.allocate(16);
bb.putLong(time);
bb.put(NODE);
bb.putShort((short) seq); | Fix squid:S<I> ThreadLocal memory leak in UniqueId (#<I>) | molgenis_molgenis | train | java |
cafdf641bbb208fd3e9345d8ec21a108a97a2b37 | diff --git a/src/main/org/codehaus/groovy/reflection/CachedClass.java b/src/main/org/codehaus/groovy/reflection/CachedClass.java
index <HASH>..<HASH> 100644
--- a/src/main/org/codehaus/groovy/reflection/CachedClass.java
+++ b/src/main/org/codehaus/groovy/reflection/CachedClass.java
@@ -281,16 +281,14 @@ public class CachedClass {
}
public int getSuperClassDistance() {
- synchronized (getTheClass()) {
- if (distance == -1) {
- int distance = 0;
- for (Class klazz= getTheClass(); klazz != null; klazz = klazz.getSuperclass()) {
- distance++;
- }
- this.distance = distance;
- }
- return distance;
+ if (distance>=0) return distance;
+
+ int distance = 0;
+ for (Class klazz= getTheClass(); klazz != null; klazz = klazz.getSuperclass()) {
+ distance++;
}
+ this.distance = distance;
+ return distance;
}
public int hashCode() { | remove unneeded synchronization. It is a racy single-check, but ok in this case | apache_groovy | train | java |
05b0360b1480bd823796be596bea325b0be0f482 | diff --git a/test/test_peerassets.py b/test/test_peerassets.py
index <HASH>..<HASH> 100644
--- a/test/test_peerassets.py
+++ b/test/test_peerassets.py
@@ -24,7 +24,6 @@ def test_find_deck(prov):
'network': 'peercoin-testnet',
'number_of_decimals': 2,
'production': True,
- 'testnet': True,
'version': 1,
'tx_confirmations': 100
} | test_peerassets::deck does no handle testnet boolean anymore | PeerAssets_pypeerassets | train | py |
6ad7ba2f5f4c31c1f7a1432af2c004ab4508bf14 | diff --git a/vendor/k8s.io/kubernetes/plugin/pkg/scheduler/factory/factory.go b/vendor/k8s.io/kubernetes/plugin/pkg/scheduler/factory/factory.go
index <HASH>..<HASH> 100644
--- a/vendor/k8s.io/kubernetes/plugin/pkg/scheduler/factory/factory.go
+++ b/vendor/k8s.io/kubernetes/plugin/pkg/scheduler/factory/factory.go
@@ -635,7 +635,11 @@ func (factory *ConfigFactory) MakeDefaultErrorFunc(backoff *util.PodBackoff, pod
if err == core.ErrNoNodesAvailable {
glog.V(4).Infof("Unable to schedule %v %v: no nodes are registered to the cluster; waiting", pod.Namespace, pod.Name)
} else {
- glog.Errorf("Error scheduling %v %v: %v; retrying", pod.Namespace, pod.Name, err)
+ if _, ok := err.(*core.FitError); ok {
+ glog.V(4).Infof("Unable to schedule %v %v: no fit: %v; waiting", pod.Namespace, pod.Name, err)
+ } else {
+ glog.Errorf("Error scheduling %v %v: %v; retrying", pod.Namespace, pod.Name, err)
+ }
}
backoff.Gc()
// Retry asynchronously. | UPSTREAM: <I>: scheduler should not log an error when no fit | openshift_origin | train | go |
47778a96833e8f352d1450f35f192d5a98438a2f | diff --git a/index.js b/index.js
index <HASH>..<HASH> 100644
--- a/index.js
+++ b/index.js
@@ -123,6 +123,12 @@ function writeAndRunCodeBlocks(codeBlocks) {
}
});
});
+ })
+ .then(function(codeBlocks) {
+ return removeOldDir(dir)
+ .then(function() {;
+ return codeBlocks
+ });
});
} | fix: remove old directory from running markdown
This was forgotten in a previous change. | carlwoodward_run-markdown | train | js |
e4922efcfcd6f000411bfc4808f74b50b4847c8a | diff --git a/doctr/__main__.py b/doctr/__main__.py
index <HASH>..<HASH> 100644
--- a/doctr/__main__.py
+++ b/doctr/__main__.py
@@ -13,7 +13,7 @@ which you should insert into your .travis.yml.
Then, on Travis, for the build where you build your docs, add
- - doctr deploy . --built-docs path/to/built/html/
+ - ``doctr deploy . --built-docs path/to/built/html/``
to the end of the build to deploy the docs to GitHub pages. This will only
run on the master branch, and won't run on pull requests. | Render code in docs properly | drdoctr_doctr | train | py |
5c3958facf84f6fe95f3a6f3e2bf783a36d51920 | diff --git a/settings.js b/settings.js
index <HASH>..<HASH> 100644
--- a/settings.js
+++ b/settings.js
@@ -29,6 +29,8 @@
var fs = require('fs');
var path = require('path');
var extend = require('xtend');
+var chalk = require('chalk');
+
var utilities = require('./lib/utilities.js');
var settings = {
@@ -192,6 +194,11 @@ settings.transitionSparkProfiles = function() {
if (fs.existsSync(sparkDir) && !fs.existsSync(particleDir)) {
fs.mkdirSync(particleDir);
+ console.log();
+ console.log(chalk.yellow('!!!'), "I detected a Spark profile directory, and will now migrate your settings.");
+ console.log(chalk.yellow('!!!'), "This will only happen once, since you previously used our Spark-CLI tools.");
+ console.log();
+
var files = fs.readdirSync(sparkDir);
files.forEach(function (filename) {
var data = fs.readFileSync(path.join(sparkDir, filename)); | Add warning when migrating .spark to .particle | particle-iot_particle-cli | train | js |
6d2998467fada81e5024c1f8594ae167514cb290 | diff --git a/cwltool/docker.py b/cwltool/docker.py
index <HASH>..<HASH> 100644
--- a/cwltool/docker.py
+++ b/cwltool/docker.py
@@ -229,6 +229,8 @@ class DockerCommandLineJob(ContainerCommandLineJob):
if host_outdir_tgt:
# shortcut, just copy to the output directory
# which is already going to be mounted
+ if not os.path.exists(os.path.dirname(host_outdir_tgt)):
+ os.makedirs(os.path.dirname(host_outdir_tgt))
shutil.copy(volume.resolved, host_outdir_tgt)
else:
tmp_dir, tmp_prefix = os.path.split(tmpdir_prefix) | Ensure subdirectory exists for staging (#<I>) | common-workflow-language_cwltool | train | py |
b143dad596f4230d74dadd3c5060020bd50ef7f3 | diff --git a/core/chain_manager.go b/core/chain_manager.go
index <HASH>..<HASH> 100644
--- a/core/chain_manager.go
+++ b/core/chain_manager.go
@@ -168,7 +168,7 @@ func (bc *ChainManager) NewBlock(coinbase []byte) *types.Block {
var root []byte
parentHash := ZeroHash256
- if bc.CurrentBlock != nil {
+ if bc.currentBlock != nil {
root = bc.currentBlock.Header().Root
parentHash = bc.lastBlockHash
} | Reference pointer to block instead of pointer to function | ethereum_go-ethereum | train | go |
ae9ba3312e3602329a110324aa81bd99f147e879 | diff --git a/lavalink/PlayerManager.py b/lavalink/PlayerManager.py
index <HASH>..<HASH> 100644
--- a/lavalink/PlayerManager.py
+++ b/lavalink/PlayerManager.py
@@ -14,7 +14,6 @@ class BasePlayer(ABC):
async def handle_event(self, event):
raise NotImplementedError
- @abstractmethod
async def cleanup(self):
pass | Doesn't need to be abstract | Devoxin_Lavalink.py | train | py |
9bf1be3e5a2d1a2d60842ece5d8e9fb8f7d60d4d | diff --git a/citrination_client/views/tests/test_model_template_builder.py b/citrination_client/views/tests/test_model_template_builder.py
index <HASH>..<HASH> 100644
--- a/citrination_client/views/tests/test_model_template_builder.py
+++ b/citrination_client/views/tests/test_model_template_builder.py
@@ -96,7 +96,7 @@ def test_workflow():
def test():
- site = "https://stage.citrination.com"
+ site = "https://citrination.com"
search_template_client = SearchTemplateClient(os.environ["CITRINATION_API_KEY"], site)
data_views_client = DataViewsClient(os.environ["CITRINATION_API_KEY"], site) | Change site to public, tests will still fail until FE public updated | CitrineInformatics_python-citrination-client | train | py |
78db18bb567bd761c3810a6d833b7e3feca04a35 | diff --git a/spec/api_connect_client/product_spec.rb b/spec/api_connect_client/product_spec.rb
index <HASH>..<HASH> 100644
--- a/spec/api_connect_client/product_spec.rb
+++ b/spec/api_connect_client/product_spec.rb
@@ -1,6 +1,6 @@
require 'spec_helper'
-RSpec.describe Product do
+RSpec.describe ApiConnectClient::Product do
let(:product) { described_class.new }
describe '#all', vcr: { cassette_name: 'products' } do
diff --git a/spec/api_connect_client/user_spec.rb b/spec/api_connect_client/user_spec.rb
index <HASH>..<HASH> 100644
--- a/spec/api_connect_client/user_spec.rb
+++ b/spec/api_connect_client/user_spec.rb
@@ -1,7 +1,7 @@
require 'spec_helper'
-RSpec.describe User do
- let(:user) { User.new(ENV['ADMIN_USERNAME'], ENV['ADMIN_PASSWORD']) }
+RSpec.describe ApiConnectClient::User do
+ let(:user) { ApiConnectClient::User.new(ENV['ADMIN_USERNAME'], ENV['ADMIN_PASSWORD']) }
describe '#create', vcr: { cassette_name: 'user-new' } do
it "returns the info of the newly created user" do | fix(specs): Fix bug introduced in merge | cffiebigc_api-connect-client | train | rb,rb |
824dbf772c9de13c9d29252af8953f2dec0a126d | diff --git a/test/indexeddb_mock.js b/test/indexeddb_mock.js
index <HASH>..<HASH> 100644
--- a/test/indexeddb_mock.js
+++ b/test/indexeddb_mock.js
@@ -148,7 +148,11 @@ export class IDBObjectStore {
data,
request
};
- request.result = new IDBCursorWithValue(this, cursorInternal);
+ if (keys.length === 0) {
+ request.result = null;
+ } else {
+ request.result = new IDBCursorWithValue(this, cursorInternal);
+ }
return request;
}
}
@@ -216,6 +220,7 @@ export class IDBTransaction {
abort() {
}
+
objectStore(name) {
if (!this._flags.active) {
throw new DOMException('InvalidStateError'); | Return null for the cursor if we have no data | nponiros_sync_client | train | js |
a5f347a599e4c62aa374b6d09f42ac4caa734ccc | diff --git a/lib/zuul.js b/lib/zuul.js
index <HASH>..<HASH> 100644
--- a/lib/zuul.js
+++ b/lib/zuul.js
@@ -28,6 +28,8 @@ function Zuul(config) {
// list of browsers to test
self._browsers = [];
+
+ self._concurrency = config.concurrency || 3;
};
Zuul.prototype.__proto__ = EventEmitter.prototype;
@@ -92,8 +94,7 @@ Zuul.prototype.run = function(done) {
}
var batch = new Batch();
- // TODO(shtylman) option
- batch.concurrency(3);
+ batch.concurrency(self._concurrency);
var passed = true; | add concurrency option to specify how many browsers to run at once | airtap_airtap | train | js |
2a1df67b95d4da5dab8f9b8ad11af9482169499a | diff --git a/assemblerflow/generator/recipe.py b/assemblerflow/generator/recipe.py
index <HASH>..<HASH> 100644
--- a/assemblerflow/generator/recipe.py
+++ b/assemblerflow/generator/recipe.py
@@ -424,12 +424,20 @@ class Recipe:
if pipeline_string[-1] == "|":
pipeline_string = pipeline_string[:-1]
+ # Check if there are any forks. Replace depends on the number of forks
+ if isinstance(final_forks, str):
+ to_search = "{} "
+ to_replace = "{}={{'pid':'{}'}} "
+ else:
+ to_search = " {} "
+ to_replace = " {}={{'pid':'{}'}} "
+
# Replace only names by names + process ids
for key, val in self.process_to_id.items():
# Case only one process in the pipeline
pipeline_string = pipeline_string\
- .replace("{} ".format(key),
- "{}={{'pid':'{}'}} ".format(key, val))
+ .replace(to_search.format(key),
+ to_replace.format(key, val))
return pipeline_string | change replace in case there are no forks | assemblerflow_flowcraft | train | py |
3adfeaa8572fdde8e066da2c4e2239b0a3ea7388 | diff --git a/plugin/chaos/chaos.go b/plugin/chaos/chaos.go
index <HASH>..<HASH> 100644
--- a/plugin/chaos/chaos.go
+++ b/plugin/chaos/chaos.go
@@ -3,7 +3,9 @@ package chaos
import (
"context"
+ "math/rand"
"os"
+ "time"
"github.com/coredns/coredns/plugin"
"github.com/coredns/coredns/request"
@@ -34,8 +36,10 @@ func (c Chaos) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) (
default:
return plugin.NextOrFailure(c.Name(), c.Next, ctx, w, r)
case "authors.bind.":
- for _, a := range c.Authors {
- m.Answer = append(m.Answer, &dns.TXT{Hdr: hdr, Txt: []string{a}})
+ rnd := rand.New(rand.NewSource(time.Now().Unix()))
+
+ for _, i := range rnd.Perm(len(c.Authors)) {
+ m.Answer = append(m.Answer, &dns.TXT{Hdr: hdr, Txt: []string{c.Authors[i]}})
}
case "version.bind.", "version.server.":
m.Answer = []dns.RR{&dns.TXT{Hdr: hdr, Txt: []string{c.Version}}} | plugin/chaos: randomize author list (#<I>)
Randomize the author list on request; keep the zowners.go file stable so
a 'go generate' remain stable.
chaos.Owners could potentially be a map and be randomized by ranging
over it, but this seems simpler and fewer lines of code.
Bit of Easter hacking; seems more fair to randomize this list. | coredns_coredns | train | go |
c01d264ce447f3c6c01d2cf452639b8b7b80b9bd | diff --git a/fermipy/diffuse/gt_assemble_model.py b/fermipy/diffuse/gt_assemble_model.py
index <HASH>..<HASH> 100644
--- a/fermipy/diffuse/gt_assemble_model.py
+++ b/fermipy/diffuse/gt_assemble_model.py
@@ -209,7 +209,7 @@ class GtAssembleModel(Link):
manifest = yaml.safe_load(open(args.input))
compname = args.compname
- value = manifest[key]
+ value = manifest[compname]
GtAssembleModel.assemble_component(compname, value, args.hpx_order)
@@ -259,7 +259,7 @@ class ConfigMaker_AssembleModel(ConfigMaker):
irf_ver=NAME_FACTORY.irf_ver())
logfile = make_nfs_path(outfile.replace('.fits', '.log'))
job_configs[fullkey] = dict(input=manifest,
- comp=key,
+ compname=key,
logfile=logfile)
return job_configs | Fix to gt_assemble_model to set correct component name | fermiPy_fermipy | train | py |
e067e2e85228c151a13798a0bf6860e76034e4fa | diff --git a/test/test.js b/test/test.js
index <HASH>..<HASH> 100644
--- a/test/test.js
+++ b/test/test.js
@@ -404,7 +404,7 @@ exports['Multiple Sets'] = function(test) {
[47.5500, -52.6667, "St. John's"]
];
- places = proximity.addSet('places');
+ places = proximity.addSet();
people = proximity.addSet('people');
people.addLocations(peopleLocations, function(err, reply) { | Removing explicity set name. | arjunmehta_node-geo-proximity | train | js |
db53d8dc7a0e07dda2aef3d42a76fde790e874c9 | diff --git a/packages/cli/src/commands/start.js b/packages/cli/src/commands/start.js
index <HASH>..<HASH> 100644
--- a/packages/cli/src/commands/start.js
+++ b/packages/cli/src/commands/start.js
@@ -40,8 +40,9 @@ export const builder = yargs => {
description: 'A path pointing to an existing Aragon client installation',
default: null,
})
- .option('openInBrowser', {
+ .option('auto-open', {
description: 'Wether to automatically open the client in the browser',
+ boolean: true,
default: true,
})
}
@@ -51,7 +52,7 @@ export const task = async function({
clientVersion,
clientPort,
clientPath,
- openInBrowser,
+ autoOpen,
}) {
const tasks = new TaskList([
{
@@ -95,7 +96,7 @@ export const task = async function({
{
title: 'Opening client',
task: async (ctx, task) => {
- if (openInBrowser) {
+ if (autoOpen === true) {
task.output = 'Opening client'
await openClient(ctx, clientPort)
}
@@ -111,12 +112,14 @@ export const handler = async ({
clientVersion,
clientPort,
clientPath,
+ autoOpen,
}) => {
const tasks = await task({
clientRepo,
clientVersion,
clientPort,
clientPath,
+ autoOpen,
})
await tasks.run() | Fixes a bug where start command wouldnt open in browser (#<I>) | aragon_aragon-cli | train | js |
f76924d08c805cb9f10e1339f6d3ca40a4908e8f | diff --git a/py3status/modules/deadbeef.py b/py3status/modules/deadbeef.py
index <HASH>..<HASH> 100644
--- a/py3status/modules/deadbeef.py
+++ b/py3status/modules/deadbeef.py
@@ -20,7 +20,7 @@ Format placeholders:
{year} year in four digits
For more placeholders, see title formatting 2.0 in 'deadbeef --help'
- or http://github.com/Alexey-Yakovenko/deadbeef/wiki/Title-formatting-2.0
+ or https://github.com/DeaDBeeF-Player/deadbeef/wiki/Title-formatting-2.0
Not all of Foobar2000 remapped metadata fields will work with deadbeef and
a quick reminder about using {placeholders} here instead of %placeholder%. | deadbeef: replace http with secure https | ultrabug_py3status | train | py |
085b0737cc65c41baf9ff2b4fe34ce4c6fd9af98 | diff --git a/pyes/queryset.py b/pyes/queryset.py
index <HASH>..<HASH> 100644
--- a/pyes/queryset.py
+++ b/pyes/queryset.py
@@ -151,6 +151,8 @@ class QuerySet(object):
if self._facets:
for facet in self._facets:
query.facet.add(facet)
+ if self._start is not None:
+ query.start = self._start
if self._size is not None:
query.size = self._size
return query | Update pyes/queryset.py
Include "start" offset in search. | aparo_pyes | train | py |
603998ef5596564f81911c09e6a6422ab029cf4b | diff --git a/tests/Unit/ContainerTest.php b/tests/Unit/ContainerTest.php
index <HASH>..<HASH> 100644
--- a/tests/Unit/ContainerTest.php
+++ b/tests/Unit/ContainerTest.php
@@ -324,9 +324,7 @@ final class ContainerTest extends TestCase
'class' => VariadicConstructor::class,
'__construct()' => [
'first' => 1,
- 'parameters' => 42,
- 'second' => 43,
- 'third' => 44,
+ 'parameters' => [42, 43, 44],
],
],
'integerIndexed' => [ | Fix tests (#<I>) | yiisoft_di | train | php |
ad89f5935cd7360f9327442552c83b851ef38f62 | diff --git a/lib/worker.js b/lib/worker.js
index <HASH>..<HASH> 100644
--- a/lib/worker.js
+++ b/lib/worker.js
@@ -375,6 +375,8 @@ worker.prototype.track = function(callback){
worker.prototype.untrack = function(name, queues, callback){
var self = this;
+ var jobs = [];
+
if(self.connection && self.connection.redis){
self.connection.redis.srem(self.connection.key('workers'), (name + ':' + queues), function(error){
if(error){
@@ -383,12 +385,16 @@ worker.prototype.untrack = function(name, queues, callback){
return;
}
- self.connection.redis.del([
+ [
self.connection.key('worker', name, self.stringQueues()),
self.connection.key('worker', name, self.stringQueues(), 'started'),
self.connection.key('stat', 'failed', name),
self.connection.key('stat', 'processed', name)
- ], function(error){
+ ].forEach(function(key){
+ jobs.push(function(done){ self.connection.redis.del(key, done); });
+ });
+
+ async.series(jobs, function(error){
if(error){ self.emit('error', null, null, error); }
if(typeof callback === 'function'){ callback(error); }
}); | update worker untrack commands to work across cluster (no multi) | taskrabbit_node-resque | train | js |
103c5eeb67cab192d9f0b2f1975831b3d0ef4ddb | diff --git a/pandas/core/strings.py b/pandas/core/strings.py
index <HASH>..<HASH> 100644
--- a/pandas/core/strings.py
+++ b/pandas/core/strings.py
@@ -293,6 +293,8 @@ def str_contains(arr, pat, case=True, flags=0, na=np.nan, regex=True):
See Also
--------
match : analogous, but stricter, relying on re.match instead of re.search
+ Series.str.startswith : Test if the start of each string element matches a pattern.
+ Series.str.endswith : Same as startswith, but tests the end of string.
Examples
-------- | DOC: updated Series.str.contains see also section (#<I>) | pandas-dev_pandas | train | py |
8df596396c90834ffec9aaafaa4ebfd2b1bbb650 | diff --git a/internal/input/input_js.go b/internal/input/input_js.go
index <HASH>..<HASH> 100644
--- a/internal/input/input_js.go
+++ b/internal/input/input_js.go
@@ -249,8 +249,8 @@ func OnMouseMove(e js.Value) {
func OnWheel(e js.Value) {
// TODO: What if e.deltaMode is not DOM_DELTA_PIXEL?
- theInput.wheelX = e.Get("deltaX").Float()
- theInput.wheelY = e.Get("deltaY").Float()
+ theInput.wheelX = -e.Get("deltaX").Float()
+ theInput.wheelY = -e.Get("deltaY").Float()
}
func OnTouchStart(e js.Value) { | input: Bug fix: wheel direction is opposite on browsers | hajimehoshi_ebiten | train | go |
e1e4be9151d70f270ffc2d01fd971df27c9e1acc | diff --git a/lxd/storage/drivers/utils.go b/lxd/storage/drivers/utils.go
index <HASH>..<HASH> 100644
--- a/lxd/storage/drivers/utils.go
+++ b/lxd/storage/drivers/utils.go
@@ -690,6 +690,16 @@ func copyDevice(inputPath string, outputPath string) error {
return fmt.Errorf("Error copying file %q to %q: %w", inputPath, outputPath, err)
}
+ err = from.Close()
+ if err != nil {
+ return fmt.Errorf("Failed to close file %q: %w", inputPath, err)
+ }
+
+ err = to.Close()
+ if err != nil {
+ return fmt.Errorf("Failed to close file %q: %w", outputPath, err)
+ }
+
return nil
} | lxd/storage/drivers/utils: Catch file close errors in copyDevice | lxc_lxd | train | go |
35a7946499362de10c82660698a2af7a85c06135 | diff --git a/spec/unit/mixin/shell_out_spec.rb b/spec/unit/mixin/shell_out_spec.rb
index <HASH>..<HASH> 100644
--- a/spec/unit/mixin/shell_out_spec.rb
+++ b/spec/unit/mixin/shell_out_spec.rb
@@ -37,7 +37,7 @@ describe Ohai::Mixin::ShellOut, "shell_out" do
"LANG" => "en_US.UTF-8",
"LANGUAGE" => "en_US.UTF-8",
"LC_ALL" => "en_US.UTF-8",
- "PATH" => "/Users/lamont/.asdf/installs/ruby/2.7.0/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
+ "PATH" => "#{RbConfig::CONFIG["bindir"]}:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
},
}
end | remove hardcoded path from my machine | chef_ohai | train | rb |
38671b09dba81d88c7bd5c8989f59b0e2efafb25 | diff --git a/lib/hll.js b/lib/hll.js
index <HASH>..<HASH> 100644
--- a/lib/hll.js
+++ b/lib/hll.js
@@ -122,8 +122,11 @@ class HLLOperation extends Operation {
* overwritten. If the bin does not exist, the operation will be denied.
* @property {number} NO_FAIL - Do not raise error if operation is denied.
* @property {number} ALLOW_FOLD - Allow the resulting set to be the minimum of
- * provided index bits. Also, allow the usage of less precise HLL algorithms
- * when min hash bits of all participatings sets do not match.
+ * provided index bits. For {@link
+ * module:aerospike/hll.getIntersectCount|getIntersectCount} and {@link
+ * module:aerospike/hll.getSimilarity|getSimilarity}, allow the usage of less
+ * precise HLL algorithms when min hash bits of all participating sets do not
+ * match.
*
* @see {@link HLLPolicy}
*/ | Clarify docs for HLL ALLOW_FOLD policy (#<I>) | aerospike_aerospike-client-nodejs | train | js |
5a9a3890e816810bd3ad7f5b95bc2593378d45f2 | diff --git a/tests/test_filters.py b/tests/test_filters.py
index <HASH>..<HASH> 100644
--- a/tests/test_filters.py
+++ b/tests/test_filters.py
@@ -72,7 +72,7 @@ class HaystackFilterTestCase(TestCase):
def tearDown(self):
MockPersonIndex().clear()
- def test_filters_no_filters(self):
+ def test_filter_no_query_parameters(self):
request = factory.get(path="/", data="", content_type="application/json")
response = self.view1.as_view(actions={"get": "list"})(request)
self.assertEqual(response.status_code, status.HTTP_200_OK)
@@ -152,6 +152,12 @@ class HaystackFilterTestCase(TestCase):
self.view3.as_view(actions={"get": "list"}), request
)
+ def test_filter_unicode_characters(self):
+ request = factory.get(path="/", data={"firstname": "åsmund", "lastname": "sørensen"},
+ content_type="application/json")
+ response = self.view1.as_view(actions={"get": "list"})(request)
+ self.assertEqual(len(response.data), 1)
+
class HaystackAutocompleteFilterTestCase(TestCase): | added test for querying entries with unicode characters | inonit_drf-haystack | train | py |
0fc74cea1718e2c7a9d50eb4d4707d377e61d0b9 | diff --git a/src/client/js/Panels/MetaEditor/MetaEditorControl.DiagramDesignerWidgetEventHandlers.js b/src/client/js/Panels/MetaEditor/MetaEditorControl.DiagramDesignerWidgetEventHandlers.js
index <HASH>..<HASH> 100644
--- a/src/client/js/Panels/MetaEditor/MetaEditorControl.DiagramDesignerWidgetEventHandlers.js
+++ b/src/client/js/Panels/MetaEditor/MetaEditorControl.DiagramDesignerWidgetEventHandlers.js
@@ -195,8 +195,7 @@ define(['js/logger',
//return true if there is at least one item among the dragged ones that is not on the sheet yet
if (gmeIDList.length > 0 && gmeIDList.indexOf(CONSTANTS.PROJECT_ROOT_ID) === -1) {
for (i = 0; i < gmeIDList.length; i += 1) {
- if (this._metaAspectMembersPerSheet[this._selectedMetaAspectSet]
- .indexOf(gmeIDList[i]) === -1) {
+ if (this._metaAspectMembersPerSheet[this._selectedMetaAspectSet].indexOf(gmeIDList[i]) === -1) {
accept = true;
break;
} | #<I> cosmetic fix - allow long line as break makes it hard to read
Former-commit-id: <I>e<I>bea<I>adcd<I>cac<I>c<I>b5ef<I>f<I> | webgme_webgme-engine | train | js |
f39d8f132f5e9c66c7872f62ba615e5ede65e9c7 | diff --git a/docs/generate.py b/docs/generate.py
index <HASH>..<HASH> 100755
--- a/docs/generate.py
+++ b/docs/generate.py
@@ -199,14 +199,27 @@ def generate_index(folder, original_paths):
def get_description(arg):
"""Generates a proper description for the given argument"""
desc = []
+ otherwise = False
if arg.can_be_inferred:
- desc.append('If left to None, it will be inferred automatically.')
+ desc.append('If left unspecified, it will be inferred automatically.')
+ otherwise = True
+ elif arg.is_flag:
+ desc.append('This argument can be omitted.')
+ otherwise = True
+
if arg.is_vector:
- desc.append('A list must be supplied for this argument.')
- if arg.is_generic:
+ if arg.is_generic:
+ desc.append('A list of other Requests must be supplied.')
+ else:
+ desc.append('A list must be supplied.')
+ elif arg.is_generic:
desc.append('A different Request must be supplied for this argument.')
- if arg.is_flag:
- desc.append('This argument can be omitted.')
+ else:
+ otherwise = False # Always reset to false if no other text is added
+
+ if otherwise:
+ desc.insert(1, 'Otherwise,')
+ desc[-1] = desc[-1][:1].lower() + desc[-1][1:]
return ' '.join(desc) | Make generated description on the docs more friendly | LonamiWebs_Telethon | train | py |
2fbfb4000ab8734049ef90516d68e89eb54a79ec | diff --git a/lib/slack_logger/slack_io.rb b/lib/slack_logger/slack_io.rb
index <HASH>..<HASH> 100644
--- a/lib/slack_logger/slack_io.rb
+++ b/lib/slack_logger/slack_io.rb
@@ -8,7 +8,7 @@ module SlackLogger
def self.write(message)
client = SlackLogger.client
client.auth_test
- client.chat_postMessage({channel: SlackLogger.channel, text: message, as_user: true})
+ client.chat_postMessage({channel: SlackLogger.channel, text: message.to_s, as_user: true})
end
end | Adding in to_s for message write | josephverbeck_slack-logger | train | rb |
efb38ff15c1641e0f201d698e50cb4579256f397 | diff --git a/src/Middleware/RoleMiddleware.php b/src/Middleware/RoleMiddleware.php
index <HASH>..<HASH> 100644
--- a/src/Middleware/RoleMiddleware.php
+++ b/src/Middleware/RoleMiddleware.php
@@ -56,15 +56,23 @@ class RoleMiddleware
*/
public function handle(Request $request, Closure $next, $role)
{
- if (!$user = $this->authRepositoryInterface->getActiveUser()) {
+ if ($request->ajax()) {
+ return response('Unauthorized', 401);
+ }
+ if (!$user = $this->authRepositoryInterface->getActiveUser()) {
Flash::error('Access Denied');
return redirect()->route('auth.login');
}
- if (!($role = $this->roleRepositoryInterface->getBySlug($role)) || !$user->inRole($role)) {
+ if (!$role = $this->roleRepositoryInterface->getBySlug($role)) {
+ Flash::error('Access Denied');
+
+ return redirect()->route('auth.unauthorized');
+ }
+ if (!$user->inRole($role)) {
Flash::error('Access Denied');
return redirect()->route('auth.unauthorized'); | Reverted RoleMiddleware back to what it was before things started breaking. | laraflock_dashboard | train | php |
012556daeea9011c202dd07a8a226caad98664ac | diff --git a/src/Composer/Repository/VcsRepository.php b/src/Composer/Repository/VcsRepository.php
index <HASH>..<HASH> 100644
--- a/src/Composer/Repository/VcsRepository.php
+++ b/src/Composer/Repository/VcsRepository.php
@@ -66,7 +66,7 @@ class VcsRepository extends ArrayRepository implements ConfigurableRepositoryInt
private $versionCache;
/** @var string[] */
private $emptyReferences = array();
- /** @var array<'tags'|'branches', array<string, \Throwable>> */
+ /** @var array<'tags'|'branches', array<string, TransportException>> */
private $versionTransportExceptions = array();
/**
@@ -180,7 +180,7 @@ class VcsRepository extends ArrayRepository implements ConfigurableRepositoryInt
}
/**
- * @return array<'tags'|'branches', array<string, \Throwable>>
+ * @return array<'tags'|'branches', array<string, TransportException>>
*/
public function getVersionTransportExceptions()
{ | VcsRepository: limit type of versionTransportExceptions (#<I>) | composer_composer | train | php |
eebbaeae0a1ff05b53f37f3885a590d4b202d8a6 | diff --git a/salt/cloud/__init__.py b/salt/cloud/__init__.py
index <HASH>..<HASH> 100644
--- a/salt/cloud/__init__.py
+++ b/salt/cloud/__init__.py
@@ -1666,7 +1666,7 @@ def run_parallel_map_providers_query(data):
'''
try:
import Crypto.Random
- Crypto.Random.atfork()
+ Crypto.Random.atfork() # pylint: disable=E0611
except ImportError:
# PyCrypto version < 2.1
pass | Re-add the pylint disable comment | saltstack_salt | train | py |
98f8927650658de43076f0da7a9db0752cfda7e6 | diff --git a/doapi/cli/_util.py b/doapi/cli/_util.py
index <HASH>..<HASH> 100644
--- a/doapi/cli/_util.py
+++ b/doapi/cli/_util.py
@@ -153,7 +153,8 @@ class Cache(object):
self.cache_droplets()
elif key == "image":
self.cache_images()
- if name in self.caches[key]["name"]:
+ if name in self.caches[key]["name"] or \
+ (key == "image" and name in self.caches[key]["slug"]):
msg = 'There is already another %s named %r' % (key, name)
if fatal:
die(msg) | Warn/error when the user tries to name an image with the name of a slug | jwodder_doapi | train | py |
03f5efc4dc6ce01861f84be96ca48bc33e075174 | diff --git a/openquake/baselib/hdf5.py b/openquake/baselib/hdf5.py
index <HASH>..<HASH> 100644
--- a/openquake/baselib/hdf5.py
+++ b/openquake/baselib/hdf5.py
@@ -173,13 +173,17 @@ class PickleableSequence(collections.Sequence):
return repr(self._objects)
def __toh5__(self):
- dic = {
- '%06d' % i: numpy.array(pickle.dumps(obj, pickle.HIGHEST_PROTOCOL))
- for i, obj in enumerate(self._objects)}
- return dic, {}
+ dic = {}
+ nbytes = 0
+ for i, obj in enumerate(self._objects):
+ pik = pickle.dumps(obj, pickle.HIGHEST_PROTOCOL)
+ dic['%06d' % i] = numpy.array(pik)
+ nbytes += len(pik)
+ return dic, dict(nbytes=nbytes)
def __fromh5__(self, dic, attrs):
self._objects = tuple(pickle.loads(dic[k].value) for k in sorted(dic))
+ vars(self).update(attrs)
class File(h5py.File): | Stored the number of bytes used | gem_oq-engine | train | py |
Subsets and Splits