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
8e641c7884c9ef21ddef8e6d764f507b66dfb71f
diff --git a/Query/SolrQuery.php b/Query/SolrQuery.php index <HASH>..<HASH> 100644 --- a/Query/SolrQuery.php +++ b/Query/SolrQuery.php @@ -59,7 +59,7 @@ class SolrQuery extends AbstractQuery { /** * @param bool $strict */ - public function setStrict($strict) { + public function setUseAndOperator($strict) { $this->useAndOperator = $strict; } @@ -74,7 +74,7 @@ class SolrQuery extends AbstractQuery { * @param array $value */ public function queryAllFields($value) { - $this->setStrict(false); + $this->setUseAndOperator(false); foreach ($this->mappedFields as $documentField => $entityField) { $this->searchTerms[$documentField] = $value; diff --git a/Tests/Query/SolrQueryTest.php b/Tests/Query/SolrQueryTest.php index <HASH>..<HASH> 100644 --- a/Tests/Query/SolrQueryTest.php +++ b/Tests/Query/SolrQueryTest.php @@ -128,7 +128,7 @@ class SolrQueryTest extends \PHPUnit_Framework_TestCase { $expected = 'title_s:*foo* AND text_t:*bar*'; $query = $this->createQueryWithSearchTerms(); - $query->setStrict(true); + $query->setUseAndOperator(true); $this->assertEquals($expected, $query->getQueryString()); }
rename method after class propery renaming
floriansemm_SolrBundle
train
php,php
b21bfd7b8b015dc25d28867e3c183453d4eb22fb
diff --git a/lib/callbacks/runtime.js b/lib/callbacks/runtime.js index <HASH>..<HASH> 100644 --- a/lib/callbacks/runtime.js +++ b/lib/callbacks/runtime.js @@ -81,14 +81,16 @@ __g.context = ctx; __g.depth === 0 && __g.emitter && __g.emitter.emit("resume"); __g.depth++; - var dispatched = false; try { if (trampo && frame.active && __g.trampoline) { __g.trampoline.queue(function() { return ___(err, result); }); } else { - dispatched = true; + // detect extra callback. + // The offset/col test is necessary because __cb is also used by loops and called multiple times then. + if (___.dispatched && (offset || col)) throw new Error("callback called twice"); + ___.dispatched = true; if (err) { __setEF(err, frame); return _(err); @@ -97,7 +99,7 @@ return fn(null, result); } } catch (ex) { - if (dispatched) throw ex; + if (___.dispatched) throw ex; __setEF(ex, frame); return __propagate(_, ex); } finally {
issue #<I> - second attempt to detect duplicate callbacks
Sage_streamlinejs
train
js
a402e64d0517e86ee4a897ecfd9b1d9314cce4d9
diff --git a/src/containers/IntlTelInputApp.js b/src/containers/IntlTelInputApp.js index <HASH>..<HASH> 100644 --- a/src/containers/IntlTelInputApp.js +++ b/src/containers/IntlTelInputApp.js @@ -390,6 +390,7 @@ class IntlTelInputApp extends Component { // set the initial state of the input value and the selected flag setInitialState() { const val = this.props.defaultValue || ''; + const defaultCountryData = utils.getCountryData(this.props.defaultCountry); // Init the flag setting this.selectFlag(this.props.defaultCountry || '', false); @@ -399,9 +400,10 @@ class IntlTelInputApp extends Component { if (this.getDialCode(val)) { this.updateFlagFromNumber(val); } else if (this.tempCountry !== 'auto') { - // check the defaultCountry option, else fall back to the first in the list + // check the defaultCountry option and make sure it's available, + // else fall back to the first in the list let defaultCountry = this.tempCountry; - if (!this.tempCountry) { + if (!this.tempCountry || !defaultCountryData.iso2) { defaultCountry = (this.preferredCountries.length) ? this.preferredCountries[0].iso2 : this.countries[0].iso2; }
Make sure `defaultCountry` is available in list before selecting flag, default to first country otherwise
patw0929_react-intl-tel-input
train
js
4f80fefb9ae68444471e30f3378861ff9332e88c
diff --git a/lib/create-webpack-config-base.js b/lib/create-webpack-config-base.js index <HASH>..<HASH> 100644 --- a/lib/create-webpack-config-base.js +++ b/lib/create-webpack-config-base.js @@ -32,10 +32,10 @@ function createWebpackConfigBase(batfishConfig) { ); if (!jsxtremeMarkdownOptions.modules) jsxtremeMarkdownOptions.modules = []; jsxtremeMarkdownOptions.modules.push( - `const prefixUrl = require('@mapbox/batfish/modules/prefix-url')` + `const prefixUrl = require('@mapbox/batfish/modules/prefix-url').prefixUrl` ); jsxtremeMarkdownOptions.modules.push( - `const routeTo = require('@mapbox/batfish/modules/route-to')` + `const routeTo = require('@mapbox/batfish/modules/route-to').routeTo` ); const babelPlugins = [
update webpack-config-base wirh prefixUrl and routeTo
mapbox_batfish
train
js
10b8fb27e9887144dc7c02f36ea12c980366f6e8
diff --git a/cli/lib/kontena/cli/common.rb b/cli/lib/kontena/cli/common.rb index <HASH>..<HASH> 100644 --- a/cli/lib/kontena/cli/common.rb +++ b/cli/lib/kontena/cli/common.rb @@ -222,7 +222,7 @@ module Kontena end def current_grid - config.current_grid || (self.respond_to?(:grid) ? self.grid : nil) + (self.respond_to?(:grid) ? self.grid : nil) || config.current_grid end def current_master_index
CLI::Common current_grid should prefer self.grid over config.current_grid (#<I>)
kontena_kontena
train
rb
7d0b2123346422c9c2540fdd0195425e1db67f04
diff --git a/middleware/authorization.js b/middleware/authorization.js index <HASH>..<HASH> 100644 --- a/middleware/authorization.js +++ b/middleware/authorization.js @@ -37,8 +37,6 @@ module.exports = function configuration() { if (code === 401 && err.authenticate) { res.setHeader('WWW-Authenticate', err.authenticate); } - - res.end(message); } else { res.write('HTTP/'+ req.httpVersion +' '); res.write(code +' '+ require('http').STATUS_CODES[code] +'\r\n'); @@ -51,9 +49,9 @@ module.exports = function configuration() { } res.write('\r\n'); - res.write(message); - res.destroy(); } + + res.end(message); }); }; };
End upgrade connection rather than destroy #<I> Calling destroy on the socket can mean the headers and message don't get away before the socket is destroyed. Node doc for socket.destroy say: Ensures that no more I/O activity happens on this socket.
primus_primus
train
js
e07f3ddcac394d2a8dc23fc571318b7e8c2497b1
diff --git a/activesupport/lib/active_support/notifications/instrumenter.rb b/activesupport/lib/active_support/notifications/instrumenter.rb index <HASH>..<HASH> 100644 --- a/activesupport/lib/active_support/notifications/instrumenter.rb +++ b/activesupport/lib/active_support/notifications/instrumenter.rb @@ -57,6 +57,18 @@ module ActiveSupport @duration = nil end + # Returns the difference in milliseconds between the moments when the + # execution of the instrumented event started and when it ended. + # + # ActiveSupport::Notifications.subscribe('wait') do |*args| + # @event = ActiveSupport::Notifications::Event.new(*args) + # end + # + # ActiveSupport::Notifications.instrument('wait') do + # sleep 1 + # end + # + # @event.duration #=> 1000.138 def duration @duration ||= 1000.0 * (self.end - time) end
Add docs for AS::Notifications::Event#duration [ci skip]
rails_rails
train
rb
c1b436428490fb5ab3c33cec3999a4aaa943f801
diff --git a/config/bootstrap.php b/config/bootstrap.php index <HASH>..<HASH> 100644 --- a/config/bootstrap.php +++ b/config/bootstrap.php @@ -68,7 +68,7 @@ NotificationManager::instance()->addTemplate('newAdministrator', [ # Notification recipientLists -NotificationManager::instance()->addRecipientList( - 'administrators', - TableRegistry::get('CakeAdmin.Administrators')->find('list')->toArray() -); \ No newline at end of file +//NotificationManager::instance()->addRecipientList( +// 'administrators', +// TableRegistry::get('CakeAdmin.Administrators')->find('list')->toArray() +//); \ No newline at end of file
Remove recipientList in bootstrap.php because of installation bug.
cakemanager_cakephp-cakeadmin
train
php
918ee49989d73bcbda003890378b75e7f5a6566d
diff --git a/cmd/osdb/main.go b/cmd/osdb/main.go index <HASH>..<HASH> 100644 --- a/cmd/osdb/main.go +++ b/cmd/osdb/main.go @@ -12,7 +12,7 @@ import ( ) // Program version -const VERSION = "0.1a" +const VERSION = "0.2" // Get an anonymous client connected to OSDB. func getClient() (client *osdb.Client, err error) {
Update osdb CLI version to <I>
oz_osdb
train
go
002f956a06022c9af8d9fc7d268613bdd7ac17ce
diff --git a/genty/genty.py b/genty/genty.py index <HASH>..<HASH> 100644 --- a/genty/genty.py +++ b/genty/genty.py @@ -270,16 +270,16 @@ def _build_method_wrapper(method, dataset): if dataset: # Create the test method with the given data set. if isinstance(dataset, GentyArgs): - test_method_for_dataset = lambda *my_self: method( - *(my_self + dataset.args), + test_method_for_dataset = lambda my_self: method( + *((my_self,) + dataset.args), **dataset.kwargs ) else: - test_method_for_dataset = lambda *my_self: method( - *(my_self + dataset) + test_method_for_dataset = lambda my_self: method( + *((my_self,) + dataset) ) else: - test_method_for_dataset = lambda *my_self: method(*my_self) + test_method_for_dataset = lambda my_self: method(my_self) return test_method_for_dataset
Improve the fabricated test method code The fabircated test methods are these little lamdba expressions. The param to the lamdba is just a reference to what is effectively 'self'. So replace the *args syntz with a simple 'my_self' param, and then in the lamdba contruct the 1-tuple as needed.
box_genty
train
py
beda8fae3d7f91d6e9771cf3047abcb9f91bf662
diff --git a/goose/utils/__init__.py b/goose/utils/__init__.py index <HASH>..<HASH> 100644 --- a/goose/utils/__init__.py +++ b/goose/utils/__init__.py @@ -96,10 +96,10 @@ class URLHelper(object): @classmethod def get_parsing_candidate(self, url_to_crawl): # replace shebang is urls - finalUrl = url_to_crawl.replace('#!', '?_escaped_fragment_=') \ + final_url = url_to_crawl.replace('#!', '?_escaped_fragment_=') \ if '#!' in url_to_crawl else url_to_crawl - link_hash = '%s.%s' % (hashlib.md5(finalUrl).hexdigest(), time.time()) - return ParsingCandidate(finalUrl, link_hash) + link_hash = '%s.%s' % (hashlib.md5(final_url).hexdigest(), time.time()) + return ParsingCandidate(final_url, link_hash) class StringSplitter(object):
camelcase less finalUrl
goose3_goose3
train
py
2e14b981660ec5c05df06573d0e0ae1431741b00
diff --git a/Gemfile.lock b/Gemfile.lock index <HASH>..<HASH> 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - mavenlink (0.2.5) + mavenlink (0.2.7) httparty GEM diff --git a/lib/mavenlink/client.rb b/lib/mavenlink/client.rb index <HASH>..<HASH> 100644 --- a/lib/mavenlink/client.rb +++ b/lib/mavenlink/client.rb @@ -75,6 +75,10 @@ module Mavenlink def stories(options = {}) fetch('stories', Story, options, lambda { |story| {:workspace_id => story['workspace_id']} }) end + + def story(story_id) + fetch("stories/#{story_id}", Story, {}, lambda { |story| {:workspace_id => story['workspace_id']} }) + end end class Workspace < Base diff --git a/lib/mavenlink/version.rb b/lib/mavenlink/version.rb index <HASH>..<HASH> 100644 --- a/lib/mavenlink/version.rb +++ b/lib/mavenlink/version.rb @@ -1,3 +1,3 @@ module Mavenlink - VERSION = "0.2.6" + VERSION = "0.2.7" end
Added method to get individual stories for user
mavenlink_mavenlink_ruby_api
train
lock,rb,rb
cbe478e5dab45abbc40b62ae08efc081d633fc98
diff --git a/examples/discovery.v1.js b/examples/discovery.v1.js index <HASH>..<HASH> 100644 --- a/examples/discovery.v1.js +++ b/examples/discovery.v1.js @@ -13,7 +13,9 @@ var discovery = new DiscoveryV1({ version_date: DiscoveryV1.VERSION_DATE_2017_04_27 }); -discovery.getEnvironments({}, function(error, data) {console.log(JSON.stringify(data, null, 2 ));}); +discovery.getEnvironments({}, function(error, data) { + console.log(JSON.stringify(data, null, 2)); +}); // var file = fs.readFileSync('../test/resources/sampleHtml.html'); var file = fs.createReadStream('../test/resources/sampleWord.docx');
:unamused: revert discovery example
watson-developer-cloud_node-sdk
train
js
d341330d6205059967815563c2c98e1c243aa5ad
diff --git a/Swat/Swat.php b/Swat/Swat.php index <HASH>..<HASH> 100644 --- a/Swat/Swat.php +++ b/Swat/Swat.php @@ -6,7 +6,7 @@ * Container for package wide static methods * * @package Swat - * @copyright 2005-2016 silverorange + * @copyright 2005-2017 silverorange * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 */ class Swat @@ -21,12 +21,22 @@ class Swat const GETTEXT_DOMAIN = 'swat'; // }}} + // {{{ private properties + + /** + * Whether or not this package is initialized + * + * @var boolean + */ + private static $is_initialized = false; + + // }}} // {{{ public static function _() /** * Translates a phrase * - * This is an alias for {@link Swat::gettext()}. + * This is an alias for {@link self::gettext()}. * * @param string $message the phrase to be translated. * @@ -181,6 +191,20 @@ class Swat } // }}} + // {{{ public static function init() + + public static function init() + { + if (self::$is_initialized) { + return; + } + + self::setupGettext(); + + self::$is_initialized = true; + } + + // }}} // {{{ private function __construct() /** @@ -256,6 +280,4 @@ if (!function_exists("dgettext")) { // }}} -Swat::setupGettext(); - ?>
Move package initialization to initializer function
silverorange_swat
train
php
545ef8124f60f5fbea159084d4ea45cd1279a9ef
diff --git a/client.js b/client.js index <HASH>..<HASH> 100644 --- a/client.js +++ b/client.js @@ -2,6 +2,11 @@ var ws = require('pull-ws') var WebSocket = require('ws') var url = require('url') + +function isFunction (f) { + return 'function' === typeof f +} + exports.connect = function (addr, opts) { if(isFunction(opts)) { var cb = opts
oops, isFunction was not defined
pull-stream_pull-ws
train
js
af4257493a8582292b717f8b4001e55bd3dfccc0
diff --git a/src/sap.ui.documentation/src/sap/ui/documentation/sdk/Component.js b/src/sap.ui.documentation/src/sap/ui/documentation/sdk/Component.js index <HASH>..<HASH> 100644 --- a/src/sap.ui.documentation/src/sap/ui/documentation/sdk/Component.js +++ b/src/sap.ui.documentation/src/sap/ui/documentation/sdk/Component.js @@ -54,6 +54,9 @@ sap.ui.define([ // call the base component's init function and create the App view UIComponent.prototype.init.apply(this, arguments); + // Load VersionInfo model promise + this.loadVersionInfo(); + // create the views based on the url/hash this.getRouter().initialize();
[INTERNAL] DemokitV2: Version Info model loaded on time Version info model load was removed from the component init but other code was relying on it so I'm restoring it. Change-Id: I<I>aaa7f<I>caff<I>fbfe<I>f1f<I>b<I>
SAP_openui5
train
js
017c51026aa43a3049d7c3a5e1c274f56a714c37
diff --git a/message.go b/message.go index <HASH>..<HASH> 100644 --- a/message.go +++ b/message.go @@ -197,7 +197,7 @@ func parseTags(msg *message, tagsRaw string) { case "user-type": msg.UserType = value case "tmi-sent-ts": - i, err := strconv.Atoi(value) + i, err := strconv.ParseInt(value, 10, 64) if err == nil { msg.Time = time.Unix(0, int64(i*1e6)) }
fix message timestamps on <I>bit architecture
gempir_go-twitch-irc
train
go
b112fbc2b8b2dbb820246ee793570cb50fcba8df
diff --git a/lib/tml/version.rb b/lib/tml/version.rb index <HASH>..<HASH> 100644 --- a/lib/tml/version.rb +++ b/lib/tml/version.rb @@ -30,5 +30,5 @@ #++ module Tml - VERSION = '5.2.4' + VERSION = '5.2.5' end
Updated version to <I>
translationexchange_tml-ruby
train
rb
9c00570b1d299fccd903762c22d2c4ca2c6e603d
diff --git a/src/jquery.contextMenu.js b/src/jquery.contextMenu.js index <HASH>..<HASH> 100755 --- a/src/jquery.contextMenu.js +++ b/src/jquery.contextMenu.js @@ -584,7 +584,7 @@ } break; } - if (typeof opt.$selected !== 'undefined') { + if (typeof opt.$selected !== 'undefined' && opt.$selected !== null) { opt.$selected.trigger('mouseup'); } return; @@ -613,7 +613,7 @@ // pass event to selected item, // stop propagation to avoid endless recursion e.stopPropagation(); - if (typeof opt.$selected !== 'undefined') { + if (typeof opt.$selected !== 'undefined' && opt.$selected !== null) { opt.$selected.trigger(e); } }, @@ -770,7 +770,7 @@ root = data.contextMenuRoot; if (root !== opt && root.$layer && root.$layer.is(e.relatedTarget)) { - if (typeof root.$selected !== 'undefined') { + if (typeof root.$selected !== 'undefined' && root.$selected !== null) { root.$selected.trigger('contextmenu:blur'); } e.preventDefault();
Possible fix for issue #<I>
swisnl_jQuery-contextMenu
train
js
652a11b21a7c0694bec469f2f4917a39aee15b46
diff --git a/Schema/Grammars/SqlServerGrammar.php b/Schema/Grammars/SqlServerGrammar.php index <HASH>..<HASH> 100755 --- a/Schema/Grammars/SqlServerGrammar.php +++ b/Schema/Grammars/SqlServerGrammar.php @@ -82,7 +82,7 @@ class SqlServerGrammar extends Grammar */ public function compilePrimary(Blueprint $blueprint, Fluent $command) { - return sprintf("alter table %s add constraint %s primary key (%s)", + return sprintf('alter table %s add constraint %s primary key (%s)', $this->wrapTable($blueprint), $this->wrap($command->index), $this->columnize($command->columns) @@ -98,7 +98,7 @@ class SqlServerGrammar extends Grammar */ public function compileUnique(Blueprint $blueprint, Fluent $command) { - return sprintf("create unique index %s on %s (%s)", + return sprintf('create unique index %s on %s (%s)', $this->wrap($command->index), $this->wrapTable($blueprint), $this->columnize($command->columns) @@ -114,7 +114,7 @@ class SqlServerGrammar extends Grammar */ public function compileIndex(Blueprint $blueprint, Fluent $command) { - return sprintf("create index %s on %s (%s)", + return sprintf('create index %s on %s (%s)', $this->wrap($command->index), $this->wrapTable($blueprint), $this->columnize($command->columns)
Apply fixes from StyleCI (#<I>)
illuminate_database
train
php
003ef070997b2f5fb12a1334da8ec7fa4b09007b
diff --git a/db/migrate/20100805155020_convert_page_metas.rb b/db/migrate/20100805155020_convert_page_metas.rb index <HASH>..<HASH> 100644 --- a/db/migrate/20100805155020_convert_page_metas.rb +++ b/db/migrate/20100805155020_convert_page_metas.rb @@ -1,12 +1,15 @@ class ConvertPageMetas < ActiveRecord::Migration def self.up - Page.before_save.clear # no callbacks + # following add and remove column enables running this migration + # when upgrading radiant with allowed_children_cache added to Page model + add_column :pages, :allowed_children_cache, :text Page.all.each do |page| page.fields.create(:name => 'Keywords', :content => page.keywords) page.fields.create(:name => 'Description', :content => page.description) end remove_column :pages, :keywords remove_column :pages, :description + remove_column :pages, :allowed_children_cache end def self.down
clearing callbacks was not a great ideas. This works better.
pgharts_trusty-cms
train
rb
9aaec33edff5b01c3c63e8a077860ca01339988b
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -20,7 +20,7 @@ except ImportError: def get_ext_modules(): if not cython_available: - print 'WARNING: cython not available, proceeding with pure python implementation. (%s)' % e + print 'WARNING: cython not available, proceeding with pure python implementation.' return [] try: import gevent @@ -66,7 +66,7 @@ class TestCommand(Command): else: return nose.core.TestProgram(argv=["", '-vvs', os.path.join(self._zmq_dir, 'tests')]) -__version__ = (0, 2, 1) +__version__ = (0, 2, 2) setup( name = 'gevent_zeromq',
Fixed building without cython. Bumped version number.
tmc_gevent-zeromq
train
py
0a9d21c1ec9376af76a7b12603c9805eb9544389
diff --git a/src/Routing/Assets/DefaultDispatcher.php b/src/Routing/Assets/DefaultDispatcher.php index <HASH>..<HASH> 100644 --- a/src/Routing/Assets/DefaultDispatcher.php +++ b/src/Routing/Assets/DefaultDispatcher.php @@ -57,6 +57,7 @@ class DefaultDispatcher implements DispatcherInterface // /assets/css/style.css if (! in_array($request->method(), array('GET', 'HEAD'))) { + // The Request Method is not valid for Asset Files. return null; }
Add comment on Nova\Routing\Assets\DefaultDispatcher
nova-framework_system
train
php
b02e9fbbc01497688faadeec5bb0f952421d732e
diff --git a/src/python/twitter/pants/tasks/task.py b/src/python/twitter/pants/tasks/task.py index <HASH>..<HASH> 100644 --- a/src/python/twitter/pants/tasks/task.py +++ b/src/python/twitter/pants/tasks/task.py @@ -303,7 +303,11 @@ class Task(object): from twitter.pants.tasks.ivy_utils import IvyUtils from twitter.pants.binary_util import runjava_indivisible - java_runner = java_runner or runjava_indivisible + # TODO(pl): Fix the ivy resolution lock so that Ivy can be run within + # a nailgun server + # java_runner = java_runner or runjava_indivisible + java_runner = runjava_indivisible + ivy_args = ivy_args or [] targets = set(targets)
Temporary fix to the nailgun/ivy deadlock Auditors: benjy (sapling split of <I>d9e6a<I>c<I>a<I>ba<I>c6b0bafbaac3d)
pantsbuild_pants
train
py
e817d48e0ecfebd7072d326b9c9864049dcf0c71
diff --git a/src/Illuminate/Support/Testing/Fakes/MailFake.php b/src/Illuminate/Support/Testing/Fakes/MailFake.php index <HASH>..<HASH> 100644 --- a/src/Illuminate/Support/Testing/Fakes/MailFake.php +++ b/src/Illuminate/Support/Testing/Fakes/MailFake.php @@ -4,6 +4,7 @@ namespace Illuminate\Support\Testing\Fakes; use Illuminate\Contracts\Mail\Mailer; use Illuminate\Contracts\Mail\Mailable; +use Illuminate\Contracts\Queue\ShouldQueue; use PHPUnit\Framework\Assert as PHPUnit; class MailFake implements Mailer @@ -184,7 +185,7 @@ class MailFake implements Mailer */ public function hasQueued($mailable) { - return $this->mailablesOf($mailable, true)->count() > 0; + return $this->queuedMailablesOf($mailable)->count() > 0; } /** @@ -261,6 +262,10 @@ class MailFake implements Mailer return; } + if ($view instanceof ShouldQueue) { + return $this->queue($view, $data, $callback); + } + $this->mailables[] = $view; }
fix hasQueued method and verify if the mailable should be queued on send method
laravel_framework
train
php
df9472ec6c1e31b032c16c5e374db7a7b34ca5f1
diff --git a/pdfCropMargins/main_pdfCropMargins.py b/pdfCropMargins/main_pdfCropMargins.py index <HASH>..<HASH> 100644 --- a/pdfCropMargins/main_pdfCropMargins.py +++ b/pdfCropMargins/main_pdfCropMargins.py @@ -968,13 +968,13 @@ def mainCrop(): # Move (noclobber) the original file to the name for uncropped files. if not os.path.exists(generatedUncroppedFilename): if args.verbose: print("\nDoing a file move:\n ", inputDocFname, - "\nmoving to\n ", generatedUncroppedFilename) + "\nis moving to:\n ", generatedUncroppedFilename) shutil.move(inputDocFname, generatedUncroppedFilename) # Move (noclobber) the cropped file to the original file's name. if not os.path.exists(inputDocFname): if args.verbose: print("\nDoing a file move:\n ", outputDocFname, - "\nmoving to\n ", inputDocFname) + "\nis moving to:\n ", inputDocFname) shutil.move(outputDocFname, inputDocFname) # Handle any previewing which still needs to be done.
another minor change to queryModifyOriginal screen message
abarker_pdfCropMargins
train
py
e250de9a648075da50ea1c7c073bdb14c9249e91
diff --git a/lib/omniship/carriers/ups.rb b/lib/omniship/carriers/ups.rb index <HASH>..<HASH> 100644 --- a/lib/omniship/carriers/ups.rb +++ b/lib/omniship/carriers/ups.rb @@ -472,9 +472,9 @@ module Omniship def parse_ship_accept_response(response, options={}) xml = Nokogiri::XML(response) success = response_success?(xml) + @shipment = {} if success - @shipment = {} tracking_number = [] label = [] @@ -489,7 +489,10 @@ module Omniship xml.xpath('/*/ShipmentResults/*/LabelImage/GraphicImage').each do |image| label << image.text end - @shipment[:label] = label + @shipment[:label] = label + @shipment[:success] = true + else + @shipment[:success] = false end return @shipment end
Added a success status to ups shipments
Digi-Cazter_omniship
train
rb
8f3c9456188bb29427f4accfb79f86fa8432a003
diff --git a/lib/Ripple.js b/lib/Ripple.js index <HASH>..<HASH> 100644 --- a/lib/Ripple.js +++ b/lib/Ripple.js @@ -83,12 +83,14 @@ export default class Ripple extends Component { pageY }); - !!this.state.size || this._getContainerDimensions(); + this._getContainerDimensions(() => { + const duration = (this.state.size / 100) * 110; - Animated.timing(this.state.scaleValue, { - toValue: 1, - duration: 500 - }).start(); + Animated.timing(this.state.scaleValue, { + toValue: 1, + duration: duration < 500 || duration >= 1500 ? 500 : duration + }).start(); + }); } }; @@ -114,12 +116,12 @@ export default class Ripple extends Component { } }; - _getContainerDimensions = () => { + _getContainerDimensions = (next) => { this.refs.container.measure((x, y, width, height, pageX, pageY) => { this.setState({ - size: 2 * (width > height ? width : height), + size: 3 * (width > height ? width : height), location: { pageX, pageY } - }); + }, next); }) } @@ -131,6 +133,7 @@ const styles = { overflow: 'hidden' }, background: { + flex: 1, position: 'absolute', top: 0, right: 0,
Fix issue with ripple size & speed with varying component sizes
xotahal_react-native-material-ui
train
js
0ec2eae9cc7fed38e7e469c3a2ff47d36bee2b87
diff --git a/tests/Doctrine/ODM/MongoDB/Tests/Functional/GeoSpatialTest.php b/tests/Doctrine/ODM/MongoDB/Tests/Functional/GeoSpatialTest.php index <HASH>..<HASH> 100644 --- a/tests/Doctrine/ODM/MongoDB/Tests/Functional/GeoSpatialTest.php +++ b/tests/Doctrine/ODM/MongoDB/Tests/Functional/GeoSpatialTest.php @@ -50,7 +50,7 @@ class GeoSpacialTest extends \Doctrine\ODM\MongoDB\Tests\BaseTest ->getSingleResult(); $this->assertNotNull($city); - $this->assertEquals(20, (int) $city->test); + $this->assertEquals(20, round($city->test)); $query = $this->dm->createQueryBuilder(__NAMESPACE__.'\City') ->field('coordinates')->near(50, 50)
Use round instead of casting to int.
doctrine_mongodb-odm
train
php
1e7c3a71d830aff567bc42e597ce30b08a2888fd
diff --git a/wechatpy/enterprise/crypto.py b/wechatpy/enterprise/crypto.py index <HASH>..<HASH> 100644 --- a/wechatpy/enterprise/crypto.py +++ b/wechatpy/enterprise/crypto.py @@ -65,10 +65,11 @@ class PrpCrypto(object): text = PKCS7Encoder.encode(text) cryptor = AES.new(self.key, self.mode, self.key[:16]) - ciphertext = cryptor.encrypt(text) + ciphertext = to_binary(cryptor.encrypt(text)) return base64.b64encode(ciphertext) def decrypt(self, text, corp_id): + text = to_binary(text) cryptor = AES.new(self.key, self.mode, self.key[:16]) plain_text = cryptor.decrypt(base64.b64decode(text)) padding = ord(plain_text[-1]) @@ -84,7 +85,8 @@ class PrpCrypto(object): class WeChatCrypto(object): def __init__(self, token, encoding_aes_key, corp_id): - self.key = base64.b64decode(encoding_aes_key + '=') + encoding_aes_key = to_binary(encoding_aes_key + '=') + self.key = base64.b64decode(encoding_aes_key) assert len(self.key) == 32 self.token = token self.corp_id = corp_id
Try to fix test error on Python 3
jxtech_wechatpy
train
py
a1c6b4db6c4eba20c410ff09a355d82dd1c8d8b4
diff --git a/src/js/viewmodels/viewer-app.js b/src/js/viewmodels/viewer-app.js index <HASH>..<HASH> 100644 --- a/src/js/viewmodels/viewer-app.js +++ b/src/js/viewmodels/viewer-app.js @@ -27,6 +27,7 @@ import Navigation from "./navigation"; import SettingsPanel from "./settings-panel"; import MessageDialog from "./message-dialog"; import keyUtil from "../utils/key-util"; +import urlParameters from "../stores/url-parameters"; function ViewerApp() { this.documentOptions = new DocumentOptions(); @@ -36,7 +37,8 @@ function ViewerApp() { } this.viewerSettings = { userAgentRootURL: "resources/", - viewportElement: document.getElementById("vivliostyle-viewer-viewport") + viewportElement: document.getElementById("vivliostyle-viewer-viewport"), + debug: urlParameters.getParameter("debug") === "true" }; this.viewer = new Viewer(this.viewerSettings, this.viewerOptions); this.messageDialog = new MessageDialog(messageQueue);
Add debug mode - Debug mode is enabled with a URL flag `debug=true`. - When debug mode is enabled, `visibility: hidden` is not set to the page during layout.
vivliostyle_vivliostyle.js
train
js
9e7295341f850d3d851080718dbaecd321f6a1c4
diff --git a/lib/watch.js b/lib/watch.js index <HASH>..<HASH> 100644 --- a/lib/watch.js +++ b/lib/watch.js @@ -251,7 +251,11 @@ Watcher.prototype.watch = function watch(Notify, findit) { finder.on('end', function end() { if (!extras.length) return; + // + // Send a notice to the user additional files were watched. + // if (!self.silent) { + console.log(''); self.square.logger.notice(extras.length + ' files were added to square#watcher'); }
[fix] add lfcr and short comment
observing_square
train
js
a9d73f588968190d6a065dab3b329b2ae1e9d264
diff --git a/wal/global_state.go b/wal/global_state.go index <HASH>..<HASH> 100644 --- a/wal/global_state.go +++ b/wal/global_state.go @@ -32,6 +32,10 @@ type GlobalState struct { func newGlobalState(path string) (*GlobalState, error) { f, err := os.Open(path) + if err != nil { + defer f.Close() + } + state := &GlobalState{ ServerLastRequestNumber: map[uint32]uint32{}, ShardLastSequenceNumber: map[uint32]uint64{}, @@ -51,14 +55,13 @@ func newGlobalState(path string) (*GlobalState, error) { } func (self *GlobalState) writeToFile() error { - newFile, err := os.OpenFile(self.path+".new", os.O_CREATE|os.O_RDWR, 0644) + newFile, err := os.OpenFile(self.path+".new", os.O_CREATE|os.O_TRUNC|os.O_RDWR, 0644) if err != nil { return err } - if _, err := newFile.Seek(0, os.SEEK_SET); err != nil { - return err - } + // always close and ignore any errors on exit + defer newFile.Close() if err := self.write(newFile); err != nil { return err
Make sure we always close the state on read and write Fix #<I>
influxdata_influxdb
train
go
3a9f11a91d002a1d581ef3fffc2c788cb03431e6
diff --git a/apps/editing-toolkit/editing-toolkit-plugin/wpcom-block-editor-nux/src/disable-core-nux.js b/apps/editing-toolkit/editing-toolkit-plugin/wpcom-block-editor-nux/src/disable-core-nux.js index <HASH>..<HASH> 100644 --- a/apps/editing-toolkit/editing-toolkit-plugin/wpcom-block-editor-nux/src/disable-core-nux.js +++ b/apps/editing-toolkit/editing-toolkit-plugin/wpcom-block-editor-nux/src/disable-core-nux.js @@ -7,11 +7,12 @@ const unsubscribe = subscribe( () => { dispatch( 'core/nux' ).disableTips(); if ( select( 'core/edit-post' )?.isFeatureActive( 'welcomeGuide' ) ) { dispatch( 'core/edit-post' ).toggleFeature( 'welcomeGuide' ); + unsubscribe(); } if ( select( 'core/edit-site' )?.isFeatureActive( 'welcomeGuide' ) ) { dispatch( 'core/edit-site' ).toggleFeature( 'welcomeGuide' ); + unsubscribe(); } - unsubscribe(); } ); // Listen for these features being triggered to call dotcom welcome guide instead.
BlockEditorNux: ensure 'welcomeGuide' feature is toggled off (#<I>) only for the first time for 'core/edit-post' and 'core/edit-post'
Automattic_wp-calypso
train
js
28dd6a4fe05efa1d7fe4a097b4319c9dcca84236
diff --git a/spyder/plugins/completion/languageserver/widgets/status.py b/spyder/plugins/completion/languageserver/widgets/status.py index <HASH>..<HASH> 100644 --- a/spyder/plugins/completion/languageserver/widgets/status.py +++ b/spyder/plugins/completion/languageserver/widgets/status.py @@ -10,6 +10,7 @@ Language server Status widget for pyls completions. # Standard library imports import logging +import os # Third party imports from qtpy.QtCore import QPoint, Slot @@ -63,8 +64,9 @@ class LSPStatusWidget(StatusBarWidget): ) add_actions(menu, [restart_action]) rect = self.contentsRect() + os_height = 7 if os.name == 'nt' else 12 pos = self.mapToGlobal( - rect.topLeft() + QPoint(-40, -rect.height() - 12)) + rect.topLeft() + QPoint(-40, -rect.height() - os_height)) menu.popup(pos) def set_value(self, value):
LSP: Adjust positioning of status widget on Windows
spyder-ide_spyder
train
py
bf574adc0f16a3448589af47062edd881eef294d
diff --git a/lib/active_scaffold/bridges/record_select/helpers.rb b/lib/active_scaffold/bridges/record_select/helpers.rb index <HASH>..<HASH> 100644 --- a/lib/active_scaffold/bridges/record_select/helpers.rb +++ b/lib/active_scaffold/bridges/record_select/helpers.rb @@ -69,11 +69,11 @@ class ActiveScaffold::Bridges::RecordSelect module SearchColumnHelpers def active_scaffold_search_record_select(column, options) - value = field_search_record_select_value(options[:value]) + value = field_search_record_select_value(column, options[:value]) active_scaffold_record_select(options[:object], column, options, value, column.options[:multiple]) end - def field_search_record_select_value(value) + def field_search_record_select_value(column, value) return if value.blank? if column.options[:multiple] column.association.klass.find value.collect!(&:to_i)
fix display record_select search with value
activescaffold_active_scaffold
train
rb
f034d5acf8fa6f95d5a3ee5fd9919662613f4145
diff --git a/class.csstidy.php b/class.csstidy.php index <HASH>..<HASH> 100644 --- a/class.csstidy.php +++ b/class.csstidy.php @@ -1293,7 +1293,7 @@ class csstidy { /** * Checks if a property is valid * @param string $property - * @return bool; + * @return bool * @access public * @version 1.0 */ @@ -1317,7 +1317,6 @@ class csstidy { * @param string * @return array */ - public function parse_string_list($value) { $value = trim($value);
Fix docblocks formatting, otherwise reported by Psalm
Cerdic_CSSTidy
train
php
c978b9f8b51173e160bbe7809f690ba2c74feaf3
diff --git a/cartoframes/analysis/geocode.py b/cartoframes/analysis/geocode.py index <HASH>..<HASH> 100644 --- a/cartoframes/analysis/geocode.py +++ b/cartoframes/analysis/geocode.py @@ -4,6 +4,7 @@ import re import hashlib import logging import uuid +import pandas as pd from .. import context from ..auth import get_default_credentials @@ -258,6 +259,11 @@ class GeocodeAnalysis(object): """ + input_dataframe = None + if isinstance(dataset, pd.DataFrame): + input_dataframe = dataset + dataset = Dataset(input_dataframe) + if dry_run: table_name = None @@ -301,7 +307,15 @@ class GeocodeAnalysis(object): # temporary_dataset.delete() Dataset(input_table_name, credentials=self._credentials).delete() - return (result_dataset, result_info) + result = result_dataset + if input_dataframe: + # TODO: only if not saved to table? (table_name is None?) + if dry_run: + result = input_dataframe + else: + result = result_dataset.download() + + return (result, result_info) # Note that this can be optimized for non in-place cases (table_name is not None), e.g. # injecting the input query in the geocoding expression,
Accept a DataFrame as a geocode input
CartoDB_cartoframes
train
py
82a48ae6a34ead7e806d1c28109394283fd1c988
diff --git a/lib/finalsay.js b/lib/finalsay.js index <HASH>..<HASH> 100644 --- a/lib/finalsay.js +++ b/lib/finalsay.js @@ -1,11 +1,9 @@ 'use strict' module.exports = function (program) { - return new Promise((resolve, reject) => { - if (program.finalSay) { - return Promise.resolve(program.finalSay()) - } else { - return Promise.resolve() - } - }) + if (program.finalSay) { + return Promise.resolve(program.finalSay()) + } else { + return Promise.resolve() + } }
:wrench: Improve final say
felixrieseberg_electron-windows-store
train
js
e8879226214fd281adfb2caf852bf054c0fd90cc
diff --git a/lib/nake/argv.rb b/lib/nake/argv.rb index <HASH>..<HASH> 100644 --- a/lib/nake/argv.rb +++ b/lib/nake/argv.rb @@ -2,6 +2,17 @@ module Nake module ArgvParser + def self.extract!(args) + args.dup.inject(Hash.new) do |options, argument| + key, value = self.parse(argument) + if key + options[key] = value + args.delete(argument) + end + options + end + end + def self.extract(args) args.inject(Hash.new) do |options, argument| key, value = self.parse(argument)
Bang method for extracting options from ARGV
botanicus_nake
train
rb
6cb673996e87128801d8e4cb1a03a2cee741f8cd
diff --git a/tcp_transport.go b/tcp_transport.go index <HASH>..<HASH> 100644 --- a/tcp_transport.go +++ b/tcp_transport.go @@ -47,8 +47,8 @@ func NewTCPTransportWithLogger( }) } -// NewTCPTransportWithLogger returns a NetworkTransport that is built on top of -// a TCP streaming transport layer, using a default logger and the address provider +// NewTCPTransportWithConfig returns a NetworkTransport that is built on top of +// a TCP streaming transport layer, using the given config struct. func NewTCPTransportWithConfig( bindAddr string, advertise net.Addr,
Fix incorrect docstring for NewTCPTransportWithConfig Just fix a minor copy/paste mistake on the docstring.
hashicorp_raft
train
go
6f66b31fb7e5dd14f76164561482e10b53d70282
diff --git a/smack-im/src/main/java/org/jivesoftware/smack/roster/Roster.java b/smack-im/src/main/java/org/jivesoftware/smack/roster/Roster.java index <HASH>..<HASH> 100644 --- a/smack-im/src/main/java/org/jivesoftware/smack/roster/Roster.java +++ b/smack-im/src/main/java/org/jivesoftware/smack/roster/Roster.java @@ -128,9 +128,9 @@ public final class Roster extends Manager { /** * The default subscription processing mode to use when a Roster is created. By default - * all subscription requests are automatically accepted. + * all subscription requests are automatically rejected. */ - private static SubscriptionMode defaultSubscriptionMode = SubscriptionMode.accept_all; + private static SubscriptionMode defaultSubscriptionMode = SubscriptionMode.reject_all; /** * The initial maximum size of the map holding presence information of entities without an Roster entry. Currently
Set default subscription mode to "reject all" In order to make the defaults of Smack more secure.
igniterealtime_Smack
train
java
74727c95648fd5a4d688d6d356b7671ad9186ef9
diff --git a/src/Psalm/Checker/ClassLikeChecker.php b/src/Psalm/Checker/ClassLikeChecker.php index <HASH>..<HASH> 100644 --- a/src/Psalm/Checker/ClassLikeChecker.php +++ b/src/Psalm/Checker/ClassLikeChecker.php @@ -455,6 +455,8 @@ abstract class ClassLikeChecker extends SourceChecker implements StatementsSourc $method_checker->check(clone $class_context); if (!$config->excludeIssueInFile('InvalidReturnType', $this->file_name)) { + $secondary_return_type_location = null; + /** @var string */ $method_id = $method_checker->getMethodId(); $return_type_location = MethodChecker::getMethodReturnTypeLocation(
Prevent value from breaking outside of scope
vimeo_psalm
train
php
2a194b2c6f49d15a9c270269b2b8f587cb8fe23f
diff --git a/test/functional/ft_11_recursion.rb b/test/functional/ft_11_recursion.rb index <HASH>..<HASH> 100644 --- a/test/functional/ft_11_recursion.rb +++ b/test/functional/ft_11_recursion.rb @@ -105,6 +105,8 @@ class FtRecursionTest < Test::Unit::TestCase 6.times { wait_for(:alpha) } + Thread.pass + assert_equal((1..6).to_a.join("\n"), @tracer.to_s) end end
a bit more patient in ft_<I> (since participant dispatch is now done in a thread)
jmettraux_ruote
train
rb
ed00fa5b4a6cbcb10b8b8ec9bbcccf893dc0e7c6
diff --git a/billy/bin/update.py b/billy/bin/update.py index <HASH>..<HASH> 100755 --- a/billy/bin/update.py +++ b/billy/bin/update.py @@ -406,7 +406,8 @@ def main(): if 'import' in args.actions: try: db.billy_runs.save(scrape_data, safe=True) - except Exception: + except Exception as e: + print('mongo error:', e) six.reraise(lex, None, exc_traceback) # XXX: This should *NEVER* happen, but it has # in the past, so we're going to catch any errors
add a print statement to hopefully help debug mongo error in logs
openstates_billy
train
py
deba7f7bc43835f8e536ee08aef04dcb00a05d41
diff --git a/payment/src/test/java/org/killbill/billing/payment/PaymentTestSuiteNoDB.java b/payment/src/test/java/org/killbill/billing/payment/PaymentTestSuiteNoDB.java index <HASH>..<HASH> 100644 --- a/payment/src/test/java/org/killbill/billing/payment/PaymentTestSuiteNoDB.java +++ b/payment/src/test/java/org/killbill/billing/payment/PaymentTestSuiteNoDB.java @@ -163,6 +163,7 @@ public abstract class PaymentTestSuiteNoDB extends GuicyKillbillTestSuiteNoDB { paymentExecutors.initialize(); ((MockPaymentDao) paymentDao).reset(); Profiling.resetPerThreadProfilingData(); + clock.resetDeltaFromReality(); } @AfterMethod(groups = "fast")
payment: Fix instability in `fast` tests where we don't reset the clock It is unclear whether resetting the clock is best done after we initialize the stack - I would think before but this is what we typically in other part of the code, so I wanted to keep in homogeneous.
killbill_killbill
train
java
aaec0c03dde9b584815514a134a552b8869907d9
diff --git a/dingo/core/network/__init__.py b/dingo/core/network/__init__.py index <HASH>..<HASH> 100644 --- a/dingo/core/network/__init__.py +++ b/dingo/core/network/__init__.py @@ -214,6 +214,11 @@ class BranchDingo: # branch (line/cable) length in m self.length = kwargs.get('length', None) self.type = kwargs.get('type', None) +<<<<<<< HEAD +======= + + +>>>>>>> e547894... Adapt class BranchDingo to it's actual needs class TransformerDingo():
Adapt class BranchDingo to it's actual needs Conflicts: dingo/core/network/__init__.py
openego_ding0
train
py
43f09639995f8086595531049aaa149406b8dfc4
diff --git a/devtools-detect.js b/devtools-detect.js index <HASH>..<HASH> 100644 --- a/devtools-detect.js +++ b/devtools-detect.js @@ -5,7 +5,7 @@ /*global CustomEvent */ 'use strict'; var devtools = window.devtools = { open: false }; - var threshold = 150; + var threshold = 160; var emitEvent = function (state) { window.dispatchEvent(new CustomEvent('devtoolschange', { detail: {
Increase threshold to account for Chrome downloadbar Fixes #2
sindresorhus_devtools-detect
train
js
29e2f93469f934bbaf71ac8d1af7a876f879ef04
diff --git a/spinoff/actor/comm.py b/spinoff/actor/comm.py index <HASH>..<HASH> 100644 --- a/spinoff/actor/comm.py +++ b/spinoff/actor/comm.py @@ -61,9 +61,7 @@ class ActorRef(object): self._referee = local_actor local_actor._send(message) - def __lshift__(self, message): - self.send(message) - return self + __lshift__ = send def __getstate__(self): return self.addr
Made '<<' simply an alias for 'send' to avoid the extra stack frame
eallik_spinoff
train
py
29c3ebb6a5ccf72ab31c8ed3c75a5f5a77233608
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -99,8 +99,8 @@ CLASSIFIERS = [ # 'Programming Language :: Python :: 3.2', # 'Programming Language :: Python :: 3.3', # 'Programming Language :: Python :: 3.4', - "Programming Language :: Python :: 3.5", - "Programming Language :: Python :: 3.6", + # "Programming Language :: Python :: 3.5", + # "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9",
Drop (official) support for Python <I> and <I>
MinchinWeb_minchin.releaser
train
py
5a135d8ddddac4deaaad399222442473aecf58a7
diff --git a/server/gamedb.js b/server/gamedb.js index <HASH>..<HASH> 100644 --- a/server/gamedb.js +++ b/server/gamedb.js @@ -104,7 +104,10 @@ GameDB.prototype.addGamesByList = function(filePath) { try { var fileList = JSON.parse(fs.readFileSync(filePath, {encoding:'utf-8'})); fileList.forEach(function(info) { - this.addGameInfo(path.join(info.path, "package.json")); + var gameInfo = this.addGameInfo(path.join(info.path, "package.json")); + if (gameInfo) { + gameInfo.happyFunTimes.files = info.files; + } }.bind(this)); } catch (e) { console.error("could not read: " + filePath + " :" + e); @@ -118,9 +121,9 @@ GameDB.prototype.addGameInfo = function(filePath) { this.games.push(packageInfo); this.gamesById[packageInfo.happyFunTimes.gameId] = packageInfo; } catch (e) { - throw e; + console.warn("Could not read gameInfo for: " + filePath); } - return true; + return packageInfo; }; /**
make gamedb not fail for games that are in list but don't exit
greggman_HappyFunTimes
train
js
461d523729e4fd29ae66d76550ba38335a028c4b
diff --git a/src/extensions/scratch3_video_sensing/index.js b/src/extensions/scratch3_video_sensing/index.js index <HASH>..<HASH> 100644 --- a/src/extensions/scratch3_video_sensing/index.js +++ b/src/extensions/scratch3_video_sensing/index.js @@ -378,6 +378,12 @@ class Scratch3VideoSensingBlocks { return state.motionAmount > Number(args.REFERENCE); } + /** + * A scratch command block handle that configures the video state from + * passed arguments. + * @param {object} args - the block arguments + * @param {VideoState} args.VIDEO_STATE - the video state to set the device to + */ videoToggle (args) { const state = args.VIDEO_STATE; if (state === VideoState.OFF) { @@ -389,6 +395,13 @@ class Scratch3VideoSensingBlocks { } } + /** + * A scratch command block handle that configures the video preview's + * transparency from passed arguments. + * @param {object} args - the block arguments + * @param {number} args.TRANSPARENCY - the transparency to set the video + * preview to + */ setVideoTransparency (args) { this.runtime.ioDevices.video.setPreviewGhost(Number(args.TRANSPARENCY)); }
Add block comments to videoSensing.videoToggle and setVideoTransparency
LLK_scratch-vm
train
js
4bd058021bfcd5e7067a0e46bfb8356803effcf2
diff --git a/src/main/java/org/minimalj/frontend/impl/swing/toolkit/SwingComboBox.java b/src/main/java/org/minimalj/frontend/impl/swing/toolkit/SwingComboBox.java index <HASH>..<HASH> 100644 --- a/src/main/java/org/minimalj/frontend/impl/swing/toolkit/SwingComboBox.java +++ b/src/main/java/org/minimalj/frontend/impl/swing/toolkit/SwingComboBox.java @@ -45,6 +45,11 @@ public class SwingComboBox<T> extends JComboBox<T> implements Input<T> { public T getValue() { return model.getSelectedObject(); } + + @Override + public void setEditable(boolean enabled) { + super.setEnabled(enabled); + } //
SwingComboBox: regression fix, combo was editable
BrunoEberhard_minimal-j
train
java
d46c48d12197305c5a0c2ca958b72cb0c5abc77a
diff --git a/cherrypy/test/test.py b/cherrypy/test/test.py index <HASH>..<HASH> 100644 --- a/cherrypy/test/test.py +++ b/cherrypy/test/test.py @@ -110,6 +110,7 @@ class LocalServer(object): m = __import__(modulename, globals(), locals()) setup = getattr(m, "setup_server", None) setup() + self.teardown = getattr(m, "teardown_server", None) engine = cherrypy.engine if hasattr(engine, "signal_handler"): @@ -123,6 +124,8 @@ class LocalServer(object): self.sync_apps() def stop(self): + if self.teardown: + self.teardown() import cherrypy cherrypy.engine.exit()
Fixing broken teardown_server.
cherrypy_cheroot
train
py
47570c17bcb47756da6076f3e53e4a7882057ed4
diff --git a/src/plone/app/mosaic/browser/static/js/mosaic.layout.js b/src/plone/app/mosaic/browser/static/js/mosaic.layout.js index <HASH>..<HASH> 100644 --- a/src/plone/app/mosaic/browser/static/js/mosaic.layout.js +++ b/src/plone/app/mosaic/browser/static/js/mosaic.layout.js @@ -515,6 +515,10 @@ define([ // Get url var tile_url = $(this).parents(".mosaic-tile").find('.tileUrl').html(); tile_url = tile_url.replace(/@@/, '@@edit-tile/'); + // Calc absolute edit url + if (tile_url.match(/^\.\/.*/)) { + tile_url = $.mosaic.options.context_url + tile_url.replace(/^\./, ''); + } // Annotate the edited tile, because overlay will steal its focus $(this).parents(".mosaic-tile").addClass('mosaic-edited-tile');
Fix edit-tile urls to be absolute
plone_plone.app.mosaic
train
js
1f30f5148ca9b4c6acfd562d661c849b7f429f31
diff --git a/tilequeue/command.py b/tilequeue/command.py index <HASH>..<HASH> 100755 --- a/tilequeue/command.py +++ b/tilequeue/command.py @@ -41,7 +41,8 @@ import time def create_command_parser(fn): def create_parser_fn(parser): - parser.add_argument('--config') + parser.add_argument('--config', required=True, + help='The path to the tilequeue config file.') parser.set_defaults(func=fn) return parser return create_parser_fn @@ -907,6 +908,8 @@ def tilequeue_main(argv_args=None): parser_func(subparser) args = parser.parse_args(argv_args) + assert os.path.exists(args.config), \ + 'Config file {} does not exist!'.format(args.config) cfg = make_config_from_argparse(args.config) Peripherals = namedtuple('Peripherals', 'redis_cache_index queue') peripherals = Peripherals(make_redis_cache_index(cfg),
Make --config required, and check config path. tilequeue/command.py -This will make it obvious that the user needs to supply a `--config` path, and produce a human error message when the file isn't found (you otherwise get a rather ugly and unenlightening trace).
tilezen_tilequeue
train
py
9736342ee13327f3d404c3152cfeec3f1c3b6fa7
diff --git a/android/src/main/java/guichaguri/trackplayer/metadata/components/MediaNotification.java b/android/src/main/java/guichaguri/trackplayer/metadata/components/MediaNotification.java index <HASH>..<HASH> 100644 --- a/android/src/main/java/guichaguri/trackplayer/metadata/components/MediaNotification.java +++ b/android/src/main/java/guichaguri/trackplayer/metadata/components/MediaNotification.java @@ -181,7 +181,7 @@ public class MediaNotification { if(action == PlaybackStateCompat.ACTION_PAUSE && !playing) return instance; // Add it to the compact view if it's allowed to - if((compactCapabilities & action) == 0) { + if((compactCapabilities & action) == action) { compactView.add(instance); }
Fix/compact capabilities (#<I>) * fix compact capabilities * Always add compact capabities if enabled event if there is no capabilities * Revert "Always add compact capabities if enabled event if there is no capabilities" This reverts commit 7bb<I>fb6f0dc<I>ddfabce<I>fe<I>e9fde.
react-native-kit_react-native-track-player
train
java
fe8830f3dc11f89003a2040dafc53158a662e7e9
diff --git a/bbs/lrp_bbs/lrp_bbs_test.go b/bbs/lrp_bbs/lrp_bbs_test.go index <HASH>..<HASH> 100644 --- a/bbs/lrp_bbs/lrp_bbs_test.go +++ b/bbs/lrp_bbs/lrp_bbs_test.go @@ -404,7 +404,7 @@ var _ = Describe("LRP", func() { }) }) - Describe("modifying DesireLRP", func() { + Describe("Updating DesireLRP", func() { BeforeEach(func() { err := bbs.DesireLRP(lrp) Ω(err).ShouldNot(HaveOccurred()) @@ -450,5 +450,16 @@ var _ = Describe("LRP", func() { Ω(updated).Should(Equal(lrp)) }) }) + + Context("When the LRP does not exist", func() { + It("returns an ErrorKeyNotFound", func() { + instances := 0 + + err := bbs.UpdateDesiredLRP("garbage-guid", models.DesiredLRPUpdate{ + Instances: &instances, + }) + Ω(err).Should(Equal(storeadapter.ErrorKeyNotFound)) + }) + }) }) })
Add test for ErrorKeyNotFound in UpdateDesiredLRP [#<I>]
cloudfoundry_runtimeschema
train
go
b1a3254f0f64f031ca4b36dc9903f2b527257efc
diff --git a/DependencyInjection/Providers/GoogleProviderConfigurator.php b/DependencyInjection/Providers/GoogleProviderConfigurator.php index <HASH>..<HASH> 100644 --- a/DependencyInjection/Providers/GoogleProviderConfigurator.php +++ b/DependencyInjection/Providers/GoogleProviderConfigurator.php @@ -7,9 +7,12 @@ use Symfony\Component\Config\Definition\Builder\NodeBuilder; class GoogleProviderConfigurator implements ProviderConfiguratorInterface { public function buildConfiguration(NodeBuilder $node) - { - $node + { + // todo - add the comments as help text, and render in README + $node + // Optional value for sending hd parameter. More detail: https://developers.google.com/accounts/docs/OAuth2Login#hd-param ->scalarNode('access_type')->end() + // #Optional value for sending access_type parameter. More detail: https://developers.google.com/identity/protocols/OAuth2WebServer#offline ->scalarNode('hosted_domain')->end() ; }
[#<I>] Adding notes from README into config
knpuniversity_oauth2-client-bundle
train
php
2c7ded8960a503eff34fc42b5bb76dfe98c27fb6
diff --git a/js/lib/extension.js b/js/lib/extension.js index <HASH>..<HASH> 100644 --- a/js/lib/extension.js +++ b/js/lib/extension.js @@ -10,5 +10,11 @@ define([],function(){ return round(value); }; + if (!Date.now) { + Date.now = function now() { + return +(new Date); + }; + } + return true; }); \ No newline at end of file
added polyfill for Date.now()
rappid_rAppid.js
train
js
bb19385ea41d4d1b6c18da479fee2e8fce5e9398
diff --git a/persistence.js b/persistence.js index <HASH>..<HASH> 100644 --- a/persistence.js +++ b/persistence.js @@ -236,7 +236,7 @@ MongoPersistence.prototype.createRetainedStreamCombi = function (patterns) { for (let i = 0; i < patterns.length; i++) { instance.matcher.add(patterns[i], true) - regex.push(escape(patterns[i]).replace(/(#|\\\+).*$/, '')) + regex.push(escape(patterns[i]).replace(/(\/*#|\\\+).*$/, '')) } regex = regex.join('|')
fix: Regex match empty level #<I> (#<I>) * fix: Regex match empty level #<I> * fix when wildecard is #
mcollina_aedes-persistence-mongodb
train
js
f95b38a40b453f4261d20558bf952c1e9a2082c3
diff --git a/lib/httparty/httpcache.rb b/lib/httparty/httpcache.rb index <HASH>..<HASH> 100644 --- a/lib/httparty/httpcache.rb +++ b/lib/httparty/httpcache.rb @@ -53,7 +53,7 @@ module HTTParty def cacheable? HTTPCache.perform_caching && HTTPCache.apis.keys.include?(uri.host) && - [Net::HTTP::Get, Net::HTTP::Head, Net::HTTP::Options].include?(http_method) + http_method == Net::HTTP::Get end def response_from(response_body)
For now let's just do get requests.
vigetlabs_cachebar
train
rb
b8e6b0b830c0674deb322734971d34f772edd6a1
diff --git a/tests/test_commands.py b/tests/test_commands.py index <HASH>..<HASH> 100644 --- a/tests/test_commands.py +++ b/tests/test_commands.py @@ -228,6 +228,15 @@ def test_start_rethinkdb_exits_when_cannot_start(mock_popen): utils.start_rethinkdb() +@patch('subprocess.Popen') +def test_start_temp_rethinkdb_returns_a_process_when_successful(mock_popen): + from bigchaindb.commands import utils + mock_popen.return_value = Mock(stdout=[ + 'Listening for client driver 1234', + 'Server ready']) + assert utils.start_temp_rethinkdb() == (mock_popen.return_value, 1234) + + @patch('rethinkdb.ast.Table.reconfigure') def test_set_shards(mock_reconfigure, monkeypatch, b): from bigchaindb.commands.bigchain import run_set_shards
Add code coverage for start_temp_rethinkdb
bigchaindb_bigchaindb
train
py
ae5704bd97949d49689b82e708e88bf6ce9a9207
diff --git a/code/amf/CodeBankSnippets.php b/code/amf/CodeBankSnippets.php index <HASH>..<HASH> 100644 --- a/code/amf/CodeBankSnippets.php +++ b/code/amf/CodeBankSnippets.php @@ -371,7 +371,7 @@ class CodeBankSnippets implements CodeBank_APIClass { $snippet->PackageID=$data->packageID; if($data->folderID>0) { - $folder=Folder::get()->byID(intval($data->folderID)); + $folder=SnippetFolder::get()->byID(intval($data->folderID)); if(empty($folder) || $folder===false || $folder->ID==0) { $response['status']="EROR"; $response['message']=_t('CodeBankAPI.FOLDER_DOES_NOT_EXIST', '_Folder does not exist');
Fixed issue where the wrong Folder was being checked when creating a snippet
UndefinedOffset_silverstripe-codebank
train
php
34ec028eb90c91937cdd73823766428af971897e
diff --git a/lib/puppet/pops/types/p_object_type.rb b/lib/puppet/pops/types/p_object_type.rb index <HASH>..<HASH> 100644 --- a/lib/puppet/pops/types/p_object_type.rb +++ b/lib/puppet/pops/types/p_object_type.rb @@ -370,9 +370,6 @@ class PObjectType < PMetaType # # @api private def initialize(_pcore_init_hash, init_hash_expression = nil) - @attributes = EMPTY_HASH - @functions = EMPTY_HASH - if _pcore_init_hash.is_a?(Hash) _pcore_init_from_hash(_pcore_init_hash) else @@ -569,6 +566,8 @@ class PObjectType < PMetaType # @api private def _pcore_init_from_hash(init_hash) TypeAsserter.assert_instance_of('object initializer', TYPE_OBJECT_I12N, init_hash) + @attributes = EMPTY_HASH + @functions = EMPTY_HASH # Name given to the loader have higher precedence than a name declared in the type @name ||= init_hash[KEY_NAME] @@ -681,6 +680,10 @@ class PObjectType < PMetaType @i12n_type ||= create_i12n_type end + def allocate + implementation_class.allocate + end + def create(*args) implementation_class.create(*args) end
(PUP-<I>) Enable allocate, then initialize pattern on Object type. In order to create a self referencing type from a hash, it must be possible to first allocate the instance and then make that allocated instance available when creating the hash used for initializing the instance. This commit adds the needed `#allocate` method and moves initialization of attributes from the `#initialize` to `#_pcore_init_from_hash`.
puppetlabs_puppet
train
rb
1486d1886a3d4604bed94edf0809b2c6e128e43d
diff --git a/wafer/schedule/views.py b/wafer/schedule/views.py index <HASH>..<HASH> 100644 --- a/wafer/schedule/views.py +++ b/wafer/schedule/views.py @@ -1,5 +1,4 @@ import datetime -import itertools from django.views.generic import DetailView, TemplateView from wafer.schedule.models import Venue, Slot, Day @@ -116,17 +115,6 @@ class ScheduleXmlView(ScheduleView): template_name = 'wafer.schedule/penta_schedule.xml' content_type = 'application/xml' - def get_context_data(self, **kwargs): - context = super(ScheduleXmlView, self).get_context_data(**kwargs) - if context['active']: - # summit seems to create other ids after the day indexes, so - # we attempt to do the same - iterator = itertools.count(len(context['schedule_days']) + 2) - else: - iterator = itertools.count(1) - context['iterator'] = iterator - return context - class CurrentView(TemplateView): template_name = 'wafer.schedule/current.html'
Cleanup unneeded iterator from the view
CTPUG_wafer
train
py
c46f36c2994751390eedabbaaf4df43b56f889a2
diff --git a/lib/hippie/client.js b/lib/hippie/client.js index <HASH>..<HASH> 100644 --- a/lib/hippie/client.js +++ b/lib/hippie/client.js @@ -119,6 +119,24 @@ Client.prototype.header = function(key, val) { }; /** + * Set multiple headers. + * + * @param {Object} headers + * @returns {Client} self + * @api public + */ + +Client.prototype.headers = function(headers) { + var self = this; + Object.entries(headers).forEach(function(entry) { + var key = entry[0]; + var val = entry[1]; + self.header(key, val); + }); + return this; +}; + +/** * Set HTTP method. * * @param {String} method diff --git a/test/header.test.js b/test/header.test.js index <HASH>..<HASH> 100644 --- a/test/header.test.js +++ b/test/header.test.js @@ -9,4 +9,18 @@ describe('#header', function() { done(); }); }); + + it('sets multiple headers for the request', function(done) { + api() + .get('/header') + .headers({ + 'X-Custom': 'custom header', + 'Y-Custom': 'another header', + }) + .end(function(err, res) { + should.not.exist(err); + res.body.should.eq('custom header'); + done(); + }); + }); });
Add option to pass multiple headers to the hippie client
vesln_hippie
train
js,js
4ef6a26b7b8a8575e75c4c8d381df2a95c2e14b2
diff --git a/ssbio/databases/pdb.py b/ssbio/databases/pdb.py index <HASH>..<HASH> 100644 --- a/ssbio/databases/pdb.py +++ b/ssbio/databases/pdb.py @@ -639,7 +639,7 @@ def blast_pdb_df(seq, xml_outfile='', xml_outdir='', force_rerun=False, evalue=0 # @cachetools.func.ttl_cache(maxsize=1, ttl=SEVEN_DAYS) -@lru_cache(maxsize=1) +@lru_cache(maxsize=10) def _property_table(): """Download the PDB -> resolution table directly from the RCSB PDB REST service. @@ -655,6 +655,7 @@ def _property_table(): return p +@lru_cache(maxsize=500) def get_resolution(pdb_id): """Quick way to get the resolution of a PDB ID using the table of results from the REST service @@ -703,6 +704,7 @@ def get_resolution(pdb_id): # return taxonomy +@lru_cache(maxsize=500) def get_release_date(pdb_id): """Quick way to get the release date of a PDB ID using the table of results from the REST service
Trying cache repoze - lru_cache
SBRG_ssbio
train
py
c59a0d5007f0b20063b9fdbc68830a705bb73c9e
diff --git a/nephele/nephele-server/src/main/java/eu/stratosphere/nephele/taskmanager/runtime/RuntimeTaskContext.java b/nephele/nephele-server/src/main/java/eu/stratosphere/nephele/taskmanager/runtime/RuntimeTaskContext.java index <HASH>..<HASH> 100644 --- a/nephele/nephele-server/src/main/java/eu/stratosphere/nephele/taskmanager/runtime/RuntimeTaskContext.java +++ b/nephele/nephele-server/src/main/java/eu/stratosphere/nephele/taskmanager/runtime/RuntimeTaskContext.java @@ -223,10 +223,10 @@ public final class RuntimeTaskContext implements BufferProvider, AsynchronousEve } } - System.out.println("Making checkpoint decision for " + environment.getTaskNameWithIndex()); +// System.out.println("Making checkpoint decision for " + environment.getTaskNameWithIndex()); final boolean checkpointDecision = false; /* CheckpointDecision.getDecision(this.task, rus); */ - System.out.println("Checkpoint decision for " + environment.getTaskNameWithIndex() + " is " - + checkpointDecision); +// System.out.println("Checkpoint decision for " + environment.getTaskNameWithIndex() + " is " +// + checkpointDecision); this.ephemeralCheckpoint.setCheckpointDecisionSynchronously(checkpointDecision); }
Removed System.out.println statements for checkpointing decisions.
apache_flink
train
java
2d94b4c79925c8c40728c2da4370e6e148b97527
diff --git a/src/extensions/renderer/canvas/drawing-edges.js b/src/extensions/renderer/canvas/drawing-edges.js index <HASH>..<HASH> 100644 --- a/src/extensions/renderer/canvas/drawing-edges.js +++ b/src/extensions/renderer/canvas/drawing-edges.js @@ -49,6 +49,8 @@ CRp.drawEdge = function( context, edge, shiftToOriginWithBb, drawLabel, drawOver context.lineCap = 'butt'; } + context.lineJoin = 'round'; + var edgeWidth = edge.pstyle( 'width' ).pfValue + (drawOverlayInstead ? 2 * overlayPadding : 0); var lineStyle = drawOverlayInstead ? 'solid' : edge.pstyle( 'line-style' ).value; context.lineWidth = edgeWidth;
Set the join style of each segment edge such that ie doesn't go beyond its natural bounding box #<I>
cytoscape_cytoscape.js
train
js
2ac8fbb6fe064bb022fa03d3bcecb76fc6b8a7de
diff --git a/src/Illuminate/Console/Application.php b/src/Illuminate/Console/Application.php index <HASH>..<HASH> 100755 --- a/src/Illuminate/Console/Application.php +++ b/src/Illuminate/Console/Application.php @@ -267,7 +267,7 @@ class Application extends SymfonyApplication implements ApplicationContract */ public function resolve($command) { - if (class_exists($command) && ($commandName = $command::getDefaultName())) { + if (is_subclass_of($command, SymfonyCommand::class) && ($commandName = $command::getDefaultName())) { $this->commandMap[$commandName] = $command; return null;
Make stronger assertion before caching commands (#<I>)
laravel_framework
train
php
d46d53ccb22e36e840ac290aa4a7393b232aa617
diff --git a/fusionbox/fix_user/models.py b/fusionbox/fix_user/models.py index <HASH>..<HASH> 100644 --- a/fusionbox/fix_user/models.py +++ b/fusionbox/fix_user/models.py @@ -22,10 +22,6 @@ AuthenticationForm.base_fields['username'].max_length = 255 # I guess not needed AuthenticationForm.base_fields['username'].widget.attrs['maxlength'] = 255 # html AuthenticationForm.base_fields['username'].validators[0].limit_value = 255 -AuthenticationForm.base_fields['email'].max_length = 255 # I guess not needed -AuthenticationForm.base_fields['email'].widget.attrs['maxlength'] = 255 # html -AuthenticationForm.base_fields['email'].validators[0].limit_value = 255 - from django.contrib.auth.forms import UserCreationForm UserCreationForm.base_fields['username'].max_length = 255
removed authentication form field reference from fix_user. There is no email field in authentication form
fusionbox_django-argonauts
train
py
6d14482378ff1fddd571966fb8dc3acdf7d11071
diff --git a/core/src/main/java/org/springframework/security/core/SpringSecurityCoreVersion.java b/core/src/main/java/org/springframework/security/core/SpringSecurityCoreVersion.java index <HASH>..<HASH> 100644 --- a/core/src/main/java/org/springframework/security/core/SpringSecurityCoreVersion.java +++ b/core/src/main/java/org/springframework/security/core/SpringSecurityCoreVersion.java @@ -17,6 +17,7 @@ package org.springframework.security.core; import java.io.IOException; +import java.io.InputStream; import java.util.Properties; import org.apache.commons.logging.Log; @@ -103,9 +104,9 @@ public final class SpringSecurityCoreVersion { */ private static String getSpringVersion() { Properties properties = new Properties(); - try { - properties.load(SpringSecurityCoreVersion.class.getClassLoader() - .getResourceAsStream("META-INF/spring-security.versions")); + try (InputStream is = SpringSecurityCoreVersion.class.getClassLoader() + .getResourceAsStream("META-INF/spring-security.versions")) { + properties.load(is); } catch (IOException | NullPointerException ex) { return null;
Add try-with-resources to close stream Closes gh-<I>
spring-projects_spring-security
train
java
b46ecb449fe0c3adc94854507c2e2eadda5479e6
diff --git a/referral/tests/test_models.py b/referral/tests/test_models.py index <HASH>..<HASH> 100644 --- a/referral/tests/test_models.py +++ b/referral/tests/test_models.py @@ -48,12 +48,8 @@ class UserReferrerTestCase(TestCase): request = HttpRequest() request.session = {} UserReferrer.objects.apply_referrer(user, request) - try: + with self.assertRaises(UserReferrer.DoesNotExist): user.user_referrer - except UserReferrer.DoesNotExist: - pass - else: - assert False, "Referrer should not exist!" def test_manager_apply_referrer(self): referrer = ReferrerFactory()
better exception test in UserReferrerTestCase
byteweaver_django-referral
train
py
c9801351dfa8923d2041b281798695c85497bd45
diff --git a/Model/Behavior/CacheableBehavior.php b/Model/Behavior/CacheableBehavior.php index <HASH>..<HASH> 100644 --- a/Model/Behavior/CacheableBehavior.php +++ b/Model/Behavior/CacheableBehavior.php @@ -399,6 +399,7 @@ class CacheableBehavior extends ModelBehavior { */ public function getAll(Model $model) { return $model->find('all', array( + 'order' => array($model->alias . '.' . $model->displayField => 'ASC'), 'cache' => $model->alias . '::getAll', 'cacheExpires' => $this->getExpiration($model) )); @@ -412,6 +413,7 @@ class CacheableBehavior extends ModelBehavior { */ public function getList(Model $model) { return $model->find('list', array( + 'order' => array($model->alias . '.' . $model->displayField => 'ASC'), 'cache' => $model->alias . '::getList', 'cacheExpires' => $this->getExpiration($model) ));
Add ordering to CacheableBehavior get methods
milesj_utility
train
php
77959b1d814d96a25d867d36582c6a237b8613de
diff --git a/app/helpers/sidebar_helper.rb b/app/helpers/sidebar_helper.rb index <HASH>..<HASH> 100644 --- a/app/helpers/sidebar_helper.rb +++ b/app/helpers/sidebar_helper.rb @@ -25,10 +25,12 @@ module SidebarHelper view_root = new_root if File.exists?(File.join(new_root, "content.rhtml")) end render_to_string(:file => "#{view_root}/content.rhtml", - :locals => sidebar.to_locals_hash) + :locals => sidebar.to_locals_hash, + :layout => false) else render_to_string(:partial => sidebar.content_partial, - :locals => sidebar.to_locals_hash) + :locals => sidebar.to_locals_hash, + :layout => false) end end
Avoid rendering layout for individual sidebar items.
publify_publify
train
rb
b231128d181cf4ecbbc70c627b8d2a6e23d593b0
diff --git a/runtimes/azure-client-runtime/src/main/java/com/microsoft/azure/PagedList.java b/runtimes/azure-client-runtime/src/main/java/com/microsoft/azure/PagedList.java index <HASH>..<HASH> 100644 --- a/runtimes/azure-client-runtime/src/main/java/com/microsoft/azure/PagedList.java +++ b/runtimes/azure-client-runtime/src/main/java/com/microsoft/azure/PagedList.java @@ -47,7 +47,10 @@ public abstract class PagedList<E> implements List<E> { */ public PagedList(Page<E> page) { this(); - items.addAll(page.getItems()); + List<E> retrievedItems = page.getItems(); + if (retrievedItems != null && retrievedItems.size() != 0) { + items.addAll(retrievedItems); + } nextPageLink = page.getNextPageLink(); currentPage = page; } @@ -138,14 +141,17 @@ public abstract class PagedList<E> implements List<E> { public E next() { if (!itemsListItr.hasNext()) { if (!hasNextPage()) { - throw new NoSuchElementException(); + throw new NoSuchElementException(); } else { int size = items.size(); loadNextPage(); itemsListItr = items.listIterator(size); } } - return itemsListItr.next(); + if (itemsListItr.hasNext()) { + return itemsListItr.next(); + } + return null; } @Override
fixed page listing for no item lists.
Azure_azure-sdk-for-java
train
java
96d6d7940e6fc555240a92d1b4615049cd451da2
diff --git a/peer.go b/peer.go index <HASH>..<HASH> 100644 --- a/peer.go +++ b/peer.go @@ -48,13 +48,17 @@ func (id ID) Loggable() map[string]interface{} { } } +func (id ID) String() string { + return id.Pretty() +} + // String prints out the peer. // // TODO(brian): ensure correctness at ID generation and // enforce this by only exposing functions that generate // IDs safely. Then any peer.ID type found in the // codebase is known to be correct. -func (id ID) String() string { +func (id ID) ShortString() string { pid := id.Pretty() if len(pid) <= 10 { return fmt.Sprintf("<peer.ID %s>", pid)
Change String to return the long form by default
libp2p_go-libp2p-peer
train
go
8c79925a7d334db8e9fb16d8b5395699a9a673c6
diff --git a/pypet/tests/test_helpers.py b/pypet/tests/test_helpers.py index <HASH>..<HASH> 100644 --- a/pypet/tests/test_helpers.py +++ b/pypet/tests/test_helpers.py @@ -34,7 +34,7 @@ import tempfile TEMPDIR = 'temp_folder_for_pypet_tests/' ''' Temporary directory for the hdf5 files''' -REMOVE=False +REMOVE=True ''' Whether or not to remove the temporary directory after the tests''' actual_tempdir=''
fixed non-removal of data after tests
SmokinCaterpillar_pypet
train
py
82c9549649db4d979619ec220202749f27eca54c
diff --git a/Kecik/Kecik.php b/Kecik/Kecik.php index <HASH>..<HASH> 100644 --- a/Kecik/Kecik.php +++ b/Kecik/Kecik.php @@ -1125,7 +1125,9 @@ class Kecik { if (self::$fullrender != '') { if (is_callable($this->callable)) { + ob_start(); $response = call_user_func_array($this->callable, $this->route->getParams()); + ob_get_clean(); self::$fullrender = str_replace(['@controller', '@response'], [$response, $response], self::$fullrender); eval('?>'.self::$fullrender); } else { @@ -1138,7 +1140,10 @@ class Kecik { self::$fullrender = ''; } else { if (is_callable($this->callable)) { - echo call_user_func_array($this->callable, $this->route->getParams()); + ob_start(); + $response = call_user_func_array($this->callable, $this->route->getParams()); + ob_get_clean(); + echo $response; } else { header($_SERVER["SERVER_PROTOCOL"].Route::$HTTP_RESPONSE[404]); if ($this->config->get('error.404') != '') {
add ob for strip echo in controller
kecik-framework_kecik
train
php
d02f6bdae4218ab524da1e81c3dcb918263dfbaa
diff --git a/src/Cygnite/Foundation/Collection.php b/src/Cygnite/Foundation/Collection.php index <HASH>..<HASH> 100644 --- a/src/Cygnite/Foundation/Collection.php +++ b/src/Cygnite/Foundation/Collection.php @@ -55,6 +55,42 @@ class Collection implements Countable, IteratorAggregate, ArrayAccess, Serializa } /** + * Add additional arguments in the given collection + * + * @param $name + * @param $value + * @return $this + */ + public function add($name, $value) + { + if (is_array($name)) { + foreach ($name as $key => $value) { + $this->data[$key] = $value; + } + + return $this; + } + + $this->data[$name] = $value; + + return $this; + } + + /** + * Exchanges the current values with the input + * + * @param mixed $array The values to exchange with + * @return array The old array + */ + public function exchangeArray($array) + { + $oldValues = $this->data; + $this->data = $array; + + return $oldValues; + } + + /** * Alias method of getData * * @return array
Added add, exchangeArray methods in Collection class
cygnite_framework
train
php
68de9d4093a7a1ad8d414b6c546a0a1dd6fa857c
diff --git a/hug/run.py b/hug/run.py index <HASH>..<HASH> 100644 --- a/hug/run.py +++ b/hug/run.py @@ -45,7 +45,3 @@ def terminal(): httpd = make_server('', 8000, api) print("Serving on port 8000...") httpd.serve_forever() - - -if __name__ == '__main__': - terminal()
Dont include executabuleness in run module
hugapi_hug
train
py
c5a20b2b58143fe004e4378dcde90124f95c8f14
diff --git a/src/Content/ContentBlocksApiV1PutRequestHandler.php b/src/Content/ContentBlocksApiV1PutRequestHandler.php index <HASH>..<HASH> 100644 --- a/src/Content/ContentBlocksApiV1PutRequestHandler.php +++ b/src/Content/ContentBlocksApiV1PutRequestHandler.php @@ -4,7 +4,6 @@ namespace LizardsAndPumpkins\Content; use LizardsAndPumpkins\Api\ApiRequestHandler; use LizardsAndPumpkins\Content\Exception\ContentBlockContentIsMissingInRequestBodyException; -use LizardsAndPumpkins\Content\Exception\ContentBlockContextIsMissingInRequestBodyException; use LizardsAndPumpkins\Http\HttpRequest; use LizardsAndPumpkins\Queue\Queue;
Issue #<I>: Remove duplicate class import
lizards-and-pumpkins_catalog
train
php
246b4977ce33247b070724730dad789814e71e9a
diff --git a/samples/booking/app/controllers/gorp.go b/samples/booking/app/controllers/gorp.go index <HASH>..<HASH> 100644 --- a/samples/booking/app/controllers/gorp.go +++ b/samples/booking/app/controllers/gorp.go @@ -48,6 +48,8 @@ func (p GorpPlugin) OnAppStart() { }) t = dbm.AddTable(models.Booking{}).SetKeys(true, "BookingId") + t.ColMap("User").Transient = true + t.ColMap("Hotel").Transient = true setColumnSizes(t, map[string]int{ "CardNumber": 16, "NameOnCard": 50, diff --git a/samples/booking/app/controllers/init.go b/samples/booking/app/controllers/init.go index <HASH>..<HASH> 100644 --- a/samples/booking/app/controllers/init.go +++ b/samples/booking/app/controllers/init.go @@ -8,5 +8,5 @@ func init() { rev.InterceptMethod(Application.AddUser, rev.BEFORE) rev.InterceptMethod(Hotels.checkUser, rev.BEFORE) rev.InterceptMethod((*GorpController).Commit, rev.AFTER) - rev.InterceptMethod((*GorpController).Rollback, rev.PANIC) + rev.InterceptMethod((*GorpController).Rollback, rev.FINALLY) }
FIX for booking Gorp Still has issue of time.Time not being supported by Gorp since it can't Scan() directly into the field.
revel_revel
train
go,go
3791633fd470b3dc936ed8f10cc3dd735f84e4bc
diff --git a/src/Violation/Renderer/ConsoleOutputRenderer.php b/src/Violation/Renderer/ConsoleOutputRenderer.php index <HASH>..<HASH> 100644 --- a/src/Violation/Renderer/ConsoleOutputRenderer.php +++ b/src/Violation/Renderer/ConsoleOutputRenderer.php @@ -39,6 +39,19 @@ class ConsoleOutputRenderer implements RendererInterface */ public function renderViolations(array $violations, array $errors) { + $this->printViolations($violations); + $this->printErrors($errors); + } + + /** + * @param Violation[] $violations + */ + private function printViolations(array $violations) + { + if (0 === count($violations)) { + return; + } + $table = new Table($this->output); $table->setHeaders(array('#', 'Usage', 'Line', 'Comment')); @@ -62,6 +75,16 @@ class ConsoleOutputRenderer implements RendererInterface } $table->render(); + } + + /** + * @param Error[] $errors + */ + private function printErrors(array $errors) + { + if (0 === count($errors)) { + return; + } $this->output->writeln('<error>Your project contains invalid code:</error>'); foreach ($errors as $error) {
Prevent displaying misleading violations and errors output when there are none
sensiolabs-de_deprecation-detector
train
php
1cbb54e9da52d66bc09e181c34520df283bf46cd
diff --git a/src/Illuminate/Database/Console/Migrations/BaseCommand.php b/src/Illuminate/Database/Console/Migrations/BaseCommand.php index <HASH>..<HASH> 100755 --- a/src/Illuminate/Database/Console/Migrations/BaseCommand.php +++ b/src/Illuminate/Database/Console/Migrations/BaseCommand.php @@ -25,7 +25,7 @@ class BaseCommand extends Command } return array_merge( - [$this->getMigrationPath()], $this->migrator->paths() + $this->migrator->paths(), [$this->getMigrationPath()] ); }
Allow "app" migrations to override package migrations (#<I>)
laravel_framework
train
php
8298f2decf4eea17d7f743bd0f8d0a2065bdc8a6
diff --git a/Entity/OrderProduct.php b/Entity/OrderProduct.php index <HASH>..<HASH> 100755 --- a/Entity/OrderProduct.php +++ b/Entity/OrderProduct.php @@ -74,6 +74,15 @@ class OrderProduct implements EntityInterface return $this->getProduct()->getSellPrice(); } + public function getCurrentWeight(): float + { + if ($this->hasVariant()) { + return $this->getVariant()->getWeight(); + } + + return $this->getProduct()->getWeight(); + } + public function getQuantity(): int { return $this->quantity; diff --git a/Visitor/OrderProductVisitor.php b/Visitor/OrderProductVisitor.php index <HASH>..<HASH> 100755 --- a/Visitor/OrderProductVisitor.php +++ b/Visitor/OrderProductVisitor.php @@ -55,6 +55,7 @@ final class OrderProductVisitor implements OrderVisitorInterface $this->refreshOrderProductSellPrice($orderProduct); $this->refreshOrderProductBuyPrice($orderProduct); $this->refreshOrderProductVariantOptions($orderProduct); + $this->refreshOrderProductWeight($orderProduct); } } }); @@ -125,4 +126,9 @@ final class OrderProductVisitor implements OrderVisitorInterface $orderProduct->setOptions($options); } } + + private function refreshOrderProductWeight(OrderProduct $orderProduct) + { + $orderProduct->setWeight($orderProduct->getCurrentWeight()); + } }
Added weight refresh in order product visitor.
WellCommerce_WishlistBundle
train
php,php
ff0d859a8d4607a32a12946ce26285ac02521fd3
diff --git a/lib/chromedriver.js b/lib/chromedriver.js index <HASH>..<HASH> 100644 --- a/lib/chromedriver.js +++ b/lib/chromedriver.js @@ -26,6 +26,7 @@ const MIN_CD_VERSION_WITH_W3C_SUPPORT = 75; const DEFAULT_PORT = 9515; const CHROMEDRIVER_CHROME_MAPPING = { // Chromedriver version: minimum Chrome version + '80.0.3987.106': '80.0.3987.106', '79.0.3945.36': '79.0.3945.36', '78.0.3904.70': '78.0.3904.70', '77.0.3865.40': '77.0.3865.40',
feat: update to CD <I> (#<I>)
appium_appium-chromedriver
train
js
3e9389a943c6365f3cf1b17b4368f0689a679cdd
diff --git a/lib/omnibus/project.rb b/lib/omnibus/project.rb index <HASH>..<HASH> 100644 --- a/lib/omnibus/project.rb +++ b/lib/omnibus/project.rb @@ -364,7 +364,7 @@ module Omnibus # @return [String] # def build_version(val = NULL, &block) - if block && null?(val) + if block && !null?(val) raise Error, 'You cannot specify additional parameters to ' \ '#build_version when a block is given!' end
Use the correct conditional for raising an error
chef_omnibus
train
rb
a181a35db7da25ffb90d8f3694cc47828b87a6f8
diff --git a/spyderlib/plugins/editor.py b/spyderlib/plugins/editor.py index <HASH>..<HASH> 100644 --- a/spyderlib/plugins/editor.py +++ b/spyderlib/plugins/editor.py @@ -1302,11 +1302,15 @@ class Editor(SpyderPluginWidget): self.dockwidget.setFocus() self.dockwidget.raise_() + def _convert(fname): + fname = osp.abspath(encoding.to_unicode(fname)) + if os.name == 'nt' and len(fname) >= 2 and fname[1] == ':': + fname = fname[0].upper()+fname[1:] + return fname if not isinstance(filenames, (list, QStringList)): - filenames = [osp.abspath(encoding.to_unicode(filenames))] + filenames = [_convert(filenames)] else: - filenames = [osp.abspath(encoding.to_unicode(fname)) \ - for fname in list(filenames)] + filenames = [_convert(fname) for fname in list(filenames)] if isinstance(goto, int): goto = [goto] elif goto is not None and len(goto) != len(filenames):
Windows platforms/Editor/filename list sorting bugfix: drive letters in filenames were most of the time upper cased but sometimes lower cased (when following an error link in the console)
spyder-ide_spyder
train
py
5960198b4dd509521216223c1798a4ad2a8e5c07
diff --git a/openid/consumer/discover.py b/openid/consumer/discover.py index <HASH>..<HASH> 100644 --- a/openid/consumer/discover.py +++ b/openid/consumer/discover.py @@ -89,6 +89,10 @@ class OpenIDServiceEndpoint(object): def getLocalID(self): """Return the identifier that should be sent as the openid.identity parameter to the server.""" + # I looked at this conditional and thought "ah-hah! there's the bug!" + # but Python actually makes that one big expression somehow, i.e. + # "x is x is x" is not the same thing as "(x is x) is x". + # That's pretty weird, dude. -- kmt, 1/07 if (self.local_id is self.canonicalID is None): return self.claimed_id else:
[project @ x is y is z, wtf?]
openid_python-openid
train
py
21031345cb01e9c9e5b29874fbe7aa0b0afd2949
diff --git a/cldoc/tree.py b/cldoc/tree.py index <HASH>..<HASH> 100644 --- a/cldoc/tree.py +++ b/cldoc/tree.py @@ -35,10 +35,19 @@ if platform.system() == 'Darwin': '/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/libclang.dylib' ] + found = False + for libclang in libclangs: if os.path.exists(libclang): cindex.Config.set_library_path(os.path.dirname(libclang)) + found = True break + + if not found: + lname = find_library("clang") + + if not lname is None: + cindex.Config.set_library_file(lname) else: versions = [None, '3.5', '3.4', '3.3', '3.2'] @@ -54,6 +63,14 @@ else: cindex.Config.set_library_file(lname) break +testconf = cindex.Config() + +try: + testconf.get_cindex_library() +except cindex.LibclangError as e: + sys.stderr.write("\nFatal: Failed to locate libclang library. cldoc depends on libclang for parsing sources, please make sure you have libclang installed.\n" + str(e) + "\n\n") + sys.exit(1) + class Tree(documentmerger.DocumentMerger): def __init__(self, files, flags): self.processed = {}
Improve error message with libclang could not be found
jessevdk_cldoc
train
py
6eaf3ccfbde94f742d5c3cba4cd2b65d28c7edb0
diff --git a/salt/states/cron.py b/salt/states/cron.py index <HASH>..<HASH> 100644 --- a/salt/states/cron.py +++ b/salt/states/cron.py @@ -9,9 +9,11 @@ Cron declarations require a number of parameters. The timing parameters need to be declared: minute, hour, daymonth, month, and dayweek. The user whose crontab is to be edited also needs to be defined. -By default, the timing arguments are all ``*`` and the user is root. When -making changes to an existing cron job, the name declaration is the unique -factor, so if an existing cron that looks like this: +By default, the timing arguments are all ``*`` (**Caution**: This means just +setting ``hour`` to ``5`` and not defining minute will execute the cron entry +every minute between 5 and 6 am!) and the user is root. When making changes to +an existing cron job, the name declaration is the unique factor, so if an +existing cron that looks like this: .. code-block:: yaml
Added warning about * default to cron docs
saltstack_salt
train
py
c10fd5949bd98c245b53f5a33b8571f503b41aed
diff --git a/lib/espn_rb/headline.rb b/lib/espn_rb/headline.rb index <HASH>..<HASH> 100644 --- a/lib/espn_rb/headline.rb +++ b/lib/espn_rb/headline.rb @@ -9,11 +9,11 @@ module EspnRb end def api_resources - @api_resources ||= YAML::load(File.read('lib/espn_rb/api_definitions/headline_resources.yaml')) + @api_resources ||= YAML::load(File.read(File.expand_path(File.join(File.dirname(__FILE__), "..", 'espn_rb/api_definitions/headline_resources.yaml')))) end def api_methods - @api_methods ||= YAML::load(File.read('lib/espn_rb/api_definitions/headline_methods.yaml')) + @api_methods ||= YAML::load(File.read(File.expand_path(File.join(File.dirname(__FILE__), "..", 'espn_rb/api_definitions/headline_methods.yaml')))) end def get_results(resource, method)
Fix issue rondale-sc/EspnRb#1, File not found for yaml files from within gem.
rondale-sc_EspnRb
train
rb
ec966081bc0877a1eefae6d4dcdff4964cc6e949
diff --git a/src/js/glightbox.js b/src/js/glightbox.js index <HASH>..<HASH> 100644 --- a/src/js/glightbox.js +++ b/src/js/glightbox.js @@ -1609,7 +1609,7 @@ class GlightboxInit { this.prevActiveSlideIndex = this.index; const loop = this.loop(); - if (!loop && (index < 0 || index > this.elements.length)) { + if (!loop && (index < 0 || index > this.elements.length - 1)) { return false; } if (index < 0) {
Properly prevent looping from last to first via keyboard The button was disabled properly but `goToSlide` had an off-by-one error when comparing with `this.elements.length` so the keyboard arrows would still allow looping when disabled.
biati-digital_glightbox
train
js
899cdff3e8ee26ebbb424d3f979fb1822c887308
diff --git a/salt/master.py b/salt/master.py index <HASH>..<HASH> 100644 --- a/salt/master.py +++ b/salt/master.py @@ -412,11 +412,11 @@ class Publisher(multiprocessing.Process): pub_sock = context.socket(zmq.PUB) # if 2.1 >= zmq < 3.0, we only have one HWM setting try: - pub_sock.setsockopt(zmq.HWM, self.opts.get('pub_hwm', 100)) + pub_sock.setsockopt(zmq.HWM, self.opts.get('pub_hwm', 1000)) # in zmq >= 3.0, there are separate send and receive HWM settings except AttributeError: - pub_sock.setsockopt(zmq.SNDHWM, self.opts.get('pub_hwm', 100)) - pub_sock.setsockopt(zmq.RCVHWM, self.opts.get('pub_hwm', 100)) + pub_sock.setsockopt(zmq.SNDHWM, self.opts.get('pub_hwm', 1000)) + pub_sock.setsockopt(zmq.RCVHWM, self.opts.get('pub_hwm', 1000)) if self.opts['ipv6'] is True and hasattr(zmq, 'IPV4ONLY'): # IPv6 sockets work for both IPv6 and IPv4 addresses pub_sock.setsockopt(zmq.IPV4ONLY, 0)
Set default HWM in API call as well @basepi set the HWM to <I> by default in #<I> and this is a complementary commit to that one. It is now obvious that the HWM is <I> by default in the source code. X-ref: #<I> and #<I>
saltstack_salt
train
py
e31163329d785e3f109b9b78f6ad2baf09c3ee43
diff --git a/lib/brazenhead.rb b/lib/brazenhead.rb index <HASH>..<HASH> 100644 --- a/lib/brazenhead.rb +++ b/lib/brazenhead.rb @@ -20,6 +20,10 @@ module Brazenhead @last_response end + def last_json + device.last_json + end + private def call_method_on_driver(method, args) diff --git a/spec/lib/brazenhead_spec.rb b/spec/lib/brazenhead_spec.rb index <HASH>..<HASH> 100644 --- a/spec/lib/brazenhead_spec.rb +++ b/spec/lib/brazenhead_spec.rb @@ -34,5 +34,11 @@ describe Brazenhead do result = driver.foo_bar driver.last_response.should == result end + + it "should be able to return the json result" do + http_response.stub(:body).and_return("false") + driver.foo_bar + driver.last_json.should be_false + end end end
Brazenhead passes through the last_json
leandog_brazenhead
train
rb,rb
9216d2c140094809ff61413a7d6437513fa05efb
diff --git a/src/Fumocker/Proxy.php b/src/Fumocker/Proxy.php index <HASH>..<HASH> 100644 --- a/src/Fumocker/Proxy.php +++ b/src/Fumocker/Proxy.php @@ -51,6 +51,12 @@ class Proxy $this->namespace = $namespace; } + /** + * @throws \InvalidArgumentException + * @param $callback + * + * @return void + */ public function setCallback($callback) { if (false == is_callable($callback)) { @@ -60,18 +66,27 @@ class Proxy $this->callback = $callback; } + /** + * @return mixed + */ public function call() { return call_user_func_array($this->callback ?: $this->functionName, func_get_args()); } + /** + * @return string + */ public function getFunctionName() { return $this->functionName; } + /** + * @return string + */ public function getNamespace() { return $this->namespace; } -} +} \ No newline at end of file
[proxy] add docblock where missing
formapro_Fumocker
train
php
c3558a3ae92d9e5ccb8bbe1577d5737cf97c4220
diff --git a/guacamole-ext/src/main/java/org/glyptodon/guacamole/form/Form.java b/guacamole-ext/src/main/java/org/glyptodon/guacamole/form/Form.java index <HASH>..<HASH> 100644 --- a/guacamole-ext/src/main/java/org/glyptodon/guacamole/form/Form.java +++ b/guacamole-ext/src/main/java/org/glyptodon/guacamole/form/Form.java @@ -73,6 +73,8 @@ public class Form { * The fields to provided within the new Form. */ public Form(String name, String title, Collection<Field> fields) { + this.name = name; + this.title = title; this.fields = fields; }
GUAC-<I>: Properly initialize name and title in Form constructor.
glyptodon_guacamole-client
train
java
9322443befdf53c6fa2cedceab9d73301ca6d919
diff --git a/lib/emit.js b/lib/emit.js index <HASH>..<HASH> 100644 --- a/lib/emit.js +++ b/lib/emit.js @@ -105,6 +105,7 @@ Ep.contextProperty = function(name) { }; var volatileContextPropertyNames = { + prev: true, next: true, sent: true, rval: true, @@ -273,7 +274,14 @@ Ep.getDispatchLoop = function() { return b.whileStatement( b.literal(1), - b.switchStatement(this.contextProperty("next"), cases) + b.switchStatement( + b.assignmentExpression( + "=", + this.contextProperty("prev"), + this.contextProperty("next") + ), + cases + ) ); }; diff --git a/runtime/dev.js b/runtime/dev.js index <HASH>..<HASH> 100644 --- a/runtime/dev.js +++ b/runtime/dev.js @@ -184,6 +184,7 @@ constructor: Context, reset: function() { + this.prev = 0; this.next = 0; this.sent = void 0; this.tryStack = [];
Record the last initial value of context.next as context.prev.
facebook_regenerator
train
js,js