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
2df7a6075e6913755f49d8950ebfa6900a35ebf6
diff --git a/lib/shape/base.rb b/lib/shape/base.rb index <HASH>..<HASH> 100644 --- a/lib/shape/base.rb +++ b/lib/shape/base.rb @@ -72,7 +72,7 @@ module Shape # property :practices, with: PracticeDecorator, context: {view: :summary} # def property(property_name, options={}, &block) - properties[property_name] = Shape::PropertyShaper.new( + properties[property_name.to_sym] = Shape::PropertyShaper.new( shaper_context, property_name, options, &block ) end
Ensure keys are symbols so we dont duplicate string/symbols.
robincurry_shape
train
rb
45a5d48aac7571d34e457ad315c40e83beeb1a50
diff --git a/test/ClassTestCase.php b/test/ClassTestCase.php index <HASH>..<HASH> 100644 --- a/test/ClassTestCase.php +++ b/test/ClassTestCase.php @@ -237,8 +237,10 @@ class ClassTestCase extends UnitTestCase { $instance = $class->createInstance('toto' , 'tata'); $this->assertEqual($instance->getLabel(), 'toto'); $this->assertEqual($instance->getComment(), 'tata'); - $this->assertNotIdentical($instance,$class->createInstance('toto' , 'tata')); + $instance2 = $class->createInstance('toto' , 'tata'); + $this->assertNotIdentical($instance,$instance2); $instance->delete(); + $instance2->delete(); } public function testCreateSubClass(){
a instance of toto was not remove in unit test git-svn-id: <URL>
oat-sa_generis
train
php
9118a9bf8a96c0bda709af318995dd26013d6fd1
diff --git a/lib/mongo/client.rb b/lib/mongo/client.rb index <HASH>..<HASH> 100644 --- a/lib/mongo/client.rb +++ b/lib/mongo/client.rb @@ -177,7 +177,7 @@ module Mongo # @option options [ Float ] :connect_timeout The timeout, in seconds, to # attempt a connection. # @option options [ Array<String> ] :compressors A list of potential compressors to use, in order of preference. - # The driver chooses the first compressor that is also supported by the server. Currently the driver only + # The driver chooses the first compressor that is also supported by the server. Currently the driver only # supports 'zlib'. # @option options [ Hash ] :read The read preference options. They consist # of a mode specified as a symbol, an array of hashes known as tag_sets,
RUBY-<I> Repair line misalignment causing incorrect rendering
mongodb_mongo-ruby-driver
train
rb
054d490417a64889fbffd3b81fc4d3b412c8f8c3
diff --git a/IPython/html/static/notebook/js/widgets/string.js b/IPython/html/static/notebook/js/widgets/string.js index <HASH>..<HASH> 100644 --- a/IPython/html/static/notebook/js/widgets/string.js +++ b/IPython/html/static/notebook/js/widgets/string.js @@ -46,6 +46,9 @@ require(["notebook/js/widget"], function(){ this.$textbox.val(this.model.get('value')); } + var disabled = this.model.get('disabled'); + this.$textbox.prop('disabled', disabled); + var description = this.model.get('description'); if (description.length == 0) { this.$label.hide(); @@ -96,6 +99,9 @@ require(["notebook/js/widget"], function(){ this.$textbox.val(this.model.get('value')); } + var disabled = this.model.get('disabled'); + this.$textbox.prop('disabled', disabled); + var description = this.model.get('description'); if (description.length == 0) { this.$label.hide();
Made TextArea and TextBox views compatable with disabled property
jupyter-widgets_ipywidgets
train
js
bf15df6d69873f34a130744c71eaad2c7b3d2e8f
diff --git a/lfs/pointer.go b/lfs/pointer.go index <HASH>..<HASH> 100644 --- a/lfs/pointer.go +++ b/lfs/pointer.go @@ -92,7 +92,7 @@ func EncodePointer(writer io.Writer, pointer *Pointer) (int, error) { func DecodePointerFromBlob(b *gitobj.Blob) (*Pointer, error) { // Check size before reading if b.Size >= blobSizeCutoff { - return nil, errors.NewNotAPointerError(errors.New("blob size exceeds lfs pointer size cutoff")) + return nil, errors.NewNotAPointerError(errors.New("blob size exceeds Git LFS pointer size cutoff")) } return DecodePointer(b.Contents) } @@ -104,7 +104,7 @@ func DecodePointerFromFile(file string) (*Pointer, error) { return nil, err } if stat.Size() >= blobSizeCutoff { - return nil, errors.NewNotAPointerError(errors.New(tr.Tr.Get("file size exceeds lfs pointer size cutoff"))) + return nil, errors.NewNotAPointerError(errors.New(tr.Tr.Get("file size exceeds Git LFS pointer size cutoff"))) } f, err := os.OpenFile(file, os.O_RDONLY, 0644) if err != nil {
lfs/pointer.go: uppercase LFS in messages We convert several log messages to use the uppercase acronym "LFS" instead of the lowercase variant. Note that one of these messages is not yet passed as a translation string, but we will address that issue in a subsequent commit.
git-lfs_git-lfs
train
go
d3ae21b2632a15129f03d339416b0e91b1d8f69e
diff --git a/lib/info.rb b/lib/info.rb index <HASH>..<HASH> 100644 --- a/lib/info.rb +++ b/lib/info.rb @@ -1,5 +1,5 @@ module MultiRepo NAME = "git-multirepo" - VERSION = "1.0.0.beta15" + VERSION = "1.0.0.beta16" DESCRIPTION = "Track multiple Git repositories side-by-side." end \ No newline at end of file
Bumped version number to beta<I>.
fortinmike_git-multirepo
train
rb
fcb47ceac67dd1e7f5227e606f19b76f2425faa0
diff --git a/src/core/utils/utils.js b/src/core/utils/utils.js index <HASH>..<HASH> 100644 --- a/src/core/utils/utils.js +++ b/src/core/utils/utils.js @@ -26,16 +26,15 @@ function getOfflineContext(numOfChannels, length, sampleRate) { * clone audio buffer */ -function cloneBuffer(buffer) { +function cloneBuffer(buffer, offset = 0, length = buffer.length) { if (!context || context.isFake) { return buffer; } - - const numChannels = buffer.numberOfChannels, - cloned = context.createBuffer(numChannels, buffer.length, buffer.sampleRate); + const numChannels = buffer.numberOfChannels; + const cloned = sono.context.createBuffer(numChannels, length, buffer.sampleRate); for (let i = 0; i < numChannels; i++) { cloned.getChannelData(i) - .set(buffer.getChannelData(i)); + .set(buffer.getChannelData(i).slice(offset, offset + length)); } return cloned; }
:sparkles: Add offset and length options to clone buffer
Stinkstudios_sono
train
js
cafc4a6f1f0557c9f8acc5e1427f12bb93b05adc
diff --git a/lib/models.go b/lib/models.go index <HASH>..<HASH> 100644 --- a/lib/models.go +++ b/lib/models.go @@ -35,6 +35,11 @@ const groupSeparator = "::" var ErrNameContainsGroupSeparator = errors.Errorf("group and check names may not contain '%s'", groupSeparator) +type SourceData struct { + Data []byte + Filename string +} + type Stage struct { Duration time.Duration `json:"duration"` Target null.Int `json:"target"` diff --git a/lib/options.go b/lib/options.go index <HASH>..<HASH> 100644 --- a/lib/options.go +++ b/lib/options.go @@ -61,11 +61,6 @@ type Options struct { Thresholds map[string]Thresholds `json:"thresholds"` } -type SourceData struct { - Data []byte - Filename string -} - func (o Options) Apply(opts Options) Options { if opts.Paused.Valid { o.Paused = opts.Paused
...why was SourceData defined here...
loadimpact_k6
train
go,go
249d096810207b8aeaa05d01d43837dea30f1b10
diff --git a/engine-rest/engine-rest/src/test/java/org/camunda/bpm/engine/rest/ProcessDefinitionRestServiceInteractionTest.java b/engine-rest/engine-rest/src/test/java/org/camunda/bpm/engine/rest/ProcessDefinitionRestServiceInteractionTest.java index <HASH>..<HASH> 100644 --- a/engine-rest/engine-rest/src/test/java/org/camunda/bpm/engine/rest/ProcessDefinitionRestServiceInteractionTest.java +++ b/engine-rest/engine-rest/src/test/java/org/camunda/bpm/engine/rest/ProcessDefinitionRestServiceInteractionTest.java @@ -3163,19 +3163,6 @@ public class ProcessDefinitionRestServiceInteractionTest extends AbstractRestSer } @Test - public void testUpdateHistoryTimeToLiveAbsentValue() { - given() - .pathParam("id", MockProvider.EXAMPLE_PROCESS_DEFINITION_ID) - .contentType(ContentType.JSON) - .then().expect() - .statusCode(Status.NO_CONTENT.getStatusCode()) - .when() - .put(SINGLE_PROCESS_DEFINITION_HISTORY_TIMETOLIVE_URL); - - verify(repositoryServiceMock).updateProcessDefinitionHistoryTimeToLive(MockProvider.EXAMPLE_PROCESS_DEFINITION_ID, null); - } - - @Test public void testUpdateHistoryTimeToLiveNullValue() { given() .pathParam("id", MockProvider.EXAMPLE_PROCESS_DEFINITION_ID)
fix(engine): remove the test * test is not not needed after CAM-<I> Related with #CAM-<I>
camunda_camunda-bpm-platform
train
java
a17b7f20e0a3a0d79165ce1b5f45f4f6b5b5e0b5
diff --git a/react-datepicker.js b/react-datepicker.js index <HASH>..<HASH> 100644 --- a/react-datepicker.js +++ b/react-datepicker.js @@ -10,6 +10,12 @@ var Calendar = React.createClass({displayName: 'Calendar', }; }, + componentWillReceiveProps: function(nextProps) { + this.setState({ + date: nextProps.selected.clone() + }); + }, + increaseMonth: function() { this.setState({ date: this.state.date.addMonth() diff --git a/src/calendar.js b/src/calendar.js index <HASH>..<HASH> 100644 --- a/src/calendar.js +++ b/src/calendar.js @@ -9,6 +9,12 @@ var Calendar = React.createClass({ }; }, + componentWillReceiveProps: function(nextProps) { + this.setState({ + date: nextProps.selected.clone() + }); + }, + increaseMonth: function() { this.setState({ date: this.state.date.addMonth()
Update state.date when props.selected changes This solves an issue where the calendar wouldn't immediately switch to the correct view when a user types in another date in the input.
Hacker0x01_react-datepicker
train
js,js
268aa97fb6d97e5b2b9adfce5a47c562f707c03f
diff --git a/pdftotree/_version.py b/pdftotree/_version.py index <HASH>..<HASH> 100644 --- a/pdftotree/_version.py +++ b/pdftotree/_version.py @@ -1 +1 @@ -__version__ = "0.5.0+dev" +__version__ = "0.5.0"
Change the version to become publishable to PyPI for now
HazyResearch_pdftotree
train
py
83c7f8467c15e10b18833acae1154bdf285a589a
diff --git a/core/src/main/java/hudson/tools/DownloadFromUrlInstaller.java b/core/src/main/java/hudson/tools/DownloadFromUrlInstaller.java index <HASH>..<HASH> 100644 --- a/core/src/main/java/hudson/tools/DownloadFromUrlInstaller.java +++ b/core/src/main/java/hudson/tools/DownloadFromUrlInstaller.java @@ -122,7 +122,7 @@ public abstract class DownloadFromUrlInstaller extends ToolInstaller { } protected Downloadable createDownloadable() { - return new Downloadable(getDownloadableId()); + return new Downloadable(getId()); } /** @@ -130,7 +130,7 @@ public abstract class DownloadFromUrlInstaller extends ToolInstaller { * <p> * By default we use the fully-qualified class name of the {@link DownloadFromUrlInstaller} subtype. */ - public String getDownloadableId() { + public String getId() { return clazz.getName().replace('$','.'); } @@ -144,7 +144,7 @@ public abstract class DownloadFromUrlInstaller extends ToolInstaller { * @return never null. */ public List<? extends Installable> getInstallables() throws IOException { - JSONObject d = Downloadable.get(getDownloadableId()).getData(); + JSONObject d = Downloadable.get(getId()).getData(); if(d==null) return Collections.emptyList(); return Arrays.asList(((InstallableList)JSONObject.toBean(d,InstallableList.class)).list); }
[FIXED JENKINS-<I>] Reverting getDownloadableId from #<I>. Not compatible. (cherry picked from commit <I>db2a<I>fc<I>b8fb<I>a8d<I>cf<I>b<I>c6e2)
jenkinsci_jenkins
train
java
146142340016e9c06c3de69240e70503f25d01ed
diff --git a/blanc_basic_news/news/templatetags/news_tags.py b/blanc_basic_news/news/templatetags/news_tags.py index <HASH>..<HASH> 100644 --- a/blanc_basic_news/news/templatetags/news_tags.py +++ b/blanc_basic_news/news/templatetags/news_tags.py @@ -12,7 +12,8 @@ def get_news_categories(): @register.assignment_tag def get_news_months(): - return Post.objects.dates('date', 'month') + return Post.objects.filter( + published=True, date__lte=timezone.now()).dates('date', 'month') @register.assignment_tag
get_news_months now only shows months for posts which are currently published
developersociety_blanc-basic-news
train
py
8d99c558d9ebe4c5507a1be7e28dc37b9b1d8b30
diff --git a/pyuv/_version.py b/pyuv/_version.py index <HASH>..<HASH> 100644 --- a/pyuv/_version.py +++ b/pyuv/_version.py @@ -1,2 +1,2 @@ -__version__ = "1.0.2" +__version__ = "1.1.0"
core: set version to <I>
saghul_pyuv
train
py
dffff7ac88eca3e06a8f649b12f3bab8ac2a2df4
diff --git a/tests/ShoutTest.php b/tests/ShoutTest.php index <HASH>..<HASH> 100644 --- a/tests/ShoutTest.php +++ b/tests/ShoutTest.php @@ -178,9 +178,8 @@ class ShoutTest extends \PHPUnit_Framework_TestCase { new Shout($logFile); $files = $this->logRoot->getChildren(); - $numberOfFiles = count($files); - $this->assertSame(1, $numberOfFiles, "Created $numberOfFiles - expected exactly one"); + $this->assertCount(1, $files, "Created more than one file"); $actualLogFilename = reset($files)->getName(); $this->assertEquals(time(), $actualLogFilename, 'Invalid file created', 1);
Replaced vanilla count() with assertCount in file creation with timestamp test.
kiler129_Shout
train
php
3c4313eddc82132269e2f2e4f646884dc9d79b99
diff --git a/dallinger/command_line/docker_ssh.py b/dallinger/command_line/docker_ssh.py index <HASH>..<HASH> 100644 --- a/dallinger/command_line/docker_ssh.py +++ b/dallinger/command_line/docker_ssh.py @@ -182,6 +182,7 @@ server_option = click.option( ) @click.option("--config", "-c", "config_options", nargs=2, multiple=True) def deploy(mode, image, server, dns_host, config_options): + """Deploy a dallnger experiment docker image to a server using ssh.""" server_info = CONFIGURED_HOSTS[server] ssh_host = server_info["host"] ssh_user = server_info.get("user") @@ -207,6 +208,11 @@ def deploy(mode, image, server, dns_host, config_options): config = get_config() config.load() cfg = config.as_dict() + for key in "aws_access_key_id", "aws_secret_access_key", "aws_region": + # AWS credentials are not included by default in to_dict() result + # but can be extracted explicitly from a config object + cfg[key] = config[key] + cfg.update( { "FLASK_SECRET_KEY": token_urlsafe(16),
Fix missing AWS credentials when deploying
Dallinger_Dallinger
train
py
aca5c18c2a52dce0f2f3c2f6058ad4564bcf0481
diff --git a/src/screens.web.js b/src/screens.web.js index <HASH>..<HASH> 100644 --- a/src/screens.web.js +++ b/src/screens.web.js @@ -12,10 +12,6 @@ export function screensEnabled() { } export class NativeScreen extends React.Component { - static defaultProps = { - active: true, - }; - render() { const { active, style, ...rest } = this.props;
feat: remove default active prop on web (#<I>) Remove the `defaultProps` since it is not necessary. Should fix #<I>.
kmagiera_react-native-screens
train
js
668a2d10572410fa2224f2b5c7786158111033c1
diff --git a/lib/knode.js b/lib/knode.js index <HASH>..<HASH> 100644 --- a/lib/knode.js +++ b/lib/knode.js @@ -396,7 +396,7 @@ exports.KNode.prototype.connect = function(address, port, cb) { }); callback(null); }, this) - ]); + ], callback); } exports.KNode.prototype.get = function(key, cb) {
correct callback for knode.connect
nikhilm_kademlia
train
js
93a92112af1ec47129e1b70fbb708bed08aad57d
diff --git a/ontrack-web/src/app/directive/directive.entity.js b/ontrack-web/src/app/directive/directive.entity.js index <HASH>..<HASH> 100644 --- a/ontrack-web/src/app/directive/directive.entity.js +++ b/ontrack-web/src/app/directive/directive.entity.js @@ -61,13 +61,6 @@ angular.module('ot.directive.entity', [ } }; - otTaskService.register('events', function () { - if (scope.entity && scope.entity._events) { - scope.events = []; - loadEvents(scope.entity._events); - } - }, 60000); - function loadEvents(uri) { $log.debug("[events] From URI = " + uri); scope.loadingEvents = true;
#<I> Disabling automated loading of events
nemerosa_ontrack
train
js
8a5e12947699343d80d945f398390d003602a5a0
diff --git a/jupytext/cell_reader.py b/jupytext/cell_reader.py index <HASH>..<HASH> 100644 --- a/jupytext/cell_reader.py +++ b/jupytext/cell_reader.py @@ -486,7 +486,7 @@ class SphinxGalleryScriptCellReader(ScriptCellReader): if line.startswith(triple_quote): return triple_quote - if line.startswith(self.twenty_hash): + if line.startswith('#') and self.twenty_hash in line: return line return None
cell delimiter may be commented (cf. ellipse collection example)
mwouts_jupytext
train
py
d3dee9c07362487ae77ff30a00264ac3473e28f5
diff --git a/src/Error/ErrorHandler.php b/src/Error/ErrorHandler.php index <HASH>..<HASH> 100644 --- a/src/Error/ErrorHandler.php +++ b/src/Error/ErrorHandler.php @@ -20,17 +20,16 @@ class ErrorHandler extends CoreErrorHandler public function handle($exception) { - $handlerClass = Configure::read('Error.handlerClass'); - if (!class_exists($handlerClass)) { - return; + $handlers = (array)Configure::read('Error.config.handlers'); + foreach ($handlers as $handler => $config) { + if (!class_exists($handler)) { + $handler = 'Josegonzalez\ErrorHandlers\Handler\\' . $handler; + } + if (!class_exists($handler)) { + continue; + } + $instance = new $handler((array)$config); + $instance->handle($exception); } - - $config = Configure::read('Error.handlerConfig'); - if (empty($config)) { - $config = []; - } - - $client = new $handlerClass((array)$config); - return $client->handle($exception); } }
Add ability to configure multiple handlers at a time
josegonzalez_php-error-handlers
train
php
5900362a223adab6756a62040ec44a5cb134374f
diff --git a/lib/meta/list.py b/lib/meta/list.py index <HASH>..<HASH> 100644 --- a/lib/meta/list.py +++ b/lib/meta/list.py @@ -30,6 +30,7 @@ class List(memory_region.MemoryRegion): raise ListError('declarations must be a list of Declaration objects') self.declaration_map = dict() + self.recalculating = False for i in xrange(len(self.declarations)): declaration_obj = self.declarations[i] @@ -226,6 +227,11 @@ class List(memory_region.MemoryRegion): self.move_bits(delta_pos, previous_pos, previous['bitspan']) def recalculate(self, start_from=0): + # this prevents recursion loops in instantiated size hints + if self.recalculating: + return + + self.recalculating = True self.calculate_offsets(start_from) self.calculate_deltas() @@ -243,6 +249,8 @@ class List(memory_region.MemoryRegion): self.move_positive_deltas() + self.recalculating = False + def append_declaration(self, declaration, skip_recalc=False): self.insert_declaration(len(self.declarations), declaration, skip_recalc)
do your part in preventing recursion loops today
frank2_paranoia
train
py
78eb667ede2ad2cc59632809379a76315559f772
diff --git a/salt/modules/linux_lvm.py b/salt/modules/linux_lvm.py index <HASH>..<HASH> 100644 --- a/salt/modules/linux_lvm.py +++ b/salt/modules/linux_lvm.py @@ -206,8 +206,10 @@ def pvcreate(devices, override=True, **kwargs): cmd = ['pvcreate'] for device in devices.split(','): if not os.path.exists(device): - return '{0} does not exist'.format(device) - cmd.append(device) + raise CommandExecutionError('{0} does not exist'.format(device)) + # Verify pvcreate was successful + if not pvdisplay(device): + cmd.append(device) elif not override: raise CommandExecutionError('Device "{0}" is already an LVM physical volume.'.format(device))
Bugfix: use exceptions for failure in pvcreate
saltstack_salt
train
py
779f8b70e724d1c41281e980dcaba37617420ad2
diff --git a/app/models/Component.php b/app/models/Component.php index <HASH>..<HASH> 100644 --- a/app/models/Component.php +++ b/app/models/Component.php @@ -1,5 +1,12 @@ <?php class Component extends Eloquent { - + public function getHumanStatus() { + switch ($this->status) { + case 1: return 'Operational'; + case 2: return 'Performance Issues'; + case 3: return 'Partial Outage'; + case 4: return 'Major Outage'; + } + } }
Component now has a humanStatus attribute
CachetHQ_Cachet
train
php
fa61dc3d254c1849b97143a9a5f377188eda9186
diff --git a/salt/utils/thin.py b/salt/utils/thin.py index <HASH>..<HASH> 100644 --- a/salt/utils/thin.py +++ b/salt/utils/thin.py @@ -10,6 +10,7 @@ import tarfile # Import third party libs import jinja2 import yaml +import msgpack try: import markupsafe HAS_MARKUPSAFE = True @@ -60,6 +61,7 @@ def gen_thin(cachedir, extra_mods='', overwrite=False): os.path.dirname(salt.__file__), os.path.dirname(jinja2.__file__), os.path.dirname(yaml.__file__), + os.path.dirname(msgpack.__file__), ] for mod in [m for m in extra_mods.split(',') if m]: if mod not in locals() and mod not in globals():
include msgpack in thin.tgz While msgpack is an extmod (it uses an platform-dependent .so) it includes a pure python fallback. Including it in thin will not create a protability problem.
saltstack_salt
train
py
d93ca5655ad59cd36c9addea208f9874270bcec7
diff --git a/tests/SpecTests/ErrorExpectation.php b/tests/SpecTests/ErrorExpectation.php index <HASH>..<HASH> 100644 --- a/tests/SpecTests/ErrorExpectation.php +++ b/tests/SpecTests/ErrorExpectation.php @@ -75,6 +75,17 @@ final class ErrorExpectation return $o; } + public static function fromCrud(stdClass $result) + { + $o = new self(); + + if (isset($result->error)) { + $o->isExpected = $result->error; + } + + return $o; + } + public static function fromRetryableReads(stdClass $operation) { $o = new self(); diff --git a/tests/SpecTests/Operation.php b/tests/SpecTests/Operation.php index <HASH>..<HASH> 100644 --- a/tests/SpecTests/Operation.php +++ b/tests/SpecTests/Operation.php @@ -158,6 +158,7 @@ final class Operation { $o = new self($operation); + $o->errorExpectation = ErrorExpectation::fromCrud($operation); $o->resultExpectation = ResultExpectation::fromCrud($operation, $o->getResultAssertionType()); if (isset($operation->collectionOptions)) {
PHPLIB-<I>: Add missing error expectation to crud tests
mongodb_mongo-php-library
train
php,php
95d2bd162115a720f4810d187d7213388d8f1492
diff --git a/spec/carrierwave/vips_spec.rb b/spec/carrierwave/vips_spec.rb index <HASH>..<HASH> 100644 --- a/spec/carrierwave/vips_spec.rb +++ b/spec/carrierwave/vips_spec.rb @@ -123,7 +123,7 @@ describe CarrierWave::Vips do it 'strips all exif and icc data from the image' do instance.strip instance.process! - image = Vips::Image.new_from_file(instance.current_path) + image = Vips::Image.new_from_buffer(File.open(instance.current_path, 'rb').read, '') expect { image.get_value('exif-ifd0-Software') }.to raise_error(Vips::Error) end @@ -131,7 +131,7 @@ describe CarrierWave::Vips do instance.convert('jpeg') instance.strip instance.process! - image = Vips::Image.new_from_file(instance.current_path) + image = Vips::Image.new_from_buffer(File.open(instance.current_path, 'rb').read, '') expect { image.get_value('exif-ifd0-Software') }.to raise_error(Vips::Error) end
Use read_from_buffer to make sure we are getting latest version of file
eltiare_carrierwave-vips
train
rb
0698fad53730b781f8cc53cc8f806b8aefa280d4
diff --git a/lib/bowline/initializer.rb b/lib/bowline/initializer.rb index <HASH>..<HASH> 100644 --- a/lib/bowline/initializer.rb +++ b/lib/bowline/initializer.rb @@ -242,7 +242,7 @@ module Bowline def load_application_first_run first_run = Bowline.root.join("app_first_run") if first_run.exist? - first_run.unlink if Bowline.root.writable? + first_run.unlink if Bowline.root.writable_real? Dir.glob(configuration.first_run_glob).sort.each do |initializer| load(initializer) end
Fix for opening in dmgs
maccman_bowline
train
rb
4dbbb7887cd15b4c955fb130ac0dbe6bc6accc52
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100755 --- a/setup.py +++ b/setup.py @@ -122,8 +122,8 @@ def get_version_info(): vinfo = _version_helper.generate_git_version_info() except: vinfo = vdummy() - vinfo.version = '2.0.3' - vinfo.release = 'True' + vinfo.version = '2.0.dev4' + vinfo.release = 'False' with open('pycbc/version.py', 'wb') as f: f.write("# coding: utf-8\n".encode('utf-8'))
set back to dev (#<I>)
gwastro_pycbc
train
py
1caf1e0cbadd260b7fc1990c4f63020565b47e9a
diff --git a/atomic_reactor/plugins/post_export_operator_manifests.py b/atomic_reactor/plugins/post_export_operator_manifests.py index <HASH>..<HASH> 100644 --- a/atomic_reactor/plugins/post_export_operator_manifests.py +++ b/atomic_reactor/plugins/post_export_operator_manifests.py @@ -125,7 +125,7 @@ class ExportOperatorManifestsPlugin(PostBuildPlugin): for f in files: filedir = os.path.relpath(root, manifests_path) filepath = os.path.join(filedir, f) - archive.write(os.path.join(root, f), filepath) + archive.write(os.path.join(root, f), filepath, zipfile.ZIP_DEFLATED) manifest_files = archive.namelist() if not manifest_files: self.log.error('Empty operator manifests directory')
Deflate operator manifest zip file Currently zip file is not deflated. Deflate it to reduce size for archiving and uploading. * CLOUDBLD-<I>
projectatomic_atomic-reactor
train
py
22ef54c7b5c3e0a622b590a2cdd91e6ce502c03e
diff --git a/lxd/network/network_interface.go b/lxd/network/network_interface.go index <HASH>..<HASH> 100644 --- a/lxd/network/network_interface.go +++ b/lxd/network/network_interface.go @@ -18,7 +18,7 @@ type Network interface { Type() string Status() string Config() map[string]string - IsUsed() bool + IsUsed() (bool, error) HasDHCPv4() bool HasDHCPv6() bool DHCPv4Ranges() []DHCPRange
lxd/network/network/interface: Signature change of IsUsed to accomodate NICType
lxc_lxd
train
go
e508937502bfad33c2f438552cfe0e477bf07976
diff --git a/eli5/formatters/text.py b/eli5/formatters/text.py index <HASH>..<HASH> 100644 --- a/eli5/formatters/text.py +++ b/eli5/formatters/text.py @@ -2,6 +2,7 @@ from __future__ import absolute_import from itertools import chain import six +from tabulate import tabulate from typing import List, Optional, Iterator from eli5.base import Explanation, FeatureImportances @@ -9,7 +10,8 @@ from . import fields from .features import FormattedFeatureName from .utils import ( format_signed, format_value, format_weight, has_any_values_for_weights, - replace_spaces, should_highlight_spaces, tabulate) + replace_spaces, should_highlight_spaces) +from .utils import tabulate as eli5_tabulate from .trees import tree2text @@ -153,7 +155,6 @@ def _decision_tree_lines(explanation): def _transition_features_lines(explanation): # type: (Explanation) -> List[str] - from tabulate import tabulate # type: ignore tf = explanation.transition_features assert tf is not None return [ @@ -203,7 +204,7 @@ def _targets_lines(explanation, # type: Explanation w = target.feature_weights assert w is not None - table = tabulate( + table = eli5_tabulate( [table_line(fw) for fw in chain(w.pos, reversed(w.neg))], header=table_header, col_align=col_align,
Move `tabulate` import to the top of file
TeamHG-Memex_eli5
train
py
b172c70ce011959fd895f4b2037f0b1b80e0f6a4
diff --git a/examples/particles/js/screens/play.js b/examples/particles/js/screens/play.js index <HASH>..<HASH> 100644 --- a/examples/particles/js/screens/play.js +++ b/examples/particles/js/screens/play.js @@ -19,8 +19,8 @@ game.PlayScreen = me.ScreenObject.extend({ game.changeEmitter(); // enable the keyboard - me.input.bindKey(me.input.KEY.X, "moveEmitter"); - me.input.bindKey(me.input.KEY.C, "moveViewport"); + me.input.bindKey(me.input.KEY.X, "moveEmitter", false, false); + me.input.bindKey(me.input.KEY.C, "moveViewport", false, false); // map the left button click on the enter key me.input.bindMouse(me.input.mouse.LEFT, me.input.KEY.X);
fixed ctrl+c not working on source code textarea
melonjs_melonJS
train
js
86f98a5f0047a76f2baec56fe1cf193c9f51e952
diff --git a/collatex-tools/src/main/java/eu/interedition/collatex/io/SimpleCollationDeserializer.java b/collatex-tools/src/main/java/eu/interedition/collatex/io/SimpleCollationDeserializer.java index <HASH>..<HASH> 100644 --- a/collatex-tools/src/main/java/eu/interedition/collatex/io/SimpleCollationDeserializer.java +++ b/collatex-tools/src/main/java/eu/interedition/collatex/io/SimpleCollationDeserializer.java @@ -116,8 +116,8 @@ public class SimpleCollationDeserializer extends JsonDeserializer<SimpleCollatio throw JsonMappingException.from(jp, String.format("Expected 'content' text field in witness \"%s\"", witness)); } witness.setTokenContents( - SimplePatternTokenizer.BY_WS_AND_PUNCT.apply(contentNode.getTextValue()), - SimpleTokenNormalizers.LC_TRIM_WS_PUNCT + SimplePatternTokenizer.BY_WS_OR_PUNCT.apply(contentNode.getTextValue()), + SimpleTokenNormalizers.TRIM_WS ); } witnesses.add(witness);
Set default tokenizer and normalizer in the web service to be as strict as possible.
interedition_collatex
train
java
3280d11fe78d317f438db8dfcfc56abbeee28fa7
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -67,7 +67,6 @@ setup( 'Programming Language :: Python :: 2', 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.3', 'Programming Language :: Python :: 3.4', 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.6',
Remove advertising about Python <I> EOL on pypi
AnalogJ_lexicon
train
py
c31d57098c26019c54e48866152aa942aaa92cf2
diff --git a/openag/models.py b/openag/models.py index <HASH>..<HASH> 100644 --- a/openag/models.py +++ b/openag/models.py @@ -106,8 +106,8 @@ FirmwareInput = Schema({ "variable": Any(str, unicode), "categories": [ACTUATORS, CALIBRATION], "description": Any(str, unicode), - "multiplier": float, - "deadband": float + "multiplier": Any(float, int), + "deadband": Any(float, int) }) FirmwareInput.__doc__ = """ A :class:`~openag.models.FirmwareInput` gives information about a single input
Allow int in JSON during Voluptuous Schema check
OpenAgInitiative_openag_python
train
py
fe5b32ca0082935173d692f9d139a64695f9faa8
diff --git a/test/serialize/test_serialize.py b/test/serialize/test_serialize.py index <HASH>..<HASH> 100644 --- a/test/serialize/test_serialize.py +++ b/test/serialize/test_serialize.py @@ -177,6 +177,14 @@ class TestSerialize(unittest.TestCase): self.assertEqual(obj, srl.private_decode(srl.private_encode(obj))) #s = srl.private_encode(obj) + def test_serialize_old_style_filename(self): + fn = 'some_filename.file' + srl.serialize_old_style_filename(fn, self.stream) + self.stream.seek(0) + new_fn = srl.deserialize_old_style_filename(self.stream) + self.assertEqual(fn, new_fn) + + def _compile_java_part(java_class_file, classpath): java_file = os.path.splitext(
Add test for serialize_old_style_filename Test shows a problem with this function
crs4_pydoop
train
py
ea30744706f97064bd98a8b63efb5ed058e830d6
diff --git a/tilequeue/process.py b/tilequeue/process.py index <HASH>..<HASH> 100644 --- a/tilequeue/process.py +++ b/tilequeue/process.py @@ -298,11 +298,6 @@ def process_coord_no_format( # expecting utf-8 row = utils.encode_utf8(row) - # TODO this is here for now to help with comparisons - # this can/should be removed once we fully transition to - # python output calculation - mz_properties = row.pop('mz_properties', None) # noqa - query_props = row.pop('__properties__') feature_size += len('__properties__') + _sizeof(query_props)
Remove no longer used mz_properties
tilezen_tilequeue
train
py
cbbfedf1509b57e515d436833787e6e67c1137d3
diff --git a/lib/rom/repository.rb b/lib/rom/repository.rb index <HASH>..<HASH> 100644 --- a/lib/rom/repository.rb +++ b/lib/rom/repository.rb @@ -219,9 +219,9 @@ module ROM relation = relations[name] if pk - Changeset::Update.new(relation, opts.merge(__data__: data, primary_key: pk)) + Changeset::Update.new(relation, opts.update(__data__: data, primary_key: pk)) else - Changeset::Create.new(relation, opts.merge(__data__: data)) + Changeset::Create.new(relation, opts.update(__data__: data)) end end end
Avoid extra hash allocations in Repository#changeset
rom-rb_rom
train
rb
0d6042ded4901c9ad437ac93c55e8c04dbad8bfd
diff --git a/libraries/lithium/tests/cases/test/ReportTest.php b/libraries/lithium/tests/cases/test/ReportTest.php index <HASH>..<HASH> 100644 --- a/libraries/lithium/tests/cases/test/ReportTest.php +++ b/libraries/lithium/tests/cases/test/ReportTest.php @@ -75,7 +75,7 @@ class ReportTest extends \lithium\test\Unit { $report->run(); $result = $report->render("stats"); - $this->assertPattern("/1 \/ 1 passes, 0 fails and 0 exceptions/", $result); + $this->assertPattern("#1./.*1.*passes,.*0.*fails.*0.*exceptions#s", $result); } public function testSingleFilter() {
Updating test pattern for changes to HTML assert fail rendering.
UnionOfRAD_framework
train
php
c7ab653b44e186d3306821083a8e42f8d7b5f4d5
diff --git a/go/kbfs/libkbfs/folder_branch_ops.go b/go/kbfs/libkbfs/folder_branch_ops.go index <HASH>..<HASH> 100644 --- a/go/kbfs/libkbfs/folder_branch_ops.go +++ b/go/kbfs/libkbfs/folder_branch_ops.go @@ -7956,6 +7956,8 @@ func (fbo *folderBranchOps) ClearPrivateFolderMD(ctx context.Context) { fbo.cancelEdits = nil } fbo.editHistory = kbfsedits.NewTlfHistory() + // Allow the edit monitor to be re-launched later whenever the + // MD is set again. fbo.launchEditMonitor = sync.Once{} fbo.convLock.Lock() defer fbo.convLock.Unlock()
folder_branch_ops: add comment when resetting edit monitor state Suggested by jakob<I>. Issue: #<I>
keybase_client
train
go
622c456049f02494124e50bb1c416562191ed074
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -21,7 +21,7 @@ CLASSIFIERS = [ ] INSTALL_REQUIRES = ['numpy', 'lxml', 'biopython', 'pyyaml'] METADATA = { - 'version': '2.2', + 'version': '2.3', 'title': 'msstitch', 'description': 'MS proteomics post processing utilities', 'uri': 'https://github.com/glormph/msstitch', diff --git a/src/app/drivers/startup.py b/src/app/drivers/startup.py index <HASH>..<HASH> 100644 --- a/src/app/drivers/startup.py +++ b/src/app/drivers/startup.py @@ -1,7 +1,7 @@ import os from argparse import ArgumentParser, RawTextHelpFormatter -VERSION_NUMBER = '2.2' +VERSION_NUMBER = '2.3' def parser_file_exists(currentparser, fn):
Version number increase to <I>
glormph_msstitch
train
py,py
708ab0332132afb3a54f70028e271169f8439e08
diff --git a/services/OauthService.php b/services/OauthService.php index <HASH>..<HASH> 100644 --- a/services/OauthService.php +++ b/services/OauthService.php @@ -25,6 +25,39 @@ class OauthService extends BaseApplicationComponent // -------------------------------------------------------------------- + public function connectProviderObject($provider) + { + $returnProvider = null; + + try { + Craft::log(__METHOD__." : Provider processing", LogLevel::Info, true); + + $returnProvider = $provider->process(function($url, $token = null) { + + if ($token) { + $_SESSION['token'] = base64_encode(serialize($token)); + } + + header("Location: {$url}"); + + exit; + + }, function() { + return unserialize(base64_decode($_SESSION['token'])); + }); + + } catch(\Exception $e) { + + Craft::log(__METHOD__." : Provider process failed : ".$e->getMessage(), LogLevel::Error); + + $this->_redirect(craft()->httpSession->get('oauth.referer')); + } + + return $returnProvider; + } + + // -------------------------------------------------------------------- + public function instantiateProvider($providerClass, $callbackUrl, $token = null, $scope = null) { // get provider record
Added OauthService->connectProviderObject()
dukt_oauth
train
php
d15c4a077c00f20b8a3f5b23c4d46e00dafe4bc3
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -42,6 +42,7 @@ setup( 'nanomath>=0.23.1', "pauvre==0.2.0", 'plotly>=4.1.0', + 'pyarrow' ], package_data={'NanoPlot': []}, package_dir={'nanoplot': 'nanoplot'},
adding pyarrow as a dependency
wdecoster_NanoPlot
train
py
d7b1e6b92b2a14a2e2686ec1ece4a58cb21787e2
diff --git a/app/models/user.rb b/app/models/user.rb index <HASH>..<HASH> 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -56,7 +56,7 @@ class User < ActiveRecord::Base def payload attrs = {"email" => email} - attrs.merge!({"gittip_username" => gittip_username}) if gittip_username + attrs["gittip_username"] = gittip_username if gittip_username attrs end
use []= instead of merge, because why not?
rubygems_rubygems.org
train
rb
c02347f81b4f985560de75bc9b759f61f36b35d6
diff --git a/dev/com.ibm.ws.jca/src/com/ibm/ws/jca/service/ConnectionFactoryService.java b/dev/com.ibm.ws.jca/src/com/ibm/ws/jca/service/ConnectionFactoryService.java index <HASH>..<HASH> 100644 --- a/dev/com.ibm.ws.jca/src/com/ibm/ws/jca/service/ConnectionFactoryService.java +++ b/dev/com.ibm.ws.jca/src/com/ibm/ws/jca/service/ConnectionFactoryService.java @@ -375,6 +375,10 @@ public class ConnectionFactoryService extends AbstractConnectionFactoryService i + ", " + Connector.class.getName() + ':' + ddTransactionSupport); } + // Otherwise choose NoTransaction + if (transactionSupport == null) + transactionSupport = TransactionSupportLevel.NoTransaction; + if (connectionFactoryTransactionSupport != null) { if (connectionFactoryTransactionSupport.ordinal() > transactionSupport.ordinal()) throw new IllegalArgumentException(ManagedConnectionFactory.class.getName() + ':' + transactionSupport @@ -383,8 +387,7 @@ public class ConnectionFactoryService extends AbstractConnectionFactoryService i transactionSupport = connectionFactoryTransactionSupport; } - // Otherwise choose NoTransaction - return transactionSupport == null ? TransactionSupportLevel.NoTransaction : transactionSupport; + return transactionSupport; } @Override
Issue #<I> fix NullPointerException that occurs when connection factory specifies transaction support, but resource adapter does not
OpenLiberty_open-liberty
train
java
cbd37b583ff00f33553e92249b3ece3fa543f675
diff --git a/spring-boot/src/main/java/org/springframework/boot/logging/LoggingApplicationListener.java b/spring-boot/src/main/java/org/springframework/boot/logging/LoggingApplicationListener.java index <HASH>..<HASH> 100644 --- a/spring-boot/src/main/java/org/springframework/boot/logging/LoggingApplicationListener.java +++ b/spring-boot/src/main/java/org/springframework/boot/logging/LoggingApplicationListener.java @@ -246,7 +246,12 @@ public class LoggingApplicationListener implements SmartApplicationListener { name = null; } level = environment.resolvePlaceholders(level); - system.setLogLevel(name, LogLevel.valueOf(level.toUpperCase())); + if (Boolean.toString(false).equalsIgnoreCase(level)) { + system.setLogLevel(name, LogLevel.OFF); + } + else { + system.setLogLevel(name, LogLevel.valueOf(level.toUpperCase())); + } } catch (RuntimeException ex) { this.logger.error("Cannot set level: " + level + " for '" + name + "'");
Make it easier to use YAML configuration to turn off a logger A level named off is used to disable logging for a particular logger. YAML interprets off as false, leading to a failed attempt to get the LogLevel for FALSE. A workaround is to quote the level, i.e. use "off" rather than off. This commit updates LoggingApplicationListener to coerce the string false back to the level off. Closes gh-<I> See gh-<I>
spring-projects_spring-boot
train
java
0908681c001f0eb4b91a1bdfe2baf2e3dc1192a6
diff --git a/lib/ore/versions/version.rb b/lib/ore/versions/version.rb index <HASH>..<HASH> 100644 --- a/lib/ore/versions/version.rb +++ b/lib/ore/versions/version.rb @@ -23,6 +23,9 @@ module Ore # Patch version number attr_reader :patch + # The build string + attr_reader :build + # # Creates a new version. #
Added a missing attr_reader.
ruby-ore_ore
train
rb
7d2a26025db847a31a5a9317a4b0bcd25debdfc7
diff --git a/py/jenkins_h2o_port_allocate.py b/py/jenkins_h2o_port_allocate.py index <HASH>..<HASH> 100755 --- a/py/jenkins_h2o_port_allocate.py +++ b/py/jenkins_h2o_port_allocate.py @@ -62,15 +62,14 @@ def jenkins_h2o_port_allocate(): if executor<0 or executor>=EXECUTOR_NUM: raise Exception("executor: %s wrong? Expecting 1-8 jenkins executors on a machine (0-7 exp.)" % executor) - hostname = socket.gethostname() - hostnameIndex = USED_HOSTNAMES.index(hostname) - h2oPort = DEFAULT_BASE_PORT h2oPortOffset = 0 + hostname = socket.gethostname() if hostname not in USED_HOSTNAMES: print "WARNING: this hostname: %s isn't in my list. You should add it?" % hostname print "Will use default base port" else: + hostnameIndex = USED_HOSTNAMES.index(hostname) h2oPortOffset = PORTS_PER_SLOT * (executor + hostnameIndex) h2oPort += h2oPortOffset
handle machine not in the list, correctly for default
h2oai_h2o-2
train
py
468984df50de7b06df98eed42fc83d72ffeadd52
diff --git a/commands/path.go b/commands/path.go index <HASH>..<HASH> 100644 --- a/commands/path.go +++ b/commands/path.go @@ -8,7 +8,7 @@ func gitLineEnding(git env) string { case "input", "true", "t", "1": return "\r\n" default: - return lineEnding() + return osLineEnding() } } diff --git a/commands/path_nix.go b/commands/path_nix.go index <HASH>..<HASH> 100644 --- a/commands/path_nix.go +++ b/commands/path_nix.go @@ -7,6 +7,6 @@ func cleanRootPath(pattern string) string { return pattern } -func lineEnding() string { +func osLineEnding() string { return "\n" } diff --git a/commands/path_windows.go b/commands/path_windows.go index <HASH>..<HASH> 100644 --- a/commands/path_windows.go +++ b/commands/path_windows.go @@ -17,7 +17,7 @@ var ( winBashRe *regexp.Regexp ) -func lineEnding() string { +func osLineEnding() string { return "\r\n" }
commands: osLineEnding() is more descriptive
git-lfs_git-lfs
train
go,go,go
b4a38e2708ac1c5183189ef569cbe33015018698
diff --git a/gulpfile.js b/gulpfile.js index <HASH>..<HASH> 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -12,7 +12,7 @@ gulp.task('clean', function(){ }); gulp.task('build', ['clean'], function(){ - return gulp.src(['src/serilog.js', 'src/serilog-console-sink.js']) + return gulp.src(['src/core/serilog.js', 'src/bower/serilog-console-sink.js']) .pipe(jshint('.jshintrc')) .pipe(jshint.reporter('default')) .pipe(jshint.reporter('fail')) @@ -35,8 +35,8 @@ gulp.task('test', ['build'], function(cb) { }); gulp.task('smoke', ['test'], function() { - var serilog = require('./src/serilog.js'); - var terminal = require('./src/serilog-terminal-sink.js'); + var serilog = require('./src/core/serilog.js'); + var terminal = require('./src/npm/serilog-terminal-sink.js'); var log = serilog.configuration() .minimumLevel('TRACE')
Updated gulp build script for files that have been relocated.
structured-log_structured-log
train
js
ff46010821e939abdb5a0d072879059d39ae74ff
diff --git a/src/WebServCo/Framework/Exceptions/DatabaseException.php b/src/WebServCo/Framework/Exceptions/DatabaseException.php index <HASH>..<HASH> 100644 --- a/src/WebServCo/Framework/Exceptions/DatabaseException.php +++ b/src/WebServCo/Framework/Exceptions/DatabaseException.php @@ -32,6 +32,10 @@ final class DatabaseException extends ApplicationException $code = $previous->getCode(); $this->sqlState = $previous->getSqlState(); break; + default: + // Prevent "Typed property DatabaseException::$sqlState must not be accessed before initialization" + $this->sqlState = ''; + break; } parent::__construct($message, $code, $previous);
Prevent "Typed property DatabaseException::$sqlState must not be accessed before initialization"
webservco_framework
train
php
f3111a575aec81ce483bbcd53808df3d952fe05a
diff --git a/interop/grpclb_fallback/client.go b/interop/grpclb_fallback/client.go index <HASH>..<HASH> 100644 --- a/interop/grpclb_fallback/client.go +++ b/interop/grpclb_fallback/client.go @@ -1,3 +1,4 @@ +// +build linux // +build !appengine // +build go1.11
interop: Build grpclb_fallback/client.go only for linux. (#<I>)
grpc_grpc-go
train
go
3768aba71b108f4e56dc479525a8443b603db672
diff --git a/Exedra/Routeller/RoutellerRootProvider.php b/Exedra/Routeller/RoutellerRootProvider.php index <HASH>..<HASH> 100644 --- a/Exedra/Routeller/RoutellerRootProvider.php +++ b/Exedra/Routeller/RoutellerRootProvider.php @@ -15,7 +15,7 @@ class RoutellerRootProvider implements Provider protected $cache; - public function __construct($controller, CacheInterface $cache = null, array $options = array()) + public function __construct($controller = null, CacheInterface $cache = null, array $options = array()) { $this->controller = $controller; @@ -34,6 +34,9 @@ class RoutellerRootProvider implements Provider if (!$handler->validateGroup($this->controller)) throw new Exception('Invalid pattern'); + $app->routingFactory->addGroupHandler($handler); + $app->routingFactory->addExecuteHandlers(new ExecuteHandler()); + $controller = $this->controller; $app->set('map', function() use ($app, $handler, $controller) {
routeller routing handler missing code fix
Rosengate_exedra
train
php
14545c4a74615282626ea699e36e6b9fc1f11885
diff --git a/spec/lib/base_spec.rb b/spec/lib/base_spec.rb index <HASH>..<HASH> 100644 --- a/spec/lib/base_spec.rb +++ b/spec/lib/base_spec.rb @@ -128,14 +128,6 @@ describe PlainOldModel::Base do @person.phones[0].extension.should == 'set_via_factory' @person.phones[1].extension.should == 'set_via_factory' end - - # TODO Need to make the following test pass for has many association - #it "should not wipe out existing values" do - # @person = Person.new({ addresses: [{ fname: "first name 1", lname: "last name 1"}, { fname: "first name 2", lname: "last name 2"}]}) - # @person.assign_attributes({ addresses: [{ fname: "first name 1"}, { fname: "first name 2", lname: "last name 2"}]}) - # @person.addresses.first.lname.should == "last name 1" - # @person.addresses.last.lname.should == "last name 2" - #end end end end
Moved unimplemented test from master to has_many_update_attributes branch to keep master branch clean.
gettyimages_plain_old_model
train
rb
a3fb4eca55b0e1d26fb8b716d4b1a7f25c822a22
diff --git a/Classes/Utility/ImageUtility.php b/Classes/Utility/ImageUtility.php index <HASH>..<HASH> 100644 --- a/Classes/Utility/ImageUtility.php +++ b/Classes/Utility/ImageUtility.php @@ -56,7 +56,7 @@ class ImageUtility { $metadata = static::getBasicMetadata($fileName); - if ($fullExtract) { + if ($fullExtract && !empty($metadata)) { $virtualFileObject = static::getVirtualFileObject($fileName, $metadata); $extractorRegistry = \TYPO3\CMS\Core\Resource\Index\ExtractorRegistry::getInstance(); $extractionServices = $extractorRegistry->getExtractorsWithDriverSupport('Local');
[BUGFIX] Batch process only works with file types containing metadata Change-Id: I<I>c9ffbcac<I>d1b9a<I>c5ebc<I>f<I> Resolves: #<I> Reviewed-on: <URL>
xperseguers_t3ext-image_autoresize
train
php
2637886edafadba51adee22fc983f269d1bf8471
diff --git a/theme/bootstrap/layout/general.php b/theme/bootstrap/layout/general.php index <HASH>..<HASH> 100644 --- a/theme/bootstrap/layout/general.php +++ b/theme/bootstrap/layout/general.php @@ -74,7 +74,7 @@ echo $OUTPUT->doctype() ?> <nav role="navigation" class="navbar-inner"> <div class="container-fluid"> <a class="brand" href="<?php echo $CFG->wwwroot;?>"><?php echo $SITE->shortname; ?></a> - <a class="btn btn-navbar" data-toggle="workaround-collapse" data-target=".nav-collapse"> + <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse"> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span>
MDL-<I> Theme: Correct data-target for navbar
moodle_moodle
train
php
c6955a0de1e2a2b89af7115cf3e30e733af9b5b5
diff --git a/ndb/context.py b/ndb/context.py index <HASH>..<HASH> 100644 --- a/ndb/context.py +++ b/ndb/context.py @@ -186,8 +186,7 @@ class Context(object): self._cache_policy = func def should_cache(self, key): - """Returns True if the entity associated with the given key should be - stored in the context cache. + """Return whether to use the context cache for this key. Args: key: Key instance. @@ -216,8 +215,7 @@ class Context(object): self._memcache_policy = func def should_memcache(self, key): - """Returns True if the entity associated with the given key should be - stored in memcache. + """Return whether to use memcache for this key. Args: key: Key instance. @@ -236,8 +234,10 @@ class Context(object): @tasklets.tasklet def get(self, key): - """Returns a Model instance given the entity key. It will use the context - cache if the cache policy for the given key is enabled. + """Returns a Model instance given the entity key. + + It will use the context cache if the cache policy for the given + key is enabled. Args: key: Key instance.
Make docstring summaries fit on one line.
GoogleCloudPlatform_datastore-ndb-python
train
py
8809580f985ac9aacfc014abbf195b08fdc73ae0
diff --git a/src/Illuminate/Support/Pluralizer.php b/src/Illuminate/Support/Pluralizer.php index <HASH>..<HASH> 100755 --- a/src/Illuminate/Support/Pluralizer.php +++ b/src/Illuminate/Support/Pluralizer.php @@ -46,6 +46,7 @@ class Pluralizer 'rice', 'series', 'sheep', + 'software', 'species', 'swine', 'traffic',
Added "software" as an uncountable word (#<I>)
laravel_framework
train
php
a2e5188ae7dc87642b8647fa7b0dc2d82ab4a192
diff --git a/src/PeskyCMF/ApiDocs/CmfApiMethodDocumentation.php b/src/PeskyCMF/ApiDocs/CmfApiMethodDocumentation.php index <HASH>..<HASH> 100644 --- a/src/PeskyCMF/ApiDocs/CmfApiMethodDocumentation.php +++ b/src/PeskyCMF/ApiDocs/CmfApiMethodDocumentation.php @@ -149,6 +149,9 @@ HTML; } $error['title'] = $this->translate($error['title']); } + usort($errors, function ($err1, $err2) { + return (int)array_get($err1, 'code', 0) <=> (int)array_get($err2, 'code', 0); + }); return $errors; }
CmfApiMethodDocumentation - added sorting by HTTP code for error responses
swayok_PeskyCMF
train
php
3a7ea06f95c66d86d24239f98bfee2b0d1aa0f66
diff --git a/tests/web_api/test_calculate.py b/tests/web_api/test_calculate.py index <HASH>..<HASH> 100644 --- a/tests/web_api/test_calculate.py +++ b/tests/web_api/test_calculate.py @@ -56,6 +56,36 @@ def test_responses(test): check_response(*test) +def test_invalid_parameter_period_FAILING_TEST(): + simulation_json = json.dumps({ + "persons": { + "bill": { + "birth": { + "2017-12": "1980-01-01" + }, + "salary": { + "2017-12": 2000 + }, + }, + }, + "households": { + "first_household": { + "parents": ['bill'], + "housing_tax": { + "2009": None # relies on `parameters(period).taxes.housing_tax` which is only defined from 2010 onwards + }, + "accommodation_size": { + "2017-01": 300 + } + }, + } + }) + + response = post_json(simulation_json) + + assert response.status_code # Assert that some response is created and sent to the client... + + def test_basic_calculation(): simulation_json = json.dumps({ "persons": {
Create a failing test to demonstrate bug
openfisca_openfisca-core
train
py
1b929a903404339d1d3551b67ddab0f41ff21feb
diff --git a/app/models/artefact_external_link.rb b/app/models/artefact_external_link.rb index <HASH>..<HASH> 100644 --- a/app/models/artefact_external_link.rb +++ b/app/models/artefact_external_link.rb @@ -12,5 +12,5 @@ class ArtefactExternalLink validates_with SafeHtml validates_presence_of :title - validates_presence_of :url + validates :url, :presence => true, :format => { :with => URI::regexp(%w{http https}) } end diff --git a/test/models/artefact_external_link_test.rb b/test/models/artefact_external_link_test.rb index <HASH>..<HASH> 100644 --- a/test/models/artefact_external_link_test.rb +++ b/test/models/artefact_external_link_test.rb @@ -18,5 +18,15 @@ class ArtefactExternalLinkTest < ActiveSupport::TestCase link = ArtefactExternalLink.new(:title => "Foo", :url => "http://bar.com") assert link.valid? end + + should "only be valid if the URL is valid" do + link = ArtefactExternalLink.new(:title => "Foo", :url => "notreal://foo.com") + refute link.valid? + end + + should "be valid with an https URL" do + link = ArtefactExternalLink.new(:title => "Foo", :url => "https://bar.com") + assert link.valid? + end end end
Make sure the URL is valid in artefact external links
alphagov_govuk_content_models
train
rb,rb
64f7feccec45e91931d69abf44d2460f84f87eb9
diff --git a/app/templates/gulpfile.js b/app/templates/gulpfile.js index <HASH>..<HASH> 100644 --- a/app/templates/gulpfile.js +++ b/app/templates/gulpfile.js @@ -128,7 +128,8 @@ gulp.task('wiredep', function () { gulp.src('app/*.html') .pipe(wiredep({ directory: 'app/bower_components', - ignorePath: 'app/' + ignorePath: 'app/', + exclude: ['app/bower_components/bootstrap-sass/vendor/assets/javascripts/bootstrap.js'] })) .pipe(gulp.dest('app')); });
Exclude bootstrap.js file from wiredep Bootstrap's JS components are already included, and that's what bootstrap.js is made of.
niallobrien_generator-gulp-foundation
train
js
95aa75db23cd4df9c1d6d29fd586296015fa2141
diff --git a/templates/forms/optout.php b/templates/forms/optout.php index <HASH>..<HASH> 100644 --- a/templates/forms/optout.php +++ b/templates/forms/optout.php @@ -160,8 +160,7 @@ HTML; $optOutButton.text( '<?php _efs( 'opting-out', $slug ) ?>' ); } }, - success: function( result ) { - var resultObj = $.parseJSON( result ); + success: function( resultObj ) { if ( resultObj.success ) { if ( 'allow_tracking' == action ) { action = 'stop_tracking';
[usage-tracking-control] [opt-out] Updated AJAX callback result, from now retrieving JSON objects correctly.
Freemius_wordpress-sdk
train
php
9e12b4cc1be2340d9a082eb092383679b5d6f833
diff --git a/src/FullscreenContextProvider.js b/src/FullscreenContextProvider.js index <HASH>..<HASH> 100644 --- a/src/FullscreenContextProvider.js +++ b/src/FullscreenContextProvider.js @@ -95,17 +95,28 @@ class FullscreenContextProvider extends PureComponent { }); } - render() { - const { fullscreen } = this.state; + getFullscreenContext() { const fullscreenContext = { - fullscreen, + fullscreen: this.state.fullscreen, requestFullscreen: this.requestFullscreen, requestExitFullscreen: this.requestExitFullscreen }; + if ( + this.fullscreenContext && + fullscreenContext.fullscreen === this.fullscreenContext.fullscreen + ) { + // no change + return this.fullscreenContext; + } + return (this.fullscreenContext = fullscreenContext); + } + + render() { + const fullscreenContext = this.getFullscreenContext(); return ( <div ref={elem => (this.fullscreenElement = elem)} - style={fullscreen ? fullscreenStyle : undefined} + style={this.state.fullscreen ? fullscreenStyle : undefined} > <FullscreenContext.Provider value={fullscreenContext}> {typeof this.props.children === 'function'
Fullscreen context only updates consumers when fullscreen value changes.
benwiley4000_cassette
train
js
4a9fa93bbca4364363bf16f89de50e7d82f81bd0
diff --git a/js/main.js b/js/main.js index <HASH>..<HASH> 100644 --- a/js/main.js +++ b/js/main.js @@ -26,15 +26,16 @@ $(function () { acceptFileTypes: /(\.|\/)(gif|jpe?g|png)$/i }); // Upload server status check for browsers with CORS support: - if (window.XDomainRequest || (window.XMLHttpRequest && - (new XMLHttpRequest()).withCredentials !== undefined)) { - $.get('//jquery-file-upload.appspot.com/') - .fail(function () { - $('<span class="alert alert-error"/>') - .text('Upload server currently unavailable - ' + - new Date()) - .appendTo('#fileupload'); - }); + if ($.ajaxSettings.xhr().withCredentials !== undefined) { + $.ajax({ + url: '//jquery-file-upload.appspot.com/', + type: 'HEAD' + }).fail(function () { + $('<span class="alert alert-error"/>') + .text('Upload server currently unavailable - ' + + new Date()) + .appendTo('#fileupload'); + }); } } else { // Load existing files:
Use a HEAD request for the upload server status check.
blueimp_jQuery-File-Upload
train
js
46e4465705537a7cdac295d9cba51c9ddc959439
diff --git a/interact.js b/interact.js index <HASH>..<HASH> 100644 --- a/interact.js +++ b/interact.js @@ -1373,6 +1373,10 @@ tap[prop] = event[prop]; } + tap.preventDefault = blank; + tap.stopPropagation = InteractEvent.prototype.stopPropagation; + tap.stopImmediatePropagation = InteractEvent.prototype.stopImmediatePropagation; + tap.timeStamp = new Date().getTime(); tap.originalEvent = event; tap.dt = tap.timeStamp - downTime; @@ -1388,6 +1392,11 @@ for (i = 0; i < targets.length; i++) { tap.currentTarget = elements[i]; targets[i].fire(tap); + + if (tap.immediatePropagationStopped + ||(tap.propagationStopped && targets[i + 1] !== tap.currentTarget)) { + break; + } } if (dbl) { @@ -1403,6 +1412,11 @@ for (i = 0; i < targets.length; i++) { doubleTap.currentTarget = elements[i]; targets[i].fire(doubleTap); + + if (doubleTap.immediatePropagationStopped + ||(doubleTap.propagationStopped && targets[i + 1] !== doubleTap.currentTarget)) { + break; + } } prevTap = doubleTap;
Implement tap event stop[Immediate]Propagation
taye_interact.js
train
js
1f462998702b77abf176821e95957a65ecced12c
diff --git a/internal/graphicsdriver/opengl/program.go b/internal/graphicsdriver/opengl/program.go index <HASH>..<HASH> 100644 --- a/internal/graphicsdriver/opengl/program.go +++ b/internal/graphicsdriver/opengl/program.go @@ -323,10 +323,15 @@ func (d *Driver) useProgram(mode graphics.CompositeMode, colorM *affine.ColorM, sw := graphics.InternalImageSize(srcW) sh := graphics.InternalImageSize(srcH) - if d.state.lastSourceWidth != sw || d.state.lastSourceHeight != sh { - d.context.uniformFloats(program, "source_size", []float32{float32(sw), float32(sh)}) - d.state.lastSourceWidth = sw - d.state.lastSourceHeight = sh + if filter == graphics.FilterNearest { + d.state.lastSourceWidth = 0 + d.state.lastSourceHeight = 0 + } else { + if d.state.lastSourceWidth != sw || d.state.lastSourceHeight != sh { + d.context.uniformFloats(program, "source_size", []float32{float32(sw), float32(sh)}) + d.state.lastSourceWidth = sw + d.state.lastSourceHeight = sh + } } if filter == graphics.FilterScreen {
graphicsdriver/opengl: Bug fix: source_size can be optimized out with nearest filter
hajimehoshi_ebiten
train
go
f34bb366200eaded493153c816eaabf75b3745ff
diff --git a/src/index.js b/src/index.js index <HASH>..<HASH> 100644 --- a/src/index.js +++ b/src/index.js @@ -139,6 +139,7 @@ class Offline { this.requests = {}; // Methods + this._setEnvironment(); // will set environment variables from serverless.yml file this._setOptions(); // Will create meaningful options from cli options this._registerBabel(); // Support for ES6 this._createServer(); // Hapijs boot @@ -147,8 +148,13 @@ class Offline { return this.server; } - _setOptions() { + _setEnvironment() { + Object.keys(this.service.provider.environment || {}).forEach(key => { + process.env[key] = this.service.provider.environment[key]; + }); + } + _setOptions() { // Applies defaults this.options = { host: this.options.host || 'localhost',
fixes #<I>: load environment variables from serverless.yml
dherault_serverless-offline
train
js
55a756f286ced1084f4a85d6b13b2a1bccd4aa4c
diff --git a/pdb.py b/pdb.py index <HASH>..<HASH> 100644 --- a/pdb.py +++ b/pdb.py @@ -54,7 +54,7 @@ __url__='http://codespeak.net/svn/user/antocuni/hack/pdb.py' import sys import os.path -import inspect +from inspect import getsourcelines import code import types import traceback @@ -96,20 +96,6 @@ class DefaultConfig: def setup(self, pdb): pass -def getsourcelines(obj): - try: - return inspect.getsourcelines(obj) - except IOError: - pass - - if isinstance(obj, types.FrameType): - filename = obj.f_code.co_filename - if hasattr(filename, '__source__'): - first = max(1, obj.f_lineno - 5) - lines = [line + '\n' for line in filename.__source__.lines] - return lines, first - raise IOError('could not get source code') - def setbgcolor(line, color): # hack hack hack # add a bgcolor attribute to all escape sequences found
the co_filename.__source__ hack is no longer needed with newer pylib versions
antocuni_pdb
train
py
768de1d650afe31e6a460e74997ef7b4c5c1ab96
diff --git a/index.js b/index.js index <HASH>..<HASH> 100644 --- a/index.js +++ b/index.js @@ -1,13 +1,20 @@ 'use strict'; function serialize(object) { - return JSON.stringify(object); + function replacer(key, value) { + if (value instanceof Date) { + value = value.toString(); + } + return value; + } + + return JSON.stringify(object, replacer); } function deserialize(string, options) { options = options || {stringToDates: true}; - function formatter(key, value) { + function replacer(key, value) { var newValue; if (options.stringToDates && typeof value === 'string' && !isNaN(Date.parse(value))) { newValue = new Date(value); @@ -17,7 +24,7 @@ function deserialize(string, options) { return newValue; } - return JSON.parse(string, formatter); + return JSON.parse(string, replacer); } module.exports = {
serialze dates with .toString()
blainsmith_nosj
train
js
8026260870ed4ce570ae55b1f235c9c52430a38b
diff --git a/Neos.Fusion/Tests/Unit/Service/HtmlAugmenterTest.php b/Neos.Fusion/Tests/Unit/Service/HtmlAugmenterTest.php index <HASH>..<HASH> 100644 --- a/Neos.Fusion/Tests/Unit/Service/HtmlAugmenterTest.php +++ b/Neos.Fusion/Tests/Unit/Service/HtmlAugmenterTest.php @@ -122,7 +122,13 @@ class HtmlAugmenterTest extends UnitTestCase 'exclusiveAttributes' => null, 'expectedResult' => '<fallback-tag class="some-class"><p class="some-class">Simple HTML without</p><p> unique root element</p></fallback-tag>', ), - + array( + 'html' => '<script>console.log("Script tag with unique root element");</script>', + 'attributes' => array('type' => 'new-type'), + 'fallbackTagName' => null, + 'exclusiveAttributes' => null, + 'expectedResult' => '<script type="new-type">console.log("Script tag with unique root element");</script>', + ), // attribute handling array( 'html' => '<root class="some-class">merging attributes</root>',
Add test case for script tag with HtmlAugmenter
neos_neos-development-collection
train
php
ed54f31185810e0b7957c1568923b25a77cf6a06
diff --git a/src/Parse.php b/src/Parse.php index <HASH>..<HASH> 100644 --- a/src/Parse.php +++ b/src/Parse.php @@ -134,6 +134,10 @@ class Parse return $this; } + /** + * Validate the tokens alg claim is a valid digital signature or MAC + * algorithm. Value can also be "none". See RFC 7518 for more details. + */ public function validateAlgorithm(): self { if (!$this->validate->algorithm($this->getAlgorithm(), [])) { diff --git a/src/Validate.php b/src/Validate.php index <HASH>..<HASH> 100644 --- a/src/Validate.php +++ b/src/Validate.php @@ -87,6 +87,11 @@ class Validate return hash_equals($signature, $comparison); } + /** + * Check the alg claim is in the list of valid algorithms. These are the + * valid digital signatures, MAC algorithms or "none" as + * defined in RFC 7518. + */ public function algorithm(string $algorithm, array $additional): bool { $base = ["none", "HS256"];
Added comments to algorithm and validate algorithm metods in parse and validate classes.
RobDWaller_ReallySimpleJWT
train
php,php
0fd0ede865e1d73147ad05746190fd64fec86a8c
diff --git a/lib/ezutils/classes/ezini.php b/lib/ezutils/classes/ezini.php index <HASH>..<HASH> 100644 --- a/lib/ezutils/classes/ezini.php +++ b/lib/ezutils/classes/ezini.php @@ -400,7 +400,10 @@ class eZINI $this->Charset = $charset; $this->BlockValues = $blockValues; //$this->BlockValuesPlacement = array ( 'ClassSettings' => array ( 'Formats' => array ( 0 => "settings/datetime.ini" ) ) ); - $this->BlockValuesPlacement = $blockValuesPlacement; + if ( isset( $blockValuesPlacement ) ) + $this->BlockValuesPlacement = $blockValuesPlacement; + else + $this->BlockValuesPlacement = array(); $this->ModifiedBlockValues = array(); unset( $blockValues ); }
- Added a check for the blockValuesPlacement variable in eZINI which is taken from the cache file. Sometimes the value is not present. git-svn-id: file:///home/patrick.allaert/svn-git/ezp-repo/ezpublish/trunk@<I> a<I>eee8c-daba-<I>-acae-fa<I>f<I>
ezsystems_ezpublish-legacy
train
php
bd5fefb19d7330f328f107d6ff49de4c2613bf71
diff --git a/vaex/dataset.py b/vaex/dataset.py index <HASH>..<HASH> 100644 --- a/vaex/dataset.py +++ b/vaex/dataset.py @@ -3825,7 +3825,7 @@ class Dataset(object): m = matrix_name = x +"_" +y + "_rot" for i in range(2): for j in range(2): - self.set_variable(matrix_name +"_%d%d" % (i,j), matrix[i,j]) + self.set_variable(matrix_name +"_%d%d" % (i,j), matrix[i,j].item()) self.virtual_columns[xnew] = "{m}_00 * {x} + {m}_01 * {y}".format(**locals()) self.virtual_columns[ynew] = "{m}_10 * {x} + {m}_11 * {y}".format(**locals())
bugfix: matrix rotation was using numpy floats causing file store issues
vaexio_vaex
train
py
486db485a740cf40289e0c8e762d4f2f71733a86
diff --git a/server.go b/server.go index <HASH>..<HASH> 100644 --- a/server.go +++ b/server.go @@ -590,8 +590,7 @@ func ValidTrace(sample ssf.SSFSpan) bool { // HandleTracePacket accepts an incoming packet as bytes and sends it to the // appropriate worker. func (s *Server) HandleTracePacket(packet []byte) { - //TODO increment at .1 - s.Statsd.Incr("packet.received_total", nil, 1) + s.Statsd.Incr("packet.received_total", nil, .1) // Unlike metrics, protobuf shouldn't have an issue with 0-length packets if len(packet) == 0 { s.Statsd.Count("packet.error_total", 1, []string{"packet_type:unknown", "reason:zerolength"}, 1.0) @@ -621,7 +620,7 @@ func (s *Server) HandleTracePacket(packet []byte) { s.Workers[metric.Digest%uint32(len(s.Workers))].PacketChan <- *metric } if ValidTrace(*newSample) { - s.Statsd.Incr("packet.spans.received_total", nil, 1) + s.Statsd.Incr("packet.spans.received_total", nil, .1) s.TraceWorker.TraceChan <- *newSample } }
Change sample rate for incr metric
stripe_veneur
train
go
a4a63b1b952fbe673083787c7013f8db87def6bd
diff --git a/pyFMG/fortimgr.py b/pyFMG/fortimgr.py index <HASH>..<HASH> 100644 --- a/pyFMG/fortimgr.py +++ b/pyFMG/fortimgr.py @@ -373,6 +373,23 @@ class FortiManager(object): else: return result["status"]["code"], result + def _freeform_response(self, resp): + try: + response = resp.json() + except: + # response is not able to be decoded into json return 100 as a code and the entire response object + return 100, resp + + self._set_sid(response) + self.req_resp_object.response_json = response + self.dprint() + if type(response["result"]) is list: + result = response["result"] + else: + result = response["result"] + # Return the full result data set along with 200 as the response code + return 200, result + def _post_request(self, method, params, login=False, free_form=False, create_task=None): self.req_resp_object.reset() @@ -401,7 +418,7 @@ class FortiManager(object): if free_form: try: res = response.json() - return self._handle_response(response) + return self._freeform_response(response) except: # response is not able to be decoded into json return 100 as a code and the entire response object return 100, response
Added function to process freefrom data and updated post to call it when freefrom was true
p4r4n0y1ng_pyfmg
train
py
732d13ce427a8fc2feb4eac858c7e677d94e4033
diff --git a/src/PHP_GCM/Sender.php b/src/PHP_GCM/Sender.php index <HASH>..<HASH> 100755 --- a/src/PHP_GCM/Sender.php +++ b/src/PHP_GCM/Sender.php @@ -4,7 +4,7 @@ namespace PHP_GCM; class Sender { - const GCM_ENDPOINT = 'https://gcm-http.googleapis.com/gcm/send'; + const SEND_ENDPOINT = 'https://fcm.googleapis.com/fcm/send'; const BACKOFF_INITIAL_DELAY = 1000; const MAX_BACKOFF_DELAY = 1024000; const SUCCESS = 'success'; @@ -258,7 +258,7 @@ class Sender { private function makeRequest(Message $message, array $registrationIds) { $ch = $this->getCurlRequest(); - curl_setopt($ch, CURLOPT_URL, self::GCM_ENDPOINT); + curl_setopt($ch, CURLOPT_URL, self::SEND_ENDPOINT); curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json', 'Authorization: key=' . $this->key)); curl_setopt($ch, CURLOPT_POSTFIELDS, $message->build($registrationIds)); $response = curl_exec($ch);
Switch to FCM url for sending Fixes #<I>
lkorth_php-gcm
train
php
7be039adec5eb63e3b9cc0ce69b45fee253e2683
diff --git a/fundingmanager.go b/fundingmanager.go index <HASH>..<HASH> 100644 --- a/fundingmanager.go +++ b/fundingmanager.go @@ -1210,6 +1210,8 @@ func (f *fundingManager) waitForFundingWithTimeout(completeChan *channeldb.OpenC return } + defer epochClient.Cancel() + waitingDoneChan := make(chan struct{}) cancelChan := make(chan struct{}) diff --git a/utxonursery.go b/utxonursery.go index <HASH>..<HASH> 100644 --- a/utxonursery.go +++ b/utxonursery.go @@ -321,6 +321,7 @@ func (u *utxoNursery) incubator(newBlockChan *chainntnfs.BlockEpochEvent, startingHeight uint32) { defer u.wg.Done() + defer newBlockChan.Cancel() currentHeight := startingHeight out:
multi: ensure that BlockEpoch clients are cancelled This commit fixes a prior goroutine leak that could result in a node having thousands of goroutines, particularly due to many concurrent channel fundings. We now ensure that for each BlockEpoch client created, we ensure that the client is cancelled once the creating grouting exits.
lightningnetwork_lnd
train
go,go
159c3cede6235463f3787535edd8247bb2ff4b98
diff --git a/Parsedown.php b/Parsedown.php index <HASH>..<HASH> 100755 --- a/Parsedown.php +++ b/Parsedown.php @@ -38,16 +38,6 @@ class Parsedown return $this; } - /** - * For backwards compatibility before PSR-2 naming. - * - * @deprecated Use setBreaksEnabled instead. - */ - function set_breaks_enabled($breaks_enabled) - { - return $this->setBreaksEnabled($breaks_enabled); - } - private $breaksEnabled = false; # @@ -1304,6 +1294,18 @@ class Parsedown private static $instances = array(); # + # Deprecated Methods + # + + /** + * @deprecated in favor of "setBreaksEnabled" + */ + function set_breaks_enabled($breaks_enabled) + { + return $this->setBreaksEnabled($breaks_enabled); + } + + # # Fields #
move deprecated methods to the bottom of the class
erusev_parsedown
train
php
42d82435a7cd71bdff70e2ec55a18fb6d9787063
diff --git a/ReText/editor.py b/ReText/editor.py index <HASH>..<HASH> 100644 --- a/ReText/editor.py +++ b/ReText/editor.py @@ -17,7 +17,7 @@ from ReText import globalSettings, tablemode, DOCTYPE_MARKDOWN from PyQt5.QtCore import QPoint, QSize, Qt -from PyQt5.QtGui import QColor, QPainter, QPalette, QTextCursor, QTextFormat +from PyQt5.QtGui import QColor, QKeyEvent, QPainter, QPalette, QTextCursor, QTextFormat from PyQt5.QtWidgets import QLabel, QTextEdit, QWidget def documentIndentMore(document, cursor, globalSettings=globalSettings): @@ -154,6 +154,10 @@ class ReTextEdit(QTextEdit): cursor = self.textCursor() if event.text() and self.tableModeEnabled: cursor.beginEditBlock() + if key == Qt.Key_Backspace and event.modifiers() & Qt.GroupSwitchModifier: + # Workaround for https://bugreports.qt.io/browse/QTBUG-49771 + event = QKeyEvent(event.type(), event.key(), + event.modifiers() ^ Qt.GroupSwitchModifier) if key == Qt.Key_Tab: documentIndentMore(self.document(), cursor) elif key == Qt.Key_Backtab:
editor: Add a hack to make backspace work when capslock is on
retext-project_retext
train
py
cddf9f76c93af7086cee19f220394cb3cab79be4
diff --git a/example/read-write.rb b/example/read-write.rb index <HASH>..<HASH> 100755 --- a/example/read-write.rb +++ b/example/read-write.rb @@ -3,6 +3,8 @@ $LOAD_PATH << 'lib' require 'transit' -r = Transit::Reader.new(:json) -w = Transit::Writer.new(STDOUT, :json) +transport = ENV['TRANSPORT'] || "json" + +r = Transit::Reader.new(transport.to_sym) +w = Transit::Writer.new(STDOUT, transport.to_sym) r.read(STDIN) {|o| w.write o}
make read-write file work w/ msgpack or json
cognitect_transit-ruby
train
rb
6894f456a8c28f4bf3507711a1357c9c6891c5b4
diff --git a/src/Generator/EntityConfigGenerator.php b/src/Generator/EntityConfigGenerator.php index <HASH>..<HASH> 100644 --- a/src/Generator/EntityConfigGenerator.php +++ b/src/Generator/EntityConfigGenerator.php @@ -26,7 +26,7 @@ class EntityConfigGenerator extends Generator $this->renderFile( 'module/config/schema/entity.schema.yml.twig', - $this->getModulePath($module) . '/config/schema/' . $entity_class . '.schema.yml', + $this->getModulePath($module) . '/config/schema/' . $entity_name . '.schema.yml', $parameters );
Generate schema file based on entity name not class name
hechoendrupal_drupal-console
train
php
e7c00bbfecd93c98e17950f92f3cb57cd9bd76fb
diff --git a/src/Query/DefaultQueryBuilder.php b/src/Query/DefaultQueryBuilder.php index <HASH>..<HASH> 100644 --- a/src/Query/DefaultQueryBuilder.php +++ b/src/Query/DefaultQueryBuilder.php @@ -20,8 +20,10 @@ class DefaultQueryBuilder implements QueryBuilderContract{ //when has union must do a sub query $db = DB::table(DB::raw("({$this->model->toSql()}) as sub")); - if($connection = $this->model->getModel()->getConnectionName()) - $db->connection($connection); + if($connection = $this->model->getModel()->getConnectionName()){ + if(method_exists($connection, 'connection')) + $db->connection($connection); + } $db->mergeBindings($this->model->getQuery());
Avoid error when no has connection method available, like when the model has an union
rafwell_laravel-simplegrid
train
php
f498d18e7535703162c938f95c7bb6e529cf8a7a
diff --git a/bin/update-changelog.js b/bin/update-changelog.js index <HASH>..<HASH> 100644 --- a/bin/update-changelog.js +++ b/bin/update-changelog.js @@ -55,7 +55,7 @@ function parseLog(results) { log = metadata(log, value); data.push(log) } else { - log.message = value.trim(); + log.message = value.trim().replace(/\s#\s/g, ' > '); log = {} } }
#7 Fix displaying commit messages in changelog.md
OpusCapita_npm-scripts
train
js
659e2d9323b360117760697bba2adc86e73d44db
diff --git a/dwave/system/samplers/leap_hybrid_sampler.py b/dwave/system/samplers/leap_hybrid_sampler.py index <HASH>..<HASH> 100644 --- a/dwave/system/samplers/leap_hybrid_sampler.py +++ b/dwave/system/samplers/leap_hybrid_sampler.py @@ -561,7 +561,8 @@ class LeapHybridCQMSampler: """A class for using Leap's cloud-based hybrid CQM solvers. Leap’s quantum-classical hybrid CQM solvers are intended to solve arbitrary - application problems formulated as constrained quadratic models (CQM). + application problems formulated as + :ref:`constrained quadratic models (CQM) <cqm_sdk>`. You can configure your :term:`solver` selection and usage by setting parameters, hierarchically, in a configuration file, as environment variables, or @@ -690,7 +691,7 @@ class LeapHybridCQMSampler: Args: cqm (:obj:`dimod.ConstrainedQuadraticModel`): - Constrained quadratic model (DQM). + Constrained quadratic model (CQM). time_limit (int, optional): Maximum run time, in seconds, to allow the solver to work on the
Fix typo and link to CQM
dwavesystems_dwave-system
train
py
97e50a17689fcc1649e789a2945eac3db89f6d44
diff --git a/bbq-core/test/unit/bbq_rspec_test.rb b/bbq-core/test/unit/bbq_rspec_test.rb index <HASH>..<HASH> 100644 --- a/bbq-core/test/unit/bbq_rspec_test.rb +++ b/bbq-core/test/unit/bbq_rspec_test.rb @@ -82,4 +82,27 @@ class BbqRspecTest < Test::Unit::TestCase run_cmd 'rspec -Itest/dummy/spec test/dummy/spec/acceptance/implicit_user_eyes_spec.rb' assert_match /1 example, 0 failures/, output end + + def test_api_client + create_file 'test/dummy/spec/acceptance/api_spec.rb', <<-RSPEC + require 'spec_helper' + require 'bbq/rspec' + require 'bbq/test_client' + + feature 'application API' do + scenario 'client fetches the rainbow as JSON' do + client = Bbq::TestClient.new(:headers => { 'HTTP_ACCEPT' => 'application/json' }) + client.get "/rainbow" do |response| + response.status.should == 200 + response.headers["Content-Type"].should match "application/json" + response.body["colors"].should == 7 + response.body["wonderful"].should == true + end + end + end + RSPEC + + run_cmd 'rspec -Itest/dummy/spec test/dummy/spec/acceptance/implicit_user_eyes_spec.rb' + assert_match /1 example, 0 failures/, output + end end
Added RSpec tests for TestClient
drugpl_bbq
train
rb
f50095ada1ce2ab677da361c07b09ccf49f698a1
diff --git a/Request/SetActuatorStatesRequest.php b/Request/SetActuatorStatesRequest.php index <HASH>..<HASH> 100644 --- a/Request/SetActuatorStatesRequest.php +++ b/Request/SetActuatorStatesRequest.php @@ -50,11 +50,24 @@ class SetActuatorStatesRequest extends BaseRequest public function addRoomTemperatureActuatorState($logicalDeviceId, $pointTemperature, $mode) { $this->actuatorStates[] = array( - 'xsi:type' => 'RoomTemperatureActuatorState', + 'xmlns:xsi:type' => 'RoomTemperatureActuatorState', 'LID' => $logicalDeviceId, 'PtTmp' => $pointTemperature, 'OpnMd' => $mode, 'WRAc' => false ); } -} + + /** + * @param string $logicalDeviceId the logical device id + * @param bool $value the state to set + */ + public function addSwitchActuatorState($logicalDeviceId, $value) + { + $this->actuatorStates[] = array( + 'xmlns:xsi:type' => 'SwitchActuatorState', + 'LID' => $logicalDeviceId, + 'IsOn' => $value + ); + } +} \ No newline at end of file
Added addSwitchActuatorState to SetActuatorStatesRequest.php Fixed xml-namespace being removed by SimpleXML by adding a "xmns" ('xsi:type' was changed to 'type' in SetActuatorStatesRequest.php)
Bubelbub_SmartHome-PHP
train
php
6693617df3835de9e324661ca9491805e56327d8
diff --git a/src/contrib/aliased.php b/src/contrib/aliased.php index <HASH>..<HASH> 100644 --- a/src/contrib/aliased.php +++ b/src/contrib/aliased.php @@ -38,7 +38,7 @@ if(!file_exists($path)) { } // Prepare GeSHi instance -$geshi =& new GeSHi(); +$geshi = new GeSHi(); $geshi->set_language('text'); $geshi->load_from_file($path); $geshi->set_header_type(GESHI_HEADER_PRE);
fix: SF#<I>: Assign by Reference deprecated
GeSHi_geshi-1.0
train
php
568329ca7eeda6ca059757c6df317ccc532a49f1
diff --git a/Classes/Core/Functional/FunctionalTestCase.php b/Classes/Core/Functional/FunctionalTestCase.php index <HASH>..<HASH> 100644 --- a/Classes/Core/Functional/FunctionalTestCase.php +++ b/Classes/Core/Functional/FunctionalTestCase.php @@ -398,6 +398,8 @@ abstract class FunctionalTestCase extends BaseTestCase } } + // Some DBMS like mssql are picky about inserting blob types with correct cast, setting + // types correctly (like Connection::PARAM_LOB) allows doctrine to create valid SQL $types = []; $tableDetails = $connection->getSchemaManager()->listTableDetails($tableName); foreach ($element as $columnName => $columnValue) { diff --git a/Classes/Core/Testbase.php b/Classes/Core/Testbase.php index <HASH>..<HASH> 100644 --- a/Classes/Core/Testbase.php +++ b/Classes/Core/Testbase.php @@ -664,6 +664,8 @@ class Testbase } } + // Some DBMS like mssql are picky about inserting blob types with correct cast, setting + // types correctly (like Connection::PARAM_LOB) allows doctrine to create valid SQL $types = []; $tableDetails = $connection->getSchemaManager()->listTableDetails($tableName); foreach ($insertArray as $columnName => $columnValue) {
[TASK] Comments on type hinting for inserts
TYPO3_testing-framework
train
php,php
9bf8d290eaa06505822a87f07e62acdac132da01
diff --git a/lib/rb-kqueue/event.rb b/lib/rb-kqueue/event.rb index <HASH>..<HASH> 100644 --- a/lib/rb-kqueue/event.rb +++ b/lib/rb-kqueue/event.rb @@ -1,5 +1,7 @@ module KQueue class Event + attr_reader :data + def watcher @watcher ||= @queue.watchers[[filter, @native[:ident]]] end @@ -8,9 +10,14 @@ module KQueue @filter ||= KQueue::Native::Flags.from_flag("EVFILT", @native[:filter]) end + def flags + @flags ||= Native::Flags.from_mask("NOTE", @native[:fflags]) + end + def initialize(native, queue) @native = native @queue = queue + @data = @native[:data] KQueue.handle_error @native[:data] if @native[:flags] & Native::Flags::EV_ERROR != 0 end
Add more accessors to the Event object.
mat813_rb-kqueue
train
rb
5f63230dc4a47ce1dbed0248fd114f4726b29b32
diff --git a/tests/Che/EventBand/Tests/PublishEventListenerTest.php b/tests/Che/EventBand/Tests/PublishEventListenerTest.php index <HASH>..<HASH> 100644 --- a/tests/Che/EventBand/Tests/PublishEventListenerTest.php +++ b/tests/Che/EventBand/Tests/PublishEventListenerTest.php @@ -51,7 +51,7 @@ class PublishEventListenerTest extends TestCase */ public function stopPropagation() { - $listener = new PublishEventListener($this->publisher, true); + $listener = new PublishEventListener($this->publisher, false); $event = new Event(); $listener($event);
Fix event listener test after propagation change
event-band_band-framework
train
php
fe40300c75db7ab60b407dd05999aa6d246fd0ae
diff --git a/gridmap/job.py b/gridmap/job.py index <HASH>..<HASH> 100644 --- a/gridmap/job.py +++ b/gridmap/job.py @@ -639,6 +639,7 @@ def _execute(job): Used by _process_jobs_locally """ job.execute() + return job.ret def _process_jobs_locally(jobs, max_processes=1): @@ -663,8 +664,8 @@ def _process_jobs_locally(jobs, max_processes=1): else: pool = Pool(max_processes) result = pool.map(_execute, jobs) - for ix, job in enumerate(jobs): - job.ret = result[ix] + for ret_val, job in zip(result, jobs): + job.ret = ret_val pool.close() pool.join()
Fix issue where _process_jobs_locally would not work with max_processes > 1
pygridtools_gridmap
train
py
42cfa9ca3edaf561c91098207a0f65d7f1713146
diff --git a/core/src/main/java/com/google/zxing/client/result/ProductResultParser.java b/core/src/main/java/com/google/zxing/client/result/ProductResultParser.java index <HASH>..<HASH> 100644 --- a/core/src/main/java/com/google/zxing/client/result/ProductResultParser.java +++ b/core/src/main/java/com/google/zxing/client/result/ProductResultParser.java @@ -43,7 +43,7 @@ public final class ProductResultParser extends ResultParser { String normalizedProductID; // Expand UPC-E for purposes of searching - if (format == BarcodeFormat.UPC_E) { + if (format == BarcodeFormat.UPC_E && rawText.length() == 8) { normalizedProductID = UPCEReader.convertUPCEtoUPCA(rawText); } else { normalizedProductID = rawText;
Closes Issue #<I> : don't respond to (invalid?) UPC-E codes that aren't 8 digits
zxing_zxing
train
java
98afc05b4d747f7597ad0214e68d623f68db3cd0
diff --git a/lib/fog/google/models/compute/images.rb b/lib/fog/google/models/compute/images.rb index <HASH>..<HASH> 100644 --- a/lib/fog/google/models/compute/images.rb +++ b/lib/fog/google/models/compute/images.rb @@ -11,8 +11,9 @@ module Fog # licenses needed to use some of them. # https://developers.google.com/compute/docs/premium-operating-systems GLOBAL_PROJECTS = [ - 'debian-cloud', 'centos-cloud', + 'debian-cloud', + 'google-containers', 'rhel-cloud', 'suse-cloud' ]
[google | compute] add google-containers project for images
fog_fog
train
rb
2d0ca5461dc17f33568a6e90c33986f6d6b306ba
diff --git a/migrations/install/forums.php b/migrations/install/forums.php index <HASH>..<HASH> 100644 --- a/migrations/install/forums.php +++ b/migrations/install/forums.php @@ -33,22 +33,17 @@ class FluxBB_Install_Forums $table->create(); $table->increments('id'); - // TODO: Localize string? - $table->string('forum_name', 80)->default('New forum'); + $table->string('forum_name', 80); $table->text('forum_desc')->nullable(); $table->string('redirect_url', 100)->nullable(); - // TODO: Remove moderators column - $table->text('moderators')->nullable(); $table->integer('num_topics')->unsigned()->default(0); $table->integer('num_posts')->unsigned()->default(0); $table->integer('last_post')->unsigned()->nullable(); $table->integer('last_post_id')->unsigned()->nullable(); $table->string('last_poster', 200)->nullable(); - // TODO: Really a boolean (or multiple options)? - $table->boolean('sort_by')->default(false); + $table->boolean('sort_by')->default(false); // Enchanted boolean (small int, enough for three values). Thanks, ENQ! $table->integer('disp_position')->default(0); - // TODO: Do we really need a default here? - $table->integer('cat_id')->unsigned()->default(0); + $table->integer('cat_id')->unsigned(); }); }
#<I>: Clean up the forum migration.
fluxbb_core
train
php
d4f64277ff403232458cf05c82898a26043e8c98
diff --git a/run.py b/run.py index <HASH>..<HASH> 100755 --- a/run.py +++ b/run.py @@ -17,7 +17,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # -# $Id$ +# $Id: run.py 2397 2015-03-18 19:03:10Z [email protected] $ # " Convinience parser launcher "
Adding a helper to run the parser
SergeySatskiy_cdm-flowparser
train
py
ad0ab8ef7566506bcda34a44faccb5705997eaa2
diff --git a/shared/validate/validate.go b/shared/validate/validate.go index <HASH>..<HASH> 100644 --- a/shared/validate/validate.go +++ b/shared/validate/validate.go @@ -163,10 +163,6 @@ func IsNetworkAddress(value string) error { // IsNetworkV4 validates an IPv4 CIDR string. If string is empty, returns valid. func IsNetworkV4(value string) error { - if value == "" { - return nil - } - ip, subnet, err := net.ParseCIDR(value) if err != nil { return err
shared/validate: Makes IsNetworkV4 non-optional
lxc_lxd
train
go
7ebdc3f30d2341310c5efa1e63530806cfbd8f03
diff --git a/csvs_to_sqlite/utils.py b/csvs_to_sqlite/utils.py index <HASH>..<HASH> 100644 --- a/csvs_to_sqlite/utils.py +++ b/csvs_to_sqlite/utils.py @@ -196,13 +196,13 @@ def to_sql_with_foreign_keys(conn, df, name, foreign_keys): for column, table in foreign_keys.items(): if column in columns: foreign_key_bits.append( - 'FOREIGN KEY ({}) REFERENCES {}(id)'.format( + 'FOREIGN KEY ("{}") REFERENCES [{}](id)'.format( column, table ) ) index_bits.append( # CREATE INDEX indexname ON table(column); - 'CREATE INDEX [{}_{}] ON [{}]([{}]);'.format( + 'CREATE INDEX ["{}_{}"] ON [{}]("{}");'.format( name, column, name, column ) )
Handle column names with spaces in them
simonw_csvs-to-sqlite
train
py
7a0af7aaf7961cc377fed98b67ab80fcf92c1409
diff --git a/contrib/externs/chrome_extensions.js b/contrib/externs/chrome_extensions.js index <HASH>..<HASH> 100644 --- a/contrib/externs/chrome_extensions.js +++ b/contrib/externs/chrome_extensions.js @@ -715,7 +715,7 @@ chrome.idle = {}; /** * @param {number} thresholdSeconds Threshold in seconds, used to determine * when a machine is in the idle state. - * @param {{function(string) : void} callback Callback to handle the state. + * @param {function(string) : void} callback Callback to handle the state. */ chrome.idle.queryState = function(thresholdSeconds, callback) {};
Fix bad JSDoc comment that is breaking our build. R=yzshen DELTA=1 (0 added, 0 deleted, 1 changed) Revision created by MOE tool push_codebase. MOE_MIGRATION=<I> git-svn-id: <URL>
google_closure-compiler
train
js