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
80557ba26c6f9d4fde94a7989816c07099c5b587
diff --git a/txtorcon/torstate.py b/txtorcon/torstate.py index <HASH>..<HASH> 100644 --- a/txtorcon/torstate.py +++ b/txtorcon/torstate.py @@ -525,8 +525,17 @@ class TorState(object): else: if routers[0] not in self.entry_guards.values(): warnings.warn("Building a circuit not starting with a guard: %s" % (str(routers),), RuntimeWarning) - cmd = "EXTENDCIRCUIT 0 " + ','.join(map(lambda x: x.id_hex[1:], routers)) - + cmd = "EXTENDCIRCUIT 0 " + first = True + for router in routers: + if first: + first = False + else: + cmd += ',' + if type(router) is type('') and len(router) == 40 and hashFromHexId(router): + cmd += router + else: + cmd += router.id_hex[1:] d = self.protocol.queue_command(cmd) d.addCallback(self._find_circuit_after_extend) return d
allow build_circuit to take router-hex-ids as well as Router instances
meejah_txtorcon
train
py
1b5d6cd7242169a319abb9eab82f2c0a4a5aa8a6
diff --git a/tests/unit/geometry/BoundaryTest.py b/tests/unit/geometry/BoundaryTest.py index <HASH>..<HASH> 100644 --- a/tests/unit/geometry/BoundaryTest.py +++ b/tests/unit/geometry/BoundaryTest.py @@ -52,6 +52,10 @@ class BoundaryTest: pores=Ps_int, throats=Ts_int) boun = op.geometry.Boundary(network=pn, pores=Ps_boun, throats=Ts_boun) + mod = op.models.geometry.diffusive_size_factors.cones_and_cylinders + boun.add_model(propname='throat.diffusive_size_factors', model=mod) + mod = op.models.geometry.hydraulic_size_factors.cones_and_cylinders + boun.add_model(propname='throat.hydraulic_size_factors', model=mod) geo.regenerate_models() boun.regenerate_models() air = op.phases.Air(network=pn)
Found a problem with size factor method. Conditions for bound pores should be added to size factors in geom models
PMEAL_OpenPNM
train
py
73e7570ff5fd0f9e9b7827e693bbb68f888ab737
diff --git a/openquake/hazardlib/contexts.py b/openquake/hazardlib/contexts.py index <HASH>..<HASH> 100644 --- a/openquake/hazardlib/contexts.py +++ b/openquake/hazardlib/contexts.py @@ -531,7 +531,7 @@ class PmapMaker(object): else: # some sites are far, some are close yield [pr], far yield self._ruptures(src, pr.mag), close - else: # do nothing + else: # just yield the ruptures yield self._ruptures(src), sites
Improved a comment [skip CI]
gem_oq-engine
train
py
6afb717be545073c739adcfd917138b664e81b89
diff --git a/core/rawdb/freezer_table.go b/core/rawdb/freezer_table.go index <HASH>..<HASH> 100644 --- a/core/rawdb/freezer_table.go +++ b/core/rawdb/freezer_table.go @@ -153,8 +153,15 @@ func newTable(path string, name string, readMeter metrics.Meter, writeMeter metr if err != nil { return nil, err } - // Will fail if the table is legacy(no metadata) - meta, err = openFreezerFileForReadOnly(filepath.Join(path, fmt.Sprintf("%s.meta", name))) + // TODO(rjl493456442) change it to read-only mode. Open the metadata file + // in rw mode. It's a temporary solution for now and should be changed + // whenever the tail deletion is actually used. The reason for this hack is + // the additional meta file for each freezer table is added in order to support + // tail deletion, but for most legacy nodes this file is missing. This check + // will suddenly break lots of database relevant commands. So the metadata file + // is always opened for mutation and nothing else will be written except + // the initialization. + meta, err = openFreezerFileForAppend(filepath.Join(path, fmt.Sprintf("%s.meta", name))) if err != nil { return nil, err }
core/rawdb: fix db commands (#<I>)
ethereum_go-ethereum
train
go
ff8ef0b04cd52bd317890596bdf9615b09a8f8cf
diff --git a/testing/junit_ext/src/java/com/google/j2objc/testing/JUnitTestRunner.java b/testing/junit_ext/src/java/com/google/j2objc/testing/JUnitTestRunner.java index <HASH>..<HASH> 100644 --- a/testing/junit_ext/src/java/com/google/j2objc/testing/JUnitTestRunner.java +++ b/testing/junit_ext/src/java/com/google/j2objc/testing/JUnitTestRunner.java @@ -38,7 +38,6 @@ import org.junit.runner.Result; import org.junit.runner.RunWith; import org.junit.runner.notification.Failure; import org.junit.runner.notification.RunListener; -import org.junit.runners.JUnit4; import org.junit.runners.Suite; /*-[ @@ -259,15 +258,8 @@ public class JUnitTestRunner { return false; } - /** - * @return true if {@param cls} is {@link JUnit4} annotated. - */ + /** @return true if {@param cls} is {@link RunWith} annotated. */ protected boolean isJUnit4TestClass(Class<?> cls) { - // Need to find test classes, otherwise crashes with b/11790448. - if (!cls.getName().endsWith("Test")) { - return false; - } - // Check the annotation. return cls.getAnnotation(RunWith.class) != null; }
Stop using class name heuristics to filter out non-tests. The bug that made that necessary has been fixed by now.
google_j2objc
train
java
13427b511c146a87dcd1b90d3e49ea425a4e1c6e
diff --git a/lib/phusion_passenger/config/validate_install_command.rb b/lib/phusion_passenger/config/validate_install_command.rb index <HASH>..<HASH> 100644 --- a/lib/phusion_passenger/config/validate_install_command.rb +++ b/lib/phusion_passenger/config/validate_install_command.rb @@ -148,6 +148,7 @@ module PhusionPassenger PhusionPassenger.require_passenger_lib 'platform_info/apache' PhusionPassenger.require_passenger_lib 'platform_info/apache_detector' require 'stringio' + require 'pathname' @error_count = 0 @warning_count = 0 @@ -449,7 +450,15 @@ module PhusionPassenger end if occurrences == 1 - if module_path == PhusionPassenger.apache2_module_path + if module_path !~ /^\// + # Non-absolute path. Absolutize using ServerRoot. + module_path = "#{PlatformInfo.httpd_default_root}/#{module_path}" + end + # Resolve symlinks. + module_path = Pathname.new(module_path).realpath + expected_module_path = Pathname.new(PhusionPassenger.apache2_module_path).realpath + + if module_path == expected_module_path check_ok else check_error
Improve passenger-config validate-install Apache module paths may be relative to ServerRoot, and the ServerRoot may be a symlink.
phusion_passenger
train
rb
6bf3891c764d42e01dae4e36c06216b969e1771d
diff --git a/src/Component/PageTotalsRow.php b/src/Component/PageTotalsRow.php index <HASH>..<HASH> 100644 --- a/src/Component/PageTotalsRow.php +++ b/src/Component/PageTotalsRow.php @@ -141,6 +141,10 @@ class PageTotalsRow implements PartInterface, ViewComponentInterface $valueFormatters[$column->getId()] = $prevFormatter = $column->getValueFormatter(); $column->setValueCalculator(null); $column->setValueFormatter(function ($value) use ($prevFormatter, $column) { + $operation = $this->getOperation($column->getId()); + if ($operation === static::OPERATION_IGNORE){ + return null; + } if ($prevFormatter) { $value = call_user_func($prevFormatter, $value); }
Ignored fields in total row fix
view-components_grids
train
php
6180b82256246082b7e5367450bd7b40261bc1d1
diff --git a/src/main/java/org/takes/package-info.java b/src/main/java/org/takes/package-info.java index <HASH>..<HASH> 100644 --- a/src/main/java/org/takes/package-info.java +++ b/src/main/java/org/takes/package-info.java @@ -42,9 +42,6 @@ * @todo #998:30min Replace the usage of {@link java.lang.String}.format * in the project and leverage {@link org.cactoos.text.FormattedText} decorator * as it is an elegant object oriented way. - * @todo #998:30min Replace the usage of {@link java.lang.String}.trim - * in the project and leverage {@link org.cactoos.text.Trimmed} decorator - * as it is an elegant object oriented way. * @todo #998:30min Replace the usage of {@link java.lang.String}.startsWith * in the project and leverage the future functionality described in the issue * https://github.com/yegor256/cactoos/issues/1265 as it is an elegant object
(#<I>) Removed TODO for this ticket
yegor256_takes
train
java
2cf4e594f0c3161b622926a713df1b6a7b614fce
diff --git a/libraries/lithium/core/Adaptable.php b/libraries/lithium/core/Adaptable.php index <HASH>..<HASH> 100644 --- a/libraries/lithium/core/Adaptable.php +++ b/libraries/lithium/core/Adaptable.php @@ -281,6 +281,10 @@ class Adaptable extends \lithium\core\StaticObject { } $env = Environment::get(); $config = isset($settings[$env]) ? $settings[$env] : $settings; + + if (isset($settings[$env]) && isset($settings[true])) { + $config += $settings[true]; + } static::$_configurations[$name] += array(static::_initConfig($name, $config)); return static::$_configurations[$name][0]; }
Allowing environments-based `Adaptable` configuration to use inherit from a base configuration using the key `true`.
UnionOfRAD_framework
train
php
57ce51d4effb201dae66e121e4c4140b3d434804
diff --git a/instaloader/__main__.py b/instaloader/__main__.py index <HASH>..<HASH> 100644 --- a/instaloader/__main__.py +++ b/instaloader/__main__.py @@ -1,6 +1,7 @@ """Download pictures (or videos) along with their captions and other metadata from Instagram.""" import ast +import datetime import os import sys from argparse import ArgumentParser, SUPPRESS @@ -35,6 +36,8 @@ def filterstr_to_filterfunc(filter_str: str, item_type: type): # pylint:disable=no-self-use if not isinstance(node.ctx, ast.Load): raise InvalidArgumentException("Invalid filter: Modifying variables ({}) not allowed.".format(node.id)) + if node.id == "datetime": + return node if not hasattr(item_type, node.id): raise InvalidArgumentException("Invalid filter: {} not a {} attribute.".format(node.id, item_type.__name__)) @@ -48,7 +51,7 @@ def filterstr_to_filterfunc(filter_str: str, item_type: type): def filterfunc(item) -> bool: # pylint:disable=eval-used - return bool(eval(compiled_filter, {'item': item})) + return bool(eval(compiled_filter, {'item': item, 'datetime': datetime.datetime})) return filterfunc
Support datetime objects in filter strings Now --only-if="date_utc<datetime(<I>,1,1,hour=<I>)" is possible.
instaloader_instaloader
train
py
c346976359ca30d1817c1d568ea37b24791863af
diff --git a/app/Http/Controllers/Tools/TagsController.php b/app/Http/Controllers/Tools/TagsController.php index <HASH>..<HASH> 100644 --- a/app/Http/Controllers/Tools/TagsController.php +++ b/app/Http/Controllers/Tools/TagsController.php @@ -15,11 +15,9 @@ class TagsController extends Controller */ public function show($tag = null) { - if (is_null($tag)) { - $tags = Post::allTags()->orderBy('count', 'desc')->limit(10)->get(); - }else{ + } else { $tags = Post::allTags()->orderBy('count', 'desc')->where('name', 'like', '%' . $tag . '%')->limit(10)->get(); } @@ -32,5 +30,4 @@ class TagsController extends Controller return response()->json($tags); } - }
Apply fixes from StyleCI (#<I>) [ci skip] [skip ci]
orchidsoftware_platform
train
php
dfbb9a79dbf82bf290e75478cd30b927e0667212
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -22,7 +22,7 @@ setup( packages=find_packages(), long_description=read('README.rst'), install_requires=[ - 'PyJWT>=1.0.1,<2.0.0', + 'PyJWT>=1.0.1', 'oauthlib', 'requests', 'requests-oauthlib',
unpin pyjwt pyjwt is pinned to <<I>, preventing installation of current pyjwt The current use of pyjwt appears to works just fine on pyjwt 2
mediawiki-utilities_python-mwoauth
train
py
e1200b8e3527b6ec7b51c97775eac119fdb390d3
diff --git a/test.js b/test.js index <HASH>..<HASH> 100644 --- a/test.js +++ b/test.js @@ -261,6 +261,27 @@ function runTests (options) { }); }); }); + it('should ignore unwatched siblings', function(done) { + var spy = sinon.spy(); + var testPath = getFixturePath('add.txt'); + var siblingPath = getFixturePath('change.txt'); + options.persistent = true; + var watcher = chokidar.watch(testPath, options).on('all', spy); + delay(function() { + fs.writeFileSync(siblingPath, 'c'); + delay(function() { + spy.should.not.have.been.called; + fs.writeFileSync(testPath, 'a'); + delay(function() { + fs.unlinkSync(testPath); + spy.should.have.been.calledWith('add', testPath); + delete options.persistent; + watcher.close(); + done(); + }); + }); + }); + }); }); describe('watch options', function() { function clean (done) {
Test ensuring only the watched file emits events
paulmillr_chokidar
train
js
d7447b73a34b115b7351e0cc3351309205dfeeb3
diff --git a/src/Funstaff/Tika/Wrapper.php b/src/Funstaff/Tika/Wrapper.php index <HASH>..<HASH> 100644 --- a/src/Funstaff/Tika/Wrapper.php +++ b/src/Funstaff/Tika/Wrapper.php @@ -21,8 +21,19 @@ use Symfony\Component\Process\Process; */ class Wrapper implements WrapperInterface { + /** + * @var LoggerInterface + */ protected $logger; + + /** + * @var ConfigurationInterface + */ protected $config; + + /** + * @var array + */ protected $document; /** @@ -33,6 +44,7 @@ class Wrapper implements WrapperInterface public function __construct(ConfigurationInterface $config) { $this->config = $config; + $this->document = array(); } /**
PHPdoc updated. correct initialization.
Funstaff_Tika
train
php
ff334dfa7d1687a923f476db1166acd47e7ee059
diff --git a/src/javascripts/frigging_bootstrap/components/timepicker.js b/src/javascripts/frigging_bootstrap/components/timepicker.js index <HASH>..<HASH> 100644 --- a/src/javascripts/frigging_bootstrap/components/timepicker.js +++ b/src/javascripts/frigging_bootstrap/components/timepicker.js @@ -11,12 +11,19 @@ export default class extends React.Component { _input() { return input(Object.assign({}, this.props.inputHtml, { - valueLink: this.props.valueLink, - className: cx(this.props.inputHtml.className, "form-control"), + valueLink: { + value: this.props.valueLink.value, + requestChange: this._onTimeChange, + }, + className: cx(this.props.inputHtml.className, "form-control"), }) ) } + _onTimeChange(newTime) { + console.log(`New Time ${newTime}`) + } + render() { return div({className: cx(sizeClassNames(this.props))}, div({className: formGroupCx(this.props)},
Add ValueLink To On Change For Timepicker
frig-js_frig
train
js
6150af154a5f15550730ccaf45c7784e0c9e9b55
diff --git a/Controller/TrackingController.php b/Controller/TrackingController.php index <HASH>..<HASH> 100755 --- a/Controller/TrackingController.php +++ b/Controller/TrackingController.php @@ -285,7 +285,7 @@ EOT $sourceLocation = null; - if($request->get('source') == $target){ + if($sourceUrl == $targetUrl){ /* * If the source equals the target, then the source is actually * an Activity's CTA. diff --git a/Util/ParserUtil.php b/Util/ParserUtil.php index <HASH>..<HASH> 100755 --- a/Util/ParserUtil.php +++ b/Util/ParserUtil.php @@ -22,7 +22,7 @@ class ParserUtil static function getHTMLTitle($website, $page = null) { if(self::isSameHost($website)){ - return 'Page on same host.'; + return $website; } if($page == null){
CampaignChain/campaignchain#<I> Make tracking code work with form submit
CampaignChain_core
train
php,php
407f4208e91dabdeb0ffa9a1489abfdcd189c794
diff --git a/lib/Server.php b/lib/Server.php index <HASH>..<HASH> 100644 --- a/lib/Server.php +++ b/lib/Server.php @@ -2,8 +2,6 @@ namespace Aerys; -use \Generator; - use Amp\{ Struct, Reactor, @@ -201,7 +199,7 @@ class Server implements \SplSubject { } } - private function doStart(): Generator { + private function doStart(): \Generator { assert($this->logDebug("starting")); $addrCtxMap = $this->generateBindableAddressContextMap(); @@ -350,7 +348,7 @@ class Server implements \SplSubject { } } - private function doStop(): Generator { + private function doStop(): \Generator { assert($this->logDebug("stopping")); $this->state = self::STOPPING; @@ -763,7 +761,7 @@ class Server implements \SplSubject { $request = new StandardRequest($ireq); $out = ($application)($request, $response); - if ($out instanceof Generator) { + if ($out instanceof \Generator) { $promise = resolve($out, $this->reactor); $promise->when($this->onCoroutineAppResolve, $ireq); } elseif ($response->state() & Response::STARTED) {
Use fully-qualified name for Generator references
amphp_http-server
train
php
772fd496b7f164269674daf0706e886621d23d2f
diff --git a/src/Psalm/Type/Reconciler.php b/src/Psalm/Type/Reconciler.php index <HASH>..<HASH> 100644 --- a/src/Psalm/Type/Reconciler.php +++ b/src/Psalm/Type/Reconciler.php @@ -112,7 +112,9 @@ class Reconciler $has_equality = true; } - $has_isset = $has_isset || $new_type_part_part === 'isset'; + $has_isset = $has_isset + || $new_type_part_part === 'isset' + || $new_type_part_part === 'array-key-exists'; $result_type_candidate = self::reconcileTypes( $new_type_part_part, diff --git a/tests/RedundantConditionTest.php b/tests/RedundantConditionTest.php index <HASH>..<HASH> 100644 --- a/tests/RedundantConditionTest.php +++ b/tests/RedundantConditionTest.php @@ -423,6 +423,15 @@ class RedundantConditionTest extends TestCase var_export($x); }', ], + 'arrayKeyExistsAccess' => [ + '<?php + /** @param array<int, string> $arr */ + function foo(array $arr) : void { + if (array_key_exists(1, $arr)) { + $a = ($arr[1] === "b") ? true : false; + } + }', + ], ]; }
Fix issue with array_key_exists not having an effect
vimeo_psalm
train
php,php
0cae269dc0a9d652c217f20ebd568fb41d3b3d01
diff --git a/cinje/benchmark.py b/cinje/benchmark.py index <HASH>..<HASH> 100644 --- a/cinje/benchmark.py +++ b/cinje/benchmark.py @@ -44,7 +44,7 @@ : for key, value in row.items() <td>${ key }</td><td>#{ value }</td> : end - : if not (i % frequency): + : if not (i % frequency) : flush : end </tr> @@ -62,7 +62,7 @@ : for key, value in row.items() <td&{class_="first" if first else ("last" if last else None)}>${ key }</td><td>#{ value }</td> : end - : if not (i % frequency): + : if not (i % frequency) : flush : end </tr>
Silly rabbit, colons go on the beginnings of code lines.
marrow_cinje
train
py
22089b0d9f172fd2ffadf76e9b98e38d7578801d
diff --git a/src/Stagehand/TestRunner/Core/Bootstrap.php b/src/Stagehand/TestRunner/Core/Bootstrap.php index <HASH>..<HASH> 100644 --- a/src/Stagehand/TestRunner/Core/Bootstrap.php +++ b/src/Stagehand/TestRunner/Core/Bootstrap.php @@ -54,6 +54,7 @@ class Bootstrap * @var array */ private static $namespaces = array( + 'Stagehand\AlterationMonitor', 'Stagehand\ComponentFactory', 'Symfony\Component\Config', 'Symfony\Component\Console',
Added a missing namespace to be loaded.
piece_stagehand-testrunner
train
php
a9f116fdd5f300c3432b670209626b6c7801cac1
diff --git a/rejected/process.py b/rejected/process.py index <HASH>..<HASH> 100644 --- a/rejected/process.py +++ b/rejected/process.py @@ -436,7 +436,11 @@ class Process(multiprocessing.Process, state.State): """ if method.redelivered: self.stats.incr(self.REDELIVERED) - self.invoke_consumer(data.Message(channel, method, properties, body)) + try: + self.invoke_consumer(data.Message(channel, method, properties, + body)) + except AttributeError: + pass def on_processed(self, message, result, start_time): self.stats.add_timing(self.TIME_SPENT, time.time() - start_time)
Handle CTRL-C shutdown (lock disappears on shutdown)
gmr_rejected
train
py
b7339ff537583ae291d7f17d5e59b40123a89691
diff --git a/livvkit/util/options.py b/livvkit/util/options.py index <HASH>..<HASH> 100644 --- a/livvkit/util/options.py +++ b/livvkit/util/options.py @@ -61,7 +61,7 @@ def parse(args): parser.add_argument('--verification', nargs=2, default=None, - help='Specify the locations of the test bundle to verify.') + help='Specify the locations of the test and bench bundle to compare (respectively).') parser.add_argument('--validation', action='store',
Add the test and bench order to veifications help message.
LIVVkit_LIVVkit
train
py
2dfb0610638efdee0e6df2eee3c02e63faf1a56d
diff --git a/sanic/app.py b/sanic/app.py index <HASH>..<HASH> 100644 --- a/sanic/app.py +++ b/sanic/app.py @@ -545,7 +545,7 @@ class Sanic: def run(self, host=None, port=None, debug=False, ssl=None, sock=None, workers=1, protocol=None, backlog=100, stop_event=None, register_sys_signals=True, - log_config=LOGGING): + log_config=None): """Run the HTTP Server and listen until keyboard interrupt or term signal. On termination, drain connections before closing.
Prevent `run` from overriding logging config set in constructor When creating the `Sanic` instance I provide it with a customized `log_config`. Calling `run` overrides these settings unless I provide it *again* with the same `log_config`. This is confusing and error prone. `run` shouldnt override configurations set in the `Sanic` constructor...
huge-success_sanic
train
py
63b920e31db0075a5655081ae64943a89d7df213
diff --git a/Swat/SwatDateEntry.php b/Swat/SwatDateEntry.php index <HASH>..<HASH> 100644 --- a/Swat/SwatDateEntry.php +++ b/Swat/SwatDateEntry.php @@ -158,7 +158,7 @@ class SwatDateEntry extends SwatControl implements SwatState $this->addJavaScript('swat/javascript/swat-find-index.js'); $this->addJavaScript('swat/javascript/swat-date-entry.js'); $this->addJavaScript('swat/javascript/swat-time-entry.js'); - $this->addStylesheet('swat-calendar.css'); + $this->addStylesheet('swat/swat-calendar.css'); } /** diff --git a/Swat/SwatWidget.php b/Swat/SwatWidget.php index <HASH>..<HASH> 100644 --- a/Swat/SwatWidget.php +++ b/Swat/SwatWidget.php @@ -69,7 +69,7 @@ abstract class SwatWidget extends SwatObject public function __construct($id = null) { $this->id = $id; - $this->addStylesheet('swat.css'); + $this->addStylesheet('swat/swat.css'); $this->init(); }
Fix paths to stylesheets. svn commit r<I>
silverorange_swat
train
php,php
3e20c949fe72dc3c762d88f2275c8a0c665968a5
diff --git a/lib/model/XWikiDoc.js b/lib/model/XWikiDoc.js index <HASH>..<HASH> 100644 --- a/lib/model/XWikiDoc.js +++ b/lib/model/XWikiDoc.js @@ -118,7 +118,7 @@ var create = module.exports.create = function (name) { addTag('attachment', { filename: filePath.split('/').pop(), filesize: stat.size, - author: (options && options.author) || "XWiki.Admin", + author: (options && options.author) || "xwiki:XWiki.Admin", date: (options && options.date) || "1364415417000", version: (options && options.version) || "1.1", comment: (options && options.comment) || "",
Attachments should default to xwiki:XWiki.Admin otherwise they will not have programming rights.
xwiki-contrib_xwiki-tools-node
train
js
1f0aa819dab8cbe048f59cb190fedec3301dc655
diff --git a/lib/haml/helpers.rb b/lib/haml/helpers.rb index <HASH>..<HASH> 100755 --- a/lib/haml/helpers.rb +++ b/lib/haml/helpers.rb @@ -381,7 +381,7 @@ MESSAGE end captured.map do |line| - line[min_tabs..-1] + line.slice(min_tabs, line.length) end.join end ensure
optimize capture_haml line to create fewer objects
haml_haml
train
rb
373ae77aa069900c36737729b1f5eba8cd6c0c5e
diff --git a/Gruntfile.js b/Gruntfile.js index <HASH>..<HASH> 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -95,8 +95,6 @@ module.exports = function (grunt) { 'uglify:latest' ]); - grunt.registerTask('test', [ - 'nodeunit' - ]); + grunt.registerTask('test', [ 'nodeunit' ]); }; \ No newline at end of file
Preparing for nodeunit and test procedures
hbi99_defiant.js
train
js
0c5bdfd7b7a3d7dda68c5f8188b9715354c797f8
diff --git a/dependency-check-utils/src/main/java/org/owasp/dependencycheck/utils/Settings.java b/dependency-check-utils/src/main/java/org/owasp/dependencycheck/utils/Settings.java index <HASH>..<HASH> 100644 --- a/dependency-check-utils/src/main/java/org/owasp/dependencycheck/utils/Settings.java +++ b/dependency-check-utils/src/main/java/org/owasp/dependencycheck/utils/Settings.java @@ -468,6 +468,17 @@ public final class Settings { } /** + * Sets a property value. + * + * @param key the key for the property + * @param value the value for the property + */ + public static void setInt(String key, int value) { + localSettings.get().props.setProperty(key, String.valueOf(value)); + LOGGER.debug("Setting: {}='{}'", key, value); + } + + /** * Merges a new properties file into the current properties. This method allows for the loading of a user provided properties * file.<br/><br/> * Note: even if using this method - system properties will be loaded before properties loaded from files.
added a setInt in support of PR #<I>
jeremylong_DependencyCheck
train
java
e22eaf2ec14d6cd3053ecf83d8a8e9e5c8c8b27d
diff --git a/libkbfs/bcache.go b/libkbfs/bcache.go index <HASH>..<HASH> 100644 --- a/libkbfs/bcache.go +++ b/libkbfs/bcache.go @@ -146,6 +146,7 @@ func (b *BlockCacheStandard) makeRoomForSize(size uint64) bool { return false } + oldLen := b.cleanTransient.Len() + 1 doUnlock := true b.bytesLock.Lock() defer func() { @@ -156,13 +157,16 @@ func (b *BlockCacheStandard) makeRoomForSize(size uint64) bool { // Evict items from the cache until the bytes capacity is lower // than the total capacity (or until no items are removed). - oldLen := b.cleanTransient.Len() + 1 - for b.cleanTotalBytes+size > b.cleanBytesCapacity && - oldLen != b.cleanTransient.Len() { - oldLen = b.cleanTransient.Len() - // Unlock while removing, since onEvict needs the lock. + for b.cleanTotalBytes+size > b.cleanBytesCapacity { + // Unlock while removing, since onEvict needs the lock and + // cleanTransient.Len() takes the LRU mutex (which could lead + // to a deadlock with onEvict). b.bytesLock.Unlock() doUnlock = false + if oldLen == b.cleanTransient.Len() { + break + } + oldLen = b.cleanTransient.Len() b.cleanTransient.RemoveOldest() doUnlock = true b.bytesLock.Lock()
bcache: avoid deadlock between makeRoomForSize and onEvict The deadlock: * golang-lru takes its internal lock, calls b.onEvict, which takes bytesLock * b.makeRootForSize takes bytesLock, calls cleanTransient.Len(), which takes the golang-lru internal lock. Instead, only access cleanTransient.Len() outside of the bytesLock critical section. Issue: KBFS-<I>
keybase_client
train
go
740a4c0c4dee6b8d3860c5fa3982d6bdb16a13f6
diff --git a/Kwf/Model/Row/Abstract.php b/Kwf/Model/Row/Abstract.php index <HASH>..<HASH> 100644 --- a/Kwf/Model/Row/Abstract.php +++ b/Kwf/Model/Row/Abstract.php @@ -630,7 +630,7 @@ abstract class Kwf_Model_Row_Abstract implements Kwf_Model_Row_Interface, Serial public function freeMemory() { if (!$this->_siblingRowsWhereSet) { - unset($this->_siblingRows); + $this->_siblingRows = null; } $this->_childRows = array(); }
set siblingRows to null so it won't cause problems when calling freeMemory twice
koala-framework_koala-framework
train
php
391de11e82f44c5fc9b2fbf0c8f6bde4cb0e8609
diff --git a/src/User/Password.php b/src/User/Password.php index <HASH>..<HASH> 100644 --- a/src/User/Password.php +++ b/src/User/Password.php @@ -663,6 +663,12 @@ class Password $hzup = self::getInstance($user); + // Make sure we found a record + if (!$hzup) + { + return false; + } + $oldhash = $hzup->__get('passhash'); $hzup->__set('passhash', $passhash);
[fix] Make sure an object is returned form lookup (#<I>)
hubzero_framework
train
php
1bd5ac8298d471a6394cb1e0997772eee98f15dd
diff --git a/src/make.js b/src/make.js index <HASH>..<HASH> 100644 --- a/src/make.js +++ b/src/make.js @@ -34,6 +34,7 @@ exports.exec = function(input, output, metadata, options, callback) { }); }; }); + bar.tick(0); async.series(ops, callback); } else { callback();
Always print an empty progress bar first, in case the first file take a while to process
thumbsup_thumbsup
train
js
4a93f0639a71ba3788447506147546161a839f3f
diff --git a/pgmpy/models/BayesianModel.py b/pgmpy/models/BayesianModel.py index <HASH>..<HASH> 100644 --- a/pgmpy/models/BayesianModel.py +++ b/pgmpy/models/BayesianModel.py @@ -423,7 +423,7 @@ class BayesianModel(DirectedGraph): Page 75 Algorithm 3.1 """ if observed: - observed_list = [observed] if isinstance(observed, str) else observed + observed_list = observed if isinstance(observed, (list, tuple)) else [observed] else: observed_list = [] ancestors_list = self._get_ancestors_of(observed_list)
active_trail accepts hashable objects
pgmpy_pgmpy
train
py
fae68bf0aa61c2233287623ac14a54489337b7ec
diff --git a/lib/geocoder/openstreetmapgeocoder.js b/lib/geocoder/openstreetmapgeocoder.js index <HASH>..<HASH> 100644 --- a/lib/geocoder/openstreetmapgeocoder.js +++ b/lib/geocoder/openstreetmapgeocoder.js @@ -56,7 +56,7 @@ OpenStreetMapGeocoder.prototype._formatResult = function(result) { 'city' : result.address.city, 'state': result.address.state, 'zipcode' : result.address.postcode, - 'streetName': result.address.road, + 'streetName': result.address.road || result.address.cycleway, 'streetNumber' : result.address.house_number, 'countryCode' : result.address.country_code
#<I> OpenStreetMap : streetName is sometimes undefined In some specific cases, nominatim does not returns 'road' in address but 'cycleway' for the streetName. Ex : <URL>
nchaulet_node-geocoder
train
js
51eb0f8455445f6ec59d9618721e5784243524b2
diff --git a/app/router.js b/app/router.js index <HASH>..<HASH> 100644 --- a/app/router.js +++ b/app/router.js @@ -1,3 +1,5 @@ +/* eslint-disable ember/no-incorrect-calls-with-inline-anonymous-functions */ + import EmberRouter from '@ember/routing/router'; import config from './config/environment';
turn off lintig rule for one file
ember-learn_guides-source
train
js
d1602a4268b4553c4c49dc3c71ef257014ff61a1
diff --git a/src/Message/Response.php b/src/Message/Response.php index <HASH>..<HASH> 100644 --- a/src/Message/Response.php +++ b/src/Message/Response.php @@ -16,6 +16,10 @@ class Response extends AbstractResponse parse_str($data, $this->data); } + public function isPending() { + return isset($this->data['PAYMENTINFO_0_PAYMENTSTATUS']) && $this->data['PAYMENTINFO_0_PAYMENTSTATUS'] == 'Pending'; + } + public function isSuccessful() { return isset($this->data['ACK']) && in_array($this->data['ACK'], array('Success', 'SuccessWithWarning'));
Add function to check if PayPal response is actually Pending (thephpleague/omnipay-paypal#<I>)
thephpleague_omnipay-paypal
train
php
cde514e8316d9bf057f54de4b5bd909f2cbcfee5
diff --git a/yOpenApi/__init__.py b/yOpenApi/__init__.py index <HASH>..<HASH> 100644 --- a/yOpenApi/__init__.py +++ b/yOpenApi/__init__.py @@ -92,8 +92,7 @@ class yOpenSanic(): for key, value in field.metadata.items(): schema["properties"][field.name]["{}{}".format(metadata_prefix, key.lower())] = value - if required: - schema["required"] = required + schema["required"] = required if hasattr(model, "form"): schema["{}form".format(metadata_prefix)] = model.form
required is mandatory even if its empty
Garito_yOpenApi
train
py
695a9733c55e6e3e90a830109b6685d7fbd9bb9c
diff --git a/horizon/dashboards/nova/instances/workflows.py b/horizon/dashboards/nova/instances/workflows.py index <HASH>..<HASH> 100644 --- a/horizon/dashboards/nova/instances/workflows.py +++ b/horizon/dashboards/nova/instances/workflows.py @@ -172,7 +172,7 @@ class SetInstanceDetailsAction(workflows.Action): image_id = forms.ChoiceField(label=_("Image"), required=False) instance_snapshot_id = forms.ChoiceField(label=_("Instance Snapshot"), required=False) - name = forms.CharField(max_length=80, label=_("Server Name")) + name = forms.CharField(max_length=80, label=_("Instance Name")) flavor = forms.ChoiceField(label=_("Flavor"), help_text=_("Size of image to launch.")) count = forms.IntegerField(label=_("Instance Count"),
Makes "Instance Name" consistent across dashboard instead of "Server Name" Change-Id: I<I>f<I>cf8ca<I>bfebefa4d<I>d7f7d3bc6b2f<I>
openstack_horizon
train
py
ffbad33922559308fc30364ad90f038825f531c3
diff --git a/carnifex/sshprocess.py b/carnifex/sshprocess.py index <HASH>..<HASH> 100644 --- a/carnifex/sshprocess.py +++ b/carnifex/sshprocess.py @@ -47,6 +47,10 @@ class SSHProcessInductor(ProcessInductor): connection.openChannel(session) @sessionOpenDeferred.addCallback def sessionOpened(specificData): + # Send requests to set the environment variables + for variable, value in env.iteritems(): + data = common.NS(variable) + common.NS(value) + connection.sendRequest(session, 'env', data) return connection.sendRequest(session, 'exec', command, wantReply=1) return sessionOpenDeferred
Enable requesting environment variables on the remote
sporsh_carnifex
train
py
7fc1f19389d039920ed3db3c06233f301d782853
diff --git a/spring-boot-samples/spring-boot-sample-ws/src/test/java/sample/ws/SampleWsApplicationTests.java b/spring-boot-samples/spring-boot-sample-ws/src/test/java/sample/ws/SampleWsApplicationTests.java index <HASH>..<HASH> 100644 --- a/spring-boot-samples/spring-boot-sample-ws/src/test/java/sample/ws/SampleWsApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-ws/src/test/java/sample/ws/SampleWsApplicationTests.java @@ -38,7 +38,7 @@ import static org.junit.Assert.assertThat; @RunWith(SpringJUnit4ClassRunner.class) @SpringApplicationConfiguration(classes = SampleWsApplication.class) @WebAppConfiguration -@IntegrationTest +@IntegrationTest("server.port=0") public class SampleWsApplicationTests { @Rule
Fix WS sample to use a random port
spring-projects_spring-boot
train
java
f4c41ec48ab6783d1c822acd42c3856cd41a865f
diff --git a/gcs/bucket.go b/gcs/bucket.go index <HASH>..<HASH> 100644 --- a/gcs/bucket.go +++ b/gcs/bucket.go @@ -127,12 +127,13 @@ type Bucket interface { ctx context.Context, req *UpdateObjectRequest) (*Object, error) - // Delete the object with the given name. Non-existence of the object is not - // treated as an error. + // Delete an object. Non-existence of the object is not treated as an error. // // Official documentation: // https://cloud.google.com/storage/docs/json_api/v1/objects/delete - DeleteObject(ctx context.Context, name string) error + DeleteObject( + ctx context.Context, + req *DeleteObjectRequest) error } type bucket struct { diff --git a/gcs/requests.go b/gcs/requests.go index <HASH>..<HASH> 100644 --- a/gcs/requests.go +++ b/gcs/requests.go @@ -246,3 +246,10 @@ type UpdateObjectRequest struct { // metadata. Metadata map[string]*string } + +// A request to delete an object by name. Non-existence is not treated as an +// error. +type DeleteObjectRequest struct { + // The name of the object to delete. Must be specified. + Name string +}
Added DeleteObjectRequest.
jacobsa_gcloud
train
go,go
ba3fbf15660cf9a58881f84513b2f36b2019f1e4
diff --git a/docs/conf.py b/docs/conf.py index <HASH>..<HASH> 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -151,7 +151,7 @@ html_theme = 'classic' # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". html_static_path = [] -ipython_savefig_dir = '../_build/html/_static' +ipython_savefig_dir = './_build/html/_images' # Add any extra paths that contain custom files (such as robots.txt or # .htaccess) here, relative to this directory. These files are copied
Fix error in figure path for ipython plots
data-8_datascience
train
py
13baa6356a2dd3f16a87cdad98d31b7895701305
diff --git a/authy/api/resources.py b/authy/api/resources.py index <HASH>..<HASH> 100755 --- a/authy/api/resources.py +++ b/authy/api/resources.py @@ -267,7 +267,7 @@ class Tokens(Resource): if 'force' not in options: options['force'] = "true" resp = self.get( - "/protected/json/verify/{}/{}".format(quote(str(token)), quote(str(device_id))), options) + "/protected/json/verify/{0}/{1}".format(quote(str(token)), quote(str(device_id))), options) return Token(self, resp) def __validate(self, token, device_id):
Add numbers to arguments to support python <I> again
twilio_authy-python
train
py
0d31c3e9cb63ec41ccd0ee90e688e52e29233405
diff --git a/src/Symfony/Bundle/WebProfilerBundle/Controller/RouterController.php b/src/Symfony/Bundle/WebProfilerBundle/Controller/RouterController.php index <HASH>..<HASH> 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Controller/RouterController.php +++ b/src/Symfony/Bundle/WebProfilerBundle/Controller/RouterController.php @@ -11,6 +11,7 @@ namespace Symfony\Bundle\WebProfilerBundle\Controller; +use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Matcher\UrlMatcherInterface; use Symfony\Component\Routing\Matcher\TraceableUrlMatcher;
[WebProfilerBundle] Add missing use statement. Request is needed in RouterController::getTraces to be able to create a request.
symfony_symfony
train
php
e6966cfba780dd2e7d69510dc0f860e9bfbb7982
diff --git a/demo.js b/demo.js index <HASH>..<HASH> 100644 --- a/demo.js +++ b/demo.js @@ -118,10 +118,6 @@ var lines = [ 'NOP #-121', 'NOP 29524', 'LDA #0', - 'BNE #-1', - 'BEQ #+2', - 'HALTN', - 'HALTP', 'LDA #42', 'STA 0',
Remove some unnecessary branch/halt instructions from demo assembly
thirdcoder_cpu3502
train
js
b3b4bc44ce92e9cc26a2ab35057379f14ebad9ce
diff --git a/mod/lesson/view.php b/mod/lesson/view.php index <HASH>..<HASH> 100644 --- a/mod/lesson/view.php +++ b/mod/lesson/view.php @@ -179,7 +179,7 @@ lesson_set_message(get_string('lessonnotready', 'lesson', $course->teacher)); // a nice message to the student } else { if (!count_records('lesson_pages', 'lessonid', $lesson->id)) { - redirect("$CFG->wwwroot/mod/lesson/lesson.php?id=$cm->id&amp;action=addpage&amp;pageid=0"); // no pages - redirect to add pages + redirect("$CFG->wwwroot/mod/lesson/edit.php?id=$cm->id"); // no pages - redirect to add pages } else { lesson_set_message(get_string('lessonpagelinkingbroken', 'lesson')); // ok, bad mojo } @@ -413,8 +413,6 @@ } } - - // check to see if the user can see the left menu if (!has_capability('mod/lesson:manage', $context)) { $lesson->displayleft = lesson_displayleftif($lesson);
BugFix for MDL-<I>: now blank lessons redirect to edit.php where the user is prompted by a menu of options.
moodle_moodle
train
php
dd38370f043dc73839ed5b510d1a2922939097fb
diff --git a/lib/marked.js b/lib/marked.js index <HASH>..<HASH> 100644 --- a/lib/marked.js +++ b/lib/marked.js @@ -68,7 +68,11 @@ block.gfm = { }; block.gfm.paragraph = replace(block.paragraph) - ('(?!', '(?!' + block.gfm.fences.source.replace('\\1', '\\2') + '|') + ('(?!', '(?!' + + block.gfm.fences.source.replace('\\1', '\\2') + + '|' + block.gfm.table.source + + '|' + block.gfm.nptable.source + + '|') (); /** @@ -880,7 +884,7 @@ function setOptions(opt) { block.fences = block.normal.fences; block.paragraph = block.normal.paragraph; block.table = block.normal.table; - block.nptable = block.normal.table; + block.nptable = block.normal.nptable; inline.text = inline.normal.text; inline.url = inline.normal.url; }
fix gfm paragraph rule to account for tables.
remarkjs_remark
train
js
60f18d60e16ccc5e218fdad61b71c4e2c1a6d9d1
diff --git a/src/Nacmartin/PhpExecJs/Runtime/V8jsRuntime.php b/src/Nacmartin/PhpExecJs/Runtime/V8jsRuntime.php index <HASH>..<HASH> 100644 --- a/src/Nacmartin/PhpExecJs/Runtime/V8jsRuntime.php +++ b/src/Nacmartin/PhpExecJs/Runtime/V8jsRuntime.php @@ -17,7 +17,9 @@ class V8jsRuntime implements RuntimeInterface public function __construct() { - $this->v8 = new \V8Js(); + if ($this->isAvailable()) { + $this->v8 = new \V8Js(); + } } /**
Check if v8js is available on construction of its runtime
nacmartin_phpexecjs
train
php
d36e2d9d994be27631c015087cf8b43152780886
diff --git a/setup_test.py b/setup_test.py index <HASH>..<HASH> 100644 --- a/setup_test.py +++ b/setup_test.py @@ -2,6 +2,7 @@ import setuptools import numpy.distutils.core import os import sys +import numpy as np #from sys import platform from setuptools import setup @@ -108,7 +109,7 @@ if base_cdf is None: base_cdf = find_CDF_base(lib_name) print(' '.join(('Found CDF installation at', base_cdf))) except ValueError: - print( 'Unable to find CDF installation in default locations.') + print( 'Unable to find CDF installation in default location.') base_cdf = None @@ -118,6 +119,8 @@ if base_cdf is None: else: build_cdf_flag = False #raise NotImplementedError + if not os.path.isdir(base_cdf): + raise ValueError('CDF directory supplied is not an actual directory.') if (lib_name is None): raise ValueError('Attempting to use pre-installed CDF library as directed. Please set setup.py parameters manually.')
Improved robustness when user supplies CDF library directory in setup.py.
rstoneback_pysatCDF
train
py
34d2c0063c129517e41cc9b4e8b8b303b652826f
diff --git a/vm/src/lib.js b/vm/src/lib.js index <HASH>..<HASH> 100644 --- a/vm/src/lib.js +++ b/vm/src/lib.js @@ -355,7 +355,9 @@ found = true; } - if (found && (i = keys[i]) !== undefined) return [i >>= 0, numValues[i]]; + if (found && (i = keys[i]) !== undefined && numValues[i] !== undefined) { + return [i >>= 0, numValues[i]]; + } } else { // Else use for-in (faster than for loop on tables with large holes)
Bugfix in performance improvements in next().
gamesys_moonshine
train
js
744b8c9d10089d6faee0f2b71cb47760117fbc28
diff --git a/spec/Task/PhpcsSpec.php b/spec/Task/PhpcsSpec.php index <HASH>..<HASH> 100644 --- a/spec/Task/PhpcsSpec.php +++ b/spec/Task/PhpcsSpec.php @@ -52,7 +52,7 @@ class PhpcsSpec extends ObjectBehavior $options->getDefinedOptions()->shouldContain('ignore_patterns'); $options->getDefinedOptions()->shouldContain('sniffs'); $options->getDefinedOptions()->shouldContain('triggered_by'); - //$options->getDefinedOptions()->shouldContain('exclude'); + $options->getDefinedOptions()->shouldContain('exclude'); } function it_should_run_in_git_pre_commit_context(GitPreCommitContext $context)
Update PhpcsSpec.php
phpro_grumphp
train
php
606c9d9906b68b2687a702f4754dc8900e49f6e0
diff --git a/lib/multirepo/commands/open-command.rb b/lib/multirepo/commands/open-command.rb index <HASH>..<HASH> 100644 --- a/lib/multirepo/commands/open-command.rb +++ b/lib/multirepo/commands/open-command.rb @@ -34,13 +34,13 @@ module MultiRepo ensure_in_work_tree ensure_multirepo_enabled - if @all - open_dependencies - open_main - elsif @main_only + if @main_only open_main + elsif @deps_only + open_dependencies else open_dependencies + open_main end end
Fixed OpenCommand default option (now "All", previously "Deps").
fortinmike_git-multirepo
train
rb
84458bdbd4fcadd2a060c485b9e937d14def0c25
diff --git a/Tree/PhpcrOdmTree.php b/Tree/PhpcrOdmTree.php index <HASH>..<HASH> 100644 --- a/Tree/PhpcrOdmTree.php +++ b/Tree/PhpcrOdmTree.php @@ -380,6 +380,8 @@ class PhpcrOdmTree implements TreeInterface */ public function getNodeTypes() { + $result = array(); + foreach ($this->validClasses as $className => $children) { $rel = $this->normalizeClassname($className); $admin = $this->getAdminByClass($className);
Fix Tree/PhpcrOdmTree.php uninitialized variable
sonata-project_SonataDoctrinePhpcrAdminBundle
train
php
287b178c4df31dbd5df1224a1c63e81df934bea2
diff --git a/Gruntfile.js b/Gruntfile.js index <HASH>..<HASH> 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -69,9 +69,7 @@ module.exports = function(grunt) { options: { timeout: 20000 }, - all: [ - 'examples/libglobal/tests/*.html' - ] + all: ['examples/**/tests/*.html'] }, watch: { @@ -174,5 +172,5 @@ module.exports = function(grunt) { grunt.registerTask('setUp', ['buildExampleProjects', 'copy', 'requirejs']); // Default task. - grunt.registerTask('default', ['setUp', 'jshint', 'nodeunit', 'qunit', 'clean']); + grunt.registerTask('default', ['setUp', 'jshint', 'nodeunit', 'clean']); };
Removed qunit testing in TravisCI, works locally, seems like an travis bug
asciidisco_grunt-requirejs
train
js
ed007f4c173a95d4439da9e4b875793a8426d077
diff --git a/library/Imbo/Resource/Metadata.php b/library/Imbo/Resource/Metadata.php index <HASH>..<HASH> 100644 --- a/library/Imbo/Resource/Metadata.php +++ b/library/Imbo/Resource/Metadata.php @@ -120,6 +120,10 @@ class Metadata implements ResourceInterface { } else { $metadata = json_decode($metadata, true); + if ($metadata === null) { + throw new InvalidArgumentException('Invalid JSON data', 400); + } + foreach (array_keys($metadata) as $key) { if (strpos($key, '.') === false) { continue; @@ -127,10 +131,6 @@ class Metadata implements ResourceInterface { throw new InvalidArgumentException('Invalid metadata. Dot characters (\'.\') are not allowed in metadata keys', 400); } - - if ($metadata === null) { - throw new InvalidArgumentException('Invalid JSON data', 400); - } } } }
Reorder the ifs to fix bug caused by calling array_keys on null if json_decode fails
imbo_imbo
train
php
ac757e2767a475668c68ad2ddb3dc761bd7d1ac4
diff --git a/tests/testmonitorplugin_test.py b/tests/testmonitorplugin_test.py index <HASH>..<HASH> 100644 --- a/tests/testmonitorplugin_test.py +++ b/tests/testmonitorplugin_test.py @@ -40,6 +40,18 @@ def test_send_event(plugin): assert plugin._websocket.send.called +def test_send_event_does_not_raise(plugin): + # ensure that test execution will continue + mock_event = Mock() + + def do_raise(): + raise Exception('Dummy exception') + + mock_event.serialize.side_effect = do_raise + plugin.send_event(mock_event) + assert not plugin._websocket.send.called + + def test_pytest_collectreport(plugin): plugin.send_event = Mock() report = []
Added test case for plugin error handling
bbiskup_pytest-purkinje
train
py
2fedaa9a4bc41268786f2cc4bd68be2d48acd794
diff --git a/builtin/providers/aws/resource_aws_spot_instance_request.go b/builtin/providers/aws/resource_aws_spot_instance_request.go index <HASH>..<HASH> 100644 --- a/builtin/providers/aws/resource_aws_spot_instance_request.go +++ b/builtin/providers/aws/resource_aws_spot_instance_request.go @@ -166,7 +166,10 @@ func resourceAwsSpotInstanceRequestRead(d *schema.ResourceData, meta interface{} } d.Set("spot_bid_status", *request.Status.Code) - d.Set("spot_instance_id", *request.InstanceID) + // Instance ID is not set if the request is still pending + if request.InstanceID != nil { + d.Set("spot_instance_id", *request.InstanceID) + } d.Set("spot_request_state", *request.State) d.Set("tags", tagsToMap(request.Tags))
provider/aws: Fix issue where spot instance requests would crash Requests that are pending do not have an InstanceID
hashicorp_terraform
train
go
3e2a0a0205e9eb69c64d8d89cc1f2241fa16da4e
diff --git a/src/commands/functions/invoke.js b/src/commands/functions/invoke.js index <HASH>..<HASH> 100644 --- a/src/commands/functions/invoke.js +++ b/src/commands/functions/invoke.js @@ -63,10 +63,18 @@ class FunctionsInvokeCommand extends Command { // https://www.netlify.com/docs/functions/#identity-event-functions body.event = parts[1] body.user = { + id: '1111a1a1-a11a-1111-aa11-aaa11111a11a', + aud: '', + role: '', email: '[email protected]', + app_metadata: { + provider: 'email', + }, user_metadata: { - TODO: 'mock our netlify identity user data better', + full_name: 'Test Person', }, + created_at: new Date(Date.now()).toISOString(), + update_at: new Date(Date.now()).toISOString(), } } else { // non identity functions seem to have a different shape
feat(functions): mock identity response with properly-shaped data (#<I>)
netlify_cli
train
js
db9decdfd21e21a72c7785f8233d4ea83fc1c05b
diff --git a/config/software/chef.rb b/config/software/chef.rb index <HASH>..<HASH> 100644 --- a/config/software/chef.rb +++ b/config/software/chef.rb @@ -73,19 +73,7 @@ build do " --no-ri --no-rdoc" \ " --verbose" - # Depending on which shell is being used, the path environment variable can - # be "PATH" or "Path". If *both* are set, only one is honored. - path_key = ENV.keys.grep(/\Apath\Z/i).first - - bundle "install", env: { - path_key => [ - windows_safe_path(install_dir, 'embedded', 'bin'), - windows_safe_path(install_dir, 'embedded', 'mingw', 'bin'), - windows_safe_path('C:/Windows/system32'), - windows_safe_path('C:/Windows'), - windows_safe_path('C:/Windows/System32/Wbem'), - ].join(File::PATH_SEPARATOR) - } + bundle "install --without server docgen", env: env else
Remove crazy PATH on Chef Windows gem `bundle install` `with_embedded_path` does the right thing now.
chef_chef
train
rb
5a6c183144b063825716d5b9aca3e0b0d60e23d1
diff --git a/EntityContext.js b/EntityContext.js index <HASH>..<HASH> 100644 --- a/EntityContext.js +++ b/EntityContext.js @@ -764,11 +764,15 @@ JEFRi.EntityComparator = function(a, b){ data : transaction.toString(), dataType: "json", success : function(data) { + console.log("Logging success", data); ec.expand(data, true);//Always updateOnIntern $(self).trigger('sent', data); $(self).trigger(post, data); $(transaction).trigger(post, data); - } + }, + error : function(data){ + console.log("Logging error", data); + }, }); };
Logging for get success/failure
DavidSouther_JEFRi
train
js
29374b8eaf4778e1c3df69a7eadd426d41deb649
diff --git a/src/DeferredNodeVisitor.php b/src/DeferredNodeVisitor.php index <HASH>..<HASH> 100644 --- a/src/DeferredNodeVisitor.php +++ b/src/DeferredNodeVisitor.php @@ -4,16 +4,25 @@ namespace Phive\Twig\Extensions\Deferred; class DeferredNodeVisitor implements \Twig_NodeVisitorInterface { + private $hasDeferred = false; + public function enterNode(\Twig_NodeInterface $node, \Twig_Environment $env) { + if (!$this->hasDeferred && $node instanceof DeferredNode) { + $this->hasDeferred = true; + } + return $node; } public function leaveNode(\Twig_NodeInterface $node, \Twig_Environment $env) { - return ($node instanceof \Twig_Node_Module) - ? new DeferredModuleNode($node) - : $node; + if ($this->hasDeferred && $node instanceof \Twig_Node_Module) { + $node = new DeferredModuleNode($node); + $this->hasDeferred = false; + } + + return $node; } public function getPriority()
Resolve deferred blocks only when it's necessary
rybakit_twig-deferred-extension
train
php
31f49a03fa7f4ad05052610db409d9506937bf93
diff --git a/Form/Admin/CompanyFormBuilder.php b/Form/Admin/CompanyFormBuilder.php index <HASH>..<HASH> 100755 --- a/Form/Admin/CompanyFormBuilder.php +++ b/Form/Admin/CompanyFormBuilder.php @@ -34,11 +34,17 @@ class CompanyFormBuilder extends AbstractFormBuilder $requiredData->addChild($this->getElement('text_field', [ 'name' => 'name', 'label' => $this->trans('company.label.name'), + 'rules' => [ + $this->getRule('required') + ], ])); $requiredData->addChild($this->getElement('text_field', [ 'name' => 'shortName', 'label' => $this->trans('company.label.short_name'), + 'rules' => [ + $this->getRule('required') + ], ])); $addressData = $form->addChild($this->getElement('nested_fieldset', [
Added rule required to all forms (cherry picked from commit 0ffd7c3b<I>f<I>d<I>bf9b<I>bebeb<I>)
WellCommerce_WishlistBundle
train
php
5b1d72b02a994fee1d5e39ef687b2947348f3aec
diff --git a/catalog/app/containers/Admin/Buckets.js b/catalog/app/containers/Admin/Buckets.js index <HASH>..<HASH> 100644 --- a/catalog/app/containers/Admin/Buckets.js +++ b/catalog/app/containers/Admin/Buckets.js @@ -469,8 +469,8 @@ function Delete({ bucket, close }) { <> <M.DialogTitle>Delete a bucket</M.DialogTitle> <M.DialogContent> - You are about to delete the &quot;{bucket.name}&quot; bucket. This operation is - irreversible. + You are about to disconnect &quot;{bucket.name}&quot; from Quilt. The search index + will be deleted. Bucket contents will remain unchanged. </M.DialogContent> <M.DialogActions> <M.Button onClick={() => close('cancel')} color="primary">
Soften and correct bucket delete dialog (#<I>)
quiltdata_quilt
train
js
3a09b1fb2c9c5a849d3afa9fe0b3d81f1c1cbd9e
diff --git a/src/base/model.js b/src/base/model.js index <HASH>..<HASH> 100644 --- a/src/base/model.js +++ b/src/base/model.js @@ -27,6 +27,11 @@ define([ //each model has its own event handling this._events = new Events(); + //will the model be hooked to data? + this._data_hook = null; // holds reference to dataset + this._entity_hook = null; // holds reference to dataset + this._time_hook = null; // holds reference to dataset + //bind initial events for (var evt in bind) { if (typeof bind[evt] === 'function') { @@ -194,6 +199,10 @@ define([ defer.resolve(); } }); + + if (this._data[name].isHook()) { + this._hookSubmodel(name); + } }, /**
Hook if it's a hookable model
vizabi_vizabi
train
js
725a2a416813300223a9a8bd35604a18900bfff2
diff --git a/yoti_python_sdk/tests/test_client.py b/yoti_python_sdk/tests/test_client.py index <HASH>..<HASH> 100644 --- a/yoti_python_sdk/tests/test_client.py +++ b/yoti_python_sdk/tests/test_client.py @@ -299,7 +299,7 @@ def test_perform_aml_check_details_with_correct_data( aml_result = client.perform_aml_check(aml_profile) - mock_post.assert_called_once() + mock_post.assert_called_once_with() assert isinstance(aml_result, aml.AmlResult) assert isinstance(aml_result.on_watch_list, bool)
SDK-<I>: Update test to support <I> and <I>
getyoti_yoti-python-sdk
train
py
03955218e582cb93538a05f2a011eb2dd339dad0
diff --git a/lib/ec2ssh/cli.rb b/lib/ec2ssh/cli.rb index <HASH>..<HASH> 100644 --- a/lib/ec2ssh/cli.rb +++ b/lib/ec2ssh/cli.rb @@ -6,6 +6,7 @@ require 'ec2ssh/migrator' module Ec2ssh class CLI < Thor + class_option :path, banner: "/path/to/ssh_config" class_option :dotfile, banner: '$HOME/.ec2ssh', default: "#{ENV['HOME']}/.ec2ssh" class_option :verbose, banner: 'enable debug log', default: false
Revive path option for changing ssh config path
mirakui_ec2ssh
train
rb
65ccc0ca1cf0990df6fa7367cc308e51b842ee50
diff --git a/modules/wyil/src/wyil/checks/VerificationTransformer.java b/modules/wyil/src/wyil/checks/VerificationTransformer.java index <HASH>..<HASH> 100644 --- a/modules/wyil/src/wyil/checks/VerificationTransformer.java +++ b/modules/wyil/src/wyil/checks/VerificationTransformer.java @@ -148,8 +148,9 @@ public class VerificationTransformer { if (!assume) { Expr assumptions = branch.constraints(); + Expr implication = Expr.Binary(Expr.Binary.Op.IMPLIES,assumptions,test); ArrayList<Stmt> constraints = new ArrayList<Stmt>(); - constraints.add(Stmt.Assert(code.msg, test, branch.entry().attributes())); + constraints.add(Stmt.Assert(code.msg, implication, branch.entry().attributes())); WycsFile file = new WycsFile(filename,constraints); // TODO: at some point, I think it would make sense to separate the
WYIL: verification is working again in a limited fashion. It at least verifies the simplest function involving nats.
Whiley_WhileyCompiler
train
java
db47785c39510686efb95c156519ae82673b38d8
diff --git a/src/cli/estilo.js b/src/cli/estilo.js index <HASH>..<HASH> 100644 --- a/src/cli/estilo.js +++ b/src/cli/estilo.js @@ -4,7 +4,8 @@ 'use strict' const resolve = require('path').resolve -const convert = require('../convert.js') +const loadProject = require('../load-project.js') +const renderProject = require('../render-project.js') const argv = require('minimist')(process.argv.slice(2)) const selectSyntax = require('./select-syntax.js') const init = require('./init.js') @@ -26,7 +27,7 @@ const command = argv._[0] if (!command || command === 'help') { showHelp() } else if (command === 'render') { - convert(projectPath) + loadProject(projectPath, project => renderProject(project)) } else if (command === 'add-syntax') { selectSyntax(projectPath) } else if (command === 'init') {
Update: use new project loader and render in cli
jacoborus_estilo
train
js
e3ac86c3db4eced6f9ea4bec5306394434cb6be5
diff --git a/salt/modules/alternatives.py b/salt/modules/alternatives.py index <HASH>..<HASH> 100644 --- a/salt/modules/alternatives.py +++ b/salt/modules/alternatives.py @@ -59,7 +59,7 @@ def display(name): salt '*' alternatives.display editor """ cmd = [_get_cmd(), "--display", name] - out = __salt__["cmd.run_all"](cmd, python_shell=False) + out = __salt__["cmd.run_all"](cmd, python_shell=False, ignore_retcode=True) if out["retcode"] > 0 and out["stderr"] != "": return out["stderr"] return out["stdout"] @@ -134,7 +134,7 @@ def check_exists(name, path): salt '*' alternatives.check_exists name path """ cmd = [_get_cmd(), "--display", name] - out = __salt__["cmd.run_all"](cmd, python_shell=False) + out = __salt__["cmd.run_all"](cmd, python_shell=False, ignore_retcode=True) if out["retcode"] > 0 and out["stderr"] != "": return False
alternatives: Don't log error when running alternatives --display... on nonexistant target. These functions are used for information gathering and can result in a lot of noise for something that is not an error condition.
saltstack_salt
train
py
d06801bbb24f7ffac880446f5163a717e614419b
diff --git a/openquake/engine/engine.py b/openquake/engine/engine.py index <HASH>..<HASH> 100644 --- a/openquake/engine/engine.py +++ b/openquake/engine/engine.py @@ -332,6 +332,23 @@ def create_jobs(job_inis, log_level=logging.INFO, log_file=None, return jobs +def cleanup(kind): + """ + Stop or kill the zmq workers if serialize_jobs == 1. + """ + assert kind in ("stop", "kill"), kind + if OQ_DISTRIBUTE != 'zmq' or config.distribution.serialize_jobs > 1: + return # do nothing + if kind == 'stop': + # called in the regular case + print('Stopping the workers') + parallel.workers_stop() + elif kind == 'kill': + # called in case of exceptions (including out of memory) + print('Killing the workers') + parallel.workers_kill() + + def run_jobs(jobs): """ Run jobs using the specified config file and other options. @@ -372,13 +389,10 @@ def run_jobs(jobs): else: for job in jobs: run_calc(job) - finally: - # for serialize_jobs > 1 there could be something still running: - # don't stop the zworkers in that case! - if OQ_DISTRIBUTE == 'zmq' and sum( - r for h, r, t in parallel.workers_status()) == 0: - print('Stopping the workers') - parallel.workers_stop() + cleanup('stop') + except Exception: + cleanup('kill') + raise return jobs
Killing the zmq workers in case of exceptions
gem_oq-engine
train
py
0a44db06f242929d4713a9d998849058429a0f68
diff --git a/public/js/core.forms.js b/public/js/core.forms.js index <HASH>..<HASH> 100644 --- a/public/js/core.forms.js +++ b/public/js/core.forms.js @@ -19,6 +19,9 @@ displayErrors: function($form, errors, prefix) { + if (typeof errors === 'string') { + return; + } if (prefix == undefined) { prefix = ''; } @@ -34,7 +37,7 @@ $errorsDiv.html(html); $errorsDiv.parent().addClass('input-error'); } else { - methods.displayErrors($form, error, idx + '-'); + methods.displayErrors($form, error, prefix + idx + '-'); } }); }
allow displaying errors for nested collections
yawik_core
train
js
85bed238075495d43f259a5d505e365e07afdd75
diff --git a/tests/acceptance/admin/ServerCest.php b/tests/acceptance/admin/ServerCest.php index <HASH>..<HASH> 100644 --- a/tests/acceptance/admin/ServerCest.php +++ b/tests/acceptance/admin/ServerCest.php @@ -49,8 +49,6 @@ class ServerCest Input::asAdvancedSearch($I, 'APC'), Input::asAdvancedSearch($I, 'Rack'), Input::asAdvancedSearch($I, 'MAC'), - Input::asAdvancedSearch($I, 'Tariff'), - Dropdown::asAdvancedSearch($I, 'Is wizzarded'), ]); }
Minor test fix (#<I>)
hiqdev_hipanel-module-server
train
php
2bcd77688740c605b5ddbfbfff4f439b36d2c0a3
diff --git a/src/ExternalSpeller.php b/src/ExternalSpeller.php index <HASH>..<HASH> 100644 --- a/src/ExternalSpeller.php +++ b/src/ExternalSpeller.php @@ -95,7 +95,7 @@ abstract class ExternalSpeller implements Speller if (0 !== $exitCode) { throw new ExternalProgramFailedException( $process->getCommandLine(), - $process->getErrorOutput(), + $process->getErrorOutput() ?: $process->getOutput(), $exitCode ); }
Show STDOUT if STDERR is empty
mekras_php-speller
train
php
bc85ee971b84a177d06751a7b4075debecd604a5
diff --git a/sysconfig.py b/sysconfig.py index <HASH>..<HASH> 100644 --- a/sysconfig.py +++ b/sysconfig.py @@ -23,7 +23,7 @@ BASE_PREFIX = os.path.normpath(sys.base_prefix) BASE_EXEC_PREFIX = os.path.normpath(sys.base_exec_prefix) # Path to the base directory of the project. On Windows the binary may -# live in project/PCBuild/win32 or project/PCBuild/amd64. +# live in project/PCbuild/win32 or project/PCbuild/amd64. # set for cross builds if "_PYTHON_PROJECT_BASE" in os.environ: project_base = os.path.abspath(os.environ["_PYTHON_PROJECT_BASE"])
bpo-<I>: correct PCBuild/ case to PCbuild/ in build scripts and docs (GH-<I>)
pypa_setuptools
train
py
ccbdfabaff74f14e3945643b8a06d750686756c2
diff --git a/Parsedown.php b/Parsedown.php index <HASH>..<HASH> 100755 --- a/Parsedown.php +++ b/Parsedown.php @@ -130,12 +130,12 @@ class Parsedown if ( ! isset($block['closed'])) { - if (strpos($line, $block['start']) !== false) # opening tag + if (stripos($line, $block['start']) !== false) # opening tag { $block['depth']++; } - if (strpos($line, $block['end']) !== false) # closing tag + if (stripos($line, $block['end']) !== false) # closing tag { if ($block['depth'] > 0) { @@ -359,8 +359,15 @@ class Parsedown { $name = $substring; } + $name = strtolower($name); - if ( ! ctype_alpha($name)) + // hr,h1,h2,h3,h4,h5,h6 cases + if ($name[0] == 'h' and strpos('r123456', $name[1]) !== false) + { + if ($name == 'hr') + $is_self_closing = 1; + } + elseif ( ! ctype_alpha($name)) { break; } @@ -392,7 +399,7 @@ class Parsedown 'depth' => 0, ); - if (strpos($outdented_line, $block['end'])) + if (stripos($outdented_line, $block['end'])) { $block['closed'] = true; }
support HR and headings as block markups
erusev_parsedown
train
php
a17f0a7188c6bd393fa2d02c70fbeafcb28f93eb
diff --git a/src/Wsdl2PhpGenerator/Operation.php b/src/Wsdl2PhpGenerator/Operation.php index <HASH>..<HASH> 100644 --- a/src/Wsdl2PhpGenerator/Operation.php +++ b/src/Wsdl2PhpGenerator/Operation.php @@ -76,7 +76,7 @@ class Operation } /** - * @param array $validTypes An array of Type objects with valid types for typehinting + * @param Type[] $validTypes An array of Type objects with valid types for typehinting * @return string A parameter string */ public function getParamString(array $validTypes)
Update docblock for Type[]
wsdl2phpgenerator_wsdl2phpgenerator
train
php
443ef454aa6160770f706bd77a72e15c8bac9427
diff --git a/btree.go b/btree.go index <HASH>..<HASH> 100644 --- a/btree.go +++ b/btree.go @@ -489,8 +489,8 @@ func (t *BTree) AscendLessThan(pivot Item, iterator ItemIterator) { iterator) } -// AscendGreaterOrEqual calls the iterator for every value in the tree within the range -// [greaterOrEqual, last], until iterator returns false. +// AscendGreaterOrEqual calls the iterator for every value in the tree within +// the range [pivot, last], until iterator returns false. func (t *BTree) AscendGreaterOrEqual(pivot Item, iterator ItemIterator) { if t.root == nil { return diff --git a/btree_mem.go b/btree_mem.go index <HASH>..<HASH> 100644 --- a/btree_mem.go +++ b/btree_mem.go @@ -24,8 +24,8 @@ import ( "runtime" "time" + "github.com/google/btree" "github.com/petar/GoLLRB/llrb" - "wherever/we/put/btree" ) var (
Fix btree import in btree_mem, and update comment.
google_btree
train
go,go
35c39bc01c2581e6565b3f18c618b088b884e95e
diff --git a/lib/janky/hubot.rb b/lib/janky/hubot.rb index <HASH>..<HASH> 100644 --- a/lib/janky/hubot.rb +++ b/lib/janky/hubot.rb @@ -35,7 +35,8 @@ module Janky repo = find_repo(repo_name) branch = repo.branch_for(branch_name) build = branch.current_build - room_id = params["room_id"] && Integer(params["room_id"]) + + room_id = (params["room_id"] && Integer(params["room_id"]) rescue nil) if build build.rerun(room_id)
ignore non-integer room_ids i guess
github_janky
train
rb
25699991305d1d570b647af223b239603f945eb2
diff --git a/config-dist.php b/config-dist.php index <HASH>..<HASH> 100644 --- a/config-dist.php +++ b/config-dist.php @@ -64,16 +64,11 @@ $CFG->theme = "standard"; $CFG->lang = "en"; -// Give the full name (eg mail.example.com) of an SMTP server that the -// web server machine has access to (to send mail). You can specify -// more than one server like this: "mail1.example.com;mail2.example.com" +// Give the full names of local SMTP servers that Moodle should use to +// send mail (eg "mail.a.com" or "mail.a.com;mail.b.com"). +// If this is left empty (eg "") then Moodle will attempt to use PHP mail. -$CFG->smtphosts = "mail.example.com"; - -// Choose a password to be used by the cron script. This helps avoid -// any problems caused by someone spamming moodle/admin/cron.php - -$CFG->cronpassword = "fr0o6y"; +$CFG->smtphosts = ""; // You should not need to change anything else. To continue setting up
Altered smtphosts and removed cronpassword
moodle_moodle
train
php
a35f7b867c0ba57514e66a1b247ee4f8ece513df
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100755 --- a/setup.py +++ b/setup.py @@ -59,13 +59,13 @@ class PyTest(test.test): def main(): setuptools.setup( name='mobly', - version='1.3', + version='1.4', maintainer = 'Ang Li', maintainer_email = '[email protected]', description='Automation framework for special end-to-end test cases', license='Apache2.0', url = 'https://github.com/google/mobly', - download_url = 'https://github.com/google/mobly/tarball/1.3', + download_url = 'https://github.com/google/mobly/tarball/1.4', packages=setuptools.find_packages(), include_package_data=False, scripts=['tools/sl4a_shell.py', 'tools/snippet_shell.py'],
Release <I> (#<I>)
google_mobly
train
py
e793be3a21aedfa6493f2c714e829d95fd69e83c
diff --git a/src/main/java/com/indeed/proctor/webapp/RemoteProctorSpecificationSource.java b/src/main/java/com/indeed/proctor/webapp/RemoteProctorSpecificationSource.java index <HASH>..<HASH> 100644 --- a/src/main/java/com/indeed/proctor/webapp/RemoteProctorSpecificationSource.java +++ b/src/main/java/com/indeed/proctor/webapp/RemoteProctorSpecificationSource.java @@ -312,7 +312,7 @@ public class RemoteProctorSpecificationSource extends DataLoadingTimerTask imple statusCode = urlConnection.getResponseCode(); inputStream = urlConnection.getInputStream(); // map from testName => list of bucket names - final SpecificationResult result = OBJECT_MAPPER.readValue(inputStream, SpecificationResult.class); + final SpecificationResult result = parser.parse(inputStream); return new Pair<>(statusCode, result); } catch (final Throwable e) { final SpecificationResult errorResult = createErrorResult(e);
PROW-<I>: missing logic
indeedeng_proctor
train
java
f583c88ec8938f184dc4039871239b5309a79d56
diff --git a/cookiecutter/compat.py b/cookiecutter/compat.py index <HASH>..<HASH> 100644 --- a/cookiecutter/compat.py +++ b/cookiecutter/compat.py @@ -2,11 +2,3 @@ import sys PY3 = sys.version_info[0] == 3 OLD_PY2 = sys.version_info[:2] < (2, 7) - - -if PY3: # pragma: no cover - iteritems = lambda d: iter(d.items()) - - -else: # pragma: no cover - iteritems = lambda d: d.iteritems() diff --git a/cookiecutter/prompt.py b/cookiecutter/prompt.py index <HASH>..<HASH> 100755 --- a/cookiecutter/prompt.py +++ b/cookiecutter/prompt.py @@ -13,7 +13,7 @@ from collections import OrderedDict import click from past.builtins import basestring -from .compat import iteritems +from future.utils import iteritems from jinja2.environment import Environment
Use iteritems from future.utils
audreyr_cookiecutter
train
py,py
711736cc34950f8ed9a36ff75448aa3b500efccc
diff --git a/src/model/Criteria/ScenariosCriteriaInterface.php b/src/model/Criteria/ScenariosCriteriaInterface.php index <HASH>..<HASH> 100644 --- a/src/model/Criteria/ScenariosCriteriaInterface.php +++ b/src/model/Criteria/ScenariosCriteriaInterface.php @@ -23,7 +23,7 @@ interface ScenariosCriteriaInterface */ public function params(): array; - public function addCondition(Selection $selection): Selection; + public function addCondition(Selection $selection, $values); /** * label returns human-friendly and descriptive label of the whole Criteria diff --git a/src/model/Criteria/ScenariosCriteriaStorage.php b/src/model/Criteria/ScenariosCriteriaStorage.php index <HASH>..<HASH> 100644 --- a/src/model/Criteria/ScenariosCriteriaStorage.php +++ b/src/model/Criteria/ScenariosCriteriaStorage.php @@ -21,4 +21,9 @@ class ScenariosCriteriaStorage { return $this->criteria; } + + public function getEventCriterion(string $event, $key): ScenariosCriteriaInterface + { + return $this->criteria[$event][$key]; + } }
Check condition element implementation in Scenario engine remp/crm#<I>
remp2020_crm-application-module
train
php,php
92841e7616f427a986c753c2aa54dc9b605e1738
diff --git a/app/mailers/mailer.rb b/app/mailers/mailer.rb index <HASH>..<HASH> 100644 --- a/app/mailers/mailer.rb +++ b/app/mailers/mailer.rb @@ -92,17 +92,12 @@ class Mailer < ApplicationMailer def mfa_required_popular_gems_announcement(user_id) @user = User.find(user_id) - case @user.mfa_level - when "disabled" - subject = "[Action Required] Enabling multi-factor authentication is required on your RubyGems account" - @heading = "Enable multi-factor authentication on your RubyGems account" - when "ui_only" - subject = "[Action Required] Upgrading the multi-factor authentication level is required on your RubyGems account" - @heading = "Upgrade the multi-factor authentication level on your RubyGems account" - end + heading_cta = @user.mfa_ui_only? ? "Upgrade the" : "Enable" + subject_cta = @user.mfa_ui_only? ? "Upgrading the" : "Enabling" + @heading = "#{heading_cta} multi-factor authentication#{' level' if @user.mfa_ui_only?} on your RubyGems account" mail to: @user.email, - subject: subject + subject: "[Action Required] #{subject_cta} multi-factor authentication#{' level' if @user.mfa_ui_only?} is required on your RubyGems account" end def gem_yanked(yanked_by_user_id, version_id, notified_user_id)
[Temp] Example refactor: Inline dynamic string logic
rubygems_rubygems.org
train
rb
41f5b438f6e4db1bb6cc4429e26280a154428fb1
diff --git a/py3status/modules/mail.py b/py3status/modules/mail.py index <HASH>..<HASH> 100644 --- a/py3status/modules/mail.py +++ b/py3status/modules/mail.py @@ -138,6 +138,8 @@ import mailbox from imaplib import IMAP4_SSL from os.path import exists, expanduser, expandvars STRING_MISSING = 'missing {} {}' +STRING_WRONG_NAME = 'Accountname ({}) collides with "Maildir", "mbox", "mh", \ +"Babyl", "MMDF", "mail" or "IMAP".' class Py3status: @@ -160,6 +162,9 @@ class Py3status: continue self.mailboxes[mail] = [] for account in accounts: + if account['name'] in [x.lower() for x in mailboxes] \ + + ['mail']: + raise Exception(STRING_WRONG_NAME.format(account['name'])) account.setdefault('urgent', True) if mail == 'imap': for v in ['user', 'password', 'server']:
mail module: report account name collision with folder names (#<I>)
ultrabug_py3status
train
py
2a6e152bd8af1456be532d382219520237465cbf
diff --git a/spacetrack/aio.py b/spacetrack/aio.py index <HASH>..<HASH> 100644 --- a/spacetrack/aio.py +++ b/spacetrack/aio.py @@ -2,11 +2,13 @@ from __future__ import absolute_import, division, print_function import asyncio +import ssl import time from collections.abc import AsyncIterator, Mapping import aiohttp import aiohttp.web_exceptions +import requests.certs from aiohttp.helpers import parse_mimetype from .base import AuthenticationError, SpaceTrackClient, logger @@ -33,7 +35,10 @@ class AsyncSpaceTrackClient(SpaceTrackClient): """ @staticmethod def _create_session(): - return aiohttp.ClientSession() + # Use requests/certifi CA file + ctx = ssl.create_default_context(cafile=requests.certs.where()) + connector = aiohttp.TCPConnector(ssl_context=ctx) + return aiohttp.ClientSession(connector=connector) async def _ratelimit_callback(self, until): duration = int(round(until - time.time()))
Use requests for SSL certs with aiohttp
python-astrodynamics_spacetrack
train
py
a3ceb915927182b0ca7a835134a267dd977160f5
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -17,7 +17,7 @@ setup( author_email = "[email protected]", url = "http://github.com/twilio/twilio-python/", keywords = ["twilio","twiml"], - install_requires = ["httplib2 >= 0.7, < 0.8", "pyjwt==0.1.2"], + install_requires = ["httplib2 >= 0.7", "pyjwt"], packages = find_packages(), classifiers = [ "Development Status :: 5 - Production/Stable",
don't force dependencies we are not sure about yet
twilio_twilio-python
train
py
68cf0f406480c64e88de877ba3c97d565cefecc8
diff --git a/salt/modules/yumpkg.py b/salt/modules/yumpkg.py index <HASH>..<HASH> 100644 --- a/salt/modules/yumpkg.py +++ b/salt/modules/yumpkg.py @@ -149,7 +149,7 @@ def _yum(): return __context__[contextkey] -def _call_yum(args, **kwargs): +def _call_yum(args, scope=False, **kwargs): ''' Call yum/dnf. @@ -160,8 +160,13 @@ def _call_yum(args, **kwargs): 'python_shell': False, 'env': get_module_environment(globals())} params.update(kwargs) + cmd = [] + if scope: + cmd.extend(['systemd-run', '--scope']) + cmd.append(_yum()) + cmd.extend(args) - return __salt__['cmd.run_all']([_yum()] + args, **params) + return __salt__['cmd.run_all'](cmd, **params) def _yum_pkginfo(output):
Add scope for yum/dnf
saltstack_salt
train
py
3f5a22ef0d53e73d78a5595b589288f81ea4852d
diff --git a/lib/db.js b/lib/db.js index <HASH>..<HASH> 100644 --- a/lib/db.js +++ b/lib/db.js @@ -40,6 +40,7 @@ let inject = function (deps) { DB.prototype.initialize = function () { this.basePath = Constants.basePath this.name = Constants.defaultName + return this } /**
methods should return this or a promise
moneybutton_yours-core
train
js
2d3f178993b088fe4ddaea29d3944433465a2fe8
diff --git a/eZ/Bundle/EzPublishCoreBundle/DependencyInjection/Configuration/Parser/Page.php b/eZ/Bundle/EzPublishCoreBundle/DependencyInjection/Configuration/Parser/Page.php index <HASH>..<HASH> 100644 --- a/eZ/Bundle/EzPublishCoreBundle/DependencyInjection/Configuration/Parser/Page.php +++ b/eZ/Bundle/EzPublishCoreBundle/DependencyInjection/Configuration/Parser/Page.php @@ -100,14 +100,10 @@ class Page extends AbstractParser $ezpageSettings[$type] = array(); continue; } - $enabledLayouts = array_flip( $ezpageSettings[$enabledKey] ); - foreach ( $ezpageSettings[$type] as $id => $layout ) - { - if ( !isset( $enabledLayouts[$id] ) ) - { - unset( $ezpageSettings[$type][$id] ); - } - } + $ezpageSettings[$type] = array_intersect_key( + $ezpageSettings[$type], + array_flip( $ezpageSettings[$enabledKey] ) + ); } $container->setParameter( "ezsettings.$sa.ezpage", $ezpageSettings ); }
Simplified enabled blocks and layouts settings computation
ezsystems_ezpublish-kernel
train
php
5dd7e903ff1698dcf2b6bbd821c31720d169fb83
diff --git a/lib/db/access.php b/lib/db/access.php index <HASH>..<HASH> 100644 --- a/lib/db/access.php +++ b/lib/db/access.php @@ -727,7 +727,6 @@ $capabilities = array( 'captype' => 'write', 'contextlevel' => CONTEXT_COURSE, 'archetypes' => array( - 'editingteacher' => CAP_ALLOW, 'manager' => CAP_ALLOW ) ),
lib-db-access MDL-<I> editingteacher can no longer delete courses by default.
moodle_moodle
train
php
61c09c265eb9591c7b19baa5d14f9bf8164d9afa
diff --git a/cf/commands/route/create_route.go b/cf/commands/route/create_route.go index <HASH>..<HASH> 100644 --- a/cf/commands/route/create_route.go +++ b/cf/commands/route/create_route.go @@ -80,7 +80,7 @@ func (cmd *CreateRoute) Execute(c flags.FlagContext) { domain := cmd.domainReq.GetDomain() path := c.String("path") - if !strings.HasPrefix(path, `/`) { + if path != "" && !strings.HasPrefix(path, `/`) { path = `/` + path }
Don't add '/' to path when it's blank [#<I>]
cloudfoundry_cli
train
go
4766d27e67e94a7abc9cdd3ae120a2b893017f1b
diff --git a/lib/temple/templates/rails.rb b/lib/temple/templates/rails.rb index <HASH>..<HASH> 100644 --- a/lib/temple/templates/rails.rb +++ b/lib/temple/templates/rails.rb @@ -3,9 +3,9 @@ module Temple class Rails extend Mixins::Template - def call(template) + def call(template, source = nil) opts = {}.update(self.class.options).update(file: template.identifier) - self.class.compile(template.source, opts) + self.class.compile((source || template.source), opts) end def supports_streaming?
Stop relying on deprecated method in Rails (#<I>)
judofyr_temple
train
rb
e60af1f709e095e252052b3c6a1f6afb26d28fd5
diff --git a/nomnom.js b/nomnom.js index <HASH>..<HASH> 100644 --- a/nomnom.js +++ b/nomnom.js @@ -123,7 +123,7 @@ ArgParser.prototype = { parse : function(argv) { this.print = this.print || function(str, code) { - console.log(str + '\n'); + console.log(str); process.exit(code || 0); }; this._help = this._help || ""; @@ -395,7 +395,7 @@ ArgParser.prototype = { if (this._help) { str += "\n" + this._help; } - return str + "\n"; + return str; } };
remove extra newlines at end of usage output
harthur_nomnom
train
js
4c24b80895bf8d49d9f902792d868ba891137443
diff --git a/api/server.go b/api/server.go index <HASH>..<HASH> 100644 --- a/api/server.go +++ b/api/server.go @@ -288,8 +288,8 @@ func RunServer(dry bool) http.Handler { for _, result := range results { if result.Status != hc.HealthCheckOK { hcFail = true + fmt.Printf("ERROR: %q is not working: %s\n", result.Name, result.Status) } - fmt.Printf("%s: %s\n", result.Name, result.Status) } if hcFail { os.Exit(2)
api: less verbosity in the start-up healthcheck Report only failures, we don't care about what went well here.
tsuru_tsuru
train
go
34ee2751e8af35be05a17558dc1ba57543a53e84
diff --git a/encoding/igc/decode.go b/encoding/igc/decode.go index <HASH>..<HASH> 100644 --- a/encoding/igc/decode.go +++ b/encoding/igc/decode.go @@ -315,11 +315,12 @@ func doParse(r io.Reader) (*parser, Errors) { continue } else if i := strings.IndexRune(line, 'A'); i != -1 { // Strip any leading noise. - // The noise must include at least one unprintable character (like XOFF or a fragment of a Unicode BOM). - for _, c := range line[:i] { + // Leading Unicode byte order marks and XOFF characters are silently ignored. + // The noise must include at least one unprintable character. + for j, c := range line[:i] { if !(c == ' ' || ('A' <= c && c <= 'Z')) { foundA = true - leadingNoise = true + leadingNoise = j != 0 || (c != '\x13' && c != '\ufeff') break } }
Silently ignore Unicode byte order marks and XOFF characters
twpayne_go-geom
train
go
1b81cef9a2e0e9d561ec4bf698cc00ed5c6a7a4b
diff --git a/libraries/lithium/test/Report.php b/libraries/lithium/test/Report.php index <HASH>..<HASH> 100644 --- a/libraries/lithium/test/Report.php +++ b/libraries/lithium/test/Report.php @@ -196,15 +196,6 @@ class Report extends \lithium\core\Object { } /** - * undocumented function - * - * @return void - */ - public function filters() { - return $this->reporter->filters((array) $this->results['filters']); - } - - /** * Renders the test output (e.g. layouts and filter templates) * * @param string $template name of the template (eg: layout)
Removed unnecessary 'filters' method from Report
UnionOfRAD_framework
train
php
2bb334657ba5dd8c7e3ec10c6d38498478070e23
diff --git a/spec/lib/auditable_spec.rb b/spec/lib/auditable_spec.rb index <HASH>..<HASH> 100644 --- a/spec/lib/auditable_spec.rb +++ b/spec/lib/auditable_spec.rb @@ -48,11 +48,20 @@ describe Auditable do survey.audits.count.should == 1 end - it "should create a new audit when calling audit_tag_with without existing audits" do - survey.audits.count.should == 0 - survey.audit_tag_with("something") # no audit to tag but should be ok with it - survey.audits.count.should == 1 - survey.audits.last.tag.should == "something" + describe ".audit_tag_with" do + it "should create a new audit when calling audit_tag_with without existing audits" do + expect do + survey.audit_tag_with("something") # no audit to tag but should be ok with it + end.to change { survey.audits.count }.from(0).to(1) + survey.audits.last.tag.should == "something" + end + + it "should not create new audits when only tag changes" do + survey.audit_tag_with "one" + survey.audit_tag_with "two" + survey.audit_tag_with "three" + survey.audits.map(&:tag).should == ["three"] + end end end
add a test for audit_tag_with to reflect its usage better
harley_auditable
train
rb
32baac656ce3116aa83d60e32eb536aca6483dd6
diff --git a/uni_form/tests/runtests.py b/uni_form/tests/runtests.py index <HASH>..<HASH> 100755 --- a/uni_form/tests/runtests.py +++ b/uni_form/tests/runtests.py @@ -8,17 +8,15 @@ parent = os.path.dirname(os.path.dirname(os.path.dirname( sys.path.insert(0, parent) -from django.test.simple import run_tests +from django.test.simple import DjangoTestSuiteRunner from django.conf import settings def runtests(): - failures = run_tests([ + DjangoTestSuiteRunner(failfast=False).run_tests([ 'uni_form.TestBasicFunctionalityTags', 'uni_form.TestFormHelpers', 'uni_form.TestFormLayout', ], verbosity=1, interactive=True) - sys.exit(failures) if __name__ == '__main__': runtests() -
Updating runtests to use DjangoTestSuiteRunner
django-crispy-forms_django-crispy-forms
train
py
3c4ba146d67589f67aaf6b91f7659a77a4042db9
diff --git a/app.go b/app.go index <HASH>..<HASH> 100644 --- a/app.go +++ b/app.go @@ -125,7 +125,13 @@ func (app *App) ParseCodeInfo(code, machineId string) (token string, expires int return } - err = res.DecodeField("expires_in", &expires) + expiresKey := "expires_in" + + if _, ok := res["expires"]; ok { + expiresKey = "expires" + } + + err = res.DecodeField(expiresKey, &expires) if err != nil { return @@ -165,7 +171,13 @@ func (app *App) ExchangeToken(accessToken string) (token string, expires int, er return } - err = res.DecodeField("expires_in", &expires) + expiresKey := "expires_in" + + if _, ok := res["expires"]; ok { + expiresKey = "expires" + } + + err = res.DecodeField(expiresKey, &expires) return }
refs #<I>. use "expires" as expires time key if possible.
huandu_facebook
train
go