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
8e64e468ab03f423df972f5f04ce296bda9742cc
diff --git a/Neos.Neos/Classes/Controller/Module/Administration/UsersController.php b/Neos.Neos/Classes/Controller/Module/Administration/UsersController.php index <HASH>..<HASH> 100644 --- a/Neos.Neos/Classes/Controller/Module/Administration/UsersController.php +++ b/Neos.Neos/Classes/Controller/Module/Administration/UsersController.php @@ -412,7 +412,7 @@ class UsersController extends AbstractModuleController * * @param User $user */ - protected function isEditingAllowed($user) + protected function isEditingAllowed(User $user): bool { if ($this->isAdministrator) { return true;
Update Neos.Neos/Classes/Controller/Module/Administration/UsersController.php
neos_neos-development-collection
train
php
c5418671ee8b2209544e82b431f496d8056e8b67
diff --git a/abutils/utils/seqio.py b/abutils/utils/seqio.py index <HASH>..<HASH> 100644 --- a/abutils/utils/seqio.py +++ b/abutils/utils/seqio.py @@ -84,15 +84,15 @@ def from_fasta(fasta_file, verbose=False): return FASTAInput(fasta_file, verbose=verbose) -def from_json(json_file, verbose=False): - return JSONInput(json_file, verbose=verbose) +def from_json(json_file, seq_field='vdj_nt', verbose=False): + return JSONInput(json_file, seq_field=seq_field, verbose=verbose) def from_mongodb(db, collection=None, ip='localhost', port=27017, user=None, password=None, - query=None, projection=None, verbose=False): + query=None, projection=None, seq_field='vdj_nt', verbose=False): return MongoDBInput(database=db, collection=collection, ip=ip, port=port, user=user, password=password, query=query, projection=projection, - verbose=verbose) + seq_field=seq_field, verbose=verbose)
add seq_field kwarg to from_xxx methods
briney_abutils
train
py
bafd15661d0ee1f9c63720b6e3bea2a8b6d1351c
diff --git a/lib/vagrant/commands.rb b/lib/vagrant/commands.rb index <HASH>..<HASH> 100644 --- a/lib/vagrant/commands.rb +++ b/lib/vagrant/commands.rb @@ -169,7 +169,7 @@ msg # which action to take and calls the respective action method # (see {box_add} and {box_remove}) def box(argv) - Env.load! + Environment.load! sub_commands = ["list", "add", "remove"] diff --git a/test/vagrant/commands_test.rb b/test/vagrant/commands_test.rb index <HASH>..<HASH> 100644 --- a/test/vagrant/commands_test.rb +++ b/test/vagrant/commands_test.rb @@ -255,7 +255,7 @@ class CommandsTest < Test::Unit::TestCase end should "load the environment" do - Vagrant::Env.expects(:load!).once + Vagrant::Environment.expects(:load!).once Vagrant::Commands.box(["add"]) end
`vagrant box` uses new Environment
hashicorp_vagrant
train
rb,rb
6d54e92055dc95fd174b90888e4a9db23a8971e8
diff --git a/src/models/InlineStyle.js b/src/models/InlineStyle.js index <HASH>..<HASH> 100644 --- a/src/models/InlineStyle.js +++ b/src/models/InlineStyle.js @@ -10,6 +10,11 @@ import parse from '../vendor/postcss-safe-parser/parse' const generated = {} +/* Whitelist of properties that need string values even when they're numbers */ +const propNeedsStrings = { + 'font-weight': true, +} + /* InlineStyle takes arbitrary CSS and generates a flat object */ @@ -30,7 +35,8 @@ export default class InlineStyle { if (node.type === 'decl') { const { value } = node const isNumber = value !== '' && !isNaN(value) - styleObject[camelizeStyleName(node.prop)] = isNumber ? parseFloat(value) : value + const typedVal = isNumber && !propNeedsStrings[node.prop] ? parseFloat(value) : value + styleObject[camelizeStyleName(node.prop)] = typedVal } else { /* eslint-disable no-console */ console.warn(`Node of type ${node.type} not supported as an inline style`)
start a whitelist for props like this
styled-components_styled-components
train
js
8274e4312a684ebd7c5e2f426bdb4bdb35dedb8d
diff --git a/resources/views/admin/trees-preferences.php b/resources/views/admin/trees-preferences.php index <HASH>..<HASH> 100644 --- a/resources/views/admin/trees-preferences.php +++ b/resources/views/admin/trees-preferences.php @@ -749,7 +749,7 @@ Bootstrap4::select([ '0' => I18N::translateContext('Show the [first/last] [N] parts of a place name.', 'first'), '1' => I18N::translateContext('Show the [first/last] [N] parts of a place name.', 'last'), - ], $tree->getPreference('SHOW_PEDIGREE_PLACES_SUFFIX', ['name' => 'SHOW_PEDIGREE_PLACES_SUFFIX'])), + ], $tree->getPreference('SHOW_PEDIGREE_PLACES_SUFFIX'), ['name' => 'SHOW_PEDIGREE_PLACES_SUFFIX']), Bootstrap4::select(FunctionsEdit::numericOptions(range(1, 9)), $tree->getPreference('SHOW_PEDIGREE_PLACES'), ['name' => 'SHOW_PEDIGREE_PLACES']) ) ?> <p class="small text-muted">
Fix: parenthesis in wrong place
fisharebest_webtrees
train
php
abfac84e67854c168e78133d839528c33dd99e8b
diff --git a/src/platforms/mp/runtime/modules/attrs.js b/src/platforms/mp/runtime/modules/attrs.js index <HASH>..<HASH> 100644 --- a/src/platforms/mp/runtime/modules/attrs.js +++ b/src/platforms/mp/runtime/modules/attrs.js @@ -41,7 +41,7 @@ function updateAttrs (oldVnode: VNodeWithData, vnode: VNodeWithData) { // only update daynamic attrs in runtime if (old !== cur && (bindingAttrs.indexOf(key) > -1 || key === 'slot')) { // if using local image file, set path to the root - if (vnode.tag === 'img' && key === 'src' && !/^\/|https?|data:/.test(cur)) { + if (cur && vnode.tag === 'img' && key === 'src' && !/^\/|https?|data:/.test(cur)) { cur = `/${cur}` } updateVnodeToMP(vnode, key, cur)
fix: should not set src to '/' when it's '' #<I>
kaola-fed_megalo
train
js
45f079dd431d9cafe8e7b36b3e3f03555836d731
diff --git a/src/zugbruecke/core/arg_contents.py b/src/zugbruecke/core/arg_contents.py index <HASH>..<HASH> 100644 --- a/src/zugbruecke/core/arg_contents.py +++ b/src/zugbruecke/core/arg_contents.py @@ -63,6 +63,8 @@ class arg_contents_class(): def client_unpack_return_list(self, old_arguments_list, args_package_list, argtypes_d): + self.log.err(pf(args_package_list)) + # Step through arguments new_arguments_list = [] for arg_index, arg in enumerate(args_package_list): @@ -205,6 +207,11 @@ class arg_contents_class(): else: old_arg_ref = new_arg_value + # HACK let's handle 1D fixed length arrays + elif len(arg_def_dict['f']) == 2 and arg_def_dict['f'][0] == FLAG_POINTER and arg_def_dict['f'][1] > 0: + + self.log.err(pf(arg_def_dict)) + else: pass # TODO struct ...
catching pointers to fixed length 1d arrays
pleiszenburg_zugbruecke
train
py
11518e62c4301fd5000c227fd77c4691f8b631fb
diff --git a/lxc/storage_volume.go b/lxc/storage_volume.go index <HASH>..<HASH> 100644 --- a/lxc/storage_volume.go +++ b/lxc/storage_volume.go @@ -1223,6 +1223,9 @@ func (c *cmdStorageVolumeInfo) Run(cmd *cobra.Command, args []string) error { if volState.Usage != nil { fmt.Printf(i18n.G("Usage: %s")+"\n", units.GetByteSizeStringIEC(int64(volState.Usage.Used), 2)) + if volState.Usage.Total > 0 { + fmt.Printf(i18n.G("Total: %s")+"\n", units.GetByteSizeStringIEC(int64(volState.Usage.Total), 2)) + } } // List snapshots
lxc/storage: Show volume total size
lxc_lxd
train
go
e6a1fcb7ddf9d9bc9572e7aab6dae05cac0cbcff
diff --git a/src/test/java/com/redhat/darcy/ui/api/elements/SortableTableTest.java b/src/test/java/com/redhat/darcy/ui/api/elements/SortableTableTest.java index <HASH>..<HASH> 100644 --- a/src/test/java/com/redhat/darcy/ui/api/elements/SortableTableTest.java +++ b/src/test/java/com/redhat/darcy/ui/api/elements/SortableTableTest.java @@ -77,8 +77,10 @@ public class SortableTableTest { assertSame(testTable, column.getTable()); column.getCell(7); + column.sort(SortDirection.ASCENDING); verify(testColumn).getCell(testTable, 7); + verify(testColumn).sort(testTable, SortDirection.ASCENDING); } @Test @@ -93,9 +95,11 @@ public class SortableTableTest { column.getCell(7); column.getHeader(); + column.sort(SortDirection.DESCENDING); verify(testColumn).getCell(testTable, 7); verify(testColumn).getHeader(testTable); + verify(testColumn).sort(testTable, SortDirection.DESCENDING); } interface TestSortableColumn extends SortableColumn<StubSortableTable, String> {}
Expand tests for sortable columns (could be separate tests but lazy)
darcy-framework_darcy-ui
train
java
2fd8b099b86b27564751502b1f06140fc711b74d
diff --git a/lib/granite/action.rb b/lib/granite/action.rb index <HASH>..<HASH> 100644 --- a/lib/granite/action.rb +++ b/lib/granite/action.rb @@ -70,9 +70,7 @@ module Granite else def merge_errors(other_errors) other_errors.each do |error| - next if errors.added?(error.attribute, error.type, error.options) - - errors.import(error, attribute: error.attribute) + errors.import(error) unless errors.added?(error.attribute, error) end end end
Simplify calls to `errors.import`
toptal_granite
train
rb
3db4b2363c4663fd0ff905ee797e1bdd60554718
diff --git a/packages/eslint-config-udemy-website/index.js b/packages/eslint-config-udemy-website/index.js index <HASH>..<HASH> 100644 --- a/packages/eslint-config-udemy-website/index.js +++ b/packages/eslint-config-udemy-website/index.js @@ -93,6 +93,14 @@ module.exports = { 'not `import { BrowserRouter, HashRouter, Router } from \'react-router-dom\';`.', exceptions: ['base-components/memoized-browser-router.react-component(?:\\.spec)?\\.js$'], }, + { + // For correct implementation + source: '^react-router-dom(?:\\.js)?$', + specifier: '^Link$', + message: 'Please `import Link from \'base-components/link.react-component\';`, ' + + 'not `import { Link } from \'react-router-dom\';`.', + exceptions: ['base-components/link.react-component(?:\\.spec)?\\.js$'], + }, ]], 'underscore/prefer-noop': ['error', 'always'], },
feat: import blacklist Link from react-router-dom
udemy_js-tooling
train
js
c8f34b59bb5dd89181c2eb5a316a8a03dc7cb795
diff --git a/tests/backend/common.py b/tests/backend/common.py index <HASH>..<HASH> 100644 --- a/tests/backend/common.py +++ b/tests/backend/common.py @@ -81,6 +81,14 @@ class Test_10_dumps_and_loads(TestBase): cnf = self.psr.loads(self.cnf_s, ac_dict=MyDict) self._assert_dicts_equal(cnf, cls=MyDict) + def test_20_loads_with_dict_option(self): + if self.is_ready(): + dopts = self.psr.dict_options() + if dopts: + opts = {dopts[0]: MyDict} + cnf = self.psr.loads(self.cnf_s, **opts) + self._assert_dicts_equal(cnf, cls=MyDict) + def test_30_dumps(self): if self.is_ready(): cnf_s = self.psr.dumps(self.cnf)
enhancement: add backend common test case that dict option was given on load
ssato_python-anyconfig
train
py
e12b83032f731751dbcf8ac4b26053a316511529
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100755 --- a/setup.py +++ b/setup.py @@ -33,7 +33,7 @@ setup( "cached_property", "dataclasses;python_version<'3.7'", "docopt", - "lazy_object_property", + "lazy_object_proxy", "pendulum", "pybooru", "pygments",
Fix wrong dependency name in setup.py
mirukan_lunafind
train
py
98f8b595594f62bff54116c5e2542aa929f8c664
diff --git a/master/buildbot/sourcestamp.py b/master/buildbot/sourcestamp.py index <HASH>..<HASH> 100644 --- a/master/buildbot/sourcestamp.py +++ b/master/buildbot/sourcestamp.py @@ -55,12 +55,8 @@ class SourceStamp(util.ComparableMixin, styles.Versioned): revision = changes[-1].revision if not self.project and hasattr(changes[-1], 'project'): self.project = changes[-1].project - else: - self.project = '' if not self.repository and hasattr(changes[-1], 'repository'): self.repository = changes[-1].repository - else: - self.repository = '' if revision is not None: if isinstance(revision, int):
don't empty proj/repo when they're already set Previous logic in getAbsoluteSourceStamp would incorrectly empty project and repository if they were already set, but changes were available. Fixes #<I>
buildbot_buildbot
train
py
53b2cc340acfe9499d532a3fda65fe7db75899c2
diff --git a/src/ClientContextInterface.php b/src/ClientContextInterface.php index <HASH>..<HASH> 100644 --- a/src/ClientContextInterface.php +++ b/src/ClientContextInterface.php @@ -38,7 +38,7 @@ use Predis\Command\CommandInterface; * @method $this append($key, $value) * @method $this bitcount($key, $start = null, $end = null) * @method $this bitop($operation, $destkey, $key) - * @method $this bitfield($key, ...) + * @method $this bitfield($key, $subcommand, ...$subcommandArg) * @method $this decr($key) * @method $this decrby($key, $decrement) * @method $this get($key)
Apply same fix of <I>fbc to ClientContextInterface.
imcj_predis
train
php
fe1ca40b761c789300f881b98ffc317b248280cb
diff --git a/DependencyInjection/ClientFactory.php b/DependencyInjection/ClientFactory.php index <HASH>..<HASH> 100644 --- a/DependencyInjection/ClientFactory.php +++ b/DependencyInjection/ClientFactory.php @@ -341,7 +341,7 @@ class ClientFactory } elseif ($this->project !== null) { $client->setProjectRoot($this->project); } else { - $client->setProjectRoot("{$this->root}/src"); + $client->setProjectRoot($this->root.DIRECTORY_SEPARATOR.'src'); } if ($this->stripPathRegex !== null) {
Use DIRECTORY_SEPARATOR so Windows paths work This is somewhat speculative, but paths on Windows are usually returned using "\" so the resulting regex from this call wouldn't match as "/" is used instead Using DIRECTORY_SEPARATOR is usually not required, but this is a rare case where it will fix an issue, rather than cause one itself
bugsnag_bugsnag-symfony
train
php
c540d7e4955c849f67819e924a94c3770c61fe57
diff --git a/src/org/jgroups/protocols/TransportedVectorTime.java b/src/org/jgroups/protocols/TransportedVectorTime.java index <HASH>..<HASH> 100644 --- a/src/org/jgroups/protocols/TransportedVectorTime.java +++ b/src/org/jgroups/protocols/TransportedVectorTime.java @@ -1,4 +1,4 @@ -// $Id: TransportedVectorTime.java,v 1.5 2005/08/08 12:45:45 belaban Exp $ +// $Id: TransportedVectorTime.java,v 1.6 2006/12/18 06:22:24 belaban Exp $ package org.jgroups.protocols; @@ -13,7 +13,7 @@ import java.io.Serializable; * Lighweight representation of the VectorTime clock suitable for network transport * * @author Vladimir Blagojevic vladimir@cs.yorku.ca - * @version $Revision: 1.5 $ + * @version $Revision: 1.6 $ */ public class TransportedVectorTime implements Serializable { @@ -116,12 +116,12 @@ public class TransportedVectorTime implements Serializable int[] a = values; for (int k = 0; k < a.length; k++) { - if (a[k] <= b[k]) + if (a[k] < b[k]) return true; - else + else if (a[k] > b[k]) return false; } - return true; + return true; // equals ?!? } /**
applied changes by Matthieu Bentot
belaban_JGroups
train
java
e55ca3ba30eee319c9ad9da1c4ae5a3a57542c61
diff --git a/src/inscriptis/css.py b/src/inscriptis/css.py index <HASH>..<HASH> 100644 --- a/src/inscriptis/css.py +++ b/src/inscriptis/css.py @@ -29,8 +29,8 @@ CSS = { 'h5': HtmlElement('h5', display=Display.block, margin_before=1, margin_after=1), 'h6': HtmlElement('h6', display=Display.block, margin_before=1, margin_after=1), - 'ul': HtmlElement('ul', display=Display.block, margin_before=0, margin_after=1, padding=4), - 'ol': HtmlElement('ol', display=Display.block, margin_before=0, margin_after=1, padding=4), + 'ul': HtmlElement('ul', display=Display.block, margin_before=0, margin_after=0, padding=4), + 'ol': HtmlElement('ol', display=Display.block, margin_before=0, margin_after=0, padding=4), 'li': HtmlElement('li', display=Display.block), 'address': HtmlElement('address', display=Display.block),
fix: improved style sheet for enumerations.
weblyzard_inscriptis
train
py
1d9ccd19c75293717d53155c9988c2d5dbd2a6da
diff --git a/tests/WidgetTest/TestCase.php b/tests/WidgetTest/TestCase.php index <HASH>..<HASH> 100644 --- a/tests/WidgetTest/TestCase.php +++ b/tests/WidgetTest/TestCase.php @@ -144,4 +144,20 @@ class TestCase extends PHPUnit_Framework_TestCase implements WidgetAwareInterfac return $this; } + + protected function assertIsSubset($parent, $subset, $message = '') + { + if (!(is_array($parent) && $subset)) { + $this->assertTrue(false, $message); + return false; + } + + foreach ($subset as $item) { + if (!in_array($item, $parent)) { + $this->assertTrue(false, $message); + } + } + + $this->assertTrue(true); + } }
added assertIsSubset for base test case
twinh_wei
train
php
b9f6ac61dd67b214c2a9914e997ed90526931077
diff --git a/js/gemini.js b/js/gemini.js index <HASH>..<HASH> 100644 --- a/js/gemini.js +++ b/js/gemini.js @@ -281,9 +281,8 @@ module.exports = class gemini extends Exchange { let response = await this.privatePostOrders (params); let orders = this.parseOrders (response, undefined, since, limit); if (typeof symbol !== 'undefined') { - if (!(symbol in this.markets)) - throw new ExchangeError (this.id + ' has no symbol ' + symbol); - orders = this.filterBySymbol (orders, symbol); + let market = this.market (symbol); // throws on non-existent symbol + orders = this.filterBySymbol (orders, market['symbol']); } return orders; }
minor edits to gemini fetchOpenOrders
ccxt_ccxt
train
js
362962794a75845ce1f8ed5be2a92fdad718a681
diff --git a/src/index.js b/src/index.js index <HASH>..<HASH> 100644 --- a/src/index.js +++ b/src/index.js @@ -62,7 +62,7 @@ export class Scene extends React.Component { render() { // Allow through normal attributes.. const otherProps = {}; - ['id', 'mixin'].forEach(propName => { + ['id', 'mixin', 'antialias'].forEach(propName => { if (this.props[propName]) { otherProps[propName] = this.props[propName]; } }); diff --git a/tests/react/index.test.js b/tests/react/index.test.js index <HASH>..<HASH> 100644 --- a/tests/react/index.test.js +++ b/tests/react/index.test.js @@ -83,4 +83,15 @@ describe('Scene', () => { expect(tree.type).toBe('a-scene'); expect(tree.children[0].type).toBe('a-entity'); }); + + it('renders <a-scene antialias="true">', () => { + const tree = renderer.create( + <Scene antialias='true'> + <Entity/> + </Scene> + ).toJSON(); + expect(tree.type).toBe('a-scene'); + expect(tree.props.antialias).toBe('true'); + }); + });
Allow the "antialias" property to be set on the <a-scene> element.
supermedium_aframe-react
train
js,js
a6a9be9569e6e8a8968b0fab7029b22e6ea52fde
diff --git a/framework/js/notification.js b/framework/js/notification.js index <HASH>..<HASH> 100644 --- a/framework/js/notification.js +++ b/framework/js/notification.js @@ -63,12 +63,21 @@ window.ons.notification = (function() { ons.compile(dialogEl[0]); var alertDialog = dialogEl.data('ons-alert-dialog'); + if (buttonLabels.length <= 2) { + footerEl.addClass('alert-dialog-footer--one'); + } + var createButton = function(i) { var buttonEl = angular.element('<button>').addClass('alert-dialog-button').text(buttonLabels[i]); if (i == primaryButtonIndex) { buttonEl.addClass('alert-dialog-button--primal'); } + + if (buttonLabels.length <= 2) { + buttonEl.addClass('alert-dialog-button--one'); + } + buttonEl.on('click', function() { alertDialog.hide({ callback: function() {
Show alert dialog buttons side by side when there are two buttons.
OnsenUI_OnsenUI
train
js
bf9f7e7622be66d3c64ad62a434ed453f680622f
diff --git a/irobot.js b/irobot.js index <HASH>..<HASH> 100644 --- a/irobot.js +++ b/irobot.js @@ -65,8 +65,17 @@ Robot.prototype._parseSerialData = function (emitter, data) { // strip off the header, length, and checksum since we don't need them packet = packet.slice(2, -1); - // parse the sensor data and emit an event with it - this.emit('sensordata', sensors.parseSensorData(packet)); + // parse the sensor data and emit an event with it. if we fail, just + // alert that we got a bad packet and continue. since there are lots of + // packets coming through, some are bound to end up corrupted. + try { + this.emit('sensordata', sensors.parseSensorData(packet)); + } catch (e) { + var err = new Error('bad sensor data packet received'); + err.parse_error = e; + err.packet = packet; + this.emit('badpacket', err); + } break; }
Don't fail on bad packets They happen occasionally but don't necessarily indicate something is wrong, so we just emit an event and ignore them otherwise.
jasontbradshaw_irobot
train
js
02a56064891c21179fd3239a0146986c74d5d9a6
diff --git a/shaders/chunks/light-ambient.glsl.js b/shaders/chunks/light-ambient.glsl.js index <HASH>..<HASH> 100644 --- a/shaders/chunks/light-ambient.glsl.js +++ b/shaders/chunks/light-ambient.glsl.js @@ -6,7 +6,6 @@ struct AmbientLight { }; uniform AmbientLight uAmbientLights[NUM_AMBIENT_LIGHTS]; -uniform sampler2D uAmbientLightShadowMaps[NUM_AMBIENT_LIGHTS]; void EvaluateAmbientLight(inout PBRData data, AmbientLight light, int i) { vec3 lightColor = decode(light.color, 3).rgb;
Remove unused ambient light shadowmap uniform
pex-gl_pex-renderer
train
js
f6f61c0b267d2d08013a7fbc9453454c0da9f769
diff --git a/plugins/development/src/main/java/org/kantega/reststop/development/DevelopmentClassLoaderProvider.java b/plugins/development/src/main/java/org/kantega/reststop/development/DevelopmentClassLoaderProvider.java index <HASH>..<HASH> 100644 --- a/plugins/development/src/main/java/org/kantega/reststop/development/DevelopmentClassLoaderProvider.java +++ b/plugins/development/src/main/java/org/kantega/reststop/development/DevelopmentClassLoaderProvider.java @@ -82,7 +82,7 @@ public class DevelopmentClassLoaderProvider { long columnNumber = diagnostic.getColumnNumber(); String msg = diagnostic.getMessage(Locale.getDefault()); - message.append(sourceFile).append(":").append(lineNumber).append(":").append(columnNumber).append("\n").append(msg); + message.append(sourceFile).append("[").append(lineNumber).append(":").append(columnNumber).append("]\n").append(msg); } throw new RuntimeException(message.toString(), e); }
Detect stale development classloaders before deploying them at startup
kantega_reststop
train
java
6844daff02dd1bfa5f939e9efedf00a733ed6cfc
diff --git a/varlink/__init__.py b/varlink/__init__.py index <HASH>..<HASH> 100644 --- a/varlink/__init__.py +++ b/varlink/__init__.py @@ -837,13 +837,27 @@ class SimpleServer: self._service = service self.connections = {} self._more = {} + self.removefile = None + + def __enter__(self): + return self + + def __exit__(self ,type, value, traceback): + os.remove(self.removefile) def serve(self, address, listen_fd=None): if listen_fd: s = socket.fromfd(listen_fd, socket.AF_UNIX, socket.SOCK_STREAM) - else: + elif address.startswith("unix:"): + address = address[5:] + mode = address.rfind(';mode=') + if mode != -1: + address = address[:mode] + if address[0] == '@': address = address.replace('@', '\0', 1) + else: + self.removefile = address s = socket.socket(socket.AF_UNIX) s.setblocking(0)
SimpleServer: correct address handling and cleanup
varlink_python
train
py
3263d84d0c82f953662a527518f60797e2780780
diff --git a/ccmlib/cluster.py b/ccmlib/cluster.py index <HASH>..<HASH> 100644 --- a/ccmlib/cluster.py +++ b/ccmlib/cluster.py @@ -172,10 +172,10 @@ class Cluster(): if node in self.seeds: self.seeds.remove(node) self.__update_config() - node.stop() + node.stop(gently=False) shutil.rmtree(node.get_path()) else: - self.stop() + self.stop(gently=False) shutil.rmtree(self.get_path()) def clear(self):
Don't kill not gently when removing the cluster altogether
riptano_ccm
train
py
a5b331f4d8676b5250f4749927a1a9ae13535b77
diff --git a/tests/source/simple_fault_test.py b/tests/source/simple_fault_test.py index <HASH>..<HASH> 100644 --- a/tests/source/simple_fault_test.py +++ b/tests/source/simple_fault_test.py @@ -22,7 +22,7 @@ from nhlib.source.simple_fault import SimpleFaultSource from nhlib.source.rupture import ProbabilisticRupture from nhlib.mfd import TruncatedGRMFD from nhlib.scalerel.peer import PeerMSR -from nhlib.geo import Point, Line, Polygon +from nhlib.geo import Point, Line from nhlib.tom import PoissonTOM from tests import assert_angles_equal
tests/source/simple_fault: removed unused import
gem_oq-engine
train
py
f98e96ecf875d6741ebf10820ec642a94b19bf59
diff --git a/py3status/modules/arch_updates.py b/py3status/modules/arch_updates.py index <HASH>..<HASH> 100644 --- a/py3status/modules/arch_updates.py +++ b/py3status/modules/arch_updates.py @@ -102,12 +102,12 @@ class Py3status: return None def arch_updates(self): - pacman, aur, total, full_text = None, None, None, None + pacman, aur, total, full_text = None, None, None, "" + if self._get_pacman_updates: pacman = self._get_pacman_updates() if self._get_aur_updates: aur = self._get_aur_updates() - if pacman is not None or aur is not None: total = (pacman or 0) + (aur or 0)
arch_updates: fix SPEC VIOLATION: full_text is NULL! (#<I>)
ultrabug_py3status
train
py
47122dcc4773d5168da98d695468c8d6c31a6141
diff --git a/safe_qgis/widgets/dock.py b/safe_qgis/widgets/dock.py index <HASH>..<HASH> 100644 --- a/safe_qgis/widgets/dock.py +++ b/safe_qgis/widgets/dock.py @@ -352,6 +352,7 @@ class Dock(QtGui.QDockWidget, Ui_DockBase): registry = QgsMapLayerRegistry.instance() registry.layersWillBeRemoved.disconnect(self.get_layers) registry.layersAdded.disconnect(self.get_layers) + registry.layersRemoved.disconnect(self.get_layers) self.iface.mapCanvas().layersChanged.disconnect(self.get_layers) self.iface.currentLayerChanged.disconnect(self.layer_changed)
Added disconnect for layerWillBeRemoved for #<I>
inasafe_inasafe
train
py
7e4f33c2d36aa4174708235cc9b1bfde2bc5906e
diff --git a/httprunner/ext/locust/__init__.py b/httprunner/ext/locust/__init__.py index <HASH>..<HASH> 100644 --- a/httprunner/ext/locust/__init__.py +++ b/httprunner/ext/locust/__init__.py @@ -67,6 +67,11 @@ def prepare_locust_tests() -> List: def main_locusts(): """ locusts entrance """ + from httprunner.utils import init_sentry_sdk + from sentry_sdk import capture_message + init_sentry_sdk() + capture_message("start to run locusts") + sys.argv[0] = "locust" if len(sys.argv) == 1: sys.argv.extend(["-h"])
change: report sentry when start to run locusts
HttpRunner_HttpRunner
train
py
8632ac9413f9f3e94ef41bfeec243861c79ba552
diff --git a/Zebra_Database.php b/Zebra_Database.php index <HASH>..<HASH> 100755 --- a/Zebra_Database.php +++ b/Zebra_Database.php @@ -699,6 +699,9 @@ class Zebra_Database { 'memcache' => true, // memcache is available but it is not used ); + // this is used in the "escape" method + $this->use_deprecated = version_compare(PHP_VERSION, '5.4.0', '<'); + // don't show debug console for AJAX requests if (!isset($_SERVER['HTTP_X_REQUESTED_WITH']) || $_SERVER['HTTP_X_REQUESTED_WITH'] != 'XMLHttpRequest') @@ -1311,8 +1314,8 @@ class Zebra_Database { // if no active connection exists, return false if (!$this->_connected()) return false; - // if "magic quotes" are on, strip slashes - if (get_magic_quotes_gpc()) $string = stripslashes($string); + // if we are on PHP < 5.4.0 and "magic quotes" are on, strip slashes + if ($this->use_deprecated && get_magic_quotes_gpc()) $string = stripslashes($string); // escape and return the string return mysqli_real_escape_string($this->connection, $string);
Fixed warning about deprecated function in PHP <I>+
stefangabos_Zebra_Database
train
php
c2d2a84c12128b9b16b3f1c4887a0433609f4c92
diff --git a/pyphi/examples.py b/pyphi/examples.py index <HASH>..<HASH> 100644 --- a/pyphi/examples.py +++ b/pyphi/examples.py @@ -462,6 +462,24 @@ def macro_subsystem(): return Subsystem(range(network.size), network) +def rule110_network(): + """A network of three elements which follows the logic of + the Rule 110 cellular automaton with current and past + state (0, 0, 0). """ + tpm = np.array([[0, 0, 0], + [1, 0, 1], + [1, 1, 0], + [1, 1, 1], + [0, 1, 1], + [1, 1, 1], + [1, 1, 1], + [0, 0, 0]]) + + current_state = (0, 0, 0) + past_state = (0, 0, 0) + return Network(tpm, current_state, past_state) + + def fig1a(): """The network shown in Figure 1A of the 2014 IIT 3.0 paper.""" tpm = np.array([
Add Rule <I> network to examples
wmayner_pyphi
train
py
4ae17326724b94d2681610cfec4a7a32cac28344
diff --git a/GiftedMessenger.js b/GiftedMessenger.js index <HASH>..<HASH> 100644 --- a/GiftedMessenger.js +++ b/GiftedMessenger.js @@ -62,7 +62,7 @@ class GiftedMessenger extends Component { this.state = { dataSource: ds.cloneWithRows([]), - text: '', + text: props.text, disabled: true, height: new Animated.Value(this.listViewMaxHeight), appearAnim: new Animated.Value(0), @@ -631,6 +631,7 @@ GiftedMessenger.defaultProps = { senderName: 'Sender', styles: {}, submitOnReturn: false, + text: '', typingMessage: '', };
Added initial text to props Sometimes it could be useful - to set initial text input value. For my application - I open dialog with formating message
FaridSafi_react-native-gifted-chat
train
js
8e368f511ce795718dfd8224c7bea8cf8ef50fc6
diff --git a/npm/postinstall.js b/npm/postinstall.js index <HASH>..<HASH> 100644 --- a/npm/postinstall.js +++ b/npm/postinstall.js @@ -3,7 +3,10 @@ const spawn = require("child_process").spawn const join = require("path").join const pkg = require("../package.json") -console.log(pkg.name, "post-install", process.cwd()) +// no need for this step on CI +if (process.env.CI) { + process.exit(0) +} stat("lib", function(error, stats1) { if (!error && stats1.isDirectory()) {
Skip postinstall hook on CI (make no sense and don't work on Windows)
phenomic_phenomic
train
js
a7187729dd81ff453ae97b2fd0299e650d3e6c7e
diff --git a/structr-core/src/main/java/org/structr/core/entity/AbstractNode.java b/structr-core/src/main/java/org/structr/core/entity/AbstractNode.java index <HASH>..<HASH> 100644 --- a/structr-core/src/main/java/org/structr/core/entity/AbstractNode.java +++ b/structr-core/src/main/java/org/structr/core/entity/AbstractNode.java @@ -905,7 +905,7 @@ public abstract class AbstractNode implements NodeInterface, AccessControllable, final PermissionPropagation propagation = (PermissionPropagation)r; final long startNodeId = rawPathSegment.getStartNode().getId(); final long thisId = getId(); - final SchemaRelationshipNode.Direction relDirection = thisId == startNodeId ? SchemaRelationshipNode.Direction.Out : SchemaRelationshipNode.Direction.In; + final SchemaRelationshipNode.Direction relDirection = thisId == startNodeId ? SchemaRelationshipNode.Direction.In : SchemaRelationshipNode.Direction.Out; final SchemaRelationshipNode.Direction propagationDirection = propagation.getPropagationDirection(); // check propagation direction
Fixed permission resolution direction of local path segment evaluation.
structr_structr
train
java
398130993f70056344b9f5beafb26fe9d64a6d14
diff --git a/lib/ooor/connection.rb b/lib/ooor/connection.rb index <HASH>..<HASH> 100644 --- a/lib/ooor/connection.rb +++ b/lib/ooor/connection.rb @@ -28,24 +28,10 @@ module Ooor def get_rpc_client(url) Ooor.cache.fetch("rpc-client-#{url}") do - if defined?(Java) && @config[:rpc_client] != 'ruby' - begin - require 'jooor' - get_java_rpc_client(url) - rescue LoadError - puts "WARNING falling back on Ruby xmlrpc/client client (much slower). Install the 'jooor' gem if you want Java speed for the RPC!" - get_ruby_rpc_client(url) - end - else - get_ruby_rpc_client(url) - end + Ooor::XmlRpcClient.new2(self, url, nil, @config[:rpc_timeout] || 900) end end - def get_ruby_rpc_client(url) - Ooor::XmlRpcClient.new2(self, url, nil, @config[:rpc_timeout] || 900) - end - def base_url @base_url ||= @config[:url] = "#{@config[:url].gsub(/\/$/,'').chomp('/xmlrpc')}/xmlrpc" end
jooor Java accelerator is deprecated now because json gem is already optimized when using JRuby
akretion_ooor
train
rb
0cfabc0d2e14b8947d821020f339616697ee74d9
diff --git a/django_node/settings.py b/django_node/settings.py index <HASH>..<HASH> 100644 --- a/django_node/settings.py +++ b/django_node/settings.py @@ -107,8 +107,8 @@ INSTALL_PACKAGE_DEPENDENCIES_DURING_RUNTIME = setting_overrides.get( for i, arg in enumerate(sys.argv): if ( arg.endswith('manage.py') and - len(sys.argv) > i and - sys.argv[i + 1] in ('uninstall_package_dependencies', 'install_package_dependencies') + 'uninstall_package_dependencies' in sys.argv or + 'install_package_dependencies' in sys.argv ): INSTALL_PACKAGE_DEPENDENCIES_DURING_RUNTIME = False break \ No newline at end of file
Fixed a bug where running `./manage.py` would raise an Exception.
markfinger_django-node
train
py
513628c06a4024aee645e2ec9c5bdcd141101160
diff --git a/kie-server-parent/kie-server-tests/kie-server-integ-tests-jbpm/src/test/java/org/kie/server/integrationtests/jbpm/QueryDataServiceIntegrationTest.java b/kie-server-parent/kie-server-tests/kie-server-integ-tests-jbpm/src/test/java/org/kie/server/integrationtests/jbpm/QueryDataServiceIntegrationTest.java index <HASH>..<HASH> 100644 --- a/kie-server-parent/kie-server-tests/kie-server-integ-tests-jbpm/src/test/java/org/kie/server/integrationtests/jbpm/QueryDataServiceIntegrationTest.java +++ b/kie-server-parent/kie-server-tests/kie-server-integ-tests-jbpm/src/test/java/org/kie/server/integrationtests/jbpm/QueryDataServiceIntegrationTest.java @@ -788,9 +788,7 @@ public class QueryDataServiceIntegrationTest extends JbpmKieServerBaseIntegratio } private QueryDefinition createErrorsQueryDefinition() { - String queryExpression = "select * from ExecutionErrorInfo where ERROR_ACK = "; - // Sybase needs special treatment when it comes to boolean - queryExpression += TestConfig.isSybaseDataSource() ? "0" : "'0'"; + String queryExpression = "select * from ExecutionErrorInfo where ERROR_ACK = 0"; QueryDefinition query = new QueryDefinition(); query.setName("unAckErrors");
JBPM-<I> - Provide auto acknowledge jobs for execution errors (#<I>)
kiegroup_droolsjbpm-integration
train
java
415acb0e669b8e28b19fa9af5ed138c03d605b01
diff --git a/haphilipsjs/__init__.py b/haphilipsjs/__init__.py index <HASH>..<HASH> 100644 --- a/haphilipsjs/__init__.py +++ b/haphilipsjs/__init__.py @@ -102,7 +102,13 @@ class PhilipsTV(object): self.protocol = "http" self.port = 1925 - adapter = requests.sessions.HTTPAdapter(pool_connections=1, pool_maxsize=1, pool_block=True) + # for devices with notify support we must have two + if self.api_version > 1: + pool_maxsize=2 + else: + pool_maxsize=1 + + adapter = requests.sessions.HTTPAdapter(pool_connections=1, pool_maxsize=pool_maxsize, pool_block=True) self.session = requests.Session() self.session.verify=False self.session.mount("http://", adapter)
Make sure we allow two connections for v6
danielperna84_ha-philipsjs
train
py
8ea37461fedf9c6efc4ccd0f66b9f4000b200055
diff --git a/docx2html/core.py b/docx2html/core.py index <HASH>..<HASH> 100644 --- a/docx2html/core.py +++ b/docx2html/core.py @@ -886,6 +886,14 @@ def _get_document_data(f, image_handler=None): ### +def get_list_type(meta_data, numId, ilvl): + """ + Return the list type. If numId or ilvl not in the numbering dict then + default to returning decimal. + """ + return meta_data.numbering_dict.get(numId, {}).get(ilvl, 'decimal') + + def get_list_data(li_nodes, meta_data): """ Build the list structure and return the root list @@ -961,7 +969,7 @@ def get_list_data(li_nodes, meta_data): )) ilvl = get_ilvl(li_node, w_namespace) numId = get_numId(li_node, w_namespace) - list_type = meta_data.numbering_dict[numId].get(ilvl, 'decimal') + list_type = get_list_type(meta_data, numId, ilvl) # If the ilvl is greater than the current_ilvl or the list id is # changing then we have the first li tag in a nested list. We need to
refs #<I>: If an invalid numId or ilvl is used (for whatever reason) getting the list type will always fall back to decimal.
PolicyStat_docx2html
train
py
413e1f518bfaa30189659bca7e08e404f282d10f
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -35,6 +35,6 @@ setup( ], keywords='cryptography noiseprotocol noise security', packages=find_packages(exclude=['contrib', 'docs', 'tests', 'examples']), - install_requires=['cryptography==2.1.4'], + install_requires=['cryptography>=2.1.4'], python_requires='~=3.5', # we like 3.5, 3.6, and beyond, but not 4.0 )
setup.py: relax the pin on 'cryptography' refs #<I>
plizonczyk_noiseprotocol
train
py
9d32d9f1ef18b92a885c289117a5ad5a0b9d4815
diff --git a/raven/scripts/runner.py b/raven/scripts/runner.py index <HASH>..<HASH> 100644 --- a/raven/scripts/runner.py +++ b/raven/scripts/runner.py @@ -12,7 +12,6 @@ from __future__ import print_function import logging import os import sys -import pwd from optparse import OptionParser from raven import Client @@ -28,6 +27,20 @@ def store_json(option, opt_str, value, parser): setattr(parser.values, option.dest, value) +def get_loadavg(): + if hasattr(os, 'getloadavg'): + return os.getloadavg() + return None + + +def get_uid(): + try: + import pwd + except ImportError: + return None + return pwd.getpwuid(os.geteuid())[0] + + def send_test_message(client, options): print("Client configuration:") for k in ('servers', 'project', 'public_key', 'secret_key'): @@ -60,8 +73,8 @@ def send_test_message(client, options): stack=True, tags=options.get('tags', {}), extra={ - 'user': pwd.getpwuid(os.geteuid())[0], - 'loadavg': os.getloadavg(), + 'user': get_uid(), + 'loadavg': get_loadavg(), }, ))
Handle missing getloadavg and pwd in raven test (fixes GH-<I>)
getsentry_raven-python
train
py
e40bfc77d8c33457a82523ef9274ed4e31393696
diff --git a/src/electrumWrapper/indexElectrum.js b/src/electrumWrapper/indexElectrum.js index <HASH>..<HASH> 100644 --- a/src/electrumWrapper/indexElectrum.js +++ b/src/electrumWrapper/indexElectrum.js @@ -269,7 +269,9 @@ export class Electrum { } } else if (typeof this.requests[data.id] === 'object') { const request = this.requests[data.id] - this.connections[request.connectionID].responses += 1 + if (this.connections[request.connectionID]) { + this.connections[request.connectionID].responses += 1 + } if (!data.error) { request.onDataReceived(data.result) } else {
prevent from crash when server is dead or deleted
EdgeApp_edge-currency-bitcoin
train
js
3480eda199f59df6a72186ed10bc89f5ab92b5ec
diff --git a/js/okx.js b/js/okx.js index <HASH>..<HASH> 100644 --- a/js/okx.js +++ b/js/okx.js @@ -1865,8 +1865,10 @@ module.exports = class okx extends Exchange { defaultMethod = 'privatePostTradeOrderAlgo'; request['ordType'] = 'trigger'; request['triggerPx'] = this.priceToPrecision (symbol, stopPrice); - type = (type === 'market') ? -1 : this.priceToPrecision (symbol, price); - request['orderPx'] = type; + if (type === 'market') { + price = -1; + } + request['orderPx'] = this.priceToPrecision (symbol, price); } if (defaultMethod === 'privatePostTradeOrder' || defaultMethod === 'privatePostTradeOrderAlgo') { extendedRequest = this.extend (request, params);
Undo ternary, create new if statement to adjust price argument based on the type
ccxt_ccxt
train
js
42913b51fd5df2f30880337c511cca13d2bc338e
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -40,7 +40,7 @@ setup( packages=find_packages(), include_package_data=True, package_data={ - 'rw': ['*.html', '*.css', 'templates/html5', 'templates/form'] + 'rw': ['*.html', '*.css', 'templates/html5', 'templates/form', 'templates/nginx'] }, entry_points={ 'console_scripts': [
include nginx template in distribution
FlorianLudwig_rueckenwind
train
py
93d9c1458a4d215a6b187b3564dfe24ed2cb534d
diff --git a/src/openaccess_epub/utils/epub.py b/src/openaccess_epub/utils/epub.py index <HASH>..<HASH> 100644 --- a/src/openaccess_epub/utils/epub.py +++ b/src/openaccess_epub/utils/epub.py @@ -142,7 +142,7 @@ def make_epub_base(location): <?xml version="1.0" encoding="UTF-8" ?> <container version="1.0" xmlns="urn:oasis:names:tc:opendocument:xmlns:container"> <rootfiles> - <rootfile full-path="OPS/package.opf" media-type="application/oebps-package+xml"/> + <rootfile full-path="EPUB/package.opf" media-type="application/oebps-package+xml"/> </rootfiles> </container>''')
fixing the location string for the package document, renaming OPS folder to more general EPUB
SavinaRoja_OpenAccess_EPUB
train
py
3e392676a01164595c119069ed1f9da2afeeb962
diff --git a/version/version.go b/version/version.go index <HASH>..<HASH> 100644 --- a/version/version.go +++ b/version/version.go @@ -1,7 +1,7 @@ package version import ( - "github.com/coreos/updatectl/third_party/github.com/coreos/go-semver/semver" + "github.com/coreos-inc/updatectl/third_party/github.com/coreos/go-semver/semver" ) const Version = "0.1.0+git"
fix(version): import path was incorrect. build was not working.
coreos_updateservicectl
train
go
395fef7017e6fa1fdbf720c37c874558fa427391
diff --git a/lib/troy.rb b/lib/troy.rb index <HASH>..<HASH> 100644 --- a/lib/troy.rb +++ b/lib/troy.rb @@ -10,8 +10,11 @@ require "thor/group" require "rack" require "uglifier" require "html_press" + +level, $VERBOSE = $VERBOSE, nil require "rouge" require "rouge/plugins/redcarpet" +$VERBOSE = level require "cgi" require "fileutils"
Rouge is giving a warning about overriding constants. ¯\_(ツ)_/¯
fnando_troy
train
rb
62a2e859416967609b673b85726d8dd7ca1c31db
diff --git a/acos_client/v30/slb/member.py b/acos_client/v30/slb/member.py index <HASH>..<HASH> 100644 --- a/acos_client/v30/slb/member.py +++ b/acos_client/v30/slb/member.py @@ -32,6 +32,14 @@ class Member(base.BaseV30): ) return self._get(url, **kwargs) + + def get_oper(self, service_group_name, server_name, server_port, **kwargs): + url = self.url_base_tmpl.format(gname=service_group_name) + url += self.url_mbr_tmpl.format( + name=server_name, + port=server_port + ) + return self._get(url+'oper', **kwargs) def _write(self, service_group_name, diff --git a/acos_client/v30/slb/server.py b/acos_client/v30/slb/server.py index <HASH>..<HASH> 100644 --- a/acos_client/v30/slb/server.py +++ b/acos_client/v30/slb/server.py @@ -51,7 +51,10 @@ class Server(base.BaseV30): } } - self.get(name, **kwargs) + try: + self.get(name, **kwargs) + except acos_errors.NotFound: + raise acos_errors.NotFound() return self._post(self.url_prefix + name, params, **kwargs) def delete(self, name):
Rebased member opers commit * update method for a<I> server atributes * fix allow acos cliet to get member status
a10networks_acos-client
train
py,py
694f9a87bfbbfef5b8d6bee559a49a9e30935824
diff --git a/remote.go b/remote.go index <HASH>..<HASH> 100644 --- a/remote.go +++ b/remote.go @@ -197,9 +197,9 @@ func (wd *remoteWD) execute(method, url string, data []byte) ([]byte, error) { // Are we in debug mode, and did we read the response Body successfully? if debugFlag && err == nil { // Pretty print the JSON response - prettyBuf := bytes.NewBufferString("") - err = json.Indent(prettyBuf, buf, "", " ") - if prettyBuf.Len() > 0 { + var prettyBuf bytes.Buffer + err = json.Indent(&prettyBuf, buf, "", " ") + if err == nil && prettyBuf.Len() > 0 { buf = prettyBuf.Bytes() } }
Added error check and tidied declaration.
tebeka_selenium
train
go
10fe05e87595794baa6fedbf1a7b43df3e38aee0
diff --git a/src/test/java/io/github/bonigarcia/seljup/test/generic/GenericMixedTest.java b/src/test/java/io/github/bonigarcia/seljup/test/generic/GenericMixedTest.java index <HASH>..<HASH> 100644 --- a/src/test/java/io/github/bonigarcia/seljup/test/generic/GenericMixedTest.java +++ b/src/test/java/io/github/bonigarcia/seljup/test/generic/GenericMixedTest.java @@ -16,8 +16,6 @@ */ package io.github.bonigarcia.seljup.test.generic; -import static org.assertj.core.api.Assertions.assertThat; - import java.time.Duration; import org.junit.jupiter.api.AfterEach; @@ -55,8 +53,7 @@ class GenericMixedTest { driver.get("https://bonigarcia.org/selenium-jupiter/"); Wait<WebDriver> wait = new WebDriverWait(driver, Duration.ofSeconds(30)); - wait.until(d -> d.getTitle().contains("JUnit 5")); - assertThat(driver.getTitle()).contains("Selenium"); + wait.until(d -> d.getTitle().contains("Selenium-Jupiter")); } }
Simplify assertions in generic mixed test
bonigarcia_selenium-jupiter
train
java
409672d0f3956219c5c62f52011f2538fee6461f
diff --git a/guava/src/com/google/common/collect/Multisets.java b/guava/src/com/google/common/collect/Multisets.java index <HASH>..<HASH> 100644 --- a/guava/src/com/google/common/collect/Multisets.java +++ b/guava/src/com/google/common/collect/Multisets.java @@ -964,12 +964,7 @@ public final class Multisets { @Override public boolean remove(Object o) { - int count = multiset().count(o); - if (count > 0) { - multiset().remove(o, count); - return true; - } - return false; + return multiset().remove(o, Integer.MAX_VALUE) > 0; } @Override public int size() {
Improve the implementation of Multisets.ElementSet.remove to do only one operation. ------------- Created by MOE: <URL>
google_guava
train
java
d8ad798b8dc72cda86191dbebc3cc25aa648eab5
diff --git a/lib/Opauth/Strategy/Facebook/Facebook.php b/lib/Opauth/Strategy/Facebook/Facebook.php index <HASH>..<HASH> 100644 --- a/lib/Opauth/Strategy/Facebook/Facebook.php +++ b/lib/Opauth/Strategy/Facebook/Facebook.php @@ -40,6 +40,20 @@ class Facebook extends OpauthStrategy{ * Internal callback, after Facebook's OAuth */ public function int_callback(){ - print_r($_GET); + if (array_key_exists('code', $_GET) && !empty($_GET['code'])){ + $url = 'https://graph.facebook.com/oauth/access_token'; + $params = array( + 'client_id' =>$this->strategy['app_id'], + 'client_secret' => $this->strategy['app_secret'], + 'redirect_uri'=> $this->strategy['redirect_uri'], + 'code' => trim($_GET['code']) + ); + + $response = $this->httpRequest($url.'?'.http_build_query($params)); + echo $response; + } + else{ + // Error or authentication declined + } } } \ No newline at end of file
Obtain access_token with FB code
opauth_opauth
train
php
8e52bcaf8ab436d200ea3dead500f5bc7a78d23c
diff --git a/ruby/import-js/importer.rb b/ruby/import-js/importer.rb index <HASH>..<HASH> 100644 --- a/ruby/import-js/importer.rb +++ b/ruby/import-js/importer.rb @@ -4,7 +4,11 @@ require 'open3' module ImportJS class Importer def initialize - @config = { 'lookup_paths' => ['.'], 'aliases' => {} } + @config = { + 'lookup_paths' => ['.'], + 'aliases' => {}, + 'jshint_cmd' => 'jshint' + } config_file = '.importjs' if File.exist? config_file @config = @config.merge(YAML.load_file(config_file)) @@ -30,7 +34,7 @@ module ImportJS content = "/* jshint undef: true, strict: true */\n" + VIM.evaluate('join(getline(1, "$"), "\n")') - out, _ = Open3.capture3('jsxhint -', stdin_data: content) + out, _ = Open3.capture3("#{@config['jshint_cmd']} -", stdin_data: content) imported_variables = [] out.split("\n").each do |line|
Make jshint command configurable At Brigade we use jsxhint, which is a wrapper around jshint that adds support for jsx files. To make it possible to run that command instead of the hard-coded jshint, I've added a `jshint_cmd` configuration option.
Galooshi_import-js
train
rb
e8afa62ac7dcd38ab49d9326b264b78ee32346d0
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100755 --- a/setup.py +++ b/setup.py @@ -8,7 +8,7 @@ from astropy_helpers.setup_helpers import register_commands, get_package_info from astropy_helpers.version_helpers import generate_version_py NAME = 'astropy_helpers' -VERSION = '1.3.dev' +VERSION = '2.0.dev' RELEASE = 'dev' not in VERSION DOWNLOAD_BASE_URL = 'http://pypi.io/packages/source/a/astropy-helpers'
Next major version: <I>
astropy_astropy-helpers
train
py
6569ba198c3df5b12f2726d7fcdecd7269b800c7
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index <HASH>..<HASH> 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -7,14 +7,6 @@ $LOAD_PATH.unshift(File.dirname(__FILE__)) $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib')) require 'active_hash' -ActiveHash::Base.class_eval do - def self.to_ary - end - - def self.to_str - end -end - Spec::Runner.configure do |config| config.include Fixjour end
remove unnecessary shims for rspec
zilkey_active_hash
train
rb
3998ef74704085e441127d0abe678f3298985fa0
diff --git a/spans/__init__.py b/spans/__init__.py index <HASH>..<HASH> 100644 --- a/spans/__init__.py +++ b/spans/__init__.py @@ -11,7 +11,7 @@ together. """ -__version__ = "0.2.0" +__version__ = "0.2.1" __all__ = [ "intrange", "floatrange",
Updated version to <I>
runfalk_spans
train
py
cb4ff83107f8ff6b9062df1f6571a7728cad4ab3
diff --git a/lib/milia/railtie.rb b/lib/milia/railtie.rb index <HASH>..<HASH> 100644 --- a/lib/milia/railtie.rb +++ b/lib/milia/railtie.rb @@ -10,6 +10,7 @@ module Milia require File.dirname(__FILE__) + '/../../app/controllers/registrations_controller' require File.dirname(__FILE__) + '/../../app/controllers/sessions_controller' + require File.dirname(__FILE__) + '/../../app/controllers/passwords_controller' require File.dirname(__FILE__) + '/../../app/controllers/confirmations_controller' end
railtie for passwords controller include
jekuno_milia
train
rb
dbda67d906731feae90040b08833268d9f04deff
diff --git a/Console/Factories/FactoryMakeCommand.php b/Console/Factories/FactoryMakeCommand.php index <HASH>..<HASH> 100644 --- a/Console/Factories/FactoryMakeCommand.php +++ b/Console/Factories/FactoryMakeCommand.php @@ -60,8 +60,8 @@ class FactoryMakeCommand extends GeneratorCommand protected function buildClass($name) { $namespaceModel = $this->option('model') - ? $this->qualifyClass($this->option('model')) - : trim($this->rootNamespace(), '\\').'\\Model'; + ? $this->qualifyModel($this->option('model')) + : $this->qualifyModel('Model'); $model = class_basename($namespaceModel);
[8.x] Better model directory support (#<I>) * First pass at better model directory support This updates the relevant generator commands to respect the existence of a Models directory if one exists. If the Models directory exists and the given model class name is not qualified in any way - the class will be assumed to belong in the Models directory. * remove unneeded code * Apply fixes from StyleCI (#<I>)
illuminate_database
train
php
4ba19afb3f2244f4765e0404dda54bce66cddd6c
diff --git a/app/presenters/renalware/dashboard/dashboard_presenter.rb b/app/presenters/renalware/dashboard/dashboard_presenter.rb index <HASH>..<HASH> 100644 --- a/app/presenters/renalware/dashboard/dashboard_presenter.rb +++ b/app/presenters/renalware/dashboard/dashboard_presenter.rb @@ -24,8 +24,12 @@ module Renalware def letters_in_progress @letters_in_progress ||= begin present_letters( - Renalware::Letters.cast_author(user).letters.in_progress.reverse + Letters::Letter + .where("author_id = ? or created_by_id = ?", user.id, user.id) + .in_progress + .reverse ) + # Renalware::Letters.cast_author(user) end end
Display author and typist in progress letters on dashboard
airslie_renalware-core
train
rb
2ffdf7b46663132b5dfe3b09c3f1e3d92ab3b8a4
diff --git a/js/ui/igvModalTable.js b/js/ui/igvModalTable.js index <HASH>..<HASH> 100644 --- a/js/ui/igvModalTable.js +++ b/js/ui/igvModalTable.js @@ -42,6 +42,8 @@ var igv = (function (igv) { this.browser = browser; + this.dataSource = dataSource; + this.initialized = false; this.$modalTable = $('<table id="encodeModalTable" cellpadding="0" cellspacing="0" border="0" class="display"></table>'); @@ -99,6 +101,10 @@ var igv = (function (igv) { }; + igv.IGVModalTable.prototype.genomeID = function () { + return this.dataSource.config.genomeID; + }; + igv.IGVModalTable.prototype.unbindAllMouseHandlers = function () { this.$modalTable.find('tbody').unbind();
IGVModalTable. Added genomeID() method
igvteam_igv.js
train
js
cab4fc8466b80226c7f08c199bbe5f23908a6ccb
diff --git a/lib/jsi/base.rb b/lib/jsi/base.rb index <HASH>..<HASH> 100644 --- a/lib/jsi/base.rb +++ b/lib/jsi/base.rb @@ -338,7 +338,7 @@ module JSI # # - :auto (default): by default a JSI will be returned when either: # - # - the result is a complex value (responds to #to_ary or #to_hash) and is described by some schemas + # - the result is a complex value (responds to #to_ary or #to_hash) # - the result is a schema (including true/false schemas) # # a plain value is returned when no schemas are known to describe the instance, or when the value is a @@ -602,7 +602,7 @@ module JSI value_as_jsi = if [true, false].include?(as_jsi) as_jsi elsif as_jsi == :auto - complex_value = subinstance_schemas.any? && (value.respond_to?(:to_hash) || value.respond_to?(:to_ary)) + complex_value = value.respond_to?(:to_hash) || value.respond_to?(:to_ary) schema_value = subinstance_schemas.any? { |subinstance_schema| subinstance_schema.describes_schema? } complex_value || schema_value else
Base#[] returns all complex children as JSIs
notEthan_jsi
train
rb
2fe934d79611d8072eb957c965969c5a5eed31f9
diff --git a/src/Auth/Form/UserInfoFieldset.php b/src/Auth/Form/UserInfoFieldset.php index <HASH>..<HASH> 100644 --- a/src/Auth/Form/UserInfoFieldset.php +++ b/src/Auth/Form/UserInfoFieldset.php @@ -20,6 +20,12 @@ use Zend\Validator\NotEmpty; use Zend\Validator\EmailAddress; use Zend\Validator\File; +/** + * + * + * @author Mathias Gelhausen <gelhausen@cross-solution.de> + * @todo write test + */ class UserInfoFieldset extends Fieldset implements ViewPartialProviderInterface, EmptySummaryAwareInterface, @@ -27,6 +33,8 @@ class UserInfoFieldset extends Fieldset implements { use EmptySummaryAwareTrait; + + private $defaultEmptySummaryNotice = /*@translate*/ 'Click here to enter contact informations.'; /** * View script for rendering @@ -232,12 +240,4 @@ class UserInfoFieldset extends Fieldset implements ), ); } - - /** - * @return string - */ - protected function getDefaultEmptySummaryNotice() - { - return /*@translate*/ 'Click here to enter contact informations.'; - } }
[Auth] Fix usage of EmptySummaryAwareTrait in UserInfoFieldset
yawik_auth
train
php
2305d2609aa781c4357e9e14a5a979e50c5c8714
diff --git a/event/bus.go b/event/bus.go index <HASH>..<HASH> 100644 --- a/event/bus.go +++ b/event/bus.go @@ -59,7 +59,7 @@ func (self *EventBus) dispatch(ev *Event) { handlerFunc := reflect.ValueOf(listener.Handler).MethodByName(handlerFuncName) if handlerFunc.IsValid() { log.V(2).Infof("Calling event handler for %s on listener %s", ev.Type, listener.String()) - go handlerFunc.Call([]reflect.Value{reflect.ValueOf(ev)}) + go handlerFunc.Call([]reflect.Value{reflect.ValueOf(*ev)}) } } }
fix(EventBus): dereference Event before handing to listeners
coreos_fleet
train
go
24c477275ec41bc28057b51196cd69cbe4bfb1d0
diff --git a/app/Blueprint/Infrastructure/Service/Maker/PhpFpm/PhpVersions/PHP53.php b/app/Blueprint/Infrastructure/Service/Maker/PhpFpm/PhpVersions/PHP53.php index <HASH>..<HASH> 100644 --- a/app/Blueprint/Infrastructure/Service/Maker/PhpFpm/PhpVersions/PHP53.php +++ b/app/Blueprint/Infrastructure/Service/Maker/PhpFpm/PhpVersions/PHP53.php @@ -33,6 +33,12 @@ class PHP53 implements PhpVersion { $this->addAppSource($phpFpmService); + /** + * Copy environment variables because environment variables are expected to be available in php + */ + foreach( $mainService->getEnvironmentVariables() as $name => $value ) + $phpFpmService->setEnvironmentVariable($name, $value); + $mainService->addSidekick($phpFpmService); $mainService->addVolumeFrom($phpFpmService); $infrastructure->addService($phpFpmService);
php-fpm now also adds environment variables Php-Fpm needs to receive all environment variables so it receives access accounts
ipunkt_rancherize
train
php
97ed82d714ce43bda93b2951577c969f29930036
diff --git a/para-server/src/main/java/com/erudika/para/security/SimpleAuthenticationSuccessHandler.java b/para-server/src/main/java/com/erudika/para/security/SimpleAuthenticationSuccessHandler.java index <HASH>..<HASH> 100644 --- a/para-server/src/main/java/com/erudika/para/security/SimpleAuthenticationSuccessHandler.java +++ b/para-server/src/main/java/com/erudika/para/security/SimpleAuthenticationSuccessHandler.java @@ -67,7 +67,8 @@ public class SimpleAuthenticationSuccessHandler extends SimpleUrlAuthenticationS customURI = customURI.replace("jwt=?", "jwt=" + newJWT.serialize()); } else if (StringUtils.contains(customURI, "jwt=incookie")) { SignedJWT newJWT = SecurityUtils.generateJWToken(u, app); - HttpUtils.setStateParam(app.getAppIdentifier() + "-auth", newJWT.serialize(), request, response, true); + HttpUtils.setStateParam(app.getAppIdentifier().trim() + "-auth", + newJWT.serialize(), request, response, true); } if (!StringUtils.isBlank(customURI)) { redirectStrategy.sendRedirect(request, response, customURI);
fixed bug where cookie name contains reserved characters
Erudika_para
train
java
63242ec07dd27ef0a94bf61ed24a578a411d3267
diff --git a/hazelcast-jet-core/src/main/java/com/hazelcast/jet/impl/execution/ExecutionContext.java b/hazelcast-jet-core/src/main/java/com/hazelcast/jet/impl/execution/ExecutionContext.java index <HASH>..<HASH> 100644 --- a/hazelcast-jet-core/src/main/java/com/hazelcast/jet/impl/execution/ExecutionContext.java +++ b/hazelcast-jet-core/src/main/java/com/hazelcast/jet/impl/execution/ExecutionContext.java @@ -209,8 +209,11 @@ public class ExecutionContext { public CompletableFuture<SnapshotOperationResult> beginSnapshot(long snapshotId, String mapName, boolean isTerminal) { synchronized (executionLock) { - if (cancellationFuture.isDone() || executionFuture != null && executionFuture.isDone()) { + if (cancellationFuture.isDone()) { throw new CancellationException(); + } else if (executionFuture != null && executionFuture.isDone()) { + // if execution is done, there are 0 processors to take snapshots. Therefore we're done now. + return CompletableFuture.completedFuture(new SnapshotOperationResult(0, 0, 0, null)); } return snapshotContext.startNewSnapshot(snapshotId, mapName, isTerminal); }
Fix snapshot creation after execution is done (#<I>) For non-distributed sources that use `forceTotalParallelismOne`, batch processors are created on inactive members. If there's no distributed edge in the DAG, the execution on those members will complete immediately, while the execution on the active members tries to do snapshot. This PR changes the edge case behavior that if the execution is completed, we immediately respond to the SnapshotOperation instead of throwing a CancellationException.
hazelcast_hazelcast
train
java
6003be3aff0d05d6bc6973fa948800ef61d2cacd
diff --git a/glance-model/src/main/java/org/openstack/glance/model/Image.java b/glance-model/src/main/java/org/openstack/glance/model/Image.java index <HASH>..<HASH> 100644 --- a/glance-model/src/main/java/org/openstack/glance/model/Image.java +++ b/glance-model/src/main/java/org/openstack/glance/model/Image.java @@ -23,7 +23,7 @@ public class Image implements Serializable { @JsonProperty("container_format") private String containerFormat; - private Integer size; + private Long size; private String checksum; @@ -130,14 +130,14 @@ public class Image implements Serializable { /** * @return the size */ - public Integer getSize() { + public Long getSize() { return size; } /** * @param size the size to set */ - public void setSize(Integer size) { + public void setSize(Long size) { this.size = size; }
Change data type of "size" in Image.java The data type of "size" should be changed to "Long", because "Integer" will cause an error for large images as follows: "...Numeric value (<I>) out of range of int..."
woorea_openstack-java-sdk
train
java
634a9238ae2dc367d521d45413784e6d74f1c46e
diff --git a/index.js b/index.js index <HASH>..<HASH> 100644 --- a/index.js +++ b/index.js @@ -46,7 +46,7 @@ var ddos = function(params) { if (params.testmode) { console.log('ddos: handle: beginning:', table) } - var host = req.connection.remoteAddress + "#" + req.headers['user-agent'] + var host = (req.headers['x-forwarded-for'] || req.connection.remoteAddress) + "#" + req.headers['user-agent'] if (!table[host]) table[host] = { count : 1, expiry : 1 } else {
Update index.js if the request is proxy by nginx, the req.connection.remoteAddress is nginx ip. we need use the `real ip` by req.headers['x-forwarded-for']
rook2pawn_node-ddos
train
js
f616cee48fd288e2d51f0a482a2ce601f0303b9d
diff --git a/Mapping/Loader/PhpDocLoader.php b/Mapping/Loader/PhpDocLoader.php index <HASH>..<HASH> 100644 --- a/Mapping/Loader/PhpDocLoader.php +++ b/Mapping/Loader/PhpDocLoader.php @@ -55,8 +55,11 @@ class PhpDocLoader implements LoaderInterface array $denormalizationGroups = null, array $validationGroups = null ) { - if ($classReflector = $this->getClassReflector($classMetadata->getReflectionClass())) { - $classMetadata->setDescription($classReflector->getDocBlock()->getShortDescription()); + if ( + ($classReflector = $this->getClassReflector($classMetadata->getReflectionClass())) && + $docBlock = $classReflector->getDocBlock() + ) { + $classMetadata->setDescription($docBlock->getShortDescription()); } foreach ($classMetadata->getAttributes() as $attributeMetadata) {
Fix PhpDocLoader when the DocBlock doesn't exist
api-platform_core
train
php
13876835a5df0f638d044cbe92069fec71351929
diff --git a/resource_arm_network_security_group_test.go b/resource_arm_network_security_group_test.go index <HASH>..<HASH> 100644 --- a/resource_arm_network_security_group_test.go +++ b/resource_arm_network_security_group_test.go @@ -18,7 +18,7 @@ func TestAccAzureRMNetworkSecurityGroup_basic(t *testing.T) { CheckDestroy: testCheckAzureRMNetworkSecurityGroupDestroy, Steps: []resource.TestStep{ { - Config: testAccAzureRMNetworkSecurityGroup_basic(rInt()), + Config: testAccAzureRMNetworkSecurityGroup_basic(rInt), Check: resource.ComposeTestCheckFunc( testCheckAzureRMNetworkSecurityGroupExists("azurerm_network_security_group.test"), ),
provider/azurerm: Randomizing the ARM security group acceptance tests
terraform-providers_terraform-provider-azurerm
train
go
f2e0221703df19169ba00bbf8ed794219b73f1c1
diff --git a/lib/runner.rb b/lib/runner.rb index <HASH>..<HASH> 100644 --- a/lib/runner.rb +++ b/lib/runner.rb @@ -47,7 +47,7 @@ class Job if @type == 'rspec' result += `#{base_environment} export RSPEC_COLOR=true; cd instance#{instance}; rake testbot:before_run; script/spec -O spec/spec.opts #{@files} 2>&1` elsif @type == 'cucumber' - result += `#{base_environment} script/cucumber -f progress -r features/support -r features/step_definitions #{@files} 2>&1` + result += `#{base_environment} script/cucumber -f progress --backtrace -r features/support -r features/step_definitions #{@files} 2>&1` else raise "Unknown job type! (#{@type})" end
Adding backtrace to make cucumber dev simpler.
joakimk_testbot
train
rb
1ba160d3c97593bd51f37ff8eaf93ae438b2ed67
diff --git a/aur_test.go b/aur_test.go index <HASH>..<HASH> 100644 --- a/aur_test.go +++ b/aur_test.go @@ -61,11 +61,12 @@ func TestSearchByMaintainer(t *testing.T) { expectPackages(t, 3, rs, err) } +// Currently orphan searching is broken due to https://bugs.archlinux.org/task/62388 // TestOrphans test searching for orphans -func TestOrphans(t *testing.T) { - rs, err := Orphans() - expectPackages(t, 500, rs, err) -} +//func TestOrphans(t *testing.T) { +// rs, err := Orphans() +// expectPackages(t, 500, rs, err) +//} // TestSearchByDepends test searching for packages by depends func TestSearchByDepends(t *testing.T) {
Remove broken test Currently orphan searching is broken due to <URL>
mikkeloscar_aur
train
go
9bb3638d949ce1623991c98687e119f48d8de397
diff --git a/api/models.py b/api/models.py index <HASH>..<HASH> 100644 --- a/api/models.py +++ b/api/models.py @@ -537,9 +537,10 @@ class Node(UuidAuditedModel): chef['validation_name'] = settings.CHEF_VALIDATION_NAME chef['validation_key'] = settings.CHEF_VALIDATION_KEY chef['node_name'] = self.id - # use the layer's run list - chef['run_list'] = self.layer.run_list - chef['initial_attributes'] = self.layer.initial_attributes + if self.layer.run_list: + chef['run_list'] = self.layer.run_list + if self.layer.initial_attributes: + chef['initial_attributes'] = self.layer.initial_attributes # add the formation's ssh pubkey init.setdefault('ssh_authorized_keys', []).append( self.formation.ssh_public_key)
add run_list and initial_attributes conditionally
deis_deis
train
py
9c7b504bf0680ff6f8a4102a942e3908c9f368ed
diff --git a/tensorflow_datasets/__init__.py b/tensorflow_datasets/__init__.py index <HASH>..<HASH> 100644 --- a/tensorflow_datasets/__init__.py +++ b/tensorflow_datasets/__init__.py @@ -16,6 +16,11 @@ # pylint: disable=line-too-long """`tensorflow_datasets` (`tfds`) defines a collection of datasets ready-to-use with TensorFlow. +Warning: these docs are from branch `master`. `tensorflow-datasets` will +release a stable version shortly. Follow the +[release tracking issue](https://github.com/tensorflow/datasets/issues/5) +to be notified of release. + Each dataset is defined as a `tfds.core.DatasetBuilder`, which encapsulates the logic to download the dataset and construct an input pipeline, as well as contains the dataset documentation (version, splits, number of examples, etc.).
Add warning in API docs. Docs are from master PiperOrigin-RevId: <I>
tensorflow_datasets
train
py
ac7ac1fa77b14882addd8211705308e3f3ac368f
diff --git a/anycast_healthchecker/main.py b/anycast_healthchecker/main.py index <HASH>..<HASH> 100755 --- a/anycast_healthchecker/main.py +++ b/anycast_healthchecker/main.py @@ -8,6 +8,10 @@ # # Created by: Pavlos Parissis <pavlos.parissis@booking.com> # +# pylint: disable=too-many-arguments +# pylint: disable=too-many-statements +# pylint: disable=superfluous-parens +# import os import sys import daemon
added pylint filtering
unixsurfer_anycast_healthchecker
train
py
0607a818c3f874bf30369a7b597267d2c9349050
diff --git a/CigarIterator/__init__.py b/CigarIterator/__init__.py index <HASH>..<HASH> 100755 --- a/CigarIterator/__init__.py +++ b/CigarIterator/__init__.py @@ -1,7 +1,7 @@ import re -from enum import Enum +from enum import IntEnum -class CigarOps(Enum): +class CigarOps(IntEnum): CMATCH = 0 # M CINS = 1 # I CDEL = 2 # D diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100755 --- a/setup.py +++ b/setup.py @@ -3,7 +3,7 @@ from setuptools import setup, find_packages with open('README.rst') as readme: setup( name='CigarIterator', - version='1.0.0', + version='1.0.3', packages=find_packages(), long_description=readme.read(), url='https://github.com/innovate-invent/CigarIterator',
changed Enum to IntEnum
innovate-invent_CigarIterator
train
py,py
8b8ca826b6e04f12eb50357aaa1ff4500b6234c3
diff --git a/src/internal/middleware/logging/interceptor.go b/src/internal/middleware/logging/interceptor.go index <HASH>..<HASH> 100644 --- a/src/internal/middleware/logging/interceptor.go +++ b/src/internal/middleware/logging/interceptor.go @@ -112,6 +112,14 @@ var endpoints = map[string]logConfig{ }, }, + "/enterprise_v2.API/GetState": { + transformResponse: func(r interface{}) interface{} { + copyResp := proto.Clone(r.(*enterprise.GetStateResponse)).(*enterprise.GetStateResponse) + copyResp.ActivationCode = "" + return copyResp + }, + }, + "/enterprise_v2.API/Activate": { transformRequest: func(r interface{}) interface{} { copyReq := proto.Clone(r.(*enterprise.ActivateRequest)).(*enterprise.ActivateRequest)
CORE-<I> Add logging response transformer to omit activation code from GetState (#<I>)
pachyderm_pachyderm
train
go
65c549ee64f6f4e7d80d5f7e551317a3d442c8de
diff --git a/aiocqhttp/__init__.py b/aiocqhttp/__init__.py index <HASH>..<HASH> 100644 --- a/aiocqhttp/__init__.py +++ b/aiocqhttp/__init__.py @@ -51,7 +51,7 @@ def _deco_maker(deco_method: Callable, type_: str) -> Callable: deco_method(self, type_)(func) return func - if isinstance(arg, Callable): + if callable(arg): return deco(arg) return deco
use builtin callable() to check callable type same as <URL>
richardchien_python-aiocqhttp
train
py
41f634812f1ee6b734e7d5fb25486b66ab351d0a
diff --git a/setuptools/command/easy_install.py b/setuptools/command/easy_install.py index <HASH>..<HASH> 100755 --- a/setuptools/command/easy_install.py +++ b/setuptools/command/easy_install.py @@ -148,12 +148,9 @@ class easy_install(Command): create_index = PackageIndex def initialize_options(self): - if site.ENABLE_USER_SITE: - whereami = os.path.abspath(__file__) - self.user = whereami.startswith(site.USER_SITE) - else: - self.user = 0 - + # the --user option seemst to be an opt-in one, + # so the default should be False. + self.user = 0 self.zip_ok = self.local_snapshots_ok = None self.install_dir = self.script_dir = self.exclude_scripts = None self.index_url = None
Different treatment of --user option to easy_install (refs #<I>)
pypa_setuptools
train
py
d24ea6693399b2d9b446dedb7cf1a452a0ea3c58
diff --git a/lib/jekyll/tags/highlight.rb b/lib/jekyll/tags/highlight.rb index <HASH>..<HASH> 100644 --- a/lib/jekyll/tags/highlight.rb +++ b/lib/jekyll/tags/highlight.rb @@ -42,7 +42,7 @@ eos def render(context) prefix = context["highlighter_prefix"] || "" suffix = context["highlighter_suffix"] || "" - code = super.to_s.gsub(/^(\n|\r)+|(\n|\r)+$/, '') + code = super.to_s.gsub(/\A(\n|\r)+|(\n|\r)+\z/, '') is_safe = !!context.registers[:site].safe
The highlight tip should only clip the newlines before and after the *entire* block, not in between. Ref: <URL>
jekyll_jekyll
train
rb
57f28f8167b67f3d4822e2c586b5056bfa192716
diff --git a/src/components/victory-axis/helper-methods.js b/src/components/victory-axis/helper-methods.js index <HASH>..<HASH> 100644 --- a/src/components/victory-axis/helper-methods.js +++ b/src/components/victory-axis/helper-methods.js @@ -270,7 +270,8 @@ export default { const scaleTicks = scale.ticks(props.tickCount); const ticks = Array.isArray(scaleTicks) && scaleTicks.length ? scaleTicks : scale.domain(); if (props.crossAxis) { - return includes(ticks, 0) ? without(ticks, 0) : ticks; + const filteredTicks = includes(ticks, 0) ? without(ticks, 0) : ticks; + return filteredTicks.length ? filteredTicks : ticks; } return ticks; }
dont filter zeros if ticks would be empty
FormidableLabs_victory
train
js
8436f49b21091ce7df52d0e0517ded9bf3644692
diff --git a/includes/class-freemius.php b/includes/class-freemius.php index <HASH>..<HASH> 100755 --- a/includes/class-freemius.php +++ b/includes/class-freemius.php @@ -19326,7 +19326,7 @@ $this->get_parent_instance() : $this; - return $fs->get_account_url( 'download_latest', $params ); + return $this->apply_filters( 'download_latest_url', $fs->get_account_url( 'download_latest', $params ) ); } #endregion Download Plugin ------------------------------------------------------------------
[filters] [new] Added a filter to optionally override the latest download URL.
Freemius_wordpress-sdk
train
php
b815ca593fc891c26ad646e21a06bb92fd168e23
diff --git a/tests/Database/Test/DatabaseCreateTest.php b/tests/Database/Test/DatabaseCreateTest.php index <HASH>..<HASH> 100644 --- a/tests/Database/Test/DatabaseCreateTest.php +++ b/tests/Database/Test/DatabaseCreateTest.php @@ -17,8 +17,6 @@ use Josantonius\Database\Database, final class DatabaseCreateTest extends TestCase { - private $db; - /** * Get connection test. * @@ -28,13 +26,36 @@ final class DatabaseCreateTest extends TestCase { */ public function testGetConnection() { - $this->db = Database::getConnection('identifier'); + $db = Database::getConnection('identifier'); - $database = $this->db; + $this->assertContains('identifier', $db::$id); - $this->assertContains('identifier', $database::$id); + return $db; } + /** + * [QUERY] [CREATE TABLE] [RETURN TRUE] + * + * @since 1.1.6 + * + * @depends testGetConnection + * + * @return void + */ + public function testCreateTableQuery($db) { + + $result = $db->query( + 'CREATE TABLE IF NOT EXISTS test ( + + id INT(6) UNSIGNED AUTO_INCREMENT PRIMARY KEY, + name VARCHAR(30) NOT NULL, + email VARCHAR(50), + reg_date TIMESTAMP + )' + ); + + $this->assertTrue($result); + } }
Updated to <I> version
Josantonius_PHP-Database
train
php
33191e2079ff5027cb89d27bbc2b6a4e67f9afaf
diff --git a/activerecord/test/cases/migration_test.rb b/activerecord/test/cases/migration_test.rb index <HASH>..<HASH> 100644 --- a/activerecord/test/cases/migration_test.rb +++ b/activerecord/test/cases/migration_test.rb @@ -399,6 +399,7 @@ class MigrationTest < ActiveRecord::TestCase ActiveRecord::Migrator.migrations_paths = old_path ENV["RAILS_ENV"] = original_rails_env ENV["RACK_ENV"] = original_rack_env + ActiveRecord::Migrator.up(migrations_path) end def test_migration_sets_internal_metadata_even_when_fully_migrated @@ -425,6 +426,7 @@ class MigrationTest < ActiveRecord::TestCase ActiveRecord::Migrator.migrations_paths = old_path ENV["RAILS_ENV"] = original_rails_env ENV["RACK_ENV"] = original_rack_env + ActiveRecord::Migrator.up(migrations_path) end def test_internal_metadata_stores_environment_when_other_data_exists
Fix random failure related to migration environment - Reference: <URL>
rails_rails
train
rb
5cc108605faf3ef0fbc7cc5dc982cf1d22c029f6
diff --git a/services/containers/service.go b/services/containers/service.go index <HASH>..<HASH> 100644 --- a/services/containers/service.go +++ b/services/containers/service.go @@ -124,7 +124,7 @@ func (s *Service) Update(ctx context.Context, req *api.UpdateContainerRequest) ( } } - updated, err := store.Update(ctx, container) + updated, err := store.Update(ctx, container, fieldpaths...) if err != nil { return err }
service/containers: correctly plumb fieldpaths
containerd_containerd
train
go
7396be841ae0a6be7cd6cdbfd2be71b1f0880c7d
diff --git a/spyderlib/widgets/arrayeditor.py b/spyderlib/widgets/arrayeditor.py index <HASH>..<HASH> 100644 --- a/spyderlib/widgets/arrayeditor.py +++ b/spyderlib/widgets/arrayeditor.py @@ -415,6 +415,8 @@ class ArrayView(QTableView): def _sel_to_text(self, cell_range): """Copy an array portion to a unicode string""" + if not cell_range: + return row_min, row_max, col_min, col_max = get_idx_rect(cell_range) _data = self.model().get_data() if PY3:
Variable Explorer: Fix error while tryong to copy array contents when nothing is selected
spyder-ide_spyder
train
py
2af4a021f9589a708ac7f5f24197d1cef21921e5
diff --git a/services/dialog/v1.js b/services/dialog/v1.js index <HASH>..<HASH> 100644 --- a/services/dialog/v1.js +++ b/services/dialog/v1.js @@ -112,7 +112,7 @@ Dialog.prototype.conversation = function(params, callback) { formData: omit(params, ['dialog_id']), path: params }, - requiredParams: ['dialog_id', 'client_id'], + requiredParams: ['dialog_id'], defaultOptions: this._options }; return requestFactory(parameters, callback);
remove client_id from dialog service
watson-developer-cloud_node-sdk
train
js
34a8eb4b1e9d6bbe5271c1ff4149e0f0f6391788
diff --git a/test.js b/test.js index <HASH>..<HASH> 100644 --- a/test.js +++ b/test.js @@ -1,9 +1,9 @@ -/* global afterEach, beforeEach, it */ +/*global afterEach, beforeEach, it */ 'use strict'; var assert = require('assert'); var fs = require('fs'); -var pageres = require('./index'); var rm = require('rimraf'); +var pageres = require('./index'); afterEach(function (cb) { process.chdir('../'); @@ -17,9 +17,11 @@ beforeEach(function (cb) { }); it('should generate screenshots', function (cb) { - pageres(['yeoman.io'], ['1024x768', '640x480'], function () { + pageres(['yeoman.io', 'todomvc.com'], ['1024x768', '640x480'], function () { assert(fs.existsSync('yeoman.io-640x480.png')); assert(fs.existsSync('yeoman.io-1024x768.png')); + assert(fs.existsSync('todomvc.com-640x480.png')); + assert(fs.existsSync('todomvc.com-1024x768.png')); cb(); }); });
tests - make sure it also supports multiple urls
sindresorhus_pageres-cli
train
js
892b736a0c5fa5b9c8323f3d5bf3c2ea100b1d68
diff --git a/src/org/mozilla/javascript/IRFactory.java b/src/org/mozilla/javascript/IRFactory.java index <HASH>..<HASH> 100644 --- a/src/org/mozilla/javascript/IRFactory.java +++ b/src/org/mozilla/javascript/IRFactory.java @@ -1239,6 +1239,7 @@ final class IRFactory } case Token.GET_REF: { Node ref = left.getFirstChild(); + checkMutableReference(ref); return new Node(Token.SET_REF, ref, right); } } @@ -1246,6 +1247,14 @@ final class IRFactory throw Kit.codeBug(); } + private void checkMutableReference(Node n) + { + int memberTypeFlags = n.getIntProp(Node.MEMBER_TYPE_PROP, 0); + if ((memberTypeFlags & Node.DESCENDANTS_FLAG) != 0) { + parser.reportError("msg.bad.assign.left"); + } + } + Node createAssignment(int assignType, Node left, Node right) { left = makeReference(left); @@ -1297,6 +1306,7 @@ final class IRFactory } case Token.GET_REF: { Node ref = left.getFirstChild(); + checkMutableReference(ref); Node opLeft = new Node(Token.USE_STACK); Node op = new Node(assignOp, opLeft, right); return new Node(Token.SET_REF_OP, ref, op);
Fixing bug <I>: now parser throws syntax error on assignments to descendants like x..y = 1
mozilla_rhino
train
java
53272de3f5e8bea2bd3877a48b122daf8d31dbd8
diff --git a/lib/Alchemy/Phrasea/Controller/Api/V1Controller.php b/lib/Alchemy/Phrasea/Controller/Api/V1Controller.php index <HASH>..<HASH> 100644 --- a/lib/Alchemy/Phrasea/Controller/Api/V1Controller.php +++ b/lib/Alchemy/Phrasea/Controller/Api/V1Controller.php @@ -1984,7 +1984,7 @@ class V1Controller extends Controller return $this->getBadRequestAction($request); } - $datas = substr($datas, 0, ($n)) . $value . substr($datas, ($n + 2)); + $datas = substr($datas, 0, ($n)) . $value . substr($datas, ($n + 1)); } $record->setStatus(strrev($datas));
PHRAS-<I>_setstatus-api_<I> : port of PHRAS-<I> setstatus api did change unspecified bits due to string offset error
alchemy-fr_Phraseanet
train
php
b9b2d78f18a0590aaaaba6f11f757cae5cc77eb6
diff --git a/tests/test_dependencies.py b/tests/test_dependencies.py index <HASH>..<HASH> 100644 --- a/tests/test_dependencies.py +++ b/tests/test_dependencies.py @@ -277,3 +277,22 @@ def test_multiple_inheritance_with_injector(): b = 2 assert 3 == Summator().add() + + +def test_object_inheritance_restrictions(): + """Follows `object` inheritance principles. + + Deny to use same class in the bases twice. + + """ + + class Foo(Injectable): + pass + + with pytest.raises(TypeError): + class Bar(Injector, Foo, Foo): + pass + + with pytest.raises(TypeError): + class Baz(Injector, Foo, Injector): + pass
Test for repeat same class in the injector bases.
dry-python_dependencies
train
py
bfebdfa33af6fe21141eb79e926c7a31853acc13
diff --git a/src/components/CssUtilityTable.js b/src/components/CssUtilityTable.js index <HASH>..<HASH> 100644 --- a/src/components/CssUtilityTable.js +++ b/src/components/CssUtilityTable.js @@ -23,12 +23,10 @@ const CssUtilityTable = ({ group }) => ( } } `} - render={data => { + render={(data) => { const cssUtilData = data.allSassUtilitiesJson.edges - .filter(item => ( - item.node.group[0] === group - )) - .map(item => ({ + .filter((item) => item.node.group[0] === group) + .map((item) => ({ name: item.node.context.name, description: item.node.description, group: item.node.group[0], @@ -50,7 +48,7 @@ const CssUtilityTable = ({ group }) => ( { name: 'description', header: 'Description', - } + }, ]} rows={cssUtilData} /> @@ -60,7 +58,7 @@ const CssUtilityTable = ({ group }) => ( ); CssUtilityTable.propTypes = { - group: PropTypes.string -} + group: PropTypes.string, +}; export default CssUtilityTable;
eslint add trailing commas, and parenthesis
sparkdesignsystem_spark-design-system
train
js
f613a5c87fa8417a5de0a88e1b552f75bfe39ea8
diff --git a/spec/lib/bandiera/client_spec.rb b/spec/lib/bandiera/client_spec.rb index <HASH>..<HASH> 100644 --- a/spec/lib/bandiera/client_spec.rb +++ b/spec/lib/bandiera/client_spec.rb @@ -62,7 +62,7 @@ describe Bandiera::Client do expect(Typhoeus::Request) .to receive(:new) - .with("#{api_uri}/v2/groups/foo/features/bar", method: :get, timeout: 24, open_timeout: 24, headers: {"User-Agent"=>"Bandiera Ruby Client / 3.0.4"}, params: {}) + .with("#{api_uri}/v2/groups/foo/features/bar", method: :get, timeout: 24, open_timeout: 24, headers: {"User-Agent"=>"Bandiera Ruby Client / #{Bandiera::Client::VERSION}"}, params: {}) .once .and_return(resource)
Make Bandiera User-Agent string dynamic in client tests
springernature_bandiera-client-ruby
train
rb
2ecacd030f4f9f58b738eb24c3b7ac0eeaf1a488
diff --git a/motion/adapters/array_finder_query.rb b/motion/adapters/array_finder_query.rb index <HASH>..<HASH> 100644 --- a/motion/adapters/array_finder_query.rb +++ b/motion/adapters/array_finder_query.rb @@ -163,6 +163,7 @@ module MotionModel def all to_a end + alias_method :array, :all # returns all elements that match as an array. def to_a
Add #array method as alias of #all
sxross_MotionModel
train
rb
d6eb1e3b7bdf1e8fbf500f49659f82454e709441
diff --git a/nmea.js b/nmea.js index <HASH>..<HASH> 100644 --- a/nmea.js +++ b/nmea.js @@ -57,8 +57,7 @@ exports.parsers = { trackTrue: +fields[8], date: fields[9], variation: +fields[10], - variationPole: fields[11], - checksum: fields[12] + variationPole: fields[11] }; }, VTG: function(fields) { @@ -67,8 +66,7 @@ exports.parsers = { trackTrue: +fields[1], trackMagnetic: +fields[3], speedKnots: +fields[5], - speedKmph: +fields[7], - checksum: fields[9] + speedKmph: +fields[7] }; }, GSA: function(fields) {
Removed superfluous checksum fields as per #2
jamesp_node-nmea
train
js
3a8fd1cdef0697e7a960f2370bb4bdc96b77e299
diff --git a/examples/example_22_saga_python/start_saga.py b/examples/example_22_saga_python/start_saga.py index <HASH>..<HASH> 100644 --- a/examples/example_22_saga_python/start_saga.py +++ b/examples/example_22_saga_python/start_saga.py @@ -13,10 +13,10 @@ import os import traceback -ADDRESS = '130.149.250.16' -USER = 'user' -PASSWORD = '12345' -WORKING_DIR = '/home/' + USER + '/python/saga-test' +ADDRESS = '12345.fake.street' # Address of your server +USER = 'user' # Username +PASSWORD = '12345' # That's amazing I got the same combination on my luggage! +WORKING_DIR = '/myhome/' # Your working directory def upload_file(filename, session):
FIX: Also changed address;
SmokinCaterpillar_pypet
train
py
a2bf514b3fe7c2b6de6e8ba806e386702d4d5c47
diff --git a/lib/livestyle.inc.js b/lib/livestyle.inc.js index <HASH>..<HASH> 100644 --- a/lib/livestyle.inc.js +++ b/lib/livestyle.inc.js @@ -78,15 +78,22 @@ var socket = io.connect(); socket.on('connect', function () { - var cssIncludes = findCssIncludes(), - hrefs = [], - i; + var hrefs = [], + watchNewStylesheets = function () { + var cssIncludes = fincCssIncludes(), + i; + + for (i = 0; i < cssIncludes.length; i += 1) { + if (hrefs.indexOf(cssIncludes[i].href) === -1) { + hrefs.push(cssIncludes[i].href); + } + } - for (i = 0; i < cssIncludes.length; i += 1) { - hrefs.push(cssIncludes[i].href); - } + socket.emit('watch', hrefs, location.href); + }; - socket.emit('watch', hrefs, location.href); + watchNewStylesheets(); + setInterval(warchNewStyleSheets, 2000); }).on('change', refresh); }, state = {},
Subscribe to changes to runtime injected stylesheets
One-com_livestyle
train
js
c2f38fb6d3299cf9c479164f6f18e1e18fee6b5d
diff --git a/src/main/java/org/jboss/netty/channel/ChannelPipelineFactory.java b/src/main/java/org/jboss/netty/channel/ChannelPipelineFactory.java index <HASH>..<HASH> 100644 --- a/src/main/java/org/jboss/netty/channel/ChannelPipelineFactory.java +++ b/src/main/java/org/jboss/netty/channel/ChannelPipelineFactory.java @@ -24,6 +24,10 @@ package org.jboss.netty.channel; /** * Creates a new {@link ChannelPipeline} for a new {@link Channel}. + * <p> + * This interface was introduced to initialize the {@link ChannelPipeline} of + * the child channel accepted by a server-side, but it's safe to use it for + * any other purposes. * * @author The Netty Project (netty-dev@lists.jboss.org) * @author Trustin Lee (tlee@redhat.com)
More story in ChannelPipelineFactory
netty_netty
train
java