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
63316b7b74107345def7bddf719125f309d734eb
diff --git a/activerecord/lib/active_record/database_configurations/database_config.rb b/activerecord/lib/active_record/database_configurations/database_config.rb index <HASH>..<HASH> 100644 --- a/activerecord/lib/active_record/database_configurations/database_config.rb +++ b/activerecord/lib/active_record/database_configurations/database_config.rb @@ -7,7 +7,7 @@ module ActiveRecord # as this is the parent class for the types of database configuration objects. class DatabaseConfig # :nodoc: attr_reader :env_name, :name, :spec_name - deprecate :spec_name, "spec_name accessors are deprecated and will be removed in Rails 6.2, please use name instead." + deprecate spec_name: "please use name instead" attr_accessor :owner_name diff --git a/activerecord/lib/active_record/tasks/database_tasks.rb b/activerecord/lib/active_record/tasks/database_tasks.rb index <HASH>..<HASH> 100644 --- a/activerecord/lib/active_record/tasks/database_tasks.rb +++ b/activerecord/lib/active_record/tasks/database_tasks.rb @@ -106,7 +106,7 @@ module ActiveRecord def spec @spec ||= "primary" end - deprecate :spec, "spec_name accessors are deprecated and will be removed in Rails 6.2, please use name instead." + deprecate spec: "please use name instead" def name @name ||= "primary"
Remove duplicate part from deprecation warning Before: ``` DEPRECATION WARNING: spec_name is deprecated and will be removed from Rails <I> (spec_name accessors are deprecated and will be removed in Rails <I>, please use name instead.) ``` After: ``` DEPRECATION WARNING: spec_name is deprecated and will be removed from Rails <I> (please use name instead) ``` Follow up of #<I>.
rails_rails
train
rb,rb
15378e36591abfb41ff05c9adbefa5ecbec065f1
diff --git a/thrifty-schema/src/main/java/com/microsoft/thrifty/schema/Constant.java b/thrifty-schema/src/main/java/com/microsoft/thrifty/schema/Constant.java index <HASH>..<HASH> 100644 --- a/thrifty-schema/src/main/java/com/microsoft/thrifty/schema/Constant.java +++ b/thrifty-schema/src/main/java/com/microsoft/thrifty/schema/Constant.java @@ -54,6 +54,7 @@ public class Constant implements UserElement { this.element = builder.element; this.namespaces = builder.namespaces; this.mixin = builder.mixin; + this.type = builder.type; } public ThriftType type() { @@ -129,11 +130,13 @@ public class Constant implements UserElement { private ConstElement element; private ImmutableMap<NamespaceScope, String> namespaces; + private final ThriftType type; Builder(Constant constant) { super(constant.mixin); this.element = constant.element; this.namespaces = constant.namespaces; + this.type = constant.type; } public Builder namespaces(Map<NamespaceScope, String> namespaces) {
Pass type through constant builder (#<I>)
Microsoft_thrifty
train
java
40e833d625c4d01388711b26fdc92ddf9b7a218b
diff --git a/tools/humanize/humanize.go b/tools/humanize/humanize.go index <HASH>..<HASH> 100644 --- a/tools/humanize/humanize.go +++ b/tools/humanize/humanize.go @@ -58,16 +58,16 @@ func ParseBytes(str string) (uint64, error) { return 0, err } - unit := strings.ToLower(strings.TrimSpace(str[sep:])) + m, err := ParseByteUnit(str[sep:]) + if err != nil { + return 0, err + } - if m, ok := bytesTable[unit]; ok { - f = f * float64(m) - if f >= math.MaxUint64 { - return 0, errors.New("number of bytes too large") - } - return uint64(f), nil + f = f * float64(m) + if f >= math.MaxUint64 { + return 0, errors.New("number of bytes too large") } - return 0, errors.Errorf("unknown unit: %q", unit) + return uint64(f), nil } // ParseByteUnit returns the number of bytes in a given unit of storage, or an
tools/humanize: use ParseByteUnit from ParseBytes
git-lfs_git-lfs
train
go
3f7c26a6126c3a98cd35dfc7420dd70b5372acde
diff --git a/src/Gordalina/Mangopay/Model/User.php b/src/Gordalina/Mangopay/Model/User.php index <HASH>..<HASH> 100644 --- a/src/Gordalina/Mangopay/Model/User.php +++ b/src/Gordalina/Mangopay/Model/User.php @@ -278,7 +278,7 @@ class User extends TimestampableModel */ public function setNationality($Nationality) { - if (!Utils::isISO3166($Nationality)) { + if ($Nationality !== null && !Utils::isISO3166($Nationality)) { throw new \InvalidArgumentException(sprintf('Invalid nationality iso code: %s', $Nationality)); }
Prevent blowing up when creating a user without nationality
gordalina_mangopay-php
train
php
afdaf046dc061020f31758aa3006f727ac0c764a
diff --git a/plugins/commands/serve/mappers/direct.rb b/plugins/commands/serve/mappers/direct.rb index <HASH>..<HASH> 100644 --- a/plugins/commands/serve/mappers/direct.rb +++ b/plugins/commands/serve/mappers/direct.rb @@ -37,8 +37,12 @@ module VagrantPlugins def converter(direct, mappers) args = direct.arguments.map do |v| - logger.trace("converting direct argument #{v} to something useful") - mappers.map(v) + begin + mappers.map(v) + rescue => err + logger.debug("Failed to map value #{v} - #{err}\n#{err.backtrace.join("\n")}") + raise + end end Type::Direct.new(arguments: args) end @@ -58,10 +62,10 @@ module VagrantPlugins def converter(d, mappers) args = d.args.map do |a| begin - logger.trace("direct argument list item map to any: #{a.pretty_inspect}") mappers.map(a, to: Google::Protobuf::Any) rescue => err - raise "Failed to map value #{a} - #{err}\n#{err.backtrace.join("\n")}" + logger.debug("Failed to map value #{a} - #{err}\n#{err.backtrace.join("\n")}") + raise end end SDK::Args::Direct.new(arguments: args)
Log errors from submapping on direct type
hashicorp_vagrant
train
rb
620a693035531d4d3a9481d9799d788b2c7d9530
diff --git a/generators/server/templates/src/main/java/package/config/locale/_AngularCookieLocaleResolver.java b/generators/server/templates/src/main/java/package/config/locale/_AngularCookieLocaleResolver.java index <HASH>..<HASH> 100644 --- a/generators/server/templates/src/main/java/package/config/locale/_AngularCookieLocaleResolver.java +++ b/generators/server/templates/src/main/java/package/config/locale/_AngularCookieLocaleResolver.java @@ -44,9 +44,8 @@ public class AngularCookieLocaleResolver extends CookieLocaleResolver { @Override public void addCookie(HttpServletResponse response, String cookieValue) { - // Mandatory cookie modification for angular to support the locale switching on the server side. - cookieValue = "%22" + cookieValue + "%22"; - super.addCookie(response, cookieValue); + // Mandatory cookie modification for AngularJS to support the locale switching on the server side. + super.addCookie(response, "%22" + cookieValue + "%22"); } private void parseLocaleCookieIfNecessary(HttpServletRequest request) {
[Sonar] remove variable intermediary change
jhipster_generator-jhipster
train
java
b312b8c48046cbbcb1580c255e0788b97c862f4e
diff --git a/ast_test.go b/ast_test.go index <HASH>..<HASH> 100644 --- a/ast_test.go +++ b/ast_test.go @@ -283,7 +283,7 @@ var astTests = []testCase{ }, }, { - []string{"foo | bar", "foo|bar"}, + []string{"foo | bar", "foo|bar", "foo |\n#etc\nbar"}, BinaryExpr{ Op: OR, X: litStmt("foo"), diff --git a/parse.go b/parse.go index <HASH>..<HASH> 100644 --- a/parse.go +++ b/parse.go @@ -654,6 +654,8 @@ func (p *parser) gotStmt(s *Stmt, wantStop bool) bool { func (p *parser) binaryExpr(op Token, left Stmt) (b BinaryExpr) { b.OpPos = p.lpos b.Op = op + for p.got('#') { + } p.wantFollowStmt(op.String(), &b.Y, true) b.X = left return
Fix comments right after a binary operator
mvdan_sh
train
go,go
fcb4bf6759c8fa674d749f2129f833195cd50431
diff --git a/ez_setup.py b/ez_setup.py index <HASH>..<HASH> 100644 --- a/ez_setup.py +++ b/ez_setup.py @@ -30,7 +30,7 @@ try: except ImportError: USER_SITE = None -DEFAULT_VERSION = "14.4" +DEFAULT_VERSION = "14.3.1" DEFAULT_URL = "https://pypi.python.org/packages/source/s/setuptools/" DEFAULT_SAVE_DIR = os.curdir diff --git a/setuptools/version.py b/setuptools/version.py index <HASH>..<HASH> 100644 --- a/setuptools/version.py +++ b/setuptools/version.py @@ -1 +1 @@ -__version__ = '14.4' +__version__ = '14.3.1'
Bumped to <I> in preparation for next release.
pypa_setuptools
train
py,py
5f47f9f5ccafea3a8423f786b76a190df8a8067c
diff --git a/transport/http2_client.go b/transport/http2_client.go index <HASH>..<HASH> 100644 --- a/transport/http2_client.go +++ b/transport/http2_client.go @@ -252,8 +252,7 @@ func (t *http2Client) newStream(ctx context.Context, callHdr *CallHdr) *Stream { s.windowHandler = func(n int) { t.updateWindow(s, uint32(n)) } - // Make a stream be able to cancel the pending operations by itself. - s.ctx, s.cancel = context.WithCancel(ctx) + s.ctx = ctx s.dec = &recvBufferReader{ ctx: s.ctx, goAway: s.goAway, diff --git a/transport/transport.go b/transport/transport.go index <HASH>..<HASH> 100644 --- a/transport/transport.go +++ b/transport/transport.go @@ -169,7 +169,8 @@ type Stream struct { // nil for client side Stream. st ServerTransport // ctx is the associated context of the stream. - ctx context.Context + ctx context.Context + // cancel is always nil for client side Stream. cancel context.CancelFunc // done is closed when the final status arrives. done chan struct{}
Use user context instead of creating new context for client side stream
grpc_grpc-go
train
go,go
8b94deb57083a7893e0baa7cbe6dc52b29aef0be
diff --git a/src/Kodeine/Metable/Metable.php b/src/Kodeine/Metable/Metable.php index <HASH>..<HASH> 100644 --- a/src/Kodeine/Metable/Metable.php +++ b/src/Kodeine/Metable/Metable.php @@ -13,6 +13,16 @@ trait Metable // Static property registration sigleton for save observation and slow large set hotfix public static $_isObserverRegistered; public static $_columnNames; + + /** + * whereMeta scope for easier join + * ------------------------- + */ + public function scopeWhereMeta($query, $key, $value, $alias = null) + { + $alias = (empty($alias)) ? $this->getMetaTable() : $alias; + return $query->join($this->getMetaTable() . ' AS ' . $alias, $this->getQualifiedKeyName(), '=', $alias . '.' . $this->getMetaKeyName())->where('key', '=', $key)->where('value', '=', $value)->select($this->getTable() . '.*'); + } /** * Meta scope for easier join
Update Metable.php helpful/nice to have something like this: Post::whereMeta(['revision', 'draft'])
kodeine_laravel-meta
train
php
2f12cd75ee8ffcec0e37b171cccb90d6528b9af4
diff --git a/oauth2_test.go b/oauth2_test.go index <HASH>..<HASH> 100644 --- a/oauth2_test.go +++ b/oauth2_test.go @@ -20,7 +20,7 @@ import ( "testing" "github.com/codegangsta/martini" - "github.com/codegangsta/martini-contrib/sessions" + "github.com/martini-contrib/sessions" ) func Test_LoginRedirect(t *testing.T) {
Import sessions from the new origin.
gorelease_oauth2
train
go
59561ca7ff3b7ac1047b5a823a35ae094546aaf4
diff --git a/tests/Common/FilesTest.php b/tests/Common/FilesTest.php index <HASH>..<HASH> 100644 --- a/tests/Common/FilesTest.php +++ b/tests/Common/FilesTest.php @@ -24,6 +24,7 @@ class FilesTest extends StorageApiTestCase $uploadedFile = reset($files); $this->assertEquals($fileId, $uploadedFile['id']); $this->assertArrayHasKey('region', $uploadedFile); + $this->assertArrayNotHasKey('credentials', $uploadedFile); } public function testFilesListFilterByTags()
testing that federation token is required for credentials
keboola_storage-api-php-client
train
php
fe79389fd3b4acbddd6cbaa63d25265a8ca236d5
diff --git a/externs/closure-compiler.js b/externs/closure-compiler.js index <HASH>..<HASH> 100644 --- a/externs/closure-compiler.js +++ b/externs/closure-compiler.js @@ -30,3 +30,15 @@ Touch.prototype.webkitRadiusX; /** @type {number} */ Touch.prototype.webkitRadiusY; + + + +/** + * @type {boolean} + */ +WebGLContextAttributes.prototype.preferLowPowerToHighPerformance; + +/** + * @type {boolean} + */ +WebGLContextAttributes.prototype.failIfMajorPerformanceCaveat;
Add two missing properties to extern of WebGLContextAttributes To be removed when the closure-compiler is updated
openlayers_openlayers
train
js
a247ca470ccbc7515c1a3d5166b5561ec364ec70
diff --git a/h5p.classes.php b/h5p.classes.php index <HASH>..<HASH> 100644 --- a/h5p.classes.php +++ b/h5p.classes.php @@ -1375,6 +1375,14 @@ class H5PContentValidator { } } } + foreach ($semantics->fields as $field) { + if (!(isset($field->optional) && $field->optional)) { + // Check if field is in group. + if (! property_exists($group, $field->name)) { + $this->h5pF->setErrorMessage($this->h5pF->t('No value given for mandatory field ' . $field->name)); + } + } + } } /**
OPPG-<I>: Validator just got a little more annoying. Gives warning if mandatory fields are missing in group
h5p_h5p-php-library
train
php
626c77be2fb86b34f42429227ea0b54506d4f222
diff --git a/manifest.php b/manifest.php index <HASH>..<HASH> 100755 --- a/manifest.php +++ b/manifest.php @@ -13,7 +13,7 @@ return array( 'label' => 'Result storage for LTI', 'description' => 'Implements the LTI basic outcome engine for LTI Result Server', 'license' => 'GPL-2.0', - 'version' => '1.0', + 'version' => '2.6', 'author' => 'Open Assessment Technologies', 'requires' => array( 'taoResultServer' => '2.6',
Fixed taoLtiBasicOutcome version, it was not fullfilling requirement of <I>+ from ltiDeliveryProvider extension
oat-sa_extension-tao-outcomelti
train
php
b7538e7b4941e9f5f74ab60a2058ef633ccb876f
diff --git a/storage/remote/storage.go b/storage/remote/storage.go index <HASH>..<HASH> 100644 --- a/storage/remote/storage.go +++ b/storage/remote/storage.go @@ -15,10 +15,13 @@ package remote import ( "context" + "crypto/md5" + "encoding/json" "sync" "time" "github.com/go-kit/kit/log" + "github.com/go-kit/kit/log/level" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/common/model" @@ -37,6 +40,8 @@ type Storage struct { logger log.Logger mtx sync.Mutex + configHash [16]byte + // For writes walDir string queues []*QueueManager @@ -77,6 +82,19 @@ func (s *Storage) ApplyConfig(conf *config.Config) error { s.mtx.Lock() defer s.mtx.Unlock() + cfgBytes, err := json.Marshal(conf.RemoteWriteConfigs) + if err != nil { + return err + } + + hash := md5.Sum(cfgBytes) + if hash == s.configHash { + level.Debug(s.logger).Log("msg", "remote write config has not changed, no need to restart QueueManagers") + return nil + } + + s.configHash = hash + // Update write queues newQueues := []*QueueManager{} // TODO: we should only stop & recreate queues which have changes,
Don't stop, recreate, and start remote storage QueueManagers if the (#<I>) remote write config hasn't changed at all.
prometheus_prometheus
train
go
f8e743834773dca4b938954f9084b6dde4395bf6
diff --git a/main.py b/main.py index <HASH>..<HASH> 100755 --- a/main.py +++ b/main.py @@ -499,10 +499,6 @@ class PowerLogParser: entity = self._parse_entity(entity) node = TagChangeNode(ts, entity, tag, value) - if self.current_node.indent_level > indent_level: - # mismatched indent levels - closing the node - # this can happen eg. during mulligans - self.current_node = self.current_node.parent self.update_node(node) self.current_node.indent_level = indent_level return
Remove an indent-mismatch hack causing incorrect replays
HearthSim_python-hsreplay
train
py
5476d7253ac1df3965fa35c5bfff43c82eafdf09
diff --git a/lib/active_record/connection_adapters/sqlserver/database_statements.rb b/lib/active_record/connection_adapters/sqlserver/database_statements.rb index <HASH>..<HASH> 100644 --- a/lib/active_record/connection_adapters/sqlserver/database_statements.rb +++ b/lib/active_record/connection_adapters/sqlserver/database_statements.rb @@ -256,7 +256,7 @@ module ActiveRecord end rows = results.inject([]) do |rows,row| row.each_with_index do |value, i| - if value.is_a? raw_connection.class.parent::TimeStamp + if value.respond_to?(:to_sqlserver_string) row[i] = value.to_sqlserver_string end end
Class#parent inspection is dirt slow.
rails-sqlserver_activerecord-sqlserver-adapter
train
rb
513d72fab0a00932dceba9b164b9fc55763d0bf5
diff --git a/hotdoc/core/base_formatter.py b/hotdoc/core/base_formatter.py index <HASH>..<HASH> 100644 --- a/hotdoc/core/base_formatter.py +++ b/hotdoc/core/base_formatter.py @@ -26,7 +26,7 @@ import shutil import pygraphviz as pg from hotdoc.utils.configurable import Configurable from hotdoc.utils.simple_signals import Signal -from hotdoc.utils.utils import recursive_overwrite +from hotdoc.utils.utils import recursive_overwrite, OrderedSet def _create_hierarchy_graph(hierarchy): @@ -101,6 +101,8 @@ class Formatter(Configurable): if os.path.isdir(src): recursive_overwrite(src, dest) + elif os.path.isfile(src): + shutil.copyfile(src, dest) def __copy_extra_files(self, assets_path): if not os.path.exists(assets_path): @@ -233,4 +235,4 @@ class Formatter(Configurable): """Banana banana """ Formatter.editing_server = config.get('editing_server') - Formatter.extra_assets = config.get_paths('extra_assets') + Formatter.extra_assets = OrderedSet(config.get_paths('extra_assets'))
base_formatter: copy extra assets files as well
hotdoc_hotdoc
train
py
bc6688c3c1b65adda7b138516fdd7139d808728e
diff --git a/eZ/Bundle/EzPublishCoreBundle/Composer/ScriptHandler.php b/eZ/Bundle/EzPublishCoreBundle/Composer/ScriptHandler.php index <HASH>..<HASH> 100644 --- a/eZ/Bundle/EzPublishCoreBundle/Composer/ScriptHandler.php +++ b/eZ/Bundle/EzPublishCoreBundle/Composer/ScriptHandler.php @@ -93,7 +93,7 @@ ________________/\\\\\\\\\\\\\\\____________/\\\\\\\\\\\\\____/\\\\\\___________ <fg=cyan>Welcome to eZ Platform!</fg=cyan> <options=bold>You may now complete the eZ Platform installation with ezplatform:install command, example of use:</options=bold> -<comment> $ php ezpublish/console ezplatform:install --env prod demo-clean</comment> +<comment> $ php ezpublish/console ezplatform:install --env prod demo</comment> <options=bold>After executing this, you can launch your browser* and get started.</options=bold>
Changed install command example to use 'demo' demo-clean has issues right now.
ezsystems_ezpublish-kernel
train
php
1d21491c8c669314dee4752ce502963ff320cb44
diff --git a/dataviews/ipython/display_hooks.py b/dataviews/ipython/display_hooks.py index <HASH>..<HASH> 100644 --- a/dataviews/ipython/display_hooks.py +++ b/dataviews/ipython/display_hooks.py @@ -24,7 +24,6 @@ except: from ..dataviews import Stack, View from ..views import Annotation, Layout, GridLayout, Grid from ..plots import Plot, GridLayoutPlot -from ..sheetviews import SheetLayer, SheetStack from . import magics from .magics import ViewMagic, ChannelMagic, OptsMagic
Removed unused imports in ipython/display_hooks.py
pyviz_holoviews
train
py
995ea41c9ed40ec62cbcd191294b8b7557d6bb3a
diff --git a/bigtable-hbase-dataflow/src/main/java/com/google/cloud/bigtable/dataflow/CloudBigtableIO.java b/bigtable-hbase-dataflow/src/main/java/com/google/cloud/bigtable/dataflow/CloudBigtableIO.java index <HASH>..<HASH> 100644 --- a/bigtable-hbase-dataflow/src/main/java/com/google/cloud/bigtable/dataflow/CloudBigtableIO.java +++ b/bigtable-hbase-dataflow/src/main/java/com/google/cloud/bigtable/dataflow/CloudBigtableIO.java @@ -46,7 +46,6 @@ import org.apache.hadoop.hbase.util.Bytes; import com.google.api.client.util.Lists; import com.google.api.client.util.Preconditions; -import com.google.bigtable.repackaged.com.google.common.collect.ImmutableList; import com.google.bigtable.v1.BigtableServiceGrpc.BigtableService; import com.google.bigtable.v1.SampleRowKeysRequest; import com.google.bigtable.v1.SampleRowKeysResponse; @@ -144,7 +143,7 @@ public class CloudBigtableIO { * Configuration for a Cloud Bigtable connection, a table, and an optional scan. */ private final CloudBigtableScanConfiguration configuration; - private transient ImmutableList<SampleRowKeysResponse> sampleRowKeys; + private transient List<SampleRowKeysResponse> sampleRowKeys; /** * A {@link BoundedSource} for a Cloud Bigtable {@link Table} with a start/stop key range, along
Removing a dependency on com.google.bigtable.repackaged.
googleapis_cloud-bigtable-client
train
java
b305d6e3b33ecf0e26a5b189f50431408e965769
diff --git a/src/main/java/org/asteriskjava/util/Lockable.java b/src/main/java/org/asteriskjava/util/Lockable.java index <HASH>..<HASH> 100644 --- a/src/main/java/org/asteriskjava/util/Lockable.java +++ b/src/main/java/org/asteriskjava/util/Lockable.java @@ -9,7 +9,7 @@ import org.asteriskjava.util.Locker.LockCloser; public class Lockable { - private final ReentrantLock internalLock = new ReentrantLock(true); + private final ReentrantLock internalLock = new ReentrantLock(false); final private String lockName; final AtomicReference<Thread> threadHoldingLock = new AtomicReference<>(); private final AtomicInteger totalWaitTime = new AtomicInteger();
switch to unfair lock to flush out locking bugs
asterisk-java_asterisk-java
train
java
cbc23095b32df73ff828ceda7119d9e284e5d799
diff --git a/cookiecutter/config.py b/cookiecutter/config.py index <HASH>..<HASH> 100644 --- a/cookiecutter/config.py +++ b/cookiecutter/config.py @@ -76,7 +76,7 @@ def get_config(config_path): def get_user_config(config_file=None, default_config=False): """Return the user config as a dict. - If ``default_config`` is True, ignore ``config_file and return default + If ``default_config`` is True, ignore ``config_file`` and return default values for the config parameters. If a path to a ``config_file`` is given, that is different from the default
Fix docstring - cookiecutter/config.py:docstring of cookiecutter.config.get_user_config:3: WARNING: Inline literal start-string without end-string.
audreyr_cookiecutter
train
py
6bed8c62b3f4192f4158837d73520696a188db4e
diff --git a/lib/Page.js b/lib/Page.js index <HASH>..<HASH> 100644 --- a/lib/Page.js +++ b/lib/Page.js @@ -395,8 +395,8 @@ class Page extends EventEmitter { if (clipRect) { await Promise.all([ this._client.send('Emulation.setVisibleSize', { - width: clipRect.width / this._screenDPI, - height: clipRect.height / this._screenDPI, + width: Math.ceil(clipRect.width / this._screenDPI), + height: Math.ceil(clipRect.height / this._screenDPI), }), this._client.send('Emulation.forceViewport', { x: clipRect.x / this._screenDPI,
Pass integers to the Emulation.setVisibleSize Integers are required in the Emulation.setVisibleSize. This patch fixes the screenshot clipRect so that it never tries to pass float values.
GoogleChrome_puppeteer
train
js
77f4dbfa1082d6cdf7c8697c7f300ecaab15b40b
diff --git a/src/Symfony/Component/OptionsResolver/OptionsResolver.php b/src/Symfony/Component/OptionsResolver/OptionsResolver.php index <HASH>..<HASH> 100644 --- a/src/Symfony/Component/OptionsResolver/OptionsResolver.php +++ b/src/Symfony/Component/OptionsResolver/OptionsResolver.php @@ -252,7 +252,7 @@ class OptionsResolver implements Options, OptionsResolverInterface throw new AccessException('Options cannot be made required from a lazy option or normalizer.'); } - foreach ((array) $optionNames as $key => $option) { + foreach ((array) $optionNames as $option) { $this->defined[$option] = true; $this->required[$option] = true; } @@ -333,7 +333,7 @@ class OptionsResolver implements Options, OptionsResolverInterface throw new AccessException('Options cannot be defined from a lazy option or normalizer.'); } - foreach ((array) $optionNames as $key => $option) { + foreach ((array) $optionNames as $option) { $this->defined[$option] = true; }
[OptionsResolver] Remove Unused Variable from Foreach Cycles
symfony_symfony
train
php
a71fd9b7ceb2675e36954f4e9549b46d63e1f932
diff --git a/traversal/planner/PlannerEdge.java b/traversal/planner/PlannerEdge.java index <HASH>..<HASH> 100644 --- a/traversal/planner/PlannerEdge.java +++ b/traversal/planner/PlannerEdge.java @@ -1238,10 +1238,10 @@ public abstract class PlannerEdge<VERTEX_FROM extends PlannerVertex<?>, VERTEX_T void computeCost(GraphManager graphMgr) { if (isLoop() || to.props().hasIID()) { cost = 1; + return; } cost = 0; - Set<TypeVertex> roleTypeVertices = iterate(this.roleTypes()).map(graphMgr.schema()::getType).toSet(); for (TypeVertex roleType : roleTypeVertices) { assert roleType.isRoleType() && roleType.properLabel().scope().isPresent(); @@ -1264,6 +1264,7 @@ public abstract class PlannerEdge<VERTEX_FROM extends PlannerVertex<?>, VERTEX_T void computeCost(GraphManager graphMgr) { if (isLoop() || to.props().hasIID()) { cost = 1; + return; } cost = 0;
fix incorrect RolePlayer edge cost when IID or Loop is present
graknlabs_grakn
train
java
9f72e53a5846b04d2bacb18ef15a52fb86d096fc
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index <HASH>..<HASH> 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -4,6 +4,11 @@ RSpec.configure do |config| config.treat_symbols_as_metadata_keys_with_true_values = true config.run_all_when_everything_filtered = true config.filter_run :focus - config.order = 'random' end + +module Test + def self.load_fixture(name) + File.read(File.expand_path("../html/#{name}", __FILE__)) + end +end
Add helper for loading HTML fixtures in tests
ryangreenberg_urban_dictionary
train
rb
a989f8b59913594db27fefaf43430697f381597a
diff --git a/js/remote.js b/js/remote.js index <HASH>..<HASH> 100644 --- a/js/remote.js +++ b/js/remote.js @@ -676,8 +676,6 @@ Transaction.prototype.offer_create = function (src, taker_pays, taker_gets, expi this.secret = this.account_secret(src); this.transaction.TransactionType = 'OfferCreate'; this.transaction.Account = this.account_default(src); - this.transaction.Amount = deliver_amount.to_json(); - this.transaction.Destination = dst_account; this.transaction.Fee = fees.offer.to_json(); this.transaction.TakerPays = taker_pays.to_json(); this.transaction.TakerGets = taker_gets.to_json();
JS: Fix offer_create.
ChainSQL_chainsql-lib
train
js
0bf5c8415dace8ebca62603df7ba866fb14b5265
diff --git a/examples/repl.js b/examples/repl.js index <HASH>..<HASH> 100644 --- a/examples/repl.js +++ b/examples/repl.js @@ -19,4 +19,5 @@ engine(server) .use(engine.logger('logs')) .use(engine.stats()) .use(engine.repl(__dirname + '/repl')) + .use(engine.debug()) .listen(); \ No newline at end of file diff --git a/lib/plugins/repl.js b/lib/plugins/repl.js index <HASH>..<HASH> 100644 --- a/lib/plugins/repl.js +++ b/lib/plugins/repl.js @@ -80,3 +80,15 @@ exports.help = function(master, sock){ }; exports.help.description = 'Display help information'; + +/** + * Spawn `n` additional workers. + */ + +exports.spawn = function(master, sock, n){ + n = n || 1; + sock.write('spawning ' + n + ' worker' + (n > 1 ? 's' : '') + '\n'); + master.spawn(n); +}; + +exports.spawn.description = 'Spawn one or more additional workers'; \ No newline at end of file
Added spawn(n) REPL command
LearnBoost_cluster
train
js,js
55c41d6f8069ecf8b3dba387e5b2f9779a983cc8
diff --git a/wayback-core/src/test/java/org/archive/wayback/webapp/AccessPointTest.java b/wayback-core/src/test/java/org/archive/wayback/webapp/AccessPointTest.java index <HASH>..<HASH> 100644 --- a/wayback-core/src/test/java/org/archive/wayback/webapp/AccessPointTest.java +++ b/wayback-core/src/test/java/org/archive/wayback/webapp/AccessPointTest.java @@ -156,7 +156,7 @@ public class AccessPointTest extends TestCase { // behavior returning null are commented out because EasyMock provides them by default. httpRequest = EasyMock.createNiceMock(HttpServletRequest.class); - httpResponse = EasyMock.createMock(HttpServletResponse.class); + httpResponse = EasyMock.createNiceMock(HttpServletResponse.class); // RequestDispatcher - setup expectations, call replay() and verify() if // method calls are expected. requestDispatcher = EasyMock.createMock(RequestDispatcher.class);
FIX: Fix AccessPointTest unit test by using createNiceMock
iipc_openwayback
train
java
b437bd4c84762aa5580e96de8267b39f9e01f6db
diff --git a/nolds/__init__.py b/nolds/__init__.py index <HASH>..<HASH> 100644 --- a/nolds/__init__.py +++ b/nolds/__init__.py @@ -1,4 +1,4 @@ from .measures import lyap_r, lyap_e, sampen, hurst_rs, corr_dim, dfa, \ - binary_n, logarithmic_n, logarithmic_r, expected_h, logmid_n + binary_n, logarithmic_n, logarithmic_r, expected_h, logmid_n, expected_rs from .datasets import brown72, tent_map, logistic_map, fbm, fgn, qrandom, \ load_qrandom diff --git a/nolds/measures.py b/nolds/measures.py index <HASH>..<HASH> 100644 --- a/nolds/measures.py +++ b/nolds/measures.py @@ -836,7 +836,8 @@ def expected_rs(n): """ Calculates the expected (R/S)_n for white noise for a given n. - This is used as a correction factor in the function hurst_rs. + This is used as a correction factor in the function hurst_rs. It uses the + formula of Anis-Lloyd-Peters (see [h_3]_). Args: n (int):
updates description of expected_rs and adds it to the exported functions
CSchoel_nolds
train
py,py
1808d06510cdf70f05c390e889609f7df6e16ea5
diff --git a/perceval/backends/core/redmine.py b/perceval/backends/core/redmine.py index <HASH>..<HASH> 100644 --- a/perceval/backends/core/redmine.py +++ b/perceval/backends/core/redmine.py @@ -57,7 +57,7 @@ class Redmine(Backend): :param tag: label used to mark the data :param archive: archive to store/retrieve items """ - version = '0.9.1' + version = '0.9.2' CATEGORIES = [CATEGORY_ISSUE] @@ -89,7 +89,6 @@ class Redmine(Backend): from_date = DEFAULT_DATETIME from_date = datetime_to_utc(from_date) - kwargs = {'from_date': from_date} items = super().fetch(category, **kwargs) @@ -339,7 +338,7 @@ class RedmineClient(HttpClient): CWATCHERS = 'watchers' def __init__(self, base_url, api_token=None, archive=None, from_archive=False): - super().__init__(base_url.rstrip('/'), archive, from_archive) + super().__init__(base_url.rstrip('/'), archive=archive, from_archive=from_archive) self.api_token = api_token def issues(self, from_date=DEFAULT_DATETIME,
[redmine] Fix initialization client This patch fixes the initialization of 'archive' and 'from_archive' parameters, thus allowing to correctly store data within the archive.
chaoss_grimoirelab-perceval
train
py
c8cc861b948625653f455205253c10588ccd77db
diff --git a/system/src/Grav/Console/ConsoleTrait.php b/system/src/Grav/Console/ConsoleTrait.php index <HASH>..<HASH> 100644 --- a/system/src/Grav/Console/ConsoleTrait.php +++ b/system/src/Grav/Console/ConsoleTrait.php @@ -3,6 +3,7 @@ namespace Grav\Console; use Grav\Common\Grav; use Grav\Common\Composer; +use Grav\Common\GravTrait; use Grav\Console\Cli\ClearCacheCommand; use Symfony\Component\Console\Formatter\OutputFormatterStyle; use Symfony\Component\Console\Input\ArrayInput; @@ -15,6 +16,8 @@ use Symfony\Component\Console\Output\OutputInterface; */ trait ConsoleTrait { + use GravTrait; + /** * @var */ @@ -105,10 +108,10 @@ trait ConsoleTrait $input = new ArrayInput($all); return $command->run($input, $this->output); } - + /** * Validate if the system is based on windows or not. - * + * * @return bool */ public function isWindows()
Added GravTrait back to ensure 3rd party CLI plugins don't break.
getgrav_grav
train
php
c3212083642b33d7773f6d9bcec60ad5f230c6c4
diff --git a/tests/reducer/change-model-test.js b/tests/reducer/change-model-test.js index <HASH>..<HASH> 100644 --- a/tests/reducer/change-model-test.js +++ b/tests/reducer/change-model-test.js @@ -3,7 +3,7 @@ var actions = require('../../lib/actions') var reducer = require('../../lib/reducer').reducer describe('reducer: CHANGE_MODEL', function () { - let initialState + var initialState beforeEach(function () { initialState = { baseModel: { @@ -33,7 +33,7 @@ describe('reducer: CHANGE_MODEL', function () { }) describe('when model does not include references', function () { - let newState + var newState beforeEach(function () { newState = reducer(initialState, { type: actions.CHANGE_MODEL, @@ -47,7 +47,7 @@ describe('reducer: CHANGE_MODEL', function () { }) describe('when model includes complex references', function () { - let newState + var newState beforeEach(function () { newState = reducer(initialState, { type: actions.CHANGE_MODEL,
support node5, remove block scoped vars
ciena-blueplanet_bunsen-core
train
js
30e5eec18bcf8bbce5a555320e167335c1479e23
diff --git a/src/saml2/pack.py b/src/saml2/pack.py index <HASH>..<HASH> 100644 --- a/src/saml2/pack.py +++ b/src/saml2/pack.py @@ -66,9 +66,12 @@ def http_form_post_message(message, location, relay_state="", typ="SAMLRequest") if not isinstance(message, basestring): message = "%s" % (message,) - - response.append(FORM_SPEC % (location, typ, base64.b64encode(message), - relay_state)) + + if typ == "SAMLRequest": + _msg = base64.b64encode(message) + else: + _msg = message + response.append(FORM_SPEC % (location, typ, _msg, relay_state)) response.append("""<script type="text/javascript">""") response.append(" window.onload = function ()")
May not always want to b<I> encode the message
IdentityPython_pysaml2
train
py
adea1c02d154a5eac8f0273847c3eeb3f236915e
diff --git a/astromodels/functions/functions.py b/astromodels/functions/functions.py index <HASH>..<HASH> 100644 --- a/astromodels/functions/functions.py +++ b/astromodels/functions/functions.py @@ -1079,7 +1079,10 @@ class Log_parabola(Function1D): # dimensionless because of a division (like xx here) are not recognized as such by the power # operator, which throws an exception: ValueError: Quantities and Units may only be raised to a scalar power # This is a quick fix, waiting for astropy 1.2 which will fix this - return K * xx**((alpha + beta * np.log10(xx)).to('')) + + xx = xx.to('') + + return K * xx**(alpha + beta * np.log10(xx)) @property def peak_energy(self):
Dealing with the bug in astropy which doesn't allow to use arrays in powers (will be fixed in astropy <I>)
threeML_astromodels
train
py
be4a6e47b6764bf67199e77499f17fd32c250140
diff --git a/lib/YandexMoney/ApiRequestor.php b/lib/YandexMoney/ApiRequestor.php index <HASH>..<HASH> 100644 --- a/lib/YandexMoney/ApiRequestor.php +++ b/lib/YandexMoney/ApiRequestor.php @@ -10,7 +10,7 @@ class ApiRequestor /** * */ - const USER_AGENT = 'yamolib-php'; + const USER_AGENT = 'yandex-money-sdk-php'; /** * @@ -65,13 +65,11 @@ class ApiRequestor curl_setopt($curl, CURLOPT_USERAGENT, self::USER_AGENT); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); - // curl_setopt($curl, CURLOPT_FORBID_REUSE, true); curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 30); curl_setopt($curl, CURLOPT_TIMEOUT, 80); curl_setopt($curl, CURLOPT_POST, true); curl_setopt($curl, CURLOPT_POSTFIELDS, $params); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, true); - // curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, true); curl_setopt($curl, CURLOPT_CAINFO, __DIR__ . self::CERTIFICATE_PATH); $this->_log($this->_makeRequestLogMessage($uri, $params));
user agent changed to "yandex-money-sdk-php"
romkavt_yandex-money-sdk-php
train
php
b252e554ebb23c1ebca31fd731db4f3a9685e3e8
diff --git a/lib/conceptql/behaviors/provenanceable.rb b/lib/conceptql/behaviors/provenanceable.rb index <HASH>..<HASH> 100644 --- a/lib/conceptql/behaviors/provenanceable.rb +++ b/lib/conceptql/behaviors/provenanceable.rb @@ -201,7 +201,7 @@ module ConceptQL h[c[0][0]].merge!( [[c[0][1],c[1].flatten]].to_h){|key,new_v,old_v| (new_v.flatten + old_v.flatten).uniq} } else - res = {} + res = {FILE_PROVENANCE_TYPES_VOCAB => {}, CODE_PROVENANCE_TYPES_VOCAB => {}} end return res
Fix error when using concept ids in provenance operator by themselves
outcomesinsights_conceptql
train
rb
eff49cfd90ba7ebbd343c2da921a041c5e310853
diff --git a/src/TableRow.js b/src/TableRow.js index <HASH>..<HASH> 100644 --- a/src/TableRow.js +++ b/src/TableRow.js @@ -9,9 +9,7 @@ class TableRow extends Component { } rowClick = e => { - if (e.target.tagName !== 'INPUT' && - e.target.tagName !== 'SELECT' && - e.target.tagName !== 'TEXTAREA') { + if (e.target.tagName === 'TD') { const rowIndex = this.props.index + 1; const cellIndex = e.target.cellIndex; const { selectRow, unselectableRow, isSelected, onSelectRow, onExpandRow } = this.props;
fix clicking on a custom selection column will trigger selection twice
AllenFang_react-bootstrap-table
train
js
5fc99e6ce421fd1cf6c233c9cf7585085ca0d972
diff --git a/src/Sylius/Bundle/CoreBundle/Application/Kernel.php b/src/Sylius/Bundle/CoreBundle/Application/Kernel.php index <HASH>..<HASH> 100644 --- a/src/Sylius/Bundle/CoreBundle/Application/Kernel.php +++ b/src/Sylius/Bundle/CoreBundle/Application/Kernel.php @@ -31,17 +31,17 @@ use Webmozart\Assert\Assert; class Kernel extends HttpKernel { - public const VERSION = '1.7.1'; + public const VERSION = '1.7.2-DEV'; - public const VERSION_ID = '10701'; + public const VERSION_ID = '10702'; public const MAJOR_VERSION = '1'; public const MINOR_VERSION = '7'; - public const RELEASE_VERSION = '1'; + public const RELEASE_VERSION = '2'; - public const EXTRA_VERSION = ''; + public const EXTRA_VERSION = 'DEV'; public function __construct(string $environment, bool $debug) {
Change application's version to <I>-DEV
Sylius_Sylius
train
php
df422d3d2c9c5b994d1f0b11ec384d43e07e0c98
diff --git a/lib/protocol/tcp.js b/lib/protocol/tcp.js index <HASH>..<HASH> 100644 --- a/lib/protocol/tcp.js +++ b/lib/protocol/tcp.js @@ -38,7 +38,6 @@ exports.connect = function connect(options, cb) { keepAliveIdle = options['tcpKeepAliveIdle'] * 1000; if (isNaN(keepAliveIdle)) keepAliveIdle = defaultKeepAliveIdle; } - console.log(keepAliveIdle); socket.setKeepAlive(true, keepAliveIdle); return socket; };
Remove tcp keepalive debug code
SAP_node-hdb
train
js
0ce53f5820519b697d9acbf37949514187b8ca8e
diff --git a/wafer/pages/management/tests/test_load_pages.py b/wafer/pages/management/tests/test_load_pages.py index <HASH>..<HASH> 100644 --- a/wafer/pages/management/tests/test_load_pages.py +++ b/wafer/pages/management/tests/test_load_pages.py @@ -8,6 +8,8 @@ from django.core.management import call_command from django.test import TestCase from django.utils.six import StringIO +from wafer.pages.models import Page + PAGES = { "page1.md": "\n".join([ "---", @@ -43,3 +45,8 @@ class LoadPagesTest(TestCase): "Loaded page page1", "Loaded page page2", ]) + pages = sorted(Page.objects.all(), key=lambda p: p.name) + self.assertEqual(pages[0].name, "Page 1") + self.assertEqual(pages[1].name, "Page 2") + self.assertEqual(pages[0].content.raw, "This is page 1.") + self.assertEqual(pages[1].content.raw, "This is page 2.")
Test that pages made it to the database.
CTPUG_wafer
train
py
77ef20b2e04c25f32353681367ee637da3f41be2
diff --git a/rfc5424logging/__init__.py b/rfc5424logging/__init__.py index <HASH>..<HASH> 100644 --- a/rfc5424logging/__init__.py +++ b/rfc5424logging/__init__.py @@ -1,6 +1,14 @@ -from .handler import Rfc5424SysLogHandler, NILVALUE +from .handler import Rfc5424SysLogHandler, TlsRfc5424SysLogHandler, NILVALUE from .adapter import Rfc5424SysLogAdapter, EMERGENCY, ALERT, NOTICE __version__ = "1.2.1" -__all__ = ['Rfc5424SysLogHandler', 'Rfc5424SysLogAdapter', 'EMERGENCY', 'ALERT', 'NOTICE', 'NILVALUE'] +__all__ = [ + 'Rfc5424SysLogHandler', + 'Rfc5424SysLogAdapter', + 'TlsRfc5424SysLogHandler', + 'EMERGENCY', + 'ALERT', + 'NOTICE', + 'NILVALUE' +]
loading the new class to __all__
jobec_rfc5424-logging-handler
train
py
c4c370190f35cd9b7182f06a995e25f367c3279b
diff --git a/lib/dm-core.rb b/lib/dm-core.rb index <HASH>..<HASH> 100644 --- a/lib/dm-core.rb +++ b/lib/dm-core.rb @@ -26,7 +26,7 @@ require 'extlib/inflection' begin gem 'fastthread', '~>1.0.1' require 'fastthread' -rescue Gem::LoadError +rescue LoadError # fastthread not installed end
Changed exception to check for to ancestor of Gem::LoadError
datamapper_dm-core
train
rb
68e602b5ee0887540cd62db3b42f98aba47ea3c2
diff --git a/src/java/voldemort/server/gossip/Gossiper.java b/src/java/voldemort/server/gossip/Gossiper.java index <HASH>..<HASH> 100644 --- a/src/java/voldemort/server/gossip/Gossiper.java +++ b/src/java/voldemort/server/gossip/Gossiper.java @@ -44,7 +44,6 @@ public class Gossiper implements Runnable { running.set(false); } - @Override public void run() { while (running.get()) { Node node = selectPeer();
Removed @Override on an interface for <I> compatibility.
voldemort_voldemort
train
java
0430a3906019ef9fb3d646e3bc3336f1cc765688
diff --git a/src/test/java/com/github/davidmoten/rx2/internal/flowable/FlowableRepeatingTransformTest.java b/src/test/java/com/github/davidmoten/rx2/internal/flowable/FlowableRepeatingTransformTest.java index <HASH>..<HASH> 100644 --- a/src/test/java/com/github/davidmoten/rx2/internal/flowable/FlowableRepeatingTransformTest.java +++ b/src/test/java/com/github/davidmoten/rx2/internal/flowable/FlowableRepeatingTransformTest.java @@ -234,7 +234,6 @@ public final class FlowableRepeatingTransformTest { }; Flowable.just(1, 5) // .to(Transformers.repeat(plusOne, 3, 1, tester)) // - .doOnNext(Consumers.println()) // .test() // .assertValues(2, 6) // .assertComplete(); @@ -319,7 +318,6 @@ public final class FlowableRepeatingTransformTest { private static void check(int n, int maxChained) { int result = Flowable.range(1, n) // .to(Transformers.reduce(reducer, maxChained)) // - .doOnNext(Consumers.println()) // .single(-1) // .blockingGet(); Assert.assertEquals(sum(n), result);
reduce logging from FlowableRepeatingTransformTest
davidmoten_rxjava2-extras
train
java
54fcb668ed7d37e99c92698ebebbad3fc068b8da
diff --git a/gui/tools/designer.py b/gui/tools/designer.py index <HASH>..<HASH> 100644 --- a/gui/tools/designer.py +++ b/gui/tools/designer.py @@ -159,12 +159,20 @@ class BasicDesigner: wx_obj = self.current sx, sy = self.start x, y = wx.GetMousePosition() - # update gui specs (this will overwrite relative dimensions): + # calculate the new position (this will overwrite relative dimensions): x, y = (x + sx, y + sy) if evt.ShiftDown(): # snap to grid: x = x / GRID_SIZE[0] * GRID_SIZE[0] y = y / GRID_SIZE[1] * GRID_SIZE[1] - wx_obj.obj.pos = (wx.Point(x, y)) + # calculate the diff to use in the rest of the selected objects: + ox, oy = wx_obj.obj.pos + dx, dy = (x - ox), (y - oy) + # move all selected objects: + for obj in self.selection: + x, y = obj.pos + x = x + dx + y = y + dy + obj.pos = (wx.Point(x, y)) def do_resize(self, evt, wx_obj, (n, w, s, e)): "Called by SelectionTag"
allow moving group object using mouse (designer)
reingart_gui2py
train
py
c202075affc8a4d03401a4877639a96907438d83
diff --git a/distutils/tests/test_dist.py b/distutils/tests/test_dist.py index <HASH>..<HASH> 100644 --- a/distutils/tests/test_dist.py +++ b/distutils/tests/test_dist.py @@ -83,6 +83,10 @@ class DistributionTestCase(support.LoggingSilencer, self.assertIsInstance(cmd, test_dist) self.assertEqual(cmd.sample_option, "sometext") + @unittest.skipIf( + 'distutils' not in Distribution.parse_config_files.__module__, + 'Cannot test when virtualenv has monkey-patched Distribution.', + ) def test_venv_install_options(self): sys.argv.append("install") self.addCleanup(os.unlink, TESTFN)
Mark test_venv to be skipped when running under a virtualenv as virtualenv monkey patches distutils.
pypa_setuptools
train
py
83930ac113bf9f30f69ad6cbb33878d75f9684fe
diff --git a/client/client_test.go b/client/client_test.go index <HASH>..<HASH> 100644 --- a/client/client_test.go +++ b/client/client_test.go @@ -544,3 +544,23 @@ func TestRedirectFollowingHTTPClient(t *testing.T) { } } } + +func TestDefaultCheckRedirect(t *testing.T) { + tests := []struct { + num int + err error + }{ + {0, nil}, + {5, nil}, + {10, nil}, + {11, ErrTooManyRedirects}, + {29, ErrTooManyRedirects}, + } + + for i, tt := range tests { + err := DefaultCheckRedirect(tt.num) + if !reflect.DeepEqual(tt.err, err) { + t.Errorf("#%d: want=%#v got=%#v", i, tt.err, err) + } + } +}
client: test DefaultCheckRedirect
etcd-io_etcd
train
go
56fcc622e4770bcf969ce84757c062cb506296d0
diff --git a/salt/states/boto3_route53.py b/salt/states/boto3_route53.py index <HASH>..<HASH> 100644 --- a/salt/states/boto3_route53.py +++ b/salt/states/boto3_route53.py @@ -650,8 +650,13 @@ def rr_present(name, HostedZoneId=None, DomainName=None, PrivateZone=False, Name fixed_rrs += [rr] ResourceRecords = [{'Value': rr} for rr in sorted(fixed_rrs)] + # https://github.com/boto/boto/pull/1216 + # the Route53 API returns the unicode version of the '*' character + UnicodedName = Name + if '*' in Name: + UnicodedName = Name.replace('*',r'\052') recordsets = __salt__['boto3_route53.get_resource_records'](HostedZoneId=HostedZoneId, - StartRecordName=Name, StartRecordType=Type, region=region, key=key, keyid=keyid, + StartRecordName=UnicodedName, StartRecordType=Type, region=region, key=key, keyid=keyid, profile=profile) if SetIdentifier and recordsets:
Use the unicode version of the '*' character for route<I>
saltstack_salt
train
py
c2dca1592186c2c9ff3e23126ad7f63d3cf8e04f
diff --git a/fusesoc/main.py b/fusesoc/main.py index <HASH>..<HASH> 100644 --- a/fusesoc/main.py +++ b/fusesoc/main.py @@ -152,6 +152,10 @@ def init(args): f.write("cores_root = {}\n".format(cores_root)) pr_info("FuseSoC is ready to use!") +def list_paths(args): + cores_root = CoreManager().get_cores_root() + print("\n".join(cores_root)) + def list_cores(args): cores = CoreManager().get_cores() print("\nAvailable cores:\n") @@ -336,6 +340,9 @@ def main(): parser_core_info.add_argument('core') parser_core_info.set_defaults(func=core_info) + parser_list_paths = subparsers.add_parser('list-paths', help='Displays the search order for core root paths') + parser_list_paths.set_defaults(func=list_paths) + #Simulation subparser parser_sim = subparsers.add_parser('sim', help='Setup and run a simulation') parser_sim.add_argument('--sim', nargs=1, help='Override the simulator settings from the system file')
Add command to list the core_root paths This can help the user to find conflicts etc.
olofk_fusesoc
train
py
4186af9b2114272990b06cf0cd8647ca3421c2a8
diff --git a/datadog_checks_dev/datadog_checks/dev/tooling/signing.py b/datadog_checks_dev/datadog_checks/dev/tooling/signing.py index <HASH>..<HASH> 100644 --- a/datadog_checks_dev/datadog_checks/dev/tooling/signing.py +++ b/datadog_checks_dev/datadog_checks/dev/tooling/signing.py @@ -1,8 +1,16 @@ # (C) Datadog, Inc. 2018 # All rights reserved # Licensed under a 3-clause BSD style license (see LICENSE) +# flake8: noqa import shutil +# NOTE: Set one minute for any GPG subprocess to timeout in in-toto. Should be +# enough time for developers to find and enter their PIN and / or touch their +# Yubikey. We do this before we load the rest of in-toto, so that this setting +# takes effect. +import in_toto.settings +in_toto.settings.SUBPROCESS_TIMEOUT = 60 + from in_toto import runlib from in_toto.gpg.constants import GPG_COMMAND
Increase gpg timeout to give time to developers to interact with Yubikeys (#<I>) * increase gpg timeout value for in-toto * skip flake8 for this module
DataDog_integrations-core
train
py
6dd49b112b4461b3625a82d767ed0c8f3846aee4
diff --git a/dist/index.js b/dist/index.js index <HASH>..<HASH> 100644 --- a/dist/index.js +++ b/dist/index.js @@ -26432,8 +26432,7 @@ return /******/ (function(modules) { // webpackBootstrap value: function createField(control, props) { var _this2 = this; - console.log('creating ' + props.model); - if (!control || !control.props) return control; + if (!control || !control.props || Object.hasOwnProperty(control.props, 'modelValue')) return control; var dispatch = props.dispatch; var model = props.model; diff --git a/src/components/field-component.js b/src/components/field-component.js index <HASH>..<HASH> 100644 --- a/src/components/field-component.js +++ b/src/components/field-component.js @@ -39,8 +39,10 @@ function selector(state, { model }) { class Field extends React.Component { createField(control, props) { - console.log(`creating ${props.model}`); - if (!control || !control.props) return control; + if (!control + || !control.props + || Object.hasOwnProperty(control.props, 'modelValue') + ) return control; let { dispatch,
Optimizing performance for already-created controls
davidkpiano_react-redux-form
train
js,js
99cae5fd9492e45189dd68ba821f2dd78931bb1e
diff --git a/rollup.config.js b/rollup.config.js index <HASH>..<HASH> 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -36,11 +36,16 @@ const plugins = [ main: true, browser: true, }), - replace({ - 'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV), - }), ]; +if (format === 'umd') { + plugins.push( + replace({ + 'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV), + }) + ); +} + if (production) { plugins.push(uglify()); }
Updated builds so that the NODE_ENV only gets replaced in umd builds
mlaursen_react-md
train
js
a35edea96e7f50ba75ed8f4e96f9bbf10d26cfd3
diff --git a/src/java/com/threerings/presents/client/InvocationDirector.java b/src/java/com/threerings/presents/client/InvocationDirector.java index <HASH>..<HASH> 100644 --- a/src/java/com/threerings/presents/client/InvocationDirector.java +++ b/src/java/com/threerings/presents/client/InvocationDirector.java @@ -1,5 +1,5 @@ // -// $Id: InvocationDirector.java,v 1.30 2003/07/20 17:02:59 mdb Exp $ +// $Id: InvocationDirector.java,v 1.31 2003/07/25 20:51:08 mdb Exp $ package com.threerings.presents.client; @@ -345,6 +345,7 @@ public class InvocationDirector // reregister our receivers _clobj.startTransaction(); try { + _clobj.setReceivers(new DSet()); Iterator iter = receivers.entries(); while (iter.hasNext()) { _clobj.addToReceivers((Registration)iter.next());
We need also to clear the receivers when we transfer them from our auth user object to our chosen pirate user object. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@<I> <I>f4-<I>e9-<I>-aa3c-eee0fc<I>fb1
threerings_narya
train
java
7dfd066b4a7f268b20c5b12d1c1e6fcf938bff74
diff --git a/index.js b/index.js index <HASH>..<HASH> 100644 --- a/index.js +++ b/index.js @@ -142,6 +142,10 @@ EventEmitterProto.trigger = EventEmitterProto.emit; * @description Super small and simple interpretation of popular event management. */ function EventEmitter() { + if (!(this instanceof EventEmitter)) { + return new EventEmitter(); + } + this._listeners = []; } diff --git a/test/unit/specs/test.super-event-emitter.js b/test/unit/specs/test.super-event-emitter.js index <HASH>..<HASH> 100644 --- a/test/unit/specs/test.super-event-emitter.js +++ b/test/unit/specs/test.super-event-emitter.js @@ -24,6 +24,14 @@ describe('EventEmitter', function () { expect(spyFn).toHaveBeenCalled(); }); + it('should create a new instance when called without `new`', function() { + var instance = EventEmitter(); + var instance2 = EventEmitter(); + + expect(instance).not.toBe(instance2); + expect(instance.on).toBeDefined(); + }); + it('should allow mixing with existing objects', function() { var existing = {}; EventEmitter.mixin(existing);
Allow `new`-less instantiation and prevent a global object leak
piecioshka_super-event-emitter
train
js,js
1c182d6e368e12b3800a20b1ac07ef273381a8d7
diff --git a/src/java/com/threerings/media/image/ImageUtil.java b/src/java/com/threerings/media/image/ImageUtil.java index <HASH>..<HASH> 100644 --- a/src/java/com/threerings/media/image/ImageUtil.java +++ b/src/java/com/threerings/media/image/ImageUtil.java @@ -1,5 +1,5 @@ // -// $Id: ImageUtil.java,v 1.11 2002/05/04 19:34:14 mdb Exp $ +// $Id: ImageUtil.java,v 1.12 2002/05/04 21:36:32 ray Exp $ package com.threerings.media.util; @@ -282,7 +282,7 @@ public class ImageUtil if (image instanceof BufferedImage) { BufferedImage bimage = (BufferedImage)image; int argb = bimage.getRGB(x, y); - int alpha = argb >> 24; + // int alpha = argb >> 24; // Log.info("Checking [x=" + x + ", y=" + y + ", " + alpha); // it's only a hit if the pixel is non-transparent
this line should have been commented out too git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@<I> <I>f4-<I>e9-<I>-aa3c-eee0fc<I>fb1
threerings_narya
train
java
2df3ebde3b9279dff9eb66a165156cd36a5679b1
diff --git a/lib/mongo_mapper/plugins/querying/decorator.rb b/lib/mongo_mapper/plugins/querying/decorator.rb index <HASH>..<HASH> 100644 --- a/lib/mongo_mapper/plugins/querying/decorator.rb +++ b/lib/mongo_mapper/plugins/querying/decorator.rb @@ -30,19 +30,13 @@ module MongoMapper def last(opts={}) model.load(super) end - + private def method_missing(method, *args, &block) - if model.respond_to?(method) - query = model.send(method, *args, &block) - if query.is_a?(Plucky::Query) - merge(query) - else - super - end - else - super - end + return super unless model.respond_to?(method) + result = model.send(method, *args, &block) + return super unless result.is_a?(Plucky::Query) + merge(result) end end end
Slight change in Query method missing stuff. Feel like this is easier to read than the nested ifs.
mongomapper_mongomapper
train
rb
90bad54c9e97d1ce11c9778a5e1297c9f73e81a1
diff --git a/tests/Service/CacheServiceTest.php b/tests/Service/CacheServiceTest.php index <HASH>..<HASH> 100644 --- a/tests/Service/CacheServiceTest.php +++ b/tests/Service/CacheServiceTest.php @@ -156,6 +156,25 @@ class CacheServiceTest extends \PHPUnit_Framework_TestCase $this->cacheService->save($this->getMvcEvent()); } + public function testSaveEventHasCacheKey() + { + $response = $this->getMvcEvent()->getResponse(); + $response->setContent('mockContent'); + + $this->cacheService->getEventManager()->attach(CacheEvent::EVENT_SHOULDCACHE, function () { return true; }); + $this->cacheService->getEventManager()->attach(CacheEvent::EVENT_SAVE, function (CacheEvent $e) { + $this->assertNotNull($e->getCacheKey()); + }); + + $this->storageMock + ->shouldReceive('setItem') + ->once() + ->with('/foo/bar', $response->getContent()); + + $this->cacheService->getOptions()->setCacheResponse(false); + $this->cacheService->save($this->getMvcEvent()); + } + public function testResponseIsCachedWhenOneListenerReturnsTrue() { $this->cacheService->getEventManager()->attach(CacheEvent::EVENT_SHOULDCACHE, function () { return false; });
Added test to check if EVENT_SAVE has cache key set
bramstroker_zf2-fullpage-cache
train
php
8412807a413795e6104c1275f760c7963f75713d
diff --git a/openupgradelib/openupgrade_merge_records.py b/openupgradelib/openupgrade_merge_records.py index <HASH>..<HASH> 100644 --- a/openupgradelib/openupgrade_merge_records.py +++ b/openupgradelib/openupgrade_merge_records.py @@ -419,6 +419,9 @@ def _change_generic(env, model_name, record_ids, target_record_id, if (model._table, res_id_column) in exclude_columns: continue if method == 'orm': + if not model._fields.get(model_column) or \ + not model._fields.get(res_id_column): + continue records = model.search([ (model_column, '=', model_name), (res_id_column, 'in', record_ids)]) @@ -442,6 +445,9 @@ def _change_generic(env, model_name, record_ids, target_record_id, "Changed %s record(s) of model '%s'", len(records), model_to_replace) else: + if not column_exists(env.cr, model._table, res_id_column) or \ + not column_exists(env.cr, model._table, model_column): + continue format_args = { 'table': sql.Identifier(model._table), 'res_id_column': sql.Identifier(res_id_column),
[FIX] merge_records: assure columns exist in _change_generic
OCA_openupgradelib
train
py
dd755a50d8b776e48079b4c8f3c3189df907dba2
diff --git a/netty-reactive-streams/src/test/java/com/typesafe/netty/ChannelPublisherTest.java b/netty-reactive-streams/src/test/java/com/typesafe/netty/ChannelPublisherTest.java index <HASH>..<HASH> 100644 --- a/netty-reactive-streams/src/test/java/com/typesafe/netty/ChannelPublisherTest.java +++ b/netty-reactive-streams/src/test/java/com/typesafe/netty/ChannelPublisherTest.java @@ -138,7 +138,7 @@ public class ChannelPublisherTest { } T take() throws Exception { - T t = elements.poll(100, TimeUnit.MILLISECONDS); + T t = elements.poll(1000, TimeUnit.MILLISECONDS); assertNotNull(t); return t; }
Try increasing subscriber probe timeout to fix CI
playframework_netty-reactive-streams
train
java
43e591039ce7f38b2468f8446179b0fa2b7ef7fc
diff --git a/lib/Doctrine/DBAL/Platforms/AbstractPlatform.php b/lib/Doctrine/DBAL/Platforms/AbstractPlatform.php index <HASH>..<HASH> 100644 --- a/lib/Doctrine/DBAL/Platforms/AbstractPlatform.php +++ b/lib/Doctrine/DBAL/Platforms/AbstractPlatform.php @@ -322,15 +322,15 @@ abstract class AbstractPlatform /** * Mark this type as to be commented in ALTER TABLE and CREATE TABLE statements. * - * @param Type $doctrineType + * @param string|Type $doctrineType * @return void */ - public function markDoctrineTypeCommented(Type $doctrineType) + public function markDoctrineTypeCommented($doctrineType) { if ($this->doctrineTypeComments === null) { $this->initializeCommentedDoctrineTypes(); } - $this->doctrineTypeComments[] = $doctrineType->getName(); + $this->doctrineTypeComments[] = $doctrineType instanceof Type ? $doctrineType->getName() : $doctrineType; } /**
[Platform] Allow a string to be passed as type
doctrine_dbal
train
php
d9e324a331788959bb7fb7f388383b1cad4ca65b
diff --git a/cmd/swarm/run_test.go b/cmd/swarm/run_test.go index <HASH>..<HASH> 100644 --- a/cmd/swarm/run_test.go +++ b/cmd/swarm/run_test.go @@ -242,7 +242,7 @@ func existingTestNode(t *testing.T, dir string, bzzaccount string) *testNode { "--bzzaccount", bzzaccount, "--bzznetworkid", "321", "--bzzport", httpPort, - "--verbosity", "3", + "--verbosity", fmt.Sprint(*loglevel), ) node.Cmd.InputLine(testPassphrase) defer func() { @@ -318,7 +318,7 @@ func newTestNode(t *testing.T, dir string) *testNode { "--bzzaccount", account.Address.String(), "--bzznetworkid", "321", "--bzzport", httpPort, - "--verbosity", "3", + "--verbosity", fmt.Sprint(*loglevel), ) node.Cmd.InputLine(testPassphrase) defer func() {
cmd/swarm: respect --loglevel in run_test helpers (#<I>) When CLI tests were spanning new nodes, the log level verbosity was hard coded as 6. So the Swarm process was always polluting the test output with TRACE level logs. Now `go test -v ./cmd/swarm -loglevel 0` works as expected.
ethereum_go-ethereum
train
go
d776674a899feb5ca7664b7056622e0233c2b98f
diff --git a/iktomi/utils/html.py b/iktomi/utils/html.py index <HASH>..<HASH> 100644 --- a/iktomi/utils/html.py +++ b/iktomi/utils/html.py @@ -105,13 +105,19 @@ class Cleaner(clean.Cleaner): continue par = None + def _tail_is_empty(self, el): + return not el.tail and el.tail.strip(u' \t\r\n\v\f\u00a0') + def is_element_empty(self, el): if el.tag == 'br': return True if el.tag not in self.drop_empty_tags: return False children = el.getchildren() - empty_children = all(map(self.is_element_empty, children)) + empty_children = all( + [self.is_element_empty(child) and self._tail_is_empty(child) + for child in children] + ) text = el.text and el.text.strip(u' \t\r\n\v\f\u00a0') return not text and empty_children
HtmlElement is not empty if it has tail
SmartTeleMax_iktomi
train
py
248d6b1987fe9c1280e5e3f133ee22ab7480b32e
diff --git a/tests/tasks/test_plugin_based.py b/tests/tasks/test_plugin_based.py index <HASH>..<HASH> 100644 --- a/tests/tasks/test_plugin_based.py +++ b/tests/tasks/test_plugin_based.py @@ -160,7 +160,7 @@ def test_ensure_workflow_data_is_saved_in_various_conditions( # Start the task.run in a separate process and terminate it. # This simulates the Cancel behavior by TERM signal. - def _build_docker_image(self, *args, **kwargs): + def _build_docker_image(*args, **kwargs): def _cancel_build(*args, **kwargs): raise TaskCanceledException() @@ -180,6 +180,7 @@ def test_ensure_workflow_data_is_saved_in_various_conditions( time.sleep(0.3) proc.terminate() + time.sleep(1) assert context_dir.join("workflow.json").exists() wf_data = ImageBuildWorkflowData()
fix test for checking existance of workflow.json
projectatomic_atomic-reactor
train
py
b73542b54aac5a4f96299b58a6df2af427f2ce54
diff --git a/index.js b/index.js index <HASH>..<HASH> 100644 --- a/index.js +++ b/index.js @@ -25,7 +25,11 @@ function whyIsNodeRunning (logger) { hook.disable() var activeResources = [...active.values()].filter(function(r) { - if (r.type === 'Timeout' && !r.resource.hasRef()) return false + if ( + r.type === 'Timeout' && + typeof r.resource.hasRef === 'function' + && !r.resource.hasRef() + ) return false return true })
Fix issue with excluding unrefed timers in node version <<I>
mafintosh_why-is-node-running
train
js
88898ea437174ac157b4dffc63346b6a9f15f1c4
diff --git a/lib/ticketmaster/provider.rb b/lib/ticketmaster/provider.rb index <HASH>..<HASH> 100644 --- a/lib/ticketmaster/provider.rb +++ b/lib/ticketmaster/provider.rb @@ -24,6 +24,12 @@ module TicketMaster::Provider def authorize(authentication = {}) @authentication = TicketMaster::Authenticator.new(authentication) end + + # All providers must define this method. + # It should implement the code for validating the authentication + def valid? + raise TicketMaster::Exception.new("#{Base.name}::#{this_method} method must be implemented by the provider") + end # Providers should try to define this method # diff --git a/spec/ticketmaster-exception_spec.rb b/spec/ticketmaster-exception_spec.rb index <HASH>..<HASH> 100644 --- a/spec/ticketmaster-exception_spec.rb +++ b/spec/ticketmaster-exception_spec.rb @@ -13,6 +13,13 @@ describe "Ticketmaster Exception Messages" do before(:each) do @ticketmaster = TicketMaster.new(:tester, {}) end + + describe "TicketMaster::Provider::Base" do + it "valid? method raises correct exception" do + msg = "TicketMaster::Provider::Base::valid? method must be implemented by the provider" + lambda { @ticketmaster.valid? }.should raise_error(@exception, msg) + end + end describe "TicketMaster::Provider::Helper" do it "easy_finder method raises correct exception" do
added a new valid method to implement in each provider
hybridgroup_taskmapper
train
rb,rb
c6a9f93542b1dc417f002a3b7916862c3313ff83
diff --git a/gdx-ai/src/com/badlogic/gdx/ai/btree/decorator/Include.java b/gdx-ai/src/com/badlogic/gdx/ai/btree/decorator/Include.java index <HASH>..<HASH> 100644 --- a/gdx-ai/src/com/badlogic/gdx/ai/btree/decorator/Include.java +++ b/gdx-ai/src/com/badlogic/gdx/ai/btree/decorator/Include.java @@ -94,12 +94,15 @@ public class Include<E> extends Decorator<E> { Include<E> include = (Include<E>)task; include.subtree = subtree; include.lazy = lazy; + include.guard = guard; return task; } private Task<E> createSubtreeRootTask () { - return BehaviorTreeLibraryManager.getInstance().createRootTask(subtree); + Task<E> rootTask = BehaviorTreeLibraryManager.getInstance().createRootTask(subtree); + rootTask.setGuard(guard); + return rootTask; } @Override
fix(BehaviorTree): properly copy & clone the IncludeTask guard to the generated tree.
libgdx_gdx-ai
train
java
36893766c425d49ce29fb3c3b21d10f172494a85
diff --git a/pkg/minikube/exit/exit.go b/pkg/minikube/exit/exit.go index <HASH>..<HASH> 100644 --- a/pkg/minikube/exit/exit.go +++ b/pkg/minikube/exit/exit.go @@ -102,6 +102,6 @@ func displayError(msg string, err error) { out.ErrT(out.Empty, "") out.FatalT("{{.msg}}: {{.err}}", out.V{"msg": translate.T(msg), "err": err}) out.ErrT(out.Empty, "") - out.ErrT(out.Sad, "Sorry that minikube crashed. If this was unexpected, we would love to hear from you:") + out.ErrT(out.Sad, "minikube is exiting due to an error. If this message is not helpful, please open an issue:") out.ErrT(out.URL, "https://github.com/kubernetes/minikube/issues/new/choose") }
Not a crash, but an error
kubernetes_minikube
train
go
adcbd842c888341e246243c7c6a696e4cf147fe2
diff --git a/claripy/frontends/composite_frontend.py b/claripy/frontends/composite_frontend.py index <HASH>..<HASH> 100644 --- a/claripy/frontends/composite_frontend.py +++ b/claripy/frontends/composite_frontend.py @@ -43,7 +43,7 @@ class CompositeFrontend(ConstrainedFrontend): super(CompositeFrontend, self)._ana_setstate(base_state) def downsize(self): - for e in self._solvers.values(): + for e in self._solver_list: e.downsize() # @@ -62,7 +62,10 @@ class CompositeFrontend(ConstrainedFrontend): @property def variables(self): - return set(self._solvers.keys()) + if len(self._solver_list) == 0: + return set() + else: + return set.union(*[s.variables for s in self._solver_list]) # this is really hacky, but we want to avoid having our variables messed with @variables.setter @@ -285,6 +288,9 @@ class CompositeFrontend(ConstrainedFrontend): # def _reabsorb_solver(self, s): + if len(s.variables) == 0 or self._solvers[next(iter(s.variables))] is s: + return + if isinstance(s, ModelCacheMixin): done = set() for ns in s.split():
small optimizations regarding the solver lists and solver reabsorbtion
angr_claripy
train
py
95b0e1aaa2e5d901b00fec05a55521a7fc2eaa83
diff --git a/spec/runner.rb b/spec/runner.rb index <HASH>..<HASH> 100755 --- a/spec/runner.rb +++ b/spec/runner.rb @@ -41,7 +41,7 @@ at_exit { } begin - Selenium::WebDriver::Wait.new(timeout: 600, interval: 1) \ + Selenium::WebDriver::Wait.new(timeout: 540, interval: 1) \ .until { not browser.find_element(:css, 'p#totals').text.strip.empty? } totals = browser.find_element(:css, 'p#totals').text
spec: set the timeout at 9 minutes
opal_opal-browser
train
rb
2ae52c21c00bbcca23463ee23369427977904515
diff --git a/spout/outputs.py b/spout/outputs.py index <HASH>..<HASH> 100644 --- a/spout/outputs.py +++ b/spout/outputs.py @@ -8,3 +8,18 @@ class PrintOperation(Operation): """ def perform(self, obj): print obj + + +class FileOutputOperation(Operation): + """ + Operation that writes each input item onto a separate line in a file. + """ + def __init__(self, filename): + self.output = open(filename, 'w') + + def perform(self, obj): + self.output.write(obj) + + def __del__(self): + self.output.flush() + self.output.close()
Created operation to output plain text to a file.
daviesjamie_spout
train
py
100c5fb44f0d3c09d858d9d0f20e535957467e5d
diff --git a/payout.go b/payout.go index <HASH>..<HASH> 100644 --- a/payout.go +++ b/payout.go @@ -108,7 +108,7 @@ type Payout struct { Card *Card `json:"card"` Created int64 `json:"created"` Currency Currency `json:"currency"` - Destination string `json:"destination"` + Destination *PayoutDestination `json:"destination"` FailureBalanceTransaction *BalanceTransaction `json:"failure_balance_transaction"` FailureCode PayoutFailureCode `json:"failure_code"` FailureMessage string `json:"failure_message"`
Changed the type of Payout.Destination from string to *PayoutDestination to support expanding
stripe_stripe-go
train
go
d3148331fcc7b7f3644d8dae376f06175fbfaf55
diff --git a/js/html/DomElement.js b/js/html/DomElement.js index <HASH>..<HASH> 100644 --- a/js/html/DomElement.js +++ b/js/html/DomElement.js @@ -13,7 +13,7 @@ define(["require","js/core/Component", "js/core/Content", "js/core/Binding", "in }, $behavesAsDomElement: true, ctor: function (attributes, descriptor, systemManager, parentScope, rootScope) { - ContentPlaceHolder = require("js/ui/ContentPlaceHolder"); + ContentPlaceHolder = ContentPlaceHolder || require("js/ui/ContentPlaceHolder"); this.$renderMap = {}; this.$childViews = []; this.$contentChildren = [];
optimized late requireing of ContentPlaceHolder
rappid_rAppid.js
train
js
e56b36648defb3a11e4cc6b8bcd3f945e2d850dc
diff --git a/paramiko/sftp_client.py b/paramiko/sftp_client.py index <HASH>..<HASH> 100644 --- a/paramiko/sftp_client.py +++ b/paramiko/sftp_client.py @@ -23,6 +23,7 @@ Client-mode SFTP support. from binascii import hexlify import errno import os +import stat import threading import time import weakref @@ -507,6 +508,8 @@ class SFTPClient (BaseSFTP): @since: 1.4 """ + if not S_ISDIR(self.stat(path).st_mode): + raise SFTPError(errno.ENOTDIR, "%s: %s" % (os.strerror(errno.ENOTDIR), path)) self._cwd = self.normalize(path) def getcwd(self):
patch from jim wilcoxson: raise an error early if chdir will fail.
bitprophet_ssh
train
py
819f016b84cc6c682c796535922e764f450b2e77
diff --git a/qtpylib/tools.py b/qtpylib/tools.py index <HASH>..<HASH> 100644 --- a/qtpylib/tools.py +++ b/qtpylib/tools.py @@ -695,10 +695,15 @@ def resample(data, resolution="1T", tz=None, ffill=True, dropna=False, ['_idx_']].min().max().values[-1]).replace('T', ' ') end_date = str(data.groupby(["symbol"])[ ['_idx_']].max().min().values[-1]).replace('T', ' ') - data = data[(data.index >= start_date) & (data.index <= end_date) - ].drop_duplicates(subset=['_idx_', 'symbol', - 'symbol_group', 'asset_class'], - keep='first') + + data = data[(data.index <= end_date)].drop_duplicates( + subset=['_idx_', 'symbol', 'symbol_group', 'asset_class'], + keep='first') + + # try also sync start date + trimmed = data[data.index >= start_date] + if not trimmed.empty: + data = trimmed # --------------------------------------------- # resample
fixed issue with resample's sync_last_timestamp
ranaroussi_qtpylib
train
py
53972883d5f24a981b8dac309f2f1dedd621dc2d
diff --git a/findbugs/src/java/edu/umd/cs/findbugs/detect/FindOpenStream.java b/findbugs/src/java/edu/umd/cs/findbugs/detect/FindOpenStream.java index <HASH>..<HASH> 100644 --- a/findbugs/src/java/edu/umd/cs/findbugs/detect/FindOpenStream.java +++ b/findbugs/src/java/edu/umd/cs/findbugs/detect/FindOpenStream.java @@ -433,9 +433,17 @@ public class FindOpenStream extends ResourceTrackingDetector<Stream, FindOpenStr return new StreamResourceTracker(bugReporter); } + public static boolean isMainMethod(Method method) { + return method.isStatic() + && method.getName().equals("main") + && method.getSignature().equals("([Ljava/lang/String;)V"); + } + public void analyzeMethod(ClassContext classContext, Method method, StreamResourceTracker resourceTracker) throws CFGBuilderException, DataflowAnalysisException { + if (isMainMethod(method)) return; + potentialOpenStreamList.clear(); super.analyzeMethod(classContext, method, resourceTracker);
Don't warn about open streams not being closed in main methods git-svn-id: <URL>
spotbugs_spotbugs
train
java
5df6d8f7719c65eb2fc7dae2241c5c94450c73d4
diff --git a/src/provider/AbstractBsdProvider.php b/src/provider/AbstractBsdProvider.php index <HASH>..<HASH> 100644 --- a/src/provider/AbstractBsdProvider.php +++ b/src/provider/AbstractBsdProvider.php @@ -127,10 +127,8 @@ abstract class AbstractBsdProvider extends AbstractUnixProvider */ public function getUptime() { - $uptime = shell_exec("sysctl -n kern.boottime | awk '{print $4}' | sed 's/,//'"); - if ($uptime) { - return (int)(time() - $uptime); - } + $sysctl = $this->getSysctlInfo(); + return (int)substr($sysctl['kern.boottime'], 8, 10); } /**
fix getUptime in bsd
trntv_probe
train
php
a6fa6535cf83662d58c6cbb6a40143086bd4a85f
diff --git a/index.js b/index.js index <HASH>..<HASH> 100644 --- a/index.js +++ b/index.js @@ -39,6 +39,7 @@ function addAssetsToStream(paths, files) { name = paths.name, basePath = paths.basePath, filepaths = files[name].assets, + type = paths.type, options = pluginOptions, gulpConcatOptions = {}; @@ -74,7 +75,7 @@ function addAssetsToStream(paths, files) { }); // option for newLine in gulp-concat - if (options.hasOwnProperty('newLine')) { + if (options.hasOwnProperty('newLine') || type === 'js') { gulpConcatOptions.newLine = options.newLine; } @@ -121,7 +122,8 @@ function processAssets(file, basePath, data) { basePath: basePath, searchPath: pluginOptions.searchPath, cwd: file.cwd, - transformPath: pluginOptions.transformPath + transformPath: pluginOptions.transformPath, + type: type }, files); } });
Apply newline to js files only.
jonkemp_gulp-useref
train
js
6c3ea7a511ca641cdf4fa4da1d775d5b6f4bef3e
diff --git a/daemon/execdriver/native/seccomp_default.go b/daemon/execdriver/native/seccomp_default.go index <HASH>..<HASH> 100644 --- a/daemon/execdriver/native/seccomp_default.go +++ b/daemon/execdriver/native/seccomp_default.go @@ -316,5 +316,17 @@ var defaultSeccompProfile = &configs.Seccomp{ Action: configs.Errno, Args: []*configs.Arg{}, }, + { + // In kernel x86 real mode virtual machine + Name: "vm86", + Action: configs.Errno, + Args: []*configs.Arg{}, + }, + { + // In kernel x86 real mode virtual machine + Name: "vm86old", + Action: configs.Errno, + Args: []*configs.Arg{}, + }, }, }
Block vm<I> syscalls in default seccomp profile These provide an in kernel virtual machine for x<I> real mode on x<I> used by one very early DOS emulator. Not required for any normal use.
moby_moby
train
go
05bcf6939d7ab49e9470442dd61f98abf9874a4c
diff --git a/lib/rack/ssl-enforcer.rb b/lib/rack/ssl-enforcer.rb index <HASH>..<HASH> 100644 --- a/lib/rack/ssl-enforcer.rb +++ b/lib/rack/ssl-enforcer.rb @@ -44,7 +44,7 @@ module Rack end if redirect_required? - call_before_redirect @options[:before_redirect] + call_before_redirect modify_location_and_redirect elsif ssl_request? status, headers, body = @app.call(env) @@ -81,8 +81,8 @@ module Rack destination_host && destination_host != @request.host end - def call_before_redirect(before_redirect) - before_redirect.call unless before_redirect.nil? + def call_before_redirect + @options[:before_redirect].call unless @options[:before_redirect].nil? end def modify_location_and_redirect
#<I> refactoring to not pass parameter to call_before_redirect, to make consistent iwth rest of code
tobmatth_rack-ssl-enforcer
train
rb
50c13daa8484d86fd7588cb2bbdd092b1259ebdd
diff --git a/arthur/_version.py b/arthur/_version.py index <HASH>..<HASH> 100644 --- a/arthur/_version.py +++ b/arthur/_version.py @@ -1,2 +1,2 @@ # Versions compliant with PEP 440 https://www.python.org/dev/peps/pep-0440 -__version__ = "0.1.7" +__version__ = "0.1.8"
Update version number to <I>
chaoss_grimoirelab-kingarthur
train
py
94d3649f8dcb5e0544671cccec09c577f7550cc9
diff --git a/nameko/context.py b/nameko/context.py index <HASH>..<HASH> 100644 --- a/nameko/context.py +++ b/nameko/context.py @@ -34,6 +34,7 @@ class Context(object): 'auth_token': self.auth_token, 'project_id': None, } + res.update(self.extra_kwargs) return res def add_to_message(self, message):
pass through extra kwargs when formatting context to_dict
nameko_nameko
train
py
c2f7d28c3a6ee699db24e78eb5a041a5efa50761
diff --git a/validation/features/steps/veewee_steps.rb b/validation/features/steps/veewee_steps.rb index <HASH>..<HASH> 100644 --- a/validation/features/steps/veewee_steps.rb +++ b/validation/features/steps/veewee_steps.rb @@ -9,7 +9,7 @@ Given /^a veeweebox was build$/ do end When /^I sudorun "([^\"]*)" over ssh$/ do |command| - @box.exec("echo '#{command}' > /tmp/validation.sh") + @box.exec("echo '#{command}' > /tmp/validation.sh && chmod a+x /tmp/validation.sh") @sshresult=@box.exec(@box.sudo("/tmp/validation.sh")) end
Prevent "validate" error on sudo Validate prints "unexpected exit code" and a stacktrace on the "sudo whoami" step. This is caused by insufficient permissions on /tmp/validation.sh - when it is written, the "execute" flag is not set. I added a chmod after file creation to fix the permissions.
jedi4ever_veewee
train
rb
846e086ad11689c49ad98ecd1a952bb9f0714510
diff --git a/facade/src/main/java/org/jboss/pnc/facade/providers/UserProviderImpl.java b/facade/src/main/java/org/jboss/pnc/facade/providers/UserProviderImpl.java index <HASH>..<HASH> 100644 --- a/facade/src/main/java/org/jboss/pnc/facade/providers/UserProviderImpl.java +++ b/facade/src/main/java/org/jboss/pnc/facade/providers/UserProviderImpl.java @@ -52,7 +52,8 @@ public class UserProviderImpl log.debug("Adding new user '{}' in database", username); currentUser = User.builder().username(username).build(); - store(currentUser); + // get the updated currentUser DTO with id + currentUser = store(currentUser); } return currentUser;
[NCL-<I>] Get the updated user with id on new user store
project-ncl_pnc
train
java
b774de6de1da6a45d976d97e890ab204a115e5d9
diff --git a/src/core/textures/BaseTexture.js b/src/core/textures/BaseTexture.js index <HASH>..<HASH> 100644 --- a/src/core/textures/BaseTexture.js +++ b/src/core/textures/BaseTexture.js @@ -321,7 +321,7 @@ BaseTexture.prototype.updateSourceImage = function (newSrc) { BaseTexture.fromImage = function (imageUrl, crossorigin, scaleMode) { var baseTexture = utils.BaseTextureCache[imageUrl]; - if (crossorigin === undefined && imageUrl.indexOf('data:') === 0) { + if (crossorigin === undefined && imageUrl.indexOf('data:') !== 0) { crossorigin = true; }
Fix typo in fromImage logic This bug was introduced in 1a<I>f<I>f9ebaa<I>b<I>fb<I>b2bd<I>
pixijs_pixi.js
train
js
cf0495159a12ca5aa146b625b0083681e9636932
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -9,13 +9,12 @@ with open('README.md', encoding='utf-8') as readme_file: requirements = [ 'binaryornot>=0.4.4', - 'Jinja2<4.0.0', + 'Jinja2>=2.7,<4.0.0', 'click>=7.0', 'pyyaml>=5.3.1', 'jinja2-time>=0.2.0', 'python-slugify>=4.0.0', 'requests>=2.23.0', - 'MarkupSafe<2.0.0', ] setup(
Remove direct dependency on markupsafe This sorts potential dependency conflicts with jinja2 which is the only place where markupsafe is used (since version <I>)
audreyr_cookiecutter
train
py
ce17694e70eac80e135e8b372c63075c13398d47
diff --git a/index.js b/index.js index <HASH>..<HASH> 100644 --- a/index.js +++ b/index.js @@ -13,7 +13,7 @@ exports.getPropertyInfo = function(address, callback) { ], function generateResponse(error, body) { if(!error) { - callback(error, JSON.parse(body)); + callback(null, JSON.parse(body)); } else { callback({ error: error.message });
Modified error handling in main callback
mheadd_phl-property
train
js
47438b6a4ee91380c384434b374230916dd4ca8b
diff --git a/src/main/java/javascalautils/TryCompanion.java b/src/main/java/javascalautils/TryCompanion.java index <HASH>..<HASH> 100644 --- a/src/main/java/javascalautils/TryCompanion.java +++ b/src/main/java/javascalautils/TryCompanion.java @@ -41,7 +41,10 @@ package javascalautils; * @author Peter Nerg * @since 1.3 */ -public class TryCompanion { +public final class TryCompanion { + + private TryCompanion() { + } /** * Creates an instance of {@link Try} wrapping the result of the provided function. <br>
Adde private constructor to TryCompanion
pnerg_java-scala-util
train
java
9a9c821971729af4e215bf0903323ad78e8758ca
diff --git a/db/sql/session.php b/db/sql/session.php index <HASH>..<HASH> 100644 --- a/db/sql/session.php +++ b/db/sql/session.php @@ -143,8 +143,9 @@ class Session extends Mapper { * @param $db object * @param $table string * @param $force bool + * @param $onsuspect callback **/ - function __construct(\DB\SQL $db,$table='sessions',$force=TRUE) { + function __construct(\DB\SQL $db,$table='sessions',$force=TRUE,$onsuspect=NULL) { if ($force) { $eol="\n"; $tab="\t"; @@ -184,8 +185,12 @@ class Session extends Mapper { ($agent=$this->agent()) && (!isset($headers['User-Agent']) || $agent!=$headers['User-Agent'])) { - session_destroy(); - $fw->error(403); + if (isset($onsuspect)) + $fw->call($onsuspect,array($this)); + else { + session_destroy(); + $fw->error(403); + } } $csrf=$fw->hash($fw->get('ROOT').$fw->get('BASE')).'.'. $fw->hash(mt_rand());
SQL Session: custom callback for suspect sessions
bcosca_fatfree-core
train
php
02bc9680148675e14d9bbcc6afad2b506daee2cb
diff --git a/hyperid.js b/hyperid.js index <HASH>..<HASH> 100644 --- a/hyperid.js +++ b/hyperid.js @@ -62,10 +62,17 @@ function pad (count) { function baseId (id, urlSafe) { var base64Id = Buffer.from(parser.parse(id)).toString('base64') + var l = base64Id.length if (urlSafe) { - return base64Id.replace(/\+/g, '_').replace(/\//g, '-').replace(/==$/, '-') + if (base64Id[l - 2] === '=' && base64Id[l - 1] === '=') { + base64Id = base64Id.substr(0, l - 2) + '-' + } + return base64Id.replace(/\+/g, '_').replace(/\//g, '-') + } + if (base64Id[l - 2] === '=' && base64Id[l - 1] === '=') { + return base64Id.substr(0, l - 2) + '/' } - return base64Id.replace(/==$/, '/') + return base64Id } function decode (id, opts) {
feat: avoid regex for end of id (#<I>)
mcollina_hyperid
train
js
ebbd21b8c429b5afc41c631353174175f2a9804c
diff --git a/lib/Controller/ADForm.php b/lib/Controller/ADForm.php index <HASH>..<HASH> 100644 --- a/lib/Controller/ADForm.php +++ b/lib/Controller/ADForm.php @@ -193,7 +193,7 @@ class Controller_ADForm extends AbstractController $list = isset($field->ui['valueList']) ? $field->ui['valueList'] - : $field->enum; + : array_combine($field->enum, $field->enum); if($form_field instanceof Form_Field_Checkbox) { $list = array_reverse($list);
lets fix enum() proprely, it should use values as keys
atk4_atk4
train
php
babeba784bc1110ec5a63e67b06da96325c1eca2
diff --git a/term2048/ui.py b/term2048/ui.py index <HASH>..<HASH> 100644 --- a/term2048/ui.py +++ b/term2048/ui.py @@ -28,10 +28,14 @@ def print_version_and_exit(): print("term2048 v%s" % __version__) sys.exit(0) + def print_rules_and_exit(): - print("Use your arrow keys to move the tiles. When two tiles with the same number touch they merge into one! Try to reach 2048 to win.") + print("""Use your arrow keys to move the tiles. +When two tiles with the same value touch they merge into one with the sum of +their value! Try to reach 2048 to win.""") sys.exit(0) + def parse_cli_args(): """parse args from the CLI and return a dict""" parser = argparse.ArgumentParser(description='2048 in your terminal') @@ -54,7 +58,7 @@ def start_game(): if args['version']: print_version_and_exit() - + if args['rules']: print_rules_and_exit()
PEP8 compliance in ui.py
bfontaine_term2048
train
py
2c05d517949fca12f07b495a03889dd38e5a1826
diff --git a/packages/@uppy/react/src/useUppy.js b/packages/@uppy/react/src/useUppy.js index <HASH>..<HASH> 100644 --- a/packages/@uppy/react/src/useUppy.js +++ b/packages/@uppy/react/src/useUppy.js @@ -18,8 +18,9 @@ module.exports = function useUppy (factory) { useEffect(() => { return () => { uppy.current.close({ reason: 'unmount' }) + uppy.current = undefined } - }, []) + }, [uppy]) return uppy.current }
Reset uppy instance when React component is unmounted (#<I>)
transloadit_uppy
train
js
2a90e94c5c812a573e66a4a7eb270a25a884f9b2
diff --git a/lenses/ui/base.py b/lenses/ui/base.py index <HASH>..<HASH> 100644 --- a/lenses/ui/base.py +++ b/lenses/ui/base.py @@ -314,7 +314,7 @@ class BaseUiLens(Generic[S, T, A, B]): ''' return self._compose_optic(optics.GetitemLens(key)) - def getter_setter_(self, getter, setter): + def lens_(self, getter, setter): # type: (Callable[[A], X], Callable[[A, Y], B]) -> BaseUiLens[S, T, X, Y] '''An optic that wraps a pair of getter and setter functions. A getter function is one that takes a state and returns a value @@ -332,7 +332,7 @@ class BaseUiLens(Generic[S, T, A, B]): ... prefix = old_state[:-1] ... return prefix + [target_sum - sum(prefix)] ... - >>> average_lens = lens.getter_setter_(getter, setter) + >>> average_lens = lens.lens_(getter, setter) >>> average_lens UnboundLens(Lens(<function getter...>, <function setter...>)) >>> average_lens.get()([1, 2, 4, 5])
renamed getter_setter_ method to lens_ lets break everything while we're at it a much better name
ingolemo_python-lenses
train
py
3cb7288d4f4a93d07c9989c90511f6887bcaeb25
diff --git a/git/diff.py b/git/diff.py index <HASH>..<HASH> 100644 --- a/git/diff.py +++ b/git/diff.py @@ -108,6 +108,7 @@ class Diffable(object): args.append("-p") else: args.append("--raw") + args.append("-z") # in any way, assure we don't see colored output, # fixes https://github.com/gitpython-developers/GitPython/issues/172 @@ -483,7 +484,7 @@ class Diff(object): if not line.startswith(":"): return - meta, _, path = line[1:].partition('\t') + meta, _, path = line[1:].partition('\x00') old_mode, new_mode, a_blob_id, b_blob_id, _change_type = meta.split(None, 4) # Change type can be R100 # R: status letter
Add '-z' on top of '--raw' to avoid path name mangling Authored based on <URL>
gitpython-developers_GitPython
train
py
9cac45d514bc6bd9195a39b340694ebdcb9aa109
diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/redis/RedisAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/redis/RedisAutoConfigurationTests.java index <HASH>..<HASH> 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/redis/RedisAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/redis/RedisAutoConfigurationTests.java @@ -197,7 +197,7 @@ public class RedisAutoConfigurationTests { this.contextRunner .withPropertyValues("spring.redis.database:1", "spring.redis.sentinel.master:mymaster", - "spring.redis.sentinel.nodes:127.0.0.1:26379, 127.0.0.1:26380") + "spring.redis.sentinel.nodes:127.0.0.1:26379, 127.0.0.1:26380") .run((context) -> { LettuceConnectionFactory connectionFactory = context .getBean(LettuceConnectionFactory.class);
Polish "Add Redis Sentinel database support" Closes gh-<I>
spring-projects_spring-boot
train
java
5b1893d66328908653b3a115467831e84ead803a
diff --git a/lib/email.js b/lib/email.js index <HASH>..<HASH> 100644 --- a/lib/email.js +++ b/lib/email.js @@ -118,10 +118,7 @@ var send = exports.send = function(to, subject, text_body, html_body, from, doma smtpTransport.sendMail(mailOptions, function(error, response){ if(error){ console.log("Error sending email:",error); - }else{ - console.log("Email sent: " + response.message); } - }); }
don't log successful email send message
Strider-CD_strider
train
js
b7f2c93c1844e220f97c14303f23bac87015c7ea
diff --git a/Model/Service/TransactionHandlerService.php b/Model/Service/TransactionHandlerService.php index <HASH>..<HASH> 100755 --- a/Model/Service/TransactionHandlerService.php +++ b/Model/Service/TransactionHandlerService.php @@ -574,7 +574,9 @@ class TransactionHandlerService if ($transactionType && !empty($transactions)) { $filteredResult = []; foreach ($transactions as $transaction) { - if ($transaction->getTxnType() == $transactionType && $transaction->getIsClosed() == $isClosed) { + $condition = $transaction->getTxnType() == $transactionType + && $transaction->getIsClosed() == $isClosed; + if ($condition) { $filteredResult[] = $transaction; } }
Added code improvements in transaction handler service
checkout_checkout-magento2-plugin
train
php