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
|
---|---|---|---|---|---|
6bef66e7258a013003bfd10e499454d6415e8fe7 | diff --git a/werobot/reply.py b/werobot/reply.py
index <HASH>..<HASH> 100644
--- a/werobot/reply.py
+++ b/werobot/reply.py
@@ -5,7 +5,6 @@ from .utils import isstring, to_unicode
class Article(object):
-
def __init__(self, title, description, img, url):
self.title = title
self.description = description
@@ -16,12 +15,12 @@ class Article(object):
class WeChatReply(object):
def __init__(self, message=None, star=False, **kwargs):
- if isinstance(message, WeChatMessage):
+ if "source" not in kwargs and isinstance(message, WeChatMessage):
kwargs["source"] = message.target
- kwargs["target"] = message.source
- assert 'source' in kwargs
- assert 'target' in kwargs
+ if "target" not in kwargs and isinstance(message, WeChatMessage):
+ kwargs["target"] = message.target
+
if 'time' not in kwargs:
kwargs["time"] = int(time.time())
if star: | Don't assert source/target in kwargs | offu_WeRoBot | train | py |
812013b1c1783819bbd922baf3d4dabf41dfab56 | diff --git a/lib/phpunit/lib.php b/lib/phpunit/lib.php
index <HASH>..<HASH> 100644
--- a/lib/phpunit/lib.php
+++ b/lib/phpunit/lib.php
@@ -423,6 +423,7 @@ class phpunit_util {
// reset all static caches
accesslib_clear_all_caches(true);
get_string_manager()->reset_caches();
+ events_get_handlers('reset');
//TODO: add more resets here and probably refactor them to new core function
// purge dataroot | MDL-<I> reset event handlers in phpunit test reset | moodle_moodle | train | php |
a9d25f94118fb4d148881dba4b4310fe81302471 | diff --git a/sportsref/nba/boxscores.py b/sportsref/nba/boxscores.py
index <HASH>..<HASH> 100644
--- a/sportsref/nba/boxscores.py
+++ b/sportsref/nba/boxscores.py
@@ -149,10 +149,7 @@ class BoxScore(
:returns: pandas DataFrame of play-by-play. Similar to GPF.
"""
- try:
- doc = self.get_subpage_doc('pbp')
- except ValueError:
- return pd.DataFrame()
+ doc = self.get_subpage_doc('pbp')
table = doc('table#pbp')
rows = [tr.children('td') for tr in table('tr').items() if tr('td')]
data = [] | nba.BoxScore.pbp raises ValueError when no pbp is found | mdgoldberg_sportsref | train | py |
91695de3380a8ddd76ac22fef27f78a2da762004 | diff --git a/glue/ligolw/utils/ligolw_sqlite.py b/glue/ligolw/utils/ligolw_sqlite.py
index <HASH>..<HASH> 100644
--- a/glue/ligolw/utils/ligolw_sqlite.py
+++ b/glue/ligolw/utils/ligolw_sqlite.py
@@ -290,7 +290,7 @@ def insert_from_urls(urls, contenthandler, **kwargs):
# done. build indexes
#
- dbtables.build_indexes(kwargs["contenthandler"].connection, verbose)
+ dbtables.build_indexes(contenthandler.connection, verbose)
# | fix thinko cruft in ligolw_sqlite.py | gwastro_pycbc-glue | train | py |
cef0b500b1a6519fb737e8c9ce1576c3b0863b1d | diff --git a/ontrack-web/src/app/view/view.home.js b/ontrack-web/src/app/view/view.home.js
index <HASH>..<HASH> 100644
--- a/ontrack-web/src/app/view/view.home.js
+++ b/ontrack-web/src/app/view/view.home.js
@@ -70,6 +70,8 @@ angular.module('ot.view.home', [
" promotionLevel {\n" +
" id\n" +
" name\n" +
+ " image\n" +
+ " _image\n" +
" }\n" +
" }\n" +
" }\n" + | #<I> Project favourites - promotion image | nemerosa_ontrack | train | js |
63876ff3aa58c2e265a0957830afea04a0637ce0 | diff --git a/lib/req.js b/lib/req.js
index <HASH>..<HASH> 100644
--- a/lib/req.js
+++ b/lib/req.js
@@ -55,12 +55,15 @@ Object.defineProperty(pinoReqProto, rawSymbol, {
function reqSerializer (req) {
var connection = req.connection
const _req = Object.create(pinoReqProto)
+ // req.info is for hapi compat.
_req.id = (typeof req.id === 'function' ? req.id() : (req.id || (req.info && req.info.id))) || ''
_req.method = req.method
- _req.url = req.url.path || req.url
+ // req.url.path is for hapi compat.
+ _req.url = req.url ? (req.url.path || req.url) : undefined
_req.headers = req.headers
_req.remoteAddress = connection && connection.remoteAddress
_req.remotePort = connection && connection.remotePort
+ // req.raw is for hapi compat/equivalence
_req.raw = req.raw || req
return _req
} | hapi <I> support comments | pinojs_pino-std-serializers | train | js |
24d7e0c8d5adcff5ad889f3aa3b328e7442aedc2 | diff --git a/src/pipe.js b/src/pipe.js
index <HASH>..<HASH> 100644
--- a/src/pipe.js
+++ b/src/pipe.js
@@ -165,12 +165,12 @@ export default (auth_token) => {
flexio.http().post('/processes/'+process_eid+'/run')
.then(response => {
- var obj = _.get(response, 'data', {})
+ var obj2 = _.get(response, 'data', {})
util.debug.call(this, 'Process Complete.')
this.running = false
if (typeof callback == 'function')
- callback.call(this, null, obj)
+ callback.call(this, null, obj2)
})
})
.catch(error => { | Pipe run now returns a stream output instead of the process JSON. | flexiodata_flexio-sdk-js | train | js |
44f0a72a49fc2d3ca40d050a4ae32463bc666616 | diff --git a/invenio_communities/requests/resolver.py b/invenio_communities/requests/resolver.py
index <HASH>..<HASH> 100644
--- a/invenio_communities/requests/resolver.py
+++ b/invenio_communities/requests/resolver.py
@@ -13,8 +13,8 @@ is registered in Invenio-Requests via the "invenio_requests.entity_resolvers"
entry point.
"""
-from invenio_requests.resolvers.default import RecordResolver
-from invenio_requests.resolvers.default.records import RecordPKProxy
+from invenio_records_resources.references.resolvers.records import \
+ RecordPKProxy, RecordResolver
from ..communities.records.api import Community
from ..communities.services.permissions import CommunityNeed
diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -64,7 +64,7 @@ setup_requires = [
install_requires = [
'invenio-files-rest>=1.3.0',
'invenio-mail>=1.0.2',
- 'invenio-requests>=0.2.2,<0.3.0',
+ 'invenio-requests>=0.2.3,<0.3.0',
'invenio-vocabularies>=0.10.2,<0.11.0',
] | requests: fix imports according to requests refactoring
* also bump the requests dependency to the version where the refactoring
happened | inveniosoftware_invenio-communities | train | py,py |
2ce13dcd48569485916a8d5a4bd805fe611c132f | diff --git a/src/core/textures/Texture.js b/src/core/textures/Texture.js
index <HASH>..<HASH> 100644
--- a/src/core/textures/Texture.js
+++ b/src/core/textures/Texture.js
@@ -317,7 +317,14 @@ Texture.fromCanvas = function (canvas, scaleMode)
*/
Texture.fromVideo = function (video, scaleMode)
{
- return new Texture(VideoBaseTexture.fromVideo(video, scaleMode));
+ if (typeof video === 'string')
+ {
+ return Texture.fromVideoUrl(video, scaleMode);
+ }
+ else
+ {
+ return new Texture(VideoBaseTexture.fromVideo(video, scaleMode));
+ }
};
/**
@@ -325,7 +332,7 @@ Texture.fromVideo = function (video, scaleMode)
*
* @static
* @param videoUrl {string}
- * @param scaleMode {number} See {{#crossLink "PIXI/scaleModes:property"}}scaleModes{{/crossLink}} for possible values
+ * @param scaleMode {number} See {{@link SCALE_MODES}} for possible values
* @return {Texture} A Texture
*/
Texture.fromVideoUrl = function (videoUrl, scaleMode) | Texture.fromVideo should allow urls like other from* methods | pixijs_pixi.js | train | js |
29ae7768a8ee8b0408f7cf9a0523878e72ea3328 | diff --git a/cohorts/load.py b/cohorts/load.py
index <HASH>..<HASH> 100644
--- a/cohorts/load.py
+++ b/cohorts/load.py
@@ -1297,6 +1297,10 @@ def compare_provenance(
-----------
Number of discrepancies (0: None)
"""
+ ## if either this or other items is null, return 0
+ if (not this_provenance or not other_provenance):
+ return 0
+
this_items = set(this_provenance.items())
other_items = set(other_provenance.items())
diff --git a/test/test_provenance.py b/test/test_provenance.py
index <HASH>..<HASH> 100644
--- a/test/test_provenance.py
+++ b/test/test_provenance.py
@@ -17,6 +17,8 @@ from __future__ import print_function
from nose.tools import eq_, ok_
import pandas as pd
from os import path
+import os
+from shutil import rmtree
import cohorts
import warnings
@@ -118,6 +120,11 @@ def test_summarize_provenance():
ok_(not cohort.summarize_provenance_per_cache()[cache_name])
ok_(len(w)>0)
+ ## now test whether deleting contents of cache_dir causes an error
+ dirlist = [f for f in os.listdir(cache_dir)]
+ for dir in dirlist:
+ rmtree(path.join(cache_dir, dir))
+ summary = cohort.summarize_provenance()
finally:
if cohort is not None:
cohort.clear_caches() | Fix minor bug in summarize_provenance (#<I>)
* first attempt to fix issue #<I>
* add test case for cache being empty
* fix bug
* attempt to fix test to capture error-causing scenario
* fix formatting | hammerlab_cohorts | train | py,py |
20a4175d9152ff65873f1212400a949478946bef | diff --git a/bugtool/cmd/configuration.go b/bugtool/cmd/configuration.go
index <HASH>..<HASH> 100644
--- a/bugtool/cmd/configuration.go
+++ b/bugtool/cmd/configuration.go
@@ -302,6 +302,7 @@ func copyCiliumInfoCommands(cmdDir string, k8sPods []string) []string {
"cilium ip list -n -o json",
"cilium map list --verbose",
"cilium service list",
+ "cilium recorder list",
"cilium status --verbose",
"cilium identity list",
"cilium-health status", | cilium, bugtool: add cilium recorder list to sysdump
For ease of introspection on user issues, add `cilium recorder list` to
the bug tool dump. We already have `cilium bpf recorder list` in there
from BPF side, thus this complements the agent view. | cilium_cilium | train | go |
3e57fe0396c73c9ae892f612534544d8fcbaf4a5 | diff --git a/tasks/iog.js b/tasks/iog.js
index <HASH>..<HASH> 100644
--- a/tasks/iog.js
+++ b/tasks/iog.js
@@ -16,18 +16,22 @@ module.exports = function(grunt) {
grunt.registerTask('iog', 'Logging bridge for websocket clients', function() {
var options = this.options({
- port : 8888
- });
+ port : 8888
+ }),
+ io = helpers.startServer(undefined, options.port),
+ loggers = {};
var done = this.async();
- var io = helpers.startServer(undefined, options.port);
io.set('log level',1); // warnings only
logger.debug('Connected on port ' + options.port);
io.sockets.on('connection', function (socket) {
socket.on('iog', function (data) {
- logger[data.level].apply(logger,data.args);
+ var file = data.caller.file;
+ var logger = loggers[file] ? loggers[file] : loggers[file] = log4js.getLogger(file);
+ var location = ['l', data.caller.line, ':', data.caller.col].join('');
+ logger[data.level].apply(logger,[location].concat(data.args));
});
});
}); | adding location logic, splitting loggers by file | jsoverson_rcl | train | js |
f447a322c98595e0c96c6478b1e34cda5413863b | diff --git a/test/test.resolve.js b/test/test.resolve.js
index <HASH>..<HASH> 100644
--- a/test/test.resolve.js
+++ b/test/test.resolve.js
@@ -279,7 +279,6 @@ tape( 'for some downstream errors, rate limit information may not be available',
t.equal( data, null, 'no response data' );
- console.log( info );
t.ok( info, 'has rate limit info arg' );
t.ok( info.remaining !== info.remaining, 'remaining is NaN' );
t.ok( info.reset !== info.reset, 'reset is NaN' );
@@ -404,9 +403,7 @@ tape( 'the function returns paginated results as a flat object array', function
resolve( opts, done );
function done( error, data, info ) {
- t.equal( error, null, 'error is null' );
t.deepEqual( data, expected, 'expected response data' );
- t.ok( info, 'returned rate limit info' );
t.end();
}
}); | Remove console.log and remove unnecessary tests | kgryte_github-get | train | js |
33920712bf460e365a2250a9b2db52e85f6f6dc1 | diff --git a/src/Form/Eloquent/Uploads/Thumbnails/Thumbnail.php b/src/Form/Eloquent/Uploads/Thumbnails/Thumbnail.php
index <HASH>..<HASH> 100644
--- a/src/Form/Eloquent/Uploads/Thumbnails/Thumbnail.php
+++ b/src/Form/Eloquent/Uploads/Thumbnails/Thumbnail.php
@@ -165,7 +165,7 @@ class Thumbnail
});
}
- $sourceImg->save($thumbnailDisk->path($thumbnailPath), $this->quality);
+ $thumbnailDisk->put($thumbnailPath, $sourceImg->stream(null, $this->quality));
} catch(FileNotFoundException $ex) {
return null;
@@ -175,7 +175,7 @@ class Thumbnail
}
}
- return $thumbnailDisk->url($thumbnailPath) . ($this->appendTimestamp ? "?" . filectime($thumbnailDisk->path($thumbnailPath)) : "");
+ return $thumbnailDisk->url($thumbnailPath) . ($this->appendTimestamp ? "?" . $thumbnailDisk->lastModified($thumbnailPath) : "");
}
/** | Revert thumbnail creation to work with s3 code<I>/sharp-dev#<I> | code16_sharp | train | php |
c658bef0cc6d68cb516c4b7cff3925d5d9daf61d | diff --git a/lib/image/png.js b/lib/image/png.js
index <HASH>..<HASH> 100644
--- a/lib/image/png.js
+++ b/lib/image/png.js
@@ -12,6 +12,8 @@ class PNGImage {
}
embed(document) {
+ let dataDecoded = false;
+
this.document = document;
if (this.obj) {
return;
@@ -76,13 +78,20 @@ class PNGImage {
} else if (this.image.transparency.indexed) {
// Create a transparency SMask for the image based on the data
// in the PLTE and tRNS sections. See below for details on SMasks.
+ dataDecoded = true;
return this.loadIndexedAlphaChannel();
} else if (hasAlphaChannel) {
// For PNG color types 4 and 6, the transparency data is stored as a alpha
// channel mixed in with the main image data. Separate this data out into an
// SMask object and store it separately in the PDF.
+ dataDecoded = true;
return this.splitAlphaChannel();
}
+
+ if ((this.image.interlaceMethod === 1) & !dataDecoded) {
+ return this.decodeData();
+ }
+
this.finalize();
}
@@ -152,6 +161,13 @@ class PNGImage {
return this.finalize();
});
}
+
+ decodeData() {
+ this.image.decodePixels(pixels => {
+ this.imgData = zlib.deflateSync(pixels);
+ this.finalize();
+ });
+ }
}
export default PNGImage; | png: decode pixels when image is interlaced | foliojs_pdfkit | train | js |
25dec5deeb8d905dd53631f6d3d387c2c9b67e5e | diff --git a/core/src/main/java/com/orientechnologies/orient/core/db/object/ODatabaseObjectTx.java b/core/src/main/java/com/orientechnologies/orient/core/db/object/ODatabaseObjectTx.java
index <HASH>..<HASH> 100644
--- a/core/src/main/java/com/orientechnologies/orient/core/db/object/ODatabaseObjectTx.java
+++ b/core/src/main/java/com/orientechnologies/orient/core/db/object/ODatabaseObjectTx.java
@@ -202,10 +202,10 @@ public class ODatabaseObjectTx extends ODatabaseWrapperAbstract<ODatabaseDocumen
if (pojo == null) {
try {
pojo = entityManager.createPojo(record.getClassName());
- OObjectSerializerHelper.fromStream(record, pojo, getEntityManager(), this);
-
registerPojo(pojo, record);
+ OObjectSerializerHelper.fromStream(record, pojo, getEntityManager(), this);
+
} catch (Exception e) {
throw new OConfigurationException("Can't retrieve pojo from the record " + record, e);
} | Registered early the pojo created to avoid circular reference problems. | orientechnologies_orientdb | train | java |
eb11120d10a9787f6931dc22ee6563b5a2f0eaf7 | diff --git a/lib/navigo.js b/lib/navigo.js
index <HASH>..<HASH> 100644
--- a/lib/navigo.js
+++ b/lib/navigo.js
@@ -222,12 +222,13 @@ return /******/ (function(modules) { // webpackBootstrap
link.addEventListener('click', function (e) {
var location = link.getAttribute('href');
- link.hasListenerAttached = true;
+
if (!self._destroyed) {
e.preventDefault();
self.navigate(clean(location));
}
});
+ link.hasListenerAttached = true;
}
});
},
@@ -315,4 +316,4 @@ return /******/ (function(modules) { // webpackBootstrap
/******/ ])
});
;
-//# sourceMappingURL=navigo.js.map
\ No newline at end of file
+//# sourceMappingURL=navigo.js.map | Fix issue where listeners applied more than once
`link.hasListenerAttached` was being assigned inside of the event listener, which means that it was only set to true after the link is clicked. This fixes that problem in my code anyway. | krasimir_navigo | train | js |
1210f66f95e2bd873fbe30411cb3debf7f26e1c6 | diff --git a/test/helpers/asserts.js b/test/helpers/asserts.js
index <HASH>..<HASH> 100644
--- a/test/helpers/asserts.js
+++ b/test/helpers/asserts.js
@@ -14,7 +14,7 @@ function comparePolygons(a, b){
let start = a.vertices[0];
let index = b.vertices.findIndex(v => {
if (!v) {return false;}
-
+
return v._x === start._x && v._y === start._y && v._z === start._z;
});
if (index === -1) {
@@ -38,7 +38,7 @@ function assertSameGeometry(t, a, b, failMessage) {
if (!containsCSG(a, b) || !containsCSG(b, a)) {
failMessage = failMessage == undefined ? 'CSG do not have the same geometry' : failMessage;
t.fail(failMessage);
- }
+ }else{ t.pass()}
}
// a contains b if b polygons are also found in a
@@ -59,4 +59,4 @@ function containsCSG(a, b){
module.exports = {
assertSameGeometry: assertSameGeometry,
comparePolygons: comparePolygons
-};
\ No newline at end of file
+}; | fix(asserts): fixed issue with asserts in latest ava | jscad_csg.js | train | js |
42659d5cf914c03e0fb9454f85193cdc096cc62d | diff --git a/app/models/no_cms/menus/menu.rb b/app/models/no_cms/menus/menu.rb
index <HASH>..<HASH> 100644
--- a/app/models/no_cms/menus/menu.rb
+++ b/app/models/no_cms/menus/menu.rb
@@ -1,6 +1,7 @@
module NoCms::Menus
class Menu < ActiveRecord::Base
translates :name
+ accepts_nested_attributes_for :translations
has_many :menu_items, dependent: :destroy, inverse_of: :menu, class_name: "::NoCms::Menus::MenuItem"
accepts_nested_attributes_for :menu_items, allow_destroy: true
diff --git a/app/models/no_cms/menus/menu_item.rb b/app/models/no_cms/menus/menu_item.rb
index <HASH>..<HASH> 100644
--- a/app/models/no_cms/menus/menu_item.rb
+++ b/app/models/no_cms/menus/menu_item.rb
@@ -7,6 +7,7 @@ module NoCms::Menus
:nofollow, :noreferrer, :prefetch, :prev, :search, :tag]
translates :name, :external_url, :draft, :leaf_with_draft
+ accepts_nested_attributes_for :translations
delegate :leaf_with_draft?, to: :translation | Permit nested attributes on translations. | simplelogica_nocms-menus | train | rb,rb |
e8307ba7baef22311904f07130b88b80866df133 | diff --git a/lib/beggar/base.rb b/lib/beggar/base.rb
index <HASH>..<HASH> 100644
--- a/lib/beggar/base.rb
+++ b/lib/beggar/base.rb
@@ -8,7 +8,7 @@ module Beggar
end
def progress
- "#{CurrentMonth.days_progression}%"
+ "#{CurrentMonth.weekdays_progression}%"
end
def worked_hours
diff --git a/lib/beggar/current_month.rb b/lib/beggar/current_month.rb
index <HASH>..<HASH> 100644
--- a/lib/beggar/current_month.rb
+++ b/lib/beggar/current_month.rb
@@ -17,7 +17,7 @@ module Beggar
weekdays_until_today * 8.0
end
- def days_progression
+ def weekdays_progression
(weekdays_until_today * 100.0 / weekdays).round
end | Rename days_progression to weekdays_progression | brtjkzl_beggar | train | rb,rb |
4eaeafa876d95f6736af2eb43b96fe0278b87bf7 | diff --git a/lib/html-proofer/version.rb b/lib/html-proofer/version.rb
index <HASH>..<HASH> 100644
--- a/lib/html-proofer/version.rb
+++ b/lib/html-proofer/version.rb
@@ -1,3 +1,3 @@
module HTMLProofer
- VERSION = '3.6.0'.freeze
+ VERSION = '3.7.0'.freeze
end | update gem version to <I> | gjtorikian_html-proofer | train | rb |
b42f1deeb4689da5a2603d8f782fccd05b1ca32c | diff --git a/src/Anonym/Facades/Migration.php b/src/Anonym/Facades/Migration.php
index <HASH>..<HASH> 100644
--- a/src/Anonym/Facades/Migration.php
+++ b/src/Anonym/Facades/Migration.php
@@ -19,6 +19,12 @@ use Anonym\Patterns\Facade;
class Migration extends Facade
{
+ /**
+ * get the migration facade
+ *
+ *
+ * @return MigrationManager
+ */
protected static function getFacadeClass()
{ | added comment lines to get facade class method | AnonymPHP_Anonym-Library | train | php |
2d02c07071ae847d53fb8b22f48b8f828d5b7ba8 | diff --git a/core/src/main/java/me/prettyprint/hector/api/beans/AbstractComposite.java b/core/src/main/java/me/prettyprint/hector/api/beans/AbstractComposite.java
index <HASH>..<HASH> 100644
--- a/core/src/main/java/me/prettyprint/hector/api/beans/AbstractComposite.java
+++ b/core/src/main/java/me/prettyprint/hector/api/beans/AbstractComposite.java
@@ -450,6 +450,9 @@ public abstract class AbstractComposite extends AbstractList<Object> implements
@SuppressWarnings({ "unchecked" })
private static Collection<?> flatten(Collection<?> c) {
+ if (c instanceof AbstractComposite) {
+ return ((AbstractComposite) c).getComponents();
+ }
boolean hasCollection = false;
for (Object o : c) {
if (o instanceof Collection) { | AbstractComponent.addAll() etc. now do the right thing if called with a composite | hector-client_hector | train | java |
b23812d14ccfe1ac4f4e876a62b9507b007e382e | diff --git a/gnupg/parsers.py b/gnupg/parsers.py
index <HASH>..<HASH> 100644
--- a/gnupg/parsers.py
+++ b/gnupg/parsers.py
@@ -275,6 +275,7 @@ def _is_allowed(input):
['--list-keys', '--list-key', '--fixed-list-mode',
'--list-secret-keys', '--list-public-keys',
'--list-packets', '--with-colons',
+ '--no-show-photos',
'--delete-keys', '--delete-secret-keys',
'--encrypt', '--encrypt-files',
'--decrypt', '--decrypt-files', | Add option '--no-show-photos' to allowed options. | isislovecruft_python-gnupg | train | py |
c6ab27fe69571a869d6fc343b8062b8feaa384f9 | diff --git a/lib/dumper/stack.rb b/lib/dumper/stack.rb
index <HASH>..<HASH> 100644
--- a/lib/dumper/stack.rb
+++ b/lib/dumper/stack.rb
@@ -54,10 +54,6 @@ module Dumper
DUMP_TOOLS[name] ||= `which #{name}`.chomp
end
- def dump_tool_installed?(name)
- !dump_tool(name).empty?
- end
-
# Dispatcher
def unicorn?
defined?(::Unicorn::HttpServer) && find_instance_in_object_space(::Unicorn::HttpServer)
@@ -68,8 +64,8 @@ module Dumper
end
def thin?
- # defined?(::Thin::Server) && find_instance_in_object_space(Thin::Server)
- @rackup and @rackup.server.to_s.demodulize == 'Thin'
+ defined?(::Thin::Server) && find_instance_in_object_space(::Thin::Server)
+ # @rackup and @rackup.server.to_s.demodulize == 'Thin'
end
def mongrel? | Thin may run out of rack context. | dumperhq_dumper | train | rb |
121be30d1d04be69d62959f960bd48546150ebff | diff --git a/instance/address.go b/instance/address.go
index <HASH>..<HASH> 100644
--- a/instance/address.go
+++ b/instance/address.go
@@ -216,7 +216,7 @@ func SelectInternalAddress(addresses []Address, machineLocal bool) string {
}
// SelectInternalHostPort picks one HostPort from a slice that can be
-// used as an endpoint for juju internal communication and returns it
+// used as an endpoint for juju internal communication and returns it
// in its NetAddr form.
// If there are no suitable addresses, the empty string is returned.
func SelectInternalHostPort(hps []HostPort, machineLocal bool) string { | instance/address: whitespace fix required by gofmt | juju_juju | train | go |
06e9a5709b502bbd9f0329dde65197aea24507c6 | diff --git a/test/ConfigTestCases.test.js b/test/ConfigTestCases.test.js
index <HASH>..<HASH> 100644
--- a/test/ConfigTestCases.test.js
+++ b/test/ConfigTestCases.test.js
@@ -226,6 +226,7 @@ describe("ConfigTestCases", () => {
);
if (exportedTests < filesCount)
return done(new Error("No tests exported by test case"));
+ if (testConfig.afterExecute) testConfig.afterExecute();
process.nextTick(done);
});
});
diff --git a/test/configCases/hash-length/output-filename/test.config.js b/test/configCases/hash-length/output-filename/test.config.js
index <HASH>..<HASH> 100644
--- a/test/configCases/hash-length/output-filename/test.config.js
+++ b/test/configCases/hash-length/output-filename/test.config.js
@@ -44,5 +44,8 @@ module.exports = {
}
return "./" + filename;
+ },
+ afterExecute: () => {
+ delete global.webpackJsonp;
}
}; | get rid of webpackJsonp global leak | webpack_webpack | train | js,js |
3a39c9ce91b72b8c761094282c88dda0e701336f | diff --git a/enumchoicefield/forms.py b/enumchoicefield/forms.py
index <HASH>..<HASH> 100644
--- a/enumchoicefield/forms.py
+++ b/enumchoicefield/forms.py
@@ -16,7 +16,11 @@ class EnumSelect(Widget):
self.members = members
def render(self, name, value, attrs=None):
- attrs = attrs.copy()
+ if attrs is None:
+ attrs = {}
+ else:
+ attrs = attrs.copy()
+
attrs['name'] = name
final_attrs = self.build_attrs(attrs)
output = [format_html('<select{}>', flatatt(final_attrs))] | Handle the case of attrs being None | timheap_django-enumchoicefield | train | py |
808b980962c40ab1080096c898ab3538900d2d8b | diff --git a/plugins/sigma.parseGexf.js b/plugins/sigma.parseGexf.js
index <HASH>..<HASH> 100755
--- a/plugins/sigma.parseGexf.js
+++ b/plugins/sigma.parseGexf.js
@@ -142,6 +142,7 @@ sigma.publicPrototype.parseGexf = function(gexfPath) {
var weight = edgeNode.getAttribute('weight');
if(weight!=undefined){
edge['weight'] = weight;
+ edge['size'] = weight;
}
var attvalueNodes = edgeNode.getElementsByTagName('attvalue'); | if edge weight is set, set size attribute to this value to make setting minEdgeSize and maxEdgeSize effective | jacomyal_sigma.js | train | js |
f1d6819da4f994aa931d4089c6a0711fb7db5d9a | diff --git a/code/MSSQLDatabase.php b/code/MSSQLDatabase.php
index <HASH>..<HASH> 100644
--- a/code/MSSQLDatabase.php
+++ b/code/MSSQLDatabase.php
@@ -41,6 +41,13 @@ class MSSQLDatabase extends SS_Database {
* If false use the sqlsrv_... functions
*/
protected $mssql = null;
+
+ /**
+ * Stores the affected rows of the last query.
+ * Used by sqlsrv functions only, as sqlsrv_rows_affected
+ * accepts a result instead of a database handle.
+ */
+ protected $lastAffectedRows;
/**
* Words that will trigger an error if passed to a SQL Server fulltext search
@@ -211,6 +218,7 @@ class MSSQLDatabase extends SS_Database {
$handle = mssql_query($sql, $this->dbConn);
} else {
$handle = sqlsrv_query($this->dbConn, $sql);
+ if($handle) $this->lastAffectedRows = sqlsrv_rows_affected($handle);
}
if(isset($_REQUEST['showqueries'])) {
@@ -810,7 +818,7 @@ class MSSQLDatabase extends SS_Database {
if($this->mssql) {
return mssql_rows_affected($this->dbConn);
} else {
- return sqlsrv_rows_affected($this->dbConn);
+ return $this->lastAffectedRows;
}
} | MINOR Partially reverted changes to MSSQLDatabase::affectedRows() in r<I> | silverstripe_silverstripe-mssql | train | php |
8b5e36e9b008fd058aab568bfa9cc9ae89dd49da | diff --git a/src/js/pannellum.js b/src/js/pannellum.js
index <HASH>..<HASH> 100644
--- a/src/js/pannellum.js
+++ b/src/js/pannellum.js
@@ -2399,6 +2399,7 @@ this.setPitch = function(pitch, animated, callback, callbackArgs) {
} else {
config.pitch = pitch;
}
+ latestInteraction = Date.now();
animateInit();
return this;
};
@@ -2467,6 +2468,7 @@ this.setYaw = function(yaw, animated, callback, callbackArgs) {
} else {
config.yaw = yaw;
}
+ latestInteraction = Date.now();
animateInit();
return this;
};
@@ -2528,6 +2530,7 @@ this.setHfov = function(hfov, animated, callback, callbackArgs) {
} else {
setHfov(hfov);
}
+ latestInteraction = Date.now();
animateInit();
return this;
}; | When setting view via API, reset timer for auto rotate (fixes #<I>). | mpetroff_pannellum | train | js |
781a5d3d042577cc1e3bdea433c30392456aef4c | diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -25,7 +25,7 @@ setup(
tests_require=["nose==1.2.1", "pinocchio==0.3.1", unittest2_module],
classifiers=[
'Development Status :: 4 - Beta',
- 'Intended Audience :: Developers'
+ 'Intended Audience :: Developers',
'License :: OSI Approved :: MIT License',
'Topic :: Software Development :: Libraries',
], | Add missing comma to classifiers list in setup.py
This typo was yielding an invalid classifier. | thomasw_querylist | train | py |
f9063cf4f59c25028f7b8d60576a4fee9daae293 | diff --git a/rackable.rb b/rackable.rb
index <HASH>..<HASH> 100644
--- a/rackable.rb
+++ b/rackable.rb
@@ -2,6 +2,8 @@ module Rackable
attr_reader :rack
def call(env)
+ allowed_methods = [:get, :put, :post, :delete]
+
@rack = Struct.new(:env, :request, :response, :header, :query, :data).new
rack.env = env
@@ -22,10 +24,11 @@ module Rackable
status, body = catch(:halt) do
begin
+ raise NoMethodError unless allowed_methods.include? method
[200, send(method, *args)]
rescue NoMethodError
- rack.header['Allow'] = [:get, :post, :put, :delete].delete_if { |meth|
+ rack.header['Allow'] = allowed_methods.delete_if { |meth|
!respond_to?(meth)
}.tap {|a|
a.unshift 'HEAD' if respond_to? :get
@@ -140,6 +143,11 @@ if $0 =~ /bacon$/
get '/fail'
last_response.status.should == 400
end
+
+ it 'prevents calling methods other than the allowed ones' do
+ request '/%22foo%22', "REQUEST_METHOD" => "INSTANCE_EVAL"
+ last_response.status.should == 405
+ end
end
end | security fix (<URL>) [reported by tobi] | madx_roy | train | rb |
2061704e73555c97afdaae10f5494b693ad98ded | diff --git a/protocol/carbon/carbonlistener_test.go b/protocol/carbon/carbonlistener_test.go
index <HASH>..<HASH> 100644
--- a/protocol/carbon/carbonlistener_test.go
+++ b/protocol/carbon/carbonlistener_test.go
@@ -14,6 +14,7 @@ import (
"sync/atomic"
"testing"
"time"
+ "runtime"
)
var errDeadline = errors.New("nope")
@@ -65,6 +66,7 @@ func TestCarbonForwarderNormal(t *testing.T) {
for err == nil {
// Eventually this should timeout b/c of the above context
err = forwarder.AddDatapoints(ctx, []*datapoint.Datapoint{dptest.DP()})
+ time.Sleep(time.Millisecond)
}
tailErr := errors.Tail(err).(net.Error) | Make carbon forwarder test more friendly to other procs | signalfx_gateway | train | go |
041fafc763810125faf7d4a2fb3d53a88f141d27 | diff --git a/namespaces/exec.go b/namespaces/exec.go
index <HASH>..<HASH> 100644
--- a/namespaces/exec.go
+++ b/namespaces/exec.go
@@ -133,7 +133,7 @@ func DefaultCreateCommand(container *libcontainer.Config, console, rootfs, dataP
}
*/
- command := exec.Command(init, append([]string{"init"}, args...)...)
+ command := exec.Command(init, append([]string{"init", "--"}, args...)...)
// make sure the process is executed inside the context of the rootfs
command.Dir = rootfs
command.Env = append(os.Environ(), env...) | DefaultCreateCommand supports command w/ flags
namespaces.DefaultCreateCommand prepends the user-supplied command to
execute with "--", so that "nsinit init" does not attempt to interpret
it.
Docker-DCO-<I>- | opencontainers_runc | train | go |
4a5d5919758e8d54f45001519474181ec6fce738 | diff --git a/MessageBag.php b/MessageBag.php
index <HASH>..<HASH> 100755
--- a/MessageBag.php
+++ b/MessageBag.php
@@ -146,7 +146,9 @@ class MessageBag implements Arrayable, Countable, Jsonable, JsonSerializable, Me
{
$messages = is_null($key) ? $this->all($format) : $this->get($key, $format);
- return head(array_flatten($messages)) ?: '';
+ $firstMessage = array_first($messages, null, '');
+
+ return is_array($firstMessage) ? array_first($firstMessage) : $firstMessage;
}
/** | Add ability to use first() and has() for implicit keys in message bag | illuminate_support | train | php |
05d7b17ab5d39d6eff04c1941696eb7aea2a5dd0 | diff --git a/arch/zx48k/translator.py b/arch/zx48k/translator.py
index <HASH>..<HASH> 100644
--- a/arch/zx48k/translator.py
+++ b/arch/zx48k/translator.py
@@ -170,8 +170,7 @@ class Translator(TranslatorVisitor):
yield node.operand
assert node.operand.type_.is_basic
assert node.type_.is_basic
- self.emit('cast', node.t, self.TSUFFIX(node.operand.type_.type_),
- self.TSUFFIX(node.type_.type_), node.operand.t)
+ self.ic_cast(node.t, node.operand.type_, node.type_, node.operand.t)
def visit_FUNCDECL(self, node):
# Delay emission of functions until the end of the main code | Refactorize TYPECAST visit | boriel_zxbasic | train | py |
bd712293f27b06f0ef2f8b82cb9d75dd276d4d6f | diff --git a/src/Sylius/Bundle/CoreBundle/Application/Kernel.php b/src/Sylius/Bundle/CoreBundle/Application/Kernel.php
index <HASH>..<HASH> 100644
--- a/src/Sylius/Bundle/CoreBundle/Application/Kernel.php
+++ b/src/Sylius/Bundle/CoreBundle/Application/Kernel.php
@@ -31,12 +31,12 @@ use Webmozart\Assert\Assert;
class Kernel extends HttpKernel
{
- public const VERSION = '1.6.0-DEV';
+ public const VERSION = '1.6.0-ALPHA.2';
public const VERSION_ID = '10600';
public const MAJOR_VERSION = '1';
public const MINOR_VERSION = '6';
public const RELEASE_VERSION = '0';
- public const EXTRA_VERSION = 'DEV';
+ public const EXTRA_VERSION = 'ALPHA.2';
public function __construct(string $environment, bool $debug)
{ | Change application's version to <I>-ALPHA<I> | Sylius_Sylius | train | php |
cea57097b933ca3a02e81ce6f83b670ffd244e2d | diff --git a/core/graph.py b/core/graph.py
index <HASH>..<HASH> 100644
--- a/core/graph.py
+++ b/core/graph.py
@@ -61,7 +61,6 @@ def plotFCM(data, channel_names, transform=(None, None), plot2d_type='dot2d', **
if len(channelIndexList) == 1:
# 1d so histogram plot
ch1i = channelIndexList[0]
- plt.xlabel(channel_names[0])
pHandle = plt.hist(data[:, ch1i], **kwargs)
elif len(channelIndexList) == 2:
@@ -77,9 +76,6 @@ def plotFCM(data, channel_names, transform=(None, None), plot2d_type='dot2d', **
else:
raise Exception('Not a valid plot type')
- # Label the plot
- plt.xlabel(channel_names[0])
- plt.ylabel(channel_names[1])
return pHandle | removed automatic labeling of axis | eyurtsev_FlowCytometryTools | train | py |
17c443cd96ff858d3e051abab70cad93f447293a | diff --git a/internal/examples/streaming/client/main.go b/internal/examples/streaming/client/main.go
index <HASH>..<HASH> 100644
--- a/internal/examples/streaming/client/main.go
+++ b/internal/examples/streaming/client/main.go
@@ -26,7 +26,6 @@ import (
"fmt"
"log"
"os"
- "time"
"go.uber.org/yarpc"
"go.uber.org/yarpc/internal/examples/streaming"
@@ -56,8 +55,11 @@ func do() error {
}
defer dispatcher.Stop()
- ctx, cancel := context.WithTimeout(context.Background(), time.Second)
+ // Specifying a deadline on the context affects the entire stream. As this is
+ // generally not the desired behavior, we use a cancelable context instead.
+ ctx, cancel := context.WithCancel(context.Background())
defer cancel()
+
stream, err := client.HelloThere(ctx, yarpc.WithHeader("test", "testtest"))
if err != nil {
return fmt.Errorf("failed to create stream: %s", err.Error()) | Remove deadline from stream example (#<I>)
Previously, this example code would cause context deadline exceeded
errors since the deadline on the context applies to the entire
stream. This removes the timeout on the context, instead replacing it
with a cancelable context; the cancelable context can be used to
cancel the stream as needed. | yarpc_yarpc-go | train | go |
8793b83ccf50094b502e268c4849510b1a8c296c | diff --git a/tests/TestCase/Routing/Middleware/RoutingMiddlewareTest.php b/tests/TestCase/Routing/Middleware/RoutingMiddlewareTest.php
index <HASH>..<HASH> 100644
--- a/tests/TestCase/Routing/Middleware/RoutingMiddlewareTest.php
+++ b/tests/TestCase/Routing/Middleware/RoutingMiddlewareTest.php
@@ -146,7 +146,14 @@ class RoutingMiddlewareTest extends TestCase
'action' => 'index',
'_method' => 'PATCH'
]);
- $request = ServerRequestFactory::fromGlobals(['REQUEST_URI' => '/articles-patch'], null, ['_method' => 'PATCH']);
+ $request = ServerRequestFactory::fromGlobals(
+ [
+ 'REQUEST_METHOD' => 'POST',
+ 'REQUEST_URI' => '/articles-patch'
+ ],
+ null,
+ ['_method' => 'PATCH']
+ );
$response = new Response();
$next = function ($req, $res) {
$expected = [ | Updated REQUEST_METHOD to be POST | cakephp_cakephp | train | php |
94e033abb64697607d6383f0565c8f57736b040a | diff --git a/Swat/SwatTextarea.php b/Swat/SwatTextarea.php
index <HASH>..<HASH> 100644
--- a/Swat/SwatTextarea.php
+++ b/Swat/SwatTextarea.php
@@ -49,6 +49,9 @@ class SwatTextarea extends SwatInputControl implements SwatState
if (!$this->visible)
return;
+ // textarea tags cannot be self-closing
+ $value = ($this->value === null) ? '' : $this->value;
+
$textarea_tag = new SwatHtmlTag('textarea');
$textarea_tag->name = $this->id;
$textarea_tag->id = $this->id;
@@ -57,7 +60,7 @@ class SwatTextarea extends SwatInputControl implements SwatState
// a textarea for XHTML strict.
$textarea_tag->rows = $this->rows;
$textarea_tag->cols = $this->cols;
- $textarea_tag->setContent($this->value);
+ $textarea_tag->setContent($value, 'text/plain');
$textarea_tag->display();
} | Don't self-close textarea tags.
svn commit r<I> | silverorange_swat | train | php |
c853e18ecfc1000ddcb3400dc0ab616a6e80c8ef | diff --git a/cdm/src/main/java/ucar/nc2/NetcdfFile.java b/cdm/src/main/java/ucar/nc2/NetcdfFile.java
index <HASH>..<HASH> 100644
--- a/cdm/src/main/java/ucar/nc2/NetcdfFile.java
+++ b/cdm/src/main/java/ucar/nc2/NetcdfFile.java
@@ -1916,14 +1916,19 @@ public class NetcdfFile implements ucar.nc2.util.cache.FileCacheable, Closeable
variables = new ArrayList<>();
gattributes = new ArrayList<>();
dimensions = new ArrayList<>();
- if (rootGroup == null)
- rootGroup = makeRootGroup(); // only make the root group once
+ rootGroup = makeRootGroup();
// addedRecordStructure = false;
}
protected Group makeRootGroup() {
Group root = new Group(this, null, "");
+
+ // The value of rootGroup will be queried during the course of setParentGroup.
+ // If there's an existing rootGroup that we're trying to replace, it's important that the value of the
+ // field be null for that.
+ rootGroup = null;
root.setParentGroup(null);
+
return root;
} | Fix NetcdfFile.empty()
Previously, the "global-view" CdmNode lists were emptied but the root group was left untouched. That gets emptied (actually, replaced) now as well. | Unidata_thredds | train | java |
cb8cd849eb44b9bd70ac4146f6ea0bf6d350f833 | diff --git a/dwho/classes/modules.py b/dwho/classes/modules.py
index <HASH>..<HASH> 100644
--- a/dwho/classes/modules.py
+++ b/dwho/classes/modules.py
@@ -142,7 +142,7 @@ class DWhoModuleBase(object):
if value.get('static'):
cmd_args['static'] = True
- cmd_args['op'] = CMD_R
+ cmd_args['op'] = 'GET'
if not value.get('root'):
LOG.error("Missing root for static route")
diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -5,7 +5,7 @@ import os
from setuptools import find_packages, setup
requirements = [line.strip() for line in open('requirements.txt', 'r').readlines()]
-version = '0.2.18'
+version = '0.2.19'
if os.path.isfile('VERSION'):
version = open('VERSION', 'r').readline().strip() or version | [BUG] Removed old reference | decryptus_dwho | train | py,py |
97e645d58a9d144751d35576bbcbd6df69cacd2b | diff --git a/spec/integration/bootstrap_spec.rb b/spec/integration/bootstrap_spec.rb
index <HASH>..<HASH> 100644
--- a/spec/integration/bootstrap_spec.rb
+++ b/spec/integration/bootstrap_spec.rb
@@ -11,7 +11,6 @@ describe "bootstrap spec", type: :feature, js: true, sauce: true do
it 'should translate rails message types into bootstrap alert classes' do
visit '/test/bootstrap'
expect(page).to have_content 'Page loaded'
- save_and_open_page
within('.alert.alert-info') { expect(page).to have_content 'Inline Notice' }
end
diff --git a/spec/integration/turbolinks_spec.rb b/spec/integration/turbolinks_spec.rb
index <HASH>..<HASH> 100644
--- a/spec/integration/turbolinks_spec.rb
+++ b/spec/integration/turbolinks_spec.rb
@@ -4,10 +4,8 @@ if Rails.version =~ /^4\./
describe "turbolinks spec", type: :feature, js: true, sauce: true do
it 'should invoke the API for each flash message' do
visit '/test/turbolinks'
- save_and_open_page
click_link 'This is a turbolink'
expect(page).to have_content 'Turbolink content'
- save_and_open_page
expect(evaluate_script('window.flashMessages')).to eq [
{'type' => 'notice', 'message' => 'Inline Notice'},
{'type' => 'notice', 'message' => 'Turbolink Notice'} | remove extra save_and_open_page from specs | leonid-shevtsov_unobtrusive_flash | train | rb,rb |
69e2863a52da53d5292b85396c03c24a2db8183e | diff --git a/core/payload.js b/core/payload.js
index <HASH>..<HASH> 100644
--- a/core/payload.js
+++ b/core/payload.js
@@ -80,8 +80,8 @@ module.exports = (function() {
* @param {Number} httpStatus The http status number. E.g 200.
* @public
*/
- setHTTPStatus(httpStatus && body !== null) {
- if (httpStatus !== undefined) {
+ setHTTPStatus(httpStatus) {
+ if (httpStatus !== undefined && body !== null) {
this.externalCallReturn = this.externalCallReturn || {};
this.externalCallReturn.httpStatus = httpStatus;
} | Ensuring that external responses cannot include undefined or null data. | converseai_converseai-plugins-sdk | train | js |
17f9bc7b0b8a1666667b9dd574d8ae3241e21cda | diff --git a/lib/pry-byebug/commands.rb b/lib/pry-byebug/commands.rb
index <HASH>..<HASH> 100644
--- a/lib/pry-byebug/commands.rb
+++ b/lib/pry-byebug/commands.rb
@@ -73,7 +73,7 @@ module PryByebug
def process
check_file_context
- run 'exit-all'
+ breakout_navigation :continue
end
end
alias_command 'c', 'continue' | Don't finish pry instance when 'continue'
This should improve `pry-remote` support (see #<I>) | deivid-rodriguez_pry-byebug | train | rb |
8e7b6e416e0ce0db6a095f05c82e71e336503638 | diff --git a/tasks/bug_report_template.rb b/tasks/bug_report_template.rb
index <HASH>..<HASH> 100644
--- a/tasks/bug_report_template.rb
+++ b/tasks/bug_report_template.rb
@@ -88,16 +88,16 @@ class BugTest < ActionDispatch::IntegrationTest
def test_admin_root_success?
get admin_root_url
- assert_response :success
assert_match 'Test Me', response.body # has content
assert_match 'Users', response.body # has 'Your Models' in menu
+ assert_response :success
end
def test_admin_users
User.create! full_name: 'John Doe'
get admin_users_url
- assert_response :success
assert_match 'John Doe', response.body # has created row
+ assert_response :success
end
private | Move less informative assertion to the end
If you can see the response body, you can figure out faster what's
wrong. | activeadmin_activeadmin | train | rb |
9e5aa155fbd7605b71b8bb463647ae0216ecc6f7 | diff --git a/lib/utils/config.js b/lib/utils/config.js
index <HASH>..<HASH> 100644
--- a/lib/utils/config.js
+++ b/lib/utils/config.js
@@ -188,16 +188,20 @@ function persistent(slicer, start, workerQueue) {
var nextSlice = slicer;
var start = start;
var logger = _context.logger;
+ var isProcessing = false;
+
+ return function() {
+ if (!isProcessing) {
+ isProcessing = true;
+ var worker = workerQueue.dequeue();
- return function(msg) {
- if (msg.message === 'ready') {
- Promise.resolve(nextSlice(msg))
+ Promise.resolve(nextSlice(worker.message))
.then(function(data) {
//not null or undefined
if (data != null) {
- sendMessage(_context.cluster, msg.id, {message: 'data', data: data})
+ sendMessage(_context.cluster, worker.id, {message: 'data', data: data})
}
-
+ isProcessing = false;
})
}
@@ -211,7 +215,7 @@ function once(slicer, start, workerQueue) {
var logger = _context.logger;
var isProcessing = false;
- return function slice () {
+ return function() {
if (!isProcessing) {
isProcessing = true; | persistent function now works with queuing | terascope_teraslice | train | js |
d5c691375fbc80ffe43c2bbc1f191c2e3cf0076b | diff --git a/ruby_event_store/spec/mappers/encryption_mapper_spec.rb b/ruby_event_store/spec/mappers/encryption_mapper_spec.rb
index <HASH>..<HASH> 100644
--- a/ruby_event_store/spec/mappers/encryption_mapper_spec.rb
+++ b/ruby_event_store/spec/mappers/encryption_mapper_spec.rb
@@ -59,6 +59,29 @@ module RubyEventStore
expect(event.metadata.to_h).to eq(metadata)
end
+ specify 'make sure encryption & decryption do not tamper event data' do
+ [
+ false,
+ true,
+ 123,
+ 'Any string value',
+ 123.45,
+ nil,
+ ].each do |value|
+ source_event = domain_event(build_data(value))
+ encrypted = encrypted_item(source_event)
+ record = SerializedRecord.new(
+ event_id: source_event.event_id,
+ data: YAML.dump(encrypted.data),
+ metadata: YAML.dump(encrypted.metadata),
+ event_type: SomeEventWithPersonalInfo.name
+ )
+ event = subject.serialized_record_to_event(record)
+ expect(event).to eq(source_event)
+ expect(event.metadata.to_h).to eq(metadata)
+ end
+ end
+
context 'when key is forgotten' do
subject { described_class.new(key_repository) } | A failing test case for #<I> | RailsEventStore_rails_event_store | train | rb |
90e0c05e13eb4dae4282e529f0fefb3635e506a8 | diff --git a/android/src/com/phonegap/demo/DroidGap.java b/android/src/com/phonegap/demo/DroidGap.java
index <HASH>..<HASH> 100644
--- a/android/src/com/phonegap/demo/DroidGap.java
+++ b/android/src/com/phonegap/demo/DroidGap.java
@@ -41,6 +41,10 @@ public class DroidGap extends Activity {
private static final String LOG_TAG = "DroidGap";
private WebView appView;
private String uri;
+ private PhoneGap gap;
+ private GeoBroker geo;
+ private AccelListener accel;
+
/** Called when the activity is first created. */
@Override
@@ -89,9 +93,9 @@ public class DroidGap extends Activity {
private void bindBrowser(WebView appView)
{
// The PhoneGap class handles the Notification and Android Specific crap
- PhoneGap gap = new PhoneGap(this, appView);
- GeoBroker geo = new GeoBroker(appView, this);
- AccelListener accel = new AccelListener(this, appView);
+ gap = new PhoneGap(this, appView);
+ geo = new GeoBroker(appView, this);
+ accel = new AccelListener(this, appView);
// This creates the new javascript interfaces for PhoneGap
appView.addJavascriptInterface(gap, "Device");
appView.addJavascriptInterface(geo, "Geo"); | Fixing scoping issues where PhoneGap would get Garbage Collected. | apache_cordova-ios | train | java |
1a3712d1128769fe2c2e3beef96635ef321ac849 | diff --git a/instaloader/instaloadercontext.py b/instaloader/instaloadercontext.py
index <HASH>..<HASH> 100644
--- a/instaloader/instaloadercontext.py
+++ b/instaloader/instaloadercontext.py
@@ -215,8 +215,11 @@ class InstaloaderContext:
session.headers.update({'X-CSRFToken': csrf_token})
# Not using self.get_json() here, because we need to access csrftoken cookie
self.do_sleep()
+ # Workaround credits to pgrimaud.
+ # See: https://github.com/pgrimaud/instagram-user-feed/commit/96ad4cf54d1ad331b337f325c73e664999a6d066
+ enc_password = '#PWD_INSTAGRAM_BROWSER:0:{}:{}'.format(int(datetime.now().timestamp()), passwd)
login = session.post('https://www.instagram.com/accounts/login/ajax/',
- data={'password': passwd, 'username': user}, allow_redirects=True)
+ data={'enc_password': enc_password, 'username': user}, allow_redirects=True)
try:
resp_json = login.json()
except json.decoder.JSONDecodeError: | Workaround for Instagram's encrypted login. (#<I>)
* Workaround for Instagram's encrypted login.
Credit: <URL> | instaloader_instaloader | train | py |
cbddc376d275b160379ee4b7e2af825af4e32bfd | diff --git a/pkg/minikube/exit/exit.go b/pkg/minikube/exit/exit.go
index <HASH>..<HASH> 100644
--- a/pkg/minikube/exit/exit.go
+++ b/pkg/minikube/exit/exit.go
@@ -29,16 +29,16 @@ import (
// Exit codes based on sysexits(3)
const (
- Failure = 1 // Failure represents a general failure code
- BadUsage = 64 // Usage represents an incorrect command line
- Data = 65 // Data represents incorrect data supplied by the user
- NoInput = 66 // NoInput represents that the input file did not exist or was not readable
- Unavailable = 69 // Unavailable represents when a service was unavailable
- Software = 70 // Software represents an internal software error.
- IO = 74 // IO represents an I/O error
- Config = 78 // Config represents an unconfigured or misconfigured state
- Permissions = 77 // Permissions represents a permissions error
- Interrupted = 130 // Script terminated by Control-C
+ Failure = 1 // Failure represents a general failure code
+ Interrupted = 2 // Ctrl-C (SIGINT)
+ BadUsage = 64 // Usage represents an incorrect command line
+ Data = 65 // Data represents incorrect data supplied by the user
+ NoInput = 66 // NoInput represents that the input file did not exist or was not readable
+ Unavailable = 69 // Unavailable represents when a service was unavailable
+ Software = 70 // Software represents an internal software error.
+ IO = 74 // IO represents an I/O error
+ Config = 78 // Config represents an unconfigured or misconfigured state
+ Permissions = 77 // Permissions represents a permissions error
// MaxProblems controls the number of problems to show for each source
MaxProblems = 3 | SIGINT should be exit code 2 | kubernetes_minikube | train | go |
9cd071783f9ad694c024fb2df0dd639a6a894932 | diff --git a/media/boom/js/boom/chunk/asset.js b/media/boom/js/boom/chunk/asset.js
index <HASH>..<HASH> 100644
--- a/media/boom/js/boom/chunk/asset.js
+++ b/media/boom/js/boom/chunk/asset.js
@@ -2,7 +2,7 @@ $.widget('ui.chunkAsset', $.ui.chunk, {
editAssetOnly : function() {
var chunkAsset = this;
- new boomAssetPicker(this.asset.assetId)
+ new boomAssetPicker(this.assetId)
.done(function(assetId) {
chunkAsset.save({
asset_id : assetId
@@ -65,6 +65,7 @@ $.widget('ui.chunkAsset', $.ui.chunk, {
edit : function() {
this.elements = this.getElements();
+ this.assetId = this.element.attr('data-boom-asset-id');
if (this.hasMetadata()) {
this.editAllElements();
@@ -81,7 +82,7 @@ $.widget('ui.chunkAsset', $.ui.chunk, {
this._save(data);
this.destroy();
},
-
+
_update_html : function(html) {
var $html = $(html),
$replacement = $($html[0]); | Fixed editing an asset chunk which with no metadata | boomcms_boom-core | train | js |
77ae2f8f214c49af5d011defcddb61e6cd142922 | diff --git a/bin/sauce-jasmine.js b/bin/sauce-jasmine.js
index <HASH>..<HASH> 100644
--- a/bin/sauce-jasmine.js
+++ b/bin/sauce-jasmine.js
@@ -70,8 +70,7 @@ var browserFilter = [
"microsoftedge/13..latest",
"firefox/31..latest/linux",
"chrome/31..latest/linux",
- "safari/5..latest",
- "opera/11..latest",
+ "safari/7..latest",
"android/4.4..latest",
"iphone/5.1..latest"
]; | Remove unsupported browsers from Sauce Labs tests
They do not support Opera and Safari 5/6 anymore. More details at:
<URL> | tus_tus-js-client | train | js |
5d32bd4066c71e399ddc5a0fff61445ccb4a22e9 | diff --git a/src/Sulu/Component/Content/Structure.php b/src/Sulu/Component/Content/Structure.php
index <HASH>..<HASH> 100644
--- a/src/Sulu/Component/Content/Structure.php
+++ b/src/Sulu/Component/Content/Structure.php
@@ -792,6 +792,7 @@ abstract class Structure implements StructureInterface
'path' => $this->path,
'nodeType' => $this->nodeType,
'internal' => $this->internal,
+ 'concreteLanguages' => $this->getConcreteLanguages(),
'hasSub' => $this->hasChildren,
'title' => $this->getProperty('title')->toArray()
); | added concrete-languages to small response | sulu_sulu | train | php |
e82fa44345d17c324125d4702b60bedf00a1eb21 | diff --git a/compress/compressors/__init__.py b/compress/compressors/__init__.py
index <HASH>..<HASH> 100644
--- a/compress/compressors/__init__.py
+++ b/compress/compressors/__init__.py
@@ -56,7 +56,8 @@ class Compressor(object):
def concatenate(self, paths):
"""Concatenate together a list of files"""
- return '\n'.join([self.read_file(path) for path in paths])
+ content = '\n'.join([self.read_file(path) for path in paths])
+ return "(function() { %s }).call(this);" % content
def construct_asset_path(self, asset_path, css_path):
public_path = self.absolute_path(asset_path, css_path) | push concatenated javascript into an anonymous function to avoid polluting namespace | jazzband_django-pipeline | train | py |
138b035a63cd0f5273eac2cabdb1b35598cc7494 | diff --git a/perceval/_version.py b/perceval/_version.py
index <HASH>..<HASH> 100644
--- a/perceval/_version.py
+++ b/perceval/_version.py
@@ -1,2 +1,2 @@
# Versions compliant with PEP 440 https://www.python.org/dev/peps/pep-0440
-__version__ = "0.9.2"
+__version__ = "0.9.3" | Update version number to <I> | chaoss_grimoirelab-perceval | train | py |
82bfdcc181137f8e1a0cff961c9bd4a36a98c003 | diff --git a/src/server/server.js b/src/server/server.js
index <HASH>..<HASH> 100644
--- a/src/server/server.js
+++ b/src/server/server.js
@@ -94,7 +94,13 @@ export class Server extends EventEmitter {
}
this.log.sendosc(out);
});
- this.receive.subscribe((o) => this.log.rcvosc(o), (err) => this.log.err(err));
+ this.receive.subscribe((o) => {
+ this.log.rcvosc(o);
+ // log all /fail responses as error
+ if (o[0] === '/fail') {
+ this.log.err(o);
+ }
+ }, (err) => this.log.err(err));
this.stdout.subscribe((o) => this.log.stdout(o), (o) => this.log.stderr(o));
this.processEvents.subscribe((o) => this.log.dbug(o), (o) => this.log.err(o));
} | log all /fail messages as errors | crucialfelix_supercolliderjs | train | js |
a3d4149bf3723151af1674f2f920921957b6d313 | diff --git a/plugin/PhpVersion/Php72.php b/plugin/PhpVersion/Php72.php
index <HASH>..<HASH> 100644
--- a/plugin/PhpVersion/Php72.php
+++ b/plugin/PhpVersion/Php72.php
@@ -110,7 +110,8 @@ class Php72 implements PhpVersion, MemoryLimit, PostLimit, UploadFileLimit, Defa
$phpFpmService->setEnvironmentVariable($name, $value);
$mainService->addLink($phpFpmService, 'phpfpm');
- $mainService->setEnvironmentVariable('BACKEND_HOST', $phpFpmService->getName().':9000');
+ if($this->updateBackendEnvironment)
+ $mainService->setEnvironmentVariable('BACKEND_HOST', $name.':9000');
/**
* Copy links from the main service so databases etc are available | added missing condition from setting BACKEND_HOST | ipunkt_rancherize-php72 | train | php |
9b7111a9a62b2c59bca43d1f9c2e0600f7feba33 | diff --git a/setuptools/tests/test_dist.py b/setuptools/tests/test_dist.py
index <HASH>..<HASH> 100644
--- a/setuptools/tests/test_dist.py
+++ b/setuptools/tests/test_dist.py
@@ -374,3 +374,8 @@ def test_check_specifier():
)
def test_rfc822_unescape(content, result):
assert (result or content) == rfc822_unescape(rfc822_escape(content))
+
+
+def test_metadata_name():
+ with pytest.raises(DistutilsSetupError, match='missing.*name'):
+ Distribution()._validate_metadata() | Add test capturing expectation when name is not supplied. | pypa_setuptools | train | py |
86f7beb989a8cff85a35a43b211b809d9cd4164e | diff --git a/compliance_checker/cf/cf.py b/compliance_checker/cf/cf.py
index <HASH>..<HASH> 100644
--- a/compliance_checker/cf/cf.py
+++ b/compliance_checker/cf/cf.py
@@ -4639,8 +4639,10 @@ class CF1_7Check(CF1_6Check):
# check equality to existing min/max values
# NOTE this is a data check
out_of += 1
- if (variable.actual_range[0] != variable[:].min()) or (
- variable.actual_range[1] != variable[:].max()
+ if (
+ not np.isclose( variable.actual_range[0],variable[:].min() )
+ ) or (
+ not np.isclose( variable.actual_range[1],variable[:].max() )
):
msgs.append(
"actual_range elements of '{}' inconsistent with its min/max values".format( | Issue <I> use np.isclose for float comparison | ioos_compliance-checker | train | py |
48e94db187ed0b6166a6572f499ef624d5f987ce | diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -13,7 +13,7 @@ deps = {
"eth-utils>=1.0.1,<2.0.0",
"pyethash>=0.1.27,<1.0.0",
"py-ecc>=1.4.2,<2.0.0",
- "rlp>=1.0.0b6,<2.0.0",
+ "rlp>=1.0.0,<2.0.0",
"eth-keys>=0.2.0b3,<1.0.0",
"trie>=1.3.2,<2.0.0",
"lru-dict>=1.1.6", | use rlp <I> stable | ethereum_py-evm | train | py |
e9cf884da737392d6af4beeef739febe56f4dcaa | diff --git a/src/grid/ServerGridView.php b/src/grid/ServerGridView.php
index <HASH>..<HASH> 100644
--- a/src/grid/ServerGridView.php
+++ b/src/grid/ServerGridView.php
@@ -141,6 +141,7 @@ class ServerGridView extends BoxedGridView
$badges .= Label::widget(['label' => 'W', 'tag' => 'sup', 'color' => 'success']);
}
}
+ $badges .= Label::widget(['label' => Yii::t('hipanel:server', $model->type_label), 'tag' => 'sup', 'color' => 'info']);
return $badges;
}, | Added `type` to server main column (#<I>) | hiqdev_hipanel-module-server | train | php |
b62aa830639a288d6af0a5ad7fa401c8ad966534 | diff --git a/tests/TestCase/Core/ConfigureTest.php b/tests/TestCase/Core/ConfigureTest.php
index <HASH>..<HASH> 100644
--- a/tests/TestCase/Core/ConfigureTest.php
+++ b/tests/TestCase/Core/ConfigureTest.php
@@ -84,17 +84,13 @@ class ConfigureTest extends TestCase
/**
* testReadOrFail method
*
+ * @expectedException RuntimeException
+ * @expectedExceptionMessage Expected "This.Key.Does.Not.exist" configuration
* @return void
*/
public function testReadOrFailThrowingException()
{
- try {
- $void = Configure::readOrFail('This.Key.Does.Not.exist');
- $this->fail('Expected exception to be thrown.');
- } catch (\Exception $e) {
- $this->assertTrue($e instanceof \RuntimeException);
- $this->assertEquals('Expected "This.Key.Does.Not.exist" configuration.', $e->getMessage());
- }
+ Configure::readOrFail('This.Key.Does.Not.exist');
}
/** | utilize phpunit test docblock conventions | cakephp_cakephp | train | php |
65656c537cd847d9e5074dab3f04aba526b1b0e8 | diff --git a/mod/hotpot/mod_form.php b/mod/hotpot/mod_form.php
index <HASH>..<HASH> 100644
--- a/mod/hotpot/mod_form.php
+++ b/mod/hotpot/mod_form.php
@@ -115,6 +115,7 @@ class mod_hotpot_mod_form extends moodleform_mod {
$mform->setAdvanced('summary_elements');
} else {
// existing HotPot
+ $mform->addElement('hidden', 'summarysource', HOTPOT_TEXTSOURCE_SPECIFIC);
$mform->addElement('htmleditor', 'summary', get_string('summary'));
$mform->setType('summary', PARAM_RAW);
$mform->setHelpButton('summary', array('writing', 'questions', 'richtext'), false, 'editorhelpbutton'); | added hidden "summarysource" field when updating a HotPot. This fixes "undefined property" error from mod/hotpot/lib.php | moodle_moodle | train | php |
562f8f3019978baf288d0de1a9640c9e00929fd9 | diff --git a/contribs/gmf/src/directives/displayquerygrid.js b/contribs/gmf/src/directives/displayquerygrid.js
index <HASH>..<HASH> 100644
--- a/contribs/gmf/src/directives/displayquerygrid.js
+++ b/contribs/gmf/src/directives/displayquerygrid.js
@@ -602,16 +602,17 @@ gmf.DisplayquerygridController.prototype.makeGrid_ = function(data, source) {
gmf.DisplayquerygridController.prototype.getGridConfiguration_ = function(
data) {
goog.asserts.assert(data.length > 0);
- const columns = Object.keys(data[0]);
+ const clone = {};
+ Object.assign(clone, data[0]);
+ delete clone.ol_uid;
+ const columns = Object.keys(clone);
/** @type {Array.<ngeox.GridColumnDef>} */
const columnDefs = [];
columns.forEach((column) => {
- if (column !== 'ol_uid') {
- columnDefs.push(/** @type {ngeox.GridColumnDef} */ ({
- name: column
- }));
- }
+ columnDefs.push(/** @type {ngeox.GridColumnDef} */ ({
+ name: column
+ }));
});
if (columnDefs.length > 0) { | Remove the ol_uid also on build | camptocamp_ngeo | train | js |
6971a35a82838682333bf6ce94f96808487472ab | diff --git a/tests/Fixtures/app/bootstrap.php b/tests/Fixtures/app/bootstrap.php
index <HASH>..<HASH> 100644
--- a/tests/Fixtures/app/bootstrap.php
+++ b/tests/Fixtures/app/bootstrap.php
@@ -16,14 +16,14 @@ use Doctrine\Common\Annotations\AnnotationRegistry;
date_default_timezone_set('UTC');
// PHPUnit's autoloader
-// This glob hack will not be necessary anymore when https://github.com/symfony/symfony/pull/37974 will have been merged.
-$phpunitInstalls = glob(__DIR__.'/../../../vendor/bin/.phpunit/phpunit-*');
-if (!$phpunitInstalls) {
+if (!file_exists($phpUnitAutoloaderPath = __DIR__.'/../../../vendor/bin/.phpunit/phpunit/vendor/autoload.php')) {
die('PHPUnit is not installed. Please run ./vendor/bin/simple-phpunit to install it');
}
-// Use the most recent version available
-require end($phpunitInstalls).'/vendor/autoload.php';
+$phpunitLoader = require $phpUnitAutoloaderPath;
+// Don't register the PHPUnit autoloader before the normal autoloader to prevent weird issues
+$phpunitLoader->unregister();
+$phpunitLoader->register();
$loader = require __DIR__.'/../../../vendor/autoload.php';
require __DIR__.'/AppKernel.php'; | Fix tests (#<I>)
* Fix PHPStan errors
* Remove phpunit autoloader from tests fixtures as it interferes with the default autoloader
* Re-register PHPUnit loader in order to append it after the normal autoloader
* fix: finish PR | api-platform_core | train | php |
5ea1c2b8c34808fc0132a81ad887b649ef970fbf | diff --git a/openquake/calculators/views.py b/openquake/calculators/views.py
index <HASH>..<HASH> 100644
--- a/openquake/calculators/views.py
+++ b/openquake/calculators/views.py
@@ -113,6 +113,12 @@ def view_csm_info(token, dstore):
return rst_table(rows, header)
[email protected]('slow_sources')
+def view_slow_sources(token, dstore):
+ info = dstore['source_info'][:10]
+ return rst_table(info, fmt='%g')
+
+
@view.add('rupture_collections')
def view_rupture_collections(token, dstore):
rlzs_assoc = dstore['rlzs_assoc'] | Added a view slow_sources | gem_oq-engine | train | py |
ce3e5e0cb425bacc08dbbba1c3678f998bdf624f | diff --git a/packages/xod-client/src/project/nodeLayout.js b/packages/xod-client/src/project/nodeLayout.js
index <HASH>..<HASH> 100644
--- a/packages/xod-client/src/project/nodeLayout.js
+++ b/packages/xod-client/src/project/nodeLayout.js
@@ -261,10 +261,8 @@ export const getBusNodePositionForPin = (node, pin) => {
const pinOrder = XP.getPinOrder(pin);
return {
- x: nodePosition.x + pinOrder * SLOT_SIZE.WIDTH,
- y:
- nodePosition.y +
- SLOT_SIZE.HEIGHT * (pinDirection === XP.PIN_DIRECTION.INPUT ? -1 : 1),
+ x: nodePosition.x + pinOrder,
+ y: nodePosition.y + (pinDirection === XP.PIN_DIRECTION.INPUT ? -1 : 1),
};
}; | fix(xod-client): fix splitting links with buses | xodio_xod | train | js |
2b52db261f1811b1b9113b5031df6d0bba3eef62 | diff --git a/test/node/operator/extract.js b/test/node/operator/extract.js
index <HASH>..<HASH> 100644
--- a/test/node/operator/extract.js
+++ b/test/node/operator/extract.js
@@ -16,7 +16,7 @@ describe('we check we can extract a part of B/W image', function () {
});
});
- it('check by specify 1,1 position with parent', function () {
+ it.skip('check by specify 1,1 position with parent', function () {
return load('BW4x4.png').then(function (image) { | skip test failing on travis
Ref: #<I> | image-js_image-js | train | js |
315e0bbae49a59b894c3f24a75e2825c9b9c4e07 | diff --git a/includes/events/taxonomies.php b/includes/events/taxonomies.php
index <HASH>..<HASH> 100644
--- a/includes/events/taxonomies.php
+++ b/includes/events/taxonomies.php
@@ -51,7 +51,7 @@ function wp_event_calendar_register_type_taxonomy() {
'rewrite' => $rewrite,
'capabilities' => $caps,
'update_count_callback' => '_update_post_term_count',
- 'query_var' => true,
+ 'query_var' => 'event-type',
'show_tagcloud' => true,
'hierarchical' => false,
'show_in_nav_menus' => false,
@@ -105,7 +105,7 @@ function wp_event_calendar_register_category_taxonomy() {
'rewrite' => $rewrite,
'capabilities' => $caps,
'update_count_callback' => '_update_post_term_count',
- 'query_var' => true,
+ 'query_var' => 'event-category',
'show_tagcloud' => false,
'hierarchical' => true,
'show_in_nav_menus' => false, | Query variables for event taxonomies. | stuttter_wp-event-calendar | train | php |
3146f0184812922774c2a38a9cf4b8682e2ada5b | diff --git a/public/hft/0.x.x/scripts/misc/playername.js b/public/hft/0.x.x/scripts/misc/playername.js
index <HASH>..<HASH> 100644
--- a/public/hft/0.x.x/scripts/misc/playername.js
+++ b/public/hft/0.x.x/scripts/misc/playername.js
@@ -123,6 +123,7 @@ define(['./cookies'], function(Cookie) {
// If the user's name is "" the game may send a name.
client.addEventListener('setName', handleSetNameMsg);
+ client.addEventListener('_hft_setname_', handleSetNameMsg);
element.addEventListener('click', startEnteringName, false);
element.addEventListener('change', finishEnteringName, false); | make playername.js handle the _hft_setname_ message
I'm not sure if there's a point to this | greggman_HappyFunTimes | train | js |
5603a558be16f7844e23dce1774444a6c818b69b | diff --git a/tests/Plugins/AbstractPluginTest.php b/tests/Plugins/AbstractPluginTest.php
index <HASH>..<HASH> 100644
--- a/tests/Plugins/AbstractPluginTest.php
+++ b/tests/Plugins/AbstractPluginTest.php
@@ -99,6 +99,12 @@ abstract class AbstractPluginTest extends \PHPUnit_Framework_TestCase
$this->assertTrue(isset($classImplements[PluginInterface::class]));
}
+ public function testGetSlug()
+ {
+ $this->assertInternalType('string', $this->plugin->getSlug());
+ $this->assertTrue(strlen($this->plugin->getSlug()) > 0);
+ }
+
public function testGetConfiguration()
{ | Test get slug on plugins | WyriHaximus_PhuninNode | train | php |
a667bef08c9785202386c2225df2c2135fd13cca | diff --git a/pandas/core/common.py b/pandas/core/common.py
index <HASH>..<HASH> 100644
--- a/pandas/core/common.py
+++ b/pandas/core/common.py
@@ -520,14 +520,15 @@ def _format(s, space=None, na_rep=None, float_format=None, col_width=None):
else:
formatted = _float_format(s)
+ # TODO: fix this float behavior!
# if we pass col_width, pad-zero the floats so all are same in column
- if col_width is not None and '.' in formatted:
- padzeros = col_width - len(formatted)
- if padzeros > 0 and 'e' in formatted:
- num, exp = formatted.split('e')
- formatted = "%s%se%s" % (num, ('0' * padzeros), exp)
- elif padzeros > 0:
- formatted = formatted + ('0' * padzeros)
+ #if col_width is not None and '.' in formatted:
+ # padzeros = col_width - len(formatted)
+ # if padzeros > 0 and 'e' in formatted:
+ # num, exp = formatted.split('e')
+ # formatted = "%s%se%s" % (num, ('0' * padzeros), exp)
+ # elif padzeros > 0:
+ # formatted = formatted + ('0' * padzeros)
return _just_help(formatted)
elif isinstance(s, int): | FIX: comment out float padding behavior until we nail it | pandas-dev_pandas | train | py |
fc570ac87c414d40de97eb4c64156cc9e9176c2d | diff --git a/Image/ImageModifier.php b/Image/ImageModifier.php
index <HASH>..<HASH> 100644
--- a/Image/ImageModifier.php
+++ b/Image/ImageModifier.php
@@ -8,7 +8,7 @@ use vxPHP\Image\Exception\ImageModifierException;
* wraps some image manipulation functionality
*
* @author Gregor Kofler
- * @version 0.5.1 2014-04-02
+ * @version 0.5.2 2014-04-06
*/
abstract class ImageModifier {
@@ -130,6 +130,9 @@ abstract class ImageModifier {
$this->queue[] = $todo;
+ $this->srcWidth = $this->srcWidth - $left - $right;
+ $this->srcHeight = $this->srcHeight - $top - $bottom;
+
}
/**
@@ -233,6 +236,9 @@ abstract class ImageModifier {
$todo->parameters = array($width, $height);
$this->queue[] = $todo;
+
+ $this->srcWidth = $width;
+ $this->srcHeight = $height;
} | Bugfix: size calculation did not work when carried over several steps | Vectrex_vxPHP | train | php |
d3fdda6efc562c3d14e4059084ed1addfad4a47f | diff --git a/src/ol/format/WFS.js b/src/ol/format/WFS.js
index <HASH>..<HASH> 100644
--- a/src/ol/format/WFS.js
+++ b/src/ol/format/WFS.js
@@ -99,6 +99,7 @@ const TRANSACTION_SERIALIZERS = {
* @property {number} [maxFeatures] Maximum number of features to fetch.
* @property {string} [geometryName] Geometry name to use in a BBOX filter.
* @property {Array<string>} [propertyNames] Optional list of property names to serialize.
+ * @property {string} [viewParams] viewParams GeoServer vendor parameter.
* @property {number} [startIndex] Start index to use for WFS paging. This is a
* WFS 2.0 feature backported to WFS 1.1.0 by some Web Feature Services.
* @property {number} [count] Number of features to retrieve when paging. This is a
@@ -406,6 +407,9 @@ class WFS extends XMLFeature {
if (options.count !== undefined) {
node.setAttribute('count', String(options.count));
}
+ if (options.viewParams !== undefined) {
+ node.setAttribute('viewParams ', options.viewParams);
+ }
filter = options.filter;
if (options.bbox) {
assert(options.geometryName, | Add condition for viewParams and TypeScript related option | openlayers_openlayers | train | js |
cbb03a02d4b42e350ed92f73ced05f3046100ae8 | diff --git a/test/unit/plugins/communicators/winrm/communicator_test.rb b/test/unit/plugins/communicators/winrm/communicator_test.rb
index <HASH>..<HASH> 100644
--- a/test/unit/plugins/communicators/winrm/communicator_test.rb
+++ b/test/unit/plugins/communicators/winrm/communicator_test.rb
@@ -88,7 +88,7 @@ describe VagrantPlugins::CommunicatorWinRM::Communicator do
expect(shell).to receive(:upload).with(kind_of(String), "c:/tmp/vagrant-elevated-shell.ps1")
expect(shell).to receive(:powershell) do |cmd|
expect(cmd).to eq("powershell -executionpolicy bypass -file \"c:/tmp/vagrant-elevated-shell.ps1\" " +
- "-username \"vagrant\" -password \"password\" -encoded_command \"ZABpAHIAOwAgAGUAeABpAHQAIAAkAEwAQQBTAFQARQBYAEkAVABDAE8ARABFAA==\"")
+ "-username \'vagrant\' -password \'password\' -encoded_command \"ZABpAHIAOwAgAGUAeABpAHQAIAAkAEwAQQBTAFQARQBYAEkAVABDAE8ARABFAA==\"")
end.and_return({ exitcode: 0 })
expect(subject.execute("dir", { elevated: true })).to eq(0)
end | Updating tests to check for single quote | hashicorp_vagrant | train | rb |
931be4803b1f21dc1605612364df128dce74a6ef | diff --git a/src/java/org/apache/cassandra/streaming/messages/StreamMessage.java b/src/java/org/apache/cassandra/streaming/messages/StreamMessage.java
index <HASH>..<HASH> 100644
--- a/src/java/org/apache/cassandra/streaming/messages/StreamMessage.java
+++ b/src/java/org/apache/cassandra/streaming/messages/StreamMessage.java
@@ -65,9 +65,9 @@ public abstract class StreamMessage
{
PREPARE(1, 5, PrepareMessage.serializer),
FILE(2, 0, FileMessage.serializer),
- RECEIVED(3, 1, ReceivedMessage.serializer),
- RETRY(4, 1, RetryMessage.serializer),
- COMPLETE(5, 4, CompleteMessage.serializer),
+ RECEIVED(3, 4, ReceivedMessage.serializer),
+ RETRY(4, 4, RetryMessage.serializer),
+ COMPLETE(5, 1, CompleteMessage.serializer),
SESSION_FAILED(6, 5, SessionFailedMessage.serializer);
public static Type get(byte type) | change stream message priority(make received/retry proorities higher than complete). | Stratio_stratio-cassandra | train | java |
6e33ee28e8a82ec021eb0d8194a68d9cf746b273 | diff --git a/lib/websearch_templates.py b/lib/websearch_templates.py
index <HASH>..<HASH> 100644
--- a/lib/websearch_templates.py
+++ b/lib/websearch_templates.py
@@ -1085,7 +1085,7 @@ class Template:
- 'browsed_phrases_in_colls' *array* - the phrases to display
- - 'urlargs_colls' *string* - the url parameters for the search
+ - 'colls' *array* - the list of collection parameters of the search (c's)
"""
# load the right message language | Updated docstring to tmpl_browse_pattern() to describe colls
parameter. | inveniosoftware_invenio-records | train | py |
286c4012dedc4d45382d072804a8efb2a83ad8bc | diff --git a/cocaine/asio/service.py b/cocaine/asio/service.py
index <HASH>..<HASH> 100644
--- a/cocaine/asio/service.py
+++ b/cocaine/asio/service.py
@@ -382,7 +382,11 @@ class Service(AbstractService):
@strategy.coroutine
def connectThroughLocator(self, locator, timeout=None, blocking=False):
- endpoint, self.version, api = yield locator.resolve(self.name, timeout, blocking=blocking)
+ try:
+ endpoint, self.version, api = yield locator.resolve(self.name, timeout, blocking=blocking)
+ except ServiceError as err:
+ raise LocatorResolveError(self.name, locator.address, err)
+
yield self._connectToEndpoint(*endpoint, timeout=timeout, blocking=blocking)
self.api = dict((methodName, methodId) for methodId, methodName in api.items()) | More meaningful error messages in `Locator.resolve` method. | cocaine_cocaine-framework-python | train | py |
992e297e2157c31e6c2882a879c7e7f186e3d643 | diff --git a/index.js b/index.js
index <HASH>..<HASH> 100755
--- a/index.js
+++ b/index.js
@@ -31,7 +31,7 @@ async function runMigrations(sqlitePath) {
// meaning we will not be able to access the runtimes own npm scripts!
logger.info('Running migrations');
- const scriptFilePath = path.resolve(__dirname, 'scripts', 'sequelize_migrations.sh');
+ const scriptFilePath = path.join('scripts', 'sequelize_migrations.sh');
const repositories = [
'process_models', | :recycle: Use relative path to migration script! | process-engine_process_engine_runtime | train | js |
4368788ae1345e9e70bd3cd3a1ed5a1195f121d1 | diff --git a/bigfloat.py b/bigfloat.py
index <HASH>..<HASH> 100644
--- a/bigfloat.py
+++ b/bigfloat.py
@@ -77,6 +77,9 @@ standard_functions = [
('mul', [mpfr.Mpfr, mpfr.Mpfr]),
('div', [mpfr.Mpfr, mpfr.Mpfr]),
('fmod', [mpfr.Mpfr, mpfr.Mpfr]),
+
+ ('set_d', [float]),
+
]
predicates = [
('nan_p', [mpfr.Mpfr]), | Declare set_d as a standard function. | mdickinson_bigfloat | train | py |
f54744e1e600c0c62a6d7e3a66aed1e29dafa4e1 | diff --git a/src/system/modules/metamodels/MetaModelList.php b/src/system/modules/metamodels/MetaModelList.php
index <HASH>..<HASH> 100644
--- a/src/system/modules/metamodels/MetaModelList.php
+++ b/src/system/modules/metamodels/MetaModelList.php
@@ -286,11 +286,6 @@ class MetaModelList extends Controller
if ($this->objView)
{
- $this->objView->set('filter', $intFilterSettings);
- }
-
- if ($this->objView)
- {
$this->objTemplate = new MetaModelTemplate($this->objView->get('template'));
$this->objTemplate->view = $this->objView;
} else {
@@ -309,12 +304,6 @@ class MetaModelList extends Controller
protected function getFilter()
{
$this->objFilterSettings = MetaModelFilterSettingsFactory::byId($this->intFilter);
-
- if ($this->objView)
- {
- // TODO: we should use different filter settings for jumpTo generating but for now we use the input filter also for output.
- $this->objView->set('filter', $this->intFilter);
- }
}
/** | get rid of the now useless storage of the used filter settings in the render settings
as we do not use it anymore to generate the jumpTo Url (see issue #<I>). | MetaModels_core | train | php |
20e18cc2461c09af2d4364c127e97f4121d5a1e4 | diff --git a/spacy/cli/debug_data.py b/spacy/cli/debug_data.py
index <HASH>..<HASH> 100644
--- a/spacy/cli/debug_data.py
+++ b/spacy/cli/debug_data.py
@@ -504,13 +504,18 @@ def _compile_gold(
for eg in examples:
gold = eg.reference
doc = eg.predicted
- valid_words = [x for x in gold if x is not None]
+ valid_words = [x.text for x in gold]
data["words"].update(valid_words)
data["n_words"] += len(valid_words)
- data["n_misaligned_words"] += len(gold) - len(valid_words)
+ align = eg.alignment
+ for token in doc:
+ if token.orth_.isspace():
+ continue
+ if align.x2y.lengths[token.i] != 1:
+ data["n_misaligned_words"] += 1
data["texts"].add(doc.text)
if len(nlp.vocab.vectors):
- for word in valid_words:
+ for word in [t.text for t in doc]:
if nlp.vocab.strings[word] not in nlp.vocab.vectors:
data["words_missing_vectors"].update([word])
if "ner" in factory_names: | Fix alignment and vector checks in debug data
* Update token alignment check to use Example alignment
* Update missing vector check further related to changes in v3 | explosion_spaCy | train | py |
ac2ff067d53f491021948452d91d7786d9e854aa | diff --git a/salt/modules/ssh.py b/salt/modules/ssh.py
index <HASH>..<HASH> 100644
--- a/salt/modules/ssh.py
+++ b/salt/modules/ssh.py
@@ -636,7 +636,9 @@ def set_known_host(user, hostname,
with salt.utils.fopen(full, 'a') as ofile:
ofile.write(line)
except (IOError, OSError) as exception:
- raise CommandExecutionError("Couldn't append to known hosts file: '%s'" % exception)
+ raise CommandExecutionError(
+ "Couldn't append to known hosts file: '{0}'".format(exception)
+ )
if os.geteuid() == 0:
os.chown(full, uinfo['uid'], uinfo['gid']) | Changing from printf style to string formatting | saltstack_salt | train | py |
ab16536b5d3739c33f8d8ce324ac66b9e512b449 | diff --git a/ailment/converter_vex.py b/ailment/converter_vex.py
index <HASH>..<HASH> 100644
--- a/ailment/converter_vex.py
+++ b/ailment/converter_vex.py
@@ -501,7 +501,8 @@ class VEXIRSBConverter(Converter):
# TODO: is there a conditional call?
ret_reg_offset = manager.arch.ret_offset
- ret_expr = Register(manager.next_atom(), None, ret_reg_offset, manager.arch.bits)
+ ret_expr = Register(manager.next_atom(), None, ret_reg_offset, manager.arch.bits,
+ reg_name=manager.arch.translate_register_name(ret_reg_offset, size=manager.arch.bits))
statements.append(Call(manager.next_atom(),
VEXExprConverter.convert(irsb.next, manager), | VEXIRSBConverter: Fix a missing regname. (#<I>) | angr_ailment | train | py |
f18dbf8aeeec9eded089f95acfb4402218910834 | diff --git a/httpbl.py b/httpbl.py
index <HASH>..<HASH> 100644
--- a/httpbl.py
+++ b/httpbl.py
@@ -16,7 +16,7 @@ Example:
"""
import socket
-__version__ = '1.0.0'
+__version__ = '1.0.1'
DNSBL_SUFFIX = 'dnsbl.httpbl.org.'
diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -23,6 +23,7 @@ setuptools.setup(
keywords='honeypot',
author='Gavin M. Roy',
author_email='[email protected]',
+ long_description=open('README.rst').read(),
url='https://github.com/gmr/httpbl',
license='BSD',
py_modules=['httpbl'], | Include the description on pypi | gmr_httpbl | train | py,py |
ccb81f36009d2bc8bce14bf269785c0de3a082a2 | diff --git a/mutagen/_util.py b/mutagen/_util.py
index <HASH>..<HASH> 100644
--- a/mutagen/_util.py
+++ b/mutagen/_util.py
@@ -54,31 +54,6 @@ def hashable(cls):
return cls
-def _create_enum_class(ffi, type_name, prefix):
- """Returns a new shiny class for the given enum type"""
-
- class _template(int):
- _map = {}
-
- @property
- def value(self):
- return int(self)
-
- def __repr__(self):
- return "%s.%s" % (type(self).__name__,
- self._map.get(self, "__UNKNOWN__"))
-
- cls = type(type_name, _template.__bases__, dict(_template.__dict__))
- prefix_len = len(prefix)
- for value, name in ffi.typeof(type_name).elements.items():
- assert name[:prefix_len] == prefix
- name = name[prefix_len:]
- setattr(cls, name, cls(value))
- cls._map[value] = name
-
- return cls
-
-
def enum(cls):
assert cls.__bases__ == (object,) | remove some erroneously included code | quodlibet_mutagen | train | py |
6abfc2276256a20bb57453c81a44fd3df13a35b9 | diff --git a/src/Monolog/Formatter/FluentdFormatter.php b/src/Monolog/Formatter/FluentdFormatter.php
index <HASH>..<HASH> 100644
--- a/src/Monolog/Formatter/FluentdFormatter.php
+++ b/src/Monolog/Formatter/FluentdFormatter.php
@@ -14,7 +14,7 @@ namespace Monolog\Formatter;
/**
* Class FluentdFormatter
*
- * Serializes a log message to Fluetd unix socket protocol
+ * Serializes a log message to Fluentd unix socket protocol
*
* Fluentd config:
*
@@ -63,11 +63,11 @@ class FluentdFormatter implements FormatterInterface
. ', '
. $record['datetime']->getTimestamp()
. ', '
- . json_encode([
+ . json_encode(array(
'message' => $record['message'],
'level' => $record['level'],
'level_name' => $record['level_name'],
- 'extra' => $record['extra']])
+ 'extra' => $record['extra']))
. ']';
} | Fix Fluentd array notation to support older PHP versions | Seldaek_monolog | train | php |
42a99dc76cb4752c64e968f5f090bfdfba600cab | diff --git a/src/Flex.php b/src/Flex.php
index <HASH>..<HASH> 100644
--- a/src/Flex.php
+++ b/src/Flex.php
@@ -324,6 +324,10 @@ class Flex implements PluginInterface, EventSubscriberInterface
return;
}
+ // Remove LICENSE (which do not apply to the user project)
+ @unlink('LICENSE');
+
+ // Update composer.json (project is proprietary by default)
$json = new JsonFile(Factory::getComposerFile());
$contents = file_get_contents($json->getPath());
$manipulator = new JsonManipulator($contents); | Remove the LICENSE file of the skeletons as it should not apply to the user project | symfony_flex | train | php |
2608a0ebe7aa5c67bdddc9a2825f0bf2f1af7a57 | diff --git a/lib/OpenLayers/Map.js b/lib/OpenLayers/Map.js
index <HASH>..<HASH> 100644
--- a/lib/OpenLayers/Map.js
+++ b/lib/OpenLayers/Map.js
@@ -580,8 +580,8 @@ OpenLayers.Map = OpenLayers.Class({
// Because Mozilla does not support the "resize" event for elements
// other than "window", we need to put a hack here.
- if (OpenLayers.String.contains(navigator.appName, "Microsoft")) {
- // If IE, register the resize on the div
+ if (parseFloat(navigator.appVersion.split("MSIE")[1]) < 9) {
+ // If IE < 9, register the resize on the div
this.events.register("resize", this, this.updateSize);
} else {
// Else updateSize on catching the window's resize | fix resize handling in IE 9 and better (refs #<I>) | openlayers_openlayers | train | js |
b6b0b58a8fd5066a0b4eeedf072b274fd7b1dc87 | diff --git a/json-path/src/main/java/com/jayway/jsonpath/JsonPath.java b/json-path/src/main/java/com/jayway/jsonpath/JsonPath.java
index <HASH>..<HASH> 100644
--- a/json-path/src/main/java/com/jayway/jsonpath/JsonPath.java
+++ b/json-path/src/main/java/com/jayway/jsonpath/JsonPath.java
@@ -104,7 +104,7 @@ public class JsonPath {
public JsonPath(String jsonPath, Filter[] filters) {
if (jsonPath == null ||
- jsonPath.trim().isEmpty() ||
+ jsonPath.trim().length()==0 ||
jsonPath.matches("[^\\?\\+\\=\\-\\*\\/\\!]\\(")) {
throw new InvalidPathException("Invalid path"); | Use length==0 instead of "isEmpty" which crashes on Android <I> where the method is missing. | json-path_JsonPath | train | java |
fc99692219bb9188cae72a9840a082c646560d3b | diff --git a/lib/storage.js b/lib/storage.js
index <HASH>..<HASH> 100644
--- a/lib/storage.js
+++ b/lib/storage.js
@@ -467,7 +467,7 @@ Storage.prototype.get_package = function(name, callback) {
if (!~whitelist.indexOf(i)) delete result[i]
}
- result['dist-tags'].latest = Object.keys(result.versions).sort(semver.compare)
+ result['dist-tags'].latest = Object.keys(result.versions).sort(semver.compareLoose)
for (var i in result['dist-tags']) {
if (Array.isArray(result['dist-tags'][i])) {
result['dist-tags'][i] = result['dist-tags'][i][result['dist-tags'][i].length-1]
@@ -505,7 +505,7 @@ Storage._merge_versions = function(local, up) {
}
if (local['dist-tags'][i].indexOf(up['dist-tags'][i]) === -1) {
local['dist-tags'][i].push(up['dist-tags'][i])
- local['dist-tags'][i].sort(semver.compare)
+ local['dist-tags'][i].sort(semver.compareLoose)
}
}
} | Update semver.compare to semver.compareLoose to tolerate grunt and other packages | verdaccio_verdaccio | train | js |
bd5f40441c90787f30d63481a428ee79f62b714a | diff --git a/fbcore/src/main/java/com/facebook/datasource/BaseDataSubscriber.java b/fbcore/src/main/java/com/facebook/datasource/BaseDataSubscriber.java
index <HASH>..<HASH> 100644
--- a/fbcore/src/main/java/com/facebook/datasource/BaseDataSubscriber.java
+++ b/fbcore/src/main/java/com/facebook/datasource/BaseDataSubscriber.java
@@ -39,10 +39,15 @@ public abstract class BaseDataSubscriber<T> implements DataSubscriber<T> {
@Override
public void onNewResult(DataSource<T> dataSource) {
+ // isFinished() should be checked before calling onNewResultImpl(), otherwise
+ // there would be a race condition: the final data source result might be ready before
+ // we call isFinished() here, which would lead to the loss of the final result
+ // (because of an early dataSource.close() call).
+ final boolean shouldClose = dataSource.isFinished();
try {
onNewResultImpl(dataSource);
} finally {
- if (dataSource.isFinished()) {
+ if (shouldClose) {
dataSource.close();
}
} | call isFinished() early to avoid race condition in BaseDataSubscriber | facebook_fresco | train | java |
0af662b2d829ef786398a41612be1ffef5f28119 | diff --git a/spec/support/example/parser_example_group.rb b/spec/support/example/parser_example_group.rb
index <HASH>..<HASH> 100644
--- a/spec/support/example/parser_example_group.rb
+++ b/spec/support/example/parser_example_group.rb
@@ -48,10 +48,10 @@ end
RSpec::configure do |c|
def c.escaped_path(*parts)
- Regexp.compile(parts.join('[\\\/]'))
+ /#{parts.join('\/')}/
end
- c.include ParserExampleGroup, :type => :controller, :example_group => {
+ c.include ParserExampleGroup, :example_group => {
:file_path => c.escaped_path(%w( spec whois answer parser ))
}
end | Fixed incompatibility with JRuby <I> | weppos_whois | train | rb |
bb89ef5330f9cf0922d0895fda3f8afcc2267360 | diff --git a/spyderlib/widgets/externalshell/sitecustomize.py b/spyderlib/widgets/externalshell/sitecustomize.py
index <HASH>..<HASH> 100644
--- a/spyderlib/widgets/externalshell/sitecustomize.py
+++ b/spyderlib/widgets/externalshell/sitecustomize.py
@@ -410,6 +410,17 @@ if os.environ.get("IPYTHON_KERNEL", "").lower() == "true":
# Set Pandas output encoding
pd.options.display.encoding = 'utf-8'
+
+ # Filter warning that appears only on Windows and Spyder for
+ # DataFrames with np.nan values in Pandas 0.17-
+ # Example:
+ # import pandas as pd, numpy as np
+ # pd.Series([np.nan,np.nan,np.nan],index=[1,2,3])
+ # Fixes Issue 2991
+ import warnings
+ warnings.filterwarnings(action='ignore', category=RuntimeWarning,
+ module='pandas.core.format',
+ message=".*invalid value encountered in.*")
except (ImportError, AttributeError):
pass | Sitecustomize: Filter a RuntimeWarning generated for DataFrames with nan values
Fixes #<I> | spyder-ide_spyder | train | py |
bd2e4e077a22ef150d0279d3b866f6fb9e571dfe | diff --git a/test.py b/test.py
index <HASH>..<HASH> 100755
--- a/test.py
+++ b/test.py
@@ -56,7 +56,11 @@ class TestMPDClient(unittest.TestCase):
self.client.send_status()
self.client.fetch_status()
def test_idle(self):
+ # clean event mask
+ self.idleclient.idle()
+
self.idleclient.send_idle()
+ # new event
self.client.update()
event = self.idleclient.fetch_idle()
self.assertEqual(event, ['update']) | Clean idle mask in tests to get clean state | Mic92_python-mpd2 | train | py |
22f3d57906b03dc82a44416b8a730602c7ec317d | diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100755
--- a/setup.py
+++ b/setup.py
@@ -24,7 +24,7 @@ from linaro_json import get_version
setup(
- name = 'linaro-python-json',
+ name = 'linaro-json',
version = get_version(),
author = "Zygmunt Krynicki",
author_email = "[email protected]", | Change project name to linaro-json | zyga_json-schema-validator | train | py |
7eefb8cb64ef373f6d32b5c998f27b531f47dce9 | diff --git a/django_q/tasks.py b/django_q/tasks.py
index <HASH>..<HASH> 100644
--- a/django_q/tasks.py
+++ b/django_q/tasks.py
@@ -449,6 +449,7 @@ class Iter(object):
self.args.append(args)
if self.started:
self.started = False
+ return self.length()
def run(self):
"""
@@ -511,6 +512,7 @@ class Chain(object):
if self.started:
delete_group(self.group)
self.started = False
+ return self.length()
def run(self):
""" | returns the size of the chain or iter on append | Koed00_django-q | train | py |
Subsets and Splits