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
8b0fea29f152be10817888bd05a928d5476736a8
diff --git a/test/test-state.js b/test/test-state.js index <HASH>..<HASH> 100644 --- a/test/test-state.js +++ b/test/test-state.js @@ -36,8 +36,8 @@ tape('state setup', function(t){ files.write(file2, '3.1', { position: 4 }), - files.write(file2, '18', { - position: 28 + files.write(file2, '52', { + position: 63 }), files.writeFile(file3, 'foo\nbar\n') ]);
change <I> to <I>
thisconnect_nodegit-kit
train
js
8fdc41a02b837517c173dd6757642ba7238da8c4
diff --git a/swipe.js b/swipe.js index <HASH>..<HASH> 100644 --- a/swipe.js +++ b/swipe.js @@ -67,6 +67,7 @@ Swipe.prototype = { if (!this.width) return null; // hide slider element but keep positioning during setup + var origVisibility = this.container.style.visibility; this.container.style.visibility = 'hidden'; // dynamic css @@ -82,8 +83,8 @@ Swipe.prototype = { // set start position and force translate to remove initial flickering this.slide(this.index, 0); - // show slider element - this.container.style.visibility = 'visible'; + // restore the visibility of the slider element + this.container.style.visibility = origVisibility; },
Now restores the visibility state of the slider element on completion of setup
lyfeyaj_swipe
train
js
0a1bcae6e5b2ab19307410f15c7921ca1afbc22d
diff --git a/lib/rspec_command.rb b/lib/rspec_command.rb index <HASH>..<HASH> 100644 --- a/lib/rspec_command.rb +++ b/lib/rspec_command.rb @@ -24,6 +24,7 @@ require 'rspec_command/match_fixture' # An RSpec helper module for testing command-line tools. # +# @api public # @since 1.0.0 # @example Enable globally # RSpec.configure do |config| @@ -45,23 +46,24 @@ module RSpecCommand end # @!attribute [r] temp_path - # Path to the temporary directory created for the current example. - # @return [String] + # Path to the temporary directory created for the current example. + # @return [String] let(:temp_path) do |example| example.metadata[:rspec_command_temp_path] end # @!attribute [r] fixture_root - # Base path for the fixtures directory. Default value is 'fixtures'. - # @return [String] - # @example - # let(:fixture_root) { 'data' } + # Base path for the fixtures directory. Default value is 'fixtures'. + # @return [String] + # @example + # let(:fixture_root) { 'data' } let(:fixture_root) { 'fixtures' } # @!attribute [r] _environment - # @!visibility private - # Accumulator for environment variables. - # @see RSpecCommand.environment + # @!visibility private + # @api private + # Accumulator for environment variables. + # @see RSpecCommand.environment let(:_environment) { Hash.new } # Matcher to compare files or folders from the temporary directory to a
Trying to do docs correctly.
coderanger_rspec-command
train
rb
1a43ed3dd863dfe0fc16a21466abd12add45311f
diff --git a/src/Models/MenuItem.php b/src/Models/MenuItem.php index <HASH>..<HASH> 100644 --- a/src/Models/MenuItem.php +++ b/src/Models/MenuItem.php @@ -41,7 +41,8 @@ class MenuItem extends Model public function children() { return $this->hasMany(Voyager::modelClass('MenuItem'), 'parent_id') - ->with('children'); + ->with('children') + ->orderBy('order'); } public function menu()
Fix menu items display order (#<I>) #### Menu items display order In a given nested menu Child menu items are not ordered by "order" column.
the-control-group_voyager
train
php
02b5d754bf7f80ae0fff4409b691970b777edc49
diff --git a/_data.py b/_data.py index <HASH>..<HASH> 100644 --- a/_data.py +++ b/_data.py @@ -289,8 +289,8 @@ class databox: # highly confusing behavior, numpy! if len(_n.shape(z)) == 1: # check to make sure the data file contains only 1 column of data - total_data_line_number = len(lines) - first_data_line - if total_data_line_number == 1: z = _n.array([z]) + rows_of_data = len(lines) - first_data_line + if rows_of_data == 1: z = _n.array([z]) else: z = _n.array(z) # fix for different behavior of genfromtxt on single columns
changed a variable name for clarity changed total_data_line_number to rows_of_data
Spinmob_spinmob
train
py
dda81cb177078cce44bf2a81a70b0baa5c9d9ad7
diff --git a/actionpack/lib/action_view/helpers/number_helper.rb b/actionpack/lib/action_view/helpers/number_helper.rb index <HASH>..<HASH> 100644 --- a/actionpack/lib/action_view/helpers/number_helper.rb +++ b/actionpack/lib/action_view/helpers/number_helper.rb @@ -445,6 +445,8 @@ module ActionView #for backwards compatibility with those that didn't add strip_insignificant_zeros to their locale files options[:strip_insignificant_zeros] = true if not options.key?(:strip_insignificant_zeros) + inverted_du = DECIMAL_UNITS.invert + units = options.delete :units unit_exponents = case units when Hash @@ -455,7 +457,7 @@ module ActionView I18n.translate(:"number.human.decimal_units.units", :locale => options[:locale], :raise => true) else raise ArgumentError, ":units must be a Hash or String translation scope." - end.keys.map{|e_name| DECIMAL_UNITS.invert[e_name] }.sort_by{|e| -e} + end.keys.map{|e_name| inverted_du[e_name] }.sort_by{|e| -e} number_exponent = number != 0 ? Math.log10(number.abs).floor : 0 display_exponent = unit_exponents.find{|e| number_exponent >= e }
lets not invert the hash on every iteration through this loop
rails_rails
train
rb
d7e11b3ed61f39f08ca88f927091e77d638e674f
diff --git a/docs/examples/http_exceptions.py b/docs/examples/http_exceptions.py index <HASH>..<HASH> 100644 --- a/docs/examples/http_exceptions.py +++ b/docs/examples/http_exceptions.py @@ -18,7 +18,7 @@ class HttpEntrypoint(HttpRequestHandler): response = Response( json.dumps({ 'error': exc.error_code, - 'message': unicode(exc), + 'message': str(exc), }), status=exc.status_code, mimetype='application/json'
Changed example to use str() for p3 compatibility.
nameko_nameko
train
py
741df9e1ff4e3f40ed4b5ec43b6e9718e26b2111
diff --git a/packages/scripts/bin/build.js b/packages/scripts/bin/build.js index <HASH>..<HASH> 100755 --- a/packages/scripts/bin/build.js +++ b/packages/scripts/bin/build.js @@ -16,6 +16,7 @@ const { version: packageVersion, peerDependencies = {}, dependencies = {}, + main: mainOutputFile = "build/index.js", module: esOutputFile = "build/index.es.js", css: cssOutputFile = "build/index.es.css" } = packageMeta; @@ -30,6 +31,7 @@ const inputOptions = { plugins: [ nodeResolve(), babel({ + babelrc: false, exclude: [ "**/node_modules/**", "**/*.css", @@ -68,6 +70,11 @@ const esModulesOutputOptions = { format: "es" }; +const cjsOutputOptions = { + file: mainOutputFile, + format: "cjs" +} + async function build() { console.log(`Bundling ${packageName} v${packageVersion}.`); @@ -75,6 +82,7 @@ async function build() { const bundle = await rollup.rollup(inputOptions); bundle.write(esModulesOutputOptions); + bundle.write(cjsOutputOptions); } catch (e) { console.log(e); }
Update build script to output cjs as pkg.main
Autodesk_hig
train
js
e51411937718aabc5557a635bb4a7cfce63a866a
diff --git a/skew/awsclient.py b/skew/awsclient.py index <HASH>..<HASH> 100644 --- a/skew/awsclient.py +++ b/skew/awsclient.py @@ -159,14 +159,5 @@ class AWSClient(object): return data -_client_cache = {} - - def get_awsclient(service_name, region_name, account_id): - global _client_cache - client_key = '{}:{}:{}'.format(service_name, region_name, account_id) - if client_key not in _client_cache: - _client_cache[client_key] = AWSClient(service_name, - region_name, - account_id) - return _client_cache[client_key] + return AWSClient(service_name, region_name, account_id)
Remove the client cache. It doesn't really help much for performance and causes problems for long-running processes. Related to #<I>.
scopely-devops_skew
train
py
1c20496299045ec54fefe28485c23fbf0c5ed4f5
diff --git a/spikewidgets/widgets/unitwaveformswidget/unitwaveformswidget.py b/spikewidgets/widgets/unitwaveformswidget/unitwaveformswidget.py index <HASH>..<HASH> 100644 --- a/spikewidgets/widgets/unitwaveformswidget/unitwaveformswidget.py +++ b/spikewidgets/widgets/unitwaveformswidget/unitwaveformswidget.py @@ -182,7 +182,7 @@ class UnitWaveformsWidget(BaseMultiWidget): self._sorting = sorting self._channel_ids = channel_ids if max_channels is None: - max_channels = len(recording.get_num_channels()) + max_channels = recording.get_num_channels() self._max_channels = max_channels self._unit_ids = unit_ids self._ms_before = ms_before
If max_channels is None use all channels
SpikeInterface_spikewidgets
train
py
2cc665f0df7cf5997b806b48ccbc0005ad073160
diff --git a/PyHardLinkBackup/phlb/filesystem_walk.py b/PyHardLinkBackup/phlb/filesystem_walk.py index <HASH>..<HASH> 100644 --- a/PyHardLinkBackup/phlb/filesystem_walk.py +++ b/PyHardLinkBackup/phlb/filesystem_walk.py @@ -127,9 +127,13 @@ class DirEntryPath: else: self.resolve_error = None - # e.g.: a junction under windows - # https://www.python-forum.de/viewtopic.php?f=1&t=37725&p=290429#p290428 (de) - self.different_path = self.path != self.resolved_path.path + if self.resolved_path is None: + # e.g.: broken symlink under linux + self.different_path = True + else: + # e.g.: a junction under windows + # https://www.python-forum.de/viewtopic.php?f=1&t=37725&p=290429#p290428 (de) + self.different_path = self.path != self.resolved_path.path def pformat(self): return "\n".join((
bugfix in scanner if symlink is broken
jedie_PyHardLinkBackup
train
py
6b2be86053da1ae1c717484a525f37f3e6e73973
diff --git a/salt/version.py b/salt/version.py index <HASH>..<HASH> 100644 --- a/salt/version.py +++ b/salt/version.py @@ -679,18 +679,18 @@ def system_information(): win_ver = platform.win32_ver() # linux_distribution() will return a - # distribution on OS X, only return if - # we are sure we are running on Linux - # and mac_ver is empty. - if lin_ver[0] and not mac_ver[0]: - return " ".join(lin_ver) - elif mac_ver[0]: + # distribution on OS X and Windows. + # Check mac_ver and win_ver first, + # then lin_ver. + if mac_ver[0]: if isinstance(mac_ver[1], (tuple, list)) and "".join(mac_ver[1]): return " ".join([mac_ver[0], ".".join(mac_ver[1]), mac_ver[2]]) else: return " ".join([mac_ver[0], mac_ver[2]]) elif win_ver[0]: return " ".join(win_ver) + elif lin_ver[0]: + return " ".join(lin_ver) else: return ""
swapping order of version checking logic so that lin_ver is last, since distro returns information for both Mac and Windows.
saltstack_salt
train
py
a2d247843efaf292c4b7861ef2ebcf1f6eb9e2bb
diff --git a/test/helpers/kubectl.go b/test/helpers/kubectl.go index <HASH>..<HASH> 100644 --- a/test/helpers/kubectl.go +++ b/test/helpers/kubectl.go @@ -2220,15 +2220,17 @@ func (kub *Kubectl) overwriteHelmOptions(options map[string]string) error { } if !RunsWithKubeProxy() { - nodeIP, err := kub.GetNodeIPByLabel(K8s1, false) - if err != nil { - return fmt.Errorf("Cannot retrieve Node IP for k8s1: %s", err) - } - opts := map[string]string{ "kubeProxyReplacement": "strict", - "k8sServiceHost": nodeIP, - "k8sServicePort": "6443", + } + + if GetCurrentIntegration() != CIIntegrationGKE { + nodeIP, err := kub.GetNodeIPByLabel(K8s1, false) + if err != nil { + return fmt.Errorf("Cannot retrieve Node IP for k8s1: %s", err) + } + opts["k8sServiceHost"] = nodeIP + opts["k8sServicePort"] = "6443" } if RunsOnNetNextOr419Kernel() {
test: Fix kube-proxy-free on GKE due to wrong k8sServiceHost value On GKE, kube-apiserver doesn't run on the first node as in our Jenkins builds, leading to a failure to start Cilium in kube-proxy-free mode. Since kube-proxy is always provisioned on GKE, we don't need to specify k8sServiceHost and k8sServicePort on GKE.
cilium_cilium
train
go
c042653fc0f771adbe97271ed62435dc2c354789
diff --git a/decidim-comments/app/helpers/decidim/comments/comments_helper.rb b/decidim-comments/app/helpers/decidim/comments/comments_helper.rb index <HASH>..<HASH> 100644 --- a/decidim-comments/app/helpers/decidim/comments/comments_helper.rb +++ b/decidim-comments/app/helpers/decidim/comments/comments_helper.rb @@ -29,8 +29,11 @@ module Decidim def react_comments_component(node_id, props) content_tag("div", "", id: node_id) + javascript_tag(%{ - $.getScript('#{asset_path("decidim/comments/comments.js")}') - .then(function () { + jQuery.ajax({ + url: '#{asset_path("decidim/comments/comments.js")}', + dataType: 'script', + cache: true + }).then(function () { window.DecidimComments.renderCommentsComponent( '#{node_id}', {
Fix caching issues with getScript (#<I>)
decidim_decidim
train
rb
437e78fb06d5a9eb1da26678ecba55999c9a5efd
diff --git a/index.js b/index.js index <HASH>..<HASH> 100644 --- a/index.js +++ b/index.js @@ -20,7 +20,7 @@ function gulpNgConfig(moduleName, overridableProperties) { throw new PluginError('gulp-ng-config', 'invaild JSON file provided'); } - jsonObj = _.assign(jsonObj, overridableProperties); + jsonObj = _.merge(jsonObj, overridableProperties); _.each(jsonObj, function (value, key) { constants.push({
replaces extend with merge when overriding config properties
ajwhite_gulp-ng-config
train
js
a315125a0742b01799c89469efd20821540694f6
diff --git a/test/parse.js b/test/parse.js index <HASH>..<HASH> 100644 --- a/test/parse.js +++ b/test/parse.js @@ -3,12 +3,12 @@ var parse = require('../').parse; test('parse shell commands', function (t) { t.same(parse('a \'b\' "c"'), [ 'a', 'b', 'c' ]); - t.same( parse('beep "boop" \'foo bar baz\' "it\'s \\"so\\" groovy"'), [ 'beep', 'boop', 'foo bar baz', 'it\'s "so" groovy' ] ); - t.same(parse('a b\\ c d'), [ 'a', 'b c', 'd' ]); + t.same(parse('\\$beep bo\\`op'), [ '$beep', 'bo`op' ]); + t.end(); });
failing test for unescaped metachars
substack_node-shell-quote
train
js
951f9152ed6fd5b4e95b0d7d350971569b26453f
diff --git a/src/js/Inks/InkTransition.js b/src/js/Inks/InkTransition.js index <HASH>..<HASH> 100644 --- a/src/js/Inks/InkTransition.js +++ b/src/js/Inks/InkTransition.js @@ -18,22 +18,32 @@ export default class InkTransition extends Component { transitionLeaveTimeout: 450, }; + componentWillUnmount() { + if(this.state.timeout) { clearTimeout(this.state.timeout); } + } + componentWillEnter = (done) => { const node = ReactDOM.findDOMNode(this); - setTimeout(() => { + const timeout = setTimeout(() => { node.classList.add('active'); - setTimeout(() => { + const timeout = setTimeout(() => { + this.setState({ timeout: null }); done(); }, this.props.transitionEnterTimeout); + this.setState({ timeout }); }, 25); + + this.setState({ timeout }); }; componentWillLeave = (done) => { const node = ReactDOM.findDOMNode(this); node.classList.add('leaving'); - setTimeout(() => { + const timeout = setTimeout(() => { + this.setState({ timeout: null }); done(); }, this.props.transitionLeaveTimeout); + this.setState({ timeout }); }; render() {
Fixed ink errors when components were unmounting
mlaursen_react-md
train
js
e3c6d78b35a6accc5200f6c094787c85d32cc51c
diff --git a/hazelcast/src/test/java/com/hazelcast/concurrent/lock/LockBasicTest.java b/hazelcast/src/test/java/com/hazelcast/concurrent/lock/LockBasicTest.java index <HASH>..<HASH> 100644 --- a/hazelcast/src/test/java/com/hazelcast/concurrent/lock/LockBasicTest.java +++ b/hazelcast/src/test/java/com/hazelcast/concurrent/lock/LockBasicTest.java @@ -403,7 +403,7 @@ public abstract class LockBasicTest extends HazelcastTestSupport { public void run() throws Exception { assertFalse(lock.isLocked()); } - }, 5); + }, 20); } @Test(expected = NullPointerException.class, timeout = 60000)
Increased assert timeout for lock lease test
hazelcast_hazelcast
train
java
6c41fd52fc567555760b6a88e48bde2ca80bf82e
diff --git a/packages/redux-xlsx/src/saga.js b/packages/redux-xlsx/src/saga.js index <HASH>..<HASH> 100644 --- a/packages/redux-xlsx/src/saga.js +++ b/packages/redux-xlsx/src/saga.js @@ -22,7 +22,7 @@ function readFile(file, columns) { reader.onload = async e => { /** read workbook */ const data = e.target.result; - const wb = XLSX.read(data, { type: "binary" }); + const wb = XLSX.read(data, { type: "binary", cellDates: true }); /** grab first sheet */ const wsname = wb.SheetNames[0];
fix: xlsx-import date (#<I>)
36node_sketch
train
js
3ce04783ac1df949ab384a757f9f1c7301f0def0
diff --git a/tests/bootstrap.php b/tests/bootstrap.php index <HASH>..<HASH> 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -17,7 +17,7 @@ $testDir = getenv('WP_TESTS_DIR'); if (!$testDir) { - $testDir = __DIR__ . '/wp-core-tests'; + $testDir = '/tmp/wordpress-tests-lib'; } require_once $testDir . '/includes/functions.php';
Updated to <I> version
Josantonius_WP_Register
train
php
36867fffe933e14a20aa41d3e030c7dd84034438
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -21,7 +21,7 @@ class PyTest(TestCommand): def run_tests(self): #import here, cause outside the eggs aren't loaded import pytest - err1 = pytest.main([]) + err1 = pytest.main(['--cov', 'natsort', '--flakes', '--pep8']) err2 = pytest.main(['--doctest-modules', 'natsort']) err3 = pytest.main(['README.rst']) return err1 | err2 | err3 @@ -65,7 +65,7 @@ setup( install_requires=REQUIRES, packages=['natsort'], entry_points={'console_scripts': ['natsort = natsort.__main__:main']}, - tests_require=['pytest'], + tests_require=['pytest', 'pytest-pep8', 'pytest-flakes', 'pytest-cov'], cmdclass={'test': PyTest}, description=DESCRIPTION, long_description=LONG_DESCRIPTION,
'python setup.py test' now does coverage and analysis. This was done by adding --cov, --flakes, and --pep8 to the pytest call within setup.py.
SethMMorton_natsort
train
py
82acf95864607b5331ad68bc946e967cd515afba
diff --git a/inc/fetch_cached.php b/inc/fetch_cached.php index <HASH>..<HASH> 100644 --- a/inc/fetch_cached.php +++ b/inc/fetch_cached.php @@ -28,20 +28,22 @@ $filename = $file . '.gz'; } - $modified = filemtime($filename); + if(file_exists($filename)) { - if( - file_exists($filename) && - $modified > time()-2592000 && - $modified >= (int) @file_get_contents($rah_cache['path'] . '/_lastmod.rah') - ) { - header('Content-type: text/html; charset=utf-8'); - - if($encoding) { - header('Content-Encoding: '.$encoding); + $modified = filemtime($filename); + + if( + $modified > time()-2592000 && + $modified >= (int) @file_get_contents($rah_cache['path'] . '/_lastmod.rah') + ) { + header('Content-type: text/html; charset=utf-8'); + + if($encoding) { + header('Content-Encoding: '.$encoding); + } + + die(file_get_contents($filename)); } - - die(file_get_contents($filename)); } if(
File's existence should be checked before getting the modification date.
gocom_rah_cache
train
php
212ff4b66a5d4c533fbccb86069a3a39ea2d0446
diff --git a/addon/components/docs-viewer/x-main/component.js b/addon/components/docs-viewer/x-main/component.js index <HASH>..<HASH> 100644 --- a/addon/components/docs-viewer/x-main/component.js +++ b/addon/components/docs-viewer/x-main/component.js @@ -38,7 +38,7 @@ export default Component.extend({ } } else { let file = appFiles - .filter(file => file.match(/template.(hbs|md)/)) + .filter(file => file.match(/template.+(hbs|md)/)) .find(file => file.match(path)); return `${projectHref}/edit/master/tests/dummy/app/${file}`;
fix regex in x-main I have file `"templates/docs/index.md"` and path `"templates/docs/index.md"` I need the file to be resolved for this path.
ember-learn_ember-cli-addon-docs
train
js
aab23579713141613399605e3bb6a4a25a1c13dd
diff --git a/mode/css/css.js b/mode/css/css.js index <HASH>..<HASH> 100644 --- a/mode/css/css.js +++ b/mode/css/css.js @@ -667,7 +667,7 @@ CodeMirror.defineMode("css", function(config, parserConfig) { "small", "small-caps", "small-caption", "smaller", "soft-light", "solid", "somali", "source-atop", "source-in", "source-out", "source-over", "space", "space-around", "space-between", "spell-out", "square", "square-button", "start", "static", "status-bar", "stretch", "stroke", "sub", - "subpixel-antialiased", "super", "sw-resize", "symbolic", "symbols", "table", + "subpixel-antialiased", "super", "sw-resize", "symbolic", "symbols", "system-ui", "table", "table-caption", "table-cell", "table-column", "table-column-group", "table-footer-group", "table-header-group", "table-row", "table-row-group", "tamil",
[css mode] Add system-ui as value keyword Closes #<I>
codemirror_CodeMirror
train
js
550053fdffeec3799f173cfd51fe35d965f88a6b
diff --git a/lib/date-keywords.js b/lib/date-keywords.js index <HASH>..<HASH> 100644 --- a/lib/date-keywords.js +++ b/lib/date-keywords.js @@ -43,6 +43,16 @@ function DateKeywords (dateKeyword) { const info = parser(param); return makeDate(moment()).add(-1, 'd').add(info.number, info.unit || 'd'); }, + WEEK_BEGIN: function (param) { + if (!param) return makeDate(moment()).startOf('week'); + const info = parser(param); + return makeDate(moment()).startOf('week').add(info.number, info.unit || 'd'); + }, + WEEK_END: function (param) { + if (!param) return makeDate(moment()).endOf('week'); + const info = parser(param); + return makeDate(moment()).endOf('week').add(info.number, info.unit || 'd'); + }, MONTH_BEGIN: function (param) { const date = new Date(); if (!param) return tz.transform(new Date(date.getFullYear(), date.getMonth(), 1), tz.effective);
i5-<I> Date Keyword Case Insensitive Improvements (#<I>)
entrinsik-org_utils
train
js
aa925b7aefbd88b92375ca686879a107b40b41f3
diff --git a/lib/should.js b/lib/should.js index <HASH>..<HASH> 100644 --- a/lib/should.js +++ b/lib/should.js @@ -565,6 +565,21 @@ Assertion.prototype = { , 'expected ' + this.inspect + ' to respond to ' + method + '()' , 'expected ' + this.inspect + ' to not respond to ' + method + '()'); return this; + }, + + /** + * Assert that header `field` has the given `val`. + * + * @param {String} field + * @param {String} val + * @return {Assertion} for chaining + * @api public + */ + + header: function(field, val){ + this.obj.should.have.property('headers'); + this.obj.headers.should.have.property(field.toLowerCase(), val); + return this; } };
Added header(field, val) method
tj_should.js
train
js
62f06891f8d294c704e717b057eec101116ce8fe
diff --git a/sos/jupyter/kernel.js b/sos/jupyter/kernel.js index <HASH>..<HASH> 100644 --- a/sos/jupyter/kernel.js +++ b/sos/jupyter/kernel.js @@ -1600,10 +1600,14 @@ define([ events.on('kernel_connected.Kernel', register_sos_comm); events.on('kernel_connected.Kernel', wrap_execute); events.on('rendered.MarkdownCell', update_toc); - // not sure which event would complete first but I assume that Jupyter - // would load the notebook before it tries to connect to the kernel + // I assume that Jupyter would load the notebook before it tries to connect + // to the kernel, so kernel_connected.kernel is the right time to show toc + // However, it is possible to load a page without rebooting the kernel so + // a notebook_load event seems also to be necessary. It is a bit of + // burden to run show_toc twice but hopefully this provides a more consistent + // user experience. // - // events.on('notebook_loaded.Notebook', show_toc); + events.on('notebook_loaded.Notebook', show_toc); events.on('kernel_connected.Kernel', show_toc); // #550 // kernel_ready.Kernel
Run %roc magic after loading a doc
vatlab_SoS
train
js
75c8dae86199902ae2fb0fb97b9386f24856042e
diff --git a/ddocs.go b/ddocs.go index <HASH>..<HASH> 100644 --- a/ddocs.go +++ b/ddocs.go @@ -10,11 +10,11 @@ import ( type ViewDefinition struct { Map string `json:"map"` - Reduce string `json:"reduce"` + Reduce string `json:"reduce,omitempty"` } type DDocJSON struct { - Language string `json:"language"` + Language string `json:"language,omitempty"` Views map[string]ViewDefinition `json:"views"` }
Suppress empty reduce function. Couchbase server (<I>, at least) errors out if reduce function is empty in a PUT request. So mark optional fields to be suppressed if empty.
couchbase_go-couchbase
train
go
24655086291fc67cb80d67a0d10fff81af21fa96
diff --git a/modules/activiti-engine/src/test/java/org/activiti/examples/mgmt/TablePageQueryTest.java b/modules/activiti-engine/src/test/java/org/activiti/examples/mgmt/TablePageQueryTest.java index <HASH>..<HASH> 100644 --- a/modules/activiti-engine/src/test/java/org/activiti/examples/mgmt/TablePageQueryTest.java +++ b/modules/activiti-engine/src/test/java/org/activiti/examples/mgmt/TablePageQueryTest.java @@ -74,8 +74,15 @@ public class TablePageQueryTest extends PluggableActivitiTestCase { private void verifyTaskNames(String[] expectedTaskNames, List<Map<String, Object>> rowData) { assertEquals(expectedTaskNames.length, rowData.size()); + String columnKey = "NAME_"; + + // mybatis will return the correct case for postgres table columns from version 3.0.6 on + if (processEngineConfiguration.getDatabaseType().equals("postgres")) { + columnKey = "name_"; + } + for (int i=0; i < expectedTaskNames.length; i++) { - assertEquals(expectedTaskNames[i], rowData.get(i).get("NAME_")); + assertEquals(expectedTaskNames[i], rowData.get(i).get(columnKey)); } }
adjust TableData test for proper column name in resultMap from postgres
Activiti_Activiti
train
java
2c9c850b58e05c8770f42edc496040ffe17e5cfc
diff --git a/test/Gitlab/Tests/Api/MergeRequestsTest.php b/test/Gitlab/Tests/Api/MergeRequestsTest.php index <HASH>..<HASH> 100644 --- a/test/Gitlab/Tests/Api/MergeRequestsTest.php +++ b/test/Gitlab/Tests/Api/MergeRequestsTest.php @@ -569,7 +569,6 @@ class MergeRequestsTest extends TestCase $this->assertEquals($expectedArray, $api->approvalState(1, 2)); } - /** * @test */
Apply fixes from StyleCI (#<I>)
m4tthumphrey_php-gitlab-api
train
php
5421e033b63f86251c54a8618dc15608744a2c07
diff --git a/component.go b/component.go index <HASH>..<HASH> 100644 --- a/component.go +++ b/component.go @@ -130,7 +130,7 @@ func RunProc(c interface{}) bool { if hasRecv { // Call the receival handler for this channel handlersDone.Add(1) - if componentMode == ComponentModeAsync { + if componentMode == ComponentModeAsync || componentMode == ComponentModeUndefined && DefaultComponentMode == ComponentModeAsync { go func() { if hasLock { locker.Lock()
Fixes Sync/Async switch.
trustmaster_goflow
train
go
202a0277af2d3ac341879e72bc7e56f1a06d3d71
diff --git a/packages/ember-runtime/lib/mixins/enumerable.js b/packages/ember-runtime/lib/mixins/enumerable.js index <HASH>..<HASH> 100644 --- a/packages/ember-runtime/lib/mixins/enumerable.js +++ b/packages/ember-runtime/lib/mixins/enumerable.js @@ -227,6 +227,7 @@ const Enumerable = Mixin.create({ ``` @method contains + @deprecated Use `Enumerable#includes` instead. See http://emberjs.com/deprecations/v2.x#toc_enumerable-contains @param {Object} obj The object to search for. @return {Boolean} `true` if object is found in enumerable. @public
Update api doc for Enumerable#contains to flag it as deprecated
emberjs_ember.js
train
js
9af94bba15247bd3f40f26e81f37baa1fd69f1b9
diff --git a/lib/webcommentadminlib.py b/lib/webcommentadminlib.py index <HASH>..<HASH> 100644 --- a/lib/webcommentadminlib.py +++ b/lib/webcommentadminlib.py @@ -40,6 +40,32 @@ def getnavtrail(previous = '', ln=CFG_SITE_LANG): navtrail = navtrail + previous return navtrail +def get_nb_reviews(recID): + """ + Return number of reviews of the record recID + """ + query = """SELECT count(*) + FROM cmtRECORDCOMMENT c + WHERE c.id_bibrec = %s and c.star_score > 0 + """ + + res = run_sql(query, (recID,)) + + return res[0][0] + +def get_nb_comments(recID): + """ + Return number of comments of the record recID + """ + query = """SELECT count(*) + FROM cmtRECORDCOMMENT c + WHERE c.id_bibrec = %s and c.star_score = 0 + """ + + res = run_sql(query, (recID,)) + + return res[0][0] + def perform_request_index(ln=CFG_SITE_LANG): """ """ @@ -389,3 +415,5 @@ def query_delete_comment(comID): params1 = (comID,) res1 = run_sql(query1, params1) return int(res1) + +
WebSearch: configurable comment/review links * Optionally, print comment/review links next to the Detailed record links, if a record was commented/reviewed. (Like Cited by links.) (closes: #<I>)
inveniosoftware-attic_invenio-comments
train
py
a2efb29501ebcfda058fb7ee6daaec32f1330577
diff --git a/example/app/app.js b/example/app/app.js index <HASH>..<HASH> 100644 --- a/example/app/app.js +++ b/example/app/app.js @@ -1,7 +1,7 @@ 'use strict' import React, { Component, PropTypes } from 'react' import ReactDOM from 'react-dom' -import Multistep from '../../src/index.js' +import Multistep from 'react-multistep' import { steps } from './js/signup/index.js' class App extends React.Component {
updated example app to require published or linked npm module
srdjan_react-multistep
train
js
12dd5be670dc0db77d3d4b9e751a08178bf47c2c
diff --git a/src/controllers/admin/models.js b/src/controllers/admin/models.js index <HASH>..<HASH> 100644 --- a/src/controllers/admin/models.js +++ b/src/controllers/admin/models.js @@ -22,18 +22,13 @@ exports.columns = function*() { schema = _.get(model, 'options.schema', {}), columnNames = _.get(model, 'options.admin.listView', []); - var columns = [ - { - name: '_id', - type: 'String' - } - ].concat(columnNames.map(function(c) { + var columns = columnNames.map(function(c) { return { name: c, // if we can't get figure out column type then assume it's a string type: _.get(schema[c], 'type', String), } - })); + }); yield this.render('/admin/models/columns', { columns: columns @@ -51,13 +46,11 @@ exports.rows = function*() { columnNames = _.get(model, 'options.admin.listView'); // [a,b,c] => {a:1, b:1, c:1} - var fieldsToInclude = { - _id: 1 - }; - + var fieldsToInclude = {}; _.each(columnNames, function(c) { fieldsToInclude[c] = 1; }); + fieldsToInclude._id = 1; // always include _id field // get data var rows = yield model.find({}, {
always send _id field but don't always show it
waigo_waigo
train
js
38ee31ebcbf7236988114ad4616a9f11751e3471
diff --git a/thefuck/main.py b/thefuck/main.py index <HASH>..<HASH> 100644 --- a/thefuck/main.py +++ b/thefuck/main.py @@ -105,7 +105,7 @@ def fix_command(): def print_alias(entry_point=True): if entry_point: - warn('`thefuck-alias` is deprecated, us `thefuck --alias` instead.') + warn('`thefuck-alias` is deprecated, use `thefuck --alias` instead.') position = 1 else: position = 2
Fix typo in alias warning Fixes a small typo in the deprecated alias warning.
nvbn_thefuck
train
py
4e88a66083979a282e0cd001c7ee00b13a18ec8d
diff --git a/middleman-core/lib/middleman-more/core_extensions/i18n.rb b/middleman-core/lib/middleman-more/core_extensions/i18n.rb index <HASH>..<HASH> 100644 --- a/middleman-core/lib/middleman-more/core_extensions/i18n.rb +++ b/middleman-core/lib/middleman-more/core_extensions/i18n.rb @@ -178,6 +178,15 @@ class Middleman::CoreExtensions::Internationalization < ::Middleman::Extension ::I18n.locale = lang localized_page_id = ::I18n.t("paths.#{page_id}", default: page_id, fallback: []) + localized_path = "" + + File.dirname(path).split('/').each do |path_sub| + next if path_sub == "" + localized_path = "#{localized_path}/#{(::I18n.t("paths.#{path_sub}", default: path_sub).to_s)}" + end + + path = "#{localized_path}/#{File.basename(path)}" + prefix = if (options[:mount_at_root] == lang) || (options[:mount_at_root].nil? && langs[0] == lang) '/' else
Added support for complete path localization
middleman_middleman
train
rb
633652df2af4de7e9b5d2d83bc56b1961cbb041e
diff --git a/src/main/java/com/mapcode/Decoder.java b/src/main/java/com/mapcode/Decoder.java index <HASH>..<HASH> 100755 --- a/src/main/java/com/mapcode/Decoder.java +++ b/src/main/java/com/mapcode/Decoder.java @@ -237,8 +237,8 @@ class Decoder { if (maxx > decodeLimits.getMinX()) { pt.setMaxLonToMicroDeg(maxx); } // better? - if ( pt.getLatDeg()*1000000 > decodeLimits.getMinY() && pt.getLatMicroDeg() < decodeLimits.getMaxY() && - pt.getLonDeg()*1000000 > decodeLimits.getMinX() && pt.getLonMicroDeg() < decodeLimits.getMaxX() && + if ( pt.getLatDeg()*1000000 > decodeLimits.getMinY() && pt.getLatDeg()*1000000 < decodeLimits.getMaxY() && + pt.getLonDeg()*1000000 > decodeLimits.getMinX() && pt.getLonDeg()*1000000 < decodeLimits.getMaxX() && Data.getBoundaries(j).containsPoint(pt)) { result = Point.fromPoint(pt);
<I> Enforce and test that encode(decode(m)) delivers mapcode m back
mapcode-foundation_mapcode-java
train
java
246b261d35c7ea92747e8d6d4b2ef68308cf5215
diff --git a/src/modules/Dropdown/Dropdown.js b/src/modules/Dropdown/Dropdown.js index <HASH>..<HASH> 100644 --- a/src/modules/Dropdown/Dropdown.js +++ b/src/modules/Dropdown/Dropdown.js @@ -203,7 +203,7 @@ export default class Dropdown extends Component { /* eslint-enable no-console */ } - if (!_.isEqual(nextProps.value, this.state.value)) { + if (!_.isEqual(nextProps.value, this.props.value)) { debug('value changed, setting', nextProps.value) this.setValue(nextProps.value) }
fix(Dropdown): compare nextProps to props in cwrp
Semantic-Org_Semantic-UI-React
train
js
82defe805b136c3d8c179e508c16b74411bb3bc6
diff --git a/rc_django/cache_implementation/__init__.py b/rc_django/cache_implementation/__init__.py index <HASH>..<HASH> 100644 --- a/rc_django/cache_implementation/__init__.py +++ b/rc_django/cache_implementation/__init__.py @@ -88,8 +88,9 @@ class TimedCache(object): # This extra step is needed w/ Live resources because # HTTPHeaderDict isn't serializable. header_data = {} - for header in response.headers: - header_data[header] = response.getheader(header) + if response.headers is not None: + for header in response.headers: + header_data[header] = response.getheader(header) cache_entry.headers = header_data cache_entry.time_saved = now
Fix TypeError: None is not iterable
uw-it-aca_uw-restclients-django-utils
train
py
33e22594d7548d66b303eeac9b06cdfba7d8a7ed
diff --git a/core/src/test/java/io/undertow/testutils/DebuggingSlicePool.java b/core/src/test/java/io/undertow/testutils/DebuggingSlicePool.java index <HASH>..<HASH> 100644 --- a/core/src/test/java/io/undertow/testutils/DebuggingSlicePool.java +++ b/core/src/test/java/io/undertow/testutils/DebuggingSlicePool.java @@ -42,6 +42,8 @@ public class DebuggingSlicePool implements Pool<ByteBuffer>{ private final RuntimeException allocationPoint; private final Pooled<ByteBuffer> delegate; private final String label; + private volatile boolean free = false; + private RuntimeException freePoint; public DebuggingBuffer(Pooled<ByteBuffer> delegate, String label) { this.delegate = delegate; @@ -60,12 +62,20 @@ public class DebuggingSlicePool implements Pool<ByteBuffer>{ @Override public void free() { + if(free) { + throw new RuntimeException("Buffer already freed, free point: ", freePoint); + } + freePoint = new RuntimeException("FREE POINT"); + free = true; BUFFERS.remove(this); delegate.free(); } @Override public ByteBuffer getResource() throws IllegalStateException { + if(free) { + throw new RuntimeException("Buffer already freed, free point: ", freePoint); + } return delegate.getResource(); }
Track where buffers are freed in the test suite
undertow-io_undertow
train
java
9abfa9573576fa3970496c3c394f8550e037ddf6
diff --git a/test/spec/ol/sphere.test.js b/test/spec/ol/sphere.test.js index <HASH>..<HASH> 100644 --- a/test/spec/ol/sphere.test.js +++ b/test/spec/ol/sphere.test.js @@ -176,7 +176,7 @@ describe('ol.Sphere.getLength()', function() { it('works for case ' + i, function() { var c = cases[i]; var length = ol.Sphere.getLength(c.geometry, c.options); - expect(length).to.equal(c.length); + expect(length).to.roughlyEqual(c.length, 1e-8); }); });
Compare measured lengths with a tolerance
openlayers_openlayers
train
js
8faf9928ffe6950600a8f36eeca0e15a8f95a0b1
diff --git a/bokeh/server/django/consumers.py b/bokeh/server/django/consumers.py index <HASH>..<HASH> 100644 --- a/bokeh/server/django/consumers.py +++ b/bokeh/server/django/consumers.py @@ -229,7 +229,7 @@ class WSConsumer(AsyncWebsocketConsumer, ConsumerHelper): await self.accept("bokeh") async def disconnect(self, close_code): - pass + self.connection.session.destroy() async def receive(self, text_data) -> None: fragment = text_data
Fix periodic callback not stopping in Django (#<I>)
bokeh_bokeh
train
py
d3555672798173b53fcffec437bcaa89417453dc
diff --git a/src/Http/Controllers/DenyAuthorizationController.php b/src/Http/Controllers/DenyAuthorizationController.php index <HASH>..<HASH> 100644 --- a/src/Http/Controllers/DenyAuthorizationController.php +++ b/src/Http/Controllers/DenyAuthorizationController.php @@ -2,9 +2,9 @@ namespace Laravel\Passport\Http\Controllers; -use Illuminate\Contracts\Routing\ResponseFactory; -use Illuminate\Http\Request; use Illuminate\Support\Arr; +use Illuminate\Http\Request; +use Illuminate\Contracts\Routing\ResponseFactory; class DenyAuthorizationController {
Update DenyAuthorizationController.php
laravel_passport
train
php
00dce916e18bb0b05601d82d734e1cfdc45af140
diff --git a/polyaxon/monitor_statuses/monitor.py b/polyaxon/monitor_statuses/monitor.py index <HASH>..<HASH> 100644 --- a/polyaxon/monitor_statuses/monitor.py +++ b/polyaxon/monitor_statuses/monitor.py @@ -55,15 +55,15 @@ def get_label_selector(): def run(k8s_manager): for (event_object, pod_state) in ocular.monitor(k8s_manager.k8s_api, namespace=settings.K8S_NAMESPACE, - job_container_names=( + container_names=( settings.CONTAINER_NAME_EXPERIMENT_JOB, settings.CONTAINER_NAME_PLUGIN_JOB, settings.CONTAINER_NAME_JOB, settings.CONTAINER_NAME_DOCKERIZER_JOB), label_selector=get_label_selector(), return_event=True): - logger.info('-------------------------------------------\n%s\n', pod_state) - if pod_state: + logger.debug('-------------------------------------------\n%s\n', pod_state) + if not pod_state: continue status = pod_state['status']
Fix update container and call to ocular
polyaxon_polyaxon
train
py
fff097234f886161ca3c5b9b434e8da08fc51aeb
diff --git a/ImapClient/ImapClient.php b/ImapClient/ImapClient.php index <HASH>..<HASH> 100644 --- a/ImapClient/ImapClient.php +++ b/ImapClient/ImapClient.php @@ -115,6 +115,15 @@ class ImapClient } /** + * Get the imap connection + * + * $return imap + */ + public function getImapConnection() { + return $this->imap; + } + + /** * Set connection config * * @param array $config
Add method getImapConnection Used to use other functions
SSilence_php-imap-client
train
php
d62c556110a2b062ae3a777cddf045a69d706ace
diff --git a/backup/util/ui/renderer.php b/backup/util/ui/renderer.php index <HASH>..<HASH> 100644 --- a/backup/util/ui/renderer.php +++ b/backup/util/ui/renderer.php @@ -265,8 +265,7 @@ class core_backup_renderer extends plugin_renderer_base { $hasrestoreoption = false; $html = html_writer::start_tag('div', array('class'=>'backup-course-selector backup-restore')); - if ($wholecourse && !empty($categories) && ($categories->get_count() > 0 || $categories->get_search()) && - $currentcourse != SITEID) { + if ($wholecourse && !empty($categories) && ($categories->get_count() > 0 || $categories->get_search())) { // New course $hasrestoreoption = true; @@ -308,7 +307,7 @@ class core_backup_renderer extends plugin_renderer_base { $courses->invalidate_results(); // Clean list of courses. $courses->set_include_currentcourse(); } - if (!empty($courses) && ($courses->get_count() > 0 || $courses->get_search()) && $currentcourse != SITEID) { + if (!empty($courses) && ($courses->get_count() > 0 || $courses->get_search())) { // Existing course $hasrestoreoption = true; $html .= $form;
MDL-<I> backup: Remove frontpage restore UI restrictions
moodle_moodle
train
php
63e6f377f80c59108944a3c7866347002a152991
diff --git a/index.js b/index.js index <HASH>..<HASH> 100644 --- a/index.js +++ b/index.js @@ -381,6 +381,11 @@ export default class Carousel extends Component { const scrollOffset = this._getScrollOffset(event); const newActiveItem = this._getActiveItem(scrollOffset); const itemsLength = this._positions.length; + const animationCommonOptions = { + isInteraction: false, + useNativeDriver: true, + ...animationOptions + }; let animations = []; this._currentContentOffset = scrollOffset; @@ -404,7 +409,7 @@ export default class Carousel extends Component { animations.push( Animated[animationFunc]( this.state.interpolators[activeItem], - { isInteraction: false, ...animationOptions, toValue: 0 } + { ...animationCommonOptions, toValue: 0 } ) ); } @@ -412,7 +417,7 @@ export default class Carousel extends Component { animations.push( Animated[animationFunc]( this.state.interpolators[newActiveItem], - { isInteraction: false, ...animationOptions, toValue: 1 } + { ...animationCommonOptions, toValue: 1 } ) ); }
feat(module): use native driver for slide's animation This can be overridden via `animationOptions`
archriss_react-native-snap-carousel
train
js
3b8d21af52fdd1abc36b15d52426efe1dc8dab4f
diff --git a/portstat/portstat.py b/portstat/portstat.py index <HASH>..<HASH> 100644 --- a/portstat/portstat.py +++ b/portstat/portstat.py @@ -88,15 +88,17 @@ def upload(portGroups): def main(): - parser = argparse.ArgumentParser() + parser = argparse.ArgumentParser( + description='A simple port traffic monitor') parser.add_argument('-c', '--config', type=str, default='/etc/portstat.conf', help='Path of the config file.') group = parser.add_mutually_exclusive_group() - group.add_argument('-v', '--version', help='Show portstat version.') group.add_argument( - '-s', '--sync', help='Sync the portstat settings and iptables.') + '-v', '--version', help='Show portstat version.', action='store_true') group.add_argument( - '-u', '--upload', help='Upload the port stat with webhook.') + '-s', '--sync', help='Sync the portstat settings and iptables.', action='store_true') + group.add_argument( + '-u', '--upload', help='Upload the port stat with webhook.', action='store_true') args = parser.parse_args() portGroups = getConfig(args.config) if args.version:
Fix some problem in argparse
imlonghao_portstat
train
py
ae70cea79afff1093fc8369ebb6e4e4ca3c40c38
diff --git a/test/unit/org/apache/cassandra/locator/RackUnawareStrategyTest.java b/test/unit/org/apache/cassandra/locator/RackUnawareStrategyTest.java index <HASH>..<HASH> 100644 --- a/test/unit/org/apache/cassandra/locator/RackUnawareStrategyTest.java +++ b/test/unit/org/apache/cassandra/locator/RackUnawareStrategyTest.java @@ -14,8 +14,6 @@ import org.apache.cassandra.net.EndPoint; public class RackUnawareStrategyTest { - // TODO fix these - /* @Test public void testBigIntegerStorageEndPoints() { @@ -55,7 +53,7 @@ public class RackUnawareStrategyTest List<EndPoint> hosts = new ArrayList<EndPoint>(); for (int i = 0; i < endPointTokens.length; i++) { - EndPoint ep = new EndPoint(String.valueOf(i), 7001); + EndPoint ep = new EndPoint("127.0.0." + String.valueOf(i + 1), 7001); tmd.update(endPointTokens[i], ep); hosts.add(ep); } @@ -70,5 +68,4 @@ public class RackUnawareStrategyTest } } } - */ }
fix RackUnawareStrategyTest -- endpoint asserts 'host' is an ip address (to make sure we're not mixing hostnames in again) so create a suitable fake IP for the test. patch by jbellis for CASSANDRA-<I> git-svn-id: <URL>
Stratio_stratio-cassandra
train
java
5ae46f50e500283121b564c7b1680423c3dc071f
diff --git a/ake.go b/ake.go index <HASH>..<HASH> 100644 --- a/ake.go +++ b/ake.go @@ -288,12 +288,16 @@ func (ake *AKE) sigMessage() ([]byte, error) { func (ake *AKE) processDHKey(in []byte) (isSame bool, err error) { _, gy := extractMPI(in, 0) - if gy.Cmp(g1) < 0 || gy.Cmp(pMinusTwo) > 0 { + if lt(gy, g1) || gt(gy, pMinusTwo) { err = errors.New("otr: DH value out of range") return } + + //NOTE: This keeps only the first Gy received + //Not sure if this is part of the spec, + //or simply a crypto/otr safeguard if ake.gy != nil { - isSame = ake.gy.Cmp(gy) == 0 + isSame = eq(ake.gy, gy) return } ake.gy = gy
Refactor to bigInt helpers
coyim_otr3
train
go
de801c5d1df199569c1617269ae745652f51f6cc
diff --git a/pydas/drivers.py b/pydas/drivers.py index <HASH>..<HASH> 100644 --- a/pydas/drivers.py +++ b/pydas/drivers.py @@ -589,6 +589,23 @@ class CoreDriver(BaseDriver): response = self.request('midas.item.searchbyname', parameters) return response['items'] + def search_item_by_name_and_folder_name(self, name, folder_name, token=None): + """Return all items with a given name and parent folder name. + + :param name: The name of the item to search by. + :param folder_name: The name of the parent folder to search by. + :param token: (optional) A valid token for the user in question. + + :returns: A list of all items with the given name and parent folder name. + """ + parameters = dict() + parameters['name'] = name + parameters['folderName'] = folder_name + if token: + parameters['token'] = token + response = self.request('midas.item.searchbynameandfoldername', parameters) + return response['items'] + def create_link(self, token, folder_id, url, **kwargs): """Create a link bitstream.
Add a method for searching by item and folder name
midasplatform_pydas
train
py
e2690da2b5993074634c8d97f8d25d34ed0209d4
diff --git a/tests/unit/core/ProjectTest.py b/tests/unit/core/ProjectTest.py index <HASH>..<HASH> 100644 --- a/tests/unit/core/ProjectTest.py +++ b/tests/unit/core/ProjectTest.py @@ -270,7 +270,7 @@ class ProjectTest: assert ~sp.any([len(item.props()) for item in proj]) proj._fetch_data() assert sp.any([len(item.props()) for item in proj]) - os.remove(self.proj.name+'.hdf5') + os.remove(proj.name+'.hdf5') if __name__ == '__main__':
fixing file delete due to wrong object name
PMEAL_OpenPNM
train
py
52ad4e9f0d194094b17bf1c9e6b0f0632f5a8702
diff --git a/tests/test_protection_levels.py b/tests/test_protection_levels.py index <HASH>..<HASH> 100644 --- a/tests/test_protection_levels.py +++ b/tests/test_protection_levels.py @@ -52,14 +52,16 @@ class TestProtectionLevels(common.TrezorTest): def test_get_public_key(self): with self.client: self.setup_mnemonic_pin_passphrase() - self.client.set_expected_responses([proto.PassphraseRequest(), + self.client.set_expected_responses([proto.PinMatrixRequest(), + proto.PassphraseRequest(), proto.PublicKey()]) self.client.get_public_node([]) def test_get_address(self): with self.client: self.setup_mnemonic_pin_passphrase() - self.client.set_expected_responses([proto.PassphraseRequest(), + self.client.set_expected_responses([proto.PinMatrixRequest(), + proto.PassphraseRequest(), proto.Address()]) self.client.get_address('Bitcoin', [])
update get_public_key and get_address tests to reflect reality
trezor_python-trezor
train
py
4c3626e0df8a0f0e64bc1e3963a5bbd73b18d786
diff --git a/bt/core.py b/bt/core.py index <HASH>..<HASH> 100644 --- a/bt/core.py +++ b/bt/core.py @@ -113,6 +113,13 @@ class Node(object): res.extend(c.members()) return res + @property + def full_name(self): + if self.parent == self: + return self.name + else: + return '%s>%s' % (self.parent.full_name, self.name) + class StrategyBase(Node): diff --git a/tests/test_core.py b/tests/test_core.py index <HASH>..<HASH> 100644 --- a/tests/test_core.py +++ b/tests/test_core.py @@ -60,6 +60,16 @@ def test_node_members(): assert s2 in actual +def test_node_full_name(): + s1 = SecurityBase('s1') + s2 = SecurityBase('s2') + s = StrategyBase('p', [s1, s2]) + + assert s.full_name == 'p' + assert s1.full_name == 'p>s1' + assert s2.full_name == 'p>s2' + + def test_security_setup_prices(): c1 = SecurityBase('c1') c2 = SecurityBase('c2')
Added full_name property to node
pmorissette_bt
train
py,py
53e4a277b38cf218bc8f55f9fa0a7d85aaabb5b9
diff --git a/activesupport/lib/active_support/cache/redis_cache_store.rb b/activesupport/lib/active_support/cache/redis_cache_store.rb index <HASH>..<HASH> 100644 --- a/activesupport/lib/active_support/cache/redis_cache_store.rb +++ b/activesupport/lib/active_support/cache/redis_cache_store.rb @@ -363,7 +363,7 @@ module ActiveSupport # Truncate keys that exceed 1kB. def normalize_key(key, options) - truncate_key super + truncate_key super.b end def truncate_key(key)
Convert keys to binary in the Redis cache store Fix encoding errors when using the pure-Ruby Redis driver instead of Hiredis. Dodge incompatibilities between UTF-8 and arbitrary value encodings, which rear their heads when the Redis driver tries to build a single command string from incompatibly-encoded keys and values.
rails_rails
train
rb
3360c7466b32ac2ae0508575b3c5b8705b3b91c9
diff --git a/source/Application/views/admin/en/lang.php b/source/Application/views/admin/en/lang.php index <HASH>..<HASH> 100644 --- a/source/Application/views/admin/en/lang.php +++ b/source/Application/views/admin/en/lang.php @@ -1547,7 +1547,7 @@ $aLang = array( 'mxtools' => 'Tools', 'mxtheme' => 'Themes', 'mxmodule' => 'Modules', - 'mxextensions' => '<span class=\"new\">Extensions</span>', + 'mxextensions' => 'Extensions', 'mxuadmin' => 'Administer Users', 'mxurls' => 'Links', 'mxugroups' => 'User Groups',
Fix translation of mxextensions This string is also taken to create the HTML document title and thus it should not contain any HTML markup.
OXID-eSales_oxideshop_ce
train
php
21e269b9c3c499ddd5856e57b79f22ae326d6a6f
diff --git a/StreamSelectLoop.php b/StreamSelectLoop.php index <HASH>..<HASH> 100644 --- a/StreamSelectLoop.php +++ b/StreamSelectLoop.php @@ -73,14 +73,20 @@ class StreamSelectLoop implements LoopInterface if ($read) { foreach ($read as $stream) { foreach ($this->readListeners[(int) $stream] as $listener) { - call_user_func($listener, $stream); + if (call_user_func($listener, $stream) === false) { + $this->removeReadStream($stream); + break; + } } } } if ($write) { foreach ($write as $stream) { foreach ($this->writeListeners[(int) $stream] as $listener) { - call_user_func($listener, $stream) === false); + if (call_user_func($listener, $stream) === false) { + $this->removeWriteStream($stream); + break; + } } } }
Unsubscribe stream from events when listeners return FALSE. When a listener return FALSE, the event loop unsubscribeis the related stream from read or write events.
reactphp_event-loop
train
php
e9c91a535a6177917739730efe9dbe8ca17f24db
diff --git a/discord/guild.py b/discord/guild.py index <HASH>..<HASH> 100644 --- a/discord/guild.py +++ b/discord/guild.py @@ -3371,8 +3371,7 @@ class Guild(Hashable): raise ClientException('Intents.members must be enabled to use this.') if not self._state.is_guild_evicted(self): - await self._state.chunk_guild(self, cache=cache) - return + return await self._state.chunk_guild(self, cache=cache) async def query_members( self,
Fix Guild.chunk() returning list of members
Rapptz_discord.py
train
py
24256102cff991344a5a0c49c246095b08c05823
diff --git a/autopep8.py b/autopep8.py index <HASH>..<HASH> 100755 --- a/autopep8.py +++ b/autopep8.py @@ -1476,8 +1476,8 @@ class ReflowedLines(object): def line_empty(self): return (self._lines and - not isinstance(self._lines[-1], - (self._LineBreak, self._Indent))) + isinstance(self._lines[-1], + (self._LineBreak, self._Indent))) def emit(self): string = ''
If the line DOES consist of only whitespace, then we declare it empty.
hhatto_autopep8
train
py
a7e0f75d5ef8730976119df3afb445ba25e6c616
diff --git a/poker/_common.py b/poker/_common.py index <HASH>..<HASH> 100644 --- a/poker/_common.py +++ b/poker/_common.py @@ -51,11 +51,11 @@ class _OrderableMixin: return names.index(self._name_) < names.index(other._name_) return NotImplemented + +class PokerEnum(_OrderableMixin, enum.Enum, metaclass=_PokerEnumMeta): def __str__(self): return str(self._value_[0]) - -class PokerEnum(_OrderableMixin, enum.Enum, metaclass=_PokerEnumMeta): def __repr__(self): val = self._value_[0] apostrophe = "'" if isinstance(val, str) else ""
OrderableMixin has nothing to do with __str__
pokerregion_poker
train
py
a88908c41197f1807cd083b528de0b892c264377
diff --git a/pingouin/utils.py b/pingouin/utils.py index <HASH>..<HASH> 100644 --- a/pingouin/utils.py +++ b/pingouin/utils.py @@ -104,7 +104,11 @@ def postprocess_dataframe(df): """ df = df.copy() for row, col in it.product(df.index, df.columns): - if not isinstance(df.at[row,col], numbers.Number): + if (not isinstance(df.at[row,col], numbers.Number) and + not (isinstance(df.at[row,col], np.ndarray) and + issubclass(df.at[row,col].dtype.type, np.floating) + ) + ): continue decimals = _get_round_setting_for(row, col) if decimals is None:
also apply rounding for DataFrame cells with ndarray type (e.g. CI<I>%)
raphaelvallat_pingouin
train
py
cfb5a1332bf48fb52930df9445ec5233fc3da80c
diff --git a/lib/fabrication/schematic/attribute.rb b/lib/fabrication/schematic/attribute.rb index <HASH>..<HASH> 100644 --- a/lib/fabrication/schematic/attribute.rb +++ b/lib/fabrication/schematic/attribute.rb @@ -1,6 +1,7 @@ class Fabrication::Schematic::Attribute - attr_accessor :klass, :name, :params, :value + attr_accessor :klass, :name, :value + attr_writer :params def initialize(klass, name, value, params={}, &block) self.klass = klass
Define only writer because reader is defined below
paulelliott_fabrication
train
rb
ab824fb2384d87ec8b4a61d0cc3464827d584de7
diff --git a/ArrayCollection.php b/ArrayCollection.php index <HASH>..<HASH> 100755 --- a/ArrayCollection.php +++ b/ArrayCollection.php @@ -98,6 +98,14 @@ class ArrayCollection implements CollectionInterface } /** + * @return array + */ + public function keys() + { + return array_keys($this->items); + } + + /** * @param Closure $callable */ public function forAll(Closure $callable)
DoctrineBundle (cherry picked from commit 7e<I>a<I>c<I>b<I>fb5fbc<I>f6d8fe)
WellCommerce_WishlistBundle
train
php
b0b60a83b1d7e2f4dada22849cca1bc5d494662d
diff --git a/jardin/model.py b/jardin/model.py index <HASH>..<HASH> 100644 --- a/jardin/model.py +++ b/jardin/model.py @@ -37,7 +37,7 @@ class Model(pd.DataFrame): return self.instance(self.db_adapter(db_name = kwargs.get('db')).select(**kwargs)) @classmethod - def count(self, **kwargs): + def _count(self, **kwargs): kwargs['select'] = 'COUNT(*)' return self.db_adapter().select(**kwargs)[0][0]['count']
count already exists on DataFrame
instacart_jardin
train
py
fb7f0de974327befdd1d10a06d5b4fae8fd8328c
diff --git a/dohq_artifactory/admin.py b/dohq_artifactory/admin.py index <HASH>..<HASH> 100644 --- a/dohq_artifactory/admin.py +++ b/dohq_artifactory/admin.py @@ -155,7 +155,7 @@ class AdminObject(object): class User(AdminObject): _uri = "security/users" - def __init__(self, artifactory, name, email=None, password=None, disable_ui=True): + def __init__(self, artifactory, name, email=None, password=None, disable_ui=False): super(User, self).__init__(artifactory) self.name = name
Set "disable ui" False by default
devopshq_artifactory
train
py
8e3f8cd49dd2146d02baad4848e58a21a2b6fbe0
diff --git a/sdk/examples/xo_python/sawtooth_xo/processor/handler.py b/sdk/examples/xo_python/sawtooth_xo/processor/handler.py index <HASH>..<HASH> 100644 --- a/sdk/examples/xo_python/sawtooth_xo/processor/handler.py +++ b/sdk/examples/xo_python/sawtooth_xo/processor/handler.py @@ -56,7 +56,7 @@ class XoTransactionHandler: try: # The payload is csv utf-8 encoded string name, action, space = transaction.payload.decode().split(",") - except: + except ValueError: raise InvalidTransaction("Invalid payload serialization") if name == "": @@ -68,7 +68,7 @@ class XoTransactionHandler: elif action == "take": try: space = int(space) - except: + except ValueError: raise InvalidTransaction( "Space could not be converted as an integer." ) @@ -95,7 +95,7 @@ class XoTransactionHandler: try: board, state, player1, player2, stored_name = \ state_entries[0].data.decode().split(",") - except: + except ValueError: raise InternalError("Failed to deserialize game data.") # NOTE: Since the game data is stored in a Merkle tree, there is a
Avoid bare except statements in python xo TP Bare excepts are not necessary within a transaction handler implementation, at least in the case of xo.
hyperledger_sawtooth-core
train
py
316b96d99e425a04f073db8e563d03df1b3584d6
diff --git a/js/ClientList.js b/js/ClientList.js index <HASH>..<HASH> 100644 --- a/js/ClientList.js +++ b/js/ClientList.js @@ -336,6 +336,17 @@ } } + // Add bot-start button: + button = document.createElement('button'); + button.innerHTML = 'Start bot'; + button.onclick = function() { + node.socket.send(node.msg.create({ + target: 'SERVERCOMMAND', + text: 'STARTBOT', + })); + }; + commandPanelBody.appendChild(button); + // Add MsgBar: this.appendMsgBar();
Added button for starting a bot
nodeGame_ultimatum-game
train
js
0792447fd62fd0183f7ccf4422f577d390d2b46e
diff --git a/src/FormKit/Widget/ImageFileInput.php b/src/FormKit/Widget/ImageFileInput.php index <HASH>..<HASH> 100644 --- a/src/FormKit/Widget/ImageFileInput.php +++ b/src/FormKit/Widget/ImageFileInput.php @@ -27,7 +27,9 @@ class ImageFileInput extends FileInput $this->image = new Element('img',array( 'src' => $this->value, )); - $this->imageWrapper->append($this->image); + $cutDiv = new Element('div',array('class' => 'cut') ); + $cutDiv->append($this->image); + $this->imageWrapper->append($cutDiv); } }
Add div for image "cut"
corneltek_FormKit
train
php
929a4013730abbbc958192808a473fa01fc2a577
diff --git a/sqlx.go b/sqlx.go index <HASH>..<HASH> 100644 --- a/sqlx.go +++ b/sqlx.go @@ -428,18 +428,16 @@ func (tx *Tx) Preparex(query string) (*Stmt, error) { // Stmtx returns a version of the prepared statement which runs within a transaction. Provided // stmt can be either *sql.Stmt or *sqlx.Stmt. func (tx *Tx) Stmtx(stmt interface{}) *Stmt { - var st sql.Stmt var s *sql.Stmt - switch stmt.(type) { - case sql.Stmt: - st = stmt.(sql.Stmt) - s = &st + switch v := stmt.(type) { case Stmt: - s = stmt.(Stmt).Stmt + s = v.Stmt case *Stmt: - s = stmt.(*Stmt).Stmt + s = v.Stmt + case sql.Stmt: + s = &v case *sql.Stmt: - s = stmt.(*sql.Stmt) + s = v default: panic(fmt.Sprintf("non-statement type %v passed to Stmtx", reflect.ValueOf(stmt).Type())) }
simplify type switch in Tx.Stmt
jmoiron_sqlx
train
go
92b9369ccc86b3c477b64f6b5ac3984494e53bbc
diff --git a/lib/memcached/rails.rb b/lib/memcached/rails.rb index <HASH>..<HASH> 100644 --- a/lib/memcached/rails.rb +++ b/lib/memcached/rails.rb @@ -7,6 +7,10 @@ class Memcached # A legacy compatibility wrapper for the Memcached class. It has basic compatibility with the <b>memcache-client</b> API. class Rails < ::Memcached + DEFAULTS[:logger] = nil + + attr_reader :logger + alias :servers= :set_servers # See Memcached#new for details. @@ -17,9 +21,15 @@ class Memcached ).flatten.compact opts[:prefix_key] ||= opts[:namespace] + @logger = opts[:logger] + logger.info { "memcached #{VERSION} #{servers.inspect}" } if logger super(servers, opts) end + def logger=(logger) + @logger = logger + end + # Wraps Memcached#get so that it doesn't raise. This has the side-effect of preventing you from # storing <tt>nil</tt> values. def get(key, raw=false)
added logger to Rails subclass
arthurnn_memcached
train
rb
3725ea53c6e561bfd6b79fdf8ada158b85088c85
diff --git a/lib/node_modules/@stdlib/datasets/sotu/scripts/build.js b/lib/node_modules/@stdlib/datasets/sotu/scripts/build.js index <HASH>..<HASH> 100644 --- a/lib/node_modules/@stdlib/datasets/sotu/scripts/build.js +++ b/lib/node_modules/@stdlib/datasets/sotu/scripts/build.js @@ -37,6 +37,7 @@ var RE = require( './../lib/re_filename.js' ); // VARIABLES // var debug = logger( 'sotu:build' ); +var RE_TRAILING_NEWLINE = /\n$/; var RAW_EXTNAME = '.txt'; var NUM_FILES = 0; var COUNT = 0; @@ -171,6 +172,9 @@ function toJSON( file, data ) { out.text = data; + // Remove newline characters inserted by text editors at the end of each file: + out.text = replace( out.text, RE_TRAILING_NEWLINE, '' ); + return JSON.stringify( out ); }
Remove trailing newline character of the texts in toJSON function
stdlib-js_stdlib
train
js
4c6ec41630423f301dd70fc2dd6601b6e6ee688a
diff --git a/src/Persistence.php b/src/Persistence.php index <HASH>..<HASH> 100644 --- a/src/Persistence.php +++ b/src/Persistence.php @@ -48,6 +48,7 @@ class Persistence switch (strtolower(isset($args['driver']) ?: $driver)) { case 'mysql': case 'oci': + case 'oci12': // Omitting UTF8 is always a bad problem, so unless it's specified we will do that // to prevent nasty problems. This is un-tested on other databases, so moving it here. // It gives problem with sqlite
oci<I> support
atk4_data
train
php
67d6f9504294214af2808483dbf15e6246a5a2d4
diff --git a/fancy_getopt.py b/fancy_getopt.py index <HASH>..<HASH> 100644 --- a/fancy_getopt.py +++ b/fancy_getopt.py @@ -412,6 +412,11 @@ def fancy_getopt (options, negative_opt, object, args): WS_TRANS = string.maketrans (string.whitespace, ' ' * len (string.whitespace)) def wrap_text (text, width): + """wrap_text(text : string, width : int) -> [string] + + Split 'text' into multiple lines of no more than 'width' characters + each, and return the list of strings that results. + """ if text is None: return []
Added docstring for 'wrap()' function.
pypa_setuptools
train
py
1ae75558dabd44d9c3852ec4a09777941d3e9d16
diff --git a/troposphere/elasticbeanstalk.py b/troposphere/elasticbeanstalk.py index <HASH>..<HASH> 100644 --- a/troposphere/elasticbeanstalk.py +++ b/troposphere/elasticbeanstalk.py @@ -3,7 +3,7 @@ # # See LICENSE file for full license. -from . import AWSObject, AWSProperty +from . import AWSObject, AWSProperty, Tags WebServer = "WebServer" @@ -98,6 +98,7 @@ class Environment(AWSObject): 'EnvironmentName': (basestring, False), 'OptionSettings': ([OptionSettings], False), 'SolutionStackName': (basestring, False), + 'Tags': (Tags, False), 'TemplateName': (basestring, False), 'Tier': (Tier, False), 'VersionLabel': (basestring, False),
Supports tags in ElasticBeanstalk environments
cloudtools_troposphere
train
py
f83fbe06bf6d0da2feb235fcab2858cb1035ab07
diff --git a/dev_tools/docs/build_api_docs.py b/dev_tools/docs/build_api_docs.py index <HASH>..<HASH> 100644 --- a/dev_tools/docs/build_api_docs.py +++ b/dev_tools/docs/build_api_docs.py @@ -95,6 +95,11 @@ def generate_cirq(): site_path=FLAGS.site_path, callbacks=[public_api.local_definitions_filter, filter_unwanted_inherited_methods], extra_docs=_doc.RECORDED_CONST_DOCS, + private_map={ + # Opt to not build docs for these paths for now since they error. + "cirq.experiments": ["CrossEntropyResultDict", "GridInteractionLayer"], + "cirq.experiments.random_quantum_circuit_generation": ["GridInteractionLayer"], + }, ) doc_controls.decorate_all_class_attributes( doc_controls.do_not_doc_inheritable, networkx.DiGraph, skip=[]
Disable broken symbols. (#<I>)
quantumlib_Cirq
train
py
526baa4360d5a17d6728aa88edc11b339daac6b4
diff --git a/src/document/DocumentCommandHandlers.js b/src/document/DocumentCommandHandlers.js index <HASH>..<HASH> 100644 --- a/src/document/DocumentCommandHandlers.js +++ b/src/document/DocumentCommandHandlers.js @@ -55,6 +55,7 @@ define(function (require, exports, module) { UrlParams = require("utils/UrlParams").UrlParams, StatusBar = require("widgets/StatusBar"), WorkspaceManager = require("view/WorkspaceManager"), + LanguageManager = require("language/LanguageManager"), _ = require("thirdparty/lodash"); /** @@ -952,6 +953,16 @@ define(function (require, exports, module) { saveAsDefaultPath = FileUtils.getDirectoryPath(origPath); } defaultName = FileUtils.getBaseName(origPath); + var file = FileSystem.getFileForPath(origPath); + if (file instanceof InMemoryFile) { + var language = LanguageManager.getLanguageForPath(origPath); + if (language) { + var fileExtensions = language.getFileExtensions(); + if (fileExtensions && fileExtensions.length > 0) { + defaultName += "." + fileExtensions[0]; + } + } + } FileSystem.showSaveDialog(Strings.SAVE_FILE_AS, saveAsDefaultPath, defaultName, function (err, selectedPath) { if (!err) { if (selectedPath) {
Fixed #<I> - Added extension to the filename in SaveAs Dialog for Untitled files using the language specified in language Switcher (#<I>)
adobe_brackets
train
js
a98ef3222011f1cd786f46a3ce7d237cb3524828
diff --git a/test/basics-test.js b/test/basics-test.js index <HASH>..<HASH> 100644 --- a/test/basics-test.js +++ b/test/basics-test.js @@ -40,6 +40,13 @@ tape("A component should render a single instance.", function(test) { test.end(); }); +tape("A component should accept a DOM node in place of a selection.", function(test) { + var div = d3.select(jsdom.jsdom().body).append("div"); + paragraph(div.node(), "Hello Component"); + test.equal(div.html(), "<p>Hello Component</p>"); + test.end(); +}); + tape("A component should render multiple instances.", function(test) { var div = d3.select(jsdom.jsdom().body).append("div");
Add failing test for accepting DOM node
curran_d3-component
train
js
ffd2227b19925d53c3eb84c4999e3df9c3dfba33
diff --git a/lib/git_trend/scraper.rb b/lib/git_trend/scraper.rb index <HASH>..<HASH> 100644 --- a/lib/git_trend/scraper.rb +++ b/lib/git_trend/scraper.rb @@ -15,16 +15,14 @@ module GitTrend end def get(language = nil, since = nil, number = nil) - projects = [] page = @agent.get(generate_url_for_get(language, since)) - - page.search('.repo-list-item').each do |content| + projects = page.search('.repo-list-item').map do |content| project = Project.new meta_data = content.search('.repo-list-meta').text project.lang, project.star_count = extract_lang_and_star_from_meta(meta_data) project.name = content.search('.repo-list-name a').text.split.join project.description = content.search('.repo-list-description').text.gsub("\n", '').strip - projects << project + project end fail ScrapeException if projects.empty? number ? projects[0...number] : projects
Reafactor using map instead of each
rochefort_git-trend
train
rb
2ba069d5e7f57ce47b011d7fcbef5e68be160e09
diff --git a/src/runner.py b/src/runner.py index <HASH>..<HASH> 100644 --- a/src/runner.py +++ b/src/runner.py @@ -4,11 +4,11 @@ import argparse import sys -from subprocess import run, CalledProcessError +from subprocess import CalledProcessError, run from time import sleep, time -def main() -> None: +def main() -> int: parser = argparse.ArgumentParser() parser.add_argument( "-c", @@ -22,6 +22,7 @@ def main() -> None: print(f"Running bandersnatch every {args.interval}s", file=sys.stderr) while True: start_time = time() + try: cmd = [ sys.executable, @@ -32,14 +33,17 @@ def main() -> None: "mirror", ] run(cmd, check=True) - except CalledProcessError: - sys.exit(1) + except CalledProcessError as cpe: + return cpe.returncode + run_time = time() - start_time if run_time < args.interval: sleep_time = args.interval - run_time print(f"Sleeping for {sleep_time}s", file=sys.stderr) sleep(sleep_time) + return 0 + if __name__ == "__main__": - main() + sys.exit(main())
runner.py: Have it return bandersnatch returncode + make isort happy
pypa_bandersnatch
train
py
391b7d673069d8ba85b4d5c2446086b64bd0f0f3
diff --git a/salt/client/mixins.py b/salt/client/mixins.py index <HASH>..<HASH> 100644 --- a/salt/client/mixins.py +++ b/salt/client/mixins.py @@ -5,6 +5,7 @@ A collection of mixins useful for the various *Client interfaces from __future__ import print_function from __future__ import absolute_import import collections +import copy import logging import traceback import multiprocessing @@ -266,10 +267,12 @@ class SyncClientMixin(object): try: verify_fun(self.functions, fun) - # Inject some useful globals to *all* the funciton's global + # Inject some useful globals to *all* the function's global # namespace only once per module-- not per func completed_funcs = [] - for mod_name in self.functions: + _functions = copy.deepcopy(self.functions) + + for mod_name in _functions: mod, _ = mod_name.split('.', 1) if mod in completed_funcs: continue
Backporting fix for issue #<I> on <I> branch
saltstack_salt
train
py
97f957511e34f80de76cabb085bc6e82c6ec2f06
diff --git a/spec/acceptance/httpclient/httpclient_spec.rb b/spec/acceptance/httpclient/httpclient_spec.rb index <HASH>..<HASH> 100644 --- a/spec/acceptance/httpclient/httpclient_spec.rb +++ b/spec/acceptance/httpclient/httpclient_spec.rb @@ -199,9 +199,10 @@ describe "HTTPClient" do end end - context 'credentials', net_connect: true do + context 'credentials' do it 'are detected when manually specifying Authorization header' do - stub_request(:get, 'username:[email protected]').to_return(status: 200) + stub_request(:get, "http://www.example.com/").with(basic_auth: ['username', 'password']).to_return(status: 200) + headers = {'Authorization' => 'Basic dXNlcm5hbWU6cGFzc3dvcmQ='} expect(http_request(:get, 'http://www.example.com/', {headers: headers}).status).to eql('200') end
Properly stub Authorization test case.
bblimke_webmock
train
rb
90cc68788a4d324e269552ea81b40467b2624c95
diff --git a/tasks/lib/uploader.js b/tasks/lib/uploader.js index <HASH>..<HASH> 100644 --- a/tasks/lib/uploader.js +++ b/tasks/lib/uploader.js @@ -6,7 +6,7 @@ var rest = require('restler'); exports.init = function (grunt, options) { // Method to get the API endpoint. - var api_endpoint = (grunt.option('host') || 'https://api.sorryapp.com') + '/1/pages/' + (grunt.option('page') || options.page) + '/theme'; + var api_endpoint = (grunt.option('sorry-host') || 'https://api.sorryapp.com') + '/1/pages/' + (grunt.option('sorry-page') || options.page) + '/theme'; // Upload the theme to the API. exports.upload = function (archive_path, callback) {
Namespaced the command line arguments under 'sorry' to save any clashing with other libs down the line.
sorry-app_grunt-sorry-theme-deploy
train
js
c7af8a674d4e95845422f8e32b4f21aa082a4b5f
diff --git a/src/directives/formly-field.test.js b/src/directives/formly-field.test.js index <HASH>..<HASH> 100644 --- a/src/directives/formly-field.test.js +++ b/src/directives/formly-field.test.js @@ -1014,6 +1014,32 @@ describe('formly-field', function() { expect(ctrl.$formatters).to.have.length(2); // ngModel adds one expect(ctrl.$viewValue).to.equal('hello! boo!'); }); + + it.skip(`should format a model value right from the start`, () => { + scope.model = {myKey: 'hello'}; + scope.fields = [getNewField({ + key: 'myKey', + formatters: ['"!" + $viewValue + "!"'] + })]; + compileAndDigest(); + + const ctrl = getNgModelCtrl(); + + //workaround: this formats the model value right off the bat, + //without the workaround, the initial model value stays unformatted + +/* + let value = ctrl.$modelValue; + ctrl.$formatters.forEach((formatter) => { + value = formatter(value); + }); + + ctrl.$setViewValue(value); + ctrl.$render(); +*/ + + expect(ctrl.$viewValue).to.equal('!hello!'); + }); }); function testParsersOrFormatters(which) {
Added a failing test for #<I>
formly-js_angular-formly
train
js
f9ebeb83293246c48c0a29c72abde9386bd9d44e
diff --git a/src/Behat/Mink/Driver/CoreDriver.php b/src/Behat/Mink/Driver/CoreDriver.php index <HASH>..<HASH> 100644 --- a/src/Behat/Mink/Driver/CoreDriver.php +++ b/src/Behat/Mink/Driver/CoreDriver.php @@ -181,6 +181,18 @@ abstract class CoreDriver implements DriverInterface } /** + * Checks whether select option, located by it's XPath query, is selected. + * + * @param string $xpath + * + * @return Boolean + */ + public function isSelected($xpath) + { + throw new UnsupportedDriverActionException('Element selection check is not supported by %s', $this); + } + + /** * Simulates a mouse over on the element. * * @param string $xpath
Adding "isSelected" method to "CoreDriver" to keep BC with drivers, that don't (yet) have implementation for it.
minkphp_Mink
train
php
1c4e8fb521b272a2b6ee61618fd193dcb5080ad3
diff --git a/src/FieldsBuilder.php b/src/FieldsBuilder.php index <HASH>..<HASH> 100644 --- a/src/FieldsBuilder.php +++ b/src/FieldsBuilder.php @@ -108,12 +108,15 @@ class FieldsBuilder extends Builder public function addFields($fields) { if (is_subclass_of($fields, FieldsBuilder::class)) { + $fields = clone $fields; foreach ($fields->getFields() as $field) { $this->pushField($field); } } else { - $this->pushField($fields); + foreach ($fields as $field) { + $this->pushField($field); + } } return $this; diff --git a/src/FlexibleContentBuilder.php b/src/FlexibleContentBuilder.php index <HASH>..<HASH> 100644 --- a/src/FlexibleContentBuilder.php +++ b/src/FlexibleContentBuilder.php @@ -53,8 +53,10 @@ class FlexibleContentBuilder extends Builder public function addLayout($layout, $args = []) { - if (!is_a($layout, Builder::class)) { - $layout = new FieldsBuilder($layout, $args); + if (is_a($layout, Builder::class)) { + $layout = clone $layout; + } else { + $layout = new FieldsBuilder($layout, $args); } $layout->setGroupConfig('name', $layout->getName());
addFields and addLayout should clone any passed FieldsBuilder object
StoutLogic_acf-builder
train
php,php
4f37f118a4b1e4d366de66287f12174a486b3d4d
diff --git a/packages/ember/tests/routing/decoupled_basic_test.js b/packages/ember/tests/routing/decoupled_basic_test.js index <HASH>..<HASH> 100644 --- a/packages/ember/tests/routing/decoupled_basic_test.js +++ b/packages/ember/tests/routing/decoupled_basic_test.js @@ -72,7 +72,7 @@ moduleFor( assert.ok(false, 'expected handleURLing: `' + path + '` to fail'); }) .catch(reason => { - assert.equal(reason, expectedReason); + assert.equal(reason.message, expectedReason); }); } @@ -772,7 +772,7 @@ moduleFor( actions: { error(reason) { assert.equal( - reason, + reason.message, 'Setup error', 'SpecialRoute#error received the error thrown from setup' ); @@ -813,7 +813,7 @@ moduleFor( actions: { error(reason) { assert.equal( - reason, + reason.message, 'Setup error', 'error was correctly passed to custom ApplicationRoute handler' );
Update tests to expect an Error object
emberjs_ember.js
train
js
c4a3c97dc58290f8d5ec7483b21ed44e80cc5acc
diff --git a/src/main/java/no/digipost/signature/client/asice/signature/CreateSignature.java b/src/main/java/no/digipost/signature/client/asice/signature/CreateSignature.java index <HASH>..<HASH> 100644 --- a/src/main/java/no/digipost/signature/client/asice/signature/CreateSignature.java +++ b/src/main/java/no/digipost/signature/client/asice/signature/CreateSignature.java @@ -93,6 +93,10 @@ public class CreateSignature { } public Signature createSignature(final List<? extends SignableFileReference> attachedFiles, final KeyStoreConfig keyStoreConfig) { + return new Signature(domUtils.serializeToXml(createXmlSignature(attachedFiles, keyStoreConfig))); + } + + protected Document createXmlSignature(final List<? extends SignableFileReference> attachedFiles, final KeyStoreConfig keyStoreConfig) { XMLSignatureFactory xmlSignatureFactory = getSignatureFactory(); SignatureMethod signatureMethod = getSignatureMethod(xmlSignatureFactory); @@ -138,7 +142,7 @@ public class CreateSignature { "Verify that the input is valid and that there are no illegal symbols in file names etc.", e); } - return new Signature(domUtils.serializeToXml(signedDocument)); + return signedDocument; } private URIDereferencer signedPropertiesURIDereferencer(XAdESArtifacts xadesArtifacts, XMLSignatureFactory signatureFactory) {
Introduce a overridable createXmlSignature() In CreateSignature, to make it possible to simulate erroneous created xml signature for testing purposes.
digipost_signature-api-client-java
train
java
2c47a3131a4c641823544bce03afbc05dc3a3d50
diff --git a/std.go b/std.go index <HASH>..<HASH> 100644 --- a/std.go +++ b/std.go @@ -154,6 +154,7 @@ var stdPkgs = map[string]struct{}{ "runtime/internal/atomic": {}, "image/internal/imageutil": {}, "go/internal/gccgoimporter": {}, + "internal/syscall/windows/sysdll": {}, "internal/golang.org/x/net/http2/hpack": {}, }
Run go generate after Go <I>
mvdan_interfacer
train
go
da970a263abed444da7ca1c6b1c0f4700d3171d1
diff --git a/client/mc.go b/client/mc.go index <HASH>..<HASH> 100644 --- a/client/mc.go +++ b/client/mc.go @@ -46,6 +46,16 @@ func (client *Client) Send(req gomemcached.MCRequest) (rv gomemcached.MCResponse return } +// Send a request, but do not wait for a response. +func (client *Client) Transmit(req gomemcached.MCRequest) { + transmitRequest(client.writer, req) +} + +// Receive a response +func (client *Client) Receive() gomemcached.MCResponse { + return client.getResponse() +} + // Get the value for a key. func (client *Client) Get(vb uint16, key string) gomemcached.MCResponse { var req gomemcached.MCRequest
Commands for sending and receiving requests.
dustin_gomemcached
train
go
b41308536c10f6795eb6f048fd6337fa0f1ec424
diff --git a/client/components/email-verification/index.js b/client/components/email-verification/index.js index <HASH>..<HASH> 100644 --- a/client/components/email-verification/index.js +++ b/client/components/email-verification/index.js @@ -21,16 +21,10 @@ export default function emailVerification( context, next ) { if ( showVerifiedNotice ) { user().signalVerification(); setTimeout( () => { - // TODO: unify these once translations catch up - const message = - i18n.getLocaleSlug() === 'en' - ? i18n.translate( 'Email confirmed!' ) - : i18n.translate( - "Email confirmed! Now that you've confirmed your email address you can publish posts on your blog." - ); + const message = i18n.translate( 'Email confirmed!' ); const notice = successNotice( message, { duration: 10000 } ); context.store.dispatch( notice ); - }, 100 ); // A delay is needed here, because the notice state seems to be cleared upon page load + }, 500 ); // A delay is needed here, because the notice state seems to be cleared upon page load } next();
Simplify verified=1 email confirmed text to 'Email confirmed' in all locales (#<I>) * Simplify verified=1 email confirmed text to 'Email confirmed' in all locales * Increase delay to <I>ms to allow time for translations to be loaded
Automattic_wp-calypso
train
js
6d4558034c061990c76393331002767eef5a4034
diff --git a/lib/haml/helpers/action_view_mods.rb b/lib/haml/helpers/action_view_mods.rb index <HASH>..<HASH> 100644 --- a/lib/haml/helpers/action_view_mods.rb +++ b/lib/haml/helpers/action_view_mods.rb @@ -123,20 +123,5 @@ module ActionView alias_method :form_tag_without_haml, :form_tag alias_method :form_tag, :form_tag_with_haml end - - module FormHelper - def form_for_with_haml(object_name, *args, &proc) - wrap_block = block_given? && is_haml? && block_is_haml?(proc) - if wrap_block - oldproc = proc - proc = proc {|*subargs| with_tabs(1) {oldproc.call(*subargs)}} - end - res = form_for_without_haml(object_name, *args, &proc) - res << "\n" if wrap_block - res - end - alias_method :form_for_without_haml, :form_for - #alias_method :form_for, :form_for_with_haml - end end end
remove FormHelper which incorrectly tries to add proper indentation. since #form_for uses #form_tag we can rely on the patched #form_tag_with_haml to indent the form correctly.
haml_haml
train
rb
14a80b06add601e25cca26298543ee578f82914f
diff --git a/src/Organizer/Organizer.php b/src/Organizer/Organizer.php index <HASH>..<HASH> 100644 --- a/src/Organizer/Organizer.php +++ b/src/Organizer/Organizer.php @@ -394,11 +394,7 @@ class Organizer extends EventSourcedAggregateRoot implements UpdateableWithCdbXm */ private function isTitleChanged(Title $title, Language $language) { - if (!isset($this->titles[$language->getCode()]) || - !$title->sameValueAs($this->titles[$language->getCode()])) { - return true; - } else { - return false; - } + return !isset($this->titles[$language->getCode()]) || + !$title->sameValueAs($this->titles[$language->getCode()]); } }
III-<I> Cleaner if statement for isTitleChanged method.
cultuurnet_udb3-php
train
php
6a76b606c3ef3a715c8297ee24579d219e8a9a47
diff --git a/neurom/ezy/neuron.py b/neurom/ezy/neuron.py index <HASH>..<HASH> 100644 --- a/neurom/ezy/neuron.py +++ b/neurom/ezy/neuron.py @@ -34,7 +34,6 @@ from neurom.core.types import checkTreeType from neurom.core.tree import ipreorder from neurom.core.tree import isection from neurom.core.tree import isegment -from neurom.core.tree import i_chain as i_neurites from neurom.core.neuron import Neuron as CoreNeuron from neurom.analysis.morphmath import section_length from neurom.analysis.morphmath import segment_length @@ -232,11 +231,10 @@ class Neuron(CoreNeuron): >>> tl = sum(nrn.iter_neurites(tr.isegment, mm.segment_length))) ''' - return i_neurites(self.neurites, - iterator_type, - mapping, - tree_filter=lambda t: checkTreeType(neurite_type, - t.type)) + return self.i_neurites(iterator_type, + mapping, + tree_filter=lambda t: checkTreeType(neurite_type, + t.type)) def iter_points(self, mapfun, neurite_type=TreeType.all): '''Iterator to neurite points with mapping
Simplify ezy.Neuron by using base class methods.
BlueBrain_NeuroM
train
py
2a13d01244e7ebbe69f9589b6c942b9bfd54a0ed
diff --git a/src/printer/lombok/ast/printer/SourcePrinter.java b/src/printer/lombok/ast/printer/SourcePrinter.java index <HASH>..<HASH> 100644 --- a/src/printer/lombok/ast/printer/SourcePrinter.java +++ b/src/printer/lombok/ast/printer/SourcePrinter.java @@ -292,6 +292,7 @@ public class SourcePrinter extends ForwardingASTVisitor { UnaryOperator op; try { op = node.getOperator(); + if (op == null) throw new Exception(); } catch (Exception e) { visit(node.getOperand()); formatter.closeInline(); @@ -826,6 +827,7 @@ public class SourcePrinter extends ForwardingASTVisitor { formatter.buildInline(node); visit(node.getRawName()); if (!node.extending().isEmpty()) { + formatter.space(); formatter.keyword("extends"); visitAll(node.extending(), " & ", " ", ""); }
in type arguments, a space was missing between id ('T') and 'extends'. Also, UnaryExpressions with missing operator no longer cause an exception during printing.
rzwitserloot_lombok.ast
train
java
c009f14b221307322e02c1e0ac9a932b7b267f9b
diff --git a/waldur_core/quotas/fields.py b/waldur_core/quotas/fields.py index <HASH>..<HASH> 100644 --- a/waldur_core/quotas/fields.py +++ b/waldur_core/quotas/fields.py @@ -202,6 +202,14 @@ class TotalQuotaField(CounterQuotaField): """ This field aggregates sum of value for the same field of children objects. For example, it allows to compute total volume size for the project. + + class Quotas(quotas_models.QuotaModelMixin.Quotas): + nc_volume_size = quotas_fields.TotalQuotaField( + target_models=lambda: Volume.get_all_models(), + path_to_scope='project', + target_field='size', + ) + """ def __init__(self, target_models, path_to_scope, target_field): self.target_field = target_field
Add example of total quota field usage [WAL-<I>]
opennode_waldur-core
train
py
e1427cdec584b8f073b87e3f9a0a8711d71e45b0
diff --git a/course/mod.php b/course/mod.php index <HASH>..<HASH> 100644 --- a/course/mod.php +++ b/course/mod.php @@ -265,7 +265,7 @@ } else if (isset_param('indent') and confirm_sesskey()) { - $id = required_param('id',0,PARAM_INT); + $id = required_param('id',PARAM_INT); if (! $cm = get_record("course_modules", "id", $id)) { error("This course module doesn't exist"); @@ -345,7 +345,7 @@ } else if (isset_param('groupmode') and confirm_sesskey()) { - $id = required_param( 'id',0,PARAM_INT ); + $id = required_param( 'id', PARAM_INT ); if (! $cm = get_record("course_modules", "id", $id)) { error("This course module doesn't exist"); @@ -578,8 +578,8 @@ die; } - $id = required_param('id',0,PARAM_INT); - $section = required_param('section',0,PARAM_INT); + $id = required_param('id',PARAM_INT); + $section = required_param('section',PARAM_INT); if (! $course = get_record("course", "id", $id)) { error("This course doesn't exist");
fixed incorrect use of required_param()
moodle_moodle
train
php
325f5a760e1508ae82e30c39a631e93ab1113ab7
diff --git a/gorp_test.go b/gorp_test.go index <HASH>..<HASH> 100644 --- a/gorp_test.go +++ b/gorp_test.go @@ -18,6 +18,13 @@ import ( "time" ) +// verify interface compliance +var _ Dialect = SqliteDialect{} +var _ Dialect = PostgresDialect{} +var _ Dialect = MySQLDialect{} +var _ Dialect = SqlServerDialect{} +var _ Dialect = OracleDialect{} + type Invoice struct { Id int64 Created int64
ensure that dialect structs comply with interface
go-gorp_gorp
train
go
8f658077819332c2e149b0e885eddd7c7547edf5
diff --git a/src/bandersnatch/package.py b/src/bandersnatch/package.py index <HASH>..<HASH> 100644 --- a/src/bandersnatch/package.py +++ b/src/bandersnatch/package.py @@ -61,7 +61,7 @@ class Package(object): if self.mirror.hash_index: return os.path.join( self.mirror.webdir, 'simple', - self.normalized_first, self.normalized_name_legacy) + self.normalized_name[0], self.normalized_name_legacy) return os.path.join( self.mirror.webdir, 'simple', self.normalized_name_legacy)
Um. Weird. Why did my test not catch this but ... hm. Maybe OS X/Linux issue.
pypa_bandersnatch
train
py
5c68fa0077160677ab610a6fc6a8b07546a20440
diff --git a/lib/chef/provider/windows_script.rb b/lib/chef/provider/windows_script.rb index <HASH>..<HASH> 100644 --- a/lib/chef/provider/windows_script.rb +++ b/lib/chef/provider/windows_script.rb @@ -36,7 +36,7 @@ class Chef @is_wow64 = wow64_architecture_override_required?(run_context.node, target_architecture) - if ( target_architecture == :i386 ) && ! is_i386_process_on_x86_64_windows? + if ( target_architecture == :i386 ) && node_windows_architecture(run_context.node) == :x86_64 && !is_i386_process_on_x86_64_windows? raise Chef::Exceptions::Win32ArchitectureIncorrect, "Support for the i386 architecture from a 64-bit Ruby runtime is not yet implemented" end
Only check WOW<I> process when system architecture is x<I>. Fixes <URL>
chef_chef
train
rb