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
22c00fe5bc770d7501b671ea0f2b10192126498b
diff --git a/AllTestsIntegration.php b/AllTestsIntegration.php index <HASH>..<HASH> 100644 --- a/AllTestsIntegration.php +++ b/AllTestsIntegration.php @@ -13,5 +13,5 @@ class AllTestsIntegration extends AllTestsRunner { /** @var array Default test suites */ - protected static $_aTestSuites = array('integration', 'Integration'); + protected static $testSuites = array('integration', 'Integration'); }
PR-<I> Rename $_aTestSuites to $testSuites for Integration suite Related #<I>
OXID-eSales_testing_library
train
php
05086e5fca438a68f5ef245b8908e40cebf3618c
diff --git a/src/module-elasticsuite-core/Search/Request/Aggregation/AggregationBuilder.php b/src/module-elasticsuite-core/Search/Request/Aggregation/AggregationBuilder.php index <HASH>..<HASH> 100644 --- a/src/module-elasticsuite-core/Search/Request/Aggregation/AggregationBuilder.php +++ b/src/module-elasticsuite-core/Search/Request/Aggregation/AggregationBuilder.php @@ -140,7 +140,7 @@ class AggregationBuilder $bucketParams = [ 'field' => $bucketField, - 'name' => $field->getName(), + 'name' => isset($aggregationParams['config']['name']) ? $aggregationParams['config']['name'] : $field->getName(), 'filter' => array_diff_key($filters, [$field->getName() => true]), ];
Better handling of aggregation names.
Smile-SA_elasticsuite
train
php
bef35a96409448ca1162d18b883ee39ef6bb62fb
diff --git a/views/js/layout/tree.js b/views/js/layout/tree.js index <HASH>..<HASH> 100644 --- a/views/js/layout/tree.js +++ b/views/js/layout/tree.js @@ -635,7 +635,8 @@ define([ * @returns {undefined} */ function executePossibleAction(actions, context, exclude) { - var possibleActions; + var possibleActions, + self = this; if (!_.isArray(exclude)) { exclude = []; } @@ -649,9 +650,13 @@ define([ }); //execute the first allowed action if(possibleActions.length > 0){ + //hide shown earlier message + if (self.permissionErrorMessage) { + self.permissionErrorMessage.close(); + } actionManager.exec(possibleActions[0], context); } else { - feedback().error(__("You don't have sufficient permissions to access")); + self.permissionErrorMessage = feedback().error(__("You don't have sufficient permissions to access")); } }
Hide error message after the allowed item has been selected
oat-sa_tao-core
train
js
043d3b2dd4ca2dea9c64eccfac9ec5af1e856c7c
diff --git a/associations/belongs_to_association_test.go b/associations/belongs_to_association_test.go index <HASH>..<HASH> 100644 --- a/associations/belongs_to_association_test.go +++ b/associations/belongs_to_association_test.go @@ -12,8 +12,7 @@ import ( ) type fooBelongsTo struct { - ID uuid.UUID `db:"id"` - NestedBars []nestedBar `has_many:"nested_bars"` + ID uuid.UUID `db:"id"` } func (f fooBelongsTo) TableName() string { @@ -25,18 +24,13 @@ type barBelongsTo struct { Foo fooBelongsTo `belongs_to:"foo"` } -type nestedBar struct { - ID uuid.UUID `db:"id"` - FooID uuid.UUID `db:"foo_id"` -} - func Test_Belongs_To_Association(t *testing.T) { a := require.New(t) id, _ := uuid.NewV1() bar := barBelongsTo{FooID: id} - as, err := associations.AssociationsForStruct(&bar, "Foo.NestedBars") + as, err := associations.AssociationsForStruct(&bar, "Foo") a.NoError(err) a.Equal(len(as), 1) a.Equal(reflect.Struct, as[0].Kind())
Removes nested association from belongs_to_association tests
gobuffalo_pop
train
go
435556663030c166a08d1b2a0b9168e251b6ef2d
diff --git a/openpnm/materials/BundleOfTubes.py b/openpnm/materials/BundleOfTubes.py index <HASH>..<HASH> 100644 --- a/openpnm/materials/BundleOfTubes.py +++ b/openpnm/materials/BundleOfTubes.py @@ -96,8 +96,15 @@ class BundleOfTubes(Project): geom.add_model(propname='pore.diameter', model=mods.geometry.pore_size.from_neighbor_throats, throat_prop='throat.diameter', mode='max') + geom.add_model(propname='pore.diameter', + model=mods.misc.constant, value=0.0) geom.add_model(propname='throat.length', - model=mods.geometry.throat_length.classic) + model=mods.geometry.throat_length.ctc) + geom.add_model(propname='throat.area', + model=mods.geometry.throat_area.cylinder) + geom.add_model(propname='pore.area', + model=mods.misc.from_neighbor_throats, + throat_prop='throat.area') geom.add_model(propname='pore.volume', model=mods.misc.constant, value=0.0) geom.add_model(propname='throat.volume',
Adding necessary pore-scale models...now algs work
PMEAL_OpenPNM
train
py
1017caeb725de9778faed7fe521bfe3397f2fca9
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -48,9 +48,9 @@ setup( 'Programming Language :: Python :: 3.7', 'Programming Language :: Python :: 3.8', 'Programming Language :: Python :: 3.9', - # 'Programming Language :: Python :: 3.10', # invalid in PyPI yet. + 'Programming Language :: Python :: 3.10', ], - keywords='python track tracker time code blocks statistics analytics'.split(), + keywords='python track tracker time code blocks monitor statistics analytics'.split(), packages=find_packages(), data_files=[('', ['LICENSE'])], install_requires=[],
include python <I>
rsalmei_about-time
train
py
c6a2ddd0b52809009e6462714ac0a89fcc235499
diff --git a/test/integration/client-side-encryption/client_side_encryption.prose.test.js b/test/integration/client-side-encryption/client_side_encryption.prose.test.js index <HASH>..<HASH> 100644 --- a/test/integration/client-side-encryption/client_side_encryption.prose.test.js +++ b/test/integration/client-side-encryption/client_side_encryption.prose.test.js @@ -931,7 +931,6 @@ describe('Client Side Encryption Prose Tests', metadata, function () { }, succeed: false, errorValidator: err => { - // TODO(NODE-4162): aws region test should only check if an error is thrown expect(err).to.be.an.instanceOf(Error); } },
chore(NODE-<I>): removed TODO (#<I>)
mongodb_node-mongodb-native
train
js
aba1bfef3749ceaaddbac060b641770732befb00
diff --git a/rados/ioctx.go b/rados/ioctx.go index <HASH>..<HASH> 100644 --- a/rados/ioctx.go +++ b/rados/ioctx.go @@ -205,10 +205,10 @@ func (ioctx *IOContext) Read(oid string, data []byte, offset uint64) (int, error // Delete deletes the object with key oid. It returns an error, if any. func (ioctx *IOContext) Delete(oid string) error { - c_oid := C.CString(oid) - defer C.free(unsafe.Pointer(c_oid)) + coid := C.CString(oid) + defer C.free(unsafe.Pointer(coid)) - return getError(C.rados_remove(ioctx.ioctx, c_oid)) + return getError(C.rados_remove(ioctx.ioctx, coid)) } // Truncate resizes the object with key oid to size size. If the operation
rados: naming conventions: fixes in Delete function Fix up variable names that don't meet Go standards.
ceph_go-ceph
train
go
e5db4be248127162902cac1e9e9670d85d49f423
diff --git a/lib/plugins/crawler/index.js b/lib/plugins/crawler/index.js index <HASH>..<HASH> 100644 --- a/lib/plugins/crawler/index.js +++ b/lib/plugins/crawler/index.js @@ -54,12 +54,12 @@ module.exports = { } else if (message.url === url) { log.verbose('Crawler skipping initial URL %s', url); } else if (pageMimeType.test(queueItem.stateData.contentType)) { - log.verbose('Crawler found URL %s', url); + log.verbose('Crawler found %s URL %s', pageCount, url); queue.postMessage(make('url', {}, {url, group: message.group})); pageCount++; if (pageCount >= maxPages) { - log.verbose('Crawler stopped after %d urls', pageCount); + log.info('Crawler stopped after %d urls', pageCount); crawler.stop(); return resolve(); } @@ -70,7 +70,7 @@ module.exports = { crawler.on('complete', resolve); - log.debug('Starting to crawl from ' + message.url + ' with max depth ' + crawler.depth + + log.info('Starting to crawl from ' + message.url + ' with max depth ' + crawler.maxDepth + ' and max count ' + maxPages); crawler.start(); })
info log crawler setup and when we stop
sitespeedio_sitespeed.io
train
js
ccd334259275fab9ffdd44a8c1cee8afaefa9882
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -50,7 +50,7 @@ setup( data_files=[( (BASE_DIR, ['data/nssm_original.exe']) )], - install_requires=['indy-plenum==1.10.0.dev902', + install_requires=['indy-plenum==1.10.0.dev904', 'timeout-decorator==0.4.0', 'distro==1.3.0'], setup_requires=['pytest-runner'],
ST-<I> -- Add some more logs
hyperledger_indy-node
train
py
fbe5aaaae8405d19dc1bf691c5bead6348c6da10
diff --git a/lib/did_you_mean/spell_checkers/require_path_checker.rb b/lib/did_you_mean/spell_checkers/require_path_checker.rb index <HASH>..<HASH> 100644 --- a/lib/did_you_mean/spell_checkers/require_path_checker.rb +++ b/lib/did_you_mean/spell_checkers/require_path_checker.rb @@ -2,6 +2,7 @@ require_relative "../spell_checker" require_relative "../tree_spell_checker" +require "rbconfig" module DidYouMean class RequirePathChecker
Should require "rbconfig" to use RbConfig
yuki24_did_you_mean
train
rb
24c39e7bd9a07a017cd2c585c0ae17ad131bfc03
diff --git a/chess/__init__.py b/chess/__init__.py index <HASH>..<HASH> 100644 --- a/chess/__init__.py +++ b/chess/__init__.py @@ -1014,21 +1014,12 @@ class BaseBoard: """ self._set_board_fen(fen) - def piece_map(self) -> Dict[Square, Piece]: + def piece_map(self, *, mask: Bitboard = BB_ALL) -> Dict[Square, Piece]: """ Gets a dictionary of :class:`pieces <chess.Piece>` by square index. """ result = {} - for square in scan_reversed(self.occupied): - result[square] = typing.cast(Piece, self.piece_at(square)) - return result - - def piece_map_by_color(self, color: Color) -> Dict[Square, Piece]: - """ - Gets a dictionary of :class:`pieces <chess.Piece>` by square index. - """ - result = {} - for square in scan_reversed(self.occupied_co[color]): + for square in scan_reversed(self.occupied & mask): result[square] = typing.cast(Piece, self.piece_at(square)) return result
Combine piece_map methods (#<I>)
niklasf_python-chess
train
py
f2aeb5ae99e579d2deefd7d67c03f0f348fa7eaf
diff --git a/provider/local/environ.go b/provider/local/environ.go index <HASH>..<HASH> 100644 --- a/provider/local/environ.go +++ b/provider/local/environ.go @@ -335,6 +335,11 @@ func (env *localEnviron) PublicStorage() storage.StorageReader { return httpstorage.Client(env.config.sharedStorageAddr()) } +// Implements environs.BootstrapStorager. +func (env *localEnviron) EnableBootstrapStorage() error { + return env.setupLocalStorage() +} + // Destroy is specified in the Environ interface. func (env *localEnviron) Destroy() error { if !env.config.runningAsRoot {
Make sure that the local provider has bootstrap storage.
juju_juju
train
go
fc376a56eca9725ac445412356f0d82137578c7b
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -14,6 +14,7 @@ setup( author='John Doee', author_email='johndoee@tidalstream.org', description='IMDB Parser', + long_description=long_description, license='MIT', packages=['imdbparser'], install_requires=['lxml', 'requests'],
Fixed description for pypi
JohnDoee_imdbparser
train
py
94ecd7ec7b14c15c032a8ca0812fa80c8b46cd80
diff --git a/app/src/js/modules/ckeditor.js b/app/src/js/modules/ckeditor.js index <HASH>..<HASH> 100644 --- a/app/src/js/modules/ckeditor.js +++ b/app/src/js/modules/ckeditor.js @@ -158,6 +158,8 @@ config.autoGrow_bottomSpace = 24; config.removePlugins = 'elementspath'; config.resize_dir = 'vertical'; + config.protectedSource.push(/\{\{[\s\S]*?\}\}/g); + config.protectedSource.push(/\{\%[\s\S]*?%\}/g); if (set.filebrowser) { if (set.filebrowser.browseUrl) {
CKEditor: Set twig syntax {{ }} and {% %} as protected
bolt_bolt
train
js
bb79758f042f1a51ce1ad3d1b23206b0a3c8d851
diff --git a/timepiece/admin.py b/timepiece/admin.py index <HASH>..<HASH> 100644 --- a/timepiece/admin.py +++ b/timepiece/admin.py @@ -58,6 +58,22 @@ class ProjectAdmin(admin.ModelAdmin): admin.site.register(timepiece.Project, ProjectAdmin) +class ContractAssignmentAdmin(admin.ModelAdmin): + list_display = ('id', 'contract', 'contact', 'start_date', + 'end_date', 'num_hours', 'worked') + list_filter = ('contract',) + ordering = ('-start_date',) + + def worked(self, obj): + hours_worked = float(obj.hours_worked) + percent = hours_worked * 100.0 / obj.num_hours + return "%.2f (%.2f%%)" % (hours_worked, percent) + worked.label = 'Hours Worked' + worked.is_safe = True + +admin.site.register(timepiece.ContractAssignment, ContractAssignmentAdmin) + + class RepeatPeriodAdmin(admin.ModelAdmin): list_display = ('count', 'interval') list_filter = ('interval',)
add contract assignment admin --HG-- branch : project-budgeting
caktus_django-timepiece
train
py
44c5096860600d7558461b5998fcdfe2f08ca848
diff --git a/lib/workers.js b/lib/workers.js index <HASH>..<HASH> 100644 --- a/lib/workers.js +++ b/lib/workers.js @@ -12,6 +12,7 @@ var inherits = require('inherits'); var defaultOptions = { + pollingDelay: 0, pollingInterval: 1500, lockTimeMs: 4000 }; @@ -44,7 +45,7 @@ function Workers(baseUrl, options) { var engineApi = new EngineApi(baseUrl); - var timer = setInterval(poll, options.pollingInterval); + var pollingTimer; var consumerId = options.consumerId || uuid.v4(); @@ -144,13 +145,25 @@ function Workers(baseUrl, options) { this.poll = poll; this.destroy = function() { - emit('destroy'); + emit('destroy', consumerId); - clearInterval(timer); + clearInterval(pollingTimer); }; - emit('start', consumerId); + function start() { + emit('start', consumerId); + + pollingTimer = setInterval(poll, options.pollingInterval); + } + + this.start = start; + + // disable auto-start by setting polling delay to -1 + if (options.pollingDelay !== -1) { + // delay start by pollingDelay + random value + setTimeout(start, options.pollingDelay + (options.pollingDelay * Math.random())); + } } inherits(Workers, Emitter);
feat(workers): add pollingDelay
nikku_camunda-worker-node
train
js
3f2d1f8ef2323e6183f414f40b976001d0f6dc01
diff --git a/lib/gov_kit/vote_smart.rb b/lib/gov_kit/vote_smart.rb index <HASH>..<HASH> 100644 --- a/lib/gov_kit/vote_smart.rb +++ b/lib/gov_kit/vote_smart.rb @@ -19,6 +19,13 @@ module GovKit end end + class Bio < VoteSmartResource + def self.find(candidate_id) + response = get("/CandidateBio.getBio", :query => {"candidateId" => candidate_id}) + instantiate_record(response['bio']['candidate']) + end + end + class Bill < VoteSmartResource def self.find(bill_id) response = get("/Votes.getBill", :query => {"billId" => bill_id})
Adding bio method to votesmart api
opengovernment_govkit
train
rb
87ea2be6df07192d18149541af77a0832079bb40
diff --git a/src/qinfer/__init__.py b/src/qinfer/__init__.py index <HASH>..<HASH> 100644 --- a/src/qinfer/__init__.py +++ b/src/qinfer/__init__.py @@ -40,6 +40,7 @@ from qinfer.abstract_model import * from qinfer.parallel import * from qinfer.score import * from qinfer.rb import * +from qinfer.smc import * from qinfer.unstructured_models import * from qinfer.derived_models import * from qinfer.ipy import * diff --git a/src/qinfer/smc.py b/src/qinfer/smc.py index <HASH>..<HASH> 100644 --- a/src/qinfer/smc.py +++ b/src/qinfer/smc.py @@ -34,7 +34,6 @@ from __future__ import division, unicode_literals __all__ = [ 'SMCUpdater', 'SMCUpdaterBCRB', - 'SMCUpdaterABC', 'MixedApproximateSMCUpdater' ]
Finally added smc.py to __init__.
QInfer_python-qinfer
train
py,py
77f8ea2185517828b1da6c3dfa707c475f62e8ca
diff --git a/src/Mpdf.php b/src/Mpdf.php index <HASH>..<HASH> 100644 --- a/src/Mpdf.php +++ b/src/Mpdf.php @@ -9723,7 +9723,8 @@ class Mpdf implements \Psr\Log\LoggerAwareInterface $rect = sprintf('%.3F %.3F %.3F %.3F', $pl[0], $pl[1], $pl[0] + $pl[2], $pl[1] - $pl[3]); $annot .= '<</Type /Annot /Subtype /Link /Rect [' . $rect . ']'; - $annot .= ' /Contents ' . $this->_UTF16BEtextstring($pl[4]); + // Removed as causing undesired effects in Chrome PDF viewer https://github.com/mpdf/mpdf/issues/283 + // $annot .= ' /Contents ' . $this->_UTF16BEtextstring($pl[4]); $annot .= ' /NM ' . $this->_textstring(sprintf('%04u-%04u', $n, $key)); $annot .= ' /M ' . $this->_textstring('D:' . date('YmdHis'));
Removed additional contents for Link annotation subtype (Closes #<I>)
mpdf_mpdf
train
php
5560a64f57541893526ff4da9fedab0aebe37ebb
diff --git a/runcommands/runners/commands.py b/runcommands/runners/commands.py index <HASH>..<HASH> 100644 --- a/runcommands/runners/commands.py +++ b/runcommands/runners/commands.py @@ -12,7 +12,7 @@ __all__ = ['local', 'remote'] @command -def local(config, cmd, cd=None, path=(), prepend_path=(), append_path=(), sudo=False, +def local(config, cmd, cd=None, path=None, prepend_path=None, append_path=None, sudo=False, run_as=None, echo=False, hide=False, timeout=None, use_pty=True, abort_on_failure=True, inject_config=True): """Run a command locally. @@ -75,8 +75,8 @@ def get_default_local_prepend_path(config): @command -def remote(config, cmd, host, user=None, cd=None, path=(), prepend_path=(), - append_path=(), sudo=False, run_as=None, echo=False, hide=False, timeout=30, +def remote(config, cmd, host, user=None, cd=None, path=None, prepend_path=None, + append_path=None, sudo=False, run_as=None, echo=False, hide=False, timeout=30, abort_on_failure=True, inject_config=True, strategy='ssh'): """Run a command on the remote host via SSH.
Revert local/remote path option default values to None This is because we want to pass paths as strings from the command line, not lists. Amends <I>c3df<I>c<I>a<I>a<I>e0a
wylee_runcommands
train
py
a94b5534f208c8d5238d6c498f5d26c0ab88e8a7
diff --git a/pyrsistent.py b/pyrsistent.py index <HASH>..<HASH> 100644 --- a/pyrsistent.py +++ b/pyrsistent.py @@ -1178,7 +1178,7 @@ def freeze(o): """ typ = type(o) if typ is dict: - return pmap({k: freeze(v) for k, v in o.iteritems()}) + return pmap({k: freeze(v) for k, v in six.iteritems(o)}) elif typ is list: return pvector(map(freeze, o)) elif typ is tuple: @@ -1207,7 +1207,7 @@ def thaw(o): """ typ = type(o) if typ is type(pvector()): - return map(thaw, o) + return list(map(thaw, o)) if typ is type(pmap()): return {k: thaw(v) for k, v in o.iteritems()} if typ is tuple:
whoops, python 3 support!
tobgu_pyrsistent
train
py
9ce7ba472c78952a468582142ec92463ea449d75
diff --git a/graylog2-server/src/main/java/org/graylog2/indexer/esplugin/IndexChangeMonitor.java b/graylog2-server/src/main/java/org/graylog2/indexer/esplugin/IndexChangeMonitor.java index <HASH>..<HASH> 100644 --- a/graylog2-server/src/main/java/org/graylog2/indexer/esplugin/IndexChangeMonitor.java +++ b/graylog2-server/src/main/java/org/graylog2/indexer/esplugin/IndexChangeMonitor.java @@ -57,11 +57,6 @@ public class IndexChangeMonitor extends AbstractLifecycleComponent<IndexChangeMo } if (eventBus != null) { - final List<String> indicesCreated = event.indicesCreated(); - if (!indicesCreated.isEmpty()) { - eventBus.post(IndicesCreatedEvent.create(indicesCreated)); - } - final List<String> indicesDeleted = event.indicesDeleted(); if (!indicesDeleted.isEmpty()) { eventBus.post(IndicesDeletedEvent.create(indicesDeleted));
Remove unused IndicesCreatedEvent
Graylog2_graylog2-server
train
java
79ae7ad3fd2f45724abca76fba3668c9357095b4
diff --git a/bin/wsdump.py b/bin/wsdump.py index <HASH>..<HASH> 100755 --- a/bin/wsdump.py +++ b/bin/wsdump.py @@ -171,11 +171,7 @@ def main(): pass elif isinstance(data, bytes): try: - decomp = zlib.decompressobj( - -zlib.MAX_WBITS - ) - data = decomp.decompress(data) - data = "[zlib] " + str(data + decomp.flush(), "utf-8") + data = "[zlib] " + str(zlib.decompress(data, -zlib.MAX_WBITS), "utf-8") except: pass
Simplify zlib.decompress call
websocket-client_websocket-client
train
py
54da80e26497b8f1dbcd3027775628d11e1c6814
diff --git a/lib/plugins/invoke.js b/lib/plugins/invoke.js index <HASH>..<HASH> 100644 --- a/lib/plugins/invoke.js +++ b/lib/plugins/invoke.js @@ -21,6 +21,9 @@ class Invoke { }; this.hooks = { + 'initialize': () => { + this.options = this.serverless.processedInput.options; + }, 'invoke:local:loadEnvVars': async () => BbPromise.bind(this).then(this.loadEnvVarsForLocal), 'after:invoke:invoke': async () => BbPromise.bind(this).then(this.trackInvoke), 'after:invoke:local:invoke': async () => BbPromise.bind(this).then(this.trackInvokeLocal),
fix(AWS Invocation): Fix resolution of options with non-AWS provider (#<I>)
serverless_serverless
train
js
5516b0b2c9e9559fbbddfe99151f302066951c0f
diff --git a/discord/guild.py b/discord/guild.py index <HASH>..<HASH> 100644 --- a/discord/guild.py +++ b/discord/guild.py @@ -1151,7 +1151,7 @@ class Guild(Hashable): Raises ------- Forbidden - You do not have permissions to change the role. + You do not have permissions to create the role. HTTPException Editing the role failed. InvalidArgument
guild.py: change word in create_role's docstring
Rapptz_discord.py
train
py
a150aadca4a987fd08b86a95199f15d0fb231f6b
diff --git a/test/BinaryReaderTest.php b/test/BinaryReaderTest.php index <HASH>..<HASH> 100644 --- a/test/BinaryReaderTest.php +++ b/test/BinaryReaderTest.php @@ -19,8 +19,8 @@ class BinaryReaderTest extends \PHPUnit_Framework_TestCase public function setUp() { - $dataBig = file_get_contents(__DIR__ . '/asset/testfile-big.bin'); - $dataLittle = file_get_contents(__DIR__ . '/asset/testfile-little.bin'); + $dataBig = fopen(__DIR__ . '/asset/testfile-big.bin', 'rb'); + $dataLittle = fopen(__DIR__ . '/asset/testfile-little.bin', 'rb'); $this->brBig = new BinaryReader($dataBig, Endian::ENDIAN_BIG); $this->brLittle = new BinaryReader($dataLittle, Endian::ENDIAN_LITTLE);
Use file resource in BinaryReader tests
mdurrant_php-binary-reader
train
php
2137af49dc23304a65d72d749f483c28848d699e
diff --git a/bin/object.js b/bin/object.js index <HASH>..<HASH> 100644 --- a/bin/object.js +++ b/bin/object.js @@ -204,15 +204,17 @@ TypedObject.prototype.normalize = function(value) { if (item.hasDefault && !value.hasOwnProperty(key)) value[key] = item.default; }); - Object.keys(value) - .forEach(function(key) { - if (object.properties.hasOwnProperty(key)) { - const schema = object.properties[key]; - result[key] = schema.normalize(value[key]); - } else if (!object.clean) { - result[key] = value[key]; - } - }); + if (value) { + Object.keys(value) + .forEach(function (key) { + if (object.properties.hasOwnProperty(key)) { + const schema = object.properties[key]; + result[key] = schema.normalize(value[key]); + } else if (!object.clean) { + result[key] = value[key]; + } + }); + } return result; };
don't normalize null objects
byu-oit_fully-typed
train
js
e3b3214c12f5d929db1dfa34454d5284dd80bbb5
diff --git a/run_tests.py b/run_tests.py index <HASH>..<HASH> 100644 --- a/run_tests.py +++ b/run_tests.py @@ -69,8 +69,9 @@ def find_tests(): m = importlib.import_module('test.' + n) suite = unittest.defaultTestLoader.loadTestsFromModule(m) suites.append(suite) - from test.html5lib_adapter import find_tests - suites.append(find_tests()) + if 'SKIP_HTML5LIB' not in os.environ: + from test.html5lib_adapter import find_tests + suites.append(find_tests()) return unittest.TestSuite(suites)
Allow skipping html5lib tests via an env var
kovidgoyal_html5-parser
train
py
777e2eb0ed10689142a0ee715f4735c88320868f
diff --git a/src/index.js b/src/index.js index <HASH>..<HASH> 100644 --- a/src/index.js +++ b/src/index.js @@ -54,7 +54,7 @@ module.exports.reporter = reporterType => { }) } - if (reporterType === 'fail' && foundIssues) { + if (isFailReporter && foundIssues) { failedFiles.push(file.path) }
refactor(src): use isFailReporter var
dustinspecker_gulp-alex
train
js
d7ade9e17a78aa0741b6745559f81c0a8a1ce721
diff --git a/src/com/tapsterrock/mpp/MPP9File.java b/src/com/tapsterrock/mpp/MPP9File.java index <HASH>..<HASH> 100644 --- a/src/com/tapsterrock/mpp/MPP9File.java +++ b/src/com/tapsterrock/mpp/MPP9File.java @@ -1360,7 +1360,7 @@ final class MPP9File { continue; } - + resource = file.addResource(); resource.setAccrueAt(AccrueType.getInstance (MPPUtility.getShort (data, 12))); @@ -1504,6 +1504,7 @@ final class MPP9File resource.setText28(rscVarData.getUnicodeString (id, RESOURCE_TEXT28)); resource.setText29(rscVarData.getUnicodeString (id, RESOURCE_TEXT29)); resource.setText30(rscVarData.getUnicodeString (id, RESOURCE_TEXT30)); + resource.setType((MPPUtility.getShort(data, 14)==0?new Integer(1):new Integer(0))); resource.setUniqueID(id.intValue()); resource.setWork(new MPXDuration (MPPUtility.getDouble (data, 52)/60000, TimeUnit.HOURS));
Added support for reading resource type attribute from an MPP9 file.
joniles_mpxj
train
java
8f936f9f8375950aef228d5cbe27b68c125f1ea5
diff --git a/integration/install_test.go b/integration/install_test.go index <HASH>..<HASH> 100644 --- a/integration/install_test.go +++ b/integration/install_test.go @@ -238,7 +238,7 @@ func nodeHealer() ExecFlow { if nodeOpts == "" { nodeOpts = strings.Join(env.All("nodeopts"), ",") } - res := T("node-add", nodeOpts, "pool="+poolName).Run(env) + res := T("node-add", nodeOpts, "pool="+poolName).WithTimeout(20 * time.Minute).Run(env) c.Assert(res, ResultOk) nodeAddr := waitNewNode(c, env) env.Set("newnode-"+poolName, nodeAddr) @@ -341,7 +341,7 @@ func poolAdd() ExecFlow { res = T("pool-constraint-set", poolName, "team", "{{.team}}").Run(env) c.Assert(res, ResultOk) opts := nodeOrRegisterOpts(c, env) - res = T("node-add", opts, "pool="+poolName).Run(env) + res = T("node-add", opts, "pool="+poolName).WithTimeout(20 * time.Minute).Run(env) c.Assert(res, ResultOk) nodeAddr := waitNewNode(c, env) env.Add("nodeaddrs", nodeAddr)
integration: increase timeout for node-add operation
tsuru_tsuru
train
go
9941b36f190696c327b4224879585611dbb76b3a
diff --git a/spyder/plugins/application/plugin.py b/spyder/plugins/application/plugin.py index <HASH>..<HASH> 100644 --- a/spyder/plugins/application/plugin.py +++ b/spyder/plugins/application/plugin.py @@ -101,6 +101,11 @@ class Application(SpyderPluginV2): self.get_container().sig_load_log_file.connect(editor.load) # -------------------------- PLUGIN TEARDOWN ------------------------------ + @on_plugin_teardown(plugin=Plugins.Preferences) + def on_preferences_teardown(self): + preferences = self.get_plugin(Plugins.Preferences) + preferences.deregister_plugin_preferences(self) + def on_close(self, _unused=True): self.get_container().on_close()
Start application migration to use the teardown mechanism
spyder-ide_spyder
train
py
f54f48edc0c676bcddbe88d7c7e2c6199532f3ff
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -41,9 +41,12 @@ setup( # that you indicate whether you support Python 2, Python 3 or both. 'Programming Language :: Python :: 2', 'Programming Language :: Python :: 2.7', + 'programming Language :: Python :: 3', + 'programming Language :: Python :: 3.3', + 'programming Language :: Python :: 3.4', ], - install_requires = ['markdown','markdown-include >= 0.4.1','toposort','jinja2', - 'pygments','beautifulsoup4'], + install_requires = ['markdown','markdown-include >= 0.4.1','toposort', + 'jinja2','pygments','beautifulsoup4'], entry_points = { 'console_scripts': [ 'ford=ford:main',
Updated the setup.py file to give appropriate information to PyPI.
Fortran-FOSS-Programmers_ford
train
py
ca1f427749c4074127084df28393119399a824f9
diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/utils/SymmetryTools.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/utils/SymmetryTools.java index <HASH>..<HASH> 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/utils/SymmetryTools.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/utils/SymmetryTools.java @@ -518,6 +518,7 @@ public class SymmetryTools { for (int i = 0; i < order; i++) { Structure s = new StructureImpl(); + s.addModel(new ArrayList<Chain>(1)); s.setStructureIdentifier(repeatsId.get(i)); Block align = symmetry.getMultipleAlignment().getBlock(0);
Quick fix of #<I>, following 'users should create models' We might still need to do this elsewhere, or may want to fix it more thoroughly elsewhere
biojava_biojava
train
java
977093184b0543538aaf6b0691a76666b4056520
diff --git a/pkg/endpoint/bpf.go b/pkg/endpoint/bpf.go index <HASH>..<HASH> 100644 --- a/pkg/endpoint/bpf.go +++ b/pkg/endpoint/bpf.go @@ -33,6 +33,7 @@ import ( "github.com/cilium/cilium/pkg/labels" "github.com/cilium/cilium/pkg/loadinfo" "github.com/cilium/cilium/pkg/logging/logfields" + "github.com/cilium/cilium/pkg/maps/bwmap" "github.com/cilium/cilium/pkg/maps/ctmap" "github.com/cilium/cilium/pkg/maps/eppolicymap" "github.com/cilium/cilium/pkg/maps/lxcmap" @@ -959,6 +960,13 @@ func (e *Endpoint) deleteMaps() []error { errors = append(errors, fmt.Errorf("unable to remove endpoint from global policy map: %s", err)) } + // Remove rate-limit from bandwidth manager map. + if e.bps != 0 && option.Config.EnableBandwidthManager { + if err := bwmap.Delete(e.ID); err != nil { + errors = append(errors, fmt.Errorf("unable to remote endpoint from bandwidth manager map: %s", err)) + } + } + return errors }
endpoint: Clean up the bwmap on pod termination The bandwidth manager map is populated with the rate limits to apply to specific pods (not all pods are rate limited). On pod termination, we must remove the corresponding entry from the map, if a rate limit was configured. Fixes: <I>f<I> ("cilium: add bandwidth manager")
cilium_cilium
train
go
5f4e18b59966e33681bb3d6bc5a1412b922170a2
diff --git a/app/models/rubygem.rb b/app/models/rubygem.rb index <HASH>..<HASH> 100644 --- a/app/models/rubygem.rb +++ b/app/models/rubygem.rb @@ -130,7 +130,8 @@ class Rubygem < ActiveRecord::Base end def owned_by?(user) - ownerships.find_by_user_id(user.id) if user + return false unless user + ownerships.exists?(:user_id => user.id) end def to_s diff --git a/test/unit/rubygem_test.rb b/test/unit/rubygem_test.rb index <HASH>..<HASH> 100644 --- a/test/unit/rubygem_test.rb +++ b/test/unit/rubygem_test.rb @@ -285,7 +285,7 @@ class RubygemTest < ActiveSupport::TestCase end should "be not owned if no user" do - assert !@rubygem.owned_by?(nil) + assert_equal false, @rubygem.owned_by?(nil) assert @rubygem.unowned? end end
Rubygem#owned_by? should return boolean
rubygems_rubygems.org
train
rb,rb
e888ced6374983504169804c9da8be9c706d19ca
diff --git a/lib/tracker/manager.js b/lib/tracker/manager.js index <HASH>..<HASH> 100644 --- a/lib/tracker/manager.js +++ b/lib/tracker/manager.js @@ -7,7 +7,7 @@ module.exports = function TrackerManager(zeronet) { let trackers = [] - let lastid + let lastid = -1 function updateNext() { if (!trackers.length) return @@ -16,15 +16,19 @@ module.exports = function TrackerManager(zeronet) { lastid++ } + let main + function updateAll() { - updateNext() - if (lastid) setTimeout(updateAll, 1000) + if (trackers[lastid]) { + updateNext() + main = setTimeout(updateAll, 1000) + } else { + lastid = 0 + main = setTimeout(updateAll, 30 * 1000) + } } - const main = setInterval(() => { - lastid = 0 - updateAll() - }, (30 + trackers.length) * 1000) //every 30secs + per tracker 1sec + updateAll() function add(tracker, zite) { let plist
Fix the tracker-reannounce-timer
ZeroNetJS_zeronet-common
train
js
f15e0998067fb074bd77b4a76d2db96d4ed7db9d
diff --git a/lib/torquespec/torquespec.rb b/lib/torquespec/torquespec.rb index <HASH>..<HASH> 100644 --- a/lib/torquespec/torquespec.rb +++ b/lib/torquespec/torquespec.rb @@ -47,12 +47,17 @@ module TorqueSpec end end + def self.on_windows? + java.lang::System.getProperty( "os.name" ) =~ /windows/i + end + + # A somewhat hackish way of exposing client-side gems to the server-side daemon def self.rubylib here = File.dirname(__FILE__) rspec_libs = Dir.glob(File.expand_path(File.join(here, "../../..", "*{rspec,diff-lcs}*/lib"))) this_lib = File.expand_path(File.join(here, "..")) - rspec_libs.unshift( this_lib ).join(":") + rspec_libs.unshift( this_lib ).join(on_windows? ? ";" : ":") end # We must initialize the daemon with the same params as passed to the client
Use the correct path item separator on windows.
torquebox_torquespec
train
rb
63ebba13634933b18306f62a1beb4b3a30263156
diff --git a/public/js/processors/processor.js b/public/js/processors/processor.js index <HASH>..<HASH> 100644 --- a/public/js/processors/processor.js +++ b/public/js/processors/processor.js @@ -346,7 +346,11 @@ var processors = jsbin.processors = (function () { revision: jsbin.state.revision }, success: function (data) { - resolve(data); + if (data.errors) { + console.log(data.errors); + } else if (data.result) { + resolve(data.result); + } }, error: function (jqxhr) { reject(jqxhr.responseText);
Accept error messages (and show in console log for the moment)
jsbin_jsbin
train
js
0931e6d610e5a6e02684c5cacb341eb8cdec82f4
diff --git a/tests/test_menu_launcher.py b/tests/test_menu_launcher.py index <HASH>..<HASH> 100644 --- a/tests/test_menu_launcher.py +++ b/tests/test_menu_launcher.py @@ -275,8 +275,17 @@ def test_running_menu(): # go to containers menu child.sendline('1') child.expect('error') - # return to logs menu - child.sendline('\033') + # kill child + child.read() + child.close() + # create new child + child1 = pexpect.spawn(cmd) + child1.expect('Exit') + # go to system commands + child.sendline('5') + child.expect('Return to Vent menu') + # go to logs menu + child.sendline('1') child.expect('Return to System Commands menu') # go to namespace menu child.sendline('2')
child needs to be killed and re-created due to error thrown on small terminals.
CyberReboot_vent
train
py
efb1ba5d62a7e99e0df07b180c88f3af3da9d9d1
diff --git a/configs/tslint.js b/configs/tslint.js index <HASH>..<HASH> 100644 --- a/configs/tslint.js +++ b/configs/tslint.js @@ -297,9 +297,16 @@ module.exports = { function getRulesDir() { let fakeIndexFilePath = resolve.sync('@magicspace/tslint-rules/bld/rules', { + basedir: __dirname, isFile(fileName) { if (Path.basename(fileName) === 'index.js') { - return true; + let dirName = Path.dirname(fileName); + + try { + return FS.statSync(dirName).isDirectory(); + } catch (error) { + return false; + } } try {
Fix isFile callback for resolving
makeflow_magicspace
train
js
06ed2e2fcb805cbd3ba3b6d016e702ee4dc731b4
diff --git a/TYPO3.Eel/Classes/TYPO3/Eel/Helper/ArrayHelper.php b/TYPO3.Eel/Classes/TYPO3/Eel/Helper/ArrayHelper.php index <HASH>..<HASH> 100644 --- a/TYPO3.Eel/Classes/TYPO3/Eel/Helper/ArrayHelper.php +++ b/TYPO3.Eel/Classes/TYPO3/Eel/Helper/ArrayHelper.php @@ -344,8 +344,7 @@ class ArrayHelper implements ProtectedContextAwareInterface */ public function flip(array $array) { - $newArray = array_flip($array); - return $newArray; + return array_flip($array); } /**
TASK: Skip one variable assignment
neos_flow-development-collection
train
php
d4bbbc3b8ed060a5bbecfcdacbd90f8d1de75245
diff --git a/lease/lease_test.go b/lease/lease_test.go index <HASH>..<HASH> 100644 --- a/lease/lease_test.go +++ b/lease/lease_test.go @@ -313,7 +313,7 @@ func (s *leaseSuite) TestLeaseExpiration(c *gc.C) { subscription := mgr.LeaseReleasedNotifier(testNamespace) receivedSignal := make(chan struct{}) - var leaseClaimedTime time.Time + leaseClaimedTime := time.Now() go func() { <-subscription @@ -336,7 +336,6 @@ func (s *leaseSuite) TestLeaseExpiration(c *gc.C) { // Grab a lease. _, err := mgr.ClaimLease(testNamespace, testId, leaseDuration) - leaseClaimedTime = time.Now() c.Assert(err, jc.ErrorIsNil) // Wait for the all-clear, or a time-out.
lease: fix data race in tests Fixes LP <I>
juju_juju
train
go
4059b8bd647bac1caa5080f249fafac6cd9ac255
diff --git a/spinoff/remoting/hub.py b/spinoff/remoting/hub.py index <HASH>..<HASH> 100644 --- a/spinoff/remoting/hub.py +++ b/spinoff/remoting/hub.py @@ -74,9 +74,9 @@ class Hub(object): self._outsock = self._ctx.socket(zmq.ROUTER) self._insock.identity = self._outsock.identity = nid self._listener_in = spawn(self._listen, self._insock, IN) - self._listener_in.link(lambda _: self.stop()) + self._listener_in.link_exception(lambda _: self.stop()) self._listener_out = spawn(self._listen, self._outsock, OUT) - self._listener_out.link(lambda _: self.stop()) + self._listener_out.link_exception(lambda _: self.stop()) self._heartbeater = None self._watched_nodes = {} self._initialized = True
Hub only stops itself if its listeners fail due to an exception--this is to avoid unnecessary recursive stopping
eallik_spinoff
train
py
653a778d640e75da029e31679b72e14e44d7ef31
diff --git a/wandb/summary.py b/wandb/summary.py index <HASH>..<HASH> 100644 --- a/wandb/summary.py +++ b/wandb/summary.py @@ -44,10 +44,9 @@ class SummarySubDict(object): def __setattr__(self, k, v): k = k.strip() if k.startswith("_"): - return object.__setattr__(self, k, v) + object.__setattr__(self, k, v) else: self[k] = v - return v def __getattr__(self, k): k = k.strip() @@ -95,6 +94,7 @@ class SummarySubDict(object): return self._dict.get(k, default) def __getitem__(self, k): + k = k.strip() self.get(k) # load the value into _dict if it should be there return self._dict[k]
Summaries: address Jeff's comments. Add a missing key.strip() and get rid of the unnecessary return in __setitem__.
wandb_client
train
py
952da4a62b552ade3526784a1d596d781be55389
diff --git a/template/files.go b/template/files.go index <HASH>..<HASH> 100644 --- a/template/files.go +++ b/template/files.go @@ -64,8 +64,9 @@ func init() { panic({{exported "CTX"}}.Err()) } +{{ $length := len .DirList }} {{if not .Debug}} -{{if (and (not .Updater.Empty) (not .Spread))}} +{{if and (not .Updater.Empty) (not .Spread) (gt $length 0)}} var err error {{end}}
Add error variable when a dir needs to be creaTed
UnnoTed_fileb0x
train
go
046431838233fe4b2a34e2c01ef6aff1a0f01479
diff --git a/bypy.py b/bypy.py index <HASH>..<HASH> 100755 --- a/bypy.py +++ b/bypy.py @@ -228,6 +228,18 @@ except: "You can install it by running 'pip install requests'") raise +# https://urllib3.readthedocs.org/en/latest/security.html#certifi-with-urllib3 +try: + import urllib3 + import certifi + + http = urllib3.PoolManager( + cert_reqs='CERT_REQUIRED', # Force certificate check. + ca_certs=certifi.where(), # Path to the Certifi bundle. + ) +except: + print("[Info] Package 'certifi' not found, normally this is *OK*. But if you encounter 'InsecureRequestWarning' later, you can try install 'certifi' by running 'pip install certifi' first, and then re-run this program, the 'InsecureRequestWarning' then should be gone.") + requests_version = requests.__version__.split('.') if int(requests_version[0]) < 1: print("You Python Requests Library version is to lower than 1.\n" + \ diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100755 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ from setuptools import setup,find_packages setup( name='bypy', - version='1.0.1', + version='1.0.2', description='Python client for Baidu Yun (Personal Cloud Storage) 百度云/百度网盘 Python 客户端', author='Hou Tianze', author_email='houtianze@gmail.com',
Prompt the user for 'certifi' to fix 'InsecureRequestWarning'
houtianze_bypy
train
py,py
7d4006fa7c83cf420e8b4083b7b502ba1c427603
diff --git a/simuvex/plugins/unicorn_engine.py b/simuvex/plugins/unicorn_engine.py index <HASH>..<HASH> 100644 --- a/simuvex/plugins/unicorn_engine.py +++ b/simuvex/plugins/unicorn_engine.py @@ -709,7 +709,6 @@ class Unicorn(SimStatePlugin): if self.state.registers.load(vex_offset, 64).symbolic: symbolic_regs = True - symbolic_regs = True if symbolic_regs: highest_reg_offset, reg_size = max(self.state.arch.registers.values()) symbolic_offsets = set()
remove debugging un-optimization
angr_angr
train
py
29fb8b5e1deaa3444be6e117aad0b326b14237c7
diff --git a/memsql/common/database.py b/memsql/common/database.py index <HASH>..<HASH> 100644 --- a/memsql/common/database.py +++ b/memsql/common/database.py @@ -100,6 +100,10 @@ class Connection(object): """ Ping the server """ return self._db.ping() + def thread_id(self): + """ Retrieve the thread id for the current connection """ + return self._db.thread_id() + def debug_query(self, query, *parameters, **kwparameters): return self._query(query, parameters, kwparameters, debug=True) diff --git a/memsql/common/test/test_database_adapters.py b/memsql/common/test/test_database_adapters.py index <HASH>..<HASH> 100644 --- a/memsql/common/test/test_database_adapters.py +++ b/memsql/common/test/test_database_adapters.py @@ -28,6 +28,9 @@ def test_query(test_db_conn): def test_ping(test_db_conn): test_db_conn.ping() +def test_thread_id(test_db_conn): + assert isinstance(test_db_conn.thread_id(), int) + class TestQueries(object): @pytest.fixture(scope="class") def x_conn(self, request, test_db_args, test_db_database):
expose thread_id method on database connections
memsql_memsql-python
train
py,py
0742f549fae6118dd7b154ea9244077d124751a2
diff --git a/tweepy/client.py b/tweepy/client.py index <HASH>..<HASH> 100644 --- a/tweepy/client.py +++ b/tweepy/client.py @@ -1671,7 +1671,7 @@ class Client(BaseClient): "Client.follow is deprecated; use Client.follow_user instead.", DeprecationWarning ) - self.follow_user(target_user_id, user_auth=user_auth) + return self.follow_user(target_user_id, user_auth=user_auth) # Mutes
Fix return for Client.follow Properly return response from Client.follow_user rather than None
tweepy_tweepy
train
py
9c924e17dc0379694253cc669170a6c0f48c4a11
diff --git a/Cart.php b/Cart.php index <HASH>..<HASH> 100755 --- a/Cart.php +++ b/Cart.php @@ -4,9 +4,7 @@ namespace yii2mod\cart; use yii\base\Component; use yii\base\InvalidParamException; use yii\web\Session; -use yii2mod\cart\models\CartDiscountInterface; use yii2mod\cart\models\CartItemInterface; -use yii2mod\cart\models\OrderInterface; /** * Provides basic cart functionality (adding, removing, clearing, listing items). You can extend this class and @@ -179,7 +177,7 @@ class Cart extends Component * @param string $attribute * @param string|null $itemType * - * @return int|float + * @return integer */ public function getAttributeTotal($attribute, $itemType = null) {
Scrutinizer Auto-Fixes This patch was automatically generated as part of the following inspection: <URL>
yii2mod_yii2-cart
train
php
903846481ebe9e8a85cfbc6f04514d71c57a1c1f
diff --git a/build/index.es6.js b/build/index.es6.js index <HASH>..<HASH> 100644 --- a/build/index.es6.js +++ b/build/index.es6.js @@ -144,7 +144,7 @@ class Element extends HTMLElement { this.createShadowRoot().innerHTML = `<style>${ this.stylesheet.toString() }</style>${ this.element }`; /** Reset GlobalElement after we've grabbed all the deets. **/ - GlobalElement = undefined; + if (this.hasUpdated) GlobalElement = undefined; } /** diff --git a/build/index.umd.js b/build/index.umd.js index <HASH>..<HASH> 100644 --- a/build/index.umd.js +++ b/build/index.umd.js @@ -145,7 +145,7 @@ this.createShadowRoot().innerHTML = `<style>${ this.stylesheet.toString() }</style>${ this.element }`; /** Reset GlobalElement after we've grabbed all the deets. **/ - GlobalElement = undefined; + if (this.hasUpdated) GlobalElement = undefined; } }, { key: "attachedCallback", diff --git a/src/index.js b/src/index.js index <HASH>..<HASH> 100644 --- a/src/index.js +++ b/src/index.js @@ -196,4 +196,4 @@ class Element extends HTMLElement { } -export default Component; +export default {Component, GlobalElement, Element};
Add if condition to prevent undefined errors.
jakejarrett_marionette-component
train
js,js,js
e051c49b8e314e59b90efdaf99e2de2bfc3da2e8
diff --git a/src/Aura/Web/Context.php b/src/Aura/Web/Context.php index <HASH>..<HASH> 100644 --- a/src/Aura/Web/Context.php +++ b/src/Aura/Web/Context.php @@ -207,6 +207,10 @@ class Context */ public function __construct(array $globals, array $agents = []) { + // make sure these are loaded, in case auto_globals_jit = on + $_SERVER; + $_ENV; + $this->input = file_get_contents('php://input'); $this->get = ! isset($globals['_GET']) ? [] : $globals['_GET']; $this->post = ! isset($globals['_POST']) ? [] : $globals['_POST'];
Fixed a bug loading $GLOBALS data in Web\Context when auto_globals_jit = on
auraphp_Aura.Accept
train
php
4dac10423e4c9cad51f62b359451b263bdf3d398
diff --git a/fastly/cli.py b/fastly/cli.py index <HASH>..<HASH> 100644 --- a/fastly/cli.py +++ b/fastly/cli.py @@ -21,8 +21,9 @@ def main(): ) argparser.add_argument( - "-k", "--api-key", required=False, - help="Fastly API key", default=os.environ.get('FASTLY_API_KEY') + "-k", "--api-key", + required=False, default=os.environ.get('FASTLY_API_KEY'), + help="Fastly API key" ) argparser.add_argument( @@ -39,7 +40,8 @@ def main(): # These parsers are used multiple times service_parser = argparse.ArgumentParser(add_help=False) service_parser.add_argument( - 'service_id', + "-s", "--service-id", + required=False, default=os.environ.get('FASTLY_SERVICE_ID'), help='Service ID', )
Allow setting default service as FASTLY_SERVICE_ID env var.
fastly_fastly-py
train
py
cfa2cb96172cda7ab153244140912d3af3021122
diff --git a/hrp/plugin.go b/hrp/plugin.go index <HASH>..<HASH> 100644 --- a/hrp/plugin.go +++ b/hrp/plugin.go @@ -17,6 +17,7 @@ const ( goPluginFile = "debugtalk.so" // built from go plugin hashicorpGoPluginFile = "debugtalk.bin" // built from hashicorp go plugin hashicorpPyPluginFile = "debugtalk.py" // used for hashicorp python plugin + projectInfoFile = "proj.json" // used for ensuring root project ) func initPlugin(path string, logOn bool) (plugin funplugin.IPlugin, pluginDir string, err error) { @@ -118,9 +119,15 @@ func GetProjectRootDirPath(path string) (rootDir string, err error) { rootDir = filepath.Dir(pluginPath) return } + // fix: no debugtalk file in project but having proj.json created by startpeoject + projPath, err := locateFile(path, projectInfoFile) + if err == nil { + rootDir = filepath.Dir(projPath) + return + } // failed to locate project root dir - // maybe project plugin debugtalk.xx is not exist + // maybe project plugin debugtalk.xx and proj.json are not exist // use current dir instead return os.Getwd() }
fix: failed to locate root dir even if proj.json exist
HttpRunner_HttpRunner
train
go
13698f14605d30eafe22b2b09f1d01e21b2170d8
diff --git a/spec/unit/pretty_format_spec.rb b/spec/unit/pretty_format_spec.rb index <HASH>..<HASH> 100644 --- a/spec/unit/pretty_format_spec.rb +++ b/spec/unit/pretty_format_spec.rb @@ -42,12 +42,8 @@ RSpec.describe "#pretty_format" do end context "with non-English locale" do - before do - @previous_locale = I18n.locale.to_s - I18n.locale = "es" - end - after do - I18n.locale = @previous_locale + around do |example| + I18n.with_locale(:es) { example.call } end it "should return a localized Date or Time with long format for non-english locale" do t = Time.utc(1985, "feb", 28, 20, 15, 1)
Don't reimplement `I<I>n.with_locale`
activeadmin_activeadmin
train
rb
6e986b8dbb80be35aa48ebc3497686f4440255cd
diff --git a/src/main/java/de/paymill/Paymill.java b/src/main/java/de/paymill/Paymill.java index <HASH>..<HASH> 100755 --- a/src/main/java/de/paymill/Paymill.java +++ b/src/main/java/de/paymill/Paymill.java @@ -43,7 +43,7 @@ public class Paymill { * @return */ public static String getApiUrl() { - return System.getProperty("apiUrl", "https://api.paymill.de/v1"); + return System.getProperty("apiUrl", "https://api.paymill.de/v2"); } /**
Update src/main/java/de/paymill/Paymill.java Actually updating to v2
paymill_paymill-java
train
java
b17995dbeddc8f6556ae2a1eb736c03f71751a76
diff --git a/nephele/nephele-server/src/main/java/eu/stratosphere/nephele/taskmanager/Task.java b/nephele/nephele-server/src/main/java/eu/stratosphere/nephele/taskmanager/Task.java index <HASH>..<HASH> 100644 --- a/nephele/nephele-server/src/main/java/eu/stratosphere/nephele/taskmanager/Task.java +++ b/nephele/nephele-server/src/main/java/eu/stratosphere/nephele/taskmanager/Task.java @@ -15,7 +15,6 @@ package eu.stratosphere.nephele.taskmanager; -import java.util.ConcurrentModificationException; import java.util.HashMap; import java.util.Iterator; import java.util.Map; @@ -234,10 +233,11 @@ public class Task implements ExecutionObserver { */ public void initialExecutionResourcesExhausted() { - if (this.environment.getExecutingThread() != Thread.currentThread()) { + //TODO: Reactivate me + /*if (this.environment.getExecutingThread() != Thread.currentThread()) { throw new ConcurrentModificationException( "initialExecutionResourcesExhausted must be called from the task that executes the user code"); - } + }*/ // Construct a resource utilization snapshot final long timestamp = System.currentTimeMillis();
Temporarily disabled thread-safety check
apache_flink
train
java
ceed555381ea80490ff2543b946e645cddfeb070
diff --git a/wikitextparser/cell_test.py b/wikitextparser/cell_test.py index <HASH>..<HASH> 100644 --- a/wikitextparser/cell_test.py +++ b/wikitextparser/cell_test.py @@ -7,10 +7,11 @@ import wikitextparser as wtp from wikitextparser.table import Cell -class Cell(unittest.TestCase): +class TableCell(unittest.TestCase): - """Argument test class.""" + """Test the Cell class.""" + @unittest.expectedFailure def test_basic(self): c = Cell('\n| a ') self.assertEqual(' a ', c.value)
cell_test.py: Mark the test as an expected failure
5j9_wikitextparser
train
py
3f4cd6986af622e0f7ceaf8c3951eb989a4f3250
diff --git a/libkbfs/disk_block_cache.go b/libkbfs/disk_block_cache.go index <HASH>..<HASH> 100644 --- a/libkbfs/disk_block_cache.go +++ b/libkbfs/disk_block_cache.go @@ -570,11 +570,13 @@ func (cache *DiskBlockCacheStandard) Put(ctx context.Context, tlfID tlf.ID, } encodedLen := int64(len(entry)) defer func() { - cache.log.CDebugf(ctx, "Cache Put id=%s tlf=%s bSize=%d entrySize=%d "+ - "err=%+v", blockID, tlfID, blockLen, encodedLen, err) if err == nil { cache.putMeter.Mark(1) + } else { + err = errors.WithStack(err) } + cache.log.CDebugf(ctx, "Cache Put id=%s tlf=%s bSize=%d entrySize=%d "+ + "err=%+v", blockID, tlfID, blockLen, encodedLen, err) }() blockKey := blockID.Bytes() hasKey, err := cache.blockDb.Has(blockKey, nil)
disk_block_cache: Output stack when Put fails.
keybase_client
train
go
2958847431488b36bf640ca324092c9648031bd9
diff --git a/lib/solrizer/fedora/indexer.rb b/lib/solrizer/fedora/indexer.rb index <HASH>..<HASH> 100644 --- a/lib/solrizer/fedora/indexer.rb +++ b/lib/solrizer/fedora/indexer.rb @@ -59,7 +59,7 @@ class Indexer else if defined?(Rails.root.to_s) config_path = File.join(Rails.root.to_s, "config", "solr.yml") - yaml = YAML.load(File.open(File.join(config_path, "solr.yml"))) + yaml = YAML.load(File.open(config_path)) puts RAILS_ENV + "*****" solr_config = yaml[RAILS_ENV] puts solr_config.inspect
patch to indexer.rb for loading appropriate solr.yml file
samvera-deprecated_solrizer-fedora
train
rb
421a88fed1d2f14426f15158f3712ab563581327
diff --git a/lib/addressable/uri.rb b/lib/addressable/uri.rb index <HASH>..<HASH> 100644 --- a/lib/addressable/uri.rb +++ b/lib/addressable/uri.rb @@ -331,7 +331,10 @@ module Addressable return nil if component.nil? begin - if component.kind_of?(Symbol) || component.kind_of?(Numeric) + if component.kind_of?(Symbol) || + component.kind_of?(Numeric) || + component.kind_of?(TrueClass) || + component.kind_of?(FalseClass) component = component.to_s else component = component.to_str diff --git a/spec/addressable/uri_spec.rb b/spec/addressable/uri_spec.rb index <HASH>..<HASH> 100644 --- a/spec/addressable/uri_spec.rb +++ b/spec/addressable/uri_spec.rb @@ -2934,7 +2934,7 @@ describe Addressable::URI, "when parsed from " + end it "should have the correct query string after flag hash assignment" do - @uri.query_values = {'flag?1' => true, 'fl=ag2' => true, 'flag3' => true} + @uri.query_values = {'flag?1' => nil, 'fl=ag2' => nil, 'flag3' => nil} @uri.query.split("&").should include("flag%3F1") @uri.query.split("&").should include("fl%3Dag2") @uri.query.split("&").should include("flag3")
Wasn't handling boolean query values consistently.
sporkmonger_addressable
train
rb,rb
b1b46c6aba61d986bacbbca3cf212e906bdaa3af
diff --git a/test_isort.py b/test_isort.py index <HASH>..<HASH> 100644 --- a/test_isort.py +++ b/test_isort.py @@ -1095,6 +1095,7 @@ def test_placement_control(): test_output = SortImports(file_contents=test_input, known_first_party=['p24', 'p24.imports._VERSION'], known_standard_library=['p24.imports'], + known_third_party=['bottle'], default_section="THIRDPARTY").output assert test_output == ("import os\n" "import p24.imports._argparse as argparse\n" @@ -1106,10 +1107,11 @@ def test_placement_control(): "import p24.imports._VERSION as VERSION\n" "import p24.shared.media_wiki_syntax as syntax\n") + def test_sticky_comments(): """Test to ensure it is possible to make comments 'stick' above imports""" test_input = ("import os\n" "\n" - "# Used for type-hinting (ref: https://github.com/davidhalter/jedi/issues/414). isort:comment-above\n" + "# Used for type-hinting (ref: https://github.com/davidhalter/jedi/issues/414).\n" "from selenium.webdriver.remote.webdriver import WebDriver # noqa\n") - assert SortImports(file_contents=test_input).output == test_input \ No newline at end of file + assert SortImports(file_contents=test_input).output == test_input
Fix isort to assume that above comments auto get included instead of requiring manual adjustment
timothycrosley_isort
train
py
097e30a29923667a0a37e6a6d26cf23699f4ad93
diff --git a/registry/registry.go b/registry/registry.go index <HASH>..<HASH> 100644 --- a/registry/registry.go +++ b/registry/registry.go @@ -94,9 +94,6 @@ func (r *Registry) GetMachineJobs(machine *machine.Machine) map[string]job.Job { func (r *Registry) ScheduleJob(job *job.Job, machine *machine.Machine) { key := path.Join(keyPrefix, machinePrefix, machine.BootId, schedulePrefix, job.Name) r.Etcd.Set(key, job.Payload.Value, 0) - - key = path.Join(keyPrefix, schedulePrefix, job.Name) - r.Etcd.Delete(key) } // Persist the changes in a provided Machine's Job to Etcd with the provided TTL
refactor(registry): Stop deleting globally-scheduled Jobs The global schedule is the entrypoint for clients to ask the system to run something. These entries cannot be deleted as the scheduler will not be able to reschedule jobs that fail on any given Machine.
coreos_fleet
train
go
cf6c2fdda339f520f0ba7eca5bd59cf05ceb5ca6
diff --git a/lib/node_modules/@stdlib/repl/lib/namespace/b.js b/lib/node_modules/@stdlib/repl/lib/namespace/b.js index <HASH>..<HASH> 100644 --- a/lib/node_modules/@stdlib/repl/lib/namespace/b.js +++ b/lib/node_modules/@stdlib/repl/lib/namespace/b.js @@ -2019,6 +2019,14 @@ ns.push({ }); ns.push({ + 'alias': 'base.dist.kumaraswamy.Kumaraswamy', + 'path': '@stdlib/math/base/dist/kumaraswamy/ctor', + 'value': require( '@stdlib/math/base/dist/kumaraswamy/ctor' ), + 'type': 'Function', + 'related': [] +}); + +ns.push({ 'alias': 'base.dist.kumaraswamy.kurtosis', 'path': '@stdlib/math/base/dist/kumaraswamy/kurtosis', 'value': require( '@stdlib/math/base/dist/kumaraswamy/kurtosis' ),
Add kumaraswamy constructor to REPL
stdlib-js_stdlib
train
js
1cbfa0659151053795bf12d43137176f1cac066f
diff --git a/tests/unit/modules/localemod_test.py b/tests/unit/modules/localemod_test.py index <HASH>..<HASH> 100644 --- a/tests/unit/modules/localemod_test.py +++ b/tests/unit/modules/localemod_test.py @@ -59,16 +59,6 @@ class LocalemodTestCase(TestCase): MagicMock(return_value='A')}): self.assertEqual(localemod.get_locale(), '') - @patch('salt.utils.which', MagicMock(side_effect=['/usr/bin/localectl', None])) - def test_get_locale_debian(self): - with patch.dict(localemod.__grains__, {'os_family': ['Debian']}): - with patch.object(localemod, '_localectl_get', return_value=True): - self.assertTrue(localemod.get_locale()) - - with patch.dict(localemod.__salt__, {'cmd.run': - MagicMock(return_value='LC_ALL=C')}): - self.assertEqual(localemod.get_locale(), 'C') - def test_set_locale(self): ''' Test for Sets the current system locale
Remove heavily-mocked failing test
saltstack_salt
train
py
7142a7556354d9ec7d02941c12dd1636ace62460
diff --git a/lib/completionlib.php b/lib/completionlib.php index <HASH>..<HASH> 100644 --- a/lib/completionlib.php +++ b/lib/completionlib.php @@ -467,7 +467,7 @@ class completion_info { * calling the involved module via modulename_get_completion_state() to check * module-specific conditions. * - * @param stdClass|cm $cm_info Course-module + * @param stdClass|cm_info $cm Course-module * @param int $possibleresult Expected completion result. If the event that * has just occurred (e.g. add post) can only result in making the activity * complete when it wasn't before, use COMPLETION_COMPLETE. If the event that @@ -1318,4 +1318,4 @@ class completion_info { unset($SESSION->completioncache); unset($SESSION->completioncacheuserid); } -} \ No newline at end of file +}
MDL-<I> completion: switch one type & name for correctness
moodle_moodle
train
php
e85fe8330bd40de517da34dfd7e5c99e92811de3
diff --git a/Gruntfile.js b/Gruntfile.js index <HASH>..<HASH> 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -71,7 +71,8 @@ module.exports = function(grunt) { 'tmp/compress_mangle_beautify.js': ['test/fixtures/src/simple.js'] }, options: { - beautify: true + beautify: true, + footer: '\n// This is a footer.' } }, enclose: { diff --git a/test/fixtures/expected/compress_mangle_beautify.js b/test/fixtures/expected/compress_mangle_beautify.js index <HASH>..<HASH> 100644 --- a/test/fixtures/expected/compress_mangle_beautify.js +++ b/test/fixtures/expected/compress_mangle_beautify.js @@ -2,4 +2,5 @@ function longFunctionC(a, b) { return longNameA + longNameB + a + b; } -var longNameA = 1, longNameB = 2, result = longFunctionC(3, 4); \ No newline at end of file +var longNameA = 1, longNameB = 2, result = longFunctionC(3, 4); +// This is a footer. \ No newline at end of file
Includes the footer option in the unit tests Fixes #<I>
gruntjs_grunt-contrib-uglify
train
js,js
0b37dd02be447bba3352783f1f00df69d5465442
diff --git a/any_urlfield/tests.py b/any_urlfield/tests.py index <HASH>..<HASH> 100644 --- a/any_urlfield/tests.py +++ b/any_urlfield/tests.py @@ -244,7 +244,7 @@ class AnyUrlTests(TestCase): fields = ('url',) # Test showing the form - instance = UrlModel.objects.create(url='http://examle.org/') + instance = UrlModel.objects.create(url=AnyUrlValue.from_db_value('http://example.org/')) form = UrlModelForm(instance=instance) self.assertIsInstance(form.fields['url'], any_urlfield.forms.AnyUrlField)
Fixed unit tests for Django <I>+ Type needs to be the real Python type, not db value
edoburu_django-any-urlfield
train
py
293d3fb5d3fa768bb7efb7e8b71e9c51cac357ae
diff --git a/plenum/server/plugin/stats_consumer/stats_publisher.py b/plenum/server/plugin/stats_consumer/stats_publisher.py index <HASH>..<HASH> 100644 --- a/plenum/server/plugin/stats_consumer/stats_publisher.py +++ b/plenum/server/plugin/stats_consumer/stats_publisher.py @@ -39,9 +39,13 @@ class StatsPublisher: self.writer.write((message + '\n').encode('utf-8')) await self.writer.drain() except (ConnectionRefusedError, ConnectionResetError) as ex: - logger.debug("Connection refused for {}:{} while sending message". - format(self.ip, self.port)) + logger.debug("Connection refused for {}:{} while sending message: {}". + format(self.ip, self.port), ex) self.writer = None + except Exception as ex1: + logger.debug("Can not publish stats message: {}".format(ex1)) + self.writer = None + def send(self, message): if len(self.messageBuffer) > config.STATS_SERVER_MESSAGE_BUFFER_MAX_SIZE:
a possible fix for assertation eror
hyperledger_indy-plenum
train
py
7682a95b3607bf92a20a4dfef92153efa5a3049c
diff --git a/lib/index.js b/lib/index.js index <HASH>..<HASH> 100644 --- a/lib/index.js +++ b/lib/index.js @@ -1,7 +1,7 @@ var crypto = require('crypto'); var randomEnoughBytes = require('random-enough'); var Buffer = require('buffer').Buffer; -var Hoek = require('Hoek'); +var Hoek = require('hoek'); var internals = {};
Hoek module is now lower case
alivesay_catbox-crypto
train
js
a9e02ca8bf89390c22a48d09446d0067e561f0dd
diff --git a/lib/specjour/worker.rb b/lib/specjour/worker.rb index <HASH>..<HASH> 100644 --- a/lib/specjour/worker.rb +++ b/lib/specjour/worker.rb @@ -28,7 +28,7 @@ module Specjour def run Kernel.puts "Running #{specs_to_run.size} spec files..." pid = Process.fork do - set_test_env_number + set_env_variables Dir.chdir(project_path) do ::Spec::Runner::CommandLine.run( ::Spec::Runner::OptionParser.parse( @@ -115,7 +115,8 @@ module Specjour DNSSD.register "specjour_worker_#{object_id}", "_#{drb_uri.scheme}._tcp", nil, drb_uri.port end - def set_test_env_number + def set_env_variables + ENV['PREPARE_DB'] = 'true' if number > 1 ENV['TEST_ENV_NUMBER'] = number.to_s end
Hook for rspec to run db:test:load
sandro_specjour
train
rb
562ccf6a094f9ec257eb6c2ed22bca0faee7b503
diff --git a/lib/Doctrine/Common/Cache/FileCache.php b/lib/Doctrine/Common/Cache/FileCache.php index <HASH>..<HASH> 100644 --- a/lib/Doctrine/Common/Cache/FileCache.php +++ b/lib/Doctrine/Common/Cache/FileCache.php @@ -134,8 +134,11 @@ abstract class FileCache extends CacheProvider $hash = hash('sha256', $id); // This ensures that the filename is unique and that there are no invalid chars in it. - if ('' === $id || strlen($id) * 2 + strlen($this->extension) > 255 || - (defined('PHP_WINDOWS_VERSION_BUILD') && strlen($this->directory) + 4 + strlen($id) * 2 + strlen($this->extension) > 259)) { + if ( + '' === $id + || ((strlen($id) * 2 + strlen($this->extension)) > 255) + || (defined('PHP_WINDOWS_VERSION_BUILD') && strlen($this->directory) + 4 + strlen($id) * 2 + strlen($this->extension) > 259) + ) { // Most filesystems have a limit of 255 chars for each path component. On Windows the the whole path is limited // to 260 chars (including terminating null char). Using long UNC ("\\?\" prefix) does not work with the PHP API. // So if the id in hex representation would surpass the limit, we use the hash instead. The prefix prevents
#<I> - Wrapping decision boolean logic in parentheses (for readability)
doctrine_cache
train
php
93becd1de3d9d59f0fbb47a0145a74dba45699d0
diff --git a/meepo/apps/mprint.py b/meepo/apps/mprint.py index <HASH>..<HASH> 100644 --- a/meepo/apps/mprint.py +++ b/meepo/apps/mprint.py @@ -24,4 +24,6 @@ def main(mysql_dsn, tables, blocking=False, debug=False): level = "DEBUG" if debug else "INFO" setup_logger(level) print_sub(tables) - mysql_pub(mysql_dsn, blocking=blocking) + + pub_tables = tables if tables else None + mysql_pub(mysql_dsn, tables=pub_tables, blocking=blocking)
pass command tables arg to mysql_pub
eleme_meepo
train
py
eea761d6755781f862c21845c83101bbc64624fd
diff --git a/src/Validation/Validator.php b/src/Validation/Validator.php index <HASH>..<HASH> 100644 --- a/src/Validation/Validator.php +++ b/src/Validation/Validator.php @@ -278,7 +278,7 @@ class Validator implements ArrayAccess, IteratorAggregate, Countable * ->add('user_id', 'valid', ['rule' => 'numeric', 'message' => 'Invalid User']) * * $validator->add('password', [ - * 'size' => ['rule' => ['between', 8, 20]], + * 'size' => ['rule' => ['lengthBetween', 8, 20]], * 'hasSpecialCharacter' => ['rule' => 'validateSpecialchar', 'message' => 'not valid'] * ]); * ```
Between is not a valid rule in the core Using a rule that is valid in the core to not confuse people.
cakephp_cakephp
train
php
5857307e11314821b53bd4b1380a0e2bd90c5bf0
diff --git a/mistletoe/block_token.py b/mistletoe/block_token.py index <HASH>..<HASH> 100644 --- a/mistletoe/block_token.py +++ b/mistletoe/block_token.py @@ -256,7 +256,7 @@ class CodeFence(BlockToken): if not match_obj: return False prepend, leader, lang = match_obj.groups() - if leader[0] in lang: + if leader[0] in lang or leader[0] in line[match_obj.end():]: return False cls._open_info = len(prepend), leader, lang return True @@ -268,7 +268,9 @@ class CodeFence(BlockToken): for line in lines: stripped_line = line.lstrip(' ') diff = len(line) - len(stripped_line) - if stripped_line.startswith(cls._open_info[1]) and diff < 4: + if (stripped_line.startswith(cls._open_info[1]) + and len(stripped_line.split(maxsplit=1)) == 1 + and diff < 4): break if diff > cls._open_info[0]: stripped_line = ' ' * (diff - cls._open_info[0]) + stripped_line
fully compliant CodeFence (#<I>)
miyuchina_mistletoe
train
py
1bc3ec11001677b120b9e7de5bf0cefc27a393b1
diff --git a/spec/unit/network/http/factory_spec.rb b/spec/unit/network/http/factory_spec.rb index <HASH>..<HASH> 100755 --- a/spec/unit/network/http/factory_spec.rb +++ b/spec/unit/network/http/factory_spec.rb @@ -28,4 +28,10 @@ describe Puppet::Network::HTTP::Factory do expect(conn).to_not be_started end + + it 'creates a connection supporting at least HTTP 1.1' do + conn = create_connection(site) + + expect(any_of(conn.class.version_1_1?, conn.class.version_1_1?)).to be_true + end end
(PUP-<I>) Ensure connections we create support at least HTTP <I> When starting a persistent HTTP connection, we do not expliclty specify `Connection: Keep-Alive`, because that is the default in HTTP/<I>[1]. This commit adds a test to ensure we are using HTTP <I> or later. Amazingly ruby has defaulted to <I> as far back as ruby <I>[2]. [1] <URL>
puppetlabs_puppet
train
rb
21309cc8d4e8fddc07e21d3636575055a3b3e661
diff --git a/packages/babylon/test/helpers/runFixtureTests.js b/packages/babylon/test/helpers/runFixtureTests.js index <HASH>..<HASH> 100644 --- a/packages/babylon/test/helpers/runFixtureTests.js +++ b/packages/babylon/test/helpers/runFixtureTests.js @@ -12,9 +12,9 @@ export function runFixtureTests(fixturesPath, parseFunction) { try { runTest(task, parseFunction); } catch (err) { - const message = + err.message = name + "/" + task.actual.filename + ": " + err.message; - throw new Error(message); + throw err; } }); }); @@ -39,9 +39,9 @@ export function runThrowTestsWithEstree(fixturesPath, parseFunction) { try { runTest(task, parseFunction); } catch (err) { - const message = + err.message = name + "/" + task.actual.filename + ": " + err.message; - throw new Error(message); + throw err; } }); });
Make these tests re-throw the same error to keep the trace.
babel_babel
train
js
b3a92c5dbbdbc30a7636f5a9651b928bf4c3b5b1
diff --git a/pysoa/server/server.py b/pysoa/server/server.py index <HASH>..<HASH> 100644 --- a/pysoa/server/server.py +++ b/pysoa/server/server.py @@ -372,9 +372,16 @@ class Server(object): except ImportError as e: raise ValueError('Cannot import settings module %s: %s' % (cmd_options.settings, e)) try: - settings_dict = getattr(settings_module, 'settings') + settings_dict = getattr(settings_module, 'SOA_SERVER_SETTINGS') except AttributeError: - raise ValueError('Cannot find settings variable in settings module %s' % cmd_options.settings) + try: + settings_dict = getattr(settings_module, 'settings') + except AttributeError: + raise ValueError( + "Cannot find 'SOA_SERVER_SETTINGS' or 'settings' variable in settings module {}.".format( + cmd_options.settings, + ) + ) settings = cls.settings_class(settings_dict) # Set up logging
Recognize either settings variable name non-Django services
eventbrite_pysoa
train
py
4ba7a79acac371acf7acc1def935ac6f1b155676
diff --git a/test/client/delete_by_query_test.rb b/test/client/delete_by_query_test.rb index <HASH>..<HASH> 100644 --- a/test/client/delete_by_query_test.rb +++ b/test/client/delete_by_query_test.rb @@ -58,6 +58,25 @@ describe Elastomer::Client::DeleteByQuery do response = $client.delete_by_query(nil, :action_count => 1) assert_equal(2, count) + assert_equal({ + '_all' => { + 'found' => 2, + 'deleted' => 2, + 'missing' => 0, + 'failed' => 0, + }, + @index.name => { + 'found' => 2, + 'deleted' => 2, + 'missing' => 0, + 'failed' => 0, + }, + }, response['_indices']) + + @index.refresh + response = @docs.multi_get :ids => [0, 1] + refute_found response['docs'][0] + refute_found response['docs'][1] end it 'counts missing documents' do
Add more assertions for a delete_by_query test
github_elastomer-client
train
rb
846da9f6f1838b317ae94499dcc5f155df659bc7
diff --git a/openquake/nrmllib/models.py b/openquake/nrmllib/models.py index <HASH>..<HASH> 100644 --- a/openquake/nrmllib/models.py +++ b/openquake/nrmllib/models.py @@ -19,6 +19,7 @@ serializers. """ from collections import OrderedDict +from collections import namedtuple class SourceModel(object): @@ -557,3 +558,7 @@ class HazardCurveModel(object): def __iter__(self): return self._data_iter + + +HazardCurveData = namedtuple('HazardCurveData', 'location poes') +Location = namedtuple('Location', 'x y')
models: Added HazardCurveData and Location container classes. These are used by the hazard curve xml parser.
gem_oq-engine
train
py
97f80124fdf52bfbe48ed9b124625125d4055e0e
diff --git a/hebel/layers/logistic_layer.py b/hebel/layers/logistic_layer.py index <HASH>..<HASH> 100644 --- a/hebel/layers/logistic_layer.py +++ b/hebel/layers/logistic_layer.py @@ -289,6 +289,7 @@ class LogisticLayer(TopLayer): loss = cross_entropy_logistic(activations, targets) if average: loss /= targets.shape[0] + assert np.isfinite(loss) return loss train_error = cross_entropy_error @@ -308,4 +309,5 @@ class LogisticLayer(TopLayer): class_error = np.sum((activations.get() >= .5) != (targets >= .5)) if average: class_error = float(class_error) / targets.shape[0] + assert np.isfinite(class_error) return class_error diff --git a/hebel/models/neural_net.py b/hebel/models/neural_net.py index <HASH>..<HASH> 100644 --- a/hebel/models/neural_net.py +++ b/hebel/models/neural_net.py @@ -322,6 +322,8 @@ class NeuralNet(Model): loss, hidden_cache, logistic_cache = self.evaluate( input_data, targets, return_cache=True, prediction=False) + assert np.isfinite(loss) + # Backpropagation if self.hidden_layers: hidden_activations = hidden_cache[-1][0]
Assert that loss is not nan
hannes-brt_hebel
train
py,py
5311565223cca0158cb44f4fffa812ce8dd4a4c8
diff --git a/test/unit/ajax.js b/test/unit/ajax.js index <HASH>..<HASH> 100644 --- a/test/unit/ajax.js +++ b/test/unit/ajax.js @@ -298,19 +298,15 @@ test("ajax cache", function () { }); test("global ajaxSettings", function() { - expect(3); + expect(2); var tmp = jQuery.extend({}, jQuery.ajaxSettings); - var orig = { url: "data/with_fries.xml", data: null }; + var orig = { url: "data/with_fries.xml" }; var t; $.ajaxSetup({ data: {foo: 'bar', bar: 'BAR'} }); t = jQuery.extend({}, orig); - $.ajax(t); - ok( t.url.indexOf('foo') > -1 && t.url.indexOf('bar') > -1, "Check extending null" ); - - t = jQuery.extend({}, orig); t.data = {}; $.ajax(t); ok( t.url.indexOf('foo') > -1 && t.url.indexOf('bar') > -1, "Check extending {}" );
ajax test: Removed test for extending with null.
jquery_jquery
train
js
c0f7558fbb951109a199af3f5a41a63fbfcf422c
diff --git a/libxml/test/Attribute_test.go b/libxml/test/Attribute_test.go index <HASH>..<HASH> 100644 --- a/libxml/test/Attribute_test.go +++ b/libxml/test/Attribute_test.go @@ -23,7 +23,19 @@ func TestAttributeFetch(t *testing.T) { if didCreate == false { t.Error("Should be a new attribute") } - if !(strings.Contains(doc.String(), "created")) { + if !(strings.Contains(doc.String(), "created=\"\"")) { t.Error("Should have the 'created' attr in it") } + attribute, _ = node.Attribute("existing") + if attribute.Name() != "existing" { + t.Error("Name isn't working with attributes") + } + attribute.SetName("worked") + if !(strings.Contains(doc.String(), "worked=\"true\"")) { + t.Error("Should have the 'worked' attr in it") + } + if strings.Contains(doc.String(), "existing") { + t.Error("Existing attribute should be gone now") + } + } \ No newline at end of file
Adding in a battery of tests
moovweb_gokogiri
train
go
2fed2981125e0d191d61ff842dc034cf398c9fee
diff --git a/src/main/java/com/pinterest/secor/parser/MessageParser.java b/src/main/java/com/pinterest/secor/parser/MessageParser.java index <HASH>..<HASH> 100644 --- a/src/main/java/com/pinterest/secor/parser/MessageParser.java +++ b/src/main/java/com/pinterest/secor/parser/MessageParser.java @@ -41,7 +41,10 @@ public abstract class MessageParser { public MessageParser(SecorConfig config) { mConfig = config; - if (mConfig.getMessageTimestampName() != null && mConfig.getMessageTimestampNameSeparator() != null) { + if (mConfig.getMessageTimestampName() != null && + !mConfig.getMessageTimestampName().isEmpty() && + mConfig.getMessageTimestampNameSeparator() != null && + !mConfig.getMessageTimestampNameSeparator().isEmpty()) { String separatorPattern = Pattern.quote(mConfig.getMessageTimestampNameSeparator()); mNestedFields = mConfig.getMessageTimestampName().split(separatorPattern); }
Fix a regresion on JsonMessageParser where the timestamp separator is checked against null, not empty string This was a recent checkin by open source community, looks like the check is not complete (only checked against null, not empty string), this caused the timestamp field cannot be retrieved.
pinterest_secor
train
java
3ac7d11eaa0b76dad53785bf2efe0acb8bf36429
diff --git a/pylint/config/utils.py b/pylint/config/utils.py index <HASH>..<HASH> 100644 --- a/pylint/config/utils.py +++ b/pylint/config/utils.py @@ -203,6 +203,7 @@ def _enable_all_extensions(run: Run, value: str | None) -> None: PREPROCESSABLE_OPTIONS: dict[ str, tuple[bool, Callable[[Run, str | None], None], int] ] = { # pylint: disable=consider-using-namedtuple-or-dataclass + # pylint: disable=useless-suppression, wrong-spelling-in-comment # Argparse by default allows abbreviations. It behaves differently # if you turn this off, so we also turn it on. We mimic this # by allowing some abbreviations or incorrect spelling here.
[spellcheck] Fix the spellcheck hopefully for all environments (#<I>)
PyCQA_pylint
train
py
bf0496e62e2a8e4a5bbbbf8674bd5e72632879d0
diff --git a/spec/lib/http_log_spec.rb b/spec/lib/http_log_spec.rb index <HASH>..<HASH> 100644 --- a/spec/lib/http_log_spec.rb +++ b/spec/lib/http_log_spec.rb @@ -263,14 +263,17 @@ describe HttpLog do it { is_expected.to include("[httplog] Data:\n") } end - context 'with prefix_response_lines enabled' do - let(:prefix_response_lines) { true } - it { is_expected.to include('[httplog] <head>') } - it { is_expected.to include('[httplog] <title>Test Page</title>') } - - context 'and blank response' do - let(:path) { '/empty.txt' } - it { is_expected.to include("[httplog] Response:\n") } + unless adapter_class == OpenUriAdapter # Doesn't support response logging + context 'with prefix_response_lines enabled' do + let(:prefix_response_lines) { true } + + it { is_expected.to include('[httplog] <head>') } + it { is_expected.to include('[httplog] <title>Test Page</title>') } + + context 'and blank response' do + let(:path) { '/empty.txt' } + it { is_expected.to include("[httplog] Response:\n") } + end end end
fix for OpenUriAdapter
trusche_httplog
train
rb
771b41a490a0e7ff0d6abfa5969390c3da429498
diff --git a/panwid/datatable/rows.py b/panwid/datatable/rows.py index <HASH>..<HASH> 100644 --- a/panwid/datatable/rows.py +++ b/panwid/datatable/rows.py @@ -1,5 +1,4 @@ import functools -from collections import MutableMapping import itertools import urwid
Remove unnecessary (and now incompatible) import from rows.py
tonycpsu_panwid
train
py
71d155704ba2614f27684c622863727084a4b9d1
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -13,7 +13,7 @@ setuptools.setup( url='http://github.com/EmbodiedCognition/py-c3d', keywords=('c3d motion-capture'), install_requires=['numpy'], - scripts=['scripts/c3d-viewer', 'scripts/c3d2csv'], + scripts=['scripts/c3d-metadata', 'scripts/c3d-viewer', 'scripts/c3d2csv'], classifiers=[ 'Development Status :: 4 - Beta', 'Intended Audience :: Science/Research',
Install c3d-metadata script as part of the package.
EmbodiedCognition_py-c3d
train
py
3e92bf0fc62c3728cf1c3ae2ea579596cd363c43
diff --git a/lib/squib/graphics/image.rb b/lib/squib/graphics/image.rb index <HASH>..<HASH> 100644 --- a/lib/squib/graphics/image.rb +++ b/lib/squib/graphics/image.rb @@ -1,4 +1,15 @@ module Squib + + # Cache all pngs we've already loaded + # + # :nodoc: + # @api private + def cache_load_image(file) + @img_cache ||= {} + @img_cache[file] || @img_cache[file] = Cairo::ImageSurface.from_png(file) + end + module_function :cache_load_image + class Card # :nodoc: @@ -6,7 +17,7 @@ module Squib def png(file, x, y, alpha) return if file.nil? or file.eql? '' cc = cairo_context - png = Cairo::ImageSurface.from_png(file) + png = Squib.cache_load_image(file) cc.set_source(png, x, y) cc.paint(alpha) end
Added a (currently infinite) cache of loaded pngs
andymeneely_squib
train
rb
153061c41037e2e6c8d2a9e60afa5f84b8041b16
diff --git a/rapidoid-gui/src/main/java/org/rapidoid/gui/base/BootstrapWidgets.java b/rapidoid-gui/src/main/java/org/rapidoid/gui/base/BootstrapWidgets.java index <HASH>..<HASH> 100644 --- a/rapidoid-gui/src/main/java/org/rapidoid/gui/base/BootstrapWidgets.java +++ b/rapidoid-gui/src/main/java/org/rapidoid/gui/base/BootstrapWidgets.java @@ -419,8 +419,11 @@ public abstract class BootstrapWidgets extends HTML { List<Object> grids = U.list(); for (Map.Entry<String, Map<?, ?>> entry : maps.entrySet()) { - grids.add(h4(b(entry.getKey(), ":"))); - grids.add(grid(entry.getValue())); + String key = entry.getKey(); + Map<?, ?> map = entry.getValue(); + + grids.add(h4(b(key, ":"))); + grids.add(grid(map)); } return grids;
Minor improvement of the grid factory utils.
rapidoid_rapidoid
train
java
f96c6a73a883c0b5b31d235386080498d9a96110
diff --git a/src/native/index.js b/src/native/index.js index <HASH>..<HASH> 100644 --- a/src/native/index.js +++ b/src/native/index.js @@ -16,7 +16,7 @@ const styled = (tag: Target) => /* React native lazy-requires each of these modules for some reason, so let's * assume it's for a good reason and not eagerly load them all */ -const aliases = `ActivityIndicator ActivityIndicatorIOS ART DatePickerIOS DrawerLayoutAndroid +const aliases = `ActivityIndicator ActivityIndicatorIOS ART Button DatePickerIOS DrawerLayoutAndroid Image ImageEditor ImageStore KeyboardAvoidingView ListView MapView Modal Navigator NavigatorIOS Picker PickerIOS ProgressBarAndroid ProgressViewIOS ScrollView SegmentedControlIOS Slider SliderIOS SnapshotViewIOS Switch RecyclerViewBackedScrollView RefreshControl StatusBar
adding the <Button> of react-native entry point Official button component was introduced in react-native@<I>
styled-components_styled-components
train
js
dc606bb5ef6f5da2f342aeb57060793064f4eb7a
diff --git a/lib/helpers.js b/lib/helpers.js index <HASH>..<HASH> 100644 --- a/lib/helpers.js +++ b/lib/helpers.js @@ -6,6 +6,10 @@ var parser = require('./parser'), // Returns TRUE if the passed string is a valid javascript string literal exports.isStringLiteral = function (string) { + if (typeof string !== 'string') { + return false; + } + var first = string.substring(0, 1), last = string.charAt(string.length - 1, 1), teststr;
check if the input is actually a string before checking if it's a string literal
Thunf_swiger
train
js
91424f89b6e34a9bb6c26fa927afb3e19e2418e5
diff --git a/wunderline-add.js b/wunderline-add.js index <HASH>..<HASH> 100644 --- a/wunderline-add.js +++ b/wunderline-add.js @@ -149,13 +149,16 @@ function main () { }, function (task, cb) { if (app.subtask) { - api.post({url: '/subtasks', body: { task_id: task.id, title: app.subtask, completed: false }}, function (err, res, body) { - if (err || body.error) { - console.error(JSON.stringify(err || body.error, null, 2)) - process.exit(1) - } - - cb(null, task) + var subtasks = app.subtask.reverse() + subtasks.forEach(stask => { + api.post({url: '/subtasks', body: { task_id: task.id, title: stask, completed: false }}, function (err, res, body) { + if (err || body.error) { + console.error(JSON.stringify(err || body.error, null, 2)) + process.exit(1) + } + + cb(null, task) + }) }) } else { cb(null, task)
Iterate over subtasks and send a POST request for each
wayneashleyberry_wunderline
train
js
ee30f46f38248d84b8c24d0541f400ceb03f407b
diff --git a/robotium-solo/src/main/java/com/jayway/android/robotium/solo/Solo.java b/robotium-solo/src/main/java/com/jayway/android/robotium/solo/Solo.java index <HASH>..<HASH> 100644 --- a/robotium-solo/src/main/java/com/jayway/android/robotium/solo/Solo.java +++ b/robotium-solo/src/main/java/com/jayway/android/robotium/solo/Solo.java @@ -2177,17 +2177,6 @@ public class Solo { public void finalize() throws Throwable { activityUtils.finalize(); } - - /** - * All inactive activities are finished. - * - * @deprecated Method has been deprecated as there are no longer strong references to activities. - * - */ - - public void finishInactiveActivities(){ - activityUtils.finishInactiveActivities(); - } /** * The activities that are alive are finished. Usually used in tearDown().
Removed the deprecated method finishInactiveActivities
RobotiumTech_robotium
train
java
5516576e1a1882a604cb11f234265f97d7ff1b57
diff --git a/google/datalab/ml/_cloud_models.py b/google/datalab/ml/_cloud_models.py index <HASH>..<HASH> 100644 --- a/google/datalab/ml/_cloud_models.py +++ b/google/datalab/ml/_cloud_models.py @@ -168,12 +168,13 @@ class ModelVersions(object): name = ('%s/versions/%s' % (self._full_model_name, version_name)) return self._api.projects().models().versions().get(name=name).execute() - def deploy(self, version_name, path): + def deploy(self, version_name, path, runtime_version='1.0'): """Deploy a model version to the cloud. Args: version_name: the name of the version in short form, such as "v1". path: the Google Cloud Storage path (gs://...) which contains the model files. + runtime_version: the runtime version as a string. Raises: Exception if the path is invalid or does not contain expected files. Exception if the service returns invalid response. @@ -202,7 +203,7 @@ class ModelVersions(object): body = { 'name': version_name, 'deployment_uri': path, - 'runtime_version': '1.0', + 'runtime_version': runtime_version, } response = self._api.projects().models().versions().create( body=body, parent=self._full_model_name).execute()
versions support runtime version (#<I>)
googledatalab_pydatalab
train
py
339601a8a353052dcc08e662295be998ccdf318e
diff --git a/framework/core/js/src/forum/components/Composer.js b/framework/core/js/src/forum/components/Composer.js index <HASH>..<HASH> 100644 --- a/framework/core/js/src/forum/components/Composer.js +++ b/framework/core/js/src/forum/components/Composer.js @@ -199,7 +199,7 @@ export default class Composer extends Component { */ animatePositionChange() { // When exiting full-screen mode: focus content - if (this.prevPosition === ComposerState.Position.FULLSCREEN) { + if (this.prevPosition === ComposerState.Position.FULLSCREEN && this.state.position === ComposerState.Position.NORMAL) { this.focus(); return; }
Fix exiting composer while in fullscreen mode.
flarum_core
train
js
52c8bbc83827dfd5c9f8752892cd0adaa6c4ef0b
diff --git a/lib/ffi-icu/uchar.rb b/lib/ffi-icu/uchar.rb index <HASH>..<HASH> 100644 --- a/lib/ffi-icu/uchar.rb +++ b/lib/ffi-icu/uchar.rb @@ -1,10 +1,10 @@ -require 'iconv' - module ICU class UCharPointer < FFI::MemoryPointer def self.from_string(str) - super Iconv.conv("wchar_t", "utf-8", str.encode("UTF-8")) + # not sure how this will work with other encodings + str = str.encode("UTF-8") if str.respond_to? :encode + super str.unpack("U*").pack("L*") end end
Get rid of iconv, collation now is reasonably fast
fantasticfears_ffi-icu
train
rb
0190e9cbe68c8217f6c50e85c1717cff23cc298d
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ from setuptools import setup, find_packages setup( name='PyBundle', - version='1.0.3', + version='1.0.4', packages=find_packages(), url='https://github.com/mrstephenneal/PyBundle', license='MIT',
Updated to version <I> and fixed issue with frozen_bundle stack trace
mrstephenneal_PyBundle
train
py