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
4389d17469937585fe5c16cd704aae6b624a4fed
diff --git a/drf_hal_json/views.py b/drf_hal_json/views.py index <HASH>..<HASH> 100644 --- a/drf_hal_json/views.py +++ b/drf_hal_json/views.py @@ -11,4 +11,4 @@ class HalCreateModelMixin(CreateModelMixin): url_field_data = links_data.get(api_settings.URL_FIELD_NAME) if not url_field_data: return {} - return {'Location': url_field_data} + return {'Location': str(url_field_data)} diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -11,8 +11,8 @@ setup( author_email='bredehoeft.sebastian@gmail.com', packages=find_packages(exclude=['tests*']), install_requires=[ - 'django>=1.6', - 'djangorestframework>=3.0.0', + 'django>=2.0', + 'djangorestframework>=3.10.0', 'drf-nested-fields>=0.9.0' ], zip_safe=False,
made compatible with DRF <I>
seebass_drf-hal-json
train
py,py
4fbe1c30e310d0caa638ba52b7748123c1998b57
diff --git a/DrdPlus/Lighting/UnsuitableLightingQualityMalus.php b/DrdPlus/Lighting/UnsuitableLightingQualityMalus.php index <HASH>..<HASH> 100644 --- a/DrdPlus/Lighting/UnsuitableLightingQualityMalus.php +++ b/DrdPlus/Lighting/UnsuitableLightingQualityMalus.php @@ -48,7 +48,7 @@ class UnsuitableLightingQualityMalus extends StrictObject implements NegativeInt if ($infravisionCanBeUsed && $currentLightingQuality->getValue() <= -90 // like star night && in_array($raceCode->getValue(), [RaceCode::DWARF, RaceCode::ORC], true) ) { - /** lowering malus by infravision, see PPH page 129 right column, @link https://pph.drdplus.jaroslavtyc.com/#Infravidění */ + /** lowering malus by infravision, see PPH page 129 right column, @link https://pph.drdplus.jaroslavtyc.com/#infravideni */ $possibleMalus += 3; } $possibleMalus += $duskSight->getInsufficientLightingBonus(); // lowering malus
Updated a link to PPH
drdplusinfo_drdplus-lighting
train
php
b5657ce8e9d241dde5badb062bcf05d731483462
diff --git a/anyconfig/__init__.py b/anyconfig/__init__.py index <HASH>..<HASH> 100644 --- a/anyconfig/__init__.py +++ b/anyconfig/__init__.py @@ -19,7 +19,7 @@ validation/generation support. from .globals import AUTHOR, VERSION from .api import ( single_load, multi_load, load, loads, dump, dumps, validate, gen_schema, - list_types, find_loader, to_container, get, set_, open, + list_types, find_loader, merge, get, set_, open, MS_REPLACE, MS_NO_REPLACE, MS_DICTS, MS_DICTS_AND_LISTS, UnknownParserTypeError, UnknownFileTypeError ) @@ -29,7 +29,7 @@ __version__ = VERSION __all__ = [ "single_load", "multi_load", "load", "loads", "dump", "dumps", "validate", - "gen_schema", "list_types", "find_loader", "to_container", + "gen_schema", "list_types", "find_loader", "merge", "get", "set_", "open", "MS_REPLACE", "MS_NO_REPLACE", "MS_DICTS", "MS_DICTS_AND_LISTS", "UnknownParserTypeError", "UnknownFileTypeError"
api: export merge (anyconfig.dicts.merge) instead of to_container which was deprecated and removed
ssato_python-anyconfig
train
py
57be3cfb3422d84a73f0d933bfc7b03f10df8445
diff --git a/stimela/cargo/cab/rfinder/src/run.py b/stimela/cargo/cab/rfinder/src/run.py index <HASH>..<HASH> 100644 --- a/stimela/cargo/cab/rfinder/src/run.py +++ b/stimela/cargo/cab/rfinder/src/run.py @@ -32,11 +32,8 @@ for param in cab['parameters']: if value is None: continue - msnames = [] if name == 'msname': - for ms in value: - msnames.append(ms.split('/')[-1]) - list_doc['general']['msname'] = msnames + list_doc['general']['msname'] = value.split('/')[-1] continue for key, val in list_doc.items():
get the msname with no path
SpheMakh_Stimela
train
py
d43d1869be5e97c3f4df7f58bc724f0de6df545d
diff --git a/src/main/java/water/util/MRUtils.java b/src/main/java/water/util/MRUtils.java index <HASH>..<HASH> 100644 --- a/src/main/java/water/util/MRUtils.java +++ b/src/main/java/water/util/MRUtils.java @@ -75,11 +75,10 @@ public class MRUtils { int cores = 0; for( H2ONode node : H2O.CLOUD._memary ) cores += node._heartbeat._num_cpus; - final int splits = 4*cores; - + final int splits = cores; // rebalance only if the number of chunks is less than the number of cores - if( (fr.vecs()[0].nChunks() < splits/4 || shuffle) && fr.numRows() > splits) { + if( (fr.vecs()[0].nChunks() < splits || shuffle) && fr.numRows() > splits) { Vec[] vecs = fr.vecs().clone(); Log.info("Load balancing dataset, splitting it into up to " + splits + " chunks."); long[] idx = null;
Reduce the number of chunks for rebalancing to the number of cores, not 4x.
h2oai_h2o-2
train
java
fee7fba8934ee6005b7e8eefc4baf7db48f03934
diff --git a/activestorage/app/jobs/active_storage/purge_job.rb b/activestorage/app/jobs/active_storage/purge_job.rb index <HASH>..<HASH> 100644 --- a/activestorage/app/jobs/active_storage/purge_job.rb +++ b/activestorage/app/jobs/active_storage/purge_job.rb @@ -3,6 +3,7 @@ # Provides asynchronous purging of ActiveStorage::Blob records via ActiveStorage::Blob#purge_later. class ActiveStorage::PurgeJob < ActiveStorage::BaseJob discard_on ActiveRecord::RecordNotFound + retry_on ActiveRecord::Deadlocked, attempts: 10, wait: :exponentially_longer def perform(blob) blob.purge
Retry ActiveStorage::PurgeJobs on DB deadlock
rails_rails
train
rb
f9d353553401655fb53c8384dfce92a3e9870038
diff --git a/source/CAS/PGTStorage/Db.php b/source/CAS/PGTStorage/Db.php index <HASH>..<HASH> 100644 --- a/source/CAS/PGTStorage/Db.php +++ b/source/CAS/PGTStorage/Db.php @@ -296,7 +296,7 @@ class CAS_PGTStorage_Db extends CAS_PGTStorage_AbstractStorage // initialize the PDO object for this method $pdo = $this->_getPdo(); - $this->setErrorMode(); + $this->_setErrorMode(); try { $pdo->beginTransaction(); @@ -337,7 +337,7 @@ class CAS_PGTStorage_Db extends CAS_PGTStorage_AbstractStorage // initialize the PDO object for this method $pdo = $this->_getPdo(); - $this->setErrorMode(); + $this->_setErrorMode(); try { $pdo->beginTransaction();
#<I> fix function names screwed up by the style changes
apereo_phpCAS
train
php
c47aeef173a35366c38213fdd8ff6467e694586f
diff --git a/wicket-orientdb/src/test/java/ru/ydn/wicket/wicketorientdb/orientdb/TestStandaloneOrientDBCompatibility.java b/wicket-orientdb/src/test/java/ru/ydn/wicket/wicketorientdb/orientdb/TestStandaloneOrientDBCompatibility.java index <HASH>..<HASH> 100644 --- a/wicket-orientdb/src/test/java/ru/ydn/wicket/wicketorientdb/orientdb/TestStandaloneOrientDBCompatibility.java +++ b/wicket-orientdb/src/test/java/ru/ydn/wicket/wicketorientdb/orientdb/TestStandaloneOrientDBCompatibility.java @@ -14,6 +14,7 @@ import ru.ydn.wicket.wicketorientdb.OrientDbTestWebApplication; import static org.junit.Assert.assertNotNull; +@Ignore public class TestStandaloneOrientDBCompatibility { private static final String PLOCAL_DB_NAME = "testDBLifeCycleLocal";
Exclude standalone tests because they make test very slow
OrienteerBAP_wicket-orientdb
train
java
1549f9fc607053b52447e53b253acddc890419de
diff --git a/openfisca_core/holders.py b/openfisca_core/holders.py index <HASH>..<HASH> 100644 --- a/openfisca_core/holders.py +++ b/openfisca_core/holders.py @@ -2,18 +2,19 @@ from __future__ import division -import warnings +import logging +import shutil import os +import warnings import numpy as np +import psutil from commons import empty_clone import periods from periods import MONTH, YEAR, ETERNITY from columns import make_column_from_variable from indexed_enums import Enum, EnumArray -import logging -import psutil log = logging.getLogger(__name__) @@ -528,6 +529,12 @@ class OnDiskStorage(object): def get_known_periods(self): return self._files.keys() + def __del__(self): + shutil.rmtree(self.storage_dir) # Remove the holder temporary files + # If the simulation temporary directory is empty, remove it + parent_dir = os.path.abspath(os.path.join(self.storage_dir, os.pardir)) + if not os.listdir(parent_dir): + shutil.rmtree(parent_dir) class InMemoryStorage(object):
Remove tmp files when simulation is done
openfisca_openfisca-core
train
py
457aee9a220131ba807f242278de3e2bbf448e19
diff --git a/resource_aws_vpc_test.go b/resource_aws_vpc_test.go index <HASH>..<HASH> 100644 --- a/resource_aws_vpc_test.go +++ b/resource_aws_vpc_test.go @@ -10,9 +10,8 @@ import ( ) func TestAccVpc(t *testing.T) { - testAccPreCheck(t) - resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, CheckDestroy: testAccCheckVpcDestroy, Steps: []resource.TestStep{
helper/resource: add PreCheck
terraform-providers_terraform-provider-aws
train
go
a46b7a99cf417c6325a01c83b7b58b9dcb636544
diff --git a/spec/mongo/collection_spec.rb b/spec/mongo/collection_spec.rb index <HASH>..<HASH> 100644 --- a/spec/mongo/collection_spec.rb +++ b/spec/mongo/collection_spec.rb @@ -1263,7 +1263,7 @@ describe Mongo::Collection do end end - context 'when a max time ms value is provided' do + context 'when a max time ms value is provided', if: (!sharded? && write_command_enabled?) do let(:result) do authorized_collection.parallel_scan(2, options)
RUBY-<I> Don't test parallelScan on <I>
mongodb_mongo-ruby-driver
train
rb
941348aa941b6f2ef01b773020c390d901b20856
diff --git a/lib/rpub.rb b/lib/rpub.rb index <HASH>..<HASH> 100644 --- a/lib/rpub.rb +++ b/lib/rpub.rb @@ -48,7 +48,6 @@ module Rpub end KRAMDOWN_OPTIONS = { - :auto_ids => false, :coderay_line_numbers => nil } end
Do use auto IDs for TOC
avdgaag_rpub
train
rb
cb0127384a147605b037f43c35a9bb67ffffad0f
diff --git a/src/wyjc/runtime/Util.java b/src/wyjc/runtime/Util.java index <HASH>..<HASH> 100755 --- a/src/wyjc/runtime/Util.java +++ b/src/wyjc/runtime/Util.java @@ -403,7 +403,7 @@ public class Util { * The <code>coerce</code> method forces this object to conform to a given * type. */ - public static Object coerce(Object obj, Type t) { + public static Object coerce(Object obj, Type t) { if(obj instanceof BigInteger) { return coerce((BigInteger)obj,t); } else if(obj instanceof List) { @@ -461,8 +461,10 @@ public class Util { throw new RuntimeException("invalid list coercion (" + obj + " => " + t + ")"); } - public static Object coerce(String obj, Type t) { - if(t.kind == Type.K_LIST) { + public static Object coerce(String obj, Type t) { + if(t.kind == Type.K_STRING) { + return obj; + } else if(t.kind == Type.K_LIST) { Type.List tl = (Type.List) t; List r = new List(obj.length()); for(int i=0;i!=obj.length();++i) {
Bug fix for string => [int] coercions.
Whiley_WhileyCompiler
train
java
0963870408f77f69ffa4053e127f22cf54313fe8
diff --git a/lib/songbirdsh/track.rb b/lib/songbirdsh/track.rb index <HASH>..<HASH> 100644 --- a/lib/songbirdsh/track.rb +++ b/lib/songbirdsh/track.rb @@ -22,7 +22,7 @@ module Songbirdsh end def search_string - "#{self.artist.downcase}#{self.album.downcase}#{self.title.downcase}" + "#{self.artist.to_s.downcase}#{self.album.to_s.downcase}#{self.title.to_s.downcase}" end def to_s
slight change to handle nil track fields
markryall_songbirdsh
train
rb
f70f72c635e1a4f2215ccc7ca19fd4fcdc284a79
diff --git a/scope/scope.py b/scope/scope.py index <HASH>..<HASH> 100644 --- a/scope/scope.py +++ b/scope/scope.py @@ -78,6 +78,11 @@ class TagBase: """Method called for defining arguments for the object. Should be implemented by subclasses.""" pass + def set_children(self, children): + """Set the children of the object.""" + self.children = children + return self + def serialize(self, context): """Method called for serializing object. Should be implemented by subclasses.""" pass
Add helper function for setting children.
lrgar_scope
train
py
5c818c04206da52ca6b153e2d055a281c3f0df75
diff --git a/spec/apps/rails/dummy_app.rb b/spec/apps/rails/dummy_app.rb index <HASH>..<HASH> 100644 --- a/spec/apps/rails/dummy_app.rb +++ b/spec/apps/rails/dummy_app.rb @@ -104,8 +104,7 @@ class DummyController < ActionController::Base ) ] - def index - end + def index; end def crash raise AirbrakeTestError
rubocop: fix offences of the Style/EmptyMethod cop
airbrake_airbrake
train
rb
bba6fdebd77cce64a0f23a5242232859052253d6
diff --git a/code/javascript/core/scripts/selenium-seleneserunner.js b/code/javascript/core/scripts/selenium-seleneserunner.js index <HASH>..<HASH> 100644 --- a/code/javascript/core/scripts/selenium-seleneserunner.js +++ b/code/javascript/core/scripts/selenium-seleneserunner.js @@ -109,7 +109,7 @@ function nextCommand() { if (postResult == "START") { url = url + "driver/?seleniumStart=true" + buildDriverParams() + preventBrowserCaching(); } else { - url = url + "driver/?commandResult=" + postResult + buildDriverParams() + preventBrowserCaching(); + url = url + "driver/?commandResult=" + encodeURI(postResult) + buildDriverParams() + preventBrowserCaching(); } LOG.debug("XMLHTTPRequesting " + url); xmlHttp.open("GET", url, true);
Encode the URI of the command result, for SRC-2 r<I>
SeleniumHQ_selenium
train
js
b4eed552668dc917d68a09705a0052d75642bd89
diff --git a/openfisca_web_api/controllers.py b/openfisca_web_api/controllers.py index <HASH>..<HASH> 100644 --- a/openfisca_web_api/controllers.py +++ b/openfisca_web_api/controllers.py @@ -397,6 +397,7 @@ def api1_field(req): headers = headers, ) + model.tax_benefit_system.set_variables_dependencies() simulation = simulations.Simulation( period = periods.period(datetime.date.today().year), tax_benefit_system = model.tax_benefit_system,
Compute consumers of variable before returning a field JSON.
openfisca_openfisca-web-api
train
py
7367d922793c2c4e7f777607b5de18517c1dfd27
diff --git a/forwarded.js b/forwarded.js index <HASH>..<HASH> 100644 --- a/forwarded.js +++ b/forwarded.js @@ -10,13 +10,19 @@ var proxies = [ { ip: 'x-forwarded-for', - port: 'x-forwarded-port' + port: 'x-forwarded-port', + proto: 'x-forwarded-proto' }, { ip: 'z-forwarded-for', - port: 'z-forwarded-port' + port: 'z-forwarded-port', // Estimated guess, no standard header available. + proto: 'z-forwarded-proto' // Estimated guess, no standard header available. }, { ip: 'forwarded', - port: 'forwarded-port' + port: 'forwarded-port', + proto: 'forwarded-proto' // Estimated guess, no standard header available. + }, { + ip: 'x-real-ip', + port: 'x-real-port' // Estimated guess, no standard header available. } ];
[minor] Added x-real-ip as option.
primus_primus
train
js
b741ea1b4645b6de4ab009ec303af66da5558a9d
diff --git a/troposphere/cognito.py b/troposphere/cognito.py index <HASH>..<HASH> 100644 --- a/troposphere/cognito.py +++ b/troposphere/cognito.py @@ -130,7 +130,7 @@ class PasswordPolicy(AWSProperty): 'RequireNumbers': (boolean, False), 'RequireSymbols': (boolean, False), 'RequireUppercase': (boolean, False), - 'TemporaryPasswordValidityDays': (float, False), + 'TemporaryPasswordValidityDays': (positive_integer, False), }
Fix TemporaryPasswordValidityDays type (#<I>)
cloudtools_troposphere
train
py
e9700ab5505226e5c060e7a2515548f3bf5ddb01
diff --git a/devices.js b/devices.js index <HASH>..<HASH> 100755 --- a/devices.js +++ b/devices.js @@ -3396,17 +3396,14 @@ const devices = [ vendor: 'Iris', description: 'Motion and temperature sensor', supports: 'occupancy and temperature', - fromZigbee: [ - fz.temperature, - fz.iaszone_occupancy_2, - ], + fromZigbee: [fz.iaszone_occupancy_2, fz.temperature, fz.battery_3V_2100], toZigbee: [], - meta: {configureKey: 1}, + meta: {configureKey: 2}, configure: async (device, coordinatorEndpoint) => { const endpoint = device.getEndpoint(1); await bind(endpoint, coordinatorEndpoint, ['msTemperatureMeasurement', 'genPowerCfg']); await configureReporting.temperature(endpoint); - await configureReporting.batteryPercentageRemaining(endpoint); + await configureReporting.batteryVoltage(endpoint); }, }, {
Fix battery reporting for Iris <I>-L motion sensor. (#<I>)
Koenkk_zigbee-shepherd-converters
train
js
adbdd7034293528273905bd8711bbf5c755386ed
diff --git a/system/Database/BaseBuilder.php b/system/Database/BaseBuilder.php index <HASH>..<HASH> 100644 --- a/system/Database/BaseBuilder.php +++ b/system/Database/BaseBuilder.php @@ -1602,14 +1602,12 @@ class BaseBuilder return false; // @codeCoverageIgnore } - } else { - if (empty($set)) { - if (CI_DEBUG) { - throw new DatabaseException('insertBatch() called with no data'); - } - - return false; // @codeCoverageIgnore + } elseif (empty($set)) { + if (CI_DEBUG) { + throw new DatabaseException('insertBatch() called with no data'); } + + return false; // @codeCoverageIgnore } $hasQBSet = ($set === null); @@ -1690,7 +1688,7 @@ class BaseBuilder $clean = []; - foreach ($row as $k => $rowValue) { + foreach ($row as $rowValue) { $clean[] = $escape ? $this->db->escape($rowValue) : $rowValue; }
refactor: vendor/bin/rector process
codeigniter4_CodeIgniter4
train
php
b01ac88ae90da4e1081fbe4853cbd9635bd8d6ff
diff --git a/rw/event.py b/rw/event.py index <HASH>..<HASH> 100644 --- a/rw/event.py +++ b/rw/event.py @@ -64,8 +64,10 @@ class Event(set): # wait for results for func, future in futures: try: - result = yield future - re.append(result) + if not future.done(): + yield future + re.append(future.result()) + except Exception: exceptions.append((func, traceback.format_exc()))
rw.event.Event make sure we are not waiting for already done Future's
FlorianLudwig_rueckenwind
train
py
18d7dfeb7fdd70b603facd2b3cc0e95299bd1f73
diff --git a/code/libraries/koowa/libraries/database/row/abstract.php b/code/libraries/koowa/libraries/database/row/abstract.php index <HASH>..<HASH> 100644 --- a/code/libraries/koowa/libraries/database/row/abstract.php +++ b/code/libraries/koowa/libraries/database/row/abstract.php @@ -95,6 +95,8 @@ abstract class KDatabaseRowAbstract extends KObjectArray implements KDatabaseRow // Set the row data if (isset($config->data)) { $this->setProperties($config->data->toArray(), $this->isNew()); + + unset($config->data); } //Set the status message diff --git a/code/libraries/koowa/libraries/database/rowset/abstract.php b/code/libraries/koowa/libraries/database/rowset/abstract.php index <HASH>..<HASH> 100644 --- a/code/libraries/koowa/libraries/database/rowset/abstract.php +++ b/code/libraries/koowa/libraries/database/rowset/abstract.php @@ -72,6 +72,9 @@ abstract class KDatabaseRowsetAbstract extends KObjectSet implements KDatabaseRo foreach($config->data->toArray() as $properties) { $this->create($properties, $config->status); } + + // Unset data to save memory + unset($config->data); } //Set the status message
re #<I>: Optimize row and rowset creation for memory use
joomlatools_joomlatools-framework
train
php,php
bbc9e5ce36ae6301500149190367be60147fe7f7
diff --git a/src/Projection/Catalog/Import/CatalogImport.php b/src/Projection/Catalog/Import/CatalogImport.php index <HASH>..<HASH> 100644 --- a/src/Projection/Catalog/Import/CatalogImport.php +++ b/src/Projection/Catalog/Import/CatalogImport.php @@ -143,7 +143,7 @@ class CatalogImport array_map(function (Context $context) use ($productBuilder, $productXml) { if ($productBuilder->isAvailableForContext($context)) { $product = $productBuilder->getProductForContext($context); - $this->addCommandToQueue($product); + $this->addUpdateProductCommandToQueue($product); $this->processImagesInProductXml($productXml); } }, $this->contextSource->getAllAvailableContextsWithVersion($this->dataVersion)); @@ -175,7 +175,7 @@ class CatalogImport } } - private function addCommandToQueue(Product $product) + private function addUpdateProductCommandToQueue(Product $product) { $this->commandQueue->add(new UpdateProductCommand($product)); }
Issue #<I>: Rename method addCommandToQueue to more expressive addUpdateProductCommandToQueue
lizards-and-pumpkins_catalog
train
php
b15364dd9f6768d4d9996c42e54eddfa74d89cb4
diff --git a/launch_control/commands/dashboard.py b/launch_control/commands/dashboard.py index <HASH>..<HASH> 100644 --- a/launch_control/commands/dashboard.py +++ b/launch_control/commands/dashboard.py @@ -85,5 +85,7 @@ class server_version(XMLRPCCommand): Display dashboard server version """ + __abstract__ = False + def invoke_remote(self): print "Dashboard server version: %s" % (self.server.version(),) diff --git a/launch_control/commands/dispatcher.py b/launch_control/commands/dispatcher.py index <HASH>..<HASH> 100644 --- a/launch_control/commands/dispatcher.py +++ b/launch_control/commands/dispatcher.py @@ -25,6 +25,8 @@ class LaunchControlDispatcher(object): self.subparsers = self.parser.add_subparsers( title="Sub-command to invoke") for command_cls in Command.get_subclasses(): + if getattr(command_cls, '__abstract__', False): + continue sub_parser = self.subparsers.add_parser( command_cls.get_name(), help=command_cls.get_help())
Make XMLRPCCommand (base class) not show up in lc-tool
zyga_json-schema-validator
train
py,py
3332cb4918728d5e95658e9ca1d5038cdd92c383
diff --git a/lib/princely/pdf_helper.rb b/lib/princely/pdf_helper.rb index <HASH>..<HASH> 100644 --- a/lib/princely/pdf_helper.rb +++ b/lib/princely/pdf_helper.rb @@ -25,10 +25,11 @@ module Princely :stylesheets => [], :layout => false, :template => File.join(controller_path, action_name), - :relative_paths => true + :relative_paths => true, + :server_flag => true }.merge(options) - prince = Princely::Pdf.new + prince = Princely::Pdf.new(options.slice(:server_flag)) # Sets style sheets on PDF renderer prince.add_style_sheets(*options[:stylesheets].collect{|style| asset_file_path(style)})
Accept options[:server_flag] from make_pdf
mbleigh_princely
train
rb
344729300469ed350f5eebac58468ba4fa5899a2
diff --git a/client/gutenberg/editor/hooks/components/media-upload/index.js b/client/gutenberg/editor/hooks/components/media-upload/index.js index <HASH>..<HASH> 100644 --- a/client/gutenberg/editor/hooks/components/media-upload/index.js +++ b/client/gutenberg/editor/hooks/components/media-upload/index.js @@ -77,19 +77,17 @@ export class MediaUpload extends Component { }; getEnabledFilters = () => { - // TODO: Replace with `allowedTypes` (array) after updating Gutenberg - const { type } = this.props; - switch ( type ) { - case 'image': - return [ 'images' ]; - case 'audio': - return [ 'audio' ]; - case 'video': - return [ 'videos' ]; - case 'document': - return [ 'documents' ]; - } - return undefined; + const { allowedTypes } = this.props; + + const enabledFiltersMap = { + image: 'images', + audio: 'audio', + video: 'videos', + }; + + return isArray( allowedTypes ) + ? allowedTypes.map( type => enabledFiltersMap[ type ] ) + : undefined; }; getSelectedItems = () => {
Gutenberg: wire up Media library enabled filters (#<I>) The existing mapping of allowed types to enabled filters was no longer accurate after the package update. This fixes the mapping and refactors the code to handle the cases when multiple allowed types can be returned.
Automattic_wp-calypso
train
js
55f321ea941c8181b615d5df9afa2fdaa4a8cde4
diff --git a/src/util/node.js b/src/util/node.js index <HASH>..<HASH> 100644 --- a/src/util/node.js +++ b/src/util/node.js @@ -1,3 +1,4 @@ + /*jslint indent:2,white:true,sloppy:true,node:true */ /* * freedom.js Node runtime @@ -5,7 +6,20 @@ 'use strict'; -var fdom = module.exports = {}; +var sources = [ + '/..', + '/../link', + '/../proxy', + '/../../interface' +]; + +sources.forEach(function(dir) { + require('fs').readdirSync(__dirname + dir).forEach(function(file) { + if (file.match(/.+\.js/) !== null) { + require(__dirname + dir + '/' + file); + } + }); +}); module.exports.freedom = fdom.setup(global, undefined, { portType: 'Node',
reapair node node functionality from bad merge
freedomjs_freedom
train
js
8d42007c45a21994f5b4d94f0a8e91cf71f62ff7
diff --git a/go/libkb/env.go b/go/libkb/env.go index <HASH>..<HASH> 100644 --- a/go/libkb/env.go +++ b/go/libkb/env.go @@ -255,6 +255,9 @@ func (e *Env) GetMountDir() (string, error) { "%s (%s)", runmodeName, user.Username)) case "linux": return filepath.Join(e.GetRuntimeDir(), "kbfs") + // kbfsdokan depends on an empty default + case "windows": + return "" default: return filepath.Join(e.GetRuntimeDir(), "kbfs") }
make Env.GetMountDir() return emtpy by default on windows (#<I>)
keybase_client
train
go
7fec7870f3cf2b9cde83fdb81df53d64d2a827c9
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -34,7 +34,6 @@ setup( test_suite='tests', classifiers=[ - 'Development Status :: 2 - Pre-Alpha', 'Intended Audience :: Developers', 'License :: OSI Approved :: BSD License',
Remove development status from setup.py The project status could be tracked by its version so it's useless.
ikalnytskyi_dooku
train
py
23c2080879d5c3299ad30cf8927aa59a1b470635
diff --git a/lib/olive_branch/middleware.rb b/lib/olive_branch/middleware.rb index <HASH>..<HASH> 100644 --- a/lib/olive_branch/middleware.rb +++ b/lib/olive_branch/middleware.rb @@ -11,12 +11,14 @@ module OliveBranch env["action_dispatch.request.request_parameters"].deep_transform_keys!(&:underscore) end - status, headers, response = @app.call(env) - - if inflection && headers["Content-Type"] =~ /application\/json/ - response.each do |body| - begin - new_response = JSON.parse(body) + @app.call(env).tap do |_status, headers, response| + if inflection && headers["Content-Type"] =~ /application\/json/ + response.each do |body| + begin + new_response = JSON.parse(body) + rescue JSON::ParserError + next + end if inflection == "camel" new_response.deep_transform_keys! { |k| k.camelize(:lower) } @@ -25,12 +27,9 @@ module OliveBranch end body.replace(new_response.to_json) - rescue JSON::ParserError end end end - - [status, headers, response] end end end
Refactor middleware w/ tap
vigetlabs_olive_branch
train
rb
9c051b50d7e27bfd7dec56e2e4fa70160594a9f5
diff --git a/test_project/settings.py b/test_project/settings.py index <HASH>..<HASH> 100644 --- a/test_project/settings.py +++ b/test_project/settings.py @@ -24,6 +24,8 @@ INSTALLED_APPS = ( 'tester', ) +SECRET_KEY = 'unique snowflake' + TEST_RUNNER = "test_runner.DJCETestSuiteRunner" CELERY_ALWAYS_EAGER = True
Add dummy SECRET_KEY to test_project settings Required to be non-empty since Django <I>
pmclanahan_django-celery-email
train
py
16e1661efdcebc41ff0b6dca2d021373747db48a
diff --git a/lib/svtplay_dl/service/svtplay.py b/lib/svtplay_dl/service/svtplay.py index <HASH>..<HASH> 100644 --- a/lib/svtplay_dl/service/svtplay.py +++ b/lib/svtplay_dl/service/svtplay.py @@ -38,7 +38,7 @@ class Svtplay(Service, OpenGraphThumbMixin): if re.match("^[0-9]+$", vid): old = True - url = "http://www.svt.se/videoplayer-api/video/%s" % vid + url = "http://api.svt.se/videoplayer-api/video/%s" % vid data = self.http.request("get", url) if data.status_code == 404: yield ServiceError("Can't get the json file for %s" % url)
svtplay: they changed the hostname for api calls fixes #<I>
spaam_svtplay-dl
train
py
33be56dbe9b091a4dbd8dc1c293267154f10b5bd
diff --git a/frontend/src/store/uiPropTypes.js b/frontend/src/store/uiPropTypes.js index <HASH>..<HASH> 100644 --- a/frontend/src/store/uiPropTypes.js +++ b/frontend/src/store/uiPropTypes.js @@ -70,6 +70,16 @@ export const result = PropTypes.shape({ export const results = PropTypes.objectOf(result); +export const deletedResult = PropTypes.shape({ + id: resultId, + pathName: PropTypes.string, + name: PropTypes.string, + group: PropTypes.string, + isUnregistered: PropTypes.bool, +}); + +export const deletedResults = PropTypes.objectOf(result); + export const fetchState = PropTypes.shape({ resultList: PropTypes.string, });
Define a prop type for deleted results
chainer_chainerui
train
js
68970f2e189eb5241dbad5c62131f216300942f0
diff --git a/mstate/relation.go b/mstate/relation.go index <HASH>..<HASH> 100644 --- a/mstate/relation.go +++ b/mstate/relation.go @@ -117,7 +117,7 @@ func (r *Relation) Life() Life { // state. If the lifecycle transitioned concurrently so that the cache is // stale, the call is valid but will yield no effect in the database. func (r *Relation) SetLife(life Life) error { - if !r.doc.Life.isNextValid(life) { + if !transitions[r.doc.Life][life] { panic(fmt.Errorf("illegal lifecycle state change from %q to %q", r.doc.Life, life)) } sel := bson.D{ diff --git a/mstate/state.go b/mstate/state.go index <HASH>..<HASH> 100644 --- a/mstate/state.go +++ b/mstate/state.go @@ -17,10 +17,10 @@ const ( Alive Life = iota Dying Dead - Nlife + nLife ) -var lifeStrings = [Nlife]string{ +var lifeStrings = [nLife]string{ Alive: "alive", Dying: "dying", Dead: "dead", @@ -30,7 +30,7 @@ func (l Life) String() string { return lifeStrings[l] } -var transitions = [Nlife][Nlife]bool{ +var transitions = [nLife][nLife]bool{ Alive: {Dying: true}, Dying: {Dying: true, Dead: true}, Dead: {Dead: true},
mstate: rename Nlife to nLife
juju_juju
train
go,go
19ebd3cafa187466d13e45a9f6cf937433596537
diff --git a/src/lib/widget/default.js b/src/lib/widget/default.js index <HASH>..<HASH> 100644 --- a/src/lib/widget/default.js +++ b/src/lib/widget/default.js @@ -162,11 +162,13 @@ define(['../util', '../assets', '../i18n'], function(util, assets, i18n) { evt.stopPropagation(); setState('initial'); document.body.removeEventListener('click', hideBubble); + document.body.removeEventListener('touchstart', hideBubble); return false; } setCubeAction(hideBubble); document.body.addEventListener('click', hideBubble); + document.body.addEventListener('touchstart', hideBubble); elements.connectForm.userAddress.focus(); }, @@ -240,9 +242,11 @@ define(['../util', '../assets', '../i18n'], function(util, assets, i18n) { if(visible) { addClass(elements.bubble, 'hidden'); document.body.removeEventListener('click', handleBodyClick); + document.body.removeEventListener('touchstart', handleBodyClick); } else { removeClass(elements.bubble, 'hidden'); document.body.addEventListener('click', handleBodyClick); + document.body.addEventListener('touchstart', handleBodyClick); } visible = !visible; return false;
bind to body's 'touchstart' event as well, to make stuff work on iSomething
remotestorage_remotestorage.js
train
js
d250ba1776d96f48b86eb1c76f14d4a2e996972b
diff --git a/test/configCases/target/amd-unnamed/index.js b/test/configCases/target/amd-unnamed/index.js index <HASH>..<HASH> 100644 --- a/test/configCases/target/amd-unnamed/index.js +++ b/test/configCases/target/amd-unnamed/index.js @@ -6,5 +6,5 @@ it("should name define", function() { var fs = require("fs"); var source = fs.readFileSync(__filename, "utf-8"); - expect(source).toMatch("define(function("); + expect(source).toMatch(/define\(\[[^\]]*\], function\(/); });
Fix the "should name define" test in configCases/target/amd-unnamed
webpack_webpack
train
js
dbcf4b53b84c52d7c18976e25d85b31f01f266aa
diff --git a/godotenv.go b/godotenv.go index <HASH>..<HASH> 100644 --- a/godotenv.go +++ b/godotenv.go @@ -147,15 +147,20 @@ func Exec(filenames []string, cmd string, cmdArgs []string) error { // Write serializes the given environment and writes it to a file func Write(envMap map[string]string, filename string) error { - content, error := Marshal(envMap) - if error != nil { - return error + content, err := Marshal(envMap) + if err != nil { + return err + } + file, err := os.Create(filename) + if err != nil { + return err } - file, error := os.Create(filename) - if error != nil { - return error + defer file.Close() + _, err = file.WriteString(content) + if err != nil { + return err } - _, err := file.WriteString(content) + file.Sync() return err }
Fixed Write bugs This should address a fix #<I> and #<I> This has not been addressed in any tests.
joho_godotenv
train
go
092dadc688bf84f833b713e865d9f839215d75d6
diff --git a/gwpy/timeseries/statevector.py b/gwpy/timeseries/statevector.py index <HASH>..<HASH> 100644 --- a/gwpy/timeseries/statevector.py +++ b/gwpy/timeseries/statevector.py @@ -366,11 +366,15 @@ class StateVector(TimeSeries): """ if bits is None: bits = [b for b in self.bits if b is not None] - for i, b in enumerate(bits): - if not b in self.bits and isinstance(b): - bits[i] = self.bits[b] + bindex = [] + for b in bits: + try: + bindex.append((self.bits.index(b), b)) + except IndexError as e: + e.args = ('Bit %r not found in StateVector' % b) + raise e self._bitseries = TimeSeriesDict() - for i, bit in enumerate(self.bits): + for i, bit in bindex: self._bitseries[bit] = StateTimeSeries( self.data >> i & 1, name=bit, epoch=self.x0.value, channel=self.channel, sample_rate=self.sample_rate)
StateVector.get_bit_series: fixed bugs - presumably this function didn't work properly before
gwpy_gwpy
train
py
4f124615ecef706112ac0457c47399b7155d676d
diff --git a/app/Blueprint/Webserver/WebserverBlueprint.php b/app/Blueprint/Webserver/WebserverBlueprint.php index <HASH>..<HASH> 100644 --- a/app/Blueprint/Webserver/WebserverBlueprint.php +++ b/app/Blueprint/Webserver/WebserverBlueprint.php @@ -231,9 +231,9 @@ class WebserverBlueprint implements Blueprint { protected function makeServerService(Configuration $config, Configuration $default) : Service { $serverService = new Service(); $serverService->setName($config->get('service-name')); - $serverService->setImage($config->get('docker.image', 'ipunktbs/nginx:1.9.7-7-1.2.9')); + $serverService->setImage($config->get('docker.image', 'ipunktbs/nginx:1.9.7-7-1.2.10')); if( $config->get('debug-image', false) ) - $serverService->setImage($config->get('docker.image', 'ipunktbs/nginx-debug:debug-1.2.9')); + $serverService->setImage($config->get('docker.image', 'ipunktbs/nginx-debug:debug-1.2.10')); if( $config->get('sync-user-into-container', false) ) { $serverService->setEnvironmentVariable('USER_ID', getmyuid());
nginx image update to <I>
ipunkt_rancherize
train
php
d14dfa6a20fc03ef0aa9719ae4c2dec35b59404e
diff --git a/lib/mutator_rails/single_mutate.rb b/lib/mutator_rails/single_mutate.rb index <HASH>..<HASH> 100644 --- a/lib/mutator_rails/single_mutate.rb +++ b/lib/mutator_rails/single_mutate.rb @@ -9,6 +9,7 @@ module MutatorRails parms << preface(path.basename) + base parms << '> ' + log + log_dir cmd = first_run(parms) rerun(cmd)
FOrece log directory to be made
dinj-oss_mutator_rails
train
rb
b20646883b8fd97cbcab476140ec5d4bd150a0f6
diff --git a/eqcorrscan/core/match_filter.py b/eqcorrscan/core/match_filter.py index <HASH>..<HASH> 100644 --- a/eqcorrscan/core/match_filter.py +++ b/eqcorrscan/core/match_filter.py @@ -2982,10 +2982,7 @@ class Detection(object): chans=None, event=None, id=None): """Main class of Detection.""" self.template_name = template_name - if not isinstance(detect_time, UTCDateTime): - self.detect_time = UTCDateTime(detect_time) - else: - self.detect_time = detect_time + self.detect_time = detect_time self.no_chans = int(no_chans) if not isinstance(chans, list): self.chans = [chans]
Do not force detect_time to be UTCDateTime
eqcorrscan_EQcorrscan
train
py
e7ea19f9426827dda243a54b0f4386b5c29a3fb1
diff --git a/dgitcore/datasets/auto.py b/dgitcore/datasets/auto.py index <HASH>..<HASH> 100644 --- a/dgitcore/datasets/auto.py +++ b/dgitcore/datasets/auto.py @@ -14,7 +14,7 @@ from datetime import datetime # Exports ##################################################### -__all__ = ['auto_update', 'auto_init',] +__all__ = ['auto_update', 'auto_init', 'auto_get_repo'] def find_executable_files(): """ @@ -173,7 +173,13 @@ def auto_init(autofile, force_init=False): def auto_get_repo(autooptions, debug=False): """ - Clone this repo if exists. Otherwise create one... + Automatically get repo + + Parameters + ---------- + + autooptions: dgit.json content + """ # plugin manager @@ -297,6 +303,12 @@ def auto_update(autofile, force_init): # find all the files that must be collected files = get_files_to_commit(autooptions) + if len(files) > 10: + print("Large number ({}) files are being added.".format(len(files))) + proceed = input("Do you wish to proceed? [yN] ") + if proceed != 'y': + return + # Add the files to the repo count = auto_add(repo, autooptions, files) if count == 0:
1. Export auto_get_repo as well
pingali_dgit
train
py
dfd931318c6f2e8a4cbdbd99de925b1978338ac8
diff --git a/resource_aws_ecs_task_definition_test.go b/resource_aws_ecs_task_definition_test.go index <HASH>..<HASH> 100644 --- a/resource_aws_ecs_task_definition_test.go +++ b/resource_aws_ecs_task_definition_test.go @@ -82,17 +82,19 @@ func testAccCheckAWSEcsTaskDefinitionDestroy(s *terraform.State) error { continue } - out, err := conn.DescribeTaskDefinition(&ecs.DescribeTaskDefinitionInput{ - TaskDefinition: aws.String(rs.Primary.ID), - }) + input := ecs.DescribeTaskDefinitionInput{ + TaskDefinition: aws.String(rs.Primary.Attributes["arn"]), + } - if err == nil { - if out.TaskDefinition != nil { - return fmt.Errorf("ECS task definition still exists:\n%#v", *out.TaskDefinition) - } + out, err := conn.DescribeTaskDefinition(&input) + + if err != nil { + return err } - return err + if out.TaskDefinition != nil && *out.TaskDefinition.Status != "INACTIVE" { + return fmt.Errorf("ECS task definition still exists:\n%#v", *out.TaskDefinition) + } } return nil
aws: Treat INACTIVE ECS TDs as deleted in acc tests - related to <URL>
terraform-providers_terraform-provider-aws
train
go
d309df2f1b821885a47fa8f2bf5401cf3e1ebf53
diff --git a/test/database_rewinder_test.rb b/test/database_rewinder_test.rb index <HASH>..<HASH> 100644 --- a/test/database_rewinder_test.rb +++ b/test/database_rewinder_test.rb @@ -2,6 +2,12 @@ require 'test_helper' class DatabaseRewinder::DatabaseRewinderTest < ActiveSupport::TestCase + if ActiveRecord::VERSION::STRING >= '5' + self.use_transactional_tests = false + else + self.use_transactional_fixtures = false + end + setup do DatabaseRewinder.init end @@ -117,12 +123,6 @@ class DatabaseRewinder::DatabaseRewinderTest < ActiveSupport::TestCase if ActiveRecord::VERSION::STRING >= '4' sub_test_case 'migrations' do - if ActiveRecord::VERSION::STRING >= '5' - self.use_transactional_tests = false - else - self.use_transactional_fixtures = false - end - test '.clean_all should not touch AR::SchemaMigration' do begin ActiveRecord::Base.connection.initialize_schema_migrations_table
Actually use_transactional_tests for every test
amatsuda_database_rewinder
train
rb
f405c6e4d8985e3438be9c7dbec6d6f2fa015718
diff --git a/lib/accesslib.php b/lib/accesslib.php index <HASH>..<HASH> 100755 --- a/lib/accesslib.php +++ b/lib/accesslib.php @@ -4927,10 +4927,13 @@ function count_role_users($roleid, $context, $parent=false) { $parentcontexts = ''; } - $SQL = "SELECT count(*) - FROM {$CFG->prefix}role_assignments r - WHERE (r.contextid = $context->id $parentcontexts) - AND r.roleid = $roleid"; + $SQL = "SELECT count(u.id) + FROM {$CFG->prefix}role_assignments r + JOIN {$CFG->prefix}user u + ON u.id = r.userid + WHERE (r.contextid = $context->id $parentcontexts) + AND r.roleid = $roleid + AND u.deleted = 0"; return count_records_sql($SQL); }
MDL-<I> count_role_users was showing different count to those returned from get_role_users(), based on patch from Patrick Pollett merged from MOODLE_<I>_STABLE
moodle_moodle
train
php
2b70d5cf8f525fba8d9286bd94451b2c4f18f0ae
diff --git a/lib/page.js b/lib/page.js index <HASH>..<HASH> 100644 --- a/lib/page.js +++ b/lib/page.js @@ -189,13 +189,15 @@ var Page = function( page_path, options ){ if (status == 404) { server.logger.log(page.route + ' [' + resource.name + '] ' + error, 3); } else { - server.logger.log(page.route + ' [' + resource.name + '] ' + error, resource.options.optional ? 1 : 0); - page.logToSentry(error, { - error: err, - resource: {name: resource.name, url: resource.resource.url}, - response: resource_response ? {status: resource_response.status, body: resource_response.data} : null, - context: _.omit(context, 'resources') - }); + server.logger.log(page.route + ' [' + resource.name + '] ' + error, is_optional ? 1 : 0); + if (!is_optional) { + page.logToSentry(error, { + error: err, + resource: {name: resource.name, url: resource.resource.url}, + response: resource_response ? {status: resource_response.status, body: resource_response.data} : null, + context: _.omit(context, 'resources') + }); + } } err = {status: status, error: error, message: err, resource: resource.name};
Do not report optional resource errors to Sentry
solidusjs_solidus
train
js
4d20908d5fb1343729cf96184037559f8844f45b
diff --git a/Swat/SwatCheckboxEntryList.php b/Swat/SwatCheckboxEntryList.php index <HASH>..<HASH> 100644 --- a/Swat/SwatCheckboxEntryList.php +++ b/Swat/SwatCheckboxEntryList.php @@ -134,7 +134,7 @@ class SwatCheckboxEntryList extends SwatCheckboxList $input_tag->removeAttribute('checked'); $input_tag->name = $this->id.'['.$key.']'; - if (in_array($option->value, $this->values)) + if (array_key_exists($key ,$this->values)) $input_tag->checked = 'checked'; $input_tag->id = $this->id.'_'.$checkbox_id; @@ -187,7 +187,7 @@ class SwatCheckboxEntryList extends SwatCheckboxList $checkbox_id = $key.'_'.$value; $widget = $this->getEntryWidget($checkbox_id); $widget->process(); - $this->entry_values[$value] = $widget->value; + $this->entry_values[] = $widget->value; } }
Ticket #<I>, problems occured when two options with the same value were added to the checkbox entry list widget, now when the form is submitted the array keys of the options and those of the values are compared instead of the values names. This allows that right entries to remain checked and other entries with the same value not to become suddenly checked. Also the array of entry_values is now indexed by number and not by values, this prevents two widgets with the same value having only one entry in the entry_values array. svn commit r<I>
silverorange_swat
train
php
aa8bab94e5d2a905c1abd913684fc00ae6db7a69
diff --git a/index.js b/index.js index <HASH>..<HASH> 100644 --- a/index.js +++ b/index.js @@ -20,16 +20,14 @@ HashBase.prototype.update = function (data, encoding) { if (!Buffer.isBuffer(data)) data = new Buffer(data, encoding || 'binary') // consume data + var block = this._block var offset = 0 while (this._blockOffset + data.length - offset >= this._blockSize) { - for (var i = this._blockOffset; i < this._blockSize;) this._block[i++] = data[offset++] + for (var i = this._blockOffset; i < this._blockSize;) block[i++] = data[offset++] this._update() this._blockOffset = 0 } - - while (offset < data.length) { - this._block[this._blockOffset++] = data[offset++] - } + while (offset < data.length) block[this._blockOffset++] = data[offset++] // update length for (var j = 0, carry = data.length * 8; carry > 0; ++j) {
Use this._block as local variable
crypto-browserify_hash-base
train
js
05a26b48300d21e2fe4358e24e6cbc02435603d7
diff --git a/test/index.js b/test/index.js index <HASH>..<HASH> 100644 --- a/test/index.js +++ b/test/index.js @@ -129,4 +129,21 @@ describe('render-to-string', () => { ); }); }); + + describe('className / class massaging', () => { + it('should render class using className', () => { + let rendered = render(<div className="foo bar" />); + expect(rendered).to.equal('<div class="foo bar"></div>'); + }); + + it('should render class using class', () => { + let rendered = render(<div class="foo bar" />); + expect(rendered).to.equal('<div class="foo bar"></div>'); + }); + + it('should prefer className over class', () => { + let rendered = render(<div class="foo" className="foo bar" />); + expect(rendered).to.equal('<div class="foo bar"></div>'); + }); + }); });
Tests for class/className support
developit_preact-render-to-string
train
js
0a48cde2b03d70c276ef4571de00e1c2aa5cead8
diff --git a/src/test/java/stormpot/PoolTest.java b/src/test/java/stormpot/PoolTest.java index <HASH>..<HASH> 100644 --- a/src/test/java/stormpot/PoolTest.java +++ b/src/test/java/stormpot/PoolTest.java @@ -1302,6 +1302,33 @@ public class PoolTest { throws Exception { shutdown(fixture.initPool(config)).await(timeout, null); } + + @Test(timeout = 300) + @Theory public void + mustCompleteShutDownEvenIfAllSlotsHaveNullErrors(PoolFixture fixture) + throws InterruptedException { + Allocator allocator = new CountingAllocator() { + @Override + public Poolable allocate(Slot slot) throws Exception { + return null; + } + }; + Pool pool = givenPoolWithFailedAllocation(fixture, allocator); + // the shut-down procedure must complete before the test times out. + shutdown(pool).await(); + } + + private Pool givenPoolWithFailedAllocation( + PoolFixture fixture, Allocator allocator) { + Pool pool = fixture.initPool(config.setAllocator(allocator)); + try { + // ensure at least one allocation attempt has taken place + pool.claim(); + } catch (Exception _) { + // we don't care about this one + } + return pool; + } // TODO test for resilience against spurious wake-ups? // NOTE: When adding, removing or modifying tests, also remember to update
pools must be able to complete their shut down procedures even if the allocator has only ever returned null.
chrisvest_stormpot
train
java
aa381bce1bf2eb814ead6ce443dfad0580f4a79f
diff --git a/tscreen.go b/tscreen.go index <HASH>..<HASH> 100644 --- a/tscreen.go +++ b/tscreen.go @@ -398,9 +398,12 @@ func (t *tScreen) Fini() { t.clear = false t.fini = true - if t.quit != nil { + select { + case <-t.quit: + // do nothing, already closed + + default: close(t.quit) - t.quit = nil } t.termioFini()
Fix data race in tScreen shutdown Setting t.quit to nil while the mainLoop is running causes a race condition when the Fini() method is called. This change instead uses a select expression to avoid the nil check and set.
gdamore_tcell
train
go
2ab3f288b8b1b0aecb130bc5f374778995c443f6
diff --git a/integration/integration_test.go b/integration/integration_test.go index <HASH>..<HASH> 100644 --- a/integration/integration_test.go +++ b/integration/integration_test.go @@ -37,6 +37,7 @@ import ( // Load all supported backends. _ "github.com/cayleygraph/cayley/graph/bolt" + _ "github.com/cayleygraph/cayley/graph/bolt2" _ "github.com/cayleygraph/cayley/graph/leveldb" _ "github.com/cayleygraph/cayley/graph/memstore" _ "github.com/cayleygraph/cayley/graph/mongo" @@ -452,7 +453,7 @@ func prepare(t testing.TB) { switch *backend { case "memstore": cfg.DatabasePath = "../data/30kmoviedata.nq.gz" - case "leveldb", "bolt": + case "leveldb", "bolt", "bolt2": cfg.DatabasePath = "/tmp/cayley_test_" + *backend cfg.DatabaseOptions = map[string]interface{}{ "nosync": true, // It's a test. If we need to load, do it fast.
add memory profile and bolt2 to main/integration
cayleygraph_cayley
train
go
ea91db187eeff2a25c7cd2d4d206a92d6c1b644e
diff --git a/index.js b/index.js index <HASH>..<HASH> 100644 --- a/index.js +++ b/index.js @@ -32,7 +32,8 @@ function takeScreenshot(title) { } function ProshotReporter(runner) { - runner.on('fail', function(test) { + runner.on('fail', function(test, err) { + test.err = err; return takeScreenshot(test.fullTitle()); }); }
Fix #1: Add a workaround for protractor depending on internal behavior of builtin mocha reporters
rluba_mocha-proshot
train
js
9ee3721dd2b6354409a3d4df682f45719ace8383
diff --git a/lib/xcore.js b/lib/xcore.js index <HASH>..<HASH> 100644 --- a/lib/xcore.js +++ b/lib/xcore.js @@ -237,7 +237,8 @@ XClient.prototype.unpackEvent = function(type, seq, extra, code, raw) var event = {}; // TODO: constructor & base functions // Remove the most significant bit. See Chapter 1, Event Format section in X11 protocol // specification - event.type = type && 0x7F; + type = type & 0x7F; + event.type = type; event.seq = seq; var extUnpacker = this.eventParsers[type];
Really fix the parsing of the event type field - Typo: use the bitwise operator and not the comparison operator
sidorares_node-x11
train
js
a5535bd913324a2e0be4526f2d7129618e36bdde
diff --git a/okhttp/src/main/java/com/squareup/okhttp/OkHttpClient.java b/okhttp/src/main/java/com/squareup/okhttp/OkHttpClient.java index <HASH>..<HASH> 100644 --- a/okhttp/src/main/java/com/squareup/okhttp/OkHttpClient.java +++ b/okhttp/src/main/java/com/squareup/okhttp/OkHttpClient.java @@ -31,7 +31,7 @@ import java.net.ProxySelector; import java.net.URLConnection; import java.security.GeneralSecurityException; import java.security.SecureRandom; -import java.util.Arrays; +import java.util.Collections; import java.util.List; import java.util.concurrent.TimeUnit; import javax.net.SocketFactory; @@ -508,7 +508,7 @@ public class OkHttpClient implements Cloneable { // etc.) may incorrectly be reflected in the request when it is executed. OkHttpClient client = clone(); // Force HTTP/1.1 until the WebSocket over SPDY/HTTP2 spec is finalized. - client.setProtocols(Arrays.asList(Protocol.HTTP_1_1)); + client.setProtocols(Collections.singletonList(Protocol.HTTP_1_1)); return new WebSocket(client, request, new SecureRandom()); }
Use a singleton list which is slightly more efficient.
square_okhttp
train
java
883e4df529e417512f67bbeb558d1473dccf5a93
diff --git a/lib/beaker-pe/install/pe_utils.rb b/lib/beaker-pe/install/pe_utils.rb index <HASH>..<HASH> 100644 --- a/lib/beaker-pe/install/pe_utils.rb +++ b/lib/beaker-pe/install/pe_utils.rb @@ -425,8 +425,8 @@ module Beaker end install_hosts.each do |host| - #windows agents from 4.0 -> 2016.1.2 were only installable via aio method - is_windows_msi_and_aio = (host['platform'] =~ /windows/ && (version_is_less(host['pe_ver'], '2016.3.0') && !version_is_less(host['pe_ver'], '3.99') && !(host['roles'].include?('frictionless')))) + #windows agents from 4.0 -> 2016.1.2 were only installable via the aio method + is_windows_msi_and_aio = (host['platform'] =~ /windows/ && (version_is_less(host['pe_ver'], '2016.3.0') && !version_is_less(host['pe_ver'], '3.99'))) if agent_only_check_needed && hosts_agent_only.include?(host) || is_windows_msi_and_aio host['type'] = 'aio'
PE-<I> Fix windows frictionless upgrades There was an error with my previous PR. PE <I> to PE <I> were failing because the PE <I> install of the windows agent would attempt to install via frictionless, and not with the old msi method. This PR fixes this.
puppetlabs_beaker-pe
train
rb
776c4828074aa9ed218bc9300df25a47cd6c53da
diff --git a/app/src/Bolt/Application.php b/app/src/Bolt/Application.php index <HASH>..<HASH> 100644 --- a/app/src/Bolt/Application.php +++ b/app/src/Bolt/Application.php @@ -9,7 +9,7 @@ class Application extends BaseApplication public function __construct(array $values = array()) { $values['bolt_version'] = '1.3'; - $values['bolt_name'] = 'dev'; + $values['bolt_name'] = 'beta'; parent::__construct($values); }
Bumping version to "<I> beta".
bolt_bolt
train
php
03cf8bfc14a29af99c53e96c369e49e718d657d0
diff --git a/lib/specinfra/helper/configuration.rb b/lib/specinfra/helper/configuration.rb index <HASH>..<HASH> 100644 --- a/lib/specinfra/helper/configuration.rb +++ b/lib/specinfra/helper/configuration.rb @@ -33,6 +33,7 @@ module Specinfra else value = RSpec.configuration.send(c) if defined?(RSpec) end + next if c == :lxc && defined?(Serverspec::Type::Lxc) && value.is_a?(Serverspec::Type::Lxc) Specinfra::Configuration.instance_variable_set("@#{c}", value) end end
Work around for avoid unintentional replacing of lxc configuration
mizzy_specinfra
train
rb
26ed8141e6f076c4631e77b1379272d646e7666e
diff --git a/pdfwatermarker/watermark/utils.py b/pdfwatermarker/watermark/utils.py index <HASH>..<HASH> 100644 --- a/pdfwatermarker/watermark/utils.py +++ b/pdfwatermarker/watermark/utils.py @@ -19,13 +19,12 @@ def bundle_dir(): def register_font(font='Vera.ttf'): """Register fonts for report labs canvas.""" - folder = bundle_dir + os.sep + 'lib' + os.sep + 'font' + folder = bundle_dir() + os.sep + 'lib' + os.sep + 'font' ttfFile = resource_path(os.path.join(folder, font)) pdfmetrics.registerFont(TTFont("Vera", ttfFile)) return ttfFile -bundle_dir = bundle_dir() FONT = register_font() LETTER = letter[1], letter[0] -image_directory = str(bundle_dir + os.sep + 'lib' + os.sep + 'img') \ No newline at end of file +image_directory = str(bundle_dir() + os.sep + 'lib' + os.sep + 'img') \ No newline at end of file
Created utils.py within the watermark module to house helper functions called on imports
mrstephenneal_pdfconduit
train
py
e8535b51510748ed52d51f19225ddbcc3f382c9d
diff --git a/src/props.js b/src/props.js index <HASH>..<HASH> 100644 --- a/src/props.js +++ b/src/props.js @@ -1,4 +1,15 @@ export default { + type: { + type: String, + required: true, + validator: function(value) { + return ( + ["card", "iban", "postalCode", "cardNumber", "cardExpiry", "cardCvc"] + .map(s => s.toLowerCase()) + .indexOf(value.toLowerCase()) > -1 + ) + } + }, stripe: { type: [String, Object], // stripe key or instance required: true @@ -9,10 +20,12 @@ export default { }, options: { type: Object, - required: false + required: false, + default: () => ({}) }, stripeOptions: { type: Object, - required: false + required: false, + default: () => ({}) } }
update(props): extracted props from StripeElement component
Cl3MM_vue-stripe-better-elements
train
js
a0fb0bbad312df06dd0a85453bd4f93ee2e01cbb
diff --git a/airflow/executors/local_executor.py b/airflow/executors/local_executor.py index <HASH>..<HASH> 100644 --- a/airflow/executors/local_executor.py +++ b/airflow/executors/local_executor.py @@ -125,12 +125,12 @@ class LocalWorkerBase(Process, LoggingMixin): ret = 0 return State.SUCCESS except Exception as e: - self.log.error("Failed to execute task %s.", str(e)) + self.log.exception("Failed to execute task %s.", e) + return State.FAILED finally: Sentry.flush() logging.shutdown() os._exit(ret) - raise RuntimeError('unreachable -- keep mypy happy') @abstractmethod def do_work(self):
Log exception in local executor (#<I>)
apache_airflow
train
py
ff80d0e79e15130eab060521ede07a2255de2499
diff --git a/example/src/screens/FirstTabScreen.js b/example/src/screens/FirstTabScreen.js index <HASH>..<HASH> 100644 --- a/example/src/screens/FirstTabScreen.js +++ b/example/src/screens/FirstTabScreen.js @@ -137,6 +137,11 @@ export default class FirstTabScreen extends Component { Navigation.startSingleScreenApp({ screen: { screen: 'example.FirstTabScreen' + }, + drawer: { + left: { + screen: 'example.SideMenu' + } } }); }
Fix example "show single screen app" now will show the side menu (drawer) (#<I>)
wix_react-native-navigation
train
js
6cf4fce09734dea4bac3f3399ee00d5a8f2e3b84
diff --git a/binstar_client/utils/projects/tests/test_projects.py b/binstar_client/utils/projects/tests/test_projects.py index <HASH>..<HASH> 100644 --- a/binstar_client/utils/projects/tests/test_projects.py +++ b/binstar_client/utils/projects/tests/test_projects.py @@ -4,7 +4,7 @@ from binstar_client.utils.projects import get_files def test_get_files(): - pfiles = get_files(example_path('bokeh-apps/weather')) + pfiles = sorted(get_files(example_path('bokeh-apps/weather')), key=lambda x: x['basename']) assert len(pfiles) == 6 assert pfiles[0]['basename'] == '.projectignore' assert pfiles[0]['relativepath'] == '.projectignore'
Make test_projects.py::test_get_files deterministic It relied on list order that apparently was not guaranteed. Sort the list explicitly.
Anaconda-Platform_anaconda-client
train
py
96e206351fafde93f599b0dad674fbfbc1dde23b
diff --git a/openquake/engine/tools/make_html_report.py b/openquake/engine/tools/make_html_report.py index <HASH>..<HASH> 100644 --- a/openquake/engine/tools/make_html_report.py +++ b/openquake/engine/tools/make_html_report.py @@ -164,7 +164,7 @@ SELECT description, oq_job_id, FROM uiapi.job_stats AS s INNER JOIN uiapi.oq_job AS o ON s.oq_job_id=o.id - INNER JOIN uiapi.job_param AS p + LEFT JOIN uiapi.job_param AS p ON o.id=p.job_id AND name='description') AS x WHERE oq_job_id=%s; ''' @@ -274,6 +274,7 @@ def make_report(conn, isodate='today'): tag_status.append(status) stats = fetcher.query(JOB_STATS, job_id)[1:] if not stats: + import pdb; pdb.set_trace() continue (description, job_id, stop_time, status, disk_space, duration) = stats[0]
Failed computations without a JobParam record must appear in the HTML report
gem_oq-engine
train
py
f5c74e6869b54bf6d16bb8493d3c76e9fb65bec5
diff --git a/createdb.py b/createdb.py index <HASH>..<HASH> 100755 --- a/createdb.py +++ b/createdb.py @@ -31,4 +31,9 @@ if '--with-dev-data' in sys.argv: detail_name="registration id", icon="phone", placeholder="laksdjfasdlfkj183097falkfj109f" ) + context4 = fmn.lib.models.Context.create( + session, name="desktop", description="fedmsg-notify", + detail_name="None", icon="console", + placeholder="There's no need to put a value here" + ) session.commit()
Add the desktop context to the setup script.
fedora-infra_fmn.lib
train
py
2ba737a6a56df0eab56ce78ef0e284429474d774
diff --git a/spec/functional/resource/registry_spec.rb b/spec/functional/resource/registry_spec.rb index <HASH>..<HASH> 100644 --- a/spec/functional/resource/registry_spec.rb +++ b/spec/functional/resource/registry_spec.rb @@ -55,19 +55,13 @@ describe Chef::Resource::RegistryKey, :windows_only do def clean_registry # clean 64-bit space on WOW64 - begin - hive_class.open(key_parent, Win32::Registry::KEY_WRITE | 0x0100) do |reg| - reg.delete_key(child, true) - end - rescue - end + @registry.architecture = :x86_64 + @registry.delete_key(reg_parent, true) + @registry.architecture = :machine # clean 32-bit space on WOW64 - begin - hive_class.open(key_parent, Win32::Registry::KEY_WRITE | 0x0200) do |reg| - reg.delete_key(child, true) - end - rescue - end + @registry.architecture = :i386 + @registry.delete_key(reg_parent, true) + @registry.architecture = :machine end def reset_registry
changing tests to use new delete function to delete keys
chef_chef
train
rb
88f9cf21c81684a18af7285bd0e3851fe5227f3c
diff --git a/tests/block/test_get_span.py b/tests/block/test_get_span.py index <HASH>..<HASH> 100644 --- a/tests/block/test_get_span.py +++ b/tests/block/test_get_span.py @@ -52,15 +52,13 @@ def test(first_node_with_tokens): assert result == (1, 13) -@pytest.mark.parametrize( - 'code_str', [ - ''' +@pytest.mark.parametrize('code_str', [ + ''' long_string = """ """ ''', - ] -) +]) def test_context_arrange(first_node_with_tokens): """ Long string spans are counted.
Fix lint: reformat example in get_span tests
jamescooke_flake8-aaa
train
py
a1566dcf02688b1dead42ba4ae17a8f0f56643e5
diff --git a/react/Text/Text.js b/react/Text/Text.js index <HASH>..<HASH> 100644 --- a/react/Text/Text.js +++ b/react/Text/Text.js @@ -49,6 +49,8 @@ const Text = ({ </span> ); +Text.displayName = 'Text'; + Text.propTypes = { children: PropTypes.node.isRequired, className: PropTypes.string,
fix(Text): Add display name to Text component (#<I>) Due to decorating while shallow render snapshots are getting DecoratedComponent rendered instead of Text
seek-oss_seek-style-guide
train
js
df866a976873479d2197f55dcc7800227fd434bc
diff --git a/src/helpers.php b/src/helpers.php index <HASH>..<HASH> 100644 --- a/src/helpers.php +++ b/src/helpers.php @@ -111,8 +111,10 @@ if (! function_exists('config')) { if (! function_exists('file_size_convert')) { function file_size_convert($size) { + if ($size === 0) { + return '0 b'; + } $unit = ['b', 'kb', 'mb', 'gb', 'tb', 'pb']; - return round($size / pow(1024, ($i = floor(log($size, 1024)))), 2).' '.$unit[intval($i)]; } }
:bug: fixed a divide by zero in file_size_convert
tapestry-cloud_tapestry
train
php
83d85454455b5522ba8799c995d2005b8d6940b1
diff --git a/src/unique.js b/src/unique.js index <HASH>..<HASH> 100644 --- a/src/unique.js +++ b/src/unique.js @@ -1,5 +1,5 @@ import _ from 'lodash' -const unique = Symbol('lacona-unique-key') +const unique = Symbol.for('lacona-unique-key') export default unique
Use symbol.for for node environments with potentially multiple loads
laconalabs_elliptical
train
js
9931b3e1833c2502c03f2f345bae7eae875c06da
diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php index <HASH>..<HASH> 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php @@ -1114,6 +1114,7 @@ class Configuration implements ConfigurationInterface ->end() ->children() ->arrayNode('routing') + ->normalizeKeys(false) ->useAttributeAsKey('message_class') ->beforeNormalization() ->always() @@ -1173,6 +1174,7 @@ class Configuration implements ConfigurationInterface ->end() ->end() ->arrayNode('transports') + ->normalizeKeys(false) ->useAttributeAsKey('name') ->arrayPrototype() ->beforeNormalization() @@ -1220,6 +1222,7 @@ class Configuration implements ConfigurationInterface ->scalarNode('default_bus')->defaultNull()->end() ->arrayNode('buses') ->defaultValue(['messenger.bus.default' => ['default_middleware' => true, 'middleware' => []]]) + ->normalizeKeys(false) ->useAttributeAsKey('name') ->arrayPrototype() ->addDefaultsIfNotSet()
[Messenger] fix broken key normalization
symfony_symfony
train
php
b3a6f27c1edf5d0f366effef482521a8c692e133
diff --git a/tapeforms/fieldsets.py b/tapeforms/fieldsets.py index <HASH>..<HASH> 100644 --- a/tapeforms/fieldsets.py +++ b/tapeforms/fieldsets.py @@ -147,7 +147,7 @@ class TapeformFieldsetsMixin: fieldsets = fieldsets or self.fieldsets if not fieldsets: - raise StopIteration + return # Search for primary marker in at least one of the fieldset kwargs. has_primary = any(fieldset.get('primary') for fieldset in fieldsets)
Replace StopIteration raising by return
stephrdev_django-tapeforms
train
py
71bc6ff9b4676e3f056266a04966b01a9f3e6216
diff --git a/docs/_component/editor.client.js b/docs/_component/editor.client.js index <HASH>..<HASH> 100644 --- a/docs/_component/editor.client.js +++ b/docs/_component/editor.client.js @@ -119,6 +119,15 @@ export const Editor = ({children}) => { ) const stats = state.file ? statistics(state.file) : {} + // Create a preview component that can handle errors with try-catch block; for catching invalid JS expressions errors that ErrorBoundary cannot catch. + const Preview = useCallback(() => { + try { + return state.file.result() + } catch (error) { + return <FallbackComponent error={error} /> + } + }, [state]) + return ( <div> <Tabs className="frame"> @@ -232,11 +241,7 @@ export const Editor = ({children}) => { <TabPanel> <noscript>Enable JavaScript for the rendered result.</noscript> <div className="frame-body frame-body-box-fixed-height frame-body-box"> - {state.file && state.file.result ? ( - <ErrorBoundary FallbackComponent={FallbackComponent}> - {state.file.result()} - </ErrorBoundary> - ) : null} + {state.file && state.file.result ? <Preview /> : null} </div> </TabPanel> <TabPanel>
Fix playground exceptions (#<I>) Closes GH-<I>.
mdx-js_mdx
train
js
d2699c759b4751741c1d30752f14dd61993b3be5
diff --git a/th_evernote/tests.py b/th_evernote/tests.py index <HASH>..<HASH> 100644 --- a/th_evernote/tests.py +++ b/th_evernote/tests.py @@ -17,7 +17,7 @@ except ImportError: import mock -cache = caches['th_evernote'] +cache = caches['django_th'] class EvernoteTest(MainTest): @@ -138,9 +138,6 @@ class ServiceEvernoteTest(EvernoteTest): self.assertIn('consumer_secret', settings.TH_EVERNOTE) self.assertIn('sandbox', settings.TH_EVERNOTE) - def test_get_config_th_cache(self): - self.assertIn('th_evernote', settings.CACHES) - def test_get_evernote_client(self, token=None): """ get the token from evernote
Dropped get config cache and replaced variable REPLACED: cache = caches['th_<service>'] With cache = caches['django_th'] REMOVED: def test_get_config_th_cache(self): self.assertIn('th_rss', settings.CACHES)
push-things_django-th
train
py
403bda833422264fa3246973faf7b7e08cdb0650
diff --git a/test/instrumentation/modules/pg/knex.js b/test/instrumentation/modules/pg/knex.js index <HASH>..<HASH> 100644 --- a/test/instrumentation/modules/pg/knex.js +++ b/test/instrumentation/modules/pg/knex.js @@ -13,6 +13,11 @@ var agent = require('../../../..').start({ var knexVersion = require('knex/package').version var semver = require('semver') +if (semver.gte(knexVersion, '0.21.0') && semver.lt(process.version, '10.0.0')) { + // Skip these tests: knex@0.21.x dropped support for node v8. + process.exit(0) +} + var Knex = require('knex') var test = require('tape')
fix(tests): skip testing knex >=<I> with node v8 (#<I>) Fixes #<I>
elastic_apm-agent-nodejs
train
js
f49a40609ea3011e05aa54553a8559055e93044e
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100755 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ from setuptools import setup, find_packages setup( name='psamm', version='0.7', - description='PSAMM metabolic modelrm -ing tools', + description='PSAMM metabolic modeling tools', maintainer='Jon Lund Steffensen', maintainer_email='jon_steffensen@uri.edu', url='https://github.com/zhanglab/model_script',
Fix accidental typo in setup.py
zhanglab_psamm
train
py
e0763b2abfa5095d82a4035ed00cc44b47228858
diff --git a/webpack/test.js b/webpack/test.js index <HASH>..<HASH> 100644 --- a/webpack/test.js +++ b/webpack/test.js @@ -15,7 +15,7 @@ const config = merge.smart(baseConfig, { }, { test: /targets\/.*\.js$/, - loader: 'null', + loader: 'babel?presets[]=es2015', }, ], },
chore(targets): allow es6 for targets code
xodio_xod
train
js
85766ba40ed53be70586dbdebeafcd0cbd5c1325
diff --git a/src/Bootstrap/Drupal.php b/src/Bootstrap/Drupal.php index <HASH>..<HASH> 100644 --- a/src/Bootstrap/Drupal.php +++ b/src/Bootstrap/Drupal.php @@ -257,7 +257,8 @@ class Drupal implements DrupalInterface { $drupal = new DrupalConsoleCore( $this->drupalFinder->getComposerRoot(), - $this->drupalFinder->getDrupalRoot() + $this->drupalFinder->getDrupalRoot(), + $this->drupalFinder ); return $drupal->boot();
"[console] Pass DrupalFinder to DrupalConsoleCore." (#<I>) * [console] Show message only on list command. * [console] Pass DrupalFinder to DrupalConsoleCore.
hechoendrupal_drupal-console
train
php
fca1185935ec1454b5374f2b656d8c9f79d55056
diff --git a/lib/operations/collection_ops.js b/lib/operations/collection_ops.js index <HASH>..<HASH> 100644 --- a/lib/operations/collection_ops.js +++ b/lib/operations/collection_ops.js @@ -233,7 +233,7 @@ function countDocuments(coll, query, options, callback) { coll.aggregate(pipeline, options, (err, result) => { if (err) return handleCallback(callback, err); result.toArray((err, docs) => { - if (err) handleCallback(err); + if (err) return handleCallback(err); handleCallback(callback, null, docs.length ? docs[0].n : 0); }); });
fix(count-documents): return callback on error case otherwise the scucess handler is called, which results into further missleading errors (e.g. length is not defined)
mongodb_node-mongodb-native
train
js
c02de2329bd6503cf07127b3a66f4682edd6f501
diff --git a/httpcache4j-api/src/main/java/org/codehaus/httpcache4j/MIMEType.java b/httpcache4j-api/src/main/java/org/codehaus/httpcache4j/MIMEType.java index <HASH>..<HASH> 100644 --- a/httpcache4j-api/src/main/java/org/codehaus/httpcache4j/MIMEType.java +++ b/httpcache4j-api/src/main/java/org/codehaus/httpcache4j/MIMEType.java @@ -110,7 +110,7 @@ public final class MIMEType implements Serializable { @Override public int hashCode() { - return new HashCodeBuilder(10, 31).append(getPrimaryType()).append(getSubType()).toHashCode(); + return new HashCodeBuilder(11, 31).append(getPrimaryType()).append(getSubType()).toHashCode(); } public boolean includes(MIMEType mimeType) {
- hashcodebuilder expected first number to be odd git-svn-id: file:///home/projects/httpcache4j/tmp/scm-svn-tmp/trunk@<I> aeef7db8-<I>a-<I>-b<I>-bac<I>ff<I>f6
httpcache4j_httpcache4j
train
java
fd88a56c5518734faf7438a948b582997d6b2f8a
diff --git a/lib/jekyll/post.rb b/lib/jekyll/post.rb index <HASH>..<HASH> 100644 --- a/lib/jekyll/post.rb +++ b/lib/jekyll/post.rb @@ -63,7 +63,7 @@ module Jekyll # # Returns <String> def dir - path = @categories ? '/' + @categories.join('/') : '' + path = (@categories && !@categories.empty?) ? '/' + @categories.join('/') : '' if permalink permalink.to_s.split("/")[0..-2].join("/") else
fix double slash caused by empty categories
jekyll_jekyll
train
rb
001f842e23f1c5e784e26042c0f52c1d2c1abf7a
diff --git a/provider/azure/azure_discover.go b/provider/azure/azure_discover.go index <HASH>..<HASH> 100644 --- a/provider/azure/azure_discover.go +++ b/provider/azure/azure_discover.go @@ -117,6 +117,8 @@ func fetchAddrsWithTags(tagName string, tagValue string, vmnet network.Interface var id string if v.ID != nil { id = *v.ID + } else { + id = "ip address id not found" } if v.Tags == nil { l.Printf("[DEBUG] discover-azure: Interface %s has no tags", id) @@ -167,6 +169,8 @@ func fetchAddrsWithVmScaleSet(resourceGroup string, vmScaleSet string, vmnet net var id string if v.ID != nil { id = *v.ID + } else { + id = "ip address id not found" } if v.IPConfigurations == nil { l.Printf("[DEBUG] discover-azure: Interface %s had no ip configuration", id)
better message in case id is nil
hashicorp_go-discover
train
go
9811cfa802bee5707276d77ffc958e5ab3ccc213
diff --git a/src/shared/js/ch.Validation.js b/src/shared/js/ch.Validation.js index <HASH>..<HASH> 100644 --- a/src/shared/js/ch.Validation.js +++ b/src/shared/js/ch.Validation.js @@ -180,7 +180,7 @@ this.error = null; this - .on('exists', function (data) { + .on('exist', function (data) { this._mergeConditions(data.conditions); }) // Clean the validation if is shown; diff --git a/src/shared/js/ch.factory.js b/src/shared/js/ch.factory.js index <HASH>..<HASH> 100644 --- a/src/shared/js/ch.factory.js +++ b/src/shared/js/ch.factory.js @@ -75,7 +75,7 @@ } else { if (data.emit !== undefined) { - data.emit('exists', options); + data.emit('exist', options); } }
#<I> Factory: rename exists with exist
mercadolibre_chico
train
js,js
1610ad84ca184bf43a11784134a89cf995d1cfb5
diff --git a/lib/jsonapi/resource.rb b/lib/jsonapi/resource.rb index <HASH>..<HASH> 100644 --- a/lib/jsonapi/resource.rb +++ b/lib/jsonapi/resource.rb @@ -537,6 +537,7 @@ module JSONAPI associations = _lookup_association_chain([records.model.to_s, *model_names]) joins_query = _build_joins([records.model, *associations]) + # _sorting is appended to avoid name clashes with manual joins eg. overriden filters order_by_query = "#{associations.last.name}_sorting.#{column_name} #{direction}" records = records.joins(joins_query).order(order_by_query) else diff --git a/test/controllers/controller_test.rb b/test/controllers/controller_test.rb index <HASH>..<HASH> 100644 --- a/test/controllers/controller_test.rb +++ b/test/controllers/controller_test.rb @@ -327,8 +327,6 @@ class PostsControllerTest < ActionController::TestCase assert_equal post.id.to_s, json_response['data'][-2]['id'], 'alphabetically first user is second last' end - end - def test_invalid_sort_param get :index, params: {sort: 'asdfg'}
Add comment for order by query and fix typo
cerebris_jsonapi-resources
train
rb,rb
a62dd3b7805e925daa2c6920522ec973d4f39828
diff --git a/test/extended/images/layers.go b/test/extended/images/layers.go index <HASH>..<HASH> 100644 --- a/test/extended/images/layers.go +++ b/test/extended/images/layers.go @@ -66,8 +66,7 @@ var _ = g.Describe("[Feature:ImageLayers] Image layer subresource", func() { if !ok { return false, nil } - o.Expect(ref.ImageMissing).To(o.BeTrue()) - return true, nil + return ref.ImageMissing, nil }) o.Expect(err).NotTo(o.HaveOccurred()) })
ImageLayers test should loop until image is missing In the event we do fill the cache
openshift_origin
train
go
8c708b4f3d104e0de00f9f13ff88a10a5bb68c24
diff --git a/harpoon/overview.py b/harpoon/overview.py index <HASH>..<HASH> 100644 --- a/harpoon/overview.py +++ b/harpoon/overview.py @@ -176,7 +176,10 @@ class Harpoon(object): configuration.converters.done(path, meta.result) for key, v in val.items(ignore_converters=True): + if isinstance(v, MergedOptions): + v.ignore_converters = True meta.result[key] = v + return spec.normalise(meta, meta.result) converter = Converter(convert=convert_image, convert_path=["images", image])
Make sure converter doesn't trip over itself
delfick_harpoon
train
py
9693695d2b732c5a0298f90db8fabadaee780da6
diff --git a/examples/i18n/I18n.php b/examples/i18n/I18n.php index <HASH>..<HASH> 100644 --- a/examples/i18n/I18n.php +++ b/examples/i18n/I18n.php @@ -9,12 +9,12 @@ class I18n extends Mustache { public $__ = array(__CLASS__, '__trans'); // A *very* small i18n dictionary :) - private $dictionary = array( + private static $dictionary = array( 'Hello.' => 'Hola.', 'My name is {{ name }}.' => 'Me llamo {{ name }}.', ); - public function __trans($text) { - return isset($this->dictionary[$text]) ? $this->dictionary[$text] : $text; + public static function __trans($text) { + return isset(self::$dictionary[$text]) ? self::$dictionary[$text] : $text; } -} \ No newline at end of file +}
Fix E_STRICT failure in i<I>n example.
bobthecow_mustache.php
train
php
13a371c5a2bb213d069dd6c3b33802edc54b13fa
diff --git a/micrometer-core/src/main/java/io/micrometer/core/instrument/binder/cache/JCacheMetrics.java b/micrometer-core/src/main/java/io/micrometer/core/instrument/binder/cache/JCacheMetrics.java index <HASH>..<HASH> 100644 --- a/micrometer-core/src/main/java/io/micrometer/core/instrument/binder/cache/JCacheMetrics.java +++ b/micrometer-core/src/main/java/io/micrometer/core/instrument/binder/cache/JCacheMetrics.java @@ -118,7 +118,7 @@ public class JCacheMetrics implements MeterBinder { "The number of times cache lookup methods have not returned a value"), objectName, CacheStatistics.CacheMisses::get); - registry.gauge(registry.createId(name + ".puts", tags, "Cache removals"), + registry.gauge(registry.createId(name + ".puts", tags, "Cache puts"), objectName, CacheStatistics.CachePuts::get); registry.gauge(registry.createId(name + ".removals", tags, "Cache removals"),
Nit - fix JCache put gauge description
micrometer-metrics_micrometer
train
java
f34a65b66a0f8787cea67b9e971f0bfb7ddd7237
diff --git a/pandas/tests/groupby/test_apply.py b/pandas/tests/groupby/test_apply.py index <HASH>..<HASH> 100644 --- a/pandas/tests/groupby/test_apply.py +++ b/pandas/tests/groupby/test_apply.py @@ -1177,3 +1177,25 @@ def test_apply_empty_string_nan_coerce_bug(): index=MultiIndex.from_tuples([(1, ""), (2, "")], names=["a", "b"]), ) tm.assert_frame_equal(result, expected) + + +@pytest.mark.parametrize("index_values", [[1, 2, 3], [1.0, 2.0, 3.0]]) +def test_apply_index_key_error_bug(index_values): + # GH 44310 + result = DataFrame( + { + "a": ["aa", "a2", "a3"], + "b": [1, 2, 3], + }, + index=Index(index_values), + ) + expected = DataFrame( + { + "b_mean": [2.0, 3.0, 1.0], + }, + index=Index(["a2", "a3", "aa"], name="a"), + ) + result = result.groupby("a").apply( + lambda df: Series([df["b"].mean()], index=["b_mean"]) + ) + tm.assert_frame_equal(result, expected)
TST: group by - apply Key Error (#<I>) * Test for Group By - Apply Key Error * Paramaters change
pandas-dev_pandas
train
py
91537a888d790f39e734a63c06f6439b2b7877bf
diff --git a/lib/completionlib.php b/lib/completionlib.php index <HASH>..<HASH> 100644 --- a/lib/completionlib.php +++ b/lib/completionlib.php @@ -652,7 +652,7 @@ WHERE return $result; } - public function inform_grade_changed($cm, &$item, &$grade, $deleted) { + public function inform_grade_changed($cm, $item, $grade, $deleted) { // Bail out now if completion is not enabled for course-module, grade // is not used to compute completion, or this is a different numbered // grade @@ -682,11 +682,11 @@ WHERE * <p> * (Internal function. Not private, so we can unit-test it.) * - * @param grade_item &$item - * @param grade_grade &$grade + * @param grade_item $item + * @param grade_grade $grade * @return int Completion state e.g. COMPLETION_INCOMPLETE */ - function internal_get_grade_state(&$item, &$grade) { + function internal_get_grade_state($item, $grade) { if (!$grade) { return COMPLETION_INCOMPLETE; }
MDL-<I> & operator is often not needed in PHP5 in method definition
moodle_moodle
train
php
bbe881f882d949f5de15e9663e1fbc2d578d3058
diff --git a/generators/server/index.js b/generators/server/index.js index <HASH>..<HASH> 100644 --- a/generators/server/index.js +++ b/generators/server/index.js @@ -635,7 +635,7 @@ module.exports = class JHipsterServerGenerator extends BaseBlueprintGenerator { 'java:docker:dev': 'npm run java:docker -- -Pdev,webapp', 'java:docker:prod': 'npm run java:docker -- -Pprod', 'ci:backend:test': - 'npm run backend:info && npm run backend:doc:test && npm run backend:nohttp:test && npm run backend:unit:test -- -P$npm_package_config_default_environment', + 'npm run backend:info && npm run backend:doc:test && npm run backend:nohttp:test && npm run backend:unit:test -- -Djhipster-tests.keep-containers-running=false -P$npm_package_config_default_environment', 'ci:e2e:package': 'npm run java:$npm_package_config_packaging:$npm_package_config_default_environment -- -Pe2e -Denforcer.skip=true', 'preci:e2e:server:start': 'npm run docker:db:await --if-present && npm run docker:others:await --if-present',
variabilize container reuse flag on testcontainers and set it to false on CI
jhipster_generator-jhipster
train
js
92574de13ad1c4a03a3bfe9fadebec8781b6b0ba
diff --git a/lib/bson/binary.rb b/lib/bson/binary.rb index <HASH>..<HASH> 100644 --- a/lib/bson/binary.rb +++ b/lib/bson/binary.rb @@ -134,7 +134,7 @@ module BSON encode_binary_data_with_placeholder(encoded) do |encoded| encoded << SUBTYPES.fetch(type) encoded << data.bytesize.to_bson if type == :old - encoded << data + encoded << data.encode(UTF8).force_encoding(BINARY) end end
Encode to UTF-8 before forcing BINARY encoding in Binary#to_bson
mongodb_bson-ruby
train
rb
208b32aac7a29d0f4f608201839b009000dd63c5
diff --git a/lib/less/environments/browser.js b/lib/less/environments/browser.js index <HASH>..<HASH> 100644 --- a/lib/less/environments/browser.js +++ b/lib/less/environments/browser.js @@ -172,15 +172,6 @@ less.Parser.environment = { var hrefParts = this.extractUrlParts(filename, window.location.href); var href = hrefParts.url; - // TODO - use pathDiff in less.node - /*if (env.relativeUrls) { - if (env.rootpath) { - newFileInfo.rootpath = extractUrlParts(env.rootpath + pathDiff(hrefParts.path, newFileInfo.entryPath)).path; - } else { - newFileInfo.rootpath = hrefParts.path; - } - }*/ - if (env.useFileCache && fileCache[href]) { try { var lessText = fileCache[href];
remove commented out code now implemented in parser
less_less.js
train
js
8a392d4ebcbf231d45272a4d987f3a81db438254
diff --git a/src/main/java/org/zeroturnaround/zip/ZipUtil.java b/src/main/java/org/zeroturnaround/zip/ZipUtil.java index <HASH>..<HASH> 100644 --- a/src/main/java/org/zeroturnaround/zip/ZipUtil.java +++ b/src/main/java/org/zeroturnaround/zip/ZipUtil.java @@ -357,6 +357,9 @@ public final class ZipUtil { try { action.process(is, e); } + catch (ZipBreakException ex) { + break; + } finally { IOUtils.closeQuietly(is); } @@ -426,7 +429,12 @@ public final class ZipUtil { ZipInputStream in = new ZipInputStream(new BufferedInputStream(is)); ZipEntry entry; while ((entry = in.getNextEntry()) != null) { - action.process(in, entry); + try { + action.process(in, entry); + } + catch (ZipBreakException ex) { + break; + } } } catch (IOException e) {
Breaking from the iterate method with an exception
zeroturnaround_zt-zip
train
java
caada65f9bb6abfede5560466ed33b88a4305c5d
diff --git a/core-bundle/src/EventListener/InitializeSystemListener.php b/core-bundle/src/EventListener/InitializeSystemListener.php index <HASH>..<HASH> 100644 --- a/core-bundle/src/EventListener/InitializeSystemListener.php +++ b/core-bundle/src/EventListener/InitializeSystemListener.php @@ -42,6 +42,11 @@ class InitializeSystemListener extends ScopeAwareListener private $rootDir; /** + * @var bool + */ + private $isBooted = false; + + /** * Constructor. * * @param RouterInterface $router The router object @@ -139,6 +144,11 @@ class InitializeSystemListener extends ScopeAwareListener */ private function boot(Request $request = null) { + // do not boot twice + if ($this->booted()) { + return; + } + $this->includeHelpers(); // Try to disable the PHPSESSID @@ -181,6 +191,19 @@ class InitializeSystemListener extends ScopeAwareListener $this->triggerInitializeSystemHook(); $this->checkRequestToken(); + + // set booted + $this->isBooted = true; + } + + /** + * Check is booted + * + * @return bool + */ + private function booted() + { + return $this->isBooted; } /**
[Core] do not boot Contao's Framework twice
contao_contao
train
php
390b999aa80c60fd86156f5da70caa46fb870670
diff --git a/lib/rufus/decision/hashes.rb b/lib/rufus/decision/hashes.rb index <HASH>..<HASH> 100644 --- a/lib/rufus/decision/hashes.rb +++ b/lib/rufus/decision/hashes.rb @@ -203,11 +203,18 @@ module Decision # def self.check_and_eval(ruby_code, bndng=binding()) - TREECHECKER.check(ruby_code) - + begin + TREECHECKER.check(ruby_code) + rescue + raise $!, "Error parsing #{ruby_code} -> #{$!}", $!.backtrace + end # OK, green for eval... - eval(ruby_code, bndng) + begin + eval(ruby_code, bndng) + rescue + raise $!, "Error evaling #{ruby_code} -> #{$!}", $!.backtrace + end end end end diff --git a/lib/rufus/decision/table.rb b/lib/rufus/decision/table.rb index <HASH>..<HASH> 100644 --- a/lib/rufus/decision/table.rb +++ b/lib/rufus/decision/table.rb @@ -406,7 +406,11 @@ module Decision next if value == nil || value == '' - value = Rufus::dsub(value, hash) + begin + value = Rufus::dsub(value, hash) + rescue + raise $!, "Error substituting in #{value} -> #{$!}", $!.backtrace + end hash[out_header] = if @options[:accumulate] #
wrap some potential exception points for ruby_eval with more info
jmettraux_rufus-decision
train
rb,rb
4c5bef3b320104d9838db4cb60637b547f32848a
diff --git a/pymatgen/core/tests/test_lattice.py b/pymatgen/core/tests/test_lattice.py index <HASH>..<HASH> 100644 --- a/pymatgen/core/tests/test_lattice.py +++ b/pymatgen/core/tests/test_lattice.py @@ -476,7 +476,7 @@ class LatticeTestCase(PymatgenTest): s1 = np.array([0.5, -1.5, 3]) s2 = np.array([0.5, 3., -1.5]) s3 = np.array([2.5, 1.5, -4.]) - self.assertEqual(m.get_miller_index_from_sites([s1, s2, s3]), + self.assertEqual(m.get_miller_index_from_coords([s1, s2, s3]), (2, 1, 1)) # test on a hexagonal system
TST: Fix typo in Lattice tests
materialsproject_pymatgen
train
py
a098a71ad00626322eeff8d421f25e2236b571b3
diff --git a/shoebot/__init__.py b/shoebot/__init__.py index <HASH>..<HASH> 100644 --- a/shoebot/__init__.py +++ b/shoebot/__init__.py @@ -82,6 +82,9 @@ class Bot: self.WIDTH = Bot.DEFAULT_WIDTH self.HEIGHT = Bot.DEFAULT_HEIGHT + + if self.gtkmode: + import gtkexcepthook if canvas: self.canvas = canvas @@ -340,7 +343,6 @@ class Bot: sys.exit() else: # if on gtkmode, print the error and don't break - import gtkexcepthook raise ShoebotError(errmsg)
fixed a minor error with gtkexcepthook that prevented to redirect some exceptions
shoebot_shoebot
train
py