hash
stringlengths 40
40
| diff
stringlengths 131
26.7k
| message
stringlengths 7
694
| project
stringlengths 5
67
| split
stringclasses 1
value | diff_languages
stringlengths 2
24
|
---|---|---|---|---|---|
20e1e0749573b59c9f3e758fc345a3c2c7d16fb5 | diff --git a/torchnet/meter/apmeter.py b/torchnet/meter/apmeter.py
index <HASH>..<HASH> 100644
--- a/torchnet/meter/apmeter.py
+++ b/torchnet/meter/apmeter.py
@@ -75,7 +75,7 @@ class APMeter(meter.Meter):
'dimensions for output should match previously added examples.'
# make sure storage is of sufficient size
- if self.scores.size() < self.scores.numel() + output.numel():
+ if self.scores.storage().size() < self.scores.numel() + output.numel():
new_size = math.ceil(self.scores.storage().size() * 1.5)
new_weight_size = math.ceil(self.weights.storage().size() * 1.5)
self.scores.storage().resize_(int(new_size + output.numel()))
@@ -105,7 +105,7 @@ class APMeter(meter.Meter):
if self.scores.numel() == 0:
return 0
ap = torch.zeros(self.scores.size(1))
- rg = torch.arange(1, self.scores.size(0)+1).float()
+ rg = torch.range(1, self.scores.size(0)).float()
if self.weights.numel() > 0:
weight = self.weights.new(self.weights.size())
weighted_truth = self.weights.new(self.weights.size()) | re-add range,until arange is incorporated in update | pytorch_tnt | train | py |
830bea849d967bb4b3cd1d68d1ef5b9687eebf83 | diff --git a/troposphere/logs.py b/troposphere/logs.py
index <HASH>..<HASH> 100644
--- a/troposphere/logs.py
+++ b/troposphere/logs.py
@@ -2,6 +2,17 @@ from . import AWSObject, AWSProperty
from .validators import positive_integer
+class Destination(AWSProperty):
+ resource_type = "AWS::Logs::Destination"
+
+ props = {
+ 'DestinationName': (basestring, True),
+ 'DestinationPolicy': (basestring, True),
+ 'RoleArn': (basestring, True),
+ 'TargetArn': (basestring, True),
+ }
+
+
class LogGroup(AWSObject):
resource_type = "AWS::Logs::LogGroup"
@@ -10,6 +21,15 @@ class LogGroup(AWSObject):
}
+class LogStream(AWSObject):
+ resource_type = "AWS::Logs::LogStream"
+
+ props = {
+ 'LogGroupName': (basestring, True),
+ 'LogStreamName': (basestring, False)
+ }
+
+
class MetricTransformation(AWSProperty):
props = {
'MetricName': (basestring, True), | Added new resources for Logs: Destination & LogStream | cloudtools_troposphere | train | py |
10bfd6ff87107fde16459140792cbc590f8497a0 | diff --git a/lib/replicant/replicant.js b/lib/replicant/replicant.js
index <HASH>..<HASH> 100644
--- a/lib/replicant/replicant.js
+++ b/lib/replicant/replicant.js
@@ -109,7 +109,7 @@ class Replicant extends EventEmitter {
// Initialize the storage object if not present
if (!{}.hasOwnProperty.call(replicator.stores, namespace)) {
- replicator.stores[namespace] = new LocalStorage(path.join(REPLICANTS_ROOT, namespace));
+ replicator.stores[namespace] = new LocalStorage(path.join(REPLICANTS_ROOT, namespace), Infinity);
}
// Get the existing value, if any, and JSON parse if its an object | feat(replicants): remove local storage size quota (#<I>) | nodecg_nodecg | train | js |
de2d57485eda95aaf55b8c9d9f1698e18949c8e6 | diff --git a/lib/flickr.js b/lib/flickr.js
index <HASH>..<HASH> 100644
--- a/lib/flickr.js
+++ b/lib/flickr.js
@@ -71,9 +71,12 @@ exports.Flickr.prototype._executeOAuthAPIRequest = function(params, options, cal
var queryString = this.paramsToQueryString(params);
var request = this.oauth_client.get("https://api.flickr.com" + this.baseUrl + queryString,
- oauth_token, oauth_token_secret, function(error, data){
- if (error) {
- callback(new Error("Flickr Error ("+error.statusCode+"): message: "+error.data));
+ oauth_token, oauth_token_secret, function(err, data){
+ if (err) {
+ var error = new Error(err.data);
+ error.statusCode = err.statusCode;
+
+ callback(error);
} else {
flickr_instance.processResponse(data, options, callback);
} | Updated the OathAPI method to use the status code and message | sujal_node-flickr | train | js |
e41850faedfa47b2fd65d3b5f68ea73c40675b2f | diff --git a/lib/handlers/session.js b/lib/handlers/session.js
index <HASH>..<HASH> 100644
--- a/lib/handlers/session.js
+++ b/lib/handlers/session.js
@@ -421,8 +421,12 @@ module.exports = Observable.extend({
dropboxCallback: function (req, res, next) {
if (req.session.user) {
- req.session.user.dropbox_token = req.user.accessToken;
- this.models.updateDropboxData(req.session.user.name, req.user.accessToken, function (err) {
+ req.session.user.dropbox_token = req.user.accessToken; // jshint ignore: line
+ req.session.user.dropbox_id = req.user.id; // jshint ignore: line
+ this.models.user.updateOwnershipData(req.session.user.name, {
+ dropbox_token: req.user.accessToken, // jshint ignore: line
+ dropbox_id: req.user.id // jshint ignore: line
+ }, function (err) {
if (err) {
return next(err);
} | Save idropbox_id as well as token | jsbin_jsbin | train | js |
feb05f6f95750d81b79ea882ff0f121ede3fe31f | diff --git a/lib/resources/instagram/index.js b/lib/resources/instagram/index.js
index <HASH>..<HASH> 100644
--- a/lib/resources/instagram/index.js
+++ b/lib/resources/instagram/index.js
@@ -90,8 +90,15 @@ Instagram.prototype.subscribe = function(options, callback) {
utils.request(req, function(err, res, body) {
if(err) return callback(err);
- if(!body || !body.meta || body.meta.code >= 400) {
- return callback(new Error(meta.error_type + ': ' + meta.error_message));
+ if(body.error_type && body.error_message) {
+ return callback(new Error(body.error_type + ': ' + body.error_message));
+ }
+
+ if(!body || !body.meta || !body.data) {
+ return callback(new Error('Invalid response from Instagram'));
+ }
+ else if(body.meta.code >= 400) {
+ return callback(new Error(body.meta.error_type + ': ' + body.meta.error_message));
}
return callback(null, body.data); | Instagram: Add checks for more api errors
why can’t they just use a standard format for all responses? WORST API
EVER | jameswyse_nails-framework | train | js |
9113df09f96e7c6aacf785b91951b717339bfef9 | diff --git a/cul.js b/cul.js
index <HASH>..<HASH> 100644
--- a/cul.js
+++ b/cul.js
@@ -57,11 +57,15 @@ var Cul = function (options) {
options.init = options.init || true;
options.parse = options.parse || true;
options.coc = options.coc || false;
+ options.scc = options.scc || false;
options.rssi = options.rssi || true;
if (options.coc) {
options.baudrate = options.baudrate || 38400;
options.serialport = options.serialport || '/dev/ttyACM0';
+ } else if (options.scc) {
+ options.baudrate = options.baudrate || 38400;
+ options.serialport = options.serialport || '/dev/ttyAMA0';
} else {
options.baudrate = options.baudrate || 9600;
options.serialport = options.serialport || '/dev/ttyAMA0'; | Added SCC device option which sets default options for SCC | hobbyquaker_cul | train | js |
e6d8fe0f363c34958c372b58304f21c05215f9ae | diff --git a/utils/EQcorrscan_plotting.py b/utils/EQcorrscan_plotting.py
index <HASH>..<HASH> 100644
--- a/utils/EQcorrscan_plotting.py
+++ b/utils/EQcorrscan_plotting.py
@@ -206,7 +206,7 @@ def multi_event_singlechan(streams, picks, clip=10.0, pre_pick=2.0):
channel='*'+picks[i].channel[-1])[0]
else:
print 'No data for '+picks[i].station+'.'+picks[i].channel
- break
+ continue
tr.trim(picks[i].time-pre_pick, picks[i].time-pre_pick+clip)
y = tr.data
x = np.arange(len(y)) | Added multi-channel single channel plotting routine
Former-commit-id: <I>dc<I>d4c2ae9c5cc<I>ba<I>ea<I>e<I>f2e<I>e3 | eqcorrscan_EQcorrscan | train | py |
ff0141af9eaff9887d51fdd5fd6f91c4b7de8c44 | diff --git a/lib/metasploit_data_models/version.rb b/lib/metasploit_data_models/version.rb
index <HASH>..<HASH> 100755
--- a/lib/metasploit_data_models/version.rb
+++ b/lib/metasploit_data_models/version.rb
@@ -4,9 +4,11 @@ module MetasploitDataModels
# The major version number.
MAJOR = 0
# The minor version number, scoped to the {MAJOR} version number.
- MINOR = 18
+ MINOR = 19
# The patch number, scoped to the {MINOR} version number.
PATCH = 0
+ # The prerelease version, scoped to the {PATCH} version number.
+ PRERELEASE = 'mdm-service-text'
# The full version string, including the {MAJOR}, {MINOR}, {PATCH}, and optionally, the {PRERELEASE} in the
# {http://semver.org/spec/v2.0.0.html semantic versioning v2.0.0} format. | Upate version for branch
MSP-<I> | rapid7_metasploit_data_models | train | rb |
63e222b382ac515b8117741d5caafec78a68e7f2 | diff --git a/Zepi/Web/AccessControl/src/EventHandler/Administration/EditUser.php b/Zepi/Web/AccessControl/src/EventHandler/Administration/EditUser.php
index <HASH>..<HASH> 100644
--- a/Zepi/Web/AccessControl/src/EventHandler/Administration/EditUser.php
+++ b/Zepi/Web/AccessControl/src/EventHandler/Administration/EditUser.php
@@ -282,7 +282,7 @@ class EditUser extends FrontendEventHandler
protected function validateData(Framework $framework, User $user, $username, $password, $passwordConfirmed)
{
// Username
- if ($this->userManager->hasUserForUsername($username) && $this->userManager->getUserForUsername($username)->getUuid() == $user->getUuid()) {
+ if ($this->userManager->hasUserForUsername($username) && $this->userManager->getUserForUsername($username)->getUuid() != $user->getUuid()) {
return $this->translate('The username is already in use.', '\\Zepi\\Web\\AccessControl');
} | [+BUGFIX] EditUser EventHandler: Validation check is wrong | zepi_turbo-base | train | php |
3695e22b4be4e7f1f27e3e806e47a172764e5db2 | diff --git a/src/com/google/javascript/jscomp/WhitelistWarningsGuard.java b/src/com/google/javascript/jscomp/WhitelistWarningsGuard.java
index <HASH>..<HASH> 100644
--- a/src/com/google/javascript/jscomp/WhitelistWarningsGuard.java
+++ b/src/com/google/javascript/jscomp/WhitelistWarningsGuard.java
@@ -253,12 +253,12 @@ public class WhitelistWarningsGuard extends WarningsGuard {
out.append(
"# This is a list of legacy warnings that have yet to be fixed.\n");
- if (productName != null) {
+ if (productName != null && !productName.isEmpty()) {
out.append("# Please find some time and fix at least one of them "
+ "and it will be the happiest day for " + productName + ".\n");
}
- if (generatorTarget != null) {
+ if (generatorTarget != null && !generatorTarget.isEmpty()) {
out.append("# When you fix any of these warnings, run "
+ generatorTarget + " task.\n");
} | A few tweaks to the WhitelistBuilder output
-------------
Created by MOE: <URL> | google_closure-compiler | train | java |
a22c16645bca0a35823731e6bc0229775ca36d66 | diff --git a/lib/github/html.rb b/lib/github/html.rb
index <HASH>..<HASH> 100644
--- a/lib/github/html.rb
+++ b/lib/github/html.rb
@@ -49,7 +49,8 @@ module GitHub
# context - The default context hash. Values specified here may be
# overridden by individual pipeline runs.
class Pipeline
- Result = Struct.new(:output, :mentioned_users, :mentioned_teams, :mentioned_issues)
+ Result = Struct.new(:output, :mentioned_users, :mentioned_teams, :mentioned_issues,
+ :commits, :commits_count)
def initialize(filters, context={})
@filters = filters.flatten | Changing more pipelines to use the result | jch_html-pipeline | train | rb |
b21f8ec80436487e5778bcacd12205f6a2cfe46c | diff --git a/superset/viz.py b/superset/viz.py
index <HASH>..<HASH> 100644
--- a/superset/viz.py
+++ b/superset/viz.py
@@ -1765,9 +1765,7 @@ class WorldMapViz(BaseViz):
columns = ['country', 'm1', 'm2']
if metric == secondary_metric:
ndf = df[cols]
- # df[metric] will be a DataFrame
- # because there are duplicate column names
- ndf['m1'] = df[metric].iloc[:, 0]
+ ndf['m1'] = df[metric]
ndf['m2'] = ndf['m1']
else:
if secondary_metric: | Remove the use of Pandas' iloc() in WorldMapViz (#<I>)
When the same metric is used in a World Map panel for both bubble size
and an axis (either X or Y), it currently breaks the rendering.
The change in behavior was introduced in:
<URL> is not needed anymore since the code that used
to duplicate the metric is not there anymore.
Should fix #<I> | apache_incubator-superset | train | py |
1cc5068b8c6c1fc375956bcf9a09abb2a9b57489 | diff --git a/builtin/providers/aws/resource_vpn_connection_route.go b/builtin/providers/aws/resource_vpn_connection_route.go
index <HASH>..<HASH> 100644
--- a/builtin/providers/aws/resource_vpn_connection_route.go
+++ b/builtin/providers/aws/resource_vpn_connection_route.go
@@ -91,6 +91,12 @@ func resourceAwsVpnConnectionRouteRead(d *schema.ResourceData, meta interface{})
return err
}
}
+ if resp == nil || len(resp.VPNConnections) == 0 {
+ // This is kind of a weird edge case. I'd rather return an error
+ // instead of just blindly setting the ID to ""... since I don't know
+ // what might cause this.
+ return fmt.Errorf("No VPN connections returned")
+ }
vpnConnection := resp.VPNConnections[0] | provider/aws: nil protection against VPN connections [GH-<I>] | hashicorp_terraform | train | go |
731fb31965be8c8c541ea284d3e747bdba83fabb | diff --git a/webapps/ui/cockpit/plugins/base/app/data/dashboard/processDefinitionStatisticsData.js b/webapps/ui/cockpit/plugins/base/app/data/dashboard/processDefinitionStatisticsData.js
index <HASH>..<HASH> 100644
--- a/webapps/ui/cockpit/plugins/base/app/data/dashboard/processDefinitionStatisticsData.js
+++ b/webapps/ui/cockpit/plugins/base/app/data/dashboard/processDefinitionStatisticsData.js
@@ -6,7 +6,7 @@ var Controller = [ '$scope', 'processData', 'ProcessDefinitionResource',
function($scope, processData, ProcessDefinitionResource) {
processData.provide('processDefinitions', function() {
- return ProcessDefinitionResource.queryStatistics({ incidents: true }).$promise;
+ return ProcessDefinitionResource.queryStatistics({ rootIncidents: true }).$promise;
});
processData.provide('processDefinitionStatistics', ['processDefinitions', function(processDefinitions) { | fix(cockpit): only include rootIncidents in processes dashboard
Related to CAM-<I> | camunda_camunda-bpm-platform | train | js |
a4ede170fe4d4ceabb06a52cc3c2145f0faa3358 | diff --git a/shared/chat/conversation/container.js b/shared/chat/conversation/container.js
index <HASH>..<HASH> 100644
--- a/shared/chat/conversation/container.js
+++ b/shared/chat/conversation/container.js
@@ -87,13 +87,14 @@ const mapStateToProps = (state: TypedState, {routePath}): StateProps => {
}
const {inSearch, inboxFilter} = state.chat
+ const searchResults = SearchConstants.getSearchResultIdsArray(state, {searchKey: 'chatSearch'})
const userInputItemIds = SearchConstants.getUserInputItemIds(state, {searchKey: 'chatSearch'})
// If it's a multi-user chat that isn't a team, offer to make a new team.
const showTeamOffer = flags.teamChatEnabled && inSearch && userInputItemIds && userInputItemIds.length > 1
return {
- showSearchResults: inSearch,
+ showSearchResults: inSearch && !!searchResults,
conversationErrorText,
conversationIsError,
finalizeInfo, | Don't show no search results (#<I>) | keybase_client | train | js |
acad6b275e971f8103ae6e69ddeadc00a2d8b5ef | diff --git a/main/core/Controller/WorkspaceController.php b/main/core/Controller/WorkspaceController.php
index <HASH>..<HASH> 100644
--- a/main/core/Controller/WorkspaceController.php
+++ b/main/core/Controller/WorkspaceController.php
@@ -375,15 +375,25 @@ class WorkspaceController extends Controller
if (!is_null($resourceNode)) {
$this->session->set('isDesktop', false);
$route = $this->router->generate(
- 'claro_resource_open',
- [
- 'node' => $resourceNode->getId(),
- 'resourceType' => $resourceNode->getResourceType()->getName(),
- ]
- );
+ 'claro_resource_show',
+ [
+ 'id' => $resourceNode->getUuid(),
+ 'type' => $resourceNode->getResourceType()->getName(),
+ ]
+ );
return new RedirectResponse($route);
}
+ } elseif (isset($details['opening_type']) && 'tool' === $details['opening_type'] && isset($details['opening_target'])) {
+ $route = $this->router->generate(
+ 'claro_workspace_open_tool',
+ [
+ 'toolName' => $details['opening_target'],
+ 'workspaceId' => $workspaceId,
+ ]
+ );
+
+ return new RedirectResponse($route);
}
} | Workspace opening fix (#<I>)
* Fixes workspace default tool opening
* Fixes default resource at workspace opening | claroline_Distribution | train | php |
5a7ad27176f189b07456b2ec0000fbe349bc3072 | diff --git a/toolsrc/org/mozilla/javascript/tools/debugger/Main.java b/toolsrc/org/mozilla/javascript/tools/debugger/Main.java
index <HASH>..<HASH> 100644
--- a/toolsrc/org/mozilla/javascript/tools/debugger/Main.java
+++ b/toolsrc/org/mozilla/javascript/tools/debugger/Main.java
@@ -2233,7 +2233,7 @@ class SourceInfo {
}
int fnFirstLine = lines[0];
- int fnEndLine = lines[0];
+ int fnEndLine = fnFirstLine + 1;
for (int i = 1; i != lines.length; ++i) {
int line = lines[i];
if (line < fnFirstLine) { | Fixing ArrayIndexOutOfBoundsException reported by Steven Beal caused by broken code to setup endLine in SourceInfo.updateLineInfo. | mozilla_rhino | train | java |
41474fb518b4d24653dfb6d42a969a9d59e742ba | diff --git a/html.go b/html.go
index <HASH>..<HASH> 100644
--- a/html.go
+++ b/html.go
@@ -25,7 +25,7 @@ func (hr htmlrequester) fetchHTML(url string) (string, error) {
client := resty.New()
client.SetTimeout(hr.config.timeout)
resp, err := client.R().
- SetHeader("Content-Type", "application/json").
+ SetHeader("Content-Type", "text/plain").
SetHeader("User-Agent", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_7) AppleWebKit/534.30 (KHTML, like Gecko) Chrome/12.0.742.91 Safari/534.30").
Get(url) | Update html.go
Changed content-type from application/json to text/plain | advancedlogic_GoOse | train | go |
a83b9e940ab1796968d828ca4a33aa78cbe21ecd | diff --git a/pynexus/pynexus.py b/pynexus/pynexus.py
index <HASH>..<HASH> 100644
--- a/pynexus/pynexus.py
+++ b/pynexus/pynexus.py
@@ -273,7 +273,7 @@ class NexusConn:
else:
resQueue.put(res)
- threading.Thread(target=taskPushCh).start()
+ threading.Thread(target=callTaskPush).start()
return resQueue, errQueue
def taskPull(self, prefix, timeout=0):
@@ -299,6 +299,20 @@ class NexusConn:
)
return task, None
+ def taskPullCh(self, prefix, timeout=0):
+ resQueue = Queue()
+ errQueue = Queue()
+
+ def callTaskPull():
+ task, err = self.taskPull(prefix, timeout=timeout)
+ if err:
+ errQueue.put(err)
+ else:
+ resQueue.put(res)
+
+ threading.Thread(target=callTaskPull).start()
+ return resQueue, errQueue
+
def userCreate(self, username, password):
return self.execute('user.create', {'user': username, 'pass': password}) | New method taskPullCh for asynchronous pulls | jaracil_nxpy | train | py |
ad664f329946b8ee0c59686d02877ec8a1da8542 | diff --git a/ppb/systems/renderer.py b/ppb/systems/renderer.py
index <HASH>..<HASH> 100644
--- a/ppb/systems/renderer.py
+++ b/ppb/systems/renderer.py
@@ -2,6 +2,7 @@ import ctypes
import io
import logging
import random
+from time import time
import sdl2
import sdl2.ext
@@ -135,9 +136,10 @@ class Renderer(SdlSubSystem):
self.window = None
self.window_title = window_title
self.pixel_ratio = None
- self.render_clock = 0
+ self.render_clock = time()
self.target_frame_rate = target_frame_rate
- self.target_count = 1 / self.target_frame_rate
+ self.target_frame_length = 1 / self.target_frame_rate
+ self.target_clock = self.render_clock + self.target_frame_length
self._texture_cache = ObjectSideData()
@@ -166,12 +168,12 @@ class Renderer(SdlSubSystem):
super().__exit__(*exc)
def on_idle(self, idle_event: events.Idle, signal):
- self.render_clock += idle_event.time_delta
- if self.render_clock > self.target_count:
+ self.render_clock = time()
+ if self.render_clock >= self.target_clock:
self.pre_render_updates(idle_event.scene)
signal(events.PreRender())
signal(events.Render())
- self.render_clock = 0
+ self.target_clock = self.render_clock + self.target_frame_length
def pre_render_updates(self, scene):
camera = scene.main_camera | Calculate target framerate based on clock times, not an accumulator, to avoid floating point precision problems. | ppb_pursuedpybear | train | py |
9c3aa1f08191e48d2cd9cf2b511ec0b395acae8b | diff --git a/webpack.config.js b/webpack.config.js
index <HASH>..<HASH> 100644
--- a/webpack.config.js
+++ b/webpack.config.js
@@ -54,7 +54,7 @@ if (process.env.NODE_ENV === 'production') {
scssLoaders = [
'style-loader',
- 'css-loader',
+ 'css-loader?-autoprefixer',
'sass-loader'
]; | Fixed bug causing -webkit prefixes for IOS 8 Safari being removed by autoprefixer part of css-loader | kambi-sportsbook-widgets_widget-build-tools | train | js |
5c9e23c90540f89348faf43cce82c787f1229d72 | diff --git a/src/Twig.php b/src/Twig.php
index <HASH>..<HASH> 100644
--- a/src/Twig.php
+++ b/src/Twig.php
@@ -132,7 +132,7 @@ class Twig implements \ArrayAccess, \Pimple\ServiceProviderInterface
/**
* Return Twig environment
*
- * @return \Twig_EnvironmentInterface
+ * @return \Twig_Environment
*/
public function getEnvironment()
{ | Fixed return type hint to match Twig_Environment class | slimphp_Twig-View | train | php |
17774840e223867a0f0bd8cca7e6e43a960dd29d | diff --git a/tests/Fumocker/Tests/RegistryTest.php b/tests/Fumocker/Tests/RegistryTest.php
index <HASH>..<HASH> 100644
--- a/tests/Fumocker/Tests/RegistryTest.php
+++ b/tests/Fumocker/Tests/RegistryTest.php
@@ -10,14 +10,19 @@ class RegistryTest extends \PHPUnit_Framework_TestCase
*/
public function setUp()
{
- $classReflection = new \ReflectionClass('Fumocker\Registry');
- $propertyReflection = $classReflection->getProperty('instance');
+ $reflectionClass = new \ReflectionClass('Fumocker\Registry');
+ $reflectionProperty = $reflectionClass->getProperty('instance');
- $propertyReflection->setAccessible(true);
- $propertyReflection->setValue($classReflection, null);
- $propertyReflection->setAccessible(false);
+ $reflectionProperty->setAccessible(true);
+ $reflectionProperty->setValue($reflectionClass, null);
+ $reflectionProperty->setAccessible(false);
}
+ /**
+ * @static
+ *
+ * @return array
+ */
public static function provideInvalidIdentifiers()
{
return array(
@@ -33,6 +38,11 @@ class RegistryTest extends \PHPUnit_Framework_TestCase
);
}
+ /**
+ * @static
+ *
+ * @return array
+ */
public static function provideValidIdentifiers()
{
return array( | [registry] missing docblocks, variable rename. | formapro_Fumocker | train | php |
7ba0f893f1e2b62526ab536606ec7147d9b2ccca | diff --git a/pyhomematic/devicetypes/actors.py b/pyhomematic/devicetypes/actors.py
index <HASH>..<HASH> 100644
--- a/pyhomematic/devicetypes/actors.py
+++ b/pyhomematic/devicetypes/actors.py
@@ -175,6 +175,17 @@ class IOSwitch(HMActor, HelperActorState, HelperWorking, HelperEventRemote):
self.set_state(False, channel)
+class KeyMatic(HMActor, HelperActorState):
+ """
+ Open or close KeyMatic.
+ """
+ def __init__(self, device_description, proxy, resolveparamsets=False):
+ super().__init__(device_description, proxy, resolveparamsets)
+
+ # init metadata
+ self.ACTIONNODE.update({"OPEN": self.ELEMENT})
+
+
class IPSwitch(HMActor, HelperActorState, HelperActionOnTime):
"""
Switch turning attached device on or off.
@@ -321,4 +332,8 @@ DEVICETYPES = {
"HMW-LC-Dim1L-DR": KeyDimmer,
"HMIP-PS": IPSwitch,
"HMIP-PSM": IPSwitchPowermeter,
+ "HM-Sec-Key": KeyMatic,
+ "HM-Sec-Key-S": KeyMatic,
+ "HM-Sec-Key-O": KeyMatic,
+ "HM-Sec-Key-Generic": KeyMatic,
} | Added KeyMatic support (#<I>) | danielperna84_pyhomematic | train | py |
9359a236bc955a84b53417246fb5b4b2e3d04389 | diff --git a/i18n/tests/loader_tests.py b/i18n/tests/loader_tests.py
index <HASH>..<HASH> 100644
--- a/i18n/tests/loader_tests.py
+++ b/i18n/tests/loader_tests.py
@@ -1,10 +1,11 @@
import unittest
-import i18n
+from i18n import resource_loader
class TestFileLoader(unittest.TestCase):
- def test_dummy(self):
- self.assertTrue(hasattr(i18n, 'resource_loader'))
+ def test_nonexisting_extension(self):
+ self.assertRaises(resource_loader.I18nFileLoadError, resource_loader.load_resource, "foo.bar")
+
suite = unittest.TestLoader().loadTestsFromTestCase(TestFileLoader)
unittest.TextTestRunner(verbosity=2).run(suite) | Add test for nonexisting file extensions. | danhper_python-i18n | train | py |
f62df7516eefd7087d271b2c8e572ae8b18577be | diff --git a/main.py b/main.py
index <HASH>..<HASH> 100755
--- a/main.py
+++ b/main.py
@@ -441,6 +441,7 @@ class PowerLogParser:
sre = ACTION_METADATA_RE.match(data)
if sre:
meta, data, info = sre.groups()
+ data = self._parse_entity(data)
node = MetaDataNode(ts, meta, data, info)
self.current_node.append(node)
return | Process MetaData.data as an entity | HearthSim_python-hsreplay | train | py |
04018aa6a4a3c9967f7317821959df2144040822 | diff --git a/packages/vue-inbrowser-compiler/rollup.config.js b/packages/vue-inbrowser-compiler/rollup.config.js
index <HASH>..<HASH> 100644
--- a/packages/vue-inbrowser-compiler/rollup.config.js
+++ b/packages/vue-inbrowser-compiler/rollup.config.js
@@ -25,7 +25,7 @@ export default {
typescript({
useTsconfigDeclarationDir: true,
tsconfig: './tsconfig.build.json',
- cacheRoot: '../../node_modules/.rpt2_cache'
+ cacheRoot: '../../node_modules/.rollup_vue-compiler_cache'
}),
// Allow bundling cjs modules (unlike webpack, rollup doesn't understand cjs)
commonjs() | chore: make rollup cache folder name | vue-styleguidist_vue-styleguidist | train | js |
96908cb4297d4acb3f2cfb27d2cfee0884e4a1f9 | diff --git a/api/director_deployments.go b/api/director_deployments.go
index <HASH>..<HASH> 100644
--- a/api/director_deployments.go
+++ b/api/director_deployments.go
@@ -80,7 +80,7 @@ func (repo BoshDirectorRepository) DeleteDeployment(deploymentName string) (apiR
type deploymentResponse struct {
Name string `json:"name"`
- Releases []nameVersion `json:"deployments"`
+ Releases []nameVersion `json:"releases"`
Stemcells []nameVersion `json:"stemcells"`
}
diff --git a/api/director_deployments_test.go b/api/director_deployments_test.go
index <HASH>..<HASH> 100644
--- a/api/director_deployments_test.go
+++ b/api/director_deployments_test.go
@@ -19,7 +19,7 @@ var _ = Describe("Deployments", func() {
Body: `[
{
"name": "cf-warden",
- "deployments": [
+ "releases": [
{
"name": "cf",
"version": "153" | /deployments each include 'releases' not 'deployments' | cloudfoundry-community_gogobosh | train | go,go |
20df8ff5848d227238b77373bc869168ad3184b1 | diff --git a/Swat/SwatCheckboxEntryList.php b/Swat/SwatCheckboxEntryList.php
index <HASH>..<HASH> 100644
--- a/Swat/SwatCheckboxEntryList.php
+++ b/Swat/SwatCheckboxEntryList.php
@@ -174,7 +174,7 @@ class SwatCheckboxEntryList extends SwatCheckboxList
parent::process();
- foreach ($this->values as $key => $option_value)
+ foreach ($this->values as $option_value)
$widget = $this->getEntryWidget($option_value)->process();
} | We don't need key here.
svn commit r<I> | silverorange_swat | train | php |
d7ff5b3d0a46c6e542f92897e7633b645978599f | diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -25,7 +25,6 @@ setup(
],
install_requires=[
- 'sqlite3',
],
python_requires='>=3', | Remove sqlite3 dependency, as it is not a package -- it is included in python distributions | alvarogzp_python-sqlite-framework | train | py |
64a325e51e2115cc6a34896581c120c6912c1144 | diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -21,11 +21,15 @@ except ImportError:
if not os.path.exists(os.path.join(src_path, 'index.c')):
msg = "index extension needs to be compiled but cython isn't available"
raise ImportError(msg)
+ ext_modules = [
+ Extension("cyflann.index", ["cyflann/index.c"]),
+ ]
else:
- cythonize("cyflann/index.pyx", "cyflann/flann.pdx")
-ext_modules = [
- Extension("cyflann.index", ["cyflann/index.c"], extra_link_args=['-lflann'])
-]
+ ext_modules = cythonize("cyflann/*.pyx", "cyflann/*.pdx")
+
+for ext in ext_modules: # why doesn't cythonize let you do this?
+ ext.extra_link_args = ['-lflann']
+
setup(
name='cyflann', | change setup.py build method a bit | dougalsutherland_cyflann | train | py |
bb693d19b197633d98298fbb7b3380b88a8568b3 | diff --git a/support/publish-gems.rb b/support/publish-gems.rb
index <HASH>..<HASH> 100755
--- a/support/publish-gems.rb
+++ b/support/publish-gems.rb
@@ -24,6 +24,7 @@ gem_order = %w{
torquebox-web
torquebox
torquebox-server
+ torquebox-no-op
}
if gem_map.keys.sort != gem_order.sort | Add no-op gem to the publish script. | torquebox_torquebox | train | rb |
7629f674e30ea92218fe1d27bedc87b0f8d33a59 | diff --git a/sacad/sources/base.py b/sacad/sources/base.py
index <HASH>..<HASH> 100644
--- a/sacad/sources/base.py
+++ b/sacad/sources/base.py
@@ -143,9 +143,9 @@ class CoverSource(metaclass=abc.ABCMeta):
self.updateHttpHeaders(headers)
with self.api_watcher:
if post_data is not None:
- response = requests.post(url, data=post_data, headers=headers, timeout=10, verify=False)
+ response = requests.post(url, data=post_data, headers=headers, timeout=15, verify=False)
else:
- response = requests.get(url, headers=headers, timeout=10, verify=False)
+ response = requests.get(url, headers=headers, timeout=15, verify=False)
response.raise_for_status()
data = response.content
# add cache entry only when parsing is successful | Increase HTTP timeout again (to <I>s) | desbma_sacad | train | py |
548638d6dea8f66c77bfe68a90f7262091fba4ef | diff --git a/classes/phing/tasks/ext/StopwatchTask.php b/classes/phing/tasks/ext/StopwatchTask.php
index <HASH>..<HASH> 100644
--- a/classes/phing/tasks/ext/StopwatchTask.php
+++ b/classes/phing/tasks/ext/StopwatchTask.php
@@ -124,6 +124,7 @@ class StopwatchTask extends Task
$this->log('Starttime: ' . $period->getStartTime() . ' - Endtime: ' . $period->getEndTime() . ' - Duration: ' . $period->getDuration() . ' - Memory: ' . $period->getMemory(), Project::MSG_INFO);
}
+ $this->log('Name: ' . $this->name, Project::MSG_INFO);
$this->log('Category: ' . $event->getCategory(), Project::MSG_INFO);
$this->log('Origin: ' . $event->getOrigin(), Project::MSG_INFO);
$this->log('Start time: ' . $event->getStartTime(), Project::MSG_INFO); | Added stopwatch name to log output. (#<I>) | phingofficial_phing | train | php |
ce152f209be66f88c2d4d75be5829347733e5270 | diff --git a/interop/grpclb_fallback/client_linux.go b/interop/grpclb_fallback/client_linux.go
index <HASH>..<HASH> 100644
--- a/interop/grpclb_fallback/client_linux.go
+++ b/interop/grpclb_fallback/client_linux.go
@@ -35,6 +35,7 @@ import (
"google.golang.org/grpc/credentials"
"google.golang.org/grpc/credentials/alts"
"google.golang.org/grpc/credentials/google"
+ _ "google.golang.org/grpc/xds/googledirectpath"
testgrpc "google.golang.org/grpc/interop/grpc_testing"
testpb "google.golang.org/grpc/interop/grpc_testing" | xds: Add xds dependency to the fallback test client (#<I>) | grpc_grpc-go | train | go |
ce53cf7464141bf8f7c0c5b5984ee21e27a62cb5 | diff --git a/tests/AuditModelTest.php b/tests/AuditModelTest.php
index <HASH>..<HASH> 100644
--- a/tests/AuditModelTest.php
+++ b/tests/AuditModelTest.php
@@ -257,7 +257,16 @@ EOF;
$this->assertInstanceOf(UserStub::class, $audit->user()->getRelated());
- $this->assertEquals('pk_id', $audit->user()->getOwnerKey());
+ // Up to Laravel 5.3, the ownerKey attribute was called otherKey
+ if (method_exists($audit->user(), 'getOtherKey')) {
+ $this->assertEquals('pk_id', $audit->user()->getOtherKey());
+ }
+
+ // From Laravel 5.4 onward, the otherKey attribute was renamed to ownerKey
+ if (method_exists($audit->user(), 'getOwnerKey')) {
+ $this->assertEquals('pk_id', $audit->user()->getOwnerKey());
+ }
+
$this->assertEquals('fk_id', $audit->user()->getForeignKey());
}
} | fix(Tests): call the appropriate method, depending on which Laravel version we're on | owen-it_laravel-auditing | train | php |
8b8f2d96ea0fc0b2b5a25e41faa75205e993892c | diff --git a/lib/chef/provider/package/yum.rb b/lib/chef/provider/package/yum.rb
index <HASH>..<HASH> 100644
--- a/lib/chef/provider/package/yum.rb
+++ b/lib/chef/provider/package/yum.rb
@@ -18,7 +18,6 @@
require 'chef/config'
require 'chef/provider/package'
-require 'chef/mixin/command' # handle_command_failures
require 'chef/mixin/shell_out'
require 'chef/resource/package'
require 'singleton' | Remove unused require in yum package provider | chef_chef | train | rb |
d11e83df9617c7f4448a1dea7f94cbca78339fec | diff --git a/guacamole/src/main/java/org/glyptodon/guacamole/net/basic/TunnelRequestService.java b/guacamole/src/main/java/org/glyptodon/guacamole/net/basic/TunnelRequestService.java
index <HASH>..<HASH> 100644
--- a/guacamole/src/main/java/org/glyptodon/guacamole/net/basic/TunnelRequestService.java
+++ b/guacamole/src/main/java/org/glyptodon/guacamole/net/basic/TunnelRequestService.java
@@ -54,6 +54,7 @@ import org.slf4j.LoggerFactory;
* that use purely the Guacamole API.
*
* @author Michael Jumper
+ * @author Vasily Loginov
*/
@Singleton
public class TunnelRequestService { | GUAC-<I>: Add Vasily Loginov as author. | glyptodon_guacamole-client | train | java |
8d91c4e7eb39ca2061fd2ff16a39e47b6181d21b | diff --git a/main.py b/main.py
index <HASH>..<HASH> 100755
--- a/main.py
+++ b/main.py
@@ -118,7 +118,9 @@ def makeEPUB(document, xml_local, cache_dir, outdirect, log_to):
toc = tocncx.TocNCX()
toc.takeArticle(document)
toc.write(outdirect)
- opf.generateOPF(document, outdirect)
+ myopf = opf.ContentOPF(outdirect)
+ myopf.takeArticle(document)
+ myopf.write()
utils.epubZip(outdirect)
#WARNING: shutil.rmtree() is a recursive deletion function, care should be | Altered single mode workflow to use ContentOPF class | SavinaRoja_OpenAccess_EPUB | train | py |
f3039dc40e8dfb3fafd53d74071c76dc67ddf741 | diff --git a/src/PopupDialog.js b/src/PopupDialog.js
index <HASH>..<HASH> 100644
--- a/src/PopupDialog.js
+++ b/src/PopupDialog.js
@@ -1,7 +1,6 @@
// flow
import React, {PropTypes, Component} from 'react';
-import {Dimensions} from 'react-native';
import Dialog from './components/Dialog';
import DialogTitle from './components/DialogTitle';
import ScaleAnimation from './animations/ScaleAnimation'; | :rocket: Indentation + removed unused variables | jacklam718_react-native-popup-dialog | train | js |
9726067b1527301144433b965a6fce2f45173784 | diff --git a/src/logger.js b/src/logger.js
index <HASH>..<HASH> 100644
--- a/src/logger.js
+++ b/src/logger.js
@@ -1,9 +1,11 @@
-import {Writable} from 'stream'
-
-// If testing from CLI, use noop logger, to not interfere with the mocha reporter
-// (see issues #1998, #2107, etc. at https://github.com/mochajs/mocha)
if (process.env.MOCHA === '1') {
- global.logger = new console.Console(new Writable)
+ // If testing from CLI, use noop logger, to not interfere with the mocha reporter
+ // (see issues mochajs/mocha#1998, mochajs/mocha#2107, etc.)
+
+ // code only uses these methods, so this should be enough
+ global.logger = {error () {}, warn () {}, info () {}}
} else {
+ // Else make a stderr-only console, so that you can redirect the CLI output to a
+ // file (see issue #73)
global.logger = new console.Console(process.stderr)
} | [log] Don't use stream.Writable
Fix #<I> | citation-js_citation-js | train | js |
bb433e27f020597f3807cb4058d1e45a671cea6e | diff --git a/kafka/future.py b/kafka/future.py
index <HASH>..<HASH> 100644
--- a/kafka/future.py
+++ b/kafka/future.py
@@ -45,7 +45,7 @@ class Future(object):
self.is_done = True
for f in self._errbacks:
try:
- f(e)
+ f(self.exception)
except Exception:
log.exception('Error processing errback')
return self | Call errbacks with future.exception | dpkp_kafka-python | train | py |
6605b11b2ec062a7c1c93d2117fe0a1bf684191d | diff --git a/src/main/java/com/github/ansell/csv/sum/CSVSummariser.java b/src/main/java/com/github/ansell/csv/sum/CSVSummariser.java
index <HASH>..<HASH> 100644
--- a/src/main/java/com/github/ansell/csv/sum/CSVSummariser.java
+++ b/src/main/java/com/github/ansell/csv/sum/CSVSummariser.java
@@ -233,6 +233,11 @@ public final class CSVSummariser {
try (final SequenceWriter csvWriter = CSVUtil.newCSVWriter(output, summarySchema);
final SequenceWriter mappingWriter = CSVUtil.newCSVWriter(mappingOutput, mappingSchema);) {
+ // Need to do this to get the header line written out in this case
+ if(rowCount.get() == 0) {
+ csvWriter.write(Arrays.asList());
+ mappingWriter.write(Arrays.asList());
+ }
headers.forEach(h -> {
final int emptyCount = emptyCounts.get(h).get();
final int nonEmptyCount = nonEmptyCounts.get(h).get(); | Push out csvsum headers even if there are no source rows | ansell_csvsum | train | java |
f6a738d50418b1104a625a860dcfcfce3aa3cd95 | diff --git a/Generator/ContentEntityType.php b/Generator/ContentEntityType.php
index <HASH>..<HASH> 100644
--- a/Generator/ContentEntityType.php
+++ b/Generator/ContentEntityType.php
@@ -45,7 +45,7 @@ class ContentEntityType extends EntityTypeBase {
$base_fields_property = [
'base_fields' => [
'label' => 'Base fields',
- 'description' => "The machine name of the field.",
+ 'description' => "The base fields for this content entity.",
'format' => 'compound',
// TODO: default, populated by things such as interface choice!
'properties' => [ | Fixed description for content entity type base fields. | drupal-code-builder_drupal-code-builder | train | php |
9beedcf6f09a2bc1e7bfc1acf3ae97ad45e00429 | diff --git a/ginga/rv/plugins/Zoom.py b/ginga/rv/plugins/Zoom.py
index <HASH>..<HASH> 100644
--- a/ginga/rv/plugins/Zoom.py
+++ b/ginga/rv/plugins/Zoom.py
@@ -191,8 +191,7 @@ class Zoom(GingaPlugin.GlobalPlugin):
def prepare(self, fitsimage):
fitssettings = fitsimage.get_settings()
zoomsettings = self.zoomimage.get_settings()
- # TODO: should we add our own canvas instead?
- fitsimage.add_callback('motion', self.motion_cb)
+ fitsimage.add_callback('cursor-changed', self.motion_cb)
for name in ['cuts']:
fitssettings.get_setting(name).add_callback(
'set', self.cutset_cb, fitsimage) | Fix for Zoom plugin for following keyboard panning changes
- Previously it was just triggering off of mouse tracking. | ejeschke_ginga | train | py |
6375d719d401588ad9ef4291bbfaada2b463fcca | diff --git a/openquake/calculators/base.py b/openquake/calculators/base.py
index <HASH>..<HASH> 100644
--- a/openquake/calculators/base.py
+++ b/openquake/calculators/base.py
@@ -135,14 +135,12 @@ def parallel_filter(csm, srcfilter, monitor):
seed = int(os.environ.get('OQ_SAMPLE_SOURCES', 0))
logging.info('Filtering sources with %s', srcfilter.__class__.__name__)
trt_sources = csm.get_trt_sources(optimize_same_id=False)
- # use Rtree and the processpool
- dist = 'no' if os.environ.get('OQ_DISTRIBUTE') == 'no' else 'processpool'
if monitor.hdf5:
source_info = monitor.hdf5['source_info']
source_info.attrs['has_dupl_sources'] = csm.has_dupl_sources
srcs_by_grp = collections.defaultdict(list)
smap = parallel.Starmap(
- only_filter, monitor=monitor, distribute=dist, progress=logging.debug)
+ only_filter, monitor=monitor, progress=logging.debug)
for trt, sources in trt_sources:
if hasattr(sources, 'atomic') and sources.atomic:
smap.submit(sources, srcfilter, seed) | Restored prefiltering on the workers with celery
Former-commit-id: 7b<I>f<I>f<I>f<I>ccdc3bb<I>f9d<I>b<I> | gem_oq-engine | train | py |
77b661a9599225721ac416cc342d56d1afb105a1 | diff --git a/setuptools/tests/test_upload.py b/setuptools/tests/test_upload.py
index <HASH>..<HASH> 100644
--- a/setuptools/tests/test_upload.py
+++ b/setuptools/tests/test_upload.py
@@ -3,6 +3,7 @@ import os
import re
from distutils import log
+from distutils.errors import DistutilsError
from distutils.version import StrictVersion
import pytest
@@ -146,3 +147,22 @@ class TestUploadTest:
with pytest.raises(AssertionError):
cmd.run()
+ def test_upload_file_http_error(self, patched_upload):
+ patched_upload.urlopen.side_effect = six.moves.urllib.error.HTTPError(
+ 'https://example.com',
+ 404,
+ 'File not found',
+ None,
+ None
+ )
+
+ cmd = patched_upload.cmd
+ cmd.ensure_finalized()
+
+ with pytest.raises(DistutilsError):
+ cmd.run()
+
+ cmd.announce.assert_any_call(
+ 'Upload failed (404): File not found',
+ log.ERROR)
+ | Add test for HTTPError in upload_file | pypa_setuptools | train | py |
6cfc08070394cefdff3ef77a101f0ab5cdf8a14d | diff --git a/repr.go b/repr.go
index <HASH>..<HASH> 100644
--- a/repr.go
+++ b/repr.go
@@ -102,10 +102,11 @@ func (p *Printer) Print(vs ...interface{}) {
func (p *Printer) Println(vs ...interface{}) {
for i, v := range vs {
if i > 0 {
- fmt.Fprintln(p.w)
+ fmt.Fprint(p.w, " ")
}
p.reprValue(reflect.ValueOf(v), "")
}
+ fmt.Fprintln(p.w)
}
func (p *Printer) reprValue(v reflect.Value, indent string) { | Correctly adhere to Println semantics. | alecthomas_repr | train | go |
7cad36e2eb7e76b7c52a73bfb920d3d584ed4a44 | diff --git a/selendroid-standalone/src/main/java/io/selendroid/android/impl/DefaultAndroidEmulator.java b/selendroid-standalone/src/main/java/io/selendroid/android/impl/DefaultAndroidEmulator.java
index <HASH>..<HASH> 100644
--- a/selendroid-standalone/src/main/java/io/selendroid/android/impl/DefaultAndroidEmulator.java
+++ b/selendroid-standalone/src/main/java/io/selendroid/android/impl/DefaultAndroidEmulator.java
@@ -306,6 +306,15 @@ public class DefaultAndroidEmulator extends AbstractDevice implements AndroidEmu
try {
ShellCommand.exec(command);
+ while (isEmulatorStarted()) {
+ System.err.println("emulator still running, sleeping 0.5 and killing again");
+ try {
+ Thread.sleep(500);
+ } catch(InterruptedException ie) {
+ throw new RuntimeException(ie);
+ }
+ ShellCommand.exec(command);
+ }
} catch (ShellCommandException e) {
throw new AndroidDeviceException(e);
} | retry killing the emulator until it is really dead | selendroid_selendroid | train | java |
1f8d2bcf7f06672f03c5309a0ff20abed51580e6 | diff --git a/lib/format.rb b/lib/format.rb
index <HASH>..<HASH> 100644
--- a/lib/format.rb
+++ b/lib/format.rb
@@ -1,14 +1,7 @@
module WaveFile
class WaveFileFormat
def initialize(channels, bits_per_sample, sample_rate)
- if channels == :mono
- channels = 1
- end
- if channels == :stereo
- channels = 2
- end
-
- @channels = channels
+ self.channels=(channels)
@bits_per_sample = bits_per_sample
@sample_rate = sample_rate
end
@@ -29,6 +22,17 @@ module WaveFile
return (@bits_per_sample / 8) * @channels
end
- attr_accessor :channels, :bits_per_sample, :sample_rate
+ def channels=(new_channels)
+ if new_channels == :mono
+ @channels = 1
+ elsif new_channels == :stereo
+ @channels = 2
+ else
+ @channels = new_channels
+ end
+ end
+
+ attr_reader :channels
+ attr_accessor :bits_per_sample, :sample_rate
end
end | Allowing using :mono and :stereo to specify number of channels in the WaveFileFormat.channels=() setter as well. | jstrait_wavefile | train | rb |
4a6367a54687313508792f09cbeec19f7b608be9 | diff --git a/lib/spreewald/web_steps.rb b/lib/spreewald/web_steps.rb
index <HASH>..<HASH> 100644
--- a/lib/spreewald/web_steps.rb
+++ b/lib/spreewald/web_steps.rb
@@ -517,5 +517,5 @@ Then /^I should see in this order:?$/ do |text|
lines = lines.collect { |line| line.gsub(/\s+/, ' ')}.collect(&:strip).reject(&:blank?)
pattern = lines.collect(&Regexp.method(:quote)).join('.*?')
pattern = Regexp.compile(pattern)
- page.body.gsub(/\s+/, ' ').should =~ pattern
+ page.text.gsub(/\s+/, ' ').should =~ pattern
end
diff --git a/lib/spreewald_support/version.rb b/lib/spreewald_support/version.rb
index <HASH>..<HASH> 100644
--- a/lib/spreewald_support/version.rb
+++ b/lib/spreewald_support/version.rb
@@ -1,5 +1,5 @@
# coding: UTF-8
module Spreewald
- VERSION = "0.3.3"
+ VERSION = "0.3.4"
end | step "I should see in this order:" now tests on the page text, stripping away all HTML tags | makandra_spreewald | train | rb,rb |
79a2c4e4730216dd1bed13ee48aed042cf521f1b | diff --git a/config/environments/production.rb b/config/environments/production.rb
index <HASH>..<HASH> 100644
--- a/config/environments/production.rb
+++ b/config/environments/production.rb
@@ -64,7 +64,7 @@ ScholarSphere::Application.configure do
# config.assets.manifest = YOUR_PATH
# Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
- config.assets.precompile += %w( generic_files.js dashboard.js video.js audio.min.js jquery.zclip.min.js video-js.css generic_files.css jquery-ui-1.8.1.custom.css bootstrap.min.css )
+ config.assets.precompile += %w( generic_files.js dashboard.js video.js audio.min.js jquery.zclip.min.js bootstrap-tooltip.js bootstrap-popover.js video-js.css generic_files.css jquery-ui-1.8.1.custom.css bootstrap.min.css )
config.logout_url = 'https://webaccess.psu.edu/cgi-bin/logout?https://scholarsphere-test.dlt.psu.edu/'
config.login_url = 'https://webaccess.psu.edu?cosign-scholarsphere-test.dlt.psu.edu&https://scholarsphere-test.dlt.psu.edu/' | added javascripts to precompile | samvera_hyrax | train | rb |
de82474531528276d67abc90ca7e7c641673a5cd | diff --git a/asammdf/blocks/v2_v3_blocks.py b/asammdf/blocks/v2_v3_blocks.py
index <HASH>..<HASH> 100644
--- a/asammdf/blocks/v2_v3_blocks.py
+++ b/asammdf/blocks/v2_v3_blocks.py
@@ -2713,7 +2713,7 @@ class TextBlock:
text = kwargs["text"]
try:
- text = text.encode("utf-8")
+ text = text.encode("latin-1")
except (AttributeError, UnicodeDecodeError):
pass
@@ -2721,9 +2721,9 @@ class TextBlock:
self.block_len = len(text) + 5
self.text = text + b'\0'
- if self.block_len > 65535:
- self.block_len = 65535
- self.text = self.text[:65534] + b'\0'
+ if self.block_len > 65000:
+ self.block_len = 65000 + 5
+ self.text = self.text[:65000] + b'\0'
def __getitem__(self, item):
return self.__getattribute__(item) | fix error when creating v3 TXBLOCK from text with length higher than <I> | danielhrisca_asammdf | train | py |
a3d95c634d4aee5b80199e600c2504cb31572dab | diff --git a/app/app_test.go b/app/app_test.go
index <HASH>..<HASH> 100644
--- a/app/app_test.go
+++ b/app/app_test.go
@@ -976,6 +976,17 @@ func (s *S) TestRun(c *C) {
c.Assert(cmds, HasLen, 1)
}
+func (s *S) TestRunWithoutEnv(c *C) {
+ s.provisioner.PrepareOutput([]byte("a lot of files"))
+ app := App{Name: "myapp", State: provision.StatusStarted}
+ var buf bytes.Buffer
+ err := app.run("ls -lh", &buf)
+ c.Assert(err, IsNil)
+ c.Assert(buf.String(), Equals, "a lot of files")
+ cmds := s.provisioner.GetCmds("ls -lh", &app)
+ c.Assert(cmds, HasLen, 1)
+}
+
func (s *S) TestSerializeEnvVars(c *C) {
dir, err := commandmocker.Add("juju", "$*")
c.Assert(err, IsNil) | app: added test for App.run | tsuru_tsuru | train | go |
db4a1aa7e097051cf9489cac7c3a42fed31d77f2 | diff --git a/src/ox_modules/module-mob/commands/clickHidden.js b/src/ox_modules/module-mob/commands/clickHidden.js
index <HASH>..<HASH> 100644
--- a/src/ox_modules/module-mob/commands/clickHidden.js
+++ b/src/ox_modules/module-mob/commands/clickHidden.js
@@ -23,7 +23,12 @@ module.exports = function(locator, clickParent) {
var el = this.helpers.getElement(locator);
// NOTE: adding comments inside the passed function is not allowed!
/*global document*/
- this.driver.execute(function (domEl, clickParent) {
+ var ret = this.driver.execute(function (domEl, clickParent) {
+ // createEvent won't be available won't be available on IE in < 9 compatibility mode
+ if (!document.createEvent) {
+ return false;
+ }
+
var clckEv = document.createEvent('MouseEvent');
clckEv.initEvent('click', true, true);
if (clickParent) {
@@ -31,5 +36,11 @@ module.exports = function(locator, clickParent) {
} else {
domEl.dispatchEvent(clckEv);
}
+
+ return true;
}, el, clickParent);
+
+ if (!ret) {
+ throw new this.OxError(this.errHelper.errorCode.NOT_SUPPORTED, 'clickHidden() is not supported on the current page');
+ }
}; | Throw proper error if mob.clickHidden cannot be executed | oxygenhq_oxygen | train | js |
00d8b111a555fd4fff923257837bb3d0715b2122 | diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -55,6 +55,7 @@ with open(os.path.join(REQUIREMENT_DIR, "docs_requirements.txt")) as f:
setuptools_require = ["setuptools>=38.3.0"]
pytest_runner_require = ["pytest-runner"] if need_pytest() else []
+sqlite_requires = ["SimpleSQLite>=0.33.1"]
setuptools.setup(
name=MODULE_NAME,
@@ -86,11 +87,11 @@ setuptools.setup(
"build": ["wheel"],
"docs": docs_requires,
"excel": ["xlrd>=1.1.0"],
- "gs": ["gspread", "oauth2client", "pyOpenSSL", "SimpleSQLite>=0.33.1"],
+ "gs": ["gspread", "oauth2client", "pyOpenSSL"] + sqlite_requires,
"mediawiki": ["pypandoc"],
"release": ["releasecmd>=0.0.12"],
- "sqlite": ["SimpleSQLite>=0.33.1"],
"test": tests_requires,
+ "sqlite": sqlite_requires,
},
classifiers=[ | Extract a requirement for SQLite functionality | thombashi_pytablereader | train | py |
bbeea431eeb0ab1ef443b9342be8225a567c7a8d | diff --git a/lib/chef/win32/api/installer.rb b/lib/chef/win32/api/installer.rb
index <HASH>..<HASH> 100644
--- a/lib/chef/win32/api/installer.rb
+++ b/lib/chef/win32/api/installer.rb
@@ -158,7 +158,7 @@ UINT MsiCloseHandle(
raise Chef::Exceptions::Package, msg
end
- version
+ version.chomp(0.chr)
end
end
end | windows_package is idempotent again
This was broken in #<I>. The issue is that the package does not get detected
as installed because the version that is installed has \x<I> at the end,
while the version from the msi does not. This fails comparison, and we fall
into code that does not use source and thus requires candidate version and we
die. (Or something like that)
Solves #<I> | chef_chef | train | rb |
9dbbc9c70865b0877075e1c7de09bd9ff2b97436 | diff --git a/test/test_action_controller_request_proxy.rb b/test/test_action_controller_request_proxy.rb
index <HASH>..<HASH> 100644
--- a/test/test_action_controller_request_proxy.rb
+++ b/test/test_action_controller_request_proxy.rb
@@ -15,6 +15,7 @@ class ActionControllerRequestProxyTest < Test::Unit::TestCase
request.env['REQUEST_METHOD'] = 'PUT'
end
+ request.env['REQUEST_URI'] = '/'
request.env['RAW_POST_DATA'] = body_params.to_query
request.env['CONTENT_TYPE'] = 'application/x-www-form-urlencoded' | Provide REQUEST_URI in the request_proxy env, needed for rails <I> | oauth-xx_oauth-ruby | train | rb |
1317eb5c3364c270b3ca5d809fc9a192e820ad65 | diff --git a/salt/grains/core.py b/salt/grains/core.py
index <HASH>..<HASH> 100644
--- a/salt/grains/core.py
+++ b/salt/grains/core.py
@@ -116,7 +116,7 @@ def _linux_cpudata():
#
# Hardware : BCM2708
# Revision : 0002
- # Serial : 00000000XXXXXXXX
+ # Serial : 00000000
elif key == 'Processor':
grains['cpu_model'] = val.split('-')[0]
grains['num_cpus'] = 1 | Lint (incorrectly flags as FIXME) | saltstack_salt | train | py |
40a5ecc6d22a28faa910f905f22c6f07094bc28a | diff --git a/src/Auth0.js b/src/Auth0.js
index <HASH>..<HASH> 100644
--- a/src/Auth0.js
+++ b/src/Auth0.js
@@ -21,6 +21,7 @@ var TicketsManager = require('./management/TicketsManager');
// Authenticators.
var OAuthAuthenticator = require('./auth/OAuthAuthenticator');
var DatabaseAuthenticator = require('./auth/DatabaseAuthenticator');
+var PasswordlessAuthenticator = require('./auth/PasswordlessAuthenticator');
var BASE_URL_FORMAT = 'https://%s/api/v2';
@@ -160,6 +161,13 @@ var Auth0 = function (options) {
* @type {DatabaseAuthenticator}
*/
this.database = new DatabaseAuthenticator(managerOptions, this.oauth);
+
+ /**
+ * Passwordless authenticator.
+ *
+ * @type {PasswordlessAuthenticator}
+ */
+ this.passwordless = new PasswordlessAuthenticator(managerOptions, this.oauth);
}; | Add bindings for PasswordlessAuthenticator | auth0_node-auth0 | train | js |
c894c611bff823c5023c3694359d6dad50277d5f | diff --git a/lib/tkellem/plugins/backlog.rb b/lib/tkellem/plugins/backlog.rb
index <HASH>..<HASH> 100644
--- a/lib/tkellem/plugins/backlog.rb
+++ b/lib/tkellem/plugins/backlog.rb
@@ -57,6 +57,7 @@ class Backlog
# open stream in append-only mode
return @streams[ctx] if @streams[ctx]
stream = @streams[ctx] = File.open(stream_filename(ctx), 'ab')
+ stream.seek(0, IO::SEEK_END)
@starting_pos[ctx] = stream.pos
stream
end | seek to the end of backlog after opening, before reading position | codekitchen_tkellem | train | rb |
7582a29c40c1f7041b8caf2da9754bf20d63c580 | diff --git a/modules/social_features/social_content_block/src/Plugin/ContentBlock/TopicContentBlock.php b/modules/social_features/social_content_block/src/Plugin/ContentBlock/TopicContentBlock.php
index <HASH>..<HASH> 100644
--- a/modules/social_features/social_content_block/src/Plugin/ContentBlock/TopicContentBlock.php
+++ b/modules/social_features/social_content_block/src/Plugin/ContentBlock/TopicContentBlock.php
@@ -36,6 +36,7 @@ class TopicContentBlock extends ContentBlockBase {
// Add group tags.
case 'field_group':
$query->innerJoin('group_content_field_data', 'gd', 'gd.entity_id = base_table.nid');
+ $query->condition('gd.type', '%' . $query->escapeLike('-group_node-topic'), 'LIKE');
$query->condition('gd.gid', $entity_ids, 'IN');
break; | Issue #<I> by chmez: Add checking group content type | goalgorilla_open_social | train | php |
a8f2e560e28f928212acdc1691892dd103c369f6 | diff --git a/ssbio/databases/pdb.py b/ssbio/databases/pdb.py
index <HASH>..<HASH> 100644
--- a/ssbio/databases/pdb.py
+++ b/ssbio/databases/pdb.py
@@ -15,6 +15,7 @@ import requests
import deprecation
from Bio.PDB import PDBList
from lxml import etree
+from six.moves.urllib_error import URLError
from six.moves.urllib.request import urlopen, urlretrieve
import ssbio.databases.pisa as pisa
@@ -66,6 +67,7 @@ class PDBProp(StructProp):
structure_file = p.retrieve_pdb_file(pdb_code=self.id, pdir=outdir, file_format=file_type, overwrite=force_rerun)
if not op.exists(structure_file):
log.debug('{}: {} file not available'.format(self.id, file_type))
+ raise URLError('{}.{}: file not available to download'.format(self.id, file_type))
else:
log.debug('{}: {} file saved'.format(self.id, file_type))
self.load_structure_path(structure_file, file_type) | Raise error when PDB file cannot be downloaded | SBRG_ssbio | train | py |
1ea05e52289e70a0b7f6fff60f5199be40fba6b6 | diff --git a/OpenPNM/Base/__Core__.py b/OpenPNM/Base/__Core__.py
index <HASH>..<HASH> 100644
--- a/OpenPNM/Base/__Core__.py
+++ b/OpenPNM/Base/__Core__.py
@@ -194,7 +194,7 @@ class Core(Base):
'''
#Check no duplicate or invalid locations
- locs = sp.unique(new_order.values())
+ locs = sp.unique(new_order.values())[0]
if len(locs) < len(new_order.values()):
raise Exception('Duplicates found in the order')
@@ -1095,7 +1095,7 @@ class Core(Base):
if prop_found == False:
raise KeyError(prop)
-
+
return temp
def num_pores(self,labels='all',mode='union'): | Fixed a strange bug in reorder_models. I upgraded to numpy <I>, and now unique is now returning a tuple that must be indexed (like shape)...I don't think it was doing this before or else this bug would have appeared. | PMEAL_OpenPNM | train | py |
b10f827813625c0e97a3b287e03098c7c7630ac6 | diff --git a/pyoko/manage.py b/pyoko/manage.py
index <HASH>..<HASH> 100644
--- a/pyoko/manage.py
+++ b/pyoko/manage.py
@@ -230,7 +230,7 @@ class DumpData(Command):
if PY2:
out = bucket.name + "/|" + obj.key + "/|" + obj.data
if to_file:
- outfile.write(out)
+ outfile.write(out+"\n")
else:
print(out)
else:
diff --git a/tests/test_model_db_queries.py b/tests/test_model_db_queries.py
index <HASH>..<HASH> 100644
--- a/tests/test_model_db_queries.py
+++ b/tests/test_model_db_queries.py
@@ -63,7 +63,7 @@ class TestCase:
def test_get_multiple_objects_exception(self):
self.prepare_testbed()
s2 = Student(name='Foo').save()
- sleep(1)
+ sleep(2)
with pytest.raises(MultipleObjectsReturned):
Student.objects.get() | fixed CSV output of dumpdata for python2 | zetaops_pyoko | train | py,py |
dfc81aeff8f9d064d9d23db5abca2b34881d015a | diff --git a/src/basis.js b/src/basis.js
index <HASH>..<HASH> 100644
--- a/src/basis.js
+++ b/src/basis.js
@@ -293,26 +293,26 @@
var foo = parts[0];
var bar = parts[1];
var baz = parts[2];
- var result;
+ var fn;
switch (parts.length)
{
case 1:
- result = function(object){
+ fn = function(object){
return object != null ? object[foo] : object;
};
break;
case 2:
- result = function(object){
+ fn = function(object){
return object != null ? object[foo][bar] : object;
};
break;
case 3:
- result = function(object){
+ fn = function(object){
return object != null ? object[foo][bar][baz] : object;
};
break;
default:
- result = function(object){
+ fn = function(object){
if (object != null)
{
object = object[foo][bar][baz];
@@ -324,7 +324,8 @@
}
}
- ;;;result.toString = function(){ return 'function(object){\n return object ? object.' + path + ' : object;\n}'; }
+ ;;;fn.toString = function(){ return 'function(object){\n return object ? object.' + path + ' : object;\n}'; }
+ return fn;
}
return new Function('object', 'return object != null ? object.' + path + ' : object'); | fix basis.getter didn't return a closure for simple paths | basisjs_basisjs | train | js |
d9256fab648a47d2a94959a936ff858f4f574c03 | diff --git a/cleancat/base.py b/cleancat/base.py
index <HASH>..<HASH> 100644
--- a/cleancat/base.py
+++ b/cleancat/base.py
@@ -465,7 +465,8 @@ class MongoReference(Field):
raise ValidationError('Object does not exist.')
def serialize(self, value):
- return value.pk
+ if value:
+ return value.pk
class Schema(object):
""" | Fix MongoReference serialization for None values (#<I>) | closeio_cleancat | train | py |
6f0c7b6ce586f13fc3747e05c397311188bc51fa | diff --git a/file_reader.go b/file_reader.go
index <HASH>..<HASH> 100644
--- a/file_reader.go
+++ b/file_reader.go
@@ -155,6 +155,10 @@ func (f *FileReader) Read(b []byte) (int, error) {
return 0, io.EOF
}
+ if len(b) == 0 {
+ return 0, nil
+ }
+
if f.blocks == nil {
err := f.getBlocks()
if err != nil {
diff --git a/file_reader_test.go b/file_reader_test.go
index <HASH>..<HASH> 100644
--- a/file_reader_test.go
+++ b/file_reader_test.go
@@ -101,6 +101,17 @@ func TestFileBigReadN(t *testing.T) {
assert.EqualValues(t, n, 1000000)
}
+func TestFileReadNil(t *testing.T) {
+ client := getClient(t)
+
+ file, err := client.Open("/_test/mobydick.txt")
+ require.NoError(t, err)
+
+ n, err := file.Read(nil)
+ assert.NoError(t, err)
+ assert.EqualValues(t, n, 0)
+}
+
func TestFileReadAt(t *testing.T) {
client := getClient(t) | Reads on nil buffers | colinmarc_hdfs | train | go,go |
7db925dfccdc934fc5242b0a0c13f28a2c75388b | diff --git a/django_rq/tests/tests.py b/django_rq/tests/tests.py
index <HASH>..<HASH> 100644
--- a/django_rq/tests/tests.py
+++ b/django_rq/tests/tests.py
@@ -15,7 +15,7 @@ from django_rq.workers import get_worker
try:
from rq_scheduler import Scheduler
- from .queues import get_scheduler
+ from ..queues import get_scheduler
RQ_SCHEDULER_INSTALLED = True
except ImportError:
RQ_SCHEDULER_INSTALLED = False | Fixed an import error that causes scheduler tests to not run. | rq_django-rq | train | py |
1ca73fcb6185a3a784195aef69a3c71bdfb5b433 | diff --git a/lib/fog/aws/glacier.rb b/lib/fog/aws/glacier.rb
index <HASH>..<HASH> 100644
--- a/lib/fog/aws/glacier.rb
+++ b/lib/fog/aws/glacier.rb
@@ -161,7 +161,7 @@ module Fog
params[:headers]['Authorization'] = @signer.sign params, date
response = @connection.request(params, &block)
- if response.headers['Content-Type'] == 'application/json'
+ if response.headers['Content-Type'] == 'application/json' && response.body.size > 0 #body will be empty if the streaming form has been used
response.body = Fog::JSON.decode(response.body)
end
response | [AWS|Glacier] Don't try to deserialize json when body is empty | fog_fog | train | rb |
4e005ccb86bc38922226c268e0fa4c7d8a1d0a69 | diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -53,7 +53,6 @@ setup(
],
install_requires=[
'Django >= 2.1,<3.1',
- 'psycopg2',
],
zip_safe=False,
) | Removed psycopg2 as a requirement | tomturner_django-tenants | train | py |
c8384c1aa8133d02539ec357d4e5a684d465fe44 | diff --git a/src/org/opencms/ui/dataview/CmsPagingControls.java b/src/org/opencms/ui/dataview/CmsPagingControls.java
index <HASH>..<HASH> 100644
--- a/src/org/opencms/ui/dataview/CmsPagingControls.java
+++ b/src/org/opencms/ui/dataview/CmsPagingControls.java
@@ -99,6 +99,7 @@ public class CmsPagingControls extends HorizontalLayout {
* Creates a new instance.<p>
*/
public CmsPagingControls() {
+ setMargin(true);
addComponent(m_label);
addComponent(m_fastBack);
addComponent(m_back); | Improved layout of paging controls in dataview widget. | alkacon_opencms-core | train | java |
64697fd49cf3c54e0d9e873b3a181ae709f3d19d | diff --git a/Kwc/Shop/Cart/Checkout/Payment/Wirecard/ConfirmLink/Controller.php b/Kwc/Shop/Cart/Checkout/Payment/Wirecard/ConfirmLink/Controller.php
index <HASH>..<HASH> 100644
--- a/Kwc/Shop/Cart/Checkout/Payment/Wirecard/ConfirmLink/Controller.php
+++ b/Kwc/Shop/Cart/Checkout/Payment/Wirecard/ConfirmLink/Controller.php
@@ -14,7 +14,7 @@ class Kwc_Shop_Cart_Checkout_Payment_Wirecard_ConfirmLink_Controller extends Zen
$order->payment_component_id = $component->componentId;
$order->checkout_component_id = $component->parent->componentId;
$order->cart_component_class = $component->parent->parent->componentClass;
- $order->status = 'ordered';
+ $order->status = 'processing';
$order->date = date('Y-m-d H:i:s');
$order->save();
$session = new Kwf_Session_Namespace('kwcShopCart'); | set status for onClick confirmLink in wirecard payment to processing | koala-framework_koala-framework | train | php |
327c700aab1c9bf336e1b07767d3cbab29968a7a | diff --git a/sigma-src/webpack.config.sigma.js b/sigma-src/webpack.config.sigma.js
index <HASH>..<HASH> 100644
--- a/sigma-src/webpack.config.sigma.js
+++ b/sigma-src/webpack.config.sigma.js
@@ -32,7 +32,7 @@ module.exports = {
output: {
path: sigmaDistRoot,
- filename: options.optimizeMinimize ? '[name].min.js' : '[name].js',
+ filename: '[name].js',
library: 'Sigma',
libraryTarget: 'umd',
}, | fixed sigma files build, removed unnecessary min | dunnock_react-sigma | train | js |
69d8ab8ddfcaf67a35a3cc0f8738a5b0d47e3689 | diff --git a/parsimonious/nodes.py b/parsimonious/nodes.py
index <HASH>..<HASH> 100644
--- a/parsimonious/nodes.py
+++ b/parsimonious/nodes.py
@@ -222,7 +222,7 @@ class NodeVisitor(object, metaclass=RuleDecoratorMeta):
# Catch any exception, and tack on a parse tree so it's easier to
# see where it went wrong.
exc_class = type(exc)
- raise VisitationError(exc, exc_class, node)
+ raise VisitationError(exc, exc_class, node) from exc
def generic_visit(self, node, visited_children):
"""Default visitor method | Use raise from to improve exception messages. | erikrose_parsimonious | train | py |
6e7f06ad18e19ac9a8286d780b22c03755b43ca5 | 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
@@ -1,7 +1,9 @@
-require 'simplecov'
-SimpleCov.start do
- add_group 'Airbrake API', 'lib/airbrake-api'
- add_group 'Specs', 'spec'
+unless ENV['CI']
+ require 'simplecov'
+ SimpleCov.start do
+ add_group 'Airbrake API', 'lib/airbrake-api'
+ add_group 'Specs', 'spec'
+ end
end
require 'rspec' | don't run code coverage in CI | stve_airbrake-api | train | rb |
1549075a57c453bbb3c5e3ae87390e326f4f35a7 | diff --git a/h5p.classes.php b/h5p.classes.php
index <HASH>..<HASH> 100644
--- a/h5p.classes.php
+++ b/h5p.classes.php
@@ -116,8 +116,6 @@ interface H5PFrameworkInterface {
*
* @param object $libraryData
* Object holding the information that is to be stored
- *
- * @todo Describe object structure and members so new implementors know what to look for
*/
public function saveLibraryData(&$libraryData, $new = TRUE);
@@ -1526,7 +1524,11 @@ class H5PContentValidator {
$this->semanticsCache[$value->library] = $librarySemantics;
}
$this->validateBySemantics($value->params, $librarySemantics);
- $this->filterParams($value, array('library', 'params'));
+ $validkeys = array('library', 'params');
+ if (isset($semantics->extraAttributes)) {
+ $validkeys = array_merge($validkeys, $semantics->extraAttributes);
+ }
+ $this->filterParams($value, $validkeys);
}
else {
$this->h5pF->setErrorMessage($this->h5pF->t('Library used in content is not a valid library according to semantics')); | From ICC, allow extra params | h5p_h5p-php-library | train | php |
452c51a67b3b44f101cbb2c172840aefe637d742 | diff --git a/cli/api/instance.go b/cli/api/instance.go
index <HASH>..<HASH> 100644
--- a/cli/api/instance.go
+++ b/cli/api/instance.go
@@ -84,8 +84,7 @@ func (a *api) AttachServiceInstance(serviceID string, instanceID int, command st
cmd := []string{
"/usr/bin/ssh",
"-t", targetIP, "--",
- "serviced", "--endpoint", GetOptionsRPCEndpoint(),
- "service", "attach", fmt.Sprintf("%s", targetContainer),
+ "docker", "exec", "-it", fmt.Sprintf("%s", targetContainer),
}
cmd = append(cmd, command)
cmd = append(cmd, args...) | call docker exec directly when attaching to a remote container | control-center_serviced | train | go |
f72c21a37767d2beec677eb97f14a1586b7568b2 | diff --git a/core/Session.php b/core/Session.php
index <HASH>..<HASH> 100644
--- a/core/Session.php
+++ b/core/Session.php
@@ -78,6 +78,7 @@ class Piwik_Session extends Zend_Session
try {
Zend_Session::start();
+ register_shutdown_function(array('Zend_Session', 'writeClose'), true);
} catch(Exception $e) {
Piwik::log('Unable to start session: ' . $e->getMessage());
Piwik_ExitWithMessage(Piwik_Translate('General_ExceptionUnableToStartSession')); | fixes #<I> - still can't reproduce (tested with/without Suhosin, across multiple PHP versions); calling Zend_Session::writeClose() multiple times is handled by Zend/Session.php
git-svn-id: <URL> | matomo-org_matomo | train | php |
65863060862fab02c5c5b65f1f566a2f0e4a1ae1 | diff --git a/src/server/pfs/server/server_test.go b/src/server/pfs/server/server_test.go
index <HASH>..<HASH> 100644
--- a/src/server/pfs/server/server_test.go
+++ b/src/server/pfs/server/server_test.go
@@ -114,6 +114,23 @@ func TestInvalidRepoRF(t *testing.T) {
require.YesError(t, client.CreateRepo("lenny#"))
}
+func TestCreateRepoNonexistantProvenance(t *testing.T) {
+ // This method of calling CreateRepo
+ // is used within pps CreateJob()
+
+ client, _ := getClientAndServer(t)
+ var provenance []*pfsclient.Repo
+ provenance = append(provenance, pclient.NewRepo("bogusABC"))
+ _, err := client.PfsAPIClient.CreateRepo(
+ context.Background(),
+ &pfsclient.CreateRepoRequest{
+ Repo: pclient.NewRepo("foo"),
+ Provenance: provenance,
+ },
+ )
+ require.YesError(t, err)
+}
+
func TestSimpleRF(t *testing.T) {
t.Parallel()
client, server := getClientAndServer(t) | Add failing test for Creating a repo w nonexistant provenance | pachyderm_pachyderm | train | go |
cd5d99bb61fd4877d147bc6804b10c65ba0b5c6d | diff --git a/openquake/engine/calculators/risk/hazard_getters.py b/openquake/engine/calculators/risk/hazard_getters.py
index <HASH>..<HASH> 100644
--- a/openquake/engine/calculators/risk/hazard_getters.py
+++ b/openquake/engine/calculators/risk/hazard_getters.py
@@ -115,7 +115,9 @@ class HazardGetter(object):
def __call__(self, monitor=None):
for hazard in self.hazard_outputs:
h = hazard.output_container
- yield (hazard.id,) + self.get_assets_data(h, monitor)
+ assets, data = self.get_assets_data(h, monitor)
+ if len(assets) > 0:
+ yield hazard.id, assets, data
def weights(self):
ws = []
@@ -215,7 +217,9 @@ class GroundMotionValuesGetter(HazardGetter):
for hazard, seed in zip(self.hazard_outputs, self.seeds):
h = hazard.output_container
numpy.random.seed(seed)
- yield (hazard.id,) + self.get_assets_data(h, monitor)
+ assets, data = self.get_assets_data(h, monitor)
+ if len(assets) > 0:
+ yield hazard.id, assets, data
def assets_gen(self, hazard_output):
""" | Fixed a bug when there are no GMVs close to the given assets
Former-commit-id: c<I>e<I>dfa1cf<I>a<I>d4be<I>acd<I>ca<I>b5 | gem_oq-engine | train | py |
05a48b7724a53bb40f1299db0b6eef952e140005 | diff --git a/fileobserver-impl/src/main/java/ch/sourcepond/io/fileobserver/impl/fs/PathProcessingQueues.java b/fileobserver-impl/src/main/java/ch/sourcepond/io/fileobserver/impl/fs/PathProcessingQueues.java
index <HASH>..<HASH> 100644
--- a/fileobserver-impl/src/main/java/ch/sourcepond/io/fileobserver/impl/fs/PathProcessingQueues.java
+++ b/fileobserver-impl/src/main/java/ch/sourcepond/io/fileobserver/impl/fs/PathProcessingQueues.java
@@ -48,9 +48,9 @@ public class PathProcessingQueues {
latestEvent = isReCreate(pKind) ? ENTRY_MODIFY : pKind;
if (taskQueue.isEmpty()) {
- handler.process(pKind, path, this);
+ handler.process(latestEvent, path, this);
} else {
- taskQueue.offer(() -> handler.process(pKind, path, this));
+ taskQueue.offer(() -> handler.process(latestEvent, path, this));
}
} | Pass latestEvent instead of pKind for further processing | SourcePond_fileobserver | train | java |
244b20e65fcf390a626fa03e7ea8a011e40430ed | diff --git a/src/core/display/Transform.js b/src/core/display/Transform.js
index <HASH>..<HASH> 100644
--- a/src/core/display/Transform.js
+++ b/src/core/display/Transform.js
@@ -96,8 +96,6 @@ export default class Transform extends TransformBase
*/
updateTransform(parentTransform)
{
- const pt = parentTransform.worldTransform;
- const wt = this.worldTransform;
const lt = this.localTransform;
lt.a = this._cx * this.scale.x;
@@ -109,6 +107,9 @@ export default class Transform extends TransformBase
lt.ty = this.position.y - ((this.pivot.x * lt.b) + (this.pivot.y * lt.d));
// concat the parent matrix with the objects transform.
+ const pt = parentTransform.worldTransform;
+ const wt = this.worldTransform;
+
wt.a = (lt.a * pt.a) + (lt.b * pt.c);
wt.b = (lt.a * pt.b) + (lt.b * pt.d);
wt.c = (lt.c * pt.a) + (lt.d * pt.c); | Change the lines order in updateTransform. (#<I>)
Change the lines order in updateTransform for unified style
see
<URL> | pixijs_pixi.js | train | js |
d45b46f3c6582123a90adea1bf4c71fc5324a2ee | diff --git a/filehub.py b/filehub.py
index <HASH>..<HASH> 100644
--- a/filehub.py
+++ b/filehub.py
@@ -203,20 +203,18 @@ class RecvResource(http.UrlResource):
yield from resp.send()
total_len = 0
- file_content = yield from entry.reader.read(8192)
- while len(file_content) > 0:
- total_len += len(file_content)
-
- try:
- yield from resp.send_body(file_content)
- except Exception as exc:
- logger('filehub.RecvResource').debug(traceback.format_exc())
- logger('filehub.RecvResource').debug('Transfer failed: %r', exc)
- entry.done.set_exception(exc)
- resp.connection.close()
- return
-
+ try:
file_content = yield from entry.reader.read(8192)
+ while len(file_content) > 0:
+ total_len += len(file_content)
+ yield from resp.send_body(file_content)
+ file_content = yield from entry.reader.read(8192)
+ except Exception as exc:
+ logger('filehub.RecvResource').debug(traceback.format_exc())
+ logger('filehub.RecvResource').debug('Transfer failed: %r', exc)
+ entry.done.set_exception(exc)
+ resp.connection.close()
+ return
logger('filehub.RecvResource').debug(
'entry_idx = %r, transfer completed, ' | Handle exceptions raised by StreamReader.read(...) | l04m33_filehub | train | py |
0e824142b1ae736ff6263ba064abe11d0fd991ab | diff --git a/volume/drivers/aws/aws.go b/volume/drivers/aws/aws.go
index <HASH>..<HASH> 100644
--- a/volume/drivers/aws/aws.go
+++ b/volume/drivers/aws/aws.go
@@ -462,7 +462,7 @@ func (d *Driver) Detach(volumeID string, options map[string]string) error {
} else {
volume.DevicePath = ""
if err := d.UpdateVol(volume); err != nil {
- logrus.Warnf("Failed to update volume", volumeID)
+ logrus.Warnf("Failed to update volume: %s", volumeID)
}
}
return nil | Fix go <I> vet error:
volume/drivers/aws/aws.go:<I>:<I>: Warnf call has arguments but no formatting directives | libopenstorage_openstorage | train | go |
2ba9034e59c76c814606cf75b47df2ea04ee16b5 | diff --git a/src/index.js b/src/index.js
index <HASH>..<HASH> 100644
--- a/src/index.js
+++ b/src/index.js
@@ -21,6 +21,7 @@ export default function sizer({
placeholderStyle = DEFAULT_PLACEHOLDER_STYLE,
widthProp = DEFAULT_WIDTH_PROP,
heightProp = DEFAULT_HEIGHT_PROP,
+ getSizeProps = null,
resizeProps = DEFAULT_RESIZE_PROPS,
updateSizeCallback = DEFAULT_UPDATE_SIZE_CALLBACK,
updateSizeCallbackProp = DEFAULT_UPDATE_SIZE_CALLBACK_PROP,
@@ -108,7 +109,13 @@ export default function sizer({
const props = this.props;
const { width, height } = this.state;
if (WrappedComponent && (width || height)) {
- return createElement(WrappedComponent, {...props, [widthProp]: width, [heightProp]: height, ref: this.setWrappedInstance});
+ if (getSizeProps) {
+ const sizeProps = getSizeProps({ width, height });
+ return createElement(WrappedComponent, {...props, ...sizeProps, ref: this.setWrappedInstance});
+ }
+ else {
+ return createElement(WrappedComponent, {...props, [widthProp]: width, [heightProp]: height, ref: this.setWrappedInstance});
+ }
}
else {
return createElement(Placeholder, {placeholderRef: this.setWrappedInstance}); | Add optional getSizeProps function to the HOC options
if present, this function is called with width and height as arguments
the results of this function are passed to the wrapped component as props
(instead of passing the width & height props) | jharris4_react-sizer | train | js |
c1881f39201e6df19a345efdbba73cee13e62aa3 | diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -13,5 +13,7 @@ setup(name='chumpy',
package_dir = {'chumpy': '.'}
author='Matthew Loper',
author_email='[email protected]'
+ url='https://github.com/mattloper/chumpy',
+ description='chumpy',
) | Update setup.py
Adding more metadata to setup.py | mattloper_chumpy | train | py |
75a18caed4871a68beb5be2c105dd54dee8ada9a | diff --git a/internal/service/ec2/vpc_peering_connection.go b/internal/service/ec2/vpc_peering_connection.go
index <HASH>..<HASH> 100644
--- a/internal/service/ec2/vpc_peering_connection.go
+++ b/internal/service/ec2/vpc_peering_connection.go
@@ -343,7 +343,7 @@ func modifyVPCPeeringConnectionOptions(conn *ec2.EC2, d *schema.ResourceData, vp
// Retry reading back the modified options to deal with eventual consistency.
// Often this is to do with a delay transitioning from pending-acceptance to active.
- err := resource.Retry(VPCPeeringConnectionOptionsPropagationTimeout, func() *resource.RetryError {
+ err := resource.Retry(VPCPeeringConnectionOptionsPropagationTimeout, func() *resource.RetryError { // nosem: helper-schema-resource-Retry-without-TimeoutError-check
vpcPeeringConnection, err := FindVPCPeeringConnectionByID(conn, d.Id())
if err != nil { | Add 'nosem: helper-schema-resource-Retry-without-TimeoutError-check' to VPC Peering eventual consistency check. | terraform-providers_terraform-provider-aws | train | go |
9a78ee3b1a72d10b938d40aa715c2c91027d20f7 | diff --git a/test/unit/node/index.js b/test/unit/node/index.js
index <HASH>..<HASH> 100644
--- a/test/unit/node/index.js
+++ b/test/unit/node/index.js
@@ -29,6 +29,7 @@ const excludeGlob = '**/{browser,electron-sandbox,electron-browser,electron-main
const excludeModules = [
'vs/platform/environment/test/node/nativeModules.test.js', // native modules are compiled against Electron and this test would fail with node.js
'vs/base/parts/storage/test/node/storage.test.js', // same as above, due to direct dependency to sqlite native module
+ 'vs/workbench/contrib/testing/test/**' // flaky
];
/** | unit - skip all tests for `test` component in node | Microsoft_vscode | train | js |
a0efacd72959706d5cfeb23a083a984e46dd825b | diff --git a/kbfsdokan/main.go b/kbfsdokan/main.go
index <HASH>..<HASH> 100644
--- a/kbfsdokan/main.go
+++ b/kbfsdokan/main.go
@@ -21,7 +21,6 @@ import (
var runtimeDir = flag.String("runtime-dir", os.Getenv("KEYBASE_RUNTIME_DIR"), "runtime directory")
var label = flag.String("label", os.Getenv("KEYBASE_LABEL"), "label to help identify if running as a service")
var mountType = flag.String("mount-type", defaultMountType, "mount type: default, force")
-var debug = flag.Bool("debug", false, "Print debug messages")
var version = flag.Bool("version", false, "Print version")
const usageFormatStr = `Usage: | kbfsdokan: fix flag changes with master | keybase_client | train | go |
203ebe0cd77d7493b1809d1833cd923132275316 | diff --git a/biodata-models/src/main/java/org/opencb/biodata/models/variant/clinical/Gwas.java b/biodata-models/src/main/java/org/opencb/biodata/models/variant/clinical/Gwas.java
index <HASH>..<HASH> 100644
--- a/biodata-models/src/main/java/org/opencb/biodata/models/variant/clinical/Gwas.java
+++ b/biodata-models/src/main/java/org/opencb/biodata/models/variant/clinical/Gwas.java
@@ -311,7 +311,7 @@ public class Gwas {
return this.studies;
}
- public class GwasStudy {
+ public static class GwasStudy {
private String pubmedId;
private String firstAuthor;
private String date;
@@ -431,7 +431,7 @@ public class Gwas {
return equals;
}
- public class GwasTrait {
+ public static class GwasTrait {
private String diseaseTrait;
private String dateAddedToCatalog;
private List<GwasTest> tests;
@@ -482,7 +482,7 @@ public class Gwas {
return equals;
}
- public class GwasTest {
+ public static class GwasTest {
private Float pValue;
private Float pValueMlog;
private String pValueText; | Gwas inner classes made static, to allow them be mocked | opencb_biodata | train | java |
82257420412716ffaec980f6cf4258a44374b242 | diff --git a/audioread/ffdec.py b/audioread/ffdec.py
index <HASH>..<HASH> 100644
--- a/audioread/ffdec.py
+++ b/audioread/ffdec.py
@@ -270,6 +270,9 @@ class FFmpegAudioFile(object):
self.proc.kill()
self.proc.wait()
+ self.stderr_reader.join()
+ self.stdout_reader.join()
+
# Close the stdout and stderr streams that were opened by Popen,
# which should occur regardless of if the process terminated
# cleanly. | ffdec: Ensure that QueueReaderThreads have stopped before closing pipes
This is a follow up from 8d<I>f7b5f1fb2c<I>f<I>c8f<I>ccfc7cf<I>b
The previous fix was enough to stop my test case from crashing, but when
running `beet import` the problem would still occur. | beetbox_audioread | train | py |
007dbc60b43558d8ef33a6a9b17074643bef08e0 | diff --git a/gandi/cli/core/cli.py b/gandi/cli/core/cli.py
index <HASH>..<HASH> 100644
--- a/gandi/cli/core/cli.py
+++ b/gandi/cli/core/cli.py
@@ -149,7 +149,9 @@ class GandiCLI(click.Group):
}
if 'GANDICLI_PATH' in os.environ:
- for path in os.environ.get('GANDICLI_PATH').split(':'):
+ for _path in os.environ.get('GANDICLI_PATH').split(':'):
+ # remove trailing separator if any
+ path = _path.rstrip(os.sep)
command_dirs[os.path.basename(path)] = os.path.join(path,
'commands') | Remove trailing slash if present when processing GANDICLI_PATH paths | Gandi_gandi.cli | train | py |
8229c9dc6cb146a1765b3f25b91876c100e02a42 | diff --git a/Imap.php b/Imap.php
index <HASH>..<HASH> 100644
--- a/Imap.php
+++ b/Imap.php
@@ -370,9 +370,16 @@ class Imap {
*
* @return bool success or not
* @param $name of the folder
+ * @param $subscribe immediately subscribe to folder
*/
- public function addFolder($name) {
- return imap_createmailbox($this->imap , $this->mailbox . $name);
+ public function addFolder($name, $subscribe = false) {
+ $success = imap_createmailbox($this->imap, $this->mailbox . $name);
+
+ if ($success && $subscribe) {
+ $success = imap_subscribe($this->imap, $this->mailbox . $name);
+ }
+
+ return $success;
} | added option to subscribe when adding a new folder | SSilence_php-imap-client | train | php |
166243896ac5e0c82267f3bd16833f59b5978621 | diff --git a/gwpy/plot/plot.py b/gwpy/plot/plot.py
index <HASH>..<HASH> 100644
--- a/gwpy/plot/plot.py
+++ b/gwpy/plot/plot.py
@@ -257,7 +257,7 @@ class Plot(figure.Figure):
# -- colour bars ----------------------------
def colorbar(self, mappable=None, cax=None, ax=None, fraction=None,
- emit=True, **kwargs):
+ label=None, emit=True, **kwargs):
"""Add a colorbar to the current `Plot`
A colorbar must be associated with an `Axes` on this `Plot`,
@@ -325,6 +325,8 @@ class Plot(figure.Figure):
# generate colour bar
cbar = super(Plot, self).colorbar(mappable, **kwargs)
self.colorbars.append(cbar)
+ if label: # mpl<1.3 doesn't accept label in Colorbar constructor
+ label.set_label(label)
# update mappables for this axis
if emit: | Plot.colorbar: set label manually
ColorbarBase in mpl<<I> doesn't accept `label` keyword | gwpy_gwpy | train | py |
7efa411e64f2347a8b65ce7fa574c91797caf5dd | diff --git a/lib/honeybadger.rb b/lib/honeybadger.rb
index <HASH>..<HASH> 100644
--- a/lib/honeybadger.rb
+++ b/lib/honeybadger.rb
@@ -17,6 +17,10 @@ require 'honeybadger/integrations'
require 'honeybadger/railtie' if defined?(Rails::Railtie)
+unless defined?(Rails)
+ Honeybadger::Dependency.inject!
+end
+
module Honeybadger
VERSION = '1.11.1'
LOG_PREFIX = "** [Honeybadger] " | Inject dependencies immediately if Rails isn't installed. | honeybadger-io_honeybadger-ruby | train | rb |
d930bfa069678bad4391fb28d56bf12919c04695 | diff --git a/html/components/tooltip.js b/html/components/tooltip.js
index <HASH>..<HASH> 100644
--- a/html/components/tooltip.js
+++ b/html/components/tooltip.js
@@ -22,8 +22,8 @@ const addPositioningClass = (trigger, tooltip) => {
const elemX = trigger.getBoundingClientRect().left;
const elemY = trigger.getBoundingClientRect().top;
- const viewportWidth = window.screen.width;
- const viewportHeight = window.screen.height;
+ const viewportWidth = document.documentElement.clientWidth;
+ const viewportHeight = document.documentElement.clientHeight;
const maxWidth = 328;
const triggerWidth = 16; | revert to using clientWidth | sparkdesignsystem_spark-design-system | train | js |
423d61b6c960ec23ec68529a6b9d9e61eb37e6bd | diff --git a/src/funnies.js b/src/funnies.js
index <HASH>..<HASH> 100644
--- a/src/funnies.js
+++ b/src/funnies.js
@@ -126,5 +126,6 @@ export default [
"We’re going to need a bigger boat.",
"Chuck Norris never git push. The repo pulls before.",
"Web developers do it with <style>",
- "I need to git pull --my-life-together"
+ "I need to git pull --my-life-together",
+ "Java developers never RIP. They just get Garbage Collected."
]; | Adds a new funny quote (#<I>) | 1egoman_funnies | train | js |
bda1c6eca07a43522401b95e02c1e1ca61355258 | diff --git a/core/client/src/main/java/alluxio/client/file/FileOutStream.java b/core/client/src/main/java/alluxio/client/file/FileOutStream.java
index <HASH>..<HASH> 100644
--- a/core/client/src/main/java/alluxio/client/file/FileOutStream.java
+++ b/core/client/src/main/java/alluxio/client/file/FileOutStream.java
@@ -131,7 +131,7 @@ public class FileOutStream extends AbstractOutStream {
}
CompleteFileOptions options = CompleteFileOptions.defaults();
- if (mUnderStorageType.isSyncPersist()) {
+ if (mUnderStorageOutputStream != null) {
mUnderStorageOutputStream.close();
options.setUfsLength(getBytesWritten());
}
@@ -265,7 +265,7 @@ public class FileOutStream extends AbstractOutStream {
private void handleCacheWriteException(IOException e) throws IOException {
LOG.warn("Failed to write into AlluxioStore, canceling write attempt.", e);
- if (!mUnderStorageType.isSyncPersist()) {
+ if (mUnderStorageOutputStream == null) {
throw new IOException(ExceptionMessage.FAILED_CACHE.getMessage(e.getMessage()), e);
} | Check null stream instead of sync persist. | Alluxio_alluxio | train | java |
Subsets and Splits