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
c332d0bafbf266e032490decbdecc8b5086c39db
diff --git a/ricecooker/utils/downloader.py b/ricecooker/utils/downloader.py index <HASH>..<HASH> 100644 --- a/ricecooker/utils/downloader.py +++ b/ricecooker/utils/downloader.py @@ -40,14 +40,18 @@ try: async def load_page(path): browser = await launch({'headless': True}) - page = await browser.newPage() - # TODO: We may need to add an option for networkidle2 if we want to use this with - # pages that are doing constant polling. - await page.goto(path, {'waitUntil': ['load', 'domcontentloaded', 'networkidle0']}) - # get the entire rendered page, including the doctype - content = await page.content() - cookies = await page.cookies() - await browser.close() + content = None + cookies = None + try: + page = await browser.newPage() + # TODO: We may need to add an option for networkidle2 if we want to use this with + # pages that are doing constant polling. + await page.goto(path, {'waitUntil': ['load', 'domcontentloaded', 'networkidle0']}) + # get the entire rendered page, including the doctype + content = await page.content() + cookies = await page.cookies() + finally: + await browser.close() return content, {'cookies': cookies} USE_PYPPETEER = True except:
Make sure we always close the browser, even if an error occurs.
learningequality_ricecooker
train
py
37503b1dd7115c8cdf04523bbbb38738b4b38c40
diff --git a/src/View/Helper/TimeHelper.php b/src/View/Helper/TimeHelper.php index <HASH>..<HASH> 100644 --- a/src/View/Helper/TimeHelper.php +++ b/src/View/Helper/TimeHelper.php @@ -333,6 +333,10 @@ class TimeHelper extends Helper return $invalid; } + if ($date instanceof \DateTimeImmutable) { + $date = $date->toMutable(); + } + try { $time = new Time($date); return $time->i18nFormat($format, $timezone);
transform immutable datetime to mutable when using the time helper
cakephp_cakephp
train
php
af1ead70c15308c3980b6470852614da14467d2b
diff --git a/treeherder/client/thclient/client.py b/treeherder/client/thclient/client.py index <HASH>..<HASH> 100644 --- a/treeherder/client/thclient/client.py +++ b/treeherder/client/thclient/client.py @@ -620,6 +620,7 @@ class TreeherderClient(object): REPOSITORY_ENDPOINT = 'repository' JOBGROUP_ENDPOINT = 'jobgroup' JOBTYPE_ENDPOINT = 'jobtype' + MACHINE_PLATFORM_ENDPOINT = 'machineplatform' MAX_COUNT = 2000 def __init__( @@ -783,6 +784,22 @@ class TreeherderClient(object): """ return self._get_json(self.JOBTYPE_ENDPOINT, None) + def get_machine_platforms(self): + """ + Gets a list of machine platforms stored inside Treeherder + + Returns a list of dictionaries with the following properties: + + { + id: <id> + os_name: <os_name> + platform: <platform>, + architecture: <architecture>, + active_status: <active_status> + } + """ + return self._get_json(self.MACHINE_PLATFORM_ENDPOINT, None) + def get_resultsets(self, project, **params): """ Gets resultsets from project, filtered by parameters
Bug <I> - Add a client method for getting list of machine platforms
mozilla_treeherder
train
py
7cd22d7f906c07d2d912cd98343a426e4cc89808
diff --git a/belpy/biopax/processor.py b/belpy/biopax/processor.py index <HASH>..<HASH> 100644 --- a/belpy/biopax/processor.py +++ b/belpy/biopax/processor.py @@ -332,6 +332,12 @@ class BiopaxProcessor(object): return names + def _get_uniprot_id(self, bp_entref): + xrefs = bp_entref.getXref().toArray() + uniprot_refs = [x for x in xrefs if x.getDb() == 'UniProt Knowledgebase'] + uniprot_ids = [r.getId() for r in uniprot_refs] + return uniprot_ids + def _get_hgnc_id(self, bp_entref): xrefs = bp_entref.getXref().toArray() hgnc_refs = [x for x in xrefs if x.getDb() == 'HGNC']
Querying UniProt ID in BioPAX processor
sorgerlab_indra
train
py
d9c9c6acd355547af2bc40c54afc60cb61658e63
diff --git a/lib/rango/boot.rb b/lib/rango/boot.rb index <HASH>..<HASH> 100644 --- a/lib/rango/boot.rb +++ b/lib/rango/boot.rb @@ -33,17 +33,13 @@ end # require gems etc. However if you really want to, you # can bypass loading of init.rb and ORM setup. # This is useful mostly for one file applications -unless Rango.flat? - time = Time.timer { Project.import("init.rb") } - Rango.logger.debug("Loading init.rb ... #{time}") -end # Ruby Enterprise Edition doesn't support Ruby 1.9 yet, but when it will, we will ready if GC.respond_to?(:copy_on_write_friendly=) GC.copy_on_write_friendly = true end -Rango.reloader.setup_signals +# Rango.reloader.setup_signals module Rango class BootLoader
We don't load init.rb automatically, since init.rb itself should require rango and run the boot process
botanicus_rango
train
rb
0d468451e56a5ba66d0c720e49b7bb9350b9c328
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -1,7 +1,7 @@ from setuptools import setup, find_packages setup( name = 'filetracker', - version = '2.1rc1', + version = '2.1', author = 'SIO2 Project Team', author_email = 'sio2@sio2project.mimuw.edu.pl', description = 'Filetracker caching file storage',
Bumped version to <I> (#<I>)
sio2project_filetracker
train
py
4225b4a872fb20aa7438bd1797f97d5b6bb69631
diff --git a/testsrc/org/mozilla/javascript/tests/Test262SuiteTest.java b/testsrc/org/mozilla/javascript/tests/Test262SuiteTest.java index <HASH>..<HASH> 100644 --- a/testsrc/org/mozilla/javascript/tests/Test262SuiteTest.java +++ b/testsrc/org/mozilla/javascript/tests/Test262SuiteTest.java @@ -51,7 +51,7 @@ public class Test262SuiteTest { private static final File testDir = new File("test262/test"); private static final String testHarnessDir = "test262/harness/"; - private static final String testProperties = "testsrc/test262.properties"; + private static String testProperties = "testsrc/test262.properties"; static Map<Integer, Map<String, Script>> HARNESS_SCRIPT_CACHE = new HashMap<>(); static Map<File, Integer> EXCLUDED_TESTS = new LinkedHashMap<>(); @@ -101,6 +101,12 @@ public class Test262SuiteTest { } else { OPT_LEVELS = new int[] {-1, 0, 9}; } + + String propFile = System.getProperty("test262properties"); + + if (propFile != null && !propFile.equals("")) { + testProperties = propFile; + } } private static String getOverriddenLevel() {
Add commandline option for running (ecma) tests with specific (test<I>).properties file
mozilla_rhino
train
java
08658c01779b63e313b10a23946b79294a8aef63
diff --git a/salt/modules/lxc.py b/salt/modules/lxc.py index <HASH>..<HASH> 100644 --- a/salt/modules/lxc.py +++ b/salt/modules/lxc.py @@ -2635,17 +2635,17 @@ def set_dns(name, dnsservers=None, searchdomains=None): def _need_install(name): ret = 0 - has_minion = retcode(name, "command -v salt-minion") + has_minion = retcode(name, 'which salt-minion') # we assume that installing is when no minion is running # but testing the executable presence is not enougth for custom # installs where the bootstrap can do much more than installing # the bare salt binaries. if has_minion: - processes = run_stdout(name, "ps aux") + processes = run_stdout(name, 'ps aux') if 'salt-minion' not in processes: ret = 1 else: - retcode(name, "salt-call --local service.stop salt-minion") + retcode(name, 'salt-call --local service.stop salt-minion') else: ret = 1 return ret
Replace "command -v" with "which" The former does not work in lxc-attach, while the latter does.
saltstack_salt
train
py
6b12bca7c697d98f5fd45e3ee6baf86736b8f0b4
diff --git a/lib/nodejs/sclang.js b/lib/nodejs/sclang.js index <HASH>..<HASH> 100644 --- a/lib/nodejs/sclang.js +++ b/lib/nodejs/sclang.js @@ -72,6 +72,9 @@ SCLang.prototype.args = function() { o.push(this.options.executeFile); } o.push('-u', this.options.langPort); + if (this.options.config) { + o.push('-l', this.options.config); + } return o; };
sclang: pass lang config as -l if supplied
crucialfelix_supercolliderjs
train
js
c54b70abc566dd0fb40bf9f6120ef7a7e26f2d81
diff --git a/butterknife/src/main/java/butterknife/internal/DebouncingOnClickListener.java b/butterknife/src/main/java/butterknife/internal/DebouncingOnClickListener.java index <HASH>..<HASH> 100644 --- a/butterknife/src/main/java/butterknife/internal/DebouncingOnClickListener.java +++ b/butterknife/src/main/java/butterknife/internal/DebouncingOnClickListener.java @@ -3,19 +3,10 @@ package butterknife.internal; import android.view.View; /** - * A {@link View.OnClickListener} that enables debouncing of multiple clicks posted in a row. - * - * Once a click is fired, a post is enqueued to the main thread looper queue and no further click - * is allowed until that post is dequeued. - * - * A click on one button disables all buttons. - * + * A {@linkplain View.OnClickListener click listener} that debounces multiple clicks posted in the + * same frame. A click on one button disables all buttons for that frame. */ public abstract class DebouncingOnClickListener implements View.OnClickListener { - - /** - * This is static because we want to disable clicks for all click listeners. - */ private static boolean enabled = true; private static final Runnable ENABLE_AGAIN = new Runnable() {
Clean up the docs to remove implementation details.
JakeWharton_butterknife
train
java
98b212cbfb2b58abeaa58609e53667058ba23429
diff --git a/src/_pytest/hookspec.py b/src/_pytest/hookspec.py index <HASH>..<HASH> 100644 --- a/src/_pytest/hookspec.py +++ b/src/_pytest/hookspec.py @@ -497,6 +497,13 @@ def pytest_assertion_pass(item, lineno, orig, expl): :param int lineno: line number of the assert statement :param string orig: string with original assertion :param string expl: string with assert explanation + + .. note:: + + This hook is still *experimental*, so its parameters or even the hook itself might + be changed/removed without warning in any future pytest release. + + If you find this hook useful, please share your feedback opening an issue. """
Added "experimental" note.
pytest-dev_pytest
train
py
cf870236a73220437f170733fd81c372e0d407ff
diff --git a/src/EventSubscriber/LocaleSubscriber.php b/src/EventSubscriber/LocaleSubscriber.php index <HASH>..<HASH> 100644 --- a/src/EventSubscriber/LocaleSubscriber.php +++ b/src/EventSubscriber/LocaleSubscriber.php @@ -14,7 +14,7 @@ declare(strict_types=1); namespace Sonata\TranslationBundle\EventSubscriber; use Symfony\Component\EventDispatcher\EventSubscriberInterface; -use Symfony\Component\HttpKernel\Event\GetResponseEvent; +use Symfony\Component\HttpKernel\Event\RequestEvent; use Symfony\Component\HttpKernel\KernelEvents; /** @@ -35,7 +35,7 @@ final class LocaleSubscriber implements EventSubscriberInterface $this->defaultLocale = $defaultLocale; } - public function onKernelRequest(GetResponseEvent $event) + public function onKernelRequest(RequestEvent $event) { $request = $event->getRequest(); if (!$request->hasPreviousSession()) {
Replace deprecated GetResponseEvent with RequestEvent It was deprecated in symfony <I>
sonata-project_SonataTranslationBundle
train
php
613d2e8b52163c623a37990b7ead0fdd97ab30bb
diff --git a/ruby_event_store/spec/client_spec.rb b/ruby_event_store/spec/client_spec.rb index <HASH>..<HASH> 100644 --- a/ruby_event_store/spec/client_spec.rb +++ b/ruby_event_store/spec/client_spec.rb @@ -211,14 +211,14 @@ module RubyEventStore end specify 'timestamp can be overwritten by using with_metadata' do - client.with_metadata(timestamp: '2018-01-01T00:00:00Z') do + client.with_metadata(timestamp: Time.utc(2018, 1, 1)) do client.append(event = TestEvent.new) end published = client.read.limit(100).to_a expect(published.size).to eq(1) expect(published.first.metadata.to_h.keys).to eq([:timestamp]) - expect(published.first.metadata[:timestamp]).to eq('2018-01-01T00:00:00Z') + expect(published.first.metadata[:timestamp]).to eq(Time.utc(2018, 1, 1)) end specify 'timestamp is utc time' do
Timestamp is a Time.
RailsEventStore_rails_event_store
train
rb
fdea57595de8e3d7b9e6c44b625fb7e3d6454ee8
diff --git a/deepcopy_test.go b/deepcopy_test.go index <HASH>..<HASH> 100644 --- a/deepcopy_test.go +++ b/deepcopy_test.go @@ -893,6 +893,21 @@ func TestTimeCopy(t *testing.T) { } } +func TestPointerToStruct(t *testing.T) { + type Foo struct { + Bar int + } + + f := &Foo{Bar: 42} + cpy := Copy(f) + if f == cpy { + t.Errorf("expected copy to point to a different location: orig: %p; copy: %p", f, cpy) + } + if !reflect.DeepEqual(f, cpy) { + t.Errorf("expected the copy to be equal to the original (except for memory location); it wasn't: got %#v; want %#v", f, cpy) + } +} + func TestIssue9(t *testing.T) { // simple pointer copy x := 42
add test of copy of pointer to struct
mohae_deepcopy
train
go
2a6f116a7afc44987441455c92d8123a6ec3d9b1
diff --git a/lib/index.js b/lib/index.js index <HASH>..<HASH> 100644 --- a/lib/index.js +++ b/lib/index.js @@ -18,6 +18,9 @@ module.exports = async function faucetDispatch(referenceDir, config, exitOnError: !watch }); let browsers = browserslist.findConfig(referenceDir) || {}; + if(!browsers.pop) { + browsers = [browsers]; + } let plugins = pluginsByBucket(config); // initialize plugins with corresponding configuration
normalized Browserslist value turns out that a `browserslist` string within `package.json` does not result in an array ¯\_(ツ)_/¯ h/t @tloist
faucet-pipeline_faucet-pipeline-core
train
js
7fe482cf9a632fcaade2d5827ac9bfd658eb90a3
diff --git a/src/core/util/util.js b/src/core/util/util.js index <HASH>..<HASH> 100644 --- a/src/core/util/util.js +++ b/src/core/util/util.js @@ -113,12 +113,14 @@ angular.module('material.core') var scrollOffset = body.scrollTop + body.parentElement.scrollTop; var clientWidth = body.clientWidth; - applyStyles(body, { - position: 'fixed', - width: '100%', - overflowY: 'scroll', - top: -scrollOffset + 'px' - }); + if (body.scrollHeight > body.clientHeight) { + applyStyles(body, { + position: 'fixed', + width: '100%', + overflowY: 'scroll', + top: -scrollOffset + 'px' + }); + } applyStyles(htmlNode, { overflowY: 'hidden'
fix(disableScroll): fix disable scroll creating scrollbar when none existed
angular_material
train
js
6b9079dd0da13cead677f49e12175aa0f8fe6892
diff --git a/lib/rundock/cli.rb b/lib/rundock/cli.rb index <HASH>..<HASH> 100644 --- a/lib/rundock/cli.rb +++ b/lib/rundock/cli.rb @@ -34,7 +34,7 @@ module Rundock option :targetgroup, type: :string, aliases: ['-g'] option :tasks, type: :string, aliases: ['-t'] option :hooks, type: :string, aliases: ['-k'] - option :run_anyway, type: :boolean, default: false + option :run_anyway, type: :boolean, aliases: ['-r'], default: false option :dry_run, type: :boolean, aliases: ['-n'] def do(*scenario_file_path) scenario_file_path = [DEFAULT_SCENARIO_FILE_PATH] if scenario_file_path.empty? @@ -56,7 +56,7 @@ module Rundock option :ssh_config, type: :string, aliases: ['-F'] option :ask_password, type: :boolean, default: false option :sudo, type: :boolean, default: false - option :run_anyway, type: :boolean, default: false + option :run_anyway, type: :boolean, aliases: ['-r'], default: false option :dry_run, type: :boolean, aliases: ['-n'] def ssh opts = {}
Add run anyway option to alase
hiracy_rundock
train
rb
f13a7d8c9c5eb596e9349ba65d22a6e148ce9e8e
diff --git a/src/models/color.js b/src/models/color.js index <HASH>..<HASH> 100644 --- a/src/models/color.js +++ b/src/models/color.js @@ -76,7 +76,7 @@ const ColorModel = Hook.extend({ if (_this.palette && Object.keys(_this.palette._data).length !== 0) { const defaultPalette = _this.getDefaultPalette(); - const currentPalette = _this.getPalette(true); + const currentPalette = _this.getPalette(); const palette = {}; //extend partial current palette with default palette and //switch current palette elements which equals @@ -236,7 +236,7 @@ const ColorModel = Hook.extend({ return this.paletteLabels.getPlainObject(); }, - getPalette(includeDefault) { + getPalette() { //rebuild palette if it's empty if (!this.palette || Object.keys(this.palette._data).length === 0) { const palette = this.getDefaultPalette(); @@ -245,7 +245,7 @@ const ColorModel = Hook.extend({ this.set("paletteLabels", paletteLabels, false, false); } const palette = this.palette.getPlainObject(); - if (this.use === "indicator" && !includeDefault) { + if (this.scaleType !== "ordinal") { delete palette["_default"]; } return palette;
Attempt to fix the bug with color value in the last point when switching color to time
vizabi_vizabi
train
js
66e8546f7ffe6ae1a9d66dfbc9c9a05ecba2e00e
diff --git a/lib/mongo/grid/stream/write.rb b/lib/mongo/grid/stream/write.rb index <HASH>..<HASH> 100644 --- a/lib/mongo/grid/stream/write.rb +++ b/lib/mongo/grid/stream/write.rb @@ -82,9 +82,8 @@ module Mongo def write(io) ensure_open! @indexes ||= ensure_indexes! - data = io.read - @length += data.length - chunks = File::Chunk.split(data, file_info, @n) + @length += io.size + chunks = File::Chunk.split(io, file_info, @n) @n += chunks.size chunks_collection.insert_many(chunks) unless chunks.empty? self
No need to read io stream before creating chunks in GridFS write
mongodb_mongo-ruby-driver
train
rb
0ce165be397f46fe24e26b646169d12dace64dac
diff --git a/lib/Boris/ShallowParser.php b/lib/Boris/ShallowParser.php index <HASH>..<HASH> 100644 --- a/lib/Boris/ShallowParser.php +++ b/lib/Boris/ShallowParser.php @@ -203,7 +203,7 @@ class ShallowParser { return substr($input, -1) == ';' && !preg_match( '/^(' . 'echo|print|exit|die|goto|global|include|include_once|require|require_once|list|' . - 'return|do|for|while|if|function|namespace|class|interface|abstract|switch|' . + 'return|do|for|foreach|while|if|function|namespace|class|interface|abstract|switch|' . 'declare|throw|try|unset' . ')\b/i', $input
Add foreach to list of non-returning statements
borisrepl_boris
train
php
1aa857a9ea08eb18e957b166c6bb3c9defd7891a
diff --git a/bee.go b/bee.go index <HASH>..<HASH> 100644 --- a/bee.go +++ b/bee.go @@ -25,7 +25,7 @@ import ( "strings" ) -const version = "1.2.4" +const version = "1.3.0" type Command struct { // Run runs the command.
change the version to <I>
beego_bee
train
go
b577bebafe638a893bf3412c39ab391e5d964e5b
diff --git a/actionpack/lib/action_dispatch/journey/path/pattern.rb b/actionpack/lib/action_dispatch/journey/path/pattern.rb index <HASH>..<HASH> 100644 --- a/actionpack/lib/action_dispatch/journey/path/pattern.rb +++ b/actionpack/lib/action_dispatch/journey/path/pattern.rb @@ -165,6 +165,10 @@ module ActionDispatch end alias :=~ :match + def match?(other) + to_regexp.match?(other) + end + def source to_regexp.source end diff --git a/actionpack/lib/action_dispatch/journey/router.rb b/actionpack/lib/action_dispatch/journey/router.rb index <HASH>..<HASH> 100644 --- a/actionpack/lib/action_dispatch/journey/router.rb +++ b/actionpack/lib/action_dispatch/journey/router.rb @@ -106,7 +106,7 @@ module ActionDispatch def find_routes(req) routes = filter_routes(req.path_info).concat custom_routes.find_all { |r| - r.path.match(req.path_info) + r.path.match?(req.path_info) } routes =
Use Path::Pattern#match? that uses Regexp#match? where MatchData is not in need
rails_rails
train
rb,rb
3e6e1035aa9305eb85072cee856ddafc664cc6f2
diff --git a/javascript/node/selenium-webdriver/firefox/index.js b/javascript/node/selenium-webdriver/firefox/index.js index <HASH>..<HASH> 100644 --- a/javascript/node/selenium-webdriver/firefox/index.js +++ b/javascript/node/selenium-webdriver/firefox/index.js @@ -337,13 +337,6 @@ class Driver extends webdriver.WebDriver { binary = new Binary(binary); } - let profile = new Profile; - if (caps.has(Capability.PROFILE)) { - profile = caps.get(Capability.PROFILE); - caps.delete(Capability.PROFILE); - } - - let freePort = portprober.findFreePort(); let serverUrl, onQuit; if (caps.get(Capability.MARIONETTE) @@ -353,6 +346,13 @@ class Driver extends webdriver.WebDriver { onQuit = () => service.kill(); } else { + let profile = new Profile; + if (caps.has(Capability.PROFILE)) { + profile = caps.get(Capability.PROFILE); + caps.delete(Capability.PROFILE); + } + + let freePort = portprober.findFreePort(); let preparedProfile = freePort.then(port => prepareProfile(profile, port)); let command = preparedProfile.then(dir => binary.launch(dir));
[js] Move Profile generation out of GeckoDriver path (#<I>)
SeleniumHQ_selenium
train
js
1aaace38a19c21ffbcfec8e46901ed77148d7814
diff --git a/packages/openneuro-server/libs/bidsId.js b/packages/openneuro-server/libs/bidsId.js index <HASH>..<HASH> 100644 --- a/packages/openneuro-server/libs/bidsId.js +++ b/packages/openneuro-server/libs/bidsId.js @@ -41,4 +41,28 @@ export default { } return id }, + + decode(id) { + let decodedId = this.hexToASCII(id) + let datasetId = null + let tag = null + // decodes the two different formats of storing dataset + snapshot tag + if (/\s{4}ds\d{6}/.test(decodedId)) { + datasetId = decodedId.slice(4) + } else if (/\d{6}-\d{5}/.test(decodedId)) { + tag = decodedId.slice(7) + datasetId = 'ds' + decodedId.slice(0, 6) + } else { + // handles all these old dataset ids that start with 57 or 58 + if (id.startsWith('57') || id.startsWith('58')) { + datasetId = id + } else { + // if the id is of the proper length but has no ds, add ds. + // otherwise, add it is short and needs a 0 as well + const beginning = id.length == 6 ? 'ds' : 'ds0' + datasetId = beginning + id + } + } + return { datasetId, tag } + }, }
Server: new decode function to split encoded id into datasetId and snapshotTag
OpenNeuroOrg_openneuro
train
js
df9d853368d4d01d51ff5a4854b9ad3bd7055568
diff --git a/core-bundle/src/Command/SymlinksCommand.php b/core-bundle/src/Command/SymlinksCommand.php index <HASH>..<HASH> 100644 --- a/core-bundle/src/Command/SymlinksCommand.php +++ b/core-bundle/src/Command/SymlinksCommand.php @@ -120,7 +120,7 @@ class SymlinksCommand extends LockedCommand implements ContainerAwareInterface }; $this->createSymlinksFromFinder( - $this->findIn($this->rootDir . "/system/modules")->files()->filter($filter)->name('.htaccess'), + $this->findIn($this->rootDir . '/system/modules')->files()->filter($filter)->name('.htaccess'), 'system/modules' ); } @@ -165,8 +165,8 @@ class SymlinksCommand extends LockedCommand implements ContainerAwareInterface * The method will try to generate relative symlinks and fall back to generating * absolute symlinks if relative symlinks are not supported (see #208). * - * @param string $source The symlink name - * @param string $target The symlink target + * @param string $source The symlink name + * @param string $target The symlink target */ private function symlink($source, $target) {
[Core] Fix issues found by the PHP-CS-Fixer.
contao_contao
train
php
49c856ed3e5893d2c77603cb087649e1b368d600
diff --git a/lib/gemfury/command/app.rb b/lib/gemfury/command/app.rb index <HASH>..<HASH> 100644 --- a/lib/gemfury/command/app.rb +++ b/lib/gemfury/command/app.rb @@ -1,5 +1,6 @@ class Gemfury::Command::App < Thor include Gemfury::Command::Authorization + UserAgent = "Gemfury CLI #{Gemfury::VERSION}".freeze PackageExtensions = %w(gem egg tar.gz tgz nupkg) # Impersonation @@ -191,7 +192,9 @@ private opts = {} opts[:user_api_key] = @user_api_key if @user_api_key opts[:account] = options[:as] if options[:as] - Gemfury::Client.new(opts) + client = Gemfury::Client.new(opts) + client.user_agent = UserAgent + return client end def with_checks_and_rescues(&block)
Separate User Agent for CLI vs. API client
gemfury_gemfury
train
rb
67a15010b34b0679061423c7bf04fa5cd85350d8
diff --git a/src/index.js b/src/index.js index <HASH>..<HASH> 100644 --- a/src/index.js +++ b/src/index.js @@ -15,12 +15,19 @@ const plugin = { (vnode.componentOptions && vnode.componentOptions.listeners) let opts = binding.value || {} - let modifiers = Object.keys(binding.modifiers || {}); + + const modifiers = Object.keys(binding.modifiers || {}); + const placement = modifiers.find(modifier => modifier !== 'arrow'); + const withArrow = modifiers.findIndex(modifier => modifier === 'arrow') !== -1; opts = Object.assign({}, options, opts) - if (modifiers.length) { - opts.placement = opts.placement || modifiers[0]; + if (placement) { + opts.placement = opts.placement || placement; + } + + if (withArrow) { + opts.arrow = opts.arrow !== undefined ? opts.arrow : true; } if (handlers && handlers['show']) {
Add support to have an arrow modifier
KABBOUCHI_vue-tippy
train
js
b233006be0c6aa15a4d9c70d0a46b1c4a9ea5adc
diff --git a/src/index.js b/src/index.js index <HASH>..<HASH> 100644 --- a/src/index.js +++ b/src/index.js @@ -230,7 +230,7 @@ router.set("/api/ruleset/enable/:hash", function(req, res, route){ }); router.set("/api/ruleset/install/:rid", function(req, res, route){ - pe.installRuleset(route.params.rid, function(err){ + pe.db.installRuleset(route.params.rid, function(err){ if(err) return errResp(res, err); jsonResp(res, {ok: true}); });
api ruleset install to use engine core
Picolab_pico-engine
train
js
ffab30d58dd54031b7c34d20faa2e02d284523fa
diff --git a/src/Translation/Translator.php b/src/Translation/Translator.php index <HASH>..<HASH> 100644 --- a/src/Translation/Translator.php +++ b/src/Translation/Translator.php @@ -116,9 +116,9 @@ class Translator string : The translated text. */ - public function trans(string $sText, array $placeholders = array(), $sLanguage = null) + public function trans($sText, array $placeholders = array(), $sLanguage = null) { - $sText = trim($sText); + $sText = trim((string)$sText); /* if(!$sLanguage) { $sLanguage = $this->sLanguage;
Fixed error due to type string in function declaration.
jaxon-php_jaxon-core
train
php
42d49a598ff9f795b2c32f8b6ad2bd10f97cf1be
diff --git a/parsl/executors/mpix/zmq_pipes.py b/parsl/executors/mpix/zmq_pipes.py index <HASH>..<HASH> 100644 --- a/parsl/executors/mpix/zmq_pipes.py +++ b/parsl/executors/mpix/zmq_pipes.py @@ -3,7 +3,7 @@ import zmq import uuid import time - +import pickle class TasksOutgoing(object): """ Outgoing task queue from MPIX @@ -22,6 +22,7 @@ class TasksOutgoing(object): def close(self): self.zmq_socket.close() + self.context.term() class ResultsIncoming(object): @@ -37,8 +38,14 @@ class ResultsIncoming(object): result = self.results_receiver.recv_pyobj() return result + def request_close(self): + status = self.results_receiver.send(pickle.dumps(None)) + time.sleep(0.1) + return status + def close(self): - self.zmq_socket.close() + self.results_receiver.close() + self.context.term() class JobsQIncoming(object):
Adding methods to close sockets safely
Parsl_parsl
train
py
f5eaeb3e394baf5da690f4fbcc3eab89de20514f
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ from distutils.core import setup setup( name='angr-utils', - version='0.2.1', + version='0.2.2', packages=['angrutils'], install_requires=[ 'pydot',
Bumped version to <I> because of package name conflict
axt_angr-utils
train
py
c7e006148357142072b42a8e88ccc329934b4326
diff --git a/webpack.config.build.js b/webpack.config.build.js index <HASH>..<HASH> 100644 --- a/webpack.config.build.js +++ b/webpack.config.build.js @@ -29,6 +29,7 @@ module.exports = function(theme, type = 'intact') { resolve: { alias: { './components/code': './empty', + 'intact$': type === 'vue' ? 'intact-vue' : type === 'react' ? 'intact-react' : undefined, }, }, externals: type === 'intact' ? {
chore: fix build kpc.react.js with intact-vue
ksc-fe_kpc
train
js
0f38c03a889faa97151ea5f3601c151e28e44e26
diff --git a/src/Jobby/BackgroundJob.php b/src/Jobby/BackgroundJob.php index <HASH>..<HASH> 100644 --- a/src/Jobby/BackgroundJob.php +++ b/src/Jobby/BackgroundJob.php @@ -67,8 +67,10 @@ class BackgroundJob return; } + $lockAquired = false; try { $this->helper->aquireLock($lockfile); + $lockAquired = true; if ($this->isFunction()) { $this->runFunction(); @@ -80,7 +82,9 @@ class BackgroundJob $this->mail($e->getMessage()); } - $this->helper->releaseLock($lockfile); + if ($lockAquired) { + $this->helper->releaseLock($lockfile); + } } /**
only release the lock if granted before
jobbyphp_jobby
train
php
9e7886c59b02e460657707ebc54aa0e63a7499a7
diff --git a/py/test/terminal/remote.py b/py/test/terminal/remote.py index <HASH>..<HASH> 100644 --- a/py/test/terminal/remote.py +++ b/py/test/terminal/remote.py @@ -101,18 +101,21 @@ class RemoteTerminalSession(object): from py.__.test.terminal.remote import slaverun_TerminalSession slaverun_TerminalSession(channel) """, stdout=self.out, stderr=self.out) - print "MASTER: initiated slave terminal session ->" - repr = self.config.make_repr(conftestnames=[]) - channel.send((str(topdir), repr, failures)) - print "MASTER: send start info, topdir=%s" % (topdir,) try: - return channel.receive() - except channel.RemoteError, e: - print "*" * 70 - print "ERROR while waiting for proper slave startup" - print "*" * 70 - print e - return [] + print "MASTER: initiated slave terminal session ->" + repr = self.config.make_repr(conftestnames=[]) + channel.send((str(topdir), repr, failures)) + print "MASTER: send start info, topdir=%s" % (topdir,) + try: + return channel.receive() + except channel.RemoteError, e: + print "*" * 70 + print "ERROR while waiting for proper slave startup" + print "*" * 70 + print e + return [] + finally: + gw.exit() def slaverun_TerminalSession(channel): """ we run this on the other side. """
[svn r<I>] explicitely shutdown the gateway for the remote session after each run. --HG-- branch : trunk
vmalloc_dessert
train
py
72feef5194367297c39b4c66224f13fbbb4aac97
diff --git a/params.go b/params.go index <HASH>..<HASH> 100644 --- a/params.go +++ b/params.go @@ -42,7 +42,7 @@ var mainNetParams = Params{ } // regressionPowLimit is the highest proof of work value a bitcoin block can -// have. It is the value 2^256 - 1. +// have for the regression test network. It is the value 2^256 - 1. var regressionPowLimit = new(big.Int).Sub(new(big.Int).Lsh(bigOne, 255), bigOne) // regressionParams contains parameters specific to the regression test network
Clarify reg test proof of work limit comment.
btcsuite_btcd
train
go
bd8818c9fe04ad769fb96e7c23f242cf50945090
diff --git a/astropy_helpers/commands/test.py b/astropy_helpers/commands/test.py index <HASH>..<HASH> 100644 --- a/astropy_helpers/commands/test.py +++ b/astropy_helpers/commands/test.py @@ -33,14 +33,18 @@ except Exception: class _AstropyTestMeta(type): """ - Causes an exception to be raised on accessing user_options so that - if ``./setup.py test`` is run with additional command-line options we - can provide a useful error message instead of the default that tells - users the options are unrecognized. + Causes an exception to be raised on accessing attributes of the test + command class so that if ``./setup.py test`` is run with additional + command-line options we can provide a useful error message instead of + the default that tells users the options are unrecognized. """ - @property - def user_options(cls): + def __getattribute__(cls, attr): + if attr == 'description': + # Allow cls.description to work so that `./setup.py + # --help-commands` still works + return super(_AstropyTestMeta, cls).__getattribute__(attr) + raise DistutilsArgError( "Test 'test' command requires the astropy package to be " "installed and importable.")
Should fix #<I>. Turns out that on Python 2, hasattr returns False upon _any_ exception, whereas on Python 3 it returns False only when AttributeError is raised, and allows any other exception to bubble up. By casting a wider net this seems to get the job done for both Python 2 and 3.
astropy_astropy-helpers
train
py
6ea6e458b72f5f505cd36053b68147cf4a932bf0
diff --git a/lib/boot.js b/lib/boot.js index <HASH>..<HASH> 100644 --- a/lib/boot.js +++ b/lib/boot.js @@ -9,8 +9,8 @@ const wrap = fn => function () { function deferAll(obj) { const o = {}; for (const k in obj) { - o[k] = function (...args) { - return this.then(() => obj[k](...args)); + o[k] = function () { + return this.then(() => obj[k].apply(o, arguments)); }; } return o;
replace spread operator (v6 only)
lukeed_taskr
train
js
8beaebfb1e1facb4d05160e0a30b7eb6e47efbce
diff --git a/Builder/Generator.php b/Builder/Generator.php index <HASH>..<HASH> 100755 --- a/Builder/Generator.php +++ b/Builder/Generator.php @@ -111,7 +111,7 @@ class Generator extends TwigGeneratorGenerator $value = $configurations; } else { // All fields are still available in a builder - $value = array_merge($value, $configurations); + $value = array_merge($value ?:array(), $configurations); } } else { if (is_array($value)) {
Fix case where fields is null in global and defined in a builder
symfony2admingenerator_AdmingeneratorGeneratorBundle
train
php
52678a284382d4da911c007fe8bc84b47057925f
diff --git a/src/java/org/apache/cassandra/db/compaction/SSTableSplitter.java b/src/java/org/apache/cassandra/db/compaction/SSTableSplitter.java index <HASH>..<HASH> 100644 --- a/src/java/org/apache/cassandra/db/compaction/SSTableSplitter.java +++ b/src/java/org/apache/cassandra/db/compaction/SSTableSplitter.java @@ -17,7 +17,6 @@ */ package org.apache.cassandra.db.compaction; -import java.io.IOException; import java.util.*; import org.apache.cassandra.db.*; @@ -34,7 +33,7 @@ public class SSTableSplitter { this.task = new SplittingCompactionTask(cfs, sstable, sstableSizeInMB); } - public void split() throws IOException + public void split() { task.execute(new StatsCollector()); }
don't declare throwing exceptions that aren't thrown
Stratio_stratio-cassandra
train
java
0cb72daac536727a0e411e3f2daa78d42c12baf6
diff --git a/plugin/webdav/plugin.go b/plugin/webdav/plugin.go index <HASH>..<HASH> 100644 --- a/plugin/webdav/plugin.go +++ b/plugin/webdav/plugin.go @@ -242,6 +242,16 @@ func (dav WebDAV) do(method, path string, in io.Reader) (*http.Response, error) } func (dav WebDAV) Put(path string, in io.Reader) (int64, error) { + paths := strings.Split(path, "/") + for i := range paths { + if i == 0 { + continue + } + if _, err := dav.do("MKCOL", strings.Join(paths[0:i], "/"), nil); err != nil { + return 0, err + } + } + res, err := dav.do("PUT", path, in) if err != nil { return 0, err
webdav: Issue MKCOL for intervening directories Some WebDAV implementations (i.e. Apache) cannot accept a PUT request to a collection (directory) that does not already exist. Now, the webdav plugin can handle this by issuing MKCOL requests for all intervening collections (directories) before issuing the final PUT.
starkandwayne_shield
train
go
8e5f58853327a3fcf4c42da8219f536ac86e302d
diff --git a/src/League/Fractal/Scope.php b/src/League/Fractal/Scope.php index <HASH>..<HASH> 100644 --- a/src/League/Fractal/Scope.php +++ b/src/League/Fractal/Scope.php @@ -168,15 +168,15 @@ class Scope $currentPage = (int) $paginator->getCurrentPage(); $lastPage = (int) $paginator->getLastPage(); - $pagination = [ + $pagination = array( 'total' => (int) $paginator->getTotal(), 'count' => (int) $paginator->count(), 'per_page' => (int) $paginator->getPerPage(), 'current_page' => $currentPage, 'total_pages' => $lastPage, - ]; + ); - $pagination['links'] = []; + $pagination['links'] = array(); // $paginator->appends(array_except(Request::query(), ['page']));
Fuck everything about PHP <I>.
thephpleague_fractal
train
php
4205b58753712f9f89bd871815a5279c1880c852
diff --git a/_postinstall.js b/_postinstall.js index <HASH>..<HASH> 100755 --- a/_postinstall.js +++ b/_postinstall.js @@ -60,7 +60,7 @@ try { "https://www.bbcweb3hytmzhn5d532owbu6oqadra5z3ar726vq5kgwwn6aucdccrad.onion/russian" ), "", flags(), "", bold("Прекратите эту бессмысленную агрессию! Остановите Путина!"), "", - bold("Не позволяйте ФСБ управлять Россией. Верните его Людям!") + "\x1b[39m", "", + bold("Не позволяйте ФСБ управлять Россией. Верните её Людям!") + "\x1b[39m", "", flags(), "" ].join("\n") );
refactor: Fixed pronoun in manifest (#<I>)
medikoo_es5-ext
train
js
78a67da1b066e2096a0376692d56fc005dc1ca7e
diff --git a/src/middleware/BasicAuthentication.php b/src/middleware/BasicAuthentication.php index <HASH>..<HASH> 100644 --- a/src/middleware/BasicAuthentication.php +++ b/src/middleware/BasicAuthentication.php @@ -23,16 +23,18 @@ class BasicAuthentication // Get current route name $routeName = Request::route()->getName(); + // If we have a named route if ($routeName) { + // Check if route username and password are set - if (!$routeUsername = env('routerestrictor.route.'.$routeName.'.username') || !$routePassword = env('routerestrictor.route.'.$routeName.'.password')) { - throw new Exception('Laravel Route Restrictor route username and password are not set in environment file.'); - } + if ($routeUsername = env('routerestrictor.route.'.$routeName.'.username') && $routePassword = env('routerestrictor.route.'.$routeName.'.password')) { - // Check against route password - if (trim($user) === $routeUsername && trim($password) === $routePassword) { - return true; + // Check against route password + if (trim($user) === $routeUsername && trim($password) === $routePassword) { + return true; + } } + }
Changed logic for username/password restriction for named routes
DivineOmega_laravel-route-restrictor
train
php
27b3bd901f192d1b7b9c5868d5d2098973165174
diff --git a/lib/3scale/core/version.rb b/lib/3scale/core/version.rb index <HASH>..<HASH> 100644 --- a/lib/3scale/core/version.rb +++ b/lib/3scale/core/version.rb @@ -1,5 +1,5 @@ module ThreeScale module Core - VERSION = '1.4.1' + VERSION = '1.4.2' end end
core: bugfix release <I>
3scale_pisoni
train
rb
5e896927ccb0df351239d670f1ebf70d92c5c2a4
diff --git a/flask_appbuilder/static/appbuilder/js/ab.js b/flask_appbuilder/static/appbuilder/js/ab.js index <HASH>..<HASH> 100644 --- a/flask_appbuilder/static/appbuilder/js/ab.js +++ b/flask_appbuilder/static/appbuilder/js/ab.js @@ -51,9 +51,9 @@ $(function() { $('.appbuilder_date').datetimepicker({ pickTime: false }); $(".my_select2").select2({placeholder: "Select a State", allowClear: true}); + $(".my_select2.readonly").select2("readonly", true); loadSelectData(); loadSelectDataSlave(); - $(".my_select2.readonly").attr("readonly", "readonly"); $("a").tooltip({container:'.row', 'placement': 'bottom'}); });
fix(js): select2 readonly not working (#<I>)
dpgaspar_Flask-AppBuilder
train
js
cace968c5534e5e6d3e5f7312bee9c7eb6d0a190
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -54,12 +54,13 @@ classifiers = [ 'Programming Language :: Python :: 2', 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3.4', 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.6', 'Programming Language :: Python :: 3.7', ] -python_requires = '>=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*' +python_requires = '>=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*' setup( name='dimod',
Add <I> to allowed version
dwavesystems_dimod
train
py
728ae7651b9f7fa536290f78d39b786540a1f401
diff --git a/website/gatsby-node.js b/website/gatsby-node.js index <HASH>..<HASH> 100644 --- a/website/gatsby-node.js +++ b/website/gatsby-node.js @@ -177,7 +177,7 @@ exports.createPages = ({ graphql, actions }) => { id: page.id, slug: slug, isIndex: false, - title: page.title, + title: page.title || page.id, data: { ...page, isProject: true }, ...universeContext, },
Fix universe page titles if no separate title is set
explosion_spaCy
train
js
3c9141978eb83cde6325748939447f4eed18f1de
diff --git a/src/plugin/pathify.js b/src/plugin/pathify.js index <HASH>..<HASH> 100644 --- a/src/plugin/pathify.js +++ b/src/plugin/pathify.js @@ -42,7 +42,9 @@ function plugin (store) { store.get = function (path, ...args) { const getter = makeGetter(store, path) if (typeof getter !== 'undefined') { - return getter(...args) + return getter instanceof Function + ? getter()(...args) + : getter } } diff --git a/src/services/accessors.js b/src/services/accessors.js index <HASH>..<HASH> 100644 --- a/src/services/accessors.js +++ b/src/services/accessors.js @@ -53,14 +53,12 @@ export function makeGetter (store, path) { const getter = resolver.get('getters') if (getter.exists) { - return function (...args) { + return function () { let value = getter.member[getter.type] if (getter.path) { value = getValue(value, getter.path) } - return value instanceof Function - ? value(...args) - : value + return value } }
Modified `make.getters()` to return getter functions as actual functions. Fixes #9
davestewart_vuex-pathify
train
js,js
cb848c8dd716b0243e41a94c9b52c803a3056eb4
diff --git a/activerecord/test/cases/migration_test.rb b/activerecord/test/cases/migration_test.rb index <HASH>..<HASH> 100644 --- a/activerecord/test/cases/migration_test.rb +++ b/activerecord/test/cases/migration_test.rb @@ -606,30 +606,26 @@ class MigrationTest < ActiveRecord::TestCase end def with_another_process_holding_lock(lock_key) - other_process_has_lock = false - test_terminated = false + thread_lock = Concurrent::CountDownLatch.new + test_terminated = Concurrent::CountDownLatch.new other_process = Thread.new do begin conn = ActiveRecord::Base.connection_pool.checkout conn.get_advisory_lock(lock_key) - other_process_has_lock = true - while !test_terminated do # hold the lock open until we tested everything - sleep(0.01) - end + thread_lock.count_down + test_terminated.wait # hold the lock open until we tested everything ensure conn.release_advisory_lock(lock_key) ActiveRecord::Base.connection_pool.checkin(conn) end end - while !other_process_has_lock # wait until the 'other process' has the lock - sleep(0.01) - end + thread_lock.wait # wait until the 'other process' has the lock yield - test_terminated = true + test_terminated.count_down other_process.join end end
don't sleep in tests we should be using a countdown latch instead of rolling our own busy-loop.
rails_rails
train
rb
511a043ea17c79d8c091a797c229a6eac3a88674
diff --git a/lib/components/Form/form.stories.js b/lib/components/Form/form.stories.js index <HASH>..<HASH> 100644 --- a/lib/components/Form/form.stories.js +++ b/lib/components/Form/form.stories.js @@ -16,8 +16,7 @@ stories.add('Input', () => ( <Input fieldName="Includes" fieldId="includes" - onChangeFunction={() => { - }} + onChangeFunction={() => {}} /> )); @@ -32,8 +31,8 @@ stories.add('Select', () => ( <Select name="Test field" options={[ - {text: 'Test without value'}, - {text: 'Test with value', value: 'value test'}, + { text: 'Test without value' }, + { text: 'Test with value', value: 'value test' }, ]} /> )); @@ -42,8 +41,7 @@ stories.add('Checkbox', () => ( <Checkbox fieldName="Payment Type" fieldId="prepay" - onClickFunction={() => { - }} + onClickFunction={() => {}} text="prepay" /> ));
Update form.stories.js
travel-cloud_react-component-library
train
js
9b64cb07c4c85ec2d50b88c2531d8daf09fe36a3
diff --git a/parsecsv.lib.php b/parsecsv.lib.php index <HASH>..<HASH> 100644 --- a/parsecsv.lib.php +++ b/parsecsv.lib.php @@ -135,6 +135,8 @@ class parseCSV { var $output_delimiter = ','; var $output_filename = 'data.csv'; + # keep raw file data in memory after successful parsing (useful for debugging) + var $keep_file_data = false; /** * Internal variables @@ -490,6 +492,9 @@ class parseCSV { $rows = array_slice($rows, ($this->offset === null ? 0 : $this->offset) , $this->limit, true); } } + if ( !$this->keep_file_data ) { + $this->file_data = null; + } return $rows; }
Fixed Issue #6 - Automatically clears $file_data property after successful parsing of input data. Set the $keep_file_data property to true to keep it around for debugging. git-svn-id: <URL>
parsecsv_parsecsv-for-php
train
php
830e1714632ad87a42008327badb9a481ff1c37e
diff --git a/branch.go b/branch.go index <HASH>..<HASH> 100644 --- a/branch.go +++ b/branch.go @@ -92,7 +92,7 @@ func (repo *Repository) NewBranchIterator(flags BranchType) (*BranchIterator, er func (repo *Repository) CreateBranch(branchName string, target *Commit, force bool, signature *Signature, msg string) (*Branch, error) { - ref := new(Reference) + var ptr *C.git_reference cBranchName := C.CString(branchName) cForce := cbool(force) @@ -113,11 +113,11 @@ func (repo *Repository) CreateBranch(branchName string, target *Commit, force bo runtime.LockOSThread() defer runtime.UnlockOSThread() - ret := C.git_branch_create(&ref.ptr, repo.ptr, cBranchName, target.cast_ptr, cForce, cSignature, cmsg) + ret := C.git_branch_create(&ptr, repo.ptr, cBranchName, target.cast_ptr, cForce, cSignature, cmsg) if ret < 0 { return nil, MakeGitError(ret) } - return ref.Branch(), nil + return newReferenceFromC(ptr, repo).Branch(), nil } func (b *Branch) Delete() error {
Free reference resource allocated by libgit2 during go garbage collecting
libgit2_git2go
train
go
8879c7feb0eafc612b89fe175da0516a228c6433
diff --git a/lib/fit-commit/runner.rb b/lib/fit-commit/runner.rb index <HASH>..<HASH> 100755 --- a/lib/fit-commit/runner.rb +++ b/lib/fit-commit/runner.rb @@ -77,7 +77,7 @@ module FitCommit end def message_text - File.open(message_path, "r").read + File.read(message_path) end def empty_commit?
Don't leave open file descriptors around
m1foley_fit-commit
train
rb
e1c3c02ced4406364e91ea86d943552b3cfd01b2
diff --git a/snaptime/main.py b/snaptime/main.py index <HASH>..<HASH> 100644 --- a/snaptime/main.py +++ b/snaptime/main.py @@ -1,6 +1,7 @@ import re +from functools import reduce from datetime import datetime, timedelta from dateutil.relativedelta import relativedelta import pytz @@ -41,7 +42,7 @@ UNIT_LISTS = { def get_unit(string): - for unit, variants in UNIT_LISTS.iteritems(): + for unit, variants in UNIT_LISTS.items(): if string in variants: return unit
make compatible with python 3
zartstrom_snaptime
train
py
c9e704863e96df237cf66d894a005189ba77b1f5
diff --git a/script/bump-version.py b/script/bump-version.py index <HASH>..<HASH> 100755 --- a/script/bump-version.py +++ b/script/bump-version.py @@ -88,6 +88,7 @@ def main(): suffix = '' if '-' in version: suffix = '-' + version.split('-')[1] + versions[3] = parse_version(version)[3] version = version.split('-')[0] if args.dry_run:
correctly get pre (#<I>)
electron_electron
train
py
88692e9e4b041be1aa99802d5d1d379070f6dfb0
diff --git a/salt/modules/virtualenv_mod.py b/salt/modules/virtualenv_mod.py index <HASH>..<HASH> 100644 --- a/salt/modules/virtualenv_mod.py +++ b/salt/modules/virtualenv_mod.py @@ -161,11 +161,13 @@ def create(path, ) else: cmd.append('--distribute') - if not os.access(python, os.X_OK): - raise salt.exceptions.CommandExecutionError( - 'Requested python ({0}) does not appear executable.'.format(python) - ) + if python is not None and python.strip() != '': + if not os.access(python, os.X_OK): + raise salt.exceptions.CommandExecutionError( + 'Requested python ({0}) does not appear ' + 'executable.'.format(python) + ) cmd.append('--python={0}'.format(python)) if extra_search_dir is not None: if isinstance(extra_search_dir, basestring) and \
Only check for the execution bits if a value was actually passed.
saltstack_salt
train
py
ba2773bc3f0e0deebd2fdcf66588836b6f3a134d
diff --git a/lewis/adapters/stream.py b/lewis/adapters/stream.py index <HASH>..<HASH> 100644 --- a/lewis/adapters/stream.py +++ b/lewis/adapters/stream.py @@ -349,8 +349,15 @@ class Func: self.func = func + func_name = getattr(func, "__name__", repr(func)) + if isinstance(pattern, str): - pattern = regex(pattern) + try: + pattern = regex(pattern) + except re.error as e: + raise RuntimeError( + f"The pattern '{pattern}' for function '{func_name}' is invalid regex: {e}" + ) self.matcher = pattern @@ -364,7 +371,7 @@ class Func: "The number of arguments for function '{}' matched by pattern " "'{}' is not compatible with number of defined " "groups in pattern ({}).".format( - getattr(func, "__name__", repr(func)), + func_name, self.matcher.pattern, self.matcher.arg_count, )
Make it clearer which commands are throwing regex errors
DMSC-Instrument-Data_lewis
train
py
592391e1befc43f738a116c226ee0c4878479978
diff --git a/bundles/as3/lib/sprout/tasks/asdoc_task.rb b/bundles/as3/lib/sprout/tasks/asdoc_task.rb index <HASH>..<HASH> 100644 --- a/bundles/as3/lib/sprout/tasks/asdoc_task.rb +++ b/bundles/as3/lib/sprout/tasks/asdoc_task.rb @@ -47,6 +47,7 @@ module Sprout # http://livedocs.adobe.com/flex/201/html/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Book_Parts&file=asdoc_127_1.html # class AsDocTask < ToolTask + attr_accessor :exclude_expressions def initialize_task super @@ -228,6 +229,7 @@ EOF end def define # :nodoc: + @exclude_expressions ||= [] super validate_templates CLEAN.add(output) @@ -248,7 +250,7 @@ EOF end end end - + protected def validate_templates @@ -258,7 +260,7 @@ EOF templates_path << templates_dir end end - + def execute(*args) update_helper_mode begin @@ -291,6 +293,16 @@ EOF end end + def filename_to_import_name( filename ) + name = filename.scan(/\w+/) + # Ignore the first (Base directory), and last (AS file extension) elements from + # the filename. + name[1..-2].join('.') + end + + def filelist_from_expressions + FileList[@exclude_expressions] unless @exclude_expressions.empty? + end end end
bundles/as3/lib/sprout/tasks/asdoc_task.rb: * Added attr_accessor for exclude_expressions. * Modified define to initialize exclude_expressions to an empty array. * Added filename_to_import_name method. * Added filelist_from_expressions method.
lukebayes_project-sprouts
train
rb
5cda8c524f22fefaf47a1f38cddfd806e235d437
diff --git a/src/Commands/CacheKeyPrefix.php b/src/Commands/CacheKeyPrefix.php index <HASH>..<HASH> 100644 --- a/src/Commands/CacheKeyPrefix.php +++ b/src/Commands/CacheKeyPrefix.php @@ -46,7 +46,7 @@ class CacheKeyPrefix extends Command * * @return null */ - public function fire() + public function handle() { list($path, $contents) = $this->getKeyFile();
Changes fire() method for handle() method
TypiCMS_Core
train
php
fab5a7519dc862a6304fa1c4a7750fc6184ba5bc
diff --git a/bin/svgicons2svgfont.js b/bin/svgicons2svgfont.js index <HASH>..<HASH> 100755 --- a/bin/svgicons2svgfont.js +++ b/bin/svgicons2svgfont.js @@ -11,6 +11,7 @@ const SVGIcons2SVGFontStream = require('../src/index.js'); const SVGIconsDirStream = require('../src/iconsdir.js'); program + .storeOptionsAsProperties(true) .version(require('../package').version) .usage('[options] <icons ...>') .option('-v, --verbose', 'tell me everything!')
Fix bug with commander The default value of _storeOptionsAsProperties in commander is fucking false, so arguments from cli will never fed into the program.
nfroidure_svgicons2svgfont
train
js
9a8ba0dc8136bb4a45109412e0ee4fa6da39ebce
diff --git a/src/Surfnet/StepupMiddlewareClient/Identity/Dto/IdentitySearchQuery.php b/src/Surfnet/StepupMiddlewareClient/Identity/Dto/IdentitySearchQuery.php index <HASH>..<HASH> 100644 --- a/src/Surfnet/StepupMiddlewareClient/Identity/Dto/IdentitySearchQuery.php +++ b/src/Surfnet/StepupMiddlewareClient/Identity/Dto/IdentitySearchQuery.php @@ -45,12 +45,15 @@ class IdentitySearchQuery implements HttpQuery /** * @param string $institution + * @return IdentitySearchQuery */ - public function __construct($institution) + public function setInstitution($institution) { $this->assertNonEmptyString($institution, 'institution'); $this->institution = $institution; + + return $this; } /** @@ -108,7 +111,9 @@ class IdentitySearchQuery implements HttpQuery */ public function toHttpQuery() { - $fields = ['institution' => $this->institution]; + if ($this->institution) { + $fields = ['institution' => $this->institution]; + } if ($this->commonName) { $fields['commonName'] = $this->commonName;
Make institution query filter optional The institution has been made optional because an identity might not be RA(A) for the institution that is found in its SHO attribute. This was previously used to scope the search results. But since FGA is no longer required.
OpenConext_Stepup-Middleware-clientbundle
train
php
c397e0c8bc387a0db701f2aeb58479894c2aff24
diff --git a/course/yui/modchooser/modchooser.js b/course/yui/modchooser/modchooser.js index <HASH>..<HASH> 100644 --- a/course/yui/modchooser/modchooser.js +++ b/course/yui/modchooser/modchooser.js @@ -88,6 +88,11 @@ YUI.add('moodle-course-modchooser', function(Y) { Y.one(baseselector).all(CSS.SECTION).each(function(section) { this._setup_for_section(section); }, this); + + // Setup for the block site menu + Y.one(baseselector).all(CSS.SITEMENU).each(function(section) { + this._setup_for_section(section); + }, this); }, _setup_for_section : function(section, sectionid) { var chooserspan = section.one(CSS.SECTIONMODCHOOSER); @@ -116,6 +121,9 @@ YUI.add('moodle-course-modchooser', function(Y) { } else if (e.target.ancestor(CSS.SECTION)) { var section = e.target.ancestor(CSS.SECTION); this.sectionid = section.get('id').replace('section-', ''); + } else if (e.target.ancestor(CSS.SITEMENU)) { + // The block site menu has a sectionid of 0 + this.sectionid = 0; } this.display_chooser(e); },
MDL-<I> Detect activity chooser in block_site_main_menu correctly
moodle_moodle
train
js
853766e9a541f56389d2109e484ea1147e4ca878
diff --git a/openquake/server/dbapi.py b/openquake/server/dbapi.py index <HASH>..<HASH> 100644 --- a/openquake/server/dbapi.py +++ b/openquake/server/dbapi.py @@ -266,6 +266,9 @@ def match(m_templ, *m_args): >>> match('SELECT * FROM job WHERE id=?x', 1) ('SELECT * FROM job WHERE id=?', (1,)) """ + # strip commented lines + m_templ = '\n'.join(line for line in m_templ.splitlines() + if not line.lstrip().startswith('--')) if not m_args: return m_templ, () try: @@ -323,7 +326,6 @@ class Db(object): raise exc.__class__('%s: %s %s' % (exc, templ, args)) if templ.lstrip().lower().startswith(('select', 'pragma')): rows = cursor.fetchall() - if kw.get('scalar'): # scalar query if not rows: raise NotFound
Stripped SQL comments in the dbapi
gem_oq-engine
train
py
b93a57156c1f54b1a8c940db0a061e268339368d
diff --git a/src/ol/interaction/DragBox.js b/src/ol/interaction/DragBox.js index <HASH>..<HASH> 100644 --- a/src/ol/interaction/DragBox.js +++ b/src/ol/interaction/DragBox.js @@ -53,6 +53,13 @@ const DragBoxEventType = { * @api */ BOXEND: 'boxend', + + /** + * Triggered upon drag box canceled. + * @event DragBoxEvent#boxcancel + * @api + */ + BOXCANCEL: 'boxcancel', }; /** @@ -192,22 +199,21 @@ class DragBox extends PointerInteraction { handleUpEvent(mapBrowserEvent) { this.box_.setMap(null); - if ( - this.boxEndCondition_( - mapBrowserEvent, - this.startPixel_, - mapBrowserEvent.pixel - ) - ) { + const completeBox = this.boxEndCondition_( + mapBrowserEvent, + this.startPixel_, + mapBrowserEvent.pixel + ); + if (completeBox) { this.onBoxEnd(mapBrowserEvent); - this.dispatchEvent( - new DragBoxEvent( - DragBoxEventType.BOXEND, - mapBrowserEvent.coordinate, - mapBrowserEvent - ) - ); } + this.dispatchEvent( + new DragBoxEvent( + completeBox ? DragBoxEventType.BOXEND : DragBoxEventType.BOXCANCEL, + mapBrowserEvent.coordinate, + mapBrowserEvent + ) + ); return false; }
Add a cancel event to the dragbox interaction
openlayers_openlayers
train
js
1a6bf48c273eeefcd13cb71d5bfe71eb41b55883
diff --git a/bugzilla/base.py b/bugzilla/base.py index <HASH>..<HASH> 100644 --- a/bugzilla/base.py +++ b/bugzilla/base.py @@ -486,7 +486,7 @@ class Bugzilla(object): If 'user' and 'password' are both set, we'll run login(). Otherwise you'll have to login() yourself before some methods will work. ''' - if self._proxy: + if self._transport: self.disconnect() if url is None and self.url: diff --git a/tests/ro_functional.py b/tests/ro_functional.py index <HASH>..<HASH> 100644 --- a/tests/ro_functional.py +++ b/tests/ro_functional.py @@ -248,6 +248,10 @@ class RHTest(BaseTest): test14 = lambda s: BaseTest._testQueryOneline(s, "720784", " CVE-2011-2527") + def testDoubleConnect(self): + bz = self.bzclass(url=self.url) + bz.connect(self.url) + def testQueryFlags(self): bz = self.bzclass(url=self.url) if not bz.logged_in:
base: Fix implied disconnect() on connect() call Apparently we can't check self._proxy like that, since it tries to look up data on the remote connection. Check self._transport instead, and add a test case. <URL>
python-bugzilla_python-bugzilla
train
py,py
6e328e67893eb46323ad06f0e92cb9536babbabc
diff --git a/conn.go b/conn.go index <HASH>..<HASH> 100644 --- a/conn.go +++ b/conn.go @@ -1,17 +1,24 @@ package pool -import "net" +import ( + "net" + "sync" +) // PoolConn is a wrapper around net.Conn to modify the the behavior of // net.Conn's Close() method. type PoolConn struct { net.Conn + mu sync.RWMutex c *channelPool unusable bool } // Close() puts the given connects back to the pool instead of closing it. func (p *PoolConn) Close() error { + p.mu.RLock() + defer p.mu.RUnlock() + if p.unusable { if p.Conn != nil { return p.Conn.Close() @@ -23,7 +30,9 @@ func (p *PoolConn) Close() error { // MarkUnusable() marks the connection not usable any more, to let the pool close it instead of returning it to pool. func (p *PoolConn) MarkUnusable() { + p.mu.Lock() p.unusable = true + p.mu.Unlock() } // newConn wraps a standard net.Conn to a poolConn net.Conn.
Add locks around Close() and MarkUnusable(). (#<I>) * Add locks. * Wrong type of unlock on Close() * Put locks on private variable called mu.
fatih_pool
train
go
2ec0141eb5f28502240f7bf4a089ad86ec78b781
diff --git a/src/plugins/Entity/Entity.Geometry.js b/src/plugins/Entity/Entity.Geometry.js index <HASH>..<HASH> 100644 --- a/src/plugins/Entity/Entity.Geometry.js +++ b/src/plugins/Entity/Entity.Geometry.js @@ -1120,7 +1120,7 @@ Entity.Geometry = meta.Class.extend /** - * Add entity as child. + * Attach entity as child. * @param entity {Entity.Geometry} */ attach: function(entity, isRelative) @@ -1203,6 +1203,10 @@ Entity.Geometry = meta.Class.extend } }, + /** + * Detach child from entity. + * @param entity {Entity.Geometry} + */ detach: function(entity) { if(entity) @@ -1238,6 +1242,9 @@ Entity.Geometry = meta.Class.extend } }, + /** + * Detach all children fro mentity. + */ detachChildren: function() { if(!this.children) { return; }
Docs: Updated info about childs.
tenjou_meta2d
train
js
7ace5b1450df719b862df0b03cecefface7793d8
diff --git a/sdk/core/azure-core/azure/core/pipeline/policies/_utils.py b/sdk/core/azure-core/azure/core/pipeline/policies/_utils.py index <HASH>..<HASH> 100644 --- a/sdk/core/azure-core/azure/core/pipeline/policies/_utils.py +++ b/sdk/core/azure-core/azure/core/pipeline/policies/_utils.py @@ -25,7 +25,8 @@ # -------------------------------------------------------------------------- import datetime import email.utils -from ..._utils import _FixedOffset, _case_insensitive_dict +from requests.structures import CaseInsensitiveDict +from ..._utils import _FixedOffset def _parse_http_date(text): """Parse a HTTP date format into datetime.""" @@ -57,7 +58,7 @@ def get_retry_after(response): :return: Value of Retry-After in seconds. :rtype: float or None """ - headers = _case_insensitive_dict(**response.http_response.headers) + headers = CaseInsensitiveDict(response.http_response.headers) retry_after = headers.get("retry-after") if retry_after: return parse_retry_after(retry_after)
undo remove requests (#<I>)
Azure_azure-sdk-for-python
train
py
529d7525e347ea1673704a7856e55a25609ed465
diff --git a/Resources/public/js/FpJsFormValidator.js b/Resources/public/js/FpJsFormValidator.js index <HASH>..<HASH> 100644 --- a/Resources/public/js/FpJsFormValidator.js +++ b/Resources/public/js/FpJsFormValidator.js @@ -233,7 +233,7 @@ function FpJsCustomizeMethods() { if (data['entity'] && data['entity']['constraints']) { for (var i in data['entity']['constraints']) { var constraint = data['entity']['constraints'][i]; - if (constraint instanceof FpJsFormValidatorBundleFormConstraintUniqueEntity && constraint.fields.indexOf(item.name)) { + if (constraint instanceof FpJsFormValidatorBundleFormConstraintUniqueEntity && constraint.fields.indexOf(item.name) > -1) { var owner = item.jsFormValidator.parent; constraint.validate(null, owner); }
unique-constraints Only run unique constraint checks on the constraint fields
formapro_JsFormValidatorBundle
train
js
c16e18735732b0a9c9812a3d43b5e9d035408ef1
diff --git a/lib/spidr/agent.rb b/lib/spidr/agent.rb index <HASH>..<HASH> 100644 --- a/lib/spidr/agent.rb +++ b/lib/spidr/agent.rb @@ -716,8 +716,8 @@ module Spidr # The URL to add to the failures list. # def failed(url) - @every_failed_url_blocks.each { |block| block.call(url) } @failures << url + @every_failed_url_blocks.each { |block| block.call(url) } return true end
Added the failing url to @failures before calling the every_failed_url blocks.
postmodern_spidr
train
rb
4e62cbe7546409b48d94d5c615da36c915c159aa
diff --git a/lib/dradis/plugins/projects/export/v1/template.rb b/lib/dradis/plugins/projects/export/v1/template.rb index <HASH>..<HASH> 100644 --- a/lib/dradis/plugins/projects/export/v1/template.rb +++ b/lib/dradis/plugins/projects/export/v1/template.rb @@ -33,6 +33,7 @@ module Dradis::Plugins::Projects::Export::V1 end end + # No-op here, overwritten in V2 def build_comments_for(builder, commentable); end def build_evidence_for_node(builder, node) @@ -126,6 +127,7 @@ module Dradis::Plugins::Projects::Export::V1 end end + # No-op here, overwritten in PRO def build_report_content(builder); end def build_tags(builder) diff --git a/lib/dradis/plugins/projects/upload/v1/template.rb b/lib/dradis/plugins/projects/upload/v1/template.rb index <HASH>..<HASH> 100644 --- a/lib/dradis/plugins/projects/upload/v1/template.rb +++ b/lib/dradis/plugins/projects/upload/v1/template.rb @@ -38,6 +38,7 @@ module Dradis::Plugins::Projects::Upload::V1 private + # No-op here, overwritten in V2 def create_comments(commentable, xml_comments) true end
add comments to no-op methods
dradis_dradis-projects
train
rb,rb
5e0d604809346a2dcc69a1b764db13940f21c25c
diff --git a/artist/plot.py b/artist/plot.py index <HASH>..<HASH> 100644 --- a/artist/plot.py +++ b/artist/plot.py @@ -764,7 +764,7 @@ class PolarPlot(Plot): self.plot(x, y, mark=None, linestyle=linestyle) - def set_ylimits(self, min=None, max=None): - """Do not allow setting y limits, it messes with the axes.""" + def set_xlimits(self, min=None, max=None): + """Do not allow setting x limits, it messes with the axes.""" pass
Oops, meant to disable setting of x limits.
davidfokkema_artist
train
py
5505bbad902585d888e3ae6d5cc8ce9fcd00080d
diff --git a/library/WT/GedcomRecord.php b/library/WT/GedcomRecord.php index <HASH>..<HASH> 100644 --- a/library/WT/GedcomRecord.php +++ b/library/WT/GedcomRecord.php @@ -227,7 +227,7 @@ class WT_GedcomRecord { * check if this object is equal to the given object * @param GedcomRecord $obj */ - public function equals(&$obj) { + public function equals($obj) { return !is_null($obj) && $this->xref==$obj->getXref(); } @@ -854,7 +854,7 @@ class WT_GedcomRecord { * for generating a diff view * @param GedcomRecord $diff the record to compare facts with */ - public function diffMerge(&$diff) { + public function diffMerge($diff) { if (is_null($diff)) { return; }
Remove some old PHP4 code. PHP5 passes objects by reference automatically
fisharebest_webtrees
train
php
d44206bafa6d8e9027efc33e41ca2b1b3f2efc68
diff --git a/lazyproxy.py b/lazyproxy.py index <HASH>..<HASH> 100644 --- a/lazyproxy.py +++ b/lazyproxy.py @@ -40,7 +40,7 @@ else: class LazyProxy(object): """Proxy for a lazily-obtained object, that is cached on first use""" - __slots__ = ("__subject__", "__callback__", "__cache__") + __slots__ = ("__callback__", "__cache__") def __init__(self, func): set_callback(self,func) @@ -53,7 +53,9 @@ class LazyProxy(object): set_cache(self, get_callback(self)()) return get_cache(self) - __subject__.setter = set_cache + @__subject__.setter + def __subject__(self, value): + set_cache(self, value) def __getattribute__(self, attr): subject = object.__getattribute__(self, '__subject__')
Don't need subject in __slots__ Fix __subject__ property
gazpachoking_jsonref
train
py
2122082209ac8acfb20107e575139a77412f42db
diff --git a/lib/AssetGraph.js b/lib/AssetGraph.js index <HASH>..<HASH> 100644 --- a/lib/AssetGraph.js +++ b/lib/AssetGraph.js @@ -646,23 +646,6 @@ _.extend(AssetGraph.prototype, { })); }, - createSubgraph: function (startAsset, relationQuery) { - var that = this, - subgraph = new AssetGraph(); - (function traverse(asset) { - if (!(asset.id in subgraph.idIndex)) { - subgraph.addAsset(asset); - that.findRelations(_.extend({from: asset}, relationQuery)).forEach(function (relation) { - if (!(relation.id in subgraph.idIndex)) { - subgraph.addRelation(relation); - } - traverse(relation.to); - }); - } - }(startAsset)); - return subgraph; - }, - runTransform: function (transform, cb) { var that = this, startTime = new Date(),
Removed AssetGraph.createSubgraph (not in use).
assetgraph_assetgraph
train
js
fdac9132d378c4478ee7b6c3b5289e9197e25e06
diff --git a/bg/graphviz.py b/bg/graphviz.py index <HASH>..<HASH> 100644 --- a/bg/graphviz.py +++ b/bg/graphviz.py @@ -570,11 +570,15 @@ class BGTreeVertexProcessor(VertexProcessor): if self.text_processor is None: self.text_processor = BGTreeVertexTextProcessor(color_source=color_source) - def get_vertex_id(self, vertex): - return super().get_vertex_id(vertex=vertex) + def get_vertex_id(self, vertex, leaf_wrapper=BGGenome): + if isinstance(vertex, TreeNode) and vertex.is_leaf(): + vertex_for_id = leaf_wrapper(vertex.name) + else: + vertex_for_id = vertex + return super().get_vertex_id(vertex=vertex_for_id) - def export_vertex_as_dot(self, vertex, label_format=LabelFormat.plain): - vertex_id = self.get_vertex_id(vertex=vertex) + def export_vertex_as_dot(self, vertex, label_format=LabelFormat.plain, leaf_wrapper=BGGenome): + vertex_id = self.get_vertex_id(vertex=vertex, leaf_wrapper=leaf_wrapper) attributes = [] if isinstance(vertex, TreeNode) and vertex.is_leaf(): attributes.extend(self.text_processor.get_attributes_string_list(entry=vertex, label_format=label_format))
fixed BGTree dot export. Now leaves correctly connect to the rest of thre tree
aganezov_bg
train
py
17c2ffe379ce479758832b35270c51e51b690eaa
diff --git a/src/TechDivision/ApplicationServer/AbstractWorker.php b/src/TechDivision/ApplicationServer/AbstractWorker.php index <HASH>..<HASH> 100644 --- a/src/TechDivision/ApplicationServer/AbstractWorker.php +++ b/src/TechDivision/ApplicationServer/AbstractWorker.php @@ -80,7 +80,7 @@ abstract class AbstractWorker extends AbstractContextThread public function main() { $i = 0; - while ($i++ < 10) { + while ($i++ < 100) { // reinitialize the server socket $serverSocket = $this->initialContext->newInstance($this->getResourceClass(), array(
Switch worker load from <I> to <I> requests
appserver-io_appserver
train
php
36abb33d616f55819f70259532281d84c9b467c5
diff --git a/ca/django_ca/models.py b/ca/django_ca/models.py index <HASH>..<HASH> 100644 --- a/ca/django_ca/models.py +++ b/ca/django_ca/models.py @@ -13,6 +13,8 @@ # You should have received a copy of the GNU General Public License along with django-ca. If not, # see <http://www.gnu.org/licenses/>. +import re + from django.db import models from django.utils import timezone from django.utils.translation import ugettext_lazy as _ @@ -27,6 +29,15 @@ class Watcher(models.Model): name = models.CharField(max_length=64, null=True, blank=True, verbose_name=_('CommonName')) mail = models.EmailField(verbose_name=_('E-Mail')) + @classmethod + def from_addr(cls, addr): + defaults = {} + if '<' in addr: + name, addr = re.match('(.*) <(.*)>', addr).groups() + defaults['name'] = name + + return cls.objects.update_or_create(mail=addr, defaults=defaults)[0] + def __str__(self): if self.name: return '%s <%s>' % (self.name, self.mail)
add a from_addr method to parse address strings
mathiasertl_django-ca
train
py
f14629ba634ee5fbb75d589f25374bb37bb41b6b
diff --git a/src/server/pfs/server/local_block_api_server.go b/src/server/pfs/server/local_block_api_server.go index <HASH>..<HASH> 100644 --- a/src/server/pfs/server/local_block_api_server.go +++ b/src/server/pfs/server/local_block_api_server.go @@ -181,6 +181,12 @@ func (s *localBlockAPIServer) ListObjectsTaggedWithPrefix(request *pfsclient.Lis return nil } +func (s *localBlockAPIServer) DeleteObjects(ctx context.Context, request *pfsclient.DeleteObjectsRequest) (response *pfsclient.DeleteObjectsResponse, retErr error) { + func() { s.Log(request, nil, nil, 0) }() + defer func(start time.Time) { s.Log(request, response, retErr, time.Since(start)) }(time.Now()) + return &pfsclient.DeleteObjectsResponse{}, nil +} + func (s *localBlockAPIServer) GetTag(request *pfsclient.Tag, getTagServer pfsclient.ObjectAPI_GetTagServer) (retErr error) { func() { s.Log(request, nil, nil, 0) }() defer func(start time.Time) { s.Log(request, nil, retErr, time.Since(start)) }(time.Now())
Add no-op DeleteObjects to local server
pachyderm_pachyderm
train
go
9982c9c4ac993706ab27049541a676b2fa449ee7
diff --git a/packages/ember-glimmer/tests/integration/content-test.js b/packages/ember-glimmer/tests/integration/content-test.js index <HASH>..<HASH> 100644 --- a/packages/ember-glimmer/tests/integration/content-test.js +++ b/packages/ember-glimmer/tests/integration/content-test.js @@ -988,7 +988,7 @@ moduleFor('Inline style tests', class extends StyleTest { this.assertElement(this.firstChild, { tagName: 'div', content: '', attrs: { 'style': 'width: 60px;' } }); } - ['@htmlbars can set dynamic style with -html-safe']() { + ['@test can set dynamic style with -html-safe']() { this.render('<div style={{-html-safe model.style}}></div>', { model: { style: 'width: 60px;'
[Glimmer2] Unskip html-safe test
emberjs_ember.js
train
js
12cfd94ec5c980c3b30b59cf5c82c81a8e64f605
diff --git a/src/phpDocumentor/Plugin/Core/Transformer/Writer/Xml.php b/src/phpDocumentor/Plugin/Core/Transformer/Writer/Xml.php index <HASH>..<HASH> 100644 --- a/src/phpDocumentor/Plugin/Core/Transformer/Writer/Xml.php +++ b/src/phpDocumentor/Plugin/Core/Transformer/Writer/Xml.php @@ -212,6 +212,10 @@ class Xml extends WriterAbstract implements Translatable $child->appendChild($markers); foreach ($file->getMarkers() as $marker) { + if (! $marker['type']) { + continue; + } + $marker_obj = new \DOMElement(strtolower($marker['type'])); $markers->appendChild($marker_obj); @@ -400,7 +404,13 @@ class Xml extends WriterAbstract implements Translatable foreach ($class->getInheritedMethods() as $method) { // TODO #840: Workaround; for some reason there are NULLs in the methods array. if ($method) { - $this->methodConverter->convert($child, $method); + $methodElement = $this->methodConverter->convert($child, $method); + $methodElement->appendChild( + new \DOMElement( + 'inherited_from', + $method->getParent()->getFullyQualifiedStructuralElementName() + ) + ); } } }
Add inherited_from element on inherited methods
phpDocumentor_phpDocumentor2
train
php
5d2686af53c644e98c2d28de954d2dc2ced9287d
diff --git a/cmd2/argparse_completer.py b/cmd2/argparse_completer.py index <HASH>..<HASH> 100644 --- a/cmd2/argparse_completer.py +++ b/cmd2/argparse_completer.py @@ -10,6 +10,7 @@ import argparse import inspect import numbers import shutil +import textwrap from collections import deque from typing import Dict, List, Optional, Union @@ -622,6 +623,9 @@ class AutoCompleter(object): :param arg_action: action being tab completed :param completion_error: error that occurred """ + # Indent all lines of completion_error + indented_error = textwrap.indent(str(completion_error), ' ') + error = ("\nError tab completing {}:\n" - " {}\n".format(argparse._get_action_name(arg_action), str(completion_error))) + "{}\n".format(argparse._get_action_name(arg_action), indented_error)) self._print_message(style_error('{}'.format(error)))
Improved displaying multiline CompletionErrors
python-cmd2_cmd2
train
py
8b69cce4d0867cc6161c3ca628edda2038434f43
diff --git a/fake_xml_http_request.js b/fake_xml_http_request.js index <HASH>..<HASH> 100644 --- a/fake_xml_http_request.js +++ b/fake_xml_http_request.js @@ -1,4 +1,4 @@ -(function(window, undefined){ +(function(undefined){ /** * Minimal Event interface implementation * @@ -468,6 +468,13 @@ function verifyResponseBodyType(body) { } } - -window.FakeXMLHttpRequest = FakeXMLHttpRequest; -})(typeof window !== 'undefined' ? window : typeof module !== 'undefined' ? module.exports : this); +if (typeof module !== 'undefined' && module.exports) { + module.exports = FakeXMLHttpRequest; +} else if (typeof define === 'function' && define.amd) { + define(function() { return FakeXMLHttpRequest; }); +} else if (typeof window !== 'undefined') { + window.FakeXMLHttpRequest = FakeXMLHttpRequest; +} else if (this) { + this.FakeXMLHttpRequest = FakeXMLHttpRequest; +} +})();
Add more robust checks for CommonJS, AMD, and browser environments.
pretenderjs_FakeXMLHttpRequest
train
js
0e4b800825eec3de1903ebe6f518f43f6dc758ab
diff --git a/drools-test-coverage/test-suite/src/test/java/org/drools/testcoverage/common/util/KieUtil.java b/drools-test-coverage/test-suite/src/test/java/org/drools/testcoverage/common/util/KieUtil.java index <HASH>..<HASH> 100644 --- a/drools-test-coverage/test-suite/src/test/java/org/drools/testcoverage/common/util/KieUtil.java +++ b/drools-test-coverage/test-suite/src/test/java/org/drools/testcoverage/common/util/KieUtil.java @@ -63,7 +63,7 @@ public final class KieUtil { KieModule kieModule = builder.getKieModule(); if (kieBaseTestConfiguration.useCanonicalModel()) { final File kjarFile = FileUtil.bytesToTempKJARFile(releaseId, ((InternalKieModule) kieModule).getBytes(), ".jar" ); - kieModule = new CanonicalKieModule(releaseId, getDefaultKieModuleModel(kieServices), kjarFile ); + kieModule = new CanonicalKieModule(releaseId, kieModuleModel, kjarFile ); } kieServices.getRepository().addKieModule(kieModule);
use correct kieModuleModel in test suite while running executable model tests
kiegroup_drools
train
java
ddb9d1a791f71642906b9c1a6a0f4490e568b001
diff --git a/lib/instance/cook/executable_sequence.rb b/lib/instance/cook/executable_sequence.rb index <HASH>..<HASH> 100644 --- a/lib/instance/cook/executable_sequence.rb +++ b/lib/instance/cook/executable_sequence.rb @@ -316,14 +316,15 @@ module RightScale cookbook_sequence.paths.reverse.each {|path| dir = File.expand_path(File.join(local_basedir, path)) unless Chef::Config[:cookbook_path].include?(dir) - if cookbook_sequence.positions.detect{|pos| pos.position.starts_with?(path)} + if File.directory?(dir) Chef::Config[:cookbook_path] << dir else - RightScale::Log.info("Excluding #{path} from chef cookbooks_path because it will not be downloaded") + RightScale::Log.info("Excluding #{path} from chef cookbooks_path because it was not downloaded") end end } end + RightScale::Log.info("Updated cookbook_path to: #{Chef::Config[:cookbook_path].join(", ")}") true end
only add repository cookbook paths for cookbooks that have been downloaded.
rightscale_right_link
train
rb
74b05ef53085b0ec6604b09f07a3536edcf115c5
diff --git a/salt/modules/consul.py b/salt/modules/consul.py index <HASH>..<HASH> 100644 --- a/salt/modules/consul.py +++ b/salt/modules/consul.py @@ -2164,7 +2164,7 @@ def acl_info(consul_url=None, **kwargs): function = 'acl/info/{0}'.format(kwargs['id']) ret = _query(consul_url=consul_url, data=data, - method='PUT', + method='GET', function=function) return ret
fix HTTP method for acl_info
saltstack_salt
train
py
9b539ab73ff28107ec72d756287e89dbca86f422
diff --git a/bundles/org.eclipse.orion.client.ui/web/orion/commandRegistry.js b/bundles/org.eclipse.orion.client.ui/web/orion/commandRegistry.js index <HASH>..<HASH> 100644 --- a/bundles/org.eclipse.orion.client.ui/web/orion/commandRegistry.js +++ b/bundles/org.eclipse.orion.client.ui/web/orion/commandRegistry.js @@ -1011,7 +1011,7 @@ define([ var self = this; menuButton.onclick = function(evt){ var bounds = lib.bounds(dropdownArrow); - if ((evt.clientX >= bounds.left && created.dropdown) || pretendDefaultActionId === true) { + if ((evt.clientX >= bounds.left || pretendDefaultActionId === true) && created.dropdown) { created.dropdown.toggle(evt); } else { self._invoke(defaultInvocation);
command cannot pretend default action if there is no dropdown
eclipse_orion.client
train
js
6f14e098132ffc08d5c83154c537ff90627c24e7
diff --git a/luigi/file.py b/luigi/file.py index <HASH>..<HASH> 100644 --- a/luigi/file.py +++ b/luigi/file.py @@ -56,7 +56,7 @@ class LocalFileSystem(FileSystem): def exists(self, path): return os.path.exists(path) - def mkdir(self, path): + def mkdir(self, path, parents=True, raise_if_exists=False): os.makedirs(path) def isdir(self, path):
Preserve the overrided method's signature. FileSystem (parent class) had mkdir defined as: def mkdir(self, path, parents=True, raise_if_exists=False): ...
spotify_luigi
train
py
57ba4a84cd03ddb6c771ac19613c38cdf740d4a2
diff --git a/src/HttpAnswer.js b/src/HttpAnswer.js index <HASH>..<HASH> 100644 --- a/src/HttpAnswer.js +++ b/src/HttpAnswer.js @@ -138,7 +138,9 @@ HttpAnswer.prototype.end = function(){ } if( ! this.answered() ){ - this._native.writeHead(this._statusCode, this._headers); + //this.writeHeads(this._statusCode, this._headers); + this._native.statusCode = this._statusCode; + setHeaders(this._native, this); if( isStream(this.data) ){ pump(this.data, this._native); }else{ @@ -150,6 +152,14 @@ HttpAnswer.prototype.end = function(){ } } +function setHeaders(nativeResponse, wrapper){ + const headers = Object.keys( wrapper._headers ); + + for(let i=0; i< headers.length; i++){ + nativeResponse.setHeader( headers[i], wrapper._headers[ headers[i] ]); + } +} + //TODO: test // Check section https://tools.ietf.org/html/rfc7230#section-3.3.2 // we should not send content-length for status code < 200, 204.
fix: don't send the headers in advance. as many libraries send the headers when they start sending the stream.
node-muneem_muneem
train
js
0545f9d2416bb9b848ae59e9429cbf19254fd818
diff --git a/src/extensions/default/CodeFolding/foldhelpers/foldgutter.js b/src/extensions/default/CodeFolding/foldhelpers/foldgutter.js index <HASH>..<HASH> 100644 --- a/src/extensions/default/CodeFolding/foldhelpers/foldgutter.js +++ b/src/extensions/default/CodeFolding/foldhelpers/foldgutter.js @@ -342,11 +342,11 @@ define(function (require, exports, module) { */ function onCursorActivity(cm) { var state = cm.state.foldGutter; + var vp = cm.getViewport(); window.clearTimeout(state.changeUpdate); state.changeUpdate = window.setTimeout(function () { - var from = cm.getCursor("from"), - to = cm.getCursor("to"); - updateInViewport(cm, from.line, to.line); + //need to render the entire visible viewport to remove fold marks rendered from previous selections if any + updateInViewport(cm, vp.from, vp.to); }, 400); }
fixed refresh rendering bug with selection based fold
adobe_brackets
train
js
16a5e2b723350762f890eb9c422db890493f5d88
diff --git a/cogroo-common/src/main/java/br/ccsl/cogroo/tools/featurizer/FeaturizerModel.java b/cogroo-common/src/main/java/br/ccsl/cogroo/tools/featurizer/FeaturizerModel.java index <HASH>..<HASH> 100644 --- a/cogroo-common/src/main/java/br/ccsl/cogroo/tools/featurizer/FeaturizerModel.java +++ b/cogroo-common/src/main/java/br/ccsl/cogroo/tools/featurizer/FeaturizerModel.java @@ -75,7 +75,6 @@ public class FeaturizerModel extends BaseModel { artifactMap.put(FEATURIZER_MODEL_ENTRY_NAME, featurizerModel); - loadArtifactSerializers(); checkArtifactMap(); } @@ -87,9 +86,6 @@ public class FeaturizerModel extends BaseModel { public FeaturizerModel(InputStream in) throws IOException, InvalidFormatException { super(COMPONENT_NAME, in); - loadArtifactSerializers(); - finishLoadingArtifacts(in); - checkArtifactMap(); } @Override
Changed to conform with model subclass requirements
cogroo_cogroo4
train
java
464d6a4526a6a2093b448808b95843f56c6a0098
diff --git a/lib/authem/user.rb b/lib/authem/user.rb index <HASH>..<HASH> 100644 --- a/lib/authem/user.rb +++ b/lib/authem/user.rb @@ -8,7 +8,10 @@ module Authem has_many :authem_sessions, as: :subject, class_name: "Authem::Session" has_secure_password - validates :email, uniqueness: true, format: /\A\S+@\S+\z/ + validates :email, + uniqueness: true, + presence: true, + format: { with: /\A\S+@\S+\z/, allow_blank: true } before_create{ self.password_reset_token = Authem::Token.generate } end
A little more sane validation for blank email
paulelliott_authem
train
rb
720e0578269862b63a33a4acf1e6d67af5548244
diff --git a/tests/SyncIndex.php b/tests/SyncIndex.php index <HASH>..<HASH> 100644 --- a/tests/SyncIndex.php +++ b/tests/SyncIndex.php @@ -20,7 +20,7 @@ class SyncIndex { $response = call_user_func_array(array($this->realIndex, $name), $arguments); - if (isset($response['taskID'])) { + if (is_array($response) && isset($response['taskID'])) { $this->realIndex->waitTask($response['taskID']); }
syncIndex not always get an api response
algolia_algoliasearch-client-php
train
php
d73950249fc224e85c554298fbd3ef1068a7eb5c
diff --git a/themes/theme-ios11/pages/Product/components/AddToCartBar/style.js b/themes/theme-ios11/pages/Product/components/AddToCartBar/style.js index <HASH>..<HASH> 100644 --- a/themes/theme-ios11/pages/Product/components/AddToCartBar/style.js +++ b/themes/theme-ios11/pages/Product/components/AddToCartBar/style.js @@ -8,6 +8,8 @@ const container = css({ background: colors.light, boxShadow: '0 0 30px rgba(0, 0, 0, 0.1)', paddingBottom: 'var(--safe-area-inset-bottom)', + position: 'relative', + zIndex: 2, }); const innerContainer = css({
PWA-<I> Corrected bug where SnackBar messages were above AddToCartBar
shopgate_pwa
train
js
7947f8de01e0ad2acb782a2f61813364ddd0c019
diff --git a/lib/discordrb/bot.rb b/lib/discordrb/bot.rb index <HASH>..<HASH> 100644 --- a/lib/discordrb/bot.rb +++ b/lib/discordrb/bot.rb @@ -54,10 +54,23 @@ module Discordrb data = packet['d'] case packet['t'] when "READY" - initialize_bot(data) - # TODO + # Handle heartbeats + @heartbeat_interval = data['heartbeat_interval'] + setup_heartbeat + + # Initialize the bot user + @bot_user = User.new(data['user']) + + # Initialize servers + @servers = {} + data['guilds'].each do |element| + server = Server.new(element) + @servers[server.id] = server + end when "MESSAGE_CREATE" message = Message.new(data) + + # TODO: Call event handlers end end @@ -83,5 +96,18 @@ module Discordrb @ws.send(packet.to_json) end + + def setup_heartbeat + Thread.new do + loop do + send_heartbeat + sleep @heartbeat_interval + end + end + end + + def send_heartbeat + # TODO + end end end
Add logic to handle the READY packet
meew0_discordrb
train
rb
91b3f6337add88cc03947beacc33233aaa81cbc3
diff --git a/index.js b/index.js index <HASH>..<HASH> 100644 --- a/index.js +++ b/index.js @@ -6,10 +6,15 @@ var path = require("path"); module.exports = function (content, sourceMap) { this.cacheable && this.cacheable(); var resourceDir = path.dirname(this.resourcePath); - var files = glob.sync(content.trim(), { + var pattern = content.trim(); + var files = glob.sync(pattern, { cwd: resourceDir }); + if (!files.length) { + this.emitWarning('Did not find anything for glob "' + pattern + '" in directory "' + resourceDir + '"'); + } + return "module.exports = [\n" + files.map(function (file) { return " require(" + JSON.stringify(file) + ")" }).join(",\n") + "\n];"
feat: warn if there are no matches for the glob
joscha_less-vars-loader
train
js
dd5daaf3588d2315fc552cf57e70fade05b4397f
diff --git a/test/open.js b/test/open.js index <HASH>..<HASH> 100644 --- a/test/open.js +++ b/test/open.js @@ -21,14 +21,19 @@ test('open', t => { }) t.test('> autoconfigure (using invalid password)', t => { - t.plan(2) + t.plan(3) dc.on('DC_EVENT_INFO', info => { if (info.startsWith('Got autoconfig:')) { t.pass('Got autoconfig!') } }) dc.once('DC_EVENT_ERROR_NETWORK', (first, error) => { - t.pass(`Got _some_ error: ${first}, ${error}`) + t.is(first, 1, 'first network error') + if (error.startsWith('Cannot login as')) { + t.pass('Got correct login error') + } else { + t.pass('Got incorrect login error: ' + error) + } }) dc.configure({ addr: 'hpk2@hq5.merlinux.eu',
Make sure the network error has correct syntax (i.e. NOT ssl error)
deltachat_deltachat-node
train
js
abc4ce92980829cbfb39e9ca5b5c899f372e8c88
diff --git a/src/uiSelectController.js b/src/uiSelectController.js index <HASH>..<HASH> 100644 --- a/src/uiSelectController.js +++ b/src/uiSelectController.js @@ -169,7 +169,6 @@ uis.controller('uiSelectCtrl', } ctrl.refreshItems = function (data){ - $scope.calculateDropdownPos(); data = data || ctrl.parserResult.source($scope); var selectedItems = ctrl.selected; //TODO should implement for single mode removeSelected @@ -181,6 +180,9 @@ uis.controller('uiSelectCtrl', ctrl.setItemsFn(filteredItems); } } + if (ctrl.dropdownPosition === 'auto' || ctrl.dropdownPosition === 'up'){ + $scope.calculateDropdownPos(); + } }; // See https://github.com/angular/angular.js/blob/v1.2.15/src/ng/directive/ngRepeat.js#L259
fix(choices): avoid to recalculate position when set 'down'
angular-ui_ui-select
train
js
1b202b86ded13b9c33220fbab45e8b6ce69a5822
diff --git a/test/unit/auth-handlers.test.js b/test/unit/auth-handlers.test.js index <HASH>..<HASH> 100644 --- a/test/unit/auth-handlers.test.js +++ b/test/unit/auth-handlers.test.js @@ -1118,6 +1118,36 @@ describe('Auth Handler:', function () { expect(_.get(request, 'auth.hawk.timestamp')).to.not.be.ok; }); + it('should handle formdata bodies correctly when includePayloadHash=true', + function (done) { + var rawReq = _.merge({}, rawRequests.hawkWithBody, { + body: { + mode: 'formdata', + formdata: [] + } + }), + request = new Request(rawReq), + auth = request.auth, + authInterface = createAuthInterface(auth), + handler = AuthLoader.getHandler(auth.type), + headers; + + handler.sign(authInterface, request, function () { + headers = request.getHeaders({ + ignoreCase: true + }); + + // Ensure that the required headers have been added. + expect(headers).to.have.property('authorization'); + + // Ensure that the body hash is not included in Authorization header. + // Update this once we figure out a way to calculate hash for formdata body type. + expect(headers.authorization).to.not.include('hash'); + + done(); + }); + }); + it('should handle graphql bodies correctly when includePayloadHash=true', function (done) { var rawReq = _.merge({}, rawRequests.hawkWithBody, {
Added test with formdata body in Hawk auth
postmanlabs_postman-runtime
train
js
54db41f5a49087d1f332a57cbf9bcc1a844e3289
diff --git a/polyfills/Event/polyfill.js b/polyfills/Event/polyfill.js index <HASH>..<HASH> 100644 --- a/polyfills/Event/polyfill.js +++ b/polyfills/Event/polyfill.js @@ -17,6 +17,11 @@ textinput: 1 }; + // This polyfill depends on availability of `document` so will not run in a worker + // However, we asssume there are no browsers with worker support that lack proper + // support for `Event` within the worker + if (typeof document === 'undefined' || typeof window === 'undefined') return; + function indexOf(array, element) { var index = -1,
Prevent Event being applied in web workers, fixes #<I> (#<I>) * Prevent Event being applied in web workers * Avoid ReferenceErrors
Financial-Times_polyfill-service
train
js