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 |
|---|---|---|---|---|---|
581295c98489fb5a436e5eae74eeb337dc70ca2c | diff --git a/tests/Integration/TestCase.php b/tests/Integration/TestCase.php
index <HASH>..<HASH> 100644
--- a/tests/Integration/TestCase.php
+++ b/tests/Integration/TestCase.php
@@ -9,6 +9,7 @@ use Spatie\Backup\BackupServiceProvider;
use Illuminate\Database\Schema\Blueprint;
use League\Flysystem\FileNotFoundException;
use Orchestra\Testbench\TestCase as Orchestra;
+use ZipArchive;
abstract class TestCase extends Orchestra
{
@@ -158,11 +159,12 @@ abstract class TestCase extends Orchestra
$this->assertFalse($this->fileExistsInZip($zipPath, $filename), "Failed to assert that {$zipPath} doesn't contain a file name {$filename}");
}
- protected function fileExistsInZip($zipPath, $filename)
+ protected function fileExistsInZip($zipPath, $filename): bool
{
- $zip = new \ZipArchive();
+ $zip = new ZipArchive();
+
if ($zip->open($zipPath) === true) {
- return $zip->locateName($filename, \ZipArchive::FL_NODIR) !== false;
+ return $zip->locateName($filename, ZipArchive::FL_NODIR) !== false;
}
return false; | Update fileExistsInZip | spatie_laravel-backup | train | php |
abc1d01d04109c1c2952256cc2b434857d891e5a | diff --git a/packages/@vuepress/core/lib/prepare/Page.js b/packages/@vuepress/core/lib/prepare/Page.js
index <HASH>..<HASH> 100644
--- a/packages/@vuepress/core/lib/prepare/Page.js
+++ b/packages/@vuepress/core/lib/prepare/Page.js
@@ -24,8 +24,8 @@ module.exports = class Page {
async process (markdown) {
this.key = 'v-' + Math.random().toString(16).slice(2)
- this.content = await fs.readFile(this._filePath, 'utf-8')
- const frontmatter = parseFrontmatter(this.content)
+ this._content = await fs.readFile(this._filePath, 'utf-8')
+ const frontmatter = parseFrontmatter(this._content)
// infer title
const title = inferTitle(frontmatter) | fix: regression - avoid deliver 'content' to client side | vuejs_vuepress | train | js |
3c9362eaf7c14868ac9fae6ebccd761c97bf83c2 | diff --git a/pyemma/coordinates/estimation/covariance.py b/pyemma/coordinates/estimation/covariance.py
index <HASH>..<HASH> 100644
--- a/pyemma/coordinates/estimation/covariance.py
+++ b/pyemma/coordinates/estimation/covariance.py
@@ -249,6 +249,11 @@ class LaggedCovariance(StreamingEstimator, ProgressReporter):
return self._rc.cov_XY(bessel=self.bessel)
@property
+ def cov_tau_tau(self):
+ self._check_estimated()
+ return self._rc.cov_YY(bessel=self.bessel)
+
+ @property
def nsave(self):
if self.c00:
return self._rc.storage_XX.nsave
@@ -264,3 +269,6 @@ class LaggedCovariance(StreamingEstimator, ProgressReporter):
if self.c0t:
if self._rc.storage_XY.nsave <= ns:
self._rc.storage_XY.nsave = ns
+ if self.ctt:
+ if self._rc.storage_YY.nsave <= ns:
+ self._rc.storage_YY.nsave = ns | [LaggedCovariance] added property cov_tau_tau
We can compute the instantaneous covariance on the lagged data by setting
ctt=True, but there was no property to access it. | markovmodel_PyEMMA | train | py |
ea0e271c8b38cac2a7440634bc9565dc6055b726 | diff --git a/miniutils/pragma/__init__.py b/miniutils/pragma/__init__.py
index <HASH>..<HASH> 100644
--- a/miniutils/pragma/__init__.py
+++ b/miniutils/pragma/__init__.py
@@ -2,3 +2,4 @@ from .collapse_literals import collapse_literals
from .core import *
from .deindex import deindex
from .unroll import unroll
+from .inline import inline | Removed annulment of inline from master | scnerd_miniutils | train | py |
36d0420f53adfa4c59b1a2dbbc734a392feda5f4 | diff --git a/openquake/baselib/parallel.py b/openquake/baselib/parallel.py
index <HASH>..<HASH> 100644
--- a/openquake/baselib/parallel.py
+++ b/openquake/baselib/parallel.py
@@ -847,8 +847,8 @@ class Starmap(object):
nbytes = sum(self.sent[self.task_func.__name__].values())
if nbytes > 1E6:
- logging.info('Sent %s in %d seconds', humansize(nbytes),
- time.time() - self.t0)
+ logging.info('Sent %d tasks, %s in %d seconds', len(self.tasks),
+ humansize(nbytes), time.time() - self.t0)
isocket = iter(self.socket)
self.todo = len(self.tasks) | Better logging [skip CI] | gem_oq-engine | train | py |
c2e31f36dafb15dd113784442fef43298a98264e | diff --git a/command/v7/push_command.go b/command/v7/push_command.go
index <HASH>..<HASH> 100644
--- a/command/v7/push_command.go
+++ b/command/v7/push_command.go
@@ -274,7 +274,7 @@ func (cmd PushCommand) processStreamsFromPrepareSpace(
eventClosed = true
break
}
- cmd.processEvent(event, "tktktktktktktk")
+ cmd.processEvent(event, cmd.RequiredArgs.AppName)
case warnings, ok := <-warningsStream:
if !ok {
if !warningsClosed { | fixup! Introduce the concept of PrepareSpace | cloudfoundry_cli | train | go |
4b4f07f4bf9d81ab1829ccdf6562dc95d75ab7d4 | diff --git a/tests/test_objectify.py b/tests/test_objectify.py
index <HASH>..<HASH> 100644
--- a/tests/test_objectify.py
+++ b/tests/test_objectify.py
@@ -5,7 +5,7 @@ import utils
class ObjectifyTestCase(unittest.TestCase):
def setUp(self):
- self.o = utils.Objectify()
+ self.o = utils.objectify()
def test_bool_empty(self):
self.assertFalse(self.o)
@@ -25,7 +25,7 @@ class ObjectifyTestCase(unittest.TestCase):
def test_dict(self):
d = {'hello': 'world', 'thanks': 'mom'}
- o = utils.Objectify(copy.deepcopy(d))
+ o = utils.objectify(copy.deepcopy(d))
self.assertEqual(len(o), len(d))
for key, value in d.items():
self.assertEqual(o[key], value) | Fix naming issue in objectify test case | silas_ops | train | py |
95c2dfa18e7618899f6d5bcf43cbc01461266841 | diff --git a/libraries/Maniaplanet/WebServices/HTTPClient.php b/libraries/Maniaplanet/WebServices/HTTPClient.php
index <HASH>..<HASH> 100644
--- a/libraries/Maniaplanet/WebServices/HTTPClient.php
+++ b/libraries/Maniaplanet/WebServices/HTTPClient.php
@@ -300,7 +300,7 @@ abstract class HTTPClient
$this->lastRequestExecTime = round($responseInfo['total_time'] * 1000);
if($this->slowRequestThreshold)
{
- if($this->lastRequestExecTime > $this->slowRequestThreshold)
+ if(class_exists('\ManiaLib\Utils\Logger') && $this->lastRequestExecTime > $this->slowRequestThreshold)
{
$message = sprintf('%s ms: %s %s', $this->lastRequestExecTime, $method, $url);
\ManiaLib\Utils\Logger::info($message); | Added missing class_exists() check for ManiaLib logger. | maniaplanet_maniaplanet-ws-sdk | train | php |
a4a7bee1f329a0b940f763237e6ed15d7b2d45aa | diff --git a/src/Api/ProvidersContainer.php b/src/Api/ProvidersContainer.php
index <HASH>..<HASH> 100644
--- a/src/Api/ProvidersContainer.php
+++ b/src/Api/ProvidersContainer.php
@@ -2,7 +2,6 @@
namespace seregazhuk\PinterestBot\Api;
-use seregazhuk\PinterestBot\Api\Providers\ContactRequests;
use seregazhuk\PinterestBot\Api\Providers\Pins;
use seregazhuk\PinterestBot\Api\Providers\User;
use seregazhuk\PinterestBot\Api\Providers\Auth; | Scrutinizer Auto-Fixes
This commit consists of patches automatically generated for this project on <URL> | seregazhuk_php-pinterest-bot | train | php |
99c0e602bc7ad752ecb7e22a393666da6cbd3f97 | diff --git a/src/Jobs/Skills/Character/Skills.php b/src/Jobs/Skills/Character/Skills.php
index <HASH>..<HASH> 100644
--- a/src/Jobs/Skills/Character/Skills.php
+++ b/src/Jobs/Skills/Character/Skills.php
@@ -93,5 +93,10 @@ class Skills extends EsiBase
'active_skill_level' => $character_skill->active_skill_level,
])->save();
});
+
+ // delete skills which have been removed
+ CharacterSkill::where('character_id', $this->getCharacterId())
+ ->whereNotIn('skill_id', collect($character_skills->skills)->pluck('skill_id')->flatten()->all())
+ ->delete();
}
} | add skill cleaner as CCP may remove some skills from the game (#<I>) | eveseat_eveapi | train | php |
683d4bcb156b5991df142fee8c9f49f9daf5763a | diff --git a/PWE/Lib/Smarty/SmartyWrapper.php b/PWE/Lib/Smarty/SmartyWrapper.php
index <HASH>..<HASH> 100644
--- a/PWE/Lib/Smarty/SmartyWrapper.php
+++ b/PWE/Lib/Smarty/SmartyWrapper.php
@@ -56,11 +56,15 @@ class SmartyWrapper extends Smarty implements Setupable
parent::registerObject($object_name, $object_impl, $object_impl->getSmartyAllowedMethods(), false);
}
- // FIXME: why here?
+ // FIXME: why here? remove it at all?
public static function setup(PWECore $pwe, array &$registerData)
{
- PWELogger::debug("Copying into %s/design", $pwe->getStaticDirectory());
- FilesystemHelper::fsys_copydir(__DIR__ . '/../../design', $pwe->getStaticDirectory() . '/design');
+ if (is_writable($pwe->getStaticDirectory())) {
+ PWELogger::debug("Copying into %s/design", $pwe->getStaticDirectory());
+ FilesystemHelper::fsys_copydir(__DIR__ . '/../../design', $pwe->getStaticDirectory() . '/design');
+ } else {
+ PWELogger::warn("Can't copy resources to %s, it's not writable");
+ }
}
} | Don't install design when have no perms | undera_pwe | train | php |
7a1fc1e1b1f8617b1f11d2cf0b3421d5e234ece7 | diff --git a/java/client/src/org/openqa/selenium/remote/http/Routable.java b/java/client/src/org/openqa/selenium/remote/http/Routable.java
index <HASH>..<HASH> 100644
--- a/java/client/src/org/openqa/selenium/remote/http/Routable.java
+++ b/java/client/src/org/openqa/selenium/remote/http/Routable.java
@@ -21,4 +21,7 @@ public interface Routable extends HttpHandler {
boolean matches(HttpRequest req);
+ default Routable with(Filter filter) {
+ return filter.andFinally(this);
+ }
} | Routables can also be filtered | SeleniumHQ_selenium | train | java |
a1bd45eaa90dde7e0ce087962bfc96058a2947ce | diff --git a/modeltranslation/fields.py b/modeltranslation/fields.py
index <HASH>..<HASH> 100644
--- a/modeltranslation/fields.py
+++ b/modeltranslation/fields.py
@@ -216,10 +216,12 @@ class TranslationFieldDescriptor(object):
loc_field_name = build_localized_fieldname(self.name,
get_language())
if hasattr(instance, loc_field_name):
- return getattr(instance, loc_field_name) or\
- (self.get_default_instance(instance) if\
- self.fallback_value is None else\
- self.fallback_value)
+ if getattr(instance, loc_field_name):
+ return getattr(instance, loc_field_name)
+ elif self.fallback_value is None:
+ return self.get_default_instance(instance)
+ else:
+ return self.fallback_value
def get_default_instance(self, instance):
""" | Fixed Python <I> incompatibility. Resolves issue <I>. | deschler_django-modeltranslation | train | py |
9c482f5ff25264ed82aa11d5551eadfe11592281 | diff --git a/autopep8.py b/autopep8.py
index <HASH>..<HASH> 100755
--- a/autopep8.py
+++ b/autopep8.py
@@ -940,7 +940,7 @@ class FixPEP8(object):
# Avoid applying this when indented.
# https://docs.python.org/reference/compound_stmts.html
for line in logical_lines:
- if ':' in line:
+ if ':' in line and STARTSWITH_DEF_REGEX.match(line):
return []
line_index = result['line'] - 1
diff --git a/test/test_autopep8.py b/test/test_autopep8.py
index <HASH>..<HASH> 100755
--- a/test/test_autopep8.py
+++ b/test/test_autopep8.py
@@ -3729,6 +3729,22 @@ raise IOError('abc '
with autopep8_context(line) as result:
self.assertEqual(fixed, result)
+ def test_e702_with_dict_semicolon(self):
+ line = """\
+MY_CONST = [
+ {'A': 1},
+ {'B': 2}
+];
+"""
+ fixed = """\
+MY_CONST = [
+ {'A': 1},
+ {'B': 2}
+]
+"""
+ with autopep8_context(line) as result:
+ self.assertEqual(fixed, result)
+
def test_e703_with_inline_comment(self):
line = 'a = 5; # inline comment\n'
fixed = 'a = 5 # inline comment\n' | for #<I> (easy solution...) | hhatto_autopep8 | train | py,py |
f26cfb322dca2aec8ef9b797a93958e102684a72 | diff --git a/src/java/com/threerings/media/image/ImageManager.java b/src/java/com/threerings/media/image/ImageManager.java
index <HASH>..<HASH> 100644
--- a/src/java/com/threerings/media/image/ImageManager.java
+++ b/src/java/com/threerings/media/image/ImageManager.java
@@ -1,5 +1,5 @@
//
-// $Id: ImageManager.java,v 1.36 2003/01/13 23:55:05 mdb Exp $
+// $Id: ImageManager.java,v 1.37 2003/01/14 04:05:56 mdb Exp $
package com.threerings.media.image;
@@ -121,6 +121,8 @@ public class ImageManager
*/
public BufferedImage createImage (int width, int height, int transparency)
{
+ // DEBUG: override transparency for the moment on all images
+ transparency = Transparency.TRANSLUCENT;
return _gc.createCompatibleImage(width, height, transparency);
} | Temporary hack to make all images translucent since that works around
strange slow rendering problems we see when we allow mixed BITMASK and
TRANSLUCENT images to be rendered.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@<I> <I>f4-<I>e9-<I>-aa3c-eee0fc<I>fb1 | threerings_narya | train | java |
052b1ae8d96107db8e785ba8a3e8c542b72e0d49 | diff --git a/src/Instrument/Transformer/FilterInjectorTransformer.php b/src/Instrument/Transformer/FilterInjectorTransformer.php
index <HASH>..<HASH> 100644
--- a/src/Instrument/Transformer/FilterInjectorTransformer.php
+++ b/src/Instrument/Transformer/FilterInjectorTransformer.php
@@ -86,9 +86,10 @@ class FilterInjectorTransformer implements SourceTransformer
$resource = (string) $originalResource;
if ($resource['0'] !== '/') {
+ $shouldCheckExistence = true;
$resource
- = PathResolver::realpath($resource, $checkExistence = true)
- ?: PathResolver::realpath("{$originalDir}/{$resource}", $checkExistence = true)
+ = PathResolver::realpath($resource, $shouldCheckExistence)
+ ?: PathResolver::realpath("{$originalDir}/{$resource}", $shouldCheckExistence)
?: $originalResource;
}
// If the cache is disabled, then use on-fly method | Fix a notice with unused variable | goaop_framework | train | php |
ebbc0047ce4271d26dae3d90a03b86a161bb4fb0 | diff --git a/terraform/terraform.go b/terraform/terraform.go
index <HASH>..<HASH> 100644
--- a/terraform/terraform.go
+++ b/terraform/terraform.go
@@ -111,6 +111,14 @@ func (t *Terraform) diffWalkFn(
return nil
}
+ switch n.Meta.(type) {
+ case *config.ProviderConfig:
+ // Ignore, we don't treat this any differently.
+ return nil
+ case *config.Resource:
+ // Continue
+ }
+
r := n.Meta.(*config.Resource)
p := t.mapping[r]
if p == nil { | terraform: ignore ProviderConfig during walks | hashicorp_terraform | train | go |
9ddc13eee5aa61a30987ea6c4fd2e716b90bad23 | diff --git a/src/Http/Request.php b/src/Http/Request.php
index <HASH>..<HASH> 100644
--- a/src/Http/Request.php
+++ b/src/Http/Request.php
@@ -117,10 +117,7 @@ class Request
$received = $this->getReceivedData('subscribe');
if ($received != null) {
-
- $post = $this->send($end_point);
-
- dd($post);
+ return $this->send($end_point);
}
} | Allows other script access Request::subscribeFacebook() method | gigaai_framework | train | php |
dd83e1d281e47a9918221bee48d8cd5babd63662 | diff --git a/usb1.py b/usb1.py
index <HASH>..<HASH> 100644
--- a/usb1.py
+++ b/usb1.py
@@ -821,6 +821,8 @@ class LibUSBContext(object):
"""
__libusb_exit = libusb1.libusb_exit
__context_p = None
+ __added_cb = None
+ __removed_cb = None
def __init__(self):
"""
@@ -843,6 +845,8 @@ class LibUSBContext(object):
if context_p is not None:
self.__libusb_exit(context_p)
self.__context_p = None
+ self.__added_cb = None
+ self.__removed_cb = None
def getDeviceList(self):
"""
@@ -926,6 +930,8 @@ class LibUSBContext(object):
removed_cb = POINTER(None)
else:
removed_cb = libusb1.libusb_pollfd_removed_cb_p(removed_cb)
+ self.__added_cb = added_cb
+ self.__removed_cb = removed_cb
libusb1.libusb_set_pollfd_notifiers(self.__context_p, added_cb,
removed_cb, user_data) | Keep references to added_cb and removed_cb callbacks.
Prevents them from being garbage-collected. | vpelletier_python-libusb1 | train | py |
2979943666920115c55cc088398bd5838ef32bf6 | diff --git a/chardet/cli/chardetect.py b/chardet/cli/chardetect.py
index <HASH>..<HASH> 100755
--- a/chardet/cli/chardetect.py
+++ b/chardet/cli/chardetect.py
@@ -39,6 +39,9 @@ def description_of(lines, name='stdin'):
u = UniversalDetector()
for line in lines:
u.feed(line)
+ # shortcut out of the loop to save reading further - particularly useful if we read a BOM.
+ if u.done:
+ break
u.close()
result = u.result
if PY2: | stop chardetect.py reading file immediately when filetype known (#<I>)
Even though the UniversalDetector would just return immediately, looping through a whole large file is still slow and unnecessary. | chardet_chardet | train | py |
47455eb885ffb54cf2cadb7968f8848b6cbadc2f | diff --git a/app/scripts/Inset.js b/app/scripts/Inset.js
index <HASH>..<HASH> 100644
--- a/app/scripts/Inset.js
+++ b/app/scripts/Inset.js
@@ -593,6 +593,7 @@ export default class Inset {
this.isHovering = true;
this.focus();
this.originFocus();
+ this.drawLeaderLine(this.options.selectColor);
this.mouseHandler.mouseOver(event, this);
}
@@ -605,6 +606,7 @@ export default class Inset {
this.isHovering = false;
this.blur();
this.originBlur();
+ this.drawLeaderLine();
this.mouseHandler.mouseOut(event, this);
}
@@ -839,11 +841,11 @@ export default class Inset {
colorSteps
))
);
- // Set the coration center to [0, half height]
+ // Set the rotation center to [0, half height]
gradient.pivot.set(0, this.options.leaderLineWidth / 2);
- gradient.x = pointFrom[0];
- gradient.y = pointFrom[1];
+ gradient.x = pointTo[0];
+ gradient.y = pointTo[1];
gradient.rotation = getAngleBetweenPoints(
[this.originX, this.originY],
[this.x, this.y] | Fix regression of leader line drawing and re-draw on hover for non-dynamic leader lines | higlass_higlass | train | js |
c423b966d72e79d19fe9439e5eaf1889736282cc | diff --git a/esda/getisord.py b/esda/getisord.py
index <HASH>..<HASH> 100644
--- a/esda/getisord.py
+++ b/esda/getisord.py
@@ -559,7 +559,7 @@ class G_Local(object):
def _infer_star_and_structure_w(weights, star, transform):
assert transform.lower() in ("r", "b"), (
f'Transforms must be binary "b" or row-standardized "r".'
- f"Recieved: {transform.upper()}"
+ f"Recieved: {transform}"
)
adj_matrix = weights.sparse
diagonal = adj_matrix.diagonal() | address @jgaboardi review | pysal_esda | train | py |
b17ce8e084a99873c6367c1be2343287c45aeda2 | diff --git a/neo/Network/NodeLeader.py b/neo/Network/NodeLeader.py
index <HASH>..<HASH> 100644
--- a/neo/Network/NodeLeader.py
+++ b/neo/Network/NodeLeader.py
@@ -130,8 +130,7 @@ class NodeLeader:
self.peer_check_loop.start(240, now=False)
if settings.ACCEPT_INCOMING_PEERS:
- endpoint = TCP4ServerEndpoint(reactor, settings.NODE_PORT)
- endpoint.listen(NeoClientFactory(incoming_client=True))
+ reactor.listenTCP(settings.NODE_PORT, NeoClientFactory(incoming_client=True))
def setBlockReqSizeAndMax(self, breqpart=0, breqmax=0):
if breqpart > 0 and breqmax > 0 and breqmax > breqpart: | fix simultaneous listening and connecting over the same port | CityOfZion_neo-python | train | py |
ce02b0912dc68cd4849a084d8bff26527943b6a7 | diff --git a/index.js b/index.js
index <HASH>..<HASH> 100644
--- a/index.js
+++ b/index.js
@@ -152,13 +152,11 @@ exports.request = function (options, callback) {
if (!options.encoding && options.encoding !== null) {
options.encoding = 'utf8';
}
- if (options.encoding) {
- encoding = options.encoding;
- if (encoding === 'ascii') {
- options['use-ascii'] = true;
- }
- delete options.encoding;
+ encoding = options.encoding;
+ if (encoding === 'ascii') {
+ options['use-ascii'] = true;
}
+ delete options.encoding;
//Parse POST data
if (options.data && typeof options.data === 'object') {
@@ -388,7 +386,7 @@ exports.copy = function (obj) {
var copy = {};
for (var i in obj) {
if (typeof obj[i] === 'object') {
- copy[i] = exports.copy(obj[i]);
+ copy[i] = copy[i] ? exports.copy(obj[i]) : null;
} else {
copy[i] = obj[i];
} | Fix encoding issues, re #<I> | node-js-libs_curlrequest | train | js |
731edb02f05802daa1164b1462d499bfcbed751c | diff --git a/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/rdbms/FullBackupJob.java b/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/rdbms/FullBackupJob.java
index <HASH>..<HASH> 100644
--- a/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/rdbms/FullBackupJob.java
+++ b/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/rdbms/FullBackupJob.java
@@ -187,7 +187,7 @@ public class FullBackupJob extends AbstractFullBackupJob
{
scripts =
new String[][]{{"JCR_MVALUE", "select * from JCR_MVALUE"}, {"JCR_MREF", "select * from JCR_MREF"},
- {"JCR_MITEM", "select * from JCR_MITEM"}};
+ {"JCR_MITEM", "select * from JCR_MITEM where JCR_MITEM.name <> '__root_parent'"}};
}
else
{ | EXOJCR-<I> : Rdbms FullBackupJob was changed (skip recored in JCR_MITEM with uuid '__root_parent'). | exoplatform_jcr | train | java |
3465b1b7531e5521fb501a393e8be80ccc89d979 | diff --git a/zipkin-ui/js/publicPath.js b/zipkin-ui/js/publicPath.js
index <HASH>..<HASH> 100644
--- a/zipkin-ui/js/publicPath.js
+++ b/zipkin-ui/js/publicPath.js
@@ -4,7 +4,11 @@ import $ from 'jquery';
// html-webpack-plugin limitations: https://github.com/jantimon/html-webpack-plugin/issues/119
// otherwise it could be: window.location.pathname.replace(/(.*)\/zipkin\/.*/, '$1/zipkin/')
let contextRoot = $('base').attr('href') || '/zipkin/';
-contextRoot += contextRoot.endsWith('/') ? '' : '/';
+
+// explicit to avoid having to do a polyfill for String.endsWith
+if (contextRoot.substr(contextRoot.length - 1) !== '/') {
+ contextRoot += '/';
+}
// set dynamically 'output.publicPath' as per https://webpack.github.io/docs/configuration.html#output-publicpath
__webpack_public_path__ = contextRoot; // eslint-disable-line camelcase, no-undef | Fixes IE which can't use String.endsWith (#<I>) | apache_incubator-zipkin | train | js |
49dfc7a40066fec9cf6b0b4da6740f42390ed704 | diff --git a/spec/warning_specs/line_length_spec.rb b/spec/warning_specs/line_length_spec.rb
index <HASH>..<HASH> 100644
--- a/spec/warning_specs/line_length_spec.rb
+++ b/spec/warning_specs/line_length_spec.rb
@@ -48,6 +48,12 @@ describe Wool::GenericLineLengthWarning do
output = " # my comment is\n # this and that\n # and another\n # thing"
@twenty_cap.new('(stdin)', input).fix.should == output
end
+
+ it 'uses the same number of hashes to denote the comment' do
+ input = " ## my comment is this and that and another thing"
+ output = " ## my comment is\n ## this and that\n ## and another\n ## thing"
+ @twenty_cap.new('(stdin)', input).fix.should == output
+ end
end
end | Added another test for the double-hash case for comment rewriting | michaeledgar_laser | train | rb |
236e62e72762ec15d0a05a9f6febf1feb607ad49 | diff --git a/datajoint/autopopulate.py b/datajoint/autopopulate.py
index <HASH>..<HASH> 100644
--- a/datajoint/autopopulate.py
+++ b/datajoint/autopopulate.py
@@ -169,7 +169,9 @@ class AutoPopulate:
if multiprocess is True:
nproc = mp.cpu_count()
else:
- assert type(multiprocess) == int
+
+ if not isinstance(multiprocess, int):
+ raise DataJointError("multiprocess can be False, True or a positive integer")
nproc = multiprocess
else:
nproc = 1 | Replace assertion with DataJointError | datajoint_datajoint-python | train | py |
23fcb8e9c48db39a989a56271a2e015e81bcdaf7 | diff --git a/tests/suites/http_status.js b/tests/suites/http_status.js
index <HASH>..<HASH> 100644
--- a/tests/suites/http_status.js
+++ b/tests/suites/http_status.js
@@ -27,7 +27,9 @@ casper.test.begin("HTTP status code handling", 163, {
this.testCodes.push(118);
}
- if (utils.ltVersion(phantom.version, '1.9.0') || isGecko) {
+ if (utils.ltVersion(phantom.version, '1.9.0')
+ || utils.gteVersion(phantom.version, '1.9.2')
+ || isGecko) {
// https://github.com/ariya/phantomjs/issues/11163
this.testCodes = this.testCodes.concat([
400, 401, 402, 403, 404, 405, 406, 407, 409, 410, 411, 412, 413, | Reactivate some tests about http status for PhantomJS <I>+ | casperjs_casperjs | train | js |
6b0812052fb2391c63f9dcc014b56ec6b90c7e4f | diff --git a/lib/Doctrine/DBAL/Connection.php b/lib/Doctrine/DBAL/Connection.php
index <HASH>..<HASH> 100644
--- a/lib/Doctrine/DBAL/Connection.php
+++ b/lib/Doctrine/DBAL/Connection.php
@@ -984,7 +984,7 @@ class Connection implements DriverConnection
* Gets the SchemaManager that can be used to inspect or change the
* database schema through the connection.
*
- * @return Doctrine\DBAL\Schema\SchemaManager
+ * @return Doctrine\DBAL\Schema\AbstractSchemaManager
*/
public function getSchemaManager()
{ | Fixed reference to non-existing class in docblock | doctrine_dbal | train | php |
f2e96806db199b23abdf62620490a9ee91c537ba | diff --git a/test/integration/version_upgrade_test.go b/test/integration/version_upgrade_test.go
index <HASH>..<HASH> 100644
--- a/test/integration/version_upgrade_test.go
+++ b/test/integration/version_upgrade_test.go
@@ -40,7 +40,7 @@ import (
// and it tries to upgrade from the older supported k8s to news supported k8s
func TestVersionUpgrade(t *testing.T) {
profile := UniqueProfileName("vupgrade")
- ctx, cancel := context.WithTimeout(context.Background(), 30*time.Minute)
+ ctx, cancel := context.WithTimeout(context.Background(), 45*time.Minute)
MaybeSlowParallel(t)
defer CleanupWithLogs(t, profile, cancel) | Wait longer for TestVersionUpgrade as old versions may need to retry | kubernetes_minikube | train | go |
5b2e17939b04008d9db9601453b4171df061b2c1 | diff --git a/packages/mdc-slider/addon/components/mdc-slider.js b/packages/mdc-slider/addon/components/mdc-slider.js
index <HASH>..<HASH> 100644
--- a/packages/mdc-slider/addon/components/mdc-slider.js
+++ b/packages/mdc-slider/addon/components/mdc-slider.js
@@ -69,11 +69,24 @@ export default Component.extend({
let {min, max, value, step, disabled} = this.getProperties (['min', 'max', 'value', 'step', 'disabled']);
- if (min !== this._slider.min) {
+ if (min > this._slider.max) {
+ // The new min value is greater than the current max value. We need to adjust
+ // the max value before setting the new min value. This will prevent the underlying
+ // component from throwing an exception.
+
+ this._slider.max = max;
this._slider.min = min;
}
+ else if (max < this._slider.min) {
+ // The new max value is less than the current min value. We need to adjust
+ // the min value before setting the new max value. This will prevent the underlying
+ // component from throwing an exception.
- if (max !== this._slider.max) {
+ this._slider.min = min;
+ this._slider.max = max;
+ }
+ else {
+ this._slider.min = min;
this._slider.max = max;
} | fix: Updating the slider failed if the min value was greater than the current max, or the max was less than the current min | onehilltech_ember-cli-mdc | train | js |
9293d3d801bf034acaed8f6e813139ad4853167c | diff --git a/lxd/storage_volumes_snapshot.go b/lxd/storage_volumes_snapshot.go
index <HASH>..<HASH> 100644
--- a/lxd/storage_volumes_snapshot.go
+++ b/lxd/storage_volumes_snapshot.go
@@ -1084,8 +1084,6 @@ func pruneExpireCustomVolumeSnapshotsTask(d *Daemon) (task.Func, task.Schedule)
logger.Info("Done pruning expired custom volume snapshots")
}
- f(context.Background())
-
first := true
schedule := func() (time.Duration, error) {
interval := time.Minute | lxd/storage_volumes_snapshots: Don't trigger expiry task on load | lxc_lxd | train | go |
e732c6876da37581ccf5efb458b4b6b82f9c0a36 | diff --git a/test/parserTest.js b/test/parserTest.js
index <HASH>..<HASH> 100644
--- a/test/parserTest.js
+++ b/test/parserTest.js
@@ -323,6 +323,31 @@ Unit.test("mongo-parse", function(t) {
pointerz[0].val = 1;
this.eq(theObject.a.b, 1);
});
+
+ this.test('removing an existing property', function() {
+ var theObject = {};
+ var pointerz = DotNotationPointers(theObject, "a.b");
+ this.eq(pointerz.length, 1);
+
+ pointerz[0].val = 1;
+ this.eq(theObject.a.b, 1);
+
+ pointerz[0].val = undefined;
+ this.eq(theObject.a.hasOwnProperty("b"), false);
+ });
+
+ this.test('removing a property that does not exist', function() {
+ var theObject = {};
+ var pointerz = DotNotationPointers(theObject, "a.b");
+ this.eq(pointerz.length, 1);
+
+ pointerz[0].val = 1;
+ this.eq(theObject.a.b, 1);
+
+ pointerz = DotNotationPointers(theObject, "a.c");
+ pointerz[0].val = undefined;
+ this.eq(theObject.a.hasOwnProperty("c"), false);
+ });
})
this.test('mapValues', function(t) { | add property removal test
the desired behaviour is to remove a property from the object if the new value is set to 'undefined' | fresheneesz_mongo-parse | train | js |
7606b8050d48664b2f5da28cffad125665d45552 | diff --git a/lib/appsignal/version.rb b/lib/appsignal/version.rb
index <HASH>..<HASH> 100644
--- a/lib/appsignal/version.rb
+++ b/lib/appsignal/version.rb
@@ -1,5 +1,5 @@
require 'yaml'
module Appsignal
- VERSION = '1.0.5.beta.4'
+ VERSION = '1.0.5'
end | Bump to <I> [ci skip] | appsignal_appsignal-ruby | train | rb |
908f1a4ef94f49c7ff0f3bce84d872aa13c66b8e | diff --git a/lib/word-to-markdown.rb b/lib/word-to-markdown.rb
index <HASH>..<HASH> 100644
--- a/lib/word-to-markdown.rb
+++ b/lib/word-to-markdown.rb
@@ -23,7 +23,7 @@ class WordToMarkdown
github_flavored: true
}
- SOFFICE_VERSION_REQUIREMENT = '~> 5.0'
+ SOFFICE_VERSION_REQUIREMENT = '> 4.0'
PATHS = [
"~/Applications/LibreOffice.app/Contents/MacOS", | lessen dependency back to > <I> | benbalter_word-to-markdown | train | rb |
45e578706ceb2ad75e2c68097956c7dbbcc89965 | diff --git a/tests/ContainerTest.php b/tests/ContainerTest.php
index <HASH>..<HASH> 100644
--- a/tests/ContainerTest.php
+++ b/tests/ContainerTest.php
@@ -13,6 +13,7 @@
namespace chillerlan\SettingsTest;
use PHPUnit\Framework\TestCase;
+use Exception, TypeError;
class ContainerTraitTest extends TestCase{
@@ -83,4 +84,14 @@ class ContainerTraitTest extends TestCase{
$this->assertSame($expected, (string)$container);
}
+ public function testFromJsonException(){
+ $this->expectException(Exception::class);
+ (new TestContainer)->fromJSON('-');
+
+ }
+ public function testFromJsonTypeError(){
+ $this->expectException(TypeError::class);
+ (new TestContainer)->fromJSON('2');
+ }
+
} | :octocat: coverage | chillerlan_php-settings-container | train | php |
f9f45ec57bf9063532ca41c896caebe35b78ea5a | diff --git a/src/index.js b/src/index.js
index <HASH>..<HASH> 100644
--- a/src/index.js
+++ b/src/index.js
@@ -202,7 +202,8 @@ export const sessionStoreBuilder = () => ({
if (params.cookieDomain) throw new Error('baseUrl param is deprecated, replaced with directoryUrl')
if (params.sessionDomain) throw new Error('baseUrl param is deprecated, replaced with directoryUrl')
if (!params.directoryUrl && params.directoryUrl !== '') throw new Error('directoryUrl param is required')
- commit('setAny', params)
+ const directoryUrl = params.directoryUrl.endsWith('/') ? params.directoryUrl.slice(0, -1) : params.directoryUrl
+ commit('setAny', { ...params, directoryUrl })
dispatch('readCookie')
},
readCookie({ state, commit }) { | fix: manage trailing slash in directoryUrl | koumoul-dev_sd-vue | train | js |
8def10e962e1d504f3dc8f0b83821141927ec529 | diff --git a/pulsar/apps/tasks/rpc.py b/pulsar/apps/tasks/rpc.py
index <HASH>..<HASH> 100755
--- a/pulsar/apps/tasks/rpc.py
+++ b/pulsar/apps/tasks/rpc.py
@@ -99,14 +99,17 @@ By default it returns an empty dictionary.'''
def task_callback(self, request, jobname, ack = True, **kwargs):
'''Internal function which uses the :attr:`task_queue_manager`
to create an :class:`pulsar.ActorLinkCallback` for running a task
-from *jobname* in the :class:`TaskQueue`.'''
+from *jobname* in the :class:`TaskQueue`.
+The function returned by this method can be called with exactly
+the same ``args`` and ``kwargs`` as the callable method of the :class:`Job`
+(excluding the ``consumer``).'''
funcname = 'addtask' if ack else 'addtask_noack'
request_params = self.task_request_parameters(request)
return self.task_queue_manager.get_callback(
request.environ,
funcname,
- jobname = jobname,
- task_extra = request_params,
+ jobname,
+ request_params,
**kwargs)
def task_run(self, request, jobname, ack = True, **kwargs): | task_callback properly invoke the task queue manager so that tasks can be called exatly in the same way as the Job callable | quantmind_pulsar | train | py |
4a063d765d4858d6e4b7ed5d8f02988a5530c4af | diff --git a/hearthstone/cardxml.py b/hearthstone/cardxml.py
index <HASH>..<HASH> 100644
--- a/hearthstone/cardxml.py
+++ b/hearthstone/cardxml.py
@@ -124,7 +124,12 @@ class CardXML(object):
master_power.text = self.master_power
for tag, value in self.tags.items():
- e = ElementTree.SubElement(ret, "Tag", enumID=str(int(tag)), name=tag.name)
+ e = ElementTree.SubElement(ret, "Tag", enumID=str(int(tag)))
+ if not isinstance(tag, GameTag):
+ tag = GameTag(tag)
+
+ e.attrib["name"] = tag.name
+
if tag.type == Type.LOCSTRING:
e.attrib["type"] = "LocString"
for locale, localized_value in sorted(value.items()): | cardxml: Always cast tags to int on write | HearthSim_python-hearthstone | train | py |
f1e5d821be65f862c11a2216b4dcd0b79c65d091 | diff --git a/planet/cli/cli.py b/planet/cli/cli.py
index <HASH>..<HASH> 100644
--- a/planet/cli/cli.py
+++ b/planet/cli/cli.py
@@ -27,20 +27,17 @@ LOGGER = logging.getLogger(__name__)
@click.group()
@click.pass_context
-@click.option('--verbosity',
- default="warning",
- help=("Optional: set verbosity level to warning, info, or debug.\
- Defaults to warning."))
@click.option('--quiet',
is_flag=True,
default=False,
help='Disable ANSI control output.')
@click.version_option(version=planet.__version__)
+@click.option('--verbosity',
+ default="warning",
+ help=("Optional: set verbosity level to warning, info, or debug.\
+ Defaults to warning."))
def main(ctx, verbosity, quiet):
- """Planet API Client
- Parameters:
- ctx -- context object
- verbosity -- user input for verbosity."""
+ """Planet API Client"""
_configure_logging(verbosity)
# ensure that ctx.obj exists and is a dict (in case `cli()` is called | Moved verbosity down in visible options. | planetlabs_planet-client-python | train | py |
404c797e1445d7d840c1941ca54911f4143aeffe | diff --git a/mama_cas/mixins.py b/mama_cas/mixins.py
index <HASH>..<HASH> 100644
--- a/mama_cas/mixins.py
+++ b/mama_cas/mixins.py
@@ -151,9 +151,9 @@ class CustomAttributesMixin(object):
"""
def get_custom_attributes(self, ticket):
"""
- Build a list of user attributes from the ``User`` object, the
- user profile object or a custom callback callable. Attributes
- are specified with one or more settings:
+ Build a dictionary of user attributes from the ``User``
+ object, the user profile object or custom callbacks using one
+ or more of these settings:
``MAMA_CAS_USER_ATTRIBUTES``
A dict of name and ``User`` attribute values. The name can
@@ -166,9 +166,9 @@ class CustomAttributesMixin(object):
correspond with an attribute on the user profile object.
``MAMA_CAS_ATTRIBUTE_CALLBACKS``
- A string representation of a custom callable that returns
- a dict containing attributes. The callable is provided a
- single argument of the ``User``.
+ A tuple of dotted paths to callables that return a dict of
+ name and attribute values. Each callable is provided a
+ single argument of the authenticated ``User``.
All attributes are returned as a single dictionary.
""" | Update docstring to match settings changes | jbittel_django-mama-cas | train | py |
384d27eaf0a5e3f0ea747115bccc26253e9667a2 | diff --git a/library/Imbo/Database/Doctrine.php b/library/Imbo/Database/Doctrine.php
index <HASH>..<HASH> 100644
--- a/library/Imbo/Database/Doctrine.php
+++ b/library/Imbo/Database/Doctrine.php
@@ -311,6 +311,24 @@ class Doctrine implements DatabaseInterface {
$qb->setFirstResult($offset);
}
+ if ($metadataQuery = $query->metadataQuery()) {
+ $qb->leftJoin('i', 'metadata', 'm', 'i.id = m.imageId');
+ $tag = $qb->expr()->andx();
+ $tmp = 0;
+
+ foreach ($metadataQuery as $key => $value) {
+ $qb->andWhere($qb->expr()->andx(
+ $qb->expr()->eq('m.tagName', ':tagName' . $tmp),
+ $qb->expr()->eq('m.tagValue', ':tagValue' . $tmp)
+ ));
+ $qb->setParameters(array(
+ ':tagName' . $tmp => $key,
+ ':tagValue' . $tmp => $value,
+ ));
+ $tmp++;
+ }
+ }
+
$stmt = $qb->execute();
$rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
$returnMetadata = $query->returnMetadata(); | Use the metadata query found in the URL | imbo_imbo | train | php |
2696c415ec9aad4bbe4ef74c1c4d15e16db68e01 | diff --git a/spyder/plugins/tests/test_ipythonconsole.py b/spyder/plugins/tests/test_ipythonconsole.py
index <HASH>..<HASH> 100644
--- a/spyder/plugins/tests/test_ipythonconsole.py
+++ b/spyder/plugins/tests/test_ipythonconsole.py
@@ -21,7 +21,6 @@ from textwrap import dedent
# Third party imports
import cloudpickle
from flaky import flaky
-import ipykernel
from pygments.token import Name
import pytest
from qtpy import PYQT5
@@ -113,8 +112,6 @@ def ipyconsole(qtbot, request):
@flaky(max_runs=3)
@pytest.mark.auto_backend
@pytest.mark.skipif(os.name == 'nt', reason="It times out sometimes on Windows")
-@pytest.mark.xfail(zmq.__version__ >= '17.0.0' and ipykernel.__version__ <= "4.8.1",
- reason="A bug with pyzmq 17 and ipykernel 4.8.1")
def test_auto_backend(ipyconsole, qtbot):
"""Test that the automatic backend is working correctly."""
# Wait until the window is fully up | Testing: Remove xfail on ipykernel because it's not needed anymore | spyder-ide_spyder | train | py |
f2040dbf56ed5a1a8c760cbc957b972ad674cec8 | diff --git a/alerta/settings.py b/alerta/settings.py
index <HASH>..<HASH> 100644
--- a/alerta/settings.py
+++ b/alerta/settings.py
@@ -3,6 +3,8 @@
#
# To override these settings use /etc/alertad.conf or the contents of the
# configuration file set by the environment variable ALERTA_SVR_CONF_FILE.
+#
+# Further information on settings can be found at http://docs.alerta.io
DEBUG = False | Point to the Alerta docs site for more info
Fixes #<I> | alerta_alerta | train | py |
fc10a50ca301b4c56c237ae4708bb6e885b51799 | diff --git a/flight/Flight.php b/flight/Flight.php
index <HASH>..<HASH> 100644
--- a/flight/Flight.php
+++ b/flight/Flight.php
@@ -365,6 +365,11 @@ class Flight {
* @param string $url URL
*/
public static function _redirect($url, $code = 303) {
+ $base = self::request()->base;
+ if ($base != '/' && strpos($url, '://') === false) {
+ $url = $base.(($url[0] == '/') ? '' : '/').$url;
+ }
+
self::response(false)
->status($code)
->header('Location', $url) | Fixed redirect problem when running in a subfolder | mikecao_flight | train | php |
079d75effc7dc8c7c0cd473dbcd9e35f74efd4d0 | diff --git a/sane_redirects/middleware.py b/sane_redirects/middleware.py
index <HASH>..<HASH> 100644
--- a/sane_redirects/middleware.py
+++ b/sane_redirects/middleware.py
@@ -2,7 +2,10 @@ from __future__ import absolute_import, unicode_literals
from django.conf import settings
from django.http import HttpResponseRedirect
-from django.utils.deprecation import MiddlewareMixin
+try:
+ from django.utils.deprecation import MiddlewareMixin
+except ImportError: # Django<1.9
+ MiddlewareMixin = object
from .models import Redirect | Reinstate compatibility with Django <I> | feinheit_django-sane-redirects | train | py |
95f572e938c0efe2c4fb68b2ffa5707f77e5e09e | diff --git a/input.go b/input.go
index <HASH>..<HASH> 100644
--- a/input.go
+++ b/input.go
@@ -558,6 +558,7 @@ func (w *Window) SetCursorEnterCallback(cbfun CursorEnterCallback) (previous Cur
} else {
C.glfwSetCursorEnterCallbackCB(w.data)
}
+ panicError()
return previous
} | Add missing panicError call. | go-gl_glfw | train | go |
ca73522b300eb888bc9a56df511bc510287a793b | diff --git a/Kwf/Component/View/Helper/ComponentWithMaster.php b/Kwf/Component/View/Helper/ComponentWithMaster.php
index <HASH>..<HASH> 100644
--- a/Kwf/Component/View/Helper/ComponentWithMaster.php
+++ b/Kwf/Component/View/Helper/ComponentWithMaster.php
@@ -23,9 +23,10 @@ class Kwf_Component_View_Helper_ComponentWithMaster extends Kwf_Component_View_H
$view->assign($vars);
return $view->render($this->_getRenderer()->getTemplate($component, 'Master'));
} else if ($last['type'] == 'component') {
- $plugins = self::_getGroupedViewPlugins($component->componentClass);
+ $helper = new Kwf_Component_View_Helper_Component();
+ $helper->setRenderer($this->_getRenderer());
return '<div class="kwfMainContent">' . "\n " .
- $this->_getRenderPlaceholder($component->componentId, array(), null, 'component', $plugins) . "\n" .
+ $helper->component($component) . "\n" .
'</div>' . "\n";
} else {
throw new Kwf_Exception("invalid type"); | simplify code: create component helper to render main component | koala-framework_koala-framework | train | php |
bf213f79afb73e7b3017dafe80be299fbda38b15 | diff --git a/src/samples/java/ex/MRC_Sample.java b/src/samples/java/ex/MRC_Sample.java
index <HASH>..<HASH> 100755
--- a/src/samples/java/ex/MRC_Sample.java
+++ b/src/samples/java/ex/MRC_Sample.java
@@ -1,4 +1,5 @@
package ex;
+
import java.awt.Component;
import java.util.Collection;
import java.util.Iterator;
@@ -6,6 +7,9 @@ import java.util.List;
@SuppressWarnings("all")
public class MRC_Sample {
+ private static String PART1 = "Part1";
+ private static String PART2 = "Part2";
+
private Component[] components;
private int getValue() {
@@ -124,4 +128,8 @@ public class MRC_Sample {
private int fpOverload(short s) {
return 2;
}
+
+ private String fpAppend() {
+ return PART1 + PART2;
+ }
} | add another fp for MRC | mebigfatguy_fb-contrib | train | java |
ce325029c0d3a99008e29e2dfeab75d7e610f678 | diff --git a/fastlane_core/lib/fastlane_core/ipa_file_analyser.rb b/fastlane_core/lib/fastlane_core/ipa_file_analyser.rb
index <HASH>..<HASH> 100644
--- a/fastlane_core/lib/fastlane_core/ipa_file_analyser.rb
+++ b/fastlane_core/lib/fastlane_core/ipa_file_analyser.rb
@@ -37,6 +37,7 @@ module FastlaneCore
def self.fetch_info_plist_file(path)
UI.user_error!("Could not find file at path '#{path}'") unless File.exist?(path)
+ Zip.validate_entry_sizes = true # https://github.com/rubyzip/rubyzip/releases/tag/v2.0.0
Zip::File.open(path, "rb") do |zipfile|
file = zipfile.glob('**/Payload/*.app/Info.plist').first
return nil unless file | Improve rubyzip security behavior to be able to continue using <I> (#<I>) | fastlane_fastlane | train | rb |
4e5e19c336640e2bc39cba0051160e7b469494d8 | diff --git a/bika/lims/content/instrument.py b/bika/lims/content/instrument.py
index <HASH>..<HASH> 100644
--- a/bika/lims/content/instrument.py
+++ b/bika/lims/content/instrument.py
@@ -50,7 +50,6 @@ schema = BikaSchema.copy() + Schema((
),
),
StringField('DataInterface',
- schemata = _("Export & import"),
vocabulary = "getDataInterfaces",
widget = ReferenceWidget(
checkbox_bound = 1,
@@ -59,7 +58,6 @@ schema = BikaSchema.copy() + Schema((
),
),
RecordsField('DataInterfaceOptions',
- schemata = _("Export & import"),
type = 'interfaceoptions',
subfields = ('Key','Value'),
required_subfields = ('Key','Value'), | make instrument schemata into single page | senaite_senaite.core | train | py |
ea72ba2075ba326178864d14071fea40de7d1baf | diff --git a/lib/textbringer/window.rb b/lib/textbringer/window.rb
index <HASH>..<HASH> 100644
--- a/lib/textbringer/window.rb
+++ b/lib/textbringer/window.rb
@@ -576,6 +576,7 @@ module Textbringer
def get_char
if @key_buffer.empty?
PDCurses.PDC_save_key_modifiers(1) if defined?(PDCurses)
+ need_retry = false
begin
key = @window.get_char
if defined?(PDCurses)
@@ -587,7 +588,7 @@ module Textbringer
if (mods & PDCurses::KEY_MODIFIER_ALT) != 0
if key == "\0"
# Alt + `, Alt + < etc. return NUL, so ignore it.
- key = nil
+ need_retry = true
else
@key_buffer.push(key)
key = "\e"
@@ -595,7 +596,7 @@ module Textbringer
end
end
end
- end while key.nil?
+ end while need_retry
key
else
@key_buffer.shift | Add new flag need_retry to avoid infinite loop when called in non-block mode. | shugo_textbringer | train | rb |
7a6bc576d126020a7e83ac7f44c0ca069d3572ff | diff --git a/salt/utils/network.py b/salt/utils/network.py
index <HASH>..<HASH> 100644
--- a/salt/utils/network.py
+++ b/salt/utils/network.py
@@ -1945,7 +1945,7 @@ def parse_host_port(host_port):
_s_ = host_port[:]
if _s_[0] == "[":
- if "]" in host_port[0]:
+ if "]" in host_port:
host, _s_ = _s_.lstrip("[").rsplit("]", 1)
host = ipaddress.IPv6Address(host)
if _s_[0] == ":":
@@ -1964,13 +1964,10 @@ def parse_host_port(host_port):
else:
host = _s_
try:
- host_ip = ipaddress.ip_address(host)
- host = host_ip
+ if not isinstance(host, ipaddress._BaseAddress):
+ host_ip = ipaddress.ip_address(host)
+ host = host_ip
except ValueError:
log.debug('"%s" Not an IP address? Assuming it is a hostname.', host)
-# Todo: uncomment and handle
-# except TypeError as _e_:
-# log.error('"%s" generated a TypeError exception', host)
-# raise _e_
return host, port | avoid TypeError by not constructing an ip_address from an ip_address | saltstack_salt | train | py |
c0da54a313a86cfd9bca4d358bb3ff734804c1c4 | diff --git a/bundles/org.eclipse.orion.client.core/web/orion/contentTypes.js b/bundles/org.eclipse.orion.client.core/web/orion/contentTypes.js
index <HASH>..<HASH> 100644
--- a/bundles/org.eclipse.orion.client.core/web/orion/contentTypes.js
+++ b/bundles/org.eclipse.orion.client.core/web/orion/contentTypes.js
@@ -40,6 +40,9 @@ define([], function() {
}
return best;
}
+ if (typeof filename !== "string") { //$NON-NLS-0$
+ return null;
+ }
var extension = filename && filename.split(".").pop(); //$NON-NLS-0$
var best = null;
for (var i=0; i < contentTypes.length; i++) { | [Bug <I>] Fix error loading navigator
-Trying to get contentType of file with no Name field | eclipse_orion.client | train | js |
55c416efaae247ecb85d52edeaa225ecf7aea103 | diff --git a/ontobio/ontol.py b/ontobio/ontol.py
index <HASH>..<HASH> 100644
--- a/ontobio/ontol.py
+++ b/ontobio/ontol.py
@@ -507,19 +507,16 @@ class Ontology():
list[str]
descendant node IDs
"""
- if reflexive:
- decs = self.descendants(node, relations, reflexive=False)
- decs.append(node)
- return decs
- g = None
- if relations is None:
- g = self.get_graph()
- else:
- g = self.get_filtered_graph(relations)
- if node in g:
- return list(nx.descendants(g, node))
- else:
- return []
+ seen = set()
+ nextnodes = [node]
+ while len(nextnodes) > 0:
+ nn = nextnodes.pop()
+ if not nn in seen:
+ seen.add(nn)
+ nextnodes += self.children(nn, relations=relations)
+ if not reflexive:
+ seen -= {node}
+ return list(seen)
def equiv_graph(self):
@@ -1172,7 +1169,7 @@ class Synonym(AbstractPropertyValue):
class PropertyChainAxiom(object):
"""
Represents a property chain axiom used to infer the existence of a property from a chain of properties.
-
+
See the OWL primer for a description of property chains: https://www.w3.org/TR/owl2-primer/#Property_Chains
""" | adding this faster algorithm to descendants as well | biolink_ontobio | train | py |
d8978edbc260352e281ad438f2155a24f486b293 | diff --git a/lib/svtplay_dl/service/tv4play.py b/lib/svtplay_dl/service/tv4play.py
index <HASH>..<HASH> 100644
--- a/lib/svtplay_dl/service/tv4play.py
+++ b/lib/svtplay_dl/service/tv4play.py
@@ -113,7 +113,7 @@ class Tv4play(Service, OpenGraphThumbMixin):
if i.find("mediaFormat").text == "mp4":
base = urlparse(i.find("base").text)
parse = urlparse(i.find("url").text)
- if base.scheme == "rtmp":
+ if "rtmp" in base.scheme:
swf = "http://www.tv4play.se/flash/tv4playflashlets.swf"
options.other = "-W %s -y %s" % (swf, i.find("url").text)
yield RTMP(copy.copy(options), i.find("base").text, i.find("bitrate").text) | tv4play: Look for rtmp in scheme
Sometimes when you login you have rtmpe streams
instead of rtmp. | spaam_svtplay-dl | train | py |
006d1878c17e052c1010caae1037b1e5b53b0c0c | diff --git a/app/models/translation_center/translation_key.rb b/app/models/translation_center/translation_key.rb
index <HASH>..<HASH> 100644
--- a/app/models/translation_center/translation_key.rb
+++ b/app/models/translation_center/translation_key.rb
@@ -7,7 +7,7 @@ module TranslationCenter
# validations
validates :name, uniqueness: true
- validates :category, :name, presence: true
+ validates :name, presence: true
# called after key is created or updated
before_save :add_category
@@ -16,12 +16,12 @@ module TranslationCenter
# add a category of this translation key
def add_category
+
category_name = self.name.to_s.split('.').first
+
# if one word then add to general category
- category_name = 'general' if self.name.to_s.split('.').size == 1
- category = Category.find_or_initialize_by_name(category_name)
- category.save if category.new_record?
- self.category_id = category.id
+ category_name = self.name.to_s.split('.').size == 1 ? 'general' : self.name.to_s.split('.').first
+ self.category = Category.find_or_create_by_name(category_name)
self.last_accessed = Time.now
end | no need to validate category presense as it is added in the before save | BadrIT_translation_center | train | rb |
4e65bd8da24c83a714bb1de700983a8b503054b7 | diff --git a/src/cloudant/result.py b/src/cloudant/result.py
index <HASH>..<HASH> 100644
--- a/src/cloudant/result.py
+++ b/src/cloudant/result.py
@@ -176,7 +176,7 @@ class Result(object):
# Access by index value:
result = Result(callable)
- result(9) # skip first 9 records and get 10th
+ result[9] # skip first 9 records and get 10th
# Access by key value:
result = Result(callable)
@@ -341,7 +341,7 @@ class Result(object):
stop = idx_slice.stop
data = None
if (start is not None and stop is not None and
- start >= 0 and stop >= 0 and start <= stop):
+ start >= 0 and stop >= 0 and start < stop):
if limit is not None:
if start >= limit:
# Result is out of range | Make index slicing where start and stop equal be invalid | cloudant_python-cloudant | train | py |
47569a6b857caaf636622daac7725ecc68d4b816 | diff --git a/lib/jss.rb b/lib/jss.rb
index <HASH>..<HASH> 100644
--- a/lib/jss.rb
+++ b/lib/jss.rb
@@ -194,8 +194,9 @@ module JSS
class Category < JSS::APIObject; end
class Computer < JSS::APIObject; end
class Department < JSS::APIObject; end
- class EBook < JSS::APIObject; end
class DistributionPoint < JSS::APIObject; end
+ class EBook < JSS::APIObject; end
+ class IBeacon < JSS::APIObject
class LDAPServer < JSS::APIObject; end
class MacApplication < JSS::APIObject; end
class MobileDevice < JSS::APIObject; end | early definition of IBeacon class so it exists for Scope objects | PixarAnimationStudios_ruby-jss | train | rb |
9ca22e9805d55b920ce22f029ed321127928992d | diff --git a/src/Symfony/Component/Cache/Tests/Adapter/FilesystemAdapterTest.php b/src/Symfony/Component/Cache/Tests/Adapter/FilesystemAdapterTest.php
index <HASH>..<HASH> 100644
--- a/src/Symfony/Component/Cache/Tests/Adapter/FilesystemAdapterTest.php
+++ b/src/Symfony/Component/Cache/Tests/Adapter/FilesystemAdapterTest.php
@@ -35,6 +35,9 @@ class FilesystemAdapterTest extends CachePoolTest
public static function rmdir($dir)
{
+ if (!file_exists($dir)) {
+ return;
+ }
if (!$dir || 0 !== strpos(dirname($dir), sys_get_temp_dir())) {
throw new \Exception(__METHOD__."() operates only on subdirs of system's temp dir");
} | [Cache] Fix test tearDown | symfony_symfony | train | php |
32825ebd3d5ab9514ac7f0cc360a274955fa3259 | diff --git a/message/externallib.php b/message/externallib.php
index <HASH>..<HASH> 100644
--- a/message/externallib.php
+++ b/message/externallib.php
@@ -111,7 +111,7 @@ class moodle_message_external extends external_api {
// Check if the user is a contact
//TODO: performance improvement - edit the function so we can pass an array instead userid
- if ($success && empty($contact) && !empty(get_user_preferences('message_blocknoncontacts', NULL, $message['touserid']))) {
+ if ($success && empty($contact) && get_user_preferences('message_blocknoncontacts', NULL, $message['touserid']) == null) {
// The user isn't a contact and they have selected to block non contacts so this message won't be sent.
$success = false;
$errormessage = get_string('userisblockingyounoncontact', 'message'); | MDL-<I> Fixed up typo with user prefs | moodle_moodle | train | php |
9c0928521c6af06863e9673b54548eda6c894146 | diff --git a/jbehave-core/src/main/java/org/jbehave/core/embedder/PerformableTree.java b/jbehave-core/src/main/java/org/jbehave/core/embedder/PerformableTree.java
index <HASH>..<HASH> 100644
--- a/jbehave-core/src/main/java/org/jbehave/core/embedder/PerformableTree.java
+++ b/jbehave-core/src/main/java/org/jbehave/core/embedder/PerformableTree.java
@@ -885,7 +885,7 @@ public class PerformableTree {
SUCCESSFUL, FAILED, PENDING, NOT_PERFORMED, EXCLUDED;
}
- public static abstract class PerformableEntity implements Performable {
+ public abstract static class PerformableEntity implements Performable {
private PerformableGivenStories givenStories;
private final Map<Stage, Map<ExecutionType, PerformableSteps>> stageSteps; | JBEHAVE-<I> Fix all violations of Checkstyle rule ModifierOrder | jbehave_jbehave-core | train | java |
8bc8237d462c081f49ab79372cf644e5f1ee31b6 | diff --git a/lib/volt/server/html_parser/sandlebars_parser.rb b/lib/volt/server/html_parser/sandlebars_parser.rb
index <HASH>..<HASH> 100644
--- a/lib/volt/server/html_parser/sandlebars_parser.rb
+++ b/lib/volt/server/html_parser/sandlebars_parser.rb
@@ -122,7 +122,9 @@ module Volt
# or end of doc before closed binding
raise_parse_error("unclosed binding: {#{binding.strip}")
else
+ #:nocov:
fail 'should not reach here'
+ #:nocov:
end
end | Skip test coverage for impossible safety branch in sandlebars parser | voltrb_volt | train | rb |
d9b36a95bb9ede2ecdec734382f00c11822fe638 | diff --git a/openstack_dashboard/dashboards/project/api_access/tables.py b/openstack_dashboard/dashboards/project/api_access/tables.py
index <HASH>..<HASH> 100644
--- a/openstack_dashboard/dashboards/project/api_access/tables.py
+++ b/openstack_dashboard/dashboards/project/api_access/tables.py
@@ -37,7 +37,7 @@ class DownloadEC2(tables.LinkAction):
verbose_name = _("Download EC2 Credentials")
verbose_name_plural = _("Download EC2 Credentials")
icon = "download"
- url = "horizon:project:access_and_security:api_access:ec2"
+ url = "horizon:project:api_access:ec2"
policy_rules = (("compute", "os_compute_api:os-certificates:create"),)
def allowed(self, request, datum=None):
@@ -84,8 +84,7 @@ class RecreateCredentials(tables.LinkAction):
verbose_name = _("Recreate EC2 Credentials")
classes = ("ajax-modal",)
icon = "refresh"
- url = \
- "horizon:project:access_and_security:api_access:recreate_credentials"
+ url = "horizon:project:api_access:recreate_credentials"
policy_rules = (("compute", "os_compute_api:certificates:create"))
action_type = "danger" | Fix EC2 related buttons url in the api access page
access_and_security has moved to separate panel since
<URL> | openstack_horizon | train | py |
59016e8ce621fa4b768181623dcfa4f00c73bb85 | diff --git a/test/specs/parsing/xquery-updating/ReplaceExpression.tests.js b/test/specs/parsing/xquery-updating/ReplaceExpression.tests.js
index <HASH>..<HASH> 100644
--- a/test/specs/parsing/xquery-updating/ReplaceExpression.tests.js
+++ b/test/specs/parsing/xquery-updating/ReplaceExpression.tests.js
@@ -24,7 +24,7 @@ describe('ReplaceExpression', () => {
const ele = documentNode.appendChild(documentNode.createElement('ele'));
const result = await evaluateUpdatingExpression('replace node ele with <ele/>', documentNode, null, {}, {});
- chai.assert.deepEqual(result.result, []);
+ chai.assert.deepEqual(result.xdmValue, []);
assertCorrectUpdateList(result.pendingUpdateList, [
{
type: 'replaceNode',
@@ -38,7 +38,7 @@ describe('ReplaceExpression', () => {
const ele = documentNode.appendChild(documentNode.createElement('ele'));
const result = await evaluateUpdatingExpression('if (true()) then replace node ele with <ele/> else ()', documentNode, null, {}, {});
- chai.assert.deepEqual(result.result, []);
+ chai.assert.deepEqual(result.xdmValue, []);
assertCorrectUpdateList(result.pendingUpdateList, [
{
type: 'replaceNode', | Fix tests to read from the correct property | FontoXML_fontoxpath | train | js |
503e9878e8ae1f79cec0d9e55cef575d76fff458 | diff --git a/run_doctests.py b/run_doctests.py
index <HASH>..<HASH> 100644
--- a/run_doctests.py
+++ b/run_doctests.py
@@ -23,7 +23,7 @@ import sys
arg = sys.argv[:1]
arg.append('--verbosity=2')
arg.append('--with-doctest')
-arg.append('--doctest-options=+NORMALIZE_WHITESPACE')
+arg.append('--doctest-options=+NORMALIZE_WHITESPACE,+ELLIPSIS')
try:
# pylint: disable=unused-import
import odl.space.cuda | Added ellipsis support to docstring tests | odlgroup_odl | train | py |
99e8883d01491ce32be72071522128b1e1abc08b | diff --git a/ansible_runner/config/_base.py b/ansible_runner/config/_base.py
index <HASH>..<HASH> 100644
--- a/ansible_runner/config/_base.py
+++ b/ansible_runner/config/_base.py
@@ -362,7 +362,8 @@ class BaseConfig(object):
if 'ansible-playbook' in value:
playbook_file_path = self._get_playbook_path(cmdline_args)
if playbook_file_path:
- self._update_volume_mount_paths(args_list, playbook_file_path)
+ self._update_volume_mount_paths(args_list, playbook_file_path, labels=":Z")
+ break
cmdline_args_copy = cmdline_args.copy()
optional_arg_paths = []
@@ -385,7 +386,7 @@ class BaseConfig(object):
# comma separated host list provided as value
continue
- self._update_volume_mount_paths(args_list, optional_arg_value)
+ self._update_volume_mount_paths(args_list, optional_arg_value, labels=":Z")
def wrap_args_for_containerization(self, args, execution_mode, cmdline_args):
new_args = [self.process_isolation_executable] | add Z label for playbook and inventory dir mount | ansible_ansible-runner | train | py |
d685f446ef88c2273a5e3f310d2ebb2bff9091f8 | diff --git a/lib/puppet/type/file.rb b/lib/puppet/type/file.rb
index <HASH>..<HASH> 100644
--- a/lib/puppet/type/file.rb
+++ b/lib/puppet/type/file.rb
@@ -147,7 +147,7 @@ module Puppet
resource[:recurselimit] = value
true
else
- raise ArgumentError, "Invalid recurse value %s" % value.inspect
+ self.fail "Invalid recurse value #{value.inspect}"
end
end
end
@@ -163,7 +163,7 @@ module Puppet
when Integer, Fixnum, Bignum; value
when /^\d+$/; Integer(value)
else
- raise ArgumentError, "Invalid recurselimit value %s" % value.inspect
+ self.fail "Invalid recurselimit value #{value.inspect}"
end
end
end | <I> file and line info on bad params in type/file | puppetlabs_puppet | train | rb |
d25f85af0925391968e2af462dd797a3f160c066 | diff --git a/go/vt/tabletserver/status.go b/go/vt/tabletserver/status.go
index <HASH>..<HASH> 100644
--- a/go/vt/tabletserver/status.go
+++ b/go/vt/tabletserver/status.go
@@ -34,7 +34,7 @@ google.load("visualization", "1", {packages:["corechart"]});
function minutesAgo(d, i) {
var copy = new Date(d);
- copy.setMinutes(copy.getMinutes() - i);
+ copy.setTime(copy.getTime() - i*60*1000);
return copy
} | Fixing wrap around in minutes in vttablet's QPS graph. | vitessio_vitess | train | go |
d34c7595e950de3604e830dbf52a42dc27277c03 | diff --git a/controllers/api.js b/controllers/api.js
index <HASH>..<HASH> 100644
--- a/controllers/api.js
+++ b/controllers/api.js
@@ -167,15 +167,12 @@ module.exports = function(connection_,settings_) {
//Fire query
lastQry = connection.query("SELECT " + fields + " FROM ?? " + where + " " + order + " " + limit, [req.params.table], function (err, rows) {
if (err) return sendError(res, err.code);
- if (rows.length > 0) {
- res.send({
- result: 'success',
- json: rows,
- table: req.params.table,
- length: rows.length
- });
- } else return sendError(res, 'No Row found.')
-
+ res.send({
+ result: 'success',
+ json: rows,
+ table: req.params.table,
+ length: rows.length
+ });
});
});
}, | Disabled "No Row found." error of findAll. | kenodressel_mysql-to-rest | train | js |
ca255b932127c59158d42f8af1c0ae5f3d42bc3b | diff --git a/lib/puppet/reports/rrdgraph.rb b/lib/puppet/reports/rrdgraph.rb
index <HASH>..<HASH> 100644
--- a/lib/puppet/reports/rrdgraph.rb
+++ b/lib/puppet/reports/rrdgraph.rb
@@ -99,7 +99,7 @@ Puppet::Network::Handler.report.newreport(:rrdgraph) do
def process(time = nil)
time ||= Time.now.to_i
- unless File.directory?(hostdir) and File.writeable?(hostdir)
+ unless File.directory?(hostdir) and FileTest.writable?(hostdir)
# Some hackishness to create the dir with all of the right modes and ownership
config = Puppet::Util::Config.new
config.setdefaults(:reports, :hostdir => {:default => hostdir, :owner => Puppet[:user], :mode => 0755, :group => Puppet[:group], :desc => "eh"}) | fixing the method to check for hostdir writability in the rrdgraph report
git-svn-id: <URL> | puppetlabs_puppet | train | rb |
5c32f5054434fca4dd701779a79a5308c910afff | diff --git a/src/components/container/container.js b/src/components/container/container.js
index <HASH>..<HASH> 100644
--- a/src/components/container/container.js
+++ b/src/components/container/container.js
@@ -106,9 +106,9 @@ class Container extends UIObject {
return this.playback.getDuration();
}
- error(error) {
- this.$el.prepend(error.render().el)
- this.trigger('container:error', {error: error, container: this}, this.name);
+ error(errorObj) {
+ this.$el.prepend(errorObj.render().el)
+ this.trigger('container:error', {error: errorObj, container: this}, this.name);
}
loadedMetadata(duration) { | container: fix jshint complaints | clappr_clappr | train | js |
8e17a2e76b7f3fdd30b2717c8f103f8767ea261c | diff --git a/Runnable/DispatcherStore.php b/Runnable/DispatcherStore.php
index <HASH>..<HASH> 100644
--- a/Runnable/DispatcherStore.php
+++ b/Runnable/DispatcherStore.php
@@ -147,7 +147,7 @@ abstract class DispatcherStore extends BaseStore
*/
public function dumpAction($action)
{
- echo "Action '" . $action->getName() . "'' : " . var_export($action->getProperties(), true) . "\n";
+ echo "Action '" . $action->getName() . "' : " . var_export($action->getProperties(), true) . "\n";
}
/** | fix(typo): remove double single quote | wizbii_pipeline | train | php |
062ae2b5a5595fca6f4e95aabf20c5f1e7b838b5 | diff --git a/docs/source/conf.py b/docs/source/conf.py
index <HASH>..<HASH> 100644
--- a/docs/source/conf.py
+++ b/docs/source/conf.py
@@ -135,7 +135,7 @@ html_theme = 'default'
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
-html_static_path = ['_static']
+#html_static_path = ['_static']
# Add any extra paths that contain custom files (such as robots.txt or
# .htaccess) here, relative to this directory. These files are copied | Suppress warning about missing _static directory during docs build. | mdickinson_bigfloat | train | py |
34db087608d515f3bd1d953e63e738ff45a57fd3 | diff --git a/src/mocks/mock-request.js b/src/mocks/mock-request.js
index <HASH>..<HASH> 100644
--- a/src/mocks/mock-request.js
+++ b/src/mocks/mock-request.js
@@ -72,7 +72,7 @@ MockRequest.prototype = {
* @return {boolean}
*/
isExactMatch (request) {
- const bodyMatch = this.bodyFunction
+ const bodyMatch = () => this.bodyFunction
? this.body(request.body())
: this.body === toSortedQueryString(request.body())
@@ -80,7 +80,7 @@ MockRequest.prototype = {
? this.url(request.url(), request.params())
: sortedUrl(this.url) === sortedUrl(request.url())
- return this.method === request.method() && urlMatch && bodyMatch
+ return this.method === request.method() && urlMatch && bodyMatch()
},
/** | Lazy-match body to not trigger body-matching callback unnecessarily | tulios_mappersmith | train | js |
a7ac2c7454dd114a2d401a5c118a912601532623 | diff --git a/drivers/bridge/bridge.go b/drivers/bridge/bridge.go
index <HASH>..<HASH> 100644
--- a/drivers/bridge/bridge.go
+++ b/drivers/bridge/bridge.go
@@ -61,6 +61,7 @@ type ContainerConfiguration struct {
type bridgeEndpoint struct {
id types.UUID
intf *sandbox.Interface
+ macAddress net.HardwareAddr
config *EndpointConfiguration // User specified parameters
portMapping []netutils.PortBinding // Operation port bindings
}
@@ -424,6 +425,7 @@ func (d *driver) CreateEndpoint(nid, eid types.UUID, epOptions map[string]interf
if err != nil {
return nil, err
}
+ endpoint.macAddress = mac
// Add bridge inherited attributes to pipe interfaces
if config.Mtu != 0 {
@@ -614,6 +616,10 @@ func (d *driver) EndpointInfo(nid, eid types.UUID) (map[string]interface{}, erro
m[options.PortMap] = pmc
}
+ if len(ep.macAddress) != 0 {
+ m[options.MacAddress] = ep.macAddress
+ }
+
return m, nil
} | Added mac address to EndpointInfo | docker_libnetwork | train | go |
7debcbdd023ed21463ff2cb90dd6b860b1e9f522 | diff --git a/lib/parser.js b/lib/parser.js
index <HASH>..<HASH> 100644
--- a/lib/parser.js
+++ b/lib/parser.js
@@ -284,8 +284,8 @@ Parser.prototype = {
selectorToken: function() {
if (this.isSelectorToken(1)) {
if ('{' == this.peek().type) {
- if (this.lineContains(':') || !this.lineContains('}'))
- return;
+ // unclosed, must be a block
+ if (!this.lineContains('}')) return;
}
return this.next();
} | remove lookahead for ":" within selector interpolation | stylus_stylus | train | js |
742d130a10620c84f448ccb89c69934525afc077 | diff --git a/lib/opal/jquery/element.rb b/lib/opal/jquery/element.rb
index <HASH>..<HASH> 100644
--- a/lib/opal/jquery/element.rb
+++ b/lib/opal/jquery/element.rb
@@ -759,10 +759,10 @@ class Element < `#{JQUERY_CLASS.to_n}`
%x{
var method = self[#{name}];
- if (method) {
+ if (typeof(method) === 'function') {
return method.apply(self, #{args.to_n});
} else {
- return #{super}
+ return #{super};
}
}
end | Forward method_missing to jq plugins only for func | opal_opal-jquery | train | rb |
c235839229a6d4fae1ccfceb7d4cab22d0cc1382 | diff --git a/lib/better_errors/error_page.rb b/lib/better_errors/error_page.rb
index <HASH>..<HASH> 100644
--- a/lib/better_errors/error_page.rb
+++ b/lib/better_errors/error_page.rb
@@ -95,6 +95,8 @@ module BetterErrors
end
html << "</div>"
end
+ rescue Errno::ENOENT
+ "<p>Source unavailable</p>"
end
end
end
diff --git a/spec/better_errors/error_page_spec.rb b/spec/better_errors/error_page_spec.rb
index <HASH>..<HASH> 100644
--- a/spec/better_errors/error_page_spec.rb
+++ b/spec/better_errors/error_page_spec.rb
@@ -41,5 +41,12 @@ module BetterErrors
response.should_not include("14 fourteen")
end
end
+
+ it "should not die if the source file is not a real filename" do
+ exception.stub!(:backtrace).and_return([
+ "<internal:prelude>:10:in `spawn_rack_application'"
+ ])
+ response.should include("Source unavailable")
+ end
end
end | don't die if a filename in a backtrace does not exist (#4) | BetterErrors_better_errors | train | rb,rb |
d1606641fff94362499d0a3f0087cec1cef4358b | diff --git a/main.go b/main.go
index <HASH>..<HASH> 100644
--- a/main.go
+++ b/main.go
@@ -137,7 +137,7 @@ func main() {
// Mount middleware
service.Use(middleware.RequestID())
- service.Use(middleware.LogRequest(true))
+ service.Use(middleware.LogRequest(configuration.IsPostgresDeveloperModeEnabled()))
service.Use(gzip.Middleware(9))
service.Use(jsonapi.ErrorHandler(service, true))
service.Use(middleware.Recover()) | Log requests only when developer mode is enabled (#<I>) | fabric8-services_fabric8-auth | train | go |
accf9d4987aaa333fe480eb91eb7b5fc1529a813 | diff --git a/gosu-lab/src/main/java/editor/BasicGosuEditor.java b/gosu-lab/src/main/java/editor/BasicGosuEditor.java
index <HASH>..<HASH> 100644
--- a/gosu-lab/src/main/java/editor/BasicGosuEditor.java
+++ b/gosu-lab/src/main/java/editor/BasicGosuEditor.java
@@ -44,6 +44,11 @@ public class BasicGosuEditor extends JFrame implements IGosuEditor
}
} );
}
+ @Override
+ public void windowDeactivated( WindowEvent e )
+ {
+ EventQueue.invokeLater( _panel::saveIfDirty );
+ }
} );
addComponentListener(
new ComponentAdapter() | save current file on frame window deactivation | gosu-lang_gosu-lang | train | java |
89d342365dfc03c5ef22ee682837ce5ff062e112 | diff --git a/cmd/fish/install.go b/cmd/fish/install.go
index <HASH>..<HASH> 100644
--- a/cmd/fish/install.go
+++ b/cmd/fish/install.go
@@ -33,6 +33,10 @@ func newInstallCmd() *cobra.Command {
if err != nil {
return err
}
+ if food.Installed() {
+ ohai.Ohaif("%s is already installed. Please use `fish upgrade %s` to upgrade.\n", fishFood, fishFood)
+ return nil
+ }
ohai.Ohaif("Installing %s...\n", fishFood)
start := time.Now()
if err := food.Install(); err != nil { | error out on install if it already exists | fishworks_gofish | train | go |
efd4e10af231be9ade0eff6a669884a121d2f458 | diff --git a/src/Controller/OrderCRUDController.php b/src/Controller/OrderCRUDController.php
index <HASH>..<HASH> 100644
--- a/src/Controller/OrderCRUDController.php
+++ b/src/Controller/OrderCRUDController.php
@@ -162,7 +162,7 @@ class OrderCRUDController extends CRUDController
}
try {
- if ($action === 'validate' && $selectedModel->getNumber() === null) {
+ if ($action === OrderTransitions::TRANSITION_FULFILL && $selectedModel->getNumber() === null) {
$this->container->get('sylius.order_number_assigner')->assignNumber($selectedModel);
}
$stateMachine = $stateMachineFactory->get($selectedModel, OrderTransitions::GRAPH); | Replace wrong state transition name by correct value | sil-project_EcommerceBundle | train | php |
328e6daec52f6db62221b7adc390b3ab30e5b363 | diff --git a/autotweet/app.py b/autotweet/app.py
index <HASH>..<HASH> 100644
--- a/autotweet/app.py
+++ b/autotweet/app.py
@@ -1,15 +1,8 @@
-import logging
from flask import Flask, jsonify, render_template, request
app = Flask(__name__)
-def set_logging_level(level):
- if level is None:
- level = 0
- logging.basicConfig(level=level*10)
-
-
@app.route('/')
def form():
atm = app.config['atm'] | Remove unused code snippets. | Kjwon15_autotweet | train | py |
1bf56344daeee76d4431dc0b0d03ceee849401f2 | diff --git a/salt/cli/__init__.py b/salt/cli/__init__.py
index <HASH>..<HASH> 100644
--- a/salt/cli/__init__.py
+++ b/salt/cli/__init__.py
@@ -404,7 +404,8 @@ class SaltCP(object):
'''
Parse the command line
'''
- parser = optparse.OptionParser(version="%%prog %s" % VERSION)
+ usage = "%prog [options] '<target>' SOURCE DEST"
+ parser = optparse.OptionParser(version="%%prog %s" % VERSION, usage=usage)
parser.add_option('-t',
'--timeout', | "salt-cp --help" should mention that it takes source/destination filenames as parameters, just like "man salt-cp" does. | saltstack_salt | train | py |
1a1fb58deace3bb9bd881974d457121a49bbe7c4 | diff --git a/src/main/java/org/jinstagram/Instagram.java b/src/main/java/org/jinstagram/Instagram.java
index <HASH>..<HASH> 100644
--- a/src/main/java/org/jinstagram/Instagram.java
+++ b/src/main/java/org/jinstagram/Instagram.java
@@ -627,6 +627,8 @@ public class Instagram {
* be moved to Sandbox Mode if it wasn't approved
* through the review process.
* See changelog on Nov 17, 2015
+ *
+ * No analog method was offered instead.
*/
@Deprecated
public MediaFeed getPopularMedia() throws InstagramException { | Added comment to javadoc of popular media. No methods to replace /media/popular was provided. | sachin-handiekar_jInstagram | train | java |
1372c2084e3019fcb48618de4d3af77281fa6ef2 | diff --git a/plugin/src/main/java/io/fabric8/maven/plugin/converter/DeploymentOpenShiftConverter.java b/plugin/src/main/java/io/fabric8/maven/plugin/converter/DeploymentOpenShiftConverter.java
index <HASH>..<HASH> 100644
--- a/plugin/src/main/java/io/fabric8/maven/plugin/converter/DeploymentOpenShiftConverter.java
+++ b/plugin/src/main/java/io/fabric8/maven/plugin/converter/DeploymentOpenShiftConverter.java
@@ -91,7 +91,7 @@ public class DeploymentOpenShiftConverter implements KubernetesToOpenShiftConver
specBuilder.withNewStrategy().withType("Rolling").
withNewRollingParams().withTimeoutSeconds(openshiftDeployTimeoutSeconds).endRollingParams().endStrategy();
} else if (Strings.isNotBlank(strategyType)) {
- if (strategyType.equals("Recreate")) {
+ if ("Recreate".equals(strategyType)) {
specBuilder.withNewStrategy().withType(strategyType).
withNewRecreateParams().withTimeoutSeconds(openshiftDeployTimeoutSeconds).endRecreateParams().endStrategy();
} else { | chore(pepperpot): unnecessary reorder to remove pepperpot warnings
I hope this pleases pepperpot.
I guess it avoids a possible NPE if the above line were to be removed | fabric8io_fabric8-maven-plugin | train | java |
a9885065f0351fcee7f6053dc947b39bbdf7e1d1 | diff --git a/spyderlib/widgets/qteditor/qteditor.py b/spyderlib/widgets/qteditor/qteditor.py
index <HASH>..<HASH> 100644
--- a/spyderlib/widgets/qteditor/qteditor.py
+++ b/spyderlib/widgets/qteditor/qteditor.py
@@ -1063,9 +1063,10 @@ class QtEditor(TextEditBaseWidget):
self.fix_indent()
elif key == Qt.Key_Backspace and not shift and not ctrl:
leading_text = self.get_text('sol', 'cursor')
+ leading_length = len(leading_text)
if not self.hasSelectedText() \
and leading_text and not leading_text.strip() \
- and len(leading_text) > 4:
+ and leading_length > 4 and leading_length % 4 == 0:
self.unindent()
else:
QPlainTextEdit.keyPressEvent(self, event) | QtEditor: when pressing <BACKSPACE> right before the text contents of an indented line of code, unindents only if leading text length is a multiple of 4, otherwise simply remove one space | spyder-ide_spyder | train | py |
feae5fea0ad11a199b6fbdd967f511c3466fcdc3 | diff --git a/test/index.js b/test/index.js
index <HASH>..<HASH> 100644
--- a/test/index.js
+++ b/test/index.js
@@ -401,8 +401,8 @@ test("Work correctly with Vue.extend", t => {
t.plan(2)
const SubVue = Vue.extend({
asyncComputed: {
- async x () {
- return 1
+ x () {
+ return Promise.resolve(1)
}
}
}) | Allow tests to run on Node v6, by removing async functions from tests | foxbenjaminfox_vue-async-computed | train | js |
f569c2966775839bb06c83d4e7c0eec0c0d8a98f | diff --git a/modules/casper.js b/modules/casper.js
index <HASH>..<HASH> 100644
--- a/modules/casper.js
+++ b/modules/casper.js
@@ -2250,12 +2250,12 @@ Casper.prototype.withFrame = function withFrame(frameInfo, then) {
} catch (e) {
// revert to main page on error
this.warn("Error while processing frame step: " + e);
- this.page.switchToMainFrame();
+ this.page.switchToParentFrame();
throw e;
}
return this.then(function _step() {
// revert to main page
- this.page.switchToMainFrame();
+ this.page.switchToParentFrame();
});
}; | fixes #<I> - withFrame() now switches back to parent frame instead of main one | casperjs_casperjs | train | js |
01d951ce6c08b3b649bfbdb050660037b2a8b0d4 | diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100755
--- a/setup.py
+++ b/setup.py
@@ -176,10 +176,14 @@ if not ISRELEASED:
FULLVERSION += '.dev'
try:
import subprocess
- pipe = subprocess.Popen(["git", "rev-parse", "--short", "HEAD"],
- stdout=subprocess.PIPE).stdout
+ try:
+ pipe = subprocess.Popen(["git", "rev-parse", "--short", "HEAD"],
+ stdout=subprocess.PIPE).stdout
+ except OSError:
+ # msysgit compatibility
+ pipe = subprocess.Popen(["git.cmd", "rev-parse", "--short", "HEAD"],
+ stdout=subprocess.PIPE).stdout
rev = pipe.read().strip()
-
# makes distutils blow up on Python 2.7
if sys.version_info[0] >= 3:
rev = rev.decode('ascii') | ENH: make sha lookup compatible with msysgit | pandas-dev_pandas | train | py |
846c08ba881164ea9e5044e5f233f4159229da6d | diff --git a/src/Isolate.php b/src/Isolate.php
index <HASH>..<HASH> 100644
--- a/src/Isolate.php
+++ b/src/Isolate.php
@@ -96,11 +96,12 @@ class Isolate
* operation; the caller must return immediately and only after the exception
* has been handled does it become legal to invoke JavaScript operations.
*
- * @param \V8\Value $value
+ * @param Context $context
+ * @param Value $value
*
- * @return \V8\Value
+ * @return Value
*/
- public function ThrowException(Value $value) : Value
+ public function ThrowException(Context $context, Value $value) : Value
{
} | Require Context explicitly in V8\Isolate::ThrowException()
Breaks BC | phpv8_php-v8-stubs | train | php |
6cd180d4540587e40e01df527642e50ba4d4f1ac | diff --git a/spec/helpers/database.rb b/spec/helpers/database.rb
index <HASH>..<HASH> 100644
--- a/spec/helpers/database.rb
+++ b/spec/helpers/database.rb
@@ -1,5 +1,7 @@
require 'ronin/database'
+require 'spec_helper'
+
module Helpers
- Ronin::Database.setup(ENV['DATABASE'] || 'sqlite3::memory:')
+ Database.setup(ENV['DATABASE'] || 'sqlite3::memory:')
end | Second thought, have all spec helpers require 'spec_helper.rb' as a convention. | ronin-ruby_ronin | train | rb |
79f43c0beec338d594a1b516ae0301c723c6e3cd | diff --git a/lib/valid_email2/address.rb b/lib/valid_email2/address.rb
index <HASH>..<HASH> 100644
--- a/lib/valid_email2/address.rb
+++ b/lib/valid_email2/address.rb
@@ -6,7 +6,7 @@ module ValidEmail2
class Address
attr_accessor :address
- PROHIBITED_DOMAIN_CHARACTERS_REGEX = /[+!_\/\s']/
+ PROHIBITED_DOMAIN_CHARACTERS_REGEX = /[+!_\/\s'`]/
DEFAULT_RECIPIENT_DELIMITER = '+'.freeze
DOT_DELIMITER = '.'.freeze
diff --git a/spec/valid_email2_spec.rb b/spec/valid_email2_spec.rb
index <HASH>..<HASH> 100644
--- a/spec/valid_email2_spec.rb
+++ b/spec/valid_email2_spec.rb
@@ -59,7 +59,7 @@ describe ValidEmail2 do
expect(user.valid?).to be_falsey
end
- %w[+ _ ! / \ '].each do |invalid_character|
+ %w[+ _ ! / \ ' `].each do |invalid_character|
it "is invalid if email contains a \"#{invalid_character}\" character" do
user = TestUser.new(email: "foo@google#{invalid_character}yahoo.com")
expect(user.valid?).to be_falsey | Disallow ` (backticks) in domains. Fixes #<I> | micke_valid_email2 | train | rb,rb |
476af62498b999f93eefb97d4f64fcb7e4f3289a | diff --git a/test.py b/test.py
index <HASH>..<HASH> 100644
--- a/test.py
+++ b/test.py
@@ -247,11 +247,13 @@ def test_chunked_encoding_error(spawn):
'"ok","modifiedIndex":42,"createdIndex":42}}')
# Bad response.
conn, __ = server.accept()
+ conn.recv(999999)
conn.send(header.encode())
conn.close()
# Good response.
conn, __ = server.accept()
response = header + '%x\r\n%s\r\n0\r\n\r\n' % (len(data), data)
+ conn.recv(999999)
conn.send(response.encode())
conn.close()
spawn(bad_web_server)
@@ -308,12 +310,9 @@ def test_503_service_unavailable(spawn):
server.listen(10)
__, port = server.getsockname()
def dead_web_server():
- response = '\r\n'.join([
- 'HTTP/1.1 503 Service Unavailable',
- 'Content-Type: text/html; charset=UTF-8',
- 'Connection: close',
- ]) + '\r\n\r\n'
+ response = 'HTTP/1.1 503 Service Unavailable\r\n\r\n'
conn, __ = server.accept()
+ conn.recv(999999)
conn.send(response.encode())
conn.close()
spawn(dead_web_server) | Fake HTTP servers receives request before responding | sublee_etc | train | py |
9519eafc448518f3da79087f16d5ded5c5b669c9 | diff --git a/lib/socketLogic.js b/lib/socketLogic.js
index <HASH>..<HASH> 100644
--- a/lib/socketLogic.js
+++ b/lib/socketLogic.js
@@ -108,7 +108,7 @@ function socketLogic (socket, secure, skynet){
// Have device join its uuid room name so that others can subscribe to it
debug(socket.id, 'subscribing to received and broadcast', auth.device.uuid);
- socket.messageIOClient.subscribe(auth.device.uuid, ['received', 'broadcast']);
+ socket.messageIOClient.subscribe(auth.device.uuid, ['received']);
whoAmI(data.uuid, false, function(results){
data.auth = auth; | don't subscribe to broadcast on login | octoblu_meshblu | train | js |
2db652c1824a72a32420dae1d43e82a970fb4282 | diff --git a/Facades/View.php b/Facades/View.php
index <HASH>..<HASH> 100755
--- a/Facades/View.php
+++ b/Facades/View.php
@@ -6,6 +6,7 @@ namespace Illuminate\Support\Facades;
* @method static \Illuminate\Contracts\View\Factory addNamespace(string $namespace, string|array $hints)
* @method static \Illuminate\Contracts\View\View first(array $views, \Illuminate\Contracts\Support\Arrayable|array $data = [], array $mergeData = [])
* @method static \Illuminate\Contracts\View\Factory replaceNamespace(string $namespace, string|array $hints)
+ * @method static \Illuminate\Contracts\View\Factory addExtension(string $extension, string $engine, \Closure|null $resolver = null)
* @method static \Illuminate\Contracts\View\View file(string $path, array $data = [], array $mergeData = [])
* @method static \Illuminate\Contracts\View\View make(string $view, array $data = [], array $mergeData = [])
* @method static array composer(array|string $views, \Closure|string $callback) | Add PHPDoc method for `View` facade (#<I>) | illuminate_support | train | php |
819271ae774b8e5a137bca08dff94383bb5f1ec7 | diff --git a/twilio/__init__.py b/twilio/__init__.py
index <HASH>..<HASH> 100644
--- a/twilio/__init__.py
+++ b/twilio/__init__.py
@@ -1,2 +1,2 @@
-__version_info__ = ('5', '0', '0')
+__version_info__ = ('6', '0', '0rc1')
__version__ = '.'.join(__version_info__) | Bump to version <I>rc1 | twilio_twilio-python | train | py |
4cc82db4adfe02458eca59e312531b47a107ab33 | diff --git a/actionpack/lib/action_controller/test_case.rb b/actionpack/lib/action_controller/test_case.rb
index <HASH>..<HASH> 100644
--- a/actionpack/lib/action_controller/test_case.rb
+++ b/actionpack/lib/action_controller/test_case.rb
@@ -3,6 +3,7 @@ require "active_support/core_ext/hash/conversions"
require "active_support/core_ext/object/to_query"
require "active_support/core_ext/module/anonymous"
require "active_support/core_ext/hash/keys"
+require "active_support/testing/constant_lookup"
require "action_controller/template_assertions"
require "rails-dom-testing" | Missing require "active_support/testing/constant_lookup" | rails_rails | 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.