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
|
---|---|---|---|---|---|
26d1f0827f6e9f66ea5f817af32e488ca235a793 | diff --git a/lib/Doctrine/Migrations/Version/DbalExecutor.php b/lib/Doctrine/Migrations/Version/DbalExecutor.php
index <HASH>..<HASH> 100644
--- a/lib/Doctrine/Migrations/Version/DbalExecutor.php
+++ b/lib/Doctrine/Migrations/Version/DbalExecutor.php
@@ -25,6 +25,7 @@ use Symfony\Component\Stopwatch\Stopwatch;
use Throwable;
use function count;
+use function method_exists;
use function ucfirst;
/**
@@ -203,7 +204,7 @@ final class DbalExecutor implements Executor
if (! $configuration->isDryRun()) {
$this->metadataStorage->complete($result);
- } else {
+ } elseif (method_exists($this->metadataStorage, 'getSql')) {
foreach ($this->metadataStorage->getSql($result) as $sqlQuery) {
$this->addSql($sqlQuery);
} | check for getSql method exists in MetadataStorage | doctrine_migrations | train | php |
a28940f3503ca05e518991c896a0c186a98c7cdb | diff --git a/treebeard/tests.py b/treebeard/tests.py
index <HASH>..<HASH> 100644
--- a/treebeard/tests.py
+++ b/treebeard/tests.py
@@ -402,6 +402,16 @@ class TestClassMethods(TestNonEmptyTree):
self.assertEqual(got, expected)
@multi_test()
+ def test_get_tree_leaf(self):
+ node = self.model.objects.get(desc=u'1')
+
+ self.assertEqual(0, node.get_children_count())
+ got = [(o.desc, o.get_depth(), o.get_children_count())
+ for o in self.model.get_tree(node)]
+ expected = [(u'1', 1, 0)]
+ self.assertEqual(got, expected)
+
+ @multi_test()
def test_dump_bulk_node(self):
node = self.model.objects.get(desc=u'231')
self.model.load_bulk(BASE_DATA, node) | added TestClassMethods.test_get_tree_leaf | django-treebeard_django-treebeard | train | py |
44635e382e00566c2ec98e5bcc4a21648bf4a607 | diff --git a/retry.go b/retry.go
index <HASH>..<HASH> 100644
--- a/retry.go
+++ b/retry.go
@@ -31,13 +31,14 @@ const MaxJitter = 1.0
// NoJitter disables the use of jitter for randomizing the exponential backoff time
const NoJitter = 0.0
-// initalize our own instance of a random generator with the current time
-var random = rand.New(rand.NewSource(time.Now().UnixNano()))
-
// newRetryTimer creates a timer with exponentially increasing delays
// until the maximum retry attempts are reached.
func newRetryTimer(maxRetry int, unit time.Duration, cap time.Duration, jitter float64) <-chan int {
attemptCh := make(chan int)
+
+ // Seed random function with current unix nano time.
+ rand.Seed(time.Now().UTC().UnixNano())
+
go func() {
defer close(attemptCh)
for i := 0; i < maxRetry; i++ {
@@ -75,7 +76,7 @@ func exponentialBackoffWait(base time.Duration, attempt int, cap time.Duration,
sleep = cap
}
if jitter != NoJitter {
- sleep -= time.Duration(random.Float64() * float64(sleep) * jitter)
+ sleep -= time.Duration(rand.Float64() * float64(sleep) * jitter)
}
return sleep
} | rand: Seed current time inside newRetryTimer
Avoids global unprotected 'random' generator, use a simple
seeding value based on current time inside the Timer thread.
Fixes mc vendorization issue #<I> | minio_minio-go | train | go |
6ce84495d1e5e2fec2fd9b138e66796323c929ee | diff --git a/lib/impala/cursor.rb b/lib/impala/cursor.rb
index <HASH>..<HASH> 100644
--- a/lib/impala/cursor.rb
+++ b/lib/impala/cursor.rb
@@ -14,6 +14,8 @@ module Impala
@row_buffer = []
@done = false
@open = true
+
+ fetch_more
end
def inspect | fetch data right off the bat, when a Cursor is instantiated.
This means the Cursor is no longer lazy in fetching data, but I'm not sure I
care. It fixes an issue where an cursor would return true for has_more? even if
there's nothing in the table. | colinmarc_impala-ruby | train | rb |
0ce4275f5783c8d82391494171c2f129e7763d6a | diff --git a/tests/VirtualFileSystem/WrapperTest.php b/tests/VirtualFileSystem/WrapperTest.php
index <HASH>..<HASH> 100644
--- a/tests/VirtualFileSystem/WrapperTest.php
+++ b/tests/VirtualFileSystem/WrapperTest.php
@@ -1209,4 +1209,18 @@ class WrapperTest extends \PHPUnit_Framework_TestCase
'Allowed to touch if not owner but with write permission'
);
}
+
+ public function testIsExecutableReturnsCorrectly()
+ {
+ $fs = new FileSystem();
+ $file = $fs->createFile('/file');
+
+ chmod($fs->path('/file'), 0000);
+
+ $this->assertFalse(is_executable($fs->path('/file')));
+
+ chmod($fs->path('/file'), 0777);
+
+ $this->assertTrue(is_executable($fs->path('/file')));
+ }
} | added tests for is_executable #<I> | michael-donat_php-vfs | train | php |
5b282ffa1ea51cb398d06b20aeff419fa32c54b5 | diff --git a/src/Core/Application.php b/src/Core/Application.php
index <HASH>..<HASH> 100644
--- a/src/Core/Application.php
+++ b/src/Core/Application.php
@@ -17,6 +17,7 @@ class Application extends \Tsugi\Silex\Application {
$this['tsugi']->output->buffer = false;
$P7 = strpos(phpversion(), '7') === 0;
+ $P7 = true; // After backleveled to Twig 1.27
// Some controllers work in PHP 5
if ( !$P7 ) { | Allow the koseu routed w/ twig <I> | tsugiproject_koseu-php | train | php |
5199564d26c14746f128cc3380a44a90279c1107 | diff --git a/iterator.go b/iterator.go
index <HASH>..<HASH> 100644
--- a/iterator.go
+++ b/iterator.go
@@ -258,7 +258,9 @@ func (item *Item) ValueSize() int64 {
}
var vp valuePointer
vp.Decode(item.vptr)
- return int64(vp.Len) - int64(len(item.key)) - headerBufSize - crc32.Size - 8 // len(uint64) (timestamp)
+
+ klen := int64(len(item.key) + 8) // 8 bytes for timestamp.
+ return int64(vp.Len) - klen - headerBufSize - crc32.Size
}
// UserMeta returns the userMeta set by the user. Typically, this byte, optionally set by the user | Make the key size calculation more obvious. | dgraph-io_badger | train | go |
4d1dee625d8b9a44064f958e8f819af63467d78c | diff --git a/cslbot/hooks/url.py b/cslbot/hooks/url.py
index <HASH>..<HASH> 100644
--- a/cslbot/hooks/url.py
+++ b/cslbot/hooks/url.py
@@ -55,9 +55,6 @@ def handle(send, msg, args):
return
if url.startswith("https://twitter.com"):
- if random.random() < 0.1:
- send("A nice shiny url would go here if somebody found a library that supports python 3.7")
- return
tid = url.split("/")[-1]
twitter_api = get_api(args["config"])
status = twitter_api.GetStatus(tid) | Remove silly hook
This is like the one useful feature of the bot please stop breaking it. | tjcsl_cslbot | train | py |
4865d274ee705c95b78723382edad0e9e4ae786a | diff --git a/openshift/dynamic/discovery.py b/openshift/dynamic/discovery.py
index <HASH>..<HASH> 100644
--- a/openshift/dynamic/discovery.py
+++ b/openshift/dynamic/discovery.py
@@ -26,7 +26,7 @@ class Discoverer(object):
def __init__(self, client, cache_file):
self.client = client
- default_cachefile_name = 'osrcp-{0}.json'.format(hashlib.md5(self.__get_default_cache_id()).hexdigest())
+ default_cachefile_name = 'osrcp-{0}.json'.format(hashlib.sha1(self.__get_default_cache_id()).hexdigest())
self.__cache_file = cache_file or os.path.join(tempfile.gettempdir(), default_cachefile_name)
self.__init_cache() | Remove md5, which fails in FIPS environment | openshift_openshift-restclient-python | train | py |
1b263ce6641a3dad291761351c09673ddeed7047 | diff --git a/test/common/tracker.js b/test/common/tracker.js
index <HASH>..<HASH> 100644
--- a/test/common/tracker.js
+++ b/test/common/tracker.js
@@ -225,5 +225,17 @@ module.exports = (db) => {
done();
});
});
+
+ it('query#reject error instance', (done) => {
+ tracker.on('query', (query) => {
+ query.reject(new Error('i threw up'));
+ });
+
+ db.select('field').from('test-table').catch((error) => {
+ expect(error.message).to.be.a('string');
+ expect(error.message.indexOf('i threw up')).to.not.equal(-1);
+ done();
+ });
+ });
});
} | Add test for rejecting with an error instance (#<I>) | colonyamerican_mock-knex | train | js |
e3ddf8220d0759639d4022bf8277ebbb9a7e1f4b | diff --git a/src/localStorage/localStorage.js b/src/localStorage/localStorage.js
index <HASH>..<HASH> 100644
--- a/src/localStorage/localStorage.js
+++ b/src/localStorage/localStorage.js
@@ -11,9 +11,6 @@ angular.module('ngIdle.localStorage', [])
},
remove: function(key) {
storage.removeItem('ngIdle.'+key);
- },
- parseJson: function(raw) {
- return angular.fromJson(raw);
}
};
}]); | Update localStorage.js
Deleted public "IdleLocalStorage.parseJson" function as all dependencies on it have been replaced with "angular.fromJson" | HackedByChinese_ng-idle | train | js |
1054e9814710899faecd569bf4a70fece4af4fab | diff --git a/index.js b/index.js
index <HASH>..<HASH> 100644
--- a/index.js
+++ b/index.js
@@ -7,7 +7,7 @@ var fs = require('fs'),
var src = require('fs').readFileSync(__dirname + '/lib/angular.min.js', 'utf8');
// replace implicit references
- src = src.replace('angular.element(document)', 'window.angular.element(document)');
+ src = src.split('angular.element(document)').join('window.angular.element(document)');
src = src.split('(navigator.userAgent)').join('(window.navigator.userAgent)');
src = src.split('angular.$$csp').join('window.angular.$$csp'); | Ensure all instances are replaced. Fixes #<I>. | bclinkinbeard_angular | train | js |
8e30474b81d99e16570de68dbcb064ad42b97afe | diff --git a/app/actions.js b/app/actions.js
index <HASH>..<HASH> 100644
--- a/app/actions.js
+++ b/app/actions.js
@@ -412,3 +412,22 @@ export const moveFolder = (changes) => ({
parentId: changes.parentId,
},
});
+
+export const openTab = (patchId) => ({
+ type: ActionType.TAB_OPEN,
+ payload: {
+ patchId,
+ },
+});
+
+export const closeTab = (id) => ({
+ type: ActionType.TAB_CLOSE,
+ payload: {
+ id,
+ },
+});
+
+export const sortTabs = (newOrderObject) => ({
+ type: ActionType.TAB_SORT,
+ payload: newOrderObject,
+}); | feat(tabs): add actions for open/close/sort tabs | xodio_xod | train | js |
239a64d75dc72d8778d7c0c12185c9c2bcf95448 | diff --git a/lib/edfize/version.rb b/lib/edfize/version.rb
index <HASH>..<HASH> 100644
--- a/lib/edfize/version.rb
+++ b/lib/edfize/version.rb
@@ -3,7 +3,7 @@ module Edfize
MAJOR = 0
MINOR = 2
TINY = 0
- BUILD = "pre"
+ BUILD = "beta1"
STRING = [MAJOR, MINOR, TINY, BUILD].compact.join('.')
end | Version bump to <I>.beta1 | nsrr_edfize | train | rb |
9bbd7c9d53be4c035c13ef5eb360fb09f4408546 | diff --git a/src/Comely/IO/Database/Database.php b/src/Comely/IO/Database/Database.php
index <HASH>..<HASH> 100644
--- a/src/Comely/IO/Database/Database.php
+++ b/src/Comely/IO/Database/Database.php
@@ -30,8 +30,6 @@ class Database extends PDO implements ComponentInterface
public const SQLITE = 1002;
public const PGSQL = 1003;
- /** @var Queries */
- private $queries;
/** @var ServerCredentials */
private $server;
@@ -60,9 +58,14 @@ class Database extends PDO implements ComponentInterface
$this->server = $credentials;
// Remove sensitive information from credentials
unset($this->server->username, $this->server->password);
+ }
- // Build Queries Index
- $this->queries = new Queries();
+ /**
+ * @return ServerCredentials
+ */
+ public function connection(): ServerCredentials
+ {
+ return $this->server;
}
/** | Removed Queries prop./instance, added connection() method | comelyio_comely | train | php |
08eb71b57cd4a3506b6baf449179af12edc01569 | diff --git a/spyder/plugins/editor/widgets/editor.py b/spyder/plugins/editor/widgets/editor.py
index <HASH>..<HASH> 100644
--- a/spyder/plugins/editor/widgets/editor.py
+++ b/spyder/plugins/editor/widgets/editor.py
@@ -3014,9 +3014,9 @@ class EditorSplitter(QSplitter):
focus_widget.setFocus()
def editorstack_closed(self):
- logger.debug("method 'editorstack_closed':")
- logger.debug(" self : %r" % self)
try:
+ logger.debug("method 'editorstack_closed':")
+ logger.debug(" self : %r" % self)
self.unregister_editorstack_cb(self.editorstack)
self.editorstack = None
close_splitter = self.count() == 1 | pyside2: Avoid error due to already deleted C++ object | spyder-ide_spyder | train | py |
a458153c5dc8f2f7db17c2e34fc52fa3e40f9acb | diff --git a/lib/rakuten_web_service/genre.rb b/lib/rakuten_web_service/genre.rb
index <HASH>..<HASH> 100644
--- a/lib/rakuten_web_service/genre.rb
+++ b/lib/rakuten_web_service/genre.rb
@@ -54,7 +54,7 @@ module RakutenWebService
def initialize(params)
super
- self.class[self.id.to_s] = @params.reject { |k, v| k == 'itemCount' }
+ self.class[self.id.to_s] = @params.reject { |k, _| k == 'itemCount' }
end
def children | Use underscore as an argument to indicate it won't be used. | rakuten-ws_rws-ruby-sdk | train | rb |
ae18d0e77bce5932a8c820b1b676b86e799eede1 | diff --git a/lib/jekyll/menus.rb b/lib/jekyll/menus.rb
index <HASH>..<HASH> 100644
--- a/lib/jekyll/menus.rb
+++ b/lib/jekyll/menus.rb
@@ -13,10 +13,18 @@ module Jekyll
#
- def to_liquid_drop
- Drops::All.new(Utils.deep_merge(
+ def menus
+ Util.deep_merge(
_data_menus, _page_menus
- ))
+ )
+ end
+
+ #
+
+ def to_liquid_drop
+ Drops::All.new(
+ menus
+ )
end
# | Add the ability to extract the raw menus. | forestryio_jekyll-menus | train | rb |
d5517de36fdecb6e6d0ccad079d73bfb89951b66 | diff --git a/tasks/mochaTest.js b/tasks/mochaTest.js
index <HASH>..<HASH> 100644
--- a/tasks/mochaTest.js
+++ b/tasks/mochaTest.js
@@ -1,5 +1,6 @@
module.exports = {
options: {
+ timeout: 5000,
require: [
function() {
/*eslint-disable */ | Increase mocha test timeout
The default timeout is <I>ms, which some tests like "Base Scanner Class
should run all rules" sometimes exceed, even on my fast MacBook. | mozilla_addons-linter | train | js |
e62092ebb26e487ee2ff62401db6e04e885180a1 | diff --git a/spec/static/main.js b/spec/static/main.js
index <HASH>..<HASH> 100644
--- a/spec/static/main.js
+++ b/spec/static/main.js
@@ -43,6 +43,12 @@ ipcMain.on('echo', function(event, msg) {
event.returnValue = msg;
});
+// Verify Menu.buildFromTemplate does not modify the specified template
+ipcMain.on('menu-build-from-template', function(event, template) {
+ Menu.buildFromTemplate(template);
+ event.returnValue = template;
+})
+
if (process.argv[2] == '--ci') {
process.removeAllListeners('uncaughtException');
process.on('uncaughtException', function(error) {
@@ -101,10 +107,4 @@ app.on('ready', function() {
});
event.returnValue = "done";
});
-
- // Verify Menu.buildFromTemplate does not modify the specified template
- ipcMain.on('menu-build-from-template', function(event, template) {
- Menu.buildFromTemplate(template);
- event.returnValue = template;
- })
}); | Move ipc handler to be near others | electron_electron | train | js |
04d35d2cc15c686073977eb74ef5a87edcb306b2 | diff --git a/spec/fixtures/app/controllers/events_controller.rb b/spec/fixtures/app/controllers/events_controller.rb
index <HASH>..<HASH> 100644
--- a/spec/fixtures/app/controllers/events_controller.rb
+++ b/spec/fixtures/app/controllers/events_controller.rb
@@ -3,7 +3,7 @@ class EventsController < ApplicationController
def create
end
- def show
+ def show()
redirect_to :edit, notice: I18n.t('cb.a')
# args are ignored | failing test for controll rel. key | glebm_i18n-tasks | train | rb |
da6ce7e963fe2593e60c301437c3acc036efed0c | diff --git a/translator/src/test/java/com/google/devtools/j2objc/translate/DeadCodeEliminatorTest.java b/translator/src/test/java/com/google/devtools/j2objc/translate/DeadCodeEliminatorTest.java
index <HASH>..<HASH> 100644
--- a/translator/src/test/java/com/google/devtools/j2objc/translate/DeadCodeEliminatorTest.java
+++ b/translator/src/test/java/com/google/devtools/j2objc/translate/DeadCodeEliminatorTest.java
@@ -69,7 +69,7 @@ public class DeadCodeEliminatorTest extends GenerationTest {
+ " }\n"
+ "}\n";
DeadCodeMap map = DeadCodeMap.builder()
- .addDeadMethod("A$B", "A$B", "(I)V")
+ .addDeadMethod("A$B", "A$B", "(LA;I)V")
.build();
setDeadCodeMap(map);
String translation = translateSourceFile(source, "A", "A.m"); | Fix inner class ctor sig as reported by ProGuard
If ProGuard decides to keep an inner class but remove all its fields
(such as in the case where "-keep class" is used), the signature of
the removed inner class constructor will actually carry its outer class
as the first parameter type. | google_j2objc | train | java |
9face430345eb83356601e9eaf631d09ce9faaf6 | diff --git a/chef/lib/chef/knife/cookbook_site_share.rb b/chef/lib/chef/knife/cookbook_site_share.rb
index <HASH>..<HASH> 100644
--- a/chef/lib/chef/knife/cookbook_site_share.rb
+++ b/chef/lib/chef/knife/cookbook_site_share.rb
@@ -50,7 +50,7 @@ class Chef
cl = Chef::CookbookLoader.new(config[:cookbook_path])
if cl.cookbook_exists?(cookbook_name)
cookbook = cl[cookbook_name]
- Chef::CookbookUploader.validate_cookbook(cookbook)
+ Chef::CookbookUploader.new(cookbook,config[:cookbook_path]).validate_cookbook
tmp_cookbook_dir = Chef::CookbookSiteStreamingUploader.create_build_dir(cookbook)
begin
Chef::Log.debug("temp cookbook directory is #{tmp_cookbook_dir.inspect}") | [CHEF-<I>] validate_cookbook is now an instance method | chef_chef | train | rb |
a8bdb375d4d766651424f6ac58a44305c02f0f67 | diff --git a/rb/spec/integration/selenium/webdriver/window_spec.rb b/rb/spec/integration/selenium/webdriver/window_spec.rb
index <HASH>..<HASH> 100644
--- a/rb/spec/integration/selenium/webdriver/window_spec.rb
+++ b/rb/spec/integration/selenium/webdriver/window_spec.rb
@@ -39,7 +39,7 @@ module Selenium
target_width = size.width - 20
target_height = size.height - 20
- window.size = Dimension.new(target_height)
+ window.size = Dimension.new(target_width, target_height)
new_size = window.size
expect(new_size.width).to eq(target_width) | Revert change made by a silly mistake
5b<I>c mistakenly removed this argument | SeleniumHQ_selenium | train | rb |
abece785976ebbc5dc6a28a892f0b471bbaf4ccf | diff --git a/src/ngrest/plugins/CheckboxList.php b/src/ngrest/plugins/CheckboxList.php
index <HASH>..<HASH> 100644
--- a/src/ngrest/plugins/CheckboxList.php
+++ b/src/ngrest/plugins/CheckboxList.php
@@ -81,5 +81,7 @@ class CheckboxList extends Plugin
$event->sender->setAttribute($this->name, $this->jsonDecode($event->sender->getAttribute($this->name)));
return false;
}
+
+ return true;
}
}
diff --git a/src/ngrest/plugins/FileArray.php b/src/ngrest/plugins/FileArray.php
index <HASH>..<HASH> 100644
--- a/src/ngrest/plugins/FileArray.php
+++ b/src/ngrest/plugins/FileArray.php
@@ -53,5 +53,7 @@ class FileArray extends \admin\ngrest\base\Plugin
$event->sender->setAttribute($this->name, $this->jsonDecode($event->sender->getAttribute($this->name)));
return false;
}
+
+ return true;
}
} | Fixed Bug where checkbox list and file array in i<I>n context does not
encode the data correctly. | luyadev_luya-module-admin | train | php,php |
416262aada915408d2584e2ce647ad97213868a6 | diff --git a/fmn/lib/__init__.py b/fmn/lib/__init__.py
index <HASH>..<HASH> 100644
--- a/fmn/lib/__init__.py
+++ b/fmn/lib/__init__.py
@@ -94,7 +94,8 @@ def matches(filter, message, valid_paths, rule_cache, config):
def load_preferences(session, config, valid_paths,
- cull_disabled=False, openid=None):
+ cull_disabled=False, openid=None,
+ cull_backends=None):
""" Every rule for every filter for every context for every user.
Any preferences in the DB that are for contexts that are disabled in the
@@ -105,6 +106,9 @@ def load_preferences(session, config, valid_paths,
submitted, then only the preferences of that user are returned (and this is
less expensive).
"""
+
+ cull_backends = cull_backends or []
+
query = session.query(fmn.lib.models.Preference)
if openid:
@@ -116,6 +120,7 @@ def load_preferences(session, config, valid_paths,
for preference in preferences
if (
preference.context.name in config['fmn.backends']
+ and preference.context.name not in cull_backends
and (not cull_disabled or preference.enabled)
)
] | Allow to load only certain subsets of preferences (not desktop). | fedora-infra_fmn.lib | train | py |
5ab18c1afabb1a55a36acb127826ce7b93731df1 | diff --git a/src/ruby_supportlib/phusion_passenger/debug_logging.rb b/src/ruby_supportlib/phusion_passenger/debug_logging.rb
index <HASH>..<HASH> 100644
--- a/src/ruby_supportlib/phusion_passenger/debug_logging.rb
+++ b/src/ruby_supportlib/phusion_passenger/debug_logging.rb
@@ -112,7 +112,7 @@ module PhusionPassenger
output = @@stderr_evaluator.call
end
location = caller[nesting_level].sub(/.*phusion_passenger\//, '')
- location.sub!(/(.*):.*/, '\1')
+ location.sub!(/(.*?):.*/, '\1')
now = Time.now
time_str = now.strftime("%Y-%m-%d %H:%M:%S.")
time_str << sprintf("%04d", now.usec / 100) | Ruby DebugLogging: fix displaying caller location
If the caller was within two level of nested modules, like this:
module Foo
module Bar
DebugLogging.notice 'hi'
end
end
Then the printed location will contain the string `<module`.
This is caused by our regex being too greedy, so make it less greedy. | phusion_passenger | train | rb |
957f21140066fa198b4017655c506b30915792f9 | diff --git a/lib/puppet/pops/parser/epp_support.rb b/lib/puppet/pops/parser/epp_support.rb
index <HASH>..<HASH> 100644
--- a/lib/puppet/pops/parser/epp_support.rb
+++ b/lib/puppet/pops/parser/epp_support.rb
@@ -201,8 +201,6 @@ module EppSupport
if s.end_with? "<%"
@mode = :error
@issue = Issues::EPP_UNBALANCED_EXPRESSION
- else
- mode = :epp
end
return s | (PUP-<I>) Preserve current mode when reaching end of input
Remove the line that tried to switch the mode when reaching end of
input. The line didn't do anything because it was setting the value of a
local variable instead of calling the accessor. | puppetlabs_puppet | train | rb |
47e80019f571eab2827afaf7b4eb450c9881f509 | diff --git a/safe/gui/widgets/test/test_dock_regressions.py b/safe/gui/widgets/test/test_dock_regressions.py
index <HASH>..<HASH> 100644
--- a/safe/gui/widgets/test/test_dock_regressions.py
+++ b/safe/gui/widgets/test/test_dock_regressions.py
@@ -7,19 +7,18 @@ from qgis.core import QgsMapLayerRegistry
from PyQt4 import QtCore
+from safe.test.utilities import get_qgis_app
+QGIS_APP, CANVAS, IFACE, PARENT = get_qgis_app()
+
from safe.impact_functions import register_impact_functions
from safe.test.utilities import (
test_data_path,
load_layer,
set_canvas_crs,
GEOCRS,
- setup_scenario,
- get_qgis_app)
+ setup_scenario)
from safe.utilities.keyword_io import KeywordIO
-# AG: get_qgis_app() should be called before importing modules from
-# safe.gui.widgets.dock
-QGIS_APP, CANVAS, IFACE, PARENT = get_qgis_app()
from safe.gui.widgets.dock import Dock | Make test works on test_dock_regressions. | inasafe_inasafe | train | py |
c17c35c52696a395249f0b7a83c82e508a1d3cb3 | diff --git a/lib/chef/knife/xargs_essentials.rb b/lib/chef/knife/xargs_essentials.rb
index <HASH>..<HASH> 100644
--- a/lib/chef/knife/xargs_essentials.rb
+++ b/lib/chef/knife/xargs_essentials.rb
@@ -243,7 +243,7 @@ class Chef
diff = `diff -u #{old_file.path} #{tempfile.path}`
diff.gsub!(old_file.path, "#{format_path(file[:file])} (old)")
diff.gsub!(tempfile.path, "#{format_path(file[:file])} (new)")
- output diff
+ stdout.write diff
ensure
old_file.close!
end | Don't print extra newlines on diff | jkeiser_knife-essentials | train | rb |
76e2f4f5211b4bc178323e5e6d5b49f7ca9887c3 | diff --git a/grails-bootstrap/src/main/groovy/org/codehaus/groovy/grails/cli/GrailsScriptRunner.java b/grails-bootstrap/src/main/groovy/org/codehaus/groovy/grails/cli/GrailsScriptRunner.java
index <HASH>..<HASH> 100644
--- a/grails-bootstrap/src/main/groovy/org/codehaus/groovy/grails/cli/GrailsScriptRunner.java
+++ b/grails-bootstrap/src/main/groovy/org/codehaus/groovy/grails/cli/GrailsScriptRunner.java
@@ -84,7 +84,7 @@ public class GrailsScriptRunner {
private PrintStream out = System.out;
private GrailsConsole console = GrailsConsole.getInstance();
- private boolean isInteractive = console.isInteractiveEnabled();
+ private boolean isInteractive = System.getProperty(GrailsConsole.ENABLE_INTERACTIVE) != null ? Boolean.getBoolean(GrailsConsole.ENABLE_INTERACTIVE) : true;
private URLClassLoader classLoader;
private File scriptCacheDir; | calculate interactive system property independently of GrailsConsole | grails_grails-core | train | java |
78328a2bf56e11eada4c46b0256b68a581c2fefa | diff --git a/test/unit/rules/no-curly-component-invocation-test.js b/test/unit/rules/no-curly-component-invocation-test.js
index <HASH>..<HASH> 100644
--- a/test/unit/rules/no-curly-component-invocation-test.js
+++ b/test/unit/rules/no-curly-component-invocation-test.js
@@ -80,6 +80,17 @@ const SHARED_BAD = [
],
},
{
+ template: '{{foo.bar bar=baz}}',
+ results: [
+ {
+ message: generateError('foo.bar'),
+ line: 1,
+ column: 0,
+ source: '{{foo.bar bar=baz}}',
+ },
+ ],
+ },
+ {
template: '{{link-to "bar" "foo"}}',
results: [
{
@@ -191,7 +202,13 @@ generateRuleTests({
requireDash: false,
},
- good: [...SHARED_GOOD, '{{aaa-bbb}}', '{{aaa/bbb}}', '{{aaa-bbb bar=baz}}'],
+ good: [
+ ...SHARED_GOOD,
+ '{{aaa-bbb}}',
+ '{{aaa/bbb}}',
+ '{{aaa-bbb bar=baz}}',
+ '{{#aaa-bbb bar=baz}}{{/aaa-bbb}}',
+ ],
bad: [...SHARED_BAD],
}); | no-curly-component-invocation: Add additional test cases | ember-template-lint_ember-template-lint | train | js |
c243e1f92d6c4bd8515d1a9885000a5fd21a5de2 | diff --git a/tests/Installation/Commands/InstallCommandTest.php b/tests/Installation/Commands/InstallCommandTest.php
index <HASH>..<HASH> 100644
--- a/tests/Installation/Commands/InstallCommandTest.php
+++ b/tests/Installation/Commands/InstallCommandTest.php
@@ -174,6 +174,10 @@ class InstallCommandTest extends PHPUnit_Framework_TestCase
echo $file->getFilename(), "\n";
}
echo "project/bin...\n";
+ foreach (new \DirectoryIterator(__DIR__ . '/project/vendor') as $file) {
+ echo $file->getFilename(), "\n";
+ }
+ echo "project/bin...\n";
foreach (new \DirectoryIterator(__DIR__ . '/project/vendor/bin') as $file) {
echo $file->getFilename(), "\n";
} | for ci debugging commit | Wandu_Framework | train | php |
0dce9f05f2a1db8213b7ef520a6505c74e6d2c81 | diff --git a/wepay.php b/wepay.php
index <HASH>..<HASH> 100755
--- a/wepay.php
+++ b/wepay.php
@@ -204,10 +204,14 @@ class WePay {
*/
public function request($endpoint, array $values = array()) {
if (!$this->ch) {
+ $headers = array("Content-Type: application/json"); // always pass the correct Content-Type header
+ if ($this->token) { // if we have an access_token, add it to the Authorization header
+ $headers[] = "Authorization: Bearer $this->token";
+ }
$this->ch = curl_init();
curl_setopt($this->ch, CURLOPT_USERAGENT, 'WePay v2 PHP SDK v' . self::VERSION);
curl_setopt($this->ch, CURLOPT_RETURNTRANSFER, true);
- curl_setopt($this->ch, CURLOPT_HTTPHEADER, array("Authorization: Bearer $this->token", "Content-Type: application/json"));
+ curl_setopt($this->ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($this->ch, CURLOPT_TIMEOUT, 5); // 5-second timeout, adjust to taste
curl_setopt($this->ch, CURLOPT_POST, !empty($values)); // WePay's API is not strictly RESTful, so all requests are sent as POST unless there are no request values
} | Add support for API calls without access_tokens (useful for CC tokenization | wepay_PHP-SDK | train | php |
fbdab27f661c2cd7d6564d7b7a0139943537cd12 | diff --git a/kaminari-core/spec/fake_app/rails_app.rb b/kaminari-core/spec/fake_app/rails_app.rb
index <HASH>..<HASH> 100644
--- a/kaminari-core/spec/fake_app/rails_app.rb
+++ b/kaminari-core/spec/fake_app/rails_app.rb
@@ -4,7 +4,6 @@ require 'action_controller/railtie'
require 'action_view/railtie'
require 'fake_app/active_record/config' if defined? ActiveRecord
-require 'fake_app/mongo_mapper/config' if defined? MongoMapper
# config
app = Class.new(Rails::Application)
app.config.secret_key_base = app.config.secret_token = '3b7cd727ee24e8444053437c36cc66c4'
@@ -26,7 +25,6 @@ end
#models
require 'fake_app/active_record/models' if defined? ActiveRecord
-require 'fake_app/mongo_mapper/models' if defined? MongoMapper
# controllers
class ApplicationController < ActionController::Base; end | These should be required from kaminari-mongo_mapper gem's spec_helper | kaminari_kaminari | train | rb |
4efb0547d0620749b4f68238fab4346f32173ea9 | diff --git a/lib/rfd.rb b/lib/rfd.rb
index <HASH>..<HASH> 100644
--- a/lib/rfd.rb
+++ b/lib/rfd.rb
@@ -74,6 +74,16 @@ module Rfd
end
end
+ def ctrl_p
+ if @total_pages > 1
+ if @current_page > 0
+ switch_page @current_page - 1
+ else
+ switch_page @total_pages - 1
+ end
+ end
+ end
+
def enter
if current_item.directory?
cd current_item | ctrl_p to the previous page | amatsuda_rfd | train | rb |
17a4cbffc4798f3fcff35db7bda497988ead3660 | diff --git a/lib/dm-core/property.rb b/lib/dm-core/property.rb
index <HASH>..<HASH> 100644
--- a/lib/dm-core/property.rb
+++ b/lib/dm-core/property.rb
@@ -80,11 +80,14 @@ module DataMapper
# property :title, String
#
# def title=(new_title)
- # raise ArgumentError if new_title != 'Luke is Awesome'
+ # super
+ # raise ArgumentError if new_title != 'Lee is l337'
# @title = new_title
# end
# end
#
+ # Calling super ensures that any validators defined for the property are kept active.
+ #
# == Lazy Loading
# By default, some properties are not loaded when an object is fetched in
# DataMapper. These lazily loaded properties are fetched on demand when their | Added note to documentation; call super when overriding accessors to ensure validators are still active | datamapper_dm-core | train | rb |
029340995b11cb43d702734f7562fa7f0a0703af | diff --git a/test/cache_set.js b/test/cache_set.js
index <HASH>..<HASH> 100644
--- a/test/cache_set.js
+++ b/test/cache_set.js
@@ -135,7 +135,7 @@ function performTest(cacheObj, keySuffix) {
assert.equal(response.isSuccess(), true);
assert.equal(response.data.response, true);
setTimeout(async function() {
- response = await openSTCache.get(cKey);
+ response = await cacheObj.get(cKey);
assert.equal(response.isSuccess(), true);
assert.equal(response.data.response, null);
}, ttl * 1000); | bug fix in test case of cache set | ostdotcom_cache | train | js |
ac4e80f09f90476e8ba71fb4a4e05d5e7108592d | diff --git a/lib/server.js b/lib/server.js
index <HASH>..<HASH> 100644
--- a/lib/server.js
+++ b/lib/server.js
@@ -163,6 +163,9 @@
zip: isZip,
online: isOnline
});
+ } else if (isJsHint) {
+ res .type('json')
+ .send(jshint);
} else if (isJoin) {
joinFunc = join({
dir : DIR_ROOT,
@@ -179,9 +182,6 @@
restafaryFunc(req, res, next);
} else if (isMin) {
minifyFunc(req, res, sendFile);
- } else if (isJsHint) {
- res .type('json')
- .send(jshint);
} else {
sendFile();
} | fix(server) serve: jshin | cloudcmd_edward | train | js |
35e3f72af29a33189a46a4b5ada84768b87e0ef2 | diff --git a/activerecord/lib/active_record/named_scope.rb b/activerecord/lib/active_record/named_scope.rb
index <HASH>..<HASH> 100644
--- a/activerecord/lib/active_record/named_scope.rb
+++ b/activerecord/lib/active_record/named_scope.rb
@@ -19,7 +19,7 @@ module ActiveRecord
# fruits = fruits.where(:colour => 'red') if options[:red_only]
# fruits = fruits.limit(10) if limited?
#
- # Anonymous scopes tend to be useful when procedurally generating complex
+ # Anonymous \scopes tend to be useful when procedurally generating complex
# queries, where passing intermediate values (scopes) around as first-class
# objects is convenient.
# | Adds backslash to scope for cross-references. | rails_rails | train | rb |
bf330dbd9931c04c888231baf99e4dc52de2b1a1 | diff --git a/test/autorender_test.js b/test/autorender_test.js
index <HASH>..<HASH> 100644
--- a/test/autorender_test.js
+++ b/test/autorender_test.js
@@ -149,6 +149,7 @@ QUnit.test("It was able to load", function(){
QUnit.module("Using live-reload", {
setup: function(){
F.open("//live-reload/page.html");
+ F.wait(100);
}
});
diff --git a/test/live-reload/test.js b/test/live-reload/test.js
index <HASH>..<HASH> 100644
--- a/test/live-reload/test.js
+++ b/test/live-reload/test.js
@@ -8,6 +8,6 @@ window.ONRUNNING = function(){
loader.normalize("~/test/live-reload/app").then(function(name){
reloadAll([name]).then(function(){
- console.log("reloaded");
+ //console.log("reloaded");
});
}); | Add a small wait on live-reload tests | donejs_autorender | train | js,js |
b7023f2554b84a853366d9cbceaf6f82733701b3 | diff --git a/src/Administration/Resources/administration/src/module/sw-product-stream/page/sw-product-stream-detail/index.js b/src/Administration/Resources/administration/src/module/sw-product-stream/page/sw-product-stream-detail/index.js
index <HASH>..<HASH> 100644
--- a/src/Administration/Resources/administration/src/module/sw-product-stream/page/sw-product-stream-detail/index.js
+++ b/src/Administration/Resources/administration/src/module/sw-product-stream/page/sw-product-stream-detail/index.js
@@ -164,9 +164,11 @@ Component.register('sw-product-stream-detail', {
closeModalPreview() {
return new Promise((resolve) => {
this.showModalPreview = false;
- this.$refs.modalPreview.$on('sw-product-stream-modal-preview-destroy', () => {
- resolve();
- });
+ if (this.$refs.modalPreview) {
+ this.$refs.modalPreview.$on('sw-product-stream-modal-preview-destroy', () => {
+ resolve();
+ });
+ }
});
}, | NTR - fix modal error after detail leave to listing | shopware_platform | train | js |
b2c714830f6421a32a5e0119cbeaa87d5d7be3c6 | diff --git a/src/index.js b/src/index.js
index <HASH>..<HASH> 100644
--- a/src/index.js
+++ b/src/index.js
@@ -127,7 +127,7 @@ function createElementReconfirm (properties) {
} else {
// Mount the ReactConfirmAlert component
document.body.children[0].classList.add('react-confirm-alert-blur')
- const divTarget = document.createElement('div')
+ divTarget = document.createElement('div')
divTarget.id = 'react-confirm-alert'
document.body.appendChild(divTarget)
render(<ReactConfirmAlert {...properties} />, divTarget) | Removing redeclaration of divTarget | GA-MO_react-confirm-alert | train | js |
07922fae335e7a1bdab5df22ad2c06d0f1f4cec4 | diff --git a/lmj/nn/feedforward.py b/lmj/nn/feedforward.py
index <HASH>..<HASH> 100644
--- a/lmj/nn/feedforward.py
+++ b/lmj/nn/feedforward.py
@@ -151,7 +151,7 @@ class Network(object):
@property
def monitors(self):
- return self.sparsities
+ return [self.cost] + self.sparsities
@property
def sparsities(self): | Add raw cost (i.e., output error) to default network monitors. | lmjohns3_theanets | train | py |
ff4648735378bdeabfabb11effb0cf1e0e2d721c | diff --git a/src/Psalm/Checker/Statements/ExpressionChecker.php b/src/Psalm/Checker/Statements/ExpressionChecker.php
index <HASH>..<HASH> 100644
--- a/src/Psalm/Checker/Statements/ExpressionChecker.php
+++ b/src/Psalm/Checker/Statements/ExpressionChecker.php
@@ -130,6 +130,8 @@ class ExpressionChecker
if (!isset($stmt->expr->inferredType)) {
$stmt->inferredType = new Type\Union([new TInt, new TFloat]);
+ } elseif ($stmt->expr->inferredType->isMixed()) {
+ $stmt->inferredType = Type::getMixed();
} else {
$acceptable_types = [];
@@ -139,14 +141,12 @@ class ExpressionChecker
} elseif ($type_part instanceof TString) {
$acceptable_types[] = new TInt;
$acceptable_types[] = new TFloat;
+ } else {
+ $acceptable_types[] = new TInt;
}
}
- if ($acceptable_types) {
- $stmt->inferredType = new Type\Union($acceptable_types);
- } else {
- $stmt->inferredType = new Type\Union([new TInt, new TFloat]);
- }
+ $stmt->inferredType = new Type\Union($acceptable_types);
}
} elseif ($stmt instanceof PhpParser\Node\Expr\Isset_) {
self::analyzeIsset($statements_checker, $stmt, $context); | Be more discerning about unaryminus/plus inferred type | vimeo_psalm | train | php |
fa0f978747ab2725d29d4563074560e9554ddb6a | diff --git a/src/VR.js b/src/VR.js
index <HASH>..<HASH> 100644
--- a/src/VR.js
+++ b/src/VR.js
@@ -1046,7 +1046,7 @@ function getGamepads() {
for (let i = 0; i < globalGamepads.tracker.length; i++) {
globalGamepads.tracker[i].id = getControllerID('openvr', 'tracker');
}
- gamepads.push.apply(gamepads, trackerGamepads);
+ gamepads.push.apply(gamepads, globalGamepads.tracker);
}
if (GlobalContext.xrState.handTracking[0]) { | Bugfix tracker gamepads reference in VR.js | exokitxr_exokit | train | js |
28f095f4b659974cbf3556deb2dac076f5bb3ea4 | diff --git a/bin/tessel-2.js b/bin/tessel-2.js
index <HASH>..<HASH> 100755
--- a/bin/tessel-2.js
+++ b/bin/tessel-2.js
@@ -29,7 +29,7 @@ parser.command('push')
// true: push=true
controller.deployScript(opts, true, function(err) {
throw err;
- });
+ });
})
.option('entryPoint', {
position: 1,
@@ -60,6 +60,7 @@ parser.command('list')
.callback(function(opts) {
controller.listTessels(function(err) {
if (err) throw err;
+ process.exit(1);
});
})
.help('Show all connected Tessels'); | Force to exit process once completing list | tessel_t2-cli | train | js |
8dac0741b6b21bdea9300270131baa5c3d41e881 | diff --git a/intake/cli/server/__main__.py b/intake/cli/server/__main__.py
index <HASH>..<HASH> 100644
--- a/intake/cli/server/__main__.py
+++ b/intake/cli/server/__main__.py
@@ -39,6 +39,9 @@ def main(argv=None):
help='Name of catalog YAML file')
parser.add_argument('--flatten', dest='flatten', action='store_true')
parser.add_argument('--no-flatten', dest='flatten', action='store_false')
+ parser.add_argument('-a', '--address', type=str,
+ default=conf.get('address', 'localhost'),
+ help='hosting address')
parser.set_defaults(flatten=True)
args = parser.parse_args(argv[1:])
@@ -66,7 +69,7 @@ def main(argv=None):
app = server.make_app()
server.start_periodic_functions(close_idle_after=3600.0)
- app.listen(args.port)
+ app.listen(args.port, address=args.address)
try:
tornado.ioloop.IOLoop.current().start()
except KeyboardInterrupt: | add server cli kwarg for address | intake_intake | train | py |
b123be5612b73052da26e44044e6a63141d135b4 | diff --git a/cmd/web-handlers.go b/cmd/web-handlers.go
index <HASH>..<HASH> 100644
--- a/cmd/web-handlers.go
+++ b/cmd/web-handlers.go
@@ -306,7 +306,7 @@ func (web *webAPIHandlers) ListBuckets(r *http.Request, args *WebGenericArgs, re
r.Header.Set("delimiter", SlashSeparator)
// If etcd, dns federation configured list buckets from etcd.
- if globalDNSConfig != nil {
+ if globalDNSConfig != nil && globalBucketFederation {
dnsBuckets, err := globalDNSConfig.List()
if err != nil && err != dns.ErrNoEntriesFound {
return toJSONError(ctx, err) | fix: browser should listBuckets from etcd in global federation (#<I>) | minio_minio | train | go |
4144d8ab66b6c1caeda9f745bf3941141d70da87 | diff --git a/autograd/scipy/stats/chi2.py b/autograd/scipy/stats/chi2.py
index <HASH>..<HASH> 100644
--- a/autograd/scipy/stats/chi2.py
+++ b/autograd/scipy/stats/chi2.py
@@ -1,4 +1,4 @@
-from __future__ import absolute_import
+from __future__ import absolute_import, division
import autograd.numpy as np
import scipy.stats | Imported __future__.division to avoid integer division in Python 2 | HIPS_autograd | train | py |
7998ea1c74b88d9f7000465d148f3f996a13022d | diff --git a/sievelib/managesieve.py b/sievelib/managesieve.py
index <HASH>..<HASH> 100644
--- a/sievelib/managesieve.py
+++ b/sievelib/managesieve.py
@@ -497,8 +497,7 @@ class Client(object):
:rtype: boolean
"""
try:
- self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
- self.sock.connect((self.srvaddr, self.srvport))
+ self.sock = socket.create_connection((self.srvaddr, self.srvport))
self.sock.settimeout(Client.read_timeout)
except socket.error as msg:
raise Error("Connection to server failed: %s" % str(msg)) | use socket.create_connection() to build socket connection.
This also adds IPv6 support. | tonioo_sievelib | train | py |
c1b1cba0b5633c000a61e80ab98e4baac7fd1b14 | diff --git a/adrest/views.py b/adrest/views.py
index <HASH>..<HASH> 100644
--- a/adrest/views.py
+++ b/adrest/views.py
@@ -22,8 +22,9 @@ class ResourceView(HandlerMixin, ThrottleMixin, EmitterMixin, ParserMixin, Authe
api = None
log = True
-
- allowed_methods = ('GET', )
+
+ # Since we handle cross-origin XML HTTP requests, let OPTIONS be another default allowed method.
+ allowed_methods = ('GET', 'OPTIONS')
emitters = (XMLTemplateEmitter, JSONTemplateEmitter) | OPTIONS added to default resource view methods. | klen_adrest | train | py |
2e0348b9228a53673303366e4343217b1010143c | diff --git a/src/src/com/tns/JsDebugger.java b/src/src/com/tns/JsDebugger.java
index <HASH>..<HASH> 100644
--- a/src/src/com/tns/JsDebugger.java
+++ b/src/src/com/tns/JsDebugger.java
@@ -126,10 +126,6 @@ public class JsDebugger
LocalSocket socket = serverSocket.accept();
logger.write("Debugger new connection on: " + socket.getFileDescriptor().toString());
- dbgMessages.clear();
- dbgMessages.addAll(compileMessages);
-
-
//out (send messages to node inspector)
this.responseHandler = new ResponseHandler(socket, requestHandlerCloseable);
Thread responseThread = new Thread(this.responseHandler);
@@ -144,7 +140,8 @@ public class JsDebugger
this.responseHandler.stop();
socket.close();
-
+ dbgMessages.clear();
+ dbgMessages.addAll(compileMessages);
}
catch (IOException | InterruptedException e)
{ | clear messages at the end of the current debug connection to prepare for a new one | NativeScript_android-runtime | train | java |
be7fa47e30432eabc4e14a01c1a08cdedff2db6a | diff --git a/example.js b/example.js
index <HASH>..<HASH> 100644
--- a/example.js
+++ b/example.js
@@ -1,7 +1,5 @@
-'use strict'
-
const moment = require('moment')
-const fastJson = require('.')
+const fastJson = require('fast-json-stringify')
const stringify = fastJson({
title: 'Example Schema',
type: 'object', | modifying run kit example (#<I>) | fastify_fast-json-stringify | train | js |
a1a8439af37eea6c6ad751bce77b49c623ab2629 | diff --git a/docs/conf.py b/docs/conf.py
index <HASH>..<HASH> 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -98,7 +98,7 @@ html_theme = 'sphinx_rtd_theme'
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
-html_static_path = ['_static']
+html_static_path = []
# Custom sidebar templates, must be a dictionary that maps document names
# to template names. | remove 'static' folder in sphinx conf | tmontaigu_pylas | train | py |
53fa493c90db4c21ae81c69c17e12f510bcf9063 | diff --git a/jujupy.py b/jujupy.py
index <HASH>..<HASH> 100644
--- a/jujupy.py
+++ b/jujupy.py
@@ -281,8 +281,7 @@ class EnvJujuClient:
else:
controller_option = ('-c', controller_client.env.environment)
self.juju(_jes_cmds[seen_cmd]['create'], controller_option + (
- self.env.environment, '--config', config_file),
- include_e=False)
+ self.env.environment, '--config', config_file), include_e=False)
def destroy_environment(self, force=True, delete_jenv=False):
if force: | Drive-by lint cleanup. | juju_juju | train | py |
366454ee39a803f1bdeabc7c79fbb973c101c026 | diff --git a/Facades/Http.php b/Facades/Http.php
index <HASH>..<HASH> 100644
--- a/Facades/Http.php
+++ b/Facades/Http.php
@@ -33,7 +33,7 @@ use Illuminate\Http\Client\Factory;
* @method static \Illuminate\Http\Client\PendingRequest dump()
* @method static \Illuminate\Http\Client\PendingRequest dd()
* @method static \Illuminate\Http\Client\PendingRequest async()
- * @method static \Illuminate\Http\Client\Pool pool(callable $callback)
+ * @method static array pool(callable $callback)
* @method static \Illuminate\Http\Client\Response delete(string $url, array $data = [])
* @method static \Illuminate\Http\Client\Response get(string $url, array $query = [])
* @method static \Illuminate\Http\Client\Response head(string $url, array $query = []) | fix return type of pool (#<I>) | illuminate_support | train | php |
896d6ce0ca81f49fee5816e1af55dcde3e51c075 | diff --git a/isort/parse.py b/isort/parse.py
index <HASH>..<HASH> 100644
--- a/isort/parse.py
+++ b/isort/parse.py
@@ -510,6 +510,22 @@ def identify_contiguous_imports(
import_section += line
elif stripped_line.startswith(IMPORT_START_IDENTIFIERS):
import_section += line
+ if "(" in stripped_line and not ")" in stripped_line:
+ nested_line = line
+ nested_stripped_line = nested_line.strip()
+ while not ")" in nested_stripped_line:
+ nested_line = input_stream.readline()
+ nested_stripped_line = nested_line.strip()
+ import_section += nested_line
+
+ if stripped_line.endswith("\\"):
+ nested_line = line
+ nested_stripped_line = nested_line.strip()
+ while nested_line and nested_stripped_line.endswith("\\"):
+ nested_line = input_stream.readline()
+ nested_stripped_line = nested_line.strip()
+ import_section += nested_line
+
contains_imports = True
else:
not_imports = True | Attempt to deal with \ and ( \n \n ) continuouations | timothycrosley_isort | train | py |
76e9fe24312fb1f3abd2058b669644c55c63a0d3 | diff --git a/deployment/vm/fakes/fake_vm.go b/deployment/vm/fakes/fake_vm.go
index <HASH>..<HASH> 100644
--- a/deployment/vm/fakes/fake_vm.go
+++ b/deployment/vm/fakes/fake_vm.go
@@ -29,6 +29,9 @@ type FakeVM struct {
StartCalled int
StartErr error
+ DrainCalled int
+ DrainErr error
+
AttachDiskInputs []AttachDiskInput
attachDiskBehavior map[string]error
@@ -153,6 +156,11 @@ func (vm *FakeVM) Start() error {
return vm.StartErr
}
+func (vm *FakeVM) Drain() error {
+ vm.DrainCalled++
+ return vm.DrainErr
+}
+
func (vm *FakeVM) WaitToBeRunning(maxAttempts int, delay time.Duration) error {
vm.WaitToBeRunningInputs = append(vm.WaitToBeRunningInputs, WaitInput{
MaxAttempts: maxAttempts, | Update hand-rolled fake VM with Drain call | cloudfoundry_bosh-cli | train | go |
f4e75f0978a77ff0a1e836c55ab0f2dbc1379cf6 | diff --git a/src/ScreenSwitcher.js b/src/ScreenSwitcher.js
index <HASH>..<HASH> 100644
--- a/src/ScreenSwitcher.js
+++ b/src/ScreenSwitcher.js
@@ -115,7 +115,7 @@ ScreenSwitcher.defaultProps = {
ScreenSwitcher.propTypes = {
children: PropTypes.node.isRequired,
- hideButton: PropTypes.boolean,
+ hideButton: PropTypes.bool,
};
export default ScreenSwitcher; | Update ScreenSwitcher.js (#4) | calvium_react-native-device-screen-switcher | train | js |
80fea58917eb2e1ec38910b58f7502688d214e37 | diff --git a/src/Controller/Component/CapabilityComponent.php b/src/Controller/Component/CapabilityComponent.php
index <HASH>..<HASH> 100644
--- a/src/Controller/Component/CapabilityComponent.php
+++ b/src/Controller/Component/CapabilityComponent.php
@@ -7,6 +7,27 @@ use Cake\ORM\TableRegistry;
class CapabilityComponent extends Component
{
/**
+ * Method that returns all controller names.
+ * @param bool $includePlugins flag for including plugin controllers
+ * @return array controller names
+ */
+ protected function _getAllControllers($includePlugins = true)
+ {
+ $controllers = $this->_getDirControllers(APP . 'Controller' . DS);
+
+ if (true === $includePlugins) {
+ $plugins = \Cake\Core\Plugin::loaded();
+ foreach ($plugins as $plugin) {
+ // plugin path
+ $path = \Cake\Core\Plugin::path($plugin) . 'src' . DS . 'Controller' . DS;
+ $controllers = array_merge($controllers, $this->_getDirControllers($path, $plugin));
+ }
+ }
+
+ return $controllers;
+ }
+
+ /**
* Method that retrieves controller names
* found on the provided directory path.
* @param string $path directory path | added method for retrieving all controllers names (task #<I>) | QoboLtd_cakephp-roles-capabilities | train | php |
4b214a92c0a99add5107baa6591979bff8dc369c | diff --git a/gulpfile.js b/gulpfile.js
index <HASH>..<HASH> 100644
--- a/gulpfile.js
+++ b/gulpfile.js
@@ -139,6 +139,14 @@ gulp.task('watch', function () {
gulp.watch('./src/js/**/*.js', ['test']);
});
+gulp.task('node-server', function (cb) {
+ var cmd = spawn('node', ['server.js'], { stdio: 'inherit' });
+ cmd.on('close', function (code) {
+ console.log('my-task exited with code ' + code);
+ cb(code);
+ });
+});
+
gulp.task('dev', ['default']);
-gulp.task('default', ['webpack:server', 'watch']);
\ No newline at end of file
+gulp.task('default', ['webpack:server', 'watch', 'node-server']);
\ No newline at end of file | task for the node server, initialises in the default gulp task | heldrida_reactatouille-boilerplate | train | js |
81721164772df768a56b82b13099e4a8a5011354 | diff --git a/inferno/callbacks.py b/inferno/callbacks.py
index <HASH>..<HASH> 100644
--- a/inferno/callbacks.py
+++ b/inferno/callbacks.py
@@ -293,8 +293,8 @@ class PrintLog(Callback):
why `PrintLog` works best in conjunction with that callback.
*Note*: `PrintLog` will not result in good outputs if the number
- of columns varies between epochs, e.g. if the valid loss is only
- present on every other epoch.
+ of columns varies between epochs, e.g. if the valid loss is only
+ present on every other epoch.
Parameters
---------- | Wrong indentation in docstring fixed. | skorch-dev_skorch | train | py |
346984788157afa318ab0691b16b85d2897f07b2 | diff --git a/plugin/wavesurfer.microphone.js b/plugin/wavesurfer.microphone.js
index <HASH>..<HASH> 100644
--- a/plugin/wavesurfer.microphone.js
+++ b/plugin/wavesurfer.microphone.js
@@ -22,12 +22,19 @@
this.reloadBufferFunction = this.reloadBuffer.bind(this);
// cross-browser getUserMedia
- this.getUserMedia = (
+ var getUserMediaFn =
navigator.getUserMedia ||
navigator.webkitGetUserMedia ||
navigator.mozGetUserMedia ||
- navigator.msGetUserMedia
- ).bind(navigator);
+ navigator.msGetUserMedia;
+
+ if (getUserMediaFn) {
+ this.getUserMedia = getUserMediaFn.bind(navigator);
+ } else {
+ this.getUserMedia = function (constraints, successCallback, errorCallback) {
+ errorCallback(new Error('getUserMedia is not supported'));
+ };
+ }
// The buffer size in units of sample-frames.
// If specified, the bufferSize must be one of the following values: | check does browser support getUserMedia | katspaugh_wavesurfer.js | train | js |
be71d2c3702c57e2dff19f544e983174137a9fb5 | diff --git a/lib/mail/Mail.php b/lib/mail/Mail.php
index <HASH>..<HASH> 100644
--- a/lib/mail/Mail.php
+++ b/lib/mail/Mail.php
@@ -1093,11 +1093,28 @@ class Mail implements \JsonSerializable
/**
* Retrieve the contents attached to a Mail object
+ *
+ * Will return array of Content Objects with text/plain MimeType first
+ * Array re-ordered before return where this is not already the case
*
* @return Content[]
*/
public function getContents()
{
+ if ($this->contents[0]->getType() !== 'text/plain'
+ && count($this->contents) > 1
+ ) {
+
+ foreach ($this->contents as $key => $value) {
+ if ($value->getType() == 'text/plain') {
+ $plain_content = $value;
+ unset($this->contents[$key]);
+ break;
+ }
+ }
+ array_unshift($this->contents, $plain_content);
+ }
+
return $this->contents;
} | Add check so that getContents() always returns content with MimeType text/plain first in array of Content objects | sendgrid_sendgrid-php | train | php |
5e2b621f06c3a9452ca822d25ab82c3604fd3752 | diff --git a/src/services/SeoService.php b/src/services/SeoService.php
index <HASH>..<HASH> 100644
--- a/src/services/SeoService.php
+++ b/src/services/SeoService.php
@@ -22,8 +22,8 @@ class SeoService extends Component
{
$headers = Craft::$app->getResponse()->getHeaders();
- // If devMode always noindex
- if (Craft::$app->config->general->devMode)
+ // Always noindex except on production environment
+ if (CRAFT_ENVIRONMENT !== 'production')
{
$headers->set('x-robots-tag', 'none, noimageindex');
return; | ✨ noindex except on production environment | ethercreative_seo | train | php |
094ac69ecd41c83245d1f1c8a2910ff5dbe36e2d | diff --git a/Snappy/LoggableGenerator.php b/Snappy/LoggableGenerator.php
index <HASH>..<HASH> 100644
--- a/Snappy/LoggableGenerator.php
+++ b/Snappy/LoggableGenerator.php
@@ -77,6 +77,16 @@ class LoggableGenerator implements GeneratorInterface
}
/**
+ * {@inheritDoc}
+ */
+ public function setOption($name, $value)
+ {
+ $this->logDebug(sprintf('Set option %s = %s.', $name, $value));
+
+ return $this->generator->setOption($name, $value);
+ }
+
+ /**
* Logs the given debug message if the logger is configured or do nothing
* otherwise
* | Added another method to be able to set options
Not sure why something so simple but necessary is missing from this interface to Snappy.
I just added a new option to be able to set options before generating the PDF document. | KnpLabs_KnpSnappyBundle | train | php |
0420fb56475409c209193fbd45f9afffe8cd35eb | diff --git a/activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb b/activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb
index <HASH>..<HASH> 100644
--- a/activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb
+++ b/activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb
@@ -6,6 +6,11 @@ module ActiveRecord
class Base
def self.mysql2_connection(config)
config[:username] = 'root' if config[:username].nil?
+
+ if Mysql2::Client.const_defined? :FOUND_ROWS
+ config[:flags] = Mysql2::Client::FOUND_ROWS
+ end
+
client = Mysql2::Client.new(config.symbolize_keys)
options = [config[:host], config[:username], config[:password], config[:database], config[:port], config[:socket], 0]
ConnectionAdapters::Mysql2Adapter.new(client, logger, options, config) | adding FOUND_ROWS to the connect flags for mysql2 | rails_rails | train | rb |
9f50c813080c180ffb5bfbd7491db2670d4fcc3f | diff --git a/src/node/surface_component.js b/src/node/surface_component.js
index <HASH>..<HASH> 100644
--- a/src/node/surface_component.js
+++ b/src/node/surface_component.js
@@ -39,6 +39,14 @@ SurfaceComponent.Prototype = function() {
throw new Error("This method is abstract and must be overridden");
};
+ this.getElement = function() {
+ return this.el;
+ };
+
+ this.getRange = function() {
+ return this.range;
+ };
+
};
SurfaceComponent.Prototype.prototype = Component.prototype;
@@ -48,7 +56,7 @@ Object.defineProperties(SurfaceComponent.prototype, {
"range": {
get: function() {
if (!this.__range__) {
- this.__range__ = __createRange__(this.getElement());
+ this.__range__ = __createRange__(this.el);
}
return this.__range__;
} | Fix old regression: added legacy methods. | substance_nodes | train | js |
7826a58dfc94187efb8710f0a195c82eb05cf84a | diff --git a/acceptance/ui/features/support/env.rb b/acceptance/ui/features/support/env.rb
index <HASH>..<HASH> 100644
--- a/acceptance/ui/features/support/env.rb
+++ b/acceptance/ui/features/support/env.rb
@@ -59,6 +59,7 @@ if Capybara.app_host.empty?
Capybara.app_host = "http://localhost"
end
printf "Using app_host=%s\n", Capybara.app_host
+printf "Using userid=%s\n", ENV["APPLICATION_USERID"]
#
# NOTE: Cucumber does not provide an API to override the output directory | Log the userid used for acceptance tests | control-center_serviced | train | rb |
05da51a41d4a1a7a08e5f19194a248923780fff8 | diff --git a/engineio/socket.py b/engineio/socket.py
index <HASH>..<HASH> 100755
--- a/engineio/socket.py
+++ b/engineio/socket.py
@@ -140,7 +140,7 @@ class Socket(object):
# try to set a socket timeout matching the configured ping interval
for attr in ['_sock', 'socket']: # pragma: no cover
if hasattr(ws, attr) and hasattr(getattr(ws, attr), 'settimeout'):
- getattr(ws, attr).settimeout(self.server.ping_interval)
+ getattr(ws, attr).settimeout(self.server.ping_timeout)
if self.connected:
# the socket was already connected, so this is an upgrade | be a bit more forgiving with socket timeouts | miguelgrinberg_python-engineio | train | py |
b83678340ae059038654dc9f3821ff10fc226868 | diff --git a/tests/Common/TokensTest.php b/tests/Common/TokensTest.php
index <HASH>..<HASH> 100644
--- a/tests/Common/TokensTest.php
+++ b/tests/Common/TokensTest.php
@@ -579,10 +579,12 @@ class TokensTest extends StorageApiTestCase
public function testTokenWithoutTokensManagePermissionCanListAndViewOnlySelf()
{
+ $initialTokens = $this->_client->listTokens();
+
$tokenId = $this->_client->createToken([], 'Token without canManageTokens permission');
$tokens = $this->_client->listTokens();
- $this->assertGreaterThan(1, count($tokens));
+ $this->assertCount(count($initialTokens) + 1, $tokens);
$token = $this->_client->getToken($tokenId);
$this->assertFalse($token['canManageTokens']); | fixup tests: tokens list and get | keboola_storage-api-php-client | train | php |
c5e140c79dc90e2c67201b72327ef482e7143d26 | diff --git a/consul/state/prepared_query.go b/consul/state/prepared_query.go
index <HASH>..<HASH> 100644
--- a/consul/state/prepared_query.go
+++ b/consul/state/prepared_query.go
@@ -14,6 +14,11 @@ var validUUID = regexp.MustCompile(`(?i)^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f
// isUUID returns true if the given string is a valid UUID.
func isUUID(str string) bool {
+ const uuidLen = 36
+ if len(str) != uuidLen {
+ return false
+ }
+
return validUUID.MatchString(str)
} | Small premature optimization in `isUUID()`.
If the length isn't `<I>`, return `false` immediately before firing up
the regexp engine. | hashicorp_consul | train | go |
dbe3f35756778c22f9661c3deb0f4d0053ee475b | diff --git a/Gruntfile.js b/Gruntfile.js
index <HASH>..<HASH> 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -49,7 +49,7 @@ module.exports = function(grunt) {
command: 'git add progressbar.min.js progressbar.min.js.map; git commit -m "Add minified script"'
}
},
- extRelease: {
+ release: {
options: {
// Don't release to NPM
npm: false, | Rename config back to release since grunt-release does not support rename <URL> | kimmobrunfeldt_progressbar.js | train | js |
c18e1687741ef3fbee53dbc0ef0f08ec5b7011ae | diff --git a/lib/vocab.js b/lib/vocab.js
index <HASH>..<HASH> 100644
--- a/lib/vocab.js
+++ b/lib/vocab.js
@@ -209,7 +209,7 @@ module.exports = function(modulename) {
schema.vocab = {
module: modulename,
term,
- registrationOrder: _M.registrationOrder++,
+ registrationOrder: _M._registrationOrder++,
};
// Store term in global vocab object: | forgot an underscore on _registrationOrder | OADA_oada-formats | train | js |
fee843be7dc93fdaadd148171bf7824b76524bcd | diff --git a/src/Qcloud/Cos/Client.php b/src/Qcloud/Cos/Client.php
index <HASH>..<HASH> 100644
--- a/src/Qcloud/Cos/Client.php
+++ b/src/Qcloud/Cos/Client.php
@@ -130,9 +130,11 @@ class Client extends GSClient {
$options = Collection::fromConfig(array_change_key_case($options), array(
'min_part_size' => Copy::MIN_PART_SIZE,
'params' => $options));
- $sourcebucket = explode('-',explode('.',$copysource)[0])[0];
- $sourceappid = explode('-',explode('.',$copysource)[0])[1];
- $sourceregion = explode('.',$copysource)[2];
+ $sourcelistdot = explode('.',$copysource);
+ $sourcelistline = explode('-',$sourcelistdot[0]);
+ $sourcebucket = $sourcelistline[0];
+ $sourceappid = $sourcelistline[1];
+ $sourceregion = $sourcelistdot[2];
$sourcekey = substr(strstr($copysource,'/'),1);
$sourceversion = "";
$cosClient = new Client(array('region' => $sourceregion, | fix copy (#<I>) | tencentyun_cos-php-sdk-v5 | train | php |
7ef81e228bd47e7a81665ac4e98a1b3967f67d13 | diff --git a/queryset_sequence/__init__.py b/queryset_sequence/__init__.py
index <HASH>..<HASH> 100644
--- a/queryset_sequence/__init__.py
+++ b/queryset_sequence/__init__.py
@@ -116,6 +116,12 @@ class QuerySequence(six.with_metaclass(PartialInheritanceMeta, Query)):
"""Return the class-name and memory location; there's no SQL to show."""
return object.__str__(self)
+ def chain(self, *args, **kwargs):
+ obj = super(QuerySequence, self).chain(*args, **kwargs)
+
+ obj._querysets = [qs._chain() for qs in self._querysets]
+ return obj
+
def clone(self, *args, **kwargs):
obj = super(QuerySequence, self).clone(*args, **kwargs)
@@ -425,6 +431,7 @@ class QuerySetSequence(six.with_metaclass(PartialInheritanceMeta, QuerySet)):
'db',
# Private methods.
+ '_chain',
'_clone',
'_fetch_all',
'_merge_sanity_check', | Added support for Queryset._clone() and Query.clone()
Regards django/django#<I> | percipient_django-querysetsequence | train | py |
1e667cba283b79fa9297b688ca0d7086b2d22d81 | diff --git a/src/image/operator/paintPoints.js b/src/image/operator/paintPoints.js
index <HASH>..<HASH> 100644
--- a/src/image/operator/paintPoints.js
+++ b/src/image/operator/paintPoints.js
@@ -8,7 +8,7 @@ import Shape from '../../util/shape';
* @param {Array<Array<number>>} points - Array of [x,y] points
* @param {object} [options]
* @param {Array<number>} [options.color=[max,0,0]] - Array of 3 elements (R, G, B), default is red.
- * @param {Array<number>} [options.shape] - Array of 3 elements (R, G, B), default is red.
+ * @param {object} [options.shape] - Definition of the shape, see Shape contructor.
* @return {this} The original painted image
*/
export default function paintPoints(points, options = {}) { | Fix help of paintPOInts | image-js_image-js | train | js |
782db45280d89854d9fd0fc3d9b62c6a8c877a9a | diff --git a/packages/neos-ui-ckeditor-bindings/src/ckeditor/neosPlaceholder.js b/packages/neos-ui-ckeditor-bindings/src/ckeditor/neosPlaceholder.js
index <HASH>..<HASH> 100644
--- a/packages/neos-ui-ckeditor-bindings/src/ckeditor/neosPlaceholder.js
+++ b/packages/neos-ui-ckeditor-bindings/src/ckeditor/neosPlaceholder.js
@@ -65,7 +65,12 @@ export default CKEDITOR => {
// IF: editable allows a "P" inside, we create a "newline".
// NOTE: this condition might not be good enough; we might need to check for block level elements using CKEDITOR.dtd.$block
if (CKEDITOR.dtd[editable.getName()].p) {
- editable.setHtml('<p><br/></p>');
+ if (editor.config.autoParagraph) {
+ editable.setHtml('<p><br/></p>');
+ } else {
+ editable.setHtml('');
+ }
+
// Set caret in position
const range = editor.createRange();
range.moveToElementEditablePosition(editable.getFirst(), true); | TASK: Add condition for autoParagraph to neos placeholder plugin | neos_neos-ui | train | js |
458998d0a5757ae0a396f52542a2decc22c616e2 | diff --git a/Examples/SimpleClient.php b/Examples/SimpleClient.php
index <HASH>..<HASH> 100644
--- a/Examples/SimpleClient.php
+++ b/Examples/SimpleClient.php
@@ -24,7 +24,7 @@ $onClose = function ($msg) {
$connection = new Connection(
array(
- "realm" => 'ff',
+ "realm" => 'realm1',
"onClose" => $onClose,
// "onChallenge" => $onChallenge,
"url" => 'ws://127.0.0.1:9090', | Changed the example client to realm1. | voryx_Thruway | train | php |
10c868c2b1796fb151b6f91dd940bbe71abae3ee | diff --git a/salt/cloud/clouds/openstack.py b/salt/cloud/clouds/openstack.py
index <HASH>..<HASH> 100644
--- a/salt/cloud/clouds/openstack.py
+++ b/salt/cloud/clouds/openstack.py
@@ -75,6 +75,7 @@ Either a password or an API key must also be specified:
apikey: 901d3f579h23c8v73q9
Optionally, if you don't want to save plain-text password in your configuration file, you can use keyring:
+
.. code-block:: yaml
my-openstack-keyring-config: | Fix docs so they will format correctly | saltstack_salt | train | py |
9ae6ec521fe7c8d97d77e2efd699e40f0cbe734c | diff --git a/lib/action_tracker/version.rb b/lib/action_tracker/version.rb
index <HASH>..<HASH> 100644
--- a/lib/action_tracker/version.rb
+++ b/lib/action_tracker/version.rb
@@ -1,3 +1,3 @@
module ActionTracker
- VERSION = '0.1.6.1'.freeze
+ VERSION = '0.1.6.2'.freeze
end | Bumping gem version for <I> | appprova_action_tracker | train | rb |
7cf3c763ff5a03f95eeabba3f1818d48edd0ba05 | diff --git a/httpclient/socksify.go b/httpclient/socksify.go
index <HASH>..<HASH> 100644
--- a/httpclient/socksify.go
+++ b/httpclient/socksify.go
@@ -49,13 +49,19 @@ func SOCKS5DialFuncFromEnvironment(origDialer DialFunc) DialFunc {
return origDialer
}
- socks5Proxy := proxy.NewSocks5Proxy(proxy.NewHostKeyGetter())
- dialer, err := socks5Proxy.Dialer(string(proxySSHKey), proxyURL.Host)
- if err != nil {
- return origDialer
- }
-
+ var (
+ socks5Proxy *proxy.Socks5Proxy
+ dialer proxy.DialFunc
+ )
return func(network, address string) (net.Conn, error) {
+ if socks5Proxy == nil {
+ var err error
+ socks5Proxy = proxy.NewSocks5Proxy(proxy.NewHostKeyGetter())
+ dialer, err = socks5Proxy.Dialer(string(proxySSHKey), proxyURL.Host)
+ if err != nil {
+ return origDialer(network, address)
+ }
+ }
return dialer(network, address)
}
} | Start proxy and create dialer when dial is called
This avoids unnecessarily creating these resources when they are not
needed (for instance when someone just runs `bosh --version` in the
bosh-cli).
[#<I>] | cloudfoundry_bosh-utils | train | go |
45f9383cf8817524d8bfe6027aa8fe675214248f | diff --git a/go/pools/resource_pool.go b/go/pools/resource_pool.go
index <HASH>..<HASH> 100644
--- a/go/pools/resource_pool.go
+++ b/go/pools/resource_pool.go
@@ -47,8 +47,11 @@ type resourceWrapper struct {
}
// NewResourcePool creates a new ResourcePool pool.
-// capacity is the initial capacity of the pool.
-// maxCap is the maximum capacity.
+// capacity is the number of active resources in the pool:
+// there can be up to 'capacity' of these at a given time.
+// maxCap specifies the extent to which the pool can be resized
+// in the future through the SetCapacity function.
+// You cannot resize the pool beyond maxCap.
// If a resource is unused beyond idleTimeout, it's discarded.
// An idleTimeout of 0 means that there is no timeout.
func NewResourcePool(factory Factory, capacity, maxCap int, idleTimeout time.Duration) *ResourcePool { | pools: clarify diff between capacity and maxCap | vitessio_vitess | train | go |
6203920e5be8c7a908ff6aa69814852128578d1b | diff --git a/roku/discovery.py b/roku/discovery.py
index <HASH>..<HASH> 100644
--- a/roku/discovery.py
+++ b/roku/discovery.py
@@ -7,6 +7,9 @@ import socket
import httplib
import StringIO
+ST_DIAL = 'urn:dial-multiscreen-org:service:dial:1'
+ST_ECP = 'roku:ecp'
+
class SSDPResponse(object):
@@ -26,7 +29,7 @@ class SSDPResponse(object):
return '<SSDPResponse({location}, {st}, {usn})'.format(**self.__dict__)
-def discover(timeout=2, retries=1):
+def discover(timeout=2, retries=1, st=ST_ECP):
group = ('239.255.255.250', 1900)
@@ -45,7 +48,7 @@ def discover(timeout=2, retries=1):
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, socket.IPPROTO_UDP)
sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
sock.setsockopt(socket.IPPROTO_IP, socket.IP_MULTICAST_TTL, 2)
- sock.sendto(message.format(st='roku:ecp'), group)
+ sock.sendto(message.format(st=st), group)
while 1:
try: | add configurable service type to discover method | jcarbaugh_python-roku | train | py |
ba1a2f40e15972e4ba98a1be719d7614957f95a6 | diff --git a/bin/cache_gc.py b/bin/cache_gc.py
index <HASH>..<HASH> 100755
--- a/bin/cache_gc.py
+++ b/bin/cache_gc.py
@@ -36,6 +36,7 @@ oqpath.set_oq_path()
from openquake import kvs
from openquake import logs
+from openquake import settings
from openquake.kvs import tokens
LOG = logs.LOG
@@ -128,6 +129,8 @@ def clear_job_data(job_id):
:param job_id: job ID as an integer
"""
+ logs.init_logs(level='warn', log_type=settings.LOGGING_BACKEND)
+
try:
job_id = int(job_id)
except ValueError: | Initialize logging in cache_gc.py. | gem_oq-engine | train | py |
98bd5fb4f676653e44ca695f76715e0442c34358 | diff --git a/appengine_toolkit/management/commands/_utils.py b/appengine_toolkit/management/commands/_utils.py
index <HASH>..<HASH> 100644
--- a/appengine_toolkit/management/commands/_utils.py
+++ b/appengine_toolkit/management/commands/_utils.py
@@ -32,3 +32,16 @@ def collect_dependency_paths(package_name):
deps.extend(collect_dependency_paths(req.project_name))
return deps
+
+
+def parse_requirements_file(req_file):
+ """
+ TODO docstrings
+ """
+ lines = []
+ for line in req_file.readlines():
+ line = line.strip()
+ if not line or line.startswith('#'):
+ continue
+ lines.append(line)
+ return lines | added function to parse requirement file | masci_django-appengine-toolkit | train | py |
c31033cf4c22355ce21efe702f834d64dfbc6857 | diff --git a/lib/qr.js b/lib/qr.js
index <HASH>..<HASH> 100644
--- a/lib/qr.js
+++ b/lib/qr.js
@@ -8,12 +8,16 @@ var vector = require('./vector');
var fn_noop = function() {};
-var DEFAULT_OPTIONS = {
+var BITMAP_OPTIONS = {
ec_level: 'M',
- type: 'png',
size: 5,
margin: 4,
- customize: null,
+ customize: null
+};
+
+var VECTOR_OPTIONS = {
+ ec_level: 'M',
+ margin: 1
};
function get_options(options) {
@@ -22,11 +26,15 @@ function get_options(options) {
} else {
options = options || {};
}
- var _options = {};
- for (var k in DEFAULT_OPTIONS) {
- _options[k] = k in options ? options[k] : DEFAULT_OPTIONS[k];
+ var _options = {
+ type: String(options.type || 'png').toLowerCase()
+ };
+
+ var defaults = _options.type == 'png' ? BITMAP_OPTIONS : VECTOR_OPTIONS;
+
+ for (var k in defaults) {
+ _options[k] = k in options ? options[k] : defaults[k];
}
- _options.type = ('' + _options.type).toLowerCase();
return _options;
} | Different defaults for bitmap and vector | alexeyten_qr-image | train | js |
e3152d6700b1837615596d5dbdf4b71e7abb881c | diff --git a/src/BoomCMS/Chunk/Slideshow/Slide.php b/src/BoomCMS/Chunk/Slideshow/Slide.php
index <HASH>..<HASH> 100644
--- a/src/BoomCMS/Chunk/Slideshow/Slide.php
+++ b/src/BoomCMS/Chunk/Slideshow/Slide.php
@@ -39,7 +39,7 @@ class Slide
public function getAssetId()
{
- return $this->getAsset()->getId();
+ return $this->attrs['asset_id'];
}
public function getCaption() | Improved efficiancy of chunk slideshows
Don't fetch asset from database unnecessarily | boomcms_boom-core | train | php |
0edc6f00d640da9b4650587f5de73657e52ba540 | diff --git a/gshell-testsuite/src/test/java/org/apache/gshell/testsuite/TestShellBuilder.java b/gshell-testsuite/src/test/java/org/apache/gshell/testsuite/TestShellBuilder.java
index <HASH>..<HASH> 100644
--- a/gshell-testsuite/src/test/java/org/apache/gshell/testsuite/TestShellBuilder.java
+++ b/gshell-testsuite/src/test/java/org/apache/gshell/testsuite/TestShellBuilder.java
@@ -20,6 +20,7 @@
package org.apache.gshell.testsuite;
import org.apache.gshell.registry.CommandRegistrar;
+import org.apache.gshell.Shell;
import org.apache.maven.shell.ShellBuilder;
/**
@@ -34,4 +35,10 @@ public class TestShellBuilder
CommandRegistrar registrar = getContainer().lookup(CommandRegistrar.class);
registrar.registerCommand(name, type);
}
+
+ @Override
+ public Shell create() throws Exception {
+ setRegisterCommands(false);
+ return super.create();
+ }
}
\ No newline at end of file | Speed up tests, only register what is required | jdillon_gshell | train | java |
df4bdd1dd54dc3ed2507f88f43e258e25c5228d8 | diff --git a/src/Persistence_SQL.php b/src/Persistence_SQL.php
index <HASH>..<HASH> 100644
--- a/src/Persistence_SQL.php
+++ b/src/Persistence_SQL.php
@@ -262,8 +262,9 @@ class Persistence_SQL extends Persistence
$fx = $args[0];
$field = is_string($args[1]) ? $m->getElement($args[1]) : $args[1];
- $q->field($q->expr("$fx([])", [$field]));
$this->initQueryConditions($m, $q);
+ $m->hook('initSelectQuery', [$q, $type]);
+ $q->reset('field')->field($q->expr("$fx([])", [$field]));
return $q; | call joins when executing fx() | atk4_data | train | php |
15ff4285ffccd3492641dfb002a02614ac6dc0d1 | diff --git a/insights/client/config.py b/insights/client/config.py
index <HASH>..<HASH> 100644
--- a/insights/client/config.py
+++ b/insights/client/config.py
@@ -93,7 +93,7 @@ DEFAULT_OPTS = {
'check_results': {
'default': False,
'opt': ['--check-results'],
- 'help': "Check for insights results",
+ 'help': argparse.SUPPRESS,
'action': "store_true",
'group': 'actions'
}, | suppress help output for check-results (#<I>) | RedHatInsights_insights-core | train | py |
8c4d9b79d5727aa803b88e8181f7edabe46b40c4 | diff --git a/searx/search.py b/searx/search.py
index <HASH>..<HASH> 100644
--- a/searx/search.py
+++ b/searx/search.py
@@ -391,11 +391,11 @@ class Search(object):
load_default_categories = True
for pd_name, pd in self.request_data.items():
if pd_name == 'categories':
- self.categories.extend(categ.strip() for categ in pd.split(',') if categ in categories)
+ self.categories.extend(categ for categ in map(unicode.strip, pd.split(',')) if categ in categories)
elif pd_name == 'engines':
pd_engines = [{'category': engines[engine].categories[0],
'name': engine}
- for engine in map(str.strip, pd.split(',')) if engine in engines]
+ for engine in map(unicode.strip, pd.split(',')) if engine in engines]
if pd_engines:
self.engines.extend(pd_engines)
load_default_categories = False | [fix] engine selection from url | asciimoo_searx | train | py |
cc019b294b7c005ddbafd6d0c29a3eac03cb1e8d | diff --git a/app/controllers/api/activation_keys_controller.rb b/app/controllers/api/activation_keys_controller.rb
index <HASH>..<HASH> 100644
--- a/app/controllers/api/activation_keys_controller.rb
+++ b/app/controllers/api/activation_keys_controller.rb
@@ -18,7 +18,6 @@ class Api::ActivationKeysController < Api::ApiController
before_filter :find_organization, :only => [:index]
before_filter :find_activation_key, :only => [:show, :update, :destroy, :add_pool, :remove_pool]
before_filter :find_pool, :only => [:add_pool, :remove_pool]
- before_filter :authorize
def rules
read_test = lambda{ActivationKey.readable?(@organization)} | api perms review - activation keys | Katello_katello | train | rb |
44ef3ed8a0a8edaae69178b141ba54f8112cedbc | diff --git a/tests/test_opensimplex.py b/tests/test_opensimplex.py
index <HASH>..<HASH> 100644
--- a/tests/test_opensimplex.py
+++ b/tests/test_opensimplex.py
@@ -7,7 +7,10 @@ from opensimplex import OpenSimplex
class TestOpensimplex(unittest.TestCase):
def load_samples(self):
for line in gzip.open("tests/samples.json.gz"):
- yield json.loads(line)
+ # Python3: need to decode the line as it's a bytes object and json
+ # will only work on strings!
+ # TODO BUG: it will also take about 14 seconds to run the tests now! wtf
+ yield json.loads(line.decode("utf-8"))
def test_samples(self):
simplex = OpenSimplex(seed=0) | Fix failing tests on py3k. | lmas_opensimplex | train | py |
d6346d0f54c6bddabcf7640f50e100c11720717d | diff --git a/js/binance.js b/js/binance.js
index <HASH>..<HASH> 100644
--- a/js/binance.js
+++ b/js/binance.js
@@ -28,7 +28,7 @@ module.exports = class binance extends Exchange {
'fetchOrder': true,
'fetchOrders': true,
'fetchOpenOrders': true,
- 'fetchClosedOrders': true,
+ 'fetchClosedOrders': 'emulated',
'withdraw': true,
'fetchFundingFees': true,
'fetchDeposits': true, | binance has['fetchClosedOrders'] = emulated | ccxt_ccxt | train | js |
9673e1162a581bc1c39ac94f62ce3cd2b66e78fe | diff --git a/auth_jwt.go b/auth_jwt.go
index <HASH>..<HASH> 100644
--- a/auth_jwt.go
+++ b/auth_jwt.go
@@ -121,6 +121,9 @@ func (mw *JWTMiddleware) middlewareImpl(c *gin.Context) {
// Reply will be of the form {"token": "TOKEN"}.
func (mw *JWTMiddleware) LoginHandler(c *gin.Context) {
+ // Initial middleware default setting.
+ mw.MiddlewareInit()
+
var loginVals Login
if c.BindJSON(&loginVals) != nil {
diff --git a/auth_jwt_test.go b/auth_jwt_test.go
index <HASH>..<HASH> 100644
--- a/auth_jwt_test.go
+++ b/auth_jwt_test.go
@@ -43,7 +43,6 @@ func TestLoginHandler(t *testing.T) {
return true
},
}
- authMiddleware.MiddlewareInit()
gin.SetMode(gin.TestMode)
r := gin.New() | fix: Initial middleware default setting on login handle. | appleboy_gin-jwt | train | go,go |
f228768a8f3850e3c3b1187e44b2bdf175ca58ea | diff --git a/app/templates/gulpfile.js b/app/templates/gulpfile.js
index <HASH>..<HASH> 100644
--- a/app/templates/gulpfile.js
+++ b/app/templates/gulpfile.js
@@ -122,7 +122,7 @@ gulp.task('watch', ['connect', 'serve'], function () {
server.changed(file.path);
});
- gulp.watch('app/styles/**/*.<%= includeSass ? 'sass' : 'css' %>', ['styles']);
+ gulp.watch('app/styles/**/*.<%= includeSass ? 'scss' : 'css' %>', ['styles']);
gulp.watch('app/scripts/**/*.js', ['scripts']);
gulp.watch('app/images/**/*', ['images']);
gulp.watch('bower.json', ['wiredep']); | Fix Sass extension in gulp.watch() | niallobrien_generator-gulp-foundation | train | js |
6454d3b270f6ad161fde5e9e5158dcb7337b05db | diff --git a/js/load-image-meta.js b/js/load-image-meta.js
index <HASH>..<HASH> 100644
--- a/js/load-image-meta.js
+++ b/js/load-image-meta.js
@@ -208,7 +208,7 @@
* @returns {Promise<Blob|null>|undefined} Combined Blob
*/
function replaceHead(blob, head, callback) {
- var options = { maxMetaDataSize: 256, disableMetaDataParsers: true }
+ var options = { maxMetaDataSize: 1024, disableMetaDataParsers: true }
if (!callback && global.Promise) {
return parseMetaData(blob, options).then(function (data) {
return replaceJPEGHead(blob, data.imageHead, head) | Raise maxMetaDataSize for replaceHead function.
The image blob generated from a canvas for specific pictures contains a JPEG APP2 segment that is larger than <I> bytes.
See also #<I>. | blueimp_JavaScript-Load-Image | train | js |
88cbe13741b18bfd915802bff3f4560eb68f44a7 | diff --git a/activestorage/test/analyzer/video_analyzer_test.rb b/activestorage/test/analyzer/video_analyzer_test.rb
index <HASH>..<HASH> 100644
--- a/activestorage/test/analyzer/video_analyzer_test.rb
+++ b/activestorage/test/analyzer/video_analyzer_test.rb
@@ -24,7 +24,6 @@ class ActiveStorage::Analyzer::VideoAnalyzerTest < ActiveSupport::TestCase
assert_equal 480, metadata[:width]
assert_equal 640, metadata[:height]
assert_equal [4, 3], metadata[:display_aspect_ratio]
- assert_equal 5.227975, metadata[:duration]
assert_equal 90, metadata[:angle]
end | Fix activestorage CI failure due to ffprove version differece
Our CI environment is upgraded from stretch to buster then ffprove
version is also upgraded from <I> to <I>.
<URL> | rails_rails | train | rb |
Subsets and Splits