hash
stringlengths 40
40
| diff
stringlengths 131
114k
| message
stringlengths 7
980
| project
stringlengths 5
67
| split
stringclasses 1
value |
|---|---|---|---|---|
08bb4460a728b4f2998fad52898392b690942c5d
|
diff --git a/src/main/groovy/com/blackducksoftware/integration/hub/api/aggregate/bom/AggregateBomRequestService.java b/src/main/groovy/com/blackducksoftware/integration/hub/api/aggregate/bom/AggregateBomRequestService.java
index <HASH>..<HASH> 100644
--- a/src/main/groovy/com/blackducksoftware/integration/hub/api/aggregate/bom/AggregateBomRequestService.java
+++ b/src/main/groovy/com/blackducksoftware/integration/hub/api/aggregate/bom/AggregateBomRequestService.java
@@ -23,6 +23,7 @@
*/
package com.blackducksoftware.integration.hub.api.aggregate.bom;
+import java.util.ArrayList;
import java.util.List;
import com.blackducksoftware.integration.exception.IntegrationException;
@@ -42,8 +43,13 @@ public class AggregateBomRequestService extends HubResponseService {
}
public List<VersionBomComponentView> getBomEntries(final ProjectVersionView projectVersion) throws IntegrationException {
- final String componentURL = metaService.getFirstLink(projectVersion, MetaService.COMPONENTS_LINK);
- return getBomEntries(componentURL);
+ if (metaService.hasLink(projectVersion, MetaService.COMPONENTS_LINK)) {
+ // In some versions of the Hub, if the BOM is empty the version wil not have the components link
+ final String componentURL = metaService.getFirstLink(projectVersion, MetaService.COMPONENTS_LINK);
+ return getBomEntries(componentURL);
+ } else {
+ return new ArrayList<>();
+ }
}
public List<VersionBomComponentView> getBomEntries(final String componentsUrl) throws IntegrationException {
|
Working on fixing issues with empty BOM's
|
blackducksoftware_blackduck-common
|
train
|
7f964ff45bd02c4e76a5f49f666c513842f00fd8
|
diff --git a/test/unit/index.spec.js b/test/unit/index.spec.js
index <HASH>..<HASH> 100644
--- a/test/unit/index.spec.js
+++ b/test/unit/index.spec.js
@@ -20,6 +20,7 @@ const preprocessor = require('../../dist/index')
describe('webpack preprocessor', function () {
beforeEach(function () {
+ webpack.reset()
sinon.restore()
this.watchApi = {
|
chore: always reset webpack stub
|
cypress-io_cypress
|
train
|
acbaccd6aa502bc9a25472b19f143f3910585cd6
|
diff --git a/index.js b/index.js
index <HASH>..<HASH> 100644
--- a/index.js
+++ b/index.js
@@ -60,7 +60,7 @@ function maybeAnswer(msg) {
var corrId=msg.properties.correlationId;
var pro = cacheTable[corrId];
if(pro){
- pro.resolve(msg.content.toString());
+ pro.resolve(JSON.parse(msg.content.toString()));
delete cacheTable[corrId];
}
}
|
solve a mistake of not parsing result from server to JSON in package
|
richardzyx_node-microservice
|
train
|
332cb7150ff291578bc1ef5cb04ec3ea66dc2fee
|
diff --git a/test/taglib-test.js b/test/taglib-test.js
index <HASH>..<HASH> 100644
--- a/test/taglib-test.js
+++ b/test/taglib-test.js
@@ -51,7 +51,7 @@ function testRender(path, data, done, options) {
var context = options.context || new Context(new StringBuilder());
marko.render(inputPath, data, context)
- .on('end', function() {
+ .on('finish', function() {
var output = context.getOutput();
fs.writeFileSync(actualPath, output, {encoding: 'utf8'});
@@ -72,8 +72,8 @@ function testRender(path, data, done, options) {
done();
})
- .on('error', done);
-
+ .on('error', done)
+ .end();
}
xdescribe('marko-widgets/taglib' , function() {
|
Use finish event instead of end event when listening for marko template writer to finish
|
marko-js_marko-widgets
|
train
|
63caf22671ae03f23ba93534082e91eb24a5b539
|
diff --git a/cmd/syncthing/main.go b/cmd/syncthing/main.go
index <HASH>..<HASH> 100644
--- a/cmd/syncthing/main.go
+++ b/cmd/syncthing/main.go
@@ -600,17 +600,18 @@ func syncthingMain() {
if (opts.MaxRecvKbps > 0 || opts.MaxSendKbps > 0) && !opts.LimitBandwidthInLan {
lans, _ = osutil.GetLans()
- networks := make([]string, 0, len(lans))
- for _, lan := range lans {
- networks = append(networks, lan.String())
- }
for _, lan := range opts.AlwaysLocalNets {
_, ipnet, err := net.ParseCIDR(lan)
if err != nil {
l.Infoln("Network", lan, "is malformed:", err)
continue
}
- networks = append(networks, ipnet.String())
+ lans = append(lans, ipnet)
+ }
+
+ networks := make([]string, len(lans))
+ for i, lan := range lans {
+ networks[i] = lan.String()
}
l.Infoln("Local networks:", strings.Join(networks, ", "))
}
|
Consider 'AlwaysLocalNets' in bandwidth limiters
'AlwaysLocalNets' was getting printed, but was getting used
when setting up connections. Now, the nets that should be
considered local are printed and used.
|
syncthing_syncthing
|
train
|
2c6d08abd0e8c4d9e4957190d3cc55c6c57a8416
|
diff --git a/host-controller/src/main/java/org/jboss/as/host/controller/HostControllerConfigurationPersister.java b/host-controller/src/main/java/org/jboss/as/host/controller/HostControllerConfigurationPersister.java
index <HASH>..<HASH> 100644
--- a/host-controller/src/main/java/org/jboss/as/host/controller/HostControllerConfigurationPersister.java
+++ b/host-controller/src/main/java/org/jboss/as/host/controller/HostControllerConfigurationPersister.java
@@ -33,6 +33,7 @@ import java.util.concurrent.ExecutorService;
import java.util.function.Supplier;
import org.jboss.as.controller.PathAddress;
+import org.jboss.as.controller.ProcessType;
import org.jboss.as.controller.extension.ExtensionRegistry;
import org.jboss.as.controller.persistence.ConfigurationFile;
import org.jboss.as.controller.persistence.ConfigurationPersistenceException;
@@ -186,23 +187,26 @@ public class HostControllerConfigurationPersister implements ExtensibleConfigura
@Override
public List<ModelNode> load() throws ConfigurationPersistenceException {
- final ConfigurationFile configurationFile = environment.getHostConfigurationFile();
- final File bootFile = configurationFile.getBootFile();
- final ConfigurationFile.InteractionPolicy policy = configurationFile.getInteractionPolicy();
- final HostRunningModeControl runningModeControl = environment.getRunningModeControl();
+ // TODO investigate replacing all this with something more like BackupXmlConfigurationPersister.isSuppressLoad
+ if (environment.getProcessType() == ProcessType.EMBEDDED_HOST_CONTROLLER) {
+ final ConfigurationFile configurationFile = environment.getHostConfigurationFile();
+ final File bootFile = configurationFile.getBootFile();
+ final ConfigurationFile.InteractionPolicy policy = configurationFile.getInteractionPolicy();
+ final HostRunningModeControl runningModeControl = environment.getRunningModeControl();
- if (bootFile.exists() && bootFile.length() == 0) { // empty config, by definition
- return new ArrayList<>();
- }
+ if (bootFile.exists() && bootFile.length() == 0) { // empty config, by definition
+ return new ArrayList<>();
+ }
- if (policy == ConfigurationFile.InteractionPolicy.NEW && (bootFile.exists() && bootFile.length() != 0)) {
- throw HostControllerLogger.ROOT_LOGGER.cannotOverwriteHostXmlWithEmpty(bootFile.getName());
- }
+ if (policy == ConfigurationFile.InteractionPolicy.NEW && (bootFile.exists() && bootFile.length() != 0)) {
+ throw HostControllerLogger.ROOT_LOGGER.cannotOverwriteHostXmlWithEmpty(bootFile.getName());
+ }
- // if we started with new / discard but now we're reloading, ignore it. Otherwise on a reload, we have no way to drop the --empty-host-config
- // if we're loading a 0 byte file, treat this the same as booting with an emoty config
- if (configurationFile.getBootFile().length() == 0 || (!runningModeControl.isReloaded() && (policy == ConfigurationFile.InteractionPolicy.NEW || policy == ConfigurationFile.InteractionPolicy.DISCARD))) {
- return new ArrayList<>();
+ // if we started with new / discard but now we're reloading, ignore it. Otherwise on a reload, we have no way to drop the --empty-host-config
+ // if we're loading a 0 byte file, treat this the same as booting with an emoty config
+ if (bootFile.length() == 0 || (!runningModeControl.isReloaded() && (policy == ConfigurationFile.InteractionPolicy.NEW || policy == ConfigurationFile.InteractionPolicy.DISCARD))) {
+ return new ArrayList<>();
+ }
}
return hostPersister.load();
}
|
[WFCORE-<I>] Don't ignore an empty host.xml in the non-embedded case
|
wildfly_wildfly-core
|
train
|
0e5b15d92b9eec2a5bcc941c0f5700644aa52b2d
|
diff --git a/lib/core/src/server/manager/manager-config.js b/lib/core/src/server/manager/manager-config.js
index <HASH>..<HASH> 100644
--- a/lib/core/src/server/manager/manager-config.js
+++ b/lib/core/src/server/manager/manager-config.js
@@ -59,11 +59,12 @@ async function getManagerWebpackConfig(options, presets) {
const refs = {};
if (autoRefs && autoRefs.length) {
- autoRefs.forEach(({ id, url, title }) => {
+ autoRefs.forEach(({ id, url, title, version }) => {
refs[id.toLowerCase()] = {
id: id.toLowerCase(),
url: stripTrailingSlash(url),
title,
+ version,
};
});
}
|
FIX missing passed version property in autoref
|
storybooks_storybook
|
train
|
c401d2c639d08b3c0d75db7ee97b50ecfd88363c
|
diff --git a/tests/aik099/PHPUnit/Integration/BrowserStackAwareTestCase.php b/tests/aik099/PHPUnit/Integration/BrowserStackAwareTestCase.php
index <HASH>..<HASH> 100644
--- a/tests/aik099/PHPUnit/Integration/BrowserStackAwareTestCase.php
+++ b/tests/aik099/PHPUnit/Integration/BrowserStackAwareTestCase.php
@@ -65,9 +65,13 @@ abstract class BrowserStackAwareTestCase extends BrowserTestCase
'type' => 'browserstack',
'api_username' => getenv('BS_USERNAME'),
'api_key' => getenv('BS_ACCESS_KEY'),
-
- 'browserName' => 'chrome',
- 'desiredCapabilities' => array('browser_version' => '38.0', 'project' => 'PHPUnit-Mink'),
+ 'browserName' => 'Firefox',
+ 'desiredCapabilities' => array(
+ 'browser_version' => '41.0',
+ 'os' => 'Windows',
+ 'os_version' => '7',
+ 'project' => 'PHPUnit-Mink',
+ ),
'baseUrl' => 'http://www.google.com',
),
);
|
Use Firefox in tests, because due ChromeDriver bug switching to main window is impossible
|
minkphp_phpunit-mink
|
train
|
675a912eb86a9e109e9877379e8454b388242d57
|
diff --git a/activerecord/lib/active_record/connection_adapters/mysql/schema_statements.rb b/activerecord/lib/active_record/connection_adapters/mysql/schema_statements.rb
index <HASH>..<HASH> 100644
--- a/activerecord/lib/active_record/connection_adapters/mysql/schema_statements.rb
+++ b/activerecord/lib/active_record/connection_adapters/mysql/schema_statements.rb
@@ -45,6 +45,13 @@ module ActiveRecord
indexes
end
+ def remove_column(table_name, column_name, type = nil, options = {})
+ if foreign_key_exists?(table_name, column: column_name)
+ remove_foreign_key(table_name, column: column_name)
+ end
+ super
+ end
+
def internal_string_options_for_primary_key
super.tap do |options|
if CHARSETS_OF_4BYTES_MAXLEN.include?(charset) && (mariadb? || version < "8.0.0")
diff --git a/activerecord/test/cases/migration/references_foreign_key_test.rb b/activerecord/test/cases/migration/references_foreign_key_test.rb
index <HASH>..<HASH> 100644
--- a/activerecord/test/cases/migration/references_foreign_key_test.rb
+++ b/activerecord/test/cases/migration/references_foreign_key_test.rb
@@ -139,6 +139,16 @@ if ActiveRecord::Base.connection.supports_foreign_keys?
end
end
+ test "removing column removes foreign key" do
+ @connection.create_table :testings do |t|
+ t.references :testing_parent, index: true, foreign_key: true
+ end
+
+ assert_difference "@connection.foreign_keys('testings').size", -1 do
+ @connection.remove_column :testings, :testing_parent_id
+ end
+ end
+
test "foreign key methods respect pluralize_table_names" do
begin
original_pluralize_table_names = ActiveRecord::Base.pluralize_table_names
|
Remove FK together with column in MySQL
Unlike with other databses, MySQL doesn't let you remove the column
if there's a FK on this column.
For better developer experience we want to remove the FK together with
the column.
|
rails_rails
|
train
|
41db005d0b35daf9d60b669b35071a1e0f4a00fa
|
diff --git a/command/agent/dns.go b/command/agent/dns.go
index <HASH>..<HASH> 100644
--- a/command/agent/dns.go
+++ b/command/agent/dns.go
@@ -787,8 +787,8 @@ func (d *DNSServer) handleRecurse(resp dns.ResponseWriter, req *dns.Msg) {
var err error
for _, recursor := range d.recursors {
r, rtt, err = c.Exchange(req, recursor)
- r.Compress = true
if err == nil {
+ r.Compress = true
// Forward the response
d.logger.Printf("[DEBUG] dns: recurse RTT for %v (%v)", q, rtt)
if err := resp.WriteMsg(r); err != nil {
|
Fix panic where r.Compress would be set before checking for errors.
|
hashicorp_consul
|
train
|
8c9c185831f0a6f403962cb8586d352de7563de4
|
diff --git a/lib/yard/logging.rb b/lib/yard/logging.rb
index <HASH>..<HASH> 100644
--- a/lib/yard/logging.rb
+++ b/lib/yard/logging.rb
@@ -12,7 +12,8 @@ module YARD
# @return [IO] the IO object being logged to
# @since 0.8.2
- attr_accessor :io
+ def io; @logdev end
+ def io=(pipe) @logdev = pipe end
# @return [Boolean] whether backtraces should be shown (by default
# this is on).
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index <HASH>..<HASH> 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -121,4 +121,8 @@ module Kernel
end
end if ENV['TM_APP_PATH']
+RSpec.configure do |config|
+ config.before(:each) { log.io = StringIO.new }
+end
+
include YARD
|
Allow log.io= to properly update underlying stream.
Stream logger output to StringIO buffer instead of STDOUT for tests
|
lsegal_yard
|
train
|
47ee6f0d597cacbaa35cfa128e83d6cad008a5f6
|
diff --git a/src/Exception.php b/src/Exception.php
index <HASH>..<HASH> 100644
--- a/src/Exception.php
+++ b/src/Exception.php
@@ -15,7 +15,7 @@ abstract class Exception
*
* @return Throwable
*/
- final public static function getBaseException(Throwable $throwable)
+ final public static function getBaseException(Throwable $throwable) : Throwable
{
while ($throwable->getPrevious() !== null) {
$throwable = $throwable->getPrevious();
@@ -36,7 +36,7 @@ abstract class Exception
*
* @throws \ErrorException Thrown based on information given in parameters.
*/
- final public static function raise($level, $message, $file = null, $line = null)
+ final public static function raise(int $level, string $message, string $file = null, int $line = null)
{
if (error_reporting() === 0) {
return false;
@@ -54,7 +54,7 @@ abstract class Exception
*
* @return array
*/
- final public static function toArray(Throwable $throwable, $traceAsString = false, $depth = 512)
+ final public static function toArray(Throwable $throwable, bool $traceAsString = false, int $depth = 512) : array
{
$result = [
'type' => get_class($throwable),
@@ -76,7 +76,7 @@ abstract class Exception
/**
* Creates an ErrorException based on the error from error_get_last().
*
- * @return \ErrorException
+ * @return \ErrorException|null
*/
final public static function fromLastError()
{
|
Add scalar type hints and return types
|
subjective-php_util-exceptions
|
train
|
c43198638d32c0442dbea6f869c158a8d9e79662
|
diff --git a/virtualchain/lib/blockchain/bitcoin_blockchain/multisig.py b/virtualchain/lib/blockchain/bitcoin_blockchain/multisig.py
index <HASH>..<HASH> 100644
--- a/virtualchain/lib/blockchain/bitcoin_blockchain/multisig.py
+++ b/virtualchain/lib/blockchain/bitcoin_blockchain/multisig.py
@@ -21,37 +21,48 @@
along with Virtualchain. If not, see <http://www.gnu.org/licenses/>.
"""
-import pybitcoin
-import bitcoin
import traceback
import sys
-from pybitcoin import opcodes
-
+from .opcodes import *
from .keys import *
+from .bits import *
import os
+import binascii
+
+def make_multisig_script( pubs, m ):
+ """
+ Make a multisig scriptSig script, as a hex string
+ """
+ return btc_script_serialize( [m] + pubs + [len(pubs)] + [OPCODE_VALUES['OP_CHECKMULTISIG']] )
+
def make_multisig_info( m, pks ):
"""
Make a multisig address and redeem script.
@m of the given @pks must sign.
+
Return {'address': p2sh address, 'redeem_script': redeem script, 'private_keys': private keys}
- Return (p2sh address, redeem script)
+ * privkeys will be hex-encoded
+ * redeem_script will be hex-encoded
"""
+ import virtualchain
+ from virtualchain.lib.ecdsalib import ecdsa_private_key
+
pubs = []
privkeys = []
for pk in pks:
- priv = BitcoinPrivateKey(pk)
+ priv = ecdsa_private_key(pk)
priv_hex = priv.to_hex()
pub_hex = priv.public_key().to_hex()
privkeys.append(priv_hex)
pubs.append(pub_hex)
- script = bitcoin.mk_multisig_script( pubs, m )
- addr = bitcoin.p2sh_scriptaddr(script, multisig_version_byte)
+ script = make_multisig_script(pubs, m)
+ addr = btc_make_p2sh_address(script)
return {
'address': addr,
@@ -60,13 +71,6 @@ def make_multisig_info( m, pks ):
}
-def make_multisig_address( redeem_script ):
- """
- Make a multisig address (p2sh address)
- """
- return bitcoin.p2sh_scriptaddr( redeem_script, multisig_version_byte )
-
-
def make_multisig_wallet( m, n ):
"""
Create a bundle of information
@@ -95,7 +99,7 @@ def parse_multisig_redeemscript( redeem_script_hex ):
redeem_script_hex = str(redeem_script_hex)
try:
- script_parts = bitcoin.deserialize_script( redeem_script_hex )
+ script_parts = btc_script_deserialize(redeem_script_hex)
except:
if os.environ.get("BLOCKSTACK_TEST") == "1":
traceback.print_exc()
@@ -105,7 +109,7 @@ def parse_multisig_redeemscript( redeem_script_hex ):
try:
assert len(script_parts) > 2
- assert script_parts[-1] == opcodes.OP_CHECKMULTISIG
+ assert script_parts[-1] == OPCODE_VALUES['OP_CHECKMULTISIG']
script_parts.pop(-1)
# get n
@@ -139,7 +143,7 @@ def parse_multisig_scriptsig( scriptsig_hex ):
Return None on error
"""
try:
- script_parts = bitcoin.deserialize_script( scriptsig_hex )
+ script_parts = btc_script_deserialize(scriptsig_hex)
except:
if os.environ.get("BLOCKSTACK_TEST") == "1":
traceback.print_exc()
|
refactor multisig.py to use routines from bits.py and keys.py
|
blockstack_virtualchain
|
train
|
178fd5cafbdb413b7f41a91ad351e3fed582c22a
|
diff --git a/library/CM/PagingSource/MongoDb.php b/library/CM/PagingSource/MongoDb.php
index <HASH>..<HASH> 100644
--- a/library/CM/PagingSource/MongoDb.php
+++ b/library/CM/PagingSource/MongoDb.php
@@ -56,13 +56,25 @@ class CM_PagingSource_MongoDb extends CM_PagingSource_Abstract {
$cacheKey = array('items', $offset, $count);
if (($items = $this->_cacheGet($cacheKey)) === false) {
$mongoDb = CM_Service_Manager::getInstance()->getMongoDb();
- $cursor = $mongoDb->find($this->_collection, $this->_criteria, $this->_projection, $this->_aggregation);
-
- if (null !== $offset) {
- $cursor->skip($offset);
+ $aggregation = null;
+ if ($this->_aggregation) {
+ $aggregation = $this->_aggregation;
+ if (null !== $offset) {
+ array_push($aggregation, ['$skip' => $offset]);
+ }
+ if (null !== $count) {
+ array_push($aggregation, ['$limit' => $count]);
+ }
}
- if (null !== $count) {
- $cursor->limit($count);
+ $cursor = $mongoDb->find($this->_collection, $this->_criteria, $this->_projection, $aggregation);
+ if (null === $this->_aggregation) {
+ /** @var MongoCursor $cursor */
+ if (null !== $offset) {
+ $cursor->skip($offset);
+ }
+ if (null !== $count) {
+ $cursor->limit($count);
+ }
}
$items = array();
foreach ($cursor as $item) {
diff --git a/tests/library/CM/PagingSource/MongoDbTest.php b/tests/library/CM/PagingSource/MongoDbTest.php
index <HASH>..<HASH> 100644
--- a/tests/library/CM/PagingSource/MongoDbTest.php
+++ b/tests/library/CM/PagingSource/MongoDbTest.php
@@ -55,6 +55,18 @@ class CM_PagingSource_MongoDbTest extends CMTest_TestCase {
unset($doc['_id']);
return $doc;
}));
+
+ $result = \Functional\map($source->getItems(1), function ($doc) {
+ unset($doc['_id']);
+ return $doc;
+ });
+ $this->assertEquals(array_slice($itemsExpected, 1), $result);
+
+ $result = \Functional\map($source->getItems(1, 2), function ($doc) {
+ unset($doc['_id']);
+ return $doc;
+ });
+ $this->assertEquals(array_slice($itemsExpected, 1, 2), $result);
}
public function testGetItemsAggregation() {
@@ -76,6 +88,18 @@ class CM_PagingSource_MongoDbTest extends CMTest_TestCase {
return $doc;
});
$this->assertEquals($itemsExpected, $result);
+
+ $result = \Functional\map($source->getItems(1), function ($doc) {
+ unset($doc['_id']);
+ return $doc;
+ });
+ $this->assertEquals(array_slice($itemsExpected, 1), $result);
+
+ $result = \Functional\map($source->getItems(1, 2), function ($doc) {
+ unset($doc['_id']);
+ return $doc;
+ });
+ $this->assertEquals(array_slice($itemsExpected, 1, 2), $result);
}
public function testGetCountOffsetCount() {
|
use 'skip' and 'limit' operations for offset and count instead of unavailable cursor->skip() and limit() operations when using aggregation
|
cargomedia_cm
|
train
|
feae05f88abb69888dfd16301e0c1d2449e4e335
|
diff --git a/kubetest/kops.go b/kubetest/kops.go
index <HASH>..<HASH> 100644
--- a/kubetest/kops.go
+++ b/kubetest/kops.go
@@ -45,7 +45,7 @@ import (
)
// kopsAWSMasterSize is the default ec2 instance type for kops on aws
-const kopsAWSMasterSize = "c4.large"
+const kopsAWSMasterSize = "c5.large"
var (
@@ -381,7 +381,7 @@ func (k kops) Up() error {
var featureFlags []string
- // We are defaulting the master size to c4.large on AWS because m3.larges are getting less previlent.
+ // We are defaulting the master size to c5.large on AWS because it's cheapest non-throttled instance type.
// When we are using GCE, then we need to handle the flag differently.
// If we are not using gce then add the masters size flag, or if we are using gce, and the
// master size is not set to the aws default, then add the master size flag.
|
Set default master size to c5.large for AWS
|
kubernetes_test-infra
|
train
|
e5e7898c648c08fe2d7e1ec10b8163e832e87c86
|
diff --git a/lib/Doctrine/MongoDB/Database.php b/lib/Doctrine/MongoDB/Database.php
index <HASH>..<HASH> 100644
--- a/lib/Doctrine/MongoDB/Database.php
+++ b/lib/Doctrine/MongoDB/Database.php
@@ -119,7 +119,10 @@ class Database
/**
* Wrapper method for MongoDB::createCollection().
*
- * @see http://php.net/manual/en/mongodb.command.php
+ * This method will dispatch preCreateCollection and postCreateCollection
+ * events.
+ *
+ * @see http://php.net/manual/en/mongodb.createcollection.php
* @param string $name Collection name
* @param boolean|array $cappedOrOptions Capped collection indicator or an
* options array (for driver 1.4+)
@@ -139,16 +142,10 @@ class Database
$this->eventManager->dispatchEvent(Events::preCreateCollection, new CreateCollectionEventArgs($this, $name, $options));
}
- if (version_compare(phpversion('mongo'), '1.4.0', '>=')) {
- $this->getMongoDB()->createCollection($name, $options);
- } else {
- $this->getMongoDB()->createCollection($name, $options['capped'], $options['size'], $options['max']);
- }
-
- $result = $this->selectCollection($name);
+ $result = $this->doCreateCollection($name, $options);
if ($this->eventManager->hasListeners(Events::postCreateCollection)) {
- $this->eventManager->dispatchEvent(Events::postCreateCollection, new EventArgs($this, $prefix));
+ $this->eventManager->dispatchEvent(Events::postCreateCollection, new EventArgs($this, $result));
}
return $result;
@@ -520,6 +517,25 @@ class Database
}
/**
+ * Creates a collection.
+ *
+ * @see Database::createCollection()
+ * @param string $name
+ * @param array $options
+ * @return Collection
+ */
+ protected function doCreateCollection($name, array $options)
+ {
+ if (version_compare(phpversion('mongo'), '1.4.0', '>=')) {
+ $this->getMongoDB()->createCollection($name, $options);
+ } else {
+ $this->getMongoDB()->createCollection($name, $options['capped'], $options['size'], $options['max']);
+ }
+
+ return $this->doSelectCollection($name);
+ }
+
+ /**
* Return a new GridFS instance.
*
* @see Database::getGridFS()
diff --git a/tests/Doctrine/MongoDB/Tests/DatabaseEventsTest.php b/tests/Doctrine/MongoDB/Tests/DatabaseEventsTest.php
index <HASH>..<HASH> 100644
--- a/tests/Doctrine/MongoDB/Tests/DatabaseEventsTest.php
+++ b/tests/Doctrine/MongoDB/Tests/DatabaseEventsTest.php
@@ -4,6 +4,7 @@ namespace Doctrine\MongoDB\Tests;
use Doctrine\Common\EventManager;
use Doctrine\MongoDB\Events;
+use Doctrine\MongoDB\Event\CreateCollectionEventArgs;
use Doctrine\MongoDB\Event\EventArgs;
use Doctrine\MongoDB\Event\MutableEventArgs;
@@ -11,6 +12,23 @@ class DatabaseEventsTest extends \PHPUnit_Framework_TestCase
{
const databaseName = 'database';
+ public function testCreateCollection()
+ {
+ $name = 'collection';
+ $options = array('capped' => false, 'size' => 0, 'max' => 0);
+ $result = $this->getMockCollection();
+
+ $eventManager = $this->getMockEventManager();
+ $db = $this->getMockDatabase($eventManager, array('doCreateCollection' => $result));
+
+ $this->expectEvents($eventManager, array(
+ array(Events::preCreateCollection, new CreateCollectionEventArgs($db, $name, $options)),
+ array(Events::postCreateCollection, new EventArgs($db, $result)),
+ ));
+
+ $this->assertSame($result, $db->createCollection($name, $options));
+ }
+
public function testGetDBRef()
{
$reference = array('$ref' => 'collection', '$id' => 1);
@@ -70,6 +88,13 @@ class DatabaseEventsTest extends \PHPUnit_Framework_TestCase
}
}
+ private function getMockCollection()
+ {
+ return $this->getMockBuilder('Doctrine\MongoDB\Collection')
+ ->disableOriginalConstructor()
+ ->getMock();
+ }
+
private function getMockDatabase(EventManager $em, array $methods)
{
$c = $this->getMockBuilder('Doctrine\MongoDB\Connection')
|
Fix post-event dispatching in Database::createCollection()
This corrects an invalid variable reference and adds a test for the method. Additionally, the handling for multiple driver APIs is moved to a "do" method.
Also, use doSelectCollection() to avoid dispatching extra events.
|
doctrine_mongodb
|
train
|
4e177eb170545586a5d31b400722dd1d9c80e749
|
diff --git a/payment/src/main/java/com/ning/billing/payment/api/DefaultPaymentApi.java b/payment/src/main/java/com/ning/billing/payment/api/DefaultPaymentApi.java
index <HASH>..<HASH> 100644
--- a/payment/src/main/java/com/ning/billing/payment/api/DefaultPaymentApi.java
+++ b/payment/src/main/java/com/ning/billing/payment/api/DefaultPaymentApi.java
@@ -180,13 +180,8 @@ public class DefaultPaymentApi implements PaymentApi {
Invoice invoice = invoicePaymentApi.getInvoice(UUID.fromString(invoiceId));
if (invoice.getBalance().compareTo(BigDecimal.ZERO) <= 0 ) {
- // TODO: send a notification that invoice was ignored?
- log.info("Received invoice for payment with balance of 0 {} ", invoice);
- Either<PaymentError, PaymentInfo> result = Either.left(new PaymentError("invoice_balance_0",
- "Invoice balance was 0 or less",
- account.getId(),
- UUID.fromString(invoiceId)));
- processedPaymentsOrErrors.add(result);
+ log.debug("Received invoice for payment with balance of 0 {} ", invoice);
+
}
else if (invoice.isMigrationInvoice()) {
log.info("Received invoice for payment that is a migration invoice - don't know how to handle those yet: {}", invoice);
@@ -305,8 +300,8 @@ public class DefaultPaymentApi implements PaymentApi {
@Override
public List<Either<PaymentError, PaymentInfo>> createRefund(Account account, List<String> invoiceIds) {
- //TODO
- throw new UnsupportedOperationException();
+ final PaymentProviderPlugin plugin = getPaymentProviderPlugin(account);
+ return plugin.processRefund(account);
}
@Override
diff --git a/payment/src/main/java/com/ning/billing/payment/provider/NoOpPaymentProviderPlugin.java b/payment/src/main/java/com/ning/billing/payment/provider/NoOpPaymentProviderPlugin.java
index <HASH>..<HASH> 100644
--- a/payment/src/main/java/com/ning/billing/payment/provider/NoOpPaymentProviderPlugin.java
+++ b/payment/src/main/java/com/ning/billing/payment/provider/NoOpPaymentProviderPlugin.java
@@ -108,4 +108,10 @@ public class NoOpPaymentProviderPlugin implements PaymentProviderPlugin {
return Either.right(null);
}
+ @Override
+ public List<Either<PaymentError, PaymentInfo>> processRefund(Account account) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
}
diff --git a/payment/src/main/java/com/ning/billing/payment/provider/PaymentProviderPlugin.java b/payment/src/main/java/com/ning/billing/payment/provider/PaymentProviderPlugin.java
index <HASH>..<HASH> 100644
--- a/payment/src/main/java/com/ning/billing/payment/provider/PaymentProviderPlugin.java
+++ b/payment/src/main/java/com/ning/billing/payment/provider/PaymentProviderPlugin.java
@@ -42,5 +42,6 @@ public interface PaymentProviderPlugin {
Either<PaymentError, Void> updatePaymentProviderAccountExistingContact(Account account);
Either<PaymentError, Void> updatePaymentProviderAccountWithNewContact(Account account);
+ List<Either<PaymentError, PaymentInfo>> processRefund(Account account);
}
diff --git a/payment/src/test/java/com/ning/billing/payment/provider/MockPaymentProviderPlugin.java b/payment/src/test/java/com/ning/billing/payment/provider/MockPaymentProviderPlugin.java
index <HASH>..<HASH> 100644
--- a/payment/src/test/java/com/ning/billing/payment/provider/MockPaymentProviderPlugin.java
+++ b/payment/src/test/java/com/ning/billing/payment/provider/MockPaymentProviderPlugin.java
@@ -24,13 +24,11 @@ import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicBoolean;
-import com.google.inject.Inject;
-import com.ning.billing.util.clock.Clock;
import org.apache.commons.lang.RandomStringUtils;
-import org.joda.time.DateTime;
import com.google.common.base.Predicate;
import com.google.common.collect.Collections2;
+import com.google.inject.Inject;
import com.ning.billing.account.api.Account;
import com.ning.billing.invoice.api.Invoice;
import com.ning.billing.payment.api.CreditCardPaymentMethodInfo;
@@ -40,6 +38,7 @@ import com.ning.billing.payment.api.PaymentInfo;
import com.ning.billing.payment.api.PaymentMethodInfo;
import com.ning.billing.payment.api.PaymentProviderAccount;
import com.ning.billing.payment.api.PaypalPaymentMethodInfo;
+import com.ning.billing.util.clock.Clock;
public class MockPaymentProviderPlugin implements PaymentProviderPlugin {
private final AtomicBoolean makeNextInvoiceFail = new AtomicBoolean(false);
@@ -266,8 +265,14 @@ public class MockPaymentProviderPlugin implements PaymentProviderPlugin {
@Override
public Either<PaymentError, Void> updatePaymentProviderAccountWithNewContact(Account account) {
- // nothing to do here
- return Either.right(null);
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public List<Either<PaymentError, PaymentInfo>> processRefund(Account account) {
+ // TODO Auto-generated method stub
+ return null;
}
}
|
Changed payment api to not return error for 0 invoice
|
killbill_killbill
|
train
|
50acc61321c7febb342dd20fbc9b1ea8f85b5a2d
|
diff --git a/mod/scorm/lib.php b/mod/scorm/lib.php
index <HASH>..<HASH> 100755
--- a/mod/scorm/lib.php
+++ b/mod/scorm/lib.php
@@ -461,7 +461,7 @@ function scorm_update_grades($scorm=null, $userid=0, $nullifnone=true) {
if ($scorm != null) {
if ($grades = scorm_get_user_grades($scorm, $userid)) {
- scorm_grade_item_update($scorm, $grades[$userid]);
+ scorm_grade_item_update($scorm, $grades);
} else if ($userid and $nullifnone) {
$grade = new object();
|
MDL-<I> reverting the [$userid] change - we do need array there in upgrades and changes in modedit; merged from MOODLE_<I>_STABLE
|
moodle_moodle
|
train
|
2bcd5a0588e3c5c74df28bea908266946a0ce157
|
diff --git a/app/controllers/system_templates_controller.rb b/app/controllers/system_templates_controller.rb
index <HASH>..<HASH> 100644
--- a/app/controllers/system_templates_controller.rb
+++ b/app/controllers/system_templates_controller.rb
@@ -58,8 +58,11 @@ class SystemTemplatesController < ApplicationController
product_hash = {}
@products.each{|prd| product_hash[prd.name] = prd.id}
+ package_groups = current_organization.locker.package_groups.collect{|grp| grp[:name]}.sort
+
retain_search_history
- render :index, :locals=>{:editable=>SystemTemplate.manageable?(current_organization), :product_hash => product_hash}
+ render :index, :locals=>{:editable=>SystemTemplate.manageable?(current_organization),
+ :product_hash => product_hash, :package_groups => package_groups}
end
def items
@@ -205,10 +208,10 @@ class SystemTemplatesController < ApplicationController
render :json=>Pulp::Package.name_search(name).sort.uniq[0..19]
end
- def auto_complete_package_groups
- name = params[:name]
- current_organization.locker.package_groups
- end
+ #def auto_complete_package_groups
+ # name = params[:name]
+ #
+ #end
def create
diff --git a/app/views/system_templates/index.html.haml b/app/views/system_templates/index.html.haml
index <HASH>..<HASH> 100644
--- a/app/views/system_templates/index.html.haml
+++ b/app/views/system_templates/index.html.haml
@@ -16,6 +16,8 @@
KT.content_breadcrumb = $.parseJSON('#{escape_javascript(template_content_breadcrumb())}');
KT.template_breadcrumb = $.parseJSON('#{escape_javascript(generate_template_breadcrumb())}');
KT.product_hash = $.parseJSON('#{escape_javascript(product_hash.to_json)}');
+ KT.package_groups = $.parseJSON('#{escape_javascript(package_groups.to_json)}');
+
localize({
"add": '+ #{_('Add')}',
"add_plus": '+ #{_('Add')}',
diff --git a/config/routes.rb b/config/routes.rb
index <HASH>..<HASH> 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -121,7 +121,6 @@ Src::Application.routes.draw do
get :auto_complete_search
get :items
get :auto_complete_package
- get :foobar
get :auto_complete_package_groups
get :product_packages
get :product_comps
diff --git a/public/javascripts/system_template.js b/public/javascripts/system_template.js
index <HASH>..<HASH> 100644
--- a/public/javascripts/system_template.js
+++ b/public/javascripts/system_template.js
@@ -403,7 +403,7 @@ KT.template_renderer = function() {
comps = function() {
var html = "";
if (KT.permissions.editable) {
- html += '<ul ><li class="content_input_item"><form id="add_group_form">';
+ html += '<ul ><li class="content_input_item"><form id="add_package_group_form">';
html += '<input id="add_package_group_input" type="text" size="33"><form> ';
html += '<a id="add_package_group" class="fr st_button ">' + i18n.add_plus + '</a>';
html += ' </li></ul>';
@@ -690,7 +690,7 @@ KT.package_group_actions = (function() {
//called everytime 'packages is loaded'
var register_autocomplete = function() {
current_input = KT.auto_complete_box({
- values: auto_complete_call,
+ values: KT.package_groups,
default_text: i18n.package_group_search_text,
input_id: "add_package_group_input",
form_id: "add_package_group_form",
@@ -699,31 +699,18 @@ KT.package_group_actions = (function() {
});
},
verify_add_group = function(name, cleanup_cb){
- KT.templates.add_package_group(name);
+ if ($.inArray(name, KT.package_groups) > -1) {
+ KT.templates.add_package_group(name);
+ }
+ else {
+ current_input.error();
+ }
cleanup_cb();
- /*
- $.ajax({
- type: "GET",
- url: KT.common.rootURL() + '/system_templates/auto_complete_package_group',
- data: {name:name},
- cache: false,
- success: function(data){
- if ($.inArray(name, data) > -1) {
- KT.templates.add_package_group(name);
- }
- else {
- current_input.error();
- }
- cleanup_cb();
- },
- error: KT.templates.throw_error
- }); */
},
auto_complete_call = function(req, response_cb) {
- console.log("Called");
$.ajax({
type: "GET",
- url: KT.routes.auto_complete_package_groups_system_templates_path(),
+ url: KT.common.rootURL() + '/system_templates/auto_complete_package_groups',
data: {name:req.term},
cache: false,
success: function(data){
|
system templates - package groups auto complete working
|
Katello_katello
|
train
|
c9525b2e5279a4a663c17507567018c4cbaacbb4
|
diff --git a/python/src/cm_api/endpoints/cms.py b/python/src/cm_api/endpoints/cms.py
index <HASH>..<HASH> 100644
--- a/python/src/cm_api/endpoints/cms.py
+++ b/python/src/cm_api/endpoints/cms.py
@@ -187,7 +187,9 @@ class ClouderaManager(BaseApiResource):
'endTime': end_datetime.isoformat(),
'includeInfoLog': includeInfoLog,
}
- return self._cmd('collectDiagnosticData', data=args)
+ # This method is deprecated as of CM API version 3 which was introduced
+ # in CM 4.5.
+ return self._cmd('collectDiagnosticData', data=args, api_version=2)
def collect_diagnostic_data_45(self, end_datetime, bundle_size_bytes, cluster_name=None,
roles=None, collect_metrics=False, start_datetime=None):
|
[API][SupportIntegration] OPSAPS-<I> Set API version to 2 for collect_diagnostic_data()
collect_diagnostic_data() was deprecated, in place of collect_diagnostic_data_<I>(), in CM API
version 3 which was introduced as a part of CM <I>.
Testing done:
-make test
|
cloudera_cm_api
|
train
|
33f59144107ca172fb67ba92609a1b223002a41c
|
diff --git a/lib/ruote/engine.rb b/lib/ruote/engine.rb
index <HASH>..<HASH> 100644
--- a/lib/ruote/engine.rb
+++ b/lib/ruote/engine.rb
@@ -73,7 +73,8 @@ module Ruote
'_id' => Time.now.to_f.to_s,
'wfid' => wfid,
'tree' => tree,
- 'workitem' => workitem)
+ 'workitem' => workitem,
+ 'variables' => {})
wfid
end
diff --git a/lib/ruote/exp/flowexpression.rb b/lib/ruote/exp/flowexpression.rb
index <HASH>..<HASH> 100644
--- a/lib/ruote/exp/flowexpression.rb
+++ b/lib/ruote/exp/flowexpression.rb
@@ -54,6 +54,14 @@ module Ruote::Exp
Ruote::FlowExpressionId.new(h.fei)
end
+ def parent_id
+ h.parent_id ? Ruote::FlowExpressionId.new(h.parent_id) : nil
+ end
+
+ def parent
+ self.class.get_expression(@context, h.parent_id)
+ end
+
#--
# PERSISTENCE
#++
@@ -68,6 +76,16 @@ module Ruote::Exp
@context.storage.delete(@h)
end
+ def self.get_expression (context, fei)
+
+ fexp = context.storage.get(
+ 'expressions', Ruote::FlowExpressionId.new(fei).to_storage_id)
+
+ exp_class = context.expmap.expression_class(fexp['name'])
+
+ exp_class.new(context, fexp)
+ end
+
#--
# META
#++
diff --git a/lib/ruote/exp/ro_variables.rb b/lib/ruote/exp/ro_variables.rb
index <HASH>..<HASH> 100644
--- a/lib/ruote/exp/ro_variables.rb
+++ b/lib/ruote/exp/ro_variables.rb
@@ -136,13 +136,11 @@ module Ruote::Exp
# holding the var is held. The block is meant to return the new value
# for the variable.
#
- def get_or_set_variable (var, &block)
-
- fexp, v = locate_var(var)
-
- fexp.gos_variable(v, block)
- # note that block is passed as regular argument
- end
+ #def get_or_set_variable (var, &block)
+ # fexp, v = locate_var(var)
+ # fexp.gos_variable(v, block)
+ # # note that block is passed as regular argument
+ #end
protected
@@ -180,10 +178,9 @@ module Ruote::Exp
# Does the magic for #get_or_set_variable (and is wrapped in a ticket).
#
- def gos_variable (var, block)
-
- un_set_variable(:set, var, block.call(@variables[var]))
- end
+ #def gos_variable (var, block)
+ # un_set_variable(:set, var, block.call(@variables[var]))
+ #end
#with_ticket :gos_variable
# Returns the flow expression that owns a variable (or the one
@@ -197,7 +194,7 @@ module Ruote::Exp
if prefix.length >= 2 # engine variable
return parent.locate_var(var, prefix) \
- if prefix.length == 1 && parent_id
+ if prefix.length == 1 && h.parent_id
# no prefix...
@@ -205,7 +202,7 @@ module Ruote::Exp
if h.variables
return parent.locate_var(var, prefix) \
- if parent_id
+ if h.parent_id
raise "uprooted var lookup, something went wrong"
end
diff --git a/lib/ruote/worker.rb b/lib/ruote/worker.rb
index <HASH>..<HASH> 100644
--- a/lib/ruote/worker.rb
+++ b/lib/ruote/worker.rb
@@ -90,10 +90,16 @@ module Ruote
action = task['action']
if task['tree']
+
launch(task)
+
elsif EXP_ACTIONS.include?(action)
- get_expression(task).send("do_#{action}", task['workitem'])
+
+ Ruote::Exp::FlowExpression.get_expression(@context, task['fei']).send(
+ "do_#{action}", task['workitem'])
+
elsif action == 'dispatch'
+
dispatch(task)
end
@@ -133,7 +139,7 @@ module Ruote
fei = task['fei']
workitem = task['workitem']
- variables = task['variables'] || {}
+ variables = task['variables']
fei ||= {
'engine_id' => @context['engine_id'] || 'engine',
@@ -164,16 +170,6 @@ module Ruote
#fei
end
- def get_expression (task)
-
- fexp = @storage.get(
- 'expressions', FlowExpressionId.new(task['fei']).to_storage_id)
-
- exp_class = context.expmap.expression_class(fexp['name'])
-
- exp_class.new(@context, fexp)
- end
-
def notify (event)
@subscribers.each do |type, actions, subscriber|
diff --git a/test/functional/eft_0_process_definition.rb b/test/functional/eft_0_process_definition.rb
index <HASH>..<HASH> 100644
--- a/test/functional/eft_0_process_definition.rb
+++ b/test/functional/eft_0_process_definition.rb
@@ -30,7 +30,7 @@ class EftProcessDefinitionTest < Test::Unit::TestCase
alpha = @engine.register_participant :alpha, Ruote::HashParticipant
- noisy
+ #noisy
wfid = @engine.launch(pdef)
|
locate_var fixed, next step is storing 'main' process tree in vars
|
jmettraux_ruote
|
train
|
cab33b40716dac985119b6f18447e0f6b6771c2a
|
diff --git a/src/org/jgroups/stack/Retransmitter.java b/src/org/jgroups/stack/Retransmitter.java
index <HASH>..<HASH> 100644
--- a/src/org/jgroups/stack/Retransmitter.java
+++ b/src/org/jgroups/stack/Retransmitter.java
@@ -1,4 +1,4 @@
-// $Id: Retransmitter.java,v 1.13 2007/01/16 16:41:02 belaban Exp $
+// $Id: Retransmitter.java,v 1.14 2007/01/18 18:17:34 belaban Exp $
package org.jgroups.stack;
@@ -24,7 +24,7 @@ import java.util.*;
*
* @author John Giorgiadis
* @author Bela Ban
- * @version $Revision: 1.13 $
+ * @version $Revision: 1.14 $
*/
public class Retransmitter {
@@ -38,7 +38,7 @@ public class Retransmitter {
private final List<Entry> msgs=new LinkedList(); // List<Entry> of elements to be retransmitted
private RetransmitCommand cmd=null;
private boolean retransmitter_owned;
- private TimeScheduler retransmitter=null;
+ private TimeScheduler timer=null;
protected static final Log log=LogFactory.getLog(Retransmitter.class);
@@ -103,7 +103,7 @@ public class Retransmitter {
synchronized(msgs) {
e=new Entry(first_seqno, last_seqno, RETRANSMIT_TIMEOUTS);
msgs.add(e);
- retransmitter.add(e);
+ timer.add(e);
}
}
@@ -163,7 +163,7 @@ public class Retransmitter {
synchronized(msgs) {
if(retransmitter_owned) {
try {
- retransmitter.stop();
+ timer.stop();
}
catch(InterruptedException ex) {
if(log.isErrorEnabled()) log.error("failed stopping retransmitter", ex);
@@ -221,7 +221,7 @@ public class Retransmitter {
this.sender=sender;
this.cmd=cmd;
retransmitter_owned=sched_owned;
- retransmitter=sched;
+ timer=sched;
}
|
renamed retransmitter to timer
|
belaban_JGroups
|
train
|
7e45cfda788ecd1577aea4a6695e6e3cb971c8fc
|
diff --git a/code/MSSQLDatabase.php b/code/MSSQLDatabase.php
index <HASH>..<HASH> 100644
--- a/code/MSSQLDatabase.php
+++ b/code/MSSQLDatabase.php
@@ -87,10 +87,16 @@ class MSSQLDatabase extends SS_Database {
if($this->mssql) {
$this->dbConn = mssql_connect($parameters['server'], $parameters['username'], $parameters['password'], true);
} else {
- $this->dbConn = sqlsrv_connect($parameters['server'], array(
- 'UID' => $parameters['username'],
- 'PWD' => $parameters['password'],
- ));
+ // Windows authentication doesn't require a username and password
+ if(defined('MSSQL_USE_WINDOWS_AUTHENTICATION') && MSSQL_USE_WINDOWS_AUTHENTICATION == true) {
+ $connectionInfo = array();
+ } else {
+ $connectionInfo = array(
+ 'UID' => $parameters['username'],
+ 'PWD' => $parameters['password'],
+ );
+ }
+ $this->dbConn = sqlsrv_connect($parameters['server'], $connectionInfo);
}
if(!$this->dbConn) {
|
ENHANCEMENT Support for Windows authentication for MSSQLDatabase - this is a more secure way of connecting to the database server, because a username and password is not required in the _ss_environment.php file
|
silverstripe_silverstripe-mssql
|
train
|
f07f20fbffc99359c0cf435633ccc1e14f66490b
|
diff --git a/core-bundle/contao/dca/tl_article.php b/core-bundle/contao/dca/tl_article.php
index <HASH>..<HASH> 100644
--- a/core-bundle/contao/dca/tl_article.php
+++ b/core-bundle/contao/dca/tl_article.php
@@ -192,7 +192,7 @@ $GLOBALS['TL_DCA']['tl_article'] = array
'author' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_article']['author'],
- 'default' => $this->User->id,
+ 'default' => BackendUser::getInstance()->id,
'exclude' => true,
'inputType' => 'select',
'foreignKey' => 'tl_user.name',
|
[Core] Use `BackendUser::getInstance()` instead of `$this->User` in the DCA
|
contao_contao
|
train
|
802bce74f9f83a8a2e9812407ea79bd27b4dd2ae
|
diff --git a/sos/archive.py b/sos/archive.py
index <HASH>..<HASH> 100644
--- a/sos/archive.py
+++ b/sos/archive.py
@@ -340,14 +340,14 @@ class FileCacheArchive(Archive):
# path case
try:
shutil.copy(src, dest)
+ except OSError as e:
+ self.log_info("File not collected: '%s'" % e)
except IOError as e:
# Filter out IO errors on virtual file systems.
if src.startswith("/sys/") or src.startswith("/proc/"):
pass
else:
self.log_info("caught '%s' copying '%s'" % (e, src))
- except OSError as e:
- self.log_info("File not collected: '%s'" % e)
# copy file attributes, skip SELinux xattrs for /sys and /proc
try:
|
[archive] Re-order exception handling in add_file
Re orders the order of exception handling within add_file(), to avoid an
unreachable OSError as highlighted by LGTM.
|
sosreport_sos
|
train
|
ad0be10cd1715edf6f9a7786e7aa487453c1abb4
|
diff --git a/alphalens/tests/test_performance.py b/alphalens/tests/test_performance.py
index <HASH>..<HASH> 100644
--- a/alphalens/tests/test_performance.py
+++ b/alphalens/tests/test_performance.py
@@ -28,6 +28,8 @@ from pandas import (
Timedelta
)
+from pandas.tseries.offsets import (BDay, Day)
+
from pandas.util.testing import (assert_frame_equal,
assert_series_equal)
@@ -574,36 +576,61 @@ class PerformanceTestCase(TestCase):
([-0.75, -0.75, -0.75, -0.75, -0.75],
'1D', '2D',
[1., 0.5, 0.25, 0.125, 0.0625, 0.03125, 0.015625]),
+ ([-0.75, -0.75, -0.75, -0.75, -0.75],
+ '1B', '2D',
+ [1., 0.5, 0.25, 0.125, 0.0625, 0.03125, 0.015625]),
([3.0, 3.0, 3.0, 3.0, 3.0],
'1D', '2D',
[1.0, 2.0, 4.0, 8.0, 16.0, 32.0, 64.0]),
+ ([3.0, 3.0, 3.0, 3.0, 3.0],
+ '1B', '2D',
+ [1.0, 2.0, 4.0, 8.0, 16.0, 32.0, 64.0]),
([3.0, -0.75, 3.0, -0.75, 3.0],
- '1h', '2h',
+ '1H', '2h',
[1.0, 2.0, 2.5, 3.125, 3.90625, 4.88281, 9.76562]),
([3.0, -0.75],
'1D', '2D',
[1.0, 2.0, 2.5, 1.25]),
+ ([3.0, -0.75],
+ '1B', '2D',
+ [1.0, 2.0, 2.5, 1.25]),
([7.0, -0.875, 7.0, -0.875, 7.0],
'1D', '3D',
[1.0, 2.0, 2.5, 3.75, 3.75, 5.625, 7.03125,
14.0625]),
+ ([7.0, -0.875, 7.0, -0.875, 7.0],
+ '1B', '3D',
+ [1.0, 2.0, 2.5, 3.75, 3.75, 5.625, 7.03125,
+ 14.0625]),
([7.0, -0.875, nan, 7.0, -0.875],
'1D', '3D',
[1.0, 2.0, 2.5, 3.125, 3.90625, 4.88281, 6.10351,
3.05175]),
+ ([7.0, -0.875, nan, 7.0, -0.875],
+ '1B', '3D',
+ [1.0, 2.0, 2.5, 3.125, 3.90625, 4.88281, 6.10351,
+ 3.05175]),
([7.0, nan, nan, -0.875, 7.0, nan, nan, nan, 7.0,
nan, -0.875],
- '1h', '3h',
+ '1H', '3h',
[1.0, 2.0, 4.0, 8.0, 4.0, 5.0, 6.25, 12.5, 12.5,
25., 50., 62.5, 31.25, 15.625]),
([15., nan, nan, -0.9375, 15., nan, nan, nan, 15.],
'1D', '4D',
[1.0, 2.0, 4.0, 8.0, 10.0, 12.5, 15.625, 19.53125,
39.0625, 78.125, 156.25, 312.5, 625.0]),
+ ([15., nan, nan, -0.9375, 15., nan, nan, nan, 15.],
+ '1B', '4D',
+ [1.0, 2.0, 4.0, 8.0, 10.0, 12.5, 15.625, 19.53125,
+ 39.0625, 78.125, 156.25, 312.5, 625.0]),
([15.0, -0.9375, 15.0, -0.9375],
'1D', '4D',
[1.0, 2.0, 2.5, 3.75, 4.6875, 4.6875, 5.85937,
2.92968]),
+ ([15.0, -0.9375, 15.0, -0.9375],
+ '1B', '4D',
+ [1.0, 2.0, 2.5, 3.75, 4.6875, 4.6875, 5.85937,
+ 2.92968]),
])
def test_cumulative_returns(self, returns, ret_freq, period_len,
expected_vals):
@@ -611,6 +638,7 @@ class PerformanceTestCase(TestCase):
period_len = Timedelta(period_len)
index = date_range('1/1/1999', periods=len(returns), freq=ret_freq)
returns = Series(returns, index=index)
+ returns.index.freq = BDay() if 'B' in ret_freq else Day()
cum_ret = cumulative_returns(returns, period_len)
|
TST: added more performance.cumulative_returns tests
|
quantopian_alphalens
|
train
|
4780980151c92bb8bd8e0d33801cc4788a215ef5
|
diff --git a/grade/edit/settings/form.php b/grade/edit/settings/form.php
index <HASH>..<HASH> 100644
--- a/grade/edit/settings/form.php
+++ b/grade/edit/settings/form.php
@@ -39,7 +39,7 @@ class course_settings_form extends moodleform {
$mform->addElement('header', 'general', get_string('generalsettings', 'grades'));
if ($can_view_admin_links) {
$link = '<a href="' . $CFG->wwwroot.'/'.$CFG->admin.'/settings.php?section=gradessettings">' . $strchangedefaults . '</a>';
- $mform->addElement('static', 'generalsettingslink', $link);
+ $mform->addElement('static', 'generalsettingslink', null, $link);
}
$options = array(-1 => get_string('default', 'grades'),
GRADE_REPORT_AGGREGATION_POSITION_FIRST => get_string('positionfirst', 'grades'),
@@ -58,7 +58,7 @@ class course_settings_form extends moodleform {
$mform->addElement('header', 'grade_item_settings', get_string('gradeitemsettings', 'grades'));
if ($can_view_admin_links) {
$link = '<a href="' . $CFG->wwwroot.'/'.$CFG->admin.'/settings.php?section=gradeitemsettings">' . $strchangedefaults . '</a>';
- $mform->addElement('static', 'gradeitemsettingslink', $link);
+ $mform->addElement('static', 'gradeitemsettingslink', null, $link);
}
$options = array(-1 => get_string('default', 'grades'),
@@ -101,7 +101,7 @@ class course_settings_form extends moodleform {
$mform->addElement('header', 'grade_'.$type.$plugin, get_string('modulename', 'grade'.$type.'_'.$plugin, NULL));
if ($can_view_admin_links) {
$link = '<a href="' . $CFG->wwwroot.'/'.$CFG->admin.'/settings.php?section=gradereport' . $plugin . '">' . $strchangedefaults . '</a>';
- $mform->addElement('static', 'gradeitemsettingslink', $link);
+ $mform->addElement('static', 'gradeitemsettingslink', null, $link);
}
$functionname($mform);
}
|
gradebook MDL-<I> Make "change defaults" links more obvious on grades->course settings page
|
moodle_moodle
|
train
|
99792f737a15dcbfce1a74097b0bdb95113d98f2
|
diff --git a/CHANGELOG b/CHANGELOG
index <HASH>..<HASH> 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -11,6 +11,7 @@
* Stripe: Set `receipt_email` to Stripe request if receipt delivery is requested [miccheng]
* Worldpay US: Add eCheck support [mrezentes]
* FirstData_e4: add level_3 data [mrezentes]
+* Vanco: Support passing ip address [duff]
== Version 1.53.0 (September 1, 2015)
diff --git a/lib/active_merchant/billing/gateways/vanco.rb b/lib/active_merchant/billing/gateways/vanco.rb
index <HASH>..<HASH> 100644
--- a/lib/active_merchant/billing/gateways/vanco.rb
+++ b/lib/active_merchant/billing/gateways/vanco.rb
@@ -132,6 +132,7 @@ module ActiveMerchant
add_client_id(doc)
add_amount(doc, money, options)
add_payment_method(doc, payment_method, options)
+ add_options(doc, options)
add_purchase_noise(doc)
end
end
@@ -238,6 +239,10 @@ module ActiveMerchant
doc.ReasonForCredit("Refund requested")
end
+ def add_options(doc, options)
+ doc.CustomerIPAddress(options[:ip]) if options[:ip]
+ end
+
def add_client_id(doc)
doc.ClientID(@options[:client_id])
end
diff --git a/test/remote/gateways/remote_vanco_test.rb b/test/remote/gateways/remote_vanco_test.rb
index <HASH>..<HASH> 100644
--- a/test/remote/gateways/remote_vanco_test.rb
+++ b/test/remote/gateways/remote_vanco_test.rb
@@ -27,6 +27,12 @@ class RemoteVancoTest < Test::Unit::TestCase
assert_equal "Success", response.message
end
+ def test_successful_purchase_with_ip_address
+ response = @gateway.purchase(@amount, @credit_card, @options.merge(ip: "192.168.19.123"))
+ assert_success response
+ assert_equal "Success", response.message
+ end
+
def test_failed_purchase
response = @gateway.purchase(@amount, @credit_card, billing_address: address(country: "CA"))
assert_failure response
diff --git a/test/unit/gateways/vanco_test.rb b/test/unit/gateways/vanco_test.rb
index <HASH>..<HASH> 100644
--- a/test/unit/gateways/vanco_test.rb
+++ b/test/unit/gateways/vanco_test.rb
@@ -40,6 +40,17 @@ class VancoTest < Test::Unit::TestCase
assert_equal "Success", response.message
end
+ def test_successful_purchase_with_ip_address
+ response = stub_comms do
+ @gateway.purchase(@amount, @credit_card, @options.merge(ip: "192.168.0.1"))
+ end.check_request do |endpoint, data, headers|
+ if data =~ /<RequestType>EFTAdd/
+ assert_match(%r(<CustomerIPAddress>192), data)
+ end
+ end.respond_with(successful_login_response, successful_purchase_response)
+ assert_success response
+ end
+
def test_failed_purchase
response = stub_comms do
@gateway.purchase(@amount, @credit_card, @options)
|
Vanco: Support passing ip address
|
activemerchant_active_merchant
|
train
|
aad5338f0fd5981b47ffe26b1308f1a637a256a9
|
diff --git a/invenio_previewer/assets/semantic-ui/js/invenio_previewer/bottom.js b/invenio_previewer/assets/semantic-ui/js/invenio_previewer/bottom.js
index <HASH>..<HASH> 100644
--- a/invenio_previewer/assets/semantic-ui/js/invenio_previewer/bottom.js
+++ b/invenio_previewer/assets/semantic-ui/js/invenio_previewer/bottom.js
@@ -6,6 +6,8 @@
* under the terms of the MIT License; see LICENSE file for more details.
*/
+import $ from "jquery";
+
$(".ui.button.embed-btn").click(function () {
$("#embedModal").modal("show");
});
|
assets: fix import on js file
|
inveniosoftware_invenio-previewer
|
train
|
078ebed16ab743031fa700bc858a873c9db39141
|
diff --git a/lib/saxerator/document_fragment.rb b/lib/saxerator/document_fragment.rb
index <HASH>..<HASH> 100644
--- a/lib/saxerator/document_fragment.rb
+++ b/lib/saxerator/document_fragment.rb
@@ -10,6 +10,8 @@ module Saxerator
end
def each(&block)
+ return to_enum unless block_given?
+
# Always have to start at the beginning of a File
@source.rewind if @source.respond_to?(:rewind)
|
Return an enumerator if no block is given
This is the typical pattern for Enumerable objects, and was an oversight
that it was not already-included here.
See <URL>
|
soulcutter_saxerator
|
train
|
d22e0a7cec3b9fc4b42c30d750788fdca5fbd87a
|
diff --git a/django_airavata/apps/api/static/django_airavata_api/js/models/Experiment.js b/django_airavata/apps/api/static/django_airavata_api/js/models/Experiment.js
index <HASH>..<HASH> 100644
--- a/django_airavata/apps/api/static/django_airavata_api/js/models/Experiment.js
+++ b/django_airavata/apps/api/static/django_airavata_api/js/models/Experiment.js
@@ -132,6 +132,18 @@ export default class Experiment extends BaseModel {
);
}
+ get isCancelable() {
+ switch(this.latestStatus.state){
+ case ExperimentState.VALIDATED:
+ case ExperimentState.SCHEDULED:
+ case ExperimentState.LAUNCHED:
+ case ExperimentState.EXECUTING:
+ return true;
+ default:
+ return false;
+ }
+ }
+
get resourceHostId() {
return this.userConfigurationData &&
this.userConfigurationData.computationalResourceScheduling
diff --git a/django_airavata/apps/api/views.py b/django_airavata/apps/api/views.py
index <HASH>..<HASH> 100644
--- a/django_airavata/apps/api/views.py
+++ b/django_airavata/apps/api/views.py
@@ -303,14 +303,13 @@ class ExperimentViewSet(APIBackedViewSet):
@detail_route(methods=['post'])
def cancel(self, request, experiment_id=None):
try:
- request.airavata_client.launchExperiment(
+ request.airavata_client.terminateExperiment(
request.authz_token, experiment_id, self.gateway_id)
return Response({'success': True})
except Exception as e:
log.error("Cancel action has thrown the following error: ", e)
return Response({'success': False, 'errorMessage': e.message})
-
def _get_writeable_project(self, experiment):
# figure what project to clone into:
# 1) project of this experiment if writeable
diff --git a/django_airavata/apps/workspace/static/django_airavata_workspace/js/components/experiment/ExperimentSummary.vue b/django_airavata/apps/workspace/static/django_airavata_workspace/js/components/experiment/ExperimentSummary.vue
index <HASH>..<HASH> 100644
--- a/django_airavata/apps/workspace/static/django_airavata_workspace/js/components/experiment/ExperimentSummary.vue
+++ b/django_airavata/apps/workspace/static/django_airavata_workspace/js/components/experiment/ExperimentSummary.vue
@@ -238,7 +238,7 @@
<script>
import { models, services } from "django-airavata-api";
-import { components } from "django-airavata-common-ui";
+import { components, notifications } from "django-airavata-common-ui";
import OutputDisplayContainer from "./output-displays/OutputDisplayContainer";
import urls from "../../utils/urls";
@@ -328,16 +328,7 @@ export default {
return this.localFullExperiment.applicationName;
},
isCancelable() {
- switch(this.localFullExperiment.experimentStatusName){
-
- case "VALIDATED":
- case 'SCHEDULED':
- case 'LAUNCHED':
- case 'EXECUTING':
- return true;
- default:
- return false;
- }
+ return this.localFullExperiment.experiment.isCancelable;
},
storageDirLink() {
if (this.experiment.relativeExperimentDataDir) {
@@ -383,7 +374,15 @@ export default {
cancel() {
services.ExperimentService.cancel({
lookup: this.experiment.experimentId
- });
+ }).then(() => {
+ notifications.NotificationList.add(
+ new notifications.Notification({
+ type: "SUCCESS",
+ message: "Trying to cancel the experiment",
+ duration: 5
+ })
+ )
+ });
},
getDataProducts(io, collection) {
if (!io.value || !collection) {
|
Moved isClonable to experiment.js
Using enum instead of string values
Update launchExperiment to terminateExperiment
Added notification after cancel button is pressed
|
apache_airavata-django-portal
|
train
|
744409fd3bd37cef577c7618105cac9926439cca
|
diff --git a/examples/howto/parser.go b/examples/howto/parser.go
index <HASH>..<HASH> 100644
--- a/examples/howto/parser.go
+++ b/examples/howto/parser.go
@@ -95,7 +95,10 @@ func main() {
parser := &TestResultParser{}
r, err := s.Result(parser)
- _ = err
+ if err != nil {
+ fmt.Println("Error when querying solr:", err.Error())
+ return
+ }
fmt.Println(r.Results.Docs)
fmt.Println(parser.original_response)
|
Adding Error checking in example
|
vanng822_go-solr
|
train
|
6d027900ee3a1567a5bd95c028b2be16ea503a2c
|
diff --git a/spring-session-core/src/main/java/org/springframework/session/web/http/SessionRepositoryFilter.java b/spring-session-core/src/main/java/org/springframework/session/web/http/SessionRepositoryFilter.java
index <HASH>..<HASH> 100644
--- a/spring-session-core/src/main/java/org/springframework/session/web/http/SessionRepositoryFilter.java
+++ b/spring-session-core/src/main/java/org/springframework/session/web/http/SessionRepositoryFilter.java
@@ -230,7 +230,8 @@ public class SessionRepositoryFilter<S extends Session> extends OncePerRequestFi
}
else {
S session = wrappedSession.getSession();
- saveSession(session);
+ clearRequestedSessionCache();
+ SessionRepositoryFilter.this.sessionRepository.save(session);
String sessionId = session.getId();
if (!isRequestedSessionIdValid()
|| !sessionId.equals(getRequestedSessionId())) {
@@ -371,10 +372,9 @@ public class SessionRepositoryFilter<S extends Session> extends OncePerRequestFi
return this.requestedSession;
}
- private void saveSession(S session) {
+ private void clearRequestedSessionCache() {
this.requestedSessionCached = false;
this.requestedSession = null;
- SessionRepositoryFilter.this.sessionRepository.save(session);
}
/**
@@ -394,6 +394,7 @@ public class SessionRepositoryFilter<S extends Session> extends OncePerRequestFi
super.invalidate();
SessionRepositoryRequestWrapper.this.requestedSessionInvalidated = true;
setCurrentSession(null);
+ clearRequestedSessionCache();
SessionRepositoryFilter.this.sessionRepository.deleteById(getId());
}
}
diff --git a/spring-session-core/src/test/java/org/springframework/session/web/http/SessionRepositoryFilterTests.java b/spring-session-core/src/test/java/org/springframework/session/web/http/SessionRepositoryFilterTests.java
index <HASH>..<HASH> 100644
--- a/spring-session-core/src/test/java/org/springframework/session/web/http/SessionRepositoryFilterTests.java
+++ b/spring-session-core/src/test/java/org/springframework/session/web/http/SessionRepositoryFilterTests.java
@@ -67,6 +67,7 @@ import static org.mockito.BDDMockito.given;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.reset;
import static org.mockito.Mockito.spy;
+import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyZeroInteractions;
@@ -1335,6 +1336,32 @@ public class SessionRepositoryFilterTests {
verifyZeroInteractions(sessionRepository);
}
+ @Test
+ public void doFilterSessionRetrievalIsCached() throws Exception {
+ MapSession session = this.sessionRepository.createSession();
+ this.sessionRepository.save(session);
+ SessionRepository<MapSession> sessionRepository = spy(this.sessionRepository);
+ setSessionCookie(session.getId());
+
+ this.filter = new SessionRepositoryFilter<>(sessionRepository);
+
+ doFilter(new DoInFilter() {
+ @Override
+ public void doFilter(HttpServletRequest wrappedRequest,
+ HttpServletResponse wrappedResponse) {
+ wrappedRequest.getSession().invalidate();
+ wrappedRequest.getSession();
+ }
+ });
+
+ // 3 invocations expected: initial resolution, after invalidation, after commit
+ verify(sessionRepository, times(3)).findById(eq(session.getId()));
+ verify(sessionRepository).deleteById(eq(session.getId()));
+ verify(sessionRepository).createSession();
+ verify(sessionRepository).save(any());
+ verifyZeroInteractions(sessionRepository);
+ }
+
// --- order
@Test
|
Fix caching of requested session in SessionRepositoryFilter
Closes gh-<I>
|
spring-projects_spring-session
|
train
|
4c2c524b652fbb7ccb2586d9f1a3ffb05ed5e110
|
diff --git a/lib/sfn/command/update.rb b/lib/sfn/command/update.rb
index <HASH>..<HASH> 100644
--- a/lib/sfn/command/update.rb
+++ b/lib/sfn/command/update.rb
@@ -247,7 +247,7 @@ module Sfn
def scrub_template(template)
template = Sfn::Utils::StackParameterScrubber.scrub!(template)
(template['Resources'] || {}).each do |r_name, r_content|
- if(custom_stack_types.include?(r_content['Type']))
+ if(valid_stack_types.include?(r_content['Type']))
(r_content['Properties'] || {}).delete('Stack')
end
end
|
Use helper for valid stack types when scrubbing
|
sparkleformation_sfn
|
train
|
353998d8d33ae9e49df22f0fa8a18a2188c0d0b8
|
diff --git a/app/controllers/roles_controller.rb b/app/controllers/roles_controller.rb
index <HASH>..<HASH> 100644
--- a/app/controllers/roles_controller.rb
+++ b/app/controllers/roles_controller.rb
@@ -15,8 +15,9 @@ class RolesController < ApplicationController
before_filter :find_role, :except => [:index, :items, :new, :create, :verbs_and_scopes]
before_filter :authorize #call authorize after find_role so we call auth based on the id instead of cp_id
- before_filter :setup_resource_types, :only =>[:edit, :update, :update_permission, :show_permission, :create_permission]
before_filter :setup_options, :only => [:index, :items]
+ helper_method :resource_types
+
include AutoCompleteSearch
def rules
@@ -170,11 +171,8 @@ class RolesController < ApplicationController
@role = Role.find(params[:id]) unless params.has_key? :role_id
end
- def setup_resource_types
- @resource_types = {}
- ResourceType::TYPES.each do |res, details|
- @resource_types[res] = details[:name]
- end
+ def resource_types
+ ResourceType::TYPES
end
-
+
end
diff --git a/app/helpers/roles_helper.rb b/app/helpers/roles_helper.rb
index <HASH>..<HASH> 100644
--- a/app/helpers/roles_helper.rb
+++ b/app/helpers/roles_helper.rb
@@ -27,13 +27,13 @@ module RolesHelper
end
def get_scopes(f)
- return Tag.tags_for(@resource_types.first[0]) || [] if f.object.new_record?
+ return Tag.tags_for(resource_types.first[0]) || [] if f.object.new_record?
Tag.tags_for(f.object.resource_type.name) || []
end
def get_verbs(f)
if f.object.new_record?
- verbs = Verb.verbs_for(@resource_types.first[0]) || {}
+ verbs = Verb.verbs_for(resource_types.first[0]) || {}
verbs = verbs.collect {|name, display| [name, display]}
verbs.sort! {|a,b| a[1] <=> b[1]}
return verbs
diff --git a/app/views/roles/_permission.html.haml b/app/views/roles/_permission.html.haml
index <HASH>..<HASH> 100644
--- a/app/views/roles/_permission.html.haml
+++ b/app/views/roles/_permission.html.haml
@@ -12,7 +12,7 @@
.grid_1.ra.fielditem
= f.label :type, _("Type")
.grid_6.la.fielditem
- = res.select :name, @resource_types.collect {|name, display| [display, name]}, {}, :data_type => "types"
+ = res.select :name, resource_types.collect {|name, details| [details[:name], name]}, {}, :data_type => "types"
|
Added code to return all details about a resource type as opposed to just the name for the roles perms pages
|
Katello_katello
|
train
|
3a19fc6513c8e56e417154c0f44d8504a975ac86
|
diff --git a/.gitignore b/.gitignore
index <HASH>..<HASH> 100644
--- a/.gitignore
+++ b/.gitignore
@@ -10,3 +10,5 @@ newfeatures/*
/mejs3/
node_modules
local-build
+# PhpStorm/WebStorm configuration
+.idea
\ No newline at end of file
diff --git a/Gruntfile.js b/Gruntfile.js
index <HASH>..<HASH> 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -177,4 +177,6 @@ module.exports = function(grunt) {
grunt.registerTask('default', ['concat', 'removelogging', 'uglify', 'cssmin', 'copy',
'shell:buildFlash', 'replace:cdnBuild', 'shell:buildFlashCDN', 'clean:temp']);
+ grunt.registerTask('html5only', ['concat', 'removelogging', 'uglify', 'cssmin', 'copy', 'clean:temp']);
+
};
\ No newline at end of file
diff --git a/src/js/mep-library.js b/src/js/mep-library.js
index <HASH>..<HASH> 100644
--- a/src/js/mep-library.js
+++ b/src/js/mep-library.js
@@ -4,7 +4,7 @@ if (typeof jQuery != 'undefined') {
mejs.$ = Zepto;
// define `outerWidth` method which has not been realized in Zepto
- $.fn.outerWidth = function(includeMargin) {
+ Zepto.fn.outerWidth = function(includeMargin) {
var width = $(this).width();
if (includeMargin) {
width += parseInt($(this).css('margin-right'), 10);
|
add one more task to build only html5 version
|
mediaelement_mediaelement
|
train
|
2bc2814d5e5cd6951bdcc8dc52b4dd45c60da374
|
diff --git a/src/qtism/runtime/rendering/markup/xhtml/AbstractXhtmlRenderer.php b/src/qtism/runtime/rendering/markup/xhtml/AbstractXhtmlRenderer.php
index <HASH>..<HASH> 100644
--- a/src/qtism/runtime/rendering/markup/xhtml/AbstractXhtmlRenderer.php
+++ b/src/qtism/runtime/rendering/markup/xhtml/AbstractXhtmlRenderer.php
@@ -241,6 +241,12 @@ abstract class AbstractXhtmlRenderer extends AbstractMarkupRenderer
public function additionalClass($additionalClass)
{
$additionalClasses = $this->getAdditionalClasses();
+
+
+ if (($key = array_search($additionalClass, $additionalClasses)) !== false) {
+ unset($additionalClasses[$key]);
+ }
+
$additionalClasses[] = $additionalClass;
$this->setAdditionalClasses(array_unique($additionalClasses));
}
|
CSS classes now added in the correct hierarchical order.
|
oat-sa_qti-sdk
|
train
|
89f9c55e0bf78a10a8624ef67b48c5826c660a4e
|
diff --git a/hack/coalesce.py b/hack/coalesce.py
index <HASH>..<HASH> 100755
--- a/hack/coalesce.py
+++ b/hack/coalesce.py
@@ -77,8 +77,9 @@ def main():
root.set('time', '0')
for package in sorted(test_packages('bazel-testlogs')):
root.append(result(package))
- artifacts_dir = os.path.join(os.environ.get('WORKSPACE', os.getcwd()),
- '_artifacts')
+ artifacts_dir = os.environ.get(
+ 'ARTIFACTS',
+ os.path.join(os.environ.get('WORKSPACE', os.getcwd()), '_artifacts'))
try:
os.mkdir(artifacts_dir)
except OSError:
|
coalesce.py should use $ARTIFACTS if it exists.
|
kubernetes_test-infra
|
train
|
89077047ca4b6dbe447284e1340bb8fc7b35652a
|
diff --git a/lib/swag_dev/project/tools/yardoc.rb b/lib/swag_dev/project/tools/yardoc.rb
index <HASH>..<HASH> 100644
--- a/lib/swag_dev/project/tools/yardoc.rb
+++ b/lib/swag_dev/project/tools/yardoc.rb
@@ -31,6 +31,17 @@ class SwagDev::Project::Tools::Yardoc
::Pathname.new(path)
end
+ # Get paths (based on ``YARD::CLI::Yardoc#files``)
+ #
+ # @return [Array<Pathname>]
+ def paths
+ core.files.to_a.flatten.map do |file|
+ Dir.glob(file)
+ .map { |f| ::Pathname.new(f) }
+ .map { |fpath| fpath.dirname }.uniq.sort[0]
+ end.flatten.uniq.sort
+ end
+
# Ignores files matching path match (regexp)
#
# @return [Array<String>]
|
yardoc (tools) paths method added
|
SwagDevOps_kamaze-project
|
train
|
8a3018c768a329c0f7d5c15eebccd3fdc88a2263
|
diff --git a/pdb.py b/pdb.py
index <HASH>..<HASH> 100644
--- a/pdb.py
+++ b/pdb.py
@@ -22,8 +22,10 @@ import pprint
import re
import signal
from collections import OrderedDict
-from fancycompleter import Completer, ConfigurableClass, Color
+
import fancycompleter
+import six
+from fancycompleter import Color, Completer, ConfigurableClass
__author__ = 'Antonio Cuni <anto.cuni@gmail.com>'
__url__ = 'http://github.com/antocuni/pdb'
@@ -170,6 +172,37 @@ class Undefined:
undefined = Undefined()
+class PdbMeta(type):
+ def __call__(cls, *args, **kwargs):
+ """Reuse an existing instance with ``pdb.set_trace()``."""
+ use_global_pdb = kwargs.get("use_global_pdb", True)
+ global_pdb = getattr(local, "GLOBAL_PDB", None)
+
+ calling_frame = sys._getframe().f_back
+ called_for_set_trace = (
+ calling_frame.f_code.co_name == "set_trace"
+ and calling_frame.f_back
+ and "set_trace" in calling_frame.f_back.f_code.co_names)
+
+ if use_global_pdb and global_pdb and called_for_set_trace:
+ if hasattr(global_pdb, "botframe"):
+ # Do not stop while tracing is active (in _set_stopinfo).
+ # But skip it with instances that have not called set_trace
+ # before.
+ global_pdb.set_continue()
+ global_pdb._skip_init = True
+ return global_pdb
+
+ obj = cls.__new__(cls)
+ if called_for_set_trace:
+ kwargs.setdefault("start_filename", calling_frame.f_code.co_filename)
+ kwargs.setdefault("start_lineno", calling_frame.f_lineno)
+ obj.__init__(*args, **kwargs)
+ local.GLOBAL_PDB = obj
+ return obj
+
+
+@six.add_metaclass(PdbMeta)
class Pdb(pdb.Pdb, ConfigurableClass, object):
DefaultConfig = DefaultConfig
@@ -205,32 +238,6 @@ class Pdb(pdb.Pdb, ConfigurableClass, object):
self.hidden_frames = []
self.stdout = self.ensure_file_can_write_unicode(self.stdout)
- def __new__(cls, *args, **kwargs):
- """Reuse an existing instance with ``pdb.set_trace()``."""
- use_global_pdb = kwargs.get("use_global_pdb", True)
- global_pdb = getattr(local, "GLOBAL_PDB", None)
- if use_global_pdb and global_pdb:
- called_for_set_trace = False
- frame = sys._getframe()
- while frame.f_back:
- frame = frame.f_back
- if (frame.f_code.co_name == "set_trace"
- and frame.f_back
- and "set_trace" in frame.f_back.f_code.co_names):
- called_for_set_trace = True
- break
- if called_for_set_trace:
- if hasattr(global_pdb, "botframe"):
- # Do not stop while tracing is active (in _set_stopinfo).
- # But skip it with instances that have not called set_trace
- # before.
- global_pdb.set_continue()
- global_pdb._skip_init = True
- return global_pdb
- ret = super(Pdb, cls).__new__(cls)
- local.GLOBAL_PDB = ret
- return ret
-
def ensure_file_can_write_unicode(self, f):
# Wrap with an encoder, but only if not already wrapped
if (not hasattr(f, 'stream')
diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -84,6 +84,7 @@ setup(
"fancycompleter>=0.8",
"wmctrl",
"pygments",
+ "six",
],
extras_require={
'funcsigs': ["funcsigs"],
diff --git a/testing/test_pdb.py b/testing/test_pdb.py
index <HASH>..<HASH> 100644
--- a/testing/test_pdb.py
+++ b/testing/test_pdb.py
@@ -3595,3 +3595,27 @@ def test_set_trace_with_incomplete_pdb():
5 frames hidden .*
# c
""")
+
+
+def test_config_gets_start_filename():
+ def fn():
+ setup_lineno = set_trace.__code__.co_firstlineno + 8
+ set_trace_lineno = sys._getframe().f_lineno + 8
+
+ class MyConfig(ConfigTest):
+ def setup(self, pdb):
+ print("config_setup")
+ assert pdb.start_filename == __file__
+ assert pdb.start_lineno == setup_lineno
+
+ set_trace(Config=MyConfig)
+
+ assert pdb.local.GLOBAL_PDB.start_lineno == set_trace_lineno
+
+ check(fn, r"""
+config_setup
+[NUM] > .*fn()
+-> assert pdb.local.GLOBAL_PDB.start_lineno == set_trace_lineno
+ 5 frames hidden .*
+# c
+""")
|
Fix (unreleased) regression with missing start attributes
This is not exactly the same as before (which was only done via the
module's `set_trace`), and therefore still gets updated in
`Pdb.set_trace()` (after initially in `__init__`).
|
antocuni_pdb
|
train
|
a12ffbce1b517181768bc520933b888e2c219b80
|
diff --git a/code/site/modules/mod_default/template.php b/code/site/modules/mod_default/template.php
index <HASH>..<HASH> 100644
--- a/code/site/modules/mod_default/template.php
+++ b/code/site/modules/mod_default/template.php
@@ -20,6 +20,29 @@
class ModDefaultTemplate extends KTemplateDefault
{
/**
+ * The cache object
+ *
+ * @var JCache
+ */
+ protected $_cache;
+
+ /**
+ * Constructor
+ *
+ * Prevent creating instances of this class by making the contructor private
+ *
+ * @param object An optional KConfig object with configuration options
+ */
+ public function __construct(KConfig $config)
+ {
+ parent::__construct($config);
+
+ if(KFactory::get('lib.joomla.config')->getValue('config.caching')) {
+ $this->_cache = KFactory::tmp('lib.joomla.cache', array('template', 'output'));
+ }
+ }
+
+ /**
* Load a template by path -- first look in the templates folder for an override
*
* This function tries to get the template from the cache. If it cannot be found
@@ -31,24 +54,21 @@ class ModDefaultTemplate extends KTemplateDefault
*/
public function loadFile($path, $data = array(), $process = true)
{
- //Load from cache or cache the template
- $cache = KFactory::tmp('lib.joomla.cache', array('template', 'output'));
-
- //Set the lifetime to 0 to make sure cache isn't garbage collected.
- $cache->setLifeTime(0);
-
- $identifier = md5($path);
-
- if ($template = $cache->get($identifier))
+ if(isset($this->_cache))
{
- // store the path
- $this->_path = $path;
+ $identifier = md5($path);
+
+ if ($template = $this->_cache->get($identifier))
+ {
+ // store the path
+ $this->_path = $path;
- $this->loadString($template, $data, $process);
+ $this->loadString($template, $data, $process);
+ return $this;
+ }
}
- else parent::loadFile($path, $data, $process);
-
- return $this;
+
+ return parent::loadFile($path, $data, $process);;
}
/**
@@ -94,21 +114,21 @@ class ModDefaultTemplate extends KTemplateDefault
*/
public function parse()
{
- $cache = KFactory::tmp('lib.joomla.cache', array('template', 'output'));
-
- //Set the lifetime to 0 to make sure cache isn't garbage collected.
- $cache->setLifeTime(0);
-
- $identifier = md5($this->_path);
-
- if (!$template = $cache->get($identifier))
+ if(isset($this->_cache))
{
- $template = parent::parse();
+ $identifier = md5($this->_path);
+
+ if (!$template = $this->_cache->get($identifier))
+ {
+ $template = parent::parse();
- //Store the object in the cache
- $cache->store($template, $identifier);
+ //Store the object in the cache
+ $this->_cache->store($template, $identifier);
+ }
+
+ return $template;
}
- return $template;
+ return parent::parse();
}
}
\ No newline at end of file
|
Performance : Only create a caching object if the cache is enabled and store it as a class property to avoid recreation.
|
timble_kodekit
|
train
|
06bf93caed06bd43bf4295d1ca76424ea5d05bc9
|
diff --git a/doc/command-t.txt b/doc/command-t.txt
index <HASH>..<HASH> 100644
--- a/doc/command-t.txt
+++ b/doc/command-t.txt
@@ -1558,6 +1558,10 @@ master (not yet released)
- Fix a RangeError on 64-bit Windows (#304, patch from Adrian Keet).
- Fix issue switching back to previously opened file in another tab (#306).
- Fix inability to open some help targets with |:CommandTHelp| (#307).
+- Similar to #307, make |:CommandTCommand| work with commands containing
+ special characters.
+- Again similar to #307, prevent special characters in tags from being escaped
+ when using |:CommandTTag|.
5.0.1 (18 August 2017) ~
diff --git a/ruby/command-t/lib/command-t/finder/command_finder.rb b/ruby/command-t/lib/command-t/finder/command_finder.rb
index <HASH>..<HASH> 100644
--- a/ruby/command-t/lib/command-t/finder/command_finder.rb
+++ b/ruby/command-t/lib/command-t/finder/command_finder.rb
@@ -10,9 +10,17 @@ module CommandT
end
def open_selection(command, selection, options = {})
+ escaped = VIM.escape_for_single_quotes selection
::VIM::command "call feedkeys(':#{selection} ', 'nt')"
end
+ def prepare_selection(selection)
+ # Pass selection through as-is, bypassing path-based stuff that the
+ # controller would otherwise do, like `expand_path`,
+ # `sanitize_path_string` and `relative_path_under_working_directory`.
+ selection
+ end
+
def flush; end
def name
diff --git a/ruby/command-t/lib/command-t/finder/history_finder.rb b/ruby/command-t/lib/command-t/finder/history_finder.rb
index <HASH>..<HASH> 100644
--- a/ruby/command-t/lib/command-t/finder/history_finder.rb
+++ b/ruby/command-t/lib/command-t/finder/history_finder.rb
@@ -11,12 +11,17 @@ module CommandT
end
def open_selection(command, selection, options = {})
- # Need to unescape to reverse the work done by `#sanitize_path_string`.
- unescaped = selection.gsub(/\\(.)/, '\1')
- escaped = VIM.escape_for_single_quotes unescaped
+ escaped = VIM.escape_for_single_quotes(selection)
::VIM::command "call feedkeys('#{@history_type}#{escaped} ', 'nt')"
end
+ def prepare_selection(selection)
+ # Pass selection through as-is, bypassing path-based stuff that the
+ # controller would otherwise do, like `expand_path`,
+ # `sanitize_path_string` and `relative_path_under_working_directory`.
+ selection
+ end
+
def flush; end
def name
diff --git a/ruby/command-t/lib/command-t/finder/tag_finder.rb b/ruby/command-t/lib/command-t/finder/tag_finder.rb
index <HASH>..<HASH> 100644
--- a/ruby/command-t/lib/command-t/finder/tag_finder.rb
+++ b/ruby/command-t/lib/command-t/finder/tag_finder.rb
@@ -18,6 +18,13 @@ module CommandT
::VIM::command "silent! tag #{selection} | :normal zz"
end
+ def prepare_selection(selection)
+ # Pass selection through as-is, bypassing path-based stuff that the
+ # controller would otherwise do, like `expand_path`,
+ # `sanitize_path_string` and `relative_path_under_working_directory`.
+ selection
+ end
+
def flush
@scanner.flush
end
|
Avoid unwanted escaping in :CommandTCommand and :CommandTTag
Also adjusting `:CommandTHistory` to use the same approach, for
consistency.
|
wincent_command-t
|
train
|
a38d87d4042c107c353c8de095d733896a8d9be7
|
diff --git a/grimoire_elk/enriched/enrich.py b/grimoire_elk/enriched/enrich.py
index <HASH>..<HASH> 100644
--- a/grimoire_elk/enriched/enrich.py
+++ b/grimoire_elk/enriched/enrich.py
@@ -710,6 +710,22 @@ class Enrich(ElasticItems):
return enrolls
+ @staticmethod
+ def get_main_enrollments(enrollments):
+ """ Get the main enrollment given a list of enrollments.
+ If the enrollment contains :: the main one is the first part.
+
+ For example:
+ - Enrollment: Chaoss::Eng
+ - Main: Chaoss
+
+ If there is more than one, it will return ordered alphabetically.
+ """
+ main_orgs = list(map(lambda x: x.split("::")[0], enrollments))
+ main_orgs = sorted(list(set(main_orgs)))
+
+ return main_orgs
+
def __get_item_sh_fields_empty(self, rol, undefined=False):
""" Return a SH identity with all fields to empty_field """
# If empty_field is None, the fields do not appear in index patterns
@@ -799,10 +815,13 @@ class Enrich(ElasticItems):
eitem_sh[rol + "_gender"] = self.unknown_gender
eitem_sh[rol + "_gender_acc"] = 0
- eitem_sh[rol + "_org_name"] = self.get_enrollment(eitem_sh[rol + "_uuid"], item_date)
eitem_sh[rol + "_bot"] = self.is_bot(eitem_sh[rol + '_uuid'])
- eitem_sh[rol + MULTI_ORG_NAMES] = self.get_multi_enrollment(eitem_sh[rol + "_uuid"], item_date)
+ multi_enrolls = self.get_multi_enrollment(eitem_sh[rol + "_uuid"], item_date)
+ main_enrolls = self.get_main_enrollments(multi_enrolls)
+ all_enrolls = list(set(main_enrolls + multi_enrolls))
+ eitem_sh[rol + MULTI_ORG_NAMES] = all_enrolls
+ eitem_sh[rol + "_org_name"] = main_enrolls[0]
return eitem_sh
diff --git a/tests/test_enrich.py b/tests/test_enrich.py
index <HASH>..<HASH> 100644
--- a/tests/test_enrich.py
+++ b/tests/test_enrich.py
@@ -595,6 +595,12 @@ class TestEnrich(unittest.TestCase):
self.assertEqual(eitem_sh['author_bot'], False)
self.assertEqual(eitem_sh['author_multi_org_names'], ['-- UNDEFINED --'])
+ def test_get_main_enrollments(self):
+ """Test get the main enrollment given the list of enrollments"""
+ enrollments = ['Bitergia::Eng', 'Chaoss']
+ main_enrolls = self._enrich.get_main_enrollments(enrollments)
+ self.assertListEqual(main_enrolls, ['Bitergia', 'Chaoss'])
+
def test_no_params(self):
"""Neither identity nor sh_id are passed as arguments"""
|
[enrich] Get main enrollments for *_org_name field
This code gets the main enrollments for `*_org_name` when
there are several enrollments.
If the enrollment contains :: the main one is the first part.
For example:
- Enrollment: Chaoss::Eng
- Main: Chaoss
If there is more than one, it will return ordered alphabetically.
Test added accordingly.
|
chaoss_grimoirelab-elk
|
train
|
02c46a0819e9094b42e27d3c8f4478b62f5663b9
|
diff --git a/src/com/esotericsoftware/kryo/Kryo.java b/src/com/esotericsoftware/kryo/Kryo.java
index <HASH>..<HASH> 100644
--- a/src/com/esotericsoftware/kryo/Kryo.java
+++ b/src/com/esotericsoftware/kryo/Kryo.java
@@ -1002,19 +1002,24 @@ public class Kryo {
* {@link #setInstantiatorStrategy(InstantiatorStrategy) strategy} is set, it will be used instead of throwing an exception. */
protected ObjectInstantiator newInstantiator (final Class type) {
if (!Util.isAndroid) {
- // ReflectASM.
- try {
- final ConstructorAccess access = ConstructorAccess.get(type);
- return new ObjectInstantiator() {
- public Object newInstance () {
- try {
- return access.newInstance();
- } catch (Exception ex) {
- throw new KryoException("Error constructing instance of class: " + className(type), ex);
+ // Use ReflectASM if the class is not a non-static member class.
+ Class enclosingType = type.getEnclosingClass();
+ boolean isNonStaticMemberClass = enclosingType != null && type.isMemberClass()
+ && !Modifier.isStatic(type.getModifiers());
+ if (!isNonStaticMemberClass) {
+ try {
+ final ConstructorAccess access = ConstructorAccess.get(type);
+ return new ObjectInstantiator() {
+ public Object newInstance () {
+ try {
+ return access.newInstance();
+ } catch (Exception ex) {
+ throw new KryoException("Error constructing instance of class: " + className(type), ex);
+ }
}
- }
- };
- } catch (Exception ignored) {
+ };
+ } catch (Exception ignored) {
+ }
}
}
// Reflection.
diff --git a/src/com/esotericsoftware/kryo/io/Output.java b/src/com/esotericsoftware/kryo/io/Output.java
index <HASH>..<HASH> 100644
--- a/src/com/esotericsoftware/kryo/io/Output.java
+++ b/src/com/esotericsoftware/kryo/io/Output.java
@@ -26,7 +26,8 @@ public class Output extends OutputStream {
/** Creates a new Output for writing to a byte array.
* @param bufferSize The initial size of the buffer.
- * @param maxBufferSize The buffer is doubled as needed until it exceeds maxBufferSize and an exception is thrown. */
+ * @param maxBufferSize The buffer is doubled as needed until it exceeds maxBufferSize and an exception is thrown. Can be -1
+ * for no maximum. */
public Output (int bufferSize, int maxBufferSize) {
if (maxBufferSize < -1) throw new IllegalArgumentException("maxBufferSize cannot be < -1: " + maxBufferSize);
this.capacity = bufferSize;
|
Avoid ReflectASM for non-static member classes.
|
EsotericSoftware_kryo
|
train
|
653dce34b829f0139b1d5563ef171819ae760a3f
|
diff --git a/spyderlib/spyder.py b/spyderlib/spyder.py
index <HASH>..<HASH> 100644
--- a/spyderlib/spyder.py
+++ b/spyderlib/spyder.py
@@ -1854,7 +1854,7 @@ Please provide any additional information below.
CONF.set('main', 'open_files_port', port)
self.open_files_server.bind(('127.0.0.1', port))
self.open_files_server.listen(20)
- while True:
+ while 1: # 1 is faster than True
try:
req, dummy = self.open_files_server.accept()
except socket.error as e:
|
Single instance mode: Use '1' instead of 'True' to maintain the open_files_server infinite loop
|
spyder-ide_spyder
|
train
|
746bdd54fbf671638932805b215fc825e9b5fb97
|
diff --git a/ci/run_apex_tests.py b/ci/run_apex_tests.py
index <HASH>..<HASH> 100644
--- a/ci/run_apex_tests.py
+++ b/ci/run_apex_tests.py
@@ -294,7 +294,7 @@ def run_tests():
for tf in tf_res['records']:
TraceFlag.delete(tf['Id'])
- expiration = datetime.datetime.now() + datetime.timedelta(1)
+ expiration = datetime.datetime.now() + datetime.timedelta(seconds=60*60*12)
res = TraceFlag.create({
'ApexCode': 'Info',
'ApexProfiling': 'Debug',
|
Set TraceFlag expiration to <I> hours rather than <I> to prevent errors
that expiration is too far in the future due to timezone differences
|
SFDO-Tooling_CumulusCI
|
train
|
267599c50df36f187f79366d90924318a818b09c
|
diff --git a/engine/src/main/java/org/camunda/bpm/engine/impl/test/TestHelper.java b/engine/src/main/java/org/camunda/bpm/engine/impl/test/TestHelper.java
index <HASH>..<HASH> 100644
--- a/engine/src/main/java/org/camunda/bpm/engine/impl/test/TestHelper.java
+++ b/engine/src/main/java/org/camunda/bpm/engine/impl/test/TestHelper.java
@@ -96,7 +96,7 @@ public abstract class TestHelper {
boolean onMethod = true;
try {
- method = testClass.getDeclaredMethod(methodName, (Class<?>[])null);
+ method = getMethod(testClass, methodName);
} catch (Exception e) {
if (deploymentAnnotation == null) {
// we have neither the annotation, nor can look it up from the method
@@ -231,7 +231,7 @@ public abstract class TestHelper {
Method method = null;
try {
- method = testClass.getDeclaredMethod(methodName, (Class<?>[]) null);
+ method = getMethod(testClass, methodName);
} catch (Exception e) {
return null;
@@ -246,6 +246,10 @@ public abstract class TestHelper {
return annotation;
}
+ protected static Method getMethod(Class<?> clazz, String methodName) throws SecurityException, NoSuchMethodException {
+ return clazz.getMethod(methodName, (Class<?>[]) null);
+ }
+
/**
* Ensures that the deployment cache and database is clean after a test. If not the cache
* and database will be cleared.
|
fix(engine): lookup test method correctly
related to CAM-<I>
|
camunda_camunda-bpm-platform
|
train
|
c8adc97f0c898d6ef16082446db5ef34d7db2d32
|
diff --git a/annis-kickstarter/src/main/java/de/hu_berlin/german/korpling/annis/kickstarter/InitDialog.java b/annis-kickstarter/src/main/java/de/hu_berlin/german/korpling/annis/kickstarter/InitDialog.java
index <HASH>..<HASH> 100644
--- a/annis-kickstarter/src/main/java/de/hu_berlin/german/korpling/annis/kickstarter/InitDialog.java
+++ b/annis-kickstarter/src/main/java/de/hu_berlin/german/korpling/annis/kickstarter/InitDialog.java
@@ -16,12 +16,19 @@
package de.hu_berlin.german.korpling.annis.kickstarter;
import annis.administration.CorpusAdministration;
+import com.google.common.base.Charsets;
import java.awt.Frame;
import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileReader;
+import java.io.InputStream;
+import java.io.InputStreamReader;
import java.io.Serializable;
+import java.net.URI;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
+import java.util.Properties;
import java.util.concurrent.ExecutionException;
import javax.swing.JFileChooser;
import javax.swing.JOptionPane;
@@ -57,26 +64,50 @@ public class InitDialog extends javax.swing.JDialog
@Override
protected String doInBackground() throws Exception
{
+ InputStream propStream = null;
try
{
- corpusAdministration.initializeDatabase("localhost", "5432",
- "anniskickstart",
- "anniskickstart", "annisKickstartPassword", "postgres",
- txtAdminUsername.getText(), new String(txtAdminPassword.getPassword()),
- false);
+ // get the values from the installation
+ File propFile = new File(System.getProperty("annis.home") + "/conf",
+ "database.properties");
+ propStream = new FileInputStream(propFile);
+ Properties prop = new Properties();
+ InputStreamReader propReader = new InputStreamReader(propStream, Charsets.UTF_8);
+ prop.load(propReader);
+
+ String rawDataSourceURI = prop.getProperty("datasource.url",
+ "jdbc:postgresql://localhost:5432/anniskickstart").trim();
+
+ URI uri = new URI(rawDataSourceURI.substring("jdbc:".length()));
+
+ corpusAdministration.initializeDatabase(
+ uri.getHost(), "" + uri.getPort(),
+ uri.getPath().substring(1), // remove / at beginning
+ prop.getProperty("datasource.username", "anniskickstart").trim(),
+ prop.getProperty("datasource.password", "annisKickstartPassword").trim(),
+ "postgres",
+ txtAdminUsername.getText(),
+ new String(txtAdminPassword.getPassword()),
+ prop.getProperty("datasource.ssl", "false").trim().equalsIgnoreCase("true"));
return "";
}
catch (Exception ex)
- {
+ {
parent.setVisible(false);
ExceptionDialog dlg = new ExceptionDialog(parent, ex);
dlg.setVisible(true);
}
+ finally
+ {
+ if(propStream != null)
+ {
+ propStream.close();
+ }
+ }
return "ERROR";
}
-
@Override
protected void done()
{
|
use the provided database.properties file in Kickstarter when initializing the database
|
korpling_ANNIS
|
train
|
d5b56fc44c338d14d92b8d0648f91a3660d80de7
|
diff --git a/satpy/writers/__init__.py b/satpy/writers/__init__.py
index <HASH>..<HASH> 100644
--- a/satpy/writers/__init__.py
+++ b/satpy/writers/__init__.py
@@ -174,7 +174,7 @@ def to_image(dataset, copy=True, **kwargs):
if 'bands' in dataset.dims:
return Image([dataset.sel(bands=0).values, dataset.sel(bands=1).values, dataset.sel(bands=2).values], copy=copy, **kwargs)
else:
- return Image([dataset], copy=copy, **kwargs)
+ return Image([np.ma.masked_invalid(dataset.values)], copy=copy, **kwargs)
class Writer(Plugin):
|
Fix to_image for 2d data
|
pytroll_satpy
|
train
|
caa09b6dee63acafe040aabcbfcf6490127410d8
|
diff --git a/plenum/test/freshness/test_replica_freshness.py b/plenum/test/freshness/test_replica_freshness.py
index <HASH>..<HASH> 100644
--- a/plenum/test/freshness/test_replica_freshness.py
+++ b/plenum/test/freshness/test_replica_freshness.py
@@ -55,7 +55,7 @@ def replica_with_valid_requests(primary_replica):
def set_current_time(replica, ts):
replica.get_current_time.value = OLDEST_TS + ts
- replica.get_time_for_3pc_batch.value = OLDEST_TS + ts
+ replica.get_time_for_3pc_batch.value = int(OLDEST_TS + ts)
def check_and_pop_ordered(replica, ledger_ids):
diff --git a/plenum/test/req_handler/test_txn_author_agreement_handler.py b/plenum/test/req_handler/test_txn_author_agreement_handler.py
index <HASH>..<HASH> 100644
--- a/plenum/test/req_handler/test_txn_author_agreement_handler.py
+++ b/plenum/test/req_handler/test_txn_author_agreement_handler.py
@@ -60,8 +60,10 @@ def test_dynamic_validation_update_last_taa_with_retired(txn_author_agreement_ha
txn_author_agreement_handler.update_state(txn, None, taa_request)
taa_request.operation[TXN_AUTHOR_AGREEMENT_RETIREMENT_TS] = retired_time
if retired_time == "without":
- taa_request.operation.pop(TXN_AUTHOR_AGREEMENT_RETIREMENT_TS, None)
- txn_author_agreement_handler.dynamic_validation(taa_request, taa_pp_time)
+ # TODO: INDY-2316 Can we get rid of this?
+ # taa_request.operation.pop(TXN_AUTHOR_AGREEMENT_RETIREMENT_TS, None)
+ # txn_author_agreement_handler.dynamic_validation(taa_request, taa_pp_time)
+ pass
else:
with pytest.raises(InvalidClientRequest,
match="The latest transaction author agreement cannot be retired"):
@@ -76,8 +78,10 @@ def test_dynamic_validation_update_with_retired_taa_off(txn_author_agreement_han
txn_author_agreement_handler.state.remove(StaticTAAHelper.state_path_taa_latest())
taa_request.operation[TXN_AUTHOR_AGREEMENT_RETIREMENT_TS] = retired_time
if retired_time == "without":
- taa_request.operation.pop(TXN_AUTHOR_AGREEMENT_RETIREMENT_TS, None)
- txn_author_agreement_handler.dynamic_validation(taa_request, taa_pp_time)
+ # TODO: INDY-2316 Can we get rid of this?
+ # taa_request.operation.pop(TXN_AUTHOR_AGREEMENT_RETIREMENT_TS, None)
+ # txn_author_agreement_handler.dynamic_validation(taa_request, taa_pp_time)
+ pass
else:
with pytest.raises(InvalidClientRequest,
match="Retirement date cannot be changed when TAA enforcement is disabled."):
@@ -119,7 +123,9 @@ def test_dynamic_validation_update_with_text(txn_author_agreement_handler, domai
match="Changing a text of existing transaction author agreement is forbidden"):
txn_author_agreement_handler.dynamic_validation(taa_request, taa_pp_time)
else:
- txn_author_agreement_handler.dynamic_validation(taa_request, taa_pp_time)
+ # TODO: INDY-2316
+ with pytest.raises(InvalidClientRequest):
+ txn_author_agreement_handler.dynamic_validation(taa_request, taa_pp_time)
def test_dynamic_validation_from_steward(txn_author_agreement_handler, domain_state,
@@ -135,7 +141,8 @@ def test_dynamic_validation_from_steward(txn_author_agreement_handler, domain_st
def test_dynamic_validation_with_not_unique_version(txn_author_agreement_handler, taa_request, taa_pp_time, set_aml):
txn = reqToTxn(taa_request)
txn_author_agreement_handler.update_state(txn, None, taa_request)
- txn_author_agreement_handler.dynamic_validation(taa_request, taa_pp_time)
+ # TODO: INDY-2316 Can we get rid of this?
+ # txn_author_agreement_handler.dynamic_validation(taa_request, taa_pp_time)
taa_request.operation[TXN_AUTHOR_AGREEMENT_TEXT] = ""
with pytest.raises(InvalidClientRequest,
match="Changing a text of existing transaction author agreement is forbidden"):
|
INDY-<I>: Fix some tests
|
hyperledger_indy-plenum
|
train
|
252fcec740704f78554fcf69e0146f8159df81b1
|
diff --git a/lib/navigation/systems.rb b/lib/navigation/systems.rb
index <HASH>..<HASH> 100644
--- a/lib/navigation/systems.rb
+++ b/lib/navigation/systems.rb
@@ -149,18 +149,12 @@ module Navigation
:if => lambda{@group},
:options => {:class=>"navigation_element"}
},
-# { :key => :content,
-# :name =>_("Content"),
-# :url => lambda{system_group_errata_path(@group.id)},
-# :if => lambda{@group},
-# :options => {:class=>"navigation_element"},
-# :items => system_groups_content_subnav
-# },
- { :key => :errata,
- :name =>_("Errata"),
- :url => lambda{system_group_errata_path(@group.id)},
+ { :key => :content,
+ :name =>_("Content"),
+ :url => lambda{system_group_packages_path(@group.id)},
:if => lambda{@group},
- :options => {:class=>"navigation_element"},
+ :options => {:class=>"navigation_element menu_parent"},
+ :items => system_groups_content_subnav
},
{ :key => :details,
:name =>_("Details"),
@@ -173,12 +167,12 @@ module Navigation
def system_groups_content_subnav
[
-# { :key => :packages,
-# :name =>_("Packages"),
-# :url => lambda{packages_system_system_packages_path(@system.id)},
-# :if => lambda{@system},
-# :options => {:class=>"third_level navigation_element"}
-# },
+ { :key => :packages,
+ :name =>_("Packages"),
+ :url => lambda{system_group_packages_path(@group.id)},
+ :if => lambda{@group},
+ :options => {:class=>"third_level navigation_element"},
+ },
{ :key => :errata,
:name =>_("Errata"),
:url => lambda{system_group_errata_path(@group.id)},
diff --git a/public/javascripts/system_groups.js b/public/javascripts/system_groups.js
index <HASH>..<HASH> 100644
--- a/public/javascripts/system_groups.js
+++ b/public/javascripts/system_groups.js
@@ -16,6 +16,11 @@ KT.panel.list.registerPage('system_groups', { create : 'new_system_group' });
$(document).ready(function() {
KT.panel.set_expand_cb(function(){
+ var children = $('#panel .menu_parent');
+ $.each(children, function(i, item) {
+ KT.menu.hoverMenu(item, { top : '75px' });
+ });
+
KT.system_groups.new_setup();
KT.system_groups.details_setup();
KT.system_groups.systems_setup();
|
system groups - update to have Content as 3rd level nav
This makes Content as a 3rd level nav consisting of Packages and Errata,
consistent with the Systems page.
|
Katello_katello
|
train
|
accc82fd111e75685b0631f0aa411490032608ca
|
diff --git a/test/api/interop_extra_test.js b/test/api/interop_extra_test.js
index <HASH>..<HASH> 100644
--- a/test/api/interop_extra_test.js
+++ b/test/api/interop_extra_test.js
@@ -197,6 +197,8 @@ describe(`${anyGrpc.clientName} client -> ${anyGrpc.serverName} server`, functio
});
});
describe('max message size', function() {
+ // with the default timeout the test times out under aarch64 emulator
+ this.timeout(6000);
// A size that is larger than the default limit
const largeMessageSize = 8 * 1024 * 1024;
const largeMessage = Buffer.alloc(largeMessageSize);
@@ -238,6 +240,8 @@ describe(`${anyGrpc.clientName} client -> ${anyGrpc.serverName} server`, functio
});
});
describe('with a client with no message size limits', function() {
+ // with the default timeout the test times out under aarch64 emulator
+ this.timeout(6000);
let unrestrictedClient;
before(function() {
const ca_path = path.join(__dirname, '../data/ca.pem');
@@ -283,6 +287,8 @@ describe(`${anyGrpc.clientName} client -> ${anyGrpc.serverName} server`, functio
});
});
describe('with a server with message size limits and a client without limits', function() {
+ // with the default timeout the test times out under aarch64 emulator
+ this.timeout(6000);
let restrictedServer;
let restrictedServerClient;
let restrictedServerClient2;
diff --git a/test/api/interop_sanity_test.js b/test/api/interop_sanity_test.js
index <HASH>..<HASH> 100644
--- a/test/api/interop_sanity_test.js
+++ b/test/api/interop_sanity_test.js
@@ -48,7 +48,8 @@ var childExecArgv = [];
describe(`${anyGrpc.clientName} client -> ${anyGrpc.serverName} server`, function() {
describe('Interop tests', function() {
- this.timeout(4000);
+ // with the default timeout the test times out under aarch64 emulator
+ this.timeout(10000);
before(function(done) {
for (let arg of process.argv) {
if (arg.startsWith('--require=')) {
|
increase timeout for tests that timeout under emulator
|
grpc_grpc-node
|
train
|
a82763b4fdb6a158c46d473af46fbb680c518355
|
diff --git a/src/collectors/monit/monit.py b/src/collectors/monit/monit.py
index <HASH>..<HASH> 100644
--- a/src/collectors/monit/monit.py
+++ b/src/collectors/monit/monit.py
@@ -53,7 +53,7 @@ class MonitCollector(diamond.collector.Collector):
mem = int(service.getElementsByTagName('memory')[0].getElementsByTagName('kilobyte')[0].firstChild.data)
metrics["%s.cpu.percent" % name] = cpu
- metrics["%s.memory.%s_usage" % (name, self.config['byte_unit'])] = diamond.convertor.binary.convert(value = mem, oldUnit = 'byte', newUnit = self.config['byte_unit'])
+ metrics["%s.memory.%s_usage" % (name, self.config['byte_unit'])] = diamond.convertor.binary.convert(value = mem, oldUnit = 'kilobyte', newUnit = self.config['byte_unit'])
for key in metrics:
self.publish(key, metrics[key])
|
monit is in kilobyte not byte
|
python-diamond_Diamond
|
train
|
a46c55ee8eb44a4c6f3dbbb4023b495cb9181bbd
|
diff --git a/build-coordinator/src/main/java/org/jboss/pnc/coordinator/builder/DefaultBuildCoordinator.java b/build-coordinator/src/main/java/org/jboss/pnc/coordinator/builder/DefaultBuildCoordinator.java
index <HASH>..<HASH> 100644
--- a/build-coordinator/src/main/java/org/jboss/pnc/coordinator/builder/DefaultBuildCoordinator.java
+++ b/build-coordinator/src/main/java/org/jboss/pnc/coordinator/builder/DefaultBuildCoordinator.java
@@ -141,12 +141,8 @@ public class DefaultBuildCoordinator implements BuildCoordinator {
buildQueue.getUnfinishedTasks());
buildQueue.enqueueTaskSet(buildSetTask);
- List<BuildTask> readyTasks = buildSetTask.getBuildTasks().stream().filter(BuildTask::readyToBuild).collect(Collectors.toList());
- List<BuildTask> waitingTasks = new ArrayList<>(buildSetTask.getBuildTasks());
- waitingTasks.removeAll(readyTasks);
- waitingTasks.forEach(this::addTaskToBuildQueue);
- readyTasks.forEach(this::addTaskToBuildQueue);
+ buildSetTask.getBuildTasks().forEach(this::addTaskToBuildQueue);
return buildSetTask;
|
Simplify adding tasks to queue when building
|
project-ncl_pnc
|
train
|
fd9acc81a549e352243fbdf55eee270f98b07dfa
|
diff --git a/checkers/python3.py b/checkers/python3.py
index <HASH>..<HASH> 100644
--- a/checkers/python3.py
+++ b/checkers/python3.py
@@ -23,7 +23,7 @@ from pylint.utils import WarningScope
from pylint.checkers import utils
-_OLD_OCTAL = re.compile("\d{2}")
+_OLD_OCTAL = re.compile("0\d{1}")
def _is_old_octal(literal):
return _OLD_OCTAL.match(literal)
diff --git a/test/unittest_checker_python3.py b/test/unittest_checker_python3.py
index <HASH>..<HASH> 100644
--- a/test/unittest_checker_python3.py
+++ b/test/unittest_checker_python3.py
@@ -285,6 +285,11 @@ class Python3TokenCheckerTest(testutils.CheckerTestCase):
def test_old_octal_literal(self):
self._test_token_message("045", "old-octal-literal")
+ # Make sure we are catching only octals.
+ tokens = testutils.tokenize_str("45")
+ with self.assertNoMessages():
+ self.checker.process_tokens(tokens)
+
if __name__ == '__main__':
unittest.main()
|
Fix the flawed check of old octal syntax.
|
PyCQA_pylint
|
train
|
8c58df910df839cab4705e6e85c9db83edf9feaa
|
diff --git a/lib/magento/country.rb b/lib/magento/country.rb
index <HASH>..<HASH> 100644
--- a/lib/magento/country.rb
+++ b/lib/magento/country.rb
@@ -16,6 +16,18 @@ module Magento
def all
list
end
+
+ def find_by_id(id)
+ list.select{ |c| c.id == id }.first
+ end
+
+ def find_by_iso(iso)
+ list.select{ |c| [c.iso2, c.iso3].include? iso }.first
+ end
+ end
+
+ def regions
+ Magento::Region.find_by_country(self.iso2)
end
end
end
\ No newline at end of file
diff --git a/lib/magento/customer.rb b/lib/magento/customer.rb
index <HASH>..<HASH> 100644
--- a/lib/magento/customer.rb
+++ b/lib/magento/customer.rb
@@ -102,7 +102,10 @@ module Magento
def all
list
end
-
+ end
+
+ def addresses
+ Magento::CustomerAddress.list(self.id)
end
def delete
diff --git a/lib/magento/customer_address.rb b/lib/magento/customer_address.rb
index <HASH>..<HASH> 100644
--- a/lib/magento/customer_address.rb
+++ b/lib/magento/customer_address.rb
@@ -83,6 +83,14 @@ module Magento
end
end
+
+ def country
+ Magento::Country.find_by_id(self.country)
+ end
+
+ def region
+ Magento::Region.find_by_country_and_id(self.country.iso2, self.region)
+ end
def delete
self.class.delete(self.id)
diff --git a/lib/magento/region.rb b/lib/magento/region.rb
index <HASH>..<HASH> 100644
--- a/lib/magento/region.rb
+++ b/lib/magento/region.rb
@@ -20,6 +20,14 @@ module Magento
def find_by_country(iso)
list(iso)
end
+
+ def find_by_country_and_id(iso, id)
+ list(iso).select{ |r| r.id == id }.first
+ end
+
+ def find_by_country_iso_and_iso(country_iso, iso)
+ list(iso).select{ |r| [r.iso2, r.iso3].include? iso }.first
+ end
end
end
end
|
added some helper methods to address and related
|
pstuteville_magentor
|
train
|
de21d162c29258a32a5bc258ed6432f61ffec5c5
|
diff --git a/tests/test_lib.py b/tests/test_lib.py
index <HASH>..<HASH> 100755
--- a/tests/test_lib.py
+++ b/tests/test_lib.py
@@ -97,3 +97,15 @@ class TestHashClassFail(object):
obj = ssdeep.Hash()
with pytest.raises(TypeError):
obj.update(1234)
+
+
+class TestPseudoHashClassFail(object):
+ def test_update_01(self):
+ obj = ssdeep.PseudoHash()
+ with pytest.raises(TypeError):
+ obj.update(None)
+
+ def test_update_02(self):
+ obj = ssdeep.PseudoHash()
+ with pytest.raises(TypeError):
+ obj.update(1234)
|
test - Additional tests for PseudoHash() class
|
DinoTools_python-ssdeep
|
train
|
55cb92a0c12e5c64d306d2ecbfd736d03ba34c96
|
diff --git a/modules/activiti-engine/src/main/java/org/activiti/engine/impl/persistence/entity/TaskEntityManager.java b/modules/activiti-engine/src/main/java/org/activiti/engine/impl/persistence/entity/TaskEntityManager.java
index <HASH>..<HASH> 100644
--- a/modules/activiti-engine/src/main/java/org/activiti/engine/impl/persistence/entity/TaskEntityManager.java
+++ b/modules/activiti-engine/src/main/java/org/activiti/engine/impl/persistence/entity/TaskEntityManager.java
@@ -52,7 +52,7 @@ public class TaskEntityManager extends AbstractManager {
if (commandContext.getProcessEngineConfiguration().getEventDispatcher().isEnabled()) {
commandContext.getProcessEngineConfiguration().getEventDispatcher().dispatchEvent(
ActivitiEventBuilder.createActivityCancelledEvent(
- task.getId(),
+ task.getExecution().getActivityId(),
task.getName(),
task.getExecutionId(),
task.getProcessInstanceId(),
diff --git a/modules/activiti-engine/src/test/java/org/activiti/engine/test/api/event/ProcessInstanceEventsTest.java b/modules/activiti-engine/src/test/java/org/activiti/engine/test/api/event/ProcessInstanceEventsTest.java
index <HASH>..<HASH> 100755
--- a/modules/activiti-engine/src/test/java/org/activiti/engine/test/api/event/ProcessInstanceEventsTest.java
+++ b/modules/activiti-engine/src/test/java/org/activiti/engine/test/api/event/ProcessInstanceEventsTest.java
@@ -247,6 +247,7 @@ public class ProcessInstanceEventsTest extends PluggableActivitiTestCase {
assertEquals("ActivitiEventType.ACTIVITY_CANCELLED was expected 1 time.", 1, taskCancelledEvents.size());
ActivitiActivityCancelledEvent activityCancelledEvent = (ActivitiActivityCancelledEvent) taskCancelledEvents.get(0);
assertTrue("The cause has to be the same as deleteProcessInstance method call", ActivitiActivityCancelledEvent.class.isAssignableFrom(activityCancelledEvent.getClass()));
+ assertEquals("The activity id has to be the same as processInstance activity", processInstance.getActivityId(), activityCancelledEvent.getActivityId());
assertEquals("The process instance has to be the same as in deleteProcessInstance method call", processInstance.getId(), activityCancelledEvent.getProcessInstanceId());
assertEquals("The execution instance has to be the same as in deleteProcessInstance method call", processInstance.getId(), activityCancelledEvent.getExecutionId());
assertEquals("The cause has to be the same as in deleteProcessInstance method call", "delete_test", activityCancelledEvent.getCause());
|
Activity cancelled event for process delete API call
|
Activiti_Activiti
|
train
|
cdb5c190105470ed32b8180e1522e46999670343
|
diff --git a/src/wormhole/server/rendezvous_websocket.py b/src/wormhole/server/rendezvous_websocket.py
index <HASH>..<HASH> 100644
--- a/src/wormhole/server/rendezvous_websocket.py
+++ b/src/wormhole/server/rendezvous_websocket.py
@@ -247,5 +247,6 @@ class WebSocketRendezvousFactory(websocket.WebSocketServerFactory):
protocol = WebSocketRendezvous
def __init__(self, url, rendezvous):
websocket.WebSocketServerFactory.__init__(self, url)
+ self.setProtocolOptions(autoPingInterval=60, autoPingTimeout=600)
self.rendezvous = rendezvous
self.reactor = reactor # for tests to control
diff --git a/src/wormhole/wormhole.py b/src/wormhole/wormhole.py
index <HASH>..<HASH> 100644
--- a/src/wormhole/wormhole.py
+++ b/src/wormhole/wormhole.py
@@ -354,6 +354,7 @@ class _Wormhole:
self._ws_t = self._timing.add("open websocket")
p = urlparse(self._ws_url)
f = WSFactory(self._ws_url)
+ f.setProtocolOptions(autoPingInterval=60, autoPingTimeout=600)
f.wormhole = self
f.d = defer.Deferred()
# TODO: if hostname="localhost", I get three factories starting
|
websockets: turn on autoPingInterval to expire stale connections
With this, both clients and servers will send a PING at least once every
minute, and will drop connections that haven't seen any traffic for <I>
minutes.
This should help keep NAT table entries alive, and will drop connections
that are no longer viable because their NAT entries have expired.
closes #<I>
|
warner_magic-wormhole
|
train
|
684eaa22618cdf7d0e9e47d5ff8d741dfab0e4ec
|
diff --git a/lib/structures/Guild.js b/lib/structures/Guild.js
index <HASH>..<HASH> 100644
--- a/lib/structures/Guild.js
+++ b/lib/structures/Guild.js
@@ -236,13 +236,19 @@ class Guild extends Base {
/**
* Create a channel in the guild
* @arg {String} name The name of the channel
- * @arg {String} [type=0] The type of the channel, either 0 or 2
+ * @arg {String} [type=0] The type of the channel, either 0 (text), 2 (voice), or 4 (category)
* @arg {String} [reason] The reason to be displayed in audit logs
- * @arg {String} [parentID] ID of the parent category for a channel
+ * @arg {Object} [options] The properties the channel should have
+ * @arg {String} [options.topic] The topic of the channel (text channels only)
+ * @arg {Boolean} [options.nsfw] The nsfw status of the channel
+ * @arg {Number} [options.bitrate] The bitrate of the channel (voice channels only)
+ * @arg {Number} [options.userLimit] The channel user limit (voice channels only)
+ * @arg {Number} [options.rateLimitPerUser] The time in seconds a user has to wait before sending another message (does not affect bots or users with manageMessages/manageChannel permissions) (text channels only)
+ * @arg {String?} [options.parentID] The ID of the parent channel category for this channel
* @returns {Promise<CategoryChannel | TextChannel | VoiceChannel>}
*/
- createChannel(name, type, reason, parentID) {
- return this.shard.client.createChannel.call(this.shard.client, this.id, name, type, reason, parentID);
+ createChannel(name, type, reason, options) {
+ return this.shard.client.createChannel.call(this.shard.client, this.id, name, type, reason, options);
}
/**
|
Fix Guild#createChannel documentation, naming (#<I>)
|
abalabahaha_eris
|
train
|
835e4e6b2df82894da2ff96f29e5fb30789a8158
|
diff --git a/src/Language/AST/Node.php b/src/Language/AST/Node.php
index <HASH>..<HASH> 100644
--- a/src/Language/AST/Node.php
+++ b/src/Language/AST/Node.php
@@ -82,11 +82,6 @@ abstract class Node
public function __toString()
{
$tmp = $this->toArray();
- $tmp['loc'] = [
- 'start' => $this->loc->start,
- 'end' => $this->loc->end
- ];
-
return json_encode($tmp);
}
|
Removed unnecessary loc entry in AST\Node::toArray()
|
webonyx_graphql-php
|
train
|
cbafa76bd3d56e5788a18bb6b8e61072b4fb6f81
|
diff --git a/src/main/java/backtype/storm/contrib/jms/spout/JmsSpout.java b/src/main/java/backtype/storm/contrib/jms/spout/JmsSpout.java
index <HASH>..<HASH> 100644
--- a/src/main/java/backtype/storm/contrib/jms/spout/JmsSpout.java
+++ b/src/main/java/backtype/storm/contrib/jms/spout/JmsSpout.java
@@ -1,5 +1,6 @@
package backtype.storm.contrib.jms.spout;
+import java.io.Serializable;
import java.util.Map;
import java.util.Timer;
import java.util.concurrent.ConcurrentHashMap;
@@ -66,7 +67,7 @@ public class JmsSpout implements IRichSpout, MessageListener {
private transient Session session;
private boolean hasFailures = false;
- public Object recoveryMutex = new Object();
+ public Serializable recoveryMutex = "RECOVERY_MUTEX";
private Timer recoveryTimer = null;
private long recoveryPeriod = 30*1000; // Default to 30 seconds
diff --git a/src/test/java/backtype/storm/contrib/jms/spout/JmsSpoutTest.java b/src/test/java/backtype/storm/contrib/jms/spout/JmsSpoutTest.java
index <HASH>..<HASH> 100644
--- a/src/test/java/backtype/storm/contrib/jms/spout/JmsSpoutTest.java
+++ b/src/test/java/backtype/storm/contrib/jms/spout/JmsSpoutTest.java
@@ -1,5 +1,8 @@
package backtype.storm.contrib.jms.spout;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.ObjectOutputStream;
import java.util.HashMap;
import javax.jms.ConnectionFactory;
@@ -42,6 +45,16 @@ public class JmsSpoutTest {
Assert.assertTrue(mockCollector.emitted); // Should have been re-emitted
}
+ @Test
+ public void testSerializability() throws IOException{
+ JmsSpout spout = new JmsSpout();
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ ObjectOutputStream oos = new ObjectOutputStream(out);
+ oos.writeObject(spout);
+ oos.close();
+ Assert.assertTrue(out.toByteArray().length > 0);
+ }
+
public Message sendMessage(ConnectionFactory connectionFactory, Destination destination) throws JMSException {
Session mySess = connectionFactory.createConnection().createSession(false, Session.CLIENT_ACKNOWLEDGE);
MessageProducer producer = mySess.createProducer(destination);
|
Fix for serializability of mutex.
|
ptgoetz_storm-jms
|
train
|
9c69026a0c382aedda547d56c3e6765e367d2950
|
diff --git a/pex/pex_bootstrapper.py b/pex/pex_bootstrapper.py
index <HASH>..<HASH> 100644
--- a/pex/pex_bootstrapper.py
+++ b/pex/pex_bootstrapper.py
@@ -41,6 +41,7 @@ def iter_compatible_interpreters(
path=None, # type: Optional[str]
valid_basenames=None, # type: Optional[Iterable[str]]
interpreter_constraints=None, # type: Optional[Iterable[str]]
+ preferred_interpreter=None, # type: Optional[PythonInterpreter]
):
# type: (...) -> Iterator[PythonInterpreter]
"""Find all compatible interpreters on the system within the supplied constraints.
@@ -51,6 +52,8 @@ def iter_compatible_interpreters(
pypy, etc.).
:param interpreter_constraints: Interpreter type and version constraint strings as described in
`--interpreter-constraint`.
+ :param preferred_interpreter: For testing - an interpreter to prefer amongst all others.
+ Defaults to the current running interpreter.
Interpreters are searched for in `path` if specified and $PATH if not.
@@ -77,7 +80,7 @@ def iter_compatible_interpreters(
)
# Prefer the current interpreter, if valid.
- current_interpreter = PythonInterpreter.get()
+ current_interpreter = preferred_interpreter or PythonInterpreter.get()
if not _valid_path or _valid_path(current_interpreter.binary):
if normalized_paths:
candidate_paths = frozenset(
@@ -85,8 +88,10 @@ def iter_compatible_interpreters(
)
candidate_paths_in_path = candidate_paths.intersection(normalized_paths)
if candidate_paths_in_path:
- for p in candidate_paths_in_path:
- normalized_paths.remove(p)
+ # In case the full path of the current interpreter binary was in the
+ # `normalized_paths` we're searching, remove it to prevent identifying it again
+ # just to then skip it as `seen`.
+ normalized_paths.discard(current_interpreter.binary)
seen.add(current_interpreter)
yield current_interpreter
else:
diff --git a/tests/test_pex_bootstrapper.py b/tests/test_pex_bootstrapper.py
index <HASH>..<HASH> 100644
--- a/tests/test_pex_bootstrapper.py
+++ b/tests/test_pex_bootstrapper.py
@@ -2,11 +2,13 @@
# Licensed under the Apache License, Version 2.0 (see LICENSE).
import os
+import shutil
import sys
from textwrap import dedent
import pytest
+from pex.common import temporary_dir
from pex.interpreter import PythonInterpreter
from pex.interpreter_constraints import UnsatisfiableInterpreterConstraintsError
from pex.pex_bootstrapper import iter_compatible_interpreters
@@ -22,14 +24,20 @@ def basenames(*paths):
return [os.path.basename(p) for p in paths]
-def find_interpreters(path, valid_basenames=None, constraints=None):
- # type: (Iterable[str], Optional[Iterable[str]], Optional[Iterable[str]]) -> List[AnyStr]
+def find_interpreters(
+ path, # type: Iterable[str]
+ valid_basenames=None, # type: Optional[Iterable[str]]
+ constraints=None, # type: Optional[Iterable[str]]
+ preferred_interpreter=None, # type: Optional[PythonInterpreter]
+):
+ # type: (...) -> List[AnyStr]
return [
interp.binary
for interp in iter_compatible_interpreters(
path=os.pathsep.join(path),
valid_basenames=valid_basenames,
interpreter_constraints=constraints,
+ preferred_interpreter=preferred_interpreter,
)
]
@@ -157,3 +165,19 @@ def test_find_compatible_interpreters_bias_current():
py36 = ensure_python_interpreter(PY36)
assert [os.path.realpath(sys.executable), py36] == find_interpreters([py36, sys.executable])
assert [os.path.realpath(sys.executable), py36] == find_interpreters([sys.executable, py36])
+
+
+def test_find_compatible_interpreters_siblings_of_current_issues_1109():
+ py27 = ensure_python_interpreter(PY27)
+ py36 = ensure_python_interpreter(PY36)
+
+ with temporary_dir() as path_entry:
+ python27 = os.path.join(path_entry, "python2.7")
+ shutil.copy(py27, python27)
+
+ python36 = os.path.join(path_entry, "python3.6")
+ shutil.copy(py36, python36)
+
+ assert [os.path.realpath(p) for p in (python36, python27)] == find_interpreters(
+ path=[path_entry], preferred_interpreter=PythonInterpreter.from_binary(python36)
+ )
|
Fix `iter_compatible_interpreters` with `path`. (#<I>)
Previously, if the current interpreter was valid and contained in a
path directory entry, all sibling interpreters in that same directory
went undiscovered. A test is added that fails without the fix.
Fixes #<I>
|
pantsbuild_pex
|
train
|
08204e13e0808ee51abd77ce7910d2d268719df8
|
diff --git a/phono3py/phonon3/fc3.py b/phono3py/phonon3/fc3.py
index <HASH>..<HASH> 100644
--- a/phono3py/phonon3/fc3.py
+++ b/phono3py/phonon3/fc3.py
@@ -512,7 +512,7 @@ def show_drift_fc3(fc3,
"Corresponding python code is not implemented.")
raise RuntimeError(text)
- text = "max drift of %s: " % name
+ text = "Max drift of %s: " % name
text += "%f (%s%s%s) " % (maxval1,
"xyz"[klm1[0]], "xyz"[klm1[1]], "xyz"[klm1[2]])
text += "%f (%s%s%s) " % (maxval2,
|
Slightly modify the output text for max drift fc
|
atztogo_phono3py
|
train
|
fd7e74f7fc31d201b3cc7cb7fa034676fddcf0b2
|
diff --git a/lib/gir_ffi/in_out_pointer.rb b/lib/gir_ffi/in_out_pointer.rb
index <HASH>..<HASH> 100644
--- a/lib/gir_ffi/in_out_pointer.rb
+++ b/lib/gir_ffi/in_out_pointer.rb
@@ -29,7 +29,7 @@ module GirFFI
def self.for type
ffi_type = type_to_ffi_type type
ptr = AllocationHelper.safe_malloc(FFI.type_size ffi_type)
- ptr.send "put_#{ffi_type}", 0, 0
+ ptr.send "put_#{ffi_type}", 0, nil_value_for(type)
self.new ptr, type, ffi_type
end
@@ -70,6 +70,15 @@ module GirFFI
value
end
end
+
+ def nil_value_for type
+ case type
+ when :utf8, :pointer
+ nil
+ else
+ 0
+ end
+ end
end
end
end
|
JRuby doesn't like 0 as a pointer value. Pass nil instead.
|
mvz_gir_ffi
|
train
|
38c732b7ea2d7f356c4fd95ea9e36813d5a70774
|
diff --git a/lib/resourcery/controller_extensions.rb b/lib/resourcery/controller_extensions.rb
index <HASH>..<HASH> 100644
--- a/lib/resourcery/controller_extensions.rb
+++ b/lib/resourcery/controller_extensions.rb
@@ -31,7 +31,7 @@ module Resourcery
def destroy
resource.destroy
- respond_with resource
+ redirect_to resource_class
end
protected
diff --git a/spec/controller_extensions_spec.rb b/spec/controller_extensions_spec.rb
index <HASH>..<HASH> 100644
--- a/spec/controller_extensions_spec.rb
+++ b/spec/controller_extensions_spec.rb
@@ -134,5 +134,21 @@ describe 'controller extensions', type: :controller do
end
end
+ describe 'DELETE destroy' do
+ before do
+ User.should_receive(:find).with("123").and_return(resource)
+ resource.should_receive(:destroy)
+
+ delete :destroy, id: 123
+ end
+
+ it "should set resource ivar" do
+ expect(assigns(:user)).to eq(resource)
+ end
+
+ it "should redirect to the collection url" do
+ expect(response).to redirect_to users_path
+ end
+ end
end
end
|
Spec and implement the #destroy action
|
hmans_resourcery
|
train
|
66fb7b3388d17ef791925732ce03c4f67a6ea34b
|
diff --git a/app/controllers/rocket_job_mission_control/application_controller.rb b/app/controllers/rocket_job_mission_control/application_controller.rb
index <HASH>..<HASH> 100644
--- a/app/controllers/rocket_job_mission_control/application_controller.rb
+++ b/app/controllers/rocket_job_mission_control/application_controller.rb
@@ -20,7 +20,7 @@ module RocketJobMissionControl
else
{roles: %i[admin]}
end
- AccessPolicy.new(Authorization.new(**@args))
+ RocketJobMissionControl::AccessPolicy.new(Authorization.new(**@args))
end
end
|
Use fully qualified class name: RocketJobMissionControl::AccessPolicy
|
rocketjob_rocketjob_mission_control
|
train
|
fc40a19c808b4d4a09191bca2ebe712866a7de0d
|
diff --git a/engine/core/src/main/java/org/datacleaner/metamodel/datahub/DataHubDataSet.java b/engine/core/src/main/java/org/datacleaner/metamodel/datahub/DataHubDataSet.java
index <HASH>..<HASH> 100644
--- a/engine/core/src/main/java/org/datacleaner/metamodel/datahub/DataHubDataSet.java
+++ b/engine/core/src/main/java/org/datacleaner/metamodel/datahub/DataHubDataSet.java
@@ -68,6 +68,8 @@ public class DataHubDataSet extends AbstractDataSet {
private Iterator<Object[]> _resultSetIterator;
private Row _row;
+ private boolean _endReached;
+
/**
* Constructor
*
@@ -84,6 +86,7 @@ public class DataHubDataSet extends AbstractDataSet {
_paging = query.getMaxRows() == null;
_nextPageFirstRow = 1;
_nextPageMaxRows = PAGE_SIZE;
+ _endReached = false;
_resultSetIterator = getNextPage();
}
@@ -101,7 +104,7 @@ public class DataHubDataSet extends AbstractDataSet {
@Override
public boolean next() {
if (!_resultSetIterator.hasNext()) {
- if (_paging) {
+ if (_paging && !_endReached) {
_resultSetIterator = getNextPage();
if (!_resultSetIterator.hasNext()) {
_row = null;
@@ -122,20 +125,22 @@ public class DataHubDataSet extends AbstractDataSet {
_nextPageFirstRow = _nextPageFirstRow + _nextPageMaxRows;
- String uri = _uri + createParams(firstRow, maxRows);
+ final String uri = _uri + createParams(firstRow, maxRows);
- HttpGet request = new HttpGet(uri);
+ final HttpGet request = new HttpGet(uri);
request.addHeader(ACCEPT, JSON_CONTENT_TYPE);
- HttpResponse response = executeRequest(request);
-
- return getResultSet(response.getEntity());
+ final HttpResponse response = executeRequest(request);
+ final List<Object[]> resultSet = getResultSet(response.getEntity());
+ final int resultSetSize = resultSet.size();
+ _endReached = (resultSetSize < maxRows);
+ return resultSet.iterator();
}
- private Iterator<Object[]> getResultSet(HttpEntity entity) {
+ private List<Object[]> getResultSet(HttpEntity entity) {
JsonQueryDatasetResponseParser parser = new JsonQueryDatasetResponseParser();
try {
List<Object[]> resultSet = parser.parseQueryResult(entity.getContent());
- return resultSet.iterator();
+ return resultSet;
} catch (Exception e) {
throw new IllegalStateException(e);
}
|
Stop when returned rows is less than requested rows
|
datacleaner_DataCleaner
|
train
|
dbd0528fe72c175a8c6b6872c6a0f97c16c4dd64
|
diff --git a/src/transforms/ViewLayout.js b/src/transforms/ViewLayout.js
index <HASH>..<HASH> 100644
--- a/src/transforms/ViewLayout.js
+++ b/src/transforms/ViewLayout.js
@@ -85,7 +85,9 @@ function layoutAxis(axis, width, height) {
ticksIndex = datum.grid ? 1 : 0,
labelIndex = ticksIndex + 1,
titleIndex = labelIndex + (datum.domain ? 2 : 1),
+ range = item.range,
offset = item.offset,
+ position = item.position,
minExtent = item.minExtent,
maxExtent = item.maxExtent,
title = datum.title && item.items[titleIndex].items[0],
@@ -101,39 +103,43 @@ function layoutAxis(axis, width, height) {
// position axis group and title
switch (orient) {
case 'top': {
+ x = position || 0;
y = -offset;
s = Math.max(minExtent, Math.min(maxExtent, -bounds.y1));
if (title) title.auto
? (title.y = -(titlePadding + s), s += titleSize)
: bounds.union(title.bounds);
- bounds.add(0, -s).add(width, 0);
+ bounds.add(0, -s).add(range, 0);
break;
}
case 'left': {
x = -offset;
+ y = position || 0;
s = Math.max(minExtent, Math.min(maxExtent, -bounds.x1));
if (title) title.auto
? (title.x = -(titlePadding + s), s += titleSize)
: bounds.union(title.bounds);
- bounds.add(-s, 0).add(0, height);
+ bounds.add(-s, 0).add(0, range);
break;
}
case 'right': {
x = width + offset;
+ y = position || 0;
s = Math.max(minExtent, Math.min(maxExtent, bounds.x2));
if (title) title.auto
? (title.x = titlePadding + s, s += titleSize)
: bounds.union(title.bounds);
- bounds.add(0, 0).add(s, height);
+ bounds.add(0, 0).add(s, range);
break;
}
case 'bottom': {
+ x = position || 0;
y = height + offset;
s = Math.max(minExtent, Math.min(maxExtent, bounds.y2));
if (title) title.auto
? (title.y = titlePadding + s, s += titleSize)
: bounds.union(title.bounds);
- bounds.add(0, 0).add(width, s);
+ bounds.add(0, 0).add(range, s);
break;
}
}
|
Update axis layout to be more precise.
|
vega_vega-view
|
train
|
d5b8210e4380c80a3c8e58c4d84fc1ce3ce34b3a
|
diff --git a/src/main/java/com/j256/ormlite/jdbc/JdbcDatabaseConnection.java b/src/main/java/com/j256/ormlite/jdbc/JdbcDatabaseConnection.java
index <HASH>..<HASH> 100644
--- a/src/main/java/com/j256/ormlite/jdbc/JdbcDatabaseConnection.java
+++ b/src/main/java/com/j256/ormlite/jdbc/JdbcDatabaseConnection.java
@@ -141,11 +141,6 @@ public class JdbcDatabaseConnection implements DatabaseConnection {
}
public <T> Object queryForOne(String statement, Object[] args, FieldType[] argFieldTypes,
- GenericRowMapper<T> rowMapper) throws SQLException {
- return queryForOne(statement, args, argFieldTypes, rowMapper, null);
- }
-
- public <T> Object queryForOne(String statement, Object[] args, FieldType[] argFieldTypes,
GenericRowMapper<T> rowMapper, ObjectCache objectCache) throws SQLException {
PreparedStatement stmt =
connection.prepareStatement(statement, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
|
Removed a deprecated internal method.
|
j256_ormlite-jdbc
|
train
|
071b5f8321d5e813ad6e98f970b6e491898c591a
|
diff --git a/CHANGES.txt b/CHANGES.txt
index <HASH>..<HASH> 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,6 @@
2.1.1
+ * Fix some Thrift slice deletions and updates of COMPACT STORAGE
+ tables with some clustering columns omitted (CASSANDRA-7990)
* Fix filtering for CONTAINS on sets (CASSANDRA-8033)
* Properly track added size (CASSANDRA-7239)
* Allow compilation in java 8 (CASSANDRA-7208)
diff --git a/src/java/org/apache/cassandra/db/composites/AbstractCellNameType.java b/src/java/org/apache/cassandra/db/composites/AbstractCellNameType.java
index <HASH>..<HASH> 100644
--- a/src/java/org/apache/cassandra/db/composites/AbstractCellNameType.java
+++ b/src/java/org/apache/cassandra/db/composites/AbstractCellNameType.java
@@ -184,6 +184,7 @@ public abstract class AbstractCellNameType extends AbstractCType implements Cell
public CellName cellFromByteBuffer(ByteBuffer bytes)
{
+ // we're not guaranteed to get a CellName back from fromByteBuffer(), so it's on the caller to guarantee this
return (CellName)fromByteBuffer(bytes);
}
diff --git a/src/java/org/apache/cassandra/db/composites/CompoundDenseCellNameType.java b/src/java/org/apache/cassandra/db/composites/CompoundDenseCellNameType.java
index <HASH>..<HASH> 100644
--- a/src/java/org/apache/cassandra/db/composites/CompoundDenseCellNameType.java
+++ b/src/java/org/apache/cassandra/db/composites/CompoundDenseCellNameType.java
@@ -54,14 +54,13 @@ public class CompoundDenseCellNameType extends AbstractCompoundCellNameType
public CellName create(Composite prefix, ColumnDefinition column)
{
// We ignore the column because it's just the COMPACT_VALUE name which is not store in the cell name (and it can be null anyway)
- assert prefix.size() == fullSize;
if (prefix instanceof CellName)
return (CellName)prefix;
+ // as noted below in makeWith(), compound dense cell names don't have to include all components
assert prefix instanceof CompoundComposite;
CompoundComposite lc = (CompoundComposite)prefix;
- assert lc.elements.length == lc.size;
- return new CompoundDenseCellName(lc.elements);
+ return new CompoundDenseCellName(lc.elements, lc.size);
}
protected Composite makeWith(ByteBuffer[] components, int size, Composite.EOC eoc, boolean isStatic)
@@ -69,7 +68,7 @@ public class CompoundDenseCellNameType extends AbstractCompoundCellNameType
assert !isStatic;
// A composite dense table cell name don't have to have all the component set to qualify as a
// proper CellName (for backward compatibility reasons mostly), so always return a cellName
- Composite c = new CompoundDenseCellName(components, size);
+ CompoundDenseCellName c = new CompoundDenseCellName(components, size);
return eoc != Composite.EOC.NONE ? c.withEOC(eoc) : c;
}
diff --git a/src/java/org/apache/cassandra/thrift/CassandraServer.java b/src/java/org/apache/cassandra/thrift/CassandraServer.java
index <HASH>..<HASH> 100644
--- a/src/java/org/apache/cassandra/thrift/CassandraServer.java
+++ b/src/java/org/apache/cassandra/thrift/CassandraServer.java
@@ -933,8 +933,8 @@ public class CassandraServer implements Cassandra.Iface
del.timestamp);
else
mutation.deleteRange(cfm.cfName,
- cfm.comparator.cellFromByteBuffer(del.predicate.getSlice_range().start),
- cfm.comparator.cellFromByteBuffer(del.predicate.getSlice_range().finish),
+ cfm.comparator.fromByteBuffer(del.predicate.getSlice_range().start),
+ cfm.comparator.fromByteBuffer(del.predicate.getSlice_range().finish),
del.timestamp);
}
else
|
Fix Thrift slice deletions, incomplete cell names in updates
Patch by Tyler Hobbs; reviewed by Sylvain Lebresne for CASSANDRA-<I>
|
Stratio_stratio-cassandra
|
train
|
52ad9d8277fb815f67a90c09747fe93cb87fe0e5
|
diff --git a/lib/workers/branch/index.js b/lib/workers/branch/index.js
index <HASH>..<HASH> 100644
--- a/lib/workers/branch/index.js
+++ b/lib/workers/branch/index.js
@@ -177,7 +177,10 @@ async function processBranch(branchConfig) {
logger.debug('Passing repository-changed error up');
throw err;
}
- logger.error({ err }, `Error updating branch: ${err.message}`);
+ // istanbul ignore if
+ if (err.message !== 'registry-failure') {
+ logger.error({ err }, `Error updating branch: ${err.message}`);
+ }
// Don't throw here - we don't want to stop the other renovations
return 'error';
}
diff --git a/lib/workers/branch/lock-files.js b/lib/workers/branch/lock-files.js
index <HASH>..<HASH> 100644
--- a/lib/workers/branch/lock-files.js
+++ b/lib/workers/branch/lock-files.js
@@ -402,6 +402,22 @@ async function getUpdatedLockFiles(config) {
'package-lock.json'
);
if (res.error) {
+ // istanbul ignore if
+ if (res.stderr && res.stderr.includes('No matching version found for')) {
+ for (const upgrade of config.upgrades) {
+ if (
+ res.stderr.includes(
+ `No matching version found for ${upgrade.depName}`
+ )
+ ) {
+ logger.info(
+ { dependency: upgrade.depName },
+ 'npm install failed for the dependency being updated - skipping branch creation'
+ );
+ throw new Error('registry-failure');
+ }
+ }
+ }
lockFileErrors.push({
lockFile: lockFileName,
stderr: res.stderr,
@@ -433,6 +449,22 @@ async function getUpdatedLockFiles(config) {
'npm-shrinkwrap.json'
);
if (res.error) {
+ // istanbul ignore if
+ if (res.stderr && res.stderr.includes('No matching version found for')) {
+ for (const upgrade of config.upgrades) {
+ if (
+ res.stderr.includes(
+ `No matching version found for ${upgrade.depName}`
+ )
+ ) {
+ logger.info(
+ { dependency: upgrade.depName },
+ 'npm install failed for the dependency being updated - skipping branch creation'
+ );
+ throw new Error('registry-failure');
+ }
+ }
+ }
lockFileErrors.push({
lockFile: lockFileName,
stderr: res.stderr,
@@ -462,6 +494,24 @@ async function getUpdatedLockFiles(config) {
env
);
if (res.error) {
+ // istanbul ignore if
+ if (res.stderr && res.stderr.includes(`Couldn't find any versions for`)) {
+ for (const upgrade of config.upgrades) {
+ /* eslint-disable no-useless-escape */
+ if (
+ res.stderr.includes(
+ `Couldn't find any versions for \\\"${upgrade.depName}\\\"`
+ )
+ ) {
+ logger.warn(
+ { dependency: upgrade.depName },
+ 'yarn install failed for the dependency being updated - skipping branch creation'
+ );
+ throw new Error('registry-failure');
+ }
+ /* eslint-enable no-useless-escape */
+ }
+ }
lockFileErrors.push({
lockFile: lockFileName,
stderr: res.stderr,
@@ -491,6 +541,22 @@ async function getUpdatedLockFiles(config) {
env
);
if (res.error) {
+ // istanbul ignore if
+ if (res.stdout && res.stdout.includes(`No compatible version found:`)) {
+ for (const upgrade of config.upgrades) {
+ if (
+ res.stdout.includes(
+ `No compatible version found: ${upgrade.depName}`
+ )
+ ) {
+ logger.warn(
+ { dependency: upgrade.depName },
+ 'pnpm install failed for the dependency being updated - skipping branch creation'
+ );
+ throw new Error('registry-failure');
+ }
+ }
+ }
lockFileErrors.push({
lockFile: lockFileName,
stderr: res.stderr,
diff --git a/lib/workers/branch/npm.js b/lib/workers/branch/npm.js
index <HASH>..<HASH> 100644
--- a/lib/workers/branch/npm.js
+++ b/lib/workers/branch/npm.js
@@ -70,7 +70,7 @@ async function generateLockFile(tmpDir, env, filename) {
'Generated lockfile'
);
} catch (err) /* istanbul ignore next */ {
- logger.warn(
+ logger.info(
{
err,
stdout,
diff --git a/lib/workers/branch/pnpm.js b/lib/workers/branch/pnpm.js
index <HASH>..<HASH> 100644
--- a/lib/workers/branch/pnpm.js
+++ b/lib/workers/branch/pnpm.js
@@ -79,7 +79,7 @@ async function generateLockFile(tmpDir, env) {
},
'pnpm install error'
);
- return { error: true, stderr: err.stderr };
+ return { error: true, stderr: err.stderr, stdout: err.stdout };
}
return { lockFile };
}
diff --git a/lib/workers/branch/yarn.js b/lib/workers/branch/yarn.js
index <HASH>..<HASH> 100644
--- a/lib/workers/branch/yarn.js
+++ b/lib/workers/branch/yarn.js
@@ -81,6 +81,8 @@ async function generateLockFile(tmpDir, env) {
logger.info(
{
err,
+ stdout,
+ stderr,
},
'yarn install error'
);
|
fix: skip branch creation if the updated dependency fails to lock (#<I>)
There are times when an npm dependency has an update available yet the “npm/yarn/pnpm install” fails to find it, and the lock file can’t be generated. We check for this any time there’s a lock file error and abort the branch creation, hoping it fixes itself on the next run.
Closes #<I>
|
renovatebot_renovate
|
train
|
a4b285ce0002bfaa7a15bd500a1bfaac0a13eeeb
|
diff --git a/src/pyshark/tshark/tshark.py b/src/pyshark/tshark/tshark.py
index <HASH>..<HASH> 100644
--- a/src/pyshark/tshark/tshark.py
+++ b/src/pyshark/tshark/tshark.py
@@ -101,11 +101,11 @@ def get_tshark_version(tshark_path=None):
parameters = [get_tshark_path(tshark_path), '-v']
version_output = check_output(parameters).decode("ascii")
version_line = version_output.splitlines()[0]
- pattern = '.*\s(\d+\.\d+\.\d+)\s.*' # match "#.#.#" version pattern
+ pattern = '.*\s(\d+\.\d+\.\d+)\s.*' # match " #.#.# " version pattern
m = re.match(pattern, version_line)
if not m:
raise TSharkVersionException('Unable to parse TShark version from: {}'.format(version_line))
- version_string = m.groups()[0]
+ version_string = m.groups()[0] # Use first match found
return version_string
|
Updating comments to reflect regex correctly
|
KimiNewt_pyshark
|
train
|
782bc4d3b037684f472e1db53c1878390b8c9a32
|
diff --git a/lib/puppet/defaults.rb b/lib/puppet/defaults.rb
index <HASH>..<HASH> 100644
--- a/lib/puppet/defaults.rb
+++ b/lib/puppet/defaults.rb
@@ -131,7 +131,9 @@ module Puppet
:diff => ["diff", "Which diff command to use when printing differences between files."],
:show_diff => [false, "Whether to print a contextual diff when files are being replaced. The diff
is printed on stdout, so this option is meaningless unless you are running Puppet interactively.
- This feature currently requires the ``diff/lcs`` Ruby library."]
+ This feature currently requires the ``diff/lcs`` Ruby library."],
+ :yamldir => {:default => "$vardir/yaml", :owner => "$user", :group => "$user", :mode => "750",
+ :desc => "The directory in which YAML data is stored, usually in a subdirectory."}
)
hostname = Facter["hostname"].value
@@ -503,11 +505,6 @@ module Puppet
"The backend store to use for storing files by checksum (i.e., filebuckets)."]
)
- self.setdefaults(:yaml,
- :yamldir => ["$vardir/yaml",
- "The directory in which YAML data is stored, usually in a subdirectory."]
- )
-
self.setdefaults(:rails,
:dblocation => { :default => "$statedir/clientconfigs.sqlite3",
:mode => 0660,
|
Fixing the yaml path so that it is correctly
created for puppetmasterd.
|
puppetlabs_puppet
|
train
|
c9dbdbed4f9026c4befacac638ef41424b5e7569
|
diff --git a/src/translate.php b/src/translate.php
index <HASH>..<HASH> 100644
--- a/src/translate.php
+++ b/src/translate.php
@@ -319,19 +319,16 @@ class Translate{
if(!isset($TR_TABLES[$charset])){
require(dirname(__FILE__)."/tr_tables/lower_upper/$charset.php");
}
- return strtr($text,$TR_TABLES[$charset]["velka"],$TR_TABLES[$charset]["mala"]);
+ $text = strtr($text,$TR_TABLES[$charset]["velka"],$TR_TABLES[$charset]["mala"]);
break;
case "utf8":
- // TODO: rewrite this masterpiece :)
- $text = self::Trans($text,"utf8","iso-8859-2");
- $text = self::Lower($text,"iso-8859-2");
- return self::Trans($text,"iso-8859-2","utf8");
+ $text = mb_strtolower($text,"utf8");
break;
- case "ascii":
default:
- return strtolower($text);
- break;
+ $text = strtolower($text);
}
+
+ return $text;
}
/**
@@ -351,19 +348,17 @@ class Translate{
if(!isset($TR_TABLES[$charset])){
require(dirname(__FILE__)."/tr_tables/lower_upper/$charset.php");
}
- return strtr($text,$TR_TABLES[$charset]["mala"],$TR_TABLES[$charset]["velka"]);
+ $text = strtr($text,$TR_TABLES[$charset]["mala"],$TR_TABLES[$charset]["velka"]);
break;
case "utf8":
- // TODO: rewrite this masterpiece :)
- $text = self::Trans($text,"utf8","iso-8859-2");
- $text = self::Upper($text,"iso-8859-2");
- return self::Trans($text,"iso-8859-2","utf8");
+ $text = mb_strtoupper($text,"utf8");
break;
case "ascii":
default:
- return strtoupper($text);
- break;
+ $text = strtoupper($text);
}
+
+ return $text;
}
/**
diff --git a/test/tc_translate.php b/test/tc_translate.php
index <HASH>..<HASH> 100644
--- a/test/tc_translate.php
+++ b/test/tc_translate.php
@@ -172,6 +172,12 @@ class TcTranslate extends TcBase{
$this->assertNotEquals("KŘEMÍLEK",Translate::Upper("Křemílek","ASCII"));
$this->assertNotEquals("křemílek",Translate::Lower("KřemÍLEK","ASCII"));
+
+ $this->assertEquals("KŘEMÍLEK",Translate::Upper("Křemílek","UTF-8"));
+ $this->assertEquals("křemílek",Translate::Lower("KřemÍLEK","UTF-8"));
+
+ $this->assertEquals("§ • (symbols)",Translate::Lower("§ • (symbols)","UTF-8"));
+ $this->assertEquals("§ • (SYMBOLS)",Translate::UPPER("§ • (SYMBOLS)","UTF-8"));
}
function test_utf8_to_ascii(){
@@ -200,7 +206,7 @@ class TcTranslate extends TcBase{
// Symbols
$this->assertEquals("(R) (c)",Translate::Trans("® ©","UTF-8","ASCII"));
- $this->assertEquals("? paragraph",Translate::Trans("§ paragraph","UTF-8","ASCII"));
+ $this->assertEquals("? (section)",Translate::Trans("§ (section)","UTF-8","ASCII"));
// TODO: otestovat locale
|
Translate::Lower() and Translate::Upper() fixed for UTF-8 strings; built-in functions mb_strtoupper and mb_strtolower are being used
|
atk14_Translate
|
train
|
aa30a90f68afe55773d5b9ebeb6a807cd9ba6a2d
|
diff --git a/lib/mongo_mapper/plugins/associations/base.rb b/lib/mongo_mapper/plugins/associations/base.rb
index <HASH>..<HASH> 100644
--- a/lib/mongo_mapper/plugins/associations/base.rb
+++ b/lib/mongo_mapper/plugins/associations/base.rb
@@ -6,7 +6,7 @@ module MongoMapper
attr_reader :name, :options, :query_options
# Options that should not be considered MongoDB query options/criteria
- AssociationOptions = [:as, :class, :class_name, :dependent, :extend, :foreign_key, :in, :polymorphic, :autosave, :touch]
+ AssociationOptions = [:as, :class, :class_name, :dependent, :extend, :foreign_key, :in, :polymorphic, :autosave, :touch, :counter_cache]
def initialize(name, options={}, &extension)
@name, @options, @query_options, @original_options = name.to_sym, {}, {}, options
@@ -43,6 +43,10 @@ module MongoMapper
!!@options[:touch]
end
+ def counter_cache?
+ !!@options[:counter_cache]
+ end
+
def type_key_name
"_type"
end
diff --git a/lib/mongo_mapper/plugins/associations/belongs_to_association.rb b/lib/mongo_mapper/plugins/associations/belongs_to_association.rb
index <HASH>..<HASH> 100644
--- a/lib/mongo_mapper/plugins/associations/belongs_to_association.rb
+++ b/lib/mongo_mapper/plugins/associations/belongs_to_association.rb
@@ -20,6 +20,7 @@ module MongoMapper
model.key type_key_name, String unless model.key?(type_key_name) if polymorphic?
super
add_touch_callbacks if touch?
+ add_counter_cache if counter_cache?
end
def autosave?
@@ -46,7 +47,15 @@ module MongoMapper
@model.after_save(method_name)
@model.after_touch(method_name)
@model.after_destroy(method_name)
+ end
+
+ def add_counter_cache
+ options = {}
+ if @options[:counter_cache] && @options[:counter_cache] != true
+ options[:field] = @options[:counter_cache]
+ end
+ @model.counter_cache name, options
end
end
end
diff --git a/lib/mongo_mapper/plugins/counter_cache.rb b/lib/mongo_mapper/plugins/counter_cache.rb
index <HASH>..<HASH> 100644
--- a/lib/mongo_mapper/plugins/counter_cache.rb
+++ b/lib/mongo_mapper/plugins/counter_cache.rb
@@ -17,6 +17,19 @@ module MongoMapper
# end
#
# Field names follow rails conventions, so counter_cache :user will increment the Integer field `posts_count' on User
+ #
+ # Alternatively, you can also use the more common ActiveRecord syntax:
+ #
+ # class Post
+ # belongs_to :user, :counter_cache => true
+ # end
+ #
+ # Or with an alternative field name:
+ #
+ # class Post
+ # belongs_to :user, :counter_cache => :custom_posts_count
+ # end
+ #
module CounterCache
class InvalidCounterCacheError < StandardError; end
diff --git a/spec/functional/counter_cache_spec.rb b/spec/functional/counter_cache_spec.rb
index <HASH>..<HASH> 100644
--- a/spec/functional/counter_cache_spec.rb
+++ b/spec/functional/counter_cache_spec.rb
@@ -20,27 +20,24 @@ module CounterCacheFixtureModels
:class_name => "CounterCacheFixtureModels::Comment"
belongs_to :user,
+ :counter_cache => true,
:class_name => "CounterCacheFixtureModels::User"
-
- counter_cache :user
end
class Comment
include MongoMapper::Document
belongs_to :post,
+ :counter_cache => true,
:class_name => "CounterCacheFixtureModels::Post"
-
- counter_cache :post
end
class CustomComment
include MongoMapper::Document
belongs_to :post,
+ :counter_cache => :some_custom_comments_count,
:class_name => "CounterCacheFixtureModels::Post"
-
- counter_cache :post, :field => :some_custom_comments_count
end
end
|
counter caching: Add more conventional syntax: belongs_to :association, :counter_cache => true
|
mongomapper_mongomapper
|
train
|
52dcf596638b386ac3c69e9eedf6f48e0a660d56
|
diff --git a/spring-social-twitter/src/main/java/org/springframework/social/twitter/api/impl/SearchTemplate.java b/spring-social-twitter/src/main/java/org/springframework/social/twitter/api/impl/SearchTemplate.java
index <HASH>..<HASH> 100644
--- a/spring-social-twitter/src/main/java/org/springframework/social/twitter/api/impl/SearchTemplate.java
+++ b/spring-social-twitter/src/main/java/org/springframework/social/twitter/api/impl/SearchTemplate.java
@@ -67,7 +67,8 @@ class SearchTemplate extends AbstractTwitterOperations implements SearchOperatio
}
if (this.includeEntities)
{
- parameters.put("include_entities", "true");
+ searchUrl += "&include_entities={entities}";
+ parameters.put("entities", "true");
}
return restTemplate.getForObject(searchUrl, SearchResults.class, parameters);
}
|
fixed small issue where search template was not building the 'included_entities' into the url
|
spring-projects_spring-social-twitter
|
train
|
1c670ce9db3dabf61eef8c5f33266084e96f3113
|
diff --git a/taxon_names_resolver/gnr_tools.py b/taxon_names_resolver/gnr_tools.py
index <HASH>..<HASH> 100644
--- a/taxon_names_resolver/gnr_tools.py
+++ b/taxon_names_resolver/gnr_tools.py
@@ -22,7 +22,7 @@ def safeReadJSON(url, logger, max_check=6, waittime=30):
while counter < max_check:
try:
with contextlib.closing(urllib.request.urlopen(url)) as f:
- res = json.loads(f.read())
+ res = json.loads(f.read().decode('utf8'))
return res
except Exception as errmsg:
logger.info('----- GNR error [{0}] : retrying ----'.format(errmsg))
|
added utf8 decoding to json.loads in gnr_tools.py
|
DomBennett_TaxonNamesResolver
|
train
|
78d57af7d1ecd010333351afee0e50df30c85c48
|
diff --git a/tests/unit/test_routes.py b/tests/unit/test_routes.py
index <HASH>..<HASH> 100644
--- a/tests/unit/test_routes.py
+++ b/tests/unit/test_routes.py
@@ -52,6 +52,7 @@ def test_routes():
includeme(config)
assert config.add_route.calls == [
+ pretend.call("health", "/_health/"),
pretend.call('index', '/'),
pretend.call("robots.txt", "/robots.txt"),
pretend.call("index.sitemap.xml", "/sitemap.xml"),
diff --git a/tests/unit/test_views.py b/tests/unit/test_views.py
index <HASH>..<HASH> 100644
--- a/tests/unit/test_views.py
+++ b/tests/unit/test_views.py
@@ -21,7 +21,7 @@ from pyramid.httpexceptions import HTTPNotFound
from warehouse import views
from warehouse.views import (
forbidden, index, httpexception_view, robotstxt, current_user_indicator,
- search,
+ search, health
)
from ..common.db.accounts import UserFactory
@@ -340,3 +340,14 @@ class TestSearch:
pretend.call(es_query, url_maker=url_maker, page=15 or 1),
]
assert url_maker_factory.calls == [pretend.call(db_request)]
+
+
+def test_health():
+ request = pretend.stub(
+ db=pretend.stub(
+ execute=pretend.call_recorder(lambda q: None),
+ ),
+ )
+
+ assert health(request) == "OK"
+ assert request.db.execute.calls == [pretend.call("SELECT 1")]
diff --git a/vcl/main.vcl b/vcl/main.vcl
index <HASH>..<HASH> 100644
--- a/vcl/main.vcl
+++ b/vcl/main.vcl
@@ -128,6 +128,12 @@ sub vcl_recv {
return(pass);
}
+ # We don't ever want to cache our health URL. Outside systems should be
+ # able to use it to reach past Fastly and get an end to end health check.
+ if (req.url == "/_health/") {
+ return(pass);
+ }
+
# Finally, return the default lookup action.
return(lookup);
}
diff --git a/warehouse/routes.py b/warehouse/routes.py
index <HASH>..<HASH> 100644
--- a/warehouse/routes.py
+++ b/warehouse/routes.py
@@ -12,6 +12,9 @@
def includeme(config):
+ # Simple Route for health checks.
+ config.add_route("health", "/_health/")
+
# Basic global routes
config.add_route("index", "/")
config.add_route("robots.txt", "/robots.txt")
diff --git a/warehouse/views.py b/warehouse/views.py
index <HASH>..<HASH> 100644
--- a/warehouse/views.py
+++ b/warehouse/views.py
@@ -207,3 +207,14 @@ def search(request):
)
def current_user_indicator(request):
return {}
+
+
+@view_config(route_name="health", renderer="string")
+def health(request):
+ # This will ensure that we can access the database and run queries against
+ # it without doing anything that will take a lock or block other queries.
+ request.db.execute("SELECT 1")
+
+ # Nothing will actually check this, but it's a little nicer to have
+ # something to return besides an empty body.
+ return "OK"
|
Add a simple view for Fastly Health checks
|
pypa_warehouse
|
train
|
98864112cb9f8695c99c9f9602e9eb7437dd0d2c
|
diff --git a/client/blocks/reader-post-card/index.jsx b/client/blocks/reader-post-card/index.jsx
index <HASH>..<HASH> 100644
--- a/client/blocks/reader-post-card/index.jsx
+++ b/client/blocks/reader-post-card/index.jsx
@@ -21,6 +21,7 @@ import FollowButton from 'reader/follow-button';
import PostGallery from './gallery';
import DailyPostButton from 'blocks/daily-post-button';
import { isDailyPostChallengeOrPrompt } from 'blocks/daily-post-button/helper';
+import * as DiscoverHelper from 'reader/discover/helper';
export default class RefreshPostCard extends React.Component {
static propTypes = {
@@ -127,7 +128,11 @@ export default class RefreshPostCard extends React.Component {
let followUrl;
if ( showPrimaryFollowButton ) {
- followUrl = feed ? feed.feed_URL : post.site_URL;
+ if ( DiscoverHelper.isDiscoverPost( post ) ) {
+ followUrl = DiscoverHelper.getSourceFollowUrl( post );
+ } else {
+ followUrl = feed ? feed.feed_URL : post.site_URL;
+ }
}
let featuredAsset;
@@ -142,7 +147,7 @@ export default class RefreshPostCard extends React.Component {
return (
<Card className={ classes } onClick={ this.handleCardClick }>
<PostByline post={ post } site={ site } feed={ feed } showSiteName={ showSiteName } />
- { showPrimaryFollowButton && <FollowButton siteUrl={ followUrl } /> }
+ { showPrimaryFollowButton && followUrl && <FollowButton siteUrl={ followUrl } /> }
<div className="reader-post-card__post">
{ ! isGallery && featuredAsset }
{ isGallery && <PostGallery post={ post } /> }
diff --git a/client/lib/reader-feed-subscriptions/actions.js b/client/lib/reader-feed-subscriptions/actions.js
index <HASH>..<HASH> 100644
--- a/client/lib/reader-feed-subscriptions/actions.js
+++ b/client/lib/reader-feed-subscriptions/actions.js
@@ -14,7 +14,7 @@ var Dispatcher = require( 'dispatcher' ),
FeedStoreActionTypes = require( 'lib/feed-store/constants' ).action;
var FeedSubscriptionActions = {
- follow: function( url, fetchMeta ) {
+ follow: function( url, fetchMeta = true ) {
var meta;
if ( ! url ) {
diff --git a/client/reader/discover/controller.js b/client/reader/discover/controller.js
index <HASH>..<HASH> 100644
--- a/client/reader/discover/controller.js
+++ b/client/reader/discover/controller.js
@@ -44,7 +44,7 @@ export default {
),
onUpdatesShown: trackUpdatesLoaded.bind( null, mcKey ),
suppressSiteNameLink: true,
- showPrimaryFollowButtonOnCards: false,
+ showPrimaryFollowButtonOnCards: true,
showBack: false,
className: 'is-discover-stream is-site-stream',
} ),
diff --git a/client/reader/discover/helper.js b/client/reader/discover/helper.js
index <HASH>..<HASH> 100644
--- a/client/reader/discover/helper.js
+++ b/client/reader/discover/helper.js
@@ -77,5 +77,11 @@ export function getSourceFollowUrl( post ) {
if ( isInternalDiscoverPost( post ) ) {
followUrl = get( post, 'discover_metadata.attribution.blog_url' );
}
+
+ // If it's a site pick, try the permalink
+ if ( ! followUrl && isDiscoverSitePick( post ) ) {
+ followUrl = get( post, 'discover_metadata.permalink' );
+ }
+
return followUrl || '';
}
|
Reader Refresh: show follow button for Discover cards (#<I>)
* Show follow button on Discover cards
* Show follow button where follow URL is available, and use original post for byline if we have it
* For site picks, try the permalink
* Fetch feed and site meta with new subscriptions so that Manage Following works after sub
|
Automattic_wp-calypso
|
train
|
8af66c86d93e1679ea0302a80b5a20c47ea6ff39
|
diff --git a/README.rdoc b/README.rdoc
index <HASH>..<HASH> 100644
--- a/README.rdoc
+++ b/README.rdoc
@@ -48,6 +48,33 @@ You can also be a follower of other models
@gang.follower?(@bonnie)
@bonnie.follows?(@gang)
+== Callbacks
+
+You can attach callbacks to the follower/followee models before or after the follow.
+
+ # Follower model
+ def before_follow(followee)
+ puts 'Notify me'
+ end
+
+ # Other follower callbacks
+ after_follow
+ before_unfollow
+ after_unfollow
+
+
+ # Followee model
+ def before_followed_by(follower)
+ puts 'Something here'
+ end
+
+ # Other followee callbacks
+ after_followed_by
+ before_unfollowed_by
+ after_unfollowed_by
+
+* Note: careful with using callbacks, we have no transaction so if breaks on your callbacks, what gets saved is saved.
+
* Any bug or issue, please send me an email to aeguintu@gmail.com
== For development
diff --git a/lib/mongoid_follow/follower.rb b/lib/mongoid_follow/follower.rb
index <HASH>..<HASH> 100644
--- a/lib/mongoid_follow/follower.rb
+++ b/lib/mongoid_follow/follower.rb
@@ -14,10 +14,10 @@ module Mongoid
def follow(model)
if self.id != model.id && !self.follows?(model)
- model.before_followed_by(self) if model.respond_to?('before_followed')
+ model.before_followed_by(self) if model.respond_to?('before_followed_by')
model.followers.create!(:ff_type => self.class.name, :ff_id => self.id)
model.inc(:fferc, 1)
- model.after_followed_by(self) if model.respond_to?('after_followed')
+ model.after_followed_by(self) if model.respond_to?('after_followed_by')
self.before_follow(model) if self.respond_to?('before_follow')
self.followees.create!(:ff_type => model.class.name, :ff_id => model.id)
@@ -36,10 +36,10 @@ module Mongoid
def unfollow(model)
if self.id != model.id && self.follows?(model)
- model.before_unfollowed_by(self) if model.respond_to?('before_unfollowed')
+ model.before_unfollowed_by(self) if model.respond_to?('before_unfollowed_by')
model.followers.where(:ff_type => self.class.name, :ff_id => self.id).destroy
model.inc(:fferc, -1)
- model.after_unfollowed_by(self) if model.respond_to?('after_unfollowed')
+ model.after_unfollowed_by(self) if model.respond_to?('after_unfollowed_by')
self.before_unfollow(model) if self.respond_to?('before_unfollow')
self.followees.where(:ff_type => model.class.name, :ff_id => model.id).destroy
diff --git a/spec/models/user.rb b/spec/models/user.rb
index <HASH>..<HASH> 100644
--- a/spec/models/user.rb
+++ b/spec/models/user.rb
@@ -9,6 +9,10 @@ class User
# after follower follows
end
+ def after_followed_by(follower)
+ # after followee is followed
+ end
+
def after_unfollowed_by(followee)
# after follower unfollows
end
diff --git a/spec/specs/follow_spec.rb b/spec/specs/follow_spec.rb
index <HASH>..<HASH> 100644
--- a/spec/specs/follow_spec.rb
+++ b/spec/specs/follow_spec.rb
@@ -129,11 +129,11 @@ describe Mongoid::Follower do
# Duh... this is a useless spec... Hrmn...
it "should respond on callbacks" do
@bonnie.respond_to?('after_follow').should be_true
- @bonnie.respond_to?('after_unfollowed').should be_true
+ @bonnie.respond_to?('after_unfollowed_by').should be_true
@bonnie.respond_to?('before_follow').should be_false
- @gang.respond_to?('before_followed').should be_true
- @gang.respond_to?('after_followed').should be_false
+ @gang.respond_to?('before_followed_by').should be_true
+ @gang.respond_to?('after_followed_by').should be_false
end
end
end
|
Modified callbacks. Fixed README.
|
alecguintu_mongoid_follow
|
train
|
db4c7109913d9fac676417db00dc41b01766f30b
|
diff --git a/rinoh/style.py b/rinoh/style.py
index <HASH>..<HASH> 100644
--- a/rinoh/style.py
+++ b/rinoh/style.py
@@ -553,6 +553,13 @@ class Styled(DocumentElement, metaclass=StyledMeta):
style = '[{}]'.format(self.style) if self.style else ''
return parent + self.__class__.__name__ + style
+ @property
+ def nesting_level(self):
+ try:
+ return self.parent.nesting_level + 1
+ except AttributeError:
+ return 0
+
@cached
def get_style(self, attribute, flowable_target):
try:
@@ -1006,7 +1013,7 @@ class StyleLog(object):
log.write('{line} page {} {line}\n'.format(current_page,
line='-' * 34))
styled = entry.styled
- level = styled.path.count('>')
+ level = styled.nesting_level
name = type(styled).__name__
attrs = OrderedDict()
if styled.id:
|
Styled.nesting_level: depth of a Styled in the tree
|
brechtm_rinohtype
|
train
|
2eb6d11906598476902e1f4e2f59bba0013661f2
|
diff --git a/woocommerce-api.js b/woocommerce-api.js
index <HASH>..<HASH> 100644
--- a/woocommerce-api.js
+++ b/woocommerce-api.js
@@ -65,13 +65,19 @@ WooCommerceAPI.prototype._getUrl = function(endpoint) {
* @return {Object}
*/
WooCommerceAPI.prototype._getOAuth = function() {
- return new OAuth({
+ var data = {
consumer: {
public: this.consumerKey,
secret: this.consumerSecret
},
signature_method: 'HMAC-SHA256'
- });
+ };
+
+ if ('v3' !== this.version) {
+ data.last_ampersand = false;
+ }
+
+ return new OAuth(data);
};
/**
|
Added support for WooCommerce API v1 and v2 oAuth
|
woocommerce_wc-api-node
|
train
|
1d3e93f1a3503fa23a589b1e5baa5802aeaab819
|
diff --git a/kettle.py b/kettle.py
index <HASH>..<HASH> 100755
--- a/kettle.py
+++ b/kettle.py
@@ -7,7 +7,7 @@ import struct
import sys
from argparse import ArgumentParser
from fireplace.enums import CardType, GameTag, OptionType, Zone
-from fireplace.game import Game
+from fireplace.game import BaseGame as Game
from fireplace.player import Player
from fireplace.utils import CardList
|
Kettle: Use BaseGame instead of Game for now
|
jleclanche_fireplace
|
train
|
a61f6ff7343f176227deea0eb7b28a4b15050bf3
|
diff --git a/backend/macros.js b/backend/macros.js
index <HASH>..<HASH> 100644
--- a/backend/macros.js
+++ b/backend/macros.js
@@ -71,6 +71,10 @@ class Macros extends commonMacros {
// Removes a 'mailto:' from the beginning
// Ensures the email contains a @
static standardizeEmail(email) {
+ if (!email) {
+ return null;
+ }
+
if (email.startsWith('mailto:')) {
email = email.slice('mailto:'.length);
}
@@ -88,6 +92,10 @@ class Macros extends commonMacros {
static standardizePhone(phone) {
+ if (!phone) {
+ return null;
+ }
+
phone = phone.trim();
if (phone.startsWith('tel:')) {
diff --git a/backend/scrapers/employees/cssh.js b/backend/scrapers/employees/cssh.js
index <HASH>..<HASH> 100644
--- a/backend/scrapers/employees/cssh.js
+++ b/backend/scrapers/employees/cssh.js
@@ -32,7 +32,14 @@ class Cssh {
const $ = cheerio.load(resp.body);
// Scrape the name from a h1
- obj.name = $('#lightbox-container > div.col-lg-3.col-md-3.col-sm-6.fac-single > h1').text().trim();
+ let name = $('#lightbox-container > div.col-lg-3.col-md-3.col-sm-6.fac-single > h1').text()
+ if (name) {
+ obj.name = name.trim();
+ }
+ else {
+ obj.name = ''
+ macros.error("Could not scrape prof name.", url)
+ }
// Parse the first name and the last name from the given name
const { firstName, lastName } = macros.parseNameWithSpaces(obj.name);
@@ -43,12 +50,24 @@ class Cssh {
}
// Scrape the picture of the prof
- obj.image = $('#lightbox-container > div.col-lg-3.col-md-3.col-sm-6.fac-single > img.headshot').attr('src').trim();
+ let image = $('#lightbox-container > div.col-lg-3.col-md-3.col-sm-6.fac-single > img.headshot').attr('src')
+ if (image) {
+ obj.image = image.trim();
+ }
+ else {
+ macros.log("Could not scrape image.", url)
+ }
// Job Title
// "Assistant Professor Sociology and Health Science"
- const primaryRole = $('#lightbox-container > div.col-lg-3.col-md-3.col-sm-6.fac-single > div.fac-single-title').text().trim().split(';')[0];
- obj.primaryRole = primaryRole.replace(/\s+/gi, ' ');
+ let primaryRole = $('#lightbox-container > div.col-lg-3.col-md-3.col-sm-6.fac-single > div.fac-single-title').text()
+ if (primaryRole) {
+ primaryRole = primaryRole.trim().split(';')[0];
+ obj.primaryRole = primaryRole.replace(/\s+/gi, ' ');
+ }
+ else {
+ macros.log('Could not scrape job title', url)
+ }
// Parse out the email.
const emailElements = $('#lightbox-container > div.col-lg-3.col-md-3.col-sm-6.fac-single > p > a');
@@ -58,7 +77,7 @@ class Cssh {
const element = emailElements[i];
if (element.attribs.href.startsWith('mailto')) {
if (emailElement) {
- console.log('Error, already saw a email element');
+ macros.log('Error, already saw a email element');
} else {
emailElement = element;
}
@@ -73,7 +92,7 @@ class Cssh {
// If they are different, log a warning and skip this email.
if ((mailto || email) && mailto !== email) {
- console.log('Warning; mailto !== email, skipping', mailto, email, 'done yo');
+ macros.log('Warning; mailto !== email, skipping', mailto, email, 'done yo');
} else if (mailto === email && email) {
// If they are the same and they are not an empty string or undefined, keep the email.
obj.emails = [email];
@@ -109,7 +128,7 @@ class Cssh {
// The phone number is under the contact field
else if (category === 'Contact:') {
- console.log(element.data.trim(), 'phone??');
+ macros.log(element.data.trim(), 'phone??');
}
}
@@ -119,14 +138,14 @@ class Cssh {
if (element.name === 'h4') {
// If an h4 element but not a category, log an error
if (element.children.length !== 1 || element.children[0].type !== 'text') {
- console.log('error finding category text', element.children);
+ macros.log('error finding category text', element.children);
continue;
}
// Ensure that its children is valid too.
const h4Text = element.children[0].data.trim();
if (h4Text.length < 0) {
- console.log('Found h4 with no text?', element.children);
+ macros.log('Found h4 with no text?', element.children);
continue;
}
@@ -190,7 +209,7 @@ class Cssh {
if (macros.DEV) {
await cache.set('dev_data', this.constructor.name, 'main', people);
- console.log('cssh file saved!');
+ macros.log('cssh file saved!');
}
return people;
|
Some bug fixes in cssh js
|
ryanhugh_searchneu
|
train
|
e5005ed66d26cabb8d2dbd1c0478ffcf0a5684c3
|
diff --git a/slave/ls340.py b/slave/ls340.py
index <HASH>..<HASH> 100644
--- a/slave/ls340.py
+++ b/slave/ls340.py
@@ -284,14 +284,25 @@ class Loop(InstrumentBase):
* *<enabled>* A boolean enabling/disabling the control loop.
* *<powerup>* Specifies if the control loop is enabled/disabled after
powerup.
+
:ivar pid: The PID values.
:ivar ramp: The control-loop ramp parameters, represented by the following
tuple *(<enabled>, <rate>)*, where
* *<enabled>* Enables, disables the ramping.
* *<rate>* Specifies the ramping rate in kelvin/minute.
+
:ivar ramping: The ramping status. `True` if ramping and `False` otherwise.
:ivar setpoint: The control-loop setpoint in its configured units.
+ :ivar settle: The settle parameters. *(<threshold>, <time>)*, where
+
+ * *<threshold>* Specifies the allowable band around the setpoint. Must
+ be between 0.00 and 100.00.
+ * *<time>* The time in seconds, the reading must stay within the band.
+ Valid entries are 0-86400.
+
+ .. note:: This command is only available for loop1.
+
:ivar tuning_status: A boolean representing the tuning status, `True` if
tuning `False` otherwise.
.. note:: This attribute is only available for loop1.
|
Implemented loop1 settle command, closes #<I>.
|
p3trus_slave
|
train
|
399ba60eb17744ea4c45891e29140f1a2b44a4c0
|
diff --git a/netpyne/analysis/hnn.py b/netpyne/analysis/hnn.py
index <HASH>..<HASH> 100644
--- a/netpyne/analysis/hnn.py
+++ b/netpyne/analysis/hnn.py
@@ -28,7 +28,10 @@ import numpy as np
@exception
def plotDipole():
from .. import sim
- from bokeh.plotting import figure, show, output_file
+ from bokeh.plotting import figure
+ from bokeh.resources import CDN
+ from bokeh.embed import file_html
+ from bokeh.layouts import layout
TOOLS = "pan,wheel_zoom,box_zoom,reset,save,box_select"
@@ -38,5 +41,7 @@ def plotDipole():
spkid = sim.allSimData['spkid']
fig.scatter(spkt, spkid, size=1, legend="all spikes")
- output_file("hnn_dipole.html", title="HNN Dipole Plot (spikes for now!)")
- show(fig) # open a browser
\ No newline at end of file
+ plot_layout = layout(fig, sizing_mode='scale_both')
+ html = file_html(plot_layout, CDN, title="HNN Dipole Plot (spikes for now!)")
+
+ return html
|
Change plotDipole to return html instead of saving it as a file
|
Neurosim-lab_netpyne
|
train
|
de45b6fc595e62276bb2b4db5eb865d219716c30
|
diff --git a/lib/firehose/version.rb b/lib/firehose/version.rb
index <HASH>..<HASH> 100644
--- a/lib/firehose/version.rb
+++ b/lib/firehose/version.rb
@@ -1,4 +1,4 @@
module Firehose
- VERSION = "1.1.0"
- CODENAME = "Rockin' Reconnect"
+ VERSION = "1.1.1"
+ CODENAME = "Radtastical Redis"
end
|
Bumped gem to <I> to work with em-hiredis gem.
|
firehoseio_firehose
|
train
|
e262e612d6bdf7c73461cf66f1115dbc5ccef7a1
|
diff --git a/knowledge_base/__init__.py b/knowledge_base/__init__.py
index <HASH>..<HASH> 100755
--- a/knowledge_base/__init__.py
+++ b/knowledge_base/__init__.py
@@ -652,3 +652,19 @@ class KnowledgeBase(object):
author.remove()
return removed_resources
+
+
+ def remove_work(self, work):
+
+ removed_resources = []
+
+ for title in work.efrbroo_P102_has_title:
+ removed_resources.append(title.subject)
+ title.remove()
+
+ for identifier in work.ecrm_P1_is_identified_by:
+ removed_resources.append(identifier.subject)
+ identifier.remove()
+
+ work.remove()
+ return removed_resources
|
added kb.remove_work()
|
mromanello_hucitlib
|
train
|
83fd2784f97453ba46fa6918ef4b5101403c6cbe
|
diff --git a/src/main/java/hex/singlenoderf/SpeeDRF.java b/src/main/java/hex/singlenoderf/SpeeDRF.java
index <HASH>..<HASH> 100644
--- a/src/main/java/hex/singlenoderf/SpeeDRF.java
+++ b/src/main/java/hex/singlenoderf/SpeeDRF.java
@@ -295,7 +295,7 @@ public class SpeeDRF extends Job.ValidatedJob {
Frame train = FrameTask.DataInfo.prepareFrame(source, response, ignored_cols, !regression /*toEnum is TRUE if regression is FALSE*/, false, false);
Frame test = null;
if (validation != null) {
- test = FrameTask.DataInfo.prepareFrame(validation, validation.vecs()[source.find(response)], ignored_cols, false, false, false);
+ test = FrameTask.DataInfo.prepareFrame(validation, validation.vecs()[source.find(response)], ignored_cols, !regression, false, false);
}
// Set the model parameters
|
tweak the test data so that final column gets mapped
|
h2oai_h2o-2
|
train
|
28f1eb8fcfffcf2aac49c756be0f6bf8c6133743
|
diff --git a/azure-keyvault/azure/keyvault/custom/key_vault_authentication.py b/azure-keyvault/azure/keyvault/custom/key_vault_authentication.py
index <HASH>..<HASH> 100644
--- a/azure-keyvault/azure/keyvault/custom/key_vault_authentication.py
+++ b/azure-keyvault/azure/keyvault/custom/key_vault_authentication.py
@@ -6,7 +6,7 @@
import threading
from requests.auth import AuthBase
from requests.cookies import extract_cookies_to_jar
-from msrest.authentication import Authentication
+from msrest.authentication import OAuthTokenAuthentication
from azure.keyvault import HttpBearerChallenge
from azure.keyvault import HttpBearerChallengeCache as ChallengeCache
@@ -125,7 +125,7 @@ class KeyVaultAuthBase(AuthBase):
request.headers['Authorization'] = '{} {}'.format(auth[0], auth[1])
-class KeyVaultAuthentication(Authentication):
+class KeyVaultAuthentication(OAuthTokenAuthentication):
"""
Authentication class to be used as credentials for the KeyVaultClient.
:Example Usage:
@@ -140,18 +140,51 @@ class KeyVaultAuthentication(Authentication):
self.keyvault_data_client = KeyVaultClient(KeyVaultAuthentication(auth_callack))
"""
- def __init__(self, authorization_callback):
+ def __init__(self, authorization_callback=None, credentials=None):
"""
Creates a new KeyVaultAuthentication instance used for authentication in the KeyVaultClient
:param authorization_callback: A callback used to provide authentication credentials to the key vault data service.
This callback should take three str arguments: authorization uri, resource, and scope, and return
a tuple of (token type, access token).
+ :param credentials:: Credentials needed for the client to connect to Azure.
+ :type credentials: :mod:`A msrestazure Credentials
+ object<msrestazure.azure_active_directory>`
"""
+ if not authorization_callback and not credentials:
+ raise ValueError("Either parameter 'authorization_callback' or parameter 'credentials' must not be None.")
+
super(KeyVaultAuthentication, self).__init__()
+
+ self._credentials = credentials
+
+ if not authorization_callback:
+ def auth_callback(server, resource, scope):
+ if self._credentials.resource != resource:
+ self._credentials.resource = resource
+ token = self._credentials.set_token()
+ token = self._credentials.token
+ return token['token_type'], token['access_token']
+
+ authorization_callback = auth_callback
+
self.auth = KeyVaultAuthBase(authorization_callback)
self._callback = authorization_callback
def signed_session(self):
- session = super(KeyVaultAuthentication, self).signed_session()
- session.auth = self.auth
+ session = None
+ if self._credentials:
+ session = self._credentials.signed_session()
+ else:
+ session = super(KeyVaultAuthentication, self).signed_session()
+ session.auth = self.auth
return session
+
+ def refresh_session(self):
+ """Return updated session if token has expired, attempts to
+ refresh using refresh token.
+
+ :rtype: requests.Session.
+ """
+ if self._credentials:
+ self._credentials.refresh_session()
+ return self.signed_session()
diff --git a/azure-keyvault/azure/keyvault/custom/key_vault_client.py b/azure-keyvault/azure/keyvault/custom/key_vault_client.py
index <HASH>..<HASH> 100644
--- a/azure-keyvault/azure/keyvault/custom/key_vault_client.py
+++ b/azure-keyvault/azure/keyvault/custom/key_vault_client.py
@@ -9,7 +9,7 @@ from msrest.pipeline import ClientRawResponse
from .key_vault_authentication import KeyVaultAuthBase, KeyVaultAuthentication
from ..key_vault_client import KeyVaultClient as KeyVaultClientBase
from ..models import KeyVaultErrorException
-from msrestazure.azure_active_directory import AADTokenCredentials
+from msrestazure.azure_active_directory import AADMixin
class CustomKeyVaultClient(KeyVaultClientBase):
@@ -25,21 +25,12 @@ class CustomKeyVaultClient(KeyVaultClientBase):
object<msrestazure.azure_active_directory>` or :mod:`A KeyVaultAuthentication
object<key_vault_authentication>`
"""
- self._inner_creds = None
- # if the supplied credentials instance is not derived from KeyVaultAuthBase but is an AADTokenCredentials instance
- if not isinstance(credentials, KeyVaultAuthBase) and isinstance(credentials, AADTokenCredentials):
+ # if the supplied credentials instance is not derived from KeyVaultAuthBase but is an AAD credential type
+ if not isinstance(credentials, KeyVaultAuthBase) and isinstance(credentials, AADMixin):
- # create a callback which authenticates with the supplied credentials instance
- self._inner_creds = credentials
-
- def auth_callback(server, resource, scope):
- self._inner_creds.resource = resource
- token = self._inner_creds.token
- return token['token_type'], token['access_token']
-
- # swap the supplied credentials with a KeyVaultAuthentication instance using the created callback
- credentials = KeyVaultAuthentication(auth_callback)
+ # wrap the supplied credentials with a KeyVaultAuthentication instance. Use that for the credentials supplied to the base client
+ credentials = KeyVaultAuthentication(credentials=credentials)
super(CustomKeyVaultClient, self).__init__(credentials)
|
updates from feedback
-moving auth_callback logic to KeyVaultAuthentication
-updating KeyVaultAuthentication to derive from OAuthTokenAuthentication
[skip ci]
|
Azure_azure-sdk-for-python
|
train
|
972e4155d4a8876684dad725ab623e9f393a5502
|
diff --git a/src/main/java/com/luckycatlabs/sunrisesunset/dto/Location.java b/src/main/java/com/luckycatlabs/sunrisesunset/dto/Location.java
index <HASH>..<HASH> 100755
--- a/src/main/java/com/luckycatlabs/sunrisesunset/dto/Location.java
+++ b/src/main/java/com/luckycatlabs/sunrisesunset/dto/Location.java
@@ -64,4 +64,30 @@ public class Location {
public BigDecimal getLongitude() {
return longitude;
}
+
+ /**
+ * Sets the coordinates of the location object.
+ *
+ * @param latitude
+ * the latitude, in degrees, of this location. North latitude is positive, south negative.
+ * @param longitude
+ * the longitude, in degrees, of this location. East longitude is positive, east negative.
+ */
+ public void setLocation(String latitude, String longitude) {
+ this.latitude = new BigDecimal(latitude);
+ this.longitude = new BigDecimal(longitude);
+ }
+
+ /**
+ * Sets the coordinates of the location object.
+ *
+ * @param latitude
+ * the latitude, in degrees, of this location. North latitude is positive, south negative.
+ * @param longitude
+ * the longitude, in degrees, of this location. East longitude is positive, east negative.
+ */
+ public void setLocation(double latitude, double longitude) {
+ this.latitude = new BigDecimal(latitude);
+ this.longitude = new BigDecimal(longitude);
+ }
}
|
Added setters to the location class in order to avoid creating a
new SunriseSunsetCalculator every time a new location arrives (useful
for mobile devices)
|
mikereedell_sunrisesunsetlib-java
|
train
|
ee17b93df9ef2150d0ef25e077f1f87637a54508
|
diff --git a/integration-cli/docker_cli_run_test.go b/integration-cli/docker_cli_run_test.go
index <HASH>..<HASH> 100644
--- a/integration-cli/docker_cli_run_test.go
+++ b/integration-cli/docker_cli_run_test.go
@@ -2266,7 +2266,7 @@ func TestRunRedirectStdout(t *testing.T) {
}()
select {
- case <-time.After(2 * time.Second):
+ case <-time.After(10 * time.Second):
t.Fatal("command timeout")
case <-ch:
}
|
Up test timeout to <I>s based on recent drone.io timeout failures
Docker-DCO-<I>-
|
containers_storage
|
train
|
990fef3b5774320524291872c3387f1dd17c5b24
|
diff --git a/blockstack_client/schemas.py b/blockstack_client/schemas.py
index <HASH>..<HASH> 100644
--- a/blockstack_client/schemas.py
+++ b/blockstack_client/schemas.py
@@ -59,8 +59,8 @@ OP_USER_ID_CLASS = r'[a-zA-Z0-9\-_.%]'
OP_DATASTORE_ID_CLASS = r'[a-zA-Z0-9\-_.~%]'
OP_USER_ID_PATTERN = r'^({}+)$'.format(OP_USER_ID_CLASS)
OP_DATASTORE_ID_PATTERN = r'^({}+)$'.format(OP_DATASTORE_ID_CLASS)
-OP_URI_TARGET_PATTERN = r'^([a-z0-9+]+)://([a-zA-Z0-9\-_.~%#?&\\:/=]+)$'
-OP_URI_TARGET_PATTERN_NOSCHEME = r'^([a-zA-Z0-9\-_.~%#?&\\:/=]+)$'
+OP_URI_TARGET_PATTERN = r'^([a-z0-9+]+)://([a-zA-Z0-9\-_.~%#?&\\:/=@]+)$'
+OP_URI_TARGET_PATTERN_NOSCHEME = r'^([a-zA-Z0-9\-_.~%#?&\\:/=@]+)$'
OP_ANY_TYPE_SCHEMA = [
{
diff --git a/blockstack_client/version.py b/blockstack_client/version.py
index <HASH>..<HASH> 100644
--- a/blockstack_client/version.py
+++ b/blockstack_client/version.py
@@ -24,4 +24,4 @@
__version_major__ = '0'
__version_minor__ = '14'
__version_patch__ = '3'
-__version__ = '{}.{}.{}.1'.format(__version_major__, __version_minor__, __version_patch__)
+__version__ = '{}.{}.{}.2'.format(__version_major__, __version_minor__, __version_patch__)
|
URL schema to allow @ + a version bump
|
blockstack_blockstack-core
|
train
|
a39a6e77a47d36a58dbe637442f3b744336ce17a
|
diff --git a/www/data_module/src/services/data/collection/dataquery.service.spec.js b/www/data_module/src/services/data/collection/dataquery.service.spec.js
index <HASH>..<HASH> 100644
--- a/www/data_module/src/services/data/collection/dataquery.service.spec.js
+++ b/www/data_module/src/services/data/collection/dataquery.service.spec.js
@@ -172,7 +172,7 @@ describe('dataquery service', function() {
});
});
- return describe('limit(array, limit)', function() {
+ describe('limit(array, limit)', function() {
it('should slice the array', function() {
const result = wrappedDataQuery.limit(testArray, 1);
diff --git a/www/data_module/src/services/data/data.service.spec.js b/www/data_module/src/services/data/data.service.spec.js
index <HASH>..<HASH> 100644
--- a/www/data_module/src/services/data/data.service.spec.js
+++ b/www/data_module/src/services/data/data.service.spec.js
@@ -174,7 +174,7 @@ describe('Data service', function() {
});
});
- return describe('when()', () =>
+ describe('when()', () =>
it('should autopopulate ids', function(done) {
dataService.when('builds', [{}, {}, {}]);
dataService.getBuilds().onChange = function(builds) {
diff --git a/www/data_module/src/services/dataUtils/dataUtils.service.spec.js b/www/data_module/src/services/dataUtils/dataUtils.service.spec.js
index <HASH>..<HASH> 100644
--- a/www/data_module/src/services/dataUtils/dataUtils.service.spec.js
+++ b/www/data_module/src/services/dataUtils/dataUtils.service.spec.js
@@ -158,7 +158,7 @@ describe('Data utils service', function() {
});
});
- return describe('emailInString(string)', () =>
+ describe('emailInString(string)', () =>
it('should return an email from a string', function() {
let email = dataUtilsService.emailInString('foo <bar@foo.com>');
diff --git a/www/data_module/src/services/socket/socket.service.spec.js b/www/data_module/src/services/socket/socket.service.spec.js
index <HASH>..<HASH> 100644
--- a/www/data_module/src/services/socket/socket.service.spec.js
+++ b/www/data_module/src/services/socket/socket.service.spec.js
@@ -156,7 +156,7 @@ describe('Socket service', function() {
});
- return describe('getUrl()', function() {
+ describe('getUrl()', function() {
it('should return the WebSocket url based on the host and port (localhost)', function() {
const host = 'localhost';
|
www: Fix useless return in sites involving describe()
|
buildbot_buildbot
|
train
|
937532169ff5c969cd70c3210c0065042d2d20c4
|
diff --git a/config/drivers.php b/config/drivers.php
index <HASH>..<HASH> 100644
--- a/config/drivers.php
+++ b/config/drivers.php
@@ -6,18 +6,18 @@
return [
'chrome' => [
'mac' => [
- 'version' => '2.9',
- 'url' => 'http://chromedriver.storage.googleapis.com/2.9/chromedriver_mac32.zip',
+ 'version' => '2.35.0',
+ 'url' => 'https://chromedriver.storage.googleapis.com/2.35/chromedriver_mac64.zip',
'filename' => 'chromedriver',
],
'win' => [
- 'version' => '2.9',
- 'url' => 'http://chromedriver.storage.googleapis.com/2.9/chromedriver_win32.zip',
+ 'version' => '2.35.0',
+ 'url' => 'https://chromedriver.storage.googleapis.com/2.35/chromedriver_win32.zip',
'filename' => 'chromedriver.exe',
],
'linux' => [
- 'version' => '2.9',
- 'url' => 'http://chromedriver.storage.googleapis.com/2.9/chromedriver_linux64.zip',
+ 'version' => '2.35.0',
+ 'url' => 'https://chromedriver.storage.googleapis.com/2.35/chromedriver_linux64.zip',
'filename' => 'chromedriver',
],
],
|
updated versions for ChromeDriver download links (#<I>)
|
Modelizer_Laravel-Selenium
|
train
|
9d86275813aa5f4ed862262225666c3160aee9b4
|
diff --git a/src/main/org/codehaus/groovy/ast/expr/MethodCallExpression.java b/src/main/org/codehaus/groovy/ast/expr/MethodCallExpression.java
index <HASH>..<HASH> 100644
--- a/src/main/org/codehaus/groovy/ast/expr/MethodCallExpression.java
+++ b/src/main/org/codehaus/groovy/ast/expr/MethodCallExpression.java
@@ -67,6 +67,7 @@ public class MethodCallExpression extends Expression {
new MethodCallExpression(transformer.transform(objectExpression), transformer.transform(method), transformer.transform(arguments));
answer.setSafe(safe);
answer.setSpreadSafe(spreadSafe);
+ answer.setImplicitThis(implicitThis);
answer.setSourcePosition(this);
return answer;
}
|
GROOVY-<I>
changed return values of isImplicitThis() to: (was OK after phase CONVERSION, but not after SEMANTIC_ANALYSIS)
* anObj.methodCall() isImplicitThis() returns false
* this.println("anything") isImplicitThis() returns false
* println("anything") isImplicitThis() returns true
git-svn-id: <URL>
|
groovy_groovy-core
|
train
|
62f7700148a367fe792518d9d9dc7e2a56d073dd
|
diff --git a/src/main/java/net/bootsfaces/beans/ELTools.java b/src/main/java/net/bootsfaces/beans/ELTools.java
index <HASH>..<HASH> 100644
--- a/src/main/java/net/bootsfaces/beans/ELTools.java
+++ b/src/main/java/net/bootsfaces/beans/ELTools.java
@@ -415,7 +415,7 @@ public class ELTools {
*/
public static Annotation[] readAnnotations(UIComponent p_component) {
ValueExpression valueExpression = p_component.getValueExpression("value");
- if (valueExpression != null) {
+ if (valueExpression != null && valueExpression.getExpressionString() != null && valueExpression.getExpressionString().length()>0) {
return readAnnotations(valueExpression, p_component);
}
return null;
|
#<I> and #<I> stop the application from crashing if no vale attribute is provided
|
TheCoder4eu_BootsFaces-OSP
|
train
|
05c341192f392b50096a1eafa5353daf28261b16
|
diff --git a/html/pfappserver/root/static.alt/src/store/modules/config.js b/html/pfappserver/root/static.alt/src/store/modules/config.js
index <HASH>..<HASH> 100644
--- a/html/pfappserver/root/static.alt/src/store/modules/config.js
+++ b/html/pfappserver/root/static.alt/src/store/modules/config.js
@@ -1122,7 +1122,7 @@ const actions = {
commit('PKI_CAS_REQUEST')
return api.getPkiCas().then(response => {
const { data: { items = [] } = {} } = response
- commit('PKI_CAS_UPDATED', items)
+ commit('PKI_CAS_UPDATED', items || [])
return state.pkiCas
})
} else {
@@ -1137,7 +1137,7 @@ const actions = {
commit('PKI_PROFILES_REQUEST')
return api.getPkiProfiles().then(response => {
const { data: { items = [] } = {} } = response
- commit('PKI_PROFILES_UPDATED', items)
+ commit('PKI_PROFILES_UPDATED', items || [])
return state.pkiProfiles
})
} else {
@@ -1152,7 +1152,7 @@ const actions = {
commit('PKI_CERTS_REQUEST')
return api.getPkiCerts().then(response => {
const { data: { items = [] } = {} } = response
- commit('PKI_CERTS_UPDATED', items)
+ commit('PKI_CERTS_UPDATED', items || [])
return state.pkiCerts
})
} else {
|
(web admin) fix loop when items is null
|
inverse-inc_packetfence
|
train
|
bae94182a8351d8ed22be06d178d8b16c5e899a2
|
diff --git a/src/Config.php b/src/Config.php
index <HASH>..<HASH> 100644
--- a/src/Config.php
+++ b/src/Config.php
@@ -40,7 +40,7 @@ class Config
'files' => [
'changes' => 'CHANGES.md',
'contributing' => 'CONTRIBUTING.md',
- 'license' => 'LICENSE',
+ 'license' => 'LICENSE.md',
'phpunit' => 'phpunit.xml.dist',
'readme' => 'README.MD',
],
|
use a .md file for license
|
producerphp_producer.producer
|
train
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.