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
08c4b073f3850235bc85dd757874de66038add04
diff --git a/webpack.config.dist.js b/webpack.config.dist.js index <HASH>..<HASH> 100644 --- a/webpack.config.dist.js +++ b/webpack.config.dist.js @@ -1,15 +1,22 @@ const path = require("path"); +const webpack = require("webpack"); module.exports = { - devtool: "source-map", - entry: ["./src/index.js"], + entry: { + "js-worker-search": "./src/index.js" + }, output: { path: "dist", - filename: "js-worker-search.js", + filename: "[name].js", libraryTarget: "commonjs2", library: "redux-search" }, - plugins: [], + plugins: [ + new webpack.SourceMapDevToolPlugin({ + exclude: /.*worker\.js$/, + filename: "[name].js.map" + }) + ], module: { loaders: [ {
fix: exclude source maps for worker scripts Fixes #<I>
bvaughn_js-worker-search
train
js
9b6599d02ea7a464f25e279156b0c1de8c991e52
diff --git a/notario/validators/be.py b/notario/validators/be.py index <HASH>..<HASH> 100644 --- a/notario/validators/be.py +++ b/notario/validators/be.py @@ -4,25 +4,31 @@ def string(value): """ Validates a given input is of type string. """ - return isinstance(value, basestring) + assert isinstance(value, basestring) def boolean(value): """ Validates a given input is of type boolean. """ - return isinstance(value, bool) + assert isinstance(value, bool) def dictionary(value): """ Validates a given input is of type dictionary. """ - return isinstance(value, dict) + assert isinstance(value, dict) def array(value): """ Validates a given input is of type list. """ - return isinstance(value, list) + assert isinstance(value, list) + +def integer(value): + """ + Validates a given input is of type int.. + """ + assert isinstance(value, int), "not of type int"
is integer is absolutely needed for validators
alfredodeza_notario
train
py
5998f7132aea4148c0fbea02bd5cb9e413a0fd75
diff --git a/leonardo/module/media/management/commands/import_files.py b/leonardo/module/media/management/commands/import_files.py index <HASH>..<HASH> 100644 --- a/leonardo/module/media/management/commands/import_files.py +++ b/leonardo/module/media/management/commands/import_files.py @@ -65,7 +65,7 @@ class FileImporter(object): return None current_parent = None for folder_name in folder_names: - current_parent, created = Folder.objects.get_or_create(name=folder_name, parent=current_parent) + current_parent, created = LeonardoFolder.objects.get_or_create(name=folder_name, parent=current_parent) if created: self.folder_created += 1 if self.verbosity >= 2:
use loanardo folder for importing
django-leonardo_django-leonardo
train
py
3df264501f85a414b62a128ba95f679be09e961f
diff --git a/lib/workers/package-file/index.js b/lib/workers/package-file/index.js index <HASH>..<HASH> 100644 --- a/lib/workers/package-file/index.js +++ b/lib/workers/package-file/index.js @@ -29,6 +29,10 @@ async function renovatePackageFile(packageFileConfig) { return [config]; } + if (packageContent.workspaces) { + logger.warn('Found workspaces'); + } + // Check for renovate config inside the package.json if (packageContent.renovate) { logger.trace( diff --git a/test/workers/package-file/index.spec.js b/test/workers/package-file/index.spec.js index <HASH>..<HASH> 100644 --- a/test/workers/package-file/index.spec.js +++ b/test/workers/package-file/index.spec.js @@ -65,7 +65,7 @@ describe('packageFileWorker', () => { expect(res).toEqual([]); }); it('calls depTypeWorker', async () => { - config.api.getFileJson.mockReturnValueOnce({}); + config.api.getFileJson.mockReturnValueOnce({ workspaces: true }); depTypeWorker.renovateDepType.mockReturnValueOnce([{}]); depTypeWorker.renovateDepType.mockReturnValueOnce([{}, {}]); depTypeWorker.renovateDepType.mockReturnValueOnce([]);
chore: add warning if yarn workspaces found (#<I>)
renovatebot_renovate
train
js,js
40881f1e34b17cd2202c9b22e1cb4486d27a1ae3
diff --git a/lib/upnp/control_point.rb b/lib/upnp/control_point.rb index <HASH>..<HASH> 100644 --- a/lib/upnp/control_point.rb +++ b/lib/upnp/control_point.rb @@ -55,7 +55,7 @@ module UPnP options[:response_wait_time] ||= 5 options[:m_search_count] ||= @search_count - ttl = options[:response_wait_time] || 4 + options[:ttl] ||= 4 starter = -> do ssdp_search_and_listen(@search_target, options)
This should've gone with search/listen combo commit
turboladen_playful
train
rb
6143f635608d30461a9e5e33de3c392a87a0e980
diff --git a/tests/wipy/wlan/wlan.py b/tests/wipy/wlan/wlan.py index <HASH>..<HASH> 100644 --- a/tests/wipy/wlan/wlan.py +++ b/tests/wipy/wlan/wlan.py @@ -97,7 +97,7 @@ print(wifi.isconnected() == False) # test init again wifi.init(WLAN.AP, ssid='www.wipy.io', auth=None, channel=5, antenna=WLAN.INT_ANT) -print(len(wlan.mac()) == 6) +print(len(wifi.mac()) == 6) # next ones MUST raise try:
tests/wipy: Fix error in wlan test.
micropython_micropython
train
py
c0fdfed8c146100cd9c6138d601b18841d9a49a6
diff --git a/code/model/Order.php b/code/model/Order.php index <HASH>..<HASH> 100644 --- a/code/model/Order.php +++ b/code/model/Order.php @@ -870,7 +870,7 @@ class Order extends DataObject { if($payments = $this->Payments()) { foreach($payments as $payment) { if($payment->Status == 'Success') { - $paid += $payment->Amount->getValue(); + $paid += $payment->getValue(); } } }
fixed getAmount in order (bug)
silvershop_silvershop-core
train
php
de9d33b2cfb1e7bd904c8da66bfd0af65a633612
diff --git a/test/runner-browser.js b/test/runner-browser.js index <HASH>..<HASH> 100644 --- a/test/runner-browser.js +++ b/test/runner-browser.js @@ -1,6 +1,7 @@ // Readd promise polyfills for legacy browsers since karma-webpack removes them require('core-js/fn/promise') require('core-js/fn/object/assign') +require('core-js/fn/array/from') // This file is required due to an issue with karma-tap // https://github.com/tmcw-up-for-adoption/karma-tap/issues/10 diff --git a/webpack.config.js b/webpack.config.js index <HASH>..<HASH> 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -112,7 +112,8 @@ legacyBundle.module.loaders = [ // https://github.com/babel/babel-preset-env/pull/241 legacyBundle.entry = [ 'core-js/fn/promise', - 'core-js/fn/object/assign' + 'core-js/fn/object/assign', + 'core-js/fn/array/from' ].concat(legacyBundle.entry) legacyBundle.output.filename = `${baseFileName}.legacy${PROD ? '.min' : ''}.js`
fix(polyfill): add array from polyfill for IE
contentful_contentful.js
train
js,js
f28b624c97cb20ce4254513a305829e269734622
diff --git a/plenum/server/consensus/view_change_service.py b/plenum/server/consensus/view_change_service.py index <HASH>..<HASH> 100644 --- a/plenum/server/consensus/view_change_service.py +++ b/plenum/server/consensus/view_change_service.py @@ -329,6 +329,11 @@ class NewViewBuilder: continue # Don't add checkpoint to pretending ones if not enough nodes have it + # TODO: PBFT paper (for example Fig.4 in https://www.microsoft.com/en-us/research/wp-content/uploads/2017/01/p398-castro-bft-tocs.pdf) + # assumes a weak certificate here. + # But they also assume a need of catch-up before processing NewView if a Replica doesn't have the calculated checkpoint yet + # It looks like using a strong certificate eliminates a need for cathcup (although re-ordering may be slower) + # Once https://jira.hyperledger.org/browse/INDY-2237 is done, we may come back to weak certificate here have_checkpoint = [vc for vc in vcs if cur_cp in vc.checkpoints] if not self._data.quorums.strong.is_reached(len(have_checkpoint)): continue
add TODO comment for deviation from the paper
hyperledger_indy-plenum
train
py
e7f245e84ece8d23a846baf10cf5f65fecb34da9
diff --git a/LiSE/character.py b/LiSE/character.py index <HASH>..<HASH> 100644 --- a/LiSE/character.py +++ b/LiSE/character.py @@ -1109,6 +1109,14 @@ class Portal(GraphEdgeMapping.Edge): """Return a JSON representation of my present state""" return json_dump(self._get_json_dict()) + def delete(self): + """Remove myself from my :class:`Character`. + + For symmetry with :class:`Thing` and :class`Place`. + + """ + del self.character.portal[self.origin][self.destination] + class CharacterThingMapping(MutableMapping, RuleFollower): """:class:`Thing` objects that are in a :class:`Character`"""
Portal.delete() for consistency reasons
LogicalDash_LiSE
train
py
ad1da969ee73bb9a21ad9f62c2f0e55cd7d06b3b
diff --git a/lib/ruboty/action.rb b/lib/ruboty/action.rb index <HASH>..<HASH> 100644 --- a/lib/ruboty/action.rb +++ b/lib/ruboty/action.rb @@ -13,8 +13,7 @@ module Ruboty def call(handler, message, options = {}) if !!options[:missing] == missing? && message.match(pattern_with(handler.robot.name)) - handler.send(name, message) - true + !!handler.send(name, message) else false end diff --git a/lib/ruboty/robot.rb b/lib/ruboty/robot.rb index <HASH>..<HASH> 100644 --- a/lib/ruboty/robot.rb +++ b/lib/ruboty/robot.rb @@ -31,6 +31,12 @@ module Ruboty end end + # @return [true] Because it needs to tell that an action is matched. + def say(*args) + adapter.say(*args) + true + end + # ROBOT_NAME is deprecated. def name ENV["RUBOTY_NAME"] || ENV["ROBOT_NAME"] || DEFAULT_ROBOT_NAME
Use action's returned-value to check if the action is matched or not So you need to return truthy value from action, or to return false if you want not to tell that the action is matched.
r7kamura_ruboty
train
rb,rb
4fd070e3172a7c702d9c0fe4f44af43e14d83c30
diff --git a/service/src/main/java/org/ops4j/pax/wicket/internal/Activator.java b/service/src/main/java/org/ops4j/pax/wicket/internal/Activator.java index <HASH>..<HASH> 100644 --- a/service/src/main/java/org/ops4j/pax/wicket/internal/Activator.java +++ b/service/src/main/java/org/ops4j/pax/wicket/internal/Activator.java @@ -84,9 +84,9 @@ public final class Activator implements BundleActivator { } public final void stop(BundleContext context) throws Exception { + bundleTrackerAggregator.close(); context.removeBundleListener(paxWicketBundleListener); httpTracker.close(); - bundleTrackerAggregator.close(); httpTracker = null; applicationFactoryTracker = null;
[PAXWICKET-<I>] Correct order in activator
ops4j_org.ops4j.pax.wicket
train
java
d8cbe1ac78719b54fb529fb5433a9159a7ca4805
diff --git a/elasticsearch/connection.py b/elasticsearch/connection.py index <HASH>..<HASH> 100644 --- a/elasticsearch/connection.py +++ b/elasticsearch/connection.py @@ -85,7 +85,7 @@ class RequestsHttpConnection(Connection): raw_data = response.text except (requests.ConnectionError, requests.Timeout) as e: self.log_request_fail(method, request.url, time.time() - start, exception=e) - raise ConnectionError(e) + raise ConnectionError('N/A', str(e), e) # raise errors based on http status codes, let the client handle those if needed if not (200 <= response.status_code < 300): diff --git a/elasticsearch/serializer.py b/elasticsearch/serializer.py index <HASH>..<HASH> 100644 --- a/elasticsearch/serializer.py +++ b/elasticsearch/serializer.py @@ -13,7 +13,7 @@ class JSONSerializer(object): try: return json.loads(s) except (ValueError, TypeError) as e: - raise SerializationError(e) + raise SerializationError(s, e) def dumps(self, data): # don't serialize strings @@ -23,6 +23,6 @@ class JSONSerializer(object): try: return json.dumps(data, default=self.default) except (ValueError, TypeError) as e: - raise SerializationError(e) + raise SerializationError(data, e)
More power to the SerializationError
elastic_elasticsearch-py
train
py,py
41fced3daa13bb43552dd067585b9fd6cce08e06
diff --git a/pipeline/middleware.py b/pipeline/middleware.py index <HASH>..<HASH> 100644 --- a/pipeline/middleware.py +++ b/pipeline/middleware.py @@ -6,8 +6,14 @@ from django.utils.html import strip_spaces_between_tags as minify_html from pipeline.conf import settings +try: + # Support for Django 1.10 new MIDDLEWARE setting + from django.utils.deprecation import MiddlewareMixin +except ImportError: # Django < 1.10 + MiddlewareMixin = object -class MinifyHTMLMiddleware(object): + +class MinifyHTMLMiddleware(MiddlewareMixin): def __init__(self): if not settings.PIPELINE_ENABLED: raise MiddlewareNotUsed
Added compatibility for Django <I> new style middleware
jazzband_django-pipeline
train
py
b1eeb2ef1a9298154d26a0dee0ea9ad8140de8b9
diff --git a/hazelcast/src/main/java/com/hazelcast/instance/Node.java b/hazelcast/src/main/java/com/hazelcast/instance/Node.java index <HASH>..<HASH> 100644 --- a/hazelcast/src/main/java/com/hazelcast/instance/Node.java +++ b/hazelcast/src/main/java/com/hazelcast/instance/Node.java @@ -202,10 +202,6 @@ public class Node { this.multicastService = mcService; initializeListeners(config); joiner = nodeContext.createJoiner(this); - - if(getGroupProperties().HEALTH_MONITORING_ENABLED.getBoolean()){ - new MemoryMonitor(this).start(); - } } private void initializeListeners(Config config) { @@ -334,6 +330,11 @@ public class Node { logger.warning("ManagementCenterService could not be constructed!", e); } initializer.afterInitialize(this); + + if(getGroupProperties().HEALTH_MONITORING_ENABLED.getBoolean()){ + logger.finest("Starting memory monitor"); + new MemoryMonitor(this).start(); + } } public void shutdown(final boolean force, final boolean now) {
Moved the startup of the memorymonitor to node.start
hazelcast_hazelcast
train
java
ab0abf7f72ad2b80dab37a7b1c912650bcc1a02c
diff --git a/manticore/core/executor.py b/manticore/core/executor.py index <HASH>..<HASH> 100644 --- a/manticore/core/executor.py +++ b/manticore/core/executor.py @@ -200,22 +200,21 @@ class State(object): return expr - def new_symbolic_value(self, nbits, **options): + def new_symbolic_value(self, nbits, label='val', taint=frozenset()): '''Create and return a symbolic value that is |nbits| bits wide. Assign the value to a register or write it into the address space to introduce it into the program state. Args: nbits - The bitwidth of the value returned. - options - Options to set on the returned expression. Valid options: - label -- The label to assign to the value. + label - The label to assign to the value. + taint - A tuple or frozenset of values to use as taint identifiers. Returns: Expression representing the value. ''' assert nbits in (1, 4, 8, 16, 32, 64, 128, 256) - name = options.get('label', 'val') - expr = self.constraints.new_bitvec(nbits, name=name) + expr = self.constraints.new_bitvec(nbits, name=label, taint=taint) self.input_symbols.append(expr) return expr
Refactor `new_symbolic_value` (#<I>) * Use default params instead of dict, add taint * Update docstring
trailofbits_manticore
train
py
0be880826e286c6b8737c52561d906beaa770e32
diff --git a/src/pybel/manager/models.py b/src/pybel/manager/models.py index <HASH>..<HASH> 100644 --- a/src/pybel/manager/models.py +++ b/src/pybel/manager/models.py @@ -386,6 +386,9 @@ class Author(Base): def __str__(self): return self.name + def __repr__(self): + return f'Author(name="{self.name}")' + class Citation(Base): """The information about the citations that are used to prove a specific relation are stored in this table."""
Add repr for Author [skip ci]
pybel_pybel
train
py
d6437d31d4e99291d25b84584920db3431fb26c9
diff --git a/lib/generate/index.js b/lib/generate/index.js index <HASH>..<HASH> 100644 --- a/lib/generate/index.js +++ b/lib/generate/index.js @@ -64,7 +64,7 @@ var generate = function(options) { try { var _config = require(path.resolve(options.input, options.configFile)); - options = _.merge(options, _.omit(_config, 'input', 'configFile', 'defaultsPlugins')); + options = _.merge(options, _.omit(_config, 'input', 'configFile', 'defaultsPlugins', 'generator')); } catch(err) { // No config file: not a big deal
Omit "generator" when building file with config file
GitbookIO_gitbook
train
js
5a1f927310414ca47408c3f2f81a0b43beb8cb19
diff --git a/sites/shared_conf.py b/sites/shared_conf.py index <HASH>..<HASH> 100644 --- a/sites/shared_conf.py +++ b/sites/shared_conf.py @@ -5,12 +5,6 @@ import sys import alabaster -# Add local blog extension -sys.path.append(os.path.abspath('.')) -extensions = ['blog'] -rss_link = 'http://paramiko.org' -rss_description = 'Paramiko project news' - # Alabaster theme html_theme_path = [alabaster.get_path()] # Paths relative to invoking conf.py - not this shared file diff --git a/sites/www/conf.py b/sites/www/conf.py index <HASH>..<HASH> 100644 --- a/sites/www/conf.py +++ b/sites/www/conf.py @@ -2,3 +2,10 @@ import os, sys sys.path.append(os.path.abspath('..')) from shared_conf import * + +# Add local blog extension +sys.path.append(os.path.abspath('.')) +extensions = ['blog'] +rss_link = 'http://paramiko.org' +rss_description = 'Paramiko project news' +
Blog only used/exists in www, don't import it in docs site
paramiko_paramiko
train
py,py
1b2dcd516e430915f698d574513f93bb1bce4b68
diff --git a/ui-ace.js b/ui-ace.js index <HASH>..<HASH> 100644 --- a/ui-ace.js +++ b/ui-ace.js @@ -26,7 +26,7 @@ angular.module('ui.ace', []) onChange = function (callback) { return function (e) { var newValue = session.getValue(); - if (newValue !== scope.$eval(attrs.value) && !scope.$$phase) { + if (newValue !== scope.$eval(attrs.value) && !scope.$$phase && !scope.$root.$$phase) { if (angular.isDefined(ngModel)) { scope.$apply(function () { ngModel.$setViewValue(newValue);
fix(ui-ace): issue with digest already in progress error
angular-ui_ui-ace
train
js
e7531c461abd34830eeda4e5ebe8128026579f30
diff --git a/addon/components/discover-page/component.js b/addon/components/discover-page/component.js index <HASH>..<HASH> 100644 --- a/addon/components/discover-page/component.js +++ b/addon/components/discover-page/component.js @@ -423,7 +423,7 @@ export default Ember.Component.extend(Analytics, { hyperLinks: [// Links that are hyperlinks from hit._source.lists.links { type: 'share', - url: config.SHARE.baseUrl + 'preprint/' + hit._id + url: config.SHARE.baseUrl + `${hit._source.type}` + '/' + hit._id } ], infoLinks: [], // Links that are not hyperlinks hit._source.lists.links
Instead of hardcoding preprint, use resource type to build SHARE url.
CenterForOpenScience_ember-osf
train
js
b4d806828d53d5088f189951cfe446049e01f9f0
diff --git a/lib/github/kv.rb b/lib/github/kv.rb index <HASH>..<HASH> 100644 --- a/lib/github/kv.rb +++ b/lib/github/kv.rb @@ -73,7 +73,7 @@ module GitHub @encapsulated_errors = encapsulated_errors @use_local_time = use_local_time @conn_block = conn_block - raise InvalidConnectionError, "CLIENT_FOUND_ROWS must not be set" unless found_rows_is_set?(connection) + raise InvalidConnectionError, "CLIENT_FOUND_ROWS must be set" unless found_rows_is_set?(connection) end def connection
CLIENT_FOUND_ROWS must be set
github_github-ds
train
rb
e62e207010e96a23ce1bbea139f38b473f8d3b07
diff --git a/post-install.js b/post-install.js index <HASH>..<HASH> 100644 --- a/post-install.js +++ b/post-install.js @@ -57,7 +57,7 @@ function getConfig (file, options = { home: false, json: true }) { /** * tests if an absolute path exists */ -export function exists (pathname) { +function exists (pathname) { try { return statSync(pathname) } catch (e) {
fix(northbrook): remove export statement
northbrookjs_northbrook
train
js
3798e24920bc7793ab86446b567a17ccc4366b65
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -33,7 +33,9 @@ setup( extras_require={ 'dev': [ 'coverage>=4', - 'django<1.9', + # NOTE: Keep this Django version up to date with latest the + # Django release; use tox for more thorough testing. + 'django>=1.9,<1.10', 'tox>=2.3.1', ], },
Install latest Django version in dev This is used for default dev and testing. Tox is used for testing all supported Python and Django versions.
PSU-OIT-ARC_django-local-settings
train
py
6664eb7d7ac8579143a0da1e70cdc6344549cf60
diff --git a/tests/error/test_located_error.py b/tests/error/test_located_error.py index <HASH>..<HASH> 100644 --- a/tests/error/test_located_error.py +++ b/tests/error/test_located_error.py @@ -1,3 +1,5 @@ +from typing import cast, Any + from pytest import raises # type: ignore from graphql.error import GraphQLError, located_error @@ -12,8 +14,7 @@ def describe_located_error(): def passes_graphql_error_through(): path = ["path", 3, "to", "field"] - # noinspection PyArgumentEqualDefault - e = GraphQLError("msg", None, None, None, path) # type: ignore + e = GraphQLError("msg", None, None, None, cast(Any, path)) assert located_error(e, [], []) == e def passes_graphql_error_ish_through(): @@ -23,6 +24,5 @@ def describe_located_error(): def does_not_pass_through_elasticsearch_like_errors(): e = Exception("I am from elasticsearch") - # noinspection PyTypeHints - e.path = "/something/feed/_search" # type: ignore + cast(Any, e).path = "/something/feed/_search" assert located_error(e, [], []) is not e
Cast to Any instead of ignoring type error Somewhat replicates graphql/graphql-js@<I>aa<I>b4ae<I>d<I>e6bd<I>cf7dc<I>c<I>
graphql-python_graphql-core-next
train
py
6e5cba02627269c6f170a44d20615e423804f9ab
diff --git a/docs/conf.py b/docs/conf.py index <HASH>..<HASH> 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -93,7 +93,7 @@ copyright = u'2014, Université de Montréal' # # The short X.Y version. import fuel -version = fuel.__version__[:fuel.__version__.rindex('.')] +version = '.'.join(fuel.__version__.split('.')[:2]) # The full version, including alpha/beta/rc tags. release = fuel.__version__
Robust extraction of first two parts of the version
mila-iqia_fuel
train
py
db7544ce156d4ca877661a6296bab0eec819eb6b
diff --git a/src/views/bill/_form.php b/src/views/bill/_form.php index <HASH>..<HASH> 100644 --- a/src/views/bill/_form.php +++ b/src/views/bill/_form.php @@ -104,8 +104,7 @@ $form = ActiveForm::begin([ <div class="col-md-2"> <?= $form->field($model, "[$i]time")->widget(DateTimePicker::class, [ 'model' => $model, - 'type' => DatePicker::TYPE_COMPONENT_APPEND, - 'pluginOptions' => [ + 'clientOptions' => [ 'autoclose' => true, 'format' => 'yyyy-mm-dd hh:ii:ss', ],
DateTimePicker options modified to work with 2amigos DateTimePicker
hiqdev_hipanel-module-finance
train
php
31edd392c96dd7af169f4a7b3683bc6c8660f6c9
diff --git a/src/database/migrations/2016_08_15_165500_page_version_track_chunk_changes.php b/src/database/migrations/2016_08_15_165500_page_version_track_chunk_changes.php index <HASH>..<HASH> 100644 --- a/src/database/migrations/2016_08_15_165500_page_version_track_chunk_changes.php +++ b/src/database/migrations/2016_08_15_165500_page_version_track_chunk_changes.php @@ -25,11 +25,15 @@ class PageVersionTrackChunkChanges extends Migration foreach ($types as $type) { $className = 'BoomCMS\Database\Models\Chunk\\'.ucfirst($type); - $chunk = (new $className()) + $count = (new $className()) ->where('page_vid', $version->getId()) - ->first(); + ->count(); + + if ($count === 1) { + $chunk = (new $className()) + ->where('page_vid', $version->getId()) + ->first(); - if ($chunk) { $version->{PageVersion::ATTR_CHUNK_TYPE} = $type; $version->{PageVersion::ATTR_CHUNK_ID} = $chunk->id; $version->save();
Page history: Updated migration to track chunk changes Now ignores versions where nature of content change can't be determined (multiple chunks exist for the version)
boomcms_boom-core
train
php
d5173b06743f11aa2af3fc15d9c88df305f9dd8b
diff --git a/yabt/buildcontext.py b/yabt/buildcontext.py index <HASH>..<HASH> 100644 --- a/yabt/buildcontext.py +++ b/yabt/buildcontext.py @@ -417,7 +417,8 @@ class BuildContext: docker_run.append(format_qualified_image_name(buildenv_target)) docker_run.extend(cmd) logger.info('Running command in build env "{}" using command {}', - buildenv_target_name, ' '.join(docker_run)) + buildenv_target_name, ' '.join( + format_for_cli(part) for part in docker_run)) # TODO: Consider changing the PIPEs to temp files. if 'stderr' not in kwargs: kwargs['stderr'] = PIPE @@ -653,3 +654,7 @@ class BuildContext: list(self.failed_nodes), self.skipped_nodes) else: logger.info('Finished building target graph successfully') + + +def format_for_cli(part): + return '"{}"'.format(part) if ' ' in part else part
take care of spaces in the docker run command
resonai_ybt
train
py
fa489bab59550ec20f17f1e7d1825f7578d28463
diff --git a/inc/roots-options.php b/inc/roots-options.php index <HASH>..<HASH> 100644 --- a/inc/roots-options.php +++ b/inc/roots-options.php @@ -40,6 +40,18 @@ function roots_theme_options_add_page() { } add_action('admin_menu', 'roots_theme_options_add_page'); +function roots_admin_bar_render() { + global $wp_admin_bar; + + $wp_admin_bar->add_menu(array( + 'parent' => 'appearance', + 'id' => 'theme_options', + 'title' => __('Theme Options', 'roots'), + 'href' => admin_url( 'themes.php?page=theme_options') + )); +} +add_action('wp_before_admin_bar_render', 'roots_admin_bar_render'); + global $roots_css_frameworks; $roots_css_frameworks = array( 'blueprint' => array(
added theme options to the wordpress admin bar
roots_sage
train
php
7f91115112afb4976609b8413a39ad2c30d01dbf
diff --git a/mouse/_nixmouse.py b/mouse/_nixmouse.py index <HASH>..<HASH> 100644 --- a/mouse/_nixmouse.py +++ b/mouse/_nixmouse.py @@ -27,7 +27,7 @@ def build_display(): def get_position(): build_display() - root_id, child_id = c_uint32(), c_uint32() + root_id, child_id = c_void_p(), c_void_p() root_x, root_y, win_x, win_y = c_int(), c_int(), c_int(), c_int() mask = c_uint() ret = x11.XQueryPointer(display, c_uint32(window), byref(root_id), byref(child_id),
fixed potentially unsafe <I> bit only types
boppreh_mouse
train
py
8f63272403a1843fdb6040b97821b363ae3318c8
diff --git a/lib/vagrant.rb b/lib/vagrant.rb index <HASH>..<HASH> 100644 --- a/lib/vagrant.rb +++ b/lib/vagrant.rb @@ -2,20 +2,13 @@ libdir = File.dirname(__FILE__) $:.unshift(libdir) PROJECT_ROOT = File.join(libdir, '..') -require 'ftools' -require 'json' -require 'pathname' -require 'logger' -require 'virtualbox' -require 'net/ssh' -require 'net/scp' -require 'tarruby' -require 'fileutils' -require 'vagrant/busy' -require 'vagrant/util' -require 'vagrant/commands' -require 'vagrant/config' -require 'vagrant/env' -require 'vagrant/provisioning' -require 'vagrant/ssh' -require 'vagrant/vm' +# The libs which must be loaded prior to the rest +%w{ftools json pathname logger virtualbox net/ssh + net/scp tarruby fileutils vagrant/util}.each do |f| + require f +end + +# Glob require the rest +Dir[File.join(PROJECT_ROOT, "lib", "vagrant", "**", "*.rb")].each do |f| + require f +end
Cleaned up the requiring of files in vagrant.rb
hashicorp_vagrant
train
rb
8451618a36b0411b6c3f8b80229054cd82c59632
diff --git a/openfisca_core/formulas.py b/openfisca_core/formulas.py index <HASH>..<HASH> 100644 --- a/openfisca_core/formulas.py +++ b/openfisca_core/formulas.py @@ -35,7 +35,7 @@ from . import holders log = logging.getLogger(__name__) -class AbstractFormula(object): +class Formula(object): holder = None def __init__(self, holder = None): @@ -43,7 +43,7 @@ class AbstractFormula(object): self.holder = holder -class AbstractSimpleFormula(AbstractFormula): +class SimpleFormula(Formula): holder_by_parameter = None parameters = None # class attribute requires_default_legislation = False # class attribute @@ -51,7 +51,7 @@ class AbstractSimpleFormula(AbstractFormula): requires_self = False # class attribute def __init__(self, holder = None): - super(AbstractSimpleFormula, self).__init__(holder = holder) + super(SimpleFormula, self).__init__(holder = holder) holder = self.holder column = holder.column
Remove "Abstract" from formula names.
openfisca_openfisca-core
train
py
70ac00595b37c62055df6486355c9e2a1fbc4b13
diff --git a/terraform/context_apply_test.go b/terraform/context_apply_test.go index <HASH>..<HASH> 100644 --- a/terraform/context_apply_test.go +++ b/terraform/context_apply_test.go @@ -8980,12 +8980,6 @@ Outputs: result_1 = hello result_3 = hello world - -module.child: - <no state> - Outputs: - - result = hello `) if got != want { t.Fatalf("wrong final state\ngot:\n%s\nwant:\n%s", got, want) diff --git a/terraform/terraform_test.go b/terraform/terraform_test.go index <HASH>..<HASH> 100644 --- a/terraform/terraform_test.go +++ b/terraform/terraform_test.go @@ -441,12 +441,6 @@ const testTerraformApplyEmptyModuleStr = ` Outputs: end = XXXX - -module.child: -<no state> -Outputs: - -aws_route53_zone_id = XXXX ` const testTerraformApplyDependsCreateBeforeStr = ` @@ -661,12 +655,6 @@ aws_instance.bar: provider = provider["registry.terraform.io/hashicorp/aws"] foo = true type = aws_instance - -module.child: - <no state> - Outputs: - - leader = true ` const testTerraformApplyModuleDestroyOrderStr = `
fix apply tests sSme apply tests had outputs in empty modules, which won't be saved to state.
hashicorp_terraform
train
go,go
c1ae828b6faff36953b2437487017f4d36a5ae33
diff --git a/data/preferences.js b/data/preferences.js index <HASH>..<HASH> 100644 --- a/data/preferences.js +++ b/data/preferences.js @@ -53,6 +53,7 @@ exports.DEFAULT_FENNEC_PREFS = { exports.DEFAULT_FIREFOX_PREFS = { "browser.startup.homepage" : "about:blank", "startup.homepage_welcome_url" : "about:blank", + "startup.homepage_welcome_url.additional" : "", "devtools.errorconsole.enabled" : true, "devtools.chrome.enabled" : true,
Don't show additional firstrun page on official builds This was pointed out on IRC, see <URL> in <URL>
mozilla-jetpack_jpm
train
js
e62332aba6d12eb36896c8caf87f0ecc1377832a
diff --git a/lib/rscons/application.rb b/lib/rscons/application.rb index <HASH>..<HASH> 100644 --- a/lib/rscons/application.rb +++ b/lib/rscons/application.rb @@ -75,6 +75,8 @@ module Rscons end if rv == 0 build(operation_options) + else + rv end when "clean" clean diff --git a/spec/build_tests_spec.rb b/spec/build_tests_spec.rb index <HASH>..<HASH> 100644 --- a/spec/build_tests_spec.rb +++ b/spec/build_tests_spec.rb @@ -2257,6 +2257,7 @@ EOF result = run_rscons(rsconscript: "autoconf_fail.rb") expect(result.stdout).to match /Checking for C compiler\.\.\. not found/ expect(result.status).to_not eq 0 + expect(result.stderr).to_not match /from\s/ end it "exits with an error if configuration has not been performed before attempting to create an environment" do
avoid backtrace when configuring fails during autoconf
holtrop_rscons
train
rb,rb
8bcfd16f19baf379a7c8fea1652130856d5d0f40
diff --git a/core/client/mixins/editor-route-base.js b/core/client/mixins/editor-route-base.js index <HASH>..<HASH> 100644 --- a/core/client/mixins/editor-route-base.js +++ b/core/client/mixins/editor-route-base.js @@ -22,7 +22,10 @@ var EditorRouteBase = Ember.Mixin.create(styleBody, ShortcutsRoute, loadingIndic // The actual functionality is implemented in utils/codemirror-shortcuts codeMirrorShortcut: function (options) { - this.get('controller.codemirror').shortcut(options.type); + // Only fire editor shortcuts when the editor has focus. + if (Ember.$('.CodeMirror.CodeMirror-focused').length > 0) { + this.get('controller.codemirror').shortcut(options.type); + } } },
Editor must be focused before allowing certain keyboard shortcuts. closes #<I> - checked for the CodeMirror-focused class on the CodeMirror div - used length to determine whether CodeMirror-focused has been added - determines whether the editor has been focused on
TryGhost_Ghost
train
js
dc23f34d47dc3ad20d2b4330cc1c917358b46815
diff --git a/djstripe/admin.py b/djstripe/admin.py index <HASH>..<HASH> 100644 --- a/djstripe/admin.py +++ b/djstripe/admin.py @@ -152,7 +152,7 @@ class StripeModelAdmin(admin.ModelAdmin): self.raw_id_fields = get_forward_relation_fields_for_model(self.model) def get_list_display(self, request): - return ("id",) + self.list_display + ("created", "livemode") + return ("__str__", "id") + self.list_display + ("created", "livemode") def get_list_filter(self, request): return self.list_filter + ("created", "livemode")
Set __str__ as first StripeModelAdmin list_display column
dj-stripe_dj-stripe
train
py
09eae7f2bcd045cddc0773e1e791ff663ec0d274
diff --git a/languagetool-language-modules/en/src/main/java/org/languagetool/rules/en/AbstractEnglishSpellerRule.java b/languagetool-language-modules/en/src/main/java/org/languagetool/rules/en/AbstractEnglishSpellerRule.java index <HASH>..<HASH> 100644 --- a/languagetool-language-modules/en/src/main/java/org/languagetool/rules/en/AbstractEnglishSpellerRule.java +++ b/languagetool-language-modules/en/src/main/java/org/languagetool/rules/en/AbstractEnglishSpellerRule.java @@ -36,7 +36,7 @@ import java.util.*; public abstract class AbstractEnglishSpellerRule extends MorfologikSpellerRule { - private final EnglishSynthesizer synthesizer = new EnglishSynthesizer(new English()); + private static final EnglishSynthesizer synthesizer = new EnglishSynthesizer(new English()); public AbstractEnglishSpellerRule(ResourceBundle messages, Language language) throws IOException { this(messages, language, null, Collections.emptyList());
speedup: don't re-init synthesizer for reach rule init
languagetool-org_languagetool
train
java
8974b4f00be538ae083b18349e2716357c090ce2
diff --git a/pkg/kubelet/nodestatus/setters.go b/pkg/kubelet/nodestatus/setters.go index <HASH>..<HASH> 100644 --- a/pkg/kubelet/nodestatus/setters.go +++ b/pkg/kubelet/nodestatus/setters.go @@ -139,7 +139,7 @@ func NodeAddress(nodeIP net.IP, // typically Kubelet.nodeIP // no existing Hostname address found, add it klog.Warningf("adding overridden hostname of %v to cloudprovider-reported addresses", hostname) nodeAddresses = append(nodeAddresses, v1.NodeAddress{Type: v1.NodeHostName, Address: hostname}) - } else { + } else if existingHostnameAddress.Address != hostname { // override the Hostname address reported by the cloud provider klog.Warningf("replacing cloudprovider-reported hostname of %v with overridden hostname of %v", existingHostnameAddress.Address, hostname) existingHostnameAddress.Address = hostname
Don't log a warning to override hostname if there's no change.
kubernetes_kubernetes
train
go
b9b7b35868275b55830c6a68c9b8c3a28c240101
diff --git a/lib/health-data-standards/import/bundle/importer.rb b/lib/health-data-standards/import/bundle/importer.rb index <HASH>..<HASH> 100644 --- a/lib/health-data-standards/import/bundle/importer.rb +++ b/lib/health-data-standards/import/bundle/importer.rb @@ -4,13 +4,19 @@ module HealthDataStandards class Importer COLLECTION_NAMES = ["bundles", "records", "measures", "selected_measures", "patient_cache", "query_cache", "system.js"] + DEFAULTS = {clear_db: false, + type: nil, + delete_existing: false, + update_measures: true, + clear_collections: COLLECTION_NAMES + } # Import a quality bundle into the database. This includes metadata, measures, test patients, supporting JS libraries, and expected results. # # @param [File] zip The bundle zip file. # @param [String] Type of measures to import, either 'ep', 'eh' or nil for all # @param [Boolean] keep_existing If true, delete all current collections related to patients and measures. def self.import(zip, options={}) - + options = DEFAULTS.merge(options) bundle_versions = Hash[* HealthDataStandards::CQM::Bundle.where({}).collect{|b| [b._id, b.version]}.flatten] # Unpack content from the bundle. bundle_contents = unpack_bundle_contents(zip, options[:type])
making update_measures true by default
projectcypress_health-data-standards
train
rb
a31631b5f9ffaaf831bdf9017260939a30626df0
diff --git a/_fixtures/teststepprog.go b/_fixtures/teststepprog.go index <HASH>..<HASH> 100644 --- a/_fixtures/teststepprog.go +++ b/_fixtures/teststepprog.go @@ -2,12 +2,12 @@ package main var n = 0 -func CallFn2() { +func CallFn2(x int) { n++ } -func CallFn(fn func()) { - fn() +func CallFn(x int, fn func(x int)) { + fn(x + 1) } func CallEface(eface interface{}) { @@ -17,6 +17,6 @@ func CallEface(eface interface{}) { } func main() { - CallFn(CallFn2) + CallFn(0, CallFn2) CallEface(n) }
proc/test: fix TestStepCallPtr on linux/<I> (#<I>) The test needs to set a breakpoint on main.CallFn after the prologue, on linux/<I> this function does not have any instruction after the prologue on the function header line because it doesn't need to allocate space for local variables. Change the fixture so that this isn't a problem. This bug results on the test failing a small percentage of the time.
go-delve_delve
train
go
bf40670ef63b38c0b3f24241b8e327271a4cea08
diff --git a/lib/rb-inotify/notifier.rb b/lib/rb-inotify/notifier.rb index <HASH>..<HASH> 100644 --- a/lib/rb-inotify/notifier.rb +++ b/lib/rb-inotify/notifier.rb @@ -181,7 +181,8 @@ module INotify def watch(path, *flags, &callback) return Watcher.new(self, path, *flags, &callback) unless flags.include?(:recursive) - Dir.glob(File.join(path, '{*,.*}')).each do |d| + Dir.glob(File.join(path, '*'), File::FNM_DOTMATCH).each do |d| + next if d =~ /\/\.\.?$/ # Current or parent directory watch(d, *flags, &callback) if !RECURSIVE_BLACKLIST.include?(d) && File.directory?(d) end
Skip if current or parent directory.
guard_rb-inotify
train
rb
2382269aec0cf0625345ae86e776f672c873f354
diff --git a/lib/forms.js b/lib/forms.js index <HASH>..<HASH> 100644 --- a/lib/forms.js +++ b/lib/forms.js @@ -34,6 +34,16 @@ module.exports.loginForm = forms.create({ /** + * A resend account verification email form. + * + * @property resendAccountVerificationEmailForm + */ +module.exports.resendAccountVerificationEmailForm = forms.create({ + email: fields.email({ required: validators.required('Email is required.') }) +}); + + +/** * A forgot password form. * * @property forgotPasswordForm
Adding a new resendAccountVerificationEmailForm. This allows us to collect an email address on our resend account verification email page. References #<I>.
stormpath_express-stormpath
train
js
702846596973c67b210dd6ed59d77ded5dbd2f55
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -9,7 +9,7 @@ from setuptools import setup, find_packages MAJOR = 0 MINOR = 5 MICRO = 2 -ISRELEASED = True +ISRELEASED = False VERSION = '%d.%d.%d' % (MAJOR, MINOR, MICRO) QUALIFIER = ''
revert to <I>-dev
pydata_xarray
train
py
c254c02938aeba1842c91226fd820dba2034e0f2
diff --git a/locksmith/mongoauth/management/commands/apireport.py b/locksmith/mongoauth/management/commands/apireport.py index <HASH>..<HASH> 100644 --- a/locksmith/mongoauth/management/commands/apireport.py +++ b/locksmith/mongoauth/management/commands/apireport.py @@ -34,4 +34,4 @@ class Command(BaseCommand): apicall(endpoint, settings.LOCKSMITH_SIGNING_KEY, api=settings.LOCKSMITH_API_NAME, date=date, endpoint=item['method'], key=item['key'], - calls=item['count'].split('.')[0]) + calls=int(item['count']))
count was a float, not a str
sunlightlabs_django-locksmith
train
py
cb37d0faf1754b6ee2835d444018bca8dcac6999
diff --git a/upup/pkg/fi/cloudup/awsup/aws_cloud.go b/upup/pkg/fi/cloudup/awsup/aws_cloud.go index <HASH>..<HASH> 100644 --- a/upup/pkg/fi/cloudup/awsup/aws_cloud.go +++ b/upup/pkg/fi/cloudup/awsup/aws_cloud.go @@ -867,7 +867,7 @@ func buildKarpenterGroup(c AWSCloud, cluster *kops.Cluster, ig *kops.InstanceGro } } - klog.Infof("found %d karpenter instances", len(instances)) + klog.V(2).Infof("found %d karpenter instances", len(instances)) { req := &ec2.DescribeInstancesInput{ @@ -891,7 +891,7 @@ func buildKarpenterGroup(c AWSCloud, cluster *kops.Cluster, ig *kops.InstanceGro } } } - klog.Infof("found %d updated instances", len(updatedInstances)) + klog.V(2).Infof("found %d updated instances", len(updatedInstances)) { for _, instance := range instances {
Set higher verbosity on some karpenter logging
kubernetes_kops
train
go
71db03395390880743a92a7a93315184c8878bd9
diff --git a/lib/dpl/provider/s3.rb b/lib/dpl/provider/s3.rb index <HASH>..<HASH> 100644 --- a/lib/dpl/provider/s3.rb +++ b/lib/dpl/provider/s3.rb @@ -51,7 +51,7 @@ module DPL opts[:acl] = options[:acl].gsub(/_/, '-') if options[:acl] opts[:expires] = get_option_value_by_filename(options[:expires], filename) if options[:expires] opts[:storage_class] = options[:storage_class] if options[:storage_class] - opts[:server_side_encryption] = :aes256 if options[:server_side_encryption] + opts[:server_side_encryption] = "AES256" if options[:server_side_encryption] unless File.directory?(filename) log "uploading #{filename.inspect} with #{opts.inspect}" result = api.bucket(option(:bucket)).object(upload_path(filename)).upload_file(filename, opts)
Current AWS SDK requires an upper case string value for encryption alogrithm.
travis-ci_dpl
train
rb
cb5338ddc93d6a9998b9f3fc46a05cd41b727df0
diff --git a/javascript/atoms/dom.js b/javascript/atoms/dom.js index <HASH>..<HASH> 100644 --- a/javascript/atoms/dom.js +++ b/javascript/atoms/dom.js @@ -573,7 +573,7 @@ bot.dom.isBodyScrollBarShown_ = function(bodyElement) { * @return {!goog.math.Size} The dimensions of the element. */ bot.dom.getElementSize = function(element) { - if (goog.isFunction(element['getBBox'])) { + if (goog.isFunction(element['getBBox']) && !bot.dom.isElement(element, goog.dom.TagName.SVG)) { try { var bb = element['getBBox'](); if (bb) {
Fixing size calculation for SVG elements
SeleniumHQ_selenium
train
js
eeb7a4d3b43c881ee8caf7820e207943fa0f2bad
diff --git a/test/lib/initialize-components-test.js b/test/lib/initialize-components-test.js index <HASH>..<HASH> 100644 --- a/test/lib/initialize-components-test.js +++ b/test/lib/initialize-components-test.js @@ -1,6 +1,5 @@ 'use strict'; -const Promise = require('bluebird'); const {assert} = require('../../library'); const initializeComponents = require('../../lib/initialize-components');
Fix broken test (removal of Bluebird) Changes to be committed: modified: test/lib/initialize-components-test.js
kixxauth_kixx
train
js
d3b7bc89f2a24f6e99d9ed3cfb84e292e8a55e2c
diff --git a/src/Interceptor.php b/src/Interceptor.php index <HASH>..<HASH> 100644 --- a/src/Interceptor.php +++ b/src/Interceptor.php @@ -462,7 +462,9 @@ class Interceptor { mkdir(dirname($path), 0755, true); } - file_put_contents($path, $content); + if (file_put_contents($path, $content) === false) { + throw new JitException("Unable to create a cached file at `'{$file}'`."); + } if ($timestamp) { touch($path, $timestamp); }
Throws an error when a cache file can't be created.
crysalead_jit
train
php
ea06d611549f8a09f172a774a4dbd8f75fcabc7b
diff --git a/test.js b/test.js index <HASH>..<HASH> 100755 --- a/test.js +++ b/test.js @@ -34,7 +34,10 @@ for (var i = 0, l = tests.length; i < l; i++) { tests.push(obj); }); -var width = process.stdout.getWindowSize()[0]; +var width = 80; +if (process.stdout.isTTY) { + width = process.stdout.getWindowSize()[0]; +} var mistakes = 0; function dump(value) { if (typeof value === 'undefined' || Buffer.isBuffer(value)) {
Don't assume the test is running in a tty
creationix_msgpack-js
train
js
2e6860e5be9b5a80794a7f6a1a0daf6890d6390a
diff --git a/orderer/common/server/main.go b/orderer/common/server/main.go index <HASH>..<HASH> 100644 --- a/orderer/common/server/main.go +++ b/orderer/common/server/main.go @@ -252,7 +252,9 @@ func Main() { } ab.RegisterAtomicBroadcastServer(grpcServer.Server(), server) logger.Info("Beginning to serve requests") - grpcServer.Start() + if err := grpcServer.Start(); err != nil { + logger.Fatalf("Atomic Broadcast gRPC server has terminated while serving requests due to: %v", err) + } } func reuseListener(conf *localconfig.TopLevel, typ string) bool {
Errors should be checked when orderer grpc server is serving requests
hyperledger_fabric
train
go
84c777c13c225cc459fe5f8fecd686551c8d76bf
diff --git a/classes/Kohana/Model/Address.php b/classes/Kohana/Model/Address.php index <HASH>..<HASH> 100644 --- a/classes/Kohana/Model/Address.php +++ b/classes/Kohana/Model/Address.php @@ -38,6 +38,7 @@ class Kohana_Model_Address extends Jam_Model { 'line2' => Jam::field('string'), 'state' => Jam::field('string'), 'fax' => Jam::field('string'), + 'fields_required' => Jam::field('boolean', array('in_db' => FALSE)), )) ->validator( 'first_name', @@ -48,7 +49,7 @@ class Kohana_Model_Address extends Jam_Model { 'line1', 'zip', 'phone', - array('if' => 'required', 'present' => TRUE) + array('if' => 'fields_required', 'present' => TRUE) ) ->validator('email', array('format' => array('email' => TRUE))); }
add fields_required to address
OpenBuildings_purchases
train
php
dfcd11b1ea7754ac9c20a5c9b8ea0d1dd08ab1ba
diff --git a/aospy/data_loader.py b/aospy/data_loader.py index <HASH>..<HASH> 100644 --- a/aospy/data_loader.py +++ b/aospy/data_loader.py @@ -98,8 +98,8 @@ def _sel_var(ds, var): return da.rename(var.name) except KeyError: pass - raise KeyError('{0} not found in ' - 'among names:{1} in {2}'.format(var, var.names, ds)) + msg = '{0} not found among names: {1} in\n{2}'.format(var, var.names, ds) + raise LookupError(msg) def _prep_time_data(ds): diff --git a/aospy/test/test_data_loader.py b/aospy/test/test_data_loader.py index <HASH>..<HASH> 100644 --- a/aospy/test/test_data_loader.py +++ b/aospy/test/test_data_loader.py @@ -122,7 +122,7 @@ class TestDataLoader(AospyDataLoaderTestCase): result = _sel_var(ds, condensation_rain) self.assertEqual(result.name, condensation_rain.name) - with self.assertRaises(KeyError): + with self.assertRaises(LookupError): _sel_var(ds, precip) def test_maybe_apply_time_shift(self):
MNT:Switch from KeyError to LookupError when variable not found (#<I>) Makes the error message cleaner, due to KeyError not escaping newline characters as a result of some deep-in-the-weeds CPython implementation details.
spencerahill_aospy
train
py,py
0ea5a1d5ba3fff6d6489bdf9ac6b8f8cbe4890c5
diff --git a/lambda_uploader/config.py b/lambda_uploader/config.py index <HASH>..<HASH> 100644 --- a/lambda_uploader/config.py +++ b/lambda_uploader/config.py @@ -124,8 +124,8 @@ class Config(object): if not lambda_file: lambda_file = path.join(self._path, 'lambda.json') - if not path.isfile(lambda_file): - raise Exception("%s not found" % lambda_file) + if not path.isfile(lambda_file) or path.isdir(lambda_file): + raise Exception("%s not a valid configuration file" % lambda_file) with open(lambda_file) as config_file: self._config = json.load(config_file)
Raise an exception if the config passed is not a valid conf file
rackerlabs_lambda-uploader
train
py
2b4ea7d30d22341fb488df73901277a5194fd424
diff --git a/src/main/java/junit/framework/Assert.java b/src/main/java/junit/framework/Assert.java index <HASH>..<HASH> 100644 --- a/src/main/java/junit/framework/Assert.java +++ b/src/main/java/junit/framework/Assert.java @@ -226,8 +226,8 @@ public class Assert { * Object to check or <code>null</code> */ static public void assertNull(Object object) { - String message= object != null ? "Expected: <null> but was: " + object.toString() : ""; - assertNull(message, object); + if(object != null) + assertNull("Expected: <null> but was: " + object.toString(), object); } /** * Asserts that an object is null. If it is not
implementing kcooney's suggestion
junit-team_junit4
train
java
bed08bc14a52560e918e44a27fe2197ef26b61df
diff --git a/config/routes.rb b/config/routes.rb index <HASH>..<HASH> 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -70,6 +70,7 @@ SurveyorGui::Application.routes.draw do get 'cut_question' get 'paste_question' end + end resources :survey_sections do post :sort, :on => :collection @@ -90,6 +91,7 @@ SurveyorGui::Application.routes.draw do resources :surveyresponses, :only=>['preview_results', + 'preview_survey', 'preview_report', 'test', 'prepare_value_analysis_report', @@ -106,6 +108,5 @@ SurveyorGui::Application.routes.draw do get 'show_results' end end - end end
routes.rb: fixed error in placement of end
kjayma_surveyor_gui
train
rb
5e31d5fd26eb64ba26b538ed361db2442164ecb1
diff --git a/binding/cxf/src/main/java/io/tracee/cxf/client/TraceeCxfFeature.java b/binding/cxf/src/main/java/io/tracee/cxf/client/TraceeCxfFeature.java index <HASH>..<HASH> 100644 --- a/binding/cxf/src/main/java/io/tracee/cxf/client/TraceeCxfFeature.java +++ b/binding/cxf/src/main/java/io/tracee/cxf/client/TraceeCxfFeature.java @@ -37,7 +37,7 @@ public class TraceeCxfFeature extends AbstractFeature { provider.getOutInterceptors().add(requestOutInterceptor); provider.getOutInterceptors().add(responseOutInterceptor); - provider.getInFaultInterceptors().add(requestInInterceptor); provider.getOutFaultInterceptors().add(responseOutInterceptor); + provider.getInFaultInterceptors().add(requestInInterceptor); } }
Switch lines to clarify request/response handling
tracee_tracee
train
java
e9e5d64975b9ebae1c3c66e1f7ae845b78b5c4cc
diff --git a/saltcloud/clouds/ec2.py b/saltcloud/clouds/ec2.py index <HASH>..<HASH> 100644 --- a/saltcloud/clouds/ec2.py +++ b/saltcloud/clouds/ec2.py @@ -1031,7 +1031,8 @@ def create(vm_=None, call=None): data = _wait_for_spot_instance( __query_spot_instance_request, update_args=(sir_id, location), - timeout=10 * 60, + timeout=config.get_config_value( + 'wait_for_spot_timeout', vm_, __opts__, default=10) * 60, max_failures=5 ) log.debug('wait_for_spot_instance data {0}'.format(data))
Configurable wait for Spot instance implemented for EC2
saltstack_salt
train
py
61bec5852aed5399bc251dfd06118c584792f0d1
diff --git a/wkhtmltopdf/tests/tests.py b/wkhtmltopdf/tests/tests.py index <HASH>..<HASH> 100644 --- a/wkhtmltopdf/tests/tests.py +++ b/wkhtmltopdf/tests/tests.py @@ -137,7 +137,7 @@ class TestViews(TestCase): else: filename = '.pdf' self.assertEqual(response['Content-Disposition'], - 'attachment; filename="{}"'.format(filename)) + 'attachment; filename="{0}"'.format(filename)) # Content as a direct output response = PDFResponse(content=content, filename="nospace.pdf", @@ -161,7 +161,7 @@ class TestViews(TestCase): else: filename = '.pdf' self.assertEqual(response['Content-Disposition'], - 'attachment; filename="{}"'.format(filename)) + 'inline; filename="{0}"'.format(filename)) # Content-Type response = PDFResponse(content=content,
Fix py<I> bug and copypasta error Python <I> doesn't allow empty format arguments: ``{}`` must be ``{0}``. Also second test is ``inline`` rather than ``attachment``.
incuna_django-wkhtmltopdf
train
py
664316c4e15635631e8f43135828448e0976e1bf
diff --git a/structr-ui/src/test/java/org/structr/test/console/ConsoleTest.java b/structr-ui/src/test/java/org/structr/test/console/ConsoleTest.java index <HASH>..<HASH> 100644 --- a/structr-ui/src/test/java/org/structr/test/console/ConsoleTest.java +++ b/structr-ui/src/test/java/org/structr/test/console/ConsoleTest.java @@ -147,8 +147,8 @@ public class ConsoleTest extends StructrUiTest { public void testRebuildCommand() { final Console console = new Console(securityContext, ConsoleMode.JavaScript, Collections.emptyMap()); - final int nodeCount = 2244; - final int relCount = 2180; + final int nodeCount = 2255; + final int relCount = 2193; final String fullIndexRebuildOutput = "Node type not set or no entity class found. Starting (re-)indexing all nodes\r\n" +
Tests: Fixes ConsoleTest
structr_structr
train
java
79ff6b286d81b7e8d2dd5a527c49de7d76f1b23b
diff --git a/classic.py b/classic.py index <HASH>..<HASH> 100644 --- a/classic.py +++ b/classic.py @@ -522,7 +522,7 @@ class ClassicMediaStore(MediaStore): self.l.warn("Duplicate file %s" % hd) else: os.rename(fn, path) - os.chmod(path, 644) + os.chmod(path, 0644) with self.keysCond: if self._keys is None: self.l.debug(
classic: yes, chmods are octal
bwesterb_mirte
train
py
9fca7ee2930c7def06038532bb13c2bb62513c77
diff --git a/rastermap/mapping.py b/rastermap/mapping.py index <HASH>..<HASH> 100644 --- a/rastermap/mapping.py +++ b/rastermap/mapping.py @@ -445,6 +445,7 @@ class Rastermap: #X -= X.mean(axis=-1)[:,np.newaxis] if ((u is None)): # compute svd and keep iPC's of data + X -= np.mean(X, axis=0) nmin = min([X.shape[0], X.shape[1]]) nmin = np.minimum(nmin-1, self.nPC) u,sv,v = svdecon(np.float64(X), k=nmin)
subtract the feature mean if doing own PCA
MouseLand_rastermap
train
py
5eea4425e86ac7dd8e6b6ee1f4605bdb121df9f9
diff --git a/examples/payment_request.rb b/examples/payment_request.rb index <HASH>..<HASH> 100644 --- a/examples/payment_request.rb +++ b/examples/payment_request.rb @@ -1,6 +1,12 @@ # -*- encoding : utf-8 -*- require_relative "boot" +# Payment request +# +# You need to set your AccountCredentials (EMAIL, TOKEN) in the application config +# +# P.S: See the boot file example for more details. + payment = PagSeguro::PaymentRequest.new payment.abandon_url = "http://dev.simplesideias.com.br/?abandoned" payment.notification_url = "http://dev.simplesideias.com.br/?notification" @@ -8,11 +14,8 @@ payment.redirect_url = "http://dev.simplesideias.com.br/?redirect" # if you don't want use the application config, can give your credentials object to payment request # -# AccountCredentials: -# payment.credentials = PagSeguro::ApplicationCredentials.new("APP_ID", "APP_KEY", "AUTHORIZATION_CODE") -# -# AccountCredentials: -payment.credentials = PagSeguro::ApplicationCredentials.new('EMAIL', 'TOKEN') +# payment.credentials = PagSeguro::AccountCredentials.new('rafaelrpbelo@gmail.com', 'E280E0A9B6FA48A2AA9E4E73B5A6FC60') + payment.items << { id: 1234,
Update doc of the example and remove ApplicationCredentials example
pagseguro_ruby
train
rb
f47e0f13d61eb9b93c44ecfd81f832c9b1b8c13c
diff --git a/knxip/core.py b/knxip/core.py index <HASH>..<HASH> 100644 --- a/knxip/core.py +++ b/knxip/core.py @@ -1,4 +1,29 @@ from knxip.helper import * +import re + +def parse_group_address(addr): + res = None + + if re.match('[0-9]+$', addr): + res=int(addr) + + m = re.match("([0-9]+)/([0-9]+)$", addr) + if m: + main = m.group(1) + sub = m.group(2) + res=int(main)*256+int(sub) + + m = re.match("([0-9]+)/([0-9]+)/([0-9]+)$", addr) + if m: + main = m.group(1) + middle = m.group(2) + sub = m.group(3) + res = int(main)*256*8+int(middle)*256+int(sub) + + if res==None: + raise KNXException("Address {} does not match any address scheme".format(addr)) + + return res class ValueCache():
added parse_address function
open-homeautomation_pknx
train
py
082b272d572278a4ace81ad5fabf11fa9a48705e
diff --git a/src/Client.php b/src/Client.php index <HASH>..<HASH> 100644 --- a/src/Client.php +++ b/src/Client.php @@ -2,6 +2,7 @@ namespace ChrisWhite\B2; +use ChrisWhite\B2\Exceptions\NotFoundException; use ChrisWhite\B2\Exceptions\ValidationException; use ChrisWhite\B2\Http\Client as HttpClient; @@ -331,12 +332,17 @@ class Client * Returns a single File object representing a file stored on B2. * * @param array $options + * @throws NotFoundException If no file id was provided and BucketName + FileName does not resolve to a file, a NotFoundException is thrown. * @return File */ public function getFile(array $options) { if (!isset($options['FileId']) && isset($options['BucketName']) && isset($options['FileName'])) { $options['FileId'] = $this->getFileIdFromBucketAndFileName($options['BucketName'], $options['FileName']); + + if (!$options['FileId']) { + throw new NotFoundException(); + } } $response = $this->client->request('POST', $this->apiUrl.'/b2_get_file_info', [
Throw exception if FileId did not resolve. (#5) If we're unable to look up the FileId, this means that the FileName and BucketName combination did not resolve to a valid file. We therefor throw a NotFoundException, instead of continuing to try to request file information without the required information to do so.
cwhite92_b2-sdk-php
train
php
1242b6c0c45cf16e73e36db2e937af968d4a5f83
diff --git a/morphs/json/index.js b/morphs/json/index.js index <HASH>..<HASH> 100644 --- a/morphs/json/index.js +++ b/morphs/json/index.js @@ -3,7 +3,7 @@ export default (Vue) => { return json(value, indent); }); - Vue.prototype.$morphJson = (value) => { + Vue.prototype.$morphJson = (value, indent) => { return json(value, indent); };
added indent params to the prototype
jofftiquez_vue-morphling
train
js
f79d321e6eeaf20682f44a98a54f11c98bfd07de
diff --git a/redis/client.py b/redis/client.py index <HASH>..<HASH> 100755 --- a/redis/client.py +++ b/redis/client.py @@ -2849,12 +2849,11 @@ class BasePipeline(object): shas = [s.sha for s in scripts] # we can't use the normal script_* methods because they would just # get buffered in the pipeline. - exists = immediate('SCRIPT', 'EXISTS', *shas, **{'parse': 'EXISTS'}) + exists = immediate('SCRIPT EXISTS', *shas) if not all(exists): for s, exist in izip(scripts, exists): if not exist: - s.sha = immediate('SCRIPT', 'LOAD', s.script, - **{'parse': 'LOAD'}) + s.sha = immediate('SCRIPT LOAD', s.script) def execute(self, raise_on_error=True): "Execute all the commands in the current pipeline" @@ -2924,9 +2923,7 @@ class Script(object): self.registered_client = registered_client self.script = script # Precalculate and store the SHA1 hex digest of the script. - # Encode the digest because it should match the return type of script_load, which - # in Python 3 is bytes. - self.sha = hashlib.sha1(script.encode('utf-8')).hexdigest().encode('utf-8') + self.sha = hashlib.sha1(b(script)).hexdigest() def __call__(self, keys=[], args=[], client=None): "Execute the script, passing any required ``args``"
make register_scripts use the single string form of the SCRIPT (EXISTS|LOAD) commands so that they will be parsed the same way as in script_load and script_exists
andymccurdy_redis-py
train
py
4bc91b5ff036f1cd12f315fd6042ecff6d94e512
diff --git a/vendor/init.go b/vendor/init.go index <HASH>..<HASH> 100644 --- a/vendor/init.go +++ b/vendor/init.go @@ -111,16 +111,12 @@ func addChrome(ctx context.Context) error { func main() { flag.Parse() ctx := context.Background() - wg := sync.WaitGroup{} if *downloadBrowsers { - wg.Add(1) - go func() { - if err := addChrome(ctx); err != nil { - glog.Errorf("unable to Download Google Chrome browser: %v", err) - } - wg.Done() - }() + if err := addChrome(ctx); err != nil { + glog.Errorf("unable to Download Google Chrome browser: %v", err) + } } + var wg sync.WaitGroup for _, file := range files { wg.Add(1) file := file
Fix race condition in vendor/init.go (#<I>) * Fix race condition in vendor/init.go This was introduced in [1]. When --download_browsers is true, addChrome() would be run in parallel with iterating through the list of files. However, addChrome just appends the latest Chrome release to that list of files. This results in the Chrome file not being present in the files download list. [1] <URL>
tebeka_selenium
train
go
a460cb3983a221813575530d3662919adf9404b8
diff --git a/src/ol/renderer/layerrenderer.js b/src/ol/renderer/layerrenderer.js index <HASH>..<HASH> 100644 --- a/src/ol/renderer/layerrenderer.js +++ b/src/ol/renderer/layerrenderer.js @@ -166,7 +166,7 @@ ol.renderer.Layer.prototype.loadImage = function(image) { ol.renderer.Layer.prototype.renderIfReadyAndVisible = function() { var layer = this.getLayer(); if (layer.getVisible() && layer.getSourceState() == ol.source.State.READY) { - this.getMap().render(); + this.changed(); } };
Fire change instead of calling render on map
openlayers_openlayers
train
js
bce3286b076657a1a98fe808c559221249a6a032
diff --git a/tests/connections.test.js b/tests/connections.test.js index <HASH>..<HASH> 100644 --- a/tests/connections.test.js +++ b/tests/connections.test.js @@ -153,3 +153,24 @@ test('incoming ws connection has no port configured', t => { t.end() }) + +test('port is set on top level, but not incoming', t => { + var config = Config('testnet', { + port: 8009, + host: 'localhost', + connections: { + incoming: { + net: [{ scope: ['device', 'local'], port: 8009, host: '::'}] + } + } + }) + console.error(config) + + t.equal(config.port, 8009, 'net: sets default port in connections') + + t.end() +}) + + + +
test case, to not unset port
ssbc_ssb-config
train
js
1e1a65ac52d1b6c35f4c6ef636c3acf57e8b51a5
diff --git a/gtk/gtk.go b/gtk/gtk.go index <HASH>..<HASH> 100644 --- a/gtk/gtk.go +++ b/gtk/gtk.go @@ -6244,6 +6244,11 @@ func (v *ComboBoxText) GetActiveText() string { return gostring(C._gtk_combo_box_text_get_active_text(COMBO_BOX_TEXT(v))) } +func (v *ComboBoxText) GetEntry() *Entry { + w := v.GetChild() + return &Entry{*w, Editable{C.toGEditable(w.GWidget)}} +} + //----------------------------------------------------------------------- // GtkComboBoxEntry //-----------------------------------------------------------------------
Implemented a simple non-GTK-spec method for easy retrieval of the Entry widget within ComboBoxText widgets.
mattn_go-gtk
train
go
b845a564902f54a422c0d5e22ee63dc43ab43b1a
diff --git a/test-app/webpack.config.babel.js b/test-app/webpack.config.babel.js index <HASH>..<HASH> 100644 --- a/test-app/webpack.config.babel.js +++ b/test-app/webpack.config.babel.js @@ -22,7 +22,7 @@ const { const HtmlWebpackPlugin = require('html-webpack-plugin') -const development = () => group([ +const developmentConfig = () => group([ sourceMaps(), devServer(), devServer.proxy({ @@ -35,7 +35,7 @@ const development = () => group([ }) ]) -const production = () => group([ +const productionConfig = () => group([ extractText(), addPlugins([ new webpack.LoaderOptionsPlugin({ @@ -56,10 +56,9 @@ const production = () => group([ ]) module.exports = createConfig([ - setOutput('./build/bundle.js'), babel(), - css.modules(), typescript(), + css.modules(), addPlugins([ new HtmlWebpackPlugin({ inject: true, @@ -71,10 +70,11 @@ module.exports = createConfig([ }), env('development', [ entryPoint('./src/index.dev.js'), - development() + developmentConfig() ]), env('production', [ entryPoint('./src/index.js'), - production() + setOutput('./build/bundle.js'), + productionConfig() ]) ])
Very minor, non-functional changes to test-app's config
andywer_webpack-blocks
train
js
71c833680884ee9047454de1baddb85ca3c27583
diff --git a/src/continuous.js b/src/continuous.js index <HASH>..<HASH> 100644 --- a/src/continuous.js +++ b/src/continuous.js @@ -80,11 +80,11 @@ export function transformer() { } function scale(x) { - return (output || (output = piecewise(domain.map(transform), range, interpolate)))(+transform(clamp(x))); + return (output || (output = piecewise(domain.map(transform), range, interpolate)))(transform(clamp(x))); } scale.invert = function(y) { - return clamp(+untransform((input || (input = piecewise(range, domain.map(transform), interpolateNumber)))(y))); + return clamp(untransform((input || (input = piecewise(range, domain.map(transform), interpolateNumber)))(y))); }; scale.domain = function(_) {
Remove superfluous coercion.
d3_d3-scale
train
js
8ba93d441f84a6f9583975826ce78bc47da4093c
diff --git a/luigi/target.py b/luigi/target.py index <HASH>..<HASH> 100644 --- a/luigi/target.py +++ b/luigi/target.py @@ -13,6 +13,8 @@ # the License. import abc +import logging +logger = logging.getLogger('luigi-interface') class Target(object): @@ -139,7 +141,11 @@ class FileSystemTarget(Target): This method is implemented by using :py:meth:`fs`. """ - return self.fs.exists(self.path) + path = self.path + if '*' in path or '?' in path or '[' in path or '{' in path: + logger.warning("Using wildcards in path %s might lead to processing of an incomplete dataset; " + "override exists() to suppress the warning." % path) + return self.fs.exists(path) def remove(self): """Remove the resource at the path specified by this FileSystemTarget.
Warn when wildcards is used in paths
spotify_luigi
train
py
78133ca1cc63b951ea22534b1f11fbb770712b00
diff --git a/lib/client/api.go b/lib/client/api.go index <HASH>..<HASH> 100644 --- a/lib/client/api.go +++ b/lib/client/api.go @@ -1973,7 +1973,10 @@ func (tc *TeleportClient) Join(ctx context.Context, mode types.SessionParticipan // Session joining is not supported in proxy recording mode if recConfig, err := site.GetSessionRecordingConfig(ctx); err != nil { - return trace.Wrap(err) + // If the user can't see the recording mode, just let them try joining below + if !trace.IsAccessDenied(err) { + return trace.Wrap(err) + } } else if services.IsRecordAtProxy(recConfig.GetMode()) { return trace.BadParameter("session joining is not supported in proxy recording mode") }
Fix session join access denied (#<I>)
gravitational_teleport
train
go
921c10c48d78e969561f2420af0a2df59ec8f396
diff --git a/aegean.py b/aegean.py index <HASH>..<HASH> 100755 --- a/aegean.py +++ b/aegean.py @@ -1481,9 +1481,9 @@ def find_sources_in_image(filename, hdu_index=0, outfile=None, rms=None, max_sum if len(island_group) > 0: fit_parallel(island_group) - for sources in queue: - if sources: # ignore empty lists - for src in sources: + for srcs in queue: + if srcs: # ignore empty lists + for src in srcs: # ignore sources that we have been told to ignore if (src.peak_flux > 0 and nopositive) or (src.peak_flux < 0 and nonegative): continue @@ -2019,7 +2019,7 @@ if __name__ == "__main__": except AttributeError, e: if 'poll' in e.message: log.warn("Your O/S doesn't support select.poll(): Reverting to cores=1") - cores = 1 + options.cores = 1 queue = None temp = None else:
bugfix: when an os doesn't support os.poll the cores are now correctly set to 1 bugfix: no more infinite loop when source finding.
PaulHancock_Aegean
train
py
5a842dee27806aa50c62a2655c8f9ff43c89ed77
diff --git a/manifest.php b/manifest.php index <HASH>..<HASH> 100755 --- a/manifest.php +++ b/manifest.php @@ -27,7 +27,7 @@ return array( 'label' => 'Simple delivery model', 'description' => 'Single test delivery model', 'license' => 'GPL-2.0', - 'version' => '2.6', + 'version' => '3.0', 'author' => 'Open Assessment Technologies, CRP Henri Tudor', 'requires' => array( 'taoDeliveryTemplate' => '1.0' @@ -57,8 +57,5 @@ return array( #BASE URL (usually the domain root) 'BASE_URL' => ROOT_URL . 'taoSimpleDelivery/', - - #BASE WWW the web resources path - 'BASE_WWW' => ROOT_URL . 'taoSimpleDelivery/views/', ) ); \ No newline at end of file
removed referring to a variable BASE_WWW
oat-sa_extension-tao-deliverysimple
train
php
dbab61064dc869460a7bc2eabee3085e93283424
diff --git a/packages/cozy-client/src/StackLink.js b/packages/cozy-client/src/StackLink.js index <HASH>..<HASH> 100644 --- a/packages/cozy-client/src/StackLink.js +++ b/packages/cozy-client/src/StackLink.js @@ -35,7 +35,7 @@ export default class StackLink extends CozyLink { } const collection = this.stackClient.collection(doctype) if (id) { - return collection.get(id) + return collection.get(id, query) } if (ids) { return collection.getAll(ids) diff --git a/packages/cozy-stack-client/src/AppCollection.js b/packages/cozy-stack-client/src/AppCollection.js index <HASH>..<HASH> 100644 --- a/packages/cozy-stack-client/src/AppCollection.js +++ b/packages/cozy-stack-client/src/AppCollection.js @@ -17,7 +17,7 @@ class AppCollection extends DocumentCollection { this.endpoint = '/apps/' } - get(idArg) { + get(idArg, query) { let id if (idArg.indexOf('/') > -1) { id = idArg.split('/')[1]
feat: Add query as argument to collection.get()
cozy_cozy-client
train
js,js
b4a63679d4c3f2cc5d8bc27af4ad8d1b3da6f3b0
diff --git a/api/auth.go b/api/auth.go index <HASH>..<HASH> 100644 --- a/api/auth.go +++ b/api/auth.go @@ -499,11 +499,12 @@ func teamInfo(w http.ResponseWriter, r *http.Request, t auth.Token) error { for _, roleInstance := range user.Roles { role, ok := cachedRoles[roleInstance.Name] if !ok { - role, err := permission.FindRole(roleInstance.Name) + roleFound, err := permission.FindRole(roleInstance.Name) if err != nil { return &errors.HTTP{Code: http.StatusNotFound, Message: err.Error()} } - cachedRoles[roleInstance.Name] = role + cachedRoles[roleInstance.Name] = roleFound + role = cachedRoles[roleInstance.Name] } if role.ContextType == permission.CtxGlobal || (role.ContextType == permission.CtxTeam && roleInstance.ContextValue == team.Name) { canInclude := permission.Check(t, permission.PermTeam)
fix lint in cache for role
tsuru_tsuru
train
go
08e87c1f30025918e04b44c36bdef61d3bafa188
diff --git a/lib/compile/formats.js b/lib/compile/formats.js index <HASH>..<HASH> 100644 --- a/lib/compile/formats.js +++ b/lib/compile/formats.js @@ -116,7 +116,9 @@ function uri(str) { } +var Z_ANCHOR = /[^\\]\\Z/; function regex(str) { + if (Z_ANCHOR.test(str)) return false; try { new RegExp(str); return true;
feat: format "regex" should fail if regular expression contains \Z anchor
epoberezkin_ajv
train
js
1e20d00e88fbb9f1f43811bf4418987ba53d4478
diff --git a/jenkins-plugin/src/main/java/org/jenkinsci/plugins/pipeline/maven/reporters/GeneratedArtifactsReporter.java b/jenkins-plugin/src/main/java/org/jenkinsci/plugins/pipeline/maven/reporters/GeneratedArtifactsReporter.java index <HASH>..<HASH> 100644 --- a/jenkins-plugin/src/main/java/org/jenkinsci/plugins/pipeline/maven/reporters/GeneratedArtifactsReporter.java +++ b/jenkins-plugin/src/main/java/org/jenkinsci/plugins/pipeline/maven/reporters/GeneratedArtifactsReporter.java @@ -57,7 +57,9 @@ public class GeneratedArtifactsReporter implements ResultsReporter{ for (MavenSpyLogProcessor.MavenArtifact mavenArtifact : join) { try { if (StringUtils.isEmpty(mavenArtifact.file)) { - listener.error("[withMaven] Can't archive maven artifact with no file attached: " + mavenArtifact); + if (LOGGER.isLoggable(Level.FINE)) { + listener.getLogger().println("[withMaven] Can't archive maven artifact with no file attached: " + mavenArtifact); + } continue; }
Only display “Can't archive maven artifact with no file attached…” if FINE is enabled.
jenkinsci_pipeline-maven-plugin
train
java
972caf9d3dad7cc9013f6945e942faf204eb26b8
diff --git a/src/index.js b/src/index.js index <HASH>..<HASH> 100644 --- a/src/index.js +++ b/src/index.js @@ -5,7 +5,8 @@ import * as Helpers from './helpers' import type { Config } from './types' async function resolveAsFile(filePath: string, config: Config): Promise<?string> { - if (config.extensions.has(Path.extname(filePath)) && await Helpers.statItem(filePath, config)) { + const stat = await Helpers.statItem(filePath, config) + if (config.extensions.has(Path.extname(filePath)) && stat && stat.isFile()) { return filePath } for (const extension of config.extensions) {
:bug: Fix for dirs with ext in name
steelbrain_resolve
train
js
edcd80f2288c8077843e3c2b089e007ef01e225c
diff --git a/spec/lib/location_spec.rb b/spec/lib/location_spec.rb index <HASH>..<HASH> 100644 --- a/spec/lib/location_spec.rb +++ b/spec/lib/location_spec.rb @@ -11,16 +11,23 @@ describe Location do } it "converts values to Float" do - expect(location.lat).to equal 2.0 - expect(location.lng).to equal 3.0 - expect(location.radius).to equal 300.0 - expect(location.speed).to equal 2.0 - expect(location.course).to equal 30.0 + expect(location.lat).to be_a Float + expect(location.lat).to be 2.0 + expect(location.lng).to be_a Float + expect(location.lng).to be 3.0 + expect(location.radius).to be_a Float + expect(location.radius).to be 300.0 + expect(location.speed).to be_a Float + expect(location.speed).to be 2.0 + expect(location.course).to be_a Float + expect(location.course).to be 30.0 end it "provides hash-style access to its properties with both symbol and string keys" do - expect(location[:lat]).to equal 2.0 - expect(location['lat']).to equal 2.0 + expect(location[:lat]).to be_a Float + expect(location[:lat]).to be 2.0 + expect(location['lat']).to be_a Float + expect(location['lat']).to be 2.0 end it "does not allow hash-style assignment" do
OK, Ruby <I> has introduced flonum, so do not expect identity.
huginn_huginn
train
rb
5953841466d0fb81773d575f8489979d4090dc4e
diff --git a/server.js b/server.js index <HASH>..<HASH> 100644 --- a/server.js +++ b/server.js @@ -61,9 +61,17 @@ function Server (opts) { // start an http tracker unless the user explictly says no if (opts.http !== false) { self.http = http.createServer() - self.http.on('request', function (req, res) { self.onHttpRequest(req, res) }) self.http.on('error', function (err) { self._onError(err) }) self.http.on('listening', onListening) + + // Add default http request handler on next tick to give user the chance to add + // their own handler first. Handle requests untouched by user's handler. + process.nextTick(function () { + self.http.on('request', function (req, res) { + if (res.headersSent) return + self.onHttpRequest(req, res) + }) + }) } // start a udp tracker unless the user explicitly says no
allow user to intercept 'request' event for http tracker
webtorrent_bittorrent-tracker
train
js
d78d81849eaa40c87435c113e27abbf2e0c4a467
diff --git a/cmd/modd/main.go b/cmd/modd/main.go index <HASH>..<HASH> 100644 --- a/cmd/modd/main.go +++ b/cmd/modd/main.go @@ -77,6 +77,7 @@ func main() { err := modd.RunProcs(*prep, log) if err != nil { log.Shout("%s", err) + continue } d.Restart() }
Only restart daemons if prep commands all succeeded
cortesi_modd
train
go
7d0cd5adb7e4efb96269df28e3e998f6ffdb4445
diff --git a/lib/allowy/rspec.rb b/lib/allowy/rspec.rb index <HASH>..<HASH> 100644 --- a/lib/allowy/rspec.rb +++ b/lib/allowy/rspec.rb @@ -1,3 +1,4 @@ +require 'active_support/concern' require 'allowy/matchers' module Allowy
added explicit require 'active_support/concerns' to the rspec helpers too
dnagir_allowy
train
rb
03046c057e35a48f4bb3a1c5896773fe41b42bc1
diff --git a/src/loose/state.js b/src/loose/state.js index <HASH>..<HASH> 100644 --- a/src/loose/state.js +++ b/src/loose/state.js @@ -4,7 +4,7 @@ import {tokenizer, SourceLocation, tokTypes as tt, Node, lineBreak, isNewLine} f export const pluginsLoose = {} export class LooseParser { - constructor(input, options) { + constructor(input, options = {}) { this.toks = tokenizer(input, options) this.options = this.toks.options this.input = this.toks.input
Don't crash when the loose parser isn't given an options arg Closes #<I>
acornjs_acorn
train
js
f357bee5d236a7fa05fdaa115f0434e18dd26285
diff --git a/tests/bootstrap.php b/tests/bootstrap.php index <HASH>..<HASH> 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -1,7 +1,5 @@ <?php -echo "here\n"; - // Ensure PHP 5.4+ for testing if (PHP_VERSION_ID < 50400) { die('Please use PHP 5.4+ for testing. Currently, you are using PHP ' . PHP_VERSION . '.');
Removed a snippet of debug code from the testing bootstrap
AcclimateContainer_acclimate-container
train
php
3ad5ce687452484eb9277bfe2f1ae6949c27f6eb
diff --git a/src/Composer/Repository/Vcs/HgDriver.php b/src/Composer/Repository/Vcs/HgDriver.php index <HASH>..<HASH> 100644 --- a/src/Composer/Repository/Vcs/HgDriver.php +++ b/src/Composer/Repository/Vcs/HgDriver.php @@ -119,7 +119,7 @@ class HgDriver extends VcsDriver public function getFileContent($file, $identifier) { $resource = sprintf('hg cat -r %s %s', ProcessExecutor::escape($identifier), ProcessExecutor::escape($file)); - $this->process->execute(sprintf('hg cat -r %s', $resource), $content, $this->repoDir); + $this->process->execute($resource, $content, $this->repoDir); if (!trim($content)) { return;
Fix hg command to retrieve file content
composer_composer
train
php
5ce5d58f338306a0cce649dceea4d79f44763a83
diff --git a/test/test.basic.js b/test/test.basic.js index <HASH>..<HASH> 100644 --- a/test/test.basic.js +++ b/test/test.basic.js @@ -38,11 +38,9 @@ describe("Basics", function () { } }); - // Note: In very extreme circumstances this test may fail as, by its - // nature it's random. But it's a low enough percentage that I'm - // willing to accept it. - // Award to anyone that calculates the actual probability of this - // test failing and submits a pull request adding it to this comment! + // The probability of this test failing is approximately 4.09e-86. + // So, in theory, it could give a false negative, but the sun will + // probably die long before that happens. expect(true_count).to.be.within(200, 800); });
Calculate the probability of a test failing The reasoning and code to compute the probability is here: <URL>
chancejs_chancejs
train
js
3a559ff8a3e6bfc277587286386a5e6540c2c395
diff --git a/index.js b/index.js index <HASH>..<HASH> 100644 --- a/index.js +++ b/index.js @@ -1,6 +1,22 @@ // Copyright (c) 2015. David M. Lee, II 'use strict'; +var shimmer = require('shimmer'); + +var Protocol = require('mysql/lib/protocol/Protocol'); +var Pool = require('mysql/lib/Pool'); + module.exports = function(ns) { - // TODO + shimmer.wrap(Protocol.prototype, '_enqueue', function(enqueue) { + return function(sequence) { + sequence._callback = ns.bind(sequence._callback); + return enqueue.call(this, sequence); + }; + }); + + shimmer.wrap(Pool.prototype, 'getConnection', function(getConnection) { + return function(cb) { + return getConnection.call(this, ns.bind(cb)); + }; + }); };
Shims for connection and connection pool
building5_cls-mysql
train
js
bd22a8c6937068c2a8e0f5fc066515b00a4aba70
diff --git a/pyjstat/pyjstat.py b/pyjstat/pyjstat.py index <HASH>..<HASH> 100644 --- a/pyjstat/pyjstat.py +++ b/pyjstat/pyjstat.py @@ -611,11 +611,16 @@ class Dataset(OrderedDict): except ValueError: raise - def write(self, output='jsonstat'): + def write(self, output='jsonstat', naming="label", value='value'): """Writes data from a Dataset object to JSONstat or Pandas Dataframe. Args: output(string): can accept 'jsonstat' or 'dataframe'. Default to 'jsonstat'. + naming (string, optional, ingored if output = 'jsonstat'): dimension naming. \ + Possible values: 'label' or 'id'. Defaults to 'label'. + value (string, optional, ignored if output = 'jsonstat'): name of value column. \ + Defaults to 'value'. + Returns: Serialized JSONstat or a Pandas Dataframe,depending on the \ @@ -626,7 +631,7 @@ class Dataset(OrderedDict): if output == 'jsonstat': return json.dumps(OrderedDict(self), cls=NumpyEncoder) elif output == 'dataframe': - return from_json_stat(self)[0] + return from_json_stat(self, naming=naming, value=value)[0] else: raise ValueError("Allowed arguments are 'jsonstat' or 'dataframe'")
Fix issue #<I> In issue #<I>, the write method in the new Dataset class does not pass in values for naming and value to `from_json_stat` when transforming `json-stat` to `dataframe`. This leaves the user with having to use `from_json_stat` directly to allow for changing these values.
predicador37_pyjstat
train
py
8eb66c97b0fb2f3b6a8759c38eb2a3ba307ed817
diff --git a/core/client/src/test/java/alluxio/client/block/UnderStoreBlockInStreamTest.java b/core/client/src/test/java/alluxio/client/block/UnderStoreBlockInStreamTest.java index <HASH>..<HASH> 100644 --- a/core/client/src/test/java/alluxio/client/block/UnderStoreBlockInStreamTest.java +++ b/core/client/src/test/java/alluxio/client/block/UnderStoreBlockInStreamTest.java @@ -95,7 +95,7 @@ public class UnderStoreBlockInStreamTest { } /** - * Tests that array read methods read the correct data. + * Tests that array read methods read the correct data, for the first block of the file. * * @throws IOException when reading from the stream fails */ @@ -104,11 +104,23 @@ public class UnderStoreBlockInStreamTest { arrayReadInternal(mBlockStream, 0); } + /** + * Tests that array read methods read the correct data, for the last block of the file. + * + * @throws IOException when reading from the stream fails + */ @Test public void arrayReadEOFTest() throws IOException { arrayReadInternal(mEOFBlockStream, (int) BLOCK_LENGTH); } + /** + * Internal test case to verify array read methods an in stream. + * + * @param inStream the stream to read from + * @param startIndex the start index of the file to read from + * @throws IOException when reading from the stream fails + */ private void arrayReadInternal(UnderStoreBlockInStream inStream, int startIndex) throws IOException { long remaining = inStream.remaining();
Improve javadocs for tests in UnderStoreBlockInStreamTest
Alluxio_alluxio
train
java
dc7331577af30d3a51a6476e909896ba48debfc2
diff --git a/sharding-jdbc-core/src/main/java/com/dangdang/ddframe/rdb/sharding/parsing/parser/clause/WhereClauseParser.java b/sharding-jdbc-core/src/main/java/com/dangdang/ddframe/rdb/sharding/parsing/parser/clause/WhereClauseParser.java index <HASH>..<HASH> 100644 --- a/sharding-jdbc-core/src/main/java/com/dangdang/ddframe/rdb/sharding/parsing/parser/clause/WhereClauseParser.java +++ b/sharding-jdbc-core/src/main/java/com/dangdang/ddframe/rdb/sharding/parsing/parser/clause/WhereClauseParser.java @@ -68,7 +68,7 @@ public class WhereClauseParser implements SQLClauseParser { } // TODO 解析组合expr - public void parseComparisonCondition(final ShardingRule shardingRule, final SQLStatement sqlStatement, final List<SelectItem> items) { + private void parseComparisonCondition(final ShardingRule shardingRule, final SQLStatement sqlStatement, final List<SelectItem> items) { lexerEngine.skipIfEqual(Symbol.LEFT_PAREN); SQLExpression left = expressionClauseParser.parse(sqlStatement); if (lexerEngine.equalAny(Symbol.EQ)) {
refactor WhereClauseParser
apache_incubator-shardingsphere
train
java
e67f2133be4dc2a8b2f28b72e6b17ad4e4e76f13
diff --git a/lib/bleno.js b/lib/bleno.js index <HASH>..<HASH> 100644 --- a/lib/bleno.js +++ b/lib/bleno.js @@ -4,6 +4,8 @@ var events = require('events'); var os = require('os'); var util = require('util'); +var UuidUtil = require('./uuid-util'); + var PrimaryService = require('./primary-service'); var Characteristic = require('./characteristic'); var Descriptor = require('./descriptor'); @@ -64,7 +66,16 @@ Bleno.prototype.startAdvertising = function(name, serviceUuids, callback) { if (callback) { this.once('advertisingStart', callback); } - this._bindings.startAdvertising(name, serviceUuids); + + var undashedServiceUuids = []; + + if (serviceUuids && serviceUuids.length) { + for (var i = 0; i < serviceUuids.length; i++) { + undashedServiceUuids[i] = UuidUtil.removeDashes(serviceUuids[i]); + } + } + + this._bindings.startAdvertising(name, undashedServiceUuids); }; Bleno.prototype.startAdvertisingIBeacon = function(uuid, major, minor, measuredPower, callback) {
- remove dashes from service uuids before starting advertising (issue #<I>)
noble_bleno
train
js
8c4bc1cd4172d205c7f0eb7ff4d4e2af2091fe73
diff --git a/lib/rack/test.rb b/lib/rack/test.rb index <HASH>..<HASH> 100644 --- a/lib/rack/test.rb +++ b/lib/rack/test.rb @@ -1,7 +1,3 @@ -unless $LOAD_PATH.include?(File.expand_path(File.dirname(__FILE__) + "/..")) - $LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__) + "/..")) -end - require "uri" require "rack" require "rack/mock_session"
Not rack test's responsibility to set up its load path
rack-test_rack-test
train
rb
71ec54234e74fc6efce28480a2fef7635f1e1f56
diff --git a/juju/client/connection.py b/juju/client/connection.py index <HASH>..<HASH> 100644 --- a/juju/client/connection.py +++ b/juju/client/connection.py @@ -376,13 +376,15 @@ class Connection: self._pinger_task.cancel() if self._receiver_task: self._receiver_task.cancel() - await jasyncio.sleep(1) + await self.ws.close() self.ws = None if self.proxy is not None: self.proxy.close() + await jasyncio.sleep(1) + async def _recv(self, request_id): if not self.is_open: raise websockets.exceptions.ConnectionClosed(0, 'websocket closed')
allow time for websockets to properly cancel its tasks
juju_python-libjuju
train
py
8e336261e6062ebdd9f6cf4bd2467a60bebdcea5
diff --git a/master/buildbot/test/unit/test_db_migrate_versions_036_build_parent.py b/master/buildbot/test/unit/test_db_migrate_versions_036_build_parent.py index <HASH>..<HASH> 100644 --- a/master/buildbot/test/unit/test_db_migrate_versions_036_build_parent.py +++ b/master/buildbot/test/unit/test_db_migrate_versions_036_build_parent.py @@ -19,6 +19,7 @@ import datetime from buildbot.test.util import migration from twisted.trial import unittest +from buildbot.util import datetime2epoch class Migration(migration.MigrateTestMixin, unittest.TestCase): @@ -73,8 +74,8 @@ class Migration(migration.MigrateTestMixin, unittest.TestCase): conn.execute(buildsets.insert(), [ dict(external_idstring='extid', reason='rsn1', sourcestamps=[91], - submitted_at=datetime.datetime(1978, 6, 15, 12, 31, 15), - complete_at=datetime.datetime(1979, 6, 15, 12, 31, 15), + submitted_at=datetime2epoch(datetime.datetime(1978, 6, 15, 12, 31, 15)), + complete_at=datetime2epoch(datetime.datetime(1979, 6, 15, 12, 31, 15)), complete=False, results=-1, bsid=91) ])
another db fix did forget datetime2epoch, and pg is the only backend to care about it.
buildbot_buildbot
train
py