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
8047415630b5fcf569d7199b6eb7daf90e380373
diff --git a/lib/dm-core/query.rb b/lib/dm-core/query.rb index <HASH>..<HASH> 100644 --- a/lib/dm-core/query.rb +++ b/lib/dm-core/query.rb @@ -486,10 +486,10 @@ module DataMapper # # @api semipublic def filter_records(records) - records = records.uniq if unique? - records = match_records(records) - records = sort_records(records) - records = limit_records(records) + records = records.uniq if unique? + records = match_records(records) if conditions + records = sort_records(records) if order + records = limit_records(records) if limit || offset > 0 records end @@ -504,7 +504,6 @@ module DataMapper # @api semipublic def match_records(records) conditions = self.conditions - return records if conditions.nil? records.select { |record| conditions.matches?(record) } end
Updated Query#filter_records to have guard clauses for each method it calls
datamapper_dm-core
train
rb
6c9292aee75b7886c043fadb2e34455fdf3f5463
diff --git a/test/cli/test_run.py b/test/cli/test_run.py index <HASH>..<HASH> 100644 --- a/test/cli/test_run.py +++ b/test/cli/test_run.py @@ -17,6 +17,7 @@ from nameko.constants import ( from nameko.exceptions import CommandError from nameko.runners import ServiceRunner from nameko.standalone.rpc import ClusterRpcProxy +from nameko.testing.waiting import wait_for_call from test.sample import Service @@ -35,8 +36,10 @@ def test_run(rabbit_config): 0, 'test.sample:Service', ]) - gt = eventlet.spawn(main, args) - eventlet.sleep(1) + + # start runner and wait for it to come up + with wait_for_call(ServiceRunner, 'start'): + gt = eventlet.spawn(main, args) # make sure service launches ok with ClusterRpcProxy(rabbit_config) as proxy: @@ -116,8 +119,9 @@ def test_main_with_logging_config(rabbit_config, tmpdir): 'test.sample', ]) - gt = eventlet.spawn(main, args) - eventlet.sleep(1) + # start runner and wait for it to come up + with wait_for_call(ServiceRunner, 'start'): + gt = eventlet.spawn(main, args) with ClusterRpcProxy(rabbit_config) as proxy: proxy.service.ping()
use waiter rather than sleeping for runner to come up
nameko_nameko
train
py
04ffe9508c8b687c88987d261ba606d7d8f7b990
diff --git a/scout/server/links.py b/scout/server/links.py index <HASH>..<HASH> 100644 --- a/scout/server/links.py +++ b/scout/server/links.py @@ -420,7 +420,7 @@ def ensembl_link(variant_obj, build=37): """Compose (sv) variant link to ensembl""" my_end = variant_obj["end"] - if variant_obj["chromosome"] != variant_obj["end_chrom"]: + if variant_obj["chromosome"] != variant_obj.get("end_chrom"): my_end = variant_obj["position"] if build == 37: @@ -434,7 +434,7 @@ def decipher_link(variant_obj, build=37): """Compose DECIPHER SV variant links""" my_end = variant_obj["end"] - if variant_obj["chromosome"] != variant_obj["end_chrom"]: + if variant_obj["chromosome"] != variant_obj.get("end_chrom"): my_end = variant_obj["position"] if build == 37:
fix missing end_chrom key when creating links
Clinical-Genomics_scout
train
py
3102622add56cbab05f3dce2b67554304cbf1d3a
diff --git a/mod/quiz/format.php b/mod/quiz/format.php index <HASH>..<HASH> 100644 --- a/mod/quiz/format.php +++ b/mod/quiz/format.php @@ -148,6 +148,13 @@ class quiz_default_format { // Export functions + function export_file_extension() { + /// return the files extension appropriate for this type + /// override if you don't want .txt + + return ".txt"; + } + function exportpreprocess($category, $course) { /// Does any pre-processing that may be desired @@ -191,7 +198,7 @@ class quiz_default_format { } // write file - $filepath = $path."/".$filename; + $filepath = $path."/".$filename . $this->export_file_extension(); if (!$fh=fopen($filepath,"w")) { error("Cannot open for writing: $filepath"); }
Changed export part so that export file extension can be changed by overriding export_file_extension() method
moodle_moodle
train
php
e195b48f21bac800dbad5acc04ac732930d36c35
diff --git a/ci/ci_build.rb b/ci/ci_build.rb index <HASH>..<HASH> 100755 --- a/ci/ci_build.rb +++ b/ci/ci_build.rb @@ -19,7 +19,7 @@ puts "[CruiseControl] Rails build" build_results = {} # Install required version of bundler. -bundler_install_cmd = "gem install bundler -v 0.9.3 --no-ri --no-rdoc" +bundler_install_cmd = "gem install bundler -v 0.9.6 --no-ri --no-rdoc" puts "Running command: #{bundler_install_cmd}" build_results[:install_bundler] = system bundler_install_cmd
Have CI use the current version of bundler
rails_rails
train
rb
cbed73d0dd1b1a8bb672ceac3dc8c0e1f4587036
diff --git a/src/plone/app/mosaic/browser/static/js/mosaic.layout.js b/src/plone/app/mosaic/browser/static/js/mosaic.layout.js index <HASH>..<HASH> 100644 --- a/src/plone/app/mosaic/browser/static/js/mosaic.layout.js +++ b/src/plone/app/mosaic/browser/static/js/mosaic.layout.js @@ -1143,11 +1143,11 @@ define([ } // Notify user - $.plone.notify({ - title: "Info", - message: "You can't have more then 4 columns", - sticky: false - }); + //$.plone.notify({ + // title: "Info", + // message: "You can't have more then 4 columns", + // sticky: false + //}); // Dropped on row } else {
Comment failing plone.notify call, because missing notify framework
plone_plone.app.mosaic
train
js
6419fd58f8bac5c74dbb9064f4fe37af57506033
diff --git a/src/test/java/edu/jhu/pacaya/util/JUnitUtils.java b/src/test/java/edu/jhu/pacaya/util/JUnitUtils.java index <HASH>..<HASH> 100644 --- a/src/test/java/edu/jhu/pacaya/util/JUnitUtils.java +++ b/src/test/java/edu/jhu/pacaya/util/JUnitUtils.java @@ -57,4 +57,22 @@ public class JUnitUtils { } } + public static void assertArrayEquals(String[][][] a1, String[][][] a2) { + Assert.assertEquals(a1.length, a2.length); + for (int i=0; i<a1.length; i++) { + assertArrayEquals(a1[i], a2[i]); + } + } + + public static void assertArrayEquals(String[][] a1, String[][] a2) { + Assert.assertEquals(a1.length, a2.length); + for (int i=0; i<a1.length; i++) { + assertArrayEquals(a1[i], a2[i]); + } + } + + public static void assertArrayEquals(String[] a1, String[] a2) { + Assert.assertArrayEquals(a1, a2); + } + }
Bug fix: NerEvaluator wasn't correctly evaluating conlleval style F1 on chunks
mgormley_pacaya
train
java
a5eec52d49d1ad6334d989cdc4ba66dad05efe26
diff --git a/barcode/ean.py b/barcode/ean.py index <HASH>..<HASH> 100755 --- a/barcode/ean.py +++ b/barcode/ean.py @@ -41,6 +41,9 @@ class EuropeanArticleNumber13(Barcode): ean = ean[:self.digits] if not ean.isdigit(): raise IllegalCharacterError('EAN code can only contain numbers.') + if len(ean) != self.digits: + raise NumberOfDigitsError('EAN must have {0} digits, not ' + '{1}.'.format(self.digits, len(ean))) self.ean = ean self.ean = '{0}{1}'.format(ean, self.calculate_checksum()) self.writer = writer or Barcode.default_writer()
Adding the same length check and exception as for PZN.
WhyNotHugo_python-barcode
train
py
4aa934bf556683ba23d495bec3adda7ffc2d0ac2
diff --git a/index.js b/index.js index <HASH>..<HASH> 100644 --- a/index.js +++ b/index.js @@ -173,7 +173,7 @@ prototype._flush = function (callback) { if (missingBytes !== 0) { var error = new Error('incomplete blob') error.incomplete = true - error.missingBytes = this.missingBytes + error.missingBytes = missingBytes this.emit('error', error) } callback()
Fix missing bytes properties of error objects
kemitchell_blob-log-decoder.js
train
js
3da164982817828aa5f7d9e2158c04ce40ee5f55
diff --git a/activemodel/test/cases/railtie_test.rb b/activemodel/test/cases/railtie_test.rb index <HASH>..<HASH> 100644 --- a/activemodel/test/cases/railtie_test.rb +++ b/activemodel/test/cases/railtie_test.rb @@ -5,10 +5,10 @@ class RailtieTest < ActiveModel::TestCase include ActiveSupport::Testing::Isolation def setup - require 'rails/all' + require 'active_model/railtie' - @app ||= Class.new(::Rails::Application).tap do |app| - app.config.eager_load = false + @app ||= Class.new(::Rails::Application) do + config.eager_load = false end end
Require active_model/railtie directly instead of rails/all Use Class.new with a block instead of tap to configure it.
rails_rails
train
rb
20273cf6198217dd34b6f5bf00c127b8140f99bf
diff --git a/src/imageTools/freehand.js b/src/imageTools/freehand.js index <HASH>..<HASH> 100755 --- a/src/imageTools/freehand.js +++ b/src/imageTools/freehand.js @@ -170,13 +170,12 @@ function mouseMoveCallback (e) { data.highlight = true; data.handles[currentHandle].x = config.mouseLocation.handles.start.x; data.handles[currentHandle].y = config.mouseLocation.handles.start.y; - if (currentHandle) { - const lastLineIndex = data.handles[currentHandle - 1].lines.length - 1; - const lastLine = data.handles[currentHandle - 1].lines[lastLineIndex]; + const neighbourIndex = currentHandle === 0 ? data.handles.length - 1 : currentHandle - 1; + const lastLineIndex = data.handles[neighbourIndex].lines.length - 1; + const lastLine = data.handles[neighbourIndex].lines[lastLineIndex]; - lastLine.x = config.mouseLocation.handles.start.x; - lastLine.y = config.mouseLocation.handles.start.y; - } + lastLine.x = config.mouseLocation.handles.start.x; + lastLine.y = config.mouseLocation.handles.start.y; } if (config.freehand) {
Fixed first two points line stuck to old position upon shape modification (#<I>)
cornerstonejs_cornerstoneTools
train
js
ddb5a1a045d0e5b15430a107448da2fdb939fc3e
diff --git a/tests/cysqlite.py b/tests/cysqlite.py index <HASH>..<HASH> 100644 --- a/tests/cysqlite.py +++ b/tests/cysqlite.py @@ -114,10 +114,6 @@ class TestCySqliteHelpers(CyDatabaseTestCase): ('DELETE', 'main', 'register', 2)]) def test_properties(self): - mem_used, mem_high = self.database.memory_used - self.assertTrue(mem_high >= mem_used) - self.assertFalse(mem_high == 0) - self.assertTrue(self.database.cache_used is not None)
Remove tests that may fail due to compiler flags.
coleifer_peewee
train
py
f6ed0a3b755b6f886c7f86a09a34d7b56e77273a
diff --git a/astropy_helpers/tests/test_setup_helpers.py b/astropy_helpers/tests/test_setup_helpers.py index <HASH>..<HASH> 100644 --- a/astropy_helpers/tests/test_setup_helpers.py +++ b/astropy_helpers/tests/test_setup_helpers.py @@ -246,7 +246,7 @@ def test_missing_cython_c_files(capsys, pyx_extension_test_package, assert msg in stderr -@pytest.mark.parametrize('mode', ['cli', 'cli-w', 'cli-sphinx', 'cli-l']) +@pytest.mark.parametrize('mode', ['cli', 'cli-w', 'cli-sphinx', 'cli-l', 'cli-parallel']) def test_build_docs(capsys, tmpdir, mode): """ Test for build_docs @@ -309,6 +309,8 @@ def test_build_docs(capsys, tmpdir, mode): run_setup('setup.py', ['build_docs', '-l']) elif mode == 'cli-sphinx': run_setup('setup.py', ['build_sphinx']) + elif mode == 'cli-parallel': + run_setup('setup.py', ['build_docs', '--parallel=2']) assert os.path.exists(docs_dir.join('_build', 'html', 'index.html').strpath)
Added test of --parallel option
astropy_astropy-helpers
train
py
86087e280665aed0bea29a3e8b91a5b9fe47ce3c
diff --git a/openquake/hazardlib/shakemap/gmfs.py b/openquake/hazardlib/shakemap/gmfs.py index <HASH>..<HASH> 100644 --- a/openquake/hazardlib/shakemap/gmfs.py +++ b/openquake/hazardlib/shakemap/gmfs.py @@ -19,7 +19,7 @@ import math import logging import numpy -from scipy.stats import truncnorm, norm +from scipy.stats import truncnorm from scipy import interpolate from openquake.baselib.general import CallableDict diff --git a/openquake/hazardlib/shakemap/parsers.py b/openquake/hazardlib/shakemap/parsers.py index <HASH>..<HASH> 100644 --- a/openquake/hazardlib/shakemap/parsers.py +++ b/openquake/hazardlib/shakemap/parsers.py @@ -278,6 +278,12 @@ def get_shakemap_array(grid_file, uncertainty_file=None): :returns: array with fields lon, lat, vs30, val, std """ data = _get_shakemap_array(grid_file) + count = sum(imt in data.dtype['val'].names + for imt in ('PGA', 'SA(0.3)', 'SA(1.0)')) + if count < 4: + logging.warning('%s does not contain (PGA, SA03, SA10)', + grid_file.fp.name) + if uncertainty_file: data2 = _get_shakemap_array(uncertainty_file) # sanity check: lons and lats must be the same
Added warning for invalid IMTs in ShakeMaps
gem_oq-engine
train
py,py
1a99634c6c7251af1bb0cea8e3ab5d7a88427d91
diff --git a/src/Utils/Formatter.php b/src/Utils/Formatter.php index <HASH>..<HASH> 100644 --- a/src/Utils/Formatter.php +++ b/src/Utils/Formatter.php @@ -488,7 +488,7 @@ class Formatter // Finishing the line. if ($lineEnded) { $ret .= $this->options['line_ending'] - . str_repeat($this->options['indentation'], $indent); + . str_repeat($this->options['indentation'], (int) $indent); $lineEnded = false; } else {
Fix uncaught TypeError with CASE Statement Related to #<I>
phpmyadmin_sql-parser
train
php
68208e0d44ea993c81861818b7484d3fc64b81b0
diff --git a/salt/states/boto_lambda.py b/salt/states/boto_lambda.py index <HASH>..<HASH> 100644 --- a/salt/states/boto_lambda.py +++ b/salt/states/boto_lambda.py @@ -508,6 +508,13 @@ def _function_code_present( )["function"] update = False if ZipFile: + if '://' in ZipFile: # Looks like a remote URL to me... + dlZipFile = __salt__['cp.cache_file'](path=ZipFile) + if dlZipFile is False: + ret['result'] = False + ret['comment'] = 'Failed to cache ZipFile `{0}`.'.format(ZipFile) + return ret + ZipFile = dlZipFile size = os.path.getsize(ZipFile) if size == func["CodeSize"]: sha = hashlib.sha256()
INFRA-<I> - allow boto_lambda.function_present() to support remote URLs for ZipFile param
saltstack_salt
train
py
9a9c465c6a630c03b083f277889b9dcc21ac889f
diff --git a/profile.go b/profile.go index <HASH>..<HASH> 100644 --- a/profile.go +++ b/profile.go @@ -21,7 +21,7 @@ type Profile struct { // GetProfile fetches the recipient's profile from facebook platform // Non empty UserID has to be specified in order to receive the information func (m *Messenger) GetProfile(userID string) (*Profile, error) { - resp, err := m.doRequest("GET", fmt.Sprintf(GraphAPI+"/v2.6/%s?fields=first_name,last_name,profile_pic,locale,timezone,gender", userID), nil) + resp, err := m.doRequest("GET", fmt.Sprintf(GraphAPI+"/v2.6/%s?fields=first_name,last_name,picture,locale,timezone,gender", userID), nil) if err != nil { return nil, err }
Changed field name from profile_pic to picture Got an error using profile_pic "(#<I>) Tried accessing nonexisting field (profile_pic) on node type (User)" while picture is working
maciekmm_messenger-platform-go-sdk
train
go
c1f7b2d79ebadff635badd3f67e95ce30896d5e3
diff --git a/storage/io/src/test/java/org/openscience/cdk/io/cml/JmolTest.java b/storage/io/src/test/java/org/openscience/cdk/io/cml/JmolTest.java index <HASH>..<HASH> 100644 --- a/storage/io/src/test/java/org/openscience/cdk/io/cml/JmolTest.java +++ b/storage/io/src/test/java/org/openscience/cdk/io/cml/JmolTest.java @@ -32,6 +32,7 @@ import java.io.InputStream; import javax.vecmath.Vector3d; import org.junit.Assert; +import org.junit.Ignore; import org.junit.Test; import org.openscience.cdk.CDKTestCase; import org.openscience.cdk.geometry.GeometryTools; @@ -100,7 +101,8 @@ public class JmolTest extends CDKTestCase { * Special CML characteristics: * - Jmol Animation */ - @Test public void testAnimation() throws Exception { + @Ignore("It is broken, but not used, AFAIK") + public void testAnimation() throws Exception { String filename = "data/cml/SN1_reaction.cml"; logger.info("Testing: " + filename); InputStream ins = this.getClass().getClassLoader().getResourceAsStream(filename);
Ignore this old test; this convention is not used anymore, AFAIK Change-Id: I<I>ea<I>a<I>cce<I>f<I>aac1c4e<I>ebabcaa2c
cdk_cdk
train
java
756b7ad43d0ad18858075f90ce5eaec2896d439c
diff --git a/git/test/test_base.py b/git/test/test_base.py index <HASH>..<HASH> 100644 --- a/git/test/test_base.py +++ b/git/test/test_base.py @@ -5,6 +5,7 @@ # This module is part of GitPython and is released under # the BSD License: http://www.opensource.org/licenses/bsd-license.php import os +import sys import tempfile import git.objects.base as base @@ -116,6 +117,14 @@ class TestBase(TestBase): filename = u"שלום.txt" file_path = os.path.join(rw_repo.working_dir, filename) + + # verify first that we could encode file name in this environment + try: + _ = file_path.encode(sys.getfilesystemencoding()) + except UnicodeEncodeError: + from nose import SkipTest + raise SkipTest("Environment doesn't support unicode filenames") + open(file_path, "wb").write(b'something') if os.name == 'nt':
BF: skip unicode filename test in env not supporting unicode encodings
gitpython-developers_GitPython
train
py
7f849d53121e32cb175824d3f9c40ec0a3740c17
diff --git a/buildbot/status/tinderbox.py b/buildbot/status/tinderbox.py index <HASH>..<HASH> 100644 --- a/buildbot/status/tinderbox.py +++ b/buildbot/status/tinderbox.py @@ -172,7 +172,7 @@ class TinderboxMailNotifier(mail.MailNotifier): text += "%s build: %s\n" % (t, self.columnName) elif isinstance(self.columnName, WithProperties): # interpolate the WithProperties instance, use that - text += "%s build: %s\n" % (t, self.columnName.render(build)) + text += "%s build: %s\n" % (t, build.getProperties().render(self.columnName)) else: raise Exception("columnName is an unhandled value") text += "%s errorparser: %s\n" % (t, self.errorparser)
axel-tinderbox-fix.patch Fix by Axel Hecht <l<I><EMAIL>> to a regression in tinderbox
buildbot_buildbot
train
py
eade9c6f9d0f326cab9efe7d6bcd035853027c8f
diff --git a/src/vis/vis.js b/src/vis/vis.js index <HASH>..<HASH> 100644 --- a/src/vis/vis.js +++ b/src/vis/vis.js @@ -554,13 +554,6 @@ var Vis = cdb.core.View.extend({ } this._setLayerOptions(options); - if (this.mobile_enabled) { - if (options.legends === undefined) { - options.legends = this.legends ? true : false; - } - this.addMobile(data, options); - } - if (data.slides) { function odysseyLoaded() { self._createSlides([data].concat(data.slides)); @@ -573,6 +566,13 @@ var Vis = cdb.core.View.extend({ } } + if (this.mobile_enabled) { + if (options.legends === undefined) { + options.legends = this.legends ? true : false; + } + this.addMobile(data, options); + } + _.defer(function() { self.trigger('done', self, self.getLayers()); })
load the mobile overlay after generating the slides
CartoDB_carto.js
train
js
19fe4044d3874ba4a9023ee0ddf0a810d5a3b536
diff --git a/lib/parser.js b/lib/parser.js index <HASH>..<HASH> 100644 --- a/lib/parser.js +++ b/lib/parser.js @@ -338,6 +338,7 @@ Parser.prototype = { case 'conditional': case 'keyframe': case 'function': + case 'media': case 'for': switch (type) { case 'color':
Fixed support for * selector within @media block
stylus_stylus
train
js
23f5f3a5a9fa249b553d86fb5f4ac0e2569212b4
diff --git a/src/Rules/Classes/AccessStaticPropertiesRule.php b/src/Rules/Classes/AccessStaticPropertiesRule.php index <HASH>..<HASH> 100644 --- a/src/Rules/Classes/AccessStaticPropertiesRule.php +++ b/src/Rules/Classes/AccessStaticPropertiesRule.php @@ -32,7 +32,11 @@ class AccessStaticPropertiesRule implements \PHPStan\Rules\Rule */ public function processNode(Node $node, Scope $scope): array { - $name = (string) $node->name; + if (!is_string($node->name)) { + return []; + } + + $name = $node->name; $currentClass = $scope->getClass(); if ($currentClass === null) { return []; diff --git a/tests/PHPStan/Rules/Classes/data/access-static-properties.php b/tests/PHPStan/Rules/Classes/data/access-static-properties.php index <HASH>..<HASH> 100644 --- a/tests/PHPStan/Rules/Classes/data/access-static-properties.php +++ b/tests/PHPStan/Rules/Classes/data/access-static-properties.php @@ -41,6 +41,7 @@ class IpsumAccessStaticProperties parent::$lorem; // does not have a parent FooAccessStaticProperties::$test; FooAccessStaticProperties::$foo; // protected and not from a parent + FooAccessStaticProperties::$$foo; } }
Fixed checking access to static properties with dynamic name
phpstan_phpstan
train
php,php
ccbbc6bb4b10c035a40e55157171b9e253e0b773
diff --git a/src/de/lmu/ifi/dbs/elki/KDDTask.java b/src/de/lmu/ifi/dbs/elki/KDDTask.java index <HASH>..<HASH> 100644 --- a/src/de/lmu/ifi/dbs/elki/KDDTask.java +++ b/src/de/lmu/ifi/dbs/elki/KDDTask.java @@ -110,6 +110,11 @@ public class KDDTask<O extends DatabaseObject> extends AbstractApplication { * Output handler. */ private ResultHandler<O, Result> resulthandler = null; + + /** + * Store the result. + */ + MultiResult result = null; /** * Provides a KDDTask. @@ -184,7 +189,6 @@ public class KDDTask<O extends DatabaseObject> extends AbstractApplication { public void run() throws IllegalStateException { Database<O> db = databaseConnection.getDatabase(normalization); algorithm.run(db); - MultiResult result; Result res = algorithm.getResult(); // standard annotations from the source file @@ -216,6 +220,15 @@ public class KDDTask<O extends DatabaseObject> extends AbstractApplication { } resulthandler.processResult(db, result); } + + /** + * Get the algorithms result. + * + * @return the result + */ + public MultiResult getResult() { + return result; + } /** * Runs a KDD task accordingly to the specified parameters.
Give access to the result of an Algorithm running within a KDDTask
elki-project_elki
train
java
d463e22fc7179f71659b29d97068998cf37147e7
diff --git a/lib/pdk.rb b/lib/pdk.rb index <HASH>..<HASH> 100644 --- a/lib/pdk.rb +++ b/lib/pdk.rb @@ -1,12 +1,20 @@ -require 'pdk/analytics' -require 'pdk/answer_file' -require 'pdk/config' -require 'pdk/generate' require 'pdk/i18n' require 'pdk/logger' -require 'pdk/report' -require 'pdk/validate' -require 'pdk/version' module PDK + autoload :Analytics, 'pdk/analytics' + autoload :AnswerFile, 'pdk/answer_file' + autoload :Config, 'pdk/config' + autoload :Generate, 'pdk/generate' + autoload :Report, 'pdk/report' + autoload :TEMPLATE_REF, 'pdk/version' + autoload :Util, 'pdk/util' + autoload :Validate, 'pdk/validate' + autoload :VERSION, 'pdk/version' + + # TODO - Refactor backend code to not raise CLI errors + module CLI + autoload :FatalError, 'pdk/cli/errors' + autoload :ExitWithError, 'pdk/cli/errors' + end end
(maint) Convert base requires to autoloads
puppetlabs_pdk
train
rb
0de9e7f8cc0aebfc2cb7a476f25ccb65a92240b1
diff --git a/lib/twilio-ruby/rest/pricing/countries.rb b/lib/twilio-ruby/rest/pricing/countries.rb index <HASH>..<HASH> 100644 --- a/lib/twilio-ruby/rest/pricing/countries.rb +++ b/lib/twilio-ruby/rest/pricing/countries.rb @@ -1,7 +1,7 @@ module Twilio module REST module Pricing - class Countries < ListResource + class Countries < NextGenListResource def initialize(path, client) super @list_key = 'countries' diff --git a/lib/twilio-ruby/rest/pricing/voice/numbers.rb b/lib/twilio-ruby/rest/pricing/voice/numbers.rb index <HASH>..<HASH> 100644 --- a/lib/twilio-ruby/rest/pricing/voice/numbers.rb +++ b/lib/twilio-ruby/rest/pricing/voice/numbers.rb @@ -1,7 +1,7 @@ module Twilio module REST module Pricing - class Numbers < ListResource + class Numbers < NextGenListResource def initialize(path, client) super @submodule = :Pricing
Switch Pricing resources to next-gen lists
twilio_twilio-ruby
train
rb,rb
562bc5ddfb3863adcbc1cf4650245bc357ae2720
diff --git a/lib/mongo_mapper/query.rb b/lib/mongo_mapper/query.rb index <HASH>..<HASH> 100644 --- a/lib/mongo_mapper/query.rb +++ b/lib/mongo_mapper/query.rb @@ -79,7 +79,11 @@ module MongoMapper key = normalized_key(key.field) end - criteria[key] = normalized_value(key, value) + if criteria[key] && criteria.kind_of?(Hash) && value.kind_of?(Hash) + value.keys.each {|k| criteria[key][k] = value[k]} + else + criteria[key] = normalized_value(key, value) + end end criteria @@ -133,4 +137,4 @@ module MongoMapper end end end -end \ No newline at end of file +end diff --git a/test/unit/test_query.rb b/test/unit/test_query.rb index <HASH>..<HASH> 100644 --- a/test/unit/test_query.rb +++ b/test/unit/test_query.rb @@ -53,6 +53,12 @@ class QueryTest < Test::Unit::TestCase criteria[:created_at]['$gt'].should be_utc end + should "work with multiple symbol operators on the same field" do + Query.new(Message, :position.gt => 0, :position.lte => 10).criteria.should == { + :position => {"$gt" => 0, "$lte" => 10} + } + end + should "work with simple criteria" do Query.new(Room, :foo => 'bar').criteria.should == { :foo => 'bar'
Allow multiple symbol operators on the same field
mongomapper_mongomapper
train
rb,rb
e8e84607fa18a4fb0c867ec747c3ee6d1962f402
diff --git a/media_tree/templatetags/media_tree_thumbnail.py b/media_tree/templatetags/media_tree_thumbnail.py index <HASH>..<HASH> 100644 --- a/media_tree/templatetags/media_tree_thumbnail.py +++ b/media_tree/templatetags/media_tree_thumbnail.py @@ -295,4 +295,3 @@ def thumbnail(parser, token): return ThumbnailNode(source_var, opts=opts, context_name=context_name) register.tag(thumbnail) -raise_
Update media_tree_thumbnail.py
samluescher_django-media-tree
train
py
105b5642139850c89138e31e075a5c589d251429
diff --git a/spec/deploy_hook_spec.rb b/spec/deploy_hook_spec.rb index <HASH>..<HASH> 100644 --- a/spec/deploy_hook_spec.rb +++ b/spec/deploy_hook_spec.rb @@ -194,7 +194,7 @@ describe "the deploy-hook API" do it "returns a brief problem description for hook files containing valid Ruby syntax" do hook_path = File.expand_path('../fixtures/invalid_hook.rb', __FILE__) desc = "spec/fixtures/invalid_hook.rb:1: syntax error, unexpected '^'" - match = /\A.*#{Regexp.escape desc}\Z/ + match = /#{Regexp.escape desc}/ @hook.syntax_error(hook_path).should =~ match end end
Fix deploy hook test broken by pull request merge.
engineyard_engineyard-serverside
train
rb
0df4474cfac6aab1eda1f06c693b5bee1c50dbf8
diff --git a/io/eolearn/io/sentinelhub_service.py b/io/eolearn/io/sentinelhub_service.py index <HASH>..<HASH> 100644 --- a/io/eolearn/io/sentinelhub_service.py +++ b/io/eolearn/io/sentinelhub_service.py @@ -96,6 +96,10 @@ class SentinelHubOGCInput(EOTask): return 1.0 if name == 'time_difference': return datetime.timedelta(seconds=-1) + if name == 'size_x': + return None + if name == 'size_y': + return None raise ValueError('Parameter {} was neither defined in initialization of {} nor is contained in ' 'EOPatch'.format(name, self.__class__.__name__))
Bug fix: size_x or size_y can be None when making the very first request.
sentinel-hub_eo-learn
train
py
cd40065605213c28fcd006674151e8aa6ac22bcb
diff --git a/lib/sensu/io.rb b/lib/sensu/io.rb index <HASH>..<HASH> 100644 --- a/lib/sensu/io.rb +++ b/lib/sensu/io.rb @@ -68,7 +68,7 @@ module Sensu if wait_on_group wait_on_process_group(process.pid) end - [output, status.exited? ? status.exitstatus : 2] + [output, status.exitstatus || 2] end end end
exited?() can let nil exit statuses through
sensu_sensu
train
rb
fe84454bb0857cd2e01beee3e0abe840d0c53632
diff --git a/pkg/tsdb/loki/loki.go b/pkg/tsdb/loki/loki.go index <HASH>..<HASH> 100644 --- a/pkg/tsdb/loki/loki.go +++ b/pkg/tsdb/loki/loki.go @@ -141,10 +141,12 @@ func (s *Service) QueryData(ctx context.Context, req *backend.QueryDataRequest) span.SetTag("stop_unixnano", query.End.UnixNano()) defer span.Finish() - //Currently hard coded as not used - applies to log queries - limit := 1000 - //Currently hard coded as not used - applies to queries which produce a stream response - interval := time.Second * 1 + // `limit` only applies to log-producing queries, and we + // currently only support metric queries, so this can be set to any value. + limit := 1 + + // we do not use `interval`, so we set it to zero + interval := time.Duration(0) value, err := client.QueryRange(query.Expr, limit, query.Start, query.End, logproto.BACKWARD, query.Step, interval, false) if err != nil {
loki: alerting: simplified config (#<I>) * loki: alerting: simplified config * adjusted config handling
grafana_grafana
train
go
b835496fe995b58aacdb1d788890424150515921
diff --git a/core/typechecker/src/test/java/org/overture/typechecker/tests/external/ExternalClassesRtTypeCheckTest.java b/core/typechecker/src/test/java/org/overture/typechecker/tests/external/ExternalClassesRtTypeCheckTest.java index <HASH>..<HASH> 100644 --- a/core/typechecker/src/test/java/org/overture/typechecker/tests/external/ExternalClassesRtTypeCheckTest.java +++ b/core/typechecker/src/test/java/org/overture/typechecker/tests/external/ExternalClassesRtTypeCheckTest.java @@ -17,7 +17,7 @@ public class ExternalClassesRtTypeCheckTest extends BaseTestSuite InvocationTargetException, NoSuchMethodException, IOException { Properties.recordTestResults = false; - String name = "Type_Check_Rt_Classes_TestSuite_External"; + String name = "Type_Check_RT_Classes_TestSuite_External"; File root = ExternalTestSettings.getBasePath("rttest/tc"); TestSuite test = null; if (root != null && root.exists())
fixing the path for the RT files
overturetool_overture
train
java
91d0a1bd1a40a61f698eea459ffe08ee899e7dcb
diff --git a/asammdf/mdf.py b/asammdf/mdf.py index <HASH>..<HASH> 100644 --- a/asammdf/mdf.py +++ b/asammdf/mdf.py @@ -2,7 +2,7 @@ """ common MDF file format module """ import csv -from datetime import datetime +from datetime import datetime, timezone import logging import xml.etree.ElementTree as ET from collections import OrderedDict, defaultdict @@ -1863,7 +1863,15 @@ class MDF(object): timestamps.append(header.start_time) - oldest = timestamps[0] + try: + oldest = min(timestamps) + except TypeError: + timestamps = [ + timestamp.astimezone(timezone.utc) + for timestamp in timestamps + ] + oldest = min(timestamps) + offsets = [(timestamp - oldest).total_seconds() for timestamp in timestamps] offsets = [offset if offset > 0 else 0 for offset in offsets] @@ -2212,7 +2220,15 @@ class MDF(object): timestamps.append(header.start_time) - oldest = min(timestamps) + try: + oldest = min(timestamps) + except TypeError: + timestamps = [ + timestamp.astimezone(timezone.utc) + for timestamp in timestamps + ] + oldest = min(timestamps) + offsets = [(timestamp - oldest).total_seconds() for timestamp in timestamps] stacked.header.start_time = oldest
handle mixed local time and utc time
danielhrisca_asammdf
train
py
e78508ae06f668a3f48b8cb63eee13d4349bb699
diff --git a/test/test_list.rb b/test/test_list.rb index <HASH>..<HASH> 100644 --- a/test/test_list.rb +++ b/test/test_list.rb @@ -3,8 +3,17 @@ require "minitest/autorun" require "dreck" +# Tests for list results. class DreckListTest < Minitest::Test - # Tests for list results. + def test_list_bad_count + # requesting a non-positive sized list throws a bad count error + assert_raises Dreck::BadCountError do + Dreck.parse [] do + list :string, :stuff, count: -1 + end + end + end + def test_list_absorb_empty # parsing an empty list into a greedy list throws a greedy absorption error assert_raises Dreck::GreedyAbsorptionError do
test: Add test for BadCountError
woodruffw_dreck
train
rb
3c93b86103f517295e92ce6b395d91f03eae129f
diff --git a/lib/tri/table/__init__.py b/lib/tri/table/__init__.py index <HASH>..<HASH> 100644 --- a/lib/tri/table/__init__.py +++ b/lib/tri/table/__init__.py @@ -241,15 +241,12 @@ class Column(RefinableObject): return bound_column - EVALUATED_ATTRIBUTES = [ - 'after', 'attr', 'auto_rowspan', 'bulk', 'cell', 'choices', 'display_name', 'extra', 'group', 'model', 'model_field', 'query', 'show', 'sort_default_desc', 'sort_key', 'sortable', 'title', 'url' - ] - def _evaluate(self): """ Evaluates callable/lambda members. After this function is called all members will be values. """ - for k in self.EVALUATED_ATTRIBUTES: + evaluated_attributes = self.get_declared('refinable_members').keys() + for k in evaluated_attributes: v = getattr(self, k) new_value = evaluate_recursive(v, table=self.table, column=self) if new_value is not v:
Removed EVALUATED_MEMBERS
TriOptima_tri.table
train
py
83b668122cad377cb0d3f98bb51067f81c8b75a8
diff --git a/packages/openneuro-server/src/graphql/resolvers/dataset-search.js b/packages/openneuro-server/src/graphql/resolvers/dataset-search.js index <HASH>..<HASH> 100644 --- a/packages/openneuro-server/src/graphql/resolvers/dataset-search.js +++ b/packages/openneuro-server/src/graphql/resolvers/dataset-search.js @@ -81,7 +81,7 @@ export const datasetSearchConnection = async ( { q, after, first = 25 }, ) => { const requestBody = { - sort: [{ _score: 'asc', id: 'desc' }], + sort: [{ _score: 'asc', 'id.keyword': 'desc' }], } if (after) { try { @@ -93,7 +93,7 @@ export const datasetSearchConnection = async ( const result = await elasticClient.search({ index: elasticIndex, size: first, - q, + q: `${q} AND public:true`, body: requestBody, }) return elasticRelayConnection(result)
fix(search): Limit the basic search to public datasets
OpenNeuroOrg_openneuro
train
js
e651ffaffdcc41be24ba30ce7514495665a61c8e
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -20,7 +20,7 @@ def check_setuptools(): check_setuptools() setup(name='instana', - version='1.8.1', + version='1.8.2', download_url='https://github.com/instana/python-sensor', url='https://www.instana.com/', license='MIT',
Bump package version to <I>
instana_python-sensor
train
py
73883064ed549e2a3d2dc1d6f166636bbf744726
diff --git a/polysquarelinter/lint_spelling_only.py b/polysquarelinter/lint_spelling_only.py index <HASH>..<HASH> 100644 --- a/polysquarelinter/lint_spelling_only.py +++ b/polysquarelinter/lint_spelling_only.py @@ -122,7 +122,7 @@ def main(arguments=None): # suppress(unused-function) num_errors = 0 for found_filename in result.files: file_path = os.path.abspath(found_filename) - with open(file_path, "r+") as found_file: + with open(file_path, "rb+") as found_file: jobstamps_dependencies = [file_path] if os.path.exists(dictionary_path): diff --git a/polysquarelinter/linter.py b/polysquarelinter/linter.py index <HASH>..<HASH> 100644 --- a/polysquarelinter/linter.py +++ b/polysquarelinter/linter.py @@ -732,7 +732,7 @@ def _run_lint_on_file(file_path, If fix_what_you_can is specified, then the first error that has a possible replacement will be automatically fixed on this file. """ - with open(file_path, "r+") as found_file: + with open(file_path, "rb+") as found_file: file_contents = found_file.read().decode("utf-8") file_lines = file_contents.splitlines(True) try:
polysquarelinter: Read as binary
polysquare_polysquare-generic-file-linter
train
py,py
7420571de0ddf90ee45ef3af0aa3a54e2f65fc57
diff --git a/tests/unit/phpDocumentor/Parser/Middleware/EmittingMiddlewareTest.php b/tests/unit/phpDocumentor/Parser/Middleware/EmittingMiddlewareTest.php index <HASH>..<HASH> 100644 --- a/tests/unit/phpDocumentor/Parser/Middleware/EmittingMiddlewareTest.php +++ b/tests/unit/phpDocumentor/Parser/Middleware/EmittingMiddlewareTest.php @@ -29,14 +29,13 @@ use function md5; final class EmittingMiddlewareTest extends TestCase { /** - * Test is ran in a separate process because sometimes a Parser in another test registers itself to the - * EventDispatcher; this should be fixed. - * * @covers ::execute - * @runInSeparateProcess */ public function testEmitsPreParsingEvent() : void { + // start with a clean dispatcher + Dispatcher::setInstance('default', new Dispatcher()); + $filename = __FILE__; $file = new FileDescriptor(md5('result')); $file->setPath($filename);
Re-set Dispatcher for EmittingMiddleware test
phpDocumentor_phpDocumentor2
train
php
746f7714cf07c4cb39fbb44fcb0e18fdae41f1be
diff --git a/molecule/core.py b/molecule/core.py index <HASH>..<HASH> 100644 --- a/molecule/core.py +++ b/molecule/core.py @@ -189,7 +189,7 @@ class Molecule(object): :return: None """ - inventory = '' + inventory = '[all]\n' for instance in self.driver.instances: inventory += self.driver.inventory_entry(instance)
Added ungrouped hosts under all (#<I>) This works around an Ansible <I> bug [1]. [1] <URL>
ansible_molecule
train
py
72491f7a9920e0d0d9752a634e59548fb5588e4a
diff --git a/src/pylast/__init__.py b/src/pylast/__init__.py index <HASH>..<HASH> 100644 --- a/src/pylast/__init__.py +++ b/src/pylast/__init__.py @@ -1798,9 +1798,14 @@ class Artist(_Taggable): else: params = None - return self._extract_cdata_from_request( - self.ws_prefix + ".getInfo", section, params - ) + try: + bio = self._extract_cdata_from_request( + self.ws_prefix + ".getInfo", section, params + ) + except IndexError: + bio = None + + return bio def get_bio_published_date(self): """Returns the date on which the artist's biography was published."""
Last.fm now even skips an empty <content/> when no bio
pylast_pylast
train
py
482d3f69a6da00abf1ddae321e9d7502d71f1152
diff --git a/subconvert/subparser/FrameTime.py b/subconvert/subparser/FrameTime.py index <HASH>..<HASH> 100644 --- a/subconvert/subparser/FrameTime.py +++ b/subconvert/subparser/FrameTime.py @@ -63,11 +63,21 @@ class FrameTime(object): 'miliseconds': self.miliseconds }) - def getTimeStr(self): - return "%d:%02d:%02d.%03d" % (self.hours, self.minutes, self.seconds, self.miliseconds) + def toStr(self, strType="time"): + """Convert FrameTime to string representation""" + if strType == "time": + return "%d:%02d:%02d.%03d" % (self.hours, self.minutes, self.seconds, self.miliseconds) + elif strType == "frame": + return "%s" % (self.frame) + else: + raise AttributeError(_("Incorrect string type: '%s'") % strType) - def getFrameStr(self): - return "%s" % (self.frame) + def changeFps(self, newFps): + if fps > 0: + self.fps = float(fps) + else: + raise ValueError(_("Incorrect FPS value: %s.") % fps) + self.frame = int(round(self.full_seconds * self.fps)) def __set_time__(self, seconds): """Set frame from a given time"""
Added changing FPS to FrameTime interface
mgoral_subconvert
train
py
b4bb499507d06a09d8b725173e30b40b2165aebb
diff --git a/python/ccxt/bitmex.py b/python/ccxt/bitmex.py index <HASH>..<HASH> 100644 --- a/python/ccxt/bitmex.py +++ b/python/ccxt/bitmex.py @@ -245,7 +245,10 @@ class bitmex (Exchange): # why the hassle? urlencode in python is kinda broken for nested dicts. # E.g. self.urlencode({"filter": {"open": True}}) will return "filter={'open':+True}" # Bitmex doesn't like that. Hence resorting to self hack. - request['filter'] = self.json(request['filter']) + + # There would be no 'filter' key in request when you call self.fetch_closed_orders or fetch_orders directly. + if 'filter' in request: + request['filter'] = self.json(request['filter']) response = self.privateGetOrder(request) return self.parse_orders(response, market, since, limit) @@ -255,6 +258,7 @@ class bitmex (Exchange): def fetch_closed_orders(self, symbol=None, since=None, limit=None, params={}): # Bitmex barfs if you set 'open': False in the filter... + # fetch_closed_orders doesn't set a 'filter' param. orders = self.fetch_orders(symbol, since, limit, params) return self.filter_by(orders, 'status', 'closed')
Fix bitmex fetch_orders functions fix fetch_orders and fetch_closed_orders cause they do not set a filter key by default.
ccxt_ccxt
train
py
bfdbc55392682be35448622ec90c60d28aa0216d
diff --git a/bbs/task_bbs/convergence.go b/bbs/task_bbs/convergence.go index <HASH>..<HASH> 100644 --- a/bbs/task_bbs/convergence.go +++ b/bbs/task_bbs/convergence.go @@ -29,7 +29,11 @@ type compareAndSwappableTask struct { NewTask models.Task } -func (bbs *TaskBBS) ConvergeTasks(logger lager.Logger, expirePendingTaskDuration, convergenceInterval, timeToResolve time.Duration, cellsLoader *services_bbs.CellsLoader) { +func (bbs *TaskBBS) ConvergeTasks( + logger lager.Logger, + expirePendingTaskDuration, convergenceInterval, timeToResolve time.Duration, + cellsLoader *services_bbs.CellsLoader, +) { taskLog := logger.Session("converge-tasks") taskLog.Info("starting-convergence") defer taskLog.Info("finished-convergence")
Make function signature multi-line for readability
cloudfoundry_runtimeschema
train
go
adbd4d802948e655fe052ce480aaeb598c4ab63e
diff --git a/test/e2e/federated-service.go b/test/e2e/federated-service.go index <HASH>..<HASH> 100644 --- a/test/e2e/federated-service.go +++ b/test/e2e/federated-service.go @@ -214,6 +214,11 @@ func waitForFederatedServiceShard(cs *release_1_3.Clientset, namespace string, s if numSvcs > 0 && service != nil { // Renaming for clarity/readability clSvc := clSvcList.Items[0] + + // The federation service has no cluster IP. Clear any cluster IP before + // comparison. + clSvc.Spec.ClusterIP = "" + Expect(clSvc.Name).To(Equal(service.Name)) Expect(clSvc.Spec).To(Equal(service.Spec)) }
Clear ClusterIP in the local service before comparison.
kubernetes_kubernetes
train
go
1e39453a0d60fdb17835c17d67b3cc80a672eb96
diff --git a/haproxy/main.py b/haproxy/main.py index <HASH>..<HASH> 100644 --- a/haproxy/main.py +++ b/haproxy/main.py @@ -157,7 +157,7 @@ def print_commands(): description = eval('dummy_log_file.cmd_{0}.__doc__'.format(cmd)) if description: description = re.sub(r'\n\s+', ' ', description) - description.strip() + description = description.strip() print('{0}: {1}\n'.format(cmd, description))
strip() returns a new string It must be assigned to a variable.
gforcada_haproxy_log_analysis
train
py
cf5e727082a835e75be184dcf1f09fc565cffef8
diff --git a/tests/test_core.py b/tests/test_core.py index <HASH>..<HASH> 100644 --- a/tests/test_core.py +++ b/tests/test_core.py @@ -123,6 +123,9 @@ class TestResource: user = User() assert repr(user) == '<mysite.User: foo>' + del User.__str__ + assert repr(user) == '<mysite.User: [no __str__]>' + class TestSession: @@ -168,3 +171,6 @@ class TestSession: session = MySession() assert repr(session) == '<mysite.MySession: foo>' + + del MySession.__str__ + assert repr(session) == '<mysite.MySession: [no __str__]>'
test rebustness of session, resource repr
ariebovenberg_snug
train
py
50a875b06963f185fc2968f796267ccb45158bf5
diff --git a/lib/createTask.js b/lib/createTask.js index <HASH>..<HASH> 100644 --- a/lib/createTask.js +++ b/lib/createTask.js @@ -78,6 +78,7 @@ var plugins = { , wrapper : require('./plugins/wrapper') , log : require('./plugins/logger') , compress : require('./plugins/compressor') + , preprocess : require('./plugins/preprocessor') }; function buildTask(task) { @@ -96,6 +97,7 @@ function buildTask(task) { if(task.filter) gulpTask = plugins.filter(gulpTask, task.filter, task); if(task.preLog || task.log) gulpTask = plugins.log(gulpTask, task.preLog, task); if(task.concat) gulpTask = plugins.concat(gulpTask, task.concat, task); + if(task.preprocess) gulpTask = plugins.preprocess(gulpTask, task.preprocess, task); if(task.rename) gulpTask = plugins.rename(gulpTask, task.rename, task); if(task.wrapper) gulpTask = plugins.wrapper(gulpTask, task.wrapper, task); if(task.replace) gulpTask = plugins.replace(gulpTask, task.replace, task);
Added preprocessor support scss for now hot fix
Emallates_gulp-task-builder
train
js
797eb3315a6dbe60ffd94a27201fdde89f178c24
diff --git a/lib/listen/silencer.rb b/lib/listen/silencer.rb index <HASH>..<HASH> 100644 --- a/lib/listen/silencer.rb +++ b/lib/listen/silencer.rb @@ -34,6 +34,9 @@ module Listen | \.swpx | ^4913 + # Emacs backup/swap files + | (?:\.\#.+|\#.+\#) + # Sed temporary files - but without actual words, like 'sedatives' | (?:^ sed diff --git a/spec/lib/listen/silencer_spec.rb b/spec/lib/listen/silencer_spec.rb index <HASH>..<HASH> 100644 --- a/spec/lib/listen/silencer_spec.rb +++ b/spec/lib/listen/silencer_spec.rb @@ -34,6 +34,9 @@ RSpec.describe Listen::Silencer do # Vim swap files ignored += %w[foo.swp foo.swx foo.swpx 4913] + # Emacs backup/swap files + ignored += %w[#hello.rb# .#hello.rb] + # sed temp files ignored += %w[sedq7eVAR sed86w1kB]
Ignore emacs backup/swap files by default.
guard_listen
train
rb,rb
314add23f46f58ff31ccc3ed71c16c20779fccef
diff --git a/lib/jellyfish/swagger.rb b/lib/jellyfish/swagger.rb index <HASH>..<HASH> 100644 --- a/lib/jellyfish/swagger.rb +++ b/lib/jellyfish/swagger.rb @@ -5,9 +5,8 @@ module Jellyfish class Swagger include Jellyfish controller_include Jellyfish::NormalizedPath, Module.new{ - def block_call argument, block - headers_merge 'Content-Type' => 'application/json; charset=utf-8', - 'Access-Control-Allow-Origin' => '*' + def dispatch + headers_merge 'Content-Type' => 'application/json; charset=utf-8' super end }
swagger: use dispatch and do not add cors headers by default remove Access-Control-Allow-Origin by default
godfat_jellyfish
train
rb
eb1dd9ea24a4f72c3b688dfec356a0d16497d7f6
diff --git a/core/sdk/src/main/java/com/mongodb/stitch/core/auth/internal/CoreStitchAuth.java b/core/sdk/src/main/java/com/mongodb/stitch/core/auth/internal/CoreStitchAuth.java index <HASH>..<HASH> 100644 --- a/core/sdk/src/main/java/com/mongodb/stitch/core/auth/internal/CoreStitchAuth.java +++ b/core/sdk/src/main/java/com/mongodb/stitch/core/auth/internal/CoreStitchAuth.java @@ -203,6 +203,9 @@ public abstract class CoreStitchAuth<StitchUserT extends CoreStitchUser> @Override public <T> Stream<T> openAuthenticatedStream(final StitchAuthRequest stitchReq, final Decoder<T> decoder) { + if (!isLoggedIn()) { + throw new StitchClientException(StitchClientErrorCode.MUST_AUTHENTICATE_FIRST); + } try { return new Stream<>( requestClient.doStreamRequest(stitchReq.builder().withPath(
Throw if not logged in for stream request
mongodb_stitch-android-sdk
train
java
ec844b66132e3326e1a7ef3ef45e8513991114a9
diff --git a/src/emailjs-imap-client.js b/src/emailjs-imap-client.js index <HASH>..<HASH> 100644 --- a/src/emailjs-imap-client.js +++ b/src/emailjs-imap-client.js @@ -1095,6 +1095,11 @@ value: sequence }] }; + + if (options.valueAsString !== undefined) { + command.valueAsString = options.valueAsString; + } + var query = []; items.forEach((item) => { diff --git a/test/unit/emailjs-imap-client-test.js b/test/unit/emailjs-imap-client-test.js index <HASH>..<HASH> 100644 --- a/test/unit/emailjs-imap-client-test.js +++ b/test/unit/emailjs-imap-client-test.js @@ -1447,6 +1447,21 @@ }] }); }); + + it('should build FETCH with the valueAsString option', () => { + expect(br._buildFETCHCommand('1:*', ['body[]'], {valueAsString: false})).to.deep.equal({ + command: 'FETCH', + attributes: [{ + type: 'SEQUENCE', + value: '1:*' + }, { + type: 'ATOM', + value: 'BODY', + section: [] + }], + valueAsString: false + }); + }); }); describe('#_parseFETCH', () => {
Added valueAsString to the fetch command.
emailjs_emailjs-imap-client
train
js,js
4867fcdc055e194d0ba26eb063087d219d907be4
diff --git a/auto_ml/utils.py b/auto_ml/utils.py index <HASH>..<HASH> 100644 --- a/auto_ml/utils.py +++ b/auto_ml/utils.py @@ -15,13 +15,19 @@ import scipy import xgboost as xgb -def split_output(X, output_column_name): +def split_output(X, output_column_name, verbose=False): y = [] for row in X: y.append( row.pop(output_column_name) ) + if verbose: + print('Just to make sure that your y-values make sense, here are the first 100 sorted values:') + print(sorted(y)[:100]) + print('And here are the final 100 sorted values:') + print(sorted(y)[-100:]) + return X, y
adds some logging for our output values just so the user can catch any outliers
ClimbsRocks_auto_ml
train
py
728d9b2a26f20a6afc34fe46f6d18d601a02cb53
diff --git a/cake/libs/model/datasources/dbo_source.php b/cake/libs/model/datasources/dbo_source.php index <HASH>..<HASH> 100755 --- a/cake/libs/model/datasources/dbo_source.php +++ b/cake/libs/model/datasources/dbo_source.php @@ -515,7 +515,7 @@ class DboSource extends DataSource { * @return integer Number of rows in resultset */ function lastNumRows() { - return $this->lastAffected($source); + return $this->lastAffected(); } /**
Removed the unused var.
cakephp_cakephp
train
php
3df84f524a801e03720b9c8f21a2df92abb514ce
diff --git a/lib/qprompt.py b/lib/qprompt.py index <HASH>..<HASH> 100644 --- a/lib/qprompt.py +++ b/lib/qprompt.py @@ -289,10 +289,10 @@ def ask(msg="Enter input", fmt=None, dft=None, vld=None, shw=True, blk=False): msg += " [%s]" % (dft if type(dft) is str else repr(dft)) vld.append(dft) if vld: - # Input cannot be blank if validity check provided. - blk = False # Sanitize valid inputs. vld = list(set([fmt(v) if fmt(v) else v for v in vld])) + if str not in vld: + blk = False # NOTE: The following fixes a Py3 related bug found in `0.8.1`. try: vld = sorted(vld) except: pass @@ -303,7 +303,7 @@ def ask(msg="Enter input", fmt=None, dft=None, vld=None, shw=True, blk=False): ans = get_input(msg) if "?" == ans: if vld: - echo(vld) + echo("%r %s" % (vld, "(may be blank)" if blk else "")) ans = None continue if "" == ans:
Minor update to how blk is handled in ask.
jeffrimko_Qprompt
train
py
9e5ecf779177b3757caadee2f0665c81a1b99e90
diff --git a/spec/unit/validation_errors/enumerable_spec.rb b/spec/unit/validation_errors/enumerable_spec.rb index <HASH>..<HASH> 100644 --- a/spec/unit/validation_errors/enumerable_spec.rb +++ b/spec/unit/validation_errors/enumerable_spec.rb @@ -16,7 +16,8 @@ describe DataMapper::Validate::ValidationErrors do seen << i end - seen.should == [["must have valid format"], ["can't be blank"]] + seen.should include(["must have valid format"]) + seen.should include(["can't be blank"]) end end @@ -26,7 +27,10 @@ describe DataMapper::Validate::ValidationErrors do @model.add(:ip_address, "must belong to a local subnet") end it "maps error message arrays using provided block" do - @model.map { |ary| ary.size }.should == [2, 1] + projection = @model.map { |ary| ary.size } + + projection.should include(2) + projection.should include(1) end end end
[dm-validations] Hash enumeration does not guarantee order of iteration, update spec examples
emmanuel_aequitas
train
rb
546571880f30278bd13284c06960145ec9f16e67
diff --git a/openhtf/io/frontend/__init__.py b/openhtf/io/frontend/__init__.py index <HASH>..<HASH> 100644 --- a/openhtf/io/frontend/__init__.py +++ b/openhtf/io/frontend/__init__.py @@ -338,7 +338,7 @@ class WebGuiServer(tornado.web.Application): ] + dash_router.urls + station_router.urls super(WebGuiServer, self).__init__( handler_routes, template_path=path, static_path=path, debug=dev_mode) - self.listen(self.port) + self.listen(http_port) def remove_handlers_by_url(self, url): """Remove any handlers with the given URL pattern (must match exactly)."""
Fix a small bug that prevents the frontend from running. (#<I>)
google_openhtf
train
py
feb81411920879326459514024566b28421de7b6
diff --git a/asammdf/mdf.py b/asammdf/mdf.py index <HASH>..<HASH> 100644 --- a/asammdf/mdf.py +++ b/asammdf/mdf.py @@ -3452,7 +3452,7 @@ class MDF(object): else: index = msg_map[entry] - sigs = [(t, None)] + sigs = [] for name_, signal in signals.items(): @@ -3465,6 +3465,10 @@ class MDF(object): and signal["is_max"] ) + t = signal["t"] + + sigs.insert(0, (t, None)) + out.extend(index, sigs) self._set_temporary_master(None) cntr += 1 diff --git a/asammdf/version.py b/asammdf/version.py index <HASH>..<HASH> 100644 --- a/asammdf/version.py +++ b/asammdf/version.py @@ -1,4 +1,4 @@ # -*- coding: utf-8 -*- """ asammdf version module """ -__version__ = "5.16.0.dev17" +__version__ = "5.16.0.dev18"
fix can extraction for OBD2 muxed signals
danielhrisca_asammdf
train
py,py
2f747981805ae00f7028e29a0157f05d7cd7eb1d
diff --git a/core/packet.go b/core/packet.go index <HASH>..<HASH> 100644 --- a/core/packet.go +++ b/core/packet.go @@ -32,7 +32,7 @@ func (p Packet) DevAddr() (lorawan.DevAddr, error) { } // FCnt returns the frame counter of the given packet -func (p Packet) Fcnt() (uint16, error) { +func (p Packet) Fcnt() (uint32, error) { if p.Payload.MACPayload == nil { return 0, fmt.Errorf("MACPayload should not be empty") }
brocaar/lorawan changed FCnt to uint<I>
TheThingsNetwork_ttn
train
go
e6866776085b173435cf57ee0d8f276ab8347374
diff --git a/fcrepo-kernel/src/main/java/org/fcrepo/spring/ModeShapeRepositoryFactoryBean.java b/fcrepo-kernel/src/main/java/org/fcrepo/spring/ModeShapeRepositoryFactoryBean.java index <HASH>..<HASH> 100644 --- a/fcrepo-kernel/src/main/java/org/fcrepo/spring/ModeShapeRepositoryFactoryBean.java +++ b/fcrepo-kernel/src/main/java/org/fcrepo/spring/ModeShapeRepositoryFactoryBean.java @@ -49,6 +49,7 @@ public class ModeShapeRepositoryFactoryBean implements } s.save(); + s.logout(); } @Override
make sure to log-out our repository initialization session
fcrepo4_fcrepo4
train
java
43aacf1e3112d89eb99413ae5eb450c42bb2a2d3
diff --git a/fulfil_client/client.py b/fulfil_client/client.py index <HASH>..<HASH> 100755 --- a/fulfil_client/client.py +++ b/fulfil_client/client.py @@ -96,7 +96,8 @@ class Model(object): def __getattr__(self, name): @json_response def proxy_method(*args, **kwargs): - context = kwargs.pop('context', self.client.context) + context = self.client.context.copy() + context.update(kwargs.pop('context', {})) request_logger.debug( "%s.%s::%s::%s" % ( self.model_name, name, args, kwargs diff --git a/tests/test_fulfil_client.py b/tests/test_fulfil_client.py index <HASH>..<HASH> 100755 --- a/tests/test_fulfil_client.py +++ b/tests/test_fulfil_client.py @@ -30,4 +30,4 @@ def test_find_no_filter(client): def test_raises_server_error(client): Model = client.model('ir.model') with pytest.raises(ServerError): - Model.search([], context=1) + Model.search(1)
Update existing context for requests While this was the behavior on the the get request it seems to have been forgotten on the context for geenric method handler.
fulfilio_fulfil-python-api
train
py,py
cc16c8c4679d902e4d3a0acfd5532f142f289bae
diff --git a/choix/utils.py b/choix/utils.py index <HASH>..<HASH> 100644 --- a/choix/utils.py +++ b/choix/utils.py @@ -358,7 +358,7 @@ def compare(items, params, rank=False): def probabilities(items, params): - """Compute the comparison outcome probabilities. + """Compute the comparison outcome probabilities given a subset of items. This function computes, for each item in ``items``, the probability that it would win (i.e., be chosen) in a comparison involving the items, given
Improved dosctring for `probabilities`. The docstring of the function `probabilities` was a little bit too minimalistic. Now it states more clearly that it computes the distribution for the subset of items passed as argument.
lucasmaystre_choix
train
py
41d3f97cf21094c230e73b0a9295ef8796997973
diff --git a/src/gitgraph.js b/src/gitgraph.js index <HASH>..<HASH> 100644 --- a/src/gitgraph.js +++ b/src/gitgraph.js @@ -78,7 +78,8 @@ break; default: this.orientation = "vertical"; - this.template.branch.labelRotation = options.template.branch !== undefined && + + this.template.branch.labelRotation = _isDefined(options, 'template.branch.labelRotation') && options.template.branch.labelRotation !== null ? options.template.branch.labelRotation : 0; break; @@ -1557,6 +1558,15 @@ return (typeof object === "object"); } + function _isDefined(obj, key) { + return key.split(".").every(function(x) { + if(typeof obj != "object" || obj === null || ! x in obj) + return false; + obj = obj[x]; + return true; + }); + } + // Expose GitGraph object window.GitGraph = GitGraph; window.GitGraph.Branch = Branch;
Added utility function to check for undefined values in nested object properties.
nicoespeon_gitgraph.js
train
js
2eb06e998bda5516799188421def7b9efe038b1d
diff --git a/Commands/StartCommand.php b/Commands/StartCommand.php index <HASH>..<HASH> 100644 --- a/Commands/StartCommand.php +++ b/Commands/StartCommand.php @@ -32,7 +32,8 @@ class StartCommand extends Command { $config = $this->initializeConfig($input, $output); - $handler = new ProcessManager($output, $config['port'], $config['host'], $config['workers']); + $class = isset($config['processmanager']) ? $config['processmanager'] : ProcessManager::class; + $handler = new $class($output, $config['port'], $config['host'], $config['workers']); $handler->setBridge($config['bridge']); $handler->setAppEnv($config['app-env']);
Create ProcessManager from optional factory (#<I>) * Create ProcessManager from optional factory * Instantiate user-defined process manager class * Remove command line option
php-pm_php-pm
train
php
327dd62cf45b804a410d4a76f59ef689ce6e4e39
diff --git a/wicket-orientdb/src/main/java/ru/ydn/wicket/wicketorientdb/model/ODocumentWrapperModel.java b/wicket-orientdb/src/main/java/ru/ydn/wicket/wicketorientdb/model/ODocumentWrapperModel.java index <HASH>..<HASH> 100644 --- a/wicket-orientdb/src/main/java/ru/ydn/wicket/wicketorientdb/model/ODocumentWrapperModel.java +++ b/wicket-orientdb/src/main/java/ru/ydn/wicket/wicketorientdb/model/ODocumentWrapperModel.java @@ -26,7 +26,7 @@ public class ODocumentWrapperModel<T extends ODocumentWrapper> extends Model<T> T ret= super.getObject(); if(ret!=null && needToReload) { - ret.reload(); + ret.load(); needToReload = false; } return ret; @@ -44,6 +44,4 @@ public class ODocumentWrapperModel<T extends ODocumentWrapper> extends Model<T> super.detach(); } - - }
Reload() shouldn't cross transation: replace my load()
OrienteerBAP_wicket-orientdb
train
java
1cb2f341984d3c7fc7433eb6370580dc707ff382
diff --git a/Neos.Flow/Classes/Security/Aspect/LoggingAspect.php b/Neos.Flow/Classes/Security/Aspect/LoggingAspect.php index <HASH>..<HASH> 100644 --- a/Neos.Flow/Classes/Security/Aspect/LoggingAspect.php +++ b/Neos.Flow/Classes/Security/Aspect/LoggingAspect.php @@ -15,7 +15,6 @@ namespace Neos\Flow\Security\Aspect; use Neos\Flow\Annotations as Flow; use Neos\Flow\Aop\JoinPointInterface; -use Neos\Flow\Log\PsrSecurityLoggerInterface; use Neos\Flow\Security\Authentication\AuthenticationManagerInterface; use Neos\Flow\Security\Authentication\TokenInterface; use Neos\Flow\Security\Exception\NoTokensAuthenticatedException; @@ -29,8 +28,8 @@ use Neos\Flow\Security\Exception\NoTokensAuthenticatedException; class LoggingAspect { /** - * @var PsrSecurityLoggerInterface - * @Flow\Inject + * @var \Psr\Log\LoggerInterface + * @Flow\Inject(name="Neos.Flow:SecurityLogger") */ protected $securityLogger;
TASK: Use virtual object injection for security logger
neos_flow-development-collection
train
php
1d536fc18f44dd54d8a75e539dbf2168431b678c
diff --git a/Neos.Flow/Classes/Command/RoutingCommandController.php b/Neos.Flow/Classes/Command/RoutingCommandController.php index <HASH>..<HASH> 100644 --- a/Neos.Flow/Classes/Command/RoutingCommandController.php +++ b/Neos.Flow/Classes/Command/RoutingCommandController.php @@ -143,7 +143,7 @@ class RoutingCommandController extends CommandController $this->outputLine(' Pattern: ' . $route->getUriPattern()); $this->outputLine('<b>Generated Path:</b>'); - $this->outputLine(' ' . $route->getResolvedUriPath()); + $this->outputLine(' ' . $route->getResolvedUriConstraints()->getPathConstraint()); if ($controllerObjectName !== null) { $this->outputLine('<b>Controller:</b>');
BUGFIX: Replace missing getResolvedUriPath
neos_flow-development-collection
train
php
72247e4c6be22c90d75fa4df7598ecc610d1a5c5
diff --git a/Kwc/Abstract/Admin.php b/Kwc/Abstract/Admin.php index <HASH>..<HASH> 100644 --- a/Kwc/Abstract/Admin.php +++ b/Kwc/Abstract/Admin.php @@ -67,10 +67,11 @@ class Kwc_Abstract_Admin extends Kwf_Component_Abstract_Admin $s = array('ignoreVisible'=>true); foreach ($source->getChildComponents($s) as $c) { - if ($c->generator->hasSetting('inherit') && $c->generator->getSetting('inherit')) { - if ($c->generator->hasSetting('unique') && $c->generator->getSetting('unique')) { + if ($c->generator->hasSetting('inherit') && $c->generator->getSetting('inherit') && + $c->generator->hasSetting('unique') && $c->generator->getSetting('unique') && + $source->componentId != $c->parent->componentId + ) { continue; - } } if ($c->generator->getGeneratorFlag('pageGenerator')) { continue;
Skip duplicating of unique boxes only for child pages
koala-framework_koala-framework
train
php
ea0d71011305f2216aaa06db3d56162333bce016
diff --git a/public/javascript/pump.js b/public/javascript/pump.js index <HASH>..<HASH> 100644 --- a/public/javascript/pump.js +++ b/public/javascript/pump.js @@ -70,6 +70,12 @@ if (!window.Pump) { if (Pump.principalUser) { Pump.principalUser = Pump.User.unique(Pump.principalUser); Pump.principal = Pump.principalUser.profile; + Pump.body.nav = new Pump.UserNav({el: Pump.body.$(".navbar-inner .container"), + model: Pump.principalUser, + data: { + messages: Pump.principalUser.majorDirectInbox, + notifications: Pump.principalUser.minorDirectInbox + }}); } else if (Pump.principal) { Pump.principal = Pump.Person.unique(Pump.principal); } else {
Initialize nav if user is set by server
pump-io_pump.io
train
js
983a2dccaa263bad1f055a85d864a8097f0af8a2
diff --git a/actionpack/lib/action_view/helpers/number_helper.rb b/actionpack/lib/action_view/helpers/number_helper.rb index <HASH>..<HASH> 100644 --- a/actionpack/lib/action_view/helpers/number_helper.rb +++ b/actionpack/lib/action_view/helpers/number_helper.rb @@ -100,10 +100,10 @@ module ActionView # number_to_currency(1234567890.50) # => $1,234,567,890.50 # number_to_currency(1234567890.506) # => $1,234,567,890.51 # number_to_currency(1234567890.506, :precision => 3) # => $1,234,567,890.506 - # number_to_currency(1234567890.506, :locale => :fr) # => 1 234 567 890,506 € + # number_to_currency(1234567890.506, :locale => :fr) # => 1 234 567 890,51 € # # number_to_currency(-1234567890.50, :negative_format => "(%u%n)") - # # => ($1,234,567,890.51) + # # => ($1,234,567,890.50) # number_to_currency(1234567890.50, :unit => "&pound;", :separator => ",", :delimiter => "") # # => &pound;1234567890,50 # number_to_currency(1234567890.50, :unit => "&pound;", :separator => ",", :delimiter => "", :format => "%n %u")
Cosmetic fix in number_to_currency docs
rails_rails
train
rb
397baaea53099aef8e425de5d79d2b4466106c77
diff --git a/Tests/ServiceRepositoryTest.php b/Tests/ServiceRepositoryTest.php index <HASH>..<HASH> 100644 --- a/Tests/ServiceRepositoryTest.php +++ b/Tests/ServiceRepositoryTest.php @@ -48,7 +48,7 @@ class ServiceRepositoryTest extends TestCase $container->registerExtension($extension); $extension->load([[ 'dbal' => [ - 'driver' => 'pdo_mysql', + 'driver' => 'pdo_sqlite', 'charset' => 'UTF8', ], 'orm' => [
Changed pdo_mysql dependency to pdo_sqlite
doctrine_DoctrineBundle
train
php
a78c97499d8f00c67e52cf2d666e530ad3e48920
diff --git a/nats/js/client.py b/nats/js/client.py index <HASH>..<HASH> 100644 --- a/nats/js/client.py +++ b/nats/js/client.py @@ -922,7 +922,7 @@ class JetStreamContext(JetStreamManager): req_subject = f"{self._prefix}.STREAM.MSG.GET.{stream_name}" req = {'last_by_subj': subject} data = json.dumps(req) - resp = await self._api_request(req_subject, data.encode()) + resp = await self._api_request(req_subject, data.encode(), timeout=self._timeout) raw_msg = api.RawStreamMsg.from_response(resp['message']) if raw_msg.hdrs: hdrs = base64.b64decode(raw_msg.hdrs)
Fix incorrect timeout propagation This commit adds timeout propagation on key value get operation.
nats-io_asyncio-nats
train
py
d84cae6c9c1ccc2a95214cfdb6fa65c293e67a16
diff --git a/bin/release.py b/bin/release.py index <HASH>..<HASH> 100755 --- a/bin/release.py +++ b/bin/release.py @@ -190,6 +190,7 @@ def checkInMaven2Repo(version, workingDir): mod_dir = settings[local_mvn_repo_dir_key] + "/" + getModuleName(p) if not is_in_svn(mod_dir): newmodules.append(mod_dir) + print "New modules added in this release: %s" % newmodules if len(newmodules) > 0: client.add(newmodules) client.add(moduleNames)
Added more msgs
infinispan_infinispan
train
py
d94efccaa70477b1f8ac5cddc65e1ba868ae1659
diff --git a/src/Asana.php b/src/Asana.php index <HASH>..<HASH> 100644 --- a/src/Asana.php +++ b/src/Asana.php @@ -667,9 +667,7 @@ class Asana */ public function getCustomFields($workspaceId = null) { - if (is_null($workspaceId)) { - $workspaceId = $this->defaultWorkspaceId; - } + $workspaceId = $workspaceId ?: $this->defaultWorkspaceId; return $this->curl->get("workspaces/{$workspaceId}/custom_fields"); }
use ternary operator instead of if statement
Torann_laravel-asana
train
php
1fd653ce33ff468334fd510cbd7978d4bad69d19
diff --git a/projects/samskivert/src/java/com/samskivert/util/SortableArrayList.java b/projects/samskivert/src/java/com/samskivert/util/SortableArrayList.java index <HASH>..<HASH> 100644 --- a/projects/samskivert/src/java/com/samskivert/util/SortableArrayList.java +++ b/projects/samskivert/src/java/com/samskivert/util/SortableArrayList.java @@ -1,5 +1,5 @@ // -// $Id: SortableArrayList.java,v 1.14 2003/06/16 18:11:30 mdb Exp $ +// $Id: SortableArrayList.java,v 1.15 2003/07/15 00:30:30 ray Exp $ // // samskivert library - useful routines for java programs // Copyright (C) 2001 Michael Bayne @@ -237,6 +237,10 @@ public class SortableArrayList extends AbstractList // documentation inherited from interface public int indexOf (Object o) { + if (_elements == null) { + return -1; + } + return ListUtil.indexOfEqual(_elements, o); }
There have been so many bugs caused by _elements being allowed to be null. Fixed another. git-svn-id: <URL>
samskivert_samskivert
train
java
3f04e706fca40b762d0f0925f696635c185d9c69
diff --git a/src/oj.js b/src/oj.js index <HASH>..<HASH> 100644 --- a/src/oj.js +++ b/src/oj.js @@ -38,7 +38,7 @@ oj.version = '0.2.2' - oj.isClient = !(typeof process !== "undefined" && process !== null ? process.versions != null ? process.versions.node : 0 : 0) + oj.isClient = !(typeof process !== _udf && process !== null ? process.versions != null ? process.versions.node : 0 : 0) // Detect jQuery globally or in required module if (typeof $ != _udf) @@ -1021,7 +1021,7 @@ // Compile to dom if requested // Add dom element with attributes - if (options.dom && (typeof document !== "undefined" && document !== null)){ + if (options.dom && (typeof document !== _udf && document !== null)){ // Create element el = document.createElement(tag)
Replaced two instances of `"undefined"` with `_udf`
evanmoran_oj
train
js
3a8a32ef69a1f03a578d5b13e0cb6aa81446deb8
diff --git a/bases.go b/bases.go index <HASH>..<HASH> 100644 --- a/bases.go +++ b/bases.go @@ -45,6 +45,10 @@ func NewHandler( } } +func (h *Handler) LogTime(logger *logrus.Entry, start time.Time) { + LogTime(logger, "Handler building", start) +} + func NewController( c *viper.Viper, l *logrus.Entry,
LogTime method added on handlers.
solher_snakepit
train
go
e2cda52c2ccb0e3921cdb6090426590fc94b48bd
diff --git a/test/integration/tx/transactions.js b/test/integration/tx/transactions.js index <HASH>..<HASH> 100644 --- a/test/integration/tx/transactions.js +++ b/test/integration/tx/transactions.js @@ -179,6 +179,8 @@ describe('Send Transactions', function () { this.timeout(config.timeout) describe('Bitcoin - Ledger', () => { + before(async function () { await importBitcoinAddresses(chains.bitcoinWithLedger) }) + beforeEach(async function () { await fundUnusedBitcoinAddress(chains.bitcoinWithLedger) }) testTransaction(chains.bitcoinWithLedger) }) @@ -193,6 +195,8 @@ describe('Send Batch Transactions', function () { this.timeout(config.timeout) describe('Bitcoin - Ledger', () => { + before(async function () { await importBitcoinAddresses(chains.bitcoinWithLedger) }) + beforeEach(async function () { await fundUnusedBitcoinAddress(chains.bitcoinWithLedger) }) testBatchTransaction(chains.bitcoinWithLedger) })
Import and fund ledger and bitcoinjs addresses in tests
liquality_chainabstractionlayer
train
js
6f249af286cbd52e8499eaee1a60d2b1fae208b3
diff --git a/project_generator/tool.py b/project_generator/tool.py index <HASH>..<HASH> 100644 --- a/project_generator/tool.py +++ b/project_generator/tool.py @@ -50,7 +50,7 @@ class ToolsSupported: 'toolchain': 'gcc_arm', 'toolnames': ['coide'], 'exporter': Coide, - 'builder': None, + 'builder': Coide, }, 'make_gcc_arm': { 'toolchain': 'gcc_arm', diff --git a/project_generator/tools/coide.py b/project_generator/tools/coide.py index <HASH>..<HASH> 100644 --- a/project_generator/tools/coide.py +++ b/project_generator/tools/coide.py @@ -19,6 +19,8 @@ import copy from os.path import basename, join, normpath from os import getcwd + +from .builder import Builder from .exporter import Exporter from ..targets import Targets @@ -43,7 +45,7 @@ class CoIDEdefinitions(): }, } -class Coide(Exporter): +class Coide(Exporter, Builder): source_files_dic = [ 'source_files_c', 'source_files_s', 'source_files_cpp', 'source_files_obj', 'source_files_lib'] file_types = {'cpp': 1, 'c': 1, 's': 1, 'obj': 1, 'lib': 1}
Coide - bugfix builder - should inherit and not implement it
project-generator_project_generator
train
py,py
144c731c45b3a982a9e49041a7f91a36b7e6b0b9
diff --git a/src/main/java/org/minimalj/backend/db/DbBackend.java b/src/main/java/org/minimalj/backend/db/DbBackend.java index <HASH>..<HASH> 100644 --- a/src/main/java/org/minimalj/backend/db/DbBackend.java +++ b/src/main/java/org/minimalj/backend/db/DbBackend.java @@ -1,5 +1,6 @@ package org.minimalj.backend.db; +import java.io.File; import java.io.InputStream; import java.io.OutputStream; import java.io.Serializable; @@ -24,7 +25,8 @@ public class DbBackend extends Backend { public DbBackend() { String databaseFile = System.getProperty("MjBackendDatabaseFile", null); - this.persistence = new DbPersistence(DbPersistence.embeddedDataSource(databaseFile), Application.getApplication().getEntityClasses()); + boolean createTables = databaseFile == null || !new File(databaseFile).exists(); + this.persistence = new DbPersistence(DbPersistence.embeddedDataSource(databaseFile), createTables, Application.getApplication().getEntityClasses()); this.queries = Application.getApplication().getQueries(); }
DbBackend: only create tables in derby db if the file not yet exists
BrunoEberhard_minimal-j
train
java
62c2b58388829d3d3eb92028039d9176b2876a49
diff --git a/lib/clash/tests.rb b/lib/clash/tests.rb index <HASH>..<HASH> 100644 --- a/lib/clash/tests.rb +++ b/lib/clash/tests.rb @@ -114,6 +114,7 @@ module Clash def read_config # Find the config file (fall back to legacy filename) if path = config_path || config_path('.clash.yml') + read_test_line_numbers(path) config = SafeYAML.load_file(path) config = [config] unless config.is_a?(Array) @@ -129,12 +130,22 @@ module Clash path = File.join('./', @options[:path]) paths = [] + # Walk up the directory tree looking for a clash file. (path.count('/') + 1).times do paths << File.join(path, file) path.sub!(/\/[^\/]+$/, '') end - paths.find {|p| File.file?(p) } + # By default search for clash config in the test directory. + paths << "./test/_clash.yml" + + path = paths.find {|p| File.file?(p) } + + if path && path =~ %r{test/_clash.yml} && @options[:path] == '.' + @options[:path] = 'test' + end + + path end def print_results
Clash config file defaults to looking in test directory
imathis_clash
train
rb
5605f45590da7ac57aebff3b9a2eebfc22e0a1ba
diff --git a/tests/Integration/PersistedDataTest.php b/tests/Integration/PersistedDataTest.php index <HASH>..<HASH> 100644 --- a/tests/Integration/PersistedDataTest.php +++ b/tests/Integration/PersistedDataTest.php @@ -89,7 +89,7 @@ class PersistedDataTest extends IntegrationTestCase // Assertions $this->assertTrue($updateResult); $this->assertInstanceOf(ReferencedUser::class, $result); - $this->assertSame($expected, $result->toArray()); + $this->assertEquals($expected, $result->toArray()); } public function testUpdateData() @@ -131,7 +131,7 @@ class PersistedDataTest extends IntegrationTestCase // Assertions $this->assertTrue($updateResult); $this->assertInstanceOf(ReferencedUser::class, $result); - $this->assertSame($expected, $result->toArray()); + $this->assertEquals($expected, $result->toArray()); } private function getUser(bool $save = false): ReferencedUser
Fix test that was breaking on CI
leroy-merlin-br_mongolid
train
php
6101f8927ebc68c18ddf40183c925ab09058cc3c
diff --git a/core/common/webpack_rules.js b/core/common/webpack_rules.js index <HASH>..<HASH> 100644 --- a/core/common/webpack_rules.js +++ b/core/common/webpack_rules.js @@ -402,8 +402,8 @@ module.exports = ( config ) => { include: [ path.resolve( inlineNodeModules, 'ansi-regex'), path.resolve( inlineNodeModules, 'strip-ansi'), - path.resolve( nodeModulesPath, 'ansi-regex' ), - path.resolve( nodeModulesPath, 'strip-ansi' ), + path.resolve( yarnModulesPath, 'ansi-regex' ), + path.resolve( yarnModulesPath, 'strip-ansi' ), ], use: [ {
fix: android 4x & ie9 + compatibility for yarn
legoflow_engine
train
js
f61e2f4ee3fc84744294306fa1167492ee0627ae
diff --git a/src/language/CSSUtils.js b/src/language/CSSUtils.js index <HASH>..<HASH> 100644 --- a/src/language/CSSUtils.js +++ b/src/language/CSSUtils.js @@ -810,7 +810,7 @@ define(function (require, exports, module) { if (token === "}" && !currentSelector) { return false; } - if (token === ";") { + if (token === ";" || (state.state === "prop")) { currentSelector = ""; } else { if (!currentSelector) { @@ -979,12 +979,12 @@ define(function (require, exports, module) { } if (selectors[j].level < currentLevel) { break; - } else if (selectors[j].declListEndLine !== -1) { + } + if (selectors[j].declListEndLine !== -1) { return; - } else { - selectors[j].declListEndLine = line; - selectors[j].declListEndChar = stream.pos - 1; // stream.pos actually points to the char after the } } + selectors[j].declListEndLine = line; + selectors[j].declListEndChar = stream.pos - 1; // stream.pos actually points to the char after the } } } while (currentLevel > 0 && currentLevel === level); }
Fix the issue of last property with no ';' causing runaway nested rule.
adobe_brackets
train
js
9f5d2fb7ee0d135e551ad9a0fc132e8c38b77c0b
diff --git a/tests/EseyeTest.php b/tests/EseyeTest.php index <HASH>..<HASH> 100644 --- a/tests/EseyeTest.php +++ b/tests/EseyeTest.php @@ -57,6 +57,9 @@ class EseyeTest extends PHPUnit_Framework_TestCase // Remove caching $configuration->cache = NullCache::class; + // Force ESI data-source to be singularity + $configuration->datasource = 'singularity'; + $this->esi = new Eseye; } @@ -252,7 +255,7 @@ class EseyeTest extends PHPUnit_Framework_TestCase $uri = $this->esi->buildDataUri('/{foo}/', ['foo' => 'bar']); - $this->assertEquals('https://esi.evetech.net/latest/bar/?datasource=test', + $this->assertEquals('https://esi.evetech.net/latest/bar/?datasource=singularity', $uri->__toString()); }
tests: switch test data-source to singularity
eveseat_eseye
train
php
10bf8a8f3adf2045509fdef85119075d536b1522
diff --git a/Model/Api.php b/Model/Api.php index <HASH>..<HASH> 100644 --- a/Model/Api.php +++ b/Model/Api.php @@ -428,7 +428,7 @@ class Api 'Accept: application/json' ]; - if($method == \Zend_Http_Client::POST || $method == \Zend_Http_Client::PUT) { + if($method == \Zend_Http_Client::PUT) { array_push($headers, 'Content-Type: application/x-www-form-urlencoded'); } diff --git a/view/adminhtml/web/js/testconnection.js b/view/adminhtml/web/js/testconnection.js index <HASH>..<HASH> 100644 --- a/view/adminhtml/web/js/testconnection.js +++ b/view/adminhtml/web/js/testconnection.js @@ -34,7 +34,7 @@ define([ } }); }); - } + }; function resetAllMessages() { successBtnMsg.text();
Fixed snippet upload bug when uploading for the 1st time
fastly_fastly-magento2
train
php,js
0946163fe0d54292f0dd0213f9fef15fb58f5105
diff --git a/chai-immutable.js b/chai-immutable.js index <HASH>..<HASH> 100644 --- a/chai-immutable.js +++ b/chai-immutable.js @@ -53,9 +53,7 @@ this.assert( size === 0, 'expected #{this} to be empty but got size #{act}', - 'expected #{this} to not be empty', - 0, - size + 'expected #{this} to not be empty' ); } else _super.apply(this, arguments);
Remove unnecessary assert params to the empty assertion
astorije_chai-immutable
train
js
19313240055607124ca51b44175ab74b5ad158aa
diff --git a/lib/textbringer/buffer.rb b/lib/textbringer/buffer.rb index <HASH>..<HASH> 100644 --- a/lib/textbringer/buffer.rb +++ b/lib/textbringer/buffer.rb @@ -606,7 +606,7 @@ module Textbringer end_of_line forward_char s = @point - while !end_of_buffer? && byte_after != "\n" && + while !end_of_line? && Buffer.display_width(substring(s, @point)) < column forward_char end @@ -627,7 +627,7 @@ module Textbringer backward_char beginning_of_line s = @point - while !end_of_buffer? && byte_after != "\n" && + while !end_of_line? && Buffer.display_width(substring(s, @point)) < column forward_char end @@ -656,7 +656,7 @@ module Textbringer end def beginning_of_line - while !beginning_of_buffer? && byte_before != "\n" + while !beginning_of_line? backward_char end @point @@ -667,8 +667,7 @@ module Textbringer end def end_of_line - while !end_of_buffer? && - byte_after(@point) != "\n" + while !end_of_line? forward_char end @point @@ -1049,7 +1048,7 @@ module Textbringer end def transpose_chars - if end_of_buffer? || char_after == "\n" + if end_of_line? backward_char end if beginning_of_buffer?
Use beginning_of_line? and end_of_line?.
shugo_textbringer
train
rb
14b1908b3bbc8f3bc73afa4e64fa4a56aec31a20
diff --git a/test/main.js b/test/main.js index <HASH>..<HASH> 100644 --- a/test/main.js +++ b/test/main.js @@ -46,12 +46,11 @@ describe('gulp-flatten', function () { }); it('should emit arg error with nonstring option', function (done) { - var stream = flatten(123); + var stream = flatten({newPath: 123}); stream.on('error', function (err) { should.exist(err); should.exist(err.message); - should.ok(err.message === 'Path must be a string. Received undefined' - || err.message === 'Arguments to path.join must be strings') + should.ok(err.message === 'The "path" argument must be of type string') done(); }); stream.write(fileInstance);
tests now passes on node 9.x.x
armed_gulp-flatten
train
js
4d109f7ef3930ec0fd6ea3c0c86953ffd956ec08
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100755 --- a/setup.py +++ b/setup.py @@ -4,7 +4,7 @@ import sys from setuptools import setup, find_packages -install_requires = ['PyMySQL<=0.6.4'] +install_requires = ['PyMySQL<=0.6.6'] PY_VER = sys.version_info
bump supported pymysql version
aio-libs_aiomysql
train
py
6c03d6111410919930a04d826dfa25254cd871c1
diff --git a/greenhouse/__init__.py b/greenhouse/__init__.py index <HASH>..<HASH> 100644 --- a/greenhouse/__init__.py +++ b/greenhouse/__init__.py @@ -4,5 +4,4 @@ from greenhouse.scheduler import * from greenhouse.utils import * from greenhouse.pool import * from greenhouse.io import * -from greenhouse.scheduler import EXCEPTION_FILE as exception_file import greenhouse.poller diff --git a/tests/test_scheduler.py b/tests/test_scheduler.py index <HASH>..<HASH> 100644 --- a/tests/test_scheduler.py +++ b/tests/test_scheduler.py @@ -239,16 +239,6 @@ class PausingTestCase(StateClearingTestCase): class ExceptionsTestCase(StateClearingTestCase): class CustomError(Exception): pass - def setUp(self): - StateClearingTestCase.setUp(self) - self._oldprintexc = greenhouse.scheduler.PRINT_EXCEPTIONS - - greenhouse.scheduler.PRINT_EXCEPTIONS = False - - def tearDown(self): - greenhouse.scheduler.PRINT_EXCEPTIONS = self._oldprintexc - StateClearingTestCase.tearDown(self) - def test_exceptions_raised_in_grlets(self): l = [False]
clean out references to the old exception machinery in greenhouse/__init__.py and test_scheduler.py
teepark_greenhouse
train
py,py
de227330ea0c28d625ee110c7c2dc4214cd513bb
diff --git a/juju/jasyncio.py b/juju/jasyncio.py index <HASH>..<HASH> 100644 --- a/juju/jasyncio.py +++ b/juju/jasyncio.py @@ -24,6 +24,9 @@ import asyncio import signal import functools import websockets +import logging + +ROOT_LOGGER = logging.getLogger() from asyncio import Event, TimeoutError, Queue, ensure_future, \ gather, sleep, wait_for, create_subprocess_exec, subprocess, \ @@ -46,7 +49,7 @@ except ImportError: return asyncio.ensure_future(coro) -def create_task_with_handler(coro, task_name, logger): +def create_task_with_handler(coro, task_name, logger=ROOT_LOGGER): """Wrapper around "asyncio.create_task" to make sure the task exceptions are handled properly.
Fix for small bug in task handling Fixes #<I>
juju_python-libjuju
train
py
7fccecc7009c23eeb79229973f9ced8a5af7cf84
diff --git a/lakeside/__init__.py b/lakeside/__init__.py index <HASH>..<HASH> 100755 --- a/lakeside/__init__.py +++ b/lakeside/__init__.py @@ -40,7 +40,7 @@ def get_devices(username, password): info = r.json() for item in info['items']: - devices.append({'address': item['device']['wifi']['lan_ip_addr'], 'code': item['device']['local_code'], 'type': item['device']['product']['product_code']}) + devices.append({'address': item['device']['wifi']['lan_ip_addr'], 'code': item['device']['local_code'], 'type': item['device']['product']['product_code'], 'name': item['device']['alias_name']}) return devices diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -23,11 +23,11 @@ import warnings dynamic_requires = [] -version = 0.1 +version = 0.2 setup( name='lakeside', - version=0.1, + version=0.2, author='Matthew Garrett', author_email='mjg59@google.com', url='http://github.com/google/python-lakeside',
Provide the device name and bump to <I>
google_python-lakeside
train
py,py
32fe43cbe929c5b847735e8aea305b315cb0945e
diff --git a/src/nu/validator/servlet/VerifierServletTransaction.java b/src/nu/validator/servlet/VerifierServletTransaction.java index <HASH>..<HASH> 100644 --- a/src/nu/validator/servlet/VerifierServletTransaction.java +++ b/src/nu/validator/servlet/VerifierServletTransaction.java @@ -1226,7 +1226,7 @@ class VerifierServletTransaction implements DocumentModeHandler, SchemaResolver } String language = (String) request.getAttribute( "http://validator.nu/properties/document-language"); - if (!"".equals(language)) { + if (!"".equals(language) && language != null) { String langFieldName = "LANG_" + language.toUpperCase(); if ("zh-hans".equals(language)) { langFieldName = "LANG_ZH_HANS";
Prevent NPE caused by previous commit
validator_validator
train
java
b2c16eab05f0704c3da4cbf19e273786b61e3d07
diff --git a/lib/dialects/http.js b/lib/dialects/http.js index <HASH>..<HASH> 100644 --- a/lib/dialects/http.js +++ b/lib/dialects/http.js @@ -31,9 +31,6 @@ function INIT(options) { function httpRequest(operation) { var self = this return function(req, resp) { - if (!~ self._allowedJobTypes.indexOf(req.params.jobType)) - return $done('Not a valid job type', 400); - var $done = function(err, code, msg) { if (!msg && !_.isNumber(code)) { msg = code||'' // `code` is optional @@ -45,6 +42,9 @@ function httpRequest(operation) { resp.end(!!err ? ''+err : (''+msg || '')) } + if (!~ self._allowedJobTypes.indexOf(req.params.jobType)) + return $done('Not a valid job type', 400); + return OPS[operation](req, resp, $done) } }
Fix bug if bad job-type passed to HTTP dialect
Rafflecopter_deetoo
train
js
3fcd99780dace81196bedbbe385b94feb33c30e5
diff --git a/service/src/main/java/org/ops4j/pax/web/service/internal/HttpServiceRequestWrapper.java b/service/src/main/java/org/ops4j/pax/web/service/internal/HttpServiceRequestWrapper.java index <HASH>..<HASH> 100644 --- a/service/src/main/java/org/ops4j/pax/web/service/internal/HttpServiceRequestWrapper.java +++ b/service/src/main/java/org/ops4j/pax/web/service/internal/HttpServiceRequestWrapper.java @@ -70,7 +70,7 @@ public class HttpServiceRequestWrapper extends HttpServletRequestWrapper { super.setAttribute(name, value); } - private void handleAuthenticationType(final String authenticationType) { + private void handleAuthenticationType(final Object authenticationType) { if (!isJettyRequestAvailable()) { return; } @@ -85,7 +85,7 @@ public class HttpServiceRequestWrapper extends HttpServletRequestWrapper { m_request.setAuthType((String) authenticationType); } - private void handleRemoteUser(final String remoteUser) { + private void handleRemoteUser(final Object remoteUser) { } private boolean isJettyRequestAvailable() {
PAXWEB-<I> Handle Authentication type in first phase. Remote User will follow.
ops4j_org.ops4j.pax.web
train
java
7ad1374d136b4a614cc10f5008542259880f629c
diff --git a/playitagainsam/eventlog.py b/playitagainsam/eventlog.py index <HASH>..<HASH> 100644 --- a/playitagainsam/eventlog.py +++ b/playitagainsam/eventlog.py @@ -52,15 +52,6 @@ class EventLog(object): # Collapse consecutive writes into a single chunk. if self.events[-1]["act"] == "WRITE": self.events[-1]["data"] += event["data"] - # Collapse DEL and term wiping into a no-op. - if self.events[-1]["data"] == "\x08\x1b[K": - if len(self.events) >= 3: - e_echo, e_del = self.events[-3:-1] - if e_echo["act"] == "ECHO": - if e_del["act"] == "READ": - if e_del["data"] == "\x7f": - del self.events[-2:] - e_echo["data"] = e_echo["data"][:-1] return # Collapse read/write of same data into an "ECHO". if self.events[-1]["act"] == "READ":
Remove code for collapsing backspaces, it no longer works. This will have to be redone in a more clever way, possibly as a separate "filter" pass during write.
rfk_playitagainsam
train
py
083f98c0b04140426c5bc7fddeed78dc7a826363
diff --git a/raiden/network/proxies/secret_registry.py b/raiden/network/proxies/secret_registry.py index <HASH>..<HASH> 100644 --- a/raiden/network/proxies/secret_registry.py +++ b/raiden/network/proxies/secret_registry.py @@ -151,7 +151,6 @@ class SecretRegistry: estimated_transaction = self.client.estimate_gas( self.proxy, "registerSecretBatch", log_details, secrets_to_register ) - receipt = None transaction_hash = None msg = None transaction_mined = None @@ -186,8 +185,10 @@ class SecretRegistry: # If the transaction was sent it must not fail. If this happened # some of our assumptions is broken therefore the error is # unrecoverable - if estimated_transaction is not None and receipt is not None: - if receipt["gasUsed"] == estimated_transaction.estimated_gas: + if transaction_mined is not None: + receipt = transaction_mined.receipt + + if receipt["gasUsed"] == transaction_mined.startgas: # The transaction failed and all gas was used. This can # happen because of: #
bugfix: receit was always none
raiden-network_raiden
train
py
28e1ccb48fdc807319181276d333df2684ad012e
diff --git a/src/index.js b/src/index.js index <HASH>..<HASH> 100644 --- a/src/index.js +++ b/src/index.js @@ -21,7 +21,7 @@ class PublicationServer { * to. * @param {Object} server The HTTP server to allow Primus to listen on. */ - constructor({authFn, mountPath, errHandler, server} = {}) { + constructor({authFn, mountPath, errHandler, server, transformer} = {}) { assert(authFn, 'Must provide an authorization function'); this._subscriptions = {}; @@ -39,7 +39,7 @@ class PublicationServer { authorization: this._authFn, pathname: this._mountPath, parser: 'EJSON', - transformer: 'uws', + transformer: transformer || 'uws', pingInterval: false });
Add the option for a configurable transformer
mixmaxhq_publication-server
train
js