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
aa001629e653ba7d673f27bc23e47d73ef23be13
diff --git a/lib/vcr/cucumber_tags.rb b/lib/vcr/cucumber_tags.rb index <HASH>..<HASH> 100644 --- a/lib/vcr/cucumber_tags.rb +++ b/lib/vcr/cucumber_tags.rb @@ -22,7 +22,7 @@ module VCR cassette_name = "cucumber_tags/#{tag_name.gsub(/\A@/, '')}" @main_object.Around(tag_name) do |scenario, block| - VCR.use_cassette(cassette_name, options) { block.call } + VCR.use_cassette(cassette_name, options, &block) end self.class.add_tag(tag_name)
Simplify passing the block to VCR.use_cassette -- use &block rather than { block.call }.
vcr_vcr
train
rb
758c420b1503cadab2a5eb7dd93497afd5c1b578
diff --git a/orca/server/tests/test_server.py b/orca/server/tests/test_server.py index <HASH>..<HASH> 100644 --- a/orca/server/tests/test_server.py +++ b/orca/server/tests/test_server.py @@ -244,7 +244,7 @@ def test_injectable_repr(tapp, dfb_factor): data = json.loads(rv.data.decode('utf-8')) - assert data == {'type': "<class 'int'>", 'repr': '2'} + assert data == {'type': str(type(42)), 'repr': '2'} def test_no_injectable_404(tapp):
fix a test for python 2/3 compatibility
UDST_orca
train
py
c5f797ccaca81f196e2e69241fad8cbb5dc10af9
diff --git a/lib/alchemy/i18n.rb b/lib/alchemy/i18n.rb index <HASH>..<HASH> 100644 --- a/lib/alchemy/i18n.rb +++ b/lib/alchemy/i18n.rb @@ -30,8 +30,9 @@ module Alchemy # hello: Hallo # def self.t(msg, *args) + raise ArgumentError, 'Please provide a tanslation key' if msg.nil? options = args.extract_options! - options[:default] = options[:default] ? options[:default] : msg.to_s.humanize + humanize_default_string!(msg, options) scope = ['alchemy'] case options[:scope].class.name when "Array" @@ -52,5 +53,13 @@ module Alchemy Dir.glob(File.join(File.dirname(__FILE__), '../../config/locales/alchemy.*.yml')) end + private + + def self.humanize_default_string!(msg, options) + if options[:default].blank? + options[:default] = msg.is_a?(Symbol) ? msg.to_s.humanize : msg + end + end + end end
Only humanize translation keys that are symbols.
AlchemyCMS_alchemy_cms
train
rb
fc1edd215e02e69f5022b3712ba78f2a599f1a56
diff --git a/lib/bson.rb b/lib/bson.rb index <HASH>..<HASH> 100644 --- a/lib/bson.rb +++ b/lib/bson.rb @@ -16,7 +16,7 @@ begin # Need this for running test with and without c ext in Ruby 1.9. raise LoadError if ENV['TEST_MODE'] && !ENV['C_EXT'] require 'bson_ext/cbson' - raise LoadError unless defined?(CBson::VERSION)# && CBson::VERSION == Mongo::BSON::VERSION + raise LoadError unless defined?(CBson::VERSION) && CBson::VERSION == BSON::VERSION require 'bson/bson_c' module BSON BSON_CODER = BSON_C
minor: check bson and bson_ext versions
mongodb_mongo-ruby-driver
train
rb
5dd2ffb98c6169f8fcf84c065da3c27289e737af
diff --git a/Testing/Fakes/EventFake.php b/Testing/Fakes/EventFake.php index <HASH>..<HASH> 100644 --- a/Testing/Fakes/EventFake.php +++ b/Testing/Fakes/EventFake.php @@ -5,6 +5,7 @@ namespace Illuminate\Support\Testing\Fakes; use Closure; use Illuminate\Contracts\Events\Dispatcher; use Illuminate\Support\Arr; +use Illuminate\Support\Str; use Illuminate\Support\Traits\ReflectsClosures; use PHPUnit\Framework\Assert as PHPUnit; use ReflectionFunction; @@ -61,6 +62,10 @@ class EventFake implements Dispatcher $actualListener = (new ReflectionFunction($listenerClosure)) ->getStaticVariables()['listener']; + if (is_string($actualListener) && Str::endsWith($actualListener, '@handle')) { + $actualListener = Str::parseCallback($actualListener)[0]; + } + if ($actualListener === $expectedListener || ($actualListener instanceof Closure && $expectedListener === Closure::class)) {
[8.x] Fix assertListening check with auto discovery (#<I>) * Fix assertListening check with auto discovery * wip
illuminate_support
train
php
767ac6fb9a6b5ae6a6f4ed506b7404351f926b5d
diff --git a/lib/suggestion-list.js b/lib/suggestion-list.js index <HASH>..<HASH> 100644 --- a/lib/suggestion-list.js +++ b/lib/suggestion-list.js @@ -292,7 +292,7 @@ class SuggestionList { } hide () { - atom.views.updateDocument(this.destroyOverlay.bind(this)) + this.destroyOverlay() if (this.activeEditor === null) { return } @@ -313,7 +313,9 @@ class SuggestionList { } const editorElement = atom.views.getView(this.activeEditor) if (editorElement && editorElement.classList) { - editorElement.classList.remove('autocomplete-active') + atom.views.updateDocument(() => { + editorElement.classList.remove('autocomplete-active') + }) } this.suggestionMarker = undefined this.overlayDecoration = undefined
fix autocomplete-active class not being removed
atom_autocomplete-plus
train
js
e58095c4f22f5637d6eb90898ecbbbbb057490d4
diff --git a/common/src/main/java/io/netty/util/concurrent/DefaultThreadFactory.java b/common/src/main/java/io/netty/util/concurrent/DefaultThreadFactory.java index <HASH>..<HASH> 100644 --- a/common/src/main/java/io/netty/util/concurrent/DefaultThreadFactory.java +++ b/common/src/main/java/io/netty/util/concurrent/DefaultThreadFactory.java @@ -107,14 +107,8 @@ public class DefaultThreadFactory implements ThreadFactory { public Thread newThread(Runnable r) { Thread t = newThread(new DefaultRunnableDecorator(r), prefix + nextId.incrementAndGet()); try { - if (t.isDaemon()) { - if (!daemon) { - t.setDaemon(false); - } - } else { - if (daemon) { - t.setDaemon(true); - } + if (t.isDaemon() != daemon) { + t.setDaemon(daemon); } if (t.getPriority() != priority) {
Simplify code Motivation: Code can be simplified Modification: Refactor code to remove extra branching Result: Cleaner code.
netty_netty
train
java
417b4067b5d4207bf6504d41af39918f7baa5f8f
diff --git a/tests/tests/Attribute/Value/PageValueTest.php b/tests/tests/Attribute/Value/PageValueTest.php index <HASH>..<HASH> 100755 --- a/tests/tests/Attribute/Value/PageValueTest.php +++ b/tests/tests/Attribute/Value/PageValueTest.php @@ -39,7 +39,7 @@ class PageValueTest extends \AttributeValueTestCase 'name' => 'Basic', )); - $parent = Page::getByID(HOME_CID); + $parent = Page::getByID(Page::getHomePageID()); $parent->add($pt, array( 'cName' => 'Test Page 1',
Remove usage of HOME_CID from Attribute/Value/PageValueTest test
concrete5_concrete5
train
php
b3d41a031576b5c9f46034af67628c386921fd39
diff --git a/tests/test_conf.py b/tests/test_conf.py index <HASH>..<HASH> 100644 --- a/tests/test_conf.py +++ b/tests/test_conf.py @@ -177,3 +177,25 @@ class BuildHtmlTests(unittest.TestCase): # noqa ) custom_css_index = stylesheet_href_list.index("_static/custom.css") self.assertTrue(default_theme_index < custom_css_index) + + @with_app( + **gen_app_conf( + confoverrides={ + "revealjs_style_theme": "moon", + "revealjs_static_path": ["_static"], + "revealjs_css_files": ["other_custom.css"], + } + ) + ) + def test_specified_theme_css_comes_before_custom_css( + self, app: TestApp, status, warning + ): + soup = soup_html(app, "index.html") + stylesheet_href_list = [ + e["href"] for e in soup.find_all("link", rel="stylesheet") + ] + specified_theme_index = stylesheet_href_list.index( + "_static/revealjs4/dist/theme/moon.css" + ) + custom_css_index = stylesheet_href_list.index("_static/other_custom.css") + self.assertTrue(specified_theme_index < custom_css_index)
add another test case in case of specified theme and other css files
attakei_sphinx-revealjs
train
py
cb78877cc5ea63dd295f8c65c4ebb3d23b51ae0a
diff --git a/lib/Form/Field.php b/lib/Form/Field.php index <HASH>..<HASH> 100644 --- a/lib/Form/Field.php +++ b/lib/Form/Field.php @@ -185,14 +185,8 @@ abstract class Form_Field extends AbstractView { $this->value=null; } function loadPOST(){ - $gpc = get_magic_quotes_gpc(); - if ($gpc){ - if(isset($_POST[$this->name]))$this->set(stripslashes($_POST[$this->name])); - else $this->set($this->default_value); - } else { - if(isset($_POST[$this->name]))$this->set($_POST[$this->name]); - else $this->set($this->default_value); - } + if(isset($_POST[$this->name]))$this->set($_POST[$this->name]); + else $this->set($this->default_value); $this->normalize(); } function normalize(){
magic quotes are already inside the API once
atk4_atk4
train
php
c25ae1e6abca33f195215c7ed019d0cec39cae62
diff --git a/client/connection/connection.go b/client/connection/connection.go index <HASH>..<HASH> 100644 --- a/client/connection/connection.go +++ b/client/connection/connection.go @@ -15,7 +15,6 @@ import ( "strings" "time" - "github.com/cloudfoundry-incubator/cf-lager" "github.com/cloudfoundry-incubator/garden" "github.com/cloudfoundry-incubator/garden/routes" "github.com/cloudfoundry-incubator/garden/transport" @@ -94,7 +93,7 @@ func (err Error) Error() string { } func New(network, address string) Connection { - return NewWithLogger(network, address, cf_lager.New("garden-connection")) + return NewWithLogger(network, address, lager.NewLogger("garden-connection")) } func NewWithLogger(network, address string, log lager.Logger) Connection {
use lager rather than cf_lager for garden client
cloudfoundry_garden
train
go
c0144d7d2424bc57f265fcda63a03ca6189aaaa8
diff --git a/src/Rocketeer/Services/Connections/RemoteHandler.php b/src/Rocketeer/Services/Connections/RemoteHandler.php index <HASH>..<HASH> 100644 --- a/src/Rocketeer/Services/Connections/RemoteHandler.php +++ b/src/Rocketeer/Services/Connections/RemoteHandler.php @@ -83,8 +83,8 @@ class RemoteHandler { $credentials = $connection->getServerCredentials(); - if (!isset($credentials['host']) || !isset($credentials['username'])) { - throw new MissingCredentialsException('Host and/or username is required for '.$connection->name); + if (!isset($credentials['host'])) { + throw new MissingCredentialsException('Host is required for '.$connection->name); } $connection = new Connection(
Remove requirment of username
rocketeers_rocketeer
train
php
d24b8576cf81379101b5fe115507ae1a6b53d645
diff --git a/interop/interop_client.js b/interop/interop_client.js index <HASH>..<HASH> 100644 --- a/interop/interop_client.js +++ b/interop/interop_client.js @@ -178,7 +178,6 @@ function pingPong(client, done) { payload: {body: zeroBuffer(payload_sizes[index])} }); call.on('data', function(response) { - debugger; assert.strictEqual(response.payload.type, testProto.PayloadType.COMPRESSABLE); assert.equal(response.payload.body.limit - response.payload.body.offset,
Removed stray debugger statement
grpc_grpc-node
train
js
c3495909453b0e31886383de8269e96f23efd8ec
diff --git a/src/DOM.js b/src/DOM.js index <HASH>..<HASH> 100644 --- a/src/DOM.js +++ b/src/DOM.js @@ -2078,7 +2078,7 @@ class HTMLIFrameElement extends HTMLSrcableElement { const height = this.height || context.canvas.ownerDocument.defaultView.innerHeight; if (bindings.nativePlatform === 'android') { - return new bindings.nativeBrowser(context, width, height, url); + return new bindings.nativeBrowser.Browser(context, width, height, url); } else { return new ElectronVm({ url,
Bugfix native browser construction in the Android case
exokitxr_exokit
train
js
c92b1c6bba68c568458d51343f827469e492ffec
diff --git a/ontrack-service/src/main/java/net/nemerosa/ontrack/service/SearchServiceImpl.java b/ontrack-service/src/main/java/net/nemerosa/ontrack/service/SearchServiceImpl.java index <HASH>..<HASH> 100644 --- a/ontrack-service/src/main/java/net/nemerosa/ontrack/service/SearchServiceImpl.java +++ b/ontrack-service/src/main/java/net/nemerosa/ontrack/service/SearchServiceImpl.java @@ -23,7 +23,7 @@ public class SearchServiceImpl implements SearchService { @Override public Collection<SearchResult> search(SearchRequest request) { - return providers.parallelStream() + return providers.stream() .filter(provider -> provider.isTokenSearchable(request.getToken())) .flatMap(provider -> provider.search(request.getToken()).stream()) .collect(Collectors.toList());
Search: disabling parallel search since it does preserve the URI context
nemerosa_ontrack
train
java
e82bb27feddc11d013cc2a26ac29fe8c5e8a4585
diff --git a/library/src/ibt/ortc/plugins/websocket/WebSocketReceiver.java b/library/src/ibt/ortc/plugins/websocket/WebSocketReceiver.java index <HASH>..<HASH> 100644 --- a/library/src/ibt/ortc/plugins/websocket/WebSocketReceiver.java +++ b/library/src/ibt/ortc/plugins/websocket/WebSocketReceiver.java @@ -56,6 +56,11 @@ public class WebSocketReceiver eventHandler.onMessage(new WebSocketMessage(message)); messageBytes.clear(); } + else if (b == -1) { + frameStart = false; + messageBytes.clear(); + handleError(); + } else if (frameStart == true){ messageBytes.add((byte)b); }
Fixed web socket receiver eat all memory
realtime-framework_RealtimeMessaging-Java
train
java
f992c61df13e57c8f344cc16725144a9d2d7a741
diff --git a/lib/rest-core/middleware/cache.rb b/lib/rest-core/middleware/cache.rb index <HASH>..<HASH> 100644 --- a/lib/rest-core/middleware/cache.rb +++ b/lib/rest-core/middleware/cache.rb @@ -68,7 +68,7 @@ module RestCore return res unless cache(res) return res unless cache_for?(res) - if expires_in(res).kind_of?(Fixnum) && + if expires_in(res).kind_of?(Numeric) && cache(res).respond_to?(:store) && cache(res).method(:store).arity == -3
Use Numeric as Fixnum is deprecated
godfat_rest-core
train
rb
1c3b8de474c7cd8070a85dea7660530977756b53
diff --git a/packages/upload-core/src/upload.js b/packages/upload-core/src/upload.js index <HASH>..<HASH> 100644 --- a/packages/upload-core/src/upload.js +++ b/packages/upload-core/src/upload.js @@ -350,7 +350,7 @@ class Upload { }; const fileReader = new FileReader() fileReader.addEventListener("loadend", check); - fileReader.readAsArrayBuffer(file); + fileReader.readAsArrayBuffer(this.file); while (true) { await new Promise(r => setTimeout(r, 100)); if (obj.isUncorrupt !== -1 ) {
feat(POCL-<I>): fixed missing this. before file.
Availity_sdk-js
train
js
52ece2f303fd4b646633874dbaeeeb04f4f03dcc
diff --git a/openquake/hazardlib/gsim/yu_2013.py b/openquake/hazardlib/gsim/yu_2013.py index <HASH>..<HASH> 100644 --- a/openquake/hazardlib/gsim/yu_2013.py +++ b/openquake/hazardlib/gsim/yu_2013.py @@ -124,9 +124,16 @@ def fnc(ra, *args): def get_ras(repi, theta, mag, coeff): """ + Computes equivalent distance + + :param repi: + Epicentral distance :param theta: + Azimuth value :param mag: + Magnitude :param C: + GMPE coefficients """ rx = 150. ras = 300.
Adding description pf params
gem_oq-engine
train
py
cc36454d59ec86c711d8142da995a2557ef270e0
diff --git a/packages/openneuro-app/webpack.common.js b/packages/openneuro-app/webpack.common.js index <HASH>..<HASH> 100644 --- a/packages/openneuro-app/webpack.common.js +++ b/packages/openneuro-app/webpack.common.js @@ -59,6 +59,9 @@ module.exports = { use: [ { loader: 'babel-loader', + options: { + rootMode: 'upward', + }, }, ], },
App: Fix loading babel config now that it is root level.
OpenNeuroOrg_openneuro
train
js
830d2b808db56e1edccaa048bf93c495899ea274
diff --git a/src/Yosymfony/Toml/Parser.php b/src/Yosymfony/Toml/Parser.php index <HASH>..<HASH> 100644 --- a/src/Yosymfony/Toml/Parser.php +++ b/src/Yosymfony/Toml/Parser.php @@ -222,12 +222,6 @@ class Parser private function isTokenValidForTablename(Token $token) { - if (Lexer::TOKEN_HASH === $token->getType()) { - $this->lexer->setCommentOpen(false); - - return true; - } - return Lexer::TOKEN_LITERAL === $token->getType(); }
Keys can no longer contain '#' characters'
yosymfony_toml
train
php
586b7cc19ef289b0f60a859ca75ec6a9eb97120d
diff --git a/integration-cli/docker_cli_plugins_test.go b/integration-cli/docker_cli_plugins_test.go index <HASH>..<HASH> 100644 --- a/integration-cli/docker_cli_plugins_test.go +++ b/integration-cli/docker_cli_plugins_test.go @@ -27,6 +27,7 @@ func (s *DockerSuite) TestPluginBasicOps(c *check.C) { c.Assert(out, checker.Contains, "true") id, _, err := dockerCmdWithError("plugin", "inspect", "-f", "{{.Id}}", pNameWithTag) + id = strings.TrimSpace(id) c.Assert(err, checker.IsNil) out, _, err = dockerCmdWithError("plugin", "remove", pNameWithTag) diff --git a/plugin/backend.go b/plugin/backend.go index <HASH>..<HASH> 100644 --- a/plugin/backend.go +++ b/plugin/backend.go @@ -162,6 +162,7 @@ func (pm *Manager) Remove(name string, config *types.PluginRmConfig) error { } pm.pluginStore.Remove(p) + os.RemoveAll(filepath.Join(pm.libRoot, p.GetID())) pm.pluginEventLogger(p.GetID(), name, "remove") return nil }
delete plugin rootfs on plugin rm
moby_moby
train
go,go
f3c9db17c52e3ad898f926c125d27af1ca7b75f4
diff --git a/classes/hypeJunction/Services/IconFactory.php b/classes/hypeJunction/Services/IconFactory.php index <HASH>..<HASH> 100644 --- a/classes/hypeJunction/Services/IconFactory.php +++ b/classes/hypeJunction/Services/IconFactory.php @@ -244,7 +244,7 @@ class IconFactory { * * @param \ElggEntity $entity Entity * @param string $size Size - * @return ElggFile + * @return \ElggFile */ public function getURL(\ElggEntity $entity, $size = '') { @@ -292,7 +292,7 @@ class IconFactory { $size = strtolower($size ? : 'medium'); $filename = "icons/" . $entity->guid . $size . ".jpg"; $etag = md5($entity->icontime . $size); - $filehandler = new ElggFile(); + $filehandler = new \ElggFile(); $filehandler->owner_guid = $entity->owner_guid; $filehandler->setFilename($filename); if ($filehandler->exists()) {
fix(icons): classname missing scope
hypeJunction_hypeApps
train
php
968d4b2d574181e381b2bef84f3bb86924acaa14
diff --git a/src/MrDeDownloader.py b/src/MrDeDownloader.py index <HASH>..<HASH> 100644 --- a/src/MrDeDownloader.py +++ b/src/MrDeDownloader.py @@ -10,7 +10,7 @@ import ThreadHTMLParser from pathlib import Path # import multiprocessing -VERSION = ['1', '2', '0'] +VERSION = ['1', '2', '1'] temp_path = Path('./temp/') threads_path = Path('./temp/threads/')
[update] to version <I>
IceflowRE_unidown
train
py
ae8bb648881f653b6fb0d0afaa2458121cf1306b
diff --git a/lib/paper_trail/version_number.rb b/lib/paper_trail/version_number.rb index <HASH>..<HASH> 100644 --- a/lib/paper_trail/version_number.rb +++ b/lib/paper_trail/version_number.rb @@ -1,3 +1,3 @@ module PaperTrail - VERSION = '1.6.4' + VERSION = '1.6.5' end
Promote patch version to <I>.
paper-trail-gem_paper_trail
train
rb
33c92d87ddf97ad4aaff98336012b583c3e399eb
diff --git a/src/com/backendless/geo/BackendlessGeoQuery.java b/src/com/backendless/geo/BackendlessGeoQuery.java index <HASH>..<HASH> 100644 --- a/src/com/backendless/geo/BackendlessGeoQuery.java +++ b/src/com/backendless/geo/BackendlessGeoQuery.java @@ -29,7 +29,7 @@ import java.util.Map; public class BackendlessGeoQuery extends AbstractBackendlessGeoQuery implements IBackendlessQuery { private Units units; - private boolean includeMeta = true; + private boolean includeMeta; private double[] searchRectangle; private int pageSize = 100; private int offset;
BKNDLSS-<I>: changed default value if includeMeta into false
Backendless_Android-SDK
train
java
92b6c482b0525a95165edd00f5dee58da05b639a
diff --git a/test/integration/generated_regress_test.rb b/test/integration/generated_regress_test.rb index <HASH>..<HASH> 100644 --- a/test/integration/generated_regress_test.rb +++ b/test/integration/generated_regress_test.rb @@ -935,10 +935,22 @@ describe Regress do end describe "Regress::TestStructC" do - it "must be tested" do - skip + let(:instance) { Regress::TestStructC.new } + it "has a writable field another_int" do + instance.another_int.must_equal 0 + instance.another_int = 42 + instance.another_int.must_equal 42 + end + + it "has a writable field obj" do + o = Regress::TestSubObj.new + instance.obj.must_equal nil + instance.obj = o + # TODO: Improve #== for ClassBase + instance.obj.to_ptr.must_equal o.to_ptr end end + describe "Regress::TestStructD" do it "must be tested" do skip
Add tests for fields of Regress::TestStructC
mvz_gir_ffi
train
rb
207c059ecfa86089c5d241e66508cf9e593c0d3d
diff --git a/plugin/import-js-sublime/import-js.py b/plugin/import-js-sublime/import-js.py index <HASH>..<HASH> 100644 --- a/plugin/import-js-sublime/import-js.py +++ b/plugin/import-js-sublime/import-js.py @@ -11,7 +11,6 @@ class ImportJsCommand(sublime_plugin.TextCommand): project_root = self.view.window().extract_variables()['folder'] proc = subprocess.Popen( importjs_path, - shell=True, cwd=project_root, env=environment, stdin=subprocess.PIPE,
Don't use shell=True when calling import-js This is considered bad practice since it opens up for script injection. Right now it's probably not a problem since we hardcode the command to run, but I'm about to add passing in the current word here, and we don't want `rm -rf /` to wipe out anything.
Galooshi_import-js
train
py
38ff4bf754fff829919204b72c397c089c4fc9d7
diff --git a/src/Robo/Plugins/Tasks/RemoteBackup.php b/src/Robo/Plugins/Tasks/RemoteBackup.php index <HASH>..<HASH> 100644 --- a/src/Robo/Plugins/Tasks/RemoteBackup.php +++ b/src/Robo/Plugins/Tasks/RemoteBackup.php @@ -63,7 +63,7 @@ abstract class RemoteBackup extends Remote ->addArgument($this->backupDir) ->onSuccess($this->getCommand()); - return (new Ssh($this->host, $this->auth)) + return $this->collectionBuilder()->taskSsh($this->host, $this->auth) ->remoteDirectory($this->cwd) ->timeout($this->timeout) ->exec((string) $command)
Fix ssh task initialization.
digipolisgent_robo-digipolis-helpers
train
php
5ec0641b2945705120a3bc8f84ee7d1713caaf16
diff --git a/src/Illuminate/Foundation/Console/Presets/Preset.php b/src/Illuminate/Foundation/Console/Presets/Preset.php index <HASH>..<HASH> 100644 --- a/src/Illuminate/Foundation/Console/Presets/Preset.php +++ b/src/Illuminate/Foundation/Console/Presets/Preset.php @@ -41,7 +41,11 @@ class Preset file_put_contents( base_path('package.json'), - json_encode($packages, JSON_PRETTY_PRINT) + preg_replace( + '/^( +?)\\1(?=[^ ])/m', + '$1', + json_encode($packages, JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT) . PHP_EOL + ) ); }
Maintain package.json formatting Preserve the Node.js formatting of 2 space indent and end of file new line when modifying the `package.json` file from PHP
laravel_framework
train
php
158ea1a6852c60d481eb10c3f6a29d0efb3513bf
diff --git a/docs/lib/url_generator.js b/docs/lib/url_generator.js index <HASH>..<HASH> 100644 --- a/docs/lib/url_generator.js +++ b/docs/lib/url_generator.js @@ -123,7 +123,7 @@ function normalizeNestedPaths (data) { return flatten(value, memo, parents.concat(key)) } - memo[key] = parents.concat(value).join("/") + memo[key] = parents.concat(value).join('/') return memo }, memo) @@ -135,7 +135,7 @@ function normalizeNestedPaths (data) { return expand(value, parents.concat(key)) } - return parents.concat(value).join("/") + return parents.concat(value).join('/') }) }
docs: eslint use single quotes
cypress-io_cypress
train
js
45dfd7eab7350fb946f1ce01fbb38f5f116f1e40
diff --git a/io/keepalive_writer.go b/io/keepalive_writer.go index <HASH>..<HASH> 100644 --- a/io/keepalive_writer.go +++ b/io/keepalive_writer.go @@ -69,6 +69,9 @@ func (w *keepAliveWriter) keepAlive() { } func (w *keepAliveWriter) Write(b []byte) (int, error) { + if len(b) == 0 { + return 0, nil + } w.writeLock.Lock() defer w.writeLock.Unlock() if w.withError { diff --git a/io/keepalive_writer_test.go b/io/keepalive_writer_test.go index <HASH>..<HASH> 100644 --- a/io/keepalive_writer_test.go +++ b/io/keepalive_writer_test.go @@ -58,3 +58,12 @@ func (s *S) TestKeepAliveWriterDoesntWriteMultipleNewlines(c *gocheck.C) { time.Sleep(120 * time.Millisecond) c.Check(buf.String(), gocheck.Equals, "xxx\n---\n---\n") } + +func (s *S) TestKeepAliveWriterEmptyContent(c *gocheck.C) { + var buf closableBuffer + w := NewKeepAliveWriter(&buf, 100*time.Millisecond, "---") + close(w.ping) + count, err := w.Write(nil) + c.Assert(err, gocheck.IsNil) + c.Assert(count, gocheck.Equals, 0) +}
io: fix KeepAliveWriter behavior on empty writes
tsuru_tsuru
train
go,go
681b33a0518daf3efb6747e8ad7bf9538a413ca2
diff --git a/scss/tests/functions/test_extra.py b/scss/tests/functions/test_extra.py index <HASH>..<HASH> 100644 --- a/scss/tests/functions/test_extra.py +++ b/scss/tests/functions/test_extra.py @@ -14,7 +14,7 @@ xfail = pytest.mark.xfail # would be nice to check the output, though that's a little tedious. def test_background_noise(): - libextra.background_noise(Number(0.5), Number(0.5), Number(100), BooleanValue(True)) + libextra.background_noise(Number(0.5), Number(0.5), Number(100), BooleanValue(True), color=ColorValue.from_name('green')) def test_background_brushed():
Fudge background-noise test into passing.
Kronuz_pyScss
train
py
d02e36872ded42e5863a307c367513ce03a3d191
diff --git a/mungegithub/mungers/submit-queue_test.go b/mungegithub/mungers/submit-queue_test.go index <HASH>..<HASH> 100644 --- a/mungegithub/mungers/submit-queue_test.go +++ b/mungegithub/mungers/submit-queue_test.go @@ -244,7 +244,7 @@ func fakeRunGithubE2ESuccess(ciStatus *github.CombinedStatus, e2ePass, unitPass } } -func TestMunge(t *testing.T) { +func TestSubmitQueue(t *testing.T) { runtime.GOMAXPROCS(runtime.NumCPU()) tests := []struct { @@ -560,7 +560,6 @@ func TestMunge(t *testing.T) { } w.WriteHeader(http.StatusOK) w.Write(data) - test.pr.Merged = boolPtr(true) }) sq := SubmitQueue{}
[submit queue] fix flaky test
kubernetes-retired_contrib
train
go
613fde41da6541e94bfa65096fcf19a4feef0efb
diff --git a/lib/Controller/MVCForm.php b/lib/Controller/MVCForm.php index <HASH>..<HASH> 100644 --- a/lib/Controller/MVCForm.php +++ b/lib/Controller/MVCForm.php @@ -101,6 +101,10 @@ class Controller_MVCForm extends AbstractController { $a=array(null=>'')+$a; } $form_field->setValueList($a); + } else { + if ($msg=$field->mandatory()){ + $form_field->setNotNull($msg); + } } if($field instanceof Field_Reference)$form_field->setModel($field->model);
Required was not setting not null validation rule
atk4_atk4
train
php
3e053da9b53d96e5df754d6068e08a6d6f370393
diff --git a/spec/graphlient/adapters/http/faraday_adapter_spec.rb b/spec/graphlient/adapters/http/faraday_adapter_spec.rb index <HASH>..<HASH> 100644 --- a/spec/graphlient/adapters/http/faraday_adapter_spec.rb +++ b/spec/graphlient/adapters/http/faraday_adapter_spec.rb @@ -104,7 +104,9 @@ describe Graphlient::Adapters::HTTP::FaradayAdapter do stub_request(:post, url).to_raise(Faraday::TimeoutError.new(Net::ReadTimeout.new(error_message))) end it 'raises a Graphlient Timeout' do - expect { client.schema }.to raise_error(Graphlient::Errors::TimeoutError, error_message) + expect { client.schema }.to raise_error(Graphlient::Errors::TimeoutError) { |error| + expect(error.message).to include(error_message) + } end end end
Net::ReadTimeout message has changed in Ruby <I> It now says: Net::ReadTimeout with "Message"
ashkan18_graphlient
train
rb
6215667b412c62fcfd3131e23f5123255d464e54
diff --git a/mt940/processors.py b/mt940/processors.py index <HASH>..<HASH> 100644 --- a/mt940/processors.py +++ b/mt940/processors.py @@ -156,7 +156,7 @@ def _parse_mt940_details(detail_str): elif key.startswith('2'): key20 = DETAIL_KEYS['20'] result[key20] = (result[key20] or '') + value - elif key in ('61', '62', '63'): + elif key in {'60', '61', '62', '63', '64', '65'}: key60 = DETAIL_KEYS['60'] result[key60] = (result[key60] or '') + value
added support for more "additional purpose" keys to fix #<I>
WoLpH_mt940
train
py
14900f3c727fce2dbb414e1b948aec63e3fae2d3
diff --git a/server/gpx.js b/server/gpx.js index <HASH>..<HASH> 100644 --- a/server/gpx.js +++ b/server/gpx.js @@ -3,9 +3,12 @@ var utils = require("./utils"); var _e = utils.escapeXml; function _dataToText(fields, data) { + if(fields.length == 1 && fields[0].name == "Description") + return data["Description"] || ""; + var text = [ ]; for(var i=0; i<fields.length; i++) { - text.push(fields[i].name + ": " + (data[fields[i]] || "")); + text.push(fields[i].name + ": " + (data[fields[i].name] || "")); } return text.join('\n\n'); }
Fix description of objects in GPX export (fixes #<I>) - Values were missing from description - If there is only the default field (Description), it is not prefixed by "Description: "
FacilMap_facilmap2
train
js
8b2a8b86b84061bd54879083c1007fe8723af374
diff --git a/lib/surrounded/context.rb b/lib/surrounded/context.rb index <HASH>..<HASH> 100644 --- a/lib/surrounded/context.rb +++ b/lib/surrounded/context.rb @@ -194,7 +194,7 @@ module Surrounded def map_roles(role_object_array) role_object_array.each do |role, object| if self.respond_to?("map_role_#{role}") - self.send("map_#{role}_role", object) + self.send("map_role_#{role}", object) else map_role(role, role_behavior_name(role), object) map_role_collection(role, role_behavior_name(role), object)
fix typo in custom map role method call this is currently undocumented/untested but will be addressed later
saturnflyer_surrounded
train
rb
1c282ea567d01a76b509ff48170b65c761db1e96
diff --git a/java-dns/google-cloud-dns/src/test/java/com/google/cloud/dns/DnsOptionsTest.java b/java-dns/google-cloud-dns/src/test/java/com/google/cloud/dns/DnsOptionsTest.java index <HASH>..<HASH> 100644 --- a/java-dns/google-cloud-dns/src/test/java/com/google/cloud/dns/DnsOptionsTest.java +++ b/java-dns/google-cloud-dns/src/test/java/com/google/cloud/dns/DnsOptionsTest.java @@ -29,6 +29,7 @@ public class DnsOptionsTest { @Test public void testInvalidTransport() { thrown.expect(IllegalArgumentException.class); - DnsOptions.newBuilder().setTransportOptions(EasyMock.createMock(TransportOptions.class)); + DnsOptions.newBuilder() + .setTransportOptions(EasyMock.<TransportOptions>createMock(TransportOptions.class)); } }
Preparing Easymock for a future upgrade. (#<I>) * Upgrading Easymock. * Reverting the upgrade of easymock, but keeping code changes.
googleapis_google-cloud-java
train
java
375031ca51116a1bb151e8d13930e895f13fe563
diff --git a/web/concrete/js/build/core/sitemap/search.js b/web/concrete/js/build/core/sitemap/search.js index <HASH>..<HASH> 100644 --- a/web/concrete/js/build/core/sitemap/search.js +++ b/web/concrete/js/build/core/sitemap/search.js @@ -104,7 +104,7 @@ height: '100%', href: CCM_TOOLS_PATH + '/sitemap_search_selector', modal: true, - title: ccmi18n_filemanager.title, + title: ccmi18n_sitemap.pageLocationTitle, onClose: function() { ConcreteEvent.fire('PageSelectorClose'); },
Sitemap title was mislabeled as File Manager Former-commit-id: <I>c<I>e2a<I>a<I>bd<I>f8a<I>eca6f6c4c Former-commit-id: 3f<I>c<I>cfb<I>bdcd8aefb1d6f3fb<I>ad
concrete5_concrete5
train
js
999916398f6853ffbc0b67e82247876ce51f5776
diff --git a/lib/bolt/plugin/terraform.rb b/lib/bolt/plugin/terraform.rb index <HASH>..<HASH> 100644 --- a/lib/bolt/plugin/terraform.rb +++ b/lib/bolt/plugin/terraform.rb @@ -82,11 +82,22 @@ module Bolt # Uses the Terraform CLI to pull remote state files def load_remote_statefile(opts) - stdout_str, stderr_str, = Open3.capture3('terraform state pull', chdir: opts['dir']) + dir = File.expand_path(opts['dir']) + + begin + stdout_str, stderr_str, status = Open3.capture3('terraform state pull', chdir: dir) + rescue Errno::ENOENT + reason = if File.directory?(dir) + "Could not find executable 'terraform'" + else + "Could not find directory '#{dir}'" + end + raise Bolt::Error.new(reason, 'FILE_ERROR') + end - unless stderr_str.empty? - err = stdout_str.split("\n").first - msg = "Could not pull Terraform remote state file for #{opts['dir']}: #{err}" + unless status.success? + err = stdout_str + stderr_str + msg = "Could not pull Terraform remote state file for #{opts['dir']}:\n#{err}" raise Bolt::Error.new(msg, 'bolt/terraform-state-error') end
Add error handling for reading remote state files This wraps the 'terraform state pull' command in a rescue block to handle errors raised when the dir or terraform are missing.
puppetlabs_bolt
train
rb
e5927cd3ec824198e828aa0b36346074294ff459
diff --git a/src/Storage/migrations/2018_08_08_100000_create_telescope_entries_table.php b/src/Storage/migrations/2018_08_08_100000_create_telescope_entries_table.php index <HASH>..<HASH> 100644 --- a/src/Storage/migrations/2018_08_08_100000_create_telescope_entries_table.php +++ b/src/Storage/migrations/2018_08_08_100000_create_telescope_entries_table.php @@ -9,7 +9,7 @@ class CreateTelescopeEntriesTable extends Migration /** * The database schema. * - * @var Schema + * @var \lluminate\Support\Facades\Schema */ protected $schema; @@ -20,9 +20,17 @@ class CreateTelescopeEntriesTable extends Migration */ public function __construct() { - $this->schema = Schema::connection( - config('telescope.storage.database.connection') - ); + $this->schema = Schema::connection($this->getConnection()); + } + + /** + * Get the migration connection name. + * + * @return string|null + */ + public function getConnection() + { + return config('telescope.storage.database.connection'); } /**
Use getConnection method in Migrations
laravel_telescope
train
php
95b14d2f29485503313c6718cd8727cd68a778da
diff --git a/ayrton/__init__.py b/ayrton/__init__.py index <HASH>..<HASH> 100755 --- a/ayrton/__init__.py +++ b/ayrton/__init__.py @@ -127,7 +127,7 @@ class Globals (dict): return ans -def main (file=None, script=None, **kwargs): +def main (script=None, file=None, **kwargs): if script is None and file is not None: script= open (file).read () else:
* swapped param order so tests keep running.
StyXman_ayrton
train
py
d85a0bea1160221fdb5be6c3c1a2784fbc8c46a3
diff --git a/h2o-algos/src/main/java/hex/tree/gbm/GBM.java b/h2o-algos/src/main/java/hex/tree/gbm/GBM.java index <HASH>..<HASH> 100755 --- a/h2o-algos/src/main/java/hex/tree/gbm/GBM.java +++ b/h2o-algos/src/main/java/hex/tree/gbm/GBM.java @@ -259,7 +259,7 @@ public class GBM extends SharedTree<GBMModel,GBMModel.GBMParameters,GBMModel.GBM for( int row = 0; row < wk._len; row++) { if( ys.isNA(row) ) continue; double f = tr.atd(row) + offset.atd(row); - double y = ys.at8(row); + double y = ys.atd(row); if( _parms._distribution == Distribution.Family.multinomial ) { double weight = hasWeightCol() ? chk_weight(chks).atd(row) : 1; double sum = score1(chks, weight,0.0 /*offset not used for multiclass*/,fs,row);
PUBDEV-<I>: Fix a major bug in GBM Regression: was casting the response to a long instead of double... (was ok for classification).
h2oai_h2o-3
train
java
dc5d65c5c056c9a77ee7845420a255d992c59548
diff --git a/metrics-core/src/main/java/com/yammer/metrics/core/VirtualMachineMetrics.java b/metrics-core/src/main/java/com/yammer/metrics/core/VirtualMachineMetrics.java index <HASH>..<HASH> 100644 --- a/metrics-core/src/main/java/com/yammer/metrics/core/VirtualMachineMetrics.java +++ b/metrics-core/src/main/java/com/yammer/metrics/core/VirtualMachineMetrics.java @@ -241,8 +241,7 @@ public class VirtualMachineMetrics { final long[] threadIds = getThreadMXBean().findDeadlockedThreads(); if (threadIds != null) { final Set<String> threads = new HashSet<String>(); - final ThreadInfo[] infos = getThreadMXBean().getThreadInfo(threadIds, 100); - for (ThreadInfo info : infos) { + for (ThreadInfo info : getThreadMXBean().getThreadInfo(threadIds, 100)) { final StringBuilder stackTrace = new StringBuilder(); for (StackTraceElement element : info.getStackTrace()) { stackTrace.append("\t at ").append(element.toString()).append('\n');
Inline thread info in VirtualMachineMetrics.
dropwizard_metrics
train
java
87a0221f253e3045175836f3bbb89c671f486d1b
diff --git a/lib/payload/parser.rb b/lib/payload/parser.rb index <HASH>..<HASH> 100755 --- a/lib/payload/parser.rb +++ b/lib/payload/parser.rb @@ -1,6 +1,4 @@ #!/usr/bin/env ruby -require 'ezmq' -require 'json' require_relative '../queue-helper' def parse(payload = '', of_format:) @@ -10,17 +8,16 @@ def parse(payload = '', of_format:) require_relative lib_file Object.const_get("#{of_format.capitalize}Payload").new payload else + puts "Dropping bad format: #{of_format}" nil end end QueueHelper.wait_for_queue('raw-payload') do |data| - unless data.nil? - puts "Parsing: #{data}" - payload = parse data['payload'], of_format: data['format'] - if payload - hash = { payload: payload.to_hash, job_name: data['job_name'] } - QueueHelper.enqueue hash, to: 'parsed-payload' - end + puts "Parsing: #{data}" + payload = parse data['payload'], of_format: data['format'] + if payload + hash = { payload: payload.to_hash, job_name: data['job_name'] } + QueueHelper.enqueue hash, to: 'parsed-payload' end end
Further clean up of payload parser
JScott_robot_sweatshop
train
rb
6e262da2b8b5a596d4d5c749d3699babf36eabf9
diff --git a/agent.go b/agent.go index <HASH>..<HASH> 100644 --- a/agent.go +++ b/agent.go @@ -14,6 +14,7 @@ import ( "os/exec" "os/signal" "runtime" + "runtime/debug" "sync" "syscall" "time" @@ -441,6 +442,9 @@ func initAgentAsInit() error { } func init() { + // Force full stacktrace on internal error + debug.SetTraceback("system") + if len(os.Args) > 1 && os.Args[1] == "init" { runtime.GOMAXPROCS(1) runtime.LockOSThread()
main: Display full stacktrace on internal error Enable a full stacktrace display on internal error as an aid to debugging. Fixes #<I>.
kata-containers_agent
train
go
9cf425641be4682788c7e1991fa80c2e3870e6cc
diff --git a/db/postgres.js b/db/postgres.js index <HASH>..<HASH> 100644 --- a/db/postgres.js +++ b/db/postgres.js @@ -39,7 +39,7 @@ module.exports = function (settings, collection) { }) }, find: function (query, offset, limit, orderby) { - var pgQuery = mongoToPostgres('data', query) + var pgQuery = mongoToPostgres('data', query||{}) return new Promise(function (resolve, reject) { pg.connect(settings.postgresql_uri, function (err, client, done) { if (err) {
bugfix to not crash api-calls on empty mongoquery query-var
thomas4019_expressa
train
js
0a48a747fb72f068ff737992c423dd470cadca3c
diff --git a/src/Eloquent/Model.php b/src/Eloquent/Model.php index <HASH>..<HASH> 100644 --- a/src/Eloquent/Model.php +++ b/src/Eloquent/Model.php @@ -109,7 +109,7 @@ abstract class Model extends Eloquent } } - return $this->with($relations); + $builder->with($relations); } /**
Apply with to buider instead of model
fuzz-productions_laravel-api-data
train
php
af3bb8737b0f686ab9873f81c2dc009c47bfe715
diff --git a/src/Event/BeforeCommandExecuteEvent.php b/src/Event/BeforeCommandExecuteEvent.php index <HASH>..<HASH> 100644 --- a/src/Event/BeforeCommandExecuteEvent.php +++ b/src/Event/BeforeCommandExecuteEvent.php @@ -29,6 +29,22 @@ class BeforeCommandExecuteEvent extends Event const RETURN_CODE_DISABLED = 113; /** + * The active application. + * + * @var Application + * @since __DEPLOY_VERSION__ + */ + private $application; + + /** + * The command being executed. + * + * @var CommandInterface + * @since __DEPLOY_VERSION__ + */ + private $command; + + /** * Flag indicating the command is enabled * * @var boolean @@ -48,8 +64,8 @@ class BeforeCommandExecuteEvent extends Event { parent::__construct(ConsoleEvents::BEFORE_COMMAND_EXECUTE); - $this->setArgument('application', $application); - $this->setArgument('command', $command); + $this->application = $application; + $this->command = $command; if ($command) { @@ -90,7 +106,7 @@ class BeforeCommandExecuteEvent extends Event */ public function getApplication(): Application { - return $this->getArgument('application'); + return $this->application; } /** @@ -102,7 +118,7 @@ class BeforeCommandExecuteEvent extends Event */ public function getCommand() { - return $this->getArgument('command'); + return $this->command; } /**
Event arguments are mutable, make the app and command event class properties instead
joomla-framework_console
train
php
2c240563741c58162ccdd21edc7b3732026cd433
diff --git a/acme/crypto.go b/acme/crypto.go index <HASH>..<HASH> 100644 --- a/acme/crypto.go +++ b/acme/crypto.go @@ -63,6 +63,7 @@ func GetOCSPForCert(bundle []byte) ([]byte, int, error) { if err != nil { return nil, OCSPUnknown, err } + defer resp.Body.Close() issuerBytes, err := ioutil.ReadAll(resp.Body) if err != nil { @@ -96,6 +97,7 @@ func GetOCSPForCert(bundle []byte) ([]byte, int, error) { if err != nil { return nil, OCSPUnknown, err } + defer req.Body.Close() ocspResBytes, err := ioutil.ReadAll(req.Body) ocspRes, err := ocsp.ParseResponse(ocspResBytes, issuerCert)
Close leaky file descriptors
go-acme_lego
train
go
69928a4ac20b2317f9c7768102e5168e8514f80c
diff --git a/example/src/EmojiList.js b/example/src/EmojiList.js index <HASH>..<HASH> 100644 --- a/example/src/EmojiList.js +++ b/example/src/EmojiList.js @@ -39,9 +39,8 @@ export default class EmojiList extends Component { break; case "Enter": case "Tab": - const id = this.filtered[this.state.option]; - const { emoji } = gemoji.name[id]; - this.props.onChange(`${emoji} `); + const { char } = this.filtered[this.state.option]; + this.props.onChange(`${char} `); break; case "ArrowUp": e.preventDefault();
Fixed bug after change to way filtered emojis are stored
danrpts_react-cursor-dropdown
train
js
22c17347df295838fdda216770f3166a350e24a4
diff --git a/lib/components/user/stacked-pane-display.js b/lib/components/user/stacked-pane-display.js index <HASH>..<HASH> 100644 --- a/lib/components/user/stacked-pane-display.js +++ b/lib/components/user/stacked-pane-display.js @@ -8,6 +8,7 @@ import { PageHeading, StackedPaneContainer } from './styled' * This component handles the flow between screens for new OTP user accounts. */ const StackedPaneDisplay = ({ onCancel, paneSequence, title }) => { + // Create indicator of if cancel button was clicked so that child components can know const [isBeingCanceled, updateBeingCanceled] = useState(false) return (
refactor(trip-page): clarify use of new state variable
opentripplanner_otp-react-redux
train
js
dd4be5f7535e13a7362bb71870acebd03a9cf88e
diff --git a/library/Garp/File/Storage/Local.php b/library/Garp/File/Storage/Local.php index <HASH>..<HASH> 100755 --- a/library/Garp/File/Storage/Local.php +++ b/library/Garp/File/Storage/Local.php @@ -11,6 +11,8 @@ class Garp_File_Storage_Local implements Garp_File_Storage_Protocol { protected $_path; + protected $_ssl; + const PERMISSIONS = 0774; @@ -19,6 +21,7 @@ class Garp_File_Storage_Local implements Garp_File_Storage_Protocol { $this->_docRoot = APPLICATION_PATH."/../public"; $this->_path = $path; $this->_domain = $config->domain; + $this->_ssl = $config->ssl ? true : false; } @@ -34,6 +37,9 @@ class Garp_File_Storage_Local implements Garp_File_Storage_Protocol { /** Fetches the url to the file, suitable for public access on the web. */ public function getUrl($filename) { + if ($this->_ssl) { + return 'https://'.$this->_domain.$this->_path.'/'.$filename; + } return 'http://'.$this->_domain.$this->_path.'/'.$filename; }
Added SSL (https) support to Garp_File_Storage_Local
grrr-amsterdam_garp3
train
php
fa6dabf8762da42ce02bf7f484bd6b2621e479d9
diff --git a/daemon/logger/syslog/syslog.go b/daemon/logger/syslog/syslog.go index <HASH>..<HASH> 100644 --- a/daemon/logger/syslog/syslog.go +++ b/daemon/logger/syslog/syslog.go @@ -77,7 +77,7 @@ func rfc5424formatterWithAppNameAsTag(p syslog.Priority, hostname, tag, content // for multiple syntaxes, there are further restrictions in rfc5424, i.e., the maximum // resolution is limited to "TIME-SECFRAC" which is 6 (microsecond resolution) func rfc5424microformatterWithAppNameAsTag(p syslog.Priority, hostname, tag, content string) string { - timestamp := time.Now().Format("2006-01-02T15:04:05.999999Z07:00") + timestamp := time.Now().Format("2006-01-02T15:04:05.000000Z07:00") pid := os.Getpid() msg := fmt.Sprintf("<%d>%d %s %s %s %d %s - %s", p, 1, timestamp, hostname, tag, pid, tag, content)
Add zero padding for RFC<I> syslog format This fix tries to address the issue raised in <I> where current RFC<I> sys log format does not zero pad the time (trailing zeros are removed) This fix apply the patch to fix the issue. This fix fixes <I>.
moby_moby
train
go
0fa818ad42749197c7ca05d46f287e92c6551b4d
diff --git a/lib/fog/storage/models/aws/file.rb b/lib/fog/storage/models/aws/file.rb index <HASH>..<HASH> 100644 --- a/lib/fog/storage/models/aws/file.rb +++ b/lib/fog/storage/models/aws/file.rb @@ -113,7 +113,7 @@ module Fog options['Content-MD5'] = content_md5 if content_md5 options['Content-Type'] = content_type if content_type options['Expires'] = expires if expires - options.merge(metadata) + options.merge!(metadata) options['x-amz-storage-class'] = storage_class if storage_class data = connection.put_object(directory.key, key, body, options)
Patch for AWS S3 Metadata problem
fog_fog
train
rb
31bfaf58475a7e1d5d8088d29bc2d87cd260461d
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -18,7 +18,7 @@ setup( install_requires=[ "requests>=2.2.1", "six>=1.8.0", - "simplejson>=3.4.0;python_version<'2.6'" + "simplejson>=3.4.0;python_version<'2.6'", ] packages=find_packages(), classifiers=[
Added missing comma.
twilio_authy-python
train
py
d510b6d7fcd6b402f484e53dfab8c550d4d257ae
diff --git a/projects/age.py b/projects/age.py index <HASH>..<HASH> 100644 --- a/projects/age.py +++ b/projects/age.py @@ -36,14 +36,16 @@ traits_template = ''' <style> img{ float:left; - margin-top: 10px; - margin-bottom: 10px; - margin-right: 15px; - margin-left: 15px; + border-radius: 5px; + margin-top: 5px; + margin-bottom: 5px; + margin-right: 10px; + margin-left: 10px; width: 180; height: 90; } #box{ + border-radius: 50%; width:50px; height:50px; }
[projects] Add rounded corners for box
tanghaibao_jcvi
train
py
511ab1469f450c351a43a8f13a5f87f5c42b502f
diff --git a/Source/com/drew/metadata/mov/media/QuickTimeSoundHandler.java b/Source/com/drew/metadata/mov/media/QuickTimeSoundHandler.java index <HASH>..<HASH> 100644 --- a/Source/com/drew/metadata/mov/media/QuickTimeSoundHandler.java +++ b/Source/com/drew/metadata/mov/media/QuickTimeSoundHandler.java @@ -70,6 +70,8 @@ public class QuickTimeSoundHandler extends QuickTimeMediaHandler<QuickTimeSoundD @Override protected void processTimeToSample(@NotNull SequentialReader reader, @NotNull Atom atom, QuickTimeContext context) throws IOException { - directory.setDouble(QuickTimeSoundDirectory.TAG_AUDIO_SAMPLE_RATE, context.timeScale); + if (context.timeScale != null) { + directory.setDouble(QuickTimeSoundDirectory.TAG_AUDIO_SAMPLE_RATE, context.timeScale); + } } }
Prevent exception due to null time scale Contributes to drewnoakes/metadata-extractor#<I>
drewnoakes_metadata-extractor
train
java
e108129e5888989a624df5dff260d48e40b82349
diff --git a/views.py b/views.py index <HASH>..<HASH> 100644 --- a/views.py +++ b/views.py @@ -19,27 +19,31 @@ """Community Module Blueprint.""" -from __future__ import absolute_import +from __future__ import absolute_import, unicode_literals + +from flask import Blueprint, abort, flash, jsonify, redirect, \ + render_template, request, url_for -from flask import render_template, abort, request, flash, \ - redirect, url_for, jsonify, Blueprint from flask_breadcrumbs import register_breadcrumb + from flask_login import current_user, login_required + from flask_menu import register_menu from invenio.base.decorators import wash_arguments +from invenio.base.globals import cfg from invenio.base.i18n import _ from invenio.ext.cache import cache from invenio.ext.principal import permission_required from invenio.ext.sqlalchemy import db from invenio.ext.sslify import ssl_required -from invenio.utils.pagination import Pagination from invenio.modules.formatter import format_record +from invenio.utils.pagination import Pagination -from .forms import CommunityForm, EditCommunityForm, DeleteCommunityForm, SearchForm +from .forms import CommunityForm, DeleteCommunityForm, EditCommunityForm, \ + SearchForm from .models import Community, FeaturedCommunity from .signals import curate_record -from invenio.base.globals import cfg blueprint = Blueprint(
global: unicode literals for views * Forces unicode literals on views. (addresses #<I>) * PEP8/<I> code style improvements.
inveniosoftware_invenio-communities
train
py
d580ca29a0e9468e11d2546a40887147342b7f82
diff --git a/src/configure-webpack/loaders/javascript.js b/src/configure-webpack/loaders/javascript.js index <HASH>..<HASH> 100644 --- a/src/configure-webpack/loaders/javascript.js +++ b/src/configure-webpack/loaders/javascript.js @@ -26,7 +26,13 @@ export default { // Replaces require("babel-polyfill") // with only the polyfills you need // for the target browsers - useBuiltIns: true + useBuiltIns: true, + targets: { + // Unfortunately we are bound to what UglifyJS + // currently supports as language features + // https://github.com/babel/babel-preset-env#targetsuglify + uglify: true + } }], require.resolve('babel-preset-react'), require.resolve('babel-preset-stage-3')
Target UglifyJS to be sure we can produce builds 👮
saguijs_sagui
train
js
25f220054ce34d4fa41843201ed06770ff241a9e
diff --git a/rabbitmq/check.py b/rabbitmq/check.py index <HASH>..<HASH> 100644 --- a/rabbitmq/check.py +++ b/rabbitmq/check.py @@ -353,8 +353,7 @@ class RabbitMQ(AgentCheck): for conn in data: if conn['vhost'] in vhosts: stats[conn['vhost']] += 1 - if conn.get('state'): - connection_states[conn['state']] += 1 + connection_states[conn.get('state', 'direct')] += 1 for vhost, nb_conn in stats.iteritems(): self.gauge('rabbitmq.connections', nb_conn, tags=['%s_vhost:%s' % (TAG_PREFIX, vhost)] + custom_tags)
Modified state key check If 'state' does not exists, it would imply a 'direct' type connection and not a 'network' type, therefore create/name the connection state to 'direct' to account for it instead of skipping the metric entirely.
DataDog_integrations-core
train
py
aa929dedb553949149130885b9d6d7cf8d8f5db6
diff --git a/js/huobi.js b/js/huobi.js index <HASH>..<HASH> 100644 --- a/js/huobi.js +++ b/js/huobi.js @@ -770,7 +770,7 @@ module.exports = class huobi extends Exchange { } async fetchTime (params = {}) { - const response = await this.publicGetCommonTimestamp (params); + const response = await this.spotPublicGetV1CommonTimestamp (params); return this.safeInteger (response, 'data'); }
huobi.js fetchTime switched to new endpoints
ccxt_ccxt
train
js
9cdd13ff8bf2e948fc6149b48a035fc7c5a3fd86
diff --git a/ace.go b/ace.go index <HASH>..<HASH> 100644 --- a/ace.go +++ b/ace.go @@ -30,7 +30,6 @@ func New() *Ace { c := &C{} c.index = -1 c.Writer = &c.writercache - c.Data = make(map[string]interface{}) return c } return a diff --git a/context.go b/context.go index <HASH>..<HASH> 100644 --- a/context.go +++ b/context.go @@ -38,6 +38,7 @@ func (a *Ace) CreateContext(w http.ResponseWriter, r *http.Request) *C { c.Request = r c.context = nil c.index = -1 + c.Data = make(map[string]interface{}) if a.render != nil { c.Render = a.render }
fix bug data with value push back to the pool
plimble_ace
train
go,go
39d75606a4cbec14d6f9f9d4e295dad4e3711682
diff --git a/github/github.go b/github/github.go index <HASH>..<HASH> 100644 --- a/github/github.go +++ b/github/github.go @@ -434,6 +434,9 @@ func (e *Error) Error() string { // the 200 range. API error responses are expected to have either no response // body, or a JSON response body that maps to ErrorResponse. Any other // response body will be silently ignored. +// +// The error type will be *RateLimitError for rate limit exceeded errors, +// and *TwoFactorAuthError for two-factor authentication errors. func CheckResponse(r *http.Response) error { if c := r.StatusCode; 200 <= c && c <= 299 { return nil
Document specific errors returned by CheckResponse.
google_go-github
train
go
2c0751464d1e653694a1386fd1f296910ace8c51
diff --git a/src/lib/isDomSelector.js b/src/lib/isDomSelector.js index <HASH>..<HASH> 100644 --- a/src/lib/isDomSelector.js +++ b/src/lib/isDomSelector.js @@ -4,6 +4,14 @@ function isDomSelector(str) { } try { + if (!document) { + throw new Error('avoriaz must be run in a browser environment like PhantomJS, jsdom or chrome'); + } + } catch (error) { + throw new Error('avoriaz must be run in a browser environment like PhantomJS, jsdom or chrome'); + } + + try { document.querySelector(str); return true; } catch (error) {
Throw error - avoriaz must be run in a browser - if document does not exist
eddyerburgh_avoriaz
train
js
adb45865309afb5124dbca46d41e491417f34da0
diff --git a/shared/profile/showcased-team-info/index.js b/shared/profile/showcased-team-info/index.js index <HASH>..<HASH> 100644 --- a/shared/profile/showcased-team-info/index.js +++ b/shared/profile/showcased-team-info/index.js @@ -28,7 +28,7 @@ const TeamInfo = (props: Props) => ( {props.openTeam && 'OPEN '}TEAM </Text> - <Text type="BodySmall">{props.memberCount} members</Text> + <Text type="BodySmall">{props.memberCount + ' member' + (props.memberCount !== 1 ? 's' : '')}</Text> <Text type={isMobile ? 'Body' : 'BodySmall'} style={styleDescription}> {props.description}
Show 1 member instead of 1 members on profile showcased team (#<I>)
keybase_client
train
js
cf84683ba50660f3465ce93aad52b395cc779839
diff --git a/packages/ember-runtime/lib/mixins/enumerable.js b/packages/ember-runtime/lib/mixins/enumerable.js index <HASH>..<HASH> 100644 --- a/packages/ember-runtime/lib/mixins/enumerable.js +++ b/packages/ember-runtime/lib/mixins/enumerable.js @@ -332,7 +332,7 @@ export default Mixin.create({ @param {Function} callback The callback to execute @param {Object} [target] The target object to use @return {Array} The mapped array. - @private + @public */ map(callback, target) { var ret = Ember.A();
[DOC Release] Mark Enumerable.map() as public [ci skip]
emberjs_ember.js
train
js
531fb7e19696ff9fc616fc0955d96a3dfcd3afdb
diff --git a/lxd/db/networks.go b/lxd/db/networks.go index <HASH>..<HASH> 100644 --- a/lxd/db/networks.go +++ b/lxd/db/networks.go @@ -305,13 +305,6 @@ const ( NetworkTypeBridge NetworkType = iota // Network type bridge. ) -// GetNetwork returns the network with the given name. -// -// The network must be in the created stated, not pending. -func (c *Cluster) GetNetwork(name string) (int64, *api.Network, error) { - return c.getNetwork(name, true) -} - // GetNetworkInAnyState returns the network with the given name. // // The network can be in any state.
lxd/db/networks: Removes unused GetNetwork
lxc_lxd
train
go
aec66b0db717da68035d5e4ba8e800485e68a475
diff --git a/mwparserfromhell/parser/tokenizer.py b/mwparserfromhell/parser/tokenizer.py index <HASH>..<HASH> 100644 --- a/mwparserfromhell/parser/tokenizer.py +++ b/mwparserfromhell/parser/tokenizer.py @@ -183,7 +183,7 @@ class Tokenizer(object): while True: this = self._read() if this not in self.SENTINELS: - self._write(self._read(), text=True) + self._write(this, text=True) self._head += 1 continue if this is self.END:
Missed another call (<I> seconds -> <I> seconds for 1,<I>,<I> chars).
earwig_mwparserfromhell
train
py
8cf7a6f909490eafa1e1d0887761dfb4a538e400
diff --git a/lib/wsdl.js b/lib/wsdl.js index <HASH>..<HASH> 100644 --- a/lib/wsdl.js +++ b/lib/wsdl.js @@ -976,7 +976,6 @@ function open_wsdl(uri, options, callback) { }) } else { - console.log("requesting:", uri); http.request(uri, null /* options */, function (err, response, definition) { if (err) { callback(err);
didn't mean to put that in the pull request. sorry...
vpulim_node-soap
train
js
8dcfcdb72dff763ef9907f36fbbad32975061d6f
diff --git a/src/main/java/com/simpligility/maven/plugins/android/AndroidSdk.java b/src/main/java/com/simpligility/maven/plugins/android/AndroidSdk.java index <HASH>..<HASH> 100644 --- a/src/main/java/com/simpligility/maven/plugins/android/AndroidSdk.java +++ b/src/main/java/com/simpligility/maven/plugins/android/AndroidSdk.java @@ -262,9 +262,18 @@ public class AndroidSdk private BuildToolInfo getBuildToolInfo() { + //First we use the build tools specified in the pom file if ( buildToolsVersion != null && !buildToolsVersion.equals( "" ) ) { - return sdkManager.getBuildTool( FullRevision.parseRevision( buildToolsVersion ) ); + BuildToolInfo buildToolInfo = sdkManager.getBuildTool( FullRevision.parseRevision( buildToolsVersion ) ); + if ( buildToolInfo != null ) + { + return buildToolInfo; + } + //Since we cannot find the build tool specified by the user we make it fail + // instead of using the latest build tool version + throw new InvalidSdkException( "Invalid SDK: Build-tools " + buildToolsVersion + " not found." + + " Check your Android SDK to install the build tools " + buildToolsVersion ); } if ( androidTarget != null )
Add comments & an exception when the build tools specified in the pom is not found
simpligility_android-maven-plugin
train
java
4d8392fc44b64fbac5c103d9b8c12fa9d88dfb7a
diff --git a/devices/philips.js b/devices/philips.js index <HASH>..<HASH> 100644 --- a/devices/philips.js +++ b/devices/philips.js @@ -268,7 +268,7 @@ module.exports = [ ota: ota.zigbeeOTA, }, { - zigbeeModel: ['LLC012', 'LLC011'], + zigbeeModel: ['LLC012', 'LLC011', 'LLC013'], model: '7299760PH', vendor: 'Philips', description: 'Hue Bloom',
Add LLC<I> to <I>PH (#<I>)
Koenkk_zigbee-shepherd-converters
train
js
59aa37d708547bbaf0d94b30c74ebc81a8fd7b8e
diff --git a/src/cattrs/gen.py b/src/cattrs/gen.py index <HASH>..<HASH> 100644 --- a/src/cattrs/gen.py +++ b/src/cattrs/gen.py @@ -36,7 +36,11 @@ class AttributeOverride: omit: bool = False # Omit the field completely. -def override(omit_if_default=None, rename=None, omit: bool = False): +def override( + omit_if_default: Optional[bool] = None, + rename: Optional[str] = None, + omit: bool = False, +): return AttributeOverride(omit_if_default=omit_if_default, rename=rename, omit=omit) @@ -50,7 +54,7 @@ def make_dict_unstructure_fn( converter: "BaseConverter", _cattrs_omit_if_default: bool = False, _cattrs_use_linecache: bool = True, - **kwargs, + **kwargs: AttributeOverride, ) -> Callable[[T], Dict[str, Any]]: """ Generate a specialized dict unstructuring function for an attrs class or a
fix: missing annotations from gen and make_unstructure_dict_fn
Tinche_cattrs
train
py
e7128bceee815155ade476227480b213ef50b6f0
diff --git a/parsl/app/bash.py b/parsl/app/bash.py index <HASH>..<HASH> 100644 --- a/parsl/app/bash.py +++ b/parsl/app/bash.py @@ -6,6 +6,8 @@ from parsl.app.futures import DataFuture from parsl.app.app import AppBase from parsl.dataflow.dflow import DataFlowKernelLoader +from functools import update_wrapper + logger = logging.getLogger(__name__) @@ -150,7 +152,9 @@ class BashApp(AppBase): else: dfk = self.data_flow_kernel - app_fut = dfk.submit(wrap_error(remote_side_bash_executor), self.func, *args, + + app_fut = dfk.submit(wrap_error(update_wrapper(remote_side_bash_executor, self.func)), + self.func, *args, executors=self.executors, fn_hash=self.func_hash, cache=self.cache,
Update the remote_side_bash_executor wrapper This will make bash apps be named after the function they are based off of rather than the `remote_side_bash_executor` which wraps them. Fixes #<I>.
Parsl_parsl
train
py
50cd8c6f8aa75af7261327008ea87ae85297c774
diff --git a/libs/xmlforms/formreport.js b/libs/xmlforms/formreport.js index <HASH>..<HASH> 100644 --- a/libs/xmlforms/formreport.js +++ b/libs/xmlforms/formreport.js @@ -9,6 +9,11 @@ exports.fetchAndParseReports = function(db, pgsql) { return db.query(pgsql.fetchMissingReportContents()).then(function (data) { var dataset = {}; Object.keys(data).forEach(function (i) { + // skip docs with empty XML and skip contacts reports + if (!data[i].xml || data[i].xml.slice(0,5) === '<data') { + return; + } + // extract XML and add a root tag around it to reuse existing code // which expects wrapper var flatxml = parseInstanceXML('<instance>' + data[i].xml + '</instance>');
skip contact data records as they are parsed differently
medic_couch2pg
train
js
2e2926d8442ac13b01eb9ebb0a861e9e92da6ca7
diff --git a/test/unit/credit_card_test.rb b/test/unit/credit_card_test.rb index <HASH>..<HASH> 100644 --- a/test/unit/credit_card_test.rb +++ b/test/unit/credit_card_test.rb @@ -193,6 +193,7 @@ class CreditCardTest < Test::Unit::TestCase def test_should_correctly_identify_card_brand assert_equal 'visa', CreditCard.brand?('4242424242424242') assert_equal 'american_express', CreditCard.brand?('341111111111111') + assert_equal 'master', CreditCard.brand?('5105105105105100') (222100..272099).each {|bin| assert_equal 'master', CreditCard.brand?(bin.to_s + '1111111111'), "Failed with BIN #{bin}"} assert_nil CreditCard.brand?('') end
added test for MasterCard legacy BIN range Closes #<I>.
activemerchant_active_merchant
train
rb
9c2fffb522c755a6ab1e097b8831dd18d314ea17
diff --git a/src/pycdlib/headervd.py b/src/pycdlib/headervd.py index <HASH>..<HASH> 100644 --- a/src/pycdlib/headervd.py +++ b/src/pycdlib/headervd.py @@ -547,8 +547,8 @@ class PrimaryVolumeDescriptor(HeaderVolumeDescriptor): if unused4 != 0: raise pycdlibexception.PyCdlibException("data in 4th unused field not zero") # According to Ecma-119, the last 653 bytes of the PVD should be all 0. - if unused5 != b'\x00'*653: - raise pycdlibexception.PyCdlibException("data in 5th unused field not zero") + # However, we have seen ISOs in the wild that do not follow this, so + # relax the check. # Check to make sure that the little-endian and big-endian versions # of the parsed data agree with each other.
Allow non-zero end of PVD. The Tribes Vengeance ISO disk 1 violates this, so just relax the requirement.
clalancette_pycdlib
train
py
d8397b4c72dea57f6a00a80b00aecef211aec0b4
diff --git a/index.js b/index.js index <HASH>..<HASH> 100644 --- a/index.js +++ b/index.js @@ -19,7 +19,7 @@ function errorCB (err) { module.exports = function (_, opts, keys, path) { //_ was legacy db. removed that, but for backwards compatibilty reasons do not change interface - path = path || _db.location + if(!path) throw new Error('path must be provided') keys = keys || ssbKeys.generate() @@ -149,3 +149,4 @@ module.exports = function (_, opts, keys, path) { return db } +
remove _db, and throw error if path not provided
ssbc_ssb-db
train
js
738de8e754387c16a41bb233632d267d9567c87a
diff --git a/src/Esperance/Assertion.php b/src/Esperance/Assertion.php index <HASH>..<HASH> 100644 --- a/src/Esperance/Assertion.php +++ b/src/Esperance/Assertion.php @@ -214,7 +214,7 @@ class Assertion private function expect($subject) { - return new self($subject); + return new static($subject); } private function i($obj)
Fix to use late-static-binding on expect() method.
esperance_esperance
train
php
eb500aa0f90f46ed2df3bebd79d071e88f9f3227
diff --git a/src/org/mozilla/javascript/ScriptableObject.java b/src/org/mozilla/javascript/ScriptableObject.java index <HASH>..<HASH> 100644 --- a/src/org/mozilla/javascript/ScriptableObject.java +++ b/src/org/mozilla/javascript/ScriptableObject.java @@ -2555,9 +2555,9 @@ public abstract class ScriptableObject implements Scriptable, Serializable, public Object get(Object key) { Object value = null; if (key instanceof String) { - value = getImpl((String) key, 0, this); + value = get((String) key, this); } else if (key instanceof Number) { - value = getImpl(null, ((Number) key).intValue(), this); + value = get(((Number) key).intValue(), this); } if (value == Scriptable.NOT_FOUND || value == Undefined.instance) { return null;
Forward calls to Map.get() to Scriptable.get() instead of ScriptableObject.getImp() so it will actually work in subclasses that override ScriptableObject.get().
mozilla_rhino
train
java
a8ad4af439d961527390d6a7c8fb4bc4c3b79afe
diff --git a/js/kucoin.js b/js/kucoin.js index <HASH>..<HASH> 100644 --- a/js/kucoin.js +++ b/js/kucoin.js @@ -1007,6 +1007,7 @@ module.exports = class kucoin extends Exchange { } price = trade[2]; amount = trade[3]; + id = trade[4]; } else { timestamp = this.safeValue (trade, 'createdAt'); order = this.safeString (trade, 'orderOid');
Fix for ccxt #<I> Fix for missing Trade ID on Kucoin
ccxt_ccxt
train
js
7b5e9abc65259b86a9e52bee1b932df10d868f10
diff --git a/mvc/models/Model.php b/mvc/models/Model.php index <HASH>..<HASH> 100644 --- a/mvc/models/Model.php +++ b/mvc/models/Model.php @@ -164,7 +164,11 @@ abstract class Model extends FormModel implements IModel if (empty($this->cacheRelations[$name])) { $sql = new Query((new ConnectionInjector)->build()); - $sql->addWhere('`m`.`'.$relation['On'][1].'`=:'.$relation['On'][0]); + if ((new ConnectionInjector)->build()->getDriverType() === 'pgsql') { + $sql->addWhere('"m"."' . $relation['On'][1] . '"=:' . $relation['On'][0]); + } else { + $sql->addWhere('`m`.`' . $relation['On'][1] . '`=:' . $relation['On'][0]); + } if ($relation['Where']) { $sql->addWhere($relation['Where']);
patch model for pgsql relations
linpax_microphp-framework
train
php
c5995fd07d652177a57bf954cc977269233beb96
diff --git a/src/core/WebCtrlResolver.php b/src/core/WebCtrlResolver.php index <HASH>..<HASH> 100644 --- a/src/core/WebCtrlResolver.php +++ b/src/core/WebCtrlResolver.php @@ -68,17 +68,17 @@ class WebCtrlResolver extends AbstractCtrlResolver $method = strtolower($this->request->getMethod()); if (isset($this->routeMap[$method])) { foreach ($this->routeMap[$method] as $route => $config) { - $params = []; + $actionArgs = []; if (preg_match( '#^'.$route.'/?$#u', urldecode($this->request->getUrlPath()), - $params + $actionArgs )) { AppHelper::getInstance()->setRouteConfig($config); $this->ctrlName = $config['ctrl'][0]; $this->actionName = $config['ctrl'][1]; - unset($params[0]); - $this->actionArgs = array_values($params); + unset($actionArgs[0]); + $this->actionArgs = array_values($actionArgs); break; } }
Tiny edits were added. Task #1 - Migrate Nadir microframework project from php <I> to php <I>.
selikhovleonid_nadir2
train
php
44110a305b5a23609c5f6366da9d746244807dbb
diff --git a/power/__init__.py b/power/__init__.py index <HASH>..<HASH> 100644 --- a/power/__init__.py +++ b/power/__init__.py @@ -35,7 +35,7 @@ try: from power.linux import PowerManagement else: raise RuntimeError("{platform} is not supported.".format(platform=platform)) -except RuntimeError as e: +except (RuntimeError, ImportError) as e: import warnings warnings.warn("Unable to load PowerManagement for {platform}. No-op PowerManagement class is used: {error}".format(error=str(e), platform=platform)) from power.common import PowerManagementNoop as PowerManagement
Use PowerManagementNoop on import errors Platform implementation can fail to import its dependencies.
Kentzo_Power
train
py
b5efa6d3eeb6061b3ab0f087c6aaba0d51291400
diff --git a/test_bokehjs.py b/test_bokehjs.py index <HASH>..<HASH> 100644 --- a/test_bokehjs.py +++ b/test_bokehjs.py @@ -1,4 +1,5 @@ import os +from os.path import join import unittest import subprocess @@ -6,6 +7,8 @@ class TestBokehJS(unittest.TestCase): def test_bokehjs(self): os.chdir('bokehjs') - proc = subprocess.Popen(["grunt"]) + proc = subprocess.Popen([join('node_modules', '.bin', 'gulp'), "test"]) self.assertEqual(proc.wait(), 0) +if __name__ == "__main__": + unittest.main() \ No newline at end of file
run tests from python unit test
bokeh_bokeh
train
py
b5362d099bcda40552d542962e77c643a32c00ee
diff --git a/www/src/py2js.js b/www/src/py2js.js index <HASH>..<HASH> 100644 --- a/www/src/py2js.js +++ b/www/src/py2js.js @@ -4500,7 +4500,8 @@ function $WithCtx(context){ new $NodeJSCtx(catch_node,'catch($err'+$loop_num+')') var fbody = new $Node(), indent=node.indent+4 - var js = '$exc'+num+' = false;console.log($err'+$loop_num+')\n'+' '.repeat(indent)+ + var js = '$exc'+num+' = false;$err'+$loop_num+'=$B.exception($err'+ + $loop_num+')\n'+' '.repeat(indent)+ 'if(!bool($ctx_manager_exit'+num+'($err'+$loop_num+ '.__class__.$factory,'+'$err'+$loop_num+ ',getattr($err'+$loop_num+',"traceback"))))'
Improve exception handling in context managers (keyword "with")
brython-dev_brython
train
js
3d964628f08fa1f6d87fdf3f6f8dfe374574a694
diff --git a/fundingmanager_test.go b/fundingmanager_test.go index <HASH>..<HASH> 100644 --- a/fundingmanager_test.go +++ b/fundingmanager_test.go @@ -1447,6 +1447,9 @@ func TestFundingManagerFundingTimeout(t *testing.T) { Height: fundingBroadcastHeight + 288, } + // Bob should have sent an Error message to Alice. + assertErrorSent(t, bob.msgChan) + // Should not be pending anymore. assertNumPendingChannelsBecomes(t, bob, 0) } @@ -1511,6 +1514,9 @@ func TestFundingManagerFundingNotTimeoutInitiator(t *testing.T) { // Since Alice was the initiator, the channel should not have timed out assertNumPendingChannelsRemains(t, alice, 1) + // Bob should have sent an Error message to Alice. + assertErrorSent(t, bob.msgChan) + // Since Bob was not the initiator, the channel should timeout assertNumPendingChannelsBecomes(t, bob, 0) }
fundingmanager test: check that error is sent on timeout
lightningnetwork_lnd
train
go
5150feb38cd0206f124b49952747900f35f716a5
diff --git a/Module.php b/Module.php index <HASH>..<HASH> 100644 --- a/Module.php +++ b/Module.php @@ -3,7 +3,7 @@ * YAWIK * Auth Module Bootstrap * - * @copyright (c) 2013-2104 Cross Solution (http://cross-solution.de) + * @copyright (c) 2013-2014 Cross Solution (http://cross-solution.de) * @license MIT */ diff --git a/src/Geo/Controller/IndexController.php b/src/Geo/Controller/IndexController.php index <HASH>..<HASH> 100644 --- a/src/Geo/Controller/IndexController.php +++ b/src/Geo/Controller/IndexController.php @@ -3,7 +3,7 @@ * YAWIK * * @filesource - * @copyright (c) 2013-2104 Cross Solution (http://cross-solution.de) + * @copyright (c) 2013-2014 Cross Solution (http://cross-solution.de) * @license MIT */ diff --git a/src/Geo/Form/GeoText.php b/src/Geo/Form/GeoText.php index <HASH>..<HASH> 100644 --- a/src/Geo/Form/GeoText.php +++ b/src/Geo/Form/GeoText.php @@ -3,7 +3,7 @@ * YAWIK * * @filesource - * @copyright (c) 2013-2104 Cross Solution (http://cross-solution.de) + * @copyright (c) 2013-2014 Cross Solution (http://cross-solution.de) * @license MIT */
[General] phpdoc changes. Fixes year in copyright.
yawik_geo
train
php,php,php
77dd58a67fbff816fe1678852e04c3d1cd4ed767
diff --git a/kernel/classes/clusterfilehandlers/ezdbfilehandler.php b/kernel/classes/clusterfilehandlers/ezdbfilehandler.php index <HASH>..<HASH> 100644 --- a/kernel/classes/clusterfilehandlers/ezdbfilehandler.php +++ b/kernel/classes/clusterfilehandlers/ezdbfilehandler.php @@ -49,7 +49,7 @@ class eZDBFileHandler implements ezpDatabaseBasedClusterFileHandler // connection failed if( self::$dbbackend->db === false ) - throw new eZDBNoConnectionException( self::$dbbackend->dbparams['host'] ); + throw new eZClusterHandlerDBNoConnectionException( self::$dbbackend->dbparams['host'], self::$dbbackend->dbparams['user'], self::$dbbackend->dbparams['pass'] ); } $this->filePath = $filePath;
eZDBNoConnectionException() called with only 1 arg, but 3 args are mandatory
ezsystems_ezpublish-legacy
train
php
6a20429b174622a37a44b633d598443c3b177ba6
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 @@ -40,7 +40,7 @@ RSpec.configure do |config| Object.const_set(type, Class.new(OpenStruct)) end - def mock_mapper(model_class, attributes = []) + def mock_mapper(model_class, attributes = [], relationships = []) klass = Class.new(DataMapper::Mapper::Relation) do model model_class repository :test @@ -55,6 +55,10 @@ RSpec.configure do |config| klass.attributes << attribute end + relationships.each do |relationship| + klass.relationships << relationship + end + @_mocked_mappers << klass.name.to_sym klass
Accept relationships in mock_mapper spec helper
rom-rb_rom
train
rb
c0bf732b2c5c4b4d66dec1bf6c7db6415fae4d2c
diff --git a/get_test.go b/get_test.go index <HASH>..<HASH> 100644 --- a/get_test.go +++ b/get_test.go @@ -452,6 +452,13 @@ func TestGetMemcacheFail(t *testing.T) { return errors.New("expected memcache.SetMulti error") }) + defer func() { + nds.SetMemcacheAddMulti(memcache.AddMulti) + nds.SetMemcacheCompareAndSwapMulti(memcache.CompareAndSwapMulti) + nds.SetMemcacheGetMulti(memcache.GetMulti) + nds.SetMemcacheSetMulti(memcache.SetMulti) + }() + retVal := &testEntity{} if err := nds.Get(c, key, retVal); err != nil { t.Fatal(err)
Fixed memcache fail tests.
qedus_nds
train
go
82ed8e702c2d5db1591938ed5339732166892215
diff --git a/gui/default/syncthing/core/syncthingController.js b/gui/default/syncthing/core/syncthingController.js index <HASH>..<HASH> 100755 --- a/gui/default/syncthing/core/syncthingController.js +++ b/gui/default/syncthing/core/syncthingController.js @@ -690,7 +690,7 @@ angular.module('syncthing.core') }; $scope.refreshFailed = function (page, perpage) { - if (!$scope.failed) { + if (!$scope.failed || !$scope.failed.folder) { return; } var url = urlbase + '/folder/errors?folder=' + encodeURIComponent($scope.failed.folder);
gui: Prevent spurious api call (fixes #<I>) (#<I>)
syncthing_syncthing
train
js
3d853be1cff30271fb46f8bd7b8f10ad5669ee90
diff --git a/httphandlers/buildinfo_handler.go b/httphandlers/buildinfo_handler.go index <HASH>..<HASH> 100644 --- a/httphandlers/buildinfo_handler.go +++ b/httphandlers/buildinfo_handler.go @@ -8,8 +8,8 @@ import ( type FtHandler func(http.ResponseWriter, *http.Request) -//BuildInfoHandlerFunc is a HandlerFunc that returns a JSON representation of the build-info. -func BuildInfoHandlerFunc(w http.ResponseWriter, r *http.Request) { +//BuildInfoHandler is a HandlerFunc that returns a JSON representation of the build-info. +func BuildInfoHandler(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", "application/json; charset=utf-8") if err := json.NewEncoder(w).Encode(buildinfo.GetBuildInfo()); err != nil { panic(err)
Renamed back BuildInfoHandlerFunc as BuildInfoHandler
Financial-Times_service-status-go
train
go
7107f2c36e0b99fc9cd4525ef287c198fd14934e
diff --git a/lib/celluloid/actor.rb b/lib/celluloid/actor.rb index <HASH>..<HASH> 100644 --- a/lib/celluloid/actor.rb +++ b/lib/celluloid/actor.rb @@ -34,7 +34,7 @@ module Celluloid if Celluloid.actor? and not Celluloid.exclusive? # The current task will be automatically resumed when we get a response - Task.suspend :callwait + Task.suspend(:callwait).value else # Otherwise we're inside a normal thread, so block response = Thread.mailbox.receive do |msg| @@ -200,7 +200,7 @@ module Celluloid when Call Task.new(:message_handler) { message.dispatch(@subject) }.resume when Response - message.call.task.resume message.value + message.call.task.resume message else @receivers.handle_message(message) end
Fix bug passing ErrorResponses back to their callers Celluloid was eagerly obtaining the response value before resuming a calling task. This meant that exceptions intended to be raised in the caller's scope were actually getting raised inside actor internals. Like Rick Perry said, oops!
celluloid_celluloid
train
rb
97a34405b2f5fcde4b0374aa052ad4f591ad318f
diff --git a/lib/plugins/assets/index.js b/lib/plugins/assets/index.js index <HASH>..<HASH> 100644 --- a/lib/plugins/assets/index.js +++ b/lib/plugins/assets/index.js @@ -18,7 +18,7 @@ module.exports = { switch (message.type) { case 'pagexray.run': { - aggregator.addToAggregate(message.data, message.data.group, message.url, this.context.storageManager); + aggregator.addToAggregate(message.data, message.group, message.url, this.context.storageManager); break; }
Correctly set ’group’ for assets summaries.
sitespeedio_sitespeed.io
train
js
16bbcef72b37a52cfbb588cd90eaa13c60fdcf6a
diff --git a/scripts/issue_helper/python.py b/scripts/issue_helper/python.py index <HASH>..<HASH> 100644 --- a/scripts/issue_helper/python.py +++ b/scripts/issue_helper/python.py @@ -1,9 +1,22 @@ +from typing import List + +from github.Issue import Issue + from common import Common _PYTHON_OWNER = {'msyyc', 'BigCat20196', 'Wzb123456789', 'kazrael2119'} _PYTHON_REPO = 'Azure/azure-sdk-for-python' _FILE_OUT_NAME_PYTHON = 'sdk_issue_python.md' +class Python(Common): + + def collect_open_issues(self) -> List[Issue]: + open_issues = super().collect_open_issues() + # Skip issue created by owners + filtered_issues = [i for i in open_issues if i.user.login not in self.language_owner] + return filtered_issues + + def python_process() -> None: - instance = Common(_PYTHON_OWNER, _PYTHON_REPO, _FILE_OUT_NAME_PYTHON) + instance = Python(_PYTHON_OWNER, _PYTHON_REPO, _FILE_OUT_NAME_PYTHON) instance.run()
[Issue helper] Skip issue created by owners (#<I>) * initial * rename yml * git push function * only collect issues with label 'Mgmt' * handle exception * date format * update log print * update bot policy * skip self-create issue * add ziwei and zhenbiao * Update python.py * skip self author * skip self author * skip self author * Update python.py * Update python.py
Azure_azure-sdk-for-python
train
py
801e5b1a851aa5fdebee379c5fecaaee1b52fc67
diff --git a/config/v3_1/translate/translate.go b/config/v3_1/translate/translate.go index <HASH>..<HASH> 100644 --- a/config/v3_1/translate/translate.go +++ b/config/v3_1/translate/translate.go @@ -16,6 +16,7 @@ package translate import ( "github.com/coreos/ignition/v2/config/translate" + "github.com/coreos/ignition/v2/config/util" old_types "github.com/coreos/ignition/v2/config/v3_0/types" "github.com/coreos/ignition/v2/config/v3_1/types" ) @@ -44,7 +45,7 @@ func translateConfigReference(old old_types.ConfigReference) (ret types.Resource func translateCAReference(old old_types.CaReference) (ret types.Resource) { // use a new translator so we don't recurse infinitely tr := translate.NewTranslator() - ret.Source = &old.Source + ret.Source = util.StrToPtr(old.Source) tr.Translate(&old.Verification, &ret.Verification) return }
config/v3_1/translate: don't point to field from input struct Copy the CaReference.Source rather than pointing directly to it, in case an external caller wants to change the input value afterward.
coreos_ignition
train
go
494efecef393a5bc30d463bf7cc9589dfe97d982
diff --git a/spec/analysand/view_streaming_spec.rb b/spec/analysand/view_streaming_spec.rb index <HASH>..<HASH> 100644 --- a/spec/analysand/view_streaming_spec.rb +++ b/spec/analysand/view_streaming_spec.rb @@ -37,6 +37,12 @@ module Analysand end describe '#view in streaming mode' do + let(:resp) { db.view('doc/a_view', :stream => true) } + + it 'returns all rows' do + resp.rows.map { 1 }.inject(&:+).should == row_count + end + it 'returns rows as soon as possible' do streamed = Benchmark.realtime do resp = db.view('doc/a_view', :stream => true)
Test that a view stream can run to completion.
yipdw_analysand
train
rb