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
f0cafcb9e91d5d34c821ff8a5aa554602c74a97c
diff --git a/Command/JobsCommand.php b/Command/JobsCommand.php index <HASH>..<HASH> 100644 --- a/Command/JobsCommand.php +++ b/Command/JobsCommand.php @@ -55,6 +55,9 @@ class JobsCommand extends Command foreach( $this->getSiteItems( $context, $input ) as $siteItem ) { + \Aimeos\MShop::cache( true ); + \Aimeos\MAdmin::cache( true ); + $localeItem = $localeManager->bootstrap( $siteItem->getCode(), '', '', false ); $localeItem->setLanguageId( null ); $localeItem->setCurrencyId( null );
Clear cached managers to avoid using old context
aimeos_aimeos-symfony
train
php
3e17b7c4a442a240e97a0ab96c1722d527fa6165
diff --git a/haas/tests/test_result.py b/haas/tests/test_result.py index <HASH>..<HASH> 100644 --- a/haas/tests/test_result.py +++ b/haas/tests/test_result.py @@ -298,7 +298,7 @@ class TestFailfast(ExcInfoFixture, unittest.TestCase): self.assertFalse(collector.shouldStop) -class TestBuffering(ExcInfoFixture): +class TestBuffering(ExcInfoFixture, unittest.TestCase): @patch('sys.stderr', new_callable=StringIO) def test_buffering_stderr(self, stderr):
Add accidentally removed TestCase base class
scalative_haas
train
py
f4f40c2636c0fde77f53f73e8e2d0540d3ace03d
diff --git a/peri/comp/objs.py b/peri/comp/objs.py index <HASH>..<HASH> 100644 --- a/peri/comp/objs.py +++ b/peri/comp/objs.py @@ -1,6 +1,5 @@ import numpy as np from scipy.special import erf -from scipy.linalg import expm3 try: from scipy.weave import inline @@ -708,14 +707,11 @@ class Slab(Component): ]) pos = pos + self.inner.l - # p = self.rvecs.dot(self.normal()) - pos).dot(self.normal()) - n = self.normal() p = (np.sum([r*n for r, n in zip(self.rvecs, self.normal())]) - pos.dot(self.normal())) m1 = p < -4. m0 = p > 4. mp = -(m1 | m0) - # self.image[:] = 1.0/(1.0 + np.exp(7*p)) #FIXME why is this not an erf??? self.image[m1] = 1. self.image[mp] = 1.0/(1.0 + np.exp(7*p[mp])) #FIXME why is this not an erf??? self.image[m0] = 0.
Removing some now unnecessary lines from objs.py
peri-source_peri
train
py
72855357306046e5bfcd6e3866fa9e1180728094
diff --git a/src/tween/tween.babel.js b/src/tween/tween.babel.js index <HASH>..<HASH> 100644 --- a/src/tween/tween.babel.js +++ b/src/tween/tween.babel.js @@ -1221,14 +1221,16 @@ class Tween extends Module { @parma {Function} Method to call */ _overrideCallback(callback, fun) { + let self = this; + var isCallback = (callback && typeof callback === 'function'), override = function callbackOverride() { // call overriden callback if it exists - isCallback && callback.apply(this, arguments); + isCallback && callback.apply(self, arguments); // call the passed cleanup function - fun.apply(this, arguments); + fun.apply(self, arguments); }; // add overridden flag
Fix `no-invalid-this` rule Note that `self` in this context refer to the global `window` object.
mojs_mojs
train
js
1cb05f87c1edf17e184a5d5489555a9497c422e0
diff --git a/properties/base.py b/properties/base.py index <HASH>..<HASH> 100644 --- a/properties/base.py +++ b/properties/base.py @@ -385,7 +385,8 @@ class List(basic.Property): return 'a list - each item is {info}'.format(info=self.prop.info()) def _unused_default_warning(self): - if self.prop.default is not utils.undefined: + if (self.prop.default is not utils.undefined and + self.prop.default != self.default): warn('List prop default ignored: {}'.format(self.prop.default), RuntimeWarning) @@ -507,7 +508,7 @@ class Union(basic.Property): continue if prop_def is utils.undefined: prop_def = prop.default - else: + elif prop_def != prop.default: warn('Union prop default ignored: {}'.format(prop.default), RuntimeWarning)
Do not warn on unused defaults if unused and used values are the same For example Unions of different list types will not warn any more. An empty list is the default regardless.
seequent_properties
train
py
f67ad89d25bca80015e6b0f53703bb99b7b83a6b
diff --git a/src/_pdbpp_path_hack/pdb.py b/src/_pdbpp_path_hack/pdb.py index <HASH>..<HASH> 100644 --- a/src/_pdbpp_path_hack/pdb.py +++ b/src/_pdbpp_path_hack/pdb.py @@ -9,5 +9,9 @@ else: pdb_path = os.path.join(os.path.dirname(code.__file__), 'pdb.py') +# Set __file__ to exec'd code. This is good in general, and required for +# coverage.py to use it. +__file__ = pdb_path + with open(pdb_path) as f: exec(compile(f.read(), pdb_path, 'exec'))
_pdbpp_path_hack/pdb.py: set __file__ Required for coverage.py since it uses the same filename. Ref: <URL>
antocuni_pdb
train
py
f2f6728b3f36f3c4fac57bd09ba4114b439f2b6d
diff --git a/src/Manager.php b/src/Manager.php index <HASH>..<HASH> 100644 --- a/src/Manager.php +++ b/src/Manager.php @@ -77,6 +77,10 @@ class Manager extends Module { self::ATTR_SESSION_TIMEOUT => 60 // seconds inactive to trigger timeout ]; } + /** + * @throws InvalidEntityException + * @return \Logikos\Auth\UserModelInterface + */ public function getEntity() { static $cache = []; $entity = $this->getUserOption(self::ATTR_ENTITY);
added return comment for ide autocomplete
logikostech_auth
train
php
db4caa0d822c3e59c63933875017778169ae86f6
diff --git a/lib/solargraph/convention/rspec.rb b/lib/solargraph/convention/rspec.rb index <HASH>..<HASH> 100644 --- a/lib/solargraph/convention/rspec.rb +++ b/lib/solargraph/convention/rspec.rb @@ -8,14 +8,23 @@ module Solargraph @environ ||= Environ.new( requires: ['rspec'], domains: ['RSpec::Matchers', 'RSpec::ExpectationGroups'], - # This override is necessary due to an erroneous @return tag in - # rspec's YARD documentation. - # @todo The return types have been fixed (https://github.com/rspec/rspec-expectations/pull/1121) pins: [ + # This override is necessary due to an erroneous @return tag in + # rspec's YARD documentation. + # @todo The return types have been fixed (https://github.com/rspec/rspec-expectations/pull/1121) Solargraph::Pin::Reference::Override.method_return('RSpec::Matchers#expect', 'RSpec::Expectations::ExpectationTarget') - ] + ].concat(extras) ) end + + private + + def extras + @@extras ||= SourceMap.load_string(%( + def describe(*args); end + def it(*args); end + )).pins + end end end end
Basic support for RSpec #describe and #it
castwide_solargraph
train
rb
4f2e2854030a25298c4fa8e25e277ee00cb250e2
diff --git a/tests/Formatter/PhpGetBrowserTest.php b/tests/Formatter/PhpGetBrowserTest.php index <HASH>..<HASH> 100644 --- a/tests/Formatter/PhpGetBrowserTest.php +++ b/tests/Formatter/PhpGetBrowserTest.php @@ -68,4 +68,30 @@ class PhpGetBrowserTest extends \PHPUnit_Framework_TestCase self::assertSame('TestComment', $return->comment); self::assertObjectHasAttribute('browser_type', $return); } + + public function testPatternIdIsReturned() + { + $data = [ + 'Browser' => 'test', + 'PatternId' => 'test.json::u0::c1', + ]; + + $this->object->setData($data); + $return = $this->object->getData(); + + self::assertObjectHasAttribute('patternid', $return); + self::assertSame('test.json::u0::c1', $return->patternid); + } + + public function testPatternIdIsNotReturned() + { + $data = [ + 'Browser' => 'test', + ]; + + $this->object->setData($data); + $return = $this->object->getData(); + + self::assertObjectNotHasAttribute('patternid', $return); + } }
adding a couple of tests to hit new code
browscap_browscap-php
train
php
b09c6a9682d094a7097a3c4a15dcec5af4601428
diff --git a/Tests/Unit/Document/UrlObjectTest.php b/Tests/Unit/Document/UrlObjectTest.php index <HASH>..<HASH> 100644 --- a/Tests/Unit/Document/UrlObjectTest.php +++ b/Tests/Unit/Document/UrlObjectTest.php @@ -57,7 +57,7 @@ class UrlObjectTest extends \PHPUnit_Framework_TestCase $url->setUrl($data['url']); $this->assertEquals($data['url'], $url->getUrl()); - $url->setUrlKey($data['key']); - $this->assertEquals($data['key'], $url->getUrlKey()); + $url->setKey($data['key']); + $this->assertEquals($data['key'], $url->getKey()); } }
Test fixed for CategoryService Test updated for UrlObject after change
ongr-archive_ContentBundle
train
php
9bf01f4441e03f0958c2c8991fd5d3cda91a828b
diff --git a/pachyderm/plot.py b/pachyderm/plot.py index <HASH>..<HASH> 100644 --- a/pachyderm/plot.py +++ b/pachyderm/plot.py @@ -465,6 +465,8 @@ class LegendConfig: font_size: Optional[float] = attr.ib(default=None) ncol: Optional[float] = attr.ib(default=1) marker_label_spacing: Optional[float] = attr.ib(default=None) + # NOTE: Default in mpl is 0.5 + label_spacing: Optional[float] = attr.ib(default=None) def apply( self, @@ -490,6 +492,7 @@ class LegendConfig: fontsize=self.font_size, ncol=self.ncol, handletextpad=self.marker_label_spacing, + labelspacing=self.label_spacing, **kwargs, )
Set spacing from marker to label in legend
raymondEhlers_pachyderm
train
py
51da9d6802e0321918961bda6fe92efb53edb13a
diff --git a/tasks/index.js b/tasks/index.js index <HASH>..<HASH> 100644 --- a/tasks/index.js +++ b/tasks/index.js @@ -1,18 +1,8 @@ 'use strict'; var i18next = require('..'); -var through2 = require('through2'); var vfs = require('vinyl-fs'); -var tap = function(callback) { - return through2.obj(function(file, enc, done) { - if (typeof callback === 'function') { - callback(); - } - done(); - }); -}; - module.exports = function(grunt) { grunt.registerMultiTask('i18next', 'A grunt task for i18next-scanner', function() { var done = this.async(); @@ -23,9 +13,9 @@ module.exports = function(grunt) { vfs.src(target.files || target.src, {base: target.base || '.'}) .pipe(i18next(options, target.customTransform, target.customFlush)) .pipe(vfs.dest(target.dest || '.')) - .pipe(tap(function() { + .on('end', function() { done(); - })); + }); }); }); };
Fix the grunt task. Wait for all files to be written before finish the task.
i18next_i18next-scanner
train
js
0f6183f8cc414825df67bde2efa9486ab4a6e6e2
diff --git a/mongo/mongo_test.go b/mongo/mongo_test.go index <HASH>..<HASH> 100644 --- a/mongo/mongo_test.go +++ b/mongo/mongo_test.go @@ -374,7 +374,7 @@ func (s *MongoSuite) TestInstallMongod(c *gc.C) { {"precise", [][]string{{"--target-release", "precise-updates/cloud-tools", "mongodb-server"}}}, {"trusty", [][]string{{"juju-mongodb"}}}, {"xenial", [][]string{{"juju-mongodb3.2"}, {"juju-mongo-tools3.2"}}}, - {"bionic", [][]string{{"juju-mongodb3.2"}, {"juju-mongo-tools3.2"}}}, + {"bionic", [][]string{{"mongodb-server-core"}}}, } testing.PatchExecutableAsEchoArgs(c, s, "add-apt-repository") @@ -434,7 +434,7 @@ func (s *MongoSuite) TestInstallMongodFallsBack(c *gc.C) { {"precise", "mongodb-server"}, {"trusty", "juju-mongodb"}, {"xenial", "juju-mongodb3.2"}, - {"bionic", "juju-mongodb3.2"}, + {"bionic", "mongodb-server-core"}, } dataDir := c.MkDir()
Update the test to expect mongodb-server-core on bionic.
juju_juju
train
go
70b987dcd558363a4fd5589f10eabdd3a0fa6c1b
diff --git a/bokeh/models/tools.py b/bokeh/models/tools.py index <HASH>..<HASH> 100644 --- a/bokeh/models/tools.py +++ b/bokeh/models/tools.py @@ -288,7 +288,7 @@ class BoxSelectTool(Tool): defaults to all renderers on a plot. """) - select_every_mousemove = Bool(True, help=""" + select_every_mousemove = Bool(False, help=""" An explicit list of renderers to hit test again. If unset, defaults to all renderers on a plot. """)
Fix box select tool issue Python default out of sync with js
bokeh_bokeh
train
py
54898306cf56fd22ad44c9e68e9289f4c749969d
diff --git a/provider/maas/environ.go b/provider/maas/environ.go index <HASH>..<HASH> 100644 --- a/provider/maas/environ.go +++ b/provider/maas/environ.go @@ -64,7 +64,7 @@ func releaseNodes(nodes gomaasapi.MAASObject, ids url.Values) error { func reserveIPAddress(ipaddresses gomaasapi.MAASObject, cidr string, addr network.Address) error { params := url.Values{} params.Add("network", cidr) - params.Add("ip", addr.Value) + params.Add("requested_address", addr.Value) _, err := ipaddresses.CallPost("reserve", params) return err }
Fixed MAAS provider address allocation params - forward port to master
juju_juju
train
go
0a9a7e55c11e154bc832ba7b3d8b17443dd36e15
diff --git a/index.js b/index.js index <HASH>..<HASH> 100644 --- a/index.js +++ b/index.js @@ -48,7 +48,7 @@ function statAsync (fp, callback) { function tryStatSync (fp) { try { return fs.statSync(fp).isDirectory() - } catch(err) { + } catch (err) { return false } }
index.js: add space after `catch` (#6)
tunnckoCore_detect-installed
train
js
8a327ede94fbb01977367223997c0d3cb4d73d9a
diff --git a/src/modules/auth-session/sagas/logout.js b/src/modules/auth-session/sagas/logout.js index <HASH>..<HASH> 100644 --- a/src/modules/auth-session/sagas/logout.js +++ b/src/modules/auth-session/sagas/logout.js @@ -1,12 +1,16 @@ import { takeLeading, put } from 'redux-saga/effects'; -import { config } from 'config'; +import { config, globalEnv } from 'config'; import { deleteTokens } from 'services/actions'; import { types, logoutSuccess, logoutFailure } from '../actions'; function requestFrame() { return new Promise(res => { - window.requestAnimationFrame(res); + if (globalEnv.requestAnimationFrame) { + window.requestAnimationFrame(res); + } else { + res(); + } }); }
:bug: Skip calling requestAnimationFrame if window object isn't present
AckeeCZ_petrus
train
js
5940a80970d80284fcfa86ab6f788bc0cbe2d4c7
diff --git a/malcolm/modules/scanning/infos.py b/malcolm/modules/scanning/infos.py index <HASH>..<HASH> 100644 --- a/malcolm/modules/scanning/infos.py +++ b/malcolm/modules/scanning/infos.py @@ -178,8 +178,6 @@ class ExposureDeadtimeInfo(Info): def calculate_minimum_duration(self, exposure: float) -> float: """Calculate the minimum frame duration required for the frame""" - if exposure < self.min_exposure: - self.min_exposure denominator = 1 - (self.frequency_accuracy / 1000000.0) min_duration = (exposure + self.readout_time) / denominator return min_duration
ExposureDeadtimeInfo: remove unused code path for calculating duration
dls-controls_pymalcolm
train
py
c88ac927314499a6b8ecc2ea754b6e32ba433bdb
diff --git a/pyisbn/__init__.py b/pyisbn/__init__.py index <HASH>..<HASH> 100644 --- a/pyisbn/__init__.py +++ b/pyisbn/__init__.py @@ -58,6 +58,7 @@ books in their collection. class Isbn(object): + """Class for representing ISBN objects.""" __slots__ = ('_isbn', 'isbn') @@ -174,11 +175,13 @@ class Isbn(object): class Isbn10(Isbn): + """Class for representing ISBN-10 objects. :seealso: ``Isbn`` """ + def __init__(self, isbn): """Initialise a new ``Isbn10`` object. @@ -208,11 +211,13 @@ class Isbn10(Isbn): class Sbn(Isbn10): + """Class for representing SBN objects. :seealso: ``Isbn10`` """ + def __init__(self, sbn): """Initialise a new ``Sbn`` object. @@ -252,11 +257,13 @@ class Sbn(Isbn10): class Isbn13(Isbn): + """Class for representing ISBN-13 objects. :seealso: ``Isbn`` """ + def __init__(self, isbn): """Initialise a new ``Isbn13`` object.
[QA] PEP-<I> class docstring compliance fixes. For some reason I always forget this one.
JNRowe_pyisbn
train
py
38dffe440743c29ec5fdf386fd22272de7cd8783
diff --git a/example.js b/example.js index <HASH>..<HASH> 100644 --- a/example.js +++ b/example.js @@ -2,15 +2,19 @@ var pdfFormFill = require('lib/pdf-fill-form.js'); var fs = require('fs'); // Show fields -var formFields = pdfFormFill.readSync('test.pdf') +var formFields = pdfFormFill.readSync('test.pdf'); console.log(formFields); // Write fields -pdfFormFill.writeAsync('test.pdf', { "myField1": "myField1 fill text" }, { "save": "imgpdf" }, function(err, result) { - fs.writeFile("test_filled_images.pdf", result, function(err) { - if(err) { +pdfFormFill.writeAsync('test.pdf', { 'myField1': 'myField1 fill text' }, { 'save': 'imgpdf' }, function(err, result) { + if (err) { + return console.log(err); + } + + fs.writeFile('test_filled_images.pdf', result, function(err) { + if (err) { return console.log(err); } - console.log("The file was saved!"); - }); + console.log('The file was saved!'); + }); });
Ran through Google Closure linter
tpisto_pdf-fill-form
train
js
dc097d834461be88df9a9dc38e639f609e37785d
diff --git a/tt/gspreadsheet.py b/tt/gspreadsheet.py index <HASH>..<HASH> 100644 --- a/tt/gspreadsheet.py +++ b/tt/gspreadsheet.py @@ -129,6 +129,8 @@ class GSpreadsheet(object): return "https://docs.google.com/a/texastribune.org/spreadsheet/ccc?key=%s" % (self.key) def get_worksheets(self): + if hasattr(self, 'spreadsheet_name') and hasattr(self, '_worksheets'): + return self._worksheets # for debugging worksheets = self.client.GetWorksheetsFeed(self.key) self.spreadsheet_name = worksheets.title.text
return cached worksheets if importer already knows the worksheets
texastribune_gspreadsheet
train
py
c54c50310d112ea6e5e28fd7f545f3d5bb730b0f
diff --git a/lib/cb/requests/application_external/submit_application.rb b/lib/cb/requests/application_external/submit_application.rb index <HASH>..<HASH> 100644 --- a/lib/cb/requests/application_external/submit_application.rb +++ b/lib/cb/requests/application_external/submit_application.rb @@ -30,6 +30,7 @@ module Cb private def ipath + return '' unless @args[:ipath].class == String ipath_length = 10 @args[:ipath].slice(0, ipath_length) || '' unless @args.nil? || @args[:ipath].nil?
ipath won't bomb if not given a string
careerbuilder_ruby-cb-api
train
rb
0c666862d878d922e766c8d6faa036adc74a6af1
diff --git a/gulpfile.js b/gulpfile.js index <HASH>..<HASH> 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -19,7 +19,7 @@ gulp.task('sass', function () { }); gulp.task('css', ['sass'], function () { - return gulp.src(cssDir + '/*.css') + return gulp.src([cssDir + '/*.css', '!' + cssDir + '/*.min.css']) .pipe(minifycss()) .pipe(rename({extname: '.min.css'})) .pipe(gulp.dest(cssDir)); @@ -37,7 +37,7 @@ gulp.task('scripts', function() { }); gulp.task('js', ['scripts'], function() { - return gulp.src([jsDir + '/grido.js', jsDir + '/grido.bundle.js']) + return gulp.src([jsDir + '/*.js', '!' + jsDir + '/*.min.js']) .pipe(uglify({preserveComments: 'license'})) .pipe(rename({extname: '.min.js'})) .pipe(gulp.dest(jsDir));
Assets: Fixed a gulp task for minification
o5_grido
train
js
18b76ea70de65fe00374f87f2e0db275ac5bcdf4
diff --git a/engine/src/main/java/com/stratio/streaming/configuration/StreamingContextConfiguration.java b/engine/src/main/java/com/stratio/streaming/configuration/StreamingContextConfiguration.java index <HASH>..<HASH> 100644 --- a/engine/src/main/java/com/stratio/streaming/configuration/StreamingContextConfiguration.java +++ b/engine/src/main/java/com/stratio/streaming/configuration/StreamingContextConfiguration.java @@ -275,8 +275,6 @@ public class StreamingContextConfiguration { private void configureDataContext(JavaPairDStream<String, String> messages) { KeepPayloadFromMessageFunction keepPayloadFromMessageFunction = new KeepPayloadFromMessageFunction(); - kafkaTopicService.createTopicIfNotExist(InternalTopic.TOPIC_DATA.getTopicName(), configurationContext.getKafkaReplicationFactor(), configurationContext.getKafkaPartitions()); - JavaDStream<StratioStreamingMessage> insertRequests = messages.filter( new FilterMessagesByOperationFunction(STREAM_OPERATIONS.MANIPULATION.INSERT)).map( keepPayloadFromMessageFunction);
Removed duplicated Kafka topic creation.
Stratio_Decision
train
java
667dd45105f40f2d6a6f15bd48387dc014ca88e1
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100755 --- a/setup.py +++ b/setup.py @@ -4,7 +4,7 @@ from libsubmit.version import VERSION install_requires = [ 'ipyparallel', 'boto3', - 'azure' + 'azure', 'haikunator', 'python-novaclient' ]
Fixing missing comma in setup
Parsl_libsubmit
train
py
c53424220ce7a0ecc22a186161e880f124ced9ce
diff --git a/src/org/zaproxy/zap/extension/autoupdate/ExtensionAutoUpdate.java b/src/org/zaproxy/zap/extension/autoupdate/ExtensionAutoUpdate.java index <HASH>..<HASH> 100644 --- a/src/org/zaproxy/zap/extension/autoupdate/ExtensionAutoUpdate.java +++ b/src/org/zaproxy/zap/extension/autoupdate/ExtensionAutoUpdate.java @@ -278,6 +278,19 @@ public class ExtensionAutoUpdate extends ExtensionAdaptor implements CheckForUpd } } + File addOnFile; + try { + addOnFile = copyAddOnFileToLocalPluginFolder(ao); + } catch (FileAlreadyExistsException e) { + logger.warn("Unable to copy add-on, a file with the same name already exists.", e); + return false; + } catch (IOException e) { + logger.warn("Unable to copy add-on to local plugin folder.", e); + return false; + } + + ao.setFile(addOnFile); + return install(ao); }
Copy the add-on installed through the API Copy the add-on to local plugin directory to install it permanently, like the other ways of installing an add-on do, to avoid surprises when ZAP is started again.
zaproxy_zaproxy
train
java
7709af9f42ae8455c205d4ba65ef0bb6f22be1e5
diff --git a/visidata/vd.py b/visidata/vd.py index <HASH>..<HASH> 100755 --- a/visidata/vd.py +++ b/visidata/vd.py @@ -241,9 +241,7 @@ anytype = lambda r='': str(r) anytype.__name__ = '' class date: - """Simple wrapper around `datetime`. - - This allows it to be created from dateutil str or numeric input as time_t""" + """`datetime` wrapper, constructing from time_t or with dateutil.parse""" def __init__(self, s=None): if s is None: @@ -263,6 +261,10 @@ class date: fmtstr = '%Y-%m-%d %H:%M:%S' return self.dt.strftime(fmtstr) + def __getattr__(self, k): + """Forward unknown attributes to inner datetime object""" + return getattr(self.dt, k) + def __str__(self): return self.to_string()
Add forwarding from date to inner datetime for .year/etc #<I>
saulpw_visidata
train
py
b2844c64cd47c5ebfd6a0744e88ed032fac3bc47
diff --git a/voluptuous/voluptuous.py b/voluptuous/voluptuous.py index <HASH>..<HASH> 100644 --- a/voluptuous/voluptuous.py +++ b/voluptuous/voluptuous.py @@ -260,13 +260,21 @@ class Schema(object): continue # Backtracking is not performed once a key is selected, so if # the value is invalid we immediately throw an exception. + exception_errors = [] try: out[new_key] = cvalue(key_path, value) + except MultipleInvalid as e: + exception_errors.extend(e.errors) except Invalid as e: - if len(e.path) > len(key_path): - errors.append(e) - else: - errors.append(Invalid(e.msg + invalid_msg, e.path)) + exception_errors.append(e) + + if exception_errors: + for err in exception_errors: + if len(err.path) > len(key_path): + errors.append(err) + else: + errors.append( + Invalid(err.msg + invalid_msg, err.path)) break # Key and value okay, mark any Required() fields as found.
Preserve all errors for fields of dicts and objects
alecthomas_voluptuous
train
py
1d51b72785f4d14ca0e26fd1d1f69c25f9deb2e7
diff --git a/src/drawer.js b/src/drawer.js index <HASH>..<HASH> 100644 --- a/src/drawer.js +++ b/src/drawer.js @@ -709,8 +709,7 @@ function updateTile( drawer, drawLevel, haveDrawn, x, y, level, levelOpacity, le ); if ( tile.loaded ) { - - drawer.updateAgain = blendTile( + var needsUpdate = blendTile( drawer, tile, x, y, @@ -718,6 +717,10 @@ function updateTile( drawer, drawLevel, haveDrawn, x, y, level, levelOpacity, le levelOpacity, currentTime ); + + if ( needsUpdate ) { + drawer.updateAgain = true; + } } else if ( tile.loading ) { // the tile is already in the download queue // thanks josh1093 for finally translating this typo
Fixed blendTile()-related blurriness issue We were setting drawer.updateAgain to the result of each blendTile(), which meant it was keeping only the last result. Instead we should have been only setting it to true if blendTile returned true, but never setting it to false. Fixed.
openseadragon_openseadragon
train
js
c6bc82fbc8face7df7269ca1c5ca4b70b0c96a4a
diff --git a/dev/io.openliberty.microprofile.openapi.2.0.internal/src/io/openliberty/microprofile/openapi20/utils/IndexUtils.java b/dev/io.openliberty.microprofile.openapi.2.0.internal/src/io/openliberty/microprofile/openapi20/utils/IndexUtils.java index <HASH>..<HASH> 100644 --- a/dev/io.openliberty.microprofile.openapi.2.0.internal/src/io/openliberty/microprofile/openapi20/utils/IndexUtils.java +++ b/dev/io.openliberty.microprofile.openapi.2.0.internal/src/io/openliberty/microprofile/openapi20/utils/IndexUtils.java @@ -74,7 +74,7 @@ public class IndexUtils { for (Path file : files) { try { - processFile(file.getFileName().toString(), Files.newInputStream(file), indexer, filter, config); + processFile(containerPath.relativize(file).toString(), Files.newInputStream(file), indexer, filter, config); } catch (IOException e) { if (LoggingUtils.isEventEnabled(tc)) { Tr.event(tc, String.format("Error occurred when processing file %s: %s", file.getFileName().toString(), e.getMessage()));
OpenAPI: respect config when scanning expanded app File paths were not being handled correctly for expanded apps, leading to an incorrect class name being compared to the include/exclude filters derived from the configuration.
OpenLiberty_open-liberty
train
java
c5ac06911a5401d612a62df4d9488bdf6e6284d5
diff --git a/suitable/tests/conftest.py b/suitable/tests/conftest.py index <HASH>..<HASH> 100644 --- a/suitable/tests/conftest.py +++ b/suitable/tests/conftest.py @@ -19,14 +19,20 @@ class Container(object): self.password = password def spawn_api(self, api_class, **kwargs): - return api_class( - '%s:%s' % (self.host, self.port), - remote_user=self.username, - remote_pass=self.password, - connection='smart', - extra_vars={ + options = { + 'remote_user': self.username, + 'remote_pass': self.password, + 'connection': 'smart', + 'extra_vars': { 'ansible_python_interpreter': '/usr/bin/python3' } + } + + options.update(kwargs) + + return api_class( + '%s:%s' % (self.host, self.port), + ** options ) def vanilla_api(self, **kwargs):
Fixes conftest options not being propagated
seantis_suitable
train
py
86916fb9928d264df870cfb75cd02bd04a3d41df
diff --git a/lib/survey_gizmo/resource.rb b/lib/survey_gizmo/resource.rb index <HASH>..<HASH> 100644 --- a/lib/survey_gizmo/resource.rb +++ b/lib/survey_gizmo/resource.rb @@ -257,8 +257,6 @@ module SurveyGizmo def inspect if ENV['GIZMO_DEBUG'] ap "CLASS: #{self.class}" - ap "CLASS ATTRIBUTE SET\n----------" - ap self.class.attribute_set end attribute_strings = self.class.attribute_set.map do |attrib|
Don't need to log the attribute_set as an object
jarthod_survey-gizmo-ruby
train
rb
20f8c5366948d3ee6ceb8f517171f0317fc37752
diff --git a/azurerm/resource_arm_api_management_logger_test.go b/azurerm/resource_arm_api_management_logger_test.go index <HASH>..<HASH> 100644 --- a/azurerm/resource_arm_api_management_logger_test.go +++ b/azurerm/resource_arm_api_management_logger_test.go @@ -89,7 +89,7 @@ func TestAccAzureRMApiManagementLogger_basicEventHubAppInsightsUpdate(t *testing resource.TestCheckResourceAttr(resourceName, "eventhub.#", "1"), resource.TestCheckResourceAttrSet(resourceName, "eventhub.0.name"), resource.TestCheckResourceAttrSet(resourceName, "eventhub.0.connection_string"), - resource.TestCheckNoResourceAttr(resourceName, "application_insights.#"), + resource.TestCheckResourceAttr(resourceName, "application_insights.#", "0"), ), }, {
Update azurerm/resource_arm_api_management_logger_test.go
terraform-providers_terraform-provider-azurerm
train
go
e0114f863f750e5173f827e1f8059b01e160b1b9
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -3,7 +3,7 @@ from setuptools import setup, find_packages setup( name="rueckenwind", version="0.0.1", - install_requires=['tornado>=3.0.1,<4.0', 'jinja2', 'werkzeug==0.6.2', 'babel', 'mock', 'configobj', 'bson'], + install_requires=['tornado>=3.0.1,<4.0', 'jinja2', 'werkzeug==0.6.2', 'babel', 'mock', 'configobj', 'motor'], packages=find_packages(exclude=["test"]), include_package_data=True, package_data={
Added motor dependency, bson will be provided by pymongo.
FlorianLudwig_rueckenwind
train
py
c06fb77947b24a412aa60d89a3c1a7b78166f2f3
diff --git a/spec/ransack/dependencies_spec.rb b/spec/ransack/dependencies_spec.rb index <HASH>..<HASH> 100644 --- a/spec/ransack/dependencies_spec.rb +++ b/spec/ransack/dependencies_spec.rb @@ -1,3 +1,4 @@ +=begin rails = ::ActiveRecord::VERSION::STRING.first(3) if %w(3.2 4.0 4.1).include?(rails) || rails == '3.1' && RUBY_VERSION < '2.2' @@ -8,3 +9,4 @@ if %w(3.2 4.0 4.1).include?(rails) || rails == '3.1' && RUBY_VERSION < '2.2' end end end +=end
Comment out this test for now. TODO: examine this.
activerecord-hackery_ransack
train
rb
5be49884b5947d4624bdaaf9cf2629ca4dd73567
diff --git a/activerecord/lib/active_record/associations/association_proxy.rb b/activerecord/lib/active_record/associations/association_proxy.rb index <HASH>..<HASH> 100644 --- a/activerecord/lib/active_record/associations/association_proxy.rb +++ b/activerecord/lib/active_record/associations/association_proxy.rb @@ -51,7 +51,7 @@ module ActiveRecord alias_method :proxy_respond_to?, :respond_to? alias_method :proxy_extend, :extend delegate :to_param, :to => :proxy_target - instance_methods.each { |m| undef_method m unless m =~ /^(?:nil\?|send|object_id|to_a)$|^__|proxy_/ } + instance_methods.each { |m| undef_method m unless m.to_s =~ /^(?:nil\?|send|object_id|to_a)$|^__|proxy_/ } def initialize(owner, reflection) @owner, @reflection = owner, reflection
Prevent calling regexp on symbol in Ruby <I> in association_proxy
rails_rails
train
rb
7ab6f110d91723ea72d54ffaaa12404454d523c9
diff --git a/plash/cli.py b/plash/cli.py index <HASH>..<HASH> 100644 --- a/plash/cli.py +++ b/plash/cli.py @@ -19,6 +19,9 @@ SHORTCUTS = [ ('-a', ['apt'], '+'), ('-p', ['pip'], '+'), ('-b', ['apt', 'ubuntu-server'], 0), + ('-U', ['os', 'ubuntu'], 0), + ('-F', ['os', 'fedora'], 0), + ('-D', ['os', 'debian'], 0), ]
Shortcuts for some osses
ihucos_plash
train
py
a7e489192bc4e205dd31652bd944f71c57abb040
diff --git a/galpy/potential_src/TwoPowerSphericalPotential.py b/galpy/potential_src/TwoPowerSphericalPotential.py index <HASH>..<HASH> 100644 --- a/galpy/potential_src/TwoPowerSphericalPotential.py +++ b/galpy/potential_src/TwoPowerSphericalPotential.py @@ -312,6 +312,7 @@ class HernquistPotential(TwoPowerIntegerSphericalPotential): self.beta= 4 if normalize: self.normalize(normalize) + self.hasC= True return None def _evaluate(self,R,z,phi=0.,t=0.,dR=0,dphi=0):
add C implementation of Hernquist potential
jobovy_galpy
train
py
099d85ae38d59be42bdf8c1db40ca4ffddb00edb
diff --git a/test_isort.py b/test_isort.py index <HASH>..<HASH> 100644 --- a/test_isort.py +++ b/test_isort.py @@ -1507,3 +1507,12 @@ def test_basic_comment(): '# Foo\n' 'import os\n') assert SortImports(file_contents=test_input).output == test_input + + +def test_shouldnt_add_lines(): + """Ensure that isort doesn't add a blank line when a top of import comment is present, issue #316""" + test_input = ('"""Text"""\n' + '# This is a comment\n' + 'import pkg_resources\n') + assert SortImports(file_contents=test_input).output == test_input +
Add test case for issue #<I>
timothycrosley_isort
train
py
ed8c4906d63cc67bb79b7d889906d866f48a4591
diff --git a/build/prepareNightly.js b/build/prepareNightly.js index <HASH>..<HASH> 100644 --- a/build/prepareNightly.js +++ b/build/prepareNightly.js @@ -9,9 +9,14 @@ if (!parts) { throw new Error(`Invalid version number ${version}`); } // Add date to version. -const major = parts[1]; -const minor = parts[2]; -const patch = parts[3]; +const major = +parts[1]; +const minor = +parts[2]; +let patch = +parts[3]; +const isStable = !parts[4]; +if (isStable) { + // It's previous stable version. Dev version should be higher. + patch++; +} const date = new Date().toISOString().replace(/:|T|\.|-/g, '').slice(0, 8); const nightlyVersion = `${major}.${minor}.${patch}-dev.${date}`;
chore: increase dev version from stable version.
ecomfe_zrender
train
js
edc07e82c198e04cf1e610325d44e3349c1e67ed
diff --git a/registrator.go b/registrator.go index <HASH>..<HASH> 100644 --- a/registrator.go +++ b/registrator.go @@ -1,4 +1,4 @@ -package main +package main // import "github.com/progrium/registrator" import ( "errors"
Added canonical import path to main package. So can be built and Dockerized by centurylink/golang-builder. <URL>
gliderlabs_registrator
train
go
5376cdd30c1f01f5ec1660bf0c5c04fdb9d44c16
diff --git a/lib/fields.js b/lib/fields.js index <HASH>..<HASH> 100644 --- a/lib/fields.js +++ b/lib/fields.js @@ -42,7 +42,7 @@ exports.string = function (opt) { if (b.required) { var validator = typeof b.required === 'function' ? b.required : validators.required(); validator(form, b, function (v_err) { - b.error = v_err ? v_err.toString() : null; + b.error = v_err ? String(v_err) : null; callback(v_err, b); }); } else { @@ -52,7 +52,7 @@ exports.string = function (opt) { async.forEachSeries(b.validators || [], function (v, callback) { if (!b.error) { v(form, b, function (v_err) { - b.error = v_err ? v_err.toString() : null; + b.error = v_err ? String(v_err) : null; callback(null); }); } else {
Use String() instead of the toString prototype method.
caolan_forms
train
js
7b5c513d98d3e5b5296b7dbe2bc5a67aa606fced
diff --git a/Tests/Model/Node/ProductOptionsTest.php b/Tests/Model/Node/ProductOptionsTest.php index <HASH>..<HASH> 100644 --- a/Tests/Model/Node/ProductOptionsTest.php +++ b/Tests/Model/Node/ProductOptionsTest.php @@ -76,13 +76,8 @@ class ProductOptionsTest extends WebTestCase $po->getOption('color', 'red')->getName(), 'an option can be returned by type and value' ); - $this->assertEquals( - 'colorBlue', - $po->getOption('CoLoRr', 'bLuE')->getName(), - 'getOption parameters for type and value are case insensitive' - ); $this->assertNull($po->getOption('bull', 'shit'), "return null when the type doesn't exists"); - + $this->assertEquals( 'colorBlue', $po->getOptionByName('colorBlue')->getName(),
remove case insensitive test, it just doesn't make sense
vespolina_commerce
train
php
b68ffdc9cceb38e469978df1c2e0fbb7a9f9cb46
diff --git a/libraries/lithium/core/Libraries.php b/libraries/lithium/core/Libraries.php index <HASH>..<HASH> 100644 --- a/libraries/lithium/core/Libraries.php +++ b/libraries/lithium/core/Libraries.php @@ -144,9 +144,13 @@ class Libraries { public static function add($name, $config = array()) { $defaults = array( 'path' => LITHIUM_LIBRARY_PATH . '/' . $name, - 'prefix' => $name . "\\", 'suffix' => '.php', - 'loader' => null, 'includePath' => false, - 'transform' => null, 'bootstrap' => null, 'defer' => false, + 'prefix' => $name . "\\", + 'suffix' => '.php', + 'loader' => null, + 'includePath' => false, + 'transform' => null, + 'bootstrap' => null, + 'defer' => false ); switch ($name) { case 'app': @@ -549,7 +553,7 @@ class Libraries { * @return void */ protected static function _addPlugins($plugins) { - $defaults = array('bootstrap' => null, 'route' => true); + $defaults = array('bootstrap' => true, 'route' => true); $params = array('app' => LITHIUM_APP_PATH, 'root' => LITHIUM_LIBRARY_PATH); $result = array();
Plugins now load thier bootstrap files automatically.
UnionOfRAD_framework
train
php
c4e17e3cab8d87c73ae5fe94ec69fc43b7e2bcd9
diff --git a/comments-bundle/src/Resources/contao/classes/Comments.php b/comments-bundle/src/Resources/contao/classes/Comments.php index <HASH>..<HASH> 100644 --- a/comments-bundle/src/Resources/contao/classes/Comments.php +++ b/comments-bundle/src/Resources/contao/classes/Comments.php @@ -73,7 +73,8 @@ class Comments extends Frontend $total = $gtotal = $intTotal; // Get the current page - $page = Input::get('page') ? Input::get('page') : 1; + $id = 'page_c' . $this->id; + $page = Input::get($id) ?: 1; // Do not index or cache the page if the page number is outside the range if ($page < 1 || $page > max(ceil($total/$objConfig->perPage), 1)) @@ -93,7 +94,7 @@ class Comments extends Frontend $offset = ($page - 1) * $objConfig->perPage; // Initialize the pagination menu - $objPagination = new Pagination($total, $objConfig->perPage); + $objPagination = new Pagination($total, $objConfig->perPage, 7, $id); $objTemplate->pagination = $objPagination->generate("\n "); }
[Comments] Pagination variables are now unique (see #<I>)
contao_contao
train
php
ddea68a80deedced4bf0fad24e66f075e368c38c
diff --git a/lib/genDocute.js b/lib/genDocute.js index <HASH>..<HASH> 100644 --- a/lib/genDocute.js +++ b/lib/genDocute.js @@ -23,6 +23,6 @@ module.exports = async config => { logger.success('Generated successfully') } catch (err) { console.error(err.name === 'SAOError' ? err.message : err.stack) + process.exit(1) } - process.exit(1) }
fix: Avoid abnormal exits fix #<I>
vuese_vuese
train
js
165c798e4257fa30839a636c5a2d46dc8308cbd7
diff --git a/lib/grably.rb b/lib/grably.rb index <HASH>..<HASH> 100644 --- a/lib/grably.rb +++ b/lib/grably.rb @@ -33,7 +33,7 @@ module Grably def init profile = (ENV[ENV_PROFILE_KEY] || 'default').split(',') puts 'Loding profile ' + profile.join('/') - @config = Grably::Core::Configuration.load(ENV[ENV_PROFILE_KEY] || []) + @config = Grably::Core::Configuration.load(profile) end def server
Use profile var instead of looking up into ENV
vizor-games_grably
train
rb
a2721775508aca064a42ad37ae024c7658a30f41
diff --git a/includes/constants.php b/includes/constants.php index <HASH>..<HASH> 100755 --- a/includes/constants.php +++ b/includes/constants.php @@ -30,7 +30,7 @@ * */ #TAO version number -define('TAO_VERSION', '3.3.0-sprint70'); +define('TAO_VERSION', '3.3.0-sprint71'); $version = TAO_VERSION;
udpate version to sprint <I>
oat-sa_tao-core
train
php
ae47fb1e4f1010c896fd7d27ff504b4f66fc88db
diff --git a/VirtualProductDelivery.php b/VirtualProductDelivery.php index <HASH>..<HASH> 100644 --- a/VirtualProductDelivery.php +++ b/VirtualProductDelivery.php @@ -33,7 +33,7 @@ class VirtualProductDelivery extends AbstractDeliveryModule */ public function isValidDelivery(Country $country) { - $cart = $this->getRequest()->getSession()->getCart(); + $cart = $this->getRequest()->getSession()->getSessionCart($this->getDispatcher()); foreach ($cart->getCartItems() as $cartItem) { if (!$cartItem->getProduct()->getVirtual()) { return false;
Refactored the cart management in the Session object
thelia-modules_VirtualProductDelivery
train
php
f318b5e6a3e5c5ab9d026bc52ccea2e8625c3417
diff --git a/plugins/org.eclipse.xtext/src/org/eclipse/xtext/resource/XtextResource.java b/plugins/org.eclipse.xtext/src/org/eclipse/xtext/resource/XtextResource.java index <HASH>..<HASH> 100644 --- a/plugins/org.eclipse.xtext/src/org/eclipse/xtext/resource/XtextResource.java +++ b/plugins/org.eclipse.xtext/src/org/eclipse/xtext/resource/XtextResource.java @@ -226,6 +226,21 @@ public class XtextResource extends ResourceImpl { super.doUnload(); parseResult = null; } + + /** + * @since 2.9 + */ + public void relink() { + if (!isLoaded()) { + throw new IllegalStateException("You can't update an unloaded resource."); + } + try { + isUpdating = true; + updateInternalState(parseResult, parseResult); + } finally { + isUpdating = false; + } + } public void update(int offset, int replacedTextLength, String newText) { if (!isLoaded()) {
[idea][performance] Only relink a model on the modification counter change, reparsing should be triggered by changing a corresponding xtext file Change-Id: I<I>eefbbe<I>c<I>d4e2d<I>e3
eclipse_xtext-core
train
java
b25f79d6b2cc7d3b29155cc728393222667dd5a3
diff --git a/lib/html/builder.rb b/lib/html/builder.rb index <HASH>..<HASH> 100644 --- a/lib/html/builder.rb +++ b/lib/html/builder.rb @@ -8,6 +8,10 @@ module BBLib SELF_CLOSING_TAGS.include?(tag.to_s.downcase) end + def self.build(*args, &block) + Builder.build(*args, &block) + end + module Builder BBLib::HTML::TAGS.each do |tag|
Added build method to HTML module.
bblack16_bblib-ruby
train
rb
4183cb796e8b58a6ba81694ab9d79203d4731fb4
diff --git a/test/test_calculating_business_duration.rb b/test/test_calculating_business_duration.rb index <HASH>..<HASH> 100644 --- a/test/test_calculating_business_duration.rb +++ b/test/test_calculating_business_duration.rb @@ -25,6 +25,13 @@ describe "calculating business duration" do assert_equal 5, sunday.business_days_until(friday, true) end + it "can calculate inclusive business duration with holidays passed as options" do + monday = Date.parse("June 20, 2022") + friday = Date.parse("June 24, 2022") + tuesday_holiday = Date.parse("June 22, 2022") + assert_equal 4, monday.business_days_until(friday, inclusive=true, holidays: [tuesday_holiday]) + end + it "properly calculate business time with respect to work_hours" do friday = Time.parse("December 24, 2010 15:00") monday = Time.parse("December 27, 2010 11:00")
add tests for inclusive business duration with holidays passed as options
bokmann_business_time
train
rb
542d5bad9ed302041ad40486557b311793eabc9e
diff --git a/eZ/Bundle/EzPublishCoreBundle/EventListener/SessionSetDynamicNameListener.php b/eZ/Bundle/EzPublishCoreBundle/EventListener/SessionSetDynamicNameListener.php index <HASH>..<HASH> 100644 --- a/eZ/Bundle/EzPublishCoreBundle/EventListener/SessionSetDynamicNameListener.php +++ b/eZ/Bundle/EzPublishCoreBundle/EventListener/SessionSetDynamicNameListener.php @@ -57,11 +57,9 @@ class SessionSetDynamicNameListener implements EventSubscriberInterface /** @var $session \Symfony\Component\HttpFoundation\Session\Session */ $session = $this->container->get( 'session' ); - /** @var $configResolver \eZ\Publish\Core\MVC\ConfigResolverInterface */ - $configResolver = $this->container->get( 'ezpublish.config.resolver' ); - $sessionName = $configResolver->getParameter( 'session_name' ); - if ( $session->getName() != $sessionName ) + if ( !$session->isStarted() ) { + $sessionName = $this->container->get( 'ezpublish.config.resolver' )->getParameter( 'session_name' ); if ( strpos( $sessionName, self::MARKER ) !== false ) { $session->setName(
Additional fix for EZP-<I>, Impossible to log in using PHP <I>
ezsystems_ezpublish-kernel
train
php
a3fc0299498feb33085d0df8c862f76b4e2b589e
diff --git a/docs/conf.py b/docs/conf.py index <HASH>..<HASH> 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -92,9 +92,9 @@ author = u'Deren Eaton' # The short X.Y version. #import ipyrad -version = 0.0.65 ##ipyrad.__version__ +version = "0.0.65" ##ipyrad.__version__ # The full version, including alpha/beta/rc tags. -release = 0.0.65 ##ipyrad.__version__ +release = "0.0.65" ##ipyrad.__version__ # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages.
'version' hard coded in conf as str not float
dereneaton_ipyrad
train
py
2514515f1f0423cb9d81a1a402b4a3096e4fa645
diff --git a/packages/currencies/tests/index.test.js b/packages/currencies/tests/index.test.js index <HASH>..<HASH> 100644 --- a/packages/currencies/tests/index.test.js +++ b/packages/currencies/tests/index.test.js @@ -117,12 +117,15 @@ test("formatter can change locale", () => { expect( formatCurrencyUnit(getFiatUnit("USD"), -1234567, { showCode: true }) ).toBe("- USD 12,345.67"); + // FIXME we can't test this unless we configure node.js properly to have the locales. we'll come back to this later... + /* expect( formatCurrencyUnit(getFiatUnit("EUR"), -1234567, { showCode: true, locale: "fr-FR" }) ).toBe("-12 345.67 EUR"); + */ }); test("encodeURIScheme", () => {
comment out tests for now because node.js need conf for Intl
LedgerHQ_ledgerjs
train
js
cf5c6533b8d40a1ae7799e9f72f2847889d0596c
diff --git a/lib/praxis-blueprints/blueprint.rb b/lib/praxis-blueprints/blueprint.rb index <HASH>..<HASH> 100644 --- a/lib/praxis-blueprints/blueprint.rb +++ b/lib/praxis-blueprints/blueprint.rb @@ -337,11 +337,11 @@ module Praxis if value.respond_to?(:validating) # really, it's a thing with sub-attributes next if value.validating end - errors.push(*sub_attribute.validate(value, sub_context)) + errors.concat(sub_attribute.validate(value, sub_context)) end self.class.attribute.type.requirements.each do |req| validation_errors = req.validate(keys_with_values, context) - errors.push(*validation_errors) unless validation_errors.empty? + errors.concat(validation_errors) unless validation_errors.empty? end errors ensure diff --git a/lib/praxis-blueprints/field_expander.rb b/lib/praxis-blueprints/field_expander.rb index <HASH>..<HASH> 100644 --- a/lib/praxis-blueprints/field_expander.rb +++ b/lib/praxis-blueprints/field_expander.rb @@ -108,7 +108,7 @@ module Praxis new_fields = fields.is_a?(Array) ? fields[0] : fields result = [expand(object.member_attribute.type, new_fields)] - history[object][fields].push(*result) + history[object][fields].concat(result) result end
Use `.concat` to appease the cops a little bit.
praxis_praxis-blueprints
train
rb,rb
de696521376a4d643c70c0e98ce393bc336954c6
diff --git a/frontend/client/src/model.js b/frontend/client/src/model.js index <HASH>..<HASH> 100644 --- a/frontend/client/src/model.js +++ b/frontend/client/src/model.js @@ -42,6 +42,18 @@ Espo.define('model', [], function () { Dep.prototype.initialize.call(this); }, + set: function (key, val, options) { + if (typeof key === 'object') { + var o = key; + if (this.idAttribute in o) { + this.id = o[this.idAttribute]; + } + } else if (key === 'id') { + this.id = val; + } + return Dep.prototype.set.call(this, key, val, options); + }, + get: function (key) { if (key === 'id' && this.id) { return this.id;
fix id in model.set
espocrm_espocrm
train
js
82e2a3064b4751d959ffdda214fef1ba7fd85e8a
diff --git a/application/briefkasten/tests/test_dropbox.py b/application/briefkasten/tests/test_dropbox.py index <HASH>..<HASH> 100644 --- a/application/briefkasten/tests/test_dropbox.py +++ b/application/briefkasten/tests/test_dropbox.py @@ -49,8 +49,8 @@ def test_dropbox_is_created_if_it_does_not_exist(): @fixture -def dropbox_without_attachment(dropbox_container): - return dropbox_container.add_dropbox(message=u'Schönen guten Tag!') +def dropbox_without_attachment(dropbox_container, drop_id): + return dropbox_container.add_dropbox(drop_id, message=u'Schönen guten Tag!') @fixture
add_dropbox now requires a pre-computed id
ZeitOnline_briefkasten
train
py
668420c7f286cc67e72239ee524aa2f29397a8c0
diff --git a/xblock/fields.py b/xblock/fields.py index <HASH>..<HASH> 100644 --- a/xblock/fields.py +++ b/xblock/fields.py @@ -438,7 +438,7 @@ class Dict(Field): if value is None or isinstance(value, dict): return value else: - raise TypeError('Value stored in a Dict must be None or a dict.') + raise TypeError('Value stored in a Dict must be None or a dict, found %s' % type(value)) class List(Field): @@ -453,7 +453,7 @@ class List(Field): if value is None or isinstance(value, list): return value else: - raise TypeError('Value stored in an List must be None or a list.') + raise TypeError('Value stored in an List must be None or a list, found %s' % type(value)) class String(Field): @@ -468,7 +468,7 @@ class String(Field): if value is None or isinstance(value, basestring): return value else: - raise TypeError('Value stored in a String must be None or a string.') + raise TypeError('Value stored in a String must be None or a string, found %s' % type(value)) class Any(Field):
Provide more information in some exceptions.
edx_XBlock
train
py
ecdf4240f1d7354e60ce906f1ba26945672a66ed
diff --git a/src/node_modules/base/model.js b/src/node_modules/base/model.js index <HASH>..<HASH> 100644 --- a/src/node_modules/base/model.js +++ b/src/node_modules/base/model.js @@ -6,9 +6,7 @@ var Model = require('ampersand-model'); module.exports = Model.extend({ - '@type': "Base", - - typeAttribute: "@type", + typeAttribute: "modelType", idAttribute: "@id", namespaceAttribute: "@graph",
typeAttribute is now the default modelType
holodex_app
train
js
da9f86f1a7764b50a03ee8fcd77d12a660c8b5b0
diff --git a/src/xterm.js b/src/xterm.js index <HASH>..<HASH> 100644 --- a/src/xterm.js +++ b/src/xterm.js @@ -1102,9 +1102,8 @@ line = this.lines[row]; out = ''; - if (y === this.y + if (this.y === y - (this.ybase - this.ydisp) && this.cursorState - && (this.ydisp === this.ybase) && !this.cursorHidden) { x = this.x; } else {
Draw cursor at correct position when scrolling Fixes #<I>
xtermjs_xterm.js
train
js
c8c6ec4c0db4774946b044e171ca7bd90b348aee
diff --git a/ctd/ctd.py b/ctd/ctd.py index <HASH>..<HASH> 100644 --- a/ctd/ctd.py +++ b/ctd/ctd.py @@ -12,6 +12,8 @@ # obs: New constructors and methods for pandas DataFrame and Series. # +# Standard library. +import warnings # Scientific stack. import numpy as np @@ -179,9 +181,9 @@ def from_cnv(fname, compression=None, below_water=False, lon=None, cast[column] = cast[column].astype(dtypes[column]) else: try: - cast[column] = np.float_(cast[column].astype(float)) + cast[column] = cast[column].astype(float) except ValueError: - print('Could not convert %s to float.' % column) + warnings.warn('Could not convert %s to float.' % column) if below_water: cast = remove_above_water(cast) return cast
Using warnings instead of print statements to show alerts. Fixed astype bug.
pyoceans_python-ctd
train
py
ae8bed5d809cf6cf1691fe1b16fe8935a7d632f5
diff --git a/Gruntfile.js b/Gruntfile.js index <HASH>..<HASH> 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -8,4 +8,5 @@ module.exports = function(grunt) { }); grunt.loadNpmTasks('grunt-fh-build'); + grunt.registerTask('default', ['fh:default']); };
[task]:RHMAP-<I> - Add default task which is missing
feedhenry_fh-mbaas-client
train
js
05be585022a45590a68b3b28f78179ab0d941106
diff --git a/lxd/backup/backup_instance.go b/lxd/backup/backup_instance.go index <HASH>..<HASH> 100644 --- a/lxd/backup/backup_instance.go +++ b/lxd/backup/backup_instance.go @@ -5,6 +5,7 @@ import ( "strings" "time" + "github.com/lxc/lxd/lxd/operations" "github.com/lxc/lxd/lxd/project" "github.com/lxc/lxd/lxd/state" "github.com/lxc/lxd/shared" @@ -16,6 +17,7 @@ import ( type Instance interface { Name() string Project() string + Operation() *operations.Operation } // InstanceBackup represents an instance backup. @@ -47,6 +49,11 @@ func (b *InstanceBackup) InstanceOnly() bool { return b.instanceOnly } +// Instance returns the instance to be backed up. +func (b *InstanceBackup) Instance() Instance { + return b.instance +} + // Rename renames an instance backup. func (b *InstanceBackup) Rename(newName string) error { oldBackupPath := shared.VarPath("backups", "instances", project.Instance(b.instance.Project(), b.name))
lxd/backup/backup/instance: expose instance interface
lxc_lxd
train
go
9539c43c7de96bde5e901a732d0786d5bb9e2595
diff --git a/src/Client.php b/src/Client.php index <HASH>..<HASH> 100644 --- a/src/Client.php +++ b/src/Client.php @@ -180,20 +180,22 @@ final class Client */ public function publish(string $uri, $obs, array $options = []): DisposableInterface { - $obs = $obs instanceof Observable ? $obs : Observable::just($obs); + $obs = $obs instanceof Observable ? $obs : Observable::of($obs); $completed = new Subject(); return $this->session ->takeUntil($completed) - ->mapTo($obs->doOnCompleted(function () use ($completed) { + ->mapTo($obs->finally(function () use ($completed) { $completed->onNext(0); })) ->switchFirst() ->map(function ($value) use ($uri, $options) { return new PublishMessage(Utils::getUniqueId(), (object)$options, $uri, [$value]); }) - ->subscribe($this->webSocket); + ->subscribe(function ($value) { + $this->webSocket->onNext($value); + }); } public function onChallenge(callable $challengeCallback)
Only subscribe onNext of websocket in pusblish
voryx_RxThruwayClient
train
php
decae0f07d337b6cd65ccdebad256bd171fdaba4
diff --git a/salt/cloud/clouds/vmware.py b/salt/cloud/clouds/vmware.py index <HASH>..<HASH> 100644 --- a/salt/cloud/clouds/vmware.py +++ b/salt/cloud/clouds/vmware.py @@ -1903,6 +1903,9 @@ def list_snapshots(kwargs=None, call=None): return {vm["name"]: _get_snapshots(vm["snapshot"].rootSnapshotList)} else: ret[vm["name"]] = _get_snapshots(vm["snapshot"].rootSnapshotList) + else: + if kwargs and kwargs.get('name') == vm["name"]: + return {} return ret
Update vmware.py if the vmname does't have any snapshot,it will return all snapshots on all vm that with snapshots. but it should return none.fix it
saltstack_salt
train
py
327768300eea8623c8e603aeac99038e607438b0
diff --git a/tests/test_sharding.py b/tests/test_sharding.py index <HASH>..<HASH> 100644 --- a/tests/test_sharding.py +++ b/tests/test_sharding.py @@ -14,7 +14,7 @@ logger = logging.getLogger(__name__) import tempfile -from lib import set_storage +from lib import set_storage, cleanup_storage from lib.shards import Shard, Shards from lib.hosts import Hosts from lib.process import PortPool, HOSTNAME @@ -42,7 +42,8 @@ class ShardsTestCase(unittest.TestCase): PortPool().change_range() def tearDown(self): - self.sh.cleanup() + # self.sh.cleanup() + cleanup_storage() if os.path.exists(self.db_path): os.remove(self.db_path)
use cleanup_storage function instead of sh.cleanup in tearDown
10gen_mongo-orchestration
train
py
2fd1fd9573c4e297ecbc45a0be184450fb034f75
diff --git a/matterclient/matterclient.go b/matterclient/matterclient.go index <HASH>..<HASH> 100644 --- a/matterclient/matterclient.go +++ b/matterclient/matterclient.go @@ -817,9 +817,14 @@ func (m *MMClient) StatusLoop() { backoff = time.Second * 60 case <-time.After(time.Second * 5): if retries > 3 { + m.log.Debug("StatusLoop() timeout") m.Logout() m.WsQuit = false - m.Login() + err := m.Login() + if err != nil { + log.Errorf("Login failed: %#v", err) + break + } if m.OnWsConnect != nil { m.OnWsConnect() }
Break when re-login fails (mattermost)
42wim_matterbridge
train
go
3fc00b05f3def0d54d5834ad72bf11e239dc8849
diff --git a/src/test/java/io/nats/client/NatsTestServer.java b/src/test/java/io/nats/client/NatsTestServer.java index <HASH>..<HASH> 100644 --- a/src/test/java/io/nats/client/NatsTestServer.java +++ b/src/test/java/io/nats/client/NatsTestServer.java @@ -165,6 +165,8 @@ public class NatsTestServer implements AutoCloseable { System.out.println("\t" + ex.getMessage()); System.out.println("%%% Make sure that gnatsd is installed and in your PATH."); System.out.println("%%% See https://github.com/nats-io/gnatsd for information on installing gnatsd"); + + throw new IllegalStateException("Failed to run [" + this.cmdLine +"]"); } }
Added illegalstate exception when test server can't run
nats-io_java-nats
train
java
484d638bb29467376a7db405af9c78412895fdd0
diff --git a/lib/cramp/action.rb b/lib/cramp/action.rb index <HASH>..<HASH> 100644 --- a/lib/cramp/action.rb +++ b/lib/cramp/action.rb @@ -112,7 +112,7 @@ module Cramp end def websockets_protocol_10? - [8, 9, 10].include?(@env['HTTP_SEC_WEBSOCKET_VERSION'].to_i) + [7, 8, 9, 10].include?(@env['HTTP_SEC_WEBSOCKET_VERSION'].to_i) end def protocol10_parser diff --git a/lib/cramp/websocket/extension.rb b/lib/cramp/websocket/extension.rb index <HASH>..<HASH> 100644 --- a/lib/cramp/websocket/extension.rb +++ b/lib/cramp/websocket/extension.rb @@ -10,7 +10,7 @@ module Cramp end def websocket? - @env['HTTP_CONNECTION'] == 'Upgrade' && ['WebSocket', 'websocket'].include?(@env['HTTP_UPGRADE']) + ['WebSocket', 'websocket'].include?(@env['HTTP_UPGRADE']) end def secure_websocket?
Firefox 6 websockets support
lifo_cramp
train
rb,rb
b9c1a467bfb507353c8f3f72b775de2e123af3f3
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -68,11 +68,6 @@ setup_requires = [ install_requires = [ 'Flask>=0.11.1', - # "requests" has hard version range dependency on "idna" and "urllib3" - # Every time "idna" and "urllib3" are updated, installation breaks because - # "requests" dependencies are not resolved properly. - 'urllib3<1.25,>=1.21.1', # from "requests" - 'idna>=2.5,<2.8', # from "requests" ] packages = find_packages()
installation: remove requests-related pins
inveniosoftware_invenio-search
train
py
0fbde7fa3599204ef82546bc4c465a26b14ec328
diff --git a/wsgiservice/resource.py b/wsgiservice/resource.py index <HASH>..<HASH> 100644 --- a/wsgiservice/resource.py +++ b/wsgiservice/resource.py @@ -207,7 +207,7 @@ class Resource(object): else: self.response.vary.append('Accept') types = [mime for ext, mime in self.EXTENSION_MAP] - return self.request.accept.first_match(types) + return self.request.accept.best_match(types) def handle_ignored_resources(self): """Ignore robots.txt and favicon.ico GET requests based on a list of
Replace first_match with best_match. first_match has been deprecated since WebOb <I>b1.
pneff_wsgiservice
train
py
67525d520a518e74921bad3baa5f5c250d4d5072
diff --git a/synapse/tests/test_lib_config.py b/synapse/tests/test_lib_config.py index <HASH>..<HASH> 100644 --- a/synapse/tests/test_lib_config.py +++ b/synapse/tests/test_lib_config.py @@ -115,8 +115,20 @@ class ConfTest(SynTest): with self.getTestDir() as fdir: fp0 = os.path.join(fdir, 'c0.json') fp1 = os.path.join(fdir, 'c1.json') + fpnull = os.path.join(fdir, 'null.json') + fpnewp = os.path.join(fdir, 'newp.json') jssave(config0, fp0) jssave(config1, fp1) + jssave(None, fpnull) + + with Foo() as conf: + conf.loadConfPath(fpnewp) + self.eq(conf.getConfOpt('enabled'), 0) + self.eq(conf.getConfOpt('fooval'), 99) + + conf.loadConfPath(fpnull) + self.eq(conf.getConfOpt('enabled'), 0) + self.eq(conf.getConfOpt('fooval'), 99) with Foo() as conf: conf.loadConfPath(fp0)
Add test coverage for loadConfPath
vertexproject_synapse
train
py
5418be07424cff6a268d5369fa0616fffe865105
diff --git a/src/main/java/org/jboss/remotingjmx/protocol/v2/ServerCommon.java b/src/main/java/org/jboss/remotingjmx/protocol/v2/ServerCommon.java index <HASH>..<HASH> 100644 --- a/src/main/java/org/jboss/remotingjmx/protocol/v2/ServerCommon.java +++ b/src/main/java/org/jboss/remotingjmx/protocol/v2/ServerCommon.java @@ -202,12 +202,40 @@ public abstract class ServerCommon extends Common { public void handleError(Channel channel, IOException error) { log.warn("Channel closing due to error", error); - end(); + executor.execute(new Runnable() { + @Override + public void run() { + try { + serverMessageInterceptor.handleEvent(new Event() { + @Override + public void run() { + end(); + } + }); + } catch (IOException e) { + log.error(e); + } + } + }); } @Override - public void handleEnd(Channel channel) { - end(); + public void handleEnd(final Channel channel) { + executor.execute(new Runnable() { + @Override + public void run() { + try { + serverMessageInterceptor.handleEvent(new Event() { + @Override + public void run() { + end(); + } + }); + } catch (IOException e) { + log.error(e); + } + } + }); } }
[REMJMX-<I>] Always reuse serverMessageInterceptor when closing channel so proper security identity is set up.
jbossas_remoting-jmx
train
java
f5f93a474959910231ffe243c72ad94d9ecf5784
diff --git a/src/main/java/com/squareup/thumbor/ThumborUrl.java b/src/main/java/com/squareup/thumbor/ThumborUrl.java index <HASH>..<HASH> 100644 --- a/src/main/java/com/squareup/thumbor/ThumborUrl.java +++ b/src/main/java/com/squareup/thumbor/ThumborUrl.java @@ -345,7 +345,12 @@ public final class ThumborUrl { // URL-safe Base64 encode. final String encoded = Utilities.base64Encode(encrypted); - return new StringBuilder(host).append("/").append(encoded).append("/").append(target).toString(); + return new StringBuilder(host) // + .append("/") // + .append(encoded) // + .append("/") // + .append(target) // + .toString(); } /**
Stylisting tweak to match other build methods.
square_pollexor
train
java
2bc394e2f652cc62cc9776529249d44135e54a53
diff --git a/metrics-core/src/main/java/com/codahale/metrics/Clock.java b/metrics-core/src/main/java/com/codahale/metrics/Clock.java index <HASH>..<HASH> 100644 --- a/metrics-core/src/main/java/com/codahale/metrics/Clock.java +++ b/metrics-core/src/main/java/com/codahale/metrics/Clock.java @@ -20,8 +20,6 @@ public abstract class Clock { return System.currentTimeMillis(); } - private static final Clock DEFAULT = new UserTimeClock(); - /** * The default clock to use. * @@ -29,7 +27,7 @@ public abstract class Clock { * @see Clock.UserTimeClock */ public static Clock defaultClock() { - return DEFAULT; + return UserTimeClockHolder.DEFAULT; } /** @@ -41,4 +39,8 @@ public abstract class Clock { return System.nanoTime(); } } + + private static class UserTimeClockHolder { + private static final Clock DEFAULT = new UserTimeClock(); + } }
Move the default UserTimeClock to a holder class This allows to avoid a deadlock when the user creates a new UserTimeClock by hand. By creating a holder class we defer the resolution of UserTimeClock class in the Clock class until the `defaultClock` method invocation, rather than classloading.
dropwizard_metrics
train
java
06e5b53a9b926d7e340588ab70e47a522fd01ab5
diff --git a/scapy/contrib/mpls.py b/scapy/contrib/mpls.py index <HASH>..<HASH> 100644 --- a/scapy/contrib/mpls.py +++ b/scapy/contrib/mpls.py @@ -17,7 +17,7 @@ from scapy.packet import Packet, bind_layers, Padding from scapy.fields import BitField, ByteField, ShortField -from scapy.layers.inet import IP +from scapy.layers.inet import IP, UDP from scapy.contrib.bier import BIER from scapy.layers.inet6 import IPv6 from scapy.layers.l2 import Ether, GRE @@ -63,6 +63,7 @@ class MPLS(Packet): bind_layers(Ether, MPLS, type=0x8847) +bind_layers(UDP, MPLS, dport=6635) bind_layers(GRE, MPLS, proto=0x8847) bind_layers(MPLS, MPLS, s=0) bind_layers(MPLS, EoMCW)
adding support for MPLS over UDP
secdev_scapy
train
py
cf0094187e356e9b762a1796b092734d4e30d654
diff --git a/spacy/cli/package.py b/spacy/cli/package.py index <HASH>..<HASH> 100644 --- a/spacy/cli/package.py +++ b/spacy/cli/package.py @@ -16,8 +16,8 @@ def package(input_dir, output_dir, force): check_dirs(input_path, output_path) template_setup = get_template('setup.py') + template_manifest = get_template('MANIFEST.in') template_init = get_template('en_model_name/__init__.py') - template_manifest = 'include meta.json' meta = generate_meta() model_name = meta['lang'] + '_' + meta['name']
Fetch MANIFEST.in from GitHub as well
explosion_spaCy
train
py
e75d10d6b7a547f5be7f8e0ce904baafba88c41b
diff --git a/cmd/influxd/launcher/query_test.go b/cmd/influxd/launcher/query_test.go index <HASH>..<HASH> 100644 --- a/cmd/influxd/launcher/query_test.go +++ b/cmd/influxd/launcher/query_test.go @@ -44,8 +44,8 @@ mem,server=b value=45.2`)) } rawQ := fmt.Sprintf(`from(bucket:"%s") - |> filter(fn: (r) => r._measurement == "cpu" and (r._field == "v1" or r._field == "v0")) |> range(start:-1m) + |> filter(fn: (r) => r._measurement == "cpu" and (r._field == "v1" or r._field == "v0")) `, be.Bucket.Name) // Expected keys:
test(launcher): fix ill-formatted query; range must come before filter Until <URL>
influxdata_influxdb
train
go
ff4835ec5c9d86579a0625b185671fa22444a771
diff --git a/src/main/java/com/thinkaurelius/faunus/formats/rexster/FaunusRexsterExtension.java b/src/main/java/com/thinkaurelius/faunus/formats/rexster/FaunusRexsterExtension.java index <HASH>..<HASH> 100644 --- a/src/main/java/com/thinkaurelius/faunus/formats/rexster/FaunusRexsterExtension.java +++ b/src/main/java/com/thinkaurelius/faunus/formats/rexster/FaunusRexsterExtension.java @@ -27,7 +27,7 @@ import java.io.OutputStream; @ExtensionNaming(namespace = FaunusRexsterExtension.EXTENSION_NAMESPACE, name = FaunusRexsterExtension.EXTENSION_NAME) public class FaunusRexsterExtension extends AbstractRexsterExtension { - public static final String EXTENSION_NAMESPACE = "aurelius"; + public static final String EXTENSION_NAMESPACE = "faunus"; public static final String EXTENSION_NAME = "v"; public static final byte[] LINE_BREAK = "\n".getBytes();
Changed namespace of kibble to 'faunus'
thinkaurelius_faunus
train
java
ed0294ae276d67d40cf43145178aeed134b27345
diff --git a/web/concrete/config/app.php b/web/concrete/config/app.php index <HASH>..<HASH> 100644 --- a/web/concrete/config/app.php +++ b/web/concrete/config/app.php @@ -234,10 +234,7 @@ if (!defined('UPLOAD_FILE_EXTENSIONS_ALLOWED')) { } else { define('UPLOAD_FILE_EXTENSIONS_CONFIGURABLE', false); } -<<<<<<< HEAD -======= if (!defined('SEO_EXCLUDE_WORDS')) { Config::getOrDefine('SEO_EXCLUDE_WORDS', 'a, an, as, at, before, but, by, for, from, is, in, into, like, of, off, on, onto, per, since, than, the, this, that, to, up, via, with'); -} ->>>>>>> 0a5729a... finished up the seo excluded words +} \ No newline at end of file
resolved cherry-pick conflict Former-commit-id: c2f<I>c<I>d6a<I>c9ad<I>b<I>c3c<I>d2f<I>f
concrete5_concrete5
train
php
d528fafe1d875e3c504066533e3dc21319e4d395
diff --git a/dingo/core/__init__.py b/dingo/core/__init__.py index <HASH>..<HASH> 100644 --- a/dingo/core/__init__.py +++ b/dingo/core/__init__.py @@ -692,6 +692,16 @@ class NetworkDingo: for grid_district in self.mv_grid_districts(): grid_district.mv_grid.routing(debug, anim) + def connect_generators(self, debug=False): + """ Connects MV generators (graph nodes) to grid (graph) for every MV grid district + + Args: + debug: If True, information is printed during process + """ + + for grid_district in self.mv_grid_districts(): + grid_district.mv_grid.connect_generators(debug) + def mv_parametrize_grid(self, debug=False): """ Performs Parametrization of grid equipment of all MV grids, see method `parametrize_grid()` in class `MVGridDingo` for details.
add call method for connecting generators to NetworkDingo class
openego_ding0
train
py
9b30525542044a71f2d99da7669fd52c59d20414
diff --git a/lib/Server.php b/lib/Server.php index <HASH>..<HASH> 100644 --- a/lib/Server.php +++ b/lib/Server.php @@ -329,6 +329,12 @@ class sspmod_openidProvider_Server { public function loadState($stateId) { assert('is_string($stateId)'); + // sanitize the input + $restartURL = SimpleSAML_Utilities::getURLFromStateID($stateId); + if (!is_null($restartURL)) { + SimpleSAML_Utilities::checkURLAllowed($restartURL); + } + return SimpleSAML_Auth_State::loadState($stateId, 'openidProvider:resumeState'); }
Followup on previous commits. Use redirectUntrustedURL() as a shortcut, and let everything else make use of redirectTrustedURL(). Move the responsibility to check the input out of the library, to the places where URLs are grabbed from input parameters. git-svn-id: <URL>
simplesamlphp_simplesamlphp-module-openidprovider
train
php
5f843feb90ddf10674f58cebfb52f9ee4b9b060f
diff --git a/lib/namespace.js b/lib/namespace.js index <HASH>..<HASH> 100644 --- a/lib/namespace.js +++ b/lib/namespace.js @@ -141,21 +141,25 @@ Namespace.prototype.add = function(client, fn){ var self = this; this.run(socket, function(err){ process.nextTick(function(){ - if (err) return socket.err(err.data || err.message); - - // track socket - self.sockets.push(socket); - - // it's paramount that the internal `onconnect` logic - // fires before user-set events to prevent state order - // violations (such as a disconnection before the connection - // logic is complete) - socket.onconnect(); - if (fn) fn(); - - // fire user-set events - self.emit('connect', socket); - self.emit('connection', socket); + if ('open' == client.conn.readyState) { + if (err) return socket.error(err.data || err.message); + + // track socket + self.sockets.push(socket); + + // it's paramount that the internal `onconnect` logic + // fires before user-set events to prevent state order + // violations (such as a disconnection before the connection + // logic is complete) + socket.onconnect(); + if (fn) fn(); + + // fire user-set events + self.emit('connect', socket); + self.emit('connection', socket); + } else { + debug('next called after client was closed - ignoring socket'); + } }); }); return socket;
namespace: make sure not to fire `connection` if underlying client closed after `next` is called from a middleware
socketio_socket.io
train
js
f28fe326a93c12bdd42b771b291b1ebe6ded86c4
diff --git a/.karma.conf.js b/.karma.conf.js index <HASH>..<HASH> 100644 --- a/.karma.conf.js +++ b/.karma.conf.js @@ -77,6 +77,31 @@ module.exports = function (config) { // { type: 'text', subdir: '.', file: 'text.txt' }, { type: 'text-summary', subdir: '.', file: 'text-summary.txt' }, ], + check: { + global: { + statements: 75, + branches: 55, + functions: 75, + lines: 75, + excludes: [ + 'foo/bar/**/*.js' + ] + }, + // each: { + // statements: 50, + // branches: 50, + // functions: 50, + // lines: 50, + // excludes: [ + // 'other/directory/**/*.js' + // ], + // overrides: { + // 'baz/component/**/*.js': { + // statements: 98 + // } + // } + // } + }, watermarks: { statements: [70, 75], functions: [70, 75],
test(.karma.conf.js): added code coverage check
RentDynamics_ng-core
train
js
09cfd93db14659ebb6c1fb5259c1d6508cb80cf7
diff --git a/Connection.php b/Connection.php index <HASH>..<HASH> 100644 --- a/Connection.php +++ b/Connection.php @@ -424,7 +424,10 @@ class Connection extends Component CURLOPT_RETURNTRANSFER => false, CURLOPT_HEADER => false, // http://www.php.net/manual/en/function.curl-setopt.php#82418 - CURLOPT_HTTPHEADER => ['Expect:'], + CURLOPT_HTTPHEADER => [ + 'Expect:', + 'Content-Type: application/json', + ], CURLOPT_WRITEFUNCTION => function ($curl, $data) use (&$body) { $body .= $data;
<I> (#<I>) * support "gt", ">", "lt", "<", "gte", ">=", "lte" and "<=" operator * reset the curl post fields and post method when resetting the curl handler * Remove deprecated warning "Content type detection for rest requests is deprecated. Specify the content type using the [Content-Type] header"
yiisoft_yii2-elasticsearch
train
php
5e19f7789a4992ffd4deae3879e2dc04b430ab0e
diff --git a/generators/heroku/index.js b/generators/heroku/index.js index <HASH>..<HASH> 100644 --- a/generators/heroku/index.js +++ b/generators/heroku/index.js @@ -191,28 +191,7 @@ module.exports = class extends BaseBlueprintGenerator { type: 'list', name: 'herokuJavaVersion', message: 'Which Java version would you like to use to build and run your app ?', - choices: [ - { - value: '1.8', - name: '1.8', - }, - { - value: '11', - name: '11', - }, - { - value: '12', - name: '12', - }, - { - value: '13', - name: '13', - }, - { - value: '14', - name: '14', - }, - ], + choices: constants.JAVA_COMPATIBLE_VERSIONS.map(version => ({ value: version })), default: 1, }, ];
support jdk<I> with heroku sub gen
jhipster_generator-jhipster
train
js
2fd888ac9d2e94c4c5eb7aaf26dda376b44b6bd3
diff --git a/python/ray/tests/test_advanced_9.py b/python/ray/tests/test_advanced_9.py index <HASH>..<HASH> 100644 --- a/python/ray/tests/test_advanced_9.py +++ b/python/ray/tests/test_advanced_9.py @@ -186,6 +186,10 @@ def test_function_table_gc_actor(call_ray_start): wait_for_condition(lambda: function_entry_num(job_id) == 0) +@pytest.mark.skipif( + sys.platform != "linux", + reason="This test is only run on linux machines.", +) def test_worker_oom_score(shutdown_only): @ray.remote def get_oom_score():
[core] Skip windows test for adjusting worker OOM score (#<I>) Fixes CI failure introduced in #<I>.
ray-project_ray
train
py
f80b39f69d97a52bee5887b6b13de8c5f26ef7fe
diff --git a/werkzeug/serving.py b/werkzeug/serving.py index <HASH>..<HASH> 100644 --- a/werkzeug/serving.py +++ b/werkzeug/serving.py @@ -481,7 +481,7 @@ def run_simple(hostname, port, application, use_reloader=False, from werkzeug.debug import DebuggedApplication application = DebuggedApplication(application, use_evalex) if static_files: - from werkzeug.utils import SharedDataMiddleware + from werkzeug.wsgi import SharedDataMiddleware application = SharedDataMiddleware(application, static_files) def inner():
Fixed an import error in the serving support. This fixes #<I>
pallets_werkzeug
train
py
2284910819d8fb0a0aa709a906ffb6375ce7e41b
diff --git a/bolt/spark.py b/bolt/spark.py index <HASH>..<HASH> 100644 --- a/bolt/spark.py +++ b/bolt/spark.py @@ -41,20 +41,27 @@ class BoltArraySpark(BoltArray): Functional operators """ - # TODO make sure that operation preserves shape + # TODO handle shape changes + # TODO add axes def map(self, func): return self._constructor(self._rdd.mapValues(func)).__finalize__(self) + # TODO add axes def reduce(self, func): return self._constructor(self._rdd.values().reduce(func)).__finalize__(self) """ - Basic array operators + Reductions """ + # TODO add axes def sum(self, axis=0): return self._constructor(self._rdd.sum()).__finalize__(self) + """ + Slicing and indexing + """ + def __getitem__(self): pass
Add todos and reorganize
bolt-project_bolt
train
py
7d5ef304fd369f8d08cba99c2fd03a18b699329b
diff --git a/modules/activiti-engine/src/test/java/org/activiti/engine/test/bpmn/mail/EmailTestCase.java b/modules/activiti-engine/src/test/java/org/activiti/engine/test/bpmn/mail/EmailTestCase.java index <HASH>..<HASH> 100644 --- a/modules/activiti-engine/src/test/java/org/activiti/engine/test/bpmn/mail/EmailTestCase.java +++ b/modules/activiti-engine/src/test/java/org/activiti/engine/test/bpmn/mail/EmailTestCase.java @@ -37,7 +37,7 @@ public class EmailTestCase extends PluggableActivitiTestCase { wiser.start(); serverUpAndRunning = true; } catch (RuntimeException e) { // Fix for slow port-closing Jenkins - if (e.getMessage().toLowerCase().contains("BindException")) { + if (e.getMessage().toLowerCase().contains("bindexception")) { Thread.sleep(250L); } }
(possible) fix for failing email tests
Activiti_Activiti
train
java
64ba7991f4b6037d0f7548e955e0cfa1d96c83e7
diff --git a/consul/mdb_table.go b/consul/mdb_table.go index <HASH>..<HASH> 100644 --- a/consul/mdb_table.go +++ b/consul/mdb_table.go @@ -28,12 +28,19 @@ const ( using a row id, while maintaining any number of secondary indexes. */ type MDBTable struct { - lastRowID uint64 // Last used rowID - Env *mdb.Env - Name string // This is the name of the table, must be unique - Indexes map[string]*MDBIndex - Encoder func(interface{}) []byte - Decoder func([]byte) interface{} + Env *mdb.Env + Name string // This is the name of the table, must be unique + Indexes map[string]*MDBIndex + Encoder func(interface{}) []byte + Decoder func([]byte) interface{} + + // NotifyGroup is created in init, it can be used to + // watch a table for changes. It is not invoked internally, + // but can be used by clients of the table. + NotifyGroup *NotifyGroup + + // Last used rowID + lastRowID uint64 } // MDBTables is used for when we have a collection of tables @@ -97,6 +104,9 @@ func (t *MDBTable) Init() error { return fmt.Errorf("Missing table indexes") } + // Create the notify group + t.NotifyGroup = &NotifyGroup{} + // Ensure we have a unique id index id, ok := t.Indexes["id"] if !ok {
consul: Add a NotifyGroup to the MDBTable
hashicorp_consul
train
go
15b0f6838f5a321916d694bd5de79f84ada1f503
diff --git a/isort/settings.py b/isort/settings.py index <HASH>..<HASH> 100644 --- a/isort/settings.py +++ b/isort/settings.py @@ -402,7 +402,7 @@ def file_should_be_skipped( position = os.path.split(position[0]) for glob in config['skip_glob']: - if fnmatch.fnmatch(filename, glob): + if fnmatch.fnmatch(filename, glob) or fnmatch.fnmatch('/' + filename, glob): return True if not (os.path.isfile(os_path) or os.path.isdir(os_path) or os.path.islink(os_path)):
Fix issue with */ style glob tests
timothycrosley_isort
train
py
f6dd07f05b39e8444337220957d148812a1e686d
diff --git a/pywws/Plot.py b/pywws/Plot.py index <HASH>..<HASH> 100755 --- a/pywws/Plot.py +++ b/pywws/Plot.py @@ -486,7 +486,7 @@ class BasePlotter(object): self.plot_count = len(plot_list) if self.plot_count < 1: # nothing to plot - self.logger.error('%s has no plot nodes' % input_file) + self.logger.info('%s has no plot nodes' % input_file) self.doc.unlink() return 1 # get start and end datetimes diff --git a/pywws/version.py b/pywws/version.py index <HASH>..<HASH> 100644 --- a/pywws/version.py +++ b/pywws/version.py @@ -1,3 +1,3 @@ version = '13.08' -release = '1049' -commit = '2bc66e7' +release = '1050' +commit = '05c221c'
Reduce "no plot nodes" message from error to info The pywws.Tasks module always tries graph templates as plots first, before trying them as wind roses if the plot failed. This was generating spurious error messages for a situation that isn't really an error.
jim-easterbrook_pywws
train
py,py
2689f26434a23cf81e72c2ca6320f46d092bc22b
diff --git a/bokeh/server/application_context.py b/bokeh/server/application_context.py index <HASH>..<HASH> 100644 --- a/bokeh/server/application_context.py +++ b/bokeh/server/application_context.py @@ -7,6 +7,7 @@ import logging log = logging.getLogger(__name__) from .session import ServerSession +from .exceptions import ProtocolError class ApplicationContext(object): ''' Server-side holder for bokeh.application.Application plus any associated data.
Add missing import to server/application_context.py This was only apparent when an error was raised.
bokeh_bokeh
train
py
d242242849e0607ac24a66225e2d466c2623477d
diff --git a/labm8/py/dockerutil.py b/labm8/py/dockerutil.py index <HASH>..<HASH> 100644 --- a/labm8/py/dockerutil.py +++ b/labm8/py/dockerutil.py @@ -166,7 +166,9 @@ class BazelPy3Image(object): subprocess.check_call( _Docker(["tag", self.image_name, tmp_name], timeout=60), ) - subprocess.check_call(_Docker(["rmi", self.image_name], timeout=60)) + subprocess.check_call( + _Docker(["rmi", "--force", self.image_name], timeout=60) + ) yield DockerImageRunContext(tmp_name) # FIXME(cec): Using the --force flag here is almost certainly the wrong # thing, but I'm getting strange errors when trying to untag the image
Force removal of docker image. github.com/ChrisCummins/phd/issues/<I>
ChrisCummins_labm8
train
py
23337a993df1cdf8e57ae419c7441f7323b74a87
diff --git a/lib/yard/generators/class_generator.rb b/lib/yard/generators/class_generator.rb index <HASH>..<HASH> 100644 --- a/lib/yard/generators/class_generator.rb +++ b/lib/yard/generators/class_generator.rb @@ -1,6 +1,8 @@ module YARD module Generators class ClassGenerator < Base + before_generate :is_class? + def sections_for(object) [ :header, @@ -11,9 +13,8 @@ module YARD AttributesGenerator, ConstantsGenerator, ConstructorGenerator, - MethodSummaryGenerator.new(options, :ignore_serializer => true, - :scope => :instance, :visibility => :public - ) + G(MethodSummaryGenerator, :scope => :instance, :visibility => :public), + G(MethodDetailsGenerator, :scope => :instance, :visibility => :public) ] ] end
Add visibility grouping generators to class generator
lsegal_yard
train
rb
e4a84bea99926e855d662e130c59a9f6b28106b8
diff --git a/libcontainer/cgroups/systemd/v2.go b/libcontainer/cgroups/systemd/v2.go index <HASH>..<HASH> 100644 --- a/libcontainer/cgroups/systemd/v2.go +++ b/libcontainer/cgroups/systemd/v2.go @@ -53,6 +53,10 @@ func genV2ResourcesProperties(c *configs.Cgroup) ([]systemdDbus.Property, error) properties = append(properties, newProp("MemoryMax", uint64(c.Resources.Memory))) } + if c.Resources.MemoryReservation != 0 { + properties = append(properties, + newProp("MemoryLow", uint64(c.Resources.MemoryReservation))) + } // swap is set if c.Resources.MemorySwap != 0 { swap, err := cgroups.ConvertMemorySwapToCgroupV2Value(c.Resources.MemorySwap, c.Resources.Memory)
cgroupv2+systemd: set MemoryLow For some reason, this was not set before. Test case is added by the next commit.
opencontainers_runc
train
go
25023e75157b8e1ff324bcea44f4494766a8a7d8
diff --git a/eventsourcing/examples/test_parking_lot.py b/eventsourcing/examples/test_parking_lot.py index <HASH>..<HASH> 100644 --- a/eventsourcing/examples/test_parking_lot.py +++ b/eventsourcing/examples/test_parking_lot.py @@ -17,10 +17,10 @@ from eventsourcing.system import NotificationLogReader @dataclass class LicencePlate: number: str + regex = re.compile("^[0-9]{3}-[0-9]{3}$") def __post_init__(self) -> None: - regex = re.compile("^[0-9]{3}-[0-9]{3}$") - if not bool(regex.match(self.number)): + if not bool(self.regex.match(self.number)): raise ValueError()
Moved regex to be a class attribute.
johnbywater_eventsourcing
train
py
e6ed7e68b1e0605af003c8ca06641f2db6298b11
diff --git a/core/server/src/main/java/alluxio/master/file/FileSystemMaster.java b/core/server/src/main/java/alluxio/master/file/FileSystemMaster.java index <HASH>..<HASH> 100644 --- a/core/server/src/main/java/alluxio/master/file/FileSystemMaster.java +++ b/core/server/src/main/java/alluxio/master/file/FileSystemMaster.java @@ -1987,7 +1987,7 @@ public final class FileSystemMaster extends AbstractMaster { try { return loadMetadataAndJournal(inodePath, options); } catch (Exception e) { - // NOTE, this may be expected when client tries to get info (e.g. exisits()) for a file + // NOTE, this may be expected when client tries to get info (e.g. exists()) for a file // existing neither in Alluxio nor UFS. LOG.debug("Failed to load metadata for path from UFS: {}", inodePath.getUri()); }
Update the comment in loadMetadataIfNotExistAndJournal from exisits to exists.
Alluxio_alluxio
train
java