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
41ff53be670a3c8ededfbfde9855950ec41051b1
diff --git a/lib/api-versions.rb b/lib/api-versions.rb index <HASH>..<HASH> 100644 --- a/lib/api-versions.rb +++ b/lib/api-versions.rb @@ -50,7 +50,7 @@ module ApiVersions private def accepts_proper_format?(request) - !!(request.headers['Accept'] =~ /^application\/vnd\.#{self.class.api_vendor}\+json/) + !!(request.headers['Accept'] =~ /^application\/vnd\.#{self.class.api_vendor}\+?.+/) end def matches_version?(request)
Should not assume API client wants json.
EDMC_api-versions
train
rb
7eca5e3be8289e663fdc9aee0c9f06d399c1f8d0
diff --git a/system/HTTP/Response.php b/system/HTTP/Response.php index <HASH>..<HASH> 100644 --- a/system/HTTP/Response.php +++ b/system/HTTP/Response.php @@ -447,9 +447,9 @@ class Response extends Message implements ResponseInterface * * @return $this */ - public function setJSON($body) + public function setJSON($body, bool $unencoded = true) { - $this->body = $this->formatBody($body, 'json'); + $this->body = $this->formatBody($body, 'json' . ($unencoded ? '-unencoded' : '')); return $this; } @@ -542,7 +542,7 @@ class Response extends Message implements ResponseInterface $this->bodyFormat = $format; // Nothing much to do for a string... - if (! is_string($body)) + if (! is_string($body) || $format === 'json-unencoded') { /** * @var Format $config
Inccorectly formated JSON response , if body is string JSON was not correctly formatted in case we providing a string to setJSON() method. Of course, this is not the final solution but I am pointing out the place where the issue occurs. ``` $this->response ->setJSON(time().'get') ->send(); ```
codeigniter4_CodeIgniter4
train
php
1f24ba646298f948f029ff30e5c1f6f5c5d52666
diff --git a/utils/utils_test.go b/utils/utils_test.go index <HASH>..<HASH> 100644 --- a/utils/utils_test.go +++ b/utils/utils_test.go @@ -153,6 +153,12 @@ func (s *TestSuite) TestSliceToMap(c *C) { c.Assert(m, IsNil) } +func (s *TestSuite) TestChecksum(c *C) { + checksum, err := GetFileChecksum(s.imageFile) + c.Assert(err, IsNil) + c.Assert(checksum, Equals, "0ff7859005e5debb631f55b7dcf4fb3a1293ff937b488d8bf5a8e173d758917ccf9e835403c16db1b33d406b9b40438f88d184d95c81baece136bc68fa0ae5d2") +} + func (s *TestSuite) TestLoopDevice(c *C) { dev, err := AttachLoopDeviceRO(s.imageFile) c.Assert(err, IsNil)
utils: Unit test for checksum
rancher_convoy
train
go
7d361d8166606edd72518d2ac91e715caf698754
diff --git a/salt/fileserver/roots.py b/salt/fileserver/roots.py index <HASH>..<HASH> 100644 --- a/salt/fileserver/roots.py +++ b/salt/fileserver/roots.py @@ -310,6 +310,7 @@ def _file_lists(load, form): __opts__, form, list_cache, w_lock ) if cache_match is not None: + log.debug("Returning file list from cache") return cache_match if refresh_cache: ret = {
Add debug log when file list is returned from cache
saltstack_salt
train
py
6bbe1df0863809aff46b056e0c33106b6da90978
diff --git a/hashedindex/textparser.py b/hashedindex/textparser.py index <HASH>..<HASH> 100644 --- a/hashedindex/textparser.py +++ b/hashedindex/textparser.py @@ -29,8 +29,11 @@ _punctuation = copy(punctuation) for char in _punctuation_exceptions: _punctuation = _punctuation.replace(char, '') -_re_punctuation = re.compile('[%s]' % re.escape(_punctuation)) -_re_token = re.compile(r'[A-z0-9]+') +_punctuation_class = '[%s]' % re.escape(_punctuation) +_word_class = '[A-z0-9%s]+' % re.escape(_punctuation_exceptions) + +_re_punctuation = re.compile(_punctuation_class) +_re_token = re.compile('%s' % (_word_class)) _url_pattern = ( r'(https?:\/\/)?(([\da-z-]+)\.){1,2}.([a-z\.]{2,6})(/[\/\w \.-]*)*\/?(\?(\w+=\w+&?)+)?'
Isolate regex character class definitions from compilation line
MichaelAquilina_hashedindex
train
py
ebd295a66af85d02f29f86a3292c0d4ab1b9f19a
diff --git a/src/HTMLServerComponentsCompiler.php b/src/HTMLServerComponentsCompiler.php index <HASH>..<HASH> 100644 --- a/src/HTMLServerComponentsCompiler.php +++ b/src/HTMLServerComponentsCompiler.php @@ -63,7 +63,7 @@ class HTMLServerComponentsCompiler if ($scheme === 'data') { $componentHTML = $this->processData($sourceParts[1]); } elseif ($scheme === 'file') { - $componentHTML = $this->processFile($sourceParts[1], $attributes, $component->innerHTML); + $componentHTML = $this->processFile(urldecode($sourceParts[1]), $attributes, $component->innerHTML); } else { throw new \Exception('URI scheme not valid!' . $domDocument->saveHTML($component)); }
Added fix for encoded local file paths.
ivopetkov_html-server-components-compiler
train
php
df3f1d18de5dcdcba880d34cd498283dcb191c9f
diff --git a/src/sources/raster.js b/src/sources/raster.js index <HASH>..<HASH> 100644 --- a/src/sources/raster.js +++ b/src/sources/raster.js @@ -141,8 +141,7 @@ export class RasterSource extends RasterTileSource { name, element: canvas, filtering: this.filtering, - coords, - UNPACK_PREMULTIPLY_ALPHA_WEBGL: true + coords }; }
un-tiled rasters: don't unpack premult alpha (fixes alpha levels when compositing multiple images)
tangrams_tangram
train
js
4ea91256562fc8bb6bd64545d2e996178db75b8f
diff --git a/sift/src/main/java/siftscience/android/AppStateCollector.java b/sift/src/main/java/siftscience/android/AppStateCollector.java index <HASH>..<HASH> 100644 --- a/sift/src/main/java/siftscience/android/AppStateCollector.java +++ b/sift/src/main/java/siftscience/android/AppStateCollector.java @@ -169,7 +169,7 @@ public class AppStateCollector implements LocationListener, List<String> addresses = new ArrayList<>(); try { for (Enumeration<NetworkInterface> en = NetworkInterface.getNetworkInterfaces(); - en.hasMoreElements(); ) { + en != null && en.hasMoreElements(); ) { NetworkInterface intf = en.nextElement(); for (Enumeration<InetAddress> enumIpAddr = intf.getInetAddresses(); enumIpAddr.hasMoreElements(); ) {
Fix potential NPE in AppStateCollector.getIpAddresses()
SiftScience_sift-android
train
java
9d90b0cbb008b1d77426f673f2330312d7a3360e
diff --git a/riak/search.py b/riak/search.py index <HASH>..<HASH> 100644 --- a/riak/search.py +++ b/riak/search.py @@ -5,12 +5,12 @@ from xml.dom.minidom import Document class RiakSearch: def __init__(self, client, transport_class=None, host="127.0.0.1", port=8098): - if not transport_class: - self._transport = RiakHttpTransport(host, - port, - "/solr") - else: - self._transport = transport_class(host, port, client_id=client_id) + if transport_class is None: + transport_class = RiakHttpTransport + + hostports = [ (host, port), ] + self._cm = transport_class.default_cm(hostports) + self._transport = transport_class(self._cm, prefix="/solr") self._client = client self._decoders = {"text/xml": ElementTree.fromstring}
Fix the transport creation in the search object.
basho_riak-python-client
train
py
5d992e2d9bcc1b39f4630ffaf89cbc5ec4f2cb5e
diff --git a/lib/deas/sinatra_app.rb b/lib/deas/sinatra_app.rb index <HASH>..<HASH> 100644 --- a/lib/deas/sinatra_app.rb +++ b/lib/deas/sinatra_app.rb @@ -1,4 +1,5 @@ require 'sinatra/base' +require 'timeout' require 'deas/error_handler' require 'deas/exceptions' require 'deas/request_data'
(hotfix) require 'timeout' for access to `Timeout::Error` Something changed from <I> to <I> so that this class isn't auto required/available. This switches to requiring it so that the test suite passes. I'm currently testing against <I>. This is part of making sure our gems are all working on modern ruby versions.
redding_deas
train
rb
9ed5efc54e5b04f04db4bfc0be601f5ae00ed55b
diff --git a/src/auto-ngtemplate-loader.js b/src/auto-ngtemplate-loader.js index <HASH>..<HASH> 100644 --- a/src/auto-ngtemplate-loader.js +++ b/src/auto-ngtemplate-loader.js @@ -1,6 +1,6 @@ const { escapeRegExp, get } = require('lodash'); const { isValid } = require('var-validator'); -const { urlToRequest } = require('loader-utils'); +const { urlToRequest, getOptions } = require('loader-utils'); const { replaceTemplateUrl } = require('./util'); @@ -17,7 +17,7 @@ module.exports = function autoNgTemplateLoader(source, map) { variableName = 'autoNgTemplateLoaderTemplate', pathResolver = urlToRequest, useResolverFromConfig = false, - } = this.getOptions(); + } = this.getOptions() || getOptions(this); if (useResolverFromConfig) { if (this.version > 1) {
added a way to potentially handle the loader-utils api difference
YashdalfTheGray_auto-ngtemplate-loader
train
js
81985a78a33c71d15bdadee1c691593747bc454c
diff --git a/components/typography/mdc-typography.js b/components/typography/mdc-typography.js index <HASH>..<HASH> 100644 --- a/components/typography/mdc-typography.js +++ b/components/typography/mdc-typography.js @@ -82,7 +82,7 @@ export const mdcText = { export const mdcDisplay = { name: 'mdc-display', mixins: [ - mdcTypoMixin('mdc-headline'), + mdcTypoMixin('mdc-display'), mdcTypoPropMixin('h1', 'headline4', [ 'headline4', 'headline3',
fix(typography): fix mdc-display class name
stasson_vue-mdc-adapter
train
js
b8e1fb97b7d66f412dcbd5ead151c80bd3370d8a
diff --git a/src/index.js b/src/index.js index <HASH>..<HASH> 100644 --- a/src/index.js +++ b/src/index.js @@ -72,6 +72,8 @@ export class DefaultLoader extends Loader { } } +PLATFORM.Loader = DefaultLoader; + if (!PLATFORM.global.System || !PLATFORM.global.System.import) { if (PLATFORM.global.requirejs && requirejs.s && requirejs.s.contexts && requirejs.s.contexts._ && requirejs.s.contexts._.defined) { let defined = requirejs.s.contexts._.defined;
feat(index): ensure that DefaultLoader is set as the platfrom loader
aurelia_loader-default
train
js
64e41c817afe43dc1dbe63b431ae05d198435e34
diff --git a/lib/yard/server/webrick_adapter.rb b/lib/yard/server/webrick_adapter.rb index <HASH>..<HASH> 100644 --- a/lib/yard/server/webrick_adapter.rb +++ b/lib/yard/server/webrick_adapter.rb @@ -3,14 +3,6 @@ require 'webrick' module YARD module Server class WebrickAdapter < Adapter - def mount_command(path, command, options) - mount_servlet(path, WebrickServlet, command, options) - end - - def mount_servlet(path, servlet, *args) - server.mount(path, servlet, self, *args) - end - def start server_options[:ServerType] = WEBrick::Daemon if server_options[:daemonize] server = WEBrick::HTTPServer.new(server_options)
Remove unnecessary code from WebrickAdapter
lsegal_yard
train
rb
e74365102b6d258af51fc056158b834ef2e01e10
diff --git a/polyline.go b/polyline.go index <HASH>..<HASH> 100644 --- a/polyline.go +++ b/polyline.go @@ -30,18 +30,15 @@ func DecodeUints(s string) ([]uint, error) { xs := make([]uint, 0) var x, shift uint for i, c := range []byte(s) { - if c < 95 { - if c < 63 { - return nil, &InvalidCharacterError{i, c} - } else { - xs = append(xs, x+(uint(c)-63)<<shift) - x = 0 - shift = 0 - } - } else if c < 127 { + switch { + case 63 <= c && c < 95: + xs = append(xs, x+(uint(c)-63)<<shift) + x = 0 + shift = 0 + case 95 <= c && c < 127: x += (uint(c) - 95) << shift shift += 5 - } else { + default: return nil, &InvalidCharacterError{i, c} } }
Use a switch statement instead of nested ifs
twpayne_gopolyline
train
go
96f64497584dfbb7a2327ef7175a2a12685c23d1
diff --git a/Form/Type/IbanType.php b/Form/Type/IbanType.php index <HASH>..<HASH> 100644 --- a/Form/Type/IbanType.php +++ b/Form/Type/IbanType.php @@ -54,7 +54,8 @@ class IbanType extends AbstractType )) ->add('c8', 'extra_form_iban_text', array( 'attr' => array('style' => 'width: 6em;background:#DDD;'), - 'max_length' => 7 + 'max_length' => 7, + 'required' => false )) ; }
Set last IBAN field as not required
IDCI-Consulting_ExtraFormBundle
train
php
0bde36d0973b43ae8f445d6894fb5042d6b5d273
diff --git a/salt/minion.py b/salt/minion.py index <HASH>..<HASH> 100644 --- a/salt/minion.py +++ b/salt/minion.py @@ -397,8 +397,9 @@ class Minion(object): ret = {} for ind in range(0, len(data['arg'])): try: - if '\n' not in data['arg'][ind]: - arg = yaml.safe_load(data['arg'][ind]) + arg = data['arg'][ind] + if '\n' not in arg: + arg = yaml.safe_load(arg) if isinstance(arg, bool): data['arg'][ind] = str(data['arg'][ind]) elif isinstance(arg, (dict, int, list, string_types)): @@ -478,8 +479,9 @@ class Minion(object): for ind in range(0, len(data['fun'])): for index in range(0, len(data['arg'][ind])): try: - if '\n' not in data['arg'][ind]: - arg = yaml.safe_load(data['arg'][ind][index]) + arg = data['arg'][ind][index] + if '\n' not in arg: + arg = yaml.safe_load(arg) if isinstance(arg, bool): data['arg'][ind][index] = str(data['arg'][ind][index]) elif isinstance(arg, (dict, int, list, string_types)):
Always define `arg` before the new line detection regarding yaml's `safe_load`.
saltstack_salt
train
py
d21bce06d0c8820c00026553f54c5b0321f2222b
diff --git a/tchannel/tornado/connection.py b/tchannel/tornado/connection.py index <HASH>..<HASH> 100644 --- a/tchannel/tornado/connection.py +++ b/tchannel/tornado/connection.py @@ -24,7 +24,6 @@ import logging import os import socket import sys -from Queue import Empty import tornado.gen import tornado.iostream @@ -48,8 +47,10 @@ from .message_factory import build_protocol_exception try: import tornado.queues as queues # included in 4.2 + QueueEmpty = queues.QueueEmpty except ImportError: import toro as queues + from Queue import Empty as QueueEmpty log = logging.getLogger('tchannel') @@ -142,7 +143,7 @@ class TornadoConnection(object): while True: message = self._messages.get_nowait() log.warn("Unconsumed message %s", message) - except Empty: + except QueueEmpty: pass def await(self):
[py] Fix tornado <I> compatibility
uber_tchannel-python
train
py
85861ef7fa7850aff0a99e28b8bf39e4e6823958
diff --git a/packages/xod-client/src/project/actions.js b/packages/xod-client/src/project/actions.js index <HASH>..<HASH> 100644 --- a/packages/xod-client/src/project/actions.js +++ b/packages/xod-client/src/project/actions.js @@ -8,7 +8,7 @@ export const createProject = (projectName) => ({ type: ActionType.PROJECT_CREATE, payload: { name: projectName, - mainPatchId: core.generateId(), + mainPatchId: `@/${core.generateId()}`, }, });
fix(xod-client): fix id of mainPatch on creating new project
xodio_xod
train
js
4ec3de6c1c1b68d26a76c92ceba7b0d49f35ad4e
diff --git a/lib/mongo_mapper/plugins/associations/in_array_proxy.rb b/lib/mongo_mapper/plugins/associations/in_array_proxy.rb index <HASH>..<HASH> 100644 --- a/lib/mongo_mapper/plugins/associations/in_array_proxy.rb +++ b/lib/mongo_mapper/plugins/associations/in_array_proxy.rb @@ -36,7 +36,7 @@ module MongoMapper end def paginate(options) - klass.paginate(scoped_options(options)) + query.paginate(options) end def all(options={}) @@ -117,6 +117,10 @@ module MongoMapper end private + def query(options={}) + klass.query(scoped_options(options)) + end + def scoped_conditions {:_id => ids} end diff --git a/lib/mongo_mapper/plugins/associations/many_documents_proxy.rb b/lib/mongo_mapper/plugins/associations/many_documents_proxy.rb index <HASH>..<HASH> 100644 --- a/lib/mongo_mapper/plugins/associations/many_documents_proxy.rb +++ b/lib/mongo_mapper/plugins/associations/many_documents_proxy.rb @@ -16,7 +16,7 @@ module MongoMapper end def paginate(options) - klass.paginate(scoped_options(options)) + query.paginate(options) end def all(options={})
Switched proxy pagination to plucky.
mongomapper_mongomapper
train
rb,rb
aeacdeb6ff0afde429e2ef3310244982b1e08089
diff --git a/lib/care.rb b/lib/care.rb index <HASH>..<HASH> 100644 --- a/lib/care.rb +++ b/lib/care.rb @@ -26,7 +26,8 @@ class Care end def read(n_bytes) - return '' if (n_bytes == 0 || n_bytes < 0) # As hardcoded for all Ruby IO objects + return '' if n_bytes == 0 # As hardcoded for all Ruby IO objects + raise ArgumentError, "negative length #{n_bytes} given" if n_bytes < 0 # also as per Ruby IO objects read = @cache.byteslice(@io, @pos, n_bytes) return unless read && !read.empty? @pos += read.bytesize
Return error in Care for negative bytes to read
WeTransfer_format_parser
train
rb
f57cd38b824fdcd9f4e49b66542e38d57b78b7bd
diff --git a/file.php b/file.php index <HASH>..<HASH> 100644 --- a/file.php +++ b/file.php @@ -36,6 +36,8 @@ if ($course->category) { require_login($courseid); + } else if ($CFG->forcelogin) { + require_login(); } // it's OK to get here if no course was specified
Use forcelogin on site files if it's defined bug <I>
moodle_moodle
train
php
ffe070b8b4c32c3c872326fa85f555a9af249ec6
diff --git a/php/samples/php_delivered.php b/php/samples/php_delivered.php index <HASH>..<HASH> 100644 --- a/php/samples/php_delivered.php +++ b/php/samples/php_delivered.php @@ -9,7 +9,8 @@ $rmapi = new RMAPI('YoUrSeCr3tTokenG03sH3rE'); #retrieve account information array $account_info = $rmapi->rm_administrationUsersCurrent(); -#parse array and access the account id stdClass object value. returns just the the account GUID as a string +#parse array and access the account id stdClass object value. +#returns just the the account GUID as a string $AccountId = $account_info['service_response']->AccountId; #Dates are in UTC format and must be set as strings
adjust comments moved the comments down a line to keep things looking pretty in mkting site examples
ReachmailInc_WebAPISamples
train
php
bed48960af251770e1c6c842dfd79f7707d8d618
diff --git a/index.js b/index.js index <HASH>..<HASH> 100644 --- a/index.js +++ b/index.js @@ -24,6 +24,8 @@ module.exports = function (renameFunction) { 'use strict'; ; relativePath = renameFunction(relativePath); file.path = path.join(file.base, relativePath); + + this.emit('data', file); }; endStream = function endStream () { this.emit('end'); };
Emit the file when stream is processed
architectcodes_gulp-simple-rename
train
js
3a81d2cf69fbfe8d087f5f618f6ff40d61462310
diff --git a/uploadservice/src/main/java/net/gotev/uploadservice/UploadService.java b/uploadservice/src/main/java/net/gotev/uploadservice/UploadService.java index <HASH>..<HASH> 100644 --- a/uploadservice/src/main/java/net/gotev/uploadservice/UploadService.java +++ b/uploadservice/src/main/java/net/gotev/uploadservice/UploadService.java @@ -288,7 +288,7 @@ public final class UploadService extends Service { return START_STICKY; } - private void clearIdleTimer() { + synchronized private void clearIdleTimer() { if (idleTimer != null) { Logger.info(TAG, "Clearing idle timer"); idleTimer.cancel(); @@ -296,7 +296,7 @@ public final class UploadService extends Service { } } - private int shutdownIfThereArentAnyActiveTasks() { + synchronized private int shutdownIfThereArentAnyActiveTasks() { if (uploadTasksMap.isEmpty()) { clearIdleTimer();
#<I> methods which interacts with idle timer are now synchronized
gotev_android-upload-service
train
java
ebc873027749560280a181cae347c6bce2f45ea1
diff --git a/src/Annotations/Schema.php b/src/Annotations/Schema.php index <HASH>..<HASH> 100644 --- a/src/Annotations/Schema.php +++ b/src/Annotations/Schema.php @@ -62,7 +62,7 @@ class Schema extends AbstractAnnotation public $properties; /** - * The type of the parameter. Since the parameter is not located at the request body, it is limited to simple types (that is, not an object). The value MUST be one of "string", "number", "integer", "boolean", "array" or "file". If type is "file", the consumes MUST be either "multipart/form-data" or " application/x-www-form-urlencoded" and the parameter MUST be in "formData". + * The type of the schema/property. The value MUST be one of "string", "number", "integer", "boolean", "array" or "object". * @var string */ public $type;
Fix Schema::type phpdoc is not about parameters Schema::$type is not for parameters but mostly properties. There is a separate class for parameters.
zircote_swagger-php
train
php
0bb51d14e3668d4b026bd4de6c810a402ab90252
diff --git a/lib/stripe_mock/request_handlers/subscriptions.rb b/lib/stripe_mock/request_handlers/subscriptions.rb index <HASH>..<HASH> 100644 --- a/lib/stripe_mock/request_handlers/subscriptions.rb +++ b/lib/stripe_mock/request_handlers/subscriptions.rb @@ -99,7 +99,7 @@ module StripeMock customer = assert_existence :customer, customer_id, customers[customer_id] if plan && customer - unless customer[:currency] == plan[:currency] + unless customer[:currency].to_s == plan[:currency].to_s raise Stripe::InvalidRequestError.new('lol', 'currency', http_status: 400) end end
Compare the currency of the customer and plan as a string
rebelidealist_stripe-ruby-mock
train
rb
5464c4be5bfc4f255b8570b58304d6801de48b72
diff --git a/test/middleware/producer-pipeline.tests.js b/test/middleware/producer-pipeline.tests.js index <HASH>..<HASH> 100644 --- a/test/middleware/producer-pipeline.tests.js +++ b/test/middleware/producer-pipeline.tests.js @@ -36,7 +36,7 @@ describe('ProducerPipeline', function() { }); it('should call middleware function once when it is given one', function(done){ producerPipeline.use(simpleMiddleware); - producerPipeline.execute(message).then(() => { + producerPipeline.execute(message).then(function(){ expect(message.properties.headers.length).to.equal(1); expect(message.properties.headers[0]).to.equal('first: true'); done();
Don't use lambdas yet since our builder doesn't support them
twindagger_magicbus
train
js
a860ceaa871c3662acb9d57cf68f958251929f12
diff --git a/Imager.js b/Imager.js index <HASH>..<HASH> 100644 --- a/Imager.js +++ b/Imager.js @@ -2,10 +2,9 @@ 'use strict'; - var defaultWidths, getKeys, isArray; + var defaultWidths, getKeys, isArray, nextTick; - window.requestAnimationFrame = - window.requestAnimationFrame || + nextTick = window.requestAnimationFrame || window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame || function (callback) { @@ -128,7 +127,7 @@ this.changeDivsToEmptyImages(); - window.requestAnimationFrame(function(){ + nextTick(function(){ self.init(); }); }
Removed the override of `window.requestAnimationFrame` But kept it internally as `nextTick` function.
BBC-News_Imager.js
train
js
e88339de9762db0279487c700f208fc4eb8d34e4
diff --git a/lib/hexdump/hexdump.rb b/lib/hexdump/hexdump.rb index <HASH>..<HASH> 100644 --- a/lib/hexdump/hexdump.rb +++ b/lib/hexdump/hexdump.rb @@ -53,7 +53,6 @@ module Hexdump end index = 0 - offset = 0 hex_segment = [] print_segment = [] @@ -88,27 +87,20 @@ module Hexdump end } - data.each_byte do |b| - if offset == 0 - hex_segment.clear - print_segment.clear - end - - hex_segment << hex_byte[b] - print_segment << print_byte[b] - - offset += 1 + data.each_byte.each_slice(width) do |bytes| + hex_segment.clear + print_segment.clear - if (offset >= width) - segment.call - - offset = 0 - index += width + bytes.each do |b| + hex_segment << hex_byte[b] + print_segment << print_byte[b] end + + segment.call + index += width end # flush the hexdump buffer - segment.call unless offset == 0 return nil end
Use each_slice to walk through the bytes.
postmodern_hexdump
train
rb
d1e4e09ca094c248895aee1d3e8f6a41589ca571
diff --git a/webpack.config.js b/webpack.config.js index <HASH>..<HASH> 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -1,11 +1,8 @@ const DedupePlugin = require('webpack/lib/optimize/DedupePlugin') +const UglifyJsPlugin = require('webpack/lib/optimize/UglifyJsPlugin') module.exports = { - entry: [ - // Using this instead of transform-runtime, - // see babel config below. - 'babel-polyfill', - ], + entry: [ ], resolve: { extensions: [ "", ".js", ".jsx", ] }, @@ -23,17 +20,15 @@ module.exports = { 'stage-1', ], plugins: [ - // broken in Webpack, doesn't work. Instead we load - // babel-polyfill as an entry, above. See - // https://discuss.babeljs.io/t/regeneratorruntime-is-not-defined-in-webpack-build/202 - //'transform-runtime' + 'transform-runtime' ], }, }, ], }, plugins: [ - new DedupePlugin() + new DedupePlugin(), + new UglifyJsPlugin(), ], devtool: "source-map", }
Use transform-runtime plugin for Babel, which I think might solve #<I>, but still using Babel and not Buble. I'd like to switch to Buble soon, but they have a bug in issue <I> of their tracker. Also enable minification of global build.
trusktr_infamous
train
js
976588598a1f23412161bcfe9109b32d6c73952a
diff --git a/ext/dep_gecode/extconf.rb b/ext/dep_gecode/extconf.rb index <HASH>..<HASH> 100644 --- a/ext/dep_gecode/extconf.rb +++ b/ext/dep_gecode/extconf.rb @@ -98,6 +98,13 @@ EOS # symbols we need to export. We pass an extra def file to the linker to # make it export the symbols we need. $DLDFLAGS << " -Wl,--enable-auto-image-base,--enable-auto-import dep_gecode-all.def" + + # When compiling with devkit, mingw/bin is added to the PATH only for + # compilation, but not at runtime. Windows uses PATH for shared library + # path and has no rpath feature. This means that dynamic linking to + # libraries in mingw/bin will succeed at compilation but cause runtime + # loading failures. To fix this we static link libgcc and libstdc++ + # See: https://github.com/opscode/dep-selector/issues/17 $libs << " -static-libgcc -static-libstdc++" end
Explain why we need to static link on windows
chef_dep-selector
train
rb
197d29754d02a3da0143548630276bf1d6dbdb47
diff --git a/telesign/api.py b/telesign/api.py index <HASH>..<HASH> 100644 --- a/telesign/api.py +++ b/telesign/api.py @@ -516,9 +516,6 @@ class Verify(ServiceBase): """ - if(verify_code == None): - verify_code = random_with_N_digits(5) - resource = "/v1/verify/sms" method = "POST" @@ -630,9 +627,6 @@ class Verify(ServiceBase): ... """ - if(verify_code == None): - verify_code = random_with_N_digits(5) - resource = "/v1/verify/call" method = "POST"
Removed autogeneration of verify codes from call/sms
TeleSign_python_telesign
train
py
289b4dc6a2e53af6098147e521923b9c7198c18d
diff --git a/lib/mail_style/inline_styles.rb b/lib/mail_style/inline_styles.rb index <HASH>..<HASH> 100644 --- a/lib/mail_style/inline_styles.rb +++ b/lib/mail_style/inline_styles.rb @@ -16,7 +16,7 @@ module MailStyle def write_inline_styles # Parse only text/html parts - @parts.select{|p| p.content_type == 'text/html'}.each do |part| + parsable_parts(@parts).each do |part| part.body = parse_html(part.body) end @@ -24,6 +24,15 @@ module MailStyle real_content_type, ctype_attrs = parse_content_type self.body = parse_html(body) if body.is_a?(String) && real_content_type == 'text/html' end + + def parsable_parts(parts) + selected = [] + parts.each do |p| + selected << p if p.content_type == 'text/html' + selected += parsable_parts(p.parts) + end + selected + end def parse_html(html) # Parse original html
Support for nested parts. This is neccessary for a multipart email with attachments.
Mange_roadie
train
rb
fcd2a0bbbcb7191ab4fed751656a90c6fb26e30e
diff --git a/lxd/container_exec.go b/lxd/container_exec.go index <HASH>..<HASH> 100644 --- a/lxd/container_exec.go +++ b/lxd/container_exec.go @@ -340,7 +340,7 @@ func containerExecPost(d *Daemon, r *http.Request) Response { _, ok := env["PATH"] if !ok { env["PATH"] = "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" - if shared.PathExists(fmt.Sprintf("%s/snap/bin", c.RootfsPath())) { + if shared.PathExists(fmt.Sprintf("%s/snap", c.RootfsPath())) { env["PATH"] = fmt.Sprintf("%s:/snap/bin", env["PATH"]) } }
Add /snap/bin to PATH even if only /snap exists /snap/bin is created later on by snapd, so lets just assume that it will exist and append /snap/bin so long as /snap exists.
lxc_lxd
train
go
cd86c82d5c64c1eb781b32531ed14b5617c9856e
diff --git a/src/Google/Http/Batch.php b/src/Google/Http/Batch.php index <HASH>..<HASH> 100644 --- a/src/Google/Http/Batch.php +++ b/src/Google/Http/Batch.php @@ -68,8 +68,8 @@ Content-Transfer-Encoding: binary MIME-Version: 1.0 Content-ID: %s -%s%s %s +%s%s EOF;
header lines get messed up without this, although it doesn't seem to matter
googleapis_google-api-php-client
train
php
a13432325dae26c4c5777f6e2f113a99b7e51fca
diff --git a/androguard/core/bytecodes/apk.py b/androguard/core/bytecodes/apk.py index <HASH>..<HASH> 100644 --- a/androguard/core/bytecodes/apk.py +++ b/androguard/core/bytecodes/apk.py @@ -683,7 +683,7 @@ class APK(object): # Some applications have more than one MAIN activity. # For example: paid and free content activityEnabled = item.get(NS_ANDROID + "enabled") - if activityEnabled is not None and activityEnabled != "" and activityEnabled == "false": + if activityEnabled == "false": continue for sitem in item.findall(".//action"):
Simplify check that activity is enabled. Obviously, it can't be `None` nor empty when it is `"false"`.
androguard_androguard
train
py
f0c458d4622a4af18ce5247dea28ffa272b83abe
diff --git a/workshift/tests.py b/workshift/tests.py index <HASH>..<HASH> 100644 --- a/workshift/tests.py +++ b/workshift/tests.py @@ -196,7 +196,6 @@ class TestViews(TestCase): response = self.client.get("/workshift/profile/{0}/preferences/" .format(self.wprofile.user.username)) self.assertEqual(response.status_code, 200) - print response.content self.assertIn(self.wtype.title, response.content) def test_views_load(self): @@ -329,7 +328,7 @@ class TestViews(TestCase): response = self.client.get("/workshift/?day=2014-01-01") self.assertEqual(response.status_code, 200) self.assertIn("Wednesday, January 1, 2014", response.content) - self.assertIn("?day=2013-12-31", response.content) + self.assertNotIn("?day=2013-12-31", response.content) self.assertIn("?day=2014-01-02", response.content) class TestInteractForms(TestCase):
Removed print statement Fixed semester_view test
knagra_farnsworth
train
py
0bbb75af2962d0d891a95e5fed00566aac6c1b45
diff --git a/test/unit/Reflection/StringCast/ReflectionClassStringCastTest.php b/test/unit/Reflection/StringCast/ReflectionClassStringCastTest.php index <HASH>..<HASH> 100644 --- a/test/unit/Reflection/StringCast/ReflectionClassStringCastTest.php +++ b/test/unit/Reflection/StringCast/ReflectionClassStringCastTest.php @@ -52,6 +52,9 @@ class ReflectionClassStringCastTest extends TestCase ); } + /** + * @requires PHP >= 8.1 + */ public function testPureEnumToString(): void { $reflector = new DefaultReflector(new AggregateSourceLocator([ @@ -66,6 +69,9 @@ class ReflectionClassStringCastTest extends TestCase ); } + /** + * @requires PHP >= 8.1 + */ public function testBackedEnumToString(): void { $reflector = new DefaultReflector(new AggregateSourceLocator([
ReflectionClassStringCast tests for enums have to run on PHP <I> to be able to reflect interfaces that exist only in PHP <I> stubs
Roave_BetterReflection
train
php
277be842bf30848e7292a931169bd4c8ff726dee
diff --git a/lib/git/cmd.py b/lib/git/cmd.py index <HASH>..<HASH> 100644 --- a/lib/git/cmd.py +++ b/lib/git/cmd.py @@ -51,11 +51,11 @@ class Git(MethodMissingMixin): return self.git_dir def execute(self, command, - istream = None, - with_status = False, - with_stderr = False, - with_exceptions = False, - with_raw_output = False, + istream=None, + with_status=False, + with_stderr=False, + with_exceptions=False, + with_raw_output=False, ): """ Handles executing the command on the shell and consumes and returns @@ -96,10 +96,10 @@ class Git(MethodMissingMixin): # Start the process proc = subprocess.Popen(command, - cwd = self.git_dir, - stdin = istream, - stderr = stderr, - stdout = subprocess.PIPE + cwd=self.git_dir, + stdin=istream, + stderr=stderr, + stdout=subprocess.PIPE ) # Wait for the process to return
style: follow PEP 8 in git/cmd.py Keyword args shouldn't use spaces around the equals sign per PEP 8.
gitpython-developers_GitPython
train
py
8e7fc240f91e659c6a3f27d2ae6c54299865789d
diff --git a/helper/schema/field_writer_map.go b/helper/schema/field_writer_map.go index <HASH>..<HASH> 100644 --- a/helper/schema/field_writer_map.go +++ b/helper/schema/field_writer_map.go @@ -207,7 +207,8 @@ func (w *MapFieldWriter) setPrimitive( k := strings.Join(addr, ".") if v == nil { - delete(w.result, k) + // The empty string here means the value is removed. + w.result[k] = "" return nil }
schema: delete non existing values We need to set the value to an empty value so the state file does indeed change the value. Otherwise the obsolote value is still intact and doesn't get changed at all. This means `terraform show` still shows the obsolote value when the particular value is not existing anymore. This is due the AWS API which is returning a null instead of an empty string.
hashicorp_terraform
train
go
3ffbecd487688766b4dda6d5fb18371328b80004
diff --git a/src/org/javasimon/EnabledManager.java b/src/org/javasimon/EnabledManager.java index <HASH>..<HASH> 100644 --- a/src/org/javasimon/EnabledManager.java +++ b/src/org/javasimon/EnabledManager.java @@ -17,7 +17,7 @@ import java.lang.reflect.InvocationTargetException; class EnabledManager implements Manager { static final Manager INSTANCE = new EnabledManager(); - private static final int CLIENT_CODE_STACK_INDEX = 3; + private static final int CLIENT_CODE_STACK_INDEX = 4; // and 3 for JDK 6 :-) private final Map<String, AbstractSimon> allSimons = new HashMap<String, AbstractSimon>();
stack index seems to be different for JDK 6 and 5 ;-) fixed for 5 non, later might be derived from JVM version git-svn-id: <URL>
virgo47_javasimon
train
java
4b04f72430a01b85ba65160b7637f4c9ad16c3fa
diff --git a/src/main/java/com/scaleset/geo/Feature.java b/src/main/java/com/scaleset/geo/Feature.java index <HASH>..<HASH> 100644 --- a/src/main/java/com/scaleset/geo/Feature.java +++ b/src/main/java/com/scaleset/geo/Feature.java @@ -2,6 +2,7 @@ package com.scaleset.geo; import com.fasterxml.jackson.annotation.JsonAnyGetter; import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonInclude; import com.vividsolutions.jts.geom.Coordinate; import com.vividsolutions.jts.geom.Envelope; import com.vividsolutions.jts.geom.Geometry; @@ -10,6 +11,7 @@ import com.vividsolutions.jts.geom.GeometryFactory; import java.util.HashMap; import java.util.Map; +@JsonInclude(JsonInclude.Include.NON_NULL) public class Feature { private final static GeometryFactory factory = new GeometryFactory(); @@ -39,7 +41,6 @@ public class Feature { return id; } - @JsonAnyGetter public Map<String, Object> getProperties() { return properties; } @@ -48,7 +49,6 @@ public class Feature { return type; } - @JsonAnySetter public Object put(String key, Object value) { return properties.put(key, value); }
update Feature to properly serialize properties
scaleset_scaleset-geo
train
java
e6e4f7c4100608f3732346cb709d9751c33e904e
diff --git a/command/agent/kvs_endpoint.go b/command/agent/kvs_endpoint.go index <HASH>..<HASH> 100644 --- a/command/agent/kvs_endpoint.go +++ b/command/agent/kvs_endpoint.go @@ -47,10 +47,10 @@ func (s *HTTPServer) KVSGet(resp http.ResponseWriter, req *http.Request, args *s // Make the RPC var out structs.IndexedDirEntries - defer setMeta(resp, &out.QueryMeta) if err := s.agent.RPC(method, &args, &out); err != nil { return nil, err } + setMeta(resp, &out.QueryMeta) // Check if we get a not found if len(out.Entries) == 0 {
agent: Write out the meta data before a potential <I>
hashicorp_consul
train
go
0a4644e85db01b7428327d035d0d67d5953e7e74
diff --git a/spec/lib/gemsmith/authenticators/ruby_gems_spec.rb b/spec/lib/gemsmith/authenticators/ruby_gems_spec.rb index <HASH>..<HASH> 100644 --- a/spec/lib/gemsmith/authenticators/ruby_gems_spec.rb +++ b/spec/lib/gemsmith/authenticators/ruby_gems_spec.rb @@ -10,7 +10,7 @@ RSpec.describe Gemsmith::Authenticators::RubyGems do let(:client) { instance_spy Net::HTTP } let(:request) { instance_spy Net::HTTP::Get } let(:api_key) { "b656c8cfc5b9d6d661520345b956cb16" } - let(:response) { double :response, body: api_key } + let(:response) { instance_spy Net::HTTPResponse, body: api_key } before do allow(client).to receive(:request).with(request).and_return(response)
Fixed Rubocop RSpec/VerifiedDoubles issue.
bkuhlmann_gemsmith
train
rb
066f6941330e66bf511ecb6784e25dce8386292e
diff --git a/examples/with-chakra-ui/src/pages/_app.js b/examples/with-chakra-ui/src/pages/_app.js index <HASH>..<HASH> 100644 --- a/examples/with-chakra-ui/src/pages/_app.js +++ b/examples/with-chakra-ui/src/pages/_app.js @@ -5,12 +5,12 @@ import theme from '../theme' class App extends NextApp { render() { - const { Component } = this.props + const { Component, pageProps } = this.props return ( <ThemeProvider theme={theme}> <ColorModeProvider> <CSSReset /> - <Component /> + <Component {...pageProps} /> </ColorModeProvider> </ThemeProvider> )
example(chakra-ui): pass through pageProps in custom app (#<I>) Took me a while to figure out why the simple data fetching examples weren't working in my project, which I based off this template. Here's the fix.
zeit_next.js
train
js
a5a2a04eafe00b6ea4daf594801769d544f1dcf3
diff --git a/pandas/io/tests/test_parsers.py b/pandas/io/tests/test_parsers.py index <HASH>..<HASH> 100644 --- a/pandas/io/tests/test_parsers.py +++ b/pandas/io/tests/test_parsers.py @@ -24,6 +24,9 @@ from pandas.util.testing import assert_almost_equal, assert_frame_equal import pandas._tseries as lib from pandas.util import py3compat +from numpy.testing.decorators import slow + + class TestParsers(unittest.TestCase): data1 = """index,A,B,C,D foo,2,3,4,5 @@ -764,9 +767,10 @@ bar""" df = read_fwf(StringIO(data3), colspecs=colspecs, delimiter='~', header=None) assert_frame_equal(df, expected) + @slow def test_url(self): # HTTP(S) - url = 'https://raw.github.com/jseabold/pandas/read-table-url/pandas/io/tests/salary.table' + url = 'https://raw.github.com/pydata/pandas/master/pandas/io/tests/salary.table' url_table = read_table(url) dirpath = curpath() localtable = os.path.join(dirpath, 'salary.table')
TST: point test url to github for #<I>
pandas-dev_pandas
train
py
ccb7ca2b0d7bde5a2577b373eb289887bb25c58a
diff --git a/src/main/java/com/amazon/carbonado/repo/replicated/ReplicationTrigger.java b/src/main/java/com/amazon/carbonado/repo/replicated/ReplicationTrigger.java index <HASH>..<HASH> 100644 --- a/src/main/java/com/amazon/carbonado/repo/replicated/ReplicationTrigger.java +++ b/src/main/java/com/amazon/carbonado/repo/replicated/ReplicationTrigger.java @@ -152,7 +152,7 @@ class ReplicationTrigger<S extends Storable> extends Trigger<S> { if (!master.tryUpdate()) { // Master record does not exist. To ensure consistency, // delete record from replica. - tryDeleteReplica(replica); + repair(replica); throw abortTry(); } } else { @@ -161,7 +161,7 @@ class ReplicationTrigger<S extends Storable> extends Trigger<S> { } catch (PersistNoneException e) { // Master record does not exist. To ensure consistency, // delete record from replica. - tryDeleteReplica(replica); + repair(replica); throw e; } }
Repair unmatched replica without rolling back.
Carbonado_Carbonado
train
java
cced3612fcedae7936e471ad5ae3e5ffda2910ca
diff --git a/benchmark/ycsb/src/main/java/com/impetus/kundera/ycsb/runner/YCSBRunner.java b/benchmark/ycsb/src/main/java/com/impetus/kundera/ycsb/runner/YCSBRunner.java index <HASH>..<HASH> 100644 --- a/benchmark/ycsb/src/main/java/com/impetus/kundera/ycsb/runner/YCSBRunner.java +++ b/benchmark/ycsb/src/main/java/com/impetus/kundera/ycsb/runner/YCSBRunner.java @@ -199,7 +199,7 @@ public abstract class YCSBRunner } } - // sendMail(); + sendMail(); } protected String getCommandString(String clazz, String workLoad)
Enabled sendmail for YCSB
Impetus_Kundera
train
java
9fab7cbab7e1030afff553ebf838ce619cb0e5f6
diff --git a/src/WPUpdatePhp.php b/src/WPUpdatePhp.php index <HASH>..<HASH> 100644 --- a/src/WPUpdatePhp.php +++ b/src/WPUpdatePhp.php @@ -74,11 +74,8 @@ class WPUpdatePhp { */ private function load_version_notice( $callback ) { if ( is_admin() && ! defined( 'DOING_AJAX' ) ) { - if ( ! is_main_network() ) { - add_action( 'admin_notices', $callback ); - } else { - add_action( 'admin_head', $callback ); - } + add_action( 'admin_notices', $callback ); + add_action( 'network_admin_notices', $callback ); } }
correct hook for displaying network notices
WPupdatePHP_wp-update-php
train
php
da7399f9d5570a95bb6502860988b8ab9d6eb031
diff --git a/Kwf/Assets/WebpackConfig.php b/Kwf/Assets/WebpackConfig.php index <HASH>..<HASH> 100644 --- a/Kwf/Assets/WebpackConfig.php +++ b/Kwf/Assets/WebpackConfig.php @@ -34,7 +34,7 @@ class Kwf_Assets_WebpackConfig if ($ret = Kwf_Config::getValue('debug.webpackDevServerPublic')) { return $ret; } else { - return trim(`hostname`).':'.self::getDevServerPort(); + return Kwf_Config::getValue('server.domain').':'.self::getDevServerPort(); } } public static function getDevServerProxy()
dev server should always start on server.domain because certificate will be added for this domain not for hostname
koala-framework_koala-framework
train
php
df86339c4c1cdce9e7b126ca10fa8e1caa9f7ae0
diff --git a/test/test_service.py b/test/test_service.py index <HASH>..<HASH> 100644 --- a/test/test_service.py +++ b/test/test_service.py @@ -4,7 +4,6 @@ Tests for the ``service`` module. """ -import logging import threading import time @@ -56,12 +55,16 @@ class TimedService(BasicService): """ Test service that runs for a certain amount of time. """ - def __init__(self, duration): + def __init__(self, run=0, on_terminate=0): super(TimedService, self).__init__() - self.duration = duration + self.run_duration = run + self.on_terminate_duration = on_terminate def run(self): - time.sleep(self.duration) + time.sleep(self.run_duration) + + def on_terminate(self): + time.sleep(self.on_terminate_duration) class WaitingService(BasicService): @@ -137,3 +140,11 @@ class TestService(object): service.kill() assert_not_running() + def test_long_on_terminate(self): + """ + Test a long duration of ``on_terminate``. + """ + service = start(TimedService(0.2, 1)) + service.stop() # Activates ``on_terminate`` + time.sleep(0.1) # ``run`` has now finished + assert_running()
Added test for long running ``on_terminate``.
torfsen_service
train
py
0fbe7d07019adb034648967f6da8298ab8d4af47
diff --git a/lib/dragonfly/function_manager.rb b/lib/dragonfly/function_manager.rb index <HASH>..<HASH> 100644 --- a/lib/dragonfly/function_manager.rb +++ b/lib/dragonfly/function_manager.rb @@ -52,7 +52,7 @@ module Dragonfly end def inspect - to_s.sub(/>$/, " with functions: #{functions.keys.map{|k| k.to_s }.sort.join(', ')} >") + "<#{self.class.name} with functions: #{functions.keys.map{|k| k.to_s }.sort.join(', ')} >" end private
Slightly better Processor/Analyser/Generator/Encoder inspect output
markevans_dragonfly
train
rb
e84e657209256f0d64d7ce425c963901a94b6b74
diff --git a/salt/crypt.py b/salt/crypt.py index <HASH>..<HASH> 100644 --- a/salt/crypt.py +++ b/salt/crypt.py @@ -585,11 +585,11 @@ class AsyncAuth(object): if self.opts.get('syndic_master', False): # Is syndic syndic_finger = self.opts.get('syndic_finger', self.opts.get('master_finger', False)) if syndic_finger: - if salt.utils.pem_finger(m_pub_fn) != syndic_finger: + if salt.utils.pem_finger(m_pub_fn, sum_type=self.opts['hash_type']) != syndic_finger: self._finger_fail(syndic_finger, m_pub_fn) else: if self.opts.get('master_finger', False): - if salt.utils.pem_finger(m_pub_fn) != self.opts['master_finger']: + if salt.utils.pem_finger(m_pub_fn, sum_type=self.opts['hash_type']) != self.opts['master_finger']: self._finger_fail(self.opts['master_finger'], m_pub_fn) auth['publish_port'] = payload['publish_port'] raise tornado.gen.Return(auth)
Use hash_type for pem_finger in crypt
saltstack_salt
train
py
500fe144ff2a0257fd20070c52ee9dbc3c4ec93a
diff --git a/openquake/risk/job/general.py b/openquake/risk/job/general.py index <HASH>..<HASH> 100644 --- a/openquake/risk/job/general.py +++ b/openquake/risk/job/general.py @@ -467,9 +467,9 @@ def compute_bcr_for_block(job_id, points, get_loss_curve, vulnerability function object and asset object and is supposed to return a loss curve. :return: - A list of dictionaries -- one dictionary for each point in the block. - Dict values are three-item tuples with point row, column and a mapping - of asset ids to the BCR value. + A list of three-item tuples, one tuple per point in the block. Each + tuple consists of point row, point column and a mapping of point's + asset ids to the BCR value. """ # too many local vars (16/15) -- pylint: disable=R0914 result = []
risk/job/general.py: more correct docstring in compute_bcr_for_block() Former-commit-id: ff<I>ef<I>bc3af<I>a<I>c0a<I>f9
gem_oq-engine
train
py
7e6a0941ea6694f168d2ac1c1baef6a918ba134f
diff --git a/liquibase-core/src/main/java/liquibase/snapshot/jvm/ViewSnapshotGenerator.java b/liquibase-core/src/main/java/liquibase/snapshot/jvm/ViewSnapshotGenerator.java index <HASH>..<HASH> 100644 --- a/liquibase-core/src/main/java/liquibase/snapshot/jvm/ViewSnapshotGenerator.java +++ b/liquibase-core/src/main/java/liquibase/snapshot/jvm/ViewSnapshotGenerator.java @@ -82,7 +82,7 @@ public class ViewSnapshotGenerator extends JdbcSnapshotGenerator { // remove strange zero-termination seen on some Oracle view definitions int length = definition.length(); if (definition.charAt(length-1) == 0) { - definition = definition.substring(0, length-2); + definition = definition.substring(0, length-1); } if (database instanceof InformixDatabase) {
substring is annoying. endindex is not index of last character, endindex-1 is
liquibase_liquibase
train
java
df914734d5d97979b6ab3ce3080f127f17d6305e
diff --git a/src/main/java/hex/singlenoderf/SpeeDRFModel.java b/src/main/java/hex/singlenoderf/SpeeDRFModel.java index <HASH>..<HASH> 100644 --- a/src/main/java/hex/singlenoderf/SpeeDRFModel.java +++ b/src/main/java/hex/singlenoderf/SpeeDRFModel.java @@ -175,7 +175,7 @@ public class SpeeDRFModel extends Model implements Job.Progress { return m.score_each || m.t_keys.length == 2 || m.t_keys.length == m.N; } - @Override public ConfusionMatrix cm() { return cms[cms.length-1]; } + @Override public ConfusionMatrix cm() { return validAUC == null ? cms[cms.length-1] : validAUC.CM(); } private static void scoreIt(SpeeDRFModel m, SpeeDRFModel old, final boolean score_new_only) { // Gather the results
PUB-<I> use the AUC data for grid search reporting
h2oai_h2o-2
train
java
2e61ca18785ae13eb297a2c04b999589126f4d37
diff --git a/lib/specjour/cucumber/distributed_formatter.rb b/lib/specjour/cucumber/distributed_formatter.rb index <HASH>..<HASH> 100644 --- a/lib/specjour/cucumber/distributed_formatter.rb +++ b/lib/specjour/cucumber/distributed_formatter.rb @@ -1,5 +1,4 @@ module Specjour::Cucumber - ::Term::ANSIColor.coloring = true class DistributedFormatter < ::Cucumber::Formatter::Progress def initialize(step_mother, io, options)
No longer need to set coloring for cucumber output
sandro_specjour
train
rb
f4a70d9a2e5ecc66309325b5f5396cc0ad9316d8
diff --git a/lib/app/helper_model/model.js b/lib/app/helper_model/model.js index <HASH>..<HASH> 100644 --- a/lib/app/helper_model/model.js +++ b/lib/app/helper_model/model.js @@ -277,6 +277,17 @@ Model.setStatic(function setDocumentProperty(key, getter, setter, on_server) { }); /** + * The schema + * + * @type {Schema} + */ +Model.setStaticProperty(function schema() { + if (this.prototype.model_info) { + return this.prototype.model_info.schema; + } +}); + +/** * The model name * * @type {String}
Set the schema property on the client-side model's constructor too
skerit_alchemy
train
js
394a02885d2b33fb69676b34af917004751c1322
diff --git a/ddl/backfilling.go b/ddl/backfilling.go index <HASH>..<HASH> 100644 --- a/ddl/backfilling.go +++ b/ddl/backfilling.go @@ -320,7 +320,7 @@ func (w *backfillWorker) run(d *ddlCtx, bf backfiller, job *model.Job) { }) failpoint.Inject("mockBackfillSlow", func() { - time.Sleep(30 * time.Millisecond) + time.Sleep(100 * time.Millisecond) }) // Dynamic change batch size.
ddl: fix unstable test in the TestCancel (#<I>) close pingcap/tidb#<I>
pingcap_tidb
train
go
4f8494a946a97facdd0d1ee906b87c89ca6da9df
diff --git a/src/Local/LocalBuild.php b/src/Local/LocalBuild.php index <HASH>..<HASH> 100644 --- a/src/Local/LocalBuild.php +++ b/src/Local/LocalBuild.php @@ -133,6 +133,7 @@ class LocalBuild $finder = new Finder(); $finder->in($repositoryRoot) ->ignoreDotFiles(false) + ->notPath('builds') ->name('.platform.app.yaml') ->depth('> 0') ->depth('< 5');
For safety when building outside project context, don't look for apps in 'builds'
platformsh_platformsh-cli
train
php
3810dfb62b09fb840ea15fbd112af7d03e8a78c9
diff --git a/pupa/cli/commands/update.py b/pupa/cli/commands/update.py index <HASH>..<HASH> 100644 --- a/pupa/cli/commands/update.py +++ b/pupa/cli/commands/update.py @@ -140,7 +140,7 @@ class Command(BaseCommand): if 'people' in scraper_types: report[session].update(scraper.scrape_people()) elif 'bills' in scraper_types: - report[session].update(scrape_bills()) + report[session].update(scraper.scrape_bills()) elif 'events' in scraper_types: report[session].update(scraper.scrape_events()) elif 'votes' in scraper_types:
fix bug in scrape_bills
opencivicdata_pupa
train
py
a0fe3cf3030dbbf09025c69ce75a69b326565dd8
diff --git a/deployutils/__init__.py b/deployutils/__init__.py index <HASH>..<HASH> 100644 --- a/deployutils/__init__.py +++ b/deployutils/__init__.py @@ -22,4 +22,4 @@ # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -__version__ = '0.5.9-dev' +__version__ = '0.5.9'
releases <I> to pypi
djaodjin_djaodjin-deployutils
train
py
2ba0a4369af0860975250b5fd3d81c563822a6a1
diff --git a/workflow/controller/workflowpod.go b/workflow/controller/workflowpod.go index <HASH>..<HASH> 100644 --- a/workflow/controller/workflowpod.go +++ b/workflow/controller/workflowpod.go @@ -535,6 +535,14 @@ func (woc *wfOperationCtx) createEnvVars() []apiv1.EnvVar { Name: common.EnvVarContainerRuntimeExecutor, Value: woc.getContainerRuntimeExecutor(), }, + // This flag was introduced in Go 15 and will be removed in Go 16. + // x509: cannot validate certificate for ... because it doesn't contain any IP SANs + // https://github.com/argoproj/argo-workflows/issues/5563 - Upgrade to Go 16 + // https://github.com/golang/go/issues/39568 + { + Name: "GODEBUG", + Value: "x509ignoreCN=0", + }, } if woc.controller.Config.Executor != nil { execEnvVars = append(execEnvVars, woc.controller.Config.Executor.Env...)
fix(executor): GODEBUG=x<I>ignoreCN=0 (#<I>)
argoproj_argo
train
go
5724d386a40a1f128b44f23dd7e5f37786daf238
diff --git a/lib/erector/rails/rails_version.rb b/lib/erector/rails/rails_version.rb index <HASH>..<HASH> 100644 --- a/lib/erector/rails/rails_version.rb +++ b/lib/erector/rails/rails_version.rb @@ -1,6 +1,6 @@ module Erector module Rails - RAILS_VERSION = "2.2.2" - RAILS_VERSION_TAG = "v2.2.2" + RAILS_VERSION = "2.2.0" + RAILS_VERSION_TAG = "v2.2.0" end end diff --git a/spec/rails_root/config/boot.rb b/spec/rails_root/config/boot.rb index <HASH>..<HASH> 100644 --- a/spec/rails_root/config/boot.rb +++ b/spec/rails_root/config/boot.rb @@ -15,6 +15,8 @@ unless defined?(Rails::Initializer) rails_dir = "#{RAILS_ROOT}/vendor/rails" system("rm -rf #{RAILS_ROOT}/vendor/plugins/erector") + system("cd #{RAILS_ROOT}/../.. && rake switch_to_rails_version_tag") + Dir["#{rails_dir}/*"].each do |path| $:.unshift("#{path}/lib") if File.directory?("#{path}/lib") end
Spec suite passes for Rails <I> boot invokes the switch_to_rails_version_tag rake task.
erector_erector
train
rb,rb
a579a0701aec334368667243adaef9ff9041a68c
diff --git a/resources/lang/he-IL/cachet.php b/resources/lang/he-IL/cachet.php index <HASH>..<HASH> 100644 --- a/resources/lang/he-IL/cachet.php +++ b/resources/lang/he-IL/cachet.php @@ -117,9 +117,18 @@ return [ ], ], + // Meta descriptions + 'meta' => [ + 'description' => [ + 'incident' => 'Details and updates about the :name incident that occurred on :date', + 'schedule' => 'Details about the scheduled maintenance period :name starting :startDate', + 'subscribe' => 'Subscribe to :app in order to receive updates of incidents and scheduled maintenance periods', + 'overview' => 'Stay up to date with the latest service updates from :app.', + ], + ], + // Other 'home' => 'Home', - 'description' => 'Stay up to date with the latest service updates from :app.', 'powered_by' => 'Powered by <a href="https://cachethq.io" class="links">Cachet</a>.', 'timezone' => 'Times are shown in :timezone.', 'about_this_site' => 'About This Site',
New translations cachet.php (Hebrew)
CachetHQ_Cachet
train
php
911151aa493b42c725b8b7523f4c5a9f2fd6ac40
diff --git a/lib/gpio.js b/lib/gpio.js index <HASH>..<HASH> 100644 --- a/lib/gpio.js +++ b/lib/gpio.js @@ -191,6 +191,8 @@ GPIO.prototype.set = function(v, fn) { self.emit('change', v); if(typeof callback === 'function') callback(); }); + } else { + if(typeof callback === 'function') callback(); } } };
call the callback anyway if value as change or not
EnotionZ_gpio
train
js
717417d521c699fcaff5b0df82a15ef8c81df2dc
diff --git a/src/test_case.php b/src/test_case.php index <HASH>..<HASH> 100644 --- a/src/test_case.php +++ b/src/test_case.php @@ -401,7 +401,6 @@ class SimpleFileLoader { $existing_classes = get_declared_classes(); $existing_globals = get_defined_vars(); - echo $test_file.PHP_EOL; include_once $test_file; $new_globals = get_defined_vars(); $this->makeFileVariablesGlobal($existing_globals, $new_globals);
Remove stray echo: PHP 7 now errors when calling `ini_set` after headers have already been sent. This `echo` statement results in a write that in turn triggers the error scenario. It looks like the echo was possibly commited by mistake, as the other changes in b7e<I>a<I>b<I>bf<I>fc<I>bdcc<I> seem unrelated. Removing the echo doesn't appear to affect tests in any negative way.
simpletest_simpletest
train
php
90d4e1d0345da343c10a5b6f65a7b73c4bdc2f99
diff --git a/test/com/google/javascript/jscomp/IntegrationTest.java b/test/com/google/javascript/jscomp/IntegrationTest.java index <HASH>..<HASH> 100644 --- a/test/com/google/javascript/jscomp/IntegrationTest.java +++ b/test/com/google/javascript/jscomp/IntegrationTest.java @@ -2122,6 +2122,23 @@ public class IntegrationTest extends IntegrationTestCase { assertEquals(1, compiler.getWarnings().length); } + public void testInlineProperties() { + CompilerOptions options = createCompilerOptions(); + CompilationLevel level = CompilationLevel.ADVANCED_OPTIMIZATIONS; + level.setOptionsForCompilationLevel(options); + level.setTypeBasedOptimizationOptions(options); + + String code = "" + + "var ns = {};\n" + + "/** @constructor */\n" + + "ns.C = function () {this.someProperty = 1}\n" + + "alert(new ns.C().someProperty + new ns.C().someProperty);\n"; + assertTrue(options.inlineProperties); + assertTrue(options.collapseProperties); + // CollapseProperties used to prevent inlining this property. + test(options, code, "alert(2);"); + } + /** Creates a CompilerOptions object with google coding conventions. */ @Override protected CompilerOptions createCompilerOptions() {
Add a InlineProperties integration test. R=nicksantos DELTA=<I> (<I> added, 0 deleted, 0 changed) Revision created by MOE tool push_codebase. MOE_MIGRATION=<I> git-svn-id: <URL>
google_closure-compiler
train
java
680e4b5438a2fbcc606ce217b213b108016cfcf9
diff --git a/goon.go b/goon.go index <HASH>..<HASH> 100644 --- a/goon.go +++ b/goon.go @@ -59,7 +59,8 @@ type Goon struct { } func memkey(k *datastore.Key) string { - return k.Encode() + // Versioning, so that incompatible changes to the cache system won't cause problems + return "g1:" + k.Encode() } // NewGoon creates a new Goon object from the given request.
Added versioning to cache keys to prevent incompatible changes from doing harm.
mjibson_goon
train
go
67e12af772bd12d3435c3349c582a830dd82d7bf
diff --git a/lib/agent.js b/lib/agent.js index <HASH>..<HASH> 100644 --- a/lib/agent.js +++ b/lib/agent.js @@ -72,6 +72,22 @@ function Agent(options) { return; } + // Avoid duplicitive timeout events by removing timeout listeners set on + // socket by previous requests. node does not do this normally because it + // assumes sockets are too short-lived for it to matter. It becomes a + // problem when sockets are being reused. Steps are being taken to fix + // this issue upstream in node v0.10.0. + // + // See https://github.com/joyent/node/commit/451ff1540ab536237e8d751d241d7fc3391a4087 + socket.removeAllListeners('timeout'); + if (self.maxKeepAliveTime) { + // Restore the socket's setTimeout() that was remove as collateral + // damage. + socket.setTimeout(self.maxKeepAliveTime, function () { + socket.destroy(); + }); + } + // keepalive if (!self.unusedSockets[name]) { self.unusedSockets[name] = [];
Remove timeout listeners set from previous requests.
node-modules_agentkeepalive
train
js
3d4c31c675f5de1f729f9d4447d7982c74ac6078
diff --git a/Control.FullScreen.js b/Control.FullScreen.js index <HASH>..<HASH> 100644 --- a/Control.FullScreen.js +++ b/Control.FullScreen.js @@ -20,7 +20,7 @@ L.Control.FullScreen = L.Control.extend({ } } else { container = L.DomUtil.create('div', containerClass); - className = '-fullscreen'; + className = '-fullscreen leaflet-bar leaflet-bar-part last'; } this._createButton(this.options.title, containerClass + className, container, this.toogleFullScreen, map);
Update Control.FullScreen.js Change a fullscreen button style when the button isn't a part of a ZoomControl.
brunob_leaflet.fullscreen
train
js
b959f0d973be252756e3371077f654dde692d4d0
diff --git a/h264parser/parser.go b/h264parser/parser.go index <HASH>..<HASH> 100644 --- a/h264parser/parser.go +++ b/h264parser/parser.go @@ -303,6 +303,10 @@ func ParseSPS(data []byte) (self SPSInfo, err error) { R: bytes.NewReader(data), } + if _, err = r.ReadBits(8); err != nil { + return + } + if self.ProfileIdc, err = r.ReadBits(8); err != nil { return }
ParseSPS should skip first 1 bit of SPS
nareix_joy4
train
go
23287716b7fc44e2b34de7f80a9cb8f101a0cc98
diff --git a/presto-main/src/main/java/com/facebook/presto/byteCode/Block.java b/presto-main/src/main/java/com/facebook/presto/byteCode/Block.java index <HASH>..<HASH> 100644 --- a/presto-main/src/main/java/com/facebook/presto/byteCode/Block.java +++ b/presto-main/src/main/java/com/facebook/presto/byteCode/Block.java @@ -563,12 +563,34 @@ public class Block implements ByteCodeNode return this; } + public Block dup(Class<?> type) + { + if (type == long.class || type == double.class) { + nodes.add(OpCodes.DUP2); + } + else { + nodes.add(OpCodes.DUP); + } + return this; + } + public Block pop() { nodes.add(OpCodes.POP); return this; } + public Block pop(Class<?> type) + { + if (type == long.class || type == double.class) { + nodes.add(OpCodes.POP2); + } + else { + nodes.add(OpCodes.POP); + } + return this; + } + public Block swap() { nodes.add(OpCodes.SWAP);
Add dup and pop methods that handle longs and double
prestodb_presto
train
java
744fe744727364f9d0daadda34ecb5dee3f1693d
diff --git a/lib/statesman/adapters/active_record_queries.rb b/lib/statesman/adapters/active_record_queries.rb index <HASH>..<HASH> 100644 --- a/lib/statesman/adapters/active_record_queries.rb +++ b/lib/statesman/adapters/active_record_queries.rb @@ -8,7 +8,7 @@ module Statesman raise NotImplementedError, "#{missing_methods.join(', ')} method(s) should be defined on " \ - "the model. Alternatively, use the new form of `extend " \ + "the model. Alternatively, use the new form of `include " \ "Statesman::Adapters::ActiveRecordQueries[" \ "transition_class: MyTransition, " \ "initial_state: :some_state]`"
Change extend to include The message says you need to extend Statesman::Adapters::ActiveRecordQueries, but you should use include instead.
gocardless_statesman
train
rb
24309ff7eb90643d5566c30ce051f35d97d8f306
diff --git a/py/testdir_single_jvm/test_rf_covtype_fvec.py b/py/testdir_single_jvm/test_rf_covtype_fvec.py index <HASH>..<HASH> 100644 --- a/py/testdir_single_jvm/test_rf_covtype_fvec.py +++ b/py/testdir_single_jvm/test_rf_covtype_fvec.py @@ -8,7 +8,7 @@ import h2o, h2o_cmd, h2o_rf as h2o_rf, h2o_hosts, h2o_import as h2i, h2o_exec, h paramDict = { 'response': 'C54', 'cols': None, - 'ignored_cols_by_name': '1,2,6,7,8', + 'ignored_cols_by_name': 'C1,C2,C6,C7,C8', 'classification': None, 'validation': None, 'ntrees': 10,
ignored_cols_by_name needs to be C* for numbers
h2oai_h2o-2
train
py
041c71d03f26b027e4cb6f6fbd32b35dfe3c1fb9
diff --git a/src/ConfigTrait.php b/src/ConfigTrait.php index <HASH>..<HASH> 100644 --- a/src/ConfigTrait.php +++ b/src/ConfigTrait.php @@ -35,6 +35,24 @@ trait ConfigTrait } /** + * @param string $key + * @param Enum $type + * @param mixed $default + * @return array|false|mixed|null|string + */ + protected function getEnvStrict(string $key, Enum $type, $default = null) + { + $value = $this->getEnv($key, $default); + if (is_null($value)) { + return $value; + } + + $type->validate($value); + + return $value; + } + + /** * Support method for getEnv * Can be used as second argument: *
Add getEnvStrict method to ConfigTrait
Horat1us_environment-config
train
php
ddcf3438bf7cc1e5087da8b41e0d583356733fdb
diff --git a/azurerm/internal/services/recoveryservices/tests/data_source_backup_policy_vm_test.go b/azurerm/internal/services/recoveryservices/tests/data_source_backup_policy_vm_test.go index <HASH>..<HASH> 100644 --- a/azurerm/internal/services/recoveryservices/tests/data_source_backup_policy_vm_test.go +++ b/azurerm/internal/services/recoveryservices/tests/data_source_backup_policy_vm_test.go @@ -36,7 +36,7 @@ func testAccDataSourceBackupPolicyVm_basic(data acceptance.TestData) string { data "azurerm_backup_policy_vm" "test" { name = azurerm_backup_policy_vm.test.name - recovery_vault_name = azurerm_backup_vault.test.name + recovery_vault_name = azurerm_recovery_services_vault.test.name resource_group_name = azurerm_resource_group.test.name } `, template)
Data source `azurerm_backup_policy_vm` fix acctests (#<I>)
terraform-providers_terraform-provider-azurerm
train
go
a2d55958275ea65dfa7e15b0b408088b05bd7067
diff --git a/moderngl/__init__.py b/moderngl/__init__.py index <HASH>..<HASH> 100644 --- a/moderngl/__init__.py +++ b/moderngl/__init__.py @@ -2559,7 +2559,7 @@ class Context: :py:class:`VertexArray` object ''' - content = [(buffer, detect_format(program, attributes), *attributes)] + content = [(buffer, detect_format(program, attributes)) + attributes] return self.vertex_array(program, content, index_buffer) def program(self, *, vertex_shader, fragment_shader=None, geometry_shader=None,
fix py <I> support
moderngl_moderngl
train
py
e2995c769aa66ce364609e4cf6f83ffaa7d7d03d
diff --git a/lib/service.js b/lib/service.js index <HASH>..<HASH> 100755 --- a/lib/service.js +++ b/lib/service.js @@ -120,11 +120,16 @@ class Service { _get (id, params = {}) { params.query = params.query || {}; + const query = Object.assign({}, filter(params.query || {}).query); + + if (id !== null) { + query[this.id] = id; + } const discriminator = (params.query || {})[this.discriminatorKey] || this.discriminatorKey; const model = this.discriminators[discriminator] || this.Model; let modelQuery = model - .findOne({ [this.id]: id }); + .findOne(query); // Handle $populate if (params.query.$populate) { @@ -149,7 +154,8 @@ class Service { .exec() .then(data => { if (!data) { - throw new errors.NotFound(`No record found for id '${id}'`); + const msg = query[this.id] ? `No record found for id '${query[this.id]}'` : 'No record found'; + throw new errors.NotFound(msg); } return data;
Allows params for get requests
feathers-plus_feathers-mongoose-advanced
train
js
9303232db211bc226684debf4ac7619209170130
diff --git a/src/Sonata/ProductBundle/Controller/ProductAdminController.php b/src/Sonata/ProductBundle/Controller/ProductAdminController.php index <HASH>..<HASH> 100644 --- a/src/Sonata/ProductBundle/Controller/ProductAdminController.php +++ b/src/Sonata/ProductBundle/Controller/ProductAdminController.php @@ -80,7 +80,8 @@ class ProductAdminController extends Controller $form = $this->createFormBuilder(null, array()) ->add('number', 'integer', array( 'required' => true, - 'label' => $this->getTranslator()->trans('variations_number', array(), 'SonataProductBundle'))) + 'label' => $this->getTranslator()->trans('variations_number', array(), 'SonataProductBundle'), + 'attr' => array('min' => 1))) ->getForm(); if ($this->getRequest()->isMethod('POST')) {
SONATA-<I> - Fix variation creation to have a minimum value of 1
sonata-project_ecommerce
train
php
1a5085b78e9955c670ddf8a750638aac36d92ddb
diff --git a/integration/users_test.go b/integration/users_test.go index <HASH>..<HASH> 100644 --- a/integration/users_test.go +++ b/integration/users_test.go @@ -12,7 +12,7 @@ func init() { client = initTest() } -func TestCreateAndDeleteUser(t *testing.T) { +func TestUserCreateAndDelete(t *testing.T) { handle := "[email protected]" name := "tester" @@ -31,8 +31,6 @@ func TestCreateAndDeleteUser(t *testing.T) { } }() - fmt.Print(user.Handle, handle) - assert.Equal(t, *user.Handle, handle) assert.Equal(t, *user.Name, name)
GH-<I>: Fixup of user test.
zorkian_go-datadog-api
train
go
af840c75b91cef9c5440015e0d8d787a7665cad8
diff --git a/modules/social_features/social_profile/src/Plugin/EntityReferenceSelection/UserSelection.php b/modules/social_features/social_profile/src/Plugin/EntityReferenceSelection/UserSelection.php index <HASH>..<HASH> 100644 --- a/modules/social_features/social_profile/src/Plugin/EntityReferenceSelection/UserSelection.php +++ b/modules/social_features/social_profile/src/Plugin/EntityReferenceSelection/UserSelection.php @@ -72,12 +72,7 @@ class UserSelection extends UserSelectionBase { } $query = parent::buildEntityQuery(NULL, $match_operator); - - $or = $query->orConditionGroup(); - $or->condition('uid', $ids, 'IN'); - - $query->condition($or); - $query->condition('uid', $this->currentUser->id(), '!='); + $query->condition('uid', $ids, 'IN'); return $query; }
#<I> by ronaldtebrake: make sure we dont filter out the current user so users can select themselves in entityreference selectors (#<I>)
goalgorilla_open_social
train
php
ed279c66f5f2fa56c01bbb0aeb24d8b247cf6d6e
diff --git a/translator/src/main/java/com/google/devtools/j2objc/gen/ObjectiveCSourceFileGenerator.java b/translator/src/main/java/com/google/devtools/j2objc/gen/ObjectiveCSourceFileGenerator.java index <HASH>..<HASH> 100644 --- a/translator/src/main/java/com/google/devtools/j2objc/gen/ObjectiveCSourceFileGenerator.java +++ b/translator/src/main/java/com/google/devtools/j2objc/gen/ObjectiveCSourceFileGenerator.java @@ -599,7 +599,7 @@ public abstract class ObjectiveCSourceFileGenerator extends SourceFileGenerator for (Iterator<SingleVariableDeclaration> iter = function.getParameters().iterator(); iter.hasNext(); ) { IVariableBinding var = iter.next().getVariableBinding(); - String paramType = NameTable.getObjCType(var.getType()); + String paramType = NameTable.getSpecificObjCType(var.getType()); paramType += (paramType.endsWith("*") ? "" : " "); sb.append(paramType + NameTable.getName(var)); if (iter.hasNext()) {
Fix function signatures with generic types to declare the known bound on the parameter types.
google_j2objc
train
java
3e8f1e60b153452e10a9ac35c913c6356face7d4
diff --git a/src/Http/Controllers/WebhookController.php b/src/Http/Controllers/WebhookController.php index <HASH>..<HASH> 100644 --- a/src/Http/Controllers/WebhookController.php +++ b/src/Http/Controllers/WebhookController.php @@ -274,7 +274,7 @@ class WebhookController extends Controller if ($user = $this->getUserByStripeId($payload['data']['object']['customer'])) { if (in_array(Notifiable::class, class_uses_recursive($user))) { - $payment = new Payment(Cashier::stripe()->paymentIntents->retrieve( + $payment = new Payment($user->stripe()->paymentIntents->retrieve( $payload['data']['object']['payment_intent'] ));
Fix reference to billable (#<I>)
laravel_cashier
train
php
2a43dac1f36b12f5adaea0cdad349f3e860e0eee
diff --git a/ui/src/data_explorer/components/Visualization.js b/ui/src/data_explorer/components/Visualization.js index <HASH>..<HASH> 100644 --- a/ui/src/data_explorer/components/Visualization.js +++ b/ui/src/data_explorer/components/Visualization.js @@ -94,7 +94,7 @@ const Visualization = React.createClass({ return ( <div className={classNames("graph", {active: true})} style={{height}}> <VisHeader views={VIEWS} view={view} onToggleView={this.handleToggleView} name={name || 'Graph'}/> - <div className={classNames({"graph-container": view === 'graph', "table-container": view === 'table'})}> + <div className={classNames({"graph-container": view === GRAPH, "table-container": view === TABLE})}> {this.renderVisualization(view, queries, heightPixels, onEditRawStatus)} </div> </div> @@ -103,9 +103,9 @@ const Visualization = React.createClass({ renderVisualization(view, queries, heightPixels, onEditRawStatus) { switch (view) { - case 'graph': + case GRAPH: return this.renderGraph(queries) - case 'table': + case TABLE: return <MultiTable queries={queries} height={heightPixels} onEditRawStatus={onEditRawStatus} /> default: this.renderGraph(queries)
Update some primatives to use constants
influxdata_influxdb
train
js
3a95492c488adca5bb509392978947d2e2c52905
diff --git a/test/helpers/kubectl.go b/test/helpers/kubectl.go index <HASH>..<HASH> 100644 --- a/test/helpers/kubectl.go +++ b/test/helpers/kubectl.go @@ -3089,6 +3089,10 @@ func (kub *Kubectl) ValidateNoErrorsInLogs(duration time.Duration) { // ValidateListOfErrorsInLogs is similar to ValidateNoErrorsInLogs, but // takes a blacklist of bad log messages instead of using the default list. func (kub *Kubectl) ValidateListOfErrorsInLogs(duration time.Duration, blacklist map[string][]string) { + if kub == nil { + // if `kub` is nil, this is run after the test failed while setting up `kub` and we are unable to gather logs + return + } ctx, cancel := context.WithTimeout(context.Background(), 1*time.Minute) defer cancel()
test: don't check logs if kubectl is nil Added a nil check in log check function since it can be run after test failed due to kubectl failing to set up, resulting in a panic.
cilium_cilium
train
go
617f75787e5c1f32cf51e60dc410c5d694bc605e
diff --git a/src/main/java/com/github/drapostolos/typeparser/TypeParser.java b/src/main/java/com/github/drapostolos/typeparser/TypeParser.java index <HASH>..<HASH> 100644 --- a/src/main/java/com/github/drapostolos/typeparser/TypeParser.java +++ b/src/main/java/com/github/drapostolos/typeparser/TypeParser.java @@ -16,5 +16,4 @@ public interface TypeParser<T> { * @return an instance of type T. */ T parse(String value); - }
minor cosmetic fix: removed blank line.
drapostolos_type-parser
train
java
f8c5fca85b1e55bfb928f5747474a7219dbe0233
diff --git a/src/Schema/AbstractColumn.php b/src/Schema/AbstractColumn.php index <HASH>..<HASH> 100644 --- a/src/Schema/AbstractColumn.php +++ b/src/Schema/AbstractColumn.php @@ -383,6 +383,7 @@ abstract class AbstractColumn implements ColumnInterface, ElementInterface * Returns type defined by the user, only until schema sync. Attention, this value is only preserved during the * declaration process. Value will become null after the schema fetched from database. * + * @internal * @return string|null */ public function getDeclaredType(): ?string
- marked getDeclaredType as internal
spiral_database
train
php
503dc78b3abc146fbbc8cbc1c83f97a9f03a2b12
diff --git a/Entity/Path.php b/Entity/Path.php index <HASH>..<HASH> 100644 --- a/Entity/Path.php +++ b/Entity/Path.php @@ -134,26 +134,27 @@ class Path extends AbstractResource } /** - * Add steps + * Add step * - * @param \Innova\PathBundle\Entity\Step $steps + * @param \Innova\PathBundle\Entity\Step $step * @return Path */ - public function addStep(\Innova\PathBundle\Entity\Step $steps) + public function addStep(\Innova\PathBundle\Entity\Step $step) { - $this->steps[] = $steps; - + $this->steps[] = $step; + $step->setPath($this); + return $this; } /** - * Remove steps + * Remove step * - * @param \Innova\PathBundle\Entity\Step $steps + * @param \Innova\PathBundle\Entity\Step $step */ - public function removeStep(\Innova\PathBundle\Entity\Step $steps) + public function removeStep(\Innova\PathBundle\Entity\Step $step) { - $this->steps->removeElement($steps); + $this->steps->removeElement($step); } /**
[PathBundle] fix bug in relationships management
claroline_Distribution
train
php
323262e0d160003ff4d851c107a8b815f704fb8e
diff --git a/src/collection/dimensions.js b/src/collection/dimensions.js index <HASH>..<HASH> 100644 --- a/src/collection/dimensions.js +++ b/src/collection/dimensions.js @@ -290,6 +290,9 @@ var noninf = function( x ){ }; var updateBounds = function( b, x1, y1, x2, y2 ){ + // don't update with zero area boxes + if( x2 - x1 === 0 || y2 - y1 === 0 ){ return; } + b.x1 = x1 < b.x1 ? x1 : b.x1; b.x2 = x2 > b.x2 ? x2 : b.x2; b.y1 = y1 < b.y1 ? y1 : b.y1; @@ -663,7 +666,9 @@ var boundingBoxImpl = function( ele, options ){ bounds.h = noninf( bounds.y2 - bounds.y1 ); // expand bounds by 1 because antialiasing can increase the visual/effective size by 1 on all sides - math.expandBoundingBox( bounds, 1 ); + if( bounds.w > 0 && bounds.h > 0 && displayed ){ + math.expandBoundingBox( bounds, 1 ); + } return bounds; };
Bounding box calculations should ignore positions for zero area components #<I>
cytoscape_cytoscape.js
train
js
96db69f9e48e62f0bf2010f4077d6cbdb18a1bf4
diff --git a/lib/rfd.rb b/lib/rfd.rb index <HASH>..<HASH> 100644 --- a/lib/rfd.rb +++ b/lib/rfd.rb @@ -418,7 +418,7 @@ module Rfd def process_command_line(prompt: ':') command_line.set_prompt prompt cmd, *args = command_line.get_command(prompt: prompt).split(' ') - if respond_to? cmd + if cmd && !cmd.empty? && respond_to?(cmd) self.public_send cmd, *args command_line.wclear command_line.wrefresh
Avoid dying by :<enter>
amatsuda_rfd
train
rb
b3d9ca21ca669917b5bc11d96050da778a66a0c5
diff --git a/src/Jade/Lexer/MixinScanner.php b/src/Jade/Lexer/MixinScanner.php index <HASH>..<HASH> 100644 --- a/src/Jade/Lexer/MixinScanner.php +++ b/src/Jade/Lexer/MixinScanner.php @@ -17,9 +17,9 @@ abstract class MixinScanner extends CaseScanner $token = $this->token('call', $matches[1]); // check for arguments - if (preg_match('/^ *\((.*?)\)/', $this->input, $matchesArguments)) { + if (preg_match('/^ *' . Scanner::PARENTHESES . '/', $this->input, $matchesArguments)) { $this->consume($matchesArguments[0]); - $token->arguments = $matchesArguments[1]; + $token->arguments = trim(substr($matchesArguments[1], 1, -1)); } return $token;
Use more precise RegExp for mixin scan
pug-php_pug
train
php
6e403fad6b6d618eadef34aa9797876ec42dbd52
diff --git a/provider/local/environ.go b/provider/local/environ.go index <HASH>..<HASH> 100644 --- a/provider/local/environ.go +++ b/provider/local/environ.go @@ -9,6 +9,7 @@ import ( "os" "os/exec" "path/filepath" + "regexp" "strings" "sync" @@ -434,7 +435,7 @@ func (env *localEnviron) Destroy() error { cmd := exec.Command( "pkill", fmt.Sprintf("-%d", terminationworker.TerminationSignal), - "jujud", + "-f", filepath.Join(regexp.QuoteMeta(env.config.rootDir()), ".*", "jujud"), ) return cmd.Run() }
provider/local: qualify pkill jujud with home dir When local was changed to use common code for bootstrap and destroy, destroy regressed and would destroy any jujud running on the machine. This CL fixes it by only killing the jujud that is located in the environment's data-dir.
juju_juju
train
go
d095d1207d0f472316ad5f4d4da5f3a50e805020
diff --git a/openquake/risklib/scientific.py b/openquake/risklib/scientific.py index <HASH>..<HASH> 100644 --- a/openquake/risklib/scientific.py +++ b/openquake/risklib/scientific.py @@ -1493,11 +1493,14 @@ class LossesByAsset(object): def compute(self, asset, losses_by_lt): """ :param asset: an asset record - :param losses_by_lt: a dictionary loss_type -> losses + :param losses_by_lt: a dictionary loss_type -> losses (of size E) :yields: pairs (loss_name, losses) """ yield from losses_by_lt.items() @cached_property def losses_by_A(self): + """ + :returns: a dictionary loss name -> array with A losses + """ return AccumDict(accum=numpy.zeros(self.A))
Update two docstrings [skip CI]
gem_oq-engine
train
py
79cf381e047f3c1feb987b02c8ed7934700e00cc
diff --git a/connection_test.go b/connection_test.go index <HASH>..<HASH> 100644 --- a/connection_test.go +++ b/connection_test.go @@ -347,10 +347,9 @@ func TestFragmentationSlowReader(t *testing.T) { } func TestWriteAfterTimeout(t *testing.T) { - ctx, cancel := NewContext(20 * time.Millisecond) - defer cancel() - - WithVerifiedServer(t, nil, func(ch *Channel, hostPort string) { + // The channel reads and writes during timeouts, causing warning logs. + opts := testutils.NewOpts().DisableLogVerification() + WithVerifiedServer(t, opts, func(ch *Channel, hostPort string) { timedOut := make(chan struct{}) handler := func(ctx context.Context, call *InboundCall) { @@ -372,6 +371,8 @@ func TestWriteAfterTimeout(t *testing.T) { } ch.Register(HandlerFunc(handler), "call") + ctx, cancel := NewContext(20 * time.Millisecond) + defer cancel() _, _, _, err := raw.Call(ctx, ch, hostPort, testServiceName, "call", nil, nil) assert.Equal(t, err, ErrTimeout, "Call should timeout")
Disable log verification in TestWriteAfterTimeout
uber_tchannel-go
train
go
59185f79e9178286d715e3c978701e0ddbbdca12
diff --git a/core/src/main/java/com/github/jsonldjava/core/JsonLdApi.java b/core/src/main/java/com/github/jsonldjava/core/JsonLdApi.java index <HASH>..<HASH> 100644 --- a/core/src/main/java/com/github/jsonldjava/core/JsonLdApi.java +++ b/core/src/main/java/com/github/jsonldjava/core/JsonLdApi.java @@ -1606,7 +1606,23 @@ public class JsonLdApi { } else { for (final String key : frame.keySet()) { if ("@id".equals(key) || !isKeyword(key) && !(node.containsKey(key))) { - return false; + + Object frameObject = frame.get(key); + if(frameObject instanceof ArrayList) { + ArrayList<Object> o = (ArrayList<Object>) frame.get(key); + + boolean _default = false; + for (Object oo : o) { + if(oo instanceof Map){ + if (((Map) oo).containsKey("@default")) { + _default = true; + } + } + } + if(_default) continue; + } + + return false; } } return true;
Inside filterNode() check if nodes have an @default in the frame, if they do, then don't filter them out.
jsonld-java_jsonld-java
train
java
91e84e425737e823f988d0a850e63d4530576b20
diff --git a/src/Sylius/Bundle/ApiBundle/DependencyInjection/Configuration.php b/src/Sylius/Bundle/ApiBundle/DependencyInjection/Configuration.php index <HASH>..<HASH> 100644 --- a/src/Sylius/Bundle/ApiBundle/DependencyInjection/Configuration.php +++ b/src/Sylius/Bundle/ApiBundle/DependencyInjection/Configuration.php @@ -30,7 +30,7 @@ final class Configuration implements ConfigurationInterface $rootNode ->children() ->booleanNode('enabled') - ->defaultTrue() + ->defaultFalse() ->end() ->end() ;
[API] Disable API by default
Sylius_Sylius
train
php
80ccf6bc22116d2460444475a85123e97fc905ae
diff --git a/spec/public/property/object_spec.rb b/spec/public/property/object_spec.rb index <HASH>..<HASH> 100644 --- a/spec/public/property/object_spec.rb +++ b/spec/public/property/object_spec.rb @@ -96,7 +96,9 @@ describe DataMapper::Property, 'Object type' do it 'should load the correct value' do pending_if 'Fix adapters to use different serialization methods', !@do_adapter do - should == { 'lang' => 'en_CA' } + pending_if 'Fix DO adapter to send String for Text primitive', !!(RUBY_PLATFORM =~ /java/) do + should == { 'lang' => 'en_CA' } + end end end end
Mark spec as pending for JRuby
datamapper_dm-core
train
rb
f0eeee21f21b1929f3f6931d8ee35f39e29db656
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -52,7 +52,7 @@ setup(name='umapi-client', 'cryptography', 'PyJWT', 'six', - 'enum34' + 'enum34;python_version<"3.4"', ], setup_requires=[ 'pytest-runner',
make enum<I> conditional on python version
adobe-apiplatform_umapi-client.py
train
py