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
414792ee0d3ce0bb50358a274f7de7065f9c5d21
diff --git a/ads/core.py b/ads/core.py index <HASH>..<HASH> 100644 --- a/ads/core.py +++ b/ads/core.py @@ -204,16 +204,14 @@ class Article(object): def _get_field(self, field): """ - Queries the api for a single field for the record by `id`. Intentionally - does not update self.response. This method should only be called - indirectly by cached properties. + Queries the api for a single field for the record by `id`. + This method should only be called indirectly by cached properties. :param field: name of the record field to load """ if not hasattr(self, "id") or self.id is None: raise SolrResponseError("Cannot query an article without an id") - response = SolrResponse.load_http_response(BaseQuery().session.get( - SEARCH_URL, params={"q": "id:{}".format(self.id), "fl": field})) - value = response.docs[0][field] + sq = SearchQuery(q="id:{}".format(self.id), fl=field) + value = next(sq).__getattribute__(field) self._raw[field] = value return value
Article: use SearchQuery instead of BaseQuery for _get_field()
andycasey_ads
train
py
8829d9d8e9a68afe0c27a28260027e4c09a8fa38
diff --git a/src/speech_rules/clearspeak_rules.js b/src/speech_rules/clearspeak_rules.js index <HASH>..<HASH> 100644 --- a/src/speech_rules/clearspeak_rules.js +++ b/src/speech_rules/clearspeak_rules.js @@ -2250,8 +2250,9 @@ sre.ClearspeakRules.initClearspeakRules_ = function() { 'self::number', '@role="mixed"'); defineRule( 'number-with-chars', 'clearspeak.default', - '[t] "number"; [m] CQFspaceoutNumber', 'self::number[@role!="protected"]', - '"" != translate(text(), "0123456789.,", "")'); + '[t] "number"; [m] CQFspaceoutNumber', 'self::number', + '"" != translate(text(), "0123456789.,", "")', + 'text() != translate(text(), "0123456789.,", "")'); // Decimal periods: defineRule(
Fixes number rules to work with alpha mixed numbers.
zorkow_speech-rule-engine
train
js
c019deefb01389215d78fd59ed0876d527b7a805
diff --git a/spyderlib/widgets/dicteditor.py b/spyderlib/widgets/dicteditor.py index <HASH>..<HASH> 100644 --- a/spyderlib/widgets/dicteditor.py +++ b/spyderlib/widgets/dicteditor.py @@ -757,7 +757,10 @@ class BaseTableView(QTableView): """Reimplement Qt method""" index_clicked = self.indexAt(event.pos()) if index_clicked.isValid(): - self.edit_item() + row = index_clicked.row() + # TODO: Remove hard coded "Value" column number (3 here) + index_clicked = index_clicked.child(row, 3) + self.edit(index_clicked) else: event.accept()
Variable explorer: Make double clicks to edit values when pressed anywhere (and not just in the Value column)
spyder-ide_spyder
train
py
93510a73120d0dcec3243e5cac52346319d55c0a
diff --git a/chisel/request.py b/chisel/request.py index <HASH>..<HASH> 100644 --- a/chisel/request.py +++ b/chisel/request.py @@ -23,7 +23,7 @@ from .compat import func_name, iteritems import hashlib -import os +from pathlib import posixpath from pkg_resources import resource_string @@ -71,11 +71,11 @@ class StaticRequest(Request): if name is None: name = resource_name if urls is None: - urls = (('GET', '/' + resource_name),) + urls = (('GET', '/' + posixpath.join(*posixpath.split(resource_name)[1:])),) if doc is None: doc = ('The "{0}" package\'s static resource, "{1}".'.format(package, resource_name),) if content_type is None: - content_type = self.EXT_TO_CONTENT_TYPE.get(os.path.splitext(resource_name)[1].lower(), 'application/octet-stream') + content_type = self.EXT_TO_CONTENT_TYPE.get(posixpath.splitext(resource_name)[1].lower(), 'application/octet-stream') Request.__init__(self, name=name, urls=urls, doc=doc)
use posixpath in StaticRequest
craigahobbs_chisel
train
py
2772ea4febfeafb3c7ded2bc63b522b85f76d624
diff --git a/lib/commands/test.js b/lib/commands/test.js index <HASH>..<HASH> 100644 --- a/lib/commands/test.js +++ b/lib/commands/test.js @@ -5,11 +5,18 @@ const doctap = require('../doctap'), module.exports.command = 'test'; module.exports.description = 'Run all doctests' -module.exports.builder = {}; +module.exports.builder = { + entrypoint: { + describe: 'entrypoint to api.js', + type: 'string', + default: '.' + } +}; module.exports.handler = function test (argv) { argv._handled = true; - doctap(cwd('.', 'api.js')); + let entrypoint = argv.entrypoint; + doctap(cwd(entrypoint, 'api.js')); // tap-parser --json=4 > doctest.json console.log('Run Smappi Test Server...'); };
Added entrypoint for smappi test
smappi_smappi-cl
train
js
5327547635bc99250c3c2756c2a0a536c0795adb
diff --git a/rake/lib/rake/filelist.rb b/rake/lib/rake/filelist.rb index <HASH>..<HASH> 100644 --- a/rake/lib/rake/filelist.rb +++ b/rake/lib/rake/filelist.rb @@ -6,8 +6,21 @@ module Rake add_matching(pattern) if pattern end - def add_matching(pattern) - Dir[pattern].each { |fn| self << fn } if pattern + def add(*filenames) + filenames.each do |fn| + case fn + when Array + fn.each { |f| self << f } + else + self << fn + end + end + end + + def add_matching(*patterns) + patterns.each do |pattern| + Dir[pattern].each { |fn| self << fn } if pattern + end end def to_s
Added "add" function. Arrays and single file names are acceptable. git-svn-id: svn+ssh://rubyforge.org/var/svn/rake/trunk@<I> 5af<I>f1-ac1a-<I>-<I>d6-<I>a<I>c<I>ef
ruby_rake
train
rb
0034eb3992c6b229e37e85e7637394839f3a2c9a
diff --git a/angr/analyses/cgc.py b/angr/analyses/cgc.py index <HASH>..<HASH> 100644 --- a/angr/analyses/cgc.py +++ b/angr/analyses/cgc.py @@ -50,7 +50,7 @@ class CGC(Analysis): # make a CGC state s = self._p.initial_state() s.get_plugin('cgc') - self.e = self._p.surveyors.Explorer(start=self._p.exit_to(self._p.entry, state=s), find=self.check_path) + self.e = self._p.surveyors.Explorer(start=self._p.exit_to(self._p.entry, state=s), find=self.check_for_eip_control, enable_veritesting=True) self.e.run() self.vuln_path = self.e.found[0]
merged cgc.py.
angr_angr
train
py
e914c862b48bd909e72daca1ccb24b3f71f7f639
diff --git a/conn_test.go b/conn_test.go index <HASH>..<HASH> 100644 --- a/conn_test.go +++ b/conn_test.go @@ -16,6 +16,29 @@ func TestSystemBus(t *testing.T) { } } +func TestSend(t *testing.T) { + bus, err := SessionBus() + if err != nil { + t.Error(err) + } + ch := make(chan *Call, 1) + msg := &Message{ + Type: TypeMethodCall, + Flags: 0, + Headers: map[HeaderField]Variant{ + FieldDestination: MakeVariant(bus.Names()[0]), + FieldPath: MakeVariant(ObjectPath("/org/freedesktop/DBus")), + FieldInterface: MakeVariant("org.freedesktop.DBus.Peer"), + FieldMember: MakeVariant("Ping"), + }, + } + call := bus.Send(msg, ch) + <-ch + if call.Err != nil { + t.Error(call.Err) + } +} + type server struct{} func (server) Double(i int64) (int64, *Error) {
Add test for Conn.Send()
guelfey_go.dbus
train
go
4b33181511804396247d5b8c243693ea9ce22985
diff --git a/addon/adapters/pouch.js b/addon/adapters/pouch.js index <HASH>..<HASH> 100644 --- a/addon/adapters/pouch.js +++ b/addon/adapters/pouch.js @@ -133,8 +133,12 @@ export default DS.RESTAdapter.extend({ _recordToData: function (store, type, record) { var data = {}; - var recordTypeName = this.getRecordTypeName(type); - var serializer = store.serializerFor(recordTypeName); + // Though it would work to use the default recordTypeName for modelName & + // serializerKey here, these uses are conceptually distinct and may vary + // independently. + var modelName = type.modelName || type.typeKey; + var serializerKey = camelize(modelName); + var serializer = store.serializerFor(modelName); var recordToStore = record; // In Ember-Data beta.15, we need to take a snapshot. See issue #45. @@ -152,7 +156,7 @@ export default DS.RESTAdapter.extend({ {includeId: true} ); - data = data[recordTypeName]; + data = data[serializerKey]; // ember sets it to null automatically. don't need it. if (data.rev === null) {
Serializer keys are conceptually distinct from recordTypeName.
pouchdb-community_ember-pouch
train
js
362ee4c9eb4002cfe6cc0750fba2de244f90117a
diff --git a/system/src/Grav/Common/Page/Page.php b/system/src/Grav/Common/Page/Page.php index <HASH>..<HASH> 100644 --- a/system/src/Grav/Common/Page/Page.php +++ b/system/src/Grav/Common/Page/Page.php @@ -2902,7 +2902,7 @@ class Page $case_insensitive = Grav::instance()['config']->get('system.force_lowercase_urls'); if ($case_insensitive) { - return strtolower($route); + return mb_strtolower($route); } else { return $route; }
Fix for URL encoding with Multibyte folders
getgrav_grav
train
php
1d23ed3afc4700f3af01984ef0c39db8e49da309
diff --git a/src/model/Repositories/UserEmailConfirmationsRepository.php b/src/model/Repositories/UserEmailConfirmationsRepository.php index <HASH>..<HASH> 100644 --- a/src/model/Repositories/UserEmailConfirmationsRepository.php +++ b/src/model/Repositories/UserEmailConfirmationsRepository.php @@ -21,7 +21,7 @@ class UserEmailConfirmationsRepository extends Repository public function confirm(string $token): ?ActiveRow { - $emailConfirmationRow = $this->getTable()->where('token', $token)->fetch(); + $emailConfirmationRow = $this->getTable()->where('token', $token)->order('id DESC')->fetch(); if (!$emailConfirmationRow) { return null; } @@ -32,10 +32,14 @@ class UserEmailConfirmationsRepository extends Repository return $emailConfirmationRow; } - + public function getToken(int $userId): ?string { - $token = $this->getTable()->where('user_id', $userId)->fetchField('token'); + $token = $this->getTable() + ->where('user_id', $userId) + ->order('id DESC') + ->fetchField('token'); + return $token ?: null; } }
Add automatic internal user confirmation At this point we want to maintain backwards compatibility and confirm every user. Once we start sending activation links to the selected groups of users, we'll exclude this groups from the automatic user confirmation. remp/crm#<I>
remp2020_crm-users-module
train
php
ac7cc206aad6c1ce1d490f06d3263244f6ef0f86
diff --git a/tests/test_georaster_tiling.py b/tests/test_georaster_tiling.py index <HASH>..<HASH> 100644 --- a/tests/test_georaster_tiling.py +++ b/tests/test_georaster_tiling.py @@ -157,9 +157,11 @@ class GeoRaster2TestGetTile(TestCase): def test_get_tile_from_different_crs_tile_is_not_tilted_with_different_buffer(self): for raster in [self.read_only_virtual_geo_raster_wgs84()]: os.environ["TELLURIC_GET_TILE_BUFFER"] = "0" - r = raster.get_tile(*tiles[18]) + try: + r = raster.get_tile(*tiles[18]) + except: + del os.environ["TELLURIC_GET_TILE_BUFFER"] self.assertEqual(2, len(np.unique(r.image.mask))) - del os.environ["TELLURIC_GET_TILE_BUFFER"] def test_get_entire_all_raster(self): vr = self.small_read_only_virtual_geo_raster()
makng environment setting on test safer
satellogic_telluric
train
py
2584a5a432bf3615bf3ddb7d995a142fb14b40e5
diff --git a/salt/renderers/stateconf.py b/salt/renderers/stateconf.py index <HASH>..<HASH> 100644 --- a/salt/renderers/stateconf.py +++ b/salt/renderers/stateconf.py @@ -38,7 +38,7 @@ from cStringIO import StringIO # Import salt libs import salt.utils from salt.exceptions import SaltRenderError -import six +import salt.utils.six as six from six import string_types __all__ = ['render']
Replaced import six in file /salt/renderers/stateconf.py
saltstack_salt
train
py
937ac5f80e6932e5b40cd87266bc5db8f51dc85f
diff --git a/textdistance/algorithms/edit_based.py b/textdistance/algorithms/edit_based.py index <HASH>..<HASH> 100644 --- a/textdistance/algorithms/edit_based.py +++ b/textdistance/algorithms/edit_based.py @@ -251,8 +251,9 @@ class JaroWinkler(_BaseSimilarity): if not s1_len or not s2_len: return 0.0 - min_len = max(s1_len, s2_len) - search_range = (min_len // 2) - 1 + min_len = min(s1_len, s2_len) + search_range = max(s1_len, s2_len) + search_range = (search_range // 2) - 1 if search_range < 0: search_range = 0 @@ -294,7 +295,7 @@ class JaroWinkler(_BaseSimilarity): # stop to boost if strings are not similar if not self.winklerize: return weight - if weight <= 0.7 or s1_len <= 3 or s2_len <= 3: + if weight <= 0.7: return weight # winkler modification
Modify JaroWinkler boosting to match behaviour of jellyfish algorithm
orsinium_textdistance
train
py
8f659ca0f6d3b6a359608dbe034411b3eb8d44df
diff --git a/spec/unit/provider/service/smf_spec.rb b/spec/unit/provider/service/smf_spec.rb index <HASH>..<HASH> 100644 --- a/spec/unit/provider/service/smf_spec.rb +++ b/spec/unit/provider/service/smf_spec.rb @@ -20,6 +20,8 @@ describe provider_class, :if => Puppet.features.posix? do FileTest.stubs(:executable?).with('/usr/sbin/svcadm').returns true FileTest.stubs(:file?).with('/usr/bin/svcs').returns true FileTest.stubs(:executable?).with('/usr/bin/svcs').returns true + Facter.stubs(:value).with(:operatingsystem).returns('Solaris') + Facter.stubs(:value).with(:osfamily).returns('Solaris') Facter.stubs(:value).with(:kernelrelease).returns '5.11' end
(maint) Stub operatingsystem fact in SMF provider test
puppetlabs_puppet
train
rb
55c5723752045b5a2011bcb42ad8e9071fed3153
diff --git a/src/main/java/graphql/execution/TypeInfo.java b/src/main/java/graphql/execution/TypeInfo.java index <HASH>..<HASH> 100644 --- a/src/main/java/graphql/execution/TypeInfo.java +++ b/src/main/java/graphql/execution/TypeInfo.java @@ -74,7 +74,7 @@ public class TypeInfo { typeIsNonNull, type, parentType); } - static class Builder { + public static class Builder { GraphQLType type; TypeInfo parentType;
#<I> type info build is public
graphql-java_graphql-java
train
java
5e0ee6c09522ae573ef03b77dbd609f3db4d15b6
diff --git a/codec-dns/src/main/java/io/netty/handler/codec/dns/AbstractDnsMessage.java b/codec-dns/src/main/java/io/netty/handler/codec/dns/AbstractDnsMessage.java index <HASH>..<HASH> 100644 --- a/codec-dns/src/main/java/io/netty/handler/codec/dns/AbstractDnsMessage.java +++ b/codec-dns/src/main/java/io/netty/handler/codec/dns/AbstractDnsMessage.java @@ -375,6 +375,11 @@ public abstract class AbstractDnsMessage extends AbstractReferenceCounted implem @Override protected void deallocate() { clear(); + + final ResourceLeak leak = this.leak; + if (leak != null) { + leak.close(); + } } @Override
Fix missing ResourceLeak.close() in AbstractDnsMessage Motivation: ResourceLeak.close() must be called when a reference-counted resource is deallocated, but AbstractDnsMessage.deallocate() forgot to call it. Modifications: Call ResourceLeak.close() for the tracked AbstractDnsMessage instances Result: Fix the false resource leak warnings
netty_netty
train
java
86cfa1453d15550f956e3e24810a7f35423b0633
diff --git a/src/Formatter/Result.php b/src/Formatter/Result.php index <HASH>..<HASH> 100644 --- a/src/Formatter/Result.php +++ b/src/Formatter/Result.php @@ -168,13 +168,13 @@ class Result $this->identifiers[$identifier][] = $value; } - public function get($identifier, $default = null) + public function get($identifier, $default = null, $singleAsArray = false) { if (!array_key_exists($identifier, $this->identifiers)) { return $default; } - if (is_array($this->identifiers[$identifier]) && 1 === count($this->identifiers[$identifier])) { + if (is_array($this->identifiers[$identifier]) && 1 === count($this->identifiers[$identifier]) && $singleAsArray === false) { return array_values($this->identifiers[$identifier])[0]; }
assume single as array for get default false
neoxygen_neo4j-neoclient
train
php
0803bf70d19d57a443cc198fcc191e4bf3349bc7
diff --git a/src/Zephyrus/Security/Authorization.php b/src/Zephyrus/Security/Authorization.php index <HASH>..<HASH> 100644 --- a/src/Zephyrus/Security/Authorization.php +++ b/src/Zephyrus/Security/Authorization.php @@ -9,8 +9,9 @@ class Authorization const GET = 1; const POST = 2; const PUT = 4; - const DELETE = 8; - const ALL = 15; + const PATCH = 8; + const DELETE = 16; + const ALL = 31; const MODE_BLACKLIST = 0; const MODE_WHITELIST = 1; @@ -145,6 +146,9 @@ class Authorization if ($httpMethod & self::PUT) { $methods[] = 'PUT'; } + if ($httpMethod & self::PATCH) { + $methods[] = 'PATCH'; + } if ($httpMethod & self::DELETE) { $methods[] = 'DELETE'; }
Added PATCH method to Authorization
dadajuice_zephyrus
train
php
f586f243a504ed078d35b773c2b921b87ee048a6
diff --git a/src/main/java/org/jboss/pressgang/ccms/rest/v1/constants/RESTv1Constants.java b/src/main/java/org/jboss/pressgang/ccms/rest/v1/constants/RESTv1Constants.java index <HASH>..<HASH> 100644 --- a/src/main/java/org/jboss/pressgang/ccms/rest/v1/constants/RESTv1Constants.java +++ b/src/main/java/org/jboss/pressgang/ccms/rest/v1/constants/RESTv1Constants.java @@ -34,7 +34,7 @@ public class RESTv1Constants { public static final String CONTENT_SPEC_EXPANSION_NAME = "contentSpecs"; public static final String CONTENT_SPEC_NODE_EXPANSION_NAME = "nodes"; - public static final String TRANSLATED_CONTENT_SPEC_EXPANSION_NAME = "translatedContentSpec"; + public static final String TRANSLATED_CONTENT_SPEC_EXPANSION_NAME = "translatedContentSpecs"; public static final String CONTENT_SPEC_TRANSLATED_NODE_EXPANSION_NAME = "translatedNodes"; public static final String TOPIC_URL_NAME = "topic";
Minor fix to make a collection expand a plural.
pressgang-ccms_PressGangCCMSRESTv1Common
train
java
c54fc9e4e6072e7bffbb1a02b1c11645c50038e4
diff --git a/plugins/UsersManager/UsersManager.php b/plugins/UsersManager/UsersManager.php index <HASH>..<HASH> 100644 --- a/plugins/UsersManager/UsersManager.php +++ b/plugins/UsersManager/UsersManager.php @@ -166,7 +166,7 @@ class UsersManager extends \Piwik\Plugin */ public static function checkPasswordHash($passwordHash, $exceptionMessage) { - if (strlen($passwordHash) !== strlen(static::getPasswordHash('teststring'))) { + if (strlen($passwordHash) != 32) { // MD5 hash length throw new Exception($exceptionMessage); } }
Revert hash calculation on comparison For performance reasons
matomo-org_matomo
train
php
623b54c057a764bd9b69ac601d9c14f39a07d705
diff --git a/svtplay_dl.py b/svtplay_dl.py index <HASH>..<HASH> 100755 --- a/svtplay_dl.py +++ b/svtplay_dl.py @@ -1042,6 +1042,7 @@ class Tv4play(): options.live = True streams = {} + subtitle = False for i in sa: if i.find("mediaFormat").text != "smi": @@ -1049,6 +1050,8 @@ class Tv4play(): stream["uri"] = i.find("base").text stream["path"] = i.find("url").text streams[int(i.find("bitrate").text)] = stream + elif i.find("mediaFormat").text == "smi": + subtitle = i.find("url").text if len(streams) == 1: test = streams[list(streams.keys())[0]] else: @@ -1066,6 +1069,8 @@ class Tv4play(): sys.exit(2) manifest = "%s?hdcore=2.8.0&g=hejsan" % test["path"] download_hds(options, manifest, swf) + if options.subtitle and subtitle: + subtitle_smi(options, subtitle) class Svtplay(): def handle(self, url):
tv4play: support for subtitle.
spaam_svtplay-dl
train
py
2857276b186e5b85f0a6440845af04d9da7391e1
diff --git a/salt/minion.py b/salt/minion.py index <HASH>..<HASH> 100644 --- a/salt/minion.py +++ b/salt/minion.py @@ -325,7 +325,8 @@ class Minion(object): payload = {'enc': 'aes'} if ret_cmd == '_syndic_return': load = {'cmd': ret_cmd, - 'jid': ret['jid']} + 'jid': ret['jid'], + 'id': self.opts['id']} load['return'] = {} for key, value in ret.items(): if key == 'jid' or key == 'fun':
Add passign master's id to syndic return
saltstack_salt
train
py
248ec566f778e7d44b6607b68984bfbb87787e95
diff --git a/lib/flapjack/gateways/api.rb b/lib/flapjack/gateways/api.rb index <HASH>..<HASH> 100644 --- a/lib/flapjack/gateways/api.rb +++ b/lib/flapjack/gateways/api.rb @@ -104,7 +104,11 @@ module Flapjack end after do - logger.debug("Returning #{response.status} for #{request.request_method} #{request.path_info}#{request.query_string}") + if logger.debug? + logger.debug("Returning #{response.status} for #{request.request_method} #{request.path_info}#{request.query_string}, body: [#{response.body.join(', ')}]") + elsif logger.info? + logger.info("Returning #{response.status} for #{request.request_method} #{request.path_info}#{request.query_string}") + end end register Flapjack::Gateways::API::EntityMethods
log reponse body at debug level
flapjack_flapjack
train
rb
7e5f66f026caab3d3d5a4e87ddaac139860c3b02
diff --git a/lib/cache.js b/lib/cache.js index <HASH>..<HASH> 100644 --- a/lib/cache.js +++ b/lib/cache.js @@ -47,11 +47,25 @@ var DCp = DiskCache.prototype; DCp.setDefaultP = util.cachedMethod(function(key, toStringP, fromStringP) { return this.cacheDirP.then(function(cacheDir) { var file = path.join(cacheDir, key + ".js"); + return util.openExclusiveP(file).then(function(fd) { var stringP = Q.resolve(toStringP()); + return stringP.then(function(string) { return util.writeFdP(fd, string); + + }, function(err) { + // Note that util.writeFdP closes the file descriptor + // under normal circumstances. + fs.closeSync(fd); + + // If stringP resolved to an error, remove the cache file + // so we don't reuse it blindly in the future. + return util.unlinkP(file).then(function() { + throw err; + }); }); + }, function(err) { assert.strictEqual(err.code, "EEXIST"); // TODO // TODO Deal with inter-process race condition!
Make sure to unlink cache files that fail to build successfully.
facebookarchive_commoner
train
js
14ae64c61cafed3266adccf70df26a734ae9cec8
diff --git a/google-cloud-redis/lib/google/cloud/redis/v1/cloud_redis_pb.rb b/google-cloud-redis/lib/google/cloud/redis/v1/cloud_redis_pb.rb index <HASH>..<HASH> 100644 --- a/google-cloud-redis/lib/google/cloud/redis/v1/cloud_redis_pb.rb +++ b/google-cloud-redis/lib/google/cloud/redis/v1/cloud_redis_pb.rb @@ -5,7 +5,6 @@ require 'google/protobuf' require 'google/api/annotations_pb' -require 'google/api/resource_pb' require 'google/longrunning/operations_pb' require 'google/protobuf/field_mask_pb' require 'google/protobuf/timestamp_pb'
Remove resource_pb require (#<I>) Temporarily remove the require to get the build to pass. Awaiting a new googleapis-common-protos release for a proper fix .
googleapis_google-cloud-ruby
train
rb
f3e7cf6128d0ec6ff0c83eb986d8a808156870a8
diff --git a/ghost/admin/app/components/gh-member-settings-form-cp.js b/ghost/admin/app/components/gh-member-settings-form-cp.js index <HASH>..<HASH> 100644 --- a/ghost/admin/app/components/gh-member-settings-form-cp.js +++ b/ghost/admin/app/components/gh-member-settings-form-cp.js @@ -80,8 +80,7 @@ export default class extends Component { } get isCreatingComplimentary() { - const {comped} = this.member.changedAttributes() || {}; - return comped && comped[0] === false && comped[1] === true && this.args.isSaveRunning; + return this.args.isSaveRunning; } @action
Fixed loading indicator on comped subscription no refs
TryGhost_Ghost
train
js
557905d216290ca5e57436e85d0605389f755180
diff --git a/Classes/Cundd/Noshi/Utilities/ObjectUtility.php b/Classes/Cundd/Noshi/Utilities/ObjectUtility.php index <HASH>..<HASH> 100644 --- a/Classes/Cundd/Noshi/Utilities/ObjectUtility.php +++ b/Classes/Cundd/Noshi/Utilities/ObjectUtility.php @@ -20,6 +20,7 @@ class ObjectUtility { * @param string $keyPath Key path of the property to fetch * @param object|array $object Source to fetch the data from * @param mixed $default An optional default value to return if the path could not be resolved. If a callback is passed, it's return value is used + * @throws \LogicException if the given key path is no string * @return mixed */ static public function valueForKeyPathOfObject($keyPath, $object, $default = NULL) { @@ -28,6 +29,8 @@ class ObjectUtility { $keyPathPartsLength = count($keyPathParts); $currentValue = $object; + if (!is_string($keyPath)) throw new \LogicException('Given key path is not of type string (maybe arguments are ordered incorrect)', 1395484136); + for ($i = 0; $i < $keyPathPartsLength; $i++) { $key = $keyPathParts[$i]; $accessorMethod = 'get' . ucfirst($key);
Added a check if the given key path is a string
cundd_noshi
train
php
fde50c435bdefd4bb6fa9f5258a7f8b55326fdb8
diff --git a/lib/Models/Cesium.js b/lib/Models/Cesium.js index <HASH>..<HASH> 100644 --- a/lib/Models/Cesium.js +++ b/lib/Models/Cesium.js @@ -813,7 +813,7 @@ Cesium.prototype.pickFromScreenPosition = function(screenPosition) { Cesium.prototype.pickVectorFeatures = function(screenPosition) { // Pick vector features var vectorFeatures = []; - var pickedList = this.scene.drillPick(screenPosition, 100); + var pickedList = this.scene.drillPick(screenPosition, 101); for (var i = 0; i < pickedList.length; ++i) { var picked = pickedList[i]; var id = picked.id;
Allow <I> picked features. So that the "first <I> are shown" feature works.
TerriaJS_terriajs
train
js
e491c7449fd7637cf2f1480832bd555011fbf7b8
diff --git a/qgrid/qgridjs/qgrid.widget.js b/qgrid/qgridjs/qgrid.widget.js index <HASH>..<HASH> 100644 --- a/qgrid/qgridjs/qgrid.widget.js +++ b/qgrid/qgridjs/qgrid.widget.js @@ -1,4 +1,4 @@ -if (IPython.version[0] === '4' && parseInt(IPython.version[2]) >= 2) { +if (parseInt(IPython.version[0]) >= 5 || (IPython.version[0] === '4' && parseInt(IPython.version[2]) >= 2)) { var path = 'jupyter-js-widgets'; } else { var path = 'widgets/js/widget';
Fix version check to be compatible with IPython <I>
quantopian_qgrid
train
js
aafc24a96669d51cb5e3ac9968b5690e8ed73d78
diff --git a/smack-im/src/main/java/org/jivesoftware/smack/roster/Roster.java b/smack-im/src/main/java/org/jivesoftware/smack/roster/Roster.java index <HASH>..<HASH> 100644 --- a/smack-im/src/main/java/org/jivesoftware/smack/roster/Roster.java +++ b/smack-im/src/main/java/org/jivesoftware/smack/roster/Roster.java @@ -469,11 +469,14 @@ public final class Roster extends Manager { @Override public void processException(Exception exception) { rosterState = RosterState.uninitialized; - Level logLevel; + Level logLevel = Level.SEVERE; if (exception instanceof NotConnectedException) { logLevel = Level.FINE; - } else { - logLevel = Level.SEVERE; + } else if (exception instanceof XMPPErrorException) { + Condition condition = ((XMPPErrorException) exception).getStanzaError().getCondition(); + if (condition == Condition.feature_not_implemented || condition == Condition.service_unavailable) { + logLevel = Level.FINE; + } } LOGGER.log(logLevel, "Exception reloading roster", exception); for (RosterLoadedListener listener : rosterLoadedListeners) {
Conditionally reduce severity of roster reload error logging If the roster feature is not supported by the server, there's no need to log this at SEVERE log level.
igniterealtime_Smack
train
java
05dad9b1d30a8ff1e8e4a06bc5eaf0b19dab43e2
diff --git a/lib/puppet/defaults.rb b/lib/puppet/defaults.rb index <HASH>..<HASH> 100644 --- a/lib/puppet/defaults.rb +++ b/lib/puppet/defaults.rb @@ -486,10 +486,6 @@ module Puppet :default => "stomp", :desc => "Which type of queue to use for asynchronous processing.", }, - :queue_type => { - :default => "stomp", - :desc => "Which type of queue to use for asynchronous processing.", - }, :queue_source => { :default => "stomp://localhost:61613/", :desc => "Which type of queue to use for asynchronous processing. If your stomp server requires
(MAINT) Fix duplicate key which ruby <I> complains about
puppetlabs_puppet
train
rb
eaf23ad6a0f1fd028b7d6d5fb1ba2c5b56d31013
diff --git a/src/DependencyInjection/Configuration.php b/src/DependencyInjection/Configuration.php index <HASH>..<HASH> 100644 --- a/src/DependencyInjection/Configuration.php +++ b/src/DependencyInjection/Configuration.php @@ -19,8 +19,14 @@ class Configuration implements ConfigurationInterface */ public function getConfigTreeBuilder() { - $treeBuilder = new TreeBuilder(); - $rootNode = $treeBuilder->root('knp_menu'); + $treeBuilder = new TreeBuilder('knp_menu'); + + // Keep compatibility with symfony/config < 4.2 + if (method_exists($treeBuilder, 'getRootNode')) { + $rootNode = $treeBuilder->getRootNode(); + } else { + $rootNode = $treeBuilder->root('knp_menu'); + } $rootNode ->children()
Don't use the deprecated interface with Symfony <I>
KnpLabs_KnpMenuBundle
train
php
3af275b01da6aa43b32fcdbf21f84fe1388dfc0a
diff --git a/opal/browser/css/definition.rb b/opal/browser/css/definition.rb index <HASH>..<HASH> 100644 --- a/opal/browser/css/definition.rb +++ b/opal/browser/css/definition.rb @@ -47,8 +47,12 @@ class Definition end end - def border(options) - if Hash === options + def border(*args) + if Hash === args.first + if args.length == 1 + options = args.first + end + options.each {|name, value| case name when :radius @@ -76,11 +80,11 @@ class Definition end else - style "border-#{name}", Array(value).join(' ') + style "border-#{name}", value end } else - style :border, Array(options).join(' ') + style :border, args end end @@ -132,10 +136,10 @@ class Definition if Hash === argument argument.each {|sub, value| - style "#{name}-#{sub}", Array(value).join(' ') + style "#{name}-#{sub}", value } else - style name, Array(argument).join(' ') + style name, argument end else style name, args.join(' ') @@ -148,6 +152,10 @@ class Definition private def style(name, value = nil, important = @important) + if Array === value + value = value.join ' ' + end + if Style === name @style << name else
css/definition: fix up array setting
opal_opal-browser
train
rb
193db6ba568538b83e577dc96c7438f40530a495
diff --git a/includes/class-freemius.php b/includes/class-freemius.php index <HASH>..<HASH> 100755 --- a/includes/class-freemius.php +++ b/includes/class-freemius.php @@ -7322,7 +7322,7 @@ * @return FS_Plugin_License */ private function get_active_child_addon_license() { - $result = $this->get_parent_instance()->get_current_or_network_user_api_scope()->get( "/plugins/{$this->get_id()}/licenses.json?latest_active_child=true", true ); + $result = $this->get_parent_instance()->get_current_or_network_user_api_scope()->get( "/plugins/{$this->get_id()}/parent_licenses.json", true ); if ( ! $this->is_api_result_object( $result, 'licenses' ) ||
[bundle] [add-on] [license] [api] [refactor]
Freemius_wordpress-sdk
train
php
a0fd216fcabccd4f4e5b14b91294b658a1e0da1b
diff --git a/test/use.js b/test/use.js index <HASH>..<HASH> 100644 --- a/test/use.js +++ b/test/use.js @@ -25,9 +25,10 @@ describe('dualproto', function () { }; }); var domain = api(); - domain.mount(['hey'], function (ctxt) { + domain.mount(['hey'], function (body, ctxt) { ctxt.cutout(); }); + domain.send(['hey']); }); });
Ensure adapted Message is used.
plediii_dual-protocol
train
js
19ad64adda34bebfccffbaadb01733e5bfb9dbba
diff --git a/discord/ext/tasks/__init__.py b/discord/ext/tasks/__init__.py index <HASH>..<HASH> 100644 --- a/discord/ext/tasks/__init__.py +++ b/discord/ext/tasks/__init__.py @@ -584,12 +584,13 @@ class Loop(Generic[LF]): time_now = ( now if now is not MISSING else datetime.datetime.now(datetime.timezone.utc).replace(microsecond=0) ).timetz() + idx = -1 for idx, time in enumerate(self._time): if time >= time_now: self._time_index = idx break else: - self._time_index = 0 + self._time_index = idx + 1 def _get_time_parameter( self,
[tasks] Fix initial loop execution running prematurely
Rapptz_discord.py
train
py
0bf2a50e291f53d8b2903c415b260d797eae4907
diff --git a/Helper/Db.php b/Helper/Db.php index <HASH>..<HASH> 100644 --- a/Helper/Db.php +++ b/Helper/Db.php @@ -46,4 +46,9 @@ class Db return " LIMIT $offset, $limit "; } + + public static function getLastInsertId() + { + return self::getInstance()->lastInsertId(); + } } diff --git a/Helper/Traits/Db.php b/Helper/Traits/Db.php index <HASH>..<HASH> 100644 --- a/Helper/Traits/Db.php +++ b/Helper/Traits/Db.php @@ -6,18 +6,23 @@ use \Helper\Db as DbHelper; trait Db { - private function dbInstance() + private static function dbInstance() { return DbHelper::getInstance(); } - private function execQuery($query, array $parameters = []) + private static function execQuery($query, array $parameters = []) { return DbHelper::execQuery($query, $parameters); } - private function getSqlLimitByLimits($limit, $offset) + private static function getSqlLimitByLimits($limit, $offset) { return DbHelper::getLimitQuery($limit, $offset); } + + private static function getLastInsertId() + { + return DbHelper::getLastInsertId(); + } } \ No newline at end of file
Add short way for LastInsertId and make Db helper's method static.
APIJet_APIJet
train
php,php
09f03c2381b40dac79123e681c6766629d1ee1ef
diff --git a/Vps/Validate/Hostname.php b/Vps/Validate/Hostname.php index <HASH>..<HASH> 100644 --- a/Vps/Validate/Hostname.php +++ b/Vps/Validate/Hostname.php @@ -1,7 +1,7 @@ <?php class Vps_Validate_Hostname extends Zend_Validate_Hostname { - public function __construct($allow = self::ALLOW_DNS, $validateIdn = true, $validateTld = true, Zend_Validate_Ip $ipValidator = null) + public function __construct($allow = self::ALLOW_DNS, $validateIdn = true, $validateTld = false, Zend_Validate_Ip $ipValidator = null) { $this->_messageTemplates[self::IP_ADDRESS_NOT_ALLOWED] = trlVps("'%value%' appears to be an IP address, but IP addresses are not allowed"); $this->_messageTemplates[self::UNKNOWN_TLD] = trlVps("'%value%' appears to be a DNS hostname but cannot match TLD against known list");
Switch off validating TLD in e-mail adress validation Due to increasing list of allowed tlds
koala-framework_koala-framework
train
php
b6517d226a40d0910ac9edd3c3475847322a1d83
diff --git a/src/bookboon.php b/src/bookboon.php index <HASH>..<HASH> 100644 --- a/src/bookboon.php +++ b/src/bookboon.php @@ -28,7 +28,7 @@ class Bookboon { private $authenticated = array(); private $headers = array(); private $url = "bookboon.com/api"; - private $cache_class_name= "Bookboon_Memcached"; + private $cache_class_name= ""; private $cache = null; public static $CURL_OPTS = array(
Disable caching by default for shared solutions
bookboon_api-php
train
php
1fee54906327f154f1e8d2a23efdbf1856031163
diff --git a/lib/Cake/Network/Email/SmtpTransport.php b/lib/Cake/Network/Email/SmtpTransport.php index <HASH>..<HASH> 100644 --- a/lib/Cake/Network/Email/SmtpTransport.php +++ b/lib/Cake/Network/Email/SmtpTransport.php @@ -161,7 +161,6 @@ class SmtpTransport extends AbstractTransport { $headers = $this->_cakeEmail->getHeaders(array_fill_keys(array('from', 'sender', 'replyTo', 'readReceipt', 'returnPath', 'to', 'cc', 'bcc', 'subject'), true)); $headers = $this->_headersToString($headers); $message = implode("\r\n", $this->_cakeEmail->message()); - pr($headers . "\r\n\r\n" . $message . "\r\n\r\n\r\n."); $this->_smtpSend($headers . "\r\n\r\n" . $message . "\r\n\r\n\r\n."); }
Ooops, removed debug call.
cakephp_cakephp
train
php
64795c5f4588b218e9573b8648d258db3dd1a6dd
diff --git a/skorch/tests/test_net.py b/skorch/tests/test_net.py index <HASH>..<HASH> 100644 --- a/skorch/tests/test_net.py +++ b/skorch/tests/test_net.py @@ -1092,6 +1092,14 @@ class TestNeuralNet: assert y_proba.min() >= 0 assert y_proba.max() <= 1 + def test_set_params_with_unknown_key_raises(self, net): + with pytest.raises(ValueError) as exc: + net.set_params(foo=123) + + # TODO: check error message more precisely, depending on what + # the intended message shouldb e from sklearn side + assert exc.value.args[0].startswith('Invalid parameter foo for') + class MyRegressor(nn.Module): """Simple regression module.
Fix failing test after sklearn update. sklearn <I> changed error message when calling set_params with wrong key.
skorch-dev_skorch
train
py
ad550b7224506f1b0bcec4d7d0223097a1303311
diff --git a/README.md b/README.md index <HASH>..<HASH> 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ Example This is a simple POP3 login and listing. - var sys = require('sys') + var util = require('util') , StreamHandler = require('stream-handler') ; diff --git a/example.js b/example.js index <HASH>..<HASH> 100644 --- a/example.js +++ b/example.js @@ -1,4 +1,4 @@ - var sys = require('sys') + var util = require('util') , StreamHandler = require('stream-handler') ; diff --git a/node_stream_handler.js b/node_stream_handler.js index <HASH>..<HASH> 100644 --- a/node_stream_handler.js +++ b/node_stream_handler.js @@ -1,5 +1,5 @@ var events = require('events') - , sys = require('sys') + , util = require('util') , net = require('net') ; @@ -49,7 +49,7 @@ function StreamHandler(host, port, delimiter) { } }); } -sys.inherits(StreamHandler, events.EventEmitter); +util.inherits(StreamHandler, events.EventEmitter); StreamHandler.prototype.write = function(data) { this.conn.write(data);
[fix] Changed require('sys') to require('util') for compatibility with node <I>
jrgns_node_stream_handler
train
md,js,js
2a0e3f68f88a73558db8aaa931937e80242726f4
diff --git a/ClassCollectionLoader.php b/ClassCollectionLoader.php index <HASH>..<HASH> 100644 --- a/ClassCollectionLoader.php +++ b/ClassCollectionLoader.php @@ -56,7 +56,7 @@ class ClassCollectionLoader // auto-reload $reload = false; if ($autoReload) { - $metadata = $cacheDir.'/'.$name.'.meta'; + $metadata = $cacheDir.'/'.$name.$extension.'.meta'; if (!file_exists($metadata) || !file_exists($cache)) { $reload = true; } else {
[ClassLoader] made a small change to be consistent with the previous change
symfony_class-loader
train
php
0cc27d46be0d98650cda517e948e47a5867508c4
diff --git a/app/components/marty/auth_app.rb b/app/components/marty/auth_app.rb index <HASH>..<HASH> 100644 --- a/app/components/marty/auth_app.rb +++ b/app/components/marty/auth_app.rb @@ -14,6 +14,7 @@ class Marty::AuthApp < Marty::SimpleApp if !user.nil? menu << "->" << { text: user.name, + tooltip: 'Current user', menu: user_menu, name: "sign_out", }
minor: added one tooltip to signout menu
arman000_marty
train
rb
ba0809de9fadcbf6722bad85a50adde86fc31ddb
diff --git a/corelib/hash.rb b/corelib/hash.rb index <HASH>..<HASH> 100644 --- a/corelib/hash.rb +++ b/corelib/hash.rb @@ -181,8 +181,11 @@ class Hash def clone %x{ - var result = $hash(), - map = #{self}.map, + var result = new self._klass._alloc(); + + result.map = {}; result.keys = []; + + var map = #{self}.map, map2 = result.map, keys2 = result.keys;
Hash#clone should return subclasses
opal_opal
train
rb
f35019fe4504344a6b74437d0da7e5e72f5863f2
diff --git a/src/Illuminate/Database/Schema/Grammars/SqlServerGrammar.php b/src/Illuminate/Database/Schema/Grammars/SqlServerGrammar.php index <HASH>..<HASH> 100755 --- a/src/Illuminate/Database/Schema/Grammars/SqlServerGrammar.php +++ b/src/Illuminate/Database/Schema/Grammars/SqlServerGrammar.php @@ -149,7 +149,7 @@ class SqlServerGrammar extends Grammar */ public function compileDropIfExists(Blueprint $blueprint, Fluent $command) { - return 'if exists (select * from INFORMATION_SCHEMA.TABLES where TABLE_NAME = \''.$blueprint->getTable().'\') drop table '.$blueprint->getTable(); + return 'if exists (select * from INFORMATION_SCHEMA.TABLES where TABLE_NAME = \''.$blueprint->getTable().'\') drop table ['.$blueprint->getTable().']'; } /**
Fix sqlserver grammar (#<I>) Added square brackets to the table name. This fixes issues where the table name is equal to a keyword, like user.
laravel_framework
train
php
cd51bfc031eb9163fd6c85bb3d4ec23476bb2090
diff --git a/paramiko/client.py b/paramiko/client.py index <HASH>..<HASH> 100644 --- a/paramiko/client.py +++ b/paramiko/client.py @@ -349,7 +349,7 @@ class SSHClient (object): self._agent.close() self._agent = None - def exec_command(self, command, bufsize=-1, timeout=None): + def exec_command(self, command, bufsize=-1, timeout=None, get_pty=False): """ Execute a command on the SSH server. A new L{Channel} is opened and the requested command is executed. The command's input and output @@ -368,6 +368,8 @@ class SSHClient (object): @raise SSHException: if the server fails to execute the command """ chan = self._transport.open_session() + if(get_pty): + chan.get_pty() chan.settimeout(timeout) chan.exec_command(command) stdin = chan.makefile('wb', bufsize)
Add support for get_pty to SSHClient.exec_command()
paramiko_paramiko
train
py
1a28fcf5911d9b1778246bea109e6c804a6618f2
diff --git a/smartfile/__init__.py b/smartfile/__init__.py index <HASH>..<HASH> 100644 --- a/smartfile/__init__.py +++ b/smartfile/__init__.py @@ -35,6 +35,10 @@ class _BaseAPI(object): # Generate list of path components from URI template and provided # arguments. 'None' in the template is replaced with a path if there # is one provided by the caller. + # + # NOTE: uri_iter raises StopIteration if it runs out of elements. + # This is caught by the generator which stops before all the elements + # in self._api_url are used. uri_iter = iter(uri_args) paths = (next(uri_iter) if x is None else x for x in self._api_uri)
Add note on how part of the URL generation works
smartfile_client-python
train
py
6b3174fb51eb1c3411820e972263c721b8faf787
diff --git a/irc/modes.py b/irc/modes.py index <HASH>..<HASH> 100644 --- a/irc/modes.py +++ b/irc/modes.py @@ -54,7 +54,7 @@ def _parse_modes(mode_string, unary_modes=""): ... len = random.randint(min_len, max_len) ... chars_to_choose = [_py2_compat.chr(x) for x in range(0,1024)] ... chars = (random.choice(chars_to_choose) for x in range(len)) - ... return u''.join(chars) + ... return ''.join(chars) >>> def random_texts(min_len = 3, max_len = 80): ... while True: ... yield random_text(min_len, max_len)
Removed another unicode literal, restoring Python <I> compatibility in tests
jaraco_irc
train
py
45cc4a3e6306ef16126a32ecda016f530cbaefde
diff --git a/public/js/editors/editors.js b/public/js/editors/editors.js index <HASH>..<HASH> 100644 --- a/public/js/editors/editors.js +++ b/public/js/editors/editors.js @@ -180,7 +180,7 @@ panels.restore = function () { } else { // load from personal settings - toopen = jsbin.settings.panels; + toopen = jsbin.mobile ? [jsbin.settings.panels[0]] : jsbin.settings.panels; } }
fix: open first valid panel on mobile Originally it was tryingt open all panels which always included the output, and since in mobile we only show one panel at a time, output was last and would close all other panels.
jsbin_jsbin
train
js
ed81ef27febf72508727e30ee8f89c56ab0491b5
diff --git a/lib/you_shall_not_pass/version.rb b/lib/you_shall_not_pass/version.rb index <HASH>..<HASH> 100644 --- a/lib/you_shall_not_pass/version.rb +++ b/lib/you_shall_not_pass/version.rb @@ -1,3 +1,3 @@ module YouShallNotPass - VERSION = "0.2.0" + VERSION = "0.2.1" end
Releasing version <I>
iachettifederico_you_shall_not_pass
train
rb
b251d3ccd5cecfc645afbacc3598ffaaf9c91eff
diff --git a/smtLayer/vmUtils.py b/smtLayer/vmUtils.py index <HASH>..<HASH> 100644 --- a/smtLayer/vmUtils.py +++ b/smtLayer/vmUtils.py @@ -520,8 +520,26 @@ def installFS(rh, vaddr, mode, fileSystem, diskType): strCmd = ' '.join(cmd) rh.printSysLog("Invoking: " + strCmd) try: - out = subprocess.check_output(cmd, - stderr=subprocess.STDOUT, close_fds=True) + # Sometimes the device is not ready: sleep and retry + try_num = 0 + for sleep_secs in [0.1, 0.2, 0.3, 0.5, 1, 2, -1]: + try_num += 1 + try: + out = subprocess.check_output(cmd, + stderr=subprocess.STDOUT, close_fds=True) + rh.printSysLog("Run `%s` successfully." % strCmd) + break + except CalledProcessError as e: + if sleep_secs > 0: + rh.printSysLog("Num %d try `%s` failed (" + "retry after %s seconds): " + "rc=%d msg=%s" % ( + try_num, strCmd, sleep_secs, + e.returncode, e.output)) + time.sleep(sleep_secs) + else: + raise + if isinstance(out, bytes): out = bytes.decode(out) rh.printLn("N", "File system: " + fileSystem +
Add retry for `mkfs` when install fs on vm's dasd This is related to: <URL>
mfcloud_python-zvm-sdk
train
py
9aa21ed8271a737bfe3d92cd59d401dcc404b9bb
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -32,7 +32,7 @@ setup( ], zip_safe=True, classifiers=[ - 'Development Status :: 4 - Alpha', + 'Development Status :: 3 - Alpha', 'Intended Audience :: Developers', 'Programming Language :: Python', 'Programming Language :: Python :: 2',
Boilerplate for initial release.
bopen_elevation
train
py
79367ee7955c5ea4b267a11f3888ec7451eeae6b
diff --git a/src/Data/ImmutableRecordLogic.php b/src/Data/ImmutableRecordLogic.php index <HASH>..<HASH> 100644 --- a/src/Data/ImmutableRecordLogic.php +++ b/src/Data/ImmutableRecordLogic.php @@ -96,14 +96,14 @@ trait ImmutableRecordLogic case 'float': case 'bool': case 'array': - $nativeData[$key] = $this->{$key}; + $nativeData[$key] = $this->{$key}(); break; default: - if($isNullable && $this->{$key} === null) { + if($isNullable && $this->{$key}() === null) { $nativeData[$key] = null; continue; } - $nativeData[$key] = $this->voTypeToNative($this->{$key}, $key, $type); + $nativeData[$key] = $this->voTypeToNative($this->{$key}(), $key, $type); } }
Use getters in ImmutableRecordLogic::toArray
proophsoftware_event-machine
train
php
bca0d4ae45ba205653d9276f4fc31e21fd1e24b8
diff --git a/eth_account/datastructures.py b/eth_account/datastructures.py index <HASH>..<HASH> 100644 --- a/eth_account/datastructures.py +++ b/eth_account/datastructures.py @@ -15,3 +15,14 @@ class AttributeDict(AttrDict): 'This data is immutable -- create a copy instead of modifying. ' 'For example, AttributeDict(old, replace_key=replace_val).' ) + + def _repr_pretty_(self, builder, cycle): + """ + Custom pretty output for the IPython console + """ + builder.text(self.__class__.__name__ + "(") + if cycle: + builder.text("<cycle>") + else: + builder.pretty(self.__dict__) + builder.text(")")
prettier repr in IPython
ethereum_eth-account
train
py
b35db13c2bcc5d77003e76eab325288b90f2dd29
diff --git a/lib/transpec/cli.rb b/lib/transpec/cli.rb index <HASH>..<HASH> 100644 --- a/lib/transpec/cli.rb +++ b/lib/transpec/cli.rb @@ -26,8 +26,13 @@ module Transpec end def run(args) - paths = OptionParser.new(@configuration).parse(args) - fail_if_should_not_continue! + begin + paths = OptionParser.new(@configuration).parse(args) + fail_if_should_not_continue! + rescue => error + warn error.message + return false + end process(paths) @@ -35,9 +40,6 @@ module Transpec generate_commit_message if @configuration.generate_commit_message? true - rescue => error - warn error.message - false end def process(paths) diff --git a/spec/transpec/cli_spec.rb b/spec/transpec/cli_spec.rb index <HASH>..<HASH> 100644 --- a/spec/transpec/cli_spec.rb +++ b/spec/transpec/cli_spec.rb @@ -127,13 +127,8 @@ module Transpec context 'when any other error is raised while running' do let(:args) { ['non-existent-file'] } - it 'return false' do - should be_false - end - - it 'prints message of the exception' do - cli.should_receive(:warn).with(/No such file or directory/) - cli.run(args) + it 'does not catch the error' do + -> { cli.run(args) }.should raise_error end end
Avoid catching general errors in CLI
yujinakayama_transpec
train
rb,rb
19d99fc9e7dfb9bbd5427cb439668ff618f67cb7
diff --git a/spacy/about.py b/spacy/about.py index <HASH>..<HASH> 100644 --- a/spacy/about.py +++ b/spacy/about.py @@ -4,7 +4,7 @@ # fmt: off __title__ = "spacy" -__version__ = "2.2.0.dev6" +__version__ = "2.2.0.dev7" __summary__ = "Industrial-strength Natural Language Processing (NLP) with Python and Cython" __uri__ = "https://spacy.io" __author__ = "Explosion AI"
Set version to <I>.dev7
explosion_spaCy
train
py
2dd06cadfd6a7ca164f9391b969231e39bb05ba8
diff --git a/commands/filter.py b/commands/filter.py index <HASH>..<HASH> 100644 --- a/commands/filter.py +++ b/commands/filter.py @@ -46,6 +46,9 @@ def cmd(send, msg, args): send("Nope, not gonna do it!") elif msg.startswith('chain'): if args['is_admin'](args['nick']): + if args['handler'].outputfilter[0].__name__ == '<lambda>': + send("Must have a filter set in order to chain.") + return next_filter = msg.split()[1] if next_filter in textutils.output_filters.keys(): args['handler'].outputfilter.append(textutils.output_filters[next_filter])
Disallow !filter chain without a filter set. Fixes #<I>.
tjcsl_cslbot
train
py
8b740530dbc66573171d70bbf8f892bf8e4d318f
diff --git a/core/src/main/java/hudson/model/UpdateCenter.java b/core/src/main/java/hudson/model/UpdateCenter.java index <HASH>..<HASH> 100644 --- a/core/src/main/java/hudson/model/UpdateCenter.java +++ b/core/src/main/java/hudson/model/UpdateCenter.java @@ -39,6 +39,7 @@ import hudson.lifecycle.RestartNotSupportedException; import hudson.model.UpdateSite.Data; import hudson.model.UpdateSite.Plugin; import hudson.model.listeners.SaveableListener; +import hudson.remoting.AtmostOneThreadExecutor; import hudson.security.ACL; import hudson.util.DaemonThreadFactory; import hudson.util.FormValidation; @@ -129,7 +130,7 @@ public class UpdateCenter extends AbstractModelObject implements Saveable, OnMas * {@link ExecutorService} that performs installation. * @since 1.501 */ - private final ExecutorService installerService = Executors.newSingleThreadExecutor( + private final ExecutorService installerService = new AtmostOneThreadExecutor( new DaemonThreadFactory(new ThreadFactory() { public Thread newThread(Runnable r) { Thread t = new Thread(r);
Reduce the # of idle threads.
jenkinsci_jenkins
train
java
00ed75ceb8d6ccfd8036a21e15ab5426b7459a4f
diff --git a/lib/commit-message.js b/lib/commit-message.js index <HASH>..<HASH> 100644 --- a/lib/commit-message.js +++ b/lib/commit-message.js @@ -27,7 +27,7 @@ var config = { function CommitMessage(message) { this._errors = []; - var cfg = config; + var cfg = this.config; var log = this._log.bind(this); if (!cfg.pattern[0].test(message)) {
Use config correctly, from the prototype
clns_node-commit-msg
train
js
1263887bcd8b585574c2bb3a556e3ef648dd7eb2
diff --git a/sinon-spy-react.js b/sinon-spy-react.js index <HASH>..<HASH> 100644 --- a/sinon-spy-react.js +++ b/sinon-spy-react.js @@ -17,7 +17,7 @@ function spyOnReactClass(reactClass, methodName) { function reactClassPrototype(reactClass) { var ctor = reactClass.prototype && reactClass.prototype.constructor; - if (typeof ctor === 'undefinied') + if (typeof ctor === 'undefined') throw new Error('A component constructor could not be found for this class. Are you sure you passed in a React component?'); return ctor.prototype;
Corrected check for constructor existence
levrik_sinon-spy-react
train
js
6502bdaf2f0b2cd4f7f6b95e857028bb66e9244f
diff --git a/mythril/analysis/modules/ether_thief.py b/mythril/analysis/modules/ether_thief.py index <HASH>..<HASH> 100644 --- a/mythril/analysis/modules/ether_thief.py +++ b/mythril/analysis/modules/ether_thief.py @@ -67,7 +67,6 @@ class EtherThief(DetectionModule): :return: """ instruction = state.get_current_instruction() - node = state.node if instruction["opcode"] != "CALL": return [] @@ -80,7 +79,7 @@ class EtherThief(DetectionModule): eth_sent_total = symbol_factory.BitVecVal(0, 256) - constraints = copy(node.constraints) + constraints = copy(state.mstate.constraints) for tx in state.world_state.transaction_sequence: if tx.caller == 0xDEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEF: @@ -101,8 +100,8 @@ class EtherThief(DetectionModule): debug = json.dumps(transaction_sequence, indent=4) issue = Issue( - contract=node.contract_name, - function_name=node.function_name, + contract=state.environment.active_account.contract_name, + function_name=state.environment.active_function_name, address=instruction["address"], swc_id=UNPROTECTED_ETHER_WITHDRAWAL, title="Unprotected Ether Withdrawal",
remove dependence on cfg & nodes from ether thief
ConsenSys_mythril-classic
train
py
4ef1e42244937e36edcc314f041f2054186c2e07
diff --git a/Eloquent/Model.php b/Eloquent/Model.php index <HASH>..<HASH> 100755 --- a/Eloquent/Model.php +++ b/Eloquent/Model.php @@ -1405,7 +1405,7 @@ abstract class Model implements ArrayAccess, ArrayableInterface, JsonableInterfa { if (isset($this->table)) return $this->table; - return str_replace('\\', '', snake_case(str_plural(get_class($this)))); + return str_replace('\\', '', snake_case(str_plural(class_basename($this)))); } /**
Namespaces are now excluded from guessed model names.
illuminate_database
train
php
db0595ff93d8b4fc414dc682e9ba9a13055a2d52
diff --git a/src/wa_kat/connectors/aleph.py b/src/wa_kat/connectors/aleph.py index <HASH>..<HASH> 100755 --- a/src/wa_kat/connectors/aleph.py +++ b/src/wa_kat/connectors/aleph.py @@ -91,6 +91,18 @@ def by_issn(issn): if val } + # check whether there is alternative date in 008 + alt_creation_date = None + if additional_info["008"]: + # 131114c20139999xr-q||p|s||||||---a0eng-c -> 2013 + alt_creation_date = additional_info["008"][7:11] + + # 131114c20139999xr-q||p|s||||||---a0eng-c -> 9999 + end_date = additional_info["008"][11:15] + if end_date == "9999": + alt_creation_date += "-" # library convention is xxxx- + + # parse author author = Author.parse_author(marc) model = Model( @@ -124,9 +136,8 @@ def by_issn(issn): ), ", " ), - # publisher_tags=, creation_dates=_first_or_none( - marc.get("260c") + marc.get("260c", [alt_creation_date]) ), lang_tags=_first_or_none( marc.get("040b")
#<I>: Added better parsing of creation date.
WebarchivCZ_WA-KAT
train
py
8aac575ca547005963f4667a220f9a0df9b6d7af
diff --git a/core/AssetManager.php b/core/AssetManager.php index <HASH>..<HASH> 100644 --- a/core/AssetManager.php +++ b/core/AssetManager.php @@ -395,7 +395,7 @@ class Piwik_AssetManager // Tries to remove compressed version of the merged file. // See Piwik::serveStaticFile() for more info on static file compression - $compressedFileLocation = Piwik::COMPRESSED_FILE_LOCATION . $filename; + $compressedFileLocation = PIWIK_USER_PATH . Piwik::COMPRESSED_FILE_LOCATION . $filename; @unlink ( $compressedFileLocation . ".deflate"); @unlink ( $compressedFileLocation . ".gz"); @@ -430,7 +430,7 @@ class Piwik_AssetManager */ private static function getMergedFileDirectory () { - $mergedFileDirectory = self::getAbsoluteLocation(self::MERGED_FILE_DIR); + $mergedFileDirectory = PIWIK_USER_PATH . '/' . self::MERGED_FILE_DIR; if (!is_dir($mergedFileDirectory)) {
fixes #<I> - wasn't removing compressed assets on update; merged assets in tmp are relative to PIWIK_USER_PATH git-svn-id: <URL>
matomo-org_matomo
train
php
3247574756345ea6c1a0918c3d95bdd08054f246
diff --git a/src/app/actions/mslookup/searchspace.py b/src/app/actions/mslookup/searchspace.py index <HASH>..<HASH> 100644 --- a/src/app/actions/mslookup/searchspace.py +++ b/src/app/actions/mslookup/searchspace.py @@ -4,7 +4,7 @@ PROTEIN_STORE_CHUNK_SIZE = 100000 def create_searchspace_wholeproteins(lookup, fastafn, minpeplen): fasta = SeqIO.parse(fastafn, 'fasta') - prots = {prot.seq: prot.id for prot in fasta} + prots = {prot.seq.replace('L', 'I'): prot.id for prot in fasta} storeseqs = [] peptotal = 0 for protseq, prot_id in prots.items():
Do not forget to switch L to I when building DB
glormph_msstitch
train
py
5dde80800a24c610f42637355a9b64ccb50ff153
diff --git a/examples/pages/basic/index.js b/examples/pages/basic/index.js index <HASH>..<HASH> 100644 --- a/examples/pages/basic/index.js +++ b/examples/pages/basic/index.js @@ -49,7 +49,7 @@ class Examples extends Component { const Item = glamorous(Autocomplete.Item, { rootEl: 'div', - forwardProps: ['index', 'item', 'key'], + forwardProps: ['index', 'value', 'key'], })( { cursor: 'pointer', diff --git a/examples/pages/semantic-ui/index.js b/examples/pages/semantic-ui/index.js index <HASH>..<HASH> 100644 --- a/examples/pages/semantic-ui/index.js +++ b/examples/pages/semantic-ui/index.js @@ -28,7 +28,7 @@ function Examples() { const Item = glamorous(Autocomplete.Item, { rootEl: 'div', - forwardProps: ['index', 'item'], + forwardProps: ['index', 'value'], })( { position: 'relative',
docs(examples): update forwarded prop item -> value (#<I>)
downshift-js_downshift
train
js,js
99943f3db56e07337eaea513951b5e5d2b194a8c
diff --git a/src/tools/uavviewerjs/public/js/api_workers/pose3d_worker.js b/src/tools/uavviewerjs/public/js/api_workers/pose3d_worker.js index <HASH>..<HASH> 100644 --- a/src/tools/uavviewerjs/public/js/api_workers/pose3d_worker.js +++ b/src/tools/uavviewerjs/public/js/api_workers/pose3d_worker.js @@ -4,6 +4,10 @@ var global=self; // importing required files importScripts('../Ice.min.js'); +importScripts('../jderobot/datetime.js'); +importScripts('../jderobot/exceptions.js'); +importScripts('../jderobot/containers.js'); +importScripts('../jderobot/common.js'); importScripts('../jderobot/pose3d.js');
[issue #<I>] solved bug in pose3d of uavviwerjs
JdeRobot_base
train
js
77622b74042d5b56f1b6a6404833831dca1bea39
diff --git a/ofp/v0x01/controller2switch/port_stats_request.py b/ofp/v0x01/controller2switch/port_stats_request.py index <HASH>..<HASH> 100644 --- a/ofp/v0x01/controller2switch/port_stats_request.py +++ b/ofp/v0x01/controller2switch/port_stats_request.py @@ -0,0 +1,29 @@ +"""Information about physical ports is requested with OFPST_PORT""" + +# System imports + +# Third-party imports + +# Local source tree imports +from foundation import base +from foundation import basic_types + + +class PortStatsRequest(base.GenericStruct): + """ + Body for ofp_stats_request of type OFPST_PORT + + :param port_no -- OFPST_PORT message must request statistics either + for a single port (specified in port_no) or for + all ports (if port_no == OFPP_NONE). + :param pad -- + + """ + port_no = basic_types.UBInt16() + pad = basic_types.UBInt8Array(length=6) + + def __init__(self, port_no=None, pad=None): + + self.port_no = port_no + self.pad = pad +
Implements the Port Stats Requests message class - Issue #<I>
kytos_python-openflow
train
py
307f933ff283e431a17d0900b4ad997ce4a20727
diff --git a/src/Support/helpers.php b/src/Support/helpers.php index <HASH>..<HASH> 100644 --- a/src/Support/helpers.php +++ b/src/Support/helpers.php @@ -18,18 +18,6 @@ if (! function_exists('extract_title')) { } } -if (! function_exists('domain')) { - /** - * Return domain host. - * - * @return string - */ - function domain() - { - return parse_url(config('app.url'))['host']; - } -} - if (! function_exists('route_prefix')) { /** * Return route prefix.
Remove no longer used domain() global helper - This is now the responsibility of rinvex/laravel-tenants
rinvex_cortex-foundation
train
php
32269c0a24154c20b3789580eb2a9c0018ecf198
diff --git a/store/src/main/java/com/buschmais/jqassistant/core/store/impl/AbstractGraphStore.java b/store/src/main/java/com/buschmais/jqassistant/core/store/impl/AbstractGraphStore.java index <HASH>..<HASH> 100644 --- a/store/src/main/java/com/buschmais/jqassistant/core/store/impl/AbstractGraphStore.java +++ b/store/src/main/java/com/buschmais/jqassistant/core/store/impl/AbstractGraphStore.java @@ -27,7 +27,7 @@ import com.buschmais.xo.api.XOManagerFactory; public abstract class AbstractGraphStore implements Store { private static final Logger LOGGER = LoggerFactory.getLogger(AbstractGraphStore.class); - private static final int AUTOCOMMIT_THRESHOLD = 8192; + private static final int AUTOCOMMIT_THRESHOLD = 32678; private XOManagerFactory xoManagerFactory; private XOManager xoManager; private int created;
#<I> rework artifact resolution in maven plugins
buschmais_jqa-core-framework
train
java
a471cb8c093b44ac24cb085cdf5a64b1a2455393
diff --git a/lib/discordrb/webhooks/version.rb b/lib/discordrb/webhooks/version.rb index <HASH>..<HASH> 100644 --- a/lib/discordrb/webhooks/version.rb +++ b/lib/discordrb/webhooks/version.rb @@ -1,7 +1,9 @@ # frozen_string_literal: true # Webhook support for discordrb -module Discordrb::Webhooks - # The current version of discordrb-webhooks. - VERSION = '0.1.0'.freeze +module Discordrb + module Webhooks + # The current version of discordrb-webhooks. + VERSION = '0.1.0'.freeze + end end
:anchor: Declare the discordrb module separately in webhooks/version
meew0_discordrb
train
rb
68e38eb54e1cbf8e7fa76764adc48bcfbb8a6da9
diff --git a/src/main/java/org/killbill/billing/client/KillBillClient.java b/src/main/java/org/killbill/billing/client/KillBillClient.java index <HASH>..<HASH> 100644 --- a/src/main/java/org/killbill/billing/client/KillBillClient.java +++ b/src/main/java/org/killbill/billing/client/KillBillClient.java @@ -2,6 +2,7 @@ * Copyright 2010-2013 Ning, Inc. * Copyright 2014 Groupon, Inc * Copyright 2014 The Billing Project, LLC + * Copyright 2015 Cloudyle GmbH * * The Billing Project licenses this file to you under the Apache License, version 2.0 * (the "License"); you may not use this file except in compliance with the
Update KillBillClient.java
killbill_killbill-client-java
train
java
33e0ab8a68ebe6bbc776a8e2d758e3ec854d1818
diff --git a/src/main/java/com/buschmais/jqassistant/scm/cli/task/AnalyzeTask.java b/src/main/java/com/buschmais/jqassistant/scm/cli/task/AnalyzeTask.java index <HASH>..<HASH> 100644 --- a/src/main/java/com/buschmais/jqassistant/scm/cli/task/AnalyzeTask.java +++ b/src/main/java/com/buschmais/jqassistant/scm/cli/task/AnalyzeTask.java @@ -74,12 +74,9 @@ public class AnalyzeTask extends AbstractAnalyzeTask { try { final ReportHelper reportHelper = new ReportHelper(getLog()); final int conceptViolations = reportHelper.verifyConceptResults(severity, inMemoryReportWriter); - if (conceptViolations > 0) { - throw new CliRuleViolationException(conceptViolations + " concept(s) returned empty results!"); - } final int constraintViolations = reportHelper.verifyConstraintResults(severity, inMemoryReportWriter); - if (constraintViolations > 0) { - throw new CliRuleViolationException(constraintViolations + " constraint(s) violated!"); + if (conceptViolations > 0 || constraintViolations > 0) { + throw new CliRuleViolationException("Violations detected: " + conceptViolations + " concepts, " + constraintViolations + " constraints"); } } finally { store.commitTransaction();
#<I> verify override of rule severities
buschmais_jqa-commandline-tool
train
java
57ced886d4a56fc7d54e8a9a0cbe6044a8c05fb4
diff --git a/sbt-compiler-maven-plugin/src/main/java/com/google/code/sbt/compiler/plugin/SBTAddManagedSourcesMojo.java b/sbt-compiler-maven-plugin/src/main/java/com/google/code/sbt/compiler/plugin/SBTAddManagedSourcesMojo.java index <HASH>..<HASH> 100644 --- a/sbt-compiler-maven-plugin/src/main/java/com/google/code/sbt/compiler/plugin/SBTAddManagedSourcesMojo.java +++ b/sbt-compiler-maven-plugin/src/main/java/com/google/code/sbt/compiler/plugin/SBTAddManagedSourcesMojo.java @@ -28,7 +28,7 @@ import org.apache.maven.project.MavenProject; /** * Add managed source root, if it is not already added.<br><br> * Helper mojo.<br> - * Adds <code>${project.build.directory}/src_managed</code> is added to project's compile source roots + * Adds <code>${project.build.directory}/src_managed</code> as compile source root * even if it does not exist yet (it may be created later by source generators). * * @author <a href="mailto:gslowikowski@gmail.com">Grzegorz Slowikowski</a>
Slightly improved javadoc comment.
sbt-compiler-maven-plugin_sbt-compiler-maven-plugin
train
java
5a83914a262141e38e6eda5f6137323306a1b592
diff --git a/src/index.js b/src/index.js index <HASH>..<HASH> 100644 --- a/src/index.js +++ b/src/index.js @@ -1,5 +1,5 @@ //let baseURL = "http://svcs.ebay.com/services/search/FindingService/v1"; -let makeRequest = require('./request'); +let { makeRequest, base64Encode } = require('./request'); let urlObject = require('./buildURL'); function Ebay(options) { @@ -90,6 +90,20 @@ Ebay.prototype = { }, (error) => { console.log(error); }) + }, + + getItem: function (itemId) { + if (!itemId) throw new Error("Item Id is required"); + + + }, + + setAccessToken: function (token) { + this.options.access_token = token; + }, + + getAccessToken: function () { + } }; diff --git a/src/request.js b/src/request.js index <HASH>..<HASH> 100644 --- a/src/request.js +++ b/src/request.js @@ -17,4 +17,10 @@ let makeRequest = function makeRequest(url) { } -module.exports = makeRequest; \ No newline at end of file + +let base64Encode = (encodeData) => { + let buff = new Buffer(encodeData); + return buff.toString('base64'); +} + +module.exports = { makeRequest, base64Encode }; \ No newline at end of file
added base<I> encoding
ajay2507_ebay-node-api
train
js,js
5297390f67e869decf411ff3d681e8fe75a01a1b
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -82,7 +82,7 @@ setup( name='batman-package', author_email = 'laura.kreidberg@gmail.com', url = 'https://github.com/lkreidberg/batman', packages =['batman'], - license = ['GNU GPLv3'], + license = 'GNU GPLv3', description ='Fast transit light curve modeling', classifiers = [ 'Development Status :: 5 - Production/Stable',
setup.py: Fix pip install error in Python <I> due to license string
lkreidberg_batman
train
py
69668763841015469dab0c6692da7ac76b696448
diff --git a/lib/svtplay_dl/service/tv4play.py b/lib/svtplay_dl/service/tv4play.py index <HASH>..<HASH> 100644 --- a/lib/svtplay_dl/service/tv4play.py +++ b/lib/svtplay_dl/service/tv4play.py @@ -104,7 +104,7 @@ class Tv4play(Service, OpenGraphThumbMixin): janson2 = jansson["props"]["pageProps"]["initialApolloState"] show = jansson["query"]["nid"] - program = janson2[f"Program:{show}"] + program = janson2[f'Program:{{"nid":"{show}"}}'] episodes_panel = [] clips_panel = [] for panel in program["panels"]:
tv4play: fix so find all episodes work
spaam_svtplay-dl
train
py
804dc4c1666c7f0c24528acf3cf3083a46492e4d
diff --git a/mammoth/docx/__init__.py b/mammoth/docx/__init__.py index <HASH>..<HASH> 100644 --- a/mammoth/docx/__init__.py +++ b/mammoth/docx/__init__.py @@ -50,14 +50,14 @@ def _read_comments(zip_file, body_readers): def _read_document(zip_file, body_readers, notes, comments): - file_relationships = _try_read_entry_or_default( + package_relationships = _try_read_entry_or_default( zip_file, "_rels/.rels", read_relationships_xml_element, default=Relationships.EMPTY, ) - document_filename = _find_document_filename(zip_file, file_relationships) + document_filename = _find_document_filename(zip_file, package_relationships) with zip_file.open(document_filename) as document_fileobj: document_xml = office_xml.read(document_fileobj)
Rename file_relationships to package_relationships
mwilliamson_python-mammoth
train
py
c2d3915207f0ec9fa5c41667b37716df4e4e3f07
diff --git a/lib/emailMixin.js b/lib/emailMixin.js index <HASH>..<HASH> 100644 --- a/lib/emailMixin.js +++ b/lib/emailMixin.js @@ -179,8 +179,10 @@ module.exports = function(self) { } var finalData = {}; - var baseUrl = self.options.baseUrl || req.baseUrl || (req.protocol + '://' + req.get('Host')); - + // Allow middleware to supply baseUrl; if it's not there + // use the sitewide option; if that's not there construct it + // from what we do know about the request + var baseUrl = req.baseUrl || self.options.baseUrl || (req.protocol + '://' + req.get('Host')); var parsed = urls.parse(baseUrl); var host = parsed.host; var protocol = parsed.protocol; @@ -218,7 +220,6 @@ module.exports = function(self) { text: module.render(template + '.txt', finalData, req), html: module.render(template + '.html', finalData, req) }; - // console.log(message); return module._mailer.sendMail(message, callback); };
allow req.baseUrl to beat out the baseUrl option; we never set it, so assume it was set thoughtfully by a middleware dev and should be respected
apostrophecms_apostrophe
train
js
9b7f60912cc5b69582d45e2049a96d2dd44d27b9
diff --git a/bugzilla/bug.py b/bugzilla/bug.py index <HASH>..<HASH> 100644 --- a/bugzilla/bug.py +++ b/bugzilla/bug.py @@ -93,6 +93,10 @@ class _Bug(object): "refresh(). This will be slow, if you want to avoid " "this, properly use query/getbug include_fields.", self.bug_id, name) + + # We pass the attribute name to getbug, since for something like + # 'attachments' which downloads lots of data we really want the + # user to opt in. self.refresh(fields=[name]) refreshed = True
bug: Comment about our use of refresh(fields=X)
python-bugzilla_python-bugzilla
train
py
1780cad1693b354e46dbed7cb58f29f01aa9bfba
diff --git a/favorites/actions/toggleFavorites.js b/favorites/actions/toggleFavorites.js index <HASH>..<HASH> 100644 --- a/favorites/actions/toggleFavorites.js +++ b/favorites/actions/toggleFavorites.js @@ -90,7 +90,7 @@ const removeFavorites = productId => (dispatch) => { new PipelineRequest('deleteFavorites') .setInput({ productId }) .dispatch() - .then(res(receiveRemoveFavorites())) + .then(() => res(receiveRemoveFavorites())) .catch(rej); }); diff --git a/favorites/selectors/index.js b/favorites/selectors/index.js index <HASH>..<HASH> 100644 --- a/favorites/selectors/index.js +++ b/favorites/selectors/index.js @@ -70,6 +70,9 @@ export const hasFavorites = createSelector( count => !!count ); +/** + * Returns true when the current product is on the favorites list + */ export const isCurrentProductOnFavoriteList = createSelector( getCurrentProductId, getFavoritesProductsIds,
CON-<I> Users can remove items from their favorite list - js doc and bugfix
shopgate_pwa
train
js,js
88da3da58fcc1d155a39300690d841292839f777
diff --git a/lib/gruff/base.rb b/lib/gruff/base.rb index <HASH>..<HASH> 100644 --- a/lib/gruff/base.rb +++ b/lib/gruff/base.rb @@ -206,6 +206,9 @@ module Gruff @raw_columns.freeze @raw_rows.freeze + @scale = @columns / @raw_columns + @scale.freeze + @marker_count = nil @maximum_value = @minimum_value = nil @increment = nil @@ -215,8 +218,6 @@ module Gruff @title = nil @title_font = nil - @scale = @columns / @raw_columns - @font = nil @bold_title = true
refactor: Freeze @scale as constant
topfunky_gruff
train
rb
6b0ec9be2bddddaff75e1ecf095063fa86f6daa1
diff --git a/SingularityS3Uploader/src/main/java/com/hubspot/singularity/s3uploader/config/SingularityS3UploaderConfiguration.java b/SingularityS3Uploader/src/main/java/com/hubspot/singularity/s3uploader/config/SingularityS3UploaderConfiguration.java index <HASH>..<HASH> 100644 --- a/SingularityS3Uploader/src/main/java/com/hubspot/singularity/s3uploader/config/SingularityS3UploaderConfiguration.java +++ b/SingularityS3Uploader/src/main/java/com/hubspot/singularity/s3uploader/config/SingularityS3UploaderConfiguration.java @@ -44,6 +44,7 @@ public class SingularityS3UploaderConfiguration extends BaseRunnerConfiguration private Optional<String> s3SecretKey = Optional.absent(); @Max(5368709120L) + @Min(0) @JsonProperty private long maxSingleUploadSizeBytes = 5368709120L; @@ -51,7 +52,7 @@ public class SingularityS3UploaderConfiguration extends BaseRunnerConfiguration @JsonProperty private long uploadPartSize = 20971520L; - @Min(500) + @Min(0) @JsonProperty private int retryWaitMs = 1000;
add min 0 for uploader fields
HubSpot_Singularity
train
java
1b19d70305d213a26541a100d707f559ebded854
diff --git a/lib/chatwork/chatwork_error.rb b/lib/chatwork/chatwork_error.rb index <HASH>..<HASH> 100644 --- a/lib/chatwork/chatwork_error.rb +++ b/lib/chatwork/chatwork_error.rb @@ -3,13 +3,15 @@ module ChatWork class ChatWorkError < StandardError def self.from_response(status, body) + # HTTP status 204 don't have body. + return APIError.new(status, "") if status == 204 + hash = begin JSON.load(body) rescue JSON::ParserError => e return ChatWork::APIConnectionError.new("Response JSON is broken. #{e.message}: #{body}", e) end - unless hash['errors'] return APIConnectionError.new("Invalid response #{body}") end diff --git a/lib/chatwork/client.rb b/lib/chatwork/client.rb index <HASH>..<HASH> 100644 --- a/lib/chatwork/client.rb +++ b/lib/chatwork/client.rb @@ -18,6 +18,8 @@ module ChatWork def handle_response(response) case response.status + when 204 + ChatWork::ChatWorkError.from_response(response.status, response.body) when 200..299 begin JSON.parse(response.body)
Add code to solve <I> error. <I> will occar when API has no results.
asonas_chatwork-ruby
train
rb,rb
a69a5a414755c7f7df3a3a1d3e58e3d47e66018c
diff --git a/activesupport/test/testing/file_fixtures_test.rb b/activesupport/test/testing/file_fixtures_test.rb index <HASH>..<HASH> 100644 --- a/activesupport/test/testing/file_fixtures_test.rb +++ b/activesupport/test/testing/file_fixtures_test.rb @@ -1,5 +1,7 @@ require 'abstract_unit' +require 'pathname' + class FileFixturesTest < ActiveSupport::TestCase self.file_fixture_path = File.expand_path("../../file_fixtures", __FILE__)
Pathname might not be always initialized. Require 'pathname' explicitly
rails_rails
train
rb
df9422f4e1628ab86581876c17477c2eb3d23924
diff --git a/go/libkb/track.go b/go/libkb/track.go index <HASH>..<HASH> 100644 --- a/go/libkb/track.go +++ b/go/libkb/track.go @@ -190,7 +190,7 @@ func (t TrackDiffNone) IsSameAsTracked() bool { } func (t TrackDiffNone) ToDisplayString() string { - return "tracked" + return "followed" } func (t TrackDiffNone) ToDisplayMarkup() *Markup { return NewMarkup(t.ToDisplayString())
track -> follow (#<I>)
keybase_client
train
go
e34d6cd6486d7af55baa51e77d044538c7cba3c2
diff --git a/lib/beaker-pe/install/pe_utils.rb b/lib/beaker-pe/install/pe_utils.rb index <HASH>..<HASH> 100644 --- a/lib/beaker-pe/install/pe_utils.rb +++ b/lib/beaker-pe/install/pe_utils.rb @@ -223,6 +223,7 @@ module Beaker # @option opts [String] :pe_ver Default PE version to install or upgrade to # (Otherwise uses individual hosts pe_ver) # @option opts [Boolean] :pe_debug (false) Should we run the installer in debug mode? + # @option opts [Boolean] :interactive (false) Should we run the installer in interactive mode? # @example # on host, "#{installer_cmd(host, opts)} -a #{host['working_dir']}/answers" # @api private @@ -241,7 +242,7 @@ module Beaker else pe_debug = host[:pe_debug] || opts[:pe_debug] ? ' -D' : '' pe_cmd = "cd #{host['working_dir']}/#{host['dist']} && ./#{host['pe_installer']}#{pe_debug}" - if ! version_is_less(host['pe_ver'], '2016.2.1') + if ! version_is_less(host['pe_ver'], '2016.2.1') && ! opts[:interactive] # -y option sets "assume yes" mode where yes or whatever default will be assumed pe_cmd += " -y" end
(feature) Allow install methods to accept an interactive option This pr adds logic to allow interactive options in Beaker. Although Beaker will not be able to successfully install without `-y`, there are and may be more cases where the installer is tested against interactive mode.
puppetlabs_beaker-pe
train
rb
73a0797fe853f693ace26c1a4bfe62a3cc559b3e
diff --git a/spyder/plugins/ipythonconsole/widgets/client.py b/spyder/plugins/ipythonconsole/widgets/client.py index <HASH>..<HASH> 100644 --- a/spyder/plugins/ipythonconsole/widgets/client.py +++ b/spyder/plugins/ipythonconsole/widgets/client.py @@ -750,6 +750,7 @@ class ClientWidget(QWidget, SaveHistoryMixin): self.info_page = self.blank_page self.set_info_page() self.shellwidget.show() + self.get_control().setFocus() def _read_stderr(self): """Read the stderr file of the kernel."""
IPython console: Set focus to the console after hiding the loading page
spyder-ide_spyder
train
py
b46a5bf65b31cc65bcddcab6561cdd0277fb2b2a
diff --git a/future/tests/test_bytes.py b/future/tests/test_bytes.py index <HASH>..<HASH> 100644 --- a/future/tests/test_bytes.py +++ b/future/tests/test_bytes.py @@ -175,10 +175,10 @@ class TestBytes(unittest.TestCase): self.assertEqual(2, bytes(b'AB:CD:E').find(b':')) def test_rfind_not_found(self): - self.assertEqual(-1, bytes(b'ABCDE').find(b':')) + self.assertEqual(-1, bytes(b'ABCDE').rfind(b':')) def test_rfind_found(self): - self.assertEqual(4, bytes(b'AB:CD:E').find(b':')) + self.assertEqual(5, bytes(b'AB:CD:E').rfind(b':')) def test_bytes_join_bytes(self): b = bytes(b' * ')
Fix rfind tests in test_bytes
PythonCharmers_python-future
train
py
01270dfe22e92d99ce9402fedba4530ad8810100
diff --git a/gogs.go b/gogs.go index <HASH>..<HASH> 100644 --- a/gogs.go +++ b/gogs.go @@ -14,7 +14,7 @@ import ( ) func Version() string { - return "0.8.1" + return "0.8.2" } // Client represents a Gogs API client. diff --git a/issue.go b/issue.go index <HASH>..<HASH> 100644 --- a/issue.go +++ b/issue.go @@ -53,6 +53,7 @@ type CreateIssueOption struct { Assignee string `json:"assignee"` Milestone int64 `json:"milestone"` Labels []int64 `json:"labels"` + Closed bool `json:"closed"` } func (c *Client) CreateIssue(owner, repo string, opt CreateIssueOption) (*Issue, error) {
issue: add field to indicate state when create
gogs_go-gogs-client
train
go,go
d0d1f9fe2b2ec975d9feb92255e7af8ac4f771b9
diff --git a/library/SimplePie.php b/library/SimplePie.php index <HASH>..<HASH> 100755 --- a/library/SimplePie.php +++ b/library/SimplePie.php @@ -1294,6 +1294,7 @@ class SimplePie // Check absolute bare minimum requirements. if (!extension_loaded('xml') || !extension_loaded('pcre')) { + $this->error = 'XML or PCRE extensions not loaded!'; return false; } // Then check the xml extension is sane (i.e., libxml 2.7.x issue on PHP < 5.2.9 and libxml 2.7.0 to 2.7.2 on any version) if we don't have xmlreader.
Error message when XML or PCRE extensions missing The XML extension is not loaded by default on PHP7. Relevant to have the reason of failure in the error message instead of returning an empty error message. <URL>
simplepie_simplepie
train
php
4d1ee0d4b6bd7d170cf1ec924a8b743b5d486888
diff --git a/src/Core/Router.php b/src/Core/Router.php index <HASH>..<HASH> 100644 --- a/src/Core/Router.php +++ b/src/Core/Router.php @@ -212,6 +212,9 @@ class Router switch ($method) { // POST method case HttpMethods::POST: + $postData = array_merge($_GET, $_POST); + return $postData ?: []; + break; // PUT method case HttpMethods::PUT: // PATH method
fix form/multipart post data in engine
php-rest-server_core
train
php
e49c146b1f20527dd18c699f8ee000bb0d41068f
diff --git a/src/Kernel/Application.php b/src/Kernel/Application.php index <HASH>..<HASH> 100755 --- a/src/Kernel/Application.php +++ b/src/Kernel/Application.php @@ -4,6 +4,7 @@ namespace Encore\Kernel; use Encore\Container\Container; use Symfony\Component\Debug\Debug; +use Encore\Container\ServiceProvider; use Encore\Config\ServiceProvider as ConfigServiceProvider; class Application extends Container @@ -132,7 +133,9 @@ class Application extends Container */ protected function registerProvider(ServiceProvider $provider, $force = false) { - parent::registerProvider(); + parent::registerProvider($provider, $force); + + if ( ! in_array($provider, $this->registered)) return; if ($this->booted and method_exists($provider, 'booted')) { $provider->boot();
Fixes to registerProvider method
encorephp_kernel
train
php
28dff35127e96bd1cc7c38398e87a4dd14afb456
diff --git a/src/DependencyInjection/Configuration.php b/src/DependencyInjection/Configuration.php index <HASH>..<HASH> 100644 --- a/src/DependencyInjection/Configuration.php +++ b/src/DependencyInjection/Configuration.php @@ -41,8 +41,13 @@ class Configuration implements ConfigurationInterface */ public function getConfigTreeBuilder(): TreeBuilder { - $treeBuilder = new TreeBuilder('contentful', 'array', $this->builder); - $root = $treeBuilder->getRootNode(); + if (\method_exists(TreeBuilder::class, 'getRootNode')) { + $treeBuilder = new TreeBuilder('contentful', 'array', $this->builder); + $root = $treeBuilder->getRootNode(); + } else { + $treeBuilder = new TreeBuilder(); + $root = $treeBuilder->root('contentful', 'array', $this->builder); + } $root ->addDefaultsIfNotSet()
Use method_exists to provide compatibility with very old versions of Symfony.
contentful_ContentfulBundle
train
php
1f5c18fcde1272e321dffe7e64d6acd4dc185aac
diff --git a/rejected/consumer.py b/rejected/consumer.py index <HASH>..<HASH> 100644 --- a/rejected/consumer.py +++ b/rejected/consumer.py @@ -735,10 +735,12 @@ class PublishingConsumer(Consumer): # Publish the message self.logger.debug('Publishing message to %s:%s', exchange, routing_key) - self._channel.basic_publish(exchange=exchange, - routing_key=routing_key, - properties=msg_props, - body=body) + with self.statsd_track_duration('publish.{}.{}'.format(exchange, + routing_key)): + self._channel.basic_publish(exchange=exchange, + routing_key=routing_key, + properties=msg_props, + body=body) def reply(self, response_body, properties, auto_id=True,
Track publishing time by exchange and routing key
gmr_rejected
train
py
344ace49ee0a043aa4a94f4fe807f999a379f756
diff --git a/src/config/bindings.php b/src/config/bindings.php index <HASH>..<HASH> 100644 --- a/src/config/bindings.php +++ b/src/config/bindings.php @@ -5,7 +5,7 @@ return array( * Register the processor binding. * Default: 'Lablog\Lablog\Processor\MarkdownProcessor' */ - 'Lablog\Lablog\Processor\ProcessorInterface' => 'Lablog\Parsedown\MarkdownProcessor', + 'Lablog\Lablog\Processor\ProcessorInterface' => 'Lablog\Markdown\MarkdownProcessor', /** * Register the page type binding.
Corrected spelling mistake, replaced parsedown with markdown.
LaBlog_LaBlog
train
php
e61996c457adb15793d0bf53fddf6ad17e470179
diff --git a/src/components/networked.js b/src/components/networked.js index <HASH>..<HASH> 100644 --- a/src/components/networked.js +++ b/src/components/networked.js @@ -281,7 +281,9 @@ AFRAME.registerComponent('networked', { return; } - if (this.data.owner !== entityData.owner && this.data.lastOwnerTime < entityData.lastOwnerTime) { + if (this.data.owner !== entityData.owner && + (this.data.lastOwnerTime < entityData.lastOwnerTime || + (this.data.lastOwnerTime === entityData.lastOwnerTime && this.data.owner < entityData.owner))) { // TODO: File issue for partial set attribute. // this.el.setAttribute("networked", { owner: entityData.owner });
add check in case both lastOwnerTime's are the same
networked-aframe_networked-aframe
train
js
21ad13a75db46d861e47e82ee75c24e519ee4aef
diff --git a/test/unit/FieldType/Slug/Generator/EntityPrePersistGeneratorTest.php b/test/unit/FieldType/Slug/Generator/EntityPrePersistGeneratorTest.php index <HASH>..<HASH> 100644 --- a/test/unit/FieldType/Slug/Generator/EntityPrePersistGeneratorTest.php +++ b/test/unit/FieldType/Slug/Generator/EntityPrePersistGeneratorTest.php @@ -48,7 +48,8 @@ class EntityPrePersistGeneratorTest extends TestCase $this->assertInstanceOf(Template::class, $generatedTemplate); $this->assertFalse((string)$generatedTemplate === ''); $this->assertEquals( - '$this->niets = Tardigrades\Helper\StringConverter::toSlug($this->getSnail() . \'-\' . $this->getSexy()); + '// phpcs:ignore Generic.Files.LineLength -- easier than to write a method that will fix line ending and indentation... +$this->niets = Tardigrades\Helper\StringConverter::toSlug($this->getSnail() . \'-\' . $this->getSexy()); ', (string) $generatedTemplate); }
added phpcs comment to test
dionsnoeijen_sexy-field-entity
train
php