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
ef6c90c82a3de4a73fa4fef841168b6f358bccd2
diff --git a/src/main/java/org/fxmisc/flowless/VirtualFlow.java b/src/main/java/org/fxmisc/flowless/VirtualFlow.java index <HASH>..<HASH> 100644 --- a/src/main/java/org/fxmisc/flowless/VirtualFlow.java +++ b/src/main/java/org/fxmisc/flowless/VirtualFlow.java @@ -168,7 +168,19 @@ public class VirtualFlow<T, C extends Cell<T, ?>> extends Region implements Virt } } - orientation.relocate(navigator, -breadthOffset0.getValue(), 0); + double viewBreadth = orientation.breadth(this); + double navigatorBreadth = orientation.breadth(navigator); + double totalBreadth = breadthOffset0.getValue(); + double breadthDifference = navigatorBreadth - totalBreadth; + if (breadthDifference < viewBreadth) { + // viewport is scrolled all the way to the end of its breadth. + // but now viewport size (breadth) has increased + double adjustment = viewBreadth - breadthDifference; + orientation.relocate(navigator, -(totalBreadth - adjustment), 0); + breadthOffset0.setValue(totalBreadth - adjustment); + } else { + orientation.relocate(navigator, -breadthOffset0.getValue(), 0); + } } @Override
Fix #<I> by setting lower offset value based on viewport size increase
FXMisc_Flowless
train
java
661958b91a2309596fb228e2b7f4116c7655114c
diff --git a/test/commands/post_mortem_test.rb b/test/commands/post_mortem_test.rb index <HASH>..<HASH> 100644 --- a/test/commands/post_mortem_test.rb +++ b/test/commands/post_mortem_test.rb @@ -59,7 +59,7 @@ module Byebug ['restart', 'frame', 'quit', 'edit', 'info', 'irb', 'source', 'help', 'var class', 'list', 'method', 'kill', 'eval', 'set', 'save', 'show', - 'trace', 'thread list'].each do |cmd| + 'thread list'].each do |cmd| define_method "test_#{cmd}_is_permitted_in_post_mortem_mode" do enter 'set post_mortem', "#{cmd}", 'set no_postmortem' class_name = cmd.gsub(/(^| )\w/) { |b| b[-1,1].upcase } + 'Command'
Remove "trace" for post_mortem tests That command does not exist anymore. The test was only passing because "trace" is taken as an abbreviation for "tracevar"
deivid-rodriguez_byebug
train
rb
98709e95e67b9fee3ec38838ef3c62715d72e4e7
diff --git a/system/modules/DocumentManagementSystem/config/initialize.php b/system/modules/DocumentManagementSystem/config/initialize.php index <HASH>..<HASH> 100644 --- a/system/modules/DocumentManagementSystem/config/initialize.php +++ b/system/modules/DocumentManagementSystem/config/initialize.php @@ -75,7 +75,17 @@ class DocumentManagementSystemInitializer extends \Controller if (!\Config::get(self::DMS_BASE_DIRECTORY_KEY)) { \System::log('Setting default DMS base directory to "' . self::DMS_BASE_DIRECTORY_VALUE . '".', __METHOD__, TL_CONFIGURATION); - $objDir = \FilesModel::findByPath(self::DMS_BASE_DIRECTORY_VALUE); + $objDir = null; + + try + { + $objDir = \FilesModel::findByPath(self::DMS_BASE_DIRECTORY_VALUE); + } + catch (\Exception $e) + { + \System::log('"FilesModel::findByPath" crashed: ' . $e->getMessage(), __METHOD__, TL_ERROR); + } + if ($objDir == null) { if (file_exists(TL_ROOT . '/' . self::DMS_BASE_DIRECTORY_VALUE))
Catch Exception (#<I>)
ContaoDMS_dms
train
php
d11cd285c9dbc9690a3f6e5045782251d8c01817
diff --git a/addon/components/e3-scale/ordinal.js b/addon/components/e3-scale/ordinal.js index <HASH>..<HASH> 100644 --- a/addon/components/e3-scale/ordinal.js +++ b/addon/components/e3-scale/ordinal.js @@ -1,6 +1,7 @@ import Ember from 'ember'; import scale from '../../mixins/e3-scale'; import ordinal from '../../utils/shadow/scales/ordinal'; +const {get} = Ember; export default Ember.Component.extend(scale, { name: 'ordinal', @@ -9,18 +10,26 @@ export default Ember.Component.extend(scale, { These are optional parameters. */ attrs: { - sort: null, + sortProperty: null, banding: false, padding: 0, outerPadding: 0 }, generateScale(range, domain) { - return ordinal(range, domain, { - sort: this.getAttr('sort'), + let sortProp = this.getAttr('sortProperty'); + let options = { banding: this.getAttr('banding'), padding: this.getAttr('padding'), outerPadding: this.getAttr('outerPadding') - }); + }; + + if(sortProp) { + options.sort = function(a, b) { + return get(a, sortProp) - get(b, sortProp); + }; + } + + return ordinal(range, domain, options); } });
Expose Sort Property on Ordinal Scale
RavelLaw_e3
train
js
8573758973711d790095ec5fde673326e0429f2a
diff --git a/src/Experimental/File.php b/src/Experimental/File.php index <HASH>..<HASH> 100644 --- a/src/Experimental/File.php +++ b/src/Experimental/File.php @@ -65,7 +65,7 @@ class File extends \Inphinit\File } $finfo = finfo_open(FILEINFO_MIME_ENCODING); - $encode = finfo_buffer($finfo, file_get_contents($path, false, null, -1, 5012)); + $encode = finfo_buffer($finfo, file_get_contents($path, false, null, 0, 5012)); finfo_close($finfo); return strcasecmp($encode, 'binary') === 0; diff --git a/src/Inphinit/App.php b/src/Inphinit/App.php index <HASH>..<HASH> 100644 --- a/src/Inphinit/App.php +++ b/src/Inphinit/App.php @@ -224,7 +224,7 @@ class App self::trigger('ready'); - if ($output) { + if ($output || is_numeric($output)) { echo $output; }
Improve App and Route return, fixed File - Fixed File::isBinary method - Improved show Route return in App::exec
inphinit_framework
train
php,php
5173583e26358b2336edd1551f0c2cf936fec88a
diff --git a/src/client/rest/RESTMethods.js b/src/client/rest/RESTMethods.js index <HASH>..<HASH> 100644 --- a/src/client/rest/RESTMethods.js +++ b/src/client/rest/RESTMethods.js @@ -165,8 +165,9 @@ class RESTMethods { search(target, options) { options = transformSearchOptions(options, this.client); + for (const key in options) if (options[key] === undefined) delete options[key]; - const queryString = querystring.stringify(options); + const queryString = (querystring.stringify(options).match(/[^=&?]+=[^=&?]+/g) || []).join('&'); let type; if (target instanceof Channel) {
Fix empty search query parameters (#<I>) The search function was sending request to stuff like: search?author_id=&content=&channel_id=<I>
discordjs_discord.js
train
js
0317393c60b39486271b83414e0124d4f4031fbb
diff --git a/src/VR.js b/src/VR.js index <HASH>..<HASH> 100644 --- a/src/VR.js +++ b/src/VR.js @@ -580,9 +580,6 @@ class FakeVRDisplay extends VRDisplay { if (!globalGamepads) { globalGamepads = _makeGlobalGamepads(); - for (let i = 0; i < globalGamepads.main.length; i++) { - this.gamepads[i] = globalGamepads.main[i]; - } } const _decorateGamepad = (gamepad, targetRayMode) => { gamepad.handedness = gamepad.hand; @@ -598,6 +595,7 @@ class FakeVRDisplay extends VRDisplay { }; for (let i = 0; i < globalGamepads.main.length; i++) { _decorateGamepad(globalGamepads.main[i], 'tracked-pointer'); + this.gamepads[i] = globalGamepads.main[i]; } for (let i = 0; i < globalGamepads.tracker.length; i++) { _decorateGamepad(globalGamepads.tracker[i], 'tracked-pointer');
move gamepad assignment and remove redundant code
exokitxr_exokit
train
js
e11973b22720e6e3e89cc415f9c7b2ac71e0c156
diff --git a/index.js b/index.js index <HASH>..<HASH> 100644 --- a/index.js +++ b/index.js @@ -2,7 +2,7 @@ var parseUrl = require('url').parse; var isSecure = function(req) { if (req.secure) { return true; - } else if (req.get('X-Forwarded-Proto') === 'https') { + } else if (req.get('X-Forwarded-Proto').toLowerCase() === 'https') { return true; } return false;
lower case forwarded protocol before comparing to 'https'
battlejj_express-force-ssl
train
js
16bfe5efa4ef9f23fae885d9fae33ff47ab5b006
diff --git a/src/labels/label_point.js b/src/labels/label_point.js index <HASH>..<HASH> 100644 --- a/src/labels/label_point.js +++ b/src/labels/label_point.js @@ -10,6 +10,10 @@ export default class LabelPoint extends Label { this.position = [position[0], position[1]]; this.offset = [this.options.offset[0], this.options.offset[1]]; this.update(); + + if (!this.inTileBounds()) { + this.moveIntoTile(); + } } update() { @@ -34,10 +38,6 @@ export default class LabelPoint extends Label { this.aabb = this.obb.getExtent(); } - getNextFittingSegment() { - return this.moveIntoTile(); - } - // Try to move the label into the tile bounds // Returns true if label was moved into tile, false if it couldn't be moved moveIntoTile () {
Point labels are ensured to be created within a tile
tangrams_tangram
train
js
8dab3c8fc54ca1eb920af5652671eaa34a584b7e
diff --git a/lib/multiarray/sequence.rb b/lib/multiarray/sequence.rb index <HASH>..<HASH> 100644 --- a/lib/multiarray/sequence.rb +++ b/lib/multiarray/sequence.rb @@ -145,6 +145,10 @@ module Hornetseye Hornetseye::Sequence element_type.float, num_elements end + def floating( other ) + coercion( other ).float + end + def inspect if dimension == 1 "Sequence(#{typecode.inspect},#{num_elements.inspect})"
Added missing method Sequence_.floating
wedesoft_multiarray
train
rb
3e3eeb0358a848395ab16090c83c713290123950
diff --git a/src/Jobs/Entity/Job.php b/src/Jobs/Entity/Job.php index <HASH>..<HASH> 100644 --- a/src/Jobs/Entity/Job.php +++ b/src/Jobs/Entity/Job.php @@ -451,6 +451,8 @@ class Job extends BaseEntity implements JobInterface, return $this; } + + /** * (non-PHPdoc) * @see \Jobs\Entity\JobInterface::getContactEmail() @@ -575,6 +577,17 @@ class Job extends BaseEntity implements JobInterface, return $this; } + public function unsetOrganization($removePermissions = true) + { + if($this->organization && $removePermissions){ + $this->getPermissions()->revoke($this->organization,Permissions::PERMISSION_ALL); + } + + $this->organization = null; + + return $this; + } + /** * (non-PHPdoc) * @see \Jobs\Entity\JobInterface::setApplications()
improved behat tests, ref #<I>
yawik_jobs
train
php
cb48e3cfca2015c40d34793dcb22f9435a82013d
diff --git a/pkg/apis/networking/validation/validation_test.go b/pkg/apis/networking/validation/validation_test.go index <HASH>..<HASH> 100644 --- a/pkg/apis/networking/validation/validation_test.go +++ b/pkg/apis/networking/validation/validation_test.go @@ -59,7 +59,7 @@ func makePort(proto *api.Protocol, port intstr.IntOrString, endPort int32) netwo Protocol: proto, Port: nil, } - if port != intstr.FromInt(0) { + if port != intstr.FromInt(0) && port != intstr.FromString("") && port != intstr.FromString("0") { r.Port = &port } if endPort != 0 {
Handle int and string port in makePort
kubernetes_kubernetes
train
go
116eaa4a56d1e78a0419cad417668d002d7abd1b
diff --git a/spec/features/browse_files_spec.rb b/spec/features/browse_files_spec.rb index <HASH>..<HASH> 100644 --- a/spec/features/browse_files_spec.rb +++ b/spec/features/browse_files_spec.rb @@ -42,8 +42,7 @@ describe "Browse files", :type => :feature do end it "should allow you to click next" do expect(page).to have_content "Numerical Sort" - expect(page).to have_css "a.sort_change", text:"Numerical Sort" - click_link "Numerical Sort" + expect(page).to have_css "a.sort_change", text:"A-Z Sort" within(".modal-body") do expect(page).to have_content "key_1 " expect(page).not_to have_content "key_25 "
More facets modal defaults to numerical sort Post-Blacklight <I> update, the modal that show additional terms for a give facet now defaults to numerical sorting, as a opposed to alpha sorting.
samvera_hyrax
train
rb
4dc7817bb3110922f68bbec6ef6c5d39a8093eba
diff --git a/tasks/filerev_replace.js b/tasks/filerev_replace.js index <HASH>..<HASH> 100644 --- a/tasks/filerev_replace.js +++ b/tasks/filerev_replace.js @@ -88,7 +88,7 @@ module.exports = function(grunt) { function absolute_asset_path( string, view_src, views_root ) { var asset_path = string.trim(); - if( !grunt.file.isPathAbsolute( asset_path ) ) { + if( asset_path[0] != '/' && asset_path[0] != '\\' ) { asset_path = path.join( path.dirname( view_src ), asset_path ); asset_path = file_path_to_web_path( asset_path, views_root ); }
isPathAbsolute doesn't work in this case
solidusjs_grunt-filerev-replace
train
js
2b1ccc1b5ad03f2b518ef0e8752fdc0092470ed4
diff --git a/gwpy/plotter/core.py b/gwpy/plotter/core.py index <HASH>..<HASH> 100644 --- a/gwpy/plotter/core.py +++ b/gwpy/plotter/core.py @@ -291,14 +291,6 @@ class Plot(figure.Figure): # These methods try to guess which axes to add to, otherwise generate # a new one - def gca(self, **kwargs): - try: - kwargs.setdefault('projection', self._DefaultAxesClass.name) - except AttributeError: - pass - return super(Plot, self).gca(**kwargs) - gca.__doc__ = figure.Figure.gca.__doc__ - def get_axes(self, projection=None): """Find all `Axes`, optionally matching the given projection
Plot.gca: remove custom gca, it causes problems
gwpy_gwpy
train
py
0e2d22a3a3d6879f1ea17424c083034d3b55abd2
diff --git a/src/boost/python/device_class.py b/src/boost/python/device_class.py index <HASH>..<HASH> 100644 --- a/src/boost/python/device_class.py +++ b/src/boost/python/device_class.py @@ -667,6 +667,7 @@ def __init_DeviceClass(): DeviceClass.device_property_list = {} DeviceClass.cmd_list = {} DeviceClass.attr_list = {} + DeviceClass.pipe_list = {} DeviceClass.__init_orig__ = DeviceClass.__init__ DeviceClass.__init__ = __DeviceClass__init__ DeviceClass.__str__ = __DeviceClass__str__
Fix missing pipe_list initialization in DeviceClass
tango-controls_pytango
train
py
82b7ab3e310e63a408b318a62eb736a79f367aac
diff --git a/g_appcode.go b/g_appcode.go index <HASH>..<HASH> 100644 --- a/g_appcode.go +++ b/g_appcode.go @@ -487,10 +487,13 @@ func writeModelFiles(tables []*Table, mPath string, selectedTables map[string]bo fileStr = strings.Replace(fileStr, "{{modelName}}", camelCase(tb.Name), -1) // if table contains time field, import time.Time package timePkg := "" + importTimePkg := "" if tb.ImportTimePkg { timePkg = "\"time\"\n" + importTimePkg = "import \"time\"\n" } fileStr = strings.Replace(fileStr, "{{timePkg}}", timePkg, -1) + fileStr = strings.Replace(fileStr, "{{importTimePkg}}", importTimePkg, -1) if _, err := f.WriteString(fileStr); err != nil { ColorLog("[ERRO] Could not write model file to %s\n", fpath) os.Exit(2) @@ -707,6 +710,7 @@ func getPackagePath(curpath string) (packpath string) { const ( STRUCT_MODEL_TPL = `package models +{{importTimePkg}} {{modelStruct}} `
import package for no-pk models
beego_bee
train
go
af8f9753a24325f199c408f9b140bed68afd7693
diff --git a/lib/Psc/TPL/ContentStream/ContentStreamEntity.php b/lib/Psc/TPL/ContentStream/ContentStreamEntity.php index <HASH>..<HASH> 100644 --- a/lib/Psc/TPL/ContentStream/ContentStreamEntity.php +++ b/lib/Psc/TPL/ContentStream/ContentStreamEntity.php @@ -132,5 +132,21 @@ abstract class ContentStreamEntity extends \Psc\CMS\AbstractEntity implements Co } } + public function __toString() { + return sprintf("ContentStream(%s): %s:%s:%s\n", $this->slug, $this->locale, $this->type, $this->revision); + } + + public function getDebug() { + $ret = (string) $this; + + $entries = $this->getEntries(); + $ret .= sprintf("%d Entries:\n", count($entries)); + foreach ($entries as $entry) { + $ret .= sprintf(" %s\n", $entry->getLabel()); + } + + return $ret; + } + abstract public function getTypeClass($typeName); }
fix evil typo in contenstream controller
webforge-labs_psc-cms
train
php
2f7687d7894c115e27644711f2a80cfcda5b9d73
diff --git a/lib/virtus/builder.rb b/lib/virtus/builder.rb index <HASH>..<HASH> 100644 --- a/lib/virtus/builder.rb +++ b/lib/virtus/builder.rb @@ -25,7 +25,7 @@ module Virtus # @api private def self.call(options, &block) - new(Configuration.build(options, &block)).mod + new(Configuration.new(options, &block)).mod end # @api private diff --git a/lib/virtus/configuration.rb b/lib/virtus/configuration.rb index <HASH>..<HASH> 100644 --- a/lib/virtus/configuration.rb +++ b/lib/virtus/configuration.rb @@ -18,22 +18,6 @@ module Virtus # Access the mass-assignment setting for this instance attr_accessor :mass_assignment - # Build new configuration instance using the passed block - # - # @example - # Configuration.build do |config| - # config.coerce = false - # end - # - # @return [Configuration] - # - # @api public - def self.build(options = {}) - config = new(options) - yield config if block_given? - config - end - # Initialized a configuration instance # # @return [undefined] @@ -46,6 +30,8 @@ module Virtus @constructor = options.fetch(:constructor,true) @mass_assignment = options.fetch(:mass_assignment,true) @coercer = Coercible::Coercer.new + + yield self if block_given? end # Access the coercer for this instance and optional configure a
Removed Configuration.build in favor of Configuration#initialize. * yielding the object from within #initialize and having .new return the value is essentially what Configuration.build was doing.
solnic_virtus
train
rb,rb
228e09cdd1d2b63061ebb9cc171206c778a0d327
diff --git a/mod/forum/lib.php b/mod/forum/lib.php index <HASH>..<HASH> 100644 --- a/mod/forum/lib.php +++ b/mod/forum/lib.php @@ -715,6 +715,11 @@ function forum_cron() { $eventdata->contexturl = "{$CFG->wwwroot}/mod/forum/discuss.php?d={$discussion->id}#p{$post->id}"; $eventdata->contexturlname = $discussion->name; + // If forum_replytouser is not set then set mail display to 0. + if (!$CFG->forum_replytouser) { + $eventdata->userfrom->maildisplay = 0; + } + $mailresult = message_send($eventdata); if (!$mailresult){ mtrace("Error: mod/forum/lib.php forum_cron(): Could not send out mail for id $post->id to user $userto->id". @@ -1009,7 +1014,7 @@ function forum_cron() { $usetrueaddress = true; // Directly email forum digests rather than sending them via messaging, use the // site shortname as 'from name', the noreply address will be used by email_to_user. - $mailresult = email_to_user($userto, $site->shortname, $postsubject, $posttext, $posthtml, $attachment, $attachname, $usetrueaddress, $CFG->forum_replytouser); + $mailresult = email_to_user($userto, $site->shortname, $postsubject, $posttext, $posthtml, $attachment, $attachname, $usetrueaddress); if (!$mailresult) { mtrace("ERROR!");
MDL-<I> Forum: If forum_replytouser is not set then don't display from user email"
moodle_moodle
train
php
bdeae2b9b8105e33abd8a91d783d1a1187ab5c99
diff --git a/mod/data/lib.php b/mod/data/lib.php index <HASH>..<HASH> 100755 --- a/mod/data/lib.php +++ b/mod/data/lib.php @@ -1175,7 +1175,8 @@ function data_print_comment($data, $comment, $page=0) { echo '</td>'; echo '<td class="topic starter" align="left"><div class="author">'; - $fullname = fullname($comment->userid, has_capability('moodle/site:viewfullnames', $context)); + $fullname = fullname($user, has_capability('moodle/site:viewfullnames', $context)); + $by = new object(); $by->name = '<a href="'.$CFG->wwwroot.'/user/view.php?id='. $user->id.'&amp;course='.$data->course.'">'.$fullname.'</a>'; $by->date = userdate($comment->modified);
Comments in data print the "by" and then the date but no username MDL-<I>; merged from MOODLE_<I>_STABLE
moodle_moodle
train
php
e20e6980e9167492dc2579dd4001eb999bc92c53
diff --git a/retrieval/target.go b/retrieval/target.go index <HASH>..<HASH> 100644 --- a/retrieval/target.go +++ b/retrieval/target.go @@ -10,9 +10,11 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. + package retrieval import ( + "bytes" "fmt" "log" "net/http" @@ -236,7 +238,15 @@ func (t *target) scrape(timestamp time.Time, results chan<- *extraction.Result) BaseLabels: baseLabels, } - return processor.ProcessSingle(resp.Body, results, processOptions) + // N.B. - It is explicitly required to extract the entire payload before + // attempting to deserialize, as the underlying reader expects will + // interpret pending data as a truncated message. + buf := new(bytes.Buffer) + if _, err := buf.ReadFrom(resp.Body); err != nil { + return err + } + + return processor.ProcessSingle(buf, results, processOptions) } func (t target) State() TargetState {
Completely extract response payload for decoding. This commit forces the extraction framework to read the entire response payload into a buffer before attempting to decode it, for the underlying Protocol Buffer message readers do not block on partial messages.
prometheus_prometheus
train
go
48e443d0e2c4095661a8119ed0ae26084a79b6c6
diff --git a/src/mixins/field.js b/src/mixins/field.js index <HASH>..<HASH> 100644 --- a/src/mixins/field.js +++ b/src/mixins/field.js @@ -14,7 +14,7 @@ export const FieldMixin = { }, created() { - if (this.vanField) { + if (this.vanField && !this.vanField.children) { this.vanField.children = this; } }, diff --git a/src/radio-group/index.js b/src/radio-group/index.js index <HASH>..<HASH> 100644 --- a/src/radio-group/index.js +++ b/src/radio-group/index.js @@ -1,10 +1,11 @@ import { createNamespace } from '../utils'; +import { FieldMixin } from '../mixins/field'; import { ParentMixin } from '../mixins/relation'; const [createComponent, bem] = createNamespace('radio-group'); export default createComponent({ - mixins: [ParentMixin('vanRadio')], + mixins: [ParentMixin('vanRadio'), FieldMixin], props: { value: null,
feat(Form): support using RadioGroup
youzan_vant
train
js,js
05bba157b1f0d4966b0a6f93171c7380fc5c457b
diff --git a/hic/test/test_flow.py b/hic/test/test_flow.py index <HASH>..<HASH> 100644 --- a/hic/test/test_flow.py +++ b/hic/test/test_flow.py @@ -46,6 +46,16 @@ def test_phi_event(): _check_phi(M, (.1, 0, .01), 1.) _check_phi(M, (.1, 0, .01), (1., 0, 1.2)) + M = 2000 + vn = .1, .03, .01 + psi = 1., 1.2, 1.1 + phi = flow.phi_event(M, vn, psi) + + n = np.arange(2, 2+len(vn), dtype=float) + vnobs = np.cos(n*np.subtract.outer(phi, psi)).mean(axis=0) + assert np.all(np.abs(vn - vnobs) < 2.*M**(-.5)), \ + 'Flows are not within statistical fluctuation.' + def assert_close(a, b, msg='', tol=1e-15): assert abs(a - b) < tol, \
Add a more stringent flow test.
Duke-QCD_hic
train
py
9b0980ebd4f13236030e24b8f4296827a877a773
diff --git a/lib/fbgraph/base.rb b/lib/fbgraph/base.rb index <HASH>..<HASH> 100644 --- a/lib/fbgraph/base.rb +++ b/lib/fbgraph/base.rb @@ -1,3 +1,5 @@ +require 'hashie' + module FBGraph class Base diff --git a/specs/lib/fbauth/base_spec.rb b/specs/lib/fbauth/base_spec.rb index <HASH>..<HASH> 100644 --- a/specs/lib/fbauth/base_spec.rb +++ b/specs/lib/fbauth/base_spec.rb @@ -75,6 +75,13 @@ describe FBGraph do @base.info!(false) end + it "should parse the result by default" do + uri = "/123" + @base.find('123') + @client.consumer.stub!(:get).with(uri).and_return('{"me": [1, 2]}') + @base.info!.me.should == [1, 2] + end + describe 'when a connection is passed' do it 'should request with the path "/123/home"' do uri = "/123/home"
Load the Hashie gem in base, since it's used there.
nsanta_fbgraph
train
rb,rb
92006f67622e5a42ee584ee24c69e1ca167cbb86
diff --git a/lib/term-classes.js b/lib/term-classes.js index <HASH>..<HASH> 100644 --- a/lib/term-classes.js +++ b/lib/term-classes.js @@ -98,6 +98,9 @@ var instances = { TABLE_LIST: r.tableList(), CONFIG: r([]).config(), STATUS: r([]).status(), + WAIT: r.table('superheroes').wait(), + RECONFIGURE: r.table('superheroes').reconfigure(), + REBALANCE: r.table('superheroes').rebalance(), SYNC: r([]).sync(), INDEX_CREATE: r([]).indexCreate(''), INDEX_DROP: r([]).indexDrop(''), @@ -190,10 +193,7 @@ var instances = { /* istanbul ignore next */ var extended = filter({ - FOLD: r([]).fold && r([]).fold('', function () { return true }), - WAIT: r.wait && r.wait(), - RECONFIGURE: r.reconfigure && r.reconfigure(), - REBALANCE: r.rebalance && r.rebalance() + FOLD: r([]).fold && r([]).fold('', function () { return true }) }, exists) assign(instances, extended)
fix wait, reconfigure, rebalance term-classes
tjmehta_validate-reql
train
js
d3e5b9770f2a1f746bc005de41c7933dfb6674b7
diff --git a/lib/heroku/command.rb b/lib/heroku/command.rb index <HASH>..<HASH> 100644 --- a/lib/heroku/command.rb +++ b/lib/heroku/command.rb @@ -236,9 +236,9 @@ module Heroku json = json_decode(body.to_s) rescue false case json when Array - json[1].last # message like [['base', 'message']] + json.first.last # message like [['base', 'message']] when Hash - json['error'] # message like {'error' => 'message'} + json['error'] # message like {'error' => 'message'} else nil end
fix for array based error parsing
heroku_legacy-cli
train
rb
a3d52da76635c610cf9851ada4444641cffcd7cb
diff --git a/lib/multirepo/files/config-entry.rb b/lib/multirepo/files/config-entry.rb index <HASH>..<HASH> 100644 --- a/lib/multirepo/files/config-entry.rb +++ b/lib/multirepo/files/config-entry.rb @@ -8,14 +8,12 @@ module MultiRepo attr_accessor :id attr_accessor :path attr_accessor :url - attr_accessor :branch attr_accessor :repo def encode_with(coder) coder["id"] = @id coder["path"] = @path coder["url"] = @url - coder["branch"] = @branch end def ==(entry) @@ -28,7 +26,6 @@ module MultiRepo @id = SecureRandom.uuid @path = repo.path @url = repo.exists? ? repo.remote('origin').url : nil - @branch = repo.exists? ? repo.current_branch : nil end def repo
ConfigEntry does not store a work branch anymore. Breaks InstallCommand.
fortinmike_git-multirepo
train
rb
ec752506d96955a54903ad6a5bd91a87b851a8ea
diff --git a/lib/CalDAV/Schedule/IMipPlugin.php b/lib/CalDAV/Schedule/IMipPlugin.php index <HASH>..<HASH> 100644 --- a/lib/CalDAV/Schedule/IMipPlugin.php +++ b/lib/CalDAV/Schedule/IMipPlugin.php @@ -30,13 +30,6 @@ class IMipPlugin extends DAV\ServerPlugin { protected $senderEmail; /** - * Server class - * - * @var DAV\Server - */ - protected $server; - - /** * ITipMessage * * @var ITip\Message
Remove an unused variable. Thanks @kewisch for the notice!
sabre-io_dav
train
php
c34c42ad309fe9932c0c54f8b50688a31d7eb78e
diff --git a/core/src/test/java/com/google/instrumentation/stats/ViewDescriptorTest.java b/core/src/test/java/com/google/instrumentation/stats/ViewDescriptorTest.java index <HASH>..<HASH> 100644 --- a/core/src/test/java/com/google/instrumentation/stats/ViewDescriptorTest.java +++ b/core/src/test/java/com/google/instrumentation/stats/ViewDescriptorTest.java @@ -161,6 +161,11 @@ public final class ViewDescriptorTest { assertThat(ViewDescriptor.Name.create("my name").asString()).isEqualTo("my name"); } + @Test(expected = NullPointerException.class) + public void preventNullNameString() { + ViewDescriptor.Name.create(null); + } + @Test public void testViewDescriptorNameEquals() { new EqualsTester()
Test that ViewDescriptor.Names cannot be created with null strings.
census-instrumentation_opencensus-java
train
java
c6b098068d184fa18d2ea0b51d2b0057daf81bb4
diff --git a/pkg/registry/core/pod/strategy.go b/pkg/registry/core/pod/strategy.go index <HASH>..<HASH> 100644 --- a/pkg/registry/core/pod/strategy.go +++ b/pkg/registry/core/pod/strategy.go @@ -192,11 +192,14 @@ func NodeNameTriggerFunc(obj runtime.Object) []storage.MatchValue { // PodToSelectableFields returns a field set that represents the object // TODO: fields are not labels, and the validation rules for them do not apply. func PodToSelectableFields(pod *api.Pod) fields.Set { - podSpecificFieldsSet := fields.Set{ - "spec.nodeName": pod.Spec.NodeName, - "spec.restartPolicy": string(pod.Spec.RestartPolicy), - "status.phase": string(pod.Status.Phase), - } + // The purpose of allocation with a given number of elements is to reduce + // amount of allocations needed to create the fields.Set. If you add any + // field here or the number of object-meta related fields changes, this should + // be adjusted. + podSpecificFieldsSet := make(fields.Set, 5) + podSpecificFieldsSet["spec.nodeName"] = pod.Spec.NodeName + podSpecificFieldsSet["spec.restartPolicy"] = string(pod.Spec.RestartPolicy) + podSpecificFieldsSet["status.phase"] = string(pod.Status.Phase) return generic.AddObjectMetaFieldsSet(podSpecificFieldsSet, &pod.ObjectMeta, true) }
Allocate podFields map with a correct hint for size
kubernetes_kubernetes
train
go
50a126335fe97b319de954123e84df1a005e7e84
diff --git a/lib/fog/collection.rb b/lib/fog/collection.rb index <HASH>..<HASH> 100644 --- a/lib/fog/collection.rb +++ b/lib/fog/collection.rb @@ -5,7 +5,8 @@ module Fog class_eval <<-EOS, __FILE__, __LINE__ attr_accessor :#{name} EOS - attributes << name + @attributes ||= [] + @attributes |= [name] for other_name in [*other_names] aliases[other_name] = name end diff --git a/lib/fog/model.rb b/lib/fog/model.rb index <HASH>..<HASH> 100644 --- a/lib/fog/model.rb +++ b/lib/fog/model.rb @@ -5,7 +5,8 @@ module Fog class_eval <<-EOS, __FILE__, __LINE__ attr_accessor :#{name} EOS - attributes << name + @attributes ||= [] + @attributes |= [name] for other_name in [*other_names] aliases[other_name] = name end
prevent adding property to collection/model multiple times
fog_fog
train
rb,rb
d0ae5a1aa921aabf89629d2713a25da15bf6ea59
diff --git a/src/sentaku/implementations_stack.py b/src/sentaku/implementations_stack.py index <HASH>..<HASH> 100644 --- a/src/sentaku/implementations_stack.py +++ b/src/sentaku/implementations_stack.py @@ -6,13 +6,13 @@ based on the contexts pushed/poped from the stack it will choose context roots and help picking implementations """ from contextlib import contextmanager +LIMIT = 20 class ImplementationChoiceStack(object): def __init__(self): self._stack = [] - self._limit = 100 self.frozen = False def __repr__(self): @@ -40,11 +40,11 @@ class ImplementationChoiceStack(object): if self.frozen: raise RuntimeError( 'further nesting of implementation choice has been disabled') - if len(self._stack) > self._limit: + if len(self._stack) > LIMIT: raise OverflowError( 'stack limit exceeded ({unique} unique, {limit} limit)'.format( unique=len(set(self._stack)), - limit=self._limit, )) + limit=LIMIT, )) self._stack.append(new) try:
turn implementation stack limit into a constant of <I>
RedHatQE_Sentaku
train
py
d370e0b4a5feb77c7aa6077f94d8c8035b50dd40
diff --git a/taskqueue/__init__.py b/taskqueue/__init__.py index <HASH>..<HASH> 100644 --- a/taskqueue/__init__.py +++ b/taskqueue/__init__.py @@ -5,4 +5,4 @@ from .taskqueue import ( ) from .queueablefns import queueable, FunctionTask -__version__ = '2.11.0' \ No newline at end of file +__version__ = '2.12.0' \ No newline at end of file
release(<I>): adds retry to SQS except for http 4xx errors
seung-lab_python-task-queue
train
py
48d7984ba420608efcb9958c1ad9f8f6a6045f65
diff --git a/spec/support/selectable_examples.rb b/spec/support/selectable_examples.rb index <HASH>..<HASH> 100644 --- a/spec/support/selectable_examples.rb +++ b/spec/support/selectable_examples.rb @@ -32,6 +32,9 @@ shared_context "an NIO selectable stream" do let(:peer) { pair.last } it "selects readable when the other end closes" do + # hax: this test is broken for OpenSSL sockets + skip 'broken for SSL ;_;' if peer.is_a? OpenSSL::SSL::SSLSocket + monitor = selector.register(stream, :r) expect(selector.select(0)).to be_nil
Hax pending for closing SSL sockets selecting readable
socketry_nio4r
train
rb
695ad587c1d6ac93426aac5274e6bc79b3ba1df0
diff --git a/httpbin/core.py b/httpbin/core.py index <HASH>..<HASH> 100644 --- a/httpbin/core.py +++ b/httpbin/core.py @@ -1472,6 +1472,35 @@ def xml(): return response +@app.route("/json") +def a_json_endpoint(): + """Returns a simple JSON document. + --- + tags: + - Response formats + responses: + 200: + description: An JSON document. + """ + return flask_jsonify( + slideshow={ + 'title': 'Sample Slide Show', + 'date': 'date of publication', + 'author': 'Yours Truly', + 'slides': [ + {'type': 'all', + 'title': 'Wake up to WonderWidgets!'}, + {'type': 'all', + 'title': 'Overview', + 'items': [ + 'Why <em>WonderWidgets</em> are great', + 'Who <em>buys</em> WonderWidgets' + ]} + ] + } + ) + + if __name__ == '__main__': parser = argparse.ArgumentParser() parser.add_argument("--port", type=int, default=5000)
Added /json endpoint to match the /xml one
postmanlabs_httpbin
train
py
3c0bbf846cd1fb9509a6b1421b6f5b78105de136
diff --git a/routes/web.php b/routes/web.php index <HASH>..<HASH> 100755 --- a/routes/web.php +++ b/routes/web.php @@ -16,14 +16,14 @@ Route::group(['middleware' => ['web']], function () use ($accountController) { Route::group(['middleware' => 'auth', 'as' => 'voyager-frontend.account'], function () use ($accountController) { Route::get('/account', "$accountController@index"); - Route::post('/account', "$accountController@updateAccount"); + Route::post('/account', "$accountController@updateAccount")->name('.update'); /** * User impersonation */ Route::get('/admin/users/impersonate/{userId}', "$accountController@impersonateUser") ->name('.impersonate') - ->middleware(['web', 'admin.user']); + ->middleware(['web', 'admin.user'])->name('.admin'); Route::post('/admin/users/impersonate/{originalId}', "$accountController@impersonateUser") ->name('.impersonate')
Fix duplicate named routes. Fixes #<I>
pvtl_voyager-frontend
train
php
bfd6fb89ad448d357d1e15d5223d051e09b519f4
diff --git a/Bundle/FormBundle/Form/Type/LinkType.php b/Bundle/FormBundle/Form/Type/LinkType.php index <HASH>..<HASH> 100644 --- a/Bundle/FormBundle/Form/Type/LinkType.php +++ b/Bundle/FormBundle/Form/Type/LinkType.php @@ -110,6 +110,11 @@ class LinkType extends AbstractType */ protected function manageLinkTypeRelatedFields($linkType, $locale, $form, FormBuilderInterface $builder) { + $form->remove('route'); + $form->remove('url'); + $form->remove('attachedWidget'); + $form->remove('viewReference'); + $form->remove('locale'); switch ($linkType) { case Link::TYPE_VIEW_REFERENCE: $locale = $locale ?: $this->requestStack->getCurrentRequest()->getLocale();
on linkType change, reinitialize the fields
Victoire_victoire
train
php
879acf7799845f7d32a246cd77ce85a4472353ad
diff --git a/lang/en_utf8/error.php b/lang/en_utf8/error.php index <HASH>..<HASH> 100644 --- a/lang/en_utf8/error.php +++ b/lang/en_utf8/error.php @@ -137,7 +137,7 @@ $string['nousers'] = 'No such user!'; $string['nonmeaningfulcontent'] = 'Non meaningful content'; $string['noparticipatorycms'] = 'Sorry, but you have no participatory course modules to report on.'; $string['nopermissions'] = 'Sorry, but you do not currently have permissions to do that ($a)'; -$string['nopermissiontoviewpage'] = 'You are not allowed to look at this patge'; +$string['nopermissiontoviewpage'] = 'You are not allowed to look at this page'; $string['nosite'] = 'No sites'; $string['nositeid'] = 'No site ID'; $string['nostatstodisplay'] = 'There is no available data to display, sorry.';
MDL-<I> fixed typo - credit goes to Mitsuhiro Yoshida
moodle_moodle
train
php
e7ac6baeb954b3a576e624ff1871c5778e48d311
diff --git a/lib/gecko/record/fulfillment.rb b/lib/gecko/record/fulfillment.rb index <HASH>..<HASH> 100644 --- a/lib/gecko/record/fulfillment.rb +++ b/lib/gecko/record/fulfillment.rb @@ -16,7 +16,6 @@ module Gecko attribute :notes, String attribute :tracking_url, String attribute :tracking_company, String - attribute :destination_url, String, readonly: true attribute :packed_at, Date attribute :shipped_at, DateTime diff --git a/lib/gecko/record/invoice.rb b/lib/gecko/record/invoice.rb index <HASH>..<HASH> 100644 --- a/lib/gecko/record/invoice.rb +++ b/lib/gecko/record/invoice.rb @@ -16,7 +16,6 @@ module Gecko attribute :notes, String attribute :exchange_rate, BigDecimal - attribute :destination_url, String, readonly: true attribute :document_url, String, readonly: true end diff --git a/lib/gecko/record/purchase_order.rb b/lib/gecko/record/purchase_order.rb index <HASH>..<HASH> 100644 --- a/lib/gecko/record/purchase_order.rb +++ b/lib/gecko/record/purchase_order.rb @@ -25,7 +25,6 @@ module Gecko attribute :notes, String attribute :tax_treatment, String - attribute :destination_url, String, readonly: true attribute :document_url, String, readonly: true attribute :total, BigDecimal, readonly: true
Remove destination_url as it’s being deprecated
tradegecko_gecko
train
rb,rb,rb
9b3833d166f2b8644ea8727831e414fa28ef4841
diff --git a/code/objects/News.php b/code/objects/News.php index <HASH>..<HASH> 100644 --- a/code/objects/News.php +++ b/code/objects/News.php @@ -231,16 +231,16 @@ class News extends DataObject implements IOGObject{ $this->NewsHolderPageID = $page->ID; } if (!$this->URLSegment || ($this->isChanged('Title') && !$this->isChanged('URLSegment'))){ + $Renamed = new Renamed(); + $Renamed->OldLink = $this->URLSegment; + $Renamed->NewsID = $this->ID; + $Renamed->write(); $this->URLSegment = singleton('SiteTree')->generateURLSegment($this->Title); if(strpos($this->URLSegment, 'page-') === false){ $nr = 1; while($this->LookForExistingURLSegment($this->URLSegment)){ $this->URLSegment .= '-'.$nr++; } - $Renamed = new Renamed(); - $Renamed->OldLink = $this->URLSegment; - $Renamed->NewsID = $this->ID; - $Renamed->write(); } } }
Small bug. Renamed was called too late. Called the rename addition after setting a new name... D'oh! Need to have a look at this issue!
Firesphere_silverstripe-newsmodule
train
php
da9082953cf999b483285bc3737121361bf3a590
diff --git a/spec/cli/yardoc_spec.rb b/spec/cli/yardoc_spec.rb index <HASH>..<HASH> 100644 --- a/spec/cli/yardoc_spec.rb +++ b/spec/cli/yardoc_spec.rb @@ -15,7 +15,7 @@ describe YARD::CLI::Yardoc do end it "should alias --main to the --readme flag" do - readme = File.join(File.dirname(__FILE__),'..','..','README.markdown') + readme = File.join(File.dirname(__FILE__),'..','..','README.md') @yardoc.optparse('--main', readme) @yardoc.options[:readme].should == readme.to_sym
Fix broken spec due to README being renamed
lsegal_yard
train
rb
bbbbf83fd5ba1eacde875f06309c32e34a5914c0
diff --git a/lib/textbringer/modes/ruby_mode.rb b/lib/textbringer/modes/ruby_mode.rb index <HASH>..<HASH> 100644 --- a/lib/textbringer/modes/ruby_mode.rb +++ b/lib/textbringer/modes/ruby_mode.rb @@ -27,7 +27,7 @@ module Textbringer /x define_syntax :string, / - (?: (?<! [a-zA-Z] ) \? . ) | + (?: (?<! [a-zA-Z] ) \? \S ) | (?: %[qQrwWsix]?\{ (?: [^\\}] | \\ . )* \} ) | (?: %[qQrwWsix]?\( (?: [^\\)] | \\ . )* \) ) | (?: %[qQrwWsix]?\[ (?: [^\\\]] | \\ . )* \] ) |
Character literals should not contain bare space.
shugo_textbringer
train
rb
b90c5dc3abd9b5d8ad7d0f9e54f5647619fb4082
diff --git a/tensorflow_probability/python/distributions/gamma_gamma.py b/tensorflow_probability/python/distributions/gamma_gamma.py index <HASH>..<HASH> 100644 --- a/tensorflow_probability/python/distributions/gamma_gamma.py +++ b/tensorflow_probability/python/distributions/gamma_gamma.py @@ -163,8 +163,7 @@ class GammaGamma(tf.distributions.Distribution): def _batch_shape_tensor(self): return _dynamic_broadcast_shape_from_tensors( - self.frequency, self.concentration, self.mixing_concentration, - self.mixing_rate) + self.concentration, self.mixing_concentration, self.mixing_rate) def _batch_shape(self): return _static_broadcast_shape_from_tensors(
Remove the code to access the non-existent `frequency` property. PiperOrigin-RevId: <I>
tensorflow_probability
train
py
c60158a21a58dee6106628ddd44f7b63ec369412
diff --git a/indexing-service/src/main/java/io/druid/indexing/overlord/RemoteTaskRunner.java b/indexing-service/src/main/java/io/druid/indexing/overlord/RemoteTaskRunner.java index <HASH>..<HASH> 100644 --- a/indexing-service/src/main/java/io/druid/indexing/overlord/RemoteTaskRunner.java +++ b/indexing-service/src/main/java/io/druid/indexing/overlord/RemoteTaskRunner.java @@ -298,6 +298,7 @@ public class RemoteTaskRunner implements TaskRunner, TaskLogStreamer if (!started) { log.info("This TaskRunner is stopped. Ignoring shutdown command for task: %s", taskId); } else if (pendingTasks.remove(taskId) != null) { + pendingTaskPayloads.remove(taskId); log.info("Removed task from pending queue: %s", taskId); } else if (completeTasks.containsKey(taskId)) { cleanup(completeTasks.get(taskId).getWorker().getHost(), taskId);
RemoteTaskRunner: Remove task from pendingTaskPayloads on shutdown if needed
apache_incubator-druid
train
java
ab0e70403447455c392f9b04504c4bb67276ad59
diff --git a/assets/javascript/menu.js b/assets/javascript/menu.js index <HASH>..<HASH> 100644 --- a/assets/javascript/menu.js +++ b/assets/javascript/menu.js @@ -29,7 +29,7 @@ // Make the mobile menu button work $( '.js-mobile-menu' ).hide(); - $( '.js-mobile-menu-button' ).on( 'click', function( event ) { + $( '.js-mobile-menu-button' ).attr( 'href', '#' ).on( 'click', function( event ) { $( '.js-mobile-menu' ).slideToggle({ 'duration': 200 });
set menu button href to '#' via js to avoid reloading in customizer when clicked
GrottoPress_jentil
train
js
5e29fad47cc6066fb10c8680446a29cb4d89f3dd
diff --git a/m2bk/utils.py b/m2bk/utils.py index <HASH>..<HASH> 100644 --- a/m2bk/utils.py +++ b/m2bk/utils.py @@ -23,4 +23,7 @@ def chkstr(s, v): if type(s) != str: raise TypeError("{var} must be str".format(var=v)) if not s: - raise ValueError("{var} cannot be empty".format(var=v)) \ No newline at end of file + raise ValueError("{var} cannot be empty".format(var=v)) + +def debug(): + import pudb; pu.db
debug as a utility function using pudb
axltxl_m2bk
train
py
87574fc48488cca6697d2ab21ad276a4ade55463
diff --git a/src/Providers/FortServiceProvider.php b/src/Providers/FortServiceProvider.php index <HASH>..<HASH> 100644 --- a/src/Providers/FortServiceProvider.php +++ b/src/Providers/FortServiceProvider.php @@ -86,7 +86,7 @@ class FortServiceProvider extends ServiceProvider ! $this->app->runningInConsole() || $this->publishResources(); // Register attributes entities - app('rinvex.attributes.entities')->push(UserContract::class); + app('rinvex.attributes.entities')->push('user'); } /**
Register attribute entity by morph class alias
rinvex_cortex-auth
train
php
74c9cbdbdc2c941bbcb6ad1d7af5af6c4be80dd1
diff --git a/spec/git.spec.js b/spec/git.spec.js index <HASH>..<HASH> 100644 --- a/spec/git.spec.js +++ b/spec/git.spec.js @@ -83,8 +83,25 @@ describe("git", function() { }); }); - it("should be able to push to the origin remote", function(done) { - git.getRemote("origin").flatMapLatest(_.partialRight(git.push, "master")).subscribe(function(event) { + it("should not push to the origin remote if the remote is up-to-date", function(done) { + var s_push = git.getRemote("origin").flatMapLatest(function(remote) { + return git.push(remote, "master", git.getCommitId("master"), false); + }); + + s_push.subscribe(function(event) { + expect(event.hasValue()).toBe(false); + done(); + + return Bacon.noMore; + }); + }); + + it("should push to the origin remote", function(done) { + var s_push = git.getRemote("origin").flatMapLatest(function(remote) { + return git.push(remote, "master", Bacon.once("0000000000000000000000000000000000000000"), false); + }); + + s_push.subscribe(function(event) { expect(event.hasValue()).toBe(true); done();
Update tests for git push Now it pushes only if the remote is not up-to-date
CleverCloud_clever-tools
train
js
a1aa990fe6fb88456698e94f3ca6f5c713757f5d
diff --git a/gulpfile.js b/gulpfile.js index <HASH>..<HASH> 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -28,8 +28,8 @@ export async function lint() { /** Publishes the package in the registry. */ export async function publish() { - await exec("npm", ["publish"]); const {version} = JSON.parse(await readFile("package.json", "utf8")); + for (const registry of ["https://registry.npmjs.org", "https://npm.pkg.github.com"]) await exec("npm", ["publish", `--registry=${registry}`]); for (const command of [["tag"], ["push", "origin"]]) await exec("git", [...command, `v${version}`]); }
Publish the package on the GitHub registry [skip ci]
cedx_gulp-php-minify
train
js
30c87b96a91a0974c88511eb3309ce7be9f13836
diff --git a/cmd/bolosseum/main.go b/cmd/bolosseum/main.go index <HASH>..<HASH> 100644 --- a/cmd/bolosseum/main.go +++ b/cmd/bolosseum/main.go @@ -59,8 +59,13 @@ func getStupidIA(iaPath string) (stupidias.StupidIA, error) { } } -func getBot(botPath string) (bots.Bot, error) { +func getBot(botPath string, game games.Game) (bots.Bot, error) { logrus.Warnf("Getting bot %q", botPath) + + if botPath == "stupid" { + botPath = fmt.Sprintf("stupid://%s", game.Name()) + } + splt := strings.Split(botPath, "://") if len(splt) != 2 { return nil, fmt.Errorf("invalid bot path") @@ -132,7 +137,7 @@ func run(c *cli.Context) error { // initialize bots hasError := false for _, botPath := range args[1:] { - bot, err := getBot(botPath) + bot, err := getBot(botPath, game) if err != nil { hasError = true logrus.Errorf("Failed to initialize bot %q", bot)
Can now ust call 'stupid'
moul_bolosseum
train
go
0335d1bc4cad47fbe8f249a5b5e4f4ca199cf246
diff --git a/src/plugins/Multipart.js b/src/plugins/Multipart.js index <HASH>..<HASH> 100644 --- a/src/plugins/Multipart.js +++ b/src/plugins/Multipart.js @@ -62,7 +62,12 @@ export default class Multipart extends Plugin { this.core.log(`Download ${file.name} from ${file.uploadURL}`) return resolve(file) } else { - this.core.emitter.emit('core:upload-error', file.id) + // OPTION 1: return the full XHR object + this.core.emitter.emit('core:upload-error', file.id, xhr); + + // OPTION 2: return the payload of the XHR object + this.core.emitter.emit('core:upload-error', file.id, xhr.response); + return reject('Upload error') }
After an upload failure return information from the backend for being able of managing the error.
transloadit_uppy
train
js
5c345f6718d6e4fabcbca2d2430b642a2621dc8d
diff --git a/packages/vaex-core/vaex/dataframe.py b/packages/vaex-core/vaex/dataframe.py index <HASH>..<HASH> 100644 --- a/packages/vaex-core/vaex/dataframe.py +++ b/packages/vaex-core/vaex/dataframe.py @@ -4423,6 +4423,7 @@ class DataFrame(object): start, stop, step = item.start, item.stop, item.step start = start or 0 stop = stop or len(self) + stop = min(stop, len(self)) assert step in [None, 1] if self.filtered and start == 0: mask = self._selection_masks[FILTER_SELECTION_NAME] diff --git a/tests/slice_test.py b/tests/slice_test.py index <HASH>..<HASH> 100644 --- a/tests/slice_test.py +++ b/tests/slice_test.py @@ -36,3 +36,10 @@ def test_head_with_selection(): df = vaex.example() df.select(df.x > 0, name='test') df.head() + + +def test_slice_beyond_end(df_local): + df = df_local + df2 = df[:100] + assert df2.x.tolist() == df.x.tolist() + assert len(df[:100]) == len(df)
fix(core): slicing beyond the end of a dataframe should clip it Fixes #<I>
vaexio_vaex
train
py,py
462b494f721c341b13066dfa541274b9c945a715
diff --git a/udiskie/async_.py b/udiskie/async_.py index <HASH>..<HASH> 100644 --- a/udiskie/async_.py +++ b/udiskie/async_.py @@ -106,6 +106,9 @@ class Async: if not any(was_handled): print(formatted, file=sys.stderr) + def __await__(self): + return (yield self) + def to_coro(func): @wraps(func) @@ -147,6 +150,7 @@ class AsyncList(Async): if not tasks: run_soon(self.callback, []) for idx, task in enumerate(tasks): + task = ensure_future(task) task.callbacks.append(partial(self._subtask_result, idx)) task.errbacks.append(partial(self._subtask_error, idx)) @@ -211,6 +215,12 @@ def sleep(seconds): return future +def ensure_future(awaitable): + if isinstance(awaitable, Async): + return awaitable + return Coroutine(iter(awaitable.__await__())) + + class Coroutine(Async): """
Implement `async def` support This should make the our `async_` module mostly compatible with the new `async def` based udiskie code.
coldfix_udiskie
train
py
87f707880c749779b4e61c4f838f965b7ccc63c5
diff --git a/modules/cas/lib/Auth/Source/CAS.php b/modules/cas/lib/Auth/Source/CAS.php index <HASH>..<HASH> 100644 --- a/modules/cas/lib/Auth/Source/CAS.php +++ b/modules/cas/lib/Auth/Source/CAS.php @@ -151,7 +151,7 @@ class sspmod_cas_Auth_Source_CAS extends SimpleSAML_Auth_Source { * @param string $service * @return list username and attributes */ - private function casValidation($ticket, $service){ + protected function casValidation($ticket, $service){ switch($this->_validationMethod){ case 'validate': return $this->casValidate($ticket, $service);
cas: Make it easier to override finalStep() in subclasses. This patch makes it easier to override the finalStep()-function in subclasses by making sure that the casValidation()-function can be used from subclasses. Patch by Josselin Jacquard.
simplesamlphp_saml2
train
php
96003dd89bd6b236126d27e3b72013e3a3dd1a8a
diff --git a/lib/isono/node_modules/rpc_channel.rb b/lib/isono/node_modules/rpc_channel.rb index <HASH>..<HASH> 100644 --- a/lib/isono/node_modules/rpc_channel.rb +++ b/lib/isono/node_modules/rpc_channel.rb @@ -375,21 +375,6 @@ module Isono @table.dup.merge({:state=>self.state}) end - def on_success=(cb) - raise ArgumentError unless cb.is_a? Proc - @success_cb = cb - end - - def on_progress=(cb) - raise ArgumentError unless cb.is_a? Proc - @progress_cb = cb - end - - def on_error=(cb) - raise ArgumentError unless cb.is_a? Proc - @error_cb = cb - end - def on_success(&blk) raise ArgumentError unless blk @success_cb = blk
remove callback methods from RpcChannel::AsyncRequestContext as they were not used.
axsh_isono
train
rb
78b5fc3c7055043582e0b37bbcee6b6e0f0582d3
diff --git a/lib/excon/errors.rb b/lib/excon/errors.rb index <HASH>..<HASH> 100644 --- a/lib/excon/errors.rb +++ b/lib/excon/errors.rb @@ -126,7 +126,7 @@ module Excon # scrub authorization request = request.dup request.reject! {|key, value| [:connection, :stack].include?(key)} - if request[:headers].has_key?('Authorization') + if request.has_key?[:headers] && request[:headers].has_key?('Authorization') request[:headers] = request[:headers].dup request[:headers]['Authorization'] = REDACTED end
readd request headers guard to errors, needed for some mocks
excon_excon
train
rb
7f6f941a8091b24671a4b4b87ec42c8219fcbcb6
diff --git a/js/Swipeable.js b/js/Swipeable.js index <HASH>..<HASH> 100644 --- a/js/Swipeable.js +++ b/js/Swipeable.js @@ -86,7 +86,7 @@ var Swipeable = React.createClass({displayName: "Swipeable", } } } else { - if (pos.deltaY < 0) { + if (pos.deltaY > 0) { if (this.props.onSwipingUp) { this.props.onSwipingUp(e, pos.absY) cancelPageSwipe = true
Fixed "onSwipingUp" and "onSwipingDown" The directions were reversed in these two. "onSwipingUp" was getting called when a user was swiping down, and vice versa.
dogfessional_react-swipeable
train
js
b2211bca4160b2a21fd7f65fc11a038bc27e70d6
diff --git a/molgenis-core-ui/src/main/javascript/molgenis-global-webpack.js b/molgenis-core-ui/src/main/javascript/molgenis-global-webpack.js index <HASH>..<HASH> 100644 --- a/molgenis-core-ui/src/main/javascript/molgenis-global-webpack.js +++ b/molgenis-core-ui/src/main/javascript/molgenis-global-webpack.js @@ -9,6 +9,12 @@ import RestClientV2 from 'rest-client/RestClientV2'; window.top.molgenis.RestClient = RestClientV1; window.top.molgenis.RestClientV2 = RestClientV2; +import{ + createRsqlQuery +} from "rest-client/RestClientV2"; + +window.top.molgenis.createRsqlQuery = createRsqlQuery; + import { getAtomicAttributes, getCompoundAttributes,
Fix #<I> (#<I>)
molgenis_molgenis
train
js
dad1383c629e23ce0ac8649d37003ea8bcf17ca1
diff --git a/inspire_schemas/utils.py b/inspire_schemas/utils.py index <HASH>..<HASH> 100644 --- a/inspire_schemas/utils.py +++ b/inspire_schemas/utils.py @@ -318,11 +318,11 @@ def filter_empty_parameters(func): def func_wrapper(self, *args, **kwargs): my_kwargs = {key: value for key, value in kwargs.items() if value not in EMPTIES} - my_args = [arg for arg in args if arg not in EMPTIES] + args_is_empty = all(arg in EMPTIES for arg in args) if ( {'source', 'material'}.issuperset(my_kwargs) or not my_kwargs - ) and not my_args: + ) and args_is_empty: return return func(self, *args, **my_kwargs)
builders: use all instead of list comprehension
inspirehep_inspire-schemas
train
py
7c131afcf1d38dc17098cfd2e850068f976f82ea
diff --git a/lib/jets/commands/import/rail.rb b/lib/jets/commands/import/rail.rb index <HASH>..<HASH> 100644 --- a/lib/jets/commands/import/rail.rb +++ b/lib/jets/commands/import/rail.rb @@ -28,6 +28,13 @@ CODE end end + def copy_database_yaml + src = "#{Jets.root}config/database.yml" + dest = "#{Jets.root}rack/config/database.yml" + puts "Copying #{src} to #{dest}" + FileUtils.cp(src, dest) + end + def finish_message puts <<~EOL #{"="*30}
copy database.yml as part of import
tongueroo_jets
train
rb
d7986bc6c64ba169912419cadae1c2ac872b5e4b
diff --git a/tests/Config/ConfigTest.php b/tests/Config/ConfigTest.php index <HASH>..<HASH> 100644 --- a/tests/Config/ConfigTest.php +++ b/tests/Config/ConfigTest.php @@ -41,7 +41,7 @@ class ConfigTest extends \PHPUnit_Framework_TestCase { $config = new Config(); $config->loadCustomConfig(__DIR__); - $this->setExpectedException(\Exception::class); + $this->setExpectedException('Exception'); $config->path('phpcs.standard'); } }
Fix testing expected exception in php <I>
EdgedesignCZ_phpqa
train
php
75bb2d6e510a3c048a42ce673e9655fa779eacd5
diff --git a/src/event.js b/src/event.js index <HASH>..<HASH> 100644 --- a/src/event.js +++ b/src/event.js @@ -362,7 +362,7 @@ jQuery.event = { event.currentTarget = this; // Namespaced event handlers - all = event.type.indexOf(".") < 0; + all = event.type.indexOf(".") < 0 && !event.exclusive; if ( !all ) { namespaces = event.type.split("."); @@ -380,7 +380,7 @@ jQuery.event = { var handleObj = handlers[ j ]; // Filter the functions by class - if ( (all && !event.exclusive) || namespace.test( handleObj.namespace ) ) { + if ( all || namespace.test( handleObj.namespace ) ) { // Pass in a reference to the handler function itself // So that we can later remove it event.handler = handleObj.handler;
Fix in logic for handling exclusive namespace testing. Fixes #<I>.
jquery_jquery
train
js
0faed3abffffbd3018f0dac6261fa1b59000bfee
diff --git a/src/Guzzle/Http/ReadLimitEntityBody.php b/src/Guzzle/Http/ReadLimitEntityBody.php index <HASH>..<HASH> 100644 --- a/src/Guzzle/Http/ReadLimitEntityBody.php +++ b/src/Guzzle/Http/ReadLimitEntityBody.php @@ -35,7 +35,8 @@ class ReadLimitEntityBody extends AbstractEntityBodyDecorator public function isConsumed() { - return (($this->offset + $this->limit) - $this->body->ftell()) <= 0; + return $this->body->isConsumed() || + ($this->body->ftell() >= $this->offset + $this->limit); } /**
Adding a check to ensure that feof of ReadLimitEntityBody does not loop forever
guzzle_guzzle3
train
php
a48c2d84fa9606fe3b83ad95061672de54865e2e
diff --git a/tests/test_lock.py b/tests/test_lock.py index <HASH>..<HASH> 100644 --- a/tests/test_lock.py +++ b/tests/test_lock.py @@ -16,7 +16,7 @@ class TestLock(object): def test_lock(self, sr): lock = self.get_lock(sr, 'foo') assert lock.acquire(blocking=False) - assert sr.get('foo') == lock.token + assert sr.get('foo') == lock.local.token assert sr.ttl('foo') == -1 lock.release() assert sr.get('foo') is None @@ -56,7 +56,7 @@ class TestLock(object): # blocking_timeout prevents a deadlock if the lock can't be acquired # for some reason with self.get_lock(sr, 'foo', blocking_timeout=0.2) as lock: - assert sr.get('foo') == lock.token + assert sr.get('foo') == lock.local.token assert sr.get('foo') is None def test_high_sleep_raises_error(self, sr): @@ -77,7 +77,7 @@ class TestLock(object): with pytest.raises(LockError): lock.release() # even though we errored, the token is still cleared - assert lock.token is None + assert lock.local.token is None def test_extend_lock(self, sr): lock = self.get_lock(sr, 'foo', timeout=10)
lock tests: change lock.token to lock.local.token
andymccurdy_redis-py
train
py
946819e16ecd370b5a43f004980daaf8c6b752b8
diff --git a/cmd/prometheus/main.go b/cmd/prometheus/main.go index <HASH>..<HASH> 100644 --- a/cmd/prometheus/main.go +++ b/cmd/prometheus/main.go @@ -19,6 +19,7 @@ import ( "fmt" "io" "math" + "math/bits" "net" "net/http" _ "net/http/pprof" // Comment this line to disable pprof endpoint. @@ -344,6 +345,10 @@ func main() { klog.SetLogger(log.With(logger, "component", "k8s_client_runtime")) level.Info(logger).Log("msg", "Starting Prometheus", "version", version.Info()) + if bits.UintSize < 64 { + level.Warn(logger).Log("msg", "This Prometheus binary has not been compiled for a 64-bit architecture. Due to virtual memory constraints of 32-bit systems, it is highly recommended to switch to a 64-bit binary of Prometheus.", "GOARCH", runtime.GOARCH) + } + level.Info(logger).Log("build_context", version.BuildContext()) level.Info(logger).Log("host_details", prom_runtime.Uname()) level.Info(logger).Log("fd_limits", prom_runtime.FdLimits())
cmd/prometheus: Issue a warning on <I> bit archs (#<I>) * cmd/prometheus: Issue a warning on <I> bit archs
prometheus_prometheus
train
go
bb28f5da098815d201e2ec3973be5fd9e8f9e5c8
diff --git a/astrobase/cpserver/cps-assets/cpserver.js b/astrobase/cpserver/cps-assets/cpserver.js index <HASH>..<HASH> 100644 --- a/astrobase/cpserver/cps-assets/cpserver.js +++ b/astrobase/cpserver/cps-assets/cpserver.js @@ -1213,7 +1213,7 @@ var cpv = { var lspmethods = cpv.currcp.pfmethods; var ncols = lspmethods.length; - var colwidth = 12/ncols; + var colwidth = math.ceil(12/ncols); // zero out previous stuff $('.phased-container').empty();
cpserver.js: fix phased LC columns not working for an odd number of pfmethods
waqasbhatti_astrobase
train
js
14e9cbf2c5da35f8d9e00dc4e3c4f446c85be89c
diff --git a/cherrypy/process/plugins.py b/cherrypy/process/plugins.py index <HASH>..<HASH> 100644 --- a/cherrypy/process/plugins.py +++ b/cherrypy/process/plugins.py @@ -100,9 +100,15 @@ class SignalHandler(object): 'SIGHUP': self.handle_SIGHUP, 'SIGUSR1': self.bus.graceful, } - + + if sys.platform[:4] == 'java': + del self.handlers['SIGUSR1'] + self.handlers['SIGUSR2'] = self.bus.graceful + self.bus.log("SIGUSR1 cannot be set on the JVM platform. " + "Using SIGUSR2 instead.") + self._previous_handlers = {} - + def subscribe(self): """Subscribe self.handlers to signals.""" for sig, func in self.handlers.items():
#<I> on Jython, we attach the bus graceful operation to SIGUSR2 since SIGUSR1 cannot be set
cherrypy_cheroot
train
py
2e65e062e06b74081f081af04ff0e908d94abfdd
diff --git a/lib/trestle/version.rb b/lib/trestle/version.rb index <HASH>..<HASH> 100644 --- a/lib/trestle/version.rb +++ b/lib/trestle/version.rb @@ -1,3 +1,3 @@ module Trestle - VERSION = "0.8.11" + VERSION = "0.8.12" end
Increment version to <I>
TrestleAdmin_trestle
train
rb
d56261b223f41d69ba02a667f31209f4cc7dd655
diff --git a/glib/settings.go b/glib/settings.go index <HASH>..<HASH> 100644 --- a/glib/settings.go +++ b/glib/settings.go @@ -244,16 +244,14 @@ func (v *Settings) SetStrv(name string, values []string) bool { cstr1 := (*C.gchar)(C.CString(name)) defer C.free(unsafe.Pointer(cstr1)) - cvalues := C.make_strings(C.int(len(values) + 1)) - defer C.destroy_strings(cvalues) - + cvalues := make([]*C.gchar, len(values)) for i, accel := range values { - cstr := C.CString(accel) - defer C.free(unsafe.Pointer(cstr)) - C.set_string(cvalues, C.int(i), (*C.gchar)(cstr)) + cvalues[i] = (*C.gchar)(C.CString(accel)) + defer C.free(unsafe.Pointer(cvalues[i])) } - C.set_string(cvalues, C.int(len(values)), nil) - return gobool(C.g_settings_set_strv(v.native(), cstr1, cvalues)) + cvalues = append(cvalues, nil) + + return gobool(C.g_settings_set_strv(v.native(), cstr1, &cvalues[0])) } // SetEnum is a wrapper around g_settings_set_enum().
Added SetStrv to glib.settings (fixed)
gotk3_gotk3
train
go
159827faef2806b1858203deb79b23568438eb53
diff --git a/spec/api_spec.rb b/spec/api_spec.rb index <HASH>..<HASH> 100644 --- a/spec/api_spec.rb +++ b/spec/api_spec.rb @@ -1,6 +1,3 @@ -describe "precomputing rollups" do -end - describe "administration" do it "creates a database" it "adds a write key to a database"
Take out the precomputing rollups part
influxdata_influxdb
train
rb
e5ff5ad7e2d3b6d00c63fb3fe2426b2c715ce937
diff --git a/pyocd/__main__.py b/pyocd/__main__.py index <HASH>..<HASH> 100644 --- a/pyocd/__main__.py +++ b/pyocd/__main__.py @@ -334,9 +334,10 @@ class PyOCDTool(object): except KeyboardInterrupt: return 0 except exceptions.Error as e: - LOG.error(e, exc_info=Session.get_current().log_tracebacks) + LOG.critical(e, exc_info=Session.get_current().log_tracebacks) + return 1 except Exception as e: - LOG.error("uncaught exception: %s", e, exc_info=Session.get_current().log_tracebacks) + LOG.critical("uncaught exception: %s", e, exc_info=Session.get_current().log_tracebacks) return 1 def show_options_help(self):
pyocd tool logs fatal errors at critical level.
mbedmicro_pyOCD
train
py
f79a87b9e10dbb6c4eda19c5cf45a954f6e0219d
diff --git a/docs/conf.py b/docs/conf.py index <HASH>..<HASH> 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -48,7 +48,7 @@ copyright = u'2014, Google Inc.' # built documents. # # The short X.Y version. -version = '2.2' +version = '2.2-dev' # The full version, including alpha/beta/rc tags. release = version diff --git a/googlemaps/__init__.py b/googlemaps/__init__.py index <HASH>..<HASH> 100644 --- a/googlemaps/__init__.py +++ b/googlemaps/__init__.py @@ -15,7 +15,7 @@ # the License. # -__version__ = "2.2" +__version__ = "2.2-dev" from googlemaps.client import Client import googlemaps.exceptions diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -18,7 +18,7 @@ requirements = [ ] setup(name='googlemaps', - version='2.2', + version='2.2-dev', description='Python client library for Google Maps API Web Services', scripts=[], url='https://github.com/googlemaps/google-maps-services-python',
Start next dev version (<I>-dev)
googlemaps_google-maps-services-python
train
py,py,py
6c57c6c9edfec074f419b53af7a4fc06c17b0ad0
diff --git a/src/editor/Editor.js b/src/editor/Editor.js index <HASH>..<HASH> 100644 --- a/src/editor/Editor.js +++ b/src/editor/Editor.js @@ -61,8 +61,7 @@ define(function (require, exports, module) { "use strict"; - var EditorManager = require("editor/EditorManager"), - CodeHintManager = require("editor/CodeHintManager"), + var CodeHintManager = require("editor/CodeHintManager"), Commands = require("command/Commands"), CommandManager = require("command/CommandManager"), Menus = require("command/Menus"), @@ -604,7 +603,7 @@ define(function (require, exports, module) { // Convert CodeMirror onFocus events to EditorManager activeEditorChanged this._codeMirror.setOption("onFocus", function () { self._focused = true; - EditorManager._notifyActiveEditorChanged(self); + $(self).triggerHandler("focus", [self]); }); this._codeMirror.setOption("onBlur", function () {
Dispatching focus event and removed require
adobe_brackets
train
js
2b687d1aab7283730b2a650e89908e23dd8b881b
diff --git a/retrofit/src/main/java/retrofit/http/RestAdapter.java b/retrofit/src/main/java/retrofit/http/RestAdapter.java index <HASH>..<HASH> 100644 --- a/retrofit/src/main/java/retrofit/http/RestAdapter.java +++ b/retrofit/src/main/java/retrofit/http/RestAdapter.java @@ -100,6 +100,9 @@ public class RestAdapter { */ @SuppressWarnings("unchecked") public <T> T create(Class<T> type) { + if (!type.isInterface()) { + throw new IllegalArgumentException("Only interface endpoint definitions are supported."); + } return (T) Proxy.newProxyInstance(type.getClassLoader(), new Class<?>[] { type }, new RestHandler(type)); }
Ensure endpoint definition Class is an interface.
square_retrofit
train
java
ed97590ef21068977d625a2625e5b1df227b4247
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index <HASH>..<HASH> 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,9 +1,11 @@ + # Configure Rails Envinronment ENV["RAILS_ENV"] = "test" require File.expand_path("../dummy/config/environment.rb", __FILE__) require 'rspec/rails' + ENGINE_RAILS_ROOT=File.join(File.dirname(__FILE__), '../') # Requires supporting ruby files with custom matchers and macros, etc, @@ -16,7 +18,7 @@ RSpec.configure do |config| Disclosure.configuration.owner_class = "User" end - config.before(:all) do + config.before(:each) do class Disclosure::Issue def self.notifiable_actions ["created", "closed"] @@ -40,8 +42,8 @@ RSpec.configure do |config| end class Disclosure::TestReactor; end - Disclosure.configuration.notifier_classes << Disclosure::Issue - Disclosure.configuration.reactor_classes << Disclosure::TestReactor + Disclosure.configuration.notifier_classes = [Disclosure::Issue] + Disclosure.configuration.reactor_classes = [Disclosure::TestReactor] Disclosure.bootstrap! end end \ No newline at end of file
Set up test class on every spec run to ensure clean slate
joshmcarthur_disclosure
train
rb
d1a3fdfe4a594ef6a99aa4fb64db7fd3caec184c
diff --git a/pylint/checkers/spelling.py b/pylint/checkers/spelling.py index <HASH>..<HASH> 100644 --- a/pylint/checkers/spelling.py +++ b/pylint/checkers/spelling.py @@ -291,7 +291,7 @@ class SpellingChecker(BaseTokenChecker): initial_space = re.search(r"^[^\S]\s*", line).regs[0][1] except (IndexError, AttributeError): initial_space = 0 - if line.strip().startswith("#"): + if line.strip().startswith("#") and "docstring" not in msgid: line = line.strip()[1:] starts_with_comment = True else:
Fix spell-checker crash on docstring lines that look like # comments
PyCQA_pylint
train
py
d53f13cb94387531e08238afd28a746e3d60daa8
diff --git a/lib/sidekiq/batch/callback.rb b/lib/sidekiq/batch/callback.rb index <HASH>..<HASH> 100644 --- a/lib/sidekiq/batch/callback.rb +++ b/lib/sidekiq/batch/callback.rb @@ -5,6 +5,7 @@ module Sidekiq include Sidekiq::Worker def perform(clazz, event, opts, bid) + return unless %w(success complete).include?(event) clazz, method = clazz.split("#") if (clazz.class == String && clazz.include?("#")) method = "on_#{event}" if method.nil? clazz.constantize.new.send(method, Sidekiq::Batch::Status.new(bid), opts) rescue nil
Re-added a little evaluation just to be safe
breamware_sidekiq-batch
train
rb
25e7568d9656bdd47aa326094c1e6325251bd66e
diff --git a/src/Message/RapidResponse.php b/src/Message/RapidResponse.php index <HASH>..<HASH> 100644 --- a/src/Message/RapidResponse.php +++ b/src/Message/RapidResponse.php @@ -64,7 +64,22 @@ class RapidResponse extends AbstractResponse implements RedirectResponseInterfac } /** + * Get the transaction ID as generated by the merchant website. + * + * @return string + */ + public function getTransactionId() + { + return $this->data['InvoiceNumber']; + } + + /** * Get InvoiceNumber - merchant reference for a transaction + * + * @deprecated Omnipay standard interface is to return this when getTransactionId + * is called + * + * @see https://github.com/thephpleague/omnipay#successful-response */ public function getInvoiceNumber() {
Add getTransactionId function. eWay has a function to retrieve the merchant (originating website) generated ID but it should implement the standardised Omnipay one per <URL>; // the reference set by the originating website if available.
thephpleague_omnipay-eway
train
php
e3d281f9be83e8a75f2ef806ec3df992c3cde8c2
diff --git a/src/App/Http/Traits/UserAgentDetails.php b/src/App/Http/Traits/UserAgentDetails.php index <HASH>..<HASH> 100644 --- a/src/App/Http/Traits/UserAgentDetails.php +++ b/src/App/Http/Traits/UserAgentDetails.php @@ -102,7 +102,7 @@ trait UserAgentDetails } $a = explode(',', $locale); - $a ??= explode(';', $a[1]); + $a = $a ?? explode(';', $a[1]); return $a[0]; }
Compatibility PHP <I>; remove null coalescing assignment operator use.
jeremykenedy_laravel-logger
train
php
fc59188cfcf8bac9b06619e1dbd7b68d26dc8420
diff --git a/src/lib/device.js b/src/lib/device.js index <HASH>..<HASH> 100644 --- a/src/lib/device.js +++ b/src/lib/device.js @@ -79,7 +79,7 @@ export function isAndroidWebview(ua? : string = getUserAgent()) : boolean { } export function isIE() : boolean { - + if (window.document.documentMode) { return true; } @@ -102,27 +102,29 @@ export function isIECompHeader() : boolean { export function isIEIntranet() : boolean { - if (!isIE()) { - return false; - } + // This status check only works for older versions of IE with document.documentMode set - try { - let status = window.status; + if (window.document.documentMode) { + try { + let status = window.status; - window.status = 'testIntranetMode'; + window.status = 'testIntranetMode'; - if (window.status === 'testIntranetMode') { - window.status = status; + if (window.status === 'testIntranetMode') { + window.status = status; - return true; - } + return true; + } - return false; + return false; - } catch (err) { + } catch (err) { - return false; + return false; + } } + + return false; } export function supportsPopups(ua? : string = getUserAgent()) : boolean {
Fix intranet check to only apply to older IE versions
paypal_paypal-checkout-components
train
js
d72cfb51eab7a1f66f186900d1e2d533a822c424
diff --git a/Form/Admin/OrderStatusFormBuilder.php b/Form/Admin/OrderStatusFormBuilder.php index <HASH>..<HASH> 100644 --- a/Form/Admin/OrderStatusFormBuilder.php +++ b/Form/Admin/OrderStatusFormBuilder.php @@ -40,10 +40,10 @@ class OrderStatusFormBuilder extends AbstractFormBuilder 'default' => 1 ])); - $requiredData->addChild($this->getElement('text_field', [ + $requiredData->addChild($this->getElement('colour_picker', [ 'name' => 'colour', 'label' => 'order_status.label.colour', - 'default' => '#000' + 'default' => '000000' ])); $orderStatusGroups = $this->get('order_status_group.dataset.admin')->getResult('select');
Added ColourPicker form component
WellCommerce_OrderBundle
train
php
1a025f2b2830b2e239498680bd7166c0270d36d5
diff --git a/script/wee.js b/script/wee.js index <HASH>..<HASH> 100644 --- a/script/wee.js +++ b/script/wee.js @@ -14,6 +14,7 @@ observe = {}, refs = {}, env, + range, /** * Determine data storage root and key @@ -534,7 +535,7 @@ var pre = selector[0]; if (pre == '#') { - el = context.getElementById(selector.substr(1)); + el = D.getElementById(selector.substr(1)); } else if (pre == '.') { el = W._legacy ? context.querySelectorAll(selector) : @@ -572,13 +573,13 @@ $parseHTML: function(html) { var el; - if (! W._range && ! W._legacy) { - W._range = D.createRange(); - W._range.selectNode(W._body); + if (! range && ! W._legacy) { + range = D.createRange(); + range.selectNode(W._body); } - if (W._range && W._range.createContextualFragment) { - el = W._range.createContextualFragment(html); + if (range && range.createContextualFragment) { + el = range.createContextualFragment(html); } else { var div = D.createElement('div'), child;
Cache range instance locally Always use the document as the context for getElementById selections
weepower_wee-core
train
js
48c2ab989d99d10107bb27fa13f04e5f453b026e
diff --git a/code/controllers/SuccessController.php b/code/controllers/SuccessController.php index <HASH>..<HASH> 100644 --- a/code/controllers/SuccessController.php +++ b/code/controllers/SuccessController.php @@ -97,7 +97,11 @@ class SuccessController extends CheckoutStepController */ public function sendNotification() { - if (empty($to = self::config()->get('ticket_mail_sender'))) { + if (empty($from = self::config()->get('ticket_mail_sender'))) { + $from = Config::inst()->get('Email', 'admin_email'); + } + + if (empty($to = self::config()->get('mail_reciever'))) { $to = Config::inst()->get('Email', 'admin_email'); } @@ -107,7 +111,7 @@ class SuccessController extends CheckoutStepController 'New ticket order {order}', null, array('order' => $this->reservation->ReservationCode) )); - $email->setFrom($to); + $email->setFrom($from); $email->setTo($to); $email->setTemplate('NotificationMail'); $email->populateTemplate($this->reservation->getViewableData());
added configurable from and to notification mail addresses
TheBnl_event-tickets
train
php
ebe3eb6052dc4a2fe31dbf088e0b72fde9c9bd9e
diff --git a/lib/socket.js b/lib/socket.js index <HASH>..<HASH> 100644 --- a/lib/socket.js +++ b/lib/socket.js @@ -79,7 +79,7 @@ Socket.prototype.createTransport = function (name, queryParams) { , path: this.path , query: query , forceJSONP: this.forceJSONP - }, engine); + }); return transport; };
Removed engine refernece passed to transport constructor.
socketio_engine.io-client
train
js
5e4b8d6fbcb1123dc957a786b9b9e8f6fbc046cf
diff --git a/klein.php b/klein.php index <HASH>..<HASH> 100644 --- a/klein.php +++ b/klein.php @@ -203,10 +203,13 @@ function dispatch($uri = null, $req_method = null, array $params = null, $captur * service by $key. Its like a lazy registry $closure is * evalueted only once on first service request */ -function service($key, $closure = null) { +function service($key, Closure $closure = null) { static $services = array(); - if ($closure instanceof Closure) { + if (null !== $closure) { // store a service + if (isset($services[$key])) { + throw new RuntimeException("Service is allready registered under name: {$key}, to avoid complications it cannot be overwritten"); + } $services[$key] = function() use ($closure) { static $instance; if (null === $instance) { @@ -220,7 +223,7 @@ function service($key, $closure = null) { return $services[$key](); } // invalid service key or closure argument - throw new InvalidArgumentException("Service was not found by key [$key] or callback wrapping service is not a closure"); + throw new InvalidArgumentException("There is no service registered under name: [$key]"); } //Compiles a route string to a regular expression
use a closure typehint for service method and do not allow to overwrite
klein_klein.php
train
php
a2845b0c59378905e9d731f89f0e6da113ac0579
diff --git a/fuzzyfinder/main.py b/fuzzyfinder/main.py index <HASH>..<HASH> 100755 --- a/fuzzyfinder/main.py +++ b/fuzzyfinder/main.py @@ -17,7 +17,7 @@ def fuzzyfinder(input, collection, accessor=lambda x: x): suggestions = [] input = str(input) if not isinstance(input, str) else input pat = '.*?'.join(map(re.escape, input)) - pat = '(?=({}))'.format(pat) # lookahead regex to manage overlapping matches + pat = '(?=({0}))'.format(pat) # lookahead regex to manage overlapping matches regex = re.compile(pat, re.IGNORECASE) for item in collection: r = list(regex.finditer(accessor(item)))
fix compatibility issue with python <I>
amjith_fuzzyfinder
train
py
19df50e02d6599ea092f626832dea86f2fc85726
diff --git a/rpg2d/sim.go b/rpg2d/sim.go index <HASH>..<HASH> 100644 --- a/rpg2d/sim.go +++ b/rpg2d/sim.go @@ -152,7 +152,15 @@ func (s *runningSimulation) startLoop() { gameLoop: for { - // TODO Implement a prioritized select for ticker.C and haltReq + // Prioritized select for ticker.C and haltReq + select { + case <-ticker.C: + // TODO Step the simulation forward in time + + case hasHalted = <-haltReq: + break gameLoop + default: + } select { case <-ticker.C:
Prioritize ticking and halting in the game loop
ghthor_filu
train
go
9d89a9493251ab06941293f1c8b268f38784046b
diff --git a/hack/e2e.go b/hack/e2e.go index <HASH>..<HASH> 100644 --- a/hack/e2e.go +++ b/hack/e2e.go @@ -44,6 +44,10 @@ var ( "By default, verify that client and server have exact version match. "+ "You can explicitly set to false if you're, e.g., testing client changes "+ "for which the server version doesn't make a difference.") + checkNodeCount = flag.Bool("check_node_count", true, ""+ + "By default, verify that the cluster has at least two nodes."+ + "You can explicitly set to false if you're, e.g., testing single-node clusters "+ + "for which the node count is supposed to be one.") ctlCmd = flag.String("ctl", "", "If nonempty, pass this as an argument, and call kubectl. Implies -v. (-test, -cfg, -ctl are mutually exclusive)") ) @@ -181,7 +185,9 @@ func Test() bool { log.Fatal("Testing requested, but e2e cluster not up!") } - ValidateClusterSize() + if *checkNodeCount { + ValidateClusterSize() + } return finishRunning("Ginkgo tests", exec.Command(filepath.Join(*root, "hack/ginkgo-e2e.sh"), strings.Fields(*testArgs)...)) }
Add a flag that lets e2e tests be run against single-node clusters.
kubernetes_test-infra
train
go
379942d489d1bbbd391c9144d90d77398d8ca5c8
diff --git a/backend/undo.go b/backend/undo.go index <HASH>..<HASH> 100644 --- a/backend/undo.go +++ b/backend/undo.go @@ -80,6 +80,9 @@ func (us *UndoStack) GlueFrom(mark int) { name string args Args } + e.v = us.actions[mark].v + e.savedSel.AddAll(us.actions[mark].savedSel.Regions()) + entries := make([]entry, us.position-mark) for i := range entries { a := us.actions[i+mark]
Fixed UndoStack.GlueFrom. More termbox keypress mappings
limetext_backend
train
go
572befbcf2135c0655450ff54406aa0e1cdc6522
diff --git a/grade/edit/tree/category_form.php b/grade/edit/tree/category_form.php index <HASH>..<HASH> 100644 --- a/grade/edit/tree/category_form.php +++ b/grade/edit/tree/category_form.php @@ -439,6 +439,21 @@ class edit_category_form extends moodleform { } } } + +/// perform extra validation before submission + function validation($data, $files) { + global $COURSE; + + $errors = parent::validation($data, $files); + + if (array_key_exists('grade_item_gradetype', $data) and $data['grade_item_gradetype'] == GRADE_TYPE_SCALE) { + if (empty($data['grade_item_scaleid'])) { + $errors['grade_item_scaleid'] = get_string('missingscale', 'grades'); + } + } + + return $errors; + } } ?>
MDL-<I> scale selection validated on category edit form; merged from MOODLE_<I>_STABLE
moodle_moodle
train
php
66c39482f7b70e2814b361cc95df112b71b50377
diff --git a/src/Codeception/PHPUnit/ResultPrinter/HTML.php b/src/Codeception/PHPUnit/ResultPrinter/HTML.php index <HASH>..<HASH> 100644 --- a/src/Codeception/PHPUnit/ResultPrinter/HTML.php +++ b/src/Codeception/PHPUnit/ResultPrinter/HTML.php @@ -220,8 +220,8 @@ class HTML extends CodeceptionResultPrinter /** * A failure occurred. * - * @param PHPUnit_Framework_Test $test - * @param PHPUnit_Framework_AssertionFailedError $e + * @param \PHPUnit_Framework_Test $test + * @param \PHPUnit_Framework_AssertionFailedError $e * @param float $time */ public function addFailure(\PHPUnit_Framework_Test $test, \PHPUnit_Framework_AssertionFailedError $e, $time)
Fix NS usage in PHPDoc block (#<I>) [skip ci]
Codeception_base
train
php
8c3c694c5ada7884be80a9b17ed563a7e6275a4d
diff --git a/src/Exceptions/tests/HandlerTest.php b/src/Exceptions/tests/HandlerTest.php index <HASH>..<HASH> 100644 --- a/src/Exceptions/tests/HandlerTest.php +++ b/src/Exceptions/tests/HandlerTest.php @@ -164,6 +164,8 @@ class HandlerTest extends TestCase public function testHtmlHandlerDefaultDebug(): void { + $this->markTestSkipped('Temporary skipped (x2)'); + $handler = new HtmlHandler(HtmlHandler::DEFAULT); $result = $handler->renderException(new Error(
Debug of the test on which the CI breaks
spiral_security
train
php
6d4f65e20d5083b186e931745d04bfe92d5c22d1
diff --git a/lib/spring/server.rb b/lib/spring/server.rb index <HASH>..<HASH> 100644 --- a/lib/spring/server.rb +++ b/lib/spring/server.rb @@ -63,7 +63,7 @@ module Spring @pidfile.write("#{Process.pid}\n") @pidfile.fsync else - STDERR.puts "#{@pidfile.path} is locked; it looks like a server is already running" + $stderr.puts "#{@pidfile.path} is locked; it looks like a server is already running" exit 1 end end @@ -77,9 +77,14 @@ module Spring # there are exceptions etc, so we just open the current terminal # device directly. def redirect_output - tty = open(`tty`.chomp, "a") # ruby doesn't expose ttyname() - STDOUT.reopen(tty) - STDERR.reopen(tty) + if STDIN.tty? + tty = open(`tty`.chomp, "a") # ruby doesn't expose ttyname() + STDOUT.reopen(tty) + STDERR.reopen(tty) + else + $stderr.puts "Spring must be run in a terminal (stdin is not a tty)" + exit 1 + end end end end
Check that STDIN is a tty
rails_spring
train
rb
90671c3f53a45904a4b44843c843538f716dace8
diff --git a/Tree/Leaf.php b/Tree/Leaf.php index <HASH>..<HASH> 100644 --- a/Tree/Leaf.php +++ b/Tree/Leaf.php @@ -127,7 +127,7 @@ class Leaf implements LeafInterface public function append(LeafInterface $child) { - $this->getParent()->insertBefore($this, $child); + $this->getParent()->insertAfter($this, $child); return $this; } @@ -139,7 +139,7 @@ class Leaf implements LeafInterface public function prepend(LeafInterface $child) { - $this->getParent()->insertAfter($this, $child); + $this->getParent()->insertBefore($this, $child); return $this; }
Fixed switched append/prepend
Talesoft_tale-tree
train
php
1e4b00370128149cffd696d866507053a1763a14
diff --git a/openquake/baselib/performance.py b/openquake/baselib/performance.py index <HASH>..<HASH> 100644 --- a/openquake/baselib/performance.py +++ b/openquake/baselib/performance.py @@ -185,7 +185,7 @@ class Monitor(object): operation, time, memory = line.split('\t') data[operation] += numpy.array( [float(time), float(memory), 1]) - perf_dt = numpy.dtype([('operation', (str, 50)), ('time_sec', float), + perf_dt = numpy.dtype([('operation', (bytes, 50)), ('time_sec', float), ('memory_mb', float), ('counts', int)]) rows = [] for operation, rec in data.items():
Trivial change str -> bytes
gem_oq-engine
train
py
1895a0a19dc94b9c351fd6af63cdfce2b40fcfc2
diff --git a/structr-ui/src/main/resources/structr/js/dashboard.js b/structr-ui/src/main/resources/structr/js/dashboard.js index <HASH>..<HASH> 100644 --- a/structr-ui/src/main/resources/structr/js/dashboard.js +++ b/structr-ui/src/main/resources/structr/js/dashboard.js @@ -41,7 +41,9 @@ var _Dashboard = { let tabId = LSWrapper.getItem(_Dashboard.activeTabPrefixKey); if (tabId) { let tab = document.querySelector('#dashboard .tabs-menu li a[href="' + tabId + '"]'); - tab.click(); + if (tab) { + tab.click(); + } } }, onload: function(retryCount = 0) {
Bugfix: Prevent javascript error for removed tabs
structr_structr
train
js
2047da05ed518b28e8a19b8812fb2ffe95dd9572
diff --git a/core/charm/computedseries.go b/core/charm/computedseries.go index <HASH>..<HASH> 100644 --- a/core/charm/computedseries.go +++ b/core/charm/computedseries.go @@ -23,7 +23,7 @@ func ComputedSeries(c charm.CharmMeta) ([]string, error) { // If we have V2 metadata *and* a non-empty containers collection, // then this is a side-car based charm and we return "kubernetes" // instead of translating the collection of supplied bases. - if len(c.Meta().Containers) > 0 { + if IsKubernetes(c) { return []string{coreseries.Kubernetes.String()}, nil }
Use IsKubernetes instead of computing locally
juju_juju
train
go
7bfeb3797d9631a94c29686b6067c9c400f8c077
diff --git a/src/sos/workflow_executor.py b/src/sos/workflow_executor.py index <HASH>..<HASH> 100755 --- a/src/sos/workflow_executor.py +++ b/src/sos/workflow_executor.py @@ -503,10 +503,10 @@ class Base_Executor: elif not isinstance(patterns, (sos_targets, Sequence, paths)): raise RuntimeError( f'Unknown target to match: {patterns} of type {patterns.__class__.__name__}') - for p in patterns: # other targets has to match exactly - if not isinstance(target, (str, file_target)): + if not isinstance(target, (str, file_target)) or \ + not isinstance(p, (str, file_target)): if target == p: return {} else: diff --git a/test/test_target.py b/test/test_target.py index <HASH>..<HASH> 100644 --- a/test/test_target.py +++ b/test/test_target.py @@ -292,9 +292,9 @@ run: expand=True [work_2] input: "1.txt", "2.txt", group_by = 'single', for_each = 'data, data', pattern = '{name}.{ext}' -output: expand_pattern('{_name}.out2') +output: expand_pattern('{_data}_{_name}.out2') run: expand=True - touch {_data} {_output} + touch {_output} ''') wf = script.workflow()
Fix a test on expand_pattern
vatlab_SoS
train
py,py
38608a778aa0c2fa2ea3985e439a23aedcad8cf2
diff --git a/gameq/protocols/stalker.php b/gameq/protocols/stalker.php index <HASH>..<HASH> 100644 --- a/gameq/protocols/stalker.php +++ b/gameq/protocols/stalker.php @@ -21,7 +21,7 @@ * * @author Austin Bischoff <austin@codebeard.com> */ -class GameQ_Protocols_Stalker extends GameQ_Protocols_Gamespy3 +class GameQ_Protocols_Stalker extends GameQ_Protocols_Gamespy2 { protected $name = "stalker"; protected $name_long = "S.T.A.L.K.E.R: Shadow of Chernobyl";
Stalker is actually gamespy2 (not gamespy3 as v1 had stated). Fixes #<I>
Austinb_GameQ
train
php