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 |
|---|---|---|---|---|---|
5a91dce0441b70fbb6f0541a127993bdd2f844b1 | diff --git a/lib/sinatra/base.rb b/lib/sinatra/base.rb
index <HASH>..<HASH> 100644
--- a/lib/sinatra/base.rb
+++ b/lib/sinatra/base.rb
@@ -421,7 +421,7 @@ module Sinatra
Time.parse value.to_s
end
rescue ArgumentError => boom
- raise boom.to_s
+ raise boom
rescue Exception
raise ArgumentError, "unable to convert #{value.inspect} to a Time object"
end
diff --git a/test/helpers_test.rb b/test/helpers_test.rb
index <HASH>..<HASH> 100644
--- a/test/helpers_test.rb
+++ b/test/helpers_test.rb
@@ -679,7 +679,7 @@ class HelpersTest < Test::Unit::TestCase
end
it 'fails when Time.parse raises an ArgumentError' do
- assert_raise(RuntimeError) { get '/boom' }
+ assert_raise(ArgumentError) { get '/boom' }
end
end | make time_for always raise an ArgumentError if something goes wrong | sinatra_sinatra | train | rb,rb |
2fae9b655e9c5c7271cee74b869511858a42a9b5 | diff --git a/src/ocrmypdf/exec/__init__.py b/src/ocrmypdf/exec/__init__.py
index <HASH>..<HASH> 100644
--- a/src/ocrmypdf/exec/__init__.py
+++ b/src/ocrmypdf/exec/__init__.py
@@ -278,7 +278,6 @@ def check_external_program(
need_version,
required_for=None,
recommended=False,
- **kwargs, # To consume log parameter
):
try:
found_version = version_checker() | Remove **kwargs from check_external_program; deprecated | jbarlow83_OCRmyPDF | train | py |
6127069ac64a078c31f5805475077cc7cf49d5de | diff --git a/src/YouTube.js b/src/YouTube.js
index <HASH>..<HASH> 100644
--- a/src/YouTube.js
+++ b/src/YouTube.js
@@ -136,9 +136,6 @@ class YouTube extends React.Component {
updateVideo() {
// strip youtube video id from url
const videoId = getYouTubeId(this.props.url, {fuzzy: false});
- if (videoId === null) {
- throw new Error("React-YouTube: Url doesn't contain a youtube video id.");
- }
// if autoplay is enabled loadVideoById
if (this.props.opts.playerVars !== undefined && this.props.opts.playerVars.autoplay === 1) {
this._internalPlayer.loadVideoById(videoId); | Removed check for `videoId` after `getYouTubeId()` | troybetz_react-youtube | train | js |
895dede631779905e55181d0c5d556a8d2c944af | diff --git a/test/test_conditions_process_running.rb b/test/test_conditions_process_running.rb
index <HASH>..<HASH> 100644
--- a/test/test_conditions_process_running.rb
+++ b/test/test_conditions_process_running.rb
@@ -6,7 +6,7 @@ class TestConditionsProcessRunning < Test::Unit::TestCase
c = Conditions::ProcessRunning.new
c.running = r
- c.stubs(:watch).returns(stub(:pid => 123, :name => 'foo'))
+ c.stubs(:watch).returns(stub(:pid => 99999999, :name => 'foo'))
# no_stdout do
assert_equal !r, c.test | bump up the pid to avoid false failures (I had a real process running with a pid of <I>) | mojombo_god | train | rb |
589a98f7b75984fbd6cb659eee8778569d65ee31 | diff --git a/src/SwipeableViews.js b/src/SwipeableViews.js
index <HASH>..<HASH> 100644
--- a/src/SwipeableViews.js
+++ b/src/SwipeableViews.js
@@ -87,12 +87,16 @@ function getDomTreeShapes(element, rootNode) {
const domTreeShapes = [];
while (element && element !== rootNode.firstChild) {
- domTreeShapes.push({
- element: element,
- scrollWidth: element.scrollWidth,
- clientWidth: element.clientWidth,
- scrollLeft: element.scrollLeft,
- });
+ // Ignore the nodes that have no width.
+ if (element.clientWidth > 0) {
+ domTreeShapes.push({
+ element: element,
+ scrollWidth: element.scrollWidth,
+ clientWidth: element.clientWidth,
+ scrollLeft: element.scrollLeft,
+ });
+ }
+
element = element.parentNode;
} | [browser] Ignore the nodes that have no width
E.g. You will get a conflict when working with react-virtualized | oliviertassinari_react-swipeable-views | train | js |
06b17f86085411ef7fc5232f2dbb8d3608b49e0d | diff --git a/spec/public/request/request_spec.rb b/spec/public/request/request_spec.rb
index <HASH>..<HASH> 100644
--- a/spec/public/request/request_spec.rb
+++ b/spec/public/request/request_spec.rb
@@ -67,7 +67,7 @@ describe Merb::Request, " query and body params" do
it "should support XML params" do
request = fake_request({:content_type => "application/xml"}, :req => %{<foo bar="baz"><baz/></foo>})
request.stub!(:route_params).and_return({})
- request.params.should == {"foo" => {"baz" => {}, "bar" => "baz"}}
+ request.params.should == {"foo" => {"baz" => nil, "bar" => "baz"}}
end
end | Updates the request spec to account for the new from_xml behaviour | wycats_merb | train | rb |
9035dfcb9381abe6ed0f41ca324e633b23bf0a0b | diff --git a/select2.js b/select2.js
index <HASH>..<HASH> 100644
--- a/select2.js
+++ b/select2.js
@@ -103,7 +103,9 @@ the specific language governing permissions and limitations under the Apache Lic
function indexOf(value, array) {
var i = 0, l = array.length;
- for (; i < l; i = i + 1) if (value === array[i]) return i;
+ for (; i < l; i = i + 1) {
+ if (equal(value, array[i])) return i;
+ }
return -1;
}
@@ -113,7 +115,12 @@ the specific language governing permissions and limitations under the Apache Lic
* @param b
*/
function equal(a, b) {
- return a===b;
+ if (a === b) return true;
+ if (a === undefined || b === undefined) return false;
+ if (a === null || b === null) return false;
+ if (a.constructor === String) return a === b+'';
+ if (b.constructor === String) return b === a+'';
+ return false;
}
/** | equal and indexof need to support comparing items of differnet types, ie string vs number. this is needed because numeric ids stored in val() are strings and need to be compared against data ids which are numbers. fixes #<I> | select2_select2 | train | js |
eb72717085365e1d765b0903334009a42e88a7d8 | diff --git a/robotium-solo/src/main/java/com/jayway/android/robotium/solo/Solo.java b/robotium-solo/src/main/java/com/jayway/android/robotium/solo/Solo.java
index <HASH>..<HASH> 100755
--- a/robotium-solo/src/main/java/com/jayway/android/robotium/solo/Solo.java
+++ b/robotium-solo/src/main/java/com/jayway/android/robotium/solo/Solo.java
@@ -1422,10 +1422,22 @@ public class Solo {
* @param id the R.id of the {@link View} to be returned
* @return a {@link View} with a given id
*/
-
+
public View getView(int id){
return getter.getView(id);
}
+
+ /**
+ * Returns a View of a given class and index.
+ *
+ * @param viewClass the class of the requested view
+ * @param index the index of the {@link View}. {@code 0} if only one is available
+ * @return a {@link View} with a given class and index
+ */
+
+ public <T extends View> View getView(Class<T> viewClass, int index){
+ return waiter.waitForAndGetView(index, viewClass);
+ }
/**
* Returns an ArrayList of the View objects currently shown in the focused | Added a new method getView(Class viewClass, int index) | RobotiumTech_robotium | train | java |
de6d3c70fce588ac7b6ce41e849ee5ed0f036571 | diff --git a/ontrack-web/src/app/dialog/dialog.project.labels.js b/ontrack-web/src/app/dialog/dialog.project.labels.js
index <HASH>..<HASH> 100644
--- a/ontrack-web/src/app/dialog/dialog.project.labels.js
+++ b/ontrack-web/src/app/dialog/dialog.project.labels.js
@@ -17,9 +17,12 @@ angular.module('ot.dialog.project.labels', [
// Label filter
$scope.filter = {text: ""};
$scope.labelFilterFn = function (label) {
- return labelFilterInternalFn(label.category) || labelFilterInternalFn(label.name);
+ return labelFilterUnselectedAutoFn(label) && (labelFilterTextFn(label.category) || labelFilterTextFn(label.name));
};
- function labelFilterInternalFn(text) {
+ function labelFilterUnselectedAutoFn(label) {
+ return label.computedBy == null || label.selected;
+ }
+ function labelFilterTextFn(text) {
return !$scope.filter.text || text.toLowerCase().indexOf($scope.filter.text.toLowerCase()) >= 0;
}
// Toggling the label selection | #<I> Unselected automated labels are not displayed in the edition dialog | nemerosa_ontrack | train | js |
46adfb48ba53c8663dc34644dc8e04686f7b83a3 | diff --git a/tests/test_unified_install_cache.py b/tests/test_unified_install_cache.py
index <HASH>..<HASH> 100644
--- a/tests/test_unified_install_cache.py
+++ b/tests/test_unified_install_cache.py
@@ -108,7 +108,7 @@ def test_issues_789_demo():
colorized_isort_pex_info.pex_root = ptex_cache
# Force the standard pex to extract its code. An external tool like Pants would already know the
- # orignal source code file paths, but we need to discover here.
+ # original source code file paths, but we need to discover here.
code_hash = colorized_isort_pex_info.code_hash
assert code_hash is not None
colorized_isort_pex_code_dir = os.path.join( | docs: fix simple typo, orignal -> original (#<I>)
There is a small typo in tests/test_unified_install_cache.py.
Should read `original` rather than `orignal`. | pantsbuild_pex | train | py |
fa089129d8931da19568cdbe625bf594efc20dde | diff --git a/rkt/status.go b/rkt/status.go
index <HASH>..<HASH> 100644
--- a/rkt/status.go
+++ b/rkt/status.go
@@ -212,7 +212,7 @@ func printStatus(p *pkgPod.Pod) error {
stdout.Printf("started=%s", startedStr)
}
- if state == pkgPod.Running {
+ if state == pkgPod.Running || state == pkgPod.Exited {
stdout.Printf("networks=%s", fmtNets(p.Nets))
} | status: add ip of the non running pod
This will be useful for testing the list command to check the ip
of the non running pod | rkt_rkt | train | go |
fa1982323a9aaf593e52c75a88ba48cbb11bf598 | diff --git a/plugins/inputs/statsd/statsd.go b/plugins/inputs/statsd/statsd.go
index <HASH>..<HASH> 100644
--- a/plugins/inputs/statsd/statsd.go
+++ b/plugins/inputs/statsd/statsd.go
@@ -251,14 +251,14 @@ func (s *Statsd) Gather(acc telegraf.Accumulator) error {
}
for _, metric := range s.gauges {
- acc.AddFields(metric.name, metric.fields, metric.tags, now)
+ acc.AddGauge(metric.name, metric.fields, metric.tags, now)
}
if s.DeleteGauges {
s.gauges = make(map[string]cachedgauge)
}
for _, metric := range s.counters {
- acc.AddFields(metric.name, metric.fields, metric.tags, now)
+ acc.AddCounter(metric.name, metric.fields, metric.tags, now)
}
if s.DeleteCounters {
s.counters = make(map[string]cachedcounter) | Fix counter and gauge metric types. (#<I>) | influxdata_telegraf | train | go |
1bf658d72c206956ac0fa10e56f5cb0fd186cdff | diff --git a/src/module-elasticsuite-catalog/Model/Product/Indexer/Fulltext/Datasource/AttributeData.php b/src/module-elasticsuite-catalog/Model/Product/Indexer/Fulltext/Datasource/AttributeData.php
index <HASH>..<HASH> 100644
--- a/src/module-elasticsuite-catalog/Model/Product/Indexer/Fulltext/Datasource/AttributeData.php
+++ b/src/module-elasticsuite-catalog/Model/Product/Indexer/Fulltext/Datasource/AttributeData.php
@@ -162,11 +162,11 @@ class AttributeData extends AbstractAttributeData implements DatasourceInterface
$relation['configurable_attributes']
);
- $parentData['configurable_attributes'] = array_unique(
- array_merge($configurableAttributesCodes, $parentData['configurable_attributes'])
+ $parentData['configurable_attributes'] = array_values(
+ array_unique(array_merge($configurableAttributesCodes, $parentData['configurable_attributes']))
);
}
- $parentData['children_attributes'] = array_unique($childrenAttributes);
+ $parentData['children_attributes'] = array_values(array_unique($childrenAttributes));
}
} | Fix #<I> : Indexing children attributes of bundle products. | Smile-SA_elasticsuite | train | php |
2fb70d8088bfe053963a11a4c6574d4236f1da12 | diff --git a/text_frame.go b/text_frame.go
index <HASH>..<HASH> 100644
--- a/text_frame.go
+++ b/text_frame.go
@@ -5,9 +5,7 @@
package id3v2
import (
- "bufio"
"io"
- "io/ioutil"
"github.com/bogem/id3v2/bytesbufferpool"
"github.com/bogem/id3v2/util"
@@ -39,14 +37,14 @@ func (tf TextFrame) Body() []byte {
}
func ParseTextFrame(rd io.Reader) (Framer, error) {
- bufRd := bufio.NewReader(rd)
+ bufRd := util.NewReader(rd)
encoding, err := bufRd.ReadByte()
if err != nil {
return nil, err
}
- text, err := ioutil.ReadAll(bufRd)
+ text, err := bufRd.ReadAll()
if err != nil {
return nil, err
} | Update buf reader in text framer | bogem_id3v2 | train | go |
a87aa729cd065af68f5aacb15ec000ff2a93c9ab | diff --git a/great_expectations/data_context/data_context.py b/great_expectations/data_context/data_context.py
index <HASH>..<HASH> 100644
--- a/great_expectations/data_context/data_context.py
+++ b/great_expectations/data_context/data_context.py
@@ -941,12 +941,15 @@ class BaseDataContext(object):
Returns:
True for Success and False for Failure.
"""
+ """
key = None
keys = self.stores[self.expectations_store_name].list_keys()
for item in keys:
sval = repr(item)
if expectation_suite_name.expectation_suite_name in sval:
key=item
+ """
+ key = ExpectationSuiteIdentifier(expectation_suite_name)
if not self._stores[self.expectations_store_name].has_key(key):
raise ge_exceptions.DataContextError(
"expectation_suite with name {} does not exist." | ayirpmissing cannot reproduce split bug | great-expectations_great_expectations | train | py |
56d8d9c803c443d906ce84649f1a07f9477e49ca | diff --git a/docs/conf.py b/docs/conf.py
index <HASH>..<HASH> 100755
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -62,9 +62,9 @@ author = 'Isaak Uchakaev (Likid Geimfari)'
# built documents.
#
# The short X.Y version.
-version = '3.3.0'
+version = '4.0.0'
# The full version, including alpha/beta/rc tags.
-release = '3.3.0'
+release = '4.0.0'
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages. | Update sphinx docs conf.py | lk-geimfari_mimesis | train | py |
7a8c06d2ea2c60f2b99100088b6122f7b42a9987 | diff --git a/quasar/src/components/layout/QDrawer.js b/quasar/src/components/layout/QDrawer.js
index <HASH>..<HASH> 100644
--- a/quasar/src/components/layout/QDrawer.js
+++ b/quasar/src/components/layout/QDrawer.js
@@ -70,7 +70,11 @@ export default Vue.extend({
: false
if (this.value !== void 0 && this.value !== showing) {
- this.$emit('input', showing)
+ // setTimeout needed otherwise
+ // it breaks Vue state
+ setTimeout(() => {
+ this.$emit('input', showing)
+ })
}
return { | fix(QDrawer): breaking Vue state if initial model is initially true but component immediately emits false #<I> | quasarframework_quasar | train | js |
465ae81394b54eb37e597b15f7286826bd070306 | diff --git a/telemetry/telemetry/page/page_runner.py b/telemetry/telemetry/page/page_runner.py
index <HASH>..<HASH> 100644
--- a/telemetry/telemetry/page/page_runner.py
+++ b/telemetry/telemetry/page/page_runner.py
@@ -296,6 +296,7 @@ def _PrepareAndRunPage(test, page_set, expectations, finder_options,
logging.warning(str(e))
+@decorators.Cache
def _UpdatePageSetArchivesIfChanged(page_set):
# Attempt to download the credentials file.
if page_set.credentials_path: | [Telemetry] Only call _UpdatePageSetArchivesIfChanged once per PageSet.
This saves about 5s on my MBP. Hard to say what the savings'll be on the bots.
This might also help reliability.
BUG=<I>
Review URL: <URL> | catapult-project_catapult | train | py |
6b493a43232248a656b724067ab1a961abfbfe52 | diff --git a/consolor/consolor.py b/consolor/consolor.py
index <HASH>..<HASH> 100644
--- a/consolor/consolor.py
+++ b/consolor/consolor.py
@@ -69,7 +69,7 @@ def get_line(s, bold=False, underline=False, blinking=False, color=None,
if update_line:
parts.append(_UPDATE_LINE)
- for val in [bgcolor, color]:
+ for val in [color, bgcolor]:
if val:
parts.append(val) | Enable usage of foreground and background color at the same time | paetzke_consolor | train | py |
1485bbe552649150cf2a62eadb9688f51dc5b366 | diff --git a/ghost/admin/mirage/config.js b/ghost/admin/mirage/config.js
index <HASH>..<HASH> 100644
--- a/ghost/admin/mirage/config.js
+++ b/ghost/admin/mirage/config.js
@@ -33,7 +33,7 @@ export default function () {
// this.put('/posts/:id/', versionMismatchResponse);
// mockTags(this);
// this.loadFixtures('settings');
- mockMembers(this);
+ //mockMembers(this);
// keep this line, it allows all other API requests to hit the real server
this.passthrough(); | Removed mock members API config
no issue | TryGhost_Ghost | train | js |
9cdf069f13644a9a992d56b516e442cfd8e7ba2b | diff --git a/go/stellar/transform.go b/go/stellar/transform.go
index <HASH>..<HASH> 100644
--- a/go/stellar/transform.go
+++ b/go/stellar/transform.go
@@ -318,7 +318,13 @@ func transformPaymentRelay(mctx libkb.MetaContext, acctID stellar1.AccountID, p
loc.ToType = stellar1.ParticipantType_STELLAR
loc.ToUsername = ""
loc.ToAccountName = ""
- if p.Claim.ToPaymentStatus() == stellar1.PaymentStatus_CANCELED {
+ claimStatus := p.Claim.ToPaymentStatus()
+ if claimStatus != stellar1.PaymentStatus_ERROR {
+ // if there's a claim and it's not currently erroring, then hide the
+ // `cancel` button
+ loc.ShowCancel = false
+ }
+ if claimStatus == stellar1.PaymentStatus_CANCELED {
// canceled payment. blank out toAssertion and stow in originalToAssertion
// set delta to what it would have been had the payment completed
loc.ToAssertion = ""
@@ -334,7 +340,6 @@ func transformPaymentRelay(mctx libkb.MetaContext, acctID stellar1.AccountID, p
}
if p.Claim.TxStatus == stellar1.TransactionStatus_SUCCESS {
// If the claim succeeded, the relay payment is done.
- loc.ShowCancel = false
loc.StatusDetail = ""
} else {
claimantUsername, err := lookupUsername(mctx, p.Claim.To.Uid) | quick fix: more aggressively hide the cancel button (#<I>)
* quick fix: more aggressively hide the cancel button
* fix error case | keybase_client | train | go |
380d84cc96f582442a8a6365fbb21d1fe49c5ca5 | diff --git a/src/Pingpong/Twitter/Twitter.php b/src/Pingpong/Twitter/Twitter.php
index <HASH>..<HASH> 100644
--- a/src/Pingpong/Twitter/Twitter.php
+++ b/src/Pingpong/Twitter/Twitter.php
@@ -329,6 +329,7 @@ class Twitter
$this->forgetOAuthToken()
->storeNewSession($request)
->setOAuthToken()
+ ->setResponse($request);
;
return 200; | Set the response in getCallback, in order to be able to get user_id and screen_name | pingpong-labs_twitter | train | php |
c5142404c1cb3eaa10906fb54c53c113f3bb8b87 | diff --git a/goad.go b/goad.go
index <HASH>..<HASH> 100644
--- a/goad.go
+++ b/goad.go
@@ -159,7 +159,11 @@ func numberOfLambdas(concurrency uint, numRegions int) int {
if numRegions > int(concurrency) {
return int(concurrency)
}
- if concurrency/10 > 100 {
+ if concurrency/200 > 350 { // > 70.000
+ return 500
+ } else if concurrency/100 > 100 { // 10.000 <> 70.000
+ return 300
+ } else if concurrency/10 > 100 { // 1.000 <> 10.000
return 100
}
if int(concurrency) < 10*numRegions {
@@ -181,8 +185,8 @@ func (c TestConfig) check() error {
if c.Concurrency < 1 || c.Concurrency > concurrencyLimit {
return fmt.Errorf("Invalid concurrency (use 1 - %d)", concurrencyLimit)
}
- if c.TotalRequests < 1 || c.TotalRequests > 1000000 {
- return errors.New("Invalid total requests (use 1 - 1000000)")
+ if c.TotalRequests < 1 || c.TotalRequests > 2000000 {
+ return errors.New("Invalid total requests (use 1 - 2000000)")
}
if c.RequestTimeout.Nanoseconds() < nano || c.RequestTimeout.Nanoseconds() > nano*100 {
return errors.New("Invalid timeout (1s - 100s)") | Increase limits and number of instances (#<I>)
Increase limits and number of instances for better stability on high concurrency loads | goadapp_goad | train | go |
1c8d55cbcc0da4082ed74eaa841dead7480d67d8 | diff --git a/python/src/mapreduce/context.py b/python/src/mapreduce/context.py
index <HASH>..<HASH> 100755
--- a/python/src/mapreduce/context.py
+++ b/python/src/mapreduce/context.py
@@ -218,6 +218,10 @@ class Context(object):
# TODO(user): These properties can stay public.
self.mutation_pool = MutationPool()
self.counters = Counters(shard_state)
+ if self.mapreduce_spec:
+ self.mapreduce_id = self.mapreduce_spec.mapreduce_id
+ else:
+ self.mapreduce_id = None
self._pools = {}
self.register_pool("mutation_pool", self.mutation_pool) | Exposing mapreduce_id in context object. | GoogleCloudPlatform_appengine-mapreduce | train | py |
f74c5df97b936dc5fb639bfa4674a5ee0b6acb71 | diff --git a/app/Bus/Commands/Component/UpdateComponentCommand.php b/app/Bus/Commands/Component/UpdateComponentCommand.php
index <HASH>..<HASH> 100644
--- a/app/Bus/Commands/Component/UpdateComponentCommand.php
+++ b/app/Bus/Commands/Component/UpdateComponentCommand.php
@@ -123,7 +123,7 @@ final class UpdateComponentCommand
$this->component = $component;
$this->name = $name;
$this->description = $description;
- $this->status = $status;
+ $this->status = (int) $status;
$this->link = $link;
$this->order = $order;
$this->group_id = $group_id; | Cast status to int on update component command | CachetHQ_Cachet | train | php |
eb90d6e941b3f6a5dc3de994fe8642390b86a838 | diff --git a/aegea/ssh.py b/aegea/ssh.py
index <HASH>..<HASH> 100644
--- a/aegea/ssh.py
+++ b/aegea/ssh.py
@@ -77,7 +77,7 @@ def resolve_instance_public_dns(name):
def get_user_info():
res = clients.sts.get_caller_identity()
- iam_username = ARN(res["Arn"]).resource.split("/")[-1]
+ iam_username = ARN(res["Arn"]).resource.split("/")[1]
linux_username, at, domain = iam_username.partition("@")
iam_user_id = res["UserId"]
iam_user_id, colon, session = iam_user_id.partition(":") | Use correct ARN resource element for principal name | kislyuk_aegea | train | py |
117e7a0f8bfcda9c6d214ec129d9a588e67e16a5 | diff --git a/plugins/products/bosh-init/aws.go b/plugins/products/bosh-init/aws.go
index <HASH>..<HASH> 100644
--- a/plugins/products/bosh-init/aws.go
+++ b/plugins/products/bosh-init/aws.go
@@ -86,7 +86,7 @@ func (s *AWSBosh) resourcePoolCloudProperties() interface{} {
return awscloudproperties.ResourcePool{
InstanceType: s.cfg.AWSInstanceSize,
EphemeralDisk: awscloudproperties.EphemeralDisk{
- Size: s.boshbase.PersistentDiskSize,
+ Size: 32768,
DiskType: "gp2",
},
AvailabilityZone: s.cfg.AWSAvailabilityZone, | [#<I>] update ephemeral disk size to not be the same as persistent disk size <I> | enaml-ops_omg-cli | train | go |
a19667d65345a47f763a5aa0ff00fe0fc7a7e674 | diff --git a/test/unit/test_clique.py b/test/unit/test_clique.py
index <HASH>..<HASH> 100644
--- a/test/unit/test_clique.py
+++ b/test/unit/test_clique.py
@@ -178,6 +178,8 @@ def test_assemble_remainder_has_no_duplicates():
@pytest.mark.parametrize(('value', 'pattern', 'expected'), [
+ ('/path/to/file.%04d.ext []', None,
+ clique.Collection('/path/to/file.', '.ext', 4, [])),
('/path/to/file.%04d.ext [1-3, 5, 7-8]', None,
clique.Collection('/path/to/file.', '.ext', 4, [1, 2, 3, 5, 7, 8])),
('/path/to/file.%d.ext [1-3, 5, 7-8]', None,
@@ -189,6 +191,7 @@ def test_assemble_remainder_has_no_duplicates():
'{head}{padding}{tail} {range} [{holes}]',
clique.Collection('/path/to/file.', '.ext', 0, [1, 3, 7, 8]))
], ids=[
+ 'empty',
'padded',
'unpadded',
'custom range pattern', | [#<I>] Add unit test for failing case - parse empty collection string. | 4degrees_clique | train | py |
b430aec1b38f735c6a64acf3814e5f5a8d39bf77 | diff --git a/src/toil/test/src/dockerCheckTest.py b/src/toil/test/src/dockerCheckTest.py
index <HASH>..<HASH> 100644
--- a/src/toil/test/src/dockerCheckTest.py
+++ b/src/toil/test/src/dockerCheckTest.py
@@ -18,7 +18,7 @@ from toil import checkDockerImageExists, parseDockerAppliance
from docker.errors import ImageNotFound
# requires internet
-# @needs_appliance
+@needs_appliance
class dockerCheckTests(ToilTest):
"""
Tests initial checking of whether a docker image exists in the specified repository or not. | Forgot to uncomment @needs_appliance. | DataBiosphere_toil | train | py |
bf98754afe6142c3d9e2fd74cf83fea9c4a9cb30 | diff --git a/src/Syntax/Where.php b/src/Syntax/Where.php
index <HASH>..<HASH> 100644
--- a/src/Syntax/Where.php
+++ b/src/Syntax/Where.php
@@ -356,7 +356,7 @@ class Where
}
/**
- * @param array $columns
+ * @param string[] $columns
* @param mixed[] $values
* @param string $mode
* | Scrutinizer Auto-Fixes
This commit consists of patches automatically generated for this project on <URL> | nilportugues_php-sql-query-builder | train | php |
ed56a245b38e4d2a9de0a51b017babd259c2bd48 | diff --git a/lib/poolparty/cloud.rb b/lib/poolparty/cloud.rb
index <HASH>..<HASH> 100644
--- a/lib/poolparty/cloud.rb
+++ b/lib/poolparty/cloud.rb
@@ -61,7 +61,7 @@ module PoolParty
end
# Cloud provider methods
- def nodes(o={}); delayed_action {cloud_provider.nodes(o)}; end
+ def nodes(o={}); delayed_action {cloud_provider.nodes(o).collect{|n| n.cloud = self; n}}; end
def run_instance(o={}); cloud_provider.run_instance(o);end
def terminate_instance!(o={}); cloud_provider.terminate_instance!(o);end
def describe_instances(o={}); cloud_provider.describe_instances(o);end | updated cloud to set itself as the nodes cloud | auser_poolparty | train | rb |
2b241b30c3f2e3549e4c886aada47187684cd9c2 | diff --git a/src/driver/BasePhantomJSDriver.php b/src/driver/BasePhantomJSDriver.php
index <HASH>..<HASH> 100644
--- a/src/driver/BasePhantomJSDriver.php
+++ b/src/driver/BasePhantomJSDriver.php
@@ -30,7 +30,6 @@ class BasePhantomJSDriver extends CoreDriver {
* @param string $templateCache where we are going to store the templates cache
*/
public function __construct($phantomHost, $templateCache = null) {
- \Twig_Autoloader::register();
$this->phantomHost = $phantomHost;
$this->browser = new Browser($phantomHost);
$this->templateLoader = new \Twig_Loader_Filesystem(realpath(__DIR__ . '/Resources/Script')); | Remove usage of the deprecated Twig_Autoloader
Twig is already autoloaded by composer anyway. | jcalderonzumba_MinkPhantomJSDriver | train | php |
47d66d03b6c9fcc3feae337dc3ae86c42bb364b3 | diff --git a/api/sendpulse.php b/api/sendpulse.php
index <HASH>..<HASH> 100755
--- a/api/sendpulse.php
+++ b/api/sendpulse.php
@@ -1032,4 +1032,15 @@ class SendpulseApi implements SendpulseApi_Interface {
return $this->handleResult($requestResult);
}
+
+ /**
+ * Get stats for push campaign
+ *
+ * @return mixed
+ */
+ public function getPushCampaignStat( $campainId ) {
+ $requestResult = $this->sendRequest( 'push/tasks/'.$campainId, 'GET' );
+
+ return $this->handleResult( $requestResult );
+ }
} | get status for push campaing (issue from user yoyoy) | sendpulse_sendpulse-rest-api-php | train | php |
71418605d558e1cd9031d15177bf64821c47367f | diff --git a/spec/support/dummy_view.rb b/spec/support/dummy_view.rb
index <HASH>..<HASH> 100644
--- a/spec/support/dummy_view.rb
+++ b/spec/support/dummy_view.rb
@@ -3,7 +3,7 @@ require 'action_view'
class DummyView < ActionView::Base
module FakeRequest
class Request
- attr_accessor :path, :fullpath
+ attr_accessor :path, :fullpath, :protocol, :host_with_port
def get?
true
end
@@ -30,6 +30,10 @@ class DummyView < ActionView::Base
get "/post/:id" => "foo#post", :as => :post
get "/post/:title" => "foo#title"
get "/post/:id/comments" => "foo#comments"
+
+ namespace :blog do
+ get "/" => "foo#bar"
+ end
end
include routes.url_helpers
@@ -37,5 +41,7 @@ class DummyView < ActionView::Base
def set_path(path)
request.path = path
request.fullpath = path
+ request.protocol = 'http://'
+ request.host_with_port = 'www.example.com'
end
end | Add protocol and host for dummy request | piotrmurach_loaf | train | rb |
b943267ea5c90f4a415a98f96e9a803a36022d56 | diff --git a/alot/commands/globals.py b/alot/commands/globals.py
index <HASH>..<HASH> 100644
--- a/alot/commands/globals.py
+++ b/alot/commands/globals.py
@@ -255,7 +255,7 @@ class ExternalCommand(Command):
def afterwards(data):
if data == 'success':
- if callable(self.on_success):
+ if self.on_success is not None:
self.on_success()
else:
ui.notify(data, priority='error') | command/globals: Test for not None rather than callable
If someone passes us something other than None or a callable they're
abusing the API. Instead, use is not None, and let the code except if
something else is passed. | pazz_alot | train | py |
f630e6df4b112ceb1da0b65b25d79094e7abd7ca | diff --git a/eZ/Publish/API/Repository/Tests/SetupFactory/Legacy.php b/eZ/Publish/API/Repository/Tests/SetupFactory/Legacy.php
index <HASH>..<HASH> 100644
--- a/eZ/Publish/API/Repository/Tests/SetupFactory/Legacy.php
+++ b/eZ/Publish/API/Repository/Tests/SetupFactory/Legacy.php
@@ -362,6 +362,11 @@ class Legacy extends SetupFactory
$serviceSettings['inner_repository']['arguments']['persistence_handler'] = '@persistence_handler_legacy';
$serviceSettings['inner_repository']['arguments']['io_handler'] = '@io_handler_legacy';
+
+ // Needed for URLAliasService tests
+ $serviceSettings['inner_repository']['arguments']['service_settings']['language']['languages'][] = 'eng-US';
+ $serviceSettings['inner_repository']['arguments']['service_settings']['language']['languages'][] = 'eng-GB';
+
$serviceSettings['persistence_handler_legacy']['arguments']['config']['dsn'] = self::$dsn;
$serviceSettings['legacy_db_handler']['arguments']['dsn'] = self::$dsn; | Fix URLAlias integration tests regression introduced by <I>f<I>c<I>d0ae1a0cacbf<I>e<I>a<I>b<I> | ezsystems_ezpublish-kernel | train | php |
400a8ee6063a52710136db6e59f994db5c50e8cb | diff --git a/src/Generators/Yahoo.php b/src/Generators/Yahoo.php
index <HASH>..<HASH> 100644
--- a/src/Generators/Yahoo.php
+++ b/src/Generators/Yahoo.php
@@ -22,9 +22,9 @@ class Yahoo implements Generator
$url .= '&st='.$link->from->format($dateTimeFormat);
$url .= '&dur=allday';
} else {
+ $dateTimeFormat = 'Ymd\THis';
$utcStartDateTime = (clone $link->from)->setTimezone(new DateTimeZone('UTC'));
$utcEndDateTime = (clone $link->to)->setTimezone(new DateTimeZone('UTC'));
- $dateTimeFormat = 'Ymd\THis';
$url .= '&st='.$utcStartDateTime->format($dateTimeFormat).'Z';
$url .= '&et='.$utcEndDateTime->format($dateTimeFormat).'Z';
} | #<I> Reorder lines for readability and consistency | spatie_calendar-links | train | php |
4704a8cd0012b8415f51e705471ce40fbb3e8c69 | diff --git a/cake/libs/view/helpers/cache.php b/cake/libs/view/helpers/cache.php
index <HASH>..<HASH> 100644
--- a/cake/libs/view/helpers/cache.php
+++ b/cake/libs/view/helpers/cache.php
@@ -48,14 +48,6 @@ class CacheHelper extends AppHelper {
var $__match = array();
/**
- * holds the View object passed in final call to CacheHelper::cache()
- *
- * @var View
- * @access public
- */
- var $view;
-
-/**
* cache action time
*
* @var object | Removing unused $view property from CacheHelper.
Fixes #<I> | cakephp_cakephp | train | php |
02a1e3638a55f54a9ef627dad08936d71eefcd0c | diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -32,21 +32,27 @@ def dl_cub(cub_url, cub_archive_name):
with open(cub_archive_name, 'wb') as f:
remote_file = urllib2.urlopen(cub_url)
meta = remote_file.info()
- remote_file_size = int(meta.getheaders("Content-Length")[0])
+ # The server may provide us with the size of the file.
+ cl_header = meta.getheaders("Content-Length")
+ remote_file_size = int(cl_header[0]) if len(cl_header) > 0 else '???'
+
+ # Initialise variables
local_file_size = 0
block_size = 128*1024
+ # Do the download
while True:
data = remote_file.read(block_size)
if not data:
break
- local_file_size += len(data)
f.write(data)
- status = r"Downloading %s %10d [%3.2f%%]" % (cub_url,
- local_file_size, local_file_size * 100. / remote_file_size)
+ local_file_size += len(data)
+
+ status = r"Downloading %s %10d/%s" % (cub_url,
+ local_file_size, remote_file_size)
status = status + chr(8)*(len(status)+1)
print status, | Handle HTTP server not providing content length. | ska-sa_montblanc | train | py |
cfa4f0b9fee030158b794c7e240cf6f9e0bcaafc | diff --git a/formats/color-map.scss.js b/formats/color-map.scss.js
index <HASH>..<HASH> 100644
--- a/formats/color-map.scss.js
+++ b/formats/color-map.scss.js
@@ -18,7 +18,7 @@ class CustomMap {
return '';
}
return `
- '${palette}': (
+ ${palette}: (
${props
.filter((prop) => prop.name.includes(palette))
.map((prop) => | Remove quotes around map names (see links below)
Related to <URL> | Shopify_polaris-tokens | train | js |
bdf417b51643e4d944bb952b2b96f6982a7fd4f0 | diff --git a/src/includes/classes/Core/Utils/UrlRemote.php b/src/includes/classes/Core/Utils/UrlRemote.php
index <HASH>..<HASH> 100644
--- a/src/includes/classes/Core/Utils/UrlRemote.php
+++ b/src/includes/classes/Core/Utils/UrlRemote.php
@@ -195,8 +195,21 @@ class UrlRemote extends Classes\Core\Base\Core
}
# Close cURL resource handle.
- curl_close($curl); // Close cURL resource now.
-
+ curl_close($curl); // Close cURL resource.
+
+ # Maybe review HTTP connection data.
+
+ if ($this->App->Config->©debug['©log']) {
+ $this->c::review([
+ 'url' => $url,
+ 'args' => $args,
+ 'response' => [
+ 'code' => $curl_code,
+ 'headers' => $curl_headers,
+ 'body' => $curl_body,
+ ],
+ ], 'Remote URL connection details.', __METHOD__.'#http');
+ }
# Return final response; array or just the body.
return $return_array ? [ | Enhancing debug logging for remote connections. | wpsharks_core | train | php |
d22b8afb21182ae142c3ee592383a43cc9f12a97 | diff --git a/index.js b/index.js
index <HASH>..<HASH> 100644
--- a/index.js
+++ b/index.js
@@ -90,13 +90,13 @@ UnifiAPI.prototype.logout = function() {
*/
UnifiAPI.prototype.authorize_guest = function(mac = '', minutes = 60, up = undefined, down = undefined, mbytes = undefined, apmac = undefined, site = undefined) {
return this.netsite('/cmd/stamgr', {
- cmd: 'authorize_guest',
+ cmd: 'authorize-guest',
mac: mac.toLowerCase(),
minutes: minutes,
up: up,
down: down,
bytes: mbytes,
- ap_mac: apmac.toLowerCase()
+ ap_mac: apmac && apmac.toLowerCase()
}, {}, undefined, site);
};
@@ -111,7 +111,7 @@ UnifiAPI.prototype.authorize_guest = function(mac = '', minutes = 60, up = undef
*/
UnifiAPI.prototype.unauthorize_guest = function(mac = '', site = undefined) {
return this.netsite('/cmd/stamgr', {
- cmd: 'uauthorize_guest',
+ cmd: 'uauthorize-guest',
mac: mac.toLowerCase()
}, {}, undefined, site);
}; | fix authorize commands, optional apmac transform
changes the authorize and unauthorize `cmd` to match the rest of the `cmd`s as hyphenated as opposed to underscore separated and allows for `ap_mac` parameter for `authorize_guest` to be truly optional by not attempting to lowercase if it does not exist | delian_node-unifiapi | train | js |
afac15fb72a0d7cb996461df304fd05a16f03e8e | diff --git a/bct/algorithms/distance.py b/bct/algorithms/distance.py
index <HASH>..<HASH> 100644
--- a/bct/algorithms/distance.py
+++ b/bct/algorithms/distance.py
@@ -833,7 +833,7 @@ def findwalks(CIJ):
Wq = np.zeros((n, n, n))
CIJpwr = CIJ.copy()
Wq[:, :, 1] = CIJ
- for q in range(n):
+ for q in range(1, n):
CIJpwr = np.dot(CIJpwr, CIJ)
Wq[:, :, q] = CIJpwr | fix user submitted bug in findwalks() | aestrivex_bctpy | train | py |
d073b6538dcda197f1ae554e68dd4aa98403cf16 | diff --git a/tests/server_test.py b/tests/server_test.py
index <HASH>..<HASH> 100644
--- a/tests/server_test.py
+++ b/tests/server_test.py
@@ -3,7 +3,6 @@
import unittest
import itertools
-import logging
from nose.tools import assert_raises # pylint: disable=no-name-in-module | Removed "logging" import, unused | bcb_jsonrpcclient | train | py |
10a51ab8f20022bfd2eca1efef3dd030c0f45a4e | diff --git a/rqalpha/portfolio/account.py b/rqalpha/portfolio/account.py
index <HASH>..<HASH> 100644
--- a/rqalpha/portfolio/account.py
+++ b/rqalpha/portfolio/account.py
@@ -398,7 +398,7 @@ class Account(AbstractAccount):
def deposit_withdraw(self, amount):
"""出入金"""
- if (amount < 0) and (self._total_cash < amount * -1):
+ if (amount < 0) and (self.cash < amount * -1):
raise ValueError(_('insufficient cash, current {}, target withdrawal {}').format(self._total_cash, amount))
self._total_cash += amount | withdrawal should not be greater than current cash | ricequant_rqalpha | train | py |
c807ac59b533f2ba3887b0702a0d0a33671787dd | diff --git a/packages/container/lib/container.js b/packages/container/lib/container.js
index <HASH>..<HASH> 100644
--- a/packages/container/lib/container.js
+++ b/packages/container/lib/container.js
@@ -642,10 +642,18 @@ class FactoryManager {
this.fullName = fullName;
this.normalizedName = normalizedName;
this.madeToString = undefined;
+ this.injections = undefined;
}
create(options = {}) {
- let injections = injectionsFor(this.container, this.normalizedName);
+
+ let injections = this.injections;
+ if (injections === undefined) {
+ injections = injectionsFor(this.container, this.normalizedName);
+ if (areInjectionsDynamic(injections) === false) {
+ this.injections = injections;
+ }
+ }
let props = assign({}, injections, options);
props[NAME_KEY] = this.madeToString || (this.madeToString = this.container.registry.makeToString(this.class, this.fullName)); | [BUGFIX Beta] factoryFor should cache injections when possible | emberjs_ember.js | train | js |
a0287b838293e7ad06df75ca2637ba549520d569 | diff --git a/gary/dynamics/tests/test_naff.py b/gary/dynamics/tests/test_naff.py
index <HASH>..<HASH> 100644
--- a/gary/dynamics/tests/test_naff.py
+++ b/gary/dynamics/tests/test_naff.py
@@ -137,8 +137,8 @@ class TestLogarithmic1D(NAFFBase):
q1=1., q2=0.9, q3=1., units=galactic)
self.w0 = np.array([0.49,0.,0.,1.4,0.,0.])
- self.dt = 0.002
- self.nsteps = 100000
+ self.dt = 0.005
+ self.nsteps = 2**15
# -----------------------------------------------------------------------
# Logarithmic potential, 2D orbit as in Papaphilippou & Laskar (1996), Table 1 | oops, now change number of steps for log1d | adrn_gala | train | py |
f39250443b9a15b66e7e7e77543ae5c3dfd3ea77 | diff --git a/tool/tsh/tsh.go b/tool/tsh/tsh.go
index <HASH>..<HASH> 100644
--- a/tool/tsh/tsh.go
+++ b/tool/tsh/tsh.go
@@ -186,7 +186,7 @@ func Run(args []string, underTest bool) {
utils.InitLogger(utils.LoggingForCLI, logrus.WarnLevel)
// configure CLI argument parser:
- app := utils.InitCLIParser("tsh", "TSH: Teleport SSH client").Interspersed(false)
+ app := utils.InitCLIParser("tsh", "TSH: Teleport Authentication Gateway Client").Interspersed(false)
app.Flag("login", "Remote host login").Short('l').Envar("TELEPORT_LOGIN").StringVar(&cf.NodeLogin)
localUser, _ := client.Username()
app.Flag("proxy", "SSH proxy address").Envar("TELEPORT_PROXY").StringVar(&cf.Proxy) | Update tsh help string. (#<I>) | gravitational_teleport | train | go |
775ab080589126b8c75fac44ee2fd832f40bb01a | diff --git a/src/base/base_object.js b/src/base/base_object.js
index <HASH>..<HASH> 100644
--- a/src/base/base_object.js
+++ b/src/base/base_object.js
@@ -7,7 +7,7 @@ var Events = require('./events')
class BaseObject extends Events {
constructor(options={}) {
- super()
+ super(options)
this.uniqueId = uniqueId('o')
}
} | pass options to super to avoid warning from uglifyjs | clappr_clappr | train | js |
667cacfaaefe0114cd8fc3795c00bf6588256172 | diff --git a/esm/mount.js b/esm/mount.js
index <HASH>..<HASH> 100644
--- a/esm/mount.js
+++ b/esm/mount.js
@@ -31,7 +31,7 @@ export function mount (parent, child, before, replace) {
const beforeEl = getEl(before);
if (beforeEl.__redom_mounted) {
- trigger(before.el, 'onunmount');
+ trigger(beforeEl, 'onunmount');
}
parentEl.replaceChild(childEl, beforeEl); | Fix issue with unmount event triggering | redom_redom | train | js |
ff24974153bb8e1560c393addf4f1e858c32cb47 | diff --git a/lib/wavefile/writer.rb b/lib/wavefile/writer.rb
index <HASH>..<HASH> 100644
--- a/lib/wavefile/writer.rb
+++ b/lib/wavefile/writer.rb
@@ -1,5 +1,7 @@
module WaveFile
class Writer
+ EMPTY_BYTE = "\000"
+
def initialize(file_name, format)
@file = File.open(file_name, "wb")
@format = format
@@ -22,6 +24,13 @@ module WaveFile
end
def close()
+ # The Wave file format requires that the total bytes of sample data written
+ # are even. If not, an empty padding byte should be written.
+ bytes_written = @samples_written * @format.block_align
+ if bytes_written.odd?
+ @file.syswrite(EMPTY_BYTE)
+ end
+
@file.sysseek(0)
write_header(@samples_written) | Updating Writer to write a padding byte if the total bytes of sample data written is odd. | jstrait_wavefile | train | rb |
94fa1d79d8835ad3c96f7e28c1f74debe72bb70b | diff --git a/lib/casio.js b/lib/casio.js
index <HASH>..<HASH> 100644
--- a/lib/casio.js
+++ b/lib/casio.js
@@ -585,7 +585,11 @@ Casio.prototype.model = function(name, opts) {
this._eager = {};
// placeholder for errors...
- this._errors = {}
+ this._errors = {};
+
+ // array of extra properties
+ // we want to serialize as JSON
+ this._externals = [];
this.initialize(attrs);
@@ -1254,19 +1258,25 @@ Casio.prototype.model = function(name, opts) {
_.extend(Model.prototype, {
__type__: 'Model',
+
+ // define instance variables here...
+ // and then remember to set them in the constructor
__cfname: null,
_errors: null,
+ _externals: null,
+ _deleted: null,
+ _created: null,
+ _eager: null,
+
+ // define class variables;
+ // these are shared between all instances
_schema: {},
_hasOne: {},
_hasMany: {},
_belongsTo: {},
_getters: [],
_setters: [],
- _externals: [],
- _options: {},
- _deleted: null,
- _created: null,
- _eager: null
+ _options: {}
});
Model.prototype.__cfname = name;
Model.prototype._options = opts; | make sure we initialize the _externals array inside the Model constructor | studybreak_casio | train | js |
8d03334f80515119030701e14d0fa55bcae84c1d | diff --git a/iamine/__init__.py b/iamine/__init__.py
index <HASH>..<HASH> 100755
--- a/iamine/__init__.py
+++ b/iamine/__init__.py
@@ -11,8 +11,10 @@ import aiohttp
class Miner:
- def __init__(self, identifiers, loop, done_callback=None, maxtasks=None):
+ def __init__(self, identifiers, loop, done_callback=None, maxtasks=None, cache=None):
maxtasks = 100 if not maxtasks else maxtasks
+ # By default, don't cache item metadata in redis.
+ params = {'dontcache': 1} if not cache else {}
self.identifiers = identifiers
self.loop = loop
@@ -21,6 +23,7 @@ class Miner:
self.tasks = set()
self.done_callback = done_callback
self.sem = asyncio.Semaphore(maxtasks)
+ self.params = params
# connector stores cookies between requests and uses connection pool
self.connector = aiohttp.TCPConnector(share_cookies=True, loop=loop)
@@ -69,7 +72,7 @@ class Miner:
i += 1
try:
resp = yield from aiohttp.request(
- 'get', url, connector=self.connector)
+ 'get', url, params=self.params, connector=self.connector)
break
except Exception as exc:
sys.stderr.write('{0} has error {1}\n'.format(url, repr(exc))) | By default, don't cache item metadata in redis. Can be overriden with cache arg set to True. | jjjake_iamine | train | py |
cf058566c108010dd8bc92006039da983d26eac5 | diff --git a/rest_authtoken/serializers.py b/rest_authtoken/serializers.py
index <HASH>..<HASH> 100644
--- a/rest_authtoken/serializers.py
+++ b/rest_authtoken/serializers.py
@@ -55,9 +55,10 @@ class UserRegistrationSerializer(serializers.ModelSerializer):
instance.set_password(password)
instance.save()
- try:
- send_confirmation_email(instance)
- except SMTPException:
- raise ValidationError('failed to send confirmation email')
+ if REGISTRATION_EMAIL_CONFIRM:
+ try:
+ send_confirmation_email(instance)
+ except SMTPException:
+ raise ValidationError('failed to send confirmation email')
return instance | Registration: Do not send confirmation email if disabled (fixes #1) | wichmannpas_django-rest-authtoken | train | py |
8caaff5865829d70bb42ec12265461ad35745eb2 | diff --git a/authorizer/auth.go b/authorizer/auth.go
index <HASH>..<HASH> 100644
--- a/authorizer/auth.go
+++ b/authorizer/auth.go
@@ -121,7 +121,16 @@ func (s *AuthorizationService) CreateAuthorization(ctx context.Context, a *influ
return err
}
- for _, p := range a.Permissions {
+ if err := VerifyPermissions(ctx, a.Permissions); err != nil {
+ return err
+ }
+
+ return s.s.CreateAuthorization(ctx, a)
+}
+
+// VerifyPermission ensures that an authorization is allowed all of the appropriate permissions.
+func VerifyPermissions(ctx context.Context, ps []influxdb.Permission) error {
+ for _, p := range ps {
if err := IsAllowed(ctx, p); err != nil {
return &influxdb.Error{
Err: err,
@@ -131,7 +140,7 @@ func (s *AuthorizationService) CreateAuthorization(ctx context.Context, a *influ
}
}
- return s.s.CreateAuthorization(ctx, a)
+ return nil
}
// SetAuthorizationStatus checks to see if the authorizer on context has write access to the authorization provided. | feat(authorizer): add method to verify integrity of permissions | influxdata_influxdb | train | go |
7fbe64466a8ed092ebd44b6c2a982ecddc9d9723 | diff --git a/lib/ecstatic.js b/lib/ecstatic.js
index <HASH>..<HASH> 100644
--- a/lib/ecstatic.js
+++ b/lib/ecstatic.js
@@ -105,8 +105,10 @@ var ecstatic = module.exports = function (dir, options) {
return status[500](res, next, { error: err });
}
if (opts.showDir) {
- showDir(opts, stat)(req, res);
+ return showDir(opts, stat)(req, res);
}
+
+ return status[403](res, next);
});
}
@@ -196,4 +198,3 @@ function shouldCompress(req) {
})
;
};
- | Fixes a hang when the request targets an existing directory with autoIndex set, and showDir unset, but there is no index.html file | jfhbrook_node-ecstatic | train | js |
d20cff9ea33bade8f838c9f08a55906c5f9923db | diff --git a/pyerf/tests/test_pyerf.py b/pyerf/tests/test_pyerf.py
index <HASH>..<HASH> 100644
--- a/pyerf/tests/test_pyerf.py
+++ b/pyerf/tests/test_pyerf.py
@@ -83,3 +83,15 @@ class TestErfInv(object):
assert pyerf.erfinv(1) == inf
assert pyerf.erfinv(-1) == -inf
assert pyerf.erfinv(0) == 0
+
+ def test_erfinv_raises_error(self):
+ values = (
+ -2,
+ 2,
+ -1.00000001,
+ 1.00000001,
+ inf,
+ )
+ for val in values:
+ with pytest.raises(ValueError):
+ pyerf.erfinv(val) | Test for raising ValueError. | dougthor42_PyErf | train | py |
06b029769680b87b82fd72f21ec6f4da8e7aea12 | diff --git a/src/Util/System/Windows.php b/src/Util/System/Windows.php
index <HASH>..<HASH> 100644
--- a/src/Util/System/Windows.php
+++ b/src/Util/System/Windows.php
@@ -69,6 +69,10 @@ class Windows extends System
*/
protected function systemHasAnsiSupport()
{
- return (getenv('ANSICON') === true || getenv('ConEmuANSI') === 'ON');
+ return (function_exists('sapi_windows_vt100_support') && @sapi_windows_vt100_support(STDOUT))
+ || false !== getenv('ANSICON')
+ || 'ON' === getenv('ConEmuANSI')
+ || 'Hyper' === getenv('TERM_PROGRAM')
+ || 'xterm' === getenv('TERM');
}
} | Better check for Ansi color support on Windows. (#<I>) | thephpleague_climate | train | php |
3281a0b5dfef2cb825c095546b099e8e014a6356 | diff --git a/src/Composer/Installer.php b/src/Composer/Installer.php
index <HASH>..<HASH> 100644
--- a/src/Composer/Installer.php
+++ b/src/Composer/Installer.php
@@ -394,9 +394,7 @@ class Installer
&& $lockedPackage->getSourceReference()
&& $lockedPackage->getSourceReference() !== $package->getSourceReference()
) {
- $newPackage = clone $package;
- $newPackage->setSourceReference($lockedPackage->getSourceReference());
- $operations[] = new UpdateOperation($package, $newPackage);
+ $operations[] = new UpdateOperation($package, $lockedPackage);
break;
} | Use the locked package for the update operation | mothership-ec_composer | train | php |
d67aa8286730b8f578a6c8174353d0213e949482 | diff --git a/tests/db/models_test.py b/tests/db/models_test.py
index <HASH>..<HASH> 100644
--- a/tests/db/models_test.py
+++ b/tests/db/models_test.py
@@ -44,7 +44,8 @@ class Inputs4HazCalcTestCase(unittest.TestCase):
)
inputs = models.inputs4hcalc(hc.id)
- self.assertEqual(2, inputs.count())
+ # We expect 3: the two logic trees and one source model
+ self.assertEqual(3, inputs.count())
def test_with_input_type(self):
cfg = helpers.get_data_path('simple_fault_demo_hazard/job.ini') | tests/db/models_test:
Updated a test per new input loading functionality. | gem_oq-engine | train | py |
8c45b0d1b4aa5910afee4585f1ad8311bd0cf2e5 | diff --git a/lib/heroku/command/ps.rb b/lib/heroku/command/ps.rb
index <HASH>..<HASH> 100644
--- a/lib/heroku/command/ps.rb
+++ b/lib/heroku/command/ps.rb
@@ -268,14 +268,6 @@ class Heroku::Command::Ps < Heroku::Command::Base
error(message.join("\n"))
end
- do_resize(changes)
- end
-
- alias_command "resize", "ps:resize"
-
- private
-
- def do_resize(changes)
action("Resizing and restarting the specified dynos") do
api.request(
:expects => 200,
@@ -291,4 +283,6 @@ class Heroku::Command::Ps < Heroku::Command::Base
display "#{type} dynos now #{size}X ($#{price}/dyno-hour)"
end
end
+
+ alias_command "resize", "ps:resize"
end | Collapse do_resize back into the resize method.
It's no longer called from ps:scale, so it can go back to being inline. | heroku_legacy-cli | train | rb |
756f9231daf66824303ec513a4c5b8f26c34ac5b | diff --git a/src/Common/RestApiClient.php b/src/Common/RestApiClient.php
index <HASH>..<HASH> 100644
--- a/src/Common/RestApiClient.php
+++ b/src/Common/RestApiClient.php
@@ -274,10 +274,10 @@ class RestApiClient
/**
* Determine if the response was successful or not.
*
- * @param array $json
+ * @param mixed $json
* @return bool
*/
- public function responseSuccessful(array $json)
+ public function responseSuccessful($json)
{
return ! empty($json['success']);
} | Allow RestApiClient::responseSuccessful validate mixed results. | DoSomething_gateway | train | php |
5f885836ccfaf3a57987175e3d8d412ef417de1c | diff --git a/src/Administration/Resources/app/administration/src/core/factory/http.factory.js b/src/Administration/Resources/app/administration/src/core/factory/http.factory.js
index <HASH>..<HASH> 100644
--- a/src/Administration/Resources/app/administration/src/core/factory/http.factory.js
+++ b/src/Administration/Resources/app/administration/src/core/factory/http.factory.js
@@ -18,6 +18,13 @@ export default function createHTTPClient(context) {
}
/**
+ * Provides CancelToken so a request's promise from Http Client could be canceled.
+ *
+ * @returns { CancelToken, isCancel, Cancel}
+ */
+export const { CancelToken, isCancel, Cancel } = Axios;
+
+/**
* Creates the HTTP client with the provided context.
*
* @param {Context} context Information about the environment | NTR - Allows cancelling a request promise from http client | shopware_platform | train | js |
d6a53060be3a3ac3264f2a45d2f3e9b77fe5654a | diff --git a/lib/page_server.js b/lib/page_server.js
index <HASH>..<HASH> 100644
--- a/lib/page_server.js
+++ b/lib/page_server.js
@@ -224,8 +224,10 @@ module.exports = {
var options = {
"query": parsed_url.query,
"host": request.headers.host,
- "cookies": request.cookies,
- "authorization": (request.headers && request.headers.authorization)
+ "xhr": (request.headers.http_x_requested_with && request.headers.http_x_requested_with === 'xmlhttprequest'),
+ "authorization": request.headers.authorization,
+ "header": request.headers,
+ "cookies": request.cookies
};
// check if the given request is an asset bundler request | added xhr and header to request options | laktek_punch | train | js |
1b0f5a7d5dcef4c8a2047f8c61a7d2b5a88482e4 | 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
@@ -26,7 +26,9 @@ module DataMapper
model.extend Model
end
- # TODO: document
+ # Collection this resource associated with.
+ # Used by SEL.
+ #
# @api private
attr_writer :collection | A note on how Resource#collection is used | datamapper_dm-core | train | rb |
278337e45a18508b3600ffb739b19a6c020acfac | diff --git a/build.go b/build.go
index <HASH>..<HASH> 100644
--- a/build.go
+++ b/build.go
@@ -347,11 +347,11 @@ func ChangeWorkingDir(dir string) {
}
func grunt(params ...string) {
- if runtime.GOOS == "windows" {
- runPrint(`.\node_modules\.bin\grunt`, params...)
- } else {
- runPrint("./node_modules/.bin/grunt", params...)
- }
+ if runtime.GOOS == "windows" {
+ runPrint(`.\node_modules\.bin\grunt`, params...)
+ } else {
+ runPrint("./node_modules/.bin/grunt", params...)
+ }
}
func gruntBuildArg(task string) []string {
@@ -371,7 +371,7 @@ func gruntBuildArg(task string) []string {
}
func setup() {
- runPrint("go", "get", "-v", "github.com/kardianos/govendor")
+ runPrint("go", "get", "-v", "github.com/golang/dep")
runPrint("go", "install", "-v", "./pkg/cmd/grafana-server")
} | install dep instead of govendor on setup | grafana_grafana | train | go |
a0cbb41e76e9513c7619fcab3891cd7a02043041 | diff --git a/aeron-driver/src/main/java/io/aeron/driver/IpcPublication.java b/aeron-driver/src/main/java/io/aeron/driver/IpcPublication.java
index <HASH>..<HASH> 100644
--- a/aeron-driver/src/main/java/io/aeron/driver/IpcPublication.java
+++ b/aeron-driver/src/main/java/io/aeron/driver/IpcPublication.java
@@ -197,10 +197,10 @@ public class IpcPublication implements DriverManagedResource, Subscribable
workCount = 1;
}
}
- else if (tripLimit > maxSubscriberPosition)
+ else if (publisherLimit.get() > consumerPosition)
{
- tripLimit = maxSubscriberPosition;
- publisherLimit.setOrdered(maxSubscriberPosition);
+ tripLimit = consumerPosition;
+ publisherLimit.setOrdered(consumerPosition);
}
return workCount; | [Java] Clarify code in updating publisher limits for IPC publications. | real-logic_aeron | train | java |
a0e50725eb578c3877f9e54ddff0dd86dd359ef5 | diff --git a/sos/report/plugins/devices.py b/sos/report/plugins/devices.py
index <HASH>..<HASH> 100644
--- a/sos/report/plugins/devices.py
+++ b/sos/report/plugins/devices.py
@@ -14,7 +14,7 @@ class Devices(Plugin, IndependentPlugin):
short_desc = 'devices specific commands'
plugin_name = 'devices'
- profiles = ('system', 'hardware', 'boot')
+ profiles = ('system', 'hardware', 'boot', 'storage')
packages = ('udev', 'systemd-udev')
files = ('/dev',)
diff --git a/sos/report/plugins/nvme.py b/sos/report/plugins/nvme.py
index <HASH>..<HASH> 100644
--- a/sos/report/plugins/nvme.py
+++ b/sos/report/plugins/nvme.py
@@ -14,6 +14,7 @@ class Nvme(Plugin, IndependentPlugin):
short_desc = 'Collect config and system information about NVMe devices'
plugin_name = "nvme"
+ profiles = ('storage',)
packages = ('nvme-cli',)
def setup(self): | [profiles] Add nvme and devices plugins to storage profile
This patch adds nvme and devices to the list of plugins
in the storage profile.
Resolves: #<I> | sosreport_sos | train | py,py |
44bb85f5e313c2abf983e3aa90572aff5e472786 | diff --git a/google-cloud-error_reporting/test/google/cloud/error_reporting/middleware_test.rb b/google-cloud-error_reporting/test/google/cloud/error_reporting/middleware_test.rb
index <HASH>..<HASH> 100644
--- a/google-cloud-error_reporting/test/google/cloud/error_reporting/middleware_test.rb
+++ b/google-cloud-error_reporting/test/google/cloud/error_reporting/middleware_test.rb
@@ -80,10 +80,13 @@ describe Google::Cloud::ErrorReporting::Middleware do
it "raises ArgumentError if empty project_id provided" do
assert_raises ArgumentError do
- Google::Cloud::ErrorReporting::V1beta1::ReportErrorsServiceClient.stub \
- :new, "A default error_reporting" do
- ENV.stub :[], nil do
- Google::Cloud::ErrorReporting::Middleware.new nil
+ # Prevent return of actual project in any environment including GCE, etc.
+ Google::Cloud::Core::Environment.stub :project_id, nil do
+ Google::Cloud::ErrorReporting::V1beta1::ReportErrorsServiceClient.stub \
+ :new, "A default error_reporting" do
+ ENV.stub :[], nil do
+ Google::Cloud::ErrorReporting::Middleware.new nil
+ end
end
end
end | Update Error Reporting test
Prevent return of actual project in any environment including GCE.
[refs #<I>] | googleapis_google-cloud-ruby | train | rb |
e2edc9b26a7e2b8f27563485cf2faf03a1ab6d39 | diff --git a/allennlp/training/metrics/average.py b/allennlp/training/metrics/average.py
index <HASH>..<HASH> 100644
--- a/allennlp/training/metrics/average.py
+++ b/allennlp/training/metrics/average.py
@@ -23,7 +23,7 @@ class Average(Metric):
value : ``float``
The value to average.
"""
- self._total_value += value
+ self._total_value += list(self.unwrap_to_tensors(value))[0]
self._count += 1
@overrides | unwrap tensors in avg metric (#<I>)
* unwrap tensors in avg metric
* fix for generator | allenai_allennlp | train | py |
5954e9c195796d612f8ffc97bccf890a0ca5cefa | diff --git a/src/JWTAuth.php b/src/JWTAuth.php
index <HASH>..<HASH> 100644
--- a/src/JWTAuth.php
+++ b/src/JWTAuth.php
@@ -262,6 +262,6 @@ class JWTAuth
return call_user_func_array([$this->jwt, $method], $parameters);
}
- throw new \BadMethodCallException('Method [$method] does not exist.');
+ throw new \BadMethodCallException("Method [$method] does not exist.");
}
} | Quotes error
same as #<I> | tymondesigns_jwt-auth | train | php |
f67227efa2c896ad4a0e21ce9378f1435f00a40b | diff --git a/apache/datadog_checks/apache/apache.py b/apache/datadog_checks/apache/apache.py
index <HASH>..<HASH> 100644
--- a/apache/datadog_checks/apache/apache.py
+++ b/apache/datadog_checks/apache/apache.py
@@ -54,15 +54,16 @@ class Apache(AgentCheck):
service_check_tags = ['host:%s' % apache_host, 'port:%s' % apache_port] + tags
try:
self.log.debug(
- 'apache check initiating request, connect timeout %d receive %d'
- % (self.http.options['timeout'][0], self.http.options['timeout'][1])
+ 'apache check initiating request, connect timeout %d receive %d',
+ self.http.options['timeout'][0],
+ self.http.options['timeout'][1],
)
r = self.http.get(url)
r.raise_for_status()
except Exception as e:
- self.log.warning("Caught exception %s" % str(e))
+ self.log.warning("Caught exception %s", e)
self.service_check(service_check_name, AgentCheck.CRITICAL, tags=service_check_tags)
raise
else:
@@ -112,4 +113,4 @@ class Apache(AgentCheck):
raw_version = value.split(' ')[0]
version = raw_version.split('/')[1]
self.set_metadata('version', version)
- self.log.debug("found apache version {}".format(version))
+ self.log.debug("found apache version %s", version) | Standardize logging format (#<I>) | DataDog_integrations-core | train | py |
6d429438756d85a161edcbf194211e4ba7770d86 | diff --git a/tests/test_datasets_local.py b/tests/test_datasets_local.py
index <HASH>..<HASH> 100644
--- a/tests/test_datasets_local.py
+++ b/tests/test_datasets_local.py
@@ -39,9 +39,9 @@ class TestLocal(TestCase):
exists.return_value = True
isdir.return_value = True
isfile.side_effect = (True, False, True)
- listdir.return_value = range(3)
+ listdir.return_value = ('0', '1', '2')
local = LocalDatasets('test')
- self.assertEqual((0, 2), tuple(local.all))
+ self.assertEqual(('0', '2'), tuple(local.all))
@patch('serenata_toolbox.datasets.contextmanager.print') | Fix bug in LocalDatasets test | okfn-brasil_serenata-toolbox | train | py |
2bd027fa0e97d220f0bba8a478aaadedb5a01876 | diff --git a/src/metapensiero/signal/atom.py b/src/metapensiero/signal/atom.py
index <HASH>..<HASH> 100644
--- a/src/metapensiero/signal/atom.py
+++ b/src/metapensiero/signal/atom.py
@@ -262,8 +262,8 @@ class Signal(object):
try:
future.result()
except Exception as e:
- logger.exception("Error occurred while running event "
- "callbacks for '%s' on %r", self.name, instance)
+ logger.error("Error occurred while running event callbacks"
+ " for '%s' on %r: %s", self.name, instance, e)
async def _sequential_handlers_exec(self, sync_results, async_results):
for coro in async_results: | Avoid duplicated traceback in case of errors
Use logger.error() instead of logger.exception(): this is a callback
explicitly added to fetch the future's result and when that causes an
exception, it gets propagated to the caller site (usually a WAMP exchange),
that by any chance will log it, possibly wrapped within an ApplicationError. | metapensiero_metapensiero.signal | train | py |
429c2f8f4acc569b67ee26e68cff71d066f3e0b7 | diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -49,11 +49,12 @@ setup_args = dict(
'dict': ['more-itertools==2.*'],
'exceptions': [],
'function': [],
+ 'hashlib': [],
'http': ['requests==2.*'],
'inspect': [],
'iterable': [],
'logging': [],
- 'multidict': [],
+ 'multi_dict': [],
'observable': [],
'path': [],
'pymysql': ['pymysql==0.*'],
@@ -63,6 +64,7 @@ setup_args = dict(
],
'set': [],
'sqlalchemy': ['sqlparse==0.*'],
+ 'test': [],
},
# https://pypi.python.org/pypi?%3Aaction=list_classifiers
classifiers=[ | Fix: missing extras_require: hashlib, multi_dict, test | timdiels_pytil | train | py |
449177b7a9129f8d08ec7001807fd3e6075be499 | diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -94,7 +94,7 @@ if LINUX:
dst = 'libjpy.so'
if DARWIN:
src = os.path.join(sys.exec_prefix, 'lib', 'python' + str(sys.version_info.major) + '.' + str(sys.version_info.minor), 'site-packages', 'jpy.so')
- dst = 'libjpy.so'
+ dst = 'libjpy.dylib'
print('Copying', src, 'to', dst)
shutil.copyfile(src, dst) | Changed library extension for Darwin ('.dylib') | bcdev_jpy | train | py |
4afdaee3b416eec717a9564d04efe8500c01078b | diff --git a/go/vt/mysqlctl/builtinbackupengine.go b/go/vt/mysqlctl/builtinbackupengine.go
index <HASH>..<HASH> 100644
--- a/go/vt/mysqlctl/builtinbackupengine.go
+++ b/go/vt/mysqlctl/builtinbackupengine.go
@@ -298,13 +298,13 @@ func (be *BuiltinBackupEngine) backupFiles(ctx context.Context, params BackupPar
wg.Wait()
- // BackupHandles now support the ErrorRecorder interface for tracking errors
+ // BackupHandle supports the ErrorRecorder interface for tracking errors
// across any goroutines that fan out to take the backup. This means that we
- // can discard the local error recorder and put everything through the bh.
+ // don't need a local error recorder and can put everything through the bh.
//
- // This mitigates the scenario where bh.AddFile() encounters an error asynchronously,
+ // This handles the scenario where bh.AddFile() encounters an error asynchronously,
// which ordinarily would be lost in the context of `be.backupFile`, i.e. if an
- // error were encoutered
+ // error were encountered
// [here](https://github.com/vitessio/vitess/blob/d26b6c7975b12a87364e471e2e2dfa4e253c2a5b/go/vt/mysqlctl/s3backupstorage/s3.go#L139-L142).
if bh.HasErrors() {
return bh.Error() | Reword comment to make sense without the diff | vitessio_vitess | train | go |
aa4b65dc7034e5f0a5c7a6c35ab294def797cd2f | diff --git a/agent/functional_tests/generators/simpletests.go b/agent/functional_tests/generators/simpletests.go
index <HASH>..<HASH> 100644
--- a/agent/functional_tests/generators/simpletests.go
+++ b/agent/functional_tests/generators/simpletests.go
@@ -30,8 +30,7 @@ import (
)
// TODO: add more awsvpc functional tests using simple test template
-var simpleTestPattern = `
-// +build functional,%s
+var simpleTestPattern = `// +build functional,%s
// Copyright 2014-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved.
// | ftest: update generator to avoid go misinterpretation
Go may warn (exit non-zero) in some cases because it interprets the
`^// +build` string fragment as a pragma. By moving this to the
beginning of the string, we can avoid the issue entirely. | aws_amazon-ecs-agent | train | go |
e57ae1ca2ba88f6072e63b7dafaf5c050867fe25 | diff --git a/daemon/cmd/daemon_main.go b/daemon/cmd/daemon_main.go
index <HASH>..<HASH> 100644
--- a/daemon/cmd/daemon_main.go
+++ b/daemon/cmd/daemon_main.go
@@ -1558,7 +1558,7 @@ func initClockSourceOption() {
if !option.Config.DryMode {
hz, err := probes.NewProbeManager().SystemKernelHz()
if err != nil {
- log.Warnf("Auto-disabling %q feature since KERNEL_HZ cannot be determined",
+ log.WithError(err).Infof("Auto-disabling %q feature since KERNEL_HZ cannot be determined",
option.EnableBPFClockProbe)
option.Config.EnableBPFClockProbe = false
} else { | cilium: downgrade kernel_hz clock probe warning to info message
For the case where neither the kernel config can be determined nor derived
through probing, we currently emit a warning to the agent log. To avoid
confusion downgrade to just an info message. It's harmless since this just
means we're using ktime in our datapath instead of jiffies. Given it's
useful for debugging, dump the err to the info message as well. | cilium_cilium | train | go |
327c7e695e6a292e7461e9ddd2be3ffaf570f5d9 | diff --git a/redis/client.py b/redis/client.py
index <HASH>..<HASH> 100755
--- a/redis/client.py
+++ b/redis/client.py
@@ -59,7 +59,8 @@ def string_keys_to_dict(key_string, callback):
def dict_merge(*dicts):
merged = {}
- [merged.update(d) for d in dicts]
+ for d in dicts:
+ merged.update(d)
return merged | Avoid needlessly making temporary lists to merge dict(s) together | andymccurdy_redis-py | train | py |
bb5d6bd3ba5295b7327271170f7236a416a6ac9c | diff --git a/src/adapters/pouch.idb.js b/src/adapters/pouch.idb.js
index <HASH>..<HASH> 100644
--- a/src/adapters/pouch.idb.js
+++ b/src/adapters/pouch.idb.js
@@ -539,6 +539,7 @@ var IdbPouch = function(opts, callback) {
var docId = id.split('/')[0];
var attachId = id.split('/')[1];
api.get(docId, function(err, obj) {
+ obj._attachments || (obj._attachments = {});
obj._attachments[attachId] = {
content_type: type,
data: btoa(doc)
@@ -850,4 +851,4 @@ IdbPouch.destroy = function(name, callback) {
};
};
-Pouch.adapter('idb', IdbPouch);
\ No newline at end of file
+Pouch.adapter('idb', IdbPouch); | Fix putAttachment on a doc without attachments | pouchdb_pouchdb | train | js |
0353a762dc8b35a7ed30b006d67dcc618a44f364 | diff --git a/Database/Concrete/MySQL.php b/Database/Concrete/MySQL.php
index <HASH>..<HASH> 100644
--- a/Database/Concrete/MySQL.php
+++ b/Database/Concrete/MySQL.php
@@ -78,8 +78,6 @@ class MySQL extends AbstractDb
if($this->connect->select_db($this->database)===false)
throw new DbException('can\'t connect to database: ' . $this->connect->error, $this->connect->errno);
- $this->pass=null;
-
$this->query("SET CHARACTER SET 'utf8'"/*, $encoding*/);
} | fix: can't reopen timedout connection | PHPColibri_framework | train | php |
96b771b8c4c46c766087f6b70c3df3e8924b9fd1 | diff --git a/src/lib/units/month.js b/src/lib/units/month.js
index <HASH>..<HASH> 100644
--- a/src/lib/units/month.js
+++ b/src/lib/units/month.js
@@ -114,12 +114,15 @@ export function setMonth (mom, value) {
return mom;
}
- // TODO: Move this out of here!
- if (typeof value === 'string' && !/^\d+$/.test(value)) {
- value = mom.localeData().monthsParse(value);
- // TODO: Another silent failure?
- if (typeof value !== 'number') {
- return mom;
+ if (typeof value === 'string') {
+ if (/^\d+$/.test(value)) {
+ value = toInt(value);
+ } else {
+ value = mom.localeData().monthsParse(value);
+ // TODO: Another silent failure?
+ if (typeof value !== 'number') {
+ return mom;
+ }
}
} | Convert to int before days-in-month check | moment_moment | train | js |
634b55414d566fce10eb8f198c491035c386ed6b | diff --git a/src/Config.php b/src/Config.php
index <HASH>..<HASH> 100644
--- a/src/Config.php
+++ b/src/Config.php
@@ -82,7 +82,7 @@ class Config
'verbose',
'verbose_logger',
'raise_on_error',
- 'transformer'
+ 'transformer',
);
private string $accessToken; | Fix missing comma and wrong indentation | rollbar_rollbar-php | train | php |
0de04345e27dd9bc4b5ef9066df1d7d597210183 | diff --git a/nodeconductor/structure/views.py b/nodeconductor/structure/views.py
index <HASH>..<HASH> 100644
--- a/nodeconductor/structure/views.py
+++ b/nodeconductor/structure/views.py
@@ -1500,7 +1500,7 @@ class ServicesViewSet(mixins.ListModelMixin,
class BaseCounterView(viewsets.GenericViewSet):
def list(self, request, uuid=None):
result = {}
- fields = request.query_params.getlist('fields')
+ fields = request.query_params.getlist('fields') or self.get_fields().keys()
for field, func in self.get_fields().items():
if field in fields:
result[field] = func() | Render all fields by default (WAL-<I>) | opennode_waldur-core | train | py |
f2ecda165e51c937bc4cafe9bd2e4069bb63a373 | diff --git a/rollrus.go b/rollrus.go
index <HASH>..<HASH> 100644
--- a/rollrus.go
+++ b/rollrus.go
@@ -15,6 +15,17 @@ type Hook struct {
roll.Client
}
+// SetupLogging sets up logging. if token is not and empty string a rollbar
+// hook is added with the environment set to env. The log formatter is set to a
+// TextFormatter with timestamps disabled, which is suitable for use on Heroku.
+func SetupLogging(token, env string) {
+ log.SetFormatter(&log.TextFormatter{DisableTimestamp: true})
+
+ if token != "" {
+ log.AddHook(&Hook{Client: roll.New(token, env)})
+ }
+}
+
// ReportPanic attempts to report the panic to rollbar using the provided
// client and then re-panic. If it can't report the panic it will print an
// error to stderr. | SetupLogging()
This sets up logging using common Heroku defaults and a rollbar hook | heroku_rollrus | train | go |
4aa453ad54f76c4db02b6ad3574e17795c51fb23 | diff --git a/src/Composer/Installers/DrupalInstaller.php b/src/Composer/Installers/DrupalInstaller.php
index <HASH>..<HASH> 100644
--- a/src/Composer/Installers/DrupalInstaller.php
+++ b/src/Composer/Installers/DrupalInstaller.php
@@ -13,6 +13,8 @@ class DrupalInstaller extends BaseInstaller
'custom-theme' => 'themes/custom/{$name}/',
'custom-module' => 'modules/custom/{$name}/',
'custom-profile' => 'profiles/custom/{$name}/',
- 'drupal-multisite' => 'sites/{$name}/'
+ 'drupal-multisite' => 'sites/{$name}/',
+ 'console' => 'console/{$name}/',
+ 'console-language' => 'console/language/{$name}/',
);
} | Add support for Drupal Console custom packages and languages (#<I>)
* Update DrupalInstaller.php
* Added composer installer types for Drupal Console packages and languages
* Fix missing trailing comma | composer_installers | train | php |
37996da9b0df40134b7db530acb50d6e2f1a5084 | diff --git a/spec/main-spec.js b/spec/main-spec.js
index <HASH>..<HASH> 100644
--- a/spec/main-spec.js
+++ b/spec/main-spec.js
@@ -109,6 +109,10 @@ describe('exec', function() {
expect(_.message).toContain('code: 2')
}
})
+ it('does not cry if stream is stdout, exit code is non-zero and ignoreExitCode is set to true', async function() {
+ const path = Path.join(__dirname, 'fixtures', 'non-zero.js')
+ await execNode(path, [], { ignoreExitCode: true })
+ })
it('returns exitCode for `both` streams', async function() {
const path = Path.join(__dirname, 'fixtures', 'non-zero.js')
const output = await execNode(path, [], { stream: 'both' }) | :white_check_mark: Add specs for change | steelbrain_exec | train | js |
24a1a559c1bfafc6ce6c0f68940a4f589ed06668 | diff --git a/src/Command/NormalizeCommand.php b/src/Command/NormalizeCommand.php
index <HASH>..<HASH> 100644
--- a/src/Command/NormalizeCommand.php
+++ b/src/Command/NormalizeCommand.php
@@ -120,6 +120,8 @@ final class NormalizeCommand extends Command\BaseCommand
return 0;
}
+ $io->write('<info>Updating lock file.</info>');
+
return $this->updateLocker($output);
}
diff --git a/test/Unit/Command/NormalizeCommandTest.php b/test/Unit/Command/NormalizeCommandTest.php
index <HASH>..<HASH> 100644
--- a/test/Unit/Command/NormalizeCommandTest.php
+++ b/test/Unit/Command/NormalizeCommandTest.php
@@ -465,6 +465,10 @@ final class NormalizeCommandTest extends Framework\TestCase
)))
->shouldBeCalled();
+ $io
+ ->write(Argument::is('<info>Updating lock file.</info>'))
+ ->shouldBeCalled();
+
$locker = $this->prophesize(Package\Locker::class);
$locker | Enhancement: Output info before updating locker | localheinz_composer-normalize | train | php,php |
d3be3d54fb7994b723e667c2287d5f1a2a2e739e | diff --git a/salt/key.py b/salt/key.py
index <HASH>..<HASH> 100644
--- a/salt/key.py
+++ b/salt/key.py
@@ -837,12 +837,16 @@ class Key(object):
Delete all denied keys
'''
keys = self.list_keys()
- for key in keys[self.DEN]:
- try:
- os.remove(os.path.join(self.opts['pki_dir'], status, key))
- self.event.fire_event(eload, tagify(prefix='key'))
- except (OSError, IOError):
- pass
+ for status, keys in six.iteritems(self.list_keys()):
+ for key in keys[self.DEN]:
+ try:
+ os.remove(os.path.join(self.opts['pki_dir'], status, key))
+ eload = {'result': True,
+ 'act': 'delete',
+ 'id': key}
+ self.event.fire_event(eload, tagify(prefix='key'))
+ except (OSError, IOError):
+ pass
self.check_minion_cache()
return self.list_keys() | added the missing declaration of eload and status | saltstack_salt | train | py |
9c87f129500e23297f4f2d768abb5aaf3aaf28d8 | diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -36,7 +36,7 @@ extra_dependencies = {
],
"redis": [
- "redis>=2.10",
+ "redis>=2.10,<3",
],
"watch": [ | fix(build): pin redis <3 | Bogdanp_dramatiq | train | py |
e29385484fbc2581af1da4ff1404f52afd33f6a8 | diff --git a/beatrix/src/test/java/org/killbill/billing/beatrix/integration/TestInvoicePayment.java b/beatrix/src/test/java/org/killbill/billing/beatrix/integration/TestInvoicePayment.java
index <HASH>..<HASH> 100644
--- a/beatrix/src/test/java/org/killbill/billing/beatrix/integration/TestInvoicePayment.java
+++ b/beatrix/src/test/java/org/killbill/billing/beatrix/integration/TestInvoicePayment.java
@@ -406,7 +406,7 @@ public class TestInvoicePayment extends TestIntegrationBase {
}
@Test(groups = "slow")
- public void testWithoutDefaultPaymentMethodt() throws Exception {
+ public void testWithoutDefaultPaymentMethod() throws Exception {
// 2012-05-01T00:03:42.000Z
clock.setTime(new DateTime(2012, 5, 1, 0, 3, 42, 0)); | beatrix: fix typo in test name | killbill_killbill | train | java |
0b28f283ab0921f4c9d7f4b666679855881432ce | diff --git a/client.go b/client.go
index <HASH>..<HASH> 100644
--- a/client.go
+++ b/client.go
@@ -574,6 +574,8 @@ func (c *Client) Start() (addr net.Addr, err error) {
c.config.TLSConfig = &tls.Config{
Certificates: []tls.Certificate{cert},
+ ClientAuth: tls.RequireAndVerifyClientCert,
+ MinVersion: tls.VersionTLS12,
ServerName: "localhost",
}
}
@@ -774,7 +776,7 @@ func (c *Client) Start() (addr net.Addr, err error) {
}
// loadServerCert is used by AutoMTLS to read an x.509 cert returned by the
-// server, and load it as the RootCA for the client TLSConfig.
+// server, and load it as the RootCA and ClientCA for the client TLSConfig.
func (c *Client) loadServerCert(cert string) error {
certPool := x509.NewCertPool()
@@ -791,6 +793,7 @@ func (c *Client) loadServerCert(cert string) error {
certPool.AddCert(x509Cert)
c.config.TLSConfig.RootCAs = certPool
+ c.config.TLSConfig.ClientCAs = certPool
return nil
} | set ClientAuth and ClientCAs on plugin client tls config | hashicorp_go-plugin | train | go |
cc1949e263702eda566bf9391980e867b18a19b0 | diff --git a/example/myapp/middleware/core.io-auth/protocols/delegated.js b/example/myapp/middleware/core.io-auth/protocols/delegated.js
index <HASH>..<HASH> 100644
--- a/example/myapp/middleware/core.io-auth/protocols/delegated.js
+++ b/example/myapp/middleware/core.io-auth/protocols/delegated.js
@@ -0,0 +1,25 @@
+/*jshint esversion:6, node:true*/
+'use strict';
+
+/*
+ * Delegated Authentication Protocol
+ *
+ * Authentication is delegated by the Strategy to an external provider
+ * but handled locally (e.g. makes request internally to external provider)
+ * unlike OAuth or similar which redirects to the external provider.
+ * On success the authenticated user is connected to a local user (created if
+ * necessary) in a similar manner to OAuth.
+ */
+module.exports = function(passport, config){
+
+ return function $delegated(req, profile, next){
+ config.logger.info('Using delegated auth strategy for user %s', profile.id);
+
+ let query = {
+ identifier: profile.id,
+ protocol: 'delegated'
+ };
+
+ return passport.connect(req, query, profile, next);
+ };
+}; | core.io-auth: adding delegated protocol imp; | goliatone_core.io-express-server | train | js |
8423ad978542bbf9cd42fac1d01da17036c80abd | diff --git a/src/Traits/HasRoles.php b/src/Traits/HasRoles.php
index <HASH>..<HASH> 100644
--- a/src/Traits/HasRoles.php
+++ b/src/Traits/HasRoles.php
@@ -174,6 +174,10 @@ trait HasRoles
return $this->roles->contains('name', $roles);
}
+ if (is_int($roles)) {
+ return $this->roles->contains('id', $roles);
+ }
+
if ($roles instanceof Role) {
return $this->roles->contains('id', $roles->id);
} | Check if user has role to id | spatie_laravel-permission | train | php |
718a92ceddf381cb2965c823138cabca0fa2bc12 | diff --git a/amino/either.py b/amino/either.py
index <HASH>..<HASH> 100644
--- a/amino/either.py
+++ b/amino/either.py
@@ -127,6 +127,14 @@ class Either(Generic[A, B], Implicits, implicits=True):
def json(self) -> B:
return self.to_maybe.json
+ def accum_error(self, b: 'Either[A, C]') -> 'Either[A, C]':
+ return self.accum_error_f(lambda: b)
+
+ def accum_error_f(self, f: Callable[[], 'Either[A, C]']) -> 'Either[A, C]':
+ def acc(v: A) -> None:
+ return Monoid.fatal(type(v)).combine(self.__left_value, v)
+ return f().lmap(acc) if self.is_left else self
+
class Right(Either): | `Either.accum_error` that combines monoidally on the left | tek_amino | train | py |
10d16d099d0d1bb1f7eae8d3099df8fc5852647b | diff --git a/right_scraper_base/lib/right_scraper_base/repository.rb b/right_scraper_base/lib/right_scraper_base/repository.rb
index <HASH>..<HASH> 100644
--- a/right_scraper_base/lib/right_scraper_base/repository.rb
+++ b/right_scraper_base/lib/right_scraper_base/repository.rb
@@ -205,7 +205,6 @@ module RightScale
module PATTERN
include URI::REGEXP::PATTERN
GIT_URI = Regexp.new("^(#{UNRESERVED}|#{ESCAPED})@(#{HOST}):(#{ABS_PATH})$")
- p GIT_URI
end
SSH_PORT = 22 | Whoops, delete debugging print. | rightscale_right_scraper | train | rb |
d3f158eaced8499e897eb4b46af727947496fd4c | diff --git a/crispy_forms/tests/test_layout.py b/crispy_forms/tests/test_layout.py
index <HASH>..<HASH> 100644
--- a/crispy_forms/tests/test_layout.py
+++ b/crispy_forms/tests/test_layout.py
@@ -540,9 +540,7 @@ def test_keepcontext_context_manager(settings):
InlineCheckboxes('alphacheckboxes'),
'numeric_multiple_checkboxes'
)
- request_factory = RequestFactory()
- request = request_factory.get('/')
- context = RequestContext(request, {'form': form})
+ context = {'form': form}
response = render_to_response('crispy_render_template.html', context) | bare dict instead of RequestContext | django-crispy-forms_django-crispy-forms | train | py |
4f23ca975a4232b0fd05e285855dfd9c9ecc9382 | diff --git a/lib/non-stupid-digest-assets.rb b/lib/non-stupid-digest-assets.rb
index <HASH>..<HASH> 100644
--- a/lib/non-stupid-digest-assets.rb
+++ b/lib/non-stupid-digest-assets.rb
@@ -37,16 +37,16 @@ module Sprockets
full_non_digest_gz_path = "#{full_non_digest_path}.gz"
if File.exists? full_digest_path
- logger.info "Writing #{full_non_digest_path}"
+ logger.debug "Writing #{full_non_digest_path}"
FileUtils.cp full_digest_path, full_non_digest_path
else
- logger.warn "Could not find: #{full_digest_path}"
+ logger.debug "Could not find: #{full_digest_path}"
end
if File.exists? full_digest_gz_path
- logger.info "Writing #{full_non_digest_gz_path}"
+ logger.debug "Writing #{full_non_digest_gz_path}"
FileUtils.cp full_digest_gz_path, full_non_digest_gz_path
else
- logger.warn "Could not find: #{full_digest_gz_path}"
+ logger.debug "Could not find: #{full_digest_gz_path}"
end
end
end | Change logger messages to debug
These are very noisy and not worth outputting in my opinion (and sprockets shares the same opinion: <URL>)
Not being able to find gz versions is perfectly fine since images won't have them, so you always get warnings which seems wrong. | alexspeller_non-stupid-digest-assets | train | rb |
bc92c92af6e8901ac32e18322610b0104f26482e | diff --git a/lib/conf/shared/panel.js b/lib/conf/shared/panel.js
index <HASH>..<HASH> 100644
--- a/lib/conf/shared/panel.js
+++ b/lib/conf/shared/panel.js
@@ -11,13 +11,16 @@ function setup_api() {
if (api) return api;
var opts = config.get('control-panel'),
- panel = plugins.require('control-panel');
+ panel = plugins.require('control-panel'),
+ init_opts = {};
if (!opts) {
console.log("Empty or outdated config file. Please run 'config activate' and retry.");
return process.exit(1);
}
+ opts.try_proxy = config.get('try_proxy');
+
api = panel.load_api(opts);
return api;
}
@@ -25,18 +28,18 @@ function setup_api() {
exports.verify_keys = function(keys, cb) {
setup_api();
api.keys.verify(keys, cb);
-}
+};
exports.authorize = function(opts, cb) {
setup_api();
api.accounts.authorize(opts, cb);
-}
+};
exports.signup = function(data, cb) {
setup_api();
api.accounts.signup(data, cb);
-}
+};
exports.link = function(cb) {
installed.enabled('control-panel', cb);
-}
+}; | Append try_proxy property to opts when initialising API from conf module. | prey_prey-node-client | train | js |
Subsets and Splits
Java Commits in Train Set
Queries for all entries where the diff_languages column is 'java', providing a filtered dataset but without deeper analysis.
Java Commits Test Data
Returns a subset of 5000 entries from the dataset where the programming language difference is Java, providing basic filtering for exploration.
Java Commits Sample
Retrieves the first 1,000 records where the 'diff_languages' column is 'java', providing limited insight into the specific data entries.
Java Commits Validation Sample
Retrieves a sample of entries from the validation dataset where the diff languages are Java, providing limited insight into specific Java-related data points.
Java Commits in Validation
This query retrieves a limited sample of entries from the validation dataset where the programming language difference is Java, providing basic filtering with minimal insight.
Java Commits Sample
This query retrieves a sample of 100 records where the 'diff_languages' is 'java', providing basic filtering but limited analytical value.
Java Commits Sample
Retrieves 100 samples where the language difference is Java, providing basic filtering but minimal analytical value.
Java Commits Sample
Retrieves 10 samples where the diff_languages column is 'java', providing basic examples of data entries with this specific language.
Java Commits Validation Sample
Retrieves 1,000 records where the differences in languages are marked as Java, providing a snapshot of that specific subset but limited to raw data.
Java Commits Sample
This query retrieves 1000 random samples from the dataset where the programming language is Java, offering limited insight beyond raw data.