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
|
---|---|---|---|---|---|
c2b2c0277d9920aaf29b6dc53091fc9c843000ac | diff --git a/test/e2e/test/mocha.env.js b/test/e2e/test/mocha.env.js
index <HASH>..<HASH> 100644
--- a/test/e2e/test/mocha.env.js
+++ b/test/e2e/test/mocha.env.js
@@ -1 +1,19 @@
process.env.SELENIUM_PROMISE_MANAGER = '0';
+
+/**
+ * External dependencies (can also be listed in the root package.json)
+ */
+// eslint-disable-next-line import/no-extraneous-dependencies
+const execa = require( 'execa' );
+
+// Make sure that chromedriver is installed before running tests
+try {
+ execa.sync( 'node', [ require.resolve( 'chromedriver/install' ) ], {
+ env: {
+ CHROMEDRIVER_SKIP_DOWNLOAD: '',
+ },
+ stdio: 'inherit',
+ } );
+} catch ( error ) {
+ console.error( error );
+} | [e2e] Installchromedriver before running e2e tests (#<I>)
Depending on the env variables, chromedriver can be skipped
when installing project dependencies.
These code changes make sure that it gets installed before
running any mocha commands. | Automattic_wp-calypso | train | js |
28bf37758344115b02631995a4fcb212c9d0fa50 | diff --git a/src/Highlighter.js b/src/Highlighter.js
index <HASH>..<HASH> 100644
--- a/src/Highlighter.js
+++ b/src/Highlighter.js
@@ -19,6 +19,7 @@ Highlighter.propTypes = {
]),
sanitize: PropTypes.func,
searchWords: PropTypes.arrayOf(PropTypes.string).isRequired,
+ textColors: PropTypes.object,
textToHighlight: PropTypes.string.isRequired,
unhighlightClassName: PropTypes.string,
unhighlightStyle: PropTypes.object
@@ -41,6 +42,7 @@ export default function Highlighter ({
highlightTag = 'mark',
sanitize,
searchWords,
+ textColors,
textToHighlight,
unhighlightClassName = '',
unhighlightStyle
@@ -66,9 +68,11 @@ export default function Highlighter ({
if (chunk.highlight) {
highlightCount++
+ const colorClass = textColors ? textColors[text] : undefined;
+
const isActive = highlightCount === +activeIndex
- highlightClassNames = `${highlightClassName} ${isActive ? activeClassName : ''}`
+ highlightClassNames = `${colorClass ? colorClass : highlightClassName} ${isActive ? activeClassName : ''}`
highlightStyles = isActive === true && activeStyle != null
? Object.assign({}, highlightStyle, activeStyle)
: highlightStyle | Added a new prop for mapping words to classes to allow for multiple styles or colors | bvaughn_react-highlight-words | train | js |
002ef0b230fe4711dd39049ef29aef2fda5f789e | diff --git a/modules/opendata/lib/ArchiWikiConvertor/Interface/Strategy.php b/modules/opendata/lib/ArchiWikiConvertor/Interface/Strategy.php
index <HASH>..<HASH> 100644
--- a/modules/opendata/lib/ArchiWikiConvertor/Interface/Strategy.php
+++ b/modules/opendata/lib/ArchiWikiConvertor/Interface/Strategy.php
@@ -4,7 +4,6 @@ abstract class Strategy{
public function __construct($c){
if($c != NULL){
$this->config= $c;
- var_dump($)
}
} | Fix error line for debug in Strtegy class | Archi-Strasbourg_archi-wiki | train | php |
9b927b6317c2f4337a6d4143167fd38083cbf8bb | diff --git a/src/mpociot/Versionable/VersionableTrait.php b/src/mpociot/Versionable/VersionableTrait.php
index <HASH>..<HASH> 100644
--- a/src/mpociot/Versionable/VersionableTrait.php
+++ b/src/mpociot/Versionable/VersionableTrait.php
@@ -36,6 +36,21 @@ trait VersionableTrait
}
/**
+ * @param $version_id
+ * @return null
+ */
+ public function getVersionModel( $version_id )
+ {
+ $version = $this->versions()->where("version_id","=", $version_id )->first();
+ if( !is_null( $version) )
+ {
+ return $version->getModel();
+ } else {
+ return null;
+ }
+ }
+
+ /**
* Pre save hook to determine if versioning is enabled and if we're updating
* the model
*/ | Added new "getVersionModel" method to the trait to allow simple restoring of models. | mpociot_versionable | train | php |
240515f39997ff3e5a2ea9c6ced8e0dfd9965ab9 | diff --git a/smoothing.py b/smoothing.py
index <HASH>..<HASH> 100644
--- a/smoothing.py
+++ b/smoothing.py
@@ -641,7 +641,7 @@ class Spatial_Filtering:
Examples
--------
>>> stl = pysal.open('../examples/stl_hom.csv', 'r')
- >>> fromWKT = pysal.core._FileIO.wkt.WKTParser()
+ >>> fromWKT = pysal.core.IOHandlers.wkt.WKTParser()
>>> stl.cast('WKT',fromWKT)
>>> d = np.array([i.centroid for i in stl[:,0]])
>>> stl_e, stl_b = np.array(stl[:,10]), np.array(stl[:,13])
@@ -716,7 +716,7 @@ class Headbanging_Triples:
--------
>>> from pysal import knnW
>>> stl_db = pysal.open('../examples/stl_hom.csv','r')
- >>> fromWKT = pysal.core._FileIO.wkt.WKTParser()
+ >>> fromWKT = pysal.core.IOHandlers.wkt.WKTParser()
>>> stl_db.cast('WKT',fromWKT)
>>> d = np.array([i.centroid for i in stl_db[:,0]])
>>> w = knnW(d,k=5) | renaming _FileIO to be more visable. Issue #<I> | pysal_mapclassify | train | py |
41b776cb88f53ddb0f0b7805b4f5324548adff35 | diff --git a/src/api/http/api.go b/src/api/http/api.go
index <HASH>..<HASH> 100644
--- a/src/api/http/api.go
+++ b/src/api/http/api.go
@@ -178,12 +178,10 @@ func (self *HttpServer) Close() {
log.Info("Closing http server")
self.conn.Close()
log.Info("Waiting for all requests to finish before killing the process")
- for i := 0; i < 2; i++ {
- select {
- case <-time.After(time.Second * 5):
- log.Error("There seems to be a hanging request. Closing anyway")
- case <-self.shutdown:
- }
+ select {
+ case <-time.After(time.Second * 5):
+ log.Error("There seems to be a hanging request. Closing anyway")
+ case <-self.shutdown:
}
}
} | don't do this twice, 5 seconds is good enough | influxdata_influxdb | train | go |
65085cf2b662194711ea065c5d61ecefb69039a1 | diff --git a/webpack.config.js b/webpack.config.js
index <HASH>..<HASH> 100644
--- a/webpack.config.js
+++ b/webpack.config.js
@@ -8,7 +8,9 @@ module.exports = {
},
output: {
path: './dist',
- publicPath: '/'
+ publicPath: '/',
+ library: 'VueInfiniteLoading',
+ libraryTarget: 'umd'
},
resolve: {
extensions: ['', '.js', '.vue']
@@ -62,7 +64,6 @@ module.exports = {
// production configurations
if (process.env.NODE_ENV === 'production') {
module.exports.output.filename = '[name].js';
- module.exports.output.chunkFilename = "[id].js";
module.exports.plugins = [
new webpack.DefinePlugin({ | Modify configuration of webpack for build library | PeachScript_vue-infinite-loading | train | js |
d8bc3dd0007c84274b89d24a565d4beee173dd37 | diff --git a/environs/maas/state_test.go b/environs/maas/state_test.go
index <HASH>..<HASH> 100644
--- a/environs/maas/state_test.go
+++ b/environs/maas/state_test.go
@@ -12,6 +12,12 @@ type StateSuite struct {
var _ = Suite(new(StateSuite))
func (suite *StateSuite) TestLoadStateReturnsNotFoundForMissingFile(c *C) {
- _, err := suite.environ.loadState()
+ serverURL := suite.testMAASObject.URL().String()
+ config := getTestConfig("loadState-test", serverURL, "a:b:c", "foo")
+ env, err := NewEnviron(config)
+ c.Assert(err, IsNil)
+
+ _, err = env.loadState()
+
c.Check(err, FitsTypeOf, environs.NotFoundError{})
} | Bit more setup: test suite's environment isn't quite enough to be functional. | juju_juju | train | go |
4dd0504b03ea0f6c02081ac589f69a2af0893b43 | diff --git a/lib/sequent/core/event.rb b/lib/sequent/core/event.rb
index <HASH>..<HASH> 100644
--- a/lib/sequent/core/event.rb
+++ b/lib/sequent/core/event.rb
@@ -22,7 +22,10 @@ module Sequent
def payload
result = {}
- instance_variables.reject { |k| payload_variables.include?(k.to_s) }.each do |k|
+ instance_variables
+ .reject { |k| payload_variables.include?(k.to_s) }
+ .select { |k| attributes.keys.include?(to_attribute_name(k))}
+ .each do |k|
result[k.to_s[1 .. -1].to_sym] = instance_variable_get(k)
end
result
@@ -32,6 +35,11 @@ module Sequent
%w{@aggregate_id @sequence_number @created_at}
end
+ private
+ def to_attribute_name(instance_variable_name)
+ instance_variable_name.to_s.gsub('@', '').to_sym
+ end
+
end
class TenantEvent < Event | Only include self created attributes in the payload
We do not want “errors” in the payload | zilverline_sequent | train | rb |
1aa2f09056c9bcdac1ad656e2c6e97167f822b5e | diff --git a/minify.go b/minify.go
index <HASH>..<HASH> 100644
--- a/minify.go
+++ b/minify.go
@@ -231,6 +231,12 @@ type minifyResponseWriter struct {
mediatype string
}
+// WriteHeader intercepts any header writes and removes the Content-Length header.
+func (w *minifyResponseWriter) WriteHeader(status int) {
+ w.ResponseWriter.Header().Del("Content-Length")
+ w.ResponseWriter.WriteHeader(status)
+}
+
// Write intercepts any writes to the response writer.
// The first write will extract the Content-Type as the mediatype. Otherwise it falls back to the RequestURI extension.
func (w *minifyResponseWriter) Write(b []byte) (int, error) {
@@ -266,7 +272,8 @@ func (m *M) ResponseWriter(w http.ResponseWriter, r *http.Request) *minifyRespon
func (m *M) Middleware(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
mw := m.ResponseWriter(w, r)
+ defer mw.Close()
+
next.ServeHTTP(mw, r)
- mw.Close()
})
} | Remove Content-Length in middleware | tdewolff_minify | train | go |
16c5605f123d9dd37b74bfaa12fa1a7c55077657 | diff --git a/satpy/tests/reader_tests/test_ami_l1b.py b/satpy/tests/reader_tests/test_ami_l1b.py
index <HASH>..<HASH> 100644
--- a/satpy/tests/reader_tests/test_ami_l1b.py
+++ b/satpy/tests/reader_tests/test_ami_l1b.py
@@ -265,8 +265,8 @@ class TestAMIL1bNetCDFIRCal(TestAMIL1bNetCDFBase):
"""Test IR specific things about the AMI reader."""
def setUp(self):
- from satpy.tests.utils import make_dataid
"""Create test data for IR calibration tests."""
+ from satpy.tests.utils import make_dataid
count_data = (np.arange(10).reshape((2, 5))) + 7000
count_data = count_data.astype(np.uint16)
count = xr.DataArray( | Stylistic change for AMI test routine | pytroll_satpy | train | py |
83c0c6a694890a6d8d896afffd646a0411427b0f | diff --git a/builder/aci.go b/builder/aci.go
index <HASH>..<HASH> 100644
--- a/builder/aci.go
+++ b/builder/aci.go
@@ -20,11 +20,11 @@ execute_files() {
fdir=$1
[ -d "$fdir" ] || return 0
- for file in $fdir/*; do
+ for file in "$fdir"/*; do
[ -e "$file" ] && {
[ -x "$file" ] || chmod +x "$file"
isLevelEnabled 4 && echo -e "\e[1m\e[32mRunning script -> $file\e[0m"
- $file
+ "$file"
}
done
}
@@ -108,10 +108,10 @@ execute_files ${CNT_PATH}/runlevels/prestart-late
`
const BUILD_SETUP = `#!/bin/sh
set -e
-. ${TARGET}/rootfs/cnt/bin/functions.sh
+. "${TARGET}/rootfs/cnt/bin/functions.sh"
isLevelEnabled "debug" && set -x
-execute_files ${BASEDIR}/runlevels/build-setup
+execute_files "${BASEDIR}/runlevels/build-setup"
`
const PATH_BIN = "/bin" | support spaces in path for build-setup | blablacar_dgr | train | go |
55f73dff69bcc68414554adb34975ce00e1c9121 | diff --git a/core/src/main/java/com/orientechnologies/orient/core/id/ORecordId.java b/core/src/main/java/com/orientechnologies/orient/core/id/ORecordId.java
index <HASH>..<HASH> 100644
--- a/core/src/main/java/com/orientechnologies/orient/core/id/ORecordId.java
+++ b/core/src/main/java/com/orientechnologies/orient/core/id/ORecordId.java
@@ -53,7 +53,7 @@ public class ORecordId implements ORID {
}
public boolean isValid() {
- return clusterId != CLUSTER_ID_INVALID && clusterPosition != CLUSTER_POS_INVALID;
+ return clusterPosition != CLUSTER_POS_INVALID;
}
@Override | Invalid RID now is only if position is -1 (before it was id == -1 && position == -1) | orientechnologies_orientdb | train | java |
6baa8e9add421114751b46ac1aa64cb32c8f253e | diff --git a/test/smoke_test.py b/test/smoke_test.py
index <HASH>..<HASH> 100755
--- a/test/smoke_test.py
+++ b/test/smoke_test.py
@@ -8,13 +8,15 @@ do_test("cd ../src/; make clean")
for mode in ["debug", "release"]:
# Build our targets
do_test("cd ../src/; nice make -j",
- { "DEBUG" : 1 if mode == "debug" else 0 },
+ { "DEBUG" : 1 if mode == "debug" else 0,
+ "UNIT_TESTS" : 1 },
cmd_format="make")
for special in ["NO_EPOLL", "MOCK_IO_LAYER", "MOCK_CACHE_CHECK", "VALGRIND"]:
do_test("cd ../src/; nice make -j",
{ "DEBUG" : 1,
- special : 1},
+ special : 1,
+ "UNIT_TESTS" : 1 },
cmd_format="make")
# Make sure auxillary tools compile
@@ -32,6 +34,9 @@ try:
# Do quick smoke tests in some environments
for (mode, checker, protocol) in [("debug", "valgrind", "text")]:
+
+ do_test("../build/%s-%s/rethindkb-unittest", mode, checker)
+
# VERY basic tests
do_test_cloud("integration/append_prepend.py",
{ "auto" : True, | Added unit tests to smoke test. | rethinkdb_rethinkdb | train | py |
4c932feb9de24793ca63bf186725c0522bc3e326 | diff --git a/src/main/java/com/github/ansell/csvsum/CSVMapping.java b/src/main/java/com/github/ansell/csvsum/CSVMapping.java
index <HASH>..<HASH> 100644
--- a/src/main/java/com/github/ansell/csvsum/CSVMapping.java
+++ b/src/main/java/com/github/ansell/csvsum/CSVMapping.java
@@ -44,16 +44,15 @@ class CSVMapping {
// Uncomment the following to debug which script engines are available on
// the classpath
- // static {
- // List<ScriptEngineFactory> factories =
- // SCRIPT_MANAGER.getEngineFactories();
- //
- // System.out.println("Installed script engines:");
- //
- // for (ScriptEngineFactory nextFactory : factories) {
- // System.out.println(nextFactory.getEngineName());
- // }
- // }
+ static {
+ List<ScriptEngineFactory> factories = SCRIPT_MANAGER.getEngineFactories();
+
+ System.out.println("Installed script engines:");
+
+ for (ScriptEngineFactory nextFactory : factories) {
+ System.out.println(nextFactory.getEngineName());
+ }
+ }
private ScriptEngine nashornEngine; | keep debugging the script engines that are available for now | ansell_csvsum | train | java |
d36e0013c04b9cc5e958d5e5d8f04dc5c98bd681 | diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/FhirVersionEnum.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/FhirVersionEnum.java
index <HASH>..<HASH> 100644
--- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/FhirVersionEnum.java
+++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/FhirVersionEnum.java
@@ -40,6 +40,8 @@ public enum FhirVersionEnum {
DSTU2_HL7ORG("org.hl7.fhir.instance.FhirDstu2Hl7Org", DSTU2, true, "1.0.2"),
+ DSTU2_1("NONE", null, true, "1.4.0"),
+
DSTU3("org.hl7.fhir.dstu3.hapi.ctx.FhirDstu3", null, true, "1.6.0");
private final FhirVersionEnum myEquivalent; | Add version constant for dstu<I> | jamesagnew_hapi-fhir | train | java |
e853e8109c1ce338d773ffdecdb9d2e71a638a47 | diff --git a/graylog2-rest-client/src/main/java/org/graylog2/restclient/lib/APIException.java b/graylog2-rest-client/src/main/java/org/graylog2/restclient/lib/APIException.java
index <HASH>..<HASH> 100644
--- a/graylog2-rest-client/src/main/java/org/graylog2/restclient/lib/APIException.java
+++ b/graylog2-rest-client/src/main/java/org/graylog2/restclient/lib/APIException.java
@@ -48,6 +48,10 @@ public class APIException extends Exception {
return response != null ? response.getStatusCode() : -1;
}
+ public byte[] getResponseBody() throws IOException {
+ return response != null ? response.getResponseBodyAsBytes() : new byte[0];
+ }
+
@Override
public String getMessage() {
final StringBuilder sb = new StringBuilder(); | Add APIException#getResponseBodyAsBytes
For some use cases getting the actual response body of a failed request (i. e. with
response codes in the 4xx or 5xx range) might be useful. | Graylog2_graylog2-server | train | java |
139fd9cd85a68d273e9efe66012dd7e072a33d8d | diff --git a/tests/TestCase/DatabaseSuite.php b/tests/TestCase/DatabaseSuite.php
index <HASH>..<HASH> 100644
--- a/tests/TestCase/DatabaseSuite.php
+++ b/tests/TestCase/DatabaseSuite.php
@@ -34,7 +34,6 @@ class DatabaseSuite extends TestSuite
public static function suite()
{
$suite = new static('Database related tests');
- $suite->addTestFile(__DIR__ . DS . 'Database' . DS . 'ConnectionTest.php');
$suite->addTestDirectoryRecursive(__DIR__ . DS . 'Database');
$suite->addTestDirectoryRecursive(__DIR__ . DS . 'ORM'); | No need to add ConnectionTest manually | cakephp_cakephp | train | php |
31ec117d09014641ffdee77f9a016619f3abe84c | diff --git a/Eloquent/BroadcastsEvents.php b/Eloquent/BroadcastsEvents.php
index <HASH>..<HASH> 100644
--- a/Eloquent/BroadcastsEvents.php
+++ b/Eloquent/BroadcastsEvents.php
@@ -124,7 +124,7 @@ trait BroadcastsEvents
*/
public function newBroadcastableModelEvent($event)
{
- return tap(new BroadcastableModelEventOccurred($this, $event), function ($event) {
+ return tap($this->withBroadcastableEvent(new BroadcastableModelEventOccurred($this, $event)), function ($event) {
$event->connection = property_exists($this, 'broadcastConnection')
? $this->broadcastConnection
: $this->broadcastConnection();
@@ -140,6 +140,17 @@ trait BroadcastsEvents
}
/**
+ * Configure the broadcastable model event for the model.
+ *
+ * @param \Illuminate\Database\Eloquent\BroadcastableModelEventOccurred $event
+ * @return \Illuminate\Database\Eloquent\BroadcastableModelEventOccurred
+ */
+ protected function withBroadcastableEvent(BroadcastableModelEventOccurred $event)
+ {
+ return $event;
+ }
+
+ /**
* Get the channels that model events should broadcast on.
*
* @param string $event | add hook to configure broadcastable model event | illuminate_database | train | php |
71f85ba9e2cf3f05abfcf9896b9e202aba2bda9a | diff --git a/lib/workers.js b/lib/workers.js
index <HASH>..<HASH> 100644
--- a/lib/workers.js
+++ b/lib/workers.js
@@ -2,7 +2,8 @@
* Tools for managing Hoodie workers
*/
-var config = require('./config'),
+var path = require('path'),
+ config = require('./config'),
client = require('./client'),
utils = require('./utils'),
_ = require('underscore');
@@ -39,7 +40,7 @@ exports.startAll = function (cfg, callback) {
var names = exports.getWorkerNames(cfg.app);
var workers = names.map(function (name) {
wconfig.name = name;
- return exports.startWorker(wconfig, hoodie);
+ return exports.startWorker(cfg.project_dir, wconfig, hoodie);
});
console.log("All workers started.");
@@ -52,9 +53,11 @@ exports.startAll = function (cfg, callback) {
* Starts the named Hoodie worker
*/
-exports.startWorker = function (wconfig, hoodie) {
+exports.startWorker = function (project_dir, wconfig, hoodie) {
console.log("Starting: '%s'", wconfig.name);
- var wmodule = require('hoodie-worker-' + wconfig.name);
+ var id = 'hoodie-worker-' + wconfig.name;
+ var p = path.resolve(project_dir, 'node_modules/' + id);
+ var wmodule = require(p);
return wmodule(utils.jsonClone(wconfig), hoodie);
}; | require workers from project_dir so we can develop using a npm linked hoodie-app | hoodiehq_hoodie-server | train | js |
6b0de3d89083f44fd7e09ea20def79b0a23d56bd | diff --git a/ck/kernel.py b/ck/kernel.py
index <HASH>..<HASH> 100644
--- a/ck/kernel.py
+++ b/ck/kernel.py
@@ -5627,6 +5627,8 @@ def list_data(i):
xd.append(fn)
# Iterate over data
+ if len(lduoa)>0:
+ xd=lduoa
for du in xd:
# print mp, du
r=find_path_to_entry({'path':mp, 'data_uoa':du}) | fixing search algo (if data_uoa_list exists) - found mistake during plotting auto-tuning grapsh | ctuning_ck | train | py |
91eac0fcc36aee834511e7af4ddc801c9118d039 | diff --git a/test/validate-token.test.js b/test/validate-token.test.js
index <HASH>..<HASH> 100644
--- a/test/validate-token.test.js
+++ b/test/validate-token.test.js
@@ -34,15 +34,7 @@ suite('seneca-user login and token validation suite tests ', function () {
before({}, function (done) {
si.ready(function (err) {
if (err) return process.exit(!console.error(err))
- done()
- })
- })
-
- test('user/register test', function (done) {
- si.act(_.extend({role: 'user', cmd: 'register'}, user1Data), function (err, data) {
- expect(err).to.not.exist()
- expect(data.user.nick).to.equal(user1Data.nick)
- done(err)
+ si.act(_.extend({role: 'user', cmd: 'register'}, user1Data), done)
})
}) | move setup from token test to before hook | senecajs_seneca-user | train | js |
a79ea032d03ef0d22b0da5fbeb94cdf40aa34f88 | diff --git a/polyfills/Event/hashchange/detect.js b/polyfills/Event/hashchange/detect.js
index <HASH>..<HASH> 100644
--- a/polyfills/Event/hashchange/detect.js
+++ b/polyfills/Event/hashchange/detect.js
@@ -1 +1 @@
-'onhashchange' in this
+'onhashchange' in this && this.onhashchange !== null | IE7 emulated using IE<I> sets this property, this ensures test parity with real IE7 | Financial-Times_polyfill-service | train | js |
3d9d3fa83407829e273b9fd51c863f426039d725 | diff --git a/qutepart/syntax/parser.py b/qutepart/syntax/parser.py
index <HASH>..<HASH> 100644
--- a/qutepart/syntax/parser.py
+++ b/qutepart/syntax/parser.py
@@ -468,7 +468,7 @@ class RegExpr(AbstractRule):
"""
match = regExp.match(string)
if match is not None and match.group(0):
- return match.group(0), match.groups()
+ return match.group(0), (match.group(0), ) + match.groups()
else:
return None, None | Fix sed parsing with dynamic reg exps | andreikop_qutepart | train | py |
aeb39de375a8b0409c78e2b9ebe7820ad25e0a97 | diff --git a/lib/CollectionItem.js b/lib/CollectionItem.js
index <HASH>..<HASH> 100644
--- a/lib/CollectionItem.js
+++ b/lib/CollectionItem.js
@@ -35,12 +35,18 @@
return (!_.isUndefined(data[key]) ? data[key] : undefinedProperty);
};
- this.merge = function(withId, callback) {
- return restHandlers.mergeItem(data.id, withId, kind, callback);
+ this.merge = function (withId, callback) {
+ return restHandlers.mergeItem(data.id, withId, kind, function (error, data, additionalData, req, res) {
+ var collectionItems = wrapCollectionItems([data], kind, options);
+ callback(error, collectionItems[0], additionalData, req, res);
+ });
};
- this.duplicate = function(callback) {
- return restHandlers.duplicateItem(data.id, kind, callback);
+ this.duplicate = function (callback) {
+ return restHandlers.duplicateItem(data.id, kind, function (error, data, additionalData, req, res) {
+ var collectionItems = wrapCollectionItems([data], kind, options);
+ callback(error, collectionItems[0], additionalData, req, res);
+ });
};
this.toObject = function() { | IND-<I> deal.merge & duplicate does not return full deal object | pipedrive_client-nodejs | train | js |
3d14bb25465587ffa8c4ea0a9d171d9d54093235 | diff --git a/bqplot/marks.py b/bqplot/marks.py
index <HASH>..<HASH> 100644
--- a/bqplot/marks.py
+++ b/bqplot/marks.py
@@ -36,7 +36,7 @@ Marks
from IPython.html.widgets import Widget, DOMWidget, CallbackDispatcher, Color
from IPython.utils.traitlets import (Int, Unicode, List, Enum, Dict, Bool,
Float, TraitError, Instance)
-
+from .scales import Scale
from .traits import NdArray, BoundedFloat, Date
from .colorschemes import CATEGORY10, CATEGORY20, CATEGORY20b, CATEGORY20c
@@ -148,7 +148,7 @@ class Mark(Widget):
that triggered the tooltip to be visible.
"""
mark_types = {}
- scales = Dict(sync=True)
+ scales = Dict(trait=Instance(Scale), sync=True)
scales_metadata = Dict(sync=True)
preserve_domain = Dict(allow_none=False, sync=True)
display_legend = Bool(False, sync=True, exposed=True, display_index=1, | Validate that scales is a dictionary of scales | bloomberg_bqplot | train | py |
b71479138be82c6ed705194172ed959bd1ff3ea9 | diff --git a/src/Administration/Resources/administration/src/module/sw-customer/page/sw-customer-detail/index.js b/src/Administration/Resources/administration/src/module/sw-customer/page/sw-customer-detail/index.js
index <HASH>..<HASH> 100644
--- a/src/Administration/Resources/administration/src/module/sw-customer/page/sw-customer-detail/index.js
+++ b/src/Administration/Resources/administration/src/module/sw-customer/page/sw-customer-detail/index.js
@@ -91,11 +91,6 @@ Component.register('sw-customer-detail', {
criteria.push(CriteriaFactory.term('customer_address.customerId', this.customerId));
params.criteria = CriteriaFactory.nested('AND', ...criteria);
- // todo: this has to be done after the customer has been loaded
- // this.customerAddressStore.getList(params).then((response) => {
- // this.customer.addresses = response.items;
- // });
-
this.touchpointStore.getList({ offset: 0, limit: 100 }).then((response) => {
this.touchpoints = response.items;
}); | NEXT-<I> - Replace application with touchpoint | shopware_platform | train | js |
d47278df994845ec22bae2e20b43f297edd33118 | diff --git a/src/motor-html/base.js b/src/motor-html/base.js
index <HASH>..<HASH> 100644
--- a/src/motor-html/base.js
+++ b/src/motor-html/base.js
@@ -155,24 +155,8 @@ export function initMotorHTMLBase() {
this._resolveReadyPromise = null
this.ready = new Promise(r => this._resolveReadyPromise = r)
- }
- // called by WebComponent#connectedCallback()
- init() {
-
- // XXX: we call this._associateImperativeNode() before super.init() because
- // super.init() may call this.childConnectedCallback() which depends
- // on the imperative counterpart existing.
- //
- // TODO: Maybe this can be called in childConnectedCallback instead
- // of connectedCallback, where in that case the parent will know if
- // the child is instanceof MotorHTMLNode. This would prevent init
- // logic from happening when a MotorHTMLNode is incorrectly
- // connected to something other than another MotorHTMLNode or
- // MotorHTMLScene.
this._associateImperativeNode()
-
- super.init()
}
/** | Just a motor-html node's imperative counterpart on construction, so that the API is available while the element hasn'tyet tobe connected to DOM. A user might like to modify position, rotation, etc, without errors before inserting the element into DOM. | trusktr_infamous | train | js |
8d09533d8ba43a519831e14c29a9916c7b1f4f43 | diff --git a/wikidataintegrator/sdc_core.py b/wikidataintegrator/sdc_core.py
index <HASH>..<HASH> 100755
--- a/wikidataintegrator/sdc_core.py
+++ b/wikidataintegrator/sdc_core.py
@@ -3101,7 +3101,7 @@ class WDGlobeCoordinate(WDBaseDataType):
"""
Implements the Wikidata data type for globe coordinates
"""
- DTYPE = 'globe-coordinate'
+ DTYPE = 'globecoordinate'
def __init__(self, latitude, longitude, precision, prop_nr, globe=None,
concept_base_uri=None, is_reference=False, is_qualifier=False, | globe-coordinate -> globecoordinate | SuLab_WikidataIntegrator | train | py |
17275a53b1caf98b75e10a0f6b132e8eb2c1630b | diff --git a/src/Duration.php b/src/Duration.php
index <HASH>..<HASH> 100644
--- a/src/Duration.php
+++ b/src/Duration.php
@@ -9,8 +9,6 @@ use Brick\DateTime\Utility\Cast;
* Represents a duration of time measured in seconds.
*
* This class is immutable.
- *
- * @todo format() method to output something like 3 hours, 4 minutes and 30 seconds
*/
class Duration
{ | Removed todo about Duration::format()
Date-time formatters will come in a future version, and will include a Duration formatter. | brick_date-time | train | php |
b5ca37a7646a34ddfd14d8e256dee83362c0aefd | diff --git a/core/pax-exam/src/main/java/org/ops4j/pax/exam/Constants.java b/core/pax-exam/src/main/java/org/ops4j/pax/exam/Constants.java
index <HASH>..<HASH> 100644
--- a/core/pax-exam/src/main/java/org/ops4j/pax/exam/Constants.java
+++ b/core/pax-exam/src/main/java/org/ops4j/pax/exam/Constants.java
@@ -23,18 +23,22 @@ package org.ops4j.pax.exam;
* @author Alin Dreghiciu ([email protected])
* @since 0.5.0, April 22, 2009
*/
-public interface Constants
-{
+public interface Constants {
/**
* The start level at which Pax Exam system bundles are to be started.
*/
- static final int START_LEVEL_SYSTEM_BUNDLES = 1;
+ static final int START_LEVEL_SYSTEM_BUNDLES = 2;
/**
- * The start level at which Pax Exam regression bundle is to be started.
+ * The start level at which Pax Exam test bundle is to be started.
*/
- static final int START_LEVEL_TEST_BUNDLE = 2;
+ static final int START_LEVEL_DEFAULT_PROVISION = 3;
+
+ /**
+ * The start level at which Pax Exam test bundle is to be started. This is also the startlevel, the test container reaches in start.
+ */
+ static final int START_LEVEL_TEST_BUNDLE = 5;
/**
* Timeout specifing that there should be no waiting. | more constants (startlevel related) | ops4j_org.ops4j.pax.exam2 | train | java |
4477ba37cef3e59d3e06e5fd2f22282853382e08 | diff --git a/src/core/effect-composer.js b/src/core/effect-composer.js
index <HASH>..<HASH> 100644
--- a/src/core/effect-composer.js
+++ b/src/core/effect-composer.js
@@ -200,6 +200,7 @@ export class EffectComposer {
stencilBuffer: stencilBuffer
});
+ renderTarget.texture.name = "EffectComposer.Buffer";
renderTarget.texture.generateMipmaps = false;
if(depthTexture) { | Add a name to new render textures. | vanruesc_postprocessing | train | js |
31739976d5ad70ac3cbf507ee2a378f26045278a | diff --git a/satpy/scene.py b/satpy/scene.py
index <HASH>..<HASH> 100644
--- a/satpy/scene.py
+++ b/satpy/scene.py
@@ -1046,8 +1046,12 @@ class Scene(MetadataObject):
factor = resample_kwargs.get('shape_divisible_by', 2)
else:
factor = None
- slice_x, slice_y = source_area.get_area_slices(
- destination_area, shape_divisible_by=factor)
+ try:
+ slice_x, slice_y = source_area.get_area_slices(
+ destination_area, shape_divisible_by=factor)
+ except TypeError:
+ slice_x, slice_y = source_area.get_area_slices(
+ destination_area)
source_area = source_area[slice_y, slice_x]
reductions[key] = (slice_x, slice_y), source_area
dataset = self._slice_data(source_area, (slice_x, slice_y), dataset) | Add workaround for unreleased pyresample and slicing for divisible shape | pytroll_satpy | train | py |
b729e450abb972d319154845c50f015a05103f36 | diff --git a/src/main/java/com/moandjiezana/toml/DateSerializer.java b/src/main/java/com/moandjiezana/toml/DateSerializer.java
index <HASH>..<HASH> 100644
--- a/src/main/java/com/moandjiezana/toml/DateSerializer.java
+++ b/src/main/java/com/moandjiezana/toml/DateSerializer.java
@@ -8,7 +8,6 @@ import java.util.GregorianCalendar;
class DateSerializer implements Serializer {
static final Serializer DATE_SERIALIZER = new DateSerializer();
private static final Calendar calendar = new GregorianCalendar();
- private static final SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:m:ss");
@Override
public boolean canSerialize(Object value) {
@@ -17,6 +16,7 @@ class DateSerializer implements Serializer {
@Override
public void serialize(Object value, SerializerContext context) {
+ SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:m:ss");
context.serialized.append(dateFormat.format(value));
int tzOffset = (calendar.get(Calendar.ZONE_OFFSET) + calendar.get(Calendar.DST_OFFSET)) / (60 * 1000);
context.serialized.append(String.format("%+03d:%02d", tzOffset / 60, tzOffset % 60)); | Fix thread-safety issue in DateSerializer. | mwanji_toml4j | train | java |
edd99023a66b6efe68bac6b9b765afdef194a5a5 | diff --git a/lib/myprofilelib.php b/lib/myprofilelib.php
index <HASH>..<HASH> 100644
--- a/lib/myprofilelib.php
+++ b/lib/myprofilelib.php
@@ -192,13 +192,13 @@ function core_myprofile_navigation(core_user\output\myprofile\tree $tree, $user,
if (isset($identityfields['department']) && $user->department) {
$node = new core_user\output\myprofile\node('contact', 'department', get_string('department'), null, null,
- $user->institution);
+ $user->department);
$tree->add_node($node);
}
if (isset($identityfields['idnumber']) && $user->idnumber) {
$node = new core_user\output\myprofile\node('contact', 'idnumber', get_string('idnumber'), null, null,
- $user->institution);
+ $user->idnumber);
$tree->add_node($node);
} | MDL-<I> user: Profile fields display properly
The department and idnumber fields were not displaying
properly on the user profile pages. | moodle_moodle | train | php |
0b0085d252ee770480de86e000fc8810526a9971 | diff --git a/core/src/main/java/jenkins/monitor/JavaVersionRecommendationAdminMonitor.java b/core/src/main/java/jenkins/monitor/JavaVersionRecommendationAdminMonitor.java
index <HASH>..<HASH> 100644
--- a/core/src/main/java/jenkins/monitor/JavaVersionRecommendationAdminMonitor.java
+++ b/core/src/main/java/jenkins/monitor/JavaVersionRecommendationAdminMonitor.java
@@ -28,6 +28,7 @@ import hudson.Extension;
import hudson.model.AdministrativeMonitor;
import hudson.security.Permission;
import jenkins.model.Jenkins;
+import jenkins.util.SystemProperties;
import jenkins.util.java.JavaUtils;
import org.jenkinsci.Symbol;
import org.kohsuke.accmod.Restricted;
@@ -46,9 +47,11 @@ import java.io.IOException;
@Symbol("javaVersionRecommendation")
public class JavaVersionRecommendationAdminMonitor extends AdministrativeMonitor {
+ private static Boolean disabled = SystemProperties.getBoolean(JavaVersionRecommendationAdminMonitor.class.getName() + ".disabled", false);
+
@Override
public boolean isActivated() {
- return JavaUtils.isRunningWithJava8OrBelow();
+ return !disabled && JavaUtils.isRunningWithJava8OrBelow();
}
@Override | [JENKINS-<I>] Ability to disable Java <I> monitor (#<I>) | jenkinsci_jenkins | train | java |
6c583c75f9ce14c332590e34b2e97a9c3e748deb | diff --git a/lib/phpunit/lib.php b/lib/phpunit/lib.php
index <HASH>..<HASH> 100644
--- a/lib/phpunit/lib.php
+++ b/lib/phpunit/lib.php
@@ -72,6 +72,10 @@ class phpunit_util {
*/
public static function acquire_test_lock() {
global $CFG;
+ if (!file_exists("$CFG->phpunit_dataroot/phpunit")) {
+ // dataroot not initialised yet
+ return;
+ }
if (!file_exists("$CFG->phpunit_dataroot/phpunit/lock")) {
file_put_contents("$CFG->phpunit_dataroot/phpunit/lock", 'This file prevents concurrent execution of Moodle PHPUnit tests');
phpunit_boostrap_fix_file_permissions("$CFG->phpunit_dataroot/phpunit/lock"); | MDL-<I> do lot try to acquire lock before dataroot init | moodle_moodle | train | php |
0e8653d6533dc50639f7d20f8421ca80d61bcc30 | diff --git a/server/src/main/java/org/jboss/as/server/deployment/Phase.java b/server/src/main/java/org/jboss/as/server/deployment/Phase.java
index <HASH>..<HASH> 100644
--- a/server/src/main/java/org/jboss/as/server/deployment/Phase.java
+++ b/server/src/main/java/org/jboss/as/server/deployment/Phase.java
@@ -319,8 +319,9 @@ public enum Phase {
public static final int POST_MODULE_EJB_REF = 0x1500;
public static final int POST_MODULE_PERSISTENCE_REF = 0x1600;
public static final int POST_MODULE_DATASOURCE_REF = 0x1700;
- public static final int POST_MODULE_WS_REF_ANNOTATION = 0x1800;
- public static final int POST_MODULE_WS_JMS_INTEGRATION = 0x1801;
+ public static final int POST_MODULE_WS_REF_DESCRIPTOR = 0x1800;
+ public static final int POST_MODULE_WS_REF_ANNOTATION = 0x1801;
+ public static final int POST_MODULE_WS_JMS_INTEGRATION = 0x1802;
public static final int POST_MODULE_JAXRS_SCANNING = 0x1A00;
public static final int POST_MODULE_JAXRS_COMPONENT = 0x1B00;
public static final int POST_MODULE_JAXRS_CDI_INTEGRATION = 0x1C00; | introducing WSRefDDProcessor
was: <I>b<I>b<I>f3d<I>cda<I>c<I>f4d<I>f | wildfly_wildfly-core | train | java |
4209fdaafcd50ba4be40ee0d4bc96ed3ecf363d8 | diff --git a/lib/train/extras/windows_file.rb b/lib/train/extras/windows_file.rb
index <HASH>..<HASH> 100644
--- a/lib/train/extras/windows_file.rb
+++ b/lib/train/extras/windows_file.rb
@@ -26,7 +26,9 @@ module Train::Extras
end
def exist?
- nil
+ return @exist if defined?(@exist)
+ @exist = @backend.run_command(
+ "(Test-Path -Path \"#{@spath}\").ToString()").stdout.chomp == 'True'
end
def link_target | Implemented WindowsFile#exist?
It was missing and not raising an error, which caused much confusion.
See <URL> | inspec_train | train | rb |
8ec77292b397f236818f0ebe0d276344cf814457 | diff --git a/index.js b/index.js
index <HASH>..<HASH> 100644
--- a/index.js
+++ b/index.js
@@ -42,7 +42,9 @@ var Utils = function (opts) {
folderPath.pop();
folderPath = folderPath.join('/');
- this.newFolder(folderPath);
+ if (!fs.existsSync(folderPath))
+ this.newFolder(folderPath);
+
fs.writeFileSync(path, content);
return this.log('Created file: ' + path);
},
diff --git a/package.json b/package.json
index <HASH>..<HASH> 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "uo-node-utils",
- "version": "0.0.3",
+ "version": "0.0.30",
"description": "Bunch of NodeJS toosl",
"main": "index.js",
"scripts": {
diff --git a/tests.js b/tests.js
index <HASH>..<HASH> 100644
--- a/tests.js
+++ b/tests.js
@@ -18,6 +18,7 @@ u.fnTest();
u.newFolder('foo');
u.newFile('foo/bar/baz.txt', 'Hello world!');
+u.newFile('foo/bar/foo.txt', 'Hello world!');
// console.log(u.readFile('foo/bar/baz.txt')); | #1 | Test if folder exist before generate it in newFile() | ugogo_node-utils | train | js,json,js |
0c514d3a9590de0dbcf7c85343bf8155fb51ebbc | diff --git a/packages/node_modules/@webex/webex-core/src/lib/storage/memory-store-adapter.js b/packages/node_modules/@webex/webex-core/src/lib/storage/memory-store-adapter.js
index <HASH>..<HASH> 100644
--- a/packages/node_modules/@webex/webex-core/src/lib/storage/memory-store-adapter.js
+++ b/packages/node_modules/@webex/webex-core/src/lib/storage/memory-store-adapter.js
@@ -24,7 +24,7 @@ function _bind(namespace, options = {}) {
const {logger} = options;
- const map = new Map();
+ const map = new Map([['@', {}]]);
if (options.data) {
Object.keys(options.data).forEach((key) => { | refactor(dev): stop uncaught exception with make storage | webex_spark-js-sdk | train | js |
9b619942e5e8f48b91f7f801ab36c0ee05077d7c | diff --git a/lib/relationships.js b/lib/relationships.js
index <HASH>..<HASH> 100644
--- a/lib/relationships.js
+++ b/lib/relationships.js
@@ -14,6 +14,9 @@ module.exports = function (app, options) {
if (utils.shouldNotApplyJsonApi(ctx, options)) {
return next();
};
+
+ if (ctx.method.name !== 'updateAttributes') return next();
+
id = ctx.req.params.id;
data = options.data;
model = utils.getModelFromContext(ctx, app); | Restrict relationships call to updateAttributes
I believe what was happening was that in some
edge cases, GET requests were making it through
later relationship method checks.
Its more explicit and safe to just check what method
was called and restrict to the correct only | digitalsadhu_loopback-component-jsonapi | train | js |
0f1cc9e3aba1eeda78bf2b28b3c42d948091daf8 | diff --git a/src/nicoSWD/Rules/AST/BaseNode.php b/src/nicoSWD/Rules/AST/BaseNode.php
index <HASH>..<HASH> 100755
--- a/src/nicoSWD/Rules/AST/BaseNode.php
+++ b/src/nicoSWD/Rules/AST/BaseNode.php
@@ -137,7 +137,9 @@ abstract class BaseNode
$value = $current->getValue();
- if ($current->getGroup() === Constants::GROUP_VALUE) {
+ if ($current instanceof Tokens\TokenMethod) {
+ continue;
+ } elseif ($current->getGroup() === Constants::GROUP_VALUE) {
if ($commaExpected) {
throw new ParserException(sprintf(
'Unexpected value at position %d on line %d', | Attempt to fix build for PHP 7 | nicoSWD_php-rule-parser | train | php |
d080de91629ab1a27116eee6456cdd6bb6dad5a2 | diff --git a/bin/cli.js b/bin/cli.js
index <HASH>..<HASH> 100755
--- a/bin/cli.js
+++ b/bin/cli.js
@@ -19,7 +19,7 @@ usage = [
, ' md5-hex'
, ' md5-b64'
, ' sha1-hex'
- , ' sha1-hex'
+ , ' sha1-b64'
, ' sha256-hex'
, ' sha256-b64'
, ' sha512-hex'
@@ -45,7 +45,7 @@ options = [
'md5-hex'
,'md5-b64'
,'sha1-hex'
- ,'sha1-hex'
+ ,'sha1-b64'
,'sha256-hex'
,'sha256-b64'
,'sha512-hex' | allowing sha1-b<I> | h2non_jshashes | train | js |
ec0d7765a66c609fddaf82e2aa364a74b45adbe4 | diff --git a/spec/refile/spec_helper.rb b/spec/refile/spec_helper.rb
index <HASH>..<HASH> 100644
--- a/spec/refile/spec_helper.rb
+++ b/spec/refile/spec_helper.rb
@@ -1,3 +1,5 @@
+ENV["RACK_ENV"] = "test"
+
require "refile"
require "refile/backend_examples"
require "webmock/rspec" | Set RACK_ENV to "test" in spec_helper.rb
This way both Refile::App and the test Rails app will always run in test
environment. | refile_refile | train | rb |
037f2c016e20ecad0c6148abcc892eff0244f0be | diff --git a/lib/Cake/Console/Command/SchemaShell.php b/lib/Cake/Console/Command/SchemaShell.php
index <HASH>..<HASH> 100644
--- a/lib/Cake/Console/Command/SchemaShell.php
+++ b/lib/Cake/Console/Command/SchemaShell.php
@@ -170,7 +170,7 @@ class SchemaShell extends Shell {
$count = 0;
if (!empty($result[1])) {
foreach ($result[1] as $file) {
- if (preg_match('/'.$fileName.'(?:[_\d]*)?\.php$/', $file)) {
+ if (preg_match('/'.preg_quote($fileName).'(?:[_\d]*)?\.php$/', $file)) {
$count++;
}
} | preg_quote'd $fileName to avoid issues when using a special character in their schema filename | cakephp_cakephp | train | php |
00def1a7a8bea5dc2ea06564f536782495d28304 | diff --git a/model/ChangeHistory.js b/model/ChangeHistory.js
index <HASH>..<HASH> 100644
--- a/model/ChangeHistory.js
+++ b/model/ChangeHistory.js
@@ -1,6 +1,10 @@
class ChangeHistory {
constructor() {
+ this.reset()
+ }
+
+ reset() {
// undo list
this.doneChanges = []
// redo list
diff --git a/ui/EditorSession.js b/ui/EditorSession.js
index <HASH>..<HASH> 100644
--- a/ui/EditorSession.js
+++ b/ui/EditorSession.js
@@ -135,6 +135,7 @@ class EditorSession extends EventEmitter {
this.markersManager.dispose()
}
+
hasChanged(resource) {
return this._dirtyFlags[resource]
}
@@ -234,6 +235,16 @@ class EditorSession extends EventEmitter {
return this._history.canRedo()
}
+ /*
+ There are cases when we want to explicitly reset the change history of
+ an editor session
+ */
+ resetHistory() {
+ this._history.reset()
+ this._setDirty('commandStates')
+ this.startFlow()
+ }
+
executeCommand(...args) {
this.commandManager.executeCommand(...args)
} | Allow explicitly resetting change history of an EditorSession. | substance_substance | train | js,js |
2c4133945d4d14593cc02b09e344d6e82e620e89 | diff --git a/src/utils/client.js b/src/utils/client.js
index <HASH>..<HASH> 100644
--- a/src/utils/client.js
+++ b/src/utils/client.js
@@ -5,17 +5,29 @@ import fetch from 'unfetch';
* See https://github.com/feathersjs/feathers-rest/blob/master/src/client/fetch.js
*/
function checkStatus(response) {
+ let rejectAsError;
+
if (response.ok) {
return response;
}
+ rejectAsError = (body = {}) => {
+ let code = body.code || response.status,
+ statusText = body.statusText || response.statusText,
+ error = new Error(statusText);
+
+ error.code = code;
+ error.statusText = statusText;
+
+ return Promise.reject(error);
+ }
+
return Promise.resolve()
.then(() => response.json())
- .then(error => {
- error.code = error.code || response.status;
- error.statusText = error.statusText || response.statusText;
- return Promise.reject(error);
- });
+ .then(
+ (body) => rejectAsError(body),
+ () => rejectAsError({ code: response.status, statusText: response.statusText })
+ );
}
function request(options) { | Make sure client deals with JSON parse errors | simplajs_simpla | train | js |
30cb1ec062335d776becbeaa8c57da47edc7511d | diff --git a/src/Helper/ProgramExecution.php b/src/Helper/ProgramExecution.php
index <HASH>..<HASH> 100644
--- a/src/Helper/ProgramExecution.php
+++ b/src/Helper/ProgramExecution.php
@@ -82,9 +82,9 @@ class ProgramExecution
* redirected to /dev/null.
* @param null|string $stderr The filename to redirect the standard error. If null the standard error is
* redirected to the standard output. Use '/dev/null' to ignore standard error.
- * @param int[] $returnVars The allowed return statuses. If the return status of the command is not in
- * this array an exception will be thrown. An empty array or null will allow all
- * return statuses.
+ * @param null|int[] $returnVars The allowed return statuses. If the return status of the command is not in
+ * this array an exception will be thrown. Null will allow all return statuses and an
+ * empty array will throw an exception always.
*
* @return int The exit status of the external program.
*
@@ -116,7 +116,7 @@ class ProgramExecution
exec($command, $output, $return_var);
- if (!empty($returnVars) && !in_array($return_var, $returnVars))
+ if (is_array($returnVars) && !in_array($return_var, $returnVars))
{
throw new ProgramExecutionException($command, $return_var, $output);
} | Changed behaviour of allowed return statuses. | SetBased_php-helper-program-execution | train | php |
40fe3a504064e226023ce6119afc92abc732f4ef | diff --git a/angularjs-portal-home/src/main/webapp/js/master-app-config.js b/angularjs-portal-home/src/main/webapp/js/master-app-config.js
index <HASH>..<HASH> 100644
--- a/angularjs-portal-home/src/main/webapp/js/master-app-config.js
+++ b/angularjs-portal-home/src/main/webapp/js/master-app-config.js
@@ -43,7 +43,7 @@ define(['angular'], function(angular) {
'whatsNewURL' : null,
'helpdeskURL' : null,
'webSearchURL' : 'http://www.google.com/search?q=',
- 'webSearchDomain' = null,
+ 'webSearchDomain' : null,
'directorySearchURL' : null,
'kbSearchURL' : null,
'eventsSearchURL' : null, | MUMUP-<I> Fixes = sign bug in master-app-config | uPortal-Project_uportal-home | train | js |
ddce0d71f5e404339826b17d0272cf396840759f | diff --git a/examples/mocha-chai-test-example.js b/examples/mocha-chai-test-example.js
index <HASH>..<HASH> 100644
--- a/examples/mocha-chai-test-example.js
+++ b/examples/mocha-chai-test-example.js
@@ -35,7 +35,7 @@ describe('When clicking on the image of the demo playground', function () {
.wait('#root')
- const url = awaitchromeless.evaluate(url => window.location.href)
+ const url = await chromeless.evaluate(url => window.location.href)
expect(url).to.match(/^https\:\/\/chromeless\.netlify\.com/) | Fixes a typo
On line <I>. `await chromeless.evaluate` was `awaitchromeless.evaluate` before | prisma-archive_chromeless | train | js |
d56d23ca7f54c04626373f4fee36be8170421062 | diff --git a/Installation/Updater/Updater020300.php b/Installation/Updater/Updater020300.php
index <HASH>..<HASH> 100644
--- a/Installation/Updater/Updater020300.php
+++ b/Installation/Updater/Updater020300.php
@@ -32,14 +32,14 @@ class Updater020300
$forums = $em->getRepository('ClarolineForumBundle:Forum')->findAll();
foreach ($forums as $forum) {
- $categories = $forum->getCategories();
+ $categories = $forum->getCategories();
- foreach ($categories as $cat) {
- $subjects = $cat->getSubjects();
+ foreach ($categories as $cat) {
+ $subjects = $cat->getSubjects();
- foreach ($subjects as $subject) {
- $subject->isClosed(false);
- }
+ foreach ($subjects as $subject) {
+ $subject->isClosed(false);
+ }
}
} | [ForumBundle] Replaced tabs by spaces | claroline_Distribution | train | php |
7aee9bcb38ad1521a53c058c145cecef473eacfb | diff --git a/salt/runners/manage.py b/salt/runners/manage.py
index <HASH>..<HASH> 100644
--- a/salt/runners/manage.py
+++ b/salt/runners/manage.py
@@ -331,10 +331,10 @@ def bootstrap(version='develop',
# pass better options to ssh, etc)
subprocess.call(['ssh',
'root@' if root_user else '' + host,
- 'python -c 'import urllib; '
+ 'python -c \'import urllib; '
'print urllib.urlopen('
'\'' + script + '\''
- ').read()' | sh -s -- git ' + version])
+ ').read()\' | sh -s -- git ' + version])
def bootstrap_psexec(hosts='', master=None, version=None, arch='win32', | Fix syntax error I failed to see when merging #<I> | saltstack_salt | train | py |
d433290bfb9583619448ca94195fa607412807d7 | diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -28,7 +28,7 @@ if __name__ == '__main__':
description=about['__description__'],
url=about['__url__'],
license='BSD',
- packages=setuptools.find_packages(),
+ packages=setuptools.find_packages(exclude=['tests']),
long_description=long_description,
install_requires=['six'],
tests_require=['pytest'], | do not install a global 'tests' package
setuptools.find_packages() finds all valid packages by default that
incidentally includes the test directory that gets installed as global
'tests'. Add an explicit exclude to avoid that. | WoLpH_python-utils | train | py |
73392ff6fb9b242ffb8a3875f43d0956f5e81659 | diff --git a/Bundle/CoreBundle/Helper/ViewHelper.php b/Bundle/CoreBundle/Helper/ViewHelper.php
index <HASH>..<HASH> 100644
--- a/Bundle/CoreBundle/Helper/ViewHelper.php
+++ b/Bundle/CoreBundle/Helper/ViewHelper.php
@@ -75,7 +75,7 @@ class ViewHelper
public function cleanVirtualViews(&$viewsReferences)
{
foreach ($viewsReferences as $viewReference) {
- // If viewReference is a persisted page
+ // If viewReference is a persisted page, we want to clean virtual BEPs
if ($viewReference['viewNamespace'] == 'Victoire\Bundle\BusinessEntityPageBundle\Entity\BusinessEntityPage') {
array_walk($viewsReferences, function ($_viewReference, $key) use ($viewReference, &$viewsReferences) {
if ($_viewReference['viewNamespace'] == 'Victoire\Bundle\BusinessEntityPageBundle\Entity\BusinessEntityPagePattern' | ICMS-<I>
add more detailed doc | Victoire_victoire | train | php |
f06e4d5b7157bca3f3ac1114242617a9b1b7733b | diff --git a/addon/mixins/sortable-item.js b/addon/mixins/sortable-item.js
index <HASH>..<HASH> 100644
--- a/addon/mixins/sortable-item.js
+++ b/addon/mixins/sortable-item.js
@@ -8,9 +8,9 @@ import { throttle } from 'ember-runloop';
const { Mixin, $, run } = Ember;
const { Promise } = Ember.RSVP;
-const dragActions = 'mousemove touchmove';
-const elementClickAction = 'click';
-const endActions = 'click mouseup touchend';
+const dragActions = 'mousemove.emberSortable touchmove.emberSortable';
+const elementClickAction = 'click.emberSortable';
+const endActions = 'click.emberSortable mouseup.emberSortable touchend.emberSortable';
export default Mixin.create({
classNames: ['sortable-item'], | Add namespaces to registered events.
This helps to identify the source of any orphaned listeners as well as
to simplify teardown. | heroku_ember-sortable | train | js |
017e559c5c99a4776ca9a370305e68bff94dc988 | diff --git a/tests/Plugins/AbstractPluginTest.php b/tests/Plugins/AbstractPluginTest.php
index <HASH>..<HASH> 100644
--- a/tests/Plugins/AbstractPluginTest.php
+++ b/tests/Plugins/AbstractPluginTest.php
@@ -160,6 +160,7 @@ abstract class AbstractPluginTest extends \PHPUnit_Framework_TestCase
foreach ($callbackArgument as $value) {
$this->assertTrue(strlen($value->getKey()) > 0);
$this->assertTrue(strlen($value->getValue()) > 0);
+ $this->assertTrue(is_numeric($value->getValue()));
}
$callbackRan = false; | Added a test to make sure the value of something is numeric | WyriHaximus_PhuninNode | train | php |
8b2e1ad221b37c41fc624d780faf2e98f7444264 | diff --git a/Console/Command/TranslationsShell.php b/Console/Command/TranslationsShell.php
index <HASH>..<HASH> 100644
--- a/Console/Command/TranslationsShell.php
+++ b/Console/Command/TranslationsShell.php
@@ -154,6 +154,7 @@ class TranslationsShell extends AppShell {
*
* @param string $name
* @return Controller
+ * @codeCoverageIgnore
*/
protected function _loadController($name, $plugin) {
$className = $name . 'Controller'; | ignore _loadController for code coverage
since this function loads clases, it's not practical to unit test this | FriendsOfCake_crud-json-api | train | php |
e3aafaa352bf3d10e503dabcb7dbe26f839ee05c | diff --git a/tcconfig/_iptables.py b/tcconfig/_iptables.py
index <HASH>..<HASH> 100644
--- a/tcconfig/_iptables.py
+++ b/tcconfig/_iptables.py
@@ -174,6 +174,8 @@ class IptablesMangleController(object):
raise RuntimeError("usable mark id not found")
def parse(self):
+ MANGLE_ITEM_COUNT = 6
+
for block in split_line_list(self.get_iptables().splitlines()):
if len(block) <= 1:
# skip if no entry exists
@@ -187,7 +189,7 @@ class IptablesMangleController(object):
for line in reversed(block[2:]):
item_list = line.split()
- if len(item_list) < 6:
+ if len(item_list) < MANGLE_ITEM_COUNT:
continue
line_number = int(item_list[0]) | Replace a magic number to a constant variable | thombashi_tcconfig | train | py |
5ce60217f1ba07015af72978e715a08259e2efc1 | diff --git a/daemon/execdriver/native/template/default_template.go b/daemon/execdriver/native/template/default_template.go
index <HASH>..<HASH> 100644
--- a/daemon/execdriver/native/template/default_template.go
+++ b/daemon/execdriver/native/template/default_template.go
@@ -25,13 +25,13 @@ func New() *libcontainer.Config {
"KILL",
"AUDIT_WRITE",
},
- Namespaces: libcontainer.Namespaces{
+ Namespaces: libcontainer.Namespaces([]libcontainer.Namespace{
{Type: "NEWNS"},
{Type: "NEWUTS"},
{Type: "NEWIPC"},
{Type: "NEWPID"},
{Type: "NEWNET"},
- },
+ }),
Cgroups: &cgroups.Cgroup{
Parent: "docker",
AllowAllDevices: false, | Calming vet about type aliases from other package | moby_moby | train | go |
f15a6bf6e4ed78baa732be8702a8885c84d922f1 | diff --git a/src/python/grpcio/grpc/experimental/__init__.py b/src/python/grpcio/grpc/experimental/__init__.py
index <HASH>..<HASH> 100644
--- a/src/python/grpcio/grpc/experimental/__init__.py
+++ b/src/python/grpcio/grpc/experimental/__init__.py
@@ -85,6 +85,6 @@ __all__ = (
'insecure_channel_credentials',
)
-if sys.version_info[0] >= 3:
+if sys.version_info[0] == 3 and sys.version_info[1] >= 6:
from grpc._simple_stubs import unary_unary, unary_stream, stream_unary, stream_stream
__all__ = __all__ + (unary_unary, unary_stream, stream_unary, stream_stream) | Add version check for Python <I> to simple stubs | grpc_grpc | train | py |
1b777511152f0cdced850e92a6709836ca805b18 | diff --git a/src/Illuminate/Database/Eloquent/Relations/BelongsToMany.php b/src/Illuminate/Database/Eloquent/Relations/BelongsToMany.php
index <HASH>..<HASH> 100755
--- a/src/Illuminate/Database/Eloquent/Relations/BelongsToMany.php
+++ b/src/Illuminate/Database/Eloquent/Relations/BelongsToMany.php
@@ -1003,15 +1003,15 @@ class BelongsToMany extends Relation
$query->whereIn($this->otherKey, (array) $ids);
}
- if ($touch) {
- $this->touchIfTouching();
- }
-
// Once we have all of the conditions set on the statement, we are ready
// to run the delete on the pivot table. Then, if the touch parameter
// is true, we will go ahead and touch all related models to sync.
$results = $query->delete();
+ if ($touch) {
+ $this->touchIfTouching();
+ }
+
return $results;
} | Fix order calling touchIfTouching method | laravel_framework | train | php |
0d2acf5923474cc1af65252fba34afb9d96aabca | diff --git a/spi/src/main/java/org/jboss/as/console/client/plugins/RuntimeExtensionmetaData.java b/spi/src/main/java/org/jboss/as/console/client/plugins/RuntimeExtensionmetaData.java
index <HASH>..<HASH> 100644
--- a/spi/src/main/java/org/jboss/as/console/client/plugins/RuntimeExtensionmetaData.java
+++ b/spi/src/main/java/org/jboss/as/console/client/plugins/RuntimeExtensionmetaData.java
@@ -4,14 +4,14 @@ package org.jboss.as.console.client.plugins;
* @author Heiko Braun
* @date 3/26/12
*/
-public class RuntimeExtensionMetaData {
+public class RuntimeExtensionmetaData {
private String token;
private String name;
private String group;
private String key;
- public RuntimeExtensionMetaData(String name, String token, String group, String key) {
+ public RuntimeExtensionmetaData(String name, String token, String group, String key) {
this.name = name;
this.token = token;
this.group = group; | weird classname problem (IDE bug?) | hal_core | train | java |
65d9c7bef2d3a8dd8ba56974def28b867a3e0d97 | diff --git a/ecurve.js b/ecurve.js
index <HASH>..<HASH> 100644
--- a/ecurve.js
+++ b/ecurve.js
@@ -34,7 +34,10 @@ function isPoint (p) {
const x = p.slice(1, 33)
if (x.compare(ZERO32) === 0) return false
if (x.compare(EC_P) >= 0) return false
- if ((t === 0x02 || t === 0x03) && p.length === 33) return true
+ if ((t === 0x02 || t === 0x03) && p.length === 33) {
+ try { decodeFrom(p) } catch (e) { return false } // TODO: temporary
+ return true
+ }
const y = p.slice(33)
if (y.compare(ZERO32) === 0) return false | fix isPoint inconsistency with native library | bitcoinjs_tiny-secp256k1 | train | js |
77d707bbb29d118e97535d3c1ea475208e845063 | diff --git a/js/kucoin.js b/js/kucoin.js
index <HASH>..<HASH> 100644
--- a/js/kucoin.js
+++ b/js/kucoin.js
@@ -2860,6 +2860,9 @@ module.exports = class kucoin extends Exchange {
if (marginMode === undefined) {
marginMode = 'cross'; // cross as default marginMode
}
+ if (symbol !== undefined) {
+ marginMode = 'isolated'; // default to isolated if the symbol argument is defined
+ }
const request = {};
let method = 'privateGetMarginBorrowOutstanding';
if (marginMode === 'isolated') { | fetchBorrowInterest, if symbol is defined default to isolated marginMode | ccxt_ccxt | train | js |
bb47810028e06e2c570e9f5d4a2dd1c6b9dd59cf | diff --git a/src/resources/assets/js/admin.js b/src/resources/assets/js/admin.js
index <HASH>..<HASH> 100644
--- a/src/resources/assets/js/admin.js
+++ b/src/resources/assets/js/admin.js
@@ -9,11 +9,6 @@ window.$ = window.jQuery = require('jquery')
require('bootstrap-sass');
/**
- * Fancybox
- */
-require('@fancyapps/fancybox');
-
-/**
* Dropzone
*/
window.Dropzone = require('dropzone'); | fancybox removed from admin.js | TypiCMS_Core | train | js |
81aef676f19f05d9d865330448a8e5d604b9f161 | diff --git a/core/container/src/main/java/org/wildfly/swarm/Swarm.java b/core/container/src/main/java/org/wildfly/swarm/Swarm.java
index <HASH>..<HASH> 100644
--- a/core/container/src/main/java/org/wildfly/swarm/Swarm.java
+++ b/core/container/src/main/java/org/wildfly/swarm/Swarm.java
@@ -464,7 +464,14 @@ public class Swarm {
private void loadStageConfiguration(URL url) {
List<ProjectStage> projectStages = new ProjectStageFactory().loadStages(url);
- String stageName = System.getProperty(SwarmProperties.PROJECT_STAGE, "default");
+ String stageName = System.getProperty(SwarmProperties.PROJECT_STAGE);
+ if (stageName == null) {
+ // Try with SWARM_PROJECT_STAGE
+ stageName = System.getenv(SwarmProperties.PROJECT_STAGE.replace('.', '_').toUpperCase());
+ }
+ if (stageName == null) {
+ stageName = "default";
+ }
ProjectStage stage = null;
for (ProjectStage projectStage : projectStages) {
if (projectStage.getName().equals(stageName)) { | SWARM-<I>: Honor swarm.project.stage as an environment variable (#<I>)
Motivation
----------
Docker environments use env vars to pass parameters to docker container
Modifications
-------------
SwarmProperties.PROJECT_STAGE is resolved in System.getenv() if System.getProperty() doesn't return null
Result
------
Swarm uses SwarmProperties.PROJECT_STAGE | thorntail_thorntail | train | java |
f1275d8d23375e8d62d3faf01d66e6a393c28da4 | diff --git a/ariba/tasks/version.py b/ariba/tasks/version.py
index <HASH>..<HASH> 100644
--- a/ariba/tasks/version.py
+++ b/ariba/tasks/version.py
@@ -2,4 +2,5 @@ import sys
from ariba import versions
def run():
- versions.get_all_versions(sys.stdout, raise_error=False)
+ extern_progs, report_lines = versions.get_all_versions(raise_error=False)
+ print(*report_lines, sep='\n') | Write all versions, not just that of ariba itself | sanger-pathogens_ariba | train | py |
09d99ddfc2c48cced9d6c21608cf5c955bb54d2d | diff --git a/packages/mysql/lib/mysql_p.js b/packages/mysql/lib/mysql_p.js
index <HASH>..<HASH> 100644
--- a/packages/mysql/lib/mysql_p.js
+++ b/packages/mysql/lib/mysql_p.js
@@ -66,6 +66,25 @@ function patchCreatePool(mysql) {
};
}
+function patchGetConnection(pool) {
+ var baseFcn = '__getConnection';
+ pool[baseFcn] = pool['getConnection'];
+
+ pool['getConnection'] = function patchedGetConnection() {
+ var args = arguments;
+ var callback = args[0];
+
+ if(callback instanceof Function){
+ args[0] = (err, connection) => {
+ if(connection) patchObject(connection);
+ return callback(err, connection);
+ }
+ }
+
+ return pool[baseFcn].apply(pool, args);
+ }
+}
+
function patchObject(connection) {
if (connection.query instanceof Function) {
connection.__query = connection.query;
@@ -76,6 +95,10 @@ function patchObject(connection) {
connection.__execute = connection.execute;
connection.execute = captureOperation('execute');
}
+
+ if(connection.getConnection instanceof Function){
+ patchGetConnection(connection);
+ }
}
function resolveArguments(argsObj) { | feat: patch connections created by a pool's getConnection
Fixes #<I> | aws_aws-xray-sdk-node | train | js |
53d2fd30339a7e242b5627978bb32c7cc97f39c2 | diff --git a/lib/OpenLayers/BaseTypes.js b/lib/OpenLayers/BaseTypes.js
index <HASH>..<HASH> 100644
--- a/lib/OpenLayers/BaseTypes.js
+++ b/lib/OpenLayers/BaseTypes.js
@@ -14,8 +14,8 @@ OpenLayers.Class = {
},
inherit: function () {
- var super = arguments[0];
- var proto = new super(OpenLayers.Class.isPrototype);
+ var superClass = arguments[0];
+ var proto = new superClass(OpenLayers.Class.isPrototype);
for (var i = 1; i < arguments.length; i++) {
if (typeof arguments[i] == "function") {
var mixin = arguments[i]; | super seems to be a reserved word (at least in mozilla)
git-svn-id: <URL> | openlayers_openlayers | train | js |
3271864afb38b77e5c6fd6403c878e1fb9263b6b | diff --git a/src/main/java/org/fusesource/jansi/AnsiOutputStream.java b/src/main/java/org/fusesource/jansi/AnsiOutputStream.java
index <HASH>..<HASH> 100644
--- a/src/main/java/org/fusesource/jansi/AnsiOutputStream.java
+++ b/src/main/java/org/fusesource/jansi/AnsiOutputStream.java
@@ -181,6 +181,7 @@ public class AnsiOutputStream extends FilterOutputStream {
return true;
case 'F':
processCursorUpLine(optionInt(options, 0, 1));
+ return true;
case 'G':
processCursorToColumn(optionInt(options, 0));
return true; | Add missing return statement within the main switch | fusesource_jansi | train | java |
fec65f026b258120791c47f040f0b3ce91b0184b | diff --git a/src/deploy.php b/src/deploy.php
index <HASH>..<HASH> 100644
--- a/src/deploy.php
+++ b/src/deploy.php
@@ -26,6 +26,7 @@ class Deploy implements Qck\Interfaces\AppFunction
$fileContents = file_get_contents($interfaceFile);
$fileContents = str_replace("<?php", "", $fileContents);
$fileContents = str_replace($namespaceDeclaration, "", $fileContents);
+ $fileContents = trim($fileContents);
$newContents .= $fileContents.PHP_EOL;
}
$newContents .= "}".PHP_EOL; | Checkpoint commit <I>_<I> | MichaelMueller_Quick | train | php |
f2851392692a0b50fd72ebf50dfdd00839b98d1e | diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -46,7 +46,7 @@ if __name__ == '__main__':
'Programming Language :: Python',
'Topic :: Scientific/Engineering :: Bio-Informatics',
],
- requires=['sqlite3', 'pandas', 'appdirs', 'progressbar', 'biopython'],
+ install_requires=['pandas', 'appdirs', 'progressbar', 'biopython'],
long_description=readme,
packages=['datacache'],
) | Changing requires to install_requires, as that's the setuptools argument | openvax_datacache | train | py |
cbc4bf403df77046caba10d9eb0a92f08a9464d4 | diff --git a/src/Auth0.php b/src/Auth0.php
index <HASH>..<HASH> 100644
--- a/src/Auth0.php
+++ b/src/Auth0.php
@@ -256,21 +256,33 @@ class Auth0 {
}
public function getUser() {
+ if ($this->user) {
+ return $this->user;
+ }
$this->exchange();
return $this->user;
}
public function getIdToken() {
+ if ($this->id_token) {
+ return $this->id_token;
+ }
$this->exchange();
return $this->id_token;
}
public function getAccessToken() {
+ if ($this->access_token) {
+ return $this->access_token;
+ }
$this->exchange();
return $this->access_token;
}
public function getRefreshToken() {
+ if ($this->refresh_token) {
+ return $this->refresh_token;
+ }
$this->exchange();
return $this->refresh_token;
} | do not exchange a token on each get* call if we already have one | auth0_auth0-PHP | train | php |
e0b7e3f99aceaabf947c033016a14acfbc2b2e8e | diff --git a/lib/getDevices.js b/lib/getDevices.js
index <HASH>..<HASH> 100644
--- a/lib/getDevices.js
+++ b/lib/getDevices.js
@@ -56,7 +56,7 @@ module.exports = function(fromDevice, query, owner, callback) {
for (var param in query) {
// console.log(param, req.params[param]);
fetch[param] = query[param];
- console.log(query[param]);
+ console.log('getDevices', param, query[param]);
if (query[param] === 'null' || query[param] === ''){
console.log('null value found');
fetch[param] = { "$exists" : false };
@@ -69,7 +69,7 @@ module.exports = function(fromDevice, query, owner, callback) {
delete fetch.token;
console.log(fetch);
//sorts newest devices on top
- if(config.mongo){
+ if(config.mongo && config.mongo.databaseUrl){
devices.find(fetch).limit(MAX_RESULTS).sort({ $natural: -1 }, function(err, devicedata) {
processResults(err, devicedata);
}); | fix mongo check in getDevices query | octoblu_meshblu | train | js |
8a1fab5cc7f565c39e726d119e880861b0fc563c | diff --git a/regions/__init__.py b/regions/__init__.py
index <HASH>..<HASH> 100644
--- a/regions/__init__.py
+++ b/regions/__init__.py
@@ -1,7 +1,13 @@
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
-This is an experimental package for representing regions
+This is an in-development package for region handling based on Astropy.
+
+The goal is to merge the functionality from pyregion and photutils apertures
+and then after some time propose this package for inclusion in the Astropy core.
+
+* Code : https://github.com/astropy/regions
+* Docs : http://astropy-regions.readthedocs.io/en/latest/
"""
# Affiliated packages may add whatever they like to this file, but | Add some info to package docstring | astropy_regions | train | py |
1ac62815e54b051b22dbc87cc1d5521c3a78b68a | diff --git a/python/phonenumbers/phonenumberutil.py b/python/phonenumbers/phonenumberutil.py
index <HASH>..<HASH> 100644
--- a/python/phonenumbers/phonenumberutil.py
+++ b/python/phonenumbers/phonenumberutil.py
@@ -1088,8 +1088,10 @@ def _format_original_allow_mods(numobj, region_calling_from):
# National prefix not used when formatting this number.
return national_format
# Otherwise, we need to remove the national prefix from our output.
- format_rule.national_prefix_formatting_rule = None
- return format_by_pattern(numobj, PhoneNumberFormat.NATIONAL, [format_rule])
+ new_format_rule = NumberFormat()
+ new_format_rule.merge_from(format_rule)
+ new_format_rule.national_prefix_formatting_rule = None
+ return format_by_pattern(numobj, PhoneNumberFormat.NATIONAL, [new_format_rule])
def _raw_input_contains_national_prefix(raw_input, national_prefix, region_code): | Don't modify real metadata; make a copy. Raised as upstream issue <I>. | daviddrysdale_python-phonenumbers | train | py |
ac85c556052f8af38b3f4298cc53619b5f2b70e0 | diff --git a/src/builder/Builder.php b/src/builder/Builder.php
index <HASH>..<HASH> 100644
--- a/src/builder/Builder.php
+++ b/src/builder/Builder.php
@@ -3,6 +3,7 @@
namespace Crm\ApplicationModule\Builder;
use Nette\Database\Context;
+use Nette\Database\Table\IRow;
abstract class Builder
{
@@ -24,7 +25,7 @@ abstract class Builder
/** @return bool */
abstract public function isValid();
- /** @return bool */
+ /** @return IRow|bool */
public function save()
{
if ($this->isValid()) { | Adding command to import crowdfunding data to CRM
remp/crm#<I> | remp2020_crm-application-module | train | php |
ff1aedcdab544ba1830c41af7ec251319d963ed8 | diff --git a/lib/generators/devise/users/routes_helper.rb b/lib/generators/devise/users/routes_helper.rb
index <HASH>..<HASH> 100644
--- a/lib/generators/devise/users/routes_helper.rb
+++ b/lib/generators/devise/users/routes_helper.rb
@@ -27,8 +27,13 @@ module DeviseUserGenerator
name_default_users = user_class.underscore.gsub('/', '_').pluralize
default_user_class = user_class.classify
%Q{
- match '/sign_in' => 'main#index', :as => :new_user_session
-
+ match '/sign_in' => 'main#index'
+ match '/log_in' => 'main#index'
+
+ devise_scope do
+ get '/sign_in' => 'main#index', :as => :new_user_session
+ end
+
devise_for :#{name_default_users}, :class_name => '#{default_user_class}', :controllers => {:sessions => 'main'} do
get '/sign_in' => 'main#index', :as => :new_user_session
end} | trying to add signin route to devise default scope | kristianmandrup_cream | train | rb |
32113e0b4413f8c42f00194645c72ea3c841614f | diff --git a/src/function/probability/pickRandom.js b/src/function/probability/pickRandom.js
index <HASH>..<HASH> 100644
--- a/src/function/probability/pickRandom.js
+++ b/src/function/probability/pickRandom.js
@@ -53,7 +53,7 @@ export const createPickRandom = /* #__PURE__ */ factory(name, dependencies, ({ t
* @return {number | Array} Returns a single random value from array when number is 1 or undefined.
* Returns an array with the configured number of elements when number is > 1.
*/
- return typed({
+ return typed(name, {
'Array | Matrix': function (possibles) {
return _pickRandom(possibles, {})
}, | Fix pickRandom having no name (#<I>) | josdejong_mathjs | train | js |
01c994fe15a0b874a22ade52d492add01a886309 | diff --git a/tests/test_bindings.py b/tests/test_bindings.py
index <HASH>..<HASH> 100644
--- a/tests/test_bindings.py
+++ b/tests/test_bindings.py
@@ -1,5 +1,6 @@
import json
+from django.utils.encoding import force_text
from rest_framework import serializers
from channels.message import pending_message_store
@@ -28,12 +29,12 @@ class TestModelResourceBinding(bindings.ResourceBinding):
class ResourceBindingTestCase(ChannelTestCase):
def setUp(self):
- super().setUp()
+ super(ResourceBindingTestCase, self).setUp()
self.client = Client()
def _send_and_consume(self, channel, data):
"""Helper that sends and consumes message and returns the next message."""
- self.client.send_and_consume(channel, data)
+ self.client.send_and_consume(force_text(channel), data)
return self._get_next_message()
def _get_next_message(self): | Allow to run tests in python <I> | hishnash_djangochannelsrestframework | train | py |
862bb7e07e43cd9f121d9d0917249c2a9615e777 | diff --git a/src/User_Command.php b/src/User_Command.php
index <HASH>..<HASH> 100644
--- a/src/User_Command.php
+++ b/src/User_Command.php
@@ -351,7 +351,7 @@ class User_Command extends \WP_CLI\CommandWithDBObject {
if ( isset( $assoc_args['user_pass'] ) ) {
$user->user_pass = $assoc_args['user_pass'];
} else {
- $user->user_pass = wp_generate_password();
+ $user->user_pass = wp_generate_password(24);
$generated_pass = true;
} | Generate <I> character password | wp-cli_entity-command | train | php |
418f0c6f0755c4248e81c4a042735e850c73c69b | diff --git a/languagetool-language-modules/de/src/main/java/org/languagetool/rules/de/CompoundInfinitivRule.java b/languagetool-language-modules/de/src/main/java/org/languagetool/rules/de/CompoundInfinitivRule.java
index <HASH>..<HASH> 100644
--- a/languagetool-language-modules/de/src/main/java/org/languagetool/rules/de/CompoundInfinitivRule.java
+++ b/languagetool-language-modules/de/src/main/java/org/languagetool/rules/de/CompoundInfinitivRule.java
@@ -89,12 +89,6 @@ public class CompoundInfinitivRule extends Rule {
"grün",
"schwarz",
"weiß",
- "tief",
- "hoch",
- "viel",
- "nicht",
- "frisch",
- "frei",
"fertig",
"neu"
}; | [de] CompoundInfinitivRule - exceptions restricted | languagetool-org_languagetool | train | java |
749921a941a3fa7b1c3a483d0aaf511f7b41c603 | diff --git a/lib/adauth/authenticate.rb b/lib/adauth/authenticate.rb
index <HASH>..<HASH> 100644
--- a/lib/adauth/authenticate.rb
+++ b/lib/adauth/authenticate.rb
@@ -59,17 +59,21 @@ module Adauth
def self.group_in_group(adobject)
# Loop through each users group and see if it's a member of an allowed group
- adobject.cn_groups.each do |group|
+ begin
+ adobject.cn_groups.each do |group|
- if @config.allowed_groups.include?(group)
- return group
- end
+ if @config.allowed_groups.include?(group)
+ return group
+ end
- adGroup = Adauth::AdObjects::Group.where('name', group).first
+ adGroup = Adauth::AdObjects::Group.where('name', group).first
- unless self.group_in_group(adGroup) == nil
- return true
+ unless self.group_in_group(adGroup) == nil
+ return true
+ end
end
+ rescue
+ return nil
end
nil | Add rescue block if there's an exception in our group-unnesting method | Arcath_Adauth | train | rb |
dafa2f415caf4d0728743aae69285707c4c21ab9 | diff --git a/src/lib/MediaServices/index.js b/src/lib/MediaServices/index.js
index <HASH>..<HASH> 100644
--- a/src/lib/MediaServices/index.js
+++ b/src/lib/MediaServices/index.js
@@ -137,8 +137,6 @@ class MediaServices {
let advanced = VIDEO_ADVANCED_CONSTRANTS.slice(0, -numberOfMaxResolutionTry);
constraints.video.advanced = advanced;
- console.log('constraints', constraints);
-
return constraints;
} | #8 add ideal facingMode to the constraints | MABelanger_jslib-html5-camera-photo | train | js |
291bc1c258bb9bd4420306bfa0202c22565026b9 | diff --git a/shell/src/main/java/alluxio/shell/command/TailCommand.java b/shell/src/main/java/alluxio/shell/command/TailCommand.java
index <HASH>..<HASH> 100644
--- a/shell/src/main/java/alluxio/shell/command/TailCommand.java
+++ b/shell/src/main/java/alluxio/shell/command/TailCommand.java
@@ -112,13 +112,4 @@ public final class TailCommand extends WithWildCardPathCommand {
.build();
return new Options().addOption(bytesOption);
}
-
- @Override
- public boolean validateArgs(String... args) {
- boolean valid = args.length >= getNumOfArgs();
- if (!valid) {
- System.out.println(getCommandName() + " takes " + getNumOfArgs() + " argument at least\n");
- }
- return valid;
- }
} | Alluxio-<I>: Add -c option to alluxio.shell.command.TailCommand.
Addressing all the comments <I> | Alluxio_alluxio | train | java |
01b12a7e66798648cdd998fafba7966bc6251c7d | diff --git a/test/commands/thread_test.rb b/test/commands/thread_test.rb
index <HASH>..<HASH> 100644
--- a/test/commands/thread_test.rb
+++ b/test/commands/thread_test.rb
@@ -172,4 +172,4 @@ module Byebug
check_error_includes "It's the current thread"
end
end
-end unless RUBY_VERSION == '2.2.0'
+end unless RUBY_VERSION == '2.2.0' && ENV['CI'] | Run thread tests for <I> locally
ruby <I>-head is available locally so we just need to skip them in CI until
next patch level version is released. | deivid-rodriguez_byebug | train | rb |
1822a96b7cff1edf955a2c518bb937758f971936 | diff --git a/docs/conf.py b/docs/conf.py
index <HASH>..<HASH> 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -148,8 +148,8 @@ github_issues_url = f'https://github.com/{github_project}/issues/'
# -- Turn on nitpicky mode for sphinx (to warn about references not found) ----
-# nitpicky = True
-# nitpick_ignore = []
+nitpicky = True
+nitpick_ignore = []
# Some warnings are impossible to suppress, and you can list specific
# references that should be ignored in a nitpick-exceptions file which | Turn on Sphinx nitpicky mode | astropy_regions | train | py |
7f2ca48b82505a98a97b181bd04a350801d49b01 | diff --git a/nion/swift/ScriptsDialog.py b/nion/swift/ScriptsDialog.py
index <HASH>..<HASH> 100644
--- a/nion/swift/ScriptsDialog.py
+++ b/nion/swift/ScriptsDialog.py
@@ -235,6 +235,8 @@ class RunScriptDialog(Dialog.ActionDialog):
self.__q = collections.deque()
self.__output_queue = collections.deque()
+ self.__skip_finished = False
+
def close(self):
self.document_controller.clear_task(str(id(self)))
super().close()
@@ -307,6 +309,7 @@ class RunScriptDialog(Dialog.ActionDialog):
except Exception:
self.print("{}: {}".format(_("Error"), traceback.format_exc()))
self.alert(_("An exception was raised."), _("Close"))
+ self.__skip_finished = True
self.__stack.current_index = 1
@@ -319,7 +322,8 @@ class RunScriptDialog(Dialog.ActionDialog):
except Exception:
pass
- self.alert("Finished")
+ if not self.__skip_finished:
+ self.alert("Finished")
def request_close():
self.document_window.request_close() | Don't show Finished message if script ended with Exception. | nion-software_nionswift | train | py |
4b35cfe1d0f5659434237261536d0f2470a9cbdb | diff --git a/src/S3/Transfer.php b/src/S3/Transfer.php
index <HASH>..<HASH> 100644
--- a/src/S3/Transfer.php
+++ b/src/S3/Transfer.php
@@ -120,18 +120,24 @@ class Transfer
public static function recursiveDirIterator($path)
{
$invalid = ['.' => true, '..' => true];
- $queue = scandir($path);
$pathLen = strlen($path) + 1;
+ $queue = new \SplDoublyLinkedList();
+ foreach (scandir($path) as $item) {
+ $queue->push($item);
+ }
- while ($file = array_shift($queue)) {
+ while (!$queue->isEmpty()) {
+ $file = $queue->shift();
if (isset($invalid[basename($file)])) {
continue;
}
$fullPath = $path . '/' . $file;
yield $fullPath;
if (is_dir($fullPath)) {
- foreach (scandir($fullPath) as $subFile) {
- $queue[] = substr("$fullPath/$subFile", $pathLen);
+ // Push these files to the front of the queue, in order.
+ $push = scandir($fullPath);
+ for ($i = count($push) - 1; $i > -1; $i--) {
+ $queue->unshift(substr("$fullPath/{$push[$i]}", $pathLen));
}
}
} | Modiying recursiveDirIterator to properly handle depth-first traversal | aws_aws-sdk-php | train | php |
b8509b5fe963d25b86bd4687483346c4fc58a720 | diff --git a/carbonate/cluster.py b/carbonate/cluster.py
index <HASH>..<HASH> 100644
--- a/carbonate/cluster.py
+++ b/carbonate/cluster.py
@@ -1,7 +1,12 @@
+import os
import sys
# Inject the graphite libs into the system path
-sys.path.insert(0, '/opt/graphite/lib')
+venv_root = ""
+if os.environ.get("VIRTUAL_ENV"):
+ # Running in a virtual environment
+ venv_root = [p for p in sys.path if p.endswith("site-packages")][-1]
+sys.path.insert(0, venv_root + "/opt/graphite/lib")
# We're going to use carbon's libs directly to do things
try: | cluster path magic works in virtual environments
This eases development setups for people not using tox | graphite-project_carbonate | train | py |
9b189a31696b6572ffb8164f1f3041d57e8eeebe | diff --git a/actionview/lib/action_view/template.rb b/actionview/lib/action_view/template.rb
index <HASH>..<HASH> 100644
--- a/actionview/lib/action_view/template.rb
+++ b/actionview/lib/action_view/template.rb
@@ -154,7 +154,7 @@ module ActionView
# we use a bang in this instrumentation because you don't want to
# consume this in production. This is only slow if it's being listened to.
def render(view, locals, buffer=nil, &block)
- instrument("!render_template") do
+ instrument("!render_template".freeze) do
compile!(view)
view.send(method_name, locals, buffer, &block)
end
@@ -348,7 +348,12 @@ module ActionView
def instrument(action, &block)
payload = { virtual_path: @virtual_path, identifier: @identifier }
- ActiveSupport::Notifications.instrument("#{action}.action_view", payload, &block)
+ case action
+ when "!render_template".freeze
+ ActiveSupport::Notifications.instrument("!render_template.action_view".freeze, payload, &block)
+ else
+ ActiveSupport::Notifications.instrument("#{action}.action_view".freeze, payload, &block)
+ end
end
EXPLICIT_COLLECTION = /# Template Collection: (?<resource_name>\w+)/ | Cut string ActionView template allocations
The instrument method creates new strings, the most common action to instrument is "!render_template` so we can detect when that action is occurring and use a frozen string instead.
This change buys us <I>,<I> bytes of memory and 1,<I> fewer objects per request. | rails_rails | train | rb |
6b634fb2c46ff408012122a41c4c3e03904e76ea | diff --git a/sherlock/transient_classifier.py b/sherlock/transient_classifier.py
index <HASH>..<HASH> 100644
--- a/sherlock/transient_classifier.py
+++ b/sherlock/transient_classifier.py
@@ -1565,6 +1565,20 @@ END""" % locals())
self.log.info(
"Could not create table (`%(crossmatchTable)s`). Probably already exist." % locals())
+ sqlQuery = u"""
+ SHOW TRIGGERS;
+ """ % locals()
+ rows = readquery(
+ log=self.log,
+ sqlQuery=sqlQuery,
+ dbConn=self.transientsDbConn,
+ )
+
+ # DON'T ADD TRIGGERS IF THEY ALREADY EXIST
+ for r in rows:
+ if r["Trigger"] in ("sherlock_classifications_BEFORE_INSERT", "sherlock_classifications_AFTER_INSERT"):
+ return None
+
triggers.append("""CREATE TRIGGER `sherlock_classifications_BEFORE_INSERT` BEFORE INSERT ON `sherlock_classifications` FOR EACH ROW
BEGIN
IF new.classification = "ORPHAN" THEN | don't create triggers on database if they already exist | thespacedoctor_sherlock | train | py |
512430104f75780b4b92549c2b524a7c4bfd3e44 | diff --git a/lxd/migrate_storage_volumes.go b/lxd/migrate_storage_volumes.go
index <HASH>..<HASH> 100644
--- a/lxd/migrate_storage_volumes.go
+++ b/lxd/migrate_storage_volumes.go
@@ -143,7 +143,7 @@ func (s *migrationSourceWs) DoStorage(state *state.State, poolName string, volNa
// Use new storage layer for migration if supported.
if pool != nil {
- migrationType, err := migration.MatchTypes(respHeader, poolMigrationTypes)
+ migrationType, err := migration.MatchTypes(respHeader, migration.MigrationFSType_RSYNC, poolMigrationTypes)
if err != nil {
logger.Errorf("Failed to neogotiate migration type: %v", err)
s.sendControl(err)
@@ -343,7 +343,7 @@ func (c *migrationSink) DoStorage(state *state.State, poolName string, req *api.
// Extract the source's migration type and then match it against our pool's
// supported types and features. If a match is found the combined features list
// will be sent back to requester.
- respType, err := migration.MatchTypes(offerHeader, pool.MigrationTypes(storageDrivers.ContentTypeFS))
+ respType, err := migration.MatchTypes(offerHeader, migration.MigrationFSType_RSYNC, pool.MigrationTypes(storageDrivers.ContentTypeFS))
if err != nil {
return err
} | lxd/migration/storage/volumes: Updates MatchTypes usage | lxc_lxd | train | go |
087a2b8cb520cdb2ccfde5205744ef5e16ddabd1 | diff --git a/scripts/experiments/run_experiments.py b/scripts/experiments/run_experiments.py
index <HASH>..<HASH> 100644
--- a/scripts/experiments/run_experiments.py
+++ b/scripts/experiments/run_experiments.py
@@ -314,7 +314,7 @@ class DepParseExpParamsRunner(ExpParamsRunner):
default_brown = brown + DPExpParams(maxSentenceLength=10,
maxNumSentences=200,
dataset="brown200")
- default_wsj = wsj + DPExpParams(maxSentenceLength=10,
+ default_wsj = wsj_00 + DPExpParams(maxSentenceLength=10,
maxNumSentences=200,
dataset="wsj200")
@@ -384,9 +384,9 @@ class DepParseExpParamsRunner(ExpParamsRunner):
for algorithm in ["viterbi", "bnb"]:
experiment = all + dataset + DPExpParams(algorithm=algorithm)
if algorithm == "viterbi":
+ exps.append(experiment + universalPostCons + DPExpParams(parser="relaxed"))
exps.append(experiment)
#exps.append(experiment + universalPostCons) # parser="cky"
- exps.append(experiment + universalPostCons + DPExpParams(parser="relaxed"))
else:
for relax in [lpRelax, rltObjVarRelax] + extra_relaxes:
exps.append(experiment + relax) | Switching to WSJ section <I> explicitly | mgormley_pacaya | train | py |
13b777f965876cad7fd86b15500ab92474d7e0e2 | diff --git a/generator/lib/builder/om/PHP5ObjectBuilder.php b/generator/lib/builder/om/PHP5ObjectBuilder.php
index <HASH>..<HASH> 100644
--- a/generator/lib/builder/om/PHP5ObjectBuilder.php
+++ b/generator/lib/builder/om/PHP5ObjectBuilder.php
@@ -4529,8 +4529,13 @@ abstract class ".$this->getClassname()." extends ".$parentClass." ";
public function clear()
{";
foreach ($table->getColumns() as $col) {
+ $clo = strtolower($col->getName());
$script .= "
- \$this->" . strtolower($col->getName()) . " = null;";
+ \$this->".$clo." = null;";
+ if($col->isLazyLoad()){
+ $script .= "
+ \$this->".$clo."_isLoaded = false;";
+ }
}
$script .= " | [<I>] Fixed missing isLoaded pointers in `clear()` method (patch by rozwell) (closes #<I>) | propelorm_Propel | train | php |
0a00bc84dd72f44340c78257b2fc95cf97706e74 | diff --git a/switchbot/__init__.py b/switchbot/__init__.py
index <HASH>..<HASH> 100644
--- a/switchbot/__init__.py
+++ b/switchbot/__init__.py
@@ -21,7 +21,6 @@ class Switchbot:
def __init__(self, mac) -> None:
self._mac = mac
self._device = None
- self._connect()
def _connect(self) -> bool:
if self._device is not None:
@@ -40,6 +39,10 @@ class Switchbot:
return True
def _sendpacket(self, key, retry=2) -> bool:
+ if self._device is None and not self._connect():
+ _LOGGER.error("Cannot connect to switchbot.")
+ return False
+
try:
_LOGGER.debug("Prepare to send")
hand_service = self._device.getServiceByUUID(UUID) | Check if device is connected (#3)
* Check if device is connected
* connect | Danielhiversen_pySwitchbot | train | py |
3b979e01b3ca99a50eba7c3fc6b1074aabad8350 | diff --git a/pfp/interp.py b/pfp/interp.py
index <HASH>..<HASH> 100644
--- a/pfp/interp.py
+++ b/pfp/interp.py
@@ -1324,7 +1324,7 @@ class PfpInterp(object):
"double": (float, fields.Double),
# cut out the quotes
- "char": (lambda x: ord(x[1:-1]), fields.Char),
+ "char": (lambda x: ord(x[1:-1].decode('unicode_escape')), fields.Char),
# TODO should this be unicode?? will probably bite me later...
# cut out the quotes
diff --git a/tests/test_strings.py b/tests/test_strings.py
index <HASH>..<HASH> 100644
--- a/tests/test_strings.py
+++ b/tests/test_strings.py
@@ -23,7 +23,19 @@ class TestStrings(unittest.TestCase, utils.UtilsMixin):
def tearDown(self):
pass
-
+
+ def test_unicode_const(self):
+ dom = self._test_parse_build(
+ "\n",
+ """
+ char newline;
+ if(newline == \'\\n\') {
+ Warning("Found newline!");
+ }
+ """
+ )
+ self.assertEqual(dom.newline, ord('\n'))
+
def test_basic_string(self):
dom = self._test_parse_build(
"hello there\x00good byte\x00", | Properly parse unicode const chars
Ensure that the characters are unicode escaped
prior to passing them to ord, otherwise things
might fail. | d0c-s4vage_pfp | train | py,py |
6219fd3cf30174a24fb42230508c5a71b1036922 | diff --git a/src/browser/NabtoProxy.js b/src/browser/NabtoProxy.js
index <HASH>..<HASH> 100644
--- a/src/browser/NabtoProxy.js
+++ b/src/browser/NabtoProxy.js
@@ -36,7 +36,7 @@ function startup(success, error, opts) {
if (opts[0].indexOf('bad_password') != -1) {
return nextTick(function() { error(NabtoConstants.ClientApiErrors.UNLOCK_PK_FAILED); });
} else if (opts[0].indexOf('nonexisting') != -1) {
- return nextTick(function() { error(NabtoConstants.ClientApiErrors.PORTAL_LOGIN_FAILURE); });
+ return nextTick(function() { error(NabtoConstants.ClientApiErrors.OPEN_CERT_OR_PK_FAILED); });
} else {
throw "Unexpected stub input [" + opts[0] + "]";
} | update stub to reflect that startup no longer attempts to create profile | nabto_cordova-plugin-nabto | train | js |
54076097441fa225ee070baf20942ba0e6b172af | diff --git a/src/Providers/ComposerServiceProvider.php b/src/Providers/ComposerServiceProvider.php
index <HASH>..<HASH> 100644
--- a/src/Providers/ComposerServiceProvider.php
+++ b/src/Providers/ComposerServiceProvider.php
@@ -30,7 +30,7 @@ class ComposerServiceProvider extends ServiceProvider
$this->mergeConfigFrom(realpath(__DIR__.'/../../config/config.php'), 'rinvex.composer');
// Register console commands
- $this->registerCommands();
+ $this->registerCommands($this->commands);
}
/** | Fix ServiceProvider registerCommands method compatibility | rinvex_laravel-composer | train | php |
Subsets and Splits