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 |
|---|---|---|---|---|---|
d746e3091d01dc0200eab574be97d3bf4da0f740 | diff --git a/test/tests/locales/ja.js b/test/tests/locales/ja.js
index <HASH>..<HASH> 100644
--- a/test/tests/locales/ja.js
+++ b/test/tests/locales/ja.js
@@ -24,8 +24,8 @@ namespace('Date | Japanese', function () {
assertDateParsed('3時45分', new Date(now.getFullYear(), now.getMonth(), now.getDate(), 3, 45));
assertDateParsed('月曜日3時45分', testGetWeekday(1,0,3,45));
- // KABUKICHO!
- assertDateParsed('29時', testDateSet(getRelativeDateReset(0,0,1),{hour:5}));
+ // Sorry Kabukicho
+ assertDateNotParsed('29時');
assertDateParsed('一月', new Date(now.getFullYear(), 0));
assertDateParsed('二月', new Date(now.getFullYear(), 1)); | Removed test for stricter hours parsing. | andrewplummer_Sugar | train | js |
bf6e39390d0c2c3fd1c67d848561fc614f64a573 | diff --git a/index.js b/index.js
index <HASH>..<HASH> 100644
--- a/index.js
+++ b/index.js
@@ -404,6 +404,7 @@ Node.prototype.send = function (msg, fingerprint, cb) {
throw new Error('message may not contain null bytes')
}
+ cb = this._wrapSendCB(msg, cb)
peer = this.getPeerWith('fingerprint', fingerprint)
if (!peer) {
this.contact({
@@ -418,6 +419,14 @@ Node.prototype.send = function (msg, fingerprint, cb) {
peer.send(msg, cb)
}
+Node.prototype._wrapSendCB = function (msg, cb) {
+ var self = this
+ return function () {
+ self._debug('sent', msg)
+ return cb && cb.apply(this, arguments)
+ }
+}
+
Node.prototype.getUnresolvedBy = function (property, value) {
for (var key in this.unresolved) {
if (this.unresolved[key][property] === value) return this.unresolved[key] | wrap node.send cb to log on sent | tradle_zlorp | train | js |
7d59f03afd00940507a3eece57a12a868564301d | diff --git a/lang/en_utf8/moodle.php b/lang/en_utf8/moodle.php
index <HASH>..<HASH> 100644
--- a/lang/en_utf8/moodle.php
+++ b/lang/en_utf8/moodle.php
@@ -36,6 +36,7 @@ $string['addnousersrecip'] = 'Add users who haven\'t accessed this $a to recipie
$string['addresource'] = 'Add a resource...';
$string['address'] = 'Address';
$string['addstudent'] = 'Add student';
+$string['addsubcategory'] = 'Add a sub-category';
$string['addteacher'] = 'Add teacher';
$string['admin'] = 'Admin';
$string['adminbookmarks'] = 'Admin bookmarks'; | MDL-<I>:
Add ability to add sub categories directly from category screens. | moodle_moodle | train | php |
8e4aa95422db6558b57630b6d3aac37c7263a9ae | diff --git a/release.py b/release.py
index <HASH>..<HASH> 100644
--- a/release.py
+++ b/release.py
@@ -132,8 +132,8 @@ def release(version):
github_token, version
)
- run("twine", "upload", "-s", *packages)
run("twine", "upload", *github_actions_wheel_paths)
+ run("twine", "upload", "-s", *packages)
if __name__ == "__main__": | upload wheels before sdist (#<I>) | pyca_bcrypt | train | py |
8d149ccc8b33995886443a01ca770b42b96a268d | diff --git a/aws/data_source_aws_cloudhsm2_cluster_test.go b/aws/data_source_aws_cloudhsm2_cluster_test.go
index <HASH>..<HASH> 100644
--- a/aws/data_source_aws_cloudhsm2_cluster_test.go
+++ b/aws/data_source_aws_cloudhsm2_cluster_test.go
@@ -4,6 +4,7 @@ import (
"fmt"
"testing"
+ "github.com/aws/aws-sdk-go/service/cloudhsmv2"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
)
@@ -13,8 +14,9 @@ func TestAccDataSourceCloudHsmV2Cluster_basic(t *testing.T) {
dataSourceName := "data.aws_cloudhsm_v2_cluster.default"
resource.ParallelTest(t, resource.TestCase{
- PreCheck: func() { testAccPreCheck(t) },
- Providers: testAccProviders,
+ PreCheck: func() { testAccPreCheck(t) },
+ ErrorCheck: testAccErrorCheck(t, cloudhsmv2.EndpointsID),
+ Providers: testAccProviders,
Steps: []resource.TestStep{
{
Config: testAccCheckCloudHsmV2ClusterDataSourceConfig, | tests/ds/cloudhsm2_cluster: Add ErrorCheck | terraform-providers_terraform-provider-aws | train | go |
95da917eedc34441f165e9c7c382e67318f3749a | diff --git a/lib/puppet/functions.rb b/lib/puppet/functions.rb
index <HASH>..<HASH> 100644
--- a/lib/puppet/functions.rb
+++ b/lib/puppet/functions.rb
@@ -185,12 +185,10 @@ module Puppet::Functions
# @api private
def self.min_max_param(method)
result = {:req => 0, :opt => 0, :rest => 0 }
- # TODO: Optimize into one map iteration that produces names map, and sets
- # count as side effect
- method.parameters.each { |p| result[p[0]] += 1 }
+ # count per parameter kind, and get array of names
+ names = method.parameters.map { |p| result[p[0]] += 1 ; p[1].to_s }
from = result[:req]
to = result[:rest] > 0 ? :default : from + result[:opt]
- names = method.parameters.map {|p| p[1].to_s }
[from, to, names]
end | (PUP-<I>) Optimize min_max_param to one map iteration | puppetlabs_puppet | train | rb |
77f6e118f762212e0039313a3905fb7685eb1479 | diff --git a/screens/MainMenu.js b/screens/MainMenu.js
index <HASH>..<HASH> 100644
--- a/screens/MainMenu.js
+++ b/screens/MainMenu.js
@@ -1,7 +1,6 @@
import React from 'react';
import { StyleSheet } from 'react-native';
import Icon from 'react-native-vector-icons/FontAwesome';
-
import {
carbonStyles,
Content, | Tight up imports in main menu | carbon-native_carbon-native | train | js |
94440d35cbc48eb57c2a37fab154ae7761691af6 | diff --git a/lib/parser/nools/tokens.js b/lib/parser/nools/tokens.js
index <HASH>..<HASH> 100644
--- a/lib/parser/nools/tokens.js
+++ b/lib/parser/nools/tokens.js
@@ -143,18 +143,14 @@ module.exports = {
"global": function (orig, context) {
var src = orig.replace(/^global\s*/, "");
- console.log(src);
var name = src.match(/^([a-zA-Z_$][0-9a-zA-Z_$]*\s*)/);
if (name) {
- console.log("name is " + name);
src = src.replace(name[0], "").replace(/^\s*|\s*$/g, "");
- console.log(src);
if (utils.findNextToken(src) === "=") {
name = name[1].replace(/^\s+|\s+$/g, '');
var fullbody = utils.getTokensBetween(src, "=", ";", true).join("");
var body = fullbody.substring(1, fullbody.length - 1);
- console.log(name + "=" + body);
context.scope.push({name: name, body: body});
src = src.replace(fullbody, "");
return src; | Removed extraneous console logs. | noolsjs_nools | train | js |
091e8a97f183b6649d8e97be5e3ec737a0533c84 | diff --git a/lib/paypal_adaptive/request.rb b/lib/paypal_adaptive/request.rb
index <HASH>..<HASH> 100644
--- a/lib/paypal_adaptive/request.rb
+++ b/lib/paypal_adaptive/request.rb
@@ -102,9 +102,11 @@ module PaypalAdaptive
begin
response_data = http.post(path, api_request_data, @headers)
- return JSON.parse(response_data.body)
+ JSON.parse(response_data.body)
rescue Net::HTTPBadGateway => e
rescue_error_message(e, "Error reading from remote server.")
+ rescue JSON::ParserError => e
+ rescue_error_message(e, "Response is not in JSON format.")
rescue Exception => e
case e
when Errno::ECONNRESET | added json parsing error handling | tc_paypal_adaptive | train | rb |
ef04c5abdf962aab1fbbcdae78c7d7c502a6a8dd | diff --git a/xbpch/core.py b/xbpch/core.py
index <HASH>..<HASH> 100644
--- a/xbpch/core.py
+++ b/xbpch/core.py
@@ -374,8 +374,9 @@ class BPCHDataStore(AbstractDataStore):
# Is the variable time-invariant? If it is, kill the time dim.
# Here, we mean it only as one sample in the dataset.
- # if dshape[0] == 1:
- # del dims[0]
+ if data.shape[0] == 1:
+ dims = dims[1:]
+ data = data.squeeze()
# Create a variable containing this data
var = xr.Variable(dims, data, var_attr) | BUG: Fixing incorrect dimensions bug when time-invariant data in bpch file | darothen_xbpch | train | py |
c34ad02a9c212171026ae9f4b637d796fa629678 | diff --git a/Classes/Ttree/ContentRepositoryImporter/Domain/Model/Import.php b/Classes/Ttree/ContentRepositoryImporter/Domain/Model/Import.php
index <HASH>..<HASH> 100644
--- a/Classes/Ttree/ContentRepositoryImporter/Domain/Model/Import.php
+++ b/Classes/Ttree/ContentRepositoryImporter/Domain/Model/Import.php
@@ -62,7 +62,6 @@ class Import {
if (is_array($data) && isset($data['__message'])) {
$message = $parentEvent ? sprintf('- %s', $data['__message']) : $data['__message'];
$this->logger->log($message, isset($data['__severity']) ? (integer)$data['__severity'] : LOG_INFO);
- unset($data['__message'], $data['__severity']);
}
$event = new Event($eventType, $data, NULL, $parentEvent);
$event->setExternalIdentifier($externalIdentifier); | [TASK] Store message and severity in EventLog | ttreeagency_ContentRepositoryImporter | train | php |
0e901b0859980d5b73d3e2ecbaa74cd36cac3175 | diff --git a/src/main/java/com/codeborne/selenide/Selectors.java b/src/main/java/com/codeborne/selenide/Selectors.java
index <HASH>..<HASH> 100644
--- a/src/main/java/com/codeborne/selenide/Selectors.java
+++ b/src/main/java/com/codeborne/selenide/Selectors.java
@@ -55,7 +55,7 @@ public class Selectors {
*
* @param attributeName name of attribute, should not be empty or null
* @param attributeValue value of attribute, should not contain both apostrophes and quotes
- * @return standard selenium By criteria
+ * @return standard selenium By cssSelector criteria
*/
public static By byAttribute(String attributeName, String attributeValue) {
return By.cssSelector(String.format("[%s='%s']", attributeName, attributeValue)); | Change method byAttribute for expand the search possibilities by data attribute of elements | selenide_selenide | train | java |
858878567b0a4fcd0e87220d73178ede1149505f | diff --git a/ceph_deploy/hosts/common.py b/ceph_deploy/hosts/common.py
index <HASH>..<HASH> 100644
--- a/ceph_deploy/hosts/common.py
+++ b/ceph_deploy/hosts/common.py
@@ -18,7 +18,7 @@ def mon_create(distro, args, monitor_keyring, hostname):
done_path = paths.mon.done(args.cluster, hostname)
init_path = paths.mon.init(args.cluster, hostname, distro.init)
- configuration = conf.load(args)
+ configuration = conf.ceph.load(args)
conf_data = StringIO()
configuration.write(conf_data)
@@ -75,7 +75,7 @@ def mon_add(distro, args, monitor_keyring):
done_path = paths.mon.done(args.cluster, hostname)
init_path = paths.mon.init(args.cluster, hostname, distro.init)
- configuration = conf.load(args)
+ configuration = conf.ceph.load(args)
conf_data = StringIO()
configuration.write(conf_data) | fix ceph conf references in hosts.common | ceph_ceph-deploy | train | py |
1348e7dd6025c4d1582ac9816eaa73f4d6818ea3 | diff --git a/coaster/utils.py b/coaster/utils.py
index <HASH>..<HASH> 100644
--- a/coaster/utils.py
+++ b/coaster/utils.py
@@ -76,10 +76,13 @@ def newpin(digits=4):
4
>>> len(newpin(5))
5
- >>> isinstance(int(newpin()), int)
+ >>> newpin().isdigit()
True
"""
- return (u'%%0%dd' % digits) % randint(0, 10 ** digits)
+ randnum = randint(0, 10 ** digits)
+ while len(str(randnum)) > digits:
+ randnum = randint(0, 10 ** digits)
+ return (u'%%0%dd' % digits) % randnum
def make_name(text, delim=u'-', maxlength=50, checkused=None, counter=2): | In newpin, ensure digit count isn't exceeded. | hasgeek_coaster | train | py |
9743ad756fa65c063c32d126ce2e09ac97621ea3 | diff --git a/parser.go b/parser.go
index <HASH>..<HASH> 100644
--- a/parser.go
+++ b/parser.go
@@ -275,15 +275,16 @@ func (p *parser) parseObjectRemainder(tok *token) (astNode, *token, error) {
numFields := 0
numAsserts := 0
var field astObjectField
- for _, field = range fields {
- if field.kind == astObjectLocal {
+ for _, f := range fields {
+ if f.kind == astObjectLocal {
continue
}
- if field.kind == astObjectAssert {
+ if f.kind == astObjectAssert {
numAsserts++
continue
}
numFields++
+ field = f
}
if numAsserts > 0 { | Fix parser - support for locals in comprehensions | google_go-jsonnet | train | go |
f2f56a933c18edd6d182a7943dbb5fa688b93f39 | diff --git a/q.py b/q.py
index <HASH>..<HASH> 100644
--- a/q.py
+++ b/q.py
@@ -60,8 +60,8 @@ if sys.version_info >= (3,):
BASESTRING_TYPES = (str, bytes)
TEXT_TYPES = (str,)
else:
- BASESTRING_TYPES = (basestring,)
- TEXT_TYPES = (unicode,)
+ BASESTRING_TYPES = (basestring,) # noqa
+ TEXT_TYPES = (unicode,) # noqa
# When we insert Q() into sys.modules, all the globals become None, so we
@@ -113,7 +113,6 @@ class Q(object):
__class__.q_max_length = value
self.long
-
# For portably converting strings between python2 and python3
BASESTRING_TYPES = BASESTRING_TYPES
TEXT_TYPES = TEXT_TYPES
@@ -302,7 +301,7 @@ class Q(object):
self.indent += 2
try:
result = func(*args, **kwargs)
- except:
+ except Exception:
# Display an exception.
self.indent -= 2
etype, evalue, etb = self.sys.exc_info() | Fix pycodestyle/flake8 issues | zestyping_q | train | py |
633326fd07a05e80d62452ff538fbd8c61615722 | diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -46,7 +46,6 @@ CLASSIFIERS = [
'Operating System :: Unix',
'Operating System :: MacOS',
'Programming Language :: Python :: 3',
- 'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7', | remove explicit support for py<I> | cggh_scikit-allel | train | py |
a77b0ded8d7757c5324a446ac68e47cae505a67f | diff --git a/xmlunit-matchers/src/test/java/org/xmlunit/matchers/ValidationMatcherTest.java b/xmlunit-matchers/src/test/java/org/xmlunit/matchers/ValidationMatcherTest.java
index <HASH>..<HASH> 100644
--- a/xmlunit-matchers/src/test/java/org/xmlunit/matchers/ValidationMatcherTest.java
+++ b/xmlunit-matchers/src/test/java/org/xmlunit/matchers/ValidationMatcherTest.java
@@ -13,7 +13,6 @@
*/
package org.xmlunit.matchers;
-import org.junit.Ignore;
import org.junit.Test;
import javax.xml.transform.stream.StreamSource;
@@ -49,7 +48,6 @@ public class ValidationMatcherTest {
}
@Test
- @Ignore("Java8's Validator doesn't seem to like https URIs")
public void shouldSuccessfullyValidateInstanceWithoutExplicitSchemaSource() {
assertThat(new StreamSource(new File("../test-resources/BookXsdGenerated.xml")),
is(new ValidationMatcher())); | http-URI should work
This reverts commit 1e3bc<I>c0e<I>f<I>d3e5edfbb<I>a8ed3c<I>f6. | xmlunit_xmlunit | train | java |
10950c51fa587c69feb2e17002e4f9d5216a4628 | diff --git a/tests/extend.js b/tests/extend.js
index <HASH>..<HASH> 100644
--- a/tests/extend.js
+++ b/tests/extend.js
@@ -27,5 +27,6 @@ console.log(instance.toString())
console.log(String(instance))
console.log(''+instance)
console.log(instance+'')
+console.log(instance)
-assert.equal(counter, 5)
+assert.equal(counter, 6) | Update tests/extend.js now that inspect() is overwritten on all id wraps. | TooTallNate_NodObjC | train | js |
20a676a877362b85220bd5c4d5572cab170f4214 | diff --git a/organizations/backends/defaults.py b/organizations/backends/defaults.py
index <HASH>..<HASH> 100644
--- a/organizations/backends/defaults.py
+++ b/organizations/backends/defaults.py
@@ -27,6 +27,7 @@
"""
import email.utils
+import inspect
import uuid
from django.conf import settings
@@ -274,8 +275,12 @@ class InvitationBackend(BaseBackend):
user = self.user_model.objects.get(email=email)
except self.user_model.DoesNotExist:
# TODO break out user creation process
- user = self.user_model.objects.create(username=self.get_username(),
- email=email, password=self.user_model.objects.make_random_password())
+ if 'username' in inspect.getargspec(self.user_model.objects.create_user).args:
+ user = self.user_model.objects.create(username=self.get_username(),
+ email=email, password=self.user_model.objects.make_random_password())
+ else:
+ user = self.user_model.objects.create(email=email,
+ password=self.user_model.objects.make_random_password())
user.is_active = False
user.save()
self.send_invitation(user, sender, **kwargs) | Create user's username only if model field exists
The `invite_by_email()` function's user creation process assumed the
user model would have a `username` field, yielding an error for any
custom user model that does not have such a field (including, for
example, user models that use an email address as the username).
By inspecting the user model's `create_user()` function arguments, we can
avoid the aforementioned error by dropping the `username` argument when
no such field exists. | bennylope_django-organizations | train | py |
2fc24efe8644a30a40fe9c9f47387e62bf35ad0e | diff --git a/rest_framework_swagger/tests.py b/rest_framework_swagger/tests.py
index <HASH>..<HASH> 100644
--- a/rest_framework_swagger/tests.py
+++ b/rest_framework_swagger/tests.py
@@ -394,7 +394,6 @@ class DocumentationGeneratorTest(TestCase):
fields = docgen._get_serializer_fields(CommentSerializer)
self.assertEqual(3, len(fields['fields']))
- self.assertEqual(fields['fields']['email']['defaultValue'], None)
def test_get_serializer_fields_api_with_no_serializer(self):
docgen = DocumentationGenerator()
@@ -948,7 +947,6 @@ class BaseMethodIntrospectorTest(TestCase):
self.assertEqual(len(SomeSerializer().get_fields()), len(params))
self.assertEqual(params[0]['name'], 'email')
- self.assertIsNone(params[0]['defaultValue'])
url_patterns = patterns('', url(r'my-api/', SerializedAPI.as_view()))
urlparser = UrlParser() | Remove assertions for None on defaultValue, since it's no longer present | marcgibbons_django-rest-swagger | train | py |
0e6814c5327e6e9f0189049ab5b9f8362210e17e | diff --git a/src/Codeception/PHPUnit/Overrides/Filter.php b/src/Codeception/PHPUnit/Overrides/Filter.php
index <HASH>..<HASH> 100644
--- a/src/Codeception/PHPUnit/Overrides/Filter.php
+++ b/src/Codeception/PHPUnit/Overrides/Filter.php
@@ -19,6 +19,16 @@ class PHPUnit_Util_Filter
$trace = $e->getSerializableTrace();
}
+ $eFile = $e->getFile();
+ $eLine = $e->getLine();
+
+ if (!self::frameExists($trace, $eFile, $eLine)) {
+ array_unshift(
+ $trace,
+ ['file' => $eFile, 'line' => $eLine]
+ );
+ }
+
foreach ($trace as $step) {
if (self::classIsFiltered($step) and $filter) {
continue;
@@ -85,4 +95,23 @@ class PHPUnit_Util_Filter
return false;
}
+
+ /**
+ * @param array $trace
+ * @param string $file
+ * @param int $line
+ *
+ * @return bool
+ */
+ private static function frameExists(array $trace, $file, $line)
+ {
+ foreach ($trace as $frame) {
+ if (isset($frame['file']) && $frame['file'] == $file &&
+ isset($frame['line']) && $frame['line'] == $line) {
+ return true;
+ }
+ }
+
+ return false;
+ }
} | Inject exception file and line number frame into stack trace in case it is missing (#<I>) | Codeception_base | train | php |
48e6b0e551c2c5f0b2113673fd3d9e4c2acc9ad2 | diff --git a/lib/dm-core/resource.rb b/lib/dm-core/resource.rb
index <HASH>..<HASH> 100644
--- a/lib/dm-core/resource.rb
+++ b/lib/dm-core/resource.rb
@@ -977,7 +977,7 @@ module DataMapper
# @api private
def _create
self.persisted_state = persisted_state.commit
- true
+ clean?
end
# This method executes the hooks before and after resource creation
diff --git a/lib/dm-core/spec/shared/resource_spec.rb b/lib/dm-core/spec/shared/resource_spec.rb
index <HASH>..<HASH> 100644
--- a/lib/dm-core/spec/shared/resource_spec.rb
+++ b/lib/dm-core/spec/shared/resource_spec.rb
@@ -767,6 +767,21 @@ share_examples_for 'A public Resource' do
end
end
+ describe 'on a new, invalid resource' do
+ before :all do
+ @user = @user_model.new(:name => nil)
+ @return = @user.__send__(method)
+ end
+
+ it 'should return false' do
+ @return.should be(false)
+ end
+
+ it 'should call save hook expected number of times' do
+ @user.save_hook_call_count.should == (method == :save ? 1 : nil)
+ end
+ end
+
describe 'on a dirty invalid resource' do
before :all do
rescue_if @skip do | Return false if Resource#save unsuccessfully creates a resource
[#<I>] | datamapper_dm-core | train | rb,rb |
6b775d85255b5e1c0583a7ef3badde14ff7cbb41 | diff --git a/openquake/baselib/hdf5.py b/openquake/baselib/hdf5.py
index <HASH>..<HASH> 100644
--- a/openquake/baselib/hdf5.py
+++ b/openquake/baselib/hdf5.py
@@ -707,7 +707,7 @@ def _fix_array(arr, key):
# for extract_assets d[0] is the pair
# ('id', ('|S50', {'h5py_encoding': 'ascii'}))
# this is a horrible workaround for the h5py 2.10.0 issue
- # https://github.com/numpy/numpy/issues/14142#issuecomment-620980980
+ # https://github.com/numpy/numpy/issues/14142
dtlist = []
for i, n in enumerate(arr.dtype.names):
if isinstance(arr.dtype.descr[i][1], tuple):
@@ -741,7 +741,7 @@ def save_npz(obj, path):
a[key] = val.encode('utf-8')
else:
a[key] = _fix_array(val, key)
- # avoid https://github.com/numpy/numpy/issues/14142#issuecomment-620980980
+ # turn into an error https://github.com/numpy/numpy/issues/14142
with warnings.catch_warnings():
warnings.filterwarnings("error", category=UserWarning)
numpy.savez_compressed(path, **a) | Improved comment [skip CI] | gem_oq-engine | train | py |
d86f81de793b1aee5fcfa6f7cd1bec227ea92bdb | diff --git a/src/Http/Controllers/Adminarea/CategoriesController.php b/src/Http/Controllers/Adminarea/CategoriesController.php
index <HASH>..<HASH> 100644
--- a/src/Http/Controllers/Adminarea/CategoriesController.php
+++ b/src/Http/Controllers/Adminarea/CategoriesController.php
@@ -97,7 +97,7 @@ class CategoriesController extends AuthorizedController
protected function process(Request $request, CategoryContract $category)
{
// Prepare required input fields
- $data = $request->all();
+ $data = $request->validated();
// Save category
$category->fill($data)->save(); | Get only validated fields (security enhancement) | rinvex_cortex-categories | train | php |
d48ac4f325b5ff708aa79825a924d57b8aec5439 | diff --git a/source/library/com/restfb/types/Photo.java b/source/library/com/restfb/types/Photo.java
index <HASH>..<HASH> 100644
--- a/source/library/com/restfb/types/Photo.java
+++ b/source/library/com/restfb/types/Photo.java
@@ -69,6 +69,18 @@ public class Photo extends NamedFacebookType {
private String picture;
/**
+ * ID of the page story this corresponds to.
+ *
+ * May not be on all photos. Applies only to published photos
+ *
+ * @return ID of the page story this corresponds to.
+ */
+ @Getter
+ @Setter
+ @Facebook("page_story_id")
+ private String pageStoryId;
+
+ /**
* The full-sized source of the photo.
*
* @return The full-sized source of the photo. | Issue #<I> - missing field added to Photo type | restfb_restfb | train | java |
0acfc2c65bf48098431fea7e28430873445c7048 | diff --git a/agent/testagent.go b/agent/testagent.go
index <HASH>..<HASH> 100644
--- a/agent/testagent.go
+++ b/agent/testagent.go
@@ -345,8 +345,8 @@ func (a *TestAgent) Client() *api.Client {
// DNSDisableCompression disables compression for all started DNS servers.
func (a *TestAgent) DNSDisableCompression(b bool) {
for _, srv := range a.dnsServers {
- cfg := srv.config.Load().(*dnsConfig)
- cfg.DisableCompression = b
+ a.config.DNSDisableCompression = b
+ srv.ReloadConfig(a.config)
}
} | agent: fix a data race in DNS tests
The dnsConfig pulled from the atomic.Value is a pointer, so modifying it in place
creates a data race. Use the exported ReloadConfig interface instead. | hashicorp_consul | train | go |
4eef6e8f1771ce2bb3bc19910b2f091debebfaa7 | diff --git a/client/lib/plugins/utils.js b/client/lib/plugins/utils.js
index <HASH>..<HASH> 100644
--- a/client/lib/plugins/utils.js
+++ b/client/lib/plugins/utils.js
@@ -112,7 +112,7 @@ PluginUtils = {
const img = li.querySelectorAll( 'img' );
const captionP = li.querySelectorAll( 'p' );
- if ( img[ 0 ].src ) {
+ if ( img[ 0 ] && img[ 0 ].src ) {
return {
url: img[ 0 ].src,
caption: captionP[ 0 ] ? captionP[ 0 ].textContent : null | Plugins: Make sure an image can be found (#<I>)
Fixes an issue where we thought that a particular wordpress.org plugin
doesn't exists in the .org repo but we just ran into a problem parsing
the data. | Automattic_wp-calypso | train | js |
ba374e8b971368afd4ec616f3ccab5b6e2d4b6bf | diff --git a/src/Webfactory/Slimdump/DumpTask.php b/src/Webfactory/Slimdump/DumpTask.php
index <HASH>..<HASH> 100644
--- a/src/Webfactory/Slimdump/DumpTask.php
+++ b/src/Webfactory/Slimdump/DumpTask.php
@@ -32,12 +32,14 @@ final class DumpTask
* @param OutputInterface $output
* @throws \Doctrine\DBAL\DBALException
*/
- public function __construct($dsn, $configFiles, OutputInterface $output)
+ public function __construct($dsn, array $configFiles, OutputInterface $output)
{
+ $mysqliIndependentDsn = preg_replace('_^mysqli:_', 'mysql:', $dsn);
+
$this->output = $output;
$this->config = ConfigBuilder::class::createConfigurationFromConsecutiveFiles($configFiles);
$this->db = DriverManager::class::getConnection(
- array('url' => $dsn, 'charset' => 'utf8', 'driverClass' => 'Doctrine\DBAL\Driver\PDOMySql\Driver')
+ array('url' => $mysqliIndependentDsn, 'charset' => 'utf8', 'driverClass' => 'Doctrine\DBAL\Driver\PDOMySql\Driver')
);
} | Add msqli bugfix
Add bugfix for msqli DSNs by @xkons | webfactory_slimdump | train | php |
09e6ff7ba23c1b0f54628d9cd1fcee823f1c51f1 | diff --git a/lib/vagrant/environment/remote.rb b/lib/vagrant/environment/remote.rb
index <HASH>..<HASH> 100644
--- a/lib/vagrant/environment/remote.rb
+++ b/lib/vagrant/environment/remote.rb
@@ -162,8 +162,7 @@ module Vagrant
end
def vagrantfile
- # When in remote mode we don't load the "home" vagrantfile
- @vagrantfile ||= Vagrant::Vagrantfile.new(config_loader, [:root])
+ client.vagrantfile
end
def to_proto | Use client to get vagrantfile for environment | hashicorp_vagrant | train | rb |
293f2596e7c7866693a7adb33008d4b87b7fe584 | diff --git a/doctr/travis.py b/doctr/travis.py
index <HASH>..<HASH> 100644
--- a/doctr/travis.py
+++ b/doctr/travis.py
@@ -276,8 +276,10 @@ def sync_from_log(src, dst, log_file):
files_log = []
files = glob.iglob(join(src, '**'), recursive=True)
- next(files) # Remove src itself
- for f in files:
+ # sorted makes this easier to test
+ for f in sorted(files):
+ if f == src:
+ continue
new_f = join(dst, f[len(src):])
if isdir(f):
os.makedirs(new_f, exist_ok=True) | The output order of glob is arbitrary; sort it for the tests | drdoctr_doctr | train | py |
7c59289e0cf0a065dfe2e73240e881e7a676d0e1 | diff --git a/src/Entity.php b/src/Entity.php
index <HASH>..<HASH> 100644
--- a/src/Entity.php
+++ b/src/Entity.php
@@ -84,20 +84,11 @@ class Entity
{
if (substr($method, 0, 7) === 'fetchBy') {
$reference = $this->references[substr($method, 7)];
- return $this->fetchBy($reference['table'], $reference['where']);
+ return $this->read($reference['table'], $reference['where']);
} elseif (substr($method, 0, 12) === 'fetchFirstBy') {
$reference = $this->references[substr($method, 12)];
- return $this->fetchFirstBy($reference['table'], $reference['where']);
+ return $this->readFirst($reference['table'], $reference['where']);
}
return null;
}
-
- private function fetchBy(string $entityTypeIdentifier, array $conditions) : array {
- return $this->read($entityTypeIdentifier, $conditions);
- }
-
- private function fetchFirstBy(string $entityTypeIdentifier, array $conditions) : Entity {
- return $this->fetchBy($entityTypeIdentifier, $conditions)[0];
- }
-
}
\ No newline at end of file | redirect fetch(First)?By* through read(First)? | pulledbits_activerecord | train | php |
88732b694068704cb151e0c4256a8e8d1adaff38 | diff --git a/git/cmd.py b/git/cmd.py
index <HASH>..<HASH> 100644
--- a/git/cmd.py
+++ b/git/cmd.py
@@ -254,14 +254,15 @@ class Git(LazyMixin):
proc.terminate()
proc.wait() # ensure process goes away
except OSError as ex:
- log.info("Ignored error after process has dies: %r", ex)
+ log.info("Ignored error after process had died: %r", ex)
pass # ignore error when process already died
except AttributeError:
# try windows
# for some reason, providing None for stdout/stderr still prints something. This is why
# we simply use the shell and redirect to nul. Its slower than CreateProcess, question
# is whether we really want to see all these messages. Its annoying no matter what.
- call(("TASKKILL /F /T /PID %s 2>nul 1>nul" % str(proc.pid)), shell=True)
+ if is_win:
+ call(("TASKKILL /F /T /PID %s 2>nul 1>nul" % str(proc.pid)), shell=True)
# END exception handling
def __getattr__(self, attr): | fix(cmd): don't try to use TASKKILL on linux
Fixes #<I> | gitpython-developers_GitPython | train | py |
36ef49734d88235093cfb4f0c00469ba286b807d | diff --git a/opal/corelib/number.rb b/opal/corelib/number.rb
index <HASH>..<HASH> 100644
--- a/opal/corelib/number.rb
+++ b/opal/corelib/number.rb
@@ -207,10 +207,19 @@ class Number < Numeric
def [](bit)
bit = Opal.coerce_to! bit, Integer, :to_int
- min = -(2**30)
- max = (2**30) - 1
- `(#{bit} < #{min} || #{bit} > #{max}) ? 0 : (self >> #{bit}) % 2`
+ %x{
+ if (#{bit} < #{Integer::MIN} || #{bit} > #{Integer::MAX}) {
+ return 0;
+ }
+
+ if (self < 0) {
+ return (((~self) + 1) >> #{bit}) % 2;
+ }
+ else {
+ return (self >> #{bit}) % 2;
+ }
+ }
end
def +@
@@ -293,8 +302,12 @@ class Number < Numeric
end
%x{
+ if (self === 0 || self === -1) {
+ return 0;
+ }
+
var result = 0,
- value = self;
+ value = self < 0 ? ~self : self;
while (value != 0) {
result += 1; | Fix Number#[] and add Number#bit_length | opal_opal | train | rb |
bdd8a75123fa809143cc1217e3a75181d8170add | diff --git a/src/ol/interaction/shiftdragzoom.js b/src/ol/interaction/shiftdragzoom.js
index <HASH>..<HASH> 100644
--- a/src/ol/interaction/shiftdragzoom.js
+++ b/src/ol/interaction/shiftdragzoom.js
@@ -46,14 +46,14 @@ goog.inherits(ol.interaction.ShiftDragZoom, ol.interaction.Drag);
*/
ol.interaction.ShiftDragZoom.prototype.handleDragEnd =
function(mapBrowserEvent) {
+ goog.dispose(this.dragBox_);
+ this.dragBox_ = null;
if (this.deltaX * this.deltaX + this.deltaY * this.deltaY >=
ol.SHIFT_DRAG_ZOOM_HYSTERESIS_PIXELS_SQUARED) {
var map = mapBrowserEvent.map;
var extent = ol.Extent.boundingExtent(
this.startCoordinate,
mapBrowserEvent.getCoordinate());
- goog.dispose(this.dragBox_);
- this.dragBox_ = null;
this.fitExtent(map, extent);
}
}; | Remove the box also if we don't zoom | openlayers_openlayers | train | js |
4155daddc73254e740f8af41851f1476f5436ce2 | diff --git a/hwt/synthesizer/shortcuts.py b/hwt/synthesizer/shortcuts.py
index <HASH>..<HASH> 100644
--- a/hwt/synthesizer/shortcuts.py
+++ b/hwt/synthesizer/shortcuts.py
@@ -132,24 +132,23 @@ def toRtlAndSave(unit, folderName='.', name=None, serializer=VhdlSerializer):
fileMode = 'a'
else:
if hasattr(obj, "_hdlSources"):
- fName = None
for fn in obj._hdlSources:
if isinstance(fn, str):
shutil.copy2(fn, folderName)
files.append(fn)
else:
sc = serializer.asHdl(obj)
+ continue
- if fName is not None and sc:
- fp = os.path.join(folderName, fName)
- files.append(fp)
+ fp = os.path.join(folderName, fName)
+ files.append(fp)
- with open(fp, fileMode) as f:
- if fileMode == 'a':
- f.write("\n")
- f.write(
- serializer.formater(sc)
- )
+ with open(fp, fileMode) as f:
+ if fileMode == 'a':
+ f.write("\n")
+ f.write(
+ serializer.formater(sc)
+ )
return files | fix code duplication in files created by toRtlAndSave | Nic30_hwt | train | py |
f48021e944378ccd0d998bb7f1cb5cb238e82025 | diff --git a/bundles/org.eclipse.orion.client.editor/web/orion/editor/textView.js b/bundles/org.eclipse.orion.client.editor/web/orion/editor/textView.js
index <HASH>..<HASH> 100644
--- a/bundles/org.eclipse.orion.client.editor/web/orion/editor/textView.js
+++ b/bundles/org.eclipse.orion.client.editor/web/orion/editor/textView.js
@@ -560,7 +560,7 @@ define("orion/editor/textView", [ //$NON-NLS-0$
var tabSize = this.view._customTabSize, range;
if (tabSize && tabSize !== 8) {
var tabIndex = text.indexOf("\t", start); //$NON-NLS-0$
- while (tabIndex !== -1 && tabIndex < end) {
+ while (tabIndex !== -1) {
if (start < tabIndex) {
range = {text: text.substring(start, tabIndex), style: style};
data.ranges.push(range);
@@ -578,6 +578,9 @@ define("orion/editor/textView", [ //$NON-NLS-0$
data.tabOffset += range.text.length;
}
start = tabIndex + 1;
+ if (start === end) {
+ return;
+ }
tabIndex = text.indexOf("\t", start); //$NON-NLS-0$
}
} | cursor navigation broken on IE<I> around fake tabs | eclipse_orion.client | train | js |
6101b700da4ba92fd38480951f861abc9e273d93 | diff --git a/lib/ui/runner_tabs.js b/lib/ui/runner_tabs.js
index <HASH>..<HASH> 100644
--- a/lib/ui/runner_tabs.js
+++ b/lib/ui/runner_tabs.js
@@ -105,8 +105,10 @@ var RunnerTab = exports.RunnerTab = View.extend({
self.render()
}
, 'change:allPassed': function(){
- self.renderRunnerName()
- self.renderResults()
+ process.nextTick(function(){
+ self.renderRunnerName()
+ self.renderResults()
+ })
}
})
this.render() | Fix to sometimes browser name being different colors from the test results within the tab. | testem_testem | train | js |
49b5fcaf7dd13f69a3c2bf3059967b1aefe43745 | diff --git a/src/test/java/io/vlingo/wire/fdx/inbound/InboundStreamTest.java b/src/test/java/io/vlingo/wire/fdx/inbound/InboundStreamTest.java
index <HASH>..<HASH> 100644
--- a/src/test/java/io/vlingo/wire/fdx/inbound/InboundStreamTest.java
+++ b/src/test/java/io/vlingo/wire/fdx/inbound/InboundStreamTest.java
@@ -10,6 +10,9 @@ package io.vlingo.wire.fdx.inbound;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
+import java.util.ArrayList;
+import java.util.List;
+
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@@ -32,9 +35,9 @@ public class InboundStreamTest extends AbstractMessageTool {
inboundStream.actor().start();
pause();
assertTrue(interest.messageCount > 0);
-
+ final List<String> copy = new ArrayList<>(interest.messages);
int count = 0;
- for (final String message : interest.messages) {
+ for (final String message : copy) {
++count;
assertEquals(MockChannelReader.MessagePrefix + count, message);
} | Prevent concurrent modifications on test collection. | vlingo_vlingo-wire | train | java |
d1999c402e1d826ed602fdc8dc09a1eb8d954127 | diff --git a/crypto/index.js b/crypto/index.js
index <HASH>..<HASH> 100644
--- a/crypto/index.js
+++ b/crypto/index.js
@@ -87,6 +87,11 @@ define(module, (exports, require) => {
return crypto.createHash('sha256').update(s).digest('hex');
},
+ hash_MD5: function() {
+ var s = qp.arg(arguments).join('');
+ return crypto.createHash('MD5').update(s).digest('hex');
+ },
+
hash: function() { return this.hash_sha256.apply(this, arguments); },
hmac_sha256: function(key, data) { | crypto; add MD5 hash fn | cjr--_qp-library | train | js |
008cdc84c20cf93d8b247d5adb1a3763e44ab667 | diff --git a/src/Network/Observer/AbstractBeats.php b/src/Network/Observer/AbstractBeats.php
index <HASH>..<HASH> 100644
--- a/src/Network/Observer/AbstractBeats.php
+++ b/src/Network/Observer/AbstractBeats.php
@@ -250,6 +250,6 @@ abstract class AbstractBeats implements ConnectionObserver
*/
public function emptyBuffer()
{
- $this->onServerActivity();
+ $this->onPotentialConnectionStateActivity();
}
}
diff --git a/tests/Unit/Network/Observer/AbstractBeatsTest.php b/tests/Unit/Network/Observer/AbstractBeatsTest.php
index <HASH>..<HASH> 100644
--- a/tests/Unit/Network/Observer/AbstractBeatsTest.php
+++ b/tests/Unit/Network/Observer/AbstractBeatsTest.php
@@ -150,10 +150,10 @@ class AbstractBeatsTest extends TestCase
$instance->emptyRead();
}
- public function testEmptyBufferWillTriggerServerActivity()
+ public function testEmptyBufferWillTriggerPotentialConnectionStateActivity()
{
$instance = $this->getInstance();
- $instance->expects($this->once())->method('onServerActivity');
+ $instance->expects($this->once())->method('onPotentialConnectionStateActivity');
$instance->emptyBuffer();
} | Fix emptyBuffer() handling
When no data is available, we should not update server activity timestamp.
Instead, ask if something is going wrong.
Fixes stomp-php/stomp-php#<I>
Due to stomp-php/stomp-php@3f<I>cf<I>be1e1b<I>ac<I>f<I>adaf5 | stomp-php_stomp-php | train | php,php |
0100df72eb2a66c9d07de46a04fcacfd4c7d9c14 | diff --git a/chef/lib/chef/knife/cookbook_site_share.rb b/chef/lib/chef/knife/cookbook_site_share.rb
index <HASH>..<HASH> 100644
--- a/chef/lib/chef/knife/cookbook_site_share.rb
+++ b/chef/lib/chef/knife/cookbook_site_share.rb
@@ -25,6 +25,7 @@ class Chef
class CookbookSiteShare < Knife
banner "knife cookbook site share COOKBOOK CATEGORY (options)"
+ category "cookbook site"
option :cookbook_path,
:short => "-o PATH:PATH",
diff --git a/chef/lib/chef/knife/cookbook_site_unshare.rb b/chef/lib/chef/knife/cookbook_site_unshare.rb
index <HASH>..<HASH> 100644
--- a/chef/lib/chef/knife/cookbook_site_unshare.rb
+++ b/chef/lib/chef/knife/cookbook_site_unshare.rb
@@ -24,6 +24,7 @@ class Chef
class CookbookSiteUnshare < Knife
banner "knife cookbook site unshare COOKBOOK"
+ category "cookbook site"
def run
@cookbook_name = @name_args[0] | correcting the category of the share and unshare commands | chef_chef | train | rb,rb |
a81b285702db6f81532b2e0b6983942cf12d4f5e | diff --git a/serializer/src/main/java/io/datakernel/serializer/SerializationInputBuffer.java b/serializer/src/main/java/io/datakernel/serializer/SerializationInputBuffer.java
index <HASH>..<HASH> 100644
--- a/serializer/src/main/java/io/datakernel/serializer/SerializationInputBuffer.java
+++ b/serializer/src/main/java/io/datakernel/serializer/SerializationInputBuffer.java
@@ -182,12 +182,21 @@ public final class SerializationInputBuffer {
if (length > remaining())
throw new IllegalArgumentException();
- char[] chars = ensureCharArray(length);
- for (int i = 0; i < length; i++) {
- int c = readByte() & 0xff;
- chars[i] = (char) c;
+ if (length <= 35) {
+ char[] chars = ensureCharArray(length);
+ for (int i = 0; i < length; i++) {
+ int c = readByte() & 0xff;
+ chars[i] = (char) c;
+ }
+ return new String(chars, 0, length);
+ } else {
+ pos += length;
+ try {
+ return new String(buf, pos - length, length, "ISO-8859-1");
+ } catch (UnsupportedEncodingException e) {
+ throw new RuntimeException();
+ }
}
- return new String(chars, 0, length);
}
public String readUTF8() { | Optimize serialization for ASCII | softindex_datakernel | train | java |
24ec2f23b8e38f2689e33b8efdbb9a0cd3c6d73a | diff --git a/tests/aws/conftest.py b/tests/aws/conftest.py
index <HASH>..<HASH> 100644
--- a/tests/aws/conftest.py
+++ b/tests/aws/conftest.py
@@ -8,7 +8,7 @@ def pytest_collection_modifyitems(session, config, items):
marked = []
unmarked = []
for item in items[start:end]:
- if item.get_marker('on_redeploy') is not None:
+ if item.get_closest_marker('on_redeploy') is not None:
marked.append(item)
else:
unmarked.append(item)
diff --git a/tests/conftest.py b/tests/conftest.py
index <HASH>..<HASH> 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -15,6 +15,12 @@ def pytest_addoption(parser):
def pytest_configure(config):
config.addinivalue_line("markers", "slow: mark test as slow to run")
+ config.addinivalue_line(
+ "markers", (
+ "on_redeploy: mark an integration test to be run after "
+ "the app is redeployed"
+ )
+ )
def pytest_collection_modifyitems(config, items): | Upgrade /aws tests to work on Python <I>
These tests used the deprecated get_marker function, which was replaced
in pytest 4 with the get_closest_marker function. Pytest also introduced
a warning for using unregistered markers. This was fixed by registering
the on_redeploy marker in the root conftest.py. | aws_chalice | train | py,py |
b5e7bdd9ba2cc77f2aa734bad3c9eadbc539fc63 | diff --git a/test/action_chat.js b/test/action_chat.js
index <HASH>..<HASH> 100644
--- a/test/action_chat.js
+++ b/test/action_chat.js
@@ -85,7 +85,7 @@ describe('Action: chat', function(){
response.body.messages[0].message.should.equal("TEST");
done();
});
- }, 200);
+ }, 400);
});
it('I can get many messagse and the order is maintained', function(done){
@@ -99,7 +99,7 @@ describe('Action: chat', function(){
response.body.messages[2].message.should.equal("TEST: C");
done();
});
- }, 200);
+ }, 400);
});
it('action should only be valid for http/s clients', function(done){ | add more time for slow fakeredis tests | actionhero_actionhero | train | js |
19b84529b12c119f9440f9be514564325f9be9cd | diff --git a/pytplot/QtPlotter/TVarFigureSpec.py b/pytplot/QtPlotter/TVarFigureSpec.py
index <HASH>..<HASH> 100644
--- a/pytplot/QtPlotter/TVarFigureSpec.py
+++ b/pytplot/QtPlotter/TVarFigureSpec.py
@@ -163,7 +163,10 @@ class TVarFigureSpec(pg.GraphicsLayout):
mousePoint = self.plotwindow.vb.mapSceneToView(pos)
#grab x and y mouse locations
index_x = int(mousePoint.x())
- index_y = 10**(round(float(mousePoint.y()),4))
+ if self._getyaxistype() == 'log':
+ index_y = 10**(round(float(mousePoint.y()),4))
+ else:
+ index_y = round(float(mousePoint.y()),4)
#print(index_y)
dataframe = pytplot.data_quants[self.tvar_name].data
specframe = pytplot.data_quants[self.tvar_name].spec_bins | Added log/linear if statement | MAVENSDC_PyTplot | train | py |
4f27a93dce23d94fdd8e874f6c6b047c445c7a12 | diff --git a/__tests__/base.js b/__tests__/base.js
index <HASH>..<HASH> 100644
--- a/__tests__/base.js
+++ b/__tests__/base.js
@@ -1258,6 +1258,23 @@ function runBaseTest(name, useProxies, freeze, useListener) {
expect(nextState).toEqual([1, 2, 100])
})
+ it("#195 should be able to find items", () => {
+ const state = {
+ items: [
+ {
+ id: 0,
+ task: "drink milk"
+ },
+ {id: 1, task: "eat cookie"}
+ ]
+ }
+ produce(state, draft => {
+ expect(draft.items.find(({id}) => id === 1).task).toBe(
+ "eat cookie"
+ )
+ })
+ })
+
afterEach(() => {
expect(baseState).toBe(origBaseState)
expect(baseState).toEqual(createBaseState()) | Tried to reproduce #<I> | immerjs_immer | train | js |
eaa0fb11f1208d479a94c79a40170bd423e29354 | diff --git a/salt/state.py b/salt/state.py
index <HASH>..<HASH> 100644
--- a/salt/state.py
+++ b/salt/state.py
@@ -180,7 +180,7 @@ class State(object):
'''
err = []
rets = []
- chunks = compile_high_data(high)
+ chunks = self.compile_high_data(high)
errors = self.verify_chunks(chunks)
if errors:
for err in errors: | Fix typo in compile_high data | saltstack_salt | train | py |
2ca71713b1eb15ec3fac6cdbd0215479fa80e5a5 | diff --git a/salt/modules/yumpkg.py b/salt/modules/yumpkg.py
index <HASH>..<HASH> 100644
--- a/salt/modules/yumpkg.py
+++ b/salt/modules/yumpkg.py
@@ -42,6 +42,7 @@ except ImportError:
# Import salt libs
import salt.utils
import salt.utils.pkg
+import salt.ext.six as six
import salt.utils.itertools
import salt.utils.systemd
import salt.utils.decorators as decorators
@@ -259,7 +260,8 @@ def _get_extra_options(**kwargs):
Returns list of extra options for yum
'''
ret = []
- for key, value in kwargs.items():
+ kwargs = salt.utils.clean_kwargs(**kwargs)
+ for key, value in six.iteritems(kwargs):
if isinstance(key, six.string_types):
ret.append('--{0}=\'{1}\''.format(key, value))
elif value is True: | use six and clean_kwargs | saltstack_salt | train | py |
a9558ba7f0ccaab331333356958a06de8daae723 | diff --git a/Classes/DataStructures/Collection.php b/Classes/DataStructures/Collection.php
index <HASH>..<HASH> 100644
--- a/Classes/DataStructures/Collection.php
+++ b/Classes/DataStructures/Collection.php
@@ -6,7 +6,6 @@ namespace OliverKlee\Oelib\DataStructures;
use OliverKlee\Oelib\Interfaces\Sortable;
use OliverKlee\Oelib\Model\AbstractModel;
-use SplObjectStorage;
/**
* This class represents a list of models.
@@ -14,7 +13,7 @@ use SplObjectStorage;
* @author Oliver Klee <typo3-coding@oliverklee.de>
* @author Niels Pardon <mail@niels-pardon.de>
*/
-class Collection extends SplObjectStorage
+class Collection extends \SplObjectStorage
{
/**
* @var int[] the UIDs in the list using the UIDs as both the keys and values
@@ -199,8 +198,8 @@ class Collection extends SplObjectStorage
/**
* Appends the contents of $list to this list.
*
- * Note: Since Collection extends SplObjectStorage this method is in most
- * cases an synonym to appendUnique() as SplObjectStorage makes sure that
+ * Note: Since Collection extends \SplObjectStorage, this method is in most
+ * cases an synonym to appendUnique() as \SplObjectStorage makes sure that
* no object is added more than once to it.
*
* @param Collection<AbstractModel> $list the list to append, may be empty | [FOLLOWUP] Do not import classes from the global namespace (#<I>) | oliverklee_ext-oelib | train | php |
f31c543c0fe4f67c5cbcaca627d537882080ed5c | diff --git a/dynamo3/result.py b/dynamo3/result.py
index <HASH>..<HASH> 100644
--- a/dynamo3/result.py
+++ b/dynamo3/result.py
@@ -6,15 +6,18 @@ from .constants import NONE
class PagedIterator(six.Iterator):
+ """ An iterator that iterates over paged results from Dynamo """
def __init__(self):
self.iterator = None
@property
def can_fetch_more(self):
+ """ Return True if more results can be fetched from the server """
return True
def fetch(self):
+ """ Fetch additional results from the server and return an iterator """
raise NotImplementedError
def __iter__(self): | Adding some missing docstrings | stevearc_dynamo3 | train | py |
55a9d38d326fbba603e8a0e0f30e96d9cba87839 | diff --git a/lib/how_bad/analyzer.rb b/lib/how_bad/analyzer.rb
index <HASH>..<HASH> 100644
--- a/lib/how_bad/analyzer.rb
+++ b/lib/how_bad/analyzer.rb
@@ -20,15 +20,13 @@ module HowBad
pulls_with_label: num_with_label(pulls),
average_issue_age: average_age_for(issues),
- oldest_issue_date: oldest_date_for(issues),
+ oldest_issue_date: oldest_age_for(issues),
average_pull_age: average_age_for(pulls),
- oldest_pull_date: oldest_date_for(pulls),
+ oldest_pull_date: oldest_age_for(pulls),
)
end
- private
-
def num_with_label(issues_or_pulls)
{} # TODO: Implement.
# Notes:
@@ -44,7 +42,7 @@ module HowBad
0 # TODO: Implement.
end
- def oldest_date_for(issues_or_pulls)
+ def oldest_age_for(issues_or_pulls)
0 # TODO: Implement.
end
end | Rename oldest_date_for to oldest_age_for. | duckinator_inq | train | rb |
2be756642fafb54786a0941a9776b18c00b2d004 | diff --git a/terraform/graph_builder_import.go b/terraform/graph_builder_import.go
index <HASH>..<HASH> 100644
--- a/terraform/graph_builder_import.go
+++ b/terraform/graph_builder_import.go
@@ -49,12 +49,12 @@ func (b *ImportGraphBuilder) Steps() []GraphTransformer {
&DisableProviderTransformerOld{},
&PruneProviderTransformer{},
- // Single root
- &RootTransformer{},
-
// Insert nodes to close opened plugin connections
&CloseProviderTransformer{},
+ // Single root
+ &RootTransformer{},
+
// Optimize
&TransitiveReductionTransformer{},
} | terraform: the import RootTransformer should run last
This was causing multiple root issues | hashicorp_terraform | train | go |
3300abda387743634e2c03fe1d40fa178813e66d | diff --git a/py/nupic/research/TP.py b/py/nupic/research/TP.py
index <HASH>..<HASH> 100644
--- a/py/nupic/research/TP.py
+++ b/py/nupic/research/TP.py
@@ -3357,10 +3357,8 @@ class Segment(object):
this segment. This is a measure of how often this segment is
providing good predictions.
- Parameters:
- ----------------------------------------------------------
- active: True if segment just provided a good prediction
- readOnly: If True, compute the updated duty cycle, but don't change
+ @param active True if segment just provided a good prediction
+ @param readOnly If True, compute the updated duty cycle, but don't change
the cached value. This is used by debugging print statements.
NOTE: This method relies on different schemes to compute the duty cycle | Adding more docs, testing automatic doc build. | numenta_nupic | train | py |
c4f77c249778b310e0e3f11af5625e3afc24be11 | diff --git a/torchvision/ops/misc.py b/torchvision/ops/misc.py
index <HASH>..<HASH> 100644
--- a/torchvision/ops/misc.py
+++ b/torchvision/ops/misc.py
@@ -113,7 +113,7 @@ def interpolate(input, size=None, scale_factor=None, mode="nearest", align_corne
)
output_shape = _output_size(2, input, size, scale_factor)
- output_shape = list(input.shape[:-2]) + output_shape
+ output_shape = list(input.shape[:-2]) + list(output_shape)
return _new_empty_tensor(input, output_shape) | Fix corner case in interpolate (#<I>) | pytorch_vision | train | py |
6ecfaa314c5deaa3c5824e3e00f5ae59d66b92e6 | diff --git a/server.py b/server.py
index <HASH>..<HASH> 100644
--- a/server.py
+++ b/server.py
@@ -109,8 +109,11 @@ class CompressedHandler(CGIHTTPRequestHandler):
ctype = CGIHTTPRequestHandler.guess_type(self, path)
# I had the case where the mimetype associated with .js in the Windows
# registery was text/plain...
- if os.path.splitext(path)[1] == ".js":
+ ext = os.path.splitext(path)[1]
+ if ext == ".js":
ctype = "application/javascript"
+ elif ext == '.wasm':
+ ctype = "application/wasm"
return ctype
def translate_path(self, path): | Server sets correct content type for extension .wasm | brython-dev_brython | train | py |
4f976e0c8d15a1627616ce38f1436db5a1c909c0 | diff --git a/src/Parser/BlankLineParser.php b/src/Parser/BlankLineParser.php
index <HASH>..<HASH> 100644
--- a/src/Parser/BlankLineParser.php
+++ b/src/Parser/BlankLineParser.php
@@ -10,11 +10,7 @@ class BlankLineParser implements ParserInterface
public function parseLine(Text $line, Node $target, callable $next)
{
- if ($line->copy()->trim()->isEmpty()) {
- return $target;
- }
-
- return $next($line, $target);
+ return $line->isEmpty() ? $target : $next($line, $target);
}
} | Simplify blank line parsing. | fluxbb_commonmark | train | php |
fec61b0c163a47382eaaa03554a31e2428974656 | diff --git a/django_productline/settings.py b/django_productline/settings.py
index <HASH>..<HASH> 100644
--- a/django_productline/settings.py
+++ b/django_productline/settings.py
@@ -44,7 +44,7 @@ USE_L10N = True
# If you set this to False, Django will not use timezone-aware datetimes.
USE_TZ = True
-
+LOCALE_PATHS = []
# Absolute filesystem path to the directory that will hold user-uploaded files. | introduced LOCALE_PATHS to make compilemessages work | henzk_django-productline | train | py |
c8a711dd484e8628049440ff4139881e7310d10a | diff --git a/src/Git/GetVersionCollectionFromGitRepository.php b/src/Git/GetVersionCollectionFromGitRepository.php
index <HASH>..<HASH> 100644
--- a/src/Git/GetVersionCollectionFromGitRepository.php
+++ b/src/Git/GetVersionCollectionFromGitRepository.php
@@ -37,10 +37,7 @@ final class GetVersionCollectionFromGitRepository implements GetVersionCollectio
} catch (InvalidVersionStringException $e) {
return null;
}
- }, explode("\n", $output)),
- function (?Version $version) : bool {
- return $version !== null;
- }
+ }, explode("\n", $output))
));
}
} | remove fix to wait for upstream fix | Roave_BackwardCompatibilityCheck | train | php |
a51942160d475bc445303be1b0f48689e88f7740 | diff --git a/modin/pandas/dataframe.py b/modin/pandas/dataframe.py
index <HASH>..<HASH> 100644
--- a/modin/pandas/dataframe.py
+++ b/modin/pandas/dataframe.py
@@ -5035,7 +5035,11 @@ class DataFrame(object):
return DataFrame(result)
else:
try:
- if len(result) == 2 and isinstance(result[0], pandas.DataFrame):
+ if (
+ isinstance(result, (list, tuple))
+ and len(result) == 2
+ and isinstance(result[0], pandas.DataFrame)
+ ):
# Some operations split the DataFrame into two (e.g. align). We need to wrap
# both of the returned results
if isinstance(result[1], pandas.DataFrame): | Checking for type before we check the length to avoid spurious errors. (#<I>)
* Checking for type before we check the length to avoid spurious errors.
* Resolves #<I>
* Prevents errors from DataFrames with 2 rows
* Lint | modin-project_modin | train | py |
f1590a5c799500664bf19a70e077c46c9ffcbe45 | diff --git a/test/ircd.test.js b/test/ircd.test.js
index <HASH>..<HASH> 100644
--- a/test/ircd.test.js
+++ b/test/ircd.test.js
@@ -99,7 +99,7 @@ exports.pmsAndParticipate = function (t) {
conn.close(function () {
t.done();
});
- }, 100);
+ }, 500);
});
};
@@ -123,7 +123,7 @@ exports.ignoreChannel = function (t) {
conn.close(function () {
t.done();
});
- }, 100);
+ }, 500);
});
};
@@ -168,8 +168,8 @@ exports.defaultOptsResponses = function (t) {
conn.close(function () {
t.done();
});
- }, 100);
- }, 100);
+ }, 500);
+ }, 500);
});
};
@@ -198,7 +198,7 @@ exports.neverHighlight = function (t) {
conn.close(function () {
t.done();
});
- }, 100);
+ }, 500);
});
};
@@ -225,6 +225,6 @@ exports.alwaysHighlight = function (t) {
conn.close();
t.done();
- }, 100);
+ }, 500);
});
}; | increase times again - net close fix was insufficient | clux_irc-stream | train | js |
c4155c08257320bbf23abd44319dbf637f999602 | diff --git a/lib/terminitor/runner.rb b/lib/terminitor/runner.rb
index <HASH>..<HASH> 100644
--- a/lib/terminitor/runner.rb
+++ b/lib/terminitor/runner.rb
@@ -47,12 +47,11 @@ module Terminitor
# One more hack: if we're getting the first tab, we return
# the term window's only current tab, else we send a CMD+T
def open_tab(terminal)
- window = has_visor? ? 2 : 1
if @got_first_tab_already
app("System Events").application_processes["Terminal.app"].keystroke("t", :using => :command_down)
end
@got_first_tab_already = true
- local_window = terminal.windows[window]
+ local_window = terminal.windows[terminal.windows.count - 1]
local_tabs = local_window.tabs if local_window
local_tabs.last.get if local_tabs
end | fix window issue with visor to grab last window. | achiurizo_consular | train | rb |
2e43a9af1b045912d9f41c8a16ddf08dfe5a70e3 | diff --git a/PyPtt/_api_loginout.py b/PyPtt/_api_loginout.py
index <HASH>..<HASH> 100644
--- a/PyPtt/_api_loginout.py
+++ b/PyPtt/_api_loginout.py
@@ -151,6 +151,12 @@ def login(
exceptions_=exceptions.WrongIDorPassword()
),
connect_core.TargetUnit(
+ i18n.ErrorIDPW,
+ '請重新輸入',
+ break_detect=True,
+ exceptions_=exceptions.WrongIDorPassword()
+ ),
+ connect_core.TargetUnit(
i18n.LoginTooOften,
'登入太頻繁',
break_detect=True,
@@ -239,7 +245,14 @@ def login(
)
]
+ #
+
+ IAC = '\xff'
+ WILL = '\xfb'
+ NAWS = '\x1f'
+
cmd_list = list()
+ cmd_list.append(IAC + WILL + NAWS)
cmd_list.append(ptt_id)
cmd_list.append(command.Enter)
cmd_list.append(password)
@@ -252,8 +265,7 @@ def login(
target_list,
screen_timeout=api.config.screen_long_timeout,
refresh=False,
- secret=True
- )
+ secret=True)
ori_screen = api.connect_core.get_screen_queue()[-1]
if index == 0: | Add re-input case in login | Truth0906_PTTLibrary | train | py |
582fbebedfdcf14955be4ec7d6602ab4efdb29a7 | diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -1,14 +1,17 @@
from __future__ import absolute_import
import sys
+import os
from setuptools import setup
# add __version__, __author__, __authoremail__, __description__ to this namespace
_PY2 = sys.version_info.major == 2
+my_loc = os.path.dirname(os.path.abspath(__file__))
+os.chdir(my_loc)
if _PY2:
- execfile("./dwave_virtual_graph/package_info.py")
+ execfile(os.path.join(".", "dwave_virtual_graph", "package_info.py"))
else:
- exec(open("./dwave_virtual_graph/package_info.py").read())
+ exec(open(os.path.join(".", "dwave_virtual_graph", "package_info.py")).read())
install_requires = ['homebase',
'minorminer', | Make it easy to call python setup.py install from any directory.
* Use os module to find location of setup.py and chdir to this location | dwavesystems_dwave-system | train | py |
ba2a730dff0f9997e2926755fa3089052269ad41 | diff --git a/Swat/SwatReplicatorFormField.php b/Swat/SwatReplicatorFormField.php
index <HASH>..<HASH> 100644
--- a/Swat/SwatReplicatorFormField.php
+++ b/Swat/SwatReplicatorFormField.php
@@ -27,7 +27,7 @@ class SwatReplicatorFormField extends SwatFieldset implements SwatReplicable
*
* @var array
*/
- public $replicators = null;
+ public $replicators = null;
// }}}
// {{{ protected properies
diff --git a/Swat/SwatToolbar.php b/Swat/SwatToolbar.php
index <HASH>..<HASH> 100644
--- a/Swat/SwatToolbar.php
+++ b/Swat/SwatToolbar.php
@@ -95,7 +95,7 @@ class SwatToolbar extends SwatDisplayableContainer
ob_start();
$child->display();
$content = ob_get_clean();
- if (strlen($content) > 0) {
+ if (strlen($content) > 0)
echo '<li>', $content, '</li>';
}
}
@@ -104,7 +104,7 @@ class SwatToolbar extends SwatDisplayableContainer
// {{{ protected function getCSSClassNames()
/**
- * Gets the array of CSS classes that are applied to this tool bar
+ * Gets the array of CSS classes that are applied to this tool bar
*
* @return array the array of CSS classes that are applied to this tool bar.
*/ | shame on mike for breaking SwatToolBar, and a couple of ws fixes
svn commit r<I> | silverorange_swat | train | php,php |
893a727559ead7ca7a4c456b8c70091abd6164b2 | diff --git a/lib/Client.js b/lib/Client.js
index <HASH>..<HASH> 100644
--- a/lib/Client.js
+++ b/lib/Client.js
@@ -72,7 +72,7 @@ class Client extends Netcat {
/* spawn exec */
util.spawnProcess.call(self, self.client)
- self.client.pipe(self.passThrough, { end: false })
+ self.client.pipe(self.passThrough, { end: !self._retry }) /* HACK: kept open when retrying */
cb.call(self)
} | HACK to keep the stream open when in retry mode | roccomuso_netcat | train | js |
12e88b795977586dd53565589ec37a3dd404bf2e | diff --git a/router/http_test.go b/router/http_test.go
index <HASH>..<HASH> 100644
--- a/router/http_test.go
+++ b/router/http_test.go
@@ -482,6 +482,26 @@ func (s *S) TestStickyHTTPRouteWebsocket(c *C) {
}
}
+func (s *S) TestNoBackends(c *C) {
+ l, _ := newHTTPListener(c)
+ defer l.Close()
+
+ addRoute(c, l, (&router.HTTPRoute{
+ Domain: "example.com",
+ Service: "example-com",
+ }).ToRoute())
+
+ req := newReq("http://"+l.Addr, "example.com")
+ res, err := newHTTPClient("example.com").Do(req)
+ c.Assert(err, IsNil)
+ defer res.Body.Close()
+
+ c.Assert(res.StatusCode, Equals, 503)
+ data, err := ioutil.ReadAll(res.Body)
+ c.Assert(err, IsNil)
+ c.Assert(string(data), Equals, "Service Unavailable\n")
+}
+
// issue #152
func (s *S) TestKeepaliveHostname(c *C) {
srv1 := httptest.NewServer(httpTestHandler("1")) | router: add test for <I> with no backends | flynn_flynn | train | go |
16169c60f2163e90275849c2a4f018411853a17f | diff --git a/pymatgen/io/qchem/outputs.py b/pymatgen/io/qchem/outputs.py
index <HASH>..<HASH> 100644
--- a/pymatgen/io/qchem/outputs.py
+++ b/pymatgen/io/qchem/outputs.py
@@ -481,6 +481,7 @@ class QCOutput(MSONable):
r"(?:Normal\s+)*BFGS [Ss]tep)*(?:\s+LineSearch Step)*(?:\s+Line search: overstep)*"
r"(?:\s+Dog-leg BFGS step)*(?:\s+Line search: understep)*"
r"(?:\s+Descent step)*(?:\s+Done DIIS. Switching to GDM)*"
+ r"(?:\s+Done GDM. Switching to DIIS)*"
r"(?:\s*\-+\s+Cycle\s+Energy\s+(?:(?:DIIS)*\s+[Ee]rror)*"
r"(?:RMS Gradient)*\s+\-+(?:\s*\-+\s+OpenMP\s+Integral\s+computing\s+Module\s+"
r"(?:Release:\s+version\s+[\d\-\.]+\,\s+\w+\s+[\d\-\.]+\, " | Allow SCF parsing for GDM -> DIIS | materialsproject_pymatgen | train | py |
b103ca9be5a863cbb99b8a57dc50ec08d321123e | diff --git a/phpfastcache/3.0.0/drivers/sqlite.php b/phpfastcache/3.0.0/drivers/sqlite.php
index <HASH>..<HASH> 100644
--- a/phpfastcache/3.0.0/drivers/sqlite.php
+++ b/phpfastcache/3.0.0/drivers/sqlite.php
@@ -43,7 +43,7 @@ class phpfastcache_sqlite extends BasePhpFastCache implements phpfastcache_drive
$db->exec('drop table if exists "balancing"');
$db->exec('CREATE TABLE "balancing" ("keyword" VARCHAR PRIMARY KEY NOT NULL UNIQUE, "db" INTEGER)');
$db->exec('CREATE INDEX "db" ON "balancing" ("db")');
- $db->exec('CREATE UNIQUE INDEX "lookup" ON "balacing" ("keyword")');
+ $db->exec('CREATE UNIQUE INDEX "lookup" ON "balancing" ("keyword")');
} | Fix typo in table name "balacing" | PHPSocialNetwork_phpfastcache | train | php |
a940183b89fbcd999b4de1d4700496ef2a1e6eb6 | diff --git a/Schema/Blueprint.php b/Schema/Blueprint.php
index <HASH>..<HASH> 100755
--- a/Schema/Blueprint.php
+++ b/Schema/Blueprint.php
@@ -5,6 +5,7 @@ namespace Illuminate\Database\Schema;
use BadMethodCallException;
use Closure;
use Illuminate\Database\Connection;
+use Illuminate\Database\Query\Expression;
use Illuminate\Database\Schema\Grammars\Grammar;
use Illuminate\Database\SQLiteConnection;
use Illuminate\Support\Fluent;
@@ -522,6 +523,18 @@ class Blueprint
}
/**
+ * Specify a raw index for the table.
+ *
+ * @param string $expression
+ * @param string $name
+ * @return \Illuminate\Support\Fluent
+ */
+ public function rawIndex($expression, $name)
+ {
+ return $this->index([new Expression($expression)], $name);
+ }
+
+ /**
* Specify a foreign key for the table.
*
* @param string|array $columns | Add the ability to create indexes as expressions | illuminate_database | train | php |
fbac38225b9edb3e7094595e1eb3b26c0ff42825 | diff --git a/src/de/timroes/axmlrpc/AuthenticationManager.java b/src/de/timroes/axmlrpc/AuthenticationManager.java
index <HASH>..<HASH> 100644
--- a/src/de/timroes/axmlrpc/AuthenticationManager.java
+++ b/src/de/timroes/axmlrpc/AuthenticationManager.java
@@ -14,6 +14,15 @@ public class AuthenticationManager {
private String pass;
/**
+ * Clear the username and password. No basic HTTP authentication will be used
+ * in the next calls.
+ */
+ public void clearAuthData() {
+ this.user = null;
+ this.pass = null;
+ }
+
+ /**
* Set the username and password that should be used to perform basic
* http authentication.
*
diff --git a/src/de/timroes/axmlrpc/XMLRPCClient.java b/src/de/timroes/axmlrpc/XMLRPCClient.java
index <HASH>..<HASH> 100644
--- a/src/de/timroes/axmlrpc/XMLRPCClient.java
+++ b/src/de/timroes/axmlrpc/XMLRPCClient.java
@@ -228,6 +228,14 @@ public class XMLRPCClient {
public void setLoginData(String user, String pass) {
authManager.setAuthData(user, pass);
}
+
+ /**
+ * Clear the username and password. No basic HTTP authentication will be used
+ * in the next calls.
+ */
+ public void clearLoginData() {
+ authManager.clearAuthData();
+ }
/**
* Delete all cookies currently used by the client. | Added method to clear login data for basic http auth. | gturri_aXMLRPC | train | java,java |
f056c176c230793e7ba81ac40e47138bc1651a99 | diff --git a/lib/state_machine/extensions.rb b/lib/state_machine/extensions.rb
index <HASH>..<HASH> 100644
--- a/lib/state_machine/extensions.rb
+++ b/lib/state_machine/extensions.rb
@@ -35,7 +35,11 @@ module StateMachine
# +define_method+ is used to prevent it from showing up in #instance_methods
alias_method :initialize_without_state_machine, :initialize
- define_method(:initialize) {|*args, &block| initialize_with_state_machine(*args, &block) }
+ class_eval <<-end_eval, __FILE__, __LINE__
+ def initialize(*args, &block)
+ initialize_with_state_machine(*args, &block)
+ end
+ end_eval
@skip_initialize_hook = false
end | Revert to string evaluation when using blocks with define_method since it's not supported in Ruby <I>. [#6 state:resolved] | pluginaweek_state_machine | train | rb |
2446453dfbd065d3ebfded470a8edeb08ec52c70 | diff --git a/mousetrap.js b/mousetrap.js
index <HASH>..<HASH> 100644
--- a/mousetrap.js
+++ b/mousetrap.js
@@ -336,9 +336,13 @@
continue;
}
- // if this is a keypress event that means that we need to only
- // look at the character, otherwise check the modifiers as
- // well
+ // if this is a keypress event and the meta key and control key
+ // are not pressed that means that we need to only look at the
+ // character, otherwise check the modifiers as well
+ //
+ // chrome will not fire a keypress if meta or control is down
+ // safari will fire a keypress if meta or meta+shift is down
+ // firefox will fire a keypress if meta or control is down
if ((action == 'keypress' && !e.metaKey && !e.ctrlKey) || _modifiersMatch(modifiers, callback.modifiers)) {
// remove is used so if you change your mind and call bind a | Add mention of browser inconsistencies | ccampbell_mousetrap | train | js |
f79bca41a0161714545ee0bf40dcec1b2d47a545 | diff --git a/src/setup.js b/src/setup.js
index <HASH>..<HASH> 100644
--- a/src/setup.js
+++ b/src/setup.js
@@ -1,6 +1,9 @@
/* @flow */
+import { destroyElement } from 'belter/src';
+
import { getNamespace, getVersion } from './globals';
+import { getSDKScript } from './script';
export type SetupComponent<T> = {|
name : string,
@@ -63,6 +66,7 @@ export function setupSDK(components : $ReadOnlyArray<SetupComponent<mixed>>) {
enumerable: false,
value: () => {
destroyers.forEach(destroy => destroy());
+ destroyElement(getSDKScript());
delete window[namespace];
}
}); | Destroy old script tag on destroy | paypal_paypal-sdk-client | train | js |
9c599f9808d3b52fee7aaa4aabbbb2de40abd9a5 | diff --git a/lib/rubycritic/report_generators/base_generator.rb b/lib/rubycritic/report_generators/base_generator.rb
index <HASH>..<HASH> 100644
--- a/lib/rubycritic/report_generators/base_generator.rb
+++ b/lib/rubycritic/report_generators/base_generator.rb
@@ -40,6 +40,11 @@ module Rubycritic
File.join(REPORT_DIR, "assets", file)
end
+ def smell_location_path(location)
+ pathname = location.pathname
+ File.join(REPORT_DIR, File.dirname(pathname), "#{pathname.basename.sub_ext("")}.html#L#{location.line}")
+ end
+
def index_path
File.join(REPORT_DIR, "index.html")
end | Create `smell_location_path` helper method | whitesmith_rubycritic | train | rb |
69e78db2868ff363b5a8a5b5fd85734d357200ca | diff --git a/tests/MessageTest.php b/tests/MessageTest.php
index <HASH>..<HASH> 100644
--- a/tests/MessageTest.php
+++ b/tests/MessageTest.php
@@ -147,7 +147,7 @@ class MessageTest extends AbstractTest
$message = $this->mailbox->getMessage(1);
- $this->assertSame('Hi!', $message->getBodyText());
+ $this->assertSame('Hi!', rtrim($message->getBodyText()));
}
public function testSpecialCharsetOnHeaders() | Tests: skip last EOL (for now) | ddeboer_imap | train | php |
6a205e0d4aabd3cfe1811772585f798ab9dfbbf0 | diff --git a/install.rb b/install.rb
index <HASH>..<HASH> 100644
--- a/install.rb
+++ b/install.rb
@@ -2,8 +2,14 @@
## Copy over asset files (javascript/css/images) from the plugin directory to public/
##
+logger.info 'activescaffold debug output for installs'
+
def copy_files(source_path, destination_path, directory)
source, destination = File.join(directory, source_path), File.join(RAILS_ROOT, destination_path)
+logger.info '----'
+logger.info directory
+logger.info cwd
+logger.info destination
FileUtils.mkdir(destination) unless File.exist?(destination)
FileUtils.cp_r(Dir.glob(source+'/*.*'), destination)
end | adding some debug output to install.rb ... trying to find a bug in the plugin install
git-svn-id: <URL> | activescaffold_active_scaffold | train | rb |
138bbfd88eeafda8224cc9b8b205f5d893e758f3 | diff --git a/lib/toiler/cli.rb b/lib/toiler/cli.rb
index <HASH>..<HASH> 100644
--- a/lib/toiler/cli.rb
+++ b/lib/toiler/cli.rb
@@ -114,7 +114,6 @@ module Toiler
end
def load_concurrent
- fail 'Concurrent should not be required now' if defined?(::Concurrent)
require 'concurrent-edge'
Concurrent.global_logger = lambda do |level, progname, msg = nil, &block|
Toiler.logger.log(level, msg, progname, &block) | checking if Concurrent is already required is no longer necessary | mercadolibre_toiler | train | rb |
eb1fab7883846e16af1d8c650715e725a20a2665 | diff --git a/test/form/samples/quote-id/_config.js b/test/form/samples/quote-id/_config.js
index <HASH>..<HASH> 100644
--- a/test/form/samples/quote-id/_config.js
+++ b/test/form/samples/quote-id/_config.js
@@ -9,7 +9,7 @@ module.exports = {
options: {
output: {
paths: id => {
- if (id.startsWith('C:')) return id;
+ if (id === external3) return id;
return path.relative(__dirname, id);
},
name: 'Q', | Fix test/form/samples/quote-id on Windows (#<I>) | rollup_rollup | train | js |
5aa2f3840060257c6c5f826ba6a0595ccd9ee30f | diff --git a/openquake/calculators/risk/scenario/core.py b/openquake/calculators/risk/scenario/core.py
index <HASH>..<HASH> 100644
--- a/openquake/calculators/risk/scenario/core.py
+++ b/openquake/calculators/risk/scenario/core.py
@@ -178,7 +178,7 @@ class ScenarioRiskCalculator(general.BaseRiskCalculator):
vuln_model = kwargs['vuln_model']
epsilon_provider = kwargs['epsilon_provider']
- block = general.Block.from_kvs(block_id)
+ block = general.Block.from_kvs(self.calc_proxy.job_id, block_id)
block_losses = self._compute_loss_for_block(
block, vuln_model, epsilon_provider) | Updated the scenario calc also (but there's still no ****ing test coverage for most of the this calculator) | gem_oq-engine | train | py |
736cc538c039e7b1e93bac3546cfb3712c16e323 | diff --git a/lib/activity_notification/apis/notification_api.rb b/lib/activity_notification/apis/notification_api.rb
index <HASH>..<HASH> 100644
--- a/lib/activity_notification/apis/notification_api.rb
+++ b/lib/activity_notification/apis/notification_api.rb
@@ -746,7 +746,7 @@ module ActivityNotification
#
# @return [String] Notifiable path URL to move after opening notification
def notifiable_path
- notifiable.present? or raise ActiveRecord::RecordNotFound.new("Couldn't find notifiable #{notifiable_type}")
+ notifiable.blank? and raise ActivityNotification::NotifiableNotFoundError.new("Couldn't find associated notifiable (#{notifiable_type}) of #{self.class.name} with 'id'=#{id}")
notifiable.notifiable_path(target_type, key)
end
diff --git a/lib/activity_notification/helpers/errors.rb b/lib/activity_notification/helpers/errors.rb
index <HASH>..<HASH> 100644
--- a/lib/activity_notification/helpers/errors.rb
+++ b/lib/activity_notification/helpers/errors.rb
@@ -1,4 +1,5 @@
module ActivityNotification
class ConfigError < StandardError; end
class DeleteRestrictionError < StandardError; end
+ class NotifiableNotFoundError < StandardError; end
end | Raise original error instead of ActiveRecord::RecordNotFound in Notification#notifiable_path | simukappu_activity_notification | train | rb,rb |
0c41654a8180399e9b9a11f327f534721a58c420 | diff --git a/lib/cave/form.rb b/lib/cave/form.rb
index <HASH>..<HASH> 100644
--- a/lib/cave/form.rb
+++ b/lib/cave/form.rb
@@ -13,6 +13,8 @@ module Cave
end
def field name, type, opts={}
+ name = name.to_sym
+
@_fields ||= {}
@_fields[name] = type | Enforce that field hash keys be symbols | jamesdabbs_cave | train | rb |
c1a4da68cf2d7afcb284599015941975c3798ff4 | diff --git a/tests/testCases/CompatibilityTestCase.php b/tests/testCases/CompatibilityTestCase.php
index <HASH>..<HASH> 100644
--- a/tests/testCases/CompatibilityTestCase.php
+++ b/tests/testCases/CompatibilityTestCase.php
@@ -1,12 +1,16 @@
<?php
-use Aedart\Testing\Laravel\TestCases\Integration\InterfaceAndTraitCompatibilityTestCase;
+use Aedart\Testing\GST\GetterSetterTraitTester;
+use Aedart\Testing\TestCases\Unit\UnitTestCase;
/**
* Class CompatibilityTestCase
*
* @author Alin Eugen Deac <aedart@gmail.com>
*/
-abstract class CompatibilityTestCase extends InterfaceAndTraitCompatibilityTestCase{
+abstract class CompatibilityTestCase extends UnitTestCase {
+
+ use GetterSetterTraitTester;
+
}
\ No newline at end of file | Change CompatibilityTestCase
Now doesn't rely on the old Interface and Trait Compatibility¨TestCase. | aedart_laravel-helpers | train | php |
f6330d69e65b779368827a3d99128ab10880f0d2 | diff --git a/spacy/_ml.py b/spacy/_ml.py
index <HASH>..<HASH> 100644
--- a/spacy/_ml.py
+++ b/spacy/_ml.py
@@ -505,7 +505,7 @@ def getitem(i):
return layerize(getitem_fwd)
def build_tagger_model(nr_class, **cfg):
- embed_size = util.env_opt('embed_size', 1000)
+ embed_size = util.env_opt('embed_size', 7000)
if 'token_vector_width' in cfg:
token_vector_width = cfg['token_vector_width']
else: | Default embed size to <I> | explosion_spaCy | train | py |
f63ccc0b1b1d76292ff373317bbd64fef1f003d0 | diff --git a/tasks/es6_module_wrap_default.js b/tasks/es6_module_wrap_default.js
index <HASH>..<HASH> 100644
--- a/tasks/es6_module_wrap_default.js
+++ b/tasks/es6_module_wrap_default.js
@@ -42,6 +42,9 @@ module.exports = function (grunt) {
var importPath = path.join(path.relative(destDirname, srcDirname), srcBaseName);
+ // Path will use forward slash as delimiter on both Windows and Unix based systems.
+ importPath = path.normalize(importPath).replace(/\\/g, '/');
+
var src;
switch (options.type) { | Fixed problems with backslash on Windows | stevoland_grunt-es6-module-wrap-default | train | js |
ee71a3fbfc6fb8112a58a8fcae31a1c2a423ef3f | diff --git a/activerecord/test/cases/relations_test.rb b/activerecord/test/cases/relations_test.rb
index <HASH>..<HASH> 100644
--- a/activerecord/test/cases/relations_test.rb
+++ b/activerecord/test/cases/relations_test.rb
@@ -25,13 +25,6 @@ class RelationTest < ActiveRecord::TestCase
assert_no_queries { car.engines.length }
end
- def test_apply_relation_as_where_id
- posts = Post.arel_table
- post_authors = posts.where(posts[:author_id].eq(1)).project(posts[:id])
- assert_equal 5, post_authors.to_a.size
- assert_equal 5, Post.where(:id => post_authors).size
- end
-
def test_dynamic_finder
x = Post.where('author_id = ?', 1)
assert x.klass.respond_to?(:find_by_id), '@klass should handle dynamic finders' | removing call to deprecated API, this test is outside AR responsibilities | rails_rails | train | rb |
643c082c21893c9386bfc239d237bc81e87c02b1 | diff --git a/core/src/main/java/org/cache2k/impl/CacheBuilderImpl.java b/core/src/main/java/org/cache2k/impl/CacheBuilderImpl.java
index <HASH>..<HASH> 100644
--- a/core/src/main/java/org/cache2k/impl/CacheBuilderImpl.java
+++ b/core/src/main/java/org/cache2k/impl/CacheBuilderImpl.java
@@ -196,6 +196,13 @@ public class CacheBuilderImpl<K, T> extends CacheBuilder<K, T> {
configureViaSetters(bc);
boolean _wrap = false;
+
+ List<StorageConfiguration> _stores = config.getStorageModules();
+
+ if (syncListeners != null) { _wrap = true; }
+ if (cacheWriter != null) { _wrap = true; }
+ if (_stores.size() > 0) { _wrap = true; }
+
_wrap = true;
WiredCache<K, T> wc = null;
if (_wrap) {
@@ -208,7 +215,6 @@ public class CacheBuilderImpl<K, T> extends CacheBuilder<K, T> {
bc.setName(_name);
if (_wrap) {
- List<StorageConfiguration> _stores = config.getStorageModules();
if (_stores.size() == 1) {
StorageConfiguration cfg = _stores.get(0);
if (cfg.getEntryCapacity() < 0) { | wrap only if we have additional attachments, heap only cache is not passing tests, yet | cache2k_cache2k | train | java |
554ac0468a96cc117ad93a904fe3f7557c8a6b84 | diff --git a/jwa/jwa.go b/jwa/jwa.go
index <HASH>..<HASH> 100644
--- a/jwa/jwa.go
+++ b/jwa/jwa.go
@@ -1,2 +1,24 @@
// Package jwa defines the various algorithm described in https://tools.ietf.org/html/rfc7518
package jwa
+
+func (kty KeyType) String() string {
+ return string(kty)
+}
+
+func (alg SignatureAlgorithm) String() string {
+ return string(alg)
+}
+
+func (alg KeyEncryptionAlgorithm) String() string {
+ return string(alg)
+}
+
+func (alg ContentEncryptionAlgorithm) String() string {
+ return string(alg)
+}
+
+func (alg CompressionAlgorithm) String() string {
+ return string(alg)
+}
+
+ | Implement Stringer() for each type in JWA | lestrrat-go_jwx | train | go |
9d6753d5a5bb72207b25a1685491be45388093d4 | diff --git a/sql_mapper.go b/sql_mapper.go
index <HASH>..<HASH> 100644
--- a/sql_mapper.go
+++ b/sql_mapper.go
@@ -13,7 +13,7 @@ type SQLMapper struct {
// Uses SQL to retrieve all points within the radius (in meters) passed in from the origin point passed in.
// Original implemenation from : http://www.movable-type.co.uk/scripts/latlong-db.html
-// Returns Rows of sql as a result, or an error if one occurs during the query.
+// Returns a pointer to a sql.Rows as a result, or an error if one occurs during the query.
func (s *SQLMapper) PointsWithinRadius(p *Point, radius float64) (*sql.Rows, error) {
select_str := fmt.Sprintf("SELECT * FROM %v a", s.conf.table)
lat1 := fmt.Sprintf("sin(radians(%f)) * sin(radians(a.lat))", p.lat) | [src] Fixing incorrect terminology in the documentation | kellydunn_golang-geo | train | go |
65a61f9055ae968e488119580ee9b2701449b599 | diff --git a/openquake/calculators/base.py b/openquake/calculators/base.py
index <HASH>..<HASH> 100644
--- a/openquake/calculators/base.py
+++ b/openquake/calculators/base.py
@@ -1008,6 +1008,7 @@ class RiskCalculator(HazardCalculator):
% self.oqparam.inputs['job_ini'])
rlzs = dstore['events']['rlz_id']
gmf_df = dstore.read_df('gmf_data', 'sid')
+ logging.info('Events per site: ~%d', len(gmf_df) / self.N)
logging.info('Grouping the GMFs by site ID')
by_sid = dict(list(gmf_df.groupby(gmf_df.index)))
for sid, assets in enumerate(self.assetcol.assets_by_site()): | Better logging [ci skip] | gem_oq-engine | train | py |
f7f3b4560f8a6a44d3738db798cba977bb5daf4f | diff --git a/tests/test_client.py b/tests/test_client.py
index <HASH>..<HASH> 100644
--- a/tests/test_client.py
+++ b/tests/test_client.py
@@ -133,6 +133,12 @@ class SSHClientTest (unittest.TestCase):
"""
self._test_connection(key_filename=test_path('test_dss.key'))
+ def test_client_rsa(self):
+ """
+ verify that SSHClient works with an RSA key.
+ """
+ self._test_connection(key_filename=test_path('test_rsa.key'))
+
def test_2_5_client_ecdsa(self):
"""
verify that SSHClient works with an ECDSA key. | Add an explicit RSA test, which fails (!) | paramiko_paramiko | train | py |
465f1fec0db86aa153d9679afa80db89d882d3ee | diff --git a/lib/Less/Environment.php b/lib/Less/Environment.php
index <HASH>..<HASH> 100755
--- a/lib/Less/Environment.php
+++ b/lib/Less/Environment.php
@@ -115,10 +115,8 @@ class Less_Environment{
*
*/
static function normalizePath($path){
- if (strtolower(substr(PHP_OS, 0, '3')) === 'win') {
- $path = str_replace('\\', '/', $path);
- }
-
+ $path = str_replace('\\', '/', $path);
+
$segments = explode('/',$path);
$segments = array_reverse($segments); | convert all backslash to slash in normalize path | oyejorge_less.php | train | php |
f8bfcddff3956f8d1cc524ff77e97da10a723ee2 | diff --git a/lib/ruby_http_client.rb b/lib/ruby_http_client.rb
index <HASH>..<HASH> 100644
--- a/lib/ruby_http_client.rb
+++ b/lib/ruby_http_client.rb
@@ -15,6 +15,12 @@ module SendGrid
@body = response.body
@headers = response.to_hash
end
+
+ # Returns the body as a hash
+ #
+ def parsed_body
+ @parsed_body ||= JSON.parse(@body, symbolize_names: true)
+ end
end
# A simple REST client. | Add a helper returns the response body as a hash | sendgrid_ruby-http-client | train | rb |
38fd57f5c969f2f169752c02226b8fc5d431bc69 | diff --git a/lib/mixpanel/client.rb b/lib/mixpanel/client.rb
index <HASH>..<HASH> 100644
--- a/lib/mixpanel/client.rb
+++ b/lib/mixpanel/client.rb
@@ -16,7 +16,7 @@ module Mixpanel
# Availalbe options for a Mixpanel API request
OPTIONS = [:resource, :event, :funnel, :name, :type, :unit, :interval, :limit, :format, :bucket,
- :values]
+ :values, :from_date, :to_date, :on, :where, :buckets]
# Dynamically define accessor methods for each option
OPTIONS.each do |option|
diff --git a/spec/mixpanel_client/mixpanel_client_spec.rb b/spec/mixpanel_client/mixpanel_client_spec.rb
index <HASH>..<HASH> 100644
--- a/spec/mixpanel_client/mixpanel_client_spec.rb
+++ b/spec/mixpanel_client/mixpanel_client_spec.rb
@@ -98,6 +98,12 @@ describe Mixpanel::Client do
format 'csv'
bucket 'list'
values '["tiger", "blood"]'
+ #below options only in segmentation events
+ from_date '2011-08-11'
+ to_date '2011-08-12'
+ on 'properties["product_id"]'
+ where '1 in properties["product_id"]'
+ buckets '5'
end
Mixpanel::Client::OPTIONS.each do |option| | Add :from_date, :to_date, :on, :where, :buckets options used in segmentation resource | keolo_mixpanel_client | train | rb,rb |
2a48ec571aab12d7684aa8037cd39f40b030ba84 | diff --git a/lib/rubikon/application.rb b/lib/rubikon/application.rb
index <HASH>..<HASH> 100644
--- a/lib/rubikon/application.rb
+++ b/lib/rubikon/application.rb
@@ -129,22 +129,22 @@ module Rubikon
#
# +text+:: The text to write into the output stream
def put(text)
- ostream << text
- ostream.flush
+ @settings[:ostream] << text
+ @settings[:ostream].flush
end
# Output a character using +IO#putc+ of the output stream
#
# +char+:: The character to write into the output stream
def putc(char)
- ostream.putc char
+ @settings[:ostream].putc char
end
# Output a line of text using +IO#puts+ of the output stream
#
# +text+:: The text to write into the output stream
def puts(text)
- ostream.puts text
+ @settings[:ostream].puts text
end
# Run this application
@@ -217,7 +217,7 @@ module Rubikon
# end
def throbber(&block)
spinner = '-\|/'
- current_ostream = ostream
+ current_ostream = @settings[:ostream]
@settings[:ostream] = StringIO.new
code_thread = Thread.new { block.call }
@@ -238,7 +238,7 @@ module Rubikon
code_thread.join
throbber_thread.join
- current_ostream << ostream.string
+ current_ostream << @settings[:ostream].string
@settings[:ostream] = current_ostream
end | Don't use #ostream inside Application, this is only convenience for users | koraktor_rubikon | train | rb |
bb7205d527db397f2de6540640c640b5c6f64130 | diff --git a/src/Dependency.php b/src/Dependency.php
index <HASH>..<HASH> 100644
--- a/src/Dependency.php
+++ b/src/Dependency.php
@@ -54,7 +54,7 @@ use SimpleComplex\Utils\Exception\ContainerRuntimeException;
* - logger
* - inspect
* - locale
- * - validator
+ * - validate
*
*
* @package SimpleComplex\Utils | Validate dependency injection container ID renamed to 'validate'; from 'validator'. | simplecomplex_php-utils | train | php |
558f2e12ef6b0464657241c291c01f5c11980434 | diff --git a/test/modules/mock.js b/test/modules/mock.js
index <HASH>..<HASH> 100644
--- a/test/modules/mock.js
+++ b/test/modules/mock.js
@@ -1,6 +1,8 @@
/**
* Defines phantomas global API mock
*/
+/* istanbul ignore file */
+
const assert = require("assert"),
debug = require("debug"),
noop = () => {}, | test/modules/mock.js excluded from code coverage | macbre_phantomas | train | js |
0b577033efbcd8a9fa861edffc1a9896f3f790bd | diff --git a/lib/awesome_print/ext/mongoid.rb b/lib/awesome_print/ext/mongoid.rb
index <HASH>..<HASH> 100644
--- a/lib/awesome_print/ext/mongoid.rb
+++ b/lib/awesome_print/ext/mongoid.rb
@@ -20,7 +20,7 @@ module AwesomePrint
cast = :mongoid_class
elsif object.class.ancestors.include?(::Mongoid::Document)
cast = :mongoid_document
- elsif (defined?(::BSON) && object.is_a?(::BSON::ObjectId)) || (defined?(::Moped) && object.is_a?(::Moped::BSON::ObjectId))
+ elsif (defined?(::BSON) && object.is_a?(::BSON::ObjectId)) || (defined?(::Moped) && defined?(::Moped::BSON) && object.is_a?(::Moped::BSON::ObjectId))
cast = :mongoid_bson_id
end
end | Ensure that Moped and Moped::BSON is defined before testing against Moped::BSON::ObjectID
In my environment we had an issue where ap was causing sidekiq to blow up because apparently our moped is not eager loading Moped::BSON. Moped was present. | awesome-print_awesome_print | train | rb |
817020ca7bbc57223a050471e37de6f9342deb1a | diff --git a/geist/version.py b/geist/version.py
index <HASH>..<HASH> 100644
--- a/geist/version.py
+++ b/geist/version.py
@@ -1 +1 @@
-__version__ = '1.0a14'
+__version__ = '1.0a16'
diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -12,7 +12,7 @@ setup(
version=__version__,
packages=['geist', 'geist.backends'],
install_requires=[
- 'numpy>=1.7.0',
+ 'numpy>=1.9.0',
'scipy',
'ooxcb',
'PyHamcrest', | Update version & up numpy version | ten10solutions_Geist | train | py,py |
e495f4307e7af584653f007fc94e2b9c415401cf | diff --git a/lib/honeybadger/config/ruby.rb b/lib/honeybadger/config/ruby.rb
index <HASH>..<HASH> 100644
--- a/lib/honeybadger/config/ruby.rb
+++ b/lib/honeybadger/config/ruby.rb
@@ -70,7 +70,7 @@ module Honeybadger
end
def logger
- get(:logger)
+ get(:logger) || config.logger
end
def backend=(backend)
@@ -78,7 +78,7 @@ module Honeybadger
end
def backend
- get(:backend)
+ get(:backend) || config.backend
end
def backtrace_filter | Fix a bug where the logger isn't initialized... (#<I>)
...when logging in `Config::Ruby`. The #logger and #backend methods both
do some lazy initialization. | honeybadger-io_honeybadger-ruby | train | rb |
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.