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
|
---|---|---|---|---|---|
fdd7c0448ddc2a4aec1ae73c75f97c813da24a3d | diff --git a/bors/app/config.py b/bors/app/config.py
index <HASH>..<HASH> 100644
--- a/bors/app/config.py
+++ b/bors/app/config.py
@@ -45,7 +45,7 @@ class AppConf:
def get_api_credentials(self, apiname):
"""Returns a Credentials object for API access"""
- for svc in self.data.get("api").get("services"):
+ for svc in self.conf.get("api").get("services"):
if svc["name"] == apiname:
try:
return svc.get("credentials") | Cleaned get_api_credentials -> fixed bug | RobotStudio_bors | train | py |
bfec9c4ccad8b76e81cebe87271620621ec11d72 | diff --git a/test/spider_task.py b/test/spider_task.py
index <HASH>..<HASH> 100644
--- a/test/spider_task.py
+++ b/test/spider_task.py
@@ -218,3 +218,31 @@ class TestSpider(TestCase):
bot.add_task(Task('page', url=SERVER.BASE_URL))
bot.run()
self.assertEqual(bot.tokens, ['fallback'])
+
+ def test_task_fallback_yields_new_task(self):
+ class TestSpider(Spider):
+ def prepare(self):
+ self.tokens = []
+
+ def task_page(self, grab, task):
+ self.tokens.append('task')
+ SERVER.RESPONSE['code'] = 403
+ yield Task('page2', url=SERVER.BASE_URL)
+
+ def task_page_fallback(self, task):
+ self.tokens.append('fallback')
+ SERVER.RESPONSE['code'] = 200
+ self.add_task(Task('page', url=SERVER.BASE_URL))
+
+ def task_page2(self, grab, task):
+ pass
+
+ def task_page2_fallback(self, task):
+ self.tokens.append('fallback2')
+
+ SERVER.RESPONSE['code'] = 403
+ bot = TestSpider(network_try_limit=2)
+ bot.setup_queue()
+ bot.add_task(Task('page', url=SERVER.BASE_URL))
+ bot.run()
+ self.assertEqual(bot.tokens, ['fallback', 'task', 'fallback2']) | Add more tests to check processing of fallback handlers | lorien_grab | train | py |
3680735661bc3afdee40d67cdc315aea505af163 | diff --git a/lib/app_drone/drones/nested_form/nested_form.rb b/lib/app_drone/drones/nested_form/nested_form.rb
index <HASH>..<HASH> 100644
--- a/lib/app_drone/drones/nested_form/nested_form.rb
+++ b/lib/app_drone/drones/nested_form/nested_form.rb
@@ -6,7 +6,7 @@ class NestedForm < Drone
depends_on :bundle, :javascript
def align
- bundle.add 'nested_form'
+ bundle.add 'nested_form', git: 'git://github.com/ryanb/nested_form.git'
javascript.pipeline 'jquery_nested_form'
end | Nested form gem must use git path. | jeriko_app_drone | train | rb |
530ee883416f6b6d7bb1add57791f670ae4b7d36 | diff --git a/spec/deferrable_gratification/combinators/bind_spec.rb b/spec/deferrable_gratification/combinators/bind_spec.rb
index <HASH>..<HASH> 100644
--- a/spec/deferrable_gratification/combinators/bind_spec.rb
+++ b/spec/deferrable_gratification/combinators/bind_spec.rb
@@ -10,14 +10,7 @@ describe DeferrableGratification::Combinators::Bind do
subject { described_class.new(@first, @second) }
- it 'should quack like a Deferrable' do
- should respond_to(:callback)
- should respond_to(:errback)
- end
-
- it 'should have a #go method to launch it' do
- should respond_to(:go)
- end
+ it_should_behave_like 'a Deferrable'
it 'should execute the first Deferrable' do
@first.should_receive(:go)
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index <HASH>..<HASH> 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -10,3 +10,13 @@ class MockDeferrable < EventMachine::DefaultDeferrable
self.stub!(:go) { self.fail(*args) }
end
end
+
+
+shared_examples_for 'a Deferrable' do
+ it { should respond_to(:callback) }
+ it { should respond_to(:errback) }
+
+ it 'should have a #go method to launch it' do
+ should respond_to(:go)
+ end
+end | Move common Deferrable behaviour specs into spec_helper | samstokes_deferrable_gratification | train | rb,rb |
a9edb288702400695258813d8e6f2cb327608a44 | diff --git a/lib/poseidon/connection.rb b/lib/poseidon/connection.rb
index <HASH>..<HASH> 100644
--- a/lib/poseidon/connection.rb
+++ b/lib/poseidon/connection.rb
@@ -10,12 +10,16 @@ module Poseidon
API_VERSION = 0
REPLICA_ID = -1 # Replica id is always -1 for non-brokers
+ attr_reader :host, :port
+
# Create a new connection
#
# @param [String] host Host to connect to
# @param [Integer] port Port broker listens on
# @param [String] client_id Unique across processes?
def initialize(host, port, client_id)
+ @host = host
+ @port = port
begin
@socket = TCPSocket.new(host, port)
rescue SystemCallError | Connection: add host and port attr readers | bpot_poseidon | train | rb |
e12635d566da9c5ab0cb51a610c10a6f9406a95e | diff --git a/src/messages/ru/admin.php b/src/messages/ru/admin.php
index <HASH>..<HASH> 100644
--- a/src/messages/ru/admin.php
+++ b/src/messages/ru/admin.php
@@ -370,7 +370,7 @@ return [
'js_scheduler_time' => 'Время выполнения',
'js_scheduler_save' => 'Добавить',
'js_scheduler_title_upcoming' => 'Предстоящее',
- 'js_scheduler_title_completed' => 'Заверешённое',
+ 'js_scheduler_title_completed' => 'Завершённое',
'js_scheduler_table_newvalue' => 'Новое значение',
'js_scheduler_table_timestamp' => 'Время выполнения',
'js_dir_manager_rename_success' => 'Директория успешно переименована.', | Update admin.php (#<I>)
fix: typo | luyadev_luya-module-admin | train | php |
6c16b5878acd1b75d566973e88d7ac2944d76656 | diff --git a/config/local.js b/config/local.js
index <HASH>..<HASH> 100644
--- a/config/local.js
+++ b/config/local.js
@@ -30,7 +30,7 @@ module.exports = {
* Cache settings
*/
cacheDB: 1,
- cacheExp: 10,
+ cacheExp: 1800,
/** | Increased default cache expiration to <I>min | cubic-js_cubic | train | js |
efd83077b4b7b1d8338065d570a4fd2c782516c0 | diff --git a/eZ/Publish/Core/REST/Client/LocationService.php b/eZ/Publish/Core/REST/Client/LocationService.php
index <HASH>..<HASH> 100644
--- a/eZ/Publish/Core/REST/Client/LocationService.php
+++ b/eZ/Publish/Core/REST/Client/LocationService.php
@@ -112,9 +112,10 @@ class LocationService implements \eZ\Publish\API\Repository\LocationService, Ses
$inputMessage = $this->outputVisitor->visit( $locationCreateStruct );
$inputMessage->headers['Accept'] = $this->outputVisitor->getMediaType( 'Location' );
+ $values = $this->urlHandler->parse( 'object', $contentInfo->id );
$result = $this->client->request(
'POST',
- $contentInfo->id,
+ $this->urlHandler->generate( 'objectLocations', array( 'object' => $values['object'] ) ),
$inputMessage
); | REST: Fix request URL for creating locations | ezsystems_ezpublish-kernel | train | php |
fe9b0969bedf1c1c70109a33769b38ed4d68c4cc | diff --git a/index.js b/index.js
index <HASH>..<HASH> 100644
--- a/index.js
+++ b/index.js
@@ -39,6 +39,7 @@ var Hyperlog = function (db, opts) {
this.logs = logs(db, {prefix: 'logs', valueEncoding: messages.Entry})
this.lock = mutexify()
this.changes = 0
+ this.setMaxListeners(0)
var self = this | no max listeners. closes #3 | mafintosh_hyperlog | train | js |
9190e24bcddc8cf25a071a8af49b7ca3b3374463 | diff --git a/lib/OpenLayers/Control/ModifyFeature.js b/lib/OpenLayers/Control/ModifyFeature.js
index <HASH>..<HASH> 100644
--- a/lib/OpenLayers/Control/ModifyFeature.js
+++ b/lib/OpenLayers/Control/ModifyFeature.js
@@ -576,8 +576,8 @@ OpenLayers.Control.ModifyFeature = OpenLayers.Class(OpenLayers.Control, {
}
}
collectComponentVertices.call(this, this.feature.geometry);
- this.layer.addFeatures(this.vertices, {silent: true});
this.layer.addFeatures(this.virtualVertices, {silent: true});
+ this.layer.addFeatures(this.vertices, {silent: true});
},
/** | Cannot modify a feature (linestring) that have two points at the same position, r=me, thanks pvalsecc for the patch and the detailed justification of this patch. (closes #<I>)
git-svn-id: <URL> | openlayers_openlayers | train | js |
804603155f775bbf1b03dbeadbb78f978af6c169 | diff --git a/hugolib/site.go b/hugolib/site.go
index <HASH>..<HASH> 100644
--- a/hugolib/site.go
+++ b/hugolib/site.go
@@ -1711,8 +1711,10 @@ func (s *Site) newHomeNode() *Node {
n.IsHome = true
s.setURLs(n, "/")
n.Data["Pages"] = s.Pages
- n.Date = s.Pages[0].Date
- n.Lastmod = s.Pages[0].Lastmod
+ if len(s.Pages) != 0 {
+ n.Date = s.Pages[0].Date
+ n.Lastmod = s.Pages[0].Lastmod
+ }
return n
} | Check for the presence of pages before setting dates
See #<I> | gohugoio_hugo | train | go |
58ebe269fe68620201c8b05107e9a6d6d5319746 | diff --git a/admin/cli/reset_password.php b/admin/cli/reset_password.php
index <HASH>..<HASH> 100644
--- a/admin/cli/reset_password.php
+++ b/admin/cli/reset_password.php
@@ -56,12 +56,13 @@ Options:
-h, --help Print out this help
Example: \$sudo -u wwwrun /usr/bin/php admin/cli/reset_password.php
-"; //TODO: localize
+"; //TODO: localize, mark as needed in install - to be translated later when everything is finished
echo $help;
die;
}
-$prompt = "Password reset - enter username (manual authentication only)"; // TODO: localize
+cli_heading('Password reset'); // TODO: localize
+$prompt = "enter username (manual authentication only)"; // TODO: localize
$username = cli_input($prompt);
if (!$user = $DB->get_record('user', array('auth'=>'manual', 'username'=>$username, 'mnethostid'=>$CFG->mnet_localhost_id))) {
@@ -80,6 +81,6 @@ $hashedpassword = hash_internal_user_password($password);
$DB->set_field('user', 'password', $hashedpassword, array('id'=>$user->id));
-echo "yay!\n";
+echo "Password cahnged\n";
exit(0); // 0 means success
\ No newline at end of file | MDL-<I> password reset cli script improvements | moodle_moodle | train | php |
d0115f61aec48cb128527b09922e3769c8ddc94b | diff --git a/internal/graphicsdriver/monogame/image.go b/internal/graphicsdriver/monogame/image.go
index <HASH>..<HASH> 100644
--- a/internal/graphicsdriver/monogame/image.go
+++ b/internal/graphicsdriver/monogame/image.go
@@ -18,6 +18,7 @@ package monogame
import (
"github.com/hajimehoshi/ebiten/internal/driver"
+ "github.com/hajimehoshi/ebiten/internal/graphics"
)
type RenderTarget2D interface {
@@ -48,7 +49,8 @@ func (*Image) Pixels() ([]byte, error) {
}
func (i *Image) SetAsDestination() {
- i.v.SetAsDestination(i.width, i.height)
+ w, h := graphics.InternalImageSize(i.width), graphics.InternalImageSize(i.height)
+ i.v.SetAsDestination(w, h)
}
func (i *Image) SetAsSource() { | graphicsdriver/monogame: Bug fix: Wrong viewport values | hajimehoshi_ebiten | train | go |
3391d78773508b4b2a29281659c4c10d96cbe3df | diff --git a/analytical/templatetags/chartbeat.py b/analytical/templatetags/chartbeat.py
index <HASH>..<HASH> 100644
--- a/analytical/templatetags/chartbeat.py
+++ b/analytical/templatetags/chartbeat.py
@@ -100,9 +100,14 @@ def contribute_to_analytical(add_node):
def _get_domain(context):
domain = context.get(DOMAIN_CONTEXT_KEY)
- if domain is None and getattr(settings, 'CHARTBEAT_AUTO_DOMAIN', True):
- try:
- domain = Site.objects.get_current().domain
- except (ImproperlyConfigured, Site.DoesNotExist): #pylint: disable=E1101
- pass
- return domain
+
+ if domain is not None:
+ return domain
+ else:
+ if 'django.contrib.sites' not in settings.INSTALLED_APPS:
+ return
+ elif getattr(settings, 'CHARTBEAT_AUTO_DOMAIN', True):
+ try:
+ return Site.objects.get_current().domain
+ except (ImproperlyConfigured, Site.DoesNotExist): #pylint: disable=E1101
+ return | Check for 'django.contrib.sites' when getting the domain for chartbeat | jazzband_django-analytical | train | py |
54a196b1145458946a26011c66ec1166f39adeec | diff --git a/applications/default/extensions/user/user.js b/applications/default/extensions/user/user.js
index <HASH>..<HASH> 100644
--- a/applications/default/extensions/user/user.js
+++ b/applications/default/extensions/user/user.js
@@ -27,9 +27,8 @@ user.init = function(application, callback) {
return callback(error);
}
if (!user) {
- // We put the same message in both cases, to avoid malicious users
- // to use this to guess usernames.
- return callback(null, false, {message: 'Invalid username or password.'});
+ // User and/or password is invalid.
+ return callback(null, false);
}
// Start from an empty container and merge in user data.
@@ -362,13 +361,13 @@ user.route = function(routes, callback) {
if (!request.body.username || !request.body.password) {
return callback(null, ['Please provide an username and a password.'], 400);
}
- passport.authenticate('local', function(error, user, info) {
+ passport.authenticate('local', function(error, user) {
if (error) {
return callback(error);
}
if (!user) {
- return callback(null, info, 400);
+ return callback(null, ['Invalid username or password.'], 401);
}
// Log user in. | Small improvements to user login. Returning a <I> status code instead of <I> when user supplied an invalid username or password. #<I> | recidive_choko | train | js |
e171f7c5ae37221e3d00c2bfb330ba5bab96d88a | diff --git a/blockstack_client/backend/utxo/insight_api.py b/blockstack_client/backend/utxo/insight_api.py
index <HASH>..<HASH> 100644
--- a/blockstack_client/backend/utxo/insight_api.py
+++ b/blockstack_client/backend/utxo/insight_api.py
@@ -38,8 +38,9 @@ class InsightClient(object):
try:
req = requests.get(url)
resp = req.json()
- except:
- raise Exception("Failed to query UTXOs")
+ except Exception as e:
+ log.error("Failed to query UTXos")
+ raise
# format...
try:
@@ -61,8 +62,9 @@ class InsightClient(object):
try:
req = requests.post(url, data=data, headers=headers)
- except:
- raise Exception("Failed to send transaction")
+ except Exception as e:
+ log.error("Failed to send transaction")
+ raise
try:
resp = req.json() | make the insight_api driver print something more useful on UTXO connection failure | blockstack_blockstack-core | train | py |
1d8ac105279df88ea7004e72a5b824c6d296069f | diff --git a/pymc3/tests/test_step.py b/pymc3/tests/test_step.py
index <HASH>..<HASH> 100644
--- a/pymc3/tests/test_step.py
+++ b/pymc3/tests/test_step.py
@@ -462,9 +462,11 @@ class TestNutsCheckTrace(object):
x = Normal('x', mu=0, sd=1)
trace = sample(draws=10, tune=1, chains=1)
- expected_stat_names = {'depth', 'diverging', 'energy', 'energy_error',
- 'model_logp', 'max_energy_error', 'mean_tree_accept', 'step_size',
- 'step_size_bar', 'tree_size', 'tune'}
+ expected_stat_names = {
+ 'depth', 'diverging', 'energy', 'energy_error', 'model_logp',
+ 'max_energy_error', 'mean_tree_accept', 'step_size',
+ 'step_size_bar', 'tree_size', 'tune'
+ }
assert(trace.stat_names == expected_stat_names)
for varname in trace.stat_names: | change logp to model_logp in tests as well | pymc-devs_pymc | train | py |
eb9a0f6dd616c1e1a4dee03f971a74a12bacb641 | diff --git a/telluric/georaster.py b/telluric/georaster.py
index <HASH>..<HASH> 100644
--- a/telluric/georaster.py
+++ b/telluric/georaster.py
@@ -1587,8 +1587,6 @@ release, please use: .colorize('gray').to_png()", GeoRaster2Warning)
'GDAL_DISABLE_READDIR_ON_OPEN': True,
'GDAL_TIFF_INTERNAL_MASK_TO_8BIT': False,
} # type: Dict
- if self._filename.split('.')[-1] == 'tif':
- rasterio_env['CPL_VSIL_CURL_ALLOWED_EXTENSIONS'] = '.tif'
with rasterio.Env(**rasterio_env):
with self._raster_opener(self._filename) as raster: # type: rasterio.io.DatasetReader | Partially revert "updated get_window rasterio settings"
This partially reverts commit f<I>a<I>e<I>ae<I>ae5bda<I>f<I>eb1bb<I>e<I>d,
bringing back support for get parameters in remote urls. | satellogic_telluric | train | py |
be15e30c40e4f67851602bc1f3d70d5022f70774 | diff --git a/django_cas_ng/__init__.py b/django_cas_ng/__init__.py
index <HASH>..<HASH> 100644
--- a/django_cas_ng/__init__.py
+++ b/django_cas_ng/__init__.py
@@ -15,7 +15,7 @@ _DEFAULTS = {
'CAS_RENEW': False,
'CAS_IGNORE_REFERER': False,
'CAS_LOGOUT_COMPLETELY': True,
- 'CAS_FORCE_CHANGE_USERNAME_CASE': False,
+ 'CAS_FORCE_CHANGE_USERNAME_CASE': None,
'CAS_REDIRECT_URL': '/',
'CAS_RETRY_LOGIN': False,
'CAS_SERVER_URL': None, | Default value of CAS_FORCE_CHANGE_USERNAME_CASE should be None, not False | mingchen_django-cas-ng | train | py |
e99ea38db06b65fa432073df9db09aff06132fb1 | diff --git a/addon/db-collection.js b/addon/db-collection.js
index <HASH>..<HASH> 100644
--- a/addon/db-collection.js
+++ b/addon/db-collection.js
@@ -1,6 +1,7 @@
import _assign from 'lodash/object/assign';
import _isArray from 'lodash/lang/isArray';
import _isEqual from 'lodash/lang/isEqual';
+import _sortBy from 'lodash/collection/sortBy';
function duplicate(data) {
if (_isArray(data)) {
@@ -39,18 +40,7 @@ class DbCollection {
return this._insertRecord(data);
} else {
// Need to sort in order to ensure IDs inserted in the correct order
- return data
- .sort(function(a, b) {
- if (a.id < b.id) {
- return -1;
- } else if (a.id === b.id) {
- return 0;
- }
- else {
- return 1;
- }
- })
- .map(this._insertRecord.bind(this));
+ return _sortBy(data, 'id').map(this._insertRecord.bind(this));
}
} | Ensure Sorting on Array Insert is Consistent
After switching all IDs to Strings, Phantom was being it's usual punk
ass self. It sorted `['abc-<I>', '<I>']` as shown, whilst Chrome sorted
it as `['<I>', 'abc-<I>']`. Using lodash's `sortBy` we work around these
problems and have a more succinct implementation. | samselikoff_ember-cli-mirage | train | js |
ac01705d33f36bfce83387b1a6ee0d05f7619ec9 | diff --git a/src/layouts/PageLayout.js b/src/layouts/PageLayout.js
index <HASH>..<HASH> 100644
--- a/src/layouts/PageLayout.js
+++ b/src/layouts/PageLayout.js
@@ -66,13 +66,33 @@ OO.ui.PageLayout.prototype.getOutlineItem = function () {
};
/**
- * Get outline item.
+ * Set outline item.
+ *
+ * @localdoc Subclasses should override #setupOutlineItem instead of this method to adjust the
+ * outline item as desired; this method is called for setting (with an object) and unsetting
+ * (with null) and overriding methods would have to check the value of `outlineItem` to avoid
+ * operating on null instead of an OO.ui.OutlineItemWidget object.
*
* @param {OO.ui.OutlineItemWidget|null} outlineItem Outline item widget, null to clear
* @chainable
*/
OO.ui.PageLayout.prototype.setOutlineItem = function ( outlineItem ) {
- this.outlineItem = outlineItem;
+ this.outlineItem = outlineItem || null;
+ if ( outlineItem ) {
+ this.setupOutlineItem();
+ }
+ return this;
+};
+
+/**
+ * Setup outline item.
+ *
+ * @localdoc Subclasses should override this method to adjust the outline item as desired.
+ *
+ * @param {OO.ui.OutlineItemWidget} outlineItem Outline item widget to setup
+ * @chainable
+ */
+OO.ui.PageLayout.prototype.setupOutlineItem = function () {
return this;
}; | [BREAKING CHANGE] Separate setup from setOutlineItem in OO.ui.PageLayout
Changes:
* Call a separate function to setup the outline item
Breaking changes:
* Subclasses should move item configuration logic to a new
setupOutlineItem method
Change-Id: I7c3c<I>d<I>cbfdf7f5ffe9b<I>de<I>b<I>a<I>a | wikimedia_oojs-ui | train | js |
1382be64f6ecd9bcbf97ea735cdced6b34721756 | diff --git a/api/src/main/java/org/wildfly/swarm/spi/api/DependenciesContainer.java b/api/src/main/java/org/wildfly/swarm/spi/api/DependenciesContainer.java
index <HASH>..<HASH> 100644
--- a/api/src/main/java/org/wildfly/swarm/spi/api/DependenciesContainer.java
+++ b/api/src/main/java/org/wildfly/swarm/spi/api/DependenciesContainer.java
@@ -23,6 +23,7 @@ import org.jboss.shrinkwrap.api.spec.JavaArchive;
/**
* @author Bob McWhirter
+ * @author Ken Finnigan
*/
public interface DependenciesContainer<T extends Archive<T>> extends LibraryContainer<T>, Archive<T> {
@@ -32,4 +33,22 @@ public interface DependenciesContainer<T extends Archive<T>> extends LibraryCont
addAsLibraries(artifacts);
return (T) this;
}
+
+ /**
+ * Add a single Maven dependency into the Archive.
+ * The following dependency formats are supported:
+ * groupId:artifactId
+ * groupId:artifactId:version
+ * groupId:artifactId:packaging:version
+ * groupId:artifactId:packaging:version:classifier
+ *
+ * @param gav String coordinates of the Maven dependency
+ * @return Archive instance
+ * @throws Exception
+ */
+ @SuppressWarnings("unchecked")
+ default T addDependency(String gav) throws Exception {
+ addAsLibrary(ArtifactLookup.get().artifact(gav));
+ return (T) this;
+ }
} | Subject: Adding a Single Dependency in main()
Motivation:
SWARM-<I>, previously we only had addAllDependencies() but it would be good to also support adding a single dependency into the deployment Archive when in a user's main()
Modifications:
Add addDependency() to DependenciesContainer to allow adding a single Maven dependency
Result:
Adds extra functionality to support a user adding a single Maven dependency to their deployment Archive from within their custom main() | thorntail_thorntail | train | java |
920f620673f74504beaff59488804ea50c750cd8 | diff --git a/example/main.go b/example/main.go
index <HASH>..<HASH> 100644
--- a/example/main.go
+++ b/example/main.go
@@ -12,17 +12,19 @@ import (
func main() {
config := pivnet.ClientConfig{
Host: pivnet.DefaultHost,
- Token: "token-from-pivnet",
UserAgent: "pivnet-cli-example",
+ SkipSSLValidation: true,
}
+ accessTokenService := pivnet.NewAccessTokenOrLegacyToken("token-from-pivnet", config.Host, config.SkipSSLValidation)
+
stdoutLogger := log.New(os.Stdout, "", log.LstdFlags)
stderrLogger := log.New(os.Stderr, "", log.LstdFlags)
verbose := false
logger := logshim.NewLogShim(stdoutLogger, stderrLogger, verbose)
- client := pivnet.NewClient(config, logger)
+ client := pivnet.NewClient(accessTokenService, config, logger)
products, err := client.Products.List() | Updated example.go file so it be up-to-date.
- this is for addressing to the issue <URL> | pivotal-cf_go-pivnet | train | go |
20e3783a1d21d1c3c6015366dac01591d522bac6 | diff --git a/lib/workers/branch/get-updated.js b/lib/workers/branch/get-updated.js
index <HASH>..<HASH> 100644
--- a/lib/workers/branch/get-updated.js
+++ b/lib/workers/branch/get-updated.js
@@ -32,7 +32,8 @@ async function getUpdatedPackageFiles(config) {
parentBranch: undefined,
});
}
- throw new Error('Error updating branch content and cannot rebase');
+ logger.debug({ existingContent, upgrade }, 'Error updating file');
+ throw new Error('update-failure');
}
if (newContent !== existingContent) {
if (config.parentBranch) {
diff --git a/lib/workers/branch/index.js b/lib/workers/branch/index.js
index <HASH>..<HASH> 100644
--- a/lib/workers/branch/index.js
+++ b/lib/workers/branch/index.js
@@ -277,7 +277,9 @@ async function processBranch(branchConfig, prHourlyLimitReached, packageFiles) {
logger.debug('Passing disk-space error up');
throw err;
}
- if (
+ if (err.message === 'update-failure') {
+ logger.warn('Error updating branch: update failure');
+ } else if (
err.message !== 'registry-failure' &&
err.message !== 'platform-failure'
) { | refactor: lower error to warn for branch update failure | renovatebot_renovate | train | js,js |
dd176d07289465be2849e15982ca7bdc60ce13fc | diff --git a/FukuML/__init__.py b/FukuML/__init__.py
index <HASH>..<HASH> 100644
--- a/FukuML/__init__.py
+++ b/FukuML/__init__.py
@@ -1,6 +1,6 @@
#encoding=utf8
-__version__ = '0.2.3'
+__version__ = '0.2.4'
__all__ = [
'MLBase',
'PLA', | <I>
- Decision Tree Classification Learning Algorithm
- Decision Tree Regression Learning Algorithm | fukuball_fuku-ml | train | py |
d560a7deff9319c43a45cfa5e014843835f0bf9b | diff --git a/lib/redistat/key.rb b/lib/redistat/key.rb
index <HASH>..<HASH> 100644
--- a/lib/redistat/key.rb
+++ b/lib/redistat/key.rb
@@ -61,7 +61,6 @@ module Redistat
def update_index
@label.groups.each do |label|
- # break if label.parent.nil?
parent = (label.parent || "")
db.sadd("#{scope}#{LABEL_INDEX}#{parent}", label.me)
end | killed an old line of commented out code | jimeh_redistat | train | rb |
9fae45cde101188c6541a951df78fb4e17c13822 | diff --git a/openstack_dashboard/dashboards/admin/aggregates/panel.py b/openstack_dashboard/dashboards/admin/aggregates/panel.py
index <HASH>..<HASH> 100644
--- a/openstack_dashboard/dashboards/admin/aggregates/panel.py
+++ b/openstack_dashboard/dashboards/admin/aggregates/panel.py
@@ -23,12 +23,12 @@ class Aggregates(horizon.Panel):
slug = 'aggregates'
permissions = ('openstack.services.compute',)
- def can_access(self, context):
+ def allowed(self, context):
# extend basic permission-based check with a check to see whether
# the Aggregates extension is even enabled in nova
if not nova.extension_supported('Aggregates', context['request']):
return False
- return super(Aggregates, self).can_access(context)
+ return super(Aggregates, self).allowed(context)
dashboard.Admin.register(Aggregates) | Fix Firewalls panel to override the right method
Instead of overriding can_acess(), the panel check should
be overriding allowed() method instead. Overriding can_access()
will disable caching for the method.
Change-Id: Ibee<I>cdcf<I>e<I>d9faeb<I>dbab<I>fc<I>c1b2c
Closes-Bug: #<I> | openstack_horizon | train | py |
70e69b1f76b8b56240786e625aa3e90bb104529b | diff --git a/client.go b/client.go
index <HASH>..<HASH> 100644
--- a/client.go
+++ b/client.go
@@ -16,6 +16,7 @@ package broker
import (
"errors"
+ "net"
"sync"
"time"
@@ -84,6 +85,12 @@ func (c *Client) ClientID() string {
return c.clientID
}
+// RemoteAddr returns the client's remote net address from the
+// underlying connection.
+func (c *Client) RemoteAddr() net.Addr {
+ return c.conn.RemoteAddr()
+}
+
// Publish will send a Message to the client and initiate QOS flows.
func (c *Client) Publish(msg *packet.Message) bool {
select { | Expose Client remote net address
This is useful in many common cases such as whitelisting, logging connections,
and blocking abusive clients. | 256dpi_gomqtt | train | go |
1cbe5609fc41010e19477865afdbb447aa6d4cb4 | diff --git a/fs/errors.py b/fs/errors.py
index <HASH>..<HASH> 100644
--- a/fs/errors.py
+++ b/fs/errors.py
@@ -43,6 +43,7 @@ __all__ = [
'ResourceInvalid',
'ResourceLocked',
'ResourceNotFound',
+ 'ResourceReadOnly',
'Unsupported',
] | Add `ResourceReadOnly` to `__all__` in `fs.errors` (#<I>) | PyFilesystem_pyfilesystem2 | train | py |
a37714498701a2fadd397cc2ff9dce4b6b28578e | diff --git a/library/src/main/java/com/wdullaer/materialdatetimepicker/Utils.java b/library/src/main/java/com/wdullaer/materialdatetimepicker/Utils.java
index <HASH>..<HASH> 100644
--- a/library/src/main/java/com/wdullaer/materialdatetimepicker/Utils.java
+++ b/library/src/main/java/com/wdullaer/materialdatetimepicker/Utils.java
@@ -143,11 +143,11 @@ public class Utils {
TypedValue typedValue = new TypedValue();
//First, try the android:colorAccent
if (Build.VERSION.SDK_INT >= 21) {
- context.getTheme().resolveAttribute(android.R.attr.colorAccent, typedValue, true);
+ context.getTheme().resolveAttribute(android.R.attr.colorPrimary, typedValue, true);
return typedValue.data;
}
//Next, try colorAccent from support lib
- int colorAccentResId = context.getResources().getIdentifier("colorAccent", "attr", context.getPackageName());
+ int colorAccentResId = context.getResources().getIdentifier("colorPrimary", "attr", context.getPackageName());
if (colorAccentResId == 0) {
return -1;
} | Use colorPrimary rather than colorAccent | wdullaer_MaterialDateTimePicker | train | java |
081d003023c797a5b6f8c5c9c66e5e16fe7b6b74 | diff --git a/gwpy/timeseries/core.py b/gwpy/timeseries/core.py
index <HASH>..<HASH> 100644
--- a/gwpy/timeseries/core.py
+++ b/gwpy/timeseries/core.py
@@ -81,6 +81,9 @@ class TimeSeries(NDData):
read
fetch
resample
+ highpass
+ lowpass
+ bandpass
"""
def __init__(self, data, epoch=None, channel=None, unit=None,
sample_rate=None, name=None, **kwargs): | docs: fixed bug in {high,low,band}pass docs | gwpy_gwpy | train | py |
b284f2a21685abde7645e7a6fc76d367a2b952ec | diff --git a/script/wee.screen.js b/script/wee.screen.js
index <HASH>..<HASH> 100644
--- a/script/wee.screen.js
+++ b/script/wee.screen.js
@@ -125,7 +125,7 @@
size = scope.size();
// If breakpoint has been hit or resize logic initialized
- if (size && (size !== current || init)) {
+ if (size && (size !== current || ! isNaN(init))) {
var evts = rules || events,
i = 0; | Ensure that screen logic doesn't fire on every resize event | weepower_wee-core | train | js |
f9afc95dff44ee04f2272a1d61ec6618c2b923b5 | diff --git a/bokeh/server/protocol/server_handler.py b/bokeh/server/protocol/server_handler.py
index <HASH>..<HASH> 100644
--- a/bokeh/server/protocol/server_handler.py
+++ b/bokeh/server/protocol/server_handler.py
@@ -8,7 +8,7 @@ log = logging.getLogger(__name__)
from tornado import gen
-from ..core.server_session import ServerSession
+from ..session import ServerSession
from ..exceptions import ProtocolError
class ServerHandler(object):
diff --git a/bokeh/server/views/ws.py b/bokeh/server/views/ws.py
index <HASH>..<HASH> 100644
--- a/bokeh/server/views/ws.py
+++ b/bokeh/server/views/ws.py
@@ -14,7 +14,6 @@ from tornado import gen
from tornado.websocket import WebSocketHandler, WebSocketClosedError
from ..exceptions import MessageError, ProtocolError, ValidationError
-from ..core.server_task import ServerTask
from ..protocol import Protocol
from ..protocol.message import Message
from ..protocol.receiver import Receiver | Fix a couple leftover references to server.core module | bokeh_bokeh | train | py,py |
79d16d881a128d92291ea148d0da8d8e853f8d19 | diff --git a/pyperformance/data-files/benchmarks/bm_fannkuch/run_benchmark.py b/pyperformance/data-files/benchmarks/bm_fannkuch/run_benchmark.py
index <HASH>..<HASH> 100644
--- a/pyperformance/data-files/benchmarks/bm_fannkuch/run_benchmark.py
+++ b/pyperformance/data-files/benchmarks/bm_fannkuch/run_benchmark.py
@@ -16,16 +16,12 @@ def fannkuch(n):
max_flips = 0
m = n - 1
r = n
- check = 0
perm1 = list(range(n))
perm = list(range(n))
perm1_ins = perm1.insert
perm1_pop = perm1.pop
while 1:
- if check < 30:
- check += 1
-
while r != 1:
count[r - 1] = r
r -= 1 | Remove unused var from fannkuch (#<I>)
This `check` var was initialized and incremented, but never used, and played no role in returning the correct result. Nor does dropping it have any meaningful impact on the benchmark result. | python_performance | train | py |
a1ca27161c185d732f510f06b335b1007578cc12 | diff --git a/l/cli.py b/l/cli.py
index <HASH>..<HASH> 100644
--- a/l/cli.py
+++ b/l/cli.py
@@ -32,7 +32,7 @@ def run(all, paths, recurse, output, stdout=stdout):
I_hate_everything = [
- click.command(),
+ click.command(context_settings=dict(help_option_names=["-h", "--help"])),
click.option(
"-1", "--one-per-line", "output",
flag_value=one_per_line, | Support -h. Sigh. | Julian_L | train | py |
a81d5c568e11953e4fec3a87a2fc6dd776260813 | diff --git a/python/phonenumbers/phonenumberutil.py b/python/phonenumbers/phonenumberutil.py
index <HASH>..<HASH> 100644
--- a/python/phonenumbers/phonenumberutil.py
+++ b/python/phonenumbers/phonenumberutil.py
@@ -993,7 +993,7 @@ def format_number(numobj, num_format):
def format_by_pattern(numobj, number_format, user_defined_formats):
- """Formats a phone number using client-defined formatting rules."
+ """Formats a phone number using client-defined formatting rules.
Note that if the phone number has a country calling code of zero or an
otherwise invalid country calling code, we cannot work out things like
@@ -1003,8 +1003,10 @@ def format_by_pattern(numobj, number_format, user_defined_formats):
Arguments:
numobj -- The phone number to be formatted
- num_format -- The format the phone number should be formatted into
- user_defined_formats -- formatting rules specified by clients
+ number_format -- The format the phone number should be formatted into,
+ as a PhoneNumberFormat value.
+ user_defined_formats -- formatting rules specified by clients, as a list
+ of NumberFormat objects.
Returns the formatted phone number.
""" | Document format_by_pattern() expected param types
The upstream Java code has types for these parameters, which makes
it clear what is needed for them. These types are obviously lost
in the translation to Python, so add some text to describe what
type of objects is expected.
Fixes #<I>. | daviddrysdale_python-phonenumbers | train | py |
0de76b61b451346470c55962319595f2a08eb7ed | diff --git a/holoviews/ipython/display_hooks.py b/holoviews/ipython/display_hooks.py
index <HASH>..<HASH> 100644
--- a/holoviews/ipython/display_hooks.py
+++ b/holoviews/ipython/display_hooks.py
@@ -13,6 +13,7 @@ from ..core import (ViewableElement, UniformNdMapping,
HoloMap, AdjointLayout, NdLayout, GridSpace, Layout,
CompositeOverlay, DynamicMap)
from ..core.traversal import unique_dimkeys
+from ..core.io import FileArchive
from .magics import OutputMagic, OptsMagic
# To assist with debugging of display hooks
@@ -112,7 +113,8 @@ def display_hook(fn):
# Only want to add to the archive for one display hook...
disabled_suffixes = ['png_display', 'svg_display']
if not any(fn.__name__.endswith(suffix) for suffix in disabled_suffixes):
- holoviews.archive.add(element, html=html)
+ if type(holoviews.archive) is not FileArchive:
+ holoviews.archive.add(element, html=html)
filename = OutputMagic.options['filename']
if filename:
Store.renderers[Store.current_backend].save(element, filename) | Skipping archive.add in display_hooks for FileArchives | pyviz_holoviews | train | py |
8c8aad0669ba84255aadc13db425bec4ad241ce3 | diff --git a/tests/conftest.py b/tests/conftest.py
index <HASH>..<HASH> 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -24,6 +24,7 @@ from install import (Application,
SetupPy)
OS_RELEASE_FILE = '/etc/os-release'
+REDHAT_RELEASE_FILE = '/etc/redhat-release'
install_path = os.path.abspath('install.py')
sys.path.insert(0, install_path)
@@ -52,7 +53,11 @@ _os_id = _get_os_id()
_is_dnf = True if os.system('dnf --version') == 0 else False
_is_debian = True if _os_id in ['debian', 'ubuntu'] else False
_is_fedora = _os_id == 'fedora'
-_is_centos = _os_id == 'centos'
+# CentOS6 does not have /etc/os-release file. only has /etc/redhat-release.
+# When the /etc/redhat-release exists, identify it as centos
+# to run fedora base specific tests in test_install_fedora.py.
+_is_centos = _os_id == 'centos' or \
+ (not _os_id and os.path.isfile(REDHAT_RELEASE_FILE))
def pytest_collection_modifyitems(items): | Add CentOS6 case to _is_centos.
CentOS6 does not have /etc/os-release file. only has /etc/redhat-release.
Identify the environment as centos to run fedora base specific tests
in test_install_fedora.py. | junaruga_rpm-py-installer | train | py |
9f289da3f9f2894eb1cd630540a7ca3c21360a46 | diff --git a/src/binwalk/modules/heuristics.py b/src/binwalk/modules/heuristics.py
index <HASH>..<HASH> 100644
--- a/src/binwalk/modules/heuristics.py
+++ b/src/binwalk/modules/heuristics.py
@@ -101,7 +101,7 @@ class HeuristicCompressionAnalyzer(Module):
long='trigger',
kwargs={'trigger_level' : 0},
type=float,
- description='Set the entropy trigger level (0.0 - 1.0)'),
+ description='Set the entropy trigger level (0.0 - 1.0, default: %.2f)' % ENTROPY_TRIGGER),
]
KWARGS = [
@@ -114,6 +114,12 @@ class HeuristicCompressionAnalyzer(Module):
self.HEADER[-1] = "HEURISTIC ENTROPY ANALYSIS"
+ # Trigger level sanity check
+ if self.trigger_level > 1.0:
+ self.trigger_level = 1.0
+ elif self.trigger_level < 0.0:
+ self.trigger_level = 0.0
+
if self.config.block:
self.block_size = self.config.block
else: | Added --trigger sanity checks | ReFirmLabs_binwalk | train | py |
08ef7a65ba13a1ebc5c5985510c2c4a705e8bb21 | diff --git a/lib/cinch/mask.rb b/lib/cinch/mask.rb
index <HASH>..<HASH> 100644
--- a/lib/cinch/mask.rb
+++ b/lib/cinch/mask.rb
@@ -11,7 +11,7 @@ module Cinch
def initialize(mask)
@mask = mask
@nick, @user, @host = mask.match(/(.+)!(.+)@(.+)/)[1..-1]
- @regexp = Regexp.new("^" + Regexp.escape(mask).gsub("\\*", ".*") + "$")
+ @regexp = Regexp.new("^" + Regexp.escape(mask).gsub("\\*", ".*").gsub("\\?", ".?") + "$")
end
# @return [Boolean] | add support for the ? glob character in irc masks | cinchrb_cinch | train | rb |
a2a04fb50d4982954106e51054d69b1394357ef9 | diff --git a/core/src/main/java/hudson/tools/JDKInstaller.java b/core/src/main/java/hudson/tools/JDKInstaller.java
index <HASH>..<HASH> 100644
--- a/core/src/main/java/hudson/tools/JDKInstaller.java
+++ b/core/src/main/java/hudson/tools/JDKInstaller.java
@@ -370,7 +370,6 @@ public class JDKInstaller extends ToolInstaller {
try {
// JavaScript check page. Just submit and move on
HtmlForm loginForm = html.getFormByName("myForm");
- loginForm.getInputByName("ssousername").setValueAttribute(u);
page = loginForm.submit(null);
continue;
} catch (ElementNotFoundException e) { | authentication error page doesn't have the user name field, and in any case there's no need to set it here, so skip it. | jenkinsci_jenkins | train | java |
e34adcfdd9e49f52491e6385eb202b87a495484f | diff --git a/spec/moderator/elasticsearch-spec.js b/spec/moderator/elasticsearch-spec.js
index <HASH>..<HASH> 100644
--- a/spec/moderator/elasticsearch-spec.js
+++ b/spec/moderator/elasticsearch-spec.js
@@ -3,7 +3,7 @@
var esModerator = require('../../lib/cluster/moderator/modules/elasticsearch');
var Promise = require('bluebird');
-fdescribe('elasticsearch moderator', function() {
+describe('elasticsearch moderator', function() {
var logger = {
error: function() {
@@ -138,7 +138,7 @@ fdescribe('elasticsearch moderator', function() {
})
});
- fit('checkConnectionStates can return connections that need to be paused and resumed', function(done) {
+ it('checkConnectionStates can return connections that need to be paused and resumed', function(done) {
var moderator = esModerator(context, logger);
nodesStats.nodes.default.thread_pool.get.queue = 200;
moderator.initialize() | removing the fit and fdescribe that disabled most of the tests | terascope_teraslice | train | js |
a531d0ba9dbd1f7baa11582b1968fc8eeb5fb71a | diff --git a/MAVProxy/modules/mavproxy_map/__init__.py b/MAVProxy/modules/mavproxy_map/__init__.py
index <HASH>..<HASH> 100644
--- a/MAVProxy/modules/mavproxy_map/__init__.py
+++ b/MAVProxy/modules/mavproxy_map/__init__.py
@@ -468,7 +468,7 @@ class MapModule(mp_module.MPModule):
id = 'ADSB-' + str(m.ICAO_address)
# use plane icon for now
self.create_vehicle_icon(id, 'green', vehicle_type='plane')
- self.mpstate.map.set_position(id, (m.lat*1e-7, m.lon*1e-7), rotation=m.heading)
+ self.mpstate.map.set_position(id, (m.lat*1e-7, m.lon*1e-7), rotation=m.heading*0.01)
# if the waypoints have changed, redisplay
last_wp_change = self.module('wp').wploader.last_change | fixed heading for ADSB_VEHICLE | ArduPilot_MAVProxy | train | py |
287620d508a6805410bec30f15eeaf48816f84c3 | diff --git a/sound.js b/sound.js
index <HASH>..<HASH> 100644
--- a/sound.js
+++ b/sound.js
@@ -72,6 +72,14 @@ sb.sound.muteAll = function(){
};
/**
+@Name: sb.sound.muted
+@Description: When set to 1, sounds will not play
+@Example:
+sb.sound.mute = 1;
+ */
+sb.sound.muted = 0;
+
+/**
@Name: sb.sound.prototype
@Description: The methods of sb.sound instances
*/
@@ -99,9 +107,11 @@ sb.sound.prototype = {
mySound.play();
*/
play : function(position, loops){
- position = position || 0;
- loops = loops || 0;
- return sb.flashGate.getInterface().sound_play(this.id, position, loops);
+ if(!sb.sound.muted){
+ position = position || 0;
+ loops = loops || 0;
+ return sb.flashGate.getInterface().sound_play(this.id, position, loops);
+ }
},
/** | added sb.sound.mute property back from original version | surebert_surebert-framework | train | js |
9798b5106aa73575eca7b1c222c8fd4e8f1eb42a | diff --git a/builtin/logical/postgresql/secret_creds.go b/builtin/logical/postgresql/secret_creds.go
index <HASH>..<HASH> 100644
--- a/builtin/logical/postgresql/secret_creds.go
+++ b/builtin/logical/postgresql/secret_creds.go
@@ -29,11 +29,25 @@ func secretCreds(b *backend) *framework.Secret {
DefaultDuration: 1 * time.Hour,
DefaultGracePeriod: 10 * time.Minute,
- Renew: framework.LeaseExtend(1*time.Hour, 0),
+ Renew: b.secretCredsRenew,
Revoke: b.secretCredsRevoke,
}
}
+func (b *backend) secretCredsRenew(
+ req *logical.Request, d *framework.FieldData) (*logical.Response, error) {
+ lease, err := b.Lease(req.Storage)
+ if err != nil {
+ return nil, err
+ }
+ if lease == nil {
+ lease = &configLease{Lease: 1 * time.Hour}
+ }
+
+ f := framework.LeaseExtend(lease.Lease, lease.LeaseMax)
+ return f(req, d)
+}
+
func (b *backend) secretCredsRevoke(
req *logical.Request, d *framework.FieldData) (*logical.Response, error) {
// Get the username from the internal data | logical/postgresql: renew for secret | hashicorp_vault | train | go |
0d7b1f6f8784e154f50a1c601b29411510617c1f | diff --git a/src/playbacks/hls/hls.js b/src/playbacks/hls/hls.js
index <HASH>..<HASH> 100644
--- a/src/playbacks/hls/hls.js
+++ b/src/playbacks/hls/hls.js
@@ -74,7 +74,7 @@ export default class HLS extends HTML5VideoPlayback {
timeUpdated() {
if (this.dvrEnabled) {
- this.trigger(Events.PLAYBACK_TIMEUPDATE, this.getCurrentTime(), this.getDuration(), this.name)
+ this.trigger(Events.PLAYBACK_TIMEUPDATE, this.dvrInUse ? this.getCurrentTime() : this.getDuration(), this.getDuration(), this.name)
} else {
super.timeUpdated()
} | hls: avoid seekbar jumping around on live mode | clappr_clappr | train | js |
9c43ea2f44f18a6297efe4ebc3fbaff50f6a26e4 | diff --git a/pyqode/core/widgets/filesystem_treeview.py b/pyqode/core/widgets/filesystem_treeview.py
index <HASH>..<HASH> 100644
--- a/pyqode/core/widgets/filesystem_treeview.py
+++ b/pyqode/core/widgets/filesystem_treeview.py
@@ -679,9 +679,15 @@ class FileSystemContextMenu(QtWidgets.QMenu):
@classmethod
def get_file_explorer_name(cls):
- pgm = cls.get_file_explorer_command().split(' ')[0]
- if os.path.isabs(pgm):
- pgm = os.path.split(pgm)[1]
+ system = platform.system()
+ if system == 'Darwin':
+ pgm = 'finder'
+ elif system == 'Windows':
+ pgm = 'explorer'
+ else:
+ pgm = cls.get_file_explorer_command().split(' ')[0]
+ if os.path.isabs(pgm):
+ pgm = os.path.split(pgm)[1]
return pgm.capitalize()
def _on_show_in_explorer_triggered(self): | Fix file explorer name on other OS X and windows
Open was shown instead of Finder | pyQode_pyqode.core | train | py |
8590286697507ee24e9e97fd6474e6d07f1cfbe3 | diff --git a/src/featherlight.js b/src/featherlight.js
index <HASH>..<HASH> 100644
--- a/src/featherlight.js
+++ b/src/featherlight.js
@@ -330,7 +330,10 @@
/* Resize content */
if (ratio > 1) {
ratio = h / Math.floor(h / ratio); /* Round ratio down so height calc works */
- this.$content.css('width', '' + w / ratio + 'px').css('height', '' + h / ratio + 'px');
+ var paddingW = this.$content.parent().outerWidth() - this.$content.parent().width();
+ var paddingH = this.$content.parent().outerHeight() - this.$content.parent().height();
+
+ this.$content.css('width', '' + w / ratio - paddingW + 'px').css('height', '' + h / ratio - paddingH + 'px');
}
}
}, | Takes padding and border into account for content size calculations | noelboss_featherlight | train | js |
fdac35522f22a910970fc07bd6922f4f53ba6642 | diff --git a/contrib/gofpdi/gofpdi.go b/contrib/gofpdi/gofpdi.go
index <HASH>..<HASH> 100644
--- a/contrib/gofpdi/gofpdi.go
+++ b/contrib/gofpdi/gofpdi.go
@@ -28,9 +28,10 @@ func ImportPage(f gofpdiPdf, sourceFile string, pageno int, box string) int {
return getTemplateID(f, pageno, box)
}
-// ImportPage imports a page of a PDF with the specified box (/MediaBox,
-// /TrimBox, /ArtBox, /CropBox, or /BleedBox). Returns a template id that can
-// be used with UseImportedTemplate to draw the template onto the page.
+// ImportPageFromStream imports a page of a PDF with the specified box
+// (/MediaBox, TrimBox, /ArtBox, /CropBox, or /BleedBox). Returns a template id
+// that can be used with UseImportedTemplate to draw the template onto the
+// page.
func ImportPageFromStream(f gofpdiPdf, rs *io.ReadSeeker, pageno int, box string) int {
// Set source stream for fpdi
fpdi.SetSourceStream(rs) | Corrected comment to match function name | jung-kurt_gofpdf | train | go |
3c30eb0a3cdfbe8b09776ec8f37c0554b9c407cf | diff --git a/scs_osio/device.py b/scs_osio/device.py
index <HASH>..<HASH> 100755
--- a/scs_osio/device.py
+++ b/scs_osio/device.py
@@ -5,14 +5,7 @@ Created on 18 Feb 2017
@author: Bruno Beloff ([email protected])
-workflow:
- 1: ./scs_osio/device_id.py
- 2: ./scs_osio/api_auth.py
-> 3: ./scs_osio/host_device.py
- 4: ./scs_osio/host_project.py
-
Requires APIAuth and DeviceID documents.
-Creates ClientAuth document.
command line examples:
./scs_osio/device.py -v -u south-coast-science-test-user -l 50.823130 -0.122922 "BN2 0DA" -d "test 1" | Added host serial number to DFETestDatum. | south-coast-science_scs_osio | train | py |
d2231b9a5615b6279e334e593c637d7700763e1f | diff --git a/parser-java/api/src/main/java/org/jboss/forge/addon/parser/java/ui/AbstractJavaSourceCommand.java b/parser-java/api/src/main/java/org/jboss/forge/addon/parser/java/ui/AbstractJavaSourceCommand.java
index <HASH>..<HASH> 100644
--- a/parser-java/api/src/main/java/org/jboss/forge/addon/parser/java/ui/AbstractJavaSourceCommand.java
+++ b/parser-java/api/src/main/java/org/jboss/forge/addon/parser/java/ui/AbstractJavaSourceCommand.java
@@ -170,7 +170,7 @@ public abstract class AbstractJavaSourceCommand<SOURCETYPE extends JavaSource<?>
try
{
JavaResource parsedJavaResource = javaSourceFacet.getJavaResource(source);
- classAlreadyExists = parsedJavaResource.exists();
+ classAlreadyExists = parsedJavaResource != null && parsedJavaResource.exists();
}
catch (FileNotFoundException | ResourceException ex)
{ | Avoiding NPE in other JavaSourceFacet implementations | forge_core | train | java |
a5804847d4ed4211f8589643f57bcb075371fc52 | diff --git a/lib/tessel-utils.js b/lib/tessel-utils.js
index <HASH>..<HASH> 100644
--- a/lib/tessel-utils.js
+++ b/lib/tessel-utils.js
@@ -24,9 +24,11 @@ module.exports = (function( ) {
var numArgs = args.length;
for (var i = 0; i < numArgs; i++) {
- var keyValue = args[i].split("=");
+ var keyValue = args[i];
+ var key = keyValue.substr(0,keyValue.indexOf('='));
+ var value = keyValue.substr(keyValue.indexOf('=')+1);
- argMap[keyValue[0]] = keyValue[1];
+ argMap[key] = value;
}
args = null;
} | BUG Fix. The getArgumentValue function must split on the first occurrence of "=". Instead, it split on all occurrences, causing query params to be lost. | georgenorman_tessel-kit | train | js |
22062ba9da07cec8f4b069f780f3c2a7a831f470 | diff --git a/agent/ui_endpoint_test.go b/agent/ui_endpoint_test.go
index <HASH>..<HASH> 100644
--- a/agent/ui_endpoint_test.go
+++ b/agent/ui_endpoint_test.go
@@ -1222,6 +1222,7 @@ func TestUIServiceTopology(t *testing.T) {
ChecksPassing: 3,
ChecksWarning: 1,
ChecksCritical: 2,
+ EnterpriseMeta: *structs.DefaultEnterpriseMeta(),
},
},
FilteredByACLs: false,
@@ -1253,15 +1254,17 @@ func TestUIServiceTopology(t *testing.T) {
InstanceCount: 1,
ChecksPassing: 2,
ChecksCritical: 1,
+ EnterpriseMeta: *structs.DefaultEnterpriseMeta(),
},
},
Downstreams: []*ServiceSummary{
{
- Name: "api",
- Datacenter: "dc1",
- Nodes: []string{"foo"},
- InstanceCount: 1,
- ChecksPassing: 3,
+ Name: "api",
+ Datacenter: "dc1",
+ Nodes: []string{"foo"},
+ InstanceCount: 1,
+ ChecksPassing: 3,
+ EnterpriseMeta: *structs.DefaultEnterpriseMeta(),
},
},
FilteredByACLs: false,
@@ -1298,6 +1301,7 @@ func TestUIServiceTopology(t *testing.T) {
ChecksPassing: 3,
ChecksWarning: 1,
ChecksCritical: 2,
+ EnterpriseMeta: *structs.DefaultEnterpriseMeta(),
},
},
FilteredByACLs: false, | Add default meta to test assertion (#<I>) | hashicorp_consul | train | go |
fbbac076db6f6b39e30e03027efc908fb73a3dff | diff --git a/src/serialize/PhysicalObject.js b/src/serialize/PhysicalObject.js
index <HASH>..<HASH> 100644
--- a/src/serialize/PhysicalObject.js
+++ b/src/serialize/PhysicalObject.js
@@ -109,6 +109,11 @@ class PhysicalObject extends GameObject {
this.bendingPositionDelta.subtract(original.position);
this.bendingPositionDelta.multiplyScalar(this.incrementScale);
+ // get the incremental angular-velocity
+ this.bendingAVDelta = (new ThreeVector()).copy(this.angularVelocity);
+ this.bendingAVDelta.subtract(original.angularVelocity);
+ this.bendingAVDelta.multiplyScalar(this.incrementScale);
+
// get the incremental quaternion rotation
let currentConjugate = (new Quaternion()).copy(original.quaternion).conjugate();
this.bendingQuaternionDelta = (new Quaternion()).copy(this.quaternion); | record bending of angular velocity | lance-gg_lance | train | js |
0ff697cc4dc56d4829f8817381920bf723badaf9 | diff --git a/lib/ruby_home/factories/default_values/string_value.rb b/lib/ruby_home/factories/default_values/string_value.rb
index <HASH>..<HASH> 100644
--- a/lib/ruby_home/factories/default_values/string_value.rb
+++ b/lib/ruby_home/factories/default_values/string_value.rb
@@ -17,6 +17,7 @@ module RubyHome
end
private
+
def name
template.name
end
diff --git a/spec/lib/factories/default_values/string_value_spec.rb b/spec/lib/factories/default_values/string_value_spec.rb
index <HASH>..<HASH> 100644
--- a/spec/lib/factories/default_values/string_value_spec.rb
+++ b/spec/lib/factories/default_values/string_value_spec.rb
@@ -14,7 +14,7 @@ RSpec.describe RubyHome::StringDefaultValue do
expect(handler.default).to eql('1.0')
end
- it 'returns 1.0 for Hardware Revision' do
+ it 'returns 1.0 for Version' do
template = double(name: :version)
handler = RubyHome::StringDefaultValue.new(template)
expect(handler.default).to eql('1.0') | Refactor
Fixing a specification typo | karlentwistle_ruby_home | train | rb,rb |
8efb6a3f067e1a37b265807576ecdc01fff5fc00 | diff --git a/src/main/resources/core/scripts/selenium-remoterunner.js b/src/main/resources/core/scripts/selenium-remoterunner.js
index <HASH>..<HASH> 100644
--- a/src/main/resources/core/scripts/selenium-remoterunner.js
+++ b/src/main/resources/core/scripts/selenium-remoterunner.js
@@ -626,6 +626,17 @@ Selenium.prototype.doShutDownSeleniumServer = function(keycode) {
// This doesn't really do anything on the JS side; we let the Selenium Server take care of this for us!
};
+Selenium.prototype.doRetrieveLastRemoteControlLogs = function() {
+ /**
+ * Retrieve the last messages logged on a specific remote control. Useful for error reports, especially
+ * when running multiple remote controls in a distributed environment. The maximum number of log messages
+ * that can be retrieve is configured on remote control startup.
+ *
+ * @return string The last N log messages as a multi-line string.
+ */
+ // This doesn't really do anything on the JS side; we let the Selenium Server take care of this for us!
+};
+
Selenium.prototype.doKeyDownNative = function(keycode) {
/**
* Simulates a user pressing a key (without releasing it yet) by sending a native operating system keystroke. | Added the "retrieveLastRemoteControlLogs" command (RC only)
r<I> | SeleniumHQ_selenium | train | js |
c7d1637dade2c902d49db25efd3793784354fd65 | diff --git a/lib/serverkit/resources/base.rb b/lib/serverkit/resources/base.rb
index <HASH>..<HASH> 100644
--- a/lib/serverkit/resources/base.rb
+++ b/lib/serverkit/resources/base.rb
@@ -233,7 +233,7 @@ module Serverkit
command = "cd && #{command}"
end
unless user.nil?
- command = "sudo -u #{user} -- /bin/sh -c #{Shellwords.escape(command)}"
+ command = "sudo -H -u #{user} -- /bin/sh -c #{Shellwords.escape(command)}"
end
backend.run_command(command)
end | call `sudo -H` to set HOME
`cd` moves to HOME of the sudo-ing user but HOME environment variable is
still sudo-ed user's. This may fail if sudo-ing user can't read the
directory. | serverkit_serverkit | train | rb |
ecbb366a2f212d16ac8da52a015bd5d634250144 | diff --git a/Gruntfile.js b/Gruntfile.js
index <HASH>..<HASH> 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -101,8 +101,8 @@ module.exports = function(grunt) {
require('load-grunt-tasks')(grunt)
- var buildTasks = [ 'clean', 'rollup' ]
- var testTasks = [ 'mochaTest' ]
+ var buildTasks = [ 'compile' ]
+ var testTasks = [ 'compile', 'mochaTest' ]
if (semver.satisfies(process.version, '>=4')) {
buildTasks.unshift('eslint')
@@ -113,5 +113,6 @@ module.exports = function(grunt) {
grunt.registerTask('default', [ 'build' ])
grunt.registerTask('build', buildTasks)
+ grunt.registerTask('compile', [ 'clean', 'rollup' ])
grunt.registerTask('test', testTasks)
} | Grunt 'test' task now compiles as well to simplify contributions | NotNinja_nevis | train | js |
d24bf389227bab39364587762a9eb344eb27d3bb | diff --git a/scoped_nodes.py b/scoped_nodes.py
index <HASH>..<HASH> 100644
--- a/scoped_nodes.py
+++ b/scoped_nodes.py
@@ -656,6 +656,8 @@ class ClassNG(StmtMixIn, LocalsDictNodeNG):
# XXX mro is read-only but that's not our job to detect that
return [cf(tuple(self.ancestors(recurs=True, context=context)))] + values
return std_special_attributes(self, name)
+ # don't modify the list in self.locals!
+ values = list(values)
for classnode in self.ancestors(recurs=False, context=context):
try:
values += classnode.getattr(name, context) | don't modify the list in class .locals dict | PyCQA_astroid | train | py |
43264909b4866f7a8c82f09b5038e4e07d5f705f | diff --git a/src/components/icon/js/iconService.js b/src/components/icon/js/iconService.js
index <HASH>..<HASH> 100644
--- a/src/components/icon/js/iconService.js
+++ b/src/components/icon/js/iconService.js
@@ -498,7 +498,7 @@
* Define the Icon class
*/
function Icon(el, config) {
- if (el.tagName != 'svg') {
+ if (el && el.tagName != 'svg') {
el = angular.element('<svg xmlns="http://www.w3.org/2000/svg">').append(el)[0];
} | fix(icon): adds check for `el` before checking its `tagName` | angular_material | train | js |
812661cb4b39a81fd52a5a7aaece2a1ef475195a | diff --git a/core/src/test/java/io/atomix/election/impl/LeaderElectorTest.java b/core/src/test/java/io/atomix/election/impl/LeaderElectorTest.java
index <HASH>..<HASH> 100644
--- a/core/src/test/java/io/atomix/election/impl/LeaderElectorTest.java
+++ b/core/src/test/java/io/atomix/election/impl/LeaderElectorTest.java
@@ -21,6 +21,7 @@ import io.atomix.election.AsyncLeaderElector;
import io.atomix.election.Leadership;
import io.atomix.election.LeadershipEvent;
import io.atomix.election.LeadershipEventListener;
+import org.junit.Ignore;
import org.junit.Test;
import java.util.LinkedList;
@@ -234,6 +235,7 @@ public class LeaderElectorTest extends AbstractAtomixTest {
}
@Test
+ @Ignore // Leader balancing is currently not deterministic in this test
public void testLeaderBalance() throws Throwable {
AsyncLeaderElector<NodeId> elector1 = atomix().<NodeId>leaderElectorBuilder("test-elector-leader-balance").build().async();
elector1.run("foo", node1).join(); | Disable leader balancing test. | atomix_atomix | train | java |
03aa6d9d07fbd52f4e0e21559b3c1823bf8deb89 | diff --git a/pyecore/resources/json.py b/pyecore/resources/json.py
index <HASH>..<HASH> 100644
--- a/pyecore/resources/json.py
+++ b/pyecore/resources/json.py
@@ -1,3 +1,4 @@
+# -*- coding: future_fstrings -*-
"""
The json module introduces JSON resource and JSON parsing.
"""
diff --git a/pyecore/resources/resource.py b/pyecore/resources/resource.py
index <HASH>..<HASH> 100755
--- a/pyecore/resources/resource.py
+++ b/pyecore/resources/resource.py
@@ -1,3 +1,4 @@
+# -*- coding: future_fstrings -*-
""" The resource module proposes all the concepts that are related to Resource
handling. A Resource represents a special model container that can be
serialized. Many ``Resource`` can be contained in a ``ResourceSet``, and
diff --git a/pyecore/resources/xmi.py b/pyecore/resources/xmi.py
index <HASH>..<HASH> 100644
--- a/pyecore/resources/xmi.py
+++ b/pyecore/resources/xmi.py
@@ -1,3 +1,4 @@
+# -*- coding: future_fstrings -*-
"""
The xmi module introduces XMI resource and XMI parsing.
""" | Add missing f-string encoding | pyecore_pyecore | train | py,py,py |
230b712001cce72f3db25b9ac35e170275e96f44 | diff --git a/wunderline-list.js b/wunderline-list.js
index <HASH>..<HASH> 100644
--- a/wunderline-list.js
+++ b/wunderline-list.js
@@ -19,12 +19,13 @@ getLists(function (err, data) {
if (err) process.exit(1)
var list = null
- var query = terms.join(' ')
+ var query = terms.join(' ')
- data.every(function(item) {
+ data.every(function (item) {
var found = item.title.toLowerCase().search(query) >= 0
- if (found)
+ if (found) {
list = item
+ }
return !found
}) | fix JS style issues #<I> | wayneashleyberry_wunderline | train | js |
3cf045fd1b955aae66ebc4d0dd0b79b1d96deabc | diff --git a/pkg/storage/drivers/memory/memory.go b/pkg/storage/drivers/memory/memory.go
index <HASH>..<HASH> 100644
--- a/pkg/storage/drivers/memory/memory.go
+++ b/pkg/storage/drivers/memory/memory.go
@@ -498,6 +498,7 @@ func (memory *memoryDriver) doEvictObject(key lru.Key, value interface{}) {
if len(storedBucket.objectMetadata) == 0 {
delete(memory.storedBuckets, bucket)
}
+ delete(memory.lastAccessedObjects, k)
}
}
@@ -528,5 +529,7 @@ func (memory *memoryDriver) expireLRUObjects() {
func (memory *memoryDriver) updateAccessTime(key string) {
memory.lock.Lock()
defer memory.lock.Unlock()
- memory.lastAccessedObjects[key] = time.Now().UTC()
+ if _, ok := memory.lastAccessedObjects[key]; ok {
+ memory.lastAccessedObjects[key] = time.Now().UTC()
+ }
} | Deleting key from lastAccessedObjects on eviction | minio_minio | train | go |
2cd61da4ec320a07918acfa6bd2242ffca041a73 | diff --git a/src/lib/Html.php b/src/lib/Html.php
index <HASH>..<HASH> 100755
--- a/src/lib/Html.php
+++ b/src/lib/Html.php
@@ -126,7 +126,7 @@ class Html extends BaseHtml
$options['maxlength'] = $validator->max;
if ($showCharacterCounter === true) {
- $options['length'] = $validator->max;
+ $options['data-length'] = $validator->max;
}
break;
} | character_counter feeds from data-length | MacGyer_yii2-materializecss | train | php |
c1e32a723f7a62a39a7bd14c3f82280682bfa286 | diff --git a/autofit/mapper/prior_model/abstract.py b/autofit/mapper/prior_model/abstract.py
index <HASH>..<HASH> 100644
--- a/autofit/mapper/prior_model/abstract.py
+++ b/autofit/mapper/prior_model/abstract.py
@@ -499,6 +499,7 @@ class AbstractPriorModel(AbstractModel):
for name, p in prior_tuples:
if p == prior:
return name
+ return ""
def __hash__(self):
return self.id
diff --git a/autofit/optimize/non_linear/output.py b/autofit/optimize/non_linear/output.py
index <HASH>..<HASH> 100644
--- a/autofit/optimize/non_linear/output.py
+++ b/autofit/optimize/non_linear/output.py
@@ -226,8 +226,10 @@ class AbstractOutput(object):
for prior_name, prior in self.model.prior_tuples_ordered_by_id:
try:
param_string = conf.instance.label.label(prior_name)
- except NoOptionError as e:
- logger.exception(e)
+ except NoOptionError:
+ logger.warning(
+ f"No label provided for {prior_name}. Using prior name instead."
+ )
param_string = prior_name
prior_model = prior_prior_model_dict[prior]
cls = prior_class_dict[prior] | silencing failures because of use of collections | rhayes777_PyAutoFit | train | py,py |
522ccc492f174672cd0e08dd094597236f4936d2 | diff --git a/GPy/likelihoods/likelihood.py b/GPy/likelihoods/likelihood.py
index <HASH>..<HASH> 100644
--- a/GPy/likelihoods/likelihood.py
+++ b/GPy/likelihoods/likelihood.py
@@ -218,7 +218,7 @@ class Likelihood(Parameterized):
#fi_samples = np.random.randn(num_samples)*np.sqrt(var_star) + mu_star
fi_samples = np.random.normal(mu_star, np.sqrt(var_star), size=(mu_star.shape[0], num_samples))
- from scipy.misc import logsumexp
+ from scipy.special import logsumexp
log_p_ystar = -np.log(num_samples) + logsumexp(self.logpdf(fi_samples, y_test, Y_metadata=Y_metadata), axis=1)
log_p_ystar = np.array(log_p_ystar).reshape(*y_test.shape)
return log_p_ystar | fix ImportError in likelihood.py
in function log_predictive_density_sampling | SheffieldML_GPy | train | py |
1bc64e80e9ad64d9369bec07a21a8a9fbfeabb35 | diff --git a/lib/que/rake_tasks.rb b/lib/que/rake_tasks.rb
index <HASH>..<HASH> 100644
--- a/lib/que/rake_tasks.rb
+++ b/lib/que/rake_tasks.rb
@@ -34,7 +34,9 @@ namespace :que do
worker_pid = fork do
Que.after_fork
stop = false
- trap('INT') {stop = true}
+ %w( INT TERM ).each do |signal|
+ trap(signal) {stop = true}
+ end
loop do
break if stop
@@ -70,7 +72,9 @@ namespace :que do
# the rake task in tasks/safe_shutdown.rb.
stop = false
- trap('INT'){stop = true}
+ %w( INT TERM ).each do |signal|
+ trap(signal) {stop = true}
+ end
at_exit do
$stdout.puts "Finishing Que's current jobs before exiting..." | gracefully stop on TERM signal as well. | chanks_que | train | rb |
19d1462142977053d775c8bce5448756a37d6f70 | diff --git a/s4/__init__.py b/s4/__init__.py
index <HASH>..<HASH> 100644
--- a/s4/__init__.py
+++ b/s4/__init__.py
@@ -1 +1 @@
-VERSION = '0.1.28'
+VERSION = '0.1.29' | Bump to version <I> | MichaelAquilina_S4 | train | py |
f6e246ad3eb56b9f93326430aeb98675a6714aa4 | diff --git a/mtp_common/auth/models.py b/mtp_common/auth/models.py
index <HASH>..<HASH> 100644
--- a/mtp_common/auth/models.py
+++ b/mtp_common/auth/models.py
@@ -53,6 +53,16 @@ class MojUser:
self._full_name = ' '.join(filter(None, name_parts))
return self._full_name
+ def get_initials(self):
+ if self.get_full_name():
+ return ''.join(
+ filter(
+ None,
+ map(lambda name: name[0].upper() if name else None,
+ self.get_full_name().split(' '))
+ )
+ )
+
class MojAnonymousUser:
""" | Add method to user class to get their intials, where available | ministryofjustice_money-to-prisoners-common | train | py |
a842e2ec210deca083966f84cb9200ac8228305c | diff --git a/js/clip-path-polygon.js b/js/clip-path-polygon.js
index <HASH>..<HASH> 100644
--- a/js/clip-path-polygon.js
+++ b/js/clip-path-polygon.js
@@ -8,7 +8,7 @@
*/
var globalVariable = window || root;
-var jQuery = jQuery || globalVariable.jQuery || (require && require('jquery'));
+var jQuery = jQuery || globalVariable.jQuery;
(function($) {
var id = 0; | Remove jquery require statement
+ Test for fixing #<I> | andrusieczko_clip-path-polygon | train | js |
1729b6bb990a97439db42df6d726f81b89ef720a | diff --git a/test/javascript_helper_spec.rb b/test/javascript_helper_spec.rb
index <HASH>..<HASH> 100644
--- a/test/javascript_helper_spec.rb
+++ b/test/javascript_helper_spec.rb
@@ -21,6 +21,7 @@ describe Stripe::JavascriptHelper do
describe 'when the debug flag is enabled' do
before { Rails.application.config.stripe.debug_js = true }
+ after { Rails.application.config.stripe.debug_js = false }
it 'should render the debug js' do
view.stripe_javascript_tag(:v1).must_include 'https://js.stripe.com/v1/stripe-debug.js'
end | remember to unset debug js setting | tansengming_stripe-rails | train | rb |
7dd6165f7f84d25ed2c8fa276c7f649ef134a355 | diff --git a/src/com/google/javascript/jscomp/newtypes/JSType.java b/src/com/google/javascript/jscomp/newtypes/JSType.java
index <HASH>..<HASH> 100644
--- a/src/com/google/javascript/jscomp/newtypes/JSType.java
+++ b/src/com/google/javascript/jscomp/newtypes/JSType.java
@@ -1517,7 +1517,12 @@ public abstract class JSType implements TypeI, FunctionTypeI, ObjectTypeI {
switch (tag) {
case TRUE_MASK:
case FALSE_MASK:
- builder.append("boolean");
+ builder.append(
+ (tags & BOOLEAN_MASK) == BOOLEAN_MASK
+ ? "boolean"
+ : tag == TRUE_MASK
+ ? "true"
+ : "false");
tags &= ~BOOLEAN_MASK;
continue;
case NULL_MASK: | [NTI] Clarify printed boolean types as "true" or "false" where appropriate.
-------------
Created by MOE: <URL> | google_closure-compiler | train | java |
0c1debe5748b024c3cd795d956b5dbea8295ca27 | diff --git a/clb/client_test.go b/clb/client_test.go
index <HASH>..<HASH> 100644
--- a/clb/client_test.go
+++ b/clb/client_test.go
@@ -10,7 +10,7 @@ import (
var _ = fmt.Print // For debugging; delete when done.
var _ = log.Print // For debugging; delete when done.
-func ExampleRoundRobin() {
+func Example_RoundRobin() {
srvName := "foo.service.fliglio.com"
c := NewRoundRobinClb("8.8.8.8", "53")
address, err := c.GetAddress(srvName)
@@ -30,7 +30,7 @@ func ExampleRoundRobin() {
// Output: 0.1.2.3:8001
}
-func ExampleRoundRobinFacade() {
+func Example_RoundRobinFacade() {
srvName := "foo.service.fliglio.com"
c := NewClb("8.8.8.8", "53", RoundRobin)
address, err := c.GetAddress(srvName) | style(tests): rearranging tests | benschw_srv-lb | train | go |
b4e5d5aea751b2223eced9e0bf3e43367b3a1fff | diff --git a/src/main/java/org/codehaus/mojo/buildhelper/BeanshellPropertyMojo.java b/src/main/java/org/codehaus/mojo/buildhelper/BeanshellPropertyMojo.java
index <HASH>..<HASH> 100644
--- a/src/main/java/org/codehaus/mojo/buildhelper/BeanshellPropertyMojo.java
+++ b/src/main/java/org/codehaus/mojo/buildhelper/BeanshellPropertyMojo.java
@@ -42,6 +42,7 @@ import bsh.Interpreter;
* <li><code>project</code>: the actual Maven project,</li>
* <li><code>session</code>: the executing <code>MavenSession</code>,</li>
* <li><code>settings</code>: the executing <code>Settings</code>.</li>
+ * <li><code>log</code>: the logger of the Mojo (see {@link org.apache.maven.plugin.AbstractMojo#getLog()}).</li>
* </ul>
*
* @author Hervé Boutemy
@@ -84,6 +85,7 @@ public class BeanshellPropertyMojo
set( interpreter, "project", getProject() );
set( interpreter, "session", mavenSession );
set( interpreter, "settings", settings );
+ set( interpreter, "log", getLog() );
try
{ | Provide the Mojos logger as variable in the Interpreter context (#<I>) | mojohaus_build-helper-maven-plugin | train | java |
a612e4aba043e07ec6619fe37ed3b8fc5936541b | diff --git a/http-server/src/main/java/io/micronaut/http/server/HttpServerConfiguration.java b/http-server/src/main/java/io/micronaut/http/server/HttpServerConfiguration.java
index <HASH>..<HASH> 100644
--- a/http-server/src/main/java/io/micronaut/http/server/HttpServerConfiguration.java
+++ b/http-server/src/main/java/io/micronaut/http/server/HttpServerConfiguration.java
@@ -184,7 +184,7 @@ public class HttpServerConfiguration implements ServerContextPathProvider {
}
/**
- * Sets the {@link ThreadSelection} model to use for the server.
+ * Sets the {@link io.micronaut.scheduling.executor.ThreadSelection} model to use for the server. Default value MANUAL.
* @param threadSelection The thread selection model
*/
public void setThreadSelection(ThreadSelection threadSelection) { | doc: default value for thread selection (#<I>) | micronaut-projects_micronaut-core | train | java |
984faa1897b74c977d60344332d62380b5c1c5bf | diff --git a/lib/specinfra/command/base/file.rb b/lib/specinfra/command/base/file.rb
index <HASH>..<HASH> 100644
--- a/lib/specinfra/command/base/file.rb
+++ b/lib/specinfra/command/base/file.rb
@@ -171,5 +171,9 @@ class Specinfra::Command::Base::File < Specinfra::Command::Base
def remove(file)
"rm -rf #{escape(file)}"
end
+
+ def download(src, dest)
+ "curl -sSL #{escape(src)} -o #{escape(dest)}"
+ end
end
end
diff --git a/spec/command/base/file_spec.rb b/spec/command/base/file_spec.rb
index <HASH>..<HASH> 100644
--- a/spec/command/base/file_spec.rb
+++ b/spec/command/base/file_spec.rb
@@ -85,3 +85,7 @@ end
describe get_command(:get_file_size, '/tmp') do
it { should eq 'stat -c %s /tmp' }
end
+
+describe get_command(:download_file, 'http://example.com/sample_file', '/tmp/sample_file') do
+ it { should eq 'curl -sSL http://example.com/sample_file -o /tmp/sample_file' }
+end | Add download-file command
This is a little opinionated feature.
I'd like to use `download_file` method to update remote_file resource of Itamae like following:
```
remote_file '/path/to/file' do
source '<URL> | mizzy_specinfra | train | rb,rb |
1aa24e4ca5789de2a8c3156acdae95c60f5468ae | diff --git a/src/PopupWindow.js b/src/PopupWindow.js
index <HASH>..<HASH> 100644
--- a/src/PopupWindow.js
+++ b/src/PopupWindow.js
@@ -92,7 +92,7 @@ export default class PopupWindow {
) {
Log.info("processing message");
- let url = e.data;
+ let url = e.data || e.source.location.href; // for IE9
this._cleanup(); | fallback to location.url for IE9 | IdentityModel_oidc-client-js | train | js |
2aa64fcc964b446e0d1234aef194119648248d3f | diff --git a/modules_v3/individual_report/module.php b/modules_v3/individual_report/module.php
index <HASH>..<HASH> 100644
--- a/modules_v3/individual_report/module.php
+++ b/modules_v3/individual_report/module.php
@@ -61,7 +61,7 @@ class individual_report_WT_Module extends WT_Module implements WT_Module_Report
$menus=array();
$menu=new WT_Menu(
$this->getTitle(),
- 'reportengine.php?ged='.WT_GEDURL.'&action=setup&report='.WT_MODULES_DIR.$this->getName().'/report.xml',
+ 'reportengine.php?ged='.WT_GEDURL.'&action=setup&report='.WT_MODULES_DIR.$this->getName().'/report.xml'.$pid,
'menu-report-'.$this->getName()
);
$menu->addIcon('place'); | #<I> - Family report from INDI page loads wrong XREF | fisharebest_webtrees | train | php |
39f615084a496fd191767731c8564f1ddea30347 | diff --git a/test/helpers/cons.go b/test/helpers/cons.go
index <HASH>..<HASH> 100644
--- a/test/helpers/cons.go
+++ b/test/helpers/cons.go
@@ -176,9 +176,9 @@ const (
// CiliumStableHelmChartVersion should be the chart version that points
// to the v1.X branch
- CiliumStableHelmChartVersion = "1.10"
+ CiliumStableHelmChartVersion = "1.11"
CiliumStableVersion = "v" + CiliumStableHelmChartVersion
- CiliumLatestHelmChartVersion = "1.10.90"
+ CiliumLatestHelmChartVersion = "1.11.90"
MonitorLogFileName = "monitor.log" | test/K8sUpdates: Bump stable branch for <I> development | cilium_cilium | train | go |
b13d437bb95a769616285b288d20533895b60c57 | diff --git a/discord/audit_logs.py b/discord/audit_logs.py
index <HASH>..<HASH> 100644
--- a/discord/audit_logs.py
+++ b/discord/audit_logs.py
@@ -326,7 +326,10 @@ class AuditLogEntry:
}
obj = Invite(state=self._state, data=fake_payload)
- obj.inviter = changeset.inviter
+ try:
+ obj.inviter = changeset.inviter
+ except AttributeError:
+ pass
return obj
def _convert_target_emoji(self, target_id): | Don't assume the inviter is always there. | Rapptz_discord.py | train | py |
e552172180bea043beeacd01fd944ef421ac6f58 | diff --git a/src/styles/lines/lines.js b/src/styles/lines/lines.js
index <HASH>..<HASH> 100644
--- a/src/styles/lines/lines.js
+++ b/src/styles/lines/lines.js
@@ -314,7 +314,7 @@ Object.assign(Lines, {
scaling_index: this.vertex_layout.index.a_extrude,
scaling_normalize: 256, // values have an 8-bit fraction
texcoord_index: this.vertex_layout.index.a_texcoord,
- texcoord_width: style.width || style.next_width, // UVs can't calc for zero-width, use next zoom width in that case
+ texcoord_width: (style.width || style.next_width) / context.tile.overzoom2, // UVs can't calc for zero-width, use next zoom width in that case
texcoord_normalize: 65535, // scale UVs to unsigned shorts
closed_polygon: options && options.closed_polygon,
remove_tile_edges: !style.tile_edges && options && options.remove_tile_edges, | lines: dash/texture pattern should adapt to overzooming | tangrams_tangram | train | js |
5e0cdbcacdf7ac701d509eebabc06678a935b510 | diff --git a/src/PathPrefixer.php b/src/PathPrefixer.php
index <HASH>..<HASH> 100644
--- a/src/PathPrefixer.php
+++ b/src/PathPrefixer.php
@@ -22,10 +22,14 @@ final class PathPrefixer
public function __construct(string $prefix, string $separator = '/')
{
- $this->prefix = rtrim($prefix, '\\/');
+ if ($prefix === '/' || $prefix === '\\') {
+ $this->prefix = $prefix;
+ } else {
+ $this->prefix = rtrim($prefix, '\\/');
- if ($prefix !== '') {
- $this->prefix .= $separator;
+ if ($this->prefix !== '') {
+ $this->prefix .= $separator;
+ }
}
$this->separator = $separator; | Fix #<I> - fix_usage '/' as a root | thephpleague_flysystem | train | php |
a83ca36764bf128493c57642752426b8ef32d688 | diff --git a/faker/tests/__init__.py b/faker/tests/__init__.py
index <HASH>..<HASH> 100644
--- a/faker/tests/__init__.py
+++ b/faker/tests/__init__.py
@@ -99,17 +99,15 @@ class UtilsTestCase(unittest.TestCase):
result = find_available_locales(DEFAULT_PROVIDERS)
self.assertNotEqual(len(result), 0)
+ @unittest.skipUnless(__import__("pkgutil") is not None)
def test_find_available_locales_without_pkgutil_iter_modules(self):
+ import pkgutil
+ iter_modules = pkgutil.iter_modules
+ delattr(pkgutil, "iter_modules")
try:
- import pkgutil
- iter_modules = pkgutil.iter_modules
- delattr(pkgutil, "iter_modules")
- try:
- self.test_find_available_locales()
- finally:
- setattr(pkgutil, "iter_modules", iter_modules)
- except (ImportError, AttributeError):
- pass
+ self.test_find_available_locales()
+ finally:
+ setattr(pkgutil, "iter_modules", iter_modules)
class FactoryTestCase(unittest.TestCase): | to keep coverage up, decorated test with skipUnless rather than use try/except block. | joke2k_faker | train | py |
708658bdd7cd7bce2db7d6d21f2aa72143f67f7d | diff --git a/grails-core/src/main/groovy/org/codehaus/groovy/grails/commons/DomainClassArtefactHandler.java b/grails-core/src/main/groovy/org/codehaus/groovy/grails/commons/DomainClassArtefactHandler.java
index <HASH>..<HASH> 100644
--- a/grails-core/src/main/groovy/org/codehaus/groovy/grails/commons/DomainClassArtefactHandler.java
+++ b/grails-core/src/main/groovy/org/codehaus/groovy/grails/commons/DomainClassArtefactHandler.java
@@ -73,16 +73,16 @@ public class DomainClassArtefactHandler extends ArtefactHandlerAdapter implement
// it's not a closure
if (clazz == null) return false;
- if (clazz.getAnnotation(Entity.class) != null) {
- return true;
- }
-
if (Closure.class.isAssignableFrom(clazz)) {
return false;
}
if (GrailsClassUtils.isJdk5Enum(clazz)) return false;
+ if (clazz.getAnnotation(Entity.class) != null) {
+ return true;
+ }
+
Class testClass = clazz;
while (testClass != null && !testClass.equals(GroovyObject.class) && !testClass.equals(Object.class)) {
try { | GRAILS-<I> - Fix failing functional tests
Revert "Minor optimization in isDomainClass"
This reverts commit c2a<I>b0a<I>d<I>f3d<I>eacde7d<I>e1f<I>a. | grails_grails-core | train | java |
d91690d23d2bb3060d3d1994cd642b2b8bf503f0 | diff --git a/doc/conf.py b/doc/conf.py
index <HASH>..<HASH> 100644
--- a/doc/conf.py
+++ b/doc/conf.py
@@ -36,6 +36,9 @@ extensions = [
# Include class documentation from both the class and __init__ docstrings.
autoclass_content = 'both'
+# Order automatically documented members by the occurence in the source file.
+autodoc_member_order = 'bysource'
+
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates'] | Documentation: Follow source order for autodoc | trendels_rhino | train | py |
6fc88c90073797ce2a2cf2691f904b0ec8f5b9c1 | diff --git a/lib/closure_tree/numeric_order_support.rb b/lib/closure_tree/numeric_order_support.rb
index <HASH>..<HASH> 100644
--- a/lib/closure_tree/numeric_order_support.rb
+++ b/lib/closure_tree/numeric_order_support.rb
@@ -44,7 +44,8 @@ module ClosureTree
FROM #{quoted_table_name}
WHERE #{where_eq(parent_column_name, parent_id)} #{min_where}
) AS t
- WHERE #{quoted_table_name}.#{quoted_id_column_name} = t.id
+ WHERE #{quoted_table_name}.#{quoted_id_column_name} = t.id and
+ #{quoted_table_name}.#{quoted_order_column(false)} is distinct from t.seq + #{minimum_sort_order_value.to_i - 1}
SQL
end | avoid update of records that do not change | ClosureTree_closure_tree | train | rb |
164c309114d501ffef30017ff8f11bc74a8ba3ab | diff --git a/spec/stoplight/failure_spec.rb b/spec/stoplight/failure_spec.rb
index <HASH>..<HASH> 100644
--- a/spec/stoplight/failure_spec.rb
+++ b/spec/stoplight/failure_spec.rb
@@ -27,8 +27,7 @@ describe Stoplight::Failure do
it 'returns a self-describing invalid failure' do
expect(result.error_class).to eq('Stoplight::Error::InvalidFailure')
- expect(result.error_message)
- .to eq('no implicit conversion of nil into String')
+ expect(result.error_message).to end_with('nil into String')
expect(result.time).to be_within(1).of(Time.now)
end
end | Fix build in Ruby <I>
The error message is different, but the spirit is the same.
# Ruby <I>
can't convert nil into String
# Ruby <I>
no implicit conversion of nil into String | orgsync_stoplight | train | rb |
aa9b233614da81c506929cc1c36eb509a4e2c97e | diff --git a/spec/unit/resource/file/verification_spec.rb b/spec/unit/resource/file/verification_spec.rb
index <HASH>..<HASH> 100644
--- a/spec/unit/resource/file/verification_spec.rb
+++ b/spec/unit/resource/file/verification_spec.rb
@@ -70,7 +70,11 @@ describe Chef::Resource::File::Verification do
context "with a verification command(String)" do
it "substitutes \%{file} with the path" do
- test_command = "test #{temp_path} = %{file}"
+ test_command = if windows?
+ "if \"#{temp_path}\" == \"%{file}\" (exit 0) else (exit 1)"
+ else
+ "test #{temp_path} = %{file}"
+ end
v = Chef::Resource::File::Verification.new(parent_resource, test_command, {})
expect(v.verify(temp_path)).to eq(true)
end | Fix Chef::Resource::File::Verification tests on Windows | chef_chef | train | rb |
b7a89ca826cb9ee46851f6bff698fb58d7ec057b | diff --git a/sirmordred/task_panels.py b/sirmordred/task_panels.py
index <HASH>..<HASH> 100644
--- a/sirmordred/task_panels.py
+++ b/sirmordred/task_panels.py
@@ -237,13 +237,17 @@ class TaskPanels(Task):
kibana_url = self.conf['panels']['kibiter_url'] + KIBANA_SETTINGS_URL
endpoint_url = kibana_url + '/' + endpoint
- res = self.grimoire_con.post(endpoint_url, headers=kibana_headers,
- data=json.dumps(data_value), verify=False)
try:
+ res = self.grimoire_con.post(endpoint_url, headers=kibana_headers,
+ data=json.dumps(data_value), verify=False)
res.raise_for_status()
except requests.exceptions.HTTPError:
logger.error("Impossible to set %s: %s", endpoint, str(res.json()))
return False
+ except requests.exceptions.ConnectionError as ex:
+ logger.error("Impossible to connect to kibiter %s: %s",
+ self.anonymize_url(self.conf['panels']['kibiter_url']), ex)
+ return False
return True | [task_panels] Add log message when kibiter is not reachable
This code includes a log message when the kibiter URL is wrong, which makes
impossible to connect to Kibiter. | chaoss_grimoirelab-sirmordred | train | py |
561e8bf63c92d0816c56ac4c6f7e4fe955410b20 | diff --git a/closure/goog/net/cookies.js b/closure/goog/net/cookies.js
index <HASH>..<HASH> 100644
--- a/closure/goog/net/cookies.js
+++ b/closure/goog/net/cookies.js
@@ -157,9 +157,9 @@ goog.net.Cookies.prototype.set = function(
if (opt_maxAge < 0) {
expiresStr = '';
- // Case 2: Expire the cookie.
+ // Case 2: Remove the cookie.
// Note: We don't tell people about this option in the function doc because
- // we prefer people to use ExpireCookie() to expire cookies.
+ // we prefer people to use remove() to remove cookies.
} else if (opt_maxAge == 0) {
// Note: Don't use Jan 1, 1970 for date because NS 4.76 will try to convert
// it to local time, and if the local time is before Jan 1, 1970, then the | Fix inline comments in goog.net.Cookies.prototype.set.
-------------
Created by MOE: <URL> | google_closure-library | train | js |
cf71d6b84e0203203fd0b9c3dea7f2fb528cbdbe | diff --git a/blockstack/blockstackd.py b/blockstack/blockstackd.py
index <HASH>..<HASH> 100644
--- a/blockstack/blockstackd.py
+++ b/blockstack/blockstackd.py
@@ -585,6 +585,7 @@ class BlockstackdRPC( SimpleXMLRPCServer):
if names is None:
names = []
+
return names
@@ -679,8 +680,10 @@ class BlockstackdRPC( SimpleXMLRPCServer):
db = get_state_engine()
self.analytics("get_all_names", {})
+ all_names = db.get_all_names( offset=offset, count=count )
db.close()
- return db.get_all_names( offset=offset, count=count )
+
+ return all_names
def rpc_get_names_in_namespace( self, namespace_id, offset, count, **con_info ): | bugfix: get_all_names | blockstack_blockstack-core | train | py |
39416fa0456710ae259a202a3a2eb3deec24840d | diff --git a/asammdf/gui/widgets/file.py b/asammdf/gui/widgets/file.py
index <HASH>..<HASH> 100644
--- a/asammdf/gui/widgets/file.py
+++ b/asammdf/gui/widgets/file.py
@@ -890,7 +890,11 @@ class FileWidget(Ui_file_widget, QtWidgets.QWidget):
def load_channel_list(self, event=None, file_name=None):
if file_name is None:
file_name, _ = QtWidgets.QFileDialog.getOpenFileName(
- self, "Select channel list file", "", "TXT files (*.txt)"
+ self,
+ "Select channel list file",
+ "",
+ "Config file (*.cfg);;TXT files (*.txt);;All file types (*.cfg *.txt)",
+ "All file types (*.cfg *.txt)"
)
if file_name: | add possibility to load .cfg files in the file widget | danielhrisca_asammdf | train | py |
e339c352a0563474b3ab426fd6a071c1061fa66e | diff --git a/src/logEvents.js b/src/logEvents.js
index <HASH>..<HASH> 100644
--- a/src/logEvents.js
+++ b/src/logEvents.js
@@ -20,7 +20,7 @@ export default function(enable) {
var string = '';
string += 'Event ';
string += format(' >2')(i) + ' ';
- string += (eventType + ' ').slice(0, maxEventTypeLength + 1) + ' ';
+ string += eventType + ' '.repeat(maxEventTypeLength - eventType.length);
string += format(' >5')(t - t0) + ' ';
if (eventType != 'initEnd') {
string += format(' >5')(t - times['start'][seqNo]); | Handle arbitrary event type name length in logEvents | magjac_d3-graphviz | train | js |
a75f1d6308f54d5fd8ba3978e7dfff4afe4f8199 | diff --git a/database/migrations/20180222064705_add_oauth.php b/database/migrations/20180222064705_add_oauth.php
index <HASH>..<HASH> 100644
--- a/database/migrations/20180222064705_add_oauth.php
+++ b/database/migrations/20180222064705_add_oauth.php
@@ -50,7 +50,7 @@ class AddOauth extends Migration
$table->integer('user_id')->unsigned();
$table->integer('provider_id')->unsigned();
$table->string('uid');
- $table->string('access_token');
+ $table->text('access_token');
$table->string('token_secret')->nullable();
$table->string('refresh_token')->nullable();
$table->timestamp('expires')->nullable(); | changed access_token to text for larger tokens | dappur_framework | train | php |
d5e665aabdfd7897b1e74d52ab13fff927eed7b9 | diff --git a/src/index.js b/src/index.js
index <HASH>..<HASH> 100644
--- a/src/index.js
+++ b/src/index.js
@@ -17,6 +17,7 @@ export Col from './Col';
export Collapse from './Collapse';
export Dropdown from './Dropdown';
export DropdownButton from './DropdownButton';
+export DropdownItem from './DropdownItem';
export Fade from './Fade';
export Form from './Form'; | Export the DropdownItem from index (#<I>) | react-bootstrap_react-bootstrap | train | js |
965188fbb175ca6a0c8b26a448edc65c6a8c26aa | diff --git a/allennlp/modules/alternating_highway_lstm.py b/allennlp/modules/alternating_highway_lstm.py
index <HASH>..<HASH> 100644
--- a/allennlp/modules/alternating_highway_lstm.py
+++ b/allennlp/modules/alternating_highway_lstm.py
@@ -196,8 +196,8 @@ class AlternatingHighwayLSTM(torch.nn.Module):
weight_index += init_tensor.nelement()
# Same for the recurrent connection weight.
- init_tensor = self.weight.data.new(input_size, self.hidden_size * 5).zero_()
- block_orthogonal(init_tensor, [input_size, self.hidden_size])
+ init_tensor = self.weight.data.new(self.hidden_size, self.hidden_size * 5).zero_()
+ block_orthogonal(init_tensor, [self.hidden_size, self.hidden_size])
self.weight.data[weight_index: weight_index + init_tensor.nelement()]\
.view_as(init_tensor).copy_(init_tensor)
weight_index += init_tensor.nelement() | fix lstm size bug (#<I>) | allenai_allennlp | train | py |
c4e2721e29916a4faf27e9f8c526942073ba9f36 | diff --git a/src/Helpers/CrudApi.php b/src/Helpers/CrudApi.php
index <HASH>..<HASH> 100644
--- a/src/Helpers/CrudApi.php
+++ b/src/Helpers/CrudApi.php
@@ -20,6 +20,10 @@ class CrudApi
} else {
$this->namespace = $this->getAppNamespace();
}
+
+ if (array_key_exists('model', $options)) {
+ $this->model = $options['model'];
+ }
}
public function setModel($model)
@@ -60,10 +64,9 @@ class CrudApi
public function getModel()
{
-
- $fqModel = $namespace.$this->model;
+ $fqModel = $this->namespace . $this->model;
if (!class_exists($fqModel)) {
- $fqModel = $namespace.'Models\\'.$this->model;
+ $fqModel = $this->namespace . 'Models\\'.$this->model;
if (!class_exists($fqModel)) {
return false;
} | Allow model to be passed into constructor. | taskforcedev_crud-api | train | php |
ed97b8d799b5884a207d14047d384c630cecb682 | diff --git a/lib/coral/node/fog.rb b/lib/coral/node/fog.rb
index <HASH>..<HASH> 100644
--- a/lib/coral/node/fog.rb
+++ b/lib/coral/node/fog.rb
@@ -8,6 +8,8 @@ class Fog < Plugin::Node
def normalize
super
+ yield if block_given?
+ dbg(provider_info, 'provider info')
create_machine(:fog, extended_config(:machine, provider_info))
end | Adding a yield to the normalize method of the fog node plugin provider. | coralnexus_corl | train | rb |
57e13e08a74a674424d98602ae5710d592b03d91 | diff --git a/js/modules/k6/http/http_request.go b/js/modules/k6/http/http_request.go
index <HASH>..<HASH> 100644
--- a/js/modules/k6/http/http_request.go
+++ b/js/modules/k6/http/http_request.go
@@ -47,7 +47,7 @@ import (
type HTTPRequest struct {
Method string
URL *neturl.URL
- Headers http.Header
+ Headers map[string][]string
Body io.Closer
Cookies map[string]*HTTPRequestCookie
} | use map[string][]string rather than directly using http.Header, the value doesn't seem to be passed to JS code properly | loadimpact_k6 | train | go |
Subsets and Splits