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
|
---|---|---|---|---|---|
ec4bebd130f27cc966d8866a0f383002a70b0adc | diff --git a/tcex/tcex_batch_v2.py b/tcex/tcex_batch_v2.py
index <HASH>..<HASH> 100644
--- a/tcex/tcex_batch_v2.py
+++ b/tcex/tcex_batch_v2.py
@@ -788,7 +788,7 @@ class Group(object):
self._group_data['attribute'].append(attr.data)
else:
self.tcex.log.debug('Invalid attribute value ({}) for type ({}).'.format(
- attr.type, attr.value))
+ attr.value, attr.type))
# add security labels
if self._labels:
self._group_data['securityLabel'] = []
@@ -1271,6 +1271,9 @@ class Indicator(object):
for attr in self._attributes:
if attr.valid:
self._indicator_data['attribute'].append(attr.data)
+ else:
+ self.tcex.log.debug('Invalid attribute value ({}) for type ({}).'.format(
+ attr.value, attr.type))
# add file actions
if self._file_actions:
self._indicator_data.setdefault('fileAction', {})
@@ -1293,6 +1296,8 @@ class Indicator(object):
for tag in self._tags:
if tag.valid:
self._indicator_data['tag'].append(tag.data)
+ else:
+ self.tcex.log.debug('Invalid tag value ({}).'.format(tag.name))
return self._indicator_data
@property | + added validation of tag name and attribute value to prevent null values in JSON. | ThreatConnect-Inc_tcex | train | py |
bed0f7146ae91bbbc19a2e8f31cde745d0982e0a | diff --git a/csr/csr.go b/csr/csr.go
index <HASH>..<HASH> 100644
--- a/csr/csr.go
+++ b/csr/csr.go
@@ -274,6 +274,9 @@ func getHosts(cert *x509.Certificate) []string {
for _, dns := range cert.DNSNames {
hosts = append(hosts, dns)
}
+ for _, email := range cert.EmailAddresses {
+ hosts = append(hosts, email)
+ }
return hosts
} | added e-mail address retrieval to getHosts() | cloudflare_cfssl | train | go |
1dc48f8a03a75f43dc913856fe0c6633e69ad962 | diff --git a/stacktrace.go b/stacktrace.go
index <HASH>..<HASH> 100644
--- a/stacktrace.go
+++ b/stacktrace.go
@@ -23,10 +23,10 @@ type Stacktrace struct {
func (s *Stacktrace) Class() string { return "sentry.interfaces.Stacktrace" }
func (s *Stacktrace) Culprit() string {
- if len(s.Frames) > 0 {
- f := s.Frames[len(s.Frames)-1]
- if f.Module != "" && f.Function != "" {
- return f.Module + "." + f.Function
+ for i := len(s.Frames) - 1; i >= 0; i-- {
+ frame := s.Frames[i]
+ if *frame.InApp == true && frame.Module != "" && frame.Function != "" {
+ return frame.Module + "." + frame.Function
}
}
return "" | Only report in-app culprits.
Closes cupcake/raven-go#<I>.
Condense initializer | getsentry_raven-go | train | go |
7b4229aa1b95b2050b31cc93e38fda1a72258675 | diff --git a/pandas/tests/test_downstream.py b/pandas/tests/test_downstream.py
index <HASH>..<HASH> 100644
--- a/pandas/tests/test_downstream.py
+++ b/pandas/tests/test_downstream.py
@@ -92,6 +92,7 @@ def test_pandas_datareader():
pandas_datareader.get_data_google('AAPL')
[email protected](reason="install not working, gh-18780")
def test_geopandas():
geopandas = import_module('geopandas') # noqa | TST: xfail geopandas downstream test (#<I>)
xref #<I> | pandas-dev_pandas | train | py |
1dbeaa7499753b7e9d35c9acc179025c9491c653 | diff --git a/spec/unit/timeout_spec.rb b/spec/unit/timeout_spec.rb
index <HASH>..<HASH> 100644
--- a/spec/unit/timeout_spec.rb
+++ b/spec/unit/timeout_spec.rb
@@ -96,7 +96,7 @@ describe 'Flor unit' do
exid = @unit.launch(flon)
- sleep 0.350
+ sleep 0.777
expect(
@unit.timers.collect { |t| | Slow down timeout spec for JRuby | floraison_flor | train | rb |
b77445c07560f48a896770e482e5110eda33e9c2 | diff --git a/pyimgur/request.py b/pyimgur/request.py
index <HASH>..<HASH> 100644
--- a/pyimgur/request.py
+++ b/pyimgur/request.py
@@ -92,9 +92,12 @@ def send_request(url, params=None, method='GET', data_field='data',
if data_field is not None:
content = content[data_field]
if not resp.ok:
- error_msg = "Imgur ERROR message: {}".format(content['error'])
- print(error_msg)
- print("-" * len(error_msg))
+ try:
+ error_msg = "Imgur ERROR message: {}".format(content['error'])
+ print(error_msg)
+ print("-" * len(error_msg))
+ except Exception:
+ pass
resp.raise_for_status()
ratelimit_info = {key: int(value) for (key, value) in resp.headers.items()
if key.startswith('x-ratelimit')} | Wrap imgur error in try... except
If the response isn't json with a error key, such as a
<I> bad request, then the error handling would error out. | Damgaard_PyImgur | train | py |
2131fb0978fc01b61b9a90653237cbdd6f5b2950 | diff --git a/src/packet/secret_key.js b/src/packet/secret_key.js
index <HASH>..<HASH> 100644
--- a/src/packet/secret_key.js
+++ b/src/packet/secret_key.js
@@ -324,7 +324,7 @@ async function produceEncryptionKey(s2k, passphrase, algorithm) {
* @async
*/
SecretKey.prototype.decrypt = async function (passphrase) {
- if (this.s2k.type === 'gnu-dummy') {
+ if (this.s2k && this.s2k.type === 'gnu-dummy') {
this.isEncrypted = false;
return false;
}
@@ -336,8 +336,10 @@ SecretKey.prototype.decrypt = async function (passphrase) {
let key;
if (this.s2k_usage === 254 || this.s2k_usage === 253) {
key = await produceEncryptionKey(this.s2k, passphrase, this.symmetric);
+ } else if (this.s2k_usage === 255) {
+ throw new Error('Encrypted private key is authenticated using an insecure two-byte hash');
} else {
- throw new Error('Unsupported legacy encrypted key');
+ throw new Error('Private key is encrypted using an insecure S2K function: unsalted MD5');
}
let cleartext; | Fix error message for legacy encrypted private keys | openpgpjs_openpgpjs | train | js |
0ba21047b55f75f0a00a5ad7ac260cba577cfdd1 | diff --git a/src/Drupal/DrupalExtension/Context/DrupalContext.php b/src/Drupal/DrupalExtension/Context/DrupalContext.php
index <HASH>..<HASH> 100644
--- a/src/Drupal/DrupalExtension/Context/DrupalContext.php
+++ b/src/Drupal/DrupalExtension/Context/DrupalContext.php
@@ -195,7 +195,7 @@ class DrupalContext extends MinkContext implements DrupalAwareInterface, Transla
*
* @return \Behat\Mink\Element\NodeElement|NULL
*/
- private function getRegion($region) {
+ protected function getRegion($region) {
$session = $this->getSession();
$regionObj = $session->getPage()->find('region', $region);
if (!$regionObj) { | Issue #<I> by Vanille: Added Function to get region from region_map(). | jhedstrom_drupalextension | train | php |
38eb71989201803b0035ed42264f7d506fabe9a7 | diff --git a/src/java/voldemort/utils/ByteBufferBackedInputStream.java b/src/java/voldemort/utils/ByteBufferBackedInputStream.java
index <HASH>..<HASH> 100644
--- a/src/java/voldemort/utils/ByteBufferBackedInputStream.java
+++ b/src/java/voldemort/utils/ByteBufferBackedInputStream.java
@@ -56,7 +56,7 @@ public class ByteBufferBackedInputStream extends InputStream {
if(!buffer.hasRemaining())
return -1;
- return buffer.get();
+ return buffer.get() & 0xff;
}
@Override | Fixed error where negative byte values were read causing the DataInputStream to throw an EOFException. | voldemort_voldemort | train | java |
b2f07a56ea7fc14b26858a2e593d86e4be2dc198 | diff --git a/py/selenium/webdriver/remote/webelement.py b/py/selenium/webdriver/remote/webelement.py
index <HASH>..<HASH> 100644
--- a/py/selenium/webdriver/remote/webelement.py
+++ b/py/selenium/webdriver/remote/webelement.py
@@ -203,7 +203,10 @@ class WebElement(object):
return self._id
def __eq__(self, element):
- return self._id == element.id
+ if self._id == element.id
+ return True
+ else
+ return self._execute(Command.ELEMENT_EQUALS, {'other': element.id})['value']
# Private Methods
def _execute(self, command, params=None): | Bring python implementation of web element equality in conformance with
other languages | SeleniumHQ_selenium | train | py |
9487595965d0dc292f4d1b48c7e7d30b2ef5a1ce | diff --git a/register.js b/register.js
index <HASH>..<HASH> 100644
--- a/register.js
+++ b/register.js
@@ -1,9 +1,9 @@
var pug = require('./');
-var resolvedPug = require.resolve('./');
+var resolvedPug = JSON.stringify(require.resolve('./'));
function compileTemplate(module, filename) {
var template = pug.compileFileClient(filename, {inlineRuntimeFunctions: false});
- var body = "var pug = require('" + resolvedPug + "').runtime;\n\n" +
+ var body = "var pug = require(" + resolvedPug + ").runtime;\n\n" +
"module.exports = " + template + ";";
module._compile(body, filename);
} | Fixed register.js for Windows. (#<I>) | pugjs_then-pug | train | js |
8565c712a51de22bd8bd615c1e46496945294a42 | diff --git a/webhook/client_handler_test.go b/webhook/client_handler_test.go
index <HASH>..<HASH> 100644
--- a/webhook/client_handler_test.go
+++ b/webhook/client_handler_test.go
@@ -28,7 +28,7 @@ func Example() {
}
defer req.Body.Close()
- fmt.Fprintf(w, "Received signed event: %t", event)
+ fmt.Fprintf(w, "Received signed event: %v", event)
})
log.Fatal(http.ListenAndServe(":8080", nil))
} | Correct `Fprintf` format verb
Go-tip is failing because it looks like `Fprintf` got a little more
picky about the use of inappropriate verbs.
`%t` is meant to be used for booleans (it prints the word "true" or
"false"). I think what we actually wanted here was `%v`. | stripe_stripe-go | train | go |
50a86ee89168663049df806bbe98924a3d4df1c2 | diff --git a/tests/framework/web/CUploadedFileTest.php b/tests/framework/web/CUploadedFileTest.php
index <HASH>..<HASH> 100644
--- a/tests/framework/web/CUploadedFileTest.php
+++ b/tests/framework/web/CUploadedFileTest.php
@@ -100,7 +100,7 @@ class CUploadedFileTest extends CTestCase
*
* @see https://github.com/yiisoft/yii/issues/159
*/
- public function testGetInstanceByNamePartOfOtherName()
+ public function testGetInstancesByNamePartOfOtherName()
{
$baseInputName='base_name';
$tailedInputName=$baseInputName.'_tail';
@@ -120,7 +120,8 @@ class CUploadedFileTest extends CTestCase
'size'=>100,
);
- $uploadedFile=CUploadedFile::getInstanceByName($tailedInputName);
- $this->assertEquals($_FILES[$baseInputName]['name'],$uploadedFile->getName(),'Wrong file fetched!');
+ $uploadedFiles=CUploadedFile::getInstancesByName($baseInputName);
+ foreach($uploadedFiles as $uploadedFile)
+ $this->assertEquals($_FILES[$baseInputName]['name'],$uploadedFile->getName(),'Wrong file fetched!');
}
} | Test case "CUploadedFileTest::testGetInstancesByNamePartOfOtherName()" has been fixed to expose issue #<I>. | yiisoft_yii | train | php |
7007bafde9755a6314761c48b1103aec7b23866d | diff --git a/redash_client.py b/redash_client.py
index <HASH>..<HASH> 100644
--- a/redash_client.py
+++ b/redash_client.py
@@ -9,14 +9,12 @@ class RedashClient(object):
self.api_key = api_key
def new_query(self, name, query_string, data_source_id):
- r0 = requests.post(
+ query_id = requests.post(
self.BASE_URL + "/queries?api_key=" + self.api_key,
data = json.dumps({"name": name, "query": query_string, "data_source_id": data_source_id}),
- ).json()
-
- query_id = r0["id"]
+ ).json()["id"]
- r1 = requests.post(
+ requests.post(
self.BASE_URL + "/queries/" + str(query_id) + "/refresh?api_key=" + self.api_key
).json() | Cleaning up new_query() function. | mozilla_redash_client | train | py |
e32d79807f0babb86596b2d67e6bd2f0fc25e203 | diff --git a/tests/test_serialization.py b/tests/test_serialization.py
index <HASH>..<HASH> 100644
--- a/tests/test_serialization.py
+++ b/tests/test_serialization.py
@@ -15,6 +15,7 @@
from nose_parameterized import parameterized
from unittest import TestCase
+from zipline.finance.trading import TradingEnvironment
from .serialization_cases import (
object_serialization_cases,
@@ -36,6 +37,9 @@ def gather_bad_dicts(state):
class SerializationTestCase(TestCase):
+ @classmethod
+ def setUpClass(cls):
+ cls.env = TradingEnvironment.instance()
@parameterized.expand(object_serialization_cases())
def test_object_serialization(self, | TEST: Object serialization test requires a trading environment
The object serialization test case requires a trading environment
because risk report generation requires treasury curves. | quantopian_zipline | train | py |
cee6317edbc533711bfe60f205a02fbf685f591d | diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -13,6 +13,8 @@ setup(
include_package_data = True,
install_requires = [
'Django >= 1.6',
+ # Form helper.
+ 'django-crispy-forms >= 1.4',
# Needed for address field.
'django-countries >= 2.0',
], | Added django-crispy-forms dependency. | theduke_django-baseline | train | py |
532c49d1dbcd63decd9fa5037fc2510e5f955103 | diff --git a/src/Illuminate/Database/Seeder.php b/src/Illuminate/Database/Seeder.php
index <HASH>..<HASH> 100755
--- a/src/Illuminate/Database/Seeder.php
+++ b/src/Illuminate/Database/Seeder.php
@@ -2,6 +2,7 @@
namespace Illuminate\Database;
+use Illuminate\Support\Arr;
use InvalidArgumentException;
use Illuminate\Console\Command;
use Illuminate\Container\Container;
@@ -31,7 +32,7 @@ abstract class Seeder
*/
public function call($class, $silent = false)
{
- $classes = is_array($class) ? $class : (array) $class;
+ $classes = Arr::wrap($class);
foreach ($classes as $class) {
if ($silent === false && isset($this->command)) { | Use Arr::wrap when calling seeders (#<I>) | laravel_framework | train | php |
e51d4f33b47ed8af30c3e0f517b371f7f944195a | diff --git a/wss-agent-report/src/main/java/org/whitesource/agent/report/PolicyCheckReport.java b/wss-agent-report/src/main/java/org/whitesource/agent/report/PolicyCheckReport.java
index <HASH>..<HASH> 100644
--- a/wss-agent-report/src/main/java/org/whitesource/agent/report/PolicyCheckReport.java
+++ b/wss-agent-report/src/main/java/org/whitesource/agent/report/PolicyCheckReport.java
@@ -22,7 +22,6 @@ import freemarker.template.Configuration;
import freemarker.template.Template;
import freemarker.template.TemplateException;
import org.apache.commons.collections.MapUtils;
-import org.apache.commons.lang.StringEscapeUtils;
import org.apache.commons.lang.StringUtils;
import org.whitesource.agent.api.dispatch.BaseCheckPoliciesResult;
import org.whitesource.agent.api.model.PolicyCheckResourceNode;
@@ -242,7 +241,7 @@ public class PolicyCheckReport {
protected void writeToFile(File file, String json) throws IOException {
FileWriter fw = new FileWriter(file);
try {
- fw.write(StringEscapeUtils.unescapeJava(json));
+ fw.write(json);
fw.flush();
} finally {
FileUtils.close(fw); | WSE-<I> - undo escaping to the json | whitesource_agents | train | java |
a991f4cf262b6b6d98ca34a78935d6274e8a1611 | diff --git a/src/sap.ui.unified/src/sap/ui/unified/CalendarMonthInterval.js b/src/sap.ui.unified/src/sap/ui/unified/CalendarMonthInterval.js
index <HASH>..<HASH> 100644
--- a/src/sap.ui.unified/src/sap/ui/unified/CalendarMonthInterval.js
+++ b/src/sap.ui.unified/src/sap/ui/unified/CalendarMonthInterval.js
@@ -443,6 +443,8 @@ sap.ui.define(['jquery.sap.global', 'sap/ui/core/Control', 'sap/ui/core/LocaleDa
}
}
+ return this;
+
};
CalendarMonthInterval.prototype._getMonths = function(){
@@ -488,6 +490,8 @@ sap.ui.define(['jquery.sap.global', 'sap/ui/core/Control', 'sap/ui/core/LocaleDa
oYearPicker.setYears(6);
}
+ return this;
+
};
CalendarMonthInterval.prototype.setMinDate = function(oDate){ | [INTERNAL] sap.ui.unified.CalendarMonthInterval - Correct context is now returned from setters
-setMonths return correct context
- setPickerPopup return correct context
- Global qunit test will be added with gerrit change <I>
Change-Id: I<I>b<I>c<I>a4c4f5fc<I>e9ed<I>a<I>bc | SAP_openui5 | train | js |
14ecae9b1e2b125447dc0ea0d6e04363949b9d01 | diff --git a/build/gulpfile.hygiene.js b/build/gulpfile.hygiene.js
index <HASH>..<HASH> 100644
--- a/build/gulpfile.hygiene.js
+++ b/build/gulpfile.hygiene.js
@@ -225,14 +225,16 @@ const hygiene = exports.hygiene = (some, options) => {
});
}
- const program = tslint.Linter.createProgram("src/tsconfig.json");
+ const program = tslint.Linter.createProgram('src/tsconfig.json');
const configuration = tslint.Configuration.findConfiguration('tslint-hygiene.json', '.');
const tslintOptions = { fix: false, formatter: 'json' };
const linter = new tslint.Linter(tslintOptions, program);
const tsl = es.through(function (file) {
const contents = file.contents.toString('utf8');
- linter.lint(file.relative, contents, configuration.results);
+ if (file.relative.startsWith('src/')) { // only lint files in src program
+ linter.lint(file.relative, contents, configuration.results);
+ }
this.emit('data', file);
}); | ensure to only lint files in the src program | Microsoft_vscode | train | js |
90edd68d14987a6e95f4bca01c5658b148f28e4b | diff --git a/laravel/bootstrap/app.php b/laravel/bootstrap/app.php
index <HASH>..<HASH> 100644
--- a/laravel/bootstrap/app.php
+++ b/laravel/bootstrap/app.php
@@ -7,7 +7,7 @@ $DB_CONNECTION = $_SERVER['DB_CONNECTION'] ?? $_ENV['DB_CONNECTION'] ?? 'testin
$config = ['env' => ['APP_KEY="'.$APP_KEY.'"', 'DB_CONNECTION="'.$DB_CONNECTION.'"'], 'providers' => []];
-$app = (new Commander($config, realpath(__DIR__.'/../../')))->laravel();
+$app = (new Commander($config, getcwd()))->laravel();
unset($APP_KEY, $DB_CONNECTION, $config); | Use getcwd() to determine working path. | orchestral_testbench-core | train | php |
df30e675b0f170328cc0a39062e345b37933248f | diff --git a/phy/cluster/manual/session.py b/phy/cluster/manual/session.py
index <HASH>..<HASH> 100644
--- a/phy/cluster/manual/session.py
+++ b/phy/cluster/manual/session.py
@@ -61,6 +61,15 @@ class BaseSession(EventEmitter):
return func
+ @property
+ def actions(self):
+ """List of registered actions."""
+ return self._actions
+
+ def execute_action(self, action, *args, **kwargs):
+ """Execute an action defined by an item in the 'actions' list."""
+ action['func'](*args, **kwargs)
+
#------------------------------------------------------------------------------
# Store items
diff --git a/phy/cluster/manual/tests/test_session.py b/phy/cluster/manual/tests/test_session.py
index <HASH>..<HASH> 100644
--- a/phy/cluster/manual/tests/test_session.py
+++ b/phy/cluster/manual/tests/test_session.py
@@ -118,6 +118,10 @@ def test_action():
session.my_action()
assert _track == ['action']
+ assert session.actions == [{'func': my_action, 'title': 'My action'}]
+ session.execute_action(session.actions[0])
+ assert _track == ['action', 'action']
+
def test_action_event():
session = BaseSession() | Added actions property in session. Closes #<I>. | kwikteam_phy | train | py,py |
c99d29cf9345d3a21660ba9f2e06c3f06addb429 | diff --git a/src/_utils/reakitTheme.js b/src/_utils/reakitTheme.js
index <HASH>..<HASH> 100644
--- a/src/_utils/reakitTheme.js
+++ b/src/_utils/reakitTheme.js
@@ -22,6 +22,12 @@ const buildFontSizeFromTheme = (property, { theme, ...props }) => {
return `${property}: ${size}em !important;`;
};
+const buildFontWeightFromTheme = (property, { theme, ...props }) => {
+ let weight = theme.fannypack.fontWeights[props[_camelCase(property)]];
+ if (!weight) return;
+ return `${property}: ${weight} !important;`;
+};
+
export default {
Box: css`
/* If the color is one from the palette, use it. E.g. background-color="primary" */
@@ -55,5 +61,7 @@ export default {
${props => buildSpacingFromTheme('padding-bottom', props)};
${props => buildFontSizeFromTheme('font-size', props)};
+
+ ${props => buildFontWeightFromTheme('font-weight', props)};
`
}; | Add ability to specify font weight from theme for the fontWeight prop | fannypackui_fannypack | train | js |
2743e0bbee29cb86362d23dc822ce48d5b3d830e | diff --git a/test/mp/runtime/directives/class.spec.js b/test/mp/runtime/directives/class.spec.js
index <HASH>..<HASH> 100644
--- a/test/mp/runtime/directives/class.spec.js
+++ b/test/mp/runtime/directives/class.spec.js
@@ -254,4 +254,25 @@ describe(':class', () => {
expectRootClass('foo a')
}).then(done)
})
+
+ it('class merge between parent and child and only static class on parent', () => {
+ function expectRootClass (expected) {
+ expect(page.data.$root['0v0'].h[0].rcl).toBe(expected)
+ }
+
+ const pageOptions = {
+ mpType: 'page',
+ template: '<child class="a" ></child>',
+ data: { value: 'b' },
+ components: {
+ child: {
+ template: '<div class="c"></div>'
+ }
+ }
+ }
+
+ const { page } = createPage(pageOptions)
+
+ expectRootClass('a')
+ })
}) | test: add test for merging only static parent class | kaola-fed_megalo | train | js |
7381a4d287c6194433e91b304a5c7dff409cb6bf | diff --git a/lib/js/app/components/explorer/EmbedHTML.js b/lib/js/app/components/explorer/EmbedHTML.js
index <HASH>..<HASH> 100644
--- a/lib/js/app/components/explorer/EmbedHTML.js
+++ b/lib/js/app/components/explorer/EmbedHTML.js
@@ -65,6 +65,7 @@ class EmbedHTML extends Component {
propertyNames,
latest,
percentile,
+ chartType,
steps,
stepLabels = '',
} = this.props.ui;
@@ -109,7 +110,7 @@ class EmbedHTML extends Component {
params.push(` steps: [
${stepsParams.join(',\n ')}
]\n`);
-
+
if (stepLabels.length) {
stepLabelsString = `,\n labels: ${JSON.stringify(stepLabels)}`;
}
@@ -135,21 +136,22 @@ class EmbedHTML extends Component {
min-height: 300px;
}
</style>
-
+
<script>
const chart = new KeenDataviz({
container: '#demo_container', // querySelector
+ type: '${chartType}',
title: false ${
stepLabels && stepLabelsString ? stepLabelsString : ''
}
});
-
+
// Use keen-analysis.js to run a query
const client = new KeenAnalysis({
projectId: '${projectId}',
readKey: '${readKey}'
});
-
+
client
.query({
${params.join('')} }) | fix: 🐛 embed code
add chart type to embed code feature | keen_explorer | train | js |
36b11c530fb11c446ca47503f1a135d492ef7309 | diff --git a/lib/api/gitlab.js b/lib/api/gitlab.js
index <HASH>..<HASH> 100644
--- a/lib/api/gitlab.js
+++ b/lib/api/gitlab.js
@@ -498,7 +498,10 @@ async function createFile(branchName, filePath, fileContents, message) {
content: Buffer.from(fileContents).toString('base64'),
};
} else {
- url = `projects/${config.repoName}/repository/files/${filePath}`;
+ url = `projects/${config.repoName}/repository/files/${filePath.replace(
+ /\//g,
+ '%2F'
+ )}`;
opts.body = {
branch: branchName,
commit_message: message,
@@ -523,7 +526,10 @@ async function updateFile(branchName, filePath, fileContents, message) {
content: Buffer.from(fileContents).toString('base64'),
};
} else {
- url = `projects/${config.repoName}/repository/files/${filePath}`;
+ url = `projects/${config.repoName}/repository/files/${filePath.replace(
+ /\//g,
+ '%2F'
+ )}`;
opts.body = {
branch: branchName,
commit_message: message, | Fix: filepath encoding for gitlab createFile and updateFile (#<I>)
Relates to #<I> and #<I>
Auto detected file names are not encoded correctly so here's a fix for that. | renovatebot_renovate | train | js |
571e669313c16651fb59b7123dffd500b1eb5bc0 | diff --git a/container/lxd/container.go b/container/lxd/container.go
index <HASH>..<HASH> 100644
--- a/container/lxd/container.go
+++ b/container/lxd/container.go
@@ -270,7 +270,7 @@ func (s *Server) CreateContainerFromSpec(spec ContainerSpec) (*Container, error)
op, err := s.CreateContainerFromImage(spec.Image.LXDServer, *spec.Image.Image, req)
if err != nil {
if IsLXDAlreadyExists(err) {
- container, runningErr := s.waitForContainerToRunningState(spec, ephemeral)
+ container, runningErr := s.waitForRunningContainer(spec, ephemeral)
if runningErr != nil {
// It's actually more helpful to display the original error
// message, but we'll also log out what the new error message
@@ -312,7 +312,7 @@ func (s *Server) CreateContainerFromSpec(spec ContainerSpec) (*Container, error)
return &c, nil
}
-func (s *Server) waitForContainerToRunningState(spec ContainerSpec, ephemeral bool) (*api.Container, error) {
+func (s *Server) waitForRunningContainer(spec ContainerSpec, ephemeral bool) (*api.Container, error) {
var container *api.Container
err := retry.Call(retry.CallArgs{
Func: func() error { | Better naming for waiting for running state method | juju_juju | train | go |
ac87c7959921254bc0235da6634a54364b3abe8c | diff --git a/lib/beaker/hypervisor/vagrant.rb b/lib/beaker/hypervisor/vagrant.rb
index <HASH>..<HASH> 100644
--- a/lib/beaker/hypervisor/vagrant.rb
+++ b/lib/beaker/hypervisor/vagrant.rb
@@ -201,7 +201,8 @@ module Beaker
f.write(ssh_config)
f.rewind
- host['ssh'] = {:config => f.path()}
+
+ host['ssh'] = host['ssh'].merge(Net::SSH.configuration_for(host['ip'], f.path))
host['user'] = user
@temp_files << f
end | (BKR-<I>) Fix SSH settings in nodesets
Allow SSH settings from nodesets to propagate properly into the host's
SSH configuration.
BKR-<I> #close | puppetlabs_beaker-vagrant | train | rb |
5b563a30f3d671fc497299f04686bb71c4f78768 | diff --git a/nats/js/client.py b/nats/js/client.py
index <HASH>..<HASH> 100644
--- a/nats/js/client.py
+++ b/nats/js/client.py
@@ -303,7 +303,7 @@ class JetStreamContext(JetStreamManager):
if cb and not manual_ack:
cb = self._auto_ack_callback(cb)
if config.deliver_subject is None:
- config.deliver_subject = self._nc.new_inbox()
+ raise TypeError("config.deliver_subject is required")
sub = await self._nc.subscribe(
subject=config.deliver_subject,
queue=config.deliver_group or "", | require deliver_subject in JS subscribe_bind | nats-io_asyncio-nats | train | py |
5900a671160aaf8e2c606d98ae4439899fd1d6e6 | diff --git a/lib/negroku/modes/app.rb b/lib/negroku/modes/app.rb
index <HASH>..<HASH> 100644
--- a/lib/negroku/modes/app.rb
+++ b/lib/negroku/modes/app.rb
@@ -15,6 +15,7 @@ module Negroku::Modes
ask_features
custom_capify data
+ install_binstubs
end
@@ -37,6 +38,10 @@ module Negroku::Modes
end
+ def install_binstubs
+ `bundle binstub capistrano negroku`
+ end
+
# This code was exatracted from capistrano to be used with our own templates
# https://github.com/capistrano/capistrano/blob/68e7632c5f16823a09c324d556a208e096abee62/lib/capistrano/tasks/install.rake
def custom_capify(data={}, config=nil) | feat(app): run bundle binstub on app creation | platanus_negroku | train | rb |
b5bf89de628350e58514421150839318c1338c55 | diff --git a/src/main/java/org/junit/runners/model/FrameworkMethod.java b/src/main/java/org/junit/runners/model/FrameworkMethod.java
index <HASH>..<HASH> 100644
--- a/src/main/java/org/junit/runners/model/FrameworkMethod.java
+++ b/src/main/java/org/junit/runners/model/FrameworkMethod.java
@@ -69,6 +69,15 @@ public class FrameworkMethod {
+ " should have no parameters"));
}
+
+ /**
+ * Adds to {@code errors} if this method:
+ * <ul>
+ * <li>is not public, or
+ * <li>returns something other than void, or
+ * <li>is static (given {@code isStatic is false}), or
+ * <li>is not static (given {@code isStatic is true}).
+ */
public void validatePublicVoid(boolean isStatic, List<Throwable> errors) {
if (Modifier.isStatic(fMethod.getModifiers()) != isStatic) {
String state= isStatic ? "should" : "should not"; | Javadoc on FrameworkMethod augmented | junit-team_junit4 | train | java |
0b1041dd724ec963e44cf78fea2d2e7fa798432f | diff --git a/salt/cloud/clouds/vsphere.py b/salt/cloud/clouds/vsphere.py
index <HASH>..<HASH> 100644
--- a/salt/cloud/clouds/vsphere.py
+++ b/salt/cloud/clouds/vsphere.py
@@ -367,6 +367,9 @@ def _deploy(vm_):
),
'sudo_password': config.get_cloud_config_value(
'sudo_password', vm_, __opts__, default=None
+ ),
+ 'key_filename': config.get_cloud_config_value(
+ 'key_filename', vm_, __opts__, default=None
)
} | adding key_filename param to vsphere provider | saltstack_salt | train | py |
d0782ed7e81a181f0541e1ce7c8cba0825a80299 | diff --git a/src/event.js b/src/event.js
index <HASH>..<HASH> 100644
--- a/src/event.js
+++ b/src/event.js
@@ -72,12 +72,9 @@ jQuery.event = {
eventHandle = elemData.handle = function( e ) {
// Discard the second event of a jQuery.event.trigger() and
// when an event is called after a page has unloaded
- return typeof jQuery !== strundefined && (!e || jQuery.event.triggered !== e.type) ?
- jQuery.event.dispatch.apply( eventHandle.elem, arguments ) :
- undefined;
+ return typeof jQuery !== strundefined && jQuery.event.triggered !== e.type ?
+ jQuery.event.dispatch.apply( elem, arguments ) : undefined;
};
- // Add elem as a property of the handle fn to prevent a memory leak with IE non-native events
- eventHandle.elem = elem;
}
// Handle multiple events separated by a space
@@ -146,8 +143,6 @@ jQuery.event = {
jQuery.event.global[ type ] = true;
}
- // Nullify elem to prevent memory leaks in IE
- elem = null;
},
// Detach an event or set of events from an element | Event: Fix #<I>. Remove elem from event handle, close gh-<I>.
This also reduces memory leaks if the element is removed without cleaning
events (e.g with native DOM operations).
Not pickable into the 1.x branch because oldIE still needs this. | jquery_jquery | train | js |
be281ccecd95fa72e28d78537857f4ae47dba481 | diff --git a/src/utils/types.js b/src/utils/types.js
index <HASH>..<HASH> 100644
--- a/src/utils/types.js
+++ b/src/utils/types.js
@@ -59,6 +59,8 @@ const types = {
enableQueryRules: bool,
enableSearchRelevancy: bool,
recordAnalytics: bool,
+ emptyQuery: bool,
+ suggestionAnalytics: bool,
userId: string,
useCache: bool,
customEvents: object, // eslint-disable-line | fix: revert wrongly removed properties | appbaseio_reactivecore | train | js |
95eb0169da7bb5e726fb73dcf704c3785a98dc02 | diff --git a/Connection.php b/Connection.php
index <HASH>..<HASH> 100644
--- a/Connection.php
+++ b/Connection.php
@@ -73,6 +73,11 @@ use Yii;
class Connection extends Component
{
/**
+ * @event Event an event that is triggered after a DB connection is established
+ */
+ const EVENT_AFTER_OPEN = 'afterOpen';
+
+ /**
* @var string host:port
*
* Correct syntax is:
@@ -233,6 +238,7 @@ class Connection extends Component
$options['db'] = $this->defaultDatabaseName;
}
$this->mongoClient = new \MongoClient($this->dsn, $options);
+ $this->initConnection();
Yii::endProfile($token, __METHOD__);
} catch (\Exception $e) {
Yii::endProfile($token, __METHOD__);
@@ -253,4 +259,14 @@ class Connection extends Component
$this->_databases = [];
}
}
+
+ /**
+ * Initializes the DB connection.
+ * This method is invoked right after the DB connection is established.
+ * The default implementation triggers an [[EVENT_AFTER_OPEN]] event.
+ */
+ protected function initConnection()
+ {
+ $this->trigger(self::EVENT_AFTER_OPEN);
+ }
}
\ No newline at end of file | mongodb method "open" not triggered event "after open connection" | yiisoft_yii2-mongodb | train | php |
adcfa68a8ea5230d0ba74fbda8d78af726d96bf0 | diff --git a/lib/cloudformer/stack.rb b/lib/cloudformer/stack.rb
index <HASH>..<HASH> 100644
--- a/lib/cloudformer/stack.rb
+++ b/lib/cloudformer/stack.rb
@@ -105,7 +105,7 @@ class Stack
end
printed.concat(printable_events.map(&:event_id))
break if !stack.status.match(/_COMPLETE$/).nil?
- sleep(5)
+ sleep(30)
end
end
end
diff --git a/lib/cloudformer/version.rb b/lib/cloudformer/version.rb
index <HASH>..<HASH> 100644
--- a/lib/cloudformer/version.rb
+++ b/lib/cloudformer/version.rb
@@ -1,3 +1,3 @@
module Cloudformer
- VERSION = "0.0.6"
+ VERSION = "0.0.7"
end | Reducing the poll time for stack events. | kunday_cloudformer | train | rb,rb |
513f100c6541075608ec4834c6a62da69f2c753c | diff --git a/amaascore/transactions/mtm_result.py b/amaascore/transactions/mtm_result.py
index <HASH>..<HASH> 100644
--- a/amaascore/transactions/mtm_result.py
+++ b/amaascore/transactions/mtm_result.py
@@ -55,7 +55,7 @@ class MTMResult(AMaaSModel):
@mtm_value.setter
def mtm_value(self, val):
- if not isinstance(val, Decimal):
+ if not isinstance(val, Decimal) and val is not None:
self._mtm_value = Decimal(val)
else:
self._mtm_value = val
\ No newline at end of file
diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -11,7 +11,7 @@ requires = [
setup(
name='amaascore',
- version='0.5.18',
+ version='0.5.19',
description='Asset Management as a Service - Core SDK',
license='Apache License 2.0',
url='https://github.com/amaas-fintech/amaas-core-sdk-python', | made mtm_value nullable | amaas-fintech_amaas-core-sdk-python | train | py,py |
f344973938ea8643e387a6e98957833875290e98 | diff --git a/index.js b/index.js
index <HASH>..<HASH> 100644
--- a/index.js
+++ b/index.js
@@ -43,6 +43,9 @@ let request = module.exports._requestDefaults();
query.limit = query.limit || 50;
query.sort = query.sort || '_id';
+ const __no_skip__ = !!query.__no_skip__;
+ delete query.__no_skip__;
+
module.exports[type](query, function typeCb(typeErr, res, body) {
if (typeErr) { return done(typeErr); }
@@ -53,7 +56,7 @@ let request = module.exports._requestDefaults();
return done(null);
}
- if (!query.__no_skip__) {
+ if (!__no_skip__) {
query.skip += query.limit;
} | fix(api): prevent `__no_skip__` being sent as query parameter | Turbasen_turbasen.js | train | js |
d3626af431c9949b2e466a72d6b28ef727effb29 | diff --git a/lib/mongo/cluster.rb b/lib/mongo/cluster.rb
index <HASH>..<HASH> 100644
--- a/lib/mongo/cluster.rb
+++ b/lib/mongo/cluster.rb
@@ -472,19 +472,11 @@ module Mongo
end
def servers_list
- @update_lock.synchronize do
- @servers.reduce([]) do |servers, server|
- servers << server
- end
- end
+ @update_lock.synchronize { @servers.dup }
end
def addresses_list
- @update_lock.synchronize do
- @addresses.reduce([]) do |addresses, address|
- addresses << address
- end
- end
+ @update_lock.synchronize { @addresses.dup }
end
end
end | RUBY-<I> No reason to use reduce, just dup instead | mongodb_mongo-ruby-driver | train | rb |
af3af67609a67f43d851d3a248fe91a6e7d4c8ee | diff --git a/lib/pysynphot/spectrum.py b/lib/pysynphot/spectrum.py
index <HASH>..<HASH> 100644
--- a/lib/pysynphot/spectrum.py
+++ b/lib/pysynphot/spectrum.py
@@ -518,6 +518,12 @@ class CompositeSourceSpectrum(SourceSpectrum):
if self.operation == 'multiply':
return self.component1(wavelength) * self.component2(wavelength)
+ def __iter__(self):
+ """ Allow iteration over each component. """
+
+ complist = self.complist()
+ return complist.__iter__()
+
def complist(self):
ans=[]
for comp in (self.component1, self.component2): | Add an iterator to CompositeSourceSpectrum, for the use of callers that want to inspect its pieces
git-svn-id: <URL> | spacetelescope_pysynphot | train | py |
6f9afb3347b5bded80fbd700b36ffe837b2dcf93 | diff --git a/tests/unit/test_http.py b/tests/unit/test_http.py
index <HASH>..<HASH> 100644
--- a/tests/unit/test_http.py
+++ b/tests/unit/test_http.py
@@ -216,7 +216,6 @@ class TestHTTP(object):
conn = serve.recv()
for request in conn:
conn.socket.close()
- request.reply(vanilla.http.Status(200), {}, '.')
uri = 'http://localhost:%s' % serve.port
conn = h.http.connect(uri)
@@ -277,9 +276,7 @@ class TestWebsocket(object):
conn = serve.recv()
request = conn.recv()
ws = request.upgrade()
- # TODO: test close while a request is still pending
- # looks to be a bug in HTTPClient
- # ws.recv()
+ ws.recv()
ws.close()
uri = 'ws://localhost:%s' % serve.port | actually, it's fine .. just a timing issue which I'm not sure we care about | cablehead_vanilla | train | py |
85878079e52278c74f883b971c06fa6d7e7e12c4 | diff --git a/src/Codeception/Module/SOAP.php b/src/Codeception/Module/SOAP.php
index <HASH>..<HASH> 100644
--- a/src/Codeception/Module/SOAP.php
+++ b/src/Codeception/Module/SOAP.php
@@ -266,7 +266,7 @@ EOF;
public function seeSoapResponseEquals($xml)
{
$xml = SoapUtils::toXml($xml);
- $this->assertEquals($this->getXmlResponse()->C14N(), $xml->C14N());
+ $this->assertEquals($xml->C14N(), $this->getXmlResponse()->C14N());
}
/**
@@ -307,7 +307,7 @@ EOF;
public function dontSeeSoapResponseEquals($xml)
{
$xml = SoapUtils::toXml($xml);
- \PHPUnit_Framework_Assert::assertXmlStringNotEqualsXmlString($this->getXmlResponse()->C14N(), $xml->C14N());
+ \PHPUnit_Framework_Assert::assertXmlStringNotEqualsXmlString($xml->C14N(), $this->getXmlResponse()->C14N());
} | inverse expected and actual (#<I>) | Codeception_base | train | php |
4f49c47df7261e1fcc4eeeff121e81c3e75bc08c | diff --git a/src/main/java/picocli/AbbreviationMatcher.java b/src/main/java/picocli/AbbreviationMatcher.java
index <HASH>..<HASH> 100644
--- a/src/main/java/picocli/AbbreviationMatcher.java
+++ b/src/main/java/picocli/AbbreviationMatcher.java
@@ -92,16 +92,16 @@ class AbbreviationMatcher {
private static boolean startsWith(String str, String prefix, boolean caseInsensitive) {
if (prefix.length() > str.length()) {
return false;
- } else if (isHyphenPrefix(str)) {
+ } else if (isNonAlphabetic(str)) {
return str.equals(prefix);
}
String strPrefix = str.substring(0, prefix.length());
return caseInsensitive ? strPrefix.equalsIgnoreCase(prefix) : strPrefix.equals(prefix);
}
- private static boolean isHyphenPrefix(String prefix) {
- for (char ch : prefix.toCharArray()) {
- if (ch != '-') { return false; }
+ private static boolean isNonAlphabetic(String str) {
+ for (int i = 0; i < str.length(); i++) {
+ if (Character.isLetterOrDigit(str.codePointAt(i))) { return false; }
}
return true;
} | Change isHyphenPrefix to isNonAlphabetic to match splitIntoChunks | remkop_picocli | train | java |
dac59ef36b8211ad9f6b97fe47fc168fd8dd05c9 | diff --git a/masonite/providers/AppProvider.py b/masonite/providers/AppProvider.py
index <HASH>..<HASH> 100644
--- a/masonite/providers/AppProvider.py
+++ b/masonite/providers/AppProvider.py
@@ -75,7 +75,7 @@ class AppProvider(ServiceProvider):
Autoload(self.app).load(directories)
def _set_application_debug_level(self):
- if self.app.make('Application').DEBUG == 'True':
+ if self.app.make('Application').DEBUG is 'True':
self.app.make('Application').DEBUG == True
elif self.app.make('Application').DEBUG == 'False':
- self.app.make('Application').DEBUG == False
+ self.app.make('Application').DEBUG is False | E<I> comparison to False should be 'if cond is False:' or 'if not cond:' | MasoniteFramework_masonite | train | py |
261ec470cf690ef36448495d0443e1e82a00a617 | diff --git a/spec/decorators/socializer/person_decorator_spec.rb b/spec/decorators/socializer/person_decorator_spec.rb
index <HASH>..<HASH> 100644
--- a/spec/decorators/socializer/person_decorator_spec.rb
+++ b/spec/decorators/socializer/person_decorator_spec.rb
@@ -7,7 +7,6 @@ module Socializer
let(:decorated_person) { PersonDecorator.new(person) }
context "#avatar_url" do
-
context "when the provider is Facebook, LinkedIn, or Twitter" do
let(:authentication_attributes) do
{ provider: provider.downcase, | extra empty line detected at block body beginning | socializer_socializer | train | rb |
f0f43a4f531da286d775ae017416c6173aea6c01 | diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -1,21 +1,5 @@
-import sys
-from setuptools import setup, Command
-
-
-class Tox(Command):
-
- user_options = []
-
- def initialize_options(self):
- pass
-
- def finalize_options(self):
- pass
-
- def run(self):
- import tox
- sys.exit(tox.cmdline([]))
+from setuptools import setup, find_packages
setup(
@@ -27,10 +11,7 @@ setup(
'FastMurmur2': ['Murmur>=0.1.3'],
},
- tests_require=["tox", "mock"],
- cmdclass={"test": Tox},
-
- packages=["afkak"],
+ packages=find_packages(),
zip_safe=True,
@@ -59,5 +40,5 @@ high-level consumer and producer classes. Request batching is supported by the
protocol as well as broker-aware request routing. Gzip and Snappy compression
is also supported for message sets.
""",
- keywords=['Kafka client', 'distributed messaging']
+ keywords=['Kafka client', 'distributed messaging', 'txkafka']
) | Remove Tox runner from setup.py
This isn't used to run Tox by the Makefile, so it's just dead code with
unfortunate dependency installation implications. | ciena_afkak | train | py |
aa77470ae773911ad8e4c4f9b24d013528b97778 | diff --git a/lib/smartsheet/client.rb b/lib/smartsheet/client.rb
index <HASH>..<HASH> 100644
--- a/lib/smartsheet/client.rb
+++ b/lib/smartsheet/client.rb
@@ -46,7 +46,7 @@ module Smartsheet
request_logger =
logger ?
- API::RequestLogger.new(logger, log_full_body) :
+ API::RequestLogger.new(logger, log_full_body: log_full_body) :
API::MuteRequestLogger.new
token = token_env_var if token.nil? | Ensure log_full_body is a named param. | smartsheet-platform_smartsheet-ruby-sdk | train | rb |
b71a630c557ad3c4dec60a4a33a950f5f15566d5 | diff --git a/response.go b/response.go
index <HASH>..<HASH> 100644
--- a/response.go
+++ b/response.go
@@ -68,6 +68,16 @@ func (r *Response) fixCharset(detectCharset bool, defaultEncoding string) error
return nil
}
contentType := strings.ToLower(r.Headers.Get("Content-Type"))
+
+ if strings.Contains(contentType, "image/") ||
+ strings.Contains(contentType, "video/") ||
+ strings.Contains(contentType, "audio/") ||
+ strings.Contains(contentType, "font/") {
+ // These MIME types should not have textual data.
+
+ return nil
+ }
+
if !strings.Contains(contentType, "charset") {
if !detectCharset {
return nil | Ignore certain MIME types in fixCharset
Some MIME types do not involve any text data and should not be processed
in fixCharset. This should be done instead of forcing the user to
toggle the Collector.DetectCharset flag as it could prove problematic.
Fix #<I> | gocolly_colly | train | go |
40e3ce44683b2d444bd02298851071aa4aae74f2 | diff --git a/shopify/base.py b/shopify/base.py
index <HASH>..<HASH> 100644
--- a/shopify/base.py
+++ b/shopify/base.py
@@ -137,16 +137,10 @@ class ShopifyResource(ActiveResource, mixins.Countable):
self._update(self.__class__.format.decode(response.body))
def __get_id(self):
- if self.klass.primary_key != "id":
- return self.attributes.get(self.klass.primary_key)
- else:
- return super(ShopifyResource, self).id
+ return self.attributes.get(self.klass.primary_key)
def __set_id(self, value):
- if self.klass.primary_key != "id":
- self.attributes[self.klass.primary_key] = value
- else:
- super(ShopifyResource, self).id = value
+ self.attributes[self.klass.primary_key] = value
id = property(__get_id, __set_id, None, 'Value stored in the primary key') | Fix id property compatibility with latest pyactiveresource. | Shopify_shopify_python_api | train | py |
50f07af81d5b3cdf62dc1c593dac70debc5c73ae | diff --git a/lib/plugins/disco.js b/lib/plugins/disco.js
index <HASH>..<HASH> 100644
--- a/lib/plugins/disco.js
+++ b/lib/plugins/disco.js
@@ -168,7 +168,7 @@ module.exports = function (client, stanzas) {
client.registerFeature('caps', 100, function (features, cb) {
this.emit('disco:caps', {
- from: new JID(client.jid.domain),
+ from: new JID(client.jid.domain || client.config.server),
caps: features.caps
});
this.features.negotiated.caps = true; | Fallback to use configured server for stream feature caps | legastero_stanza.io | train | js |
fb8bd8f1b979faef8733853065536fc7db111612 | diff --git a/distribute_setup.py b/distribute_setup.py
index <HASH>..<HASH> 100644
--- a/distribute_setup.py
+++ b/distribute_setup.py
@@ -47,7 +47,7 @@ except ImportError:
return os.spawnl(os.P_WAIT, sys.executable, *args) == 0
DEFAULT_VERSION = "0.6.13"
-DEFAULT_URL = "http://pypi.python.org/packages/source/d/distribute/"
+DEFAULT_URL = "https://pypi.python.org/packages/source/d/distribute/"
SETUPTOOLS_FAKED_VERSION = "0.6c11"
SETUPTOOLS_PKG_INFO = """\ | Fix: PyPi only supports HTTPS/TLS downloads now | explorigin_Rocket | train | py |
4379504be1d001a0d36faed23e4fca03c5add237 | diff --git a/report/src/main/java/com/buschmais/jqassistant/core/report/api/graph/SubGraphFactory.java b/report/src/main/java/com/buschmais/jqassistant/core/report/api/graph/SubGraphFactory.java
index <HASH>..<HASH> 100644
--- a/report/src/main/java/com/buschmais/jqassistant/core/report/api/graph/SubGraphFactory.java
+++ b/report/src/main/java/com/buschmais/jqassistant/core/report/api/graph/SubGraphFactory.java
@@ -94,6 +94,9 @@ public final class SubGraphFactory {
relationship.setEndNode(endNode);
relationship.getProperties().putAll(properties);
relationship.setLabel((String) virtualObject.get(LABEL));
+ if (startNode == null || endNode == null || type == null) {
+ throw new ReportException("The virtual relationship does not contain either start node, end node or type: " + relationship);
+ }
return (I) relationship;
case GRAPH:
SubGraph subgraph = new SubGraph(); | throw exception in SubGraphFactory if a provided virtual relationship is inconsistent | buschmais_jqa-core-framework | train | java |
1b533d4b4be9ea26210d2afbdc639c865ce48157 | diff --git a/features/support/demo_app.rb b/features/support/demo_app.rb
index <HASH>..<HASH> 100644
--- a/features/support/demo_app.rb
+++ b/features/support/demo_app.rb
@@ -13,7 +13,7 @@ class DemoApp
end
def teardown
- [@app, @test_app].each do |app|
+ all_apks do |app|
puts "Removing #{app[:package]}..."
uninstall app[:package]
end
@@ -21,7 +21,7 @@ class DemoApp
private
def install_app
- [@app, @test_app].each do |app|
+ all_apks do |app|
puts "Installing #{app[:apk]}..."
install app[:apk]
end
@@ -34,6 +34,12 @@ class DemoApp
forward local, host
end
+ def all_apks(&block)
+ [@app, @test_app].each do |app|
+ block.call app
+ end
+ end
+
def start
shell "am instrument -e packageName #{@app[:package]} -e fullLauncherName #{@app[:package]}.ApiDemos -e class com.leandog.gametel.driver.TheTest #{@test_app[:package]}/com.leandog.gametel.driver.GametelInstrumentation"
sleep 2 | refactor apks.each into block call | leandog_brazenhead | train | rb |
7e6cb9c13132e7b5f07276be58617bca6e0074fb | diff --git a/src/main/java/de/timroes/axmlrpc/serializer/DateTimeSerializer.java b/src/main/java/de/timroes/axmlrpc/serializer/DateTimeSerializer.java
index <HASH>..<HASH> 100644
--- a/src/main/java/de/timroes/axmlrpc/serializer/DateTimeSerializer.java
+++ b/src/main/java/de/timroes/axmlrpc/serializer/DateTimeSerializer.java
@@ -24,6 +24,8 @@ public class DateTimeSerializer implements Serializer {
}
public Object deserialize(String dateStr) throws XMLRPCException {
+ if (dateStr==null || dateStr.trim().length()==0)
+ return null;
try {
return Iso8601Deserializer.toDate(dateStr);
} catch (Exception ex) { | Return empty datetime elements as NULL | gturri_aXMLRPC | train | java |
915f87c260dd3ec45d89042d870ba6caf64716c3 | diff --git a/evfl/timeline.py b/evfl/timeline.py
index <HASH>..<HASH> 100644
--- a/evfl/timeline.py
+++ b/evfl/timeline.py
@@ -71,20 +71,20 @@ class Oneshot(BinaryObject):
class Cut(BinaryObject):
def __init__(self) -> None:
super().__init__()
- self.duration = -1.0 # TODO: is this correct?
+ self.start_time = -1.0 # TODO: is this correct?
self.x4 = 0xffffffff # TODO: what is this?
self.name = ''
self.params: typing.Optional[Container] = None
self._params_offset_writer: typing.Optional[PlaceholderWriter] = None
def _do_read(self, stream: ReadStream) -> None:
- self.duration = stream.read_f32()
+ self.start_time = stream.read_f32()
self.x4 = stream.read_u32()
self.name = stream.read_string_ref()
self.params = stream.read_ptr_object(Container)
def _do_write(self, stream: WriteStream) -> None:
- stream.write(f32(self.duration))
+ stream.write(f32(self.start_time))
stream.write(u32(self.x4))
stream.write_string_ref(self.name)
self._params_offset_writer = stream.write_placeholder_ptr_if(bool(self.params)) | timeline: Fix cut structure
The float is not a duration; it seems to be the start time. | zeldamods_evfl | train | py |
4565e04eee74ab1166f861814e727460cff07e10 | diff --git a/snmpsim/grammar/snmprec.py b/snmpsim/grammar/snmprec.py
index <HASH>..<HASH> 100644
--- a/snmpsim/grammar/snmprec.py
+++ b/snmpsim/grammar/snmprec.py
@@ -47,7 +47,5 @@ class SnmprecGrammar(AbstractGrammar):
rfc1902.IpAddress.tagSet):
nval = value.asNumbers()
for x in nval:
- if x in self.alnums:
+ if x not in self.alnums:
return ''.join([ '%.2x' % x for x in nval ])
- else:
- return value | hopefully final fix to hexifyValue() | etingof_snmpsim | train | py |
4c182edfcbec9196ec0b027a8aacd249a1b3b1a3 | diff --git a/queue/queue.go b/queue/queue.go
index <HASH>..<HASH> 100644
--- a/queue/queue.go
+++ b/queue/queue.go
@@ -147,7 +147,7 @@ func (q *Queue) Run(c *colly.Collector) error {
q.finish()
continue
}
- r.Retry(true)
+ r.Do()
q.finish()
}
}(c, wg)
diff --git a/request.go b/request.go
index <HASH>..<HASH> 100644
--- a/request.go
+++ b/request.go
@@ -137,8 +137,13 @@ func (r *Request) PostMultipart(URL string, requestData map[string][]byte) error
}
// Retry submits HTTP request again with the same parameters
-func (r *Request) Retry(checkRevisit bool) error {
- return r.collector.scrape(r.URL.String(), r.Method, r.Depth, r.Body, r.Ctx, *r.Headers, checkRevisit)
+func (r *Request) Retry() error {
+ return r.collector.scrape(r.URL.String(), r.Method, r.Depth, r.Body, r.Ctx, *r.Headers, false)
+}
+
+// Do submits the request
+func (r *Request) Do() error {
+ return r.collector.scrape(r.URL.String(), r.Method, r.Depth, r.Body, r.Ctx, *r.Headers, r.collector.AllowURLRevisit)
}
// Marshal serializes the Request | Add Request.Do() method which repects AllowURLRevisit | gocolly_colly | train | go,go |
6fff9c4ca236616b74d3d21fd0d9060169d8eaef | diff --git a/test/aggregate_tests.rb b/test/aggregate_tests.rb
index <HASH>..<HASH> 100644
--- a/test/aggregate_tests.rb
+++ b/test/aggregate_tests.rb
@@ -42,7 +42,10 @@ class TestSensuAggregate < TestCase
assert_equal(2, body[:outputs].size)
assert(body[:results].is_a?(Array))
assert_equal(2, body[:results].size)
- done
+ api_request('/aggregates/check_http', :delete) do |http, body|
+ assert_equal(204, http.response_header.status)
+ done
+ end
end
end
end | [aggregate-limit] minor delete aggregate test | sensu_sensu | train | rb |
b033cf26b8b6ef5a61922f9abcc9a9b7ef4e8885 | diff --git a/lib/engine-client.js b/lib/engine-client.js
index <HASH>..<HASH> 100644
--- a/lib/engine-client.js
+++ b/lib/engine-client.js
@@ -16,6 +16,22 @@ exports.version = '0.1.0';
exports.protocol = 1;
/**
+ * Utils.
+ *
+ * @api public
+ */
+
+exports.util = require('./util');
+
+/**
+ * Parser.
+ *
+ * @api public
+ */
+
+exports.parser = require('./parser');
+
+/**
* Socket constructor.
*
* @api public. | Exposed util and parser. | socketio_engine.io-client | train | js |
1c4a8bfc671282c002e39fd67afd5f4ccef0ee4c | diff --git a/kafka/consumer/fetcher.py b/kafka/consumer/fetcher.py
index <HASH>..<HASH> 100644
--- a/kafka/consumer/fetcher.py
+++ b/kafka/consumer/fetcher.py
@@ -492,8 +492,7 @@ class Fetcher(six.Iterator):
def _create_fetch_requests(self):
"""Create fetch requests for all assigned partitions, grouped by node.
- FetchRequests skipped if no leader, node has requests in flight, or we
- have not returned all previously fetched records to consumer
+ FetchRequests skipped if no leader, or node has requests in flight
Returns:
dict: {node_id: [FetchRequest,...]}
@@ -509,9 +508,7 @@ class Fetcher(six.Iterator):
" Requesting metadata update", partition)
self._client.cluster.request_update()
elif self._client.in_flight_request_count(node_id) == 0:
- # if there is a leader and no in-flight requests,
- # issue a new fetch but only fetch data for partitions whose
- # previously fetched data has been consumed
+ # fetch if there is a leader and no in-flight requests
position = self._subscriptions.assignment[partition].position
partition_info = (
partition.partition, | Update docstring and comments in _create_fetch_requests re KAFKA-<I> | dpkp_kafka-python | train | py |
97bc5b260d52f26915b60bf9d583081c9ac57c8e | diff --git a/server/peer_server.go b/server/peer_server.go
index <HASH>..<HASH> 100644
--- a/server/peer_server.go
+++ b/server/peer_server.go
@@ -122,6 +122,8 @@ func NewPeerServer(name string, path string, url string, bindAddr string, tlsCon
s.raftServer.AddEventListener(raft.HeartbeatTimeoutEventType, s.raftEventLogger)
s.raftServer.AddEventListener(raft.ElectionTimeoutThresholdEventType, s.raftEventLogger)
+ s.raftServer.AddEventListener(raft.HeartbeatEventType, s.recordMetricEvent)
+
return s
}
@@ -499,6 +501,12 @@ func (s *PeerServer) raftEventLogger(event raft.Event) {
}
}
+func (s *PeerServer) recordMetricEvent(event raft.Event) {
+ name := fmt.Sprintf("raft.event.%s", event.Type())
+ value := event.Value().(time.Duration)
+ (*s.metrics).Timer(name).Update(value)
+}
+
func (s *PeerServer) monitorSnapshot() {
for {
time.Sleep(s.snapConf.checkingInterval) | feat(metrics): Publish peer heartbeat events as metrics | etcd-io_etcd | train | go |
3dadbe13b9e90546d50a46ad6a0028352f900bec | diff --git a/src/main/java/com/samskivert/util/Randoms.java b/src/main/java/com/samskivert/util/Randoms.java
index <HASH>..<HASH> 100644
--- a/src/main/java/com/samskivert/util/Randoms.java
+++ b/src/main/java/com/samskivert/util/Randoms.java
@@ -146,18 +146,20 @@ public class Randoms
* Pick a random key from the specified mapping of weight values, or return
* <code>ifEmpty</code> if no mapping has a weight greater than 0.
*
+ * <p><b>Implementation note:</b> a random number is generated for every entry with a
+ * non-zero weight.
+ *
* @throws IllegalArgumentException if any weight is less than 0.
*/
public <T> T pick (Map<? extends T, ? extends Number> weightMap, T ifEmpty)
{
T pick = ifEmpty;
- double r = _r.nextDouble();
double total = 0.0;
for (Map.Entry<? extends T, ? extends Number> entry : weightMap.entrySet()) {
double weight = entry.getValue().doubleValue();
if (weight > 0.0) {
total += weight;
- if ((r * total) < weight) {
+ if ((_r.nextDouble() * total) < weight) {
pick = entry.getKey();
}
} else if (weight < 0.0) { | What was I thinking?: we can't just pick a random number once.
Unsmoke that crack.
git-svn-id: <URL> | samskivert_samskivert | train | java |
dd434fb71b7ce5bdbb29e93be666c0ff6b09b159 | diff --git a/builtin/providers/aws/resource_aws_db_subnet_group_test.go b/builtin/providers/aws/resource_aws_db_subnet_group_test.go
index <HASH>..<HASH> 100644
--- a/builtin/providers/aws/resource_aws_db_subnet_group_test.go
+++ b/builtin/providers/aws/resource_aws_db_subnet_group_test.go
@@ -107,6 +107,7 @@ resource "aws_subnet" "bar" {
resource "aws_db_subnet_group" "foo" {
name = "foo"
+ description = "foo description"
subnet_ids = ["${aws_subnet.foo.id}", "${aws_subnet.bar.id}"]
}
` | providers/aws: add description to test
cc/ @buth
Looks like the schema was correctly defining description as required,
added it to the tests and it's passing now. | hashicorp_terraform | train | go |
6fe95f7da39fa00aac1604c4b206fb087acd709c | diff --git a/core/Pimf/Util/Validator.php b/core/Pimf/Util/Validator.php
index <HASH>..<HASH> 100644
--- a/core/Pimf/Util/Validator.php
+++ b/core/Pimf/Util/Validator.php
@@ -295,7 +295,9 @@ class Validator
protected function middleware($fieldName, $comparing, $operator, $expecting)
{
if (in_array($operator, array("<", ">", "==", "<=", ">="), true)) {
- $func = create_function('$a,$b', 'return ($a ' . '' . $operator . ' $b);');
+ $func = function($a,$b) use ($operator) {
+ return ($a.' '.$operator.' '.$b);
+ };
return ($func($comparing, $expecting) === true) ?: $this->error($fieldName, $operator);
} | refactoring of create_function()
- that has been deprecated in PHP <I>
- and will be removed from PHP in the next major version. | gjerokrsteski_pimf-framework | train | php |
3da5aea1f5d5796c857911fc0a37b210267e0690 | diff --git a/lxd/db/db_internal_test.go b/lxd/db/db_internal_test.go
index <HASH>..<HASH> 100644
--- a/lxd/db/db_internal_test.go
+++ b/lxd/db/db_internal_test.go
@@ -63,7 +63,7 @@ func (s *dbTestSuite) CreateTestDb() (*Cluster, func()) {
s.Nil(err)
}
- db, cleanup := NewTestCluster(s.T())
+ db, cleanup := NewTestCluster(s.T().(*testing.T))
return db, cleanup
} | lxd/db: Fix for new testify | lxc_lxd | train | go |
00c7ac3c870c8bcc1480ec1d0a1d5ccfecd3fc63 | diff --git a/src/python/dxpy/utils/resolver.py b/src/python/dxpy/utils/resolver.py
index <HASH>..<HASH> 100644
--- a/src/python/dxpy/utils/resolver.py
+++ b/src/python/dxpy/utils/resolver.py
@@ -227,7 +227,7 @@ def resolve_container_id_or_name(raw_string, is_error=False, unescape=True, mult
return ([cached_project_names[string]] if multi else cached_project_names[string])
try:
- results = list(dxpy.find_projects(name=string, describe=True))
+ results = list(dxpy.find_projects(name=string, describe=True, level='LIST'))
except BaseException as details:
raise ResolutionError(str(details)) | dxpy.utils.resolver: fixed bug where it would not resolve projects for which you have < CONTRIBUTE access | dnanexus_dx-toolkit | train | py |
2e0451490717fd06370856cc3e9c4ed35327471e | diff --git a/pybromo/timestamps.py b/pybromo/timestamps.py
index <HASH>..<HASH> 100644
--- a/pybromo/timestamps.py
+++ b/pybromo/timestamps.py
@@ -171,14 +171,14 @@ class TimestapSimulation:
print('%s Donor timestamps - %s' % (header, ctime()), flush=True)
self.S.simulate_timestamps_mix(
populations = self.populations,
- max_rates = self.max_rates_d,
- bg_rate = self.bg_rate_d,
+ max_rates = self.params['em_rates_d'],
+ bg_rate = self.params['bg_rate_d'],
**kwargs)
print('%s Acceptor timestamps - %s' % (header, ctime()), flush=True)
self.S.simulate_timestamps_mix(
populations = self.populations,
- max_rates = self.max_rates_a,
- bg_rate = self.bg_rate_a,
+ max_rates = self.params['em_rates_d'],
+ bg_rate = self.params['bg_rate_d'],
**kwargs)
print('%s Completed. %s' % (header, ctime()), flush=True) | Fix TimestampSimulation from previous update | tritemio_PyBroMo | train | py |
0e1bb94b576e83edcbeec6f2da56bebdbb1cc9d1 | diff --git a/libnavigation-ui/src/main/java/com/mapbox/navigation/ui/route/NavigationMapRoute.java b/libnavigation-ui/src/main/java/com/mapbox/navigation/ui/route/NavigationMapRoute.java
index <HASH>..<HASH> 100644
--- a/libnavigation-ui/src/main/java/com/mapbox/navigation/ui/route/NavigationMapRoute.java
+++ b/libnavigation-ui/src/main/java/com/mapbox/navigation/ui/route/NavigationMapRoute.java
@@ -277,6 +277,7 @@ public class NavigationMapRoute implements LifecycleObserver {
public void addProgressChangeListener(MapboxNavigation navigation, boolean vanishRouteLineEnabled) {
this.navigation = navigation;
this.vanishRouteLineEnabled = vanishRouteLineEnabled;
+ this.mapRouteProgressChangeListener = buildMapRouteProgressChangeListener();
navigation.registerRouteProgressObserver(mapRouteProgressChangeListener);
} | added update to listener that was erroneously omitted | mapbox_mapbox-navigation-android | train | java |
5d9df01c21603dff098ab02802083fb9b7f85624 | diff --git a/terminal/output.go b/terminal/output.go
index <HASH>..<HASH> 100644
--- a/terminal/output.go
+++ b/terminal/output.go
@@ -6,13 +6,13 @@ import (
"io"
)
-// Returns special stdout, which converts escape sequences to Windows API calls
+// NewAnsiStdout returns special stdout, which converts escape sequences to Windows API calls
// on Windows environment.
func NewAnsiStdout(out FileWriter) io.Writer {
return out
}
-// Returns special stderr, which converts escape sequences to Windows API calls
+// NewAnsiStderr returns special stderr, which converts escape sequences to Windows API calls
// on Windows environment.
func NewAnsiStderr(out FileWriter) io.Writer {
return out | Fix function comments based on best practices from Effective Go (#<I>) | AlecAivazis_survey | train | go |
c7fd3ff2cc77fa1bf161c09cf0067d7fd286745f | diff --git a/gibica/interpreter.py b/gibica/interpreter.py
index <HASH>..<HASH> 100644
--- a/gibica/interpreter.py
+++ b/gibica/interpreter.py
@@ -115,7 +115,14 @@ class Interpreter(NodeVisitor):
def visit_Assignment(self, node):
"""Visitor for `Assignment` AST node."""
- self.memory[node.left.identifier.name] = self.visit(node.right)
+ obj_memory = self.memory[node.left.identifier.name]
+ obj_program = self.visit(node.right)
+ if obj_memory is not None:
+ obj_program_value = obj_program.value
+ obj_program = obj_memory
+ obj_program.value = obj_program_value
+
+ self.memory[node.left.identifier.name] = obj_program
def visit_Variable(self, node):
"""Visitor for `Variable` AST node.""" | Better memory management of mutable variables | matthieugouel_gibica | train | py |
054d88f7c3526d9fa792fbe6670a6b871694aa06 | diff --git a/library/src/main/java/de/mrapp/android/dialog/MaterialDialog.java b/library/src/main/java/de/mrapp/android/dialog/MaterialDialog.java
index <HASH>..<HASH> 100644
--- a/library/src/main/java/de/mrapp/android/dialog/MaterialDialog.java
+++ b/library/src/main/java/de/mrapp/android/dialog/MaterialDialog.java
@@ -706,6 +706,16 @@ public class MaterialDialog extends Dialog implements DialogInterface {
}
/**
+ * Returns the context, which is used by the builder.
+ *
+ * @return The context, which is used by the builder, as an instance of the class {@link
+ * Context}
+ */
+ public final Context getContext() {
+ return context;
+ }
+
+ /**
* Sets the color of the title of the dialog, which is created by the builder.
*
* @param color | Added getContext-method to Builder. | michael-rapp_AndroidMaterialDialog | train | java |
c2fcc07a89fbfc0612a965074865e36f709a65ed | diff --git a/project_generator/project.py b/project_generator/project.py
index <HASH>..<HASH> 100644
--- a/project_generator/project.py
+++ b/project_generator/project.py
@@ -471,19 +471,23 @@ class Project:
def _set_output_dir_path(self, tool, workspace_path):
if self.pgen_workspace.settings.generated_projects_dir != self.pgen_workspace.settings.generated_projects_dir_default:
+ # global settings defined, replace keys pgen is familiar, this overrides anything in the project
output_dir = Template(self.pgen_workspace.settings.generated_projects_dir)
output_dir = output_dir.substitute(target=self.project['target'], workspace=self._get_workspace_name(),
project_name=self.name, tool=tool)
else:
if self.project['export_dir'] == self.pgen_workspace.settings.generated_projects_dir_default:
+ # if export_dir is not defined we use tool_name for a project
project_name = "%s_%s" % (tool, self.name)
else:
project_name = ""
+ # TODO: below works only if we are using default export dir, will blow up with user defined paths
if workspace_path:
output_dir = os.path.join(self.project['export_dir'], workspace_path, project_name)
else:
output_dir = os.path.join(self.project['export_dir'], project_name)
self.pgen_workspace.settings.generated_projects_dir_default
+ # After all adjusting , set the output_dir path, which tools will use to export a project
self.project['output_dir']['path'] = os.path.normpath(output_dir)
@staticmethod | Project - set output dir path - add comments | project-generator_project_generator | train | py |
49ef237a9929a4f76ac5b6f24c4718504478cad4 | diff --git a/aws/resource_aws_secretsmanager_secret_policy_test.go b/aws/resource_aws_secretsmanager_secret_policy_test.go
index <HASH>..<HASH> 100644
--- a/aws/resource_aws_secretsmanager_secret_policy_test.go
+++ b/aws/resource_aws_secretsmanager_secret_policy_test.go
@@ -28,7 +28,7 @@ func testSweepSecretsManagerSecretPolicies(region string) error {
}
conn := client.(*AWSClient).secretsmanagerconn
- err = conn.ListSecretsPages(&secretsmanager.ListSecretsInput{}, func(page *secretsmanager.ListSecretsOutput, isLast bool) bool {
+ err = conn.ListSecretsPages(&secretsmanager.ListSecretsInput{}, func(page *secretsmanager.ListSecretsOutput, lastPage bool) bool {
if len(page.SecretList) == 0 {
log.Print("[DEBUG] No Secrets Manager Secrets to sweep")
return true
@@ -51,7 +51,7 @@ func testSweepSecretsManagerSecretPolicies(region string) error {
}
}
- return !isLast
+ return !lastPage
})
if err != nil {
if testSweepSkipSweepError(err) { | tests/r/secretsmanager_secret_policy: Use consistent var name | terraform-providers_terraform-provider-aws | train | go |
79f48d93e9a1be1744e86a405f3089f7c0143035 | diff --git a/Form/Type/ImmutableArrayType.php b/Form/Type/ImmutableArrayType.php
index <HASH>..<HASH> 100644
--- a/Form/Type/ImmutableArrayType.php
+++ b/Form/Type/ImmutableArrayType.php
@@ -21,9 +21,12 @@ class ImmutableArrayType extends AbstractType
public function buildForm(FormBuilder $builder, array $options)
{
foreach($options['keys'] as $infos) {
- list($name, $type, $options) = $infos;
-
- $builder->add($name, $type, $options);
+ if ($infos instanceof FormBuilder) {
+ $builder->add($infos);
+ } else {
+ list($name, $type, $options) = $infos;
+ $builder->add($name, $type, $options);
+ }
}
} | mmutableArrayType buildForm with FormBuilder as option | sonata-project_SonataAdminBundle | train | php |
78f555d7f5d193f5204c50df5d0fea2de12dbba5 | diff --git a/aikif/project.py b/aikif/project.py
index <HASH>..<HASH> 100644
--- a/aikif/project.py
+++ b/aikif/project.py
@@ -80,11 +80,6 @@ class Project(object):
res += t.name + '\n'
return res
- def add_goal(self, goal_id, name, due_date=None, priority=None):
- """
- adds a goal for the project
- """
- self.goals.append([goal_id, name, due_date, priority])
def add_task(self, task):
"""
@@ -93,13 +88,6 @@ class Project(object):
self.tasks.append(task)
- def add_link(self, src_id, dest_id, src_type='Goal', dest_type='Task'):
- """
- creates links for the projects, mainly for tasks to goals
- but also for folders to projects
- """
- self.links.append([src_id, dest_id, src_type, dest_type])
-
def add_source(self, name, location, schedule='Daily', op=''):
"""
handles the data sources used in projects, mainly as an | removed project functions add_link add_goal | acutesoftware_AIKIF | train | py |
93f838b8b8e0df0556aabb363e438751d09dc753 | diff --git a/neo4jrestclient/query.py b/neo4jrestclient/query.py
index <HASH>..<HASH> 100644
--- a/neo4jrestclient/query.py
+++ b/neo4jrestclient/query.py
@@ -215,7 +215,7 @@ class Q(BaseQ):
op_not = self._not.get_query_objects(params=params,
version=version)
params.update(op_not[1])
- query = u"NOT ( {0} )".format(op_not[0])
+ query = u"True = NOT ( {0} )".format(op_not[0])
elif self._or is not None:
left_or = self._or[0].get_query_objects(params=params,
version=version) | Update NOT check to in query.Q to use True=NOT() | versae_neo4j-rest-client | train | py |
41d4b89d44a168c384a27ce04efc07a8fad7c8f7 | diff --git a/lib/workable/client.rb b/lib/workable/client.rb
index <HASH>..<HASH> 100644
--- a/lib/workable/client.rb
+++ b/lib/workable/client.rb
@@ -57,7 +57,7 @@ module Workable
when 404
raise Errors::NotFound, response.body
when 503
- raise Errors::RequestToLong, "Response code: #{response.code}"
+ raise Errors::RequestToLong, response.body
when proc { |code| code != 200 }
raise Errors::InvalidResponse, "Response code: #{response.code}"
end | We know it's <I>, let's return body as message | emq_workable | train | rb |
cb10be18e3911d57141cd8cd5c18df90d34f2bf3 | diff --git a/index.js b/index.js
index <HASH>..<HASH> 100644
--- a/index.js
+++ b/index.js
@@ -35,8 +35,10 @@ module.exports = {
var headerConfig = appConfig.contentSecurityPolicy;
if (options.liveReload) {
- headerConfig['connect-src'] = headerConfig['connect-src'] + ' ws://localhost:' + options.liveReloadPort;
- headerConfig['script-src'] = headerConfig['script-src'] + ' localhost:' + options.liveReloadPort;
+ ['localhost', '0.0.0.0'].forEach(function(host) {
+ headerConfig['connect-src'] = headerConfig['connect-src'] + ' ws://' + host + ':' + options.liveReloadPort;
+ headerConfig['script-src'] = headerConfig['script-src'] + ' ' + host + ':' + options.liveReloadPort;
+ });
}
var headerValue = Object.keys(headerConfig).reduce(function(memo, value) { | Allow both <I> and localhost for livereload. | rwjblue_ember-cli-content-security-policy | train | js |
f20b526903a4fa1abbfa080fcef1e6602f06173e | diff --git a/lib/bootstrap.js b/lib/bootstrap.js
index <HASH>..<HASH> 100644
--- a/lib/bootstrap.js
+++ b/lib/bootstrap.js
@@ -38,7 +38,7 @@ module.exports = function(options, db) {
}, function(err, file) {
if (!file) {
- fs.createReadStream(appPath + '/public/lib/bootstrap/dist/css/bootstrap.css').pipe(res);
+ fs.createReadStream(config.root + '/bower_components/bootstrap/dist/css/bootstrap.css').pipe(res);
} else {
// streaming to gridfs
var readstream = gfs.createReadStream({
@@ -65,7 +65,8 @@ module.exports = function(options, db) {
res.send(mean.aggregated.css);
});
- app.use('/public', express.static(config.root + '/public'));
+ app.use('/packages', express.static(config.root + '/packages'));
+ app.use('/bower_components', express.static(config.root + '/bower_components'));
mean.events.on('modulesEnabled', function() { | update path to bower_components | linnovate_mean-cli | train | js |
770f1e8bfab4ba9576cf399e8785bdd02a3832c9 | diff --git a/src/SVGImage.php b/src/SVGImage.php
index <HASH>..<HASH> 100644
--- a/src/SVGImage.php
+++ b/src/SVGImage.php
@@ -20,8 +20,8 @@ class SVGImage
private $document;
/**
- * @param int $width The image's width, in pixels.
- * @param int $height The image's height, in pixels.
+ * @param string $width The image's width (any CSS length).
+ * @param string $height The image's height (any CSS length).
* @param string[] $namespaces An optional array of additional namespaces.
*/
public function __construct($width, $height, array $namespaces = array()) | Fix misleading SVGImage constructor doc comment
The size does not have to be in pixels, and neither of type int. | meyfa_php-svg | train | php |
151dec5caf5d7e3b0715bda4ea44f51931123def | diff --git a/kernel/content/ezcontentoperationcollection.php b/kernel/content/ezcontentoperationcollection.php
index <HASH>..<HASH> 100644
--- a/kernel/content/ezcontentoperationcollection.php
+++ b/kernel/content/ezcontentoperationcollection.php
@@ -283,9 +283,9 @@ class eZContentOperationCollection
$tmpRes =& eZNodeviewfunctions::generateNodeView( $tpl, $parentNode, $parentNode->attribute( 'object' ), $language, $viewMode, 0, $cacheFileArray['cache_dir'], $cacheFileArray['cache_path'], true );
}
}
- // Restore the old user as the current one
- $user->setCurrentlyLoggedInUser( $user, $user->attribute( 'contentobject_id' ) );
}
+ // Restore the old user as the current one
+ $user->setCurrentlyLoggedInUser( $user, $user->attribute( 'contentobject_id' ) );
$GLOBALS['eZCurrentAccess']['name'] = $currentSiteAccess;
$res->setDesignSetting( $currentSiteAccess, 'site' ); | #- Moved the restoration of the current user (PreGeneration) to outside of
# the siteaccess loop.
# (Manually merged from stable/<I> (<I>) rev. <I>)
git-svn-id: file:///home/patrick.allaert/svn-git/ezp-repo/ezpublish/trunk@<I> a<I>eee8c-daba-<I>-acae-fa<I>f<I> | ezsystems_ezpublish-legacy | train | php |
366225f07cb8fea3809487e0b38bcf3fa491d621 | diff --git a/lib/Model.js b/lib/Model.js
index <HASH>..<HASH> 100644
--- a/lib/Model.js
+++ b/lib/Model.js
@@ -150,7 +150,7 @@ function Model(opts) {
if (data.length === 0) {
return cb(new Error("Not found"));
}
- Singleton.get(opts.table + "/" + id, {
+ Singleton.get(opts.driver.uid + "/" + opts.table + "/" + id, {
cache : options.cache,
save_check : opts.settings.get("instance.cacheSaveCheck")
}, function (cb) {
@@ -226,7 +226,7 @@ function Model(opts) {
merge : merge,
offset : options.offset,
newInstance: function (data, cb) {
- Singleton.get(opts.table + (merge ? "+" + merge.from.table : "") + "/" + data[opts.id], {
+ Singleton.get(opts.driver.uid + "/" + opts.table + (merge ? "+" + merge.from.table : "") + "/" + data[opts.id], {
cache : options.cache,
save_check : opts.settings.get("instance.cacheSaveCheck")
}, function (cb) { | Changes singleton uid creation to use driver uid (#<I>) | dresende_node-orm2 | train | js |
00480082307c69893c68dce20ffd7e351276b0f1 | diff --git a/core/core.go b/core/core.go
index <HASH>..<HASH> 100644
--- a/core/core.go
+++ b/core/core.go
@@ -117,7 +117,7 @@ type Config struct {
Vault struct {
Address string `yaml:"address" env:"SHIELD_VAULT_ADDRESS"`
- CACert string `yaml:"ca" env:"SHIELD_VAULT_CA"`
+ CACert string `yaml:"ca" env:"SHIELD_VAULT_CA"`
} `yaml:"vault"`
Mbus struct {
@@ -126,11 +126,11 @@ type Config struct {
} `yaml:"mbus"`
Prometheus struct {
- Namespace string `yaml:"namespace"`
+ Namespace string `yaml:"namespace" env:"SHIELD_PROMETHEUS_NAMESPACE"`
- Username string `yaml:"username"`
- Password string `yaml:"password"`
- Realm string `yaml:"realm"`
+ Username string `yaml:"username" env:"SHIELD_PROMETHEUS_USERNAME"`
+ Password string `yaml:"password" env:"SHIELD_PROMETHEUS_PASSWORD"`
+ Realm string `yaml:"realm" env:"SHIELD_PROMETHEUS_REALM"`
} `yaml:"prometheus"`
Cipher string `yaml:"cipher" env:"SHIELD_CIPHER"` | More environment configuration in SHIELD core | starkandwayne_shield | train | go |
a7d13ecf2b925f7e452a90d8abb756fbfefdee4f | diff --git a/grade/report/user/externallib.php b/grade/report/user/externallib.php
index <HASH>..<HASH> 100644
--- a/grade/report/user/externallib.php
+++ b/grade/report/user/externallib.php
@@ -115,6 +115,9 @@ class gradereport_user_external extends external_api {
require_once($CFG->dirroot . '/grade/lib.php');
require_once($CFG->dirroot . '/grade/report/user/lib.php');
+ // Force regrade to update items marked as 'needupdate'.
+ grade_regrade_final_grades($course->id);
+
$gpr = new grade_plugin_return(
array(
'type' => 'report', | MDL-<I> gradereport_user: Force regrade in external function | moodle_moodle | train | php |
bed41d6c9d6be1f35e5134e08b88c20f1772d364 | diff --git a/semantic_version/base.py b/semantic_version/base.py
index <HASH>..<HASH> 100644
--- a/semantic_version/base.py
+++ b/semantic_version/base.py
@@ -91,13 +91,13 @@ class Version(object):
return int(value)
def next_major(self):
- if self.prerelease and self.minor is 0 and self.patch is 0:
+ if self.prerelease and self.minor == 0 and self.patch == 0:
return Version('.'.join(str(x) for x in [self.major, self.minor, self.patch]))
else:
return Version('.'.join(str(x) for x in [self.major + 1, 0, 0]))
def next_minor(self):
- if self.prerelease and self.patch is 0:
+ if self.prerelease and self.patch == 0:
return Version('.'.join(str(x) for x in [self.major, self.minor, self.patch]))
else:
return Version( | Don't use `is` for integer comparisons.
Closes #<I>. | rbarrois_python-semanticversion | train | py |
b6bd1177b40d1ad1077502baa91afd7040ccb84c | diff --git a/sdjournal/journal.go b/sdjournal/journal.go
index <HASH>..<HASH> 100644
--- a/sdjournal/journal.go
+++ b/sdjournal/journal.go
@@ -736,14 +736,13 @@ func (j *Journal) GetEntry() (*JournalEntry, error) {
entry.MonotonicTimestamp = uint64(monotonicUsec)
var c *C.char
- defer C.free(unsafe.Pointer(c))
-
r = C.my_sd_journal_get_cursor(sd_journal_get_cursor, j.cjournal, &c)
if r < 0 {
return nil, fmt.Errorf("failed to get cursor: %d", syscall.Errno(-r))
}
entry.Cursor = C.GoString(c)
+ C.free(unsafe.Pointer(c))
// Implements the JOURNAL_FOREACH_DATA_RETVAL macro from journal-internal.h
var d unsafe.Pointer
@@ -842,7 +841,6 @@ func (j *Journal) GetCursor() (string, error) {
}
var d *C.char
- defer C.free(unsafe.Pointer(d))
j.mu.Lock()
r := C.my_sd_journal_get_cursor(sd_journal_get_cursor, j.cjournal, &d)
@@ -853,6 +851,7 @@ func (j *Journal) GetCursor() (string, error) {
}
cursor := C.GoString(d)
+ C.free(unsafe.Pointer(d))
return cursor, nil
} | sdjournal: free correct pointer
Since defer creates a closure, it ends up freeing the wrong
pointer in these situations (i.e. not the one that ends up
getting allocated by asprintf during the actual sdjournal
call). | coreos_go-systemd | train | go |
3ebd0a7d0084ffa8b0c4a304508aedd9bebcf89f | diff --git a/server/storage/backend/backend_test.go b/server/storage/backend/backend_test.go
index <HASH>..<HASH> 100644
--- a/server/storage/backend/backend_test.go
+++ b/server/storage/backend/backend_test.go
@@ -32,7 +32,7 @@ func TestBackendClose(t *testing.T) {
b, _ := betesting.NewTmpBackend(t, time.Hour, 10000)
// check close could work
- done := make(chan struct{})
+ done := make(chan struct{}, 1)
go func() {
err := b.Close()
if err != nil { | fixing the goroutine leak in TestBackendClose | etcd-io_etcd | train | go |
006b9b126dca278db450d164a2f402268a545b6f | diff --git a/cli/command/config/remove_test.go b/cli/command/config/remove_test.go
index <HASH>..<HASH> 100644
--- a/cli/command/config/remove_test.go
+++ b/cli/command/config/remove_test.go
@@ -77,6 +77,7 @@ func TestConfigRemoveContinueAfterError(t *testing.T) {
cmd := newConfigRemoveCommand(cli)
cmd.SetArgs(names)
+ cmd.SetOutput(ioutil.Discard)
assert.EqualError(t, cmd.Execute(), "error removing config: foo")
assert.Equal(t, names, removedConfigs)
} | fixed the output leak from error test case for config/remove | docker_cli | train | go |
b77dd718226291bd699cb5d3a8eebda8cb05c275 | diff --git a/src/cf/terminal/ui.go b/src/cf/terminal/ui.go
index <HASH>..<HASH> 100644
--- a/src/cf/terminal/ui.go
+++ b/src/cf/terminal/ui.go
@@ -50,8 +50,7 @@ func (c TerminalUI) Ok() {
func (c TerminalUI) Failed(message string) {
c.Say(FailureColor("FAILED"))
c.Say(message)
-
- return
+ os.Exit(1)
}
func (c TerminalUI) FailWithUsage(ctxt *cli.Context, cmdName string) { | exit with status 1 on failure
[#<I>] | cloudfoundry_cli | train | go |
bf0e1cab44563004082aff7e92ed0ccc7a5744fe | diff --git a/code/editor/EditableCheckboxGroupField.php b/code/editor/EditableCheckboxGroupField.php
index <HASH>..<HASH> 100755
--- a/code/editor/EditableCheckboxGroupField.php
+++ b/code/editor/EditableCheckboxGroupField.php
@@ -65,7 +65,7 @@ class EditableCheckboxGroupField extends EditableFormField {
continue;
}
- if($data[$option->ID]) {
+ if(isset($data[$option->ID])) {
$option->populateFromPostData( $data[$option->ID] );
} | BUGFIX added isset to [->ID] | silverstripe_silverstripe-userforms | train | php |
f44ded1e869190ea7ddceab57496ebee9e67343a | diff --git a/lib/components/Redoc/redoc.js b/lib/components/Redoc/redoc.js
index <HASH>..<HASH> 100644
--- a/lib/components/Redoc/redoc.js
+++ b/lib/components/Redoc/redoc.js
@@ -12,8 +12,8 @@ import {ChangeDetectionStrategy} from 'angular2/angular2';
providers: [SchemaManager],
templateUrl: './lib/components/Redoc/redoc.html',
styleUrls: ['./lib/components/Redoc/redoc.css'],
- directives: [ApiInfo, MethodsList, SideMenu]
- //changeDetection: ChangeDetectionStrategy.Default
+ directives: [ApiInfo, MethodsList, SideMenu],
+ changeDetection: ChangeDetectionStrategy.Default
})
export default class Redoc extends BaseComponent {
constructor(schemaMgr) { | uncomment changeDetection spec in redoc | Rebilly_ReDoc | train | js |
01419ef8b349a92555cd911f5dd8629ea33aab30 | diff --git a/core/server/models/base/index.js b/core/server/models/base/index.js
index <HASH>..<HASH> 100644
--- a/core/server/models/base/index.js
+++ b/core/server/models/base/index.js
@@ -118,6 +118,7 @@ ghostBookshelf.Model = ghostBookshelf.Model.extend({
debug(model.tableName, event);
if (!options.transacting) {
+ debug(`event: ${event}`);
return common.events.emit(event, model, options);
}
@@ -137,6 +138,7 @@ ghostBookshelf.Model = ghostBookshelf.Model.extend({
}
_.each(this.ghostEvents, (ghostEvent) => {
+ debug(`event: ${event}`);
common.events.emit(ghostEvent, model, _.omit(options, 'transacting'));
}); | Added base model debug log for events
no issue | TryGhost_Ghost | train | js |
0ebd3338d6499857244250ab15bff1e0e3fe9a3c | diff --git a/addon/components/tour-start-button.js b/addon/components/tour-start-button.js
index <HASH>..<HASH> 100644
--- a/addon/components/tour-start-button.js
+++ b/addon/components/tour-start-button.js
@@ -195,9 +195,9 @@ export default Ember.Component.extend({
let tour = get(this, 'tour');
let callout = get(this, 'callout');
let placement = get(this, 'calloutPlacement') || 'top';
- let [target] = this.$().children();
+ let target = this.$().children().get(0);
- if (tour && callout) {
+ if (tour && callout && target) {
tourManager.addCallout(tour, {
calloutMessage: callout,
placement, | Do not use array deconstructing on jQuery collection
This caused the code to fail on environments where Symbol is not natively available (e.g. IE or phantomjs) | mydea_ember-site-tour | train | js |
343733120455a3f872d932b1c6f0ac0d4f4e7974 | diff --git a/tests/PosPaymentTest.php b/tests/PosPaymentTest.php
index <HASH>..<HASH> 100644
--- a/tests/PosPaymentTest.php
+++ b/tests/PosPaymentTest.php
@@ -62,7 +62,6 @@ class PosPaymentTest extends TestCase
$this->validateApiPermission($e);
}
- print $result;
$this->assertTrue(isset($result['SaleToPOIResponse']));
$this->assertEquals('Success', $result['SaleToPOIResponse']['PaymentResponse']['Response']['Result']); | PW-<I>: removed print statement | Adyen_adyen-php-api-library | train | php |
12cc387dba0c377df6c5276cbc8ca95c955263aa | diff --git a/go/vt/vtadmin/cluster/cluster.go b/go/vt/vtadmin/cluster/cluster.go
index <HASH>..<HASH> 100644
--- a/go/vt/vtadmin/cluster/cluster.go
+++ b/go/vt/vtadmin/cluster/cluster.go
@@ -211,14 +211,20 @@ func New(ctx context.Context, cfg Config) (*Cluster, error) {
// to avoid data races in tests (the latter of these is caused by the cache
// goroutines).
//
-// Sub-components of the cluster are `Close`-d concurrently.
+// Sub-components of the cluster are `Close`-d concurrently, caches first, then
+// proxy connections.
func (c *Cluster) Close() error {
var (
wg sync.WaitGroup
rec concurrency.AllErrorRecorder
)
- for _, closer := range []io.Closer{c.DB, c.Vtctld, c.schemaCache} {
+ // First, close any caches, which may have connections to DB or Vtctld
+ // (N.B. (andrew) when we have multiple caches, we can close them
+ // concurrently, like we do with the proxies).
+ rec.RecordError(c.schemaCache.Close())
+
+ for _, closer := range []io.Closer{c.DB, c.Vtctld} {
wg.Add(1)
go func(closer io.Closer) {
defer wg.Done() | Fix data race in vtadmin (#<I>)
The schema cache has a backfill goroutine running which depends on the
clutser's Vtctld, so there's a more subtle `Close` ordering dependency
here.
It's okay (and good!) to close caches concurrently, and proxy connections
concurrently, but never concurrently _with each other_, and always do the
caches first. | vitessio_vitess | train | go |
7c1901e301d79475b45773b1d2e031f4889633e6 | diff --git a/src/livestreamer/plugins/tvcatchup.py b/src/livestreamer/plugins/tvcatchup.py
index <HASH>..<HASH> 100644
--- a/src/livestreamer/plugins/tvcatchup.py
+++ b/src/livestreamer/plugins/tvcatchup.py
@@ -25,7 +25,7 @@ class TVCatchup(Plugin):
stream_url = match.groupdict()["stream_url"]
if stream_url:
- return {"720p": HLSStream(self.session, stream_url)}
+ return HLSStream.parse_variant_playlist(self.session, stream_url)
__plugin__ = TVCatchup | tvcatchup now returns a variant playlist | streamlink_streamlink | train | py |
b5a2ea8125b896d3e7b1d9ade96d25fc22c5d68b | diff --git a/client/http_client.go b/client/http_client.go
index <HASH>..<HASH> 100644
--- a/client/http_client.go
+++ b/client/http_client.go
@@ -11,10 +11,10 @@ import (
"os"
"path/filepath"
"regexp"
- "text/template"
+ "strconv"
"strings"
+ "text/template"
"time"
- "strconv"
)
const NON_VERBOSE = "NON_VERBOSE"
@@ -177,7 +177,7 @@ func (slc *HttpClient) makeHttpRequest(url string, requestType string, requestBo
SL_API_RETRY_COUNT = 5
}
- for i:=1; i<=SL_API_RETRY_COUNT; i++ {
+ for i := 1; i <= SL_API_RETRY_COUNT; i++ {
resp, err = slc.HTTPClient.Do(req)
if err != nil {
if !strings.Contains(err.Error(), "i/o timeout") || i > SL_API_RETRY_COUNT {
@@ -189,7 +189,7 @@ func (slc *HttpClient) makeHttpRequest(url string, requestType string, requestBo
break
}
- time.Sleep(SL_API_WAIT_TIME * time.Second)
+ time.Sleep(time.Duration(SL_API_WAIT_TIME) * time.Second)
}
defer resp.Body.Close() | Need to cast to time.Duration | maximilien_softlayer-go | train | go |
e17410ce1b4e7b21570858b60051615a84c31f9c | diff --git a/xmantissa/tdb.py b/xmantissa/tdb.py
index <HASH>..<HASH> 100644
--- a/xmantissa/tdb.py
+++ b/xmantissa/tdb.py
@@ -142,6 +142,7 @@ class TabularDataModel:
# hasNextPage and hasPrevPage methosd. We gracefully handle it
# anyway simply because we expect multiple frontends for this
# model, and multiple frontends means lots of places for bugs.
+ self.totalItems = self.totalPages = 0
return
self._currentResults = results
self._paginate() | ensure "totalItems" and "totalPages" are always attributes of the TDM, even if their values are 0. | twisted_mantissa | train | py |
c17ed636bf596b0c51d01ae38952b88438fd031b | diff --git a/index.js b/index.js
index <HASH>..<HASH> 100644
--- a/index.js
+++ b/index.js
@@ -371,7 +371,7 @@ wjs.prototype.addPlayer = function(wcpSettings) {
} else vlcs[wjsPlayer.context].hideUI = setTimeout(function(i) { return function() { hideUI.call(players[i]); } }(wjsPlayer.context),3000);
}
}
- }
+ } else wjsPlayer.wrapper.css({cursor: 'default'});
});
/* Progress and Volume Bars */ | Fixed mouse cursor on UI hidden | jaruba_wcjs-player | train | js |
bbb0f00ea81b1c379e8336437c3c6845a99affb4 | diff --git a/.tools/validate.go b/.tools/validate.go
index <HASH>..<HASH> 100644
--- a/.tools/validate.go
+++ b/.tools/validate.go
@@ -210,7 +210,7 @@ func GitCommits(commitrange string) ([]CommitEntry, error) {
// GitFetchHeadCommit returns the hash of FETCH_HEAD
func GitFetchHeadCommit() (string, error) {
- output, err := exec.Command("git", "rev-parse", "--verify", "HEAD").Output()
+ output, err := exec.Command("git", "rev-parse", "--verify", "FETCH_HEAD").Output()
if err != nil {
return "", err
} | .tools: make GetFetchHeadCommit do what it says | opencontainers_runtime-spec | train | go |
Subsets and Splits