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
38b1d84e6fe7ff21bbe8dc7529a7650ab06d58d5
diff --git a/sphinxcontrib/paverutils.py b/sphinxcontrib/paverutils.py index <HASH>..<HASH> 100644 --- a/sphinxcontrib/paverutils.py +++ b/sphinxcontrib/paverutils.py @@ -191,7 +191,6 @@ def run_sphinx(options, *option_sets): for (name, value) in getattr(options, 'config_args', {}).items() ] sphinxopts = [ - '', '-b', options.get('builder', 'html'), '-d', paths.doctrees, '-c', paths.confdir,
compatibility with sphinx pr #<I>
sphinx-contrib_paverutils
train
py
9c62da4115a04599d944e36ea03f22996ddd45f5
diff --git a/core/codegen/src/test/java/org/overture/codegen/tests/ExpressionTestCase.java b/core/codegen/src/test/java/org/overture/codegen/tests/ExpressionTestCase.java index <HASH>..<HASH> 100644 --- a/core/codegen/src/test/java/org/overture/codegen/tests/ExpressionTestCase.java +++ b/core/codegen/src/test/java/org/overture/codegen/tests/ExpressionTestCase.java @@ -22,7 +22,7 @@ public class ExpressionTestCase extends CodeGenBaseTestCase @Override protected String generateActualOutput() throws AnalysisException { - return JavaCodeGenUtil.generateJavaFromExp(CodeGenTestUtil.getFileContent(file)); + return JavaCodeGenUtil.generateJavaFromExp(CodeGenTestUtil.getFileContent(file)).getContent(); } @Override
Updated expression test case to work with notion of 'oo status'
overturetool_overture
train
java
2f8148d0c04c25d0825cb5653825045c7c317a80
diff --git a/_config.php b/_config.php index <HASH>..<HASH> 100644 --- a/_config.php +++ b/_config.php @@ -1,6 +1,13 @@ <?php /** + * - CMS_DIR: Path relative to webroot, e.g. "cms" + * - CMS_PATH: Absolute filepath, e.g. "/var/www/my-webroot/cms" + */ +define('CMS_DIR', 'cms'); +define('CMS_PATH', BASE_PATH . '/' . CMS_DIR); + +/** * Extended URL rules for the CMS module * * @package cms @@ -42,4 +49,4 @@ CMSMenu::remove_menu_item('CMSPageSettingsController'); CMSMenu::remove_menu_item('CMSPageHistoryController'); CMSMenu::remove_menu_item('CMSPageReportsController'); CMSMenu::remove_menu_item('CMSPageAddController'); -CMSMenu::remove_menu_item('CMSFileAddController'); \ No newline at end of file +CMSMenu::remove_menu_item('CMSFileAddController');
MINOR Move definition of CMS_DIR and CMS_PATH into cms/_config.php
silverstripe_silverstripe-siteconfig
train
php
ce9cdac1b53d4dc87f150608fd5e9f1e7a5ac024
diff --git a/bcbio/variation/multiallelic.py b/bcbio/variation/multiallelic.py index <HASH>..<HASH> 100644 --- a/bcbio/variation/multiallelic.py +++ b/bcbio/variation/multiallelic.py @@ -35,11 +35,14 @@ def to_single(in_file, data): out_file = "%s-nomultiallelic%s" % utils.splitext_plus(in_file) if not utils.file_exists(out_file): ba_file, ma_file = _split_mulitallelic(in_file, data) - ready_ma_file = _decompose(ma_file, data) - ann_ma_file = effects.add_to_vcf(ready_ma_file, data) - if ann_ma_file: - ready_ma_file = ann_ma_file - out_file = vcfutils.merge_sorted([ready_ma_file, ba_file], out_file, data) + if vcfutils.vcf_has_variants(ma_file): + ready_ma_file = _decompose(ma_file, data) + ann_ma_file = effects.add_to_vcf(ready_ma_file, data) + if ann_ma_file: + ready_ma_file = ann_ma_file + out_file = vcfutils.merge_sorted([ready_ma_file, ba_file], out_file, data) + else: + utils.symlink_plus(in_file, out_file) return vcfutils.bgzip_and_index(out_file, data["config"]) def _decompose(in_file, data):
Multi-allelic variants: skip decomposing work and merging if no multi-allelic present
bcbio_bcbio-nextgen
train
py
ca2aa5da5d6b876d550d9611f6c9c8fc509461f1
diff --git a/aws/resource_aws_elasticsearch_domain_test.go b/aws/resource_aws_elasticsearch_domain_test.go index <HASH>..<HASH> 100644 --- a/aws/resource_aws_elasticsearch_domain_test.go +++ b/aws/resource_aws_elasticsearch_domain_test.go @@ -560,7 +560,7 @@ func TestAccAWSElasticSearchDomain_update_version(t *testing.T) { var domain1, domain2, domain3 elasticsearch.ElasticsearchDomainStatus ri := acctest.RandInt() - resource.Test(t, resource.TestCase{ + resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, CheckDestroy: testAccCheckESDomainDestroy,
Run the ES Update Version test in parallel with the others This PR was originally created before the move to parallel acceptance tests so needed fixing up.
terraform-providers_terraform-provider-aws
train
go
a016fddcc272c4bd747e712de7a50f1cec8dd1c8
diff --git a/maven-plugin/src/main/java/net/revelc/code/formatter/FormatterMojo.java b/maven-plugin/src/main/java/net/revelc/code/formatter/FormatterMojo.java index <HASH>..<HASH> 100644 --- a/maven-plugin/src/main/java/net/revelc/code/formatter/FormatterMojo.java +++ b/maven-plugin/src/main/java/net/revelc/code/formatter/FormatterMojo.java @@ -423,7 +423,7 @@ public class FormatterMojo extends AbstractMojo implements ConfigurationSource { Result result; if (file.getName().endsWith(".java") && javaFormatter.isInitialized()) { result = this.javaFormatter.formatFile(file, this.lineEnding, dryRun); - } else if (jsFormatter.isInitialized()) { + } else if (file.getName().endsWith(".js") && jsFormatter.isInitialized()) { result = this.jsFormatter.formatFile(file, this.lineEnding, dryRun); } else { result = Result.SKIPPED;
[javascript] Javascript needs to do same as java and only look at javascript files
revelc_formatter-maven-plugin
train
java
de3947351bf4635a258149b1752a4b9c42da276a
diff --git a/graphene_django/__init__.py b/graphene_django/__init__.py index <HASH>..<HASH> 100644 --- a/graphene_django/__init__.py +++ b/graphene_django/__init__.py @@ -5,7 +5,7 @@ from .fields import ( DjangoConnectionField, ) -__version__ = '2.0.dev2017083101' +__version__ = '2.0.0' __all__ = [ '__version__', diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -57,11 +57,11 @@ setup( install_requires=[ 'six>=1.10.0', - 'graphene>=2.0.dev', + 'graphene>=2.0', 'Django>=1.8.0', 'iso8601', 'singledispatch>=3.4.0.3', - 'promise>=2.1.dev', + 'promise>=2.1', ], setup_requires=[ 'pytest-runner',
Updated graphene-django to <I> 🎉
graphql-python_graphene-django
train
py,py
0d83e493def6d5515b3f3537e73cbacd4c4a4516
diff --git a/cli.js b/cli.js index <HASH>..<HASH> 100755 --- a/cli.js +++ b/cli.js @@ -18,7 +18,14 @@ process.cliLogger = require('webpack-log')({ const updateNotifier = require('update-notifier'); const packageJson = require('./package.json'); -updateNotifier({ pkg: packageJson }).notify(); +const notifier = updateNotifier({ + pkg, + updateCheckInterval: 1000 * 60 * 60 * 24 * 7, // 1 week +}); + +if (notifier.update) { + console.log(`Update available: ${notifier.update.latest}`); +} const semver = require('semver');
feat: update notify period set interval to be 1 week
webpack_webpack-cli
train
js
3451019e2ba44a285495d52029e6398ac88d2f9f
diff --git a/tornado/test/process_test.py b/tornado/test/process_test.py index <HASH>..<HASH> 100644 --- a/tornado/test/process_test.py +++ b/tornado/test/process_test.py @@ -57,9 +57,11 @@ class ProcessTest(LogTrapTestCase): return "http://127.0.0.1:%d%s" % (port, path) sockets = bind_sockets(port, "127.0.0.1") # ensure that none of these processes live too long - signal.alarm(5) + signal.alarm(5) # master process try: id = fork_processes(3, max_restarts=3) + assert id is not None + signal.alarm(5) # child processes except SystemExit, e: # if we exit cleanly from fork_processes, all the child processes # finished with status 0
Set alarms on child processes in process_test. These alarms used to be there, but got dropped in a previous change because I had assumed the child processes would inherit the parent's alarm.
tornadoweb_tornado
train
py
2af8ca44d7c21ad8dcd2fae8e63010f36b4ed231
diff --git a/src/com/dtmilano/android/viewclient.py b/src/com/dtmilano/android/viewclient.py index <HASH>..<HASH> 100644 --- a/src/com/dtmilano/android/viewclient.py +++ b/src/com/dtmilano/android/viewclient.py @@ -4075,7 +4075,7 @@ On OSX install ''') def installPackage(self, apk): - return subprocess.check_call([self.adb, "install", "-r", apk], shell=False) + return subprocess.check_call([self.adb, "-s", self.serialno, "install", "-r", apk], shell=False) @staticmethod def writeViewImageToFileInDir(view):
let install apk by serialno
dtmilano_AndroidViewClient
train
py
10af402a3b059d26bb4c02d359906e05a3231e2c
diff --git a/demo/src/components/SrlComponent.js b/demo/src/components/SrlComponent.js index <HASH>..<HASH> 100644 --- a/demo/src/components/SrlComponent.js +++ b/demo/src/components/SrlComponent.js @@ -167,9 +167,10 @@ function toHierplaneTrees(response) { }; }); - // Filter out the trees with only a single child (AllenNLP's SRL output includes a node - // for each verb with a single child, the verb itself). - return trees.filter(t => t.root.children.length > 1); + // Filter out the trees without any children, as Hierplane can't render something that isn't + // a tree of at least one level. We can remove this once this bug is fixed: + // https://github.com/allenai/hierplane/issues/74 + return trees.filter(t => t.root.children.length > 0); } class SrlInput extends React.Component {
Filter out trees with no children, but retain those with a single child. (#<I>) * Fixes #<I>; * Fixes #<I>;
allenai_allennlp
train
js
42942b0b9368be6b15c216e7c2d7cf2c70afadec
diff --git a/tests/network/test_timeseries.py b/tests/network/test_timeseries.py index <HASH>..<HASH> 100644 --- a/tests/network/test_timeseries.py +++ b/tests/network/test_timeseries.py @@ -1699,8 +1699,23 @@ class TestTimeSeries: ).all() def test_timesteps_load_feedin_case(self): - # ToDo implement - pass + self.edisgo.set_time_series_worst_case_analysis() + time_steps_load_case = self.edisgo.timeseries.timeindex_worst_cases[ + self.edisgo.timeseries.timeindex_worst_cases.index.str.contains("load") + ].values + assert ( + self.edisgo.timeseries.timesteps_load_feedin_case.loc[time_steps_load_case] + == "load_case" + ).all() + time_steps_feedin_case = self.edisgo.timeseries.timeindex_worst_cases[ + self.edisgo.timeseries.timeindex_worst_cases.index.str.contains("feed") + ].values + assert ( + self.edisgo.timeseries.timesteps_load_feedin_case.loc[ + time_steps_feedin_case + ] + == "feed-in_case" + ).all() def test_reduce_memory(self): # ToDo implement
Add test time steps load and feed-in case
openego_eDisGo
train
py
5b598e2b882bb37b33ac034c7371331e81675b7f
diff --git a/bokeh/tests/test_ar_downsample.py b/bokeh/tests/test_ar_downsample.py index <HASH>..<HASH> 100644 --- a/bokeh/tests/test_ar_downsample.py +++ b/bokeh/tests/test_ar_downsample.py @@ -147,7 +147,7 @@ class _ProxyTester(object): class _ShaderTester(_ProxyTester): def __init__(self, *args): super(_ProxyTester, self).__init__(*args) - if sys.modules.has_key('abstract_rendering'): + if 'abstract_rendering' in sys.modules: self.reifyBase = ar.Shader def test_out(self): @@ -173,7 +173,7 @@ class _InfoTester(_ProxyTester): class _AggregatorTester(_ProxyTester): def __init__(self, *args): super(_ProxyTester, self).__init__(*args) - if sys.modules.has_key('abstract_rendering'): + if 'abstract_rendering' in sys.modules: self.reifyBase = ar.Aggregator
Removed 'has_key', replaced with 'in'
bokeh_bokeh
train
py
df3fcefdf13438bc0adee845d84fc4fed940e459
diff --git a/fs/fs.go b/fs/fs.go index <HASH>..<HASH> 100644 --- a/fs/fs.go +++ b/fs/fs.go @@ -242,7 +242,7 @@ func resolveReferenceDirs(env Environment, gitStorageDir string) []string { // not, the empty string and false is returned instead. func existsAlternate(objs string) (string, bool) { objs = strings.TrimSpace(objs) - if strings.HasPrefix(objs, "#") { + if strings.HasPrefix(objs, "\"") { var err error unquote := strings.LastIndex(objs, "\"")
fs/fs.go: strings.HasPrefix typo existsAlternate supposes a valid alternate string, and sanitizes it. One case of this is unquoting a quoted string using strconv.Unquote, which we trigger if and only if the string begins with a double-quote character, ". This function was extracted from a similar-looking function that ignores comments (i.e., those strings beginning with '#'), so a typo was made here. This patch fixes that.
git-lfs_git-lfs
train
go
cf2a13fbbf3dc9ed9f8809b9582c514973734c62
diff --git a/lib/conceptql/operators/from.rb b/lib/conceptql/operators/from.rb index <HASH>..<HASH> 100644 --- a/lib/conceptql/operators/from.rb +++ b/lib/conceptql/operators/from.rb @@ -27,7 +27,9 @@ module ConceptQL end def table_name - values.first.to_sym rescue nil + name = values.first + name = name.to_sym if name.respond_to?(:to_sym) + name end def requried_columns
From: handle QualifiedIdentifier
outcomesinsights_conceptql
train
rb
969e1f271d440bca699f6493674d7f4e8a47926b
diff --git a/IlluminaUtils/utils/helperfunctions.py b/IlluminaUtils/utils/helperfunctions.py index <HASH>..<HASH> 100644 --- a/IlluminaUtils/utils/helperfunctions.py +++ b/IlluminaUtils/utils/helperfunctions.py @@ -14,6 +14,7 @@ import os import sys import gzip import stat +import math import numpy import cPickle import textwrap @@ -462,12 +463,17 @@ def visualize_qual_stats_dict(D, dest, title, split_tiles = False): return float(max(D[p][tile]['count'])) + def get_num_tiles(D, p = '1'): + return len(D[p].keys()) + + num_tiles = get_num_tiles(D) + + num_rows_to_show = 8 + fig = plt.figure(figsize = (30, 16)) if split_tiles: - fig = plt.figure(figsize = (30, 16)) - gs = Gs(6, 80) + gs = Gs(num_rows_to_show, int(math.ceil(num_tiles / num_rows_to_show)) * 2) else: - fig = plt.figure(figsize = (30, 16)) - gs = Gs(6, 16) + gs = Gs(num_rows_to_show, int(math.ceil(num_tiles / num_rows_to_show))) plt.rcParams.update({'axes.linewidth' : 0.9}) plt.rc('grid', color='0.50', linestyle='-', linewidth=0.1)
try to do a bit better with variable number of tiles
merenlab_illumina-utils
train
py
d62a255eab869f0e9c66437e45c5504777b0a3d5
diff --git a/src/Drush/UpdateDBStatus.php b/src/Drush/UpdateDBStatus.php index <HASH>..<HASH> 100644 --- a/src/Drush/UpdateDBStatus.php +++ b/src/Drush/UpdateDBStatus.php @@ -12,6 +12,11 @@ class UpdateDBStatus extends Check { $response->test(function ($check) { $context = $check->context; $output = $context->drush->updatedbStatus()->getOutput(); + // Sometimes "No database updates required" is in Stderr, and thus is + // empty. + if (empty($output)) { + return TRUE; + } if (count($output) === 1) { $output = reset($output); if (strpos($output, 'No database updates required') === 0) {
No updates is reported in stderr.
drutiny_drutiny
train
php
7f335274bf2484a59f54b6a79f997f4614e3dee9
diff --git a/src/Generator.php b/src/Generator.php index <HASH>..<HASH> 100644 --- a/src/Generator.php +++ b/src/Generator.php @@ -71,7 +71,7 @@ class Generator protected function detectDrivers() { try{ - if (class_exists('Cache')) { + if (class_exists('Auth')) { $class = get_class(\Auth::driver()); $this->extra['Auth'] = array($class); $this->interfaces['\Illuminate\Auth\UserProviderInterface'] = $class;
Fix a copy paste error (probably) I don't use this helper, however, I guess that line wasnt correct.
barryvdh_laravel-ide-helper
train
php
a971ffb88003d6f49bf1789ca7df95aa538d2be0
diff --git a/plugins/inputs/sqlserver/sqlserver.go b/plugins/inputs/sqlserver/sqlserver.go index <HASH>..<HASH> 100644 --- a/plugins/inputs/sqlserver/sqlserver.go +++ b/plugins/inputs/sqlserver/sqlserver.go @@ -351,7 +351,6 @@ EXEC(@SQL) const sqlDatabaseIOV2 = `SELECT 'sqlserver_database_io' As [measurement], REPLACE(@@SERVERNAME,'\',':') AS [sql_instance], -SERVERPROPERTY('ServerName') AS [host], DB_NAME([vfs].[database_id]) [database_name], vfs.io_stall_read_ms AS read_latency_ms, vfs.num_of_reads AS reads,
Remove host tag from Database IO v2 Query (#<I>)
influxdata_telegraf
train
go
07a33bef38e6a95b21dc6d8bf090bc96f4617ae4
diff --git a/cmsplugin_cascade/link/forms.py b/cmsplugin_cascade/link/forms.py index <HASH>..<HASH> 100644 --- a/cmsplugin_cascade/link/forms.py +++ b/cmsplugin_cascade/link/forms.py @@ -29,7 +29,7 @@ class LinkForm(ModelForm): instance = kwargs.get('instance') mailto = 'mailto: ' urlvalidator = URLValidator() - initial = {'link_content': instance.glossary.get('link_content', '')} + initial = {'link_content': instance and instance.glossary.get('link_content', '') or ''} try: if instance.text_link.startswith(mailto): initial['link_type'] = 'email'
Fixed: instance is now evaluated before fetching
jrief_djangocms-cascade
train
py
6ccdc1e2d53b70a9ac002396c164f2966cdbbc21
diff --git a/tests/Pug/PugSymfonyEngineTest.php b/tests/Pug/PugSymfonyEngineTest.php index <HASH>..<HASH> 100644 --- a/tests/Pug/PugSymfonyEngineTest.php +++ b/tests/Pug/PugSymfonyEngineTest.php @@ -484,6 +484,7 @@ class PugSymfonyEngineTest extends KernelTestCase ' bar: biz', 'services:', ' templating.engine.pug:', + ' public: true', ' class: Pug\PugSymfonyEngine', ' arguments: ["@kernel"]', '',
Add public: true also in unit tests
pug-php_pug-symfony
train
php
517cbc62dbb3ccb4ae1062cca48ed9b50e9811ba
diff --git a/src/index.js b/src/index.js index <HASH>..<HASH> 100755 --- a/src/index.js +++ b/src/index.js @@ -184,6 +184,7 @@ nativeBindings.nativeGl.onconstruct = (gl, canvas) => { }; const framebuffer = { + canvas, framebuffer: fbo, colorTexture, depthStencilTexture,
Emit canvas in iframe framebuffer event
exokitxr_exokit
train
js
7557eb567f9ab2567bbdac5f29a27083b07d20ff
diff --git a/molgenis-questionnaires/src/main/frontend/src/store/getters.js b/molgenis-questionnaires/src/main/frontend/src/store/getters.js index <HASH>..<HASH> 100644 --- a/molgenis-questionnaires/src/main/frontend/src/store/getters.js +++ b/molgenis-questionnaires/src/main/frontend/src/store/getters.js @@ -36,7 +36,14 @@ const getTotalNumberOfFieldsForChapter = (chapter, formData) => { return accumulator + getTotalNumberOfFieldsForChapter(child, formData) } - if (child.visible(formData)) { + let visible = false + try { + visible = child.visible(formData) + } catch (e) { + console.log('Something went wrong evaluating expression:\n', e) + } + + if (visible) { accumulator++ }
fix(getters.js): catch exception when evaluating visible expression
molgenis_molgenis
train
js
bd7266391f772e9b552fd44e2d696e3b8db3ced3
diff --git a/lib/translation_center/translation_helpers.rb b/lib/translation_center/translation_helpers.rb index <HASH>..<HASH> 100644 --- a/lib/translation_center/translation_helpers.rb +++ b/lib/translation_center/translation_helpers.rb @@ -59,7 +59,9 @@ module I18n # added another class to be used def html_message key = keys.last.to_s.gsub('_', ' ').gsub(/\b('?[a-z])/) { $1.capitalize } - %(<span class="translation_missing inplace_key" title="translation missing: #{keys.join('.')}">#{key}</span>) + translation_key = keys + translation_key.shift + %(<span class="translation_missing inplace_key" data-id="#{TranslationCenter::TranslationKey.find_by_name(translation_key.join('.')).id}" title="translation missing: #{keys.join('.')}">#{key}</span>) end end
add key id to the span returned from missing translation
BadrIT_translation_center
train
rb
f7455043fcb92bc915eaf6390df39d985e22a61d
diff --git a/src/middleware/authenticator.js b/src/middleware/authenticator.js index <HASH>..<HASH> 100644 --- a/src/middleware/authenticator.js +++ b/src/middleware/authenticator.js @@ -3,7 +3,7 @@ import jwt from 'jsonwebtoken'; import debug from 'debug'; const verify = bluebird.promisify(jwt.verify); -const noauth = RegExp(/\/auth\/(login|register|password|now.*)$/, 'i'); +const noauth = RegExp(/\/auth\/(login|register|password.*|now)$/, 'i'); const log = debug('uwave:v1:authenticator');
fix wrongly placed pipe in regex
u-wave_http-api
train
js
091ad89197b7b0c22e04e0aac1749e2ca4218b43
diff --git a/docs/storage/driver/storagedriver.go b/docs/storage/driver/storagedriver.go index <HASH>..<HASH> 100644 --- a/docs/storage/driver/storagedriver.go +++ b/docs/storage/driver/storagedriver.go @@ -37,11 +37,8 @@ const CurrentVersion Version = "0.1" // filesystem-like key/value object storage. Storage Drivers are automatically // registered via an internal registration mechanism, and generally created // via the StorageDriverFactory interface (https://godoc.org/github.com/docker/distribution/registry/storage/driver/factory). -// See below for an example of how to get a StorageDriver for S3: -// -// import _ "github.com/docker/distribution/registry/storage/driver/s3-aws" -// s3Driver, err = factory.Create("s3", storageParams) -// // assuming no error, s3Driver is the StorageDriver that communicates with S3 according to storageParams +// Please see the aforementioned factory package for example code showing how to get an instance +// of a StorageDriver type StorageDriver interface { // Name returns the human-readable "name" of the driver, useful in error // messages and logging. By convention, this will just be the registration
Remove the example Instead, direct users to the one in the factory package
docker_distribution
train
go
dffebb93d4e6adf12fa53b7254fae6119609d590
diff --git a/lib/fastly-rails/active_record/surrogate_key.rb b/lib/fastly-rails/active_record/surrogate_key.rb index <HASH>..<HASH> 100644 --- a/lib/fastly-rails/active_record/surrogate_key.rb +++ b/lib/fastly-rails/active_record/surrogate_key.rb @@ -16,7 +16,7 @@ module FastlyRails table_name end - def service_id + def fastly_service_identifier FastlyRails.service_id end end @@ -37,8 +37,8 @@ module FastlyRails self.class.purge_all end - def service_id - self.class.service_id + def fastly_service_identifier + self.class.fastly_service_identifier end end end
rename active_record mix-in's `service_id` methods
fastly_fastly-rails
train
rb
61179ddb596242d45a4e5d8d0c9a14531d3678ba
diff --git a/client.go b/client.go index <HASH>..<HASH> 100644 --- a/client.go +++ b/client.go @@ -723,6 +723,7 @@ func clientWriter(c *Client, w io.Writer, pendingRequests map[uint64]*AsyncResul wr.Request = m.request m.request = nil if m.done == nil { + c.Stats.incRPCCalls() asyncResultPool.Put(m) } diff --git a/server.go b/server.go index <HASH>..<HASH> 100644 --- a/server.go +++ b/server.go @@ -371,6 +371,7 @@ func serveRequest(s *Server, responsesChan chan<- *serverMessage, stopChan <-cha if skipResponse { m.Response = nil m.Error = "" + s.Stats.incRPCCalls() serverMessagePool.Put(m) }
Count Send() calls on client and server in Stats.RPCCalls
valyala_gorpc
train
go,go
db5a4e93b5232623ecb866c801b01ffe9f840ce0
diff --git a/src/core/SaltScanner.java b/src/core/SaltScanner.java index <HASH>..<HASH> 100644 --- a/src/core/SaltScanner.java +++ b/src/core/SaltScanner.java @@ -88,7 +88,7 @@ public class SaltScanner { /** A holder for storing the first exception thrown by a scanner if something * goes pear shaped. Make sure to synchronize on this object when checking * for null or assigning from a scanner's callback. */ - private Exception exception; + private volatile Exception exception; /** * Default ctor that performs some validation. Call {@link scan} after @@ -372,13 +372,15 @@ public class SaltScanner { */ private void handleException(final Exception e) { // make sure only one scanner can set the exception - synchronized (this) { - if (exception == null) { - exception = e; - } else { - // TODO - it would be nice to close and cancel the other scanners but - // for now we have to wait for them to finish and/or throw exceptions. - LOG.error("Another scanner threw an exception", e); + if (exception == null) { + synchronized (this) { + if (exception == null) { + exception = e; + } else { + // TODO - it would be nice to close and cancel the other scanners but + // for now we have to wait for them to finish and/or throw exceptions. + LOG.error("Another scanner threw an exception", e); + } } }
Naive DCLP on exception field to ensure we only get first reference.
OpenTSDB_opentsdb
train
java
f45563eaeaa7f3a89b2c9d685e716ec7edd66f97
diff --git a/service_discovery/service_discovery.go b/service_discovery/service_discovery.go index <HASH>..<HASH> 100644 --- a/service_discovery/service_discovery.go +++ b/service_discovery/service_discovery.go @@ -89,7 +89,7 @@ var _ = ServiceDiscoveryDescribe("Service Discovery", func() { Describe("Adding an internal route on an app", func() { It("successfully creates a policy", func() { - curlArgs := appNameFrontend + "." + Config.GetAppsDomain() + "/proxy/" + internalHostName + "." + internalDomainName + ":8080" + curlArgs := Config.Protocol() + appNameFrontend + "." + Config.GetAppsDomain() + "/proxy/" + internalHostName + "." + internalDomainName + ":8080" Eventually(func() string { curl := helpers.Curl(Config, curlArgs).Wait() return string(curl.Out.Contents())
Add protocol to service discovery app url.
cloudfoundry_cf-acceptance-tests
train
go
1621e91f9bac616c61f6944aade87d910927c9fb
diff --git a/src/Field/Configurator/IdConfigurator.php b/src/Field/Configurator/IdConfigurator.php index <HASH>..<HASH> 100644 --- a/src/Field/Configurator/IdConfigurator.php +++ b/src/Field/Configurator/IdConfigurator.php @@ -27,7 +27,7 @@ final class IdConfigurator implements FieldConfiguratorInterface $maxLength = Crud::PAGE_INDEX === $context->getCrud()->getCurrentPage() ? 7 : -1; } - if (-1 !== $maxLength) { + if (-1 !== $maxLength && !is_null($field->getValue()) { $field->setFormattedValue(u($field->getValue())->truncate($maxLength, '…')); } }
Display null when an Id is null Add a check to not truncate a null field value. This is useful when displaying id of children which are not necessarily initialized yet.
EasyCorp_EasyAdminBundle
train
php
e95eba8fa0537d010ce2f936910f8044f573c88c
diff --git a/src/Carbon/Lang/uk.php b/src/Carbon/Lang/uk.php index <HASH>..<HASH> 100644 --- a/src/Carbon/Lang/uk.php +++ b/src/Carbon/Lang/uk.php @@ -24,7 +24,7 @@ return array( 'min' => ':count хвилину|:count хвилини|:count хвилин', 'second' => ':count секунду|:count секунди|:count секунд', 's' => ':count секунду|:count секунди|:count секунд', - 'ago' => ':time назад', + 'ago' => ':time тому', 'from_now' => 'через :time', 'after' => ':time після', 'before' => ':time до',
update uk.php Word "назад" is not so popular nowadays. Most people use "тому" after counted time
briannesbitt_Carbon
train
php
9089afda527e2ac0572c3bc5ba90f8ca3548f26d
diff --git a/canmatrix/compare.py b/canmatrix/compare.py index <HASH>..<HASH> 100644 --- a/canmatrix/compare.py +++ b/canmatrix/compare.py @@ -321,14 +321,14 @@ def compareFrame(f1, f2, ignore=None): if transmitter not in f1.transmitter: result.addChild(compareResult("added", "Frame-Transmitter", f2)) - for sg1 in f1.SignalGroups: + for sg1 in f1.signalGroups: sg2 = f2.signalGroupbyName(sg1.name) if sg2 is None: result.addChild(compareResult("removed", "Signalgroup", sg1)) else: result.addChild(compareSignalGroup(sg1, sg2)) - for sg2 in f2._SignalGroups: + for sg2 in f2.signalGroups: if f1.signalGroupbyName(sg2.name) is None: result.addChild(compareResult("added", "Signalgroup", sg2)) return result
Fix variable name error that broke comparison feature
ebroecker_canmatrix
train
py
e16cd4f871f87a0add2a2c38114bc798909d0862
diff --git a/centinel/client.py b/centinel/client.py index <HASH>..<HASH> 100644 --- a/centinel/client.py +++ b/centinel/client.py @@ -1,10 +1,10 @@ -import os -import sys -import json import glob import imp +import json import logging +import os import random +import sys import tarfile import time
alphabetically sorted import list in client.py
iclab_centinel
train
py
53e2c0eecc1ebef18209796b7996110d31fc833d
diff --git a/tests/test_mark_tokens.py b/tests/test_mark_tokens.py index <HASH>..<HASH> 100644 --- a/tests/test_mark_tokens.py +++ b/tests/test_mark_tokens.py @@ -608,6 +608,12 @@ j # not a complex number, just a name source = f.read() except OSError: continue + + # Astroid fails with a syntax error if a type comment is on its own line + if self.is_astroid_test and re.search(r'^\s*# type: ', source, re.MULTILINE): + print('Skipping', filename) + continue + m = self.create_mark_checker(source) m.verify_all_nodes(self)
Skip modules with invalid type comments in astroid
gristlabs_asttokens
train
py
1b62b0c6f4a9b7d7ae7692002f33449186fbf577
diff --git a/propagation.go b/propagation.go index <HASH>..<HASH> 100644 --- a/propagation.go +++ b/propagation.go @@ -71,11 +71,6 @@ const ( // span, err := tracer.Join("opName", TextMap, carrier) // TextMap - - // SplitBinary is DEPRECATED - SplitBinary - // SplitText is DEPRECATED - SplitText ) // TextMapWriter is the Inject() carrier for the TextMap builtin format. With @@ -145,25 +140,3 @@ func (c HTTPHeaderTextMapCarrier) ForeachKey(handler func(key, val string) error } return nil } - -// SplitTextCarrier is DEPRECATED -type SplitTextCarrier struct { - TracerState map[string]string - Baggage map[string]string -} - -// NewSplitTextCarrier is DEPRECATED -func NewSplitTextCarrier() *SplitTextCarrier { - return &SplitTextCarrier{} -} - -// SplitBinaryCarrier is DEPRECATED -type SplitBinaryCarrier struct { - TracerState []byte - Baggage []byte -} - -// NewSplitBinaryCarrier is DEPRECATED -func NewSplitBinaryCarrier() *SplitBinaryCarrier { - return &SplitBinaryCarrier{} -}
Remove old deprecated carriers Now that basictracer-go no longer references them
opentracing_opentracing-go
train
go
4d424c06b999b55f57a0a2238cd6c5da849b4949
diff --git a/packages/embark/src/lib/modules/solidity/index.js b/packages/embark/src/lib/modules/solidity/index.js index <HASH>..<HASH> 100644 --- a/packages/embark/src/lib/modules/solidity/index.js +++ b/packages/embark/src/lib/modules/solidity/index.js @@ -145,7 +145,8 @@ class Solidity { compiled_object[className].abiDefinition = contract.abi; compiled_object[className].userdoc = contract.userdoc; compiled_object[className].filename = filename; - compiled_object[className].originalFilename = originalFilepaths[path.basename(filename)]; + const normalized = path.normalize(filename); + compiled_object[className].originalFilename = Object.values(originalFilepaths).find(ogFilePath => normalized.indexOf(ogFilePath) > -1); } }
fix(embark/solidity): fix getting the original filename of contracts
embark-framework_embark
train
js
dc5ce6013c432e117486ed2ec371cfda78225b0f
diff --git a/tests/unit/admin/actionsmainajaxTest.php b/tests/unit/admin/actionsmainajaxTest.php index <HASH>..<HASH> 100644 --- a/tests/unit/admin/actionsmainajaxTest.php +++ b/tests/unit/admin/actionsmainajaxTest.php @@ -22,7 +22,6 @@ /** * Tests for Actions_List class - * @group knorke */ class Unit_Admin_ActionsMainAjaxTest extends OxidTestCase { diff --git a/tests/unit/models/oxrssfeedTest.php b/tests/unit/models/oxrssfeedTest.php index <HASH>..<HASH> 100644 --- a/tests/unit/models/oxrssfeedTest.php +++ b/tests/unit/models/oxrssfeedTest.php @@ -20,9 +20,6 @@ * @version OXID eShop CE */ -/** - * @group knorke - */ class Unit_Models_oxrssfeedTest extends OxidTestCase {
<I> Fix rss cache invalidation removed forgotten test group (cherry picked from commit acece2c)
OXID-eSales_oxideshop_ce
train
php,php
93f30a937fd0890ac36c8626c773d0f08f13dfbd
diff --git a/src/messages/layout.js b/src/messages/layout.js index <HASH>..<HASH> 100644 --- a/src/messages/layout.js +++ b/src/messages/layout.js @@ -21,9 +21,9 @@ export const BAD_ZIPFILE = { export const TYPE_NO_MANIFEST_JSON = { code: 'TYPE_NO_MANIFEST_JSON', message: _('manifest.json was not found'), - description: _(oneLine`A manifest.json in the root of the - extension was not found. See: https://mzl.la/2r2McKv for more on - packaging`), + description: _(oneLine`No manifest.json was found at the root of the extension. + The package file must be a ZIP of the extension's files themselves, not of the + containing directory. See: https://mzl.la/2r2McKv for more on packaging.`), }; export const FILE_TOO_LARGE = {
Improve messaging for missing manifest.json (#<I>) * Improve messaging for missing manifest.json * Update messaging * Update wording (again) * Update layout.js
mozilla_addons-linter
train
js
1011887404bc4560ba39e41430df153250ac95e3
diff --git a/mqtt_codec/packet.py b/mqtt_codec/packet.py index <HASH>..<HASH> 100644 --- a/mqtt_codec/packet.py +++ b/mqtt_codec/packet.py @@ -1350,7 +1350,6 @@ class MqttUnsuback(MqttPacketBody): ---------- packet_id: int 0 <= packet_id <= 2**16-1 - results: iterable of SubscribeResult """ self.packet_id = packet_id
Corrected unsuback docstring.
kcallin_mqtt-codec
train
py
39c3466f0e2a88659b69ff08b97df2a526dace17
diff --git a/paml/parse.py b/paml/parse.py index <HASH>..<HASH> 100644 --- a/paml/parse.py +++ b/paml/parse.py @@ -23,9 +23,6 @@ class Parser(object): def parse(self, source): for raw_line in source: - if raw_line.startswith('!'): - self.add_node(nodes.Content(raw_line[1:]), depth=self.depth + 1) - continue line = raw_line.lstrip() if not line: continue
Remove the old escape character. May put this back in later though.
mikeboers_PyHAML
train
py
7e69f3fba7fec027903c681659369b4e2054b53c
diff --git a/shapes.py b/shapes.py index <HASH>..<HASH> 100644 --- a/shapes.py +++ b/shapes.py @@ -174,16 +174,17 @@ class Box(Image): size[1] + int(amount[1])) def image(self): - image = [ [False for x in range(self._size[0])] - for y in range(self._size[1]) ] - - for xPos in range(0, self._size[0]): - image[0][xPos] = True - image[self._size[1]][xPos] = True - - for yPos in range(0, self._size[1]): - image[yPos][0] = True - image[yPos][self._size[1]] = True + image = [] + + image.append([True]*self._size[0]) + for yPos in range(1, self._size[0]-2): + image.append([]) + + image[yPos].append(True) + for xPos in range(self._size[1]-2): + image[yPos].append(False) + image[yPos].append(True) + image.append([True]*self._size[0]) return self._rotate(image, self.direction)
Rewrote Box algorithum
olls_graphics
train
py
e036bc74cd4e4eda6e9b592c704809cd50ce36d4
diff --git a/plugins/progressive/ls.progressive.js b/plugins/progressive/ls.progressive.js index <HASH>..<HASH> 100644 --- a/plugins/progressive/ls.progressive.js +++ b/plugins/progressive/ls.progressive.js @@ -1,6 +1,6 @@ /* This lazySizes extension adds better support for browser rendering of progressive jpgs/pngs. -Needs a proper low quality src, so use it with the LQIP pattern. +Needs a proper low quality src, so use it with the LQIP pattern. When the lazysizes detects the image gets visible, the src will be inserted as background image until the image from srcset is completely loaded. */ (function(document){ @@ -24,7 +24,7 @@ When the lazysizes detects the image gets visible, the src will be inserted as b } var src = img.getAttribute('src'); if(src) { - img.style.backgroundSize = 'cover'; + img.style.backgroundSize = '100% 100%'; img.style.backgroundImage = 'url(' + src + ')'; img.removeAttribute('src'); img.addEventListener('load', onload);
background-size <I>% <I>% seems to be better than cover
aFarkas_lazysizes
train
js
9da79dd0b58f385b0cb80af6691b2032441c86d2
diff --git a/tests/integration/__init__.py b/tests/integration/__init__.py index <HASH>..<HASH> 100644 --- a/tests/integration/__init__.py +++ b/tests/integration/__init__.py @@ -1115,7 +1115,10 @@ class TestDaemon(object): for dirname in (TMP, RUNTIME_VARS.TMP_STATE_TREE, RUNTIME_VARS.TMP_PILLAR_TREE, RUNTIME_VARS.TMP_PRODENV_STATE_TREE): if os.path.isdir(dirname): - shutil.rmtree(dirname, onerror=remove_readonly) + try: + shutil.rmtree(dirname, onerror=remove_readonly) + except: + log.exception('Failed to remove directory: %s', dirname) def wait_for_jid(self, targets, jid, timeout=120): time.sleep(1) # Allow some time for minions to accept jobs
Allow test suite to finish if tmp dir removal fails
saltstack_salt
train
py
08c234276347430d68c373c36c084175e2dccba5
diff --git a/MAVProxy/modules/mavproxy_misseditor/missionEditorFrame.py b/MAVProxy/modules/mavproxy_misseditor/missionEditorFrame.py index <HASH>..<HASH> 100755 --- a/MAVProxy/modules/mavproxy_misseditor/missionEditorFrame.py +++ b/MAVProxy/modules/mavproxy_misseditor/missionEditorFrame.py @@ -1,5 +1,5 @@ #!/usr/bin/env python -# -*- coding: UTF-8 -*- +# -*- coding: utf-8 -*- # # generated by wxGlade 0.6.8 on Wed Jun 11 13:41:49 2014 #
misseditor: buffer encoding is case-sensitive
ArduPilot_MAVProxy
train
py
ecb4d49c06484e8ed9bdb6db35350d104e13b730
diff --git a/kafka/consumer/group.py b/kafka/consumer/group.py index <HASH>..<HASH> 100644 --- a/kafka/consumer/group.py +++ b/kafka/consumer/group.py @@ -628,11 +628,14 @@ class KafkaConsumer(six.Iterator): # init any new fetches (won't resend pending fetches) self._fetcher.init_fetches() - self._client.poll() + self._client.poll( + max(0, self._consumer_timeout - time.time()) * 1000) timeout_at = min(self._consumer_timeout, self._client._delayed_tasks.next_at() + time.time(), self._client.cluster.ttl() / 1000.0 + time.time()) + if time.time() > timeout_at: + continue for msg in self._fetcher: yield msg if time.time() > timeout_at:
Pass consumer timeout to client.poll() in iterator; check timeout before iterating fetcher
dpkp_kafka-python
train
py
a079f60b634d43f5c85c4d589aa3fbaf6b1cdd86
diff --git a/activesupport/lib/active_support/core_ext/hash/keys.rb b/activesupport/lib/active_support/core_ext/hash/keys.rb index <HASH>..<HASH> 100644 --- a/activesupport/lib/active_support/core_ext/hash/keys.rb +++ b/activesupport/lib/active_support/core_ext/hash/keys.rb @@ -15,7 +15,8 @@ class Hash self end - # Return a new hash with all keys converted to symbols. + # Return a new hash with all keys converted to symbols, as long as + # they respond to +to_sym+. def symbolize_keys inject({}) do |options, (key, value)| options[(key.to_sym rescue key) || key] = value @@ -23,7 +24,8 @@ class Hash end end - # Destructively convert all keys to symbols. + # Destructively convert all keys to symbols, as long as they respond + # to +to_sym+. def symbolize_keys! self.replace(self.symbolize_keys) end
details that symbolize_keys symbolizes keys as long as they respond to to_sym (so "all" may not be really all)
rails_rails
train
rb
8590ec81072b176456e8fc358fc593fbf146dc93
diff --git a/pin_passcode/views.py b/pin_passcode/views.py index <HASH>..<HASH> 100644 --- a/pin_passcode/views.py +++ b/pin_passcode/views.py @@ -1,9 +1,13 @@ from django.conf import settings from django.contrib.auth import login, get_user_model from django.shortcuts import render, HttpResponse +from django.views.decorators.csrf import requires_csrf_token +from django.middleware.csrf import get_token +@requires_csrf_token def form(request): + get_token(request) return render(request, 'pin_passcode/form.html') diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -12,7 +12,7 @@ setup( name="django-pin-passcode", packages=find_packages(), include_package_data=True, # declarations in MANIFEST.in - version="0.0.8", + version="0.1.1", author="Eric Carmichael", author_email="eric@ckcollab.com", description="A simple django app that provides site-wide easy password authentication for 1 user",
fixes csrf problem on firefox... sheesh! such a pain
ckcollab_django-pin-passcode
train
py,py
519e2d39d5b5a58cf40e654cc7fea68a4aa1a7c8
diff --git a/girder/api/v1/user.py b/girder/api/v1/user.py index <HASH>..<HASH> 100644 --- a/girder/api/v1/user.py +++ b/girder/api/v1/user.py @@ -93,7 +93,8 @@ class User(Resource): 'token': token['_id'], 'expires': token['expires'], 'userId': user['_id'] - } + }, + 'message': 'Login succeeded.' } def logout(self): diff --git a/tests/cases/user_test.py b/tests/cases/user_test.py index <HASH>..<HASH> 100644 --- a/tests/cases/user_test.py +++ b/tests/cases/user_test.py @@ -170,6 +170,8 @@ class UserTestCase(base.TestCase): }) self.assertStatusOk(resp) self.assertEqual('Login succeeded.', resp.json['message']) + self.assertEqual('good@email.com', resp.json['user']['email']) + self._verifyUserDocument(resp.json['user']) # Make sure we got a nice cookie self._verifyAuthCookie(resp)
Fix failing user test and endpoint. Also making it more thorough.
girder_girder
train
py,py
5c165815c7d4755e01571e9a289d16c180463a42
diff --git a/mongoctl/objects/cluster.py b/mongoctl/objects/cluster.py index <HASH>..<HASH> 100644 --- a/mongoctl/objects/cluster.py +++ b/mongoctl/objects/cluster.py @@ -87,7 +87,7 @@ class Cluster(DocumentWrapper): server_uri_templates = [] for member in self.get_members(): server = member.get_server() - if not server.is_arbiter(): + if not server.is_arbiter_server(): server_uri_templates.append(server.get_address_display()) creds = "[<dbuser>:<dbpass>@]" if self.get_repl_key() else ""
Removing arbiters from print-uri
mongolab_mongoctl
train
py
c1c91208e9e49223b66558e5edf3bd63af0a2d6a
diff --git a/lib/datawrassler.rb b/lib/datawrassler.rb index <HASH>..<HASH> 100644 --- a/lib/datawrassler.rb +++ b/lib/datawrassler.rb @@ -33,13 +33,13 @@ class KdnuggetsRoundup::DataWrassler tags = tags.collect{|tag| tag.text} summary = doc.css('p.excerpt').text author = doc.css('#post- b').text.match(/\S*\s\S*[[:punct:]]/)[0].gsub(/[0-9[[:punct:]]]/, '') - article = doc.css('div#post- p') + text = doc.css('div#post- p') counter = 0 excerpt = [] - article.each do |paragraph| + text.each do |paragraph| excerpt << paragraph.text counter += 1 - if counter == 5 + if counter > 5 break end end
Adjusted excerpt extractor to > 5
Jirles_kdnuggets-roundup
train
rb
052e9146d0ee04d9a5b348c310a4a00e676c69fe
diff --git a/lib/inbox.rb b/lib/inbox.rb index <HASH>..<HASH> 100644 --- a/lib/inbox.rb +++ b/lib/inbox.rb @@ -285,7 +285,7 @@ module Inbox # loop and yield deltas until we've come to the end. loop do - path = self.url_for_path("/delta?cursor=#{cursor}#{exclude_string}") + path = self.url_for_path("/delta?exclude_folders=false&cursor=#{cursor}#{exclude_string}") if expanded_view path += '&view=expanded' end @@ -338,7 +338,7 @@ module Inbox end # loop and yield deltas indefinitely. - path = self.url_for_path("/delta/streaming?cursor=#{cursor}#{exclude_string}") + path = self.url_for_path("/delta/streaming?exclude_folders=false&cursor=#{cursor}#{exclude_string}") if expanded_view path += '&view=expanded' end
Expose folders in the delta stream API.
nylas_nylas-ruby
train
rb
23ebba3ffc7a726cad0da8c13101c8c957fc329f
diff --git a/haproxy_exporter.go b/haproxy_exporter.go index <HASH>..<HASH> 100644 --- a/haproxy_exporter.go +++ b/haproxy_exporter.go @@ -162,6 +162,10 @@ var ( 44: newServerMetric("http_responses_total", "Total of HTTP responses.", prometheus.CounterValue, prometheus.Labels{"code": "other"}), 49: newServerMetric("client_aborts_total", "Total number of data transfers aborted by the client.", prometheus.CounterValue, nil), 50: newServerMetric("server_aborts_total", "Total number of data transfers aborted by the server.", prometheus.CounterValue, nil), + 58: newServerMetric("http_queue_time_average_seconds", "Avg. HTTP queue time for last 1024 successful connections.", prometheus.GaugeValue, nil), + 59: newServerMetric("http_connect_time_average_seconds", "Avg. HTTP connect time for last 1024 successful connections.", prometheus.GaugeValue, nil), + 60: newServerMetric("http_response_time_average_seconds", "Avg. HTTP response time for last 1024 successful connections.", prometheus.GaugeValue, nil), + 61: newServerMetric("http_total_time_average_seconds", "Avg. HTTP total time for last 1024 successful connections.", prometheus.GaugeValue, nil), } frontendMetrics = metrics{
added average aver last <I> reqeusts metrics to server metric type
prometheus_haproxy_exporter
train
go
3eeb11c1c6eca91776382bca6593e1fbaab5b540
diff --git a/lib/survey_gizmo/rest_response.rb b/lib/survey_gizmo/rest_response.rb index <HASH>..<HASH> 100644 --- a/lib/survey_gizmo/rest_response.rb +++ b/lib/survey_gizmo/rest_response.rb @@ -11,7 +11,7 @@ class RestResponse ap @parsed_response end - fail "Bad response: #{@parsed_response.pretty_inspect}" unless @parsed_response['result_ok'] && @parsed_response['result_ok'].to_s.downcase == 'true' + fail("Bad response: #{rest_response.inspect}") unless @parsed_response['result_ok'] && @parsed_response['result_ok'].to_s.downcase == 'true' return unless data # Handle really crappy [] notation in SG API, so far just in SurveyResponse
Use inspect instead of pretty inspect for rails free environments
jarthod_survey-gizmo-ruby
train
rb
270c9d0ce80abb60f2251757104c929491dc35ef
diff --git a/lxc/main.go b/lxc/main.go index <HASH>..<HASH> 100644 --- a/lxc/main.go +++ b/lxc/main.go @@ -285,7 +285,7 @@ func (c *cmdGlobal) PreRun(cmd *cobra.Command, args []string) error { } fmt.Fprintf(os.Stderr, i18n.G("If this is your first time running LXD on this machine, you should also run: lxd init")+"\n") - fmt.Fprintf(os.Stderr, i18n.G("To start your first container, try: lxc launch ubuntu:16.04")+"\n\n") + fmt.Fprintf(os.Stderr, i18n.G("To start your first container, try: lxc launch ubuntu:18.04")+"\n\n") } // Only setup macaroons if a config path exists (so the jar can be saved)
lxc: Switch to Ubuntu <I> as initial container
lxc_lxd
train
go
321c215789022c9fab030de111e2631c3db44b09
diff --git a/metric_tank/aggmetric.go b/metric_tank/aggmetric.go index <HASH>..<HASH> 100644 --- a/metric_tank/aggmetric.go +++ b/metric_tank/aggmetric.go @@ -82,8 +82,8 @@ func NewAggMetric(key string, chunkSpan, numChunks uint32, maxDirtyChunks uint32 // Sync the saved state of a chunk by its T0. func (a *AggMetric) SyncChunkSaveState(ts uint32) { - a.RLock() - defer a.RUnlock() + a.Lock() + defer a.Unlock() chunk := a.getChunkByT0(ts) if chunk != nil { log.Debug("marking chunk %s:%d as saved.", a.Key, chunk.T0)
use writeLock instead of readLock
grafana_metrictank
train
go
94de1f8e847326b37507bf7627f5c95ba8f5c0d2
diff --git a/test/support/prepare.js b/test/support/prepare.js index <HASH>..<HASH> 100644 --- a/test/support/prepare.js +++ b/test/support/prepare.js @@ -15,7 +15,7 @@ const npmrc = [ fs.writeFileSync(join(tmpPath, '.npmrc'), npmrc, 'utf-8') module.exports = function prepare (pkg) { - const pkgTmpPath = join(tmpPath, Math.random().toString()) + const pkgTmpPath = join(tmpPath, Number(new Date()).toString()) mkdirp.sync(pkgTmpPath) const json = JSON.stringify(pkg || {}) fs.writeFileSync(join(pkgTmpPath, 'package.json'), json, 'utf-8')
refactor(tests): instead of random temp dir names, use date It is easier to debug when the folders are sorted
pnpm_pnpm
train
js
67920abd88c8d92682c5ba5f567b0d9a89d3edbd
diff --git a/yaas-pubsub.js b/yaas-pubsub.js index <HASH>..<HASH> 100644 --- a/yaas-pubsub.js +++ b/yaas-pubsub.js @@ -40,14 +40,14 @@ function fixEventPayload(events) { }); } -function read(topicOwnerClient, eventType, numEvents) { +function read(topicOwnerClient, eventType, numEvents, autoCommit) { return requestHelper.post( pathPubSubBase + '/' + topicOwnerClient + '/' + eventType + '/read', 'application/json', { numEvents: numEvents, ttlMs: 4000, - autoCommit: false + autoCommit: autoCommit || false } ).then(function (response) { if (response.statusCode == 204) { @@ -67,4 +67,4 @@ module.exports = { commit: commit, init: init, read: read -} \ No newline at end of file +}
adding autoCommit as additional param for pubsub/read
SAP_yaas-nodejs-client-sdk
train
js
77f62b1a0a009d2e86095fc6997a93793c9f921b
diff --git a/PyFunceble/dataset/csv_base.py b/PyFunceble/dataset/csv_base.py index <HASH>..<HASH> 100644 --- a/PyFunceble/dataset/csv_base.py +++ b/PyFunceble/dataset/csv_base.py @@ -234,12 +234,8 @@ class CSVDatasetBase(DBDatasetBase): raise TypeError(f"<filter_map> should be {dict}, {type(filter_map)} given.") for row in self.get_content(): - for key, value in filter_map.items(): - if key not in row: - continue - - if row[key] == value: - yield row + if all(x in row and row[x] == y for x, y in filter_map.items()): + yield row def get_filtered_comparision_row(self, row: dict): """
Fix issue with the filtering of content. Indeed, before this patch, the was the filter was done may have been misleading or inappropriate.
funilrys_PyFunceble
train
py
cde3d8701d976b1b27ce8190514a29989a7041eb
diff --git a/lib/https/index.js b/lib/https/index.js index <HASH>..<HASH> 100644 --- a/lib/https/index.js +++ b/lib/https/index.js @@ -334,6 +334,7 @@ function _handleWebsocket(socket, clientIp, clientPort, callback, wss) { if (retryConnect) { reqSocket.removeListener('error', retryConnect); abortIfUnavailable(reqSocket); + retryConnect = null; } clearTimeout(timeout); var resDelay = util.getMatcherValue(_rules.resDelay); diff --git a/lib/tunnel.js b/lib/tunnel.js index <HASH>..<HASH> 100644 --- a/lib/tunnel.js +++ b/lib/tunnel.js @@ -299,6 +299,7 @@ function tunnelProxy(server, proxy) { if (retryConnect) { resSocket.removeListener('error', retryConnect); abortIfUnavailable(resSocket); + retryConnect = null; } reqSocket.headers = headers; reqSocket.fullUrl = tunnelUrl;
refactor: retry connect if error
avwo_whistle
train
js,js
50f7775976bf4d0ea908c9ae38a7d213b0923dd5
diff --git a/certsuite/harness.py b/certsuite/harness.py index <HASH>..<HASH> 100644 --- a/certsuite/harness.py +++ b/certsuite/harness.py @@ -228,7 +228,7 @@ class TestRunner(object): proc.wait() logger.debug("Process finished") - except Exception as e: + except Exception: logger.error("Error running suite %s:\n%s" % (suite, traceback.format_exc())) raise finally: @@ -274,7 +274,7 @@ def check_adb(): try: logger.info("Testing ADB connection") mozdevice.DeviceManagerADB() - except mozdevice.DMError, e: + except mozdevice.DMError as e: logger.critical('Error connecting to device via adb (error: %s). Please be ' \ 'sure device is connected and "remote debugging" is enabled.' % \ e.msg) @@ -288,7 +288,7 @@ def install_marionette(version): marionette_install(version) except AlreadyInstalledException: logger.info("Marionette is already installed") - except subprocess.CalledProcessError, e: + except subprocess.CalledProcessError as e: logger.critical('Error installing marionette extension: %s' % e) logger.critical(traceback.format_exc()) sys.exit(1)
Use 'as' instead of comma
mozilla-b2g_fxos-certsuite
train
py
d0986115652737a5278b7c99e543f1f4ff8be7fd
diff --git a/zzk/service/hoststate.go b/zzk/service/hoststate.go index <HASH>..<HASH> 100644 --- a/zzk/service/hoststate.go +++ b/zzk/service/hoststate.go @@ -109,6 +109,7 @@ func (l *HostStateListener) PostProcess(p map[string]struct{}) { for _, s := range stateIDs { if _, ok := p[s]; !ok { l.cleanUpContainer(s) + plog.WithField("stateid", s).Info("Cleaned up orphaned container") } } }
Added logging to PostProcess
control-center_serviced
train
go
b189ec7997c990fa0d18069a49da32b584336099
diff --git a/src/org/mockito/internal/configuration/InjectingAnnotationEngine.java b/src/org/mockito/internal/configuration/InjectingAnnotationEngine.java index <HASH>..<HASH> 100644 --- a/src/org/mockito/internal/configuration/InjectingAnnotationEngine.java +++ b/src/org/mockito/internal/configuration/InjectingAnnotationEngine.java @@ -90,7 +90,7 @@ public class InjectingAnnotationEngine implements AnnotationEngine { Set<Object> mocks = new HashSet<Object>(); while (clazz != Object.class) { - new InjectMocksScanner(testClassInstance, clazz).addTo(mockDependentFields); + new InjectMocksScanner(clazz).addTo(mockDependentFields); new MockScanner(testClassInstance, clazz).addPreparedMocks(mocks); clazz = clazz.getSuperclass(); }
issue <I> : factored out the mock scanning for injection (missing modification)
mockito_mockito
train
java
b3a6cdb1dfe743822150fffcfc3f5a4350b416d7
diff --git a/source/org/jasig/portal/tools/RunXSLT.java b/source/org/jasig/portal/tools/RunXSLT.java index <HASH>..<HASH> 100644 --- a/source/org/jasig/portal/tools/RunXSLT.java +++ b/source/org/jasig/portal/tools/RunXSLT.java @@ -58,7 +58,7 @@ public class RunXSLT { xslt.transform(); } catch (PortalException pe) { System.err.println("RunXSLT: Error on transform"); - pe.getRecordedException().printStackTrace(); + pe.printStackTrace(); } }
removed usage of deprecated getRecordedException() method. printing the stack trace of the PortalException is sufficient, as the cause's trace is included in the trace of the PortalException wrapping it. git-svn-id: <URL>
Jasig_uPortal
train
java
9e9879674ce72015e5ed2a20e1516be7da2d0ff2
diff --git a/packages/selenium-ide/src/neo/IO/SideeX/playback.js b/packages/selenium-ide/src/neo/IO/SideeX/playback.js index <HASH>..<HASH> 100644 --- a/packages/selenium-ide/src/neo/IO/SideeX/playback.js +++ b/packages/selenium-ide/src/neo/IO/SideeX/playback.js @@ -398,7 +398,7 @@ function doImplicitWait(error, commandId, target, implicitTime, implicitCount) { PlaybackState.setCommandState(commandId, PlaybackStates.Fatal, "Playback aborted"); return false; } else if (isElementNotFound(error)) { - if (implicitTime && (Date.now() - implicitTime > 300)) { + if (implicitTime && (Date.now() - implicitTime > 30000)) { return doLocatorFallback().then(result => { if (result && result.result === "success") return result; reportError("Implicit Wait timed out after 30000ms");
Set implicit wait back to <I> seconds
SeleniumHQ_selenium-ide
train
js
2f7ad4e11eeaa8ee3bf686d7b79fa5aef9dc7d40
diff --git a/nodeconductor/server/admin/menu.py b/nodeconductor/server/admin/menu.py index <HASH>..<HASH> 100644 --- a/nodeconductor/server/admin/menu.py +++ b/nodeconductor/server/admin/menu.py @@ -23,7 +23,7 @@ class CustomAppList(items.AppList): 'url': self._get_admin_change_url(model, context) }) - for app in sorted(apps.keys()): + for app in sorted(apps, key=lambda k: apps[k]['title']): app_dict = apps[app] item = items.MenuItem(title=app_dict['title'], url=app_dict['url']) # sort model list alphabetically
Fix applications order in django admin
opennode_waldur-core
train
py
6ab5fe50abaf19b823b962c6d2cbd4444281a11d
diff --git a/lib/libhoney/response.rb b/lib/libhoney/response.rb index <HASH>..<HASH> 100644 --- a/lib/libhoney/response.rb +++ b/lib/libhoney/response.rb @@ -1,9 +1,11 @@ +require 'http' + module Libhoney class Response attr_accessor :duration, :status_code, :metadata, :error def initialize(duration: 0, - status_code: 0, + status_code: HTTP::Response::Status.new(0), metadata: nil, error: nil) @duration = duration diff --git a/test/libhoney_test.rb b/test/libhoney_test.rb index <HASH>..<HASH> 100644 --- a/test/libhoney_test.rb +++ b/test/libhoney_test.rb @@ -290,6 +290,7 @@ class LibhoneyTest < Minitest::Test 20.times do response = @honey.responses.pop assert_kind_of(Exception, response.error) + assert_kind_of(HTTP::Response::Status, response.status_code) end @honey.send_now('argle' => 'bargle')
Ensure the type of status_code is always the same Although you can check the `error` property on the response it is nicer to always have the same type being returned for the status_code
honeycombio_libhoney-rb
train
rb,rb
51462994d5f3365e6483f7bb34a5e669e9ba0790
diff --git a/auth/token.go b/auth/token.go index <HASH>..<HASH> 100644 --- a/auth/token.go +++ b/auth/token.go @@ -152,6 +152,7 @@ func expired() bool { } func updateToken(token string, expires time.Time, filename string) { + WaitForDelegateKeys() cond.L.Lock() currentToken = token currentIdentity = getIdentityFromToken(token)
Wait for keys before parsing identity token
control-center_serviced
train
go
b0cdbb0c71dc96a301de4e268af13c2cad03e525
diff --git a/tests/pytests/unit/states/test_pkg.py b/tests/pytests/unit/states/test_pkg.py index <HASH>..<HASH> 100644 --- a/tests/pytests/unit/states/test_pkg.py +++ b/tests/pytests/unit/states/test_pkg.py @@ -218,7 +218,7 @@ def test_fulfills_version_string(version_string, installed_versions, expected_re ) assert expected_result == pkg._fulfills_version_string( installed_versions, version_string - ), msg + ) @pytest.mark.parametrize( @@ -241,4 +241,4 @@ def test_fulfills_version_spec(installed_versions, operator, version, expected_r ) assert expected_result == pkg._fulfills_version_spec( installed_versions, operator, version - ), msg + )
Remove superfluous msg to allow pytest to handle it automatically
saltstack_salt
train
py
52e15a58da04e109686b7a627d8090de15ff1a41
diff --git a/rest_framework_gis/pagination.py b/rest_framework_gis/pagination.py index <HASH>..<HASH> 100644 --- a/rest_framework_gis/pagination.py +++ b/rest_framework_gis/pagination.py @@ -8,6 +8,8 @@ class GeoJsonPagination(pagination.PageNumberPagination): """ A geoJSON implementation of a pagination serializer. """ + page_size_query_param = 'page_size' + def get_paginated_response(self, data): return Response(OrderedDict([ ('type', 'FeatureCollection'), diff --git a/tests/django_restframework_gis_tests/views.py b/tests/django_restframework_gis_tests/views.py index <HASH>..<HASH> 100644 --- a/tests/django_restframework_gis_tests/views.py +++ b/tests/django_restframework_gis_tests/views.py @@ -29,7 +29,6 @@ class GeojsonLocationList(generics.ListCreateAPIView): serializer_class = LocationGeoFeatureSerializer queryset = Location.objects.all() pagination_class = GeoJsonPagination - paginate_by_param = 'page_size' geojson_location_list = GeojsonLocationList.as_view()
Added default page_size_query_param in GeoJsonPagination paginate_by_param in views was deprecated in DRF <I>
djangonauts_django-rest-framework-gis
train
py,py
88405bb1d77ca6aedded7ac228d30a7ca6c99948
diff --git a/src/server/pfs/server/api_server.go b/src/server/pfs/server/api_server.go index <HASH>..<HASH> 100644 --- a/src/server/pfs/server/api_server.go +++ b/src/server/pfs/server/api_server.go @@ -16,6 +16,7 @@ import ( pfsserver "github.com/pachyderm/pachyderm/src/server/pfs" "github.com/pachyderm/pachyderm/src/server/pkg/metrics" + "go.pedge.io/lion" "go.pedge.io/pb/go/google/protobuf" "go.pedge.io/proto/rpclog" "go.pedge.io/proto/stream" @@ -294,7 +295,10 @@ func (a *apiServer) InspectCommit(ctx context.Context, request *pfs.InspectCommi commitInfos = pfsserver.ReduceCommitInfos(commitInfos) - if len(commitInfos) != 1 || commitInfos[0].Commit.ID != request.Commit.ID { + if len(commitInfos) != 1 || + (commitInfos[0].Commit.ID != request.Commit.ID && + commitInfos[0].Branch != request.Commit.ID) { + lion.Printf("commitInfos: %+v", commitInfos) return nil, fmt.Errorf("incorrect commit returned (this is likely a bug)") }
Fix a bug in InspectCommit with branch names.
pachyderm_pachyderm
train
go
df80ef9203d7c7b12122b6da7108bb524583fd18
diff --git a/src/Factory.php b/src/Factory.php index <HASH>..<HASH> 100644 --- a/src/Factory.php +++ b/src/Factory.php @@ -41,6 +41,13 @@ class Factory private $factories = array(); /** + * The array of callbacks to trigger on instance/create. + * + * @var array + */ + private $callbacks = array(); + + /** * The array of objects we have created. * * @var array @@ -391,9 +398,10 @@ class Factory * * @return $this */ - public function define($model, array $definition = array()) + public function define($model, array $definition = array(), $callback = null) { $this->factories[$model] = $definition; + $this->callbacks[$model] = $callback; return $this; }
Allow a callback to be set when calling ::define. This callback will be called after the object has been created (and saved in the case of ::create).
thephpleague_factory-muffin
train
php
7ec7f8f1cc2eec1a40674cb67e29b7477d3990d5
diff --git a/tests/NotifynderTestCase.php b/tests/NotifynderTestCase.php index <HASH>..<HASH> 100644 --- a/tests/NotifynderTestCase.php +++ b/tests/NotifynderTestCase.php @@ -69,8 +69,10 @@ abstract class NotifynderTestCase extends OrchestraTestCase public function tearDown() { app('db')->rollback(); + app('db')->statement('SET FOREIGN_KEY_CHECKS=0;'); Notification::truncate(); NotificationCategory::truncate(); + app('db')->statement('SET FOREIGN_KEY_CHECKS=1;'); } protected function getApplicationTimezone($app)
ignore constraints to truncate models on tearDown
fenos_Notifynder
train
php
48ad67c67eb843557bbca7acf6e28be0e683ff5f
diff --git a/src/Server/RemoteAuthenticatable.php b/src/Server/RemoteAuthenticatable.php index <HASH>..<HASH> 100644 --- a/src/Server/RemoteAuthenticatable.php +++ b/src/Server/RemoteAuthenticatable.php @@ -3,6 +3,7 @@ namespace DoSomething\Gateway\Server; use InvalidArgumentException; +use League\OAuth2\Client\Token\AccessToken; trait RemoteAuthenticatable { @@ -27,6 +28,22 @@ trait RemoteAuthenticatable } /** + * Get the OAuth token for downstream requests. + * + * @return AccessToken + */ + public function getOAuthToken() + { + return new AccessToken([ + 'resource_owner_id' => $this->getAuthIdentifier(), + 'access_token' => token()->jwt(), + 'refresh_token' => null, + 'expires' => token()->expires()->timestamp, + 'role' => token()->role(), + ]); + } + + /** * Get the password for the user. * * @return string
Add support for using OAuth on downstream requests with RemoteUser. (#<I>)
DoSomething_gateway
train
php
0bfd95812b9f60fd62a8de27555fbca5a7e6d032
diff --git a/core/codegen/cppgen/src/main/java/org/overture/codegen/vdm2cpp/CppCodeGen.java b/core/codegen/cppgen/src/main/java/org/overture/codegen/vdm2cpp/CppCodeGen.java index <HASH>..<HASH> 100644 --- a/core/codegen/cppgen/src/main/java/org/overture/codegen/vdm2cpp/CppCodeGen.java +++ b/core/codegen/cppgen/src/main/java/org/overture/codegen/vdm2cpp/CppCodeGen.java @@ -103,7 +103,7 @@ public class CppCodeGen extends CodeGenBase { for (SClassDefinition classDef : mergedParseLists) { - if (generator.getIRInfo().getAssistantManager().getDeclAssistant().classIsLibrary(classDef)) + if (generator.getIRInfo().getAssistantManager().getDeclAssistant().isLibrary(classDef)) { simplifyLibraryClass(classDef); } @@ -448,7 +448,7 @@ public class CppCodeGen extends CodeGenBase private boolean shouldBeGenerated(SClassDefinition classDef, DeclAssistantCG declAssistant) { - if (declAssistant.classIsLibrary(classDef)) + if (declAssistant.isLibrary(classDef)) { return false; }
Updates to cppgen caused by refactoring in the codegen platform
overturetool_overture
train
java
b78f9a4c1d523e0e841f280aa076ccfa1d6d9f14
diff --git a/polyfills/Array.prototype.some/polyfill.js b/polyfills/Array.prototype.some/polyfill.js index <HASH>..<HASH> 100644 --- a/polyfills/Array.prototype.some/polyfill.js +++ b/polyfills/Array.prototype.some/polyfill.js @@ -1,10 +1,21 @@ -Array.prototype.some = function some(callback) { +Array.prototype.reduceRight = function reduceRight(callback) { + if (!(this instanceof Object)) { + throw new TypeError(this + 'is not an object'); + } + if (typeof callback !== 'function') { throw new TypeError(callback + ' is not a function'); } - for (var array = this, index = 0, length = array.length; index < length; ++index) { - if (index in array && callback.call(arguments[1], array[index], index, array)) { + var + array = Object(this), + arrayIsString = array instanceof String, + scope = arguments[1], + length = array.length, + index = 0; + + for (; index < length; ++index) { + if (index in array && callback.call(scope, arrayIsString ? array.charAt(index) : array[index], index, array)) { return true; } }
Update Array.prototype.some - throw error on non-objects - array should be an object - support strings in old ie
Financial-Times_polyfill-service
train
js
79636316256671ece1b9bf45861c1108508b467a
diff --git a/library/CM/App/Cli.php b/library/CM/App/Cli.php index <HASH>..<HASH> 100644 --- a/library/CM/App/Cli.php +++ b/library/CM/App/Cli.php @@ -22,7 +22,7 @@ class CM_App_Cli extends CM_Cli_Runnable_Abstract { } public function setupElasticsearch() { - $searchCli = new CM_Elasticsearch_Index_Cli($this->_getInput(), $this->_getOutput()); + $searchCli = new CM_Elasticsearch_Index_Cli($this->_getStreamInput(), $this->_getStreamOutput(), $this->_getStreamError()); $searchCli->create(null, true); }
Fixed merge commit - Passed right arguments to CM_Elasticsearch_Index_Cli
cargomedia_cm
train
php
a6adc47059d422891e59e6a0f6dee1f35de8c6cc
diff --git a/src/article/metadata/RemoveReferenceCommand.js b/src/article/metadata/RemoveReferenceCommand.js index <HASH>..<HASH> 100644 --- a/src/article/metadata/RemoveReferenceCommand.js +++ b/src/article/metadata/RemoveReferenceCommand.js @@ -1,4 +1,4 @@ -import { Command } from 'substance' +import { Command, isNil } from 'substance' export default class RemoveReferenceCommand extends Command { getCommandState (params, context) { @@ -8,7 +8,7 @@ export default class RemoveReferenceCommand extends Command { isDisabled (params, context) { const xpath = params.selectionState.xpath const isCustomSelection = params.selection.isCustomSelection() - if (!isCustomSelection) return true + if (!isCustomSelection || isNil(xpath) || xpath.length === 0) return true // Every reference should be inside article references property return xpath[xpath.length - 1].property !== 'references' }
Guard xpath inspection for test use case.
substance_texture
train
js
f5c5f30877daa02b416bfc988ae0546518ff3530
diff --git a/money/tests.py b/money/tests.py index <HASH>..<HASH> 100644 --- a/money/tests.py +++ b/money/tests.py @@ -6,10 +6,7 @@ import unittest from money import Money -class TestClass(unittest.TestCase): - def setUp(self): - self.m = Money('2.22', 'EUR') - +class TestClass(unittest.TestCase): def test_new_instance_int_amount(self): self.assertIsInstance(Money(0, 'EUR'), Money) self.assertIsInstance(Money(12345, 'EUR'), Money) @@ -41,7 +38,8 @@ class TestClass(unittest.TestCase): money = Money('twenty', 'EUR') def test_not_hashable(self): - self.assertFalse(isinstance(self.m, collections.Hashable)) + money = Money('2.22', 'EUR') + self.assertFalse(isinstance(money, collections.Hashable)) class TestMoneyRepresentations(unittest.TestCase):
Removed almost unused test setUp()
carlospalol_money
train
py
94458a168afeb72e48ac38aa43ae37eb521e1698
diff --git a/neo4j-gremlin/src/main/java/com/tinkerpop/gremlin/neo4j/process/graph/step/map/Neo4jCypherIterator.java b/neo4j-gremlin/src/main/java/com/tinkerpop/gremlin/neo4j/process/graph/step/map/Neo4jCypherIterator.java index <HASH>..<HASH> 100644 --- a/neo4j-gremlin/src/main/java/com/tinkerpop/gremlin/neo4j/process/graph/step/map/Neo4jCypherIterator.java +++ b/neo4j-gremlin/src/main/java/com/tinkerpop/gremlin/neo4j/process/graph/step/map/Neo4jCypherIterator.java @@ -29,8 +29,7 @@ public class Neo4jCypherIterator<T> implements Iterator<Map<String, T>> { } public Map<String, T> next() { - final Map<String, T> next = this.iterator.next(); - final Map<String, T> transformed = next.entrySet().stream().collect(Collectors.toMap( + return this.iterator.next().entrySet().stream().collect(Collectors.toMap( Map.Entry::getKey, entry -> { final T val = entry.getValue(); @@ -42,8 +41,6 @@ public class Neo4jCypherIterator<T> implements Iterator<Map<String, T>> { return val; } })); - - return transformed; } }
minor memory optimzation and typesafety for Neo4jCypherIterator.
apache_tinkerpop
train
java
df9e1ad40fc99053ffa7205b2fc4ec5424c583b0
diff --git a/lib/browserstack/client.rb b/lib/browserstack/client.rb index <HASH>..<HASH> 100644 --- a/lib/browserstack/client.rb +++ b/lib/browserstack/client.rb @@ -1,17 +1,22 @@ module Browserstack HOSTNAME = "api.browserstack.com" class Client - attr_reader :browsers, :version + attr_reader :browsers + attr_accessor :version, :home + alias_method :api_version, :version + alias_method "api_version=", "version=" def initialize(params) params ||= {} + #File.read(`$HOME/browserstack.yml`) raise ArgumentError, "Username is required" unless params[:username] raise ArgumentError, "Password is required" unless params[:password] @authentication = "Basic " + Base64.encode64("#{params[:username]}:#{params[:password]}").strip - @version = 2 + validate_version(version) if version = params[:api_version] || params[:version] + @version = version || 3 end def get_browsers(os = nil) @@ -95,5 +100,9 @@ module Browserstack def return_with_os(os) os ? @browsers[os.to_sym] : @browsers end + + def validate_version(version) + raise "Invalid Version" unless ["1", "2", "3"].include?(version.to_s) + end end end
use version 3 by default and provide option to change version
rahulnwn_ruby-browserstack
train
rb
b406265c3366a8f2638b4831c9ef03e18f3a09fb
diff --git a/doc/source/conf.py b/doc/source/conf.py index <HASH>..<HASH> 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -199,6 +199,7 @@ MOCK_MODULES = [ 'shapely.ops', 'shapely.wkt', 'yaml', - 'affine' + 'affine', + 'tqdm' ] sys.modules.update((mod_name, Mock()) for mod_name in MOCK_MODULES)
added tqdm to mock list for RTD
ungarj_mapchete
train
py
c100020a0be6586ee1b94a8eaaa4d8e516908f86
diff --git a/lib/chatrix/room.rb b/lib/chatrix/room.rb index <HASH>..<HASH> 100644 --- a/lib/chatrix/room.rb +++ b/lib/chatrix/room.rb @@ -34,6 +34,18 @@ module Chatrix @admin = Components::Admin.new self, @matrix end + # Convenience method to get the canonical alias from this room's state. + # @return [String] The canonical alias for this room. + def canonical_alias + @state.canonical_alias + end + + # Convenience method to get the name from this room's state. + # @return [String] The name for this room. + def name + @state.name + end + # Process join events for this room. # @param data [Hash] Event data containing state and timeline events. def process_join(data) @@ -59,7 +71,7 @@ module Chatrix # If it has a canonical alias, the alias is returned. # If it has neither a name nor alias, the room ID is returned. def to_s - @state.name || @state.alias || @id + name || canonical_alias || @id end end end
Add helper methods for alias and name on Room
Sharparam_chatrix
train
rb
bca9d2b983d64ccbd55e8985ea9c3b9f2c3b22bc
diff --git a/src/Http/Presenters/Setting.php b/src/Http/Presenters/Setting.php index <HASH>..<HASH> 100644 --- a/src/Http/Presenters/Setting.php +++ b/src/Http/Presenters/Setting.php @@ -123,7 +123,7 @@ class Setting extends Presenter ->label(trans('orchestra/foundation::label.email.region')) ->options([ 'us-east-1' => 'us-east-1', - 'us-west-2' => 'us-east-1', + 'us-west-2' => 'us-west-2', 'eu-west-1' => 'eu-west-1', ]);
Fixes description for `us-west-2` SES region.
orchestral_foundation
train
php
3f7e7ed12eb4ccc7f77215bc76c954eceba5d865
diff --git a/pippo-server-parent/pippo-undertow/src/main/java/ro/pippo/undertow/websocket/UndertowWebSocketConnection.java b/pippo-server-parent/pippo-undertow/src/main/java/ro/pippo/undertow/websocket/UndertowWebSocketConnection.java index <HASH>..<HASH> 100644 --- a/pippo-server-parent/pippo-undertow/src/main/java/ro/pippo/undertow/websocket/UndertowWebSocketConnection.java +++ b/pippo-server-parent/pippo-undertow/src/main/java/ro/pippo/undertow/websocket/UndertowWebSocketConnection.java @@ -45,13 +45,7 @@ public class UndertowWebSocketConnection implements WebSocketConnection { @Override public void close(int code, String reason) { - channel.setCloseCode(code); - channel.setCloseReason(reason); - try { - channel.sendClose(); - } catch (IOException e) { - throw new PippoRuntimeException(e); - } + WebSockets.sendClose(code, reason, channel, null); } @Override
Issue #<I> - Use WebSockets.sendClose to send close code/reason (#<I>)
pippo-java_pippo
train
java
91f81dca48f68775dbd07c8ad67d9ec0fa94edff
diff --git a/Swat/SwatStyleSheetHtmlHeadEntry.php b/Swat/SwatStyleSheetHtmlHeadEntry.php index <HASH>..<HASH> 100644 --- a/Swat/SwatStyleSheetHtmlHeadEntry.php +++ b/Swat/SwatStyleSheetHtmlHeadEntry.php @@ -26,7 +26,7 @@ class SwatStyleSheetHtmlHeadEntry extends SwatHtmlHeadEntry $uri.'&'.$tag; } - printf('<link rel="stylesheet" href="%s%s" />', + printf('<link rel="stylesheet" type="text/css" href="%s%s" />', $uri_prefix, $uri); }
Specify type in link like the patch steven so graciously provided. Refs #<I>. svn commit r<I>
silverorange_swat
train
php
403de6fc648ac4e012b60b49161c3f5f36dc944a
diff --git a/sqlparse/engine/grouping.py b/sqlparse/engine/grouping.py index <HASH>..<HASH> 100644 --- a/sqlparse/engine/grouping.py +++ b/sqlparse/engine/grouping.py @@ -343,9 +343,9 @@ def group_functions(tlist): has_table = False has_as = False for tmp_token in tlist.tokens: - if tmp_token.value == 'CREATE': + if tmp_token.value.upper() == 'CREATE': has_create = True - if tmp_token.value == 'TABLE': + if tmp_token.value.upper() == 'TABLE': has_table = True if tmp_token.value == 'AS': has_as = True diff --git a/tests/test_grouping.py b/tests/test_grouping.py index <HASH>..<HASH> 100644 --- a/tests/test_grouping.py +++ b/tests/test_grouping.py @@ -660,3 +660,7 @@ def test_grouping_as_cte(): assert p[0].get_alias() is None assert p[2].value == 'AS' assert p[4].value == 'WITH' + +def test_grouping_create_table(): + p = sqlparse.parse("create table db.tbl (a string)")[0].tokens + assert p[4].value == "db.tbl"
Fixed bad parsing of create table statements that use lower case
andialbrecht_sqlparse
train
py,py
ef8201ccc84de38ab305e6da600652e50ed861cd
diff --git a/config/initializers/validators.rb b/config/initializers/validators.rb index <HASH>..<HASH> 100644 --- a/config/initializers/validators.rb +++ b/config/initializers/validators.rb @@ -1,12 +1,14 @@ include ActiveModel::EachValidator -class IsJsonValidator < ActiveModel::EachValidator - def validate_each(record, attribute, value) - @json = JSON.parse(value) - record.errors.add(attribute, "is empty") if @json.empty? - rescue TypeError => e - record.errors.add(attribute, "is not valid JSON: #{e.message}") - rescue JSON::JSONError => e - record.errors.add(attribute, "is not valid JSON: #{e.message}") +if defined? ActiveModel::EachValidator + class IsJsonValidator < ActiveModel::EachValidator + def validate_each(record, attribute, value) + @json = JSON.parse(value) + record.errors.add(attribute, "is empty") if @json.empty? + rescue TypeError => e + record.errors.add(attribute, "is not valid JSON: #{e.message}") + rescue JSON::JSONError => e + record.errors.add(attribute, "is not valid JSON: #{e.message}") + end end end \ No newline at end of file
fix the validators when activemodel is not available
madebymany_sir-trevor-rails
train
rb
c01cc7157d9848778088bf51cf55737df85e8103
diff --git a/test/extended/deployments/deployments.go b/test/extended/deployments/deployments.go index <HASH>..<HASH> 100644 --- a/test/extended/deployments/deployments.go +++ b/test/extended/deployments/deployments.go @@ -1076,8 +1076,9 @@ var _ = g.Describe("[Feature:DeploymentConfig] deploymentconfigs", func() { // Deployment status can't be updated yet but should be right after o.Expect(appsinternalutil.DeploymentStatusFor(rc1)).To(o.Equal(appsapi.DeploymentStatusRunning)) // It should finish right after - rc1, err = waitForRCModification(oc, namespace, rc1.Name, deploymentChangeTimeout, + rc1, err = waitForRCModification(oc, namespace, rc1.Name, deploymentRunTimeout, rc1.GetResourceVersion(), func(rc *kapiv1.ReplicationController) (bool, error) { + e2e.Logf("Deployment status for RC: %#v", appsinternalutil.DeploymentStatusFor(rc)) return appsinternalutil.DeploymentStatusFor(rc) == appsapi.DeploymentStatusComplete, nil }) o.Expect(err).NotTo(o.HaveOccurred())
test/extended/deployments: check for deployment completion with deploymentRunTimeout
openshift_origin
train
go
0482d2e0960b60079c3b6d6c86794b6b2366bece
diff --git a/decidim-budgets/lib/decidim/budgets/component.rb b/decidim-budgets/lib/decidim/budgets/component.rb index <HASH>..<HASH> 100644 --- a/decidim-budgets/lib/decidim/budgets/component.rb +++ b/decidim-budgets/lib/decidim/budgets/component.rb @@ -148,7 +148,7 @@ Decidim.register_component(:budgets) do |component| description: Decidim::Faker::Localized.wrapped("<p>", "</p>") do Decidim::Faker::Localized.paragraph(sentence_count: 3) end, - budget_amount: Faker::Number.number(digits: 8) + budget_amount: Faker::Number.between(from: Integer(budget.total_budget * 0.7), to: budget.total_budget) ) attachment_collection = Decidim::AttachmentCollection.create!(
Project budget amount is less than total budget (#<I>)
decidim_decidim
train
rb
0e4e1a43f1b692c5aa19bee9101dfbd1722e34d9
diff --git a/lib/accesslib.php b/lib/accesslib.php index <HASH>..<HASH> 100755 --- a/lib/accesslib.php +++ b/lib/accesslib.php @@ -5269,7 +5269,7 @@ function get_role_users($roleid, $context, $parent=false, $fields='', $fields = 'u.id, u.confirmed, u.username, u.firstname, u.lastname, '. 'u.maildisplay, u.mailformat, u.maildigest, u.email, u.city, '. 'u.country, u.picture, u.idnumber, u.department, u.institution, '. - 'u.emailstop, u.lang, u.timezone, r.name as rolename'; + 'u.emailstop, u.lang, u.timezone, u.lastaccess, u.mnethostid, r.name as rolename'; } // whether this assignment is hidden
MDL-<I>: get_role_users - add lastaccess & mnethostid to the list of default fields to return. These are used by messaging/emailing. (Merged from MOODLE_<I>_STABLE)
moodle_moodle
train
php
d30b5bf7f63ccc60045b5621a198f6786fbe7f82
diff --git a/src/Wandu/Database/Console/MigrateCreateCommand.php b/src/Wandu/Database/Console/MigrateCreateCommand.php index <HASH>..<HASH> 100644 --- a/src/Wandu/Database/Console/MigrateCreateCommand.php +++ b/src/Wandu/Database/Console/MigrateCreateCommand.php @@ -34,7 +34,7 @@ class {$name} extends Migration */ public function migrate(Builder \$schema) { - \$schema->table('{articles}', function (Blueprint \$table) { + \$schema->create('{articles}', function (Blueprint \$table) { \$table->bigIncrements('id'); \$table->timestamps(); });
rename default migration's method table to create
Wandu_Framework
train
php
d5fa70c7b9acf91c986ed3bb69a06b16ce5cb12c
diff --git a/spec/mixpanel_client/events_externalspec.rb b/spec/mixpanel_client/events_externalspec.rb index <HASH>..<HASH> 100644 --- a/spec/mixpanel_client/events_externalspec.rb +++ b/spec/mixpanel_client/events_externalspec.rb @@ -16,7 +16,7 @@ describe 'External calls to mixpanel' do resource 'events' end } - data.should raise_error(Mixpanel::URI::HTTPError) + data.should raise_error(Mixpanel::HTTPError) end it 'should return events' do diff --git a/spec/mixpanel_client/properties_externalspec.rb b/spec/mixpanel_client/properties_externalspec.rb index <HASH>..<HASH> 100644 --- a/spec/mixpanel_client/properties_externalspec.rb +++ b/spec/mixpanel_client/properties_externalspec.rb @@ -16,7 +16,7 @@ describe 'External calls to mixpanel' do resource 'properties' end } - data.should raise_error(Mixpanel::URI::HTTPError) + data.should raise_error(Mixpanel::HTTPError) end it 'should return events' do
Updated specs to match namespacing exceptions. Fixes issue #5.
keolo_mixpanel_client
train
rb,rb
81da54a4daa4007d2e85f6aac1110274dd82be8c
diff --git a/fluent_blogs/views/entries.py b/fluent_blogs/views/entries.py index <HASH>..<HASH> 100644 --- a/fluent_blogs/views/entries.py +++ b/fluent_blogs/views/entries.py @@ -16,10 +16,15 @@ from parler.models import TranslatableModel class BaseBlogMixin(object): context_object_name = None + prefetch_translations = False + def get_queryset(self): - # NOTE: This is a workaround, defining the queryset static somehow caused results to remain cached. - return get_entry_model().objects.published() + # NOTE: This is also workaround, defining the queryset static somehow caused results to remain cached. + qs = get_entry_model().objects.published() + if self.prefetch_translations: + qs = qs.prefetch_related('translations') + return qs def get_language(self): """ @@ -58,6 +63,9 @@ class BaseArchiveMixin(BaseBlogMixin): class BaseDetailMixin(BaseBlogMixin): + # Only relevant at the detail page, e.g. for a language switch menu. + prefetch_translations = appsettings.FLUENT_BLOGS_PREFETCH_TRANSLATIONS + def get_queryset(self): qs = super(BaseDetailMixin, self).get_queryset()
Allow to set prefetch_translations when needed This can be used when sites have a language-switching menu for example.
django-fluent_django-fluent-blogs
train
py
3e90dacce4ba102e6822ebff0eba4cb60bbdb085
diff --git a/pyhs2/connections.py b/pyhs2/connections.py index <HASH>..<HASH> 100644 --- a/pyhs2/connections.py +++ b/pyhs2/connections.py @@ -32,6 +32,10 @@ class Connection(object): transport.open() res = self.client.OpenSession(TOpenSessionReq()) self.session = res.sessionHandle + if database is not None: + with self.cursor() as cur: + query = "USE {0}".format(database) + cur.execute(query) def __enter__(self): return self
Fixed bug with setting inital db
BradRuderman_pyhs2
train
py
04567e4dda5dd32227d562e3c927d21635ba8b8c
diff --git a/classes/Gems/JQuery/View/Helper/TabContainer.php b/classes/Gems/JQuery/View/Helper/TabContainer.php index <HASH>..<HASH> 100644 --- a/classes/Gems/JQuery/View/Helper/TabContainer.php +++ b/classes/Gems/JQuery/View/Helper/TabContainer.php @@ -107,7 +107,7 @@ class Gems_JQuery_View_Helper_TabContainer extends ZendX_JQuery_View_Helper_TabC if (isset($opts['class'])) { $class .= $opts['class']; } - if ($firstSelected || $fragment_counter == $selected) { + if ($firstSelected || $tabIndex == $selected) { $class .= ' active'; $active = ' active'; $firstSelected = false;
Fixed #<I>: tabindex should be used instead of fragment counter(was working, but accidentally removed it before committing)
GemsTracker_gemstracker-library
train
php
0b573e21341e746e415667f0ead8646c9e6e181e
diff --git a/lib/passports.js b/lib/passports.js index <HASH>..<HASH> 100644 --- a/lib/passports.js +++ b/lib/passports.js @@ -105,18 +105,14 @@ module.exports = { passport.tokens = JSON.stringify(query.tokens) } - // I save any update to the Passport before moving on and - // I read the associated user instance + // Save any update to the Passport and read the associated user instance return Promise.all([ app.services.FootprintService.findAssociation("Passport", passport.id, "User"), - app.services.FootprintService.update("Passport", passport.id, passport) + app.services.FootprintService.update("Passport", passport.id, passport.toJSON()) ]) .then(results => { let userInstance = results[0]; // Not so usefull, just for keeping namings clear - return app.services.FootprintService.find('user', userInstance.id) - }) - .then(user => { - next(null, user) + next(null, userInstance) }) .catch(next) }
- Fixed passport.toJSON() and redundant query after review
jaumard_trailpack-passport
train
js
8a650a11d1f859a88cc91b8815c16597203892aa
diff --git a/xarray/core/dataset.py b/xarray/core/dataset.py index <HASH>..<HASH> 100644 --- a/xarray/core/dataset.py +++ b/xarray/core/dataset.py @@ -3550,7 +3550,7 @@ class Dataset(Mapping, ImplementsDatasetReduce, DataWithCoords): def merge( self, - other: "CoercibleMapping", + other: Union["CoercibleMapping", "DataArray"], inplace: bool = None, overwrite_vars: Union[Hashable, Iterable[Hashable]] = frozenset(), compat: str = "no_conflicts",
Fix mypy type checking tests failure in ds.merge (#<I>) * Added DataArray as valid type input to ds.merge method * Fix import error by specifying type as string
pydata_xarray
train
py
ae3c055545d363596ab95da3bd9a6c9ee1ae1419
diff --git a/scrapers/neuEmployees.js b/scrapers/neuEmployees.js index <HASH>..<HASH> 100644 --- a/scrapers/neuEmployees.js +++ b/scrapers/neuEmployees.js @@ -138,16 +138,13 @@ async function getCookiePromise() { function hitWithLetters(lastNameStart, jsessionCookie) { - jsessionCookie = '0000yanSt9GeC_JZ_t5ahPOOnlQ:188q12kdr' const reqBody = `searchBy=Last+Name&queryType=begins+with&searchText=${lastNameStart}&deptText=&addrText=&numText=&divText=&facStaff=1`; return request.post({ url: 'https://prod-web.neu.edu/wasapp/employeelookup/public/searchEmployees.action', method: 'POST', headers: { - 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.143', 'Content-Type': 'application/x-www-form-urlencoded', Cookie: `JSESSIONID=${jsessionCookie}`, - Referer: 'https://prod-web.neu.edu/wasapp/employeelookup/public/searchEmployees.action', }, body: reqBody, })
"removed hardcoded cookie"
ryanhugh_searchneu
train
js
46ea6caffd99e7dd91ac8639751abb021d1bf847
diff --git a/greycat/src/main/java/greycat/base/BaseCustomTypeSingle.java b/greycat/src/main/java/greycat/base/BaseCustomTypeSingle.java index <HASH>..<HASH> 100644 --- a/greycat/src/main/java/greycat/base/BaseCustomTypeSingle.java +++ b/greycat/src/main/java/greycat/base/BaseCustomTypeSingle.java @@ -30,7 +30,7 @@ public class BaseCustomTypeSingle extends BaseCustomType { } @Override - public final Object getAt(int index) { + public Object getAt(int index) { return _backend.estruct(DEF_NODE).getAt(index); } @@ -45,12 +45,12 @@ public class BaseCustomTypeSingle extends BaseCustomType { } @Override - public final int typeAt(int index) { + public int typeAt(int index) { return _backend.estruct(DEF_NODE).typeAt(index); } @Override - public final Container setAt(int index, int type, Object value) { + public Container setAt(int index, int type, Object value) { return _backend.estruct(DEF_NODE).setAt(index, type, value); }
* modeling env: prepared custom types to override getAt/setAt/typeAt
datathings_greycat
train
java