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
b86c403dc5816392b7d6b379d77586362e58691c
diff --git a/lib/neo4j/rails/railtie.rb b/lib/neo4j/rails/railtie.rb index <HASH>..<HASH> 100644 --- a/lib/neo4j/rails/railtie.rb +++ b/lib/neo4j/rails/railtie.rb @@ -15,7 +15,6 @@ module Neo4j # register migrations in config/initializers initializer "neo4j.start", :after => :load_config_initializers do |app| Neo4j::Config.setup.merge!(app.config.neo4j.to_hash) - Neo4j.start end end end
No need to start up neo4j unless needed. E.g. prevent starting neo4j for rake routes.
neo4jrb_neo4j
train
rb
42aafbac0073978141147d3ce4ac9a887b224bde
diff --git a/lib/tachikoma_ai/strategies/bundler/gem.rb b/lib/tachikoma_ai/strategies/bundler/gem.rb index <HASH>..<HASH> 100644 --- a/lib/tachikoma_ai/strategies/bundler/gem.rb +++ b/lib/tachikoma_ai/strategies/bundler/gem.rb @@ -2,7 +2,7 @@ require 'rubygems' require 'json' module TachikomaAi - module Bundler + class Bundler class Gem STRING_PATTERN = /[-|\+]\s+(\S+)\s\((.+?)\)/ major, minor = RUBY_VERSION.split('.') diff --git a/spec/tachikoma_ai/strategies/bundler/gem_spec.rb b/spec/tachikoma_ai/strategies/bundler/gem_spec.rb index <HASH>..<HASH> 100644 --- a/spec/tachikoma_ai/strategies/bundler/gem_spec.rb +++ b/spec/tachikoma_ai/strategies/bundler/gem_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper' module TachikomaAi - module Bundler + class Bundler describe Gem do describe '.parse' do subject { Gem.parse('+ byebug (5.0.0)') }
:cocktail: Fix the mix of Module and Class
sinsoku_tachikoma_ai
train
rb,rb
149e40f8acc9355332e0834b2a628017c615d445
diff --git a/zipline/utils/calendars/calendar_utils.py b/zipline/utils/calendars/calendar_utils.py index <HASH>..<HASH> 100644 --- a/zipline/utils/calendars/calendar_utils.py +++ b/zipline/utils/calendars/calendar_utils.py @@ -33,6 +33,7 @@ _default_calendar_aliases = { 'ICEUS': 'ICE', 'NYFE': 'ICE', } +default_calendar_names = sorted(_default_calendar_factories.keys()) class TradingCalendarDispatcher(object):
BUG/ENH: Allow users to switch between calendars (#<I>) * BUG: Allow users to switch between calendars You previously could not switch between different calendars because the `trading_calendar` parameter was not being passed into run_algo or `TradingAlgorithm`. You now can pass which calendar you'd like to use via the CLI using `--trading-calendar`. * DEV/MAINT: Add pdb++ and change fixtures variable
quantopian_trading_calendars
train
py
9696f33acf356506467d4f5db10729d43efa73b4
diff --git a/src/main/java/hudson/plugins/sshslaves/SSHLauncher.java b/src/main/java/hudson/plugins/sshslaves/SSHLauncher.java index <HASH>..<HASH> 100644 --- a/src/main/java/hudson/plugins/sshslaves/SSHLauncher.java +++ b/src/main/java/hudson/plugins/sshslaves/SSHLauncher.java @@ -592,7 +592,15 @@ public class SSHLauncher extends ComputerLauncher { sftpClient = new SFTPv3Client(connection); sftpClient.rm(fileName); } catch (Exception e) { - e.printStackTrace(listener.error(Messages.SSHLauncher_ErrorDeletingFile(getTimestamp()))); + if (sftpClient == null) {// system without SFTP + try { + connection.exec("rm " + fileName, listener.getLogger()); + } catch (Exception x) { + x.printStackTrace(listener.error(Messages.SSHLauncher_ErrorDeletingFile(getTimestamp()))); + } + } else { + e.printStackTrace(listener.error(Messages.SSHLauncher_ErrorDeletingFile(getTimestamp()))); + } } finally { if (sftpClient != null) { sftpClient.close();
[FIXED HUDSON-<I>] fallback if SFTP is not available.
jenkinsci_ssh-slaves-plugin
train
java
704175ac5c4811030a4a53d7a0cf7eaaca4768ed
diff --git a/Gulpfile.js b/Gulpfile.js index <HASH>..<HASH> 100644 --- a/Gulpfile.js +++ b/Gulpfile.js @@ -3,7 +3,7 @@ var express = require('express'); var fs = require('fs'); var gulp = require('gulp'); var lr = require('tiny-lr'); -var path = require('path') +var path = require('path'); var browserify = require('gulp-browserify'); var concat = require('gulp-concat'); @@ -78,7 +78,7 @@ gulp.task('file-system', function () { }); gulp.task('jshint', function() { - gulp.src('src/js/**/*.js') + gulp.src(['Gulpfile.js', 'src/js/**/*.js']) .pipe(jshint()) .pipe(jshint.reporter('jshint-stylish')); });
add gulpfile to jshint
tadeuzagallo_zsh.js
train
js
82b42fffefa31525eef8b6a6545946e447a6a986
diff --git a/gns3server/version.py b/gns3server/version.py index <HASH>..<HASH> 100644 --- a/gns3server/version.py +++ b/gns3server/version.py @@ -23,8 +23,8 @@ # or negative for a release candidate or beta (after the base version # number has been incremented) -__version__ = "2.2.4" -__version_info__ = (2, 2, 4, 0) +__version__ = "2.2.5dev1" +__version_info__ = (2, 2, 5, -99) if "dev" in __version__: try:
Development on <I>dev1
GNS3_gns3-server
train
py
20d3a781decbee60dd675b42303103898df0a429
diff --git a/pybar/run_manager.py b/pybar/run_manager.py index <HASH>..<HASH> 100644 --- a/pybar/run_manager.py +++ b/pybar/run_manager.py @@ -407,7 +407,7 @@ class RunManager(object): ''' self.current_run.abort(msg) - def run_run(self, run, run_conf=None, use_thread=False, catch_exception=True): + def run_run(self, run, conf=None, run_conf=None, use_thread=False, catch_exception=True): '''Runs a run in another thread. Non-blocking. Parameters @@ -424,6 +424,9 @@ class RunManager(object): If use_thread is True, returns function, which blocks until thread terminates, and which itself returns run status. If use_thread is False, returns run status. ''' + if conf is not None: + self.conf.update(conf) + if isclass(run): # instantiate the class run = run(conf=self.conf)
ENH: allow passing conf to run_run
SiLab-Bonn_pyBAR
train
py
d17105538579fdebf4ea08f47685990850c520bf
diff --git a/h2o-core/src/main/java/water/AutoBuffer.java b/h2o-core/src/main/java/water/AutoBuffer.java index <HASH>..<HASH> 100644 --- a/h2o-core/src/main/java/water/AutoBuffer.java +++ b/h2o-core/src/main/java/water/AutoBuffer.java @@ -519,6 +519,8 @@ public /* final */ class AutoBuffer { assert !_read; _read = true; _bb.flip(); + if(_firstPage) + _bb.position(2); _firstPage = true; return this; }
Fix auto serial test - auto buffer now leaves 2 bytes of the first buffer of data empty to leave space for message size (if the message is small), fixed flipForReading to account for that
h2oai_h2o-3
train
java
32fc4e6460842c9b0983008f105b04f77e4b5633
diff --git a/src/OpenSSL/crypto.py b/src/OpenSSL/crypto.py index <HASH>..<HASH> 100644 --- a/src/OpenSSL/crypto.py +++ b/src/OpenSSL/crypto.py @@ -2450,6 +2450,7 @@ def load_publickey(type, buffer): pkey = PKey.__new__(PKey) pkey._pkey = _ffi.gc(evp_pkey, _lib.EVP_PKEY_free) + pkey._only_public = True return pkey diff --git a/tests/test_crypto.py b/tests/test_crypto.py index <HASH>..<HASH> 100644 --- a/tests/test_crypto.py +++ b/tests/test_crypto.py @@ -2427,6 +2427,20 @@ def _runopenssl(pem, *args): return output +class TestFunctions(object): + """ + py.test-based tests for the free functions in the crypto module. + + If possible, add new tests here. + """ + def test_load_publickey_sets_only_public(self): + """ + _only_public should be set on PKeys loaded with load_publickey. + """ + key = load_publickey(FILETYPE_PEM, cleartextPublicKeyPEM) + assert key._only_public is True + + class FunctionTests(TestCase): """ Tests for free-functions in the :py:obj:`OpenSSL.crypto` module.
fix a small bug with load_publickey (#<I>) * fix a small bug with load_publickey * update docstring, rename test method * make hynek happy
pyca_pyopenssl
train
py,py
6a64e11b2f6e4d909357ee7019cab9421fe72b90
diff --git a/src/test/java/org/la4j/matrix/AbstractMatrixTest.java b/src/test/java/org/la4j/matrix/AbstractMatrixTest.java index <HASH>..<HASH> 100644 --- a/src/test/java/org/la4j/matrix/AbstractMatrixTest.java +++ b/src/test/java/org/la4j/matrix/AbstractMatrixTest.java @@ -2060,4 +2060,25 @@ public abstract class AbstractMatrixTest extends TestCase { assertFalse(b.is(Matrices.TRIDIAGONAL_MATRIX)); } + public void testSymmetricMatrixPredicate() { + + Matrix a = factory().createMatrix(new double[][] { + { 0.0, 1.0, 0.0, 0.0 }, + { 1.0, 2.0, 3.0, 5.0 }, + { 0.0, 3.0, 0.0, 0.0 }, + { 0.0, 5.0, 0.0, 2.0 } + }); + + assertTrue(a.is(Matrices.SYMMETRIC_MATRIX)); + + Matrix b = factory().createMatrix(new double[][] { + { 0.0, 0.0, 0.0, 0.0 }, + { 0.0, 2.0, 3.0, 0.0 }, + { 3.0, 3.0, 0.0, 0.0 }, + { 0.0, 0.0, 0.0, 2.0 } + }); + + assertFalse(b.is(Matrices.SYMMETRIC_MATRIX)); + + } }
added sym matrix predicate test
vkostyukov_la4j
train
java
138bc33fa38e56787cdae728685946012d584a67
diff --git a/src/HttpResponse.php b/src/HttpResponse.php index <HASH>..<HASH> 100644 --- a/src/HttpResponse.php +++ b/src/HttpResponse.php @@ -85,7 +85,7 @@ class HttpResponse public function xml(): ?SimpleXMLElement { return simplexml_load_string( - utf8_encode($this->response->getBody()), + utf8_encode($this->response->getBody()->getContents()), 'SimpleXMLElement', LIBXML_NOCDATA | LIBXML_NOBLANKS ); }
Retrieve Contents instead of Stream for xml
faustbrian_HTTP
train
php
613031eeeb8cfa5a3037092b3e00c64501cf1c1f
diff --git a/src/NewRelicExceptionHandler.php b/src/NewRelicExceptionHandler.php index <HASH>..<HASH> 100644 --- a/src/NewRelicExceptionHandler.php +++ b/src/NewRelicExceptionHandler.php @@ -41,7 +41,7 @@ class NewRelicExceptionHandler implements ExceptionHandler */ public function report(Exception $e) { - if (!in_array(get_class($e), $this->ignoredExceptions)) { + if ($this->shouldReport($e)) { $this->logException($e); } } @@ -64,6 +64,18 @@ class NewRelicExceptionHandler implements ExceptionHandler } + /** + * @inheritdoc + */ + public function shouldReport(Exception $e) + { + foreach ($this->ignoredExceptions as $type) { + if ($e instanceof $type) { + return false; + } + } + return true; + } /** * Logs the exception to New Relic (if the extension is loaded)
made compatible to new illuminate exception contract from lumen <I>
digiaonline_lumen-newrelic
train
php
e64a83cdbd3ce836f3339c600c1006b20c23d8fd
diff --git a/activerecord/lib/active_record/enum.rb b/activerecord/lib/active_record/enum.rb index <HASH>..<HASH> 100644 --- a/activerecord/lib/active_record/enum.rb +++ b/activerecord/lib/active_record/enum.rb @@ -54,11 +54,12 @@ module ActiveRecord # remove unused values, the explicit +Hash+ syntax should be used. # # In rare circumstances you might need to access the mapping directly. - # The mappings are exposed through a constant with the attributes name: + # The mappings are exposed through a class method with the pluralized attribute + # name: # # Conversation.statuses # => { "active" => 0, "archived" => 1 } # - # Use that constant when you need to know the ordinal value of an enum: + # Use that class method when you need to know the ordinal value of an enum: # # Conversation.where("status <> ?", Conversation.statuses[:archived]) module Enum
Updated comment to mention the enum mapping class method [ci skip]
rails_rails
train
rb
6edaaa27a57b665fecf83fcd4bb8aaebb5ea60bd
diff --git a/lib/deliver/itunes_connect.rb b/lib/deliver/itunes_connect.rb index <HASH>..<HASH> 100644 --- a/lib/deliver/itunes_connect.rb +++ b/lib/deliver/itunes_connect.rb @@ -77,6 +77,11 @@ module Deliver result = visit ITUNESCONNECT_URL raise "Could not open iTunesConnect" unless result['status'] == 'success' + if page.has_content?"My Apps" + # Already logged in + return true + end + fill_in "accountname", with: user fill_in "accountpassword", with: password
Improved iTC handling if user is already logged in
fastlane_fastlane
train
rb
b93719aa6efec302d28e65bef6b7f661965e3868
diff --git a/lib/index.js b/lib/index.js index <HASH>..<HASH> 100644 --- a/lib/index.js +++ b/lib/index.js @@ -3,6 +3,8 @@ var extname = require('path').extname; var _ = require('lodash'); var Prism = require('prismjs'); var he = require('he'); +var vm = require('vm'); +var fs = require('fs'); var jsonSyntax = require('./prism-json'); @@ -17,11 +19,20 @@ module.exports = function(options) { Prism.languages.json = options.json ? options.json : jsonSyntax; return function(files, metalsmith, done) { + setImmediate(done); function requireLanguage(language) { + if (!Prism.languages[language]) { - require('prismjs/components/prism-' + language); + + var path = require.resolve('prismjs/components/prism-' + language); + var code = fs.readFileSync(path).toString(); + + // make Prism object available in the plugins local scope + vm.runInNewContext(code, { + Prism: Prism + }); } }
pass Prism context when requiring the language plugins
Availity_metalsmith-prism
train
js
ea335729cf24a9e8a37563a6a2bfa2cb5c2c0e70
diff --git a/spring-security-jwt/src/test/java/org/springframework/security/jwt/RubyJwtIntegrationTests.java b/spring-security-jwt/src/test/java/org/springframework/security/jwt/RubyJwtIntegrationTests.java index <HASH>..<HASH> 100644 --- a/spring-security-jwt/src/test/java/org/springframework/security/jwt/RubyJwtIntegrationTests.java +++ b/spring-security-jwt/src/test/java/org/springframework/security/jwt/RubyJwtIntegrationTests.java @@ -28,7 +28,9 @@ import org.springframework.security.jwt.crypto.sign.MacSigner; /** * Tests for compatibility with Ruby's JWT Gem. * - * Requires a local JRuby installation and maven must be run with: + * Requires a local JRuby installation with jruby.home as a system property. Using RVM + * sets this up automatically (e.g. "rvm use jruby-1.7.12"), or alternatively Maven can be + * run with: * * <pre> * mvn -DargLine="-Djruby.home=${JRUBY_HOME}" test
Clarify usage of ruby integration test
spring-projects_spring-security-oauth
train
java
15130b74f2e2ae63b587052bd421e6bec6cdb27c
diff --git a/src/Kwf/FileWatcher/Helper/Links.php b/src/Kwf/FileWatcher/Helper/Links.php index <HASH>..<HASH> 100644 --- a/src/Kwf/FileWatcher/Helper/Links.php +++ b/src/Kwf/FileWatcher/Helper/Links.php @@ -9,7 +9,7 @@ class Links $finder = new Finder(); $finder->directories(); foreach ($excludePatterns as $excludePattern) { - $finder->notName($excludePattern); + $finder->notPath($excludePattern); } foreach ($paths as $p) { $finder->in($p);
Fix symlink lookup: excludePattern shoud be used as path so it doesn't recurse into excludes paths
koala-framework_file-watcher
train
php
5a5f61a7e0727dfe3b1e7df3ef3702abdd678993
diff --git a/test/unit/pseudoimager.js b/test/unit/pseudoimager.js index <HASH>..<HASH> 100644 --- a/test/unit/pseudoimager.js +++ b/test/unit/pseudoimager.js @@ -2,7 +2,6 @@ let path = require("path"); let fs = require("fs"); let lwip = require("lwip"); let Image = require("lwip/lib/image"); -let Sinon = require("sinon"); let Mocha = require("mocha"); let describe = Mocha.describe; let it = require("mocha").it;
We don't use Sinon (yet).
randytarampi_me
train
js
2d9401fb13625eb000bbaa1f48aa74815fc44125
diff --git a/src/Composer/Repository/Vcs/GitDriver.php b/src/Composer/Repository/Vcs/GitDriver.php index <HASH>..<HASH> 100644 --- a/src/Composer/Repository/Vcs/GitDriver.php +++ b/src/Composer/Repository/Vcs/GitDriver.php @@ -242,7 +242,7 @@ class GitDriver extends VcsDriver } $process = new ProcessExecutor($io); - if($process->execute('git ls-remote --heads ' . ProcessExecutor::escape($url)) === 0) { + if($process->execute('git ls-remote --heads ' . ProcessExecutor::escape($url), $output) === 0) { return true; }
fix bug in GitDriver::supports for remote repo for some reason it does not work (in packagist) without the $output param. I don't get any error message here, maybe someone has an idea, why? Anyway, need this ;)
mothership-ec_composer
train
php
aeb61a2a28aaaf0853de30190009a971455a022c
diff --git a/src/frontend/org/voltdb/compiler/DDLCompiler.java b/src/frontend/org/voltdb/compiler/DDLCompiler.java index <HASH>..<HASH> 100644 --- a/src/frontend/org/voltdb/compiler/DDLCompiler.java +++ b/src/frontend/org/voltdb/compiler/DDLCompiler.java @@ -1689,8 +1689,8 @@ public class DDLCompiler { } if (db.getGroups().get(role) == null) { throw compiler.new VoltCompilerException( - String.format("Unknown user group %s defined in the ALLOW attribute of STREAM %s", - role, table.getTypeName())); + String.format("Unknown role %s listed in the ALLOW attribute of STREAM %s", role, + table.getTypeName())); } definedRoles.add(role); }
ENG-<I>: Use role not user group
VoltDB_voltdb
train
java
78fc4adac6941fb90f45e004b6f1a3246a3a6eda
diff --git a/src/parser/Parser.js b/src/parser/Parser.js index <HASH>..<HASH> 100644 --- a/src/parser/Parser.js +++ b/src/parser/Parser.js @@ -147,15 +147,15 @@ function Parser(source) { let hasImplicationSymbol = true; if (_foundToBe(TokenTypes.Symbol, '<-')) { - clauseNode.addChild(new AstNode(NodeTypes.Symbol, currentToken)); + clauseNode.addChild(new AstNode(NodeTypes.BinaryOperator, currentToken)); _expect(TokenTypes.Symbol); } else if (_foundToBe(TokenTypes.Symbol, '->')) { - clauseNode.addChild(new AstNode(NodeTypes.Symbol, currentToken)); + clauseNode.addChild(new AstNode(NodeTypes.BinaryOperator, currentToken)); _expect(TokenTypes.Symbol); } else { clauseNode.addChild(_literalSet()); if (_foundToBe(TokenTypes.Symbol, '<-') || _foundToBe(TokenTypes.Symbol, '->')) { - clauseNode.addChild(new AstNode(NodeTypes.Symbol, currentToken)); + clauseNode.addChild(new AstNode(NodeTypes.BinaryOperator, currentToken)); _expect(TokenTypes.Symbol); } else { hasImplicationSymbol = false;
update -> and <- to be binary operators
lps-js_lps.js
train
js
00487608f0f4a7ebe6062b0338a2b7dfde256dc9
diff --git a/src/main/java/cocaine/message/HandshakeMessage.java b/src/main/java/cocaine/message/HandshakeMessage.java index <HASH>..<HASH> 100644 --- a/src/main/java/cocaine/message/HandshakeMessage.java +++ b/src/main/java/cocaine/message/HandshakeMessage.java @@ -1,23 +1,25 @@ package cocaine.message; +import java.util.UUID; + /** * @author Anton Bobukh <abobukh@yandex-team.ru> */ public class HandshakeMessage extends Message { - private final String uniqueId; + private final UUID id; - public HandshakeMessage(long session, String uniqueId) { + public HandshakeMessage(long session, UUID id) { super(Type.HANDSHAKE, session); - this.uniqueId = uniqueId; + this.id = id; } - public String getUniqueId() { - return uniqueId; + public UUID getId() { + return id; } @Override public String toString() { - return "HandshakeMessage/" + getSession() + ": " + uniqueId; + return "HandshakeMessage/" + getSession() + ": " + id; } }
Application ID type is changed to java.util.UUID
cocaine_cocaine-framework-java
train
java
821c81fdd4749208c9731c74f55eca5930cf2a8a
diff --git a/trunk/ipaddr.py b/trunk/ipaddr.py index <HASH>..<HASH> 100644 --- a/trunk/ipaddr.py +++ b/trunk/ipaddr.py @@ -1045,6 +1045,17 @@ class _BaseV4(object): return self in IPv4Network('224.0.0.0/4') @property + def is_unspecified(self): + """Test if the address is unspecified. + + Returns: + A boolean, True if this is the unspecified address as defined in + RFC 5735 3. + + """ + return self in IPv4Network('0.0.0.0') + + @property def is_loopback(self): """Test if the address is a loopback address. diff --git a/trunk/ipaddr_test.py b/trunk/ipaddr_test.py index <HASH>..<HASH> 100755 --- a/trunk/ipaddr_test.py +++ b/trunk/ipaddr_test.py @@ -656,6 +656,8 @@ class IpaddrUnitTest(unittest.TestCase): self.assertEquals(True, ipaddr.IPAddress('127.42.0.0').is_loopback) self.assertEquals(False, ipaddr.IPAddress('128.0.0.0').is_loopback) + self.assertEquals(True, ipaddr.IPNetwork('0.0.0.0').is_unspecified) + def testReservedIpv6(self):
+ add IPv4Network().is_unspecified. issue<I>. (thanks to rep.dot.net for the bug report and patch). git-svn-id: <URL>
google_ipaddr-py
train
py,py
4c4b98605227d775613f5535ca84af2aedc5fafa
diff --git a/tasks/ccop.rb b/tasks/ccop.rb index <HASH>..<HASH> 100644 --- a/tasks/ccop.rb +++ b/tasks/ccop.rb @@ -23,7 +23,9 @@ task :ccop do file_list.each do |file| corrected = "#{file}_corrected" begin - system("indent #{file} -o #{corrected}") + result = `indent #{file} -o #{corrected}` + break unless result + if FileUtils.compare_file(file, corrected) print(green('.')) else
Backticks wait for the system command to finish?
deivid-rodriguez_byebug
train
rb
994054079b81fe24f2278a8d3b9c44e2cb9ca49c
diff --git a/gumble/client.go b/gumble/client.go index <HASH>..<HASH> 100644 --- a/gumble/client.go +++ b/gumble/client.go @@ -190,7 +190,7 @@ func (c *Client) AudioOutgoing() chan<- AudioBuffer { // pingRoutine sends ping packets to the server at regular intervals. func (c *Client) pingRoutine() { - ticker := time.NewTicker(time.Second * 10) + ticker := time.NewTicker(time.Second * 5) defer ticker.Stop() packet := MumbleProto.Ping{
change sending ping packets every 5 seconds from <I> seconds
layeh_gumble
train
go
28e6fedcb83a3c3588399cb67f6a14f2c9fc80b8
diff --git a/allauth/socialaccount/providers/__init__.py b/allauth/socialaccount/providers/__init__.py index <HASH>..<HASH> 100644 --- a/allauth/socialaccount/providers/__init__.py +++ b/allauth/socialaccount/providers/__init__.py @@ -1,3 +1,5 @@ +from collections import OrderedDict + from django.conf import settings from allauth.compat import importlib @@ -5,7 +7,7 @@ from allauth.compat import importlib class ProviderRegistry(object): def __init__(self): - self.provider_map = {} + self.provider_map = OrderedDict() self.loaded = False def get_list(self, request=None):
changed provider_map from dict to OrderedDict to ensure ordering when calling as_choices(). (#<I>)
pennersr_django-allauth
train
py
7874e2fe08a499336901c397b3fbcc2d3b908b0d
diff --git a/dockermap/map/policy/cache.py b/dockermap/map/policy/cache.py index <HASH>..<HASH> 100644 --- a/dockermap/map/policy/cache.py +++ b/dockermap/map/policy/cache.py @@ -69,8 +69,7 @@ class CachedImages(CachedItems, dict): if update_latest or full_name not in self: self._client.pull(repository=image, tag=tag, insecure_registry=insecure_registry) images = self._client.images(name=image_name) - if images: - new_image = images[0] + for new_image in images: tags = new_image.get('RepoTags') if tags: self._latest.update(tags)
Fix adding multiple images of same repository.
merll_docker-map
train
py
6f4cf26bca3f82a6efaeaec3530492b974ba04f6
diff --git a/examples/angular-demo/app/js/directives/heatMap.js b/examples/angular-demo/app/js/directives/heatMap.js index <HASH>..<HASH> 100644 --- a/examples/angular-demo/app/js/directives/heatMap.js +++ b/examples/angular-demo/app/js/directives/heatMap.js @@ -302,6 +302,7 @@ angular.module('heatMapDirective', []).directive('heatMap', ['ConnectionService' $scope.clearFilter = function () { $scope.messenger.removeFilter($scope.filterKey, function () { $scope.$apply(function () { + $scope.queryForMapData(); $scope.hideClearFilterButton(); }); }, function () {
map was not querying for new data after removing filters
NextCenturyCorporation_neon
train
js
ad5f344c29efb6b328c59d78c53fb09ef57b65eb
diff --git a/cursor.go b/cursor.go index <HASH>..<HASH> 100644 --- a/cursor.go +++ b/cursor.go @@ -2,15 +2,13 @@ package disruptor import "sync/atomic" -type Cursor [cpuCacheLinePadding]int64 +type Cursor [8]int64 // prevent false sharing of the cursor by padding the CPU cache line with 64 *bytes* of data. func NewCursor() *Cursor { - this := &Cursor{} - this.Store(InitialCursorSequenceValue) - return this + var this Cursor + this[0] = InitialCursorSequenceValue + return &this } func (this *Cursor) Store(sequence int64) { atomic.StoreInt64(&this[0], sequence) } func (this *Cursor) Load() int64 { return atomic.LoadInt64(&this[0]) } - -const cpuCacheLinePadding = 8
Inlined constant; revised constructor.
smartystreets_go-disruptor
train
go
95f54dee9bc80c1ccf28ff094e7307923d1e2bfb
diff --git a/openquake/engine/tools/load_hazards.py b/openquake/engine/tools/load_hazards.py index <HASH>..<HASH> 100644 --- a/openquake/engine/tools/load_hazards.py +++ b/openquake/engine/tools/load_hazards.py @@ -60,6 +60,9 @@ def transfer_data(curs, model, **foreign_keys): conn = curs.connection + # FIXME(lp). In order to avoid alter the table, we should use a + # data modifying CTE. I am not using data modifying CTE as I + # consider it a maintenance nightmare at this moment. curs.execute( "ALTER TABLE %s ADD load_id INT" % model_table(model)) args = dict(
added comment explaining why I am temporarly altering the tables
gem_oq-engine
train
py
e354d67d5e34d6105f88d2f5109282c3ddb8060a
diff --git a/master/buildbot/process/buildstep.py b/master/buildbot/process/buildstep.py index <HASH>..<HASH> 100644 --- a/master/buildbot/process/buildstep.py +++ b/master/buildbot/process/buildstep.py @@ -57,6 +57,7 @@ from buildbot.process.results import SUCCESS from buildbot.process.results import WARNINGS from buildbot.process.results import Results from buildbot.process.results import worst_status +from buildbot.util import bytes2NativeString from buildbot.util import debounce from buildbot.util import flatten from buildbot.worker_transition import WorkerAPICompatMixin @@ -804,6 +805,7 @@ class BuildStep(results.ResultComputingConfigMixin, logid = yield self.master.data.updates.addLog(self.stepid, util.ascii2unicode(name), u'h') l = self._newLog(name, u'h', logid) + html = bytes2NativeString(html) yield l.addContent(html) yield l.finish()
Make sure that html is a native string
buildbot_buildbot
train
py
2b3aa068c9bd43f5585a61ecbf5d9f4649646f0c
diff --git a/polyaxon/hpsearch/search_managers/bayesian_optimization/manager.py b/polyaxon/hpsearch/search_managers/bayesian_optimization/manager.py index <HASH>..<HASH> 100644 --- a/polyaxon/hpsearch/search_managers/bayesian_optimization/manager.py +++ b/polyaxon/hpsearch/search_managers/bayesian_optimization/manager.py @@ -25,8 +25,12 @@ class BOSearchManager(BaseSearchAlgorithmManager): configs = [] metrics = [] for key in experiments_metrics.keys(): - configs.append(experiments_configs[key]) - metrics.append(experiments_metrics[key]) + if key in experiments_configs: + configs.append(experiments_configs[key]) + metrics.append(experiments_metrics[key]) + + if not configs or not metrics: + return None optimizer = BOOptimizer(hptuning_config=self.hptuning_config) optimizer.add_observations(configs=configs, metrics=metrics) suggestion = optimizer.get_suggestion()
Handle missing experiments in suggestion algorithms gracefully
polyaxon_polyaxon
train
py
0264d775453293e6ecde6612bf776ea4b9a948a3
diff --git a/cmd/influx_inspect/tsm.go b/cmd/influx_inspect/tsm.go index <HASH>..<HASH> 100644 --- a/cmd/influx_inspect/tsm.go +++ b/cmd/influx_inspect/tsm.go @@ -549,7 +549,7 @@ func cmdDumpTsm1dev(opts *tsdmDumpOpts) { buf := make([]byte, e.Size-4) f.Read(buf) - blockSize += int64(len(buf)) + 4 + blockSize += int64(e.Size) blockType := buf[0] @@ -584,7 +584,7 @@ func cmdDumpTsm1dev(opts *tsdmDumpOpts) { blockStats.size(len(buf)) if opts.filterKey != "" && !strings.Contains(key, opts.filterKey) { - i += (4 + int64(e.Size)) + i += blockSize blockCount++ continue } @@ -601,7 +601,7 @@ func cmdDumpTsm1dev(opts *tsdmDumpOpts) { fmt.Sprintf("%d/%d", len(ts), len(values)), }, "\t")) - i += (4 + int64(e.Size)) + i += blockSize blockCount++ } }
Fix block sizes reported by influx_inspect
influxdata_influxdb
train
go
a8903de681e5a68f246b119e987aa79412035efe
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100755 --- a/setup.py +++ b/setup.py @@ -44,7 +44,7 @@ extras_require={ ':python_version>="3"': ['avro-python3']} setup(name='schema-salad', - version='3.0', + version='2.5.1', description='Schema Annotations for Linked Avro Data (SALAD)', long_description=open(README).read(), author='Common workflow language working group', @@ -72,8 +72,8 @@ setup(name='schema-salad', "Operating System :: MacOS :: MacOS X", "Development Status :: 4 - Beta", "Programming Language :: Python :: 2.7", - #"Programming Language :: Python :: 3.3", # TODO: uncomment these - #"Programming Language :: Python :: 3.4", # lines - #"Programming Language :: Python :: 3.5" + "Programming Language :: Python :: 3.3", + "Programming Language :: Python :: 3.4", + "Programming Language :: Python :: 3.5" ] )
setup.py: change version, uncomment classifiers for py3
common-workflow-language_schema_salad
train
py
75fe384c81c68217f49dc5ccba408cdd00766f8d
diff --git a/actionmailer/test/abstract_unit.rb b/actionmailer/test/abstract_unit.rb index <HASH>..<HASH> 100644 --- a/actionmailer/test/abstract_unit.rb +++ b/actionmailer/test/abstract_unit.rb @@ -26,7 +26,7 @@ I18n.enforce_available_locales = false FIXTURE_LOAD_PATH = File.expand_path('fixtures', File.dirname(__FILE__)) ActionMailer::Base.view_paths = FIXTURE_LOAD_PATH -class Rails +module Rails def self.root File.expand_path('../', File.dirname(__FILE__)) end
Rails is a module not a class
rails_rails
train
rb
8859848ec048957fe8a0affa52ceeecd34d89b6a
diff --git a/nunaliit2-js/src/main/js/nunaliit2/n2.couchImportProfile.js b/nunaliit2-js/src/main/js/nunaliit2/n2.couchImportProfile.js index <HASH>..<HASH> 100644 --- a/nunaliit2-js/src/main/js/nunaliit2/n2.couchImportProfile.js +++ b/nunaliit2-js/src/main/js/nunaliit2/n2.couchImportProfile.js @@ -1371,6 +1371,12 @@ var AnalysisReport = $n2.Class({ var doc = null; if( schema ){ doc = schema.createObject(); + + // Remove attachment instructions + if( doc.nunaliit_attachments ){ + delete doc.nunaliit_attachments; + }; + } else { doc = {}; };
nunaliit2-js: When importing data via an import profile, do not include an empty section "nunaliit_attachments" Issue #<I>
GCRC_nunaliit
train
js
f8d0014a9daf5361ca14cb44411d8c574b96a3f2
diff --git a/src/main/java/com/synopsys/integration/blackduck/notification/content/detail/NotificationContentDetail.java b/src/main/java/com/synopsys/integration/blackduck/notification/content/detail/NotificationContentDetail.java index <HASH>..<HASH> 100644 --- a/src/main/java/com/synopsys/integration/blackduck/notification/content/detail/NotificationContentDetail.java +++ b/src/main/java/com/synopsys/integration/blackduck/notification/content/detail/NotificationContentDetail.java @@ -192,7 +192,11 @@ public class NotificationContentDetail extends Stringable { } public boolean isVulnerability() { - return !isPolicy(); + return CONTENT_KEY_GROUP_VULNERABILITY.equals(notificationGroup); + } + + public boolean isBomEdit() { + return CONTENT_KEY_GROUP_BOM_EDIT.equals(notificationGroup); } public List<UriSingleResponse<? extends HubResponse>> getPresentLinks() {
Correct logic for determining the type of a NotificationContentDetail.
blackducksoftware_blackduck-common
train
java
851b620b325701b619f7531b97688c79b5ee2ebe
diff --git a/lib/regexp_parser/expression/classes/backref.rb b/lib/regexp_parser/expression/classes/backref.rb index <HASH>..<HASH> 100644 --- a/lib/regexp_parser/expression/classes/backref.rb +++ b/lib/regexp_parser/expression/classes/backref.rb @@ -16,7 +16,7 @@ module Regexp::Expression attr_reader :number def initialize(token) - @number = token.text[3..-2] + @number = token.text[token.token.equal?(:number) ? 1..-1 : 3..-2] super(token) end end
Fix number attribute for traditional backref expressions
ammar_regexp_parser
train
rb
5389bcf4fb587f10461439a06bb845a7101232c5
diff --git a/src/image-preview/index.js b/src/image-preview/index.js index <HASH>..<HASH> 100644 --- a/src/image-preview/index.js +++ b/src/image-preview/index.js @@ -54,6 +54,7 @@ const ImagePreview = (images, startPosition = 0) => { }); if (options.onClose) { + instance.$off('close'); instance.$once('close', options.onClose); } diff --git a/src/image-preview/test/index.spec.js b/src/image-preview/test/index.spec.js index <HASH>..<HASH> 100644 --- a/src/image-preview/test/index.spec.js +++ b/src/image-preview/test/index.spec.js @@ -102,6 +102,26 @@ test('onClose option', async done => { done(); }); +test('onClose should only trigger once', async done => { + const onClose = jest.fn(); + const instance = ImagePreview({ + images, + startPostion: 1, + onClose + }); + + ImagePreview({ + images, + startPostion: 1, + onClose + }); + + instance.close(); + + expect(onClose).toHaveBeenCalledTimes(1); + done(); +}); + test('onChange option', async done => { const instance = ImagePreview({ images,
fix(ImagePreview): onClose should only trigger once (#<I>)
youzan_vant
train
js,js
20273fec2a18652551132b1b8adde1b08c903260
diff --git a/Propel/Behavior/Tos/templates/queryHaveNotAgreedToAnyTerms.php b/Propel/Behavior/Tos/templates/queryHaveNotAgreedToAnyTerms.php index <HASH>..<HASH> 100644 --- a/Propel/Behavior/Tos/templates/queryHaveNotAgreedToAnyTerms.php +++ b/Propel/Behavior/Tos/templates/queryHaveNotAgreedToAnyTerms.php @@ -8,7 +8,7 @@ public function haveNotAgreedToAnyTerms() { return $this ->useAgreementQuery(null, Criteria::LEFT_JOIN) - ->filterByAgreedAt(null) // TODO: this selects entity with 0000-00-00 also + ->filterByAgreedAt(null) ->endUse() ->distinct(); }
removed TODO of already taken care issue
coopers-peele_CPTermsBundle
train
php
96b21e1e835790f3e2e7593642e4e41a0ed505bf
diff --git a/lib/sprout/generator.rb b/lib/sprout/generator.rb index <HASH>..<HASH> 100644 --- a/lib/sprout/generator.rb +++ b/lib/sprout/generator.rb @@ -88,14 +88,21 @@ module Sprout # suggest[http://groups.google.com/group/projectsprouts/] any improvements to # the Google Group. # - # @see Sprout::GeneratorGenerator - # # --- # # Back to Home: {file:README.textile} # # Next Topic: {Sprout::Library} # + # --- + # + # @see Sprout::GeneratorGenerator + # @see Sprout::Library + # @see Sprout::Executable + # @see Sprout::Specification + # @see Sprout::RubyFeature + # @see Sprout::System + # module Generator include RubyFeature @@ -137,7 +144,8 @@ module Sprout # @param type [Symbol] A snake-cased name of the class without the Generator suffix. # for example, to instantiate a generator named, +TestSuiteGenerator+, this argument # would be +:test_suite+ - def create_instance type + # @param options [Hash] deprecated - please remove this argument wherever it's found. + def create_instance type, options=nil class_name = "#{type.to_s.camel_case}Generator" registered_entities.each do |entity| if(entity.to_s.match(/::#{class_name}$/) || entity.to_s.match(/^#{class_name}$/))
Updated interface to be compatible with existing generators
lukebayes_project-sprouts
train
rb
96be54f99a092b95f8694a38e0942f6c84bc097b
diff --git a/c7n/filters/core.py b/c7n/filters/core.py index <HASH>..<HASH> 100644 --- a/c7n/filters/core.py +++ b/c7n/filters/core.py @@ -271,7 +271,7 @@ class ValueFilter(Filter): elif self.expr: r = self.expr.search(i) else: - self.expr = jmespath.compile(self.k) + self.expr = jmespath.compile(k) r = self.expr.search(i) return r
get resource value should be using passed value of key not instance value (#<I>)
cloud-custodian_cloud-custodian
train
py
15bcad790dc06d39d15e7e5d5ea7f8c5b840b602
diff --git a/lib/rubocop/config_loader.rb b/lib/rubocop/config_loader.rb index <HASH>..<HASH> 100644 --- a/lib/rubocop/config_loader.rb +++ b/lib/rubocop/config_loader.rb @@ -153,12 +153,7 @@ module RuboCop warn Rainbow('For more information: https://docs.rubocop.org/rubocop/versioning.html').yellow end - # Merges the given configuration with the default one. If - # AllCops:DisabledByDefault is true, it changes the Enabled params so - # that only cops from user configuration are enabled. - # If AllCops::EnabledByDefault is true, it changes the Enabled params - # so that only cops explicitly disabled in user configuration are - # disabled. + # Merges the given configuration with the default one. def merge_with_default(config, config_file, unset_nil: true) resolver.merge_with_default(config, config_file, unset_nil: unset_nil) end
Remove duplicated comment This comment already exists in the ConfigLoaderResolver. I think that level of details is a better fit there and it doesn't make sense to maintain it duplicated.
rubocop-hq_rubocop
train
rb
db4ca1f75640c801947e1e080726acdd0e374ed7
diff --git a/crypto/src/main/java/org/springframework/security/crypto/password/NoOpPasswordEncoder.java b/crypto/src/main/java/org/springframework/security/crypto/password/NoOpPasswordEncoder.java index <HASH>..<HASH> 100644 --- a/crypto/src/main/java/org/springframework/security/crypto/password/NoOpPasswordEncoder.java +++ b/crypto/src/main/java/org/springframework/security/crypto/password/NoOpPasswordEncoder.java @@ -26,7 +26,8 @@ package org.springframework.security.crypto.password; * @deprecated This PasswordEncoder is not secure. Instead use an * adaptive one way function like BCryptPasswordEncoder, Pbkdf2PasswordEncoder, or * SCryptPasswordEncoder. Even better use {@link DelegatingPasswordEncoder} which supports - * password upgrades. + * password upgrades. There are no plans to remove this support. It is deprecated to indicate that + * this is a legacy implementation and using it is considered insecure. */ @Deprecated public final class NoOpPasswordEncoder implements PasswordEncoder {
Document NoOpPasswordEncoder will not be removed This commit adds extension to deprecation notice. Fixes gh-<I>
spring-projects_spring-security
train
java
957acb91f3275e0f1e69716551721ec9dd8a6235
diff --git a/gulpTaskFactory.js b/gulpTaskFactory.js index <HASH>..<HASH> 100644 --- a/gulpTaskFactory.js +++ b/gulpTaskFactory.js @@ -12,7 +12,7 @@ var concat = require('gulp-concat'), exports.gulpTaskFactory = function(gulpTask, options) { var task = function (gulpTask, options) { - var isJs = gulpTask.toString().endsWith('.js'), + var isJs = gulpTask.indexOf('.js') > 0, isCss = !isJs; if (options.concat !== undefined && options.concat.active && options.concat.config === undefined) {
Fixing gulpTaskFactory to work in older versions of nodejs.
m4l1c3_gulp-bundle-files
train
js
cdca7de94e94b80bd064463dd802e92eb8156daf
diff --git a/app/utils.js b/app/utils.js index <HASH>..<HASH> 100644 --- a/app/utils.js +++ b/app/utils.js @@ -112,7 +112,7 @@ _.extend(Helper.prototype, { }, setExecutable: function(filePath) { - fs.chownSync(this.$.destinationPath(filePath), '755'); + fs.chmodSync(this.$.destinationPath(filePath), '755'); }, /**
fix setting executable flag for gradlew
xvik_generator-lib-java
train
js
8292110aa234df2a2826905edaebcbc79961d363
diff --git a/tests/py/test_unittest.py b/tests/py/test_unittest.py index <HASH>..<HASH> 100644 --- a/tests/py/test_unittest.py +++ b/tests/py/test_unittest.py @@ -19,10 +19,17 @@ import unittest -def assertMultiLineEqual(self, a, b, msg=None): self.assertEqual(a,b,msg) -unittest.TestCase.assertMultiLineEqual = assertMultiLineEqual +# Monkey-patch a few unittest 2.7 features for Python 2.6. +# +# These are note the pretty versions provided by 2.7 but they do the +# same job as far as correctness is concerned. + +if not hasattr(unittest.TestCase, "assertMultiLineEqual"): + def assertMultiLineEqual(self, a, b, msg=None): self.assertEqual(a,b,msg) + unittest.TestCase.assertMultiLineEqual = assertMultiLineEqual -def assertIn(self, a, b, msg=None): self.assertTrue(a in b,msg) -unittest.TestCase.assertIn = assertIn +if not hasattr(unittest.TestCase, "assertIn"): + def assertIn(self, a, b, msg=None): self.assertTrue(a in b,msg) + unittest.TestCase.assertIn = assertIn
NO-JIRA: [c,cpp] fix monkey-patch of python <I> unittest features for python <I> Don't apply patch on versions that have the feature.
apache_qpid-proton
train
py
c61ec17dd124c48679e448a8ed345a98b33d3d38
diff --git a/autograder_sandbox/autograder_sandbox.py b/autograder_sandbox/autograder_sandbox.py index <HASH>..<HASH> 100644 --- a/autograder_sandbox/autograder_sandbox.py +++ b/autograder_sandbox/autograder_sandbox.py @@ -111,7 +111,8 @@ class AutograderSandbox: The default value for this parameter can be changed by setting the SANDBOX_MEM_LIMIT environment variable. - See https://docs.docker.com/config/containers/resource_constraints/#limit-a-containers-access-to-memory + See https://docs.docker.com/config/containers/resource_constraints/\ +#limit-a-containers-access-to-memory for more information. :param min_fallback_timeout: The timeout argument to run_command
Fixed pycodestyle warning.
eecs-autograder_autograder-sandbox
train
py
7c2fce23a4e557bb38bc5ebabbb6466784191d6b
diff --git a/packages/adapters/snapshot-adapters/resolve-snapshot-mysql/src/index.js b/packages/adapters/snapshot-adapters/resolve-snapshot-mysql/src/index.js index <HASH>..<HASH> 100644 --- a/packages/adapters/snapshot-adapters/resolve-snapshot-mysql/src/index.js +++ b/packages/adapters/snapshot-adapters/resolve-snapshot-mysql/src/index.js @@ -49,7 +49,7 @@ const loadSnapshot = async (pool, snapshotKey) => { const content = rows.length > 0 ? rows[0].SnapshotContent.toString() : null - return content != null ? content.SnapshotContent : null + return content != null ? JSON.parse(content) : null } const saveSnapshot = async (pool, snapshotKey, content) => { @@ -67,6 +67,8 @@ const saveSnapshot = async (pool, snapshotKey, content) => { } pool.counters.set(snapshotKey, 0) + const stringContent = JSON.stringify(content) + await pool.connection.execute( `INSERT INTO ${escapeId( pool.tableName @@ -74,7 +76,7 @@ const saveSnapshot = async (pool, snapshotKey, content) => { VALUES(?, ?) ON DUPLICATE KEY UPDATE \`SnapshotContent\` = ?`, - [snapshotKey, content, content] + [snapshotKey, stringContent, stringContent] ) }
Hotfixing snapshot mysql adapter stringifying conent (#<I>)
reimagined_resolve
train
js
4fc23d2b8632546255956ff1ad2723851f0967f5
diff --git a/src/Validators/PayloadValidator.php b/src/Validators/PayloadValidator.php index <HASH>..<HASH> 100644 --- a/src/Validators/PayloadValidator.php +++ b/src/Validators/PayloadValidator.php @@ -62,7 +62,7 @@ class PayloadValidator extends Validator */ protected function validateStructure(array $payload) { - if (count(array_diff_key($this->requiredClaims, array_keys($payload))) !== 0) { + if (count(array_diff($this->requiredClaims, array_keys($payload))) !== 0) { throw new TokenInvalidException('JWT payload does not contain the required claims'); }
Use array_diff to check presence of required claims
tymondesigns_jwt-auth
train
php
77a1c9cc44a0ffe737ce2ac22662cf427ed8e82a
diff --git a/lib/App/index.js b/lib/App/index.js index <HASH>..<HASH> 100644 --- a/lib/App/index.js +++ b/lib/App/index.js @@ -29,9 +29,9 @@ const VALIDATION_LEVELS = [ 'publish', ]; const IMAGE_MARKERS = { - '.jpg': new Buffer([ 0xFF, 0xD8 ]), - '.jpeg': new Buffer([ 0xFF, 0xD8 ]), - '.png': new Buffer([ 0x89, 0x50, 0x4e, 0x47 ]), + '.jpg': Buffer.from([ 0xFF, 0xD8 ]), + '.jpeg': Buffer.from([ 0xFF, 0xD8 ]), + '.png': Buffer.from([ 0x89, 0x50, 0x4e, 0x47 ]), } const IMAGE_SIZES = { 'app': { @@ -554,7 +554,7 @@ class App { filepath = join( this._path, filepath ); const fd = await openAsync(filepath, 'r'); - const buffer = new Buffer(numBytes); + const buffer = Buffer.from(numBytes); await readAsync(fd, buffer, 0, numBytes, 0); return buffer; }
new Buffer -> Buffer.from
athombv_node-homey-lib
train
js
6a7836cddcf3ae0322e76cd5f79f6dd9ea73a09c
diff --git a/mllib/src/test/java/org/apache/spark/mllib/recommendation/JavaALSSuite.java b/mllib/src/test/java/org/apache/spark/mllib/recommendation/JavaALSSuite.java index <HASH>..<HASH> 100644 --- a/mllib/src/test/java/org/apache/spark/mllib/recommendation/JavaALSSuite.java +++ b/mllib/src/test/java/org/apache/spark/mllib/recommendation/JavaALSSuite.java @@ -90,8 +90,8 @@ public class JavaALSSuite implements Serializable { double err = confidence * (truePref - prediction) * (truePref - prediction); sqErr += err; denom += 1.0; - } } + } double rmse = Math.sqrt(sqErr / denom); Assert.assertTrue(String.format("Confidence-weighted RMSE=%2.4f above threshold of %2.2f", rmse, matchThreshold), Math.abs(rmse) < matchThreshold);
Fixing closing brace indentation
apache_spark
train
java
fde732e0e9a4f224c5ae48ad942c6d955aa0a8e6
diff --git a/pylint/__pkginfo__.py b/pylint/__pkginfo__.py index <HASH>..<HASH> 100644 --- a/pylint/__pkginfo__.py +++ b/pylint/__pkginfo__.py @@ -22,7 +22,7 @@ from os.path import join # For an official release, use dev_version = None -numversion = (2, 4, 1) +numversion = (2, 4, 2) dev_version = None version = ".".join(str(num) for num in numversion)
Bump master to <I>
PyCQA_pylint
train
py
1ca5872a5a67bf8aa44f04650d87b42011cb7463
diff --git a/internal/plugin/plugin.go b/internal/plugin/plugin.go index <HASH>..<HASH> 100644 --- a/internal/plugin/plugin.go +++ b/internal/plugin/plugin.go @@ -33,6 +33,14 @@ var ( "myplugin": myplugin.CommandOptions, "otherplugin": otherplugin.CommandOptions, } + CacheableComponents = []component.Type{ + component.CommandType, + component.ConfigType, + component.HostType, + component.MapperType, + component.PluginInfoType, + component.PushType, + } ) type Plugin struct { @@ -186,8 +194,10 @@ func (p *Plugin) InstanceOf( return } - // Store the instance for later usage - p.components[c] = i + if p.isCacheable(c) { + // Store the instance for later usage + p.components[c] = i + } return } @@ -258,3 +268,13 @@ func (p *Plugin) loadParent(i *Instance) error { return nil } + +// Check if component type can be cached +func (p *Plugin) isCacheable(t component.Type) bool { + for _, v := range CacheableComponents { + if t == v { + return true + } + } + return false +}
Define component types which can be cached
hashicorp_vagrant
train
go
09b5d952ca3ba423da318045907df7b13555a835
diff --git a/lib/cabbage_doc/web.rb b/lib/cabbage_doc/web.rb index <HASH>..<HASH> 100644 --- a/lib/cabbage_doc/web.rb +++ b/lib/cabbage_doc/web.rb @@ -11,6 +11,8 @@ module CabbageDoc ROOT = File.expand_path("../../../web", __FILE__).freeze set :root, proc { + Configuration.instance.validate! + dir = File.join(Configuration.instance.root, 'web') if Dir.exists?(dir) dir
validate configuration in the mountable sinatra app
kapost_cabbage_doc
train
rb
f34031126ea2f5cb57ae9285320e5e36c71f5d43
diff --git a/lib/jasmine_rails/runner.rb b/lib/jasmine_rails/runner.rb index <HASH>..<HASH> 100644 --- a/lib/jasmine_rails/runner.rb +++ b/lib/jasmine_rails/runner.rb @@ -13,7 +13,7 @@ module JasmineRails File.open(runner_path, 'w') {|f| f << html.gsub('/assets', './assets')} phantomjs_runner_path = File.join(File.dirname(__FILE__), '..', 'assets', 'javascripts', 'jasmine-runner.js') - run_cmd %{phantomjs "#{phantomjs_runner_path}" "#{runner_path.to_s}?spec=#{spec_filter}"} + run_cmd %{"#{Phantomjs.path}" "#{phantomjs_runner_path}" "#{runner_path.to_s}?spec=#{spec_filter}"} end end
use phantomjs path if it's not in PATH
searls_jasmine-rails
train
rb
ba5fb5a2eb213b654b03247488327b8db1a52f32
diff --git a/raft/src/main/java/net/kuujo/copycat/raft/Raft.java b/raft/src/main/java/net/kuujo/copycat/raft/Raft.java index <HASH>..<HASH> 100644 --- a/raft/src/main/java/net/kuujo/copycat/raft/Raft.java +++ b/raft/src/main/java/net/kuujo/copycat/raft/Raft.java @@ -331,8 +331,6 @@ public class Raft implements Protocol, Managed<Raft> { @Override public Raft build() { - if (log == null) - throw new ConfigurationException("log not configured"); if (stateMachine == null) throw new ConfigurationException("state machine not configured"); if (cluster == null)
Allow Raft algorithm to be started without a log.
atomix_atomix
train
java
51ad6d41ca95a0128191bb2317a73029504881ac
diff --git a/keanu-project/src/test/java/io/improbable/keanu/network/BayesianNetworkTest.java b/keanu-project/src/test/java/io/improbable/keanu/network/BayesianNetworkTest.java index <HASH>..<HASH> 100644 --- a/keanu-project/src/test/java/io/improbable/keanu/network/BayesianNetworkTest.java +++ b/keanu-project/src/test/java/io/improbable/keanu/network/BayesianNetworkTest.java @@ -10,7 +10,7 @@ import org.junit.Before; import org.junit.Test; import io.improbable.keanu.vertices.bool.BoolVertex; -import io.improbable.keanu.vertices.bool.probabilistic.Flip; +import io.improbable.keanu.vertices.bool.probabilistic.BernoulliVertex; public class BayesianNetworkTest { @@ -21,8 +21,8 @@ public class BayesianNetworkTest { @Before public void setUpNetwork() { - input1 = new Flip(0.25); - input2 = new Flip(0.75); + input1 = new BernoulliVertex(0.25); + input2 = new BernoulliVertex(0.75); output = input1.or(input2); network = new BayesianNetwork(output.getConnectedGraph());
fixed compile error in test after merge
improbable-research_keanu
train
java
be09e5a90dc759d86c6a96f89e5e9c82cb9f1cae
diff --git a/cake/libs/folder.php b/cake/libs/folder.php index <HASH>..<HASH> 100644 --- a/cake/libs/folder.php +++ b/cake/libs/folder.php @@ -530,7 +530,10 @@ class Folder extends Object{ * @return boolean Success * @access public */ - function delete($path) { + function delete($path = null) { + if (!$path) { + $path = $this->pwd(); + } $path = $this->slashTerm($path); if (is_dir($path) === true) { $files = glob($path . "*", GLOB_NOSORT); diff --git a/cake/tests/cases/libs/folder.test.php b/cake/tests/cases/libs/folder.test.php index <HASH>..<HASH> 100644 --- a/cake/tests/cases/libs/folder.test.php +++ b/cake/tests/cases/libs/folder.test.php @@ -106,6 +106,17 @@ class FolderTest extends UnitTestCase { $result = $Folder->delete($mv); $this->assertTrue($result); + + $new = TMP . 'test_folder_new'; + $result = $Folder->create($new); + $this->assertTrue($result); + + $result = $Folder->cd($new); + $this->assertTrue($result); + + $result = $Folder->delete(); + $this->assertTrue($result); + } function testRealPathForWebroot() {
closes #<I>, Folder delete does not require path git-svn-id: <URL>
cakephp_cakephp
train
php,php
4ac0e7fd0cb30597e54c3ad87a2895d1165eb3fc
diff --git a/inc/posttype/namespace.php b/inc/posttype/namespace.php index <HASH>..<HASH> 100644 --- a/inc/posttype/namespace.php +++ b/inc/posttype/namespace.php @@ -71,7 +71,7 @@ function register_post_types() { 'capability_type' => 'page', 'has_archive' => true, 'hierarchical' => true, - 'supports' => [ 'title', 'editor', 'page-attributes' ], + 'supports' => [ 'title', 'editor', 'page-attributes', 'revisions' ], 'show_in_menu' => false, 'show_in_admin_bar' => true, 'show_in_rest' => true,
Add revisions support to parts (#<I>)
pressbooks_pressbooks
train
php
cf47b4dd84d76db66b194a12177a75e067b3b16f
diff --git a/Tests/Command/InfoDoctrineCommandTest.php b/Tests/Command/InfoDoctrineCommandTest.php index <HASH>..<HASH> 100644 --- a/Tests/Command/InfoDoctrineCommandTest.php +++ b/Tests/Command/InfoDoctrineCommandTest.php @@ -25,9 +25,6 @@ class InfoDoctrineCommandTest extends TestCase $testContainer = $this->createYamlBundleTestContainer(); $kernel = $this->getMock('Symfony\Component\HttpKernel\Kernel', array(), array(), '', false); $kernel->expects($this->once()) - ->method('getBundles') - ->will($this->returnValue(array())); - $kernel->expects($this->once()) ->method('getContainer') ->will($this->returnValue($testContainer)); $application = new Application($kernel);
changed Application to have nice error messages when something bad happens early on the CLI
doctrine_DoctrineBundle
train
php
57c703ea62b881e094fca673db3b074965d3f401
diff --git a/monty/pprint.py b/monty/pprint.py index <HASH>..<HASH> 100644 --- a/monty/pprint.py +++ b/monty/pprint.py @@ -5,7 +5,8 @@ Pretty printing functions. from io import StringIO import sys - +from json import JSONEncoder, loads +from IPython.display import JSON, display def pprint_table(table, out=sys.stdout, rstrip=False): """ @@ -81,3 +82,27 @@ def _draw_tree(node, prefix, child_iter, text_str): buf.write(_draw_tree(child, sub_prefix, child_iter, text_str)) return buf.getvalue() + +class DisplayEcoder(JSONEncoder): + def default(self, o): + try: + return o.as_dict() + except Exception: + try: + return o.__dict__ + except Exception: + return str(o) + +def pprint_json(data): + """ + Display a tree-like object in a jupyter notebook. + Allows for collapsable interactive interaction with data. + + Args: + data: a dictionary or object + + Based on: + https://gist.github.com/jmmshn/d37d5a1be80a6da11f901675f195ca22 + + """ + display(JSON(loads(DisplayEcoder().encode(data)))) \ No newline at end of file
added helper function to display tree-like objects fixed
materialsvirtuallab_monty
train
py
168ffa2e130f874223251bf0062c21645daf39af
diff --git a/raven/utils/http.py b/raven/utils/http.py index <HASH>..<HASH> 100644 --- a/raven/utils/http.py +++ b/raven/utils/http.py @@ -48,7 +48,11 @@ def urlopen(url, data=None, timeout=defaults.TIMEOUT, ca_certs=None, if verify_ssl: handlers = [ValidHTTPSHandler] else: - handlers = [] + try: + handlers = [urllib2.HTTPSHandler( + context=ssl._create_unverified_context())] + except AttributeError: + handlers = [] opener = urllib2.build_opener(*handlers)
Fix disabling of ssl certs check with python <I>/<I>
getsentry_raven-python
train
py
50759ee2b14fe8b6cf3108172db156d67826dc1c
diff --git a/lib/ApiWeb.php b/lib/ApiWeb.php index <HASH>..<HASH> 100644 --- a/lib/ApiWeb.php +++ b/lib/ApiWeb.php @@ -335,6 +335,10 @@ class ApiWeb extends ApiCLI { // }}} // {{{ Miscelanious Functions + /** Render only specified object or object with specified name */ + function cut($object){ + $_GET['cut_object']=is_object($object)?$object->name:$object; + } /** Perform instant redirect to another page */ function redirect($page=null,$args=array()){ /**
A better way to cut an object, instead of messing with _GET directly
atk4_atk4
train
php
d09cd9ef89e9860c7b972cba9fcb1736f4de17c7
diff --git a/lib/node_modules/@stdlib/repl/lib/context/regexp/index.js b/lib/node_modules/@stdlib/repl/lib/context/regexp/index.js index <HASH>..<HASH> 100644 --- a/lib/node_modules/@stdlib/repl/lib/context/regexp/index.js +++ b/lib/node_modules/@stdlib/repl/lib/context/regexp/index.js @@ -7,6 +7,9 @@ var NS = {}; var getKeys = require( 'object-keys' ).shim(); NS.RE_EOL = require( '@stdlib/regexp/eol' ); +NS.RE_DIRNAME = require( '@stdlib/regexp/dirname' ); +NS.RE_DIRNAME_POSIX = require( '@stdlib/regexp/dirname-posix' ); +NS.RE_DIRNAME_WINDOWS = require( '@stdlib/regexp/dirname-windows' ); NS.RE_EXTNAME = require( '@stdlib/regexp/extname' ); NS.RE_EXTNAME_POSIX = require( '@stdlib/regexp/extname-posix' ); NS.RE_EXTNAME_WINDOWS = require( '@stdlib/regexp/extname-windows' );
Add dirname RegExps to REPL context
stdlib-js_stdlib
train
js
5b526c5cb7dcc8eb97eb420898fc2456cf2bcd42
diff --git a/core/src/main/java/io/undertow/util/ImmediateAuthenticationMechanismFactory.java b/core/src/main/java/io/undertow/util/ImmediateAuthenticationMechanismFactory.java index <HASH>..<HASH> 100644 --- a/core/src/main/java/io/undertow/util/ImmediateAuthenticationMechanismFactory.java +++ b/core/src/main/java/io/undertow/util/ImmediateAuthenticationMechanismFactory.java @@ -20,6 +20,6 @@ public class ImmediateAuthenticationMechanismFactory implements AuthenticationMe @Override public AuthenticationMechanism create(String mechanismName, FormParserFactory formParserFactory, Map<String, String> properties) { - return null; + return authenticationMechanism; } }
Fixed NPE and problem in which custom AuthenticationMechanisms aren't used The DeploymentInfo wraps an AuthenticationMechanism with a ImmediateAuthenticationMechanismFactory. However, that factory always returns null when create() is called. Fix is to simply returns the AuthenticationMechanism that was provided to it during construction.
undertow-io_undertow
train
java
f612ebd2d32516d61ca1d573d5861b5252c7a878
diff --git a/bin/release.py b/bin/release.py index <HASH>..<HASH> 100755 --- a/bin/release.py +++ b/bin/release.py @@ -329,7 +329,7 @@ def release(): prettyprint("Step 6: Uploading Artifacts", Levels.INFO) do_task(upload_artifacts, [base_dir, version], async_processes) - do_task(upload_artifacts, [base_dir % "as-modules", version], async_processes) + do_task(upload_artifacts, [base_dir + "/as-modules", version], async_processes) prettyprint("Step 6: Complete", Levels.INFO) prettyprint("Step 7: Uploading to configuration XML schema", Levels.INFO)
ISPN-<I> Issue with the release script (bin/release.py)
infinispan_infinispan
train
py
d0e37979ccbe9e1e7fa237f41d6fca47e8d9481a
diff --git a/index.js b/index.js index <HASH>..<HASH> 100644 --- a/index.js +++ b/index.js @@ -11,3 +11,4 @@ exports.RangeIterator = require('./lib/RangeIterator'); exports.SubsetIterator = require('./lib/SubsetIterator'); exports.PermutationIterator = require('./lib/PermutationIterator'); exports.TransformIterator = require('./lib/TransformIterator'); +exports.RepeatIterator = require('./lib/RepeatIterator');
Oops, need to actually expose RepeatIterator to be able to use it
thelonious_kld-array-iterators
train
js
cb714803f8b09ae483659eb4108e28184748e928
diff --git a/lib/codemirror.js b/lib/codemirror.js index <HASH>..<HASH> 100644 --- a/lib/codemirror.js +++ b/lib/codemirror.js @@ -2582,6 +2582,7 @@ // Reset the input to correspond to the selection (or to be empty, // when not typing and nothing is selected) function resetInput(cm, typing) { + if (cm.display.contextMenuPending) return; var minimal, selected, doc = cm.doc; if (cm.somethingSelected()) { cm.display.prevInput = ""; @@ -3446,6 +3447,7 @@ resetInput(cm); // Adds "Select all" to context menu in FF if (!cm.somethingSelected()) display.input.value = display.prevInput = " "; + display.contextMenuPending = true; display.selForContextMenu = cm.doc.sel; clearTimeout(display.detectingSelectAll); @@ -3464,6 +3466,7 @@ } } function rehide() { + display.contextMenuPending = false; display.inputDiv.style.position = "relative"; display.input.style.cssText = oldCSS; if (ie && ie_version < 9) display.scrollbars.setScrollTop(display.scroller.scrollTop = scrollPos);
Prevent resetInput from breaking context menu 'select all' in FF Closes #<I>
codemirror_CodeMirror
train
js
2344247d0eb665ff5a6ed20b3776b27f4ffc1838
diff --git a/test/simple.test.js b/test/simple.test.js index <HASH>..<HASH> 100644 --- a/test/simple.test.js +++ b/test/simple.test.js @@ -47,13 +47,6 @@ test('GET /_ping => pong', async (t) => { t.true(stdout[0].includes('GET /_ping')) }) -test('GET /_routes => 200 with routes', async (t) => { - const { statusCode, body } = await $get('/_routes') - t.is(statusCode, 200) - t.true(Array.isArray(body)) - t.true(body.length > 0) -}) - test('GET /404 => 404 status code', async (t) => { const { statusCode, body } = await $get('/404') t.is(statusCode, 404)
test: Remove _routes test
mono-js_mono
train
js
30596d2f67fb334e86a4302c02c91086509b30de
diff --git a/lib/handlers/ReactNative.js b/lib/handlers/ReactNative.js index <HASH>..<HASH> 100644 --- a/lib/handlers/ReactNative.js +++ b/lib/handlers/ReactNative.js @@ -469,7 +469,21 @@ class RecvHandler extends Handler const localId = id; const mid = kind; - const streamId = rtpParameters.rtcp.cname; + let streamId = rtpParameters.rtcp.cname; + + // NOTE: In iOS we cannot reuse the same remote MediaStream for new remote + // tracks. This is because the libwebrtc ObjC bindgins do not react on new + // tracks generated within already existing streams (a terrible bug the + // libwebrtc team will never fix). So force the streamId to be different. + const { Platform } = require('react-native'); + + if (Platform.OS === 'ios') + { + logger.debug( + 'receive() | forcing a random remote streamId to avoid well known bug in libwebrtc for iOS'); + + streamId += `-hack-iOS-${utils.generateRandomNumber()}`; + } this._remoteSdp.receive( {
Hack for #<I> (to avoid bug in ObjC bindings of libwebrtc in iOS)
versatica_mediasoup-client
train
js
2a21ce52b873c7656882c9103517ad339fab5877
diff --git a/spec/features/thredded/user_replies_to_post_spec.rb b/spec/features/thredded/user_replies_to_post_spec.rb index <HASH>..<HASH> 100644 --- a/spec/features/thredded/user_replies_to_post_spec.rb +++ b/spec/features/thredded/user_replies_to_post_spec.rb @@ -73,8 +73,10 @@ feature 'User replying to topic' do end def posts_exist_in_a_topic - topic = create(:topic, messageboard: messageboard) - posts = create_list(:post, 2, postable: topic, messageboard: messageboard) - PageObject::Posts.new(posts) + topic = create(:topic, + with_posts: 2, + messageboard: messageboard, + user: create(:user, name: 'R2D2')) + PageObject::Posts.new(topic.posts) end end
Fix flaky user_replies_to_post_spec.rb Avoid creating users with the same prefix as the user we auto-complete. Example failure: <URL>
thredded_thredded
train
rb
424ee7f1b7de0dcff7f06c87687f9cd8161671ba
diff --git a/dvc/tree/base.py b/dvc/tree/base.py index <HASH>..<HASH> 100644 --- a/dvc/tree/base.py +++ b/dvc/tree/base.py @@ -3,7 +3,7 @@ import json import logging import tempfile from concurrent.futures import ThreadPoolExecutor, as_completed -from functools import partial, wraps +from functools import partial from multiprocessing import cpu_count from operator import itemgetter from urllib.parse import urlparse @@ -55,24 +55,6 @@ class RemoteMissingDepsError(DvcException): pass -class DirCacheError(DvcException): - def __init__(self, hash_): - super().__init__( - f"Failed to load dir cache for hash value: '{hash_}'." - ) - - -def index_locked(f): - @wraps(f) - def wrapper(obj, named_cache, remote, *args, **kwargs): - if hasattr(remote, "index"): - with remote.index: - return f(obj, named_cache, remote, *args, **kwargs) - return f(obj, named_cache, remote, *args, **kwargs) - - return wrapper - - class BaseRemoteTree: scheme = "base" REQUIRES = {}
tree: remove duplicated code (#<I>) Leftover from remote/tree separation.
iterative_dvc
train
py
4e882a9c3351a961a356dc1570f24ae9de8b386f
diff --git a/php/WP_CLI/CommandWithTranslation.php b/php/WP_CLI/CommandWithTranslation.php index <HASH>..<HASH> 100644 --- a/php/WP_CLI/CommandWithTranslation.php +++ b/php/WP_CLI/CommandWithTranslation.php @@ -178,6 +178,7 @@ abstract class CommandWithTranslation extends \WP_CLI_Command { 'language' => 'en_US', 'english_name' => 'English (United States)', 'native_name' => 'English (United States)', + 'updated' => '', ); array_push( $translations, $en_us );
Prevent error caused by #<I> by ensuring item confirms to expected
wp-cli_export-command
train
php
251cafe5e4eec2b8214fc59a72537d8b28d280f7
diff --git a/plugins/providers/virtualbox/action/destroy_unused_network_interfaces.rb b/plugins/providers/virtualbox/action/destroy_unused_network_interfaces.rb index <HASH>..<HASH> 100644 --- a/plugins/providers/virtualbox/action/destroy_unused_network_interfaces.rb +++ b/plugins/providers/virtualbox/action/destroy_unused_network_interfaces.rb @@ -13,8 +13,8 @@ module VagrantPlugins if env[:machine].provider_config.destroy_unused_network_interfaces @logger.info("Destroying unused network interfaces...") env[:machine].provider.driver.delete_unused_host_only_networks - @app.call(env) end + @app.call(env) end end end
Call the rest of the middleware stack all the time.
hashicorp_vagrant
train
rb
b2d7eb89e82c94a140180dc84c467fc13b00e00f
diff --git a/lib/dm-core/associations/many_to_many.rb b/lib/dm-core/associations/many_to_many.rb index <HASH>..<HASH> 100644 --- a/lib/dm-core/associations/many_to_many.rb +++ b/lib/dm-core/associations/many_to_many.rb @@ -233,6 +233,12 @@ module DataMapper raise NotImplementedError end + def save + # TODO: create the new intermediaries + # TODO: destroy the orphaned intermediaries + raise NotImplementedError + end + def destroy # TODO: destroy the intermediaries # TODO: destroy the resources in the child model @@ -245,6 +251,17 @@ module DataMapper raise NotImplementedError end + private + + def relate_resource(resource) + # TODO: queue up new intermediaries for creation + raise NotImplementedError + end + + def orphan_resource(resource) + # TODO: queue up orphaned intermediaries for destruction + raise NotImplementedError + end end # class Collection end # module ManyToMany end # module Associations
Stubbed more of ManyToMany::Collection
datamapper_dm-core
train
rb
487b741947c10bbceb854b7357dad43ac4222f98
diff --git a/src/lib/generator.js b/src/lib/generator.js index <HASH>..<HASH> 100644 --- a/src/lib/generator.js +++ b/src/lib/generator.js @@ -14,6 +14,7 @@ import generateEditorconfig from './subgenerators/generate-swap-editorconfig/gen import generateNpmrc from './subgenerators/generate-swap-npmrc/generator' import generateContribute from './subgenerators/generate-swap-contribute/generator' import generateLicense from './subgenerators/generate-swap-license/generator' +import generateMain from './subgenerators/generate-swap-main/generator' import promptTask from './tasks/prompt' @@ -41,6 +42,7 @@ export default function (app) { app.register('npmrc', generateNpmrc) app.register('contribute', generateContribute) app.register('license', generateLicense) + app.register('main', generateMain) /** * Scaffold out a(n) swap-project project. Also aliased as the [default](#default) task.
register swap-main as sub-generator
sirap-group_generate-swap-project
train
js
2c971c53ca347708af01a64bed325cdc9e66c859
diff --git a/lib/lentil/instagram_harvester.rb b/lib/lentil/instagram_harvester.rb index <HASH>..<HASH> 100644 --- a/lib/lentil/instagram_harvester.rb +++ b/lib/lentil/instagram_harvester.rb @@ -20,7 +20,7 @@ module Lentil def configure_connection(opts = {}) opts['client_id'] ||= Lentil::Engine::APP_CONFIG["instagram_client_id"] opts['client_secret'] ||= Lentil::Engine::APP_CONFIG["instagram_client_secret"] - opts['access_token'] ||= nil + opts['access_token'] ||= Lentil::Engine::APP_CONFIG["instagram_access_token"] || nil Instagram.configure do |config| config.client_id = opts['client_id'] @@ -218,7 +218,7 @@ module Lentil response.body end - + # # Retrieve the binary video data for a given Image object #
Look for access_token in config file
NCSU-Libraries_lentil
train
rb
aa5655dddf5fa153a271f746c5e2605a1aa681c1
diff --git a/src/Extension/ConfigTrait.php b/src/Extension/ConfigTrait.php index <HASH>..<HASH> 100644 --- a/src/Extension/ConfigTrait.php +++ b/src/Extension/ConfigTrait.php @@ -49,7 +49,11 @@ trait ConfigTrait $filesystem->getFile(sprintf('config://extensions/%s.%s.yml', strtolower($this->getName()), strtolower($this->getVendor())), $file); if (!$file->exists()) { - $this->copyDistFile($file); + try { + $this->copyDistFile($file); + } catch (\RuntimeException $e) { + return $this->config; + } } $this->addConfig($file); @@ -98,7 +102,7 @@ trait ConfigTrait /** @var YamlFile $distFile */ $distFile = $filesystem->get(sprintf('%s/config/config.yml.dist', $this->getBaseDirectory()->getPath()), new YamlFile()); if (!$distFile->exists()) { - return; + throw new \RuntimeException(sprintf('No config.yml.dist file found at extensions://%s', $this->getBaseDirectory()->getPath())); } $file->write($distFile->read()); $app['logger.system']->info(
Throw & catch an exception if and extension is missing config.yml.dist
bolt_bolt
train
php
9a98be5ad08813d532694f95c480b0bcbecd0da6
diff --git a/lib/chef/http.rb b/lib/chef/http.rb index <HASH>..<HASH> 100644 --- a/lib/chef/http.rb +++ b/lib/chef/http.rb @@ -242,12 +242,8 @@ class Chef raise Chef::Exceptions::RedirectLimitExceeded if @redirects_followed >= redirect_limit @redirects_followed += 1 Chef::Log.debug("Following redirect #{@redirects_followed}/#{redirect_limit}") - if @sign_on_redirect - yield - else - @authenticator.sign_request = false - yield - end + + yield ensure @redirects_followed = 0 @authenticator.sign_request = true diff --git a/lib/chef/rest.rb b/lib/chef/rest.rb index <HASH>..<HASH> 100644 --- a/lib/chef/rest.rb +++ b/lib/chef/rest.rb @@ -192,6 +192,14 @@ class Chef end end + def follow_redirect + unless @sign_on_redirect + @authenticator.sign_request = false + end + super + ensure + @authenticator.sign_request = true + end private def stream_to_tempfile(url, response)
Remove references to authenticator from base HTTP class
chef_chef
train
rb,rb
c79c74a2d655a5cc5d0f9defc3816a17433279ae
diff --git a/GPy/testing/link_function_tests.py b/GPy/testing/link_function_tests.py index <HASH>..<HASH> 100644 --- a/GPy/testing/link_function_tests.py +++ b/GPy/testing/link_function_tests.py @@ -7,7 +7,6 @@ _lim_val_exp = np.log(_lim_val) _lim_val_square = np.sqrt(_lim_val) _lim_val_cube = cbrt(_lim_val) from GPy.likelihoods.link_functions import Identity, Probit, Cloglog, Log, Log_ex_1, Reciprocal, Heaviside -#np.seterr(over='raise') class LinkFunctionTests(np.testing.TestCase): def setUp(self): @@ -80,8 +79,7 @@ class LinkFunctionTests(np.testing.TestCase): assert np.isinf(np.exp(np.log(self.f_upper_lim))) #Check the clipping works np.testing.assert_almost_equal(link.transf(self.f_lower_lim), 0, decimal=5) - #Need to look at most significant figures here rather than the decimals - np.testing.assert_approx_equal(link.transf(self.f_upper_lim), _lim_val, significant=5) + self.assertTrue(np.isfinite(link.transf(self.f_upper_lim))) self.check_overflow(link, lim_of_inf) #Check that it would otherwise fail
tidied link_fn tests
SheffieldML_GPy
train
py
0d9efeb839733e62bb22a8323c75bccd844f1f35
diff --git a/src/semantic_tree/semantic_tree.js b/src/semantic_tree/semantic_tree.js index <HASH>..<HASH> 100644 --- a/src/semantic_tree/semantic_tree.js +++ b/src/semantic_tree/semantic_tree.js @@ -1028,11 +1028,16 @@ sre.SemanticTree.prototype.processRelationsInRow_ = function(nodes) { var children = partition.comp.map( goog.bind(this.processOperationsInRow_, this)); if (partition.rel.some( - function(x) {return x.role !== firstRel.role;})) { - return this.makeBranchNode_( + function(x) {return !x.equals(firstRel);})) { + var node = this.makeBranchNode_( sre.SemanticAttr.Type.MULTIREL, children, partition.rel); + if (partition.rel.every( + function(x) {return x.role === firstRel.role;})) { + node.role = firstRel.role; + } + return node; } - var node = this.makeBranchNode_(sre.SemanticAttr.Type.RELSEQ, + node = this.makeBranchNode_(sre.SemanticAttr.Type.RELSEQ, children, partition.rel, sre.SemanticTree.getEmbellishedInner_(firstRel).textContent); node.role = firstRel.role;
Slightly less intrusive change of semantic tree structure: Giving the multirel element a role if all the children roles are the same.
zorkow_speech-rule-engine
train
js
9253e427db4bce9a154f840e4cb833b8c8c1f6f8
diff --git a/wallace/nodes.py b/wallace/nodes.py index <HASH>..<HASH> 100644 --- a/wallace/nodes.py +++ b/wallace/nodes.py @@ -4,6 +4,7 @@ from wallace.models import Node, Info from wallace.information import State import random from sqlalchemy import and_ +from sqlalchemy.ext.hybrid import hybrid_property class Agent(Node): @@ -12,16 +13,21 @@ class Agent(Node): __mapper_args__ = {"polymorphic_identity": "agent"} - def set_fitness(self, fitness): - self.property1 = repr(fitness) - - @property + @hybrid_property def fitness(self): if self.property1 is None: return None else: return float(self.property1) + @fitness.setter + def fitness(self, fitness): + self.property1 = repr(fitness) + + @fitness.expression + def generation(self): + return self.property1.label('fitness') + class ReplicatorAgent(Agent):
make fitness a hybrid_property with a setter
berkeley-cocosci_Wallace
train
py
0746ae3966a1d364025c9c98db61976edc4533de
diff --git a/lib/Gitlab/Api/Projects.php b/lib/Gitlab/Api/Projects.php index <HASH>..<HASH> 100644 --- a/lib/Gitlab/Api/Projects.php +++ b/lib/Gitlab/Api/Projects.php @@ -828,7 +828,7 @@ class Projects extends AbstractApi */ public function removeShare($project_id, $group_id) { - return $this->delete($this->getProjectPath($project_id, 'services/'.$group_id)); + return $this->delete($this->getProjectPath($project_id, 'share/' . $group_id)); } /**
fix Projects::removeShare (service/ was used instead of share/)
m4tthumphrey_php-gitlab-api
train
php
e86c955dc8047a2d6489b2ad0a85c9a5de2f37a3
diff --git a/pypsa/linopf.py b/pypsa/linopf.py index <HASH>..<HASH> 100644 --- a/pypsa/linopf.py +++ b/pypsa/linopf.py @@ -244,6 +244,10 @@ def define_ramp_limit_constraints(n, sns, c): return fix_i = get_non_extendable_i(n, c) ext_i = get_extendable_i(n, c) + if "committable" in n.df(c): + com_i = n.df(c).query('committable').index.difference(ext_i) + else: + com_i = [] p = get_var(n, c, 'p').loc[sns[1:]] p_prev = get_var(n, c, 'p').shift(1).loc[sns[1:]] active = get_activity_mask(n, c, sns[1:]) @@ -282,10 +286,7 @@ def define_ramp_limit_constraints(n, sns, c): kwargs = dict(spec='ext.', mask=active[gens_i]) define_constraints(n, lhs, '>=', 0, c, 'mu_ramp_limit_down', **kwargs) - if "committable" in n.df(c): - com_i = n.df(c).query('committable').index.difference(ext_i) - else: - com_i = [] + # com up gens_i = rup_i.intersection(com_i)
moved the `committable` conditional
PyPSA_PyPSA
train
py
1953f9310f4d8eca79eb4f67e98e5d833c5daf4c
diff --git a/pkg/minikube/download/preload.go b/pkg/minikube/download/preload.go index <HASH>..<HASH> 100644 --- a/pkg/minikube/download/preload.go +++ b/pkg/minikube/download/preload.go @@ -41,7 +41,7 @@ const ( // PreloadVersion is the current version of the preloaded tarball // // NOTE: You may need to bump this version up when upgrading auxiliary docker images - PreloadVersion = "v5" + PreloadVersion = "v6" // PreloadBucket is the name of the GCS bucket where preloaded volume tarballs exist PreloadBucket = "minikube-preloaded-volume-tarballs" )
Increase preload version to v6 We upgraded the dashboard image in #<I>, this will rebuild tarballs to include the latest version. This should also fix a small performance regression, where start time was increased by <I>% on kvm2, probably becaues we were waiting for the new dashboard image to download. [PR bot comment](<URL>)
kubernetes_minikube
train
go
1239f6fe2ca74b24ec31af36b8f79e13fa0dfea9
diff --git a/django_extensions/management/commands/sqldiff.py b/django_extensions/management/commands/sqldiff.py index <HASH>..<HASH> 100644 --- a/django_extensions/management/commands/sqldiff.py +++ b/django_extensions/management/commands/sqldiff.py @@ -449,7 +449,7 @@ class SQLDiff(object): table_name = meta.db_table app_label = meta.app_label - if meta.proxy: + if self.options.get('include_proxy_models', False) and meta.proxy: continue if cur_app_label != app_label: @@ -918,6 +918,10 @@ to check/debug ur models compared to the real database tables and columns.""" '--output_text', '-t', action='store_false', dest='sql', default=True, help="Outputs the differences as descriptive text instead of SQL") + parser.add_argument( + '--include-proxy-models', action='store_true', dest='include_proxy_models', + default=False, + help="Include proxy models in the graph") def __init__(self, *args, **kwargs): super(Command, self).__init__(*args, **kwargs)
add cli support for adding proxy models back in the diff
django-extensions_django-extensions
train
py
42ed39fdc2bb08208e0dd089757696ced069c446
diff --git a/mesh_tensorflow/transformer/transformer.py b/mesh_tensorflow/transformer/transformer.py index <HASH>..<HASH> 100644 --- a/mesh_tensorflow/transformer/transformer.py +++ b/mesh_tensorflow/transformer/transformer.py @@ -997,7 +997,7 @@ class Unitransformer(object): mesh_shape=self.mesh_shape, layout=self.layout) return mtf.gather( - beams, mtf.constant(inputs.mesh, 2, dtype=tf.int32), beam_dim) + beams, mtf.constant(inputs.mesh, 0, dtype=tf.int32), beam_dim) @gin.configurable
Revert a mistake I made in cl/<I> . This should fix beam search. PiperOrigin-RevId: <I>
tensorflow_mesh
train
py
c19dfcb9b2310a03f7942429996be86e988d204e
diff --git a/baggageclaimcmd/driver_linux.go b/baggageclaimcmd/driver_linux.go index <HASH>..<HASH> 100644 --- a/baggageclaimcmd/driver_linux.go +++ b/baggageclaimcmd/driver_linux.go @@ -51,7 +51,7 @@ func (cmd *BaggageclaimCommand) driver(logger lager.Logger) (volume.Driver, erro volumesDir := cmd.VolumesDir.Path() - if cmd.Driver == "btrfs" && fsStat.Type != btrfsFSType { + if cmd.Driver == "btrfs" && uint32(fsStat.Type) != btrfsFSType { volumesImage := volumesDir + ".img" filesystem := fs.New(logger.Session("fs"), volumesImage, volumesDir, cmd.MkfsBin)
baggageclaimcmd: fix build issues on <I>bit platforms fsStat.Type is int<I> on <I>bit platforms and 0x<I>e overflows it.
concourse_baggageclaim
train
go
5d3d88e09079d0591d7c1f6a703df164b63d43c0
diff --git a/code/plugins/system/koowa/pattern/observer.php b/code/plugins/system/koowa/pattern/observer.php index <HASH>..<HASH> 100644 --- a/code/plugins/system/koowa/pattern/observer.php +++ b/code/plugins/system/koowa/pattern/observer.php @@ -25,7 +25,7 @@ interface KPatternObserver * @param object An associative array of arguments * @return mixed */ - public function update(ArrayObject $args); + public function update(KConfig $args); /** * This function returns an unique identifier for the object. This id can be used as
Update method should use KConfig instead of ArrayObject as parameter.
joomlatools_joomlatools-framework
train
php
7bb0550a0dd2aa1e16a00268dd6c1f58f69d7285
diff --git a/core-bundle/contao/library/Contao/Database/Updater.php b/core-bundle/contao/library/Contao/Database/Updater.php index <HASH>..<HASH> 100644 --- a/core-bundle/contao/library/Contao/Database/Updater.php +++ b/core-bundle/contao/library/Contao/Database/Updater.php @@ -375,6 +375,14 @@ class Updater extends \Controller ->execute(serialize($arrCss), $objLayout->id); } + // Add the jQuery fields if they do not yet exist (see #5689) + if (!$this->Database->fieldExists('addJQuery', 'tl_layout')) + { + $this->Database->query("ALTER TABLE `tl_layout` ADD `addJQuery` char(1) NOT NULL default ''"); + $this->Database->query("ALTER TABLE `tl_layout` ADD `jSource` varchar(16) NOT NULL default ''"); + $this->Database->query("ALTER TABLE `tl_layout` ADD `jquery` text NULL"); + } + // Get all page layouts that use the moo_mediabox template $objLayout = $this->Database->query("SELECT `id`, `addJQuery`, `jquery`, `mootools` FROM `tl_layout` WHERE `addMooTools`=1 AND `mootools` LIKE '%\"moo_mediaelement\"%'");
[Core] Make sure the jQuery related database fields exist when the version <I> update is executed (see <I>)
contao_contao
train
php
eb40f6f892b0fd8eb81e3f1a40dcc3205f8eaf93
diff --git a/tests/test_pipenv.py b/tests/test_pipenv.py index <HASH>..<HASH> 100644 --- a/tests/test_pipenv.py +++ b/tests/test_pipenv.py @@ -843,6 +843,29 @@ requests = "*" c = p.pipenv('install') assert c.return_code == 0 + @pytest.mark.extras + @pytest.mark.lock + @pytest.mark.requirements + @pytest.mark.complex + def test_complex_lock_deep_extras(self): + # records[pandas] requires tablib[pandas] which requires pandas. + + with PipenvInstance() as p: + with open(p.pipfile_path, 'w') as f: + contents = """ +[packages] +records = {extras = ["pandas"], version = "==0.5.2"} + """.strip() + f.write(contents) + + c = p.pipenv('lock') + assert c.return_code == 0 + assert 'tablib' in p.lockfile['default'] + assert 'pandas' in p.lockfile['default'] + + c = p.pipenv('install') + assert c.return_code == 0 + @pytest.mark.lock @pytest.mark.deploy def test_deploy_works(self):
Test confirming that deep extras resolves works
pypa_pipenv
train
py
5623fcf52e4cd624dc1a0ccecb0587f6eb181ffe
diff --git a/cheroot/test/test_ssl.py b/cheroot/test/test_ssl.py index <HASH>..<HASH> 100644 --- a/cheroot/test/test_ssl.py +++ b/cheroot/test/test_ssl.py @@ -31,8 +31,6 @@ from ..testing import ( IS_LIBRESSL_BACKEND = ssl.OPENSSL_VERSION.startswith('LibreSSL') PY27 = sys.version_info[:2] == (2, 7) -PY37 = sys.version_info[:2] == (3, 7) -PY38 = sys.version_info[:2] == (3, 8) fails_under_py3 = pytest.mark.xfail( @@ -323,7 +321,7 @@ def test_http_over_https_error(ca, adapter_type, tls_http_server, ip_addr): expect_fallback_response_over_plain_http = ( (adapter_type == 'pyopenssl' - and (IS_ABOVE_OPENSSL10 or PY37 or PY38)) + and (IS_ABOVE_OPENSSL10 or six.PY3)) or PY27 ) if expect_fallback_response_over_plain_http:
Expect nice behavior from py3+pyopenssl
cherrypy_cheroot
train
py
5343057dbc9c327955d16bec0237ebe996053e90
diff --git a/lib/data_mapper.rb b/lib/data_mapper.rb index <HASH>..<HASH> 100644 --- a/lib/data_mapper.rb +++ b/lib/data_mapper.rb @@ -108,4 +108,7 @@ module DataMapper Repository.context.pop end end + + # A logger should always be present. + Logger.new(nil, 7) end
Don't blow up when there's no logger set.
datamapper_dm-core
train
rb
4550389480c1a43a954b3082537b18cad84d388e
diff --git a/lib/mongo/types/objectid.rb b/lib/mongo/types/objectid.rb index <HASH>..<HASH> 100644 --- a/lib/mongo/types/objectid.rb +++ b/lib/mongo/types/objectid.rb @@ -124,6 +124,12 @@ module Mongo legacy end + # Returns the utc time at which this ObjectID was generated. This may + # be used in lieu of a created_at timestamp. + def generation_time + Time.at(@data.pack("C4").unpack("N")[0]) + end + private begin diff --git a/test/test_objectid.rb b/test/test_objectid.rb index <HASH>..<HASH> 100644 --- a/test/test_objectid.rb +++ b/test/test_objectid.rb @@ -121,4 +121,10 @@ class ObjectIDTest < Test::Unit::TestCase assert_equal s, ObjectID.legacy_string_convert(l) end + def test_generation_time + time = Time.now + id = ObjectID.new + + assert_in_delta time.to_i, id.generation_time.to_i, 2 + end end
Added generation_time method on ObjectID
mongodb_mongo-ruby-driver
train
rb,rb
76b358de7fd4bc6d2400ee3202d38ca62e6df802
diff --git a/RemexHtml/DOM/DOMBuilder.php b/RemexHtml/DOM/DOMBuilder.php index <HASH>..<HASH> 100644 --- a/RemexHtml/DOM/DOMBuilder.php +++ b/RemexHtml/DOM/DOMBuilder.php @@ -58,7 +58,7 @@ class DOMBuilder implements TreeHandler { private $isFragment; /** @var bool */ - private $coerced; + private $coerced = false; /** * @param array $options An associative array of options:
Fix missing initialization for DOMBuilder::$coerced Because this wasn't initialized, DOMBuilder::isCoerced would return `null` instead of `false`. That's still a falsey value, so would only bite the called if (eg) they explicitly tested against `false`. Change-Id: Ia<I>b<I>e1d3d<I>efd<I>af3ffb4dabc<I>
wikimedia_remex-html
train
php
e9a7891c7fea2036e797d85b7050678973bca45b
diff --git a/lib/src/main/java/com/ibm/mobilefirstplatform/clientsdk/android/analytics/api/MFPAnalytics.java b/lib/src/main/java/com/ibm/mobilefirstplatform/clientsdk/android/analytics/api/MFPAnalytics.java index <HASH>..<HASH> 100644 --- a/lib/src/main/java/com/ibm/mobilefirstplatform/clientsdk/android/analytics/api/MFPAnalytics.java +++ b/lib/src/main/java/com/ibm/mobilefirstplatform/clientsdk/android/analytics/api/MFPAnalytics.java @@ -161,7 +161,7 @@ public class MFPAnalytics { metadata.remove(KEY_METADATA_START_TIME); - log(metadata);Get rid of + log(metadata);R lifecycleEvents.remove(TAG_SESSION); } catch (JSONException e) {
Delete unused text from MFPAnalytics.
ibm-bluemix-mobile-services_bms-clientsdk-android-core
train
java
ce110c71e1c1d41b4e3e30f6cdba2bca5171c58b
diff --git a/proso_common/middleware.py b/proso_common/middleware.py index <HASH>..<HASH> 100644 --- a/proso_common/middleware.py +++ b/proso_common/middleware.py @@ -11,7 +11,7 @@ class ToolbarMiddleware(object): def process_response(self, request, response): - if not request.user.is_staff: + if not hasattr(request, "user") or not request.user.is_staff: return response # Check for responses where the config_bar can't be inserted.
fix Toolbar middleware error raised when request is not standard (WSGI request)
adaptive-learning_proso-apps
train
py
280861f63cabf247363f426f79acca7352107cfe
diff --git a/tensorboard/uploader/uploader_main.py b/tensorboard/uploader/uploader_main.py index <HASH>..<HASH> 100644 --- a/tensorboard/uploader/uploader_main.py +++ b/tensorboard/uploader/uploader_main.py @@ -92,7 +92,7 @@ def _define_flags(parser): parser.add_argument( '--endpoint', type=str, - default='localhost:10000', + default='api.tensorboard.dev:443', help='URL for the API server accepting write requests.') parser.add_argument(
uploader: set default endpoint to production (#<I>) Test Plan: Build the Pip package and install it into a new virtualenv. Using the new package, revoke auth (`tensorboard dev auth revoke`), then upload an experiment. Note that the correct Terms of Service and Privacy Policy documents are clearly displayed in the consent prompt. wchargin-branch: uploader-prod
tensorflow_tensorboard
train
py
31ccc4941f1a0bb4a6e600ab0d87dbc5aa30b6cd
diff --git a/src/CodeGen/Utils.php b/src/CodeGen/Utils.php index <HASH>..<HASH> 100644 --- a/src/CodeGen/Utils.php +++ b/src/CodeGen/Utils.php @@ -4,25 +4,27 @@ use Twig_Loader_String; use Twig_Environment; use Closure; + + class Utils { static $stringloader = null; + static $twig; - static public function renderStringTemplate($templateContent, array $args = array()) + static public function renderStringTemplate($templateContent, array $args = array(), Twig_Environment $env = null) { - if (!self::$stringloader) { - self::$stringloader = new Twig_Loader_String(); - } - if (!self::$twig) { - self::$twig = new Twig_Environment(self::$stringloader); + if (!$env) { + $env = new Twig_Environment; } + $template = $twig->createTemplate($templateContent); + if (is_callable($args)) { $args = call_user_func($args); } elseif ($args instanceof Closure) { $args = $args(); } - return self::$twig->render($templateContent, $args); + return $template->render($args); } static public function evalCallback($cb)
Rewrite render string method to support newer Twig engine
c9s_CodeGen
train
php