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
|
---|---|---|---|---|---|
6bf0225aecaab7db38088deb14d3eff82def697f | diff --git a/settings.js b/settings.js
index <HASH>..<HASH> 100644
--- a/settings.js
+++ b/settings.js
@@ -73,12 +73,12 @@ var settings = {
},
updates: {
"2b04:d006": {
- SystemFirmwareOne: "system-part1-0.4.3-photon.bin",
- SystemFirmwareTwo: "system-part2-0.4.3-photon.bin"
+ SystemFirmwareOne: "system-part1-0.4.4-rc.1-photon.bin",
+ SystemFirmwareTwo: "system-part2-0.4.4-rc.1-photon.bin"
},
"2b04:d008": {
- SystemFirmwareOne: "system-part1-0.4.3-p1.bin",
- SystemFirmwareTwo: "system-part2-0.4.3-p1.bin"
+ SystemFirmwareOne: "system-part1-0.4.4-rc.1-p1.bin",
+ SystemFirmwareTwo: "system-part2-0.4.4-rc.1-p1.bin"
}
},
commandMappings: path.join(__dirname, "mappings.json") | System firmware updates now at <I>-rc<I> | particle-iot_particle-cli | train | js |
0ef2324f0bdd2fb524b0e19973c2b1a093a5afc5 | diff --git a/xmlChart.go b/xmlChart.go
index <HASH>..<HASH> 100644
--- a/xmlChart.go
+++ b/xmlChart.go
@@ -253,7 +253,7 @@ type aLn struct {
Algn string `xml:"algn,attr,omitempty"`
Cap string `xml:"cap,attr,omitempty"`
Cmpd string `xml:"cmpd,attr,omitempty"`
- W int `xml:"w,attr,omitempty" `
+ W int `xml:"w,attr,omitempty"`
NoFill string `xml:"a:noFill,omitempty"`
Round string `xml:"a:round,omitempty"`
SolidFill *aSolidFill `xml:"a:solidFill"`
@@ -591,7 +591,7 @@ type formatChartSeries struct {
} `json:"line"`
Marker struct {
Type string `json:"type"`
- Size int `json:"size,"`
+ Size int `json:"size"`
Width float64 `json:"width"`
Border struct {
Color string `json:"color"` | fix unknown option in JSON struct tag | 360EntSecGroup-Skylar_excelize | train | go |
068a775db2d4910828706ff2c0af32783d006d2b | diff --git a/app/controllers/UsersController.java b/app/controllers/UsersController.java
index <HASH>..<HASH> 100644
--- a/app/controllers/UsersController.java
+++ b/app/controllers/UsersController.java
@@ -107,6 +107,9 @@ public class UsersController extends AuthenticatedController {
}
public Result newUserForm() {
+ if (!Permissions.isPermitted(RestPermissions.USERS_CREATE)) {
+ return redirect(routes.StartpageController.redirect());
+ }
BreadcrumbList bc = breadcrumbs();
bc.addCrumb("New", routes.UsersController.newUserForm());
@@ -130,6 +133,9 @@ public class UsersController extends AuthenticatedController {
}
public Result editUserForm(String username) {
+ if (!Permissions.isPermitted(RestPermissions.USERS_EDIT, username)) {
+ return redirect(routes.StartpageController.redirect());
+ }
BreadcrumbList bc = breadcrumbs();
bc.addCrumb("Edit " + username, routes.UsersController.editUserForm(username)); | Block reader users access to users forms
Readers users will now only be available of seeing their own edit form.
Fixes #<I> | Graylog2_graylog2-server | train | java |
4a4968128a89cc323efa1621c5e7f49d9eb45c04 | diff --git a/rb/lib/selenium/webdriver/common/service.rb b/rb/lib/selenium/webdriver/common/service.rb
index <HASH>..<HASH> 100644
--- a/rb/lib/selenium/webdriver/common/service.rb
+++ b/rb/lib/selenium/webdriver/common/service.rb
@@ -135,12 +135,12 @@ module Selenium
end
def connect_to_server
- http = Selenium::WebDriver::Remote::Http::Default.new
- http.open_timeout = STOP_TIMEOUT / 2
- http.read_timeout = STOP_TIMEOUT / 2
- http.server_url = uri
- yield http
- http.close
+ Net::HTTP.start(@host, @port) do |http|
+ http.open_timeout = STOP_TIMEOUT / 2
+ http.read_timeout = STOP_TIMEOUT / 2
+
+ yield http
+ end
end
def find_free_port
@@ -164,7 +164,10 @@ module Selenium
def stop_server
return if process_exited?
- connect_to_server { |http| http.call(:get, '/shutdown', nil) }
+ connect_to_server do |http|
+ headers = WebDriver::Remote::Http::Common::DEFAULT_HEADERS.dup
+ http.get('/shutdown', headers)
+ end
end
def process_running? | Revert using HTTP default client for service shutdown
It doesn't play nicely with IEDriverServer which responds with text/html
content-type, while client only supports application/json
Basically reverts <I> while ensuring that default headers are used
so that User-Agent is set properly | SeleniumHQ_selenium | train | rb |
af822204dcdc818b2882b2832e522b9341accf0e | diff --git a/spec/point_spec.rb b/spec/point_spec.rb
index <HASH>..<HASH> 100644
--- a/spec/point_spec.rb
+++ b/spec/point_spec.rb
@@ -2,11 +2,25 @@ require 'spec_helper'
describe GosuEnhanced::Point do
describe '#initialize' do
- it 'should work with two values' do
+ it 'should work with two positive values' do
point = GosuEnhanced::Point.new( 10, 20 )
expect( point.x ).to eq 10
expect( point.y ).to eq 20
end
+
+ it 'should work with negative values' do
+ point = GosuEnhanced::Point.new( -10, 20 )
+ expect( point.x ).to eq -10
+ expect( point.y ).to eq 20
+
+ point = GosuEnhanced::Point.new( 10, -20 )
+ expect( point.x ).to eq 10
+ expect( point.y ).to eq -20
+
+ point = GosuEnhanced::Point.new( -10, -20 )
+ expect( point.x ).to eq -10
+ expect( point.y ).to eq -20
+ end
end
describe '#offset' do | Updated Point spec for negative initialization | JulianNicholls_gosu_enhanced-gem | train | rb |
201e7fcdc438cb7cb4890ae74962419056a43571 | diff --git a/lib/connection.js b/lib/connection.js
index <HASH>..<HASH> 100644
--- a/lib/connection.js
+++ b/lib/connection.js
@@ -155,7 +155,7 @@ module.exports = (function () {
});
return;
}
- next(err, me.config.createCustomIndex);
+ next(null, true);
},
getClasses: ['ensureIndex',
function (next, results) {
@@ -354,4 +354,4 @@ module.exports = (function () {
}
};
-})();
\ No newline at end of file
+})(); | fixed a bug that prevented the adapter from initializing | appscot_sails-orientdb | train | js |
1a401e82f5ff58f0621e864723dbfdd229bff53c | diff --git a/client.go b/client.go
index <HASH>..<HASH> 100644
--- a/client.go
+++ b/client.go
@@ -1337,6 +1337,7 @@ func (cl *Client) AddMagnet(uri string) (t Torrent, err error) {
defer cl.mu.Unlock()
t.torrent = cl.torrent(m.InfoHash)
if t.torrent != nil {
+ t.addTrackers([][]string{m.Trackers})
return
}
t.torrent, err = newTorrent(m.InfoHash, [][]string{m.Trackers}, cl.halfOpenLimit) | Merge trackers by magnet links if the torrent is already present | anacrolix_torrent | train | go |
cc1ee3be927e365793bce5e323d6f92693ee6760 | diff --git a/EventListener/AbstractSerializationListener.php b/EventListener/AbstractSerializationListener.php
index <HASH>..<HASH> 100644
--- a/EventListener/AbstractSerializationListener.php
+++ b/EventListener/AbstractSerializationListener.php
@@ -26,27 +26,27 @@ abstract class AbstractSerializationListener implements EventSubscriberInterface
/**
* @var UploaderHelper
*/
- private $uploaderHelper;
+ protected $uploaderHelper;
/**
* @var Registry
*/
- private $doctrine;
+ protected $doctrine;
/**
* @var ImagineHelper
*/
- private $imagineHelper;
+ protected $imagineHelper;
/**
* @var MetadataReader
*/
- private $metadataReader;
+ protected $metadataReader;
/**
* @var Reader
*/
- private $annotationsReader;
+ protected $annotationsReader;
/**
* @param UploaderHelper $uploaderHelper | Changes in AbstractSerializerBundle | glavweb_GlavwebRestBundle | train | php |
76603126729e1f3b90b625f7192e00d5c1cbd06e | diff --git a/client/server/middleware/unsupported-browser.js b/client/server/middleware/unsupported-browser.js
index <HASH>..<HASH> 100644
--- a/client/server/middleware/unsupported-browser.js
+++ b/client/server/middleware/unsupported-browser.js
@@ -55,7 +55,9 @@ function allowPath( path ) {
? path.replace( new RegExp( `^/${ prefixedLocale }` ), '' )
: path;
- const allowedPaths = [ '/browsehappy', '/themes', '/theme', '/calypso/evergreen' ];
+ // '/calypso' is the static assets path, and should never be redirected. (Can
+ // cause CDN caching issues if an asset gets cached with a redirect.)
+ const allowedPaths = [ '/browsehappy', '/themes', '/theme', '/calypso' ];
// For example, match either exactly "/themes" or "/themes/*"
return allowedPaths.some( ( p ) => parsedPath === p || parsedPath.startsWith( p + '/' ) );
} | Redirect even fewer assets (#<I>) | Automattic_wp-calypso | train | js |
71ecee7a1f5b875bd7eee5786434a96922e240b0 | diff --git a/lib/swag_dev/project/tools/vagrant/composer.rb b/lib/swag_dev/project/tools/vagrant/composer.rb
index <HASH>..<HASH> 100644
--- a/lib/swag_dev/project/tools/vagrant/composer.rb
+++ b/lib/swag_dev/project/tools/vagrant/composer.rb
@@ -2,6 +2,7 @@
require_relative '../vagrant'
require 'pathname'
+require 'yaml'
# rubocop:disable Style/Documentation
class SwagDev::Project::Tools::Vagrant
@@ -27,6 +28,20 @@ class SwagDev::Project::Tools::Vagrant::Composer
@path = ::Pathname.new(path)
end
+ # Dump (boxes) config
+ #
+ # @return [String]
+ def dump
+ ::YAML.dump(boxes)
+ end
+
+ # Denote existence of configured boxes
+ #
+ # @return [Boolean]
+ def boxes?
+ !boxes.empty?
+ end
+
# Get boxes
#
# @return [Hash] | vagrant/composer (tools) methods added | SwagDevOps_kamaze-project | train | rb |
1e73bc2044018443574d0412c29e036ee48c5701 | diff --git a/oandapyV20/definitions/trades.py b/oandapyV20/definitions/trades.py
index <HASH>..<HASH> 100644
--- a/oandapyV20/definitions/trades.py
+++ b/oandapyV20/definitions/trades.py
@@ -8,4 +8,23 @@ definitions = {
"CLOSE_WHEN_TRADABLE": "The Trade will be closed as soon as the "
"trade’s instrument becomes tradeable"
},
+ "TradeStateFilter": {
+ "OPEN": "The Trades that are currently open",
+ "CLOSED": "The Trades that have been fully closed",
+ "CLOSE_WHEN_TRADEABLE": "The Trades that will be closed as soon as "
+ "the trades' instrument becomes tradeable",
+ "ALL": "The Trades that are in any of the possible states listed "
+ "above."
+ },
+ "TradePL": {
+ "POSITIVE": "An open Trade currently has a positive (profitable) "
+ "unrealized P/L, or a closed Trade realized a positive "
+ "amount of P/L.",
+ "NEGATIVE": "An open Trade currently has a negative (losing) "
+ "unrealized P/L, or a closed Trade realized a negative "
+ "amount of P/L",
+ "ZERO": "An open Trade currently has unrealized P/L of zero "
+ "(neither profitable nor losing), or a closed Trade realized "
+ "a P/L amount of zero."
+ }
} | Added: TradeStateFilter, TradePL | hootnot_oanda-api-v20 | train | py |
14c128870ebb0d728bf9114f4362f07aa14c3670 | diff --git a/src/index.js b/src/index.js
index <HASH>..<HASH> 100644
--- a/src/index.js
+++ b/src/index.js
@@ -55,7 +55,7 @@ module.exports = {
+ '[ -f package.json ] && cat package.json | grep -q \'"' + cmd + '"\\s*:\'\n'
// package.json or script can't be found exit
+ '[ $? -ne 0 ] && exit 0\n'
- + 'npm run ' + cmd + ' --silent\n'
+ + 'npm run ' + cmd + ( cmd === 'commitmsg' ? ' $1' : '') + ' --silent\n'
+ 'if [ $? -ne 0 ]; then\n'
+ ' echo\n'
+ ' echo "husky - ' + name + ' hook failed (add --no-verify to bypass)"\n' | pass $1 to script if hook is commitmsg | typicode_husky | train | js |
bd7fd0f7554b45c1b06c39de57e9b479b250711f | diff --git a/src/index.js b/src/index.js
index <HASH>..<HASH> 100644
--- a/src/index.js
+++ b/src/index.js
@@ -399,7 +399,7 @@ class Libp2p extends EventEmitter {
* Called when libp2p has started and before it returns
* @private
*/
- _onDidStart () {
+ async _onDidStart () {
this._isStarted = true
this.connectionManager.start()
@@ -410,7 +410,7 @@ class Libp2p extends EventEmitter {
})
// Peer discovery
- this._setupPeerDiscovery()
+ await this._setupPeerDiscovery()
// Once we start, emit and dial any peers we may have already discovered
for (const peerInfo of this.peerStore.peers.values()) { | fix: await peer discovery start in libp2p start (#<I>) | libp2p_js-libp2p | train | js |
49022f25438f155e352f21c6ae2ed2c61d6101ae | diff --git a/lib/install/loaders/erb.js b/lib/install/loaders/erb.js
index <HASH>..<HASH> 100644
--- a/lib/install/loaders/erb.js
+++ b/lib/install/loaders/erb.js
@@ -5,7 +5,7 @@ module.exports = {
use: [{
loader: 'rails-erb-loader',
options: {
- runner: 'bin/rails runner'
+ runner: (/^win/.test(process.platform) ? 'ruby ' : '') + 'bin/rails runner'
}
}]
} | Prepend bin/rails with ruby executable on Windows in erb-loader (#<I>) | rails_webpacker | train | js |
5ac1e8cf472e8a0cfceef956a50175792e61b50b | diff --git a/epyc/experiment.py b/epyc/experiment.py
index <HASH>..<HASH> 100644
--- a/epyc/experiment.py
+++ b/epyc/experiment.py
@@ -17,7 +17,6 @@
# You should have received a copy of the GNU General Public License
# along with epyc. If not, see <http://www.gnu.org/licenses/gpl.html>.
-#from __future__ import annotations # so we can type instances of Experiment returned from its methods
from datetime import datetime
import traceback
import sys | Removed __future__ | simoninireland_epyc | train | py |
265f962f50fa035c386641a56996fba7fe0917ea | diff --git a/src/extensions/renderer/base/load-listeners.js b/src/extensions/renderer/base/load-listeners.js
index <HASH>..<HASH> 100644
--- a/src/extensions/renderer/base/load-listeners.js
+++ b/src/extensions/renderer/base/load-listeners.js
@@ -1508,7 +1508,7 @@ BRp.load = function(){
var dragDelta = r.touchData.dragDelta;
- if( updatePos && is.number( dragDelta[0] ) && is.number( dragDelta[1] ) ){
+ if( updatePos && dragDelta && is.number( dragDelta[0] ) && is.number( dragDelta[1] ) ){
dPos.x += dragDelta[0];
dPos.y += dragDelta[1];
} | Dragging nodes via touch gives errors in some cases (extensions etc.) #<I> | cytoscape_cytoscape.js | train | js |
ab2a35f9b1742495f7279954601e82a1badc951f | diff --git a/base64.js b/base64.js
index <HASH>..<HASH> 100644
--- a/base64.js
+++ b/base64.js
@@ -12,7 +12,7 @@
len = string.length,
result = '';
- do {
+ while (i < len) {
a = string.charCodeAt(i++) || 0;
b = string.charCodeAt(i++) || 0;
c = string.charCodeAt(i++) || 0;
@@ -29,8 +29,7 @@
}
result += characters.charAt(b1) + characters.charAt(b2) + characters.charAt(b3) + characters.charAt(b4);
-
- } while (i < len);
+ }
return result;
},
@@ -42,7 +41,7 @@
len = string.length,
result = '';
- do {
+ while (i < len) {
b1 = characters.indexOf(string.charAt(i++));
b2 = characters.indexOf(string.charAt(i++));
b3 = characters.indexOf(string.charAt(i++));
@@ -53,8 +52,7 @@
c = ((b3 & 0x3) << 6) | (b4 & 0x3F);
result += fromCharCode(a) + (b?fromCharCode(b):'') + (c?fromCharCode(c):'');
-
- } while (i < len);
+ }
return result;
} | Replaced `do while` loops with standard `while` loops. | davidchambers_Base64.js | train | js |
c2717f753c1eadd42c06d1205f4ee0848da94dcb | diff --git a/src/Core/Controller/AbstractCoreController.php b/src/Core/Controller/AbstractCoreController.php
index <HASH>..<HASH> 100644
--- a/src/Core/Controller/AbstractCoreController.php
+++ b/src/Core/Controller/AbstractCoreController.php
@@ -1,7 +1,15 @@
<?php
+/**
+ * YAWIK
+ *
+ * @filesource
+ * @copyright (c) 2013-2014 Cross Solution (http://cross-solution.de)
+ * @license MIT
+ */
namespace Core\Controller;
+use Auth\Controller\Plugin\Auth;
use Core\Controller\Plugin\Notification;
use Zend\Mvc\Controller\AbstractActionController;
@@ -9,6 +17,7 @@ use Zend\Mvc\Controller\AbstractActionController;
* Class AbstractCoreController
*
* @method Notification notification()
+ * @method Auth auth()
*
* @package Core\Controller
*/ | Y<I> Change/Assign Company to Organization in Job offer | yawik_core | train | php |
e225acd179ec57f7b716ac3dd7c37ae4d0d7570f | diff --git a/server/client.go b/server/client.go
index <HASH>..<HASH> 100644
--- a/server/client.go
+++ b/server/client.go
@@ -1031,7 +1031,7 @@ func (c *client) readLoop(pre []byte) {
// Check if the account has mappings and if so set the local readcache flag.
// We check here to make sure any changes such as config reload are reflected here.
if c.kind == CLIENT {
- if c.acc.hasMappings() {
+ if c.Account().hasMappings() {
c.in.flags.set(hasMappings)
} else {
c.in.flags.clear(hasMappings)
@@ -4409,8 +4409,9 @@ func (c *client) Account() *Account {
return nil
}
c.mu.Lock()
- defer c.mu.Unlock()
- return c.acc
+ acc := c.acc
+ c.mu.Unlock()
+ return acc
}
// prunePerAccountCache will prune off a random number of cache entries. | Fix race accessing c.acc checking for mappings | nats-io_gnatsd | train | go |
30216a58e12d840579e80f5993be5d95ef3f1a4b | diff --git a/Resources/public/js/comments/controllers/portfoliosController.js b/Resources/public/js/comments/controllers/portfoliosController.js
index <HASH>..<HASH> 100644
--- a/Resources/public/js/comments/controllers/portfoliosController.js
+++ b/Resources/public/js/comments/controllers/portfoliosController.js
@@ -10,7 +10,6 @@ commentsApp
function(data) {
$scope.portfolios = data;
$scope.clickOnPortolio($scope.selectedPortfolioId);
- commentsManager.loadComments($scope.selectedPortfolioId);
},
function(errorPayload) {
console.error('failure loading portfolios', errorPayload); | [PortfolioBundle] Fix duplicate display of comments | claroline_Distribution | train | js |
cfdced2392a971627ef9ca7d96292341f17503d2 | diff --git a/interfaces/python/infomap.py b/interfaces/python/infomap.py
index <HASH>..<HASH> 100644
--- a/interfaces/python/infomap.py
+++ b/interfaces/python/infomap.py
@@ -1896,7 +1896,16 @@ class Infomap(InfomapWrapper):
_, ext = os.path.splitext(filename)
# remove the dot
- writer = "write_{}".format(ext[1:])
+ ext = ext[1:]
+
+ if ext == "ftree":
+ ext = "flow_tree"
+ elif ext == "nwk":
+ ext = "newick"
+ elif ext == "net":
+ ext = "pajek"
+
+ writer = "write_{}".format(ext)
if hasattr(self, writer):
return getattr(self, writer)(filename, *args, **kwargs)
@@ -2029,11 +2038,6 @@ class Infomap(InfomapWrapper):
"""
return self.network.writePajekNetwork(filename, flow)
- # for the method "write"
- write_ftree = write_flow_tree
- write_nwk = write_newick
- write_net = write_pajek
-
def main():
import sys | refactor(python): Map to writer methods inside "write" | mapequation_infomap | train | py |
fa0caab77e1f725442c1981283fddf02b458a88c | diff --git a/lib/Doctrine/DBAL/Schema/Constraint.php b/lib/Doctrine/DBAL/Schema/Constraint.php
index <HASH>..<HASH> 100644
--- a/lib/Doctrine/DBAL/Schema/Constraint.php
+++ b/lib/Doctrine/DBAL/Schema/Constraint.php
@@ -21,10 +21,12 @@
namespace Doctrine\DBAL\Schema;
+use Doctrine\DBAL\Platforms\AbstractPlatform;
+
/**
* Marker interface for contraints
*
- *
+ *
* @link www.doctrine-project.org
* @since 2.0
* @version $Revision$
@@ -34,5 +36,7 @@ interface Constraint
{
public function getName();
+ public function getQuotedName(AbstractPlatform $platform);
+
public function getColumns();
} | Added a missing method in the Constraint interface | doctrine_dbal | train | php |
1c86f95ae4fdfe417644db6dd2f9e964ac75d246 | diff --git a/lollygag/core/single_site/link_crawler.py b/lollygag/core/single_site/link_crawler.py
index <HASH>..<HASH> 100644
--- a/lollygag/core/single_site/link_crawler.py
+++ b/lollygag/core/single_site/link_crawler.py
@@ -31,7 +31,8 @@ class LinkCrawler(HTMLParser, Crawler):
return HTMLParser.feed(self, data)
def handle_starttag(self, tag, attrs):
- #pylint: disable=unused-argument
+ if tag != 'a':
+ return
for attribute in attrs:
if attribute[0] == "href":
self._links.add(attribute[1]) | Linkcrawler will only search for links in <a> tags | snorrwe_lollygag | train | py |
c9358c4877994462a83f7b2f9c0b2f1e80490843 | diff --git a/src/providers/sh/util/index.js b/src/providers/sh/util/index.js
index <HASH>..<HASH> 100755
--- a/src/providers/sh/util/index.js
+++ b/src/providers/sh/util/index.js
@@ -253,7 +253,7 @@ module.exports = class Now extends EventEmitter {
if (!quiet && type === 'npm' && deployment.nodeVersion) {
if (engines && engines.node && !missingVersion) {
log(chalk`Using Node.js {bold ${
- deployment.nodeVersion}} (requested: {dim \`${engines.node}\`)`)
+ deployment.nodeVersion}} (requested: {dim \`${engines.node}\`})`)
} else {
log(chalk`Using Node.js {bold ${deployment.nodeVersion}} (default)`)
} | Ensure `chalk` is being used properly (#<I>) | zeit_now-cli | train | js |
0f400567a7f5e83d5da35347a4b9fb2684128f1c | diff --git a/couchbase/views/params.py b/couchbase/views/params.py
index <HASH>..<HASH> 100644
--- a/couchbase/views/params.py
+++ b/couchbase/views/params.py
@@ -510,9 +510,9 @@ class Query(object):
Returns the (uri_part, post_data_part) for a long query.
"""
uristr = self._encode(omit_keys=True)
- kstr = ""
+ kstr = "{}"
- klist = self._real_options.get('keys', None)
+ klist = self._real_options.get('keys', UNSPEC)
if klist != UNSPEC:
kstr = '{{"keys":{0}}}'.format(klist) | PYCBC-<I>, PYCBC-<I>: Don't send invalid JSON in POST when no keys
We might still want to consider what to do in this case, but sending
'None' is certainly wrong :)
Change-Id: I<I>f<I>f<I>cc1f<I>a<I>e<I>ea<I>
Reviewed-on: <URL> | couchbase_couchbase-python-client | train | py |
6862c0a997b453fdfb7da7fcb49021d69123f260 | diff --git a/python/setup.py b/python/setup.py
index <HASH>..<HASH> 100644
--- a/python/setup.py
+++ b/python/setup.py
@@ -35,7 +35,7 @@ if platform == 'darwin':
setup(
name = 'cm_api',
- version = '8.0.0', # Compatible with API v8 (CM 5.2)
+ version = '9.0.0', # Compatible with API v9 (CM 5.3)
packages = find_packages('src', exclude=['cm_api_tests']),
package_dir = {'cm_api': 'src/cm_api',
'cm_shell': 'src/cm_shell'},
diff --git a/python/src/cm_api/api_client.py b/python/src/cm_api/api_client.py
index <HASH>..<HASH> 100644
--- a/python/src/cm_api/api_client.py
+++ b/python/src/cm_api/api_client.py
@@ -30,7 +30,7 @@ __docformat__ = "epytext"
LOG = logging.getLogger(__name__)
API_AUTH_REALM = "Cloudera Manager"
-API_CURRENT_VERSION = 8
+API_CURRENT_VERSION = 9
class ApiException(RestException):
""" | OPSAPS-<I>. Bump API version to 9 for CM<I>.
Introduced V9 API for CM<I>. So bumping the version to 9 in the python API
too. | cloudera_cm_api | train | py,py |
7a17e9ba793a7ada9ed13fc4556c6d2018f79add | diff --git a/lib/cuke_modeler/example.rb b/lib/cuke_modeler/example.rb
index <HASH>..<HASH> 100644
--- a/lib/cuke_modeler/example.rb
+++ b/lib/cuke_modeler/example.rb
@@ -46,10 +46,11 @@ module CukeModeler
def add_row(row)
case
when row.is_a?(Array)
- @rows << Hash[@parameters.zip(row.collect { |value| value.strip })]
+ @rows << Hash[@parameters.zip(row.collect { |value| value.to_s.strip })]
@row_elements << Row.new("|#{row.join('|')}|")
when row.is_a?(Hash)
- @rows << row.each_value { |value| value.strip! }
+ @parameters = row.keys if @parameters.empty?
+ @rows << row.each_value { |value| value.to_s.strip }
@row_elements << Row.new("|#{ordered_row_values(row).join('|')}|")
else
raise(ArgumentError, "Can only add row from a Hash or an Array but received #{row.class}")
@@ -173,7 +174,7 @@ module CukeModeler
end
def string_for(cells, index)
- cells[index] ? cells[index].ljust(determine_buffer_size(index)) : ''
+ cells[index] ? cells[index].to_s.ljust(determine_buffer_size(index)) : ''
end
def ordered_row_values(row_hash) | Fix a few issues creating examples from scratch | enkessler_cuke_modeler | train | rb |
2814e1426b46381e82274a1f95973d3e15235baf | diff --git a/Admin/PageAdmin.php b/Admin/PageAdmin.php
index <HASH>..<HASH> 100644
--- a/Admin/PageAdmin.php
+++ b/Admin/PageAdmin.php
@@ -138,7 +138,18 @@ class PageAdmin extends Admin
->add('name')
->add('enabled', null, array('required' => false))
->add('position')
- ->add('type', 'sonata_page_type_choice', array('required' => false))
+ ->end();
+
+ if ($this->hasSubject() && !$this->getSubject()->isInternal()) {
+ $formMapper
+ ->with($this->trans('form_page.group_main_label'))
+ ->add('type', 'sonata_page_type_choice', array('required' => false))
+ ->end()
+ ;
+ }
+
+ $formMapper
+ ->with($this->trans('form_page.group_main_label'))
->add('templateCode', 'sonata_page_template', array('required' => true))
->add('parent', 'sonata_page_selector', array(
'page' => $this->getSubject() ?: null, | Tweak page type for internal page | sonata-project_SonataPageBundle | train | php |
860f4c078d68c208df36b82d09f35f623529c22b | diff --git a/src/Middleware/Collection.php b/src/Middleware/Collection.php
index <HASH>..<HASH> 100644
--- a/src/Middleware/Collection.php
+++ b/src/Middleware/Collection.php
@@ -23,9 +23,9 @@ class Collection extends \ArrayObject
protected function validate(array $middlewares)
{
foreach ($middlewares as $middleware) {
- if (!(is_callable($middleware) || is_subclass_of($middleware, MiddlewareInterface::class))) {
+ if (!(is_callable($middleware) || method_exists($middleware, '__invoke'))) {
throw new \DomainException(
- 'All elements of $middlewares must be callable or implement Relay\\MiddlewareInterface'
+ 'All elements of $middlewares must be callable or implement __invoke()'
);
}
}
diff --git a/tests/Middleware/CollectionTest.php b/tests/Middleware/CollectionTest.php
index <HASH>..<HASH> 100644
--- a/tests/Middleware/CollectionTest.php
+++ b/tests/Middleware/CollectionTest.php
@@ -15,7 +15,7 @@ class MiddlewareCollectionTest extends TestCase
{
$this->setExpectedException(
'\\DomainException',
- 'All elements of $middlewares must be callable or implement Relay\\MiddlewareInterface'
+ 'All elements of $middlewares must be callable or implement __invoke()'
);
$middlewares = ['foo']; | Relax validation in Middleware\Collection
This is intended to be a temporary measure to allow middlewares
included in Middleware\DefaultCollection to be considered valid
until such time as they implement Relay\MiddlewareInterface.
Refs #<I> | equip_framework | train | php,php |
d8dc262788bc6b5498e10689261237fea6060741 | diff --git a/client/gutenberg/editor/hooks/components/media-upload/utils.js b/client/gutenberg/editor/hooks/components/media-upload/utils.js
index <HASH>..<HASH> 100644
--- a/client/gutenberg/editor/hooks/components/media-upload/utils.js
+++ b/client/gutenberg/editor/hooks/components/media-upload/utils.js
@@ -2,7 +2,7 @@
/**
* External dependencies
*/
-import { get, reduce } from 'lodash';
+import { get, head, reduce, split } from 'lodash';
/**
* WordPress dependencies
@@ -43,6 +43,7 @@ export const mediaCalypsoToGutenberg = media => {
),
},
title: get( media, 'title' ),
+ type: head( split( get( media, 'mime_type', '' ), '/' ) ),
width: get( media, 'width' ),
};
}; | Adds the expected type to the media library mapping to Gutenberg's media schema (#<I>) | Automattic_wp-calypso | train | js |
929c794a21924719d707e048d3e9621f0041221a | diff --git a/scripts/version.js b/scripts/version.js
index <HASH>..<HASH> 100644
--- a/scripts/version.js
+++ b/scripts/version.js
@@ -5,12 +5,12 @@ replace({
'files': 'dist/**/*.js',
'replace': 'VERSION_STRING',
'with': pkg.version
-}).then((changedFiles) => {
+}).then(function(changedFiles) {
if (changedFiles.length > 0) {
console.log('Versioned:', changedFiles.join(', '));
} else {
console.log('No files versioned. Did you build?');
}
-}).catch((err) => {
+}).catch(function(err) {
throw err;
}); | no arrow syntax for more compatibility | ionic-team_legacy-ionic-cloud | train | js |
c53852d8ea4209ea423ae5db1751e7aff0130189 | diff --git a/resource_aws_ecs_service.go b/resource_aws_ecs_service.go
index <HASH>..<HASH> 100644
--- a/resource_aws_ecs_service.go
+++ b/resource_aws_ecs_service.go
@@ -36,6 +36,7 @@ func resourceAwsEcsService() *schema.Resource {
Type: schema.TypeString,
Optional: true,
Computed: true,
+ ForceNew: true,
},
"task_definition": &schema.Schema{
@@ -131,6 +132,10 @@ func resourceAwsEcsServiceRead(d *schema.ResourceData, meta interface{}) error {
return err
}
+ if len(out.Services) < 1 {
+ return nil
+ }
+
service := out.Services[0]
log.Printf("[DEBUG] Received ECS service %#v", service) | aws: Allow migrating (recreating) ecs_service to another cluster | terraform-providers_terraform-provider-aws | train | go |
e2e3f46ed36b3df7e7d768810e284597eaa0e1b1 | diff --git a/packages/notifications-flyout/src/presenters/PanelPresenter.js b/packages/notifications-flyout/src/presenters/PanelPresenter.js
index <HASH>..<HASH> 100644
--- a/packages/notifications-flyout/src/presenters/PanelPresenter.js
+++ b/packages/notifications-flyout/src/presenters/PanelPresenter.js
@@ -32,7 +32,7 @@ export default function PanelPresenter({
{
transitionState: null,
loadingTransitionState,
- customStylesheet
+ stylesheet: customStylesheet
},
resolvedRoles
); | fix: passing stylesheet incorrectly to flyout panel | Autodesk_hig | train | js |
a2d4b37c6d86937f21119e2fccd7e2668b67bb08 | diff --git a/bosh-stemcell/spec/bosh/stemcell/stage_collection_spec.rb b/bosh-stemcell/spec/bosh/stemcell/stage_collection_spec.rb
index <HASH>..<HASH> 100644
--- a/bosh-stemcell/spec/bosh/stemcell/stage_collection_spec.rb
+++ b/bosh-stemcell/spec/bosh/stemcell/stage_collection_spec.rb
@@ -200,6 +200,7 @@ module Bosh::Stemcell
:bosh_clean_ssh,
:image_create,
:image_install_grub,
+ :bosh_package_list
]
} | Add missing package expectation in Google stemcell building test
- This should fix the failing Travis test on the PR
[#<I>](<URL>) | cloudfoundry_bosh | train | rb |
c13f6340d080734693d3814e9e961c4ed8a5f1ee | diff --git a/docs/conf.py b/docs/conf.py
index <HASH>..<HASH> 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -24,7 +24,7 @@ master_doc = 'index'
# General information about the project.
project = u'vtki'
copyright = u'2017-2019, Alex Kaszynski'
-author = u'Alex Kaszynski'
+author = u'Alex Kaszynski & Bane Sullivan'
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the | Add Bane to docs author list | vtkiorg_vtki | train | py |
3475c7a7b4de7caf82024ce01c02f0fe8af3c87f | diff --git a/lib/hci-socket/bindings.js b/lib/hci-socket/bindings.js
index <HASH>..<HASH> 100644
--- a/lib/hci-socket/bindings.js
+++ b/lib/hci-socket/bindings.js
@@ -121,6 +121,11 @@ BlenoBindings.prototype.onAddressChange = function(address) {
};
BlenoBindings.prototype.onReadLocalVersion = function(hciVer, hciRev, lmpVer, manufacturer, lmpSubVer) {
+ if (manufacturer === 2) {
+ // Intel Corporation
+ this._gatt.maxMtu = 23;
+ }
+
if (manufacturer === 93) {
// Realtek Semiconductor Corporation
this._gatt.maxMtu = 23; | Limit MTU to <I> for Intel devices
Intel <I> does not seem to like MTU's higher than <I>, making services and characteristics undiscoverable on devices such as iPhones. See Issue #<I> for more information. | noble_bleno | train | js |
ad53ff5fdf71600c5072e4bcef7e3c1c164993f6 | diff --git a/vm/vm.luajs.js b/vm/vm.luajs.js
index <HASH>..<HASH> 100644
--- a/vm/vm.luajs.js
+++ b/vm/vm.luajs.js
@@ -838,17 +838,16 @@ luajs.VM.Function.operations = [
{
name: 'VARARG',
handler: function (a, b) {
- var i;
+ var i,
+ limit = b === 0? this._params.length : b - 1;
- if (b === 0) {
- for (i = 0; i < this._params.length; i++) {
- this._register[a + i] = this._params[this._data.paramCount + i];
- }
-
- } else {
- for (i = 0; i < b - 1; i++) {
- this._register[a + i] = this._params[this._data.paramCount + i];
- }
+ for (i = 0; i < limit; i++) {
+ this._register[a + i] = this._params[this._data.paramCount + i];
+ }
+
+ // Assumption: Clear the remaining items in the register.
+ for (i = a + limit; i < this._register.length; i++) {
+ delete this._register[i];
}
}
} | Varargs hopefully put to bed. Now clears remaining register items after insertion. | gamesys_moonshine | train | js |
84ccfecf7c022e60ae664b78b7202aa37ea4969f | diff --git a/test/extended/util/db_image_helpers.go b/test/extended/util/db_image_helpers.go
index <HASH>..<HASH> 100644
--- a/test/extended/util/db_image_helpers.go
+++ b/test/extended/util/db_image_helpers.go
@@ -169,7 +169,7 @@ func WaitUntilUp(oc *CLI, d Database, timeout time.Duration) error {
// WaitUntilAllHelpersAreUp waits until all helpers are ready to serve requests
func WaitUntilAllHelpersAreUp(oc *CLI, helpers []Database) error {
for _, m := range helpers {
- if err := WaitUntilUp(oc, m, 120*time.Second); err != nil {
+ if err := WaitUntilUp(oc, m, 180*time.Second); err != nil {
return err
}
} | increase timeout for helper pods | openshift_origin | train | go |
504b40ddb21b69796f81bf87cb1e5e33b07a58d0 | diff --git a/src/Charcoal/Admin/AdminScript.php b/src/Charcoal/Admin/AdminScript.php
index <HASH>..<HASH> 100644
--- a/src/Charcoal/Admin/AdminScript.php
+++ b/src/Charcoal/Admin/AdminScript.php
@@ -14,11 +14,16 @@ use Charcoal\App\Script\AbstractScript;
// Module `charcoal-property` dependencies
use Charcoal\Property\PropertyInterface;
+// From 'charcoal-translator'
+use Charcoal\Translator\TranslatorAwareTrait;
+
/**
*
*/
abstract class AdminScript extends AbstractScript
{
+ use TranslatorAwareTrait;
+
/**
* @var FactoryInterface $modelFactory
*/
@@ -31,6 +36,8 @@ abstract class AdminScript extends AbstractScript
public function setDependencies(Container $container)
{
$this->modelFactory = $container['model/factory'];
+ $this->setTranslator($container['translator']);
+
parent::setDependencies($container);
} | Add translator to base admin script (therefore, all admin scripts). | locomotivemtl_charcoal-admin | train | php |
752cd77652e48e6be168610fd630dbe607d40997 | diff --git a/graphene/core/fields.py b/graphene/core/fields.py
index <HASH>..<HASH> 100644
--- a/graphene/core/fields.py
+++ b/graphene/core/fields.py
@@ -55,7 +55,12 @@ class Field(object):
if resolve_fn:
return resolve_fn(instance, args, info)
else:
- return instance.get_field(self.field_name)
+ if isinstance(instance, BaseObjectType):
+ return instance.get_field(self.field_name)
+ if hasattr(instance, self.field_name):
+ return getattr(instance, self.field_name)
+ elif hasattr(instance, self.name):
+ return getattr(instance, self.name)
@memoize
def get_resolve_fn(self):
@@ -74,6 +79,8 @@ class Field(object):
def get_object_type(self, schema):
field_type = self.field_type
+ if inspect.isfunction(field_type):
+ field_type = field_type(self)
_is_class = inspect.isclass(field_type)
if isinstance(field_type, Field):
return field_type.get_object_type(schema) | Improved field resolving if instance is not wrapped | graphql-python_graphene | train | py |
3ceb4085cbce75d2d16a132f797389eede28b39f | diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/util/MetaUtil.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/util/MetaUtil.java
index <HASH>..<HASH> 100644
--- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/util/MetaUtil.java
+++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/util/MetaUtil.java
@@ -91,8 +91,6 @@ public class MetaUtil {
IPrimitiveType<String> value = (IPrimitiveType<String>) theContext.getElementDefinition("uri").newInstance();
value.setValue(theValue);
sourceExtension.setValue(value);
- } else {
- throw new UnsupportedOperationException(MetaUtil.class.getSimpleName() + ".setSource() not supported on FHIR Version " + theContext.getVersion().getVersion());
}
} | fix test (not super happy about this fix, but I think it's the right thing to do) | jamesagnew_hapi-fhir | train | java |
2870f21446a4a9bfe2d8929cbc655bbb31498da7 | diff --git a/addok/index_utils.py b/addok/index_utils.py
index <HASH>..<HASH> 100644
--- a/addok/index_utils.py
+++ b/addok/index_utils.py
@@ -167,7 +167,7 @@ def index_document(doc, update_ngrams=True):
pipe = DB.pipeline()
housenumbers = None
index_geohash(pipe, key, doc['lat'], doc['lon'])
- importance = doc.get('importance', 0.0) * config.IMPORTANCE_WEIGHT
+ importance = float(doc.get('importance', 0.0)) * config.IMPORTANCE_WEIGHT
tokens = {}
for field in config.FIELDS:
name = field['key'] | Parse importance to float before doing math | addok_addok | train | py |
9855de91b881e66f13440a7b50225c52670e9e22 | diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -41,7 +41,7 @@ try:
from setuptools import setup
kw = {
'install_requires': [
- 'pycrypto >= 2.1, != 2.4',
+ 'pycrypto>=2.1,!=2.4',
'ecdsa',
],
} | Remove whitespace in install_requires to avoid potential setuptools bugs
Fixes #<I> | paramiko_paramiko | train | py |
4fcb036fcacb8a92d5443707a221878e50ea44be | diff --git a/src/renderable/sprite.js b/src/renderable/sprite.js
index <HASH>..<HASH> 100644
--- a/src/renderable/sprite.js
+++ b/src/renderable/sprite.js
@@ -32,7 +32,7 @@
* private/internal scale factor
* @ignore
*/
- this._scale = new me.Vector2d();
+ this._scale = new me.Vector2d(1, 1);
// if true, image flipping/scaling is needed
this.scaleFlag = false;
@@ -60,9 +60,6 @@
*/
this._sourceAngle = 0;
- // image reference
- this.image = null;
-
// to manage the flickering effect
this.flickering = false;
this.flickerDuration = 0;
@@ -77,22 +74,9 @@
this._super(me.Renderable, "init", [x, y,
framewidth || image.width,
frameheight || image.height]);
+
// cache image reference
this.image = image;
-
- // scale factor of the object
- this._scale.set(1.0, 1.0);
- this.lastflipX = this.lastflipY = false;
- this.scaleFlag = false;
-
- // set the default sprite index & offset
- this.offset.set(0, 0);
-
- // non persistent per default
- this.isPersistent = false;
-
- // and not flickering
- this.flickering = false;
},
/** | Cleanup in me.Sprite; thanks @xorinzor | melonjs_melonJS | train | js |
4c930992588219fa2b46f5e53989ebe390c508e2 | diff --git a/src/server/pkg/sync/sync.go b/src/server/pkg/sync/sync.go
index <HASH>..<HASH> 100644
--- a/src/server/pkg/sync/sync.go
+++ b/src/server/pkg/sync/sync.go
@@ -151,8 +151,14 @@ func (p *Puller) Pull(client *pachclient.APIClient, root string, repo, commit, f
}
if tree != nil {
treePath := path.Join(treeRoot, basepath)
- if err := tree.PutFile(treePath, fileInfo.Objects, int64(fileInfo.SizeBytes)); err != nil {
- return err
+ if fileInfo.FileType == pfs.FileType_DIR {
+ if err := tree.PutDir(treePath); err != nil {
+ return err
+ }
+ } else {
+ if err := tree.PutFile(treePath, fileInfo.Objects, int64(fileInfo.SizeBytes)); err != nil {
+ return err
+ }
}
}
path := filepath.Join(root, basepath) | Don't pull directories as files to stats branch. | pachyderm_pachyderm | train | go |
83f71540afb1efd8100fad1c5e359f8c3ae2b9de | diff --git a/core/src/main/java/hudson/model/Actionable.java b/core/src/main/java/hudson/model/Actionable.java
index <HASH>..<HASH> 100644
--- a/core/src/main/java/hudson/model/Actionable.java
+++ b/core/src/main/java/hudson/model/Actionable.java
@@ -267,8 +267,12 @@ public abstract class Actionable extends AbstractModelObject implements ModelObj
List<Action> current = getOrCreateActions();
boolean found = false;
for (Action a1 : current) {
- if (!found && a.equals(a1)) {
- found = true;
+ if (!found) {
+ if (a.equals(a1)) {
+ found = true;
+ } else if (clazz.isInstance(a1)) {
+ old.add(a1);
+ }
} else if (clazz.isInstance(a1) && !a.equals(a1)) {
old.add(a1);
} | [JENKINS-<I>] Oleg wants to reduce the number of times we call `Action.equals()`
- cannot use a local variable as the optimization only applies while we have not found the action being added | jenkinsci_jenkins | train | java |
13a683180d86fa6f5bf182e7a08146c23e1e4170 | diff --git a/core/src/main/java/fr/labri/gumtree/io/TreeIoUtils.java b/core/src/main/java/fr/labri/gumtree/io/TreeIoUtils.java
index <HASH>..<HASH> 100644
--- a/core/src/main/java/fr/labri/gumtree/io/TreeIoUtils.java
+++ b/core/src/main/java/fr/labri/gumtree/io/TreeIoUtils.java
@@ -293,7 +293,7 @@ public final class TreeIoUtils {
}
}
- private static String toJSON(Tree t) {
+ public static String toJSON(Tree t) {
StringWriter s = new StringWriter();
String result = null;
try { | Make public
In case clients want a string and not a file write side effect. | GumTreeDiff_gumtree | train | java |
b1ace59a734b85e060862d9aecaf3801bd2e3017 | diff --git a/login/index.php b/login/index.php
index <HASH>..<HASH> 100644
--- a/login/index.php
+++ b/login/index.php
@@ -130,7 +130,7 @@
}
// check whether the user should be changing password
- if (get_user_preferences('auth_forcepasswordchange', false)){
+ if (get_user_preferences('auth_forcepasswordchange', false) || $frm->password == 'changeme'){
if (isset($passwordchangeurl)) {
redirect($passwordchangeurl);
} else { | Anyone with the password "changeme" needs to change it | moodle_moodle | train | php |
f1084dc0fb0aa3aea2878e8db0b3591ce70e3003 | diff --git a/chunk/src/main/java/org/duracloud/chunk/writer/DuracloudContentWriter.java b/chunk/src/main/java/org/duracloud/chunk/writer/DuracloudContentWriter.java
index <HASH>..<HASH> 100644
--- a/chunk/src/main/java/org/duracloud/chunk/writer/DuracloudContentWriter.java
+++ b/chunk/src/main/java/org/duracloud/chunk/writer/DuracloudContentWriter.java
@@ -143,14 +143,14 @@ public class DuracloudContentWriter implements ContentWriter {
try {
// Write chunk as a temp file if no jumpstart and a content item already exists
- //
- if(exists){
+ if(!jumpStart && exists){
chunkFile = IOUtil.writeStreamToFile(chunk);
chunkChecksum = getChunkChecksum(chunkFile);
}
- // Write chunk if it is not already in storage (or jumpstart is enabled)
+ // Write chunk if jump start is enabled or it does not exist in storage or
+ // it exists in storage but checksums do not match
if (jumpStart || !exists || !chunkInStorage(spaceId, chunkId, chunkChecksum)) {
final File chunkFile1 = chunkFile;
final String chunkChecksum1 = chunkChecksum; | Improves code comment and ensures that chunks are written to temp file only when the file exists in storage and we're not in jump start mode. | duracloud_duracloud | train | java |
23e06679205c7023a2dbdf662a434bf168520a57 | diff --git a/demo/demo.php b/demo/demo.php
index <HASH>..<HASH> 100644
--- a/demo/demo.php
+++ b/demo/demo.php
@@ -30,7 +30,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-set_time_limit(60);
+set_time_limit(0);
$start = microtime(true);
require_once "../Highlight/Autoloader.php"; | Don't let demo.php time out | scrivo_highlight.php | train | php |
88497c87037cece9c4ebabcf2b1a0b8d2bd6b359 | diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -13,7 +13,7 @@ with open(path.join(here, 'README.rst'), encoding='utf-8') as f:
setup(
name='shipane_sdk',
- version='1.0.0.a15',
+ version='1.0.0.b1',
description=u'实盘易(ShiPanE)Python SDK,通达信自动化交易 API。',
long_description=long_description, | Release <I>.b1 | sinall_ShiPanE-Python-SDK | train | py |
b5c5a03693c926e67b1b4d93894acf7056356764 | diff --git a/OrchidCore/src/main/java/com/eden/orchid/utilities/OrchidUtils.java b/OrchidCore/src/main/java/com/eden/orchid/utilities/OrchidUtils.java
index <HASH>..<HASH> 100644
--- a/OrchidCore/src/main/java/com/eden/orchid/utilities/OrchidUtils.java
+++ b/OrchidCore/src/main/java/com/eden/orchid/utilities/OrchidUtils.java
@@ -32,6 +32,7 @@ import java.util.Arrays;
import java.util.Collection;
import java.util.Formatter;
import java.util.HashMap;
+import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Objects;
@@ -179,7 +180,10 @@ public final class OrchidUtils {
}
}
- for(String key : namedArgs.keySet()) {
+ Iterator<String> it = namedArgs.keySet().iterator();
+
+ while(it.hasNext()) {
+ String key = it.next();
Object value = namedArgs.get(key);
boolean removeObject = false;
@@ -194,7 +198,7 @@ public final class OrchidUtils {
}
if(removeObject) {
- namedArgs.remove(key);
+ it.remove();
}
} | Replaces foreach with iterator when removing empty command-line args | JavaEden_Orchid | train | java |
532df951c09e43659f86bab966b854b4cab79563 | diff --git a/src/ox_modules/module-web.js b/src/ox_modules/module-web.js
index <HASH>..<HASH> 100644
--- a/src/ox_modules/module-web.js
+++ b/src/ox_modules/module-web.js
@@ -280,11 +280,11 @@ export default class WebModule extends WebDriverModule {
async dispose(status) {
this._whenWebModuleDispose = defer();
- if (!status || typeof status !== 'string' || !['passed', 'failed', 'canceled'].includes(status.toLowerCase())) {
+ /*if (!status || typeof status !== 'string' || !['passed', 'failed', 'canceled'].includes(status.toLowerCase())) {
throw new OxError(errHelper.errorCode.SCRIPT_ERROR, 'Status argument is required and should be "passed" or "failed"');
- }
+ }*/
- if (this.driver && this.isInitialized) {
+ if (status && this.driver && this.isInitialized) {
try {
status = status.toUpperCase(); | Temporary fix for calling dispose with null argument. | oxygenhq_oxygen | train | js |
3e0fc5a4cd9aaf6b00cbeba6d5778dd6de621f21 | diff --git a/bundles/org.eclipse.orion.client.ui/web/orion/widgets/nav/common-nav.js b/bundles/org.eclipse.orion.client.ui/web/orion/widgets/nav/common-nav.js
index <HASH>..<HASH> 100644
--- a/bundles/org.eclipse.orion.client.ui/web/orion/widgets/nav/common-nav.js
+++ b/bundles/org.eclipse.orion.client.ui/web/orion/widgets/nav/common-nav.js
@@ -161,7 +161,7 @@ define([
var itemId = this.model.getId(item);
var itemNode = lib.node(itemId);
if (itemNode) {
- afterShow();
+ if (afterShow) { afterShow(); }
} else if(item.Parents && item.Parents.length>0) {
item.Parents[0].Parents = item.Parents.slice(1);
this.expandItem(item.Parents[0], afterShow);
@@ -170,7 +170,7 @@ define([
expandItem: function(item, afterExpand) {
this.showItem(item, function() {
if (this.myTree.isExpanded(item)) {
- afterExpand();
+ if (afterExpand) { afterExpand(); }
} else {
this.myTree.expand(this.model.getId(item), afterExpand);
} | callbacks for showItem/expandItem may be undefined | eclipse_orion.client | train | js |
68d87bcebe1c4f5d35f043b0006dcbda39b1cac9 | diff --git a/lib/parser.js b/lib/parser.js
index <HASH>..<HASH> 100644
--- a/lib/parser.js
+++ b/lib/parser.js
@@ -62,10 +62,9 @@ function parser (data, opts) {
function publish () {
if (opts.newline) {
var lines = this.payload.toString().split('\n').slice(0, -1)
-
lines.forEach(function (line) {
this.push(buildObject(line))
- this.payload.consume(new Buffer(line + '\n').length)
+ this.payload.consume(Buffer.byteLength(line) + 1)
}.bind(this))
} else {
this.push(buildObject(this.payload)) | optimize publish() function with newline option, 3x faster, less memory usage | mcollina_docker-loghose | train | js |
372044b3bb932757eb50a5238c0fa783bae842dc | diff --git a/tests.py b/tests.py
index <HASH>..<HASH> 100644
--- a/tests.py
+++ b/tests.py
@@ -1853,6 +1853,18 @@ class QueryResultWrapperTestCase(ModelTestCase):
self.assertTrue(isinstance(comments._qr, NaiveQueryResultWrapper))
+ # Go up two levels and use aliases for the joined instances.
+ comments = (Comment
+ .select(Comment, Blog, User)
+ .join(Blog, on=(Comment.blog == Blog.pk).alias('bx'))
+ .join(User, on=(Blog.user == User.id).alias('ux'))
+ .where(User.username == 'u1')
+ .order_by(Comment.id))
+ with self.assertQueryCount(1):
+ self.assertEqual([c.comment for c in comments], ['c11', 'c12'])
+ self.assertEqual([c.bx.title for c in comments], ['b1', 'b1'])
+ self.assertEqual([c.bx.ux.username for c in comments], ['u1', 'u1'])
+
def test_naive(self):
u1 = User.create(username='u1')
u2 = User.create(username='u2') | Add additional test for join attrs. | coleifer_peewee | train | py |
bf5fc7d381404c2a218d4c28865b251d6e8e1cb8 | diff --git a/tool.go b/tool.go
index <HASH>..<HASH> 100644
--- a/tool.go
+++ b/tool.go
@@ -641,7 +641,15 @@ func (fs serveCommandFileSystem) Open(requestName string) (http.File, error) {
if isIndex {
// If there was no index.html file in any dirs, supply our own.
- return newFakeFile("index.html", []byte(`<html><head><meta charset="utf-8"><script src="`+base+`.js"></script></head><body></body></html>`)), nil
+ return newFakeFile("index.html", []byte(`<html>
+<head>
+ <meta name="viewport" content="initial-scale=1">
+ <meta charset="utf-8">
+ <script defer src="`+base+`.js"></script>
+</head>
+<body>
+</body>
+</html>`)), nil
}
return nil, os.ErrNotExist | Added viewport support and defered execution on gopherjs serve (#<I>)
Added `<meta name="viewport" content="initial-scale=1">` for responsive web development
environment with gopherjs via gopherjs serve command. | gopherjs_gopherjs | train | go |
de058297248c2de427c9a144b2b32845d308816e | diff --git a/.rubocop.yml b/.rubocop.yml
index <HASH>..<HASH> 100644
--- a/.rubocop.yml
+++ b/.rubocop.yml
@@ -57,6 +57,11 @@ Metrics/LineLength:
Metrics/MethodLength:
Max: 224
+Metrics/ModuleLength:
+ Max: 160
+ Exclude:
+ - spec/**/*
+
Metrics/PerceivedComplexity:
Max: 13
diff --git a/lib/landable/configuration.rb b/lib/landable/configuration.rb
index <HASH>..<HASH> 100644
--- a/lib/landable/configuration.rb
+++ b/lib/landable/configuration.rb
@@ -161,7 +161,6 @@ module Landable
end
def amqp_service_enabled
- return false unless amqp_configuration
amqp_configuration[:enabled] && amqp_configuration[:messaging_service]
end
diff --git a/lib/landable/traffic/event_publisher.rb b/lib/landable/traffic/event_publisher.rb
index <HASH>..<HASH> 100644
--- a/lib/landable/traffic/event_publisher.rb
+++ b/lib/landable/traffic/event_publisher.rb
@@ -5,7 +5,7 @@ module Landable
class << self
def publish(page_view)
@configuration = Landable.configuration.amqp_configuration
- return unless @configuration && enabled?
+ return unless enabled?
@event_type = event_type(page_view)
return unless @event_type | Removing redundant configuration checks in EventPublisher | enova_landable | train | yml,rb,rb |
a7e7201e9bcc3c1b334d3a482fba8366e272e61a | diff --git a/lib/reporters/console-watch.js b/lib/reporters/console-watch.js
index <HASH>..<HASH> 100644
--- a/lib/reporters/console-watch.js
+++ b/lib/reporters/console-watch.js
@@ -69,8 +69,10 @@ Reporter.prototype = Object.create(Base.prototype, extend({
this.data.on('change', function (event) {
if (event.type === 'remove') {
- this.subtract(reports[event.name]);
- delete reports[event.name];
+ if (reports[event.name]) {
+ this.subtract(reports[event.name]);
+ delete reports[event.name];
+ }
return;
} else if (event.type === 'update') {
this.subtract(reports[event.name]); | There were cases where report didn't exist | medikoo_xlint | train | js |
751f350117decf00d6d270d93f34744b60efa440 | diff --git a/SftpAdapter.php b/SftpAdapter.php
index <HASH>..<HASH> 100644
--- a/SftpAdapter.php
+++ b/SftpAdapter.php
@@ -66,6 +66,13 @@ class SftpAdapter implements FilesystemAdapter
return $this->connectionProvider->provideConnection()->is_file($location);
}
+ public function directoryExists(string $path): bool
+ {
+ $location = $this->prefixer->prefixDirectoryPath($path);
+
+ return $this->connectionProvider->provideConnection()->is_dir($location);
+ }
+
/**
* @param string $path
* @param string|resource $contents | Added directoryExists method. | thephpleague_flysystem-sftp | train | php |
64c71c201480ca58165411868e19fad66fd2da71 | diff --git a/src/JSend/JSendResponse.php b/src/JSend/JSendResponse.php
index <HASH>..<HASH> 100644
--- a/src/JSend/JSendResponse.php
+++ b/src/JSend/JSendResponse.php
@@ -208,7 +208,7 @@ class JSendResponse implements \JsonSerializable
*
* @param string $json the raw JSON (JSend) to decode
* @param int $depth User specified recursion depth, defaults to 512
- * @param int $options Bitmask of JSON decode options. (only for php >= 5.4)
+ * @param int $options Bitmask of JSON decode options.
*
* @return JSendResponse if JSON is invalid
* @throws InvalidJSendException if JSend does not conform to spec
@@ -216,11 +216,7 @@ class JSendResponse implements \JsonSerializable
*/
public static function decode($json, $depth = 512, $options = 0)
{
- if (version_compare(phpversion(), '5.4', '>=')) {
- $rawDecode = json_decode($json, true, $depth, $options);
- } else {
- $rawDecode = json_decode($json, true, $depth);
- }
+ $rawDecode = json_decode($json, true, $depth, $options);
if ($rawDecode === null) {
throw new \UnexpectedValueException('JSON is invalid.'); | Check not needed
As the repo is now <I> and up, this check isn't needed. | NanneHuiges_JSend | train | php |
f9cbc209948e4cc3d3253175227ff6242ac16af7 | diff --git a/src/java/arjdbc/jdbc/RubyJdbcConnection.java b/src/java/arjdbc/jdbc/RubyJdbcConnection.java
index <HASH>..<HASH> 100644
--- a/src/java/arjdbc/jdbc/RubyJdbcConnection.java
+++ b/src/java/arjdbc/jdbc/RubyJdbcConnection.java
@@ -2729,13 +2729,10 @@ public class RubyJdbcConnection extends RubyObject {
}
}
- private static final BigInteger MAX_LONG = BigInteger.valueOf(Long.MAX_VALUE);
- private static final BigInteger MIN_LONG = BigInteger.valueOf(Long.MIN_VALUE);
-
protected static void setLongOrDecimalParameter(final PreparedStatement statement,
final int index, final BigInteger value) throws SQLException {
- if ( value.compareTo(MAX_LONG) <= 0 // -1 intValue < MAX_VALUE
- && value.compareTo(MIN_LONG) >= 0 ) {
+
+ if ( value.bitLength() <= 63 ) {
statement.setLong(index, value.longValue());
}
else { | use bit-length check with BigInt for (faster) long value conversion | jruby_activerecord-jdbc-adapter | train | java |
878ba2e8776f2fa5a5657910fcd8abd23ae4eb5e | diff --git a/go/chat/attachment_preview.go b/go/chat/attachment_preview.go
index <HASH>..<HASH> 100644
--- a/go/chat/attachment_preview.go
+++ b/go/chat/attachment_preview.go
@@ -166,14 +166,16 @@ func previewGIF(ctx context.Context, log logger.Logger, src io.Reader, basename
// don't resize if multiple frames and < 5MB
bounds := g.Image[0].Bounds()
+ duration := gifDuration(g)
res := &PreviewRes{
- Source: newBufferSource(bytes.NewBuffer(raw), basename),
- ContentType: "image/gif",
- BaseWidth: bounds.Dx(),
- BaseHeight: bounds.Dy(),
- PreviewWidth: bounds.Dx(),
- PreviewHeight: bounds.Dy(),
- BaseDurationMs: gifDuration(g),
+ Source: newBufferSource(bytes.NewBuffer(raw), basename),
+ ContentType: "image/gif",
+ BaseWidth: bounds.Dx(),
+ BaseHeight: bounds.Dy(),
+ PreviewWidth: bounds.Dx(),
+ PreviewHeight: bounds.Dy(),
+ BaseDurationMs: duration,
+ PreviewDurationMs: duration,
}
return res, nil
} | Add PreviewDurationMs when using original as preview | keybase_client | train | go |
af98f88b2439a6064401a1bc8e3c39481e563073 | diff --git a/inflect.py b/inflect.py
index <HASH>..<HASH> 100644
--- a/inflect.py
+++ b/inflect.py
@@ -54,9 +54,9 @@ from typing import Dict, Union
try:
- import importlib.metadata as importlib_metadata # type: ignore
+ from importlib import metadata # type: ignore
except ImportError:
- import importlib_metadata # type: ignore
+ import importlib_metadata as metadata # type: ignore
class UnknownClassicalModeError(Exception):
@@ -88,7 +88,7 @@ class BadGenderError(Exception):
try:
- __version__ = importlib_metadata.version("inflect")
+ __version__ = metadata.version("inflect") # type: ignore
except Exception:
__version__ = "unknown" | 🧎♀️ Genuflect to the types. | jazzband_inflect | train | py |
7d893a07686b2a969fa423e82de18dc33b6be0b7 | diff --git a/engine/node/score-node-impl/src/main/java/io/cloudslang/engine/node/services/WorkerNodeServiceImpl.java b/engine/node/score-node-impl/src/main/java/io/cloudslang/engine/node/services/WorkerNodeServiceImpl.java
index <HASH>..<HASH> 100644
--- a/engine/node/score-node-impl/src/main/java/io/cloudslang/engine/node/services/WorkerNodeServiceImpl.java
+++ b/engine/node/score-node-impl/src/main/java/io/cloudslang/engine/node/services/WorkerNodeServiceImpl.java
@@ -277,7 +277,7 @@ public class WorkerNodeServiceImpl implements WorkerNodeService {
}
@Override
- @Transactional(readOnly = true)
+ @Transactional
public void updateQueueSync(boolean isQueueSync) {
List<WorkerNode> workers = workerNodeRepository.findAll();
for (WorkerNode w : workers) { | remove read only on transactional (#<I>) | CloudSlang_score | train | java |
3fcbfb857bcebeed2587e679553abea17b02dfce | diff --git a/src/Languages.php b/src/Languages.php
index <HASH>..<HASH> 100644
--- a/src/Languages.php
+++ b/src/Languages.php
@@ -400,8 +400,9 @@ class Languages implements \ArrayAccess
private static function loadIntoCategory()
{
//func_get_arg to avoid override any variable or access to $this from language file
+ ${func_get_arg(0)->getNameOfLanguageVariable()} = array();
require_once func_get_arg(1);
- if (isset(${func_get_arg(0)->getNameOfLanguageVariable()})) {
+ if (!empty(${func_get_arg(0)->getNameOfLanguageVariable()})) {
func_get_arg(0)->lang[func_get_arg(2)][func_get_arg(0)->getCategory()] = ${func_get_arg(0)->getNameOfLanguageVariable()};
}
} | fixed variable assignment in case when register_globals is turned on | rimelek_i18n | train | php |
db44031713018f882a70085935bae2ea2967fd6b | diff --git a/classes/PodsAdmin.php b/classes/PodsAdmin.php
index <HASH>..<HASH> 100644
--- a/classes/PodsAdmin.php
+++ b/classes/PodsAdmin.php
@@ -24,7 +24,6 @@ class PodsAdmin {
add_action('wp_ajax_pods_admin', array($this, 'admin_ajax'));
add_action('wp_ajax_nopriv_pods_admin', array($this, 'admin_ajax'));
}
- add_action('wp_before_admin_bar_render', array($this, 'admin_bar_links'));
}
public function admin_init() { | removed redundant add_action call for admin bar links from PodsAdmin class | pods-framework_pods | train | php |
42f8a4715ebb9feba3bdf0b9708357bece0cd8db | diff --git a/test/integration/022_bigquery_test/test_bigquery_copy_failing_models.py b/test/integration/022_bigquery_test/test_bigquery_copy_failing_models.py
index <HASH>..<HASH> 100644
--- a/test/integration/022_bigquery_test/test_bigquery_copy_failing_models.py
+++ b/test/integration/022_bigquery_test/test_bigquery_copy_failing_models.py
@@ -32,6 +32,5 @@ class TestBigqueryCopyTableFails(DBTIntegrationTest):
@use_profile('bigquery')
def test__bigquery_copy_table_fails(self):
results = self.run_dbt(expect_pass=False)
- # Copy SQL macro raises a NotImplementedException, which gives None
- # as results.
- self.assertEqual(results, None)
+ self.assertEqual(len(results), 1)
+ self.assertTrue(results[0].error) | Assert that single result has error | fishtown-analytics_dbt | train | py |
623aefd09aa71d241cef52d6b1ea31104e1f2eb5 | diff --git a/src/Deployment/Connection/SSHConnectionAdapter.php b/src/Deployment/Connection/SSHConnectionAdapter.php
index <HASH>..<HASH> 100644
--- a/src/Deployment/Connection/SSHConnectionAdapter.php
+++ b/src/Deployment/Connection/SSHConnectionAdapter.php
@@ -151,7 +151,7 @@ class SSHConnectionAdapter implements ConnectionAdapterInterface
}
/**
- * Returns the 'home' user directory of the user currently running the script.
+ * Returns the 'home' directory for the user.
*
* @return string|null
*/
@@ -160,10 +160,11 @@ class SSHConnectionAdapter implements ConnectionAdapterInterface
$userDirectory = null;
if (isset($_SERVER['HOME'])) {
$userDirectory = $_SERVER['HOME'];
+ } elseif (isset($_SERVER['USERPROFILE'])) {
+ $userDirectory = $_SERVER['USERPROFILE'];
}
- elseif (isset($_SERVER['HOMEPATH'])) {
- $userDirectory = $_SERVER['HOMEPATH'];
- }
+ $userDirectory = realpath($userDirectory.'/../');
+ $userDirectory .= '/'.$this->authenticationUsername;
return $userDirectory;
} | Fixed implementation for replacing the ~ for the user 'home' directory in SSHConnectionAdapter | accompli_accompli | train | php |
165f51aa48e0ddc5aa3b687f2dc7f182ac0e40bd | diff --git a/lib/fluent/supervisor.rb b/lib/fluent/supervisor.rb
index <HASH>..<HASH> 100644
--- a/lib/fluent/supervisor.rb
+++ b/lib/fluent/supervisor.rb
@@ -151,6 +151,8 @@ module Fluent
private
def dry_run
+ $log.info "starting fluentd-#{Fluent::VERSION} as dry run mode"
+
read_config
change_privilege
init_engine
@@ -158,7 +160,7 @@ module Fluent
run_configure
exit 0
rescue => e
- $log.error "Dry run failed: #{e}"
+ $log.error "dry run failed: #{e}"
exit 1
end | Dump version info at dry run mode | fluent_fluentd | train | rb |
f237f9927443382fb8e4d409c2fc56d8281b2d23 | diff --git a/src/IsoCodes/Iban.php b/src/IsoCodes/Iban.php
index <HASH>..<HASH> 100755
--- a/src/IsoCodes/Iban.php
+++ b/src/IsoCodes/Iban.php
@@ -73,7 +73,7 @@ class Iban implements IsoCodeInterface
'GB'=>'[A-Z]{4}[0-9]{14}'
);
/*On vérifie la longueur minimale*/
- if (mb_strlen($iban) < 18) {
+ if (mb_strlen($iban) < 15) {
return false;
}
/*On récupère le code ISO du pays*/ | Change minimal number of IBAN characters
Belgium allows <I> characters and Norway <I> | ronanguilloux_IsoCodes | train | php |
562fed642855746fffc63c9e0e3634f88a5f1b91 | diff --git a/src/Scaffold_Command.php b/src/Scaffold_Command.php
index <HASH>..<HASH> 100644
--- a/src/Scaffold_Command.php
+++ b/src/Scaffold_Command.php
@@ -173,10 +173,8 @@ class Scaffold_Command extends WP_CLI_Command {
$raw_output = self::mustache_render( $raw_template, $vars );
if ( ! $control_args['raw'] ) {
- $vars = array_merge( $vars, array(
- 'machine_name' => $machine_name,
- 'output' => $raw_output,
- ) );
+ $vars['machine_name'] = $machine_name;
+ $vars['output'] = $raw_output;
$final_output = self::mustache_render( $extended_template, $vars );
} else { | QA: don't unnecessarily use array_merge()
`array_merge()` is a "heavy" function in PHP and is not actually needed to achieve the desired result in this case. | wp-cli_scaffold-command | train | php |
aa7aee33cf966f09fd10caccff6c09ab7ae1b8e5 | diff --git a/src/Query.php b/src/Query.php
index <HASH>..<HASH> 100644
--- a/src/Query.php
+++ b/src/Query.php
@@ -254,6 +254,10 @@ class Query
return $this->all()->first();
}
+ public function execute()
+ {
+ return $this->_execute();
+ }
/**
* Executes this query and returns a traversable object containing the results
@@ -277,7 +281,7 @@ class Query
'set' => $this->set(),
'sort' => $this->order(),
'extraOptions' => $this->getOptions(),
- 'conditions' => $this->conditions(),
+ 'conditions' => $this->where(),
'repository' => $this->endpoint(),
'webservice' => $this->_webservice
]; | Add exeute method and use where in debugInfo | UseMuffin_Webservice | train | php |
a9bdddc0c230b56974a1c96e118b3723980a81d4 | diff --git a/app/AppKernel.php b/app/AppKernel.php
index <HASH>..<HASH> 100644
--- a/app/AppKernel.php
+++ b/app/AppKernel.php
@@ -27,6 +27,10 @@ class AppKernel extends Kernel
// Put here your own bundles!
);
+ if (in_array($this->environment, array('dev', 'test'))) {
+ $bundles[] = new \Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
+ }
+
return array_merge(parent::registerBundles(), $bundles);
}
}
diff --git a/src/Sylius/Bundle/CoreBundle/Kernel/Kernel.php b/src/Sylius/Bundle/CoreBundle/Kernel/Kernel.php
index <HASH>..<HASH> 100644
--- a/src/Sylius/Bundle/CoreBundle/Kernel/Kernel.php
+++ b/src/Sylius/Bundle/CoreBundle/Kernel/Kernel.php
@@ -102,10 +102,6 @@ abstract class Kernel extends BaseKernel
new \WhiteOctober\PagerfantaBundle\WhiteOctoberPagerfantaBundle(),
);
- if ($this->isDebug()) {
- $bundles[] = new \Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
- }
-
return $bundles;
} | Move environment specific bundles to the user app kernel | Sylius_Sylius | train | php,php |
5f3b4b616b24e5aad109a7710bb9b670f2b4a126 | diff --git a/src/Symfony/Bridge/Doctrine/Form/ChoiceList/ORMQueryBuilderLoader.php b/src/Symfony/Bridge/Doctrine/Form/ChoiceList/ORMQueryBuilderLoader.php
index <HASH>..<HASH> 100644
--- a/src/Symfony/Bridge/Doctrine/Form/ChoiceList/ORMQueryBuilderLoader.php
+++ b/src/Symfony/Bridge/Doctrine/Form/ChoiceList/ORMQueryBuilderLoader.php
@@ -89,6 +89,6 @@ class ORMQueryBuilderLoader implements EntityLoaderInterface
return $qb->andWhere($where)
->getQuery()
->setParameter($parameter, $values, $parameterType)
- ->getResult();
+ ->getResult() ?: [];
}
} | [Bridge/Doctrine] fix return type declarations | symfony_symfony | train | php |
3d65cc380e401cc442506de519a83cc60fe14927 | diff --git a/src/actions/editorialWorkflow.js b/src/actions/editorialWorkflow.js
index <HASH>..<HASH> 100644
--- a/src/actions/editorialWorkflow.js
+++ b/src/actions/editorialWorkflow.js
@@ -227,7 +227,7 @@ export function persistUnpublishedEntry(collection, existingUnpublishedEntry) {
const entryDraft = state.entryDraft;
// Early return if draft contains validation errors
- if (!entryDraft.get('fieldsErrors').isEmpty()) return Promise.resolve();
+ if (!entryDraft.get('fieldsErrors').isEmpty()) return Promise.reject();
const backend = currentBackend(state.config);
const transactionID = uuid();
@@ -260,7 +260,7 @@ export function persistUnpublishedEntry(collection, existingUnpublishedEntry) {
kind: 'danger',
dismissAfter: 8000,
}));
- return dispatch(unpublishedEntryPersistedFail(error, transactionID));
+ return Promise.reject(dispatch(unpublishedEntryPersistedFail(error, transactionID)));
});
};
} | stop navigation on failed entry save in editorial workflow | netlify_netlify-cms | train | js |
9aea7deaa8065ae684255de771008aed96cc76ba | diff --git a/src/request_handlers/webelement_request_handler.js b/src/request_handlers/webelement_request_handler.js
index <HASH>..<HASH> 100644
--- a/src/request_handlers/webelement_request_handler.js
+++ b/src/request_handlers/webelement_request_handler.js
@@ -177,7 +177,6 @@ ghostdriver.WebElementReqHand = function(idOrElement, session) {
res.respondBasedOnResult(_session, req, size);
},
-
_postValueCommand = function(req, res) {
var i, ilen,
postObj = JSON.parse(req.post),
@@ -192,9 +191,7 @@ ghostdriver.WebElementReqHand = function(idOrElement, session) {
_getJSON(),
postObj.value);
- // TODO - Error handling based on the value of "typeRes"
-
- res.success(_session.getId());
+ res.respondBasedOnResult(_session, req, typeRes);
return;
} | Completed the POST /session/:id/element/:id/value command. | detro_ghostdriver | train | js |
540b2e354eb295b4257f6ff6634d5245a6f1a71a | diff --git a/qiskit/quantum_info/operators/symplectic/clifford.py b/qiskit/quantum_info/operators/symplectic/clifford.py
index <HASH>..<HASH> 100644
--- a/qiskit/quantum_info/operators/symplectic/clifford.py
+++ b/qiskit/quantum_info/operators/symplectic/clifford.py
@@ -37,7 +37,7 @@ class Clifford(BaseOperator):
from reference [1].
* Rows 0 to *N-1* are the *destabilizer* group generators
- * Rows *N-1* to *2N-1* are the *stabilizer* group generators.
+ * Rows *N* to *2N-1* are the *stabilizer* group generators.
The internal :class:`~qiskit.quantum_info.StabilizerTable` for the Clifford
can be accessed using the :attr:`table` attribute. The destabilizer or | fix doc (#<I>) | Qiskit_qiskit-terra | train | py |
654b331643ca80d581c899d485369fbb5757fb94 | diff --git a/activerecord/lib/active_record/fixtures.rb b/activerecord/lib/active_record/fixtures.rb
index <HASH>..<HASH> 100644
--- a/activerecord/lib/active_record/fixtures.rb
+++ b/activerecord/lib/active_record/fixtures.rb
@@ -374,8 +374,9 @@ module ActiveRecord
#
# == Support for YAML defaults
#
- # You probably already know how to use YAML to set and reuse defaults in
- # your <tt>database.yml</tt> file. You can use the same technique in your fixtures:
+ # You can set and reuse defaults in your in your fixtures YAML file.
+ # This is the same technique used in the <tt>database.yml</tt> file
+ # to specify defaults:
#
# DEFAULTS: &DEFAULTS
# created_on: <%= 3.weeks.ago.to_s(:db) %> | [ci skip] less derogatory explanation of defaults | rails_rails | train | rb |
3c686fecdfc22a2ed7eb3c97f7bd1c156eff94d7 | diff --git a/telethon/tl/session.py b/telethon/tl/session.py
index <HASH>..<HASH> 100644
--- a/telethon/tl/session.py
+++ b/telethon/tl/session.py
@@ -2,12 +2,13 @@ import json
import os
import platform
import sqlite3
+import struct
import time
from base64 import b64decode
from os.path import isfile as file_exists
from threading import Lock
-from .. import utils, helpers
+from .. import utils
from ..tl import TLObject
from ..tl.types import (
PeerUser, PeerChat, PeerChannel,
@@ -62,7 +63,7 @@ class Session:
self.save_entities = True
self.flood_sleep_threshold = 60
- self.id = helpers.generate_random_long(signed=True)
+ self.id = struct.unpack('q', os.urandom(8))[0]
self._sequence = 0
self.time_offset = 0
self._last_msg_id = 0 # Long | Avoid more cyclic imports on the session file | LonamiWebs_Telethon | train | py |
409400ea035397b9e766439dfc4befdc178d358a | diff --git a/api/app/core/PushNotification/Notifier.php b/api/app/core/PushNotification/Notifier.php
index <HASH>..<HASH> 100644
--- a/api/app/core/PushNotification/Notifier.php
+++ b/api/app/core/PushNotification/Notifier.php
@@ -56,7 +56,7 @@ class Notifier {
foreach(static::getPlatformServices() as $platform => $service_klass) {
$service = new $service_klass();
$query = \models\App::collection('push_registrations')->where('platform', $platform);
- $query->chunk(self::MAX_RECIPIENTS_PER_REQUEST, function($registrations) use (&$service, &$status, $message) {
+ $query->chunk(self::MAX_RECIPIENTS_PER_REQUEST, function($registrations) use (&$platform, &$service, &$status, $message) {
try {
$chunk_status = $service->push($registrations, $message);
$status['success'] += $chunk_status['success']; | push notification: fix platform reference when debugging errors | doubleleft_hook | train | php |
d9399039824de0ef68dc0017cd7db69253bb9ae5 | diff --git a/currencies/utils.py b/currencies/utils.py
index <HASH>..<HASH> 100644
--- a/currencies/utils.py
+++ b/currencies/utils.py
@@ -42,4 +42,8 @@ def get_currency_code(request):
def price_rounding(price, decimals=2):
- return price.quantize(D("0.{}".format('1'.zfill(decimals))), rounding=ROUND_UP)
+ decimal_format = "0.01"
+ # Because of the up-rounding we require at least 2 decimals
+ if decimals > 2:
+ decimal_format = "0.{}".format('1'.zfill(decimals))
+ return price.quantize(D(decimal_format), rounding=ROUND_UP) | Don't allow rounding wih less than 2 decimals | panosl_django-currencies | train | py |
11a967571b70eeaff101f9c27e659f619eb5cfaa | diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -7,7 +7,7 @@ setup(
author_email='[email protected]',
packages=['essence'],
scripts=[],
- url='',
+ url='https://github.com/chromy/essence.git',
license='LICENSE.txt',
description='',
long_description=open('README.txt').read(), | add url to setup.py | chromy_essence | train | py |
0f8187f068eaf50b480ebc79ca91dac9a5036f1f | diff --git a/modules/ezoe/upload.php b/modules/ezoe/upload.php
index <HASH>..<HASH> 100755
--- a/modules/ezoe/upload.php
+++ b/modules/ezoe/upload.php
@@ -121,6 +121,14 @@ if ( $http->hasPostVariable( 'uploadButton' ) || $forcedUpload )
$newObjectName = $newObject->attribute( 'name' );
$newObjectNodeID = (int) $newObject->attribute( 'main_node_id' ); // this will be empty if object is stopped by approve workflow
+ // set parent section for new object
+ if ( isset( $newObjectNodeID ) && $newObjectNodeID )
+ {
+ $newObjectParentNodeObject = $newObject->attribute( 'main_node' )->attribute( 'parent' )->attribute( 'object' );
+ $newObject->setAttribute( 'section_id', $newObjectParentNodeObject->attribute( 'section_id' ) );
+ $newObject->store();
+ }
+
// edit attributes
$newVersionObject = $newObject->attribute( 'current' );
$newObjectDataMap = $newVersionObject->attribute('data_map'); | updated version with syntactic corrections | ezsystems_ezpublish-legacy | train | php |
191acd0758e4f8cc564185c55bc8a149cfbff408 | diff --git a/pyghmi/ipmi/oem/lenovo/imm.py b/pyghmi/ipmi/oem/lenovo/imm.py
index <HASH>..<HASH> 100644
--- a/pyghmi/ipmi/oem/lenovo/imm.py
+++ b/pyghmi/ipmi/oem/lenovo/imm.py
@@ -1723,9 +1723,16 @@ class XCCClient(IMMClient):
'type': item['source'],
}, ''))
if summary.get('health', pygconst.Health.Ok) == pygconst.Health.Ok:
- # Fault LED is lit without explanation, mark critical
- # to encourage examination
- summary['health'] = pygconst.Health.Critical
+ # Fault LED is lit without explanation, mark to encourage
+ # examination
+ summary['health'] = pygconst.Health.Warning
+ if not fallbackdata:
+ fallbackdata.append(sdr.SensorReading({
+ 'name': 'Fault LED',
+ 'states': ['Active'],
+ 'health': pygconst.Health.Warning,
+ 'type': 'LED',
+ }, ''))
raise pygexc.FallbackData(fallbackdata)
# Will use the generic handling for unhealthy systems | Have LED fallback force a sensor if no other explanation
This mitigates the poor appearance of the 'unexplained health'
scenario.
Change-Id: I5b<I>c<I>a<I>b<I>deee<I>f<I>b | openstack_pyghmi | train | py |
68bcfad6779e261cfd5f8ee67f25eedde1c3f72a | diff --git a/test/core/compiler/compiler.js b/test/core/compiler/compiler.js
index <HASH>..<HASH> 100644
--- a/test/core/compiler/compiler.js
+++ b/test/core/compiler/compiler.js
@@ -90,11 +90,14 @@ describe("Compiler", function() {
});
it("should compile and mark SVG elements", function() {
- var el = createTestElement("compilerSVG", '<svg></svg>');
+ var el = createTestElement("compilerSVG", '');
var app = new Moon({
root: "#compilerSVG",
- template: '<div id="compilerSVG"><svg></svg></div>'
+ template: '<div id="compilerSVG"><svg><defs><g id="TestLink"><circle/></g></defs><use xlink:href="#TestLink"></use></svg></div>'
});
+
+ var use = el.firstChild.firstChild.nextSibling;
+ expect(use.getAttribute("xlink:href") || use.getAttribute("href")).to.equal("#TestLink");
expect(app.render().children[0].data.SVG).to.equal(1);
});
}); | add tests for xlink:href | kbrsh_moon | train | js |
f2d458f8486afec97414465077be622347a4e09d | diff --git a/java/src/org/openqa/selenium/grid/node/local/LocalNode.java b/java/src/org/openqa/selenium/grid/node/local/LocalNode.java
index <HASH>..<HASH> 100644
--- a/java/src/org/openqa/selenium/grid/node/local/LocalNode.java
+++ b/java/src/org/openqa/selenium/grid/node/local/LocalNode.java
@@ -152,7 +152,7 @@ public class LocalNode extends Node {
.ticker(ticker)
.removalListener((RemovalListener<SessionId, SessionSlot>) notification -> {
// Attempt to stop the session
- LOG.log(Debug.getDebugLogLevel(), "Stopping session %s", notification.getKey().toString());
+ LOG.log(Debug.getDebugLogLevel(), "Stopping session {0}", notification.getKey().toString());
SessionSlot slot = notification.getValue();
if (!slot.isAvailable()) {
slot.stop(); | [grid] Fixing a log output [skip ci] | SeleniumHQ_selenium | train | java |
52515f4bb7378272a37dfaaa37dce878916e6f62 | diff --git a/prow/github/types.go b/prow/github/types.go
index <HASH>..<HASH> 100644
--- a/prow/github/types.go
+++ b/prow/github/types.go
@@ -161,7 +161,9 @@ type User struct {
}
// NormLogin normalizes GitHub login strings
-var NormLogin = strings.ToLower
+func NormLogin(login string) string {
+ return strings.TrimPrefix(strings.ToLower(login), "@")
+}
// PullRequestEventAction enumerates the triggers for this
// webhook payload type. See also: | trim leading @ from logins when normalizing in github client | kubernetes_test-infra | train | go |
7b80dd1c7830881108c87c6c628dffd1831b6d49 | diff --git a/src/ValidatingTrait.php b/src/ValidatingTrait.php
index <HASH>..<HASH> 100644
--- a/src/ValidatingTrait.php
+++ b/src/ValidatingTrait.php
@@ -135,10 +135,9 @@ trait ValidatingTrait {
* 'saving' ruleset exists, fallback to '$rules' and otherwise return
* an empty array
*
- * @param string $ruleset
* @return array
*/
- public function getDefaultRules($ruleset = null)
+ public function getDefaultRules()
{
$rules = $this->getRuleset('saving') ?: $this->getRules(); | Remove unused parameter
This isn't used, or did you want to do `$this->getRuleset($ruleset)` instead? | dwightwatson_validating | train | php |
d192b11057c4fc1be2c6821e0a66cadaf175e8c0 | diff --git a/src/WPMissing/Util.php b/src/WPMissing/Util.php
index <HASH>..<HASH> 100644
--- a/src/WPMissing/Util.php
+++ b/src/WPMissing/Util.php
@@ -23,6 +23,6 @@ class Util {
}
}
- return \Missing\Date::strftime($date_string, $format, $else, $tz);
+ return \Missing\Dates::strftime($date_string, $format, $else, $tz);
}
} | Bump for new version of PHP-Missing | dxw_wp-missing | train | php |
27bca914b2b921d6b0b08e2d6afac0cc9c9cfe80 | diff --git a/server/irc/connection.js b/server/irc/connection.js
index <HASH>..<HASH> 100644
--- a/server/irc/connection.js
+++ b/server/irc/connection.js
@@ -460,7 +460,7 @@ IrcConnection.prototype.setEncoding = function (encoding) {
//This test is done to check if this encoding also supports
//the ASCII charset required by the IRC protocols
//(Avoid the use of base64 or incompatible encodings)
- if (encoded_test === "TEST") {
+ if (encoded_test == "TEST") { // jshint ignore:line
this.encoding = encoding;
return true;
} | Fix regression due to <I>d<I> | prawnsalad_KiwiIRC | train | js |
6b4dc381f98f97ef99489abd2ee7c3e59c4eb714 | diff --git a/pkg/minikube/node/cache.go b/pkg/minikube/node/cache.go
index <HASH>..<HASH> 100644
--- a/pkg/minikube/node/cache.go
+++ b/pkg/minikube/node/cache.go
@@ -124,6 +124,7 @@ func beginDownloadKicBaseImage(g *errgroup.Group, cc *config.ClusterConfig, down
baseImg := cc.KicBaseImage
if baseImg == kic.BaseImage && len(cc.KubernetesConfig.ImageRepository) != 0 {
baseImg = strings.Replace(baseImg, "gcr.io/k8s-minikube", cc.KubernetesConfig.ImageRepository, 1)
+ cc.KicBaseImage = baseImg
}
var finalImg string
// If we end up using a fallback image, notify the user | fix base image when using with custom image repository | kubernetes_minikube | train | go |
3bd0526df3c3b1010eef8efb23440715ecc82481 | diff --git a/openquake/engine/tools/make_html_report.py b/openquake/engine/tools/make_html_report.py
index <HASH>..<HASH> 100644
--- a/openquake/engine/tools/make_html_report.py
+++ b/openquake/engine/tools/make_html_report.py
@@ -233,6 +233,9 @@ $("#tabs").tabs();
def make_tabs(tag_ids, tag_contents):
+ """
+ Return a HTML string containing all the tabs we want to display
+ """
templ = '''
<div id="tabs">
<ul> | Added a docstring
Former-commit-id: f<I>c7c<I>fb<I>c<I>d6bc1aa<I>e7b<I>cb<I> | gem_oq-engine | train | py |
b314a5606e2d464ee187a2c7306c4f63aa5d71ca | diff --git a/twython/twython.py b/twython/twython.py
index <HASH>..<HASH> 100644
--- a/twython/twython.py
+++ b/twython/twython.py
@@ -567,16 +567,3 @@ class Twython(object):
if isinstance(text, (str, unicode)):
return Twython.unicode2utf8(text)
return str(text)
-
-if __name__ == '__main__':
- app_key = 'KEkNAu84zC5brBehnhAz9g'
- app_secret = 'Z0KOh2Oyf1yDVnQAvRemIslaZfeDfaG79TJ4JoJHXbk'
- oauth_token = '142832463-U6l4WX5pnxSY9wdDWE0Ahzz03yYuhiUvsIjBAyOH'
- oauth_token_secret = 'PJBXfanIZ89hLLDI7ylNDvWyqALVxBMOBELhLW0A'
-
- t = Twython(app_key=app_key,
- app_secret=app_secret,
- oauth_token=oauth_token,
- oauth_token_secret=oauth_token_secret)
-
- print t.updateProfileBannerImage('/Users/mikehelmick/Desktop/Stuff/Screen Shot 2012-08-15 at 2.54.58 PM.png') | Deleting auth stuff, oops | ryanmcgrath_twython | train | py |
5aa39bc11db3c02fc10522c3f24a428cc5238f81 | diff --git a/lib/flapjack/cli/worker_manager.rb b/lib/flapjack/cli/worker_manager.rb
index <HASH>..<HASH> 100644
--- a/lib/flapjack/cli/worker_manager.rb
+++ b/lib/flapjack/cli/worker_manager.rb
@@ -42,11 +42,3 @@ class WorkerManagerOptions
end
-module Daemons
- class PidFile
- # we override this method so creating pid files is fork-safe
- def filename
- File.join(@dir, "#{@progname}#{Process.pid}.pid")
- end
- end
-end | removed daemons code into patches file | flapjack_flapjack | train | rb |
c109675645e218b7fa31e66975dcd8c5b6ede251 | diff --git a/holoviews/core/data.py b/holoviews/core/data.py
index <HASH>..<HASH> 100644
--- a/holoviews/core/data.py
+++ b/holoviews/core/data.py
@@ -1341,9 +1341,18 @@ class DictColumns(DataColumns):
class GridColumns(DictColumns):
"""
- Interface for simple dictionary-based columns format. The dictionary
- keys correspond to the column (i.e dimension) names and the values
- are collections representing the values in that column.
+ Interface for simple dictionary-based columns format using a
+ compressed representation that uses the cartesian product between
+ key dimensions. As with DictColumns, the dictionary keys correspond
+ to the column (i.e dimension) names and the values are NumPy arrays
+ representing the values in that column.
+
+ To use this compressed format, the key dimensions must be orthogonal
+ to one another with each key dimension specifiying an axis of the
+ multidimensional space occupied by the value dimension data. For
+ instance, given an temperature recordings sampled regularly across
+ the earth surface, a list of N unique latitudes and M unique
+ longitudes can specify the position of NxM temperature samples.
"""
types = (dict, OrderedDict, cyODict) | Updated the class docstring for GridColumns | pyviz_holoviews | train | py |
838668dda650f77d29a053620d1f0b20113ff018 | diff --git a/benchexec/outputhandler.py b/benchexec/outputhandler.py
index <HASH>..<HASH> 100644
--- a/benchexec/outputhandler.py
+++ b/benchexec/outputhandler.py
@@ -229,7 +229,7 @@ class OutputHandler(object):
def format_line(key, value):
if value is None:
return ""
- return (key + ":").ljust(columnWidth) + str(value).strip() + "\n"
+ return ((key + ":").ljust(columnWidth) + str(value)).strip() + "\n"
def format_byte(key, value):
if value is None:
@@ -414,7 +414,7 @@ class OutputHandler(object):
runSetInfo += runSet.name + "\n"
runSetInfo += "Run set {0} of {1}: skipped {2}\n".format(
runSet.index, len(self.benchmark.run_sets), reason or ""
- )
+ ).rstrip()
self.txt_file.append(runSetInfo)
def writeRunSetInfoToLog(self, runSet): | Avoid trailing whitespace in text file for results | sosy-lab_benchexec | train | py |
f0b834f692d892451e97ff07d090f808d004f736 | diff --git a/pycbc/__init__.py b/pycbc/__init__.py
index <HASH>..<HASH> 100644
--- a/pycbc/__init__.py
+++ b/pycbc/__init__.py
@@ -29,6 +29,12 @@ import subprocess, os, sys, tempfile
import logging
import signal
+try:
+ # This will fail when pycbc is imported during the build process,
+ # before version.py has been generated.
+ from version import git_hash
+except:
+ git_hash = 'none'
def init_logging(verbose=False):
"""
@@ -99,6 +105,12 @@ _python_name = "python%d%d_compiled" % tuple(sys.version_info[:2])
_tmp_dir = tempfile.gettempdir()
_cache_dir_name = repr(os.getuid()) + '_' + _python_name
_cache_dir_path = os.path.join(_tmp_dir, _cache_dir_name)
+# Append the git hash to the cache path. This will ensure that cached
+# files are correct even in cases where weave currently doesn't realize
+# that a recompile is needed.
+# FIXME: It would be better to find a way to trigger a recompile off
+# of all the arguments to weave.
+_cache_dir_path = os.path.join(_cache_dir_path, git_hash)
try: os.makedirs(_cache_dir_path)
except OSError: pass
os.environ['PYTHONCOMPILED'] = _cache_dir_path | Append the git has to the weave cache path | gwastro_pycbc | train | py |
234892110805f67a5a73ccc2e2377f832815b00c | diff --git a/Connector/ZimbraConnector.php b/Connector/ZimbraConnector.php
index <HASH>..<HASH> 100644
--- a/Connector/ZimbraConnector.php
+++ b/Connector/ZimbraConnector.php
@@ -1006,9 +1006,9 @@ class ZimbraConnector
return $response;
}
- public function getFolders($accountName)
+ public function getFolders($accountName, $ignoreDelegatedAuth = false)
{
- $this->delegateAuth($accountName);
+ $this->delegateAuth($accountName, $ignoreDelegatedAuth);
$response = $this->request('GetFolder', array(), array(), true); | Added ability to ignore delegated auth selectively on GetFolders requests | synaq_SynaqZasaBundle | train | php |
d3281ca7ecd0b8c0eb9f064a9a28350f7ea09763 | diff --git a/src/Charcoal/Property/AbstractProperty.php b/src/Charcoal/Property/AbstractProperty.php
index <HASH>..<HASH> 100644
--- a/src/Charcoal/Property/AbstractProperty.php
+++ b/src/Charcoal/Property/AbstractProperty.php
@@ -181,10 +181,6 @@ abstract class AbstractProperty extends AbstractEntity implements
public function setDependencies(Container $container)
{
$this->setPdo($container['database']);
-
- // This method is a stub. Reimplement in children class.
- $this->setPropertyFactory($container['property/factory']);
- $this->setMetadataLoader($container['metadata/loader']);
}
/** | Do not re-set dependencies that were set from constructor. | locomotivemtl_charcoal-property | train | php |
Subsets and Splits