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
d004c4adcd7ef66ec0da3a5304d292f60655fd58
diff --git a/user/profile/field/menu/field.class.php b/user/profile/field/menu/field.class.php index <HASH>..<HASH> 100644 --- a/user/profile/field/menu/field.class.php +++ b/user/profile/field/menu/field.class.php @@ -16,6 +16,9 @@ class profile_field_menu extends profile_field_base { /// Param 1 for menu type is the options $options = explode("\n", $this->field->param1); $this->options = array(); + if ($this->field->required){ + $this->options[''] = get_string('choose').'...'; + } foreach($options as $key => $option) { $this->options[$key] = format_string($option);//multilang formatting } @@ -40,7 +43,11 @@ class profile_field_menu extends profile_field_base { * Overwrites the base class method */ function edit_field_set_default(&$mform) { - $defaultkey = (int)array_search($this->field->defaultdata, $this->options); + if (FALSE !==array_search($this->field->defaultdata, $this->options)){ + $defaultkey = (int)array_search($this->field->defaultdata, $this->options); + } else { + $defaultkey = ''; + } $mform->setDefault($this->inputname, $defaultkey); }
MDL-<I> "'Required' does nothing for select fields in customisable user profiles" added an extra option 'Choose...' which is the default if no other default is specified. If the user leaves the select field set to 'Choose...' then the required rule fails and the form does not submit.
moodle_moodle
train
php
99e7ca4f01738df8a0d994f04e6cc05f8bd51c5e
diff --git a/usb/usb.go b/usb/usb.go index <HASH>..<HASH> 100644 --- a/usb/usb.go +++ b/usb/usb.go @@ -15,7 +15,7 @@ // Package usb provides a wrapper around libusb-1.0. // -// Note that this package was deprecated in favor of github.com/google/gousb. +// Deprecated: this package was deprecated in favor of github.com/google/gousb. // Please use the new package when starting new projects. package usb
Add a properly formatted deprecation comment, triggering lint warnings.
kylelemons_gousb
train
go
810260d7b9c6262e1237134bb801302a77424e87
diff --git a/oryx-ml-mllib/src/test/java/com/cloudera/oryx/ml/mllib/als/ALSModelContentIT.java b/oryx-ml-mllib/src/test/java/com/cloudera/oryx/ml/mllib/als/ALSModelContentIT.java index <HASH>..<HASH> 100644 --- a/oryx-ml-mllib/src/test/java/com/cloudera/oryx/ml/mllib/als/ALSModelContentIT.java +++ b/oryx-ml-mllib/src/test/java/com/cloudera/oryx/ml/mllib/als/ALSModelContentIT.java @@ -64,7 +64,7 @@ public final class ALSModelContentIT extends AbstractALSIT { config, generator, generator.getSentData().size(), - 10); + 100); Collection<Integer> modelUsers = null; Collection<Integer> modelItems = null;
Increase interval to avoid spurious test errors in ALSModelContentIT
OryxProject_oryx
train
java
84bede1effec40e63c8ba3baf79a7b8dcea85510
diff --git a/osmdroid-android/src/main/java/org/osmdroid/views/MapController.java b/osmdroid-android/src/main/java/org/osmdroid/views/MapController.java index <HASH>..<HASH> 100644 --- a/osmdroid-android/src/main/java/org/osmdroid/views/MapController.java +++ b/osmdroid-android/src/main/java/org/osmdroid/views/MapController.java @@ -266,6 +266,13 @@ public class MapController implements IMapController, MapViewConstants { mCurrentAnimator = null; } mMapView.mIsAnimating.set(false); + + // Fix for issue 477 + if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.GINGERBREAD_MR1) { + mMapView.clearAnimation(); + mZoomInAnimationOld.reset(); + mZoomOutAnimationOld.reset(); + } } protected class MyZoomAnimatorListener extends AnimatorListenerAdapter {
Update issue <I> Add fix for API <= <I> and zoom animation.
osmdroid_osmdroid
train
java
177ac7bd399a6d13d64826bfaab3c70e84b85c2b
diff --git a/tests/MetaModels/Test/Helper/ToolBoxFileTest.php b/tests/MetaModels/Test/Helper/ToolBoxFileTest.php index <HASH>..<HASH> 100644 --- a/tests/MetaModels/Test/Helper/ToolBoxFileTest.php +++ b/tests/MetaModels/Test/Helper/ToolBoxFileTest.php @@ -3,7 +3,7 @@ /** * This file is part of MetaModels/core. * - * (c) 2012-2015 The MetaModels team. + * (c) 2012-2017 The MetaModels team. * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -13,7 +13,8 @@ * @package MetaModels * @subpackage Core * @author Christian Schiffler <c.schiffler@cyberspectrum.de> - * @copyright 2012-2015 The MetaModels team. + * @author Richard Henkenjohann <richardhenkenjohann@googlemail.com> + * @copyright 2012-2017 The MetaModels team. * @license https://github.com/MetaModels/core/blob/master/LICENSE LGPL-3.0 * @filesource */ @@ -40,7 +41,8 @@ class ToolBoxFileTest extends TestCase $emptyExpected = array( 'bin' => array(), 'value' => array(), - 'path' => array() + 'path' => array(), + 'meta' => array() ); $this->assertEquals($emptyExpected, ToolboxFile::convertUuidsOrPathsToMetaModels(null));
Respect the "meta" array in the ToolboxFileTest. Changes made via #<I>
MetaModels_core
train
php
86198852a5e4a89aa5d620b3f000534183075172
diff --git a/djangocms_text_ckeditor/html.py b/djangocms_text_ckeditor/html.py index <HASH>..<HASH> 100644 --- a/djangocms_text_ckeditor/html.py +++ b/djangocms_text_ckeditor/html.py @@ -38,6 +38,7 @@ def extract_images(data, plugin): tree_builder = html5lib.treebuilders.getTreeBuilder('dom') parser = html5lib.html5parser.HTMLParser(tree = tree_builder) dom = parser.parse(data) + found = False for img in dom.getElementsByTagName('img'): src = img.getAttribute('src') if not src.startswith('data:'): @@ -81,7 +82,11 @@ def extract_images(data, plugin): new_img_html = plugin_to_tag(image_plugin) # replace the original image node with the newly created cms plugin html img.parentNode.replaceChild(parser.parseFragment(new_img_html).childNodes[0], img) - return u''.join([y.toxml() for y in dom.getElementsByTagName('body')[0].childNodes]) + found = True + if found: + return u''.join([y.toxml() for y in dom.getElementsByTagName('body')[0].childNodes]) + else: + return data def img_data_to_plugin(filename, image, parent_plugin, width=None, height=None):
fixed further tests for <I>
divio_djangocms-text-ckeditor
train
py
0550c48c396e33ee81f3fcbd7904d589fdc48945
diff --git a/lib/player.js b/lib/player.js index <HASH>..<HASH> 100644 --- a/lib/player.js +++ b/lib/player.js @@ -3567,7 +3567,7 @@ shaka.Player.prototype.getSelectableText_ = function() { }; /** - * Get the period that is on the screen. This will return |null| is nothing + * Get the period that is on the screen. This will return |null| if nothing * is loaded. * * @return {?shaka.extern.Period}
Correct Type in Comment On getPresentationPeriod_ "is" was used where we likely meant "if". Change-Id: I<I>f<I>a4b9eb<I>a7e<I>ff<I>d<I>fc<I>f
google_shaka-player
train
js
98dc1b5e360ddf3279d169c4099d3fe186ab5be1
diff --git a/src/server/pachyderm_test.go b/src/server/pachyderm_test.go index <HASH>..<HASH> 100644 --- a/src/server/pachyderm_test.go +++ b/src/server/pachyderm_test.go @@ -2867,6 +2867,18 @@ func TestChainedPipelines(t *testing.T) { require.Equal(t, 2, len(results)) } +func TestFlushCommitReturnsFromCommit(t *testing.T) { + c := getPachClient(t) + repo := uniqueString("TestFlushCommitReturnsFromCommit") + require.NoError(t, c.CreateRepo(repo)) + _, err := c.StartCommit(repo, "", "master") + require.NoError(t, err) + require.NoError(t, c.FinishCommit(repo, "master")) + commitInfos, err := c.FlushCommit([]*pfsclient.Commit{client.NewCommit(repo, "master")}, nil) + require.NoError(t, err) + require.Equal(t, 1, len(commitInfos)) +} + func getPachClient(t testing.TB) *client.APIClient { client, err := client.NewFromAddress("0.0.0.0:30650") require.NoError(t, err)
Adds a (failing) test for FlushCommit.
pachyderm_pachyderm
train
go
ec52ad0a8d4091756225aff6880064f93f799b2e
diff --git a/discord_test.go b/discord_test.go index <HASH>..<HASH> 100644 --- a/discord_test.go +++ b/discord_test.go @@ -15,10 +15,10 @@ var ( envToken = os.Getenv("DG_TOKEN") // Token to use when authenticating envEmail = os.Getenv("DG_EMAIL") // Email to use when authenticating envPassword = os.Getenv("DG_PASSWORD") // Password to use when authenticating - envGuild = os.Getenv("DG_GUILD") // Guild ID to use for tests - envChannel = os.Getenv("DG_CHANNEL") // Channel ID to use for tests - envUser = os.Getenv("DG_USER") // User ID to use for tests - envAdmin = os.Getenv("DG_ADMIN") // User ID of admin user to use for tests + // envGuild = os.Getenv("DG_GUILD") // Guild ID to use for tests + envChannel = os.Getenv("DG_CHANNEL") // Channel ID to use for tests + // envUser = os.Getenv("DG_USER") // User ID to use for tests + envAdmin = os.Getenv("DG_ADMIN") // User ID of admin user to use for tests ) func init() {
Commented out two unused envars
bwmarrin_discordgo
train
go
77921e919889dbc3e328a04b66e69c5b1085266b
diff --git a/tests/Gliph/Graph/DirectedAdjacencyGraphTest.php b/tests/Gliph/Graph/DirectedAdjacencyGraphTest.php index <HASH>..<HASH> 100644 --- a/tests/Gliph/Graph/DirectedAdjacencyGraphTest.php +++ b/tests/Gliph/Graph/DirectedAdjacencyGraphTest.php @@ -75,4 +75,13 @@ class DirectedAdjacencyGraphTest extends AdjacencyGraphTest { $this->assertEquals(array($this->v['a'], $this->v['c']), $found[1]); } + public function testTranspose() { + $this->g->addDirectedEdge($this->v['a'], $this->v['b']); + $this->g->addDirectedEdge($this->v['a'], $this->v['c']); + + $transpose = $this->g->transpose(); + + $this->doCheckVertexCount(3, $transpose); + $this->doCheckVerticesEqual(array($this->v['b'], $this->v['a'], $this->v['c']), $transpose); + } }
Test transposition on DirectedAdjacencyGraph
sdboyer_gliph
train
php
322454e8e511eae6c471e2aacf08175a100b5999
diff --git a/spiketoolkit/preprocessing/basepreprocessorrecording.py b/spiketoolkit/preprocessing/basepreprocessorrecording.py index <HASH>..<HASH> 100644 --- a/spiketoolkit/preprocessing/basepreprocessorrecording.py +++ b/spiketoolkit/preprocessing/basepreprocessorrecording.py @@ -13,7 +13,12 @@ class BasePreprocessorRecordingExtractor(RecordingExtractor): self._recording = recording self.copy_channel_properties(recording) self.copy_epochs(recording) + self.copy_timestamps(recording) self.is_filtered = self._recording.is_filtered + if hasattr(self._recording, "has_unscaled"): + self.has_unscaled = self._recording.has_unscaled + else: + self.has_unscaled = False def get_channel_ids(self): return self._recording.get_channel_ids()
Add has_unscaled to base preprocessor
SpikeInterface_spiketoolkit
train
py
507ab7941d5c04b8029b254a26ae27630b9f5ae8
diff --git a/src/Request.php b/src/Request.php index <HASH>..<HASH> 100644 --- a/src/Request.php +++ b/src/Request.php @@ -138,16 +138,16 @@ class Request implements JsonSerializable { 'SCRIPT_NAME' => '', 'PATH_INFO' => '/', 'EXT' => '', - 'QUERY' => array(), + 'QUERY' => [], 'SERVER_NAME' => 'localhost', 'SERVER_PORT' => 80, 'HTTP_ACCEPT' => 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', 'HTTP_ACCEPT_LANGUAGE' => 'en-US,en;q=0.8', 'HTTP_ACCEPT_CHARSET' => 'ISO-8859-1,utf-8;q=0.7,*;q=0.3', - 'HTTP_USER_AGENT' => 'Vanilla Framework', + 'HTTP_USER_AGENT' => 'Garden/0.1 (Howdy stranger)', 'REMOTE_ADDR' => '127.0.0.1', 'URL_SCHEME' => 'http', - 'INPUT' => array(), + 'INPUT' => [], ); }
Change the default environment on the Request class.
vanilla_garden
train
php
b4b144edb3db04dced5e09502555cdaf14b17a8a
diff --git a/voice.go b/voice.go index <HASH>..<HASH> 100644 --- a/voice.go +++ b/voice.go @@ -32,7 +32,8 @@ type Voice struct { Ready bool // If true, voice is ready to send/receive audio Debug bool // If true, print extra logging OP2 *voiceOP2 // exported for dgvoice, may change. - Opus chan []byte // Chan for sending opus audio + OpusSend chan []byte // Chan for sending opus audio + OpusRecv chan []byte // Chan for receiving opus audio // FrameRate int // This can be used to set the FrameRate of Opus data // FrameSize int // This can be used to set the FrameSize of Opus data @@ -185,8 +186,8 @@ func (v *Voice) wsEvent(messageType int, message []byte) { // Start the opusSender. // TODO: Should we allow 48000/960 values to be user defined? - v.Opus = make(chan []byte, 2) - go v.opusSender(v.Opus, 48000, 960) + v.OpusSend = make(chan []byte, 2) + go v.opusSender(v.OpusSend, 48000, 960) return
Renamed Opus chan to OpusSend and added OpusRecv
bwmarrin_discordgo
train
go
80f109a3532de79a85b6564dbef1ee537c965da0
diff --git a/classes/phing/TaskAdapter.php b/classes/phing/TaskAdapter.php index <HASH>..<HASH> 100755 --- a/classes/phing/TaskAdapter.php +++ b/classes/phing/TaskAdapter.php @@ -57,6 +57,8 @@ class TaskAdapter extends Task if (method_exists($this->proxy, "main")) { try { //try to call main $this->proxy->main($this->project); + } catch (BuildException $be) { + throw $be; } catch (Exception $ex) { $this->log("Error in " . get_class($this->proxy), Project::MSG_ERR); throw new BuildException("Error in " . get_class($this->proxy), $ex);
Refs #<I> - rethrow build exceptions (makes if task less chatty)
phingofficial_phing
train
php
e1d62cee1efa5029ef58909dee2f3c26e60ec929
diff --git a/src/config/hisite.php b/src/config/hisite.php index <HASH>..<HASH> 100644 --- a/src/config/hisite.php +++ b/src/config/hisite.php @@ -49,7 +49,9 @@ return [ \hiqdev\thememanager\menus\AbstractSidebarMenu::class => [ 'add' => [ 'hosting' => [ - 'menu' => \hipanel\modules\hosting\menus\SidebarMenu::class, + 'menu' => [ + 'class' => \hipanel\modules\hosting\menus\SidebarMenu::class, + ], 'where' => [ 'after' => ['servers', 'domains', 'tickets', 'finance', 'clients', 'dashboard'], 'before' => ['stock'],
Added DNS to sidebar sub menu
hiqdev_hipanel-module-hosting
train
php
b77844a9b28c3e89b9e741b2b4aab32a4fd09816
diff --git a/toml.py b/toml.py index <HASH>..<HASH> 100644 --- a/toml.py +++ b/toml.py @@ -283,13 +283,15 @@ def dumps(o): def dump_sections(o, sup): retstr = "" + if sup != "" and sup[-1] != ".": + sup += '.' retdict = {} for section in o: if not isinstance(o[section], dict): if isinstance(o[section], list) and isinstance(o[section][0], dict): for a in o[section]: - retstr += "[["+sup+"."+section+"]]\n" - s, d = dump_sections(a, sup+"."+section) + retstr += "[["+sup+section+"]]\n" + s, d = dump_sections(a, sup+section) if s: retstr += s else:
Fix bug with leading dot in array of tables name
uiri_toml
train
py
2c2d95f79062349fbca9f716afbab831c55a50f3
diff --git a/docs/conf.py b/docs/conf.py index <HASH>..<HASH> 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -43,6 +43,9 @@ class Mock(MagicMock): MOCK_MODULES = [ 'boto', 'boto.utils', + 'storages', + 'storages.backends', + 'storages.backends.s3boto', ] for mod_name in MOCK_MODULES:
Add storages to the shimlist
wooey_Wooey
train
py
57557083321526e77bb5ac3480564f125e960851
diff --git a/scss/__init__.py b/scss/__init__.py index <HASH>..<HASH> 100644 --- a/scss/__init__.py +++ b/scss/__init__.py @@ -1648,10 +1648,14 @@ try: import cStringIO as StringIO except: import StringIO + try: from PIL import Image, ImageDraw except ImportError: - Image = None + try: + import Image, ImageDraw + except: + Image = None ################################################################################ @@ -4352,6 +4356,7 @@ def eval_expr(expr, rule, raw=False): raise except: if not DEBUG: + log.exception("Exception!") return#@@@# raise __doc__ = """
Try importing PIL from alternative path. log exceptions.
Kronuz_pyScss
train
py
bb4785a200d14c05b13b31c36ebe39c632b94911
diff --git a/services/personality_insights/v2.js b/services/personality_insights/v2.js index <HASH>..<HASH> 100644 --- a/services/personality_insights/v2.js +++ b/services/personality_insights/v2.js @@ -20,17 +20,9 @@ var extend = require('extend'); var requestFactory = require('../../lib/requestwrapper'); var pick = require('object.pick'); var omit = require('object.omit'); +var herper = require('../../lib/helper'); -/** - * Return true if 'text' is html - * @param {String} text The 'text' to analyze - * @return {Boolean} true if 'text' has html tags - */ -function isHTML(text){ - return /<[a-z][\s\S]*>/i.test(text); -} - function PersonalityInsights(options) { // Default URL var serviceDefaults = { @@ -62,7 +54,7 @@ PersonalityInsights.prototype.profile = function(params, callback) { // Content-Type var content_type = null; if (params.text) - content_type = isHTML(params.text) ? 'text/html' : 'text/plain'; + content_type = herper.isHTML(params.text) ? 'text/html' : 'text/plain'; else content_type = 'application/json';
update the function to detect html in personality insights
watson-developer-cloud_node-sdk
train
js
ad7dfac6539e1ac319f159ea67912eb0290964db
diff --git a/packages/mjml-social/src/SocialElement.js b/packages/mjml-social/src/SocialElement.js index <HASH>..<HASH> 100644 --- a/packages/mjml-social/src/SocialElement.js +++ b/packages/mjml-social/src/SocialElement.js @@ -120,10 +120,7 @@ export default class MjSocialElement extends BodyComponent { } getSocialAttributes() { - const socialNetwork = { - ...defaultSocialNetworks[this.getAttribute('name')], - } - + const socialNetwork = defaultSocialNetworks[this.getAttribute('name')] let href = this.getAttribute('href') if (get(socialNetwork, 'share-url')) {
rm useless cloning
mjmlio_mjml
train
js
26cfa88f3a4b3fc62df76b60b39397efb229c0bd
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -24,7 +24,6 @@ tests_require = [ 'pytest-django>=3.2.1', ] + rest_framework_require -django_version = 'Django>=1.8.0,<2' if sys.version_info[0] < 3 else 'Django>=1.8.0' setup( name='graphene-django', version=version, @@ -60,7 +59,7 @@ setup( 'six>=1.10.0', 'graphene>=2.1,<3', 'graphql-core>=2.1rc1', - django_version, + 'Django>=1.8.0', 'iso8601', 'singledispatch>=3.4.0.3', 'promise>=2.1',
Fixed non-deterministic setup.py. Related issue #<I> This commit is trying to fix <URL>
graphql-python_graphene-django
train
py
8929368bbb2366ace79cba548ca776d62739f620
diff --git a/system/drivers/DC_General.php b/system/drivers/DC_General.php index <HASH>..<HASH> 100644 --- a/system/drivers/DC_General.php +++ b/system/drivers/DC_General.php @@ -1456,7 +1456,7 @@ class DC_General extends DataContainer implements editable, listable { $varNew = $this->Encryption->encrypt(is_array($varNew) ? serialize($varNew) : $varNew); } - else if ($arrConfig['eval']['unique'] && !$this->getDataProvider($this->objCurrentModel->getProviderName())->isUniqueValue($strField, $varNew)) + else if ($arrConfig['eval']['unique'] && !$this->getDataProvider($this->objCurrentModel->getProviderName())->isUniqueValue($strField, $varNew, $this->objCurrentModel->getID())) { $this->noReload = true; $objWidget->addError(sprintf($GLOBALS['TL_LANG']['ERR']['unique'], $objWidget->label));
call isUniqueValue with id of current item.
contao-community-alliance_dc-general
train
php
9edc805932b53b14d3225643037be9afb1478ec1
diff --git a/canmatrix/arxml.py b/canmatrix/arxml.py index <HASH>..<HASH> 100644 --- a/canmatrix/arxml.py +++ b/canmatrix/arxml.py @@ -1231,7 +1231,7 @@ def getFrame(frameTriggering, arDict, multiplexTranslation, ns, float_factory): else: logger.debug(arGetName(pdu, ns)) - if "MULTIPLEXED-I-PDU" in pdu.tag: + if pdu is not None and "MULTIPLEXED-I-PDU" in pdu.tag: selectorByteOrder = arGetChild(pdu, "SELECTOR-FIELD-BYTE-ORDER", arDict, ns) selectorLen = arGetChild(pdu, "SELECTOR-FIELD-LENGTH", arDict, ns) selectorStart = arGetChild(pdu, "SELECTOR-FIELD-START-POSITION", arDict, ns)
Update arxml.py more robustness for arxml reading (#<I>)
ebroecker_canmatrix
train
py
5a92549f1dbdbf70a93c03b35a7f6d08206c8c2d
diff --git a/xbbg/__init__.py b/xbbg/__init__.py index <HASH>..<HASH> 100644 --- a/xbbg/__init__.py +++ b/xbbg/__init__.py @@ -1,3 +1,3 @@ """Intuitive Bloomberg data API""" -__version__ = '0.7.6' +__version__ = '0.7.7a1'
version <I>a1 - added options in `blp.live`
alpha-xone_xbbg
train
py
6b9adef6849f4013b0caee82787d947bd924dcee
diff --git a/ocrmypdf/hocrtransform.py b/ocrmypdf/hocrtransform.py index <HASH>..<HASH> 100755 --- a/ocrmypdf/hocrtransform.py +++ b/ocrmypdf/hocrtransform.py @@ -205,8 +205,8 @@ class HocrTransform(): # put the image on the page, scaled to fill the page if imageFileName is not None: - im = Image.open(imageFileName) - pdf.drawInlineImage(im, 0, 0, width=self.width, height=self.height) + pdf.drawImage(imageFileName, 0, 0, + width=self.width, height=self.height) # finish up the page and save it pdf.showPage() diff --git a/ocrmypdf/pageinfo.py b/ocrmypdf/pageinfo.py index <HASH>..<HASH> 100644 --- a/ocrmypdf/pageinfo.py +++ b/ocrmypdf/pageinfo.py @@ -45,7 +45,6 @@ def _page_has_inline_images(page): data = contents.getData() begin_image, image_data, end_image = False, False, False for data in re.split(b'\s+', data): - print(data) if data == b'BI': begin_image = True elif data == b'ID':
Don't create inline images in output PDFs ...except that Ghostscript will sometimes turn out of line images into inline images on its own, possibly if file size is small.
jbarlow83_OCRmyPDF
train
py,py
982ce5007fa9cf024aafee6accbf46af290943b1
diff --git a/src/data/List.js b/src/data/List.js index <HASH>..<HASH> 100644 --- a/src/data/List.js +++ b/src/data/List.js @@ -34,7 +34,7 @@ function cloneChunk(originalChunk) { } var TRANSFERABLE_PROPERTIES = [ - 'stackedOn', 'hasItemOption', '_nameList', '_idList', '_rawData' + 'stackedOn', 'hasItemOption', '_nameList', '_idList', '_rawData', '_chunkSize' ]; function transferProperties(a, b) { @@ -910,7 +910,7 @@ listProto.filterSelf = function (dimensions, cb, stack, context) { } } - this.indices = newIndices; + this.indices = new Uint32Array(newIndices); // Reset data extent this._extent = {}; @@ -1304,8 +1304,6 @@ listProto.cloneShallow = function () { list._extent = zrUtil.extend({}, this._extent); } - list._frameSize = this._frameSize; - return list; };
Fix clone not transfer chunkSize bug.
apache_incubator-echarts
train
js
467695bcb968d66600bfad610e4df3cc7aaf68fc
diff --git a/recipe/common.php b/recipe/common.php index <HASH>..<HASH> 100644 --- a/recipe/common.php +++ b/recipe/common.php @@ -74,7 +74,7 @@ set('writable_chmod_recursive', true); // For chmod mode only (if is boolean, it set('http_user', false); set('http_group', false); -set('clear_paths', []); // Relative path from deploy_path +set('clear_paths', []); // Relative path from release_path set('clear_use_sudo', false); // Using sudo in clean commands? set('cleanup_use_sudo', false); // Using sudo in cleanup commands?
Fix comment in common recipe (#<I>) As stated in <URL>
deployphp_deployer
train
php
7c33f88f77d3ee996fb905deb148cc1d549b117c
diff --git a/pysyte/cli/main.py b/pysyte/cli/main.py index <HASH>..<HASH> 100644 --- a/pysyte/cli/main.py +++ b/pysyte/cli/main.py @@ -49,8 +49,6 @@ def run(main_method, add_args=None, post_parse=None, config=None, usage=None, ep main = main_method else: def main(): - if post_parse: - parser.post_parser = post_parse args = parser.parse_args() if post_parse: parsed = post_parse(args)
Do not duplicate post-parsing
jalanb_pysyte
train
py
62cf38db3f0d54d13b54139e227a71de9a2d6d72
diff --git a/jws/jws.go b/jws/jws.go index <HASH>..<HASH> 100644 --- a/jws/jws.go +++ b/jws/jws.go @@ -374,10 +374,19 @@ func Parse(src io.Reader) (m *Message, err error) { } } + var parser func(io.Reader) (*Message, error) if first == '{' { - return parseJSON(rdr) + parser = parseJSON + } else { + parser = parseCompact } - return parseCompact(rdr) + + m, err = parser(rdr) + if err != nil { + return nil, errors.Wrap(err, `failedt o parse jws message`) + } + + return m, nil } // ParseString is the same as Parse, but take in a string
slight re-org of the code
lestrrat-go_jwx
train
go
0e7330777448758b059ab24d6db4b527c0269001
diff --git a/util.py b/util.py index <HASH>..<HASH> 100644 --- a/util.py +++ b/util.py @@ -458,3 +458,31 @@ def get_platform (): return sys.platform # get_platform() + + +def native_path (pathname): + """Return 'pathname' as a name that will work on the native + filesystem, i.e. split it on '/' and put it back together again + using the current directory separator. Needed because filenames in + the setup script are always supplied in Unix style, and have to be + converted to the local convention before we can actually use them in + the filesystem. Raises DistutilsValueError if 'pathname' is + absolute (starts with '/') or contains local directory separators + (unless the local separator is '/', of course).""" + + if pathname[0] == '/': + raise DistutilsValueError, "path '%s' cannot be absolute" % pathname + if pathname[-1] == '/': + raise DistutilsValueError, "path '%s' cannot end with '/'" % pathname + if os.sep != '/': + if os.sep in pathname: + raise DistutilsValueError, \ + "path '%s' cannot contain '%c' character" % \ + (pathname, os.sep) + + paths = string.split (pathname, '/') + return apply (os.path.join, paths) + else: + return pathname + +# native_path ()
Added 'native_path()' for use on pathnames from the setup script: split on slashes, and put back together again using the local directory separator.
pypa_setuptools
train
py
6540ed21e47043d64e20bf6809d32faff0e35282
diff --git a/tests/Cli.php b/tests/Cli.php index <HASH>..<HASH> 100644 --- a/tests/Cli.php +++ b/tests/Cli.php @@ -14,7 +14,6 @@ class Cli { echo 'test'; yield 'execute' => 0; - echo 'test'; yield 'execute' => 1; } }
this should go for the test to pass
gentry-php_gentry
train
php
5c235cbc4aa3de34fc1fa2931df14346f743550f
diff --git a/holoviews/plotting/plot.py b/holoviews/plotting/plot.py index <HASH>..<HASH> 100644 --- a/holoviews/plotting/plot.py +++ b/holoviews/plotting/plot.py @@ -635,7 +635,7 @@ class GenericCompositePlot(DimensionedPlot): layout_frame = self.layout.clone(shared_data=False) nthkey_fn = lambda x: zip(tuple(x.name for x in x.kdims), list(x.data.keys())[min([key[0], len(x)-1])]) - if key == current_key: + if key == self.current_key: return self.current_frame else: self.current_key = key
Fixed unassigned variable in GenericCompositePlot
pyviz_holoviews
train
py
9c03dff2c919919760616583216567a08dd67a6e
diff --git a/lib/tests/accesslib_test.php b/lib/tests/accesslib_test.php index <HASH>..<HASH> 100644 --- a/lib/tests/accesslib_test.php +++ b/lib/tests/accesslib_test.php @@ -2476,10 +2476,11 @@ class accesslib_testcase extends advanced_testcase { $this->assertDebuggingCalled('print_context_name() is deprecated, please use $context->get_context_name() instead.', DEBUG_DEVELOPER); $this->assertFalse(empty($name)); - get_context_url($coursecontext); + $url1 = get_context_url($coursecontext); $this->assertDebuggingCalled('get_context_url() is deprecated, please use $context->get_url() instead.', DEBUG_DEVELOPER); - $url = $coursecontext->get_url(); - $this->assertFalse($url instanceof modole_url); + $url2 = $coursecontext->get_url(); + $this->assertEquals($url1, $url2); + $this->assertFalse($url2 instanceof modole_url); $pagecm = get_coursemodule_from_instance('page', $testpages[7]); $context = context_module::instance($pagecm->id);
MDL-<I> libraries: added another PHPUnit test to ensure deprecated function returns the same as the replacement
moodle_moodle
train
php
583971559601c8b6c746396379d3bb600c26dff0
diff --git a/src/Illuminate/Foundation/Console/RouteListCommand.php b/src/Illuminate/Foundation/Console/RouteListCommand.php index <HASH>..<HASH> 100644 --- a/src/Illuminate/Foundation/Console/RouteListCommand.php +++ b/src/Illuminate/Foundation/Console/RouteListCommand.php @@ -240,7 +240,7 @@ class RouteListCommand extends Command } } - return $results; + return array_map('strtolower', $results); } /**
Compare route:list columns case insensitively
laravel_framework
train
php
eed1ccff9b2635cac03c877f0ecb281fde2ffe61
diff --git a/tensor2tensor/models/research/transformer_moe.py b/tensor2tensor/models/research/transformer_moe.py index <HASH>..<HASH> 100644 --- a/tensor2tensor/models/research/transformer_moe.py +++ b/tensor2tensor/models/research/transformer_moe.py @@ -93,8 +93,8 @@ class TransformerMoe(t2t_model.T2TModel): """Apply processing and capture the extra loss.""" @expert_utils.add_var_scope() def decorated(x, *args, **kwargs): - x = dp_preprocess(x) - y, loss = fct(x, *args, **kwargs) + x_preprocessed = dp_preprocess(x) + y, loss = fct(x_preprocessed, *args, **kwargs) cache["extra_loss"] += loss return dp_postprocess(x, y) return decorated
Fix transformer_moe model has wrong logic in pre/postprocessing (#<I>)
tensorflow_tensor2tensor
train
py
24381c2f370fe994a653f81074f91e58fc0333d5
diff --git a/lib/OpenLayers/Control/MouseDefaults.js b/lib/OpenLayers/Control/MouseDefaults.js index <HASH>..<HASH> 100644 --- a/lib/OpenLayers/Control/MouseDefaults.js +++ b/lib/OpenLayers/Control/MouseDefaults.js @@ -188,7 +188,7 @@ OpenLayers.Control.MouseDefaults.prototype = (end.lat) ), this.map.getZoom() + 1); } - this.map.viewPortDiv.removeChild(document.getElementById("zoomBox")); + this.map.viewPortDiv.removeChild(this.zoomBox); this.zoomBox = null; } },
Remove MouseDefaults.zoomBox directly, rather than attempting to remove it by DOM ID. Fixes #<I> in IE. git-svn-id: <URL>
openlayers_openlayers
train
js
fb376a83a47d678952672a7f5d36a02101135fb2
diff --git a/pifpaf/drivers/ceph.py b/pifpaf/drivers/ceph.py index <HASH>..<HASH> 100644 --- a/pifpaf/drivers/ceph.py +++ b/pifpaf/drivers/ceph.py @@ -130,6 +130,9 @@ mon pg warn min per osd = 0 mon data avail warn = 2 mon data avail crit = 1 +# Ceph CVE CVE-2021-20288 to prevent HEALTH_WARN +auth allow insecure global id reclaim = false + [mon.a] host = localhost mon addr = 127.0.0.1:%(port)d
Set auth_allow_insecure_global_id_reclaim to false This is for Ceph CVE-<I>-<I> to prevent it from being stuck in HEALTH_WARN.
jd_pifpaf
train
py
6b667de5709f4dc794be0dca1890da5b9ca620ac
diff --git a/views/js/runner/provider/qti.js b/views/js/runner/provider/qti.js index <HASH>..<HASH> 100644 --- a/views/js/runner/provider/qti.js +++ b/views/js/runner/provider/qti.js @@ -24,6 +24,7 @@ define([ 'jquery', 'lodash', 'context', + 'module', 'core/promise', 'taoQtiItem/qtiItem/core/Loader', 'taoQtiItem/qtiItem/core/Element', @@ -31,7 +32,7 @@ define([ 'taoQtiItem/runner/provider/manager/picManager', 'taoQtiItem/runner/provider/manager/userModules', 'taoItems/assets/manager' -], function($, _, context, Promise, QtiLoader, Element, QtiRenderer, picManager, userModules, assetManagerFactory){ +], function($, _, context, module, Promise, QtiLoader, Element, QtiRenderer, picManager, userModules, assetManagerFactory){ 'use strict'; var timeout = (context.timeout > 0 ? context.timeout + 1 : 30) * 1000;
Added variable that is responsible about type of the feedback form (modal|inline)
oat-sa_extension-tao-itemqti
train
js
03a2958a28b900eec1392b55d2470930c3e5b7e3
diff --git a/pkg/cmd/server/etcd/etcdserver/run.go b/pkg/cmd/server/etcd/etcdserver/run.go index <HASH>..<HASH> 100644 --- a/pkg/cmd/server/etcd/etcdserver/run.go +++ b/pkg/cmd/server/etcd/etcdserver/run.go @@ -93,6 +93,9 @@ func RunEtcd(etcdServerConfig *configapi.EtcdConfig) { func addressToURLs(addr string, isTLS bool) []string { addrs := strings.Split(addr, ",") for i := range addrs { + if strings.HasPrefix(addrs[i], "unix://") || strings.HasPrefix(addrs[i], "unixs://") { + continue + } if isTLS { addrs[i] = "https://" + addrs[i] } else {
Allow unix domain sockets to be passed to etcd start
openshift_origin
train
go
b9465e8755509cc79ad7492914a26c8ac3884de0
diff --git a/railties/lib/rails/test_unit/minitest_plugin.rb b/railties/lib/rails/test_unit/minitest_plugin.rb index <HASH>..<HASH> 100644 --- a/railties/lib/rails/test_unit/minitest_plugin.rb +++ b/railties/lib/rails/test_unit/minitest_plugin.rb @@ -93,5 +93,7 @@ module Minitest mattr_accessor(:run_with_rails_extension) { false } end +# Let libraries override our reporter setup by loading other plugins then +# setting ourselves as the first plugin to be initialized. Minitest.load_plugins -Minitest.extensions << 'rails' +Minitest.extensions.unshift 'rails'
Set Rails as the first minitest initialized plugin. When calling `load_plugins` minitest would fill out its extensions, then we'd tackle ourselves on as the last plugin. Because minitest loads plugins in order we will ultimately have the last say on what reporters will be used. Invert that strategy by putting ourselves first and give other plugins plenty of leeway to override our default reporter setup. Fixes #<I>.
rails_rails
train
rb
24f593ae0738dd93503674411d576865465a32a1
diff --git a/salt/modules/virt.py b/salt/modules/virt.py index <HASH>..<HASH> 100644 --- a/salt/modules/virt.py +++ b/salt/modules/virt.py @@ -695,7 +695,7 @@ def _gen_pool_xml(name, source_initiator]): source = { 'devices': source_devices or [], - 'dir': source_dir, + 'dir': source_dir if source_format != 'cifs' or not source_dir else source_dir.lstrip('/'), 'adapter': source_adapter, 'hosts': [{'name': host[0], 'port': host[1] if len(host) > 1 else None} for host in hosts], 'auth': source_auth,
virt.pool_define: remove potential leading / in CIFS source path libvirt needs the CIFS source path not to start with a /. Let's remove them since this could be a common user mistake.
saltstack_salt
train
py
1a4a89a894a2c7358f697edd00d20c1fcfcc4b71
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -15,7 +15,7 @@ setup( long_description=open("README.rst").read(), author=AUTHOR, author_email=AUTHOR_EMAIL, - license="LGPL", + license="MIT", include_package_data=True, py_modules=['config_resolver'], classifiers=[
Switched to MIT license.
exhuma_config_resolver
train
py
4e42a3daa65cc2fdca7c96e77d62db4e34aee276
diff --git a/lifecycle/lifecycle.go b/lifecycle/lifecycle.go index <HASH>..<HASH> 100644 --- a/lifecycle/lifecycle.go +++ b/lifecycle/lifecycle.go @@ -22,7 +22,6 @@ type Lifecycle struct { interrupt chan os.Signal fatalQuit chan struct{} killFuncs []func() - uninstaller stopper.Stopper } // New creates a new Lifecycle. This should be called after validating @@ -36,7 +35,6 @@ func New(singleProcess bool) *Lifecycle { l := Lifecycle{ interrupt: make(chan os.Signal, 1), fatalQuit: make(chan struct{}, 1), - uninstaller: InstallStackTracer(), } // make sigint trigger a clean shutdown @@ -78,8 +76,6 @@ func (l *Lifecycle) RunWhenKilled(finalizer func(), timeout time.Duration) { vlog.VLogf("Caught fatal quit, shutting down") } - defer l.uninstaller.Stop() - // wait for either confirmation that we finished or another interrupt shutdown := make(chan struct{}, 1) go func() {
lifecycle: remove using uninstaller by default so that programs can use SIGUSR1
fastly_go-utils
train
go
1c65facbebefd0ab0fc91b52eab9f3f18927826e
diff --git a/thinc/extra/datasets.py b/thinc/extra/datasets.py index <HASH>..<HASH> 100644 --- a/thinc/extra/datasets.py +++ b/thinc/extra/datasets.py @@ -43,7 +43,7 @@ def ancora_pos_tags(encode_words=False): # pragma: no cover def ewtb_pos_tags(encode_tags=False, encode_words=False): # pragma: no cover - data_dir = get_file("UD_English-r1.4", EWTB_1_4_ZIP, unzip=True) + data_dir = get_file("UD_English-EWT-r1.4", EWTB_1_4_ZIP, unzip=True) train_loc = os.path.join(data_dir, "en-ud-train.conllu") dev_loc = os.path.join(data_dir, "en-ud-dev.conllu") return ud_pos_tags(
Fix location of UD_English-EWT dataset
explosion_thinc
train
py
e9d9205ce8461f7611cba369a5e8d4fea8c53034
diff --git a/terraform/eval_diff.go b/terraform/eval_diff.go index <HASH>..<HASH> 100644 --- a/terraform/eval_diff.go +++ b/terraform/eval_diff.go @@ -146,7 +146,6 @@ func (n *EvalDiff) Eval(ctx EvalContext) (interface{}, error) { // necessary unmarkedConfigVal := configVal var unmarkedPaths []cty.PathValueMarks - // var marks cty.ValueMarks if configVal.ContainsMarked() { // store the marked values so we can re-mark them later after // we've sent things over the wire. Right now this stores @@ -250,8 +249,9 @@ func (n *EvalDiff) Eval(ctx EvalContext) (interface{}, error) { plannedNewVal := resp.PlannedState // Add the marks back to the planned new value + markedPlannedNewVal := plannedNewVal if configVal.ContainsMarked() { - plannedNewVal = plannedNewVal.MarkWithPaths(unmarkedPaths) + markedPlannedNewVal = plannedNewVal.MarkWithPaths(unmarkedPaths) } plannedPrivate := resp.PlannedPrivate @@ -499,7 +499,10 @@ func (n *EvalDiff) Eval(ctx EvalContext) (interface{}, error) { Change: plans.Change{ Action: action, Before: priorVal, - After: plannedNewVal, + // Pass the marked value through in our change + // to propogate through evaluation. + // Marks will be removed when encoding. + After: markedPlannedNewVal, }, RequiredReplace: reqRep, }
Modifications to eval_diff
hashicorp_terraform
train
go
386ae96037fb67cc9540a0d18493cc7d9a803da1
diff --git a/src/Isbn/CheckDigit.php b/src/Isbn/CheckDigit.php index <HASH>..<HASH> 100644 --- a/src/Isbn/CheckDigit.php +++ b/src/Isbn/CheckDigit.php @@ -6,6 +6,7 @@ class CheckDigit { public static function make($isbn) { + $isbn = Hyphens::removeHyphens($isbn); if (strlen($isbn) == 12 OR strlen($isbn) == 13) return CheckDigit::make13($isbn); if (strlen($isbn) == 9 OR strlen($isbn) == 10)
Be more sure about the exactness of the string I'm measuring
Fale_isbn
train
php
6975e35ace8e679b739be40cbee23b4740213e0e
diff --git a/core-bundle/src/Resources/contao/library/Contao/Model.php b/core-bundle/src/Resources/contao/library/Contao/Model.php index <HASH>..<HASH> 100644 --- a/core-bundle/src/Resources/contao/library/Contao/Model.php +++ b/core-bundle/src/Resources/contao/library/Contao/Model.php @@ -430,6 +430,8 @@ abstract class Model $this->arrModified = array(); + $this->objDatabase->getModelRegistry()->register($this); + $this->postSave(self::INSERT); }
[Core] Register model, after insert a new row into database.
contao_contao
train
php
472e9313f2b75344bd8ec056ee4c52a0fd3877e8
diff --git a/addon/services/l10n.js b/addon/services/l10n.js index <HASH>..<HASH> 100644 --- a/addon/services/l10n.js +++ b/addon/services/l10n.js @@ -134,7 +134,9 @@ export default Service.extend({ * @default 'assets/locales' * @public */ - jsonPath: '/assets/locales', + jsonPath: computed(function() { + return '/assets/locales'; // Use a cp here to prevent broccoli-asset-rev from changing this + }), /** * If the assetMap.json generated by broccoli-asset-rev should be used. @@ -144,7 +146,7 @@ export default Service.extend({ * Override and set this to false if you want to have the legacy behaviour, * where it manually fingerprints the files with the current app version. * - * By default, this is true if ifa.enabled = true in your config/environment.js. + * By default, this is true if ifa is enabled in your config/environment.js. * * @property useAssetMap * @type {Boolean}
Use a cp for jsonPath to prevent broccoli-asset-rev from making wrong changes
Cropster_ember-l10n
train
js
cac71606aaf4ec9400682ae10bdddf2fdbfa05dc
diff --git a/html/pfappserver/root/static.alt/src/views/Configurator/_router/index.js b/html/pfappserver/root/static.alt/src/views/Configurator/_router/index.js index <HASH>..<HASH> 100644 --- a/html/pfappserver/root/static.alt/src/views/Configurator/_router/index.js +++ b/html/pfappserver/root/static.alt/src/views/Configurator/_router/index.js @@ -25,6 +25,10 @@ const route = { transitionDelay: 150 // force scroll to the top }, beforeEnter: (to, from, next) => { + // do not include X-PacketFence-Tenant-Id header when in configrator, fixes #5610 + if (localStorage.getItem('X-PacketFence-Tenant-Id')) { + localStorage.removeItem('X-PacketFence-Tenant-Id') + } // Force initial visit to start with the first step if (!['configurator-network', 'configurator-interfaces'].includes(to.name)) { next({ name: 'configurator-network'})
(web admin) do not include X-PacketFence-Tenant-Id header when in configurator, fixes #<I>
inverse-inc_packetfence
train
js
a8d17c30b5f5786cb8ad2d8ce156810245e51901
diff --git a/Grido/Components/Filters/Text.php b/Grido/Components/Filters/Text.php index <HASH>..<HASH> 100644 --- a/Grido/Components/Filters/Text.php +++ b/Grido/Components/Filters/Text.php @@ -17,6 +17,9 @@ namespace Grido\Components\Filters; * @package Grido * @subpackage Components\Filters * @author Petr Bugyík + * + * @property int $suggestionLimit + * @property-write callback $suggestionCallback */ class Text extends Filter { @@ -90,6 +93,14 @@ class Text extends Filter /**********************************************************************************************/ /** + * @return int + */ + public function getSuggestionLimit() + { + return $this->suggestionLimit; + } + + /** * @param string $query - value from input * @internal */
Fixed latest commit part 2 (for php <I>)
o5_grido
train
php
95fd5c06c62a03a070c226b9c2e7e2c007174955
diff --git a/index.js b/index.js index <HASH>..<HASH> 100644 --- a/index.js +++ b/index.js @@ -124,7 +124,7 @@ module.exports = { result.posCount = posDaily; result.negCount = negDaily; result.nullCount = nullDaily; - result.date = start; + result.date = start.toISOString(); callback(result); } });
don't even know what i did there
Rostlab_JS16_ProjectD_Group5
train
js
413f0922775b7e3cfff822743545d68193c57aa1
diff --git a/barf/core/smt/smttranslator.py b/barf/core/smt/smttranslator.py index <HASH>..<HASH> 100644 --- a/barf/core/smt/smttranslator.py +++ b/barf/core/smt/smttranslator.py @@ -216,16 +216,6 @@ class SmtTranslator(object): return var_name - def _translate_immediate_oprnd(self, operand): - """Translate REIL immediate operand to SMT. - """ - if operand.size >= 4: - fmt = "#x%" + "%0003d" % (operand.size / 4) + "x" - else: - fmt = "#b%1d" - - return smtsymbol.BitVec(operand.size, fmt % operand.immediate) - def _translate_src_oprnd(self, operand): """Translate source operand to a SMT expression. """ @@ -235,7 +225,7 @@ class SmtTranslator(object): elif isinstance(operand, ReilImmediateOperand): - ret_val = self._translate_immediate_oprnd(operand) + ret_val = smtsymbol.cast_int(operand.immediate, operand.size) else:
Refactor remove SmtTranslator's auxiliary method
programa-stic_barf-project
train
py
7aa39c1897d41713ef4ec8d7a9e6f6755f9f11d6
diff --git a/lib/pbfParser.js b/lib/pbfParser.js index <HASH>..<HASH> 100644 --- a/lib/pbfParser.js +++ b/lib/pbfParser.js @@ -245,7 +245,7 @@ function createTagsObject(pb, entity){ tags = {}; - for(i = entity.keys.length - 1; i >= 0; --i){ + for(i = 0; i < entity.keys.length; ++i){ keyI = entity.keys[i]; valI = entity.vals[i];
keep tag order (no reverse iteration)
marook_osm-read
train
js
880cae44b4fb0c19d96233fdf86aa88b32b72bb7
diff --git a/PyFunceble/query/requests/adapter/base.py b/PyFunceble/query/requests/adapter/base.py index <HASH>..<HASH> 100644 --- a/PyFunceble/query/requests/adapter/base.py +++ b/PyFunceble/query/requests/adapter/base.py @@ -96,7 +96,7 @@ class RequestAdapterBase(requests.adapters.HTTPAdapter): response = requests.models.Response() response.url = f"http://{PyFunceble.storage.NOT_RESOLVED_STD_HOSTNAME}" response.status_code = HTTPStatusCode.STD_UNKNOWN_STATUS_CODE - response._content = "".encode("utf-8") + response._content = "".encode("utf-8") # pylint: disable=protected-access response.history = [response] response.headers = { "X-Message": "This is a fake header generated by "
fixup! Improvement of the HTTP/S requester.
funilrys_PyFunceble
train
py
cbb42d23595cef9d321a2db7bc00f804a2194866
diff --git a/tests/common/test_zz_gui_docking_windows.py b/tests/common/test_zz_gui_docking_windows.py index <HASH>..<HASH> 100644 --- a/tests/common/test_zz_gui_docking_windows.py +++ b/tests/common/test_zz_gui_docking_windows.py @@ -39,7 +39,7 @@ def wait_for_event_notification(): raise RuntimeError("A timeout occurred") -def assert_size_equality(size1, size2, window=None): +def assert_size_equality(size1, size2): assert abs(size1[0] - size2[0]) <= 10 assert abs(size1[1] - size2[1]) <= 10 @@ -61,7 +61,10 @@ def undock_sidebars(): expected_size = get_stored_window_size(window_name) new_size = window.get_size() if not bool(window.maximize_initially): - assert_size_equality(new_size, expected_size, window) + assert_size_equality(new_size, expected_size) + else: + maximized_parameter_name = window_key.upper() + "_WINDOW_MAXIMIZED" + assert bool(window.maximize_initially) and global_runtime_config.get_config_value(maximized_parameter_name) logger.info("resizing...") time.sleep(debug_sleep_time)
undock test: clean up and add assert on maximized window if in runtime config
DLR-RM_RAFCON
train
py
11699ccd3f3acb59bd9265e64d229ffc04bcecf3
diff --git a/picker/picker.go b/picker/picker.go index <HASH>..<HASH> 100644 --- a/picker/picker.go +++ b/picker/picker.go @@ -272,7 +272,7 @@ func (p *Picker) PickAddr() (string, error) { p.mu.Lock() p.peer = peer p.mu.Unlock() - return p.peer.Addr, err + return peer.Addr, err } // State returns the connectivity state of the underlying connections.
picker: Fix data race in PickAddr PickAddr sets p.peer to peer, then returns p.peer.Addr after unlocking its mutex. It should return peer.Addr instead to avoid triggering a data race.
docker_swarmkit
train
go
34551d092aa72b6f800226752ef19c8fa51bc3c5
diff --git a/clients/filter/data.go b/clients/filter/data.go index <HASH>..<HASH> 100644 --- a/clients/filter/data.go +++ b/clients/filter/data.go @@ -67,12 +67,13 @@ type Download struct { Size string `json:"size"` Public string `json:"public,omitempty"` Private string `json:"private,omitempty"` + Skipped bool `json:"skipped,omitempty"` } // Event represents an event from a filter api response type Event struct { - Time string `json:"time"` - Type string `json:"type"` + Time string `json:"time"` + Type string `json:"type"` } // Preview represents a preview document returned from the filter api
Add skipped flag to filter downloads
ONSdigital_go-ns
train
go
bb5a06b38eba7e621c494717334b8c58a1933abd
diff --git a/resources/class_generator.py b/resources/class_generator.py index <HASH>..<HASH> 100644 --- a/resources/class_generator.py +++ b/resources/class_generator.py @@ -23,8 +23,12 @@ for i, mo in enumerate(managed_objects): for prop in mo["properties"]: body_text += " @cached_property\n" body_text += " def %s(self):\n" % prop["name"] - body_text += (" return self._get_property(\"%s\", %s, %s)\n" % - (prop["name"], prop["mor"], prop["multivalue"])) + if prop["mor"] is True: + body_text += (" return self._get_mor(\"%s\", %s)\n" % + (prop["name"], prop["multivalue"])) + else: + body_text += (" return self._get_dataobject(\"%s\", %s)\n" % + (prop["name"], prop["multivalue"])) body_text += "\n\n"
Call different method depending on whether it's a MOR or not
psphere-project_psphere
train
py
41848fc0d0b212b6f325b5b43a867ad10f0880b4
diff --git a/Nextras/Datagrid/Datagrid.php b/Nextras/Datagrid/Datagrid.php index <HASH>..<HASH> 100644 --- a/Nextras/Datagrid/Datagrid.php +++ b/Nextras/Datagrid/Datagrid.php @@ -367,7 +367,7 @@ class Datagrid extends UI\Control { $form = new UI\Form; - if ($this->editFormFactory && ($this->editRowKey || !empty($_POST))) { + if ($this->editFormFactory && ($this->editRowKey || !empty($_POST['edit']))) { $data = $this->editRowKey && empty($_POST) ? $this->getData($this->editRowKey) : NULL; $form['edit'] = Nette\Callback::create($this->editFormFactory)->invokeArgs(array($data));
In creation of edit form check for 'edit' part of POST data This prevents creation edit form in case POST data were filled from different sources (like filter)
nextras_datagrid
train
php
c5f1c6901f0ff1b7867c80691134d535ac645559
diff --git a/test/test_consumer_integration.py b/test/test_consumer_integration.py index <HASH>..<HASH> 100644 --- a/test/test_consumer_integration.py +++ b/test/test_consumer_integration.py @@ -352,8 +352,14 @@ class TestConsumerIntegration(KafkaIntegrationTestCase): # Produce 10 messages that are large (bigger than default fetch size) large_messages = self.send_messages(0, [ random_string(5000) for x in range(10) ]) - # Consumer should still get all of them - consumer = self.consumer() + # Brokers prior to 0.11 will return the next message + # if it is smaller than max_bytes (called buffer_size in SimpleConsumer) + # Brokers 0.11 and later that store messages in v2 format + # internally will return the next message only if the + # full MessageSet is smaller than max_bytes. + # For that reason, we set the max buffer size to a little more + # than the size of all large messages combined + consumer = self.consumer(max_buffer_size=60000) expected_messages = set(small_messages + large_messages) actual_messages = set([ x.message.value for x in consumer ])
Increase max_buffer_size for test_large_messages
dpkp_kafka-python
train
py
f4053e6b23494463e84639d05ca61ab5e21c31c9
diff --git a/packages/ember-metal/lib/chains.js b/packages/ember-metal/lib/chains.js index <HASH>..<HASH> 100644 --- a/packages/ember-metal/lib/chains.js +++ b/packages/ember-metal/lib/chains.js @@ -231,10 +231,10 @@ ChainNodePrototype.unchain = function(key, path) { var node = chains[key]; // unchain rest of path first... - if (path && path.length>1) { - key = firstKey(path); - path = path.slice(key.length+1); - node.unchain(key, path); + if (path && path.length > 1) { + var nextKey = firstKey(path); + var nextPath = path.slice(nextKey.length + 1); + node.unchain(nextKey, nextPath); } // delete node if needed.
Minor cleanup in ChainNode.unchain. Do not reassign passed in variable. Makes debugging quite painful.
emberjs_ember.js
train
js
a4e520aff16b607c0cf5558fbcfc0dc2cf41d9d8
diff --git a/cmd/swarm-rafttool/dump.go b/cmd/swarm-rafttool/dump.go index <HASH>..<HASH> 100644 --- a/cmd/swarm-rafttool/dump.go +++ b/cmd/swarm-rafttool/dump.go @@ -200,7 +200,9 @@ func dumpSnapshot(swarmdir, unlockKey string, redact bool) error { if task != nil { if container := task.Spec.GetContainer(); container != nil { container.Env = []string{"ENVVARS REDACTED"} - container.PullOptions.RegistryAuth = "REDACTED" + if container.PullOptions != nil { + container.PullOptions.RegistryAuth = "REDACTED" + } } } } @@ -208,7 +210,9 @@ func dumpSnapshot(swarmdir, unlockKey string, redact bool) error { if service != nil { if container := service.Spec.Task.GetContainer(); container != nil { container.Env = []string{"ENVVARS REDACTED"} - container.PullOptions.RegistryAuth = "REDACTED" + if container.PullOptions != nil { + container.PullOptions.RegistryAuth = "REDACTED" + } } } }
Fix nil pointer deref in dump-snapshot --redacted container.PullOptions is nil if the service is deployed without `--with-registry-auth`. Observed on client+server <I>.
docker_swarmkit
train
go
89a1a38ac2cad4b9ee88db765cfd75eee1c798e7
diff --git a/test/wdio.conf.js b/test/wdio.conf.js index <HASH>..<HASH> 100644 --- a/test/wdio.conf.js +++ b/test/wdio.conf.js @@ -56,7 +56,14 @@ exports.config = { // browserName: 'chrome', 'goog:chromeOptions': { - args: ['--disable-gpu'] + args: [ + '--browser-test', + '--disable-features=site-per-process', + '--disable-gpu', + '--disable-site-isolation-trials', + '--disable-webgl', + '--no-sandbox' + ] } // If outputDir is provided WebdriverIO can capture driver session logs // it is possible to configure which logTypes to include/exclude.
Squashed commit of the following: commit <I>d<I>b9cf8ed<I>a<I>c6e<I>b<I>d<I>f8a<I>bf
electric-eloquence_fepper-ui
train
js
7fc47bfc4367da1612c02760e67d2e61c42708a3
diff --git a/lib/jekyll/log_adapter.rb b/lib/jekyll/log_adapter.rb index <HASH>..<HASH> 100644 --- a/lib/jekyll/log_adapter.rb +++ b/lib/jekyll/log_adapter.rb @@ -1,6 +1,6 @@ module Jekyll class LogAdapter - attr_reader :writer + attr_reader :writer, :messages LOG_LEVELS = { :debug => ::Logger::DEBUG, @@ -16,6 +16,7 @@ module Jekyll # # Returns nothing def initialize(writer, level = :info) + @messages = [] @writer = writer self.log_level = level end @@ -100,12 +101,5 @@ module Jekyll def formatted_topic(topic) "#{topic} ".rjust(20) end - - # Public: All the messages Stevenson has printed so far - # - # Returns an Array of all messages Stevenson has built so far using #message - def messages - @messages ||= Array.new - end end end
Initialize @messages at instantiation time.
jekyll_jekyll
train
rb
e25c2c40649b623e881b20717ad0f4310430cea8
diff --git a/lib/Hpe3parSdk/volume_manager.rb b/lib/Hpe3parSdk/volume_manager.rb index <HASH>..<HASH> 100644 --- a/lib/Hpe3parSdk/volume_manager.rb +++ b/lib/Hpe3parSdk/volume_manager.rb @@ -90,10 +90,21 @@ module Hpe3parSdk end def delete_volume(name) + begin + remove_volume_metadata(name, 'type') + rescue; end + response = @http.delete("/volumes/#{name}") response[1] end + def remove_volume_metadata(name, key) + response = @http.delete( + "/volumes/#{name}/objectKeyValues/#{key}" + ) + body + end + def modify_volume(name, volume_mods) @http.put("/volumes/#{name}", body: volume_mods) if volume_mods.key? ('newName') && !volume_mods['newName'].nil?
Delete telemetry metadata before deleting the volume
HewlettPackard_hpe3par_ruby_sdk
train
rb
a4464d01379d592114bdcc8b321104f600330b84
diff --git a/core/server/adapters/storage/LocalFileStorage.js b/core/server/adapters/storage/LocalFileStorage.js index <HASH>..<HASH> 100644 --- a/core/server/adapters/storage/LocalFileStorage.js +++ b/core/server/adapters/storage/LocalFileStorage.js @@ -123,6 +123,14 @@ class LocalFileStore extends StorageBase { })); } + if (err.statusCode === 400) { + return next(new common.errors.BadRequestError({err: err})); + } + + if (err.statusCode === 403) { + return next(new common.errors.NoPermissionError({err: err})); + } + return next(new common.errors.GhostError({err: err})); }
Return correct error codes from storage adapter no issue - malformed paths such as http://localhost:<I>/content/images/<I>/<I>/%c0%af were throwing <I> errors, instead of <I> errors - this code catches the error and handles it correctly
TryGhost_Ghost
train
js
b7bb7f21f8be868424be0182289be19a2f9d6f87
diff --git a/addok/helpers/text.py b/addok/helpers/text.py index <HASH>..<HASH> 100644 --- a/addok/helpers/text.py +++ b/addok/helpers/text.py @@ -1,3 +1,4 @@ +from pathlib import Path import re from addok import config @@ -71,7 +72,7 @@ SYNONYMS = {} def load_synonyms(): - with config.RESOURCES_ROOT.joinpath(config.SYNONYMS_PATH).open() as f: + with Path(config.SYNONYMS_PATH).open() as f: for line in f: if line.startswith('#'): continue
Use SYNONYMS_PATH as absolute path
addok_addok
train
py
d255f42a9e3a337f8e3975cd751741feaed2fff9
diff --git a/benchmark.js b/benchmark.js index <HASH>..<HASH> 100644 --- a/benchmark.js +++ b/benchmark.js @@ -1,20 +1,15 @@ -// ran through matcha -// ./node_modules/matcha/bin/matcha benchmark.js +var chalk = require('./'); -var chalk = require('./index.js'); - -suite('chalk', function(){ - - bench('add colour', function(){ +suite('chalk', function () { + bench('single style', function () { chalk.red('the fox jumps over the lazy dog'); }); - bench('add several styles', function(){ - chalk.blue.bgRed.bold('the fox jumps over the lazy dog') ; + bench('several styles', function () { + chalk.blue.bgRed.bold('the fox jumps over the lazy dog'); }); - bench('add nested styles', function(){ - chalk.red('the fox jumps ', chalk.underline.bgBlue('over the lazy dog') + '!') ; + bench('nested styles', function () { + chalk.red('the fox jumps', chalk.underline.bgBlue('over the lazy dog') + '!'); }); - });
bench - minor code style tweaks
chalk_chalk
train
js
2c6c855317dd81de620e4a208f5fea1b26cb95ab
diff --git a/src/treemap/binary.js b/src/treemap/binary.js index <HASH>..<HASH> 100644 --- a/src/treemap/binary.js +++ b/src/treemap/binary.js @@ -33,14 +33,14 @@ export default function(parent, x0, y0, x1, y1) { var valueLeft = sums[k] - valueOffset, valueRight = value - valueLeft; - if ((y1 - y0) > (x1 - x0)) { - var yk = (y0 * valueRight + y1 * valueLeft) / value; - partition(i, k, valueLeft, x0, y0, x1, yk); - partition(k, j, valueRight, x0, yk, x1, y1); - } else { + if ((x1 - x0) > (y1 - y0)) { var xk = (x0 * valueRight + x1 * valueLeft) / value; partition(i, k, valueLeft, x0, y0, xk, y1); partition(k, j, valueRight, xk, y0, x1, y1); + } else { + var yk = (y0 * valueRight + y1 * valueLeft) / value; + partition(i, k, valueLeft, x0, y0, x1, yk); + partition(k, j, valueRight, x0, yk, x1, y1); } } }
Favor vertical partition of squares. With a square layout, this tends to form an initial row across the top rather than a column along the left. Related #<I>.
d3_d3-hierarchy
train
js
5201edd81ca3bf26bea27f0883bc2b674a8c41ca
diff --git a/utilities/text-import.py b/utilities/text-import.py index <HASH>..<HASH> 100755 --- a/utilities/text-import.py +++ b/utilities/text-import.py @@ -178,7 +178,7 @@ class TextImporter(Importer): p1.prefix = prefix_node1 p1.type = 'host' p1.node = node1 - p2.description = node1 + p1.description = node1 p1.authoritative_source = 'nw' p1.alarm_priority = 'low' p1.save({})
Whops, typo :(
SpriteLink_NIPAP
train
py
7c930261570a131a43181b6809fe8cd7173e3a44
diff --git a/umap/tests/test_umap.py b/umap/tests/test_umap.py index <HASH>..<HASH> 100644 --- a/umap/tests/test_umap.py +++ b/umap/tests/test_umap.py @@ -200,7 +200,7 @@ def test_sparse_fit(): pass -# @SkipTest +@SkipTest def test_sklearn_digits(): digits = datasets.load_digits() data = digits.data
Skip test for now -- need to regenerate example embedding
lmcinnes_umap
train
py
87dcc177f4ed03350f910341b99cb0027f68a678
diff --git a/app/view/js/bolt-extend.js b/app/view/js/bolt-extend.js index <HASH>..<HASH> 100644 --- a/app/view/js/bolt-extend.js +++ b/app/view/js/bolt-extend.js @@ -222,12 +222,12 @@ var BoltExtender = Object.extend(Object, { if(devpacks.length > 0) { controller.find('.dev-version-container .installed-version-item').html(""); - controller.find('.dev-version-container .installed-version-item').append(this.buildVersionTable(devpacks)); + controller.find('.dev-version-container .installed-version-item').append(controller.buildVersionTable(devpacks)); } if(stablepacks.length > 0) { controller.find('.stable-version-container .installed-version-item').html(""); - controller.find('.stable-version-container .installed-version-item').append(this.buildVersionTable(stablepacks)); + controller.find('.stable-version-container .installed-version-item').append(controller.buildVersionTable(stablepacks)); }
use controller alias to call method
bolt_bolt
train
js
82917fc3d91f48bd6d94f09bee330a3e1900f888
diff --git a/lib/httpi/adapter/em_http.rb b/lib/httpi/adapter/em_http.rb index <HASH>..<HASH> 100644 --- a/lib/httpi/adapter/em_http.rb +++ b/lib/httpi/adapter/em_http.rb @@ -142,10 +142,26 @@ module HTTPI def respond_with(http, start_time) raise TimeoutError, "Connection timed out: #{Time.now - start_time} sec" if http.response_header.status.zero? - # I'm confused here... if I return http.response_header.raw, the - # integration tests pass and the unit tests fail; if I drop the #raw - # call, the integration tests fail, but the unit tests pass. - Response.new http.response_header.status, http.response_header, http.response + Response.new http.response_header.status, + convert_headers(http.response_header), http.response + end + + # Takes any header names with an underscore as a word separator and + # converts the name to camel case, where words are separated by a dash. + # + # E.g. CONTENT_TYPE becomes Content-Type. + def convert_headers(headers) + return headers unless headers.keys.any? { |k| k =~ /_/ } + + result = {} + + headers.each do |k, v| + words = k.split("_") + key = words.map { |w| w.downcase.capitalize }.join("-") + result[key] = v + end + + result end class TimeoutError < StandardError; end
Convert headers so integration tests pass
savonrb_httpi
train
rb
cbacd965ea67cd9a2b5886570c64c0d4cf80712a
diff --git a/zinnia/managers.py b/zinnia/managers.py index <HASH>..<HASH> 100644 --- a/zinnia/managers.py +++ b/zinnia/managers.py @@ -22,11 +22,7 @@ def tags_published(): def authors_published(): """Return the published authors""" from django.contrib.auth.models import User - - author_ids = [user.pk for user in User.objects.all() - if user.entry_set.filter(status=PUBLISHED).count()] - return User.objects.filter(pk__in=author_ids) - + return User.objects.filter(entry__status=2).distinct() def entries_published(queryset): """Return only the entries published"""
Optimized the authors-query who published a blog entry. The previous method is really slow when you have some more users!
Fantomas42_django-blog-zinnia
train
py
d26cc800fd5ab62e1f49b46c3210d5a223b126ed
diff --git a/lib/highlighter.js b/lib/highlighter.js index <HASH>..<HASH> 100644 --- a/lib/highlighter.js +++ b/lib/highlighter.js @@ -28,7 +28,7 @@ var Highlighter = React.createClass({displayName: "Highlighter", */ renderPlain: function(string) { this.count++; - return React.createElement('span',{'key': this.count}, string); + return React.DOM.span({'key': this.count}, string); }, /** @@ -41,7 +41,7 @@ var Highlighter = React.createClass({displayName: "Highlighter", */ renderHighlight: function(string) { this.count++; - return React.createElement('strong',{'key': this.count, 'className': 'highlight'}, string); + return React.DOM.strong({'key': this.count, 'className': 'highlight'}, string); }, /** @@ -136,7 +136,7 @@ var Highlighter = React.createClass({displayName: "Highlighter", }, render: function() { - return React.createElement('span', React.__spread({}, this.props), this.renderElement(this.props.children)) + return React.DOM.span(React.__spread({}, this.props), this.renderElement(this.props.children)); } });
Using React.DOM API for creating elements.
helior_react-highlighter
train
js
d5bc4b5f1f2acbb527e9ce22c96bf350858368a6
diff --git a/packages/mdc-typography/index.js b/packages/mdc-typography/index.js index <HASH>..<HASH> 100644 --- a/packages/mdc-typography/index.js +++ b/packages/mdc-typography/index.js @@ -39,7 +39,7 @@ module.exports = { }); if (typography.autoLinkFont) { - this.ui.writeLine ('Linking Roboto fonts with the application.'); + this.ui.writeLine (`[${config.environment}]: Linking Roboto fonts with the application.`); return '<link href="https://fonts.googleapis.com/css?family=Roboto:300,400,500" rel="stylesheet" />'; } }
chore: added environment to log message for more clarity
onehilltech_ember-cli-mdc
train
js
2ee0bda18690c234e37597f923c19743cea5e587
diff --git a/lib/geocoderfactory.js b/lib/geocoderfactory.js index <HASH>..<HASH> 100644 --- a/lib/geocoderfactory.js +++ b/lib/geocoderfactory.js @@ -39,6 +39,11 @@ return new GoogleGeocoder(adapter, {clientId: extra.clientId, apiKey: extra.apiKey, language: extra.language}); } + if (geocoderName === 'agol') { + var AGOLGeocoder = new require('./geocoder/agolgeocoder.js'); + + return new AGOLGeocoder(adapter, {client_id:extra.client_id, client_secret:extra.client_secret}); + } if (geocoderName === 'freegeoip') { var FreegeoipGeocoder = new require('./geocoder/freegeoipgeocoder.js');
Added the AGOL geocoded to the factory
nchaulet_node-geocoder
train
js
8426a70967849e37b79a101e10341a880831667b
diff --git a/grimoire_elk/enriched/askbot.py b/grimoire_elk/enriched/askbot.py index <HASH>..<HASH> 100644 --- a/grimoire_elk/enriched/askbot.py +++ b/grimoire_elk/enriched/askbot.py @@ -166,6 +166,8 @@ class AskbotEnrich(Enrich): eitem['time_to_reply'] = get_time_diff_days(added_at, first_answer_time) eitem['question_has_accepted_answer'] = 1 if question['accepted_answer_id'] else 0 eitem['question_accepted_answer_id'] = question['accepted_answer_id'] + else: + eitem['question_has_accepted_answer'] = 0 if question['author'] and type(question['author']) is dict: eitem['author_askbot_user_name'] = question['author']['username']
[enriched] Set not accepted answer flag to askbot unanswered question This patch sets the default value of the attribute question_has_accepted_answer to zero for unanswered questions in askbot.
chaoss_grimoirelab-elk
train
py
c917e49d8a11593f4a6543aa4d87be352b3988dd
diff --git a/spec/functional/mongoid/versioning_spec.rb b/spec/functional/mongoid/versioning_spec.rb index <HASH>..<HASH> 100644 --- a/spec/functional/mongoid/versioning_spec.rb +++ b/spec/functional/mongoid/versioning_spec.rb @@ -110,6 +110,25 @@ describe Mongoid::Versioning do it "does not version the updated_at timestamp" do version.updated_at.should be_nil end + + it "does not embed versions within versions" do + version.versions.should be_empty + end + + context "when saving multiple times" do + + before do + page.update_attribute(:title, "3") + end + + it "does not embed versions within versions" do + version.versions.should be_empty + end + + it "does not embed versions multiple levels deep" do + page.versions.last.versions.should be_empty + end + end end context "when the document has not changed" do
Specs to show versions are not being created inside versions on current master. Closes #<I>.
mongodb_mongoid
train
rb
e1f3e6470ae35e192b2928c2b3b75265e9b28bbe
diff --git a/rinoh/dimension.py b/rinoh/dimension.py index <HASH>..<HASH> 100644 --- a/rinoh/dimension.py +++ b/rinoh/dimension.py @@ -103,10 +103,12 @@ class DimensionBase(AttributeType, metaclass=DimensionType): return super().check_type(value) or value == 0 REGEX = re.compile(r"""(?P<value> - \d*.?\d+ # integer or float value + [+-]? # optional sign + \d*.?\d+ # integer or float value ) + \s* # optional space between value & unit (?P<unit> - [a-z%]* # unit (can be an empty string) + [a-z%]* # unit (can be an empty string) ) """, re.IGNORECASE | re.VERBOSE)
Dimension parsing: support sign and space
brechtm_rinohtype
train
py
f73ffa057cd7d70daebf3019f676abf2b54e3f9e
diff --git a/spec/downloadr/http_spec.rb b/spec/downloadr/http_spec.rb index <HASH>..<HASH> 100644 --- a/spec/downloadr/http_spec.rb +++ b/spec/downloadr/http_spec.rb @@ -42,6 +42,21 @@ module Downloader end end + context "when initializing Downloadr::HTTP w/o a download path or uri filename" do + before :each do + @uri = "http://www.google.com" + end + + subject{@http_downloadr} + + it "should have the right uri" do + expect { + Downloadr::HTTP.new(@uri) + }.to raise_error(Downloadr::UnknownDownloadPath) + end + end + + context "when downloading a file via HTTP" do before :each do @download_path = Tempfile.new('downloadr')
Add unit-test for unknown download path
claudijd_downloadr
train
rb
62e471d1ab445b94746c869865faba2caa76d36b
diff --git a/faker/providers/phone_number/zh_TW/__init__.py b/faker/providers/phone_number/zh_TW/__init__.py index <HASH>..<HASH> 100644 --- a/faker/providers/phone_number/zh_TW/__init__.py +++ b/faker/providers/phone_number/zh_TW/__init__.py @@ -2,12 +2,13 @@ from __future__ import unicode_literals from .. import Provider as PhoneNumberProvider +# phone number from https://en.wikipedia.org/wiki/Telephone_numbers_in_Taiwan class Provider(PhoneNumberProvider): - formats = ("(##) %#######", - "##-%#######", - "### %#######", + formats = ("(0#) %#######", + "0#-%#######", + "0## %#######", "09########", "09##-######", - "##-%######", - "## %######") + "0#-%######", + "0# %######")
modified zh_TW phone number for a more valid format
joke2k_faker
train
py
05b4c32908fbc5914f930f912a5053e4f5f9e60c
diff --git a/examples/pytorch/question-answering/run_qa_no_trainer.py b/examples/pytorch/question-answering/run_qa_no_trainer.py index <HASH>..<HASH> 100755 --- a/examples/pytorch/question-answering/run_qa_no_trainer.py +++ b/examples/pytorch/question-answering/run_qa_no_trainer.py @@ -791,7 +791,7 @@ def main(): if not args.pad_to_max_length: # necessary to pad predictions and labels for being gathered start_logits = accelerator.pad_across_processes(start_logits, dim=1, pad_index=-100) - end_logits = accelerator.pad_across_processes(start_logits, dim=1, pad_index=-100) + end_logits = accelerator.pad_across_processes(end_logits, dim=1, pad_index=-100) all_start_logits.append(accelerator.gather(start_logits).cpu().numpy()) all_end_logits.append(accelerator.gather(end_logits).cpu().numpy())
fixed a typo (#<I>)
huggingface_pytorch-pretrained-BERT
train
py
b3cd3bbfe8e919e497b290bf50acd9a4fe303f5d
diff --git a/app/Http/Middleware/DoHousekeeping.php b/app/Http/Middleware/DoHousekeeping.php index <HASH>..<HASH> 100644 --- a/app/Http/Middleware/DoHousekeeping.php +++ b/app/Http/Middleware/DoHousekeeping.php @@ -34,10 +34,7 @@ use function assert; */ class DoHousekeeping implements MiddlewareInterface { - // Delete cache files after 1 hour. - private const MAX_CACHE_AGE = 60 * 60; - - // Delete thumnnails after 90 days. + // Delete thumbnails after 90 days. private const MAX_THUMBNAIL_AGE = 60 * 60 * 24 * 90; // Delete files in /data/tmp after 1 hour. @@ -100,12 +97,10 @@ class DoHousekeeping implements MiddlewareInterface */ private function runHousekeeping(FilesystemInterface $data_filesystem, FilesystemInterface $root_filesystem): void { - // Clear files in the (user-specified) data folder - which might not be local files - $this->housekeeping_service->deleteOldFiles($data_filesystem, 'cache', self::MAX_CACHE_AGE); - + // Clear old thumbnails $this->housekeeping_service->deleteOldFiles($data_filesystem, 'thumbnail-cache', self::MAX_THUMBNAIL_AGE); - // Clear files in /data - which need to be local files + // Clear temporary files $this->housekeeping_service->deleteOldFiles($root_filesystem, self::TMP_DIR, self::MAX_TMP_FILE_AGE); // Clear entries in database tables
Fix: cache files cleaned up in two different places
fisharebest_webtrees
train
php
5176771e8b0241444b54d99e3f9852b176a2d271
diff --git a/core/src/main/java/com/google/common/truth/super/com/google/common/truth/Platform.java b/core/src/main/java/com/google/common/truth/super/com/google/common/truth/Platform.java index <HASH>..<HASH> 100644 --- a/core/src/main/java/com/google/common/truth/super/com/google/common/truth/Platform.java +++ b/core/src/main/java/com/google/common/truth/super/com/google/common/truth/Platform.java @@ -17,6 +17,7 @@ package com.google.common.truth; import static com.google.common.truth.StringUtil.format; +import com.google.common.truth.Truth.AssertionErrorWithCause; import java.util.LinkedHashSet; import java.util.Set; import jsinterop.annotations.JsPackage; @@ -56,10 +57,8 @@ final class Platform { static AssertionError comparisonFailure( String message, String expected, String actual, Throwable cause) { - AssertionError failure = - new AssertionError(format("%s expected:<[%s]> but was:<[%s]>", message, expected, actual)); - failure.initCause(cause); // Not affected by Android bug - return failure; + throw new AssertionErrorWithCause( + format("%s expected:<[%s]> but was:<[%s]>", message, expected, actual), cause); } /** Determines if the given subject contains a match for the given regex. */
Use AssertionErrorWithCause from GWT, too. It saves us the trouble of manually calling initCause() and leaving a comment. More importantly, if we start omitting "java.lang.AssertionError: " failure messages, as I hope to do, this CL ensures that the change will happen in GWT, too. [] RELNOTES=n/a ------------- Created by MOE: <URL>
google_truth
train
java
b6cc6831330ea7e33d396e56635f4de96892e7b7
diff --git a/public/javascripts/admin/tabcontrol.js b/public/javascripts/admin/tabcontrol.js index <HASH>..<HASH> 100644 --- a/public/javascripts/admin/tabcontrol.js +++ b/public/javascripts/admin/tabcontrol.js @@ -27,7 +27,8 @@ var TabControl = Class.create({ var tab = new TabControl.Tab(page); this.tabs.push(tab); this.tabContainer.insert({bottom: tab}); - $('page_part_index_field').setValue(this.tabs.length); + var part_index = $('page_part_index_field'); + part_index.setValue(Number(part_index.value)+1); page.hide(); }, @@ -119,4 +120,4 @@ TabControl.Tab = Class.create({ } }); -var TabControls = {}; \ No newline at end of file +var TabControls = {};
Make sure part attribute indexes are unique (closes gh-<I>)
radiant_radiant
train
js
33109a27182a393f25beef3690dbf0c479113dc0
diff --git a/script/bootstrap.py b/script/bootstrap.py index <HASH>..<HASH> 100755 --- a/script/bootstrap.py +++ b/script/bootstrap.py @@ -99,16 +99,24 @@ def update_node_modules(dirname, env=None): if env is None: env = os.environ if PLATFORM == 'linux': + # Use prebuilt clang for building native modules. llvm_dir = os.path.join(SOURCE_ROOT, 'vendor', 'llvm-build', 'Release+Asserts', 'bin') env['CC'] = os.path.join(llvm_dir, 'clang') env['CXX'] = os.path.join(llvm_dir, 'clang++') env['npm_config_clang'] = '1' with scoped_cwd(dirname): + args = [NPM, 'install'] if is_verbose_mode(): - execute_stdout([NPM, 'install', '--verbose'], env) + args += '--verbose' + # Ignore npm install errors when running in CI. + if os.environ.has_key('CI'): + try: + execute_stdout(args, env) + except: + pass else: - execute_stdout([NPM, 'install'], env) + execute_stdout(args, env) def update_electron_modules(dirname, target_arch):
Ignore npm install errors when running in CI
electron_electron
train
py
8bcc705490915ee54ef88844089e018305c3c3a2
diff --git a/creep/src/targets/ssh.py b/creep/src/targets/ssh.py index <HASH>..<HASH> 100755 --- a/creep/src/targets/ssh.py +++ b/creep/src/targets/ssh.py @@ -18,7 +18,7 @@ class SSHTarget: self.tunnel = ['ssh', '-T', '-p', str (port or 22)] + extra + [remote] def read (self, logger, relative): - command = '! test -f \'{0}\' || cat \'{0}\''.format (pipes.quote (self.directory + '/' + relative)) + command = 'test -d \'{0}\' && ( test ! -f \'{1}\' || cat \'{1}\' )'.format (pipes.quote (self.directory), pipes.quote (self.directory + '/' + relative)) result = Process (self.tunnel + [command]).execute () if not result:
Detect missing directory in SSH target.
r3c_creep
train
py
368d2cb2ccfb82d9692d560fbb5dca1cf76c90d1
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -1,5 +1,9 @@ +import re +import io +import os from setuptools import setup + def readme(): with open('README.rst') as f: return f.read()
Read version from __init__ in setup.py
phuijse_P4J
train
py
3b76f82d47732f6d9378ade276b32a1488c01a7f
diff --git a/server/links.go b/server/links.go index <HASH>..<HASH> 100644 --- a/server/links.go +++ b/server/links.go @@ -12,8 +12,8 @@ type getExternalLinksResponse struct { // CustomLink is a handler that returns a custom link to be used in server's routes response, within ExternalLinks type CustomLink struct { - Name string `json:"name,omitempty"` - URL string `json:"url,omitempty"` + Name string `json:"name"` + URL string `json:"url"` } // NewCustomLinks transforms `--custom-link` CLI flag data or `CUSTOM_LINKS` ENV
Remove omitempty from CustomLink definition since should never b
influxdata_influxdb
train
go
b3ed4f28f4cc44aa6c4612c24a0365ae01488d6c
diff --git a/tests/helpers/collection_helper.rb b/tests/helpers/collection_helper.rb index <HASH>..<HASH> 100644 --- a/tests/helpers/collection_helper.rb +++ b/tests/helpers/collection_helper.rb @@ -50,7 +50,7 @@ def collection_tests(collection, params = {}, mocks_implemented = true) end tests("#get('#{@identity}')").returns(nil) do - pending if Fog.mocking? && !mocks_implemented + pending if !Fog.mocking? || mocks_implemented collection.get(@identity) end
The condition here should be the same as for destroying, so that we test iff the instance gets destroyed
fog_fog
train
rb
44d0c15a40501c9374608411014730fc24b061bc
diff --git a/lib/god/simple_logger.rb b/lib/god/simple_logger.rb index <HASH>..<HASH> 100644 --- a/lib/god/simple_logger.rb +++ b/lib/god/simple_logger.rb @@ -32,7 +32,7 @@ module God time = Time.now.strftime(self.datetime_format) label = SEV_LABEL[level] - @io.puts("#{label[0..0]} [#{time}] #{label.rjust(5)}: #{msg}") + @io.print("#{label[0..0]} [#{time}] #{label.rjust(5)}: #{msg}\n") end def fatal(msg)
Fix bug when writing using IO.puts with different threads. IO.puts will write each passed argument using a record separator, tipically a newline. This might lead to the situation where a different thread also writes to the same stream before writing the newline, which in turn will print a message right next to the other.
mojombo_god
train
rb
928a1a443d960f338969446d7495dd0c0025f0b0
diff --git a/spec/lib/bootsy_spec.rb b/spec/lib/bootsy_spec.rb index <HASH>..<HASH> 100644 --- a/spec/lib/bootsy_spec.rb +++ b/spec/lib/bootsy_spec.rb @@ -12,7 +12,16 @@ describe Bootsy do end describe 'default values' do - its(:editor_options) { should == {} } + describe '.editor_options' do + subject { Bootsy.editor_options } + + it { should include(font_styles: true) } + it { should include(lists: true) } + it { should include(emphasis: true) } + it { should include(html: false) } + it { should include(image: true) } + it { should include(color: true) } + end its(:image_versions_available) { should == [:small, :medium, :large, :original] } @@ -29,4 +38,4 @@ describe Bootsy do its(:store_dir) { should == 'uploads' } end -end \ No newline at end of file +end
Fix expectation for `Bootsy.editor_options`.
volmer_bootsy
train
rb
83139a6d658f3ec26d1a9259c131da1227745542
diff --git a/angr/analyses/decompiler/decompilation_cache.py b/angr/analyses/decompiler/decompilation_cache.py index <HASH>..<HASH> 100644 --- a/angr/analyses/decompiler/decompilation_cache.py +++ b/angr/analyses/decompiler/decompilation_cache.py @@ -1,5 +1,6 @@ from typing import Optional, Set, Dict, TYPE_CHECKING +from .clinic import Clinic from .structured_codegen import BaseStructuredCodeGenerator @@ -11,3 +12,4 @@ class DecompilationCache: self.type_constraints: Optional[Set] = None self.var_to_typevar: Optional[Dict] = None self.codegen: Optional[BaseStructuredCodeGenerator] = None + self.clinic: Optional[Clinic] = None diff --git a/angr/analyses/decompiler/decompiler.py b/angr/analyses/decompiler/decompiler.py index <HASH>..<HASH> 100644 --- a/angr/analyses/decompiler/decompiler.py +++ b/angr/analyses/decompiler/decompiler.py @@ -128,6 +128,7 @@ class Decompiler(Analysis): self.codegen = codegen self.cache.codegen = codegen + self.clinic = clinic def _set_global_variables(self):
cache clinic objects (vars and graph) for use in AIL graph (#<I>)
angr_angr
train
py,py
404a96b0f8f0d5721f5dfe547e439046073ff52f
diff --git a/api/quota.go b/api/quota.go index <HASH>..<HASH> 100644 --- a/api/quota.go +++ b/api/quota.go @@ -51,7 +51,7 @@ func changeUserQuota(w http.ResponseWriter, r *http.Request, t auth.Token) error func getAppQuota(w http.ResponseWriter, r *http.Request, t auth.Token) error { user, err := t.User() - a, err := getApp(r.URL.Query().Get(":appname"), user, r) + a, err := getApp(r.URL.Query().Get(":appname"), user) if err != nil { return err }
Fixing the method getApp, removing the unnecessary argument. related to #<I>
tsuru_tsuru
train
go
4a14aad5ae23e1bc18968fd4cf70cbd8fa9db03e
diff --git a/pyup/bot.py b/pyup/bot.py index <HASH>..<HASH> 100644 --- a/pyup/bot.py +++ b/pyup/bot.py @@ -3,7 +3,7 @@ from __future__ import absolute_import, print_function, unicode_literals import logging from .requirements import RequirementsBundle from .providers.github import Provider as GithubProvider -from .errors import NoPermissionError +from .errors import NoPermissionError, BranchExistsError logger = logging.getLogger(__name__) @@ -160,12 +160,17 @@ class Bot(object): def commit_and_pull(self, initial, base_branch, new_branch, title, body, updates): - # create new branch - self.provider.create_branch( - base_branch=base_branch, - new_branch=new_branch, - repo=self.user_repo - ) + try: + # create new branch + self.provider.create_branch( + base_branch=base_branch, + new_branch=new_branch, + repo=self.user_repo + ) + except BranchExistsError as e: + # instead of failing loud if the branch already exists, we are going to return + # None here and handle this case on a different layer. + return None updated_files = {} for update in self.iter_changes(initial, updates):
return None instead of failing with an exception if a branch exists
pyupio_pyup
train
py
94f31b194888e93893d63c74f37fa7e924d0bdc5
diff --git a/packages/cli/lib/lib/webpack/run-webpack.js b/packages/cli/lib/lib/webpack/run-webpack.js index <HASH>..<HASH> 100644 --- a/packages/cli/lib/lib/webpack/run-webpack.js +++ b/packages/cli/lib/lib/webpack/run-webpack.js @@ -90,12 +90,17 @@ async function prodBuild(env) { } let clientCompiler = webpack(config); - let stats = await runCompiler(clientCompiler); - // Timeout for plugins that work on `after-emit` event of webpack - await new Promise(r => setTimeout(r, 20)); + try { + let stats = await runCompiler(clientCompiler); - return showStats(stats, true); + // Timeout for plugins that work on `after-emit` event of webpack + await new Promise(r => setTimeout(r, 20)); + + return showStats(stats, true); + } catch (error) { + console.log(error); + } } function runCompiler(compiler) { @@ -104,7 +109,7 @@ function runCompiler(compiler) { showStats(stats, true); if (err || (stats && stats.hasErrors())) { - rej(red('Build failed! ' + (err || ''))); + rej(`${red('\n\nBuild failed! \n\n')} ${err || ''}`); } res(stats);
chore: Log build errors (#<I>) * chore: Display babel build errors during build time * beauitfy log output
developit_preact-cli
train
js
d1cbe167e49ec248d1430999be984f4df3d58b2f
diff --git a/gobblin-admin/src/main/web/js/models/job-execution.js b/gobblin-admin/src/main/web/js/models/job-execution.js index <HASH>..<HASH> 100644 --- a/gobblin-admin/src/main/web/js/models/job-execution.js +++ b/gobblin-admin/src/main/web/js/models/job-execution.js @@ -87,7 +87,10 @@ var app = app || {} }, getRecordsRead: function () { if (this.hasMetrics()) { - var recordsRead = $.grep(this.attributes.metrics, function (e) { return e.name === 'gobblin.extractor.records.read' }) + var recordsRead = $.grep( + this.attributes.metrics, function (e) { + return e.name.match(/JOB.*\.records$/)} + ) if (recordsRead.length === 1) { var val = parseFloat(recordsRead[0].value) if (!isNaN(val)) {
Pull the right metric in the job summary page
apache_incubator-gobblin
train
js
67a0cc36939df247d21bd9b708107f3512a4fa23
diff --git a/spinoff/util/testing/control.py b/spinoff/util/testing/control.py index <HASH>..<HASH> 100644 --- a/spinoff/util/testing/control.py +++ b/spinoff/util/testing/control.py @@ -3,7 +3,7 @@ from __future__ import print_function import abc from pickle import PicklingError -from twisted.internet.defer import Deferred +from twisted.internet.defer import Deferred, inlineCallbacks, returnValue from spinoff.util.async import sleep, after @@ -260,18 +260,21 @@ class Buffer(object): else: self.queue.append(arg) + @inlineCallbacks def expect(self, times=1): """If times > 1, returns `None`.""" - if self.queue: - return self.queue.pop(0) - else: - self.d = Deferred() - return self.d - if times > 1: - self.expect(times - 1) - - @property - def is_empty(self): + for _ in range(times): + if self.queue: + ret = self.queue.pop(0) + if times == 1: + returnValue(ret) + else: + self.d = Deferred() + ret = yield self.d + if times == 1: + returnValue(ret) + + def expect_not(self): """If the queue is not empty, returns False immediately, otherwise a Deferred that fires a bit later and whose result is True or False depending on whether the queue is still empty when the Deferred fires or not.
Renamed util.testing.control.Buffer.is_empty => expect_not and made it a method; fixed Buffer.expect when times > 1
eallik_spinoff
train
py
466d44ff13f1b9c7a5f31f6d61cc192ce05d189b
diff --git a/lib/nunes/subscriber.rb b/lib/nunes/subscriber.rb index <HASH>..<HASH> 100644 --- a/lib/nunes/subscriber.rb +++ b/lib/nunes/subscriber.rb @@ -49,9 +49,7 @@ module Nunes # # Returns nothing. def increment(metric) - if @adapter - @adapter.increment metric - end + @adapter.increment metric end # Internal: Track the timing of a metric for the client. @@ -61,9 +59,7 @@ module Nunes # # Returns nothing. def timing(metric, duration_in_ms) - if @adapter - @adapter.timing metric, duration_in_ms - end + @adapter.timing metric, duration_in_ms end end end
Remove if-condition since ivar adapter can't be nil.
jnunemaker_nunes
train
rb