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
|
---|---|---|---|---|---|
a995b5884180a92a3c73be9f07a014c83aa8bb04
|
diff --git a/Library/Compiler.php b/Library/Compiler.php
index <HASH>..<HASH> 100755
--- a/Library/Compiler.php
+++ b/Library/Compiler.php
@@ -428,14 +428,16 @@ class Compiler
}
}
- /**
- * Load additional extension prototypes
- */
- foreach (new DirectoryIterator(ZEPHIRPATH . 'prototypes') as $file) {
- if (!$file->isDir()) {
- $extension = str_replace('.php', '', $file);
- if (!extension_loaded($extension)) {
- require $file->getRealPath();
+ if (is_dir(ZEPHIRPATH . 'prototypes') && is_readable(ZEPHIRPATH . 'prototypes')) {
+ /**
+ * Load additional extension prototypes
+ */
+ foreach (new DirectoryIterator(ZEPHIRPATH . 'prototypes') as $file) {
+ if (!$file->isDir()) {
+ $extension = str_replace('.php', '', $file);
+ if (!extension_loaded($extension)) {
+ require $file->getRealPath();
+ }
}
}
}
|
refs #NA Check prototypes folder before interator it
|
phalcon_zephir
|
train
|
php
|
dc553104c63af9b8c1d28c15b11ab7b60c95151a
|
diff --git a/spring-session/src/test/java/org/springframework/session/web/http/SessionRepositoryFilterTests.java b/spring-session/src/test/java/org/springframework/session/web/http/SessionRepositoryFilterTests.java
index <HASH>..<HASH> 100644
--- a/spring-session/src/test/java/org/springframework/session/web/http/SessionRepositoryFilterTests.java
+++ b/spring-session/src/test/java/org/springframework/session/web/http/SessionRepositoryFilterTests.java
@@ -35,6 +35,7 @@ import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import javax.servlet.http.HttpSessionContext;
+import org.assertj.core.data.Offset;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -150,8 +151,8 @@ public class SessionRepositoryFilterTests {
@Override
public void doFilter(HttpServletRequest wrappedRequest) {
long lastAccessed = wrappedRequest.getSession().getLastAccessedTime();
- assertThat(lastAccessed)
- .isEqualTo(wrappedRequest.getSession().getCreationTime());
+ assertThat(lastAccessed).isCloseTo(
+ wrappedRequest.getSession().getCreationTime(), Offset.offset(5L));
SessionRepositoryFilterTests.this.request.setAttribute(ACCESS_ATTR,
lastAccessed);
}
|
Fix SessionRepositoryFilterTests doFilterLastAccessedTime assertion
Relax the assertion so that it is not exact to avoid timing issues.
Fixes gh-<I>
|
spring-projects_spring-session
|
train
|
java
|
337262dc57433e0a7505762be21f871721d32708
|
diff --git a/lib/class/inode_file.js b/lib/class/inode_file.js
index <HASH>..<HASH> 100644
--- a/lib/class/inode_file.js
+++ b/lib/class/inode_file.js
@@ -60,6 +60,7 @@ File.setStatic(function from(obj) {
size : obj.size
};
+ file.name = obj.name;
file.type = obj.type;
file.hash = obj.hash;
}
|
Get file name from object if it's present
|
skerit_alchemy
|
train
|
js
|
ee1bdf09f1acc6e2300745d9e1822cbf74f05a72
|
diff --git a/src/components/Response.php b/src/components/Response.php
index <HASH>..<HASH> 100644
--- a/src/components/Response.php
+++ b/src/components/Response.php
@@ -25,4 +25,14 @@ class Response extends \yii\web\Response
parent::sendContent();
}
+
+ public function refresh($anchor = '')
+ {
+ $request = Yii::$app->request;
+ if ($request->getIsAjax()) {
+ return $this->redirect($request->getReferrer() . $anchor);
+ }
+
+ return parent::refresh($anchor);
+ }
}
|
Fix. Ignore ajax request urls when redirect from hiam (#<I>)
|
hiqdev_hipanel-core
|
train
|
php
|
0ecf24d8fde1e97c3899c0fd515518dbf7ac7b3c
|
diff --git a/src/test/java/org/op4j/AssortedTests.java b/src/test/java/org/op4j/AssortedTests.java
index <HASH>..<HASH> 100644
--- a/src/test/java/org/op4j/AssortedTests.java
+++ b/src/test/java/org/op4j/AssortedTests.java
@@ -1813,5 +1813,24 @@ public class AssortedTests extends TestCase {
Op.on(set).exec(FnSet.ofCalendar().count())
.get().intValue());
}
+
+ @Test
+ public void test68() throws Exception {
+ assertEquals("asd",
+ Op.on("<>asd<>").exec(FnString.substringBetween("<>"))
+ .get());
+
+ assertEquals("",
+ Op.on("<>asd<>").exec(FnString.substringBefore("<>"))
+ .get());
+
+ assertEquals("<>asd",
+ Op.on("<>asd<>").exec(FnString.substringBeforeLast("<>"))
+ .get());
+
+ assertEquals("as",
+ Op.on("<>asd<>").exec(FnString.substringBetween(">", "d"))
+ .get());
+ }
}
|
substringbefore, after and between added
git-svn-id: <URL>
|
op4j_op4j
|
train
|
java
|
43ce23ff7a9ce9e61aa5ea181c6339909e55a0b5
|
diff --git a/taipan/collections/dicts.py b/taipan/collections/dicts.py
index <HASH>..<HASH> 100644
--- a/taipan/collections/dicts.py
+++ b/taipan/collections/dicts.py
@@ -126,6 +126,9 @@ def peekitem(dict_):
raise KeyError("peekitem(): dictionary is empty")
return next(iteritems(dict_))
+# TODO(xion): peekkey and peekvalue
+
+# TODO(xion): make the ``from_`` argument keyword-only in select() and omit()
def select(keys, from_, strict=False):
"""Selects a subset of given dictionary, including only the specified keys.
|
Add a few TODOs to .collections.dicts
|
Xion_taipan
|
train
|
py
|
9eb5c2ba0e1183c5ebdd66b4a538b13b8888cc6e
|
diff --git a/tests/bindings/modalBindingBehaviors.js b/tests/bindings/modalBindingBehaviors.js
index <HASH>..<HASH> 100644
--- a/tests/bindings/modalBindingBehaviors.js
+++ b/tests/bindings/modalBindingBehaviors.js
@@ -179,4 +179,18 @@
expect(this.testElement).toContainElement('.modal-header #test');
});
+
+ it('Should render modal-dialog element with passed css classes', function () {
+ var vm = {
+ value: {
+ dialogCss: 'test-class',
+ header: { name: 'test-template' },
+ body: { name: 'test-template' },
+ }
+ };
+
+ ko.applyBindings(vm, this.testElement[0]);
+
+ expect(this.testElement).toContainElement('.modal-dialog.test-class');
+ });
});
\ No newline at end of file
|
Added test case for dialogCss property for modal binding
|
faulknercs_Knockstrap
|
train
|
js
|
d7ef8c7b0ec71c53f95a41f5bf58c8c7898aac65
|
diff --git a/sheet_test.go b/sheet_test.go
index <HASH>..<HASH> 100644
--- a/sheet_test.go
+++ b/sheet_test.go
@@ -160,7 +160,8 @@ func (s *SheetSuite) TestMarshalSheetWithMultipleCells(c *C) {
cell = row.AddCell()
cell.Value = "A cell (with value 2)!"
refTable := NewSharedStringRefTable()
- xSheet := sheet.makeXLSXSheet(refTable)
+ styles := &xlsxStyles{}
+ xSheet := sheet.makeXLSXSheet(refTable, styles)
output := bytes.NewBufferString(xml.Header)
body, err := xml.MarshalIndent(xSheet, " ", " ")
@@ -177,10 +178,10 @@ func (s *SheetSuite) TestMarshalSheetWithMultipleCells(c *C) {
</cols>
<sheetData>
<row r="1">
- <c r="A1" t="s">
+ <c r="A1" s="0" t="s">
<v>0</v>
</c>
- <c r="B1" t="s">
+ <c r="B1" s="1" t="s">
<v>1</v>
</c>
</row>
|
Resolve failing tests from merge.
|
tealeg_xlsx
|
train
|
go
|
1835e28ab695efc8d6a8d7a81d18270d02ccd1ab
|
diff --git a/lib/httplog/http_log.rb b/lib/httplog/http_log.rb
index <HASH>..<HASH> 100644
--- a/lib/httplog/http_log.rb
+++ b/lib/httplog/http_log.rb
@@ -40,7 +40,7 @@ module HttpLog
url.to_s.match(options[:url_whitelist_pattern])
end
- def log(msg)
+ def log(msg, encoding='UTF-8')
# This builds a hash {0=>:DEBUG, 1=>:INFO, 2=>:WARN, 3=>:ERROR, 4=>:FATAL, 5=>:UNKNOWN}.
# Courtesy of the delayed_job gem in this commit:
# https://github.com/collectiveidea/delayed_job/commit/e7f5aa1ed806e61251bdb77daf25864eeb3aff59
@@ -92,7 +92,7 @@ module HttpLog
gz = Zlib::GzipReader.new( sio )
log("Response: (deflated)\n#{gz.read}")
else
- log("Response:\n#{body}")
+ log("Response:\n#{body}", encoding)
end
end
end
|
actually passing encoding to the log method. doh
|
trusche_httplog
|
train
|
rb
|
a7f4d816ca3880c0fb0fde02798bd1e21c9e5ada
|
diff --git a/salt/modules/ebuild.py b/salt/modules/ebuild.py
index <HASH>..<HASH> 100644
--- a/salt/modules/ebuild.py
+++ b/salt/modules/ebuild.py
@@ -17,6 +17,7 @@ import re
import salt.utils
# Import third party libs
+HAS_PORTAGE = False
try:
import portage
HAS_PORTAGE = True
@@ -30,8 +31,7 @@ except ImportError:
import portage
HAS_PORTAGE = True
except ImportError:
- HAS_PORTAGE = False
-
+ pass
log = logging.getLogger(__name__)
|
Bring `HAS_PORTAGE` to global scope, wrongly removed(by me).
|
saltstack_salt
|
train
|
py
|
460013080fdb57d2e7a8a2f98de459cb7fe2d2d1
|
diff --git a/pyout/tests/test_tabular.py b/pyout/tests/test_tabular.py
index <HASH>..<HASH> 100644
--- a/pyout/tests/test_tabular.py
+++ b/pyout/tests/test_tabular.py
@@ -257,10 +257,10 @@ def test_tabular_write_multicolor():
assert_eq_repr(out.stdout, expected)
-def test_tabular_write_empty_string_nostyle():
+def test_tabular_write_all_whitespace_nostyle():
out = Tabular(style={"name": {"color": "green"}})
- out({"name": ""})
- assert_eq_repr(out.stdout, "\n")
+ out({"name": " "})
+ assert_eq_repr(out.stdout, " \n")
def test_tabular_write_style_flanking():
|
tests: Update "don't style empty string" check
With the next commit, render() won't be called with zero-width values.
Pass a value with spaces to trigger the "all whitespace" code path in
TermProcessors.render(). Also rename the test to make it clear that
the tested behavior isn't strictly limited to empty strings.
|
pyout_pyout
|
train
|
py
|
d41571ac7c1c5d58452a5dcb031d5b5a88afddd8
|
diff --git a/toolkits/golang.go b/toolkits/golang.go
index <HASH>..<HASH> 100644
--- a/toolkits/golang.go
+++ b/toolkits/golang.go
@@ -25,7 +25,7 @@ import (
)
const (
- minGoVersionForToolkit = "1.7.3"
+ minGoVersionForToolkit = "1.7.4"
)
// === Base Toolkit struct ===
|
Go <I> (#<I>)
|
bitrise-io_bitrise
|
train
|
go
|
9de699d2ad8d128198edfd3fb71095dca178a8e8
|
diff --git a/lib/guard/rspec/runner.rb b/lib/guard/rspec/runner.rb
index <HASH>..<HASH> 100644
--- a/lib/guard/rspec/runner.rb
+++ b/lib/guard/rspec/runner.rb
@@ -50,7 +50,6 @@ module Guard
def failure_exit_code_supported?
@failure_exit_code_supported ||= begin
cmd_parts = []
- cmd_parts << environment_variables
cmd_parts << "bundle exec" if bundle_exec?
cmd_parts << rspec_executable
cmd_parts << "--help"
@@ -103,8 +102,8 @@ module Guard
def rspec_command(paths, options)
cmd_parts = []
- cmd_parts << "rvm #{@options[:rvm].join(',')} exec" if @options[:rvm].respond_to?(:join)
cmd_parts << environment_variables
+ cmd_parts << "rvm #{@options[:rvm].join(',')} exec" if @options[:rvm].respond_to?(:join)
cmd_parts << "bundle exec" if bundle_exec?
cmd_parts << rspec_executable
cmd_parts << rspec_arguments(paths, options)
|
export environment before rvm exec
|
guard_guard-rspec
|
train
|
rb
|
a6ed6b77f90e3cb1a18e2d55f3b8729e631a8d13
|
diff --git a/http-client/src/main/java/io/micronaut/http/client/interceptor/HttpClientIntroductionAdvice.java b/http-client/src/main/java/io/micronaut/http/client/interceptor/HttpClientIntroductionAdvice.java
index <HASH>..<HASH> 100644
--- a/http-client/src/main/java/io/micronaut/http/client/interceptor/HttpClientIntroductionAdvice.java
+++ b/http-client/src/main/java/io/micronaut/http/client/interceptor/HttpClientIntroductionAdvice.java
@@ -185,9 +185,11 @@ public class HttpClientIntroductionAdvice implements MethodInterceptor<Object, O
String headerValue = header.value();
headers.put(headerName, headerValue);
}
- } else {
- Header header = context.getAnnotation(Header.class);
- headers.put(header.name(), header.value());
+ }
+
+ Header headerAnnotation = context.getAnnotation(Header.class);
+ if (headerAnnotation != null) {
+ headers.put(headerAnnotation.name(), headerAnnotation.value());
}
List<NettyCookie> cookies = new ArrayList<>();
|
Handle header only if the Header annotation is present
|
micronaut-projects_micronaut-core
|
train
|
java
|
55ca06cb42d26ab445fca48e1460d10605f7f8d3
|
diff --git a/PhpAmqpLib/Connection/AbstractConnection.php b/PhpAmqpLib/Connection/AbstractConnection.php
index <HASH>..<HASH> 100644
--- a/PhpAmqpLib/Connection/AbstractConnection.php
+++ b/PhpAmqpLib/Connection/AbstractConnection.php
@@ -268,7 +268,7 @@ class AbstractConnection extends AbstractChannel
// Try to close the AMQP connection
$this->safeClose();
// Reconnect the socket/stream then AMQP
- $this->getIO()->reconnect();
+ $this->getIO()->close();
$this->setIsConnected(false); // getIO can initiate the connection setting via LazyConnection, set it here to be sure
$this->connect();
}
diff --git a/PhpAmqpLib/Wire/IO/AbstractIO.php b/PhpAmqpLib/Wire/IO/AbstractIO.php
index <HASH>..<HASH> 100644
--- a/PhpAmqpLib/Wire/IO/AbstractIO.php
+++ b/PhpAmqpLib/Wire/IO/AbstractIO.php
@@ -117,17 +117,6 @@ abstract class AbstractIO
abstract public function connect();
/**
- * Reconnects the socket
- * @return void
- * @throws \PhpAmqpLib\Exception\AMQPIOException
- */
- public function reconnect()
- {
- $this->close();
- $this->connect();
- }
-
- /**
* @return resource
*/
abstract public function getSocket();
|
Remove AbstractIO reconnect as it is only used, incorrectly, in one place
Fixes #<I>
|
php-amqplib_php-amqplib
|
train
|
php,php
|
dc437ae87d33dacc799b919d098b359a9e9a03fb
|
diff --git a/tests/test_distro.py b/tests/test_distro.py
index <HASH>..<HASH> 100644
--- a/tests/test_distro.py
+++ b/tests/test_distro.py
@@ -99,20 +99,18 @@ class TestCli:
import json
root_dir = os.path.join(RESOURCES, 'cli', 'fedora30')
command = [sys.executable, '-m', 'distro', '-j', '--root-dir', root_dir]
- desired_output = '''
- {
- "codename": "",
- "id": "fedora",
- "like": "",
- "version": "30",
- "version_parts": {
- "build_number": "",
- "major": "30",
- "minor": ""
+ desired_output = {
+ 'codename': '',
+ 'id': 'fedora',
+ 'like': '',
+ 'version': '30',
+ 'version_parts': {
+ 'build_number': '',
+ 'major': '30',
+ 'minor': '',
}
}
- '''
- desired_output = json.loads(desired_output)
+
results = json.loads(self._run(command))
assert desired_output == results
|
Prefer mapping to JSON string as test expectation
This is easier to read and maintain and more resilient to formatting
changes.
|
nir0s_distro
|
train
|
py
|
5de6ff1e702816ef5c99cb1764e240a43a5772f2
|
diff --git a/index.js b/index.js
index <HASH>..<HASH> 100644
--- a/index.js
+++ b/index.js
@@ -108,6 +108,7 @@ JSHinter.prototype.testGenerator = function(relativePath, passed, errors) {
return "QUnit.module('JSHint - " + path.dirname(relativePath) + "');\n" +
"QUnit.test('" + relativePath + " should pass jshint', function(assert) { \n" +
+ " assert.expect(1);\n" +
" assert.ok(" + !!passed + ", '" + relativePath + " should pass jshint." + errors + "'); \n" +
"});\n"
};
|
Add assert.expect to generated tests
|
rwjblue_broccoli-jshint
|
train
|
js
|
62a678a24d47d7bf4f8427e42f603f5b9c72fa4d
|
diff --git a/app/controllers/navigation.js b/app/controllers/navigation.js
index <HASH>..<HASH> 100644
--- a/app/controllers/navigation.js
+++ b/app/controllers/navigation.js
@@ -5,6 +5,7 @@ import ProgressDialog from 'hospitalrun/mixins/progress-dialog';
import UserSession from 'hospitalrun/mixins/user-session';
import Navigation from 'hospitalrun/mixins/navigation';
export default Ember.Controller.extend(HospitalRunVersion, ModalHelper, ProgressDialog, UserSession, Navigation, {
+ ajax: Ember.inject.service(),
application: Ember.inject.controller(),
allowSearch: false,
config: Ember.inject.service(),
@@ -18,9 +19,8 @@ export default Ember.Controller.extend(HospitalRunVersion, ModalHelper, Progress
actions: {
about: function() {
- let config = this.get('config'),
- version = this.get('version');
- config.getConfigValue('site_information', '').then((siteInfo) => {
+ let version = this.get('version');
+ this.get('ajax').request('/serverinfo').then((siteInfo) => {
let message = `Version: ${version}`;
if (!Ember.isEmpty(siteInfo)) {
message += ` Site Info: ${siteInfo}`;
|
Changed to pull site/sever information from server config
|
HospitalRun_hospitalrun-frontend
|
train
|
js
|
269c9b3364ab9aa736b7e32bed5c2cd9a86a7603
|
diff --git a/class.contextio.php b/class.contextio.php
index <HASH>..<HASH> 100755
--- a/class.contextio.php
+++ b/class.contextio.php
@@ -296,7 +296,7 @@ class ContextIO {
}
public function addUser($params) {
- $params = $this->_filterParams($params, array('email','first_name','last_name','type','server','username','provider_consumer_key','provider_token','provider_token_secret','service_level','password','use_ssl','port','raw_file_list','expunge_on_deleted_flag'), array('email'));
+ $params = $this->_filterParams($params, array('email','first_name','last_name','type','server','username','provider_consumer_key','provider_token','provider_token_secret','service_level','password','use_ssl','port','raw_file_list','expunge_on_deleted_flag', 'migrate_account_id'), array('email'));
if ($params === false) {
throw new InvalidArgumentException("params array contains invalid parameters or misses required parameters");
}
|
added migrate_account_id as a valid param on post->users.
|
contextio_PHP-Lite-ContextIO
|
train
|
php
|
305356eabdd9de91f1afb0ceac3cfb70b362397b
|
diff --git a/lib/cli.js b/lib/cli.js
index <HASH>..<HASH> 100644
--- a/lib/cli.js
+++ b/lib/cli.js
@@ -105,14 +105,15 @@ function run() {
return done()
function done() {
- info('listening on '+port)
+ info('listening on http://localhost:' + port + '/')
+
return serve(
cwd
, browserify
, browserify_args
, entry_points
, parsed.live
- , log
+ , log
).listen(port)
}
|
expose a clickable URL for those terminals supporting it.
|
chrisdickinson_beefy
|
train
|
js
|
a65b1315a143f38b5c8efde64469c4122c6b1dc4
|
diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -9,7 +9,7 @@ os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir)))
setup(
name='django-genes',
- version='0.6',
+ version='0.7',
packages=find_packages(),
include_package_data=True,
license='LICENSE.txt',
|
Bumping django-genes package version # to reflect the addition of auto-complete search.
|
greenelab_django-genes
|
train
|
py
|
9dcfa4d99c14bcbd9a148e389605d6cbc5de62b1
|
diff --git a/lib/user_stream/version.rb b/lib/user_stream/version.rb
index <HASH>..<HASH> 100644
--- a/lib/user_stream/version.rb
+++ b/lib/user_stream/version.rb
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
module UserStream
- VERSION = "1.2.4"
+ VERSION = "1.3.0"
end
|
Version bump to <I>.
|
mitukiii_userstream
|
train
|
rb
|
ad01dcc8e91674776dd6d42fab43de8e1474ddfe
|
diff --git a/lib/xdr/struct.rb b/lib/xdr/struct.rb
index <HASH>..<HASH> 100644
--- a/lib/xdr/struct.rb
+++ b/lib/xdr/struct.rb
@@ -9,7 +9,7 @@ class XDR::Struct
attribute_method_prefix 'read_'
attribute_method_suffix 'write_'
-
+
class_attribute :fields
self.fields = ActiveSupport::OrderedHash.new
@@ -68,6 +68,14 @@ class XDR::Struct
other.attributes == self.attributes
end
+ def eql? (other)
+ return false unless other.is_a?(self.class)
+ other.attributes.eql? self.attributes
+ end
+
+ def hash
+ [self.class, self.attribues].hash
+ end
def read_attribute(attr)
@attributes[attr]
diff --git a/lib/xdr/union.rb b/lib/xdr/union.rb
index <HASH>..<HASH> 100644
--- a/lib/xdr/union.rb
+++ b/lib/xdr/union.rb
@@ -114,6 +114,16 @@ class XDR::Union
other.value == self.value
end
+ def eql?(other)
+ return false unless other.is_a?(self.class)
+ return false unless other.switch.eql? self.switch
+ other.value.eql? self.value
+ end
+
+ def hash
+ [self.class, self.switch, self.value].hash
+ end
+
private
def valid_for_arm_type(value, arm)
arm_type = arms[@arm]
|
Add eql? and hash implementations for struct and union
Allows for `uniq` to behave as expected
|
stellar_ruby-xdr
|
train
|
rb,rb
|
1d1ac8ebd6e34da46cf7fba2e43228fc1d49b8d5
|
diff --git a/lib/jammit/compressor.rb b/lib/jammit/compressor.rb
index <HASH>..<HASH> 100644
--- a/lib/jammit/compressor.rb
+++ b/lib/jammit/compressor.rb
@@ -22,7 +22,7 @@ module Jammit
# Font extensions for which we allow embedding:
EMBED_EXTS = EMBED_MIME_TYPES.keys
- EMBED_FONTS = ['.ttf', '.otf']
+ EMBED_FONTS = ['.ttf', '.otf', '.woff']
# (32k - padding) maximum length for data-uri assets (an IE8 limitation).
MAX_IMAGE_SIZE = 32700
|
allow .woff fonts to be embedded.
|
documentcloud_jammit
|
train
|
rb
|
d8ea4fb8710cc8f541c52688e562075ecf96a953
|
diff --git a/bin/ember-template-lint.js b/bin/ember-template-lint.js
index <HASH>..<HASH> 100755
--- a/bin/ember-template-lint.js
+++ b/bin/ember-template-lint.js
@@ -193,7 +193,8 @@ async function run() {
let resultsAccumulator = [];
for (let relativeFilePath of filesToLint) {
- let resolvedFilePath = path.resolve(relativeFilePath);
+ // on Windows the attempt to resolve the '/dev/stdin' doesn't return '/dev/stdin', hence explicit check
+ let resolvedFilePath = relativeFilePath === STDIN ? STDIN : path.resolve(relativeFilePath);
let filePath = resolvedFilePath === STDIN ? options.filename || '' : relativeFilePath;
let moduleId = filePath.slice(0, -4);
let messages = await lintFile(linter, filePath, resolvedFilePath, moduleId, options.fix);
|
fix ENOENT: no such file or directory, open 'D:\dev\stdin' error on Windows
|
ember-template-lint_ember-template-lint
|
train
|
js
|
8a49f74ff5d1fdb050d8507e70fd81878ecddeae
|
diff --git a/spec/factories/socializer_ties.rb b/spec/factories/socializer_ties.rb
index <HASH>..<HASH> 100644
--- a/spec/factories/socializer_ties.rb
+++ b/spec/factories/socializer_ties.rb
@@ -2,5 +2,6 @@
FactoryGirl.define do
factory :socializer_tie, class: Socializer::Tie do
+ association :activity_contact, factory: :socializer_activity_object_person
end
end
diff --git a/spec/models/socializer/tie_spec.rb b/spec/models/socializer/tie_spec.rb
index <HASH>..<HASH> 100644
--- a/spec/models/socializer/tie_spec.rb
+++ b/spec/models/socializer/tie_spec.rb
@@ -17,6 +17,7 @@ module Socializer
it { is_expected.to belong_to(:activity_contact) }
end
- it { is_expected.to respond_to(:contact) }
+ # TODO: Test return values
+ it { expect(tie.contact).to be_kind_of(Socializer::Person) }
end
end
|
check the return type for contact
add the activity_contact association to the factory
|
socializer_socializer
|
train
|
rb,rb
|
a21dcb3d9ce43db0485488bc18875e084a2b1be9
|
diff --git a/code/PollAdmin.php b/code/PollAdmin.php
index <HASH>..<HASH> 100644
--- a/code/PollAdmin.php
+++ b/code/PollAdmin.php
@@ -6,7 +6,6 @@ class PollAdmin extends ModelAdmin {
private static $url_segment = 'polls';
private static $menu_title = 'Polls';
private static $menu_icon = 'silverstripe-polls/images/poll.png';
- private static $menu_priority = -0.48;
public function getList() {
$list = parent::getList();
|
removing menu priority, developer should use yml config file
|
Webmaxsk_silverstripe-polls
|
train
|
php
|
c8ca9b72153832b547214a7abe42e3c0bcbf61e1
|
diff --git a/install/lib/class.installer.php b/install/lib/class.installer.php
index <HASH>..<HASH> 100644
--- a/install/lib/class.installer.php
+++ b/install/lib/class.installer.php
@@ -1,6 +1,7 @@
<?php
require_once(CORE . '/class.administration.php');
+ require_once(TOOLKIT . '/class.cryptography.php');
require_once(TOOLKIT . '/class.lang.php');
require_once(INSTALL . '/lib/class.installerpage.php');
@@ -434,7 +435,7 @@
Symphony::Database()->insert(array(
'id' => 1,
'username' => Symphony::Database()->cleanValue($fields['user']['username']),
- 'password' => sha1(Symphony::Database()->cleanValue($fields['user']['password'])),
+ 'password' => Cryptography::hash(Symphony::Database()->cleanValue($fields['user']['password'])),
'first_name' => Symphony::Database()->cleanValue($fields['user']['firstname']),
'last_name' => Symphony::Database()->cleanValue($fields['user']['lastname']),
'email' => Symphony::Database()->cleanValue($fields['user']['email']),
|
Installer uses Cryptography::hash() instead of sha1() during installation
|
symphonycms_symphony-2
|
train
|
php
|
fdf92295f004d959cae4af978242dd9c6a7e0d35
|
diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -26,7 +26,7 @@ METADATA = dict(
SETUPTOOLS_METADATA = dict(
- install_requires = ['setuptools', 'requests'],
+ install_requires = ['setuptools', 'requests', 'numpy', 'matplotlib'],
include_package_data = True
)
@@ -47,8 +47,8 @@ def Main():
METADATA.update(SETUPTOOLS_METADATA)
setuptools.setup(**METADATA)
except ImportError:
- print "Could not import setuptools, using distutils"
- print "NOTE: You will need to install dependencies manualy"
+ print("Could not import setuptools, using distutils")
+ print("NOTE: You will need to install dependencies manualy")
import distutils.core
distutils.core.setup(**METADATA)
|
working towards python3 compatibility re #<I>
|
lightning-viz_lightning-python
|
train
|
py
|
e0c1c952bb7a2fae9f4dd4f5b94f6d63b9e9c7d2
|
diff --git a/perseuspy/__init__.py b/perseuspy/__init__.py
index <HASH>..<HASH> 100644
--- a/perseuspy/__init__.py
+++ b/perseuspy/__init__.py
@@ -68,6 +68,8 @@ def read_perseus(path_or_file, type_map = perseus_to_dtype, **kwargs):
"""
annotations = read_annotations(path_or_file, separator, type_map)
column_index = create_column_index(annotations)
+ if 'usecols' in kwargs:
+ column_index = column_index[kwargs['usecols']]
if 'Type' in annotations:
dtype = {name : t for name, t in zip(annotations['Column Name'], annotations['Type'])}
if 'dtype' in kwargs:
|
handle 'usecols' kwarg in read.perseus
|
cox-labs_perseuspy
|
train
|
py
|
1691e3af58ade0f17dfca1d81015a89374d4064d
|
diff --git a/lib/vagrant/bundler.rb b/lib/vagrant/bundler.rb
index <HASH>..<HASH> 100644
--- a/lib/vagrant/bundler.rb
+++ b/lib/vagrant/bundler.rb
@@ -146,7 +146,7 @@ module Vagrant
'local_source' => plugin_source
}
}
- internal_install(plugin_info, {})
+ internal_install(plugin_info, {}, local_install: true)
plugin_source.spec
end
@@ -224,8 +224,10 @@ module Vagrant
def internal_install(plugins, update, **extra)
- update = {} unless update.is_a?(Hash)
+ # Only clear Gem sources if not performing local install
+ Gem.sources.clear if !extra[:local_install]
+ update = {} unless update.is_a?(Hash)
installer_set = Gem::Resolver::InstallerSet.new(:both)
# Generate all required plugin deps
|
Only install from defined sources unless install is local
|
hashicorp_vagrant
|
train
|
rb
|
5d3a4448e3ccf30a4a767ad77ed6ec3782f8e606
|
diff --git a/tests/SetterTests.php b/tests/SetterTests.php
index <HASH>..<HASH> 100644
--- a/tests/SetterTests.php
+++ b/tests/SetterTests.php
@@ -43,8 +43,9 @@ class SetterTests extends TestCase
{
$stub = new ModelBaseServiceStub();
- $stub->service = new BaseServiceStub();
- $this->assertInstanceOf(BaseServiceStub::class, $stub->service);
+ $service = new BaseServiceStub();
+ $stub->service = $service;
+ $this->assertSame($service, $stub->service);
}
public function testSetUnknown(): void
|
test - setter - improve inspection
|
MatthewPattell_yii2-services
|
train
|
php
|
c9a2258ea530f9d15894e9d55f1f98a15a680cbe
|
diff --git a/parse.go b/parse.go
index <HASH>..<HASH> 100644
--- a/parse.go
+++ b/parse.go
@@ -93,17 +93,6 @@ func (p *parser) readByte() byte {
return b
}
-func (p *parser) discByte(b byte) {
- if p.nextErr != nil {
- p.errPass(p.nextErr)
- return
- }
- if _, err := p.br.Discard(1); err != nil {
- p.errPass(err)
- }
- p.npos = moveWith(p.npos, b)
-}
-
func moveWith(pos Pos, b byte) Pos {
if b == '\n' {
pos.Line++
@@ -137,7 +126,7 @@ func (p *parser) willRead(b byte) bool {
func (p *parser) readOnly(b byte) bool {
if p.willRead(b) {
- p.discByte(b)
+ p.readByte()
return true
}
return false
@@ -854,7 +843,7 @@ func (p *parser) arithmEnd(left Pos) Pos {
if !p.peekArithmEnd() {
p.matchingErr(left, DLPAREN, DRPAREN)
}
- p.discByte(')')
+ p.readByte()
p.popStop()
p.next()
return p.lpos
|
parse: replace discByte(byte)
Now that this is no longer in any critical paths, it's unnecessary.
|
mvdan_sh
|
train
|
go
|
bf2d3433bc30079836aa6a3b4c716f602d246acd
|
diff --git a/src/java/org/apache/cassandra/utils/StreamingHistogram.java b/src/java/org/apache/cassandra/utils/StreamingHistogram.java
index <HASH>..<HASH> 100644
--- a/src/java/org/apache/cassandra/utils/StreamingHistogram.java
+++ b/src/java/org/apache/cassandra/utils/StreamingHistogram.java
@@ -127,10 +127,10 @@ public class StreamingHistogram
}
/**
- * Calculates estimated number of points in interval [-∞,b].
+ * Calculates estimated number of points in interval [-inf,b].
*
* @param b upper bound of a interval to calculate sum
- * @return estimated number of points in a interval [-∞,b].
+ * @return estimated number of points in a interval [-inf,b].
*/
public double sum(double b)
{
|
Avoid special characters which might confuse ant.
|
Stratio_stratio-cassandra
|
train
|
java
|
75180d2c74e49b70c8662721c3f82bea0c6842df
|
diff --git a/tests/test_api.py b/tests/test_api.py
index <HASH>..<HASH> 100644
--- a/tests/test_api.py
+++ b/tests/test_api.py
@@ -46,13 +46,8 @@ class TestAPI(object):
dataless_uuid = "ed9e7ddd-3e97-452d-9e34-fee5d432258e"
dallinger.data.register(dataless_uuid, "https://bogus-url.com/something")
- try:
+ with pytest.raises(RuntimeError):
data = exp.collect(dataless_uuid, recruiter="bots")
- except RuntimeError:
- # This is expected for an already registered UUID with no accessible data
- pass
- else:
- pytest.fail("Did not raise RuntimeError for existing UUID")
# In debug mode an unknown UUID fails
unknown_uuid = "c85d5086-2fa7-4baf-9103-e142b9170cca"
|
Use pytest.raises() consistently
|
Dallinger_Dallinger
|
train
|
py
|
81676899e94aed1654e885386e6426b12643b3ed
|
diff --git a/examples/dendrogram.py b/examples/dendrogram.py
index <HASH>..<HASH> 100644
--- a/examples/dendrogram.py
+++ b/examples/dendrogram.py
@@ -31,7 +31,7 @@
from neurom.view import common
from neurom.analysis.morphmath import segment_length
-from neurom.core.tree import isegment
+from neurom.core.tree import isegment, val_iter
from matplotlib.collections import LineCollection
@@ -53,7 +53,7 @@ def get_transformed_position(segment, segments_dict, y_length):
(x0, y0), line_type = segments_dict[start_node_id]
# increase horizontal dendrogram length by segment length
- x1 = x0 + segment_length(segment)
+ x1 = x0 + segment_length(list(val_iter(segment)))
# if the parent node is visited for the first time
# the dendrogram segment is drawn from below. If it
|
fix for segment length function in dendrogram example
|
BlueBrain_NeuroM
|
train
|
py
|
bb5af1d77658133af8be8c9b1a13139722315c3a
|
diff --git a/torchvision/transforms/functional.py b/torchvision/transforms/functional.py
index <HASH>..<HASH> 100644
--- a/torchvision/transforms/functional.py
+++ b/torchvision/transforms/functional.py
@@ -85,14 +85,8 @@ def to_tensor(pic):
img = 255 * torch.from_numpy(np.array(pic, np.uint8, copy=False))
else:
img = torch.ByteTensor(torch.ByteStorage.from_buffer(pic.tobytes()))
- # PIL image mode: L, LA, P, I, F, RGB, YCbCr, RGBA, CMYK
- if pic.mode == 'YCbCr':
- nchannel = 3
- elif pic.mode == 'I;16':
- nchannel = 1
- else:
- nchannel = len(pic.mode)
- img = img.view(pic.size[1], pic.size[0], nchannel)
+
+ img = img.view(pic.size[1], pic.size[0], len(pic.getbands()))
# put it from HWC to CHW format
# yikes, this transpose takes 80% of the loading time/CPU
img = img.transpose(0, 1).transpose(0, 2).contiguous()
|
generalize number of bands calculation in to_tensor (#<I>)
|
pytorch_vision
|
train
|
py
|
5067c9ca3a2b479008fbe1bcd37060b0aaa05853
|
diff --git a/atomic_reactor/plugins/exit_koji_promote.py b/atomic_reactor/plugins/exit_koji_promote.py
index <HASH>..<HASH> 100644
--- a/atomic_reactor/plugins/exit_koji_promote.py
+++ b/atomic_reactor/plugins/exit_koji_promote.py
@@ -513,7 +513,7 @@ class KojiPromotePlugin(ExitPlugin):
if not isinstance(source, GitSource):
raise RuntimeError('git source required')
- extra = {}
+ extra = {'image': {}}
koji_task_id = metadata.get('labels', {}).get('koji-task-id')
if koji_task_id is not None:
self.log.info("build configuration created by Koji Task ID %s",
|
koji_promote: seems like build.extra.image is required
It is not listed in the specification any more, but builds do
not display correctly without this.
|
projectatomic_atomic-reactor
|
train
|
py
|
6830f02b128813181a0e8dbc13e426409368ed43
|
diff --git a/admin_tools/menu/utils.py b/admin_tools/menu/utils.py
index <HASH>..<HASH> 100644
--- a/admin_tools/menu/utils.py
+++ b/admin_tools/menu/utils.py
@@ -5,14 +5,13 @@ Menu utilities.
import types
from django.conf import settings
-from django.core.exceptions import ImproperlyConfigured
from django.utils.importlib import import_module
from django.core.urlresolvers import reverse
def _get_menu_cls(menu_cls, context):
if type(menu_cls) is types.DictType:
- curr_url = context.get('request').META['PATH_INFO']
+ curr_url = context.get('request').path
for key in menu_cls:
admin_site_mod, admin_site_inst = key.rsplit('.', 1)
admin_site_mod = import_module(admin_site_mod)
|
fixed admin path error when calculating menu class to use
|
django-admin-tools_django-admin-tools
|
train
|
py
|
80f5786884991a47823f7a4bc5e39ff9e3a5829e
|
diff --git a/forum/__init__.py b/forum/__init__.py
index <HASH>..<HASH> 100644
--- a/forum/__init__.py
+++ b/forum/__init__.py
@@ -1,2 +1,2 @@
"""A minimalistic Django forum app"""
-__version__ = '0.7.3'
+__version__ = '0.7.4'
diff --git a/forum/signals.py b/forum/signals.py
index <HASH>..<HASH> 100644
--- a/forum/signals.py
+++ b/forum/signals.py
@@ -19,12 +19,10 @@ def new_message_posted_receiver(sender, **kwargs):
'thread_instance': post_instance.thread,
'post_instance': post_instance,
}
- subject = ''.join(render_to_string('forum/threadwatch_email_subject.txt', context).splitlines())
- content = render_to_string('forum/threadwatch_email_content.txt', context)
+ subject = ''.join(render_to_string('forum/threadwatch/email_subject.txt', context).splitlines())
+ content = render_to_string('forum/threadwatch/email_content.txt', context)
for item in threadwatchs:
- #print "*", item, "for", item.owner
- # (subject, message, from_email, recipient_list)
emails_datas.append((
subject,
content,
|
Fix bad template names in threadwatch sending, close #<I>, bump to <I>
|
emencia_emencia-django-forum
|
train
|
py,py
|
f26f2d931d047152f6d95956e00803a43018f9ca
|
diff --git a/store.js b/store.js
index <HASH>..<HASH> 100644
--- a/store.js
+++ b/store.js
@@ -2,7 +2,8 @@ var store = (function(){
var api = {},
win = window,
doc = win.document,
- name = 'localStorage',
+ localStorageName = 'localStorage',
+ globalStorageName = 'globalStorage',
storage
api.set = function(key, value) {}
@@ -10,14 +11,14 @@ var store = (function(){
api.remove = function(key) {}
api.clear = function() {}
- if (win.localStorage) {
- storage = win.localStorage
+ if (localStorageName in win && win[localStorageName]) {
+ storage = win[localStorageName]
api.set = function(key, val) { storage[key] = val }
api.get = function(key) { return storage[key] }
api.remove = function(key) { delete storage[key] }
api.clear = function() { storage.clear() }
- } else if (win.globalStorage) {
- storage = win.globalStorage[win.location.hostname]
+ } else if (globalStorageName in win && win[globalStorageName]) {
+ storage = win[globalStorageName][win.location.hostname]
api.set = function(key, val) { storage[key] = val }
api.get = function(key) { return storage[key] && storage[key].value }
api.remove = function(key) { delete storage[key] }
|
Fix issue 2. Thanks Paul Irish for the suggested fix and relevant links.
See <URL>
|
marcuswestin_store.js
|
train
|
js
|
18047add47bca70d1a4476c12b2da086f9718591
|
diff --git a/src/main/java/org/zeromq/ZMQException.java b/src/main/java/org/zeromq/ZMQException.java
index <HASH>..<HASH> 100644
--- a/src/main/java/org/zeromq/ZMQException.java
+++ b/src/main/java/org/zeromq/ZMQException.java
@@ -43,6 +43,18 @@ public class ZMQException extends RuntimeException
code = errno;
}
+ public ZMQException(String message, int errno)
+ {
+ super(message);
+ code = errno;
+ }
+
+ public ZMQException(ZMQException cause)
+ {
+ super(cause.getMessage(), cause);
+ code = cause.code;
+ }
+
public int getErrorCode()
{
return code;
|
Added constructors to ZMQException
|
zeromq_jeromq
|
train
|
java
|
e4e15337e2f73efaf8115394e8e4e104b3fb55f4
|
diff --git a/src/test/java/benchmark/Synchronized_Versus_ReentrantLock.java b/src/test/java/benchmark/Synchronized_Versus_ReentrantLock.java
index <HASH>..<HASH> 100644
--- a/src/test/java/benchmark/Synchronized_Versus_ReentrantLock.java
+++ b/src/test/java/benchmark/Synchronized_Versus_ReentrantLock.java
@@ -2,7 +2,6 @@ package benchmark;
import com.carrotsearch.junitbenchmarks.AbstractBenchmark;
-import com.sun.servicetag.SystemEnvironment;
import org.junit.Test;
import org.mapdb.CC;
diff --git a/src/test/java/org/mapdb/Gen.java b/src/test/java/org/mapdb/Gen.java
index <HASH>..<HASH> 100644
--- a/src/test/java/org/mapdb/Gen.java
+++ b/src/test/java/org/mapdb/Gen.java
@@ -61,7 +61,7 @@ public class Gen<T> implements TestRule {
try {
test.evaluate();
} catch (Throwable t) {
- errorCollector.addError(new AssertionError("For value: "
+ errorCollector.addError(new Error("For value: "
+ v, t));
}
}
|
Make it compilable on JDK6
|
jankotek_mapdb
|
train
|
java,java
|
0f6b89df6088bd67ca1deb63472d455f64d4b162
|
diff --git a/Kwc/Abstract/Image/ImageFile.php b/Kwc/Abstract/Image/ImageFile.php
index <HASH>..<HASH> 100644
--- a/Kwc/Abstract/Image/ImageFile.php
+++ b/Kwc/Abstract/Image/ImageFile.php
@@ -11,7 +11,7 @@ class Kwc_Abstract_Image_ImageFile extends Kwf_Form_Field_File
public function load($row, $postData = array())
{
$ret = parent::load($row, $postData);
- $component = Kwf_Component_Data_Root::getInstance()->getComponentByDbId($row->component_id, array('ignoreVisible' => true));
+ $component = Kwf_Component_Data_Root::getInstance()->getComponentByDbId($row->component_id, array('ignoreVisible' => true, 'limit' => 1));
if ($component) { //component can be non-existent if it's in a not selected card
if (is_instance_of($component->componentClass, 'Kwc_Abstract_Image_Component')) {
$contentWidth = $component->getComponent()->getMaxContentWidth();
|
Fix Image Admin for components where multiple exist for one db id
|
koala-framework_koala-framework
|
train
|
php
|
06e6ac8176469179b59262ef1f12950afa1005e8
|
diff --git a/css.js b/css.js
index <HASH>..<HASH> 100644
--- a/css.js
+++ b/css.js
@@ -1,4 +1,4 @@
-define(['./core/extend', './css/builder', './request'], function(extend, builder, request) {
+define(['./core/extend', './core/deferredUtils', './css/builder', './request'], function(extend, def, builder, request) {
'use strict';
var result = {},
ielt10 = (function () {
@@ -258,6 +258,21 @@ define(['./core/extend', './css/builder', './request'], function(extend, builder
result.style = buildStyleObject;
+ result.loadFromString = function (css, uniqueId) {
+ var packages;
+ if (isDojo) {
+ packages = window.dojoConfig.packages;
+ }
+ else {
+ packages = requirejs.s.contexts._.config.packages;
+ }
+ var defer = def.defer();
+ loadStyle(css, uniqueId, packages, '', true, function (styleObj) {
+ defer.resolve(styleObj);
+ });
+ return defer.promise;
+ };
+
result.load = function(id, require, load)
{
/* jshint unused: true */
|
css now can load from string
|
ninejs_ninejs
|
train
|
js
|
57f312172ab188fb186431028bb3cefadbc60a9d
|
diff --git a/lib/notee/helpers/notee_helper.rb b/lib/notee/helpers/notee_helper.rb
index <HASH>..<HASH> 100644
--- a/lib/notee/helpers/notee_helper.rb
+++ b/lib/notee/helpers/notee_helper.rb
@@ -63,17 +63,6 @@ module Notee
@posts = Notee::Post.where(user_id: writer.id, status: Notee::STATUS[:published], is_deleted: false).order(published_at: :desc)
end
- def notee_categories
-
- notee_categories_arr = {}
-
- get_parent_categories_arr.each do |cate|
- post_count = get_category_posts_count(cate)
- notee_categories_arr.store(cate.name, [post_count, cate])
- end
-
- notee_categories_arr
- end
def notee_archives
posts = Notee::Post.select(:published_at).where(status: 1, is_deleted: false).order(created_at: :desc)
@@ -142,6 +131,8 @@ module Notee
count
end
+ private
+
def recursive_category_family_loop(category, count)
if category.children.present?
category.children.each do |child_cate|
|
delete notee_categories method
|
maru-u_notee
|
train
|
rb
|
26a0c02196ccecafb64a152aaecf6067fbb5cc06
|
diff --git a/lib/dugway/store.rb b/lib/dugway/store.rb
index <HASH>..<HASH> 100644
--- a/lib/dugway/store.rb
+++ b/lib/dugway/store.rb
@@ -131,7 +131,12 @@ module Dugway
end
def lookup(permalink, array)
- array.find { |item| item['permalink'] == permalink }.try(:dup)
+ if item = array.find { |item| item['permalink'] == permalink }
+ # Create a deep copy
+ Marshal.load(Marshal.dump(item))
+ else
+ nil
+ end
end
def lookup_products(permalink, type)
|
Create a deep copy of lookup items. Fixes #<I>
|
bigcartel_dugway
|
train
|
rb
|
18dbb5aaf5b8cbfd8bea2fd8939fd1e37cdb402c
|
diff --git a/src/Bot.php b/src/Bot.php
index <HASH>..<HASH> 100644
--- a/src/Bot.php
+++ b/src/Bot.php
@@ -227,7 +227,7 @@ class Bot
* and monitor those connections for events to forward to plugins.
*
* @param bool $autorun
- *
+ *
* @throws \RuntimeException if configuration is inconsistent with
* expected structure
*/
|
Removed whitespace at end of line
|
phergie_phergie-irc-bot-react
|
train
|
php
|
3152d495b30695bd91ba6d2df45bf2565dfb70e1
|
diff --git a/tensorpack/tfutils/distributions.py b/tensorpack/tfutils/distributions.py
index <HASH>..<HASH> 100644
--- a/tensorpack/tfutils/distributions.py
+++ b/tensorpack/tfutils/distributions.py
@@ -172,7 +172,7 @@ class CategoricalDistribution(Distribution):
def _loglikelihood(self, x, theta):
eps = 1e-8
- return tf.reduce_sum(tf.log(theta + eps) * x, reduction_indices=1)
+ return tf.reduce_sum(tf.log(theta + eps) * x, 1)
def _encoder_activation(self, dist_param):
return tf.nn.softmax(dist_param)
@@ -214,8 +214,7 @@ class GaussianDistribution(Distribution):
exponent = (x - mean) / (stddev + eps)
return tf.reduce_sum(
- - 0.5 * np.log(2 * np.pi) - tf.log(stddev + eps) - 0.5 * tf.square(exponent),
- reduction_indices=1
+ - 0.5 * np.log(2 * np.pi) - tf.log(stddev + eps) - 0.5 * tf.square(exponent), 1
)
def _encoder_activation(self, dist_param):
|
reduction_indices was deprecated in TF
|
tensorpack_tensorpack
|
train
|
py
|
75878fe757a502830d4d8c227bc229edc62e8fa3
|
diff --git a/decode.go b/decode.go
index <HASH>..<HASH> 100644
--- a/decode.go
+++ b/decode.go
@@ -362,7 +362,16 @@ func createNewOutInner(outInnerWasPointer bool, outInnerType reflect.Type) refle
func setInnerField(outInner *reflect.Value, outInnerWasPointer bool, index []int, value string, omitEmpty bool) error {
oi := *outInner
if outInnerWasPointer {
+ // initialize nil pointer
+ if oi.IsNil() {
+ setField(oi, "", omitEmpty)
+ }
oi = outInner.Elem()
}
+ // because pointers can be nil need to recurse one index at a time and perform nil check
+ if len(index) > 1 {
+ nextField := oi.Field(index[0])
+ return setInnerField(&nextField, nextField.Kind() == reflect.Ptr, index[1:], value, omitEmpty)
+ }
return setField(oi.FieldByIndex(index), value, omitEmpty)
}
|
initialize nil pointer values on decode for nested structs
|
gocarina_gocsv
|
train
|
go
|
8f07db846ff6984e687cbe84023ae96cb2004fdf
|
diff --git a/lib/serverspec/type/x509_certificate.rb b/lib/serverspec/type/x509_certificate.rb
index <HASH>..<HASH> 100644
--- a/lib/serverspec/type/x509_certificate.rb
+++ b/lib/serverspec/type/x509_certificate.rb
@@ -84,9 +84,9 @@ module Serverspec::Type
# Normalize output between openssl versions.
def normalize_dn(dn)
- return subject unless subject.start_with?('/')
+ return dn unless dn.start_with?('/')
# normalize openssl >= 1.1 to < 1.1 output
- subject[1..-1].split('/').join(', ').gsub('=', ' = ')
+ dn[1..-1].split('/').join(', ').gsub('=', ' = ')
end
end
end
|
Fixed infinite loop in subject of x<I>_certificate
|
mizzy_serverspec
|
train
|
rb
|
9b61108f667e88ab225b58311149d0c30bd9818e
|
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/remote/RemoteGraph.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/remote/RemoteGraph.java
index <HASH>..<HASH> 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/remote/RemoteGraph.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/remote/RemoteGraph.java
@@ -29,6 +29,7 @@ import org.apache.tinkerpop.gremlin.structure.Graph;
import org.apache.tinkerpop.gremlin.structure.Transaction;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import org.apache.tinkerpop.gremlin.structure.util.GraphFactory;
+import org.apache.tinkerpop.gremlin.structure.util.StringFactory;
import org.apache.tinkerpop.gremlin.structure.util.empty.EmptyGraph;
import java.lang.reflect.Constructor;
@@ -193,6 +194,11 @@ public class RemoteGraph implements Graph {
return RemoteFeatures.INSTANCE;
}
+ @Override
+ public String toString() {
+ return StringFactory.graphString(this, connection.toString());
+ }
+
public static class RemoteFeatures implements Features {
static RemoteFeatures INSTANCE = new RemoteFeatures();
|
Cleaned up the toString() on RemoteGraph.
|
apache_tinkerpop
|
train
|
java
|
ebdb7313f1d346aaa047901228548b86df6727f0
|
diff --git a/openstack_dashboard/dashboards/project/dashboard.py b/openstack_dashboard/dashboards/project/dashboard.py
index <HASH>..<HASH> 100644
--- a/openstack_dashboard/dashboards/project/dashboard.py
+++ b/openstack_dashboard/dashboards/project/dashboard.py
@@ -45,22 +45,22 @@ class ObjectStorePanels(horizon.PanelGroup):
class OrchestrationPanels(horizon.PanelGroup):
- name = _("Orchestration")
slug = "orchestration"
+ name = _("Orchestration")
panels = ('stacks',
'stacks.resource_types',)
class DatabasePanels(horizon.PanelGroup):
- name = _("Database")
slug = "database"
+ name = _("Database")
panels = ('databases',
'database_backups',)
class DataProcessingPanels(horizon.PanelGroup):
- name = _("Data Processing")
slug = "data_processing"
+ name = _("Data Processing")
panels = ('data_processing.wizard',
'data_processing.clusters',
'data_processing.job_executions',
|
Sort the panel's variable in the dashboards.py
In the dashboards.py some PanelGroup's variable
use(slug,name.panels), and some use(name, slug, panels),
we can unit it, used as(slug,name.panels).
Change-Id: If<I>fcb<I>c<I>c<I>db8bceb4ed<I>c<I>
Closes-bug:#<I>
|
openstack_horizon
|
train
|
py
|
c5ae330b00f64939e7d74cc4f8d787e01e6d16ed
|
diff --git a/src/performance/captureHardNavigation.js b/src/performance/captureHardNavigation.js
index <HASH>..<HASH> 100644
--- a/src/performance/captureHardNavigation.js
+++ b/src/performance/captureHardNavigation.js
@@ -22,7 +22,7 @@ function isValidTrace (transaction, trace) {
module.exports = function captureHardNavigation (transaction) {
if (transaction.isHardNavigation && window.performance && window.performance.timing) {
- var baseTime = window.performance.timing.navigationStart
+ var baseTime = window.performance.timing.fetchStart
var timings = window.performance.timing
transaction._rootTrace._start = transaction._start = 0
|
fix: use fetchStart instead of navigationStart for the base time
|
opbeat_opbeat-js-core
|
train
|
js
|
94a54f2c648eba2ab7defcaf3ed3b89bb7531bed
|
diff --git a/src/drivers/chrome/js/driver.js b/src/drivers/chrome/js/driver.js
index <HASH>..<HASH> 100644
--- a/src/drivers/chrome/js/driver.js
+++ b/src/drivers/chrome/js/driver.js
@@ -55,7 +55,7 @@
for ( option in defaults ) {
localStorage[option] = defaults[option];
}
- } else if ( version !== localStorage['version'] && localStorage['upgradeMessage'] ) {
+ } else if ( version !== localStorage['version'] && parseInt(localStorage['upgradeMessage'], 10) ) {
upgraded = true;
}
|
Respect "Show upgrade message" option in Chrome
|
AliasIO_Wappalyzer
|
train
|
js
|
e3a23f4ae6c12a2ac52719f41e2d986d38db0acd
|
diff --git a/src/Composer/DependencyResolver/Solver.php b/src/Composer/DependencyResolver/Solver.php
index <HASH>..<HASH> 100644
--- a/src/Composer/DependencyResolver/Solver.php
+++ b/src/Composer/DependencyResolver/Solver.php
@@ -796,10 +796,10 @@ class Solver
continue 2; // next rule
}
} else {
- if ($this->decisions->decidedInstall(abs($literal))) {
+ if ($this->decisions->decidedInstall($literal)) {
continue 2; // next rule
}
- if ($this->decisions->undecided(abs($literal))) {
+ if ($this->decisions->undecided($literal)) {
$decisionQueue[] = $literal;
}
}
|
Remove unnecessary abs() calls
Literal cannot be negative at this point
|
composer_composer
|
train
|
php
|
361ac45d72875f7a070601b17c27fdb3773bb1ec
|
diff --git a/src/foremast/utils/lookups.py b/src/foremast/utils/lookups.py
index <HASH>..<HASH> 100644
--- a/src/foremast/utils/lookups.py
+++ b/src/foremast/utils/lookups.py
@@ -102,8 +102,9 @@ class GitLookup():
"""
file_contents = ''
+ file_path = os.path.join(self.runway_dir, filename)
+
try:
- file_path = os.path.join(self.runway_dir, filename)
with open(file_path, 'rt') as lookup_file:
file_contents = lookup_file.read()
except FileNotFoundError:
|
refactor: Move safe assignment outside of try
See also: #<I>
|
foremast_foremast
|
train
|
py
|
70b322cc32118ed2983d62ef03994a91fcf825a7
|
diff --git a/index_edit.php b/index_edit.php
index <HASH>..<HASH> 100644
--- a/index_edit.php
+++ b/index_edit.php
@@ -89,6 +89,7 @@ if ($user_id) {
}
if ($action=='update') {
+ Zend_Session::writeClose();
foreach (array('main', 'side') as $location) {
if ($location=='main') {
$new_blocks=$main;
|
Changing home/my page blocks fails for some users
|
fisharebest_webtrees
|
train
|
php
|
3d68105ecb521a054cde032fef8062675fcfda1e
|
diff --git a/spec/hook_handler/hook_handler_hook_spec.rb b/spec/hook_handler/hook_handler_hook_spec.rb
index <HASH>..<HASH> 100644
--- a/spec/hook_handler/hook_handler_hook_spec.rb
+++ b/spec/hook_handler/hook_handler_hook_spec.rb
@@ -97,4 +97,13 @@ describe EvalHook::HookHandler, "hook handler hooks" do
hh.evalhook("TestModule321::B")
end
+ it "should intercept global_variable access" do
+ hh = EvalHook::HookHandler.new
+
+ hh.should_receive(:handle_gvar).with(:$global_variable_test)
+
+ hh.evalhook("$global_variable_test")
+ end
+
+
end
\ No newline at end of file
|
added test for interception of global variable access (pass)
|
tario_evalhook
|
train
|
rb
|
5e29558e87dabb0cd3975c0c496b219cb8280c24
|
diff --git a/src/FilterRule/NumberFormat.php b/src/FilterRule/NumberFormat.php
index <HASH>..<HASH> 100644
--- a/src/FilterRule/NumberFormat.php
+++ b/src/FilterRule/NumberFormat.php
@@ -41,7 +41,7 @@ class NumberFormat extends FilterRule
*/
public function __construct($decimals, $decimalPoint, $thousandSeperator)
{
- $this->decimals = $decimals;
+ $this->decimals = intval($decimals);
$this->decimalPoint = $decimalPoint;
$this->thousandSeperator = $thousandSeperator;
}
|
#<I>: Added intval to cast the decimals-configuration to int
|
particle-php_Filter
|
train
|
php
|
2bffae847f4e30d3351146859076937d06644eaa
|
diff --git a/lib/houston/conversations.rb b/lib/houston/conversations.rb
index <HASH>..<HASH> 100644
--- a/lib/houston/conversations.rb
+++ b/lib/houston/conversations.rb
@@ -25,8 +25,12 @@ module Houston
listeners.hear(message).each do |match|
event = Houston::Conversations::Event.new(match)
- yield event if block_given?
- match.listener.call_async event
+
+ if block_given?
+ yield event, match.listener
+ else
+ match.listener.call_async event
+ end
# Invoke only one listener per message
return true
|
[refactor] Yielded listener as well to Houston::Conversations.hear and allowed client code to invoke it (4m)
|
houston_houston-conversations
|
train
|
rb
|
2e5044d0a728fa624a99e6b7165feb1808433f8a
|
diff --git a/pyqode/core/server.py b/pyqode/core/server.py
index <HASH>..<HASH> 100644
--- a/pyqode/core/server.py
+++ b/pyqode/core/server.py
@@ -111,6 +111,7 @@ class Server(object):
self._workQueue = []
if autoCloseOnQuit:
QtGui.QApplication.instance().aboutToQuit.connect(self.close)
+ self._lock = thread.allocate_lock()
def close(self):
"""
@@ -148,7 +149,6 @@ class Server(object):
logger.info("Connected to Code Completion Server on 127.0.0.1:%d" %
port)
self.__running = True
- self._lock = thread.allocate_lock()
thread.start_new_thread(self._threadFct, ())
except OSError:
logger.exception("Failed to connect to Code Completion Server on "
|
Fix issue with _lock not allocated
|
pyQode_pyqode.core
|
train
|
py
|
2f68c73619cd6d2ada8838f91d8ff4b64105d7b2
|
diff --git a/chance.js b/chance.js
index <HASH>..<HASH> 100644
--- a/chance.js
+++ b/chance.js
@@ -442,7 +442,7 @@
}
if (options.prefix) {
- name = this.prefix() + ' ' + name;
+ name = this.prefix(options) + ' ' + name;
}
return name;
|
Ensure gender option from name passed along to prefix, if provided
|
chancejs_chancejs
|
train
|
js
|
727217970d5c65c708f105c0db36556afb2a15f8
|
diff --git a/src/main/java/br/com/fixturefactory/ObjectFactory.java b/src/main/java/br/com/fixturefactory/ObjectFactory.java
index <HASH>..<HASH> 100755
--- a/src/main/java/br/com/fixturefactory/ObjectFactory.java
+++ b/src/main/java/br/com/fixturefactory/ObjectFactory.java
@@ -65,7 +65,7 @@ public class ObjectFactory {
for (Property property : rule.getProperties()) {
Class<?> fieldType = ReflectionUtils.invokeRecursiveType(result, property.getName());
- Object value = property.hasRelationFunction() || fieldType.getEnclosingClass() != null ?
+ Object value = property.hasRelationFunction() || ReflectionUtils.isInnerClass(fieldType) ?
property.getValue(result) : property.getValue();
|
fixing inner class verify on instatiate properties on ObjectFactory
|
six2six_fixture-factory
|
train
|
java
|
3ead5175c4d5b1efe7947f5e65d72ce1e5a6315a
|
diff --git a/src/Phug/Util/Util/TestCase.php b/src/Phug/Util/Util/TestCase.php
index <HASH>..<HASH> 100644
--- a/src/Phug/Util/Util/TestCase.php
+++ b/src/Phug/Util/Util/TestCase.php
@@ -54,8 +54,8 @@ class TestCase extends TestCaseTypeBase
protected function removeFile($file)
{
if (is_dir($file)) {
- $this->emptyDirectory($file);
- rmdir($file);
+ @$this->emptyDirectory($file);
+ @rmdir($file);
return;
}
|
Mute scandir failures in tests cleanup step
|
phug-php_phug
|
train
|
php
|
e64b4b50939389d3fd47e33dd967449065763408
|
diff --git a/GradientFeatureAuditor.py b/GradientFeatureAuditor.py
index <HASH>..<HASH> 100644
--- a/GradientFeatureAuditor.py
+++ b/GradientFeatureAuditor.py
@@ -9,7 +9,7 @@ import time
import os
import json
-ENABLE_MULTIPROCESSING = False
+ENABLE_MULTIPROCESSING = True
SAVE_REPAIRED_DATA = True
SAVE_PREDICTION_DETAILS = True
|
Re-enabled GFA multiprocessing
|
algofairness_BlackBoxAuditing
|
train
|
py
|
7754c5b852e556426e6c0e58909c505818e599bb
|
diff --git a/epa/__init__.py b/epa/__init__.py
index <HASH>..<HASH> 100644
--- a/epa/__init__.py
+++ b/epa/__init__.py
@@ -1,6 +1,8 @@
#!/usr/bin/env python
import envirofacts
+import gics
+import pcs
import radinfo
-__all__ = [envirofacts, radinfo]
+__all__ = [envirofacts, gics, pcs, radinfo]
|
Added GICS and PCS to __init__.py file in EPA
|
codeforamerica_epa_python
|
train
|
py
|
251e9b138bf5551730d1f3a26ced9f44b61cdcf5
|
diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -5,7 +5,7 @@ setup(name='cbamf',
author='Matt Bierbaum, Brian Leahy, Alex Alemi',
version='0.1.1',
- packages=['cbamf', 'cbamf.mc', 'cbamf.comp', 'cbamf.psf', 'cbamf.viz', 'cbamf.priors', 'cbamf.test'],
+ packages=['cbamf', 'cbamf.mc', 'cbamf.comp', 'cbamf.psf', 'cbamf.viz', 'cbamf.priors', 'cbamf.test', 'cbamf.opt'],
install_requires=[
"numpy>=1.8.1",
"scipy>=0.14.0",
|
added cbamf.opt to setup.py
|
peri-source_peri
|
train
|
py
|
15523bd58f4b867ec67ad57ce62c0cff397b70c6
|
diff --git a/insteonplm/protocol.py b/insteonplm/protocol.py
index <HASH>..<HASH> 100755
--- a/insteonplm/protocol.py
+++ b/insteonplm/protocol.py
@@ -280,6 +280,11 @@ class PLM(asyncio.Protocol):
if code == b'\x6a':
self.log.info('ALL-Link database dump is complete')
self.devices.state = 'loaded'
+ for da in dir(self.devices):
+ if 'cat' in self.devices[da] and self.devices[da]['cat'] > 0:
+ self.log.debug('I already know the category for %s (%s)', da, hex(self.devices[da]['cat']))
+ else:
+ self.product_data_request(da)
else:
self.log.warn('Sent command %s was NOT successful! (acknak %d)', binascii.hexlify(sm), acknak)
|
Request product data for any catless device
If, after completing the ALL-Link Database dump, we see a device for which
there is no known category, request a followup product data requrest from that
device.
|
nugget_python-insteonplm
|
train
|
py
|
5ca2dd70c7e8ebabbe850b4ee8a4b7cb3a146d0a
|
diff --git a/spring-boot-admin-server-ui/src/main/frontend/viewRegistry.js b/spring-boot-admin-server-ui/src/main/frontend/viewRegistry.js
index <HASH>..<HASH> 100644
--- a/spring-boot-admin-server-ui/src/main/frontend/viewRegistry.js
+++ b/spring-boot-admin-server-ui/src/main/frontend/viewRegistry.js
@@ -70,7 +70,7 @@ export default class ViewRegistry {
const children = this._toRoutes(views, v => v.parent === p.name);
return ({
path: p.path,
- name: children.length === 0 ? p.name : undefined,
+ name: p.name,
component: p.component,
props: p.props,
meta: {view: p},
|
Allow creation of custom nested routed components
Undefined name prevents creation of nested routed components, because the `router-link` in `sidebar` uses this name as target. Any (custom) instance view that is determined to have any children is therefore unclickable.
In fact I can't see any reason to have undefined name. Maybe there is some, but in such case I would like to know it to be able to design some workaround.
|
codecentric_spring-boot-admin
|
train
|
js
|
5173fbbb2c598eee0d7c8db80b2f2f0fbe4c7713
|
diff --git a/core/API/Proxy.php b/core/API/Proxy.php
index <HASH>..<HASH> 100644
--- a/core/API/Proxy.php
+++ b/core/API/Proxy.php
@@ -480,7 +480,7 @@ class Proxy extends Singleton
$hideLine = trim($hideLine);
$hideLine .= ' ';
- $token = strtok($hideLine, " ");
+ $token = trim(strtok($hideLine, " "), "\n");
$hide = false;
|
fix annotations which were broken in case there was no space after anotation and new line character
|
matomo-org_matomo
|
train
|
php
|
97492b1f242cf2d33c2666ca26aef73887813002
|
diff --git a/ELiDE/ELiDE/statlist.py b/ELiDE/ELiDE/statlist.py
index <HASH>..<HASH> 100644
--- a/ELiDE/ELiDE/statlist.py
+++ b/ELiDE/ELiDE/statlist.py
@@ -156,21 +156,12 @@ class StatListView(ListView):
def __init__(self, **kwargs):
kwargs['adapter'] = self.get_adapter()
self._listeners = {}
- self.bind(remote=self._trigger_handle_remote)
super().__init__(**kwargs)
def on_time(self, *args):
super().on_time(*args)
self._trigger_upd_data()
- def handle_remote(self, *args):
- if hasattr(self, '_old_remote'):
- self.unlisten(remote=self._old_remote)
- self._old_remote = self.remote
- self.mirror = dict(self.remote)
- self.refresh_adapter()
- _trigger_handle_remote = trigger(handle_remote)
-
def on_mirror(self, *args):
self._trigger_upd_data()
self._trigger_sortkeys()
@@ -267,7 +258,6 @@ class StatListView(ListView):
_trigger_refresh_adapter = trigger(refresh_adapter)
def upd_data(self, *args):
- self.mirror = dict(self.remote)
if (
'_control' in self.mirror
):
|
Get rid of old MirrorMapping-based listeners
|
LogicalDash_LiSE
|
train
|
py
|
c19fa9f2d0acebb46e5f7c9075aa5b96a5d5c5a5
|
diff --git a/tests/test_library.py b/tests/test_library.py
index <HASH>..<HASH> 100644
--- a/tests/test_library.py
+++ b/tests/test_library.py
@@ -125,7 +125,6 @@ def test_library_add_edit_delete(plex, movies, photos):
# Create Other Videos library = No external metadata scanning
section_name = "plexapi_test_section"
movie_location = movies.locations[0]
- movie_path = plex.browse(path=movie_location)[0]
photo_location = photos.locations[0]
plex.library.add(
name=section_name,
@@ -173,12 +172,6 @@ def test_library_add_edit_delete(plex, movies, photos):
section.addLocations(photo_location)
section.reload()
assert len(section.locations) == 2
- section.removeLocations(movie_path)
- section.reload()
- assert len(section.locations) == 1
- section.addLocations(movie_path)
- section.reload()
- assert len(section.locations) == 2
section.edit(**{'location': [movie_location]})
section.reload()
assert len(section.locations) == 1
|
removing testing with `Path` object
|
pkkid_python-plexapi
|
train
|
py
|
34b9d9fe3ea09a610f30ef61aa1c65c391ee13eb
|
diff --git a/bundler.d/checking.rb b/bundler.d/checking.rb
index <HASH>..<HASH> 100644
--- a/bundler.d/checking.rb
+++ b/bundler.d/checking.rb
@@ -1,7 +1,6 @@
group :checking do
unless defined? JRUBY_VERSION
- # TODO - lock until we get this working on rhel6
- gem 'therubyracer', "= 0.11.0beta8", :require => "v8"
+ gem 'therubyracer', "~> 0.11.0", :require => "v8"
gem 'ref'
end
gem 'jshintrb', '0.2.1'
|
bumping version of therubyracer
|
Katello_katello
|
train
|
rb
|
5f6ee71cd9290212a547acc8fff7438e02d5e44a
|
diff --git a/lib/active_record/connection_adapters/sqlserver/database_statements.rb b/lib/active_record/connection_adapters/sqlserver/database_statements.rb
index <HASH>..<HASH> 100644
--- a/lib/active_record/connection_adapters/sqlserver/database_statements.rb
+++ b/lib/active_record/connection_adapters/sqlserver/database_statements.rb
@@ -106,8 +106,8 @@ module ActiveRecord
end
end
- def empty_insert_statement(table_name)
- "INSERT INTO #{quote_table_name(table_name)} DEFAULT VALUES"
+ def empty_insert_statement_value
+ "DEFAULT VALUES"
end
def case_sensitive_equality_operator
|
[Rails3] New DatabaseStatement for empty insert statements.
|
rails-sqlserver_activerecord-sqlserver-adapter
|
train
|
rb
|
2821d56d832f1b84037624a6357f1ccdc45e4936
|
diff --git a/news-bundle/src/Resources/contao/dca/tl_news.php b/news-bundle/src/Resources/contao/dca/tl_news.php
index <HASH>..<HASH> 100644
--- a/news-bundle/src/Resources/contao/dca/tl_news.php
+++ b/news-bundle/src/Resources/contao/dca/tl_news.php
@@ -320,7 +320,7 @@ $GLOBALS['TL_DCA']['tl_news'] = array
'exclude' => true,
'search' => true,
'inputType' => 'text',
- 'eval' => array('maxlength'=>255, 'tl_class'=>'w50'),
+ 'eval' => array('maxlength'=>255, 'allowHtml'=>true, 'tl_class'=>'w50'),
'sql' => "varchar(255) NOT NULL default ''"
),
'floating' => array
|
[News] Allow HTML input in image caption fields (see #<I>)
|
contao_contao
|
train
|
php
|
5800db7c1b15fa96653e9525187bb8c90bf92bc5
|
diff --git a/spec/unit/connection_spec.rb b/spec/unit/connection_spec.rb
index <HASH>..<HASH> 100644
--- a/spec/unit/connection_spec.rb
+++ b/spec/unit/connection_spec.rb
@@ -109,7 +109,7 @@ module Neography
end
it "does requests with authentication" do
- connection.client.should_receive(:set_auth).with(
+ connection.client.should_not_receive(:set_auth).with(
"http://localhost:7474/db/data/foo/bar",
"foo",
"bar") { double.as_null_object }
|
authentication now happens at initialization, not later
|
maxdemarzi_neography
|
train
|
rb
|
f1366fde385890677674320678075d4d2bb47a99
|
diff --git a/lib/dryrun/android_project.rb b/lib/dryrun/android_project.rb
index <HASH>..<HASH> 100644
--- a/lib/dryrun/android_project.rb
+++ b/lib/dryrun/android_project.rb
@@ -82,7 +82,7 @@ module Dryrun
content = File.open(@settings_gradle_path, 'rb').read
modules = content.scan(/'([^']*)'/)
- modules.each {|replacement| replacement.first.tr!(':', '/')}
+ modules.each {|replacement| replacement.first.tr!(':', '')}
end
def execute_command(command)
@@ -112,8 +112,8 @@ module Dryrun
end
def sample_project
- if @custom_module && @modules.any? {|m| m.first == "/#{@custom_module}"}
- @path_to_sample = File.join(@base_path, "/#{@custom_module}")
+ if @custom_module && @modules.any? {|m| m.first == "#{@custom_module}"}
+ @path_to_sample = File.join(@base_path, "#{@custom_module}")
return @path_to_sample
else
@modules.each do |child|
|
Do not inclue file separator to the name of custom module
|
cesarferreira_dryrun
|
train
|
rb
|
3ddccb78a64f88b7e638aab99f6b980f529aba2c
|
diff --git a/silverberg/thrift_client.py b/silverberg/thrift_client.py
index <HASH>..<HASH> 100644
--- a/silverberg/thrift_client.py
+++ b/silverberg/thrift_client.py
@@ -109,7 +109,7 @@ class OnDemandThriftClient(object):
return d
def _notify_on_connect(self):
- d = Deferred(lambda d: self.disconnect())
+ d = Deferred()
self._waiting_on_connect.append(d)
return d
|
reverted cancellation in thirftclient
since cancellation of cqlclient will call its disconnect which will call
thrift client's disconnect
|
rackerlabs_silverberg
|
train
|
py
|
c9c982ea9dfcb82e3dfb339be072f5c6a755bf73
|
diff --git a/gui.go b/gui.go
index <HASH>..<HASH> 100644
--- a/gui.go
+++ b/gui.go
@@ -6,6 +6,7 @@ package gocui
import (
"errors"
+ "sync"
"github.com/nsf/termbox-go"
)
@@ -28,6 +29,9 @@ type Gui struct {
keybindings []*keybinding
maxX, maxY int
+ // Protects the gui from being flushed concurrently.
+ mu sync.Mutex
+
// BgColor and FgColor allow to configure the background and foreground
// colors of the GUI.
BgColor, FgColor Attribute
@@ -254,6 +258,9 @@ func (g *Gui) handleEvent(ev *termbox.Event) error {
// Flush updates the gui, re-drawing frames and buffers.
func (g *Gui) Flush() error {
+ g.mu.Lock()
+ defer g.mu.Unlock()
+
if g.layout == nil {
return errors.New("Null layout")
}
|
Protect Gui from being flushed concurrently
|
jroimartin_gocui
|
train
|
go
|
b913baf0301772d4a5c493f0d16babc483225830
|
diff --git a/Gruntfile.js b/Gruntfile.js
index <HASH>..<HASH> 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -480,7 +480,7 @@ module.exports = function(grunt) {
// public commands
grunt.registerTask('happyplan:dev', ['jshint', 'happyplan:build']);
- grunt.registerTask('happyplan:dist', ['jshint', 'happyplan:build', 'imagemin:dist']);//, 'clean:build']);
+ grunt.registerTask('happyplan:dist', ['jshint', 'happyplan:build', 'imagemin:dist']);
//happyplan: == default
grunt.registerTask('happyplan:default', ['happyplan:dev', 'connect:server', 'open:dev', 'watch']);
diff --git a/tasks/build.js b/tasks/build.js
index <HASH>..<HASH> 100644
--- a/tasks/build.js
+++ b/tasks/build.js
@@ -27,6 +27,7 @@ module.exports = function (grunt) {
grunt.registerTask('happyplan:build', 'Build the website', [
// clean everything
+ 'clean:build',
'clean:dist',
// run static generator
|
Start with a clean `build` directory each time you start the process.
Close #<I>
|
happyplan_happyplan
|
train
|
js,js
|
86ed0e28c1d13c878099526a269b47717ee39113
|
diff --git a/helpers/io_helper.rb b/helpers/io_helper.rb
index <HASH>..<HASH> 100644
--- a/helpers/io_helper.rb
+++ b/helpers/io_helper.rb
@@ -127,6 +127,11 @@ module IO_helper
File.open(path, 'w+'){|f| f.write(new_lines.join)}
end
+ def cd_in(path)
+ puts "cd into #{path}".colorize(:green)
+ FileUtils.cd(path)
+ end
+
def cli_exist?(path, cli)
File.directory?("#{path}/#{cli}")
end
|
io helper cd_in method added
|
0000marcell_simple_commander
|
train
|
rb
|
6f81a4aaa565eea36b4cbab69ce00e12e01e53d3
|
diff --git a/tests/test_kvstore.py b/tests/test_kvstore.py
index <HASH>..<HASH> 100644
--- a/tests/test_kvstore.py
+++ b/tests/test_kvstore.py
@@ -176,6 +176,13 @@ class KVStoreBase(object):
class TestBsddbStore(unittest.TestCase, KVStoreBase):
DB = "tests.test_bsddb_store"
+ @classmethod
+ def setUpClass(cls):
+ try:
+ import bsddb
+ except ImportError:
+ raise unittest.SkipTest("bsddb not installed")
+
def setUp(self):
self.store = cobe.kvstore.BsddbStore(self.DB)
|
Skip BsddbStore tests if bsddb is missing or broken (as on OSX)
|
pteichman_cobe
|
train
|
py
|
056b36985ff44b4172f6ab6355e60a9e3c35cc16
|
diff --git a/src/Controller/MenusController.php b/src/Controller/MenusController.php
index <HASH>..<HASH> 100644
--- a/src/Controller/MenusController.php
+++ b/src/Controller/MenusController.php
@@ -18,7 +18,7 @@ class MenusController extends AppController
*/
public function index()
{
- $menus = $this->paginate($this->Menus);
+ $menus = $this->Menus->find('all');
$this->set(compact('menus'));
$this->set('_serialize', ['navMenu']);
|
Removed pagination, will be handled by datatables (task #<I>)
|
QoboLtd_cakephp-menu
|
train
|
php
|
bbb21d4c740a1777869928f5c4e27dd9385443cf
|
diff --git a/src/test/java/com/esotericsoftware/kryo/KryoTest.java b/src/test/java/com/esotericsoftware/kryo/KryoTest.java
index <HASH>..<HASH> 100644
--- a/src/test/java/com/esotericsoftware/kryo/KryoTest.java
+++ b/src/test/java/com/esotericsoftware/kryo/KryoTest.java
@@ -84,7 +84,7 @@ public class KryoTest {
@SuppressWarnings( "unchecked" )
@Override
protected Serializer newDefaultSerializer( final Class type ) {
- return new ReferenceFieldSerializer( _kryo, type );
+ return new ReferenceFieldSerializer( this, type );
}
/**
|
change reference to this instead of the field
|
magro_kryo-serializers
|
train
|
java
|
5280b20e6638c368da543488b00b7e842c6c0773
|
diff --git a/meta/state.go b/meta/state.go
index <HASH>..<HASH> 100644
--- a/meta/state.go
+++ b/meta/state.go
@@ -130,7 +130,19 @@ func (r *localRaft) open() error {
return err
}
- // Make sure our address is in the raft peers or we won't be able to boot into the cluster
+ // For single-node clusters, we can update the raft peers before we start the cluster if the hostname
+ // has changed.
+ if config.EnableSingleNode {
+ if err := r.peerStore.SetPeers([]string{s.RemoteAddr.String()}); err != nil {
+ return err
+ }
+ peers = []string{s.RemoteAddr.String()}
+ }
+
+ // If we have multiple nodes in the cluster, make sure our address is in the raft peers or
+ // we won't be able to boot into the cluster because the other peers will reject our new hostname. This
+ // is difficult to resolve automatically because we need to have all the raft peers agree on the current members
+ // of the cluster before we can change them.
if len(peers) > 0 && !raft.PeerContained(peers, s.RemoteAddr.String()) {
s.Logger.Printf("%v is not in the list of raft peers. Please update %v/peers.json on all raft nodes to have the same contents.", s.RemoteAddr.String(), s.Path())
return fmt.Errorf("peers out of sync: %v not in %v", s.RemoteAddr.String(), peers)
|
Make host rename on single node more seemless
Renaming a host that is a raft peer member is pretty difficult but
we can special case single-node renames since we know all the member
in the cluster and we can update the peer store directly on all nodes
(just one).
Fixes #<I>
|
influxdata_influxdb
|
train
|
go
|
103ea24b83080b4284fd552f5ee8a04c092bd1e4
|
diff --git a/numexpr/version.py b/numexpr/version.py
index <HASH>..<HASH> 100644
--- a/numexpr/version.py
+++ b/numexpr/version.py
@@ -1,5 +1,5 @@
version='1.2'
-release=False
+release=True
if not release:
version += '.dev'
|
Start the packaging phase for <I>.
|
pydata_numexpr
|
train
|
py
|
b5e3397b8806ce29090f1134ed6bc7c3155ffd3e
|
diff --git a/tests/text_quotations_test.py b/tests/text_quotations_test.py
index <HASH>..<HASH> 100644
--- a/tests/text_quotations_test.py
+++ b/tests/text_quotations_test.py
@@ -712,7 +712,11 @@ Subject: Hi
Attachments: none
Hello.
+
+-- Original Message --
+On 24th February 2016 at 09.32am Conal Wrote:
+Hey!
"""
- expected_markers = "stttttsttttet"
+ expected_markers = "stttttsttttetestt"
markers = quotations.split_emails(msg)
eq_(markers, expected_markers)
|
Updating test to account for --original message-- case
|
mailgun_talon
|
train
|
py
|
b3d285df7db5ace54e90a68fca4d812ab463ef89
|
diff --git a/src/models/color.js b/src/models/color.js
index <HASH>..<HASH> 100644
--- a/src/models/color.js
+++ b/src/models/color.js
@@ -272,6 +272,9 @@ const ColorModel = Hook.extend({
:
{ min: timeMdl.start, max: timeMdl.end };
+ if (!limits.min) limits.min = new Date();
+ if (!limits.max) limits.max = new Date();
+
const singlePoint = (limits.max - limits.min == 0);
domain = domain.sort((a, b) => a - b);
|
Add protection for the case when buildScale is executed prematurely and limits are null, which results in error when doing null.valueOf() <URL>
|
vizabi_vizabi
|
train
|
js
|
91c6e5a6cb9e656a0a1f3a074490edcfe7adddfc
|
diff --git a/Dropbox/OAuth/Storage/Encrypter.php b/Dropbox/OAuth/Storage/Encrypter.php
index <HASH>..<HASH> 100644
--- a/Dropbox/OAuth/Storage/Encrypter.php
+++ b/Dropbox/OAuth/Storage/Encrypter.php
@@ -66,6 +66,11 @@ class Encrypter
$iv = substr($cipherText, 0, self::IV_SIZE);
$cipherText = substr($cipherText, self::IV_SIZE);
$data = mcrypt_decrypt(self::CIPHER, $this->key, $cipherText, self::MODE, $iv);
- return unserialize($data);
+ $token = @unserialize($data);
+ if($token === false){ // Unserialize fails if $token is boolean false
+ throw new \Dropbox\Exception('Failed to unserialize token');
+ } else {
+ return $token;
+ }
}
}
|
Added check for failed unserialisation of token
|
BenExile_Dropbox
|
train
|
php
|
4ee98efb38a6376fb3a9e7bf2c5563b35bcf0523
|
diff --git a/src/base/reader.js b/src/base/reader.js
index <HASH>..<HASH> 100644
--- a/src/base/reader.js
+++ b/src/base/reader.js
@@ -151,7 +151,14 @@ const Reader = Class.extend({
const result = Object.keys(row).reduce((result, key) => {
if (correct) {
- const value = utils.isString(row[key]) ? row[key].replace(",", ".").replace(/0*$/, "").trim() : row[key];
+ const defaultValue = row[key];
+ const value = !utils.isString(defaultValue) ?
+ defaultValue :
+ defaultValue.replace(",", ".")
+ .replace(new RegExp(defaultValue.includes(".") ? "0+$" : ""), "")
+ .replace(/\.$/, "")
+ .trim();
+
const parser = parsers[key];
let resultValue;
|
Trim right zeros only if dot is present. Trim trailing dot (#<I>)
|
vizabi_vizabi
|
train
|
js
|
1a416b6b22968bac0b1eb5b9f20d56251e25ca17
|
diff --git a/liquibase-core/src/main/java/liquibase/changelog/OfflineChangeLogHistoryService.java b/liquibase-core/src/main/java/liquibase/changelog/OfflineChangeLogHistoryService.java
index <HASH>..<HASH> 100644
--- a/liquibase-core/src/main/java/liquibase/changelog/OfflineChangeLogHistoryService.java
+++ b/liquibase-core/src/main/java/liquibase/changelog/OfflineChangeLogHistoryService.java
@@ -222,11 +222,11 @@ public class OfflineChangeLogHistoryService extends AbstractChangeLogHistoryServ
csvWriter.writeNext(line);
}
}
- oldFile.delete();
- newFile.renameTo(oldFile);
} catch (Exception e) {
throw new DatabaseException(e);
}
+ oldFile.delete();
+ newFile.renameTo(oldFile);
}
protected void appendChangeSet(ChangeSet changeSet, ChangeSet.ExecType execType) throws DatabaseException {
@@ -265,11 +265,12 @@ public class OfflineChangeLogHistoryService extends AbstractChangeLogHistoryServ
csvWriter.writeNext(newLine);
- oldFile.delete();
- newFile.renameTo(oldFile);
} catch (Exception e) {
throw new DatabaseException(e);
}
+
+ oldFile.delete();
+ newFile.renameTo(oldFile);
}
@Override
|
closing streams before rename
(cherry picked from commit b8c<I>afe7c<I>da<I>ef5f<I>e6a0bed6)
|
liquibase_liquibase
|
train
|
java
|
203b649b10909267ede30b92a12b8140725e1842
|
diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -19,7 +19,7 @@ os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir)))
os.system('pip install https://bitbucket.org/lazka/mutagen/get/default.tar.gz')
setup(
name='soundscrape',
- version='0.22.2',
+ version='0.23.0',
packages=['soundscrape'],
install_requires=required,
extras_require={ ':python_version < "3.0"': [ 'wsgiref>=0.1.2', ], },
@@ -42,6 +42,9 @@ setup(
'Programming Language :: Python',
'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',
+ 'Programming Language :: Python :: 3.3',
+ 'Programming Language :: Python :: 3.4',
+ 'Programming Language :: Python :: 3.5',
'Topic :: Internet :: WWW/HTTP',
'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
],
|
<I> - initial Python3 support. Hoping this doesn't break P2 unicode..
|
Miserlou_SoundScrape
|
train
|
py
|
1dba307f0b4f7b764654efc62a3a8d11d8f16f3f
|
diff --git a/common.js b/common.js
index <HASH>..<HASH> 100644
--- a/common.js
+++ b/common.js
@@ -188,9 +188,11 @@ function schemaToArray(schema,offset,options,data) {
let blockDepth = 0;
let container = [];
let block = { title: '', rows: [] };
- if (schema.description) block.title = schema.description;
- if (!block.title && schema.title) block.title = schema.title;
- if (schema.externalDocs) block.externalDocs = schema.externalDocs;
+ if (schema) {
+ if (schema.description) block.title = schema.description;
+ if (!block.title && schema.title) block.title = schema.title;
+ if (schema.externalDocs) block.externalDocs = schema.externalDocs;
+ }
container.push(block);
let wsState = wsGetState();
wsState.combine = true;
|
Harden prev commit against undefined schemas
|
Mermade_widdershins
|
train
|
js
|
a22a69f36a7d9c34f6fbd0b6c15a0833fcf0a5f4
|
diff --git a/server/clientcommands.js b/server/clientcommands.js
index <HASH>..<HASH> 100644
--- a/server/clientcommands.js
+++ b/server/clientcommands.js
@@ -46,8 +46,13 @@ var listeners = {
// be sent from the IRCd to the target without being truncated.
var blocks = truncateString(args.msg, 350);
- blocks.forEach(function (block) {
- irc_connection.write('PRIVMSG ' + args.target + ' :' + block);
+ blocks.forEach(function (block, idx) {
+ // Apply the callback on the last message only
+ var cb = (idx === blocks.length - 1) ?
+ callback :
+ undefined;
+
+ irc_connection.write('PRIVMSG ' + args.target + ' :' + block, cb);
});
},
@@ -120,8 +125,13 @@ var listeners = {
// be sent from the IRCd to the target without being truncated.
var blocks = truncateString(args.msg, 350);
- blocks.forEach(function (block) {
- irc_connection.write('NOTICE ' + args.target + ' :' + block);
+ blocks.forEach(function (block, idx) {
+ // Apply the callback on the last message only
+ var cb = (idx === blocks.length - 1) ?
+ callback :
+ undefined;
+
+ irc_connection.write('NOTICE ' + args.target + ' :' + block, cb);
});
},
|
Callback fix on on truncated messages
|
prawnsalad_KiwiIRC
|
train
|
js
|
73665d130486c6cb6156f07933f86165aa4d3b82
|
diff --git a/src/autobind.js b/src/autobind.js
index <HASH>..<HASH> 100644
--- a/src/autobind.js
+++ b/src/autobind.js
@@ -78,7 +78,7 @@ function autobindMethod(target, key, { value: fn, configurable, enumerable }) {
return fn;
}
- // Autobound method calling calling super.sameMethod() which is also autobound and so on.
+ // Autobound method calling super.sameMethod() which is also autobound and so on.
if (this.constructor !== constructor && key in this.constructor.prototype) {
return getBoundSuper(this, fn);
}
|
comment had double "calling" word
|
jayphelps_core-decorators
|
train
|
js
|
46118e61bb90ae28ee605b8394f6a813c969c4a4
|
diff --git a/stanza/models/ner_tagger.py b/stanza/models/ner_tagger.py
index <HASH>..<HASH> 100644
--- a/stanza/models/ner_tagger.py
+++ b/stanza/models/ner_tagger.py
@@ -249,8 +249,9 @@ def train(args):
logger.info("Training ended with {} steps.".format(global_step))
- best_f, best_eval = max(dev_score_history)*100, np.argmax(dev_score_history)+1
- logger.info("Best dev F1 = {:.2f}, at iteration = {}".format(best_f, best_eval * args['eval_interval']))
+ if len(dev_score_history) > 0:
+ best_f, best_eval = max(dev_score_history)*100, np.argmax(dev_score_history)+1
+ logger.info("Best dev F1 = {:.2f}, at iteration = {}".format(best_f, best_eval * args['eval_interval']))
def evaluate(args):
# file paths
|
Only report max dev score if ran dev set at least once
|
stanfordnlp_stanza
|
train
|
py
|
8b2dda09aae8fde8a538f5f42f77abc60090a3c3
|
diff --git a/client/state/plugins/installed/test/selectors.js b/client/state/plugins/installed/test/selectors.js
index <HASH>..<HASH> 100644
--- a/client/state/plugins/installed/test/selectors.js
+++ b/client/state/plugins/installed/test/selectors.js
@@ -125,6 +125,20 @@ describe( 'Installed plugin selectors', () => {
} );
} );
+ describe( 'isLoaded', () => {
+ test( 'Should get `false` if this site is not in the current state', () => {
+ expect( selectors.isLoaded( state, 'no.site' ) ).to.be.false;
+ } );
+
+ test( 'Should get `true` if this site is done being fetched', () => {
+ expect( selectors.isLoaded( state, 'site.one' ) ).to.be.true;
+ } );
+
+ test( 'Should get `false` if this site is currently being fetched', () => {
+ expect( selectors.isLoaded( state, 'site.three' ) ).to.be.false;
+ } );
+ } );
+
describe( 'isRequestingForSites', () => {
test( 'Should get `false` if no sites are being fetched', () => {
expect( selectors.isRequestingForSites( state, [ 'site.one', 'site.two' ] ) ).to.be.false;
|
Plugins State: Add test for new isLoaded selector (#<I>)
|
Automattic_wp-calypso
|
train
|
js
|
e535b29ef38246e7ceac2c97ac2078c2b430c89f
|
diff --git a/usb/_interop.py b/usb/_interop.py
index <HASH>..<HASH> 100644
--- a/usb/_interop.py
+++ b/usb/_interop.py
@@ -131,8 +131,7 @@ def as_array(data=None):
except TypeError:
# When you pass a unicode string or a character sequence,
# you get a TypeError if first parameter does not match
- try:
- return array.array('c', data)
- except TypeError:
- return array.array('u', data)
+ a = array.array('B')
+ a.fromstring(data)
+ return a
|
Fixed compatibility with Python <I>. closes #8.
In usb/_interop.py in the as_array function, the array typecodes 'c' and
'u' are used. The 'c' typecode was removed from python <I> and 'u' will
is deprecated. The solution is to use the fromstring array method, but
it has the side effect of adding only the first byte of Unicode strings.
|
pyusb_pyusb
|
train
|
py
|
186282cdaa22c7c8194be2d5c2bd576fe1ceb358
|
diff --git a/login/index.php b/login/index.php
index <HASH>..<HASH> 100644
--- a/login/index.php
+++ b/login/index.php
@@ -152,6 +152,9 @@ if ($authsequence[0] == 'cas' and !empty($CFG->cas_enabled)) {
set_moodle_cookie($USER->username);
set_login_session_preferences();
+ /// This is what lets the user do anything on the site :-)
+ load_all_capabilities();
+
//Select password change url
$userauth = get_auth_plugin($USER->auth);
if ($userauth->can_change_password()) {
@@ -214,8 +217,6 @@ if ($authsequence[0] == 'cas' and !empty($CFG->cas_enabled)) {
reset_login_count();
- load_all_capabilities(); /// This is what lets the user do anything on the site :-)
-
redirect($urltogo);
exit;
|
MDL-<I> placement of load_all_capabilities() in login page
|
moodle_moodle
|
train
|
php
|
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.