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 |
|---|---|---|---|---|---|
b88d743c7adf1b9d0ea022f3a28a494a45a6d15e | diff --git a/src/controls/folder/folder.js b/src/controls/folder/folder.js
index <HASH>..<HASH> 100644
--- a/src/controls/folder/folder.js
+++ b/src/controls/folder/folder.js
@@ -34,7 +34,7 @@ class Folder extends Component {
<label>{ label }</label>
<Chevron style={{marginLeft:'auto'}} />
</div>
- { open ? <div style={{padding:'1em', backgroundColor: 'rgba( 1, 1, 1, 0.05 )', borderRadius:2}}>{ value() }</div> : null }
+ { open ? <div style={{padding:'1em', backgroundColor: 'rgba( 1, 1, 1, 0.04 )', borderRadius:2}}>{ value() }</div> : null }
</div>
} | Changed background opacity of folder | wearekuva_oui | train | js |
348c9c88ce1002d6f9b5651d6f2f6717ae3bb847 | diff --git a/vendor/plugins/authentication/app/models/user.rb b/vendor/plugins/authentication/app/models/user.rb
index <HASH>..<HASH> 100644
--- a/vendor/plugins/authentication/app/models/user.rb
+++ b/vendor/plugins/authentication/app/models/user.rb
@@ -55,17 +55,4 @@ class User < ActiveRecord::Base
!other_user.superuser and User.count > 1 and (other_user.nil? or self.id != other_user.id)
end
-protected
-
- # before filter
- def encrypt_password
- return if password.blank?
- self.password_salt = Digest::SHA1.hexdigest("--#{Time.now.to_s}--#{login}--") if new_record?
- self.crypted_password = encrypt(password)
- end
-
- def password_required?
- crypted_password.blank? || !password.blank?
- end
-
end | doesn't seem like we use these methods anywhere and password encryption works without them. | refinery_refinerycms | train | rb |
4b65973bf27d55624a1d7dcdb399112447b5c2c1 | diff --git a/make/build.js b/make/build.js
index <HASH>..<HASH> 100644
--- a/make/build.js
+++ b/make/build.js
@@ -102,7 +102,7 @@ class Builder {
// Generate UMD AST
resultAst = clone(this._toAst("UMD"));
// Grab the final placeholder
- this._placeholder = resultAst.body[0].expression[ARGUMENTS][1].body.body;
+ this._placeholder = resultAst.body[0].expression[ARGUMENTS][0].body.body;
this._placeholder.pop(); // remove __gpf__
// Generate all ASTs and aggregate to the final result
this._addAst("boot"); | Fix after changing UMD.js (#<I>) | ArnaudBuchholz_gpf-js | train | js |
23ea8b6bd4d4a4a62a6473322a5d826c26225b18 | diff --git a/lib/lovely_rufus/layers/email_quote_stripper.rb b/lib/lovely_rufus/layers/email_quote_stripper.rb
index <HASH>..<HASH> 100644
--- a/lib/lovely_rufus/layers/email_quote_stripper.rb
+++ b/lib/lovely_rufus/layers/email_quote_stripper.rb
@@ -7,6 +7,7 @@ module LovelyRufus
private
+ # :reek:UnusedPrivateMethod
def fixed_quote
quote.size > 0 ? quote.delete(' ') + ' ' : ''
end | a surprisingly futile attempt to ignore a smell | chastell_lovely_rufus | train | rb |
b57ca10fc62a6db8e2a1d8fdb7cc1d473c8ce5f2 | diff --git a/test/errors_test.rb b/test/errors_test.rb
index <HASH>..<HASH> 100644
--- a/test/errors_test.rb
+++ b/test/errors_test.rb
@@ -4,6 +4,9 @@ class ErrorsTest < Rugged::TestCase
def test_rugged_error_classes_exist
error_classes = [
+ Rugged::NoMemError,
+ Rugged::OSError,
+ Rugged::InvalidError,
Rugged::Error,
Rugged::ReferenceError,
Rugged::ZlibError,
@@ -19,8 +22,12 @@ class ErrorsTest < Rugged::TestCase
Rugged::IndexerError
]
- error_classes.each do |err|
- assert_equal err.class, Class
+ # All should descend from StandardError (correctly), except
+ # Rugged::NoMemError which descends from Ruby's built-in NoMemoryError,
+ # which descends from Exception
+ error_classes.each do |klass|
+ err = klass.new
+ assert err.is_a?(StandardError) || err.is_a?(Exception)
end
end
end | A more expression version of the errors test | libgit2_rugged | train | rb |
b9776438dc0926b89d8282eb1e999daaa9d41d1a | diff --git a/lib/jets/commands/delete.rb b/lib/jets/commands/delete.rb
index <HASH>..<HASH> 100644
--- a/lib/jets/commands/delete.rb
+++ b/lib/jets/commands/delete.rb
@@ -38,7 +38,8 @@ class Jets::Commands::Delete
end
def delete_logs
- log = Jets::Commands::Commands.Log.new(mute: true, sure: true)
+ puts "Deleting CloudWatch logs"
+ log = Jets::Commands::Clean::Log.new(mute: true, sure: true)
log.clean
end | fix delete cloudwatch logs on jets delete | tongueroo_jets | train | rb |
8089a8e3121a167c275cb0e2554680ca85cc245e | diff --git a/client/src/views/autocomplete.js b/client/src/views/autocomplete.js
index <HASH>..<HASH> 100644
--- a/client/src/views/autocomplete.js
+++ b/client/src/views/autocomplete.js
@@ -315,7 +315,11 @@ var AutoComplete = Backbone.View.extend({
if (this.matches[this.selected_idx]) {
this.trigger('match', this.currentMatch(), this.matches[this.selected_idx]);
event.preventDefault();
- dont_process_other_input_keys = true;
+
+ // If the UI is not open, let the return key keep processing as normal.
+ // If we did not let this happen, since there is no visual UI it would look
+ // weird to the user if they had to press return twice for something to happen.
+ dont_process_other_input_keys = this._show_ui ? true : false;
}
}
else if (event.keyCode === 27) { // escape | Pressing return twice fix if autocomplete UI is not open | prawnsalad_KiwiIRC | train | js |
3ce192870409496d18b8815de543f46fd68ad399 | diff --git a/node_examples/getReadableContent.js b/node_examples/getReadableContent.js
index <HASH>..<HASH> 100644
--- a/node_examples/getReadableContent.js
+++ b/node_examples/getReadableContent.js
@@ -1,5 +1,5 @@
var sax = require("sax"),
- readability = require("../readabilitysax"),
+ readability = require("../readabilitySAX"),
url = require("url");
exports.get = function(uri, cb){
diff --git a/node_examples/readabilityAPI.js b/node_examples/readabilityAPI.js
index <HASH>..<HASH> 100644
--- a/node_examples/readabilityAPI.js
+++ b/node_examples/readabilityAPI.js
@@ -1,4 +1,4 @@
-var readability = require('./getreadablecontent'),
+var readability = require("./getReadableContent.js"),
url = require("url"),
http = require("http");
@@ -8,4 +8,4 @@ http.createServer(function(request, response){
response.writeHead(200, {"content-type":"application/json"});
response.end(JSON.stringify(ret));
});
-}).listen(80);
\ No newline at end of file
+}).listen(process.argv.length > 2 ? process.argv[2] : 80);
\ No newline at end of file | Fixed paths for case sensitive filesystems | fb55_readabilitySAX | train | js,js |
6ec4809c14a3050a4a07e9feaa1eb9c38804b4a6 | diff --git a/cumulusci/cli/service.py b/cumulusci/cli/service.py
index <HASH>..<HASH> 100644
--- a/cumulusci/cli/service.py
+++ b/cumulusci/cli/service.py
@@ -97,7 +97,7 @@ class ConnectServiceCommand(click.MultiCommand):
click.Option(
("--default",),
is_flag=True,
- help="Set this service as the global defualt.",
+ help="Set this service as the global default.",
)
)
if runtime.project_config is not None: | [CCI] Fixing service connect help typo | SFDO-Tooling_CumulusCI | train | py |
a44abccd32c39d1c8e249fdbea2f4c98e114fab6 | diff --git a/tilelive.js b/tilelive.js
index <HASH>..<HASH> 100644
--- a/tilelive.js
+++ b/tilelive.js
@@ -1,7 +1,7 @@
require.paths.unshift(__dirname + '/modules',
__dirname + '/lib/node', __dirname);
-var mapnik = require('./modules/mapnik.node');
+var mapnik = require('mapnik');
mapnik.register_datasources('/usr/local/lib/mapnik2/input');
mapnik.register_fonts('/usr/local/lib/mapnik2/fonts/');
diff --git a/tl/sphericalmercator.js b/tl/sphericalmercator.js
index <HASH>..<HASH> 100644
--- a/tl/sphericalmercator.js
+++ b/tl/sphericalmercator.js
@@ -1,4 +1,4 @@
-var mapnik = require('../modules/mapnik.node');
+var mapnik = require('mapnik');
var mercator = new mapnik.Projection('+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs +over'); | Change how mapnik module is required. | mapbox_tilelive | train | js,js |
95780286faeec12132be33d6c949090648c425e4 | diff --git a/app/controllers/roboto/robots_controller.rb b/app/controllers/roboto/robots_controller.rb
index <HASH>..<HASH> 100644
--- a/app/controllers/roboto/robots_controller.rb
+++ b/app/controllers/roboto/robots_controller.rb
@@ -1,7 +1,7 @@
module Roboto
class RobotsController < Roboto::ApplicationController
def show
- render :text => robot_contents,
+ render :plain => robot_contents,
:layout => false,
:content_type => 'text/plain'
end | fix DEPRECATION WARNING: `render :text` is deprecated because it does not actually render a `text/plain` response. | LaunchAcademy_roboto | train | rb |
b2c76577afb64069c207cfd188acc7ecaf36a9d8 | diff --git a/Extension/UserExtension.php b/Extension/UserExtension.php
index <HASH>..<HASH> 100644
--- a/Extension/UserExtension.php
+++ b/Extension/UserExtension.php
@@ -24,7 +24,7 @@ class UserExtension extends \Twig_Extension
$user = $this->userManager->getUserById($user);
}
- return $user->isGranted($role);
+ return $user->hasRole($role);
}
public function getName() | can't use isGranted on user | hackzilla_ticket-message | train | php |
16ac9439814463a49066baf9b93d59882219332b | diff --git a/test/index.js b/test/index.js
index <HASH>..<HASH> 100644
--- a/test/index.js
+++ b/test/index.js
@@ -1,9 +1,25 @@
var assert = require('assert')
+var fs = require('fs')
var db = require('..')
describe('mime-db', function () {
+ it('should not contain types not in src/', function () {
+ var path = __dirname + '/../src'
+ var types = []
+
+ // collect all source types
+ fs.readdirSync(path).forEach(function (file) {
+ if (!/^\w+\.json$/.test(file)) return
+ types.push.apply(types, Object.keys(require(path + '/' + file)))
+ })
+
+ Object.keys(db).forEach(function (name) {
+ assert.ok(types.indexOf(name) !== -1, 'type "' + name + '" should be in src/')
+ })
+ })
+
it('should all be mime types', function () {
assert(Object.keys(db).every(function (name) {
return ~name.indexOf('/') || console.log(name) | tests: add test for all types to be in src/ | jshttp_mime-db | train | js |
bdbbfd98748c6f5074d50998dbcb0a853bcdbeeb | diff --git a/lib/eztemplate/classes/eztemplatecompiler.php b/lib/eztemplate/classes/eztemplatecompiler.php
index <HASH>..<HASH> 100644
--- a/lib/eztemplate/classes/eztemplatecompiler.php
+++ b/lib/eztemplate/classes/eztemplatecompiler.php
@@ -463,7 +463,8 @@ class eZTemplateCompiler
// have enough time to compile
// However if time limit is unlimited (0) we leave it be
// Time limit will also be reset after subtemplates are compiled
- if ( ini_get( 'max_execution_time' ) != 0 )
+ $maxExecutionTime = ini_get( 'max_execution_time' );
+ if ( $maxExecutionTime != 0 && $maxExecutionTime < 30 )
{
@set_time_limit( 30 );
}
@@ -2288,7 +2289,8 @@ $rbracket
* ensure that remaining template has
* enough time to compile. However if time
* limit is unlimited (0) we leave it be */
- if ( ini_get( 'max_execution_time' ) != 0 )
+ $maxExecutionTime = ini_get( 'max_execution_time' );
+ if ( $maxExecutionTime != 0 && $maxExecutionTime < 60 )
{
@set_time_limit( 60 );
} | eZTemplateCompiler:
- Make sure we only set the execution time if it's less then we want it to be.
git-svn-id: file:///home/patrick.allaert/svn-git/ezp-repo/ezpublish/trunk@<I> a<I>eee8c-daba-<I>-acae-fa<I>f<I> | ezsystems_ezpublish-legacy | train | php |
01d9958a8164b08d808f76fc79f77a58ffe309bc | diff --git a/src/components/networked-share.js b/src/components/networked-share.js
index <HASH>..<HASH> 100644
--- a/src/components/networked-share.js
+++ b/src/components/networked-share.js
@@ -644,7 +644,7 @@ AFRAME.registerComponent('networked-share', {
this.removeOwnership();
var data = { networkId: this.networkId };
- naf.connection.broadcastData('r', data);
+ naf.connection.broadcastDataGuaranteed('r', data);
this.unbindOwnershipEvents();
this.unbindOwnerEvents(); | use broadcastDataGuaranteed within remove() | networked-aframe_networked-aframe | train | js |
b6757391c09c3271f708f87d0b29ca4c040b0f46 | diff --git a/lib/pusher/webhook.rb b/lib/pusher/webhook.rb
index <HASH>..<HASH> 100644
--- a/lib/pusher/webhook.rb
+++ b/lib/pusher/webhook.rb
@@ -4,7 +4,7 @@ require 'hmac-sha2'
module Pusher
# Used to parse and authenticate WebHooks
#
- # @example
+ # @example Sinatra
# post '/webhooks' do
# webhook = Pusher::WebHook.new(request)
# if webhook.valid?
@@ -48,9 +48,7 @@ module Pusher
# matches the configured key & secret. In the case that the webhook is
# invalid, the reason is logged
#
- # @param extra_tokens [Hash] If you have extra tokens for your Pusher
- # app, you can specify them here so that they're used to attempt
- # validation.
+ # @param extra_tokens [Hash] If you have extra tokens for your Pusher app, you can specify them so that they're used to attempt validation.
#
def valid?(extra_tokens = nil)
extra_tokens = [extra_tokens] if extra_tokens.kind_of?(Hash) | Tweak WebHook rdoc
* rdoc.info likes long lines... | pusher_pusher-http-ruby | train | rb |
113374e9432a7582ee8bfc906488c0363478a105 | diff --git a/merb-core/lib/merb-core/controller/mixins/responder.rb b/merb-core/lib/merb-core/controller/mixins/responder.rb
index <HASH>..<HASH> 100644
--- a/merb-core/lib/merb-core/controller/mixins/responder.rb
+++ b/merb-core/lib/merb-core/controller/mixins/responder.rb
@@ -297,7 +297,7 @@ module Merb
#
# :api: private
def _perform_content_negotiation
- if fmt = params[:format]
+ if fmt = params[:format] and !fmt.blank?
accepts = [fmt.to_sym]
else
accepts = _accept_types | [merb-core] Content negotiation handles blank formats like nil
Fixes specs to support the "get/post/put/delete"
test helpers properly. | wycats_merb | train | rb |
bcb0c09ab18a84dceab3e9a09eef6ad39fe066ed | diff --git a/src/main/groovy/org/codehaus/gant/GantBuilder.java b/src/main/groovy/org/codehaus/gant/GantBuilder.java
index <HASH>..<HASH> 100644
--- a/src/main/groovy/org/codehaus/gant/GantBuilder.java
+++ b/src/main/groovy/org/codehaus/gant/GantBuilder.java
@@ -99,7 +99,7 @@ public class GantBuilder extends AntBuilder {
@SuppressWarnings ( "unchecked" )
public BuildLogger getLogger ( ) {
final List<? extends BuildListener> listeners = getProject ( ).getBuildListeners ( ) ; // Unchecked conversion here.
- assert listeners.size ( ) == 1 ;
+ assert listeners.size ( ) > 0 ;
return (BuildLogger) listeners.get ( 0 ) ;
}
} | Trying a GMaven build shows that the original assertion was too restrictive.
git-svn-id: <URL> | Gant_Gant | train | java |
0a45c748ae9f1868d12bfd2aa17e31285adfa6f4 | diff --git a/packages/devtools-components/src/tree.js b/packages/devtools-components/src/tree.js
index <HASH>..<HASH> 100644
--- a/packages/devtools-components/src/tree.js
+++ b/packages/devtools-components/src/tree.js
@@ -786,6 +786,10 @@ class Tree extends Component {
onExpand: this._onExpand,
onCollapse: this._onCollapse,
onClick: e => {
+ // We can stop the propagation since click handler on the node can be
+ // created in `renderItem`.
+ e.stopPropagation();
+
// Since the user just clicked the node, there's no need to check if
// it should be scrolled into view.
this._focus(item, { preventAutoScroll: true }); | Stop the propagation on tree node click. (#<I>)
Not having it was causing issue in the console ([Bug <I>](<URL>)),
and I think it's safe to stop the propagation since click events are handled
through renderItem result. | firefox-devtools_debugger | train | js |
be6d60ce444b0f34b16a29a8ba8188cb85117f2c | diff --git a/annis-widgets/src/main/java/annis/gui/components/medialement/MediaElementPlayer.java b/annis-widgets/src/main/java/annis/gui/components/medialement/MediaElementPlayer.java
index <HASH>..<HASH> 100644
--- a/annis-widgets/src/main/java/annis/gui/components/medialement/MediaElementPlayer.java
+++ b/annis-widgets/src/main/java/annis/gui/components/medialement/MediaElementPlayer.java
@@ -100,12 +100,19 @@ public class MediaElementPlayer extends AbstractJavaScriptComponent
@Override
public void play(double start)
{
+ // we get the time in seconds with fractions but the HTML5 players
+ // only have a resolution of seconds
+ start = Math.floor(start);
callFunction("play", start);
}
@Override
public void play(double start, double end)
{
+ // we get the time in seconds with fractions but the HTML5 players
+ // only have a resolution of seconds
+ start = Math.floor(start);
+ end = Math.ceil(end);
callFunction("playRange", start, end);
} | don't miss play range due to bad rounding | korpling_ANNIS | train | java |
a3a55339abf133e8073a5c4220e7d61749b5f16f | diff --git a/dvc/version.py b/dvc/version.py
index <HASH>..<HASH> 100644
--- a/dvc/version.py
+++ b/dvc/version.py
@@ -6,7 +6,7 @@
import os
import subprocess
-_BASE_VERSION = "2.0.9"
+_BASE_VERSION = "2.0.10"
def _generate_version(base_version): | dvc: bump to <I> | iterative_dvc | train | py |
cda546e44052e7e4a5626df367dc326a4998a005 | diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -30,8 +30,11 @@ setup(
author='Evan Gray',
author_email='hello@evanscottgray.com',
description='stream from papertrail into slack.',
+ long_description=open('README.rst').read(),
install_requires=install_requires,
packages=find_packages(),
+ classifiers=['Development Status :: 4 - Beta',
+ 'License :: OSI Approved :: Apache Software License'],
license='Apache Software License',
url='https://github.com/evanscottgray/paperslacktail',
entry_points={ | update setup.py to have classifiers and readme reader thingy | evanscottgray_paperslacktail | train | py |
e5f9429da4ab8d3c399cbd653ab2cdef9f51f04d | diff --git a/src/mal.js b/src/mal.js
index <HASH>..<HASH> 100644
--- a/src/mal.js
+++ b/src/mal.js
@@ -30,7 +30,7 @@ MyAnimeList.getUserList = function (username, type = "anime") {
if (resp.statusCode < 200 || resp.statusCode > 299) { /* Status Code errors */
return reject(resp.statusCode);
}
- parseString(body, function (err, result) {
+ parseString(body, {explicitArray: false}, function (err, result) {
resolve(result["myanimelist"][type] || []);
});
});
@@ -68,7 +68,7 @@ MyAnimeList.prototype.search = function (name, type = "anime") {
if (resp.statusCode < 200 || resp.statusCode > 299) { /* Status Code errors */
return reject(resp.statusCode);
}
- parseString(body, function (err, result) {
+ parseString(body, {explicitArray: false}, function (err, result) {
resolve(result["anime"]["entry"]);
});
}); | set explicitArray to false to clean up the return | lap00zza_MyAnimeList.js | train | js |
c9a161e31ec23eb024e2fe2b94f4e571761ffc6e | diff --git a/lib/go/blobserver/localdisk/localdisk.go b/lib/go/blobserver/localdisk/localdisk.go
index <HASH>..<HASH> 100644
--- a/lib/go/blobserver/localdisk/localdisk.go
+++ b/lib/go/blobserver/localdisk/localdisk.go
@@ -247,7 +247,9 @@ func (ds *diskStorage) ReceiveBlob(blobRef *blobref.BlobRef, source io.Reader, m
if err != nil {
return
}
- // TODO: fsync before close.
+ if err = tempFile.Sync(); err != nil {
+ return
+ }
if err = tempFile.Close(); err != nil {
return
} | Go has fsync now. | perkeep_perkeep | train | go |
4b4238b84789dfaef1d1b284d67f4c65ba643fdd | diff --git a/modeltranslation/tests/settings.py b/modeltranslation/tests/settings.py
index <HASH>..<HASH> 100644
--- a/modeltranslation/tests/settings.py
+++ b/modeltranslation/tests/settings.py
@@ -39,5 +39,3 @@ SITE_ID = 1
LANGUAGES = (('de', 'Deutsch'),
('en', 'English'))
DEFAULT_LANGUAGE = 'de'
-
-MODELTRANSLATION_TRANSLATION_REGISTRY = 'modeltranslation.tests' | Removed deprecated MODELTRANSLATION_TRANSLATION_REGISTRY setting from test settings. | deschler_django-modeltranslation | train | py |
c3e2398bd235e5cd335d0eeea7813c6d41b01f72 | diff --git a/spec/tools.rb b/spec/tools.rb
index <HASH>..<HASH> 100644
--- a/spec/tools.rb
+++ b/spec/tools.rb
@@ -43,12 +43,6 @@ module DeepCover
::Coverage.result.fetch(fn)
end
- def branch_coverage(fn)
- DeepCover.start
- with_warnings(nil) { DeepCover.require fn }
- DeepCover.branch_coverage(fn)
- end
-
def our_coverage(fn)
DeepCover.start
with_warnings(nil) { DeepCover.require fn } | Remove Tools.branch_coverage
It relies on things that don't exist anymore | deep-cover_deep-cover | train | rb |
877afbcf187b0a05cd818c83dd98ba286510e72a | diff --git a/lib/bento_search/util.rb b/lib/bento_search/util.rb
index <HASH>..<HASH> 100644
--- a/lib/bento_search/util.rb
+++ b/lib/bento_search/util.rb
@@ -97,6 +97,8 @@ module BentoSearch::Util
# Get back a Nokogiri node, call #inner_html on it to go back to a string
# (and you probably want to call .html_safe on the string you get back for use
# in rails view)
+ #
+ # (In future consider using this gem instead of doing it ourselves? https://github.com/nono/HTML-Truncator )
def self.nokogiri_truncate(node, max_length, omission = '…', seperator = nil)
if node.kind_of?(::Nokogiri::XML::Text) | comment for future third-party html truncator | jrochkind_bento_search | train | rb |
444a47981ab7575bc0fbce5e78c7c0dca7b703a0 | diff --git a/lib/right_http_connection.rb b/lib/right_http_connection.rb
index <HASH>..<HASH> 100644
--- a/lib/right_http_connection.rb
+++ b/lib/right_http_connection.rb
@@ -232,11 +232,21 @@ them.
# try to connect server(if connection does not exist) and get response data
begin
# (re)open connection to server if none exists
+ # TODO TRB 8/2/07 - you also need to get a new connection if the
+ # server, port, or proto has changed in the request_params
start(request_params) unless @http
# get response and return it
request = request_params[:request]
request['User-Agent'] = get_param(:user_agent) || ''
+
+ # Detect if the body is a streamable object like a file or socket. If so, stream that
+ # bad boy.
+ if(request.body && request.body.respond_to?(:read))
+ body = request.body
+ request.content_length = body.respond_to?(:lstat) ? body.lstat.size : body.size
+ request.body_stream = request.body
+ end
response = @http.request(request)
error_reset | (#<I>) Stream uploads (PUTs) if the source is a file, stream, or anything
read()-able
git-svn-id: <URL> | rightscale_right_http_connection | train | rb |
f8b6bb9912321031834400bf37e7649fa743b62c | diff --git a/src/main/java/com/opentable/db/postgres/embedded/EmbeddedPostgres.java b/src/main/java/com/opentable/db/postgres/embedded/EmbeddedPostgres.java
index <HASH>..<HASH> 100644
--- a/src/main/java/com/opentable/db/postgres/embedded/EmbeddedPostgres.java
+++ b/src/main/java/com/opentable/db/postgres/embedded/EmbeddedPostgres.java
@@ -448,7 +448,16 @@ public class EmbeddedPostgres implements Closeable
*/
private static String getOS()
{
- return SystemUtils.IS_OS_WINDOWS ? "Windows" : system("uname", "-s").get(0);
+ if (SystemUtils.IS_OS_WINDOWS) {
+ return "Windows";
+ }
+ if (SystemUtils.IS_OS_MAC_OSX) {
+ return "Darwin";
+ }
+ if (SystemUtils.IS_OS_LINUX) {
+ return "Linux";
+ }
+ throw new UnsupportedOperationException("Unknown OS " + SystemUtils.OS_NAME);
}
/** | Operating system detection: remove system() call | opentable_otj-pg-embedded | train | java |
459b312eb7bfadf5575a8d05e9c9583830a89995 | diff --git a/lib/spinach/runner/scenario_runner.rb b/lib/spinach/runner/scenario_runner.rb
index <HASH>..<HASH> 100644
--- a/lib/spinach/runner/scenario_runner.rb
+++ b/lib/spinach/runner/scenario_runner.rb
@@ -38,7 +38,8 @@ module Spinach
Spinach.hooks.run_before_step step
unless @exception
begin
- step_location = feature_steps.execute_step(step['name'])
+ step_location = feature_steps.get_step_location(step['name'])
+ feature_steps.execute_step(step['name'])
Spinach.hooks.run_on_successful_step step, step_location
rescue *Spinach.config[:failure_exceptions] => e
@exception = e | Make scenario_runner to get step location before executing it | codegram_spinach | train | rb |
7b82014105a846a3b779cbfaaefdcfeacc16595e | diff --git a/lib/Thelia/Action/Product.php b/lib/Thelia/Action/Product.php
index <HASH>..<HASH> 100644
--- a/lib/Thelia/Action/Product.php
+++ b/lib/Thelia/Action/Product.php
@@ -90,17 +90,14 @@ class Product extends BaseAction implements EventSubscriberInterface
->setTitle($event->getTitle())
->setVisible($event->getVisible() ? 1 : 0)
->setVirtual($event->getVirtual() ? 1 : 0)
-
- // Set the default tax rule to this product
- ->setTaxRule(TaxRuleQuery::create()->findOneByIsDefault(true))
-
->setTemplateId($event->getTemplateId())
->create(
$event->getDefaultCategory(),
$event->getBasePrice(),
$event->getCurrencyId(),
- $event->getTaxRuleId(),
+ // Set the default tax rule if not defined
+ $event->getTaxRuleId() ?: TaxRuleQuery::create()->findOneByIsDefault(true),
$event->getBaseWeight(),
$event->getBaseQuantity()
)
@@ -386,7 +383,7 @@ class Product extends BaseAction implements EventSubscriberInterface
$fileList['documentList']['list'] = ProductDocumentQuery::create()
->findByProductId($event->getProductId());
$fileList['documentList']['type'] = TheliaEvents::DOCUMENT_DELETE;
-
+
// Delete product
$product
->setDispatcher($this->eventDispatcher) | Set default tax rule if it not defined in create product event | thelia_core | train | php |
ac580c867f8973d21cdc5758798a5c9bb02a8031 | diff --git a/lib/lazy_xml_model/collection_proxy.rb b/lib/lazy_xml_model/collection_proxy.rb
index <HASH>..<HASH> 100644
--- a/lib/lazy_xml_model/collection_proxy.rb
+++ b/lib/lazy_xml_model/collection_proxy.rb
@@ -100,18 +100,20 @@ module LazyXmlModel
if item_from_collection.present?
item_from_collection
else
- item = begin
- new_item = klass.new
- new_item.xml_parent_element = xml_parent_element
- new_item.xml_element = element
- new_item
- end
+ item = build_item_for_element(element)
@collection << item
item
end
end
end
+ def build_item_for_element(element)
+ new_item = klass.new
+ new_item.xml_parent_element = xml_parent_element
+ new_item.xml_element = element
+ new_item
+ end
+
def element_name
klass.tag || association_name
end | small refactor of CollectionProxy | evanrolfe_lazy_xml_model | train | rb |
b741fe48f7e614608675c64f6e5a2b252cad6c8d | diff --git a/openstack_dashboard/dashboards/project/snapshots/views.py b/openstack_dashboard/dashboards/project/snapshots/views.py
index <HASH>..<HASH> 100644
--- a/openstack_dashboard/dashboards/project/snapshots/views.py
+++ b/openstack_dashboard/dashboards/project/snapshots/views.py
@@ -47,7 +47,6 @@ class SnapshotsView(tables.DataTableView, tables.PagedTableMixin):
volumes = api.cinder.volume_list(self.request)
volumes = dict((v.id, v) for v in volumes)
except Exception:
- raise
exceptions.handle(self.request, _("Unable to retrieve "
"volume snapshots.")) | Remove unnecessary raise
If exception arise, it will be raised and the following
code will not be executed.
Change-Id: I<I>eef<I>d6baeeeb<I>e<I>e2ab9c5fa2f4e<I>b8a4
Closes-Bug: <I> | openstack_horizon | train | py |
a27767df2007e32eeed77d34189f4d555eb2dae6 | diff --git a/src/Command/SonataListFormMappingCommand.php b/src/Command/SonataListFormMappingCommand.php
index <HASH>..<HASH> 100644
--- a/src/Command/SonataListFormMappingCommand.php
+++ b/src/Command/SonataListFormMappingCommand.php
@@ -29,7 +29,7 @@ class SonataListFormMappingCommand extends ContainerAwareCommand
public function isEnabled()
{
- return Kernel::MAJOR_VERSION !== 3;
+ return Kernel::MAJOR_VERSION < 3;
}
protected function configure() | SonataListFormMappingCommand is enabled on symfony v4
#<I>
SonataListFormMappingCommand is enabled on symfony v4, this commit fix it. | sonata-project_SonataCoreBundle | train | php |
a6b357d88abe55fcd2550ce83682f757599c1d84 | diff --git a/pyphi/network.py b/pyphi/network.py
index <HASH>..<HASH> 100644
--- a/pyphi/network.py
+++ b/pyphi/network.py
@@ -214,7 +214,7 @@ class Network:
def generate_node_indices(self, nodes):
"""Returns the nodes indices for nodes, where ``nodes`` is either
already integer indices or node labels."""
- if len(nodes) == 0:
+ if not nodes:
indices = ()
elif all(isinstance(node, str) for node in nodes):
indices = self.labels2indices(nodes) | Don't use `len` to check for empty sequence | wmayner_pyphi | train | py |
7c72941e2b0b2c388791cff27da3378199f467a1 | diff --git a/draft/polling.go b/draft/polling.go
index <HASH>..<HASH> 100644
--- a/draft/polling.go
+++ b/draft/polling.go
@@ -153,6 +153,10 @@ func (p *Poller) PollAll(timeout time.Duration) ([]Polled, error) {
func (p *Poller) poll(timeout time.Duration, all bool) ([]Polled, error) {
lst := make([]Polled, 0, len(p.items))
+ if len(p.items) == 0 {
+ return lst, nil
+ }
+
var ctx *Context
for _, soc := range p.socks {
if !soc.opened {
diff --git a/polling.go b/polling.go
index <HASH>..<HASH> 100644
--- a/polling.go
+++ b/polling.go
@@ -153,6 +153,10 @@ func (p *Poller) PollAll(timeout time.Duration) ([]Polled, error) {
func (p *Poller) poll(timeout time.Duration, all bool) ([]Polled, error) {
lst := make([]Polled, 0, len(p.items))
+ if len(p.items) == 0 {
+ return lst, nil
+ }
+
var ctx *Context
for _, soc := range p.socks {
if !soc.opened { | Fix Poller poll to handle empty case | pebbe_zmq4 | train | go,go |
82cebbf34e85b82e8cbde030ce6e433d3da596ab | diff --git a/packages/create-react-app/createReactApp.js b/packages/create-react-app/createReactApp.js
index <HASH>..<HASH> 100755
--- a/packages/create-react-app/createReactApp.js
+++ b/packages/create-react-app/createReactApp.js
@@ -21,10 +21,12 @@ const tmp = require('tmp');
const unpack = require('tar-pack').unpack;
const hyperquest = require('hyperquest');
+const packageJson = require('./package.json');
+
let projectName;
-const program = commander
- .version(require('./package.json').version)
+const program = new commander.Command(packageJson.name)
+ .version(packageJson.version)
.arguments('<project-directory>')
.usage(`${chalk.green('<project-directory>')} [options]`)
.action(name => { | Provide commander with package name (#<I>)
commander to figure it out on its own | vcarl_create-react-app | train | js |
0513c69babe0647d7e80a920082b494b962aa3df | diff --git a/sacrud/preprocessing.py b/sacrud/preprocessing.py
index <HASH>..<HASH> 100644
--- a/sacrud/preprocessing.py
+++ b/sacrud/preprocessing.py
@@ -146,7 +146,7 @@ class RequestPreprocessing(object):
value = value[0]
if not value and not hasattr(value, 'filename'):
- if self.column.default:
+ if self.column.default or self.column.primary_key:
return None
if column_type in list(self.types_list.keys()):
@@ -172,6 +172,7 @@ class ObjPreprocessing(object):
continue # pragma: no cover
value = request_preprocessing.check_type(table, key)
if value is None:
+ request.pop(key, None)
continue
request[key] = value
params = {k: v for k, v in request.items() if not k.endswith('[]')} | fix preprocessing pk for create action, when pk have not value | sacrud_sacrud | train | py |
464ed85177c57fe15c96a2e777f9966c2cf1ebf7 | diff --git a/lxc/manpage.go b/lxc/manpage.go
index <HASH>..<HASH> 100644
--- a/lxc/manpage.go
+++ b/lxc/manpage.go
@@ -37,7 +37,14 @@ func (c *cmdManpage) Run(cmd *cobra.Command, args []string) error {
Title: i18n.G("LXD - Command line client"),
Section: "1",
}
- doc.GenManTree(c.global.cmd, header, args[0])
+
+ opts := doc.GenManTreeOptions{
+ Header: header,
+ Path: args[0],
+ CommandSeparator: ".",
+ }
+
+ doc.GenManTreeFromOpts(c.global.cmd, opts)
return nil
}
diff --git a/lxd/main_manpage.go b/lxd/main_manpage.go
index <HASH>..<HASH> 100644
--- a/lxd/main_manpage.go
+++ b/lxd/main_manpage.go
@@ -43,7 +43,14 @@ func (c *cmdManpage) Run(cmd *cobra.Command, args []string) error {
Title: "LXD - Container server",
Section: "1",
}
- doc.GenManTree(c.global.cmd, header, args[0])
+
+ opts := doc.GenManTreeOptions{
+ Header: header,
+ Path: args[0],
+ CommandSeparator: ".",
+ }
+
+ doc.GenManTreeFromOpts(c.global.cmd, opts)
return nil
} | man: Use . as separator | lxc_lxd | train | go,go |
132e8ba5722a5c2ad2749a3c3f215b59cd2b8bb8 | diff --git a/cocaine/tools/actions/common.py b/cocaine/tools/actions/common.py
index <HASH>..<HASH> 100644
--- a/cocaine/tools/actions/common.py
+++ b/cocaine/tools/actions/common.py
@@ -79,7 +79,7 @@ class NodeInfo(Node):
for app_ in apps:
info = ''
try:
- app = Service(app_)
+ app = Service(app_, locator=self.locator)
channel = yield app.info()
info = yield channel.rx.get()
if all([self._expand, self._storage is not None, 'profile' in info]): | [Info] Use the proper locator to get Info from a remote host | cocaine_cocaine-tools | train | py |
ae81771f9e2e47e3ddc9e555fe803d5679cb4fac | diff --git a/eth/rlp/accounts.py b/eth/rlp/accounts.py
index <HASH>..<HASH> 100644
--- a/eth/rlp/accounts.py
+++ b/eth/rlp/accounts.py
@@ -34,3 +34,11 @@ class Account(rlp.Serializable):
code_hash: bytes=EMPTY_SHA3,
**kwargs: Any) -> None:
super().__init__(nonce, balance, storage_root, code_hash, **kwargs)
+
+ def __repr__(self):
+ return "Account(nonce=%d, balance=%d, storage_root=0x%s, code_hash=0x%s)" % (
+ self.nonce,
+ self.balance,
+ self.storage_root.hex(),
+ self.code_hash.hex(),
+ ) | add repr to eth.rlp.Account | ethereum_py-evm | train | py |
14fa0e3777f32ba87fdc3a88548bcea8f32ac246 | diff --git a/src/neuron/loader/instances.js b/src/neuron/loader/instances.js
index <HASH>..<HASH> 100644
--- a/src/neuron/loader/instances.js
+++ b/src/neuron/loader/instances.js
@@ -1,5 +1,7 @@
;(function(K){
+return;
+
var Loader = K._Loader;
@@ -8,8 +10,8 @@ var Loader = K._Loader;
* and also create a new namespace for modules under this application
* will be very useful for business requirement
- <code env="page">
- var Checkin = KM.app('Checkin', {
+ <code env="inline">
+ KM.app('Checkin', {
base: '/q/mods/'
});
@@ -27,13 +29,14 @@ var Loader = K._Loader;
// provide a module of the kernel
KM.provide('io/ajax', function(K, Ajax){
new Ajax( ... )
- })
+ });
+
</code>
<code env="index.js">
// '~/' -> the home dir for the current application
- KM.define(['~/timeline'], function(K, require){
+ KM.define(['~/timeline', 'dom'], function(K, require){
var timeline = require('~/timeline');
}); | loader: add TODOs; add scheme plan for new features of loader | kaelzhang_neuron.js | train | js |
464caaf5dff2cbaa4aaac8cc95fa9249d56d84bf | diff --git a/ghost/members-api/subscriptions/payment-processors/stripe/api.js b/ghost/members-api/subscriptions/payment-processors/stripe/api.js
index <HASH>..<HASH> 100644
--- a/ghost/members-api/subscriptions/payment-processors/stripe/api.js
+++ b/ghost/members-api/subscriptions/payment-processors/stripe/api.js
@@ -19,7 +19,7 @@ const getPlanHashSeed = (plan, product) => {
return product.id + plan.interval + plan.currency + plan.amount;
};
-const getProductHashSeed = product => product.name;
+const getProductHashSeed = () => 'Ghost Subscription';
const getCustomerHashSeed = member => member.email;
const plans = createApi('plans', isActive, getPlanAttr, getPlanHashSeed); | Updated product hashseed to be hardcoded (#<I>)
no-issue | TryGhost_Ghost | train | js |
97bd12a8cf3225f0635b351001fe4bd25ac6a06e | diff --git a/Model/OriginalFile.php b/Model/OriginalFile.php
index <HASH>..<HASH> 100644
--- a/Model/OriginalFile.php
+++ b/Model/OriginalFile.php
@@ -109,6 +109,6 @@ class OriginalFile
public function getOrginalFile()
{
- return base64_decode($this->original_file_base64);
+ return base64_decode(strtr($this->original_file_base64, '-_,', '+/='));
}
} | Fixes decoding of rubies urlsafe base<I> encode | cwd_datamolino-client | train | php |
f71b66eba63388a6b89f1baf8d4a271e825abd42 | diff --git a/lib/dugway/liquid/drops/cart_drop.rb b/lib/dugway/liquid/drops/cart_drop.rb
index <HASH>..<HASH> 100755
--- a/lib/dugway/liquid/drops/cart_drop.rb
+++ b/lib/dugway/liquid/drops/cart_drop.rb
@@ -9,10 +9,14 @@ module Dugway
items.map { |item| item.quantity }.inject(:+) || 0
end
- def total
+ def subtotal
items.map { |item| item.price }.inject(:+) || 0
end
+ def total
+ subtotal
+ end
+
def country
nil
end
diff --git a/lib/dugway/liquid/drops/cart_item_drop.rb b/lib/dugway/liquid/drops/cart_item_drop.rb
index <HASH>..<HASH> 100755
--- a/lib/dugway/liquid/drops/cart_item_drop.rb
+++ b/lib/dugway/liquid/drops/cart_item_drop.rb
@@ -12,6 +12,10 @@ module Dugway
def option
ProductOptionDrop.new(source['option'])
end
+
+ def shipping
+ 0.0
+ end
end
end
end | Finalize cart drops. Closes #7 | bigcartel_dugway | train | rb,rb |
6590d6ad82118ea4e25a7511113fb846e1b9fce0 | diff --git a/synapse/cortex.py b/synapse/cortex.py
index <HASH>..<HASH> 100644
--- a/synapse/cortex.py
+++ b/synapse/cortex.py
@@ -2665,6 +2665,8 @@ class Cortex(s_cell.Cell): # type: ignore
async def count(self, text, opts=None):
+ opts = self._initStormOpts(opts)
+
view = self._viewFromOpts(opts)
i = 0
diff --git a/synapse/tests/test_cortex.py b/synapse/tests/test_cortex.py
index <HASH>..<HASH> 100644
--- a/synapse/tests/test_cortex.py
+++ b/synapse/tests/test_cortex.py
@@ -1571,6 +1571,7 @@ class CortexBasicTest(s_t_utils.SynTest):
# test the remote storm result counting API
self.eq(0, await proxy.count('test:pivtarg'))
self.eq(1, await proxy.count('inet:user'))
+ self.eq(1, await core.count('inet:user'))
# Test the getFeedFuncs command to enumerate feed functions.
ret = await proxy.getFeedFuncs() | fix for local count() api (#<I>) | vertexproject_synapse | train | py,py |
2381250f2606f389d0536b8d5fbd1a8428fe8e22 | diff --git a/app/search_engines/bento_search/ebsco_host_engine.rb b/app/search_engines/bento_search/ebsco_host_engine.rb
index <HASH>..<HASH> 100644
--- a/app/search_engines/bento_search/ebsco_host_engine.rb
+++ b/app/search_engines/bento_search/ebsco_host_engine.rb
@@ -228,6 +228,8 @@ class BentoSearch::EbscoHostEngine
# normalization.
if ["Academic Journal", "Journal"].include?(components.first) && ["Article", "Journal Article"].include?(components.last)
return "Journal Article"
+ elsif components.last == "Book: Monograph"
+ return "Book" # Book: Monograph what??
elsif components.first == "Periodical" && components.length > 1
return components.last
elsif components.size == 2 && components.first.include?(components.last) | ebscohost, improved heuristic for reasonable format_str | jrochkind_bento_search | train | rb |
2a812df6b530d44ac794323f0618e0ef009ca4be | diff --git a/js/okx.js b/js/okx.js
index <HASH>..<HASH> 100644
--- a/js/okx.js
+++ b/js/okx.js
@@ -906,7 +906,6 @@ module.exports = class okx extends Exchange {
'margin': spot && (Precise.stringGt (maxLeverage, '1')),
'swap': swap,
'future': future,
- 'futures': future, // deprecated
'option': option,
'active': true,
'contract': contract,
@@ -1297,7 +1296,7 @@ module.exports = class okx extends Exchange {
async fetchTickers (symbols = undefined, params = {}) {
const [ type, query ] = this.handleMarketTypeAndParams ('fetchTickers', undefined, params);
- return await this.fetchTickersByType (type, symbols, this.omit (query, 'type'));
+ return await this.fetchTickersByType (type, symbols, query);
}
parseTrade (trade, market = undefined) { | remove deprecated type future from market structure | ccxt_ccxt | train | js |
8caad4f241acb3c6110c029570597f106edf4ec8 | diff --git a/src/Admin/AbstractAdmin.php b/src/Admin/AbstractAdmin.php
index <HASH>..<HASH> 100644
--- a/src/Admin/AbstractAdmin.php
+++ b/src/Admin/AbstractAdmin.php
@@ -1318,6 +1318,11 @@ abstract class AbstractAdmin extends AbstractTaggedAdmin implements AdminInterfa
return;
}
+ // NEXT_MAJOR: Remove this check
+ if (!$admin) {
+ return;
+ }
+
if ($this->hasRequest()) {
$admin->setRequest($this->getRequest());
}
diff --git a/src/Admin/Pool.php b/src/Admin/Pool.php
index <HASH>..<HASH> 100644
--- a/src/Admin/Pool.php
+++ b/src/Admin/Pool.php
@@ -506,7 +506,7 @@ class Pool
* @throws TooManyAdminClassException if there is too many admin for the field description target model
* @throws AdminCodeNotFoundException if the admin_code option is invalid
*
- * @return AdminInterface
+ * @return AdminInterface|false|null NEXT_MAJOR: Restrict to AdminInterface
*/
final public function getAdminByFieldDescription(FieldDescriptionInterface $fieldDescription)
{ | Handle case of Admin not found (#<I>) | sonata-project_SonataAdminBundle | train | php,php |
ca906820748e5c9d11563fe8b04f98fb2c328ddf | diff --git a/lib/jsi/util.rb b/lib/jsi/util.rb
index <HASH>..<HASH> 100644
--- a/lib/jsi/util.rb
+++ b/lib/jsi/util.rb
@@ -17,21 +17,21 @@ module JSI
# @param hash [#to_hash] the hash from which to convert symbol keys to strings
# @return [same class as the param `hash`, or Hash if the former cannot be done] a
# hash(-like) instance containing no symbol keys
- def stringify_symbol_keys(hash)
- unless hash.respond_to?(:to_hash)
- raise(ArgumentError, "expected argument to be a hash; got #{hash.class.inspect}: #{hash.pretty_inspect.chomp}")
+ def stringify_symbol_keys(hashlike)
+ unless hashlike.respond_to?(:to_hash)
+ raise(ArgumentError, "expected argument to be a hash; got #{hashlike.class.inspect}: #{hashlike.pretty_inspect.chomp}")
end
- JSI::Typelike.modified_copy(hash) do |hash_|
+ JSI::Typelike.modified_copy(hashlike) do |hash|
changed = false
out = {}
- hash_.each do |k, v|
+ hash.each do |k, v|
if k.is_a?(Symbol)
changed = true
k = k.to_s
end
out[k] = v
end
- changed ? out : hash_
+ changed ? out : hash
end
end | don't shadow in JSI::Typelike#stringify_symbol_keys hash | notEthan_jsi | train | rb |
b912ed8826d41bddf593593cd5cd0051882cabdd | diff --git a/parfait-core/src/main/java/com/custardsource/parfait/MonitorableRegistry.java b/parfait-core/src/main/java/com/custardsource/parfait/MonitorableRegistry.java
index <HASH>..<HASH> 100644
--- a/parfait-core/src/main/java/com/custardsource/parfait/MonitorableRegistry.java
+++ b/parfait-core/src/main/java/com/custardsource/parfait/MonitorableRegistry.java
@@ -8,6 +8,7 @@ import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import com.google.common.base.Preconditions;
+import com.google.common.collect.ImmutableList;
/**
* A collection of Monitorables to be monitored by a given output source (or
@@ -74,10 +75,7 @@ public class MonitorableRegistry {
* MonitorableRegistry.
*/
public synchronized Collection<Monitorable<?>> getMonitorables() {
- Preconditions.checkState(stateFrozen,
- "MonitorableRegistry must be frozen before retrieving monitorable list");
- stateFrozen = true;
- return Collections.unmodifiableCollection(monitorables.values());
+ return ImmutableList.copyOf(monitorables.values());
}
/* | Tidyup of MonitorableRegistry preconditions, better concurrent semantics | performancecopilot_parfait | train | java |
b254afaea67e08d83611423a3a1ec7afcee849b3 | diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -18,7 +18,8 @@ setup_args = dict(
'console_scripts': [
'wallace = wallace.command_line:wallace',
],
- }
+ },
+ dependency_links=['-e git+git://github.com/berkeley-cocosci/psiTurk.git@wallace3#egg=psiturk']
)
# Read in requirements.txt for dependencies. | Add custom psiTurk as dependency link | berkeley-cocosci_Wallace | train | py |
8fa0badad390b4935819fa49cabb38debc373d2d | diff --git a/src/Core.php b/src/Core.php
index <HASH>..<HASH> 100755
--- a/src/Core.php
+++ b/src/Core.php
@@ -235,8 +235,20 @@ class Core
curl_setopt($ch, CURLOPT_POSTFIELDS, $query_string);
// @TODO - S.P. to review...
- curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
+ // JBB - these turn off all SSL security checking
+ // curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
+ // curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
+
+ // JBB - adding switch to check for a constant in the php bootstrap
+ // which defines the location of a cURL SSL certificate
+ if( defined("CURL_SSL_CERTIFICATE") && is_file(CURL_SSL_CERTIFICATE)) {
+ curl_setopt($ch, CURLOPT_CAINFO, CURL_SSL_CERTIFICATE);
+ curl_setopt($ch, CURLOPT_CAPATH, CURL_SSL_CERTIFICATE);
+ }
+ else {
+ throw new \Exception('cURL SSL certificate not found');
+ }
+
// Manage if user provided headers.
if (count($headers) > 0) | VIDA-<I> Adding SSL Certificate check
Commented out the lines which disable cURL's security checking,
Included lines which looks for a cURL SSL certificate file (supplied by using a project defined php constant which will be required in all projects which wish to use cURL), and, if that file is present, uses that file to add those SSL certificates to cURL's configuration.
If the constant is not found, and is not a file, then an exception is thrown. | iRAP-software_package-core-libs | train | php |
78553d3ac7969ea641e6608e816c5f23e910e077 | diff --git a/lib/console.js b/lib/console.js
index <HASH>..<HASH> 100644
--- a/lib/console.js
+++ b/lib/console.js
@@ -92,7 +92,11 @@ ConsoleLogger.prototype.write = function (record) {
if (!msg || msg===' ') {
// this is the case where you send in an object as the only argument
var fields = _.omit(record,'name','prefix','showtab','showcr','hostname','pid','level','msg','time','v','problemLogName');
- msg = util.inspect(fields, {colors:true});
+ if (_.isEmpty(fields)) {
+ msg = '';
+ } else {
+ msg = util.inspect(fields, {colors:true});
+ }
}
if (this.showcr && msg.indexOf('\n') > 0) {
var lines = msg.split(/\n/), | [CLI-<I>] don't print empty object | appcelerator_appc-logger | train | js |
223766932c09a2d8f8a7412eaf8e67780857e8f3 | diff --git a/src/Illuminate/Queue/Console/RetryCommand.php b/src/Illuminate/Queue/Console/RetryCommand.php
index <HASH>..<HASH> 100644
--- a/src/Illuminate/Queue/Console/RetryCommand.php
+++ b/src/Illuminate/Queue/Console/RetryCommand.php
@@ -51,7 +51,7 @@ class RetryCommand extends Command
*/
protected function getJobIds()
{
- $ids = $this->argument('id');
+ $ids = (array) $this->argument('id');
if (count($ids) === 1 && $ids[0] === 'all') {
$ids = Arr::pluck($this->laravel['queue.failer']->all(), 'id'); | Ensure getJobIds always return an array. (#<I>) | laravel_framework | train | php |
8a0ee9aedfee9eb1a5ee6df1644c9020e9e31e97 | diff --git a/src/cli.js b/src/cli.js
index <HASH>..<HASH> 100644
--- a/src/cli.js
+++ b/src/cli.js
@@ -9,7 +9,7 @@ import defaultPublisher from './Publisher/publish.js';
let argv = minimist(process.argv.slice(2));
if (argv.h || argv.help) {
console.log('usage: esdoc [esdoc.json | path/to/js/src]');
- return;
+ process.exit(0)
}
assert.equal(argv._.length, 1, 'specify esdoc.json or dir. see -h'); | fix: return at non-function scope. | esdoc_esdoc | train | js |
11adfd32601b7ec63eb82d0d521144d7fdf23d8b | diff --git a/APIJet/Request.php b/APIJet/Request.php
index <HASH>..<HASH> 100644
--- a/APIJet/Request.php
+++ b/APIJet/Request.php
@@ -9,6 +9,8 @@ class Request
const PUT = 'PUT';
const DELETE = 'DELETE';
+ private static $inputData = null;
+
private function __construct() {}
private function __clone() {}
@@ -71,4 +73,21 @@ class Request
return (bool) $authorizationCallback();
}
+
+ public static function getInputData()
+ {
+ if (self::$inputData === null) {
+
+ $inputData = [];
+ $rawInput = file_get_contents('php://input');
+
+ if (!empty($rawInput)) {
+ mb_parse_str($rawInput, $inputData);
+ }
+
+ self::$inputData = $inputData;
+ }
+
+ return self::$inputData;
+ }
} | Add getInputData in APIJet\Request | APIJet_APIJet | train | php |
79ba0762c1180f9a4dc733b789f61f13ecbb3c37 | diff --git a/src/Entities/Subscription.php b/src/Entities/Subscription.php
index <HASH>..<HASH> 100644
--- a/src/Entities/Subscription.php
+++ b/src/Entities/Subscription.php
@@ -195,16 +195,6 @@ final class Subscription extends Entity
}
/**
- * @deprecated
- *
- * @return string
- */
- public function getCancelledTime()
- {
- return $this->getCanceledTime();
- }
-
- /**
* @return string
*/
public function getRenewalTime() | Remove deprecated method Subscription::getCancelledTime() (#<I>) | Rebilly_rebilly-php | train | php |
4cd4381b8087abf20b86c686a98f3c2309f3e76d | diff --git a/lib/index.js b/lib/index.js
index <HASH>..<HASH> 100644
--- a/lib/index.js
+++ b/lib/index.js
@@ -64,6 +64,16 @@ Server.prototype.serveClient = function(v){
};
/**
+ * Backwards compatiblity.
+ *
+ * @api public
+ */
+
+Server.prototype.set = function(){
+ return this;
+};
+
+/**
* Sets the client serving path.
*
* @param {String} pathname | lib: bc compatibility | socketio_socket.io | train | js |
9053f53c5dd3c1bdd7c23d7e29e03c4bc3e06cad | diff --git a/datasync/kvdbsync/plugin_impl_dbsync.go b/datasync/kvdbsync/plugin_impl_dbsync.go
index <HASH>..<HASH> 100644
--- a/datasync/kvdbsync/plugin_impl_dbsync.go
+++ b/datasync/kvdbsync/plugin_impl_dbsync.go
@@ -49,6 +49,11 @@ type Deps struct {
KvPlugin keyval.KvProtoPlugin // inject
}
+// Name implements PluginNamed
+func (p *Plugin) Name() string {
+ return p.PluginName.String()
+}
+
type infraDeps interface {
// InfraDeps for getting PlugginInfraDeps instance (logger, config, plugin name, statuscheck)
InfraDeps(pluginName string, opts ...local.InfraDepsOpts) *local.PluginInfraDeps | Implement Name for kvdbsync | ligato_cn-infra | train | go |
72dd93aa026bfa52560a88d18c00c21b9c411793 | diff --git a/js/conversation_controller.js b/js/conversation_controller.js
index <HASH>..<HASH> 100644
--- a/js/conversation_controller.js
+++ b/js/conversation_controller.js
@@ -62,6 +62,9 @@
storage.put("unreadCount", newUnreadCount);
setUnreadCount(newUnreadCount);
+ if (newUnreadCount === 0) {
+ window.clearAttention();
+ }
}
}))();
diff --git a/js/panel_controller.js b/js/panel_controller.js
index <HASH>..<HASH> 100644
--- a/js/panel_controller.js
+++ b/js/panel_controller.js
@@ -22,6 +22,9 @@
extension.windows.drawAttention(inboxWindowId);
}
};
+ window.clearAttention = function() {
+ extension.windows.clearAttention(inboxWindowId);
+ };
/* Inbox window controller */
var inboxFocused = false;
@@ -58,7 +61,7 @@
});
appWindow.contentWindow.addEventListener('focus', function() {
inboxFocused = true;
- extension.windows.clearAttention(inboxWindowId);
+ clearAttention();
});
// close the inbox if background.html is refreshed | Clear window attention if all messages are marked read
Fixes #<I>
// FREEBIE | ForstaLabs_librelay-node | train | js,js |
cb3aca18c85f5149635cc2b259c74ff50d68797f | diff --git a/lib/tenacity/orm_ext/mongoid.rb b/lib/tenacity/orm_ext/mongoid.rb
index <HASH>..<HASH> 100644
--- a/lib/tenacity/orm_ext/mongoid.rb
+++ b/lib/tenacity/orm_ext/mongoid.rb
@@ -63,15 +63,15 @@ module Tenacity
end
def _t_find_first_by_associate(property, id)
- find(:first, :conditions => { property => _t_serialize(id) })
+ first(:conditions => { property => _t_serialize(id) })
end
def _t_find_all_by_associate(property, id)
- find(:all, :conditions => { property => _t_serialize(id) })
+ all(:conditions => { property => _t_serialize(id) })
end
def _t_find_all_ids_by_associate(property, id)
- results = collection.find({property => _t_serialize(id)}, {:fields => 'id'}).to_a
+ results = collection.find(property => _t_serialize(id))
results.map { |r| r['_id'] }
end | Support for Moped in Mongoid 3 | jwood_tenacity | train | rb |
e76b34b8737ea73914bcefb8e4db4bd0f083edff | diff --git a/src/main/java/net/fortuna/ical4j/util/ResourceLoader.java b/src/main/java/net/fortuna/ical4j/util/ResourceLoader.java
index <HASH>..<HASH> 100644
--- a/src/main/java/net/fortuna/ical4j/util/ResourceLoader.java
+++ b/src/main/java/net/fortuna/ical4j/util/ResourceLoader.java
@@ -54,7 +54,9 @@ public class ResourceLoader {
public static URL getResource(String name) {
URL resource = null;
try {
- resource = Thread.currentThread().getContextClassLoader().getResource(name);
+ if (Thread.currentThread().getContextClassLoader() != null) {
+ resource = Thread.currentThread().getContextClassLoader().getResource(name);
+ }
} catch (SecurityException e) {
LOG.info("Unable to access context classloader, using default. " + e.getMessage());
} | Added null checking to avoid potential null pointer exception on some samsung devices | ical4j_ical4j | train | java |
6aad1882aee3d388ddce43a33c483edfdedd2292 | diff --git a/src/Database/Driver/PDODriverTrait.php b/src/Database/Driver/PDODriverTrait.php
index <HASH>..<HASH> 100644
--- a/src/Database/Driver/PDODriverTrait.php
+++ b/src/Database/Driver/PDODriverTrait.php
@@ -93,6 +93,9 @@ trait PDODriverTrait {
*/
public function beginTransaction() {
$this->connect();
+ if ($this->_connection->inTransaction()) {
+ return true;
+ }
return $this->_connection->beginTransaction();
}
@@ -103,6 +106,9 @@ trait PDODriverTrait {
*/
public function commitTransaction() {
$this->connect();
+ if (!$this->_connection->inTransaction()) {
+ return false;
+ }
return $this->_connection->commit();
}
@@ -112,6 +118,9 @@ trait PDODriverTrait {
* @return boolean true on success, false otherwise
*/
public function rollbackTransaction() {
+ if (!$this->_connection->inTransaction()) {
+ return false;
+ }
return $this->_connection->rollback();
} | Bringing back some old code removed for hhvm, we do need it | cakephp_cakephp | train | php |
917f439d5c6c3a5f7209e1a9f815dec9c2c689f6 | diff --git a/bin/sdk/gutenberg.js b/bin/sdk/gutenberg.js
index <HASH>..<HASH> 100644
--- a/bin/sdk/gutenberg.js
+++ b/bin/sdk/gutenberg.js
@@ -4,8 +4,9 @@
* External dependencies
*/
const fs = require( 'fs' );
-const path = require( 'path' );
const GenerateJsonFile = require( 'generate-json-file-webpack-plugin' );
+const path = require( 'path' );
+const { compact } = require( 'lodash' );
const DIRECTORY_DEPTH = '../../'; // Relative path of the extensions to preset directory
@@ -84,7 +85,7 @@ exports.config = ( { argv: { inputDir, outputDir }, getBaseConfig } ) => {
return {
...baseConfig,
- plugins: [
+ plugins: compact( [
...baseConfig.plugins,
fs.existsSync( presetPath ) &&
new GenerateJsonFile( {
@@ -94,10 +95,10 @@ exports.config = ( { argv: { inputDir, outputDir }, getBaseConfig } ) => {
betaBlocks: presetBetaBlocks,
},
} ),
- ],
+ ] ),
entry: {
editor: editorScript,
- 'editor-beta': editorBetaScript,
+ ...( editorBetaScript && { 'editor-beta': editorBetaScript } ),
...viewScriptEntry,
...viewBlocksScripts,
}, | SDK: Fix build failures without index json files (#<I>)
* Fix broken false plugins
* Entry scripts cannot be undefined
* Alphabetize requires | Automattic_wp-calypso | train | js |
202db4fb117768795c0fcc909cc9c3d75b9172b7 | diff --git a/utils_test.go b/utils_test.go
index <HASH>..<HASH> 100644
--- a/utils_test.go
+++ b/utils_test.go
@@ -5,6 +5,8 @@
package gin
import (
+ "bytes"
+ "encoding/xml"
"fmt"
"net/http"
"testing"
@@ -124,3 +126,14 @@ func TestBindMiddleware(t *testing.T) {
Bind(&bindTestStruct{})
})
}
+
+func TestMarshalXMLforH(t *testing.T) {
+ h := H{
+ "": "test",
+ }
+ var b bytes.Buffer
+ enc := xml.NewEncoder(&b)
+ var x xml.StartElement
+ e := h.MarshalXML(enc, x)
+ assert.Error(t, e)
+} | improve utils code coverage (#<I>) | gin-gonic_gin | train | go |
8040f74215c882d4e062e660584317d5de086aa4 | diff --git a/test/test.js b/test/test.js
index <HASH>..<HASH> 100644
--- a/test/test.js
+++ b/test/test.js
@@ -344,9 +344,9 @@ module.exports = function (createFn) {
})
})
- it('200 GET Customers/?bogus=field should ignore unknown parameters', function (done) {
+ it('200 GET Customers?foo=bar should ignore unknown parameters', function (done) {
request.get({
- url: util.format('%s/api/v1/Customers/?foo=bar', testUrl),
+ url: util.format('%s/api/v1/Customers?foo=bar', testUrl),
json: true
}, function (err, res, body) {
assert.ok(!err) | chore(tests): remove trailing slash
- This was testing for trailing slash instead of unknown parameter | florianholzapfel_express-restify-mongoose | train | js |
279ab8502c03bcf901abdfe8273af1c8000b780d | diff --git a/lib/audited/auditor.rb b/lib/audited/auditor.rb
index <HASH>..<HASH> 100644
--- a/lib/audited/auditor.rb
+++ b/lib/audited/auditor.rb
@@ -70,8 +70,8 @@ module Audited
# to notify a party after the audit has been created or if you want to access the newly-created
# audit.
define_callbacks :audit
- set_callback :audit, :after, :after_audit, if: lambda { self.respond_to?(:after_audit) }
- set_callback :audit, :around, :around_audit, if: lambda { self.respond_to?(:around_audit) }
+ set_callback :audit, :after, :after_audit, if: lambda { self.respond_to?(:after_audit, true) }
+ set_callback :audit, :around, :around_audit, if: lambda { self.respond_to?(:around_audit, true) }
attr_accessor :version
diff --git a/spec/support/active_record/models.rb b/spec/support/active_record/models.rb
index <HASH>..<HASH> 100644
--- a/spec/support/active_record/models.rb
+++ b/spec/support/active_record/models.rb
@@ -40,6 +40,8 @@ module Models
audited
attr_accessor :bogus_attr, :around_attr
+ private
+
def after_audit
self.bogus_attr = "do something"
end | Allow private / protected callback declarations
Prior to this change, users would have to declare publicly scoped
callback handlers. | collectiveidea_audited | train | rb,rb |
addf9b3d206d5da75c9d224e2cf6cd85803e45d7 | diff --git a/lib/tire/model/import.rb b/lib/tire/model/import.rb
index <HASH>..<HASH> 100644
--- a/lib/tire/model/import.rb
+++ b/lib/tire/model/import.rb
@@ -1,6 +1,13 @@
module Tire
module Model
+ # Provides support for easy importing of large ActiveRecord- and ActiveModel-bound
+ # recordsets into model index.
+ #
+ # Relies on pagination support in your model, namely the `paginate` class method.
+ #
+ # Please refer to the relevant of the README for more information.
+ #
module Import
module ClassMethods | [DOC] Added basic information about Tire::Model::Import module | karmi_retire | train | rb |
d3edf6bd1d17fec654cb10431b864b22467cdbd0 | diff --git a/master/buildbot/steps/gitdiffinfo.py b/master/buildbot/steps/gitdiffinfo.py
index <HASH>..<HASH> 100644
--- a/master/buildbot/steps/gitdiffinfo.py
+++ b/master/buildbot/steps/gitdiffinfo.py
@@ -72,7 +72,7 @@ class GitDiffInfo(buildstep.ShellMixin, buildstep.BuildStep):
yield self.runCommand(cmd)
log = yield self.getLog("stdio-merge-base")
- log.finish()
+ yield log.finish()
if cmd.results() != results.SUCCESS:
return cmd.results() | steps: Fix unyielded log.finish() in GitDiffInfo step | buildbot_buildbot | train | py |
a364a7a7e23c2c6b0c9071899604e6d378f9a474 | diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2011 Nippon Telegraph and Telephone Corporation.
+# Copyright (C) 2011, 2012 Nippon Telegraph and Telephone Corporation.
# Copyright (C) 2011 Isaku Yamahata <yamahata at valinux co jp>
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -15,11 +15,19 @@
# limitations under the License.
import os
+import sys
from setuptools import find_packages
from setuptools import setup
-long_description = 'Ryu is an open-sourced network operating system licensed under Apache License v2. Ryu aims to provide logically centralized control and well defined API that makes it easy for cloud operators to implement network management applications on top of the Ryu. Currently, Ryu supports OpenFlow protocol to control the network devices.'
+doing_bdist = any(arg.startswith('bdist') for arg in sys.argv[1:])
+
+long_description = open('README.rst').read() + '\n\n'
+
+if doing_bdist:
+ start = long_description.find('=\n') + 2
+ long_description = long_description[
+ start:long_description.find('\n\n\n', start)]
classifiers = [
'License :: OSI Approved :: Apache Software License', | Update setup.py
Use 'What's Ryu' section for RPM package description. Otherwise, we
use README.rst for long_description so that we have a nice PyPI
website. | osrg_ryu | train | py |
17d67e633482c128446e388b49548c543db0b3ed | diff --git a/app/controllers/concerns/scim_rails/exception_handler.rb b/app/controllers/concerns/scim_rails/exception_handler.rb
index <HASH>..<HASH> 100644
--- a/app/controllers/concerns/scim_rails/exception_handler.rb
+++ b/app/controllers/concerns/scim_rails/exception_handler.rb
@@ -68,6 +68,20 @@ module ScimRails
)
end
end
+
+ ## StandardError must be ordered last or it will catch all exceptions
+ if Rails.env.production?
+ rescue_from StandardError do |e|
+ json_response(
+ {
+ schemas: ["urn:ietf:params:scim:api:messages:2.0:Error"],
+ detail: e.message,
+ status: "500"
+ },
+ :internal_server_error
+ )
+ end
+ end
end
end
end | • rescue StandardError when the unknown goes wrong | lessonly_scim_rails | train | rb |
32da4f3f27d68a8304798ec91d60b8bbb5d4829c | diff --git a/lib/rubocop/cop/util.rb b/lib/rubocop/cop/util.rb
index <HASH>..<HASH> 100644
--- a/lib/rubocop/cop/util.rb
+++ b/lib/rubocop/cop/util.rb
@@ -24,7 +24,7 @@ module RuboCop
# Match literal regex characters, not including anchors, character
# classes, alternatives, groups, repetitions, references, etc
- LITERAL_REGEX = /[\w\s\-,"'!#%&<>=;:`~]|\\[^AbBdDgGhHkpPRwWXsSzZS0-9]/
+ LITERAL_REGEX = /[\w\s\-,"'!#%&<>=;:`~]|\\[^AbBdDgGhHkpPRwWXsSzZ0-9]/
module_function | :warning: character class has duplicated range
There're two "S"s in the literal | rubocop-hq_rubocop | train | rb |
7fc4815e117eda7e598599fd4bddc97362afaf95 | diff --git a/core/src/main/java/hudson/PluginManager.java b/core/src/main/java/hudson/PluginManager.java
index <HASH>..<HASH> 100644
--- a/core/src/main/java/hudson/PluginManager.java
+++ b/core/src/main/java/hudson/PluginManager.java
@@ -650,7 +650,17 @@ public abstract class PluginManager extends AbstractModelObject implements OnMas
continue;
}
- String artifactId = dependencyToken.split(":")[0];
+ String[] artifactIdVersionPair = dependencyToken.split(":");
+ String artifactId = artifactIdVersionPair[0];
+ VersionNumber dependencyVersion = new VersionNumber(artifactIdVersionPair[1]);
+
+ PluginManager manager = Jenkins.getActiveInstance().getPluginManager();
+ VersionNumber installedVersion = manager.getPluginVersion(manager.rootDir, artifactId);
+ if (installedVersion != null && installedVersion.isNewerThan(dependencyVersion)) {
+ // Do not downgrade dependencies that are already installed.
+ continue;
+ }
+
URL dependencyURL = context.getResource(fromPath + "/" + artifactId + ".hpi");
if (dependencyURL == null) { | Do not downgrade installed plugins when loading detached plugins | jenkinsci_jenkins | train | java |
a53aeaebccb1d6a6a4e124caed5bb9297f98d64c | diff --git a/tensor2tensor/utils/cloud_mlengine.py b/tensor2tensor/utils/cloud_mlengine.py
index <HASH>..<HASH> 100755
--- a/tensor2tensor/utils/cloud_mlengine.py
+++ b/tensor2tensor/utils/cloud_mlengine.py
@@ -232,7 +232,7 @@ def _tar_and_copy(src_dir, target_dir):
tmp_dir = tempfile.gettempdir().rstrip("/")
src_base = os.path.basename(src_dir)
shell_run(
- "tar -zcf {tmp_dir}/{src_base}.tar.gz -C {src_dir} .",
+ "tar --exclude=.git -zcf {tmp_dir}/{src_base}.tar.gz -C {src_dir} .",
src_dir=src_dir,
src_base=src_base,
tmp_dir=tmp_dir) | Exclude .git/ directory when submitting to Cloud ML Engine (#<I>)
The `.git` directory isn't used on Cloud ML Engine, therefor we should ignore it in the uploaded archive.
This reduces the size of the `.tar.gz` archive from a fresh clone of `tensor2tensor` from <I> MB to only <I> MB. | tensorflow_tensor2tensor | train | py |
206becd6ac52fc35219b8db161f71ea3e88bd3f9 | diff --git a/lib/netsuite/records/discount_item.rb b/lib/netsuite/records/discount_item.rb
index <HASH>..<HASH> 100644
--- a/lib/netsuite/records/discount_item.rb
+++ b/lib/netsuite/records/discount_item.rb
@@ -7,9 +7,9 @@ module NetSuite
include Support::Actions
include Namespaces::ListAcct
- actions :get, :get_list, :add, :delete, :upsert
+ actions :get, :get_list, :add, :delete, :search, :upsert
- fields :available_to_partners, :created_date, :description, :display_name, :include_children, :is_inactive, :is_pretax,
+ fields :available_to_partners, :created_date, :description, :display_name, :include_children, :is_inactive, :is_pre_tax,
:item_id, :last_modified_date, :non_posting, :rate, :upc_code, :vendor_name
record_refs :account, :custom_form, :deferred_revenue_account, :department, :expense_account,
@@ -27,6 +27,10 @@ module NetSuite
initialize_from_attributes_hash(attributes)
end
+ def self.search_class_name
+ "Item"
+ end
+
end
end
end | Adding search to discount item, fixing field configuration, fixing search class | NetSweet_netsuite | train | rb |
28ee47829e2a6205229d40c7af043ad6df071f28 | diff --git a/testing/conftest.py b/testing/conftest.py
index <HASH>..<HASH> 100644
--- a/testing/conftest.py
+++ b/testing/conftest.py
@@ -24,8 +24,8 @@ def restore_settrace():
newtrace = sys.gettrace()
if newtrace is not _orig_trace:
- assert newtrace is None
sys.settrace(_orig_trace)
+ assert newtrace is None
@pytest.fixture | tests: restore_settrace: restore before failing (#<I>) | antocuni_pdb | train | py |
e43f3f8245186f724c51b15788e7026300a36b84 | diff --git a/Classes/Flowpack/ElasticSearch/Indexer/Object/IndexInformer.php b/Classes/Flowpack/ElasticSearch/Indexer/Object/IndexInformer.php
index <HASH>..<HASH> 100644
--- a/Classes/Flowpack/ElasticSearch/Indexer/Object/IndexInformer.php
+++ b/Classes/Flowpack/ElasticSearch/Indexer/Object/IndexInformer.php
@@ -115,7 +115,6 @@ class IndexInformer
* @throws \Flowpack\ElasticSearch\Exception
* @param ObjectManagerInterface $objectManager
* @return array
- * @Flow\CompileStatic
*/
public static function buildIndexClassesAndProperties($objectManager)
{ | BUGFIX: buildIndexClassesAndProperties cannot compile static
The class was annotated as CompileStatic but actually cannot be compiled because it returns objects.
A better solution with CompileStatic can be found but for now this just removes the annotation. | Flowpack_Flowpack.ElasticSearch | train | php |
6bd9bd3173b8fd3c8b52f3de9c659581b5b3d63d | diff --git a/account/middleware.py b/account/middleware.py
index <HASH>..<HASH> 100644
--- a/account/middleware.py
+++ b/account/middleware.py
@@ -33,7 +33,7 @@ class LocaleMiddleware(object):
return response
-class AccountTimezoneMiddleware(object):
+class TimezoneMiddleware(object):
"""
This middleware sets the timezone used to display dates in
templates to the user's timezone. | Decided to change AccountTimezoneMiddleware to TimezoneMiddleware
This change helps unify the naming. Originally it was decided to add the
"Account" prefix, but now realizing it breaks consistency. | pinax_django-user-accounts | train | py |
5e17fbdaca9fca5a058522a7e2060d48cd9724cc | diff --git a/packer.go b/packer.go
index <HASH>..<HASH> 100644
--- a/packer.go
+++ b/packer.go
@@ -8,6 +8,7 @@ import (
"io/ioutil"
"log"
"os"
+ "runtime"
)
func main() {
@@ -19,6 +20,11 @@ func main() {
log.SetOutput(os.Stderr)
}
+ // If there is no explicit number of Go threads to use, then set it
+ if os.Getenv("GOMAXPROCS") == "" {
+ runtime.GOMAXPROCS(runtime.NumCPU())
+ }
+
defer plugin.CleanupClients()
config, err := parseConfig(defaultConfig) | packer: Set GOMAXPROCS for number of CPU if n ot set | hashicorp_packer | train | go |
06ed1abc2b14ca05af9d33c51faa1fc7c08eddfd | diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/fs/FileSystemMediumTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/fs/FileSystemMediumTest.java
index <HASH>..<HASH> 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/fs/FileSystemMediumTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/fs/FileSystemMediumTest.java
@@ -767,7 +767,8 @@ public class FileSystemMediumTest {
ScannerMediumTester.AnalysisBuilder analysis = tester
.newAnalysis(new File(projectDir, "sonar-project.properties"))
.property("sonar.sources", "XOURCES")
- .property("sonar.tests", "TESTX");
+ .property("sonar.tests", "TESTX")
+ .property("sonar.scm.exclusions.disabled", "true");
if (System2.INSTANCE.isOsWindows()) { // Windows is file path case-insensitive
AnalysisResult result = analysis.execute(); | Fix scanner engine test failing on macOS | SonarSource_sonarqube | train | java |
e9d9c100389e6d04f060f58eeb5e75921e82eb59 | diff --git a/util.py b/util.py
index <HASH>..<HASH> 100644
--- a/util.py
+++ b/util.py
@@ -29,8 +29,27 @@ def get_platform ():
irix-5.3
irix64-6.2
- For non-POSIX platforms, currently just returns 'sys.platform'.
+ Windows will return one of:
+ win-x86_64 (64bit Windows on x86_64 (AMD64))
+ win-ia64 (64bit Windows on Itanium)
+ win32 (all others - specifically, sys.platform is returned)
+
+ For other non-POSIX platforms, currently just returns 'sys.platform'.
"""
+ if os.name == 'nt':
+ # sniff sys.version for architecture.
+ prefix = " bit ("
+ i = string.find(sys.version, prefix)
+ if i == -1:
+ return sys.platform
+ j = string.find(sys.version, ")", i)
+ look = sys.version[i+len(prefix):j].lower()
+ if look=='amd64':
+ return 'win-x86_64'
+ if look=='itanium':
+ return 'win-ia64'
+ return sys.platform
+
if os.name != "posix" or not hasattr(os, 'uname'):
# XXX what about the architecture? NT is Intel or Alpha,
# Mac OS is M68k or PPC, etc. | [ <I> ] distutils.util.get_platform() return value on <I>bit Windows
As discussed on distutils-sig: Allows the generated installer name on
<I>bit Windows platforms to be different than the name generated for
<I>bit Windows platforms. | pypa_setuptools | train | py |
3110abec03d41cb885426aae7a80de4685a12a50 | diff --git a/lib/classes/navigation/views/secondary.php b/lib/classes/navigation/views/secondary.php
index <HASH>..<HASH> 100644
--- a/lib/classes/navigation/views/secondary.php
+++ b/lib/classes/navigation/views/secondary.php
@@ -89,13 +89,13 @@ class secondary extends view {
return [
self::TYPE_SETTING => [
'modedit' => 1,
- 'roleoverride' => 3,
- 'rolecheck' => 3.1,
- 'logreport' => 4,
- "mod_{$this->page->activityname}_useroverrides" => 5, // Overrides are module specific.
- "mod_{$this->page->activityname}_groupoverrides" => 6,
- 'roleassign' => 7,
- 'filtermanage' => 8,
+ "mod_{$this->page->activityname}_useroverrides" => 3, // Overrides are module specific.
+ "mod_{$this->page->activityname}_groupoverrides" => 4,
+ 'roleassign' => 5,
+ 'filtermanage' => 6,
+ 'roleoverride' => 7,
+ 'rolecheck' => 7.1,
+ 'logreport' => 8,
'backup' => 9,
'restore' => 10,
'competencybreakdown' => 11, | MDL-<I> core: Update the secondary nav nodes order
- Part of: MDL-<I> | moodle_moodle | train | php |
017d9d7e43edf07a26e30e6424b2a17b9ff6ae25 | diff --git a/spec/net_x/http_unix_spec.rb b/spec/net_x/http_unix_spec.rb
index <HASH>..<HASH> 100644
--- a/spec/net_x/http_unix_spec.rb
+++ b/spec/net_x/http_unix_spec.rb
@@ -22,7 +22,7 @@ describe NetX::HTTPUnix do
conn.puts "HTTP/1.1 200 OK"
conn.puts ""
conn.puts "Hello from TCP server"
- conn.close
+ conn.close_write
end
end
end
@@ -34,7 +34,7 @@ describe NetX::HTTPUnix do
conn.puts "HTTP/1.1 200 OK"
conn.puts ""
conn.puts "Hello from UNIX server"
- conn.close
+ conn.close_write
end
end
end | (maint) improve test suite to work on modern rubies
Without this change, tests would fail with Errno::ECONNRESET or Errno::EPIPE as the server would close the connection without reading all of the client's messages. Trying to actually read the request lead to lock-ups. Since this doesn't actually have to read anything, `close_write` works well enough for this. | puppetlabs_net_http_unix | train | rb |
c964068e46fd64b4871d9c54403c2a3b3c73ec45 | diff --git a/sendgrid/helpers/inbound/parse.py b/sendgrid/helpers/inbound/parse.py
index <HASH>..<HASH> 100644
--- a/sendgrid/helpers/inbound/parse.py
+++ b/sendgrid/helpers/inbound/parse.py
@@ -38,14 +38,15 @@ class Parse(object):
contents = base64 encoded file contents"""
attachments = None
if 'attachment-info' in self.payload:
- attachments = self._get_attachments(self.payload, self.request)
+ attachments = self._get_attachments(self.request)
# Check if we have a raw message
raw_email = self.get_raw_email()
if raw_email is not None:
- attachments = self._get_attachments_raw(self.payload)
+ attachments = self._get_attachments_raw(raw_email)
return attachments
- def _get_attachments(self, payload, request):
+ def _get_attachments(self, request):
+ attachments = []
for _, filestorage in request.files.iteritems():
attachment = {}
if filestorage.filename not in (None, 'fdopen', '<fdopen>'):
@@ -56,7 +57,7 @@ class Parse(object):
attachments.append(attachment)
return attachments
- def _get_attachments_raw(self, payload):
+ def _get_attachments_raw(self, raw_email):
attachments = []
counter = 1
for part in raw_email.walk(): | Fixed some errors with the refactoring | sendgrid_sendgrid-python | train | py |
cf1a0112bdd01fe0d2b95e5cf927ba9b196adf1b | diff --git a/ghost/admin/testem.js b/ghost/admin/testem.js
index <HASH>..<HASH> 100644
--- a/ghost/admin/testem.js
+++ b/ghost/admin/testem.js
@@ -5,6 +5,7 @@ let launch_in_ci = [process.env.BROWSER || 'Chrome'];
module.exports = {
framework: 'mocha',
+ browser_start_timeout: 120,
browser_disconnect_timeout: 60,
test_page: 'tests/index.html?hidepassed',
disable_watching: true, | Increased testem's `browser_start_timeout` to <I>s
no issue
- we're seeing random failures in CI with the error "Browser failed to connect within <I>s. testem.js not loaded?"
- bumped the timeout to <I>s to determine if it's due to occasional CI-related slowness or something else | TryGhost_Ghost | train | js |
8f6f2c734dd42d7c2d50dd3aec8424165e072d42 | diff --git a/src/draw/handler/Draw.Polyline.js b/src/draw/handler/Draw.Polyline.js
index <HASH>..<HASH> 100644
--- a/src/draw/handler/Draw.Polyline.js
+++ b/src/draw/handler/Draw.Polyline.js
@@ -220,6 +220,8 @@ L.Draw.Polyline = L.Draw.Feature.extend({
},
_onTouch: function (e) {
+ // #TODO: fix the glitchyness of not closing the polyline
+ // #TODO: use touchstart and touchend vs using click(touch start & end).
this._onMouseDown(e);
this._onMouseUp(e);
}, | #TODO: fix ployline glitchyness on shape completion | Leaflet_Leaflet.draw | train | js |
da9693f38c67a75d7e6e2274fac12b204d222843 | diff --git a/lib/sshkit/host.rb b/lib/sshkit/host.rb
index <HASH>..<HASH> 100644
--- a/lib/sshkit/host.rb
+++ b/lib/sshkit/host.rb
@@ -72,10 +72,11 @@ module SSHKit
def netssh_options
{}.tap do |sho|
- sho[:keys] = keys if keys.any?
- sho[:port] = port if port
- sho[:user] = user if user
- sho[:password] = password if password
+ sho[:keys] = keys if keys.any?
+ sho[:port] = port if port
+ sho[:user] = user if user
+ sho[:password] = password if password
+ sho[:forward_agent] = true
end
end | Enable agent forwarding by default for all hosts | capistrano_sshkit | train | rb |
c036fd9b2e9ddb40b72d29e41b2c5e3b3249c5eb | diff --git a/lib/aws/api_translator.rb b/lib/aws/api_translator.rb
index <HASH>..<HASH> 100644
--- a/lib/aws/api_translator.rb
+++ b/lib/aws/api_translator.rb
@@ -121,7 +121,8 @@ module Aws
end
property :name
- property :documentation_url
+
+ ignore :documentation_url
ignore :alias
def set_http(http) | Removed documentation urls (for now). | aws_aws-sdk-ruby | train | rb |
b9d505d9471aed2973dcb01ecab5cea69ebf775e | diff --git a/salt/minion.py b/salt/minion.py
index <HASH>..<HASH> 100644
--- a/salt/minion.py
+++ b/salt/minion.py
@@ -726,8 +726,8 @@ class Minion(object):
ret['fun'] = data['fun']
minion_instance._return_pub(ret)
if data['ret']:
+ ret['id'] = opts['id']
for returner in set(data['ret'].split(',')):
- ret['id'] = opts['id']
try:
minion_instance.returners['{0}.returner'.format(
returner | Only need to set ret id once
Don't set it inside the for loop when it's the same all the time. | saltstack_salt | train | py |
1a6456050ba9bb5f821243a3bd930765c9aee89c | diff --git a/test/mixin.rb b/test/mixin.rb
index <HASH>..<HASH> 100644
--- a/test/mixin.rb
+++ b/test/mixin.rb
@@ -18,6 +18,7 @@ module MixinTest
def teardown
super
Timecop.return
+ GC.start
end
module Checker | Fix test failure at in_object_space.
Depending on GC timing, mock object at test/mixin.rb are remains while
test/in_object_space.rb. But lib/fluentd/in_object_space.rb call Object#class
on all un-GCed object, including mock object.
Because unexpected method expectations are happen, in_object_space reports failure. | fluent_fluentd | train | rb |
ab3862dfe71b757b07f80b8c5bfc675d0f1dedc1 | diff --git a/lib/bbcloud/commands/users-update.rb b/lib/bbcloud/commands/users-update.rb
index <HASH>..<HASH> 100644
--- a/lib/bbcloud/commands/users-update.rb
+++ b/lib/bbcloud/commands/users-update.rb
@@ -2,6 +2,7 @@ desc 'Update user details'
arg_name 'user-id...'
command [:update] do |c|
c.desc "Path to public ssh key file"
+ c.long_desc "This is the path to the public ssh key that you'd like to use for new servers. You can specify '-' to read from stdin"
c.flag [:f, "ssh-key"]
c.desc "Name" | users-update: added long description | brightbox_brightbox-cli | train | rb |
076e64adf809399e5c1f83087a5f23fd037d0061 | diff --git a/test/tests/clone.js b/test/tests/clone.js
index <HASH>..<HASH> 100644
--- a/test/tests/clone.js
+++ b/test/tests/clone.js
@@ -25,7 +25,7 @@ describe("Clone", function() {
});
});
- it("can clone with http", function() {
+ it.skip("can clone with http", function() {
var test = this;
var url = "http://git.tbranyen.com/smart/site-content"; | Skip http clone test
We're having an issue reaching the server for the http clone test so I'm just going to skip it for right now. | nodegit_nodegit | train | js |
08c438b86efa867f58344a84a1b047e7dc46df44 | diff --git a/python/bigdl/dllib/nn/layer.py b/python/bigdl/dllib/nn/layer.py
index <HASH>..<HASH> 100644
--- a/python/bigdl/dllib/nn/layer.py
+++ b/python/bigdl/dllib/nn/layer.py
@@ -902,6 +902,34 @@ class Model(Container):
callBigDlFunc(bigdl_type, "saveGraphTopology", self.value, log_path)
return self
+class Attention(Layer):
+
+ '''
+ Implementation of multiheaded attention and self-attention layers.
+
+ >>> attention = Attention(8, 4, 1.0)
+ creating: createAttention
+ '''
+
+ def __init__(self, hidden_size, num_heads, attention_dropout, bigdl_type="float"):
+ super(Attention, self).__init__(None, bigdl_type,
+ hidden_size, num_heads, attention_dropout)
+
+class FeedForwardNetwork(Layer):
+
+ '''
+ Implementation FeedForwardNetwork constructed with fully connected network.
+ Input with shape (batch_size, length, hidden_size)
+ Output with shape (batch_size, length, hidden_size)
+
+ >>> ffn = FeedForwardNetwork(8, 4, 1.0)
+ creating: createFeedForwardNetwork
+ '''
+
+ def __init__(self, hidden_size, filter_size, relu_dropout, bigdl_type="float"):
+ super(FeedForwardNetwork, self).__init__(None, bigdl_type,
+ hidden_size, filter_size, relu_dropout)
+
class Linear(Layer):
''' | [New feature] Add attention layer and ffn layer (#<I>)
* add attention layer
* add ffn layer and more unit tests
* refactor according to pr comments
* add SerializationTest
* fix unit tests
* add python api | intel-analytics_BigDL | train | py |
f585a5889fb82b0043977257242f3246b6a1d367 | diff --git a/guizero/tkmixins.py b/guizero/tkmixins.py
index <HASH>..<HASH> 100644
--- a/guizero/tkmixins.py
+++ b/guizero/tkmixins.py
@@ -25,14 +25,15 @@ class ScheduleMixin():
"""Fired by tk.after, gets the callback and either executes the function and cancels or repeats"""
# execute the function
function(*args)
- repeat = self._callback[function][1]
- if repeat:
- # setup the call back again and update the id
- callback_id = self.tk.after(time, self._call_wrapper, time, function, *args)
- self._callback[function][0] = callback_id
- else:
- # remove it from the call back dictionary
- self._callback.pop(function)
+ if function in self._callback.keys():
+ repeat = self._callback[function][1]
+ if repeat:
+ # setup the call back again and update the id
+ callback_id = self.tk.after(time, self._call_wrapper, time, function, *args)
+ self._callback[function][0] = callback_id
+ else:
+ # remove it from the call back dictionary
+ self._callback.pop(function)
class DestroyMixin():
def destroy(self):
@@ -112,4 +113,4 @@ class ReprMixin:
def __repr__(self):
return self.description
-
\ No newline at end of file
+ | Fix scheduled function cancellation
Cancelling a scheduled function that is running can result in an exception.
This can occur if the function cancels itself.
We can prevent this by checking if the function exists in self._callback | lawsie_guizero | train | py |
e8ec681a7bd6485874114b2eec4050e931fd7ee6 | diff --git a/hamper/plugins/karma.py b/hamper/plugins/karma.py
index <HASH>..<HASH> 100644
--- a/hamper/plugins/karma.py
+++ b/hamper/plugins/karma.py
@@ -178,11 +178,14 @@ class Karma(ChatCommandPlugin):
# Play nice when the user isn't in the db
kt = bot.factory.loader.db.session.query(KarmaTable)
thing = ude(groups[0].strip().lower())
- user = kt.filter(KarmaTable.user == thing).first()
+ rec_list = kt.filter(KarmaTable.receiver == thing).all()
- if user:
+ if rec_list:
+ total = 0
+ for r in rec_list:
+ total += r.kcount
bot.reply(
- comm, '%s has %d points' % (uen(user.user), user.kcount),
+ comm, '%s has %d points' % (uen(thing), total),
encode=False
)
else: | karma: update UserKarma for the new row structure | hamperbot_hamper | train | py |
4def49ca81b59d61a1cff1aec470499cc9bf4663 | diff --git a/loguru/_logger.py b/loguru/_logger.py
index <HASH>..<HASH> 100644
--- a/loguru/_logger.py
+++ b/loguru/_logger.py
@@ -762,6 +762,11 @@ class Logger:
The id of the sink to remove, as it was returned by the |add| method. If ``None``, all
handlers are removed. The pre-configured handler is guaranteed to have the index ``0``.
+ Raises
+ ------
+ ValueError
+ If ``handler_id`` is not ``None`` but there is no active handler with such id.
+
Examples
--------
>>> i = logger.add(sys.stderr, format="{message}") | Add documentation about exception possibly raised by ".remove()" | Delgan_loguru | train | py |
1aec5fb5b73522810ae2c370d3532b0d46aa65ba | diff --git a/code/template/helper/actionbar.php b/code/template/helper/actionbar.php
index <HASH>..<HASH> 100644
--- a/code/template/helper/actionbar.php
+++ b/code/template/helper/actionbar.php
@@ -58,7 +58,7 @@ class KTemplateHelperActionbar extends KTemplateHelperAbstract
$html .= '</div>';
$buttons = '';
- foreach ($config->toolbar->getCommands() as $command)
+ foreach ($config->toolbar as $command)
{
$name = $command->getName();
@@ -96,7 +96,7 @@ class KTemplateHelperActionbar extends KTemplateHelperAbstract
$command->attribs->class->append(array('disabled', 'unauthorized'));
}
- //Add a toolbar class
+ //Add a toolbar class
$command->attribs->class->append(array('toolbar'));
//Create the href | re #<I> - Toolbar can be traversed. | timble_kodekit | train | php |
d0d171fcc63d4408498960a05845c6396bbefcfe | diff --git a/workspaces/amber-lib/src/index.js b/workspaces/amber-lib/src/index.js
index <HASH>..<HASH> 100644
--- a/workspaces/amber-lib/src/index.js
+++ b/workspaces/amber-lib/src/index.js
@@ -5,6 +5,7 @@ import {
import Form from 'unformed';
import FormFields from 'unformed-fields';
import { Icon, resources as ContentResources } from '@amber-engine/amber-content';
+import { components as AnalyticsComponents, analytics } from '@amber-engine/amber-analytics';
const {
FormSuccessSection,
@@ -28,11 +29,13 @@ export const components = {
...FormFields,
},
},
+ AnalyticsComponents,
};
export const utils = {
...FormUtils,
...SharedUtils,
+ analytics,
};
export const resources = { | Adding analytics components/utils. | AmberEngine_amber-lib-js | train | js |
e57ace6665fc307ec3d54a97cc25d5cfc86a2f19 | diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100755
--- a/setup.py
+++ b/setup.py
@@ -17,10 +17,10 @@ except:
pass
if sys.platform == "win32":
- ext = Extension("tlslite.utils.win32prng",
- sources=["tlslite/utils/win32prng.c"],
- libraries=["advapi32"])
- exts = [ext]
+ #ext = Extension("tlslite.utils.win32prng",
+ # sources=["tlslite/utils/win32prng.c"],
+ # libraries=["advapi32"])
+ exts = []#[ext]
else:
exts = [] | win<I>prng ext no longer beckoned for if platform is win<I>
Looking for win<I>prng during setup was causing failed installations. Will use os.urandom() instead. | javipalanca_spade | train | py |
Subsets and Splits
Java Commits in Train Set
Queries for all entries where the diff_languages column is 'java', providing a filtered dataset but without deeper analysis.
Java Commits Test Data
Returns a subset of 5000 entries from the dataset where the programming language difference is Java, providing basic filtering for exploration.
Java Commits Sample
Retrieves the first 1,000 records where the 'diff_languages' column is 'java', providing limited insight into the specific data entries.
Java Commits Validation Sample
Retrieves a sample of entries from the validation dataset where the diff languages are Java, providing limited insight into specific Java-related data points.
Java Commits in Validation
This query retrieves a limited sample of entries from the validation dataset where the programming language difference is Java, providing basic filtering with minimal insight.
Java Commits Sample
This query retrieves a sample of 100 records where the 'diff_languages' is 'java', providing basic filtering but limited analytical value.
Java Commits Sample
Retrieves 100 samples where the language difference is Java, providing basic filtering but minimal analytical value.
Java Commits Sample
Retrieves 10 samples where the diff_languages column is 'java', providing basic examples of data entries with this specific language.
Java Commits Validation Sample
Retrieves 1,000 records where the differences in languages are marked as Java, providing a snapshot of that specific subset but limited to raw data.
Java Commits Sample
This query retrieves 1000 random samples from the dataset where the programming language is Java, offering limited insight beyond raw data.