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
b5ac72b889f500504a93a484d3e145ce3b57e152
diff --git a/lib/audio_monster/monster.rb b/lib/audio_monster/monster.rb index <HASH>..<HASH> 100644 --- a/lib/audio_monster/monster.rb +++ b/lib/audio_monster/monster.rb @@ -10,6 +10,7 @@ require 'nu_wav' require 'tempfile' require 'mimemagic' require 'active_support/all' +require 'digest' module AudioMonster @@ -745,7 +746,8 @@ module AudioMonster file_name = File.basename(base_file_name) file_ext = File.extname(base_file_name) FileUtils.mkdir_p(tmp_dir) unless File.exists?(tmp_dir) - tmp = Tempfile.new([file_name, file_ext], tmp_dir) + safe_file_name = Digest::SHA256.hexdigest(file_name) + tmp = Tempfile.new([safe_file_name, file_ext], tmp_dir) tmp.binmode if bin_mode tmp end
avoid "File name too long" errors from Tempfile by hashing file_name before construction
PRX_audio_monster
train
rb
0d94cf61d27c2dfdd669d4185a480d4e449df338
diff --git a/QueryBuilder/MongodbQueryBuilder.php b/QueryBuilder/MongodbQueryBuilder.php index <HASH>..<HASH> 100644 --- a/QueryBuilder/MongodbQueryBuilder.php +++ b/QueryBuilder/MongodbQueryBuilder.php @@ -46,12 +46,17 @@ class MongodbQueryBuilder extends AbstractQueryBuilder { if (isset($this->config['joinWhere'])) { foreach($this->config['joinWhere'] as $where) { list($name, $values, $subSelectField) = $where; - // @todo test it - if ($subSelectField == 'id') { + if ($subSelectField === 'id') { $queryBuilder->field($name)->in($values); } else { $founds = array(); - $tmp = $this->service->getRepository($name)->findBy(array($subSelectField=>$values)); + $className = explode('\\', $this->or->getClassName()); + unset($className[count($className) - 1]); + $tmp = $this->service->getRepository(implode('\\', $className).'\\'.ucfirst($name)) + ->createQueryBuilder() + ->field($subSelectField)->in($values) + ->getQuery() + ->execute(); foreach($tmp as $t) $founds[] = $t->getId(); if (count($founds)) {
Fix joinWhere with subselect in MongodbQueryBuilder
nyroDev_UtilityBundle
train
php
c380f7e88c3b9083f3ed99ef92f50e0e29e5c995
diff --git a/tests/test_extensions/test_redis.py b/tests/test_extensions/test_redis.py index <HASH>..<HASH> 100644 --- a/tests/test_extensions/test_redis.py +++ b/tests/test_extensions/test_redis.py @@ -2,7 +2,9 @@ from __future__ import unicode_literals, division, print_function, absolute_import from nose.tools import eq_ +from nose.plugins.skip import SkipTest from marrow.wsgi.objects.request import LocalRequest +from redis.exceptions import ConnectionError from redis import StrictRedis from web.core.application import Application @@ -12,9 +14,14 @@ def insert_data_controller(context): context.redis.set('bar', 'baz') -class TestMongoDBExtension(object): +class TestRedisExtension(object): def setup(self): self.connection = StrictRedis(db='testdb') + try: + self.connection.ping() + except ConnectionError: + raise SkipTest('No Redis server available') + self.config = { 'extensions': { 'redis': {
Fixed test class name and made the test skippable if no Redis server is present.
marrow_WebCore
train
py
1c194a4d6dae5c8db600a3519c2b3516dfb38eda
diff --git a/classes/Gems/Tracker.php b/classes/Gems/Tracker.php index <HASH>..<HASH> 100644 --- a/classes/Gems/Tracker.php +++ b/classes/Gems/Tracker.php @@ -719,7 +719,7 @@ class Gems_Tracker extends \Gems_Loader_TargetLoaderAbstract implements \Gems_Tr $trackData['gtr_track_class'] = 'AnyStepEngine'; } - $this->_trackEngines[$trackId] = $this->_loadClass('engine_' . $trackData['gtr_track_class'], true, array($trackData)); + $this->_trackEngines[$trackId] = $this->_loadClass('Engine_' . $trackData['gtr_track_class'], true, array($trackData)); } return $this->_trackEngines[$trackId];
Track Engine directory is with capital E. When using ProjectOverloader as loader, case sensitive matters on linux
GemsTracker_gemstracker-library
train
php
d6fe0ba347f5fe2c1a5c38ea6873477becc54bc8
diff --git a/grid_frame.py b/grid_frame.py index <HASH>..<HASH> 100755 --- a/grid_frame.py +++ b/grid_frame.py @@ -412,6 +412,7 @@ class GridFrame(wx.Frame): # remove unneeded headers pmag_items = sorted(builder.remove_list_headers(pmag_items)) dia = pw.HeaderDialog(self, 'columns to add', er_items, pmag_items) + dia.Centre() result = dia.ShowModal() new_headers = [] if result == 5100: @@ -430,6 +431,7 @@ class GridFrame(wx.Frame): self.grid.SetWindowStyle(wx.DOUBLE_BORDER) self.main_sizer.Fit(self) self.grid.SetWindowStyle(wx.NO_BORDER) + self.Centre() self.main_sizer.Fit(self) # self.grid.changes = set(range(self.grid.GetNumberRows()))
UI fixes based on running through tutorials on Windows
PmagPy_PmagPy
train
py
7132f81d14dda4e5c8fff65b166a4829e362291f
diff --git a/src/Symfony/Component/Serializer/Serializer.php b/src/Symfony/Component/Serializer/Serializer.php index <HASH>..<HASH> 100644 --- a/src/Symfony/Component/Serializer/Serializer.php +++ b/src/Symfony/Component/Serializer/Serializer.php @@ -28,8 +28,8 @@ use Symfony\Component\Serializer\Encoder\EncoderInterface; */ class Serializer implements SerializerInterface { - protected $normalizers = array(); - protected $encoders = array(); + private $normalizers = array(); + private $encoders = array(); private $normalizerCache = array(); /**
[Serializer] Some more privates
symfony_symfony
train
php
0fc075728bca749833182a0465cdfab94e15d607
diff --git a/src/config/hisite.php b/src/config/hisite.php index <HASH>..<HASH> 100644 --- a/src/config/hisite.php +++ b/src/config/hisite.php @@ -80,13 +80,6 @@ return [ 'hisite' => 'hisite.php', ], ], - 'hisite/page' => [ - 'class' => \yii\i18n\PhpMessageSource::class, - 'basePath' => '@hisite/messages', - 'fileMap' => [ - 'page' => 'page.php', - ], - ], ], ], ],
removed `hisite/page` translation
hiqdev_hisite
train
php
dce62a180009cf3c3166d596a60a1f47a1f082da
diff --git a/lib/spice/version.rb b/lib/spice/version.rb index <HASH>..<HASH> 100755 --- a/lib/spice/version.rb +++ b/lib/spice/version.rb @@ -1,3 +1,3 @@ module Spice - VERSION = "0.4.0" + VERSION = "0.4.1" end
bump to <I> to fix platform support
danryan_spice
train
rb
6d39b0ae0783dde3e93d8f21c87ef3bdb8f1bfa9
diff --git a/lib/cancan/model_adapters/data_mapper_adapter.rb b/lib/cancan/model_adapters/data_mapper_adapter.rb index <HASH>..<HASH> 100644 --- a/lib/cancan/model_adapters/data_mapper_adapter.rb +++ b/lib/cancan/model_adapters/data_mapper_adapter.rb @@ -10,7 +10,8 @@ module CanCan end def self.matches_conditions_hash?(subject, conditions) - subject.class.all(:conditions => conditions).include?(subject) # TODO don't use a database query here for performance and other instances + collection = DataMapper::Collection.new(subject.query, [ subject ]) + !!collection.first(conditions) end def database_records
Use dkubb's suggestion for evaluating conditions against a Resource.
ryanb_cancan
train
rb
b0b0332a0f6037fdb8ad03175493774054864267
diff --git a/pysnmp/entity/rfc3413/config.py b/pysnmp/entity/rfc3413/config.py index <HASH>..<HASH> 100644 --- a/pysnmp/entity/rfc3413/config.py +++ b/pysnmp/entity/rfc3413/config.py @@ -38,6 +38,8 @@ def getTargetAddr(snmpEngine, snmpTargetAddrName): snmpTargetAddrTAddress = tuple( TransportAddressIPv6(snmpTargetAddrTAddress) ) + elif snmpTargetAddrTDomain[:len(config.snmpLocalDomain)] == config.snmpLocalDomain: + snmpTargetAddrTAddress = str(snmpTargetAddrTAddress) return ( snmpTargetAddrTDomain, snmpTargetAddrTAddress,
cast snmpLocalDomain-typed address object into a string to make it compatible with BSD socket API
etingof_pysnmp
train
py
d743e4206f6efbde575592dcd7cc8e60d0007ca0
diff --git a/src/ol-ext/interaction/measure.js b/src/ol-ext/interaction/measure.js index <HASH>..<HASH> 100644 --- a/src/ol-ext/interaction/measure.js +++ b/src/ol-ext/interaction/measure.js @@ -1,5 +1,5 @@ goog.provide('ngeo.MeasureEvent'); -goog.provide('ngeo.interaction'); +goog.provide('ngeo.MeasureEventType'); goog.provide('ngeo.interaction.Measure'); goog.require('goog.dom');
Fix goog.provides in measure.js
camptocamp_ngeo
train
js
929f8d119839288455d038952aab79730baf4c61
diff --git a/tornado/netutil.py b/tornado/netutil.py index <HASH>..<HASH> 100644 --- a/tornado/netutil.py +++ b/tornado/netutil.py @@ -362,7 +362,7 @@ else: # than one wildcard per fragment. A survery of established # policy among SSL implementations showed it to be a # reasonable choice. - raise CertificateError( + raise SSLCertificateError( "too many wildcards in certificate DNS name: " + repr(dn)) if frag == '*': # When '*' is a fragment by itself, it matches a non-empty dotless
Fix exception name in backported ssl fix.
tornadoweb_tornado
train
py
c3c3e519219ad80ac07d21c74849fbc4246c9d7a
diff --git a/lib/puppet/provider/maillist/mailman.rb b/lib/puppet/provider/maillist/mailman.rb index <HASH>..<HASH> 100755 --- a/lib/puppet/provider/maillist/mailman.rb +++ b/lib/puppet/provider/maillist/mailman.rb @@ -101,9 +101,9 @@ Puppet::Type.type(:maillist).provide(:mailman) do # Pull the current state of the list from the full list. We're # getting some double entendre here.... def query - provider.class.instances.each do |list| + self.class.instances.each do |list| if list.name == self.name or list.name.downcase == self.name - return list.property_hash + return list.properties end end nil
Fixing a small problem with the mailman type
puppetlabs_puppet
train
rb
246444b97516e222cf271327e27e08dbf206e7a7
diff --git a/mod/assignment/lib.php b/mod/assignment/lib.php index <HASH>..<HASH> 100644 --- a/mod/assignment/lib.php +++ b/mod/assignment/lib.php @@ -1018,7 +1018,7 @@ class assignment_base { $table->define_headers($tableheaders); $table->define_baseurl($CFG->wwwroot.'/mod/assignment/submissions.php?id='.$this->cm->id.'&amp;currentgroup='.$currentgroup); - $table->sortable(true); + $table->sortable(true, 'lastname');//sorted by lastname by default $table->collapsible(true); $table->initialbars(true);
Bug #<I> - Assigment listing shows duplicate names with paged display; merged from MOODLE_<I>_STABLE
moodle_moodle
train
php
c976a550cbfc91c303ff094b5b56f6fd6a4ba7f3
diff --git a/server.go b/server.go index <HASH>..<HASH> 100644 --- a/server.go +++ b/server.go @@ -206,7 +206,8 @@ func newServer(listenAddrs []string, chanDB *channeldb.DB, cc *chainControl, debugPre[:], debugHash[:]) } - s.htlcSwitch = htlcswitch.New(htlcswitch.Config{ + htlcSwitch, err := htlcswitch.New(htlcswitch.Config{ + DB: chanDB, SelfKey: s.identityPriv.PubKey(), LocalChannelClose: func(pubKey []byte, request *htlcswitch.ChanClose) { @@ -230,8 +231,13 @@ func newServer(listenAddrs []string, chanDB *channeldb.DB, cc *chainControl, pubKey[:], err) } }, - FwdingLog: chanDB.ForwardingLog(), + FwdingLog: chanDB.ForwardingLog(), + SwitchPackager: channeldb.NewSwitchPackager(), }) + if err != nil { + return nil, err + } + s.htlcSwitch = htlcSwitch // If external IP addresses have been specified, add those to the list // of this server's addresses. We need to use the cfg.net.ResolveTCPAddr
server: initialize switch with circuit db
lightningnetwork_lnd
train
go
bc4013ebfa65d85bd92c1eb24e72ab8f4143b998
diff --git a/core/DataAccess/Model.php b/core/DataAccess/Model.php index <HASH>..<HASH> 100644 --- a/core/DataAccess/Model.php +++ b/core/DataAccess/Model.php @@ -282,8 +282,10 @@ class Model public function deletePreviousArchiveStatus($numericTable, $archiveId, $doneFlag) { $tableWithoutLeadingPrefix = $numericTable; - if (strlen($numericTable) >= 23) { - $tableWithoutLeadingPrefix = substr($numericTable, strlen($numericTable) - 23); + $lenNumericTableWithoutPrefix = strlen('archive_numeric_MM_YYYY'); + + if (strlen($numericTable) >= $lenNumericTableWithoutPrefix) { + $tableWithoutLeadingPrefix = substr($numericTable, strlen($numericTable) - $lenNumericTableWithoutPrefix); // we need to make sure lock name is less than 64 characters see https://github.com/piwik/piwik/issues/9131 } $dbLockName = "rmPrevArchiveStatus.$tableWithoutLeadingPrefix.$archiveId";
removed the hardcoded <I> and instead calculate lenght dynamically
matomo-org_matomo
train
php
a1071170a5288efc2d127aa8d9314a64c03c9e08
diff --git a/src/Util/Arr.php b/src/Util/Arr.php index <HASH>..<HASH> 100644 --- a/src/Util/Arr.php +++ b/src/Util/Arr.php @@ -70,7 +70,7 @@ class Arr } /** - * Get specified collection item. + * Get specified value in array path. * * @param array $data The data. * @param array|string $path The path of array keys. @@ -96,7 +96,22 @@ class Arr } /** - * Get specified collection item. + * Increment specified value in array path. + * + * @param array $data The data. + * @param array|string $path The path of array keys. + * @param mixed $value The value to increment. + * @param string $glue [optional] + * + * @return mixed The new array. + */ + public static function incrementPath(array $data, $path, $value, $glue = '.') + { + return self::setPath($data, $path, self::path($data, $path, 0, $glue) + $value, $glue); + } + + /** + * Set specified value in array path. * * @param array $data The data. * @param array|string $path The path of array keys.
Added Util/Arr::incrementPath()
ansas_php-component
train
php
2617069511783ebe87feea5e9f2831d1efdd398f
diff --git a/server.js b/server.js index <HASH>..<HASH> 100644 --- a/server.js +++ b/server.js @@ -603,8 +603,7 @@ cache(function(data, match, sendBadge) { try { var data = JSON.parse(buffer); var downloads = data.version_downloads; - badgeData.text[1] = metric(downloads); - badgeData.text[1] = badgeData.text[1] + ' latest version'; + badgeData.text[1] = metric(downloads) + ' latest version'; badgeData.colorscheme = downloadCountColor(downloads); sendBadge(format, badgeData); } catch(e) { @@ -630,8 +629,7 @@ cache(function(data, match, sendBadge) { try { var data = JSON.parse(buffer); var downloads = data.downloads; - badgeData.text[1] = metric(downloads); - badgeData.text[1] = badgeData.text[1] + ' total'; + badgeData.text[1] = metric(downloads) + ' total'; badgeData.colorscheme = downloadCountColor(downloads); sendBadge(format, badgeData); } catch(e) {
Gem downloads: omit needless space & code lines.
badges_shields
train
js
8d46da6199f84063299cade73ce7ff4bb07ea66a
diff --git a/spring-cloud-contract-stub-runner/src/main/java/org/springframework/cloud/contract/stubrunner/StubServer.java b/spring-cloud-contract-stub-runner/src/main/java/org/springframework/cloud/contract/stubrunner/StubServer.java index <HASH>..<HASH> 100644 --- a/spring-cloud-contract-stub-runner/src/main/java/org/springframework/cloud/contract/stubrunner/StubServer.java +++ b/spring-cloud-contract-stub-runner/src/main/java/org/springframework/cloud/contract/stubrunner/StubServer.java @@ -53,10 +53,15 @@ class StubServer { } private StubServer stubServer() { + this.httpServerStub.registerMappings(this.mappings); log.info("Started stub server for project [" + this.stubConfiguration.toColonSeparatedDependencyNotation() - + "] on port " + this.httpServerStub.port()); - this.httpServerStub.registerMappings(this.mappings); + + "] on port " + this.httpServerStub.port() + " with [" + + this.mappings.size() + "] mappings"); + if (this.mappings.isEmpty() && getPort() != -1) { + log.warn( + "There are no HTTP mappings registered, if your contracts are not messaging based then something went wrong"); + } return this; }
Added more logging if there are no HTTP stubs in the attached JAR. Fixes gh-<I>
spring-cloud_spring-cloud-contract
train
java
b92cd1adb05b24d9d57ffb511842125b6ed4c9ba
diff --git a/Tests/Controller/Admin/ReviewControllerTest.php b/Tests/Controller/Admin/ReviewControllerTest.php index <HASH>..<HASH> 100755 --- a/Tests/Controller/Admin/ReviewControllerTest.php +++ b/Tests/Controller/Admin/ReviewControllerTest.php @@ -51,7 +51,10 @@ class ReviewControllerTest extends AbstractAdminControllerTestCase public function testGridAction() { - $this->client->request('GET', $this->generateUrl('admin.review.grid')); - $this->assertTrue($this->client->getResponse()->isRedirect($this->generateUrl('admin.review.index', [], true))); + $this->client->request('GET', $this->generateUrl('admin.review.grid'), [], [], [ + 'HTTP_X-Requested-With' => 'XMLHttpRequest', + ]); + + $this->assertTrue($this->client->getResponse()->isSuccessful()); } }
Factory fixes, fixed repositories, tests, entities
WellCommerce_WishlistBundle
train
php
d75af1670e9c2f282f90ec0b366cd7ecee491616
diff --git a/Fitter.py b/Fitter.py index <HASH>..<HASH> 100644 --- a/Fitter.py +++ b/Fitter.py @@ -113,7 +113,7 @@ class ExtractTrack(): dz = z1 - z0 dx = x1 - x0 - # Compute distance and compare to best + # Compute distance and compare to best: reject x1? if math.hypot(dz, dx) < math.hypot(z1 - z0, best_x - x0): # The previous best was rejected, so add it to the unextracted list leftovers.append((z1, best_x)) @@ -121,7 +121,7 @@ class ExtractTrack(): best_x = x1 else: # Distance too far compared to best, so unextracted - leftovers.append((z1, best_x)) + leftovers.append((z1, x1)) # Make sure we aren't jumping too far. If we are, throw the best # and leftovers into the unextracted bin
Found bug, need to fix: logic of unextracted points broken
nuSTORM_gnomon
train
py
c65e1d6342684b1f01d70a5a753d13efc0d84c06
diff --git a/s3direct/views.py b/s3direct/views.py index <HASH>..<HASH> 100644 --- a/s3direct/views.py +++ b/s3direct/views.py @@ -1,5 +1,4 @@ import json -from inspect import isfunction from django.http import HttpResponse from django.views.decorators.http import require_POST @@ -43,7 +42,7 @@ def get_upload_params(request): data = json.dumps({'error': 'Invalid file type (%s).' % content_type}) return HttpResponse(data, content_type="application/json", status=400) - if isfunction(key): + if hasattr(key, '__call__'): key = key(filename) else: key = '%s/${filename}' % key
Add support for functool.partials in filename generation
bradleyg_django-s3direct
train
py
b54261599f2d3aab6a3eebc8dee787c98ffc8b93
diff --git a/Mixtape/commands/pullmeans.py b/Mixtape/commands/pullmeans.py index <HASH>..<HASH> 100644 --- a/Mixtape/commands/pullmeans.py +++ b/Mixtape/commands/pullmeans.py @@ -87,8 +87,11 @@ class PullMeansGHMM(SampleGHMM): if len(p) > 0: data['index'].extend(sorted_indices[-self.args.n_per_state:]) + index_length = len(sorted_indices[-self.args.n_per_state:]) data['filename'].extend(sorted_filenms[-self.args.n_per_state:]) - data['state'].extend([k]*self.args.n_per_state) + filename_length = len(sorted_filenms[-self.args.n_per_state:]) + assert len(index_length) == len(filename_length) + data['state'].extend([k]*index_length) else: print('WARNING: NO STRUCTURES ASSIGNED TO STATE=%d' % k)
prevent ValueError when trying to pull too many structures
msmbuilder_msmbuilder
train
py
0c0dba1caf72f78558554a28ca4fc01923cec6f1
diff --git a/activesupport/lib/active_support/notifications/instrumenter.rb b/activesupport/lib/active_support/notifications/instrumenter.rb index <HASH>..<HASH> 100644 --- a/activesupport/lib/active_support/notifications/instrumenter.rb +++ b/activesupport/lib/active_support/notifications/instrumenter.rb @@ -81,14 +81,20 @@ module ActiveSupport @allocation_count_finish = now_allocations end + # Returns the CPU time (in milliseconds) passed since the call to + # +start!+ and the call to +finish!+ def cpu_time - @cpu_time_finish - @cpu_time_start + (@cpu_time_finish - @cpu_time_start) * 1000 end + # Returns the idle time time (in milliseconds) passed since the call to + # +start!+ and the call to +finish!+ def idle_time duration - cpu_time end + # Returns the number of allocations made since the call to +start!+ and + # the call to +finish!+ def allocations @allocation_count_finish - @allocation_count_start end
Match the units in `duration` (milliseconds)
rails_rails
train
rb
25e90339699a20e08bb01c43969fc8de17c043e4
diff --git a/lib/danger/ci_source/gitlab_ci.rb b/lib/danger/ci_source/gitlab_ci.rb index <HASH>..<HASH> 100644 --- a/lib/danger/ci_source/gitlab_ci.rb +++ b/lib/danger/ci_source/gitlab_ci.rb @@ -54,6 +54,7 @@ module Danger if (client_version >= Gem::Version.new("13.8")) # Gitlab 13.8.0 started returning merge requests for merge commits and squashed commits # By checking for merge_request.state, we can ensure danger only comments on MRs which are open + return 0 if merge_request.nil? return 0 unless merge_request.state == "opened" end else
Check for nil, before accessing merge_request
danger_danger
train
rb
66b20f39cdd4935e853ceb8e6a9a2376ddc625fb
diff --git a/stack.go b/stack.go index <HASH>..<HASH> 100644 --- a/stack.go +++ b/stack.go @@ -20,7 +20,7 @@ var ( type Frame struct { Filename string `json:"filename"` Method string `json:"method"` - Line int `json: "line"` + Line int `json:"lineno"` } type Stack []Frame
Fix line numbers in the payload.
stvp_rollbar
train
go
10beb86e9e05c1fedaa7bf37a7dc4274bcdf40cb
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -48,10 +48,9 @@ if sys.platform == 'darwin': import setup_helper setup_helper.install_custom_make_tarball() -import paramiko setup(name = "paramiko", - version = paramiko.__version__, + version = "1.7.10" description = "SSH2 protocol library", author = "Jeff Forcier", author_email = "jeff@bitprophet.org",
Partially revert centralized version stuff (cherry picked from commit d9ba7a<I>c<I>b<I>ae<I>e<I>d2d9fe<I>ba<I>) Conflicts: setup.py
paramiko_paramiko
train
py
fce131b7a7bff539259536456d27f5964487d34e
diff --git a/pysat/_instrument.py b/pysat/_instrument.py index <HASH>..<HASH> 100644 --- a/pysat/_instrument.py +++ b/pysat/_instrument.py @@ -1402,19 +1402,13 @@ class Instrument(object): # ensure data is unique and monotonic # check occurs after all the data padding loads, or individual load # thus it can potentially check issues with padding or with raw data - if (not self.index.is_monotonic_increasing): + if (not self.index.is_monotonic_increasing) or (not self.index.is_unique): if self.strict_time_flag: - raise ValueError('Loaded data is not monotonic increasing') - else: - # warn about changes coming in the future - warnings.warn(' '.join(('Strict times will eventually be', - 'enforced upon all instruments.', - '(strict_time_flag)')), - DeprecationWarning, - stacklevel=2) - if (not self.index.is_unique): - if self.strict_time_flag: - raise ValueError('Loaded data is not unique') + raise ValueError('Loaded data is not unique (', + not self.index.is_unique, + ') or not monotonic increasing (', + not self.index.is_monotonic_increasing, + ')') else: # warn about changes coming in the future warnings.warn(' '.join(('Strict times will eventually be',
STY: revert to original error message
rstoneback_pysat
train
py
3b1508d1d0c5099dc9cab396a7b1cafbf7016a60
diff --git a/bytecode/tests/__init__.py b/bytecode/tests/__init__.py index <HASH>..<HASH> 100644 --- a/bytecode/tests/__init__.py +++ b/bytecode/tests/__init__.py @@ -36,7 +36,7 @@ def _format_instr_list(block, labels, lineno): instr_list.append(text) return '[%s]' % ',\n '.join(instr_list) -def dump_code(code, lineno=True): +def dump_bytecode(code, lineno=True): """ Use this function to write unit tests: copy/paste its output to write a self.assertBlocksEqual() check.
tests: rename dump_code to dump_bytecode
vstinner_bytecode
train
py
92febbffb91943f13cfac8c00e55103b20645b70
diff --git a/plex/objects/library/container.py b/plex/objects/library/container.py index <HASH>..<HASH> 100644 --- a/plex/objects/library/container.py +++ b/plex/objects/library/container.py @@ -33,3 +33,9 @@ class MediaContainer(Container): } return Section.construct(client, node, attribute_map, child=True) + + def __iter__(self): + for item in super(MediaContainer, self).__iter__(): + item.section = self.section + + yield item
Update [MediaContainer] children with the correct `section` object
fuzeman_plex.py
train
py
e13770f597917101259150e4210140a545231b7d
diff --git a/lib/releaf/rspec/helpers.rb b/lib/releaf/rspec/helpers.rb index <HASH>..<HASH> 100644 --- a/lib/releaf/rspec/helpers.rb +++ b/lib/releaf/rspec/helpers.rb @@ -22,6 +22,12 @@ module Releaf return user end + def within_dialog &block + find(".dialog") do + yield + end + end + def save_and_check_response status_text click_button 'Save' expect(page).to have_css('body > .notifications .notification[data-id="resource_status"][data-type="success"]', text: status_text)
"within_dialog" matcher scope added
cubesystems_releaf
train
rb
4f43d9a53007f3723bde6f91d36cafcd42f40aff
diff --git a/ipywidgets/static/widgets/js/manager.js b/ipywidgets/static/widgets/js/manager.js index <HASH>..<HASH> 100644 --- a/ipywidgets/static/widgets/js/manager.js +++ b/ipywidgets/static/widgets/js/manager.js @@ -169,17 +169,17 @@ define([ * @return {Promise<WidgetModel>} */ ManagerBase.prototype.new_widget = function(options) { - var comm; - if (!options.comm) { - comm = Promise.resolve(options.comm); + var commPromise; + if (options.comm) { + commPromise = Promise.resolve(options.comm); } else { - comm = this._create_comm('ipython.widget', options.model_id, + commPromise = this._create_comm('ipython.widget', options.model_id, {'widget_class': options.widget_class}); } var options_clone = _.clone(options); var that = this; - return comm.then(function(comm) { + return commPromise.then(function(comm) { options_clone.comm = comm; return that.new_model(options_clone).then(function(model) { // Requesting the state to populate default values.
fix typo in comm creation conditional
jupyter-widgets_ipywidgets
train
js
9fe78c8bc4d0eaac60d2db126d0fad1a268b72b5
diff --git a/client/client.go b/client/client.go index <HASH>..<HASH> 100644 --- a/client/client.go +++ b/client/client.go @@ -299,13 +299,14 @@ type redirectFollowingHTTPClient struct { } func (r *redirectFollowingHTTPClient) Do(ctx context.Context, act httpAction) (*http.Response, []byte, error) { + next := act for i := 0; i < 100; i++ { if i > 0 { if err := r.checkRedirect(i); err != nil { return nil, nil, err } } - resp, body, err := r.client.Do(ctx, act) + resp, body, err := r.client.Do(ctx, next) if err != nil { return nil, nil, err } @@ -318,7 +319,7 @@ func (r *redirectFollowingHTTPClient) Do(ctx context.Context, act httpAction) (* if err != nil { return nil, nil, fmt.Errorf("Location header not valid URL: %s", hdr) } - act = &redirectedHTTPAction{ + next = &redirectedHTTPAction{ action: act, location: *loc, }
client: don't use nested actions
etcd-io_etcd
train
go
ce76d23dd143729966c791e838f7fcc5b031773c
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -56,7 +56,7 @@ setup( data_files=[( (BASE_DIR, ['data/nssm_original.exe']) )], - install_requires=['indy-plenum-dev==1.6.552', + install_requires=['indy-plenum-dev==1.6.553', 'indy-anoncreds-dev==1.0.32', 'python-dateutil', 'timeout-decorator==0.4.0'],
INDY-<I>: Updated indy-plenum dependency
hyperledger_indy-node
train
py
43428356983801b229a234fa2e4ae268163d5fd3
diff --git a/lib/dragonfly/configurable.rb b/lib/dragonfly/configurable.rb index <HASH>..<HASH> 100644 --- a/lib/dragonfly/configurable.rb +++ b/lib/dragonfly/configurable.rb @@ -49,7 +49,6 @@ module Dragonfly @obj = obj instance_eval(&block) @obj = nil - obj end def configure_with_plugin(obj, plugin, *args, &block) @@ -86,10 +85,12 @@ module Dragonfly class_eval do def configure(&block) self.class.configurer.configure(self, &block) + self end def configure_with(plugin, *args, &block) self.class.configurer.configure_with_plugin(self, plugin, *args, &block) + self end end end
return self from configure and configure_with
markevans_dragonfly
train
rb
85778d3817a4b383cb97a7ca8e5f0b2cc54ffa64
diff --git a/ryu/app/rest_firewall.py b/ryu/app/rest_firewall.py index <HASH>..<HASH> 100644 --- a/ryu/app/rest_firewall.py +++ b/ryu/app/rest_firewall.py @@ -802,7 +802,8 @@ class Firewall(object): vid = match.get(REST_DL_VLAN, VLANID_NONE) rule_id = Firewall._cookie_to_ruleid(cookie) delete_ids.setdefault(vid, '') - delete_ids[vid] += '%d,' % rule_id + delete_ids[vid] += (('%d' if delete_ids[vid] == '' + else ',%d') % rule_id) msg = [] for vid, rule_ids in delete_ids.items():
rest_firewall: remove of an unnecessary comma of json response
osrg_ryu
train
py
655d211dc02e0057b34e8d76df6fbb03a7a34c77
diff --git a/tests/test_slsb.py b/tests/test_slsb.py index <HASH>..<HASH> 100644 --- a/tests/test_slsb.py +++ b/tests/test_slsb.py @@ -57,6 +57,10 @@ class TestSLSB(unittest.TestCase): with open("./examples/lorem_ipsum.txt") as f: message = f.read() secret = slsb.hide("./examples/pictures/Lenna.png", message) + secret.save("./image.png") + + clear_message = slsb.reveal("./image.png") + self.assertEqual(message, clear_message) def test_with_too_long_message(self): with open("./examples/lorem_ipsum.txt") as f:
Bug fix: forgot to write the results in a file.
cedricbonhomme_Stegano
train
py
ffe9b351923aca8b24ce2b25d609f4c68ef96735
diff --git a/Tests/DependencyInjection/NetgenContentBrowserExtensionTest.php b/Tests/DependencyInjection/NetgenContentBrowserExtensionTest.php index <HASH>..<HASH> 100644 --- a/Tests/DependencyInjection/NetgenContentBrowserExtensionTest.php +++ b/Tests/DependencyInjection/NetgenContentBrowserExtensionTest.php @@ -85,6 +85,7 @@ class NetgenContentBrowserExtensionTest extends AbstractExtensionTestCase $this->load(); $this->assertContainerBuilderHasService('netgen_content_browser.controller.api.tree'); + $this->assertContainerBuilderHasService('netgen_content_browser.ezpublish.thumbnail_loader.variation'); $this->assertContainerBuilderHasService('netgen_content_browser.ezpublish.location_builder'); $this->assertContainerBuilderHasService('netgen_content_browser.ezpublish.adapter'); $this->assertContainerBuilderHasService('netgen_content_browser.repository'); @@ -93,5 +94,10 @@ class NetgenContentBrowserExtensionTest extends AbstractExtensionTestCase 'netgen_content_browser.adapter', 'netgen_content_browser.ezpublish.adapter' ); + + $this->assertContainerBuilderHasAlias( + 'netgen_content_browser.ezpublish.thumbnail_loader', + 'netgen_content_browser.ezpublish.thumbnail_loader.variation' + ); } }
Refactor thumbnail loader into separate service
netgen-layouts_content-browser-sylius
train
php
b6a171ca706ff32d5b6f35c8508003562958b4e6
diff --git a/src/Handler/GuzzleV5/GuzzleHandler.php b/src/Handler/GuzzleV5/GuzzleHandler.php index <HASH>..<HASH> 100644 --- a/src/Handler/GuzzleV5/GuzzleHandler.php +++ b/src/Handler/GuzzleV5/GuzzleHandler.php @@ -26,14 +26,15 @@ use Psr\Http\Message\StreamInterface as Psr7StreamInterface; class GuzzleHandler { private static $validOptions = [ - 'proxy' => true, - 'verify' => true, - 'timeout' => true, - 'debug' => true, - 'connect_timeout' => true, - 'stream' => true, - 'delay' => true, - 'sink' => true, + 'proxy' => true, + 'expect' => true, + 'verify' => true, + 'timeout' => true, + 'debug' => true, + 'connect_timeout' => true, + 'stream' => true, + 'delay' => true, + 'sink' => true, ]; /** @var ClientInterface */
Pass Expect http config in GuzzleV5 handler (#<I>)
aws_aws-sdk-php
train
php
c5fb035ee8a645a2d21fc2478f2b15a46ccf4f40
diff --git a/service_configuration_lib/__init__.py b/service_configuration_lib/__init__.py index <HASH>..<HASH> 100644 --- a/service_configuration_lib/__init__.py +++ b/service_configuration_lib/__init__.py @@ -84,11 +84,11 @@ def read_services_configuration(soa_dir=DEFAULT_SOA_DIR): # Not all services have all fields. Who knows what might be in there # You can't depend on every service having a vip, for example all_services = {} - for rootdir, dirs, _ in os.walk(soa_dir): - for service_dirname in dirs: - service_name = service_dirname - service_info = read_service_configuration_from_dir(rootdir, service_dirname) - all_services.update( { service_name: service_info } ) + rootdir = os.path.abspath(soa_dir) + for service_dirname in os.listdir(rootdir): + service_name = service_dirname + service_info = read_service_configuration_from_dir(rootdir, service_dirname) + all_services.update( { service_name: service_info } ) return all_services def services_that_run_here():
cleaning up read_services_configuration a bit
Yelp_service_configuration_lib
train
py
ef3b8215170461f40c003d063167f2942c54b798
diff --git a/src/Creative/InLine/Linear.php b/src/Creative/InLine/Linear.php index <HASH>..<HASH> 100644 --- a/src/Creative/InLine/Linear.php +++ b/src/Creative/InLine/Linear.php @@ -81,6 +81,7 @@ class Linear extends AbstractLinearCreative // object $adParams = new AdParameters($this->adParametersDomElement); + return $adParams->setParams($params); } diff --git a/src/Creative/InLine/Linear/MediaFile.php b/src/Creative/InLine/Linear/MediaFile.php index <HASH>..<HASH> 100644 --- a/src/Creative/InLine/Linear/MediaFile.php +++ b/src/Creative/InLine/Linear/MediaFile.php @@ -79,6 +79,8 @@ class MediaFile } /** + * Please note that this attribute is deprecated since VAST 4.1 along with VPAID + * * @param string $value * @return $this */
Added comment about attribute deprecation in VAST <I>.
sokil_php-vast
train
php,php
b285d892490a2ce246863439ab0b5abccc9bfb1a
diff --git a/src/index.js b/src/index.js index <HASH>..<HASH> 100644 --- a/src/index.js +++ b/src/index.js @@ -394,7 +394,7 @@ module.exports = S => { } catch (err) { return this._reply500(response, `Error while parsing template "${contentType}" for ${funName}`, err, requestId); } - } else if (typeof request.payload === 'object') { + } else if (request.payload && typeof request.payload === 'object') { event = request.payload; }
Handle requests without payload or mapping template
dherault_serverless-offline
train
js
ae1817a769825856ad63abd84fc5804f94aa075b
diff --git a/packages/@vue/cli-service/lib/commands/build/index.js b/packages/@vue/cli-service/lib/commands/build/index.js index <HASH>..<HASH> 100644 --- a/packages/@vue/cli-service/lib/commands/build/index.js +++ b/packages/@vue/cli-service/lib/commands/build/index.js @@ -226,7 +226,7 @@ async function build (args, api, options) { isFreshBuild ) { console.log( - chalk.gray(`Tip: the direcotry is meant to be served by an HTTP server, and will not work if\n` + + chalk.gray(`Tip: the directory is meant to be served by an HTTP server, and will not work if\n` + `you open it directly over file:// protocol. To preview it locally, use an HTTP\n` + `server like the ${chalk.yellow(`serve`)} package on npm.\n`) )
fix: typo (#<I>) Fixes typo in console.log output when the build is the first build (direcotry => directory)
vuejs_vue-cli
train
js
a5978b208e308b89374fc2c97b3cfd09f05b87c4
diff --git a/qunit/qunit.js b/qunit/qunit.js index <HASH>..<HASH> 100644 --- a/qunit/qunit.js +++ b/qunit/qunit.js @@ -544,7 +544,7 @@ extend(QUnit, { var qunit = id( "qunit" ); if ( qunit ) { qunit.innerHTML = - '<h1 id="qunit-header">' + document.title + '</h1>' + + '<h1 id="qunit-header">' + escapeInnerText( document.title ) + '</h1>' + '<h2 id="qunit-banner"></h2>' + '<div id="qunit-testrunner-toolbar"></div>' + '<h2 id="qunit-userAgent"></h2>' +
Escape document.title before inserting into markup. Extends fix for #<I>
JamesMGreene_qunit-assert-html
train
js
b34e33825a845a4648e68cae96d5a885c96c076e
diff --git a/src/main/java/com/cloudbees/jenkins/support/impl/AboutJenkins.java b/src/main/java/com/cloudbees/jenkins/support/impl/AboutJenkins.java index <HASH>..<HASH> 100644 --- a/src/main/java/com/cloudbees/jenkins/support/impl/AboutJenkins.java +++ b/src/main/java/com/cloudbees/jenkins/support/impl/AboutJenkins.java @@ -693,7 +693,7 @@ public class AboutJenkins extends Component { for (PluginWrapper w : plugins) { if (w.isActive()) { - out.println("RUN curl -L $JENKINS_UC/plugins/"+w.getShortName()+"/"+w.getVersion()+"/"+w.getShortName()+".hpi" + out.println("RUN curl -L $JENKINS_UC/download/plugins/"+w.getShortName()+"/"+w.getVersion()+"/"+w.getShortName()+".hpi" + " -o /usr/share/jenkins/ref/plugins/"+w.getShortName()+".jpi"); } }
Fix download url to plugins The url missed the "download" part of the url to access the plugins. The curl command didn't output error but the plugins downloaded were html files containing the <I> message.
jenkinsci_support-core-plugin
train
java
73cf78a99457cacbbabcee83f49b9ed300b8bf17
diff --git a/src/exporters/file.js b/src/exporters/file.js index <HASH>..<HASH> 100644 --- a/src/exporters/file.js +++ b/src/exporters/file.js @@ -3,28 +3,33 @@ const UnixFS = require('ipfs-unixfs') const pull = require('pull-stream') -function extractContent (node) { - return UnixFS.unmarshal(node.data).data -} - // Logic to export a single (possibly chunked) unixfs file. module.exports = (node, name, ds) => { + const file = UnixFS.unmarshal(node.data) let content if (node.links.length === 0) { - const c = extractContent(node) - content = pull.values([c]) + content = pull.values([file.data]) } else { content = pull( pull.values(node.links), pull.map((link) => ds.getStream(link.hash)), pull.flatten(), - pull.map(extractContent) + pull.map((node) => { + try { + const ex = UnixFS.unmarshal(node.data) + return ex.data + } catch (err) { + console.error(node) + throw new Error('Failed to unmarshal node') + } + }) ) } return pull.values([{ content: content, - path: name + path: name, + size: file.fileSize() }]) }
feat(exporter): return file sizes
ipfs_js-ipfs-unixfs
train
js
c88812f8b4705fd20e34d390f9f5abcc2e8741d1
diff --git a/lib/spatial_features/has_spatial_features.rb b/lib/spatial_features/has_spatial_features.rb index <HASH>..<HASH> 100644 --- a/lib/spatial_features/has_spatial_features.rb +++ b/lib/spatial_features/has_spatial_features.rb @@ -5,7 +5,9 @@ module SpatialFeatures scope :with_features, lambda { where(:id => Feature.select(:spatial_model_id).where(:spatial_model_type => name)) } scope :without_features, lambda { where.not(:id => Feature.select(:spatial_model_id).where(:spatial_model_type => name)) } - has_many :spatial_cache, :as => :spatial_model + has_many :spatial_cache, :as => :spatial_model, :dependent => :delete_all + has_many :model_a_spatial_proximities, :as => :model_a, :class_name => 'SpatialProximity', :dependent => :delete_all + has_many :model_b_spatial_proximities, :as => :model_b, :class_name => 'SpatialProximity', :dependent => :delete_all extend SpatialFeatures::ClassMethods include SpatialFeatures::InstanceMethods
Destroy cache when model is destroyed.
culturecode_spatial_features
train
rb
8c185f0f89e13747280e669d06ac9e6d55e8879f
diff --git a/app/src/Bolt/YamlUpdater.php b/app/src/Bolt/YamlUpdater.php index <HASH>..<HASH> 100644 --- a/app/src/Bolt/YamlUpdater.php +++ b/app/src/Bolt/YamlUpdater.php @@ -62,7 +62,7 @@ class YamlUpdater /** * Get a value from the yml. return an array with info * - * @param string $key + * @param string $key * @return bool|array */ public function get($key) @@ -86,8 +86,8 @@ class YamlUpdater /** * Find a specific part of the key, starting from $this->pointer * - * @param $keypart - * @param int $indent + * @param string $keypart + * @param int $indent * @return bool|int */ private function find($keypart, $indent = 0) @@ -171,7 +171,6 @@ class YamlUpdater return $value; } - /** * Verify if the modified yaml is still a valid .yml file, and if we * are actually allowed to write and update the current file. @@ -183,7 +182,7 @@ class YamlUpdater /** * Save our modified .yml file. - * @param bool $makebackup + * @param bool $makebackup * @return bool true if save was successful */ public function save($makebackup = true)
PSR-2 clean up of YamlUpdater.php
bolt_bolt
train
php
20ac0a677b1096ed13ee9be6ebe24f12a6bee254
diff --git a/bindings/py/nupic/bindings/regions/PyRegion.py b/bindings/py/nupic/bindings/regions/PyRegion.py index <HASH>..<HASH> 100644 --- a/bindings/py/nupic/bindings/regions/PyRegion.py +++ b/bindings/py/nupic/bindings/regions/PyRegion.py @@ -292,6 +292,27 @@ class PyRegion(object): def write(self, proto): + """Calls writeToProto on subclass after converting proto to specific type + using getProtoType(). + + proto: PyRegionProto capnproto object + """ + regionImpl = proto.regionImpl.as_struct(self.getProtoType()) + self.writeToProto(regionImpl) + + + @classmethod + def read(cls, proto): + """Calls readFromProto on subclass after converting proto to specific type + using getProtoType(). + + proto: PyRegionProto capnproto object + """ + regionImpl = proto.regionImpl.as_struct(cls.getProtoType()) + return cls.readFromProto(regionImpl) + + + def writeToProto(self, proto): """Write state to proto object. The type of proto is determined by getProtoType(). @@ -300,7 +321,7 @@ class PyRegion(object): @classmethod - def read(cls, proto): + def readFromProto(cls, proto): """Read state from proto object. The type of proto is determined by getProtoType().
Refactor PyRegion subclasses to take specific proto object in read
numenta_nupic.core
train
py
a2d45e8f6c4ad788a62eedf23e5ecc6b32a9324c
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -111,7 +111,6 @@ setup( "matplotlib", "gammapy>=0.18", "healpy", - "astropy-healpix", - "fermitools" + "astropy-healpix" ], )
fermitools not in pip
fermiPy_fermipy
train
py
1daba6ff22804633db006272359f514583e2eac6
diff --git a/config/config.go b/config/config.go index <HASH>..<HASH> 100644 --- a/config/config.go +++ b/config/config.go @@ -6,6 +6,7 @@ import ( steno "github.com/cloudfoundry/gosteno" "io/ioutil" + "runtime" "strconv" "time" ) @@ -90,7 +91,7 @@ var defaultConfig = Config{ Port: 8081, Index: 0, - GoMaxProcs: 8, + GoMaxProcs: -1, EndpointTimeoutInSeconds: 60, @@ -112,6 +113,10 @@ func DefaultConfig() *Config { func (c *Config) Process() { var err error + if c.GoMaxProcs == -1 { + c.GoMaxProcs = runtime.NumCPU() + } + c.PruneStaleDropletsInterval = time.Duration(c.PruneStaleDropletsIntervalInSeconds) * time.Second c.DropletStaleThreshold = time.Duration(c.DropletStaleThresholdInSeconds) * time.Second c.PublishActiveAppsInterval = time.Duration(c.PublishActiveAppsIntervalInSeconds) * time.Second
Default GOMAXPROCS to the number of available CPUs [#<I>]
cloudfoundry_gorouter
train
go
852453a91e77d22b4e4a6f436e81758f21991dca
diff --git a/bika/lims/browser/dashboard.py b/bika/lims/browser/dashboard.py index <HASH>..<HASH> 100644 --- a/bika/lims/browser/dashboard.py +++ b/bika/lims/browser/dashboard.py @@ -110,9 +110,9 @@ class DashboardView(BrowserView): 'title': <section_title>, 'panels': <array of panels>} """ - sections = [self.get_analysisrequests_section(), - self.get_worksheets_section(), - self.get_analyses_section()] + sections = [self.get_analyses_section(), + self.get_analysisrequests_section(), + self.get_worksheets_section()] return sections def get_analysisrequests_section(self):
Panels in dashboard. Display Analyses before Analysis Requests
senaite_senaite.core
train
py
5f4d378222479948863d1db90b1b09d321d366fd
diff --git a/.travis.yml b/.travis.yml index <HASH>..<HASH> 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,7 +2,7 @@ language: python cache: pip sudo: false env: -- APISPEC_VERSION="==1.0.0b5" +- APISPEC_VERSION="==1.0.0rc1" - APISPEC_VERSION="" - MARSHMALLOW_VERSION="==2.13.0" - MARSHMALLOW_VERSION="" diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100755 --- a/setup.py +++ b/setup.py @@ -9,7 +9,7 @@ REQUIRES = [ 'flask>=0.10.1', 'marshmallow>=2.0.0', 'webargs>=0.18.0', - 'apispec==1.0.0b5', + 'apispec==1.0.0rc1', ] def find_version(fname): diff --git a/tests/test_openapi.py b/tests/test_openapi.py index <HASH>..<HASH> 100644 --- a/tests/test_openapi.py +++ b/tests/test_openapi.py @@ -13,7 +13,7 @@ from flask_apispec.apidoc import ViewConverter, ResourceConverter @pytest.fixture() def marshmallow_plugin(): - return MarshmallowPlugin() + return MarshmallowPlugin(schema_name_resolver=lambda x: None) @pytest.fixture def spec(marshmallow_plugin):
Compatibility with openapi <I>rc1
jmcarp_flask-apispec
train
yml,py,py
bf14bacac3f1cae15ce7b32b5341122c305e630e
diff --git a/api/client/commands.go b/api/client/commands.go index <HASH>..<HASH> 100644 --- a/api/client/commands.go +++ b/api/client/commands.go @@ -1161,7 +1161,7 @@ func (cli *DockerCli) CmdImport(args ...string) error { v.Set("repo", repository) if cmd.NArg() == 3 { - fmt.Fprintf(cli.err, "[DEPRECATED] The format 'URL|- [REPOSITORY [TAG]]' as been deprecated. Please use URL|- [REPOSITORY[:TAG]]\n") + fmt.Fprintf(cli.err, "[DEPRECATED] The format 'URL|- [REPOSITORY [TAG]]' has been deprecated. Please use URL|- [REPOSITORY[:TAG]]\n") v.Set("tag", cmd.Arg(2)) }
Fix typo in deprecation message. Because the doc maintainers don't like Cockney.
moby_moby
train
go
91bc60f72071a3ce0eaf23a77c1ee82e1b927120
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ setup( author='Philipp Adelt', author_email='autosort-github@philipp.adelt.net ', url='https://github.com/padelt/temper-python', - version='1.2.3', + version='1.2.4', description='Reads temperature from TEMPerV1 devices (USB 0c45:7401)', long_description=open('README.md').read(), packages=['temperusb'],
Bump PyPI version to <I>
padelt_temper-python
train
py
1c18268f0da7bbf9b24d23179aa58c109f941b76
diff --git a/python/dllib/src/bigdl/dllib/keras/utils.py b/python/dllib/src/bigdl/dllib/keras/utils.py index <HASH>..<HASH> 100644 --- a/python/dllib/src/bigdl/dllib/keras/utils.py +++ b/python/dllib/src/bigdl/dllib/keras/utils.py @@ -74,7 +74,7 @@ def to_bigdl_metric(metric): elif metric == "mae": return MAE() elif metric == "auc": - return AUC(1000) + return AUC() elif metric == "loss": return Loss() elif metric == "treennaccuracy":
Update default value of AUC to <I> (#<I>) * update * typo
intel-analytics_BigDL
train
py
ef0f5eb25f5f6e2333bd236116a151a0f7fbe552
diff --git a/src/server/server.go b/src/server/server.go index <HASH>..<HASH> 100644 --- a/src/server/server.go +++ b/src/server/server.go @@ -144,9 +144,11 @@ func (self *Server) ListenAndServe() error { port := udpInput.Port database := udpInput.Database - if port <= 0 || database == "" { - log.Warn("Cannot start udp server. please check your configuration") + if port <= 0 { + log.Warn("Cannot start udp server on port %d. please check your configuration", port) continue + } else if database == "" { + log.Warn("Cannot start udp server for database=\"\". please check your configuration") } log.Info("Starting UDP Listener on port %d to database %s", port, database)
Make start udp server log message more detailed. Originally it logged the same message when either the port or database config settings were wrong. Now it logs which setting was wrong.
influxdata_influxdb
train
go
d1d6abb38876e620585744294f5fda81da0ba42e
diff --git a/lib/migrate.js b/lib/migrate.js index <HASH>..<HASH> 100644 --- a/lib/migrate.js +++ b/lib/migrate.js @@ -5,7 +5,7 @@ var loader = require('./loader') var level1props = ['amd', 'bail', 'cache', 'context', 'dependencies', 'devServer', 'devtool', 'entry', 'externals', 'loader', 'module', 'name', - 'node', 'output', 'plugins', 'profile', 'recordsInputPath', + 'node', 'output', 'performance', 'plugins', 'profile', 'recordsInputPath', 'recordsOutputPath', 'recordsPath', 'resolve', 'resolveLoader', 'stats', 'target', 'watch', 'watchOptions']
compatible webpack beta <I>
QingWei-Li_2webpack2
train
js
57e1caf5626e1afa0f309bb29daf9f877f8d44d8
diff --git a/lib/grabber.js b/lib/grabber.js index <HASH>..<HASH> 100644 --- a/lib/grabber.js +++ b/lib/grabber.js @@ -29,6 +29,8 @@ Grabber.prototype.download = function(remoteImagePath, callback) { tmp.file({dir: this.tmp_dir, postfix: "." + extension}, function(err, localImagePath, fd) { + tmp.closeSync(fd); // close immediately, we do not use this file handle. + console.log('downloading', remoteImagePath, 'from s3 to local file', localImagePath); if (err) { diff --git a/lib/thumbnailer.js b/lib/thumbnailer.js index <HASH>..<HASH> 100644 --- a/lib/thumbnailer.js +++ b/lib/thumbnailer.js @@ -44,6 +44,7 @@ Thumbnailer.prototype.createConversionPath = function(callback) { var _this = this; tmp.file({dir: this.tmp_dir, postfix: ".jpg"}, function(err, convertedPath, fd) { + fs.closeSync(fd); // close immediately, we do not use this file handle. _this.convertedPath = convertedPath; callback(err); });
Fixing leaking file descriptors.
bcoe_thumbd
train
js,js
9ed47ba1b11f62763bff25d9bc005a17b4a0212e
diff --git a/art/test.py b/art/test.py index <HASH>..<HASH> 100644 --- a/art/test.py +++ b/art/test.py @@ -1003,6 +1003,7 @@ art.art.artError: number should have int type >>> aprint("love_you",number=1,text="") »-(¯`·.·´¯)-><-(¯`·.·´¯)-« >>> cov.stop() +>>> cov.report() >>> cov.save() '''
fix : report added to test file
sepandhaghighi_art
train
py
2f11c446b729ae58a54a0d4719ccd101377054e4
diff --git a/libraries/botframework-connector/microsoft/botframework/connector/auth/jwt_token_validation.py b/libraries/botframework-connector/microsoft/botframework/connector/auth/jwt_token_validation.py index <HASH>..<HASH> 100644 --- a/libraries/botframework-connector/microsoft/botframework/connector/auth/jwt_token_validation.py +++ b/libraries/botframework-connector/microsoft/botframework/connector/auth/jwt_token_validation.py @@ -7,7 +7,9 @@ from .channel_validation import ChannelValidation from .microsoft_app_credentials import MicrosoftAppCredentials class JwtTokenValidation: - async def assertValidActivity(self, activity, authHeader, credentials): + + @staticmethod + async def assertValidActivity(activity, authHeader, credentials): """Validates the security tokens required by the Bot Framework Protocol. Throws on any exceptions. activity: The incoming Activity from the Bot Framework or the Emulator authHeader:The Bearer token included as part of the request
Converted assertValidActivity method to static method
Microsoft_botbuilder-python
train
py
eeede0844e033aaccd611d6a7d564ec75e5d5398
diff --git a/bundles/EzPublishBlockManagerBundle/DependencyInjection/NetgenEzPublishBlockManagerExtension.php b/bundles/EzPublishBlockManagerBundle/DependencyInjection/NetgenEzPublishBlockManagerExtension.php index <HASH>..<HASH> 100644 --- a/bundles/EzPublishBlockManagerBundle/DependencyInjection/NetgenEzPublishBlockManagerExtension.php +++ b/bundles/EzPublishBlockManagerBundle/DependencyInjection/NetgenEzPublishBlockManagerExtension.php @@ -119,8 +119,6 @@ class NetgenEzPublishBlockManagerExtension extends Extension } } - unset($config['system']); - return $config; }; }
Do not remove system key from processed semantic config, we are just not going to use it
netgen-layouts_layouts-ezplatform
train
php
3c236b0a2ddd07f4c846286dff3f601376fb09d7
diff --git a/test/test_environment.py b/test/test_environment.py index <HASH>..<HASH> 100644 --- a/test/test_environment.py +++ b/test/test_environment.py @@ -114,8 +114,11 @@ class TestEnvironment(object): db_user, db_password, host, port) # TODO: use PyMongo's add_user once that's fixed. - self.sync_cx.admin.command( - 'createUser', db_user, pwd=db_password, roles=['root']) + try: + self.sync_cx.admin.command( + 'createUser', db_user, pwd=db_password, roles=['root']) + except pymongo.errors.OperationFailure: + print("Couldn't create root user, prior test didn't clean up?") self.sync_cx.admin.authenticate(db_user, db_password)
Let tests proceed with auth even if previous run didn't clean up.
mongodb_motor
train
py
ce9a4203610700e1302df47162f25c7ddedec325
diff --git a/salt/returners/mysql.py b/salt/returners/mysql.py index <HASH>..<HASH> 100644 --- a/salt/returners/mysql.py +++ b/salt/returners/mysql.py @@ -70,6 +70,7 @@ Use the following mysql database schema:: DROP TABLE IF EXISTS `salt_events`; CREATE TABLE `salt_events` ( + `id` BIGINT NOT NULL AUTO_INCREMENT, `tag` varchar(255) NOT NULL, `data` varchar(1024) NOT NULL, `alter_time` TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
Let's create an id field and make it large
saltstack_salt
train
py
ab7ee8fa1d03071f20e4d23b99af6046a736d97c
diff --git a/contentbank/contenttype/h5p/classes/content.php b/contentbank/contenttype/h5p/classes/content.php index <HASH>..<HASH> 100644 --- a/contentbank/contenttype/h5p/classes/content.php +++ b/contentbank/contenttype/h5p/classes/content.php @@ -42,6 +42,12 @@ class content extends \core_contentbank\content { public function is_view_allowed(): bool { // Force H5P content to be deployed. $fileurl = $this->get_file_url(); + if (empty($fileurl)) { + // This should never happen because H5P contents should have always a file. However, this extra-checked has been added + // to avoid the contentbank stop working if, for any unkonwn/weird reason, the file doesn't exist. + return false; + } + // Skip capability check when creating the H5P content (because it has been created by trusted users). $h5pplayer = new \core_h5p\player($fileurl, new \stdClass(), true, '', true); // Flush error messages.
MDL-<I> contenttype_h5p: Improve error handling In MoodleCloud it was raised that, in some cases, loading the content bank, from a course page, gives an "Invalid H5P content URL", not offering any way to delete the offending content or create new one. An extra-check has been added to the "is_view_allowed" method to guarantee the H5P API is called only if the H5P content has a file.
moodle_moodle
train
php
22298cbf64c9fe2a694b450eb8a482551534cd9e
diff --git a/app/public/js/nodes.js b/app/public/js/nodes.js index <HASH>..<HASH> 100644 --- a/app/public/js/nodes.js +++ b/app/public/js/nodes.js @@ -35,7 +35,6 @@ ready( () => { } } - function build_line(top, file, key, value, overriden) { if (overriden === true) { rowclass = "row overriden"; diff --git a/app/web.rb b/app/web.rb index <HASH>..<HASH> 100644 --- a/app/web.rb +++ b/app/web.rb @@ -29,6 +29,24 @@ module HieravizApp end case settings.configdata['auth_method'] + when 'dummy' + + get '/logout' do + erb :logout, layout: :_layout + end + + helpers do + def get_username + 'Dummy' + end + def get_userinfo + { 'username' => 'Dummy' } + end + def check_authorization + true + end + end + when 'http' use Rack::Auth::Basic, "Puppet Private Access" do |username, password|
add dummy auth for development offline
Gandi_hieraviz
train
js,rb
6b86419edacdc49c2cbb53812ef6a1c276760912
diff --git a/lib/procodile/instance.rb b/lib/procodile/instance.rb index <HASH>..<HASH> 100644 --- a/lib/procodile/instance.rb +++ b/lib/procodile/instance.rb @@ -1,3 +1,4 @@ +require 'fileutils' require 'procodile/logger' require 'procodile/rbenv' @@ -135,6 +136,7 @@ module Procodile end if self.process.log_path && @supervisor.run_options[:force_single_log] != true + FileUtils.mkdir_p(File.dirname(self.process.log_path)) log_destination = File.open(self.process.log_path, 'a') io = nil else
fix: create the log directory if it doesn't exist
adamcooke_procodile
train
rb
85109b1454d812bd1f302bee0ea35be85ebdd3ea
diff --git a/visidata/errors.py b/visidata/errors.py index <HASH>..<HASH> 100644 --- a/visidata/errors.py +++ b/visidata/errors.py @@ -4,9 +4,6 @@ from visidata import vd, VisiData, options __all__ = ['stacktrace', 'ExpectedException'] -import warnings -warnings.simplefilter('error') - class ExpectedException(Exception): 'an expected exception' pass diff --git a/visidata/main.py b/visidata/main.py index <HASH>..<HASH> 100755 --- a/visidata/main.py +++ b/visidata/main.py @@ -10,6 +10,7 @@ import os import io import sys import locale +import warnings from visidata import vd, option, options, status, run, BaseSheet, AttrDict from visidata import Path, openSource, saveSheets, domotd @@ -76,6 +77,7 @@ optalias('c', 'config') def main_vd(): 'Open the given sources using the VisiData interface.' locale.setlocale(locale.LC_ALL, '') + warnings.showwarning = vd.warning flPipedInput = not sys.stdin.isatty() flPipedOutput = not sys.stdout.isatty()
[warnings] instead of filtering, output warnings to status
saulpw_visidata
train
py,py
049ff3b8b386b30cdef8c21fb436d884d1a11730
diff --git a/lib/git-process/github_service.rb b/lib/git-process/github_service.rb index <HASH>..<HASH> 100644 --- a/lib/git-process/github_service.rb +++ b/lib/git-process/github_service.rb @@ -122,7 +122,7 @@ module GitHubService def create_authorization - logger.info("Authorizing this to work with your repos.") + logger.info("Authorizing #{user} to work with #{site}.") auth = pw_client.create_authorization(:scopes => ['repo', 'user', 'gist'], :note => 'Git-Process', :note_url => 'http://jdigger.github.com/git-process')
Improved GH auth logging.
jdigger_git-process
train
rb
62fd118611741ed1e3f2a11f9d9cc7f11fb52cf8
diff --git a/actstream/tests.py b/actstream/tests.py index <HASH>..<HASH> 100644 --- a/actstream/tests.py +++ b/actstream/tests.py @@ -163,10 +163,15 @@ class ActivityTestCase(ActivityBaseTestCase): self.assertEquals(f1, f2, "Should have received the same Follow " "object that I first submitted") - def test_zzzz_no_orphaned_actions(self): + def test_y_no_orphaned_follows(self): + follows = Follow.objects.count() + self.user2.delete() + self.assertEqual(follows - 1, Follow.objects.count()) + + def test_z_no_orphaned_actions(self): actions = self.user1.actor_actions.count() self.user2.delete() - self.assertEqual(actions, self.user1.actor_actions.count() + 1) + self.assertEqual(actions - 1, self.user1.actor_actions.count()) def test_generic_relation_accessors(self): self.assertEqual(self.user2.actor_actions.count(), 2)
make maths more readable, added test for orphaned follows
justquick_django-activity-stream
train
py
ff33d3aa1ff065cd09a89714819fb2704f32d693
diff --git a/src/Controller/ConfigurableBase.php b/src/Controller/ConfigurableBase.php index <HASH>..<HASH> 100644 --- a/src/Controller/ConfigurableBase.php +++ b/src/Controller/ConfigurableBase.php @@ -152,8 +152,9 @@ abstract class ConfigurableBase extends Base $callbackResolver = $this->callbackResolver; return function (Request $request) use ($callback, $callbackResolver) { if (!substr($callback, 0, 2) === '::') { - return $callback; + return $callbackResolver->resolveCallback($callback); } + $controller = $callbackResolver->resolveCallback($request->attributes->get('_controller')); if (is_array($controller)) { list($cls, $_) = $controller; @@ -163,6 +164,7 @@ abstract class ConfigurableBase extends Base return null; } $callback = array($cls, substr($callback, 2)); + $callback = $callbackResolver->resolveCallback($callback); return $callback; }; }
Resolving callbacks for good measure
bolt_bolt
train
php
0a6a0a492da9fb341f5c94535652ba288375a6e6
diff --git a/test/unit/core/core.transformations/transformations.serialize.js b/test/unit/core/core.transformations/transformations.serialize.js index <HASH>..<HASH> 100644 --- a/test/unit/core/core.transformations/transformations.serialize.js +++ b/test/unit/core/core.transformations/transformations.serialize.js @@ -42,10 +42,11 @@ describe('Core Transformations', function() { */ before(function() { - var collections = {}, + var collections = [], waterline = new Waterline(); - collections.customer = Waterline.Collection.extend({ + collections.push(Waterline.Collection.extend({ + identity: 'customer', tableName: 'customer', attributes: { uuid: { @@ -53,16 +54,17 @@ describe('Core Transformations', function() { primaryKey: true } } - }); + })); - collections.foo = Waterline.Collection.extend({ + collections.push(Waterline.Collection.extend({ + identity: 'foo', tableName: 'foo', attributes: { customer: { model: 'customer' } } - }); + })); var schema = new Schema(collections); transformer = new Transformer(schema.foo.attributes, schema.schema);
fix test to accept collections as an array
balderdashy_waterline
train
js
317b34679542e6e7bf855677580350c0275e31c0
diff --git a/clonevirtualenv.py b/clonevirtualenv.py index <HASH>..<HASH> 100644 --- a/clonevirtualenv.py +++ b/clonevirtualenv.py @@ -6,7 +6,7 @@ import shutil import subprocess import sys -version_info = (0, 1, 2) +version_info = (0, 2, 2) __version__ = '.'.join(map(str, version_info))
forgot to update version info in module.
edwardgeorge_virtualenv-clone
train
py
c0910f2bc553d45debf50c2438c77f009f547a9e
diff --git a/lib/jekyll/drops/drop.rb b/lib/jekyll/drops/drop.rb index <HASH>..<HASH> 100644 --- a/lib/jekyll/drops/drop.rb +++ b/lib/jekyll/drops/drop.rb @@ -3,7 +3,7 @@ module Jekyll module Drops class Drop < Liquid::Drop - NON_CONTENT_METHODS = [:[], :[]=, :inspect, :to_h, :fallback_data, :to_s].freeze + NON_CONTENT_METHODS = [:fallback_data].freeze # Get or set whether the drop class is mutable. # Mutability determines whether or not pre-defined fields may be @@ -86,7 +86,7 @@ module Jekyll # Returns an Array of strings which represent method-specific keys. def content_methods @content_methods ||= ( - self.class.instance_methods(false) - NON_CONTENT_METHODS + self.class.instance_methods - Jekyll::Drops::Drop.instance_methods - NON_CONTENT_METHODS ).map(&:to_s).reject do |method| method.end_with?("=") end
look up the content methods for drops in a smarter way
jekyll_jekyll
train
rb
ee73a73ec4b2773a11f31f52ea384cdee861a8aa
diff --git a/rope/contrib/findit.py b/rope/contrib/findit.py index <HASH>..<HASH> 100644 --- a/rope/contrib/findit.py +++ b/rope/contrib/findit.py @@ -71,8 +71,8 @@ def find_definition(project, code, offset, resource=None): A `Location` object is returned if the definition location can be determined, otherwise ``None`` is returned. """ - pymodule = project.pycore.get_string_module(code, resource) - pyname = rope.base.evaluate.eval_location(pymodule, offset) + main_module = project.pycore.get_string_module(code, resource) + pyname = rope.base.evaluate.eval_location(main_module, offset) if pyname is not None: module, lineno = pyname.get_definition_location() name = rope.base.worder.Worder(code).get_word_at(offset)
findit: choosing a better name for pymodule in find_definition()
python-rope_rope
train
py
7ad0562722ae6b48697f22da5d1fa19f838e595a
diff --git a/lib/jss.rb b/lib/jss.rb index <HASH>..<HASH> 100644 --- a/lib/jss.rb +++ b/lib/jss.rb @@ -67,7 +67,7 @@ module JSS ### The minimum JSS version that works with this gem, as returned by the API ### in the deprecated 'jssuser' resource - MINIMUM_SERVER_VERSION = '9.4'.freeze + MINIMUM_SERVER_VERSION = '10.2.1'.freeze ### The current local UTC offset as a fraction of a day (Time.now.utc_offset is the offset in seconds, ### 60*60*24 is the seconds in a day) @@ -118,7 +118,6 @@ module JSS class APIObject; end class APIConnection; end - class Client; end class DBConnection; end class Server; end class Icon; end @@ -191,6 +190,9 @@ module JSS module MDM; end module ManagementHistory; end + ### Class-like modules + module Client; end + end # module JSS ### Load the rest of the module
min server is now <I>, might become <I> soon
PixarAnimationStudios_ruby-jss
train
rb
f1ec0a23f30ba270f82e61416316ec7239267e86
diff --git a/src/Module.php b/src/Module.php index <HASH>..<HASH> 100644 --- a/src/Module.php +++ b/src/Module.php @@ -2,6 +2,8 @@ namespace luya; +use luya\components\UrlRule; + class Module extends \luya\base\Module { /** @@ -19,6 +21,6 @@ class Module extends \luya\base\Module * @var array */ public $urlRules = [ - ['class' => 'luya\components\UrlRule'], + ['class' => 'luya\components\UrlRule', 'position' => UrlRule::POSITION_LUYA], ]; }
added url rule position for luya module as luya position.
luyadev_luya
train
php
1f9a5e34769d890000fd4cec4920551e4097ec9e
diff --git a/src/Services/KeylistsService.php b/src/Services/KeylistsService.php index <HASH>..<HASH> 100644 --- a/src/Services/KeylistsService.php +++ b/src/Services/KeylistsService.php @@ -36,6 +36,9 @@ class KeylistsService public function getKeyValue($keyType, $keyValue) { $list = Keyvalue::getKeyvaluesByKeyType($keyType); - return $list[$keyValue]; + if (isset($list[$keyValue])) { + return $list[$keyValue]; + } + return null; } }
Return null rather than throw error on value not found
delatbabel_keylists
train
php
db6deeb891cdd7987a6f63b4aa4930aaf5e66e71
diff --git a/src/interaction/InteractionManager.js b/src/interaction/InteractionManager.js index <HASH>..<HASH> 100644 --- a/src/interaction/InteractionManager.js +++ b/src/interaction/InteractionManager.js @@ -222,7 +222,7 @@ InteractionManager.prototype.addEvents = function () this.interactionDOMElement.style['-ms-touch-action'] = 'none'; } - this.interactionDOMElement.addEventListener('mousemove', this.onMouseMove, true); + window.document.addEventListener('mousemove', this.onMouseMove, true); this.interactionDOMElement.addEventListener('mousedown', this.onMouseDown, true); this.interactionDOMElement.addEventListener('mouseout', this.onMouseOut, true); @@ -252,7 +252,7 @@ InteractionManager.prototype.removeEvents = function () this.interactionDOMElement.style['-ms-touch-action'] = ''; } - this.interactionDOMElement.removeEventListener('mousemove', this.onMouseMove, true); + window.document.removeEventListener('mousemove', this.onMouseMove, true); this.interactionDOMElement.removeEventListener('mousedown', this.onMouseDown, true); this.interactionDOMElement.removeEventListener('mouseout', this.onMouseOut, true);
moved mouse move event to the document this means mouse move gets called all the time even if the user is not over the renderer. fixes #<I>
pixijs_pixi.js
train
js
98057d482a3520b03ad6f7e929393edcbc10f86d
diff --git a/lib/app/helper_model/criteria.js b/lib/app/helper_model/criteria.js index <HASH>..<HASH> 100644 --- a/lib/app/helper_model/criteria.js +++ b/lib/app/helper_model/criteria.js @@ -673,8 +673,10 @@ Criteria.setMethod(function select(field) { } } else { - if (typeof field == 'object' && field instanceof Classes.Alchemy.Criteria.FieldConfig) { - field = field.name; + if (typeof field == 'object') { + if (field instanceof Classes.Alchemy.Criteria.FieldConfig || field.name) { + field = field.name; + } } if (this._select) {
Add small workaround for Criteria select issue
skerit_alchemy
train
js
ac236da0489a3070713f8326e1d792c30e34377c
diff --git a/src/com/esotericsoftware/kryo/serializers/DefaultSerializers.java b/src/com/esotericsoftware/kryo/serializers/DefaultSerializers.java index <HASH>..<HASH> 100644 --- a/src/com/esotericsoftware/kryo/serializers/DefaultSerializers.java +++ b/src/com/esotericsoftware/kryo/serializers/DefaultSerializers.java @@ -291,7 +291,7 @@ public class DefaultSerializers { } public void write (Kryo kryo, Output output, StringBuffer object) { - output.writeString(object == null ? null : object.toString()); + output.writeString(object); } public StringBuffer read (Kryo kryo, Input input, Class<StringBuffer> type) { @@ -312,13 +312,11 @@ public class DefaultSerializers { } public void write (Kryo kryo, Output output, StringBuilder object) { - output.writeString(object == null ? null : object.toString()); + output.writeString(object); } public StringBuilder read (Kryo kryo, Input input, Class<StringBuilder> type) { - String value = input.readString(); - if (value == null) return null; - return new StringBuilder(value); + return input.readStringBuilder(); } public StringBuilder copy (Kryo kryo, StringBuilder original) {
Updated StringBuilderSerializer and StringBufferSerializer.
EsotericSoftware_kryo
train
java
82cb0554ae19cbb32d29471d8caaff2b12a3dda5
diff --git a/src/Yggdrasil/Core/Routing/Router.php b/src/Yggdrasil/Core/Routing/Router.php index <HASH>..<HASH> 100644 --- a/src/Yggdrasil/Core/Routing/Router.php +++ b/src/Yggdrasil/Core/Routing/Router.php @@ -157,13 +157,27 @@ final class Router continue; } + $httpMethods = ['Get', 'Post', 'Put', 'Delete']; + $isApiAction = false; + + foreach ($httpMethods as $method) { + if (strstr($action, $method)) { + $isApiAction = true; + } + } + $actionAlias = str_replace( - ['Get', 'Post', 'Put', 'Delete', 'Action'], + array_merge($httpMethods, ['Action']), '', $action->getName() ); $alias = $controllerAlias . ':' . $actionAlias; + + if ($isApiAction) { + $alias = 'API:' . $alias; + } + $queryMap[$alias] = $this->getQuery($alias); } }
[Router] Add REST support for getQueryMap
Assasz_yggdrasil
train
php
0a8be46679ea71450c28044aa5e132c7d4e410bf
diff --git a/lib/repository.js b/lib/repository.js index <HASH>..<HASH> 100644 --- a/lib/repository.js +++ b/lib/repository.js @@ -484,14 +484,14 @@ Repository.prototype.createCommitOnHead = function( message, callback){ var repo = this; + var index; - return repo.openIndex().then(function(index) { - index.read(true); - - filesToAdd.forEach(function(filePath) { - index.addByPath(filePath); - }); - + return repo.openIndex().then(function(index_) { + index = index_; + index.read(1); + return index.addAll(); + }) + .then(function() { index.write(); return index.writeTree(); @@ -643,8 +643,8 @@ Repository.prototype.fetchAll = function( /** * Merge a branch onto another branch * - * @param {String|Ref} from * @param {String|Ref} to + * @param {String|Ref} from * @return {Oid|Index} A commit id for a succesful merge or an index for a * merge with conflicts */ @@ -807,8 +807,8 @@ Repository.prototype.checkoutBranch = function(branch, opts) { var name = ref.name(); - return repo.setHead(name, - repo.defaultSignature(), + return repo.setHead(name, + repo.defaultSignature(), "Switch HEAD to " + name); }) .then(function() {
Fix `createCommitOnHead` The convenience method `createCommitOnHead` was adding files being ignored via `.gitignore` which is really bad. Now it's changed to use the `Index.prototype.addAll` method since it's available now and it wasn't when that method was written.
nodegit_nodegit
train
js
5108bf415f4f9d7cc3888505b572f8cdcc1044bb
diff --git a/repository/lib.php b/repository/lib.php index <HASH>..<HASH> 100644 --- a/repository/lib.php +++ b/repository/lib.php @@ -199,15 +199,15 @@ abstract class repository { $params = (array)$params; require_once($CFG->dirroot . '/repository/'. $type . '/repository.class.php'); $classname = 'repository_' . $type; - if (self::has_admin_config()) { - $configs = self::get_option_names(); + $record = new stdclass; + if (call_user_func($classname . '::has_admin_config')) { + $configs = call_user_func($classname . '::get_option_names'); $options = array(); foreach ($configs as $config) { $options[$config] = $params[$config]; } - $record->data1 = serialize($options); + $record->data1 = serialize($options); } - $record = new stdclass; $record->repositoryname = $params['name']; $record->repositorytype = $type; $record->timecreated = time();
MDL-<I>, self::static_func doesn't work well on php <I>, change to another way to do this
moodle_moodle
train
php
11f4c99757d8d72f767027d267683b35c6d5e44f
diff --git a/pmag.py b/pmag.py index <HASH>..<HASH> 100755 --- a/pmag.py +++ b/pmag.py @@ -8452,6 +8452,8 @@ def read_criteria_from_file(path,acceptance_criteria): acceptance_criteria[crit]['value']=rec[crit] acceptance_criteria[crit]['threshold_type']="inherited" acceptance_criteria[crit]['decimal_points']=-999 + # LJ add: + acceptance_criteria[crit]['category'] = None # bollean flag elif acceptance_criteria[crit]['threshold_type']=='bool':
(temporary?) fix for measurement_step_max key error in thellier_gui auto interpreter with older data sets
PmagPy_PmagPy
train
py
803da228506b10d94b28c971d32eb5b133d04570
diff --git a/examples/dev-kits/main.js b/examples/dev-kits/main.js index <HASH>..<HASH> 100644 --- a/examples/dev-kits/main.js +++ b/examples/dev-kits/main.js @@ -4,9 +4,9 @@ module.exports = { ember: { id: 'ember', title: 'Ember', - url: 'https://deploy-preview-9210--storybookjs.netlify.com/ember-cli', + url: 'https://deploy-preview-9210--storybookjs.netlify.app/ember-cli', }, - cra: 'https://deploy-preview-9210--storybookjs.netlify.com/cra-ts-kitchen-sink', + cra: 'https://deploy-preview-9210--storybookjs.netlify.app/cra-ts-kitchen-sink', }, webpack: async (config) => ({ ...config,
FIX refs examples by using the correct domain from netlify
storybooks_storybook
train
js
34bdaccaa132bddd798b6ee36718da20a0fe3103
diff --git a/test/fixtures/active_record.rb b/test/fixtures/active_record.rb index <HASH>..<HASH> 100644 --- a/test/fixtures/active_record.rb +++ b/test/fixtures/active_record.rb @@ -963,9 +963,9 @@ class PostResource < JSONAPI::Resource end def self.sortable_fields(context) - super(context) - [:id] + super(context) - [:id] + [:"author.name"] end - + def self.verify_key(key, context = nil) super(key) raise JSONAPI::Exceptions::RecordNotFound.new(key) unless find_by_key(key, context: context) diff --git a/test/test_helper.rb b/test/test_helper.rb index <HASH>..<HASH> 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -116,14 +116,6 @@ module Pets end end -class PostResource < JSONAPI::Resource - attribute :id - - def self.sortable_fields(context) - (super(context) << :"author.name") - [:id] - end -end - JSONAPI.configuration.route_format = :underscored_route TestApp.routes.draw do jsonapi_resources :people
Add relationship sortable field to PostResource and take out of TestHelper
cerebris_jsonapi-resources
train
rb,rb
a56a7e088d5c9c299c6ef28165a9de55635a3aaf
diff --git a/scripts/configure_test_slurm.py b/scripts/configure_test_slurm.py index <HASH>..<HASH> 100755 --- a/scripts/configure_test_slurm.py +++ b/scripts/configure_test_slurm.py @@ -1,6 +1,7 @@ from socket import gethostname from string import Template from subprocess import call +from getpass import getuser SLURM_CONFIG_TEMPLATE = ''' # slurm.conf file generated by configurator.html. @@ -33,7 +34,7 @@ SlurmctldPort=6817 SlurmdPidFile=/var/run/slurmd.pid SlurmdPort=6818 SlurmdSpoolDir=/tmp/slurmd -SlurmUser=john +SlurmUser=$user #SlurmdUser=root #SrunEpilog= #SrunProlog= @@ -80,7 +81,7 @@ PartitionName=debug Nodes=$hostname Default=YES MaxTime=INFINITE State=UP def main(): - template_params = {"hostname": gethostname()} + template_params = {"hostname": gethostname(), "user": getuser()} config_contents = Template(SLURM_CONFIG_TEMPLATE).substitute(template_params) open("/etc/slurm-llnl/slurm.conf", "w").write(config_contents) call("slurmctld")
Touch up configure_test_slurm.py for non-my-laptop setups.
galaxyproject_pulsar
train
py
c34324fe70862638abd52dcd8b7fc4f0e34fe6fb
diff --git a/src/ace/Document.js b/src/ace/Document.js index <HASH>..<HASH> 100644 --- a/src/ace/Document.js +++ b/src/ace/Document.js @@ -381,7 +381,7 @@ ace.Document = function(text, mode) { this.$insertLines(firstRow, lines); var addedRows = lastRow - firstRow + 1; - this.fireChangeEvent(firstRow, lastRow+addedRows); + this.fireChangeEvent(firstRow); return addedRows; };
fix "copy lines up/down"
joewalker_gcli
train
js
b9f02fd165245a2dc20ac572722d51e951993d83
diff --git a/werkzeug/wsgi.py b/werkzeug/wsgi.py index <HASH>..<HASH> 100644 --- a/werkzeug/wsgi.py +++ b/werkzeug/wsgi.py @@ -738,13 +738,6 @@ class FileWrapper(object): raise StopIteration() -def make_limited_stream(stream, limit): - """Makes a stream limited.""" - if not isinstance(stream, LimitedStream) and limit is not None: - stream = LimitedStream(stream, limit) - return stream - - def _make_chunk_iter(stream, limit, buffer_size): """Helper for the line and chunk iter functions.""" if isinstance(stream, (bytes, bytearray, text_type)): @@ -755,7 +748,9 @@ def _make_chunk_iter(stream, limit, buffer_size): if item: yield item return - _read = make_limited_stream(stream, limit).read + if not isinstance(stream, LimitedStream) and limit is not None: + stream = LimitedStream(stream, limit) + _read = stream.read while 1: item = _read(buffer_size) if not item:
Some internal refactoring for limited streams on chunk iters
pallets_werkzeug
train
py
944485d1bd3bcd37eb83880c84aa5ce52745cbcd
diff --git a/tests/Controller.js b/tests/Controller.js index <HASH>..<HASH> 100644 --- a/tests/Controller.js +++ b/tests/Controller.js @@ -133,4 +133,14 @@ describe('Controller', () => { controller.getSignal('foo')(new Date()) }) }) + it('should throw when pointing to a non existing signal', () => { + const controller = new Controller({}) + assert.throws(() => { + controller.getSignal('foo.bar')() + }) + }) + it('should return undefined when grabbing non existing state', () => { + const controller = new Controller({}) + assert.equal(controller.getState('foo.bar'), undefined) + }) })
test(Controller): write tests for missing signal and missing state
cerebral_cerebral
train
js
32711b1251df11482a3335b664ff4d6d6043a7df
diff --git a/test/serve.test.js b/test/serve.test.js index <HASH>..<HASH> 100644 --- a/test/serve.test.js +++ b/test/serve.test.js @@ -33,6 +33,7 @@ describe('serve', function() { }); it('finds next unused port', function() { + this.timeout(10000); return createDirectory('foo').then(path => { process1 = spawn('node', ['./src/tabris', 'serve', path]); let port1;
Increase timeout of slow serve test Spawning serve several times sequentially may take more than 2 seconds, which leads to errors in a shared resource test environment. Change-Id: I3ec<I>caec<I>d<I>b6d<I>ef0ddf<I>
eclipsesource_tabris-js-cli
train
js
7e00b5a92bf5597bab7c624f056a66260c35c801
diff --git a/safe_qgis/test_utilities.py b/safe_qgis/test_utilities.py index <HASH>..<HASH> 100644 --- a/safe_qgis/test_utilities.py +++ b/safe_qgis/test_utilities.py @@ -2,6 +2,7 @@ import unittest import sys import os +from unittest import expectedFailure from PyQt4.QtCore import QVariant # Add parent directory to path to make test aware of other modules @@ -347,6 +348,7 @@ class UtilitiesTest(unittest.TestCase): myHtml = impactLayerAttribution(myKeywords) self.assertEqual(len(myHtml), 320) + @expectedFailure def test_localisedAttribution(self): """Test we can localise attribution.""" os.environ['LANG'] = 'id'
Mark localsed attribution as expected to fail
inasafe_inasafe
train
py
0b3f6dda6bf6f6d19c544714fcca6ae9c2d2e4a8
diff --git a/src/Commands/TestCommand.php b/src/Commands/TestCommand.php index <HASH>..<HASH> 100644 --- a/src/Commands/TestCommand.php +++ b/src/Commands/TestCommand.php @@ -31,9 +31,9 @@ class TestCommand extends Command } if (in_array(config('app.env'), config('larabug.environments'))) { - $this->info('✓ [Larabug] Correct environment found'); + $this->info('✓ [Larabug] Correct environment found (' . config('app.env') . ')'); } else { - $this->error('✗ [LaraBug] Environment not allowed to send errors to LaraBug, set this in your config'); + $this->error('✗ [LaraBug] Environment (' . config('app.env') . ') not allowed to send errors to LaraBug, set this in your config'); $this->info('More information about environment configuration: https://www.larabug.com/docs/how-to-use/installation'); }
Added the environment to the output of the test command Added the environment to the output of the test command
LaraBug_LaraBug
train
php
3a7841f7a18e8ff8241a843a5fe324314f3441ae
diff --git a/tests/test_connection.py b/tests/test_connection.py index <HASH>..<HASH> 100644 --- a/tests/test_connection.py +++ b/tests/test_connection.py @@ -297,7 +297,7 @@ class TestConnection(XvfbTest): cookies.append((i, c)) for i, c in cookies: try: - name = ''.join(c.reply().name) + name = c.reply().name.to_string() except xcffib.xproto.BadAtom: continue atoms.update({i: name}) # Lookup by number
ok, really fix the test this time :)
tych0_xcffib
train
py
593c53921ce888b64b74467407e60239e8d6e32f
diff --git a/src/Receita/CNPJParser.php b/src/Receita/CNPJParser.php index <HASH>..<HASH> 100644 --- a/src/Receita/CNPJParser.php +++ b/src/Receita/CNPJParser.php @@ -58,7 +58,7 @@ class CNPJParser { { $ret = array(); if($text==self::nao_informada or $text==self::asterisks){ - $ret['code'] = '00'; + $ret['code'] = '00.00-0-00'; $ret['text'] = $text; } else { $split = explode(' - ',$text);
CNPJParser: Fixed code for undefined activity The code now uses tha same format as a normal code.
vkruoso_receita-tools
train
php
2986be4e55d6c8113344d5e184d40c6c3945a2bb
diff --git a/_distutils_importer/__init__.py b/_distutils_importer/__init__.py index <HASH>..<HASH> 100644 --- a/_distutils_importer/__init__.py +++ b/_distutils_importer/__init__.py @@ -25,7 +25,7 @@ class DistutilsMetaFinder: return self.get_distutils_spec() def get_distutils_spec(self): - import importlib + import importlib.util class DistutilsLoader(importlib.util.abc.Loader):
Fix AttributeError when `importlib.util` was not otherwise imported.
pypa_setuptools
train
py
3db8817a27f2509474171733036e34266a53cca4
diff --git a/lib/varnish/utils.rb b/lib/varnish/utils.rb index <HASH>..<HASH> 100644 --- a/lib/varnish/utils.rb +++ b/lib/varnish/utils.rb @@ -1,2 +1 @@ -require 'varnish/utils/buffer_set' require 'varnish/utils/timer'
Belatedly stop including a file that's been killed.
andreacampi_varnish-rb
train
rb
384a280d762180f1e443ba87a7edafbb028c51af
diff --git a/test/simple.rb b/test/simple.rb index <HASH>..<HASH> 100644 --- a/test/simple.rb +++ b/test/simple.rb @@ -303,6 +303,8 @@ module SimpleTestMethods end def test_time_with_default_timezone_local + skip "with_system_tz not working in tomcat" if ActiveRecord::Base.connection.raw_connection.jndi? + with_system_tz 'Europe/Prague' do Time.use_zone 'Europe/Prague' do with_timezone_config default: :local do @@ -325,6 +327,8 @@ module SimpleTestMethods # def test_preserving_time_objects_with_utc_time_conversion_to_default_timezone_local + skip "with_system_tz not working in tomcat" if ActiveRecord::Base.connection.raw_connection.jndi? + with_system_tz 'America/New_York' do # with_env_tz in Rails' tests with_timezone_config default: :local do time = Time.utc(2000) @@ -341,6 +345,8 @@ module SimpleTestMethods end def test_preserving_time_objects_with_time_with_zone_conversion_to_default_timezone_local + skip "with_system_tz not working in tomcat" if ActiveRecord::Base.connection.raw_connection.jndi? + with_system_tz 'America/New_York' do # with_env_tz in Rails' tests with_timezone_config default: :local do Time.use_zone 'Central Time (US & Canada)' do
[test] skip tests using with_system_tz in JNDI config ..because it's not working from inside the tomcat container
jruby_activerecord-jdbc-adapter
train
rb
a16f80c8b7638a8c1f61483f3932f02c1448e4c4
diff --git a/bench_test.go b/bench_test.go index <HASH>..<HASH> 100644 --- a/bench_test.go +++ b/bench_test.go @@ -25,7 +25,7 @@ func benchRequest(b *testing.B, router http.Handler, r *http.Request) { func BenchmarkRouter(b *testing.B) { router := New() - router.HandleFunc("/hello", func(w http.ResponseWriter, r *http.Request) {}) + router.HandleFunc("/hello", func(w http.ResponseWriter, r *http.Request) {}, "GET,HEAD") r, _ := http.NewRequest("GET", "/hello", nil) benchRequest(b, router, r) }
benchmark for methods GET/HEAD
nbari_violetear
train
go