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
68c4af876e0c7335ac89cebcb4ac3e9340b388a3
diff --git a/src/Fcm.php b/src/Fcm.php index <HASH>..<HASH> 100644 --- a/src/Fcm.php +++ b/src/Fcm.php @@ -44,7 +44,7 @@ class Fcm extends Gcm $json = $result->getBody(); - $this->setFeedback(json_decode($json)); + $this->setFeedback(json_decode($json, false, 512, JSON_BIGINT_AS_STRING)); } catch (\Exception $e) { $response = ['success' => false, 'error' => $e->getMessage()];
Using JSON_BIGINT_AS_STRING as bitmask to prevent large integers convertion to float type. Fixes #<I>
Edujugon_PushNotification
train
php
e6e8b9fe2c4efb832ef3602852c76d1e71be140f
diff --git a/lib/take2/configuration.rb b/lib/take2/configuration.rb index <HASH>..<HASH> 100644 --- a/lib/take2/configuration.rb +++ b/lib/take2/configuration.rb @@ -25,9 +25,8 @@ module Take2 ].freeze @retry_proc = proc {} @retry_condition_proc = proc { false } - @time_to_sleep = 3 - @start = @time_to_sleep # TODO: Soft deprecate time to sleep - @backoff_setup = { type: :constant, start: @start } + @time_to_sleep = 0 # TODO: Soft deprecate time to sleep + @backoff_setup = { type: :constant, start: 3 } @backoff_intervals = Backoff.new(*@backoff_setup.values).intervals # Overwriting the defaults validate_options(options, &setter) diff --git a/spec/take2/configuration_spec.rb b/spec/take2/configuration_spec.rb index <HASH>..<HASH> 100644 --- a/spec/take2/configuration_spec.rb +++ b/spec/take2/configuration_spec.rb @@ -30,7 +30,7 @@ RSpec.describe(Take2::Configuration) do end it 'has correct default value for time_to_sleep' do - expect(default.time_to_sleep).to(eql(3)) + expect(default.time_to_sleep).to(eql(0)) end it 'has correct default value for backoff_intervals' do
support time to sleep only if set manually
restaurant-cheetah_take2
train
rb,rb
8520e746eef92249a41ff1821658b13457c71da2
diff --git a/src/test/java/com/algolia/search/saas/SimpleTest.java b/src/test/java/com/algolia/search/saas/SimpleTest.java index <HASH>..<HASH> 100644 --- a/src/test/java/com/algolia/search/saas/SimpleTest.java +++ b/src/test/java/com/algolia/search/saas/SimpleTest.java @@ -543,7 +543,7 @@ public class SimpleTest { @Test public void test34_securedApiKeys() { - assertEquals("143fec7bef6f16f6aa127a4949948a966816fa154e67a811e516c2549dbe2a8b", APIClient.hmac("my_api_key", "(public,user1)")); + assertEquals("1fd74b206c64fb49fdcd7a5f3004356cd3bdc9d9aba8733656443e64daafc417", APIClient.hmac("my_api_key", "(public,user1)")); String key = client.generateSecuredApiKey("my_api_key", "(public,user1)"); assertEquals(key, APIClient.hmac("my_api_key", "(public,user1)")); key = client.generateSecuredApiKey("my_api_key", "(public,user1)", "" + 42);
Update hmac value in the test
algolia_algoliasearch-client-android
train
java
5c11bf95b8e18c54d3351d12c2452c36514d37d7
diff --git a/src/main/java/org/craftercms/engine/controller/ComponentRenderController.java b/src/main/java/org/craftercms/engine/controller/ComponentRenderController.java index <HASH>..<HASH> 100644 --- a/src/main/java/org/craftercms/engine/controller/ComponentRenderController.java +++ b/src/main/java/org/craftercms/engine/controller/ComponentRenderController.java @@ -41,7 +41,7 @@ public class ComponentRenderController { this.renderComponentViewName = renderComponentViewName; } - @RequestMapping(method = RequestMethod.GET) + @RequestMapping(method = {RequestMethod.GET, RequestMethod.POST}) protected ModelAndView render(@RequestParam("path") String path) throws Exception { return new ModelAndView(renderComponentViewName, COMPONENT_PATH_MODEL_NAME, path); }
Controller fix: * Added support of POST method to ComponentRenderController.
craftercms_engine
train
java
eb0170a587965f75240de23b793ca2d3fa23c37c
diff --git a/tests/conftest.py b/tests/conftest.py index <HASH>..<HASH> 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -379,8 +379,10 @@ def dummy_mailer(): from smtplib import SMTP from dallinger.heroku import messages server = mock.create_autospec(SMTP) + orig_server = messages.get_email_server messages.get_email_server = lambda: server - return server + yield server + messages.get_email_server = orig_server def pytest_addoption(parser): diff --git a/tests/test_experiment_server.py b/tests/test_experiment_server.py index <HASH>..<HASH> 100644 --- a/tests/test_experiment_server.py +++ b/tests/test_experiment_server.py @@ -336,6 +336,7 @@ class TestHandleError(object): dummy_mailer.sendmail.assert_called_once() assert dummy_mailer.sendmail.call_args[0][0] == u'test_error@gmail.com' + @pytest.mark.usefixtures('experiment_dir', 'db_session') class TestWorkerFailed(object):
Fix style error and un-monkeypatch fixture.
Dallinger_Dallinger
train
py,py
27bb02ad6f39477160347a6755c68748ec3ab6a9
diff --git a/rspec/rspec_helper.rb b/rspec/rspec_helper.rb index <HASH>..<HASH> 100644 --- a/rspec/rspec_helper.rb +++ b/rspec/rspec_helper.rb @@ -1,3 +1,5 @@ -$LOAD_PATH.unshift(File.dirname(__FILE__) + '/../lib/view_assets') +RSPEC_ROOT = File.dirname(__FILE__) +$LOAD_PATH.unshift(RSPEC_ROOT + '/../lib/view_assets') require 'view_assets' -include ViewAssets \ No newline at end of file +include ViewAssets +FIXTURE_ROOT = RSPEC_ROOT + '/fixtures'
use FIXTURE_ROOT constant to store the path to fixtures
bom-d-van_view_assets
train
rb
a3ce2414629e11938ef1760479e1644edb4bf39b
diff --git a/DataFixtures/ObjectFactory.php b/DataFixtures/ObjectFactory.php index <HASH>..<HASH> 100644 --- a/DataFixtures/ObjectFactory.php +++ b/DataFixtures/ObjectFactory.php @@ -9,6 +9,7 @@ class ObjectFactory { private $manager; private $className; + private $defaultAttributes; public function __construct( ReferenceRepository $referenceRepository, @@ -25,9 +26,11 @@ class ObjectFactory public function add(array $attributes = array()) { + // We do not override $attributes because the reference manipulator will use the first element to generate the reference name + $mergedAttributes = array_merge($this->defaultAttributes, $attributes); $object = new $this->className(); - foreach ($attributes as $attribute => $value) { + foreach ($mergedAttributes as $attribute => $value) { $object->{'set'.ucfirst($attribute)}($value); } @@ -40,4 +43,11 @@ class ObjectFactory return $this; } + + public function setDefaults(array $attributes = array()) + { + $this->defaultAttributes = $attributes; + + return $this; + } }
Added a method to set default values to fixtures
KnpLabs_KnpRadBundle
train
php
821e56ad4aba6b6ce097d9b355cfb673ad46af68
diff --git a/aeron-client/src/main/java/uk/co/real_logic/aeron/Publication.java b/aeron-client/src/main/java/uk/co/real_logic/aeron/Publication.java index <HASH>..<HASH> 100644 --- a/aeron-client/src/main/java/uk/co/real_logic/aeron/Publication.java +++ b/aeron-client/src/main/java/uk/co/real_logic/aeron/Publication.java @@ -240,7 +240,14 @@ public class Publication implements AutoCloseable final int nextIndex = nextPartitionIndex(activeIndex); logAppenders[nextIndex].defaultHeader().putInt(TERM_ID_FIELD_OFFSET, newTermId, LITTLE_ENDIAN); - logAppenders[previousPartitionIndex(activeIndex)].statusOrdered(NEEDS_CLEANING); + + final int previousIndex = previousPartitionIndex(activeIndex); + + // Need to advance the term id in case a publication takes an interrupt between reading the active term + // and incrementing the tail. This covers the case of interrupt talking over one term in duration. + logAppenders[previousIndex].defaultHeader().putInt(TERM_ID_FIELD_OFFSET, newTermId + 1, LITTLE_ENDIAN); + + logAppenders[previousIndex].statusOrdered(NEEDS_CLEANING); LogBufferDescriptor.activeTermId(logMetaDataBuffer, newTermId); }
[Java] Handel the case of a publisher reading the active term id and then taking an interrupt before doing an increment on the the term tail.
real-logic_aeron
train
java
b5a58037eda19e6b2b56467b9ca53706375873d7
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100755 --- a/setup.py +++ b/setup.py @@ -64,9 +64,13 @@ class bump_version(Command): args = ['--verbose'] if self.verbose > 1 else [] for k, v in kwargs.items(): - k = "--{}".format(k.replace("_", "-")) - is_bool = isinstance(v, bool) and v is True - args.extend([k] if is_bool else [k, str(v)]) + arg = "--{}".format(k.replace("_", "-")) + if isinstance(v, bool): + if v is False: + continue + args.append(arg) + else: + args.extend([arg, str(v)]) args.append(part) log.debug(
setup.py: fix issue with False boolean options in bump_version command In the `setup.py release` custom command, when one doesn't pass the -s option (to GPG sign the git tag), the resulting command-line that is passed to the bumpversion script contains an invalid '--sign-tags False' argument. Boolean options with a False value should be omitted instead.
robotools_fontParts
train
py
1074bc6438ce97335c6b45120011c682100ef999
diff --git a/src/FlysystemStreamWrapper.php b/src/FlysystemStreamWrapper.php index <HASH>..<HASH> 100644 --- a/src/FlysystemStreamWrapper.php +++ b/src/FlysystemStreamWrapper.php @@ -384,7 +384,9 @@ class FlysystemStreamWrapper // as needed in that case. This will be a no-op for php 5. $this->stream_flush(); - fclose($this->handle); + if (is_resource($this->handle)) { + fclose($this->handle); + } } /** @@ -418,7 +420,9 @@ class FlysystemStreamWrapper $args = [$this->getTarget(), $this->handle]; $success = $this->invoke($this->getFilesystem(), 'putStream', $args, 'fflush'); - fseek($this->handle, $pos); + if (is_resource($this->handle)) { + fseek($this->handle, $pos); + } return $success; }
#8 Add resource check on stream_flush and stream_close
twistor_flysystem-stream-wrapper
train
php
4212198c0052d629659bcc24fa23a94914b95e2f
diff --git a/lib/onebox/engine/amazon_onebox.rb b/lib/onebox/engine/amazon_onebox.rb index <HASH>..<HASH> 100644 --- a/lib/onebox/engine/amazon_onebox.rb +++ b/lib/onebox/engine/amazon_onebox.rb @@ -10,13 +10,13 @@ module Onebox private - def extracted_data + def data { url: @url, - name: @body.css("html body h1").inner_text, - image: @body.css("html body #main-image").first["src"], - description: @body.css("html body #postBodyPS").inner_text, - price: @body.css("html body .priceLarge").inner_text + name: raw.css("html body h1").inner_text, + image: raw.css("html body #main-image").first["src"], + description: raw.css("html body #postBodyPS").inner_text, + price: raw.css("html body .priceLarge").inner_text } end end
refactor amazon onebox - data method #<I>
discourse_onebox
train
rb
5b1425234ebd79db8cf8df3c949b8d019e5c308e
diff --git a/src/filters/Select.js b/src/filters/Select.js index <HASH>..<HASH> 100644 --- a/src/filters/Select.js +++ b/src/filters/Select.js @@ -21,10 +21,21 @@ class SelectFilter extends Component { } componentDidUpdate(prevProps) { + function optionsEquals(options1, options2) { + const keys = Object.keys(options1); + for(let k in keys) { + if(options1[k] !== options2[k]) { + return false; + } + } + + return Object.keys(options1).length === Object.keys(options2).length + } + let needFilter = false; if (this.props.defaultValue !== prevProps.defaultValue) { needFilter = true; - } else if (this.props.options !== prevProps.options) { + } else if (!optionsEquals(this.props.options, prevProps.options)) { needFilter = true; } if (needFilter) {
Fix callback condition in Select filter The filter changed callback will be called less often, and in particular it will not be called when the options object has changed but has the same entries. This should fix issue #<I>
AllenFang_react-bootstrap-table
train
js
1c94ceec6032c4dd1219f7f9e00964f0f679fde1
diff --git a/lib/transport.js b/lib/transport.js index <HASH>..<HASH> 100644 --- a/lib/transport.js +++ b/lib/transport.js @@ -21,7 +21,11 @@ module.exports = Transport; */ function Transport (opts) { - this.options = opts; + this.path = opts.path; + this.host = opts.host; + this.port = opts.port; + this.secure = opts.secure; + this.query = opts.query; this.readyState = ''; this.writeBuffer = []; };
Expose transport options as properties.
socketio_engine.io-client
train
js
016436ae1882e2104fc085aa098b5925ef547305
diff --git a/src/ol/renderer/webgl/TileLayer.js b/src/ol/renderer/webgl/TileLayer.js index <HASH>..<HASH> 100644 --- a/src/ol/renderer/webgl/TileLayer.js +++ b/src/ol/renderer/webgl/TileLayer.js @@ -5,6 +5,7 @@ // FIXME animated shaders! check in redraw import LayerType from '../../LayerType.js'; +import ImageTile from '../../ImageTile.js'; import TileRange from '../../TileRange.js'; import TileState from '../../TileState.js'; import TileSource from '../../source/Tile.js'; @@ -286,6 +287,11 @@ class WebGLTileLayerRenderer extends WebGLLayerRenderer { const tilesToDraw = tilesToDrawByZ[zs[i]]; for (const tileKey in tilesToDraw) { tile = tilesToDraw[tileKey]; + + if (!(tile instanceof ImageTile)) { + continue; + } + tileExtent = tileGrid.getTileCoordExtent(tile.tileCoord, tmpExtent); u_tileOffset[0] = 2 * (tileExtent[2] - tileExtent[0]) / framebufferExtentDimension;
Check that tile is ImageTile before using it
openlayers_openlayers
train
js
89d0a889e51a65d8e04b0efa0f8a066e19cbd15f
diff --git a/ieml/calculation/thesaurus.py b/ieml/calculation/thesaurus.py index <HASH>..<HASH> 100644 --- a/ieml/calculation/thesaurus.py +++ b/ieml/calculation/thesaurus.py @@ -8,10 +8,22 @@ from ieml.script import CONTAINED_RELATION from bidict import bidict from models.relations import RelationsConnector, RelationsQueries from fractions import Fraction +from collections import namedtuple + + +ScoreNode = namedtuple('ScoreNode', ['script', 'score']) def rank_paradigms(paradigms_list, usl_list): + paradigms = {p:0 for p in paradigms_list} for usl in usl_list: term_list = [term for term in usl.tree_iter() if isinstance(term, Term)] for term in term_list: + # TODO : CHECK IF PARADIGM_LIST CONTAINS TERM OBJECT OR STRINGS + for paradigm in paradigms_list: + if set(term.script.singular_sequences) <= set(paradigm.script.singular_sequences): + paradigms[paradigm] += 1 + + # return sorted(list[paradigms], key= lambda e: paradigms[e]) + return sorted(paradigms, key= lambda e: paradigms[e])
Add a method to rank the most cited root paradigms for a given usl collection. Pair programming with Zack #Zack
IEMLdev_ieml
train
py
2260c41426f3946ae48ce733467e83153438c59b
diff --git a/lib/sbsm/session.rb b/lib/sbsm/session.rb index <HASH>..<HASH> 100644 --- a/lib/sbsm/session.rb +++ b/lib/sbsm/session.rb @@ -356,9 +356,19 @@ module SBSM end def user_input(*keys) if(keys.size == 1) - key = keys.first - key_sym = (key.is_a? Symbol) ? key : key.to_s.intern - @valid_input[key_sym] + index = nil + key = keys.first.to_s + if match = /([^\[]+)\[([^\]]+)\]/.match(key) + key = match[1] + index = match[2] + end + key_sym = key.to_sym + valid = @valid_input[key_sym] + if(index && valid.respond_to?(:[])) + valid[index] + else + valid + end else keys.inject({}) { |inj, key| inj.store(key, user_input(key))
allow access to hashed inputs through hash-syntax strings
zdavatz_sbsm
train
rb
9c9dc477e10cc55ba0b20e562f4666ad490f6b9c
diff --git a/lib/fakefs/file.rb b/lib/fakefs/file.rb index <HASH>..<HASH> 100644 --- a/lib/fakefs/file.rb +++ b/lib/fakefs/file.rb @@ -497,8 +497,8 @@ module FakeFS true end - def write(str) - val = super(str) + def write(*args) + val = super(*args) @file.mtime = Time.now val end
FakeFS::File: fix interface of #write It can take multiple arguments. This caused a warning at least since ruby <I>
fakefs_fakefs
train
rb
257fb37bdeba9b9741e1ca9968ba6338f369edde
diff --git a/tests/Jasny/Config/DynamoDBLoaderTest.php b/tests/Jasny/Config/DynamoDBLoaderTest.php index <HASH>..<HASH> 100644 --- a/tests/Jasny/Config/DynamoDBLoaderTest.php +++ b/tests/Jasny/Config/DynamoDBLoaderTest.php @@ -82,7 +82,9 @@ class DynamoDBLoaderTest extends \PHPUnit_Framework_TestCase if (!$wait) return; self::$dynamodb->waitUntil('TableExists', [ - 'TableName' => self::TABLE_NAME + 'TableName' => self::TABLE_NAME, + 'waiter.interval' => 1, + 'waiter.max_attempts' => 5 ]); } @@ -100,7 +102,9 @@ class DynamoDBLoaderTest extends \PHPUnit_Framework_TestCase if (!$wait) return; self::$dynamodb->waitUntil('TableNotExists', [ - 'TableName' => self::TABLE_NAME + 'TableName' => self::TABLE_NAME, + 'waiter.interval' => 1, + 'waiter.max_attempts' => 5 ]); }
Set the poll interval for wait in DynamoDBLoaderTest By default WaitOn for DynamoDB poll once every <I>s, causing the test to wait <I> seconds. This is non-sense because the table is created in <I>s by dynalite. Setting the poll interval to 1s significantly speeds up the DynamoDB test.
jasny_config
train
php
5ddcec5b2e523a967987d05dfd6bad684e7cb2f7
diff --git a/models/editor.js b/models/editor.js index <HASH>..<HASH> 100644 --- a/models/editor.js +++ b/models/editor.js @@ -29,15 +29,16 @@ module.exports = (bookshelf) => { idAttribute: 'id', initialize() { this.on('saving', (model) => { - if (model.hasChanged('password')) { - return bcrypt.genSaltAsync(10) - .then((salt) => - bcrypt.hashAsync(model.get('password'), salt) - ) - .then((hash) => { - model.set('password', hash); - }); + if (!model.hasChanged('password')) { + return null; } + return bcrypt.genSaltAsync(10) + .then((salt) => + bcrypt.hashAsync(model.get('password'), salt) + ) + .then((hash) => { + model.set('password', hash); + }); }); }, parse: util.snakeToCamel,
Ensure that password salting function always returns a value
bookbrainz_bookbrainz-data-js
train
js
e0262feea59faf737039682da9879a407066de15
diff --git a/generators/app/configs/package.json.js b/generators/app/configs/package.json.js index <HASH>..<HASH> 100644 --- a/generators/app/configs/package.json.js +++ b/generators/app/configs/package.json.js @@ -26,7 +26,7 @@ module.exports = function(generator) { [packager]: version }, 'scripts': { - test: 'npm run eslint && npm run mocha', + test: `${packager} run eslint && ${packager} run mocha`, eslint: `eslint ${lib}/. test/. --config .eslintrc.json`, start: `node ${lib}/`, mocha: 'mocha test/ --recursive --exit'
Use the selected packager to run commands (#<I>)
feathersjs_generator-feathers
train
js
6f583c91e4af302db6d8fe3188baf8d0f8bf0b69
diff --git a/commands/review/post/mode_parent.go b/commands/review/post/mode_parent.go index <HASH>..<HASH> 100644 --- a/commands/review/post/mode_parent.go +++ b/commands/review/post/mode_parent.go @@ -213,7 +213,7 @@ func merge(mergeTask, current, parent string) (act action.Action, err error) { } // Reset the branch to the original position. - if err := git.Reset("--hard", currentSHA); err != nil { + if err := git.Reset("--keep", currentSHA); err != nil { return errs.NewError(task, err) } return nil
review post: Use reset --keep instead of --hard Actually the right thing is to use --keep instead of --hard since we only need to reset the branch to the original position. We don't really care about the working directory state. Change-Id: <I>e3 Story-Id: salsaflow/salsaflow#<I>
salsaflow_salsaflow
train
go
700fbef42b0a269204bfbe03c9404c059ec95d98
diff --git a/docker/transport/unixconn.py b/docker/transport/unixconn.py index <HASH>..<HASH> 100644 --- a/docker/transport/unixconn.py +++ b/docker/transport/unixconn.py @@ -21,13 +21,12 @@ RecentlyUsedContainer = urllib3._collections.RecentlyUsedContainer class UnixHTTPResponse(httplib.HTTPResponse, object): def __init__(self, sock, *args, **kwargs): disable_buffering = kwargs.pop('disable_buffering', False) + if six.PY2: + # FIXME: We may need to disable buffering on Py3 as well, + # but there's no clear way to do it at the moment. See: + # https://github.com/docker/docker-py/issues/1799 + kwargs['buffering'] = not disable_buffering super(UnixHTTPResponse, self).__init__(sock, *args, **kwargs) - if disable_buffering is True: - # We must first create a new pointer then close the old one - # to avoid closing the underlying socket. - new_fp = sock.makefile('rb', 0) - self.fp.close() - self.fp = new_fp class UnixHTTPConnection(httplib.HTTPConnection, object):
Fix broken unbuffered streaming with Py3
docker_docker-py
train
py
1e6b6ba7de350d17e905a92495e97bc922ba7038
diff --git a/sphinx/conf.py b/sphinx/conf.py index <HASH>..<HASH> 100644 --- a/sphinx/conf.py +++ b/sphinx/conf.py @@ -48,9 +48,9 @@ copyright = u'2011, Florian Ludwig' # built documents. # # The short X.Y version. -version = '0.0.1' +version = '0.2.0' # The full version, including alpha/beta/rc tags. -release = '0.0.1' +release = '0.2.0' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages.
DOC dump version to <I>
FlorianLudwig_rueckenwind
train
py
dac378b63d910d87dbbc0191893eb24f59804a42
diff --git a/src/InputNumber.js b/src/InputNumber.js index <HASH>..<HASH> 100644 --- a/src/InputNumber.js +++ b/src/InputNumber.js @@ -216,7 +216,11 @@ const InputNumber = React.createClass({ }, render() { - const props = this.props; + const props = {...this.props}; + // Remove React warning. + // Warning: Input elements must be either controlled or uncontrolled (specify either the value prop, or the defaultValue prop, but not both). + delete props.defaultValue; + const prefixCls = props.prefixCls; const classes = classNames({ [prefixCls]: true,
fix: should work with React@<I>
react-component_input-number
train
js
8f7cf68682aa6691ee635eb140bab1615b3102cd
diff --git a/src/js/mep-player.js b/src/js/mep-player.js index <HASH>..<HASH> 100644 --- a/src/js/mep-player.js +++ b/src/js/mep-player.js @@ -695,12 +695,13 @@ setPlayerSize: function(width,height) { var t = this; - t.width = width; - t.height = height; + if (typeof width != 'undefined') + t.width = width; + + if (typeof height != 'undefined') + t.height = height; - // XXX: Dirty hack: - // If there is a % char in the supplied height value, set size to - // 100% of parent container. + // detect 100% mode if (t.height.toString().indexOf('%') > 0) { // do we have the native dimensions yet?
updated height/width to check for undfined.
mediaelement_mediaelement
train
js
f4c2d6dfa2e11f99742bf817dd87d68fc234374c
diff --git a/src/util/Util.js b/src/util/Util.js index <HASH>..<HASH> 100644 --- a/src/util/Util.js +++ b/src/util/Util.js @@ -302,11 +302,11 @@ class Util { .sort((a, b) => a.rawPosition - b.rawPosition || Long.fromString(a.id).sub(Long.fromString(b.id)).toNumber()); } - static setPosition(item, position, relative, sorted, route, handle, reason) { + static setPosition(item, position, relative, sorted, route, reason) { let updatedItems = sorted.array(); Util.moveElementInArray(updatedItems, item, position, relative); updatedItems = updatedItems.map((r, i) => ({ id: r.id, position: i })); - return route.patch({ data: updatedItems, reason }).then(handle || (x => x)); + return route.patch({ data: updatedItems, reason }); } }
fix a thing (#<I>)
discordjs_discord.js
train
js
9e1a59699d1e0b2423b4dae83784f08fa2a81a03
diff --git a/lib/active_interaction/pipeline.rb b/lib/active_interaction/pipeline.rb index <HASH>..<HASH> 100644 --- a/lib/active_interaction/pipeline.rb +++ b/lib/active_interaction/pipeline.rb @@ -34,9 +34,10 @@ module ActiveInteraction # result straight through, use `nil`. To pass the result as a value in a # hash, pass the key as a symbol. # - # @return [Array<Array(Proc, Base)>] + # @return [nil] def pipe(interaction, function = nil) @steps << [lambdafy(function), interaction] + nil end # Run all the interactions in the pipeline. If any interaction fails, stop
Return nil from pipe I don't want to leak all of the steps.
AaronLasseigne_active_interaction
train
rb
3c95282ec600e8a24dee2ca0f0cb2476c9e911ce
diff --git a/src/Http/Client/Response.php b/src/Http/Client/Response.php index <HASH>..<HASH> 100644 --- a/src/Http/Client/Response.php +++ b/src/Http/Client/Response.php @@ -13,7 +13,9 @@ */ namespace Cake\Http\Client; -use Cake\Http\Cookie\CookieCollection; +// This alias is necessary to avoid class name conflicts +// with the deprecated class in this namespace. +use Cake\Http\Cookie\CookieCollection as CookiesCollection; use Psr\Http\Message\ResponseInterface; use RuntimeException; use Zend\Diactoros\MessageTrait; @@ -453,7 +455,7 @@ class Response extends Message implements ResponseInterface if ($this->cookies) { return; } - $this->cookies = CookieCollection::createFromHeader($this->getHeader('Set-Cookie')); + $this->cookies = CookiesCollection::createFromHeader($this->getHeader('Set-Cookie')); } /**
Use an alias to avoid duplicate class name issues. The deprecated CookieCollection shares a name with this imported class so we need an alias.
cakephp_cakephp
train
php
072699e93bf50aae800854f2a613e627c28f0257
diff --git a/translator/prelude.go b/translator/prelude.go index <HASH>..<HASH> 100644 --- a/translator/prelude.go +++ b/translator/prelude.go @@ -211,6 +211,7 @@ var go$newType = function(size, kind, string, name, pkgPath, constructor) { typ.Ptr = go$newType(4, "Ptr", "*" + string, "", "", constructor); typ.Ptr.Struct = typ; typ.init = function(fields) { + typ.Ptr.init(typ); typ.Ptr.nil = new constructor(); var i; for (i = 0; i < fields.length; i++) { @@ -234,7 +235,6 @@ var go$newType = function(size, kind, string, name, pkgPath, constructor) { } rt.structType = new go$reflect.structType(rt, new (go$sliceType(go$reflect.structField))(reflectFields)); }; - typ.Ptr.init(typ); }; break;
fixed nil pointer error on field access of nil
gopherjs_gopherjs
train
go
68fd1a3b2310d7054cbd13432c6e1273e61c7d2b
diff --git a/activesupport/lib/active_support/core_ext/object/with_options.rb b/activesupport/lib/active_support/core_ext/object/with_options.rb index <HASH>..<HASH> 100644 --- a/activesupport/lib/active_support/core_ext/object/with_options.rb +++ b/activesupport/lib/active_support/core_ext/object/with_options.rb @@ -47,7 +47,21 @@ class Object # end # # <tt>with_options</tt> can also be nested since the call is forwarded to its receiver. - # Each nesting level will merge inherited defaults in addition to their own. + # + # NOTE: Each nesting level will merge inherited defaults in addition to their own. + # + # class Post < ActiveRecord::Base + # with_options if: :persisted?, length: { minimum: 50 } do + # validates :content, if: -> { content.present? } + # end + # end + # + # The code is equivalent to: + # + # validates :content, length: { minimum: 50 }, if: -> { content.present? } + # + # Hence the inherited default for `if` key is ignored. + # def with_options(options, &block) option_merger = ActiveSupport::OptionMerger.new(self, options) block.arity.zero? ? option_merger.instance_eval(&block) : block.call(option_merger)
[ci skip] Add Doc of with_options for the case when inherited default options and original options have same keys
rails_rails
train
rb
8063a9dec07329804f3e1770aa31984bc38a694d
diff --git a/subprojects/groovy-json/src/main/java/groovy/json/internal/JsonFastParser.java b/subprojects/groovy-json/src/main/java/groovy/json/internal/JsonFastParser.java index <HASH>..<HASH> 100644 --- a/subprojects/groovy-json/src/main/java/groovy/json/internal/JsonFastParser.java +++ b/subprojects/groovy-json/src/main/java/groovy/json/internal/JsonFastParser.java @@ -161,6 +161,7 @@ public class JsonFastParser extends JsonParserCharArray { int index = __index; char currentChar; boolean doubleFloat = false; + boolean foundDot = false; if (minus && index + 1 < array.length) { index++; @@ -174,6 +175,12 @@ public class JsonFastParser extends JsonParserCharArray { break; } else if (isDelimiter(currentChar)) { break; + } else if (currentChar == '.') { + if (foundDot) { + complain("unexpected character " + currentChar); + } + foundDot = true; + doubleFloat = true; } else if (isDecimalChar(currentChar)) { doubleFloat = true; }
GROOVY-<I>: Ensure multiple decimal points caught when numbers lazily evaluated in the JsonFastParser.
apache_groovy
train
java
67b45df04ddc903ddbeb71e7b1fc0938a7a6bb65
diff --git a/app/helpers/rails_admin/main_helper.rb b/app/helpers/rails_admin/main_helper.rb index <HASH>..<HASH> 100644 --- a/app/helpers/rails_admin/main_helper.rb +++ b/app/helpers/rails_admin/main_helper.rb @@ -71,7 +71,7 @@ module RailsAdmin max_sets = sets.size-2 total = current_set.between?(1, max_sets) ? 704 : total column_offset = total-sets[current_set][:size] - per_property = column_offset/properties.size + per_property = properties.size != 0 ? column_offset / properties.size : 0 offset = column_offset - per_property * properties.size properties.each do |property|
If there are no properties, don't crash, just set the per_property to 0, seems safe enough.
sferik_rails_admin
train
rb
44966070960d168062d537c8ce88c1fd5f0a0c40
diff --git a/tests/functional/test_local.py b/tests/functional/test_local.py index <HASH>..<HASH> 100644 --- a/tests/functional/test_local.py +++ b/tests/functional/test_local.py @@ -5,7 +5,6 @@ from threading import Thread from threading import Event import json import subprocess -import select from contextlib import contextmanager import pytest @@ -182,14 +181,6 @@ def test_can_import_env_vars(unused_tcp_port): def _wait_for_server_ready(process): - result = select.select([process.stderr], [], [], 10)[0] - if not result: - raise AssertionError("Local server was unable to start up " - "(did not send READY message).") - status = process.stderr.read(5) - if status != b'READY': - raise AssertionError("Local server did not sent expect READ message, " - "instead sent: %s" % status) if process.poll() is not None: raise AssertionError( 'Local server immediately exited with rc: %s' % process.poll()
Remove select() in local test You can't select() on a file desriptor in windows, it has to be a socket. Given we're already retrying connection errors, we don't actually need this. It originally was used to speed up tests.
aws_chalice
train
py
ff01391cf00f68f3d1c5a87486a370be0f2b5876
diff --git a/service/elastigroup/providers/aws/aws.go b/service/elastigroup/providers/aws/aws.go index <HASH>..<HASH> 100644 --- a/service/elastigroup/providers/aws/aws.go +++ b/service/elastigroup/providers/aws/aws.go @@ -510,6 +510,7 @@ type BlockDeviceMapping struct { type EBS struct { DeleteOnTermination *bool `json:"deleteOnTermination,omitempty"` Encrypted *bool `json:"encrypted,omitempty"` + KmsKeyId *string `json:"kmsKeyId,omitempty"` SnapshotID *string `json:"snapshotId,omitempty"` VolumeType *string `json:"volumeType,omitempty"` VolumeSize *int `json:"volumeSize,omitempty"` @@ -2597,6 +2598,13 @@ func (o *EBS) SetEncrypted(v *bool) *EBS { return o } +func (o *EBS) SetKmsKeyId(v *string) *EBS { + if o.KmsKeyId = v; o.KmsKeyId == nil { + o.nullFields = append(o.nullFields, "KmsKeyId") + } + return o +} + func (o *EBS) SetSnapshotId(v *string) *EBS { if o.SnapshotID = v; o.SnapshotID == nil { o.nullFields = append(o.nullFields, "SnapshotID")
[src] Added support for kms_key_id as part of the EBS
spotinst_spotinst-sdk-go
train
go
2972a1478252d8d660b8294639771b0dbdf1cb44
diff --git a/lib/generators/templates/blast.rb b/lib/generators/templates/blast.rb index <HASH>..<HASH> 100644 --- a/lib/generators/templates/blast.rb +++ b/lib/generators/templates/blast.rb @@ -295,7 +295,13 @@ module Quorum logger("NCBI Blast", @cmd) - @cmd.each { |c| system(c) } + # Execute each system command in a Thread. + threads = [] + @cmd.each do |c| + threads << Thread.new { system(c) } + end + # Wait for every Thread to finish working. + threads.each { |t| t.join } parse_and_save_results end diff --git a/spec/dummy/quorum/lib/tools/blast.rb b/spec/dummy/quorum/lib/tools/blast.rb index <HASH>..<HASH> 100644 --- a/spec/dummy/quorum/lib/tools/blast.rb +++ b/spec/dummy/quorum/lib/tools/blast.rb @@ -295,7 +295,13 @@ module Quorum logger("NCBI Blast", @cmd) - @cmd.each { |c| system(c) } + # Execute each system command in a Thread. + threads = [] + @cmd.each do |c| + threads << Thread.new { system(c) } + end + # Wait for every Thread to finish working. + threads.each { |t| t.join } parse_and_save_results end
Execute each Blast system command in a Thread.
ncgr_quorum
train
rb,rb
c3353ad39e1e122db2ca9ef9d45714f34ef21b85
diff --git a/system/BaseModel.php b/system/BaseModel.php index <HASH>..<HASH> 100644 --- a/system/BaseModel.php +++ b/system/BaseModel.php @@ -290,12 +290,9 @@ abstract class BaseModel /** * BaseModel constructor. * - * @param object|null $db DB Connection * @param ValidationInterface|null $validation Validation - * - * @phpstan-ignore-next-line */ - public function __construct(object &$db = null, ValidationInterface $validation = null) + public function __construct(ValidationInterface $validation = null) { $this->tempReturnType = $this->returnType; $this->tempUseSoftDeletes = $this->useSoftDeletes; diff --git a/system/Model.php b/system/Model.php index <HASH>..<HASH> 100644 --- a/system/Model.php +++ b/system/Model.php @@ -90,9 +90,16 @@ class Model extends BaseModel */ public function __construct(ConnectionInterface &$db = null, ValidationInterface $validation = null) { - parent::__construct($db, $validation); + parent::__construct($validation); - $this->db = $db ?? Database::connect($this->DBGroup); + if (is_null($db)) + { + $this->db = Database::connect($this->DBGroup); + } + else + { + $this->db = &$db; + } } //--------------------------------------------------------------------
BaseModel/Model - Reworked Constructor to properly use reference
codeigniter4_CodeIgniter4
train
php,php
a069b0c4525aacd2a021af6fb8e60dbf5c639a6f
diff --git a/src/Select.js b/src/Select.js index <HASH>..<HASH> 100644 --- a/src/Select.js +++ b/src/Select.js @@ -714,7 +714,7 @@ const Select = React.createClass({ onRemove={this.removeValue} value={value} > - {renderLabel(value, 1)} + {renderLabel(value, i)} <span className="Select-aria-only">&nbsp;</span> </ValueComponent> ); @@ -729,7 +729,7 @@ const Select = React.createClass({ onClick={onClick} value={valueArray[0]} > - {renderLabel(valueArray[0], 1)} + {renderLabel(valueArray[0], i)} </ValueComponent> ); } @@ -904,7 +904,7 @@ const Select = React.createClass({ isSelected={isSelected} ref={optionRef} > - {renderLabel(option, 1)} + {renderLabel(option, i)} </Option> ); });
Fix typo, change "1" -> "i"
HubSpot_react-select-plus
train
js
f50f3e62e6416f489c63a779ffaed478c6583220
diff --git a/cmd/peco/peco.go b/cmd/peco/peco.go index <HASH>..<HASH> 100644 --- a/cmd/peco/peco.go +++ b/cmd/peco/peco.go @@ -1,5 +1,3 @@ -// +build build - package main import ( @@ -13,12 +11,7 @@ import ( "github.com/nsf/termbox-go" ) -// This value is to be initialized by an external tool at link time -// via -// -// go build -ldflags "-X main.version vX.Y.Z" ... -// -var version string +var version = "v0.1.1" func showHelp() { const v = `
Temporarily do away with hardcoding. See thigs thread: <URL>
peco_peco
train
go
e0db79af617252d188cd07441d8cbb9c199617bd
diff --git a/test/Tests/RemoteObjectTest.php b/test/Tests/RemoteObjectTest.php index <HASH>..<HASH> 100644 --- a/test/Tests/RemoteObjectTest.php +++ b/test/Tests/RemoteObjectTest.php @@ -221,7 +221,7 @@ class RemoteObjectTest extends \HPCloud\Tests\TestCase { // Change content and retest. $obj->setContent('foo'); - $this->assertTrue(obj->isDirty()); + $this->assertTrue($obj->isDirty()); } /**
Fixed minor typo that I accidentally commit last time.
hpcloud_HPCloud-PHP
train
php
a7866882fb81f890ca5c24d592ac7a8a7a2c3a62
diff --git a/app/models/organization.rb b/app/models/organization.rb index <HASH>..<HASH> 100644 --- a/app/models/organization.rb +++ b/app/models/organization.rb @@ -86,7 +86,7 @@ class Organization < ActiveRecord::Base org_verbs = { :update => N_("Manage Organization and Environments"), - + :read => N_("Access Organization"), :read_systems => N_("Access Systems"), :create_systems =>N_("Register Systems"), :update_systems => N_("Manage Systems"), @@ -94,8 +94,7 @@ class Organization < ActiveRecord::Base } org_verbs.merge!({ :create => N_("Create Organization"), - :read => N_("Access Organization"), - :delete => N_("Delete Organization"), + :delete => N_("Delete Organization") }) if global org_verbs.with_indifferent_access
added read in the non global list for orgs
Katello_katello
train
rb
040ca25e4fcd94385137b4b1716a0eb1c767eb47
diff --git a/src/main/java/com/hp/autonomy/hod/client/api/textindex/query/parametric/FieldValues.java b/src/main/java/com/hp/autonomy/hod/client/api/textindex/query/parametric/FieldValues.java index <HASH>..<HASH> 100644 --- a/src/main/java/com/hp/autonomy/hod/client/api/textindex/query/parametric/FieldValues.java +++ b/src/main/java/com/hp/autonomy/hod/client/api/textindex/query/parametric/FieldValues.java @@ -9,7 +9,7 @@ import lombok.Singular; import java.util.List; -@Builder +@Builder(toBuilder = true) @JsonDeserialize(builder = FieldValues.FieldValuesBuilder.class) @Data public class FieldValues { @@ -25,7 +25,7 @@ public class FieldValues { private Integer totalValues; } - @Builder + @Builder(toBuilder = true) @JsonDeserialize(builder = ValueAndCount.ValueAndCountBuilder.class) @Data public static class ValueAndCount {
Sever-side meta-filter (FIND-<I>) Add toBuilder to FieldValues so we can easily manipulate parametric response to ape ValueRestriction behaviour [rev. matthew.gordon]
microfocus-idol_java-hod-client
train
java
833a099daaa0f2c9325dea524e830a7368398e68
diff --git a/FlowCal/mef.py b/FlowCal/mef.py index <HASH>..<HASH> 100644 --- a/FlowCal/mef.py +++ b/FlowCal/mef.py @@ -24,7 +24,7 @@ import FlowCal.plot import FlowCal.transform import FlowCal.stats -standard_curve_colors = ['tab:blue', 'tab:green', 'tab:orange'] +standard_curve_colors = ['tab:blue', 'tab:green', 'tab:red'] def clustering_gmm(data, n_clusters,
Changed standard curve color back to red.
taborlab_FlowCal
train
py
1b2a7549df0441550f8b5e02c6bd507863dac15c
diff --git a/classes/Living.js b/classes/Living.js index <HASH>..<HASH> 100644 --- a/classes/Living.js +++ b/classes/Living.js @@ -176,7 +176,7 @@ Living = new Class({ * next command in the action queue will be called. */ startHeart: function() { - this.heartTimer = (function(){ this.beatHeart(); }).periodical(1000, this); + this.heartTimer = this.beatHeart.periodical(1000, this); }, /** @@ -193,12 +193,13 @@ Living = new Class({ }, /** - * The heart should be stopped when the player's hit points are below 0. - * This will cause the player to become dead. + * Stops the character from acting. Should happen upon death, but + * heartbeat should NOT be confused with a physical, game-mechanic + * heartbeat. */ stopHeart: function() { + clearTimeout(this.heartTimer); this.heartTimer = null; - this.fireEvent('death'); }, /**
Fixed the heartbeat's timer clearance, iterated that heartbeat has nothing to do with the player's vital status.
Yuffster_discord-engine
train
js
4481af61052d042473a78c63f32905bb3f50646d
diff --git a/tests/estestcase.py b/tests/estestcase.py index <HASH>..<HASH> 100644 --- a/tests/estestcase.py +++ b/tests/estestcase.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import absolute_import import os +import logging """ Unit tests for pyes. These require an es server with thrift plugin running on the default port (localhost:9500). @@ -16,7 +17,7 @@ def get_conn(*args, **kwargs): class ESTestCase(unittest.TestCase): def setUp(self): - self.conn = get_conn(timeout=300.0)#incremented timeout for debugging + self.conn = get_conn(timeout=300.0,log_curl=True)#incremented timeout for debugging self.index_name = "test-index" self.document_type = "test-type" self.conn.delete_index_if_exists(self.index_name) @@ -133,7 +134,7 @@ def setUp(): 'store': 'yes', 'type': u'string'}} - conn = get_conn() + conn = get_conn(log_curl=True) conn.delete_index_if_exists("test-pindex") conn.create_index("test-pindex") conn.put_mapping("test-type", {'properties': mapping}, ["test-pindex"])
Adding curl logging to the test connection. Note: output is suppressed by nose framework unless there is an error
aparo_pyes
train
py
ae97c58c9c6bec64dce390d3c798580cbc722810
diff --git a/tasks/zip.js b/tasks/zip.js index <HASH>..<HASH> 100644 --- a/tasks/zip.js +++ b/tasks/zip.js @@ -45,11 +45,12 @@ module.exports = function(grunt) { // If there is no router if (!router) { // Grab the cwd and return the relative path as our router - var cwd = data.cwd || process.cwd(); + var cwd = data.cwd || process.cwd(), + separator = new RegExp(path.sep.replace('\\', '\\\\'), 'g'); router = function routerFn (filepath) { // Join path via / // DEV: Files zipped on Windows need to use / to have the same layout on Linux - return path.relative(cwd, filepath).split(path.sep).join('/'); + return path.relative(cwd, filepath).replace(separator, '/'); }; } else if (data.cwd) { // Otherwise, if a `cwd` was specified, throw a fit and leave
Moved to RegExp.replace over split
twolfson_grunt-zip
train
js
67172e744681a6c8d8cf07b7b99fac3c2651a912
diff --git a/lib/Orkestra/Transactor/Entity/AbstractAccount.php b/lib/Orkestra/Transactor/Entity/AbstractAccount.php index <HASH>..<HASH> 100644 --- a/lib/Orkestra/Transactor/Entity/AbstractAccount.php +++ b/lib/Orkestra/Transactor/Entity/AbstractAccount.php @@ -161,7 +161,7 @@ abstract class AbstractAccount extends AbstractEntity */ public function __toString() { - return (string) $this->alias; + return (string) ($this->alias ?: sprintf('%s ending with %s', $this->getType(), $this->lastFour)); } /**
Updated toString for AbstractAccount
orkestra_orkestra-transactor
train
php
0e84fa178201ec076a91710e3c2e82d50ee80615
diff --git a/lib/expeditor/command.rb b/lib/expeditor/command.rb index <HASH>..<HASH> 100644 --- a/lib/expeditor/command.rb +++ b/lib/expeditor/command.rb @@ -87,10 +87,9 @@ module Expeditor end # `chain` returns new command that has self as dependencies - def chain(&block) - Command.new(dependencies: [self]) do |v| - block.call(v) - end + def chain(opts = {}, &block) + opts[:dependencies] = [self] + Command.new(opts, &block) end def self.const(value) diff --git a/spec/expeditor/command_spec.rb b/spec/expeditor/command_spec.rb index <HASH>..<HASH> 100644 --- a/spec/expeditor/command_spec.rb +++ b/spec/expeditor/command_spec.rb @@ -498,6 +498,17 @@ describe Expeditor::Command do expect(command_double.get).to eq(84) end end + + context 'with options' do + it 'should recognize options' do + command = simple_command(42) + command_sleep = command.chain(timeout: 0.01) do |n| + sleep 0.1 + n * 2 + end.start + expect { command_sleep.get }.to raise_error(Expeditor::TimeoutError) + end + end end describe '.const' do
Make it possible to use options in Command#chain
cookpad_expeditor
train
rb,rb
dda887248a98f6b0bc56b93265810f89e3390f4b
diff --git a/angr/storage/memory_mixins/paged_memory/paged_memory_mixin.py b/angr/storage/memory_mixins/paged_memory/paged_memory_mixin.py index <HASH>..<HASH> 100644 --- a/angr/storage/memory_mixins/paged_memory/paged_memory_mixin.py +++ b/angr/storage/memory_mixins/paged_memory/paged_memory_mixin.py @@ -528,10 +528,10 @@ class PagedMemoryMixin(MemoryMixin): flushed = [] # cycle over all the keys ( the page number ) - for pageno, _ in self._pages.items(): + for pageno, page in self._pages.items(): if pageno in white_list_page_number: #l.warning("Page " + str(pageno) + " not flushed!") - new_page_dict[pageno] = self._pages[pageno] + new_page_dict[pageno] = page else: #l.warning("Page " + str(pageno) + " flushed!") flushed.append((pageno, self.page_size)) @@ -541,8 +541,6 @@ class PagedMemoryMixin(MemoryMixin): # self.state.unicorn.uncache_region(addr, length) self._pages = new_page_dict - self._initialized = set() - return flushed class ListPagesMixin(PagedMemoryMixin):
removed unused attributes and cleaned loop over self._pages
angr_angr
train
py
99cdd973c79476f5944795aa14bf93403bec1876
diff --git a/containers/pax-exam-container-karaf/src/main/java/org/ops4j/pax/exam/karaf/container/internal/KarafTestContainer.java b/containers/pax-exam-container-karaf/src/main/java/org/ops4j/pax/exam/karaf/container/internal/KarafTestContainer.java index <HASH>..<HASH> 100644 --- a/containers/pax-exam-container-karaf/src/main/java/org/ops4j/pax/exam/karaf/container/internal/KarafTestContainer.java +++ b/containers/pax-exam-container-karaf/src/main/java/org/ops4j/pax/exam/karaf/container/internal/KarafTestContainer.java @@ -474,8 +474,10 @@ public class KarafTestContainer implements TestContainer { // do the same for lib/boot File[] bootJars = new File(karafHome + "/lib/boot") .listFiles((FileFilter) new WildcardFileFilter("*.jar")); - for (File jar : bootJars) { - cp.add(jar.toString()); + if (bootJars != null) { + for (File jar : bootJars) { + cp.add(jar.toString()); + } } // do the same for lib/ext File[] extJars = new File(karafHome + "/lib/ext")
[PAXEXAM-<I>] Support Karaf libraries in the lib/boot folder
ops4j_org.ops4j.pax.exam2
train
java
2eb8301f8eda448a871b52d2c6e1033c79638aac
diff --git a/salt/fileclient.py b/salt/fileclient.py index <HASH>..<HASH> 100644 --- a/salt/fileclient.py +++ b/salt/fileclient.py @@ -223,7 +223,9 @@ class Client(object): if fn_.strip() and fn_.startswith(path): if salt.utils.check_include_exclude( fn_, include_pat, exclude_pat): - ret.append(self.cache_file('salt://' + fn_, saltenv)) + fn_ = self.cache_file('salt://' + fn_, saltenv) + if fn_: + ret.append(fn_) if include_empty: # Break up the path into a list containing the bottom-level
Bugfix: crash on highstate population when empty path is passed
saltstack_salt
train
py
7b8e967aa0e214acc1d2f507c250e588491d2963
diff --git a/VM-Core/src/main/java/com/validation/manager/core/server/core/Versionable.java b/VM-Core/src/main/java/com/validation/manager/core/server/core/Versionable.java index <HASH>..<HASH> 100644 --- a/VM-Core/src/main/java/com/validation/manager/core/server/core/Versionable.java +++ b/VM-Core/src/main/java/com/validation/manager/core/server/core/Versionable.java @@ -1,11 +1,9 @@ package com.validation.manager.core.server.core; -import com.validation.manager.core.AuditedEntityListener; import com.validation.manager.core.VMAuditedObject; import java.io.Serializable; import javax.persistence.Basic; import javax.persistence.Column; -import javax.persistence.EntityListeners; import javax.persistence.MappedSuperclass; import javax.validation.constraints.Min; import javax.validation.constraints.NotNull; @@ -15,7 +13,6 @@ import javax.validation.constraints.NotNull; * @author Javier A. Ortiz Bultron <javier.ortiz.78@gmail.com> */ @MappedSuperclass -@EntityListeners(AuditedEntityListener.class) public class Versionable extends VMAuditedObject implements Serializable, Comparable<Versionable> {
Remove the audit entity listener. Candidate to remove as dead code.
javydreamercsw_validation-manager
train
java
9f0461245972f15138bbe074fa836a8eb6662f37
diff --git a/ryu/app/wsgi.py b/ryu/app/wsgi.py index <HASH>..<HASH> 100644 --- a/ryu/app/wsgi.py +++ b/ryu/app/wsgi.py @@ -225,23 +225,15 @@ class WSGIApplication(object): self.registory = {} self._wsmanager = WebSocketManager() super(WSGIApplication, self).__init__() - # XXX: Switch how to call the API of Routes for every version - match_argspec = inspect.getargspec(self.mapper.match) - if 'environ' in match_argspec.args: - # New API - self._match = self._match_with_environ - else: - # Old API - self._match = self._match_with_path_info - - def _match_with_environ(self, req): - match = self.mapper.match(environ=req.environ) - return match - - def _match_with_path_info(self, req): - self.mapper.environ = req.environ - match = self.mapper.match(req.path_info) - return match + + def _match(self, req): + # Note: Invoke the new API, first. If the arguments unmatched, + # invoke the old API. + try: + return self.mapper.match(environ=req.environ) + except TypeError: + self.mapper.environ = req.environ + return self.mapper.match(req.path_info) @wsgify_hack def __call__(self, req, start_response):
wsgi: Avoid using inspect.getargspec Officially, "inspect.getargspec" is obsoleted in Python <I>, this patch fixes to avoid using this function.
osrg_ryu
train
py
29ed0313214fcd0ce842194ef7195b899f501534
diff --git a/views/js/controller/runtime/testRunner.js b/views/js/controller/runtime/testRunner.js index <HASH>..<HASH> 100644 --- a/views/js/controller/runtime/testRunner.js +++ b/views/js/controller/runtime/testRunner.js @@ -391,7 +391,13 @@ define(['jquery', 'lodash', 'spin', 'serviceApi/ServiceApi', 'serviceApi/UserInf return { start : function(assessmentTestContext){ - + + $(document).ajaxError(function(event, jqxhr) { + if (jqxhr.status == 403) { + iframeNotifier.parent('serviceforbidden'); + } + }); + window.onServiceApiReady = function onServiceApiReady(serviceApi) { TestRunner.serviceApi = serviceApi;
fixing silent fail at delivery time on expired session.
oat-sa_extension-tao-testqti
train
js
06227620c527133ec93ee033255fd5c69c46d55b
diff --git a/bloop/stream/buffer.py b/bloop/stream/buffer.py index <HASH>..<HASH> 100644 --- a/bloop/stream/buffer.py +++ b/bloop/stream/buffer.py @@ -1,10 +1,4 @@ import heapq -import random - - -def jitter(): - """Used to advance a monotonic clock by a small amount""" - return random.randint(1, 5) def heap_item(clock, record, shard): @@ -107,6 +101,6 @@ class RecordBuffer: # Try to prevent collisions from someone accessing the underlying int. # This offset ensures _RecordBuffer__monotonic_integer will never have # the same value as any call to clock(). - value = self.__monotonic_integer + jitter() - self.__monotonic_integer = value + jitter() + value = self.__monotonic_integer + 1 + self.__monotonic_integer += 2 return value
Remove random jitter from stream.RecordBuffer.clock
numberoverzero_bloop
train
py
8ad6bc885c579c11e98ea3a4fe0f156b7dc9ffea
diff --git a/tests/test_location_by_point_query_url.py b/tests/test_location_by_point_query_url.py index <HASH>..<HASH> 100644 --- a/tests/test_location_by_point_query_url.py +++ b/tests/test_location_by_point_query_url.py @@ -79,18 +79,3 @@ def test_location_by_point_url_http_protocol(data, expected): def test_location_by_point_url_https_protocol(data, expected): loc_by_point = LocationByPoint(data, https_protocol) assert loc_by_point.build_url() == expected - - -@parametrize('data,expected', [ - (DATA[0], EXPECTED[0]), - (DATA[1], EXPECTED[1]), - (DATA[2], EXPECTED[2]), - (DATA[3], EXPECTED[3]), - (DATA[4], EXPECTED[4]), - (DATA[5], EXPECTED[5]), - (DATA[6], EXPECTED[6]) -]) -def test_location_by_point_url_get_data(data, expected): - loc_by_point = LocationByPoint(data) - loc_by_point.get_data() - assert loc_by_point.status_code == 200
Divided data in between http and https protocol
bharadwajyarlagadda_bingmaps
train
py
d17c9e8b0a040be0c6fc957186bb22c3ee0166be
diff --git a/salt/utils/ssdp.py b/salt/utils/ssdp.py index <HASH>..<HASH> 100644 --- a/salt/utils/ssdp.py +++ b/salt/utils/ssdp.py @@ -380,12 +380,12 @@ class SSDPDiscoveryClient(SSDPBase): :return: ''' - self.log.info("Looking for a server discovery") response = {} - try: - self._query() - self._collect_masters_map(response) - except socket.timeout: + masters = {} + self.log.info("Looking for a server discovery") + self._query() + self._collect_masters_map(response) + if not response: msg = 'No master has been discovered.' self.log.info(msg) masters = {}
Bugfix for refactoring: the exception was never raised anyway
saltstack_salt
train
py
9bd1c9e7ca12d047a376491afad09d1e72ed3728
diff --git a/helper/resource/testing.go b/helper/resource/testing.go index <HASH>..<HASH> 100644 --- a/helper/resource/testing.go +++ b/helper/resource/testing.go @@ -82,10 +82,25 @@ type TestCase struct { // tests will only need one step. type TestStep struct { // PreConfig is called before the Config is applied to perform any per-step - // setup that needs to happen + // setup that needs to happen. This is called regardless of "test mode" + // below. PreConfig func() - // Config a string of the configuration to give to Terraform. + //--------------------------------------------------------------- + // Test modes. One of the following groups of settings must be + // set to determine what the test step will do. Ideally we would've + // used Go interfaces here but there are now hundreds of tests we don't + // want to re-type so instead we just determine which step logic + // to run based on what settings below are set. + //--------------------------------------------------------------- + + //--------------------------------------------------------------- + // Plan, Apply testing + //--------------------------------------------------------------- + + // Config a string of the configuration to give to Terraform. If this + // is set, then the TestCase will execute this step with the same logic + // as a `terraform apply`. Config string // Check is called after the Config is applied. Use this step to
helper/resource: reshuffling to prepare for importstate testing
hashicorp_terraform
train
go
c8524bee162dafec133caabaffef563b5430ac3a
diff --git a/src/maplace.js b/src/maplace.js index <HASH>..<HASH> 100644 --- a/src/maplace.js +++ b/src/maplace.js @@ -726,8 +726,9 @@ if (this.o.draggable) { google.maps.event.addListener(this.directionsDisplay, 'directions_changed', function() { + var result = self.directionsDisplay.getDirections(); distance = self.compute_distance(self.directionsDisplay.directions); - self.o.afterRoute.call(self, distance); + self.o.afterRoute.call(self, distance, result.status, result); }); }
[fix] afterRoute not passing status or location with draggable #<I> #<I>
danielemoraschi_maplace.js
train
js
731c45e4f904ac955663d8a152d804adc8f3f02a
diff --git a/protobuf3/message.py b/protobuf3/message.py index <HASH>..<HASH> 100644 --- a/protobuf3/message.py +++ b/protobuf3/message.py @@ -101,6 +101,8 @@ class Message(object): return self.__wire_message.get(field_number, []) def _set_wire_values(self, field_number, field_type, field_value, index=None, insert=False, append=False): + if field_number not in self.__wire_message: + self.__wire_message[field_number] = [] if append: self.__wire_message[field_number].append(WireField(type=field_type, value=field_value)) elif insert:
Fixed KeyError in append method
Pr0Ger_protobuf3
train
py
fed595673f2a8b8562caf1b06e5fbf8c26851576
diff --git a/src/routes.php b/src/routes.php index <HASH>..<HASH> 100644 --- a/src/routes.php +++ b/src/routes.php @@ -55,7 +55,7 @@ Route::group(['prefix' => Config::get('bauhaus::admin.uri')], function () { Route::get('model/{model}/export/{type}', [ 'as' => 'admin.model.export', 'uses' => 'KraftHaus\Bauhaus\ModelController@export' - ]); + ])->where('type', 'json|xml|csv|xls'); // extra route includes require_once __DIR__ . '/routes/modals.php';
#<I> export route constraints added
krafthaus_bauhaus
train
php
0a8347e9dda20f9744cae47b36414ec4d074d6a2
diff --git a/src/Cartalyst/Sentry/Hashing/NativeHasher.php b/src/Cartalyst/Sentry/Hashing/NativeHasher.php index <HASH>..<HASH> 100644 --- a/src/Cartalyst/Sentry/Hashing/NativeHasher.php +++ b/src/Cartalyst/Sentry/Hashing/NativeHasher.php @@ -31,6 +31,11 @@ class NativeHasher implements HasherInterface { // Usually caused by an old PHP environment, see // https://github.com/cartalyst/sentry/issues/98#issuecomment-12974603 // and https://github.com/ircmaxell/password_compat/issues/10 + if (! function_exists('password_hash')) + { + throw new \RuntimeException('The function password_hash() does not exist, your PHP environment is probably incompatible. Try running [vendor/ircmaxell/password-compat/version-test.php] to check compatibility or use an alternative hashing strategy.'); + } + if (($hash = password_hash($string, PASSWORD_DEFAULT)) === false) { throw new \RuntimeException('Error generating hash from string, your PHP environment is probably incompatible. Try running [vendor/ircmaxell/password-compat/version-test.php] to check compatibility or use an alternative hashing strategy.');
Check if password_hash() actually exists (>PHP<I>) and throw a descriptive RuntimeException if it doesn't.
cartalyst_sentry
train
php
5e1f08a51e12d2ca955a158f1bad6bfe8a8576c3
diff --git a/config/tinker.php b/config/tinker.php index <HASH>..<HASH> 100644 --- a/config/tinker.php +++ b/config/tinker.php @@ -4,6 +4,19 @@ return [ /* |-------------------------------------------------------------------------- + | Custom commands + |-------------------------------------------------------------------------- + | + | Sometimes, you might want to make certain console commands available in + | Tinker. This option allows you to do just that. Simply provide a list + | of commands that you want to expose in Tinker. + | + */ + + 'commands' => [], + + /* + |-------------------------------------------------------------------------- | Alias Blacklist |-------------------------------------------------------------------------- | diff --git a/src/Console/TinkerCommand.php b/src/Console/TinkerCommand.php index <HASH>..<HASH> 100644 --- a/src/Console/TinkerCommand.php +++ b/src/Console/TinkerCommand.php @@ -80,6 +80,10 @@ class TinkerCommand extends Command } } + foreach (config('tinker.commands', []) as $command) { + $commands[] = $this->getApplication()->resolve($command); + } + return $commands; }
allow to expose console command in tinker
laravel_tinker
train
php,php
76b2ce8604618262d14e42257eee0a66d66bac75
diff --git a/builder/vmware/common/driver.go b/builder/vmware/common/driver.go index <HASH>..<HASH> 100644 --- a/builder/vmware/common/driver.go +++ b/builder/vmware/common/driver.go @@ -106,6 +106,9 @@ func NewDriver(dconfig *DriverConfig, config *SSHConfig) (Driver, error) { errs := "" for _, driver := range drivers { err := driver.Verify() + log.Printf("Testing vmware driver %T. Success: %t", + driver, err == nil) + if err == nil { return driver, nil }
log which vmware driver we decide on
hashicorp_packer
train
go
a97c6df7180f7bd58a5fe5415023ed396a1e7d58
diff --git a/__init__.py b/__init__.py index <HASH>..<HASH> 100644 --- a/__init__.py +++ b/__init__.py @@ -22,5 +22,5 @@ __revision__ = "$Id$" # #--start constants-- -__version__ = "2.6b3" +__version__ = "2.6rc1" #--end constants--
Bumping to <I>rc1
pypa_setuptools
train
py
26a15465f5487a2883bbaf767317284976c9ba47
diff --git a/src/main/java/io/github/bonigarcia/wdm/WebDriverManager.java b/src/main/java/io/github/bonigarcia/wdm/WebDriverManager.java index <HASH>..<HASH> 100644 --- a/src/main/java/io/github/bonigarcia/wdm/WebDriverManager.java +++ b/src/main/java/io/github/bonigarcia/wdm/WebDriverManager.java @@ -1146,15 +1146,11 @@ public abstract class WebDriverManager { String browserVersionOutput = getBrowserVersionInWindows( programFilesEnv, winBrowserName, browserBinaryPath); if (isNullOrEmpty(browserVersionOutput)) { - String otherProgramFilesEnv = getOtherProgramFilesEnv(); browserVersionOutput = getBrowserVersionInWindows( - otherProgramFilesEnv, winBrowserName, + getOtherProgramFilesEnv(), winBrowserName, browserBinaryPath); - if (!isNullOrEmpty(browserVersionOutput)) { - return Optional - .of(getVersionFromWmicOutput(browserVersionOutput)); - } - } else { + } + if (!isNullOrEmpty(browserVersionOutput)) { return Optional .of(getVersionFromWmicOutput(browserVersionOutput)); }
Smell-fix: refactor method to reduce cognitive complexity
bonigarcia_webdrivermanager
train
java
02ff60d083181ae4899fcd8ed4ef28bddd065024
diff --git a/helper/resource/wait.go b/helper/resource/wait.go index <HASH>..<HASH> 100644 --- a/helper/resource/wait.go +++ b/helper/resource/wait.go @@ -74,7 +74,7 @@ func RetryableError(err error) *RetryError { return &RetryError{Err: err, Retryable: true} } -// NonRetryableError is a helper to create a RetryError that's _not)_ retryable +// NonRetryableError is a helper to create a RetryError that's _not_ retryable // from a given error. func NonRetryableError(err error) *RetryError { if err == nil {
Fixing small typo in resource/wait.go
hashicorp_terraform
train
go
dd231114bc0168658c47d2e66d3942ef1385db2b
diff --git a/debug.go b/debug.go index <HASH>..<HASH> 100644 --- a/debug.go +++ b/debug.go @@ -128,7 +128,7 @@ func (l *State) errorMessage() { l.top++ l.call(l.top-2, 1, false) } - l.throw(fmt.Errorf("%v: %s", RuntimeError, CheckString(l, -1))) + l.throw(RuntimeError(CheckString(l, -1))) } func SetHooker(l *State, f Hook, mask byte, count int) { diff --git a/lua.go b/lua.go index <HASH>..<HASH> 100644 --- a/lua.go +++ b/lua.go @@ -21,13 +21,16 @@ const ( ) var ( - RuntimeError = errors.New("runtime error") - SyntaxError = errors.New("syntax error") - MemoryError = errors.New("memory error") - ErrorError = errors.New("error within the error handler") - FileError = errors.New("file error") + SyntaxError = errors.New("syntax error") + MemoryError = errors.New("memory error") + ErrorError = errors.New("error within the error handler") + FileError = errors.New("file error") ) +type RuntimeError string + +func (r RuntimeError) Error() string { return "runtime error: " + string(r) } + type Type int const (
Throw RuntimeError as a structured error
Shopify_go-lua
train
go,go
a8fc28b5f4604023fe9039334ff0b13dce2269cc
diff --git a/packages/Pages/src/site/components/com_pages/filters/post.php b/packages/Pages/src/site/components/com_pages/filters/post.php index <HASH>..<HASH> 100644 --- a/packages/Pages/src/site/components/com_pages/filters/post.php +++ b/packages/Pages/src/site/components/com_pages/filters/post.php @@ -39,7 +39,7 @@ class ComPagesFilterPost extends ComMediumFilterPost protected function _initialize(KConfig $config) { $config->append(array( - 'tag_list' => array('img', 'a', 'blockquote', 'strong', 'em', 'ul', 'ol', 'li', 'code', 'h2', 'h3', 'h4'), + 'tag_list' => array('img', 'blockquote', 'strong', 'em', 'ul', 'ol', 'li', 'h1', 'h2', 'h3', 'h4', 'h5'), 'tag_method' => 0 ));
removed support for a, block quote tags
anahitasocial_anahita
train
php
dafc99dc83c185fd47d33b0a02f58ce14fe73277
diff --git a/any_urlfield/forms/fields.py b/any_urlfield/forms/fields.py index <HASH>..<HASH> 100644 --- a/any_urlfield/forms/fields.py +++ b/any_urlfield/forms/fields.py @@ -153,11 +153,11 @@ class ExtendedURLValidator(URLValidator): def __call__(self, value): try: super(ExtendedURLValidator, self).__call__(value) - except ValidationError as e: + except ValidationError: parsed = urlparse(value) if parsed.scheme == "tel" and re.match(self.tel_re, parsed.netloc): return - raise e + raise
Raise the original exception instead of reraising with a new traceback
edoburu_django-any-urlfield
train
py
c60d8c225637a5d06d7ca6e5ffa9512a5bdd5bcf
diff --git a/Collection.php b/Collection.php index <HASH>..<HASH> 100644 --- a/Collection.php +++ b/Collection.php @@ -1348,7 +1348,7 @@ class Collection implements ArrayAccess, Arrayable, Countable, IteratorAggregate // function which we were given. Then, we will sort the returned values and // and grab the corresponding values for the sorted keys from this array. foreach ($this->items as $key => $value) { - $results[$key] = [$callback($value, $key), $key]; + $results[$key] = $callback($value, $key); } $descending ? arsort($results, $options)
revert PR <I> (#<I>)
illuminate_support
train
php
58080c926abb51fa818dc8aa908ce60197d381d3
diff --git a/client/signup/jetpack-connect/controller.js b/client/signup/jetpack-connect/controller.js index <HASH>..<HASH> 100644 --- a/client/signup/jetpack-connect/controller.js +++ b/client/signup/jetpack-connect/controller.js @@ -223,7 +223,7 @@ export default { }, akismetLanding( context ) { - getPlansLandingPage( context, false, '/jetpack/connect/akismet' ); + getPlansLandingPage( context, true, '/jetpack/connect/akismet' ); }, plansLanding( context ) {
JPC: Hide free plan in akismet landing page
Automattic_wp-calypso
train
js
dff928df2dc271cadd56dfaffcef2a15fee9785e
diff --git a/lib/branch_io_cli/configuration/configuration.rb b/lib/branch_io_cli/configuration/configuration.rb index <HASH>..<HASH> 100644 --- a/lib/branch_io_cli/configuration/configuration.rb +++ b/lib/branch_io_cli/configuration/configuration.rb @@ -359,7 +359,7 @@ EOF return @branch_imports if @branch_imports source_files = target.source_build_phase.files.map { |f| f.file_ref.real_path.to_s } - source_files << bridging_header_path if bridging_header_path + source_files << bridging_header_path if bridging_header_path && File.exist?(bridging_header_path) @branch_imports = source_files.compact.map do |f| imports = branch_imports_from_file f next {} if imports.empty? @@ -377,6 +377,10 @@ EOF imports << "#{line_no}: #{line.chomp}" end imports + rescue StandardError + # Quietly ignore anything that can't be opened for now. + # TODO: Get these errors into report output. + [] end def method_missing(method_sym, *arguments, &block)
Better handling of source files that cannot be opened. (Usually from an unresolved setting like PROJECT_DIR/PROJECT_NAME/Bridging-Header.h)
BranchMetrics_branch_io_cli
train
rb
2625f5056553f03d9190726a8b8775f5913198f5
diff --git a/src/components/storage/storage__local.js b/src/components/storage/storage__local.js index <HASH>..<HASH> 100644 --- a/src/components/storage/storage__local.js +++ b/src/components/storage/storage__local.js @@ -7,8 +7,8 @@ var safePromise = function (resolver) { otherwise(function (e) { if (e && e.name === 'NS_ERROR_FILE_CORRUPTED') { window.alert('Sorry, it looks like your browser storage has been corrupted. ' + - 'Please clear your storage by going to Tools -> Clear Recent History -> Cookies' + - ' and set time range to "Everything". This will remove the corrupted browser storage across all sites.'); + 'Please clear your storage by going to Tools -> Clear Recent History -> Cookies' + + ' and set time range to "Everything". This will remove the corrupted browser storage across all sites.'); } return when.reject(e); }); @@ -75,8 +75,8 @@ LocalStorage.prototype.each = function (callback) { value = localStorage.getItem(item); promises.push( when.attempt(JSON.parse, value). - orElse(value). - fold(callback, item) + orElse(value). + fold(callback, item) ); } }
RG-<I> Storage: don't expect that everything in localStorage is json: indent Former-commit-id: 0e<I>f<I>d1fec<I>f5d<I>df0bafbb6a4d4
JetBrains_ring-ui
train
js
4727e7c399548a16df4378f96493f325140d5ef8
diff --git a/lib/zendesk_apps_support/validations/translations.rb b/lib/zendesk_apps_support/validations/translations.rb index <HASH>..<HASH> 100644 --- a/lib/zendesk_apps_support/validations/translations.rb +++ b/lib/zendesk_apps_support/validations/translations.rb @@ -49,7 +49,7 @@ module ZendeskAppsSupport end def required_keys(file) - return if file.relative_path != 'translations/en.json' || JSON.parse(file.read)['app']['name'] + return if file.relative_path != 'translations/en.json' || JSON.parse(file.read).dig('app', 'name') ValidationError.new('translation.missing_required_key', file: file.relative_path,
fix error caused by unsafe hash check
zendesk_zendesk_apps_support
train
rb
db50ff89904c78a31a5feeff9ad8fbe420fe6efe
diff --git a/karma.conf.js b/karma.conf.js index <HASH>..<HASH> 100644 --- a/karma.conf.js +++ b/karma.conf.js @@ -33,7 +33,7 @@ module.exports = function(config) { // test results reporter to use // possible values: 'dots', 'progress' // available reporters: https://npmjs.org/browse/keyword/karma-reporter - reporters: ['progress'], + reporters: ['dots'], // web server port port: 9876,
Progress reporter is too noisy on TravisCI. Use dots reporter instead.
LeaVerou_awesomplete
train
js
c1c4f3ad48e02739ce504b327ad6ff6397455f37
diff --git a/dispatch/static/manager/src/js/api/dispatch.js b/dispatch/static/manager/src/js/api/dispatch.js index <HASH>..<HASH> 100644 --- a/dispatch/static/manager/src/js/api/dispatch.js +++ b/dispatch/static/manager/src/js/api/dispatch.js @@ -1,7 +1,7 @@ import fetch from 'isomorphic-fetch' import url from 'url' -const API_URL = 'http://localhost:8000/api/' +const API_URL = 'http://192.168.56.101:80/api/' const DEFAULT_HEADERS = { 'Content-Type': 'application/json'
also revert redux devtools stuff
ubyssey_dispatch
train
js
934237d591f0aa692d9e6f0ecd24da34879b3c21
diff --git a/config/ember-try.js b/config/ember-try.js index <HASH>..<HASH> 100644 --- a/config/ember-try.js +++ b/config/ember-try.js @@ -75,8 +75,9 @@ module.exports = async function () { }, }, }, - embroiderSafe(), - embroiderOptimized(), + // Remove Embroider builds for now as there are compat issues + // embroiderSafe(), + // embroiderOptimized(), ], }; };
Remove Embroider compatibility builds from Ember Try config
imgix_ember-cli-imgix
train
js
73f4bb89012b0f06fff6d7599a891b6a9b0427ff
diff --git a/src/Validators/ConstRangeValidator.php b/src/Validators/ConstRangeValidator.php index <HASH>..<HASH> 100644 --- a/src/Validators/ConstRangeValidator.php +++ b/src/Validators/ConstRangeValidator.php @@ -34,6 +34,11 @@ class ConstRangeValidator extends RangeValidator */ public $targetClass; + /** + * @var callable + */ + public $filter; + public static $ranges = []; /** @@ -70,6 +75,18 @@ class ConstRangeValidator extends RangeValidator } /** + * @param mixed $value + * @return array|null + */ + protected function validateValue($value) + { + if (is_callable($this->filter)) { + $value = call_user_func($this->filter, $value); + } + return parent::validateValue($value); + } + + /** * @inheritdoc */ public function validateAttribute($model, $attribute)
Add filter to ConstRangeValidator
Horat1us_yii2-base
train
php
310878c4524e922518693bfdd024c571c5661b91
diff --git a/lib/node-progress.js b/lib/node-progress.js index <HASH>..<HASH> 100644 --- a/lib/node-progress.js +++ b/lib/node-progress.js @@ -88,6 +88,14 @@ ProgressBar.prototype.tick = function(len, tokens){ this.render(tokens); }; +/** + * Method to render the progress bar with optional `tokens` to + * place in the progress bar's `fmt` field. + * + * @param {Object} tokens + * @api public + */ + ProgressBar.prototype.render = function(tokens){ var percent = this.curr / this.total * 100 , complete = Math.round(this.width * (this.curr / this.total))
Added JSDoc for render method
visionmedia_node-progress
train
js
0adc45d69c5be7ec09934a90662369586d3962da
diff --git a/languagetool-language-modules/de/src/main/java/org/languagetool/rules/de/GermanSpellerRule.java b/languagetool-language-modules/de/src/main/java/org/languagetool/rules/de/GermanSpellerRule.java index <HASH>..<HASH> 100644 --- a/languagetool-language-modules/de/src/main/java/org/languagetool/rules/de/GermanSpellerRule.java +++ b/languagetool-language-modules/de/src/main/java/org/languagetool/rules/de/GermanSpellerRule.java @@ -92,7 +92,7 @@ public class GermanSpellerRule extends CompoundAwareHunspellRule { put("Thanks", "Danke"); put("Allalei", "Allerlei"); put("geupdate[dt]$", "upgedatet"); - put("gefaked", "gefakt"); + //put("gefaked", "gefakt"); -- don't suggest put("[pP]roblemhaft(e[nmrs]?)?", w -> Arrays.asList(w.replaceFirst("haft", "behaftet"), w.replaceFirst("haft", "atisch"))); put("rosane[mnrs]?$", w -> Arrays.asList("rosa", w.replaceFirst("^rosan", "rosafarben"))); put("Erbung", w -> Arrays.asList("Vererbung", "Erbschaft"));
[de] don't suggest ugly form "gefakt" (even though technically correct)
languagetool-org_languagetool
train
java
80c28972400269e7dd570f9b71fc23ace6d2b777
diff --git a/pyowm/parsers/jsonparser.py b/pyowm/parsers/jsonparser.py index <HASH>..<HASH> 100644 --- a/pyowm/parsers/jsonparser.py +++ b/pyowm/parsers/jsonparser.py @@ -100,7 +100,10 @@ def build_weather_from(d): humidity = 0 # -- snow is not a mandatory field if 'snow' in d: - snow = d['snow'].copy() + if isinstance(d['snow'], int) or isinstance(d['snow'], float): + snow = {'all': d['snow']} + else: + snow = d['snow'].copy() else: snow = {} # -- pressure
Fixed bug: snow item in JSON daily weather forecasts was treated as a dict while it could have been also a float
csparpa_pyowm
train
py
6a460ff3296d15ea899abc25dd298b98ed4074a8
diff --git a/assess_autoload_credentials.py b/assess_autoload_credentials.py index <HASH>..<HASH> 100755 --- a/assess_autoload_credentials.py +++ b/assess_autoload_credentials.py @@ -439,9 +439,9 @@ def write_openstack_config_file(tmp_dir, user, credential_details): def ensure_openstack_personal_cloud_exists(client): - if client.env.juju_home.endswith('/cloud-city'): - raise ValueError( - 'JUJU_HOME is wrongly set to: {}'.format(client.env.juju_home)) + juju_home = client.env.juju_home + if not juju_home.startswith('/tmp'): + raise ValueError('JUJU_HOME is wrongly set to: {}'.format(juju_home)) if client.env.clouds['clouds']: cloud_name = client.env.get_cloud() regions = client.env.clouds['clouds'][cloud_name]['regions'] @@ -456,7 +456,7 @@ def ensure_openstack_personal_cloud_exists(client): } } client.env.clouds['clouds'] = os_cloud - client.env.dump_yaml(client.env.juju_home, config=None) + client.env.dump_yaml(juju_home, config=None) def get_openstack_expected_details_dict(user, credential_details):
Improve sanity check for writing clouds.yaml.
juju_juju
train
py
fc609f5562ea102fb8540bed009ad0092fe4d88f
diff --git a/lib/committee/test/methods.rb b/lib/committee/test/methods.rb index <HASH>..<HASH> 100644 --- a/lib/committee/test/methods.rb +++ b/lib/committee/test/methods.rb @@ -1,9 +1,5 @@ module Committee::Test module Methods - def self.included(klass) - klass.send(:include, Rack::Test::Methods) - end - def assert_schema_conform assert_schema_content_type
Less magic; require an explicit inclusion of `Rack::Test::Methods`
interagent_committee
train
rb
27d0d13e065c308f60e1811a109ea72ec9cdcdd3
diff --git a/hazelcast/src/main/java/com/hazelcast/cache/impl/AbstractCacheService.java b/hazelcast/src/main/java/com/hazelcast/cache/impl/AbstractCacheService.java index <HASH>..<HASH> 100644 --- a/hazelcast/src/main/java/com/hazelcast/cache/impl/AbstractCacheService.java +++ b/hazelcast/src/main/java/com/hazelcast/cache/impl/AbstractCacheService.java @@ -330,7 +330,7 @@ public abstract class AbstractCacheService implements ICacheService, PreJoinAwar closeSegments(cacheNameWithPrefix); } - final WanReplicationService wanService = nodeEngine.getService(WanReplicationService.SERVICE_NAME); + WanReplicationService wanService = nodeEngine.getWanReplicationService(); wanService.removeWanEventCounters(ICacheService.SERVICE_NAME, cacheNameWithPrefix); cacheContexts.remove(cacheNameWithPrefix); operationProviderCache.remove(cacheNameWithPrefix);
Acquire WanReplicationService from NodeEngine while deleting cache The same cache deletion mechanism is used during node shutdown too, and acquiring `WanReplicationService` can fail in that case.
hazelcast_hazelcast
train
java
cadd51ab60440b1528ac07b13ff7e1ac6f973d13
diff --git a/wallace/db/base/attrs/datatypes.py b/wallace/db/base/attrs/datatypes.py index <HASH>..<HASH> 100644 --- a/wallace/db/base/attrs/datatypes.py +++ b/wallace/db/base/attrs/datatypes.py @@ -81,10 +81,14 @@ class UUID(String): is_uuid, ) - def __set__(self, inst, val): + @classmethod + def typecast(cls, val): if isinstance(val, uuid.UUID): val = val.hex - super(UUID, self).__set__(inst, val) + else: + val = uuid.UUID(val).hex + + return super(UUID, cls).typecast(val) class UUID4(UUID):
fix typecasting for UUID types
csira_wallace
train
py
ebebe0303e2cf6bdc8c75b0124f5cfadd47ca150
diff --git a/lib/ProMotion/classes/Screen.rb b/lib/ProMotion/classes/Screen.rb index <HASH>..<HASH> 100644 --- a/lib/ProMotion/classes/Screen.rb +++ b/lib/ProMotion/classes/Screen.rb @@ -195,6 +195,7 @@ module ProMotion end def view_will_appear(animated) + self.will_appear if self.respond_to? :will_appear end def view_did_appear(animated)
Added will_appear method.
infinitered_ProMotion
train
rb
014ddc80aaac3ed7a3114e705581c52027ab8182
diff --git a/src/sortablejs.js b/src/sortablejs.js index <HASH>..<HASH> 100644 --- a/src/sortablejs.js +++ b/src/sortablejs.js @@ -91,7 +91,7 @@ function init(Survey) { }; var getChoicesNotInResults = function () { var res = []; - question.activeChoices.forEach(function (choice) { + question.visibleChoices.forEach(function (choice) { if (!hasValueInResults(choice.value)) { res.push(choice); } @@ -104,7 +104,7 @@ function init(Survey) { if (!Array.isArray(val)) return res; for (var i = 0; i < val.length; i++) { var item = Survey.ItemValue.getItemByValue( - question.activeChoices, + question.visibleChoices, val[i] ); if (!!item) {
Fix #<I> sortableList randomized order not working
surveyjs_widgets
train
js
5b8e775cab0a051de9473cc58d8b4532d7a51cb5
diff --git a/src/com/opera/core/systems/scope/services/ums/SystemInputManager.java b/src/com/opera/core/systems/scope/services/ums/SystemInputManager.java index <HASH>..<HASH> 100644 --- a/src/com/opera/core/systems/scope/services/ums/SystemInputManager.java +++ b/src/com/opera/core/systems/scope/services/ums/SystemInputManager.java @@ -177,14 +177,13 @@ class ClickDelayer long currentTime = System.currentTimeMillis(); long doubleClickTime = WatirUtils.getSystemDoubleClickTimeMs(); long timeSinceLastClick = currentTime - lastClickTime; + long remainingTime = doubleClickTime - timeSinceLastClick; - if (timeSinceLastClick < doubleClickTime) { + if (remainingTime > 0) { logger.fine(String.format("Delaying click in order to avoid double-click - check your test (last click was %d ms ago, OS double click timeout is %d ms)", timeSinceLastClick, doubleClickTime)); try { - long remainingTime = doubleClickTime - timeSinceLastClick; // 100 ms chosen as a safe value for avoiding the double click, this may need adapting. - long sleepTime = remainingTime + 100; - Thread.sleep(sleepTime); + Thread.sleep(remainingTime + 100); } catch (InterruptedException e) { logger.warning("*** Delay was interrupted ***");
Could refactor this a bit, to get rid of a few unnecessary assignments;
operasoftware_operaprestodriver
train
java
2bcd4c5b56b673d1ad188638a857a2883ca6c287
diff --git a/src/Connection.php b/src/Connection.php index <HASH>..<HASH> 100644 --- a/src/Connection.php +++ b/src/Connection.php @@ -86,8 +86,7 @@ class Connection implements ConnectionInterface // Set request options $this->addOptions([ CURLOPT_URL => $url, - CURLOPT_POST => false, - CURLOPT_POSTFIELDS => [], + CURLOPT_HTTPGET => true, ]); return $this->exec(); diff --git a/test/ConnectionTest.php b/test/ConnectionTest.php index <HASH>..<HASH> 100644 --- a/test/ConnectionTest.php +++ b/test/ConnectionTest.php @@ -62,7 +62,7 @@ class ConnectionTest extends PHPUnit_Framework_TestCase $this->assertEquals("James Average Student", $resp["DisplayName"]); - $this->assertEquals(0, $connection->getOptions()[CURLOPT_POST]); + $this->assertEquals(1, $connection->getOptions()[CURLOPT_HTTPGET]); } public function testGetParams() @@ -74,7 +74,7 @@ class ConnectionTest extends PHPUnit_Framework_TestCase $this->assertEquals("James Average Student", $resp["DisplayName"]); - $this->assertEquals(0, $connection->getOptions()[CURLOPT_POST]); + $this->assertEquals(1, $connection->getOptions()[CURLOPT_HTTPGET]); } public function testPost()
Set curl request type to get in get request.
UWEnrollmentManagement_Connection
train
php,php
e339974051c72b01028d59075b9d1eb95b6b40b0
diff --git a/tests/frontend/org/voltdb/iv2/TestScoreboard.java b/tests/frontend/org/voltdb/iv2/TestScoreboard.java index <HASH>..<HASH> 100644 --- a/tests/frontend/org/voltdb/iv2/TestScoreboard.java +++ b/tests/frontend/org/voltdb/iv2/TestScoreboard.java @@ -41,9 +41,12 @@ public class TestScoreboard { } private CompleteTransactionTask createComp(long txnId, long timestamp) { + CompleteTransactionMessage msg = mock(CompleteTransactionMessage.class); + when(msg.isRollback()).thenReturn(!MpRestartSequenceGenerator.isForRestart(timestamp)); CompleteTransactionTask task = mock(CompleteTransactionTask.class); when(task.getMsgTxnId()).thenReturn(txnId); when(task.getTimestamp()).thenReturn(timestamp); + when(task.getCompleteMessage()).thenReturn(msg); return task; }
ENG-<I>: (#<I>) Fix unit test after scoreboard uses completionmessage timestamp.
VoltDB_voltdb
train
java
016d20b5420a7f31f1f74ca4099052d30c71815f
diff --git a/errors.go b/errors.go index <HASH>..<HASH> 100644 --- a/errors.go +++ b/errors.go @@ -83,7 +83,7 @@ import ( "github.com/getlantern/context" "github.com/getlantern/hidden" "github.com/getlantern/ops" - "github.com/getlantern/stack" + "github.com/go-stack/stack" ) // Error wraps system and application defined errors in unified structure for
switch back to go-stack/stack
getlantern_errors
train
go
1bd0201b2fe3540b70238e7fc37dc5858f1a467c
diff --git a/src/request.php b/src/request.php index <HASH>..<HASH> 100644 --- a/src/request.php +++ b/src/request.php @@ -66,6 +66,23 @@ public static function get_method() { } /** + * get the http ($_POST) data + * mainly useful for data from non-POST requests like PUT/PATCH/DELETE + * + * @return array a like $_POST + */ +public static function get_data() { + if (static::get_method() == 'POST') { + return $_POST; + } + + $data_string = file_get_contents('php://input'); + parse_str($data_string, $data_array); + + return $data_array; +} + +/** * get the primary http accepted output format for the current session * * @return string the most interesting part of the accept header ..
allows to fetch $_POST data for PUT/PATCH/DELETE requests
lode_fem
train
php
f3d5c0492fdd795ae31673a175bd7d9ed6cd8e8d
diff --git a/store/tikv/2pc.go b/store/tikv/2pc.go index <HASH>..<HASH> 100644 --- a/store/tikv/2pc.go +++ b/store/tikv/2pc.go @@ -588,8 +588,8 @@ func (c *twoPhaseCommitter) shouldWriteBinlog() bool { } // TiKV recommends each RPC packet should be less than ~1MB. We keep each packet's -// Key+Value size below 4KB. -const txnCommitBatchSize = 4 * 1024 +// Key+Value size below 16KB. +const txnCommitBatchSize = 16 * 1024 // batchKeys is a batch of keys in the same region. type batchKeys struct { diff --git a/store/tikv/client.go b/store/tikv/client.go index <HASH>..<HASH> 100644 --- a/store/tikv/client.go +++ b/store/tikv/client.go @@ -39,7 +39,7 @@ type Client interface { } const ( - maxConnection = 150 + maxConnection = 200 dialTimeout = 5 * time.Second writeTimeout = 10 * time.Second readTimeoutShort = 20 * time.Second // For requests that read/write several key-values.
Push more write flow to tikv (#<I>)
pingcap_tidb
train
go,go
404358da367d19776377bd3dd72d7486ad106abc
diff --git a/accordion.js b/accordion.js index <HASH>..<HASH> 100644 --- a/accordion.js +++ b/accordion.js @@ -6,12 +6,18 @@ // we're in a CommonJS environment; otherwise we'll just fail out if( vui === undefined ) { if( typeof require === 'function' ) { - module.exports = vui = require('../../vui'); + vui = require('../../vui'); } else { throw new Error('load vui first'); } } + // Export the vui object if we're in a CommonJS environment. + // It will already be on the window otherwise + if( typeof module === 'object' && typeof module.exports === 'object' ) { + module.exports = vui; + } + $.widget( "vui.vui_accordion", { options: {},
just checking for require isn't necessarily a CommonJS env. could be AMD based
Brightspace_jquery-valence-ui-accordion
train
js
03bcdf0cfc23029ecc4d570ec7e4a7b4a1013819
diff --git a/lib/actv/version.rb b/lib/actv/version.rb index <HASH>..<HASH> 100644 --- a/lib/actv/version.rb +++ b/lib/actv/version.rb @@ -1,3 +1,3 @@ module ACTV - VERSION = "1.4.2" + VERSION = "1.4.3" end
Bumps patch version to <I>
activenetwork_actv
train
rb
9f103e533c2b5904350fce71f57e498f83074636
diff --git a/index.js b/index.js index <HASH>..<HASH> 100644 --- a/index.js +++ b/index.js @@ -131,6 +131,7 @@ var sig = module.exports = function(messenger, opts) { // initialise the data event name var dataEvent = (opts || {}).dataEvent || 'data'; var openEvent = (opts || {}).openEvent || 'open'; + var closeEvent = (opts || {}).closeEvent || 'close'; var writeMethod = (opts || {}).writeMethod || 'write'; var closeMethod = (opts || {}).closeMethod || 'close'; var connected = false; @@ -169,6 +170,10 @@ var sig = module.exports = function(messenger, opts) { signaller.emit('open'); signaller.emit('connected'); }); + + messenger.on(closeEvent, function() { + signaller.emit('disconnected'); + }); } function connectToPrimus(url) {
Primus close event generates disconnected event, ref #<I>
rtc-io_rtc-signaller
train
js
dec1b122f480ee86906283377b78dd4222cfd7ba
diff --git a/Swat/SwatString.php b/Swat/SwatString.php index <HASH>..<HASH> 100644 --- a/Swat/SwatString.php +++ b/Swat/SwatString.php @@ -1089,13 +1089,8 @@ class SwatString extends SwatObject */ public static function hash($string) { - $hash = md5($string); - - $string = ''; - for ($i = 0; $i < strlen($hash) / 2; $i++) - $string .= chr(hexdec(substr($hash, $i * 2, 2))); - - $hash = base64_encode($string); + $hash = md5($string, true); + $hash = base64_encode($hash); // remove padding characters $hash = str_replace('=', '', $hash);
This is over <I> times faster in KCacheGrind profiles and does the same thing. For widgets that use a lot of serialized values (SwatDateEntry for example) this used to add up to about <I>% of the overhead of using Swat. Kudos to Mark PK for noticing this. svn commit r<I>
silverorange_swat
train
php
e312efc517688a6a0bac3a2cdebc08d899330580
diff --git a/lib/specinfra/command/openbsd.rb b/lib/specinfra/command/openbsd.rb index <HASH>..<HASH> 100644 --- a/lib/specinfra/command/openbsd.rb +++ b/lib/specinfra/command/openbsd.rb @@ -47,11 +47,25 @@ module SpecInfra "egrep '^#{escape(recipient)}:.*#{escape(target)}' /etc/mail/aliases" end + def check_link(link, target) + "stat -f %Y #{escape(link)} | grep -- #{escape(target)}" + end + def check_mode(file, mode) regexp = "^#{mode}$" "stat -f%Lp #{escape(file)} | grep #{escape(regexp)}" end + def check_owner(file, owner) + regexp = "^#{owner}$" + "stat -f %Su #{escape(file)} | grep -- #{escape(regexp)}" + end + + def check_grouped(file, group) + regexp = "^#{group}$" + "stat -f %Sg #{escape(file)} | grep -- #{escape(regexp)}" + end + def check_mounted(path) regexp = "on #{path} " "mount | grep #{escape(regexp)}"
Add OpenBSD specific commands for checking file status
mizzy_specinfra
train
rb
9b706a4e6a2e22846c319ea1b7d2144270c3cf69
diff --git a/src/SelectionControls/SelectionControlModel.php b/src/SelectionControls/SelectionControlModel.php index <HASH>..<HASH> 100644 --- a/src/SelectionControls/SelectionControlModel.php +++ b/src/SelectionControls/SelectionControlModel.php @@ -49,6 +49,7 @@ class SelectionControlModel extends ControlModel { $list = parent::getExposableModelProperties(); $list[] = "selectedItems"; + $list[] = "supportsMultipleSelection"; return $list; }
Selection controls pass their supportsMultipleSelection to the viewbridge
RhubarbPHP_Module.Leaf.CommonControls
train
php
b8eb1bbd5ba80a84a69f2c15ce58f21baa8da3af
diff --git a/core/node/dns.go b/core/node/dns.go index <HASH>..<HASH> 100644 --- a/core/node/dns.go +++ b/core/node/dns.go @@ -26,7 +26,7 @@ func DNSResolver(cfg *config.Config) (*madns.Resolver, error) { hasEth := false for domain, url := range cfg.DNS.Resolvers { - if !dns.IsFqdn(domain) { + if domain != "." && !dns.IsFqdn(domain) { return nil, fmt.Errorf("invalid domain %s; must be FQDN", domain) }
the dot is not really an FQDN
ipfs_go-ipfs
train
go