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
604a568e439aa0524ebbcadfc5fd32a6091e7f0a
diff --git a/easymode/admin/forms/fields.py b/easymode/admin/forms/fields.py index <HASH>..<HASH> 100644 --- a/easymode/admin/forms/fields.py +++ b/easymode/admin/forms/fields.py @@ -37,6 +37,7 @@ class HtmlEntityField(fields.CharField): entityless_value = re.sub(r'&[^;]+;', 'X', tagless_value) else: entityless_value = value + value = u'' # validate using super class super(HtmlEntityField, self).clean(entityless_value)
Any HTMLField in easymode will now properly clean None as u''.
specialunderwear_django-easymode
train
py
645e1e08ae23dffb9ceea4358572d9331c6cd9c5
diff --git a/src/Type/FileTypeMapper.php b/src/Type/FileTypeMapper.php index <HASH>..<HASH> 100644 --- a/src/Type/FileTypeMapper.php +++ b/src/Type/FileTypeMapper.php @@ -31,7 +31,7 @@ class FileTypeMapper public function getTypeMap(string $fileName): array { - $cacheKey = sprintf('%s-%d-v3', $fileName, filemtime($fileName)); + $cacheKey = sprintf('%s-%d-v4', $fileName, filemtime($fileName)); $cachedResult = $this->cache->load($cacheKey); if ($cachedResult === null) { $typeMap = $this->createTypeMap($fileName);
FileTypeMapper - bump cache version because of change in StaticType and bugfixes
phpstan_phpstan
train
php
3565623de11cfe1b4a805f5c868b9aafd05f5b73
diff --git a/src/foremast/pipeline/construct_pipeline_block_lambda.py b/src/foremast/pipeline/construct_pipeline_block_lambda.py index <HASH>..<HASH> 100644 --- a/src/foremast/pipeline/construct_pipeline_block_lambda.py +++ b/src/foremast/pipeline/construct_pipeline_block_lambda.py @@ -64,7 +64,7 @@ def construct_pipeline_block_lambda(env='', user_data = generate_encoded_user_data(env=env, region=region, app_name=gen_app_name, group_name=generated.project) # Use different variable to keep template simple - instance_security_groups = DEFAULT_EC2_SECURITYGROUPS[env] + instance_security_groups = sorted(DEFAULT_EC2_SECURITYGROUPS[env]) instance_security_groups.append(gen_app_name) instance_security_groups.extend(settings['security_group']['instance_extras'])
added sorted to make a copy of the list so global variable is not mutated
foremast_foremast
train
py
9ccc9c2ca6c6016492b039497658aead18112027
diff --git a/src/bbn/User.php b/src/bbn/User.php index <HASH>..<HASH> 100644 --- a/src/bbn/User.php +++ b/src/bbn/User.php @@ -273,6 +273,7 @@ class User extends Models\Cls\Basic $this->_init_class_cfg($cfg); $f =& $this->class_cfg['fields']; + self::retrieverInit($this); if ($this->isToken() && !empty($params[$f['token']])) { @@ -370,7 +371,6 @@ class User extends Models\Cls\Basic // Creating the session's variables if they don't exist yet $this->_init_session(); - self::retrieverInit($this); /* if (x::isCli() && isset($params['id'])) {
Fix in User, moved retrieverInit
nabab_bbn
train
php
dc5edc94c4f0b20d4d90bfdedfb27f0be01b35c6
diff --git a/tests/ObservableBunnyTest.php b/tests/ObservableBunnyTest.php index <HASH>..<HASH> 100644 --- a/tests/ObservableBunnyTest.php +++ b/tests/ObservableBunnyTest.php @@ -55,9 +55,10 @@ final class ObservableBunnyTest extends TestCase $messageDto = null; $subject->subscribe(function (Message $message) use (&$messageDto, $subject) { $messageDto = $message; - $subject->dispose(); }); + $loop->addTimer(2, [$subject, 'dispose']); + $loop->run(); self::assertSame($message, $messageDto->getMessage());
Dispose after the first message has been shipped
WyriHaximus_reactphp-observable-bunny
train
php
5828ad8336d2a303cd493790b1fdc54f9bb27107
diff --git a/master/contrib/git_buildbot.py b/master/contrib/git_buildbot.py index <HASH>..<HASH> 100755 --- a/master/contrib/git_buildbot.py +++ b/master/contrib/git_buildbot.py @@ -40,17 +40,17 @@ from optparse import OptionParser master = "localhost:9989" -# When sending the notification, send this category if +# When sending the notification, send this category if (and only if) # it's set (via --category) category = None -# When sending the notification, send this repository if +# When sending the notification, send this repository if (and only if) # it's set (via --repository) repository = None -# When sending the notification, send this project if +# When sending the notification, send this project if (and only if) # it's set (via --project) project = None
replace iff with if (and only if) for non-math speakers ;)
buildbot_buildbot
train
py
7e2b0a1875740980fb7c5ac88bbb47b8e74c36e4
diff --git a/validator/testcases/l10ncompleteness.py b/validator/testcases/l10ncompleteness.py index <HASH>..<HASH> 100644 --- a/validator/testcases/l10ncompleteness.py +++ b/validator/testcases/l10ncompleteness.py @@ -1,6 +1,6 @@ import sys import os -import chardet +import fastchardet import json import fnmatch from StringIO import StringIO @@ -336,7 +336,7 @@ def _parse_l10n_doc(name, doc, no_encoding=False): # Allow the parse to specify files to skip for encoding checks if not no_encoding: - encoding = chardet.detect(doc) + encoding = fastchardet.detect(doc) encoding["encoding"] = encoding["encoding"].upper() loc_doc.expected_encoding = encoding["encoding"] in handler_formats loc_doc.found_encoding = encoding["encoding"]
Added initial support for fastchardet
mozilla_amo-validator
train
py
f294134e2404dca84db92efa193ba574174cef30
diff --git a/src/Illuminate/Http/Resources/Json/JsonResource.php b/src/Illuminate/Http/Resources/Json/JsonResource.php index <HASH>..<HASH> 100644 --- a/src/Illuminate/Http/Resources/Json/JsonResource.php +++ b/src/Illuminate/Http/Resources/Json/JsonResource.php @@ -60,7 +60,7 @@ class JsonResource implements ArrayAccess, JsonSerializable, Responsable, UrlRou /** * Create a new resource instance. * - * @param dynamic $parameters + * @param mixed $parameters * @return static */ public static function make(...$parameters)
Update DocBlock for PHP Analyses (#<I>)
laravel_framework
train
php
0a9522a8b316171d083623cd9dd50f2aa21efb2c
diff --git a/activesupport/lib/active_support/testing/assertions.rb b/activesupport/lib/active_support/testing/assertions.rb index <HASH>..<HASH> 100644 --- a/activesupport/lib/active_support/testing/assertions.rb +++ b/activesupport/lib/active_support/testing/assertions.rb @@ -167,7 +167,7 @@ module ActiveSupport retval end - # Assertion that the result of evaluating an expression is changed before + # Assertion that the result of evaluating an expression is not changed before # and after invoking the passed in block. # # assert_no_changes 'Status.all_good?' do
Add missing "not" in the doc for `assert_no_changes` [ci skip]
rails_rails
train
rb
5cf2f99ba1fb1b9f106f77bdfc759779937e1402
diff --git a/salt/config/__init__.py b/salt/config/__init__.py index <HASH>..<HASH> 100644 --- a/salt/config/__init__.py +++ b/salt/config/__init__.py @@ -73,6 +73,10 @@ if salt.utils.platform.is_windows(): _MASTER_USER = "SYSTEM" elif salt.utils.platform.is_proxy(): _DFLT_FQDNS_GRAINS = False + _DFLT_IPC_MODE = "ipc" + _DFLT_FQDNS_GRAINS = True + _MASTER_TRIES = 1 + _MASTER_USER = salt.utils.user.get_user() else: _DFLT_IPC_MODE = "ipc" _DFLT_FQDNS_GRAINS = True
Need additional default opions for proxy minions.
saltstack_salt
train
py
115ab2e3db4bd9b94f4953a6099361dda53830c0
diff --git a/cli_helpers/tabular_output/output_formatter.py b/cli_helpers/tabular_output/output_formatter.py index <HASH>..<HASH> 100644 --- a/cli_helpers/tabular_output/output_formatter.py +++ b/cli_helpers/tabular_output/output_formatter.py @@ -2,6 +2,7 @@ """A generic tabular data output formatter interface.""" from __future__ import unicode_literals +from six import text_type from collections import namedtuple from cli_helpers.compat import (text_type, binary_type, int_types, float_types, @@ -102,7 +103,7 @@ class TabularOutputFormatter(object): @property def supported_formats(self): """The names of the supported output formats in a :class:`tuple`.""" - return tuple(self._output_formats.keys()) + return tuple(map(text_type, self._output_formats.keys())) @classmethod def register_new_formatter(cls, format_name, handler, preprocessors=(),
Return the supported formats as a list of unicode strings.
dbcli_cli_helpers
train
py
3f3e57a737c617094c38af6453d8ce89dafed939
diff --git a/merge.go b/merge.go index <HASH>..<HASH> 100644 --- a/merge.go +++ b/merge.go @@ -267,8 +267,8 @@ func deepMerge(dstIn, src reflect.Value, visited map[uintptr]*visit, depth int, return } default: - overwriteFull := (!isEmptyValue(src) || overwriteWithEmptySrc) && (overwrite || isEmptyValue(dst)) - if overwriteFull { + mustSet := (!isEmptyValue(src) || overwriteWithEmptySrc) && (overwrite || isEmptyValue(dst)) + if mustSet { if dst.CanSet() { dst.Set(src) } else {
Improved name for the final condition to set
imdario_mergo
train
go
b58a2bc75456cc1dc904c86e6a741c0aa02e3dfa
diff --git a/aeron-common/src/main/java/uk/co/real_logic/aeron/util/concurrent/logbuffer/LogBuffer.java b/aeron-common/src/main/java/uk/co/real_logic/aeron/util/concurrent/logbuffer/LogBuffer.java index <HASH>..<HASH> 100644 --- a/aeron-common/src/main/java/uk/co/real_logic/aeron/util/concurrent/logbuffer/LogBuffer.java +++ b/aeron-common/src/main/java/uk/co/real_logic/aeron/util/concurrent/logbuffer/LogBuffer.java @@ -75,6 +75,7 @@ public class LogBuffer { logBuffer.setMemory(0, logBuffer.capacity(), (byte)0); stateBuffer.setMemory(0, stateBuffer.capacity(), (byte)0); + statusOrdered(CLEAN); } /**
[Java:] Ensure cleaning writes are ordered.
real-logic_aeron
train
java
2b771a885d9b3aae1b1329601166b4923d48f790
diff --git a/fuel/utils.py b/fuel/utils.py index <HASH>..<HASH> 100644 --- a/fuel/utils.py +++ b/fuel/utils.py @@ -1,7 +1,10 @@ import collections +import os import six +from fuel import config + # See http://python3porting.com/differences.html#buffer if six.PY3: @@ -10,6 +13,32 @@ else: buffer_ = buffer # noqa +def find_in_data_path(filename): + """Searches for a file within Fuel's data path. + + This function loops over all paths defined in Fuel's data path and + returns the first path in which the file is found. + + Returns + ------- + file_path : str + Path to the first file matching `filename` found in Fuel's + data path. + + Raises + ------ + IOError + If the file doesn't appear in Fuel's data path. + + """ + for path in config.data_path.split(os.path.pathsep): + path = os.path.expanduser(os.path.expandvars(path)) + file_path = os.path.join(path, filename) + if os.path.isfile(file_path): + return file_path + raise IOError("{} not found in Fuel's data path".format(filename)) + + def lazy_property_factory(lazy_property): """Create properties that perform lazy loading of attributes.""" def lazy_property_getter(self):
Make fuel.config.data_path accept multiple directories
mila-iqia_fuel
train
py
4c2b8797f6a5d820b356c2e34c206b1e2f0719e8
diff --git a/rflink/protocol.py b/rflink/protocol.py index <HASH>..<HASH> 100644 --- a/rflink/protocol.py +++ b/rflink/protocol.py @@ -151,7 +151,7 @@ class PacketHandling(ProtocolBase): try: packet = decode_packet(raw_packet) except BaseException: - log.exception("failed to parse packet: %s", packet) + log.exception("failed to parse packet data: %s", raw_packet) log.debug("decoded packet: %s", packet)
Improve debugging of failed packet parse
aequitas_python-rflink
train
py
bf834e6b8ef97f06904ea18b94d0fb92315a4737
diff --git a/lib/OpenLayers/Renderer/Canvas.js b/lib/OpenLayers/Renderer/Canvas.js index <HASH>..<HASH> 100644 --- a/lib/OpenLayers/Renderer/Canvas.js +++ b/lib/OpenLayers/Renderer/Canvas.js @@ -789,7 +789,7 @@ OpenLayers.Renderer.Canvas = OpenLayers.Class(OpenLayers.Renderer, { var featureId, feature; // if the drawing canvas isn't visible, return undefined. - if (this.root.style.display === "none") return feature; + if (this.root.style.display === "none") { return feature; } if (this.hitDetection) { // this dragging check should go in the feature handler
being a good coder and adding braces around if statement body
openlayers_openlayers
train
js
3c87414b01b5f39d985f8d04154f50b6130a797a
diff --git a/src/utils/test.js b/src/utils/test.js index <HASH>..<HASH> 100644 --- a/src/utils/test.js +++ b/src/utils/test.js @@ -256,6 +256,19 @@ describe('graphology-utils', function () { assert.strictEqual(newGraph.edge(1, 2), 'rel1'); assert.strictEqual(newGraph.edge(2, 3), 'rel2'); }); + + it.skip('should work with undirected graphs.', function () { + var graph = new Graph({type: 'undirected'}); + graph.mergeEdge('Jon', 'Ishtar'); + graph.mergeEdge('Julia', 'Robin'); + + var newGraph = renameGraphKeys(graph, { + Jon: 'Joseph', + Ishtar: 'Quixal' + }); + + console.log(newGraph); + }); }); describe('updateGraphKeys', function () {
Adding unit test related to #<I>
graphology_graphology
train
js
6d60911f42138af122bddf6565d9a3bcab934254
diff --git a/dhcpcanon/timers.py b/dhcpcanon/timers.py index <HASH>..<HASH> 100644 --- a/dhcpcanon/timers.py +++ b/dhcpcanon/timers.py @@ -9,8 +9,8 @@ import random from pytz import utc from datetime import datetime, timedelta -from constants import MAX_DELAY_SELECTING, RENEW_PERC, REBIND_PERC -from constants import DT_PRINT_FORMAT +from .constants import MAX_DELAY_SELECTING, RENEW_PERC, REBIND_PERC +from .constants import DT_PRINT_FORMAT logger = logging.getLogger(__name__) diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -20,12 +20,11 @@ setup( url=dhcpcanon.__website__, packages=find_packages(exclude=['contrib', 'docs', 'tests*']), install_requires=[ - "scapy>=2.2", + 'scapy>=2.2";python_version<="2.7"', + 'scapy-python3>=0.21;python_version>="3.4"', "netaddr>=0.7", - "ipaddr>=2.1", "pytz>=2016.6", "pip>=8.1", - "pyroute2>=0.4", "attrs>=16.3", "daemon>=1.1" ],
Remove not used dependencies and modify imports for python 3
juga0_dhcpcanon
train
py,py
c591c48ba0349767f223f45c38696eae21188fad
diff --git a/dictobj.py b/dictobj.py index <HASH>..<HASH> 100644 --- a/dictobj.py +++ b/dictobj.py @@ -143,6 +143,8 @@ class DictionaryObject(object): if -1 == val: if self._defaultIsSet: if rhs._defaultIsSet: + if self._defaultValue is None and rhs._defaultValue is None: + return True return -1 == cmp(self._defaultValue, rhs._defaultValue) else: return False
Fix comparison tests when both default values are None.
grimwm_py-dictobj
train
py
bdc93b7e02e30c796140642ecac865c4e5d44d7d
diff --git a/lib/discordrb/data.rb b/lib/discordrb/data.rb index <HASH>..<HASH> 100644 --- a/lib/discordrb/data.rb +++ b/lib/discordrb/data.rb @@ -319,19 +319,15 @@ module Discordrb # @return [true, false] whether this member is muted server-wide. attr_reader :mute - alias_method :muted?, :mute # @return [true, false] whether this member is deafened server-wide. attr_reader :deaf - alias_method :deafened?, :deaf # @return [true, false] whether this member has muted themselves. attr_reader :self_mute - alias_method :self_muted?, :self_mute # @return [true, false] whether this member has deafened themselves. attr_reader :self_deaf - alias_method :self_deafened?, :self_deaf def initialize(user_id) @user_id = user_id
Remove the mute/deaf aliases from VoiceState as they're only marginally useful there
meew0_discordrb
train
rb
e9de4fde81daee698b8f1aecdfce3198f5acaa6d
diff --git a/salt/modules/win_system.py b/salt/modules/win_system.py index <HASH>..<HASH> 100644 --- a/salt/modules/win_system.py +++ b/salt/modules/win_system.py @@ -207,6 +207,8 @@ def set_computer_desc(desc): __salt__['cmd.run'](cmd) return {'Computer Description': get_computer_desc()} +set_computer_description = set_computer_desc + def get_computer_desc(): '''
Alias set_computer_description to set_computer_desc
saltstack_salt
train
py
d583bff0fcd79b24f5dc4dcc0f0d505f59ac64ba
diff --git a/lib/questionlib.php b/lib/questionlib.php index <HASH>..<HASH> 100644 --- a/lib/questionlib.php +++ b/lib/questionlib.php @@ -1926,9 +1926,6 @@ function question_format_grade($cmoptions, $grade) { */ function question_init_qenginejs_script() { global $CFG; - - // Get the properties we want into a PHP array first, becase that is easier - // to build. $config = array( 'pixpath' => $CFG->pixpath, 'wwwroot' => $CFG->wwwroot, @@ -1937,16 +1934,7 @@ function question_init_qenginejs_script() { 'flaggedalt' => get_string('flagged', 'question'), 'unflaggedalt' => get_string('notflagged', 'question'), ); - - // Then generate the script tag. - $lines = array(); - foreach ($config as $property => $value) { - $lines[] = ' ' . $property . ': "' . addslashes_js($value) . '"'; - } - $script = '<script type="text/javascript">qengine_config = {' . "\n" . - implode(",\n", $lines) . - "\n};</script>\n"; - return $script; + return print_js_config($config, 'qengine_config', true); } /// FUNCTIONS THAT SIMPLY WRAP QUESTIONTYPE METHODS //////////////////////////////////
Update to use print_js_config.
moodle_moodle
train
php
a71ecf2b6b3ee371b9778bff62a36d7180292455
diff --git a/lib/lita/adapters/shell.rb b/lib/lita/adapters/shell.rb index <HASH>..<HASH> 100644 --- a/lib/lita/adapters/shell.rb +++ b/lib/lita/adapters/shell.rb @@ -2,6 +2,7 @@ module Lita module Adapters class Shell < Adapter def run + puts 'Type "exit" or "quit" to end the session.' loop do print "#{robot.name} > " input = gets.chomp.strip diff --git a/spec/lita/adapters/shell_spec.rb b/spec/lita/adapters/shell_spec.rb index <HASH>..<HASH> 100644 --- a/spec/lita/adapters/shell_spec.rb +++ b/spec/lita/adapters/shell_spec.rb @@ -8,6 +8,8 @@ describe Lita::Adapters::Shell do subject { described_class.new(robot) } describe "#run" do + before { allow(subject).to receive(:puts) } + it "passes input to the Robot and breaks on an exit message" do expect(subject).to receive(:print).with("#{robot.name} > ").twice allow(subject).to receive(:gets).and_return("foo", "exit")
Add an opening message to the Shell session.
litaio_lita
train
rb,rb
275626be9f7ff61bb026058e4cfa4673118c977a
diff --git a/lib/transforms/insertColumn.js b/lib/transforms/insertColumn.js index <HASH>..<HASH> 100644 --- a/lib/transforms/insertColumn.js +++ b/lib/transforms/insertColumn.js @@ -1,4 +1,5 @@ const TablePosition = require('../TablePosition'); +const moveSelection = require('./moveSelection'); const createCell = require('../createCell'); /** @@ -38,8 +39,9 @@ function insertColumn(opts, transform, at) { }); // Replace the table - return transform - .setNodeByKey(table.key, newTable); + transform = transform.setNodeByKey(table.key, newTable); + // Update the selection (not doing can break the undo) + return moveSelection(opts, transform, pos.getColumnIndex() + 1, pos.getRowIndex()); } module.exports = insertColumn;
Fix undo of insertColumn when cursor is in inserted column
GitbookIO_slate-edit-table
train
js
b15c3aad94cd11784b4f9d423072d39a18631aba
diff --git a/code/libraries/koowa/components/com_activities/view/activities/json.php b/code/libraries/koowa/components/com_activities/view/activities/json.php index <HASH>..<HASH> 100644 --- a/code/libraries/koowa/components/com_activities/view/activities/json.php +++ b/code/libraries/koowa/components/com_activities/view/activities/json.php @@ -82,7 +82,7 @@ class ComActivitiesViewActivitiesJson extends KViewJson $item = array( 'id' => $activity->getActivityId(), - 'title' => $renderer->render($activity), + 'title' => $renderer->render($activity, array('escaped_urls' => false, 'fqr' => true)), 'story' => $renderer->render($activity, array('html' => false)), 'published' => $activity->getActivityPublished()->format('c'), 'verb' => $activity->getActivityVerb(),
re #<I> Ask for fully qualified routes.
joomlatools_joomlatools-framework
train
php
04beaf85d2d5425bcf214bb336d764c1c453098f
diff --git a/lib/cloud_providers/connections.rb b/lib/cloud_providers/connections.rb index <HASH>..<HASH> 100644 --- a/lib/cloud_providers/connections.rb +++ b/lib/cloud_providers/connections.rb @@ -88,7 +88,7 @@ module CloudProviders raise StandardError.new("You must pass a :source=>uri option to rsync") unless opts[:source] destination_path = opts[:destination] || opts[:source] rsync_opts = opts[:rsync_opts] || '-va' - rsync_opts += %q% --rsync-path="sudo rsync" % + rsync_opts += %q% --rsync-path="sudo rsync" --exclude=.svn --exclude=.git --exclude=.cvs % cmd_string = "rsync -L -e 'ssh #{ssh_options}' #{rsync_opts} #{opts[:source]} #{user}@#{host}:#{destination_path}" out = system_run(cmd_string) out
Added standard VCS files to rsync excludes to speed up transfer
auser_poolparty
train
rb
4e8061c7c4774da068c074bf51873ad4cd2dc776
diff --git a/Kwf_js/Form/ComboBox.js b/Kwf_js/Form/ComboBox.js index <HASH>..<HASH> 100644 --- a/Kwf_js/Form/ComboBox.js +++ b/Kwf_js/Form/ComboBox.js @@ -73,6 +73,9 @@ Kwf.Form.ComboBox = Ext.extend(Ext.form.ComboBox, reader: reader }; Ext.apply(storeConfig, this.storeConfig); + if (typeof storeConfig.remoteSort == 'undefined') { + storeConfig.remoteSort = proxy instanceof Ext.data.HttpProxy; + } if (store.type && Ext.data[store.type]) { this.store = new Ext.data[store.type](storeConfig); } else if (store.type) {
set remoteSort for store when using httpProxy this is required for SuperBoxSelect so it doesn't sort locally
koala-framework_koala-framework
train
js
1b21a84f7430deaeeed4ee1c1e299a051a389a3d
diff --git a/lib/Doctrine/DBAL/Platforms/SQLServer2008Platform.php b/lib/Doctrine/DBAL/Platforms/SQLServer2008Platform.php index <HASH>..<HASH> 100644 --- a/lib/Doctrine/DBAL/Platforms/SQLServer2008Platform.php +++ b/lib/Doctrine/DBAL/Platforms/SQLServer2008Platform.php @@ -116,4 +116,9 @@ class SQLServer2008Platform extends SQLServer2005Platform { return Keywords\SQLServer2008Keywords::class; } + + protected function getLikeWildcardCharacters() : iterable + { + return array_merge(parent::getLikeWildcardCharacters(), ['[', ']', '^']); + } }
Add more meta-characters for some MS platforms The docs only talk about <I> and up, not sure if those should be added to <I> too.
doctrine_dbal
train
php
3261e41b3d16e0f5dad4045485edd1c2b0abd5c1
diff --git a/activesupport/lib/active_support/security_utils.rb b/activesupport/lib/active_support/security_utils.rb index <HASH>..<HASH> 100644 --- a/activesupport/lib/active_support/security_utils.rb +++ b/activesupport/lib/active_support/security_utils.rb @@ -19,12 +19,14 @@ module ActiveSupport end module_function :fixed_length_secure_compare - # Constant time string comparison, for variable length strings. + # Secure string comparison for strings of variable length. # - # The values are first processed by SHA256, so that we don't leak length info - # via timing attacks. + # While a timing attack would not be able to discern the content of + # a secret compared via secure_compare, it is possible to determine + # the secret length. This should be considered when using secure_compare + # to compare weak, short secrets to user input. def secure_compare(a, b) - fixed_length_secure_compare(::Digest::SHA256.digest(a), ::Digest::SHA256.digest(b)) && a == b + a.length == b.length && fixed_length_secure_compare(a, b) end module_function :secure_compare end
Remove hashing from secure_compare and clarify documentation
rails_rails
train
rb
b8f62c1cdc6566252ae70696ee9d93deebb7116b
diff --git a/lib/chef/knife/ssh.rb b/lib/chef/knife/ssh.rb index <HASH>..<HASH> 100644 --- a/lib/chef/knife/ssh.rb +++ b/lib/chef/knife/ssh.rb @@ -560,6 +560,11 @@ class Chef config[:ssh_password] = get_stripped_unfrozen_value(ssh_password || Chef::Config[:knife][:ssh_password]) end + + # CHEF-4342 Diable host key verification if a password has been given. + if config[:ssh_password] + config[:host_key_verify] = false + end end def configure_ssh_identity_file
Fix "knife ssh" authentication scheme #<I> Affects at least knife <I> When a user uses knife ssh in "password, not key" mode, it fails.
chef_chef
train
rb
03e61e0a1f471dd8fba1982caa92cd937e588289
diff --git a/visidata/loaders/json.py b/visidata/loaders/json.py index <HASH>..<HASH> 100644 --- a/visidata/loaders/json.py +++ b/visidata/loaders/json.py @@ -45,16 +45,20 @@ class JSONSheet(Sheet): with self.source.open_text() as fp: self.rows = [] for L in fp: - self.addRow(json.loads(L)) + try: + self.addRow(json.loads(L)) + except Exception as e: + pass # self.addRow(e) def addRow(self, row, index=None): super().addRow(row, index=index) - for k in row: - if k not in self.colnames: - c = ColumnItem(k, type=deduceType(row[k])) - self.colnames[k] = c - self.addColumn(c) - return row + if isinstance(row, dict): + for k in row: + if k not in self.colnames: + c = ColumnItem(k, type=deduceType(row[k])) + self.colnames[k] = c + self.addColumn(c) + return row def newRow(self): return {}
[json] make loader more robust
saulpw_visidata
train
py
a3e3bedfef879e5e8659e78ae06cbca22d53beba
diff --git a/flink-yarn/src/main/java/org/apache/flink/yarn/Utils.java b/flink-yarn/src/main/java/org/apache/flink/yarn/Utils.java index <HASH>..<HASH> 100644 --- a/flink-yarn/src/main/java/org/apache/flink/yarn/Utils.java +++ b/flink-yarn/src/main/java/org/apache/flink/yarn/Utils.java @@ -156,7 +156,7 @@ public final class Utils { Path dst = new Path(homedir, suffix); - LOG.debug("Copying from " + localSrcPath + " to " + dst); + LOG.debug("Copying from {} to {}", localSrcPath, dst); fs.copyFromLocalFile(false, true, localSrcPath, dst);
[hotfix] Replace String concatenation with Slf4j placeholders.
apache_flink
train
java
67458b39db3779611226fac3de38a1fd6020b247
diff --git a/library/CM/SmartyPlugins/function.resource.php b/library/CM/SmartyPlugins/function.resource.php index <HASH>..<HASH> 100644 --- a/library/CM/SmartyPlugins/function.resource.php +++ b/library/CM/SmartyPlugins/function.resource.php @@ -34,7 +34,7 @@ function smarty_helper_resource_internal(CM_Render $render) { // Sorts all classes according to inheritance order, pairs them with path $phpClasses = CM_View_Abstract::getClasses($render->getSite()->getNamespaces(), CM_View_Abstract::CONTEXT_JAVASCRIPT); foreach ($phpClasses as $path => $className) { - $path = str_replace(DIR_ROOT, '', $path); + $path = str_replace(DIR_ROOT, '/', $path); $path = str_replace(DIRECTORY_SEPARATOR, '/', $path); $paths[] = preg_replace('#\.php$#', '.js', $path); }
Fix: Dev resource paths should be absolute
cargomedia_cm
train
php
ca2c2caf8c6ed825ba9f283d7ac60653652e9d78
diff --git a/examples/nexrad/nexrad_copy.py b/examples/nexrad/nexrad_copy.py index <HASH>..<HASH> 100644 --- a/examples/nexrad/nexrad_copy.py +++ b/examples/nexrad/nexrad_copy.py @@ -106,7 +106,7 @@ logger.info('ref_data.shape: {}'.format(ref_data.shape)) # https://stackoverflow.com/questions/7222382/get-lat-long-given-current-point-distance-and-bearing def offset_by_meters(lat, lon, dist, bearing): R = 6378.1 - bearing_rads = np.deg2rad(az)[:, None] + bearing_rads = np.deg2rad(bearing)[:, None] dist_km = dist / 1000.0 lat1 = np.radians(lat)
Use bearing function parameter instead of az The function was working by coincidence but it was using a global variable. Fix it by using the parameter `bearing` passed to it. Thanks to Goizueta, the reviewer :)
CartoDB_carto-python
train
py
f9bae4e6b4e807044443c6b11014d0af08893088
diff --git a/src/jpa-engine/core/src/test/java/com/impetus/kundera/utils/LuceneCleanupUtilities.java b/src/jpa-engine/core/src/test/java/com/impetus/kundera/utils/LuceneCleanupUtilities.java index <HASH>..<HASH> 100644 --- a/src/jpa-engine/core/src/test/java/com/impetus/kundera/utils/LuceneCleanupUtilities.java +++ b/src/jpa-engine/core/src/test/java/com/impetus/kundera/utils/LuceneCleanupUtilities.java @@ -53,10 +53,14 @@ public class LuceneCleanupUtilities { for (File file : files) { - // Delete each file - if (!file.delete()) - { - } + if(file.isDirectory() && !(file.list().length==0)){ + + cleanDir(file.getPath()); + file.delete(); + }else{ + file.delete(); + } + } } }
for recursively cleaning the directory
Impetus_Kundera
train
java
adbbac630edf7c3841e8cadbef2077637457243c
diff --git a/icekit/utils/testing.py b/icekit/utils/testing.py index <HASH>..<HASH> 100644 --- a/icekit/utils/testing.py +++ b/icekit/utils/testing.py @@ -4,11 +4,13 @@ import os import uuid from django.conf import settings +from nose.tools import nottest from PIL import Image, ImageDraw +@nottest @contextlib.contextmanager -def get_sample_image(storage): +def get_test_image(storage): """ Context manager that creates an image with the given storage class, returns a storage name, and cleans up (including thumbnails) when done. diff --git a/icekit/utils/tests.py b/icekit/utils/tests.py index <HASH>..<HASH> 100644 --- a/icekit/utils/tests.py +++ b/icekit/utils/tests.py @@ -5,15 +5,15 @@ from django.conf import settings from django_dynamic_fixture import G from django_webtest import WebTest -from icekit.utils.testing import get_sample_image +from icekit.utils import testing from icekit.tests.models import ImageTest class TestingUtils(WebTest): - def test_get_sample_image(self): + def test_get_test_image(self): image_test = G(ImageTest) - with get_sample_image(image_test.image.storage) as image_name: + with testing.get_test_image(image_test.image.storage) as image_name: # Check that the image was created. image_test.image = image_name self.assertTrue(os.path.exists(image_test.image.path))
Rename `get_sample_image()` to `get_test_image()` and tell Nose it is not a test.
ic-labs_django-icekit
train
py,py
bfe3e3346e264a2e6df5815491de396c642c05ff
diff --git a/commands/commands.go b/commands/commands.go index <HASH>..<HASH> 100644 --- a/commands/commands.go +++ b/commands/commands.go @@ -86,6 +86,7 @@ func (c *Command) Usage() { func (c *Command) Parse() { core.SetupDebugging(c.FlagSet) + c.FlagSet.SetOutput(core.ErrorWriter) c.FlagSet.Parse(c.Args) }
FlagSet errors should go to the panic log too
git-lfs_git-lfs
train
go
93c550ef65ebd2e6f0a4109103f1ceba057ddb87
diff --git a/msaf/run.py b/msaf/run.py index <HASH>..<HASH> 100644 --- a/msaf/run.py +++ b/msaf/run.py @@ -355,9 +355,9 @@ def process(in_path, annot_beats=False, feature="pcp", framesync=False, # TODO: Only save if needed # Save estimations - # msaf.utils.ensure_dir(os.path.dirname(file_struct.est_file)) - # io.save_estimations(file_struct, est_times, est_labels, - # boundaries_id, labels_id, **config) + msaf.utils.ensure_dir(os.path.dirname(file_struct.est_file)) + io.save_estimations(file_struct, est_times, est_labels, + boundaries_id, labels_id, **config) return est_times, est_labels else:
Single file process saves estimations This commented lines produced this issue <URL>
urinieto_msaf
train
py
b34880fee0949707a1823d6d65b2f5192ac7b459
diff --git a/base.php b/base.php index <HASH>..<HASH> 100644 --- a/base.php +++ b/base.php @@ -1143,7 +1143,7 @@ final class Base { foreach (str_split($body,1024) as $part) { // Throttle output $ctr++; - if ($ctr/$kbps>$elapsed=microtime(TRUE)-$now && + if ($ctr/$kbps>($elapsed=microtime(TRUE)-$now) && !connection_aborted()) usleep(1e6*($ctr/$kbps-$elapsed)); echo $part;
Bug fix: Calculation of elapsed time
bcosca_fatfree-core
train
php
52a4327769d50f15e73b0f871df0cb1d676a6f3b
diff --git a/telethon/sessions/memory.py b/telethon/sessions/memory.py index <HASH>..<HASH> 100644 --- a/telethon/sessions/memory.py +++ b/telethon/sessions/memory.py @@ -228,7 +228,7 @@ class MemorySession(Session): def cache_file(self, md5_digest, file_size, instance): if not isinstance(instance, (InputDocument, InputPhoto)): raise TypeError('Cannot cache %s instance' % type(instance)) - key = (md5_digest, file_size, _SentFileType.from_type(instance)) + key = (md5_digest, file_size, _SentFileType.from_type(type(instance))) value = (instance.id, instance.access_hash) self._files[key] = value
Fix MemorySession file caching
LonamiWebs_Telethon
train
py
30a02eded010c222f9e7e6430955f5fb5c190207
diff --git a/vault/testing.go b/vault/testing.go index <HASH>..<HASH> 100644 --- a/vault/testing.go +++ b/vault/testing.go @@ -790,7 +790,6 @@ func TestCluster(t testing.TB, handlers []http.Handler, base *CoreConfig, unseal if err != nil { t.Fatalf("err: %v", err) } - c1.redirectAddr = coreConfig.RedirectAddr coreConfig.RedirectAddr = fmt.Sprintf("https://127.0.0.1:%d", c2lns[0].Address.Port) if coreConfig.ClusterAddr != "" { @@ -800,7 +799,6 @@ func TestCluster(t testing.TB, handlers []http.Handler, base *CoreConfig, unseal if err != nil { t.Fatalf("err: %v", err) } - c2.redirectAddr = coreConfig.RedirectAddr coreConfig.RedirectAddr = fmt.Sprintf("https://127.0.0.1:%d", c3lns[0].Address.Port) if coreConfig.ClusterAddr != "" { @@ -810,7 +808,6 @@ func TestCluster(t testing.TB, handlers []http.Handler, base *CoreConfig, unseal if err != nil { t.Fatalf("err: %v", err) } - c2.redirectAddr = coreConfig.RedirectAddr // // Clustering setup
Don't need to explictly set redirectAddrs
hashicorp_vault
train
go
3b5cc7c1f600ed0b8b59b877a734ca8f8f34eb72
diff --git a/lib/get/onValue.js b/lib/get/onValue.js index <HASH>..<HASH> 100644 --- a/lib/get/onValue.js +++ b/lib/get/onValue.js @@ -36,7 +36,7 @@ module.exports = function onValue(model, node, seedOrFunction, outerResults, per } else if (outputFormat === "JSONG") { - if (typeof node.value === "object") { + if (node.value && typeof node.value === "object") { valueNode = clone(node); } else { valueNode = node.value;
made it so null is not output as an atom.
Netflix_falcor
train
js
0d585f8a425472494af48ffae8adbb785fa0d136
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -12,7 +12,7 @@ if sys.version_info <= (3, 1): setup( name="ss", - version="1.5.1", + version="1.5.2", packages=[], scripts=['ss.py'], py_modules=['ss'], diff --git a/ss.py b/ss.py index <HASH>..<HASH> 100644 --- a/ss.py +++ b/ss.py @@ -18,7 +18,7 @@ import guessit init(autoreset=True) -__version__ = '1.5.0' +__version__ = '1.5.2' if sys.version_info[0] == 3: # pragma: no cover from urllib.request import urlopen
Bumping version to <I> Fixes #<I>
nicoddemus_ss
train
py,py
fc95adb51637b5965225a08e18068e31431cb892
diff --git a/runtime/API.js b/runtime/API.js index <HASH>..<HASH> 100644 --- a/runtime/API.js +++ b/runtime/API.js @@ -137,6 +137,8 @@ function buildClass(base, def) { this._es6now = { + version: "0.7.1", + class: buildClass, // Support for iterator protocol diff --git a/src/NodeRun.js b/src/NodeRun.js index <HASH>..<HASH> 100644 --- a/src/NodeRun.js +++ b/src/NodeRun.js @@ -104,6 +104,8 @@ export function startREPL() { addExtension(); + console.log(`es6now ${ _es6now.version } (Node ${ process.version })`); + // Provide a way to load a module from the REPL global.loadModule = path => __load(global.require.resolve(path)); diff --git a/src/Runtime.js b/src/Runtime.js index <HASH>..<HASH> 100644 --- a/src/Runtime.js +++ b/src/Runtime.js @@ -141,6 +141,8 @@ function buildClass(base, def) { this._es6now = { + version: "0.7.1", + class: buildClass, // Support for iterator protocol
Output the version of es6now and Node when we start the REPL.
zenparsing_esdown
train
js,js,js
c892b531089b262b41efb8c3b38e9ecd0d44025a
diff --git a/course/report.php b/course/report.php index <HASH>..<HASH> 100644 --- a/course/report.php +++ b/course/report.php @@ -21,7 +21,7 @@ $navigation = build_navigation($navlinks); print_header($course->fullname.': '.$strreports, $course->fullname.': '.$strreports, $navigation); - $reports = get_plugin_list('report'); + $reports = get_plugin_list('coursereport'); foreach ($reports as $report => $reportdirectory) { $pluginfile = $reportdirectory.'/mod.php';
course-reports MDL-<I> Fixed broken reports, changed plugin list type to coursereport
moodle_moodle
train
php
04cc98a3fb891bcd33c18f7ed8b8ed238254a81e
diff --git a/components/select-ng/select-ng__lazy.js b/components/select-ng/select-ng__lazy.js index <HASH>..<HASH> 100644 --- a/components/select-ng/select-ng__lazy.js +++ b/components/select-ng/select-ng__lazy.js @@ -38,11 +38,11 @@ class SelectLazy { } attachEvents() { - this.container.addEventListener('click', this.onClick, {capture: true, once: true}); + this.container.addEventListener('click', this.onClick, {capture: true}); } detachEvents() { - this.container.removeEventListener('click', this.onClick); + this.container.removeEventListener('click', this.onClick, {capture: true}); } render(props) {
RG-<I> use {capture: true} for removeEventListener too
JetBrains_ring-ui
train
js
53b24ff9bee3631fb76e7b7d5fedf134b68c50a4
diff --git a/src/Extensions/BlockArchiveExtension.php b/src/Extensions/BlockArchiveExtension.php index <HASH>..<HASH> 100644 --- a/src/Extensions/BlockArchiveExtension.php +++ b/src/Extensions/BlockArchiveExtension.php @@ -48,7 +48,7 @@ class BlockArchiveExtension extends DataExtension implements ArchiveViewProvider 'Breadcrumbs' => function ($val, $item) { $parent = $item->Page; - return $parent ? $parent->Breadcrumbs() : null; + return ($parent && $parent->hasMethod('Breadcrumbs')) ? $parent->Breadcrumbs() : null; }, 'allVersions.first.LastEdited' => function ($val, $item) { return DBDatetime::create_field('Datetime', $val)->Ago();
FIX Prevent exception when parent does not have breadcrumbs
silverstripe_silverstripe-versioned-admin
train
php
402a506881ddd7484766f21704174e85b0991414
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -17,7 +17,8 @@ install_requires = [ # List your project dependencies here. # For more details, see: # http://packages.python.org/distribute/setuptools.html#declaring-dependencies - "enum", "lxml", "networkx", "pygraphviz" + "enum", "lxml", "networkx", "pygraphviz", + "brewer2mpl", "unidecode" ]
added missing packages to setup.py
arne-cl_discoursegraphs
train
py
8069b7a7abd37ad7040c251087f432d610bc51bb
diff --git a/lib/monologue/engine.rb b/lib/monologue/engine.rb index <HASH>..<HASH> 100644 --- a/lib/monologue/engine.rb +++ b/lib/monologue/engine.rb @@ -15,7 +15,7 @@ module Monologue config.generators.fixture_replacement :factory_girl config.generators.integration_tool :rspec - initializer "monologue.assets.precompile" do |app| + initializer 'monologue.assets.precompile' do |app| app.config.assets.paths << Rails.root.join('vendor', 'assets', 'fonts') app.config.assets.precompile += %w[ monologue/admin/ckeditor-config.js @@ -23,7 +23,7 @@ module Monologue ] end - initializer "monologue.configuration", :before => :load_config_initializers do |app| + initializer 'monologue.configuration', :before => :load_config_initializers do |app| app.config.monologue = Monologue::Configuration.new Monologue::Config = app.config.monologue end
Fixes #<I>. small refactoring
jipiboily_monologue
train
rb
9288fe3dcb99474e7094e6f8e1b0e9fcee52e011
diff --git a/src/Jira/Api/Client/CurlClient.php b/src/Jira/Api/Client/CurlClient.php index <HASH>..<HASH> 100644 --- a/src/Jira/Api/Client/CurlClient.php +++ b/src/Jira/Api/Client/CurlClient.php @@ -90,6 +90,7 @@ class CurlClient implements ClientInterface if ($method == 'POST') { curl_setopt($curl, CURLOPT_POST, 1); if ($isFile) { + $data['file'] = $this->getCurlValue($data['file']); curl_setopt($curl, CURLOPT_POSTFIELDS, $data); } else { curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($data)); @@ -122,4 +123,19 @@ class CurlClient implements ClientInterface return $data; } + + /** + * If necessary, replace curl file @ string with a CURLFile object (for PHP 5.5 and up) + * + * @param string $fileString The string in @-format as it is used on PHP 5.4 and older. + * @return \CURLFile|string + */ + protected function getCurlValue($fileString) + { + if (!function_exists('curl_file_create')) { + return $fileString; + } + + return curl_file_create(substr($fileString, 1)); + } }
Fixing deprecated error when uploading file attachments in PHP <I>+
chobie_jira-api-restclient
train
php
f242229dd2b35b034a808efc4a5143c1b53d994a
diff --git a/php/commands/cron.php b/php/commands/cron.php index <HASH>..<HASH> 100644 --- a/php/commands/cron.php +++ b/php/commands/cron.php @@ -487,6 +487,13 @@ class Cron_Command extends WP_CLI_Command { /** * Test the WP Cron spawning system and report back its status. + * + * This command tests the spawning system by performing the following steps: + * * Checks to see if the `DISABLE_WP_CRON` constant is set; errors if true + * because WP-Cron is disabled. + * * Checks to see if the `ALTERNATE_WP_CRON` constant is set; warns if true + * * Attempts to spawn WP-Cron over HTTP; warns if non 200 response code is + * returned. */ public function test() {
Explain what `wp cron test` actually does
wp-cli_export-command
train
php
4fc8acbe3060d45d1cbe6675fb6ab87f06117f0f
diff --git a/lib/Rackem/Rack.php b/lib/Rackem/Rack.php index <HASH>..<HASH> 100644 --- a/lib/Rackem/Rack.php +++ b/lib/Rackem/Rack.php @@ -23,7 +23,7 @@ class Rack "rack.multithread" => false, "rack.multiprocess" => false, "rack.run_once" => false, - "rack.session" => &$_SESSION, + "rack.session" => array(), "rack.logger" => "" )); return new \ArrayObject($env);
don't bother with the $_SESSION global
tamagokun_rackem
train
php
dd22563dda75766adf49617f8c03178bacf5e17e
diff --git a/providers/oura/oura.go b/providers/oura/oura.go index <HASH>..<HASH> 100644 --- a/providers/oura/oura.go +++ b/providers/oura/oura.go @@ -131,13 +131,26 @@ func userFromReader(reader io.Reader, user *goth.User) error { return err } + rawData := make(map[string]interface{}) + + if u.Age != 0 { + rawData["age"] = u.Age + } + if u.Weight != 0 { + rawData["weight"] = u.Weight + } + if u.Height != 0 { + rawData["height"] = u.Height + } + if u.Gender != "" { + rawData["gender"] = u.Gender + } + user.UserID = u.UserID user.Email = u.Email - user.RawData = make(map[string]interface{}) - user.RawData["age"] = u.Age - user.RawData["weight"] = u.Weight - user.RawData["height"] = u.Height - user.RawData["gender"] = u.Gender + if len(rawData) > 0 { + user.RawData = rawData + } return err }
Update FetchUser to only fill populated fields in RawData
markbates_goth
train
go
35efcb140e2d93f69115f7dcf00fea2257d100d0
diff --git a/persistence/jdbc/src/main/java/org/infinispan/persistence/jdbc/table/management/OracleTableManager.java b/persistence/jdbc/src/main/java/org/infinispan/persistence/jdbc/table/management/OracleTableManager.java index <HASH>..<HASH> 100644 --- a/persistence/jdbc/src/main/java/org/infinispan/persistence/jdbc/table/management/OracleTableManager.java +++ b/persistence/jdbc/src/main/java/org/infinispan/persistence/jdbc/table/management/OracleTableManager.java @@ -83,6 +83,10 @@ class OracleTableManager extends AbstractTableManager { return indexName; } + protected String getDropTimestampSql() { + return String.format("DROP INDEX %s", getIndexName(true)); + } + @Override public String getInsertRowSql() { if (insertRowSql == null) {
ISPN-<I> Drop Index fails on Oracle DBs
infinispan_infinispan
train
java
86021126b1624b57eedd86f2e1c85f817c109448
diff --git a/src/views/ticket/_clientInfo.php b/src/views/ticket/_clientInfo.php index <HASH>..<HASH> 100644 --- a/src/views/ticket/_clientInfo.php +++ b/src/views/ticket/_clientInfo.php @@ -60,11 +60,14 @@ $this->registerCss(' <?= ClientGridView::detailView([ 'model' => $client, 'boxed' => false, - 'columns' => $client->login === 'anonym' ? ['name', 'email'] : [ - 'name', 'email', 'messengers', 'country', 'language', - 'state', 'balance', 'credit', - 'servers_spoiler', 'domains_spoiler', 'hosting', - ], + 'columns' => array_filter( + $client->login === 'anonym' ? ['name', 'email'] : [ + 'name', 'email', 'messengers', 'country', 'language', 'state', + Yii::$app->user->can('bill.read') ? 'balance' : null, + Yii::$app->user->can('bill.read') ? 'credit' : null, + 'servers_spoiler', 'domains_spoiler', 'hosting', + ] + ), ]) ?> <?php if ($client->login !== 'anonym') : ?>
hidden balance and credit if can not `bill.read`
hiqdev_hipanel-module-ticket
train
php
b6f7b690642f7b0940545164563f23ea766fcc71
diff --git a/src/Dingo/Api/Facades/API.php b/src/Dingo/Api/Facades/API.php index <HASH>..<HASH> 100644 --- a/src/Dingo/Api/Facades/API.php +++ b/src/Dingo/Api/Facades/API.php @@ -1,6 +1,7 @@ <?php namespace Dingo\Api\Facades; use Closure; +use Dingo\Api\Http\InternalRequest; use Illuminate\Support\Facades\Facade; /** @@ -37,4 +38,14 @@ class API extends Facade { return static::$app['dingo.api.authorization']->token($payload); } + /** + * Determine if a request is internal. + * + * @return bool + */ + public static function internal() + { + return static::$app['router']->getCurrentRequest() instanceof InternalRequest; + } + } \ No newline at end of file
Method to check if request is internal.
laravie_api
train
php
3904eaedc67446368715655992b1859f67f496a9
diff --git a/Controller/CRUDController.php b/Controller/CRUDController.php index <HASH>..<HASH> 100644 --- a/Controller/CRUDController.php +++ b/Controller/CRUDController.php @@ -391,8 +391,10 @@ class CRUDController extends Controller */ public function batchAction() { - if ($this->getRestMethod() != 'POST') { - throw new \RuntimeException('invalid request type, POST expected'); + $restMethod = $this->getRestMethod(); + + if ('POST' !== $restMethod) { + throw $this->createNotFoundException(sprintf('Invalid request type "%s", POST expected', $restMethod)); } // check the csrf token
Throw http not found exception instead of runtime Avoids a <I> server error.
sonata-project_SonataAdminBundle
train
php
5b8fd79e4af990369e53a9ff16bce309abbb6c41
diff --git a/functions/functions-twig.php b/functions/functions-twig.php index <HASH>..<HASH> 100644 --- a/functions/functions-twig.php +++ b/functions/functions-twig.php @@ -36,10 +36,17 @@ $twig->addFilter('wp_title', new Twig_Filter_Function('twig_wp_title')); $twig->addFilter('wp_sidebar', new Twig_Filter_Function('twig_wp_sidebar')); + $twig->addFilter('get_post_info', new Twig_Filter_Function('twig_get_post_info')); + $twig = apply_filters('get_twig', $twig); return $twig; } + function twig_get_post_info($id, $field = 'path'){ + $pi = PostMaster::get_post_info($id); + return $pi->$field; + } + function twig_wp_sidebar($arg){ get_sidebar($arg); }
added twig for get_post_info
timber_timber
train
php
2b09e37782ca7933220fda69787e5c83d9d8718c
diff --git a/lib/weblib.php b/lib/weblib.php index <HASH>..<HASH> 100644 --- a/lib/weblib.php +++ b/lib/weblib.php @@ -1605,13 +1605,20 @@ function obfuscate_text($plaintext) { $i=0; $length = strlen($plaintext); $obfuscated=""; + $prev_obfuscated = false; while ($i < $length) { - if (rand(0,2)) { + $c = ord($plaintext{$i}); + $numerical = ($c >= ord('0')) && ($c <= ord('9')); + if ($prev_obfuscated and $numerical ) { + $obfuscated.='&#'.ord($plaintext{$i}); + } else if (rand(0,2)) { $obfuscated.='&#'.ord($plaintext{$i}); + $prev_obfuscated = true; } else { $obfuscated.=$plaintext{$i}; + $prev_obfuscated = false; } - $i++; + $i++; } return $obfuscated; }
Fixes for obfuscate_text() when printing emails with numbers in them. (Patch from Zbigniew Fiedorowicz - thanks)
moodle_moodle
train
php
84200d11a7ad6d425a1c9f9322a25eeb16766308
diff --git a/lib/things/document.rb b/lib/things/document.rb index <HASH>..<HASH> 100644 --- a/lib/things/document.rb +++ b/lib/things/document.rb @@ -1,6 +1,6 @@ module Things class Document - DEFAULT_DATABASE_PATH = ENV['HOME'] + '/Library/Application Support/Cultured Code/Things/Database.xml' unless defined?(DEFAULT_DATABASE_PATH) + DEFAULT_DATABASE_PATH = "#{ENV['HOME']}/Library/Application Support/Cultured Code/Things/Database.xml" unless defined?(DEFAULT_DATABASE_PATH) attr_reader :database_file @@ -36,4 +36,4 @@ module Things @doc = Hpricot(IO.read(database_file)) end end -end \ No newline at end of file +end
Use interpolation for DEFAULT_DATABASE_PATH
haraldmartin_things-rb
train
rb
41903ee836b4a30db12da5d9e981374484ef6281
diff --git a/src/toil/test/jobStores/jobStoreTest.py b/src/toil/test/jobStores/jobStoreTest.py index <HASH>..<HASH> 100644 --- a/src/toil/test/jobStores/jobStoreTest.py +++ b/src/toil/test/jobStores/jobStoreTest.py @@ -1253,9 +1253,16 @@ class AWSJobStoreTest(AbstractJobStoreTest.Test): else: self.fail() finally: - for attempt in retry_s3(): - with attempt: - s3.delete_bucket(bucket=bucket) + try: + for attempt in retry_s3(): + with attempt: + s3.delete_bucket(bucket=bucket) + except boto.exception.S3ResponseError as e: + if e.error_code == 404: + # The bucket doesn't exist; maybe a failed delete actually succeeded. + pass + else: + raise @slow def testInlinedFiles(self):
Tolerate unnecessary bucket cleanup (#<I>)
DataBiosphere_toil
train
py
1c0b6c076a15516688df5c6474392fa8e79bb010
diff --git a/lib/Cake/Model/Behavior/TranslateBehavior.php b/lib/Cake/Model/Behavior/TranslateBehavior.php index <HASH>..<HASH> 100644 --- a/lib/Cake/Model/Behavior/TranslateBehavior.php +++ b/lib/Cake/Model/Behavior/TranslateBehavior.php @@ -392,6 +392,16 @@ class TranslateBehavior extends ModelBehavior { unset($this->runtime[$model->alias]['beforeValidate'], $this->runtime[$model->alias]['beforeSave']); $conditions = array('model' => $model->alias, 'foreign_key' => $model->id); $RuntimeModel = $this->translateModel($model); + + $fields = array_merge($this->settings[$model->alias], $this->runtime[$model->alias]['fields']); + if ($created) { + foreach ($fields as $field) { + if (!isset($tempData[$field])) { + //set the field value to an empty string + $tempData[$field] = ''; + } + } + } foreach ($tempData as $field => $value) { unset($conditions['content']);
Update afterSave to ensure created entires have all translated fields present Without all fields being present, find() will be unable to find the translated records. Fixes #<I>
cakephp_cakephp
train
php
886c6d6c5f0c137ff1d7faab4cd9e9926e1bd9c5
diff --git a/main.py b/main.py index <HASH>..<HASH> 100755 --- a/main.py +++ b/main.py @@ -62,6 +62,9 @@ class Node: continue attrib = getattr(self, attr) if attrib: + if isinstance(attrib, int): + # Check for enums + attrib = str(int(attrib)) element.attrib[attr] = attrib return element
Handle int attributes in serialization
HearthSim_python-hsreplay
train
py
04173b53d34ee377d1576ed6b7ee6684e2850dd4
diff --git a/cruddy/__init__.py b/cruddy/__init__.py index <HASH>..<HASH> 100644 --- a/cruddy/__init__.py +++ b/cruddy/__init__.py @@ -200,3 +200,18 @@ class CRUD(object): params = {'Key': {'id': id}} self._call_ddb_method(self.table.delete_item, params, response) return self._prepare_response(response) + + def handler(self, item, operation): + operation = operation.lower() + if operation == 'list': + response = self.list() + elif operation == 'get': + response = self.get(item['id']) + elif operation == 'create': + response = self.create(item) + elif operation == 'update': + response = self.update(item) + elif operation == 'delete': + response = self.delete(item['id']) + return response +
Add back the handler method. Still useful, I think.
Min-ops_cruddy
train
py
70dcfc73b0f57649cbe0663f1d058826ad8944d6
diff --git a/src/streamcorpus_pipeline/_tsv_files_list.py b/src/streamcorpus_pipeline/_tsv_files_list.py index <HASH>..<HASH> 100644 --- a/src/streamcorpus_pipeline/_tsv_files_list.py +++ b/src/streamcorpus_pipeline/_tsv_files_list.py @@ -151,7 +151,7 @@ class tsv_files_list(object): return stream_item if __name__ == '__main__': - ## this is a simple test of this extractor stage + ## this is a simple test of this reader stage import argparse parser = argparse.ArgumentParser() parser.add_argument(
renaming extractor --> reader one more (trivial)
trec-kba_streamcorpus-pipeline
train
py
f5db2a35c9c4313ae7edee65ede5a7de723056a2
diff --git a/packages/react-server-website/components/doc-contents.js b/packages/react-server-website/components/doc-contents.js index <HASH>..<HASH> 100644 --- a/packages/react-server-website/components/doc-contents.js +++ b/packages/react-server-website/components/doc-contents.js @@ -38,7 +38,7 @@ export default class DocContents extends React.Component { } componentDidMount() { - getCurrentRequestContext().navigator.on( "navigateStart", this.closeMenu.bind(this) ); + getCurrentRequestContext().navigator.on("loadComplete", this.closeMenu.bind(this)); } render() {
Close mobile doc menu on load complete (#<I>) This feels a little nicer. Waits to close the nav menu until the page has changed. Previously the nav menu was closed immediately, and then the page would change _after_.
redfin_react-server
train
js
a46fa66569d015dc5461c9f2c688f28919c1066c
diff --git a/lib/spout/version.rb b/lib/spout/version.rb index <HASH>..<HASH> 100644 --- a/lib/spout/version.rb +++ b/lib/spout/version.rb @@ -3,7 +3,7 @@ module Spout MAJOR = 0 MINOR = 1 TINY = 0 - BUILD = "pre" # nil, "pre", "rc", "rc2" + BUILD = "rc" # nil, "pre", "rc", "rc2" STRING = [MAJOR, MINOR, TINY, BUILD].compact.join('.') end
Version bump to <I>.rc
nsrr_spout
train
rb
5fe44ad84cdc9feccb312be86d5ca7e2ebf0375f
diff --git a/CHANGELOG.md b/CHANGELOG.md index <HASH>..<HASH> 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## [Unreleased] - unreleased +### Added +- `Service.close` method for freeing resources. ## [2] - 2015-11-15 diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -15,7 +15,7 @@ def long_desc(): setup( name='syndicate', - version='2', + version='2.1', description='A wrapper for REST APIs', author='Justin Mayfield', author_email='[email protected]', diff --git a/syndicate/client.py b/syndicate/client.py index <HASH>..<HASH> 100644 --- a/syndicate/client.py +++ b/syndicate/client.py @@ -49,6 +49,7 @@ class Service(object): async=False, **adapter_config): if not uri: raise TypeError("Required: uri") + self.closed = False self.async = async self.auth = auth self.filters = [] @@ -129,4 +130,9 @@ class Service(object): return self.do('patch', path, data=data, **kwargs) def close(self): - self.adapter.close() + if self.closed: + return + if self.adapter is not None: + self.adapter.close() + self.adapter = None + self.closed = True
Rev to <I> and add close() docs.
mayfield_syndicate
train
md,py,py
3f79e795596b43a2ee55ea506142dfab8e32d37f
diff --git a/lxd/container_lxc.go b/lxd/container_lxc.go index <HASH>..<HASH> 100644 --- a/lxd/container_lxc.go +++ b/lxd/container_lxc.go @@ -3480,7 +3480,6 @@ func (c *containerLXC) Delete() error { } // Update network files - networkUpdateStatic(c.state, "") for k, m := range c.expandedDevices { if m["type"] != "nic" || m["nictype"] != "bridged" { continue @@ -3515,6 +3514,11 @@ func (c *containerLXC) Delete() error { } } + if !c.IsSnapshot() { + // Remove any static lease file + networkUpdateStatic(c.state, "") + } + logger.Info("Deleted container", ctxMap) if c.IsSnapshot() {
lxd/containers: Properly clear static leases
lxc_lxd
train
go
80c58e8c1759a9004772c20e0a0760e10569398b
diff --git a/lib/producer.js b/lib/producer.js index <HASH>..<HASH> 100644 --- a/lib/producer.js +++ b/lib/producer.js @@ -75,7 +75,7 @@ function Producer(conf, topicConf) { this.globalConfig = conf; this.topicConfig = topicConf; this.defaultTopic = gTopic || null; - this.defaultPartition = gPart || null; + this.defaultPartition = gPart == null ? -1 : gPart; this.outstandingMessages = 0; this.sentMessages = 0; @@ -189,7 +189,7 @@ Producer.prototype.produceSync = function(msg) { this.sentMessages++; var topic = msg.topic || false; - var partition = msg.partition || this.defaultPartition; + var partition = msg.partition == null ? this.defaultPartition : msg.partition; if (!topic) { throw new TypeError('"topic" needs to be set');
Do null checking on partition instead of checking falsiness (#<I>)
Blizzard_node-rdkafka
train
js
558ce11125686b6761c6e316056ddd4c7aafab17
diff --git a/src/main/java/org/dbflute/mail/send/embedded/proofreader/SMailPmCommentProofreader.java b/src/main/java/org/dbflute/mail/send/embedded/proofreader/SMailPmCommentProofreader.java index <HASH>..<HASH> 100644 --- a/src/main/java/org/dbflute/mail/send/embedded/proofreader/SMailPmCommentProofreader.java +++ b/src/main/java/org/dbflute/mail/send/embedded/proofreader/SMailPmCommentProofreader.java @@ -73,6 +73,9 @@ public class SMailPmCommentProofreader implements SMailTextProofreader { // Line Adjustment // =============== protected String filterTemplateText(String templateText, Object pmb) { + // #for_now jflute pending, IF in FOR comment becomes empty line when false (2019/02/21) + // basically it may be unneeded because it should be structured in Java + // and modification is very difficult so pending, waiting for next request final String replaced = Srl.replace(templateText, CRLF, LF); final List<String> lineList = Srl.splitList(replaced, LF); final StringBuilder sb = new StringBuilder(templateText.length());
comment: IF in FOR comment becomes empty line when false
dbflute-session_mailflute
train
java
1e8d79676c5581714227de4c4c26dfdbc19d1f29
diff --git a/Framework/DoozR/Logger/Abstract.php b/Framework/DoozR/Logger/Abstract.php index <HASH>..<HASH> 100644 --- a/Framework/DoozR/Logger/Abstract.php +++ b/Framework/DoozR/Logger/Abstract.php @@ -622,7 +622,7 @@ abstract class DoozR_Logger_Abstract extends DoozR_Base_Class */ protected function generateFingerprint() { - return sha1(implode('', $_SERVER)); + return sha1(serialize($_SERVER)); } /**
hotfix: Bug in DoozR_Logger_Abstract
Doozer-Framework_Doozr
train
php
fcfb625e0c216cebe8ac841871888db8de78eed9
diff --git a/pmml-model/src/main/java/org/dmg/pmml/adapters/NodeAdapter.java b/pmml-model/src/main/java/org/dmg/pmml/adapters/NodeAdapter.java index <HASH>..<HASH> 100644 --- a/pmml-model/src/main/java/org/dmg/pmml/adapters/NodeAdapter.java +++ b/pmml-model/src/main/java/org/dmg/pmml/adapters/NodeAdapter.java @@ -26,7 +26,7 @@ public class NodeAdapter extends XmlAdapter<ComplexNode, Node> { return nodeTransformer.toComplexNode(node); } - private static final ThreadLocal<NodeTransformer> NODE_TRANSFORMER_PROVIDER = new ThreadLocal<NodeTransformer>(){ + public static final ThreadLocal<NodeTransformer> NODE_TRANSFORMER_PROVIDER = new ThreadLocal<NodeTransformer>(){ @Override protected NodeTransformer initialValue(){
Relaxed the visibility of ThreadLocal class constants to public
jpmml_jpmml-model
train
java
182dd16be569c5499b35ab029434cec4f7705543
diff --git a/spec/influxdb/client_spec.rb b/spec/influxdb/client_spec.rb index <HASH>..<HASH> 100644 --- a/spec/influxdb/client_spec.rb +++ b/spec/influxdb/client_spec.rb @@ -220,7 +220,7 @@ describe InfluxDB::Client do it "should POST to create a new database user with permissions" do stub_request(:post, "http://influxdb.test:9999/db/foo/users").with( :query => {:u => "username", :p => "password"}, - :body => {:name => "useruser", :password => "passpass", :readFrom => "/read*/", writeTo: "/write*/"} + :body => {:name => "useruser", :password => "passpass", :readFrom => "/read*/", :writeTo => "/write*/"} ) @influxdb.create_database_user(
Fix spec failures in Ruby <I> due to new hash style
influxdata_influxdb-ruby
train
rb
8841c70a56ff2c70729bfa8c45eeb47974f65a15
diff --git a/lib/request.js b/lib/request.js index <HASH>..<HASH> 100644 --- a/lib/request.js +++ b/lib/request.js @@ -17,8 +17,9 @@ module.exports = Request; * a callback function. */ function Request(options, callback) { - this.options = options || {}; - this.debug = options.debug; + this.options = options || {}; + this.debug = options.debug; + this.debugHeaders = options.debugHeaders; if (this.debug) { q.longStackSupport = true; } @@ -176,6 +177,8 @@ function printHeaders (headers) { Request.prototype.logRequest = function logRequest(req) { if (this.debug) { console.error('--> ' + req.method + ' ' + req.path); + } + if (this.debugHeaders) { printHeaders(req._headers); } }; @@ -193,6 +196,8 @@ Request.prototype.logResponse = function logResponse(res) { } if (this.debug) { console.error('<-- ' + res.statusCode + ' ' + res.statusMessage); + } + if (this.debugHeaders) { printHeaders(res.headers); } };
split debug and debugHeaders out
heroku_node-heroku-client
train
js
a4d001709d38ca39069fa4f4b472953052ff4f87
diff --git a/spice.py b/spice.py index <HASH>..<HASH> 100644 --- a/spice.py +++ b/spice.py @@ -24,7 +24,7 @@ def search(query, medium): elif medium == MANGA: return [Manga(entry) for entry in results.manga.findAll('entry')] else: - return + return None def search_id(id, medium): scrape_query = helpers.get_scrape_url(id, medium)
Change search invalid argument return to None Forgot this.
Utagai_spice
train
py
547a52e1e9ba6f2a2d3a49ea5990aedbfe74a5de
diff --git a/test/backend/simple/lambda_test.rb b/test/backend/simple/lambda_test.rb index <HASH>..<HASH> 100644 --- a/test/backend/simple/lambda_test.rb +++ b/test/backend/simple/lambda_test.rb @@ -30,7 +30,7 @@ class I18nSimpleBackendLambdaTest < Test::Unit::TestCase def test_translate_with_proc_as_default expected = 'result from lambda' - assert_equal expected, @backend.translate(:en, :'does not exist', :default => lambda { expected }) + assert_equal expected, @backend.translate(:en, :'does not exist', :default => lambda { |key, values| expected }) end private
fix lambda_test for ruby <I> (expects to define block params for lambda)
ruby-i18n_i18n
train
rb
c795b7fd50a1bd8e73cf1843e0861286f5312609
diff --git a/pgmpy/models/BayesianModel.py b/pgmpy/models/BayesianModel.py index <HASH>..<HASH> 100644 --- a/pgmpy/models/BayesianModel.py +++ b/pgmpy/models/BayesianModel.py @@ -177,6 +177,10 @@ class BayesianModel(DirectedGraph): The node whose CPD we want. If node not specified returns all the CPDs added to the model. + Returns + ------- + A list of TabularCPDs. + Examples -------- >>> from pgmpy.models import BayesianModel @@ -204,7 +208,7 @@ class BayesianModel(DirectedGraph): Parameters ---------- - *cpds: TabularCPD, TreeCPD, RuleCPD object + *cpds: TabularCPD object A CPD object on any subset of the variables of the model which is to be associated with the model.
updated some docstrings in BayesinaModel
pgmpy_pgmpy
train
py
ed81445ccd6d2e3b5e4605ce502b60c75386f8f5
diff --git a/examples/multipart.js b/examples/multipart.js index <HASH>..<HASH> 100644 --- a/examples/multipart.js +++ b/examples/multipart.js @@ -30,7 +30,7 @@ router.get('/', (ctx) => { router.post('/', koaBody, (ctx) => { - console.log('fields: ', ctx.request.fields); + console.log('fields: ', ctx.request.body); // => {username: ""} - if empty console.log('files: ', ctx.request.files);
Minor correction to examples/multipart.js (#<I>) ctx.request.fields no longer exists, removing reference to it
dlau_koa-body
train
js
b6190188be730fde8433354dadd1a31c07e1a7cf
diff --git a/src/saml2/response.py b/src/saml2/response.py index <HASH>..<HASH> 100644 --- a/src/saml2/response.py +++ b/src/saml2/response.py @@ -24,6 +24,7 @@ from saml2.samlp import STATUS_TOO_MANY_RESPONSES from saml2.samlp import STATUS_UNKNOWN_ATTR_PROFILE from saml2.samlp import STATUS_UNKNOWN_PRINCIPAL from saml2.samlp import STATUS_UNSUPPORTED_BINDING +from saml2.samlp import STATUS_RESPONDER import xmldsig as ds import xmlenc as xenc @@ -158,6 +159,8 @@ class StatusUnknownPrincipal(StatusError): class StatusUnsupportedBinding(StatusError): pass +class StatusResponder(StatusError): + pass STATUSCODE2EXCEPTION = { STATUS_VERSION_MISMATCH: StatusVersionMismatch, @@ -180,6 +183,7 @@ STATUSCODE2EXCEPTION = { STATUS_UNKNOWN_ATTR_PROFILE: StatusUnknownAttrProfile, STATUS_UNKNOWN_PRINCIPAL: StatusUnknownPrincipal, STATUS_UNSUPPORTED_BINDING: StatusUnsupportedBinding, + STATUS_RESPONDER: StatusResponder, } # ---------------------------------------------------------------------------
make urn:oasis:names:tc:SAML:<I>:status:Responder known in response.py
IdentityPython_pysaml2
train
py
8f522959219f59e492650a3dc6f777b19aa33558
diff --git a/src/Illuminate/Database/Eloquent/Model.php b/src/Illuminate/Database/Eloquent/Model.php index <HASH>..<HASH> 100644 --- a/src/Illuminate/Database/Eloquent/Model.php +++ b/src/Illuminate/Database/Eloquent/Model.php @@ -269,6 +269,10 @@ abstract class Model implements ArrayAccess, Arrayable, Jsonable, JsonSerializab $model->exists = $exists; + $model->setConnection( + $this->getConnectionName() + ); + return $model; }
Use same connection on creating new instance (#<I>)
laravel_framework
train
php
bbb5c8a4f82bd78caded29efe82b23360328ac88
diff --git a/examples/audio-search.php b/examples/audio-search.php index <HASH>..<HASH> 100644 --- a/examples/audio-search.php +++ b/examples/audio-search.php @@ -5,11 +5,18 @@ require '../vendor/autoload.php'; $audio = new Op3nvoice\Audio($apikey); -$items = $audio->search('does'); +$result = $audio->search('close'); -foreach($items as $item) { +$results = $result['item_results']; +$items = $result['_links']['item']; +foreach($items as $index => $item) { $bundle = $audio->load($item['href']); echo $bundle['_links']['self']['href'] . "\n"; echo $bundle['name'] . "\n"; + + $search_hits = $results[$index]['term_results'][0]['matches'][0]['hits']; + foreach($search_hits as $search_hit) { + echo $search_hit['start'] . ' -- ' . $search_hit['end'] . "\n"; + } } \ No newline at end of file
wired the search results to work more simply
Clarify_clarify-php
train
php
b7b6fe70e97e942dd0480890cbc614ca34610bf0
diff --git a/src/Roave/DeveloperTools/Mvc/Controller/ListInspectionsController.php b/src/Roave/DeveloperTools/Mvc/Controller/ListInspectionsController.php index <HASH>..<HASH> 100644 --- a/src/Roave/DeveloperTools/Mvc/Controller/ListInspectionsController.php +++ b/src/Roave/DeveloperTools/Mvc/Controller/ListInspectionsController.php @@ -63,11 +63,11 @@ class ListInspectionsController extends AbstractController 'inspections' => $inspections, 'inspectionModels' => array_filter(array_map( function (InspectionInterface $inspection) { - if ($this->inspectionRenderer->canRender($inspection)) { - return $this->inspectionRenderer->render($inspection); + if (! $this->inspectionRenderer->canRender($inspection)) { + return null; } - return null; + return $this->inspectionRenderer->render($inspection); }, $inspections )),
Inverting conditional for clearness
Roave_RoaveDeveloperTools
train
php
90228020e6a73ee490c0f1333408e310c522c267
diff --git a/app/models/shipit/task.rb b/app/models/shipit/task.rb index <HASH>..<HASH> 100644 --- a/app/models/shipit/task.rb +++ b/app/models/shipit/task.rb @@ -77,6 +77,10 @@ module Shipit task.async_refresh_deployed_revision end + after_transition any => %i(aborted success failed error timedout) do |task| + task.schedule_rollup_chunks + end + after_transition any => :flapping do |task| task.update!(confirmations: 0) end
Roll up the task output right after the task has finished
Shopify_shipit-engine
train
rb
2d9609bf72ab3c2daa048de864552d65f3b3c991
diff --git a/js/huobipro.js b/js/huobipro.js index <HASH>..<HASH> 100644 --- a/js/huobipro.js +++ b/js/huobipro.js @@ -83,7 +83,6 @@ module.exports = class huobipro extends Exchange { }, 'private': { 'get': [ - 'points/actions', 'account/accounts', // 查询当前用户的所有账户(即account-id) 'account/accounts/{id}/balance', // 查询指定账户的余额 'order/orders/{id}', // 查询某个订单详情 @@ -95,6 +94,8 @@ module.exports = class huobipro extends Exchange { 'query/deposit-withdraw', 'margin/loan-orders', // 借贷订单 'margin/accounts/balance', // 借贷账户详情 + 'points/actions', + 'points/orders', ], 'post': [ 'order/orders/place', // 创建并执行一个新订单 (一步下单, 推荐使用)
added points/orders endpoint to huobipro
ccxt_ccxt
train
js
bcba3dd19b438b408e7cd61df8e4a2a75ce16eff
diff --git a/playback/templates/nova_compute_conf.py b/playback/templates/nova_compute_conf.py index <HASH>..<HASH> 100644 --- a/playback/templates/nova_compute_conf.py +++ b/playback/templates/nova_compute_conf.py @@ -14,4 +14,5 @@ rbd_secret_uuid = {{ rbd_secret_uuid }} disk_cachemodes= "network=writeback" block_migration_flag = "VIR_MIGRATE_UNDEFINE_SOURCE,VIR_MIGRATE_PEER2PEER,VIR_MIGRATE_LIVE,VIR_MIGRATE_NON_SHARED_INC" live_migration_flag = "VIR_MIGRATE_UNDEFINE_SOURCE,VIR_MIGRATE_PEER2PEER,VIR_MIGRATE_LIVE,VIR_MIGRATE_PERSIST_DEST,VIR_MIGRATE_TUNNELLED" +live_migration_uri = qemu+tcp://%s/system """
Change live migration to use tcp not ssh
jiasir_playback
train
py
a5850049c25057fa4b6b4ecc18f01d416aa6a229
diff --git a/tests/test_requests.py b/tests/test_requests.py index <HASH>..<HASH> 100644 --- a/tests/test_requests.py +++ b/tests/test_requests.py @@ -385,13 +385,13 @@ class TestRequestGenerator(unittest.TestCase): kwargs = {"limit": "100", "asn": "3333"} r = RequestGenerator(**kwargs) self.assertEqual( - decostruct_url_params(r.build_url()), {"limit=100", "asn=3333"} + decostruct_url_params(r.build_url()), set(["limit=100", "asn=3333"]) ) kwargs = {"limit": "100", "asn": "3333", "tags": "NAT,system-ipv4-works"} r = RequestGenerator(**kwargs) self.assertEqual( decostruct_url_params(r.build_url()), - {"limit=100", "tags=NAT,system-ipv4-works", "asn=3333"} + set(["limit=100", "tags=NAT,system-ipv4-works", "asn=3333"]) ) kwargs = {"asn": "3333"} r = RequestGenerator(**kwargs)
Python <I> is ugly and needs to die
RIPE-NCC_ripe-atlas-cousteau
train
py
55a5bd2ac6a9811ea8aeb462c776dc2189cc1ea6
diff --git a/lib/enumerize/attribute.rb b/lib/enumerize/attribute.rb index <HASH>..<HASH> 100644 --- a/lib/enumerize/attribute.rb +++ b/lib/enumerize/attribute.rb @@ -19,9 +19,9 @@ module Enumerize end # Define methods to get each value - @values.each do |name, value| + @values.each do |v| metaclass = class << self; self; end - metaclass.send(:define_method, name) { value.value } + metaclass.send(:define_method, v.to_s) { v.value } end end
@values is an array not a hash
brainspec_enumerize
train
rb
b6c163d24f73f505ce0a50477f90abf019956ac5
diff --git a/lib/Doctrine/ODM/PHPCR/UnitOfWork.php b/lib/Doctrine/ODM/PHPCR/UnitOfWork.php index <HASH>..<HASH> 100644 --- a/lib/Doctrine/ODM/PHPCR/UnitOfWork.php +++ b/lib/Doctrine/ODM/PHPCR/UnitOfWork.php @@ -1216,6 +1216,8 @@ class UnitOfWork $this->scheduledUpdates[$oid] = $document; } elseif (isset($this->documentChangesets[$oid])) { + // make sure we don't keep an old changeset if an event changed + // the document and no field changeset remains. $this->documentChangesets[$oid]['fields'] = array(); } }
adding a small comment about the recalculating fix from #<I>
doctrine_phpcr-odm
train
php
ab18495cf1849072e1a710149b36a686d928bcef
diff --git a/pymongo/bson.py b/pymongo/bson.py index <HASH>..<HASH> 100644 --- a/pymongo/bson.py +++ b/pymongo/bson.py @@ -369,8 +369,8 @@ def _dict_to_bson(dict): length = len(elements) + 5 return struct.pack("<i", length) + elements + "\x00" -if _use_c: - _dict_to_bson = _cbson._dict_to_bson +# if _use_c: +# _dict_to_bson = _cbson._dict_to_bson def is_valid(bson): """Validate that the given string represents valid BSON data.
oops, not ready to commit this yet
mongodb_mongo-python-driver
train
py
c208e4ed3071d63645704555dfc7cee295eea631
diff --git a/lib/Cake/tests/Case/Network/CakeRequestTest.php b/lib/Cake/tests/Case/Network/CakeRequestTest.php index <HASH>..<HASH> 100644 --- a/lib/Cake/tests/Case/Network/CakeRequestTest.php +++ b/lib/Cake/tests/Case/Network/CakeRequestTest.php @@ -1039,6 +1039,7 @@ class CakeRequestTestCase extends CakeTestCase { 'REQUEST_URI' => '/index.php?/posts/add', 'PHP_SELF' => '', 'URL' => '/index.php?/posts/add', + 'DOCUMENT_ROOT' => 'C:\\Inetpub\\wwwroot', 'argv' => array('/posts/add'), 'argc' => 1 ), @@ -1317,6 +1318,7 @@ class CakeRequestTestCase extends CakeTestCase { * @return void */ public function testEnvironmentDetection($name, $env, $expected) { + $_GET = array(); $this->__loadEnvironment($env); $request = new CakeRequest();
Fixing a couple of tests in CakeRequest
cakephp_cakephp
train
php
3c8beed193b977b58f985493fd68e3c6845908b1
diff --git a/src/pyws/errors.py b/src/pyws/errors.py index <HASH>..<HASH> 100644 --- a/src/pyws/errors.py +++ b/src/pyws/errors.py @@ -10,7 +10,7 @@ class Error(DefaultStrImplemntationMixin, Exception): def __unicode__(self): if self.__doc__: - return unicode(self.__doc__ % self.args) + return unicode(self.__doc__.strip() % self.args) if self.args: return self.args[0] return 'unknown error'
added .strip to error messages
stepank_pyws
train
py
e72a780102cf0a84f7f81eacbbb894324da777db
diff --git a/tcconfig/parser/_filter.py b/tcconfig/parser/_filter.py index <HASH>..<HASH> 100644 --- a/tcconfig/parser/_filter.py +++ b/tcconfig/parser/_filter.py @@ -219,7 +219,7 @@ class TcFilterParser(AbstractParser): def __parse_priority(self, line): parsed_list = self.__FILTER_PRIORITY_PATTERN.parseString(line) - self.__priority = parsed_list[-1] + self.__priority = int(parsed_list[-1]) logger.debug("succeed to parse priority: priority={}, line={}".format( self.__priority, line))
Modify filter priority value type from str to int
thombashi_tcconfig
train
py
e6247443e835763a51d86176154f13ed08dde9cf
diff --git a/tools/specification-importer/specification-docs-generator.js b/tools/specification-importer/specification-docs-generator.js index <HASH>..<HASH> 100644 --- a/tools/specification-importer/specification-docs-generator.js +++ b/tools/specification-importer/specification-docs-generator.js @@ -54,7 +54,19 @@ var generateVBusSpecificationDocs = function(spec) { '|:-:|:-:|:--|', ]); - _.forEach(info.deviceTemplates, function(device) { + var deviceTemplateKeys = _.keys(info.deviceTemplates).sort(function(lKey, rKey) { + var l = info.deviceTemplates [lKey]; + var r = info.deviceTemplates [rKey]; + + var result = (l.selfAddress & l.selfMask) - (r.selfAddress & l.selfMask); + if (result === 0) { + result = l.selfMask - r.selfMask; + } + return result; + }); + + _.forEach(deviceTemplateKeys, function(deviceKey) { + var device = info.deviceTemplates [deviceKey]; lines.push(sprintf('| 0x%04X | 0x%04X | %s |', device.selfAddress, device.selfMask, escapeString(device.name))); });
Output devices sorted by address.
danielwippermann_resol-vbus
train
js
102f5ed4a0f0bebda387660f28e231e96c3490c2
diff --git a/lib/fog/core/services_mixin.rb b/lib/fog/core/services_mixin.rb index <HASH>..<HASH> 100644 --- a/lib/fog/core/services_mixin.rb +++ b/lib/fog/core/services_mixin.rb @@ -15,7 +15,7 @@ module Fog spc = service_provider_constant(service_name, provider_name) spc.new(attributes) rescue LoadError, NameError # Only rescue errors in finding the libraries, allow connection errors through to the caller - raise NotFound, "#{provider} has no #{service_name.downcase} service" + raise Fog::Service::NotFound, "#{provider} has no #{service_name.downcase} service" end def providers
fix uninitialized constant error for NotFound
fog_fog-core
train
rb
4d2ece455361950458f7b8482c8a40283dd46db9
diff --git a/spyder/plugins/editor/widgets/editor.py b/spyder/plugins/editor/widgets/editor.py index <HASH>..<HASH> 100644 --- a/spyder/plugins/editor/widgets/editor.py +++ b/spyder/plugins/editor/widgets/editor.py @@ -2651,7 +2651,8 @@ class EditorStack(QWidget): # To update the outline explorer. editor.oe_proxy = OutlineExplorerProxyEditor(editor, editor.filename) - self.outlineexplorer.register_editor(editor.oe_proxy) + if self.outlineexplorer is not None: + self.outlineexplorer.register_editor(editor.oe_proxy) # Needs to reset the highlighting on startup in case the PygmentsSH # is in use
Editor: Fix errors when Outline is not present
spyder-ide_spyder
train
py
a76029eae0e47f65d3bb14509ccbdaa4d94c0c48
diff --git a/i3ipc/i3ipc.py b/i3ipc/i3ipc.py index <HASH>..<HASH> 100644 --- a/i3ipc/i3ipc.py +++ b/i3ipc/i3ipc.py @@ -353,7 +353,7 @@ class Connection(object): _struct_header_size = struct.calcsize(_struct_header) def __init__(self, socket_path=None, auto_reconnect=False): - if not socket_path: + if not socket_path and os.environ.get("_I3IPC_TEST") is None: socket_path = os.environ.get("I3SOCK") if not socket_path: diff --git a/run-tests.py b/run-tests.py index <HASH>..<HASH> 100755 --- a/run-tests.py +++ b/run-tests.py @@ -109,6 +109,7 @@ def run_pytest(display): env = os.environ.copy() env['DISPLAY'] = ':%d' % display env['PYTHONPATH'] = './i3ipc' + env['_I3IPC_TEST'] = '1' subprocess.run([PYTEST], env=env)
Ignore I3SOCK during tests When we use the new I3SOCK environment variable set by i3, it will ignore the current DISPLAY which is required to run tests on the Xvfb server when running in another display.
acrisci_i3ipc-python
train
py,py
53a9e0fdf66d990e623ac29d7a67fb03dbe64402
diff --git a/classes/Gems/User/Form/OrganizationFormAbstract.php b/classes/Gems/User/Form/OrganizationFormAbstract.php index <HASH>..<HASH> 100644 --- a/classes/Gems/User/Form/OrganizationFormAbstract.php +++ b/classes/Gems/User/Form/OrganizationFormAbstract.php @@ -164,6 +164,7 @@ abstract class Gems_User_Form_OrganizationFormAbstract extends Gems_Form_AutoLoa } elseif (! $element instanceof Zend_Form_Element_Select) { $element = new Zend_Form_Element_Select($this->organizationFieldName); $element->setLabel($this->translate->_('Organization')); + $element->setRegisterInArrayValidator(true); $element->setRequired(true); $element->setMultiOptions($orgs); @@ -171,6 +172,7 @@ abstract class Gems_User_Form_OrganizationFormAbstract extends Gems_Form_AutoLoa $element->setAttrib('size', max(count($orgs) + 1, $this->organizationMaxLines)); } $this->addElement($element); + $element->setValue($orgId); }
When the organization id is empty or non-existent
GemsTracker_gemstracker-library
train
php
bfc9f1e3119e20bf476211d246897980a9779dc3
diff --git a/config/routes.rb b/config/routes.rb index <HASH>..<HASH> 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -5,10 +5,12 @@ Rails.application.routes.draw do constraints(:id => /[^\/]+/) do resources :discovered match 'discovered/:id/refresh_facts' => 'discovered#refresh_facts', :as => 'refresh_facts' - match 'architecture_selected_discovered' => 'hosts#architecture_selected' - match 'os_selected_discovered' => 'hosts#os_selected' - match 'medium_selected_discovered' => 'hosts#medium_selected' end end + # Needed to make the hosts/edit form render + match 'architecture_selected_discovered' => 'hosts#architecture_selected' + match 'os_selected_discovered' => 'hosts#os_selected' + match 'medium_selected_discovered' => 'hosts#medium_selected' + end
Fix edit routes, they need to be outside the module scope
theforeman_foreman_discovery
train
rb
c1758754bc96d9b5d27cb4afccb28943fff03624
diff --git a/parler_rest/serializers.py b/parler_rest/serializers.py index <HASH>..<HASH> 100644 --- a/parler_rest/serializers.py +++ b/parler_rest/serializers.py @@ -48,4 +48,7 @@ class TranslatableModelSerializer(serializers.ModelSerializer): translation = instance._get_translated_model(lang_code, auto_create=True, meta=meta) for field, value in model_fields.items(): setattr(translation, field, value) - translation.save() + + # Go through the same hooks as the regular model, + # instead of calling translation.save() directly. + instance.save_translations()
Make sure save_translations() is called when saving via REST
django-parler_django-parler-rest
train
py