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
a244af514133dec27f8b1e0ffed1151b16caac01
diff --git a/src/anyconfig/ioinfo.py b/src/anyconfig/ioinfo.py index <HASH>..<HASH> 100644 --- a/src/anyconfig/ioinfo.py +++ b/src/anyconfig/ioinfo.py @@ -37,10 +37,7 @@ def guess_io_type(obj): >>> apath = "/path/to/a_conf.ext" >>> assert guess_io_type(apath) == IOI_PATH_STR - - >>> import pathlib - >>> if pathlib is not None: - ... assert guess_io_type(pathlib.Path(apath)) == IOI_PATH_OBJ + >>> assert guess_io_type(pathlib.Path(apath)) == IOI_PATH_OBJ >>> assert guess_io_type(open(__file__)) == IOI_STREAM >>> guess_io_type(1) # doctest: +ELLIPSIS Traceback (most recent call last):
refactor: remove 'import ...' line from a doctest because it's imported already
ssato_python-anyconfig
train
py
673685450263008c448655e37b3ee979e6f3e952
diff --git a/lxd/device/config/device_runconfig.go b/lxd/device/config/device_runconfig.go index <HASH>..<HASH> 100644 --- a/lxd/device/config/device_runconfig.go +++ b/lxd/device/config/device_runconfig.go @@ -55,3 +55,9 @@ type RunConfig struct { PCIDevice []RunConfigItem // PCI device configuration settings. Revert *revert.Reverter // Revert setup of device on post-setup error. } + +// NICConfig contains network interface configuration to be passed into a VM and applied by the agent. +type NICConfig struct { + MACAddress string `json:"mac_address"` + MTU uint32 `json:"mtu"` +}
lxd/device/config: Adds NicConfig struct for passing data into VM.
lxc_lxd
train
go
aa9e564e01e2f26bc19411d7acb77bae4015d1f3
diff --git a/github/editor.go b/github/editor.go index <HASH>..<HASH> 100644 --- a/github/editor.go +++ b/github/editor.go @@ -117,6 +117,8 @@ func openTextEditor(program, file string) error { editCmd.WithArg("set ft=gitcommit tw=0 wrap lbr") } editCmd.WithArg(file) + // Reattach stdin to the console before opening the editor + resetConsole() return editCmd.Spawn() }
Reset the console before opening the editor
github_hub
train
go
d74f3b80a71bc9726f997e7b1e3c566f8c31bf4c
diff --git a/Ork/Sniffs/PHP/DisallowComparisonAssignmentSniff.php b/Ork/Sniffs/PHP/DisallowComparisonAssignmentSniff.php index <HASH>..<HASH> 100644 --- a/Ork/Sniffs/PHP/DisallowComparisonAssignmentSniff.php +++ b/Ork/Sniffs/PHP/DisallowComparisonAssignmentSniff.php @@ -103,7 +103,7 @@ class DisallowComparisonAssignmentSniff implements Sniff for ($i = ($stackPtr + 1); $i < $endStatement; $i++) { if (isset(Tokens::$comparisonTokens[$tokens[$i]['code']]) === true) { - if ($phpcsFile->findNext(T_INLINE_THEN, ($stackPtr + 1), null, false, null, true) === false) { + if ($phpcsFile->findNext([T_INLINE_THEN, T_COALESCE], ($stackPtr + 1), null, false, null, true) === false) { $error = 'The value of a comparison must not be assigned to a variable'; $phpcsFile->addError($error, $stackPtr, 'AssignedComparison'); }
Exclude null coalesce operator from this test.
AlexHowansky_ork-phpcs
train
php
6504a4fd004a26b1fe586f328ef35768c6e6d67a
diff --git a/src/extra/dna-vdom-component.js b/src/extra/dna-vdom-component.js index <HASH>..<HASH> 100644 --- a/src/extra/dna-vdom-component.js +++ b/src/extra/dna-vdom-component.js @@ -185,12 +185,19 @@ export class DNAVDomComponent extends DNATemplateComponent { // Render the template let html = this.getViewContent(); if (html !== null) { - let tmp = document.createElement('div'); - this._vtree = this._vtree || nodeToVDOM(tmp); - tmp.innerHTML = html; - let tree = nodeToVDOM(tmp, { - hooks: registry(this.is).useVirtualDomHooks, - }); + let tree = new virtualDom.VNode(this.tagName); + this._vtree = this._vtree || tree; + let parser = new DOMParser(); + let doc = parser.parseFromString( + `<${this.tagName}>${html}</${this.tagName}>`, + 'text/html' + ); + let tmp = doc.body && doc.body.firstChild; + if (tmp) { + tree = nodeToVDOM(tmp, { + hooks: registry(this.is).useVirtualDomHooks, + }); + } let diff = virtualDom.diff(this._vtree || nodeToVDOM(), tree); virtualDom.patch(this, diff); this._vtree = tree;
refactor: use DOMParser instaed of instantiate a DOMNode in DNAVDomComponent #3
chialab_dna
train
js
d0a0e19b2776282d83e19f677a708220bd7c0c81
diff --git a/pybitcoin/transactions/serialize.py b/pybitcoin/transactions/serialize.py index <HASH>..<HASH> 100644 --- a/pybitcoin/transactions/serialize.py +++ b/pybitcoin/transactions/serialize.py @@ -11,6 +11,7 @@ from binascii import hexlify, unhexlify import struct from .utils import flip_endian, variable_length_int from ..constants import UINT_MAX +from utilitybelt import is_hex def serialize_input(input, signature_script_hex=''): """ Serializes a transaction input. @@ -19,6 +20,12 @@ def serialize_input(input, signature_script_hex=''): and 'output_index' in input): raise Exception('Required parameters: transaction_hash, output_index') + if is_hex(str(input['transaction_hash'])) and len(str(input['transaction_hash'])) != 64: + raise Exception("Transaction hash '%s' must be 32 bytes" % input['transaction_hash']) + + elif not is_hex(str(input['transaction_hash'])) and len(str(input['transaction_hash'])) != 32: + raise Exception("Transaction hash '%s' must be 32 bytes" % hexlify(input['transaction_hash'])) + if not 'sequence' in input: input['sequence'] = UINT_MAX
Include extra sanity checks on the size and format of the transaction hash before serializing.
blockstack_pybitcoin
train
py
4b76bd4bd4bd7b29b127cab1180b0efe4ba3b339
diff --git a/lib/Thelia/Core/Template/Loop/CategoryTree.php b/lib/Thelia/Core/Template/Loop/CategoryTree.php index <HASH>..<HASH> 100644 --- a/lib/Thelia/Core/Template/Loop/CategoryTree.php +++ b/lib/Thelia/Core/Template/Loop/CategoryTree.php @@ -61,7 +61,7 @@ class CategoryTree extends BaseI18nLoop implements ArraySearchLoopInterface $search->filterByParent($parent); - if ($visible != BooleanOrBothType::ANY) $search->filterByVisible($visible); + if ($visible !== BooleanOrBothType::ANY) $search->filterByVisible($visible); if ($exclude != null) $search->filterById($exclude, Criteria::NOT_IN);
correction of the filter visible in categoryTree.
thelia_core
train
php
15473c16bb20d5c6ddaad7cf678203f536de2703
diff --git a/tests/job/validation_test.py b/tests/job/validation_test.py index <HASH>..<HASH> 100644 --- a/tests/job/validation_test.py +++ b/tests/job/validation_test.py @@ -31,6 +31,7 @@ VALID_IML_IMT = { "PGA": [0.007, 0.005, 0.0098], "RSD": [0.005, 0.007, 0.0098], "SA(0)": [0.005, 0.007, 0.0098], + "SA(0.025)": [0.005, 0.007, 0.0098], "SA(2.5)": [0.005, 0.007, 0.0098], "SA(0.45)": [0.005, 0.007, 0.0098], }
Re-added a deleted line in some test data Former-commit-id: b<I>c7cd<I>cc9c<I>a<I>be<I>e9f8e<I>f5c8
gem_oq-engine
train
py
331fc1b613ea90bae7c9e266ff1619a1691cdb68
diff --git a/index.js b/index.js index <HASH>..<HASH> 100644 --- a/index.js +++ b/index.js @@ -58,8 +58,8 @@ FaviconsWebpackPlugin.prototype.apply = function (compiler) { if (htmlPluginData.plugin.options.favicons !== false) { htmlPluginData.html = htmlPluginData.html.replace( /(<\/head>)/i, compilationResult.stats.html.join('') + '$&'); - callback(null, htmlPluginData); } + callback(null, htmlPluginData); }); }); }
Make the configuration from HtmlWebpackplugin (options.favicons) work (#<I>) With this configuration the callback is never called and blocks the build : new HtmlWebpackPlugin({ template: file, inject: false, filename: filename, favicons: false })
jantimon_favicons-webpack-plugin
train
js
63a92db540820f6abd84c189b561ef35781a9043
diff --git a/conductor/src/main/java/com/bluelinelabs/conductor/Controller.java b/conductor/src/main/java/com/bluelinelabs/conductor/Controller.java index <HASH>..<HASH> 100644 --- a/conductor/src/main/java/com/bluelinelabs/conductor/Controller.java +++ b/conductor/src/main/java/com/bluelinelabs/conductor/Controller.java @@ -1035,7 +1035,11 @@ public abstract class Controller { } private void removeViewReference() { + Context context = null; + if (view != null) { + context = view.getContext(); + if (!isBeingDestroyed && !hasSavedViewState) { saveViewState(view); } @@ -1071,7 +1075,7 @@ public abstract class Controller { } if (isBeingDestroyed) { - performDestroy(); + performDestroy(context); } } @@ -1148,9 +1152,13 @@ public abstract class Controller { } } - private void performDestroy() { + private void performDestroy(@Nullable Context context) { + if (context == null) { + context = getActivity(); + } + if (isContextAvailable) { - onContextUnavailable(getActivity()); + onContextUnavailable(context); } if (!destroyed) {
Pass along View's context on destroy if available
bluelinelabs_Conductor
train
java
f8fbbbac6aa63005eeeb2679862aa56852500b81
diff --git a/lib/ronin/open_port.rb b/lib/ronin/open_port.rb index <HASH>..<HASH> 100644 --- a/lib/ronin/open_port.rb +++ b/lib/ronin/open_port.rb @@ -46,9 +46,6 @@ module Ronin # The service detected on the port belongs_to :service, :required => false - # Any proxy information - has 1, :proxy_info - # any credentials used by the service running on the port has 0..n, :service_credentials
Removed an old relationship from OpenPort.
ronin-ruby_ronin
train
rb
44b052eb075ff71086b16a254b656fef162087e4
diff --git a/lib/composer.js b/lib/composer.js index <HASH>..<HASH> 100644 --- a/lib/composer.js +++ b/lib/composer.js @@ -48,7 +48,7 @@ function Composer(windshield) { function processComponent(context) { return function (component) { - var componentModule = options.components[component.component]; + var componentModule = options.components[component.component] || {}; var adapter = componentModule.adapter || null; var Model = componentModule.Model || null; var templates = componentModule.templates || {};
SR-<I> | Fix windshield so it doesn't blow up when an adapter isn't yet defined.
carsdotcom_windshieldjs
train
js
3296acbdc515ddff2a014af09f3cb9865ec3688e
diff --git a/lib/dm-core/associations/many_to_one.rb b/lib/dm-core/associations/many_to_one.rb index <HASH>..<HASH> 100644 --- a/lib/dm-core/associations/many_to_one.rb +++ b/lib/dm-core/associations/many_to_one.rb @@ -118,11 +118,12 @@ module DataMapper # @api semipublic def get(source, query = nil) lazy_load(source) - if query.nil? - get!(source) - else + + if query collection = get_collection(source) collection.first(query) if collection + else + get!(source) end end
Minor tweak to the improved m:1#get
datamapper_dm-core
train
rb
a4225a4f15edded36875a68f3c94ff15f94a9c9c
diff --git a/uPortal-health/src/main/java/org/apereo/portal/health/HealthCheckController.java b/uPortal-health/src/main/java/org/apereo/portal/health/HealthCheckController.java index <HASH>..<HASH> 100644 --- a/uPortal-health/src/main/java/org/apereo/portal/health/HealthCheckController.java +++ b/uPortal-health/src/main/java/org/apereo/portal/health/HealthCheckController.java @@ -21,5 +21,4 @@ public class HealthCheckController { // Do nothing, just return HTTP 200, OK logger.debug("Doing a health check. Returning HTTP 200, OK"); } - }
Added uPortal/health-check endpoint, removed extra newline in code
Jasig_uPortal
train
java
28557e0cfe9113a5285330542264f03e4ba74535
diff --git a/references/detection/train.py b/references/detection/train.py index <HASH>..<HASH> 100644 --- a/references/detection/train.py +++ b/references/detection/train.py @@ -35,6 +35,11 @@ from torchvision.transforms import InterpolationMode from transforms import SimpleCopyPaste +def copypaste_collate_fn(batch): + copypaste = SimpleCopyPaste(blending=True, resize_interpolation=InterpolationMode.BILINEAR) + return copypaste(*utils.collate_fn(batch)) + + def get_dataset(name, image_set, transform, data_path): paths = {"coco": (data_path, get_coco, 91), "coco_kp": (data_path, get_coco_kp, 2)} p, ds_fn, num_classes = paths[name] @@ -194,11 +199,6 @@ def main(args): if args.data_augmentation != "lsj": raise RuntimeError("SimpleCopyPaste algorithm currently only supports the 'lsj' data augmentation policies") - copypaste = SimpleCopyPaste(resize_interpolation=InterpolationMode.BILINEAR, blending=True) - - def copypaste_collate_fn(batch): - return copypaste(*utils.collate_fn(batch)) - train_collate_fn = copypaste_collate_fn data_loader = torch.utils.data.DataLoader(
Fix copypaste collate pickle issues (#<I>)
pytorch_vision
train
py
193ca52462b4b1cd3592229ecbaf2803037f8cae
diff --git a/Resources/Public/pz2-client.js b/Resources/Public/pz2-client.js index <HASH>..<HASH> 100644 --- a/Resources/Public/pz2-client.js +++ b/Resources/Public/pz2-client.js @@ -437,7 +437,7 @@ function turnIntoNewWindowLink (link) { } link.title = newTitle; - if (piwikTracker) { + if (typeof(piwikTracker) !== 'undefined') { piwikTracker.addListener(link); } } @@ -1973,7 +1973,7 @@ function loadSelectsFromForm (form) { info - string with additional information regarding the action [optional] */ function trackPiwik (action, info) { - if (piwikTracker) { + if (typeof(piwikTracker) !== 'undefined') { var pageURL = document.URL.replace(/\/$/,'') + '/pazpar2/' + action; if (info) { pageURL += '/' + info;
more careful/correct check whether piwikTracker is defined or not
subugoe_typo3-pazpar2
train
js
8154b96d677838e75db7c68b03214cf70452b274
diff --git a/chainntfs/chainntfs.go b/chainntfs/chainntfs.go index <HASH>..<HASH> 100644 --- a/chainntfs/chainntfs.go +++ b/chainntfs/chainntfs.go @@ -1,5 +1,7 @@ package chainntnfs +import "github.com/btcsuite/btcd/wire" + // TODO(roasbeef): finish // * multiple backends for interface // * btcd - websockets @@ -10,4 +12,14 @@ package chainntnfs // * SPV bloomfilter // * other stuff maybe... type ChainNotifier interface { + RegisterConfirmationsNotification(txid *wire.ShaHash, numConfs uint32, trigger *NotificationTrigger) error + RegisterSpendNotification(outpoint *wire.OutPoint, trigger *NotificationTrigger) error + + Start() error + Stop() error +} + +type NotificationTrigger struct { + TriggerChan chan struct{} + Callback func() }
chainntfs: flesh out initial draft of interface * So far very simple, only notifications for tx confirmations, and outpoint spends. * Our two cases are: waiting for the funding transaction to reach a depth of N confirmations, and open channels being notified of the counterpart trying to cheat them by broadcasting an invalidated commitment tx.
lightningnetwork_lnd
train
go
5fc37f8ac3293f8fa231cbd2905d15b29edc156c
diff --git a/flink-connectors/flink-connector-filesystem/src/main/java/org/apache/flink/streaming/connectors/fs/bucketing/BucketingSink.java b/flink-connectors/flink-connector-filesystem/src/main/java/org/apache/flink/streaming/connectors/fs/bucketing/BucketingSink.java index <HASH>..<HASH> 100644 --- a/flink-connectors/flink-connector-filesystem/src/main/java/org/apache/flink/streaming/connectors/fs/bucketing/BucketingSink.java +++ b/flink-connectors/flink-connector-filesystem/src/main/java/org/apache/flink/streaming/connectors/fs/bucketing/BucketingSink.java @@ -724,9 +724,7 @@ public class BucketingSink<T> handlePendingFilesForPreviousCheckpoints(bucketState.pendingFilesPerCheckpoint); - synchronized (bucketState.pendingFilesPerCheckpoint) { - bucketState.pendingFilesPerCheckpoint.clear(); - } + bucketState.pendingFilesPerCheckpoint.clear(); } } @@ -741,9 +739,7 @@ public class BucketingSink<T> handlePendingFilesForPreviousCheckpoints(restoredState.pendingFilesPerCheckpoint); - synchronized (restoredState.pendingFilesPerCheckpoint) { - restoredState.pendingFilesPerCheckpoint.clear(); - } + restoredState.pendingFilesPerCheckpoint.clear(); } private void handlePendingInProgressFile(String file, long validLength) {
[FLINK-<I>] [connector] Unnecessary synchronizing object in BucketingSink.
apache_flink
train
java
737dadda559a6cdddf9fc5eba6b2aea5399599f5
diff --git a/lib/merb-core.rb b/lib/merb-core.rb index <HASH>..<HASH> 100644 --- a/lib/merb-core.rb +++ b/lib/merb-core.rb @@ -101,5 +101,8 @@ module Merb attr_accessor :generator_scope Merb.generator_scope = [:merb_default, :merb, :rspec] end + + module GlobalHelpers + end end diff --git a/lib/merb-core/controller/abstract_controller.rb b/lib/merb-core/controller/abstract_controller.rb index <HASH>..<HASH> 100644 --- a/lib/merb-core/controller/abstract_controller.rb +++ b/lib/merb-core/controller/abstract_controller.rb @@ -117,7 +117,7 @@ class Merb::AbstractController # The controller that is being inherited from Merb::AbstractController def inherited(klass) _abstract_subclasses << klass.to_s - klass.send(:include, Object.full_const_get("#{klass}Helper") rescue nil + klass.send(:include, Object.full_const_get("#{klass}Helper")) rescue nil super end
Whoops: some typos in the last commit
wycats_merb
train
rb,rb
571b36df60ce868e44974d9d4b65cca48cd8ee2a
diff --git a/bosh-stemcell/spec/stemcells/stig_spec.rb b/bosh-stemcell/spec/stemcells/stig_spec.rb index <HASH>..<HASH> 100644 --- a/bosh-stemcell/spec/stemcells/stig_spec.rb +++ b/bosh-stemcell/spec/stemcells/stig_spec.rb @@ -49,6 +49,7 @@ describe 'Stig test case verification', { stemcell_image: true, stig_check: true V-38585 V-38462 V-38617 + V-38472 } expected_stig_test_cases = expected_base_stig_test_cases diff --git a/bosh-stemcell/spec/support/stemcell_shared_examples.rb b/bosh-stemcell/spec/support/stemcell_shared_examples.rb index <HASH>..<HASH> 100644 --- a/bosh-stemcell/spec/support/stemcell_shared_examples.rb +++ b/bosh-stemcell/spec/support/stemcell_shared_examples.rb @@ -29,4 +29,10 @@ shared_examples_for 'All Stemcells' do it { should_not be_file } end end + + context 'all system command files must be owned by root (stig: V-38472)' do + describe command('find -L /bin /usr/bin /usr/local/bin /sbin /usr/sbin /usr/local/sbin ! -user root') do + its (:stdout) { should eq('') } + end + end end
All system command files must be owned by root [#<I>]
cloudfoundry_bosh
train
rb,rb
630a767b8a3a93035733093b4184c05dfa2e9d31
diff --git a/lxd/storage/drivers/driver_lvm_utils.go b/lxd/storage/drivers/driver_lvm_utils.go index <HASH>..<HASH> 100644 --- a/lxd/storage/drivers/driver_lvm_utils.go +++ b/lxd/storage/drivers/driver_lvm_utils.go @@ -60,7 +60,7 @@ func (d *lvm) openLoopFile(source string) (*os.File, error) { defer unlock() // Try to prepare new loop device. - loopF, err := PrepareLoopDev(source, 0) + loopF, err := PrepareLoopDev(source, LoFlagsDirectIO) if err != nil { return nil, err }
lxd/storage: Enable direct IO for loop devices in lvm
lxc_lxd
train
go
ef198ea04b0f88f33d7f4099a14f59b96e7bcfb0
diff --git a/test/index.js b/test/index.js index <HASH>..<HASH> 100644 --- a/test/index.js +++ b/test/index.js @@ -16,7 +16,7 @@ describe('WIF', function () { }) }) - describe('decode', function () { + describe('decode/decodeRaw', function () { fixtures.valid.forEach(function (f) { it('returns ' + f.d.slice(0, 20) + '... (' + f.version + ')' + ' for ' + f.WIF, function () { var actual = wif.decode(f.version, f.WIF) @@ -35,17 +35,4 @@ describe('WIF', function () { }) }) }) - - describe('decodeRaw', function () { - fixtures.valid.forEach(function (f) { - it('returns ' + f.d.slice(0, 20) + '... (' + f.version + ')' + ' for ' + f.WIF, function () { - var buffer = bs58check.decode(f.WIF) - var actual = wif.decodeRaw(f.version, buffer) - - assert.strictEqual(actual.version, f.version) - assert.strictEqual(actual.d.toString('hex'), f.d) - assert.strictEqual(actual.compressed, f.compressed) - }) - }) - }) })
tests: decodeRaw doesnt need its own tests
bitcoinjs_wif
train
js
28d266b2dac1c68ce1d492153c87374232603471
diff --git a/enocean/protocol/eep.py b/enocean/protocol/eep.py index <HASH>..<HASH> 100644 --- a/enocean/protocol/eep.py +++ b/enocean/protocol/eep.py @@ -167,12 +167,12 @@ class EEP(object): profile = self.telegrams[eep_rorg][rorg_func][rorg_type] - if eep_rorg == RORG.VLD: - # For VLD; multiple commands can be defined, with the command id always in same location (per RORG-FUNC-TYPE). + if command: + # multiple commands can be defined, with the command id always in same location (per RORG-FUNC-TYPE). eep_command = profile.find('command', recursive=False) # If commands are not set in EEP, or command is None, # get the first data as a "best guess". - if not eep_command or command is None: + if not eep_command: return profile.find('data', recursive=False) # If eep_command is defined, so should be data.command
Support command for any rorg (#<I>)
kipe_enocean
train
py
115ae3f1df1ba94cfcfeca7c899cbea714d2a578
diff --git a/cake/config/config.php b/cake/config/config.php index <HASH>..<HASH> 100644 --- a/cake/config/config.php +++ b/cake/config/config.php @@ -22,5 +22,5 @@ * @lastmodified $Date$ * @license http://www.opensource.org/licenses/mit-license.php The MIT License */ -return $config['Cake.version'] = '1.2.4.8284'; -?> \ No newline at end of file +return $config['Cake.version'] = '1.2.5'; +?>
Updating CakePHP version.
cakephp_cakephp
train
php
4bbda4f0aef0a5430eb7b96e67bea3a84b5d82aa
diff --git a/src/task/index.js b/src/task/index.js index <HASH>..<HASH> 100644 --- a/src/task/index.js +++ b/src/task/index.js @@ -28,6 +28,7 @@ var fromJSON = function(json) { case taskTypes.TASK_TYPE_ECHO: return echoFn.fromJSON(json) case taskTypes.TASK_TYPE_LIMIT: return limitFn.fromJSON(json) + case taskTypes.TASK_TYPE_SLEEP: return sleepFn.fromJSON(json) } } diff --git a/src/task/sleep.js b/src/task/sleep.js index <HASH>..<HASH> 100644 --- a/src/task/sleep.js +++ b/src/task/sleep.js @@ -14,4 +14,9 @@ var sleep = function(value) { } } +sleep.fromJSON = function(json) { + var params = _.get(json, 'params', {}) + return 'sleep(' + JSON.stringify(params.value) + ')' +} + module.exports = sleep // export default sleep
Added sleep.fromJSON().
flexiodata_flexio-sdk-js
train
js,js
f744c804132cd850e5ef507d95d08f287b5fb290
diff --git a/lib/Bzip2.js b/lib/Bzip2.js index <HASH>..<HASH> 100644 --- a/lib/Bzip2.js +++ b/lib/Bzip2.js @@ -335,7 +335,7 @@ Bunzip.prototype._get_next_block = function() { literal used is the one at the head of the mtfSymbol array.) */ if (runPos){ runPos = 0; - if (dbufCount + t >= this.dbufSize) { _throw(Err.DATA_ERROR); } + if (dbufCount + t > this.dbufSize) { _throw(Err.DATA_ERROR); } uc = symToByte[mtfSymbol[0]]; byteCount[uc] += t; while (t--)
Apply "exactly fill up the buffer" fix from toybox's bunzip.c. Quoting the original commit message: > It's not a problem to exactly fill up the buffer with a run if the > next symbol is the terminating symbol. Fixes > <URL>
cscott_compressjs
train
js
1e9d5cb949700100e39614f9253e133f9092b136
diff --git a/python/pywatchman/__init__.py b/python/pywatchman/__init__.py index <HASH>..<HASH> 100644 --- a/python/pywatchman/__init__.py +++ b/python/pywatchman/__init__.py @@ -41,6 +41,16 @@ class WatchmanError(Exception): pass +class SocketTimeout(WatchmanError): + """A specialized exception raised for socket timeouts during communication to/from watchman. + This makes it easier to implement non-blocking loops as callers can easily distinguish + between a routine timeout and an actual error condition. + + Note that catching WatchmanError will also catch this as it is a super-class, so backwards + compatibility in exception handling is preserved. + """ + + class CommandError(WatchmanError): """error returned by watchman @@ -135,13 +145,13 @@ class UnixSocketTransport(Transport): raise WatchmanError('empty watchman response') return buf[0] except socket.timeout: - raise WatchmanError('timed out waiting for response') + raise SocketTimeout('timed out waiting for response') def write(self, data): try: self.sock.sendall(data) except socket.timeout: - raise WatchmanError('timed out sending query command') + raise SocketTimeout('timed out sending query command') class WindowsNamedPipeTransport(Transport):
Create a specialized exception for socket.timeout exceptions
facebook_watchman
train
py
63510285a026e4f05ed730a8eb2dd3356185be08
diff --git a/src/Components.php b/src/Components.php index <HASH>..<HASH> 100644 --- a/src/Components.php +++ b/src/Components.php @@ -73,14 +73,24 @@ final class Components ErrorHandler::halt('Failed to discover potential modules; could not load composer/installed.json'); } - $aComposer = @json_decode($sComposer); + $mComposer = @json_decode($sComposer); - if (empty($aComposer)) { + if (empty($mComposer)) { ErrorHandler::halt('Failed to discover potential modules; could not decode composer/installed.json'); } + if (is_array($mComposer)) { + $aPackages = $mComposer; + + } elseif (is_object($mComposer) && property_exists($mComposer, 'packages')) { + $aPackages = $mComposer->packages; + + } else { + ErrorHandler::halt('composer/installed.json is not in a valid format'); + } + $aOut = []; - foreach ($aComposer as $oPackage) { + foreach ($aPackages as $oPackage) { if (isset($oPackage->extra->nails)) { $aOut[] = new Component( $oPackage,
Backwards compatible support for composer v2 when discovering packages
nails_common
train
php
4a886e55078fc9268f8234711eb24a3bd8a8be5a
diff --git a/agent/jvm/src/main/java/org/jolokia/jvmagent/security/DelegatingAuthenticator.java b/agent/jvm/src/main/java/org/jolokia/jvmagent/security/DelegatingAuthenticator.java index <HASH>..<HASH> 100644 --- a/agent/jvm/src/main/java/org/jolokia/jvmagent/security/DelegatingAuthenticator.java +++ b/agent/jvm/src/main/java/org/jolokia/jvmagent/security/DelegatingAuthenticator.java @@ -119,7 +119,7 @@ public class DelegatingAuthenticator extends Authenticator { @Override public HttpPrincipal extract(URLConnection connection) throws IOException, ParseException { - final InputStreamReader isr = new InputStreamReader(connection.getInputStream()) + final InputStreamReader isr = new InputStreamReader(connection.getInputStream()); try { Object payload = new JSONParser().parse(isr); Stack<String> pathElements = EscapeUtil.extractElementsFromPath(path);
Update DelegatingAuthenticator.java
rhuss_jolokia
train
java
87ef35ad8c19ea8ec82a4534805a6a703c878dfc
diff --git a/tests/test_restapi.py b/tests/test_restapi.py index <HASH>..<HASH> 100644 --- a/tests/test_restapi.py +++ b/tests/test_restapi.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -from . import BaseTest +from . import BackendBaseTest from django.core.urlresolvers import reverse from django.test.utils import override_settings @@ -18,7 +18,7 @@ except ImportError: @skipUnless(rest_framework_installed, "Django restframework is not installed") -class TestRESTApi(BaseTest): +class TestRESTApi(BackendBaseTest): def test_retrieve(self): self.client.login(username='test_user', password='123456') self.client.get('/create')
testapi case deriving from backend test case
evonove_django-stored-messages
train
py
29cb7334578ca8bee8d571f351fb1a83e997b8b6
diff --git a/Blob/Stream.php b/Blob/Stream.php index <HASH>..<HASH> 100644 --- a/Blob/Stream.php +++ b/Blob/Stream.php @@ -15,8 +15,10 @@ namespace WindowsAzure\DistributionBundle\Blob; use WindowsAzure\Blob\BlobRestProxy; use WindowsAzure\Blob\Models\ListContainersOptions; +use WindowsAzure\Blob\Models\CreateBlobOptions; use WindowsAzure\Common\ServiceException; use Exception; +use Symfony\Component\HttpFoundation\File\MimeType\MimeTypeGuesser; /** * Stream Wrapper implementation for Windows Azure Blob Storage @@ -223,12 +225,17 @@ class Stream ); } + $mimeTypeGuesser = MimeTypeGuesser::getInstance(); + $createBlobOptions = new CreateBlobOptions(); + $createBlobOptions->setBlobContentType($mimeTypeGuesser->guess($this->temporaryFileName)); + // Upload the file try { $result = $this->getStorageClient($this->fileName)->createBlockBlob( $this->getContainerName($this->fileName), $this->getFileName($this->fileName), - fopen($this->temporaryFileName, "r") + fopen($this->temporaryFileName, "r"), + $createBlobOptions ); } catch (Exception $ex) { $this->cleanup();
added MimeTypeGuesser to set mime types
brainsonic_AzureDistributionBundle
train
php
4d9d1289050fb2ed92902cafcac8f0ab2cd435f0
diff --git a/examples/parallel_client.py b/examples/parallel_client.py index <HASH>..<HASH> 100644 --- a/examples/parallel_client.py +++ b/examples/parallel_client.py @@ -127,7 +127,7 @@ def get_urls_ordered_pool(urls, parallelism=None): # def get_urls_ordered_map(urls, parallelism=None): - return greenhouse.pool.map( + return greenhouse.map( lambda u: urllib2.urlopen(u).read(), urls, pool_size=parallelism or len(urls))
map() is now in the top-level greenhouse namespace
teepark_greenhouse
train
py
7e4f9254dd660a08f34994eae6d0beff82ae424c
diff --git a/code/libraries/koowa/controller/behavior/exception.php b/code/libraries/koowa/controller/behavior/exception.php index <HASH>..<HASH> 100644 --- a/code/libraries/koowa/controller/behavior/exception.php +++ b/code/libraries/koowa/controller/behavior/exception.php @@ -17,4 +17,4 @@ * @package Koowa_Controller * @subpackage Behavior */ -class KControllerBehaviorException extends KDatabaseException {} \ No newline at end of file +class KControllerBehaviorException extends KControllerException {} \ No newline at end of file
Need to extend from KControllerException
joomlatools_joomlatools-framework
train
php
3af5841fca19229409d8b6f99ffaaaf4f1fd34a1
diff --git a/demo/js/demo-switcher.js b/demo/js/demo-switcher.js index <HASH>..<HASH> 100644 --- a/demo/js/demo-switcher.js +++ b/demo/js/demo-switcher.js @@ -8,9 +8,6 @@ export default class DemoSwitcher { this.element = element; this.constructor.components.set(this.element, this); this.element.addEventListener('click', (event) => this.handleClick(event)); - - document.querySelector('.demo--container').classList.add('flex-row'); - document.querySelector('#flex-row').checked = true; } static create(element) {
remove flex styles by default (#<I>)
carbon-design-system_carbon-components
train
js
26f0a09d27a089faf26a70eec791f459f8f78eef
diff --git a/django_mobile/loader.py b/django_mobile/loader.py index <HASH>..<HASH> 100644 --- a/django_mobile/loader.py +++ b/django_mobile/loader.py @@ -11,6 +11,9 @@ class Loader(BaseLoader): is_usable = True _template_source_loaders = None + def get_contents(self, origin): + return origin.loader.get_contents(origin) + def get_template_sources(self, template_name, template_dirs=None): template_name = self.prepare_template_name(template_name) for loader in self.template_source_loaders:
to support recursion in Django <I>
gregmuellegger_django-mobile
train
py
3b31b2389664728fa8e736a526fa0cf54236a058
diff --git a/ldap_sync/search.py b/ldap_sync/search.py index <HASH>..<HASH> 100644 --- a/ldap_sync/search.py +++ b/ldap_sync/search.py @@ -14,15 +14,15 @@ class LDAPSearch(object): self.settings = settings def __del__(self): - self.unbind() + self._unbind() @property def ldap(self): if self._ldap is None: - self._ldap = self.bind() + self._ldap = self._bind() return self._ldap - def bind(self): + def _bind(self): ldap.set_option(ldap.OPT_REFERRALS, 0) l = ldap.initialize(self.settings.URI) l.protocol_version = ldap.VERSION3 @@ -33,7 +33,7 @@ class LDAPSearch(object): raise return l - def unbind(self): + def _unbind(self): if self._ldap is not None: self.ldap.unbind_s() self._ldap = None
Mark some LDAPSearch methods as internal
jbittel_django-ldap-sync
train
py
9e985a4b48add34bfac4e88f858b155511c388b1
diff --git a/system/API/ResponseTrait.php b/system/API/ResponseTrait.php index <HASH>..<HASH> 100644 --- a/system/API/ResponseTrait.php +++ b/system/API/ResponseTrait.php @@ -134,13 +134,14 @@ trait ResponseTrait $output = $this->format($data); } - if ($this->format === 'json') { - return $this->response->setJSON($output) - ->setStatusCode($status, $message); - } + if (! is_null($output) && $this->format === 'json') + { + return $this->response->setJSON($output) + ->setStatusCode($status, $message); + } - return $this->response->setBody($output) - ->setStatusCode($status, $message); + return $this->response->setBody($output) + ->setStatusCode($status, $message); } //-------------------------------------------------------------------- @@ -387,6 +388,7 @@ trait ResponseTrait $contentType = str_replace('application/json', 'text/html', $contentType); $contentType = str_replace('application/', 'text/', $contentType); $this->response->setContentType($contentType); + $this->format = 'html'; return $data; }
Added a check in respond to make sure the output isn't null before setting it as json. Modified the format method so it sets the format to hmtl if the data is a string.
codeigniter4_CodeIgniter4
train
php
3320b6961b29a88af514e27a85b849fac49c2c69
diff --git a/ctox/main.py b/ctox/main.py index <HASH>..<HASH> 100644 --- a/ctox/main.py +++ b/ctox/main.py @@ -11,7 +11,7 @@ from ctox.shell import cprint __version__ = version = '0.1.2' -SUPPORTED_ENVS = ('py26', 'py27', 'py33', 'py34') +SUPPORTED_ENVS = ('py26', 'py27', 'py33', 'py34', 'py35') class Env(object):
Add support for python <I>
hayd_ctox
train
py
cd12e927fec2af2182cc68d7a7b30e57abef4ed5
diff --git a/tests/test_model_organization.py b/tests/test_model_organization.py index <HASH>..<HASH> 100755 --- a/tests/test_model_organization.py +++ b/tests/test_model_organization.py @@ -137,11 +137,6 @@ class OrganizerTest(unittest.TestCase): # test file names self.organizer.config.save() projectname = self.organizer.exp_config['project'] - print(self.organizer.info(exp_path=True)) - print('-' * 80) - print(osp.join(self.test_dir, projectname, - '.project', - self.organizer.experiment + '.yml')) self.assertEqual(self.organizer.info(exp_path=True), osp.join(self.test_dir, projectname, '.project', @@ -259,6 +254,16 @@ class OrganizerTest(unittest.TestCase): self.organizer.app_main('main', match=True, new=True) self.assertEqual(organizer.experiment, 'test_main5') + def test_config(self): + """Test whether the ExperimentConfig works correctly""" + self._test_init() + exp = self.organizer.experiment + self.organizer.config.save() + organizer2 = self.organizer.__class__() + # the experiment config should not have been loaded + self.assertIsInstance(dict(organizer2.config.experiments)[exp], + six.string_types) + if __name__ == '__main__': unittest.main()
Implemented test for ExperimentConfig
Chilipp_model-organization
train
py
c4a0975ba115239ac35e154dfcf61d7b429c063a
diff --git a/src/Console/MakeAuthCommand.php b/src/Console/MakeAuthCommand.php index <HASH>..<HASH> 100644 --- a/src/Console/MakeAuthCommand.php +++ b/src/Console/MakeAuthCommand.php @@ -34,7 +34,7 @@ class MakeAuthCommand extends BaseCommand ); file_put_contents( - base_path('app/routes.php'), + base_path('app/routes/web.php'), file_get_contents(__DIR__.'/stubs/make/routes.stub'), FILE_APPEND );
Corrects the route path for Laravel <I> for install auth scaffolding
peterfox_hexavel-components
train
php
18e78c1b8e1ad375cd8ef1d16b81ecbc7a61f545
diff --git a/class.krumo.php b/class.krumo.php index <HASH>..<HASH> 100644 --- a/class.krumo.php +++ b/class.krumo.php @@ -577,6 +577,8 @@ This is a list of all the values from the <code><b><?php echo realpath($ini_file print "</ul></div>\n"; + print "<!-- Krumo - HTML -->\n\n"; + // flee the hive $_recursion_marker = krumo::_marker(); if ($hive =& krumo::_hive($dummy)) { @@ -769,7 +771,7 @@ This is a list of all the values from the <code><b><?php echo realpath($ini_file <style type="text/css"> <?php echo $css?> </style> -<!-- CSS --> +<!-- Krumo - CSS --> <?php // the JS // @@ -777,8 +779,7 @@ This is a list of all the values from the <code><b><?php echo realpath($ini_file <script type="text/javascript"> <?php echo join(file(KRUMO_DIR . "krumo.min.js"));?> </script> -<!-- JavaScript --> - +<!-- Krumo - JavaScript --> <?php }
Show the CSS/JavaScript/HTML sections with appropriate tags This makes reading the HTML source a lot easier
mmucklo_krumo
train
php
b1eaa33ec08740662891208c416da3dddc3d9834
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -22,7 +22,7 @@ from setuptools import setup setup(name='Skink', - version='0.1.4', + version='0.2.0', description='Control the DOM from Python using Websockets', author='OKso.me', author_email='@okso.me',
Upgraded version number to <I>
oksome_Skink
train
py
8ad422e8947ee9f928adb6c309b181641b9aa13a
diff --git a/app/models/alchemy/element/presenters.rb b/app/models/alchemy/element/presenters.rb index <HASH>..<HASH> 100644 --- a/app/models/alchemy/element/presenters.rb +++ b/app/models/alchemy/element/presenters.rb @@ -80,8 +80,15 @@ module Alchemy "#{name}_#{id}" end + # The content that's used for element's preview text. + # + # It tries to find one of element's contents that is defined +as_element_title+. + # Takes element's first content if no content is defined +as_element_title+. + # + # @return (Alchemy::Content) + # def preview_content - @_preview_content ||= contents.detect(&:preview_content?) + @_preview_content ||= contents.detect(&:preview_content?) || contents.first end private @@ -92,7 +99,7 @@ module Alchemy end def preview_text_from_preview_content(maxlength) - (preview_content || contents.first).try(:preview_text, maxlength) + preview_content.try!(:preview_text, maxlength) end end end
Return the first content if no preview content found Same behavior, but with more intuitive code. The Element#preview_content method now returns the content marked as_element_title or the first one.
AlchemyCMS_alchemy_cms
train
rb
febdf5a5a91ac04fad2c7996f7f55fa19f0ff7d7
diff --git a/activerecord/test/cases/relations_test.rb b/activerecord/test/cases/relations_test.rb index <HASH>..<HASH> 100644 --- a/activerecord/test/cases/relations_test.rb +++ b/activerecord/test/cases/relations_test.rb @@ -27,6 +27,12 @@ class RelationTest < ActiveRecord::TestCase assert_equal van.id, Minivan.where(:minivan_id => van).to_a.first.minivan_id end + def test_do_not_double_quote_string_id_with_array + van = Minivan.last + assert van + assert_equal van, Minivan.where(:minivan_id => [van]).to_a.first + end + def test_bind_values relation = Post.scoped assert_equal [], relation.bind_values
Added one more failing test for bug #<I>
rails_rails
train
rb
b234cab5a38597b20739220e2b18f64ee217ea06
diff --git a/lib/brightbox-cli/config.rb b/lib/brightbox-cli/config.rb index <HASH>..<HASH> 100644 --- a/lib/brightbox-cli/config.rb +++ b/lib/brightbox-cli/config.rb @@ -104,6 +104,10 @@ module Brightbox end end + def alias + config[client_name]['alias'] + end + def to_fog raise Ini::Error, "No api client configured" unless configured? c = config[client_name] diff --git a/lib/brightbox-cli/gli_global_hooks.rb b/lib/brightbox-cli/gli_global_hooks.rb index <HASH>..<HASH> 100644 --- a/lib/brightbox-cli/gli_global_hooks.rb +++ b/lib/brightbox-cli/gli_global_hooks.rb @@ -35,7 +35,8 @@ module Brightbox end end command = commands[:help] if global_options[:h] - info "INFO: client_id: #{CONFIG.client_name}" if CONFIG.clients.size > 1 + config_alias = CONFIG.alias == CONFIG.client_name ? nil : "(#{CONFIG.alias})" + info "INFO: client_id: #{CONFIG.client_name} #{config_alias}" if CONFIG.clients.size > 1 true end
Add the alias to the info output so you can see which config alias is in use if the alias differs from the client id
brightbox_brightbox-cli
train
rb,rb
d91d1c869910c1df44aa231adb52d625f53e8688
diff --git a/indexing-service/src/main/java/org/apache/druid/indexing/common/task/batch/parallel/TaskMonitor.java b/indexing-service/src/main/java/org/apache/druid/indexing/common/task/batch/parallel/TaskMonitor.java index <HASH>..<HASH> 100644 --- a/indexing-service/src/main/java/org/apache/druid/indexing/common/task/batch/parallel/TaskMonitor.java +++ b/indexing-service/src/main/java/org/apache/druid/indexing/common/task/batch/parallel/TaskMonitor.java @@ -164,8 +164,10 @@ public class TaskMonitor<T extends Task> } } catch (Throwable t) { + // Note that we only log the message here so that task monitoring continues to happen or else + // the task which created this monitor will keep on waiting endlessly assuming monitored tasks + // are still running. log.error(t, "Error while monitoring"); - throw t; } }, taskStatusCheckingPeriod,
make TaskMonitor continue to monitor in the face of transient errors (#<I>)
apache_incubator-druid
train
java
f5ae1a4596df5d08bd477322079f05e345c0fc80
diff --git a/packages/lib/lib/encodeCall.js b/packages/lib/lib/encodeCall.js index <HASH>..<HASH> 100644 --- a/packages/lib/lib/encodeCall.js +++ b/packages/lib/lib/encodeCall.js @@ -1,9 +1,9 @@ const abi = require('ethereumjs-abi') -function encodeCall(name, arguments = [], rawValues = []) { +function encodeCall(name, args = [], rawValues = []) { const values = rawValues.map(value => value.toString()) // convert BigNumbers to string - const methodId = abi.methodID(name, arguments).toString('hex'); - const params = abi.rawEncode(arguments, values).toString('hex'); + const methodId = abi.methodID(name, args).toString('hex'); + const params = abi.rawEncode(args, values).toString('hex'); return '0x' + methodId + params; }
Hotfix: arguments is reserved in strict mode
zeppelinos_zos
train
js
bb19d96455031e256c1e66a266b1e335f6ea41cc
diff --git a/iprestrict/middleware.py b/iprestrict/middleware.py index <HASH>..<HASH> 100644 --- a/iprestrict/middleware.py +++ b/iprestrict/middleware.py @@ -50,9 +50,11 @@ class IPRestrictMiddleware(MiddlewareMixin): if forwarded_for: closest_proxy = client_ip client_ip = forwarded_for.pop(0) + if self.trust_all_proxies: + return client_ip proxies = [closest_proxy] + forwarded_for for proxy in proxies: - if not self.trust_all_proxies and proxy not in self.trusted_proxies: + if proxy not in self.trusted_proxies: logger.warn("Client IP %s forwarded by untrusted proxy %s" % (client_ip, proxy)) raise exceptions.PermissionDenied return client_ip
short circuit IPRESTRICT_TRUST_ALL_PROXIES as early as possible
muccg_django-iprestrict
train
py
f2e350c1352677477561183f66863bf62d21990d
diff --git a/spec/hamlit/engine/old_attributes_spec.rb b/spec/hamlit/engine/old_attributes_spec.rb index <HASH>..<HASH> 100644 --- a/spec/hamlit/engine/old_attributes_spec.rb +++ b/spec/hamlit/engine/old_attributes_spec.rb @@ -103,5 +103,24 @@ describe Hamlit::Engine do <span '<foo>'='&lt;bar&gt;'></span> HTML end + + describe 'element class with attributes class' do + it 'does not generate double classes' do + assert_render(<<-HAML, <<-HTML) + .item{ class: 'first' } + HAML + <div class='first item'></div> + HTML + end + + it 'does not generate double classes for a variable' do + assert_render(<<-HAML, <<-HTML) + - val = 'val' + .element{ class: val } + HAML + <div class='element val'></div> + HTML + end + end end end
Add spec to ensure double classes aren't generated Related to #4.
haml_haml
train
rb
d1a8a7d178025b0255b506b5208b39f42c31370d
diff --git a/lxd/storage_pools_utils.go b/lxd/storage_pools_utils.go index <HASH>..<HASH> 100644 --- a/lxd/storage_pools_utils.go +++ b/lxd/storage_pools_utils.go @@ -78,21 +78,17 @@ func storagePoolCreateGlobal(state *state.State, req api.StoragePoolsPost, clien // so that it doesn't need to be explicitly called in every failing // return path. Track whether or not we want to undo the changes // using a closure. - tryUndo := true - defer func() { - if !tryUndo { - return - } + revert := revert.New() + defer revert.Fail() - dbStoragePoolDeleteAndUpdateCache(state, req.Name) - }() + revert.Add(func() { dbStoragePoolDeleteAndUpdateCache(state, req.Name) }) _, err = storagePoolCreateLocal(state, id, req, clientType) if err != nil { return err } - tryUndo = false + revert.Success() return nil }
lxd/storage/pools/utils: Use revert in storagePoolCreateGlobal
lxc_lxd
train
go
f4bec5fcc30264834fb04e0e0a7f0e74f15ebbf9
diff --git a/lib/celluloid/pool_manager.rb b/lib/celluloid/pool_manager.rb index <HASH>..<HASH> 100644 --- a/lib/celluloid/pool_manager.rb +++ b/lib/celluloid/pool_manager.rb @@ -80,6 +80,14 @@ module Celluloid @size end + def busy_size + @busy.length + end + + def idle_size + @idle.length + end + # Provision a new worker def __provision_worker while @idle.empty?
Added idle_size and busy_size calls for the pool manager
celluloid_celluloid
train
rb
edc9d938515a6efa1c127d2a90bc1e762b77c499
diff --git a/src/data/url/data-url_test.js b/src/data/url/data-url_test.js index <HASH>..<HASH> 100644 --- a/src/data/url/data-url_test.js +++ b/src/data/url/data-url_test.js @@ -86,3 +86,19 @@ QUnit.test('idProp is not part of the parameters', function() { }); }); + +QUnit.test("destroyData()", function(){ + var connection = persist({ + idProp: "id", + url: "/api/todos" + }); + + fixture("DELETE /api/todos/3", function(req) { + notEqual(req.data.other, "prop", "don't include it"); + }); + + stop(); + connection.destroyData({ id: 3, other: "prop" }).then(function(){ + start(); + }); +});
DELETE requests include a body DELETE requests are including a body, even though most servers include the body and some servers return errors when it is included.
canjs_can-connect
train
js
57ccc63ccb6598282ffaf2286247c4aafd983f64
diff --git a/lib/ec2_meta/fetcher.rb b/lib/ec2_meta/fetcher.rb index <HASH>..<HASH> 100644 --- a/lib/ec2_meta/fetcher.rb +++ b/lib/ec2_meta/fetcher.rb @@ -14,8 +14,10 @@ module Ec2Meta def fetch(path) res = http_client.get(request_path(path)) - fail MetaNotFound, "'#{path}' not found." if res.code == '404' - res.body + return res.body if res.code != '404' + + fail MetaNotFound, "'#{path}' not found." if fail_on_not_found? + nil rescue Timeout::Error => e logger.error 'Can\'t fetch EC2 metadata from EC2 METADATA API.' logger.error 'ec2_meta gem is only available on AWS EC2 instance.' @@ -47,5 +49,9 @@ module Ec2Meta def request_path(path) '/' + API_VERSION + path end + + def fail_on_not_found? + @options[:fail_on_not_found] + end end end
add option to fail on metadata not_found
leonis_ec2_meta
train
rb
e0d4387cf37d6cc3baeb80f61bd24a37e5dfae26
diff --git a/matchers/have_occurred_matcher.go b/matchers/have_occurred_matcher.go index <HASH>..<HASH> 100644 --- a/matchers/have_occurred_matcher.go +++ b/matchers/have_occurred_matcher.go @@ -29,5 +29,5 @@ func (matcher *HaveOccurredMatcher) FailureMessage(actual interface{}) (message } func (matcher *HaveOccurredMatcher) NegatedFailureMessage(actual interface{}) (message string) { - return fmt.Sprintf("Expected error:\n%s\n%s\n%s", format.Object(actual, 1), format.IndentString(actual.(error).Error(), 1), "not to have occurred") + return fmt.Sprintf("Unexpected error:\n%s\n%s\n%s", format.Object(actual, 1), format.IndentString(actual.(error).Error(), 1), "occurred") }
Clarify message for unexpected errors When reading a lot, the phrasing "Expected error" at the start makes me think it *is* expected...then we say "not to have occurred" which is awkward. Let's avoid the double negative.
onsi_gomega
train
go
d824dacd6466db867b06e70d48cc78ad6bd674ec
diff --git a/pygam/utils.py b/pygam/utils.py index <HASH>..<HASH> 100644 --- a/pygam/utils.py +++ b/pygam/utils.py @@ -539,9 +539,8 @@ def gen_edge_knots(data, dtype, verbose=True): stacklevel=2) return knots -def b_spline_basis(x, edge_knots, n_splines=20, - spline_order=3, sparse=True, - clamped=False, verbose=True): +def b_spline_basis(x, edge_knots, n_splines=20, spline_order=3, sparse=True, + verbose=True): """ tool to generate b-spline basis using vectorized De Boor recursion the basis functions extrapolate linearly past the end-knots. @@ -624,10 +623,6 @@ def b_spline_basis(x, edge_knots, n_splines=20, for m in range(2, spline_order + 2): maxi -= 1 - # bookkeeping to avoid div by 0 - # mask_l = aug_knots[m - 1 : maxi + m - 1] != aug_knots[:maxi] - # mask_r = aug_knots[m : maxi + m] != aug_knots[1 : maxi + 1] - # left sub-basis num = (x - aug_knots[:maxi]) num *= bases[:, :maxi]
clean up references to clamped bases
dswah_pyGAM
train
py
f433c5dff5a6a0f40885eb9c0dc9f4640699bee8
diff --git a/src/nylas-connection.js b/src/nylas-connection.js index <HASH>..<HASH> 100644 --- a/src/nylas-connection.js +++ b/src/nylas-connection.js @@ -137,6 +137,12 @@ module.exports = class NylasConnection { console.warn(warning); } + // raw MIMI emails have json === false and the body is a string so + // we need to turn into JSON before we can access fields + if (options.json === false) { + body = JSON.parse(body); + } + if (error || response.statusCode > 299) { if (!error) { error = new Error(body.message); @@ -151,8 +157,6 @@ module.exports = class NylasConnection { } else { if (options.downloadRequest) { return resolve(response); - } else if (options.json === false) { - return resolve(JSON.parse(body)); } else { return resolve(body); }
Parse body into JSON if its a string (#<I>)
nylas_nylas-nodejs
train
js
dc9ea995fa89ec55a4bcd18b3e5bdba0eb365c0e
diff --git a/benchmarks/datetime.js b/benchmarks/datetime.js index <HASH>..<HASH> 100644 --- a/benchmarks/datetime.js +++ b/benchmarks/datetime.js @@ -32,7 +32,7 @@ suite .on('cycle', event => { console.log(String(event.target)); }) - .on('complete', () => { + .on('complete', function() { console.log('Fastest is ' + this.filter('fastest').map('name')); }) .run();
Don't use Arrow Function (#<I>)
moment_luxon
train
js
71abd4fbdd98127dc2b4ca7c9508d38cc4caf888
diff --git a/actionpack/lib/action_dispatch/testing/assertions/selector.rb b/actionpack/lib/action_dispatch/testing/assertions/selector.rb index <HASH>..<HASH> 100644 --- a/actionpack/lib/action_dispatch/testing/assertions/selector.rb +++ b/actionpack/lib/action_dispatch/testing/assertions/selector.rb @@ -341,7 +341,7 @@ module ActionDispatch # # ==== Examples # # Selects all bold tags from within the title of an ATOM feed's entries (perhaps to nab a section name prefix) - # assert_select_feed :atom, 1.0 do + # assert_select "feed[xmlns='http://www.w3.org/2005/Atom']" do # # Select each entry item and then the title item # assert_select "entry>title" do # # Run assertions on the encoded title elements @@ -353,7 +353,7 @@ module ActionDispatch # # # # Selects all paragraph tags from within the description of an RSS feed - # assert_select_feed :rss, 2.0 do + # assert_select "rss[version=2.0]" do # # Select description element of each feed item. # assert_select "channel>item>description" do # # Run assertions on the encoded elements.
Remove assert_select_feed from assert_select_encoded documentation This documentation came from the assert_select plugin, but the assert_select_feed method was omitted when the plugin was merged into Rails in <I>f<I>d<I>ae2c<I>b4c<I>fa<I>a.
rails_rails
train
rb
425834fd3ab8c4d40629918cbc9d468560a745a8
diff --git a/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRAssetLoader.java b/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRAssetLoader.java index <HASH>..<HASH> 100644 --- a/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRAssetLoader.java +++ b/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRAssetLoader.java @@ -656,22 +656,17 @@ public final class GVRAssetLoader { { return texture; } - bmapTex = new GVRBitmapTexture(mContext, (Bitmap) null, textureParameters); - mTextureCache.put(resource, bmapTex); - } - try - { - Bitmap bitmap = GVRAsynchronousResourceLoader.decodeStream(resource.getStream(), false); - resource.closeStream(); - if (bitmap != null) - { - bmapTex.update(bitmap); + + try { + Bitmap bitmap = GVRAsynchronousResourceLoader.decodeStream(resource.getStream(), false); + bmapTex = new GVRBitmapTexture(mContext, bitmap, textureParameters); + mTextureCache.put(resource, bmapTex); + } catch (IOException e) { + return null; + } finally { + resource.closeStream(); } } - catch (IOException ex) - { - return null; - } return bmapTex; }
framework: have bitmap textures created by the asset loader tested for alpha too
Samsung_GearVRf
train
java
f12e3d3f8a1f4ef7d86bf34adbf80982cc522f60
diff --git a/lib/loops/worker.rb b/lib/loops/worker.rb index <HASH>..<HASH> 100644 --- a/lib/loops/worker.rb +++ b/lib/loops/worker.rb @@ -21,6 +21,12 @@ class Worker def run return if shutdown? if @engine == 'fork' + # Enable COW-friendly garbage collector in Ruby Enterprise Edition + # See http://www.rubyenterpriseedition.com/faq.html#adapt_apps_for_cow for more details + if GC.respond_to?(:copy_on_write_friendly=) + GC.copy_on_write_friendly = true + end + @pid = Kernel.fork do @pid = Process.pid begin
Enable COW-friendly GC on rubyee when using fork engine
kovyrin_loops
train
rb
8fe4f76a17484b704aa64bb14a934a6a3c18bcd6
diff --git a/ui/app/routes/clients/client.js b/ui/app/routes/clients/client.js index <HASH>..<HASH> 100644 --- a/ui/app/routes/clients/client.js +++ b/ui/app/routes/clients/client.js @@ -1,6 +1,7 @@ import { inject as service } from '@ember/service'; import Route from '@ember/routing/route'; import notifyError from 'nomad-ui/utils/notify-error'; +import { watchRecord, watchRelationship } from 'nomad-ui/utils/properties/watch'; export default Route.extend({ store: service(), @@ -15,4 +16,19 @@ export default Route.extend({ } return model && model.get('allocations'); }, + + setupController(controller, model) { + controller.set('watchModel', this.get('watch').perform(model)); + controller.set('watchAllocations', this.get('watchAllocations').perform(model)); + return this._super(...arguments); + }, + + deactivate() { + this.get('watch').cancelAll(); + this.get('watchAllocations').cancelAll(); + return this._super(...arguments); + }, + + watch: watchRecord('node'), + watchAllocations: watchRelationship('allocations'), });
Watch node and related allocations on the client detail page
hashicorp_nomad
train
js
095e04652fef93a3b83313df18922df79fe9fce2
diff --git a/analytics.go b/analytics.go index <HASH>..<HASH> 100644 --- a/analytics.go +++ b/analytics.go @@ -258,7 +258,7 @@ func (c *client) upload(b []byte) error { func (c *client) report(res *http.Response) (err error) { var body []byte - if res.StatusCode < 400 { + if res.StatusCode < 300 { c.debugf("response %s", res.Status) return }
don't consider 3xx HTTP status codes a success
segmentio_analytics-go
train
go
e444a2cd51c72546ceacfeab53aa20d827371994
diff --git a/pylint/lint.py b/pylint/lint.py index <HASH>..<HASH> 100644 --- a/pylint/lint.py +++ b/pylint/lint.py @@ -581,7 +581,8 @@ class PyLinter(config.OptionsManagerMixIn, def disable_noerror_messages(self): for msgcat, msgids in six.iteritems(self.msgs_store._msgs_by_category): - if msgcat == 'E': + # enable only messages with 'error' severity and above ('fatal') + if msgcat in ['E', 'F']: for msgid in msgids: self.enable(msgid) else: @@ -696,9 +697,8 @@ class PyLinter(config.OptionsManagerMixIn, # get needed checkers neededcheckers = [self] for checker in self.get_checkers()[1:]: - # fatal errors should not trigger enable / disabling a checker messages = set(msg for msg in checker.msgs - if msg[0] != 'F' and self.is_message_enabled(msg)) + if self.is_message_enabled(msg)) if (messages or any(self.report_is_enabled(r[0]) for r in checker.reports)): neededcheckers.append(checker)
Show fatal messages when disabling no-error messages (#<I>) Currently 'pylint -E' disables all non-error messages, but this includes fatal errors as well. This change reverts that, since fatal errors are errors after all.
PyCQA_pylint
train
py
682f1f3558597f7d4b2fe41799e753cdd46bfb13
diff --git a/modules/custom/openy_map/js/map.js b/modules/custom/openy_map/js/map.js index <HASH>..<HASH> 100644 --- a/modules/custom/openy_map/js/map.js +++ b/modules/custom/openy_map/js/map.js @@ -1237,14 +1237,18 @@ } var filtered_locations = []; for (var i = 0; i < locations.length; i++) { - var loc = locations[i]; + var loc = locations[i], + matched_amenities = 0; for (var j = 0; j < this.amenities_filters.length; j++) { var amenities_filter = this.amenities_filters[j]; if ($.inArray(amenities_filter, loc.amenities) >= 0) { - filtered_locations.push(loc); - continue; // If any tag matches, skip checking other tags + matched_amenities++; } } + // All selected tags should match. + if (matched_amenities === this.amenities_filters.length) { + filtered_locations.push(loc); + } } return filtered_locations; },
[OS-<I>] fixed Location Amenities Filter Logic
ymcatwincities_openy
train
js
0f3a621f4312acc6dd8969abbc4ec5326726060b
diff --git a/outline/manager.js b/outline/manager.js index <HASH>..<HASH> 100644 --- a/outline/manager.js +++ b/outline/manager.js @@ -290,7 +290,7 @@ module.exports = function (doc) { const items = await getDashboardItems() function renderTab (div, item) { - div.dataset.name = item.tabName || item.paneName + div.dataset.globalPaneName = item.tabName || item.paneName div.textContent = item.label } @@ -386,8 +386,8 @@ module.exports = function (doc) { if (dashboardContainer.childNodes.length > 0 && options.pane) { outlineContainer.style.display = 'none' dashboardContainer.style.display = 'inherit' - const tab = dashboardContainer.querySelector(`[data-name="${options.pane}"]`) || - dashboardContainer.querySelector('[data-name]') + const tab = dashboardContainer.querySelector(`[data-global-pane-name="${options.pane}"]`) || + dashboardContainer.querySelector('[data-global-pane-name]') if (tab) { tab.click() return
Renaming data-attribute per Vincent's suggestion
solid_solid-panes
train
js
37566c42893a41828ab8c541874ef24030e23724
diff --git a/src/Controller.js b/src/Controller.js index <HASH>..<HASH> 100644 --- a/src/Controller.js +++ b/src/Controller.js @@ -121,9 +121,9 @@ class Controller extends EventEmitter { const pathArray = ensurePath(path) const signalKey = pathArray.pop() const module = pathArray.reduce((currentModule, key) => { - return currentModule.modules[key] + return currentModule ? currentModule.modules[key] : undefined }, this.module) - const signal = module.signals[signalKey] + const signal = module && module.signals[signalKey] if (!signal) { throwError(`There is no signal at path "${path}"`)
fix(Controller): throw error when wrong signal path
cerebral_cerebral
train
js
82e12cffd241d05f805387897cfce0427c701248
diff --git a/src/compatibility/date.js b/src/compatibility/date.js index <HASH>..<HASH> 100644 --- a/src/compatibility/date.js +++ b/src/compatibility/date.js @@ -180,7 +180,7 @@ function _gpfInstallCompatibleDate () { shortDateAsString; try { longDateAsString = _gpfDateToISOString(new Date(_GPF_COMPATIBILITY_DATE_ISO_TEST)); - shortDateAsString = _gpfDateToISOString(new Date()); + shortDateAsString = _gpfDateToISOString(new Date(_GPF_COMPATIBILITY_DATE_SHORT_TEST)); } catch (e) {} //eslint-disable-line no-empty if (longDateAsString !== _GPF_COMPATIBILITY_DATE_ISO_TEST || shortDateAsString !== _GPF_COMPATIBILITY_DATE_SHORT_TEST + "T00:00:00.000Z") {
Fixing invalid condition (#<I>)
ArnaudBuchholz_gpf-js
train
js
8fd410ad31f85ffa98d5bbcbf2229e732d9594a2
diff --git a/tests/test_workspacebuilder.py b/tests/test_workspacebuilder.py index <HASH>..<HASH> 100644 --- a/tests/test_workspacebuilder.py +++ b/tests/test_workspacebuilder.py @@ -293,15 +293,16 @@ def test_window_options_after(session): def assert_last_line(p, s): correct = False - for _ in range(10): + timeout = time.time() + 5 # 5 second timeout + while True: pane_out = p.cmd('capture-pane', '-p', '-J').stdout while not pane_out[-1].strip(): # delete trailing lines tmux 1.8 pane_out.pop() if len(pane_out) > 1 and pane_out[-2].strip() == s: correct = True break - - time.sleep(0.1) + elif time.time() > timeout: + break # Print output for easier debugging if assertion fails if not correct:
try to improve reliability of test_window_options_after in CI
tmux-python_tmuxp
train
py
d124700503f502bac2b130557861d07fc72fe1b2
diff --git a/tests/template.py b/tests/template.py index <HASH>..<HASH> 100644 --- a/tests/template.py +++ b/tests/template.py @@ -2,7 +2,7 @@ # Copyright (C) 2015 - 2017 Satoru SATOH <ssato @ redhat.com> # License: MIT # -# pylint: disable=missing-docstring, unused-variable +# pylint: disable=missing-docstring, unused-variable, invalid-name import os.path import os import unittest
fix: disable pylint: invalid-name check
ssato_python-anyconfig
train
py
e31bba190b554cfdbab0391def7ef7a5bb8b6045
diff --git a/src/Controller/InstallerController.php b/src/Controller/InstallerController.php index <HASH>..<HASH> 100755 --- a/src/Controller/InstallerController.php +++ b/src/Controller/InstallerController.php @@ -1107,7 +1107,11 @@ class InstallerController extends AbstractActionController // load site module in installer if (!$this->isUsingCoreOnly()) { $siteConfiguration = isset($container['site_module']) ? $container['site_module'] : null; - array_push($modules, 'MelisEngine', 'MelisFront'); + + if (!in_array('MelisEngine', $modules)) + array_push($modules, 'MelisEngine'); + if (!in_array('MelisFront', $modules)) + array_push($modules,'MelisFront'); // if (in_array($siteConfiguration['site'], ['NewSite', 'None'])) { // array_push($modules, getenv('MELIS_MODULE'));
would now check for engine and front modules before adding them to the list
melisplatform_melis-installer
train
php
b805fdff922fa360e8edc5817cd36f29d5f604ec
diff --git a/src/Providers/FoundationServiceProvider.php b/src/Providers/FoundationServiceProvider.php index <HASH>..<HASH> 100644 --- a/src/Providers/FoundationServiceProvider.php +++ b/src/Providers/FoundationServiceProvider.php @@ -123,7 +123,7 @@ class FoundationServiceProvider extends ServiceProvider $this->loadViewsFrom(__DIR__.'/../../resources/views', 'cortex/foundation'); $this->loadTranslationsFrom(__DIR__.'/../../resources/lang', 'cortex/foundation'); - $this->app->runningInConsole() || $dispatcher->listen('controller.constructed', function ($accessarea) { + $this->app->runningInConsole() || $dispatcher->listen('accessarea.ready', function ($accessarea) { ! file_exists($menus = __DIR__."/../../routes/menus/{$accessarea}.php") || require $menus; ! file_exists($breadcrumbs = __DIR__."/../../routes/breadcrumbs/{$accessarea}.php") || require $breadcrumbs; });
Update menus & breadcrumbs event listener to accessarea.ready
rinvex_cortex-foundation
train
php
1a3bda947993ee7c505116ff4bb4d4ca9caa5506
diff --git a/richtextfx/src/main/java/org/fxmisc/richtext/model/ReadOnlyStyledDocument.java b/richtextfx/src/main/java/org/fxmisc/richtext/model/ReadOnlyStyledDocument.java index <HASH>..<HASH> 100644 --- a/richtextfx/src/main/java/org/fxmisc/richtext/model/ReadOnlyStyledDocument.java +++ b/richtextfx/src/main/java/org/fxmisc/richtext/model/ReadOnlyStyledDocument.java @@ -127,6 +127,9 @@ public final class ReadOnlyStyledDocument<PS, SEG, S> implements StyledDocument< * @param <S> The type of the style of individual segments. */ public static <PS, SEG, S> ReadOnlyStyledDocument<PS, SEG, S> fromSegment(SEG segment, PS paragraphStyle, S style, SegmentOps<SEG, S> segmentOps) { + if ( segment instanceof String && segmentOps instanceof TextOps ) { + return fromString( (String) segment, paragraphStyle, style, (TextOps<SEG,S>) segmentOps ); + } Paragraph<PS, SEG, S> content = new Paragraph<PS, SEG, S>(paragraphStyle, segmentOps, segment, style); List<Paragraph<PS, SEG, S>> res = Collections.singletonList(content); return new ReadOnlyStyledDocument<>(res);
Fix multi paragraph insert creation (#<I>)
FXMisc_RichTextFX
train
java
2c6bae253a9908480df577aeead9579c7cf75a0b
diff --git a/stdlib/native.rb b/stdlib/native.rb index <HASH>..<HASH> 100644 --- a/stdlib/native.rb +++ b/stdlib/native.rb @@ -335,9 +335,7 @@ class Native::Array `#@native[#@length]` end - def to_ary - self - end + alias to_ary to_a def inspect to_a.inspect
Alias Native::Array#to_ary to #to_a
opal_opal
train
rb
1c1f0ffc2b07bc73d7b83138160e5d93b388a364
diff --git a/kya/cli.py b/kya/cli.py index <HASH>..<HASH> 100644 --- a/kya/cli.py +++ b/kya/cli.py @@ -7,7 +7,14 @@ from quamash import QEventLoop from .app import Kya [email protected](invoke_without_command=True) +CONTEXT_SETTINGS = { + 'help_option_names': ['-h', '--help'] +} + + [email protected](invoke_without_command=True, + context_settings=CONTEXT_SETTINGS + ) @click.pass_context def cli(ctx): ctx.obj = QApplication([])
cli: allow -h for help
jck_kya
train
py
fe04b8f00f0241b6e3662720bd8d77a797a1a418
diff --git a/lib/git-hooks-helper/hook.rb b/lib/git-hooks-helper/hook.rb index <HASH>..<HASH> 100644 --- a/lib/git-hooks-helper/hook.rb +++ b/lib/git-hooks-helper/hook.rb @@ -139,7 +139,7 @@ module GitHooksHelper def check_best_practices each_changed_file([:rb, :erb, :haml]) do |file| - Open3.popen3("rails_best_practices --spec --test #{file}") do |stdin, stdout, stderr| + Open3.popen3("rails_best_practices --spec --test -o #{file}") do |stdin, stdout, stderr| @result.warn(stdout.read.split("\n").map do |line| if line =~ /#{file}/ line.gsub(COLOR_REGEXP, '').strip
Fix: rails best practices corret usage
MartynasM_git-hooks-helper
train
rb
11b11a855dec5f20f6a79ba226f007b27aa8475b
diff --git a/mopidy_musicbox_webclient/static/js/gui.js b/mopidy_musicbox_webclient/static/js/gui.js index <HASH>..<HASH> 100644 --- a/mopidy_musicbox_webclient/static/js/gui.js +++ b/mopidy_musicbox_webclient/static/js/gui.js @@ -509,8 +509,10 @@ $(document).ready(function(event) { $(document).keypress( function (event) { //console.log('kp: '+event); if (event.target.tagName != 'INPUT') { - switch(event.which) { - case 32: + var unicode=event.keyCode? event.keyCode : event.charCode; + var actualkey=String.fromCharCode(unicode); + switch(actualkey) { + case ' ': doPlay(); event.preventDefault(); break;
Translate unicode keys to actual characters to ensure better handling of shortcut keys.
pimusicbox_mopidy-musicbox-webclient
train
js
b9f34a18f5a6d875433d5068dd48e1321273c650
diff --git a/kafka_producer.go b/kafka_producer.go index <HASH>..<HASH> 100644 --- a/kafka_producer.go +++ b/kafka_producer.go @@ -206,7 +206,10 @@ func ProducerConfigFromFile(filename string) (*ProducerConfig, error) { return nil, err } - setStringsConfig(&producerConfig.BrokerList, c["metadata.broker.list"]) + setStringsConfig(&producerConfig.BrokerList, c["bootstrap.servers"]) + if len(producerConfig.BrokerList) == 0 { + setStringsConfig(&producerConfig.BrokerList, c["metadata.broker.list"]) + } return producerConfig, nil }
Read broker list from bootstrap.servers. Optional from metadata.broker.list
elodina_siesta
train
go
13dfd46757f20f6c7b403b1873fc2793f31132a6
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -9,7 +9,7 @@ setup( author='happyleaves', author_email='[email protected]', packages=['firetv'], - install_requires=['adb>=1.1.0'], + install_requires=['https://github.com/JeffLIrion/python-adb/zipball/master#adb==1.3.0.dev'], extras_require={ 'firetv-server': ['Flask>=0.10.1', 'PyYAML>=3.12'] },
Pin adb requirement Pinning adb requirement to <I>dev from git.
happyleavesaoc_python-firetv
train
py
6e66b11f6e5f26af1db1a7a45bf41e159a2185d1
diff --git a/lib/mongo/gridfs/grid_io.rb b/lib/mongo/gridfs/grid_io.rb index <HASH>..<HASH> 100644 --- a/lib/mongo/gridfs/grid_io.rb +++ b/lib/mongo/gridfs/grid_io.rb @@ -251,8 +251,9 @@ module Mongo # @return [Mongo::GridIO] self def each return read_all unless block_given? - while chunk = read(chunk_size) + while chunk = read(chunk_size) yield chunk + break if chunk.empty? end self end
fix: reading chunks from an empty (zero-length) grid-stored file reading chunks from an empty file caused an endless loop
mongodb_mongo-ruby-driver
train
rb
59a757120314989a72d6c63e89b38a22b89cf804
diff --git a/src/EtherscanAPIConf.php b/src/EtherscanAPIConf.php index <HASH>..<HASH> 100644 --- a/src/EtherscanAPIConf.php +++ b/src/EtherscanAPIConf.php @@ -23,15 +23,23 @@ class EtherscanAPIConf { /** * Returns API basic URL. * - * @param string $net Mainnet - if null, or testnet if provided. + * @param string $net if null then return Mainnet. Otherwise return url / testnet if provided. * * @return string */ public static function getAPIUrl($net = null) { + + // If $net is null return default mainnet url if (is_null($net)) { return self::API_URL; } - + + // If $net is valid URL then return + if (filter_var($net, FILTER_VALIDATE_URL)) { + return $net; + } + + // Otherwise treat $net as testnet name return "https://{$net}.etherscan.io/api"; }
Added full url alternative to getAPIUrl() Added additional if statement to check if $net contains valid URL if so then function returns $net. This allows the ability to point etherscan API mirrors / clones in the event that etherscan site isn't accessible.
dzarezenko_etherscan-api
train
php
6b014a7eb3d43b2ebc92b03c6f6918910aaac887
diff --git a/synth.py b/synth.py index <HASH>..<HASH> 100644 --- a/synth.py +++ b/synth.py @@ -2,6 +2,9 @@ import synthtool as s import synthtool.gcp as gcp import logging logging.basicConfig(level=logging.DEBUG) + +AUTOSYNTH_MULTIPLE_COMMITS = True + common_templates = gcp.CommonTemplates() templates = common_templates.node_library(source_location='out/src') s.copy(templates, excludes=['README.md'])
build: set AUTOSYNTH_MULTIPLE_COMMITS=true for context aware commits (#<I>)
googleapis_cloud-profiler-nodejs
train
py
a84804278f62af9bf4ca14bc6ddc24410a2d03fa
diff --git a/tests/test_api.py b/tests/test_api.py index <HASH>..<HASH> 100644 --- a/tests/test_api.py +++ b/tests/test_api.py @@ -15,6 +15,15 @@ url = 'http://127.0.0.1:5000' + api.base_url valid_response = [403, 200] # TODO - set to 200 after user login works class TestApi(unittest.TestCase): + def setUp(self): + unittest.TestCase.setUp(self) + # import aikif.api_main as api + # api.app.run(debug=True) + # Not a good idea - starts server but cant terminate easily + + def tearDown(self): + unittest.TestCase.tearDown(self) + #api.app = None def test_01_server_on(self): try:
trying starting API from tests but not the best idea - cant stop it easily
acutesoftware_AIKIF
train
py
ab3a596333fa7110c99afaefba142873a0a432b0
diff --git a/driver/src/test/java/org/neo4j/driver/v1/util/cc/ClusterExtension.java b/driver/src/test/java/org/neo4j/driver/v1/util/cc/ClusterExtension.java index <HASH>..<HASH> 100644 --- a/driver/src/test/java/org/neo4j/driver/v1/util/cc/ClusterExtension.java +++ b/driver/src/test/java/org/neo4j/driver/v1/util/cc/ClusterExtension.java @@ -126,7 +126,7 @@ public class ClusterExtension implements BeforeAllCallback, AfterEachCallback, A { String[] split = Neo4jRunner.NEOCTRL_ARGS.split( "\\s+" ); String version = split[split.length - 1]; - ServerVersion serverVersion = ServerVersion.version( version ); + ServerVersion serverVersion = ServerVersion.version( "Neo4j/" + version ); assumeTrue( CAUSAL_CLUSTER.availableIn( serverVersion ), "Server version `" + version + "` does not support Casual Cluster" ); return version; }
Parse version from NEOCTRL_ARGS
neo4j_neo4j-java-driver
train
java
b4ad600657d08a6da1be2a38449bbed9138da840
diff --git a/pyemu/en.py b/pyemu/en.py index <HASH>..<HASH> 100644 --- a/pyemu/en.py +++ b/pyemu/en.py @@ -1086,7 +1086,14 @@ class ParameterEnsemble(Ensemble): print("eigen solve for full cov") v, w = np.linalg.eigh(cov.as_2d) #w, v, other = np.linalg.svd(cov.as_2d,full_matrices=True,compute_uv=True) - + # vdiag = np.diag(v) + for i in range(v.shape[0]): + if v[i] > 1.0e-10: + pass + else: + print("near zero eigen value found", v[i], \ + "at index", i, " of ", v.shape[0]) + v[i] = 0.0 # form projection matrix print("form projection") a = np.dot(w, np.sqrt(np.diag(v)))
added patch for numerically small or neg eigen values in from gaussian draw
jtwhite79_pyemu
train
py
2a4b354f78b539d68bd6dfc2aeed65a757f5e891
diff --git a/publishable/database/seeds/CategoriesTableSeeder.php b/publishable/database/seeds/CategoriesTableSeeder.php index <HASH>..<HASH> 100644 --- a/publishable/database/seeds/CategoriesTableSeeder.php +++ b/publishable/database/seeds/CategoriesTableSeeder.php @@ -16,7 +16,7 @@ class CategoriesTableSeeder extends Seeder \DB::table('categories')->insert([ 0 => [ 'id' => 1, - 'parent_id' => 0, + 'parent_id' => null, 'order' => 1, 'name' => 'Category 1', 'slug' => 'category-1', @@ -25,7 +25,7 @@ class CategoriesTableSeeder extends Seeder ], 1 => [ 'id' => 2, - 'parent_id' => 0, + 'parent_id' => null, 'order' => 1, 'name' => 'Category 2', 'slug' => 'category-2',
Changing 0 to null for Category seeder (#<I>)
the-control-group_voyager
train
php
e2d58eb4870b9e01c34cac90b336a3575f71751d
diff --git a/thinc/backends/jax_ops.py b/thinc/backends/jax_ops.py index <HASH>..<HASH> 100644 --- a/thinc/backends/jax_ops.py +++ b/thinc/backends/jax_ops.py @@ -22,6 +22,12 @@ class JaxOps(Ops): def as_contig(self, data: ArrayT, dtype: Optional[DTypes] = None) -> ArrayT: return data if dtype is None else data.astype(dtype) + def to_numpy(self, data): + if isinstance(data, numpy.ndarray): + return data + else: + return jax.device_get(data) + def seq2col(self, seq: ArrayT, nW: int) -> ArrayT: """Given an (M, N) sequence of vectors, return an (M, N*(nW*2+1)) sequence. The new sequence is constructed by concatenating nW preceding
Add to_numpy for jax
explosion_thinc
train
py
6314dd2a4ef9bc4a27724d4724f86ceac2f1f04d
diff --git a/jbpm-services/jbpm-kie-services/src/main/java/org/jbpm/kie/services/impl/ProcessServiceImpl.java b/jbpm-services/jbpm-kie-services/src/main/java/org/jbpm/kie/services/impl/ProcessServiceImpl.java index <HASH>..<HASH> 100644 --- a/jbpm-services/jbpm-kie-services/src/main/java/org/jbpm/kie/services/impl/ProcessServiceImpl.java +++ b/jbpm-services/jbpm-kie-services/src/main/java/org/jbpm/kie/services/impl/ProcessServiceImpl.java @@ -615,7 +615,7 @@ public class ProcessServiceImpl implements ProcessService, VariablesAware { RuntimeEngine engine = manager.getRuntimeEngine(ProcessInstanceIdContext.get(processInstanceId)); try { KieSession ksession = engine.getKieSession(); - ProcessInstance processInstance = ksession.getProcessInstance(processInstanceId); + ProcessInstance processInstance = ksession.getProcessInstance(processInstanceId, true); Collection<String> activeSignals = new ArrayList<>(); if (processInstance != null) {
[JBPM-<I>] ProcessServiceImpl.getAvailableSignals should obtain ProcessInstance in read-only mode to avoid race condition
kiegroup_jbpm
train
java
33ddf69629c1bcea76b04f4a4e9e00e4cce82eb6
diff --git a/map_test.go b/map_test.go index <HASH>..<HASH> 100644 --- a/map_test.go +++ b/map_test.go @@ -113,12 +113,12 @@ func TestMapManyKeys (t *testing.T) { } if m.Size() != 100 { - t.Errorf("Wrong number of keys", m.Size()) + t.Errorf("Wrong number of keys: %d", m.Size()) } m = m.Delete("42").Delete("7").Delete("19").Delete("99") if m.Size() != 96 { - t.Errorf("Wrong number of keys", m.Size()) + t.Errorf("Wrong number of keys: %d", m.Size()) } for i:=43; i<99; i++ {
Fix error messages Thanks to `go vet` for finding these problems
mndrix_ps
train
go
75c5e23a7cf3af12c2fc87e95ebcee40f14c809e
diff --git a/tests/library/CM/File/ImageTest.php b/tests/library/CM/File/ImageTest.php index <HASH>..<HASH> 100644 --- a/tests/library/CM/File/ImageTest.php +++ b/tests/library/CM/File/ImageTest.php @@ -132,4 +132,15 @@ class CM_File_ImageTest extends CMTest_TestCase { $this->assertSame($sizeExpected, $imageNew->getWidth()); $this->assertSame($sizeExpected, $imageNew->getHeight()); } + + public function testResizeFileSize() { + $path = DIR_TEST_DATA . 'img/test.jpg'; + $pathNew = '/tmp/' . uniqid(); + $image = new CM_File_Image($path); + $this->assertEquals(17661, $image->getSize(), '', 300); + + $image->resize(100, 100, null, $pathNew); + $imageNew = new CM_File_Image($pathNew); + $this->assertEquals(2627, $imageNew->getSize(), '', 300); + } }
Add test to assert resized imaged file size
cargomedia_cm
train
php
2ad6180b8948e4b692dd5bf6ea45c257df352020
diff --git a/lib/Less/Parser.php b/lib/Less/Parser.php index <HASH>..<HASH> 100755 --- a/lib/Less/Parser.php +++ b/lib/Less/Parser.php @@ -145,7 +145,6 @@ class Less_Parser extends Less_Cache{ $return = null; if( $returnRoot ){ $rules = $this->GetRules( $filename ); - self::ReleaseMemory(); $return = new Less_Tree_Ruleset(array(), $rules ); }else{ $this->_parse( $filename ); @@ -221,7 +220,6 @@ class Less_Parser extends Less_Cache{ private function _parse( $file_path = false ){ $this->rules = array_merge($this->rules, $this->GetRules( $file_path )); - self::ReleaseMemory(); }
too many calls to releaseMemory()
oyejorge_less.php
train
php
7f2325cc10d2931af412e4d7a1f8b8ea7bfcf88d
diff --git a/lib/svtplay_dl/__init__.py b/lib/svtplay_dl/__init__.py index <HASH>..<HASH> 100644 --- a/lib/svtplay_dl/__init__.py +++ b/lib/svtplay_dl/__init__.py @@ -318,7 +318,7 @@ def main(): parser.add_option("--all-last", dest="all_last", default=-1, type=int, metavar="NN", help="get last NN episodes instead of all episodes") parser.add_option("-P", "--preferred", default=None, - metavar="preferred", help="preferred download method (rtmp, hls or hds)") + metavar="preferred", help="preferred download method (hls, hds, http or rtmp") parser.add_option("--exclude", dest="exclude", default=None, metavar="WORD1,WORD2,...", help="exclude videos with the WORD(s) in the filename. comma separated.") parser.add_option("-g", "--get-url",
main: show which order we preferred download method
spaam_svtplay-dl
train
py
37a1e330f67c74773fe549dacd5851c323896347
diff --git a/src/django_future/__init__.py b/src/django_future/__init__.py index <HASH>..<HASH> 100644 --- a/src/django_future/__init__.py +++ b/src/django_future/__init__.py @@ -60,12 +60,12 @@ def run_jobs(delete_completed=False, ignore_errors=False, now=None): raise ValueError('jobs in progress found; aborting') if now is None: now = datetime.datetime.now() + # Expire jobs. expired_jobs = ScheduledJob.objects.filter(status='scheduled', time_slot_end__lt=now) - for job in expired_jobs: - job.status = 'expired' - job.save() + expired_jobs.update(status='expired') + # Get scheduled jobs. jobs = ScheduledJob.objects.filter(status='scheduled', time_slot_start__lte=now)
Expire jobs in one SQL statement.
shrubberysoft_django-future
train
py
c439eb1fb25a1bb5201b98526474f0879861586e
diff --git a/redis/doc.go b/redis/doc.go index <HASH>..<HASH> 100644 --- a/redis/doc.go +++ b/redis/doc.go @@ -38,7 +38,7 @@ // // n, err := conn.Do("APPEND", "key", "value") // -// The Do method converts command arguments to binary strings for transmission +// The Do method converts command arguments to bulk strings for transmission // to the server as follows: // // Go Type Conversion
Fix typo in documentation Bulk strings, not binary strings.
gomodule_redigo
train
go
b5b4cbdf00f10c5eb9c74414ad4dfa4662c3aa96
diff --git a/lib/motion/project/cocoapods.rb b/lib/motion/project/cocoapods.rb index <HASH>..<HASH> 100644 --- a/lib/motion/project/cocoapods.rb +++ b/lib/motion/project/cocoapods.rb @@ -137,7 +137,7 @@ module Motion::Project if framework_search_paths framework_search_paths.scan(/\"([^\"]+)\"/) do |search_path| path = search_path.first.gsub!(/(\$\(PODS_ROOT\))|(\$\{PODS_ROOT\})/, "#{@config.project_dir}/#{PODS_ROOT}") - @config.framework_search_paths << path + @config.framework_search_paths << path if path end end
[fix #<I>] should not pass nil into framework_search_paths
HipByte_motion-cocoapods
train
rb
6bba2e8fb851e49441915a6cb7d33bf982ec761d
diff --git a/src/livestreamer/stream/hds.py b/src/livestreamer/stream/hds.py index <HASH>..<HASH> 100644 --- a/src/livestreamer/stream/hds.py +++ b/src/livestreamer/stream/hds.py @@ -699,7 +699,11 @@ class HDSStream(Stream): @classmethod def _pv_params(cls, pvswf, pv): - """Returns any parameters needed for Akamai HD player verification""" + """Returns any parameters needed for Akamai HD player verification. + + Algorithm originally documented by KSV, source: + http://stream-recorder.com/forum/showpost.php?p=43761&postcount=13 + """ (data, hdntl) = pv.split(";") cache = Cache(filename="stream.json")
stream.hds: Give KSV credit for documenting the PV algorithm.
streamlink_streamlink
train
py
81672ba8d1d34e92953934ccab4be77c6c678671
diff --git a/src/Illuminate/Console/Events/CommandFinished.php b/src/Illuminate/Console/Events/CommandFinished.php index <HASH>..<HASH> 100644 --- a/src/Illuminate/Console/Events/CommandFinished.php +++ b/src/Illuminate/Console/Events/CommandFinished.php @@ -26,7 +26,7 @@ class CommandFinished * * @var \Symfony\Component\Console\Output\OutputInterface|null */ - protected $output; + public $output; /** * The command exit code. diff --git a/src/Illuminate/Console/Events/CommandStarting.php b/src/Illuminate/Console/Events/CommandStarting.php index <HASH>..<HASH> 100644 --- a/src/Illuminate/Console/Events/CommandStarting.php +++ b/src/Illuminate/Console/Events/CommandStarting.php @@ -26,7 +26,7 @@ class CommandStarting * * @var \Symfony\Component\Console\Output\OutputInterface|null */ - protected $output; + public $output; /** * Create a new event instance.
Updates output property visibity on artisan command events (#<I>)
laravel_framework
train
php,php
bec29befe238523ae0feff9058f6a187800ba3ad
diff --git a/acceptance/tests/modules/install/ignoring_dependencies.rb b/acceptance/tests/modules/install/ignoring_dependencies.rb index <HASH>..<HASH> 100644 --- a/acceptance/tests/modules/install/ignoring_dependencies.rb +++ b/acceptance/tests/modules/install/ignoring_dependencies.rb @@ -3,12 +3,12 @@ test_name "puppet module install (ignoring dependencies)" step 'Setup' stub_forge_on(master) +on master, "mkdir -p #{master['distmoduledir']}" +on master, "mkdir -p #{master['sitemoduledir']}" teardown do on master, "rm -rf #{master['distmoduledir']}/java" on master, "rm -rf #{master['distmoduledir']}/stdlib" - on master, "rm -rf #{master['sitemoduledir']}/java" - on master, "rm -rf #{master['sitemoduledir']}/stdlib" end step "Install a module, but ignore dependencies"
do not delete PEs stdlib
puppetlabs_puppet
train
rb
69410e4ae254e87665d462fe72387120edebe2ff
diff --git a/intranet/apps/eighth/views/admin/sponsors.py b/intranet/apps/eighth/views/admin/sponsors.py index <HASH>..<HASH> 100644 --- a/intranet/apps/eighth/views/admin/sponsors.py +++ b/intranet/apps/eighth/views/admin/sponsors.py @@ -2,6 +2,7 @@ import pickle import csv +import re from collections import defaultdict @@ -63,7 +64,7 @@ def list_sponsor_view(request): if get_csv: response = http.HttpResponse(content_type="text/csv") - response['Content-Disposition'] = 'attachment; filename="sponsor_list.csv"' + response['Content-Disposition'] = 'attachment; filename="sponsor_list_{}{}.csv"'.format(block.date.strftime("%Y%m%d"), re.sub(r'\W+', '', block.block_letter)) writer = csv.writer(response) writer.writerow(["Sponsor", "Activity", "Room", "Eighth Contracted"]) for row in context["sponsor_list"]:
add block time and letter to filename
tjcsl_ion
train
py
1b4353bd4796e86b07ae78bd2e0dafe0da32ab84
diff --git a/multiselectfield/validators.py b/multiselectfield/validators.py index <HASH>..<HASH> 100644 --- a/multiselectfield/validators.py +++ b/multiselectfield/validators.py @@ -16,7 +16,7 @@ from django.core import validators -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ class MaxValueMultiFieldValidator(validators.MaxLengthValidator):
Update lazy translation import (#<I>) `ugettext_lazy` is deprecated as of Django <I> (to be removed in Django <I>)
goinnn_django-multiselectfield
train
py
3cbaf573e99c86390025cb5bf5e026c7a29d3a73
diff --git a/fut/pin.py b/fut/pin.py index <HASH>..<HASH> 100644 --- a/fut/pin.py +++ b/fut/pin.py @@ -49,7 +49,7 @@ class Pin(object): self.r.headers['x-ea-game-id-type'] = self.tidt self.r.headers['x-ea-taxv'] = self.taxv - self.custom = {"networkAccess": "G"} # wifi? + self.custom = {"networkAccess": "W"} # wifi? # TODO?: full boot process when there is no session (boot start) self.custom['service_plat'] = platform[:3]
pin: change back to W - were firefox and this is how firefox works
futapi_fut
train
py