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
f46cdf1983b8c0b3b73b9eabf0b248a75f8148d7
diff --git a/src/Storageless/Http/SessionMiddleware.php b/src/Storageless/Http/SessionMiddleware.php index <HASH>..<HASH> 100644 --- a/src/Storageless/Http/SessionMiddleware.php +++ b/src/Storageless/Http/SessionMiddleware.php @@ -210,8 +210,12 @@ final class SessionMiddleware implements MiddlewareInterface */ private function extractSessionContainer(?Token $token) : SessionInterface { + if (! $token) { + return DefaultSessionData::newEmptySession(); + } + try { - if (null === $token || ! $token->verify($this->signer, $this->verificationKey)) { + if (! $token->verify($this->signer, $this->verificationKey)) { return DefaultSessionData::newEmptySession(); }
Removing mutant: the token does not need to be checked for `null` equality, since it has only two possible types, `null|Token`
psr7-sessions_storageless
train
php
a94097940a2af4f9902f849e0b080ff20981c8e9
diff --git a/proselint/command_line.py b/proselint/command_line.py index <HASH>..<HASH> 100644 --- a/proselint/command_line.py +++ b/proselint/command_line.py @@ -121,10 +121,10 @@ def show_errors(filename, errors, output_json=False, compact=False): out.append({ "check": e[0], "message": e[1], - "line": e[2], - "column": e[3], - "start": e[4], - "end": e[5], + "line": 1 + e[2], + "column": 1 + e[3], + "start": 1 + e[4], + "end": 1 + e[5], "extent": e[6], "severity": e[7], "replacements": e[8],
Fix off-by-one error in JSON output
amperser_proselint
train
py
7c0d68b1bce27d026b69e3a069c549ab560b0f3d
diff --git a/spillway/mixins.py b/spillway/mixins.py index <HASH>..<HASH> 100644 --- a/spillway/mixins.py +++ b/spillway/mixins.py @@ -9,7 +9,8 @@ class FormMixin(object): """Returns a validated form dict or an empty dict.""" _form = getattr(self, '_form', False) if not _form: - self._form = self.form_class(self.request.GET or self.request.POST, - self.request.FILES or None) + self._form = self.form_class( + self.request.QUERY_PARAMS or self.request.DATA, + self.request.FILES or None) valid = self._form.is_valid() return self._form
Use DRF query params and data request attrs
bkg_django-spillway
train
py
9915bb873c653e1bc74f21ddbbbd8a0818087782
diff --git a/src/ol/feature.js b/src/ol/feature.js index <HASH>..<HASH> 100644 --- a/src/ol/feature.js +++ b/src/ol/feature.js @@ -21,6 +21,8 @@ goog.require('ol.style.Style'); * attribute properties, similar to the features in vector file formats like * GeoJSON. * Features can be styled individually or use the style of their vector layer. + * Note that attribute properties are set as {@link ol.Object} properties on the + * feature object, so they are observable, and have get/set accessors. * * @constructor * @extends {ol.Object}
Document that feature properties are set as object properties
openlayers_openlayers
train
js
ea2e2875722727b2f13a53a71369c0d2b1c98354
diff --git a/p2p/host/autonat/svc.go b/p2p/host/autonat/svc.go index <HASH>..<HASH> 100644 --- a/p2p/host/autonat/svc.go +++ b/p2p/host/autonat/svc.go @@ -145,10 +145,8 @@ func (as *AutoNATService) doDial(pi pstore.PeerInfo) *pb.Message_DialResponse { log.Debugf("error dialing %s: %s", pi.ID.Pretty(), err.Error()) // wait for the context to timeout to avoid leaking timing information // this renders the service ineffective as a port scanner - select { - case <-ctx.Done(): - return newDialResponseError(pb.Message_E_DIAL_ERROR, "dial failed") - } + <-ctx.Done() + return newDialResponseError(pb.Message_E_DIAL_ERROR, "dial failed") } conns := as.dialer.Network().ConnsToPeer(pi.ID)
no need to select; it's a one shot sync
libp2p_go-libp2p
train
go
581b94e94f3ba3008ee1850b0040d3f259c43e50
diff --git a/acos_client/v21/slb/common.py b/acos_client/v21/slb/common.py index <HASH>..<HASH> 100644 --- a/acos_client/v21/slb/common.py +++ b/acos_client/v21/slb/common.py @@ -15,5 +15,5 @@ import acos_client.v30.base as base -class SLBCommon(base.BaseV30): - pass +class SLBCommon(base.BaseV21): + raise NotImplementedError("slb.common support is not available using AXAPI v2.1")
slb.common stub for <I> now uses <I> base like it should slb.common for <I> now throws exceptions if people try to get crafty
a10networks_acos-client
train
py
b9b108f53fe661879b6a79e835a6b8161059b82d
diff --git a/lib/pos.js b/lib/pos.js index <HASH>..<HASH> 100644 --- a/lib/pos.js +++ b/lib/pos.js @@ -34,6 +34,10 @@ class SourcePos { this.column = column; } + /** @member {string} module:pos.SourcePos#name */ + /** @member {number} module:pos.SourcePos#line */ + /** @member {number} module:pos.SourcePos#column */ + /** * Creates a new `SourcePos` instance initialized with `line = 1` and `column = 1`. * @param {string} name Name of the source.
:memo: Add member tags
susisu_loquat-core
train
js
dae35a6532e54c8767ed3c4bef8eb230d69f217a
diff --git a/src/Asset/Widget/Queue.php b/src/Asset/Widget/Queue.php index <HASH>..<HASH> 100644 --- a/src/Asset/Widget/Queue.php +++ b/src/Asset/Widget/Queue.php @@ -95,7 +95,7 @@ class Queue implements QueueInterface public function process($html) { /** @var WidgetAssetInterface $widget */ - foreach ($this->sort($this->queue) as $widget) { + foreach ($this->queue as $widget) { if ($widget->getType() === 'frontend' && $widget->isDeferred()) { $html = $this->addDeferredJavaScript($widget, $html); } @@ -160,7 +160,8 @@ class Queue implements QueueInterface { $html = null; - foreach ($this->queue as $widget) { + /** @var WidgetAssetInterface $widget */ + foreach ($this->sort($this->queue) as $widget) { if ($widget->getType() === $type && $widget->getLocation() === $location) { $html .= $this->addWidgetHolder($widget); }
Sort widgets on render() not process() Widget::process() only inserts a JavaScript snippet if any of the widgets are deferred. Whereas unlike files, the output is done in render() and the sorting should be done here.
bolt_bolt
train
php
a71d634cf350ac4045328718f77324c0172744b6
diff --git a/core/kernel/persistence/smoothsql/class.Utils.php b/core/kernel/persistence/smoothsql/class.Utils.php index <HASH>..<HASH> 100644 --- a/core/kernel/persistence/smoothsql/class.Utils.php +++ b/core/kernel/persistence/smoothsql/class.Utils.php @@ -152,6 +152,11 @@ class core_kernel_persistence_smoothsql_Utils $dbWrapper = core_kernel_classes_DbWrapper::singleton(); + // Take care of RDFS Literals! + if ($pattern instanceof core_kernel_classes_Literal) { + $pattern = $pattern->__toString(); + } + switch (gettype($pattern)) { case 'object' : if ($pattern instanceof core_kernel_classes_Resource) {
search resilience upgrade with core_kernel_classes_Literal as search patterns.
oat-sa_generis
train
php
01d4379ec8f9be8b7226bb53f6822afe471fcafa
diff --git a/src/js/components/content.js b/src/js/components/content.js index <HASH>..<HASH> 100644 --- a/src/js/components/content.js +++ b/src/js/components/content.js @@ -12,14 +12,18 @@ quail.components.content = { * @param {jQuery} $element * The DOM element wrapper in jQuery to search for a content element within. * @return {jQuery} - * The jQuery element that is considered the content element. + * The jQuery element that is considered the most likely content element. */ findContent : function($element) { var $topScore = $element; if($element.find('[role=main]').length) { $element.find('[role=main]').first(); } - $('p').each(function() { + //If there are no paragraphs in the subject at all, we return the subject. + if($element.find('p').length === 0) { + return $element; + } + $element.find('p').each(function() { var $parent = $(this).parent(); var element = $parent.get(0); var contentScore = $parent.data('content-score') || 0;
Fixed error with content finding component finding any element on the page.
quailjs_quail
train
js
71788ab5aa1b394d8393d7567bd2c8c7bf8ee318
diff --git a/openquake/calculators/event_based.py b/openquake/calculators/event_based.py index <HASH>..<HASH> 100644 --- a/openquake/calculators/event_based.py +++ b/openquake/calculators/event_based.py @@ -46,8 +46,9 @@ def weight(src): """ :returns: source weight multiplied by the total occurrence rate """ - tot_rate = sum(rate for mag, rate in src.get_annual_occurrence_rates()) - return tot_rate + return src.num_ruptures + # tot_rate = sum(rate for mag, rate in src.get_annual_occurrence_rates()) + # return src.weight * tot_rate def get_events(ebruptures):
Changed weight [skip hazardlib]
gem_oq-engine
train
py
c5db8dbb390acef11ccd45dcbe5d6b3c6fbef019
diff --git a/dynamic_scraper/spiders/django_spider.py b/dynamic_scraper/spiders/django_spider.py index <HASH>..<HASH> 100644 --- a/dynamic_scraper/spiders/django_spider.py +++ b/dynamic_scraper/spiders/django_spider.py @@ -6,7 +6,6 @@ from builtins import map from builtins import range import ast, datetime, importlib, json, logging, scrapy -from json.decoder import JSONDecodeError from jsonpath_rw import jsonpath, parse from jsonpath_rw.lexer import JsonPathLexerError @@ -611,7 +610,7 @@ class DjangoSpider(DjangoBaseSpider): json_resp = None try: json_resp = json.loads(response.body_as_unicode()) - except JSONDecodeError: + except ValueError: msg = "JSON response for MP could not be parsed!" self.log(msg, logging.ERROR) if json_resp:
Replaced JSONDecodeError with ValueError
holgerd77_django-dynamic-scraper
train
py
8b063b31b29c062e384edc05cb3949d6b6a0807d
diff --git a/src/stylable.js b/src/stylable.js index <HASH>..<HASH> 100644 --- a/src/stylable.js +++ b/src/stylable.js @@ -6,12 +6,13 @@ import Node from './node' import isPureComponent from './isPureComponent' import getDisplayName from './getDisplayName' -export default function stylable (name) { +export default function stylable (selName) { return function wrapWithComponent (WrappedComponent) { - const stylableDisplayName = `Stylable(${getDisplayName(WrappedComponent)})` + const stylableDisplayName = `Stylable(${selName})(${getDisplayName(WrappedComponent)})` const pureComponent = isPureComponent(WrappedComponent) class Stylable extends React.Component { + static name = selName static displayName = stylableDisplayName static WrappedComponent = WrappedComponent static contextTypes = { @@ -27,7 +28,7 @@ export default function stylable (name) { constructor (props, ctx) { super(props, ctx) - this.node = new Node(name, props, ctx.styleNode, ctx.styleSheet) + this.node = new Node(selName, props, ctx.styleNode, ctx.styleSheet) this.state = { childProps: this.node.getChildProps() } this._wrapped = undefined }
feat: Use better naming for components For ex: const Title = stylable('Title')(Text) will be visible in react-devtools like 'Stylable(Title)(Text)'
vovkasm_react-native-stylable
train
js
46fd918c4793df6eeb4d1ec3a6a9f09edfe54b6b
diff --git a/src/Node/CodeBlock.php b/src/Node/CodeBlock.php index <HASH>..<HASH> 100644 --- a/src/Node/CodeBlock.php +++ b/src/Node/CodeBlock.php @@ -16,7 +16,7 @@ class CodeBlock extends Node implements NodeAcceptorInterface public function __construct(Text $text) { - $this->lines = new Collection([$text->replace('/^[ ]{4}/', '')]); + $this->lines = new Collection([$text]); } public function acceptBlankLine(BlankLine $blankLine) diff --git a/src/Parser/CodeBlockParser.php b/src/Parser/CodeBlockParser.php index <HASH>..<HASH> 100644 --- a/src/Parser/CodeBlockParser.php +++ b/src/Parser/CodeBlockParser.php @@ -23,6 +23,10 @@ class CodeBlockParser extends AbstractParser }mx', function (Text $whole, Text $code) { // TODO: Prepare contents + + // Remove indent + $code->replace('/^(\t|[ ]{1,4})/m', ''); + $this->stack->acceptCodeBlock(new CodeBlock($code)); }, function(Text $part) {
Fix indentation of code block content.
fluxbb_commonmark
train
php,php
e3c68892fc9d9c71f93aa8e69ecfd6d9a6d353f9
diff --git a/core/common/src/main/java/alluxio/util/UnderFileSystemUtils.java b/core/common/src/main/java/alluxio/util/UnderFileSystemUtils.java index <HASH>..<HASH> 100644 --- a/core/common/src/main/java/alluxio/util/UnderFileSystemUtils.java +++ b/core/common/src/main/java/alluxio/util/UnderFileSystemUtils.java @@ -160,6 +160,7 @@ public final class UnderFileSystemUtils { return "swift".equals(ufs.getUnderFSType()); } + // TODO(binfan): make separate wrapper class on ufs conf instead of using util method /** * Gets the value of the given key in the given UFS configuration or the global configuration * (in case the key is not found in the UFS configuration), throw {@link RuntimeException} if the @@ -179,6 +180,7 @@ public final class UnderFileSystemUtils { throw new RuntimeException("key " + key + " not found"); } + // TODO(binfan): make separate wrapper class on ufs conf instead of using util method /** * @param key property key * @param ufsConf configuration for the UFS
[ALLUXIO-<I>] Leave a todo to make separate class on ufs conf
Alluxio_alluxio
train
java
14d79c9cfd3bdaaeb3172dbdb35d1a7a3b507c30
diff --git a/lib/solargraph/convention/gemspec.rb b/lib/solargraph/convention/gemspec.rb index <HASH>..<HASH> 100644 --- a/lib/solargraph/convention/gemspec.rb +++ b/lib/solargraph/convention/gemspec.rb @@ -7,7 +7,7 @@ module Solargraph return EMPTY_ENVIRON unless File.basename(source_map.filename).end_with?('.gemspec') @environ ||= Environ.new( requires: ['rubygems'], - overrides: [ + pins: [ Solargraph::Pin::Reference::Override.from_comment( 'Gem::Specification.new', %( diff --git a/lib/solargraph/convention/rspec.rb b/lib/solargraph/convention/rspec.rb index <HASH>..<HASH> 100644 --- a/lib/solargraph/convention/rspec.rb +++ b/lib/solargraph/convention/rspec.rb @@ -11,7 +11,7 @@ module Solargraph # This override is necessary due to an erroneous @return tag in # rspec's YARD documentation. # @todo The return types have been fixed (https://github.com/rspec/rspec-expectations/pull/1121) - overrides: [ + pins: [ Solargraph::Pin::Reference::Override.method_return('RSpec::Matchers#expect', 'RSpec::Expectations::ExpectationTarget') ] )
Conventions add pins instead of overrides.
castwide_solargraph
train
rb,rb
a1c4f14bd47bdc9fd2cb36337e6600d48056619b
diff --git a/vsphere_cpi/lib/cloud/vsphere/cloud.rb b/vsphere_cpi/lib/cloud/vsphere/cloud.rb index <HASH>..<HASH> 100644 --- a/vsphere_cpi/lib/cloud/vsphere/cloud.rb +++ b/vsphere_cpi/lib/cloud/vsphere/cloud.rb @@ -151,6 +151,11 @@ module VSphereCloud disk = resource_pool["disk"] cpu = resource_pool["cpu"] + # Make sure number of cores is a power of 2. kb.vmware.com/kb/2003484 + if cpu & cpu - 1 != 0 + raise "Number of vCPUs: #{cpu} is not a power of 2." + end + disks = disk_spec(disk, disk_locality) cluster, datastore = @resources.get_resources(memory, disks)
Should only create VMs with number of vCPUs being a power of 2. Change-Id: Ia<I>b7fa<I>cf<I>cc<I>c<I>acdbcd8d<I>b<I>a
cloudfoundry_bosh
train
rb
a4659cfdb9319750400c51e6fa82f6859c49453f
diff --git a/structr-core/src/test/java/org/structr/schema/action/ActionContextTest.java b/structr-core/src/test/java/org/structr/schema/action/ActionContextTest.java index <HASH>..<HASH> 100644 --- a/structr-core/src/test/java/org/structr/schema/action/ActionContextTest.java +++ b/structr-core/src/test/java/org/structr/schema/action/ActionContextTest.java @@ -791,6 +791,18 @@ public class ActionContextTest extends StructrTest { // set with null assertEquals("Invalid usage message for set()", Functions.ERROR_MESSAGE_SET, Scripting.replaceVariables(ctx, testOne, "${set()}")); + // set date (JS scripting) + assertEquals("Setting the current date/time should not produce output (JS)", "", Scripting.replaceVariables(ctx, testOne, "${{var t = Structr.get('this'); t.aDate = new Date();}}")); + + try { + + // set date (old scripting) + Scripting.replaceVariables(ctx, testOne, "${set(this, 'aDate', now)}"); + + } catch (FrameworkException fex) { + fail("Setting the current date/time should not cause an Exception (StructrScript)"); + } + // geocode with null assertEquals("Invalid usage message for geocode()", Functions.ERROR_MESSAGE_GEOCODE, Scripting.replaceVariables(ctx, testOne, "${geocode()}"));
added a test for setting a date directly
structr_structr
train
java
08c02d37506b1f4b2046324d3b2623dc3fe4a6a2
diff --git a/prestans/parsers.py b/prestans/parsers.py index <HASH>..<HASH> 100644 --- a/prestans/parsers.py +++ b/prestans/parsers.py @@ -535,7 +535,7 @@ class ParserRuleSet(object): # def _parse_attribute_filter(self, request): - if not self._response_attribute_filter_template: + if self._response_attribute_filter_template is None: # Not set hence, ignore this part of the parser return None @@ -588,7 +588,8 @@ class ParserRuleSet(object): # @param request The request object to validate # def _parameter_set_for_request(self, request): - if not self._parameter_sets: + + if self._parameter_sets is None: return None for parameter_set in self._parameter_sets: @@ -621,7 +622,7 @@ class ParserRuleSet(object): def _parsed_body_for_request(self, request, environ): # Parses the contents of the body - if not self._body_template: + if self._body_template is None: # Return none if body_template is not set, this means parsing is to be ignored return None
Fixes boolean logic for checking various assignments in ParserRuleSet
anomaly_prestans
train
py
aa043cbd5ab0d688b871540b934a531c06ea4a1a
diff --git a/bundles/org.eclipse.orion.client.cf/web/orion/cfui/logView.js b/bundles/org.eclipse.orion.client.cf/web/orion/cfui/logView.js index <HASH>..<HASH> 100644 --- a/bundles/org.eclipse.orion.client.cf/web/orion/cfui/logView.js +++ b/bundles/org.eclipse.orion.client.cf/web/orion/cfui/logView.js @@ -71,9 +71,12 @@ define(['i18n!cfui/nls/messages', this._acceptPatch = null; var fullLog = ""; - this.applicationInfo.logs.forEach(function(line){ - fullLog += line + "\n"; - }); + if (this.applicationInfo){ + this.applicationInfo.logs.forEach(function(line){ + fullLog += line + "\n"; //$NON-NLS-1$ + }); + } + var selections, vScroll, hScroll; if (this._scrollLock) { selections = this.editor.getSelections();
Bug <I> - TypeError: Cannot read property 'logs' of undefined (in logView.js)
eclipse_orion.client
train
js
fc3809becf4fca891c281b0b352dc2d3587a474c
diff --git a/hcalendar.py b/hcalendar.py index <HASH>..<HASH> 100644 --- a/hcalendar.py +++ b/hcalendar.py @@ -68,9 +68,9 @@ class vObject(object): value = isodate.parse_date(content) else: value = isodate.parse_datetime(content) - if isinstance(value, datetime.time): + if type(value) is datetime.time: self._datetime[attr] = datetime.datetime.min.replace(hour=value.hour, minute=value.minute, second=value.second, microsecond=value.microsecond, tzinfo=value.tzinfo) - elif isinstance(value, datetime.date): + elif type(value) is datetime.date: self._datetime[attr] = datetime.datetime(value.year, value.month, value.day) else: self._datetime[attr] = value
Fixed type checking being useless, because of shared super classes
mback2k_python-hcalendar
train
py
28a2d3cb0bbd41ce92d95b528df831825aa86ddc
diff --git a/src/main/java/org/lastaflute/web/LastaAction.java b/src/main/java/org/lastaflute/web/LastaAction.java index <HASH>..<HASH> 100644 --- a/src/main/java/org/lastaflute/web/LastaAction.java +++ b/src/main/java/org/lastaflute/web/LastaAction.java @@ -341,10 +341,10 @@ public abstract class LastaAction { protected HtmlResponse doRedirect(Class<?> actionType, UrlChain chain) { assertArgumentNotNull("actionType", actionType); assertArgumentNotNull("chain", chain); - return newHtmlResponseAsRediect(toActionUrl(actionType, chain)); + return newHtmlResponseAsRedirect(toActionUrl(actionType, chain)); } - protected HtmlResponse newHtmlResponseAsRediect(String redirectPath) { + protected HtmlResponse newHtmlResponseAsRedirect(String redirectPath) { return HtmlResponse.fromRedirectPath(redirectPath); }
fix typo, rename to newHtmlResponseAsRedirect()
lastaflute_lastaflute
train
java
6966fb2aa1800969113aea010f1d3ee05258cd8d
diff --git a/tests/Integration/Suites/FilterNavigationTest.php b/tests/Integration/Suites/FilterNavigationTest.php index <HASH>..<HASH> 100644 --- a/tests/Integration/Suites/FilterNavigationTest.php +++ b/tests/Integration/Suites/FilterNavigationTest.php @@ -37,6 +37,9 @@ class FilterNavigationTest extends \PHPUnit_Framework_TestCase $this->registerProductListingSnippetKeyGenerator(); } + /** + * @return mixed[] + */ public function testListingPageContainsValidFilterNavigationJson() { $request = HttpRequest::fromParameters(
Issue #<I>: Add missing PHPDoc annotation
lizards-and-pumpkins_catalog
train
php
935f53bd5ad2d71cfa18a91514184eea3fb83690
diff --git a/test/adapters/delayed_job.rb b/test/adapters/delayed_job.rb index <HASH>..<HASH> 100644 --- a/test/adapters/delayed_job.rb +++ b/test/adapters/delayed_job.rb @@ -3,4 +3,4 @@ $LOAD_PATH << File.dirname(__FILE__) + "/../support/delayed_job" Delayed::Worker.delay_jobs = false Delayed::Worker.backend = :test -ActiveJob::Base.adapter = :delayed_job +ActiveJob::Base.queue_adapter = :delayed_job diff --git a/test/cases/adapter_test.rb b/test/cases/adapter_test.rb index <HASH>..<HASH> 100644 --- a/test/cases/adapter_test.rb +++ b/test/cases/adapter_test.rb @@ -26,7 +26,7 @@ class AdapterTest < ActiveSupport::TestCase end test 'should load delayed_job adapter' do - ActiveJob::Base.adapter = :delayed_job + ActiveJob::Base.queue_adapter = :delayed_job assert_equal ActiveJob::QueueAdapters::DelayedJobAdapter, ActiveJob::Base.queue_adapter end
Fix for the new adapter setter
rails_rails
train
rb,rb
fe939a3eb6ae001c002e1ba81df1453a6884e991
diff --git a/lib/write.js b/lib/write.js index <HASH>..<HASH> 100644 --- a/lib/write.js +++ b/lib/write.js @@ -227,6 +227,7 @@ function beforeCommit(object, callback) { // run beforeCommit on all composed objects as well. transformComps.call(self, object, object, function(comp, object, i, cb) { + if (comp.transient) return cb(); beforeCommit.call(comp.model, object, cb); }, callback); }); @@ -287,11 +288,13 @@ module.exports = { excludeComps = false; } var opts = { excludeComps: excludeComps }; + + if (opts.excludeComps) + object = _.omit(object, _.pluck(self.compositions, 'name')); + async.waterfall([ beforeCommit.bind(this, object), function (object, callback) { - if (opts.excludeComps) - object = _.omit(object, _.pluck(self.compositions, 'name')); cypherCommit.call(self, object, opts, callback); }, afterCommit.bind(this)
don't fire beforeSave and afterSave events on models that are not being saved
brikteknologier_seraph-model
train
js
4a9edba164404e7d1e2190035336632326639663
diff --git a/chess/__init__.py b/chess/__init__.py index <HASH>..<HASH> 100644 --- a/chess/__init__.py +++ b/chess/__init__.py @@ -143,6 +143,17 @@ def square_name(square: Square) -> str: """Gets the name of the square, like ``a3``.""" return SQUARE_NAMES[square] +def parse_square(sq_name: str) -> Square: + """ + Gets a square number from the square's name (e.g., "e4" returns 28). + + :raises: :exc:`ValueError` if sq_name is invalid (e.g., "d9"). + """ + if sq_name in SQUARE_NAMES: + return SQUARE_NAMES.index(sq_name) + else: + raise ValueError(f"'{sq_name}' is not a valid square name") + def square_distance(a: Square, b: Square) -> int: """ Gets the distance (i.e., the number of king steps) from square *a* to *b*.
Added parse_square function: #<I> (#<I>) * Added parse_square function: #<I> * Update __init__.py * Update __init__.py .find is not a function for lists apparently, it exists only for strings
niklasf_python-chess
train
py
bea1fa6bf86b99ea1ed05fb4fd039ca81c7e88e3
diff --git a/lib/index.js b/lib/index.js index <HASH>..<HASH> 100644 --- a/lib/index.js +++ b/lib/index.js @@ -1,3 +1,4 @@ +'use strict()'; const fs = require('fs'); const path = require('path');
use strict mode to enable block scoping in node 4/5
maxrimue_parent-package-json
train
js
53cbd992a57693c7aa6d063b1f50a451354981ef
diff --git a/examples/basicBind/src/BasicBind.js b/examples/basicBind/src/BasicBind.js index <HASH>..<HASH> 100644 --- a/examples/basicBind/src/BasicBind.js +++ b/examples/basicBind/src/BasicBind.js @@ -82,33 +82,7 @@ define([ } }); }, 5000); - setTimeout(function () { - data.val.list.concat([ - { - test: { - value: 'Test Value Third', - badge: badge++ - } - }, { - test: { - value: 'Test Value Fourth', - badge: badge++ - } - } - ], [ - { - test: { - value: 'Test Value Third', - badge: badge++ - } - }, { - test: { - value: 'Test Value Fourth', - badge: badge++ - } - } - ]); - }, 6000); + } return App.extend({
Remove concat from basicBind
gunins_stonewall
train
js
f0feabffd301e6c46f822c329e2c7140778cae9b
diff --git a/lib/paho.mqtt/paho_client.rb b/lib/paho.mqtt/paho_client.rb index <HASH>..<HASH> 100644 --- a/lib/paho.mqtt/paho_client.rb +++ b/lib/paho.mqtt/paho_client.rb @@ -265,6 +265,7 @@ module PahoMqtt connect_timeout = Time.now + @ack_timeout while (Time.now <= connect_timeout) && (@connection_state != MQTT_CS_CONNECTED) do receive_packet + sleep 0.0001 end end
Add tempo in connect time to reduce system time
RubyDevInc_paho.mqtt.ruby
train
rb
104da878fb978d11922b209d36fe49e6889d8a18
diff --git a/maven-plugin/src/main/java/org/kantega/reststop/maven/dist/DebianBuilder.java b/maven-plugin/src/main/java/org/kantega/reststop/maven/dist/DebianBuilder.java index <HASH>..<HASH> 100644 --- a/maven-plugin/src/main/java/org/kantega/reststop/maven/dist/DebianBuilder.java +++ b/maven-plugin/src/main/java/org/kantega/reststop/maven/dist/DebianBuilder.java @@ -106,12 +106,13 @@ public class DebianBuilder extends AbstractDistMojo { element(name("src"), "${project.build.directory}/reststop/distRoot"), element(name("type"), "directory"), element(name("includes"), ""), - element(name("excludes"), "**/*.sh,etc/init.d/"+name) + element(name("excludes"), "**/.svn,**/*.sh,etc/init.d/"+name) ), element(name("data"), element(name("src"), "${project.build.directory}/reststop/distRoot"), element(name("type"), "directory"), element(name("includes"), "**/*.sh,etc/init.d/"+name ), + element(name("excludes"), "**/.svn"), element(name("mapper"), element(name("type"), "perm"), element(name("filemode"), "755"))
Excludes subversion control files from debian build.
kantega_reststop
train
java
f1948a15cda1eebac3a50cd11b8e0144339e4bfc
diff --git a/eZ/Publish/API/Repository/Values/Content/Content.php b/eZ/Publish/API/Repository/Values/Content/Content.php index <HASH>..<HASH> 100644 --- a/eZ/Publish/API/Repository/Values/Content/Content.php +++ b/eZ/Publish/API/Repository/Values/Content/Content.php @@ -43,7 +43,7 @@ abstract class Content extends ValueObject /** * returns the outgoing relations * - * @return array an array of {@link Relation} + * @return \eZ\Publish\API\Repository\Values\Content\Relation[] An array of {@link Relation} */ abstract public function getRelations();
Fixed: Doc comment for return types.
ezsystems_ezpublish-kernel
train
php
a741a7f1d5229e82ed07b9ff00167a2e990bea71
diff --git a/packet-manager.go b/packet-manager.go index <HASH>..<HASH> 100644 --- a/packet-manager.go +++ b/packet-manager.go @@ -176,8 +176,10 @@ func (s *packetManager) maybeSendPackets() { s.sender.sendPacket(out.(encoding.BinaryMarshaler)) // pop off heads copy(s.incoming, s.incoming[1:]) // shift left + s.incoming[len(s.incoming)-1] = nil // clear last s.incoming = s.incoming[:len(s.incoming)-1] // remove last copy(s.outgoing, s.outgoing[1:]) // shift left + s.outgoing[len(s.outgoing)-1] = nil // clear last s.outgoing = s.outgoing[:len(s.outgoing)-1] // remove last } else { break
prevent memory leaks in slice buffer Remove reference to packets from packet ordering slices to prevent small memory leak. The leak is bounded and temporary, but this is a good practice.
pkg_sftp
train
go
f0a2a6269808c8868492d5f0577bb2a5279b766c
diff --git a/python/tree/tree.py b/python/tree/tree.py index <HASH>..<HASH> 100644 --- a/python/tree/tree.py +++ b/python/tree/tree.py @@ -6,7 +6,7 @@ # @Author: Brian Cherinka # @Date: 2016-10-11 13:24:56 # @Last modified by: Brian Cherinka -# @Last Modified time: 2016-10-11 21:06:09 +# @Last Modified time: 2016-10-11 21:38:29 from __future__ import print_function, division, absolute_import import os @@ -68,7 +68,7 @@ class Tree(object): if not section: sections = self._cfg.sections() else: - sections = [section] + sections = ['general', section] # add all sections into the tree environ for sec in sections:
bug fix, always adding general paths from tree into environ
sdss_tree
train
py
4bb9f687677307dc7aab89730a1e4ed4f467d4e2
diff --git a/modules/engine.py b/modules/engine.py index <HASH>..<HASH> 100644 --- a/modules/engine.py +++ b/modules/engine.py @@ -196,7 +196,7 @@ class SinglePlayerGameStage (GameStage): mailbox = LocalMailbox() actors = [referee] - if isinstance(actors, dict): + if isinstance(remaining_actors, dict): for actor, greeting in remaining_actors.items(): actor.send_message(greeting) actors.append(actor) @@ -545,6 +545,10 @@ class World (Token): self._tokens = {} self._registered = True + def __iter__(self): + for token in self._tokens.values(): + yield token + def __contains__(self, token): return token.get_id() in self._tokens
Fix a bug regarding single-player greetings.
kxgames_kxg
train
py
efc025403fc88decca499804f1bcc1991318b7c8
diff --git a/ui/src/admin/components/chronograf/OrganizationsTableRow.js b/ui/src/admin/components/chronograf/OrganizationsTableRow.js index <HASH>..<HASH> 100644 --- a/ui/src/admin/components/chronograf/OrganizationsTableRow.js +++ b/ui/src/admin/components/chronograf/OrganizationsTableRow.js @@ -133,6 +133,7 @@ class OrganizationsTableRow extends Component { onCancel={this.handleDismissDeleteConfirmation} onConfirm={this.handleDeleteOrg} onClickOutside={this.handleDismissDeleteConfirmation} + confirmLeft={true} /> : <button className="btn btn-sm btn-default btn-square"
Switch confirm buttons render display order for Organizations delete to protect errant delete
influxdata_influxdb
train
js
f4b8c5260c203d6ab7631fa394696f5c7a442586
diff --git a/spec/subexpressions.js b/spec/subexpressions.js index <HASH>..<HASH> 100644 --- a/spec/subexpressions.js +++ b/spec/subexpressions.js @@ -139,6 +139,30 @@ describe('subexpressions', function() { shouldCompileTo(string, [{}, helpers], '<input aria-label="Name" placeholder="Example User" />'); }); + it("multiple subexpressions in a hash with context", function() { + var string = '{{input aria-label=(t item.field) placeholder=(t item.placeholder)}}'; + + var context = { + item: { + field: "Name", + placeholder: "Example User" + } + }; + + var helpers = { + input: function(options) { + var hash = options.hash; + var ariaLabel = Handlebars.Utils.escapeExpression(hash['aria-label']); + var placeholder = Handlebars.Utils.escapeExpression(hash.placeholder); + return new Handlebars.SafeString('<input aria-label="' + ariaLabel + '" placeholder="' + placeholder + '" />'); + }, + t: function(defaultString) { + return new Handlebars.SafeString(defaultString); + } + } + shouldCompileTo(string, [context, helpers], '<input aria-label="Name" placeholder="Example User" />'); + }); + it("in string params mode,", function() { var template = CompilerContext.compile('{{snog (blorg foo x=y) yeah a=b}}', {stringParams: true});
added test multiple subexpressions in a hash with context
wycats_handlebars.js
train
js
54a73a34cf93c487a3be2319f4949a0e8d69fa00
diff --git a/lib/origen/parameters/set.rb b/lib/origen/parameters/set.rb index <HASH>..<HASH> 100644 --- a/lib/origen/parameters/set.rb +++ b/lib/origen/parameters/set.rb @@ -88,9 +88,7 @@ module Origen OVERRIDE_METHODS.each do |method| define_method method do - if self[method] - method_missing(method) - end + method_missing(method) end end diff --git a/spec/parameters_spec.rb b/spec/parameters_spec.rb index <HASH>..<HASH> 100644 --- a/spec/parameters_spec.rb +++ b/spec/parameters_spec.rb @@ -464,7 +464,7 @@ module ParametersSpec define_params :chain do |params| params.chain = 1 end - + define_params :not_chain do |params| params.x = 2 end @@ -478,7 +478,7 @@ module ParametersSpec ip.params = :chain ip.params.chain.should == 1 ip.params(:chain).chain.should == 1 - ip.params(:not_chain).chain.should == nil + expect { ip.params(:not_chain).chain }.to raise_error(NoMethodError) end end end
specs passing with nil check behavior change
Origen-SDK_origen
train
rb,rb
e37d0a3ebcec52b1af85364fe1548ce156ad2cca
diff --git a/liberty-starter-application/src/main/java/com/ibm/liberty/starter/api/v1/GitHubProjectEndpoint.java b/liberty-starter-application/src/main/java/com/ibm/liberty/starter/api/v1/GitHubProjectEndpoint.java index <HASH>..<HASH> 100644 --- a/liberty-starter-application/src/main/java/com/ibm/liberty/starter/api/v1/GitHubProjectEndpoint.java +++ b/liberty-starter-application/src/main/java/com/ibm/liberty/starter/api/v1/GitHubProjectEndpoint.java @@ -27,6 +27,8 @@ import javax.ws.rs.core.Response.Status; import javax.ws.rs.core.UriInfo; import java.io.IOException; import java.net.URI; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; import java.util.logging.Logger; @Path("v1/createGitHubRepository") @@ -44,6 +46,7 @@ public class GitHubProjectEndpoint { log.severe("No oAuthToken passed in."); throw new ValidationException(); } + oAuthToken = URLEncoder.encode(oAuthToken, StandardCharsets.UTF_8.name()); ProjectConstructionInput inputProcessor = new ProjectConstructionInput(new ServiceConnector(info.getBaseUri())); ProjectConstructionInputData inputData = inputProcessor.processInput(techs, techOptions, name, deploy, workspaceId, build); ProjectConstructor constructor = new ProjectConstructor(inputData);
Encode the OAuth token before storing
WASdev_tool.accelerate.core
train
java
17e3735d44d72b33a1d67549f53ce6d89d80b1fb
diff --git a/lib/middleman/core_extensions/front_matter.rb b/lib/middleman/core_extensions/front_matter.rb index <HASH>..<HASH> 100644 --- a/lib/middleman/core_extensions/front_matter.rb +++ b/lib/middleman/core_extensions/front_matter.rb @@ -52,7 +52,7 @@ module Middleman::CoreExtensions::FrontMatter class FrontMatter class << self def matcher - %r{source/.*\.html} + %r{^source/.*\.html} end end diff --git a/lib/middleman/core_extensions/sitemap.rb b/lib/middleman/core_extensions/sitemap.rb index <HASH>..<HASH> 100644 --- a/lib/middleman/core_extensions/sitemap.rb +++ b/lib/middleman/core_extensions/sitemap.rb @@ -12,12 +12,12 @@ module Middleman::CoreExtensions::Sitemap module InstanceMethods def initialize super - - file_changed do |file| + + file_changed %r{^source/} do |file| sitemap.touch_file(file) end - - file_deleted do |file| + + file_deleted %r{^source/} do |file| sitemap.remove_file(file) end end
A slight speedup in the sitemap extension by only scanning the source directory. This way sitemap will not scan through all the files in your project (including .git files and such) when it doesn't ever need to know about those files. This also includes a slight tightening of the regex for filtering paths for front_matter.
middleman_middleman
train
rb,rb
e7094b65220a6fb6c553de106498c1d0cba2d0d7
diff --git a/lib/active_importer/base.rb b/lib/active_importer/base.rb index <HASH>..<HASH> 100644 --- a/lib/active_importer/base.rb +++ b/lib/active_importer/base.rb @@ -90,7 +90,7 @@ module ActiveImporter @book = @header = nil @row_count = 0 @row_index = 1 - fire_event :import_failed, e.message + fire_event :import_failed, e end def fetch_model @@ -153,7 +153,7 @@ module ActiveImporter model.save! rescue => e @row_errors << { row_index: row_index, error_message: e.message } - fire_event :row_error, e.message + fire_event :row_error, e return false end fire_event :row_success
Pass exception to error-related events, instead of just the message
continuum_active_importer
train
rb
256ac15c1255d27bda7fd305dac23784c31fb262
diff --git a/lib/membership/member.js b/lib/membership/member.js index <HASH>..<HASH> 100644 --- a/lib/membership/member.js +++ b/lib/membership/member.js @@ -27,6 +27,7 @@ var util = require('util'); function Member(ringpop, update) { this.ringpop = ringpop; + this.id = update.address; this.address = update.address; this.status = update.status; this.incarnationNumber = update.incarnationNumber; @@ -120,10 +121,6 @@ Member.prototype.evaluateUpdate = function evaluateUpdate(update) { return true; }; -Member.prototype.getId = function getId() { - return this.address; -}; - Member.prototype.getStats = function getStats() { return { address: this.address, diff --git a/test/unit/member_test.js b/test/unit/member_test.js index <HASH>..<HASH> 100644 --- a/test/unit/member_test.js +++ b/test/unit/member_test.js @@ -205,7 +205,7 @@ testRingpop('member ID is its address', function t(deps, assert) { var member = new Member(deps.ringpop, { address: address }); - assert.equals(member.getId(), address, 'ID is address'); + assert.equals(member.id, address, 'ID is address'); }); testRingpop('update happens synchronously or not at all', function t(deps, assert) {
Address Ben's feedback; set Member id upon instantiation; no getId
esatterwhite_skyring
train
js,js
366679f53594eceef7596baa367f576f2efdf334
diff --git a/dev/com.ibm.ws.classloading/src/com/ibm/ws/classloading/java2sec/ParseJavaPolicy.java b/dev/com.ibm.ws.classloading/src/com/ibm/ws/classloading/java2sec/ParseJavaPolicy.java index <HASH>..<HASH> 100644 --- a/dev/com.ibm.ws.classloading/src/com/ibm/ws/classloading/java2sec/ParseJavaPolicy.java +++ b/dev/com.ibm.ws.classloading/src/com/ibm/ws/classloading/java2sec/ParseJavaPolicy.java @@ -62,7 +62,7 @@ public class ParseJavaPolicy { if (javaHome.endsWith("jre")) { file=javaHome.concat("/lib/security/java.policy"); } else { - file = javaHome.concat("jre/lib/security/java.policy"); + file = javaHome.concat("/jre/lib/security/java.policy"); } } }
Issue<I>-ProperMergingOfJava2Permissions
OpenLiberty_open-liberty
train
java
9e3cc8146106fc39c66d01d467014c0c86c47005
diff --git a/h2o-algos/src/main/java/hex/coxph/CoxPH.java b/h2o-algos/src/main/java/hex/coxph/CoxPH.java index <HASH>..<HASH> 100644 --- a/h2o-algos/src/main/java/hex/coxph/CoxPH.java +++ b/h2o-algos/src/main/java/hex/coxph/CoxPH.java @@ -113,8 +113,7 @@ public class CoxPH extends ModelBuilder<CoxPHModel,CoxPHModel.CoxPHParameters,Co } if( _train != null ) { - int nonFeatureColCount = (_parms._start_column!=null?1:0) + (_parms._stop_column!=null?1:0) + - (_parms._interactions_only!=null?_parms._interactions_only.length:0); + int nonFeatureColCount = (_parms._start_column!=null?1:0) + (_parms._stop_column!=null?1:0); if (_train.numCols() < (2 + nonFeatureColCount)) error("_train", "Training data must have at least 2 features (incl. response)."); }
interactions only cols count into feature cols
h2oai_h2o-3
train
java
abb2fc65bd14760021c61699ad3113cab3bd4c64
diff --git a/sos/policies/distros/redhat.py b/sos/policies/distros/redhat.py index <HASH>..<HASH> 100644 --- a/sos/policies/distros/redhat.py +++ b/sos/policies/distros/redhat.py @@ -250,7 +250,7 @@ support representative. elif self.commons['cmdlineopts'].upload_protocol == 'sftp': return RH_SFTP_HOST else: - rh_case_api = "/hydra/rest/cases/%s/attachments" + rh_case_api = "/support/v1/cases/%s/attachments" return RH_API_HOST + rh_case_api % self.case_id def _get_upload_headers(self):
[redhat] Fix broken URI to upload to customer portal Revert back the unwanted change in URI of uploading tarball to the Red Hat Customer portal. Related: #<I>
sosreport_sos
train
py
09b5adc5067c4e509395966cb3e7f98853c64d94
diff --git a/index.js b/index.js index <HASH>..<HASH> 100644 --- a/index.js +++ b/index.js @@ -99,7 +99,7 @@ module.exports = function nodeExternals(options) { var moduleName = getModuleName(request, includeAbsolutePaths); if (contains(nodeModules, moduleName) && !containsPattern(whitelist, request)) { // mark this module as external - // https://webpack.github.io/docs/configuration.html#externals + // https://webpack.js.org/configuration/externals/ return callback(null, importType + " " + request); }; callback();
Updated reference comment to webpack externals. Url was a bad link
liady_webpack-node-externals
train
js
3a447f1246e7c16b19770aadaddaa96cb31b7559
diff --git a/devices/linkam_t95/device.py b/devices/linkam_t95/device.py index <HASH>..<HASH> 100644 --- a/devices/linkam_t95/device.py +++ b/devices/linkam_t95/device.py @@ -141,7 +141,7 @@ class SimulatedLinkamT95(CanProcessComposite, object): # TODO: Is not having leading zeroes / 4 digits an error? # TODO: What are the upper and lower limits in the real device? limit = int(param) - if -196 <= limit <= 1500: + if -1960 <= limit <= 15000: self._context.temperature_limit = limit / 10.0 print "New limit: %.1f C" % (self._context.temperature_limit,) return ""
Corrected temperature limits (based on min/max reported temperature)
DMSC-Instrument-Data_lewis
train
py
17dbc38f5670ab221bf941f3cb0ae219d8cbefa8
diff --git a/packages/build-tools/tasks/webpack-tasks.js b/packages/build-tools/tasks/webpack-tasks.js index <HASH>..<HASH> 100644 --- a/packages/build-tools/tasks/webpack-tasks.js +++ b/packages/build-tools/tasks/webpack-tasks.js @@ -220,6 +220,11 @@ async function server(buildTime) { hotClient: { logLevel: 'silent', hot: true, + // Workaround to IE 11-specific issue with webpack-hot-client -- otherwise testing IE 11 on the local dev server is broken + host: { + client: '*', + server: '0.0.0.0', + }, }, content: path.resolve(process.cwd(), config.wwwDir), devWare: {
fix: update webpack-serve config so local IE <I> testing works with webpack-hot-client
bolt-design-system_bolt
train
js
7a1b78593b9c10fe18b4ddb453d0dbdedf970495
diff --git a/builtin/providers/digitalocean/resource_digitalocean_floating_ip.go b/builtin/providers/digitalocean/resource_digitalocean_floating_ip.go index <HASH>..<HASH> 100644 --- a/builtin/providers/digitalocean/resource_digitalocean_floating_ip.go +++ b/builtin/providers/digitalocean/resource_digitalocean_floating_ip.go @@ -122,6 +122,8 @@ func resourceDigitalOceanFloatingIpRead(d *schema.ResourceData, meta interface{} log.Printf("[INFO] A droplet was detected on the FloatingIP so setting the Region based on the Droplet") log.Printf("[INFO] The region of the Droplet is %s", floatingIp.Droplet.Region.Slug) d.Set("region", floatingIp.Droplet.Region.Slug) + d.Set("droplet_id", floatingIp.Droplet.ID) + } else { d.Set("region", floatingIp.Region.Slug) }
provider/digitalocean: Reassign Floating IP when droplet changes (#<I>) Fixes #<I> When a floating IP is changed in the DO console, this PR will allow it to be reassociated to the machine that Terraform attached it to and change it back
hashicorp_terraform
train
go
5dd817b323eaf4c4628210ee823db78e71ee4033
diff --git a/mongo/open.go b/mongo/open.go index <HASH>..<HASH> 100644 --- a/mongo/open.go +++ b/mongo/open.go @@ -19,17 +19,19 @@ import ( "github.com/juju/juju/cert" ) -// SocketTimeout should be long enough that -// even a slow mongo server will respond in that -// length of time. Since mongo servers ping themselves -// every 10 seconds, we use a value of just over 2 -// ping periods to allow for delayed pings due to -// issues such as CPU starvation etc. -const SocketTimeout = 21 * time.Second - -// defaultDialTimeout should be representative of -// the upper bound of time taken to dial a mongo -// server from within the same cloud/private network. +// SocketTimeout should be long enough that even a slow mongo server +// will respond in that length of time, and must also be long enough +// to allow for completion of heavyweight queries. +// +// Note: 1 minute is mgo's default socket timeout value. +// +// Also note: We have observed mongodb occasionally getting "stuck" +// for over 30s in the field. +const SocketTimeout = time.Minute + +// defaultDialTimeout should be representative of the upper bound of +// time taken to dial a mongo server from within the same +// cloud/private network. const defaultDialTimeout = 30 * time.Second // DialOpts holds configuration parameters that control the
mongo: Increase socket timeout This will hopefully fix <URL>. This also happens to be mgo's default timeout.
juju_juju
train
go
e4f525e7c5270e33972cbbc9f6360435d0ff87ae
diff --git a/flink-runtime/src/main/java/org/apache/flink/runtime/io/network/partition/SortMergeSubpartitionReader.java b/flink-runtime/src/main/java/org/apache/flink/runtime/io/network/partition/SortMergeSubpartitionReader.java index <HASH>..<HASH> 100644 --- a/flink-runtime/src/main/java/org/apache/flink/runtime/io/network/partition/SortMergeSubpartitionReader.java +++ b/flink-runtime/src/main/java/org/apache/flink/runtime/io/network/partition/SortMergeSubpartitionReader.java @@ -138,7 +138,9 @@ public class SortMergeSubpartitionReader implements ResultSubpartitionView, Buff @Override public void recycle(MemorySegment segment) { - readBuffers.add(segment); + if (!isReleased) { + readBuffers.add(segment); + } // notify data available if the reader is unavailable currently if (!isReleased && readBuffers.size() == NUM_READ_BUFFERS) { @@ -155,6 +157,9 @@ public class SortMergeSubpartitionReader implements ResultSubpartitionView, Buff public void releaseAllResources() { isReleased = true; + buffersRead.clear(); + readBuffers.clear(); + IOUtils.closeQuietly(fileReader); partition.releaseReader(this); }
[FLINK-<I>][network] Release all buffers when releasing the SortMergeSubpartitionReader By releasing all buffers read, the SortMergeSubpartitionReader is marked as unavailable. This closes #<I>.
apache_flink
train
java
2d44915934931c00868e4d4770feab1363659bae
diff --git a/src/Principal.php b/src/Principal.php index <HASH>..<HASH> 100644 --- a/src/Principal.php +++ b/src/Principal.php @@ -75,7 +75,7 @@ abstract class Principal implements Interfaces\PrincipalPipeline return $this; } - private static function apply(/* iterable */ $previous, callable $func): \Generator + private static function apply(iterable $previous, callable $func): \Generator { foreach ($previous as $value) { $result = $func($value);
Psalm and Phan both fail on this, but that's a valid code
sanmai_pipeline
train
php
3056745960bd04e1f95bd481bd03904e2d719815
diff --git a/src/Xmla.js b/src/Xmla.js index <HASH>..<HASH> 100644 --- a/src/Xmla.js +++ b/src/Xmla.js @@ -508,7 +508,7 @@ function _xjs(xml) { } } else { - return String.fromCharCode(g4, g3 ? 16: 10); + return String.fromCharCode(parseInt(g4, g3 ? 16: 10)); } }); }
Fixed an error in unescape entities. Unescaping numbered character entities results in addition of extra newline (ascii: <I>) or DLE (ascii: <I>) characters.
rpbouman_xmla4js
train
js
2daf18166f19d7fd4d30ea859ca749937bc5f34c
diff --git a/management/commands/batch_import.py b/management/commands/batch_import.py index <HASH>..<HASH> 100644 --- a/management/commands/batch_import.py +++ b/management/commands/batch_import.py @@ -86,7 +86,7 @@ class Command(BaseCommand): tags = [] if options['dirnames']: - tags = file_.parent.replace(options['topdir'], '').split('/') + tags = file_.parent.replace(options['topdir'], '').replace('\\', '/').split('/') tags = filter(None, tags) obj.export(hashVal, hashPath, tags=tags)
Fixed bug with batch import and auto tagging
theiviaxx_Frog
train
py
9e53d42a071f7afa3300b6c8627aaeed779b13c7
diff --git a/cnxpublishing/subscribers.py b/cnxpublishing/subscribers.py index <HASH>..<HASH> 100644 --- a/cnxpublishing/subscribers.py +++ b/cnxpublishing/subscribers.py @@ -63,6 +63,9 @@ def _get_recipes(module_ident, cursor): LEFT JOIN module_files mf ON m.module_ident = mf.module_ident AND m.print_style = mf.filename + LEFT JOIN module_files mf2 + ON m.module_ident = mf2.module_ident + AND mf2.filename = 'ruleset.css' LEFT JOIN latest_modules lm ON m.uuid = lm.uuid WHERE m.module_ident = %s""", (module_ident,))
add fallback to fixed name for recipe
openstax_cnx-publishing
train
py
e44039b1b0a0ec573ff4a0616cc1e5407cae2c21
diff --git a/lib/moonshot/build_mechanism/github_release.rb b/lib/moonshot/build_mechanism/github_release.rb index <HASH>..<HASH> 100644 --- a/lib/moonshot/build_mechanism/github_release.rb +++ b/lib/moonshot/build_mechanism/github_release.rb @@ -33,6 +33,12 @@ module Moonshot::BuildMechanism end end + def build_cli_hook(parser) + parser.on('-s', '--skip-ci-status', 'Skips checks on CI jobs', FalseClass) do |value| + @skip_ci_status = value + end + end + def doctor_hook super @build_mechanism.doctor_hook
CPD-<I> | As a cloud data engineer, I would like to able to skip the SHA status check when building a release. (#<I>)
acquia_moonshot
train
rb
0702fef488e35e9e38058f50dc610215468d85dc
diff --git a/src/lib/polyfills.js b/src/lib/polyfills.js index <HASH>..<HASH> 100644 --- a/src/lib/polyfills.js +++ b/src/lib/polyfills.js @@ -1,17 +1,3 @@ -// CustomEvent -if (window && !window.CustomEvent) { - let CustomEvent = (event, params) => { - params = params || {bubbles: false, cancelable: false, detail: undefined}; - let evt = document.createEvent('CustomEvent'); - evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail); - return evt; - }; - - CustomEvent.prototype = window.Event.prototype; - - window.CustomEvent = CustomEvent; -} - // Element.prototype.closest if (window) { window.Element.prototype.closest = window.Element.prototype.closest || function (css) {
Removed CustomEvents polyfill
VKCOM_VKUI
train
js
ff2ab1e7fa557fe80c861452d5cb3966764376fe
diff --git a/yoda/adapter/abstract.py b/yoda/adapter/abstract.py index <HASH>..<HASH> 100644 --- a/yoda/adapter/abstract.py +++ b/yoda/adapter/abstract.py @@ -32,7 +32,10 @@ class Abstract: def execute(self, command, path=None): """Execute command with os.popen and return output.""" + logger = logging.getLogger(__name__) + self.check_executable() + logger.debug("Executing command `%s` (cwd: %s)" % (command, path)) stdout, stderr = subprocess.Popen( command, shell=True, @@ -41,7 +44,6 @@ class Abstract: stderr=subprocess.PIPE ).communicate() - logger = logging.getLogger(__name__) if stdout: logger.info(stdout.decode("utf-8")) @@ -50,7 +52,7 @@ class Abstract: def exec_on_path(self, command): """Execute command in repository path.""" - self.execute("%s" % (command), self.path) + self.execute("%s" % command, self.path) def check_executable(self): """Check adapter executable exists."""
Added debug log for executed command
Numergy_yoda
train
py
daebefce4e04f78cc329a5b0bef6997852cf9668
diff --git a/tests/LINEBot/NarrowCastTest.php b/tests/LINEBot/NarrowCastTest.php index <HASH>..<HASH> 100644 --- a/tests/LINEBot/NarrowCastTest.php +++ b/tests/LINEBot/NarrowCastTest.php @@ -53,6 +53,17 @@ class NarrowCastTest extends TestCase 'audienceGroupId' => 21234567890 ] ], $data['recipient']['and'][1]); + $testRunner->assertEquals([ + 'type' => 'redelivery', + 'requestId' => 'test request id 1' + ], $data['recipient']['and'][2]); + $testRunner->assertEquals([ + 'type' => 'operator', + 'not' => [ + 'type' => 'redelivery', + 'requestId' => 'test request id 2' + ] + ], $data['recipient']['and'][3]); $testRunner->assertEquals('operator', $data['filter']['demographic']['type']); $testRunner->assertEquals([ 'type' => 'gender',
add assertion/tests for redelivery object
line_line-bot-sdk-php
train
php
6face3e7e4622f048e3a3a6c52b98534b971e8e8
diff --git a/shinken/modules/nsca.py b/shinken/modules/nsca.py index <HASH>..<HASH> 100644 --- a/shinken/modules/nsca.py +++ b/shinken/modules/nsca.py @@ -35,7 +35,7 @@ from shinken.basemodule import BaseModule from shinken.external_command import ExternalCommand properties = { - 'daemons' : ['arbiter'], + 'daemons' : ['arbiter', 'receiver'], 'type' : 'nsca_server', 'external' : True, 'phases' : ['running'],
Add : make the nsca module available for the receiver... Ok, this one is still not here, but it will.
Alignak-monitoring_alignak
train
py
890e1aacc3b701fd5302c7dcf07bee21f7fbdf85
diff --git a/lib/outputrequirementslib.php b/lib/outputrequirementslib.php index <HASH>..<HASH> 100644 --- a/lib/outputrequirementslib.php +++ b/lib/outputrequirementslib.php @@ -219,8 +219,7 @@ class page_requirements_manager { 'moodle-' => array( 'group' => 'moodle', 'configFn' => '@MOODLECONFIGFN@' - ), - 'root' => 'moodle' + ) ) ), 'local' => array( @@ -235,8 +234,7 @@ class page_requirements_manager { 'gallery-' => array( 'group' => 'gallery', 'configFn' => '@GALLERYCONFIGFN@', - ), - 'root' => 'gallery' + ) ) ) );
MDL-<I> remove root from yui MODULE pattern definition The problem was that the root was breaking internal group handling in YUI loader for some reason. Without the root pattern property everything seems to work fine again.
moodle_moodle
train
php
5110f6a1f20e80523b517acd38c3d37c12b3ba33
diff --git a/lib/config.js b/lib/config.js index <HASH>..<HASH> 100644 --- a/lib/config.js +++ b/lib/config.js @@ -70,7 +70,8 @@ exports.setupConfiguration = function(config) { config.run.absResultDir = path.join(startPath, config.urlObject.hostname, config.startFolder); } else if (config.file) { // TODO handle the file name in a good way if it contains chars that will not fit in a dir - config.run.absResultDir = path.join(startPath, config.file, config.startFolder); + // Only take the filename, excluding dirs + config.run.absResultDir = path.join(startPath, path.basename(config.file), config.startFolder); } else if (config.sites) { // The log file will end up here config.run.absResultDir = path.join(startPath, 'sites', config.startFolder);
when testing URLS from a file, just use the filename (not path) for the folder name
sitespeedio_sitespeed.io
train
js
a64f425891be3eb873248dcb9a4abf5544d16b4c
diff --git a/relaxng/datatype/java/src/org/whattf/datatype/MetaName.java b/relaxng/datatype/java/src/org/whattf/datatype/MetaName.java index <HASH>..<HASH> 100644 --- a/relaxng/datatype/java/src/org/whattf/datatype/MetaName.java +++ b/relaxng/datatype/java/src/org/whattf/datatype/MetaName.java @@ -93,6 +93,7 @@ public class MetaName extends AbstractDatatype { "dcterms.title", // extension "dcterms.type", // extension "dcterms.valid", // extension + "description", "es.title", // extension "format-detection", // extension "generator",
Restore accidentally deleted keyword "description".
validator_validator
train
java
394cdd8e385d94c9a3d2369363252f0cc909c5e0
diff --git a/src/utils/unwrapProperties.js b/src/utils/unwrapProperties.js index <HASH>..<HASH> 100644 --- a/src/utils/unwrapProperties.js +++ b/src/utils/unwrapProperties.js @@ -1,14 +1 @@ -ko.utils.unwrapProperties = function (wrappedProperies) { - - if (wrappedProperies === null || typeof wrappedProperies !== 'object') { - return wrappedProperies; - } - - var options = {}; - - ko.utils.objectForEach(wrappedProperies, function (propertyName, propertyValue) { - options[propertyName] = ko.unwrap(propertyValue); - }); - - return options; -}; \ No newline at end of file +ko.utils.unwrapProperties = ko.toJS; \ No newline at end of file
Removed unwrapProperties implementation as ko.toJS do the same. ko.utils.unwrapProperties is alias for ko.toJS now for compatibility.
faulknercs_Knockstrap
train
js
d288c5b4eb2173fb21cbfc6fcfaa5ff7b61a7e06
diff --git a/examples/topojson.js b/examples/topojson.js index <HASH>..<HASH> 100644 --- a/examples/topojson.js +++ b/examples/topojson.js @@ -15,6 +15,15 @@ var raster = new ol.layer.Tile({ }) }); +var styleArray = [new ol.style.Style({ + fill: new ol.style.Fill({ + color: 'rgba(255, 255, 255, 0.6)' + }), + stroke: new ol.style.Stroke({ + color: '#319FD3', + width: 1 + }) +})]; var vector = new ol.layer.Vector({ source: new ol.source.TopoJSON({ @@ -22,17 +31,8 @@ var vector = new ol.layer.Vector({ url: 'data/topojson/world-110m.json' }), styleFunction: function(feature, resolution) { - var styleArray = [new ol.style.Style({ - fill: new ol.style.Fill({ - color: 'rgba(255, 255, 255, 0.6)' - }), - stroke: new ol.style.Stroke({ - color: '#319FD3', - width: 1 - }), - zIndex: (feature.getGeometry().getType() !== 'MultiPolygon') ? 2 : 1 - })]; - return styleArray; + // don't want to render the full world polygon, which repeats all countries + return feature.getId() !== undefined ? styleArray : null; } });
Don't render feature with all countries The feature with undefined id is a multi-polygon representing all countries. Instead of rendering all multi-polygons with a lower z-index, we just avoid rendering this single feature.
openlayers_openlayers
train
js
e8b845b446e3a9f796312afa57deb433f9a27cd8
diff --git a/telemetry/telemetry/__init__.py b/telemetry/telemetry/__init__.py index <HASH>..<HASH> 100644 --- a/telemetry/telemetry/__init__.py +++ b/telemetry/telemetry/__init__.py @@ -53,22 +53,18 @@ def RemoveAllStalePycFiles(base_dir): pyc_path = os.path.join(dirname, filename) py_path = os.path.join(dirname, root + '.py') - if os.path.exists(py_path): - continue try: - os.remove(pyc_path) + if not os.path.exists(py_path): + os.remove(pyc_path) except OSError: - # Avoid race, in case we're running simultaneous instances. + # Wrap OS calls in try/except in case another process touched this file. pass - if os.listdir(dirname): - continue - try: os.removedirs(dirname) except OSError: - # Avoid race, in case we're running simultaneous instances. + # Wrap OS calls in try/except in case another process touched this dir. pass
[telemetry] Fix Pyc failures. Wrap all OS calls in exception handlers. They can all potentially run after the file or directory has been deleted by another process, causing a race condition. BUG=<I> TEST=None. TBR=<EMAIL> Review URL: <URL>
catapult-project_catapult
train
py
3b6c81e7c0110333151bae525123fccc7934921d
diff --git a/indexing-hadoop/src/main/java/io/druid/indexer/HadoopDruidIndexerConfig.java b/indexing-hadoop/src/main/java/io/druid/indexer/HadoopDruidIndexerConfig.java index <HASH>..<HASH> 100644 --- a/indexing-hadoop/src/main/java/io/druid/indexer/HadoopDruidIndexerConfig.java +++ b/indexing-hadoop/src/main/java/io/druid/indexer/HadoopDruidIndexerConfig.java @@ -487,7 +487,7 @@ public class HadoopDruidIndexerConfig { return new Path( String.format( - "%s/%s/%s/%s", + "%s/%s/%s_%s", getWorkingPath(), schema.getDataSchema().getDataSource(), schema.getTuningConfig().getVersion().replace(":", ""),
fix cleanup of hadoop ingestion intermediate path (#<I>)
apache_incubator-druid
train
java
3adc472f06f7c435b922ac3f905d021114029712
diff --git a/gulpfile.js b/gulpfile.js index <HASH>..<HASH> 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -1123,8 +1123,8 @@ gulp.task('!bundle.testing', ['build.js.dev'], function() { {sourceMaps: true}); }); -gulp.task('!bundles.js.docs', function() { - gulp.src('modules/angular2/docs/bundles/*').pipe(gulp.dest('dist/js/bundle')); +gulp.task('!bundles.js.docs', ['clean'], function() { + return gulp.src('modules/angular2/docs/bundles/*').pipe(gulp.dest('dist/js/bundle')); }); gulp.task('!bundles.js.umd', ['build.js.dev'], function() {
chore(build): fix race condition for the !bundles.js.docs task
angular_angular
train
js
97929fafe43d7a41f361de6cf0f9760d31839fa7
diff --git a/collectors/caps.php b/collectors/caps.php index <HASH>..<HASH> 100644 --- a/collectors/caps.php +++ b/collectors/caps.php @@ -59,6 +59,7 @@ class QM_Collector_Caps extends QM_Collector { public function tear_down() { remove_filter( 'user_has_cap', array( $this, 'filter_user_has_cap' ), 9999 ); remove_filter( 'map_meta_cap', array( $this, 'filter_map_meta_cap' ), 9999 ); + parent::tear_down(); } /** diff --git a/collectors/transients.php b/collectors/transients.php index <HASH>..<HASH> 100644 --- a/collectors/transients.php +++ b/collectors/transients.php @@ -18,9 +18,9 @@ class QM_Collector_Transients extends QM_Collector { } public function tear_down() { - parent::tear_down(); remove_action( 'setted_site_transient', array( $this, 'action_setted_site_transient' ), 10 ); remove_action( 'setted_transient', array( $this, 'action_setted_blog_transient' ), 10 ); + parent::tear_down(); } public function action_setted_site_transient( $transient, $value, $expiration ) {
Standardise the collector teardowns, even though there's nothing in the parent method at the moment.
johnbillion_query-monitor
train
php,php
381b94c6592b428d1f092c6ceb9c411847747abc
diff --git a/pyes/filters.py b/pyes/filters.py index <HASH>..<HASH> 100644 --- a/pyes/filters.py +++ b/pyes/filters.py @@ -203,6 +203,11 @@ class MissingFilter(TermFilter): def __init__(self, field=None, **kwargs): super(MissingFilter, self).__init__(field="field", value=field, **kwargs) +class ExistsFilter(TermFilter): + _internal_name = "exists" + def __init__(self, field=None, **kwargs): + super(ExistsFilter, self).__init__(field="field", value=field, **kwargs) + class RegexTermFilter(Filter): _internal_name = "regex_term"
Edited pyes/filters.py via GitHub
aparo_pyes
train
py
5a33ed25488056bbf8afc22ef6c5df94c7938c1e
diff --git a/client/src/main/java/nats/client/NatsImpl.java b/client/src/main/java/nats/client/NatsImpl.java index <HASH>..<HASH> 100644 --- a/client/src/main/java/nats/client/NatsImpl.java +++ b/client/src/main/java/nats/client/NatsImpl.java @@ -464,7 +464,8 @@ class NatsImpl implements Nats { subscription = subscriptions.get(frame.getId()); } if (subscription == null) { - throw new NatsException("Received a body for an unknown subscription."); + LOGGER.debug("Received a message with the subject '{}' with no subscribers.", frame.getSubject()); + return; } subscription.onMessage(frame.getSubject(), frame.getBody(), frame.getReplyTo(), executor); }
Don't throw an exception when a message is received on a closed subscription.
cloudfoundry-community_java-nats
train
java
08f32769ff096903f0aacc1a7a43313029fd2aef
diff --git a/go/kbfs/kbfshash/hash.go b/go/kbfs/kbfshash/hash.go index <HASH>..<HASH> 100644 --- a/go/kbfs/kbfshash/hash.go +++ b/go/kbfs/kbfshash/hash.go @@ -56,7 +56,7 @@ const ( // SHA256HashV2 is the type of a SHA256 hash over V2-encrypted data. SHA256HashV2 HashType = 2 - // MaxHashType is the numerically-largest hash type. + // MaxHashType is the highest-supported hash type. MaxHashType HashType = SHA256HashV2 )
kbfshash: improve MaxHashType comment Suggested by songgao. Issue: #<I>
keybase_client
train
go
2fee93485e97fbfcdca3d69b5c4df237e492ca5b
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index <HASH>..<HASH> 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -50,6 +50,7 @@ class ApplicationController < ActionController::Base end def redirect_to_root + response.headers["Cache-Control"] = "private, max-age=60" redirect_to root_path end
Add Cache-Control header for unauthenticated requests redirect <I> return for `signed_in? => false` gets cached by fastly as it doesn't have `Set-Cookie` header in response. We can continue to cache these <I> if we modify our vcl to check response path of all <I>s. Using Cache-Control header in the application seems simpler solution to me if not the perfect one.
rubygems_rubygems.org
train
rb
a89cde947558c74281c3616862967e5b5cd2e260
diff --git a/codec-http2/src/main/java/io/netty/handler/codec/http2/Http2StreamChannelBootstrap.java b/codec-http2/src/main/java/io/netty/handler/codec/http2/Http2StreamChannelBootstrap.java index <HASH>..<HASH> 100644 --- a/codec-http2/src/main/java/io/netty/handler/codec/http2/Http2StreamChannelBootstrap.java +++ b/codec-http2/src/main/java/io/netty/handler/codec/http2/Http2StreamChannelBootstrap.java @@ -166,6 +166,9 @@ public final class Http2StreamChannelBootstrap { @Deprecated public void open0(ChannelHandlerContext ctx, final Promise<Http2StreamChannel> promise) { assert ctx.executor().inEventLoop(); + if (!promise.setUncancellable()) { + return; + } final Http2StreamChannel streamChannel; if (ctx.handler() instanceof Http2MultiplexCodec) { streamChannel = ((Http2MultiplexCodec) ctx.handler()).newOutboundStream();
Support cancellation in the Http2StreamChannelBootstrap (#<I>) Motivation: Right now you can cancel the Future returned by `Http2StreamChannelBootstrap.open()` and that will race with the registration of the stream channel with the event loop, potentially culminating in an `IllegalStateException` and potential resource leak. Modification: Ensure that the returned promise is uncancellable. Result: Should no longer see `IllegalStateException`s.
netty_netty
train
java
a4c3242177dde154c9746bfec81c0f5e8b672adf
diff --git a/structr-ui/src/main/java/org/structr/web/entity/dom/DOMNode.java b/structr-ui/src/main/java/org/structr/web/entity/dom/DOMNode.java index <HASH>..<HASH> 100644 --- a/structr-ui/src/main/java/org/structr/web/entity/dom/DOMNode.java +++ b/structr-ui/src/main/java/org/structr/web/entity/dom/DOMNode.java @@ -38,6 +38,7 @@ import org.structr.common.Permission; import org.structr.common.RelType; import org.structr.common.SecurityContext; import org.structr.common.error.FrameworkException; +import org.structr.core.EntityContext; import org.structr.core.GraphObject; import org.structr.core.Predicate; import org.structr.core.Result; @@ -513,8 +514,8 @@ public abstract class DOMNode extends LinkedTreeNode implements Node, Renderable } if (_data != null) { - - Object value = _data.getProperty(referenceKeyProperty); + + Object value = _data.getProperty(EntityContext.getPropertyKeyForJSONName(_data.getClass(), referenceKeyProperty.jsonName())); return value != null ? value : defaultValue; }
use property key of the right type to get values from data object
structr_structr
train
java
c7df691033a420102b6b566a15a6d06f57aecab7
diff --git a/lib/attributor/types/collection.rb b/lib/attributor/types/collection.rb index <HASH>..<HASH> 100644 --- a/lib/attributor/types/collection.rb +++ b/lib/attributor/types/collection.rb @@ -79,13 +79,10 @@ module Attributor # The incoming value should be an array here, so the only decoding that we need to do # is from the members (if there's an :member_type defined option). def self.load(value) - case value - when Array + if value.is_a?(Enumerable) loaded_value = value - when ::String + elsif value.is_a?(::String) loaded_value = decode_json(value) - when Set - loaded_value = value.to_a else raise AttributorException.new("Do not know how to decode an array from a #{value.class.name}") end
acu<I> - support for loading collections with loser type checking
praxis_attributor
train
rb
f85289c1132f0ef20fc9b4c488e0b0b8c38a2350
diff --git a/main.go b/main.go index <HASH>..<HASH> 100644 --- a/main.go +++ b/main.go @@ -22,12 +22,13 @@ var cli = &Cli{} // BuiltinPlugins are the core plugins that will be autoinstalled var BuiltinPlugins = []string{ - "heroku-cli-addons", "heroku-apps", + "heroku-cli-addons", "heroku-fork", "heroku-git", "heroku-local", "heroku-run", + "heroku-spaces", "heroku-status", }
add heroku-spaces to built in plugins
heroku_cli
train
go
61858d164dc1cbecea4a69a28cfd7a9ad25719c3
diff --git a/Configuration/TCA/tx_styleguide_palette.php b/Configuration/TCA/tx_styleguide_palette.php index <HASH>..<HASH> 100644 --- a/Configuration/TCA/tx_styleguide_palette.php +++ b/Configuration/TCA/tx_styleguide_palette.php @@ -134,7 +134,7 @@ return [ ], 'palette_4_2' => [ 'exclude' => 1, - 'label' => 'palette_4_2', + 'label' => 'palette_4_2 This is a really long label text. AndOneWordIsReallyEvenMuchLongerWhoWritesThoseLongWordsAnyways?', 'config' => [ 'type' => 'input', ],
[TASK] Palette example with a very long label Related: #<I>
TYPO3_styleguide
train
php
57084220109d1910847be257a64447b6a3317e73
diff --git a/dyndnsc/updater/dyndns2.py b/dyndnsc/updater/dyndns2.py index <HASH>..<HASH> 100644 --- a/dyndnsc/updater/dyndns2.py +++ b/dyndnsc/updater/dyndns2.py @@ -45,8 +45,8 @@ class UpdateProtocolDyndns2(UpdateProtocol): try: r = requests.get(self.updateUrl(), params=params, auth=(self.userid, self.password), timeout=timeout) - except requests.exceptions.Timeout as exc: - log.warning("HTTP timeout(%i) occurred while updating IP at '%s'", + except (requests.exceptions.Timeout, requests.exceptions.ConnectionError) as exc: + log.warning("an error occurred while updating IP at '%s'", timeout, self.updateUrl(), exc_info=exc) return False else:
catch socket error while updating dyndns2 protocols. This can happen on machines with very dynamic setups, i.e. the link goes away or changes during an update
infothrill_python-dyndnsc
train
py
ad6792f8a6ba25d8386d4ced5f26a18a2bb26728
diff --git a/lib/templates/default/fulldoc/html/js/cucumber.js b/lib/templates/default/fulldoc/html/js/cucumber.js index <HASH>..<HASH> 100644 --- a/lib/templates/default/fulldoc/html/js/cucumber.js +++ b/lib/templates/default/fulldoc/html/js/cucumber.js @@ -116,11 +116,11 @@ $(function() { if (typeof eventObject.currentTarget !== "undefined") { var exampleRow = $(eventObject.currentTarget); - if (eventObject.currentTarget.className.match(/example\d+/) == null) { + if (eventObject.currentTarget.className.match(/example\d+-\d+/) == null) { return false; } - var exampleClass = eventObject.currentTarget.className.match(/example\d+/)[0]; + var exampleClass = eventObject.currentTarget.className.match(/example\d+-\d+/)[0]; var example = exampleRow.closest('div.details').find('.' + exampleClass); var currentExample = null;
Modified the Scenario Outlines - Toggle Examples to include the correct class name for scenarios so they work with multiple Examples.
burtlo_yard-cucumber
train
js
7ae0c748a5c4519c18a703d61315d6695e81212f
diff --git a/jlib-core/src/main/java/org/jlib/core/array/ArrayUtility.java b/jlib-core/src/main/java/org/jlib/core/array/ArrayUtility.java index <HASH>..<HASH> 100644 --- a/jlib-core/src/main/java/org/jlib/core/array/ArrayUtility.java +++ b/jlib-core/src/main/java/org/jlib/core/array/ArrayUtility.java @@ -37,6 +37,11 @@ public final class ArrayUtility { /** empty array of Objects */ public static final Object[] EMPTY_ARRAY = new Object[0]; + @SuppressWarnings("unchecked") + public <Item> Item[] emptyArray() { + return (Item[]) EMPTY_ARRAY; + } + /** * Returns a new {@link Iterable} adapter for the specified Items. *
ArrayUtility.emptyArray() created
jlib-framework_jlib-operator
train
java
6d6c524c7fdef7aa56040de9b697140c699ab141
diff --git a/lib/watir2.rb b/lib/watir2.rb index <HASH>..<HASH> 100644 --- a/lib/watir2.rb +++ b/lib/watir2.rb @@ -1 +1 @@ -load "#{File.dirname(__FILE__)}/watir" \ No newline at end of file +load "#{File.dirname(__FILE__)}/watir.rb" \ No newline at end of file
load() needs .rb extension
watir_watir
train
rb
62e3ee26077fc577b10a69a12e28d0bde7675ee5
diff --git a/docs/conf.py b/docs/conf.py index <HASH>..<HASH> 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -24,9 +24,9 @@ copyright = '2014, Jacon Tomlinson' author = 'Jacob Tomlinson' # The short X.Y version -version = '0.4' +version = '0.7' # The full version, including alpha/beta/rc tags -release = '0.4.3' +release = '0.7.0' # -- General configuration ---------------------------------------------------
Update conf.py for docs
jacobtomlinson_datapoint-python
train
py
4faeca163b7034da56bc94a09cbae664b2dbc3f7
diff --git a/lib/Delayed.php b/lib/Delayed.php index <HASH>..<HASH> 100644 --- a/lib/Delayed.php +++ b/lib/Delayed.php @@ -12,7 +12,7 @@ final class Delayed implements Promise { use Internal\Placeholder; - /** @var string Event loop watcher identifier. */ + /** @var string|null Event loop watcher identifier. */ private $watcher; /** @@ -22,6 +22,7 @@ final class Delayed implements Promise public function __construct(int $time, $value = null) { $this->watcher = Loop::delay($time, function () use ($value) { + $this->watcher = null; $this->resolve($value); }); } @@ -33,7 +34,9 @@ final class Delayed implements Promise */ public function reference() { - Loop::reference($this->watcher); + if ($this->watcher !== null) { + Loop::reference($this->watcher); + } } /** @@ -44,6 +47,8 @@ final class Delayed implements Promise */ public function unreference() { - Loop::unreference($this->watcher); + if ($this->watcher !== null) { + Loop::unreference($this->watcher); + } } }
Fix ref/unref of Delayed after resolving
amphp_amp
train
php
895f03e8207029870eeb83cb87ff1409ddd6542f
diff --git a/src/vs/workbench/contrib/webview/browser/pre/main.js b/src/vs/workbench/contrib/webview/browser/pre/main.js index <HASH>..<HASH> 100644 --- a/src/vs/workbench/contrib/webview/browser/pre/main.js +++ b/src/vs/workbench/contrib/webview/browser/pre/main.js @@ -135,13 +135,14 @@ * @return {string} */ function getVsCodeApiScript(allowMultipleAPIAcquire, state) { + const encodedState = state ? encodeURIComponent(JSON.stringify(state)) : undefined; return ` const acquireVsCodeApi = (function() { const originalPostMessage = window.parent.postMessage.bind(window.parent); const targetOrigin = '*'; let acquired = false; - let state = ${state ? `JSON.parse(${JSON.stringify(state)})` : undefined}; + let state = ${state ? `JSON.parse(decodeURIComponent("${encodedState}"))` : undefined}; return () => { if (acquired && !${allowMultipleAPIAcquire}) {
Encode webview state when injecting it into the webview Fixes #<I> This should make sure we handle cases where the state string contains special characters, such as `<`
Microsoft_vscode
train
js
d1e2f59acac042a9adaec301b29000f16da17aec
diff --git a/websocket/_app.py b/websocket/_app.py index <HASH>..<HASH> 100644 --- a/websocket/_app.py +++ b/websocket/_app.py @@ -244,7 +244,6 @@ class WebSocketApp(object): return True dispatcher.read(self.sock.sock, read) - dispatcher.dispatch() except (Exception, KeyboardInterrupt, SystemExit) as e: self._callback(self.on_error, e) if isinstance(e, SystemExit): @@ -261,10 +260,6 @@ class WebSocketApp(object): if r: callback() - def dispatch(_): - # do nothing - pass - return Dispatcher() def _get_close_args(self, data):
rmed Dispatcher.dispatch() and dispatcher.dispatch(), simplifying api
websocket-client_websocket-client
train
py
6930a8d6e67289335d6340ed049558dbddff8c58
diff --git a/ldapdb/models/base.py b/ldapdb/models/base.py index <HASH>..<HASH> 100644 --- a/ldapdb/models/base.py +++ b/ldapdb/models/base.py @@ -120,7 +120,7 @@ class Model(django.db.models.base.Model): # update an existing entry record_exists = True modlist = [] - orig = self.__class__.objects.get(pk=self.saved_pk) + orig = self.__class__.objects.using(using).get(pk=self.saved_pk) for field in self._meta.fields: if not field.db_column: continue
honour "using" when saving model (closes #<I>)
django-ldapdb_django-ldapdb
train
py
8744986baddd78c702e4c91f1628a4bfa1e4dcbf
diff --git a/lib/maruku/errors.rb b/lib/maruku/errors.rb index <HASH>..<HASH> 100644 --- a/lib/maruku/errors.rb +++ b/lib/maruku/errors.rb @@ -35,8 +35,17 @@ module MaRuKu end end + # This is like {#maruku_error} but will never raise. def maruku_recover(s, src=nil, con=nil, recover=nil) - tell_user create_frame(describe_error(s, src, con, recover)) + policy = get_setting(:on_error) + + case policy + when :ignore + when :raise, :warning + tell_user create_frame(describe_error(s, src, con, recover)) + else + raise "Unknown on_error policy: #{policy.inspect}" + end end def raise_error(s)
Update #maruku_recover to respect :on_error => :ignore. Fixes #<I>.
bhollis_maruku
train
rb
625462ff722a134e29dacd75b4af25a159d29e52
diff --git a/hamster/graphics.py b/hamster/graphics.py index <HASH>..<HASH> 100644 --- a/hamster/graphics.py +++ b/hamster/graphics.py @@ -77,10 +77,18 @@ class Area(gtk.DrawingArea): w, h = self.layout.get_pixel_size() return w, h - - def set_color(self, color, opacity = None): + def normalize_rgb(self, color): + #if any of values is over 1 - that means color has been entered in 0-255 range and we should normalize it if color[0] > 1 or color[1] > 0 or color[2] > 0: color = [c / 255.0 for c in color] + return color + + def rgb(self, color): + #return color that has each component in 0..255 range + return [c*255 for c in self.normalize_rgb(color)] + + def set_color(self, color, opacity = None): + color = self.normalize_rgb(color) if opacity: self.context.set_source_rgba(color[0], color[1], color[2], opacity)
two functions - whan that turns whatever into color with normalized components. the other returns same thing just in <I> range. handy when you don't know in which format the color has been fed in
projecthamster_hamster
train
py
e2b2065d9763965e29f98e24748efc0bfc89a485
diff --git a/src/resources/views/partials/sidebar.blade.php b/src/resources/views/partials/sidebar.blade.php index <HASH>..<HASH> 100644 --- a/src/resources/views/partials/sidebar.blade.php +++ b/src/resources/views/partials/sidebar.blade.php @@ -7,7 +7,7 @@ <!-- Sidebar user panel (optional) --> <div class="user-panel"> <div class="pull-left image"> - <img src="/img/user2-160x160.jpg" class="img-circle" alt="User Image" /> + <img src="{{asset('/img/user2-160x160.jpg'}}" class="img-circle" alt="User Image" /> </div> <div class="pull-left info"> <p>{{ Auth::user()->name }}</p> @@ -43,4 +43,4 @@ </ul><!-- /.sidebar-menu --> </section> <!-- /.sidebar --> -</aside> \ No newline at end of file +</aside>
updated sidebar.php assets file location
acacha_adminlte-laravel
train
php
d5fc4db6da5016006b2f7c16af9824f9d73a5707
diff --git a/drools-persistence-jpa/src/main/java/org/drools/persistence/session/SingleSessionCommandService.java b/drools-persistence-jpa/src/main/java/org/drools/persistence/session/SingleSessionCommandService.java index <HASH>..<HASH> 100644 --- a/drools-persistence-jpa/src/main/java/org/drools/persistence/session/SingleSessionCommandService.java +++ b/drools-persistence-jpa/src/main/java/org/drools/persistence/session/SingleSessionCommandService.java @@ -163,6 +163,10 @@ public class SingleSessionCommandService t2 ); } } + + if (sessionInfo == null) { + throw new RuntimeException("Could not find session data for id " + sessionId); + } this.marshallingHelper = new JPASessionMarshallingHelper( this.sessionInfo, kbase,
- added exception is session id cannot be found git-svn-id: <URL>
kiegroup_drools
train
java
4d355afca6d16bc82258befc93a251eefa336343
diff --git a/src/Phinx/Db/Adapter/PdoAdapter.php b/src/Phinx/Db/Adapter/PdoAdapter.php index <HASH>..<HASH> 100644 --- a/src/Phinx/Db/Adapter/PdoAdapter.php +++ b/src/Phinx/Db/Adapter/PdoAdapter.php @@ -158,7 +158,7 @@ abstract class PdoAdapter extends AbstractAdapter implements DirectActionInterfa */ public function execute($sql) { - $sql = rtrim($sql, ' \r\n\t\0\x0B;') . ';'; + $sql = rtrim($sql, "; \t\n\r\0\x0B") . ';'; $this->verboseLog($sql); if ($this->isDryRunEnabled()) {
Use double quotes for the trim escapes
cakephp_phinx
train
php
75235785679662e88e69a249aed540c323fe291b
diff --git a/lib/fastlane/actions/slack.rb b/lib/fastlane/actions/slack.rb index <HASH>..<HASH> 100644 --- a/lib/fastlane/actions/slack.rb +++ b/lib/fastlane/actions/slack.rb @@ -5,6 +5,23 @@ module Fastlane end class SlackAction + def self.git_branch + s = `git rev-parse --abbrev-ref HEAD` + return s if s.to_s.length > 0 + return nil + end + + def self.git_author + s = `git log --name-status HEAD^..HEAD` + s = s.match(/Author:.*<(.*)>/)[1] + return s if s.to_s.length > 0 + return nil + rescue + return nil + end + + + def self.run(params) options = { message: '', success: true, @@ -48,6 +65,22 @@ module Fastlane ] } + if git_branch + test_result[:fields] << { + title: "Git Branch", + value: git_branch, + short: true + } + end + + if git_author + test_result[:fields] << { + title: "Git Author", + value: git_author, + short: true + } + end + result = notifier.ping "", icon_url: 'https://s3-eu-west-1.amazonaws.com/fastlane.tools/fastlane.png', attachments: [test_result]
Added support for git branch and git author in Slack notifications
fastlane_fastlane
train
rb
747832dc721f6de5e767a8a63cc26340bf3ce1f1
diff --git a/lib/discordrb/data.rb b/lib/discordrb/data.rb index <HASH>..<HASH> 100644 --- a/lib/discordrb/data.rb +++ b/lib/discordrb/data.rb @@ -521,7 +521,7 @@ module Discordrb # @return [Hash<Integer => OpenStruct>] the channel's permission overwrites attr_reader :permission_overwrites - # @return [true, false] whether or not this channel is a PM channel, with more accuracy than {#is_private}. + # @return [true, false] whether or not this channel is a PM channel. def private? @server.nil? end
Update the Channel#private? doc comment to no longer reference is_private
meew0_discordrb
train
rb
0d20d2441c18886091f141d5e4af155e743e7236
diff --git a/molgenis-data-rest/src/test/java/org/molgenis/data/rest/v2/RestControllerV2IT.java b/molgenis-data-rest/src/test/java/org/molgenis/data/rest/v2/RestControllerV2IT.java index <HASH>..<HASH> 100644 --- a/molgenis-data-rest/src/test/java/org/molgenis/data/rest/v2/RestControllerV2IT.java +++ b/molgenis-data-rest/src/test/java/org/molgenis/data/rest/v2/RestControllerV2IT.java @@ -55,6 +55,13 @@ public class RestControllerV2IT adminToken = RestTestUtils.login(adminUserName, adminPassword); + LOG.info("Clean up test entities if they already exist..."); + removeEntity(adminToken, "it_emx_datatypes_TypeTestv2"); + removeEntity(adminToken, "it_emx_datatypes_TypeTestRefv2"); + removeEntity(adminToken, "it_emx_datatypes_Locationv2"); + removeEntity(adminToken, "it_emx_datatypes_Personv2"); + LOG.info("Cleaned up existing test entities."); + LOG.info("Importing RestControllerV2_TestEMX.xlsx..."); uploadEMX(adminToken, "/RestControllerV2_TestEMX.xlsx"); LOG.info("Importing Done");
Fix #<I>: RestControllerV2IT can fail depending on server state before the test
molgenis_molgenis
train
java
1071e9a96bc6da39da4bab5d7931b9c940db119d
diff --git a/library/Garp/Cli/Command/Snippet.php b/library/Garp/Cli/Command/Snippet.php index <HASH>..<HASH> 100755 --- a/library/Garp/Cli/Command/Snippet.php +++ b/library/Garp/Cli/Command/Snippet.php @@ -98,7 +98,8 @@ class Garp_Cli_Command_Snippet extends Garp_Cli_Command { foreach ($snippets as $identifier => $data) { $identifier = $this->_normalizeIdentifier($identifier); $snippetData = $data->toArray(); - $snippetData['identifier'] = $identifier; + $snippetData['identifier'] = isset($snippetData['identifier']) ? + $snippetData['identifier'] : $identifier; $existing = $this->_fetchExisting($identifier); if (!$this->_overwrite && $existing) { Garp_Cli::lineOut('Skipping "' . $identifier . '". Snippet already exists.');
Allow overriding the identifier in snippets.ini
grrr-amsterdam_garp3
train
php
ec915c0c3c6275a9ec784f76cf8d3809de2fba55
diff --git a/index.js b/index.js index <HASH>..<HASH> 100644 --- a/index.js +++ b/index.js @@ -36,7 +36,13 @@ class ClinicBubbleprof { const paths = getLoggingPaths({ identifier: proc.pid }) // relay SIGINT to process - process.once('SIGINT', () => proc.kill('SIGINT')) + process.once('SIGINT', function () { + // we cannot kill(SIGINT) on windows but it seems + // to relay the ctrl-c signal per default, so only do this + // if not windows + /* istanbul ignore else: windows hack */ + if (os.platform() !== 'win32') proc.kill('SIGINT') + }) proc.once('exit', function (code, signal) { // Windows exit code STATUS_CONTROL_C_EXIT 0xC000013A returns 3221225786
rely on Windows Ctrl+C process-group propergation
nearform_node-clinic-bubbleprof
train
js
2a2a998bff1158bcc9f13e90ad86bb69a606495b
diff --git a/src/Uri.php b/src/Uri.php index <HASH>..<HASH> 100644 --- a/src/Uri.php +++ b/src/Uri.php @@ -464,7 +464,7 @@ class Uri implements UriInterface */ public function isAuthority() { - return ($this->getAuthority() === $this->__toString()); + return ((string) $this === $this->getAuthority()); } /** @@ -476,13 +476,7 @@ class Uri implements UriInterface */ public function isAsterisk() { - return ( - empty($this->scheme) - && empty($this->getAuthority()) - && empty($this->query) - && empty($this->fragment) - && $this->path === '*' - ); + return ((string) $this === '*'); } /**
Simplify logic of isAuthority, isAsterisk - Compare string value of instance to expected value
phly_http
train
php
e6b9dd1cc147a881ef39b36977c705ef2b76c63c
diff --git a/test/test_filters.rb b/test/test_filters.rb index <HASH>..<HASH> 100644 --- a/test/test_filters.rb +++ b/test/test_filters.rb @@ -575,7 +575,9 @@ class TestFilters < JekyllUnitTest g["items"].is_a?(Array), "The list of grouped items for 'default' is not an Array." ) - assert_equal 5, g["items"].size + # adjust array.size to ignore symlinked page in Windows + qty = Utils::Platforms.really_windows? ? 4 : 5 + assert_equal qty, g["items"].size when "nil" assert( g["items"].is_a?(Array), @@ -587,7 +589,9 @@ class TestFilters < JekyllUnitTest g["items"].is_a?(Array), "The list of grouped items for '' is not an Array." ) - assert_equal 15, g["items"].size + # adjust array.size to ignore symlinked page in Windows + qty = Utils::Platforms.really_windows? ? 14 : 15 + assert_equal qty, g["items"].size end end end
TestFilters: adjust array size to ignore symlinks Adjust the size of grouped-items array as it won't include symlinked pages in Windows.
jekyll_jekyll
train
rb
e88be25c2cc8f8a0211620033a432af73a0aece8
diff --git a/lib/data_mapper/environment.rb b/lib/data_mapper/environment.rb index <HASH>..<HASH> 100644 --- a/lib/data_mapper/environment.rb +++ b/lib/data_mapper/environment.rb @@ -23,6 +23,16 @@ module DataMapper # @api private attr_reader :relations + # The repositories setup with this environment + # + # @return [Hash<Symbol, Repository>] + # + # @api private + attr_reader :repositories + + protected :repositories + + # Initialize a new instance # # @param [Mapper::Registry, nil] registry @@ -163,10 +173,5 @@ module DataMapper self end - protected - - attr_reader :repositories - end # class Environment - end # module DataMapper
Make Environment#repositories protected explicitly
rom-rb_rom
train
rb
f119421a90d452b87c654054a50af8ac9aa30a5f
diff --git a/tests/test_checkers.py b/tests/test_checkers.py index <HASH>..<HASH> 100644 --- a/tests/test_checkers.py +++ b/tests/test_checkers.py @@ -798,7 +798,13 @@ def test_is_executable(fs, value, fails, allow_empty): if value: fs.create_file(value) - if fails and sys.platform in ['linux', 'linux2', 'darwin']: + if not fails and sys.platform in ['linux', 'linux2', 'darwin']: + if value: + os.chmod(value, 0o0777) + + result = checkers.is_executable(value) + assert result == expects + elif fails and sys.platform in ['linux', 'linux2', 'darwin']: if value: real_uid = os.getuid() real_gid = os.getgid() diff --git a/tests/test_validators.py b/tests/test_validators.py index <HASH>..<HASH> 100644 --- a/tests/test_validators.py +++ b/tests/test_validators.py @@ -943,7 +943,10 @@ def test_executable(fs, value, fails, allow_empty): if value: fs.create_file(value) - if not fails: + if not fails and sys.platform in ['linux', 'linux2', 'darwin']: + if value: + os.chmod(value, 0o0777) + validated = validators.executable(value, allow_empty = allow_empty)
GH-9: Fixed bugs in unit test setup.
insightindustry_validator-collection
train
py,py