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
|
---|---|---|---|---|---|
dd6148edd9049f47f8a39046e57e29bf7881030b | diff --git a/demos/paymentDirect/payment.php b/demos/paymentDirect/payment.php
index <HASH>..<HASH> 100644
--- a/demos/paymentDirect/payment.php
+++ b/demos/paymentDirect/payment.php
@@ -50,10 +50,10 @@ try {
// payment type as CARD
$payIn->PaymentDetails = new \MangoPay\PayInPaymentDetailsCard();
$payIn->PaymentDetails->CardType = $card->CardType;
+ $payIn->PaymentDetails->CardId = $card->Id;
// execution type as DIRECT
$payIn->ExecutionDetails = new \MangoPay\PayInExecutionDetailsDirect();
- $payIn->ExecutionDetails->CardId = $card->Id;
$payIn->ExecutionDetails->SecureModeReturnURL = 'http://test.com';
// create Pay-In | set cardId on PaymentDetails in place of ExecutionDetails
As CardId is not a property of PayInExecutionDetailsDirect but is property of PayInPaymentDetailsCard | Mangopay_mangopay2-php-sdk | train | php |
8f98faf934f630061f60988e66ced2697c4e0319 | diff --git a/src/transformers/trainer.py b/src/transformers/trainer.py
index <HASH>..<HASH> 100755
--- a/src/transformers/trainer.py
+++ b/src/transformers/trainer.py
@@ -843,6 +843,8 @@ class Trainer:
if getattr(self, "objective", None) is None:
metrics = self.evaluate()
self.objective = self.compute_objective(metrics)
+ if self.hp_search_backend == HPSearchBackend.RAY:
+ tune.report(objective=self.objective)
return self.objective
if self.hp_search_backend == HPSearchBackend.OPTUNA: | Lat fix for Ray HP search (#<I>) | huggingface_pytorch-pretrained-BERT | train | py |
a6b2963536acc6b72301baf74d65a1bab546e7b9 | diff --git a/lib/hazel/cli.rb b/lib/hazel/cli.rb
index <HASH>..<HASH> 100644
--- a/lib/hazel/cli.rb
+++ b/lib/hazel/cli.rb
@@ -114,7 +114,7 @@ module Hazel
unless @no_bundle_install
rvm_env.chdir(@app_path) do
- puts "\n Installing dependencies into #{rvm_ruby}\n\n"
+ say_status :installing, "All dependencies into #{rvm_ruby}"
rvm_env.system "gem install bundler"
rvm_env.system "bundle install"
end | Better looking output when installing dependencies into a RVM Gemset. | c7_hazel | train | rb |
3db8fe81319cf149f0cabeb642bc18c106ddd5cb | diff --git a/src/View/Helper/EmailHelper.php b/src/View/Helper/EmailHelper.php
index <HASH>..<HASH> 100644
--- a/src/View/Helper/EmailHelper.php
+++ b/src/View/Helper/EmailHelper.php
@@ -59,8 +59,8 @@ class EmailHelper extends HtmlHelper
public function beforeRenderFile(Event $event, $viewFile)
{
- $file = explode(DS, $viewFile);
- $this->_emailType = $file[count($file) - 2];
+ preg_match('/Email\/(text|html)\//', $viewFile, $match);
+ list(, $this->_emailType) = $match;
$this->_eol = 'text' == $this->_emailType ? PHP_EOL : '<br>';
} | Improve auto-detection of email type | gourmet_email | train | php |
7714433f83fb84e51c55ffa4f4c5b1b1fb02ed47 | diff --git a/ants/utils/quantile.py b/ants/utils/quantile.py
index <HASH>..<HASH> 100644
--- a/ants/utils/quantile.py
+++ b/ants/utils/quantile.py
@@ -23,7 +23,7 @@ from .. import utils
from .. import core
-def rank_intensity( x, mask=None, get_mask=True, method='max', ):
+def rank_intensity( x, mask=None, get_mask=False, method='max', ):
"""
Rank transform the intensity of the input image with or without masking.
Intensities will transform from [0,1,2,55] to [0,1,2,3] so this may not be | BUG: was masking be default. Dammit! | ANTsX_ANTsPy | train | py |
08d8c1b231426fd0a7fa417b66d751418d2cfca5 | diff --git a/suspect/io/twix.py b/suspect/io/twix.py
index <HASH>..<HASH> 100644
--- a/suspect/io/twix.py
+++ b/suspect/io/twix.py
@@ -96,7 +96,10 @@ def load_twix_vb(fin, builder):
# read the rest of the header minus the four bytes we already read
header = fin.read(header_size - 4)
# for some reason the last 24 bytes of the header contain some junk that is not a string
- header = header[:-24].decode('windows-1250')
+ try:
+ header = header[:-24].decode('windows-1252')
+ except UnicodeDecodeError as e:
+ header = header[:-24].decode('windows-1250')
builder.set_header_string(header)
# the way that vb files are set up we just keep reading scans until the acq_end flag is set | using two encoding for twix files | bennyrowland_suspect | train | py |
c92c70c7896ab7849f16974f1d2e71acb4bdf8d9 | diff --git a/lib/discordrb/data.rb b/lib/discordrb/data.rb
index <HASH>..<HASH> 100644
--- a/lib/discordrb/data.rb
+++ b/lib/discordrb/data.rb
@@ -603,7 +603,7 @@ module Discordrb
role_ids = role_id_array(role)
if role_ids.count == 1
- API::Server.add_member_role(@bot.token, @server.id, @user.id, role_ids[0], reason: reason)
+ API::Server.add_member_role(@bot.token, @server.id, @user.id, role_ids[0], reason)
else
old_role_ids = @roles.map(&:id)
new_role_ids = (old_role_ids + role_ids).uniq
@@ -618,7 +618,7 @@ module Discordrb
role_ids = role_id_array(role)
if role_ids.count == 1
- API::Server.remove_member_role(@bot.token, @server.id, @user.id, role_ids[0], reason: reason)
+ API::Server.remove_member_role(@bot.token, @server.id, @user.id, role_ids[0], reason)
else
old_role_ids = @roles.map(&:id)
new_role_ids = old_role_ids.reject { |i| role_ids.include?(i) } | Fix reasons being hashes in calls to add/remove_member_role | meew0_discordrb | train | rb |
3824d3b0bcdea3e8d0c08598bedfce10fd3c79e0 | diff --git a/MANIFEST.in b/MANIFEST.in
index <HASH>..<HASH> 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -1,4 +1,4 @@
-include README.* setup.py setup.cfg
+include README.* setup.py setup.cfg LICENSE.txt
recursive-include pymemcache *.py
global-exclude *.pyc
global-exclude *.pyo
diff --git a/pymemcache/__init__.py b/pymemcache/__init__.py
index <HASH>..<HASH> 100644
--- a/pymemcache/__init__.py
+++ b/pymemcache/__init__.py
@@ -1 +1 @@
-__version__ = '1.2.4'
+__version__ = '1.2.5'
diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -16,7 +16,7 @@ setup(
long_description = open('README.md').read(),
license = 'Apache License 2.0',
url = 'https://github.com/Pinterest/pymemcache',
- classifiers=[
+ classifiers = [
'Programming Language :: Python',
'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7', | Adding the LICENSE.txt file to the distribution | pinterest_pymemcache | train | in,py,py |
d6ad5fa905b1052e2d191a49c394230e2e9d603e | diff --git a/generators/app/templates/app.js b/generators/app/templates/app.js
index <HASH>..<HASH> 100644
--- a/generators/app/templates/app.js
+++ b/generators/app/templates/app.js
@@ -21,7 +21,7 @@ const appHooks = require('./app.hooks');
const app = feathers();
// Load app configuration
-app.configure(configuration(path.join(__dirname, '..')));
+app.configure(configuration());
// Enable CORS, security, compression, favicon and body parsing
app.use(cors());
app.use(helmet()); | Remove path argument from configuration (#<I>)
Argument is no longer in use. Fixes #<I>. | feathersjs_generator-feathers | train | js |
0a1c1975e1c7b83640952fd53fda066802b2dcd9 | diff --git a/seed_stage_based_messaging/__init__.py b/seed_stage_based_messaging/__init__.py
index <HASH>..<HASH> 100644
--- a/seed_stage_based_messaging/__init__.py
+++ b/seed_stage_based_messaging/__init__.py
@@ -1,2 +1,2 @@
-__version__ = '0.9.5.dev0'
+__version__ = '0.9.5'
VERSION = __version__ | bumped release version to <I> | praekeltfoundation_seed-stage-based-messaging | train | py |
02be0eec5fe0a0a9fe3a8e9a6c10459b884ae268 | diff --git a/server/src/site/js/orientdb-api.js b/server/src/site/js/orientdb-api.js
index <HASH>..<HASH> 100755
--- a/server/src/site/js/orientdb-api.js
+++ b/server/src/site/js/orientdb-api.js
@@ -173,7 +173,7 @@ function ODatabase(databasePath) {
}
$.ajax({
beforeSend: function(xhr){
- if( userName != '' && userPass != '' )
+ if( userName != '' )
return xhr.setRequestHeader('Authorization', 'BASIC ' + btoa(userName+':'+userPass));
},
type : type, | Resolves #<I> - JS API library doesn't support empty passwords | orientechnologies_orientdb | train | js |
2c54b3cc11a56a19755c358be43364917f35fc4e | diff --git a/gems/rake-support/share/rails/template.rb b/gems/rake-support/share/rails/template.rb
index <HASH>..<HASH> 100644
--- a/gems/rake-support/share/rails/template.rb
+++ b/gems/rake-support/share/rails/template.rb
@@ -84,9 +84,9 @@ end
INIT
end
-# Create directories for tasks, jobs, services, and processors just for fun
+# Create directories for jobs, services, and processors just for fun
inside('app') {
- %w( tasks jobs services processors).each { |dir| FileUtils.mkdir(dir) unless File.exists?(dir) }
+ %w(jobs services processors).each { |dir| FileUtils.mkdir(dir) unless File.exists?(dir) }
}
app_constant = RAILS_2 ? 'Rails::Application' : app_const | Don't generate an app/tasks/ dir since tasks have been deprecated. | torquebox_torquebox | train | rb |
cda33ba162c88fb6b6093c7858b606e7e8368ae5 | diff --git a/blockstack_client/zonefile.py b/blockstack_client/zonefile.py
index <HASH>..<HASH> 100644
--- a/blockstack_client/zonefile.py
+++ b/blockstack_client/zonefile.py
@@ -211,6 +211,8 @@ def load_name_zonefile(name, expected_zonefile_hash, storage_drivers=None, raw_z
# try atlas node first
res = get_zonefiles( hostport, [expected_zonefile_hash], proxy=proxy )
if 'error' in res or expected_zonefile_hash not in res['zonefiles'].keys():
+ log.warning("Zonefile {} not available from {}; falling back to storage".format(expected_zonefile_hash, hostport))
+
# fall back to storage drivers if atlas node didn't have it
zonefile_txt = storage.get_immutable_data(
expected_zonefile_hash, hash_func=storage.get_zonefile_data_hash, | log failure to find zonefiles in atlas | blockstack_blockstack-core | train | py |
98e79b4b50684ec89a3fb709d6fe7d0eaaebecc2 | diff --git a/cmd/server-mux.go b/cmd/server-mux.go
index <HASH>..<HASH> 100644
--- a/cmd/server-mux.go
+++ b/cmd/server-mux.go
@@ -350,7 +350,7 @@ func (m *ServerMux) ListenAndServe(certFile, keyFile string) (err error) {
RawQuery: r.URL.RawQuery,
Fragment: r.URL.Fragment,
}
- http.Redirect(w, r, u.String(), http.StatusMovedPermanently)
+ http.Redirect(w, r, u.String(), http.StatusTemporaryRedirect)
} else {
// Execute registered handlers
m.Server.Handler.ServeHTTP(w, r) | Use <I> StatusTemporaryRedirect to redirect clients from http to https with forcing them to keep HTTP Verb (#<I>) | minio_minio | train | go |
fec009d2641f50ccdeebc3cbedd99ed1d8fc7fbc | diff --git a/lib/jazzy/config.rb b/lib/jazzy/config.rb
index <HASH>..<HASH> 100644
--- a/lib/jazzy/config.rb
+++ b/lib/jazzy/config.rb
@@ -222,8 +222,8 @@ module Jazzy
config_attr :skip_undocumented,
command_line: '--[no-]skip-undocumented',
- description: "Don't document declarations that have no documentation '\
- 'comments.",
+ description: "Don't document declarations that have no documentation "\
+ "comments.",
default: false
config_attr :hide_documentation_coverage, | Fix whitespace error in :skip_undocumented config.
Before: Don't document declarations that have no documentation ' 'comments.
After: Don't document declarations that have no documentation comments. | realm_jazzy | train | rb |
3f13479c62c32f2ae28c214ab08bca1759ec2ea8 | diff --git a/lib/yao/resources/server.rb b/lib/yao/resources/server.rb
index <HASH>..<HASH> 100644
--- a/lib/yao/resources/server.rb
+++ b/lib/yao/resources/server.rb
@@ -21,6 +21,11 @@ module Yao::Resources
self.service = "compute"
self.resource_name = "server"
self.resources_name = "servers"
+
+ def old_samples(counter_name: nil, query: {})
+ Yao::OldSample.list(counter_name, query).select{|os| os.resource_metadata["instance_id"] == id}
+ end
+
def self.start(id)
action(id, "os-start" => nil)
end | added Yao::Server#old_samples | yaocloud_yao | train | rb |
e32bd4367bf6299fbc7b7bf6ca3bd10bd837d980 | diff --git a/spotinst/aws_group.go b/spotinst/aws_group.go
index <HASH>..<HASH> 100644
--- a/spotinst/aws_group.go
+++ b/spotinst/aws_group.go
@@ -82,6 +82,7 @@ type AwsGroupScalingPolicy struct {
EvaluationPeriods *int `json:"evaluationPeriods,omitempty"`
Period *int `json:"period,omitempty"`
Cooldown *int `json:"cooldown,omitempty"`
+ Operator *string `json:"operator,omitempty"`
Dimensions []*AwsGroupScalingPolicyDimension `json:"dimensions,omitempty"`
} | feature: Add support for scaling policy operator | spotinst_spotinst-sdk-go | train | go |
f0ce3d505c479b5255726c66633e367aae3fc6e7 | diff --git a/lib/prey/connection.js b/lib/prey/connection.js
index <HASH>..<HASH> 100644
--- a/lib/prey/connection.js
+++ b/lib/prey/connection.js
@@ -10,19 +10,14 @@ var logger = require('./common').logger,
util = require('util'),
Emitter = require('events').EventEmitter;
-var Connection = function(proxy_config){
+var Connection = function(options){
var self = this;
this.established = false;
this.timeout = 5 * 1000; // 5 seconds
- if(proxy_config.enabled){
- this.check_port = proxy_config.port;
- this.check_host = proxy_config.host;
- } else {
- this.check_port = 80;
- this.check_host = 'www.google.com';
- }
+ this.target_host = options.host || 'www.google.com';
+ this.target_port = options.port || 80;
this.done = function(status, err){
if(err) logger.error(err);
@@ -37,7 +32,7 @@ var Connection = function(proxy_config){
var socket = this.socket = new net.Socket();
socket.setTimeout(this.timeout);
- socket.connect(parseInt(this.check_port), this.check_host);
+ socket.connect(parseInt(this.target_port), this.target_host);
socket.once('connect', function() {
self.established = true; | Use {port: port, host: host} options structure for connection.js. | prey_prey-node-client | train | js |
6b07aa635b0214c9ef7a717988d3892dd6442fa0 | diff --git a/salt/utils/verify.py b/salt/utils/verify.py
index <HASH>..<HASH> 100644
--- a/salt/utils/verify.py
+++ b/salt/utils/verify.py
@@ -154,12 +154,12 @@ def verify_files(files, user):
try:
pwnam = pwd.getpwnam(user)
uid = pwnam[2]
-
except KeyError:
err = ('Failed to prepare the Salt environment for user '
'{0}. The user is not available.\n').format(user)
sys.stderr.write(err)
sys.exit(salt.defaults.exitcodes.EX_NOUSER)
+
for fn_ in files:
dirname = os.path.dirname(fn_)
try:
@@ -171,6 +171,14 @@ def verify_files(files, user):
if not os.path.isfile(fn_):
with salt.utils.fopen(fn_, 'w+') as fp_:
fp_.write('')
+
+ except IOError as err:
+ if err.errno != errno.EACCES:
+ raise
+ msg = 'No permissions to access "{0}", are you running as the correct user?\n'
+ sys.stderr.write(msg.format(fn_))
+ sys.exit(err.errno)
+
except OSError as err:
msg = 'Failed to create path "{0}" - {1}\n'
sys.stderr.write(msg.format(fn_, err)) | Have a nice error message if running as the wrong user.
This is a nice-to-have to avoid exception tracebacks in the output
if running Salt as the wrong user, which I tend to do by accident a lot.
The actual exception message is no longer shown because it is redundant. | saltstack_salt | train | py |
3ee43fb0968b685fef89b57a0b7456fb6587ebea | diff --git a/test/unit/basic-tests.js b/test/unit/basic-tests.js
index <HASH>..<HASH> 100644
--- a/test/unit/basic-tests.js
+++ b/test/unit/basic-tests.js
@@ -80,7 +80,10 @@ describe('types', function () {
['00c31e', '49950'],
['0500e3c2cef9eaaab3', '92297829382473034419'],
['033171cbe0fac2d665b78d4e', '988229782938247303441911118'],
- ['fcce8e341f053d299a4872b2', '-988229782938247303441911118']
+ ['fcce8e341f053d299a4872b2', '-988229782938247303441911118'],
+ ['00b70cefb9c19c9c5112972fd01a4e676d', '243315893003967298069149506221212854125'],
+ ['00ba0cef', '12193007'],
+ ['00ffffffff', '4294967295']
];
it('should create from buffer', function () {
values.forEach(function (item) { | Test: positive varints with msb on NODEJS-<I> | datastax_nodejs-driver | train | js |
ce13d166ab3fb7600d41381bf8740a8b3534485e | diff --git a/examples/app.js b/examples/app.js
index <HASH>..<HASH> 100644
--- a/examples/app.js
+++ b/examples/app.js
@@ -6,7 +6,7 @@
var sys = require('sys'),
jade = require('./../lib/jade');
-jade.renderFile(__dirname + '/layout.jade', function(err, html){
+jade.renderFile(__dirname + '/layout.jade', { debug: true }, function(err, html){
if (err) throw err;
sys.puts(html);
});
\ No newline at end of file
diff --git a/lib/jade.js b/lib/jade.js
index <HASH>..<HASH> 100644
--- a/lib/jade.js
+++ b/lib/jade.js
@@ -306,7 +306,7 @@ Parser.prototype = {
: buf + ';';
case 'newline':
this.advance;
- return this.parseExpr();
+ return '_.lineno = ' + this.lineno + ';' + this.parseExpr();
}
},
@@ -532,6 +532,10 @@ exports.render = function(str, options){
function parse(){
try {
var parser = new Parser(str, filename);
+ if (options.debug) {
+ parser.debug();
+ parser = new Parser(str, filename);
+ }
return parser.parse();
} catch (err) {
var lineno = parser.lineno, | Added "debug" option back | pugjs_then-pug | train | js,js |
602a7b873d35d1d58199e359029ce60132955b72 | diff --git a/spec/punit/trap_spec.rb b/spec/punit/trap_spec.rb
index <HASH>..<HASH> 100644
--- a/spec/punit/trap_spec.rb
+++ b/spec/punit/trap_spec.rb
@@ -97,10 +97,11 @@ describe 'Flor punit' do
'here(0_1_0_0) terminated(f:0)'
)
- tm = @unit.journal.select { |m| m['point'] == 'trigger' }.first
+ ms = @unit.journal
+ m0 = ms.find { |m| m['point'] == 'terminated' }
+ m1 = ms.find { |m| m['point'] == 'trigger' }
- expect(tm['m']).to eq(19)
- expect(tm['sm']).to eq(18)
+ expect(m1['sm']).to eq(m0['m'])
end
it 'traps multiple times' do | Make trap trigger spec more adaptable | floraison_flor | train | rb |
e1fd7f42fc2a0f567eb6ec427eb93d774dc03f05 | diff --git a/src/app/Classes/Builder.php b/src/app/Classes/Builder.php
index <HASH>..<HASH> 100644
--- a/src/app/Classes/Builder.php
+++ b/src/app/Classes/Builder.php
@@ -63,13 +63,13 @@ class Builder
private function appendConfigParams()
{
- $this->template->authorize = isset($this->template->authorize)
- ? $this->template->authorize
- : config('enso.forms.authorize');
+ if (!property_exists($this->template, 'authorize')) {
+ $this->template->authorize = config('enso.forms.authorize');
+ }
- $this->template->dividerTitlePlacement = isset($this->template->dividerTitlePlacement)
- ? $this->template->dividerTitlePlacement
- : config('enso.forms.dividerTitlePlacement');
+ if (!property_exists($this->template, 'dividerTitlePlacement')) {
+ $this->template->dividerTitlePlacement = config('enso.forms.dividerTitlePlacement');
+ }
}
private function isForbidden($route) | refactors `appendConfigParams` from the builder | laravel-enso_FormBuilder | train | php |
cdd888d701541ad5379d348aea5556ce4e2487a2 | diff --git a/salt/renderers/stateconf.py b/salt/renderers/stateconf.py
index <HASH>..<HASH> 100644
--- a/salt/renderers/stateconf.py
+++ b/salt/renderers/stateconf.py
@@ -411,7 +411,8 @@ def add_goal_state(data):
return
else:
reqlist = []
- for sid, _, state, _ in statelist(data):
+ for sid, _, state, _ in \
+ statelist(data, set(['include', 'exclude', 'extend'])):
reqlist.append({state_name(state): sid})
data[goal_sid] = {'state.config': [dict(require=reqlist)]} | Fix a bug in goal generation that forgot to ignore the 'extend' special sid. | saltstack_salt | train | py |
3fc4e7a3ee3d776d9d195bd8427244717db21c48 | diff --git a/spec/views/shared/_atom_feed_spec.rb b/spec/views/shared/_atom_feed_spec.rb
index <HASH>..<HASH> 100644
--- a/spec/views/shared/_atom_feed_spec.rb
+++ b/spec/views/shared/_atom_feed_spec.rb
@@ -34,13 +34,19 @@ describe "shared/atom_feed.atom.builder" do
end
end
- describe "rendering trackbacks" do
+ describe "rendering trackbacks with one trackback" do
let(:article) { base_article }
let(:trackback) { Factory.build(:trackback, :article => article) }
- it "should render a valid atom feed" do
+ before do
render "shared/atom_feed", :items => [trackback]
+ end
+
+ it "should render a valid feed" do
assert_feedvalidator rendered
+ end
+
+ it "should render an Atom feed with one item" do
assert_atom10 rendered, 1
end
end | Split large atom feed view spec for trackbacks. | publify_publify | train | rb |
792f81bb221d4f2d8e6428b68c9d921f9f146e8a | diff --git a/livetests.py b/livetests.py
index <HASH>..<HASH> 100755
--- a/livetests.py
+++ b/livetests.py
@@ -52,7 +52,7 @@ def _initialize(api):
@pytest.fixture(
- scope="module", params=["2.16.22", "3.0.13", "3.1.8", "3.2.3", "3.3.0-rc2"]
+ scope="module", params=["2.16.22", "3.0.13", "3.1.8", "3.2.3", "3.3.0-rc3"]
)
def gerrit_api(request):
"""Create a Gerrit container for the given version and return an API.""" | Set the <I>-rc3 version in livetests | dpursehouse_pygerrit2 | train | py |
9c40f630e1b549f0b7889fe33dcd826b485af6fc | diff --git a/elasticsearch-model/lib/elasticsearch/model/response/base.rb b/elasticsearch-model/lib/elasticsearch/model/response/base.rb
index <HASH>..<HASH> 100644
--- a/elasticsearch-model/lib/elasticsearch/model/response/base.rb
+++ b/elasticsearch-model/lib/elasticsearch/model/response/base.rb
@@ -48,7 +48,11 @@ module Elasticsearch
# Returns the total number of hits
#
def total
- response.response['hits']['total']
+ if response.response['hits']['total'].respond_to?(:keys)
+ response.response['hits']['total']['value']
+ else
+ response.response['hits']['total']
+ end
end
# Returns the max_score | [MODEL] Handle total hits as an object in search response | elastic_elasticsearch-rails | train | rb |
d87bb430e386fa9ecb671d5283f18dafe8c65b20 | diff --git a/src/Entities/Menu.php b/src/Entities/Menu.php
index <HASH>..<HASH> 100644
--- a/src/Entities/Menu.php
+++ b/src/Entities/Menu.php
@@ -1,6 +1,7 @@
<?php namespace Arcanedev\Menus\Entities;
use Closure;
+use IteratorAggregate;
/**
* Class Menu
@@ -8,7 +9,7 @@ use Closure;
* @package Arcanedev\Menus\Entities
* @author ARCANEDEV <[email protected]>
*/
-class Menu
+class Menu implements IteratorAggregate
{
/* ------------------------------------------------------------------------------------------------
| Properties
@@ -44,6 +45,20 @@ class Menu
}
/* ------------------------------------------------------------------------------------------------
+ | Getters & Setters
+ | ------------------------------------------------------------------------------------------------
+ */
+ /**
+ * Get the menu items iterator.
+ *
+ * @return \Arcanedev\Menus\Entities\MenuItemCollection
+ */
+ public function getIterator()
+ {
+ return $this->items;
+ }
+
+ /* ------------------------------------------------------------------------------------------------
| Main Functions
| ------------------------------------------------------------------------------------------------
*/ | Adding IteratorAggregate Interface to Menu Entity | ARCANEDEV_Menus | train | php |
82f2591dc27500c0b7e00b14bd88937b4b6ab49c | diff --git a/aws/resource_aws_kinesis_firehose_delivery_stream.go b/aws/resource_aws_kinesis_firehose_delivery_stream.go
index <HASH>..<HASH> 100644
--- a/aws/resource_aws_kinesis_firehose_delivery_stream.go
+++ b/aws/resource_aws_kinesis_firehose_delivery_stream.go
@@ -2497,7 +2497,7 @@ func firehoseDeliveryStreamSSEWaitUntilTargetState(conn *firehose.Firehose, deli
func isKinesisFirehoseDeliveryStreamOptionDisabled(v interface{}) bool {
options := v.([]interface{})
- if len(options) == 0 {
+ if len(options) == 0 || options[0] == nil {
return true
}
e := options[0].(map[string]interface{})["enabled"] | Update aws/resource_aws_kinesis_firehose_delivery_stream.go | terraform-providers_terraform-provider-aws | train | go |
ca88bb6c178475ef4c872a750a94c7086bfa37c5 | diff --git a/packages/typography/src/__stories__/Typography.new-stories.js b/packages/typography/src/__stories__/Typography.new-stories.js
index <HASH>..<HASH> 100644
--- a/packages/typography/src/__stories__/Typography.new-stories.js
+++ b/packages/typography/src/__stories__/Typography.new-stories.js
@@ -15,15 +15,15 @@ export default {
argTypes: {
variant: {
options: AVAILABLE_VARIANTS,
- control: { type: "select" },
+ control: "select",
},
align: {
options: AVAILABLE_ALIGNMENTS,
- control: { type: "select" },
+ control: "select",
},
fontWeight: {
options: AVAILABLE_FONT_WEIGHTS,
- control: { type: "select" },
+ control: "select",
},
},
parameters: { | feat: use latest theme-data
- forcing a missed release, this should be a docs: commit for new storybook stories | Autodesk_hig | train | js |
bb36e6a6db7c0fdc662efb13cd503b9373675a62 | diff --git a/api.js b/api.js
index <HASH>..<HASH> 100644
--- a/api.js
+++ b/api.js
@@ -81,6 +81,12 @@ define([
});
},
+ deauthorize_url: function (done) {
+ this.get('/info', {}, function (err, res) {
+ done(res.body.authorization_endpoint + '/logout.do');
+ });
+ },
+
processResponse: function (options, err, res, done) {
// Prioritize our error condition checking over jqueries...
if (res.status_code === 401) {return this.authorize();}
@@ -142,4 +148,4 @@ define([
return api;
}
-);
\ No newline at end of file
+); | define deauthorize_url which is for logging out of uaa | hpcloud_cloud-foundry-client-js | train | js |
f5997aeae5c757886ddc1076cd634c78210a485f | diff --git a/lib/quickbooks/service/reports.rb b/lib/quickbooks/service/reports.rb
index <HASH>..<HASH> 100644
--- a/lib/quickbooks/service/reports.rb
+++ b/lib/quickbooks/service/reports.rb
@@ -6,6 +6,7 @@ module Quickbooks
if(options == {})
return "#{url_for_base}/reports/#{which_report}?date_macro=#{URI.encode_www_form_component(date_macro)}"
else
+ options_string = ""
options.each do |key, value|
options_string += "#{key}=#{value}&"
end
@@ -16,7 +17,7 @@ module Quickbooks
end
end
- def fetch_collection(model, date_macro, object_query, options)
+ def fetch_collection(model, date_macro, object_query, options = {})
response = do_http_get(url_for_query(object_query, date_macro, options))
parse_collection(response, model) | default for 'options' in fetch_collection, and set reports_string to "" initially | ruckus_quickbooks-ruby | train | rb |
38a6a9747a28e1c5a8cbdba732afb2357d04ebcb | diff --git a/packages/core/core/src/BundlerRunner.js b/packages/core/core/src/BundlerRunner.js
index <HASH>..<HASH> 100644
--- a/packages/core/core/src/BundlerRunner.js
+++ b/packages/core/core/src/BundlerRunner.js
@@ -238,21 +238,15 @@ export default class BundlerRunner {
}
});
- let entryIsReference = false;
for (let asset of duplicated) {
bundleGraph.removeAssetGraphFromBundle(asset, bundle);
-
- if (entry.id === asset.id) {
- entryIsReference = true;
- }
}
bundleGraph._graph.addEdge(
dependency
? dependency.id
: nullthrows(bundleGraph._graph.getNode(bundle.id)).id,
- entry.id,
- entryIsReference ? 'references' : null
+ entry.id
);
if (isEntry) { | Update runtimes to reflect removals aren't references anymore | parcel-bundler_parcel | train | js |
1f54f6925c080b7cc43c1c42a052cf81ef4a4924 | diff --git a/undocker.py b/undocker.py
index <HASH>..<HASH> 100644
--- a/undocker.py
+++ b/undocker.py
@@ -95,11 +95,11 @@ def main():
args = parse_args()
logging.basicConfig(level=args.loglevel)
- stdin = io.open(sys.stdin.fileno(), 'rb')
-
- with tempfile.NamedTemporaryFile() as fd:
+ with tempfile.NamedTemporaryFile() as fd, (
+ open(args.image, 'rb') if args.image
+ else io.open(sys.stdin.fileno(), 'rb')) as image:
while True:
- data = stdin.read(8192)
+ data = image.read(8192)
if not data:
break
fd.write(data) | stop lying about supporting an "image" argument | larsks_undocker | train | py |
3e57a00d33dee48eefee09da2a4650f58087330e | diff --git a/src/ContaoCommunityAlliance/DcGeneral/Contao/View/Contao2BackendView/TreeSelect.php b/src/ContaoCommunityAlliance/DcGeneral/Contao/View/Contao2BackendView/TreeSelect.php
index <HASH>..<HASH> 100644
--- a/src/ContaoCommunityAlliance/DcGeneral/Contao/View/Contao2BackendView/TreeSelect.php
+++ b/src/ContaoCommunityAlliance/DcGeneral/Contao/View/Contao2BackendView/TreeSelect.php
@@ -91,7 +91,6 @@ class TreeSelect
define('CURRENT_ID', ($strTable ? \Session::getInstance()->get('CURRENT_ID') : \Input::get('id')));
$dispatcher = $GLOBALS['container']['event-dispatcher'];
- $propagator = new EventDispatcher($dispatcher);
$translator = new TranslatorChain();
$translator->add(new LangArrayTranslator($dispatcher));
@@ -100,7 +99,7 @@ class TreeSelect
$this->itemContainer = $factory
->setContainerName($strTable)
->setTranslator($translator)
- ->setEventDispatcher($propagator)
+ ->setEventDispatcher($dispatcher)
->createDcGeneral();
$information = (array) $GLOBALS['TL_DCA'][$strTable]['fields'][$strField]; | Remove the old EventDispatcher. | contao-community-alliance_dc-general | train | php |
2a8c3f00fe753903a0fa6c130ef8aa13ece54177 | diff --git a/dpxdt/server/frontend.py b/dpxdt/server/frontend.py
index <HASH>..<HASH> 100644
--- a/dpxdt/server/frontend.py
+++ b/dpxdt/server/frontend.py
@@ -123,6 +123,9 @@ def view_build():
# Count totals for each run state within that release.
for candidate_id, status, count in stats_counts:
+ if candidate_id not in run_stats_dict:
+ continue
+
stats_dict = run_stats_dict[candidate_id]
if status in (models.Run.DIFF_APPROVED, | Fix another bug in the caching code | bslatkin_dpxdt | train | py |
b4516717b4531e80dc3697e6a36c53c50fadac24 | diff --git a/src/Sulu/Component/Content/Mapper/ContentMapper.php b/src/Sulu/Component/Content/Mapper/ContentMapper.php
index <HASH>..<HASH> 100644
--- a/src/Sulu/Component/Content/Mapper/ContentMapper.php
+++ b/src/Sulu/Component/Content/Mapper/ContentMapper.php
@@ -808,14 +808,14 @@ class ContentMapper implements ContentMapperInterface
$languageCode,
null
);
- $title = $property->getValue();
+ $nodeName = $property->getValue();
$structure->setUuid($node->getPropertyValue('jcr:uuid'));
// throw an content.node.load event (disabled for now)
//$event = new ContentNodeEvent($node, $structure);
//$this->eventDispatcher->dispatch(ContentEvents::NODE_LOAD, $event);
- $result[] = new BreadcrumbItem($depth, $nodeUuid, $title);
+ $result[] = new BreadcrumbItem($depth, $nodeUuid, $nodeName);
}
return $result; | refactored var name | sulu_sulu | train | php |
cb285c1ee99f5592bb8adcdbd826885cc36d1848 | diff --git a/src/helpers.php b/src/helpers.php
index <HASH>..<HASH> 100644
--- a/src/helpers.php
+++ b/src/helpers.php
@@ -149,7 +149,7 @@ function base64_decrypt($data, $key = false){
if($key){
$data = str_rot_pass($data, $key, true);
} else if(Config::get('encryption_key')){
- $data = str_rot_pass($data, Config::get('encryption_key'));
+ $data = str_rot_pass($data, Config::get('encryption_key'), true);
}
return $data; | base<I>_decrypt was doing encryption instead of decryption | Athlon1600_php-proxy | train | php |
579f5dd8c9e5e079ecdc1f0765706c3ee2eafb49 | diff --git a/fireplace/card.py b/fireplace/card.py
index <HASH>..<HASH> 100644
--- a/fireplace/card.py
+++ b/fireplace/card.py
@@ -1,5 +1,5 @@
from itertools import chain
-from hearthstone.enums import CardType, PlayReq, Race, Rarity, Zone
+from hearthstone.enums import CardType, PlayReq, Race, Rarity, Step, Zone
from . import actions, cards, rules
from .aura import TargetableByAuras
from .entity import BaseEntity, Entity, boolean_property, int_property, slot_property
@@ -236,9 +236,12 @@ class PlayableCard(BaseCard, Entity, TargetableByAuras):
self.log("%s draws %r", self.controller, self)
self.zone = Zone.HAND
self.controller.cards_drawn_this_turn += 1
- actions = self.get_actions("draw")
- if actions:
- self.game.queue_actions(self, actions)
+
+ if self.game.step > Step.BEGIN_MULLIGAN:
+ # Proc the draw script, but only if we are past mulligan
+ actions = self.get_actions("draw")
+ if actions:
+ self.game.queue_actions(self, actions)
def heal(self, target, amount):
return self.game.queue_actions(self, [actions.Heal(target, amount)]) | Do not trigger draw scripts during Mulligan | jleclanche_fireplace | train | py |
9a6d7becdae3c985295acc7b281f36949eda912e | diff --git a/lib/knode.js b/lib/knode.js
index <HASH>..<HASH> 100644
--- a/lib/knode.js
+++ b/lib/knode.js
@@ -324,7 +324,8 @@ exports.KNode.prototype._iterativeFind = function(key, mode, cb) {
}
if (closestNode == previousClosestNode || shortlist.length >= constants.K) {
- // TODO: clarify we might have to do a FIND_NODE here too
+ // TODO: do a FIND_* call on all nodes in shortlist
+ // who have not been contacted
externalCallback(null, 'NODE', shortlist);
return;
} | clarified that find node has to be performed | nikhilm_kademlia | train | js |
672a344903588629c97a802e354c3fe6a282e0c0 | diff --git a/core/src/test/java/com/google/errorprone/dataflow/nullnesspropagation/testdata/NullnessPropagationTransferCases8.java b/core/src/test/java/com/google/errorprone/dataflow/nullnesspropagation/testdata/NullnessPropagationTransferCases8.java
index <HASH>..<HASH> 100644
--- a/core/src/test/java/com/google/errorprone/dataflow/nullnesspropagation/testdata/NullnessPropagationTransferCases8.java
+++ b/core/src/test/java/com/google/errorprone/dataflow/nullnesspropagation/testdata/NullnessPropagationTransferCases8.java
@@ -20,7 +20,7 @@ import java.io.ByteArrayOutputStream;
import java.io.OutputStream;
/**
- * Tests for caught exceptions.
+ * Tests for {@code try} blocks.
*/
public class NullnessPropagationTransferCases8 {
public void caughtException() {
@@ -29,6 +29,10 @@ public class NullnessPropagationTransferCases8 {
} catch (Throwable t) {
// BUG: Diagnostic contains: (Non-null)
triggerNullnessChecker(t);
+
+ t = something();
+ // BUG: Diagnostic contains: (Nullable)
+ triggerNullnessChecker(t);
}
}
@@ -44,7 +48,7 @@ public class NullnessPropagationTransferCases8 {
}
}
- OutputStream something() {
- return new ByteArrayOutputStream();
+ <T> T something() {
+ return null;
}
} | Test assignment to catch() variable.
RELNOTES: none
-------------
Created by MOE: <URL> | google_error-prone | train | java |
cb7a7e1bcc0a2136d56e8fe2960c09bbce903e91 | diff --git a/src/DB/Entity/LazyLoading.php b/src/DB/Entity/LazyLoading.php
index <HASH>..<HASH> 100644
--- a/src/DB/Entity/LazyLoading.php
+++ b/src/DB/Entity/LazyLoading.php
@@ -9,7 +9,7 @@ namespace Jasny\DB\Entity;
* @license https://raw.github.com/jasny/db/master/LICENSE MIT
* @link https://jasny.github.com/db
*/
-interface LazyLoading extends \Jasny\DB\Entity, SelfAware
+interface LazyLoading extends \Jasny\DB\Entity
{
/**
* Create a ghost object. | LazyLoading doesn't automatically mean an Entity is SelfAware | jasny_db | train | php |
39430e8869b4d2f91ab8d28d18aad3ae31566eac | diff --git a/sbgn-converter/src/main/java/org/biopax/paxtools/io/sbgn/SBGNLayoutManager.java b/sbgn-converter/src/main/java/org/biopax/paxtools/io/sbgn/SBGNLayoutManager.java
index <HASH>..<HASH> 100644
--- a/sbgn-converter/src/main/java/org/biopax/paxtools/io/sbgn/SBGNLayoutManager.java
+++ b/sbgn-converter/src/main/java/org/biopax/paxtools/io/sbgn/SBGNLayoutManager.java
@@ -122,10 +122,10 @@ public class SBGNLayoutManager
graphMgr.updateBounds();
// Update the bounds
- /*for (VNode vNode: this.root.children)
+ for (VNode vNode: this.root.children)
{
updateCompoundBounds(vNode.glyph, vNode.glyph.getGlyph());
- }*/
+ }
// Clear inside of the compartmentGlyphs
for (Glyph compGlyph: idToCompartmentGlyphs.values()) | Fix for width and height of compartment nodes. | BioPAX_Paxtools | train | java |
d5581e96ba204413166902e48e06b7b10473d6b2 | diff --git a/colorise/__init__.py b/colorise/__init__.py
index <HASH>..<HASH> 100644
--- a/colorise/__init__.py
+++ b/colorise/__init__.py
@@ -23,9 +23,9 @@ import colorise.cluts
import colorise.parser
__author__ = 'Alexander Bock'
-__version__ = '0.1.4'
+__version__ = '1.0.0'
__license__ = 'MIT'
-__date__ = '2015-04-29' # YYYY-MM-DD
+__date__ = '2016-02-05' # YYYY-MM-DD
__all__ = ['set_color', 'cprint', 'fprint', 'formatcolor', 'formatbyindex',
'highlight'] | Updated version number to reflect changes on this branch | MisanthropicBit_colorise | train | py |
b618bd3de00f6294237645ce5134bca038399100 | diff --git a/src/Database/Expression/CaseExpression.php b/src/Database/Expression/CaseExpression.php
index <HASH>..<HASH> 100644
--- a/src/Database/Expression/CaseExpression.php
+++ b/src/Database/Expression/CaseExpression.php
@@ -24,7 +24,7 @@ use Closure;
/**
* This class represents a SQL Case statement
*
- * @deprecated 4.3.0 Use CaseStatementExpression instead or Query::case()
+ * @deprecated 4.3.0 Use QueryExpression::case() or CaseStatementExpression instead
*/
class CaseExpression implements ExpressionInterface
{ | Fix QueryExpression::case suggestion in deprecated | cakephp_cakephp | train | php |
e24d7c574644d95ea826b4f8486409149eedcca2 | diff --git a/src/Helpers/Mixed.php b/src/Helpers/Mixed.php
index <HASH>..<HASH> 100644
--- a/src/Helpers/Mixed.php
+++ b/src/Helpers/Mixed.php
@@ -38,10 +38,20 @@ class Mixed {
return call_user_func_array( [$entity, $method], $arguments );
}
- if ( is_string( $entity ) && class_exists( $entity ) ) {
+ if ( static::isClass( $entity ) ) {
return call_user_func_array( [new $entity(), $method], $arguments );
}
return $entity;
}
+
+ /**
+ * Check if a value is a valid class name
+ *
+ * @param mixed $class_name
+ * @return boolean
+ */
+ public static function isClass( $class_name ) {
+ return ( is_string( $class_name ) && class_exists( $class_name ) );
+ }
} | reduce complexity of Mixed::value() | htmlburger_wpemerge | train | php |
ab21fae43e3626c4ceab8eab314171dfba128f29 | diff --git a/src/sap.ui.fl/src/sap/ui/fl/apply/_internal/flexObjects/CompVariant.js b/src/sap.ui.fl/src/sap/ui/fl/apply/_internal/flexObjects/CompVariant.js
index <HASH>..<HASH> 100644
--- a/src/sap.ui.fl/src/sap/ui/fl/apply/_internal/flexObjects/CompVariant.js
+++ b/src/sap.ui.fl/src/sap/ui/fl/apply/_internal/flexObjects/CompVariant.js
@@ -176,6 +176,14 @@ sap.ui.define([
CompVariant.STANDARD_VARIANT_ID = "*standard*";
/**
+ * Returns the id of the variant object
+ * @returns {string} the id of the variant object.
+ */
+ CompVariant.prototype.getVariantId = function () {
+ return this.getId();
+ };
+
+ /**
* Checks whenever the variant can be renamed updating the entity or crating an <code>updateChange</code>.
*
* @param {sap.ui.fl.Layer} [sLayer] - Layer in which the edition may take place | [INTERNAL] sap.ui.fl: preparation change for fl restructuring
To be able to change the variant api calls in sapui5.runtime we
required to prepare this function first.
Change-Id: I0e<I>c1a6cf1b<I>f9d<I>d<I>f<I>d<I>d9
JIRA: TEAM<I>-<I> | SAP_openui5 | train | js |
a11ed6bbd3b4d22a04b71839476e744fcf0bbacc | diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -1,13 +1,17 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
-# Thanks to Kenneth Reitz, I stole the template for this
+import os
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
-required = []
+appdir = os.path.dirname(os.path.realpath(__file__))
+requirements = f"{appdir}/requirements.txt"
+# should I bother to remove testing requirements?
+required = [l.strip() for l in open(requirements) if not l.startswith("#")]
+
packages = ["limbo", "limbo.plugins"]
try:
@@ -17,7 +21,7 @@ except:
setup(
name="limbo",
- version="8.2.0",
+ version="8.2.1",
description="Simple and Clean Slack Chatbot",
long_description=longdesc,
author="Bill Mill", | Actually require requirements
I installed limbo on a new server, and realized that it didn't require all of its dependencies
closes #<I> | llimllib_limbo | train | py |
bbfa13c86c02eb235faf829951f484664cae222b | diff --git a/client/interfaces.go b/client/interfaces.go
index <HASH>..<HASH> 100644
--- a/client/interfaces.go
+++ b/client/interfaces.go
@@ -227,6 +227,7 @@ type InstanceServer interface {
DeleteNetwork(name string) (err error)
// Network ACL functions ("network_acl" API extension)
+ GetNetworkACLs() (acls []api.NetworkACL, err error)
CreateNetworkACL(acl api.NetworkACLsPost) (err error)
// Operation functions | client/interfaces: Adds GetNetworkACLs | lxc_lxd | train | go |
d08006703185b0684f4c14ac02b4df5dc07e0b61 | diff --git a/lib/ronin/address.rb b/lib/ronin/address.rb
index <HASH>..<HASH> 100644
--- a/lib/ronin/address.rb
+++ b/lib/ronin/address.rb
@@ -34,7 +34,7 @@ module Ronin
property :id, Serial
# The class name of the Address
- property :type, Discriminator
+ property :type, Discriminator, :required => true
# The Address
property :address, String, :required => true, | Add a :required => true to Address.type, to match it's migration. | ronin-ruby_ronin | train | rb |
157256764d7e2c85d14cc9ee6c5d648e787b7ccd | diff --git a/mock.py b/mock.py
index <HASH>..<HASH> 100644
--- a/mock.py
+++ b/mock.py
@@ -56,7 +56,7 @@ except ImportError:
return f
return inner
else:
- if sys.version_info[:2] >= (3, 3):
+ if sys.version_info[:2] >= (3, 2):
wraps = original_wraps
else:
def wraps(func): | Fix for wraps - __wrapped__ was added in <I> not <I> | testing-cabal_mock | train | py |
e64b8c9c2d071d82cc5e709b119c7bd3104f3e3d | diff --git a/lib/project_euler_cli/archive_viewer.rb b/lib/project_euler_cli/archive_viewer.rb
index <HASH>..<HASH> 100644
--- a/lib/project_euler_cli/archive_viewer.rb
+++ b/lib/project_euler_cli/archive_viewer.rb
@@ -14,7 +14,7 @@ class ArchiveViewer
puts
- Problem.total.downto(Problem.total - 9) { |i| puts "#{i} - #{@problems[i].title}" }
+ (Problem.total).downto(Problem.total - 9) { |i| puts "#{i} - #{@problems[i].title}" }
end
# Displays the problem numbers and titles for an individual page of the archive.
diff --git a/lib/project_euler_cli/page.rb b/lib/project_euler_cli/page.rb
index <HASH>..<HASH> 100644
--- a/lib/project_euler_cli/page.rb
+++ b/lib/project_euler_cli/page.rb
@@ -19,10 +19,6 @@ class Page
@@visited
end
- def self.visited=(visited)
- @@visited = visited
- end
-
end
end | Fix error introduced by removing parentheses in call to downto | ecssiah_project-euler-cli | train | rb,rb |
efad3813863c278bbf76b52cd745eb47a9ba0a0e | diff --git a/samples/add_item.py b/samples/add_item.py
index <HASH>..<HASH> 100644
--- a/samples/add_item.py
+++ b/samples/add_item.py
@@ -82,9 +82,10 @@ def main():
itemParams.tags = "tags"
itemParams.snippet = "Test File"
itemParams.typeKeywords = "Data,Image,png"
- itemParams.filename = upload_file
+ #itemParams.filename = upload_file
item = userInfo.addItem(
itemParameters=itemParams,
+ filePath= upload_file,
overwrite=True,
relationshipType=None,
originItemId=None,
@@ -100,4 +101,4 @@ def main():
print "with error message: %s" % synerror
if __name__ == "__main__":
- main()
\ No newline at end of file
+ main() | Update add_item.py
For adding an item of type "Image" or " Tile Package" (tested with those, but probably others) , a file path parameter is needed. ItemParameter fileName is not being used. | Esri_ArcREST | train | py |
0be0da45d0e9fd6f0b46503a0c978a79077a49e1 | diff --git a/hollow/src/main/java/com/netflix/hollow/api/producer/HollowProducer.java b/hollow/src/main/java/com/netflix/hollow/api/producer/HollowProducer.java
index <HASH>..<HASH> 100644
--- a/hollow/src/main/java/com/netflix/hollow/api/producer/HollowProducer.java
+++ b/hollow/src/main/java/com/netflix/hollow/api/producer/HollowProducer.java
@@ -343,11 +343,11 @@ public class HollowProducer {
return new HollowObjectMapper(writeEngine);
}
- protected HollowWriteStateEngine getWriteEngine() {
+ public HollowWriteStateEngine getWriteEngine() {
return objectMapper.getStateEngine();
}
-
- protected HollowObjectMapper getObjectMapper() {
+
+ public HollowObjectMapper getObjectMapper() {
return objectMapper;
} | make HollowProducer's writeEngine and objectMapper methods public | Netflix_hollow | train | java |
c4a6684f219e6026795b126e4e6b9194888307b0 | diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -20,7 +20,7 @@ for many purposes for example implement __hash__ for your complex object
very fast. freeze_stable and flatten are usable for testing and analysis.""",
keywords = "freeze state hash sort compare unittest",
url = "https://github.com/adfinis-sygroup/freeze",
- download_url = "https://github.com/adfinis-sygroup/freeze/archive/freeze-0.1.0.tar.gz",
+ #download_url = "https://github.com/adfinis-sygroup/freeze/archive/freeze-0.1.0.tar.gz",
#bugtrack_url = "https://github.com/adfinis-sygroup/freeze/issues",
classifiers = [
"Development Status :: 4 - Beta", | * removed download link since it freeze is hosted on pypi | adfinis-sygroup_freeze | train | py |
162a9cc2ee37eeab7188bc9c85324f2d601139f8 | diff --git a/lib/gravatarify/base.rb b/lib/gravatarify/base.rb
index <HASH>..<HASH> 100644
--- a/lib/gravatarify/base.rb
+++ b/lib/gravatarify/base.rb
@@ -48,7 +48,7 @@ module Gravatarify
# defined.
def subdomain(str); subdomains[str.hash % subdomains.size] || 'www' end
- # Helper method to escape string using either <tt>Rack::Utils#escape</tt> if available or else
+ # Helper method to URI escape a string using either <tt>Rack::Utils#escape</tt> if available or else
# fallback to <tt>CGI#escape</tt>.
def escape(str)
str = str.to_s unless str.is_a?(String) # convert to string!
@@ -97,7 +97,6 @@ module Gravatarify
# @return [String] In any case (even if supplied +email+ is +nil+) returns a fully qualified gravatar.com URL.
# The returned string is not yet HTML escaped, *but* all +url_options+ have been URI escaped.
def build_gravatar_url(email, url_options = {})
- # FIXME: add symbolize_keys again, maybe just write custom method, so we do not depend on ActiveSupport magic...
url_options = Gravatarify.options.merge(url_options)
email_hash = Digest::MD5.hexdigest(Base.get_smart_email_from(email).strip.downcase)
extension = (ext = url_options.delete(:filetype) and ext != '') ? ".#{ext || 'jpg'}" : '' | removed FIXME and added more descriptive rdoc | lwe_gravatarify | train | rb |
57fcce8f04b78ec5c4c6933d1cb4a004b1c616af | diff --git a/pkg/policy/identifier.go b/pkg/policy/identifier.go
index <HASH>..<HASH> 100644
--- a/pkg/policy/identifier.go
+++ b/pkg/policy/identifier.go
@@ -67,8 +67,8 @@ func NewEndpointSet(capacity int) *EndpointSet {
// signals to the provided WaitGroup when epFunc has been executed for each
// endpoint.
func (e *EndpointSet) ForEach(wg *sync.WaitGroup, epFunc func(epp Endpoint)) {
- e.mutex.Lock()
- defer e.mutex.Unlock()
+ e.mutex.RLock()
+ defer e.mutex.RUnlock()
wg.Add(len(e.endpoints)) | pkg/policy: use Read mutex instead of Write mutex
The shared region the mutex is protecting is not being modified so there
is no point in having a Lock instead of a RLock | cilium_cilium | train | go |
4c81b728ef23750c83e8a99ce9d1a757fa225d68 | diff --git a/WeaveAPI/src/weave/api/WeavePath.js b/WeaveAPI/src/weave/api/WeavePath.js
index <HASH>..<HASH> 100644
--- a/WeaveAPI/src/weave/api/WeavePath.js
+++ b/WeaveAPI/src/weave/api/WeavePath.js
@@ -76,7 +76,7 @@ function WeavePath(args)
// private variables
var stack = []; // stack of argument counts from push() calls, used with pop()
var reconstructArgs = false; // if true, JSON.parse(JSON.stringify(...)) will be used on all parameters
- var path = A(args, 1)[0] || [];
+ var path = A(args, 1);
/**
* Private function for internal use. | fixed bug that was created in recent commit | WeaveTeam_WeaveJS | train | js |
b0adf13a8ba4413723b4e65c5a4549941ddd60d1 | diff --git a/lib/aws/version.rb b/lib/aws/version.rb
index <HASH>..<HASH> 100644
--- a/lib/aws/version.rb
+++ b/lib/aws/version.rb
@@ -1,3 +1,3 @@
module Aws
- VERSION = '2.0.0.rc8'
+ VERSION = '2.0.0.rc9'
end | Tag release <I>.rc9
References:
#<I>, #<I>, #<I>, #<I>, #<I>, aws/aws-sdk-ruby#<I>,
aws/aws-sdk-ruby#<I> | aws_aws-sdk-ruby | train | rb |
43c917c874061102a7b3694140c9c86a7b723a69 | diff --git a/great_expectations/cli/datasource.py b/great_expectations/cli/datasource.py
index <HASH>..<HASH> 100644
--- a/great_expectations/cli/datasource.py
+++ b/great_expectations/cli/datasource.py
@@ -155,7 +155,12 @@ You can add a datasource later by editing the great_expectations.yml file.
data_source_name = click.prompt(
msg_prompt_datasource_name, default=default_data_source_name, show_default=True)
- context.add_datasource(data_source_name, "spark", base_directory=path)
+ context.add_datasource(data_source_name,
+ module_name="great_expectations.datasource",
+ class_name="SparkDFDatasource",
+ base_directory=path) # NOTE: Eugene: 2019-09-17: review the path and make sure that the logic works both for abs and rel.
+ # base_directory=os.path.join("..", path))
+
# if data_source_selection == "5": # dbt
# dbt_profile = click.prompt(msg_prompt_dbt_choose_profile) | Converted the logic of creating a SparkDF datasource in the CLI to use the new (module/class) convention | great-expectations_great_expectations | train | py |
3f09a40c78de5406b5070af8085fe2407488a788 | diff --git a/tests/Client/ApcuClientTest.php b/tests/Client/ApcuClientTest.php
index <HASH>..<HASH> 100644
--- a/tests/Client/ApcuClientTest.php
+++ b/tests/Client/ApcuClientTest.php
@@ -9,6 +9,10 @@ class ApcuClientTest extends TestCase
{
public function testInstantiation(): void
{
+ $enabled = ini_get('apc.enable_cli');
+ $this->assertSame('1', $enabled, 'Forgot to enable apc.enable_cli flag');
+
+ apcu_clear_cache();
$key = 'pid-' . getmypid();
$client = new ApcuClient();
$this->assertInstanceOf(ApcuClient::class, $client); | Update ApcuClientTest to check for apc.enable_cli=1 and clear the cache | beryllium_cache | train | php |
575877090472547980fc6a31131550c594117d9a | diff --git a/classes/phing/util/FileUtils.php b/classes/phing/util/FileUtils.php
index <HASH>..<HASH> 100644
--- a/classes/phing/util/FileUtils.php
+++ b/classes/phing/util/FileUtils.php
@@ -99,6 +99,9 @@ class FileUtils {
$in->close();
if ( $out !== null )
$out->close();
+
+ $destFile->setMode($sourceFile->getMode());
+
} else {
// simple copy (no filtering)
$sourceFile->copyTo($destFile); | Refs #<I> - preserve file mode (patch by Merkas) | phingofficial_phing | train | php |
11121d54e02f8d0599d9f69923f27fb89bd22687 | diff --git a/javascript/safari-driver/inject/page.js b/javascript/safari-driver/inject/page.js
index <HASH>..<HASH> 100644
--- a/javascript/safari-driver/inject/page.js
+++ b/javascript/safari-driver/inject/page.js
@@ -78,9 +78,18 @@ safaridriver.inject.page.init = function() {
safaridriver.inject.page.LOG_.info('Sending ' + message);
message.send(window);
- window.alert = safaridriver.inject.page.wrappedAlert_;
- window.confirm = safaridriver.inject.page.wrappedConfirm_;
- window.prompt = safaridriver.inject.page.wrappedPrompt_;
+ wrapDialogFunction('alert', safaridriver.inject.page.wrappedAlert_);
+ wrapDialogFunction('confirm', safaridriver.inject.page.wrappedConfirm_);
+ wrapDialogFunction('prompt', safaridriver.inject.page.wrappedPrompt_);
+
+ function wrapDialogFunction(name, newFn) {
+ var oldFn = window[name];
+ window[name] = newFn;
+ window.constructor.prototype[name] = newFn;
+ window[name].toString = function() {
+ return oldFn.toString();
+ };
+ }
};
goog.exportSymbol('init', safaridriver.inject.page.init); | JasonLeyba: The SafariDriver should try to hide the fact that it overrides window.{alert,confirm,prompt}.
r<I> | SeleniumHQ_selenium | train | js |
761b01d2337d66a6e2dcb1865553469a5b21e645 | diff --git a/src/helpers/default-config.js b/src/helpers/default-config.js
index <HASH>..<HASH> 100644
--- a/src/helpers/default-config.js
+++ b/src/helpers/default-config.js
@@ -26,5 +26,5 @@ module.exports = {
rps: true,
statusCodes: true,
},
- ignoreStartsWith: '',
+ ignoreStartsWith: '/admin',
}; | Set ignoreStartsWith to /admin
Set ignoreStartsWith to /admin to align with README. ignoreStartsWith set to empty string effectively ignored all routes. | RafalWilinski_express-status-monitor | train | js |
dc3884b874ede3fa1df60f9b5c615fef4b90aa5d | diff --git a/src/django_like/__init__.py b/src/django_like/__init__.py
index <HASH>..<HASH> 100644
--- a/src/django_like/__init__.py
+++ b/src/django_like/__init__.py
@@ -11,7 +11,7 @@ connection.operators['ilike'] = connection.operators['icontains']
def get_prep_lookup(self, lookup_type, value):
try:
- self.get_prep_lookup_origin(lookup_type, value)
+ return self.get_prep_lookup_origin(lookup_type, value)
except TypeError, e:
if lookup_type in ('like', 'ilike'):
return value | A forgot a return :-) | goinnn_django-like | train | py |
f293234e468669b9f72ff55def209436e9d4f377 | diff --git a/src/Naderman/Composer/AWS/AwsClient.php b/src/Naderman/Composer/AWS/AwsClient.php
index <HASH>..<HASH> 100644
--- a/src/Naderman/Composer/AWS/AwsClient.php
+++ b/src/Naderman/Composer/AWS/AwsClient.php
@@ -206,7 +206,12 @@ class AwsClient
}
if (!function_exists('AWS\manifest')) {
- require_once __DIR__ . '/../../../../../../aws/aws-sdk-php/src/functions.php';
+ // This file has to be loaded with the exact same name as in the composer static autoloader to avoid
+ // including it twice, which leads to functions in the AWS Namespace to be declared twice.
+ $static_include_path = __DIR__ . '/../../../../../../composer/autoload_static.php';
+ $static_include_path = realpath($static_include_path);
+ $static_include_path = dirname($static_include_path);
+ require_once $static_include_path . '/../aws/aws-sdk-php/src/functions.php';
}
if (!function_exists('GuzzleHttp\Psr7\uri_for')) { | Changed AWS require behaviour to mimic composer autoload_static which stops the file from being included twice | naderman_composer-aws | train | php |
57d4f893320659a4565c2536eba7871dd50ec147 | diff --git a/jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/factory/PropertiesBasedBundlesHandlerFactory.java b/jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/factory/PropertiesBasedBundlesHandlerFactory.java
index <HASH>..<HASH> 100644
--- a/jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/factory/PropertiesBasedBundlesHandlerFactory.java
+++ b/jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/factory/PropertiesBasedBundlesHandlerFactory.java
@@ -301,7 +301,7 @@ public class PropertiesBasedBundlesHandlerFactory {
StringTokenizer tk = new StringTokenizer(childBundlesProperty, JawrConstant.COMMA_SEPARATOR);
while (tk.hasMoreTokens()) {
ResourceBundleDefinition childDef = buildCustomBundleDefinition(tk.nextToken().trim(), true);
- childDef.setBundleId(bundleId);
+ childDef.setBundleId(props.getCustomBundleProperty(childDef.getBundleName(), BUNDLE_FACTORY_CUSTOM_ID));
if (StringUtils.isEmpty(childDef.getDebugURL())) {
children.add(childDef);
} else { | Fix issues with child bundles being included instead of parent bundle because parent bundleId was being used. | j-a-w-r_jawr-main-repo | train | java |
68fdac39b335ae951c1ebebc3846011ba3cdfbb0 | diff --git a/cloudconfig/containerinit/container_userdata_test.go b/cloudconfig/containerinit/container_userdata_test.go
index <HASH>..<HASH> 100644
--- a/cloudconfig/containerinit/container_userdata_test.go
+++ b/cloudconfig/containerinit/container_userdata_test.go
@@ -133,6 +133,8 @@ bootcmd:
- |-
printf '%s\n' '` + indentedNetConfig + `
' > '` + s.networkInterfacesFile + `'
+runcmd:
+- ifup -a || true
`
assertUserData(c, cloudConf, expected)
} | cloudconfig/containerinit: Fixed userdata tests to include ifup -a || true | juju_juju | train | go |
54a6cf79d7ac0ae8fdb0589eeb2c66da672f8c4d | diff --git a/core/client/views/blog.js b/core/client/views/blog.js
index <HASH>..<HASH> 100644
--- a/core/client/views/blog.js
+++ b/core/client/views/blog.js
@@ -35,6 +35,7 @@
initialize: function (options) {
this.$('.content-list-content').scrollClass({target: '.content-list', offset: 10});
this.listenTo(this.collection, 'remove', this.showNext);
+ this.listenTo(this.collection, 'add', this.renderPost);
// Can't use backbone event bind (see: http://stackoverflow.com/questions/13480843/backbone-scroll-event-not-firing)
this.$('.content-list-content').scroll($.proxy(this.checkScroll, this));
},
@@ -102,9 +103,18 @@
});
},
+ renderPost: function (model) {
+ this.$('ol').append(this.addSubview(new ContentItem({model: model})).render().el);
+ },
+
render: function () {
+ var $list = this.$('ol');
+
+ // Clear out any pre-existing subviews.
+ this.removeSubviews();
+
this.collection.each(function (model) {
- this.$('ol').append(this.addSubview(new ContentItem({model: model})).render().el);
+ $list.append(this.addSubview(new ContentItem({model: model})).render().el);
}, this);
this.showNext();
} | Fix duplication of entries in infinite scroll
Fixes #<I>
- Switched to render each new item as its added to the collection when
retrieving via scroll checks.
- Added check to remove all subviews whenever `render` is called on
`ContentList` as a preventative measure.
- Cached the jquery reference to the ordered list in `render`. | TryGhost_Ghost | train | js |
1b747b46aa624f1dffa9af85fba695f8b0769512 | diff --git a/generators/app/templates/tasks/karma.js b/generators/app/templates/tasks/karma.js
index <HASH>..<HASH> 100644
--- a/generators/app/templates/tasks/karma.js
+++ b/generators/app/templates/tasks/karma.js
@@ -23,9 +23,15 @@ module.exports = {
autoWatch: false,
// List of browsers to execute tests on
- browsers: [
- 'PhantomJS'
- ],
+ browsers: ['ChromeHeadlessCI'],
+
+ // Configure custom ChromHeadlessCI as an extension of ChromeHeadlessCI without sandbox
+ customLaunchers: {
+ ChromeHeadlessCI: {
+ base: 'ChromeHeadless',
+ flags: ['--no-sandbox']
+ }
+ },
// Continuous Integration mode
// if true, Karma captures browsers, runs the tests and exits | plugin: execute client tests on headless Chrome | veo-labs_openveo-plugin-generator | train | js |
b043957b47ca11d00f4b8946863c40e8426495d3 | diff --git a/tasks/blanket_mocha.js b/tasks/blanket_mocha.js
index <HASH>..<HASH> 100644
--- a/tasks/blanket_mocha.js
+++ b/tasks/blanket_mocha.js
@@ -24,14 +24,7 @@ var helpers = require('../support/mocha-helpers');
module.exports = function(grunt) {
- var ok = true;
- var status, coverageThreshold, modulePattern, modulePatternRegex, excludedFiles, customThreshold, customModuleThreshold;
- var totals = {
- totalLines: 0,
- coveredLines: 0,
- moduleTotalStatements : {},
- moduleTotalCoveredStatements : {}
- };
+ var ok, totals, status, coverageThreshold, modulePattern, modulePatternRegex, excludedFiles, customThreshold, customModuleThreshold;
// External lib.
var phantomjs = require('grunt-lib-phantomjs').init(grunt);
@@ -220,6 +213,14 @@ module.exports = function(grunt) {
logErrors: false
});
+ ok = true;
+ totals = {
+ totalLines: 0,
+ coveredLines: 0,
+ moduleTotalStatements : {},
+ moduleTotalCoveredStatements : {}
+ };
+
status = {blanketTotal: 0, blanketPass: 0, blanketFail: 0};
coverageThreshold = grunt.option('threshold') || options.threshold; | Allow coverage to be run multiple times cleanly
Currently if this is run as a part of a watch task, the statement count will
carry over from the previous run which will throw off the coverage
percentage over time. The same applies to the ok status.
This will define both status and totals on a per run basis so each run is
clean, whether the task is run on watch or manually from the command line. | GruntBlanketMocha_grunt-blanket-mocha | train | js |
15af15768b5d2be6abc4813e7d55915afc8d697d | diff --git a/cairo/surface.go b/cairo/surface.go
index <HASH>..<HASH> 100644
--- a/cairo/surface.go
+++ b/cairo/surface.go
@@ -41,7 +41,7 @@ func NewSurfaceFromPNG(fileName string) (*Surface, error) {
// CreateImageSurfaceForData is a wrapper around cairo_image_surface_create_for_data().
func CreateImageSurfaceForData(data []byte, format Format, width, height, stride int) (*Surface, error) {
- surfaceNative := C.cairo_image_surface_create_for_data((*C.guchar)(unsafe.Pointer(&data[0])),
+ surfaceNative := C.cairo_image_surface_create_for_data((*C.uchar)(unsafe.Pointer(&data[0])),
C.cairo_format_t(format), C.int(width), C.int(height), C.int(stride))
status := Status(C.cairo_surface_status(surfaceNative)) | change *C.guchar to *C.uchar for compatibility with Go <I> or earlier - tnx @founderio for the suggestion | gotk3_gotk3 | train | go |
816dcbfc8f615882963ab64998798d2a99e0e3a3 | diff --git a/lib/travis/model/build/config/dist.rb b/lib/travis/model/build/config/dist.rb
index <HASH>..<HASH> 100644
--- a/lib/travis/model/build/config/dist.rb
+++ b/lib/travis/model/build/config/dist.rb
@@ -20,10 +20,17 @@ class Build
end
def run
+ return config unless config_hashy?
+ return config if config.key?(:dist) || config.key?('dist')
+
config.dup.tap do |c|
- return c if c.key?(:dist) || c.key?('dist')
c.merge!(dist: dist_for_config)
- c.fetch(:matrix, {}).fetch(:include, []).each do |inc|
+
+ matrix = c.fetch(:matrix, {})
+ return c unless matrix.respond_to?(:fetch)
+
+ matrix.fetch(:include, []).each do |inc|
+ next unless inc.respond_to?(:key)
next if inc.key?(:dist) || inc.key?('dist')
inc.merge!(dist: dist_for_config(inc))
end
@@ -32,6 +39,10 @@ class Build
private
+ def config_hashy?
+ %w(key? dup merge! fetch).all? { |m| config.respond_to?(m) }
+ end
+
def dist_for_config(h = config)
return DIST_LANGUAGE_MAP[h[:language]] if
DIST_LANGUAGE_MAP.key?(h[:language]) | Guard against bogus config and matrix values in dist normalization | travis-ci_travis-core | train | rb |
5e50fdc5e65a0962f70fb1b256fbb28491ad44df | diff --git a/nonebot/message.py b/nonebot/message.py
index <HASH>..<HASH> 100644
--- a/nonebot/message.py
+++ b/nonebot/message.py
@@ -80,16 +80,18 @@ async def handle_message(bot: NoneBot, event: CQEvent) -> None:
def _check_at_me(bot: NoneBot, event: CQEvent) -> None:
+ def is_at_me(seg):
+ return seg.type == 'at' and seg.data['qq'] == event.self_id
+
if event.detail_type == 'private':
event['to_me'] = True
else:
# group or discuss
event['to_me'] = False
- at_me_seg = MessageSegment.at(event.self_id)
# check the first segment
first_msg_seg = event.message[0]
- if first_msg_seg == at_me_seg:
+ if is_at_me(first_msg_seg):
event['to_me'] = True
del event.message[0]
@@ -103,7 +105,7 @@ def _check_at_me(bot: NoneBot, event: CQEvent) -> None:
i -= 1
last_msg_seg = event.message[i]
- if last_msg_seg == at_me_seg:
+ if is_at_me(last_msg_seg):
event['to_me'] = True
del event.message[i:] | fix check_at_me on node-onebot | richardchien_nonebot | train | py |
1ddefcff3e85fd2d0e7a6f3ad27c6c8a26287162 | diff --git a/moco-core/src/main/java/com/github/dreamhead/moco/extractor/FormRequestExtractor.java b/moco-core/src/main/java/com/github/dreamhead/moco/extractor/FormRequestExtractor.java
index <HASH>..<HASH> 100644
--- a/moco-core/src/main/java/com/github/dreamhead/moco/extractor/FormRequestExtractor.java
+++ b/moco-core/src/main/java/com/github/dreamhead/moco/extractor/FormRequestExtractor.java
@@ -6,8 +6,6 @@ import com.google.common.collect.ImmutableMap;
import java.util.Optional;
-import static java.util.Optional.empty;
-
public final class FormRequestExtractor extends HttpRequestExtractor<String> {
private final FormsRequestExtractor extractor = new FormsRequestExtractor();
private final String key;
@@ -19,10 +17,6 @@ public final class FormRequestExtractor extends HttpRequestExtractor<String> {
@Override
protected Optional<String> doExtract(final HttpRequest request) {
Optional<ImmutableMap<String, String>> forms = extractor.extract(request);
- if (forms.isPresent()) {
- return Optional.ofNullable(forms.get().get(key));
- }
-
- return empty();
+ return forms.map(formValues -> formValues.get(key));
}
} | applied optional map in form request extractor | dreamhead_moco | train | java |
3df6dbff40b24f8c4993283bb74e9091faaa50cd | diff --git a/src/DependencyFactory.php b/src/DependencyFactory.php
index <HASH>..<HASH> 100644
--- a/src/DependencyFactory.php
+++ b/src/DependencyFactory.php
@@ -91,7 +91,7 @@ final class DependencyFactory implements ProviderInterface
public function get()
{
// is singleton ?
- if ($this->instance) {
+ if($this->instance !== null) {
return $this->instance;
}
// constructor injection | [#<I>] explicit condition | ray-di_Ray.Di | train | php |
d41cfdf2b8795bf55e4f5d1ecb78193cd90555f8 | diff --git a/v1/backends/redis/goredis.go b/v1/backends/redis/goredis.go
index <HASH>..<HASH> 100644
--- a/v1/backends/redis/goredis.go
+++ b/v1/backends/redis/goredis.go
@@ -3,10 +3,12 @@ package redis
import (
"bytes"
"encoding/json"
- "github.com/go-redis/redis"
+ "strings"
"sync"
"time"
+ "github.com/go-redis/redis"
+
"github.com/RichardKnop/machinery/v1/backends/iface"
"github.com/RichardKnop/machinery/v1/common"
"github.com/RichardKnop/machinery/v1/config"
@@ -33,10 +35,19 @@ func NewGR(cnf *config.Config, addrs []string, db int) iface.Backend {
b := &BackendGR{
Backend: common.NewBackend(cnf),
}
+ parts := strings.Split(addrs[0], "@")
+ if len(parts) == 2 {
+ // with passwrod
+ b.password = parts[0]
+ addrs[0] = parts[1]
+ }
+
ropt := &redis.UniversalOptions{
- Addrs: addrs,
- DB: db,
+ Addrs: addrs,
+ DB: db,
+ Password: b.password,
}
+
b.rclient = redis.NewUniversalClient(ropt)
return b
} | Feat: Support redis cluster with password | RichardKnop_machinery | train | go |
4920b80674abfdf030fdd3b1cd087cc512c32051 | diff --git a/stdeb/util.py b/stdeb/util.py
index <HASH>..<HASH> 100644
--- a/stdeb/util.py
+++ b/stdeb/util.py
@@ -197,10 +197,10 @@ def get_deb_depends_from_setuptools_requires(requirements):
gooddebs |= (debs)
else:
log.info("I found Debian packages \"%s\" which provides "
- "Python package \"%s\", version \"%s\", which "
+ "Python package \"%s\" which "
"does not satisfy our version requirements: "
"\"%s\" -- ignoring."
- % (', '.join(debs), req.project_name, ver, req))
+ % (', '.join(debs), req.project_name, req))
if not gooddebs:
log.warn("I found no Debian package which provides the required "
"Python package \"%s\" with version requirements " | fix a crash with an undefined variable 'ver' (from Brett) | astraw_stdeb | train | py |
97b3110549e3e68a5519cff294929d149bdbff2c | diff --git a/test/test.js b/test/test.js
index <HASH>..<HASH> 100644
--- a/test/test.js
+++ b/test/test.js
@@ -517,6 +517,7 @@ testCM("scrollSnap", function(cm) {
});
testCM("scrollIntoView", function(cm) {
+ if (phantom) return;
var outer = cm.getWrapperElement().getBoundingClientRect();
function test(line, ch) {
var pos = Pos(line, ch); | Another test that fails mysteriously on Travis' Phantom
(but not on my local one, or in a real browser) | codemirror_CodeMirror | train | js |
293fc401de533136808bb6cce813caa8cc481f32 | diff --git a/packages/lib/PubSub.js b/packages/lib/PubSub.js
index <HASH>..<HASH> 100644
--- a/packages/lib/PubSub.js
+++ b/packages/lib/PubSub.js
@@ -8,7 +8,7 @@ exports = Class(function() {
var anyArgs = [signal].concat(args),
subs = this._subscribers.__any.slice(0);
for(var i = 0, sub; sub = subs[i]; ++i) {
- sub.apply(ctx, args);
+ sub.apply(ctx, anyArgs);
}
} | fix publish on __any signal to pass the signal name as the first argument | gameclosure_js.io | train | js |
bb49ad3f615b68b9f48874b7e51364922335ad2a | diff --git a/ezp/Content/FieldType/Image/AliasCollection.php b/ezp/Content/FieldType/Image/AliasCollection.php
index <HASH>..<HASH> 100644
--- a/ezp/Content/FieldType/Image/AliasCollection.php
+++ b/ezp/Content/FieldType/Image/AliasCollection.php
@@ -130,6 +130,7 @@ class AliasCollection extends TypeCollection
{
$alias = $this->imageManager->createOriginalAlias( $imageInfo, $originalImageInfo->getBasename() );
$alias->alternativeText = $this->imageValue->alternativeText;
+ $this->imageValue->originalFilename = $originalImageInfo->getBasename();
$this->exchangeArray( array( 'original' => $alias ) );
} | FieldType\Image\ImageCollection : original file name wasn't updated | ezsystems_ezpublish-kernel | train | php |
035a6258f6fac0d95b4eee4237129719c76ab8f5 | diff --git a/lib/memcached/memcached.rb b/lib/memcached/memcached.rb
index <HASH>..<HASH> 100644
--- a/lib/memcached/memcached.rb
+++ b/lib/memcached/memcached.rb
@@ -1,4 +1,3 @@
-
=begin rdoc
The Memcached client class.
=end
@@ -44,6 +43,7 @@ class Memcached
Memcached::Failure,
Memcached::MemoryAllocationFailure,
Memcached::ReadFailure,
+ Memcached::ServerEnd,
Memcached::ServerError,
Memcached::SystemError,
Memcached::UnknownReadFailure, | Added Memcached::ServerEnd to the list of exceptions to retry | arthurnn_memcached | train | rb |
e6ed39e6f9690cbc75ed721d902da10721c6fd1f | diff --git a/index.js b/index.js
index <HASH>..<HASH> 100644
--- a/index.js
+++ b/index.js
@@ -168,6 +168,8 @@ Linter.prototype.parseOpts = function (opts) {
configFile.parser = packageOpts.parser
var tmpFilename = path.join(os.tmpdir(), '.eslintrc-' + packageOpts.parser)
fs.writeFileSync(tmpFilename, JSON.stringify(configFile))
+
+ opts._config = opts._config || {} // default _config property if not present
opts._config.configFile = tmpFilename
}
} | Forgive not having _config property on opts | standard_standard-engine | train | js |
1dde0fc35a4e7a9bb1c7d99bfc184fc8396d7f29 | diff --git a/aeron-driver/src/main/java/io/aeron/driver/MediaDriver.java b/aeron-driver/src/main/java/io/aeron/driver/MediaDriver.java
index <HASH>..<HASH> 100644
--- a/aeron-driver/src/main/java/io/aeron/driver/MediaDriver.java
+++ b/aeron-driver/src/main/java/io/aeron/driver/MediaDriver.java
@@ -1937,13 +1937,18 @@ public final class MediaDriver implements AutoCloseable
countersValuesBuffer(createCountersValuesBuffer(cncByteBuffer, cncMetaDataBuffer));
}
- EpochClock counterEpochClock = () -> 0;
- long freeToReuseTimeoutMs = 0;
+ final EpochClock counterEpochClock;
+ final long freeToReuseTimeoutMs;
if (counterFreeToReuseTimeoutNs > 0)
{
counterEpochClock = epochClock;
freeToReuseTimeoutMs = Math.min(TimeUnit.NANOSECONDS.toMillis(counterFreeToReuseTimeoutNs), 1);
}
+ else
+ {
+ counterEpochClock = () -> 0;
+ freeToReuseTimeoutMs = 0;
+ }
final UnsafeBuffer metaDataBuffer = countersMetaDataBuffer();
final UnsafeBuffer valuesBuffer = countersValuesBuffer(); | [Java] Avoid allocating lambda unless required. | real-logic_aeron | train | java |
8eea3ff78f01c2c728d6f5e97137d72da1b47054 | diff --git a/lib/pass.js b/lib/pass.js
index <HASH>..<HASH> 100644
--- a/lib/pass.js
+++ b/lib/pass.js
@@ -32,8 +32,8 @@ var REQUIRED_IMAGES = [ "icon", "logo" ];
// Create a new pass.
//
-// tempplate - The template
-// fields - Pass fields (description, serialNumber, logoText)
+// template - The template
+// fields - Pass fields (description, serialNumber, logoText)
function Pass(template, fields, images) {
this.template = template;
this.fields = cloneObject(fields); | fixed a typo in pass.js | assaf_node-passbook | train | js |
10650bbafe36d7eadc8bcfe7edca3f983dd7ff54 | diff --git a/tests/framework/validators/DateValidatorTest.php b/tests/framework/validators/DateValidatorTest.php
index <HASH>..<HASH> 100644
--- a/tests/framework/validators/DateValidatorTest.php
+++ b/tests/framework/validators/DateValidatorTest.php
@@ -303,6 +303,7 @@ class DateValidatorTest extends TestCase
// prepare data for specific ICU version, see https://github.com/yiisoft/yii2/issues/15140
switch (true) {
case (version_compare(INTL_ICU_VERSION, '57.1', '>=')):
+ case (INTL_ICU_VERSION === '55.1'):
$enGB_dateTime_valid = '31/05/2017, 12:30';
$enGB_dateTime_invalid = '05/31/2017, 12:30';
$deDE_dateTime_valid = '31.05.2017, 12:30'; | Fixed INTL version tests adaptation
Checked on my Ubuntu <I> LTS | yiisoft_yii-core | train | php |
8b4fc88b697502f7697abbea7f5dcceed3cd5b78 | diff --git a/Joomla/Sniffs/Classes/InstantiateNewClassesSniff.php b/Joomla/Sniffs/Classes/InstantiateNewClassesSniff.php
index <HASH>..<HASH> 100644
--- a/Joomla/Sniffs/Classes/InstantiateNewClassesSniff.php
+++ b/Joomla/Sniffs/Classes/InstantiateNewClassesSniff.php
@@ -14,6 +14,14 @@
*/
class Joomla_Sniffs_Classes_InstantiateNewClassesSniff implements PHP_CodeSniffer_Sniff
{
+ /**
+ * If true, short Array Syntax for php 5.4+ will be allow for Instantiating New Classes if they are found in the code.
+ * this should be removed when all Joomla projects no longer need to support php 5.3
+ *
+ * @var boolean
+ */
+ public shortArraySyntax = false;
+
/**
* Registers the token types that this sniff wishes to listen to.
*
@@ -90,6 +98,17 @@ class Joomla_Sniffs_Classes_InstantiateNewClassesSniff implements PHP_CodeSniffe
case T_WHITESPACE :
break;
+
+ case T_OPEN_SHORT_ARRAY :
+ if (shortArraySyntax === true)
+ {
+ if ($started === true)
+ {
+ $valid = true;
+ $running = false;
+ }
+ }
+ break;
}
$cnt++; | add conditionally controlled support for Short Array Syntax
Provides a method to allow Short Array Syntax for select projects that don't support php <I>
This change should be removed when all Joomla projects no longer need to support php <I> and the token `T_OPEN_SHORT_ARRAY` should be incorporated with the standard `T_ARRAY` case | joomla_coding-standards | train | php |
2b629c6f84b71554840d6e3b7e8fa0e84cad45c2 | diff --git a/includes/object-cache.php b/includes/object-cache.php
index <HASH>..<HASH> 100644
--- a/includes/object-cache.php
+++ b/includes/object-cache.php
@@ -627,15 +627,19 @@ class WP_Object_Cache {
if ( defined( 'WP_REDIS_SHARDS' ) ) {
$servers = WP_REDIS_SHARDS;
+ $parameters['shards'] = $servers;
} elseif ( defined( 'WP_REDIS_SENTINEL' ) ) {
$servers = WP_REDIS_SERVERS;
+ $parameters['servers'] = $servers;
$options['replication'] = 'sentinel';
$options['service'] = WP_REDIS_SENTINEL;
} elseif ( defined( 'WP_REDIS_SERVERS' ) ) {
$servers = WP_REDIS_SERVERS;
+ $parameters['servers'] = $servers;
$options['replication'] = true;
} elseif ( defined( 'WP_REDIS_CLUSTER' ) ) {
$servers = WP_REDIS_CLUSTER;
+ $parameters['cluster'] = $servers;
$options['cluster'] = 'redis';
} | add servers to diagnostics for settings display | tillkruss_redis-cache | train | php |
c50b9cfb237ad7490dc0cc5aaf1281a600507fc9 | diff --git a/dev/com.ibm.ws.logging.json_fat/fat/src/com/ibm/ws/logging/json/fat/JsonConfigTest.java b/dev/com.ibm.ws.logging.json_fat/fat/src/com/ibm/ws/logging/json/fat/JsonConfigTest.java
index <HASH>..<HASH> 100644
--- a/dev/com.ibm.ws.logging.json_fat/fat/src/com/ibm/ws/logging/json/fat/JsonConfigTest.java
+++ b/dev/com.ibm.ws.logging.json_fat/fat/src/com/ibm/ws/logging/json/fat/JsonConfigTest.java
@@ -323,7 +323,6 @@ public class JsonConfigTest {
}
private void runApplication(RemoteFile consoleLogFile) throws Exception {
- server.setMarkToEndOfLog();
server.setMarkToEndOfLog(consoleLogFile);
TestUtils.runApp(server, "logServlet");
} | remote setMarkToEndOfLog in runApp | OpenLiberty_open-liberty | train | java |
a8abd53a3262c5374369da6d5123cbdf9ab0c1d2 | diff --git a/enrol/lti/lib.php b/enrol/lti/lib.php
index <HASH>..<HASH> 100644
--- a/enrol/lti/lib.php
+++ b/enrol/lti/lib.php
@@ -174,11 +174,12 @@ class enrol_lti_plugin extends enrol_plugin {
public function unenrol_user(stdClass $instance, $userid) {
global $DB;
- // Get the tool associated with this instance.
- $tool = $DB->get_record('enrol_lti_tools', array('enrolid' => $instance->id), 'id', MUST_EXIST);
-
- // Need to remove the user from the users table.
- $DB->delete_records('enrol_lti_users', array('userid' => $userid, 'toolid' => $tool->id));
+ // Get the tool associated with this instance. Note - it may not exist if we have deleted
+ // the tool. This is fine because we have already cleaned the 'enrol_lti_users' table.
+ if ($tool = $DB->get_record('enrol_lti_tools', array('enrolid' => $instance->id), 'id')) {
+ // Need to remove the user from the users table.
+ $DB->delete_records('enrol_lti_users', array('userid' => $userid, 'toolid' => $tool->id));
+ }
parent::unenrol_user($instance, $userid);
} | MDL-<I> enrol_lti: confirm tool exists before deleting users | moodle_moodle | train | php |
82a0d65dddeebce902a90d6d2fdb74c293e07a66 | diff --git a/source/org/jasig/portal/utils/threading/Worker.java b/source/org/jasig/portal/utils/threading/Worker.java
index <HASH>..<HASH> 100644
--- a/source/org/jasig/portal/utils/threading/Worker.java
+++ b/source/org/jasig/portal/utils/threading/Worker.java
@@ -90,9 +90,7 @@ public final class Worker extends Thread {
*/
public void stopWorker() {
continueWorking = false;
- if ( !this.isInterrupted() )
- this.interrupt();
- pool.destroyThread(this);
+ pool.destroyThread(this);
}
private void cleanState() { | Removed interrupt() - this is called from ThreadPool
git-svn-id: <URL> | Jasig_uPortal | train | java |
4e16753504f5088e3ec0a808bc28a2b51b86879a | diff --git a/src/Nodes/Admin/Grid/Renderer.php b/src/Nodes/Admin/Grid/Renderer.php
index <HASH>..<HASH> 100644
--- a/src/Nodes/Admin/Grid/Renderer.php
+++ b/src/Nodes/Admin/Grid/Renderer.php
@@ -84,6 +84,8 @@ class Renderer
->addAttributes( [ 'type' => 'button' ] )
)->addClass( 'collapser-cell' );
+ $items = $items->sortBy('lft');
+
foreach( $items as $item )
{
$cookie = $this->getNodeCookie( $item->getKey() ); | Fix nodes not being sorted in renderer | arbory_arbory | train | php |
51280ee5fb26e868df7ad7bbe9dd9cba3b35b004 | diff --git a/lib/crtomo/parManager.py b/lib/crtomo/parManager.py
index <HASH>..<HASH> 100644
--- a/lib/crtomo/parManager.py
+++ b/lib/crtomo/parManager.py
@@ -312,8 +312,19 @@ class ParMan(object):
# now determine elements in area
elements_in_area = []
for nr, element in enumerate(grid_polygons):
- if polygon.intersects(element):
+ if polygon.contains(element):
elements_in_area.append(nr)
+ elif polygon.equals(element):
+ elements_in_area.append(nr)
+ elif polygon.crosses(element):
+ elements_in_area.append(nr)
+ # only take crossed elements with at least A % overlap
+ # int_area = polygon.intersect(element).area
+ # print('overlap: ',
+ # int_area,
+ # element.area,
+ # element.area / int_area
+ # )
# change the values
pid_clean = self._clean_pid(pid) | fix some potential issues with modifying polygon areas of parameter sets | geophysics-ubonn_crtomo_tools | train | py |
032d5f4dbe307fff4c2f143625682a20f39fac76 | diff --git a/edx_lint/pylint/right_assert_check.py b/edx_lint/pylint/right_assert_check.py
index <HASH>..<HASH> 100644
--- a/edx_lint/pylint/right_assert_check.py
+++ b/edx_lint/pylint/right_assert_check.py
@@ -76,7 +76,7 @@ class AssertChecker(BaseChecker):
"""
Check that various assertTrue/False functions are not misused.
"""
- if not isinstance(node.func, astroid.Attribute):
+ if not isinstance(node.func, astroid.Getattr):
# If it isn't a getattr ignore this. All the assertMethods are attrs of self:
return
diff --git a/test/test_pylint_plugins.py b/test/test_pylint_plugins.py
index <HASH>..<HASH> 100644
--- a/test/test_pylint_plugins.py
+++ b/test/test_pylint_plugins.py
@@ -17,6 +17,7 @@ def load_tests(unused_loader, tests, unused_pattern):
# Load our plugin.
linter.load_plugin_modules(['edx_lint.pylint'])
+ linter.global_set_option('required-attributes', ())
here = os.path.dirname(os.path.abspath(__file__)) | Make things work on py2 again. py<I> is broken now. | edx_edx-lint | train | py,py |
c9ab21f821d800d272ca298524816c6a8c30b2ec | diff --git a/core/server/web/api/app.js b/core/server/web/api/app.js
index <HASH>..<HASH> 100644
--- a/core/server/web/api/app.js
+++ b/core/server/web/api/app.js
@@ -33,7 +33,7 @@ module.exports = function setupApiApp() {
// Error handling for requests to non-existent API versions
apiApp.use(errorHandler.resourceNotFound);
apiApp.use(versionMissmatchHandler(APIVersionCompatibilityServiceInstance));
- apiApp.use(errorHandler.handleJSONResponse(sentry));
+ apiApp.use(errorHandler.handleJSONResponseV2(sentry));
debug('Parent API setup end');
return apiApp; | Fixed inconsistent error response from the API
- we have two JSON error response formats one old, one new (v2)
- we couldn't use the new one everywhere before without changing the response from older versions
- that is totally irrelevant in Ghost <I> as there is only one API version
- therefore we can and should use the new response format everywhere
- eventually we should rename it so it doesn't have v2 in it | TryGhost_Ghost | train | js |
68fc7ee41ddfea766c2e3cd7265793b76aafccd0 | diff --git a/index.js b/index.js
index <HASH>..<HASH> 100644
--- a/index.js
+++ b/index.js
@@ -79,7 +79,7 @@ function getDefaultConfig(mainTemplate, templatesPath) {
// Parse securedBy and use scopes if they are defined
ramlObj.renderSecuredBy = function (securedBy) {
- if (typeof securedBy === 'object'){
+ if (typeof securedBy === 'object') {
var out = "";
for (key in securedBy) {
out += "<b>" + key + "</b>"; | align coding style (again) | raml2html_raml2html | train | js |
5231a7b6591f93b2d9ae30a6d6cf7cc134201c43 | diff --git a/salt/cloud/clouds/vmware.py b/salt/cloud/clouds/vmware.py
index <HASH>..<HASH> 100644
--- a/salt/cloud/clouds/vmware.py
+++ b/salt/cloud/clouds/vmware.py
@@ -437,3 +437,40 @@ def list_nodes_min(kwargs=None, call=None):
ret[vm.name] = True
return ret
+
+
+def list_nodes(kwargs=None, call=None):
+ '''
+ Return a list of the VMs that are on the provider, with basic fields
+
+ .. note::
+
+ The list returned does not include templates.
+
+ CLI Example:
+
+ .. code-block:: bash
+
+ salt-cloud -f list_nodes my-vmware-config
+ '''
+ if call != 'function':
+ log.error(
+ 'The list_nodes function must be called with -f or --function.'
+ )
+ return False
+
+ ret = {}
+ vm_list = _get_vm_list()
+
+ for vm in vm_list:
+ if not vm.summary.config.template:
+ # It is not a template
+ vm_info = {
+ 'id': vm.name,
+ 'ip_address': vm.summary.guest.ipAddress,
+ 'cpus': vm.summary.config.numCpu,
+ 'ram': vm.summary.config.memorySizeMB,
+ }
+ ret[vm_info['id']] = vm_info
+
+ return ret | Adding list_nodes() to be able to display basic information about all vms | saltstack_salt | train | py |
92d19063a843c53537e49a3c74a052287b4792b2 | diff --git a/tests/Symfony/Tests/Component/Translation/Loader/XliffFileLoaderTest.php b/tests/Symfony/Tests/Component/Translation/Loader/XliffFileLoaderTest.php
index <HASH>..<HASH> 100644
--- a/tests/Symfony/Tests/Component/Translation/Loader/XliffFileLoaderTest.php
+++ b/tests/Symfony/Tests/Component/Translation/Loader/XliffFileLoaderTest.php
@@ -28,7 +28,7 @@ class XliffFileLoaderTest extends \PHPUnit_Framework_TestCase
}
/**
- * @expectedException Exception
+ * @expectedException \RuntimeException
*/
public function testLoadInvalidResource()
{
@@ -37,7 +37,7 @@ class XliffFileLoaderTest extends \PHPUnit_Framework_TestCase
}
/**
- * @expectedException Exception
+ * @expectedException \RuntimeException
*/
public function testLoadResourceDoesNotValidate()
{ | [Translation] changed some unit tests for PHPUnit <I> compatibility | symfony_symfony | train | php |
0eb7615c838d6c3623d42a8d20495271d9ece046 | diff --git a/record.go b/record.go
index <HASH>..<HASH> 100644
--- a/record.go
+++ b/record.go
@@ -8,12 +8,12 @@ import (
type Record struct {
Id int `json:"id,omitempty"`
- Content string `json:"content,omitempty"`
+ DomainId int `json:"domain_id,omitempty"`
Name string `json:"name,omitempty"`
+ Content string `json:"content,omitempty"`
TTL int `json:"ttl,omitempty"`
- RecordType string `json:"record_type,omitempty"`
Priority int `json:"prio,omitempty"`
- DomainId int `json:"domain_id,omitempty"`
+ RecordType string `json:"record_type,omitempty"`
CreatedAt string `json:"created_at,omitempty"`
UpdatedAt string `json:"updated_at,omitempty"`
} | Sort the Record fields according to the official serializer | dnsimple_dnsimple-go | train | go |
c2e60e53983b5931643dfda977af8a8cbc69841e | diff --git a/lib/rprogram/option.rb b/lib/rprogram/option.rb
index <HASH>..<HASH> 100644
--- a/lib/rprogram/option.rb
+++ b/lib/rprogram/option.rb
@@ -1,5 +1,3 @@
-require 'rprogram/extensions'
-
module RProgram
class Option | Don't require 'rprogram/extensions' any more. | postmodern_rprogram | train | rb |
Subsets and Splits