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
5816c1bc65c6cecc4cae17d75b54f5ff95345b1e
diff --git a/lib/docker-sync/sync_strategy/unison.rb b/lib/docker-sync/sync_strategy/unison.rb index <HASH>..<HASH> 100644 --- a/lib/docker-sync/sync_strategy/unison.rb +++ b/lib/docker-sync/sync_strategy/unison.rb @@ -158,7 +158,7 @@ module Docker_Sync end def get_host_port(container_name, container_port) - cmd = 'docker inspect --format=" {{ .NetworkSettings.Ports }} " ' + container_name + ' | sed -r "s/.*map\[' + container_port + '[^ ]+\s([0-9]+).*/\1/"' + cmd = 'docker inspect --format=" {{ .NetworkSettings.Ports }} " ' + container_name + ' | /usr/bin/sed -E "s/.*map\[' + container_port + '[^ ]+ ([0-9]*)[^0-9].*/\1/"' say_status 'command', cmd, :white if @options['verbose'] stdout, stderr, exit_status = Open3.capture3(cmd) if not exit_status.success?
[BUGFIX] Unison reports too many roots - PB: the sed expression to grab the used port in container is not compatible with the default sed binary. - FIX: force the use of the default sed binary /usr/bin/sed and update the regexp accordingly
EugenMayer_docker-sync
train
rb
33ed94a7381813e42d55e610cff62fc53f12fe55
diff --git a/hgvs/validator.py b/hgvs/validator.py index <HASH>..<HASH> 100644 --- a/hgvs/validator.py +++ b/hgvs/validator.py @@ -96,7 +96,7 @@ class ExtrinsicValidator(): var_ref_seq = None if var.posedit.edit.type == 'dup': # Handle Dup and NADupN objects. - var_ref_seq = getattr(var.posedit.edit, 'seq', None) + var_ref_seq = getattr(var.posedit.edit, 'ref', None) else: # use reference sequence of original variant, even if later converted (eg c_to_n) if var.posedit.pos.start.offset != 0 or var.posedit.pos.end.offset != 0:
fixed missed seq/ref substitution in validator.py
biocommons_hgvs
train
py
e5c2d73632b938f08171649e42a8d0be9b34e20e
diff --git a/addon/file.js b/addon/file.js index <HASH>..<HASH> 100644 --- a/addon/file.js +++ b/addon/file.js @@ -139,10 +139,11 @@ export default Ember.Object.extend({ }); let request = new HTTPRequest(); + request.open(options.method, options.url); + Object.keys(options.headers).forEach(function (key) { request.setRequestHeader(key, options.headers[key]); }); - request.open(options.method, options.url); if (options.timeout) { request.timeout = options.timeout;
set headers after opening the XMLHttpRequest
adopted-ember-addons_ember-file-upload
train
js
f3fff07787a7af952d7b9c7cd85501c3b4b373a4
diff --git a/ggplot/utils/utils.py b/ggplot/utils/utils.py index <HASH>..<HASH> 100644 --- a/ggplot/utils/utils.py +++ b/ggplot/utils/utils.py @@ -504,7 +504,7 @@ def remove_missing(df, na_rm=False, vars=None, name='', finite=False): if finite: lst = [np.inf, -np.inf] - to_replace = dict((v, lst) for v in vars) + to_replace = {v: lst for v in vars} df.replace(to_replace, np.nan, inplace=True) txt = 'non-finite' else: @@ -514,7 +514,7 @@ def remove_missing(df, na_rm=False, vars=None, name='', finite=False): df.reset_index(drop=True, inplace=True) if len(df) < n and not na_rm: msg = '{} : Removed {} rows containing {} values.' - gg_warn(msg.format(name, n-len(df), txt)) + gg_warn(msg.format(name, n-len(df), txt), stacklevel=3) return df
Accurate file & line no. for missing values
has2k1_plotnine
train
py
6f4bc7727de8ab044314536c6ab5b966a90fa6b9
diff --git a/lib/dashboard/public/single_instances.js b/lib/dashboard/public/single_instances.js index <HASH>..<HASH> 100644 --- a/lib/dashboard/public/single_instances.js +++ b/lib/dashboard/public/single_instances.js @@ -19,6 +19,10 @@ document.addEventListener('DOMContentLoaded', () => { continue; } + if (!newVal[url]) { + return; + } + const siEl = document.createElement('ncg-single-instance'); siEl.url = url; instancesList.appendChild(siEl);
fix(single_instance): fix "Kill" buttons always being visible, even if no instance was open
nodecg_nodecg
train
js
b15b49f07955c27fe5efdf1f0f99a26087693069
diff --git a/src/views/generators/seeder.blade.php b/src/views/generators/seeder.blade.php index <HASH>..<HASH> 100644 --- a/src/views/generators/seeder.blade.php +++ b/src/views/generators/seeder.blade.php @@ -56,7 +56,7 @@ class LaratrustSeeder extends Seeder $this->command->info("Creating '{$key}' user"); // Create default user for each role $user = \{{ $user }}::create([ - 'name' => ucfirst($key), + 'name' => ucwords(str_replace("_", " ", $key)), 'email' => $key.'@app.com', 'password' => bcrypt('password'), 'remember_token' => str_random(10), @@ -71,7 +71,7 @@ class LaratrustSeeder extends Seeder $permissions = explode(',', $value); // Create default user for each permission set $user = \{{ $user }}::create([ - 'name' => ucfirst($key), + 'name' => ucwords(str_replace("_", " ", $key)), 'email' => $key.'@app.com', 'password' => bcrypt('password'), 'remember_token' => str_random(10),
Changes mentioned in #<I>
santigarcor_laratrust
train
php
851e5befdef42aff2839cb78ecae889ec2fcf321
diff --git a/parse.go b/parse.go index <HASH>..<HASH> 100644 --- a/parse.go +++ b/parse.go @@ -81,7 +81,7 @@ func (p *parser) next() item { } func (p *parser) bug(format string, v ...interface{}) { - log.Fatalf("BUG: %s\n\n", fmt.Sprintf(format, v...)) + log.Panicf("BUG: %s\n\n", fmt.Sprintf(format, v...)) } func (p *parser) expect(typ itemType) item {
Panic instead of os.Exit for illegal state situations in parser Fixes #<I>
BurntSushi_toml
train
go
71fc52438a20f2ce61aee56375373fcd7e19f6f8
diff --git a/test.js b/test.js index <HASH>..<HASH> 100644 --- a/test.js +++ b/test.js @@ -1638,3 +1638,47 @@ test('dyadic ternary but(pref-0i1)', (t) => { t.end(); }); + +test('unary ternary instructions', (t) => { + const cpu = CPU(); + let lines = [ + 'LDA #%i010i', + 'STI A', + 'CMP #%10i01', + 'BNE fail', + + 'LDA #%i010i', + 'PTI A', + 'CMP #%11i11', + 'BNE fail', + + 'LDA #%i010i', + 'NTI A', + 'CMP #%1iii1', + 'BNE fail', + + 'LDA #%i010i', + 'FD A', + 'CMP #%00100', + 'BNE fail', + + 'LDA #%i010i', + 'RD A', + 'CMP #%i000i', + 'BNE fail', + + 'HALTZ', + + 'fail:', + 'HALTN', + ]; + + const machine_code = assembler(lines); + + console.log(machine_code); + cpu.memory.writeArray(0, machine_code); + cpu.run(); + t.equal(cpu.flags.H, 0); + + t.end(); +});
Add test for unary ternary instructions: STI, PTI, NTI, FD, and RD
thirdcoder_cpu3502
train
js
81e62b6fd516cf002fcafd29bbae617cd869909b
diff --git a/lang/en/langconfig.php b/lang/en/langconfig.php index <HASH>..<HASH> 100644 --- a/lang/en/langconfig.php +++ b/lang/en/langconfig.php @@ -29,7 +29,7 @@ $string['decsep'] = '.'; $string['firstdayofweek'] = '0'; $string['iso6391'] = 'en'; $string['iso6392'] = 'eng'; -$string['labelsep'] = '&nbsp;'; +$string['labelsep'] = ': '; $string['listsep'] = ','; $string['locale'] = 'en_AU.UTF-8'; $string['localewin'] = 'English_Australia.1252'; diff --git a/lib/outputcomponents.php b/lib/outputcomponents.php index <HASH>..<HASH> 100644 --- a/lib/outputcomponents.php +++ b/lib/outputcomponents.php @@ -1373,6 +1373,8 @@ class html_writer { $text = trim($text); $label = self::tag('label', $text, $attributes); + /* + // TODO $colonize disabled for now yet - see MDL-12192 for details if (!empty($text) and $colonize) { // the $text may end with the colon already, though it is bad string definition style $colon = get_string('labelsep', 'langconfig'); @@ -1386,6 +1388,7 @@ class html_writer { } } } + */ return $label; }
MDL-<I> temporarily disabled support for colonized labels The code must be fixed so that the colon is not displayed when the label is hidden by accessibility CSS.
moodle_moodle
train
php,php
664673f77b1645ea48ac3d2aa9bf7bbe2f8c288c
diff --git a/eventsourcing/application.py b/eventsourcing/application.py index <HASH>..<HASH> 100644 --- a/eventsourcing/application.py +++ b/eventsourcing/application.py @@ -130,7 +130,7 @@ class NotificationLog(ABC): @abstractmethod def select(self, start: int, limit: int) -> List[Notification]: """ - Returns a list of class:`~eventsourcing.persistence.Notification` objects. + Returns a list of :class:`~eventsourcing.persistence.Notification` objects. """
Fixed class ref in docs.
johnbywater_eventsourcing
train
py
e34157c70bf4753d1bcd2f38494ba6c42732f8c4
diff --git a/tests/unit/utils/vt_test.py b/tests/unit/utils/vt_test.py index <HASH>..<HASH> 100644 --- a/tests/unit/utils/vt_test.py +++ b/tests/unit/utils/vt_test.py @@ -16,7 +16,7 @@ import random import subprocess # Import Salt Testing libs -from salttesting import TestCase +from salttesting import TestCase, skipIf from salttesting.helpers import ensure_in_syspath ensure_in_syspath('../../')
Add skipIf import to fix the <I> tests
saltstack_salt
train
py
50fa974dcc22c9e10ba348dbc63cda693cdb9c1e
diff --git a/test/unittests.js b/test/unittests.js index <HASH>..<HASH> 100644 --- a/test/unittests.js +++ b/test/unittests.js @@ -55,8 +55,8 @@ describe('Unit Tests', function () { }); } + require('./worker')(); require('./crypto')(); require('./general')(); - require('./worker')(); require('./security')(); });
CI: run worker tests first to give enough time to download the required scripts (#<I>) This should fix issues with Safari <I> not managing to load the worker in BrowserStack Automate.
openpgpjs_openpgpjs
train
js
f0ae2989389370c942807c54d812110ca03aac37
diff --git a/HTML/Auto.py b/HTML/Auto.py index <HASH>..<HASH> 100644 --- a/HTML/Auto.py +++ b/HTML/Auto.py @@ -33,5 +33,5 @@ class Tag: self.hash = hash self.sorted = sorted - def tag( params={} ): + def tag( self, params={} ): return "<html />"
tag() needs self as 1st arg
jeffa_HTML-Auto-python
train
py
5a42020d1d255e949581ecfdeed807480b0076f7
diff --git a/lib/paymill.rb b/lib/paymill.rb index <HASH>..<HASH> 100644 --- a/lib/paymill.rb +++ b/lib/paymill.rb @@ -51,13 +51,15 @@ module Paymill https_request = case http_method when :post Net::HTTP::Post.new(url) + when :put + Net::HTTP::Put.new(url) when :delete Net::HTTP::Delete.new(url) else Net::HTTP::Get.new(url) end https_request.basic_auth(api_key, "") - https_request.set_form_data(data) if http_method == :post + https_request.set_form_data(data) if [:post, :put].include? http_method @response = https.request(https_request) end raise AuthenticationError if @response.code.to_i == 401
dangerous mock tests are dangerous. time for webmock, fakeweb or vcr style integration tests.
dkd_paymill-ruby
train
rb
d6864fc0a98e4c2532f353d771c4f25fab6f0e11
diff --git a/libraries/joomla/database/database/mysql.php b/libraries/joomla/database/database/mysql.php index <HASH>..<HASH> 100644 --- a/libraries/joomla/database/database/mysql.php +++ b/libraries/joomla/database/database/mysql.php @@ -175,6 +175,44 @@ class JDatabaseMySQL extends JDatabase } /** + * Gets an exporter class object. + * + * @return JDatbaseMySqlExporter An exporter object. + * @since 11.1 + */ + public function getExporter() + { + // Lazy load the exporter class. + if (!class_exists('JDatbaseMySqlExporter')) { + require dirname(__FILE__).'/mysqlexporter.php'; + } + + $o = new JDatbaseMySqlImporter; + $o->setDbo($this); + + return $o; + } + + /** + * Gets an exporter class object. + * + * @return JDatbaseMySqlImporter An importer object. + * @since 11.1 + */ + public function getImporter() + { + // Lazy load the importer class. + if (!class_exists('JDatbaseMySqlImporter')) { + require dirname(__FILE__).'/mysqlimporter.php'; + } + + $o = new JDatbaseMySqlImporter; + $o->setDbo($this); + + return $o; + } + + /** * Execute the query * * @return mixed A database resource if successful, FALSE if not.
Add getExporter and getImporter methods to lazy load the respective helpers classes.
joomla_joomla-framework
train
php
8c51bc8e1b8015957d0ecfdda4a33e05d5b49197
diff --git a/client/modules/Weather.py b/client/modules/Weather.py index <HASH>..<HASH> 100644 --- a/client/modules/Weather.py +++ b/client/modules/Weather.py @@ -76,12 +76,18 @@ def handle(text, mic, profile): for entry in forecast: try: date_desc = entry['title'].split()[0].strip().lower() + if date_desc == 'forecast': #For global forecasts + date_desc = entry['title'].split()[2].strip().lower() + weather_desc = entry['summary'] - weather_desc = entry['summary'].split('-')[1] + elif date_desc == 'current': #For first item of global forecasts + continue + else: + weather_desc = entry['summary'].split('-')[1] #US forecasts if weekday == date_desc: output = date_keyword + \ - ", the weather will be" + weather_desc + "." + ", the weather will be " + weather_desc + "." break except: continue
Weather module parses global forecasts correctly The weather module now checks to see if it is a global forecast, as the parsing needs to be slightly different if so
benhoff_vexbot
train
py
89d3b51dae0d868560f04df6465966e2c9cbaf72
diff --git a/testing/wd_wrapper.py b/testing/wd_wrapper.py index <HASH>..<HASH> 100644 --- a/testing/wd_wrapper.py +++ b/testing/wd_wrapper.py @@ -25,7 +25,7 @@ class WorkDir: return do(cmd, self.cwd) - def write(self, name: str, content: "str | bytes", /, **kw: object) -> Path: + def write(self, name: str, content: "str | bytes", **kw: object) -> Path: path = self.cwd / name if kw: assert isinstance(content, str)
restore python <I> support
pypa_setuptools_scm
train
py
bb1c8b843ad3823064eb19baa8cf822b2bdebb41
diff --git a/lib/chrome/websockets.js b/lib/chrome/websockets.js index <HASH>..<HASH> 100644 --- a/lib/chrome/websockets.js +++ b/lib/chrome/websockets.js @@ -23,11 +23,13 @@ module.exports = function(tab) { ws.on('open', () => { resolve(chrome) - chrome.send('Page.addScriptToEvaluateOnLoad', { - scriptSource: contextMenuWarning() - }) - chrome.send('Page.enable', () => - chrome.send('Debugger.enable', () => chrome.emit('Started')) + chrome.send('Page.disable', () => chrome.send('Debugger.disable', () => + chrome.send('Page.enable', () => chrome.send('Debugger.enable', () => { + chrome.emit('Started') + chrome.send('Runtime.evaluate', { + expression: contextMenuWarning() + }) + }))) ) })
Reenable page and debugger to make scriptParsed fire
porsager_wright
train
js
613ab4fc33f6ef7f4dbd72ba3a8a6240c8743ef2
diff --git a/test/specs/Routine.spec.js b/test/specs/Routine.spec.js index <HASH>..<HASH> 100644 --- a/test/specs/Routine.spec.js +++ b/test/specs/Routine.spec.js @@ -1,6 +1,6 @@ /* global describe, it, beforeEach */ -import Routine from '../../lib/Routine'; +import Routine from '../../src/Routine'; import {expect, assert} from 'chai'; import { diff --git a/test/specs/ensureThat.spec.js b/test/specs/ensureThat.spec.js index <HASH>..<HASH> 100644 --- a/test/specs/ensureThat.spec.js +++ b/test/specs/ensureThat.spec.js @@ -1,6 +1,6 @@ /* global describe, it, beforeEach */ -import Routine, {ensureThat} from '../../lib/Routine'; +import Routine, {ensureThat} from '../../src/Routine'; import {expect} from 'chai'; import {
use src instead of lib files in tests (#5)
flute-io_routine
train
js,js
fad5f329f2b0ad8611e700a509ad14b253083ee9
diff --git a/lib/yard/server/commands/library_command.rb b/lib/yard/server/commands/library_command.rb index <HASH>..<HASH> 100644 --- a/lib/yard/server/commands/library_command.rb +++ b/lib/yard/server/commands/library_command.rb @@ -60,9 +60,12 @@ module YARD def initialize_gem @gem = true self.yardoc_file = Registry.yardoc_file_for_gem(library) - return unless yardoc_file - # Build gem docs on demand - CLI::Gems.run(library) unless File.directory?(yardoc_file) + unless yardoc_file && File.directory?(yardoc_file) + # Build gem docs on demand + log.debug "Building gem docs for #{library}" + CLI::Gems.run(library) + self.yardoc_file = Registry.yardoc_file_for_gem(library) + end spec = Gem.source_index.find_name(library).first self.library_path = spec.full_gem_path end
Fix on-demand building of gems
lsegal_yard
train
rb
61a669ebe2a00d0fc9ff1668cce13b19217d9f80
diff --git a/lib/neo4j/tasks/neo4j_server.rb b/lib/neo4j/tasks/neo4j_server.rb index <HASH>..<HASH> 100644 --- a/lib/neo4j/tasks/neo4j_server.rb +++ b/lib/neo4j/tasks/neo4j_server.rb @@ -62,13 +62,12 @@ namespace :neo4j do end def install_location(args) - "neo4j-#{get_environment(args)}" + FileUtils.mkdir_p('db') unless File.directory?('db') + "db/neo4j-#{get_environment(args)}" end desc "Install Neo4j, example neo4j:install[community-2.1.3,development]" task :install, :edition, :environment do |_, args| - args.with_defaults(:edition => "community") - file = args[:edition] environment = get_environment(args) puts "Installing Neo4j-#{file} environment: #{environment}" @@ -77,7 +76,7 @@ namespace :neo4j do if OS::Underlying.windows? # Extract and move to neo4j directory - unless File.exist?('neo4j') + unless File.exist?(install_location(args)) Zip::ZipFile.open(downloaded_file) do |zip_file| zip_file.each do |f| f_path=File.join(".", f.name)
Changed rake task so that it installs database in db folder
neo4jrb_neo4j-core
train
rb
36024bc1b0cfa62c59ce9528bed097079f144d1b
diff --git a/myanimelist/media_list.py b/myanimelist/media_list.py index <HASH>..<HASH> 100644 --- a/myanimelist/media_list.py +++ b/myanimelist/media_list.py @@ -38,7 +38,7 @@ class MediaList(Base, collections.Mapping): def __init__(self, session, user_name): super(MediaList, self).__init__(session) self.username = user_name - if not isinstance(self.username, unicode) or len(self.username) < 2: + if not isinstance(self.username, unicode) or len(self.username) < 1: raise InvalidMediaListError(self.username) self._list = None self._stats = None diff --git a/myanimelist/user.py b/myanimelist/user.py index <HASH>..<HASH> 100644 --- a/myanimelist/user.py +++ b/myanimelist/user.py @@ -58,7 +58,7 @@ class User(Base): """ super(User, self).__init__(session) self.username = username - if not isinstance(self.username, unicode) or len(self.username) < 2: + if not isinstance(self.username, unicode) or len(self.username) < 1: raise InvalidUserError(self.username) self._picture = None self._favorite_anime = None
Actually, one-letter names exist, too.
shaldengeki_python-mal
train
py,py
85fa532fc197e48afd91a1de14e5cc9181a2bf66
diff --git a/openquake/engine/calculators/risk/scenario_risk/core.py b/openquake/engine/calculators/risk/scenario_risk/core.py index <HASH>..<HASH> 100644 --- a/openquake/engine/calculators/risk/scenario_risk/core.py +++ b/openquake/engine/calculators/risk/scenario_risk/core.py @@ -45,7 +45,6 @@ def scenario(workflow, getter, outputdict, params, monitor): :param monitor: A monitor instance """ - assets = getter.assets hazards = getter.get_data() epsilons = getter.get_epsilons() agg, ins = {}, {} @@ -54,6 +53,12 @@ def scenario(workflow, getter, outputdict, params, monitor): outputdict = outputdict.with_args( loss_type=loss_type, output_type="loss_map") + # ignore assets with missing costs + masked = [a.value(loss_type) is None for a in getter.assets] + assets = numpy.ma.masked_values(getter.assets, masked) + hazards = numpy.ma.masked_values(hazards, masked) + if all(masked): + continue (assets, loss_ratio_matrix, aggregate_losses, insured_loss_matrix, insured_losses) = workflow( loss_type, assets, hazards, epsilons)
Moved the mask for arrays with missing costs in the engine
gem_oq-engine
train
py
950c341c49c0462eb2fe8db4d5d75556315f079f
diff --git a/modules/backend/formwidgets/PermissionEditor.php b/modules/backend/formwidgets/PermissionEditor.php index <HASH>..<HASH> 100644 --- a/modules/backend/formwidgets/PermissionEditor.php +++ b/modules/backend/formwidgets/PermissionEditor.php @@ -55,11 +55,29 @@ class PermissionEditor extends FormWidgetBase */ public function getSaveValue($value) { - if (is_array($value)) { - return $value; + $newPermissions = is_array($value) ? array_map('intval', $value) : []; + + if (!empty($newPermissions)) { + $existingPermissions = $this->model->permissions; + + $allowedPermissions = array_map(function ($permissionObject) { + return $permissionObject->code; + }, array_flatten($this->getFilteredPermissions())); + + foreach ($newPermissions as $permission => $code) { + if ($code === 0) { + continue; + } + + if (in_array($permission, $allowedPermissions)) { + $existingPermissions[$permission] = $code; + } + } + + $newPermissions = $existingPermissions; } - return []; + return $newPermissions; } /**
Prevent privilege escalation from crafted requests Follow up to <URL>
octobercms_october
train
php
6a353e7b288ccf6f7311a4aebe9263c6dbd85e32
diff --git a/packages/components/bolt-accordion/accordion.schema.js b/packages/components/bolt-accordion/accordion.schema.js index <HASH>..<HASH> 100644 --- a/packages/components/bolt-accordion/accordion.schema.js +++ b/packages/components/bolt-accordion/accordion.schema.js @@ -22,6 +22,7 @@ module.exports = { title: 'no_separator (twig) / no-separator (web component)', description: 'Hides the separator in between items.', default: false, + enum: [true, false], }, box_shadow: { type: 'boolean',
DS-<I>: Add bool enum back in, to be addressed in separate PR
bolt-design-system_bolt
train
js
6734178d131f91e01b0941106acd1033fb7e2226
diff --git a/endless_pagination/models.py b/endless_pagination/models.py index <HASH>..<HASH> 100644 --- a/endless_pagination/models.py +++ b/endless_pagination/models.py @@ -234,3 +234,7 @@ class PageList(utils.UnicodeMixin): self._page.next_page_number(), label=settings.NEXT_LABEL) return '' + + def paginated(self): + """Return True if this page list contains more than one page.""" + return len(self) > 1 diff --git a/endless_pagination/tests/test_models.py b/endless_pagination/tests/test_models.py index <HASH>..<HASH> 100644 --- a/endless_pagination/tests/test_models.py +++ b/endless_pagination/tests/test_models.py @@ -113,6 +113,14 @@ class PageListTest(TestCase): # Ensure the length of the page list equals the number of pages. self.assertEqual(self.paginator.num_pages, len(self.pages)) + def test_paginated(self): + # Ensure the *paginated* method returns True if the page list contains + # more than one page, False otherwise. + page = DefaultPaginator(range(10), 10).page(1) + pages = models.PageList(self.request, page, self.page_label) + self.assertFalse(pages.paginated()) + self.assertTrue(self.pages.paginated()) + def test_first_page(self): # Ensure the attrs of the first page are correctly defined. page = self.pages.first()
Implemented and tested the PageList.paginated method.
frankban_django-endless-pagination
train
py,py
61e9bcfdcdd03c1cdfec395da6d3344582d3dc59
diff --git a/asset_allocation/loader.py b/asset_allocation/loader.py index <HASH>..<HASH> 100644 --- a/asset_allocation/loader.py +++ b/asset_allocation/loader.py @@ -34,7 +34,7 @@ class AssetAllocationLoader: cash_root_name = cfg.get(ConfigKeys.cash_root) # Load cash from all accounts under the root. gc_db = self.config.get(ConfigKeys.gnucash_book_path) - with open_book(gc_db, open_if_lock=False) as book: + with open_book(gc_db, open_if_lock=True) as book: svc = AccountsAggregate(book) root_account = svc.get_by_fullname(cash_root_name) acct_svc = AccountAggregate(book, root_account) diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -40,7 +40,7 @@ setup( # For a discussion on single-sourcing the version across setup.py and the # project code, see # https://packaging.python.org/en/latest/single_source_version.html - version='1.2.2', # Required + version='1.2.3', # Required # This is a one-line description or tagline of what your project does. This # corresponds to the "Summary" metadata field:
allow opening gnucash book even if open in gnucash application. <I>
MisterY_asset-allocation
train
py,py
9f7f01db04cc9b33486466591dcd7720eef6e48d
diff --git a/mod/quiz/review.php b/mod/quiz/review.php index <HASH>..<HASH> 100644 --- a/mod/quiz/review.php +++ b/mod/quiz/review.php @@ -38,6 +38,7 @@ require_login($course->id, false, $cm); $isteacher = isteacher($course->id); + $options = quiz_get_reviewoptions($quiz, $attempt, $isteacher); $popup = $isteacher ? 0 : $quiz->popup; // Controls whether this is shown in a javascript-protected window. if (!$isteacher) { @@ -232,7 +233,6 @@ $number++; // Just guessing that the missing question would have lenght 1 continue; } - $options = quiz_get_reviewoptions($quiz, $attempt, $isteacher); $options->validation = QUESTION_EVENTVALIDATE === $states[$i]->event; $options->history = ($isteacher and !$attempt->preview) ? 'all' : 'graded'; // Print the question
mod/quiz/review quiz options loaded once per pageload, not once per qn. Moved loading of quiz review options from loop iterating over each qn to be displayed, to the top of the pageload. Should give efficency gains on quizes with long pages, as well as making the options available earlier in the process. Credit: Peter Bulmer <EMAIL>
moodle_moodle
train
php
12fb51cd247d2f8205f6cd5dcb3d48bcd1e608b5
diff --git a/libinput/constant.py b/libinput/constant.py index <HASH>..<HASH> 100755 --- a/libinput/constant.py +++ b/libinput/constant.py @@ -145,7 +145,8 @@ class EventType(Enum): if self in {type(self).GESTURE_SWIPE_BEGIN, type(self).GESTURE_SWIPE_END, type(self).GESTURE_SWIPE_UPDATE, type(self).GESTURE_PINCH_BEGIN, - type(self).GESTURE_PINCH_UPDATE, type(self).GESTURE_PINCH_END}: + type(self).GESTURE_PINCH_UPDATE, type(self).GESTURE_PINCH_END, + type(self).GESTURE_HOLD_END,type(self).GESTURE_HOLD_BEGIN}: return True else: return False
Add the GESTURE_HOLD_START and GESTURE_HOLD_END to the is_gesture method.
OzymandiasTheGreat_python-libinput
train
py
7eb49bf15696b5aae8e7c303d20170d1f5d47537
diff --git a/src/main/java/org/fxmisc/wellbehaved/event/EventHandlerHelper.java b/src/main/java/org/fxmisc/wellbehaved/event/EventHandlerHelper.java index <HASH>..<HASH> 100644 --- a/src/main/java/org/fxmisc/wellbehaved/event/EventHandlerHelper.java +++ b/src/main/java/org/fxmisc/wellbehaved/event/EventHandlerHelper.java @@ -165,6 +165,17 @@ public final class EventHandlerHelper<T extends Event> { } } + public static <T extends Event> void installAfter( + ObjectProperty<EventHandler<? super T>> handlerProperty, + EventHandler<? super T> handler) { + EventHandler<? super T> oldHandler = handlerProperty.get(); + if(oldHandler != null) { + handlerProperty.set(EventHandlerHelper.chain(oldHandler, handler)); + } else { + handlerProperty.set(handler); + } + } + public static <T extends Event> void remove( ObjectProperty<EventHandler<? super T>> handlerProperty, EventHandler<? super T> handler) {
Add EventHandlerHelper.installAfter method to install an event handler with the lowest priority.
FXMisc_WellBehavedFX
train
java
4417b3c701e44fbf94fb7375a7a3f148f1ee6112
diff --git a/tilequeue/queue/file.py b/tilequeue/queue/file.py index <HASH>..<HASH> 100644 --- a/tilequeue/queue/file.py +++ b/tilequeue/queue/file.py @@ -6,10 +6,10 @@ class OutputFileQueue(object): def __init__(self, fp): self.fp = fp - self.lock = threading.RLock() + self._lock = threading.RLock() def enqueue(self, coord): - with self.lock: + with self._lock: payload = serialize_coord(coord) self.fp.write(payload + '\n') @@ -21,7 +21,7 @@ class OutputFileQueue(object): return n, 0 def read(self, max_to_read=1, timeout_seconds=20): - with self.lock: + with self._lock: coords = [] for _ in range(max_to_read): try: @@ -36,13 +36,13 @@ class OutputFileQueue(object): pass def clear(self): - with self.lock: + with self._lock: self.fp.seek(0) self.fp.truncate() return -1 def close(self): - with self.lock: + with self._lock: remaining_queue = "".join([ln for ln in self.fp]) self.clear() self.fp.write(remaining_queue)
Rename lock to _lock to imply that it's private. tilequeue/queue/file.py -The `lock` instance variable shouldn't be used outside of the `OutputFileQueue`'s methods.
tilezen_tilequeue
train
py
b1c069c826271bef5e5cfc43e15286414aa21342
diff --git a/services/puppetforge/puppetforge-module-pdk-version.tester.js b/services/puppetforge/puppetforge-module-pdk-version.tester.js index <HASH>..<HASH> 100644 --- a/services/puppetforge/puppetforge-module-pdk-version.tester.js +++ b/services/puppetforge/puppetforge-module-pdk-version.tester.js @@ -11,7 +11,7 @@ t.create('PDK version') }) t.create("PDK version (library doesn't use the PDK)") - .get('/camptocamp/openssl.json') + .get('/puppet/yum.json') .expectBadge({ label: 'pdk version', message: 'none',
tests: fix failing puppet forge service test (#<I>)
badges_shields
train
js
1577b9a5f012bf8d1994dbdd78dce36f88bf0d2e
diff --git a/Entity/CountryContext.php b/Entity/CountryContext.php index <HASH>..<HASH> 100644 --- a/Entity/CountryContext.php +++ b/Entity/CountryContext.php @@ -45,7 +45,7 @@ class CountryContext /** * @var string - * @ORM\Column(type="simple_array") + * @ORM\Column(type="simple_array", nullable=true) */ private $countries = array();
fix nullable state of country context
phlexible_country-context-bundle
train
php
e0e0e6b13d70a6568b0024ab73747d66db9aae92
diff --git a/tika/tika.py b/tika/tika.py index <HASH>..<HASH> 100644 --- a/tika/tika.py +++ b/tika/tika.py @@ -273,6 +273,8 @@ def getRemoteFile(urlOrPath, destPath): urlp = urlparse(urlOrPath) if urlp.scheme == '': return (os.path.abspath(urlOrPath), 'local') + elif urlp.scheme not in ('http', 'https'): + return (urlOrPath, 'local') else: filename = urlOrPath.rsplit('/',1)[1] destPath = destPath + '/' +filename
Fix for Windows-style paths with C: schemes and so forth. Identified by <EMAIL> this closes #<I>
chrismattmann_tika-python
train
py
09ff159191beb9f70282fb37277b95b2897a50cd
diff --git a/connection.go b/connection.go index <HASH>..<HASH> 100644 --- a/connection.go +++ b/connection.go @@ -110,7 +110,7 @@ func NewConnection(solrUrl string) (*Connection, error) { } func (c *Connection) Select(selectQuery string) (*SelectResponse, error) { - r, err := HTTPGet(fmt.Sprintf("%s/select?%s", c.url.String(), selectQuery), nil) + r, err := HTTPGet(fmt.Sprintf("%s/select/?%s", c.url.String(), selectQuery), nil) if err != nil { return nil, err }
Adding / to select url
vanng822_go-solr
train
go
043dc2363bd82ae5ba9d97b2e11000a4691a8581
diff --git a/py/testdir_multi_jvm/test_GLM_big1_nopoll.py b/py/testdir_multi_jvm/test_GLM_big1_nopoll.py index <HASH>..<HASH> 100644 --- a/py/testdir_multi_jvm/test_GLM_big1_nopoll.py +++ b/py/testdir_multi_jvm/test_GLM_big1_nopoll.py @@ -47,7 +47,8 @@ class Basic(unittest.TestCase): # if we do another poll they should be done now, and better to get it that # way rather than the inspect (to match what simpleCheckGLM is expected for glm in glmInitial: - print "Checking completed job, with no polling:", glm + print "Checking completed job, with no polling using initial response:", h2o.dump_json(glm) + a = h2o.nodes[0].poll_url(glm, noPoll=True) h2o_glm.simpleCheckGLM(self, a, 57, **kwargs)
print some extra info for debug of ec2 fail
h2oai_h2o-2
train
py
a6ea261bbcdeecd75c88a45a4e8daad627acc7fe
diff --git a/src/grid/PartGridView.php b/src/grid/PartGridView.php index <HASH>..<HASH> 100644 --- a/src/grid/PartGridView.php +++ b/src/grid/PartGridView.php @@ -205,7 +205,7 @@ class PartGridView extends BoxedGridView 'filter' => false, 'format' => 'raw', 'value' => function ($model) { - return Html::tag('nobr', Yii::$app->formatter->asDateTime($model->create_time)); + return Html::tag('nobr', Yii::$app->formatter->asDateTime($model->selling_time)); }, ], 'place' => [
Fixed typo for `selling_time` column in PartGridView
hiqdev_hipanel-module-stock
train
php
8b5618a8a0e467a725e6da7384e03a082bdd0119
diff --git a/test/cmd.js b/test/cmd.js index <HASH>..<HASH> 100644 --- a/test/cmd.js +++ b/test/cmd.js @@ -14,7 +14,7 @@ var validateNpmName = require('validate-npm-package-name') var APP_START_STOP_TIMEOUT = 10000 var PKG_PATH = path.resolve(__dirname, '..', 'package.json') var BIN_PATH = path.resolve(path.dirname(PKG_PATH), require(PKG_PATH).bin.express) -var NPM_INSTALL_TIMEOUT = 60000 +var NPM_INSTALL_TIMEOUT = 300000 // 5 minutes var TEMP_DIR = utils.tmpDir() describe('express(1)', function () {
tests: increase timeout for npm install
expressjs_generator
train
js
3d30a4c76b44ed43a5e5f9460dae16d9efdfc527
diff --git a/org/postgresql/core/Parser.java b/org/postgresql/core/Parser.java index <HASH>..<HASH> 100644 --- a/org/postgresql/core/Parser.java +++ b/org/postgresql/core/Parser.java @@ -83,6 +83,9 @@ public class Parser { break; case '?': + if (!withParameters) + break; + nativeSql.append(aChars, fragmentStart, i - fragmentStart); if (i + 1 < aChars.length && aChars[i + 1] == '?') /* replace ?? with ? */ {
Replace question marks only in PreparedStatements Question marks in the query text should be replaced with positional parameters ($1, $2, ...) only in java.sql.PreparedStatement. In a java.sql.Statement they should be left alone.
pgjdbc_pgjdbc
train
java
280a7d0c47e1260534b9ced1055d361d495b9e9a
diff --git a/Gruntfile.js b/Gruntfile.js index <HASH>..<HASH> 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -173,6 +173,10 @@ module.exports = function(grunt) { }, }); + // update various components + grunt.registerTask( 'update:iana', ['curl:update-iana'] ); + grunt.registerTask( 'update:html5', ['shell:update_html5'] ); + grunt.registerTask( 'build', [ // 'wp_readme_to_markdown', 'clean:build', @@ -198,9 +202,6 @@ module.exports = function(grunt) { 'copy', 'wp_deploy:assets' ]); - grunt.registerTask('iana', [ - 'curl:update-iana', - ]); grunt.registerTask( 'default', [ 'phpunit:default',
Grunt: new alias naming pattern for updating components
mundschenk-at_php-typography
train
js
c68250912906c9f519adbefa3dd4e58d00ab6a5e
diff --git a/src/Converter/BaseConverter.php b/src/Converter/BaseConverter.php index <HASH>..<HASH> 100644 --- a/src/Converter/BaseConverter.php +++ b/src/Converter/BaseConverter.php @@ -20,16 +20,10 @@ abstract class BaseConverter implements EventConverterInterface { $q = 'MERGE (user:User {id: {user_id}}) ON CREATE SET user.login = {user_login} - CREATE (event:GithubEvent {id: {event_id}}) - SET event.type = {event_type}, event.time = {event_time} + MERGE (event:GithubEvent {id: {event_id}}) + SET event.type = {event_type}, event.time = {event_time}, user_id: {user_id} MERGE (et:EventType {type:{event_type}}) MERGE (event)-[:EVENT_TYPE]->(et) - WITH user, event - OPTIONAL MATCH (user)-[r:LAST_EVENT]->(lastEvent) - DELETE r - MERGE (user)-[:LAST_EVENT]->(event) - WITH user, event, collect(lastEvent) as lastEvents - FOREACH (x in lastEvents | CREATE (event)-[:PREVIOUS_EVENT]->(x)) RETURN event'; $p = [
simpler event, user merge io create for event
ikwattro_github2cypher
train
php
79b051d423096d142d47b5aa96ec14bd7304b62d
diff --git a/robovm/src/playn/robovm/RoboAudio.java b/robovm/src/playn/robovm/RoboAudio.java index <HASH>..<HASH> 100644 --- a/robovm/src/playn/robovm/RoboAudio.java +++ b/robovm/src/playn/robovm/RoboAudio.java @@ -163,6 +163,10 @@ public class RoboAudio extends AudioImpl { } } + void delete(RoboSoundOAL sound) { + alDeleteBuffer(sound.bufferId()); + } + void setLooping(int sourceIdx, RoboSoundOAL sound, boolean looping) { if (active[sourceIdx] == sound) { alSourcei(sources[sourceIdx], AL_LOOPING, looping ? AL_TRUE : AL_FALSE); diff --git a/robovm/src/playn/robovm/RoboSoundOAL.java b/robovm/src/playn/robovm/RoboSoundOAL.java index <HASH>..<HASH> 100644 --- a/robovm/src/playn/robovm/RoboSoundOAL.java +++ b/robovm/src/playn/robovm/RoboSoundOAL.java @@ -68,7 +68,6 @@ public class RoboSoundOAL extends AbstractSound<Integer> { @Override protected void releaseImpl() { - // TODO - // AL.DeleteBuffer(impl); + audio.delete(this); } }
Delete OAL sounds when released.
threerings_playn
train
java,java
a167ee27cdd60899a26811b9338940d67eb61ecc
diff --git a/rpi-gpio.js b/rpi-gpio.js index <HASH>..<HASH> 100755 --- a/rpi-gpio.js +++ b/rpi-gpio.js @@ -414,18 +414,18 @@ function createListener(channel, pin, pollers, onChange) { var fd = fs.openSync(PATH + '/gpio' + pin + '/value', 'r+'); clearInterrupt(fd); poller.add(fd, Epoll.EPOLLPRI); - pollers[pin] = { - poller: poller, - fd: fd - }; + // Append ready-to-use remove function + pollers[pin] = function() { + poller.remove(fd).close(); + } } function removeListener(pin, pollers) { if (!pollers[pin]) { return } - data = pollers[pin] - data.poller.remove(data.fd).close(); + debug('remove listener for pin %d', pin) + pollers[pin]() delete pollers[pin] }
Make pollers store a self-removal function
JamesBarwell_rpi-gpio.js
train
js
e42f0c03571d843ff9812a9ee49c16b2dd4b5a26
diff --git a/lib/ronin/database/database.rb b/lib/ronin/database/database.rb index <HASH>..<HASH> 100644 --- a/lib/ronin/database/database.rb +++ b/lib/ronin/database/database.rb @@ -262,18 +262,22 @@ module Ronin # The given block will be ran within the context of each Database # repository. # - # @return [Array<Symbol>] - # The Database repository names that the transactions were performed - # within. + # @return [Array] + # The results from each database transaction. # # @since 0.4.0 # - def Database.each(&block) + def Database.map(&block) + results = [] + Database.repositories.each_key do |name| - DataMapper.repository(name,&block) + DataMapper.repository(name) do + result = block.call() + results << result unless result.nil? + end end - return Database.repositories.keys + return results end end end
Renamed Database.each to Database.map. * Choosing `map` since we're applying a block to each DataMapper repository, and returning the accumulated results.
ronin-ruby_ronin
train
rb
26fc573ba75559b982dce178d90b6e78056f2a9d
diff --git a/lib/sugarcrm/finders/finder_methods.rb b/lib/sugarcrm/finders/finder_methods.rb index <HASH>..<HASH> 100644 --- a/lib/sugarcrm/finders/finder_methods.rb +++ b/lib/sugarcrm/finders/finder_methods.rb @@ -225,7 +225,7 @@ module SugarCRM; module FinderMethods end VALID_FIND_OPTIONS = [ :conditions, :deleted, :fields, :include, :joins, :limit, :link_fields, :offset, - :order_by, :select, :readonly, :group, :having, :from, :lock, :query ] + :order_by, :select, :readonly, :group, :having, :from, :lock ] def validate_find_options(options) #:nodoc: options.assert_valid_keys(VALID_FIND_OPTIONS)
remove :query from VALID_OPTIONS snuck in previously by mistake
chicks_sugarcrm
train
rb
0484006e34f4edae2ac25f05702c43ae2e8ab1b3
diff --git a/packer/multi_error.go b/packer/multi_error.go index <HASH>..<HASH> 100644 --- a/packer/multi_error.go +++ b/packer/multi_error.go @@ -37,10 +37,6 @@ func MultiErrorAppend(err error, errs ...error) *MultiError { err = new(MultiError) } - if err.Errors == nil { - err.Errors = make([]error, 0, len(errs)) - } - err.Errors = append(err.Errors, errs...) return err default:
packer: no need to check if nil since we're appending to slice
hashicorp_packer
train
go
d9dbc68f68723af7f43210a8ac5ca29f18c678a6
diff --git a/anonymoususage/tables/statistic.py b/anonymoususage/tables/statistic.py index <HASH>..<HASH> 100644 --- a/anonymoususage/tables/statistic.py +++ b/anonymoususage/tables/statistic.py @@ -36,15 +36,7 @@ class Statistic(Table): return self def __sub__(self, i): - count = self.count - i - try: - self.tracker.dbcon.execute("DELETE FROM {name} WHERE Count = {count}".format(name=self.name, count=count)) - self.tracker.dbcon.commit() - except sqlite3.Error as e: - logger.error(e) - else: - self.count = count - logging.debug('{s.name} count set to {s.count}'.format(s=self)) + self += -i return self def increment(self, by):
In __sub__, rather than trying to delete the row with the specific count (which may not even exist, eg doing +=5 then -= 2), add a new row with the lower count
lobocv_anonymoususage
train
py
db213e67c9f67f1efd07f0cca66888ea410e4969
diff --git a/lib/plugins/thirdparty/index.js b/lib/plugins/thirdparty/index.js index <HASH>..<HASH> 100644 --- a/lib/plugins/thirdparty/index.js +++ b/lib/plugins/thirdparty/index.js @@ -6,7 +6,8 @@ const urlParser = require('url'); const DEFAULT_THIRDPARTY_PAGESUMMARY_METRICS = [ 'category.*.requests.*', - 'category.*.tools.*' + 'category.*.tools.*', + 'requests' ]; module.exports = {
Store total number of 3rd party request (#<I>)
sitespeedio_sitespeed.io
train
js
c08736bb6f6a0b06e8fe6235dae7120a6023fe77
diff --git a/lib/config.js b/lib/config.js index <HASH>..<HASH> 100644 --- a/lib/config.js +++ b/lib/config.js @@ -27,10 +27,6 @@ var path = require("path"), var unclustered = ["memory", "disk", "leveldb"]; -function warnInternalConfig(key, log) { - log.warn("`" + key + "` is an internal config value which will be overwritten and have no effect"); -} - function throwInternalConfig(key, log) { throw new Error("`" + key + "` is an internal config value and cannot be manually configured"); }
Remove dead code from lib/config.js In particular, this brings our line coverage for this module to <I>%. Woot woot!
pump-io_pump.io
train
js
de27c2f9045352fee07c0e069634360bef60a23a
diff --git a/lib/tri/declarative/__init__.py b/lib/tri/declarative/__init__.py index <HASH>..<HASH> 100644 --- a/lib/tri/declarative/__init__.py +++ b/lib/tri/declarative/__init__.py @@ -373,13 +373,13 @@ def filter_show_recursive(item): if isinstance(item, list): return [filter_show_recursive(v) for v in item if should_show(v)] - if isinstance(item, set): - return {filter_show_recursive(v) for v in item if should_show(v)} - if isinstance(item, dict): # The type(item)(** stuff is to preserve the original type return type(item)(**{k: filter_show_recursive(v) for k, v in item.items() if should_show(v)}) + if isinstance(item, set): + return {filter_show_recursive(v) for v in item if should_show(v)} + return item
Micro-optimization: dicts are more common than sets
TriOptima_tri.declarative
train
py
5ec1974bef46e3d1b00b051ff70dd140ac7ae723
diff --git a/ReText/window.py b/ReText/window.py index <HASH>..<HASH> 100644 --- a/ReText/window.py +++ b/ReText/window.py @@ -458,15 +458,14 @@ class ReTextWindow(QMainWindow): cursor.beginEditBlock() while block != end: cursor.setPosition(block.position()) - if self.tabInsertsSpaces: + if editBox.document().characterAt(cursor.position()) == '\t': + cursor.deleteChar() + else: pos = 0 while editBox.document().characterAt(cursor.position()) == ' ' \ and pos < self.tabWidth: pos += 1 cursor.deleteChar() - else: - if editBox.document().characterAt(cursor.position()) == '\t': - cursor.deleteChar() block = block.next() cursor.endEditBlock()
editBoxIndentLess: correctly de-dent both tabulated and "spaced" text
retext-project_retext
train
py
a19a2b74882351c0f5a85a7e61c7e84a93108cbf
diff --git a/keanu-project/src/test/java/io/improbable/keanu/vertices/dbl/nonprobabilistic/operators/multiple/LambdaModelVertexTest.java b/keanu-project/src/test/java/io/improbable/keanu/vertices/dbl/nonprobabilistic/operators/multiple/LambdaModelVertexTest.java index <HASH>..<HASH> 100644 --- a/keanu-project/src/test/java/io/improbable/keanu/vertices/dbl/nonprobabilistic/operators/multiple/LambdaModelVertexTest.java +++ b/keanu-project/src/test/java/io/improbable/keanu/vertices/dbl/nonprobabilistic/operators/multiple/LambdaModelVertexTest.java @@ -205,7 +205,7 @@ public class LambdaModelVertexTest { NetworkSamples posteriorSamples = MetropolisHastings.withDefaultConfig(random).getPosteriorSamples( bayesianNetwork, inputToModel, - 250000 + 2500 ); double averagePosteriorInput = posteriorSamples.getDoubleTensorSamples(inputToModel).getAverages().scalar();
Reduce number of samples to fix broken build
improbable-research_keanu
train
java
224567a0f20c2218a91d097ec9f5a763f24daa84
diff --git a/blocks/myoverview/lang/en/block_myoverview.php b/blocks/myoverview/lang/en/block_myoverview.php index <HASH>..<HASH> 100644 --- a/blocks/myoverview/lang/en/block_myoverview.php +++ b/blocks/myoverview/lang/en/block_myoverview.php @@ -63,7 +63,7 @@ $string['privacy:metadata:overviewgroupingpreference'] = 'The Course overview bl $string['privacy:metadata:overviewpagingpreference'] = 'The Course overview block paging preference.'; $string['removefromfavourites'] = 'Unstar this course'; $string['summary'] = 'Summary'; -$string['title'] = 'Title'; +$string['title'] = 'Course name'; $string['aria:hidecourse'] = 'Hide {$a} from view'; $string['aria:showcourse'] = 'Show {$a} in view'; $string['aria:hiddencourses'] = 'Show hidden courses';
MDL-<I> block myoverview: change title string to course change language string for Sort by "Title" to "Course"
moodle_moodle
train
php
0a5d67428ed3f8be7eb143db0e213e014485c41f
diff --git a/termformat/__init__.py b/termformat/__init__.py index <HASH>..<HASH> 100644 --- a/termformat/__init__.py +++ b/termformat/__init__.py @@ -7,7 +7,7 @@ __is_cython__ = False try: # Python 2.7 long = long -except NameError: +except NameError: # pragma: no cover # Python 3.3 unicode = str xrange = range
Disable coverage for python3 stuff
dveselov_termformat
train
py
a029c82312431c9b162dace76082bcafe110ef86
diff --git a/container/noxfile.py b/container/noxfile.py index <HASH>..<HASH> 100644 --- a/container/noxfile.py +++ b/container/noxfile.py @@ -75,7 +75,7 @@ def system(session): session.install('-e', '.') # Run py.test against the system tests. - session.run('py.test', '--quiet', 'tests/system/') + session.run('py.test', '--quiet', 'tests/system/', *session.posargs) @nox.session(python='3.6')
Pass posargs to py.test (#<I>)
googleapis_google-cloud-python
train
py
2e75a60c6bceaa0227fa886a17b35f14c62db2cd
diff --git a/lib/segment.rb b/lib/segment.rb index <HASH>..<HASH> 100644 --- a/lib/segment.rb +++ b/lib/segment.rb @@ -18,6 +18,10 @@ class Segment response = get "active", options Hashie::Mash.new(response) end + + def clear_rules + response = CreateSend.delete "/segments/#{segment_id}/rules.json", {} + end def delete response = CreateSend.delete "/segments/#{segment_id}.json", {} diff --git a/test/segment_test.rb b/test/segment_test.rb index <HASH>..<HASH> 100644 --- a/test/segment_test.rb +++ b/test/segment_test.rb @@ -33,5 +33,10 @@ class SegmentTest < Test::Unit::TestCase @segment.delete end + should "clear a segment's rules" do + stub_delete(@api_key, "segments/#{@segment.segment_id}/rules.json", nil) + @segment.clear_rules + end + end end
Added ability to clear a segment's rules.
campaignmonitor_createsend-ruby
train
rb,rb
b3e239c0ec9677c5b6b43fef46696abd0b690ba3
diff --git a/src/Conner/Tagging/TaggingUtil.php b/src/Conner/Tagging/TaggingUtil.php index <HASH>..<HASH> 100644 --- a/src/Conner/Tagging/TaggingUtil.php +++ b/src/Conner/Tagging/TaggingUtil.php @@ -4,14 +4,14 @@ use Conner\Tagging\Tag; /** * Utility functions to help with various tagging functionality. - * + * * @author Rob Conner <rtconner@gmail.com> */ class TaggingUtil { /** * Converts input into array - * + * * @param $tagName string or array * @return array */ @@ -42,7 +42,7 @@ class TaggingUtil { public static function slug($str) { // Make sure string is in UTF-8 and strip invalid UTF-8 characters - $str = mb_convert_encoding((string)$str, 'UTF-8', mb_list_encodings()); + $str = mb_convert_encoding((string)$str, 'UTF-8'); $options = array( 'delimiter' => '-', @@ -144,7 +144,7 @@ class TaggingUtil { /** * Private! Please do not call this function directly, just let the Tag library use it. * Increment count of tag by one. This function will create tag record if it does not exist. - * + * * @param string $tagString */ public static function incrementCount($tagString, $tagSlug, $count) {
trying a fix for hhvm
rtconner_laravel-tagging
train
php
77a6a3a0af90f9ad1050cf2440235e3a90682872
diff --git a/stomp/backward.py b/stomp/backward.py index <HASH>..<HASH> 100755 --- a/stomp/backward.py +++ b/stomp/backward.py @@ -3,15 +3,6 @@ import sys # # Functions for backwards compatibility # - -def get_func_argcount(func): - """ - Return the argument count for a function - """ - if sys.hexversion >= 0x03000000: - return func.__code__.co_argcount - else: - return func.func_code.co_argcount def input_prompt(prompt): """ diff --git a/stomp/connect.py b/stomp/connect.py index <HASH>..<HASH> 100755 --- a/stomp/connect.py +++ b/stomp/connect.py @@ -602,15 +602,12 @@ class Connection(object): if frame_type == 'connecting': listener.on_connecting(self.__current_host_and_port) continue + elif frame_type == 'disconnected': + listener.on_disconnected() + continue notify_func = getattr(listener, 'on_%s' % frame_type) - params = backward.get_func_argcount(notify_func) - if params >= 3: - notify_func(headers, body) - elif params == 2: - notify_func(headers) - else: - notify_func() + notify_func(headers, body) def __receiver_loop(self): """
change listener to use consistent number of args - two
jasonrbriggs_stomp.py
train
py,py
c94886a9882e69629a07ba892f0d32891005f3f9
diff --git a/lib/Cake/Test/Case/View/ViewTest.php b/lib/Cake/Test/Case/View/ViewTest.php index <HASH>..<HASH> 100644 --- a/lib/Cake/Test/Case/View/ViewTest.php +++ b/lib/Cake/Test/Case/View/ViewTest.php @@ -21,6 +21,7 @@ App::uses('View', 'View'); App::uses('Helper', 'View'); App::uses('Controller', 'Controller'); App::uses('CacheHelper', 'View/Helper'); +App::uses('HtmlHelper', 'View/Helper'); App::uses('ErrorHandler', 'Error');
Add missing import that causes tests to fail in isolation.
cakephp_cakephp
train
php
d4cbb3d3e8a38b0083544e794219bec1cfb3d071
diff --git a/addon/serializers/contributor.js b/addon/serializers/contributor.js index <HASH>..<HASH> 100644 --- a/addon/serializers/contributor.js +++ b/addon/serializers/contributor.js @@ -8,11 +8,12 @@ export default OsfSerializer.extend({ serialized.data.relationships = { users: { data: { - id: snapshot.record.get('userId') || snapshot.record.id.split('-')[1], + // TODO changeme when https://github.com/CenterForOpenScience/osf.io/pull/5824 goes in + id: snapshot.record.get('id') || snapshot.record.get('userId') || snapshot.record.id.split('-')[1], type: 'users' } } }; return serialized; - }, + } });
Use Contrib.id until compound ids are ready
CenterForOpenScience_ember-osf
train
js
5b2b96077b3f26271aac0e7d1e1455238aff8c1a
diff --git a/spec/unit/type/exec_spec.rb b/spec/unit/type/exec_spec.rb index <HASH>..<HASH> 100755 --- a/spec/unit/type/exec_spec.rb +++ b/spec/unit/type/exec_spec.rb @@ -755,7 +755,7 @@ describe Puppet::Type.type(:exec) do end describe "when providing a umask" do it "should fail if an invalid umask is used" do - resource = Puppet::Type.type(:exec).new :command => "/bin/true" + resource = Puppet::Type.type(:exec).new :command => @command expect { resource[:umask] = '0028'}.to raise_error(Puppet::ResourceError, /umask specification is invalid/) expect { resource[:umask] = '28' }.to raise_error(Puppet::ResourceError, /umask specification is invalid/) end
(maint) Fixing build error on windows caused by command with unix path
puppetlabs_puppet
train
rb
e04060054bfda14013ad378360da7e2c8b0c80ed
diff --git a/lib/trace.js b/lib/trace.js index <HASH>..<HASH> 100644 --- a/lib/trace.js +++ b/lib/trace.js @@ -26,7 +26,7 @@ }; getUniqueId = function () { - var random = new Int64(Math.random() * 0x7fffffff, Math.random() * 0x100000000); + var random = new Int64(Math.random() * 0x80000000, Math.random() * 0x100000000); return random.toOctetString(); };
0x<I> is the proper upperbound as Math.random has <I> digit precision
tryfer_node-tryfer
train
js
ae73547245d9136adc1b74e44ae6f1c0e2d39dae
diff --git a/openquake/engine/db/models.py b/openquake/engine/db/models.py index <HASH>..<HASH> 100644 --- a/openquake/engine/db/models.py +++ b/openquake/engine/db/models.py @@ -1453,11 +1453,11 @@ class Gmf(djm.Model): """ # a set of GMFs generate by the same SES, one per rupture gmfset = collections.defaultdict(list) # ses_ordinal -> GMFs - for key, value in gmf_dict.iteritems(): + for key in sorted(gmf_dict): imt, sa_period, sa_damping, rupture_tag = key # using a generator here saves a lot of memory nodes = (_GroundMotionFieldNode(gmv, _Point(x, y)) - for x, y, gmv in value) + for x, y, gmv in gmf_dict[key]) ses_ordinal = extract_ses_ordinal(rupture_tag) gmfset[ses_ordinal].append( _GroundMotionField(
Fixed an ordering issue Former-commit-id: 1cc<I>ae<I>f<I>e<I>f5bb5f2befedebc0
gem_oq-engine
train
py
b0ef61242ab802741604f26c7f489616719db78a
diff --git a/bin/webpack-dev-server.js b/bin/webpack-dev-server.js index <HASH>..<HASH> 100755 --- a/bin/webpack-dev-server.js +++ b/bin/webpack-dev-server.js @@ -217,9 +217,6 @@ function processOptions(wpOpt) { process.stdin.resume(); } - if(!options.watchDelay && !options.watchOptions) // TODO remove in next major version - options.watchDelay = firstWpOpt.watchDelay; - if(!options.hot) options.hot = argv["hot"];
Remove deprecated `watchDelay` option that was broken anyway
webpack_webpack-dev-server
train
js
3245b3646f3069ffa312bc01fe58412e5b5214e0
diff --git a/shim.js b/shim.js index <HASH>..<HASH> 100644 --- a/shim.js +++ b/shim.js @@ -1 +1 @@ -require('./src/contra.shim.js'); +require('./contra.shim.js');
fix broken require in shim.js
bevacqua_contra
train
js
324b16788d8af9896d2bb54cb8f80c8ba106edbf
diff --git a/bundle/Command/GenerateImageVariationsCommand.php b/bundle/Command/GenerateImageVariationsCommand.php index <HASH>..<HASH> 100644 --- a/bundle/Command/GenerateImageVariationsCommand.php +++ b/bundle/Command/GenerateImageVariationsCommand.php @@ -10,14 +10,14 @@ use eZ\Publish\API\Repository\Values\Content\Query; use eZ\Publish\API\Repository\Values\Content\Query\Criterion; use eZ\Publish\SPI\Variation\VariationHandler; use Generator; -use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand; use Symfony\Component\Cache\Adapter\TagAwareAdapterInterface; +use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Style\SymfonyStyle; -class GenerateImageVariationsCommand extends ContainerAwareCommand +class GenerateImageVariationsCommand extends Command { /** * @var \eZ\Publish\API\Repository\Repository
Command does not need to be container aware
netgen_site-bundle
train
php
c79c5e668f7dbc021c2c95af302be7fb5fbb959a
diff --git a/saunter/po/webdriver/page.py b/saunter/po/webdriver/page.py index <HASH>..<HASH> 100644 --- a/saunter/po/webdriver/page.py +++ b/saunter/po/webdriver/page.py @@ -40,6 +40,23 @@ class Page(object): return False else: return False + + def wait_for_available(self, locator): + """ + Synchronization to deal with elements that are present, and are visible + + :raises: ElementVisiblityTimeout + """ + for i in range(timeout_seconds): + try: + if self.is_element_available(locator): + break + except: + pass + time.sleep(1) + else: + raise ElementVisiblityTimeout("%s availability timed out" % locator) + return True def wait_for_visible(self, locator): """
adding wait_for_available to the webdriver page class
Element-34_py.saunter
train
py
aa5cd4de82b6b682960098138496e85bbe827e47
diff --git a/lib/subprocess.rb b/lib/subprocess.rb index <HASH>..<HASH> 100644 --- a/lib/subprocess.rb +++ b/lib/subprocess.rb @@ -499,7 +499,7 @@ module Subprocess @stdin.close wait_w.delete(@stdin) end - input[0...written] = '' + input = input[written..input.length] if input.empty? @stdin.close wait_w.delete(@stdin)
Make Process#communicate do less work on every iteration (#<I>) * Make Process#communicate do less work on every iteration
stripe_subprocess
train
rb
9a9bf67dfc3559f43534a3b4994a5f6f33245f46
diff --git a/src/BaseRepository.php b/src/BaseRepository.php index <HASH>..<HASH> 100644 --- a/src/BaseRepository.php +++ b/src/BaseRepository.php @@ -94,6 +94,10 @@ abstract class BaseRepository implements BaseRepositoryInterface $this->onceCriteria = new Collection(); $this->activeCriteria = new Collection(); + if ( ! is_numeric($this->perPage) || $this->perPage < 1) { + $this->perPage = config('repository.perPage', 1); + } + $this->makeModel(); } @@ -233,7 +237,7 @@ abstract class BaseRepository implements BaseRepositoryInterface public function paginate($perPage, $columns = ['*'], $pageName = 'page', $page = null) { if ( ! $perPage) { - $perPage = config('repository.perPage', $this->perPage); + $perPage = $this->perPage; } return $this->query()
Falling back to configuration value if perPage property is falsy or less than 1
czim_laravel-repository
train
php
95df2bca66bb7f3ecb32f8ad95e39f3cd58b5860
diff --git a/coursera/test/test_credentials.py b/coursera/test/test_credentials.py index <HASH>..<HASH> 100644 --- a/coursera/test/test_credentials.py +++ b/coursera/test/test_credentials.py @@ -46,8 +46,8 @@ def test_get_credentials_with_invalid_netrc_raises_exception(): def test_get_credentials_with_username_and_password_given(): - username, password = credentials.get_credentials( - username='user', password='pass') + username, password = credentials.get_credentials(username='user', + password='pass') assert username == 'user' assert password == 'pass' @@ -57,8 +57,8 @@ def test_get_credentials_with_username_given(use_keyring=False): _getpass = getpass.getpass getpass.getpass = lambda x: 'pass' - username, password = credentials.get_credentials( - username='user', use_keyring=use_keyring) + username, password = credentials.get_credentials(username='user', + use_keyring=use_keyring) assert username == 'user' assert password == 'pass' @@ -76,7 +76,7 @@ def test_get_credentials_with_keyring(): test_get_credentials_with_username_given(True) # Test again, this time without getpass - username, password = credentials.get_credentials( - username='user', use_keyring=True) + username, password = credentials.get_credentials(username='user', + use_keyring=True) assert username == 'user' assert password == 'pass'
test: test_credentials: Use more natural/readable wrapping.
coursera-dl_coursera-dl
train
py
877dfdda6dbc49c4fc89501e5b8d5aa68779f6fa
diff --git a/packages/neos-ui-contentrepository/src/registry/NodeTypesRegistry.js b/packages/neos-ui-contentrepository/src/registry/NodeTypesRegistry.js index <HASH>..<HASH> 100644 --- a/packages/neos-ui-contentrepository/src/registry/NodeTypesRegistry.js +++ b/packages/neos-ui-contentrepository/src/registry/NodeTypesRegistry.js @@ -163,4 +163,17 @@ export default class NodeTypesRegistry extends SynchronousRegistry { return viewConfiguration; } + + getInlineEditorForProperty(nodeTypeName, propertyName) { + const nodeType = this.get(nodeTypeName); + + return $get(['properties', propertyName, 'ui', 'inline', 'editor'], nodeType) || 'ckeditor'; + } + + getInlineEditorOptionsForProperty(nodeTypeName, propertyName) { + const nodeType = this.get(nodeTypeName); + + return $get(['properties', propertyName, 'ui', 'inline', 'editorOptions'], nodeType) || + $get(['properties', propertyName, 'ui', 'aloha'], nodeType); + } }
TASK: Add logic to discover arbitrary inline editors
neos_neos-ui
train
js
94efbc6a0a7cb981b4c1052d587b182041a5b1ec
diff --git a/aws/ec2/client.go b/aws/ec2/client.go index <HASH>..<HASH> 100644 --- a/aws/ec2/client.go +++ b/aws/ec2/client.go @@ -226,6 +226,7 @@ func (client *Client) RunInstances(config *RunInstancesConfig) (list InstanceLis type DescribeInstancesOptions struct { InstanceIds []string + Filters []*Filter } func (client *Client) DescribeInstancesWithOptions(options *DescribeInstancesOptions) (instances []*Instance, e error) { @@ -238,6 +239,7 @@ func (client *Client) DescribeInstancesWithOptions(options *DescribeInstancesOpt values.Add("InstanceId."+strconv.Itoa(i+1), id) } } + applyFilters(values, options.Filters) raw, e := client.DoSignedRequest("GET", ENDPOINT, values.Encode(), nil) if e != nil { return instances, e @@ -245,6 +247,7 @@ func (client *Client) DescribeInstancesWithOptions(options *DescribeInstancesOpt rsp := &DescribeInstancesResponse{} e = xml.Unmarshal(raw.Content, rsp) if e != nil { + e = fmt.Errorf("%s: %s", e.Error(), string(raw.Content)) return instances, e } return rsp.Instances(), nil
add filters to DescribeInstances
dynport_gocloud
train
go
485dea9033521396b1d8bf647b350ae1e42c4267
diff --git a/tests/AuthnetJsonAimTest.php b/tests/AuthnetJsonAimTest.php index <HASH>..<HASH> 100644 --- a/tests/AuthnetJsonAimTest.php +++ b/tests/AuthnetJsonAimTest.php @@ -1158,7 +1158,7 @@ class AuthnetJsonAimTest extends \PHPUnit_Framework_TestCase $this->assertEquals('9', $response->transactionResponse->cavvResultCode); $this->assertEquals('2149186775', $response->transactionResponse->transId); $this->assertEquals('', $response->transactionResponse->refTransID); - $this->assertEquals('C85B15CED28462974F1114DB07A16C39', $response->transactionResponse->transHas); + $this->assertEquals('C85B15CED28462974F1114DB07A16C39', $response->transactionResponse->transHash); $this->assertEquals('0', $response->transactionResponse->testRequest); $this->assertEquals('XXXX0015', $response->transactionResponse->accountNumber); $this->assertEquals('MasterCard', $response->transactionResponse->accountType);
Fixed typo causing unit test to fail
stymiee_authnetjson
train
php
1fe186b3bff6f13a71cf3e4faf4927b4e3907776
diff --git a/lib/htmlToXlsx.js b/lib/htmlToXlsx.js index <HASH>..<HASH> 100644 --- a/lib/htmlToXlsx.js +++ b/lib/htmlToXlsx.js @@ -55,9 +55,7 @@ module.exports = function (reporter, definition) { if (htmlToXlsxOptions.htmlEngine == null) { if (conversions.chrome) { htmlToXlsxOptions.htmlEngine = 'chrome' - } - - if (conversions.phantom) { + } else if (conversions.phantom) { htmlToXlsxOptions.htmlEngine = 'phantom' }
fix default htmlEngine should be chrome when it is present
jsreport_jsreport-html-to-xlsx
train
js
2c3a7d786e205224623a4805698978960b547a65
diff --git a/pyensembl/database.py b/pyensembl/database.py index <HASH>..<HASH> 100644 --- a/pyensembl/database.py +++ b/pyensembl/database.py @@ -272,14 +272,13 @@ class Database(object): query = """ SELECT %s%s FROM %s - WHERE feature = ? - AND seqname= ? + WHERE seqname= ? AND start <= ? AND end >= ? """ % (distinct_string, column_name, feature) - query_params = [feature, contig, end, position] + query_params = [contig, end, position] if strand: query += " AND strand = ?" @@ -368,12 +367,11 @@ class Database(object): SELECT %s%s FROM %s WHERE %s = ? - AND feature= ? """ % ("distinct " if distinct else "", ", ".join(select_column_names), feature, filter_column) - query_params = [filter_value, feature] + query_params = [filter_value] return self.run_sql_query( sql, required=required, query_params=query_params) @@ -415,9 +413,9 @@ class Database(object): query = """ SELECT %s%s FROM %s - WHERE feature=? + WHERE 1=1 """ % ("DISTINCT " if distinct else "", column, feature) - query_params = [feature] + query_params = [] if contig: contig = normalize_chromosome(contig)
got rid of redundant filter by feature in SQL queries
openvax_pyensembl
train
py
573b434d2fb608978438349e16ed2c245fc046d3
diff --git a/lib/config/massage.js b/lib/config/massage.js index <HASH>..<HASH> 100644 --- a/lib/config/massage.js +++ b/lib/config/massage.js @@ -20,6 +20,15 @@ function massageConfig(config) { massagedConfig[key] = [val]; } else if (isObject(val)) { massagedConfig[key] = massageConfig(val); + } else if (Array.isArray(val)) { + massagedConfig[key] = []; + val.forEach(item => { + if (isObject(item)) { + massagedConfig[key].push(massageConfig(item)); + } else { + massagedConfig[key].push(item); + } + }); } } return massagedConfig;
fix: arrays of objects should be massaged (#<I>)
renovatebot_renovate
train
js
9da8270c4281b151db15bda9c659918ca800e070
diff --git a/frojd_fabric/recipes/django.py b/frojd_fabric/recipes/django.py index <HASH>..<HASH> 100644 --- a/frojd_fabric/recipes/django.py +++ b/frojd_fabric/recipes/django.py @@ -2,20 +2,20 @@ from fabric.state import env from fabric.context_managers import prefix from frojd_fabric.ext import envfile, virtualenv from frojd_fabric import paths -from frojd_fabric.hooks import hook, run_hook +from frojd_fabric.hooks import hook @hook("after_setup") def after_setup(): envfile.create_env() - env.run("virtualenv %s" % paths.get_deploy_path("venv")) + virtualenv.create_venv() @hook("deploy") def after_deploy(): envfile.symlink_env() - with prefix("source %s" % (paths.get_deploy_path("venv")+"/bin/activate")): + with prefix("source %s" % (virtualenv.get_path()+"/bin/activate")): virtualenv.update_requirements() _migrate() reload_uwsgi()
Replaced virtualenv calls with extension
Frojd_Fabrik
train
py
9dc524c1dc045b4c5b0ec2637bad748ff95be296
diff --git a/util/src/main/java/org/killbill/billing/util/security/shiro/dao/JDBCSessionDao.java b/util/src/main/java/org/killbill/billing/util/security/shiro/dao/JDBCSessionDao.java index <HASH>..<HASH> 100644 --- a/util/src/main/java/org/killbill/billing/util/security/shiro/dao/JDBCSessionDao.java +++ b/util/src/main/java/org/killbill/billing/util/security/shiro/dao/JDBCSessionDao.java @@ -62,6 +62,9 @@ public class JDBCSessionDao extends CachingSessionDAO { final DateTime lastAccessTime = new DateTime(session.getLastAccessTime(), DateTimeZone.UTC); final Long sessionId = Long.valueOf(session.getId().toString()); jdbcSessionSqlDao.updateLastAccessTime(lastAccessTime, sessionId); + } else if (session instanceof SimpleSession) { + // Hack to override the value in the cache so subsequent requests see the (stale) value on disk + ((SimpleSession) session).setLastAccessTime(previousSession.getLastAccessTime()); } } else { // Various fields were changed, update the full row
util: make previous patch work with caching Make the cached session reflect the stale last access time value, so the comparison accessedRecently uses the old value, not the one from the (cached) last request. The implementation is not pretty but with the current code, I haven't found a better way :/
killbill_killbill
train
java
fe4207e713d3e318445051b5f04265602b1e0100
diff --git a/lib/turntabler/song.rb b/lib/turntabler/song.rb index <HASH>..<HASH> 100644 --- a/lib/turntabler/song.rb +++ b/lib/turntabler/song.rb @@ -51,13 +51,13 @@ module Turntabler # The playlist this song is referenced from # @return [Turntabler::Playlist] - attribute :playlist do |id| + attribute :playlist, :load => false do |id| client.user.playlists.build(:_id => id) end # The time at which the song was started # @return [Time] - attribute :started_at, :starttime + attribute :started_at, :starttime, :load => false # The number of up votes this song has received. # @note This is only available for the current song playing in a room
Don't load song data when accessing the playlist or started_at timestamp
obrie_turntabler
train
rb
680b2c8126ffecdeb90e3a61a2e0b1b90cf0e65b
diff --git a/pkg/ignore/ignore.go b/pkg/ignore/ignore.go index <HASH>..<HASH> 100644 --- a/pkg/ignore/ignore.go +++ b/pkg/ignore/ignore.go @@ -70,6 +70,10 @@ func getListOfFilesToIgnore(workingDir string) (map[string]string, error) { for scanner.Scan() { filespec := strings.Trim(scanner.Text(), " ") + if len(filespec) == 0 { + continue + } + if strings.HasPrefix(filespec, "#") { continue } diff --git a/pkg/ignore/ignore_test.go b/pkg/ignore/ignore_test.go index <HASH>..<HASH> 100644 --- a/pkg/ignore/ignore_test.go +++ b/pkg/ignore/ignore_test.go @@ -157,6 +157,10 @@ func baseTest(t *testing.T, patterns []string, filesToDel []string, filesToKeep } } +func TestBlankLine(t *testing.T) { + baseTest(t, []string{"foo.bar\n", "\n", "bar.baz\n"}, []string{"foo.bar", "bar.baz"}, []string{"foo.baz"}) +} + func TestSingleIgnore(t *testing.T) { baseTest(t, []string{"foo.bar\n"}, []string{"foo.bar"}, []string{}) }
Skip blank lines in .s2iignore file Updating pkg/ignore/ignore.go to skip blank lines in the .s2iignore file Added test to pkg/ignore/ignore_test.go to test for blank line issues Fixes #<I>
openshift_source-to-image
train
go,go
a3a5e62584c6be61e65941982056f4568e9c8b85
diff --git a/src/Controllers/ElementalAreaController.php b/src/Controllers/ElementalAreaController.php index <HASH>..<HASH> 100644 --- a/src/Controllers/ElementalAreaController.php +++ b/src/Controllers/ElementalAreaController.php @@ -165,6 +165,14 @@ class ElementalAreaController extends CMSMain return HTTPResponse::create($body)->addHeader('Content-Type', 'application/json'); } + /** + * Provides action control for form fields that are request handlers when they're used in an in-line edit form. + * + * Eg. UploadField + * + * @param HTTPRequest $request + * @return array|HTTPResponse|\SilverStripe\Control\RequestHandler|string + */ public function formAction(HTTPRequest $request) { $formName = $request->param('FormName');
DOCS Documention form field action controller method
dnadesign_silverstripe-elemental
train
php
7f0230465478b11ff28f8ed40911d26ef5c326d5
diff --git a/src/Symfony/Component/Security/Csrf/CsrfTokenGeneratorInterface.php b/src/Symfony/Component/Security/Csrf/CsrfTokenGeneratorInterface.php index <HASH>..<HASH> 100644 --- a/src/Symfony/Component/Security/Csrf/CsrfTokenGeneratorInterface.php +++ b/src/Symfony/Component/Security/Csrf/CsrfTokenGeneratorInterface.php @@ -35,6 +35,8 @@ interface CsrfTokenGeneratorInterface * Generates a CSRF token with the given token ID. * * @param string $tokenId An ID that identifies the token + * + * @return string The generated CSRF token */ public function generateCsrfToken($tokenId);
[Security] Added missing PHPDoc tag
symfony_symfony
train
php
dc771565fb70d44e2ea083ca4678c9a2ac286fd2
diff --git a/openquake/hazardlib/calc/gmf.py b/openquake/hazardlib/calc/gmf.py index <HASH>..<HASH> 100644 --- a/openquake/hazardlib/calc/gmf.py +++ b/openquake/hazardlib/calc/gmf.py @@ -279,7 +279,7 @@ class GmfComputer(object): if len(intra_res.shape) == 1: # a vector intra_res = intra_res[:, None] - inter_res = tau * epsilons + inter_res = tau * epsilons # shape (N, 1) * E => (N, E) gmf = to_imt_unit_values(mean + intra_res + inter_res, imt) stdi = tau.max(axis=0) # from shape (N, E) => E return gmf, stdi, epsilons
Added comment [ci skip]
gem_oq-engine
train
py
2139d7deb262a37d12bb9f3a5d8a6463c243a680
diff --git a/pytmx/pytmx.py b/pytmx/pytmx.py index <HASH>..<HASH> 100644 --- a/pytmx/pytmx.py +++ b/pytmx/pytmx.py @@ -879,6 +879,10 @@ class TiledTileset(TiledElement): p = {k: types[k](v) for k, v in child.items()} p.update(parse_properties(child)) + + # images are listed as relative to the .tsx file, not the .tmx file: + if source: + p["path"] = os.path.join(os.path.dirname(source), p["path"]) # handle tiles that have their own image image = child.find('image') @@ -914,6 +918,11 @@ class TiledTileset(TiledElement): image_node = node.find('image') if image_node is not None: self.source = image_node.get('source') + + # When loading from tsx, tileset image path is relative to the tsx file, not the tmx: + if source: + self.source = os.path.join(os.path.dirname(source), self.source) + self.trans = image_node.get('trans', None) self.width = int(image_node.get('width')) self.height = int(image_node.get('height'))
Tileset image is relative to the .tsx file
bitcraft_PyTMX
train
py
e19693caa899f1aee222f54ace55f4a369c6d2e9
diff --git a/src/runner.js b/src/runner.js index <HASH>..<HASH> 100644 --- a/src/runner.js +++ b/src/runner.js @@ -262,6 +262,7 @@ async function runTests() { } toggleCallsites(true) + const finished = [] try { if (!focused && files.length == 1) { console.log('') @@ -269,6 +270,8 @@ async function runTests() { for (let i = 0; i < files.length; i++) { if (!this.stopped) { const file = files[i] + const running = new RunningFile(file, this) + if (focused || files.length > 1) { const header = file.header || path.relative(process.cwd(), file.path) @@ -277,7 +280,9 @@ async function runTests() { console.log(new Array(header.length).fill('⎼').join('')) console.log(bold(header) + '\n') } - await runGroup(file.group) + + await runGroup(running.group) + finished.push(running) } } } catch(error) { @@ -291,7 +296,7 @@ async function runTests() { this.finished = true let testCount = 0, passCount = 0, failCount = 0 - files.forEach(file => { + finished.forEach(file => { testCount += file.testCount passCount += file.passCount failCount += file.failCount
fix: test results The `testCount`, `passCount`, and `failCount` were evaluating to NaN because File instances were used instead of RunningFile instances.
aleclarson_testpass
train
js
a1ff0409f647aad66c63cb8df11c2daafe221eaa
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -45,7 +45,7 @@ extras_require = { # For the pipelines.lsst.io documentation project 'pipelines': [ 'lsst-sphinx-bootstrap-theme>=0.1.0,<0.2.0', - 'astropy-helpers>=1.2.0,<1.4.0', + 'astropy-helpers>=3.0.0,<4.0.0', 'breathe==4.4.0' ],
bump astropy_helpers to ~> <I>
lsst-sqre_documenteer
train
py
6b758569b15cde0b3026ef9cf87461c3e61be3ba
diff --git a/lib/middleware.js b/lib/middleware.js index <HASH>..<HASH> 100644 --- a/lib/middleware.js +++ b/lib/middleware.js @@ -127,10 +127,27 @@ module.exports = less.middleware = function(options){ // Default dest dir to source var dest = options.dest ? options.dest : src; + if (options.paths){ + if (!(options.paths instanceof Array)) { + options.paths = [options.paths]; + } + } else { + options.paths = []; + } + // Default compile callback options.render = options.render || function(str, lessPath, cssPath, callback) { + + var paths = []; + options.paths.forEach(function(p){ paths.push(p); }); + + var p = path.dirname(lessPath); + if (paths.indexOf(p) < 0) { + paths.push(p); + } + var parser = new less.Parser({ - paths: [path.dirname(lessPath)], + paths: paths, filename: lessPath, optimization: options.optimization });
Added the option to configure the less paths.
emberfeather_less.js-middleware
train
js
e460e79e822f556defce965bbcf42a1c1716006e
diff --git a/saltcontainers/factories.py b/saltcontainers/factories.py index <HASH>..<HASH> 100644 --- a/saltcontainers/factories.py +++ b/saltcontainers/factories.py @@ -225,6 +225,10 @@ class SaltFactory(BaseFactory): client.configure_salt(obj['container']['config']) + if os.environ.get('FLAVOR') == 'devel' and os.environ.get('SALT_REPO'): + obj.run('pip install -e {0}'.format( + os.environ.get('SALT_REPO_MOUNTPOINT', '/salt/src/salt-*'))) + output = client.run( obj['container']['config']['name'], obj['cmd'] )
Do pip install right after devel container start
dincamihai_pytest-salt-containers
train
py
d6c6cf472ce99834c2d255e407c139342a065ae6
diff --git a/src/nodes/entity/switch-controller.js b/src/nodes/entity/switch-controller.js index <HASH>..<HASH> 100644 --- a/src/nodes/entity/switch-controller.js +++ b/src/nodes/entity/switch-controller.js @@ -26,11 +26,10 @@ class Switch extends EntityNode { } onHaEventMessage(evt) { + const stateChanged = + evt.type === 'state_changed' && evt.state !== this.isEnabled; super.onHaEventMessage(evt); - if ( - evt.type === 'state_changed' && - this.nodeConfig.outputOnStateChange - ) { + if (stateChanged && this.nodeConfig.outputOnStateChange) { // fake a HA entity const entity = { state: this.isEnabled,
fix(entity): Only output state change when the state actually changes The entity switch would output anytime the state_changed event was received even when the state didn't change Closes #<I>
zachowj_node-red-contrib-home-assistant-websocket
train
js
2629254663540ec31514b2a3a9a84a0e7369de0d
diff --git a/src/Support/Carbon.php b/src/Support/Carbon.php index <HASH>..<HASH> 100644 --- a/src/Support/Carbon.php +++ b/src/Support/Carbon.php @@ -52,7 +52,7 @@ class Carbon extends BaseCarbon implements JsonSerializable * @param array $array * @return static */ - public static function __set_state($array) + public static function __set_state(array $array) { return static::instance(parent::__set_state($array)); }
Merge with Laravel <I>
antonioribeiro_ia-collection
train
php
c5d41f5cb8c6bc1a1a5fb779f789cb669763b425
diff --git a/bigtable-dataflow-parent/bigtable-hbase-beam/src/main/java/com/google/cloud/bigtable/beam/CloudBigtableConfiguration.java b/bigtable-dataflow-parent/bigtable-hbase-beam/src/main/java/com/google/cloud/bigtable/beam/CloudBigtableConfiguration.java index <HASH>..<HASH> 100644 --- a/bigtable-dataflow-parent/bigtable-hbase-beam/src/main/java/com/google/cloud/bigtable/beam/CloudBigtableConfiguration.java +++ b/bigtable-dataflow-parent/bigtable-hbase-beam/src/main/java/com/google/cloud/bigtable/beam/CloudBigtableConfiguration.java @@ -247,7 +247,10 @@ public class CloudBigtableConfiguration implements Serializable { // BigtableOptions.BIGTABLE_ASYNC_MUTATOR_COUNT_DEFAULT); config.set(BigtableOptionsFactory.BIGTABLE_ASYNC_MUTATOR_COUNT_KEY, "0"); for (Entry<String, ValueProvider<String>> entry : configuration.entrySet()) { - config.set(entry.getKey(), entry.getValue().get()); + // If the value from ValueProvider is null, the value was not provided at runtime. + if (entry.getValue().get() != null) { + config.set(entry.getKey(), entry.getValue().get()); + } } setUserAgent(config); return config;
Add CloudBigtable config to HBase config only if the value in ValueProvider is not null. (#<I>)
googleapis_cloud-bigtable-client
train
java
d0b0dbecf4188abea1e6f916c292c7241f17f6cc
diff --git a/lib/octokit/client/contents.rb b/lib/octokit/client/contents.rb index <HASH>..<HASH> 100644 --- a/lib/octokit/client/contents.rb +++ b/lib/octokit/client/contents.rb @@ -73,7 +73,9 @@ module Octokit end end raise ArgumentError.new "content or :file option required" if content.nil? - options[:content] = Base64.strict_encode64(content) + options[:content] = Base64.respond_to?(:strict_encode64) ? + Base64.strict_encode64(content) : + Base64.encode64(content).delete("\n") # Ruby 1.9.2 options[:message] = message url = "repos/#{Repository.new repo}/contents/#{path}" put url, options
Ruby <I> does not have #strict_encode<I>
octokit_octokit.rb
train
rb
10d5ba17c44c744be59e9732255f33fda6a165e6
diff --git a/lifxlan/device.py b/lifxlan/device.py index <HASH>..<HASH> 100644 --- a/lifxlan/device.py +++ b/lifxlan/device.py @@ -428,7 +428,7 @@ class Device(object): attempts += 1 if not success: self.close_socket() - raise IOError("WorkflowException: Did not receive {} in response to {}".format(str(response_type), str(msg_type))) + raise WorkflowException("WorkflowException: Did not receive {} in response to {}".format(str(response_type), str(msg_type))) else: self.close_socket() return device_response diff --git a/lifxlan/lifxlan.py b/lifxlan/lifxlan.py index <HASH>..<HASH> 100644 --- a/lifxlan/lifxlan.py +++ b/lifxlan/lifxlan.py @@ -46,7 +46,11 @@ class LifxLAN: if self.num_lights == None: responses = self.discover() else: - responses = self.broadcast_with_resp(GetService, StateService) + try: + responses = self.broadcast_with_resp(GetService, StateService) + except WorkflowException as e: + print ("Exception: {}".format(e)) + return None for r in responses: light = Light(r.target_addr, r.ip_addr, r.service, r.port, self.source_id, self.verbose) self.lights.append(light)
Added error handling for LAN with zero attached LIFX devices
mclarkk_lifxlan
train
py,py
ec538ac5e63f1a9dfb749e0eff2e33d55a575b31
diff --git a/lib/rule/bubble.js b/lib/rule/bubble.js index <HASH>..<HASH> 100644 --- a/lib/rule/bubble.js +++ b/lib/rule/bubble.js @@ -11,11 +11,13 @@ var bubbleJobTitles = [ ]; var temptations = [ + /ales?/, /beers?/, /brewskis?/, 'coffee', 'foosball', /keg(?:erator)?s?/, + /lagers?/, /nerf\s*guns?/, /ping\s*pong?/, /pints?/,
Add a few more beer synonyms Resolves #<I>
rowanmanning_joblint
train
js
fe52e0b420ccfae7099b5b339e22d5b4712ca395
diff --git a/src/controllers/VersionController.php b/src/controllers/VersionController.php index <HASH>..<HASH> 100644 --- a/src/controllers/VersionController.php +++ b/src/controllers/VersionController.php @@ -34,7 +34,7 @@ class VersionController extends FileController { $v = trim($this->exec('git', ['log', '-n', '1', '--pretty=%ai %H %s'])[0]); list($date, $time, $zone, $hash, $commit) = explode(' ', $v, 5); - if ($commit !== 'version bump to ' . $this->version) { + if (!in_array($commit, ['minor', 'version bump to ' . $this->version])) { if ($hash !== $this->hash) { $this->version = 'dev'; }
slightly improved `version` file handling
hiqdev_hidev
train
php
45154c1b3629cef6e927177090e81fae929c30ab
diff --git a/spaceship/spec/portal/app_spec.rb b/spaceship/spec/portal/app_spec.rb index <HASH>..<HASH> 100644 --- a/spaceship/spec/portal/app_spec.rb +++ b/spaceship/spec/portal/app_spec.rb @@ -109,8 +109,7 @@ describe Spaceship::Portal::App do subject { Spaceship::Portal::App.find("net.sunapps.151") } it 'updates the name of the app by given bundle_id' do stub_request(:post, "https://developer.apple.com/services-account/QH65B2/account/ios/identifiers/updateAppIdName.action"). - with(body: { "appIdId" => "B7JBD8LHAA", "name" => "The New Name", "teamId" => "XXXXXXXXXX" }, - headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Content-Type' => 'application/x-www-form-urlencoded', 'User-Agent' => 'Spaceship 2.3.0' }). + with(body: { "appIdId" => "B7JBD8LHAA", "name" => "The New Name", "teamId" => "XXXXXXXXXX" }). to_return(status: 200, body: JSON.parse(PortalStubbing.adp_read_fixture_file('updateAppIdName.action.json')), headers: {}) app = subject.update_name!('The New Name')
Fix spaceship tests shouldn’t include version number (#<I>)
fastlane_fastlane
train
rb
b903c45c2bd5d32b4096b2dcfe085653a33b126a
diff --git a/Controller/VendorController.php b/Controller/VendorController.php index <HASH>..<HASH> 100644 --- a/Controller/VendorController.php +++ b/Controller/VendorController.php @@ -83,6 +83,13 @@ class VendorController extends Controller { $this->get('white_october_breadcrumbs') ->addItem('Home', $this->get('router')->generate('_homepage')) + ->addItem('Vendors', $this->get('router')->generate('pengarwin_vendor')) + ->addItem( + $vendor->getName(), + $this->get('router')->generate('pengarwin_vendor_show', array( + 'slug' => $vendor->getSlug(), + )) + ) ; return array('vendor' => $vendor);
Adding rest of breadcrumbs to vendor/show
phospr_CoreBundle
train
php
5d61197fdd11c771f8e52c5c1a6731ffa4c7092f
diff --git a/generators/server/templates/src/test/java/package/config/_DatabaseTestConfiguration.java b/generators/server/templates/src/test/java/package/config/_DatabaseTestConfiguration.java index <HASH>..<HASH> 100644 --- a/generators/server/templates/src/test/java/package/config/_DatabaseTestConfiguration.java +++ b/generators/server/templates/src/test/java/package/config/_DatabaseTestConfiguration.java @@ -24,8 +24,10 @@ import com.couchbase.client.java.cluster.DefaultBucketSettings; import com.couchbase.client.java.env.CouchbaseEnvironment; import org.assertj.core.util.Lists; import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.data.couchbase.config.AbstractCouchbaseConfiguration; +import org.springframework.data.couchbase.config.BeanNames; import org.springframework.data.couchbase.config.CouchbaseConfigurer; import org.testcontainers.couchbase.CouchbaseContainer; @@ -43,6 +45,7 @@ public class DatabaseTestConfiguration extends AbstractCouchbaseConfiguration { } @Override + @Bean(destroyMethod = "", name = BeanNames.COUCHBASE_ENV) public CouchbaseEnvironment couchbaseEnvironment() { return getCouchbaseContainer().getCouchbaseEnvironment(); }
Fix Spring shutdown problem During tests, Couchbase closing connection methods were called on the destroyed Couchbase container, hence a stack trace a the end of the integration test. Override Spring data beans to remove destroy method call (shutdown is done by closing Docker environment).
jhipster_generator-jhipster
train
java
3d33950f66cfc3ca432bb3de09ac14c81e1ccf13
diff --git a/salt/utils/__init__.py b/salt/utils/__init__.py index <HASH>..<HASH> 100644 --- a/salt/utils/__init__.py +++ b/salt/utils/__init__.py @@ -1379,8 +1379,14 @@ def check_state_result(running): # return false when hosts return a list instead of a dict return False - if state_result.get('result', False) is False: - return False + if 'result' in state_result: + if state_result.get('result', False) is False: + return False + return True + + # Check nested state results + return check_state_result(state_result) + return True
Check nested structures for state results.
saltstack_salt
train
py
528c06631ce15c66d74d693396792c5bce8332c8
diff --git a/.eslintrc.js b/.eslintrc.js index <HASH>..<HASH> 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -47,7 +47,7 @@ module.exports = { "no-unreachable": ["error"],// disallow unreachable code after return, throw, continue, and break statements "no-unsafe-finally": ["error"],// disallow control flow statements in finally blocks "use-isnan": ["error"],// require calls to isNaN() when checking for NaN - "valid-jsdoc": ["error"],// enforce valid JSDoc comments + "valid-jsdoc": ["warn"],// enforce valid JSDoc comments "valid-typeof": ["error"],// enforce comparing typeof expressions against valid strings /*--====[ Best Practices ]====--*/ @@ -165,7 +165,7 @@ module.exports = { "jsx-quotes": ["off"],// enforce the consistent use of either double or single quotes in JSX attributes "key-spacing": ["off"],// enforce consistent spacing between keys and values in object literal properties "keyword-spacing": ["off"],// enforce consistent spacing before and after keywords - "linebreak-style": ["warn", "windows"],// enforce consistent linebreak style + "linebreak-style": ["off", "windows"],// enforce consistent linebreak style "lines-around-comment": ["off"],// require empty lines around comments "max-depth": ["off"],// enforce a maximum depth that blocks can be nested "max-len": ["off"],// enforce a maximum line length
Updating lint rules.
eXigentCoder_swagger-spec-express
train
js