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
62ac4ff1398ba2ae372cffa99a3e3b250fcc6734
diff --git a/xpdo/xpdo.class.php b/xpdo/xpdo.class.php index <HASH>..<HASH> 100644 --- a/xpdo/xpdo.class.php +++ b/xpdo/xpdo.class.php @@ -1132,7 +1132,30 @@ class xPDO { * @return xPDOCriteria A criteria object or null if not found. */ public function getCriteria($className, $type= null, $cacheFlag= true) { - return $this->newQuery($className, $type, $cacheFlag); + $c = $this->newQuery($className); + $c->cacheFlag = $cacheFlag; + if (!empty($type)) { + if ($type instanceof xPDOCriteria) { + $c->wrap($type); + } elseif (is_array($type)) { + $tmp = array(); + array_walk_recursive($type, function ($v, $k) use (&$tmp) { + if (!is_numeric($k)) { + $tmp[$k] = $v; + } + }); + if (count($tmp)) { + $c->where($tmp); + } + } elseif (is_scalar($type)) { + if ($pk = $this->getPK($className)) { + $c->where(array($pk => $type)); + } + } else { + $c->where($type); + } + } + return $c; } /**
Possible fix for blind SQL injection For now, if there is a string when you get an object, this string will be got as an criteria for SQL query. So, if you want just ti get and object with primary key, but not filter a user request enough, there could be a blind SQL injection. This fix will force all conditions to be an: 1. primary key 2. array with keys and values for query 3. or xPDOQuery So no RAW SQL queries could be made with `getObject` call.
modxcms_xpdo
train
php
bf55b010807741460676ea885e1c8cf8afaff4f1
diff --git a/src/Database/PaginateHelper.php b/src/Database/PaginateHelper.php index <HASH>..<HASH> 100644 --- a/src/Database/PaginateHelper.php +++ b/src/Database/PaginateHelper.php @@ -34,7 +34,7 @@ class PaginateHelper { $offset = $pageNumber * $divider; $limit = $divider; if (0 <= $total && ($total < $offset || $total < ($offset + $limit))) { - $offset = (self::getPagesCount($total, $divider) - 1) * $divider; + $offset = (static::getPagesCount($total, $divider) - 1) * $divider; $limit = $total - $offset; } return [$offset, $limit];
Use static:: instead of self:: to call static methods
webeweb_core-library
train
php
0821f2ccca01091bfb312c3f5bd967d027628450
diff --git a/highton.py b/highton.py index <HASH>..<HASH> 100644 --- a/highton.py +++ b/highton.py @@ -38,10 +38,22 @@ class Highton: @staticmethod def _parse_from_xml_to_dict(xml): + """ + Parses valid XML into native Python dictionaries with the ability to parse them back into XML later on. + + :param xml: Valid XML as a string + :return: A Python dictionary + """ return xmltodict.parse(xml) @staticmethod def _parse_from_dict_to_xml(dictionary): + """ + Parses a native Python dictionary into valid XML. + + :param dictionary: A Python dictionary + :return: Valid XML as a string + """ return xmltodict.unparse(dictionary) def _send_request(self, method, endpoint, params=None, data=None):
Added docstrings to the two static methods for parsing
seibert-media_Highton
train
py
621f9006bfae62e7a5f01a30ca53c44ff4a74134
diff --git a/jsoncmd_test.go b/jsoncmd_test.go index <HASH>..<HASH> 100644 --- a/jsoncmd_test.go +++ b/jsoncmd_test.go @@ -312,8 +312,9 @@ var jsoncmdtests = []struct { "somehash") }, result: &GetBlockCmd{ - id: float64(1), - Hash: "somehash", + id: float64(1), + Hash: "somehash", + Verbose: true, }, }, {
Correct tests for recent getblock updates.
btcsuite_btcd
train
go
2e3aee6dddde0490a6d242a9a1071f94916a6420
diff --git a/oz/sqlalchemy/middleware.py b/oz/sqlalchemy/middleware.py index <HASH>..<HASH> 100644 --- a/oz/sqlalchemy/middleware.py +++ b/oz/sqlalchemy/middleware.py @@ -11,6 +11,7 @@ class SQLAlchemyMiddleware(object): def __init__(self): super(SQLAlchemyMiddleware, self).__init__() self.trigger_listener("on_finish", self._sqlalchemy_on_finish) + self.trigger_listener("on_connection_close", self._sqlalchemy_on_connection_close) def db(self): """Gets the SQLALchemy session for this request""" @@ -33,3 +34,15 @@ class SQLAlchemyMiddleware(object): self.db_conn.rollback() finally: self.db_conn.close() + + def _sqlalchemy_on_connection_close(self): + """ + Rollsback and closes the active session, since the client disconnected before the request + could be completed. + """ + + if hasattr(self, "db_conn"): + try: + self.db_conn.rollback() + finally: + self.db_conn.close()
Ensure trans is cleaned up if con. closed in async If the client closes its connection inside an `async` method, `on_finish` is not called. This can result in a db connection leak.
dailymuse_oz
train
py
95794c571ae9c0bff7a89f7ce2faf3b19431168f
diff --git a/lib/macaca-reporter.js b/lib/macaca-reporter.js index <HASH>..<HASH> 100644 --- a/lib/macaca-reporter.js +++ b/lib/macaca-reporter.js @@ -23,16 +23,6 @@ const totalTests = { function done(output, options, config, failures, exit) { try { - if (process.env.MACACA_RUN_IN_PARALLEL) { - output.suites.suites = output.suites.suites - .map(item => { - if (item.tests.length) { - return item; - } else { - return item.suites[0]; - } - }); - } render(output, options); outputJson(output, options);
fix: remove parallel (#<I>)
macacajs_macaca-reporter
train
js
3dc4214024921172c48445328497cccc94657c3f
diff --git a/test/mysql_simple_test.rb b/test/mysql_simple_test.rb index <HASH>..<HASH> 100644 --- a/test/mysql_simple_test.rb +++ b/test/mysql_simple_test.rb @@ -14,7 +14,16 @@ class MysqlSimpleTest < Test::Unit::TestCase include ColumnNameQuotingTests column_quote_char "`" - + + def test_column_class_instantiation + text_column = nil + assert_nothing_raised do + text_column = ActiveRecord::ConnectionAdapters::MysqlAdapter::Column. + new("title", nil, "text") + end + assert_not_nil text_column + end + def test_string_quoting_oddity s = "0123456789a'a" assert_equal "'0123456789a\\'a'", ActiveRecord::Base.connection.quote(s)
add test that recreates AR test failure after native adapter refactoring
jruby_activerecord-jdbc-adapter
train
rb
3e814f4daca2f4b851af4d95b24df3d059e882da
diff --git a/lib/githooks/cli.rb b/lib/githooks/cli.rb index <HASH>..<HASH> 100644 --- a/lib/githooks/cli.rb +++ b/lib/githooks/cli.rb @@ -25,10 +25,8 @@ module GitHooks GitHooks.verbose = !!options['verbose'] GitHooks.debug = !!options['debug'] - if options['script'].nil? && options['path'].nil? - fail ArgumentError, %q|Neither 'path' nor 'script' were specified - please provide one or the other.| - elsif options['script'] && options['path'] - fail ArgumentError, %q|Both 'script' and 'path' have been specified. Choose one or the other.| + unless options['script'] || options['path'] + fail ArgumentError, %q|Neither 'path' nor 'script' were specified - please provide at least one.| end Runner.attach(options['repo'], options['hooks'], options['script'] || options['path']) diff --git a/lib/githooks/version.rb b/lib/githooks/version.rb index <HASH>..<HASH> 100644 --- a/lib/githooks/version.rb +++ b/lib/githooks/version.rb @@ -18,5 +18,5 @@ with this program; if not, write to the Free Software Foundation, Inc., =end module GitHooks - VERSION = '1.1.2' + VERSION = '1.1.3' end
allow script and path to both be set at the same time; version bump
rabbitt_githooks
train
rb,rb
ee7ff7c436229d0c20108382e3601f2e4200a78a
diff --git a/cmd/minio-decode/main.go b/cmd/minio-decode/main.go index <HASH>..<HASH> 100644 --- a/cmd/minio-decode/main.go +++ b/cmd/minio-decode/main.go @@ -12,8 +12,8 @@ import ( func main() { app := cli.NewApp() - app.Name = "minio-encode" - app.Usage = "erasure encode a byte stream" + app.Name = "minio-decode" + app.Usage = "erasure decode a byte stream" app.Flags = []cli.Flag{ cli.StringFlag{ Name: "input,i", @@ -63,7 +63,7 @@ func main() { var err error chunks[i], err = ioutil.ReadFile(inputFilePath + "." + strconv.Itoa(i)) if err != nil { - log.Fatal(err) + continue } }
Decode on chunks missing should build and continue
minio_minio
train
go
c23f03c20db976dbe374ed4ab4ca6d7df8f517c1
diff --git a/client/state/sites/actions.js b/client/state/sites/actions.js index <HASH>..<HASH> 100644 --- a/client/state/sites/actions.js +++ b/client/state/sites/actions.js @@ -140,11 +140,17 @@ export function setFrontPage( siteId, pageId, successCallback ) { pageId } ); + const isSettingBlogPostsAsFrontPage = pageId === 0; + const requestData = { - is_page_on_front: true, + is_page_on_front: ! isSettingBlogPostsAsFrontPage, page_on_front_id: pageId, }; + if ( isSettingBlogPostsAsFrontPage ) { + requestData.page_for_posts_id = 0; + } + return wpcom.undocumented().setSiteHomepageSettings( siteId, requestData ).then( ( response ) => { const updatedOptions = { page_on_front: parseInt( response.page_on_front_id, 10 ),
Pages: Fix setFrontPage to handle setting Blog Posts as homepage (#<I>)
Automattic_wp-calypso
train
js
6bc1881727ea3b44436495f05c9033528057aa76
diff --git a/src/xterm.js b/src/xterm.js index <HASH>..<HASH> 100644 --- a/src/xterm.js +++ b/src/xterm.js @@ -401,7 +401,6 @@ this.showCursor(); this.element.focus(); - this.emit('focus', {terminal: this}); }; Terminal.prototype.blur = function() { @@ -417,7 +416,6 @@ this.send('\x1b[O'); } Terminal.focus = null; - this.emit('blur', {terminal: this}); }; /** @@ -627,6 +625,12 @@ this.element.classList.add('xterm-theme-' + this.theme); this.element.setAttribute('tabindex', 0); this.element.spellcheck = 'false'; + this.element.onfocus = function() { + self.emit('focus', {terminal: this}); + }; + this.element.onblur = function() { + self.emit('blur', {terminal: this}); + }; /* * Create the container that will hold the lines of the terminal and then
Fix emission of terminal focus&blur events
xtermjs_xterm.js
train
js
779c3a5a0bf979c1b65fa97daad99948849bdd68
diff --git a/src/NewRelic/Silex/NewRelicServiceProvider.php b/src/NewRelic/Silex/NewRelicServiceProvider.php index <HASH>..<HASH> 100644 --- a/src/NewRelic/Silex/NewRelicServiceProvider.php +++ b/src/NewRelic/Silex/NewRelicServiceProvider.php @@ -99,7 +99,7 @@ class NewRelicServiceProvider implements ServiceProviderInterface } if (!$name) { - $name = self::DEFAULT_TRANSACTION_NAME; + $name = NewRelicServiceProvider::DEFAULT_TRANSACTION_NAME; } $app['newrelic']->nameTransaction($name);
Fix issue accessing class constant within a closure in PHP <I> (fixes #4)
stikmanw_silex-newrelic
train
php
8d9a6356528e1c42bb094dfb248539f8b4797255
diff --git a/lib/letter_opener/delivery_method.rb b/lib/letter_opener/delivery_method.rb index <HASH>..<HASH> 100644 --- a/lib/letter_opener/delivery_method.rb +++ b/lib/letter_opener/delivery_method.rb @@ -11,7 +11,7 @@ module LetterOpener messages = mail.parts.map { |part| Message.new(location, mail, part) } messages << Message.new(location, mail) if messages.empty? messages.each(&:render) - Launchy.open(URI.parse(URI.escape("file://#{messages.first.filepath}"))) + Launchy.open(URI.parse(URI.escape(messages.first.filepath))) end end end
launchy can open files without explicit declaring `file://` derective closes #<I> #<I>
ryanb_letter_opener
train
rb
8859e0b6ca76a1abdf132469b7a2fa2575a01aa4
diff --git a/lib/moodlelib.php b/lib/moodlelib.php index <HASH>..<HASH> 100644 --- a/lib/moodlelib.php +++ b/lib/moodlelib.php @@ -4728,8 +4728,9 @@ function get_string($identifier, $module='', $a=NULL) { } } -/// If the preferred language was English we can abort now - if ($lang == $defaultlang) { +/// If the preferred language was English (utf8) we can abort now +/// saving some checks beacuse it's the only "root" lang + if ($lang == 'en_utf8') { return '[['. $identifier .']]'; }
Now "en" lang has "en_utf8" as parent so we must allow it to look for parent strings... Only "en_utf8" remains as root language to save us from some checks (because it cannot have parentlaguage defined).
moodle_moodle
train
php
cf55fc8a0002c34924df9f615c874e3541766ce4
diff --git a/lib/retina_tag/version.rb b/lib/retina_tag/version.rb index <HASH>..<HASH> 100644 --- a/lib/retina_tag/version.rb +++ b/lib/retina_tag/version.rb @@ -1,3 +1,3 @@ module RetinaTag - VERSION = "1.3.1" + VERSION = "1.4.0" end
version bump and releaes fixes
davydotcom_retina_tag
train
rb
f6ab2e407794f95d06b992f47a559e0442080fa4
diff --git a/lxd-agent/operations.go b/lxd-agent/operations.go index <HASH>..<HASH> 100644 --- a/lxd-agent/operations.go +++ b/lxd-agent/operations.go @@ -74,9 +74,7 @@ func operationsGet(d *Daemon, r *http.Request) response.Response { localOperationURLs := func() (shared.Jmap, error) { // Get all the operations - operations.Lock() - ops := operations.Operations() - operations.Unlock() + ops := operations.Clone() // Build a list of URLs body := shared.Jmap{} @@ -96,9 +94,7 @@ func operationsGet(d *Daemon, r *http.Request) response.Response { localOperations := func() (shared.Jmap, error) { // Get all the operations - operations.Lock() - ops := operations.Operations() - operations.Unlock() + ops := operations.Clone() // Build a list of operations body := shared.Jmap{}
lxd-agent/operations: operations.Clone() usage
lxc_lxd
train
go
05486508fc4bed05a0fcfb5c41c3bcd0576f9b4e
diff --git a/src/main/java/org/asteriskjava/live/ChannelState.java b/src/main/java/org/asteriskjava/live/ChannelState.java index <HASH>..<HASH> 100644 --- a/src/main/java/org/asteriskjava/live/ChannelState.java +++ b/src/main/java/org/asteriskjava/live/ChannelState.java @@ -17,13 +17,16 @@ package org.asteriskjava.live; /** - * Enumeration that represents the state of a channel. + * The lifecycle status of an {@link org.asteriskjava.live.AsteriskChannel}. * * @author srt * @version $Id$ */ public enum ChannelState { + /** + * The initial state of the channel when it is not yet in use. + */ DOWN, OFF_HOOK, DIALING, @@ -32,5 +35,9 @@ public enum ChannelState UP, BUSY, RSRVD, + + /** + * The channel has been hung up. + */ HUNGUP }
Added javadoc for some literals
asterisk-java_asterisk-java
train
java
72c727e3b4f8b0ab7a26182b19b0597d7533bfb5
diff --git a/pkg/apis/core/validation/events.go b/pkg/apis/core/validation/events.go index <HASH>..<HASH> 100644 --- a/pkg/apis/core/validation/events.go +++ b/pkg/apis/core/validation/events.go @@ -68,7 +68,7 @@ func ValidateEvent(event *core.Event) field.ErrorList { allErrs = append(allErrs, field.Required(field.NewPath("reportingInstance"), "")) } if len(event.ReportingInstance) > ReportingInstanceLengthLimit { - allErrs = append(allErrs, field.Invalid(field.NewPath("repotingIntance"), "", fmt.Sprintf("can have at most %v characters", ReportingInstanceLengthLimit))) + allErrs = append(allErrs, field.Invalid(field.NewPath("reportingInstance"), "", fmt.Sprintf("can have at most %v characters", ReportingInstanceLengthLimit))) } if len(event.Action) == 0 { allErrs = append(allErrs, field.Required(field.NewPath("action"), ""))
fix wrong spells in events.go
kubernetes_kubernetes
train
go
cf9f8bfc43d7ef2ddf14ea80f2215644ba836b9d
diff --git a/src/index.js b/src/index.js index <HASH>..<HASH> 100644 --- a/src/index.js +++ b/src/index.js @@ -1,7 +1,7 @@ import uniqueRandomArray from 'unique-random-array'; import starWarsNames from './starwars-names.json'; -var getRandomItem = uniqueRandomArray(starWarsNames); +const getRandomItem = uniqueRandomArray(starWarsNames); module.exports = { all: starWarsNames, @@ -12,8 +12,8 @@ function random(number) { if (number === undefined) { return getRandomItem(); } else { - var randomItems = []; - for (var i = 0; i < number; i++) { + const randomItems = []; + for (let i = 0; i < number; i++) { randomItems.push(getRandomItem()); } return randomItems;
chore: var -> const/let (#<I>) * var -> let since babel is already in place :smile: * let -> const
kentcdodds_starwars-names
train
js
c4a8a287da53be3a6bbe6b571d65d9bf27a365bc
diff --git a/lib/video_sprites/processor.rb b/lib/video_sprites/processor.rb index <HASH>..<HASH> 100644 --- a/lib/video_sprites/processor.rb +++ b/lib/video_sprites/processor.rb @@ -65,7 +65,7 @@ module VideoSprites end def create_gif - `convert -delay 20 -loop 0 #{all_images.join(' ')} #{gif_output_filename}` + `convert -geometry #{@options[:width]}x -delay 20 -loop 0 #{all_images.join(' ')} #{gif_output_filename}` end def ffmpeg_cmd
use same size for GIF as for thumbnail sprites
jronallo_video_sprites
train
rb
dd0a5dd80cafa2991d653106ba14fb1acbae155c
diff --git a/nomad/api/exceptions.py b/nomad/api/exceptions.py index <HASH>..<HASH> 100644 --- a/nomad/api/exceptions.py +++ b/nomad/api/exceptions.py @@ -3,23 +3,23 @@ class BaseNomadException(Exception): def __init__(self, nomad_resp): self.nomad_resp = nomad_resp + def __str__(self): + return 'The {0} was raised with following response: {1}.'.format(self.__class__.__name__, self.nomad_resp.text) + class URLNotFoundNomadException(BaseNomadException): """The requeted URL given does not exist""" - def __init__(self, nomad_resp): - self.nomad_resp = nomad_resp - + pass + class URLNotAuthorizedNomadException(BaseNomadException): """The requested URL is not authorized. ACL""" - def __init__(self, nomad_resp): - self.nomad_resp = nomad_resp + pass class BadRequestNomadException(BaseNomadException): """Validation failure and if a parameter is modified in the request, it could potentially succeed.""" - def __init__(self, nomad_resp): - self.nomad_resp = nomad_resp + pass class InvalidParameters(Exception):
Adding __str__ method to improve errors readability
jrxFive_python-nomad
train
py
64b5e2aba14d1b62ad6a6f7d84d4db51090f7fd3
diff --git a/src/runez/system.py b/src/runez/system.py index <HASH>..<HASH> 100644 --- a/src/runez/system.py +++ b/src/runez/system.py @@ -1252,13 +1252,18 @@ class SystemInfo: """Info on currently running process""" return _R._runez_module().PsInfo() - def diagnostics(self, via=" ⚡ "): + def diagnostics(self, via=" ⚡ ", userid=UNSET): """Usable by runez.render.PrettyTable.two_column_diagnostics()""" yield "platform", self.platform_info if self.terminal.term_program: yield "terminal", "%s (TERM=%s)" % (self.terminal.term_program, os.environ.get("TERM")) - yield "userid", self.userid + if userid is UNSET: + userid = self.userid + + if userid: + yield "userid", userid + if self.program_version: yield "version", "%s v%s" % (self.program_name, self.program_version)
Allow to override diagnostics userid
zsimic_runez
train
py
16dbe74054693b2bedb3a2461d472aaaf3f866b1
diff --git a/source/net/fortuna/ical4j/model/component/Observance.java b/source/net/fortuna/ical4j/model/component/Observance.java index <HASH>..<HASH> 100644 --- a/source/net/fortuna/ical4j/model/component/Observance.java +++ b/source/net/fortuna/ical4j/model/component/Observance.java @@ -357,8 +357,13 @@ public abstract class Observance extends Component implements Comparable { // Translate local onset into UTC time by parsing local time // as GMT and adjusting by TZOFFSETFROM - try { - java.util.Date utcOnset = UTC_FORMAT.parse(dateStr); + try { + java.util.Date utcOnset = null; + + synchronized(UTC_FORMAT) { + utcOnset = UTC_FORMAT.parse(dateStr); + } + long offset = getOffsetFrom().getOffset().getOffset(); return new DateTime(utcOnset.getTime() - offset); } catch (ParseException e) {
SimpleDateFormat isn't threadsafe, so synchronize access to shared instance
ical4j_ical4j
train
java
cd41f64a0304d95e88d67646a5a289d2b61e6927
diff --git a/ca/certificate-authority_test.go b/ca/certificate-authority_test.go index <HASH>..<HASH> 100644 --- a/ca/certificate-authority_test.go +++ b/ca/certificate-authority_test.go @@ -564,6 +564,12 @@ func TestRejectValidityTooLong(t *testing.T) { ca.SA = storageAuthority // Test that the CA rejects CSRs that would expire after the intermediate cert + csrDER, _ := hex.DecodeString(NO_CN_CSR_HEX) + csr, _ := x509.ParseCertificateRequest(csrDER) + _, err = ca.IssueCertificate(*csr, 1, FarPast) + test.Assert(t, err != nil, "Cannot issue a certificate that expires after the underlying authorization.") + + // Test that the CA rejects CSRs that would expire after the intermediate cert csrDER, _ = hex.DecodeString(NO_CN_CSR_HEX) csr, _ = x509.ParseCertificateRequest(csrDER) ca.NotAfter = time.Now()
Some changes that got missed in the rebase
letsencrypt_boulder
train
go
f4f74224de3f0d2e68d85aeda935ea53c5270914
diff --git a/src/options/normalizeUrl.js b/src/options/normalizeUrl.js index <HASH>..<HASH> 100644 --- a/src/options/normalizeUrl.js +++ b/src/options/normalizeUrl.js @@ -8,7 +8,13 @@ function normalizeUrl(testUrl) { if (!parsed.protocol) { normalized = 'http://' + normalized; } - if (!validator.isURL(normalized, {require_protocol: true, require_tld: false})) { + + const validatorOptions = { + require_protocol: true, + require_tld: false, + allow_trailing_dot: true // mDNS addresses, https://github.com/jiahaog/nativefier/issues/308 + }; + if (!validator.isURL(normalized, validatorOptions)) { throw `Your Url: "${normalized}" is invalid!`; } return normalized;
Fix #<I> - Allow mDNS addresses (ending with 'local.') during URL validation (#<I>)
jiahaog_nativefier
train
js
bf9c1e00a8dcddfbbc58579a540823256e3acdf0
diff --git a/fundamentals/tools.py b/fundamentals/tools.py index <HASH>..<HASH> 100644 --- a/fundamentals/tools.py +++ b/fundamentals/tools.py @@ -298,11 +298,16 @@ class tools(object): pass if stream is not False: + + astream = stream.read() + home = expanduser("~") + astream = astream.replace("~/", home + "/") + import yaml if orderedSettings: - settings = ordered_load(stream, yaml.SafeLoader) + settings = ordered_load(astream, yaml.SafeLoader) else: - settings = yaml.load(stream) + settings = yaml.load(astream) # SETUP LOGGER -- DEFAULT TO CONSOLE LOGGER IF NONE PROVIDED IN # SETTINGS
allowing '~' as home directory for filepaths in all settings file parameters - will be converted when initially read
thespacedoctor_fundamentals
train
py
e97ca9c2cfd459e39669080b88f60dd6dc973656
diff --git a/code/FileVersion.php b/code/FileVersion.php index <HASH>..<HASH> 100755 --- a/code/FileVersion.php +++ b/code/FileVersion.php @@ -7,6 +7,8 @@ */ class FileVersion extends DataObject { + const VERSION_FOLDER = '.versions'; + public static $db = array ( 'VersionNumber' => 'Int', 'Filename' => 'Varchar(255)' @@ -83,7 +85,7 @@ class FileVersion extends DataObject { } /** - * Saves the current version of the linked File object in a _versions directory, then returns the relative path + * Saves the current version of the linked File object in a versions directory, then returns the relative path * to where it is stored. * * @return string @@ -91,11 +93,11 @@ class FileVersion extends DataObject { protected function saveCurrentVersion() { if($this->File()->ParentID) { $base = Controller::join_links ( - $this->File()->Parent()->getFullPath(), '_versions', $this->FileID + $this->File()->Parent()->getFullPath(), self::VERSION_FOLDER, $this->FileID ); } else { $base = Controller::join_links ( - Director::baseFolder(), ASSETS_DIR, '_versions', $this->FileID + Director::baseFolder(), ASSETS_DIR, self::VERSION_FOLDER, $this->FileID ); }
ENHANCEMENT: Store versioned files in a ".versions" rather than "_versions" dir so SilverStripe does not index them. MINOR: Use a constant for storing the version folder name.
symbiote_silverstripe-versionedfiles
train
php
4cef8b8ed2f6f09e246a3abe10116c396d7ea4c0
diff --git a/dev/Nav.js b/dev/Nav.js index <HASH>..<HASH> 100644 --- a/dev/Nav.js +++ b/dev/Nav.js @@ -2,7 +2,6 @@ import 'react-select/dist/react-select.css'; import PropTypes from 'prop-types'; import React from 'react'; import Select from 'react-select'; -import './styles.css'; const Nav = props => ( <div className="mock-nav"> diff --git a/dev/index.js b/dev/index.js index <HASH>..<HASH> 100644 --- a/dev/index.js +++ b/dev/index.js @@ -1,5 +1,6 @@ import React from 'react'; import ReactDOM from 'react-dom'; import App from './App'; +import './styles.css'; ReactDOM.render(<App />, document.getElementById('root'));
move css into index.js from Nav.js
plotly_react-chart-editor
train
js,js
e231025e8bbfd6b8e9018937c36c18d6e9097cab
diff --git a/src/share/classes/com/sun/tools/javac/comp/Resolve.java b/src/share/classes/com/sun/tools/javac/comp/Resolve.java index <HASH>..<HASH> 100644 --- a/src/share/classes/com/sun/tools/javac/comp/Resolve.java +++ b/src/share/classes/com/sun/tools/javac/comp/Resolve.java @@ -3421,7 +3421,10 @@ public class Resolve { @Override protected Symbol access(Name name, TypeSymbol location) { - return ambiguousSyms.last(); + Symbol firstAmbiguity = ambiguousSyms.last(); + return firstAmbiguity.kind == TYP ? + types.createErrorType(name, location, firstAmbiguity.type).tsym : + firstAmbiguity; } }
<I>: Regression: difference in error recovery after ambiguity causes JCK test failure Summary: Wrong implementation of ResolveError.access in AmbiguityError Reviewed-by: jjh
wmdietl_jsr308-langtools
train
java
ad38ba9046a0567bbf16e1dcd65404e307172bff
diff --git a/spec/public/property_spec.rb b/spec/public/property_spec.rb index <HASH>..<HASH> 100644 --- a/spec/public/property_spec.rb +++ b/spec/public/property_spec.rb @@ -202,10 +202,40 @@ describe DataMapper::Property do end end + # What's going on here: + # + # we first set original value and make an assertion on it + # then we try to set it again, which clears original value + # (since original value is set, property is no longer dirty) describe "#set_original_value" do - it 'sets original value of the property' + before(:each) do + @image = Image.create(:md5hash => "5268f0f3f452844c79843e820f998869", + :title => "Rome at the sunset", + :description => "Just wow") + @image.reload + @property = Image.properties[:title] + end + + describe "when value changes" do + before(:each) do + @property.set_original_value(@image, "Rome at the sunset") + end - it 'only sets original value unless it is already set' + it 'sets original value of the property' do + @image.original_values[@property].should == "Rome at the sunset" + end + end + + describe "when value stays the same" do + before(:each) do + @property.set_original_value(@image, "Rome at the sunset") + end + + it 'only sets original value when it has changed' do + @property.set_original_value(@image, "Rome at the sunset") + @image.original_values[@property].should be_blank + end + end end describe "#set" do
Spec examples for Property#set_original_value * I feel like testing plumbing methods makes little sense but still makes some. If dkubb agrees that we should go for more integration specs instead, I'd not mind just removing these
datamapper_dm-core
train
rb
36c1e6dc7d49c7c85554af31be5a1841afbca067
diff --git a/tests/vcloud_director/models/compute/vapp_tests.rb b/tests/vcloud_director/models/compute/vapp_tests.rb index <HASH>..<HASH> 100644 --- a/tests/vcloud_director/models/compute/vapp_tests.rb +++ b/tests/vcloud_director/models/compute/vapp_tests.rb @@ -1,7 +1,6 @@ require File.expand_path(File.join(File.dirname(__FILE__), 'helper')) Shindo.tests("Compute::VcloudDirector | vapps", ['vclouddirector', 'all']) do - pending if Fog.mocking? # unless there is atleast one vapp we cannot run these tests pending if vdc.vapps.empty?
Enable model vapp_tests in Mock mode
fog_fog
train
rb
6b0d9fe6bc32be774ac47ae228ee33c5284eaf85
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -37,7 +37,7 @@ setup( 'normality >= 1.0.0', 'tabulate', 'dataset >= 1.0.8', - 'servicelayer >= 1.8.0', + 'servicelayer == 1.8.0', 'urlnormalizer >= 1.2.0', 'celestial >= 0.2.0', 'dateparser',
Pin servicelayer version to prevent frequent breakage
alephdata_memorious
train
py
d0a1cc87fb0d36b24385ff76a0f46c217f45624c
diff --git a/modules/cms/classes/MarkupManager.php b/modules/cms/classes/MarkupManager.php index <HASH>..<HASH> 100644 --- a/modules/cms/classes/MarkupManager.php +++ b/modules/cms/classes/MarkupManager.php @@ -12,8 +12,8 @@ class MarkupManager { use \October\Rain\Support\Traits\Singleton; - const EXTENSION_FILTER = 'functions'; - const EXTENSION_FUNCTION = 'filters'; + const EXTENSION_FILTER = 'filters'; + const EXTENSION_FUNCTION = 'functions'; const EXTENSION_TOKEN_PARSER = 'tokens'; /**
Fixes #<I> In MarkupManager filters and functions are backwards
octobercms_october
train
php
c99e1db0bb70fd0691ad56da0bbf8027dfbfb170
diff --git a/ng-FitText.js b/ng-FitText.js index <HASH>..<HASH> 100644 --- a/ng-FitText.js +++ b/ng-FitText.js @@ -58,11 +58,9 @@ scope.$watch(attrs.ngModel, function() { scope.resizer() }); - config.debounce == true - ? angular.element(window).bind('resize', _debounce( function(){ scope.$apply( scope.resizer )}, config.delay )) - : angular.element(window).bind('resize', function(){ scope.$apply( scope.resizer )}); - - function _debounce(a,b,c){var d;return function(){var e=this,f=arguments;clearTimeout(d),d=setTimeout(function(){d=null,c||a.apply(e,f)},b),c&&!d&&a.apply(e,f)}} + config.debounce + ? angular.element(window).bind('resize', config.debounce(function(){ scope.$apply(scope.resizer)}, config.delay)) + : angular.element(window).bind('resize', function(){ scope.$apply(scope.resizer)}); } } }])
Debounce functionality moved to fitTextConfigProvider
patrickmarabeas_ng-FitText.js
train
js
307777a8159b1ed7246106c22f0459655fca4e3e
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -19,9 +19,16 @@ def pkg_config(*packages, **kw): setup( - name='PyAV', + + name='av', version='0.1', description='Pythonic bindings for libav.', + + author="Mike Boers", + author_email="pyav@mikeboers.com", + + url="https://github.com/mikeboers/PyAV", + ext_modules=[ Extension( 'av.tutorial',
Register "av" on the PyPI
mikeboers_PyAV
train
py
f6cdb58d19243a18ffdaa2b2ec71872fa00e65c0
diff --git a/treetime/seq_utils.py b/treetime/seq_utils.py index <HASH>..<HASH> 100644 --- a/treetime/seq_utils.py +++ b/treetime/seq_utils.py @@ -242,11 +242,13 @@ def normalize_profile(in_profile, log=False, return_offset = True): normalized profile (fresh np object) and offset (if return_offset==True) """ if log: - tmp_prof = np.exp(in_profile) # - tmp_prefactor) + tmp_prefactor = in_profile.max(axis=1) + tmp_prof = np.exp(in_profile.T - tmp_prefactor).T else: + tmp_prefactor = 0.0 tmp_prof = in_profile norm_vector = tmp_prof.sum(axis=1) return (np.copy(np.einsum('ai,a->ai',tmp_prof,1.0/norm_vector)), - np.log(norm_vector) if return_offset else None) + (np.log(norm_vector) + tmp_prefactor) if return_offset else None)
avoid underflow errors during profile normalization by forcing the max element to 0 before exponentiation
neherlab_treetime
train
py
056a5138a4a37bf614eb780efc88a0d61f04a9a5
diff --git a/auth/shibboleth/auth.php b/auth/shibboleth/auth.php index <HASH>..<HASH> 100644 --- a/auth/shibboleth/auth.php +++ b/auth/shibboleth/auth.php @@ -178,13 +178,32 @@ class auth_plugin_shibboleth extends auth_plugin_base { } /** - * Returns true if this authentication plugin can change the user's - * password. + * Whether shibboleth users can change their password or not. * - * @return bool + * Shibboleth auth requires password to be changed on shibboleth server directly. + * So it is required to have password change url set. + * + * @return bool true if there's a password url or false otherwise. */ function can_change_password() { - return false; + if (!empty($this->config->changepasswordurl)) { + return true; + } else { + return false; + } + } + + /** + * Get password change url. + * + * @return moodle_url|null Returns URL to change password or null otherwise. + */ + function change_password_url() { + if (!empty($this->config->changepasswordurl)) { + return new moodle_url($this->config->changepasswordurl); + } else { + return null; + } } /**
MDL-<I> auth_shibboleth: Allow password change for shibboleth users This patch modifies can_change_password() and adds change_password_url() to allow Shibboleth users to change their password in case there is an (external) password change URL defined in Moodle. If no such URL is defined, the behaviour is the same as without the proposed change. Thanks FH-HWZ.ch for the contribution.
moodle_moodle
train
php
dc37bd778a46df8a584e27b3a1add519bbbe8ebb
diff --git a/actionpack/test/dispatch/request_test.rb b/actionpack/test/dispatch/request_test.rb index <HASH>..<HASH> 100644 --- a/actionpack/test/dispatch/request_test.rb +++ b/actionpack/test/dispatch/request_test.rb @@ -474,6 +474,7 @@ protected def stub_request(env = {}) ip_spoofing_check = env.key?(:ip_spoofing_check) ? env.delete(:ip_spoofing_check) : true + @trusted_proxies ||= nil ip_app = ActionDispatch::RemoteIp.new(Proc.new { }, ip_spoofing_check, @trusted_proxies) tld_length = env.key?(:tld_length) ? env.delete(:tld_length) : 1 ip_app.call(env)
Initialize @trusted_proxies.
rails_rails
train
rb
2c1833bdb4606629eaac2c5b01d9921ef0b506f6
diff --git a/course/report/log/lib.php b/course/report/log/lib.php index <HASH>..<HASH> 100644 --- a/course/report/log/lib.php +++ b/course/report/log/lib.php @@ -73,22 +73,17 @@ function print_mnet_log_selector_form($hostid, $course, $selecteduser=0, $select } } - // Get all the hosts that we SSO with - $sql = "SELECT DISTINCT - h.id, - h.name, - s.name as servicename - FROM - {$CFG->prefix}mnet_host h - LEFT OUTER JOIN - {$CFG->prefix}mnet_host2service hs ON - (h.id=hs.hostid AND hs.subscribe!=0) - LEFT OUTER JOIN - {$CFG->prefix}mnet_service2rpc sr ON - sr.serviceid=hs.serviceid - LEFT OUTER JOIN - {$CFG->prefix}mnet_service s ON - (sr.serviceid=s.id AND s.name='sso')"; + // Get all the hosts that have log records + $sql = "select distinct + h.id, + h.name + from + {$CFG->prefix}mnet_host h, + {$CFG->prefix}mnet_log l + where + h.id = l.hostid + order by + h.name"; $hosts = get_records_sql($sql); foreach($hosts as $host) {
Mnet: Bugfix: Revised query to find hosts we SSO with: MDL-<I>
moodle_moodle
train
php
73b0a89705a37e879620b190fc724fcfb6debd34
diff --git a/app/models/renalware/patients/search_query.rb b/app/models/renalware/patients/search_query.rb index <HASH>..<HASH> 100644 --- a/app/models/renalware/patients/search_query.rb +++ b/app/models/renalware/patients/search_query.rb @@ -19,6 +19,7 @@ module Renalware @term = term end + # The key here is the identity_match ransacker - see PatientsRansackHelper def call search.result end
Improve Patients::SearchQuery This object was previously unused I think. A slight improvement to let it search by nhs_number and local hispital numbers as well as family_name and given_name
airslie_renalware-core
train
rb
b33d5c5393e80ffc39fb31da8d88440803853a0a
diff --git a/_docs/server.go b/_docs/server.go index <HASH>..<HASH> 100644 --- a/_docs/server.go +++ b/_docs/server.go @@ -1,4 +1,4 @@ -// Copyright 2015 Hajime Hoshi +// Copyright 2016 Hajime Hoshi // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License.
doc: Update license year in a new file
hajimehoshi_ebiten
train
go
30765fe8420e01b599629a2593d930320eec4056
diff --git a/can-component.js b/can-component.js index <HASH>..<HASH> 100644 --- a/can-component.js +++ b/can-component.js @@ -490,7 +490,7 @@ var Component = Construct.extend( var removalDisposal = domMutate.onNodeRemoval(el, function () { var doc = el.ownerDocument; var rootNode = doc.contains ? doc : doc.documentElement; - if (!rootNode.contains(el)) { + if (!rootNode || !rootNode.contains(el)) { removalDisposal(); callTeardownFunctions(); }
fixing teardown when documentElement is removed
canjs_can-component
train
js
00dcca52996a319ed3885e47cda1de8cd7777584
diff --git a/Resources/Core/Build/Configuration/JSUnit/Bootstrap.js b/Resources/Core/Build/Configuration/JSUnit/Bootstrap.js index <HASH>..<HASH> 100644 --- a/Resources/Core/Build/Configuration/JSUnit/Bootstrap.js +++ b/Resources/Core/Build/Configuration/JSUnit/Bootstrap.js @@ -17,6 +17,19 @@ var paths = { 'jquery/autocomplete': '/base/typo3/sysext/core/Resources/Public/JavaScript/Contrib/jquery.autocomplete' }; +var packages = [ + { + name: 'lit-html', + location: '/base/typo3/sysext/core/Resources/Public/JavaScript/Contrib/lit-html', + main: 'lit-html' + }, + { + name: 'lit-element', + location: '/base/typo3/sysext/core/Resources/Public/JavaScript/Contrib/lit-element', + main: 'lit-element' + }, +]; + /** * Collect test files and define namespace mapping for RequireJS config */ @@ -76,6 +89,8 @@ requirejs.config({ paths: paths, + packages: packages, + shim: {}, // ask Require.js to load these files (all our tests)
[TASK] Include lit-html/element in JSUnit Bootstrap (#<I>) lit-html is added to TYPO3 core as client side template engine. Therefore this library needs to be loadable in unit tests. Issue on Forge: <URL>
TYPO3_testing-framework
train
js
bab4b4763764e443982963617c208ec3db7c52f5
diff --git a/src/VK/VK.php b/src/VK/VK.php index <HASH>..<HASH> 100644 --- a/src/VK/VK.php +++ b/src/VK/VK.php @@ -167,7 +167,7 @@ class VK */ public function isAuth() { - return $this->auth; + return !is_null($this->access_token); } /**
Update VK.php Now isAuth indicates that access token is set, but maybe not valid. To check token use checkAccessToken method
vladkens_VK
train
php
99859d0d63698afba1e10e3f16e669d5ffc37235
diff --git a/lib/spike/index.js b/lib/spike/index.js index <HASH>..<HASH> 100644 --- a/lib/spike/index.js +++ b/lib/spike/index.js @@ -242,7 +242,7 @@ var spike = module.exports = { console.error(error); } }); - }, 10* 1000); // leave it open for 60 minutes. + }, 24 * 60 * 1000); // leave it open for 24 hours } clearInterval(keepalive); clearTimeout(closeTimer);
Keep write access open for <I> hours Allows for things like working on a train and dropping connections, etc.
jsbin_jsbin
train
js
d3b192e3076b9465fad119703656d16d9b0277a4
diff --git a/packages/authorize/useAuthorize.js b/packages/authorize/useAuthorize.js index <HASH>..<HASH> 100644 --- a/packages/authorize/useAuthorize.js +++ b/packages/authorize/useAuthorize.js @@ -107,6 +107,7 @@ export default (permissions,{ checkPermissions(); // todo - optimize this so we only have a permissions effect for fetching // and the others are just filters + // eslint-disable-next-line react-hooks/exhaustive-deps }, [organizationId, region, customerId, permissions]); return [authorized,loading];
chore(authorize): hide warning for authorize effect
Availity_availity-react
train
js
3101bb6ab859c69acf51301cdb988f855c2ccdbc
diff --git a/lib/webmock/http_lib_adapters/async_http_client_adapter.rb b/lib/webmock/http_lib_adapters/async_http_client_adapter.rb index <HASH>..<HASH> 100644 --- a/lib/webmock/http_lib_adapters/async_http_client_adapter.rb +++ b/lib/webmock/http_lib_adapters/async_http_client_adapter.rb @@ -151,7 +151,7 @@ if defined?(Async::HTTP) def create_connected_sockets Async::IO::Socket.pair(Socket::AF_UNIX, Socket::SOCK_STREAM).tap do |sockets| sockets.each do |socket| - socket.instance_variable_set :@alpn_protocol, @alpn_protocol + socket.instance_variable_set :@alpn_protocol, nil socket.instance_eval do def alpn_protocol nil # means HTTP11 will be used for HTTPS
Fix async http adapter warning Problem: when using async http adapter rspec outputs the following warning `lib/webmock/http_lib_adapters/async_http_client_adapter.rb:<I>: warning: instance variable @alpn_protocol not initialized` Reason for that is: `@alpn_protocol` is never defined. Solution: don't use `@alpn_protocol`
bblimke_webmock
train
rb
bfffb6d6260df48c3a41f93168eebc027be5418b
diff --git a/lib/htmlParser.js b/lib/htmlParser.js index <HASH>..<HASH> 100644 --- a/lib/htmlParser.js +++ b/lib/htmlParser.js @@ -269,7 +269,7 @@ exports.parseAlbumInfo = function (html, albumUrl) { } }); - for (let nonPlayableTrack of data.album.nonPlayableTracks) { + for (var nonPlayableTrack of data.album.nonPlayableTracks) { data.album.tracks.push(nonPlayableTrack); };
convert previous commit to non- strict mode
masterT_bandcamp-scraper
train
js
66738533fb9d98071964e4d80e45d41b9d32e8c5
diff --git a/sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/cpp/CppGenerator.java b/sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/cpp/CppGenerator.java index <HASH>..<HASH> 100755 --- a/sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/cpp/CppGenerator.java +++ b/sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/cpp/CppGenerator.java @@ -1306,7 +1306,7 @@ public class CppGenerator implements CodeGenerator indent + " throw std::runtime_error(\"string too large for put%2$s [E106]\");\n" + indent + " }\n\n" + indent + " size_t length = srcLength < %4$d ? srcLength : %4$d;\n" + - indent + " std::memcpy(m_buffer + m_offset + %3$d, str.c_str(), length);\n" + + indent + " std::memcpy(m_buffer + m_offset + %3$d, str.data(), length);\n" + indent + " for (size_t start = srcLength; start < length; ++start)\n" + indent + " {\n" + indent + " m_buffer[m_offset + %3$d + start] = 0;\n" +
[Java] Fix generated codec for string_view with C<I>.
real-logic_simple-binary-encoding
train
java
04fd91981256e7e51eb2b549f480debff1e047ce
diff --git a/extension/rsb/com/src/main/java/org/openbase/jul/extension/rsb/com/RPCHelper.java b/extension/rsb/com/src/main/java/org/openbase/jul/extension/rsb/com/RPCHelper.java index <HASH>..<HASH> 100644 --- a/extension/rsb/com/src/main/java/org/openbase/jul/extension/rsb/com/RPCHelper.java +++ b/extension/rsb/com/src/main/java/org/openbase/jul/extension/rsb/com/RPCHelper.java @@ -53,7 +53,7 @@ public class RPCHelper { private static final Map<String, Integer> methodCountMap = new HashMap<>(); - public static final long RPC_TIMEOUT = TimeUnit.MINUTES.toMillis(1); + public static final long RPC_TIMEOUT = TimeUnit.MINUTES.toMillis(5); public static final String USER_TIME_KEY = "USER_NANO_TIME"; public static final long USER_TIME_VALUE_INVALID = -1;
increase rpc timeout because of registry performance issues.
openbase_jul
train
java
c039d2f3b687fb9ed4b4daf22c1b4eada69816ac
diff --git a/tendril/tcp.py b/tendril/tcp.py index <HASH>..<HASH> 100644 --- a/tendril/tcp.py +++ b/tendril/tcp.py @@ -408,14 +408,32 @@ class TCPTendrilManager(manager.TendrilManager): try: tend.application = acceptor(tend) except Exception: + # What comes next may overwrite the exception, so + # save it for reraise later... + exc_class, exc_value, exc_tb = sys.exc_info() + # Make sure the connection is closed - cli.close() - raise + try: + cli.close() + except Exception: + pass + + raise exc_class, exc_value, exc_tb except Exception: # Do something if we're in an error loop err_thresh += 1 if err_thresh >= 10: - raise + # What comes next may overwrite the exception, so + # save it for reraise later... + exc_class, exc_value, exc_tb = sys.exc_info() + + # Make sure the socket is closed + try: + sock.close() + except Exception: + pass + + raise exc_class, exc_value, exc_tb continue # Decrement the error threshold
Make sure to close sockets carefully.
klmitch_tendril
train
py
d1f655da26aa7ce631b250922adbedb2d0f05273
diff --git a/src/main/java/io/vlingo/actors/Mailbox.java b/src/main/java/io/vlingo/actors/Mailbox.java index <HASH>..<HASH> 100644 --- a/src/main/java/io/vlingo/actors/Mailbox.java +++ b/src/main/java/io/vlingo/actors/Mailbox.java @@ -35,6 +35,12 @@ public interface Mailbox extends Runnable { boolean isDelivering(); /** + * Answer the total capacity for concurrent operations. + * @return int + */ + int concurrencyCapacity(); + + /** * Recovers the previous operational mode, either active or suspended, * and if active resumes delivery. If the restored operational mode * is still suspended, then at least one more {@code resume()} is required.
Implemented concurrencyCapacity().
vlingo_vlingo-actors
train
java
a9117b5189d28940be9bb651ef2ed7ba453935a0
diff --git a/lib/ronin/ui/console.rb b/lib/ronin/ui/console.rb index <HASH>..<HASH> 100644 --- a/lib/ronin/ui/console.rb +++ b/lib/ronin/ui/console.rb @@ -82,7 +82,6 @@ module Ronin IRB.conf[:IRB_NAME] = 'ronin' IRB.conf[:PROMPT_MODE] = Console.prompt IRB.conf[:AUTO_INDENT] = Console.indent - IRB.conf[:LOAD_MODULES] = Console.auto_load irb = IRB::Irb.new(nil,script) @@ -91,6 +90,10 @@ module Ronin require 'ronin' require 'pp' + Ronin::UI::Console.auto_load.each do |path| + require path + end + include Ronin end @@ -111,7 +114,7 @@ module Ronin irb.eval_input end - print "\n" + putc "\n" return nil end
Manually require auto_load paths. * For some reason IRB.conf[:LOAD_MODULES] is not working in some instances.
ronin-ruby_ronin
train
rb
2467c4a4611e5b612085bc9ef82a35bf3376842f
diff --git a/tdigest/tdigest.py b/tdigest/tdigest.py index <HASH>..<HASH> 100644 --- a/tdigest/tdigest.py +++ b/tdigest/tdigest.py @@ -1,7 +1,7 @@ from random import shuffle, choice import bisect from operator import itemgetter -from bintrees import FastBinaryTree as BinaryTree +from bintrees import FastRBTree as RBTree class Centroid(object): @@ -25,7 +25,7 @@ class Centroid(object): class TDigest(object): def __init__(self, delta=0.01, K=100): - self.C = BinaryTree() + self.C = RBTree() self.n = 0 self.delta = delta self.K = K
Use RBTrees as they are balanced. See issue #5 for the details here.
CamDavidsonPilon_tdigest
train
py
f71a964cdddb9195aff10e85b45f7c504cd2ca9f
diff --git a/docker/docker_image_src.go b/docker/docker_image_src.go index <HASH>..<HASH> 100644 --- a/docker/docker_image_src.go +++ b/docker/docker_image_src.go @@ -79,7 +79,7 @@ func newImageSource(ctx context.Context, sys *types.SystemContext, ref dockerRef // Found the registry within the sysregistriesv2 configuration. Now we test // all endpoints for the manifest availability. If a working image source // was found, it will be used for all future pull actions. - var manifestLoadErr error + manifestLoadErr := errors.New("Internal error: newImageSource returned without trying any endpoint") for _, endpoint := range append(registry.Mirrors, registry.Endpoint) { logrus.Debugf("Trying to pull %q from endpoint %q", ref.ref, endpoint.Location)
Make very sure that newImageSource can never fail with a nil error. This can never happen with the current code, but making sure that will continue to be the case in the future does not cost any extra lines.
containers_image
train
go
1e07245dc60425011700ed236d5740d2ad64bdf0
diff --git a/lib/validator.js b/lib/validator.js index <HASH>..<HASH> 100644 --- a/lib/validator.js +++ b/lib/validator.js @@ -186,7 +186,7 @@ Specberus.prototype.loadURL = function (url, cb) { sua.get(url) .set("User-Agent", "Specberus/" + require("../package.json").version + " Node/" + process.version + " by sexy Robin") .end(function (err, res) { - if (err) return cb(err); + if (err) return self.throw(err.message); if (!res.text) return self.throw("Body of " + url + " is empty."); self.url = url; self.loadSource(res.text, cb);
Fixed case when URL is inaccessible (it was still crashing).
w3c_specberus
train
js
28b18f416f159f0828ecd722258f07e19c2a967a
diff --git a/pkg/util/util.go b/pkg/util/util.go index <HASH>..<HASH> 100644 --- a/pkg/util/util.go +++ b/pkg/util/util.go @@ -407,12 +407,12 @@ func chooseHostInterfaceNativeGo() (net.IP, error) { if i == len(intfs) { return nil, err } - glog.V(2).Infof("Choosing interface %s for from-host portals", intfs[i].Name) + glog.V(4).Infof("Choosing interface %s for from-host portals", intfs[i].Name) addrs, err := intfs[i].Addrs() if err != nil { return nil, err } - glog.V(2).Infof("Interface %s = %s", intfs[i].Name, addrs[0].String()) + glog.V(4).Infof("Interface %s = %s", intfs[i].Name, addrs[0].String()) ip, _, err := net.ParseCIDR(addrs[0].String()) if err != nil { return nil, err
Tone down logging in network interface choosing
kubernetes_kubernetes
train
go
abf1dc5c341d89ec2884cde802fc15eaa940b741
diff --git a/controller/internal/enforcer/nfqdatapath/datapath.go b/controller/internal/enforcer/nfqdatapath/datapath.go index <HASH>..<HASH> 100644 --- a/controller/internal/enforcer/nfqdatapath/datapath.go +++ b/controller/internal/enforcer/nfqdatapath/datapath.go @@ -125,6 +125,12 @@ func New( zap.L().Fatal("Failed to set conntrack options", zap.Error(err)) } + if mode == constants.LocalServer { + cmd = exec.Command(sysctlCmd, "-w", "net.ipv4.ip_early_demux=0") + if err := cmd.Run(); err != nil { + zap.L().Fatal("Failed to set early demux options", zap.Error(err)) + } + } } // This cache is shared with portSetInstance. The portSetInstance
Disable early demux to avoid the kernel bug (#<I>)
aporeto-inc_trireme-lib
train
go
ce09bb1114ae520d9448a66d98379438b32266f1
diff --git a/geometry.go b/geometry.go index <HASH>..<HASH> 100644 --- a/geometry.go +++ b/geometry.go @@ -348,12 +348,12 @@ func (m Matrix) Rotated(around Vec, angle float64) Matrix { // after the transformations of this Matrix. func (m Matrix) Chained(next Matrix) Matrix { return Matrix{ - m[0]*next[0] + m[2]*next[1], - m[1]*next[0] + m[3]*next[1], - m[0]*next[2] + m[2]*next[3], - m[1]*next[2] + m[3]*next[3], - m[0]*next[4] + m[2]*next[5] + m[4], - m[1]*next[4] + m[3]*next[5] + m[5], + next[0]*m[0] + next[2]*m[1], + next[1]*m[0] + next[3]*m[1], + next[0]*m[2] + next[2]*m[3], + next[1]*m[2] + next[3]*m[3], + next[0]*m[4] + next[2]*m[5] + next[4], + next[1]*m[4] + next[3]*m[5] + next[5], } }
fix Matrix.Chained (wrong order of composition)
faiface_pixel
train
go
28da20e4f3f4b6f6557b1daf2ef3d417e2fb649e
diff --git a/src/main/java/com/technophobia/substeps/runner/builder/SubstepNodeBuilder.java b/src/main/java/com/technophobia/substeps/runner/builder/SubstepNodeBuilder.java index <HASH>..<HASH> 100644 --- a/src/main/java/com/technophobia/substeps/runner/builder/SubstepNodeBuilder.java +++ b/src/main/java/com/technophobia/substeps/runner/builder/SubstepNodeBuilder.java @@ -136,8 +136,9 @@ public class SubstepNodeBuilder { final SubstepNode substepNode = build(scenarioDescription, substepsParent.getSteps(), subStepsMapLocal, substepsParent, parametersForSubSteps, throwExceptionIfUnableToBuildMethodArgs, tags, depth); - - substepNode.setLine(substepsParent.getParent().getParameterLine()); + // Change TPCLA-299 + // substepNode.setLine(substepsParent.getParent().getParameterLine()); + substepNode.setLine(step.getLine()); substepNode.setFileUri(substepsParent.getSubStepFileUri()); substepNode.setLineNumber(substepsParent.getSourceLineNumber()); return substepNode;
TPCLA-<I> Fix on the logging of the substeps
G2G3Digital_substeps-framework
train
java
3fb15ac13a0c7c2da23fef8e17259b60976ab872
diff --git a/nodeconductor/core/admin.py b/nodeconductor/core/admin.py index <HASH>..<HASH> 100644 --- a/nodeconductor/core/admin.py +++ b/nodeconductor/core/admin.py @@ -107,8 +107,8 @@ class UserAdmin(auth_admin.UserAdmin): return format_html_join( mark_safe('<br/>'), - '{}', - ((str(permission),) for permission in permissions), + '<a href={}>{}</a>', + ((get_admin_url(permission.customer), str(permission)) for permission in permissions), ) or mark_safe("<span class='errors'>%s</span>" % _('User has no roles in any organization.')) customer_roles.short_description = _('Roles in organizations') @@ -119,8 +119,8 @@ class UserAdmin(auth_admin.UserAdmin): return format_html_join( mark_safe('<br/>'), - '{}', - ((str(permission),) for permission in permissions), + '<a href={}>{}</a>', + ((get_admin_url(permission.project), str(permission)) for permission in permissions), ) or mark_safe("<span class='errors'>%s</span>" % _('User has no roles in any project.')) project_roles.short_description = _('Roles in projects')
Add links for customer, project roles in user profiles - WAL-<I>
opennode_waldur-core
train
py
2ab58a32d7e125e4da9c8a1ea9ff069014875c3f
diff --git a/export.js b/export.js index <HASH>..<HASH> 100644 --- a/export.js +++ b/export.js @@ -665,13 +665,13 @@ function addNestedIncludesTypeConstraints(specs, ns, addSubElements=true) { function addIncludesCodeConstraints(specs, ns, addSubElements=true) { let de = new mdl.DataElement(id(ns, 'IncludesCodesList'), true) .withDescription('An entry with a includes codes constraint.') - .withValue(new mdl.IdentifiableValue(id(ns, 'Coded')).withMinMax(0) + .withValue(new mdl.IdentifiableValue(id('shr.core', 'CodeableConcept')).withMinMax(0) .withConstraint(new mdl.IncludesCodeConstraint(new mdl.Concept('http://foo.org', 'bar', 'Foobar'))) .withConstraint(new mdl.IncludesCodeConstraint(new mdl.Concept('http://boo.org', 'far', 'Boofar'))) ); add(specs, de); if (addSubElements) { - addCodedElement(specs, ns); + addCodeableConcept(specs, addSubElements); } return de; }
Fix IncludesCodeConstraints test case
standardhealth_shr-test-helpers
train
js
3376236714341d436bac5346de3c147baa0e39f8
diff --git a/tests/TestData/TestLogger.php b/tests/TestData/TestLogger.php index <HASH>..<HASH> 100644 --- a/tests/TestData/TestLogger.php +++ b/tests/TestData/TestLogger.php @@ -15,9 +15,14 @@ class TestLogger extends AbstractLogger { protected $logStorage= []; + public function countLogs() + { + return count($this->logStorage); + } + public function log($level, $message, array $context = array()) { - $storage[] = [ + $this->logStorage[] = [ 'level' => $level, 'message' => $message, // 'context' => $context
More proof I should be sticking to TDD
AyeAyeApi_Api
train
php
2779187d8cfee7e79a7157e37682229b92753bc8
diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/filetransfer/FileTransfer.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/filetransfer/FileTransfer.java index <HASH>..<HASH> 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/filetransfer/FileTransfer.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/filetransfer/FileTransfer.java @@ -183,6 +183,10 @@ public abstract class FileTransfer { protected void setException(Exception exception) { this.exception = exception; + Status currentStatus = getStatus(); + if (currentStatus != Status.error) { + updateStatus(currentStatus, Status.error); + } } protected void setStatus(Status status) {
[filetransfer] Set the status to error in setException() FileTransfer would previously not change the status, even though an exception has been set, leading users to believe that the transfer is still ongoing, when it is not.
igniterealtime_Smack
train
java
6f564dd6fffc2cf03de02be71818b2f3bf86595e
diff --git a/jmetal-core/src/main/java/org/uma/jmetal/util/pseudorandom/PseudoRandomGenerator.java b/jmetal-core/src/main/java/org/uma/jmetal/util/pseudorandom/PseudoRandomGenerator.java index <HASH>..<HASH> 100644 --- a/jmetal-core/src/main/java/org/uma/jmetal/util/pseudorandom/PseudoRandomGenerator.java +++ b/jmetal-core/src/main/java/org/uma/jmetal/util/pseudorandom/PseudoRandomGenerator.java @@ -20,4 +20,6 @@ package org.uma.jmetal.util.pseudorandom; public interface PseudoRandomGenerator { public int nextInt(int lowerBound, int upperBound) ; public double nextDouble(double lowerBound, double upperBound) ; + public void setSeed(long seed) ; + public long getSeed() ; }
Refactoring JMetalRandom
jMetal_jMetal
train
java
2a596d441c75d45cd1843a6847d57f4e99b4e142
diff --git a/gandi/cli/modules/account.py b/gandi/cli/modules/account.py index <HASH>..<HASH> 100644 --- a/gandi/cli/modules/account.py +++ b/gandi/cli/modules/account.py @@ -35,6 +35,9 @@ class Account(GandiModule): account = cls.info() creditusage = cls.creditusage() + if not creditusage: + return account + left = account['credits'] / creditusage years, hours = divmod(left, 365 * 24) months, hours = divmod(hours, 31 * 24)
Sometimes rating doesn't return value for credit usage. This fixes a bug generating a Traceback when no value from API rating was returned.
Gandi_gandi.cli
train
py
7eb62ddf958dcb2c6eb7aa2893bf9fd143d1c30b
diff --git a/devassistant/loaded_yaml.py b/devassistant/loaded_yaml.py index <HASH>..<HASH> 100644 --- a/devassistant/loaded_yaml.py +++ b/devassistant/loaded_yaml.py @@ -79,9 +79,8 @@ class LoadedYaml(object): if not isinstance(struct, typ): err = [] if path: - err.append('In {p}:'.format(p=path[0])) - if len(path) > 1: - err.append(' -> '.join(path[1:])) + err.append('Source file {p}:'.format(p=path[0])) + err.append(' Problem in: ' + ' -> '.join(['(top level)'] + path[1:] + [name])) err.append('"{n}" has to be Yaml {w}, not {a}.'.format(n=name, w=wanted_yaml_typename, a=actual_yaml_typename))
Improve the format of reported yaml structure errors
devassistant_devassistant
train
py
8e6d1f55e2f7bc178b30c9c1cdb770d8ad625eb2
diff --git a/activesupport/lib/active_support/log_subscriber.rb b/activesupport/lib/active_support/log_subscriber.rb index <HASH>..<HASH> 100644 --- a/activesupport/lib/active_support/log_subscriber.rb +++ b/activesupport/lib/active_support/log_subscriber.rb @@ -115,13 +115,9 @@ module ActiveSupport end end - %w(info debug warn error fatal unknown).each do |level| - class_eval <<-METHOD, __FILE__, __LINE__ + 1 - private def subscribe_log_level(method, level) - self.log_levels = log_levels.merge(method => ::Logger.const_get(level.upcase)) - set_event_levels - end - METHOD + def subscribe_log_level(method, level) + self.log_levels = log_levels.merge(method => ::Logger.const_get(level.upcase)) + set_event_levels end end
Remove unnecessary class_eval from log_subscriber.rb
rails_rails
train
rb
5bc41b8e1de746ec3c713d70caf62142b283e683
diff --git a/lib/xcodeproj/project/object.rb b/lib/xcodeproj/project/object.rb index <HASH>..<HASH> 100644 --- a/lib/xcodeproj/project/object.rb +++ b/lib/xcodeproj/project/object.rb @@ -202,6 +202,18 @@ module Xcodeproj def inspect "#<#{isa} UUID: `#{uuid}', name: `#{name}'>" end + + def matches_attributes?(attributes) + attributes.all? do |attribute, expected_value| + return nil unless respond_to?(attribute) + + if expected_value.is_a?(Hash) + send(attribute).matches_attributes?(expected_value) + else + send(attribute) == expected_value + end + end + end private diff --git a/lib/xcodeproj/project/object_list.rb b/lib/xcodeproj/project/object_list.rb index <HASH>..<HASH> 100644 --- a/lib/xcodeproj/project/object_list.rb +++ b/lib/xcodeproj/project/object_list.rb @@ -63,6 +63,10 @@ module Xcodeproj "<PBXObjectList: #{map(&:inspect)}>" end + def where(attributes) + find { |o| o.matches_attributes?(attributes) } + end + def object_named(name) find { |o| o.name == name } end
Added fluent querying to objects and object lists. e.g. target.files.where(:name => "MyFile.m")
CocoaPods_Xcodeproj
train
rb,rb
49f8198a9cbf73b69d88a50d743e67c8232d99de
diff --git a/lib/cancan/controller_resource_loader.rb b/lib/cancan/controller_resource_loader.rb index <HASH>..<HASH> 100644 --- a/lib/cancan/controller_resource_loader.rb +++ b/lib/cancan/controller_resource_loader.rb @@ -32,7 +32,7 @@ module CanCan def resource_params_by_namespaced_name resource_params_by_key(:instance_name) || resource_params_by_key(:class) || ( params = @params[extract_key(namespaced_name)] - params.is_a?(Hash) ? params : nil) + params.respond_to?(:to_h) ? params : nil) end def resource_params
fixes an issue caused by strong parameters (#<I>)
CanCanCommunity_cancancan
train
rb
a79489a2eb90af2c68da591c895fa92b1153777a
diff --git a/scoop/launch/brokerLaunch.py b/scoop/launch/brokerLaunch.py index <HASH>..<HASH> 100644 --- a/scoop/launch/brokerLaunch.py +++ b/scoop/launch/brokerLaunch.py @@ -106,13 +106,16 @@ class remoteBroker(object): brokerString += "--debug " self.hostname = hostname for i in range(5000, 10000, 2): - self.shell = subprocess.Popen(self.BASE_SSH - + [hostname] - + [brokerString.format(brokerPort=i, - infoPort=i + 1, - pythonExec=pythonExecutable, - )], - # stdin=subprocess.PIPE, + cmd = self.BASE_SSH + [ + hostname, + brokerString.format(brokerPort=i, + infoPort=i + 1, + pythonExec=pythonExecutable, + ) + ] + scoop.logger.debug("Launching remote broker: {cmd}" + "".format(cmd=" ".join(cmd))) + self.shell = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, )
+ Improved remote broker debug info
soravux_scoop
train
py
e684ab1959d23ebfad207dcee3790dbe8a8bfbb6
diff --git a/Model/Posting.php b/Model/Posting.php index <HASH>..<HASH> 100644 --- a/Model/Posting.php +++ b/Model/Posting.php @@ -68,6 +68,21 @@ abstract class Posting protected $postedAt; /** + * Constructor + * + * @author Tom Haskins-Vaughan <tom@tomhv.uk> + * @since 1.0.0 + * + * @param AccountInterface $account + * @param float $amount + */ + public function __construct(AccountInterface $account, $amount) + { + $this->setAccount($account); + $this->setAmount($amount); + } + + /** * Get id * * @author Tom Haskins-Vaughan <tom@harvestcloud.com>
Added Posting::__constructor() that takes Account and amount
phospr_DoubleEntryBundle
train
php
04d66013aef421d83430feb6708f55aefc7daa05
diff --git a/modules/pubmaticBidAdapter.js b/modules/pubmaticBidAdapter.js index <HASH>..<HASH> 100644 --- a/modules/pubmaticBidAdapter.js +++ b/modules/pubmaticBidAdapter.js @@ -306,7 +306,7 @@ export const spec = { // Attaching GDPR Consent Params in UserSync url if (gdprConsent) { syncurl += '&gdpr=' + (gdprConsent.gdprApplies ? 1 : 0); - syncurl += '&consent=' + encodeURIComponent(gdprConsent.consentString || ''); + syncurl += '&gdpr_consent=' + encodeURIComponent(gdprConsent.consentString || ''); } if (syncOptions.iframeEnabled) {
Update the consent param in userSync as per IAB Spec (#<I>)
prebid_Prebid.js
train
js
26fe3bbcef476e7e86270073f76ca3561e76f036
diff --git a/lib/zk/client/conveniences.rb b/lib/zk/client/conveniences.rb index <HASH>..<HASH> 100644 --- a/lib/zk/client/conveniences.rb +++ b/lib/zk/client/conveniences.rb @@ -73,7 +73,8 @@ module ZK # # @return the return value of the given block # - # @yield calls the block once the lock has been acquired + # @yield [lock] calls the block once the lock has been acquired with the + # lock instance # # @example # diff --git a/lib/zk/locker/locker_base.rb b/lib/zk/locker/locker_base.rb index <HASH>..<HASH> 100644 --- a/lib/zk/locker/locker_base.rb +++ b/lib/zk/locker/locker_base.rb @@ -65,9 +65,10 @@ module ZK # # there is no non-blocking version of this method # + # @yield [lock] calls the block with the lock instance when acquired def with_lock lock(true) - yield + yield self ensure unlock end
make with_lock yield the locker instance to the block will help with calling lock.assert! when using zk.with_lock()
zk-ruby_zk
train
rb,rb
adf98376a977e87adc9a7aecbd1b989abd7f80b8
diff --git a/test/unit/test_host.rb b/test/unit/test_host.rb index <HASH>..<HASH> 100644 --- a/test/unit/test_host.rb +++ b/test/unit/test_host.rb @@ -65,8 +65,12 @@ module SSHKit end def test_assert_hosts_compare_equal - assert Host.new('example.com').eql? Host.new('example.com') - assert Host.new('example.com').equal? Host.new('example.com') + h1 = Host.new('example.com') + h2 = Host.new('example.com') + + assert h1 == h2 + assert h1.eql? h2 + assert h1.equal? h2 end def test_arbitrary_host_properties
Refactor TestHost#test_assert_hosts_compare_equal * Use two variables to appease rubocop linting * Only instantiate two hosts instead of six
capistrano_sshkit
train
rb
89d89496794d9e3876422235756e7607df364e70
diff --git a/plugins.js b/plugins.js index <HASH>..<HASH> 100644 --- a/plugins.js +++ b/plugins.js @@ -105,21 +105,23 @@ plugins.load_plugin = function(name) { var plugin = new Plugin(name); var fp = plugin.full_paths, - rf; + rf, last_err; for (var i=0, j=fp.length; i<j; i++) { try { rf = fs.readFileSync(fp[i]); break; - } catch(err) { + } + catch (err) { + last_err = err; continue; } } if (!rf) { if (config.get('smtp.ini', 'ini').main.ignore_bad_plugins) { - logger.logcrit("Loading plugin " + name + " failed."); + logger.logcrit("Loading plugin " + name + " failed: " + last_err); return; } - throw "Loading plugin " + name + " failed."; + throw "Loading plugin " + name + " failed: " + last_err; } var code = constants_str + rf; var sandbox = {
Properly log the error if the plugin couldn't be loaded
haraka_Haraka
train
js
28e2e67e63053e88d5b90e62b2f31f557e7dbea9
diff --git a/anyconfig/compat.py b/anyconfig/compat.py index <HASH>..<HASH> 100644 --- a/anyconfig/compat.py +++ b/anyconfig/compat.py @@ -34,17 +34,6 @@ def py3_iteritems(dic): return dic.items() -def py_iteritems(dic): - """wrapper for dict.iteritems() in python < 3.x - - >>> list(py_iteritems({})) - [] - >>> sorted(py_iteritems(dict(a=1, b=2))) - [('a', 1), ('b', 2)] - """ - return dic.iteritems() - - def py3_cmp(a, b): """ >>> py3_cmp(0, 2) @@ -78,6 +67,16 @@ else: assert configparser # silence pyflakes assert StringIO # ditto + def py_iteritems(dic): + """wrapper for dict.iteritems() in python < 3.x + + >>> list(py_iteritems({})) + [] + >>> sorted(py_iteritems(dict(a=1, b=2))) + [('a', 1), ('b', 2)] + """ + return dic.iteritems() + iteritems = py_iteritems cmp = cmp
move py_iteritems() into the block not run in python 3, in anyconfig.compat; dict in python 3 does not have iteritems method
ssato_python-anyconfig
train
py
4262cc06928594d6588ada8fbcff492d66cf7349
diff --git a/openpnm/core/Subdomain.py b/openpnm/core/Subdomain.py index <HASH>..<HASH> 100644 --- a/openpnm/core/Subdomain.py +++ b/openpnm/core/Subdomain.py @@ -54,6 +54,10 @@ class Subdomain(Base): boss = self._get_boss() element = self._parse_element(element=element, single=True) + # Make sure label array exists in boss + if (element+'.'+self.name) not in boss.keys(): + boss[element+'.'+self.name] = False + # Check to ensure indices aren't already assigned if mode == 'add': if self._isa('geometry'): @@ -78,6 +82,10 @@ class Subdomain(Base): self.update({item: boss[item][mask]}) # Update label array in network boss[element+'.'+self.name] = mask + # Remove label from boss if ALL locations are removed + if mode == 'drop': + if ~np.any(boss[element+'.'+self.name]): + del boss[element+'.'+self.name] def _get_boss(self): if self._isa('physics'):
Fixing _set_locations to remove label array is empty
PMEAL_OpenPNM
train
py
e0db4d4b62c5ed2dbf29227237a4c3222fcc1cec
diff --git a/tests/run.go b/tests/run.go index <HASH>..<HASH> 100644 --- a/tests/run.go +++ b/tests/run.go @@ -105,6 +105,13 @@ var knownFails = map[string]failReason{ "fixedbugs/issue22083.go": {category: requiresSourceMapSupport}, // Technically, added in Go 1.9.2. "fixedbugs/issue22660.go": {category: notApplicable, desc: "test of gc compiler, uses os/exec.Command"}, "fixedbugs/issue23305.go": {desc: "GopherJS fails to compile println(0xffffffff), maybe because 32-bit arch"}, + + // These are new tests in Go 1.11. + "fixedbugs/issue21221.go": {category: usesUnsupportedPackage, desc: "uses unsafe package and compares nil pointers"}, + "fixedbugs/issue22662.go": {desc: "line directives not fully working. Error: got /private/var/folders/b8/66r1c5856mqds1mrf2tjtq8w0000gn/T:1; want ??:1"}, + "fixedbugs/issue22662b.go": {category: usesUnsupportedPackage, desc: "os/exec.Command unsupported"}, + "fixedbugs/issue23188.go": {desc: "incorrect order of evaluation of index operations"}, + "fixedbugs/issue24547.go": {desc: "incorrect computing method sets with shadowed methods"}, } type failCategory uint8
tests: Triage test failures new to Go <I>.
gopherjs_gopherjs
train
go
773aa24512f3cf0bcd0f1cc8899515c046be59d1
diff --git a/ui/src/dashboards/components/TemplateVariableRow.js b/ui/src/dashboards/components/TemplateVariableRow.js index <HASH>..<HASH> 100644 --- a/ui/src/dashboards/components/TemplateVariableRow.js +++ b/ui/src/dashboards/components/TemplateVariableRow.js @@ -196,6 +196,7 @@ class RowWrapper extends Component { this.state = { isEditing: !!isNew, + isNew, selectedType: type, selectedDatabase: query && query.db, selectedMeasurement: query && query.measurement, @@ -222,7 +223,7 @@ class RowWrapper extends Component { return async e => { e.preventDefault() - this.setState({isEditing: false}) + this.setState({isEditing: false, isNew: false}) const label = e.target.label.value const tempVar = e.target.tempVar.value @@ -281,7 +282,13 @@ class RowWrapper extends Component { } handleCancelEdit() { - const {template: {type, query: {db, measurement, tagKey}}} = this.props + const { + template: {type, query: {db, measurement, tagKey}, isNew, id}, + onDelete, + } = this.props + if (isNew) { + return onDelete(id) + } this.setState({ selectedType: type, selectedDatabase: db,
Delete a new template on cancel
influxdata_influxdb
train
js
9d3efa0c72f930adb5ae846b35dc7b7d0cb05d59
diff --git a/hooks-admin.php b/hooks-admin.php index <HASH>..<HASH> 100644 --- a/hooks-admin.php +++ b/hooks-admin.php @@ -94,7 +94,7 @@ if ( \PressBooks\Book::isBook() ) { // Custom user profile // ------------------------------------------------------------------------------------------------------------------- -add_action( 'admin_init', '\PressBooks\Admin\Metaboxes\add_user_meta' ); +add_action( 'custom_metadata_manager_init_metadata', '\PressBooks\Admin\Metaboxes\add_user_meta' ); // ------------------------------------------------------------------------------------------------------------------- // Ajax
Fix: Custom user meta was missing.
pressbooks_pressbooks
train
php
81a373ead5e1d99cbe6febaf35716fe2e206c0c7
diff --git a/pkg/chartutil/capabilities.go b/pkg/chartutil/capabilities.go index <HASH>..<HASH> 100644 --- a/pkg/chartutil/capabilities.go +++ b/pkg/chartutil/capabilities.go @@ -28,12 +28,10 @@ import ( helmversion "helm.sh/helm/v3/internal/version" ) -const ( +var ( k8sVersionMajor = 1 k8sVersionMinor = 20 -) -var ( // DefaultVersionSet is the default version set, which includes only Core V1 ("v1"). DefaultVersionSet = allKnownVersions() diff --git a/pkg/lint/rules/deprecations.go b/pkg/lint/rules/deprecations.go index <HASH>..<HASH> 100644 --- a/pkg/lint/rules/deprecations.go +++ b/pkg/lint/rules/deprecations.go @@ -25,7 +25,7 @@ import ( kscheme "k8s.io/client-go/kubernetes/scheme" ) -const ( +var ( // This should be set in the Makefile based on the version of client-go being imported. // These constants will be overwritten with LDFLAGS k8sVersionMajor = 1
allow ldflags to overwrite k8s version
helm_helm
train
go,go
d8946d10e121ee4349f16a9da0d0c63465df7c12
diff --git a/tests/UserApp/ClientProxyTest.php b/tests/UserApp/ClientProxyTest.php index <HASH>..<HASH> 100644 --- a/tests/UserApp/ClientProxyTest.php +++ b/tests/UserApp/ClientProxyTest.php @@ -121,6 +121,10 @@ $this->_proxy->user->get($arguments); } + public function testDefinitiveFail(){ + $this->assertTrue(false); + } + public function teardown(){ $this->_transport->assertEmptyQueue(); }
Testing TravisCI by submitting failing test
userapp-io_userapp-php
train
php
4c02eaaeb23b377fd03817fed566600bcdc2f95c
diff --git a/more_itertools/more.py b/more_itertools/more.py index <HASH>..<HASH> 100644 --- a/more_itertools/more.py +++ b/more_itertools/more.py @@ -1,3 +1,5 @@ +from __future__ import print_function + from functools import partial, wraps from itertools import izip_longest from recipes import * @@ -177,7 +179,7 @@ def consumer(func): ... def tally(): ... i = 0 ... while True: - ... print 'Thing number %s is %s.' % (i, (yield)) + ... print('Thing number %s is %s.' % (i, (yield))) ... i += 1 ... >>> t = tally()
Use print function for future aesthetic and compatibility
erikrose_more-itertools
train
py
cbf52e4d7392ba7d8bbf105703168b1210d78e68
diff --git a/src/module/view.js b/src/module/view.js index <HASH>..<HASH> 100644 --- a/src/module/view.js +++ b/src/module/view.js @@ -334,6 +334,11 @@ define(function(require, exports, module) { 'selectionchange layoutallfinish': function(e) { var selected = this.getSelectedNode(); + /* + * Added by zhangbobell 2015.9.9 + * windows 10 的 edge 浏览器在全部动画停止后,优先级图标不显示 text, + * 因此再次触发一次 render 事件,让浏览器重绘 + * */ if (kity.Browser.edge) { this.fire('paperrender'); }
add some comments about win<I> edge
fex-team_kityminder-core
train
js
7cd487ceb596df9ed6b4db0b00445e10d688c67a
diff --git a/src/View/Helper/CalendarHelper.php b/src/View/Helper/CalendarHelper.php index <HASH>..<HASH> 100644 --- a/src/View/Helper/CalendarHelper.php +++ b/src/View/Helper/CalendarHelper.php @@ -92,7 +92,7 @@ class CalendarHelper extends Helper { $days = [ ]; $count = 0; - while ($from < $to) { + while ($from <= $to) { if ($from->month === $month) { $days[$count] = $this->retrieveDayFromDate($from); }
Fix 2-days long but < <I>h events
dereuromark_cakephp-calendar
train
php
280c54d78a72f37154fc5bbb2578f84fae0ac6f1
diff --git a/tile_generator/pcf.py b/tile_generator/pcf.py index <HASH>..<HASH> 100755 --- a/tile_generator/pcf.py +++ b/tile_generator/pcf.py @@ -150,7 +150,14 @@ def install_cmd(product, version): payload = { 'to_version': version } - opsmgr.put('/api/installation_settings/products/' + matches[0]['guid'], payload) + response = opsmgr.put('/api/installation_settings/products/' + matches[0]['guid'], payload, check=False) + if response.status_code == 422: + errors = response.json()["errors"] + for error in errors: + if error.endswith(' is already in use.'): + print('-','version already installed') + return + opsmgr.check_response(response) @cli.command('uninstall') @click.argument('product')
pcf isntall succeeds when version is already installed
cf-platform-eng_tile-generator
train
py
d879fc7c3ed9190fa5e64ace43cf367d8a4cf126
diff --git a/shinken/external_command.py b/shinken/external_command.py index <HASH>..<HASH> 100644 --- a/shinken/external_command.py +++ b/shinken/external_command.py @@ -1297,9 +1297,14 @@ class ExternalCommandManager: return i = host.launch_check(now, force=True) - for chk in host.actions: + c = None + for chk in host.checks_in_progress: if chk.id == i: c = chk + # Should not be possible to not find the check, but if so, don't crash + if not c: + console_logger.error('Passive host check failed. Cannot find the check id %s' % i) + return # Now we 'transform the check into a result' # So exit_status, output and status is eaten by the host c.exit_status = status_code @@ -1330,10 +1335,15 @@ class ExternalCommandManager: if self.current_timestamp < service.last_chk: return + c = None i = service.launch_check(now, force=True) - for chk in service.actions: + for chk in service.checks_in_progress: if chk.id == i: c = chk + # Should not be possible to not find the check, but if so, don't crash + if not c: + console_logger.error('Passive service check failed. Cannot find the check id %s' % i) + return # Now we 'transform the check into a result' # So exit_status, output and status is eaten by the service c.exit_status = return_code
Fix: get back PROCESS_SERVICE_CHECK_RESULT and PROCESS_HOST_CHECK_RESULT work after check_in_progress and force checks enhancement.
Alignak-monitoring_alignak
train
py
47d4d30e41a3fbdaee8a1a5586d8bee4d1637b71
diff --git a/src/main/webapp/js/Plugins/propertywindow.js b/src/main/webapp/js/Plugins/propertywindow.js index <HASH>..<HASH> 100644 --- a/src/main/webapp/js/Plugins/propertywindow.js +++ b/src/main/webapp/js/Plugins/propertywindow.js @@ -1833,7 +1833,20 @@ Ext.form.ComplexDataAssignmenField = Ext.extend(Ext.form.TriggerField, { tostr: "", dataType: dataType })); - } + } else { + // default to equality + var dataType = dataTypeMap[nextPart]; + if (!dataType){ + dataType = "java.lang.String"; + } + dataassignments.add(new DataAssignment({ + from: nextPart, + type: "is equal to", + to: "", + tostr: "", + dataType: dataType + })); + } } }
fix assignments sring parsing in editor
kiegroup_jbpm-designer
train
js
848599090f920b30b532007659f8f513bb885a50
diff --git a/pyemu/utils/pst_from.py b/pyemu/utils/pst_from.py index <HASH>..<HASH> 100644 --- a/pyemu/utils/pst_from.py +++ b/pyemu/utils/pst_from.py @@ -1760,9 +1760,9 @@ class PstFrom(object): if lower_bound >= upper_bound: self.logger.lraise("lower_bound {0} >= upper_bound {1}".format(lower_bound,upper_bound)) - if lower_bound > initial_value: + if par_style != "d" and lower_bound > initial_value: self.logger.lraise("lower_bound {0} > initial_value {1}".format(lower_bound,initial_value)) - if upper_bound < initial_value: + if par_style != "d" and upper_bound < initial_value: self.logger.lraise("upper_bound {0} < initial_value {1}".format(upper_bound,initial_value))
added a few more checks for agreement with bounds and initial value in pstfrom add_pars()
jtwhite79_pyemu
train
py
e5e797bf3a8894875f28809a2707beae5b74594f
diff --git a/lib/ohai/plugins/freebsd/virtualization.rb b/lib/ohai/plugins/freebsd/virtualization.rb index <HASH>..<HASH> 100644 --- a/lib/ohai/plugins/freebsd/virtualization.rb +++ b/lib/ohai/plugins/freebsd/virtualization.rb @@ -44,7 +44,7 @@ Ohai.plugin do # XXX doesn't work when jail is there but not running (ezjail-admin stop) - if ( from( "jls -n" ) || "" ).split( /\r?\n/ ).count >= 1 + if ( from( "jls -n" ) || "" ).split( $/ ).count >= 1 virtualization[:system] = "jail" virtualization[:role] = "host" end
Moved to the platform specific line break
chef_ohai
train
rb
4a2757ccbdd930926475bd291553f07423c144b3
diff --git a/upload/install/controller/upgrade/upgrade_8.php b/upload/install/controller/upgrade/upgrade_8.php index <HASH>..<HASH> 100644 --- a/upload/install/controller/upgrade/upgrade_8.php +++ b/upload/install/controller/upgrade/upgrade_8.php @@ -91,7 +91,7 @@ class Upgrade8 extends \Opencart\System\Engine\Controller { } // Config Session Expire - $query = $this->db->query("SELECT * FROM `setting` WHERE `key` = 'config_session_expire'"); + $query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "setting` WHERE `key` = 'config_session_expire'"); if (!$query->num_rows) { $this->db->query("INSERT INTO `" . DB_PREFIX . "setting` SET `store_id` = '0', `code` = 'config', `key` = 'config_session_expire', `value` = '3600000000', `serialized` = '0'");
Added one more DB_PREFIX on setting
opencart_opencart
train
php
b56ba62ec8ba142446686d127fb0b7ea39f1375f
diff --git a/src/Bartlett/Reflect/Output/Analyser.php b/src/Bartlett/Reflect/Output/Analyser.php index <HASH>..<HASH> 100644 --- a/src/Bartlett/Reflect/Output/Analyser.php +++ b/src/Bartlett/Reflect/Output/Analyser.php @@ -95,12 +95,12 @@ class Analyser extends OutputFormatter continue; } $baseNamespace = str_replace( - 'Analyser\\' . basename($analyserName), + 'Analyser\\' . basename(str_replace('\\', '/', $analyserName)), '', $analyserName ); $outputFormatter = $baseNamespace . 'Console\Formatter\\' . - substr(basename($analyserName), 0, -8) . 'OutputFormatter'; + substr(basename(str_replace('\\', '/', $analyserName)), 0, -8) . 'OutputFormatter'; if (class_exists($outputFormatter)) { $obj = new $outputFormatter();
fix missing output in CLI (Thanks to Remi Collet for his patch)
llaville_php-reflect
train
php
05bac40206756e5411c40fd00d17fb11c9e1c838
diff --git a/lib/Doctrine/ODM/CouchDB/UnitOfWork.php b/lib/Doctrine/ODM/CouchDB/UnitOfWork.php index <HASH>..<HASH> 100644 --- a/lib/Doctrine/ODM/CouchDB/UnitOfWork.php +++ b/lib/Doctrine/ODM/CouchDB/UnitOfWork.php @@ -66,17 +66,6 @@ class UnitOfWork } /** - * Create the array data structure to be stored as the doctrine metadata inside CouchDB documents - * - * @param string $documentName - * @return array - */ - protected function getDoctrineMetadata($documentName) - { - return array('type' => $documentName); - } - - /** * Create a document given class, data and the doc-id and revision * * @param string $documentName @@ -95,7 +84,7 @@ class UnitOfWork } else if (isset($documentName)) { $type = $documentName; if ($this->dm->getConfiguration()->getWriteDoctrineMetadata()) { - $data['doctrine_metadata'] = $this->getDoctrineMetadata($documentName); + $data['doctrine_metadata'] = array('type' => $documentName); } } else { throw new \InvalidArgumentException("Missing Doctrine metadata in the Document, cannot hydrate (yet)!");
removed getDoctrineMetadata(), maybe we find a different way to manage the metadata structure stored in documents
doctrine_couchdb-odm
train
php
24b903ae0a7d6ba4bbb1ed9f69662cedec3f152c
diff --git a/tests/bootstrap.php b/tests/bootstrap.php index <HASH>..<HASH> 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -7,6 +7,7 @@ namespace namespace Cache\IntegrationTests { + // PSR-6 integration tests if (!class_exists('Cache\IntegrationTests\CachePoolTest')) { class CachePoolTest extends \PHPUnit_Framework_TestCase { @@ -19,4 +20,18 @@ namespace Cache\IntegrationTests } } } + + // PSR-16 integration tests + if (!class_exists('Cache\IntegrationTests\SimpleCacheTest')) { + class SimpleCacheTest extends \PHPUnit_Framework_TestCase + { + public function testIncomplete() + { + $this->markTestIncomplete( + 'Missing dependencies. Please run: '. + 'composer require --dev cache/integration-tests:dev-master' + ); + } + } + } }
Make sure tests don't fail when integration tests not loaded
matthiasmullie_scrapbook
train
php
02331bef86ebd013d227cdc771e3558c69f00f8c
diff --git a/js/bittrex.js b/js/bittrex.js index <HASH>..<HASH> 100644 --- a/js/bittrex.js +++ b/js/bittrex.js @@ -26,7 +26,6 @@ module.exports = class bittrex extends Exchange { 'fetchMyTrades': false, 'fetchOHLCV': true, 'fetchOrder': true, - 'fetchOrders': true, 'fetchOpenOrders': true, 'fetchTickers': true, 'withdraw': true, @@ -594,7 +593,7 @@ module.exports = class bittrex extends Exchange { return this.parseOrder (response['result']); } - async fetchOrders (symbol = undefined, since = undefined, limit = undefined, params = {}) { + async fetchClosedOrders (symbol = undefined, since = undefined, limit = undefined, params = {}) { await this.loadMarkets (); let request = {}; let market = undefined; @@ -609,11 +608,6 @@ module.exports = class bittrex extends Exchange { return orders; } - async fetchClosedOrders (symbol = undefined, since = undefined, limit = undefined, params = {}) { - let orders = await this.fetchOrders (symbol, since, limit, params); - return this.filterBy (orders, 'status', 'closed'); - } - async fetchDepositAddress (code, params = {}) { await this.loadMarkets (); let currency = this.currency (code);
removed bittrex fetchOrders (obsolete)
ccxt_ccxt
train
js
14ab0c379f4e42373f12b37cde0cfbf1d8f950e3
diff --git a/src/org/zaproxy/zap/view/TabbedPanel2.java b/src/org/zaproxy/zap/view/TabbedPanel2.java index <HASH>..<HASH> 100644 --- a/src/org/zaproxy/zap/view/TabbedPanel2.java +++ b/src/org/zaproxy/zap/view/TabbedPanel2.java @@ -339,7 +339,9 @@ public class TabbedPanel2 extends TabbedPanel { public void removeTab(AbstractPanel panel) { this.remove(panel); this.fullTabList.remove(panel); - this.removedTabList.remove(panel); + if (this.removedTabList.remove(panel)) { + handleHiddenTabListTab(); + } } /**
Update the state of "plus" tab menu when tabs are removed The "plus" icon would still be shown when the last hidden tab were removed (for example, after uninstallation of an add-on) even if no other tabs were hidden.
zaproxy_zaproxy
train
java
8c807ddff29e5007451b2cb8aeb47b7ab5cb9131
diff --git a/index.js b/index.js index <HASH>..<HASH> 100644 --- a/index.js +++ b/index.js @@ -35,8 +35,18 @@ module.exports = function (options) { recess(file.path, options, function (err, results) { if (err) { err.forEach(function (el) { - var recessError = new gutil.PluginError('gulp-recess', el, { - fileName: file.path, + var realError = new Error(el.message); + + // el is an instance of LessError, which does not inherit + // from Error. PluginError expects an instance of Error. + // create a real Error and map LessError properties to it. + realError.columnNumber = el.column; + realError.fileName = el.filename; + realError.lineNumber = el.line; + realError.stack = el.stack; + realError.type = el.name; + + var recessError = new gutil.PluginError('gulp-recess', realError, { showStack: false });
Close GH-<I>: map the LessError object to a real Error instance for consumption by gulp-util.PluginError..
sindresorhus_gulp-recess
train
js
4ffce330ffa15c01b4c862bc25f7e88c596020af
diff --git a/nodeshot/ui/default/tests.py b/nodeshot/ui/default/tests.py index <HASH>..<HASH> 100755 --- a/nodeshot/ui/default/tests.py +++ b/nodeshot/ui/default/tests.py @@ -121,6 +121,8 @@ class DefaultUiTest(TestCase): def test_map(self): self._hashchange('#/map') self.assertTrue(self.browser.execute_script("return Nodeshot.body.currentView.$el.attr('id') == 'map-container'")) + self.browser.find_element_by_css_selector('#map-js.leaflet-container') + self.assertTrue(self.browser.execute_script("return Nodeshot.body.currentView.map._leaflet_id > -1")) def test_map_legend(self): self._hashchange('#/map')
UI: added checks for leaflet attributes in map test #<I>
ninuxorg_nodeshot
train
py
8ff9e11a24eb937a9ebf1272d9f46decb2f6ae0a
diff --git a/bandicoot/utils.py b/bandicoot/utils.py index <HASH>..<HASH> 100755 --- a/bandicoot/utils.py +++ b/bandicoot/utils.py @@ -44,7 +44,7 @@ def flatten(d, parent_key='', separator='__'): return OrderedDict(items) -def all(user, groupby='week', summary='default', part_of_week='allweek', part_of_day='allday', attributes=True, flatten=False): +def all(user, groupby='week', summary='default', split_week=False, split_day=False, attributes=True, flatten=False): """ Returns a dictionary containing all bandicoot indicators for the user, as well as reporting variables. @@ -113,6 +113,16 @@ def all(user, groupby='week', summary='default', part_of_week='allweek', part_of (bc.spatial.frequent_antennas, scalar_type) ] + if split_week: + part_of_week = ['allweek', 'weekday', 'weekend'] + else: + part_of_week = 'allweek' + + if split_day: + part_of_day = ['allday', 'day', 'night'] + else: + part_of_day = 'allday' + groups = [[r for r in g] for g in group_records(user, groupby=groupby)] reporting = OrderedDict([
Simplify splits in bc.utils.all
yvesalexandre_bandicoot
train
py