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
228afe45a869ce0b310fd096b64623676a4c547f
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 @@ -13,7 +13,7 @@ if (! function_exists('extract_title')) { */ function extract_title(HtmlString $breadcrumbs, string $separator = ' » ') { - return preg_replace('/[\n\r\s]+/', ' ', strip_tags(Str::replaceLast($separator, '', str_replace('</li>', $separator, $breadcrumbs)))); + return Str::afterLast(preg_replace('/[\n\r\s]+/', ' ', strip_tags(Str::replaceLast($separator, '', str_replace('</li>', $separator, $breadcrumbs)))), $separator)." {$separator} ".config('app.name'); } }
Append application name after page name in titles
rinvex_laravel-support
train
php
0166befeab6cd200da84e5a8d8de16ce5604b932
diff --git a/pydle/client.py b/pydle/client.py index <HASH>..<HASH> 100644 --- a/pydle/client.py +++ b/pydle/client.py @@ -6,6 +6,8 @@ from asyncio import new_event_loop, gather, get_event_loop, sleep from . import connection, protocol import warnings +import inspect +import functools __all__ = ['Error', 'AlreadyInChannel', 'NotInChannel', 'BasicClient', 'ClientPool'] DEFAULT_NICKNAME = '<unregistered>' @@ -448,6 +450,24 @@ class BasicClient: # This isn't a handler, just raise an error. raise AttributeError(attr) + # Bonus features + def event(self, func): + """ + Registers the specified `func` to handle events of the same name. + + The func will always be called with, at least, the bot's `self` instance. + + Returns decorated func, unmodified. + """ + if not func.__name__.startswith("on_"): + raise NameError("Event handlers must start with 'on_'.") + + if not inspect.iscoroutinefunction(func): + raise AssertionError("Wrapped function {!r} must be an `async def` function.".format(func)) + setattr(self, func.__name__, functools.partial(func, self)) + + return func + class ClientPool: """ A pool of clients that are ran and handled in parallel. """
Implement decorator-based event handler registration - for those who prefer not subclassing.
Shizmob_pydle
train
py
a90f99d200b0846632bc29cc9254ae2edd0bc363
diff --git a/commands/review/post/command.go b/commands/review/post/command.go index <HASH>..<HASH> 100644 --- a/commands/review/post/command.go +++ b/commands/review/post/command.go @@ -366,7 +366,7 @@ StoryLoop: if err != nil { return commits, errs.NewError(task, err, nil) } - parentSHA := strings.TrimSpace(stdout.String()) + parentSHA := strings.Fields(stdout.String())[0] // Prepare a temporary branch that will be used to amend commit messages. task = "Create a temporary branch to rewrite commit messages"
review post: Fix broken parent hash parsing In case the story branch base is a merge commit, there are multiple parents. The current code is however not parsing the output line properly in this case since it is not splitting on whitespaces. This patch fixes this behavior, splitting the parents hashes line and taking the first field. Story-Id: SF-<I> Change-Id: 8ac3acbc<I>
salsaflow_salsaflow
train
go
9c880d4847296c1c17b96e4c8563d80ee2d16228
diff --git a/lib/money-rails/railtie.rb b/lib/money-rails/railtie.rb index <HASH>..<HASH> 100644 --- a/lib/money-rails/railtie.rb +++ b/lib/money-rails/railtie.rb @@ -1,6 +1,6 @@ module MoneyRails class Railtie < ::Rails::Railtie - initializer 'moneyrails.initialize' do + initializer 'moneyrails.initialize', after: 'active_record.initialize_database' do MoneyRails::Hooks.init end end
Define initializer to run after active_record.initialize_database (#<I>)
RubyMoney_money-rails
train
rb
b9acac9cd634bc53b5a4bbdaf940f537040853a9
diff --git a/src/org/opencms/workplace/editors/directedit/A_CmsDirectEditProvider.java b/src/org/opencms/workplace/editors/directedit/A_CmsDirectEditProvider.java index <HASH>..<HASH> 100644 --- a/src/org/opencms/workplace/editors/directedit/A_CmsDirectEditProvider.java +++ b/src/org/opencms/workplace/editors/directedit/A_CmsDirectEditProvider.java @@ -186,7 +186,7 @@ public abstract class A_CmsDirectEditProvider implements I_CmsDirectEditProvider m_rnd = new Random(); CmsUserSettings settings = new CmsUserSettings(cms); - m_messages = new CmsMessages(Messages.get().getBundleName(), settings.getLocale()); + m_messages = new CmsMessages(org.opencms.workplace.editors.Messages.get().getBundleName(), settings.getLocale()); m_editButtonStyle = settings.getEditorButtonStyle(); }
Fixed issue with legacy direct edit text button provider not showing localized messages.
alkacon_opencms-core
train
java
1f78b7e141dad8f1c154c98c5fef9c87754612a6
diff --git a/core/containers.py b/core/containers.py index <HASH>..<HASH> 100755 --- a/core/containers.py +++ b/core/containers.py @@ -123,9 +123,6 @@ class FCMeasurement(Measurement): ------- None: if no data is loaded gHandle: reference to axis - - - TODO: fix default value of transform... need cycling function? ''' # data = self.get_data() # The index is to keep only the data part (removing the meta data) # Transform sample @@ -177,7 +174,7 @@ class FCMeasurement(Measurement): return out - def view(self, channel_names=None, launch_from_shell=False): + def view(self, channel_names=None, launch_new_subprocess=True): ''' Loads the current FCS sample viewer @@ -191,7 +188,7 @@ class FCMeasurement(Measurement): Output from sample_viewer ''' - if launch_from_shell: # This is not finished until I can list the gates somewhere + if launch_new_subprocess: # This is not finished until I can list the gates somewhere from FlowCytometryTools import __path__ as p from subprocess import call import os
change variable names in view(), removed one line of old documentation from plot
eyurtsev_FlowCytometryTools
train
py
697aff572d6a70314cae5598e42e8b3b96f6f3e3
diff --git a/index.js b/index.js index <HASH>..<HASH> 100644 --- a/index.js +++ b/index.js @@ -69,12 +69,10 @@ function Construct(options, callback) { }; app.get('/apos-rss/render-feed', function(req, res) { - var item = { - feed: apos.sanitizeString(req.query.feed), - limit: apos.sanitizeInteger(req.query.limit) - }; - return self.loadFeed(item, function() { - return res.send(self.renderWidget({ item: item })); + self.sanitize(req.query); + delete req.query._ajax; + return self.loadFeed(req.query, function() { + return res.send(self.renderWidget({ item: req.query })); }); }); diff --git a/public/js/content.js b/public/js/content.js index <HASH>..<HASH> 100644 --- a/public/js/content.js +++ b/public/js/content.js @@ -5,16 +5,11 @@ apos.widgetPlayers.rss = function($widget) { return; } - var feed = data.feed; - var limit = data.limit; - $.get( '/apos-rss/render-feed', - { - feed: feed, - limit: limit - }, + data, function(result) { + console.log(result); $widget.html(result); } );
Updated the get-feed route to just take anything. Not great for sanitizing, but we sometimes need to jam something through
apostrophecms-legacy_apostrophe-rss
train
js,js
10932750680fc3b7b783d4c2195ec8718cb15e78
diff --git a/app/models/agents/trigger_agent.rb b/app/models/agents/trigger_agent.rb index <HASH>..<HASH> 100644 --- a/app/models/agents/trigger_agent.rb +++ b/app/models/agents/trigger_agent.rb @@ -9,9 +9,9 @@ module Agents The `rules` array contains hashes of `path`, `value`, and `type`. The `path` value is a dotted path through a hash in [JSONPaths](http://goessner.net/articles/JsonPath/) syntax. - The `type` can be one of #{VALID_COMPARISON_TYPES.map { |t| "`#{t}`" }.to_sentence} and compares with the `value`. + The `type` can be one of #{VALID_COMPARISON_TYPES.map { |t| "`#{t}`" }.to_sentence} and compares with the `value`. Note that regex patterns are matched case insensitively. If you want case sensitive matching, prefix your pattern with `(?-i)`. - The `value` can be a single value or an array of values. In the case of an array, if one or more values match then the rule matches. + The `value` can be a single value or an array of values. In the case of an array, if one or more values match then the rule matches. All rules must match for the Agent to match. The resulting Event will have a payload message of `message`. You can use liquid templating in the `message, have a look at the [Wiki](https://github.com/cantino/huginn/wiki/Formatting-Events-using-Liquid) for details.
Instruct how to write a case sensitive regex pattern. (#<I>)
huginn_huginn
train
rb
609b84085fc6f45fed1989f664e56dc3a1ea110b
diff --git a/spec/fake_server.rb b/spec/fake_server.rb index <HASH>..<HASH> 100644 --- a/spec/fake_server.rb +++ b/spec/fake_server.rb @@ -36,9 +36,9 @@ class FakeServer request_bytes = decoder.bytes request_data = Kafka::Protocol::Decoder.new(StringIO.new(request_bytes)) api_key = request_data.int16 - _api_version = request_data.int16 + api_version = request_data.int16 correlation_id = request_data.int32 - _client_id = request_data.string + client_id = request_data.string message = request_data.string @@ -46,8 +46,7 @@ class FakeServer response_encoder = Kafka::Protocol::Encoder.new(response) response_encoder.write_int32(correlation_id) - case api_key - when 17 then + if api_key == 17 response_encoder.write_int16(0) response_encoder.write_array(SUPPORTED_MECHANISMS) { |m| response_encoder.write_string(m) } encoder.write_bytes(response.string)
Changed case to if and removed underscore from unused variables
zendesk_ruby-kafka
train
rb
87f454e561924be35ca8ecfa189ed3f7abcd6dd6
diff --git a/js/assessments/sentenceBeginningsAssessment.js b/js/assessments/sentenceBeginningsAssessment.js index <HASH>..<HASH> 100644 --- a/js/assessments/sentenceBeginningsAssessment.js +++ b/js/assessments/sentenceBeginningsAssessment.js @@ -104,7 +104,7 @@ module.exports = { getResult: sentenceBeginningsAssessment, isApplicable: function( paper ) { var locale = getLanguage( paper.getLocale() ); - var validLocale = locale === "en" || locale === "de"; + var validLocale = locale === "en" || locale === "de" || locale === "fr" || locale === "es"; return ( validLocale && paper.hasText() ); }, getMarks: sentenceBeginningMarker
Add fr and es to isApplicable
Yoast_YoastSEO.js
train
js
92eddd6204d855f339a12618738a1313c6a9ff59
diff --git a/lib/rest-ftp-daemon/logger.rb b/lib/rest-ftp-daemon/logger.rb index <HASH>..<HASH> 100644 --- a/lib/rest-ftp-daemon/logger.rb +++ b/lib/rest-ftp-daemon/logger.rb @@ -25,8 +25,7 @@ class Logger end # Prepend plain message to output - #output.unshift (prefix1 + message.strip) - output.unshift (prefix1 + message) + output.unshift prefix1 + message # Send all this to logger add context[:level], output diff --git a/lib/rest-ftp-daemon/settings.rb b/lib/rest-ftp-daemon/settings.rb index <HASH>..<HASH> 100644 --- a/lib/rest-ftp-daemon/settings.rb +++ b/lib/rest-ftp-daemon/settings.rb @@ -3,8 +3,8 @@ require "settingslogic" # Configuration class class Settings < Settingslogic # Read configuration - namespace (defined?(APP_ENV) ? APP_ENV : "production") - source ((File.exists? APP_CONF) ? APP_CONF : Hash.new) + namespace defined?(APP_ENV) ? APP_ENV : "production" + source File.exists? APP_CONF) ? APP_CONF : Hash.new suppress_errors true # Compute my PID filename
Rubocop: (…) interpreted as grouped expression
bmedici_rest-ftp-daemon
train
rb,rb
1a1913f3fa399f952a90c6af0036a27bb5197dfe
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -38,6 +38,7 @@ setup(name='django-argonauts', 'Intended Audience :: Developers', 'License :: OSI Approved :: BSD License', 'Topic :: Internet :: WWW/HTTP', + 'Topic :: Software Development :: Libraries', 'Programming Language :: Python', 'Programming Language :: Python :: 2.6', 'Programming Language :: Python :: 2.7',
Added classifier to setup.py.
fusionbox_django-argonauts
train
py
7cafcefd977d58e8655ec480f34a96bc9461c950
diff --git a/gemv.js b/gemv.js index <HASH>..<HASH> 100644 --- a/gemv.js +++ b/gemv.js @@ -4,7 +4,7 @@ var blas1 = require('ndarray-blas-level1'); exports.gemv = function (alpha, A, x, beta, y) { var dot = blas1.dot; - for (var i = A.shape[1] - 1; i >= 0; i--) { + for (var i = A.shape[0] - 1; i >= 0; i--) { y.set(i, y.get(i) * beta + alpha * dot(A.pick(i, null), x)); } return true;
Added fix for GEMV function.
scijs_ndarray-blas-level2
train
js
8aa86babad2eddb5244ba79b4e3b5702e7e77217
diff --git a/actionpack/lib/action_controller/metal.rb b/actionpack/lib/action_controller/metal.rb index <HASH>..<HASH> 100644 --- a/actionpack/lib/action_controller/metal.rb +++ b/actionpack/lib/action_controller/metal.rb @@ -87,6 +87,7 @@ module ActionController @_status = 200 @_request = nil @_response = nil + @_routes = nil super end diff --git a/actionpack/lib/action_dispatch/routing/route_set.rb b/actionpack/lib/action_dispatch/routing/route_set.rb index <HASH>..<HASH> 100644 --- a/actionpack/lib/action_dispatch/routing/route_set.rb +++ b/actionpack/lib/action_dispatch/routing/route_set.rb @@ -318,11 +318,6 @@ module ActionDispatch singleton_class.send(:define_method, :_routes) { routes } end - def initialize(*) - @_routes = nil - super - end - define_method(:_routes) { @_routes || routes } end
Fix tests on <I>.
rails_rails
train
rb,rb
542b14c1169d7151078601a588d076ba630db622
diff --git a/build/jsforce-core.js b/build/jsforce-core.js index <HASH>..<HASH> 100644 --- a/build/jsforce-core.js +++ b/build/jsforce-core.js @@ -4993,8 +4993,8 @@ SObject.prototype.bulkload = function(operation, options, input, callback) { * @returns {Bulk~Batch} */ SObject.prototype.insertBulk = -SObject.prototype.createBulk = function(options, input, callback) { - return this.bulkload("insert", options, input, callback); +SObject.prototype.createBulk = function(input, callback) { + return this.bulkload("insert", input, callback); }; /**
hunk unwished direct change in bulit files
jsforce_jsforce
train
js
8e9293b77606ac5e75c8fc671b64cd73c09ee023
diff --git a/planetaryimage/decoders.py b/planetaryimage/decoders.py index <HASH>..<HASH> 100644 --- a/planetaryimage/decoders.py +++ b/planetaryimage/decoders.py @@ -3,10 +3,10 @@ from six.moves import range class BandSequentialDecoder(object): - def __init__(self, dtype, shape, sample_bytes, compression=None): + def __init__(self, dtype, shape, compression=None): self.dtype = dtype self.shape = shape - self.sample_bytes = sample_bytes + self.sample_bytes = dtype.itemsize self.compression = compression @property diff --git a/planetaryimage/pds3image.py b/planetaryimage/pds3image.py index <HASH>..<HASH> 100644 --- a/planetaryimage/pds3image.py +++ b/planetaryimage/pds3image.py @@ -170,6 +170,6 @@ class PDS3Image(PlanetaryImage): def _decoder(self): if self.format == 'BAND_SEQUENTIAL': return BandSequentialDecoder( - self.dtype, self.shape, self._sample_bytes, self.compression + self.dtype, self.shape, self.compression ) raise ValueError('Unkown format (%s)' % self.format)
Removed sample_bytes argument from decoders.py. refs#<I>
planetarypy_planetaryimage
train
py,py
ea2aa2ede3ad6d283ff89d8fc5f32e015ec5dbd8
diff --git a/src/Opensoft/SimpleSerializer/Adapter/ArrayAdapter.php b/src/Opensoft/SimpleSerializer/Adapter/ArrayAdapter.php index <HASH>..<HASH> 100644 --- a/src/Opensoft/SimpleSerializer/Adapter/ArrayAdapter.php +++ b/src/Opensoft/SimpleSerializer/Adapter/ArrayAdapter.php @@ -257,7 +257,12 @@ class ArrayAdapter implements BaseArrayAdapter $innerObject = $this->exposeValue($object, $property); } if (!is_object($innerObject) || !$innerObject instanceof $type) { - $innerObject = unserialize(sprintf('O:%d:"%s":0:{}', strlen($type), $type)); + if (PHP_VERSION_ID >= 50400) { + $rc = new \ReflectionClass($type); + $innerObject = $rc->newInstanceWithoutConstructor(); + } else { + $innerObject = unserialize(sprintf('O:%d:"%s":0:{}', strlen($type), $type)); + } } $value = $this->toObject($value, $innerObject); } elseif ($type !== null) {
Fixed a backwards incomaptability after <I>
opensoft_simple-serializer
train
php
208afd349bc8352fade0bf778792beba00de35a8
diff --git a/components/lib/virtualscroller/VirtualScroller.js b/components/lib/virtualscroller/VirtualScroller.js index <HASH>..<HASH> 100644 --- a/components/lib/virtualscroller/VirtualScroller.js +++ b/components/lib/virtualscroller/VirtualScroller.js @@ -605,7 +605,7 @@ export const VirtualScroller = React.memo(React.forwardRef((props, ref) => { contentRef: (el) => contentRef.current = ObjectUtils.getRefElement(el), spacerRef: (el) => spacerRef.current = ObjectUtils.getRefElement(el), stickyRef: (el) => stickyRef.current = ObjectUtils.getRefElement(el), - items: loadedItems, + items: loadedItems(), getItemOptions: (index) => getOptions(index), children: items, element: content,
Fixed #<I> - DataTable: Checkbox Row Selection and VirtualScroller not working simultaneously
primefaces_primereact
train
js
8dc64e0e27d5d59fc237721a352d4b80ff22f3ed
diff --git a/src/Marando/AstroDate/AstroDate.php b/src/Marando/AstroDate/AstroDate.php index <HASH>..<HASH> 100644 --- a/src/Marando/AstroDate/AstroDate.php +++ b/src/Marando/AstroDate/AstroDate.php @@ -135,6 +135,10 @@ class AstroDate { * @return static */ public static function now() { + // Keep track of default timezone, then set to UTC + $defaultTZ = date_default_timezone_get(); + date_default_timezone_set('UTC'); + // Get unix Timestamp with milliseconds $mt = explode(' ', microtime()); $unix = $mt[1]; // Unix timestamp @@ -147,6 +151,9 @@ class AstroDate { $sec = (int)date('s', $unix); $micro = (float)str_replace('0.', '.', $mt[0]); // Remove 0. + // Set back to default timezone + date_default_timezone_set($defaultTZ); + return new static($year, $month, $day, $hour, $min, $sec + $micro); }
fix incorrect UTC time for now()
marando_AstroDate
train
php
45000633969a8aaf2080ba07c54987049b6d1c9c
diff --git a/lib/helpers/child-process.js b/lib/helpers/child-process.js index <HASH>..<HASH> 100644 --- a/lib/helpers/child-process.js +++ b/lib/helpers/child-process.js @@ -69,7 +69,7 @@ process.on('message', function(task) { err.skip = true; } else { - err = new Error('Error when downloading file ' + task.file_path + ': ' + res.statusCode); + err = new Error('Error when downloading file :' + res.statusCode); } stream.end();
Error when downloading file doesn't show file url
AnyFetch_anyfetch-hydrater.js
train
js
73d6478a4de828470f4ffd3a8392ce63039c8aba
diff --git a/src/engine/currencyEngine.js b/src/engine/currencyEngine.js index <HASH>..<HASH> 100644 --- a/src/engine/currencyEngine.js +++ b/src/engine/currencyEngine.js @@ -514,8 +514,16 @@ export class CurrencyEngine { } async broadcastTx (abcTransaction: AbcTransaction): Promise<AbcTransaction> { + if (!abcTransaction.otherParams.bcoinTx) { + abcTransaction.otherParams.bcoinTx = bcoin.primitives.TX.fromRaw(abcTransaction.signedTx, 'hex') + } + for (const output of abcTransaction.otherParams.bcoinTx.outputs) { + if (output.value <= 0 || output.value === '0') { + throw new Error('Wrong spend amount') + } + } const txid = await this.engineState.broadcastTx(abcTransaction.signedTx) - abcTransaction.txid = txid + if (!abcTransaction.txid) abcTransaction.txid = txid return abcTransaction }
do not try to broadcast if any of the outputs values are wrong
EdgeApp_edge-currency-bitcoin
train
js
ce91029324feaefb81d75694c91f378a05364aae
diff --git a/source/org/jasig/portal/utils/SAX2BufferImpl.java b/source/org/jasig/portal/utils/SAX2BufferImpl.java index <HASH>..<HASH> 100644 --- a/source/org/jasig/portal/utils/SAX2BufferImpl.java +++ b/source/org/jasig/portal/utils/SAX2BufferImpl.java @@ -339,7 +339,7 @@ public class SAX2BufferImpl extends SAX2FilterImpl // unqueue all of the buffered events // for speed purposes, we don't allow contentHandler to be null - if(contentHandler!=null) { + if(ch!=null) { // determine what a given content handler represents DTDHandler dtdh=null; if(ch instanceof DTDHandler) {
lame bug that was responsible for the "dissapearing channels" argh .. took a while to find. git-svn-id: <URL>
Jasig_uPortal
train
java
01365cb8ab5a61c8f48366c48c78c7209c207f3e
diff --git a/js/core/TextElement.js b/js/core/TextElement.js index <HASH>..<HASH> 100644 --- a/js/core/TextElement.js +++ b/js/core/TextElement.js @@ -5,11 +5,13 @@ define( return Element.inherit("js.core.TextElement", { _initializeBindings: function () { + this.$.textContent = bindingCreator.evaluate(this.$.textContent || "", this, "textContent"); + this.callBase(); + }, + _initializeDescriptors: function(){ if (this.$descriptor) { - var textContent = this._getTextContentFromDescriptor(this.$descriptor); - this.$.textContent = bindingCreator.evaluate(textContent, this, "textContent"); + this.$.textContent = this._getTextContentFromDescriptor(this.$descriptor); } - }, render: function () { if (!this.$initialized) {
fixed initializeDescriptors and initializeBindings
rappid_rAppid.js
train
js
2d689b6adb616d17052bba352cbd442c561cea8c
diff --git a/glreg.py b/glreg.py index <HASH>..<HASH> 100644 --- a/glreg.py +++ b/glreg.py @@ -987,11 +987,11 @@ def group_apis(reg, features=None, extensions=None, api=None, profile=None, out_apis = [] for x in features: out = Registry(x.name) - import_feature(out, reg, x, api, profile, filter_symbol) + import_feature(out, reg, x.name, api, profile, filter_symbol) out_apis.append(out) for x in extensions: out = Registry(x.name) - import_extension(out, reg, x, api, profile, filter_symbol) + import_extension(out, reg, x.name, api, profile, filter_symbol) out_apis.append(out) return out_apis
bug fix for `group_apis` Make Calls to `import_feature` and `import_extension` use the feature/extension name instead of the feature/extension object.
pyokagan_pyglreg
train
py
f8a39e3bb13000e8952144be4c019d90d5ce7b94
diff --git a/tools/make-frozen.py b/tools/make-frozen.py index <HASH>..<HASH> 100755 --- a/tools/make-frozen.py +++ b/tools/make-frozen.py @@ -26,16 +26,14 @@ def module_name(f): modules = [] -root = sys.argv[1] +root = sys.argv[1].rstrip("/") root_len = len(root) -if root[-1] != "/": - root_len += 1 for dirpath, dirnames, filenames in os.walk(root): for f in filenames: fullpath = dirpath + "/" + f st = os.stat(fullpath) - modules.append((fullpath[root_len:], st)) + modules.append((fullpath[root_len + 1:], st)) print("#include <stdint.h>") print("const uint16_t mp_frozen_sizes[] = {")
tools/make-frozen.py: Handle trailing slash in argument more reliably.
micropython_micropython
train
py
b6f924d009ef7432134398b383bef43388e93da5
diff --git a/pkg/api/v1/types.go b/pkg/api/v1/types.go index <HASH>..<HASH> 100644 --- a/pkg/api/v1/types.go +++ b/pkg/api/v1/types.go @@ -2818,7 +2818,7 @@ type NodeSpec struct { // +optional ProviderID string `json:"providerID,omitempty" protobuf:"bytes,3,opt,name=providerID"` // Unschedulable controls node schedulability of new pods. By default, node is schedulable. - // More info: http://releases.k8s.io/HEAD/docs/admin/node.md#manual-node-administration" + // More info: http://releases.k8s.io/HEAD/docs/admin/node.md#manual-node-administration // +optional Unschedulable bool `json:"unschedulable,omitempty" protobuf:"varint,4,opt,name=unschedulable"` }
Remove stray quote from API docs
kubernetes_kubernetes
train
go
7fbf8d76946ee53587955b670bd8a47e3d48e854
diff --git a/Str.php b/Str.php index <HASH>..<HASH> 100644 --- a/Str.php +++ b/Str.php @@ -327,11 +327,15 @@ class Str */ public static function replaceArray($search, array $replace, $subject) { - foreach ($replace as $value) { - $subject = static::replaceFirst($search, $value, $subject); + $segments = explode($search, $subject); + + $result = array_shift($segments); + + foreach ($segments as $segment) { + $result .= (array_shift($replace) ?? $search).$segment; } - return $subject; + return $result; } /**
Fix recursive replacements in Str::replaceArray()
illuminate_support
train
php
b36b9bfdade19f261de35a79067a3d0dc03c3498
diff --git a/framework/db/mssql/QueryBuilder.php b/framework/db/mssql/QueryBuilder.php index <HASH>..<HASH> 100644 --- a/framework/db/mssql/QueryBuilder.php +++ b/framework/db/mssql/QueryBuilder.php @@ -219,6 +219,7 @@ class QueryBuilder extends \yii\db\QueryBuilder ->from('sys.columns') ->where("object_id = OBJECT_ID('dbo.{$table}')") ->column(); + array_walk($columns, create_function('&$str', '$str = "[$str]";')); return $columns; }
fix error fix error when if fields whose names are reserved word
yiisoft_yii2
train
php
06c88c8a2edad6562ad43e63ec894b1ba59c3818
diff --git a/pygerrit/stream.py b/pygerrit/stream.py index <HASH>..<HASH> 100644 --- a/pygerrit/stream.py +++ b/pygerrit/stream.py @@ -57,13 +57,17 @@ class GerritStream(Thread): stdout = channel.makefile() stderr = channel.makefile_stderr() while not self._stop.is_set(): - if channel.exit_status_ready(): - if channel.recv_stderr_ready(): - error = stderr.readline().strip() + try: + if channel.exit_status_ready(): + if channel.recv_stderr_ready(): + error = stderr.readline().strip() + else: + error = "Remote server connection closed" + self._error_event(error) + self._stop.set() else: - error = "Remote server connection closed" - self._error_event(error) + data = stdout.readline() + self._gerrit.put_event(data) + except Exception as e: + self._error_event(repr(e)) self._stop.set() - else: - data = stdout.readline() - self._gerrit.put_event(data)
Ensure errors in json parsing doesn't leave everything in a broken state
dpursehouse_pygerrit2
train
py
e0569c863236f7abee86c82db68df7d3abcdc82d
diff --git a/test/publishing_api_v2_test.rb b/test/publishing_api_v2_test.rb index <HASH>..<HASH> 100644 --- a/test/publishing_api_v2_test.rb +++ b/test/publishing_api_v2_test.rb @@ -399,7 +399,7 @@ describe GdsApi::PublishingApiV2 do it "responds with the links" do response = @api_client.get_links(@content_id) assert_equal 200, response.code - assert_equal ["20583132-1619-4c68-af24-77583172c070"], response.links[:organisations] + assert_equal ["20583132-1619-4c68-af24-77583172c070"], response.links.organisations end end @@ -482,7 +482,7 @@ describe GdsApi::PublishingApiV2 do organisations: ["591436ab-c2ae-416f-a3c5-1901d633fbfb"], }) assert_equal 200, response.code - assert_equal ["591436ab-c2ae-416f-a3c5-1901d633fbfb"], response.links[:organisations] + assert_equal ["591436ab-c2ae-416f-a3c5-1901d633fbfb"], response.links.organisations end end
Use method calls on openstructs for Ruby <I>. The bracket access doesn't work in <I>.
alphagov_gds-api-adapters
train
rb
598f236eee9c87c83b42e3191bf171ca3e1f7555
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -11,5 +11,6 @@ setup( author_email='brian@brianthicks.com', license='MIT', packages=['emit'], + scripts=['emit/bin/emit_digraph'], zip_safe=False )
add emit_digraph script directive
BrianHicks_emit
train
py
cd1ca8b64ed01c82f4bf4638a0b5843a6ed6dc23
diff --git a/lib/stream.js b/lib/stream.js index <HASH>..<HASH> 100644 --- a/lib/stream.js +++ b/lib/stream.js @@ -54,7 +54,7 @@ Stream.prototype.write = function (data, options, next) { Stream.prototype.readCoils = function (options, next) { options = options || {}; - var addres = (typeof options.address != "undefined" ? options.address : 0); + var address = (typeof options.address != "undefined" ? options.address : 0); var quantity = (typeof options.quantity != "undefined" ? options.quantity : 1); var extra = options.extra || {}; var next = next || null; diff --git a/lib/transport/transport.js b/lib/transport/transport.js index <HASH>..<HASH> 100644 --- a/lib/transport/transport.js +++ b/lib/transport/transport.js @@ -13,6 +13,7 @@ function BaseTransport(stream, options) { this.beforerequest = (typeof options.beforerequest == "function" ? options.beforerequest : null); this.afterrequest = (typeof options.afterrequest == "function" ? options.afterrequest : null); this.retryTimer = null; + this.listen(); } util.inherits(BaseTransport, EventEmitter);
stream: fixes typo in addres
node-modbus_stream
train
js,js
4795b055cd51756bd0b1ff1d2d63c1e023db93b7
diff --git a/holoviews/plotting/mpl/tabular.py b/holoviews/plotting/mpl/tabular.py index <HASH>..<HASH> 100644 --- a/holoviews/plotting/mpl/tabular.py +++ b/holoviews/plotting/mpl/tabular.py @@ -60,7 +60,7 @@ class TablePlot(ElementPlot): # Mapping from the cell coordinates to the dictionary key. summarize = frame.rows > self.max_rows - half_rows = self.max_rows/2 + half_rows = self.max_rows//2 rows = min([self.max_rows, frame.rows]) for row in range(rows): adjusted_row = row
Fixed integer division issue in TabularPlot
pyviz_holoviews
train
py
b499db578cc836067ee28e3eb6753c2f39f2ad05
diff --git a/lib/navigationlib.php b/lib/navigationlib.php index <HASH>..<HASH> 100644 --- a/lib/navigationlib.php +++ b/lib/navigationlib.php @@ -2014,7 +2014,8 @@ class settings_navigation extends navigation_node { */ public function prepend($text, $url=null, $type=null, $shorttext=null, $key=null, pix_icon $icon=null) { $children = $this->children; - $this->children = new get_class($children); + $childrenclass = get_class($children); + $this->children = new $childrenclass; $node = $this->add($text, $url, $type, $shorttext, $key, $icon); foreach ($children as $child) { $this->children->add($child); @@ -2347,7 +2348,7 @@ class settings_navigation extends navigation_node { } if ($reportavailable) { $url = new moodle_url('/grade/report/index.php', array('id'=>$course->id)); - $coursenode->add(get_string('grades'), $url, self::TYPE_SETTING, null, null, new pix_icon('i/grades', '')); + $gradenode = $coursenode->add(get_string('grades'), $url, self::TYPE_SETTING, null, 'grades', new pix_icon('i/grades', '')); } // Add outcome if permitted
navigation MDL-<I> Fixed a small bug with navigation node prepend
moodle_moodle
train
php
4752a708c60a37020b615f5b3767633c75d7fab8
diff --git a/core/StaticContainer.php b/core/StaticContainer.php index <HASH>..<HASH> 100644 --- a/core/StaticContainer.php +++ b/core/StaticContainer.php @@ -43,6 +43,9 @@ class StaticContainer */ private static function createContainer() { + if (!class_exists("DI\\ContainerBuilder")) { + throw new \Exception("DI\\ContainerBuilder could not be found, maybe you are using Piwik from git and need to update Composer. $ php composer.phar update"); + } $builder = new ContainerBuilder(); // TODO add cache
When PHP-DI not found, hint user to composer update
matomo-org_matomo
train
php
047cfb1f6a997505e40abc4a7d1cf65d527fe00f
diff --git a/packages/ember-application/lib/system/application.js b/packages/ember-application/lib/system/application.js index <HASH>..<HASH> 100644 --- a/packages/ember-application/lib/system/application.js +++ b/packages/ember-application/lib/system/application.js @@ -985,7 +985,9 @@ Application.reopenClass({ registry.register('renderer:-dom', { create() { return new Renderer(new DOMHelper()); } }); registry.injection('view', 'renderer', 'renderer:-dom'); - registry.register('view:select', SelectView); + if (Ember.ENV._ENABLE_LEGACY_VIEW_SUPPORT) { + registry.register('view:select', SelectView); + } registry.register('view:-outlet', OutletView); registry.register('-view-registry:main', { create() { return {}; } });
[BUGFIX release] Only add `view:select` for ember-legacy-views. This causes some issues if you want to add a route named `select` (because we clober `view:select`).
emberjs_ember.js
train
js
5d7796d62e9c255a6f45d63ee4a27136ef9e3ebc
diff --git a/aiohttp_cors/__init__.py b/aiohttp_cors/__init__.py index <HASH>..<HASH> 100644 --- a/aiohttp_cors/__init__.py +++ b/aiohttp_cors/__init__.py @@ -146,7 +146,7 @@ class CorsConfig: self._route_config = {} self._preflight_route_settings = {} - self._app.on_response_prepare.append(self.on_response_prepare) + self._app.on_response_prepare.append(self._on_response_prepare) def add(self, route, config: collections.abc.Mapping=None): """Enable CORS for specific route. @@ -189,9 +189,9 @@ class CorsConfig: return route @asyncio.coroutine - def on_response_prepare(self, - request: web.Request, - response: web.StreamResponse): + def _on_response_prepare(self, + request: web.Request, + response: web.StreamResponse): """(Potentially) simple CORS request response processor. If request is done on CORS-enabled route, process request parameters
make on_response_prepare handler private
aio-libs_aiohttp-cors
train
py
455f7b0c742877a6f0e4a37d4dc75f3e590f8fcd
diff --git a/src/article/models/TableFigure.js b/src/article/models/TableFigure.js index <HASH>..<HASH> 100644 --- a/src/article/models/TableFigure.js +++ b/src/article/models/TableFigure.js @@ -21,6 +21,7 @@ export default class TableFigure extends FigurePanel { return { type: 'table-figure', content: Table.getTemplate(options), + legend: [{ type: 'paragraph' }], permission: { type: 'permission' } } }
Create TableFigure legend with one empty paragraph.
substance_texture
train
js
d53089bbabc2655699969991ed3ae526c98758a5
diff --git a/itests/src/test/java/fi/metatavu/edelphi/test/ui/base/AbstractUITest.java b/itests/src/test/java/fi/metatavu/edelphi/test/ui/base/AbstractUITest.java index <HASH>..<HASH> 100644 --- a/itests/src/test/java/fi/metatavu/edelphi/test/ui/base/AbstractUITest.java +++ b/itests/src/test/java/fi/metatavu/edelphi/test/ui/base/AbstractUITest.java @@ -587,7 +587,7 @@ public class AbstractUITest { waitAndType("*[name='avainluku']", "1234"); waitAndClick("*[name='avainl']"); waitAndClick("*[name='Lopeta']"); - waitAndClick(".PalveluSisalto a") + waitAndClick(".PalveluSisalto a"); } private void dumpScreenShot() {
Added missing semicolon into AbstractUITest
Metatavu_edelphi
train
java
46ed406b9bf4a5ace4bece3086afb2ccc6364834
diff --git a/src/Request.php b/src/Request.php index <HASH>..<HASH> 100644 --- a/src/Request.php +++ b/src/Request.php @@ -270,7 +270,7 @@ class Request implements \JsonSerializable */ protected function flatten($name) { - return strtolower(preg_replace('/\W_/', '', $name)); + return strtolower(preg_replace('/[\W_-]/', '', $name)); } /** diff --git a/tests/RequestTest.php b/tests/RequestTest.php index <HASH>..<HASH> 100644 --- a/tests/RequestTest.php +++ b/tests/RequestTest.php @@ -414,4 +414,15 @@ class RequestTest extends TestCase $request->getFormatFromUri($uri) ); } + + public function testVariableFlattening() + { + $parameters = + [ 'nAmE' => 'string']; + $request = new Request(null, null, $parameters); + $this->assertSame( + 'string', + $request->getParameter('na-me') + ); + } }
Added test for and fixed flatten
AyeAyeApi_Api
train
php,php
5983d14c0d08ba37f70ff00f0d235af0f96ca873
diff --git a/pam/pam.py b/pam/pam.py index <HASH>..<HASH> 100644 --- a/pam/pam.py +++ b/pam/pam.py @@ -30,6 +30,7 @@ a user against the Pluggable Authentication Modules (PAM) on the system. Implemented using ctypes, so no compilation is necessary. ''' +import six import __internals if __name__ == "__main__": # pragma: no cover @@ -42,7 +43,7 @@ if __name__ == "__main__": # pragma: no cover readline.redisplay() readline.set_pre_input_hook(hook) - result = input(prompt) # nosec (bandit; python2) + result = six.input(prompt) # nosec (bandit; python2) readline.set_pre_input_hook()
put the py2 stuff back
FirefighterBlu3_python-pam
train
py
6712d03ef08b6aa63daeac4f690fc88942a2781c
diff --git a/lib/rollbar.rb b/lib/rollbar.rb index <HASH>..<HASH> 100644 --- a/lib/rollbar.rb +++ b/lib/rollbar.rb @@ -71,6 +71,11 @@ module Rollbar self.class.new(self, options) end + def scope!(options = {}) + Rollbar::Util.deep_merge(@configuration.payload_options, options) + self + end + # Turns off reporting for the given block. # # @example @@ -753,6 +758,10 @@ module Rollbar self.notifier = old_notifier end + def scope!(options = {}) + notifier.scope!(options) + end + # Backwards compatibility methods def report_exception(exception, request_data = nil, person_data = nil, level = 'error') diff --git a/spec/rollbar_spec.rb b/spec/rollbar_spec.rb index <HASH>..<HASH> 100644 --- a/spec/rollbar_spec.rb +++ b/spec/rollbar_spec.rb @@ -1581,6 +1581,19 @@ describe Rollbar do end end + describe '.scope!' do + let(:new_scope) do + { :person => { :id => 1 } } + end + + it 'adds the new scope to the payload options' do + configuration = Rollbar.notifier.configuration + Rollbar.scope!(new_scope) + + expect(configuration.payload_options).to be_eql(new_scope) + end + end + describe '.reset_notifier' do it 'resets the notifier' do notifier1_id = Rollbar.notifier.object_id
Add convenience scope! method to Rollbar public interface.
rollbar_rollbar-gem
train
rb,rb
308a6d6d092174f7bc52eda2c4977a7142da234e
diff --git a/lib/subproviders/geth_api_double.js b/lib/subproviders/geth_api_double.js index <HASH>..<HASH> 100644 --- a/lib/subproviders/geth_api_double.js +++ b/lib/subproviders/geth_api_double.js @@ -188,12 +188,11 @@ GethApiDouble.prototype.eth_getBlockByHash = function(txHash, includeFullTransac GethApiDouble.prototype.eth_getBlockTransactionCountByNumber = function(blockNumber, callback) { this.state.blockchain.getBlock(blockNumber, function(err, block) { if (err) { - if (err.message.indexOf("index out of range")) { + if (err.message.indexOf("LevelUpArrayAdapter named 'blocks' index out of range: index") >= 0) { // block doesn't exist return callback(null, 0); - } else { - return callback(err); } + return callback(err); } callback(null, block.transactions.length); });
Fix geth_api_double conditional If the string is not found indexOf returns -1 !!-1 === true This fixes a potential 'misfire' on this if statement and further strengthens the condition itself with a more specific string match
trufflesuite_ganache-core
train
js
0e6108a6ccf7d0f0a0b02fd5f2b8ef1ca5d673f9
diff --git a/lib/rconfig/load_paths.rb b/lib/rconfig/load_paths.rb index <HASH>..<HASH> 100644 --- a/lib/rconfig/load_paths.rb +++ b/lib/rconfig/load_paths.rb @@ -31,8 +31,9 @@ module RConfig # If the paths are made up of a delimited string, then parse out the # individual paths. Verify that each path is valid. # - # If windows path separators are ';' and '!' - # otherwise the path separators are ';' and ':' + # - If windows path separators are ';' and '!' + # - otherwise the path separators are ';' and ':' + # # This is necessary so windows paths can be correctly processed def parse_load_paths(paths) @@ -59,6 +60,8 @@ module RConfig end + private + def get_path_separators is_windows = Gem.win_platform? if is_windows
updated comments * Updated comment so we got better rdoc formatting * made get_path_separators private
rahmal_rconfig
train
rb
252bde4e57a203550f6c48d12c6f13ccebf47d1d
diff --git a/cmd2/table_creator.py b/cmd2/table_creator.py index <HASH>..<HASH> 100644 --- a/cmd2/table_creator.py +++ b/cmd2/table_creator.py @@ -10,12 +10,20 @@ import functools import io from collections import deque from enum import Enum -from typing import Any, Deque, Optional, Sequence, Tuple, Union +from typing import Any, Optional, Sequence, Tuple, Union from wcwidth import wcwidth from . import ansi, constants, utils +# This is needed for compatibility with early versions of Python 3.5 prior to 3.5.4 +try: + from typing import Deque +except ImportError: + from typing import _alias, T + import collections + Deque = _alias(collections.deque, T) + # Constants EMPTY = '' SPACE = ' ' diff --git a/docs/conf.py b/docs/conf.py index <HASH>..<HASH> 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -19,6 +19,7 @@ documentation root, use os.path.abspath to make it absolute, like shown here. """ # Import for custom theme from Read the Docs import sphinx_rtd_theme + import cmd2 # -- General configuration -----------------------------------------------------
Address fact that typing.Deque wasn't defined prior to <I>
python-cmd2_cmd2
train
py,py
61c9cc527978352ea7d6355a64a8f8f9b3e66bcc
diff --git a/lib/branch_io_cli/helper/configuration_helper.rb b/lib/branch_io_cli/helper/configuration_helper.rb index <HASH>..<HASH> 100644 --- a/lib/branch_io_cli/helper/configuration_helper.rb +++ b/lib/branch_io_cli/helper/configuration_helper.rb @@ -291,7 +291,7 @@ EOF # If no CocoaPods or Carthage, check to see if the framework is linked. target = BranchHelper.target_from_project @xcodeproj, options.target - return if target.frameworks_build_phase.files.map(&:file_ref).map(&:path).any? { |p| p =~ %r{/Branch.framework$} } + return if target.frameworks_build_phase.files.map(&:file_ref).map(&:path).any? { |p| p =~ %r{Branch.framework$} } # --podfile, --cartfile not specified. No Podfile found. No Cartfile found. No Branch.framework in project. # Prompt the user:
Corrected regexp for Branch.framework detection.
BranchMetrics_branch_io_cli
train
rb
73e69b3c1d8569bf5e545ebce5b672e256f54e55
diff --git a/bench.js b/bench.js index <HASH>..<HASH> 100644 --- a/bench.js +++ b/bench.js @@ -87,10 +87,29 @@ var fiveHundredEntriesAndProperties = (function () { } })() +var fiveHundredEntriesAndKnownProperties = (function () { + + var instance = buildFiveHundredEntries() + + return fiveHundredEntriesAndKnownProperties + + function fiveHundredEntriesAndKnownProperties (done) { + var result = instance.lookup({ + bigCounter: '99', + small4: '99' + }) + if (!result) { + throw new Error('muahah') + } + process.nextTick(done) + } +})() + var run = bench([ threeEntries, fiveHundredEntries, - fiveHundredEntriesAndProperties + fiveHundredEntriesAndProperties, + fiveHundredEntriesAndKnownProperties ], 100000) run(run) diff --git a/lib/matchingBuckets.js b/lib/matchingBuckets.js index <HASH>..<HASH> 100644 --- a/lib/matchingBuckets.js +++ b/lib/matchingBuckets.js @@ -11,6 +11,11 @@ function matchingBuckets (buckets, pattern, set) { if (buckets[b].filter.test(keys[i])) { acc.push(buckets[b]) break + } else if (set) { + // if there are known properties, we can be 100% sure + // that if a bloom filter returns false, then we don't need + // to test the other keys + break } } }
Avoid perf drop on multiple known properties.
mcollina_bloomrun
train
js,js
40e382e6d09e6bdc9a98620c7b5c747caf5f7b93
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100755 --- a/setup.py +++ b/setup.py @@ -28,7 +28,7 @@ else: extra = {} -if sys.version_info >= (3,): +if sys.version_info[0] >= 3: extra['use_2to3'] = True extra['use_2to3_fixers'] = ['custom_2to3'] install_requires = []
python version chek modified
Jajcus_pyxmpp2
train
py
23b774535788057659e5b8c999bead52b6eb41aa
diff --git a/src/core/template.js b/src/core/template.js index <HASH>..<HASH> 100644 --- a/src/core/template.js +++ b/src/core/template.js @@ -38,6 +38,7 @@ cdb.core.TemplateList = Backbone.Collection.extend({ if(t) { return _.bind(t.render, t); } + cdb.log.error(template_name+" not found"); return null; } });
adding error when template doesn't exists
CartoDB_carto.js
train
js
e2cd8097e22352aaceb715088067719ba67e6d70
diff --git a/index.js b/index.js index <HASH>..<HASH> 100644 --- a/index.js +++ b/index.js @@ -380,6 +380,7 @@ class Hyperdrive extends EventEmitter { if (err && (err.errno !== 2)) return proxy.destroy(err) this._getContent(trie, (err, contentState) => { if (err) return proxy.destroy(err) + if (opts.wait === false && contentState.isLocked()) return cb(new Error('Content is locked.')) contentState.lock(_release => { release = _release append(contentState) diff --git a/lib/content.js b/lib/content.js index <HASH>..<HASH> 100644 --- a/lib/content.js +++ b/lib/content.js @@ -36,6 +36,9 @@ class ContentState { lock (cb) { return this.feed[CONTENT_LOCK](cb) } + isLocked () { + return this.feed[CONTENT_LOCK].locked + } } module.exports = {
Add isLocked to content state
mafintosh_hyperdrive
train
js,js
58a513330a9fd3cc00e2a6de1fe69931e9b50f11
diff --git a/tests/Backend/Workspaces/WorkspacesSnowflakeTest.php b/tests/Backend/Workspaces/WorkspacesSnowflakeTest.php index <HASH>..<HASH> 100644 --- a/tests/Backend/Workspaces/WorkspacesSnowflakeTest.php +++ b/tests/Backend/Workspaces/WorkspacesSnowflakeTest.php @@ -172,7 +172,7 @@ class WorkspacesSnowflakeTest extends ParallelWorkspacesTestCase } $this->assertArrayHasKey('metrics', $actualJobId); - $this->assertEquals(3072, $actualJobId['metrics']['outBytes']); + $this->assertEquals(3584, $actualJobId['metrics']['outBytes']); $db = $this->getDbConnection($workspace['connection']); @@ -702,7 +702,7 @@ class WorkspacesSnowflakeTest extends ParallelWorkspacesTestCase } $this->assertArrayHasKey('metrics', $actualJobId); - $this->assertEquals(16896, $actualJobId['metrics']['outBytes']); + $this->assertEquals(17920, $actualJobId['metrics']['outBytes']); $backend = WorkspaceBackendFactory::createWorkspaceBackend($workspace); $this->assertEquals(5, $backend->countRows('languages'));
update expected metrics.outBytes due to SNFLK change
keboola_storage-api-php-client
train
php
77820b9344157c40f0190513cb9bf555f56f975c
diff --git a/get_wayback_machine/get.py b/get_wayback_machine/get.py index <HASH>..<HASH> 100644 --- a/get_wayback_machine/get.py +++ b/get_wayback_machine/get.py @@ -17,7 +17,8 @@ def get(url, **kwargs): if clo['status'] != '200': return None - response_final = get_retries.get(clo['url']) + response_final = get_retries.get(clo['url'], **kwargs) if not response_final or response_final.status_code != 200: return None + return response_final
add kwargs to second get
jfilter_get-wayback-machine
train
py
7256955ba0f6acf1e87123d158b021464ffe977f
diff --git a/crud/BaseBulkAction.php b/crud/BaseBulkAction.php index <HASH>..<HASH> 100644 --- a/crud/BaseBulkAction.php +++ b/crud/BaseBulkAction.php @@ -18,7 +18,7 @@ use yii\db\Query; */ abstract class BaseBulkAction extends Action implements BulkActionInterface { - public $authAction = false; + public $authItem = false; /** * @inheritdoc @@ -53,8 +53,8 @@ abstract class BaseBulkAction extends Action implements BulkActionInterface */ public function run($step) { - if ($this->authAction !== false && $this->checkAccess) { - call_user_func($this->checkAccess, $this->authAction); + if ($this->authItem !== false && $this->checkAccess) { + call_user_func($this->checkAccess, $this->authItem); } $steps = $this->steps();
change authAction to authItem name
netis-pl_yii2-crud
train
php
9c12d96809f0a47d89a79fcd864527d3a3bab6af
diff --git a/bootstrap.php b/bootstrap.php index <HASH>..<HASH> 100644 --- a/bootstrap.php +++ b/bootstrap.php @@ -20,8 +20,4 @@ if (!($settings = include(__DIR__ . '/config.php'))) { throw new \RuntimeException('Could not read config.php, please copy config.php-DEVELOPMENT to config.php & customize to your needs!'); } -// Class alias used for BC -// // Enables old code which still extends non namespaced TestCase to work -class_alias('PHPUnit\Framework\TestCase', 'PHPUnit_Framework_TestCase'); - require_once __DIR__ . '/vendor/autoload.php';
fix: remove conflicting class_alias from boostrap.php
ezsystems_ezpublish-kernel
train
php
d28ed9f5360b54320b2d1baaa2e6d0e3f3f941fc
diff --git a/actionview/lib/action_view/helpers/asset_url_helper.rb b/actionview/lib/action_view/helpers/asset_url_helper.rb index <HASH>..<HASH> 100644 --- a/actionview/lib/action_view/helpers/asset_url_helper.rb +++ b/actionview/lib/action_view/helpers/asset_url_helper.rb @@ -118,8 +118,8 @@ module ActionView # asset_path "application", type: :stylesheet # => /stylesheets/application.css # asset_path "http://www.example.com/js/xmlhr.js" # => http://www.example.com/js/xmlhr.js def asset_path(source, options = {}) - source = source.to_s return "" unless source.present? + source = source.to_s return source if source =~ URI_REGEXP tail, source = source[/([\?#].+)$/], source.sub(/([\?#].+)$/, '')
Convert source to string if it is present.
rails_rails
train
rb
664743beffe16e1a783fe540462bf83e09aa8b0f
diff --git a/index.js b/index.js index <HASH>..<HASH> 100644 --- a/index.js +++ b/index.js @@ -23,7 +23,7 @@ resumableUpload.prototype.initUpload = function(callback, errorback) { headers: { 'Host': 'www.googleapis.com', 'Authorization': 'Bearer ' + this.tokens.access_token, - 'Content-Length': JSON.stringify(this.metadata).length, + 'Content-Length': new Buffer(JSON.stringify(this.metadata)).length, 'Content-Type': 'application/json', 'X-Upload-Content-Length': fs.statSync(this.filepath).size, 'X-Upload-Content-Type': mime.lookup(this.filepath)
fix Content-Length when request body contains 2-bytes char
grayleonard_node-youtube-resumable-upload
train
js
cfae680957faf3aca85d5402e590a900972c9708
diff --git a/aeron-cluster/src/main/java/io/aeron/cluster/ConsensusModuleAgent.java b/aeron-cluster/src/main/java/io/aeron/cluster/ConsensusModuleAgent.java index <HASH>..<HASH> 100644 --- a/aeron-cluster/src/main/java/io/aeron/cluster/ConsensusModuleAgent.java +++ b/aeron-cluster/src/main/java/io/aeron/cluster/ConsensusModuleAgent.java @@ -1774,13 +1774,10 @@ final class ConsensusModuleAgent implements Agent { captureServiceClientIds(); ++serviceAckId; - + timeOfLastLogUpdateNs = nowNs; CloseHelper.close(ctx.countedErrorHandler(), recoveryStateCounter); state(ConsensusModule.State.ACTIVE); - timeOfLastLogUpdateNs = nowNs; - leadershipTermId(recoveryPlan.lastLeadershipTermId); - return true; }
[Java] Don't overwrite leadershipTermId set when snapshot loaded for dynamic join.
real-logic_aeron
train
java
cf53a47c316a2707f57f4fcf51607970765eaffa
diff --git a/src/doiuse.js b/src/doiuse.js index <HASH>..<HASH> 100644 --- a/src/doiuse.js +++ b/src/doiuse.js @@ -3,9 +3,7 @@ let missingSupport = require('./missing-support') let Detector = require('./detect-feature-use') function doiuse (options) { - let browserQuery = options.browsers - let onFeatureUsage = options.onFeatureUsage - let ignore = options.ignore + let {browsers: browserQuery, onFeatureUsage, ignore} = options if (!browserQuery) { browserQuery = doiuse['default'].slice()
Use ES6 destructuring to pick up variables from options. This is a fairly unrelated commit. But I noticed the oppurtunity, and decided to take it.
anandthakker_doiuse
train
js
b9953eeb3e1d2041d99cf6f456069a6a894e2c37
diff --git a/modules/kinessoIdSystem.js b/modules/kinessoIdSystem.js index <HASH>..<HASH> 100644 --- a/modules/kinessoIdSystem.js +++ b/modules/kinessoIdSystem.js @@ -180,7 +180,7 @@ function kinessoSyncUrl(accountId, consentData) { const usPrivacyString = uspDataHandler.getConsentData(); let kinessoSyncUrl = `${ID_SVC}?accountid=${accountId}`; if (usPrivacyString) { - kinessoSyncUrl = `${kinessoSyncUrl}?us_privacy=${usPrivacyString}`; + kinessoSyncUrl = `${kinessoSyncUrl}&us_privacy=${usPrivacyString}`; } if (!consentData || typeof consentData.gdprApplies !== 'boolean' || !consentData.gdprApplies) return kinessoSyncUrl;
Kinesso fixing the endpoint construction (#<I>)
prebid_Prebid.js
train
js
0ee3f84de84645fdf88fab00db1638f2f3f41a48
diff --git a/collections_.py b/collections_.py index <HASH>..<HASH> 100644 --- a/collections_.py +++ b/collections_.py @@ -3,7 +3,7 @@ # # Copyright © 2009 Michael Lenzen <m.lenzen@gmail.com> # -_version = '0.1.3' +_version = '0.1.4' __all__ = ['collection', 'Collection', 'Mutable', 'set', 'frozenset', 'setlist', 'frozensetlist', 'bag', 'frozenbag']
Incremented to version <I>
mlenzen_collections-extended
train
py
a3a6f04c4bcdf39f69f61b4f0ea84ce627168edb
diff --git a/pydoop/mapreduce/simulator.py b/pydoop/mapreduce/simulator.py index <HASH>..<HASH> 100644 --- a/pydoop/mapreduce/simulator.py +++ b/pydoop/mapreduce/simulator.py @@ -69,6 +69,9 @@ class TrivialRecordWriter(object): else: raise PydoopError('Cannot manage {}'.format(cmd)) + def flush(self): + pass + def close(self): self.stream.close() @@ -114,6 +117,9 @@ class SortAndShuffle(dict): part, key, value = args[1:] self.setdefault(key, []).append(value) + def flush(self): + pass + def close(self): pass
Added 'flush' method to the TrivialRecordWriter and SortAndShuffle classes
crs4_pydoop
train
py
e876d53cb446867d18f91469dc2ffaae622b8840
diff --git a/ext_emconf.php b/ext_emconf.php index <HASH>..<HASH> 100755 --- a/ext_emconf.php +++ b/ext_emconf.php @@ -9,7 +9,7 @@ $EM_CONF[$_EXTKEY] = [ 'state' => 'stable', 'createDirs' => '', 'clearCacheOnLoad' => 0, - 'version' => '11.5.0', + 'version' => '11.5.1', 'constraints' => [ 'depends' => [ 'typo3' => '11.0.0-11.99.99',
[RELEASE] <I> Various core <I> alignments
TYPO3_styleguide
train
php
b2089d27f085499a25494116977382d25bb02bb7
diff --git a/lib/paratrooper/pending_migration_check.rb b/lib/paratrooper/pending_migration_check.rb index <HASH>..<HASH> 100644 --- a/lib/paratrooper/pending_migration_check.rb +++ b/lib/paratrooper/pending_migration_check.rb @@ -11,7 +11,8 @@ module Paratrooper end def migrations_waiting? - @migrations_waiting ||= check_for_pending_migrations + defined?(@migrations_waiting) or @migrations_waiting = check_for_pending_migrations + @migrations_waiting end def last_deployed_commit diff --git a/spec/paratrooper/pending_migration_check_spec.rb b/spec/paratrooper/pending_migration_check_spec.rb index <HASH>..<HASH> 100644 --- a/spec/paratrooper/pending_migration_check_spec.rb +++ b/spec/paratrooper/pending_migration_check_spec.rb @@ -24,6 +24,13 @@ describe Paratrooper::PendingMigrationCheck do it "memoizes the git diff" do system_caller.should_receive(:execute).exactly(1).times.and_return("DIFF") migration_check.migrations_waiting? + migration_check.migrations_waiting? + end + + it "memoizes the git diff when empty" do + system_caller.should_receive(:execute).exactly(1).times.and_return("") + migration_check.migrations_waiting? + migration_check.migrations_waiting? end context "and migrations are in diff" do
fix memorization when DIFF is empty Previous memoization failed when result was false
mattpolito_paratrooper
train
rb,rb
29920763e3fd9754739467d08f201d56d0511cf1
diff --git a/lib/metasploit_data_models/version.rb b/lib/metasploit_data_models/version.rb index <HASH>..<HASH> 100755 --- a/lib/metasploit_data_models/version.rb +++ b/lib/metasploit_data_models/version.rb @@ -4,5 +4,5 @@ module MetasploitDataModels # metasploit-framework/data/sql/migrate to db/migrate in this project, not all models have specs that verify the # migrations (with have_db_column and have_db_index) and certain models may not be shared between metasploit-framework # and pro, so models may be removed in the future. Because of the unstable API the version should remain below 1.0.0 - VERSION = '0.17.2-metasploit-data-models-search' + VERSION = '0.17.2' end
Remove prerelease from version MSP-<I>
rapid7_metasploit_data_models
train
rb
50fc7e3c4809509fecf154cfb8cdd97e745ca027
diff --git a/src/main/java/org/jboss/pressgang/ccms/contentspec/wrapper/collection/CollectionWrapper.java b/src/main/java/org/jboss/pressgang/ccms/contentspec/wrapper/collection/CollectionWrapper.java index <HASH>..<HASH> 100644 --- a/src/main/java/org/jboss/pressgang/ccms/contentspec/wrapper/collection/CollectionWrapper.java +++ b/src/main/java/org/jboss/pressgang/ccms/contentspec/wrapper/collection/CollectionWrapper.java @@ -15,6 +15,8 @@ public interface CollectionWrapper<T extends EntityWrapper<T>> { public List<T> getItems(); + public List<T> getUnchangedItems(); + public List<T> getAddItems(); public List<T> getRemoveItems();
Added missing method to CollectionWrapper interface.
pressgang-ccms_PressGangCCMSContentSpec
train
java
3e883f0efc3c38aa32c11c06e2e044086a4129f5
diff --git a/view.go b/view.go index <HASH>..<HASH> 100644 --- a/view.go +++ b/view.go @@ -961,10 +961,10 @@ func (v *View) Status() map[string]string { return m } -func (v *View) SetStatus(key string, val string) { +func (v *View) SetStatus(key, val string) { v.lock.Lock() - defer v.lock.Unlock() v.status[key] = val + v.lock.Unlock() OnStatusChanged.Call(v) } @@ -976,8 +976,8 @@ func (v *View) GetStatus(key string) string { func (v *View) EraseStatus(key string) { v.lock.Lock() - defer v.lock.Unlock() delete(v.status, key) + v.lock.Unlock() OnStatusChanged.Call(v) }
Fixing deadlock on changing view status after set and erase status in a view, we call status changed event which may access the status map. so we should unlock the lock before calling the event.
limetext_backend
train
go
b36e6fd18a0d9b28a576973887dac2d7197daa52
diff --git a/glue/pipeline.py b/glue/pipeline.py index <HASH>..<HASH> 100644 --- a/glue/pipeline.py +++ b/glue/pipeline.py @@ -1317,6 +1317,9 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="3.0" count="1" in input_file_dict = {} output_file_dict = {} + # pattern to match files endig in ,xml or .xml.gz + xml_pat = re.compile(r'.*\.xml(\.gz$|$)') + # creating dictionary for input- and output-files for node in self.__nodes: @@ -1515,7 +1518,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="3.0" count="1" in for f in node.get_input_files(): # FIXME need a better way of dealing with the cache subdirectory f = os.path.basename(f) - if f in inout_filelist: + if xml_pat.match(f) and f in inout_filelist: print >>dagfile, """\ <uses file="%s" link="inout" register="false" transfer="true"/>\ """ % f
only xml files should get inout status in a dax
gwastro_pycbc-glue
train
py
39a4959e534884a62f308521117166695592d413
diff --git a/synapse/datamodel.py b/synapse/datamodel.py index <HASH>..<HASH> 100644 --- a/synapse/datamodel.py +++ b/synapse/datamodel.py @@ -303,7 +303,10 @@ class DataModel(s_types.TypeLib): if dtype == None: return valu,{} - return dtype.chop(valu) + try: + return dtype.chop(valu) + except BadTypeValu: + raise BadPropValu(name=prop, valu=valu) #def getPropNorms(self, props): #return { p:self.getPropNorm(p,v) for (p,v) in props.items() } diff --git a/synapse/exc.py b/synapse/exc.py index <HASH>..<HASH> 100644 --- a/synapse/exc.py +++ b/synapse/exc.py @@ -27,7 +27,7 @@ class BadMesgVers(SynErr):pass class BadUrl(Exception):pass class BadJson(Exception):pass class BadMesgResp(Exception):pass -class BadPropValu(Exception):pass +class BadPropValu(SynErr):pass class BadPySource(Exception):pass class DupOpt(Exception):pass
Raise more specific exception on bad prop.
vertexproject_synapse
train
py,py
c4ef9ff816c673770f6c0e55472efe78a6b6e6f7
diff --git a/options.go b/options.go index <HASH>..<HASH> 100644 --- a/options.go +++ b/options.go @@ -90,9 +90,8 @@ func Clock(c clock.Clock) Option { return func(r *Ringpop) error { if c == nil { return errors.New("clock is required") - } else { - r.clock = c } + r.clock = c return nil } }
Fix lint error options.go:<I> "if block ends with a return statement, so drop this else and outdent its block"
uber_ringpop-go
train
go
242b3283fdb151514681c21c2666632c521532e1
diff --git a/libcontainer/cgroups/fscommon/utils.go b/libcontainer/cgroups/fscommon/utils.go index <HASH>..<HASH> 100644 --- a/libcontainer/cgroups/fscommon/utils.go +++ b/libcontainer/cgroups/fscommon/utils.go @@ -3,7 +3,6 @@ package fscommon import ( - "errors" "fmt" "math" "strconv" @@ -13,8 +12,6 @@ import ( ) var ( - ErrNotValidFormat = errors.New("line is not a valid key value format") - // Deprecated: use cgroups.OpenFile instead. OpenFile = cgroups.OpenFile // Deprecated: use cgroups.ReadFile instead.
libct/cg/fscommon: rm unused var It is not used since commit <I>f<I>e<I>abfea0 Fixes: <I>f<I>e<I>abfea0
opencontainers_runc
train
go
bb4035cbeb094f3135e8efc0a56126f9e8824771
diff --git a/HARK/ConsumptionSaving/ConsIndShockModel.py b/HARK/ConsumptionSaving/ConsIndShockModel.py index <HASH>..<HASH> 100644 --- a/HARK/ConsumptionSaving/ConsIndShockModel.py +++ b/HARK/ConsumptionSaving/ConsIndShockModel.py @@ -2958,7 +2958,6 @@ class KinkedRconsumerType(IndShockConsumerType): """ time_inv_ = copy(IndShockConsumerType.time_inv_) - time_inv_.remove("Rfree") time_inv_ += ["Rboro", "Rsave"] def __init__(self, **kwds):
remove Rfree from KinkedRconsumerType
econ-ark_HARK
train
py
1fdc1cf66080aa069a9a18658a1706e3d78e6931
diff --git a/hangups/ui/__main__.py b/hangups/ui/__main__.py index <HASH>..<HASH> 100644 --- a/hangups/ui/__main__.py +++ b/hangups/ui/__main__.py @@ -45,7 +45,7 @@ COL_SCHEMES = { ('msg_date', 'dark cyan', ''), ('msg_sender', 'dark blue', ''), ('msg_text_self', '', ''), - ('msg_self', 'light blue', ''), + ('msg_self', 'dark green', ''), ('msg_text', '', ''), ('status_line', 'standout', ''), ('tab_background', 'black,standout,underline', 'light green'),
Change default solarized msg_self colour "light blue" doesn't display properly for me.
tdryer_hangups
train
py
49c9131d5088085ad262c93e8bccfc160f4c04e8
diff --git a/src/InputController/CLIController/CLIResponse.php b/src/InputController/CLIController/CLIResponse.php index <HASH>..<HASH> 100644 --- a/src/InputController/CLIController/CLIResponse.php +++ b/src/InputController/CLIController/CLIResponse.php @@ -43,7 +43,7 @@ class CLIResponse extends OutputResponse { $code = 0; } $this->setCode($code); - $this->setBody($body); + $this->setBody($body . "\n"); } /** diff --git a/src/InputController/HTTPController/LocalFileHTTPResponse.php b/src/InputController/HTTPController/LocalFileHTTPResponse.php index <HASH>..<HASH> 100644 --- a/src/InputController/HTTPController/LocalFileHTTPResponse.php +++ b/src/InputController/HTTPController/LocalFileHTTPResponse.php @@ -74,7 +74,7 @@ class LocalFileHTTPResponse extends HTTPResponse { throw new NotFoundException('notFoundLocalFile'); } $this->localFilePath = $filePath; - $this->fileName = $filePath ?: basename($filePath); + $this->fileName = $fileName ?: basename($filePath); $this->download = $download; $this->cacheMaxAge = $cacheMaxAge; }
Fix issue with file download Fiw display of body in console
Sowapps_orpheus-inputcontroller
train
php,php
b68a28418cf1feb8f294d43b6d253758770c93eb
diff --git a/src/Slim/Middleware/Minify.php b/src/Slim/Middleware/Minify.php index <HASH>..<HASH> 100644 --- a/src/Slim/Middleware/Minify.php +++ b/src/Slim/Middleware/Minify.php @@ -40,8 +40,8 @@ class Minify extends \Slim\Middleware $res = $app->response(); $body = $res->body(); - $search = array('/\n/','/\>[^\S ]+/s','/[^\S ]+\</s','/(\s)+/s'); - $replace = array(' ','>','<','\\1'); + $search = array('/(?:(?:\/\*(?:[^*]|(?:\*+[^*\/]))*\*+\/)|(?:(?<!\:|\\\|\')\/\/.*))/', '/\n/','/\>[^\S ]+/s','/[^\S ]+\</s','/(\s)+/s'); + $replace = array(' ', ' ','>','<','\\1'); $squeezedHTML = preg_replace($search, $replace, $body);
Support for minification of JS Comments as well, since often times JS is inline in Slim templates
christianklisch_slim-minify
train
php
946ab5ae57b7b4415fb2780d8d3f2f27c821f887
diff --git a/salt/overstate.py b/salt/overstate.py index <HASH>..<HASH> 100644 --- a/salt/overstate.py +++ b/salt/overstate.py @@ -170,12 +170,12 @@ class OverState(object): for comp in self.over: rname = comp.keys()[0] if req == rname: - stage = comp[rname] - v_stage = self.verify_stage(rname, stage) + rstage = comp[rname] + v_stage = self.verify_stage(rname, rstage) if isinstance(v_stage, list): yield {rname: v_stage} else: - yield self.call_stage(rname, stage) + yield self.call_stage(rname, rstage) if req_fail[name]: yield req_fail else:
Fix overstate recursive call mapping references
saltstack_salt
train
py
93bb42b5de5f11d71fa6981d0ee7dde0d8db07e8
diff --git a/core/src/main/java/com/orientechnologies/orient/core/Orient.java b/core/src/main/java/com/orientechnologies/orient/core/Orient.java index <HASH>..<HASH> 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/Orient.java +++ b/core/src/main/java/com/orientechnologies/orient/core/Orient.java @@ -285,7 +285,7 @@ public class Orient extends OListenerManger<OOrientListener> { */ private void initShutdownQueue() { addShutdownHandler(new OShutdownWorkersHandler()); - addShutdownHandler(new OShutdownEnginesHandler()); +// addShutdownHandler(new OShutdownEnginesHandler()); addShutdownHandler(new OShutdownPendingThreadsHandler()); addShutdownHandler(new OShutdownProfilerHandler()); addShutdownHandler(new OShutdownCallListenersHandler());
disabled the shutdown of engine from Orient class
orientechnologies_orientdb
train
java
d624f25df34d170c95cc0db9500b4a682f6b9fbe
diff --git a/packages/react-scripts/config/webpack.config.prod.js b/packages/react-scripts/config/webpack.config.prod.js index <HASH>..<HASH> 100644 --- a/packages/react-scripts/config/webpack.config.prod.js +++ b/packages/react-scripts/config/webpack.config.prod.js @@ -171,14 +171,16 @@ module.exports = { new OptimizeCSSAssetsPlugin({ cssProcessorOptions: { parser: safePostCssParser, - map: { - // `inline: false` forces the sourcemap to be output into a - // separate file - inline: false, - // `annotation: true` appends the sourceMappingURL to the end of - // the css file, helping the browser find the sourcemap - annotation: true, - }, + map: shouldUseSourceMap + ? { + // `inline: false` forces the sourcemap to be output into a + // separate file + inline: false, + // `annotation: true` appends the sourceMappingURL to the end of + // the css file, helping the browser find the sourcemap + annotation: true, + } + : false, }, }), ],
Fix GENERATE_SOURCEMAP env not working for css (#<I>)
facebook_create-react-app
train
js
151aa8117691643ccc1b48a2612f3e210211e0ec
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -48,4 +48,6 @@ setup( include_package_data=True, version = my_version, install_requires=requires, + test_suite='test_requests_kerberos', + tests_require=['mock'], )
Add dependenices to enable './setup.py test' command
requests_requests-kerberos
train
py
be6ba53586338651f683b24a3ae7ba1b58b8c954
diff --git a/mysql/check.py b/mysql/check.py index <HASH>..<HASH> 100644 --- a/mysql/check.py +++ b/mysql/check.py @@ -856,8 +856,9 @@ class MySql(AgentCheck): slave_results = cursor.fetchall() if len(slave_results) > 0: for slave_result in slave_results: - # MySQL <5.7 does not have Channel_Name - channel = slave_result.get('Channel_Name', 'default') + # MySQL <5.7 does not have Channel_Name. + # For MySQL >=5.7 'Channel_Name' is set to an empty string by default + channel = slave_result.get('Channel_Name') or 'default' for key in slave_result: if slave_result[key] is not None: if key not in replica_results:
Fix default channel replication name By default (with only one master) 'Channel_Name' is set to an empty string.
DataDog_integrations-core
train
py
0e79ec8d489b74d34196d1e649d29981eb4efdd1
diff --git a/src/collectors/userscripts/userscripts.py b/src/collectors/userscripts/userscripts.py index <HASH>..<HASH> 100644 --- a/src/collectors/userscripts/userscripts.py +++ b/src/collectors/userscripts/userscripts.py @@ -27,7 +27,11 @@ import os import sys # Get a subprocess capable of check_output if sys.version_info < (2, 7): - from kitchen.pycompat27 import subprocess + try: + from kitchen.pycompat27 import subprocess + subprocess # workaround for pyflakes issue #13 + except ImportError: + subprocess = None else: import subprocess @@ -56,6 +60,10 @@ class UserScriptsCollector(diamond.collector.Collector): return config def collect(self): + if subprocess is None: + self.log.error('Unable to import kitchen') + return {} + scripts_path = self.config['scripts_path'] if not os.access(scripts_path, os.R_OK): return None
Silently ignore missing kitchen imports
python-diamond_Diamond
train
py
dfebb404cbe40f7893dc91fd7c0df4c10ae5564b
diff --git a/pkg/progress/bar.go b/pkg/progress/bar.go index <HASH>..<HASH> 100644 --- a/pkg/progress/bar.go +++ b/pkg/progress/bar.go @@ -70,9 +70,9 @@ func (h Bar) Format(state fmt.State, r rune) { negative := width - pad - positive n := 1 - n += copy(p[n:], []byte(green)) + n += copy(p[n:], green) n += copy(p[n:], bytes.Repeat([]byte("+"), positive)) - n += copy(p[n:], []byte(reset)) + n += copy(p[n:], reset) if negative > 0 { copy(p[n:len(p)-1], bytes.Repeat([]byte("-"), negative))
remove excessive []byte(s) conversion `copy` permits using to mix `[]byte` and `string` arguments without explicit conversion. I removed explicit conversion to make the code simpler.
containerd_containerd
train
go
d8d8bdd97bde08967ab88601dd163dec64353355
diff --git a/calendar/lib.php b/calendar/lib.php index <HASH>..<HASH> 100644 --- a/calendar/lib.php +++ b/calendar/lib.php @@ -2428,7 +2428,22 @@ class calendar_information { * @param int $month * @param int $year */ - public function __construct($day, $month, $year) { + public function __construct($day=0, $month=0, $year=0) { + + $date = usergetdate(time()); + + if (empty($day)) { + $day = $date['mday']; + } + + if (empty($month)) { + $month = $date['mon']; + } + + if (empty($year)) { + $year = $date['year']; + } + $this->day = $day; $this->month = $month; $this->year = $year;
calendar MDL-<I> set better defaults when constructing a calendar object.
moodle_moodle
train
php
845abf0082abf938de9d47ccd72baefb747f3055
diff --git a/src/Cache.php b/src/Cache.php index <HASH>..<HASH> 100644 --- a/src/Cache.php +++ b/src/Cache.php @@ -105,7 +105,7 @@ class Cache // educated guess (remove lock early enough so if anything goes wrong // with first process, another one can pick up) // SMELL: a bit problematic, why $grace_ttl/2 ??? - $lock_ttl = (int)($grace_ttl/2); + $lock_ttl = max(1, (int)($grace_ttl/2)); return $this->store->add($this->prepareLockKey($key), 1, $lock_ttl); }
Avoid setting lock TTL for infinity. For 1 second $grace_ttl expression (int)(1/2) equals 0. In Memcache if TTL is 0 then cache item never expires.
sobstel_metaphore
train
php
5e3735942be62671d86f503be79df1b648b4df35
diff --git a/satpy/modifiers/parallax.py b/satpy/modifiers/parallax.py index <HASH>..<HASH> 100644 --- a/satpy/modifiers/parallax.py +++ b/satpy/modifiers/parallax.py @@ -167,7 +167,7 @@ def _calculate_parallax_distance(height, elevation): class ParallaxCorrection: - """Class for parallax corrections. + """Parallax correction calculations. This class contains higher-level functionality to wrap the parallax correction calculations in :func:`forward_parallax`. The class is
Change opening line of class docstring.
pytroll_satpy
train
py
2b9b3e90c1810b53054842ec5b61e628798292ba
diff --git a/src/event/event.js b/src/event/event.js index <HASH>..<HASH> 100644 --- a/src/event/event.js +++ b/src/event/event.js @@ -82,7 +82,7 @@ jQuery.event = { for ( ret in events[type] ) break; if ( !ret ) { ret = element["on" + type] = null; - delete element.$events[type]; + delete events[type]; } }
Fix generic event handler and $events expando removal for IE
jquery_jquery
train
js
b8018621cfc305e757e027f059da7728b8d8e2ad
diff --git a/wcomponents-theme/src/main/js/wc/ui/imageEdit.js b/wcomponents-theme/src/main/js/wc/ui/imageEdit.js index <HASH>..<HASH> 100644 --- a/wcomponents-theme/src/main/js/wc/ui/imageEdit.js +++ b/wcomponents-theme/src/main/js/wc/ui/imageEdit.js @@ -524,9 +524,12 @@ function(has, mixin, Widget, event, uid, classList, timers, prompt, i18n, fabric event.add(container, "touchend", pressEnd); function clickEvent($event) { - var target = $event.target, - element = BUTTON.findAncestor(target), + var element = $event.target, config = getEventConfig(element, "click"); + if (!config) { + element = BUTTON.findAncestor(element); + config = getEventConfig(element, "click"); + } if (config) { pressEnd(); timer = timers.setTimeout(config.func.bind(this, config, $event), 0);
Fix redact mode (broken in #<I>)
BorderTech_wcomponents
train
js
22af629b5d4103dc4e9f4fe7f5a894ba6f807621
diff --git a/wagtailgmaps/wagtail_hooks.py b/wagtailgmaps/wagtail_hooks.py index <HASH>..<HASH> 100644 --- a/wagtailgmaps/wagtail_hooks.py +++ b/wagtailgmaps/wagtail_hooks.py @@ -8,8 +8,12 @@ from wagtail.wagtailcore import hooks @hooks.register('insert_editor_js') def editor_js(): + maps_js = 'https://maps.googleapis.com/maps/api/js?key={}'.format(settings.WAGTAIL_ADDRESS_MAP_KEY) + language = getattr(settings, 'WAGTAIL_ADDRESS_MAP_LANGUAGE', None) + if language: + maps_js += '&language={}'.format(language) js_files = ( - 'https://maps.googleapis.com/maps/api/js?key={}'.format(settings.WAGTAIL_ADDRESS_MAP_KEY), + maps_js, static('wagtailgmaps/js/map-field-panel.js'), ) js_includes = format_html_join(
Include language option for Google API (#<I>)
springload_wagtailgmaps
train
py
73698d292a2c60cbe947efc2f62c05d8ffd88277
diff --git a/routers/user/home.go b/routers/user/home.go index <HASH>..<HASH> 100644 --- a/routers/user/home.go +++ b/routers/user/home.go @@ -152,6 +152,7 @@ func ShowSSHKeys(ctx *middleware.Context, uid int64) { var buf bytes.Buffer for i := range keys { buf.WriteString(keys[i].OmitEmail()) + buf.WriteString("\n") } ctx.RenderData(200, buf.Bytes()) }
fix .keys route This change fixes the output from /{{ username }}.keys so that it can work in a ~/.ssh/authorized_keys file
gogs_gogs
train
go
b6cfb3dd614b47db304f5f194469d54113682ab5
diff --git a/src/global/css.js b/src/global/css.js index <HASH>..<HASH> 100644 --- a/src/global/css.js +++ b/src/global/css.js @@ -1,4 +1,5 @@ import { doc } from '../config/environment'; +import { isArray } from '../utils/is'; const PREFIX = '/* Ractive.js component styles */'; @@ -54,6 +55,7 @@ export function applyCSS(force) { } export function getCSS(cssIds) { + if (cssIds && !isArray(cssIds)) cssIds = [cssIds]; const filteredStyleDefinitions = cssIds ? styleDefinitions.filter(style => ~cssIds.indexOf(style.id)) : styleDefinitions;
avoid duplicating css of cssids that are contained by other cssids
ractivejs_ractive
train
js
4485ca97c65bcc305f81f34e926c7c9c64d312d4
diff --git a/etesync/api.py b/etesync/api.py index <HASH>..<HASH> 100644 --- a/etesync/api.py +++ b/etesync/api.py @@ -118,10 +118,11 @@ class EteSync: journal = existing[entry.uid] del existing[journal.uid] else: - journal = cache.JournalEntity(local_user=self.user, version=entry.version, uid=entry.uid, - owner=entry.owner, - encrypted_key=entry.encrypted_key, - read_only=entry.read_only) + journal = cache.JournalEntity(local_user=self.user, uid=entry.uid, owner=entry.owner) + + journal.version = entry.version + journal.encrypted_key = entry.encrypted_key + journal.read_only = entry.read_only journal.content = entry.getContent() journal.save()
Journal list fetching: fix stale cache issue. These fields can change and therefore we need to always fetch them.
etesync_pyetesync
train
py
3e17113e75d4a10f966c1ac207b2b1e6e95f0f2a
diff --git a/test_20x4.py b/test_20x4.py index <HASH>..<HASH> 100755 --- a/test_20x4.py +++ b/test_20x4.py @@ -29,11 +29,11 @@ if len(sys.argv) < 2: if sys.argv[1] == 'i2c': if len(sys.argv) != 4: print_usage() - lcd = i2c.CharLCD(int(sys.argv[2], 16), cols=16, rows=2, charmap=sys.argv[3]) + lcd = i2c.CharLCD(int(sys.argv[2], 16), cols=20, rows=4, charmap=sys.argv[3]) elif sys.argv[1] == 'gpio': if len(sys.argv) != 3: print_usage() - lcd = gpio.CharLCD(cols=16, rows=2, charmap=sys.argv[2]) + lcd = gpio.CharLCD(cols=20, rows=4, charmap=sys.argv[2]) else: print_usage()
Fix LCD configuration in <I>x4 test script Thanks @fake-name for reporting this in #<I>.
dbrgn_RPLCD
train
py
fa273c24e7025f8ec51f7dd3baa3dedd658f9725
diff --git a/lib/xcodeproj/project/object/helpers/file_references_factory.rb b/lib/xcodeproj/project/object/helpers/file_references_factory.rb index <HASH>..<HASH> 100644 --- a/lib/xcodeproj/project/object/helpers/file_references_factory.rb +++ b/lib/xcodeproj/project/object/helpers/file_references_factory.rb @@ -132,13 +132,14 @@ module Xcodeproj GroupableHelper.set_path_with_source_tree(ref, path, source_tree) ref.version_group_type = 'wrapper.xcdatamodel' + real_path = group.real_path.join(path) current_version_name = nil - if path.exist? - path.children.each do |child_path| + if real_path.exist? + real_path.children.each do |child_path| if File.extname(child_path) == '.xcdatamodel' new_file_reference(ref, child_path, :group) elsif File.basename(child_path) == '.xccurrentversion' - full_path = path + File.basename(child_path) + full_path = real_path + File.basename(child_path) xccurrentversion = Plist.read_from_path(full_path) current_version_name = xccurrentversion['_XCCurrentVersionName'] end
Fixed handling of xcdatamodeld packages in subfolders
CocoaPods_Xcodeproj
train
rb
314c6bf4159d4a84e76635a441fb62dba0122b2f
diff --git a/tests/test_version.py b/tests/test_version.py index <HASH>..<HASH> 100644 --- a/tests/test_version.py +++ b/tests/test_version.py @@ -2,7 +2,7 @@ import os -from tests.base import BaseTestZSTD +from tests.base import BaseTestZSTD, log class TestZSTD(BaseTestZSTD): @@ -11,13 +11,16 @@ class TestZSTD(BaseTestZSTD): self.ZSTD_EXTERNAL = True self.VERSION = os.getenv("VERSION") self.PKG_VERSION = os.getenv("PKG_VERSION") - v = [int(n) for n in self.VERSION.split(".")] - v = sorted(v, reverse=True) + log.info("VERSION=%r" % self.VERSION) + log.info("PKG_VERSION=%r" % self.PKG_VERSION) + v = [int(n) for n in reversed(self.VERSION.split("."))] + log.info("v=%r" % (v,)) self.VERSION_INT = 0 i = 0 for n in v: self.VERSION_INT += n * 100**i i += 1 + log.info("VERSION_INT=%r" % self.VERSION_INT) def test_module_version(self): BaseTestZSTD.helper_version(self)
Fix version tests - don't sort, just reverse
sergey-dryabzhinsky_python-zstd
train
py
ef3303ea44400009cade7576d08d228283cb745a
diff --git a/timber.php b/timber.php index <HASH>..<HASH> 100644 --- a/timber.php +++ b/timber.php @@ -532,7 +532,7 @@ class Timber { $args['total'] = ceil($wp_query->found_posts / $wp_query->query_vars['posts_per_page']); if (strlen(trim(get_option('permalink_structure')))){ $url = explode('?', get_pagenum_link(0)); - if($url[1]) { + if (isset($url[1])){ parse_str($url[1], $query); $args['add_args'] = $query; }
needed sanity check for when pretty permalinks ARE enabled
timber_timber
train
php
e5c445f8a6c449e2721f593640e5a6f504cf63bc
diff --git a/src/PuliPlugin.php b/src/PuliPlugin.php index <HASH>..<HASH> 100644 --- a/src/PuliPlugin.php +++ b/src/PuliPlugin.php @@ -75,7 +75,7 @@ class PuliPlugin implements PluginInterface, EventSubscriberInterface public function __construct(PuliRunner $puliRunner = null) { $this->puliRunner = $puliRunner; - $this->rootDir = getcwd(); + $this->rootDir = Path::normalize(getcwd()); } /**
Made sure the current working directory is normalized
puli_composer-plugin
train
php
6dc095b3faf99653e5c4723fd4b4bb2ceeeb66e5
diff --git a/lib/capybara/selenium/node.rb b/lib/capybara/selenium/node.rb index <HASH>..<HASH> 100644 --- a/lib/capybara/selenium/node.rb +++ b/lib/capybara/selenium/node.rb @@ -25,8 +25,7 @@ class Capybara::Selenium::Node < Capybara::Driver::Node elsif tag_name == 'input' and type == 'file' native.send_keys(value.to_s) elsif tag_name == 'textarea' or tag_name == 'input' - native.clear - native.send_keys(value.to_s) + native.send_keys(("\b" * native[:value].size) + value.to_s) end end
Emulate user input to prevent onchange from being triggered twice in Selenium driver
teamcapybara_capybara
train
rb
10af47d8d11acaf554194591b99a55c8353c4387
diff --git a/describe.js b/describe.js index <HASH>..<HASH> 100644 --- a/describe.js +++ b/describe.js @@ -97,8 +97,9 @@ } function Group(name, tests, config) { - this.options = options; - for (var k in config) this.options[k] = config[k]; + this.options = {}; + for (var k in options) this.options[k] = options[k]; + for (k in config) this.options[k] = config[k]; this.tests = tests; } diff --git a/tests/tests.js b/tests/tests.js index <HASH>..<HASH> 100644 --- a/tests/tests.js +++ b/tests/tests.js @@ -143,6 +143,18 @@ describe("expections", { }, { timeout: 1 }); + +describe("describe options", { + + "should revert to default timeout of 500ms": function() { + (function(callback) { + setTimeout(function() { callback(2); }, 400); + }(this.expect(2))); + } + +}); + + (function() { var arr = [], bowties;
I always forget to clone objects in JavaScript for some reason.
Yuffster_describe
train
js,js
ff54aba1f96360a4a353d2df03144082ba2a3b07
diff --git a/tasks/jshint.js b/tasks/jshint.js index <HASH>..<HASH> 100644 --- a/tasks/jshint.js +++ b/tasks/jshint.js @@ -22,9 +22,6 @@ module.exports = function(grunt) { reporterOutput: null, }); - // log (verbose) options before hooking in the reporter - grunt.verbose.writeflags(options, 'JSHint options'); - // Report JSHint errors but dont fail the task var force = options.force; delete options.force;
Remove verbose writeFlags as of Grunt <I> its automatic. Ref gruntjs/grunt#<I>.
gruntjs_grunt-contrib-jshint
train
js
bdf66c9a66f6b0be57a6ed9f22ef438f321f5a2f
diff --git a/src/FluxBB/Core.php b/src/FluxBB/Core.php index <HASH>..<HASH> 100644 --- a/src/FluxBB/Core.php +++ b/src/FluxBB/Core.php @@ -7,7 +7,6 @@ use Config; class Core extends Facade { - protected static function getFacadeAccessor() { return static::$app; @@ -25,5 +24,4 @@ class Core extends Facade { return '2.0.0-alpha1'; } - } diff --git a/src/FluxBB/Core/CoreServiceProvider.php b/src/FluxBB/Core/CoreServiceProvider.php index <HASH>..<HASH> 100644 --- a/src/FluxBB/Core/CoreServiceProvider.php +++ b/src/FluxBB/Core/CoreServiceProvider.php @@ -8,7 +8,6 @@ use FluxBB\Models\ConfigRepository; class CoreServiceProvider extends ServiceProvider { - /** * Indicates if loading of the provider is deferred. * @@ -54,5 +53,4 @@ class CoreServiceProvider extends ServiceProvider { return array(); } - }
PSR-2: Fix class closing.
fluxbb_core
train
php,php
2cfb48c5e3776297c763c56301c4084075af35ae
diff --git a/serf/messages.go b/serf/messages.go index <HASH>..<HASH> 100644 --- a/serf/messages.go +++ b/serf/messages.go @@ -83,6 +83,7 @@ type messageQueryResponse struct { LTime LamportTime // Event lamport time ID uint32 // Query ID From string // Node name + Ack bool // Is this an Ack, or reply Payload []byte // Optional response payload }
serf: Adding field to distinguish ack from response
hashicorp_serf
train
go