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
85f94646f414bcaf94f81cff0965178206863f15
diff --git a/src/clusterpost-execution/executionserver.methods.js b/src/clusterpost-execution/executionserver.methods.js index <HASH>..<HASH> 100644 --- a/src/clusterpost-execution/executionserver.methods.js +++ b/src/clusterpost-execution/executionserver.methods.js @@ -230,7 +230,12 @@ module.exports = function (conf) { handler.createOutputDirs = function(doc){ var cwd = handler.getDirectoryCWD(doc); _.each(doc.outputs, (output)=>{ - var target_dir = path.dirname(path.join(cwd, output.name)); + if(output.type == "directory"){ + var target_dir = path.join(cwd, output.name); + }else{ + var target_dir = path.dirname(path.join(cwd, output.name)); + } + if(!fs.existsSync(target_dir)){ fs.mkdirSync(target_dir, {recursive: true}); }
BUG: If the output type is directory create it If the output type is directory, don't get the dirname
juanprietob_clusterpost
train
js
88b425291ea14afc14f703fbbbc886b5069a7709
diff --git a/wandb/wandb_keras.py b/wandb/wandb_keras.py index <HASH>..<HASH> 100644 --- a/wandb/wandb_keras.py +++ b/wandb/wandb_keras.py @@ -76,9 +76,11 @@ class WandbKerasCallback(object): # summary current = logs.get(self.monitor) - if current is None: - print('Can save best model only with %s available, ' - 'skipping.' % (self.monitor)) + if current is None: # validation data wasn't set +# print('Can save best model only with %s available, ' +# 'skipping.' % (self.monitor)) + wandb.run.summary.update(row) + return copied = copy.copy(row) if self.monitor_op(current, self.best):
fixed bug when keras callback is used without validation data
wandb_client
train
py
5d75a0e7d613948245d1eb0353fb660f4664c9ed
diff --git a/discord/message.py b/discord/message.py index <HASH>..<HASH> 100644 --- a/discord/message.py +++ b/discord/message.py @@ -281,7 +281,7 @@ class MessageReference: The guild id of the message referenced. resolved: Optional[Union[:class:`Message`, :class:`DeletedReferencedMessage`]] The message that this reference resolved to. If this is ``None`` - then the original message was not fetched either due to the discord API + then the original message was not fetched either due to the Discord API not attempting to resolve it or it not being available at the time of creation. If the message was resolved at a prior point but has since been deleted then this will be of type :class:`DeletedReferencedMessage`. @@ -430,7 +430,7 @@ class Message(Hashable): .. warning:: The order of the mentions list is not in any particular order so you should - not rely on it. This is a discord limitation, not one with the library. + not rely on it. This is a Discord limitation, not one with the library. channel_mentions: List[:class:`abc.GuildChannel`] A list of :class:`abc.GuildChannel` that were mentioned. If the message is in a private message then the list is always empty.
Capitalize Discord in docs of message related attributes
Rapptz_discord.py
train
py
1faa0f46d7ba225f8a934d62fbcb646200e35448
diff --git a/tests/ApiTest.php b/tests/ApiTest.php index <HASH>..<HASH> 100644 --- a/tests/ApiTest.php +++ b/tests/ApiTest.php @@ -21,6 +21,8 @@ class ApiTest extends \PHPUnit_Framework_TestCase { $this->assertEquals('user', $api->getUsername()); $this->assertEquals('pass', $api->getPassword()); $this->assertEquals('/dev/null', $api->getCertificatePath()); + $this->assertEquals(TRUE, $api->hasBasicAuthentication()); + $this->assertEquals(TRUE, $api->hasCertificatePath()); } } \ No newline at end of file
Added tests for boolean has functions
teamdeeson_wardenapi
train
php
67e38ca1e3dce7d89f942c8717392d3d70adeb43
diff --git a/lib/preferences.js b/lib/preferences.js index <HASH>..<HASH> 100644 --- a/lib/preferences.js +++ b/lib/preferences.js @@ -31,14 +31,21 @@ Preferences.write = function(key, value) { .then(contents => { contents = contents || {}; contents[key] = value; - fs.writeFile(preferencesJson, JSON.stringify(contents), function(error) { + fs.ensureFile(preferencesJson, function(err){ if (error) { log.error('Error writing preference', key, value); reject(error); } else { - resolve(); + fs.writeFile(preferencesJson, JSON.stringify(contents), function(error) { + if (error) { + log.error('Error writing preference', key, value); + reject(error); + } else { + resolve(); + } + }); } - }); + }) }) .catch(error => { reject(error);
fs.ensureFile to fix missing .tessel dir in Preferences.write Fix for issue #<I>
tessel_t2-cli
train
js
b9ae35715a85adda9b674d36c3ce6a8c45683df5
diff --git a/htmresearch/algorithms/temporal_memory_factory.py b/htmresearch/algorithms/temporal_memory_factory.py index <HASH>..<HASH> 100644 --- a/htmresearch/algorithms/temporal_memory_factory.py +++ b/htmresearch/algorithms/temporal_memory_factory.py @@ -74,11 +74,8 @@ class ReversedExtendedTemporalMemory(FastETM): else: activeApicalCells = [] - self.activateBasalDendrites( + self.activateDendrites( activeExternalCells, - learn - ) - self.activateApicalDendrites( activeApicalCells, learn )
Call activateDendrites, not activateBasalDendrites. activateBasalDendrites and activateApicalDendrites are being removed.
numenta_htmresearch
train
py
67e9b759a8e65a689777d858c0415e01d6cdddf7
diff --git a/lib/adapter.js b/lib/adapter.js index <HASH>..<HASH> 100644 --- a/lib/adapter.js +++ b/lib/adapter.js @@ -10586,7 +10586,9 @@ define("../vendor/jquery-1.10.1.min.js", function(){}); }, onCucumberFinished: function onCucumberFinished() { - karma.complete({}); + karma.complete({ + coverage: window.__coverage__ + }); } }; diff --git a/source/adapter/cucumber_runner.js b/source/adapter/cucumber_runner.js index <HASH>..<HASH> 100644 --- a/source/adapter/cucumber_runner.js +++ b/source/adapter/cucumber_runner.js @@ -71,7 +71,9 @@ }, onCucumberFinished: function onCucumberFinished() { - karma.complete({}); + karma.complete({ + coverage: window.__coverage__ + }); } };
Pass on code coverage results back to Karma. Resolves #<I>
s9tpepper_karma-cucumberjs
train
js,js
07c69791592333fcad8651080148329eb4c527ac
diff --git a/netmiko/base_connection.py b/netmiko/base_connection.py index <HASH>..<HASH> 100644 --- a/netmiko/base_connection.py +++ b/netmiko/base_connection.py @@ -38,7 +38,7 @@ class BaseConnection(object): key_file=None, allow_agent=False, ssh_strict=False, system_host_keys=False, alt_host_keys=False, alt_key_file='', ssh_config_file=None, timeout=8, session_timeout=60, keepalive=0, default_enter=None, response_return=None, - serial_settings={}): + serial_settings=None): """ Initialize attributes for establishing connection to target device. @@ -129,6 +129,8 @@ class BaseConnection(object): self.timeout = timeout self.session_timeout = session_timeout self.keepalive = keepalive + if serial_settings is None: + serial_settings = {} self.serial_settings = serial_settings self.serial_defaults = { 'baudrate': 9600,
implemented suggested fix for python mutable issue
ktbyers_netmiko
train
py
990bc3421daee113b737e574bf7e931de6b36450
diff --git a/lib/chef/resource/portage_package.rb b/lib/chef/resource/portage_package.rb index <HASH>..<HASH> 100644 --- a/lib/chef/resource/portage_package.rb +++ b/lib/chef/resource/portage_package.rb @@ -22,13 +22,9 @@ class Chef class Resource class PortagePackage < Chef::Resource::Package resource_name :portage_package - description "Use the portage_package resource to manage packages for the Gentoo platform." - - def initialize(name, run_context = nil) - super - @provider = Chef::Provider::Package::Portage - end + provides :portage_package + description "Use the portage_package resource to manage packages for the Gentoo platform." end end end
Modernize provides in the portage_package resource
chef_chef
train
rb
f58c7a47f3cc470c3877197a27a9909f67be5967
diff --git a/test/render.test.js b/test/render.test.js index <HASH>..<HASH> 100644 --- a/test/render.test.js +++ b/test/render.test.js @@ -66,6 +66,7 @@ describe('Render ', function() { it('validates', function(done) { var count = 0; tileCoords.forEach(function(coords,idx,array) { + source._info.format = 'png32'; source.getTile(coords[0], coords[1], coords[2], function(err, tile, headers) { if (err) throw err; @@ -107,6 +108,7 @@ describe('Render ', function() { it('validates', function(done) { var count = 0; tileCoords.forEach(function(coords,idx,array) { + source._info.format = 'png32'; source.getTile(coords[0], coords[1], coords[2], function(err, tile, headers) { if (err) throw err;
explicitly request png<I> images to keep tests passed before and after <URL>
mapbox_tilelive-mapnik
train
js
7c03f8075e7ce2adf2de85bac0385d6569a69357
diff --git a/lib/index.js b/lib/index.js index <HASH>..<HASH> 100644 --- a/lib/index.js +++ b/lib/index.js @@ -39,6 +39,7 @@ if (isClient) { $(function() { $('body').on('click', 'a', function(e) { + if (Boolean($(this).data('extern'))) return if (this.protocol === 'javascript:') return if (this.hash || !$(this).attr('href') || $(this).attr('href') == '#') return if (!sameOrigin($(this).attr('href'))) return
Add Data-Attribute Option to Force Links as external Ones <a href="…" data-extern="true"> bypasses client-side execution
rkusa_swac
train
js
55e1a56758e2a3927c5923e1cc8dde9f1bbe9c6f
diff --git a/tests/test_httpserver.py b/tests/test_httpserver.py index <HASH>..<HASH> 100644 --- a/tests/test_httpserver.py +++ b/tests/test_httpserver.py @@ -104,7 +104,7 @@ class TestHttpserver(unittest.TestCase): head, body = response.split(b'\r\n\r\n', 1) # Do we have the 404 error assert head.startswith(b'HTTP/1.1 404 Not Found\r\n') - # TODO more tests here + assert self.transport.close.called def test_get_absoluteURI(self): """HTTP 1.1 servers MUST accept absoluteURI form Request-URIs
Test for dir without html added test on close
thomwiggers_httpserver
train
py
78edca3ad601a3fd194d0e220ef736c16b37ab1d
diff --git a/src/Composer/Compiler.php b/src/Composer/Compiler.php index <HASH>..<HASH> 100644 --- a/src/Composer/Compiler.php +++ b/src/Composer/Compiler.php @@ -126,7 +126,7 @@ class Compiler private function addFile($phar, $file, $strip = true) { - $path = str_replace(dirname(dirname(__DIR__)).DIRECTORY_SEPARATOR, '', $file->getRealPath()); + $path = strtr(str_replace(dirname(dirname(__DIR__)).DIRECTORY_SEPARATOR, '', $file->getRealPath()), '\\', '/'); $content = file_get_contents($file); if ($strip) { @@ -135,8 +135,10 @@ class Compiler $content = "\n".$content."\n"; } - $content = str_replace('@package_version@', $this->version, $content); - $content = str_replace('@release_date@', $this->versionDate, $content); + if ($path === 'src/Composer/Composer.php') { + $content = str_replace('@package_version@', $this->version, $content); + $content = str_replace('@release_date@', $this->versionDate, $content); + } $phar->addFromString($path, $content); }
Only replace version in Composer.php, fix user agent
mothership-ec_composer
train
php
7452983209b0a4824713ae825e75387f446fe9f0
diff --git a/src/Handler/SMSHandler.php b/src/Handler/SMSHandler.php index <HASH>..<HASH> 100644 --- a/src/Handler/SMSHandler.php +++ b/src/Handler/SMSHandler.php @@ -3,6 +3,7 @@ namespace Tylercd100\Monolog\Handler; use Exception; +use Monolog\Formatter\FormatterInterface; use Monolog\Handler\SocketHandler; use Monolog\Logger; use Tylercd100\Monolog\Formatter\SMSFormatter; @@ -81,7 +82,7 @@ abstract class SMSHandler extends SocketHandler * @param array $record * @return string */ - protected function generateDataStream($record) + protected function generateDataStream(array $record) :string { $content = $this->buildContent($record); return $this->buildHeader($content) . $content; @@ -133,7 +134,7 @@ abstract class SMSHandler extends SocketHandler * * @param array $record */ - protected function write(array $record) + protected function write(array $record) :void { parent::write($record); $this->closeSocket(); @@ -142,7 +143,7 @@ abstract class SMSHandler extends SocketHandler /** * {@inheritdoc} */ - protected function getDefaultFormatter() + protected function getDefaultFormatter(): FormatterInterface { return new SMSFormatter(); }
Fix SMSHandler to be compatible with Monolog 2
tylercd100_monolog-sms
train
php
48ed7e6ac47801a93f43dda5c7afc32ed6053b72
diff --git a/actionpack/lib/action_dispatch/testing/assertions/response.rb b/actionpack/lib/action_dispatch/testing/assertions/response.rb index <HASH>..<HASH> 100644 --- a/actionpack/lib/action_dispatch/testing/assertions/response.rb +++ b/actionpack/lib/action_dispatch/testing/assertions/response.rb @@ -35,7 +35,7 @@ module ActionDispatch elsif type.is_a?(Symbol) && @response.response_code == Rack::Utils::SYMBOL_TO_STATUS_CODE[type] assert_block("") { true } # to count the assertion else - flunk(build_message(message, "Expected response to be a <?>, but was <?>", type, @response.response_code)) + flunk "Expected response to be a <#{type}>, but was <#{@response.response_code}>" end end
stop using build_message for creating a string
rails_rails
train
rb
ad3e84de8e090e080454fe2619fc470234674fe3
diff --git a/lib/roo_on_rails/railties/http.rb b/lib/roo_on_rails/railties/http.rb index <HASH>..<HASH> 100644 --- a/lib/roo_on_rails/railties/http.rb +++ b/lib/roo_on_rails/railties/http.rb @@ -17,7 +17,7 @@ module RooOnRails ::Rack::Timeout ) - middleware_to_insert_before = defined?('Rack::Head') ? ::Rack::Head : ::ActionDispatch::Cookies + middleware_to_insert_before = defined?(::Rack::Head) ? ::Rack::Head : ::ActionDispatch::Cookies # This needs to be inserted low in the stack, before Rails returns the # thread-current connection to the pool.
Make it smarter about picking middleware
deliveroo_roo_on_rails
train
rb
868db22c713fdb39ae6e08745899008ae46c88b9
diff --git a/lib/job.js b/lib/job.js index <HASH>..<HASH> 100644 --- a/lib/job.js +++ b/lib/job.js @@ -5,6 +5,13 @@ module.exports = { webapp: webapp } +function defExtend(dest, src) { + for (var key in src) { + if (!src[key]) continue; + dest[key] = src[key] + } +} + // schema // { // routes: function (app, context) {} @@ -12,6 +19,9 @@ module.exports = { // listen: function (io, context) {} // } function webapp(id, plugin, striderjson, context, done) { + if (plugin.appConfig) { + defExtend(plugin.appConfig, context.config.plugins[id] || {}) + } // setup routes if (plugin.routes) { jobRoutes(id, plugin, context)
Enable configuration override of job plugin defaults (tests not updated)
Strider-CD_strider-extension-loader
train
js
e50e2201b1d1b07bb6456b855ccbd299c32b43f0
diff --git a/shared/route-tree/index.js b/shared/route-tree/index.js index <HASH>..<HASH> 100644 --- a/shared/route-tree/index.js +++ b/shared/route-tree/index.js @@ -159,7 +159,10 @@ function _routeSet( ): RouteStateNode { const pathHead = pathSpec && pathSpec.first() - let newRouteState = routeState || new RouteStateNode({selected: routeDef.defaultSelected}) + let newRouteState = + routeState || + // Set the initial state off of the route def + new RouteStateNode({selected: routeDef.defaultSelected, state: I.Map(routeDef.initialState)}) if (pathHead && pathHead.type === 'navigate') { newRouteState = newRouteState.set('selected', pathHead.next || routeDef.defaultSelected) if (pathHead.next === null && !routeDef.tags.persistChildren) {
set initial state when making RouteStateNode (#<I>)
keybase_client
train
js
1da36262fe6bc5531340cd15e4dd4d0598345b5d
diff --git a/Tone/component/FrequencyEnvelope.js b/Tone/component/FrequencyEnvelope.js index <HASH>..<HASH> 100644 --- a/Tone/component/FrequencyEnvelope.js +++ b/Tone/component/FrequencyEnvelope.js @@ -13,12 +13,12 @@ define(["Tone/core/Tone", "Tone/component/ScaledEnvelope", "Tone/component/Envel * @param {number} [sustain] a percentage (0-1) of the full amplitude * @param {Time} [release] the release time in seconds * @example - * var env = new Tone.FrequencyEnvelope({ + * var freqEnv = new Tone.FrequencyEnvelope({ * "attack" : 0.2, * "baseFrequency" : "C2", * "octaves" : 4 * }); - * scaledEnv.connect(oscillator.frequency); + * freqEnv.connect(oscillator.frequency); */ Tone.FrequencyEnvelope = function(){
Fixed variable name in example (#<I>)
Tonejs_Tone.js
train
js
ea394672b23d24c2c4d37bbe4a98adb118146630
diff --git a/src/background.js b/src/background.js index <HASH>..<HASH> 100644 --- a/src/background.js +++ b/src/background.js @@ -22,10 +22,10 @@ let panelId = undefined; function openPage() { const getContentWindowInfo = browser.windows.getLastFocused(); const getSideexWindowInfo = browser.windows.create({ - url: browser.extension.getURL("assets/panel.html"), + url: browser.extension.getURL("assets/index.html"), type: "popup", height: 730, - width: 750 + width: 480 }); Promise.all([getContentWindowInfo, getSideexWindowInfo])
hot reload as extension popup
SeleniumHQ_selenium-ide
train
js
f27b72a2f3459fb92ae1879b197b334c42fc438d
diff --git a/remoto/process.py b/remoto/process.py index <HASH>..<HASH> 100644 --- a/remoto/process.py +++ b/remoto/process.py @@ -6,6 +6,8 @@ from .util import admin_command def _remote_run(channel, cmd, **kw): import subprocess import sys + stop_on_nonzero = kw.pop('stop_on_nonzero', True) + process = subprocess.Popen( cmd, @@ -34,7 +36,10 @@ def _remote_run(channel, cmd, **kw): returncode = process.wait() if returncode != 0: - raise RuntimeError("command returned non-zero exit status: %s" % returncode) + if stop_on_nonzero: + raise RuntimeError("command returned non-zero exit status: %s" % returncode) + else: + channel.send({'warning': "command returned non-zero exit status: %s" % returncode}) def run(conn, command, exit=False, timeout=None, **kw):
add non zero exit status to be configured for a raise
alfredodeza_remoto
train
py
7b095504bd09a7a2f3592d15329b7ceb2e642b6e
diff --git a/lib/y_support/name_magic.rb b/lib/y_support/name_magic.rb index <HASH>..<HASH> 100644 --- a/lib/y_support/name_magic.rb +++ b/lib/y_support/name_magic.rb @@ -69,13 +69,17 @@ module NameMagic ɴ = self.class.__instances__[ self ] if ɴ then name_get_closure = self.class.instance_variable_get :@name_get_closure - return name_get_closure ? name_get_closure.( ɴ ) : ɴ - else - return nil - end + name_get_closure ? name_get_closure.( ɴ ) : ɴ + else nil end end alias ɴ name + # Retrieves either an instance name (if present), or an object id. + # + def name_or_object_id + name || object_id + end + # Names an instance, cautiously (ie. no overwriting of existing names). # def name=( ɴ )
adding method #name_or_object_id
boris-s_y_support
train
rb
6ded360ae16dd4d0ff73c3aad48b7f01636e7a26
diff --git a/src/main/java/com/corundumstudio/socketio/handler/AuthorizeHandler.java b/src/main/java/com/corundumstudio/socketio/handler/AuthorizeHandler.java index <HASH>..<HASH> 100644 --- a/src/main/java/com/corundumstudio/socketio/handler/AuthorizeHandler.java +++ b/src/main/java/com/corundumstudio/socketio/handler/AuthorizeHandler.java @@ -95,7 +95,7 @@ public class AuthorizeHandler extends ChannelInboundHandlerAdapter implements Di if (!configuration.isAllowCustomRequests() && !queryDecoder.path().startsWith(connectPath)) { HttpResponse res = new DefaultHttpResponse(HTTP_1_1, HttpResponseStatus.BAD_REQUEST); - channel.write(res).addListener(ChannelFutureListener.CLOSE); + channel.writeAndFlush(res).addListener(ChannelFutureListener.CLOSE); req.release(); log.warn("Blocked wrong request! url: {}, ip: {}", queryDecoder.path(), channel.remoteAddress()); return;
unchallenged connections fixed. #<I>
mrniko_netty-socketio
train
java
f16057c94e772a23b657d54e069941daeb63ee88
diff --git a/index.js b/index.js index <HASH>..<HASH> 100644 --- a/index.js +++ b/index.js @@ -28,7 +28,7 @@ function HtmlReplaceWebpackPlugin(options) } else { - htmlData = htmlData.replace(option.pattern, option.replacement) + htmlData = htmlData.split(option.pattern).join(option.replacement) } }) return htmlData
Support replacing all instances of the string in a html file
iminif_html-replace-webpack-plugin
train
js
dc82ca73530dc63f760b000c5186256d38f892a4
diff --git a/src/Controller/Async/Records.php b/src/Controller/Async/Records.php index <HASH>..<HASH> 100644 --- a/src/Controller/Async/Records.php +++ b/src/Controller/Async/Records.php @@ -75,4 +75,27 @@ class Records extends AsyncBase return $response; } + + /** + * Modify an individual ContentType's records. + * + * @param string $contentTypeSlug + * @param array $recordIds + */ + protected function modifyContentType($contentTypeSlug, array $recordIds) + { + foreach ($recordIds as $recordId => $actions) { + if ($actions === null) { + continue; + } + + foreach ($actions as $action => $fieldData) { + if ($action === 'delete') { + return $this->deleteRecord($contentTypeSlug, $recordId); + } else { + return $this->modifyRecord($contentTypeSlug, $recordId, $fieldData); + } + } + } + } }
Modify method for an individual ContentType's records
bolt_bolt
train
php
f353eff0341bcbafc8b882dd0bb8a32741e0b7e2
diff --git a/src/lib/datatable.py b/src/lib/datatable.py index <HASH>..<HASH> 100644 --- a/src/lib/datatable.py +++ b/src/lib/datatable.py @@ -278,8 +278,12 @@ class DataTable(object): idx = index[person] temp[idx['idxUnit']] = var[idx['idxIndi']] out[person] = temp - if sum_ is False: - return out + if sum_ is False: + if len(opt) == 1: + return out[opt[0]] + else: + return out + else: sumout = 0 for val in out.itervalues():
add option to be more explicit change also get_value in case length opt == 1
openfisca_openfisca-core
train
py
eb676519ba644036f302bb3dc65d7c4d97438385
diff --git a/superset/connectors/druid/models.py b/superset/connectors/druid/models.py index <HASH>..<HASH> 100644 --- a/superset/connectors/druid/models.py +++ b/superset/connectors/druid/models.py @@ -1331,10 +1331,10 @@ class DruidDatasource(Model, BaseDatasource): client=client, query_obj=query_obj, phase=2) df = client.export_pandas() - df = self.homogenize_types(df, query_obj.get('groupby', [])) - if df is None or df.size == 0: raise Exception(_('No data was returned.')) + + df = self.homogenize_types(df, query_obj.get('groupby', [])) df.columns = [ DTTM_ALIAS if c in ('timestamp', '__time') else c for c in df.columns
Moving homogenize_types to after no data exception (#<I>)
apache_incubator-superset
train
py
02f7d5653e7c39e5fa92c8e095b8555fb2ec2b67
diff --git a/src/quart/utils.py b/src/quart/utils.py index <HASH>..<HASH> 100644 --- a/src/quart/utils.py +++ b/src/quart/utils.py @@ -27,7 +27,7 @@ if TYPE_CHECKING: from .wrappers.response import Response # noqa: F401 -def redirect(location: str, status_code: int = 302) -> "Response": +def redirect(location: str, code: int = 302) -> "Response": body = f""" <!doctype html> <title>Redirect</title> @@ -35,7 +35,7 @@ def redirect(location: str, status_code: int = 302) -> "Response": You should be redirected to <a href="{location}">{location}</a>, if not please click the link """ - return current_app.response_class(body, status=status_code, headers={"Location": location}) + return current_app.response_class(body, status=code, headers={"Location": location}) def create_cookie(
Bugfix match the Werkzeug API in redirect Some existing Flask extensions, flask_sslify and flask_talisman, expect this argument to be called `code` rather than `status_code`.
pgjones_quart
train
py
2c34bc7e26c10bf3fc4014e822b84f151a21d639
diff --git a/browserscripts/pageinfo/visualElements.js b/browserscripts/pageinfo/visualElements.js index <HASH>..<HASH> 100644 --- a/browserscripts/pageinfo/visualElements.js +++ b/browserscripts/pageinfo/visualElements.js @@ -28,7 +28,7 @@ } function isElementPartlyInViewportAndVisible (el) { - var rect = el.getBoundingClientRect(); + const rect = el.getBoundingClientRect(); return !(rect.bottom < 0 || rect.right < 0 || rect.left > window.innerWidth || rect.top > window.innerHeight || rect.height === 0) } @@ -79,17 +79,15 @@ } } - let type = 'LargestImage'; imageTags.forEach(function (element) { if (isElementPartlyInViewportAndVisible(element)) { - keepLargestElementByType(type, element); + keepLargestElementByType('LargestImage', element); } }); - type = 'Heading'; h1Tags.forEach(function (element) { if (isElementPartlyInViewportAndVisible(element)) { - keepLargestElementByType(type, element); + keepLargestElementByType('Heading', element); } });
cleanup the script (#<I>)
sitespeedio_browsertime
train
js
b36200a0a96a98096f48445dcda48da551946147
diff --git a/lib/mongo/server/address.rb b/lib/mongo/server/address.rb index <HASH>..<HASH> 100644 --- a/lib/mongo/server/address.rb +++ b/lib/mongo/server/address.rb @@ -99,7 +99,11 @@ module Mongo # # @since 3.0.0 def resolve! - @ip = Resolv.getaddress(host) + Resolv.each_address(host) do |address| + if address =~ Resolv::IPv4::Regex + return @ip = address + end + end end end end
force to ipv4 for now
mongodb_mongo-ruby-driver
train
rb
bd7a0933801221f01be9317e46acd7955606472b
diff --git a/src/level/TMXTileset.js b/src/level/TMXTileset.js index <HASH>..<HASH> 100755 --- a/src/level/TMXTileset.js +++ b/src/level/TMXTileset.js @@ -117,15 +117,15 @@ this.transform.translate(0, this.height - this.width); } if (this.flippedX) { + this.transform.translate((this.flippedAD ? this.height : this.width), 0); a[0] *= -1; a[3] *= -1; - this.transform.translate(-(this.flippedAD ? this.height : this.width), 0); } if (this.flippedY) { + this.transform.translate(0, (this.flippedAD ? this.width : this.height)); a[1] *= -1; a[4] *= -1; - this.transform.translate(0, -(this.flippedAD ? this.width : this.height)); } } });
[#<I>] We can save 2 bytes just by changing the order of operations!
melonjs_melonJS
train
js
874ecf3ae56a4b10ef464d14ce37b9c04d353f73
diff --git a/CaptchaAction.php b/CaptchaAction.php index <HASH>..<HASH> 100644 --- a/CaptchaAction.php +++ b/CaptchaAction.php @@ -134,11 +134,12 @@ class CaptchaAction extends Action // when src attribute of image tag is changed 'url' => Url::to([$this->id, 'v' => uniqid()]), ]; - } else { - $this->setHttpHeaders(); - Yii::$app->response->format = Response::FORMAT_RAW; - return $this->renderImage($this->getVerifyCode()); } + + $this->setHttpHeaders(); + Yii::$app->response->format = Response::FORMAT_RAW; + + return $this->renderImage($this->getVerifyCode()); } /** @@ -255,9 +256,9 @@ class CaptchaAction extends Action return $this->renderImageByGD($code); } elseif ($imageLibrary === 'imagick') { return $this->renderImageByImagick($code); - } else { - throw new InvalidConfigException("Defined library '{$imageLibrary}' is not supported"); } + + throw new InvalidConfigException("Defined library '{$imageLibrary}' is not supported"); } /**
Enable `no_useless_else` rule in php-cs-fixer (#<I>)
yiisoft_yii-captcha
train
php
35e7095e1fb530583e7176f063aca18640bc4457
diff --git a/lib/xapian_db/railtie.rb b/lib/xapian_db/railtie.rb index <HASH>..<HASH> 100644 --- a/lib/xapian_db/railtie.rb +++ b/lib/xapian_db/railtie.rb @@ -40,5 +40,11 @@ module XapianDb end + config.to_prepare do + # Load a blueprint config if there is one + blueprints_file_path = "#{Rails.root}/config/xapian_blueprints.rb" + load blueprints_file_path if File.exist?(blueprints_file_path) + end + end end \ No newline at end of file
fixed the problem that initializers in development are loaded only once, not for every request
gernotkogler_xapian_db
train
rb
690c3dfdb55580a62287e53512bb109b04711b29
diff --git a/src/Products/ProductsList.php b/src/Products/ProductsList.php index <HASH>..<HASH> 100644 --- a/src/Products/ProductsList.php +++ b/src/Products/ProductsList.php @@ -100,6 +100,13 @@ class ProductsList return $result; } + /** + * [RO] Listeaza caracteristicile obligatorii ale unei categorii (https://github.com/celdotro/marketplace/wiki/Listeaza-caracteristicile-obligatorii-ale-unei-categorii) + * [EN] Lists the mandatory characteristics of a category (https://github.com/celdotro/marketplace/wiki/List-mandatory-charactersitics-for-a-category) + * @param $categID + * @return mixed + * @throws \Exception + */ public function listCategoryMandatoryCharacteristics($categID){ // Sanity check if(!isset($categID) || !is_int($categID) || $categID < 0) throw new \Exception('Specificati o categorie valida');
Added mandatory charactersitics listing for a category
celdotro_marketplace
train
php
a4581766cc9a23cd213bdc8054bbc0db00fc860a
diff --git a/packages/webiny-api/src/graphql/crudResolvers.js b/packages/webiny-api/src/graphql/crudResolvers.js index <HASH>..<HASH> 100644 --- a/packages/webiny-api/src/graphql/crudResolvers.js +++ b/packages/webiny-api/src/graphql/crudResolvers.js @@ -5,7 +5,7 @@ import parseBoolean from "./parseBoolean"; import InvalidAttributesError from "./InvalidAttributesError"; import { ListResponse, ErrorResponse, NotFoundResponse, Response } from "./responses"; -type EntityFetcher = (context: Object) => Class<Entity>; +type EntityFetcher = string | (context: Object) => Class<Entity>; const notFound = (id?: string) => { return new NotFoundResponse(id ? `Record "${id}" not found!` : "Record not found!");
fix: entityFetcher can also be a string
Webiny_webiny-js
train
js
aa12561d60a1471e64562f2b41406862584f3aec
diff --git a/lib/html2haml/html.rb b/lib/html2haml/html.rb index <HASH>..<HASH> 100644 --- a/lib/html2haml/html.rb +++ b/lib/html2haml/html.rb @@ -388,9 +388,9 @@ module Haml def to_haml_filter(filter, tabs, options) content = if children.first.cdata? - children.first.content_without_cdata_tokens + decode_entities(children.first.content_without_cdata_tokens) else - CGI.unescapeHTML(self.inner_text) + decode_entites(self.inner_text) end content = erb_to_interpolation(content, options) @@ -411,6 +411,17 @@ module Haml "#{tabulate(tabs)}:#{filter}\n#{content}" end + # TODO: this method is utterly awful, find a better way to decode HTML entities. + def decode_entities(str) + str.gsub(/&[\S]+;/) do |entity| + begin + [Nokogiri::HTML::NamedCharacters[entity[1..-2]]].pack("C") + rescue TypeError + entity + end + end + end + def static_attribute?(name, options) attr_hash[name] && !dynamic_attribute?(name, options) end
Decode HTML entities in filter content Note that the implementation her is pretty awful, it should be replaced with something better when possible. However it does, for the moment, solve the problem at hand.
haml_html2haml
train
rb
c98d3722dfb5e67103a768101097f67442faa6f7
diff --git a/src/Parsed.php b/src/Parsed.php index <HASH>..<HASH> 100644 --- a/src/Parsed.php +++ b/src/Parsed.php @@ -172,7 +172,8 @@ class Parsed public function getExpiresIn(): int { - return $this->payload['exp'] - time(); + $expiresIn = $this->payload['exp'] - time(); + return $expiresIn > 0 ? $expiresIn : 0; } /** diff --git a/tests/ParsedTest.php b/tests/ParsedTest.php index <HASH>..<HASH> 100644 --- a/tests/ParsedTest.php +++ b/tests/ParsedTest.php @@ -443,8 +443,6 @@ class ParsedTest extends TestCase 'hello' ); - $result = $parsed->getExpiresIn(); - - $this->assertTrue(-100 === $result || -99 === $result); + $this->assertSame(0, $parsed->getExpiresIn()); } }
Ammended expires in method in ParsedTest so negative integers are not returned, just zero.
RobDWaller_ReallySimpleJWT
train
php,php
8763efa8877e5296da6e81e3d557664d0a30d0d6
diff --git a/src/Dompdf/FontMetrics.php b/src/Dompdf/FontMetrics.php index <HASH>..<HASH> 100644 --- a/src/Dompdf/FontMetrics.php +++ b/src/Dompdf/FontMetrics.php @@ -120,8 +120,8 @@ class FontMetrics $rootDir = $this->getOptions()->getRootDir(); // FIXME: tempoarary define constants for cache files <= v0.6.1 - def('DOMPDF_DIR', $rootDir); - def('DOMPDF_FONT_DIR', $fontDir); + if (!defined("DOMPDF_DIR")) { define("DOMPDF_DIR", $rootDir); } + if (!defined("DOMPDF_FONT_DIR")) { define("DOMPDF_FONT_DIR", $fontDir); } $file = $rootDir . "/lib/fonts/dompdf_font_family_cache.dist.php"; $distFonts = require $file;
Don't rely on functions.inc.php in namespaced code
dompdf_dompdf
train
php
7d5a97862f927e8ba2fb82018e61fb17cd9ffcd2
diff --git a/server/rpki.go b/server/rpki.go index <HASH>..<HASH> 100644 --- a/server/rpki.go +++ b/server/rpki.go @@ -571,6 +571,11 @@ func validatePath(ownAs uint32, tree *radix.Tree, cidr string, asPath *bgp.PathA } func (c *roaManager) validate(pathList []*table.Path) { + if len(c.clientMap) == 0 { + // RPKI isn't enabled + return + } + for _, path := range pathList { if path.IsWithdraw || path.IsEOR() { continue
rpki: validate only when RPKI is enabled
osrg_gobgp
train
go
ad41967c77f87c421a43c3d4d83db64fcb753234
diff --git a/test/com/aoindustries/awt/image/ImagesTest.java b/test/com/aoindustries/awt/image/ImagesTest.java index <HASH>..<HASH> 100644 --- a/test/com/aoindustries/awt/image/ImagesTest.java +++ b/test/com/aoindustries/awt/image/ImagesTest.java @@ -63,7 +63,7 @@ public class ImagesTest { } @Test - public void hello() { + public void testFindImage() { logger.log( Level.INFO, "Got image: {0} x {1}", @@ -86,7 +86,7 @@ public class ImagesTest { testRepeat(); } long endNanos = System.nanoTime(); - logger.log(Level.INFO, "Total time: {0} ms", BigDecimal.valueOf((endNanos - startNanos)/repeat, 6)); + logger.log(Level.INFO, "Average time: {0} ms", BigDecimal.valueOf((endNanos - startNanos)/repeat, 6)); } private void testRepeat() {
Fixed naming of tests a bit.
aoindustries_aocode-public
train
java
008df99fa6f82a9bff5b1687c9c3be69894b2da4
diff --git a/src/rezplugins/release_vcs/git.py b/src/rezplugins/release_vcs/git.py index <HASH>..<HASH> 100644 --- a/src/rezplugins/release_vcs/git.py +++ b/src/rezplugins/release_vcs/git.py @@ -83,7 +83,8 @@ class GitReleaseVCS(ReleaseVCS): # and 2.12 - used to be "No upstream", now "no upstream".. errmsg = str(e).lower() if ("no upstream branch" not in errmsg - and "no upstream configured" not in errmsg): + and "no upstream configured" not in errmsg + and "does not point to a branch" not in errmsg): raise e return (None, None)
Fixed an issue where git rev-parse would error out before checking for config.allow_no_upstream
nerdvegas_rez
train
py
3b5d3e2192ce0cdc97854a1d70d5e382e454275c
diff --git a/google/oauth2/_client.py b/google/oauth2/_client.py index <HASH>..<HASH> 100644 --- a/google/oauth2/_client.py +++ b/google/oauth2/_client.py @@ -103,7 +103,11 @@ def _token_endpoint_request(request, token_uri, body): # occurs. while True: response = request(method="POST", url=token_uri, headers=headers, body=body) - response_body = response.data.decode("utf-8") + response_body = ( + response.data.decode("utf-8") + if hasattr(response.data, "decode") + else response.data + ) response_data = json.loads(response_body) if response.status == http_client.OK:
fix: in token endpoint request, do not decode the response data if it is not encoded (#<I>) * fix: in token endpoint request, do not decode the response data if it is not encoded The interface of the underlying transport 'google.auth.transport.Request' that makes the token request does not guarantee the response is encoded. In Python 3, the non-encoded strings do not have 'decode' attribute. Blindly decoding all the response could have the token refresh throw here.
googleapis_google-auth-library-python
train
py
82704de468d3ca4ea34b879b79621a9d514e16f2
diff --git a/score-tests/src/test/java/org/score/samples/StandAloneTest.java b/score-tests/src/test/java/org/score/samples/StandAloneTest.java index <HASH>..<HASH> 100644 --- a/score-tests/src/test/java/org/score/samples/StandAloneTest.java +++ b/score-tests/src/test/java/org/score/samples/StandAloneTest.java @@ -117,7 +117,7 @@ public class StandAloneTest { waitForAllEventsToArrive(3);//this flow should have 2 "Hello score" events only + 1 finish event Assert.assertEquals(2,countEvents("Hello score")); - Assert.assertEquals(1,countEvents(EventConstants.SCORE_FINISHED_EVENT)); + //Assert.assertEquals(2,countEvents(EventConstants.SCORE_FINISHED_EVENT));//todo - temp until fix to be only 1 finish event }
try to fix psrallel test issue...
CloudSlang_score
train
java
ec99954023c5189c84f09350036f311cafc2f6f2
diff --git a/examples/example-3-manipulating-child-accounts.php b/examples/example-3-manipulating-child-accounts.php index <HASH>..<HASH> 100644 --- a/examples/example-3-manipulating-child-accounts.php +++ b/examples/example-3-manipulating-child-accounts.php @@ -1,7 +1,21 @@ <?php + include 'vendor/autoload.php'; $credentials = new PrintNode\Credentials(); +/** + * There are two ways of authenticating when manipulating a Child Account + * + * - Using the Parent Account API Key + * - Using the Child Account API Key + * + * You can only manipulate a Child Account details when using the Parent Account API Key. + * For example: to change a Child Accounts name, email address, password or delete a Child Account + * you must be use the Parent Account API Key. + * + * For this example, you must be authenticated as the Parent Account. + **/ + $credentials->setApiKey(PRINTNODE_APIKEY); $request = new PrintNode\Request($credentials); @@ -17,6 +31,7 @@ $request = new PrintNode\Request($credentials); $request->setChildAccountById($id); // All requests from this request object will now operate on this Child Account. + $whoami = $request->getWhoami(); $computers = $request->getComputers(); $printers = $request->getPrinters();
Update example-3-manipulating-child-accounts.php
PrintNode_PrintNode-PHP
train
php
51bd763d0af1845172354fa2d7df9ff022a614f3
diff --git a/fastlane/lib/fastlane/version.rb b/fastlane/lib/fastlane/version.rb index <HASH>..<HASH> 100644 --- a/fastlane/lib/fastlane/version.rb +++ b/fastlane/lib/fastlane/version.rb @@ -1,4 +1,4 @@ module Fastlane - VERSION = '2.28.2'.freeze + VERSION = '2.28.3'.freeze DESCRIPTION = "The easiest way to automate beta deployments and releases for your iOS and Android apps".freeze end
Version bump to <I> (#<I>)
fastlane_fastlane
train
rb
b71aced4a2a1ee80a1cbbd26b85a57623790d7f4
diff --git a/transport/http2_client.go b/transport/http2_client.go index <HASH>..<HASH> 100644 --- a/transport/http2_client.go +++ b/transport/http2_client.go @@ -1116,12 +1116,13 @@ func (t *http2Client) operateHeaders(frame *http2.MetaHeadersFrame) { }() s.mu.Lock() - if !endStream { - s.recvCompress = state.encoding - } if !s.headerDone { - if !endStream && len(state.mdata) > 0 { - s.header = state.mdata + // Headers frame is not actually a trailers-only frame. + if !endStream { + s.recvCompress = state.encoding + if len(state.mdata) > 0 { + s.header = state.mdata + } } close(s.headerChan) s.headerDone = true
transport: Fix a data race when headers are received while the stream is being closed (#<I>)
grpc_grpc-go
train
go
3eb08c7b2c2fcd78ab93bd5fd976bcdb3fe37e20
diff --git a/qualysapi/util.py b/qualysapi/util.py index <HASH>..<HASH> 100644 --- a/qualysapi/util.py +++ b/qualysapi/util.py @@ -5,6 +5,8 @@ import qualysapi.config as qcconf import qualysapi.connector as qcconn import qualysapi.settings as qcs +from urllib.parse import quote_plus + __author__ = "Parag Baxi <parag.baxi@gmail.com> & Colin Bell <colin.bell@uwaterloo.ca>" __copyright__ = "Copyright 2011-2013, Parag Baxi & University of Waterloo" @@ -32,7 +34,7 @@ def connect( # Use function parameter login credentials. if username and password: connect = qcconn.QGConnector( - auth=(username, password), server=hostname, max_retries=max_retries, proxies=proxies + auth=(username, quote_plus(password)), server=hostname, max_retries=max_retries, proxies=proxies ) # Retrieve login credentials from config file.
fix special characters in password Applications using Qualys API module returns error when it has special characters like % or + etc, urllib.parse.quote_plus is a fix for such issues
paragbaxi_qualysapi
train
py
30105f4543ceca6e0507fe741dc8853d53e2adb9
diff --git a/Command/FilesystemKeysCommand.php b/Command/FilesystemKeysCommand.php index <HASH>..<HASH> 100644 --- a/Command/FilesystemKeysCommand.php +++ b/Command/FilesystemKeysCommand.php @@ -38,13 +38,13 @@ class FilesystemKeysCommand extends Command ->addArgument('filesystem', InputArgument::REQUIRED, 'The filesystem to use') ->addArgument('glob', InputArgument::OPTIONAL, 'An optional glob pattern') ->setHelp(<<<EOT -The <info>gaufrette:filesystem:list</info> command lists all the file keys of the specified filesystem: +The <info>%command.name%</info> command lists all the file keys of the specified filesystem: - <info>./app/console gaufrette:filesystem:list my_filesystem</info> + <info>php %command.full_name% my_filesystem</info> You can also optionaly specify a glob pattern to filter the results: - <info>./app/console gaufrette:filesystem:list my_filesystem media_*</info> + <info>php %command.full_name% my_filesystem media_*</info> EOT ); }
Fix command name in help (#<I>)
KnpLabs_KnpGaufretteBundle
train
php
1929a631711590179a7cde2a9d5f47d4e13b6d71
diff --git a/robolectric/src/main/java/org/robolectric/RobolectricTestRunner.java b/robolectric/src/main/java/org/robolectric/RobolectricTestRunner.java index <HASH>..<HASH> 100644 --- a/robolectric/src/main/java/org/robolectric/RobolectricTestRunner.java +++ b/robolectric/src/main/java/org/robolectric/RobolectricTestRunner.java @@ -362,6 +362,12 @@ public class RobolectricTestRunner extends SandboxTestRunner { return properties; } catch (IOException e) { return null; + } finally { + try { + resourceAsStream.close(); + } catch (IOException e) { + throw new RuntimeException("couldn't close test_config.properties", e); + } } }
Close test_config.properties after reading it.
robolectric_robolectric
train
java
9fd2907141026f8d24d05795e41dbfdd6d391249
diff --git a/server/controller/webmin.js b/server/controller/webmin.js index <HASH>..<HASH> 100644 --- a/server/controller/webmin.js +++ b/server/controller/webmin.js @@ -657,7 +657,7 @@ function WebAdmin (duniterServer, startServices, stopServices, listDuniterUIPlug const headInfos = head.message.split(':') let posPubkey = 3; // Gestion des différents formats - if (head.messageV2.match(/:2:/)) { + if (head.messageV2 && head.messageV2.match(/:2:/)) { //HEAD v2 const headV2Infos = head.messageV2.split(':') head.freeRooms = headV2Infos[9] + "/" + headV2Infos[10]
[fix] bug in webmin api : messageV2 maybe undefined
duniter_duniter-ui
train
js
29ed77aa901c31d8f2eaf0ca26e5d9ea71f9a1bc
diff --git a/test/dexie-unittest-utils.js b/test/dexie-unittest-utils.js index <HASH>..<HASH> 100644 --- a/test/dexie-unittest-utils.js +++ b/test/dexie-unittest-utils.js @@ -1,4 +1,6 @@ import Dexie from 'dexie'; +import {ok, start, asyncTest} from 'QUnit'; + var no_optimize = window.no_optimize || window.location.search.indexOf('dontoptimize=true') != -1; @@ -99,3 +101,20 @@ export function supports (features) { if (/multiEntry/.test(features)) return hasPolyfillIE || (!isIE && !isEdge); } + +export function spawnedTest (name, num, promiseGenerator) { + if (!promiseGenerator) { + promiseGenerator = num; + asyncTest(name, function(){ + Dexie.spawn(promiseGenerator) + .catch(e => ok(false, e.stack || e)) + .finally(start); + }); + } else { + asyncTest(name, num, function(){ + Dexie.spawn(promiseGenerator) + .catch(e => ok(false, e.stack || e)) + .finally(start); + }); + } +}
Alternative to asyncTest: spawnedTest! Usage: spawnedTest("name", function*() { // Use yield as await. // Dont have to catch errors // Dont have to call start() when done. });
dfahlander_Dexie.js
train
js
43f5ce9af8b58076179fbc73b944d86223758cc2
diff --git a/src/main/php/lang/exception/Exception.php b/src/main/php/lang/exception/Exception.php index <HASH>..<HASH> 100644 --- a/src/main/php/lang/exception/Exception.php +++ b/src/main/php/lang/exception/Exception.php @@ -46,7 +46,7 @@ class Exception extends \Exception implements Throwable */ public function __toString() { - $string = __CLASS__ . " {\n"; + $string = get_class($this) . " {\n"; $string .= ' message(string): ' . $this->getMessage() . "\n"; $string .= ' file(string): ' . $this->getFile() . "\n"; $string .= ' line(integer): ' . $this->getLine() . "\n";
use real class, not class in which method is defined
stubbles_stubbles-ioc
train
php
e272983110424f7160849448c61415a8cab66cce
diff --git a/packages/provider-queries/src/article-fragment.js b/packages/provider-queries/src/article-fragment.js index <HASH>..<HASH> 100644 --- a/packages/provider-queries/src/article-fragment.js +++ b/packages/provider-queries/src/article-fragment.js @@ -33,6 +33,7 @@ export default gql` } keywords leadAsset { + __typename ... on Video { brightcoveAccountId brightcovePolicyKey @@ -47,6 +48,7 @@ export default gql` } } relatedArticleSlice { + __typename ... on StandardSlice { items { ...relatedProps @@ -144,6 +146,7 @@ export default gql` fragment relatedProps on Tile { leadAsset { + __typename ... on Image { crop169: crop(ratio: "16:9") { url @@ -169,6 +172,7 @@ export default gql` } article { leadAsset { + __typename ... on Image { crop169: crop(ratio: "16:9") { url
chore: Add typename to article fragment (#<I>) * Add typename to article fragment * Update provider snap * Update snaps
newsuk_times-components
train
js
60440e888f6d32999441104b4fca4a68ed1d93f6
diff --git a/code/AssetTableField.php b/code/AssetTableField.php index <HASH>..<HASH> 100755 --- a/code/AssetTableField.php +++ b/code/AssetTableField.php @@ -107,7 +107,7 @@ class AssetTableField extends ComplexTableField { new TextField( 'PopupWidth', 'Popup Width' ), new TextField( 'PopupHeight', 'Popup Height' ), new HeaderField( 'SWF File Options' ), - new CheckboxField( 'Embed', 'Force Embeding' ), + new CheckboxField( 'Embed', 'Is A Flash Document' ), new CheckboxField( 'LimitDimensions', 'Limit The Dimensions In The Popup Window' ) ) );
Explicitation of the swf file which seem like pdf file (merged from <I> branch, r<I>) git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@<I> <I>b<I>ca-7a2a-<I>-9d3b-<I>d<I>a<I>a9
silverstripe_silverstripe-siteconfig
train
php
bbf67bab2649b082a75db92552a1d1c9416fcdb0
diff --git a/test/helpers.py b/test/helpers.py index <HASH>..<HASH> 100644 --- a/test/helpers.py +++ b/test/helpers.py @@ -273,12 +273,12 @@ polyhedron_mesh = meshio.Mesh( numpy.array([3, 0, 7]), ], [ - numpy.array([0, 1, 6]), # pyramid base split in two triangles - numpy.array([0, 6, 7]), - numpy.array([0, 1, 5]), - numpy.array([0, 5, 7]), - numpy.array([5, 6, 7]), - numpy.array([1, 5, 6]), + numpy.array([0, 1, 5]), # pyramid base split in two triangles + numpy.array([0, 4, 5]), + numpy.array([0, 1, 7]), + numpy.array([1, 5, 7]), + numpy.array([5, 4, 7]), + numpy.array([0, 4, 7]), ], ], ),
More reasonable polyhedron mesh for testing
nschloe_meshio
train
py
929d926774ad4ea0b45f06312a10e1ada2edfb7f
diff --git a/test/transaction.js b/test/transaction.js index <HASH>..<HASH> 100644 --- a/test/transaction.js +++ b/test/transaction.js @@ -1,5 +1,4 @@ var assert = require('assert') -var networks = require('../src/networks') var scripts = require('../src/scripts') var Address = require('../src/address') @@ -109,7 +108,7 @@ describe('Transaction', function() { var tx = new Transaction() f.raw.ins.forEach(function(txIn, i) { - var script = txIn.script ? Script.fromHex(txIn.script) : Script.EMPTY + var script = txIn.script ? Script.fromHex(txIn.script) : undefined var j = tx.addInput(txIn.hash, txIn.index, txIn.sequence, script) assert.equal(i, j) @@ -120,7 +119,7 @@ describe('Transaction', function() { if (sequence === undefined) sequence = Transaction.DEFAULT_SEQUENCE assert.equal(tx.ins[i].sequence, sequence) - assert.equal(tx.ins[i].script, script) + assert.equal(tx.ins[i].script, script || Script.EMPTY) }) }) })
tests: make use of the default behaviour
BitGo_bitgo-utxo-lib
train
js
85396cb0d132820758d1b9b028285eaad50ca61e
diff --git a/lib/index.js b/lib/index.js index <HASH>..<HASH> 100644 --- a/lib/index.js +++ b/lib/index.js @@ -249,8 +249,9 @@ exports.init = function (sequelize, optionsArg) { log('revisionId', currentRevisionId); } - instance.set(options.revisionAttribute, (currentRevisionId || 0) + 1); if (delta && delta.length > 0) { + instance.set(options.revisionAttribute, (currentRevisionId || 0) + 1); + if (!instance.context) { instance.context = {}; }
Increment revisionId only if there is a delta Currently revisionId is incremented even if there is no change in data. This commit increments revisionId only if there is some chnage in data denoted by non null delta value.
nielsgl_sequelize-paper-trail
train
js
12185ffe2eada3fab6ce302bc58cfe882c50300c
diff --git a/Resources/public/js/modules/translation.js b/Resources/public/js/modules/translation.js index <HASH>..<HASH> 100644 --- a/Resources/public/js/modules/translation.js +++ b/Resources/public/js/modules/translation.js @@ -6,7 +6,7 @@ appTranslation .factory('translationService', function(){ return { trans: function(key) { - return Translator.get('icap_portfolio' + ':' + key); + return Translator.trans(key, {}, 'icap_portfolio'); } }; })
[PortfolioBundle] Update translation service for angularjs with new version of bazing js translation
claroline_Distribution
train
js
2e1401a1b7d866e4835df1dffd1808b8adb876a2
diff --git a/src/core/Core.js b/src/core/Core.js index <HASH>..<HASH> 100644 --- a/src/core/Core.js +++ b/src/core/Core.js @@ -144,19 +144,13 @@ class Uppy { } addFile (file) { - const updatedFiles = Object.assign({}, this.state.files) - - const fileName = file.name || 'noname' - const fileExtension = Utils.getFileNameAndExtension(fileName)[1] - const isRemote = file.isRemote || false - - const fileID = Utils.generateFileID(fileName) - - // const fileType = Utils.getFileType(file) - // const fileTypeGeneral = fileType[0] - // const fileTypeSpecific = fileType[1] - Utils.getFileType(file).then((fileType) => { + const updatedFiles = Object.assign({}, this.state.files) + const fileName = file.name || 'noname' + const fileExtension = Utils.getFileNameAndExtension(fileName)[1] + const isRemote = file.isRemote || false + + const fileID = Utils.generateFileID(fileName) const fileTypeGeneral = fileType[0] const fileTypeSpecific = fileType[1]
move everything in addFile to .then callback
transloadit_uppy
train
js
e40d162df6ed9c5ca2366e6f2abf604e65842ec0
diff --git a/src/server/pfs/server/obj_block_api_server.go b/src/server/pfs/server/obj_block_api_server.go index <HASH>..<HASH> 100644 --- a/src/server/pfs/server/obj_block_api_server.go +++ b/src/server/pfs/server/obj_block_api_server.go @@ -182,7 +182,7 @@ func (s *objBlockAPIServer) PutObject(server pfsclient.ObjectAPI_PutObjectServer r := io.TeeReader(putObjectReader, hash) block := &pfsclient.Block{Hash: uuid.NewWithoutDashes()} var size int64 - if err := func() error { + if err := func() (retErr error) { w, err := s.objClient.Writer(s.localServer.blockPath(block)) if err != nil { return err
Fix bug that caused us to swallow errors.
pachyderm_pachyderm
train
go
761d4ee179d4c159e717959a3242213e37911365
diff --git a/gbdxtools/images/meta.py b/gbdxtools/images/meta.py index <HASH>..<HASH> 100644 --- a/gbdxtools/images/meta.py +++ b/gbdxtools/images/meta.py @@ -466,7 +466,6 @@ class GeoImage(Container): except AssertionError as ae: warnings.warn(ae.args) - print(bounds) image = self._slice_padded(bounds) image.__geo_interface__ = mapping(g) return image
removing a print of the image bounds
DigitalGlobe_gbdxtools
train
py
6b688ffae64738ad8285c3ac975d641f1b26aa53
diff --git a/template/shared/directives/forms/formInput.js b/template/shared/directives/forms/formInput.js index <HASH>..<HASH> 100644 --- a/template/shared/directives/forms/formInput.js +++ b/template/shared/directives/forms/formInput.js @@ -5,7 +5,8 @@ angular.module('views') template: '<div ng-include="getContentUrl()"></div>', scope: { directiveData: '=', - key: '@' + key: '@', + required: '@' }, controller: function($rootScope, $scope, $translate, defaultSettings, settingsInstances) { @@ -20,6 +21,12 @@ angular.module('views') return data; }; + + //allow front end to force required + if ($scope.required){ + $scope.directiveData.required = true; + } + if($scope.directiveData.typeRef){ if(!$scope.directiveData.endPoint){ $scope.directiveData.endPoint = settingsInstances.getTypeRefsInstance('default');
add ability to force required fields on front end, even if data model says optional this basically lets us move soem biz logic to the front end as needed
SciSpike_yaktor-ui-angular1
train
js
4709a1b1d0ad0b7ab7ebba93305b7ea99ae315e3
diff --git a/template_functions.go b/template_functions.go index <HASH>..<HASH> 100644 --- a/template_functions.go +++ b/template_functions.go @@ -607,7 +607,7 @@ func parseInt(s string) (int64, error) { // parseJSON returns a structure for valid JSON func parseJSON(s string) (interface{}, error) { if s == "" { - return make([]interface{}, 0), nil + return map[string]interface{}{}, nil } var data interface{} diff --git a/template_functions_test.go b/template_functions_test.go index <HASH>..<HASH> 100644 --- a/template_functions_test.go +++ b/template_functions_test.go @@ -1440,7 +1440,7 @@ func TestParseJSON_empty(t *testing.T) { t.Fatal(err) } - expected := []interface{}{} + expected := map[string]interface{}{} if !reflect.DeepEqual(result, expected) { t.Errorf("expected %#v to be %#v", result, expected) }
Return a map instead of an array for parseJSON The default function for parseJSON currently returns an array. This is problematic. Fixes GH-<I> because it makes using functions like `index` more difficult due to arrays being unable to have string indexes. This should be backwards compatible because one can still index a map using a string (thus treating it as an array).
hashicorp_consul-template
train
go,go
42aa8503d32f5ad762551ca120d815d5070aed35
diff --git a/impala/hiveserver2.py b/impala/hiveserver2.py index <HASH>..<HASH> 100644 --- a/impala/hiveserver2.py +++ b/impala/hiveserver2.py @@ -315,12 +315,17 @@ class HiveServer2Cursor(Cursor): def _wait_to_finish(self): loop_start = time.time() while True: - operation_state = self._last_operation.get_status() + req = TGetOperationStatusReq(operationHandle=self._last_operation.handle) + resp = self._last_operation._rpc('GetOperationStatus', req) + operation_state = TOperationState._VALUES_TO_NAMES[resp.operationState] log.debug('_wait_to_finish: waited %s seconds so far', time.time() - loop_start) if self._op_state_is_error(operation_state): - raise OperationalError("Operation is in ERROR_STATE") + if resp.errorMessage: + raise OperationalError(resp.errorMessage) + else: + raise OperationalError("Operation is in ERROR_STATE") if not self._op_state_is_executing(operation_state): break time.sleep(self._get_sleep_interval(loop_start))
Return detailed Error Messages from query failures (#<I>) Allow the usage of the errorMessage field from the GetOperationStatus command in an exception on impala <I>+ where IMPALA-<I> has been implemented.
cloudera_impyla
train
py
4c4c34c5b237da673b8a731727dc321f2e79f2b1
diff --git a/core/src/main/java/tech/tablesaw/api/Table.java b/core/src/main/java/tech/tablesaw/api/Table.java index <HASH>..<HASH> 100644 --- a/core/src/main/java/tech/tablesaw/api/Table.java +++ b/core/src/main/java/tech/tablesaw/api/Table.java @@ -1047,6 +1047,14 @@ public class Table extends Relation implements IntIterable { return new Maximum(this, numericColumnName); } + public Minimum min(String numericColumnName) { + return new Minimum(this, numericColumnName); + } + + /** + * @deprecated use min(String) instead + */ + @Deprecated public Minimum minimum(String numericColumnName) { return new Minimum(this, numericColumnName); }
Standardize naming of min/max functions
jtablesaw_tablesaw
train
java
36d49dfeadae207c92190964364c1a9df3b3cdcf
diff --git a/lua.go b/lua.go index <HASH>..<HASH> 100644 --- a/lua.go +++ b/lua.go @@ -751,8 +751,8 @@ func ToThread(l *State, index int) *State { } // ToValue convertes the value at `index` into a generic Go interface{}. The -// value can be a userdata, a table, a thread, a function, or Go string, bool, -// uint, int or float64 types. Otherwise, the function returns nil. +// value can be a userdata, a table, a thread, a function, or Go string, bool +// or float64 types. Otherwise, the function returns nil. // // Different objects will give different values. There is no way to convert // the value back into its original value. @@ -763,12 +763,7 @@ func ToThread(l *State, index int) *State { func ToValue(l *State, index int) interface{} { v := l.indexToValue(index) switch v := v.(type) { - case string, uint, int, float64, bool: - case *table: - case *luaClosure: - case *goClosure: - case *goFunction: - case *State: + case string, float64, bool, *table, *luaClosure, *goClosure, *goFunction, *State: case *userData: return v.data default:
uint and int aren't saved in the vm, so they can't occur.
Shopify_go-lua
train
go
240b5019a245ed084de85fb560f18e1d3c93dd50
diff --git a/pygeoip/timezone.py b/pygeoip/timezone.py index <HASH>..<HASH> 100644 --- a/pygeoip/timezone.py +++ b/pygeoip/timezone.py @@ -652,6 +652,7 @@ country_dict = { '09': 'Europe/Kiev', '10': 'Europe/Zaporozhye', '11': 'Europe/Simferopol', + '12': 'Europe/Kiev', '13': 'Europe/Kiev', '14': 'Europe/Zaporozhye', '15': 'Europe/Uzhgorod',
Justice should be served: add missing Kiev region ID
appliedsec_pygeoip
train
py
6eec05ebc39aa7864b047345831e41e63db94377
diff --git a/test/email_alert_api_test.rb b/test/email_alert_api_test.rb index <HASH>..<HASH> 100644 --- a/test/email_alert_api_test.rb +++ b/test/email_alert_api_test.rb @@ -32,7 +32,7 @@ describe GdsApi::EmailAlertApi do it "posts a new alert" do assert api_client.send_alert(publication_params) - assert_requested(:post, "#{base_url}/notifications", publication_params) + assert_requested(:post, "#{base_url}/notifications", body: publication_params.to_json) end it "returns the an empty response" do
Pass correct parameters to assert_requested Previously, this was just passing an options hash to assert_requested, which isn't correct usage, and would have been failing to actually check the body. Webmock now (as of release <I>) validates the options passed to assert_requested, and will complain if unknown keys are passed. This has made the error obvious.
alphagov_gds-api-adapters
train
rb
f9514d92bda0ebdf8386661722fe9c125ca59e3b
diff --git a/java/server/src/org/openqa/grid/web/servlet/RegistrationServlet.java b/java/server/src/org/openqa/grid/web/servlet/RegistrationServlet.java index <HASH>..<HASH> 100644 --- a/java/server/src/org/openqa/grid/web/servlet/RegistrationServlet.java +++ b/java/server/src/org/openqa/grid/web/servlet/RegistrationServlet.java @@ -80,6 +80,8 @@ public class RegistrationServlet extends RegistryBasedServlet { GridNodeConfiguration nodeConfig = new GridNodeConfiguration(); nodeConfig.merge(hubConfig); nodeConfig.merge(server.getConfiguration()); + nodeConfig.host = server.getConfiguration().host; + nodeConfig.port = server.getConfiguration().port; server.setConfiguration(nodeConfig); final RemoteProxy proxy = BaseRemoteProxy.getNewInstance(server, getRegistry());
actually register the requested node's host and port o<I> fixes tests :)
SeleniumHQ_selenium
train
java
2433b77aeda5855d9bf464c5f453e4552dcb98ad
diff --git a/src/Report.php b/src/Report.php index <HASH>..<HASH> 100644 --- a/src/Report.php +++ b/src/Report.php @@ -212,9 +212,9 @@ class Report * * @return \Throwable|array|null */ - public function originalError() + public function getOriginalError() { - return $this->original; + return $this->originalError; } /**
Update src/Report.php
bugsnag_bugsnag-php
train
php
3a387eb30dafcf0a964595df97fb62dab0214f23
diff --git a/src/com/jfoenix/controls/JFXListView.java b/src/com/jfoenix/controls/JFXListView.java index <HASH>..<HASH> 100644 --- a/src/com/jfoenix/controls/JFXListView.java +++ b/src/com/jfoenix/controls/JFXListView.java @@ -102,13 +102,13 @@ public class JFXListView<T> extends ListView<T> { private DoubleProperty currentVerticalGapProperty = new SimpleDoubleProperty(); - public DoubleProperty currentVerticalGapProperty(){ + DoubleProperty currentVerticalGapProperty(){ return currentVerticalGapProperty; } - public double getCurrentVerticalGap(){ + double getCurrentVerticalGap(){ return currentVerticalGapProperty.get(); } - public void setCurrentVerticalGap(double gap){ + void setCurrentVerticalGap(double gap){ currentVerticalGapProperty.set(gap); }
change currentVerticalProperty scope to package scope
jfoenixadmin_JFoenix
train
java
9944df364aaf954ecc932ce41eb2961f4f3b7c8d
diff --git a/flask_unchained/bundles/admin/model_admin.py b/flask_unchained/bundles/admin/model_admin.py index <HASH>..<HASH> 100644 --- a/flask_unchained/bundles/admin/model_admin.py +++ b/flask_unchained/bundles/admin/model_admin.py @@ -217,7 +217,7 @@ class ModelAdmin(AdminSecurityMixin, _BaseModelAdmin, metaclass=ModelAdminMetacl if attr in EXTEND_BASE_CLASS_DICT_ATTRIBUTES and isinstance(value, dict): base_value = getattr(ModelAdmin, attr) if isinstance(base_value, dict): - value.update(base_value) + base_value.update(value) elif attr in EXTEND_BASE_CLASS_LIST_ATTRIBUTES and isinstance(value, (list, tuple)): base_value = getattr(ModelAdmin, attr) if isinstance(base_value, (list, tuple)):
fix bug in admin with extending dict-based attributes
briancappello_flask-unchained
train
py
13d8dc170a721b3080c2d4ecf98e002600ac3a23
diff --git a/src/actions/index.js b/src/actions/index.js index <HASH>..<HASH> 100644 --- a/src/actions/index.js +++ b/src/actions/index.js @@ -267,12 +267,12 @@ export function reverse() { }); } + dispatch(reverseInputs(origin, destination)); + if (origin.geometry && destination.geometry) { const query = buildDirectionsQuery(o, d, waypoints); return dispatch(fetchDirections(query, profile)); } - - dispatch(reverseInputs(origin, destination)); }; }
Move dispatch on reverse before condition is returned
mapbox_mapbox-gl-directions
train
js
f63519ff1e8d375df30deba63156a2fc97aa9ee7
diff --git a/modules/system/twig/SecurityPolicy.php b/modules/system/twig/SecurityPolicy.php index <HASH>..<HASH> 100644 --- a/modules/system/twig/SecurityPolicy.php +++ b/modules/system/twig/SecurityPolicy.php @@ -18,10 +18,18 @@ final class SecurityPolicy implements SecurityPolicyInterface * @var array List of forbidden methods. */ protected $blockedMethods = [ + // \October\Rain\Extension\ExtendableTrait 'addDynamicMethod', 'addDynamicProperty', + + // \October\Rain\Support\Traits\Emitter 'bindEvent', 'bindEventOnce', + + // Eloquent & Halcyon data modification + 'insert', + 'update', + 'delete', ]; /**
Further improvements to the Twig SecurityPolicy
octobercms_october
train
php
696ffd8917c7ea5d776a5d8be026a06fb2f2acb6
diff --git a/src/core/IncomingDataPoints.java b/src/core/IncomingDataPoints.java index <HASH>..<HASH> 100644 --- a/src/core/IncomingDataPoints.java +++ b/src/core/IncomingDataPoints.java @@ -177,7 +177,7 @@ final class IncomingDataPoints implements WritableDataPoints { throw new IllegalArgumentException("New timestamp=" + timestamp + " is less than previous=" + last_ts + " when trying to add value=" + value + " to " + this); - } else if (timestamp - base_time > Const.MAX_TIMESPAN) { + } else if (timestamp - base_time >= Const.MAX_TIMESPAN) { // Need to start a new row as we've exceeded Const.MAX_TIMESPAN. // We force the starting timestamp to be on a MAX_TIMESPAN boundary // so that all TSDs create rows with the same base time. Otherwise @@ -236,7 +236,7 @@ final class IncomingDataPoints implements WritableDataPoints { // We can't have more than 1 value per second, so MAX_TIMESPAN values. final int new_size = Math.min(size * 2, Const.MAX_TIMESPAN); if (new_size == size) { - throw new AssertionError("Can't grow " + this + " larger."); + throw new AssertionError("Can't grow " + this + " larger than " + size); } values = Arrays.copyOf(values, new_size); qualifiers = Arrays.copyOf(qualifiers, new_size);
Fix an off-by-one in a comparison when adding new data points. This was causing the following error: AssertionError: Can't grow IncomingDataPoints(...) larger. When trying to add another data point exactly <I> seconds into an existing row. Bug reported by Michael Glaesemann. Change-Id: I<I>b<I>f<I>a1f<I>ab<I>f7e<I>f<I>e4
OpenTSDB_opentsdb
train
java
bc4d72282b6389c6968a1da394ec2b7fc300d7ea
diff --git a/scapy.py b/scapy.py index <HASH>..<HASH> 100755 --- a/scapy.py +++ b/scapy.py @@ -21,6 +21,9 @@ # # $Log: scapy.py,v $ +# Revision 1.0.4.5 2006/04/02 13:12:10 pbi +# - added __mul__() and __rmul__() operators to handle multiplication with an int +# # Revision 1.0.4.4 2006/03/27 13:32:50 pbi # - added missing fileno() to PcapReader and PcapWriter # @@ -1373,7 +1376,7 @@ from __future__ import generators -RCSID="$Id: scapy.py,v 1.0.4.4 2006/03/27 13:32:50 pbi Exp $" +RCSID="$Id: scapy.py,v 1.0.4.5 2006/04/02 13:12:10 pbi Exp $" VERSION = RCSID.split()[2]+"beta" @@ -4591,6 +4594,14 @@ class Packet(Gen): return Raw(load=other)/self else: raise TypeError + def __mul__(self, other): + if type(other) is int: + return [self]*other + else: + raise TypeError + def __rmul__(self,other): + return self.__mul__(other) + def __len__(self): return len(self.__str__()) def do_build(self):
- added __mul__() and __rmul__() operators to handle multiplication with an int
secdev_scapy
train
py
72e338a422f95c08502beaaf7494e51f35df882e
diff --git a/test/bot.js b/test/bot.js index <HASH>..<HASH> 100644 --- a/test/bot.js +++ b/test/bot.js @@ -50,8 +50,9 @@ client `); }); -client.setProvider(sqlite.open(path.join(__dirname, 'database.sqlite3')).then(db => new commando.SQLiteProvider(db))) - .catch(console.error); +client.setProvider( + sqlite.open(path.join(__dirname, 'database.sqlite3')).then(db => new commando.SQLiteProvider(db)) +).catch(console.error); client.registry .registerGroup('math', 'Math')
Teensy weensy change for clarity
discordjs_Commando
train
js
25d159bda3cf344cc6fdb63e9b275a90916de61f
diff --git a/src/PeskyCMF/Config/peskycmf.routes.php b/src/PeskyCMF/Config/peskycmf.routes.php index <HASH>..<HASH> 100644 --- a/src/PeskyCMF/Config/peskycmf.routes.php +++ b/src/PeskyCMF/Config/peskycmf.routes.php @@ -309,6 +309,10 @@ Route::group( Route::get('{table_name}/{id}/action/{action}', [ 'as' => $routeNamePrefix . 'cmf_api_item_custom_action', 'uses' => $apiControllerClass . '@performActionForItem', + 'fallback' => [ + 'route' => $routeNamePrefix . 'cmf_items_table', + 'use_params' => true + ] ]); Route::get('{table_name}/{id}', [
Fixed missing fallback for cmf_api_item_custom_action route
swayok_PeskyCMF
train
php
5d0ef9fbe651e1589c03eba285959bd033108e64
diff --git a/sprd/manager/ProductManager.js b/sprd/manager/ProductManager.js index <HASH>..<HASH> 100644 --- a/sprd/manager/ProductManager.js +++ b/sprd/manager/ProductManager.js @@ -1098,7 +1098,10 @@ define(["sprd/manager/IProductManager", "underscore", "flow", "sprd/util/Product var desiredRatio = options.respectTransform ? this.getConfigurationCenterAsRatio(configuration) : this.getVectorAsRatio(defaultCenter, printArea); boundingBox = configuration._getBoundingBox(null, null, null, null, desiredScale); var desiredOffset = this.centerAtPoint(this.getRatioAsPoint(desiredRatio, printArea), boundingBox); - offset.set("x", desiredOffset.x); + offset.set({ + x: desiredOffset.x, + y: defaultBox.y + }); var minimumDesignScale;
Configurations are moved to y offset of defaultBox. No centering based on scale in this direction.
spreadshirt_rAppid.js-sprd
train
js
7b2ccfc576ea34ab82335b38ae927cd1d8106ab2
diff --git a/cherrypy/wsgiserver/__init__.py b/cherrypy/wsgiserver/__init__.py index <HASH>..<HASH> 100644 --- a/cherrypy/wsgiserver/__init__.py +++ b/cherrypy/wsgiserver/__init__.py @@ -345,6 +345,7 @@ class HTTPRequest(object): self.simple_response(400, "Malformed Request-Line") return + environ["REQUEST_URI"] = path environ["REQUEST_METHOD"] = method # path may be an abs_path (including "http://host.domain.tld"); @@ -398,10 +399,6 @@ class HTTPRequest(object): environ["SERVER_PROTOCOL"] = req_protocol self.response_protocol = "HTTP/%s.%s" % min(rp, sp) - # If the Request-URI was an absoluteURI, use its location atom. - if location: - environ["SERVER_NAME"] = location - # then all the http headers try: self.read_headers()
Buh. SERVER_NAME shouldn't change based on client behaviors. Also added WSGI environ['REQUEST_URI'] so apps can know when absolute URI's were used, etc.
cherrypy_cheroot
train
py
34e64d7463b856c265b3a2fd6bdb082feffdb917
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -12,7 +12,7 @@ setup( 'gooey.languages', 'gooey.mockapplications', ], - url='http://pypi.python.org/pypi/TowelStuff/', + url='http://pypi.python.org/pypi/Gooey/', license='LICENSE.txt', description='Turn (almost) any command line program into a full GUI application with one line', long_description=open('README.md').read()
Fixed setup.py again (I think)
chriskiehl_Gooey
train
py
37f6223decd3e4751e1367080b477f0ff29287af
diff --git a/test/test.js b/test/test.js index <HASH>..<HASH> 100644 --- a/test/test.js +++ b/test/test.js @@ -80,6 +80,45 @@ describe('utily -> fs', function() }); }); + //Test isDir method + describe('-> isDir method', function() + { + //Folder that exists + it('should return that the folder path is a directory', function(done) + { + return utily.fs.isDir(__dirname, function(error, exists) + { + assert.equal(null, error); + assert.equal(true, exists); + done(); + }); + }); + + //Path is a file + it('should return that the file path is not a directory', function(done) + { + var file = path.join(__dirname, 'test.js'); + return utily.fs.isDir(file, function(error, exists) + { + assert.equal(null, error); + assert.equal(false, exists); + done(); + }); + }); + + //Path does not exists + it('should return that the fake path is not a directory', function(done) + { + var fake = path.join(__dirname, './fake/path'); + return utily.fs.isDir(fake, function(error, exists) + { + assert.equal(null, error); + assert.equal(false, exists); + done(); + }); + }) + }); + //Test mkdir method describe('-> mkdir method', function() {
test/test.js: added fs.isDir tests
jmjuanes_utily
train
js
2cba6b66bfd61976e1d2bf3a7412c8fd57003f23
diff --git a/programs/thellier_gui.py b/programs/thellier_gui.py index <HASH>..<HASH> 100755 --- a/programs/thellier_gui.py +++ b/programs/thellier_gui.py @@ -429,7 +429,8 @@ DESCRIPTION # try to read redo file if one exists if os.path.exists(os.path.join(self.WD, 'thellier_GUI.redo')): self.read_redo_file(os.path.join(self.WD, 'thellier_GUI.redo')) - self.update_selection() + if self.s: + self.update_selection() def get_DIR(self, WD=None): @@ -1594,7 +1595,8 @@ else: index += 1 self.s = self.specimens[index] self.specimens_box.SetStringSelection(self.s) - self.update_selection() + if self.s: + self.update_selection() #----------------------------------------------------------------------
in thellier gui only update selection when self.s is not null
PmagPy_PmagPy
train
py
53571a82e786df3adf5c5b57507b1797469bd65f
diff --git a/lib/bibliothecary/parsers/nuget.rb b/lib/bibliothecary/parsers/nuget.rb index <HASH>..<HASH> 100644 --- a/lib/bibliothecary/parsers/nuget.rb +++ b/lib/bibliothecary/parsers/nuget.rb @@ -59,7 +59,8 @@ module Bibliothecary frameworks[framework] = deps.map do |name, details| { name: name, - # I think 'resolved' should always be set though + # 'resolved' has been set in all examples so far + # so fallback to requested is pure paranoia requirement: details.fetch('resolved', details.fetch('requested', '*')), type: 'runtime' }
Improve comment about 'resolved' in packages.lock.json
librariesio_bibliothecary
train
rb
8199a8b59ade400a69f0efe2cb26951c130b6c75
diff --git a/src/Contracts/Classifier.php b/src/Contracts/Classifier.php index <HASH>..<HASH> 100644 --- a/src/Contracts/Classifier.php +++ b/src/Contracts/Classifier.php @@ -28,4 +28,11 @@ interface Classifier * @return bool */ public function countsTowardsApplicationCode(): bool; + + /** + * Determine if the lines of code of the component should count towards + * the total number of lines of code of the test suite. + * @return bool + */ + public function countsTowardsTests(): bool; }
Add countsTowardsTests to Classifier
stefanzweifel_laravel-stats
train
php
96e499b991598e6c36fa223ef83f640fdcf56a0a
diff --git a/lib/active_scaffold/data_structures/column.rb b/lib/active_scaffold/data_structures/column.rb index <HASH>..<HASH> 100644 --- a/lib/active_scaffold/data_structures/column.rb +++ b/lib/active_scaffold/data_structures/column.rb @@ -350,7 +350,7 @@ module ActiveScaffold::DataStructures self.css_class = '' self.required = active_record_class.validators_on(self.name).any? do |val| !val.options[:if] && !val.options[:unless] && (ActiveModel::Validations::PresenceValidator === val || - (ActiveModel::Validations::InclusionValidator === val && !val.options[:allow_nil] && !val.options[:allow_blank]) + (ActiveModel::Validations::InclusionValidator === val && !val.options[:allow_nil] && !val.options[:allow_blank] && !(@form_ui == :checkbox && [[true, false], [false, true]].include?(val.send(:delimiter)))) ) end self.sort = true
Fixes not null boolean columns When a boolean field is validated with inclusion [true, false] or [false, true] it should not be marked as required. refs #<I>
activescaffold_active_scaffold
train
rb
b2199757876f9a892c292f4a2a3e47d8666f4da5
diff --git a/visidata/plugins.py b/visidata/plugins.py index <HASH>..<HASH> 100644 --- a/visidata/plugins.py +++ b/visidata/plugins.py @@ -23,6 +23,8 @@ def _plugin_import(plugin): return "import " + _plugin_import_name(plugin) def _plugin_import_name(plugin): + if 'git+' in plugin.url: + return plugin.name return "plugins."+plugin.name def _plugin_in_import_list(plugin): @@ -166,7 +168,8 @@ class PluginsSheet(JsonLinesSheet): r = re.compile(r'^{}\W'.format(_plugin_import(plugin))) new.writelines(line for line in old.readlines() if not r.match(line)) - os.unlink(_plugin_path(plugin)) + if os.path.exists(_plugin_path(plugin)): + os.unlink(_plugin_path(plugin)) sys.modules.pop(_plugin_import_name(plugin)) importlib.invalidate_caches() vd.warning('{0} plugin uninstalled'.format(plugin['name']))
[plugins-] handle import and remove for git+ plugins, which are installed to pip local
saulpw_visidata
train
py
156e326456a742b2e96a1379c812dcb2b0289c60
diff --git a/lib/xcode-installer/release-manager.rb b/lib/xcode-installer/release-manager.rb index <HASH>..<HASH> 100644 --- a/lib/xcode-installer/release-manager.rb +++ b/lib/xcode-installer/release-manager.rb @@ -32,8 +32,15 @@ module XcodeInstaller os_version = os_version.match(/\d+\.\d+/)[0] list.each { |release| - if release['version'].to_s == version && release['os_version'].to_s == os_version - return release + if release['version'].to_s == version + if release['interface_type'] == 'gui' + # gui releases aren't limited by OS + return release + elsif release['interface_type'] == 'cli' && release['os_version'].to_s == os_version + return release + else + puts "Unknown interface type #{release['interface_type']}" + end end } end
Don't limit gui releases by os_version
phatblat_xcode-installer
train
rb
02a2c705b01f171edea106a7ee867b6112074853
diff --git a/engineio/client.py b/engineio/client.py index <HASH>..<HASH> 100644 --- a/engineio/client.py +++ b/engineio/client.py @@ -528,7 +528,7 @@ class Client(object): self.logger.info( 'PONG response has not been received, aborting') if self.ws: - self.ws.shutdown() + self.ws.close(timeout=0) self.queue.put(None) break self.pong_received = False diff --git a/tests/common/test_client.py b/tests/common/test_client.py index <HASH>..<HASH> 100644 --- a/tests/common/test_client.py +++ b/tests/common/test_client.py @@ -839,7 +839,7 @@ class TestClient(unittest.TestCase): c._ping_loop() self.assertEqual(c.state, 'connected') c.queue.put.assert_called_once_with(None) - c.ws.shutdown.assert_called_once_with() + c.ws.close.assert_called_once_with(timeout=0) def test_read_loop_polling_disconnected(self): c = client.Client()
Missing timeout when closing websocket connection (Fixes #<I>)
miguelgrinberg_python-engineio
train
py,py
58a1a0c39841ccaa530188f6edb675b3b90d6040
diff --git a/populous/generators/autoincrement.py b/populous/generators/autoincrement.py index <HASH>..<HASH> 100644 --- a/populous/generators/autoincrement.py +++ b/populous/generators/autoincrement.py @@ -13,19 +13,12 @@ class AutoIncrement(Generator): @property def start(self): if self._start is None: - self._start = self._get_start() + backend = self.blueprint.backend + value = backend.get_max_existing_value(self.item, self.field_name) + self._start = value + 1 if value is not None else 1 return self._start - def _get_start(self): - backend = self.blueprint.backend - - if not backend: - return 0 - - value = backend.get_max_existing_value(self.item, self.field_name) - return value + 1 if value is not None else 0 - def generate(self): for i in count(self.start): yield i
AutoIncrement: Start at 1, like most dbs
peopledoc_populous
train
py
126f9d0e42d050e72b3940583d2b7eaabc5a571b
diff --git a/tests/test_interfaces.py b/tests/test_interfaces.py index <HASH>..<HASH> 100644 --- a/tests/test_interfaces.py +++ b/tests/test_interfaces.py @@ -31,8 +31,8 @@ class TestInterfaces(unittest.TestCase): continue self.assertEqual( - inspect.getargspec(base_func), - inspect.getargspec(getattr(subclass, name)), + inspect.signature(base_func), + inspect.signature(getattr(subclass, name)), "%s.%s has a different signature" % (subclass.__name__, name) )
use inspect.signature(), since getargspec is deprecated
mathiasertl_xmpp-backends
train
py
f22d3574bc43201856f77a1da04f9156b3466236
diff --git a/packages/channels/botpress-channel-web/src/api.js b/packages/channels/botpress-channel-web/src/api.js index <HASH>..<HASH> 100755 --- a/packages/channels/botpress-channel-web/src/api.js +++ b/packages/channels/botpress-channel-web/src/api.js @@ -16,6 +16,7 @@ import users from './users' const ERR_USER_ID_REQ = '`userId` is required and must be valid' const ERR_MSG_TYPE = '`type` is required and must be valid' const ERR_CONV_ID_REQ = '`conversationId` is required and must be valid' +const VALID_USER_ID_RE = /^[a-z0-9-_]+$/i module.exports = async (bp, config) => { const diskStorage = multer.diskStorage({ @@ -209,9 +210,7 @@ module.exports = async (bp, config) => { }) }) - function validateUserId(userId) { - return /^[a-z0-9-_]+$/i.test(userId) - } + const validateUserId = userId => VALID_USER_ID_RE.test(userId) async function sendNewMessage(userId, conversationId, payload) { if (!payload.text || !_.isString(payload.text) || payload.text.length > 360) {
fix(channel-web): extract frequently used regex
botpress_botpress
train
js
4dc7d4530602a587f7eaece510270702f7d48759
diff --git a/src/Reader.php b/src/Reader.php index <HASH>..<HASH> 100644 --- a/src/Reader.php +++ b/src/Reader.php @@ -10,6 +10,7 @@ namespace cebe\openapi; use cebe\openapi\exceptions\IOException; use cebe\openapi\exceptions\TypeErrorException; use cebe\openapi\exceptions\UnresolvableReferenceException; +use cebe\openapi\json\InvalidJsonPointerSyntaxException; use cebe\openapi\json\JsonPointer; use cebe\openapi\spec\OpenApi; use Symfony\Component\Yaml\Yaml; @@ -69,6 +70,7 @@ class Reader * @throws TypeErrorException in case invalid spec data is supplied. * @throws UnresolvableReferenceException in case references could not be resolved. * @throws IOException when the file is not readable. + * @throws InvalidJsonPointerSyntaxException in case an invalid JSON pointer string is passed to the spec references. */ public static function readFromJsonFile(string $fileName, string $baseType = OpenApi::class, $resolveReferences = true): SpecObjectInterface {
Add exception in readFromJsonFile The InvalidJsonPointerSyntaxException can be thrown in readFromJsonFile, users need to know it in order to catch it.
cebe_php-openapi
train
php
c8c2dc469f90972a20f2b7438f4924f4e052cd3e
diff --git a/reana_commons/version.py b/reana_commons/version.py index <HASH>..<HASH> 100755 --- a/reana_commons/version.py +++ b/reana_commons/version.py @@ -14,4 +14,4 @@ and parsed by ``setup.py``. from __future__ import absolute_import, print_function -__version__ = "0.5.0.dev20190212" +__version__ = "0.5.0.dev20190213"
release: <I>.de<I>
reanahub_reana-commons
train
py
2620ee651be1b355fb58f6f266fb398b45ca250e
diff --git a/angr/call_stack.py b/angr/call_stack.py index <HASH>..<HASH> 100644 --- a/angr/call_stack.py +++ b/angr/call_stack.py @@ -46,7 +46,7 @@ class CallFrame(object): # Try to convert the ret_addr to an integer try: if self.ret_addr.symbolic: - l.warning('CallStack does not support symbolic return addresses for performance concerns.') + l.debug('CallStack does not support symbolic return addresses for performance concerns.') self.ret_addr = None else: self.ret_addr = state.se.any_int(self.ret_addr)
CallStack: change the warning to debug to avoid excessive warning messages when running CFGFast on MIPS<I> binaries.
angr_angr
train
py
9efa63a654145fcb315d16c5e6d21ab3b96c6f01
diff --git a/plugins/Goals/API.php b/plugins/Goals/API.php index <HASH>..<HASH> 100644 --- a/plugins/Goals/API.php +++ b/plugins/Goals/API.php @@ -496,7 +496,7 @@ class API extends \Piwik\Plugin\API 'idGoal' => $idGoal, 'columns' => $columns, 'showAllGoalSpecificMetrics' => $showAllGoalSpecificMetrics, - 'format_metrics' => Common::getRequestVar('format_metrics', 'bc'), + 'format_metrics' => !empty($compare) ? 0 : Common::getRequestVar('format_metrics', 'bc'), ), $default = []); Archiver::$ARCHIVE_DEPENDENT = true; $tableSegmented->filter('Piwik\Plugins\Goals\DataTable\Filter\AppendNameToColumnNames',
Fix possible notice when comparing goal data (#<I>) happened as some metrics might have been formatted twice
matomo-org_matomo
train
php
bd11d41041e2b25032ddab7830cbb957076a4e16
diff --git a/lib/svg.js b/lib/svg.js index <HASH>..<HASH> 100644 --- a/lib/svg.js +++ b/lib/svg.js @@ -100,7 +100,7 @@ function load(str) { }); // Add IDs, they are equal to glyph index in array - var id = 1; + var id = 0; _.forEach(font.glyphs, function (glyph) { glyph.id = id++; });
Fixes in glyphs IDs.
fontello_svg2ttf
train
js
9bacbbffa96817b3103612ec7a5e15c32eaf18a9
diff --git a/spec/rollbar/delay/shoryuken_spec.rb b/spec/rollbar/delay/shoryuken_spec.rb index <HASH>..<HASH> 100644 --- a/spec/rollbar/delay/shoryuken_spec.rb +++ b/spec/rollbar/delay/shoryuken_spec.rb @@ -1,7 +1,16 @@ require 'spec_helper' -require 'rollbar/delay/shoryuken' -describe Rollbar::Delay::Shoryuken do +begin + require 'rollbar/delay/shoryuken' +rescue LoadError + module Rollbar + module Delay + class Shoryuken; end + end + end +end + +describe Rollbar::Delay::Shoryuken, :if => RUBY_VERSION != '1.8.7' && RUBY_VERSION != '1.9.2' do describe '.call' do let(:payload) do { :key => 'value' }
Omit shoryuken specs for unsupported ruby versions
rollbar_rollbar-gem
train
rb
a4eed91be362e0fe86e247da7bfb4b45c27b5e72
diff --git a/pods/datasets.py b/pods/datasets.py index <HASH>..<HASH> 100644 --- a/pods/datasets.py +++ b/pods/datasets.py @@ -559,7 +559,7 @@ def pmlr(volumes='all', data_set='pmlr', refresh_data=False): file = entry['yaml'].split('/')[-1] proto, url = entry['yaml'].split('//') file = os.path.basename(url) - dir = os.path.dirname(url) + dir = '/'.join(url.split('/')[1:]) urln = proto + '//' + url.split('/')[0] data_resources[data_name_full]['files'].append([file]) data_resources[data_name_full]['dirs'].append([dir])
Fix bug from pmlr_volumes
sods_ods
train
py
661d89fd714b4f0eb699714abd9c0f44c8319324
diff --git a/torchvision/models/squeezenet.py b/torchvision/models/squeezenet.py index <HASH>..<HASH> 100644 --- a/torchvision/models/squeezenet.py +++ b/torchvision/models/squeezenet.py @@ -7,8 +7,8 @@ from typing import Any __all__ = ['SqueezeNet', 'squeezenet1_0', 'squeezenet1_1'] model_urls = { - 'squeezenet1_0': 'https://download.pytorch.org/models/squeezenet1_0-a815701f.pth', - 'squeezenet1_1': 'https://download.pytorch.org/models/squeezenet1_1-f364aa15.pth', + 'squeezenet1_0': 'https://download.pytorch.org/models/squeezenet1_0-b66bff10.pth', + 'squeezenet1_1': 'https://download.pytorch.org/models/squeezenet1_1-b8a52dc0.pth', }
update squeezenet urls (#<I>)
pytorch_vision
train
py