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
|
---|---|---|---|---|---|
dec44d535a256131ffc6cd01a2c665ce14473078 | diff --git a/src/runner/development-server.js b/src/runner/development-server.js
index <HASH>..<HASH> 100644
--- a/src/runner/development-server.js
+++ b/src/runner/development-server.js
@@ -42,7 +42,7 @@ function setupHMR (saguiOptions) {
function concatHMRBundle (saguiOptions, entry) {
const devClient = [
- require.resolve('webpack-dev-server/client/') + '?http://0.0.0.0:' + saguiOptions.port,
+ require.resolve('webpack-dev-server/client/') + '?/',
'webpack/hot/dev-server'
] | Fixed the bug where exposed port differs from the internal port which sagui is listening on | saguijs_sagui | train | js |
d294c56a6915777bae39e9276a519c1096b5f392 | diff --git a/src/org/jcodings/transcode/TranscodeFunctions.java b/src/org/jcodings/transcode/TranscodeFunctions.java
index <HASH>..<HASH> 100644
--- a/src/org/jcodings/transcode/TranscodeFunctions.java
+++ b/src/org/jcodings/transcode/TranscodeFunctions.java
@@ -120,7 +120,7 @@ public class TranscodeFunctions {
s1 = s[sStart+1] & 0xFF;
s2 = s[sStart+2] & 0xFF;
s3 = s[sStart+3] & 0xFF;
- o[oStart + 1] = (byte)(((s0 & 0x07) << 2) | ((s2 >> 4) & 0x03));
+ o[oStart + 1] = (byte)(((s0 & 0x07) << 2) | ((s1 >> 4) & 0x03));
o[oStart + 2] = (byte)(((s1 & 0x0F) << 4) | ((s2 >> 2) & 0x0F));
o[oStart + 3] = (byte)(((s2 & 0x03) << 6) | (s3 & 0x3F));
} | Fix typo in To_UTF<I>BE transcode function. | jruby_jcodings | train | java |
a5b5db7c07cb1e27fca95b780ee8f75dbcbd5a4e | diff --git a/stats.py b/stats.py
index <HASH>..<HASH> 100644
--- a/stats.py
+++ b/stats.py
@@ -50,7 +50,7 @@ def flattendata(data):
return data
elif isinstance(data,list):
if any(isinstance(d,np.ma.MaskedArray) for d in data):
- return np.ma.concatenate(data)
+ return np.ma.concatenate(data).compressed()
else:
return np.concatenate(data)
else: | added .compressed() to np.ma flattening | mattjj_pyhsmm | train | py |
18a12abbe3d73023888c99045eeff96f24dc4029 | diff --git a/client.go b/client.go
index <HASH>..<HASH> 100644
--- a/client.go
+++ b/client.go
@@ -155,29 +155,18 @@ func (client *HTTPClient) do(
}
func (client *HTTPClient) buildError(
- err *RequestError,
+ error *RequestError,
opts *RequestOptions,
resp *http.Response) error {
- var buf bytes.Buffer
- b := make([]byte, 1024)
- for buf.Len() < maxPartialBody {
- count, err := resp.Body.Read(b[:])
- if count == 0 {
- break
- }
- if err != nil && err != io.EOF {
- break
- }
- _, wErr := buf.Write(b[0:count])
- if err != nil || wErr != nil {
- break
- }
- }
- err.PartialBody = buf.Bytes()
- err.client = client
- err.Resp = resp
- err.Options = opts
- return err
+ b, _ := ioutil.ReadAll(&io.LimitedReader{
+ R: resp.Body,
+ N: maxPartialBody,
+ })
+ error.PartialBody = b
+ error.client = client
+ error.Resp = resp
+ error.Options = opts
+ return error
}
func (client *HTTPClient) formatEndpointUrl(path string, params Params) string { | Use io.LimitedReader to read partial body on errors. | t11e_go-pebbleclient | train | go |
2d69bc55452078f39d6bc1881e5037781889ee8e | diff --git a/features/lib/tasks/create_a_new_cukesalad_project.rb b/features/lib/tasks/create_a_new_cukesalad_project.rb
index <HASH>..<HASH> 100644
--- a/features/lib/tasks/create_a_new_cukesalad_project.rb
+++ b/features/lib/tasks/create_a_new_cukesalad_project.rb
@@ -1,3 +1,3 @@
-in_order_to "CreateANewCukeSaladProject" do
+in_order_to 'create a new cukesalad project' do
create_a_new_cuke_salad_project
end | Housekeeping: Conforming to convention for task definitions | RiverGlide_CukeSalad | train | rb |
b3a6af97d692cc2ba0d3afcc439d103d81091ffe | diff --git a/lib/spidr/page.rb b/lib/spidr/page.rb
index <HASH>..<HASH> 100644
--- a/lib/spidr/page.rb
+++ b/lib/spidr/page.rb
@@ -95,6 +95,14 @@ module Spidr
end
#
+ # Returns +true+ if the page is a plain text document, returns +false+
+ # otherwise.
+ #
+ def plain_text?
+ (content_type =~ /text\/plain/) == 0
+ end
+
+ #
# Returns +true+ if the page is a HTML document, returns +false+
# otherwise.
#
@@ -143,6 +151,30 @@ module Spidr
end
#
+ # Returns +true+ if the page is a MS Word document, returns +false+
+ # otherwise.
+ #
+ def ms_word?
+ (content_type =~ /application\/msword/) == 0
+ end
+
+ #
+ # Returns +true+ if the page is a PDF document, returns +false+
+ # otherwise.
+ #
+ def pdf?
+ (content_type =~ /application\/pdf/) == 0
+ end
+
+ #
+ # Returns +true+ if the page is a ZIP archive, returns +false+
+ # otherwise.
+ #
+ def zip?
+ (content_type =~ /application\/zip/) == 0
+ end
+
+ #
# Returns the body of the page in +String+ form.
#
def body | * Added some more content-type helper methods. | postmodern_spidr | train | rb |
c158c3a9175d494a4d23a7c0ab09cb96272f4ff3 | diff --git a/ui/src/dashboards/containers/DashboardsPage.js b/ui/src/dashboards/containers/DashboardsPage.js
index <HASH>..<HASH> 100644
--- a/ui/src/dashboards/containers/DashboardsPage.js
+++ b/ui/src/dashboards/containers/DashboardsPage.js
@@ -3,6 +3,8 @@ import {Link, withRouter} from 'react-router'
import {connect} from 'react-redux'
import {bindActionCreators} from 'redux'
+import _ from 'lodash'
+
import SourceIndicator from 'shared/components/SourceIndicator'
import DeleteConfirmTableCell from 'shared/components/DeleteConfirmTableCell'
import FancyScrollbar from 'shared/components/FancyScrollbar'
@@ -99,7 +101,9 @@ const DashboardsPage = React.createClass({
</tr>
</thead>
<tbody>
- {dashboards.map(dashboard =>
+ {_.sortBy(dashboards, d =>
+ d.name.toLowerCase()
+ ).map(dashboard =>
<tr key={dashboard.id} className="">
<td style={{width: '40px'}}>{dashboard.id}</td>
<td> | Fix for #<I> - Sort dashboard by name alphabetically | influxdata_influxdb | train | js |
3c8775349c5ecbdbf98e1815b2d65d2955196564 | diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb
index <HASH>..<HASH> 100644
--- a/actionpack/lib/action_dispatch/routing/mapper.rb
+++ b/actionpack/lib/action_dispatch/routing/mapper.rb
@@ -1591,7 +1591,7 @@ module ActionDispatch
if @scope.resources?
with_scope_level(:root) do
- scope(parent_resource.path) do
+ path_scope(parent_resource.path) do
super(options)
end
end | avoid another call to `scope`
calling `scope` isn't cheap, so try to call cheaper methods that do the
same thing for those particular parameters (in this case `path_scope`) | rails_rails | train | rb |
8628885c6223f84f6d9fa93e9cce661335fdce85 | diff --git a/src/Illuminate/Routing/Console/ControllerMakeCommand.php b/src/Illuminate/Routing/Console/ControllerMakeCommand.php
index <HASH>..<HASH> 100755
--- a/src/Illuminate/Routing/Console/ControllerMakeCommand.php
+++ b/src/Illuminate/Routing/Console/ControllerMakeCommand.php
@@ -53,7 +53,7 @@ class ControllerMakeCommand extends GeneratorCommand
$stub = $stub ?? '/stubs/controller.plain.stub';
- return __DIR__ . $stub;
+ return __DIR__.$stub;
}
/** | Updates code style on ControllerMakeCommand | laravel_framework | train | php |
49eb4c50e51a136f0fd095cc9908b2c6a2292a64 | diff --git a/sk_dsp_comm/test/test_fec_conv.py b/sk_dsp_comm/test/test_fec_conv.py
index <HASH>..<HASH> 100644
--- a/sk_dsp_comm/test/test_fec_conv.py
+++ b/sk_dsp_comm/test/test_fec_conv.py
@@ -5,7 +5,8 @@ import numpy as np
from numpy import testing as npt
from sk_dsp_comm import digitalcom as dc
-class TestFecConv(SKDSPCommTest):
+
+class TestFecConv_1_2(SKDSPCommTest):
_multiprocess_can_split_ = True
def test_fec_conv_inst(self): | Refactoring test to deconflict naming for rate 1/3 | mwickert_scikit-dsp-comm | train | py |
c961482d1bc7f303fb5cf41d37e51f095fd4a2d1 | diff --git a/gryadka/src/AcceptorClient.js b/gryadka/src/AcceptorClient.js
index <HASH>..<HASH> 100644
--- a/gryadka/src/AcceptorClient.js
+++ b/gryadka/src/AcceptorClient.js
@@ -4,7 +4,6 @@ const {redisAsyncClient} = require("./utils/redisAsyncClient");
class AcceptorClient {
constructor(settings) {
this.settings = settings;
- this.isTransient = this.settings.isTransient
}
start() {
this.redis = redisAsyncClient(this.settings.storage.port, this.settings.storage.host); | removes isTransient from acceptor | gryadka_js | train | js |
1691251fefc8703ddc25c5e27aa3ad8c89af0677 | diff --git a/engine/src/main/java/org/camunda/bpm/engine/impl/util/ReflectUtil.java b/engine/src/main/java/org/camunda/bpm/engine/impl/util/ReflectUtil.java
index <HASH>..<HASH> 100644
--- a/engine/src/main/java/org/camunda/bpm/engine/impl/util/ReflectUtil.java
+++ b/engine/src/main/java/org/camunda/bpm/engine/impl/util/ReflectUtil.java
@@ -148,7 +148,6 @@ public abstract class ReflectUtil {
*/
public static URI urlToURI(URL url) {
try {
- //return new URI(url.getProtocol(), url.getAuthority(), url.getPath(), url.getQuery(), null);
return new URI(url.getProtocol(), url.getPath(), null);
} catch (URISyntaxException e) {
throw new ProcessEngineException("couldn't convert URL to URI " + url, e); | fix(engine): remove commented line
related to #CAM-<I> | camunda_camunda-bpm-platform | train | java |
02db85361d62a7523e3482372235da7d69b29dae | diff --git a/duolingo.py b/duolingo.py
index <HASH>..<HASH> 100644
--- a/duolingo.py
+++ b/duolingo.py
@@ -190,6 +190,7 @@ class Duolingo(object):
# Start with the first skill and trace the dependency graph through
# skill, setting the order it was learned in.
+ # TODO: detect cycles, and such
index = 0
previous_skill = ''
while True:
@@ -327,8 +328,9 @@ class Duolingo(object):
Return the learned skill objects sorted by the order they were learned
in.
"""
- skills = [skill for skill in
- self.user_data.language_data[lang]['skills']]
+ skills = [
+ skill for skill in self.user_data.language_data[lang]['skills']
+ ]
self._compute_dependency_order(skills)
diff --git a/tests.py b/tests.py
index <HASH>..<HASH> 100644
--- a/tests.py
+++ b/tests.py
@@ -85,5 +85,6 @@ class DuolingoTest(unittest.TestCase):
def test_get_related_words(self):
response = self.lingo.get_related_words('o')
+
if __name__ == '__main__':
unittest.main() | Neatening up some code, and adding a TODO note for later | KartikTalwar_Duolingo | train | py,py |
a8914b73a12583c29bdee333528a55a5b3e5db1f | diff --git a/staging/src/k8s.io/client-go/plugin/pkg/client/auth/oidc/oidc.go b/staging/src/k8s.io/client-go/plugin/pkg/client/auth/oidc/oidc.go
index <HASH>..<HASH> 100644
--- a/staging/src/k8s.io/client-go/plugin/pkg/client/auth/oidc/oidc.go
+++ b/staging/src/k8s.io/client-go/plugin/pkg/client/auth/oidc/oidc.go
@@ -258,7 +258,11 @@ func (p *oidcAuthProvider) idToken() (string, error) {
idToken, ok := token.Extra("id_token").(string)
if !ok {
- return "", fmt.Errorf("token response did not contain an id_token")
+ // id_token isn't a required part of a refresh token response, so some
+ // providers (Okta) don't return this value.
+ //
+ // See https://github.com/kubernetes/kubernetes/issues/36847
+ return "", fmt.Errorf("token response did not contain an id_token, either the scope \"openid\" wasn't requested upon login, or the provider doesn't support id_tokens as part of the refresh response.")
}
// Create a new config to persist. | oidc client auth: better error when refresh response is missing id_token | kubernetes_kubernetes | train | go |
811172da9e61cdf8927dadd0b45fb3e0518c38d0 | diff --git a/controllers/SettingsController.php b/controllers/SettingsController.php
index <HASH>..<HASH> 100644
--- a/controllers/SettingsController.php
+++ b/controllers/SettingsController.php
@@ -44,7 +44,7 @@ class SettingsController extends Controller
$frontendAsset = scandir('../assets', 0);
if ($frontendAsset) {
foreach ($frontendAsset as $folder) {
- if ($folder !== '.' && $folder !== '..' && strlen($folder) === 8) {
+ if ($folder !== '.' && $folder !== '..' && (strlen($folder) === 7 || strlen($folder) === 8)) {
FileHelper::removeDirectory('../assets/' . $folder);
}
}
@@ -53,7 +53,7 @@ class SettingsController extends Controller
$backendAsset = scandir('assets', 0);
if ($backendAsset) {
foreach ($backendAsset as $folder) {
- if ($folder !== '.' && $folder !== '..' && strlen($folder) === 8) {
+ if ($folder !== '.' && $folder !== '..' && (strlen($folder) === 7 || strlen($folder) === 8)) {
FileHelper::removeDirectory('assets/' . $folder);
}
} | Clear assets folder - changes in condition folder length | mrstroz_yii2-wavecms | train | php |
ec13974860b6a7ff489aa0aa0d64028d1b94f4a4 | diff --git a/src/server/transport.js b/src/server/transport.js
index <HASH>..<HASH> 100644
--- a/src/server/transport.js
+++ b/src/server/transport.js
@@ -102,7 +102,7 @@ function _headers(accessToken, options, data) {
}
function _transport(options) {
- return {http: http, https: https}[options.protocol];
+ return {'http:': http, 'https:': https}[options.protocol];
}
function _handleResponse(resp, callback) { | protocol includes the : (server/transport) | rollbar_rollbar.js | train | js |
15fb2f83bbca52c3eef3249e1b2894d10a5dd926 | diff --git a/openquake/baselib/zeromq.py b/openquake/baselib/zeromq.py
index <HASH>..<HASH> 100644
--- a/openquake/baselib/zeromq.py
+++ b/openquake/baselib/zeromq.py
@@ -120,8 +120,7 @@ class Socket(object):
1. the flag .running is set to False
2. the message 'stop' is sent
- 3. SIGINT is sent
- 4. SIGTERM is sent
+ 3. SIGTERM is sent
"""
# works with zmq.REP and zmq.PULL sockets
self.running = True
@@ -134,7 +133,7 @@ class Socket(object):
if self.socket_type == 'PULL':
logging.warn('Timeout in %s', self)
continue
- except (KeyboardInterrupt, zmq.ZMQError):
+ except zmq.ZMQError:
# sending SIGTERM raises ZMQError
break
if args == 'stop': | Fixed CTRL-C in mode celery_zmq | gem_oq-engine | train | py |
d1968429f1be627c3c876fe7fdfa56bf72f22293 | diff --git a/zipline/finance/blotter.py b/zipline/finance/blotter.py
index <HASH>..<HASH> 100644
--- a/zipline/finance/blotter.py
+++ b/zipline/finance/blotter.py
@@ -261,3 +261,7 @@ class Order(object):
return False
return True
+
+ @property
+ def open_amount(self):
+ return self.amount - self.filled | ENH: Add a convenience property for open amount of a blotter.Order
Found that when implementing different slippage model, needed the
open amount in several places/functions, having the open amount
as a property of an order should help reduce the need for passing that
around and maintaining the value separately. | quantopian_zipline | train | py |
2cbeed361d07e988a28892c20d07586ae9286335 | diff --git a/lib/art-decomp.rb b/lib/art-decomp.rb
index <HASH>..<HASH> 100644
--- a/lib/art-decomp.rb
+++ b/lib/art-decomp.rb
@@ -1,3 +1,4 @@
+require 'ostruct'
require 'set'
require 'yaml' | FSM now depends on OpenStruct | chastell_art-decomp | train | rb |
9683eb885bd0d09720d10a9576d92f3f5558d243 | diff --git a/includes/class-freemius.php b/includes/class-freemius.php
index <HASH>..<HASH> 100644
--- a/includes/class-freemius.php
+++ b/includes/class-freemius.php
@@ -4369,10 +4369,12 @@
function setup_account( FS_User $user, FS_Site $site, $redirect = true ) {
$this->_user = $user;
$this->_site = $site;
+
+ $this->_sync_plans();
+
$this->_enrich_site_plan( false );
$this->_set_account( $user, $site );
- $this->_sync_plans();
if ( $this->is_trial() ) {
// Store trial plan information. | [connect] [opt-in] [optimization] On account setup, sync plans before enriching site with plan, because otherwise it syncs the plans twice on first activation. | Freemius_wordpress-sdk | train | php |
0b41ee59132926e90b8064b8ebf8675ddd532dd7 | diff --git a/Mapping/Driver/XmlDriver.php b/Mapping/Driver/XmlDriver.php
index <HASH>..<HASH> 100644
--- a/Mapping/Driver/XmlDriver.php
+++ b/Mapping/Driver/XmlDriver.php
@@ -27,7 +27,7 @@ class XmlDriver extends BaseXmlDriver
protected $classCache;
protected $fileExtension = '.mongodb.xml';
- public function __construct($prefixes)
+ public function __construct($prefixes = array())
{
$this->setNamespacePrefixes($prefixes);
}
diff --git a/Mapping/Driver/YamlDriver.php b/Mapping/Driver/YamlDriver.php
index <HASH>..<HASH> 100644
--- a/Mapping/Driver/YamlDriver.php
+++ b/Mapping/Driver/YamlDriver.php
@@ -27,7 +27,7 @@ class YamlDriver extends BaseYamlDriver
protected $classCache;
protected $fileExtension = '.mongodb.yml';
- public function __construct($prefixes)
+ public function __construct($prefixes = array())
{
$this->setNamespacePrefixes($prefixes);
} | Updated the patch to keep the compatibility with symfony <I> | doctrine_DoctrineMongoDBBundle | train | php,php |
43a47871ddf9d941ee74e54a8be20956013d9f3f | diff --git a/process/context/context.go b/process/context/context.go
index <HASH>..<HASH> 100644
--- a/process/context/context.go
+++ b/process/context/context.go
@@ -12,9 +12,11 @@ import (
)
func init() {
- runner.RegisterComponentFunc("process", func() jujuc.ContextComponent {
- return NewContext()
- })
+ runner.RegisterComponentFunc(process.ComponentName,
+ func() jujuc.ContextComponent {
+ return NewContext()
+ },
+ )
}
// Context is the workload process portion of the hook context. | Use the constant for the component name. | juju_juju | train | go |
e871f2a39103fe5cc73c2a31fd903d1a30c4d136 | diff --git a/lib/chef/mixin/openssl.rb b/lib/chef/mixin/openssl.rb
index <HASH>..<HASH> 100644
--- a/lib/chef/mixin/openssl.rb
+++ b/lib/chef/mixin/openssl.rb
@@ -35,7 +35,7 @@ class Chef
# @param [Integer] number
# @return [Boolean] is length valid
def key_length_valid?(number)
- number >= 1024 && number & (number - 1) == 0
+ number >= 1024 && ( number & (number - 1) == 0 )
end
# validate a dhparam file from path | Improve readability a tiny bit in the mixin
Per the review | chef_chef | train | rb |
12e8848748dee82aa3f588ec576741dcab424970 | diff --git a/holoviews/core/dimension.py b/holoviews/core/dimension.py
index <HASH>..<HASH> 100644
--- a/holoviews/core/dimension.py
+++ b/holoviews/core/dimension.py
@@ -268,7 +268,8 @@ class LabelledData(param.Parameterized):
settings = dict(params, **overrides)
if data is None and shared_data:
data = self.data
- return clone_type(data, *args, **settings)
+ return clone_type(data, *args, **{k:v for k,v in settings.items()
+ if k not in getattr(self, '_pos_params', [])})
def relabel(self, label=None, group=None, depth=0): | Classes with positional parameters can now declare them to clone method | pyviz_holoviews | train | py |
4b48953a0996d08ce67c35ddbc6b91206d258aaf | diff --git a/utool/util_arg.py b/utool/util_arg.py
index <HASH>..<HASH> 100644
--- a/utool/util_arg.py
+++ b/utool/util_arg.py
@@ -9,6 +9,7 @@ print, print_, printDBG, rrr, profile = inject(__name__, '[arg]')
QUIET = '--quiet' in sys.argv
VERBOSE = '--verbose' in sys.argv
+VERYVERBOSE = '--very-verbose' in sys.argv
STRICT = '--nostrict' not in sys.argv | Added very verbose flag | Erotemic_utool | train | py |
7e851d39aa863e65e620c04e9d2c922d125fc4c2 | diff --git a/lib/Library/index.js b/lib/Library/index.js
index <HASH>..<HASH> 100755
--- a/lib/Library/index.js
+++ b/lib/Library/index.js
@@ -59,9 +59,8 @@ Library.prototype.createDependent = function (name) {
Library.prototype.initClient = function () {
var client = this._client;
if (this.unify && this.unify.getValue('type') !== 'app') {
-
var name = this.unify.getValue('name') || this.name;
- var exports = this.unify.getValue('exports') || undefined;
+ var exports = this.unify.getValue('library/exports') || undefined;
var dist = this.unify.getValue('dist') || undefined;
if (dist) {
var expected = path.resolve(path.join('dist', name)); | Grabbing proper exports value. | wsick_fayde-unify | train | js |
fe23765059e9eaf3c60f644371c7ccb7099797c1 | diff --git a/spec/suite/jit/patcher/DummyClassSpec.php b/spec/suite/jit/patcher/DummyClassSpec.php
index <HASH>..<HASH> 100644
--- a/spec/suite/jit/patcher/DummyClassSpec.php
+++ b/spec/suite/jit/patcher/DummyClassSpec.php
@@ -116,4 +116,12 @@ describe("DummyClass", function() {
});
+
+ it("should enables", function() {
+
+ DummyClass::enable();
+ expect(DummyClass::enabled())->toBe(true);
+
+ });
+
}); | Improved code coverage.
Implemented full code coverage on jit\patcher\DummyClass; | kahlan_kahlan | train | php |
9a179f557c28f32974086b3686a1784c2462f903 | diff --git a/TYPO3.Flow/Classes/TYPO3/Flow/Validation/Validator/UniqueEntityValidator.php b/TYPO3.Flow/Classes/TYPO3/Flow/Validation/Validator/UniqueEntityValidator.php
index <HASH>..<HASH> 100644
--- a/TYPO3.Flow/Classes/TYPO3/Flow/Validation/Validator/UniqueEntityValidator.php
+++ b/TYPO3.Flow/Classes/TYPO3/Flow/Validation/Validator/UniqueEntityValidator.php
@@ -13,6 +13,7 @@ namespace TYPO3\Flow\Validation\Validator;
use TYPO3\Flow\Annotations as Flow;
use TYPO3\Flow\Reflection\ObjectAccess;
+use TYPO3\Flow\Utility\TypeHandling;
use TYPO3\Flow\Validation\Exception\InvalidValidationOptionsException;
/**
@@ -56,7 +57,7 @@ class UniqueEntityValidator extends AbstractValidator
throw new InvalidValidationOptionsException('The value supplied for the UniqueEntityValidator must be an object.', 1358454270);
}
- $classSchema = $this->reflectionService->getClassSchema($value);
+ $classSchema = $this->reflectionService->getClassSchema(TypeHandling::getTypeForValue($value));
if ($classSchema === null || $classSchema->getModelType() !== \TYPO3\Flow\Reflection\ClassSchema::MODELTYPE_ENTITY) {
throw new InvalidValidationOptionsException('The object supplied for the UniqueEntityValidator must be an entity.', 1358454284);
} | BUGFIX: Resolve type in UniqueEntityValidator
Run the given validator value through TypeHandling::getTypeForValue()
to make sure doctrine proxies are resolved to the actual domain
model type.
Resolves: NEOS-<I> | neos_flow-development-collection | train | php |
fe0e3880e8ce8311882f3856b689c2f79a13ced4 | diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb
index <HASH>..<HASH> 100644
--- a/actionpack/lib/action_dispatch/routing/mapper.rb
+++ b/actionpack/lib/action_dispatch/routing/mapper.rb
@@ -247,7 +247,9 @@ module ActionDispatch
#
# root :to => 'pages#main'
#
- # You should put the root route at the end of <tt>config/routes.rb</tt>.
+ # You should put the root route at the top of <tt>config/routes.rb</tt>,
+ # because this means it will be matched first. As this is the most popular route
+ # of most Rails applications, this is beneficial.
def root(options = {})
match '/', options.reverse_merge(:as => :root)
end | root route should go at the *top* of the routes file, because it is the most popular route and should be matched first | rails_rails | train | rb |
dcd8fe4050eadd04e4860bc83448e9b472d42a32 | diff --git a/simuvex/s_slicer.py b/simuvex/s_slicer.py
index <HASH>..<HASH> 100644
--- a/simuvex/s_slicer.py
+++ b/simuvex/s_slicer.py
@@ -153,6 +153,10 @@ class SimSlicer(object):
return (op0 + op1) & (2 ** 64 - 1)
+ def _forward_handler_expr_binop_Add32(self, op0, op1, state):
+
+ return (op0 + op1) & (2 ** 32 - 1)
+
#
# Backward slicing
#
@@ -176,7 +180,7 @@ class SimSlicer(object):
if self._inslice_callback:
self._inslice_callback(stmt_idx, stmt, self.inslice_callback_infodict)
- if not regs and not tmps:
+ if not regs and not tmps and not stack_offsets:
break
self.final_regs = state.regs | SimSlicer: support Add<I> | angr_angr | train | py |
5620d2b42dacd729c507cd5aab77d7d3fb536eaf | diff --git a/Responses/Application/Scan/Export/Pdf/QueueResponse.php b/Responses/Application/Scan/Export/Pdf/QueueResponse.php
index <HASH>..<HASH> 100644
--- a/Responses/Application/Scan/Export/Pdf/QueueResponse.php
+++ b/Responses/Application/Scan/Export/Pdf/QueueResponse.php
@@ -3,7 +3,7 @@
namespace RIPS\ConnectorBundle\Responses\Application\Scan\Export\Pdf;
use RIPS\Connector\Entities\Response;
-use RIPS\ConnectorBundle\Entities\Application\Scan\QueueEntity;
+use RIPS\ConnectorBundle\Entities\Application\Scan\Export\Pdf\QueueEntity;
use RIPS\ConnectorBundle\Hydrators\Application\Scan\Export\Pdf\QueueHydrator;
use RIPS\ConnectorBundle\Responses\BaseResponse; | Fix incorrect use in QueueResponse | rips_php-connector-bundle | train | php |
258c71787563ea58cb2c98a48fd8a3e5d7ba5110 | diff --git a/src/commands/apm_cmds/versions.js b/src/commands/apm_cmds/versions.js
index <HASH>..<HASH> 100644
--- a/src/commands/apm_cmds/versions.js
+++ b/src/commands/apm_cmds/versions.js
@@ -14,10 +14,10 @@ exports.handler = async function ({ reporter, module, bump, cwd, network, apm: a
const versions = await APM(web3, apmOptions).getAllVersions(module.appName)
reporter.info(`${module.appName} has ${versions.length} published versions`)
versions.map((version) => {
- if (version === undefined) {
- reporter.error('Version not found in provider')
- } else {
+ if (version && version.content) {
reporter.success(`${version.version}: ${version.contractAddress} ${version.content.provider}:${version.content.location}`)
+ } else {
+ reporter.error('Version not found in provider')
}
})
process.exit() | Handle missing versions
Address PR#<I> comments. | aragon_aragon-cli | train | js |
26d62394a7751bec68f3f27197f055b3aeb549f3 | diff --git a/extending/dropbox/dropbox.php b/extending/dropbox/dropbox.php
index <HASH>..<HASH> 100644
--- a/extending/dropbox/dropbox.php
+++ b/extending/dropbox/dropbox.php
@@ -293,7 +293,8 @@ class rah_backup__dropbox {
}
catch(exception $e) {
- //rah_backup::get()->warning[] = 'Dropbox SDK said: '.$e->getMessage();
+ rah_backup::get()->announce(array('Dropbox SDK said: '.$e->getMessage(), E_ERROR));
+ return false;
}
$this->connected = true; | Display exceptions thrown by dropbox SDK to the user. | gocom_rah_backup | train | php |
87a2fc083d13aa3efa9b97c9091506f6668848d1 | diff --git a/spock/plugins/helpers/physics.py b/spock/plugins/helpers/physics.py
index <HASH>..<HASH> 100644
--- a/spock/plugins/helpers/physics.py
+++ b/spock/plugins/helpers/physics.py
@@ -25,6 +25,7 @@ from spock.vector import Vector3
logger = logging.getLogger('spock')
+FP_MAGIC = 1e-4
class PhysicsCore(object):
def __init__(self, vec, pos, bounding_box):
@@ -106,11 +107,19 @@ class PhysicsPlugin(PluginBase):
current_vector = Vector3()
transform_vectors = []
q = collections.deque()
+ bail = False
while all(transform_vectors) or not q:
+ if not q and bail:
+ logger.warn('Physics has failed to find an MTV, bailing out')
+ self.clear_velocity()
+ return Vector()
current_vector = q.popleft() if q else current_vector
+ if current_vector.dist_sq() > self.vec.dist_sq() + FP_MAGIC:
+ continue
transform_vectors = self.check_collision(pos, current_vector)
for vector in transform_vectors:
q.append(current_vector + vector)
+ bail = True
possible_mtv = [current_vector]
while q:
current_vector = q.popleft() | Fix physics bugs when interacting with corners | SpockBotMC_SpockBot | train | py |
e8cdfcd291c5c6f49ba4f1e980812496f66c53d8 | diff --git a/pwkit/environments/jupyter/__init__.py b/pwkit/environments/jupyter/__init__.py
index <HASH>..<HASH> 100644
--- a/pwkit/environments/jupyter/__init__.py
+++ b/pwkit/environments/jupyter/__init__.py
@@ -149,6 +149,22 @@ the exit code is 1.'''
print ('(no notebook server is currently running)', file=sys.stderr)
sys.exit (1)
+ # Not sure what Jupyter does when it gets SIGTERM, but to be safe let's
+ # shut down everything
+ from requests import request
+ from notebook.utils import url_path_join as ujoin
+
+ def command (verb, *paths):
+ resp = request (verb, ujoin (info['url'], *paths))
+ resp.raise_for_status ()
+ return resp
+
+ for sessinfo in command ('GET', 'api/sessions').json ():
+ command ('DELETE', 'api/sessions', sessinfo['id'])
+
+ for kerninfo in command ('GET', 'api/kernels').json ():
+ command ('DELETE', 'api/kernels', kerninfo['id'])
+
import os, signal
os.kill (info['pid'], signal.SIGTERM) | pwkit/environments/jupyter/__init__.py: some more safety when killing server | pkgw_pwkit | train | py |
a31842aafe8c45646fd3c81732970cbfc53da751 | diff --git a/src/Cart/CartItem.php b/src/Cart/CartItem.php
index <HASH>..<HASH> 100644
--- a/src/Cart/CartItem.php
+++ b/src/Cart/CartItem.php
@@ -109,9 +109,7 @@ class CartItem implements Arrayable, Jsonable
*/
public function price()
{
- $price = $this->priceWithoutConditions();
-
- return optional($this->conditions)->apply($price, $this) ?? $price;
+ return $this->price;
}
/**
@@ -122,21 +120,14 @@ class CartItem implements Arrayable, Jsonable
*/
public function subtotal()
{
- $price = $this->price();
+ $subtotal = $this->subtotalWithoutConditions();
- $optionsSum = $this->options->subtotal();
-
- return $this->qty * ($price + $optionsSum);
- }
-
- public function priceWithoutConditions()
- {
- return $this->price;
+ return optional($this->conditions)->apply($subtotal, $this) ?? $subtotal;
}
public function subtotalWithoutConditions()
{
- $price = $this->priceWithoutConditions();
+ $price = $this->price();
$optionsSum = $this->options->subtotal(); | Apply limitation price on subtotal as well (#<I>)
* Apply limitation price on subtotal as well
* Update where calculation occurs
* Better logic
* Bug fix
* StyleCI
* refactor | tastyigniter_flame | train | php |
fa8e3cf5c603809d0f3b66b4bb1954c13d36f6b8 | diff --git a/src/Ufo/Widgets/WidgetsArrayStorage.php b/src/Ufo/Widgets/WidgetsArrayStorage.php
index <HASH>..<HASH> 100644
--- a/src/Ufo/Widgets/WidgetsArrayStorage.php
+++ b/src/Ufo/Widgets/WidgetsArrayStorage.php
@@ -28,7 +28,7 @@ class WidgetsArrayStorage extends WidgetsStorage
{
if (array_key_exists($section->path, $this->storage)) {
if (array_key_exists('', $this->storage)) {
- return array_merge($this->storage[''], $this->storage[$section->path]);
+ return array_merge_recursive($this->storage[''], $this->storage[$section->path]);
} else {
return $this->storage[$section->path];
} | fix: merging widgets for current and all pages | enikeishik_ufoframework | train | php |
2be6609a54a73f93c3343162267b257c1fdddfb6 | diff --git a/tests/documentation.py b/tests/documentation.py
index <HASH>..<HASH> 100644
--- a/tests/documentation.py
+++ b/tests/documentation.py
@@ -9,6 +9,7 @@
from __future__ import absolute_import, print_function
import os
+import sys
import sphinx
import unittest
@@ -21,12 +22,18 @@ class TestDocumentation(TestCase):
docdir = os.path.join(self.topdir, 'docs')
os.chdir(docdir)
htmldir = self.tempdir
+ # Add a fix for https://bitbucket.org/birkenfeld/sphinx/issue/1611
+ # where sphinx.main() ignores arguments passed to it and instead uses
+ # sys.argv.
+ args = ['sphinx', '-b', 'html', '-nW', '.', htmldir]
+ saved_argv, sys.argv = sys.argv, args
# sphinx.main() changed behavior in version 1.2.3 and it now calls
# exit() with the return code rather than returning it.
try:
ret = sphinx.main(['sphinx', '-b', 'html', '-nW', '.', htmldir])
except SystemExit as e:
ret = e.code
+ sys.argv = saved_argv
self.assertEqual(ret, 0) | docs: workaround for sphinx bug #<I> | geertj_gruvi | train | py |
2263172fc1fffab025e03db3698490ec292e4a59 | diff --git a/demo/www/index.php b/demo/www/index.php
index <HASH>..<HASH> 100644
--- a/demo/www/index.php
+++ b/demo/www/index.php
@@ -1,7 +1,9 @@
<?php
-ini_set('include_path', '.:/so/packages/swat/work-gauthierm:/usr/lib/php');
+$uri_array = explode('/', $_SERVER['REQUEST_URI']);
+$work_dir = $uri_array[3];
+ini_set('include_path', ".:/so/packages/swat/{$work_dir}:/usr/lib/php");
require_once '../include/ExampleApplication.php';
$app = new ExampleApplication('example'); | Make the demo index look in the swat working-dir for the current url instead of
always gauthierm
svn commit r<I> | silverorange_swat | train | php |
4c50ae95157cb6d2c36d13700a4ca1d1dc91b308 | diff --git a/pycbc/workflow/plotting.py b/pycbc/workflow/plotting.py
index <HASH>..<HASH> 100644
--- a/pycbc/workflow/plotting.py
+++ b/pycbc/workflow/plotting.py
@@ -45,6 +45,10 @@ class PlotExecutable(Executable):
""" plot executable
"""
current_retention_level = Executable.FINAL_RESULT
+
+ # plots and final results should get the highest priority
+ # on the job queue
+ self.set_priority(100)
def make_template_plot(workflow, bank_file, out_dir, tags=None):
tags = [] if tags is None else tags | plot jobs set priority <I> | gwastro_pycbc | train | py |
86c753a14931a2cace312a5c55ee139feb5ad012 | diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/ManagementWebSecurityAutoConfigurationTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/ManagementWebSecurityAutoConfigurationTests.java
index <HASH>..<HASH> 100644
--- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/ManagementWebSecurityAutoConfigurationTests.java
+++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/ManagementWebSecurityAutoConfigurationTests.java
@@ -144,7 +144,7 @@ public class ManagementWebSecurityAutoConfigurationTests {
EnvironmentTestUtils.addEnvironment(this.context, "security.ignored:none");
this.context.refresh();
// Just the application and management endpoints now
- assertEquals(2,
+ assertEquals(3,
this.context.getBean(FilterChainProxy.class).getFilterChains().size());
} | Temporary fix the build
(I mean it this thime)
See gh-<I> | spring-projects_spring-boot | train | java |
dcbf43489c86a47ce0ec731c15613f7daf551181 | diff --git a/pre_commit_hooks/trailing_whitespace_fixer.py b/pre_commit_hooks/trailing_whitespace_fixer.py
index <HASH>..<HASH> 100644
--- a/pre_commit_hooks/trailing_whitespace_fixer.py
+++ b/pre_commit_hooks/trailing_whitespace_fixer.py
@@ -94,7 +94,7 @@ def main(argv=None): # type: (Optional[Sequence[str]]) -> int
if _fix_file(
filename,
md,
- None if args.chars is None else bytes(args.chars.encode('utf-8')),
+ None if args.chars is None else args.chars.encode('utf-8'),
):
print('Fixing {}'.format(filename))
return_code = 1 | Apply suggestion: the `bytes(...)` call does nothing here | pre-commit_pre-commit-hooks | train | py |
e65f32154e34c4f528aaee28b1aedc43ae77626f | diff --git a/symphony/lib/toolkit/trait.databasewheredefinition.php b/symphony/lib/toolkit/trait.databasewheredefinition.php
index <HASH>..<HASH> 100644
--- a/symphony/lib/toolkit/trait.databasewheredefinition.php
+++ b/symphony/lib/toolkit/trait.databasewheredefinition.php
@@ -204,7 +204,7 @@ trait DatabaseWhereDefinition
* This method maps all $conditions [$k => $c] pairs on `buildSingleWhereClauseFromArray()`
*
* @param array $conditions
- * @return void
+ * @return string
*/
final public function buildWhereClauseFromArray(array $conditions)
{ | Fix wrong return type
Picked from b9d4b<I>
Picked from 9ecd1a4f<I> | symphonycms_symphony-2 | train | php |
4ef8e6bf1181cf1c2725fe850354b370b0fc8699 | diff --git a/features/support/env.rb b/features/support/env.rb
index <HASH>..<HASH> 100644
--- a/features/support/env.rb
+++ b/features/support/env.rb
@@ -57,8 +57,7 @@ Before do
step 'I cd to "project"'
end
-# Workaround for https://github.com/cucumber/aruba/pull/125
Aruba.configure do |config|
+ # JRuby needs a bit longer to get going
config.exit_timeout = RUBY_ENGINE == "jruby" ? 60 : 20
- config.command_runtime_environment = {"JRUBY_OPTS" => "--dev --debug"}
end | Remove old/outdated JRuby aruba workaround | colszowka_simplecov | train | rb |
7c79583caab9a3175344b486823cd7efdf106f7f | diff --git a/cake/tests/cases/libs/cache/memcache.test.php b/cake/tests/cases/libs/cache/memcache.test.php
index <HASH>..<HASH> 100644
--- a/cake/tests/cases/libs/cache/memcache.test.php
+++ b/cake/tests/cases/libs/cache/memcache.test.php
@@ -194,7 +194,7 @@ class MemcacheEngineTest extends CakeTestCase {
$result = Cache::read('other_test');
$this->assertFalse($result);
- Cache::config('memcache', array('duration' => '+31 day'));
+ Cache::config('memcache', array('duration' => '+30 day'));
$data = 'this is a test of the emergency broadcasting system';
$result = Cache::write('long_expiry_test', $data);
$this->assertTrue($result);
@@ -204,9 +204,6 @@ class MemcacheEngineTest extends CakeTestCase {
$expecting = $data;
$this->assertEqual($result, $expecting);
- $result = Cache::read('long_expiry_test');
- $this->assertTrue($result);
-
Cache::config('memcache', array('duration' => 3600));
} | Updating expiry time to be within tolerances of memcached. | cakephp_cakephp | train | php |
0bda3738a16ecd61e5ad35135f40eb6422b4dfa5 | diff --git a/app.py b/app.py
index <HASH>..<HASH> 100644
--- a/app.py
+++ b/app.py
@@ -18,6 +18,9 @@ from db import db_session, init_db
from models import Participant
from sqlalchemy import or_
+# Importing dashboard
+import dashboard
+
from config import config
@@ -508,6 +511,15 @@ def dashbaord():
"""
Serves dashboard.
"""
+ my_dashboard = dashboard.PsiTurkConfig(filename="config.txt")
+
+ if request.method == 'GET':
+ return jsonify(my_dashboard.get_serialized())
+
+ if request.method == 'POST':
+ config_model = request.json['configModel']
+ my_dashboard.set_serialized(config_model)
+
return render_template('dashboard.html') | Imported dashboard model. Added RESTful interface for backbone model syncing. | NYUCCL_psiTurk | train | py |
599102985de963773a3361006efcb902f2911985 | diff --git a/models/Post.php b/models/Post.php
index <HASH>..<HASH> 100644
--- a/models/Post.php
+++ b/models/Post.php
@@ -387,7 +387,7 @@ class Post extends Model
return $query
->where('id', '<>', $this->id)
- ->whereDate($attribute, $directionOperator, $this->$attribute)
+ ->where($attribute, $directionOperator, $this->$attribute)
->orderBy($attribute, $directionOrder)
;
} | Use where() instead of whereDate() (#<I>)
Fixes #<I>. Also actually makes it so that `[attribute => id]` can be used. | rainlab_blog-plugin | train | php |
4ce3103d3d25df01015afe00a3e6b9e6ea532982 | diff --git a/polyfills/Element/polyfill-ie7.js b/polyfills/Element/polyfill-ie7.js
index <HASH>..<HASH> 100644
--- a/polyfills/Element/polyfill-ie7.js
+++ b/polyfills/Element/polyfill-ie7.js
@@ -45,7 +45,8 @@
elements = document.getElementsByTagName('*'),
nativeCreateElement = document.createElement,
- interval;
+ interval,
+ loopLimit = 100;
prototype.attachEvent('onpropertychange', function (event) {
var
@@ -78,6 +79,7 @@
// Apply Element prototype to the pre-existing DOM as soon as the body element appears.
function bodyCheck(e) {
+ if (!(loopLimit--)) clearTimeout(interval);
if (document.body && !document.body.prototype && /(complete|interactive)/.test(document.readyState)) {
shiv(document, true);
if (interval && document.body.prototype) clearTimeout(interval);
@@ -87,7 +89,7 @@
}
if (!bodyCheck(true)) {
document.onreadystatechange = bodyCheck;
- interval = setInterval(bodyCheck, 1);
+ interval = setInterval(bodyCheck, 25);
}
// Apply to any new elements created after load | Loop more slowly and set a limit, see #<I> | Financial-Times_polyfill-service | train | js |
dbc25aa7715a26d81d6c53a87bae08c3a45685a2 | diff --git a/closure/goog/html/sanitizer/safedomtreeprocessor.js b/closure/goog/html/sanitizer/safedomtreeprocessor.js
index <HASH>..<HASH> 100644
--- a/closure/goog/html/sanitizer/safedomtreeprocessor.js
+++ b/closure/goog/html/sanitizer/safedomtreeprocessor.js
@@ -91,7 +91,7 @@ var SafeDomTreeProcessor = function() {};
* representation of the forest.
* @param {string} html
* @return {string}
- * @public @final
+ * @protected @final
*/
SafeDomTreeProcessor.prototype.processToString = function(html) {
if (!SAFE_PARSING_SUPPORTED) {
@@ -122,7 +122,7 @@ SafeDomTreeProcessor.prototype.processToString = function(html) {
* wrapped in a common SPAN parent, so that the result is always a tree.
* @param {string} html
* @return {!HTMLSpanElement}
- * @public @final
+ * @protected @final
*/
SafeDomTreeProcessor.prototype.processToTree = function(html) {
if (!SAFE_PARSING_SUPPORTED) { | Change the visibility of the processToString and processToTree methods of the SafeDomTreeProcessor to @protected, most subclasses wouldn't want to expose direct access to them, and a @public annotation forces them to.
RELNOTES: n/a
-------------
Created by MOE: <URL> | google_closure-library | train | js |
68cd60b7dfb720e0c2c05cb6c60d996170d30489 | diff --git a/install.php b/install.php
index <HASH>..<HASH> 100644
--- a/install.php
+++ b/install.php
@@ -56,10 +56,8 @@ if (function_exists('date_default_timezone_set') and function_exists('date_defau
@error_reporting(E_ALL);
@ini_set('display_errors', '1');
-// Check that PHP is of a sufficient version
-// PHP 5.2.0 is intentionally checked here even though a higher version is required by the environment
-// check. This is not a typo - see MDL-18112
-if (version_compare(phpversion(), "5.2.0") < 0) {
+// Check that PHP is of a sufficient version.
+if (version_compare(phpversion(), '5.3.2') < 0) {
$phpversion = phpversion();
// do NOT localise - lang strings would not work here and we CAN not move it after installib
echo "Moodle 2.1 or later requires at least PHP 5.3.2 (currently using version $phpversion).<br />"; | MDL-<I> hardcode the required PHP version in installer | moodle_moodle | train | php |
0b25ab8b8fd4aa4228d31e147bc759f1eebffb87 | diff --git a/src/main/org/bson/BasicBSONCallback.java b/src/main/org/bson/BasicBSONCallback.java
index <HASH>..<HASH> 100644
--- a/src/main/org/bson/BasicBSONCallback.java
+++ b/src/main/org/bson/BasicBSONCallback.java
@@ -13,6 +13,10 @@ public class BasicBSONCallback implements BSONCallback {
reset();
}
+ public BSONObject create(){
+ return new BasicBSONObject();
+ }
+
public BSONCallback createBSONCallback(){
return new BasicBSONCallback();
} | fix: inadvertently removed method | mongodb_mongo-java-driver | train | java |
0f58fc881b795478d3f93f8f2bbd6b73a11b4c57 | 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
@@ -205,6 +205,24 @@ class TestPDB(object):
assert "1 failed" in rest
self.flush(child)
+ def test_pdb_print_captured_logs_nologging(self, testdir):
+ p1 = testdir.makepyfile("""
+ def test_1():
+ import logging
+ logging.warn("get " + "rekt")
+ assert False
+ """)
+ child = testdir.spawn_pytest("--show-capture=all --pdb "
+ "-p no:logging %s" % p1)
+ child.expect("get rekt")
+ output = child.before.decode("utf8")
+ assert "captured log" not in output
+ child.expect("(Pdb)")
+ child.sendeof()
+ rest = child.read().decode("utf8")
+ assert "1 failed" in rest
+ self.flush(child)
+
def test_pdb_interaction_exception(self, testdir):
p1 = testdir.makepyfile("""
import pytest | Add pdb test with disabled logging plugin
Implement the test from #<I>, which was not merged yet, because the PR was
abandoned in favor or #<I>. | pytest-dev_pytest | train | py |
f0e9de4e24076b45eda37b55c39d18d32483e20f | diff --git a/examples/html/main.js b/examples/html/main.js
index <HASH>..<HASH> 100644
--- a/examples/html/main.js
+++ b/examples/html/main.js
@@ -1,6 +1,6 @@
(function () {
// Check that the browser supports the FileReader API.
- if (typeof FileReader === 'undefined') {
+ if (!window.FileReader) {
document.write('<strong>Sorry, your web browser does not support the FileReader API.</strong>');
return;
} | Change to nicer check for FileReader | mattiasw_ExifReader | train | js |
91ce77e49670fb97ceaad7d7c3b414c488c65c62 | diff --git a/setuptools/tests/test_distutils_adoption.py b/setuptools/tests/test_distutils_adoption.py
index <HASH>..<HASH> 100644
--- a/setuptools/tests/test_distutils_adoption.py
+++ b/setuptools/tests/test_distutils_adoption.py
@@ -86,3 +86,10 @@ def test_pip_import(venv):
"""
cmd = ['python', '-c', 'import pip']
popen_text(venv.run)(cmd)
+
+
+def test_distutils_has_origin():
+ """
+ Distutils module spec should have an origin. #2990.
+ """
+ assert __import__('distutils').__spec__.origin | Check that distutils has an origin. Ref #<I>. | pypa_setuptools | train | py |
dca26571ccd772db3bc6eeb05f171588d822dc07 | diff --git a/demo/gptools_mds_ne.py b/demo/gptools_mds_ne.py
index <HASH>..<HASH> 100644
--- a/demo/gptools_mds_ne.py
+++ b/demo/gptools_mds_ne.py
@@ -200,7 +200,7 @@ gp.add_data(R_mid_ETS_w, ne_ETS_w, err_y=dev_ne_ETS_w)
gp.add_data(R_mag_mean, 0, n=1)
gp.add_data(0.904, 0, err_y=0.1)
gp.add_data(0.904, 0, n=1, err_y=1)
-gp.add_data(0.91, 0, err_y=0.05)
+gp.add_data(0.91, 0, err_y=0.01)
gp.add_data(0.91, 0, n=1, err_y=1)
gp.add_data(0.95, 0, err_y=0.001)
gp.add_data(0.95, 0, n=1, err_y=0.1) | Try shrinking errorbar on <I>m constraint. | markchil_gptools | train | py |
d189f2bce06bfc5b168d3881a133925831bbf743 | diff --git a/proxylib.php b/proxylib.php
index <HASH>..<HASH> 100644
--- a/proxylib.php
+++ b/proxylib.php
@@ -622,6 +622,10 @@ class AjaxProxy
{
header($this->_responseHeaders['status']);
+ // Let the server handle the Content-Lenght and Transfer-Encoding headers
+ unset($this->_responseHeaders['Content-Length']);
+ unset($this->_responseHeaders['Transfer-Encoding']);
+
foreach($this->_responseHeaders as $name => $value)
{
if($name != 'status') | Let the server handle the Content-Lenght and Transfer-Encoding headers | lanthaler_HydraConsole | train | php |
6c0e35d7b23cbee3d0d68544402f5ee531567628 | diff --git a/pkg/controller/daemon/daemon_controller.go b/pkg/controller/daemon/daemon_controller.go
index <HASH>..<HASH> 100644
--- a/pkg/controller/daemon/daemon_controller.go
+++ b/pkg/controller/daemon/daemon_controller.go
@@ -934,6 +934,9 @@ func (dsc *DaemonSetsController) podsShouldBeOnNode(
case !shouldContinueRunning && exists:
// If daemon pod isn't supposed to run on node, but it is, delete all daemon pods on node.
for _, pod := range daemonPods {
+ if pod.DeletionTimestamp != nil {
+ continue
+ }
podsToDelete = append(podsToDelete, pod.Name)
}
} | do not delete pods whose deletiontimestamp != nil | kubernetes_kubernetes | train | go |
fc0464ada409223d3563d621d8b1406a4283f109 | diff --git a/anyconfig/backend/base.py b/anyconfig/backend/base.py
index <HASH>..<HASH> 100644
--- a/anyconfig/backend/base.py
+++ b/anyconfig/backend/base.py
@@ -153,8 +153,9 @@ class Parser(object):
:param options: Keyword options may contain 'ac_ordered'.
:return: Factory (class or function) to make an container.
"""
- if options.get("ac_dict", False):
- return options["ac_dict"] # Higher priority than ac_ordered.
+ ac_dict = options.get("ac_dict", False)
+ if ac_dict and callable(ac_dict):
+ return ac_dict # Higher priority than ac_ordered.
elif self.ordered() and options.get("ac_ordered", False):
return anyconfig.compat.OrderedDict
else: | change: only use the value of ac_dict if it's callable | ssato_python-anyconfig | train | py |
0e011ad805a5546b0d03acc66f922a3ccdeb81ea | diff --git a/tests/integration/modules/test_win_lgpo.py b/tests/integration/modules/test_win_lgpo.py
index <HASH>..<HASH> 100644
--- a/tests/integration/modules/test_win_lgpo.py
+++ b/tests/integration/modules/test_win_lgpo.py
@@ -146,6 +146,12 @@ class WinLgpoTest(ModuleCase):
# expecting it to fail
self.assertNotEqual(ret, True)
+ def runTest(self):
+ '''
+ runTest method
+ '''
+ pass
+
@classmethod
def setUpClass(cls):
''' | add runTest method to class for PY2 | saltstack_salt | train | py |
8250a80d1bd0473a86c0e1e1eab2a8db672ab998 | diff --git a/dragnet/blocks.py b/dragnet/blocks.py
index <HASH>..<HASH> 100644
--- a/dragnet/blocks.py
+++ b/dragnet/blocks.py
@@ -317,7 +317,7 @@ class Blockifier(object):
# Only these should be considered as housing blocks of text
blocks = set([
- 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'p', 'div', 'table', 'map'
+ 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'p', 'div', 'table', 'map',
])
@@ -343,7 +343,7 @@ class Blockifier(object):
# First, we need to parse the thing
encoding = encoding or guess_encoding(s, default='CHARDET')
try:
- html = etree.fromstring(s, etree.HTMLParser(recover=True, encoding=encoding))
+ html = etree.fromstring(s, etree.HTMLParser(recover=True, encoding=encoding, remove_comments=True, remove_pis=True))
except:
raise BlockifyError
if html is None: | Explicitly remove comments when parsing | dragnet-org_dragnet | train | py |
e937507530e67be81e24e4e4f63762dd09768fb5 | diff --git a/openquake/calculators/hazard/disagg/core.py b/openquake/calculators/hazard/disagg/core.py
index <HASH>..<HASH> 100644
--- a/openquake/calculators/hazard/disagg/core.py
+++ b/openquake/calculators/hazard/disagg/core.py
@@ -220,7 +220,7 @@ class DisaggHazardCalculator(Calculator):
For example:
>>> DisaggHazardCalculator.create_result_dir(
- ... '/tmp/openquake/disagg-results', 123456789)
+ ... '/tmp/openquake', 123456789)
'/tmp/openquake/disagg-results/job-123456789'
:param base_path: base result storage directory (a path to an NFS | Oops. Fixed a stupid error in the doctest. Need to sleep. | gem_oq-engine | train | py |
8e32326b8a2dae212b075b80c5953f4795c0b292 | diff --git a/Dailymotion.php b/Dailymotion.php
index <HASH>..<HASH> 100644
--- a/Dailymotion.php
+++ b/Dailymotion.php
@@ -619,6 +619,7 @@ class Dailymotion
*/
protected function httpRequest($url, $payload, $headers = null, &$status_code = null, &$response_headers = null)
{
+ $payload = is_array($payload) ? http_build_query($payload) : $payload;
$ch = curl_init();
// Force removal of the Exept: 100-continue header automatically added by curl | urlencode datas sent over curl to avoid weird issues | dailymotion_dailymotion-sdk-php | train | php |
dcda268b0fd6d6289e1461c3f988e305981a2bec | diff --git a/pymc3/backends/ndarray.py b/pymc3/backends/ndarray.py
index <HASH>..<HASH> 100644
--- a/pymc3/backends/ndarray.py
+++ b/pymc3/backends/ndarray.py
@@ -164,8 +164,12 @@ class SerializeNDArray:
metadata['_stats'] = [{k: np.array(v) for k, v in stat.items()} for stat in metadata['_stats']]
- sampler_vars = metadata.pop('sampler_vars')
- new_trace._set_sampler_vars(sampler_vars)
+ # it seems like at least some old traces don't have 'sampler_vars'
+ try:
+ sampler_vars = metadata.pop('sampler_vars')
+ new_trace._set_sampler_vars(sampler_vars)
+ except KeyError:
+ pass
for key, value in metadata.items():
setattr(new_trace, key, value) | Fix to load sampler stats broke loading old traces. (#<I>) | pymc-devs_pymc | train | py |
629b5837e99ced620e71f5d750f2c1abc3537ed3 | diff --git a/core/blockchain.go b/core/blockchain.go
index <HASH>..<HASH> 100644
--- a/core/blockchain.go
+++ b/core/blockchain.go
@@ -796,11 +796,6 @@ func (bc *BlockChain) WriteBlockAndState(block *types.Block, receipts []*types.R
bc.mu.Lock()
defer bc.mu.Unlock()
- if bc.HasBlock(block.Hash(), block.NumberU64()) {
- log.Trace("Block existed", "hash", block.Hash())
- return
- }
-
localTd := bc.GetTd(bc.currentBlock.Hash(), bc.currentBlock.NumberU64())
externTd := new(big.Int).Add(block.Difficulty(), ptd) | core: revert invalid block dedup code (#<I>) | ethereum_go-ethereum | train | go |
b6adaaf758d8a89fe330eb9d8277629b42e121c3 | diff --git a/tests/scripts/thread-cert/node.py b/tests/scripts/thread-cert/node.py
index <HASH>..<HASH> 100755
--- a/tests/scripts/thread-cert/node.py
+++ b/tests/scripts/thread-cert/node.py
@@ -65,10 +65,10 @@ class Node:
cmd += ' %d' % nodeid
print ("%s" % cmd)
- self.pexpect = pexpect.spawn(cmd, timeout=2)
+ self.pexpect = pexpect.spawn(cmd, timeout=4)
# Add delay to ensure that the process is ready to receive commands.
- time.sleep(0.1)
+ time.sleep(0.2)
def __init_ncp_sim(self, nodeid):
@@ -87,7 +87,7 @@ class Node:
print ("%s" % cmd)
self.pexpect = pexpect.spawn(cmd, timeout=4)
- time.sleep(0.1)
+ time.sleep(0.2)
self.pexpect.expect('spinel-cli >')
self.debug(int(os.getenv('DEBUG', '0'))) | Delay a little longer after starting sim node (#<I>)
- To make travis check more stable | openthread_openthread | train | py |
0a7b46d25c7b5e9fa90c488bc906945b41b20c81 | diff --git a/src/Mvc/Qt_View.php b/src/Mvc/Qt_View.php
index <HASH>..<HASH> 100644
--- a/src/Mvc/Qt_View.php
+++ b/src/Mvc/Qt_View.php
@@ -218,14 +218,31 @@ class Qt_View
*/
private function xssFilter($data)
{
- array_walk_recursive($data, function (&$value) {
- $value = htmlspecialchars($value, ENT_QUOTES, 'UTF-8');
- });
+ if (is_string($data)) {
+ $this->cleaner($data);
+ $data = [$data];
+ } else {
+ array_walk_recursive($data, [$this, 'cleaner']);
+ }
return $data;
}
/**
+ * Cleaner
+ *
+ * @param mixed $value
+ */
+ private function cleaner(&$value)
+ {
+ if (is_object($value)) {
+ $this->xssFilter($value);
+ } else {
+ $value = htmlspecialchars($value, ENT_QUOTES, 'UTF-8');
+ }
+ }
+
+ /**
* Render Debug Bar
*
* @param string $view | XSS filtering on nested objects | softberg_quantum-core | train | php |
89370fd5c3ccd7dc5a1f45aaa0d4b0d969873b10 | diff --git a/test/test_host.go b/test/test_host.go
index <HASH>..<HASH> 100644
--- a/test/test_host.go
+++ b/test/test_host.go
@@ -51,13 +51,14 @@ func (s *HostSuite) TestAddFailingJob(t *c.C) {
t.Assert(err, c.IsNil)
defer stream.Close()
- // add a job with a non existent artifact
+ // add a job with a non existent partition
job := &host.Job{
ID: jobID,
ImageArtifact: &host.Artifact{
Type: host.ArtifactTypeDocker,
URI: "http://example.com?name=foo&id=bar",
},
+ Partition: "nonexistent",
}
t.Assert(h.AddJob(job), c.IsNil)
@@ -83,7 +84,7 @@ loop:
t.Assert(actual[1].Event, c.Equals, host.JobEventError)
jobErr := actual[1].Job.Error
t.Assert(jobErr, c.NotNil)
- t.Assert(*jobErr, c.Equals, "registry: repo not found")
+ t.Assert(*jobErr, c.Equals, `host: invalid job partition "nonexistent"`)
}
func (s *HostSuite) TestAttachNonExistentJob(t *c.C) { | test: Trigger a more reliable error in TestAddFailingJob
We were previously relying on the artifact pull from example.com to
return a <I>, thus generating a "repo not found" error, but example.com
recently starting returning a <I> instead. We probably shouldn't be
relying on the reliability of example.com :) | flynn_flynn | train | go |
4823fee3dc3b9e0285d52f8f3b96b3065bfebe14 | diff --git a/src/main/java/edu/jhu/gm/Feature.java b/src/main/java/edu/jhu/gm/Feature.java
index <HASH>..<HASH> 100644
--- a/src/main/java/edu/jhu/gm/Feature.java
+++ b/src/main/java/edu/jhu/gm/Feature.java
@@ -6,7 +6,7 @@ import java.io.Serializable;
* A feature in a factor graph model.
*
* @author mgormley
- *
+ * @author mmitchell
*/
public class Feature implements Serializable { | Adding an author annotation for mmitchell. | mgormley_pacaya | train | java |
348cf2030c1df25bc8223776eebd8d782626db33 | diff --git a/lib/json_api_resource/cacheable.rb b/lib/json_api_resource/cacheable.rb
index <HASH>..<HASH> 100644
--- a/lib/json_api_resource/cacheable.rb
+++ b/lib/json_api_resource/cacheable.rb
@@ -2,7 +2,7 @@ module JsonApiResource
module Cacheable
extend ActiveSupport::Concern
def cache_key
- @cache_key ||= Digest::SHA256.hexdigest(self.to_json)
+ @cache_key ||= Digest::SHA256.hexdigest(self.attributes.to_s)
end
end
end
\ No newline at end of file | Fix the to_json infinite loop
An instance variable can reference back to the same lawyer object with its own instance variable, and then we get a to_json infinite loop. We can accomplish the same thing for our cache key another way. | avvo_json_api_resource | train | rb |
2506585269444e928c27369a42160394254c3da2 | diff --git a/salt/cloud/clouds/ec2.py b/salt/cloud/clouds/ec2.py
index <HASH>..<HASH> 100644
--- a/salt/cloud/clouds/ec2.py
+++ b/salt/cloud/clouds/ec2.py
@@ -1209,7 +1209,7 @@ def _create_eni_if_necessary(interface):
_associate_eip_with_interface(eni_id, associate_public_ip)
elif interface.get('associate_eip'):
_associate_eip_with_interface(eni_id, interface.get('associate_eip'))
- elif interface.get('allocate_new_eip') or interface.get('AssociatePublicIpAddress'):
+ elif interface.get('allocate_new_eip') or associate_public_ip:
_new_eip = _request_eip(interface)
_associate_eip_with_interface(eni_id, _new_eip)
elif interface.get('allocate_new_eips'): | Use already allocated variable instead of calling getter twice | saltstack_salt | train | py |
adbe70152e4bcb85775e56690272de498581783d | diff --git a/lib/travis/model/worker.rb b/lib/travis/model/worker.rb
index <HASH>..<HASH> 100644
--- a/lib/travis/model/worker.rb
+++ b/lib/travis/model/worker.rb
@@ -32,10 +32,10 @@ class Worker < ActiveRecord::Base
end
def guess_queue
- case host
+ case full_name
when /ruby/, /staging/
'builds.common'
- when /jvm.*otp/
+ when /jvm/
'builds.jvmotp'
when /ppp/
'builds.php' | relax conditions in Worker#guess_queue | travis-ci_travis-core | train | rb |
61953c460ebae3c2ca47978213a145bb89639c46 | diff --git a/helpers.go b/helpers.go
index <HASH>..<HASH> 100644
--- a/helpers.go
+++ b/helpers.go
@@ -372,7 +372,7 @@ func (iter *Iter) SliceMap() ([]map[string]interface{}, error) {
// iter := session.Query(`SELECT * FROM mytable`).Iter()
// for {
// // New map each iteration
-// row = make(map[string]interface{})
+// row := make(map[string]interface{})
// if !iter.MapScan(row) {
// break
// } | fix MapScan example (#<I>) | gocql_gocql | train | go |
369e9d5d01b443224855d94053bd0963b86bfcc5 | diff --git a/analyze_2d/sampler_helpers.py b/analyze_2d/sampler_helpers.py
index <HASH>..<HASH> 100644
--- a/analyze_2d/sampler_helpers.py
+++ b/analyze_2d/sampler_helpers.py
@@ -47,7 +47,7 @@ def generate_view_cluster_hyper_posterior(p_State, view_idx):
def generate_column_sample(random_state, p_State, view_idx, col_idx, cluster_idx):
r, nu, s, mu = get_updated_continuous_hypers(p_State, view_idx, col_idx, cluster_idx)
standard_t_draw = random_state.standard_t(nu)
- student_t_draw = standard_t_draw * (s * (r + 1)) / (nu * r) + mu
+ student_t_draw = standard_t_draw * numpy.sqrt((s * (r + 1)) / (nu / 2. * r)) + mu
return student_t_draw
def generate_cluster_draws(random_state, p_State, column_view_idx_lookup): | fix bug in student_t draw generator, may still have issues with nu / 2. in denominator | probcomp_crosscat | train | py |
99eb1095ebf67745e65ba7e98d1ec518eba31f24 | diff --git a/lib/firefox/webdriver/builder.js b/lib/firefox/webdriver/builder.js
index <HASH>..<HASH> 100644
--- a/lib/firefox/webdriver/builder.js
+++ b/lib/firefox/webdriver/builder.js
@@ -172,9 +172,14 @@ module.exports.configureBuilder = function (builder, baseDir, options) {
return n !== undefined;
});
- ffOptions.setBinary(
- firefoxTypes.length > 0 ? firefoxTypes[0] : firefox.Channel.RELEASE
- );
+ // Do not set binary when using Android
+ // https://bugzilla.mozilla.org/show_bug.cgi?id=1751196
+
+ if (!options.android) {
+ ffOptions.setBinary(
+ firefoxTypes.length > 0 ? firefoxTypes[0] : firefox.Channel.RELEASE
+ );
+ }
ffOptions.addArguments('-no-remote'); | Make sure we do not set Firefox binary on Android (#<I>) | sitespeedio_browsertime | train | js |
2365d644e5db39b2942dfdd3b98a3ecab374dfa8 | diff --git a/src/main/LocationTrack.js b/src/main/LocationTrack.js
index <HASH>..<HASH> 100644
--- a/src/main/LocationTrack.js
+++ b/src/main/LocationTrack.js
@@ -38,7 +38,7 @@ class LocationTrack extends React.Component {
var {height, width} = label.text("0").node().getBBox();
// Save the size information for precise calculation
this.setState({
- labelSize: {height: height, width: width}
+ labelSize: {height, width}
});
this.updateVisualization(); | code-style: fix indentation and start using compact obj literal | hammerlab_pileup.js | train | js |
b999e42cee307a944df01a01e36bfd010f9d69b8 | diff --git a/Classes/Helper/InlineHelper.php b/Classes/Helper/InlineHelper.php
index <HASH>..<HASH> 100644
--- a/Classes/Helper/InlineHelper.php
+++ b/Classes/Helper/InlineHelper.php
@@ -93,8 +93,10 @@ class InlineHelper
if (!is_numeric($uid)) {
return;
}
-
$fieldHelper = GeneralUtility::makeInstance('MASK\\Mask\\Helper\\FieldHelper');
+ if (!$this->objectManager) {
+ $this->objectManager = GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager');
+ }
$storage = $this->storageRepository->load();
/* @var $fileRepository \TYPO3\CMS\Core\Resource\FileRepository */ | [TASK] check if objectmanager is set | Gernott_mask | train | php |
a21165212e64f4f278912cd746fe6ba8390ec39d | diff --git a/manifest.php b/manifest.php
index <HASH>..<HASH> 100755
--- a/manifest.php
+++ b/manifest.php
@@ -13,7 +13,7 @@ return array(
'label' => 'Result core extension',
'description' => 'Results Server management and exposed interfaces for results data submission',
'license' => 'GPL-2.0',
- 'version' => '2.10.0',
+ 'version' => '2.10.1',
'author' => 'Open Assessment Technologies',
//taoResults may be needed for the taoResults taoResultServerModel that uses taoResults db storage
'requires' => array(
diff --git a/scripts/update/class.Updater.php b/scripts/update/class.Updater.php
index <HASH>..<HASH> 100644
--- a/scripts/update/class.Updater.php
+++ b/scripts/update/class.Updater.php
@@ -33,7 +33,7 @@ class taoResultServer_scripts_update_Updater extends \common_ext_ExtensionUpdate
*/
public function update($initialVersion) {
- $this->skip('2.6', '2.10.0');
+ $this->skip('2.6', '2.10.1');
}
} | Updating version to <I> | oat-sa_extension-tao-outcome | train | php,php |
3b91e4169060c6292dc30d294c7a506970fa4c5f | diff --git a/lib/OpenLayers/Style.js b/lib/OpenLayers/Style.js
index <HASH>..<HASH> 100644
--- a/lib/OpenLayers/Style.js
+++ b/lib/OpenLayers/Style.js
@@ -61,7 +61,7 @@ OpenLayers.Style = OpenLayers.Class({
rules: null,
/**
- * Property: context
+ * APIProperty: context
* {Object} An optional object with properties that symbolizers' property
* values should be evaluated against. If no context is specified,
* feature.attributes will be used | Mark context property as part of API. It's very useful and is used in examples (at least strategy-cluster-threshold) | openlayers_openlayers | train | js |
f7813b5497334773ac2c43b976e32418c87f5462 | diff --git a/test/integrationTest.js b/test/integrationTest.js
index <HASH>..<HASH> 100644
--- a/test/integrationTest.js
+++ b/test/integrationTest.js
@@ -18,13 +18,15 @@ function startTestServer(port, devices, callback) {
'--tester='+devices
]);
+ var logLines = '';
var timeout = setTimeout(function () {
server.kill('SIGTERM');
- throw new Error('Timeout while starting owserver');
+ throw new Error('Timeout while starting owserver: '+logLines);
}, 1000);
server.stderr.on('data', function(data) {
var str = data.toString();
+ logLines += str;
if (str.match(/Setting up tester Bus Master/)) {
clearTimeout(timeout);
if (callback) {
@@ -34,6 +36,7 @@ function startTestServer(port, devices, callback) {
});
server.on('error', function (err) {
+ console.log(logLines);
throw new Error('owserver error: '+err);
}); | Added printing of owserver log lines if there is an error | njh_node-owfs | train | js |
19dc4204159c61fa698bcdf9579328aacc8066ab | diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -1,7 +1,6 @@
from setuptools import setup, find_packages
import os
-version = '1.2'
"""
Copyright (C) 2013 Rice University
@@ -12,7 +11,7 @@ See LICENSE.txt for details.
from setuptools import setup, find_packages
import os
-version = '1.0'
+version = '1.2'
setup(name='rhaptos.cnxmlutils',
version=version, | version number duplication in setup.py | openstax_rhaptos.cnxmlutils | train | py |
ef1cfc0710a7269e8ba6537338bc36f74fac6aec | diff --git a/djgeojson/tests.py b/djgeojson/tests.py
index <HASH>..<HASH> 100644
--- a/djgeojson/tests.py
+++ b/djgeojson/tests.py
@@ -647,7 +647,11 @@ class ModelFieldTest(TestCase):
def test_models_can_have_geojson_fields(self):
saved = Address.objects.get(id=self.address.id)
- self.assertDictEqual(saved.geom, self.address.geom)
+ if isinstance(saved.geom, dict):
+ self.assertDictEqual(saved.geom, self.address.geom)
+ else:
+ # Django 1.8 !
+ self.assertEqual(json.loads(saved.geom.geojson), self.address.geom)
def test_default_form_field_is_geojsonfield(self):
field = self.address._meta.get_field('geom').formfield() | Looks like Django <I> is now smart | makinacorpus_django-geojson | train | py |
6e757a7f0364d7a43ea2c2844b28690d30137661 | diff --git a/ez_setup.py b/ez_setup.py
index <HASH>..<HASH> 100644
--- a/ez_setup.py
+++ b/ez_setup.py
@@ -160,11 +160,11 @@ download_file_powershell.viable = (
)
def download_file_curl(url, target):
- cmd = ['curl %(url)r -o %(target)s']
+ cmd = ['curl', url, '-o', target]
subprocess.check_call(cmd)
def has_curl():
- cmd = ['curl --version']
+ cmd = ['curl', '--version']
try:
subprocess.check_call(cmd)
except:
@@ -173,6 +173,20 @@ def has_curl():
download_file_curl.viable = has_curl
+def download_file_wget(url, target):
+ cmd = ['wget', url, '-q', '-O', target]
+ subprocess.check_call(cmd)
+
+def has_wget():
+ cmd = ['wget', '--version']
+ try:
+ subprocess.check_call(cmd)
+ except:
+ return False
+ return True
+
+download_file_curl.viable = has_wget
+
def download_file_insecure(url, target):
"""
Use Python to download the file, even though it cannot authenticate the
@@ -202,7 +216,7 @@ def get_best_downloader():
downloaders = [
download_file_powershell,
download_file_curl,
- #download_file_wget,
+ download_file_wget,
download_file_insecure,
] | Implemented download using wget | pypa_setuptools | train | py |
aa87e1260068e873982c55c571575f3b40a4c859 | diff --git a/src/Support/Collection.php b/src/Support/Collection.php
index <HASH>..<HASH> 100644
--- a/src/Support/Collection.php
+++ b/src/Support/Collection.php
@@ -206,7 +206,18 @@ class Collection extends Collector
public function sum() : int
{
if ($this->isEmpty()) return 0;
- return $this->returnItem(array_sum($this->items));
+ return (int) $this->returnItem(array_sum($this->items));
+ }
+
+ /**
+ * Get product of all array items.
+ *
+ * @return int
+ */
+ public function product() : int
+ {
+ if ($this->isEmpty()) return 0;
+ return (int) $this->returnItem(array_product($this->items));
}
/**
@@ -394,6 +405,22 @@ class Collection extends Collector
}
/**
+ * Replace all occurrences of the search string with the replacement string in collection.
+ *
+ * @param mixed $search
+ * @param mixed $replace
+ * @return Collection
+ */
+ public function replace($search, $replace) : Collection
+ {
+ if ($this->isEmpty()) return $this->returnItem([]);
+ return $this->walk(function(&$value) use ($search, $replace)
+ {
+ $value = str_replace($search, $replace, $value);
+ });
+ }
+
+ /**
* Flip values and keys of array items.
*
* @return Collection | - Adds product method
- Adds replace method
- Casts return method to int | faraweilyas_whitegold-framework | train | php |
2dea36ae2c84603a3594c9cc6981dffb701c817d | diff --git a/strings.go b/strings.go
index <HASH>..<HASH> 100644
--- a/strings.go
+++ b/strings.go
@@ -11,22 +11,21 @@ func ToUpperCamelCase(s string) string {
if s == "" {
return ""
}
- result := make([]rune, 0, len(s))
- upper := false
- for _, r := range s {
- if r == '_' {
+ upper := true
+ var result bytes.Buffer
+ for _, c := range s {
+ if c == '_' {
upper = true
continue
}
if upper {
- result = append(result, unicode.ToUpper(r))
+ result.WriteRune(unicode.ToUpper(c))
upper = false
continue
}
- result = append(result, r)
+ result.WriteRune(c)
}
- result[0] = unicode.ToUpper(result[0])
- return string(result)
+ return result.String()
}
// ToSnakeCase returns a copy of the string s with all Unicode letters mapped to their snake case. | ToUpperCamelCase: Performance improvement | naoina_go-stringutil | train | go |
ad48269a7a99219deb79b6b3b4b9833338da0d1f | diff --git a/lib/mess/renderer.js b/lib/mess/renderer.js
index <HASH>..<HASH> 100644
--- a/lib/mess/renderer.js
+++ b/lib/mess/renderer.js
@@ -335,10 +335,11 @@ mess.Renderer = function Renderer(env) {
var rules = [];
var output, inverted, negation, rest;
- definitions.reduce(function(input, definition, i) {
+ var input = [ new tree.Selector ];
+ for (var i = 0; i < definitions.length; i++) {
var next = [];
var results = [];
- var main = definition.selector;
+ var main = definitions[i].selector;
for (var id = 0; id < input.length; id++) {
output = main.cloneMerge(input[id]);
@@ -373,13 +374,13 @@ mess.Renderer = function Renderer(env) {
results = renderer.mergeSelectors(results);
for (var id = 0; id < results.length; id++) {
- var clone = definition.clone();
+ var clone = definitions[i].clone();
clone.selector = results[id];
rules.push(clone);
}
- return renderer.mergeSelectors(next);
- }, [new tree.Selector()]);
+ input = next;
+ }
if (env.debug) console.warn('Resolving time: ' + ((new Date - resolvingTime)) + 'ms');
// process.exit(); | Using a simple loop speeds this up by <I>ms for opened.mml | mapbox_carto | train | js |
8a32dcc3d4898d5729dc4b25180b08ac94269366 | diff --git a/app/mailers/maktoub/newsletter_mailer.rb b/app/mailers/maktoub/newsletter_mailer.rb
index <HASH>..<HASH> 100644
--- a/app/mailers/maktoub/newsletter_mailer.rb
+++ b/app/mailers/maktoub/newsletter_mailer.rb
@@ -19,7 +19,7 @@ module Maktoub
premailer = Premailer.new(render("maktoub/newsletters/#{newsletter_name}").to_s,
with_html_string: true,
- link_query_string: CGI::escape("?utm_source=newsletter&utm_medium=email&utm_campaign=#{@subject}")
+ link_query_string: CGI::escape("utm_source=newsletter&utm_medium=email&utm_campaign=#{@subject}")
)
mail(mail_fields) do |format| | remove ? from google analytics parameters, it is already added by premailer | Sandglaz_maktoub | train | rb |
b1537c2ed5b652d59d107f3c38043042ab851f8b | diff --git a/osbs/core.py b/osbs/core.py
index <HASH>..<HASH> 100755
--- a/osbs/core.py
+++ b/osbs/core.py
@@ -822,7 +822,7 @@ class Openshift(object):
break
if changetype == WATCH_ERROR:
- logger.error("Error watching ImageStream")
+ logger.error("Error watching ImageStream: %s", obj)
break
if changetype == WATCH_MODIFIED: | Log error response on import_image watch failure
If watch API returns a response of type error, log the failure
associated with it for easier debugging. | projectatomic_osbs-client | train | py |
392e3a6c692d81cd7938a3c963ff846049a39141 | diff --git a/vsphere/resource_vsphere_storage_drs_vm_override_test.go b/vsphere/resource_vsphere_storage_drs_vm_override_test.go
index <HASH>..<HASH> 100644
--- a/vsphere/resource_vsphere_storage_drs_vm_override_test.go
+++ b/vsphere/resource_vsphere_storage_drs_vm_override_test.go
@@ -76,7 +76,7 @@ func TestAccResourceVSphereStorageDrsVMOverride_update(t *testing.T) {
Config: testAccResourceVSphereStorageDrsVMOverrideConfigOverrides(),
Check: resource.ComposeTestCheckFunc(
testAccResourceVSphereStorageDrsVMOverrideExists(true),
- testAccResourceVSphereStorageDrsVMOverrideMatch("manual", nil, structure.BoolPtr(false)),
+ testAccResourceVSphereStorageDrsVMOverrideMatch("automated", nil, structure.BoolPtr(false)),
),
},
}, | r/storage_drs_vm_override: Fix update test
I forgot to port the settings to the automation level override from the
override test to the update test. | terraform-providers_terraform-provider-vsphere | train | go |
923a242768e5aed7e8428e244ac576ecce16438b | diff --git a/octopie/api.py b/octopie/api.py
index <HASH>..<HASH> 100644
--- a/octopie/api.py
+++ b/octopie/api.py
@@ -95,6 +95,10 @@ def _http_call(url, method, auth, *args, **kwargs):
if 'error_id' in result:
raise APIError(result['error_id'], result['error_message'],
result['error_name'], http_url)
+ if 'message' in result:
+ if 'rate limit exceeded' in result['message']:
+ raise APIError('Rate limit exceeded' , result['message'],
+ 'Rate limit exceeded', http_url)
return result
diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -14,7 +14,7 @@ requires = ["requests == 1.2.3"]
setup(
name='octopie',
- version='0.0.6',
+ version='0.0.7',
description='Python GitHub API Client',
author='Steven Cheng',
author_email='[email protected]', | Now raise APIError for rate limit exceed | stevenc81_octopie | train | py,py |
14b0957e749823f0dda9ab81cc48241b34248ba2 | diff --git a/peewee.py b/peewee.py
index <HASH>..<HASH> 100644
--- a/peewee.py
+++ b/peewee.py
@@ -185,6 +185,7 @@ class DQ(Leaf):
class Param(Leaf):
def __init__(self, data):
self.data = data
+ super(Param, self).__init__()
class Func(Leaf): | Fixing a small bug in param | coleifer_peewee | train | py |
7a597b733f083660aba65310732e838f18458129 | diff --git a/lib/govspeak.rb b/lib/govspeak.rb
index <HASH>..<HASH> 100644
--- a/lib/govspeak.rb
+++ b/lib/govspeak.rb
@@ -87,6 +87,7 @@ module Govspeak
end
def preprocess(source)
+ source = Govspeak::BlockquoteExtraQuoteRemover.remove(source)
@@extensions.each do |title,regexp,block|
source.gsub!(regexp) {
instance_exec(*Regexp.last_match.captures, &block)
diff --git a/test/govspeak_test.rb b/test/govspeak_test.rb
index <HASH>..<HASH> 100644
--- a/test/govspeak_test.rb
+++ b/test/govspeak_test.rb
@@ -837,6 +837,27 @@ $PriorityList:1
end
end
+ test "should remove quotes surrounding a blockquote" do
+ govspeak = %Q{
+He said:
+
+> "I'm not sure what you mean!"
+
+Or so we thought.}
+
+ given_govspeak(govspeak) do
+ assert_html_output %|
+ <p>He said:</p>
+
+ <blockquote>
+ <p class="last-child">I’m not sure what you mean!</p>
+ </blockquote>
+
+ <p>Or so we thought.</p>
+ |
+ end
+ end
+
test "should add class to last paragraph of blockquote" do
govspeak = "
> first line | Apply quote remover to document body
This isn't particularly nice as unlike the other extensions this is
applied to the whole body rather than a matched section. Thus this is
applied outside of the extension system. | alphagov_govspeak | train | rb,rb |
d9b33a72adcfeb37c9c1c384aac0db81fc8d19fa | diff --git a/src/Validators/ConstRangeValidator.php b/src/Validators/ConstRangeValidator.php
index <HASH>..<HASH> 100644
--- a/src/Validators/ConstRangeValidator.php
+++ b/src/Validators/ConstRangeValidator.php
@@ -68,7 +68,7 @@ class ConstRangeValidator extends RangeValidator
$cache[$class][$prefix] = [];
foreach ($reflection->getConstants() as $name => $v) {
- if (strpos($name, $prefix) === 0) {
+ if ($prefix === '' || strpos($name, $prefix) === 0) {
$cache[$class][$prefix][] = $v;
}
} | Perform adding constants to range if passed prefix equals '' (#<I>) | Horat1us_yii2-base | train | php |
aaf1680a59c32a46552a598cf43ae789553f08ad | diff --git a/local_settings/settings.py b/local_settings/settings.py
index <HASH>..<HASH> 100644
--- a/local_settings/settings.py
+++ b/local_settings/settings.py
@@ -2,6 +2,8 @@ import re
from collections import Mapping, Sequence
from itertools import chain
+import six
+
from .util import NO_DEFAULT, NO_DEFAULT as PLACEHOLDER
@@ -259,6 +261,9 @@ class Settings(dict):
segments = []
path_iter = zip(iter(path), chain(path[1:], (None,)))
+ if six.PY2:
+ # zip() returns a list on Python 2
+ path_iter = iter(path_iter)
convert_name = self._convert_name
current_segment = []
current_segment_contains_group = False | Fix settings path parsing on Python 2
The problem was that `zip()` returns a list on Python 2 and an iterator
on Python 3.
Refs cc<I>e | PSU-OIT-ARC_django-local-settings | train | py |
100f8ad9f033c69b293c3c03bd8104251ceff4ea | diff --git a/src/nauka/fhs.py b/src/nauka/fhs.py
index <HASH>..<HASH> 100644
--- a/src/nauka/fhs.py
+++ b/src/nauka/fhs.py
@@ -65,25 +65,6 @@ def createWorkDir(baseDir,
os.symlink(os.path.relpath(byuuidPath, bynameDir), bynamePath, True)
#
- # Create handy .rsync-filter files.
- #
- with contextlib.suppress(OSError):
- with open(os.path.join(baseDir, ".rsync-filter"), "x") as f:
- f.write("#\n"
- "# rsync filter rules.\n"
- "#\n"
- "# When the argument -F is given to rsync, the rules within will be obeyed.\n"
- "#\n")
-
- with contextlib.suppress(OSError):
- with open(os.path.join(projDir, ".rsync-filter"), "x") as f:
- f.write("#\n"
- "# rsync filter rules.\n"
- "#\n"
- "# When the argument -F is given to rsync, the rules within will be obeyed.\n"
- "#\n")
-
- #
# Return the constructed workDir.
#
return byuuidPath | Remove automatic creation of .rsync-filter files.
It has never proved useful but does pollute the filesystem a bit with
hidden files that no-one notices or uses. | obilaniu_Nauka | train | py |
bb9ef1adfe1b883aac9266d1ad19d1b64460aebf | diff --git a/TYPO3.Flow/Tests/Functional/Persistence/Fixtures/AnnotatedIdEntity.php b/TYPO3.Flow/Tests/Functional/Persistence/Fixtures/AnnotatedIdEntity.php
index <HASH>..<HASH> 100644
--- a/TYPO3.Flow/Tests/Functional/Persistence/Fixtures/AnnotatedIdEntity.php
+++ b/TYPO3.Flow/Tests/Functional/Persistence/Fixtures/AnnotatedIdEntity.php
@@ -24,6 +24,7 @@ class AnnotatedIdEntity
/**
* @ORM\Id
* @ORM\GeneratedValue
+ * @ORM\SequenceGenerator(sequenceName="annotatedidentity_seq")
* @var string
*/
protected $id; | [BUGFIX] Fix functional test by explicitly naming sequence
The auto-generated name of a sequence exceeds the maximum length, is
truncated and thus duplicates an already existing name in the schema.
This is solved by manually giving a name to the sequence.
This bug affects only PostgreSQL and is triggered by a functional test
fixture. | neos_flow-development-collection | train | php |
90996a1e18bf168506b85e4599c4408b136a57f8 | diff --git a/download_magic.py b/download_magic.py
index <HASH>..<HASH> 100755
--- a/download_magic.py
+++ b/download_magic.py
@@ -34,7 +34,7 @@ def main():
input_dir_path = '.'
# non-interactive
else:
- dataframe = extractor.command_line_dataframe(['O', False, 0])
+ dataframe = extractor.command_line_dataframe([['O', False, 0]])
checked_args = extractor.extract_and_check_args(sys.argv, dataframe)
infile, dir_path, input_dir_path, overwrite = extractor.get_vars(['f', 'WD', 'ID', 'O'], checked_args) | fix bug in download_magic command_line extractor | PmagPy_PmagPy | train | py |
b481e9e4b8b330cdf1b20fb166369fbd927944f8 | diff --git a/driver.go b/driver.go
index <HASH>..<HASH> 100644
--- a/driver.go
+++ b/driver.go
@@ -32,19 +32,19 @@ type Driver interface {
ListDir(string, func(FileInfo) error) error
// params - path
- // returns - true if the directory was deleted
+ // returns - nil if the directory was deleted or any error encountered
DeleteDir(string) error
// params - path
- // returns - true if the file was deleted
+ // returns - nil if the file was deleted or any error encountered
DeleteFile(string) error
// params - from_path, to_path
- // returns - true if the file was renamed
+ // returns - nil if the file was renamed or any error encountered
Rename(string, string) error
// params - path
- // returns - true if the new directory was created
+ // returns - nil if the new directory was created or any error encountered
MakeDir(string) error
// params - path
@@ -52,6 +52,6 @@ type Driver interface {
GetFile(string, int64) (int64, io.ReadCloser, error)
// params - destination path, an io.Reader containing the file data
- // returns - true if the data was successfully persisted
+ // returns - the number of bytes writen and the first error encountered while writing, if any.
PutFile(string, io.Reader, bool) (int64, error)
} | Fix documentation for driver interface (#<I>) | goftp_server | train | go |
9939952eb7cb5b912400c6db0e30bec21ee741ab | diff --git a/neuropythy/__init__.py b/neuropythy/__init__.py
index <HASH>..<HASH> 100644
--- a/neuropythy/__init__.py
+++ b/neuropythy/__init__.py
@@ -62,7 +62,7 @@ except: pass
# Version information...
-__version__ = '0.4.13'
+__version__ = '0.5.0' | ready for version <I>, which will probably be the version archived in the OSF website... | noahbenson_neuropythy | train | py |
cda563c7c350db3f703e3711bea4839bf169d02b | diff --git a/lib/catshardinfo.go b/lib/catshardinfo.go
index <HASH>..<HASH> 100644
--- a/lib/catshardinfo.go
+++ b/lib/catshardinfo.go
@@ -90,7 +90,8 @@ func (s *CatShardInfo) String() string {
// Get all the shards, even the bad ones
func (c *Conn) GetCatShards() (shards CatShards) {
shards = make(CatShards, 0)
- args := map[string]interface{}{"bytes": "b"}
+ //force it to only respond with the columns we know about and in a forced order
+ args := map[string]interface{}{"bytes": "b", "h": "index,shard,prirep,state,docs,store,ip,node"}
s, err := c.DoCommand("GET", "/_cat/shards", args, nil)
if err == nil {
catShardLines := strings.Split(string(s[:]), "\n") | fix shards cat api as well | mattbaird_elastigo | train | go |
4fba1c4e00ae180b424689b6a7240663592ca4df | diff --git a/test/libinit.spec.js b/test/libinit.spec.js
index <HASH>..<HASH> 100644
--- a/test/libinit.spec.js
+++ b/test/libinit.spec.js
@@ -94,10 +94,8 @@ describe('library initialize', () => {
describe('generator', function doit() {
const self = this;
- beforeEach(() => {
- self.timeout(5000);
- });
it('interpolates library.properties', () => {
+ self.timeout(5000);
return generator('init', (result) => {
return result.withOptions(testData); // Mock options passed in
}).then(validateOutput); | another try at setting the timeout for the first test | particle-iot_particle-library-manager | train | js |
Subsets and Splits