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
|
---|---|---|---|---|---|
9d69bcc10c572290201511c5379407edd07ed095 | diff --git a/hooks/pre_gen_project.py b/hooks/pre_gen_project.py
index <HASH>..<HASH> 100644
--- a/hooks/pre_gen_project.py
+++ b/hooks/pre_gen_project.py
@@ -9,3 +9,23 @@ docker = '{{ cookiecutter.use_docker }}'.lower()
if elasticbeanstalk == 'y' and (heroku == 'y' or docker == 'y'):
raise Exception("Cookiecutter Django's EXPERIMENTAL Elastic Beanstalk support is incompatible with Heroku and Docker setups.")
+
+if docker == 'n':
+ import sys
+
+ python_major_version = sys.version_info[0]
+
+ if python_major_version == 2:
+ sys.stdout.write("WARNING: Cookiecutter Django does not support Python 2! Stability is guaranteed with Python 3.4+ only. Are you sure you want to proceed? (y/n)")
+
+ yes_options = set(['y'])
+ no_options = set(['n', ''])
+ choice = raw_input().lower()
+ if choice in no_options:
+ sys.exit(1)
+ elif choice in yes_options:
+ pass
+ else:
+ sys.stdout.write("Please respond with %s or %s"
+ % (', '.join([o for o in yes_options if not o == ''])
+ , ', '.join([o for o in no_options if not o == '']))) | Add a pre-hook that checks the python version (#<I>)
Closes #<I> | pydanny_cookiecutter-django | train | py |
84e54450763eaa13cffd19401503674863317101 | diff --git a/lib/sass/plugin.rb b/lib/sass/plugin.rb
index <HASH>..<HASH> 100644
--- a/lib/sass/plugin.rb
+++ b/lib/sass/plugin.rb
@@ -75,7 +75,7 @@ module Sass
template_location_array.each do |template_location, css_location|
- Dir.glob(File.join(template_location, "**", "*.s[ca]ss")).each do |file|
+ Dir.glob(File.join(template_location, "**", "*.s[ca]ss")).sort.each do |file|
# Get the relative path to the file
name = file.sub(template_location.sub(/\/*$/, '/'), "")
css = css_filename(name, css_location) | [Sass] Sort files for consistent compilation order. | sass_ruby-sass | train | rb |
761c3ce98d9d480a5358a11c75b5ee986d09789b | diff --git a/lib/dm-core/resource.rb b/lib/dm-core/resource.rb
index <HASH>..<HASH> 100644
--- a/lib/dm-core/resource.rb
+++ b/lib/dm-core/resource.rb
@@ -299,9 +299,11 @@ module DataMapper
# true if resource and storage state match
#
# @api public
- def update(attributes = {})
- self.attributes = attributes
- _update
+ chainable do
+ def update(attributes = {})
+ self.attributes = attributes
+ _update
+ end
end
##
@@ -379,8 +381,10 @@ module DataMapper
# true if resource was destroyed
#
# @api public
- def destroy
- _destroy
+ chainable do
+ def destroy
+ _destroy
+ end
end
## | Wrap Resource#update in a chainable block to allow overriding in modules | datamapper_dm-core | train | rb |
516a345d44865be34e862c288e90e1d0d7b3c708 | diff --git a/test/util.js b/test/util.js
index <HASH>..<HASH> 100644
--- a/test/util.js
+++ b/test/util.js
@@ -172,7 +172,11 @@ var setupTest = function setupTest(refImageId) {
getRefImage(refImageId, function gotRefImage(refImgData) {
if (!refImgData && ALLOWNOREF) {
- ok(true, 'Skip the test; no reference image and ALLOWNOREF is turned on.');
+ ok(true, 'Skip the test with ALLOWNOREF.');
+ console.log(
+ 'Skip the test with ALLOWNOREF. Please manually confirm \n' +
+ 'the test result of "' + currentTestDetails.name + '"');
+ console.log(canvas.toDataURL());
start(); | Print data URL if there is no reference image | timdream_wordcloud2.js | train | js |
999e217c921e565132005ab107fe1436be713c55 | diff --git a/lib/loaders/base_js.js b/lib/loaders/base_js.js
index <HASH>..<HASH> 100644
--- a/lib/loaders/base_js.js
+++ b/lib/loaders/base_js.js
@@ -115,6 +115,7 @@ module.exports = class BaseJavascriptModule {
async _completeLoading(deviceClass) {
if (this._config)
this._config.install(deviceClass);
+ deviceClass.manifest = this._manifest;
deviceClass.metadata = makeBaseDeviceMetadata(this._manifest);
for (let action in this._manifest.actions) {
diff --git a/test/test_v2_device.js b/test/test_v2_device.js
index <HASH>..<HASH> 100644
--- a/test/test_v2_device.js
+++ b/test/test_v2_device.js
@@ -42,7 +42,9 @@ async function testPreloaded() {
const factory = await module.getDeviceClass();
+
assert.strictEqual(factory, MyDevice);
+ assert.strictEqual(factory.manifest, metadata);
//assert.strictEqual(factory.metadata, metadata);
assert.deepStrictEqual(factory.require('package.json'), {"name":"org.thingpedia.test.mydevice",
"main": "index.js", | Expose Thingpedia manifests to JS devices
Expose it as "deviceClass.manifest" (aka this.constructor.manifest).
This allows devices to access their own Thingpedia definition for
reflection, and allows writing generic JS packages that can be
instantiated with multiple JS classes (e.g. for schema.org). It
can be an alternative to a custom loader. | stanford-oval_thingpedia-api | train | js,js |
c21acf388ee23cfe376feedc00c6180b5e89fd24 | diff --git a/src/graphql_relay/connection/connection.py b/src/graphql_relay/connection/connection.py
index <HASH>..<HASH> 100644
--- a/src/graphql_relay/connection/connection.py
+++ b/src/graphql_relay/connection/connection.py
@@ -106,8 +106,6 @@ def connection_definitions(
The nodes of the returned object types will be of the specified type.
"""
name = name or get_named_type(node_type).name
- edge_fields = edge_fields or {}
- connection_fields = connection_fields or {}
edge_type = GraphQLObjectType(
name + "Edge",
@@ -123,7 +121,7 @@ def connection_definitions(
resolve=resolve_cursor,
description="A cursor for use in pagination",
),
- **resolve_maybe_thunk(edge_fields),
+ **resolve_maybe_thunk(edge_fields or {}),
},
)
@@ -138,7 +136,7 @@ def connection_definitions(
"edges": GraphQLField(
GraphQLList(edge_type), description="A list of edges."
),
- **resolve_maybe_thunk(connection_fields),
+ **resolve_maybe_thunk(connection_fields or {}),
},
) | Minor simplification
Replicates graphql/graphql-relay-js@8b5a9a<I>f<I>fddd8b<I>fe<I>e7fdf<I> | graphql-python_graphql-relay-py | train | py |
8302384ecd8334cca506b9bfec0da4210657ecf9 | diff --git a/lib/collection.js b/lib/collection.js
index <HASH>..<HASH> 100644
--- a/lib/collection.js
+++ b/lib/collection.js
@@ -2039,7 +2039,7 @@ Collection.prototype.mapReduce = function(map, reduce, options, callback) {
};
/**
- * Initiate a Out of order batch write operation. All operations will be buffered into insert/update/remove commands executed out of order.
+ * Initiate an Out of order batch write operation. All operations will be buffered into insert/update/remove commands executed out of order.
*
* @method
* @param {object} [options] Optional settings.
@@ -2056,7 +2056,7 @@ Collection.prototype.initializeUnorderedBulkOp = function(options) {
};
/**
- * Initiate an In order bulk write operation, operations will be serially executed in the order they are added, creating a new operation for each switch in types.
+ * Initiate an In order bulk write operation. Operations will be serially executed in the order they are added, creating a new operation for each switch in types.
*
* @method
* @param {object} [options] Optional settings. | docs(collection): fix typo & run-on sentence for initializeOrderedBulkOp | mongodb_node-mongodb-native | train | js |
9dec503d23ade929322802dc381072c6c9cd1525 | diff --git a/View/Helper/QrCodeHelper.php b/View/Helper/QrCodeHelper.php
index <HASH>..<HASH> 100644
--- a/View/Helper/QrCodeHelper.php
+++ b/View/Helper/QrCodeHelper.php
@@ -86,7 +86,7 @@ class QrCodeHelper extends AppHelper {
* Note: cannot be url() due to AppHelper conflicts
*
* @param string $text
- * @return string $url
+ * @return string Url
* 2010-02-25 ms
*/
public function uri($text) {
@@ -96,14 +96,8 @@ class QrCodeHelper extends AppHelper {
}
/**
- * @deprecated
- * old method - use uri() instead
+ * @return string Url
*/
- public function url($url = null, $full = false) {
- //trigger_error('use uri() instead', E_DEPRECATED);
- return $this->uri($url);
- }
-
protected function _uri($params = array()) {
$params = array_merge($this->options, $params);
$pieces = array(); | remove deprecated method that is not E_STRICT | dereuromark_cakephp-tinyauth | train | php |
3441acc9b88d2552e2b51289360798e432e2b4b2 | diff --git a/bugtool/cmd/configuration.go b/bugtool/cmd/configuration.go
index <HASH>..<HASH> 100644
--- a/bugtool/cmd/configuration.go
+++ b/bugtool/cmd/configuration.go
@@ -333,6 +333,7 @@ func copyCiliumInfoCommands(cmdDir string, k8sPods []string) []string {
"cilium bpf bandwidth list",
"cilium bpf tunnel list",
"cilium bpf lb list",
+ "cilium bpf egress list",
"cilium bpf endpoint list",
"cilium bpf ct list global",
"cilium bpf nat list", | bugtool: Include listing of egress gateway map | cilium_cilium | train | go |
018a716a30e5de279da1414c2763c42293249d43 | diff --git a/aeron-driver/src/main/java/io/aeron/driver/media/UdpChannel.java b/aeron-driver/src/main/java/io/aeron/driver/media/UdpChannel.java
index <HASH>..<HASH> 100644
--- a/aeron-driver/src/main/java/io/aeron/driver/media/UdpChannel.java
+++ b/aeron-driver/src/main/java/io/aeron/driver/media/UdpChannel.java
@@ -31,7 +31,7 @@ import static java.lang.System.lineSeparator;
import static java.net.InetAddress.getByAddress;
/**
- * The media configuration for a Aeron UDP channel as an instantiation of the socket addresses for a {@link ChannelUri}.
+ * The media configuration for Aeron UDP channels as an instantiation of the socket addresses for a {@link ChannelUri}.
*
* @see ChannelUri
* @see io.aeron.ChannelUriStringBuilder | [Java] Tidy up constants used for media type. | real-logic_aeron | train | java |
8c06cbf9fcc9b8f3073329954e324b87841ccbb9 | diff --git a/flask_mobility/mobility.py b/flask_mobility/mobility.py
index <HASH>..<HASH> 100644
--- a/flask_mobility/mobility.py
+++ b/flask_mobility/mobility.py
@@ -8,10 +8,9 @@ class Mobility(object):
self.app = app
if self.app is not None:
- self.init_app(self.app)
+ self.init_app(app)
def init_app(self, app):
- self.app = app
app.config.setdefault("MOBILE_USER_AGENTS", "android|fennec|iemobile|iphone|opera (?:mini|mobi)|mobile")
app.config.setdefault("MOBILE_COOKIE", "mobile")
@@ -21,10 +20,10 @@ class Mobility(object):
def before_request():
ctx = stack.top
if ctx is not None and hasattr(ctx, "request"):
- self.process_request(ctx.request)
+ self.process_request(ctx.request, app)
- def process_request(self, request):
+ def process_request(self, request, app):
ua = request.user_agent.string.lower()
- mc = request.cookies.get(self.app.config.get("MOBILE_COOKIE"))
+ mc = request.cookies.get(app.config.get("MOBILE_COOKIE"))
request.MOBILE = mc == "on" or (mc != "off" and self.USER_AGENTS.search(ua)) | Tweaks to get in line with Flask doc recommendations | rehandalal_flask-mobility | train | py |
a248d0ccf92d8204c77a539bbdee809a9e296985 | diff --git a/test/e2e/util.go b/test/e2e/util.go
index <HASH>..<HASH> 100644
--- a/test/e2e/util.go
+++ b/test/e2e/util.go
@@ -723,13 +723,17 @@ func RunRC(config RCConfig) error {
image := config.Image
replicas := config.Replicas
interval := config.PollInterval
-
maxContainerFailures := int(math.Max(1.0, float64(replicas)*.01))
current := 0
same := 0
label := labels.SelectorFromSet(labels.Set(map[string]string{"name": name}))
podLists := newFifoQueue()
+ // Default to 10 second polling/check interval
+ if interval <= 0 {
+ interval = 10
+ }
+
By(fmt.Sprintf("%v Creating replication controller %s", time.Now(), name))
rc := &api.ReplicationController{
ObjectMeta: api.ObjectMeta{ | Default RunRC to check every <I> seconds if an internval isn't provided. #<I> | kubernetes_kubernetes | train | go |
444b952701c02d4bf85e350c4f6ae307eb9c7b5d | diff --git a/chevron/renderer.py b/chevron/renderer.py
index <HASH>..<HASH> 100644
--- a/chevron/renderer.py
+++ b/chevron/renderer.py
@@ -292,7 +292,7 @@ def render(template='', data={}, partials_path='.', partials_ext='mustache',
padding=padding,
def_ldel=def_ldel, def_rdel=def_rdel,
scopes=data and [data]+scopes or scopes,
- warn=warn))
+ warn=warn, keep=keep))
if python3:
output += rend
@@ -329,7 +329,7 @@ def render(template='', data={}, partials_path='.', partials_ext='mustache',
partials_ext=partials_ext,
partials_dict=partials_dict,
def_ldel=def_ldel, def_rdel=def_rdel,
- warn=warn)
+ warn=warn, keep=keep)
if python3:
output += rend
@@ -364,7 +364,7 @@ def render(template='', data={}, partials_path='.', partials_ext='mustache',
partials_dict=partials_dict,
def_ldel=def_ldel, def_rdel=def_rdel,
padding=part_padding, scopes=scopes,
- warn=warn)
+ warn=warn, keep=keep)
# If the partial was indented
if left.isspace(): | Pass `keep` to recursive calls of `chevron.renderer.render()` | noahmorrison_chevron | train | py |
304070ca675fcd562d6eb2a1132bcab1d155db58 | diff --git a/test/test-cli.js b/test/test-cli.js
index <HASH>..<HASH> 100644
--- a/test/test-cli.js
+++ b/test/test-cli.js
@@ -19,6 +19,9 @@ function runWithInputAndExpect (input, args, expectedOutput, done) {
}
describe('cli arguments', function () {
+
+ this.timeout(5000);
+
it('should output nothing with empty input', function (done) {
runWithInputAndExpect('', '', '', done);
}); | Let CLI tests more time for slow machines | werk85_node-html-to-text | train | js |
9837f48287a21266d9e440f650588a23b014a269 | diff --git a/Classes/SolrService.php b/Classes/SolrService.php
index <HASH>..<HASH> 100644
--- a/Classes/SolrService.php
+++ b/Classes/SolrService.php
@@ -553,8 +553,8 @@ class Tx_Solr_SolrService extends Apache_Solr_Service {
$language = 'english';
$schema = $this->getSchema();
-
- if(is_array($schema)){
+
+ if (!is_null($schema) && isset($schema->fieldTypes)) {
foreach ($schema->fieldTypes as $fieldType) {
if ($fieldType->name === 'text') {
foreach ($fieldType->indexAnalyzer->filters as $filter) {
@@ -565,6 +565,7 @@ class Tx_Solr_SolrService extends Apache_Solr_Service {
}
}
}
+
return $language;
}
@@ -676,8 +677,8 @@ class Tx_Solr_SolrService extends Apache_Solr_Service {
$synonyms = $decodedResponse->{$baseWord};
}
} else {
- if (is_array($decodedResponse->synonymMappings->managedMap)) {
- $synonyms = $decodedResponse->synonymMappings->managedMap;
+ if (isset($decodedResponse->synonymMappings->managedMap)) {
+ $synonyms = (array)$decodedResponse->synonymMappings->managedMap;
}
} | [BUGFIX] SolrService checks synonyms for wrong type
It checked for an array, but json_decode provides a stdClass.
In test it worked, because the fallback to default language matched.
Resolves: #<I>
Change-Id: Ia<I>c6af<I>a<I>d5e0cb<I>bfe1b<I>
Reviewed-on: <URL> | TYPO3-Solr_ext-solr | train | php |
7a5aaa8d1cba71c9583052fc9719658acb5a14c2 | diff --git a/tracer.go b/tracer.go
index <HASH>..<HASH> 100644
--- a/tracer.go
+++ b/tracer.go
@@ -21,6 +21,7 @@ import (
)
var TraceBufferSize = 1 << 16 // 64K ought to be enough for everyone; famous last words.
+var MinTraceBatchSize = 16
type basicTracer struct {
ch chan struct{}
@@ -187,10 +188,17 @@ func (t *RemoteTracer) doWrite() {
for {
_, ok := <-t.ch
- // wait a bit to accumulate a batch
- time.Sleep(time.Second)
+ // deadline for batch accumulation
+ deadline := time.Now().Add(time.Second)
+ again:
t.mx.Lock()
+ if len(t.buf) < MinTraceBatchSize && time.Now().Before(deadline) {
+ t.mx.Unlock()
+ time.Sleep(100 * time.Millisecond)
+ goto again
+ }
+
tmp := t.buf
t.buf = buf[:0]
buf = tmp | don't blanket wait for 1s to accumulate a batch.
Instead check the batch size and poll every <I>ms (up to 1s) until the
minimum batch size is accumulated. | libp2p_go-libp2p-pubsub | train | go |
9c3f8b47798e83218acdc47843220c0182e97046 | diff --git a/cmd/juju/model/destroy.go b/cmd/juju/model/destroy.go
index <HASH>..<HASH> 100644
--- a/cmd/juju/model/destroy.go
+++ b/cmd/juju/model/destroy.go
@@ -338,9 +338,11 @@ func newTimedModelStatus(ctx *cmd.Context, api DestroyModelAPI, tag names.ModelT
return nil
}
if status[0].Error != nil {
- // This most likely occurred because a model was
- // destroyed half-way through the call.
- ctx.Infof("Could not get the model status from the API: %v.", status[0].Error)
+ if !errors.IsNotFound(status[0].Error) {
+ // No need to give the user a warning that the model they asked
+ // to destroy is no longer there.
+ ctx.Infof("Could not get the model status from the API: %v.", status[0].Error)
+ }
return nil
}
return &modelData{ | Address bug #<I>, don't tread model NotFound as an error when destroying that model | juju_juju | train | go |
bc68f9c7205892c7ecf4f341143dead34ea2c040 | diff --git a/molgenis-app/src/main/java/org/molgenis/app/WebAppInitializer.java b/molgenis-app/src/main/java/org/molgenis/app/WebAppInitializer.java
index <HASH>..<HASH> 100644
--- a/molgenis-app/src/main/java/org/molgenis/app/WebAppInitializer.java
+++ b/molgenis-app/src/main/java/org/molgenis/app/WebAppInitializer.java
@@ -11,7 +11,7 @@ public class WebAppInitializer extends MolgenisWebAppInitializer implements WebA
@Override
public void onStartup(ServletContext servletContext) throws ServletException
{
- super.onStartup(servletContext, WebAppConfig.class, true, 150);
+ super.onStartup(servletContext, WebAppConfig.class, true, Integer.MAX_VALUE);
// TODO : Add a session expire lister for omx biobankconnect
// servletContext.addListener(new SessionExpireListener()); | Increased the maximum upload size to accomodate bigger files | molgenis_molgenis | train | java |
5b6badd4157ac09a325164846ebc520c4414f9bd | diff --git a/api/authz.go b/api/authz.go
index <HASH>..<HASH> 100644
--- a/api/authz.go
+++ b/api/authz.go
@@ -82,6 +82,9 @@ func buildAuthz(ctx context.Context, reqs ...buildReq) error {
}
}
}
+ if len(accountIDs) == 0 {
+ return nil
+ }
projects, err := appdb.ProjectsByAccount(ctx, accountIDs...)
if err != nil {
return err | api: fix authz for build with no account ids
Closes chain/chainprv#<I>.
Reviewers: @jeffomatic | chain_chain | train | go |
592166f7f463fc5743e3399ceff8e29aca721baf | diff --git a/src/main/java/org/graylog2/database/MongoConnection.java b/src/main/java/org/graylog2/database/MongoConnection.java
index <HASH>..<HASH> 100644
--- a/src/main/java/org/graylog2/database/MongoConnection.java
+++ b/src/main/java/org/graylog2/database/MongoConnection.java
@@ -142,6 +142,7 @@ public final class MongoConnection {
.get());
}
+ coll.ensureIndex(new BasicDBObject("_id", 1));
coll.ensureIndex(new BasicDBObject("created_at", 1));
coll.ensureIndex(new BasicDBObject("host", 1));
coll.ensureIndex(new BasicDBObject("streams", 1)); | _id is a standard index #NO_ISSUE | Graylog2_graylog2-server | train | java |
c6fba2e08d8b5497f859c2e4b23f3edd2be447d4 | diff --git a/core/common/src/main/java/alluxio/network/netty/NettyRPC.java b/core/common/src/main/java/alluxio/network/netty/NettyRPC.java
index <HASH>..<HASH> 100644
--- a/core/common/src/main/java/alluxio/network/netty/NettyRPC.java
+++ b/core/common/src/main/java/alluxio/network/netty/NettyRPC.java
@@ -84,14 +84,21 @@ public final class NettyRPC {
public static void fireAndForget(final NettyRPCContext context, ProtoMessage request)
throws IOException {
Channel channel = Preconditions.checkNotNull(context.getChannel());
+ Object condition = new Object();
channel.writeAndFlush(new RPCProtoMessage(request)).addListener((ChannelFuture future) -> {
if (future.cause() != null) {
future.channel().close();
}
- request.notify();
+ synchronized (condition) {
+ condition.notify();
+ }
});
try {
- request.wait();
+ synchronized (condition) {
+ while (channel.isOpen()) {
+ condition.wait();
+ }
+ }
} catch (InterruptedException e) {
CommonUtils.closeChannel(channel);
throw new RuntimeException(e); | [SMALLFIX] Correct the use of monitor | Alluxio_alluxio | train | java |
e08d478e712dc929893f8fe9537d2a64bed670b6 | diff --git a/tests/express-test-harness.js b/tests/express-test-harness.js
index <HASH>..<HASH> 100644
--- a/tests/express-test-harness.js
+++ b/tests/express-test-harness.js
@@ -45,6 +45,33 @@ describe('express-http-context', function () {
});
});
+ it('returns undefined when key is not found', function (done) {
+ // ARRANGE
+ const app = express();
+
+ app.use(httpContext.middleware);
+
+ app.get('/test', (req, res) => {
+ httpContext.set('existing-key', 'some value');
+
+ setTimeout(() => {
+ const valueFromContext = httpContext.get('missing-key');
+ res.status(200).json({
+ typeOfValueFromContext: typeof (valueFromContext)
+ });
+ }, 5);
+ });
+
+ const sut = supertest(app);
+
+ // ACT
+ sut.get('/test').end((err, res) => {
+ // ASSERT
+ assert.equal(res.body.typeOfValueFromContext, 'undefined');
+ done();
+ });
+ });
+
it('does not store or return context outside of request', function () {
// ARRANGE
const key = 'key'; | test: assert that missing keys return undefined | skonves_express-http-context | train | js |
fc98c3aecbca5e5c1c255556d707fa07e08a70c3 | diff --git a/mod/forum/lib.php b/mod/forum/lib.php
index <HASH>..<HASH> 100644
--- a/mod/forum/lib.php
+++ b/mod/forum/lib.php
@@ -5957,7 +5957,7 @@ function forum_remove_user_tracking($userid, $context) {
if (!is_enrolled($context, $userid)) {
if ($course = $DB->get_record('course', array('id' => $context->instanceid), 'id')) {
// find all forums in which this user has reading tracked
- if ($forums = $DB->get_records_sql("SELECT f.id, cm.id as coursemodule
+ if ($forums = $DB->get_records_sql("SELECT DISTINCT f.id, cm.id as coursemodule
FROM {forum} f,
{modules} m,
{course_modules} cm, | "MDL-<I>, added DISTINCT statements" | moodle_moodle | train | php |
cd33b98041385a2b96edfa7705f1d512a14d3f92 | diff --git a/graph/history.go b/graph/history.go
index <HASH>..<HASH> 100644
--- a/graph/history.go
+++ b/graph/history.go
@@ -27,8 +27,7 @@ func (graph *Graph) WalkHistory(img *image.Image, handler func(image.Image) erro
return nil
}
-// depth returns the number of parents for a
-// current image
+// depth returns the number of parents for the current image
func (graph *Graph) depth(img *image.Image) (int, error) {
var (
count = 0
@@ -38,8 +37,7 @@ func (graph *Graph) depth(img *image.Image) (int, error) {
for parent != nil {
count++
- parent, err = graph.GetParent(parent)
- if err != nil {
+ if parent, err = graph.GetParent(parent); err != nil {
return -1, err
}
} | Refactor some code to use simply format | moby_moby | train | go |
b4c96fe7e11117d28e8eb02e12aecf7422728131 | diff --git a/database.py b/database.py
index <HASH>..<HASH> 100644
--- a/database.py
+++ b/database.py
@@ -5,6 +5,9 @@ import types
from collection import Collection
from errors import InvalidName
+ASCENDING = 1
+DESCENDING = -1
+
class Database(object):
"""A Mongo database.
"""
diff --git a/mongo.py b/mongo.py
index <HASH>..<HASH> 100644
--- a/mongo.py
+++ b/mongo.py
@@ -7,17 +7,17 @@ import types
import traceback
import struct
-from database import Database
+import database
from connection import Connection
from son import SON
from objectid import ObjectId
from dbref import DBRef
from cursor_manager import BatchCursorManager
-ASCENDING = 1
-DESCENDING = -1
+ASCENDING = database.ASCENDING
+DESCENDING = database.DESCENDING
-class Mongo(Database):
+class Mongo(database.Database):
"""A connection to a Mongo database.
"""
def __init__(self, name, host="localhost", port=27017, settings={}):
@@ -50,7 +50,7 @@ class Mongo(Database):
connection = Connection(host, port)
connection.set_cursor_manager(BatchCursorManager)
- Database.__init__(self, connection, name)
+ database.Database.__init__(self, connection, name)
def __repr__(self):
return "Mongo(%r, %r, %r)" % (self.name(), self.connection().host(), self.connection().port()) | move ASC and DESC constants to the base db class. mirror them in the enhanced class | mongodb_mongo-python-driver | train | py,py |
f614ed2a557228c1d41408a05cc68eaff319f5e6 | diff --git a/src/main/java/org/openqa/selenium/WebElement.java b/src/main/java/org/openqa/selenium/WebElement.java
index <HASH>..<HASH> 100644
--- a/src/main/java/org/openqa/selenium/WebElement.java
+++ b/src/main/java/org/openqa/selenium/WebElement.java
@@ -1,7 +1,7 @@
/*
Copyright 2007-2009 WebDriver committers
Copyright 2007-2009 Google Inc.
-Portions copyright 2011 Software Freedom Conservatory
+Portions copyright 2011 Software Freedom Conservancy
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. | DanielWagnerHall: s/Conservatory/Conservancy/g
r<I> | appium_java-client | train | java |
cb789965e6e0dfe82861cbd5306338dc22dcd5e6 | diff --git a/Tests/Command/Ec2/AuthenticationCommandsTest.php b/Tests/Command/Ec2/AuthenticationCommandsTest.php
index <HASH>..<HASH> 100644
--- a/Tests/Command/Ec2/AuthenticationCommandsTest.php
+++ b/Tests/Command/Ec2/AuthenticationCommandsTest.php
@@ -6,9 +6,8 @@ use Guzzle\Common\Event;
use Guzzle\Http\Plugin\CookiePlugin;
use Guzzle\Http\CookieJar\ArrayCookieJar;
use Guzzle\Http\Message\Response;
-use RGeyer\Guzzle\Rs\Tests\Utils\ClientCommandsBase;
-class AuthenticationCommandsTest extends ClientCommandsBase {
+class AuthenticationCommandsTest extends \Guzzle\Tests\GuzzleTestCase {
/**
* @group unit | Refactored Ec2\AuthenticationCommands to be proper unit tests | rgeyer_rs_guzzle_client | train | php |
5bb15545de51404c88df7a5eb42b1e72f89cdd88 | diff --git a/runtests.py b/runtests.py
index <HASH>..<HASH> 100644
--- a/runtests.py
+++ b/runtests.py
@@ -32,6 +32,7 @@ DEFAULT_SETTINGS = {
),
'ROOT_URLCONF': 'tests.urls',
'STATIC_URL': '/static/',
+ 'SPATIALITE_LIBRARY_PATH': 'mod_spatialite.so',
'TEMPLATES': [{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'APP_DIRS': True, | Need to force loading of mod_spatialite, not libspatialite | bkg_django-spillway | train | py |
4f9405bb57a645d0eaf67d8525b660d172cce495 | diff --git a/tests/test-merge.js b/tests/test-merge.js
index <HASH>..<HASH> 100644
--- a/tests/test-merge.js
+++ b/tests/test-merge.js
@@ -1,5 +1,6 @@
/* eslint-env mocha */
const assert = require('assert');
+const webpack = require('webpack');
const webpackMerge = require('..');
const mergeTests = require('./merge-tests');
const loadersKeys = require('./loaders-keys');
@@ -259,6 +260,37 @@ function customizeMergeTests(merge) {
assert.equal(receivedKey, 'entry');
assert.deepEqual(result, first);
});
+
+ it('should customize plugins', function () {
+ let receivedKey;
+ const config1 = {
+ plugins: [
+ new webpack.DefinePlugin({
+ 'process.env': {
+ NODE_ENV: JSON.stringify('development')
+ }
+ }),
+ new webpack.HotModuleReplacementPlugin()
+ ]
+ };
+ const config2 = {
+ plugins: [
+ new webpack.DefinePlugin({
+ __CLIENT__: true
+ }),
+ new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/),
+ new webpack.HotModuleReplacementPlugin()
+ ]
+ };
+
+ merge({
+ customizeArray(a, b, key) {
+ receivedKey = key;
+ }
+ })(config1, config2);
+
+ assert.equal(receivedKey, 'plugins');
+ });
}
module.exports = normalMergeTests; | test - Add plugin customization test
This could be better, but good enough for now. | survivejs_webpack-merge | train | js |
3e843705e6d88be78280664eea2712e973d37853 | diff --git a/lib/rambling/trie/version.rb b/lib/rambling/trie/version.rb
index <HASH>..<HASH> 100644
--- a/lib/rambling/trie/version.rb
+++ b/lib/rambling/trie/version.rb
@@ -1,6 +1,6 @@
module Rambling
module Trie
# Current version of the rambling-trie.
- VERSION = '0.5.0'
+ VERSION = '0.5.1'
end
end | Bumped to version <I>. | gonzedge_rambling-trie | train | rb |
6516182d6d668c9861f5614723745e2c6c17a3c6 | diff --git a/packages/webiny-ui/src/List/DataList/DataList.js b/packages/webiny-ui/src/List/DataList/DataList.js
index <HASH>..<HASH> 100644
--- a/packages/webiny-ui/src/List/DataList/DataList.js
+++ b/packages/webiny-ui/src/List/DataList/DataList.js
@@ -246,7 +246,7 @@ const Pagination = (props: Props) => {
return (
<React.Fragment>
- {meta.totalCount &&
+ {typeof meta.totalCount !== "undefined" &&
meta.totalCount > 0 &&
meta.from &&
meta.to && ( | fix: Fix incorrect pagination info in DataList component (#<I>)
A "0" would be outputted in the pagination section if there were no records to show. | Webiny_webiny-js | train | js |
8cd464a92660b311d9d40894f0b43b2ef191e0a1 | diff --git a/js/impress.js b/js/impress.js
index <HASH>..<HASH> 100644
--- a/js/impress.js
+++ b/js/impress.js
@@ -185,6 +185,7 @@
// making given step active
var active = null;
+ var hashTimeout = null;
var select = function ( el ) {
if ( !el || !el.stepData || el == active) {
@@ -216,7 +217,8 @@
//
// and it has to be set after animation finishes, because in chrome it
// causes transtion being laggy
- window.setTimeout(function () {
+ window.clearTimeout( hashTimeout );
+ hashTimeout = window.setTimeout(function () {
window.location.hash = "#/" + el.id;
}, 1000); | yeah, that's what happens when you do quick fixes using timeouts... | impress_impress.js | train | js |
5c665de2d689a232b35fde9247263a9a49254000 | diff --git a/worker/agent.go b/worker/agent.go
index <HASH>..<HASH> 100644
--- a/worker/agent.go
+++ b/worker/agent.go
@@ -159,8 +159,9 @@ func (a *agent) reconnect() error {
a.conn = conn
a.rw = bufio.NewReadWriter(bufio.NewReader(a.conn),
bufio.NewWriter(a.conn))
- a.grab()
+
a.worker.reRegisterFuncsForAgent(a)
+ a.grab()
go a.work()
return nil | fix worker reconnect errors, send cando after reconnection.
* fix worker reconnect errors, send cando after reconnection. | mikespook_gearman-go | train | go |
baf37172daa93d5bb5bda94553a3655938a2332d | diff --git a/helpers/api.js b/helpers/api.js
index <HASH>..<HASH> 100644
--- a/helpers/api.js
+++ b/helpers/api.js
@@ -1,5 +1,5 @@
exports.getBaseUrl = () => {
- // If DDENV is defined, use it, otherwise default to prod
- const env = process.env.DDENV ? "_" + process.env.DDENV : "";
- return `https://api${env}.dronedeploy.com`
+ const env = process.env.DDENV || "prod"; // default to prod
+ const envUrlPart = env === "prod" ? "" : "_" + env;
+ return `https://api${envUrlPart}.dronedeploy.com`
} | Minor adjustment for when env is explicitly prod | dronedeploy_function-wrapper | train | js |
0a14c152083a380ef1908f19dba566129a8dfed0 | diff --git a/lib/addMethod/index.js b/lib/addMethod/index.js
index <HASH>..<HASH> 100644
--- a/lib/addMethod/index.js
+++ b/lib/addMethod/index.js
@@ -3,7 +3,7 @@ const _ = require('lodash');
const addMethodREST = require('./addMethodREST');
const addMethodSOAP = require('./addMethodSOAP');
-const INVALID_TYPE_ERROR_MESSAGE = '`type` must be strings \'REST\' or \'SOAP\'';
+const INVALID_TYPE_ERROR_MESSAGE = `\`type\` must be strings 'REST' or 'SOAP'`;
function validateAndGetType ([ methodName, config ]) {
const { type } = config; | review feedback - changed main string to backticks | trayio_threadneedle | train | js |
33b3035e5464c63a82631decd5d1859ffdc80c02 | diff --git a/go/cmd/vtbackup/vtbackup.go b/go/cmd/vtbackup/vtbackup.go
index <HASH>..<HASH> 100644
--- a/go/cmd/vtbackup/vtbackup.go
+++ b/go/cmd/vtbackup/vtbackup.go
@@ -281,13 +281,6 @@ func takeBackup(ctx context.Context, topoServer *topo.Server, backupStorage back
// to the goal position).
backupTime := time.Now()
- if restorePos.Equal(masterPos) {
- // Nothing has happened on the master since the last backup, so there's
- // no point taking a new backup since it would be identical.
- log.Infof("No backup is necessary. The latest backup is up-to-date with the master.")
- return nil
- }
-
// Wait for replication to catch up.
waitStartTime := time.Now()
for { | Still take a new backup even if nothing changed.
We need to create a backup with the new timestamp so we know that our
backups are fresh. | vitessio_vitess | train | go |
9f662081299f74a36491e48ac0538cf45c2d2a21 | diff --git a/test/javascript/test_oracles.js b/test/javascript/test_oracles.js
index <HASH>..<HASH> 100644
--- a/test/javascript/test_oracles.js
+++ b/test/javascript/test_oracles.js
@@ -148,6 +148,13 @@ contract('Oracle', function (accounts) {
await etherToken.approve(ultimateOracle.address, 100, { from: accounts[sender1] })
await ultimateOracle.challengeOutcome(2)
+ // Sender 1 tries to increase their bid but can't
+ await etherToken.deposit({value: 50, from: accounts[sender1]})
+ await etherToken.approve(ultimateOracle.address, 50, { from: accounts[sender1] })
+ await utils.assertRejects(
+ ultimateOracle.voteForOutcome(2, 50, { from: accounts[sender1] }),
+ 'increase leading vote after challenge')
+
// Sender 2 overbids sender 1
const sender2 = 1
await etherToken.deposit({value: 150, from: accounts[sender2]}) | added testcase to test increase leading vote after challenge | gnosis_pm-contracts | train | js |
77e1e8d6115503d34b5634090ce71d3ef90b1942 | diff --git a/src/Generator.php b/src/Generator.php
index <HASH>..<HASH> 100644
--- a/src/Generator.php
+++ b/src/Generator.php
@@ -18,7 +18,7 @@ class Generator
}
File::makeDirectory($docDir);
$excludeDirs = config('l5-swagger.paths.excludes');
- $swagger = \Swagger\scan($appDir, $excludeDirs);
+ $swagger = \Swagger\scan($appDir, ['exclude' => $excludeDirs]);
$filename = $docDir.'/api-docs.json';
$swagger->saveAs($filename); | Fixes excluded directories
Excluded directories were not being correctly passed to the $options of Swagger\scan() | DarkaOnLine_L5-Swagger | train | php |
0e4c81779cec46fb7d1a8cdbdbbdaa6e6ae96d63 | diff --git a/charcoal/charcoal.py b/charcoal/charcoal.py
index <HASH>..<HASH> 100644
--- a/charcoal/charcoal.py
+++ b/charcoal/charcoal.py
@@ -219,9 +219,9 @@ class Charcoal(object):
else:
message, status = self.warn_test("Insecure request made and ignored")
self.add_output("SecureRequest", message, status)
- self.output.append(dict(self.req.headers), sec='response_headers')
- self.output.append(self.req.status_code, sec='response_status_code')
if self.test["protocol"] != 'tcp':
+ self.output.append(dict(self.req.headers), sec='response_headers')
+ self.output.append(self.req.status_code, sec='response_status_code')
if 'show_body' in self.test:
try:
req_content = self.req.content.decode() | Do not record request output in TCP test
TCP tests will not have request status code or header data so only add them to
output if the test is not TCP. Previously, trying to add the data was resulting
in a stacktrace as the req object did not exist. | sky-shiny_smolder | train | py |
2b9a5193b43b60694637a1f71d9d976150c15caa | diff --git a/lib/couchrest/model/persistence.rb b/lib/couchrest/model/persistence.rb
index <HASH>..<HASH> 100644
--- a/lib/couchrest/model/persistence.rb
+++ b/lib/couchrest/model/persistence.rb
@@ -118,8 +118,8 @@ module CouchRest
#
# ==== Returns
# returns the reloaded document
- def create(attributes = {})
- instance = new(attributes)
+ def create(attributes = {}, &block)
+ instance = new(attributes, &block)
instance.create
instance
end
@@ -128,8 +128,8 @@ module CouchRest
#
# ==== Returns
# returns the reloaded document or raises an exception
- def create!(attributes = {})
- instance = new(attributes)
+ def create!(attributes = {}, &block)
+ instance = new(attributes, &block)
instance.create!
instance
end | add init block support to #create and #create! | couchrest_couchrest_model | train | rb |
08d3a27da5b78d96e25a29dd4094ac064c118e72 | diff --git a/zipline/utils/sentinel.py b/zipline/utils/sentinel.py
index <HASH>..<HASH> 100644
--- a/zipline/utils/sentinel.py
+++ b/zipline/utils/sentinel.py
@@ -13,6 +13,10 @@ class _Sentinel(object):
__slots__ = ('__weakref__',)
+def is_sentinel(obj):
+ return isinstance(obj, _Sentinel)
+
+
def sentinel(name, doc=None):
try:
value = sentinel._cache[name] # memoized
@@ -64,8 +68,4 @@ def sentinel(name, doc=None):
return Sentinel
-def is_sentinel(obj):
- return isinstance(obj, _Sentinel)
-
-
sentinel._cache = {} | MAINT: Move is_sentinel up to top of file. | quantopian_zipline | train | py |
7cd7b366a3da311fb2c7653d252fc044ecc3b578 | diff --git a/lib/guard/jasmine/inspector.rb b/lib/guard/jasmine/inspector.rb
index <HASH>..<HASH> 100644
--- a/lib/guard/jasmine/inspector.rb
+++ b/lib/guard/jasmine/inspector.rb
@@ -37,7 +37,7 @@ module Guard
# @return [Boolean] when the file valid
#
def jasmine_spec?(path)
- path =~ /(?:_s|S)pec\.(js|coffee|js\.coffee)$/ && File.exist?(path)
+ path =~ /(?:_s|S)pec\.(js|coffee|js\.coffee|cjsx|js\.cjsx)$/ && File.exist?(path)
end
end
end | Support cjsx (react jsx flavored coffeescript) | guard_guard-jasmine | train | rb |
9510f002ffda18c69574eeb2fb5be010c0c4c4d0 | diff --git a/twitter_scraper.py b/twitter_scraper.py
index <HASH>..<HASH> 100644
--- a/twitter_scraper.py
+++ b/twitter_scraper.py
@@ -17,7 +17,7 @@ def get_tweets(user, pages=25):
while pages > 0:
d = pq(r.json()['items_html'])
- tweets = [tweet.text for tweet in d('.tweet-text')]
+ tweets = [tweet.text_content() for tweet in d('.tweet-text')]
last_tweet = d('.stream-item')[-1].attrib['data-item-id']
for tweet in tweets: | Use `text_content()` instead of text
Returns text content of '.tweet-text' including text of children
(links) | kennethreitz_twitter-scraper | train | py |
b66458257d8abccb671509f98e64e4cf0b0fe417 | diff --git a/mod/forum/lib.php b/mod/forum/lib.php
index <HASH>..<HASH> 100644
--- a/mod/forum/lib.php
+++ b/mod/forum/lib.php
@@ -1475,7 +1475,7 @@ function forum_get_discussions($forum="0", $forumsort="d.timemodified DESC",
}
//TODO: there must be a nice way to do this that keeps both postgres and mysql 3.2x happy but I can't find it right now.
- if ($CFG->dbtype == 'postgres7') {
+ if ($CFG->dbtype == 'postgres7' || $CFG->dbtype == 'mssql' || $CFG->dbtype == 'oci8po') {
return get_records_sql("SELECT $postdata, d.name, d.timemodified, d.usermodified, d.groupid,
u.firstname, u.lastname, u.email, u.picture $umfields
FROM {$CFG->prefix}forum_discussions d | Adding support for MSSQL and Oracle in this select. Not really sure why we need one OUTER
join there, if every discussion has one usermodified but.....not time now. | moodle_moodle | train | php |
3ae653475d5ecbf0577a074b82638a5f53c5672a | diff --git a/spec/lib/appsignal/transaction_spec.rb b/spec/lib/appsignal/transaction_spec.rb
index <HASH>..<HASH> 100644
--- a/spec/lib/appsignal/transaction_spec.rb
+++ b/spec/lib/appsignal/transaction_spec.rb
@@ -971,7 +971,7 @@ describe Appsignal::Transaction do
end
context "when there is a session" do
- let(:foo_filter) { { filter_parameters: %w[foo] } }
+ let(:foo_filter) { { :filter_parameters => %w[foo] } }
before do
expect(transaction).to respond_to(:request) | Honor filter_parameters keys for session data (linting)
- adhere to hash rocket hash syntax | appsignal_appsignal-ruby | train | rb |
18401bc209cfaae156d166a95957cecabe4e5a8b | diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -9,11 +9,22 @@ with open('README.rst') as readme_file:
with open('HISTORY.rst') as history_file:
history = history_file.read()
-with open('requirements.txt') as req_dev_file:
- requirements = req_dev_file.read().splitlines()
+requirements = [
+ 'fs==0.5.4'
+]
-with open('requirements_dev.txt') as req_dev_file:
- test_requirements = req_dev_file.read().splitlines()
+test_requirements = [
+ 'pip==9.0.1',
+ 'watchdog==0.8.3',
+ 'flake8==3.2.0',
+ 'tox==2.5.0',
+ 'coverage==4.2',
+ 'cryptography==1.5.3',
+ 'PyYAML==3.12',
+ 'pytest==3.0.4',
+ 'fs==0.5.4',
+ 'pymongo==3.3.1'
+]
setup(
name='datafs', | return to manual setup.py requirements | ClimateImpactLab_DataFS | train | py |
e70173cced773b692d378938640228949e4f4df7 | diff --git a/phraseapp/lib.go b/phraseapp/lib.go
index <HASH>..<HASH> 100644
--- a/phraseapp/lib.go
+++ b/phraseapp/lib.go
@@ -2991,5 +2991,5 @@ func (client *Client) VersionsList(project_id, translation_id string, page, perP
}
func GetUserAgent() string {
- return "PhraseApp go (test)"
+ return "PhraseApp go (1.0.0.rc15)"
} | <I>.rc<I>
No more panics in wizard, minor wording changes | phrase_phraseapp-go | train | go |
ec4dee0fcd6cd571ffd146cbebb7367e91457a46 | diff --git a/cmd/rlpdump/main.go b/cmd/rlpdump/main.go
index <HASH>..<HASH> 100644
--- a/cmd/rlpdump/main.go
+++ b/cmd/rlpdump/main.go
@@ -19,7 +19,6 @@
package main
import (
- "bufio"
"bytes"
"encoding/hex"
"flag"
@@ -67,7 +66,7 @@ func main() {
die(err)
}
defer fd.Close()
- r = bufio.NewReader(fd)
+ r = fd
default:
fmt.Fprintln(os.Stderr, "Error: too many arguments") | cmd/rlpdump: remove extra buffer | ethereum_go-ethereum | train | go |
8c1c248c75c732c2d608aa554b17e545a03cbca6 | diff --git a/lib/discordrb/bot.rb b/lib/discordrb/bot.rb
index <HASH>..<HASH> 100644
--- a/lib/discordrb/bot.rb
+++ b/lib/discordrb/bot.rb
@@ -16,13 +16,15 @@ module Discordrb
@email = email
@password = password
- @token = login()
-
- Thread.new { websocket_connect() }
+ @token = login
@event_handlers = {}
end
+ def run
+ websocket_connect
+ end
+
def message(attributes = {}, &block)
@event_handlers[MessageEvent] ||= []
@event_handlers[MessageEvent] << MessageEventHandler.new(attributes, block) | Extegrate the websocket connection into a separate method | meew0_discordrb | train | rb |
67d4ead33ff25b6e03fbe79192563d92db7777f7 | diff --git a/test/active_record_monkey_test.rb b/test/active_record_monkey_test.rb
index <HASH>..<HASH> 100644
--- a/test/active_record_monkey_test.rb
+++ b/test/active_record_monkey_test.rb
@@ -10,7 +10,7 @@ class DatabaseRewinder::InsertRecorderTest < ActiveSupport::TestCase
end
test '#execute' do
- cleaner = DatabaseRewinder.instance_variable_get(:'@cleaners').detect {|c| c.db == 'test.sqlite3'}
+ cleaner = DatabaseRewinder.instance_variable_get(:'@cleaners').detect {|c| c.db == (ENV['DB'] == 'sqlite3' ? 'test.sqlite3' : 'test')}
assert_equal %w(foos bars), cleaner.inserted_tables
assert_not_nil cleaner.pool | SQLite3 has .sqlite3 suffix to its DB name | amatsuda_database_rewinder | train | rb |
acf6686230a9c9b1ccb53b589d523105264ca04a | diff --git a/tests/conftest.py b/tests/conftest.py
index <HASH>..<HASH> 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -37,17 +37,17 @@ def sub_cmds(request):
@pytest.fixture
def cfile(tmpdir):
from pathlib import Path
- return Path(tmpdir) / 'config.toml'
+ return Path(str(tmpdir)) / 'config.toml'
@pytest.fixture
def nonexistent_file(tmpdir):
from pathlib import Path
- return Path(tmpdir) / 'dummy.toml'
+ return Path(str(tmpdir)) / 'dummy.toml'
@pytest.fixture
def illtoml(tmpdir):
from pathlib import Path
- path = Path(tmpdir) / 'ill.toml'
+ path = Path(str(tmpdir)) / 'ill.toml'
with path.open('w') as ift:
ift.write('not}valid[toml\n')
return path | Convert tmpdir to str to make Path (py<I> and py<I>) | amorison_loam | train | py |
52c8c0b89c7cbd85b1eaa33a1dca1f5173966850 | diff --git a/plugin/exo/Library/Options/Transfer.php b/plugin/exo/Library/Options/Transfer.php
index <HASH>..<HASH> 100644
--- a/plugin/exo/Library/Options/Transfer.php
+++ b/plugin/exo/Library/Options/Transfer.php
@@ -2,6 +2,8 @@
namespace UJM\ExoBundle\Library\Options;
+use Claroline\AppBundle\API\Options as ApiOptions;
+
/**
* Defines Serializers options.
*/
@@ -50,7 +52,7 @@ final class Transfer
*
* @var string
*/
- const NO_FETCH = 'noFetch';
+ const NO_FETCH = ApiOptions::NO_FETCH;
/**
* Persist the tags of the question.
@@ -64,5 +66,5 @@ final class Transfer
*
* @var string
*/
- const REFRESH_UUID = 'refreshUuid';
+ const REFRESH_UUID = ApiOptions::REFRESH_UUID;
} | [ExoBundle] fixes copy (#<I>) | claroline_Distribution | train | php |
0df5bdf0ede90b63ed2440e4918067c6cb572be8 | diff --git a/test/command-mapper.js b/test/command-mapper.js
index <HASH>..<HASH> 100644
--- a/test/command-mapper.js
+++ b/test/command-mapper.js
@@ -13,7 +13,7 @@ var expect = require("chai").expect,
suite("CommandMapper", function() {
test("should look like a CommandMapper object", function(){
- expect(CommandMapper).to.respondTo("map");
+ expect(CommandMapper).itself.to.respondTo("map");
expect(new CommandMapper(mapping)).to.respondTo("map");
}); | Use the 'itself' flag for 'respondTo' assertion.
This will check that the CommandMapper constructor itself responds
to the static method 'map' instead of the method on its prototype. | RickEyre_command-mapper | train | js |
fa7d34bc2d426e7c7700c750bdd37d602c273320 | diff --git a/test/com/sun/javadoc/typeAnnotations/smoke/TestSmoke.java b/test/com/sun/javadoc/typeAnnotations/smoke/TestSmoke.java
index <HASH>..<HASH> 100644
--- a/test/com/sun/javadoc/typeAnnotations/smoke/TestSmoke.java
+++ b/test/com/sun/javadoc/typeAnnotations/smoke/TestSmoke.java
@@ -69,7 +69,6 @@ public class TestSmoke extends JavadocTester {
{BUG_ID + FS + "pkg" + FS + "T0x01.html", "@A"},
{BUG_ID + FS + "pkg" + FS + "T0x02.html", "@A"},
{BUG_ID + FS + "pkg" + FS + "T0x04.html", "@A"},
- {BUG_ID + FS + "pkg" + FS + "T0x1E.html", "@A"},
{BUG_ID + FS + "pkg" + FS + "T0x08.html", "@A"},
{BUG_ID + FS + "pkg" + FS + "T0x0D.html", "@A"},
{BUG_ID + FS + "pkg" + FS + "T0x06.html", "@A"}, | Remove case that was removed from the underlying example: annotations on .class expressions. | wmdietl_jsr308-langtools | train | java |
4ba1247824c5dab3c01d40db9f86a4863dd2d23d | diff --git a/tests/test_tokenizer.py b/tests/test_tokenizer.py
index <HASH>..<HASH> 100644
--- a/tests/test_tokenizer.py
+++ b/tests/test_tokenizer.py
@@ -112,6 +112,8 @@ def test_no_ssplit():
def test_spacy():
nlp = stanza.Pipeline(processors='tokenize', dir=TEST_MODELS_DIR, lang='en', tokenize_with_spacy=True)
+ assert nlp.processors['tokenize']._variant is not None
+ assert nlp.processors['tokenize']._trainer is None
doc = nlp(EN_DOC)
assert EN_DOC_GOLD_TOKENS == '\n\n'.join([sent.tokens_string() for sent in doc.sentences])
assert all([doc.text[token._start_char: token._end_char] == token.text for sent in doc.sentences for token in sent.tokens]) | change unittest test_spacy | stanfordnlp_stanza | train | py |
2b4f167d06966ccb6e0e5f62f552903a088408c1 | diff --git a/tests/__init__.py b/tests/__init__.py
index <HASH>..<HASH> 100644
--- a/tests/__init__.py
+++ b/tests/__init__.py
@@ -25,6 +25,10 @@ class MemcachedTests(unittest.TestCase):
self.client.set('test_key', 'test')
self.assertEqual('test', self.client.get('test_key'))
+ def testGetEmptyString(self):
+ self.client.set('test_key', '')
+ self.assertEqual('', self.client.get('test_key'))
+
def testGetMulti(self):
self.assertTrue(self.client.set_multi({'test_key': 'value',
'test_key2': 'value2'})) | added a test to add empty strings | jaysonsantos_python-binary-memcached | train | py |
34f84e7b3c022ed704893ec5887aba1fd1690c61 | diff --git a/aiomanhole/__init__.py b/aiomanhole/__init__.py
index <HASH>..<HASH> 100644
--- a/aiomanhole/__init__.py
+++ b/aiomanhole/__init__.py
@@ -60,8 +60,7 @@ class InteractiveInterpreter:
raise ValueError("Cannot handle unknown banner type {!}, expected str or bytes".format(banner.__class__.__name__))
def attempt_compile(self, line):
- codeobj = self.compiler(line)
- return codeobj
+ return self.compiler(line)
def send_exception(self):
"""When an exception has occurred, write the traceback to the user.""" | Pointless indirection, be gone! | nathan-hoad_aiomanhole | train | py |
29d85c7aaf1bbebd2eee1d0fbdd1bc8f51f28f6e | diff --git a/lib/deliver/deliverfile/deliverfile_creator.rb b/lib/deliver/deliverfile/deliverfile_creator.rb
index <HASH>..<HASH> 100644
--- a/lib/deliver/deliverfile/deliverfile_creator.rb
+++ b/lib/deliver/deliverfile/deliverfile_creator.rb
@@ -81,6 +81,10 @@ module Deliver
FileUtils.mkdir_p metadata_path
json = create_json_based_on_xml(app, metadata_path)
+
+ json.each do |key, value|
+ json[key].delete(:version_whats_new)
+ end
meta_path = "#{metadata_path}metadata.json"
File.write(meta_path, JSON.pretty_generate(json)) | Removed changelog from deliver generated app metadata | fastlane_fastlane | train | rb |
a9bc1442c9c30ddc1caa480bfaa8f6b6029c2ad8 | diff --git a/src/index.js b/src/index.js
index <HASH>..<HASH> 100644
--- a/src/index.js
+++ b/src/index.js
@@ -25,7 +25,7 @@ function sortMentions(mentions) {
* @return {RegExp}
*/
function mentionRegExp(mention) {
- return new RegExp(`^${escapeStringRegExp(mention)}(?:\\b|\\s|$)`, 'i');
+ return new RegExp(`^${escapeStringRegExp(mention)}(?:\\b|\\s|\\W|$)`, 'i');
}
/**
diff --git a/test/index.js b/test/index.js
index <HASH>..<HASH> 100644
--- a/test/index.js
+++ b/test/index.js
@@ -215,5 +215,15 @@ describe('utils/parseChatMarkup', () => {
{ type: 'mention', mention: 'user[afk]', raw: 'user[AFK]' },
]);
});
+
+ it('parses @-mentions with no clear word boundary', () => {
+ expect(parseChatMarkup('hello @ReAnna!!!', {
+ mentions: ['ReAnna!!'],
+ })).to.eql([
+ 'hello ',
+ { type: 'mention', mention: 'reanna!!', raw: 'ReAnna!!' },
+ '!',
+ ]);
+ });
});
}); | fix mentions when username ends in punctuation. (#<I>) | u-wave_parse-chat-markup | train | js,js |
a4fc6929bec9639bd116557313025f8a60a62fcc | diff --git a/core-bundle/src/Resources/contao/classes/Versions.php b/core-bundle/src/Resources/contao/classes/Versions.php
index <HASH>..<HASH> 100644
--- a/core-bundle/src/Resources/contao/classes/Versions.php
+++ b/core-bundle/src/Resources/contao/classes/Versions.php
@@ -452,6 +452,7 @@ class Versions extends \Backend
$arrRow['to'] = $objVersions->version;
$arrRow['date'] = date($GLOBALS['TL_CONFIG']['datimFormat'], $objVersions->tstamp);
$arrRow['description'] = \String::substr($arrRow['description'], 32);
+ $arrRow['fromTable'] = \String::substr($arrRow['fromTable'], 18); // see #5769
if ($arrRow['editUrl'] != '')
{ | [Core] Limit the width of the table names in the version overview (see #<I>) | contao_contao | train | php |
d70b13f050e9de4c659e45ec672864e3f6645473 | diff --git a/src/geshi/tcl.php b/src/geshi/tcl.php
index <HASH>..<HASH> 100644
--- a/src/geshi/tcl.php
+++ b/src/geshi/tcl.php
@@ -187,9 +187,6 @@ $language_data = array (
'PARSER_CONTROL' => array(
'COMMENTS' => array(
'DISALLOWED_BEFORE' => '\\'
- ),
- 'ENABLE_FLAGS' => array(
-// 'KEYWORDS' => GESHI_NEVER,
)
)
); | fix: Removed superfluous ENABLE_FLAGS entry from tcl.php | GeSHi_geshi-1.0 | train | php |
5f0ebfc7cb34f54f12f8cdea8e062b6f4f3c4159 | diff --git a/src/services/decoratelayer.js b/src/services/decoratelayer.js
index <HASH>..<HASH> 100644
--- a/src/services/decoratelayer.js
+++ b/src/services/decoratelayer.js
@@ -1,3 +1,12 @@
+/**
+ * @fileoverview Provides a function that adds properties (using
+ * `Object.defineProperty`) to the layer, making it possible to control layer
+ * properties with ngModel.
+ *
+ * Example:
+ * <input type="checkbox" ngModel="layer.visible" />
+ */
+
goog.provide('ngeo.DecorateLayer');
goog.require('goog.asserts');
@@ -11,13 +20,6 @@ ngeo.DecorateLayer;
/**
- * This service provides a function that adds properties (using
- * `Object.defineProperty`) to the layer, making it possible to
- * control layer properties with ngModel.
- *
- * Example:
- * <input type="checkbox" ngModel="layer.visible" />
- *
* @param {ol.layer.Layer} layer Layer to decorate.
*/
ngeo.decorateLayer = function(layer) { | Add @fileoverview to decoratelayer.js | camptocamp_ngeo | train | js |
fecec19a71e211289791d4244ca3b5c6e5c49f74 | diff --git a/egcd/egcd.py b/egcd/egcd.py
index <HASH>..<HASH> 100644
--- a/egcd/egcd.py
+++ b/egcd/egcd.py
@@ -15,9 +15,9 @@ def egcd(b: int, n: int) -> Tuple[int, int, int]:
This implementation is adapted from the sources below:
* `Extended Euclidean Algorithm <https://brilliant.org/wiki/extended-euclidean-algorithm/>`__
- on `Brilliant.org <https://brilliant.org>`__,
+ on `Brilliant.org <https://brilliant.org>`__,
* `Modular inverse <https://rosettacode.org/wiki/Modular_inverse>`__
- on `Rosetta Code <https://rosettacode.org>`__,
+ on `Rosetta Code <https://rosettacode.org>`__,
* `Algorithm Implementation/Mathematics/Extended Euclidean algorithm <https://en.wikibooks.org/wiki/Algorithm_Implementation/Mathematics/Extended_Euclidean_algorithm>`__
on `Wikibooks <https://en.wikibooks.org>`__, and
* `Euclidean algorithm <https://en.wikipedia.org/wiki/Euclidean_algorithm>`__ | Fix formatting issue caused by errant whitespace in docstring. | lapets_egcd | train | py |
c9a9705ef14fd843ff73fb2b4c9b4f58c1fce4c5 | diff --git a/mod/quiz/export.php b/mod/quiz/export.php
index <HASH>..<HASH> 100644
--- a/mod/quiz/export.php
+++ b/mod/quiz/export.php
@@ -4,6 +4,10 @@
require_once("../../config.php");
require_once("locallib.php");
+ // list formats that are supported for export
+ // need to change this if you add something!
+ $fileformats = array( 'gift', 'xml', 'qti' );
+
require_variable($category);
optional_variable($format);
@@ -87,8 +91,7 @@
error("No categories!");
}
- $fileformats = get_list_of_plugins("mod/quiz/format");
- $fileformatname = array();
+ // iterate over valid formats to generate dropdown list
foreach ($fileformats as $key => $fileformat) {
$formatname = get_string($fileformat, 'quiz');
if ($formatname == "[[$fileformat]]") { | Now only displays available export formats. List is now hard-coded in this file. | moodle_moodle | train | php |
196cddbb66981ce4b682719a6cc329e5af6a13f0 | diff --git a/lib/flag_shih_tzu.rb b/lib/flag_shih_tzu.rb
index <HASH>..<HASH> 100644
--- a/lib/flag_shih_tzu.rb
+++ b/lib/flag_shih_tzu.rb
@@ -68,7 +68,7 @@ module FlagShihTzu
def check_flag_column
unless columns.any? { |column| column.name == flag_column && column.type == :integer }
- raise "Table '#{table_name}' must have an integer column named '#{flag_column}' in order to use FlagShihTzu"
+ puts "Error: Table '#{table_name}' must have an integer column named '#{flag_column}' in order to use FlagShihTzu"
end
end | Changed flags column check to print an error instead of raising an exception. It avoids raising an error when installing the plugin in an existing application. | pboling_flag_shih_tzu | train | rb |
1141683df31d33e20b2b0fcc0ab1fba0040daa1a | diff --git a/lib/ezutils/classes/ezsession.php b/lib/ezutils/classes/ezsession.php
index <HASH>..<HASH> 100644
--- a/lib/ezutils/classes/ezsession.php
+++ b/lib/ezutils/classes/ezsession.php
@@ -56,12 +56,18 @@ function &eZSessionRead( $key )
$key =& $db->escapeString( $key );
- $sessionRes =& $db->arrayQuery( "SELECT data, user_id FROM ezsession WHERE session_key='$key'" );
+ $sessionRes =& $db->arrayQuery( "SELECT data, user_id, expiration_time FROM ezsession WHERE session_key='$key'" );
if ( count( $sessionRes ) == 1 )
{
+ $ini =& eZINI::instance();
+
+ $sessionUpdatesTime = $sessionRes[0]['expiration_time'] - $ini->variable( 'Session', 'SessionTimeout' );
+ $sessionIdle = time() - $sessionUpdatesTime;
+
$data =& $sessionRes[0]['data'];
$GLOBALS['eZSessionUserID'] = $sessionRes[0]['user_id'];
+ $GLOBALS['eZSessionIdleTime'] = $sessionIdle;
return $data;
} | - Fixed missing patch to ezsession for handling user idle time. Needed to make new content search work properly.
git-svn-id: file:///home/patrick.allaert/svn-git/ezp-repo/ezpublish/trunk@<I> a<I>eee8c-daba-<I>-acae-fa<I>f<I> | ezsystems_ezpublish-legacy | train | php |
52b44d13ed7d0572e8bc8122256e72b28dbf218d | diff --git a/pkg/option/monitor.go b/pkg/option/monitor.go
index <HASH>..<HASH> 100644
--- a/pkg/option/monitor.go
+++ b/pkg/option/monitor.go
@@ -52,7 +52,7 @@ const (
// MonitorAggregationLevelMax is the maximum level of aggregation
// currently supported.
- MonitorAggregationLevelMax = MonitorAggregationLevelMedium
+ MonitorAggregationLevelMax OptionSetting = 4
)
// monitorAggregationOption maps a user-specified string to a monitor
@@ -81,6 +81,7 @@ var monitorAggregationFormat = map[OptionSetting]string{
MonitorAggregationLevelLowest: "Lowest",
MonitorAggregationLevelLow: "Low",
MonitorAggregationLevelMedium: "Medium",
+ MonitorAggregationLevelMax: "Max",
}
// VerifyMonitorAggregationLevel validates the specified key/value for a | Fix setting monitorAggregationLevel to max reflects via CLI
This PR fixes setting MonitorAggregationLevel to max to correctly
reflect through CLI.
Fixes: #<I> | cilium_cilium | train | go |
bef9cea8c27a16d25e66659fcc55eb1408c25a50 | diff --git a/brother_ql/__init__.py b/brother_ql/__init__.py
index <HASH>..<HASH> 100644
--- a/brother_ql/__init__.py
+++ b/brother_ql/__init__.py
@@ -4,3 +4,7 @@ class BrotherQLUnsupportedCmd(BrotherQLError): pass
class BrotherQLUnknownModel(BrotherQLError): pass
class BrotherQLRasterError(BrotherQLError): pass
+from .raster import BrotherQLRaster
+
+from .brother_ql_create import create_label
+ | make BrotherQLRaster & create_label avail. at package level | pklaus_brother_ql | train | py |
39d090ba92cd369c4200a8a852fe236b6f7a6b7a | diff --git a/asana/version.py b/asana/version.py
index <HASH>..<HASH> 100644
--- a/asana/version.py
+++ b/asana/version.py
@@ -1 +1 @@
-VERSION = '0.2.1'
+VERSION = '0.2.2' | Releasing version <I> | Asana_python-asana | train | py |
89fdab917030008e1b8cca3693d5f7a815417d94 | diff --git a/src/core/TSDB.java b/src/core/TSDB.java
index <HASH>..<HASH> 100644
--- a/src/core/TSDB.java
+++ b/src/core/TSDB.java
@@ -651,7 +651,7 @@ public final class TSDB {
}
Bytes.setInt(row, (int) base_time, metrics.width() + Const.SALT_WIDTH());
- Internal.prefixKeyWithSalt(row);
+ RowKey.prefixKeyWithSalt(row);
scheduleForCompaction(row, (int) base_time);
final PutRequest point = new PutRequest(table, row, FAMILY, qualifier, value); | Point the TSDB to use the RowKey class for salting support | OpenTSDB_opentsdb | train | java |
ca215d18459f47d9b510eb3064189ceaa920c47f | diff --git a/test/run.js b/test/run.js
index <HASH>..<HASH> 100644
--- a/test/run.js
+++ b/test/run.js
@@ -16,14 +16,14 @@ describe('routes', function(){
it('should configure the module correctly', function(){
routes.configure({
basePath: 'http://local.host',
- prefix: '/app/',
+ prefix: '/site/',
helpers: {
generateUrl: 'genUrl'
}
});
assert.equal('http://local.host', routes.config.basePath);
- assert.equal('/app/', routes.config.prefix);
+ assert.equal('/site/', routes.config.prefix);
assert.equal('genUrl', routes.config.helpers.generateUrl);
});
@@ -39,7 +39,9 @@ describe('routes', function(){
describe('express helper', function(){
it('should not error when calling the helper', function(){
- routes(app);
+ routes(app, {
+ prefix: '/app/'
+ });
});
}); | Updated tests
Updated the tests to account for the new options parameter in the helper | dluces_express-routes | train | js |
854ba47b9692e61410a8338caeb7910da0871360 | diff --git a/index.js b/index.js
index <HASH>..<HASH> 100644
--- a/index.js
+++ b/index.js
@@ -352,6 +352,7 @@ SSDP.prototype.stop = function () {
this.advertise(false)
this.advertise(false)
this.sock.close()
+ this.sock = null;
} | Null socket when stopping the service.
Fixes #8. | diversario_node-ssdp | train | js |
44ef2eec7abc965fd1fbf266827a561916b3ba77 | diff --git a/fritzconnection/fritztools.py b/fritzconnection/fritztools.py
index <HASH>..<HASH> 100644
--- a/fritzconnection/fritztools.py
+++ b/fritzconnection/fritztools.py
@@ -1,6 +1,9 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
+from __future__ import division
+
+
"""
helper functions. | fixed division error with python2 | kbr_fritzconnection | train | py |
2da8a42d86e286a209751959c27fc8b508ebf494 | diff --git a/test/backend-test.js b/test/backend-test.js
index <HASH>..<HASH> 100644
--- a/test/backend-test.js
+++ b/test/backend-test.js
@@ -157,12 +157,12 @@ suite.addBatch({
suite.addBatch({
'connect client to backend socket': {
topic: function () {
- sock = socket_client('http://127.0.0.1:' + testport);
+ sock = socket_client.connect('http://127.0.0.1:' + testport);
sock.on('connect', this.callback);
},
- 'connected': function () {
- //Connected successfully
+ 'connected': function (err) {
+ assert.ifError(err);
}
}
}); | for some reason the test changes were not coming through | Chatham_statsd-socket.io | train | js |
2fb8068c532bb4b2afd273a3932e31d0184c96c1 | diff --git a/zounds/__init__.py b/zounds/__init__.py
index <HASH>..<HASH> 100644
--- a/zounds/__init__.py
+++ b/zounds/__init__.py
@@ -47,7 +47,7 @@ from index import SearchResults, HammingDb, HammingIndex
from basic import \
Slice, Sum, Max, Pooled, process_dir, stft, audio_graph, with_onsets, \
- resampled
+ resampled, frequency_adaptive
from util import \
simple_lmdb_settings, simple_in_memory_settings, \
diff --git a/zounds/basic/__init__.py b/zounds/basic/__init__.py
index <HASH>..<HASH> 100644
--- a/zounds/basic/__init__.py
+++ b/zounds/basic/__init__.py
@@ -2,5 +2,6 @@ from basic import Slice, Sum, Max, Pooled, Binarize
from util import process_dir
-from audiograph import resampled, stft, audio_graph, with_onsets
+from audiograph import \
+ resampled, stft, audio_graph, with_onsets, frequency_adaptive | Export the frequency adaptive convenience function from the top-level module | JohnVinyard_zounds | train | py,py |
06fe3520ee1c527511069e44c7d300a13d4eaabb | diff --git a/src/sos/hosts.py b/src/sos/hosts.py
index <HASH>..<HASH> 100755
--- a/src/sos/hosts.py
+++ b/src/sos/hosts.py
@@ -1030,9 +1030,16 @@ class Host:
return self._get_local_host()
if not isinstance(alias, str):
raise ValueError(f'A string is expected for host {alias}')
- if 'hosts' not in env.sos_dict['CONFIG'] or alias not in env.sos_dict[
- 'CONFIG']['hosts']:
- raise ValueError(f'Undefined remote host {alias}')
+ if 'hosts' not in env.sos_dict['CONFIG']:
+ env.sos_dict['CONFIG']['hosts'] = {}
+ if alias in env.sos_dict['CONFIG']['hosts']:
+ return alias
+ # assuming the host name is a name or IP address
+ env.logger.debug(f'Assuming {alias} to be a hostname or IP address not defined in hosts file')
+ env.sos_dict['CONFIG']['hosts'][alias] = {
+ 'address': alias,
+ 'alias': alias,
+ }
return alias
def _get_config(self, alias: Optional[str]) -> None: | Allow the use of hostname or IP address as hosts (without task engine and other information) | vatlab_SoS | train | py |
b4c2c42dc806f44b53870ba63615ace7f96685b7 | diff --git a/closure/goog/base.js b/closure/goog/base.js
index <HASH>..<HASH> 100644
--- a/closure/goog/base.js
+++ b/closure/goog/base.js
@@ -1800,6 +1800,7 @@ goog.mixin = function(target, source) {
/**
* @return {number} An integer value representing the number of milliseconds
* between midnight, January 1, 1970 and the current time.
+ * @deprecated Use Date.now
*/
goog.now = (goog.TRUSTED_SITE && Date.now) || (function() {
// Unary plus operator converts its operand to a number which in | Deprecate goog.now.
RELNOTES: goog.now is now deprecated in favor of Date.now
-------------
Created by MOE: <URL> | google_closure-library | train | js |
456853be4688a9d016b7d2084be1420d068b3b34 | diff --git a/src/Console/ModelsCommand.php b/src/Console/ModelsCommand.php
index <HASH>..<HASH> 100644
--- a/src/Console/ModelsCommand.php
+++ b/src/Console/ModelsCommand.php
@@ -175,7 +175,8 @@ class ModelsCommand extends Command
// handle abstract classes, interfaces, ...
$reflectionClass = new \ReflectionClass($name);
- if (!$reflectionClass->isSubclassOf('Illuminate\Database\Eloquent\Model')) {
+ if (!$reflectionClass->isSubclassOf('Illuminate\Database\Eloquent\Model')
+ || $reflectionClass->isSubclassOf('Illuminate\Database\Eloquent\Relations\Pivot')) {
continue;
} | ignore intermediate table models (#<I>) | barryvdh_laravel-ide-helper | train | php |
b2b29bc540779629cb2a7c91e5e487628827e73e | diff --git a/framework/zii/widgets/grid/CButtonColumn.php b/framework/zii/widgets/grid/CButtonColumn.php
index <HASH>..<HASH> 100644
--- a/framework/zii/widgets/grid/CButtonColumn.php
+++ b/framework/zii/widgets/grid/CButtonColumn.php
@@ -149,10 +149,13 @@ class CButtonColumn extends CGridColumn
* 'visible'=>'...', // a PHP expression for determining whether the button is visible
* )
* </pre>
+ *
* In the PHP expression for the 'url' option and/or 'visible' option, the variable <code>$row</code>
* refers to the current row number (zero-based), and <code>$data</code> refers to the data model for
* the row.
*
+ * If the 'buttonID' is 'view', 'update' or 'delete' the options will be applied to the default buttons.
+ *
* Note that in order to display non-default buttons, the {@link template} property needs to
* be configured so that the corresponding button IDs appear as tokens in the template.
*/ | Added doc clarification for #<I> #<I> | yiisoft_yii | train | php |
872893b830ffeb1be5382810640e4bda90ca53e6 | diff --git a/spec/provider/s3_spec.rb b/spec/provider/s3_spec.rb
index <HASH>..<HASH> 100644
--- a/spec/provider/s3_spec.rb
+++ b/spec/provider/s3_spec.rb
@@ -134,6 +134,13 @@ describe DPL::Provider::S3 do
provider.push_app
end
+ example "Sets SSE" do
+ provider.options.update(:server_side_encryption => true)
+ expect(Dir).to receive(:glob).and_yield(__FILE__)
+ expect_any_instance_of(Aws::S3::Object).to receive(:upload_file).with(anything(), hash_including(:server_side_encryption => "AES256"))
+ provider.push_app
+ end
+
example "Sets Website Index Document" do
provider.options.update(:index_document_suffix => "test/index.html")
expect(Dir).to receive(:glob).and_yield(__FILE__) | Add rspec testing. Patterned after storage_class work. | travis-ci_dpl | train | rb |
191bb92aa2f8b9392f612a682f25d80d282203f2 | diff --git a/index.js b/index.js
index <HASH>..<HASH> 100644
--- a/index.js
+++ b/index.js
@@ -1,7 +1,7 @@
// adapted from https://github.com/grawity/code/blob/master/lib/python/nullroute/irc.py#L24-L53
module.exports = function parsePrefix(prefix) {
- if (prefix.length === 0) {
+ if (!prefix || prefix.length === 0) {
return null
} | Check is prefix does not exist (fixes #1) | sigkell_irc-prefix-parser | train | js |
ffdaf3f5c49f85762780e86f19868c99295138ef | diff --git a/src/graphql_relay/connection/connectiontypes.py b/src/graphql_relay/connection/connectiontypes.py
index <HASH>..<HASH> 100644
--- a/src/graphql_relay/connection/connectiontypes.py
+++ b/src/graphql_relay/connection/connectiontypes.py
@@ -20,10 +20,10 @@ class PageInfoType(Protocol):
def endCursor(self) -> Optional[ConnectionCursor]:
...
- def hasPreviousPage(self) -> Optional[bool]:
+ def hasPreviousPage(self) -> bool:
...
- def hasNextPage(self) -> Optional[bool]:
+ def hasNextPage(self) -> bool:
...
@@ -33,8 +33,8 @@ class PageInfoConstructor(Protocol):
*,
startCursor: Optional[ConnectionCursor],
endCursor: Optional[ConnectionCursor],
- hasPreviousPage: Optional[bool],
- hasNextPage: Optional[bool],
+ hasPreviousPage: bool,
+ hasNextPage: bool,
) -> PageInfoType:
...
@@ -44,8 +44,8 @@ class PageInfo(NamedTuple):
startCursor: Optional[ConnectionCursor]
endCursor: Optional[ConnectionCursor]
- hasPreviousPage: Optional[bool]
- hasNextPage: Optional[bool]
+ hasPreviousPage: bool
+ hasNextPage: bool
class EdgeType(Protocol): | hasPrevious/NextPage should not be optional (#<I>)
Replicates graphql/graphql-relay-js@<I>a<I>ac<I>c3b<I>a<I>ec<I>cc<I>dee<I>e5bb5 | graphql-python_graphql-relay-py | train | py |
4d619f404852729ad12d0dbd42752463f7fe86ef | diff --git a/scanpy/api/pl.py b/scanpy/api/pl.py
index <HASH>..<HASH> 100644
--- a/scanpy/api/pl.py
+++ b/scanpy/api/pl.py
@@ -1,4 +1,4 @@
-from ..plotting.anndata import scatter, violin, ranking, clustermap, heatmap
+from ..plotting.anndata import scatter, violin, ranking, clustermap, heatmap, dotplot
from ..plotting.preprocessing import filter_genes_dispersion | added dotplot to api | theislab_scanpy | train | py |
3faf3035ccbd848e9e82c3cacf214fd86deb98ca | diff --git a/etcd/v3/kv_etcd.go b/etcd/v3/kv_etcd.go
index <HASH>..<HASH> 100644
--- a/etcd/v3/kv_etcd.go
+++ b/etcd/v3/kv_etcd.go
@@ -77,7 +77,7 @@ func (w *watchQ) start() {
// Indicate the caller that watch has been canceled
_ = w.cb(key, w.opaque, nil, kvdb.ErrWatchStopped)
// Indicate that watch is returning.
- w.watchRet <- err
+ close(w.watchRet)
break
}
}
@@ -914,7 +914,7 @@ func (et *etcdKV) watchStart(
action = "unknown"
}
if !watchQ.enqueue(key, et.resultToKv(ev.Kv, action), err) {
- break
+ return
}
}
}
@@ -928,8 +928,9 @@ func (et *etcdKV) watchStart(
// Indicate the caller that watch has been canceled
logrus.Errorf("Watch closing session")
watchQ.enqueue(key, nil, kvdb.ErrWatchStopped)
- case err := <-watchRet: // error in watcher
- logrus.Errorf("Watch for %v stopped: %v", key, err)
+ case <-watchRet: // error in watcher
+ logrus.Errorf("Watch for %v stopped", key)
+ return
}
} | Return on watch close
break does not work since there is a double loop. | portworx_kvdb | train | go |
fe617a6227f3041d56154f8d603b6bfed14666c7 | diff --git a/lib/dialects/sqlite3/runner.js b/lib/dialects/sqlite3/runner.js
index <HASH>..<HASH> 100644
--- a/lib/dialects/sqlite3/runner.js
+++ b/lib/dialects/sqlite3/runner.js
@@ -40,17 +40,17 @@ Runner_SQLite3.prototype._query = Promise.method(function(obj) {
});
});
-// Grab a connection, run the query via the MySQL streaming interface,
-// and pass that through to the stream we've sent back to the client.
+// Sounds like .each doesn't work great for
Runner_SQLite3.prototype._stream = Promise.method(function(sql, stream, options) {
var runner = this;
return new Promise(function(resolver, rejecter) {
stream.on('error', rejecter);
stream.on('end', resolver);
- runner.connection.each(sql.sql, sql.bindings, function(err, row) {
- if (err) return rejecter(err);
+ return runner.query().map(function(row) {
stream.write(row);
- }, function() {
+ }).catch(function() {
+ stream.emit('error');
+ }).then(function() {
stream.end();
});
}); | different stream implementation for the sqlite3 runner | tgriesser_knex | train | js |
2cbf58081684bb1f887d76026282ed1e1525f05b | diff --git a/test/test-load-filters-on-demand.js b/test/test-load-filters-on-demand.js
index <HASH>..<HASH> 100644
--- a/test/test-load-filters-on-demand.js
+++ b/test/test-load-filters-on-demand.js
@@ -25,7 +25,7 @@ function buildChecklist(tf, colIdx){
module('Sanity checks');
-test('Selet type filters exist', function() {
+test('Select type filters exist', function() {
deepEqual(tf.loadFltOnDemand, true, 'loadFltOnDemand property');
notEqual(flt1, null, 'Filter 1 element exists');
notEqual(flt2, null, 'Filter 2 element exists'); | Fixed typo in test load filters on demand | koalyptus_TableFilter | train | js |
e2299dc389bbf84ee1bd56edc23202ec5f9249e2 | diff --git a/spacy/language.py b/spacy/language.py
index <HASH>..<HASH> 100644
--- a/spacy/language.py
+++ b/spacy/language.py
@@ -350,6 +350,7 @@ class Language(object):
'ner': self.entity.cfg if self.entity else {},
}
+ path = util.ensure_path(path)
self.setup_directory(path, **configs)
strings_loc = path / 'vocab' / 'strings.json' | Ensure path in save_to_directory | explosion_spaCy | train | py |
68df396ab6db0c3dab7c65a037730d5743eadaaa | diff --git a/includes/functions.php b/includes/functions.php
index <HASH>..<HASH> 100644
--- a/includes/functions.php
+++ b/includes/functions.php
@@ -1368,7 +1368,7 @@ function yourls_check_IP_flood( $ip = '' ) {
if( ( $now - $then ) <= YOURLS_FLOOD_DELAY_SECONDS ) {
// Flood!
yourls_do_action( 'ip_flood', $ip, $now - $then );
- yourls_die( yourls__( 'Too many URLs added too fast. Slow down please.' ), yourls__( 'Forbidden' ), 403 );
+ yourls_die( yourls__( 'Too many URLs added too fast. Slow down please.' ), yourls__( 'Too Many Requests' ), 429 );
}
} | use correct http status code for rate limiting | YOURLS_YOURLS | train | php |
083f9eb9273b22030655c4fdbd2178e82cd304a2 | diff --git a/lib/page.js b/lib/page.js
index <HASH>..<HASH> 100644
--- a/lib/page.js
+++ b/lib/page.js
@@ -89,16 +89,16 @@ Page.prototype.event = function(name){
};
/**
- * Convert this Page to a Track facade with `event`.
+ * Convert this Page to a Track facade with `name`.
*
- * @param {String} event
+ * @param {String} name
* @return {Track}
*/
-Page.prototype.track = function(event){
+Page.prototype.track = function(name){
var props = this.properties();
return new Track({
- properties: props,
- event: event
+ event: this.event(name),
+ properties: props
});
};
diff --git a/test/page.js b/test/page.js
index <HASH>..<HASH> 100644
--- a/test/page.js
+++ b/test/page.js
@@ -74,7 +74,9 @@ describe('Page', function(){
});
expect(page.track('event')).to.be.a(Track);
- expect(page.track('event').event()).to.eql('event');
+ expect(page.track().event()).to.eql('Loaded a Page');
+ expect(page.track('name').event()).to.eql('Viewed name Page');
+ expect(page.track('category').event()).to.eql('Viewed category Page');
expect(page.track('event').properties()).to.eql({
category: 'category',
name: 'name', | change .track() to accept name instead of event | segmentio_facade | train | js,js |
e8786d12bae42ef6a972ab1e1eec7873eb5d2b51 | diff --git a/Bridges/HttpKernel.php b/Bridges/HttpKernel.php
index <HASH>..<HASH> 100644
--- a/Bridges/HttpKernel.php
+++ b/Bridges/HttpKernel.php
@@ -159,7 +159,13 @@ class HttpKernel implements BridgeInterface
$this->tempFiles[] = $tmpname;
if (UPLOAD_ERR_NO_FILE == $file->getError()) {
- $file = null;
+ $file = [
+ 'error' => $file->getError(),
+ 'name' => $file->getClientFilename(),
+ 'size' => $file->getSize(),
+ 'tmp_name' => $tmpname,
+ 'type' => $file->getClientMediaType()
+ ];
} else {
if (UPLOAD_ERR_OK == $file->getError()) {
file_put_contents($tmpname, (string)$file->getStream()); | Fix empty file inputs in Symfony <I> (#<I>)
Symfony <I> fails on uploaded files that are null: they must be array
or UploadedFile. UploadedFile can only be used for actual files.
Solution is to pass the uploaded file as array instead.
The array cannot be passed for actual uploaded files because Symfony
will not trust the files because they were not created by PHP core.
A better solution would be to let Symfony accept null files (see
implementation of FileBag). | php-pm_php-pm-httpkernel | train | php |
b32a0879a96aa9b58095278936b33514741e34c8 | diff --git a/supervisor/iptables.go b/supervisor/iptables.go
index <HASH>..<HASH> 100644
--- a/supervisor/iptables.go
+++ b/supervisor/iptables.go
@@ -355,7 +355,7 @@ func (s *iptablesSupervisor) chainRules(appChain string, netChain string, ip str
appPacketIPTableContext,
appPacketIPTableSection,
"-s", ip,
- "-i", "docker0",
+ // "-i", "docker0",
"-m", "comment", "--comment", "Container specific chain",
"-j", appChain,
},
@@ -363,7 +363,7 @@ func (s *iptablesSupervisor) chainRules(appChain string, netChain string, ip str
appPacketIPTableSection,
"-s", ip,
"-p", "tcp",
- "-i", "docker0",
+ // "-i", "docker0",
"-m", "comment", "--comment", "Container specific chain",
"-j", appChain,
}, | FIXED: No need for docker0 reference | aporeto-inc_trireme-lib | train | go |
d37b3080d908f8aeb9496814adf71c1b5082cc0e | diff --git a/eth/vm/forks/london/headers.py b/eth/vm/forks/london/headers.py
index <HASH>..<HASH> 100644
--- a/eth/vm/forks/london/headers.py
+++ b/eth/vm/forks/london/headers.py
@@ -22,9 +22,12 @@ from eth.abc import (
from eth.constants import GENESIS_GAS_LIMIT
from eth.rlp.headers import BlockHeader
from eth.vm.forks.berlin.headers import (
- compute_berlin_difficulty,
configure_header,
)
+from eth.vm.forks.muir_glacier.headers import (
+ compute_difficulty,
+)
+
from .blocks import LondonBlockHeader
from .constants import (
@@ -121,7 +124,7 @@ def create_header_from_parent(difficulty_fn: Callable[[BlockHeaderAPI, int], int
return new_header
-compute_london_difficulty = compute_berlin_difficulty
+compute_london_difficulty = compute_difficulty(9700000)
create_london_header_from_parent = create_header_from_parent(
compute_london_difficulty | eip-<I>: delay difficulty bomb further to ~ Dec <I> | ethereum_py-evm | train | py |
8fc7e339dcc443aeec74e62dbf2eec583caef40f | diff --git a/pylint_django/transforms/transforms/django_views_generic_base.py b/pylint_django/transforms/transforms/django_views_generic_base.py
index <HASH>..<HASH> 100644
--- a/pylint_django/transforms/transforms/django_views_generic_base.py
+++ b/pylint_django/transforms/transforms/django_views_generic_base.py
@@ -1,7 +1,7 @@
class View(object):
request = None
- args = None
- kwargs = None
+ args = ()
+ kwargs = {}
# as_view is marked as class-only
def as_view(*args, **kwargs): | Fix view.args and view.kwargs types
Args should be a tuple and kwargs a dict so that Pylint gets the types correct. | PyCQA_pylint-django | train | py |
c61a6ed3b6deca96098ee717f575befe49a3857b | diff --git a/bakery/tasks.py b/bakery/tasks.py
index <HASH>..<HASH> 100644
--- a/bakery/tasks.py
+++ b/bakery/tasks.py
@@ -507,7 +507,7 @@ def fontaine_process(project, build, log):
os.chdir(_out)
files = glob.glob('*.ttf')
for file in files:
- cmd = "python pyfontaine --text '%s' >> 'sources/fontaine.txt'" % file
+ cmd = "pyfontaine --text '%s' >> 'sources/fontaine.txt'" % file
run(cmd, cwd=_out, log=log)
# TODO also save the totals for the dashboard....
# log.write('Running Fontaine on Results\n', prefix='### ') | pyfontaine is a standalone script | googlefonts_fontbakery | train | py |
659a3d81dabd02512e0ac18c33215ef47b161b7b | diff --git a/resource_aws_cloudtrail.go b/resource_aws_cloudtrail.go
index <HASH>..<HASH> 100644
--- a/resource_aws_cloudtrail.go
+++ b/resource_aws_cloudtrail.go
@@ -200,7 +200,7 @@ func cloudTrailGetLoggingStatus(conn *cloudtrail.CloudTrail, id *string) (bool,
}
resp, err := conn.GetTrailStatus(GetTrailStatusOpts)
if err != nil {
- return false, fmt.Errorf("Error retrieving logging status of CloudTrail (%s): %s", id, err)
+ return false, fmt.Errorf("Error retrieving logging status of CloudTrail (%s): %s", *id, err)
}
return *resp.IsLogging, err | Mistake in type refactor in cloudTrailGetLoggingStatus
When adjusting the types to prevent casting, I didn't change the error
message to handle the pointer change. "go tool vet" caught this. | terraform-providers_terraform-provider-aws | train | go |
daca0a8c96e477f5609af73fe2a2ac9d49f99078 | diff --git a/lib/Thelia/ImportExport/Export/Type/ProductSEOExport.php b/lib/Thelia/ImportExport/Export/Type/ProductSEOExport.php
index <HASH>..<HASH> 100644
--- a/lib/Thelia/ImportExport/Export/Type/ProductSEOExport.php
+++ b/lib/Thelia/ImportExport/Export/Type/ProductSEOExport.php
@@ -28,6 +28,7 @@ class ProductSEOExport extends JsonFileAbstractExport
public const FILE_NAME = 'product_seo';
protected $orderAndAliases = [
+ 'product_id' => 'id',
'product_ref' => 'ref',
'product_i18n_title' => 'product_title',
'product_visible' => 'visible',
@@ -43,6 +44,7 @@ class ProductSEOExport extends JsonFileAbstractExport
$con = Propel::getConnection();
$query = 'SELECT
+ product.id as "product_id",
product.ref as "product_ref",
product_i18n.title as "product_i18n_title",
product.visible as "product_visible", | adding IDs in product SEO export (#<I>) | thelia_core | train | php |
3000535046b65aa3f0344bb8678606b3e89f56fa | diff --git a/jodd-db/src/main/java/jodd/db/pool/CoreConnectionPool.java b/jodd-db/src/main/java/jodd/db/pool/CoreConnectionPool.java
index <HASH>..<HASH> 100644
--- a/jodd-db/src/main/java/jodd/db/pool/CoreConnectionPool.java
+++ b/jodd-db/src/main/java/jodd/db/pool/CoreConnectionPool.java
@@ -381,6 +381,9 @@ public class CoreConnectionPool implements Runnable, ConnectionProvider {
}
private void closeConnections(final ArrayList<ConnectionData> connections) {
+ if (connections == null) {
+ return;
+ }
try {
for (ConnectionData connectionData : connections) {
Connection connection = connectionData.connection;
@@ -388,7 +391,7 @@ public class CoreConnectionPool implements Runnable, ConnectionProvider {
connection.close();
}
}
- } catch (SQLException sex) {
+ } catch (SQLException ignore) {
// Ignore errors; garbage collect anyhow
}
} | Fixing minor issue with core connection pool | oblac_jodd | train | java |
6c726a215b37de987683c1c918cda9feb1e4ece9 | diff --git a/rest-api/src/test/java/org/jboss/pnc/client/ClientTest.java b/rest-api/src/test/java/org/jboss/pnc/client/ClientTest.java
index <HASH>..<HASH> 100644
--- a/rest-api/src/test/java/org/jboss/pnc/client/ClientTest.java
+++ b/rest-api/src/test/java/org/jboss/pnc/client/ClientTest.java
@@ -30,6 +30,7 @@ import org.junit.Test;
import org.slf4j.MDC;
import javax.ws.rs.NotAuthorizedException;
+import javax.ws.rs.core.HttpHeaders;
import javax.ws.rs.core.MediaType;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicReference;
@@ -116,6 +117,7 @@ public class ClientTest {
wireMockServer.stubFor(get(urlMatching(".*")).willReturn(aResponse()
.withStatus(401)
+ .withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
));
BuildClient buildClient = new BuildClient(configuration); | Fix client test by adding a content-type | project-ncl_pnc | train | java |
d2949c9c1ffb0afba424b1871bcc44933c681315 | diff --git a/djangocms_text_ckeditor/fields.py b/djangocms_text_ckeditor/fields.py
index <HASH>..<HASH> 100644
--- a/djangocms_text_ckeditor/fields.py
+++ b/djangocms_text_ckeditor/fields.py
@@ -2,6 +2,11 @@ from django.db import models
from django.contrib.admin import widgets as admin_widgets
from djangocms_text_ckeditor.html import clean_html
from djangocms_text_ckeditor.widgets import TextEditorWidget
+try:
+ from south.modelsinspector import add_introspection_rules
+ add_introspection_rules([], ['^djangocms_text_ckeditor\.fields\.HTMLField'])
+except ImportError:
+ pass
class HTMLField(models.TextField): | added south introspection rules to the field | divio_djangocms-text-ckeditor | train | py |
126ee3583ab6c7888e0628a55838778db2cf8820 | diff --git a/bika/lims/browser/dashboard/dashboard.py b/bika/lims/browser/dashboard/dashboard.py
index <HASH>..<HASH> 100644
--- a/bika/lims/browser/dashboard/dashboard.py
+++ b/bika/lims/browser/dashboard/dashboard.py
@@ -150,7 +150,7 @@ class DashboardView(BrowserView):
if filtering_allowed:
query_dic['getDepartmentUIDs'] = { "query":cookie_dep_uid,"operator":"or" }
numars += len(bc(query_dic))
-
+
if (sampenabled):
# Analysis Requests awaiting to be sampled or scheduled
review_state = ['to_be_sampled',]
@@ -495,8 +495,7 @@ class DashboardView(BrowserView):
# Analyses pending
review_state = ['sample_received',
'assigned',
- 'attachment_due',
- 'to_be_verified']
+ 'attachment_due']
query_dic = {'portal_type':"Analysis",
'review_state':review_state}
if filtering_allowed: | Remove to_be_verified state from pending analyses query... | senaite_senaite.core | train | py |
Subsets and Splits