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
|
---|---|---|---|---|---|
8c3a723191a9dbaecd31f8973510326b8c9918c4 | diff --git a/meshio/msh_io/msh4_1.py b/meshio/msh_io/msh4_1.py
index <HASH>..<HASH> 100644
--- a/meshio/msh_io/msh4_1.py
+++ b/meshio/msh_io/msh4_1.py
@@ -353,7 +353,7 @@ def _write_nodes(fh, points, write_binary):
fh.write("{} {} {} {}\n".format(dim_entity, 1, 0, len(points)).encode("utf-8"))
numpy.arange(1, 1 + len(points), dtype=c_size_t).tofile(fh, "\n", "%d")
fh.write("\n".encode("utf-8"))
- numpy.savetxt(fh, points, "%e", " ", encoding="utf-8")
+ numpy.savetxt(fh, points, "%g", " ", encoding="utf-8")
fh.write("$EndNodes\n".encode("utf-8"))
return | %e -> %g is better for $Nodes x y z #<I> | nschloe_meshio | train | py |
5a6fb1b8f1c56816ec79cc470a99ca887928934c | diff --git a/nupic/frameworks/opf/clamodel.py b/nupic/frameworks/opf/clamodel.py
index <HASH>..<HASH> 100644
--- a/nupic/frameworks/opf/clamodel.py
+++ b/nupic/frameworks/opf/clamodel.py
@@ -610,6 +610,11 @@ class CLAModel(Model):
sensor = self._getSensorRegion()
activeColumns = sensor.getOutputData('dataOut').nonzero()[0]
+ if not self._predictedFieldName in self._input:
+ raise ValueError(
+ "Expected predicted field '%s' in input row, but was not found!"
+ % self._predictedFieldName
+ )
# Calculate the anomaly score using the active columns
# and previous predicted columns.
score = self._anomalyInst.compute(
@@ -659,6 +664,10 @@ class CLAModel(Model):
"""
inferenceArgs = self.getInferenceArgs()
predictedFieldName = inferenceArgs.get('predictedField', None)
+ if predictedFieldName is None:
+ raise ValueError(
+ "No predicted field was enabled! Did you call enableInference()?"
+ )
self._predictedFieldName = predictedFieldName
classifier = self._getClassifierRegion() | Raises exception when enableInference was not called, or when predicted field missing from input row. | numenta_nupic | train | py |
93a5939662295be16a72a65d118419029b21ba6f | diff --git a/union-type.js b/union-type.js
index <HASH>..<HASH> 100644
--- a/union-type.js
+++ b/union-type.js
@@ -26,7 +26,7 @@ var numToStr = ['first', 'second', 'third', 'fourth', 'fifth', 'sixth', 'seventh
var validate = function(group, validators, name, args) {
var validator, v, i;
if (args.length > validators.length) {
- throw new TypeError('too many arguments to constructor ' + name
+ throw new TypeError('too many arguments supplied to constructor ' + name
+ ' (expected ' + validators.length + ' but got ' + args.length + ')');
}
for (i = 0; i < args.length; ++i) { | Change wording according to suggestion on PR | paldepind_union-type | train | js |
71a9b436affcd7223c36c4cfc250ed22d5a5d103 | diff --git a/tests/teststreams.py b/tests/teststreams.py
index <HASH>..<HASH> 100644
--- a/tests/teststreams.py
+++ b/tests/teststreams.py
@@ -3,8 +3,16 @@ Unit test of the streams system
"""
import param
from holoviews.element.comparison import ComparisonTestCase
-from holoviews.streams import Stream, PositionX, PositionY, PositionXY, ParamValues
-
+from holoviews.streams import * # noqa (Test all available streams)
+
+def test_all_stream_parameters_constant():
+ all_stream_cls = [v for v in globals().values() if
+ isinstance(v, type) and issubclass(v, Stream)]
+ for stream_cls in all_stream_cls:
+ for name, param in stream_cls.params().items():
+ if param.constant != True:
+ raise TypeError('Parameter %s of stream %s not declared constant'
+ % (name, stream_cls.__name__))
class TestSubscriber(object): | Added test to ensure all stream parameters are declared constant | pyviz_holoviews | train | py |
f3825d2b2a469cb0b42c580068f6dbec9f5c3e40 | diff --git a/astrocats/catalog/catalog.py b/astrocats/catalog/catalog.py
index <HASH>..<HASH> 100644
--- a/astrocats/catalog/catalog.py
+++ b/astrocats/catalog/catalog.py
@@ -462,14 +462,6 @@ class Catalog:
name of matching entry (str) or 'None' if no matches
"""
- if alias in self.entries:
- return alias
-
- if alias in self.aliases:
- name = self.aliases[alias]
- if name in self.entries:
- return name
-
for name, entry in self.entries.items():
aliases = entry.get_aliases(includename=False)
if alias in aliases: | MAINT: removed unneeded check for name as already checked | astrocatalogs_astrocats | train | py |
50636d7d14e2c08796323d776b712e514305f1df | diff --git a/SimplerDiscord/Handlers/MessageHandler.js b/SimplerDiscord/Handlers/MessageHandler.js
index <HASH>..<HASH> 100644
--- a/SimplerDiscord/Handlers/MessageHandler.js
+++ b/SimplerDiscord/Handlers/MessageHandler.js
@@ -54,7 +54,7 @@ class MessageHandler {
}
function RateLimited(ratelimit, msg) {
- if (ratelimit === undefined) return;
+ if (ratelimit.limited === undefined) return;
if (ratelimit.limited(msg.author.username)) {
console.log(`[SimpleDiscord] ${msg.author.username} is being rate limited`);
msg.channel.send(`Slow Down!!`) | AAAAAAAAAAAAAAAAA | TheDustyard_SimplerDiscord | train | js |
aea85aaef62c144d19947f7d4c86e425074a0f26 | diff --git a/src/http/api/routes/webui.js b/src/http/api/routes/webui.js
index <HASH>..<HASH> 100644
--- a/src/http/api/routes/webui.js
+++ b/src/http/api/routes/webui.js
@@ -20,7 +20,7 @@ module.exports = (server) => {
method: '*',
path: '/webui',
handler: (request, reply) => {
- return reply().redirect().location('/ipfs/QmQLXHs7K98JNQdWrBB2cQLJahPhmupbDjRuH1b9ibmwVa')
+ return reply().redirect().location('/ipfs/QmcXvo6op67G5uC9p1wWoeRY92cPxb5bDxWF8DzYhoYhHY')
}
}
]) | feat: update to Web UI <I> (#<I>)
License: MIT | ipfs_js-ipfs | train | js |
160f77b64618f7f9f24529e2a3d09625957d1590 | diff --git a/pkg/metrics/metrics.go b/pkg/metrics/metrics.go
index <HASH>..<HASH> 100644
--- a/pkg/metrics/metrics.go
+++ b/pkg/metrics/metrics.go
@@ -551,8 +551,9 @@ var (
// FQDNGarbageCollectorCleanedTotal is the number of domains cleaned by the
// GC job.
FQDNGarbageCollectorCleanedTotal = prometheus.NewCounter(prometheus.CounterOpts{
- Name: "fqdn_gc_deletions_total",
- Help: "Number of FQDNs that have been cleaned on FQDN Garbage collector job",
+ Namespace: Namespace,
+ Name: "fqdn_gc_deletions_total",
+ Help: "Number of FQDNs that have been cleaned on FQDN Garbage collector job",
})
) | pkg/metrics: add namespace to fqdn_gc_deletions_total
The fqdn_gc_deletions_total misses the Cilium namespace and it's
currently exporter without it. This commit fixes that omission.
Fixes: 5a<I>e1f<I>dc3 ("FQDN: Add metrics for Garbage collector cleanup.") | cilium_cilium | train | go |
003a590a220a9f8c4871e0d690079ff3be729614 | diff --git a/plugins/range-selector.js b/plugins/range-selector.js
index <HASH>..<HASH> 100644
--- a/plugins/range-selector.js
+++ b/plugins/range-selector.js
@@ -176,7 +176,11 @@ rangeSelector.prototype.resize_ = function() {
}
var plotArea = this.dygraph_.layout_.getPlotArea();
- var xAxisLabelHeight = this.getOption_('xAxisHeight') || (this.getOption_('axisLabelFontSize') + 2 * this.getOption_('axisTickSize'));
+
+ var xAxisLabelHeight = 0;
+ if(this.getOption_('drawXAxis')){
+ xAxisLabelHeight = this.getOption_('xAxisHeight') || (this.getOption_('axisLabelFontSize') + 2 * this.getOption_('axisTickSize'));
+ }
this.canvasRect_ = {
x: plotArea.x,
y: plotArea.y + plotArea.h + xAxisLabelHeight + 4, | BUGFIX: xAxisLabelHeight is set to 0 in case the option 'drawXAxis' is
set to false. | danvk_dygraphs | train | js |
08ed23fed7310cca7fc1510b32e83fb3cd96fcec | diff --git a/src/hamster/db.py b/src/hamster/db.py
index <HASH>..<HASH> 100644
--- a/src/hamster/db.py
+++ b/src/hamster/db.py
@@ -185,7 +185,7 @@ class Storage(storage.Storage):
activity = self.fetchone("select name from activities where id = ?", (id, ))
existing_activity = self.__get_activity_by_name(activity['name'], category_id)
- if id == existing_activity['id']: # we are already there, go home
+ if existing_activity and id == existing_activity['id']: # we are already there, go home
return False
if existing_activity: #ooh, we have something here!
@@ -778,7 +778,7 @@ class Storage(storage.Storage):
else:
query = """
- SELECT a.*, b.name as category
+ SELECT a.id, a.name, a.activity_order, a.category_id, b.name as category
FROM activities a
LEFT JOIN categories b on coalesce(b.id, -1) = a.category_id
WHERE deleted IS NULL | don't assume that there is somebody when changing category | projecthamster_hamster | train | py |
d623f7c3ff7aea4eaf65b53a4bacfbaaf018d729 | diff --git a/charmhub/client.go b/charmhub/client.go
index <HASH>..<HASH> 100644
--- a/charmhub/client.go
+++ b/charmhub/client.go
@@ -243,8 +243,8 @@ func (c *Client) Info(ctx context.Context, name string, options ...InfoOption) (
}
// Find searches for a given charm for a given name from CharmHub API.
-func (c *Client) Find(ctx context.Context, name string) ([]transport.FindResponse, error) {
- return c.findClient.Find(ctx, name)
+func (c *Client) Find(ctx context.Context, name string, options ...FindOption) ([]transport.FindResponse, error) {
+ return c.findClient.Find(ctx, name, options...)
}
// Refresh defines a client for making refresh API calls, that allow for | Allow passing options to the find command
We can then use the find options to filter the results from the API
server. | juju_juju | train | go |
c209ae47195be95b9ce6167a83279416148312fb | diff --git a/src/streamcorpus_pipeline/stages.py b/src/streamcorpus_pipeline/stages.py
index <HASH>..<HASH> 100644
--- a/src/streamcorpus_pipeline/stages.py
+++ b/src/streamcorpus_pipeline/stages.py
@@ -184,18 +184,6 @@ def _init_stage(name, config, external_stages=None):
stage_constructor = Stages.get(name, None)
if stage_constructor is None:
- #stage_constructor = pkg_resources.load_entry_point('streamcorpus.pipeline.stages', name)
- entries = pkg_resources.iter_entry_points('streamcorpus.pipeline.stages', name)
- entries = list(entries)
- if not entries:
- pass
- elif len(entries) > 1:
- logger.error('multiple entry_points for pipeline stage %r: %r', name, entries)
- else:
- stage_constructor = entries[0].load()
- if stage_constructor is not None:
- Stages[name] = stage_constructor
- if stage_constructor is None:
raise Exception('unknown stage %r' % (name,))
stage = stage_constructor(config) | removing block that does not happen any more, now that streamcorpus.*
is not a namespace package | trec-kba_streamcorpus-pipeline | train | py |
494405a94410220b8a468b070410256cf2dacc13 | diff --git a/axiom/test/test_xatop.py b/axiom/test/test_xatop.py
index <HASH>..<HASH> 100644
--- a/axiom/test/test_xatop.py
+++ b/axiom/test/test_xatop.py
@@ -912,6 +912,11 @@ class MassInsertDeleteTests(unittest.TestCase):
C{deleteFromStore} on a query with an order and limit specified does
not disregard the order.
"""
+ options = self.store.querySQL('PRAGMA compile_options;')
+ if (u'ENABLE_UPDATE_DELETE_LIMIT',) not in options:
+ raise unittest.SkipTest(
+ 'SQLite compiled without SQLITE_ENABLE_UPDATE_DELETE_LIMIT')
+
for i in xrange(10):
AttributefulItem(store=self.store, withoutDefault=i)
self.store.query( | Skip this if the functionality isn't available. | twisted_axiom | train | py |
c63b48ed9052e0144e429a80f33526d3ad4db0d5 | diff --git a/modin/experimental/cloud/connection.py b/modin/experimental/cloud/connection.py
index <HASH>..<HASH> 100644
--- a/modin/experimental/cloud/connection.py
+++ b/modin/experimental/cloud/connection.py
@@ -46,7 +46,12 @@ class Connection:
"import os; from distutils.dist import Distribution; from distutils.command.install import install; cmd = install(Distribution()); cmd.finalize_options(); print(os.path.join(cmd.install_scripts, 'rpyc_classic.py'))",
],
)
- out, err = locator.communicate(timeout=5)
+ try:
+ out, err = locator.communicate(timeout=self.connect_timeout)
+ except subprocess.TimeoutExpired as ex:
+ raise ClusterError(
+ "Cannot get path to rpyc_classic: cannot connect to host", cause=ex
+ )
if locator.returncode != 0:
raise ClusterError(
f"Cannot get path to rpyc_classic, return code: {locator.returncode}" | Catch connection timeout when getting path to rpyc_connect | modin-project_modin | train | py |
9ec44c3753e36373efc7572237664ee74b20e60b | diff --git a/koala/ast/graph.py b/koala/ast/graph.py
index <HASH>..<HASH> 100644
--- a/koala/ast/graph.py
+++ b/koala/ast/graph.py
@@ -459,6 +459,17 @@ def shunting_yard(expression, named_ranges, ref = ''):
Core algorithm taken from wikipedia with varargs extensions from
http://www.kallisti.net.nz/blog/2008/02/extension-to-the-shunting-yard-algorithm-to-allow-variable-numbers-of-arguments-to-functions/
+
+
+ The ref is the cell address which is passed down to the actual compiled python code.
+ Range basic operations signature require this reference, so it has to be written during OperatorNode.emit()
+ https://github.com/iOiurson/koala/blob/master/koala/ast/graph.py#L292.
+
+ This is needed because Excel range basic operations (+, -, * ...) are applied on matching cells.
+
+ Example:
+ Cell C2 has the following formula 'A1:A3 + B1:B3'.
+ The output will actually be A2 + B2, because the formula is relative to cell C2.
"""
#remove leading = | added comment about cell ref passed as argument in graph.py shunting_yard() | anthill_koala | train | py |
035b4a5446e13a0f33963a580a86586dd02d46aa | diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -69,7 +69,7 @@ class RpmCommand(SrpmCommand):
setup(name=PACKAGE,
version=VERSION,
description="Generic access to configuration files in some formats",
- long_description=open("README.md").read(),
+ long_description=open("README.rst").read(),
author="Satoru SATOH",
author_email="[email protected]",
license="MIT", | fixed the filename of README.* | ssato_python-anyconfig | train | py |
fd2528072e2b097ea1e7ca5df177d8d7b65b241f | diff --git a/growler/http/responder.py b/growler/http/responder.py
index <HASH>..<HASH> 100644
--- a/growler/http/responder.py
+++ b/growler/http/responder.py
@@ -42,7 +42,6 @@ class GrowlerHTTPResponder(GrowlerResponder):
body_buffer = None
content_length = None
- headers = None
def __init__(self,
handler, | GrowlerHTTPResponder: Remove extraneous class-member "headers" | pyGrowler_Growler | train | py |
8772de960482e9e4d9043fe04b5fcbc05c385083 | diff --git a/src/frontend/org/voltdb/planner/ParsedSelectStmt.java b/src/frontend/org/voltdb/planner/ParsedSelectStmt.java
index <HASH>..<HASH> 100644
--- a/src/frontend/org/voltdb/planner/ParsedSelectStmt.java
+++ b/src/frontend/org/voltdb/planner/ParsedSelectStmt.java
@@ -224,8 +224,13 @@ public class ParsedSelectStmt extends AbstractParsedStmt {
processAvgPushdownOptimization(displayElement, orderbyElement, groupbyElement);
}
// Prepare for the mv based distributed query fix only if it might be required.
- mvFixInfo.mvTable = tableList.get(0);
- processMVBasedQueryFix(mvFixInfo, m_db, scanColumns);
+ if (tableList.size() == 1) {
+ if (getSingleTableFilterExpression() == null) {
+ // Do not handle joined query case and where clause case.
+ mvFixInfo.mvTable = tableList.get(0);
+ processMVBasedQueryFix(mvFixInfo, m_db, scanColumns);
+ }
+ }
}
private static void processMVBasedQueryFix(MVFixInfo mvFixInfo, Database db, | Instead of throwing exceptions for join and where for mv partition query, just do not handle them. Return wrong answer as they are used to be | VoltDB_voltdb | train | java |
246f5b8ff7e604e72a5c4e6a121c00eba03556ef | diff --git a/logger.js b/logger.js
index <HASH>..<HASH> 100644
--- a/logger.js
+++ b/logger.js
@@ -6,22 +6,25 @@ process.stdout.setMaxListeners(100)
module.exports = function(config) {
if (!config) config = {}
- var prettyStdOut = new PrettyStream()
- prettyStdOut.pipe(process.stdout)
-
- var logger = bunyan.createLogger({
+ var loggerConfig = {
name: 'ssdp',
- streams: [{
+ streams: []
+ }
+
+ if (config.log !== false) {
+ var prettyStdOut = new PrettyStream()
+ prettyStdOut.pipe(process.stdout)
+
+ loggerConfig.streams.push({
level: 'error',
type: 'raw',
stream: prettyStdOut
- }]
- })
+ })
+ }
+
+ var logger = bunyan.createLogger(loggerConfig)
config.logLevel && logger.level(config.logLevel)
- // don't log when running tests
- if (process.env.NODE_ENV == 'test') logger.level('FATAL')
-
return logger
} | Pass "log: false" to constructor to disable logs. | diversario_node-ssdp | train | js |
8146e494d9cd1532f039edb480ce526c26841f42 | diff --git a/spec/support/config/capybara.rb b/spec/support/config/capybara.rb
index <HASH>..<HASH> 100644
--- a/spec/support/config/capybara.rb
+++ b/spec/support/config/capybara.rb
@@ -16,8 +16,16 @@ Capybara.javascript_driver = :selenium_chrome_headless_no_sandbox
Capybara::Chromedriver::Logger.raise_js_errors = true
Capybara::Chromedriver::Logger.filters = [
+ # Bandwidth probe files are not available in tests
/bandwidth_probe.*Failed to load resource/i,
- /Target node has markup rendered by React/i
+
+ # React does not like the server rendered "back to top" link inside
+ # page sections.
+ /Target node has markup rendered by React/i,
+
+ # Ignore failure of debounced request to refresh partials while db
+ # has already been cleaned
+ /partials - Failed to load resource: the server responded with a status of 401/
]
RSpec.configure do |config| | Do not fail capybara spec on failing widget refresh
Whenever changes a made inside the editor, a debounced request is made
to update the server rendered widgets.
Some of the js based editor specs trigger this request even after the
test itself has finished. The request fails since the database has
already been cleaned.
Do not make the spec fail if this happens. | codevise_pageflow | train | rb |
a3b12e707759720394a8c9301640163c1a563a47 | diff --git a/qtm/receiver.py b/qtm/receiver.py
index <HASH>..<HASH> 100644
--- a/qtm/receiver.py
+++ b/qtm/receiver.py
@@ -16,18 +16,17 @@ class Receiver(object):
""" Received from QTM and route accordingly """
self._received_data += data
h_size = RTheader.size
-
data = self._received_data
- size, type_ = RTheader.unpack_from(data, 0)
-
- while len(data) >= size:
- self._parse_received(data[h_size:size], type_)
- data = data[size:]
-
- if len(data) < h_size:
- break
+ data_len = len(data);
+ while data_len >= h_size:
size, type_ = RTheader.unpack_from(data, 0)
+ if data_len >= size:
+ self._parse_received(data[h_size:size], type_)
+ data = data[size:]
+ data_len = len(data);
+ else:
+ break;
self._received_data = data | Added size check before unpacking RTheader | qualisys_qualisys_python_sdk | train | py |
477c9c88d4f3e46684364fb9f8dd228d069f0570 | diff --git a/test/scaffolding/org/codehaus/groovy/grails/scaffolding/GrailsTemplateGeneratorsTests.java b/test/scaffolding/org/codehaus/groovy/grails/scaffolding/GrailsTemplateGeneratorsTests.java
index <HASH>..<HASH> 100644
--- a/test/scaffolding/org/codehaus/groovy/grails/scaffolding/GrailsTemplateGeneratorsTests.java
+++ b/test/scaffolding/org/codehaus/groovy/grails/scaffolding/GrailsTemplateGeneratorsTests.java
@@ -42,10 +42,10 @@ public class GrailsTemplateGeneratorsTests extends TestCase {
generator.generateController(domainClass,"test");
- File generatedFile = new File("test/TestController.groovy");
+ File generatedFile = new File("test/grails-app/controllers/TestController.groovy");
assertTrue(generatedFile.exists());
- String text = (String)new GroovyShell().evaluate("new File('test/TestController.groovy').text");
+ String text = (String)new GroovyShell().evaluate("new File('test/grails-app/controllers/TestController.groovy').text");
assertTrue(text.indexOf("class TestController") > -1);
assertTrue(text.indexOf("@Property list") > -1); | fixed template generator failing on generate controller test case (it was checking the wrong path to the controller file)
git-svn-id: <URL> | grails_grails-core | train | java |
b6a81963c0ff2626d2231433ab637bdd251cf0cc | diff --git a/resources/lang/ja-JP/cachet.php b/resources/lang/ja-JP/cachet.php
index <HASH>..<HASH> 100644
--- a/resources/lang/ja-JP/cachet.php
+++ b/resources/lang/ja-JP/cachet.php
@@ -33,7 +33,7 @@ return [
'scheduled' => '計画メンテナンス',
'scheduled_at' => ', 予定日時 :timestamp',
'posted' => '投稿日時 :timestamp',
- 'posted_at' => 'Posted at :timestamp',
+ 'posted_at' => '掲載日時 :timestamp',
'status' => [
1 => '調査中',
2 => '特定済み',
@@ -53,9 +53,9 @@ return [
// Service Status
'service' => [
- 'good' => '[0,1] System operational|[2,Inf] All systems are operational',
- 'bad' => '[0,1] The system is experiencing issues|[2,Inf] Some systems are experiencing issues',
- 'major' => '[0,1] The system is experiencing major issues|[2,Inf] Some systems are experiencing major issues',
+ 'good' => '[0,1]正常に稼動しています|[2,Inf]全システムが正常に稼動しています',
+ 'bad' => '[0,1]問題が発生しています|[2,Inf]一部システムにて問題が発生しています',
+ 'major' => '[0, 1]システムで大きな問題が発生 |[2、*]いくつかのシステムの主要な問題が発生しています。',
],
'api' => [ | New translations cachet.php (Japanese) | CachetHQ_Cachet | train | php |
bcc6d53de0be74629b02bebdaada72f577cad972 | diff --git a/Configuration/Configurator.php b/Configuration/Configurator.php
index <HASH>..<HASH> 100644
--- a/Configuration/Configurator.php
+++ b/Configuration/Configurator.php
@@ -117,8 +117,13 @@ class Configurator
*/
public function isActionEnabled($entityName, $view, $action)
{
+ if ($view === $action) {
+ return true;
+ }
+
$entityConfig = $this->getEntityConfig($entityName);
- return !in_array($action, $entityConfig['disabled_actions']);
+ return !in_array($action, $entityConfig['disabled_actions'])
+ && array_key_exists($action, $entityConfig[$view]['actions']);
}
} | Improved isActionAllowd() method | EasyCorp_EasyAdminBundle | train | php |
70dfb27ffc7974287274ff3d8b9bd64972e9ea17 | diff --git a/django_prices_openexchangerates/tasks.py b/django_prices_openexchangerates/tasks.py
index <HASH>..<HASH> 100644
--- a/django_prices_openexchangerates/tasks.py
+++ b/django_prices_openexchangerates/tasks.py
@@ -25,7 +25,7 @@ def extract_rate(rates, currency):
def get_latest_exchange_rates():
response = requests.get(ENDPOINT_LATEST, params={'app_id': API_KEY})
response.raise_for_status()
- return response.json(parse_int=Decimal, parse_float=Decimal)
+ return response.json(parse_int=Decimal, parse_float=Decimal)['rates']
def update_conversion_rates(): | Fix openExchange json parsing | mirumee_django-prices-openexchangerates | train | py |
04e648cbdbad21ae308e8edb12ddab1377727901 | diff --git a/printer/printer.go b/printer/printer.go
index <HASH>..<HASH> 100644
--- a/printer/printer.go
+++ b/printer/printer.go
@@ -960,13 +960,24 @@ func (p *printer) hasInline(pos, nline token.Pos) bool {
}
func (p *printer) stmts(stmts []*ast.Stmt) {
- if len(stmts) == 0 {
+ switch len(stmts) {
+ case 0:
return
- }
- pos := stmts[0].Pos()
- if len(stmts) == 1 && pos <= p.nline {
- p.commentsAndSeparate(pos)
- p.stmt(stmts[0])
+ case 1:
+ s := stmts[0]
+ pos := s.Pos()
+ p.commentsUpTo(pos)
+ if pos <= p.nline {
+ p.stmt(s)
+ } else {
+ if p.nlineIndex > 0 {
+ p.newlines(pos)
+ } else {
+ p.incLines(pos)
+ }
+ p.stmt(s)
+ p.wantNewline = true
+ }
return
}
inlineIndent := 0 | printer: make a single-stmt quick path
We were recalculating the statement's position and preparing for a
possible comment alignment, when neither matter if the statement is
alone.
Makes the code conceptually simpler, and there's also a small
performance win.
name old time/op new time/op delta
Fprint-4 <I>µs ± 0% <I>µs ± 1% -<I>% (p=<I> n=<I>) | mvdan_sh | train | go |
98096a8814f573f6c0a51e18bf6e80145abd0b04 | diff --git a/docs/conf.py b/docs/conf.py
index <HASH>..<HASH> 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -42,16 +42,16 @@ master_doc = 'index'
# General information about the project.
project = 'pyqrcode'
-copyright = '2013, Michael Nooner'
+copyright = '2013-2014, Michael Nooner'
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
-version = '0.10'
+version = '0.11'
# The full version, including alpha/beta/rc tags.
-release = '0.10'
+release = '0.11'
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages. | Forgot to update the docs version number | mnooner256_pyqrcode | train | py |
7a47884945d4da61ae878d5933a649ddc0d26e7c | diff --git a/lib/devicedb_comms/hive.rb b/lib/devicedb_comms/hive.rb
index <HASH>..<HASH> 100644
--- a/lib/devicedb_comms/hive.rb
+++ b/lib/devicedb_comms/hive.rb
@@ -3,7 +3,7 @@ require 'devicedb_comms/shared'
module DeviceDBComms
class Hive < DeviceDBComms::Shared
- def register(hive_name, hive_description, mac_address, ip_address)
+ def register(hive_name, mac_address, ip_address)
post("/hives/register", { hive: { hostname: hive_name, mac: mac_address, ip_address: ip_address }})
end
diff --git a/lib/devicedb_comms/version.rb b/lib/devicedb_comms/version.rb
index <HASH>..<HASH> 100644
--- a/lib/devicedb_comms/version.rb
+++ b/lib/devicedb_comms/version.rb
@@ -1,3 +1,3 @@
module DeviceDBComms
- VERSION = "0.0.12"
+ VERSION = "0.0.14"
end | Completed removal of description field and renaming of name to hostname | bbc_devicedb_comms | train | rb,rb |
40ef3a83f957292e1f37fda92164ea89c866ee66 | diff --git a/src/Bee4/Http/Client.php b/src/Bee4/Http/Client.php
index <HASH>..<HASH> 100644
--- a/src/Bee4/Http/Client.php
+++ b/src/Bee4/Http/Client.php
@@ -96,8 +96,8 @@ class Client {
$result = self::$handles[get_class($request)]->execute();
- if( self::$handles[get_class($request)]->hasInfo('request_header') ) {
- $request->setSentHeaders(self::$handles[get_class($request)]->getInfo('request_header'));
+ if( self::$handles[get_class($request)]->hasInfo(CURLINFO_HEADER_OUT) ) {
+ $request->setSentHeaders(self::$handles[get_class($request)]->getInfo(CURLINFO_HEADER_OUT));
}
$response = ResponseFactory::build($result, self::$handles[get_class($request)]->getInfos()); | Use curl constant instead of string names to retrieve execution result | bee4_transport | train | php |
e78c989a0ad21c9b7beac08a9685b2b1210dda54 | diff --git a/openquake/engine/calculators/risk/base.py b/openquake/engine/calculators/risk/base.py
index <HASH>..<HASH> 100644
--- a/openquake/engine/calculators/risk/base.py
+++ b/openquake/engine/calculators/risk/base.py
@@ -114,12 +114,13 @@ def run_risk(job_id, sorted_assocs, calc):
with monitor.copy("getting assets"):
assets = models.ExposureData.objects.get_asset_chunk(
calc.rc, assocs_by_taxonomy)
+ sorted_assets = sorted(assets, key=lambda a: a.site_id)
for it in models.ImtTaxonomy.objects.filter(
job=calc.job, taxonomy=taxonomy):
imt = it.imt.imt_str
workflow = calc.risk_model[imt, taxonomy]
for site_id, asset_group in itertools.groupby(
- assets, key=lambda a: a.site_id):
+ sorted_assets, key=lambda a: a.site_id):
with monitor.copy("getting hazard"):
risk_input = calc.risk_input_class(
imt, taxonomy, site_id, hazard_data, list(asset_group)) | Ordered the assets by site_id
Former-commit-id: dc<I>ced<I>e<I>bd<I>a<I>b<I>c2a<I> | gem_oq-engine | train | py |
6c74582ea9dab88dabeccd80e2f54c5f39f4e621 | diff --git a/syncthing_test.go b/syncthing_test.go
index <HASH>..<HASH> 100644
--- a/syncthing_test.go
+++ b/syncthing_test.go
@@ -99,7 +99,7 @@ func benchConnPair(b *testing.B, c0, c1 net.Conn) {
}
}
-func BenchmarkTCP(b *testing.B) {
+func BenchmarkSyncthingTCP(b *testing.B) {
conn0, conn1, err := getTCPConnectionPair()
if err != nil {
b.Fatal(err)
@@ -111,7 +111,7 @@ func BenchmarkTCP(b *testing.B) {
benchConnPair(b, conn0, conn1)
}
-func BenchmarkUTP(b *testing.B) {
+func BenchmarkSyncthingUDPUTP(b *testing.B) {
conn0, conn1, err := getUTPConnectionPair()
if err != nil {
b.Fatal(err) | Add Syncthing to benchmark test names | anacrolix_utp | train | go |
3509c1858085dd163d6b82057dd39354457f4af2 | diff --git a/core/container/vm.go b/core/container/vm.go
index <HASH>..<HASH> 100644
--- a/core/container/vm.go
+++ b/core/container/vm.go
@@ -123,7 +123,7 @@ func (vm *VM) buildChaincodeContainerUsingDockerfilePackageBytes(spec *pb.Chainc
}
if err := vm.Client.BuildImage(opts); err != nil {
vmLogger.Errorf("Failed Chaincode docker build:\n%s\n", outputbuf.String())
- return fmt.Errorf("Error building Chaincode container: %s", err)
+ return err
}
return nil
}
diff --git a/core/devops.go b/core/devops.go
index <HASH>..<HASH> 100644
--- a/core/devops.go
+++ b/core/devops.go
@@ -113,7 +113,6 @@ func (*Devops) Build(context context.Context, spec *pb.ChaincodeSpec) (*pb.Chain
codePackageBytes, err = vm.BuildChaincodeContainer(spec)
if err != nil {
- err = fmt.Errorf("Error getting chaincode package bytes: %s", err)
devopsLogger.Error(fmt.Sprintf("%s", err))
return nil, err
} | Fix error report
There are two kinds of error for func "BuildChaincodeContainer",
Should distinguish them. Eliminated duplcaited content in error
message.
Change-Id: I8ceb<I>acf<I>cf8a<I>ca6d<I>f6b4d<I> | hyperledger_fabric | train | go,go |
dde52698c7f7f4a3029b1bcd21ce99419a8800b7 | diff --git a/XTree/FileSystem.py b/XTree/FileSystem.py
index <HASH>..<HASH> 100644
--- a/XTree/FileSystem.py
+++ b/XTree/FileSystem.py
@@ -46,7 +46,10 @@ class FileSystem():
def create_links(self):
for src in self.files:
if self.separator:
- dst = self.separator.join(src.split('/')[1:])
+ if self.nopath:
+ dst = self.separator.join(src.split('/')[1:])
+ else:
+ dst = self.separator.join(src.split('/'))
else:
dst = os.path.basename(src)
if not self.nopath: | Fix behaviour when multiple directories are present in archive root | dktrkranz_xtree | train | py |
c465956e5c038cbbb0d3607ebd7a934bb940e377 | diff --git a/tests/utils/test_visualizer.py b/tests/utils/test_visualizer.py
index <HASH>..<HASH> 100644
--- a/tests/utils/test_visualizer.py
+++ b/tests/utils/test_visualizer.py
@@ -9,7 +9,7 @@ from tests.candidates.test_candidates import parse_doc
def test_visualizer():
"""Unit test of visualizer using the md document."""
- from fonduer.utils.visualizer import Visualizer # noqa
+ from fonduer.utils.visualizer import Visualizer, get_box # noqa
docs_path = "tests/data/html_simple/md.html"
pdf_path = "tests/data/pdf_simple/md.pdf"
@@ -38,12 +38,21 @@ def test_visualizer():
doc = candidate_extractor_udf.apply(doc, split=0)
- cands = doc.organizations
+ # Take one candidate
+ cand = doc.organizations[0]
- # Test visualizer
pdf_path = "tests/data/pdf_simple"
vis = Visualizer(pdf_path)
- vis.display_candidates([cands[0]])
+
+ # Test bounding boxes
+ boxes = [get_box(mention.context) for mention in cand.get_mentions()]
+ for box in boxes:
+ assert box.top <= box.bottom
+ assert box.left <= box.right
+ assert boxes == [mention.context.get_bbox() for mention in cand.get_mentions()]
+
+ # Test visualizer
+ vis.display_candidates([cand])
def test_get_pdf_dim(): | Check bbox to demonstrate #<I> | HazyResearch_fonduer | train | py |
3be7fb690a9b64752f1fb8ac15d1e40202a7688b | diff --git a/test/steps/client.py b/test/steps/client.py
index <HASH>..<HASH> 100644
--- a/test/steps/client.py
+++ b/test/steps/client.py
@@ -12,13 +12,13 @@ use_step_matcher("re")
@given("I start with a clean broker")
def create_the_queues(context):
- context.request_queue = context.broker.add_queue('test.req')
+ username = 'test'
+ context.request_queue = context.broker.add_queue('{}.req'.format(username))
context.request_queue.purge()
- context.response_queue = context.broker.add_queue('test.resp')
+ context.response_queue = context.broker.add_queue('{}.resp'.format(username))
context.response_queue.purge()
hostname = 'localhost'
stomp_port = 21613
- username = 'test'
context.client = Client(hostname, stomp_port, username) | Remove hardcoded 'test' from queue names. | julianghionoiu_tdl-client-python | train | py |
e49567ba729001c31fe71e4b715eed8f50d7ded9 | diff --git a/daemon/graphdriver/devmapper/deviceset.go b/daemon/graphdriver/devmapper/deviceset.go
index <HASH>..<HASH> 100644
--- a/daemon/graphdriver/devmapper/deviceset.go
+++ b/daemon/graphdriver/devmapper/deviceset.go
@@ -1317,7 +1317,7 @@ func NewDeviceSet(root string, doInit bool, options []string) (*DeviceSet, error
}
// By default, don't do blk discard hack on raw devices, its rarely useful and is expensive
- if !foundBlkDiscard && devices.dataDevice != "" {
+ if !foundBlkDiscard && (devices.dataDevice != "" || devices.thinPoolDevice != "") {
devices.doBlkDiscard = false
} | devmapper: disable discards by default if dm.thinpooldev was specified
User may still enable discards by setting dm.blkdiscard=true
Docker-DCO-<I>- | moby_moby | train | go |
d6fd799fe1ab01e09fe9a551b3a1cf1101fdf269 | diff --git a/src/Shell/Task/ImportTask.php b/src/Shell/Task/ImportTask.php
index <HASH>..<HASH> 100644
--- a/src/Shell/Task/ImportTask.php
+++ b/src/Shell/Task/ImportTask.php
@@ -52,7 +52,14 @@ class ImportTask extends Shell
continue;
}
- $entity = $table->find()->where(['name' => $role['name']])->first();
+ $entity = $table->find()->where(['name' => $role['name']])->contain(['Groups' => function ($q) {
+ return $q->select(['Groups.id']);
+ }])->first();
+
+ $linkedGroups = array_map(function ($item) {
+ return $item->get('id');
+ }, $entity->get('groups'));
+
Assert::nullOrIsInstanceOf($entity, EntityInterface::class);
if (null !== $entity && $entity->get('deny_edit')) {
@@ -73,7 +80,8 @@ class ImportTask extends Shell
}
$group = $this->getGroupByRoleName($entity->get('name'));
- if (null === $group) {
+
+ if (null === $group || in_array($group->get('id'), $linkedGroups, true)) {
continue;
} | Prevent re-linking existing role-group associations (task #<I>) | QoboLtd_cakephp-roles-capabilities | train | php |
003eecc7bd334101431b7926d9f51b606e13aee0 | diff --git a/eZ/Publish/API/REST/common.php b/eZ/Publish/API/REST/common.php
index <HASH>..<HASH> 100644
--- a/eZ/Publish/API/REST/common.php
+++ b/eZ/Publish/API/REST/common.php
@@ -31,6 +31,7 @@ $repository = new Client\Repository(
new Common\Output\Generator\Json(),
array(
'\\eZ\\Publish\\API\\Repository\\Values\\Content\\SectionCreateStruct' => new Client\Output\ValueObjectVisitor\SectionCreateStruct(),
+ '\\eZ\\Publish\\API\\Repository\\Values\\Content\\SectionUpdateStruct' => new Client\Output\ValueObjectVisitor\SectionUpdateStruct(),
)
)
); | Updated: Registered SectionUpdateStruct for visiting. | ezsystems_ezpublish-kernel | train | php |
99a7cac6c11b55d12e20c7e8669bd85a24671d71 | diff --git a/Tests/AbstractWebApplicationTest.php b/Tests/AbstractWebApplicationTest.php
index <HASH>..<HASH> 100644
--- a/Tests/AbstractWebApplicationTest.php
+++ b/Tests/AbstractWebApplicationTest.php
@@ -795,7 +795,6 @@ class AbstractWebApplicationTest extends \PHPUnit_Framework_TestCase
$this->assertSame(
self::$headers,
array(
- array('HTTP/1.1 201 Created', true, 201),
array('HTTP/1.1 303 See other', true, 303),
array('Location: http://' . self::TEST_HTTP_HOST . "/$url", true, null),
array('Content-Type: text/html; charset=utf-8', true, null), | Remove second header, it won't be set | joomla-framework_application | train | php |
47a8513cbd6fe4d6cb5089342ee84e001a6a374f | diff --git a/test/test_pf_distributed_slack.py b/test/test_pf_distributed_slack.py
index <HASH>..<HASH> 100644
--- a/test/test_pf_distributed_slack.py
+++ b/test/test_pf_distributed_slack.py
@@ -9,6 +9,7 @@ def test_pf_distributed_slack():
"examples", "scigrid-de", "scigrid-with-load-gen-trafos")
network = pypsa.Network(csv_folder_name)
+ network.set_snapshots(network.snapshots[:2])
#There are some infeasibilities without line extensions
network.lines.s_max_pu = 0.7
@@ -37,4 +38,4 @@ def test_pf_distributed_slack():
if __name__ == "__main__":
- pf_distributed_slack()
+ test_pf_distributed_slack() | make test more lightweight (2 snapshots only) | PyPSA_PyPSA | train | py |
334d63651255887a05c0dacebc370ed4b960dc89 | diff --git a/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangAtom.java b/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangAtom.java
index <HASH>..<HASH> 100644
--- a/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangAtom.java
+++ b/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangAtom.java
@@ -53,7 +53,7 @@ public class OtpErlangAtom extends OtpErlangObject implements Serializable,
if (atom.length() > maxAtomLength) {
throw new java.lang.IllegalArgumentException("Atom may not exceed "
- + maxAtomLength + " characters");
+ + maxAtomLength + " characters: " + atom);
}
this.atom = atom;
} | Improve error message when creating a too long OtpErlangAtom
Also print the value that we tried to use for the atom. This
helps a lot when debugging and doesn't affect anything when
the length is normal. | erlang_otp | train | java |
5c62240341c6d34b7edb307cb0edc3b2ce43c897 | diff --git a/ara/setup/__init__.py b/ara/setup/__init__.py
index <HASH>..<HASH> 100644
--- a/ara/setup/__init__.py
+++ b/ara/setup/__init__.py
@@ -21,5 +21,5 @@ import os
path = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
plugins = os.path.abspath(os.path.join(path, "plugins"))
-action_plugins = os.path.abspath(os.path.join(plugins, "actions"))
-callback_plugins = os.path.abspath(os.path.join(plugins, "callbacks"))
+action_plugins = os.path.abspath(os.path.join(plugins, "action"))
+callback_plugins = os.path.abspath(os.path.join(plugins, "callback")) | Fix typos in the paths returned by ara.setup
In ara <I>, we're aligning with the directory names in Ansible.
Callbacks are located at lib/ansible/plugins/callback (not "callbacks").
Same for action plugins.
Change-Id: I<I>b<I>ba<I>ba<I>d<I>abf<I>b<I>da<I>d2 | ansible-community_ara | train | py |
d12fbc7666be01ef78ac331544e0b5f10b340295 | diff --git a/src/fileseq/constants.py b/src/fileseq/constants.py
index <HASH>..<HASH> 100644
--- a/src/fileseq/constants.py
+++ b/src/fileseq/constants.py
@@ -25,7 +25,7 @@ PRINTF_SYNTAX_PADDING_PATTERN = r"%(\d+)d"
PRINTF_SYNTAX_PADDING_RE = re.compile(PRINTF_SYNTAX_PADDING_PATTERN)
# Regular expression pattern for matching file names on disk.
-DISK_PATTERN = r"^((?:.*[/\\])?)(?:(.*?)(-?\d+)?((?:\.[^.]*)?))?$"
+DISK_PATTERN = r"^((?:.*[/\\])?)(.*?)(-?\d+)?((?:\.\w*[a-zA-Z]\w)*(?:\.[^.]+)?)$"
DISK_RE = re.compile(DISK_PATTERN)
# Regular expression pattern for matching frame set strings. | Update regex to handle long extensions after frame (refs #<I>) | sqlboy_fileseq | train | py |
3bf7966d1ec46412f66edf7adb13ed932f1d3f27 | diff --git a/src/Connection.php b/src/Connection.php
index <HASH>..<HASH> 100644
--- a/src/Connection.php
+++ b/src/Connection.php
@@ -57,6 +57,14 @@ abstract class Connection
$this->setDefaults($properties);
}
+ public function __destruct()
+ {
+ // needed for DBAL connection to be released immeditelly
+ if ($this->connection !== null) {
+ $this->connection->close();
+ }
+ }
+
/**
* Normalize DSN connection string.
* | Fix DBAL Connection to be GCed without an explicit call needed (#<I>) | atk4_dsql | train | php |
2f6e90d748c2d28f7531303b953c40471e12b32d | diff --git a/src/blockchain.js b/src/blockchain.js
index <HASH>..<HASH> 100644
--- a/src/blockchain.js
+++ b/src/blockchain.js
@@ -85,6 +85,9 @@ Blockchain.connect = function(connectionList, opts, doneCb) {
if(opts.blockchainClient === 'geth') {
console.warn("%cNote: There is a known issue with Geth that may cause transactions to get stuck when using Metamask. Please log in to the cockpit (http://localhost:8000/embark?enableRegularTxs=true) to enable a workaround. Once logged in, the workaround will automatically be enabled.", "font-size: 2em");
}
+ if(opts.blockchainClient === 'parity') {
+ console.warn("%cNote: Parity blocks the connection from browser extensions like Metamask. To resolve this problem, go to https://embark.status.im/docs/blockchain_configuration.html#Using-Parity-and-Metamask", "font-size: 2em");
+ }
console.warn("%cNote: Embark has detected you are in the development environment and using Metamask, please make sure Metamask is connected to your local node", "font-size: 2em");
}
if (accounts) { | fix(blockchain): add warning when using Parity and Metamask | embark-framework_EmbarkJS | train | js |
56438933436ee068a17bb1dd581b879db2bf764d | diff --git a/src/Metabor/Statemachine/Condition/SymfonyExpression.php b/src/Metabor/Statemachine/Condition/SymfonyExpression.php
index <HASH>..<HASH> 100644
--- a/src/Metabor/Statemachine/Condition/SymfonyExpression.php
+++ b/src/Metabor/Statemachine/Condition/SymfonyExpression.php
@@ -46,7 +46,7 @@ class SymfonyExpression extends Named implements ConditionInterface
protected function getExpression()
{
if (!$this->expression) {
- $this->expression = $this->expressionLanguage->parse($this->getConditionName(), array('subject', 'context'));
+ $this->expression = $this->expressionLanguage->parse($this->getName(), array('subject', 'context'));
}
return $this->expression;
} | add SymfonyExpression as condition | Metabor_Statemachine | train | php |
a9b3e5cb366c9436fef2c660246e4a2205c24558 | diff --git a/build/libraries/git-skip.js b/build/libraries/git-skip.js
index <HASH>..<HASH> 100644
--- a/build/libraries/git-skip.js
+++ b/build/libraries/git-skip.js
@@ -83,6 +83,7 @@ function getSkippablePaths()
'themes/dashboard/main.js',
'themes/elemental/main.js',
'themes/elemental/main.css',
+ 'mix-manifest.json',
].concat(
listCopiedFiles(path.join(fsUtil.WEBROOT, 'build/node_modules/@fortawesome/fontawesome-free/webfonts'), 'css/webfonts')
).concat( | Add concrete/mix-manifest.json to the git-skip files | concrete5_concrete5 | train | js |
ae634a19065e0480e26a9514e4d66e29e8add88b | diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -11,12 +11,13 @@ from distutils.core import Command
from setuptools import setup, find_packages
from version import get_git_version
-VERSION = get_git_version()
+VERSION, SOURCE_LABEL = get_git_version()
PROJECT = 'rejester'
AUTHOR = 'Diffeo, Inc.'
AUTHOR_EMAIL = '[email protected]'
DESC = 'redis-based python client library and command line tools for managing tasks executed by a group of configurable workers'
LICENSE = 'MIT/X11 license http://opensource.org/licenses/MIT',
+URL = 'http://github.com/diffeo/rejester'
def read_file(file_name):
file_path = os.path.join(
@@ -89,6 +90,7 @@ class PyTest(Command):
setup(
name=PROJECT,
version=VERSION,
+ source_label=SOURCE_LABEL,
description=DESC,
license=LICENSE,
long_description=read_file('README.md'), | using the PEP<I> style version strings | diffeo_rejester | train | py |
a9dc72cf25589bc00260f1af4e5a17dac0f66474 | diff --git a/cmd/ddltest/ddl_test.go b/cmd/ddltest/ddl_test.go
index <HASH>..<HASH> 100644
--- a/cmd/ddltest/ddl_test.go
+++ b/cmd/ddltest/ddl_test.go
@@ -63,7 +63,7 @@ var (
startPort = flag.Int("start_port", 5000, "First tidb-server listening port")
statusPort = flag.Int("status_port", 8000, "First tidb-server status port")
logLevel = flag.String("L", "error", "log level")
- ddlServerLogLevel = flag.String("ddl_log_level", "debug", "DDL server log level")
+ ddlServerLogLevel = flag.String("ddl_log_level", "fatal", "DDL server log level")
dataNum = flag.Int("n", 100, "minimal test dataset for a table")
enableRestart = flag.Bool("enable_restart", true, "whether random restart servers for tests")
) | cmd/ddltest: change the default log level to fatal in ddltest (#<I>) | pingcap_tidb | train | go |
dd41c079460c9f0ae7f1963b9c923e4bb001fd92 | diff --git a/vespa/fpp.py b/vespa/fpp.py
index <HASH>..<HASH> 100644
--- a/vespa/fpp.py
+++ b/vespa/fpp.py
@@ -209,7 +209,11 @@ class FPPCalculation(object):
raise AttributeError('If transit pickle file (trsig.pkl)'+
'not present, "photfile" must be'+
'defined.')
- photfile = os.path.join(folder,config['photfile'])
+ if not os.path.isabs(config['photfile']):
+ photfile = os.path.join(folder,config['photfile'])
+ else:
+ photfile = config['photfile']
+
logging.info('Reading transit signal photometry ' +
'from {}...'.format(photfile))
try: | allowed photfile to be absolute path | timothydmorton_VESPA | train | py |
b90d1b843d8f2c874c37ab54e73f6fb2d72ee8f7 | diff --git a/lib/concerns/soft_delete.rb b/lib/concerns/soft_delete.rb
index <HASH>..<HASH> 100644
--- a/lib/concerns/soft_delete.rb
+++ b/lib/concerns/soft_delete.rb
@@ -2,7 +2,8 @@ module Concerns::SoftDelete
def self.included(klass)
klass.class_eval do
- default_scope{ where(deleted_at: nil) }
+ scope :active, -> { where(deleted_at: nil) }
+ scope :deleted, -> { where.not(deleted_at: nil) }
end
end | Edited soft_delete to scope active and soft 'deleted' items | airslie_renalware-core | train | rb |
53aa6dceade5a3c6549fe22ea87521482d3beb71 | diff --git a/secretballot/models.py b/secretballot/models.py
index <HASH>..<HASH> 100644
--- a/secretballot/models.py
+++ b/secretballot/models.py
@@ -11,7 +11,7 @@ class Vote(models.Model):
token = models.CharField(max_length=50)
vote = models.SmallIntegerField(choices=VOTE_CHOICES)
- # generic foreign key to a VotableModel
+ # generic foreign key to the model being voted upon
content_type = models.ForeignKey(ContentType)
object_id = models.PositiveIntegerField()
content_object = generic.GenericForeignKey('content_type', 'object_id') | remove doc reference to VotableModel | jamesturk_django-secretballot | train | py |
f977f2ab79c350f3789eed41ac6c6c5e5aa4a73d | diff --git a/mind-map/mind-map-swing-panel/src/main/java/com/igormaznitsa/mindmap/swing/panel/MindMapPanel.java b/mind-map/mind-map-swing-panel/src/main/java/com/igormaznitsa/mindmap/swing/panel/MindMapPanel.java
index <HASH>..<HASH> 100644
--- a/mind-map/mind-map-swing-panel/src/main/java/com/igormaznitsa/mindmap/swing/panel/MindMapPanel.java
+++ b/mind-map/mind-map-swing-panel/src/main/java/com/igormaznitsa/mindmap/swing/panel/MindMapPanel.java
@@ -718,7 +718,7 @@ public class MindMapPanel extends JPanel implements ClipboardOwner {
@Override
public void mouseClicked(@Nonnull final MouseEvent e) {
- if (!e.isConsumed() && lockIfNotDisposed()) {
+ if (!e.isConsumed() && lockIfNotDisposed() && !popupMenuActive) {
try {
if (!controller.isMouseClickProcessingAllowed(theInstance)) {
return; | added check popup menu visibility if detected mouse click | raydac_netbeans-mmd-plugin | train | java |
1d9429fe47a4d23529355fa36d0e67b7b00a9147 | diff --git a/pyhpimc.py b/pyhpimc.py
index <HASH>..<HASH> 100644
--- a/pyhpimc.py
+++ b/pyhpimc.py
@@ -698,7 +698,7 @@ def print_to_file(object):
Function takes in object of type str, list, or dict and prints out to current working directory as pyoutput.txt
:param: Object: object of type str, list, or dict
:return: No return. Just prints out to file handler and save to current working directory as pyoutput.txt
- """
+ '''
with open ('pyoutput.txt', 'w') as fh:
x = None
if type(object) is list: | Fixed bug
Fixed bug related to never-ending string | HPENetworking_PYHPEIMC | train | py |
e5320a9dc053962882e93f37098f462445d3d347 | diff --git a/lib/ORM/EntityQuery.php b/lib/ORM/EntityQuery.php
index <HASH>..<HASH> 100644
--- a/lib/ORM/EntityQuery.php
+++ b/lib/ORM/EntityQuery.php
@@ -145,6 +145,38 @@ class EntityQuery extends Query
}
/**
+ * @param string[]|string $column
+ * @param int $value
+ * @return int
+ */
+ public function increment($column, $value = 1)
+ {
+ if($this->mapper->supportsTimestamp()){
+ $this->sql->addUpdateColumns([
+ 'updated_at' => date($this->manager->getDateFormat())
+ ]);
+ }
+
+ return (new Update($this->manager->getConnection(), $this->mapper->getTable(), $this->sql))->increment($column, $value);
+ }
+
+ /**
+ * @param string[]|string $column
+ * @param int $value
+ * @return int
+ */
+ public function decrement($column, $value = 1)
+ {
+ if($this->mapper->supportsTimestamp()){
+ $this->sql->addUpdateColumns([
+ 'updated_at' => date($this->manager->getDateFormat())
+ ]);
+ }
+
+ return (new Update($this->manager->getConnection(), $this->mapper->getTable(), $this->sql))->decrement($column, $value);
+ }
+
+ /**
* @param $id
* @param array $columns
* @return mixed|null | Added 'increment' and 'decrement' methods | opis_database | train | php |
cafff52c3af445b399566fa6b06741863061bd9f | diff --git a/tests/spec/fs.rename.spec.js b/tests/spec/fs.rename.spec.js
index <HASH>..<HASH> 100644
--- a/tests/spec/fs.rename.spec.js
+++ b/tests/spec/fs.rename.spec.js
@@ -32,6 +32,7 @@ describe('fs.rename', function() {
fs.stat('/myfile', function(error, result) {
expect(error).to.exist;
+ expect(result).not.to.exist;
complete1 = true;
maybeDone();
}); | Fix lint issues in fs.rename.spec.js | filerjs_filer | train | js |
780f37dc64a7f861aaca5d4323ec92a65ca2908c | diff --git a/pycbc/events/threshold_cuda.py b/pycbc/events/threshold_cuda.py
index <HASH>..<HASH> 100644
--- a/pycbc/events/threshold_cuda.py
+++ b/pycbc/events/threshold_cuda.py
@@ -349,7 +349,7 @@ def threshold_on_cpu(series, value):
# Select which of the thresholding methods we want to use out of the above.
-threshold = threshold_on_cpu
+threshold = threshold_by_scan
threshold_cluster_mod = SourceModule("""
#include<pycuda-complex.hpp> | Switch thresholding method to by_scan on CUDA.
The current method is slower and seems to cause errors in the pipeline. | gwastro_pycbc | train | py |
783b3471abe83b74cddcdf91505755c18938a716 | diff --git a/test/test.py b/test/test.py
index <HASH>..<HASH> 100755
--- a/test/test.py
+++ b/test/test.py
@@ -270,5 +270,25 @@ def f(x: int, y: float, *args, z: int='not an int') -> str:
with self.assertRaisesRegex(EnsureError, "Default argument z to <function f at .+> does not match annotation type <class 'int'>"):
exec(f_code)
+ @unittest.skipIf(sys.version_info < (3, 0), "Skipping test that requires Python 3 features")
+ def test_annotations_on_bound_methods(self):
+ f_code = """
+from ensure import ensure_annotations
+
+global C
+
+class C(object):
+ @ensure_annotations
+ def f(self, x: int, y: float) -> str:
+ return str(x+y)
+
+
+"""
+ exec(f_code)
+ self.assertEqual('3.3', C().f(1, 2.3))
+ with self.assertRaisesRegex(EnsureError, "Argument x to <function C.f at .+> does not match annotation type <class 'int'>"):
+ g = C().f(3.2, 1)
+
+
if __name__ == '__main__':
unittest.main() | Begin annotations tests on bound methods | kislyuk_ensure | train | py |
0cbce0ddc139dde1367155398d0c6a186408fab3 | diff --git a/hug/test.py b/hug/test.py
index <HASH>..<HASH> 100644
--- a/hug/test.py
+++ b/hug/test.py
@@ -9,11 +9,14 @@ from functools import partial
def call(method, api_module, url, body='', headers=None, **params):
api = server(api_module)
response = StartResponseMock()
- result = api(create_environ(path=url, method=method, headers=headers, query_string=urlencode(params)), response)
+ result = api(create_environ(path=url, method=method, headers=headers, query_string=urlencode(params), body=body),
+ response)
if result:
- return json.loads(result[0].decode('utf8'))
- else:
- return response.status
+ response.data = result[0].decode('utf8')
+ response.content_type = response.headers_dict['content-type']
+ if response.content_type == 'application/json':
+ response.data = json.loads(response.data)
+ return response
for method in HTTP_METHODS: | Update call method to return entire response object, and work with non json data | hugapi_hug | train | py |
a479ba7e07f5408bc9a9926907534a4e007b4bfa | diff --git a/src/Barryvdh/TranslationManager/Translator.php b/src/Barryvdh/TranslationManager/Translator.php
index <HASH>..<HASH> 100644
--- a/src/Barryvdh/TranslationManager/Translator.php
+++ b/src/Barryvdh/TranslationManager/Translator.php
@@ -143,6 +143,27 @@ class Translator extends LaravelTranslator
return $result;
}
+ /**
+ * Get a translation according to an integer value.
+ *
+ * @param string $key
+ * @param int $number
+ * @param array $replace
+ * @param string $locale
+ * @return string
+ */
+ public function choice($key, $number, array $replace = array(), $locale = null)
+ {
+ if ($this->inPlaceEditing())
+ {
+ return $this->get($key, $replace, $locale = $locale ?: $this->locale);
+ }
+ else
+ {
+ return parent::choice($key, $number, $replace, $locale);
+ }
+ }
+
public
function setTranslationManager(Manager $manager)
{ | add plural forms group
add plural forms functionality to x-editable in translation manager | vsch_laravel-translation-manager | train | php |
9c6afcfb5d9a4db22c99c44080968b9f1cb14e2b | diff --git a/src/quantities.js b/src/quantities.js
index <HASH>..<HASH> 100644
--- a/src/quantities.js
+++ b/src/quantities.js
@@ -112,6 +112,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
"<fluid-ounce>": [["floz","fluid-ounce"], 2.95735297e-5, "volume", ["<meter>","<meter>","<meter>"]],
"<tablespoon>": [["tbs","tablespoon","tablespoons"], 1.47867648e-5, "volume", ["<meter>","<meter>","<meter>"]],
"<teaspoon>": [["tsp","teaspoon","teaspoons"], 4.92892161e-6, "volume", ["<meter>","<meter>","<meter>"]],
+ "<bushel>": [["bu","bsh","bushel","bushels"], 0.035239072, "volume", ["<meter>","<meter>","<meter>"]],
/* speed */
"<kph>" : [["kph"], 0.277777778, "speed", ["<meter>"], ["<second>"]], | Add support for bushels ("bushel", "bushels", "bu", "bsh") | gentooboontoo_js-quantities | train | js |
341f230969e1b6369dc490ef785ffe7ead03cb18 | diff --git a/state/apiserver/logger/logger_test.go b/state/apiserver/logger/logger_test.go
index <HASH>..<HASH> 100644
--- a/state/apiserver/logger/logger_test.go
+++ b/state/apiserver/logger/logger_test.go
@@ -37,8 +37,6 @@ func (s *loggerSuite) SetUpTest(c *gc.C) {
var err error
s.rawMachine, err = s.State.AddMachine("quantal", state.JobHostUnits)
c.Assert(err, gc.IsNil)
- err = s.rawMachine.SetPassword("test-password")
- c.Assert(err, gc.IsNil)
// The default auth is as the machine agent
s.authorizer = apiservertesting.FakeAuthorizer{ | logger also doesn't need the password | juju_juju | train | go |
7b173f2e7f8460e4f070836bf074cfaea320604d | diff --git a/Swat/SwatTableViewRow.php b/Swat/SwatTableViewRow.php
index <HASH>..<HASH> 100644
--- a/Swat/SwatTableViewRow.php
+++ b/Swat/SwatTableViewRow.php
@@ -21,29 +21,42 @@ abstract class SwatTableViewRow extends SwatUIBase
public $view = null;
// }}}
- // {{{ public function display()
+ // {{{ public function init()
/**
- * Displays this row
+ * Initializes this row
*
- * @param array $columns an array of columns to render in this row.
+ * This method does nothing and is implemented here so subclasses do not
+ * need to implement it.
*/
- public abstract function display(&$columns);
+ public function init()
+ {
+ }
// }}}
- // {{{ public function init()
+ // {{{ public function process()
/**
- * Initializes this row
+ * Processes this row
*
* This method does nothing and is implemented here so subclasses do not
* need to implement it.
*/
- public function init()
+ public function process()
{
}
// }}}
+ // {{{ public function display()
+
+ /**
+ * Displays this row
+ *
+ * @param array $columns an array of columns to render in this row.
+ */
+ public abstract function display(&$columns);
+
+ // }}}
// {{{ public function getHtmlHeadEntries()
/** | Add process() method to rows.
svn commit r<I> | silverorange_swat | train | php |
0c354395e4c6dd35e061a3e134ab56b3f1d5eddf | diff --git a/soco/core.py b/soco/core.py
index <HASH>..<HASH> 100755
--- a/soco/core.py
+++ b/soco/core.py
@@ -984,9 +984,13 @@ class SoCo(object): # pylint: disable=R0904
def add_to_queue(self, queueable_item):
""" Adds a queueable item to the queue """
- if not isinstance(queueable_item, QueueableItem):
- raise TypeError('queueable_item must be an instance of '
- 'QueueableItem or sub classes')
+ # Check if teh required attributes are there
+ for attribute in ['didl_metadata', 'uri']:
+ if not hasattr(queueable_item, attribute):
+ message = 'queueable_item has no attribute {}'.\
+ format(attribute)
+ raise AttributeError(message)
+ # Get the metadata
try:
metadata = XML.tostring(queueable_item.didl_metadata)
except CannotCreateDIDLMetadata as exception: | Replace type check with attribute check for arg to add_to_queue | amelchio_pysonos | train | py |
97a6a51bece3a0ec033f274a84dd0a10164ee8e5 | diff --git a/core/dbt/adapters/base/impl.py b/core/dbt/adapters/base/impl.py
index <HASH>..<HASH> 100644
--- a/core/dbt/adapters/base/impl.py
+++ b/core/dbt/adapters/base/impl.py
@@ -581,7 +581,7 @@ class BaseAdapter(object):
if schema is not None and quoting['schema'] is False:
schema = schema.lower()
- if database is not None and quoting['schema'] is False:
+ if database is not None and quoting['database'] is False:
database = database.lower()
return filter_null_values({
diff --git a/core/dbt/adapters/sql/impl.py b/core/dbt/adapters/sql/impl.py
index <HASH>..<HASH> 100644
--- a/core/dbt/adapters/sql/impl.py
+++ b/core/dbt/adapters/sql/impl.py
@@ -203,6 +203,7 @@ class SQLAdapter(BaseAdapter):
relations = []
quote_policy = {
+ 'database': True,
'schema': True,
'identifier': True
} | Quote databases when we list them
Fix a copy+paste error that broke database quoting configuration | fishtown-analytics_dbt | train | py,py |
00bc69c9396c5ab3b9c52a843d6cc0d1d1ccf5d2 | diff --git a/sprd/data/DesignerApiDataSourceClass.js b/sprd/data/DesignerApiDataSourceClass.js
index <HASH>..<HASH> 100644
--- a/sprd/data/DesignerApiDataSourceClass.js
+++ b/sprd/data/DesignerApiDataSourceClass.js
@@ -17,7 +17,7 @@ define(["js/data/RestDataSource", "sprd/model/processor/TransformerProcessor", "
var language = this.$.language;
if (language && resource.factory.prototype.constructor.name !== "sprd.model.Transformer") {
ret = _.defaults(ret, {
- language: language
+ languageCode: language
});
} | DEV-<I> use correct query param when getting masks | spreadshirt_rAppid.js-sprd | train | js |
f7c799204358bcc38c5972a29e5994b78b25b515 | diff --git a/ec2/spark_ec2.py b/ec2/spark_ec2.py
index <HASH>..<HASH> 100755
--- a/ec2/spark_ec2.py
+++ b/ec2/spark_ec2.py
@@ -1307,6 +1307,17 @@ def real_main():
cluster_instances=(master_nodes + slave_nodes),
cluster_state='ssh-ready'
)
+
+ # Determine types of running instances
+ existing_master_type = master_nodes[0].instance_type
+ existing_slave_type = slave_nodes[0].instance_type
+ # Setting opts.master_instance_type to the empty string indicates we
+ # have the same instance type for the master and the slaves
+ if existing_master_type == existing_slave_type:
+ existing_master_type = ""
+ opts.master_instance_type = existing_master_type
+ opts.instance_type = existing_slave_type
+
setup_cluster(conn, master_nodes, slave_nodes, opts, False)
else: | [EC2] [SPARK-<I>] Instance types can be mislabeled when re-starting cluster with default arguments
As described in <URL>, where machines that have one disk end up having shuffle spills in the in the small (8GB) snapshot partitions that quickly fills up and results in failing jobs due to "No space left on device" errors.
Other instance specific settings that are set in the spark_ec2.py script are likely to be wrong as well. | apache_spark | train | py |
dabaa319cb7c34f1a8d21ace3c2a07e5f530d5c1 | diff --git a/CHANGES.rst b/CHANGES.rst
index <HASH>..<HASH> 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -1,6 +1,11 @@
Permission Changelog
====================
+Version 0.4.0
+-------------
+
+Add ``with`` statement support.
+
Version 0.3.0
-------------
diff --git a/permission/__init__.py b/permission/__init__.py
index <HASH>..<HASH> 100644
--- a/permission/__init__.py
+++ b/permission/__init__.py
@@ -1,3 +1,3 @@
from .permission import Permission, Rule
-__all__ = ('Permission', 'Rule')
\ No newline at end of file
+__all__ = ('Permission', 'Rule')
diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -2,7 +2,7 @@ from distutils.core import setup
setup(
name='permission',
- version='0.3.0',
+ version='0.4.0',
author='Zhipeng Liu',
author_email='[email protected]',
url='https://github.com/hustlzp/permission', | Bump to <I>. | hustlzp_permission | train | rst,py,py |
4bc58171169b15fb95f2e7a2192dc87ad777c166 | diff --git a/src/getRollupInputOptions.js b/src/getRollupInputOptions.js
index <HASH>..<HASH> 100644
--- a/src/getRollupInputOptions.js
+++ b/src/getRollupInputOptions.js
@@ -3,6 +3,7 @@ import babelPlugin from "rollup-plugin-babel"
import chalk from "chalk"
import cjsPlugin from "rollup-plugin-commonjs"
import executablePlugin from "rollup-plugin-executable"
+import figures from "figures"
import jsonPlugin from "rollup-plugin-json"
import rebasePlugin from "rollup-plugin-rebase"
import replacePlugin from "rollup-plugin-replace"
@@ -36,6 +37,14 @@ export default function getRollupInputOptions(options) {
const protectedEnv = process.env
const env = protectedEnv.NODE_ENV
if (env) {
+ if (target !== "cli") {
+ console.warn(
+ `${
+ figures.warning
+ } Setting 'NODE_ENV' during publishing prevents selecting environment during usage!`
+ )
+ }
+
variables[`${prefix}NODE_ENV`] = JSON.stringify(env)
} | Added warning on injecting NODE_ENV for libraries. | sebastian-software_preppy | train | js |
11f04e41986349456c2bbd51cc8ff8c38e48aba8 | diff --git a/cms7/generator.py b/cms7/generator.py
index <HASH>..<HASH> 100644
--- a/cms7/generator.py
+++ b/cms7/generator.py
@@ -1,9 +1,10 @@
from pathlib2 import PurePosixPath
-
import logging
from jinja2 import Environment, ChoiceLoader, FileSystemLoader, ModuleLoader, StrictUndefined
+from .error import CMS7Error
+
logger = logging.getLogger(__name__)
class Generator:
@@ -38,7 +39,7 @@ class Generator:
break
else:
logger.warning('look up for %s: nothing found!', name)
- target = PurePosixPath(name)
+ return self.env.undefined('url_for({!r})'.format(str(name)))
n = 0
for a, b in zip(location.parts, target.parts):
if a != b: | generator: return undefined for url lookup failure
we can now look up the url for anything that's going to be deployed, so
there's no reason to just pass through unknown names any more.
we return a jinja undefined instead of just raising an exception for two
reasons: it allows a template to do something like
`if url_for('blah') is defined`, and when an error does occur, it more
obviously comes from the template | freenode_cms7 | train | py |
0c408f5a3dcfdd78be8d5407c806c9d908613aa8 | diff --git a/version.php b/version.php
index <HASH>..<HASH> 100644
--- a/version.php
+++ b/version.php
@@ -30,7 +30,7 @@
defined('MOODLE_INTERNAL') || die();
-$version = 2012051100.01; // YYYYMMDD = weekly release date of this DEV branch
+$version = 2012051100.02; // YYYYMMDD = weekly release date of this DEV branch
// RR = release increments - 00 in DEV branches
// .XX = incremental changes | NOBUG: Minibump to get latest WS installed | moodle_moodle | train | php |
7c69695e5bf93df1d6835959a831de6561a102f1 | diff --git a/GPflow/model.py b/GPflow/model.py
index <HASH>..<HASH> 100755
--- a/GPflow/model.py
+++ b/GPflow/model.py
@@ -231,6 +231,7 @@ class Model(Parameterized):
while iteration < maxiter:
self.update_feed_dict(self._feed_dict_keys, feed_dict)
self._session.run(opt_step, feed_dict=feed_dict)
+ self.fevals += 1
if callback is not None:
callback(self._session.run(self._free_vars))
iteration += 1 | fevals updated for tensorflow optimisations as well | GPflow_GPflow | train | py |
355c40d9e2687c69e597aeabfc2360150775eebb | diff --git a/tests/unit/utils/UtilsTest.py b/tests/unit/utils/UtilsTest.py
index <HASH>..<HASH> 100644
--- a/tests/unit/utils/UtilsTest.py
+++ b/tests/unit/utils/UtilsTest.py
@@ -46,8 +46,8 @@ class UtilsTest:
'item3': np.array([1, 2])})
s = D.__str__().split('\n')
assert len(s) == 7
- r = D.__repr__()
- assert r == "{'item1': 1, 'item2': 2, 'item3': array([1, 2])}"
+ # r = D.__repr__()
+ # assert r == "{'item1': 1, 'item2': 2, 'item3': array([1, 2])}"
def test_is_symmetric_w_rtol(self):
A = np.array([[1, 2, 3], [2, 4, 6], [3.000001, 6, 99]]) | Commented out a test about __repr__ that no longer is necessary | PMEAL_OpenPNM | train | py |
678cfe8934d31a1fbe19184997e236d8f3b2037d | diff --git a/Resources/router.php b/Resources/router.php
index <HASH>..<HASH> 100644
--- a/Resources/router.php
+++ b/Resources/router.php
@@ -21,7 +21,7 @@ if (getenv('MANNEQUIN_AUTOLOAD')) {
// one of our protected patterns. As much as we'd love to control each request,
// this can slow down the development server by an order of magnitude.
if (is_file($_SERVER['DOCUMENT_ROOT'].DIRECTORY_SEPARATOR.$_SERVER['SCRIPT_NAME'])) {
- if (!preg_match('@^/(index.html$|favicon.ico$|static/|m-)@', $_SERVER['SCRIPT_NAME'])) {
+ if (!preg_match('@^/(index.php$|index.html$|favicon.ico$|static/|m-)@', $_SERVER['SCRIPT_NAME'])) {
return false;
}
} | (Core) Fixed index.php in repository root will be served instead of live development server. | LastCallMedia_Mannequin-Core | train | php |
a0ba1af5982b125458248602f7f60f05fa5cf76f | diff --git a/losand.js b/losand.js
index <HASH>..<HASH> 100644
--- a/losand.js
+++ b/losand.js
@@ -286,7 +286,7 @@
try {
return _(JSON.parse(this));
} catch (e) {
- return this;
+ return this.valueOf();
}
}
}
diff --git a/spec/losand.spec.js b/spec/losand.spec.js
index <HASH>..<HASH> 100644
--- a/spec/losand.spec.js
+++ b/spec/losand.spec.js
@@ -502,4 +502,12 @@ describe("test of losand", function () {
1
)
);
+ it(
+ "String.prototype.json get parsed after this value",
+ () => expect(
+ "test".json
+ ).toBe(
+ "test"
+ )
+ );
});
\ No newline at end of file | modified: losand.js
modified: spec/losand.spec.js | johnny-shaman_losand | train | js,js |
f9e54c40db1b617b95beabb442088a153d5a4f0a | diff --git a/src/js/components/DropButton/DropButton.js b/src/js/components/DropButton/DropButton.js
index <HASH>..<HASH> 100644
--- a/src/js/components/DropButton/DropButton.js
+++ b/src/js/components/DropButton/DropButton.js
@@ -55,12 +55,15 @@ class DropButton extends Component {
});
};
- onToggle = () => {
- const { onClose, onOpen } = this.props;
+ onToggle = event => {
+ const { onClick, onClose, onOpen } = this.props;
const { show } = this.state;
this.setState({ show: !show }, () =>
show ? onClose && onClose() : onOpen && onOpen(),
);
+ if (onClick) {
+ onClick(event);
+ }
};
render() {
@@ -103,8 +106,8 @@ class DropButton extends Component {
id={id}
ref={forwardRef || this.buttonRef}
disabled={disabled}
- onClick={this.onToggle}
{...rest}
+ onClick={this.onToggle}
/>
{drop}
</React.Fragment> | Changed DropButton to allow caller to pass onClick (#<I>) | grommet_grommet | train | js |
497934bee15a25cd309ba3bce4ef3b73f94da513 | diff --git a/src/Calendar/Calendar.js b/src/Calendar/Calendar.js
index <HASH>..<HASH> 100644
--- a/src/Calendar/Calendar.js
+++ b/src/Calendar/Calendar.js
@@ -192,6 +192,7 @@ export default class Calendar extends Component {
document.activeElement.classList.add(`pe-cal-selected${selectInverse}`);
document.activeElement.setAttribute('aria-selected', true);
this.setState({
+ selectedMonth: this.state.month,
selectedDate: parseInt(document.activeElement.innerText),
selectedDt: new Date(new Date().getFullYear(), new Date().getMonth(), parseInt(document.activeElement.innerText)),
selectedElement: document.activeElement | chore: update selectedMonth in state on enter | Pearson-Higher-Ed_compounds | train | js |
dce79ba76f91afc9cd6e05407582552b3a1ef22c | diff --git a/src/Support/AliasArguments/AliasArguments.php b/src/Support/AliasArguments/AliasArguments.php
index <HASH>..<HASH> 100644
--- a/src/Support/AliasArguments/AliasArguments.php
+++ b/src/Support/AliasArguments/AliasArguments.php
@@ -70,10 +70,15 @@ class AliasArguments
}
$pathAndAlias = [];
foreach ($fields as $name => $arg) {
- // $arg is either an array DSL notation or an InputObjectField
- $arg = $arg instanceof InputObjectField ? $arg : (object) $arg;
+ $type = null;
- $type = $arg->type ?? null;
+ // $arg is either an array DSL notation or an InputObjectField
+ if ($arg instanceof InputObjectField) {
+ $type = $arg->getType();
+ } else {
+ $arg = (object) $arg;
+ $type = $arg->type ?? null;
+ }
if (null === $type) {
continue; | graphql-php: don't access public type property directly but prefer calling `getType()` | rebing_graphql-laravel | train | php |
9ea7d95bb6d86bd1dabbe7ab2c20fa11826da1c1 | diff --git a/lib/core/connection/pool.js b/lib/core/connection/pool.js
index <HASH>..<HASH> 100644
--- a/lib/core/connection/pool.js
+++ b/lib/core/connection/pool.js
@@ -643,10 +643,17 @@ function destroy(self, connections, options, callback) {
return;
}
- // Zero out all connections
+ // clear all pool state
self.inUseConnections = [];
self.availableConnections = [];
self.connectingConnections = 0;
+ self.executing = false;
+ self.queue = [];
+ self.reconnectConnection = null;
+ self.numberOfConsecutiveTimeouts = 0;
+ self.connectionIndex = 0;
+ self.retriesLeft = self.options.reconnectTries;
+ self.reconnectId = null;
// Set state to destroyed
stateTransition(self, DESTROYED); | refactor(pool): ensure all pool state is cleared on destroy | mongodb_node-mongodb-native | train | js |
0aeda2f5a4f4acb2b77cb46b3ed1fb6a6a9264bc | diff --git a/src/Traits/VerifiesEmail.php b/src/Traits/VerifiesEmail.php
index <HASH>..<HASH> 100644
--- a/src/Traits/VerifiesEmail.php
+++ b/src/Traits/VerifiesEmail.php
@@ -72,10 +72,11 @@ trait VerifiesEmail
*/
public function resendVerificationEmail(Request $request)
{
+ $user = Auth::user();
+
$this->validate($request, [
- 'email' => 'required|email|max:255'
+ 'email' => 'required|email|max:255|unique:users,email,' . $user->id
]);
- $user = Auth::user();
$user->email = $request->email;
$user->save(); | Validate if email is unique when resending the verification mail | josiasmontag_laravel-email-verification | train | php |
100106420ebee76777621ee9f9dbd008da679451 | diff --git a/src/sap.m/test/sap/m/demokit/master-detail/webapp/test/integration/pages/Master.js b/src/sap.m/test/sap/m/demokit/master-detail/webapp/test/integration/pages/Master.js
index <HASH>..<HASH> 100644
--- a/src/sap.m/test/sap/m/demokit/master-detail/webapp/test/integration/pages/Master.js
+++ b/src/sap.m/test/sap/m/demokit/master-detail/webapp/test/integration/pages/Master.js
@@ -213,7 +213,12 @@ sap.ui.define([
sCurrentId = aItemsNotInTheList[0].ObjectID;
}
- this.getContext().currentItem.id = sCurrentId;
+ var oCurrentItem = this.getContext().currentItem;
+ // Construct a binding path since the list item is not created yet and we only have the id.
+ oCurrentItem.bindingPath = "/" + oList.getModel().createKey("Objects", {
+ ObjectID : sCurrentId
+ });
+ oCurrentItem.id = sCurrentId;
},
errorMessage : "the model does not have a item that is not in the list"
}); | [INTERNAL] sap.ui.demo.masterDetail - test was failing in IE
Change-Id: I<I>b<I>cce<I>e<I>efdaea<I>bc<I>fcb<I> | SAP_openui5 | train | js |
cede63f151afae8ae94e9e95952d9dcb29ff60d6 | diff --git a/graylog2-server/src/main/java/org/graylog2/rest/resources/system/inputs/ExtractorsResource.java b/graylog2-server/src/main/java/org/graylog2/rest/resources/system/inputs/ExtractorsResource.java
index <HASH>..<HASH> 100644
--- a/graylog2-server/src/main/java/org/graylog2/rest/resources/system/inputs/ExtractorsResource.java
+++ b/graylog2-server/src/main/java/org/graylog2/rest/resources/system/inputs/ExtractorsResource.java
@@ -207,9 +207,11 @@ public class ExtractorsResource extends RestResource {
Input mongoInput = Input.find(core, input.getPersistId());
mongoInput.removeExtractor(extractorId);
+ Extractor extractor = input.getExtractors().get(extractorId);
input.getExtractors().remove(extractorId);
- String msg = "Deleted extractor <" + extractorId + ">. Reason: REST request.";
+ String msg = "Deleted extractor <" + extractorId + "> of type [" + extractor.getType() + "] " +
+ "from input <" + inputId + ">. Reason: REST request.";
LOG.info(msg);
core.getActivityWriter().write(new Activity(msg, InputsResource.class)); | improved message when extractor is deleted. fixes #<I> | Graylog2_graylog2-server | train | java |
713c3c46f269bbdc065ef0c37de05f6f5c87588a | diff --git a/lib/reactiveFns.js b/lib/reactiveFns.js
index <HASH>..<HASH> 100644
--- a/lib/reactiveFns.js
+++ b/lib/reactiveFns.js
@@ -2,10 +2,15 @@ var _ = require('lodash');
module.exports = function (app) {
app.on('model', function(model) {
- model.fn('$validate.messages', function (inputErrors, inputEvent, formEvent, options) {
+ model.fn('$validate.messages', function (inputErrors, inputEvent, formEvent, rules) {
+ // show all errors if the form was submitted
if (formEvent === 'submit') return inputErrors;
- if (!options[inputEvent]) return [];
- return _.intersection(inputErrors, options[inputEvent]);
+
+ // show errors associated with this event (keypress, blur, etc..)
+ if (!rules[inputEvent]) return [];
+ return _.filter(inputErrors, function (err) {
+ return rules[inputEvent][err];
+ });
});
});
};
\ No newline at end of file | rename options to rules, use object instead of array rules, comments | psirenny_derby-validate | train | js |
e52b2c5466e7ad3349d8298ea8207c86984b597f | diff --git a/helpers/TbHtml.php b/helpers/TbHtml.php
index <HASH>..<HASH> 100755
--- a/helpers/TbHtml.php
+++ b/helpers/TbHtml.php
@@ -132,6 +132,8 @@ class TbHtml extends CHtml
static $addons = array(self::ADDON_PREPEND, self::ADDON_APPEND);
static $grids = array(self::GRID_BORDERED, self::GRID_CONDENSED, self::GRID_HOVER, self::GRID_STRIPED);
+ static $errorMessageCss = 'error';
+
private static $_counter = 0;
//
@@ -331,10 +333,10 @@ class TbHtml extends CHtml
*/
public static function label($label, $for, $htmlOptions = array())
{
+ $htmlOptions['for'] = $for;
$formType = self::popOption('formType', $htmlOptions);
if ($formType == TbHtml::FORM_HORIZONTAL)
$htmlOptions = self::addClassName('control-label', $htmlOptions);
-
return self::tag('label', $htmlOptions, $label);
}
@@ -748,6 +750,7 @@ EOD;
if ($model->hasErrors($attribute))
self::addErrorCss($htmlOptions);
+
return self::label($label, $for, $htmlOptions);
} | Fix some bugs in the HTML helper | crisu83_yiistrap | train | php |
1633bf1289b535bdfd36b6985daf4b7d66e69c70 | diff --git a/lib/register/parfait_adapter.rb b/lib/register/parfait_adapter.rb
index <HASH>..<HASH> 100644
--- a/lib/register/parfait_adapter.rb
+++ b/lib/register/parfait_adapter.rb
@@ -60,7 +60,7 @@ class Symbol
# resetting of position used to be error, but since relink and dynamic instruction size it is ok.
# in measures (of 32)
old = cache_positions[self]
- if old != nil and ((old - pos).abs > 2000)
+ if old != nil and ((old - pos).abs > 20000)
raise "position set again #{pos}!=#{old} for #{self}"
end
cache_positions[self] = pos | fix position check
as programs get bigger the distance gets bigger
needs better approach | ruby-x_rubyx | train | rb |
dcc29cd07ebedd375cef6500e24740673d71e2dc | diff --git a/log.go b/log.go
index <HASH>..<HASH> 100644
--- a/log.go
+++ b/log.go
@@ -48,6 +48,7 @@ func (tf *TextFormatter) Format(e *log.Entry) ([]byte, error) {
if frameNo := findFrame(); frameNo != -1 {
t := newTrace(frameNo, nil)
new := e.WithFields(log.Fields{FileField: t.Loc(), FunctionField: t.FuncName()})
+ new.Time = e.Time
new.Level = e.Level
new.Message = e.Message
e = new | When copying an logrus.Entry, transfer the timestamp as well | gravitational_trace | train | go |
8daf8d87f26825bf260e832917bac64114b680a7 | diff --git a/admin/tool/log/store/legacy/db/tasks.php b/admin/tool/log/store/legacy/db/tasks.php
index <HASH>..<HASH> 100644
--- a/admin/tool/log/store/legacy/db/tasks.php
+++ b/admin/tool/log/store/legacy/db/tasks.php
@@ -28,7 +28,7 @@ $tasks = array(
array(
'classname' => '\logstore_legacy\task\cleanup_task',
'blocking' => 0,
- 'minute' => '*',
+ 'minute' => 'R',
'hour' => '5',
'day' => '*',
'dayofweek' => '*',
diff --git a/admin/tool/log/store/standard/db/tasks.php b/admin/tool/log/store/standard/db/tasks.php
index <HASH>..<HASH> 100644
--- a/admin/tool/log/store/standard/db/tasks.php
+++ b/admin/tool/log/store/standard/db/tasks.php
@@ -28,7 +28,7 @@ $tasks = array(
array(
'classname' => '\logstore_standard\task\cleanup_task',
'blocking' => 0,
- 'minute' => '*',
+ 'minute' => 'R',
'hour' => '4',
'day' => '*',
'dayofweek' => '*', | MDL-<I> tasks: Specific minute values for log cleanup | moodle_moodle | train | php,php |
e028c4892a43b03070c757c3d48b44be1003ca68 | diff --git a/galpy/potential.py b/galpy/potential.py
index <HASH>..<HASH> 100644
--- a/galpy/potential.py
+++ b/galpy/potential.py
@@ -17,6 +17,7 @@ from galpy.potential_src import TransientLogSpiralPotential
from galpy.potential_src import MovingObjectPotential
from galpy.potential_src import ForceSoftening
from galpy.potential_src import EllipticalDiskPotential
+from galpy.potential_src import CosmphiDiskPotential
#
# Functions
#
@@ -67,6 +68,8 @@ SteadyLogSpiralPotential= SteadyLogSpiralPotential.SteadyLogSpiralPotential
TransientLogSpiralPotential= TransientLogSpiralPotential.TransientLogSpiralPotential
MovingObjectPotential= MovingObjectPotential.MovingObjectPotential
EllipticalDiskPotential= EllipticalDiskPotential.EllipticalDiskPotential
+LopsidedDiskPotential= CosmphiDiskPotential.LopsidedDiskPotential
+CosmphiDiskPotential= CosmphiDiskPotential.CosmphiDiskPotential
#Softenings
PlummerSoftening= ForceSoftening.PlummerSoftening | add new potentials to top-level | jobovy_galpy | train | py |
458f2eb39c3cdbbbeb060d88c48acc987e569f74 | diff --git a/index.js b/index.js
index <HASH>..<HASH> 100644
--- a/index.js
+++ b/index.js
@@ -96,6 +96,7 @@ var deprecatedTargets = [
]
var futureTargets = [
+ {runtime: 'electron', target: '5.0.0-beta.0', abi: '68', lts: false}
]
var allTargets = deprecatedTargets | feat: add support for Electron <I> | lgeiger_node-abi | train | js |
31c13ff8fe97dc2e8c9459544ffa87af41673456 | diff --git a/keepkeylib/client.py b/keepkeylib/client.py
index <HASH>..<HASH> 100644
--- a/keepkeylib/client.py
+++ b/keepkeylib/client.py
@@ -362,7 +362,7 @@ class DebugLinkMixin(object):
self.passphrase = normalize_nfc(passphrase)
def set_mnemonic(self, mnemonic):
- self.mnemonic = normalize_nfc(mnemonic)
+ self.mnemonic = unicode(str(bytearray(Mnemonic.normalize_string(mnemonic), 'utf-8')), 'utf-8').split(' ')
def call_raw(self, msg): | reverted to old method for mnemonic setting | keepkey_python-keepkey | train | py |
498ba7c4918d940ce38c9a71f69ba4707e5b7141 | diff --git a/Lib/Embera/Providers/Ted.php b/Lib/Embera/Providers/Ted.php
index <HASH>..<HASH> 100755
--- a/Lib/Embera/Providers/Ted.php
+++ b/Lib/Embera/Providers/Ted.php
@@ -24,7 +24,7 @@ class Ted extends \Embera\Adapters\Service
/** inline {@inheritdoc} */
protected function validateUrl()
{
- return (preg_match('~ted\.com/talks/(?:.*)\.html$~i', $this->url));
+ return (preg_match('~ted\.com/talks/(?:\S*)$~i', $this->url));
}
/** inline {@inheritdoc} */
@@ -39,5 +39,3 @@ class Ted extends \Embera\Adapters\Service
);
}
}
-
-?> | Adjust for TED urls without html suffix | mpratt_Embera | train | php |
2d6b59c458641f1fea15c53c1f590552a756f650 | diff --git a/tests/test_01_marker.py b/tests/test_01_marker.py
index <HASH>..<HASH> 100644
--- a/tests/test_01_marker.py
+++ b/tests/test_01_marker.py
@@ -4,6 +4,13 @@
import pytest
+def test_marker_registered(ctestdir):
+ result = ctestdir.runpytest("--markers")
+ result.stdout.fnmatch_lines("""
+ @pytest.mark.dependency*
+ """)
+
+
def test_marker(ctestdir):
ctestdir.makepyfile("""
import pytest | Add a test for Issue #5. | RKrahl_pytest-dependency | train | py |
74f7cc5d2829df1cfee482b968cc39b70844ce86 | diff --git a/component/all/workload.go b/component/all/workload.go
index <HASH>..<HASH> 100644
--- a/component/all/workload.go
+++ b/component/all/workload.go
@@ -170,7 +170,7 @@ func (c workloads) registerUnitWorkers() *workers.EventHandlers {
}
newManifold := func(unit.ManifoldsConfig) (dependency.Manifold, error) {
- // At this point no workload process workers are running for the unit.
+ // At this point no workload workers are running for the unit.
apiConfig := util.ApiManifoldConfig{
APICallerName: unit.APICallerName,
} | Drop a lingering "process" in a doc comment. | juju_juju | train | go |
324cf604394d84f433915ebc59e0ee68dd9553f7 | diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -55,7 +55,8 @@ if sys.version_info >= (3, 5) or not os.path.isdir(mod_src_dir):
mod_src_dir = os.path.join('src', 'swig-gp' + gphoto2_version +
'-py' + str(sys.version_info[0]))
extra_compile_args = [
- '-O3', '-Wno-unused-variable', '-Wno-strict-prototypes', '-Werror']
+ '-O3', '-Wno-unused-variable', '-Wno-strict-prototypes', '-Werror',
+ '-DGPHOTO2_' + gphoto2_version.replace('.', '')]
libraries = [x.replace('-l', '') for x in gphoto2_libs]
library_dirs = [x.replace('-L', '') for x in gphoto2_lib_dirs]
include_dirs = [x.replace('-I', '') for x in gphoto2_include] | Reinstate -DGPHOTO2_2x option when compiling
Recent changes to gphoto2/port_log.i mean it's needed again. | jim-easterbrook_python-gphoto2 | train | py |
c730aa13f550dce3f7ca62911ddd711c721ca656 | diff --git a/lib/carrierwave/vips.rb b/lib/carrierwave/vips.rb
index <HASH>..<HASH> 100644
--- a/lib/carrierwave/vips.rb
+++ b/lib/carrierwave/vips.rb
@@ -190,7 +190,7 @@ module CarrierWave
def process!(*)
ret = super
if @_vimage
- tmp_name = current_path.sub(/(\.[a-z]+)$/i, '_tmp\1')
+ tmp_name = current_path.sub(/(\.[[:alnum:]]+)$/i, '_tmp\1')
writer = writer_class.send(:new, @_vimage, @_format_opts)
if @_strip
writer.remove_exif | Added supported for image files that contain alphanumerica extensiosn (3FR). When writing a new file in process<bang>, a temp file is created. Previously, this temp file was created by inserting _tmp between the file basename and the extension. The regular expression didn't account for extensions with numeric values. Now it does (I use [[::alnum::]]) | eltiare_carrierwave-vips | train | rb |
39cec22ec730c4284b67c384e1dab8e69bd611c7 | diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -67,10 +67,10 @@ if __name__ == "__main__":
'Programming Language :: Python',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
- 'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
+ 'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: Implementation :: CPython',
'Topic :: Scientific/Engineering :: Physics',
'Topic :: Utilities', | python versions
Removed support for <I> and added support for <I>. | aburrell_apexpy | train | py |
be7b618d99b4bfb4227f1cedf3324b6eebdd312d | diff --git a/salt/modules/cmdmod.py b/salt/modules/cmdmod.py
index <HASH>..<HASH> 100644
--- a/salt/modules/cmdmod.py
+++ b/salt/modules/cmdmod.py
@@ -686,18 +686,12 @@ def _run(
if success_stdout is None:
success_stdout = []
else:
- try:
- success_stdout = [i for i in salt.utils.args.split_input(success_stdout)]
- except ValueError:
- raise SaltInvocationError("success_stdout must be a list of integers")
+ success_stdout = salt.utils.args.split_input(success_stdout)
if success_stderr is None:
success_stderr = []
else:
- try:
- success_stderr = [i for i in salt.utils.args.split_input(success_stderr)]
- except ValueError:
- raise SaltInvocationError("success_stderr must be a list of integers")
+ success_stderr = salt.utils.args.split_input(success_stderr)
if not use_vt:
# This is where the magic happens | Simplifies assignment of success_stdout and success_stderr | saltstack_salt | train | py |
bf9ed8c659783b5e3a2a91da35f94a02f26e2d45 | diff --git a/linkcheck/checker/httpurl.py b/linkcheck/checker/httpurl.py
index <HASH>..<HASH> 100644
--- a/linkcheck/checker/httpurl.py
+++ b/linkcheck/checker/httpurl.py
@@ -580,7 +580,10 @@ Use URL `%(newurl)s' instead for checking.""") % {
{"err": str(msg)},
tag=WARN_HTTP_DECOMPRESS_ERROR)
f = StringIO(data)
- data = f.read()
+ try:
+ data = f.read()
+ finally:
+ f.close()
# store temporary data
self._data = data | Make sure file descriptors are closed after decoding HTTP content. | wummel_linkchecker | train | py |
8603472b4e1e5ae72f3b09553763f46646250ca5 | diff --git a/lib/microspec/runner.rb b/lib/microspec/runner.rb
index <HASH>..<HASH> 100644
--- a/lib/microspec/runner.rb
+++ b/lib/microspec/runner.rb
@@ -25,7 +25,7 @@ module Microspec
filenames.each do |filename|
scope = Scope.new filename do
- eval File.read(filename), nil, filename
+ instance_eval File.read(filename), filename
end
scope.perform | Evaluate on the given scope context instead of the current module context | Erol_microspec | train | rb |
5ac45643fde3208396fedcde336cf078d95da4b6 | diff --git a/doc/conf.py b/doc/conf.py
index <HASH>..<HASH> 100644
--- a/doc/conf.py
+++ b/doc/conf.py
@@ -19,12 +19,13 @@ autodoc_default_options = {
extensions.append('sphinx.ext.intersphinx')
intersphinx_mapping = {
+ 'python': ('https://docs.python.org/3', None),
+ 'numpy': ('https://numpy.org/doc/stable', None),
+ 'scipy': ('https://docs.scipy.org/doc/scipy/reference', None),
+ 'matplotlib': ('https://matplotlib.org', None),
'pyunlocbox': ('https://pyunlocbox.readthedocs.io/en/stable', None),
'networkx': ('https://networkx.github.io/documentation/stable', None),
'graph_tool': ('https://graph-tool.skewed.de/static/doc', None),
- 'numpy': ('https://docs.scipy.org/doc/numpy', None),
- 'scipy': ('https://docs.scipy.org/doc/scipy/reference', None),
- 'matplotlib': ('https://matplotlib.org', None),
}
extensions.append('numpydoc') | doc: update intersphinx inventories (add python, numpy has moved) | epfl-lts2_pygsp | train | py |
Subsets and Splits