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
959c1529217ec006bf7a6d8e45c6e4f536efb866
diff --git a/debug/local.debug.moonshine.js b/debug/local.debug.moonshine.js index <HASH>..<HASH> 100644 --- a/debug/local.debug.moonshine.js +++ b/debug/local.debug.moonshine.js @@ -30,14 +30,20 @@ shine.debug.ui = { iframe.style.overflow = 'hidden'; iframe.style.border = 'none'; - // window.addEventListener('load', function () { + + function append () { document.body.appendChild(iframe); iframe.contentWindow.addEventListener('load', function () { me._initIFrame(iframe); }); - // }); + } + if (document.body) { + append(); + } else { + window.addEventListener('load', append, false); + } }, @@ -79,13 +85,12 @@ shine.debug.ui = { iframe.contentDocument.querySelector('.buttons').appendChild(toggle); iframe.contentWindow.registerDebugEngine(shine.debug); shine.debug._clearLoadQueue(); - }, + } }; -// Give time for the ui to be overridden -window.addEventListener('load', function () { shine.debug.ui.init(); }); +shine.debug.ui.init();
Bugfix for loading remote debug UI before page loaded.
gamesys_moonshine
train
js
0c72d6183fc9b219ab7591bf9a455858064b6644
diff --git a/samples/call.rb b/samples/call.rb index <HASH>..<HASH> 100644 --- a/samples/call.rb +++ b/samples/call.rb @@ -8,9 +8,9 @@ print "> " to = STDIN.gets.strip call = Skype.call to -loop do + +while !call.talking? puts call.status - break if call.talking? sleep 1 end @@ -19,6 +19,6 @@ end sleep 1 end -call.hangup +call.hangup if call.talking? puts call.status
use Skype::Call.talking? in samples/call.rb
shokai_skype-ruby
train
rb
18880cde042c0c24d8204d7b34cfd14b803b478e
diff --git a/src/processor/intents/movement.js b/src/processor/intents/movement.js index <HASH>..<HASH> 100644 --- a/src/processor/intents/movement.js +++ b/src/processor/intents/movement.js @@ -99,7 +99,7 @@ exports.check = function(roomIsInSafeMode) { if(matrix[i].length > 1) { var rates = _.map(matrix[i], (object) => { - var moveBodyparts = _.filter(object.body, (i) => i.hits > 0 && i.type == C.MOVE).length, + var moves = utils.calcBodyEffectiveness(object.body, C.MOVE, 'fatigue', 1), weight = _.filter(object.body, (i) => i.type != C.MOVE && i.type != C.CARRY).length; weight += calcResourcesWeight(object); weight = weight || 1; @@ -111,11 +111,11 @@ exports.check = function(roomIsInSafeMode) { return { object, rate1, - rate2: moveBodyparts / weight + rate2: moves / weight }; }); - rates.sort((a,b) => b.rate1 - a.rate1 != 0 ? b.rate1 - a.rate1 : b.rate2 - a.rate2); + rates.sort((a,b) => b.rate1 - a.rate1 || b.rate2 - a.rate2); resultingMoveObject = rates[0].object; }
fix(processor): updated moves/weight ratio to consider boosts on move parts DEV-<I>
screeps_engine
train
js
23b4079dda21bde5587391d762c93f913063f0ed
diff --git a/openquake/hazardlib/gsim/projects/acme_2019.py b/openquake/hazardlib/gsim/projects/acme_2019.py index <HASH>..<HASH> 100644 --- a/openquake/hazardlib/gsim/projects/acme_2019.py +++ b/openquake/hazardlib/gsim/projects/acme_2019.py @@ -230,9 +230,8 @@ class AlAtikSigmaModel(GMPE): self.gmpe = registry[self.gmpe_name]() self.set_parameters() - if self.kappa_file is not None: - with self.open('kappa_file') as myfile: - self.data = myfile.read().decode('utf-8') + with self.open(self.kappa_file) as myfile: + self.data = myfile.read().decode('utf-8') def _setup_standard_deviations(self, fle): # setup tau
Merged from master [skip CI]
gem_oq-engine
train
py
73bb5851c8ae275a3143ee1b4925732dd0d43239
diff --git a/cmd/util.go b/cmd/util.go index <HASH>..<HASH> 100644 --- a/cmd/util.go +++ b/cmd/util.go @@ -71,7 +71,7 @@ func setCurrentEnv(name tokens.QName, verify bool) error { // displayEvents reads events from the `events` channel until it is closed, displaying each event as it comes in. // Once all events have been read from the channel and displayed, it closes the `done` channel so the caller can // await all the events being written. -func displayEvents(events chan engine.Event, done chan bool, debug bool) { +func displayEvents(events <-chan engine.Event, done chan bool, debug bool) { defer close(done) for event := range events {
Accept a receive-only channel in displayEvents.
pulumi_pulumi
train
go
b126ca0606ac5ae919972246ed69c01e00ac12d2
diff --git a/consensus/reactor.go b/consensus/reactor.go index <HASH>..<HASH> 100644 --- a/consensus/reactor.go +++ b/consensus/reactor.go @@ -671,7 +671,8 @@ OUTER_LOOP: } func (conR *ConsensusReactor) String() string { - return conR.StringIndented("") + // better not to access shared variables + return Fmt("ConsensusReactor") // conR.StringIndented("") } func (conR *ConsensusReactor) StringIndented(indent string) string {
consensus: no internal vars in reactor.String()
tendermint_tendermint
train
go
2851157632410b31f8ca9c3fe334fc480a170d01
diff --git a/app/models/message_state_machine.rb b/app/models/message_state_machine.rb index <HASH>..<HASH> 100644 --- a/app/models/message_state_machine.rb +++ b/app/models/message_state_machine.rb @@ -12,13 +12,16 @@ class MessageStateMachine before_transition(from: :pending, to: :read) do |message| message.read_at = Time.zone.now unless message.read_at + message.index! end before_transition(from: :unread, to: :read) do |message| message.read_at = Time.zone.now unless message.read_at + message.index! end before_transition(from: :read, to: :unread) do |message| message.read_at = nil + message.index! end end
updated index when a message is read next-l/enju_leaf#<I>
next-l_enju_message
train
rb
555c163d4d5a8f75a7b6b4df9c555fbbfd171ee3
diff --git a/djcelery/models.py b/djcelery/models.py index <HASH>..<HASH> 100644 --- a/djcelery/models.py +++ b/djcelery/models.py @@ -262,10 +262,8 @@ class TaskState(models.Model): name = models.CharField(_(u"name"), max_length=200, null=True, db_index=True) tstamp = models.DateTimeField(_(u"event received at"), db_index=True) - args = models.CharField(_(u"Arguments"), - max_length=200, null=True) - kwargs = models.CharField(_(u"Keyword arguments"), - max_length=200, null=True) + args = models.TextField(_(u"Arguments"), null=True) + kwargs = models.TextField(_(u"Keyword arguments"), null=True) eta = models.DateTimeField(_(u"ETA"), null=True, help_text=u"date to execute") expires = models.DateTimeField(_(u"expires"), null=True)
TaskState.args+kwargs should be TextField for long arguments. Closes #<I>. Thanks to tdcarrol
celery_django-celery
train
py
531c6f8a734418e984d743c858c6b4a1d9c26e80
diff --git a/config/src/main/config/portal/default/redbox/scripts/hkjobs/alerts.py b/config/src/main/config/portal/default/redbox/scripts/hkjobs/alerts.py index <HASH>..<HASH> 100644 --- a/config/src/main/config/portal/default/redbox/scripts/hkjobs/alerts.py +++ b/config/src/main/config/portal/default/redbox/scripts/hkjobs/alerts.py @@ -269,7 +269,14 @@ class AlertsData: excepted = False for node in xmlNodes: - text = node.getTextTrim() + try: + text = node.getTextTrim() + except: + try: + text = node.getValue().strip() + except: + text = node + if fieldString != "" and text != "": if excepted: exceptionString = "%s: '%s' (%s)" % (exceptions["fields"][field], text, field)
Partial fix for #<I> Only applied to old alerts. New alerts yet to be patched
redbox-mint_redbox
train
py
a6345c7cd8c41842d61902801e7bef9cacb0c2d5
diff --git a/pandas/core/reshape/tile.py b/pandas/core/reshape/tile.py index <HASH>..<HASH> 100644 --- a/pandas/core/reshape/tile.py +++ b/pandas/core/reshape/tile.py @@ -148,7 +148,7 @@ def qcut(x, q, labels=None, retbins=False, precision=3, duplicates='raise'): Parameters ---------- - x : ndarray or Series + x : 1d ndarray or Series q : integer or array of quantiles Number of quantiles. 10 for deciles, 4 for quartiles, etc. Alternately array of quantiles, e.g. [0, .25, .5, .75, 1.] for quartiles
Add requirement for a 1-dimensional ndarray in the `pd.qcut` docstring (#<I>)
pandas-dev_pandas
train
py
5173549829ff8f12809366036a2518a60087a1d5
diff --git a/Controller/StreamController.php b/Controller/StreamController.php index <HASH>..<HASH> 100644 --- a/Controller/StreamController.php +++ b/Controller/StreamController.php @@ -21,7 +21,10 @@ class StreamController extends Controller $content = $this->getContent($contentId); - return new Response($formatter->toString($content)); + $response = new Response($formatter->toString($content)); + $response->headers->set('Content-Type', 'application/xhtml+xml'); + + return $response; } /**
Handle application/xml headers
alexdebril_rss-atom-bundle
train
php
3b4cc575a691f75bd8bdb8bc6fd17538b44cd17d
diff --git a/lib/python/vdm/server/venv_starter.py b/lib/python/vdm/server/venv_starter.py index <HASH>..<HASH> 100644 --- a/lib/python/vdm/server/venv_starter.py +++ b/lib/python/vdm/server/venv_starter.py @@ -166,7 +166,7 @@ def _build_virtual_environment(venv_dir, version, packages): def main(arr): python = 'python' - args = [python, os.path.join(G.base_dir, 'bin/vdm')] + args = [python, os.path.join(G.base_dir, 'lib/python/vdm/vdmrunner.py')] if arr[0]['filepath'] is not None: args.append('-p' + str(arr[0]['filepath'])) if arr[0]['server'] is not None:
VDM-<I> Modified code to change the path of vdmrunner.py
VoltDB_voltdb
train
py
ad63a9d5ab14cf4657d35ed9f6ea91f6e5156ec8
diff --git a/src/main/java/com/ning/billing/recurly/RecurlyClient.java b/src/main/java/com/ning/billing/recurly/RecurlyClient.java index <HASH>..<HASH> 100644 --- a/src/main/java/com/ning/billing/recurly/RecurlyClient.java +++ b/src/main/java/com/ning/billing/recurly/RecurlyClient.java @@ -109,7 +109,7 @@ public class RecurlyClient { private static final Logger log = LoggerFactory.getLogger(RecurlyClient.class); public static final String RECURLY_DEBUG_KEY = "recurly.debug"; - public static final String RECURLY_API_VERSION = "2.19"; + public static final String RECURLY_API_VERSION = "2.20"; private static final String X_RATELIMIT_REMAINING_HEADER_NAME = "X-RateLimit-Remaining"; private static final String X_RECORDS_HEADER_NAME = "X-Records";
Bump to API version <I>
killbilling_recurly-java-library
train
java
6dcc6e190b92e5169387a635c7e2f38a534571a3
diff --git a/tests/CloudinaryWrapperTest.php b/tests/CloudinaryWrapperTest.php index <HASH>..<HASH> 100755 --- a/tests/CloudinaryWrapperTest.php +++ b/tests/CloudinaryWrapperTest.php @@ -1,4 +1,4 @@ -<?php +<?php namespace JD\Cloudder\Test; @@ -90,6 +90,7 @@ class CloudinaryWrapperTest extends \PHPUnit_Framework_TestCase { // given $filename = 'filename'; + $this->config->shouldReceive('get')->with('cloudder.scaling')->once()->andReturn(array()); $this->cloudinary->shouldReceive('cloudinary_url')->once()->with($filename, ['secure' => true]); // when
Fixing the tests for `showSecure()` by including the config defaults.
jrm2k6_cloudder
train
php
14cb2bf518f9714c20b7411775565ff2e73e8bb6
diff --git a/lib/writer.js b/lib/writer.js index <HASH>..<HASH> 100644 --- a/lib/writer.js +++ b/lib/writer.js @@ -87,8 +87,11 @@ class Writer { * @param {[type]} v [description] * @return {[type]} [description] */ - time(v) { + time(v, precision) { internal(this).time = v; + if (precision) { + this.precision = precision; + } return this; } /**
change the writer's time function for support precision
vicanso_influxdb-nodejs
train
js
c39177d7528d2fe425185d49a23cb8dcc32bb1a6
diff --git a/src/Contracts/OneToOneRelationRepository.php b/src/Contracts/OneToOneRelationRepository.php index <HASH>..<HASH> 100644 --- a/src/Contracts/OneToOneRelationRepository.php +++ b/src/Contracts/OneToOneRelationRepository.php @@ -4,7 +4,7 @@ namespace Ipunkt\LaravelJsonApi\Contracts; use Illuminate\Database\Eloquent\Model; -interface OneToOneRelationRepository extends RelatedRepository +interface OneToOneRelationRepository { /** * returns collection request
OneToOneRelationRepository does not need any related repository method
ipunkt_laravel-json-api
train
php
bdb1d802bcd84d94b2da80b86bbd030ceabb9763
diff --git a/lib/test.js b/lib/test.js index <HASH>..<HASH> 100644 --- a/lib/test.js +++ b/lib/test.js @@ -120,6 +120,8 @@ Test.prototype.sub = function (Class, extra, caller) { extra.buffered = ownOr(extra, 'buffered', true) else extra.buffered = ownOrEnv(extra, 'buffered', 'TAP_BUFFER', true) + + extra.bail = ownOr(extra, 'bail', this.bail) extra.parent = this extra.stack = stack.captureString(80, caller) var t = new Class(extra)
Inherit bailout results from parent test Otherwise some tests that spawn children fail in -b mode
tapjs_node-tap
train
js
f034c18546c1c4f0be5cf81c03514d99df9cd2e0
diff --git a/lib/puppet-lint/plugins/check_strings.rb b/lib/puppet-lint/plugins/check_strings.rb index <HASH>..<HASH> 100644 --- a/lib/puppet-lint/plugins/check_strings.rb +++ b/lib/puppet-lint/plugins/check_strings.rb @@ -4,7 +4,7 @@ class PuppetLint::Plugins::CheckStrings < PuppetLint::CheckPlugin data.each_line do |line| line_no += 1 line.match(/"([^\\"]|\\\\|\\")*"/).to_a.each do |s| - if s.start_with? '"' + if s.is_a? String and s.start_with? '"' variable_found = false s.scan(/.\$./) do |w| if w.start_with? '\\'
Check that the match data is a string, not nil. Closes #2
rodjek_puppet-lint
train
rb
afa66440239a233076bfa72653a493e6bf2a0f75
diff --git a/pages/db/seeds/pages.rb b/pages/db/seeds/pages.rb index <HASH>..<HASH> 100644 --- a/pages/db/seeds/pages.rb +++ b/pages/db/seeds/pages.rb @@ -1,5 +1,6 @@ module Refinery ::Refinery::Page.reset_column_information + ::Refinery::Page.translation_class.reset_column_information page_position = -1
Reset column information on pages' translation class when seeding.
refinery_refinerycms
train
rb
ecc0c4e4b4730e01874feb324ff01b1ce6b15343
diff --git a/test/e2e/storage/drivers/csi.go b/test/e2e/storage/drivers/csi.go index <HASH>..<HASH> 100644 --- a/test/e2e/storage/drivers/csi.go +++ b/test/e2e/storage/drivers/csi.go @@ -297,6 +297,7 @@ func InitGcePDCSIDriver(config testsuites.TestConfig) testsuites.TestDriver { testsuites.CapPersistence: true, testsuites.CapFsGroup: true, testsuites.CapExec: true, + testsuites.CapMultiPODs: true, }, Config: config, @@ -409,6 +410,7 @@ func InitGcePDExternalCSIDriver(config testsuites.TestConfig) testsuites.TestDri testsuites.CapPersistence: true, testsuites.CapFsGroup: true, testsuites.CapExec: true, + testsuites.CapMultiPODs: true, }, Config: config,
e2e/storage: enable concurrent writes for gcepd The driver should support multiple pods using the same volume on the same node.
kubernetes_kubernetes
train
go
e44d8f440055053ac6aa57b7a54c645d19da7ffb
diff --git a/src/Service/Service.php b/src/Service/Service.php index <HASH>..<HASH> 100644 --- a/src/Service/Service.php +++ b/src/Service/Service.php @@ -32,13 +32,13 @@ abstract class Service extends Resource * @throws Exception * @return array */ - protected function exec($params) + protected function exec($params, $method = 'GET') { $params = array_filter($params); - $response = $this->client->get($this->getEndpoint(), [ + $response = $this->client->send($this->client->createRequest($method, $this->getEndpoint(), [ 'query' => $params - ]); + ])); try { $json = $response->json(); @@ -46,7 +46,10 @@ abstract class Service extends Resource throw new Exception($e->getMessage(), 0, $e); } - $this->validateResponse($json); + // Because validateResponse() expects an array, we can only do so if the response body is not empty (which in some cases is a valid response), otherwise $json will be null. + if (strlen($response->getBody()) > 0) { + $this->validateResponse($json); + } return $json; }
Added Number/Buy, Number/Search and Number/Cancel services. Modified Service->exec() to allow specifying http method (these services require POST requests).
ConnectCorp_nexmo-client
train
php
55293777d65138c547f6b812660b5c884c9fab6f
diff --git a/elastic/__init__.py b/elastic/__init__.py index <HASH>..<HASH> 100644 --- a/elastic/__init__.py +++ b/elastic/__init__.py @@ -256,9 +256,9 @@ class Crystal(Atoms): '''Backward compatibility class. To be removed later.''' pass -class __Crystal: +class ElasticCrystal: ''' - Extension of standard ASE Atoms class designed to handle specifics of the + Mixin extension of standard ASE Atoms class designed to handle specifics of the crystalline materials. This code should, in principle, be folded into the Atoms class in the future. At this moment it is too early to think about it. Additionally there are some aspects of this code which may be difficult to @@ -639,10 +639,10 @@ class __Crystal: # Enhance the Atoms class by adding new capabilities -for k in __Crystal.__dict__ : +for k in ElasticCrystal.__dict__ : if k[:2]!='__' and k[-2:]!='__' : #print('Implanting', k) - setattr(Atoms, k, __Crystal.__dict__[k]) + setattr(Atoms, k, ElasticCrystal.__dict__[k]) # Atoms.__atoms_init__=Atoms.__init__ # Atoms.__init__=__Crystal.__crystal_init__
Shift __Crystal to ElasticCrystal to make functions visible.
jochym_Elastic
train
py
dc3ec3cb4b377557afb78fcd9ecd7043f90fd31c
diff --git a/test/units/forceutf8.js b/test/units/forceutf8.js index <HASH>..<HASH> 100644 --- a/test/units/forceutf8.js +++ b/test/units/forceutf8.js @@ -9,6 +9,7 @@ describe("Encoding", function() { }); }); it('should parse latin-1', function(done) { + setTimeout(5000); c.queue([{ uri: 'http://czyborra.com/charsets/iso8859.html', callback: function(error, result) {
sometimes timeout of <I>ms is exceeded
bda-research_node-crawler
train
js
e6893024c32e5d0a8e8c1be7a4f7b6ea6b2dbdc5
diff --git a/hypertools/plot/animate.py b/hypertools/plot/animate.py index <HASH>..<HASH> 100644 --- a/hypertools/plot/animate.py +++ b/hypertools/plot/animate.py @@ -82,7 +82,7 @@ def animated_plot(x, *args, **kwargs): plane_list.append(ax.plot_wireframe(Xs, Ys, Zs, rstride=1, cstride=1, color='black', linewidth=2)) return plane_list - def update_lines(num, data_lines, lines, trail_lines, cube_scale, tail_len=30, tail_style=':', speed=0.2): + def update_lines(num, data_lines, lines, trail_lines, cube_scale, tail_len=1000, tail_style=':', speed=0.2): if hasattr(update_lines, 'planes'): for plane in update_lines.planes: @@ -134,7 +134,7 @@ def animated_plot(x, *args, **kwargs): ax.legend(proxies,legend_data) # Creating the Animation object - line_ani = animation.FuncAnimation(fig, update_lines, 1000, fargs=(x, lines, trail, cube_scale), + line_ani = animation.FuncAnimation(fig, update_lines, x[0].shape[0], fargs=(x, lines, trail, cube_scale), interval=8, blit=False) if save: Writer = animation.writers['ffmpeg']
added frame length equal to length of dataset
ContextLab_hypertools
train
py
8c153563906ca388fdff21cd12facb1347b4af83
diff --git a/unrar/rarfile.py b/unrar/rarfile.py index <HASH>..<HASH> 100644 --- a/unrar/rarfile.py +++ b/unrar/rarfile.py @@ -95,9 +95,15 @@ class _ReadIntoMemory(object): def __init__(self): super(_ReadIntoMemory, self).__init__() self._data = None + self._missing_password = False def _callback(self, msg, user_data, p1, p2): - if msg == constants.UCM_PROCESSDATA: + if (msg == constants.UCM_NEEDPASSWORD or + msg == constants.UCM_NEEDPASSWORDW): + # This is a work around since libunrar doesn't + # properly return the error code when files are encrypted + self._missing_password = True + elif msg == constants.UCM_PROCESSDATA: if self._data is None: self._data = b('') chunk = (ctypes.c_char * p2).from_address(p1).raw @@ -105,6 +111,8 @@ class _ReadIntoMemory(object): return 1 def get_bytes(self): + if self._missing_password: + raise RuntimeError('File is encrypted, password required for extraction') return io.BytesIO(self._data)
This is a work-around to a bug/flaw in unrar lib where it won't return an ERAR_MISSING_PASSWORD when attempting to extract a file that is password protected. Current behavior would return an empty string, new bavior raises an exception
matiasb_python-unrar
train
py
6483f55733812ba9e780dc65cc7006c787545e0c
diff --git a/pkg/util/wsstream/stream.go b/pkg/util/wsstream/stream.go index <HASH>..<HASH> 100644 --- a/pkg/util/wsstream/stream.go +++ b/pkg/util/wsstream/stream.go @@ -20,6 +20,7 @@ import ( "encoding/base64" "io" "net/http" + "sync" "time" "golang.org/x/net/websocket" @@ -107,11 +108,28 @@ func (r *Reader) Copy(w http.ResponseWriter, req *http.Request) error { // handle implements a WebSocket handler. func (r *Reader) handle(ws *websocket.Conn) { + // Close the connection when the client requests it, or when we finish streaming, whichever happens first + closeConnOnce := &sync.Once{} + closeConn := func() { + closeConnOnce.Do(func() { + ws.Close() + }) + } + negotiated := ws.Config().Protocol r.selectedProtocol = negotiated[0] defer close(r.err) - defer ws.Close() - go IgnoreReceives(ws, r.timeout) + defer closeConn() + + go func() { + defer runtime.HandleCrash() + // This blocks until the connection is closed. + // Client should not send anything. + IgnoreReceives(ws, r.timeout) + // Once the client closes, we should also close + closeConn() + }() + r.err <- messageCopy(ws, r.r, !r.protocols[r.selectedProtocol].Binary, r.ping, r.timeout) }
Close websocket stream when client closes
kubernetes_kubernetes
train
go
93461c688b4641398f42f6cb39b27938eb2d8226
diff --git a/compiler/util.py b/compiler/util.py index <HASH>..<HASH> 100644 --- a/compiler/util.py +++ b/compiler/util.py @@ -23,7 +23,7 @@ import textwrap _SIMPLE_CHARS = set(string.digits + string.letters + string.punctuation) -_ESCAPES = {'\0': r'\0', '\t': r'\t', '\r': r'\r', '\n': r'\n', '"': r'\"'} +_ESCAPES = {'\t': r'\t', '\r': r'\r', '\n': r'\n', '"': r'\"'} class ParseError(Exception):
Remove \0 char from go strings since Go does not support it.
google_grumpy
train
py
eb6e996f097b23a6199504ecf9c33fd9568695ad
diff --git a/application/briefkasten/dropbox.py b/application/briefkasten/dropbox.py index <HASH>..<HASH> 100644 --- a/application/briefkasten/dropbox.py +++ b/application/briefkasten/dropbox.py @@ -185,7 +185,7 @@ class Dropbox(object): with open(fs_attachment_path, 'w') as fs_attachment: shutil.copyfileobj(attachment.file, fs_attachment) fs_attachment.close() - chmod(fs_attachment_path, 0660) + chmod(fs_attachment_path, 0o660) self.paths_created.append(fs_attachment_path) return sanitized_filename @@ -443,7 +443,7 @@ class Dropbox(object): fs_reply_path = join(fs_container, fs_name) with open(fs_reply_path, 'w') as fs_reply: fs_reply.write(message.encode('utf-8')) - chmod(fs_reply_path, 0660) + chmod(fs_reply_path, 0o660) self.paths_created.append(fs_reply_path) @property
Py3: fix octal notation
ZeitOnline_briefkasten
train
py
4bd9a51040b04fe84c74ec44e18c7621b7e12e48
diff --git a/test/Stagehand/TestRunner/Runner/PHPUnitRunnerTest.php b/test/Stagehand/TestRunner/Runner/PHPUnitRunnerTest.php index <HASH>..<HASH> 100644 --- a/test/Stagehand/TestRunner/Runner/PHPUnitRunnerTest.php +++ b/test/Stagehand/TestRunner/Runner/PHPUnitRunnerTest.php @@ -323,7 +323,7 @@ class Stagehand_TestRunner_Runner_PHPUnitRunnerTest extends Stagehand_TestRunner * @link http://redmine.piece-framework.com/issues/202 * @since Method available since Release 2.14.0 */ - public function configuresPHPUnitRuntimeEnvironmentByTheXmlConfigurationFile() + public function configuresPhpUnitRuntimeEnvironmentByTheXmlConfigurationFile() { $GLOBALS['STAGEHAND_TESTRUNNER_RUNNER_PHPUNITRUNNERTEST_bootstrapLoaded'] = false; $configDirectory = dirname(__FILE__) . DIRECTORY_SEPARATOR . basename(__FILE__, '.php');
Improved the name of a test case.
piece_stagehand-testrunner
train
php
2298c931e76481d7d99daf9f9ce130a095003dc2
diff --git a/cmd/minikube/cmd/start.go b/cmd/minikube/cmd/start.go index <HASH>..<HASH> 100644 --- a/cmd/minikube/cmd/start.go +++ b/cmd/minikube/cmd/start.go @@ -136,9 +136,10 @@ func runStart(cmd *cobra.Command, args []string) { cmdUtil.MaybeReportErrorAndExit(err) } + fmt.Println("Getting VM IP address...") ip, err := host.Driver.GetIP() if err != nil { - glog.Errorln("Error starting host: ", err) + glog.Errorln("Error getting VM IP address: ", err) cmdUtil.MaybeReportErrorAndExit(err) } kubernetesConfig := cluster.KubernetesConfig{
Add message before waiting for the VM IP address Retrieving the IP address depends on guest/host communication channels (e.g. KVP on Hyper-V) that might fail. This commit adds a message that can help the user in troubleshooting potential issues.
kubernetes_minikube
train
go
661a911a526200c52f9b6ecd46264fb80058ce68
diff --git a/docs/src/SidePanel/index.js b/docs/src/SidePanel/index.js index <HASH>..<HASH> 100644 --- a/docs/src/SidePanel/index.js +++ b/docs/src/SidePanel/index.js @@ -60,7 +60,7 @@ class SidePanelExample extends React.Component { <div className="container container-pod"> <h2 className="short-bottom">Side panels</h2> <p> - A side panel component that is hidden until opened by interaction. Useful for showing things that are useful only at certain times, such as a settings sidebar or specific item information. + A side panel component that is hidden until opened by interaction. Can be used for showing things that are useful only at certain times, such as a settings sidebar or specific item information. </p> <p> View component source <a href="https://github.com/mesosphere/reactjs-components/blob/master/src/SidePanel/SidePanelContents.js">here</a>.
Reword side panel intro a bit :pencil:
mesosphere_reactjs-components
train
js
5f8deafae6271c9bad791535ee310500f0ab049b
diff --git a/install.php b/install.php index <HASH>..<HASH> 100644 --- a/install.php +++ b/install.php @@ -290,14 +290,14 @@ if ($INSTALL['stage'] == DATABASE) { } if ($INSTALL['dbtype'] == 'mssql') { /// Check MSSQL extension is present - if (!extension_loaded('mssql')) { + if (!function_exists('mssql_connect')) { $errormsg = get_string('mssqlextensionisnotpresentinphp', 'install'); $nextstage = DATABASE; } } if ($INSTALL['dbtype'] == 'mssql_n') { /// Check MSSQL extension is present - if (!extension_loaded('mssql')) { + if (!function_exists('mssql_connect')) { $errormsg = get_string('mssqlextensionisnotpresentinphp', 'install'); $nextstage = DATABASE; }
Merged better mssql check from stable
moodle_moodle
train
php
dedbdf4c09bc2ae64327d307cce8b499716ce3c0
diff --git a/src/Config/Api/DataAccess.php b/src/Config/Api/DataAccess.php index <HASH>..<HASH> 100644 --- a/src/Config/Api/DataAccess.php +++ b/src/Config/Api/DataAccess.php @@ -129,10 +129,23 @@ class DataAccess implements IDataAccess { public function getFileInfo( PageConfig $pageConfig, array $files ): array { $batches = []; foreach ( $files as $name => $dims ) { + $txopts = []; + if ( isset( $dims['width'] ) && $dims['width'] !== null ) { + $txopts['width'] = $dims['width']; + if ( isset( $dims['page'] ) ) { + $txopts['page'] = $dims['page']; + } + } + if ( isset( $dims['height'] ) && $dims['height'] !== null ) { + $txopts['height'] = $dims['height']; + } + if ( isset( $dims['seek'] ) ) { + $txopts['thumbtime'] = $dims['seek']; + } $batches[] = [ 'action' => 'imageinfo', 'filename' => $name, - 'txopts' => $dims, + 'txopts' => $txopts, 'page' => $pageConfig->getTitle(), ]; }
Api/DataAccess.php: Fix imageinfo access call * This wasn't handling missing / null properties correctly. Port over code from lib/mw/Batcher.js * Fixes crashers in AddMediaInfo pass. Change-Id: If<I>f5b<I>df2fc<I>b1a<I>efbc0a9ff<I>b
wikimedia_parsoid
train
php
b5051b20f41cc8a273dc5e966d05be42fcdc7cb9
diff --git a/lib/bento_search.rb b/lib/bento_search.rb index <HASH>..<HASH> 100644 --- a/lib/bento_search.rb +++ b/lib/bento_search.rb @@ -1,4 +1,5 @@ require "bento_search/engine" +require 'bento_search/routes' require 'confstruct' module BentoSearch
require bento_search/routes on load so it's avail
jrochkind_bento_search
train
rb
8597c0f8794b7c8ba73b1274e282f6d9772a19d0
diff --git a/lib/solargraph/pin/block.rb b/lib/solargraph/pin/block.rb index <HASH>..<HASH> 100644 --- a/lib/solargraph/pin/block.rb +++ b/lib/solargraph/pin/block.rb @@ -1,7 +1,12 @@ module Solargraph module Pin class Block < Base + # The signature of the method that receives this block. + # + # @return [String] attr_reader :receiver + + # @return [Array<String>] attr_reader :parameters def initialize location, namespace, name, comments, receiver @@ -16,6 +21,11 @@ module Solargraph def parameters @parameters ||= [] end + + def nearly? other + return false unless super + receiver == other.receiver + end end end end
Pin::Block#nearly? checks receivers.
castwide_solargraph
train
rb
4599aa28a8bac7794dff7565ac1cf3d4d6a6bfbf
diff --git a/app/components/select-2.js b/app/components/select-2.js index <HASH>..<HASH> 100644 --- a/app/components/select-2.js +++ b/app/components/select-2.js @@ -51,7 +51,9 @@ var Select2Component = Ember.Component.extend({ include the description html if available). */ options.formatResult = function(item) { - if (!item) return; + if (!item) { + return; + } var id = get(item, "id"), text = get(item, "text"), @@ -73,7 +75,9 @@ var Select2Component = Ember.Component.extend({ produces shorter output by leaving out the description. */ options.formatSelection = function(item) { - if (!item) return; + if (!item) { + return; + } var text = get(item, "text"); @@ -108,7 +112,7 @@ var Select2Component = Ember.Component.extend({ results.push(item); } else if (filteredChildren.length) { // or it has children that matched the term - var result = $.extend({}, item, { children: filteredChildren }); + var result = Ember.$.extend({}, item, { children: filteredChildren }); results.push(result); } return results;
lints with ember-cli default jshint settings
iStefo_ember-select-2
train
js
b6b8facfd03654f3aa192c0fe6f3733566352248
diff --git a/core-bundle/src/Resources/contao/modules/ModuleArticle.php b/core-bundle/src/Resources/contao/modules/ModuleArticle.php index <HASH>..<HASH> 100644 --- a/core-bundle/src/Resources/contao/modules/ModuleArticle.php +++ b/core-bundle/src/Resources/contao/modules/ModuleArticle.php @@ -148,6 +148,11 @@ class ModuleArticle extends \Module if (!$this->blnNoMarkup && $strArticle != '' && ($strArticle == $this->id || $strArticle == $this->alias) && $this->title != '') { $objPage->pageTitle = strip_tags(strip_insert_tags($this->title)); + + if ($this->teaser != '') + { + $objPage->description = $this->prepareMetaDescription($this->teaser); + } } $this->Template->printable = false;
[Core] Override the page description if a certain article is requested (see #<I>)
contao_contao
train
php
6903f37d2e849c62b0804d2e5528c0020f486e2f
diff --git a/src/app/actions/psmtable/refine.py b/src/app/actions/psmtable/refine.py index <HASH>..<HASH> 100644 --- a/src/app/actions/psmtable/refine.py +++ b/src/app/actions/psmtable/refine.py @@ -30,7 +30,7 @@ def create_header(oldheader, genes, proteingroup, precursor, isob_header, bioset psmdatafields = [mzidtsvdata.HEADER_SETNAME] + psmdatafields if miscleav: psmdatafields.append(mzidtsvdata.HEADER_MISSED_CLEAVAGE) - header = header[:specfncolnr +1] + psmdatafields + header[specfncolnr + 1:] + header = header[:specfncolnr +1] + [x for x in psmdatafields if x not in header] + header[specfncolnr + 1:] return header
Only add standard fields to header if they are not there in PSM refine
glormph_msstitch
train
py
7d113de085dcd1855c01c73ddcaa58ca4eb51c7d
diff --git a/cli/command/system/prune.go b/cli/command/system/prune.go index <HASH>..<HASH> 100644 --- a/cli/command/system/prune.go +++ b/cli/command/system/prune.go @@ -128,6 +128,10 @@ func confirmationMessage(options pruneOptions) string { if options.pruneBuildCache { warnings = append(warnings, "all build cache") } + if len(options.filter.String()) > 0 { + warnings = append(warnings, "Elements to be pruned will be filtered with:") + warnings = append(warnings, "label="+options.filter.String()) + } var buffer bytes.Buffer t.Execute(&buffer, &warnings)
Update prune.go Append a warning with which filter the elements will be pruned with if filter is set.
docker_cli
train
go
25e3b677ff589b543b90ff0e81f1283690dccc9b
diff --git a/warrant/__init__.py b/warrant/__init__.py index <HASH>..<HASH> 100644 --- a/warrant/__init__.py +++ b/warrant/__init__.py @@ -2,6 +2,7 @@ import ast import boto3 import datetime import requests +import six from envs import env from jose import jwk, jwt @@ -153,7 +154,10 @@ class Cognito(object): hmac_key = self.get_key(kid) key = jwk.construct(hmac_key) message, encoded_sig = token.rsplit('.', 1) - decoded_sig = base64url_decode(str(encoded_sig)) + if six.PY3: + decoded_sig = base64url_decode(six.b(encoded_sig)) + else: + decoded_sig = base64url_decode(str(encoded_sig)) verified = key.verify(message, decoded_sig) if verified: setattr(self,id_name,token)
added if statement for py3 or py2 in verify_token
capless_warrant
train
py
1002237683f78e6e2987cbb8fce34ffcfa1f5aa8
diff --git a/spec/controllers/patients_controller_spec.rb b/spec/controllers/patients_controller_spec.rb index <HASH>..<HASH> 100644 --- a/spec/controllers/patients_controller_spec.rb +++ b/spec/controllers/patients_controller_spec.rb @@ -23,4 +23,12 @@ RSpec.describe PatientsController, :type => :controller do end + describe "GET medications" do + it "returns http status 200" do + get :manage_medications + expect(response).to render_template("medications") + expect(response.status).to eq(200) + end + end + end
Added rspec test for medication form.
airslie_renalware-core
train
rb
171f8a1d11bf20d685aa231515f0bc24553ec2bd
diff --git a/shopify/mixins.py b/shopify/mixins.py index <HASH>..<HASH> 100644 --- a/shopify/mixins.py +++ b/shopify/mixins.py @@ -16,6 +16,11 @@ class Metafields(object): _options = kwargs return shopify.resources.Metafield.find(resource=self.__class__.plural, resource_id=self.id, **_options) + def metafields_count(self, _options=None, **kwargs): + if _options is None: + _options = kwargs + return int(self.get("metafields/count", **_options)) + def add_metafield(self, metafield): if self.is_new(): raise ValueError("You can only add metafields to a resource that has been saved")
Enabled accessing count on metafields
Shopify_shopify_python_api
train
py
2d4459fa98fb5e4e941ea150d9c682a9e4e8dead
diff --git a/grifts/shoulders.go b/grifts/shoulders.go index <HASH>..<HASH> 100755 --- a/grifts/shoulders.go +++ b/grifts/shoulders.go @@ -17,6 +17,7 @@ var _ = Add("shoulders", func(c *Context) error { "github.com/markbates/grift": "github.com/markbates/grift", "github.com/markbates/pop": "github.com/markbates/pop", "github.com/spf13/cobra": "github.com/spf13/cobra", + "github.com/motemen/gore": "github.com/motemen/gore", } for _, p := range []string{".", "./render"} {
added github.com/motemen/gore to shoulders
gobuffalo_buffalo
train
go
38477889542b155747989010bbead99ae8393d8e
diff --git a/lib/slop.rb b/lib/slop.rb index <HASH>..<HASH> 100644 --- a/lib/slop.rb +++ b/lib/slop.rb @@ -808,7 +808,6 @@ class Slop end trash = [] - ignore_all = false items.each_with_index do |item, index| item = item.to_s @@ -816,10 +815,9 @@ class Slop if item == '--' trash << index - ignore_all = true + break end - next if ignore_all autocreate(flag, index, items) if @autocreate option, argument = extract_option(item, flag)
use break over a boolean flag and next
leejarvis_slop
train
rb
d20167bb4a61d1c1a42baf43e9a5d8440c270986
diff --git a/tests/test_bip32.py b/tests/test_bip32.py index <HASH>..<HASH> 100644 --- a/tests/test_bip32.py +++ b/tests/test_bip32.py @@ -354,6 +354,11 @@ class TestWalletVectors2(_TestWalletVectors): class _TestWalletVectorsDogecoin(TestCase): + """ + This is a reduced test because Dogecoin doesn't have official vectors. + + I generated these test values using http://bip32.org + """ def setUp(self): self.master_key = Wallet.deserialize( 'dgpv51eADS3spNJh8qd8KgFeT3V2QZBDSkYUqbaKDwZpDN4jd3uLcR7i6CruVDsb' @@ -438,9 +443,6 @@ class TestWalletVectorsDogecoin1(_TestWalletVectorsDogecoin): class TestWalletVectorsDogecoin2(_TestWalletVectorsDogecoin): - """ - This is a reduced test because Dogecoin doesn't have official vectors. - """ def test_m(self): vector = [ 'dgpv51eADS3spNJh8qd8KgFeT3V2QZBDSkYUqbaKDwZpDN4jd3uLcR7i6CruVDsbacyx3NL2puToxM9MQYhZSsD8tBkXeQkm5btsKxpZawwPQND', # nopep8
Move docs for dogecoin bip<I> tests, add note about bip<I>.org
sbuss_bitmerchant
train
py
a32eee612d7b77da9f6eaae90c1c32e6cd610b33
diff --git a/classes/MigrationModel.php b/classes/MigrationModel.php index <HASH>..<HASH> 100644 --- a/classes/MigrationModel.php +++ b/classes/MigrationModel.php @@ -314,8 +314,7 @@ class MigrationModel extends BaseModel 'code' => Lang::get('rainlab.builder::lang.migration.error_namespace_mismatch', ['namespace'=>$pluginNamespace]) ]); } - - $this->scriptFileName = Str::snake($migrationInfo['class']); + $this->scriptFileName = $this->makeScriptFileName($migrationInfo['class']); /* * Validate that a file with the generated name does not exist yet. @@ -498,4 +497,17 @@ class MigrationModel extends BaseModel $versionObj = new PluginVersion; return $versionObj->getPluginVersionInformation($this->getPluginCodeObj()); } + + protected function makeScriptFileName($value) + { + $value = Str::snake($value); + + $value = preg_replace_callback('/[0-9]+$/u', function ($match) { + $numericSuffix = $match[0]; + + return '_' . $numericSuffix; + }, $value); + + return $value; + } }
fix automatic naming of migrations (#<I>)
rainlab_builder-plugin
train
php
59d9f2b3d8ce1f18800991d55ebe1f5b0906cbc8
diff --git a/code/CMSMenu.php b/code/CMSMenu.php index <HASH>..<HASH> 100644 --- a/code/CMSMenu.php +++ b/code/CMSMenu.php @@ -163,9 +163,9 @@ class CMSMenu extends Object implements Iterator } $subClasses = array_unique($subClasses); foreach($subClasses as $key => $className) { - // Test that the class is not abstract and it has a valid menu title + // Remove abstract classes and LeftAndMain $classReflection = new ReflectionClass($className); - if(!$classReflection->isInstantiable()) { + if(!$classReflection->isInstantiable() || 'LeftAndMain' == $className) { unset($subClasses[$key]); } else { if(singleton($className)->getMenuTitle() == '') { @@ -199,4 +199,4 @@ class CMSMenu extends Object implements Iterator } } -?> \ No newline at end of file +?>
BUGFIX Remove LeftAndMain entry from CMSMenu (#<I>).
silverstripe_silverstripe-siteconfig
train
php
33f43bdaba5946dd124f5a2f206228c141fab197
diff --git a/sprd/view/ProductViewerClass.js b/sprd/view/ProductViewerClass.js index <HASH>..<HASH> 100644 --- a/sprd/view/ProductViewerClass.js +++ b/sprd/view/ProductViewerClass.js @@ -297,6 +297,10 @@ define(["js/ui/View", "js/core/Bus", "sprd/manager/ProductManager", "sprd/data/I newConfiguration.$stage = null; bus.setUp(newConfiguration); + + if(newConfiguration.type == "specialText") { + newConfiguration.fetchImage(); + } } }); }
DEV-<I> - Duplicated special font configuration does not have image
spreadshirt_rAppid.js-sprd
train
js
8b9e92d25a7b4b4ba3b7492eb3f9ae82ae414493
diff --git a/views/js/uiForm.js b/views/js/uiForm.js index <HASH>..<HASH> 100755 --- a/views/js/uiForm.js +++ b/views/js/uiForm.js @@ -737,6 +737,7 @@ if (classUri && classUri.trim()) { $this.parent('div').children('div.form-error').remove(); + const isRemoteList = !!$this.find('option:selected').attr('data-remote-list'); $.ajax({ url: context.root_url + 'taoBackOffice/Lists/getListElements', @@ -749,12 +750,16 @@ let html = '<ul class="form-elt-list">', property; - for (property in response) { - if(!response.hasOwnProperty(property)) { + for (property in response.data.elements) { + if (!response.data.elements.hasOwnProperty(property)) { continue; } - html += '<li>' + encode.html(response[property]) + '</li>'; + html += `<li>${encode.html(response.data.elements[property].label)}</li>`; + } + + if (isRemoteList && response.data.totalCount > response.data.elements.length) { + html += `<li>...</li>`; } html += '</ul>';
refactor: check for remote list on FE side. Render dots element on FE side
oat-sa_tao-core
train
js
2895deb7efcfb039dd8a4a083f5353f25f57eb7e
diff --git a/library/src/de/neofonie/mobile/app/android/widget/crouton/Crouton.java b/library/src/de/neofonie/mobile/app/android/widget/crouton/Crouton.java index <HASH>..<HASH> 100644 --- a/library/src/de/neofonie/mobile/app/android/widget/crouton/Crouton.java +++ b/library/src/de/neofonie/mobile/app/android/widget/crouton/Crouton.java @@ -323,7 +323,7 @@ public final class Crouton { RelativeLayout contentView = new RelativeLayout(this.activity); contentView.setLayoutParams(new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.MATCH_PARENT, - RelativeLayout.LayoutParams.MATCH_PARENT)); + RelativeLayout.LayoutParams.WRAP_CONTENT)); // set padding int padding = this.style.paddingInPixels; @@ -400,7 +400,7 @@ public final class Crouton { RelativeLayout.LayoutParams textParams = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.MATCH_PARENT, - RelativeLayout.LayoutParams.MATCH_PARENT); + RelativeLayout.LayoutParams.WRAP_CONTENT); if (image != null) { textParams.addRule(RelativeLayout.RIGHT_OF, image.getId()); }
fixes full screen display of Crouton
keyboardsurfer_Crouton
train
java
eee68960300604c7422c439513d9589845e73d44
diff --git a/great_expectations/data_context/__init__.py b/great_expectations/data_context/__init__.py index <HASH>..<HASH> 100644 --- a/great_expectations/data_context/__init__.py +++ b/great_expectations/data_context/__init__.py @@ -11,7 +11,7 @@ except ImportError: try: from .spark_context import SparkCSVDataContext - from .spark_parquet_context import SparkParquetContext + from .spark_parquet_context import SparkParquetDataContext from .databricks_context import DatabricksTableContext except ImportError: logger.info("Unable to load Spark contexts; install optional spark dependency for support")
Fix typo with spark parquet data context
great-expectations_great_expectations
train
py
02a16cd96b0e039e41f258005bde455901dc4361
diff --git a/plugins/Admin/templates/Configurations/index.php b/plugins/Admin/templates/Configurations/index.php index <HASH>..<HASH> 100644 --- a/plugins/Admin/templates/Configurations/index.php +++ b/plugins/Admin/templates/Configurations/index.php @@ -53,7 +53,8 @@ $this->element('addScript', [ if (! Configure::read('app.htmlHelper')->paymentIsCashless() && in_array($configuration->name, [ 'FCS_BANK_ACCOUNT_DATA', - 'FCS_MINIMAL_CREDIT_BALANCE' + 'FCS_MINIMAL_CREDIT_BALANCE', + 'FCS_CASHLESS_PAYMENT_ADD_TYPE', ])) { continue; }
hide FCS_CASHLESS_PAYMENT_ADD_TYPE if payment type is cash
foodcoopshop_foodcoopshop
train
php
b451e56416cb0994aa08f74e2ba9452149710fca
diff --git a/lib/pkgcloud/openstack/client.js b/lib/pkgcloud/openstack/client.js index <HASH>..<HASH> 100644 --- a/lib/pkgcloud/openstack/client.js +++ b/lib/pkgcloud/openstack/client.js @@ -212,8 +212,9 @@ Client.prototype._doRequest = function (options, callback) { if (!self.authorized) { createBuffer(); self.auth(function (err) { - - // TODO deal with error here + if (err) { + return errs.handle(err, callback); + } onPiped();
[fix] Properly deal with OpenStack errors.
pkgcloud_pkgcloud
train
js
80dad4fb9f165577a0799bde721aab913645dc39
diff --git a/lib/usable/version.rb b/lib/usable/version.rb index <HASH>..<HASH> 100644 --- a/lib/usable/version.rb +++ b/lib/usable/version.rb @@ -1,3 +1,3 @@ module Usable - VERSION = "0.3.0".freeze + VERSION = "1.0.0".freeze end
version 1 :sparkles:
ridiculous_usable
train
rb
eb72bde5a90c243e00e0c728d49be6afa900658e
diff --git a/src/protocol/requests/findCoordinator/v1/response.js b/src/protocol/requests/findCoordinator/v1/response.js index <HASH>..<HASH> 100644 --- a/src/protocol/requests/findCoordinator/v1/response.js +++ b/src/protocol/requests/findCoordinator/v1/response.js @@ -16,10 +16,10 @@ const decode = async rawData => { const decoder = new Decoder(rawData) const throttleTime = decoder.readInt32() const errorCode = decoder.readInt16() - const errorMessage = decoder.readString() failIfVersionNotSupported(errorCode) + const errorMessage = decoder.readString() const coordinator = { nodeId: decoder.readInt32(), host: decoder.readString(),
Only read error message if it is safe
tulios_kafkajs
train
js
6446e0fd29fa6bcd2dc062c8eb9a825f182007b3
diff --git a/lib/rack/client/handler/net_http.rb b/lib/rack/client/handler/net_http.rb index <HASH>..<HASH> 100644 --- a/lib/rack/client/handler/net_http.rb +++ b/lib/rack/client/handler/net_http.rb @@ -40,7 +40,8 @@ module Rack end def self.parse(net_response) - Rack::Response.new(net_response.body || [], net_response.code.to_i, parse_headers(net_response)) + body = (net_response.body.nil? || net_response.body.empty?) ? [] : StringIO.new(net_response.body) + Rack::Response.new(body, net_response.code.to_i, parse_headers(net_response)) end def self.parse_headers(net_response) diff --git a/spec/handler/rack_compliant_spec.rb b/spec/handler/rack_compliant_spec.rb index <HASH>..<HASH> 100644 --- a/spec/handler/rack_compliant_spec.rb +++ b/spec/handler/rack_compliant_spec.rb @@ -22,6 +22,11 @@ share_examples_for "Rack Compliant Adapter" do response.status.should == 302 response["Location"].should == "/after-redirect" end + + it 'can return an empty body' do + response = client.get("/empty") + response.body.should be_empty + end end context 'HEAD request' do
Properly handle empty response bodies.
halorgium_rack-client
train
rb,rb
a874fe3c7a2ed13182761db25352ecdd37ef6e1c
diff --git a/docs/conf.py b/docs/conf.py index <HASH>..<HASH> 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -109,6 +109,7 @@ html_theme_options = { "github_button": "true", "github_repo": "aioopenssl", "github_user": "horazont", + "font_size": "12pt", } html_sidebars = { '**': [
docs: make font size more bearable
horazont_aioopenssl
train
py
f14ddd03f20f56f6f279b806a573aef8af14c559
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 @@ -17,7 +17,6 @@ end %w{ rubygems bundler/setup - flexmock flexmock/rspec active_support rubigen
[BUGFIX] Don't double-require flexmock This was causing a crazy false-positive test result due to running minitest after spec with 0 tests (and so a return value of 0). <URL>
adhearsion_adhearsion
train
rb
354d42bfa2eedce150c22820fdc366e1f3b948f9
diff --git a/pkg/datapath/linux/node_linux_test.go b/pkg/datapath/linux/node_linux_test.go index <HASH>..<HASH> 100644 --- a/pkg/datapath/linux/node_linux_test.go +++ b/pkg/datapath/linux/node_linux_test.go @@ -1094,6 +1094,10 @@ func (s *linuxPrivilegedIPv4OnlyTestSuite) TestArpPingHandling(c *check.C) { } ip, ipnet, err := net.ParseCIDR(vethCIDR) + if err != nil { + errRet = err + return + } ip2 := net.ParseIP(vethIPAddr) ip3 := net.ParseIP(vethPeerIPAddr) ipnet.IP = ip2
node: Fix ineffectual assignment /home/travis/gopath/src/github.com/cilium/cilium/pkg/datapath/linux/node_linux_test.go:<I>:<I>: ineffectual assignment to err
cilium_cilium
train
go
44715ff4a617a3e5f4018e0eac283e45d95feddb
diff --git a/src/main/java/twitter4j/http/OAuth.java b/src/main/java/twitter4j/http/OAuth.java index <HASH>..<HASH> 100644 --- a/src/main/java/twitter4j/http/OAuth.java +++ b/src/main/java/twitter4j/http/OAuth.java @@ -39,6 +39,7 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; +import java.util.Random; /** * @author Yusuke Yamamoto - yusuke at mac.com @@ -111,13 +112,15 @@ public class OAuth { } + private static Random RAND = new Random(); + /** * @return * @see <a href="http://oauth.net/core/1.0#rfc.section.5.4.1">OAuth Core - 5.4.1. Authorization Header</a> */ /*package*/ String generateAuthorizationHeader(String method, String url, PostParameter[] params, OAuthToken token) { - long nonce = System.currentTimeMillis(); - long timestamp = nonce / 1000; + long timestamp = System.currentTimeMillis() / 1000; + long nonce = timestamp + RAND.nextInt(); return generateAuthorizationHeader(method, url, params, String.valueOf(nonce), String.valueOf(timestamp), token); }
TFJ-<I> OAuth rarely fails with "Invalid / used nonce" now nonce is randomly generated. git-svn-id: <URL>
Twitter4J_Twitter4J
train
java
282818bb99a67b6ff0cb0d52a5e4297902094569
diff --git a/lib/docker-sync/sync_strategy/unison-unox.rb b/lib/docker-sync/sync_strategy/unison-unox.rb index <HASH>..<HASH> 100644 --- a/lib/docker-sync/sync_strategy/unison-unox.rb +++ b/lib/docker-sync/sync_strategy/unison-unox.rb @@ -3,6 +3,7 @@ require 'docker-sync/preconditions' require 'docker-sync/execution' require 'open3' require 'socket' +require 'terminal-notifier' module Docker_Sync module SyncStrategy @@ -59,6 +60,7 @@ module Docker_Sync say_status 'error', "Error starting sync, exit code #{$?.exitstatus}", :red say_status 'message', stderr else + TerminalNotifier.notify("Synced #{@options['src']}", :title => 'Docker-Sync') say_status 'ok', "Synced #{@options['src']}", :white if @options['verbose'] say_status 'output', stdout
[FEATURE] Add terminal notifier support
EugenMayer_docker-sync
train
rb
e5c6e869345465b88b2bdb7b77749ccd6f164f81
diff --git a/h2o-core/src/main/java/water/api/RequestServer.java b/h2o-core/src/main/java/water/api/RequestServer.java index <HASH>..<HASH> 100644 --- a/h2o-core/src/main/java/water/api/RequestServer.java +++ b/h2o-core/src/main/java/water/api/RequestServer.java @@ -129,7 +129,7 @@ public class RequestServer extends NanoHTTPD { register("/3/Typeahead/files" ,"GET",TypeaheadHandler.class, "files", null, "Typehead hander for filename completion."); - + register("/3/Jobs/(?<job_id>.*)" ,"GET",JobsHandler .class, "fetch", null, "Get the status of the given H2O Job (long-running action)."); @@ -658,6 +658,7 @@ public class RequestServer extends NanoHTTPD { } switch( type ) { + case html: // return JSON for html requests case json: return new Response(http_response_header, MIME_JSON, s.toJsonString()); case xml:
PUBDEV-<I>: Shutdown => unimplemented error on curl -X POST <I>:<I>/3/Shutdown.html
h2oai_h2o-3
train
java
60b70be144c9afabe6485f504f87a905ba7be285
diff --git a/km3modules/mc.py b/km3modules/mc.py index <HASH>..<HASH> 100644 --- a/km3modules/mc.py +++ b/km3modules/mc.py @@ -153,9 +153,16 @@ class MCTimeCorrector(Module): def slew(tot): """Calculate the time slewing of a PMT response for a given ToT""" - p0 = 7.70824 - p1 = 0.00879447 - p2 = -0.0621101 - p3 = -1.90226 + + #p0 = 7.70824 + #p1 = 0.00879447 + #p2 = -0.0621101 + #p3 = -1.90226 + + p0 = 13.6488662517; + p1 = -0.128744123166; + p2 = -0.0174837749244; + p3 = -4.47119633965; + corr = p0 * np.exp(p1 * np.sqrt(tot) + p2 * tot) + p3 return corr
new tot-correction for correcting hit times depending on ToT of hit
tamasgal_km3pipe
train
py
20cea8f978b1814dba5b88d62f40e41e7f2f99f5
diff --git a/console/src/main/resources/root/libs/composum/nodes/browser/js/nodeview.js b/console/src/main/resources/root/libs/composum/nodes/browser/js/nodeview.js index <HASH>..<HASH> 100644 --- a/console/src/main/resources/root/libs/composum/nodes/browser/js/nodeview.js +++ b/console/src/main/resources/root/libs/composum/nodes/browser/js/nodeview.js @@ -389,8 +389,10 @@ }, reload: function () { - this.$download.attr('href', core.getContextUrl('/bin/cpm/nodes/node.download.attachment.bin' - + this.$('.editor-frame .code-editor').data('file'))); + window.setTimeout(_.bind(function () { + this.$download.attr('href', core.getContextUrl('/bin/cpm/nodes/node.download.attachment.bin' + + this.$('.editor-frame .code-editor').data('file'))); + }, this), 200); }, resize: function () {
timing problem in download link initialization (editor view) fixed
ist-dresden_composum
train
js
b8db250364486ed4c2737a3dfc96697d25ec08bc
diff --git a/plugin/index.js b/plugin/index.js index <HASH>..<HASH> 100644 --- a/plugin/index.js +++ b/plugin/index.js @@ -179,6 +179,7 @@ module.exports = generators.Base.extend({ 'testee': getDependency('testee'), 'generator-donejs': getDependency('generator-donejs'), 'donejs-cli': getDependency('donejs-cli'), + 'can-ssr': getDependency('can-ssr') } }));
Adding can-ssr dependency back to plugin generator
donejs_generator-donejs
train
js
89daf8cb521e50af399feb0a38bde3fb802ddadb
diff --git a/pyGenClean/LaTeX/__init__.py b/pyGenClean/LaTeX/__init__.py index <HASH>..<HASH> 100644 --- a/pyGenClean/LaTeX/__init__.py +++ b/pyGenClean/LaTeX/__init__.py @@ -15,6 +15,7 @@ # pyGenClean. If not, see <http://www.gnu.org/licenses/>. +import os import re import textwrap from string import Template @@ -167,3 +168,19 @@ def format_numbers(number): exponent = int(r.group(2)) return "$" + coefficient + r"\times 10^{" + str(exponent) + "}$" + + +def sanitize_fig_name(name): + """Sanitizes the name of a file (for including graphics in LaTeX). + + :param name: the name of the file to sanitize. + :type name: string + + :returns: the sanitized name. + + For example, if the name of the graphic file is ``test.1.png``, the + sanitized version of it for LaTeX is ``{test.1}.png``. + + """ + name, extension = os.path.splitext(name) + return "{" + name + "}" + extension
Added a function to sanitize the figure name in LaTeX (when dots are present before the extension)
lemieuxl_pyGenClean
train
py
d3905475c8c9865fd10071a3c1267af37bf09068
diff --git a/src/_helpers/helper-posts.js b/src/_helpers/helper-posts.js index <HASH>..<HASH> 100644 --- a/src/_helpers/helper-posts.js +++ b/src/_helpers/helper-posts.js @@ -21,7 +21,7 @@ module.exports.register = function(Handlebars, options, params) { context = context.filter(filterCallback) } if (sortCallback) { - context = context.sort(sortCallback) + context = context.slice(0).sort(sortCallback) } if (options.hash.limit) { context = context.slice(0, options.hash.limit)
Fix async sorting issue.
happyplan_happyplan
train
js
007aef2d56ccde6a4369bbc41d02e3333ef9bee3
diff --git a/bakery/management/commands/publish.py b/bakery/management/commands/publish.py index <HASH>..<HASH> 100644 --- a/bakery/management/commands/publish.py +++ b/bakery/management/commands/publish.py @@ -293,7 +293,10 @@ No content was changed on S3.") # add the cache-control heaers if necessary if content_type in self.cache_control: - headers['Cache-Control'] = 'max-age=%s' % self.cache_control[content_type] + headers['Cache-Control'] = ''.join(( + 'max-age=', + str(self.cache_control[content_type]) + )) # access and write the contents from the file with open(filename, 'rb') as file_obj:
Fix line-length warning from pep8
datadesk_django-bakery
train
py
cf0687da2196bea08628c15dd314623f258938a0
diff --git a/src/Sylius/Bundle/UserBundle/EventListener/UserLastLoginSubscriber.php b/src/Sylius/Bundle/UserBundle/EventListener/UserLastLoginSubscriber.php index <HASH>..<HASH> 100644 --- a/src/Sylius/Bundle/UserBundle/EventListener/UserLastLoginSubscriber.php +++ b/src/Sylius/Bundle/UserBundle/EventListener/UserLastLoginSubscriber.php @@ -72,7 +72,7 @@ class UserLastLoginSubscriber implements EventSubscriberInterface /** * @param UserInterface $user */ - protected function updateUserLastLogin(UserInterface $user) + protected function updateUserLastLogin($user) { if ($user instanceof $this->userClass) { $user->setLastLogin(new \DateTime());
Remove strong typing on updateUserLastLogin event If you have two way of login in one app (sylius and an other user provider / form), the event onSecurityInteractiveLogin or onImplicitLogin is fired but your entity User is not a Sylius entity user with the user interface UserInterface from sylius. So you have a php error because your 2nd user entity doesn't have the UserInterface implemented. The strong typing is useless, because on first line we check the user class.
Sylius_Sylius
train
php
eb930af32e8eaa100b59bf69911a4f0fa61a2b18
diff --git a/src/PhoreFile.php b/src/PhoreFile.php index <HASH>..<HASH> 100644 --- a/src/PhoreFile.php +++ b/src/PhoreFile.php @@ -365,7 +365,12 @@ class PhoreFile extends PhoreUri foreach ($data as $row) { $cur = []; foreach ($keys as $key) { - $cur[] = isset($row[$key]) ? $row[$key] : ""; + if (is_object($row)) { + $cur[] = isset($row->$key) ? $row->$key : ""; + } else { + $cur[] = isset($row[$key]) ? $row[$key] : ""; + } + } $s->fputcsv($cur); }
allow objects in csv writer
phore_phore-filesystem
train
php
0b6dea168cd2b16a517b1c65501f9355b7f68991
diff --git a/java/client/src/org/openqa/selenium/firefox/FirefoxBinary.java b/java/client/src/org/openqa/selenium/firefox/FirefoxBinary.java index <HASH>..<HASH> 100644 --- a/java/client/src/org/openqa/selenium/firefox/FirefoxBinary.java +++ b/java/client/src/org/openqa/selenium/firefox/FirefoxBinary.java @@ -91,12 +91,12 @@ public class FirefoxBinary { modifyLinkLibraryPath(profileDir); } - List<String> cmdArray = Lists.newArrayList(getExecutable().getPath()); + List<String> cmdArray = Lists.newArrayList(); cmdArray.addAll(extraOptions); cmdArray.addAll(Lists.newArrayList(commandLineFlags)); - CommandLine command = new CommandLine(Iterables.toArray(cmdArray, String.class)); + CommandLine command = new CommandLine(getExecutable().getPath(), Iterables.toArray(cmdArray, String.class)); command.setEnvironmentVariables(getExtraEnv()); - executable.setLibraryPath(command, getExtraEnv()); + getExecutable().setLibraryPath(command, getExtraEnv()); if (stream == null) { stream = getExecutable().getDefaultOutputStream();
Using more straightforward constructor to create a CommandLine instance
SeleniumHQ_selenium
train
java
dfa795f4b3d6e120ddba5b1c5ed6f8dc649f928b
diff --git a/config/initializers/app_config.rb b/config/initializers/app_config.rb index <HASH>..<HASH> 100644 --- a/config/initializers/app_config.rb +++ b/config/initializers/app_config.rb @@ -39,7 +39,7 @@ module ApplicationConfiguration @ostruct.use_cp = true unless @ostruct.respond_to?(:use_cp) @ostruct.use_pulp = true unless @ostruct.respond_to?(:use_pulp) # backticks gets you the equiv of a system() command in Ruby - version = `rpm -q katello --queryformat '%{VERSION}-%{RELEASE}\n'` + version = `rpm -q katello-common --queryformat '%{VERSION}-%{RELEASE}\n'` exit_code = $? if exit_code != 0 hash = `git rev-parse --short HEAD`
<I> - SAM does not contain valid version
Katello_katello
train
rb
bf380d00ab62ccedcf5d7f32125bfbd4dd636d01
diff --git a/modules/caddyhttp/server.go b/modules/caddyhttp/server.go index <HASH>..<HASH> 100644 --- a/modules/caddyhttp/server.go +++ b/modules/caddyhttp/server.go @@ -150,6 +150,17 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) { } } + // reject very long methods; probably a mistake or an attack + if len(r.Method) > 32 { + if s.shouldLogRequest(r) { + s.accessLogger.Debug("rejecting request with long method", + zap.String("method_trunc", r.Method[:32]), + zap.String("remote_addr", r.RemoteAddr)) + } + w.WriteHeader(http.StatusMethodNotAllowed) + return + } + repl := caddy.NewReplacer() r = PrepareRequest(r, repl, w, s)
caddyhttp: Reject absurd methods (#<I>) * caddyhttp: Reject absurdly long methods * Limit method to <I> chars and truncate * Just reject the request and debug-log it * Log remote address
mholt_caddy
train
go
ef5317f74f83d73484e32a69079253d406b61b42
diff --git a/actionpack/lib/action_controller/integration.rb b/actionpack/lib/action_controller/integration.rb index <HASH>..<HASH> 100644 --- a/actionpack/lib/action_controller/integration.rb +++ b/actionpack/lib/action_controller/integration.rb @@ -73,11 +73,11 @@ module ActionController unless @named_routes_configured # install the named routes in this session instance. klass = class<<self; self; end - Routing::NamedRoutes.install(klass) + Routing::Routes.named_routes.install(klass) # the helpers are made protected by default--we make them public for # easier access during testing and troubleshooting. - klass.send(:public, *Routing::NamedRoutes::Helpers) + klass.send(:public, *Routing::Routes.named_routes.helpers) @named_routes_configured = true end end diff --git a/actionpack/lib/action_controller/url_rewriter.rb b/actionpack/lib/action_controller/url_rewriter.rb index <HASH>..<HASH> 100644 --- a/actionpack/lib/action_controller/url_rewriter.rb +++ b/actionpack/lib/action_controller/url_rewriter.rb @@ -43,7 +43,7 @@ module ActionController RESERVED_OPTIONS.each {|k| options.delete k} # Generates the query string, too - Routing::Routes.generate(options, @request.parameters) + Routing::Routes.generate(options, @request.symbolized_path_parameters) end end end
Tweaks to integration tests and url rewriter for further compatibility with new routes git-svn-id: <URL>
rails_rails
train
rb,rb
6bfb2b4ca0349eca2348160b71fe515967ed3f66
diff --git a/src/SeaweedFS.php b/src/SeaweedFS.php index <HASH>..<HASH> 100644 --- a/src/SeaweedFS.php +++ b/src/SeaweedFS.php @@ -50,13 +50,27 @@ class SeaweedFS { /** * Get a volume and file id from the master server. * - * @param int $count + * @param int $count + * @param string|null $collection + * @param string|null $replication + * @param string|null $dataCenter * @return File * @throws SeaweedFSException + * @see https://github.com/chrislusf/seaweedfs/wiki/Master-Server-API#assign-a-file-key */ - public function assign($count = 1) { + public function assign($count = 1, $collection = null, $replication = null, $dataCenter = null) { + $assignProperties = [ 'count' => $count ]; + if (!is_null($collection)) { + $assignProperties['collection'] = $collection; + } + if (!is_null($replication)) { + $assignProperties['replication'] = $replication; + } + if (!is_null($dataCenter)) { + $assignProperties['dataCenter'] = $dataCenter; + } $res = $this->client->get($this->buildMasterUrl(self::DIR_ASSIGN), [ - 'query' => [ 'count' => $count ] + 'query' => $assignProperties ]); if ($res->getStatusCode() != 200) {
Allow pass other options on assign fid
tystuyfzand_seaweedfs-client
train
php
84ae8614000701c3262da995511651923f609788
diff --git a/Tests/Repository/ProductRepositoryTest.php b/Tests/Repository/ProductRepositoryTest.php index <HASH>..<HASH> 100755 --- a/Tests/Repository/ProductRepositoryTest.php +++ b/Tests/Repository/ProductRepositoryTest.php @@ -21,6 +21,11 @@ use WellCommerce\Bundle\CoreBundle\Test\Repository\AbstractRepositoryTestCase; */ class ProductRepositoryTest extends AbstractRepositoryTestCase { + protected function getAlias() + { + return 'product'; + } + protected function get() { return $this->container->get('product.repository');
Added test alias method to repository tests (cherry picked from commit <I>c7ea<I>f8dfa3ca<I>e<I>efbdaaf5f0b8d)
WellCommerce_WishlistBundle
train
php
4ae9d884db6f6d55864c0cb5697bd16f39dfb084
diff --git a/app/assets/javascripts/pageflow/editor/views/embedded/page_link_embedded_view.js b/app/assets/javascripts/pageflow/editor/views/embedded/page_link_embedded_view.js index <HASH>..<HASH> 100644 --- a/app/assets/javascripts/pageflow/editor/views/embedded/page_link_embedded_view.js +++ b/app/assets/javascripts/pageflow/editor/views/embedded/page_link_embedded_view.js @@ -108,7 +108,7 @@ pageflow.PageLinkEmbeddedView = Backbone.Marionette.ItemView.extend({ updateTitle: function() { var linkedPage = this.linkedPage(); - this.ui.title.text(linkedPage ? linkedPage.configuration.get('description') : ''); + this.ui.title.html(linkedPage ? linkedPage.configuration.get('description') : ''); }, updateThumbnailView: function() {
Do not Escape Descriptions in Internal Links
codevise_pageflow
train
js
97f42205c9b802836b744a5ac6a05064532a8a91
diff --git a/src/Helpers/Model.php b/src/Helpers/Model.php index <HASH>..<HASH> 100644 --- a/src/Helpers/Model.php +++ b/src/Helpers/Model.php @@ -2,8 +2,6 @@ namespace Taskforcedev\CrudApi\Helpers; -use Illuminate\Support\Facades\Log; - /** * Class Model. */ @@ -72,7 +70,6 @@ class Model } } } catch (\Exception $e) { - Log::debug('CrudAPI: ' . $e->getMessage()); return false; }
Remove logging in model helper.
taskforcedev_crud-api
train
php
39941cb6c0eb816f60232191fc1d55b17a2b3258
diff --git a/nuxt/store/index.js b/nuxt/store/index.js index <HASH>..<HASH> 100644 --- a/nuxt/store/index.js +++ b/nuxt/store/index.js @@ -116,8 +116,8 @@ export const actions = { export const getters = { lastUpdate (state) { if (!state.lastUpdate) return null - const lastUpdate = new Date(Date.parse(state.lastUpdate)) - return timeSince(lastUpdate) + const date = new Date(Date.parse(state.lastUpdate)) + return timeSince(date) }, allAnalyses (state) { return state.analyses diff --git a/trailblazer/mip/fastq.py b/trailblazer/mip/fastq.py index <HASH>..<HASH> 100644 --- a/trailblazer/mip/fastq.py +++ b/trailblazer/mip/fastq.py @@ -14,7 +14,7 @@ class FastqHandler: undetermined: bool=False, date: dt.datetime=None, index: str=None) -> str: """Name a FASTQ file following MIP conventions.""" flowcell = f"{flowcell}-undetermined" if undetermined else flowcell - date_str = date or '20171015' + date_str = date.strftime('%y%m%d') if date else '171015' index = index if index else 'XXXXXX' return f"{lane}_{date_str}_{flowcell}_{sample}_{index}_{read}.fastq.gz"
update date in fastq file for MIP
Clinical-Genomics_trailblazer
train
js,py
766cd5ebeae99b73cae12d60e5281671615ba50e
diff --git a/src/main/java/io/github/classgraph/AnnotationParameterValue.java b/src/main/java/io/github/classgraph/AnnotationParameterValue.java index <HASH>..<HASH> 100644 --- a/src/main/java/io/github/classgraph/AnnotationParameterValue.java +++ b/src/main/java/io/github/classgraph/AnnotationParameterValue.java @@ -204,8 +204,7 @@ public class AnnotationParameterValue extends ScanResultObject implements Compar } final AnnotationParameterValue o = (AnnotationParameterValue) obj; final int diff = this.compareTo(o); - return (diff != 0 ? false - : value == null && o.value == null ? true : value != null && o.value != null); + return (diff == 0 && (value == null && o.value == null || value != null && o.value != null)); } @Override
Simplifiable conditional expression
classgraph_classgraph
train
java
732436864bab7981070f404b7d0bbc5516340c48
diff --git a/vendors/hypeJunction/hypeList.js b/vendors/hypeJunction/hypeList.js index <HASH>..<HASH> 100644 --- a/vendors/hypeJunction/hypeList.js +++ b/vendors/hypeJunction/hypeList.js @@ -557,9 +557,6 @@ $(this).data('item-index', itemIndex); $(this).appendTo(self.$list); if (self.options.selectorDelete) { - if (typeof $.fn.die === 'function') { - $(this).find(self.options.selectorDelete).die('click'); - } $(this).find(self.options.selectorDelete).off('click').on('click', self.deleteItem); } }); @@ -620,9 +617,11 @@ */ deleteItem: function (e) { e.preventDefault(); - var confirmText = $(this).data('confirm') || elgg.echo('question:areyousure'); - if (!confirm(confirmText)) { - return false; + if (!$(this).is('*[data-confirm],.elgg-requires-confirmation')) { + var confirmText = $(this).data('confirm') || elgg.echo('question:areyousure'); + if (!confirm(confirmText)) { + return false; + } } var $elem = $(this), $item = $elem.closest($elem.closest('.elgg-list,.elgg-gallery').children()),
fix(js): remove duplicate confirmation dialogs
hypeJunction_hypeLists
train
js
3da191852de9b0aa860532de7ec39256008d8252
diff --git a/index/scorch/scorch.go b/index/scorch/scorch.go index <HASH>..<HASH> 100644 --- a/index/scorch/scorch.go +++ b/index/scorch/scorch.go @@ -310,17 +310,21 @@ func (s *Scorch) prepareSegment(newSegment segment.Segment, ids []string, introduction.persisted = make(chan error, 1) } - // get read lock, to optimistically prepare obsoleted info + // optimistically prepare obsoletes outside of rootLock s.rootLock.RLock() - for _, seg := range s.root.segment { + root := s.root + root.AddRef() + s.rootLock.RUnlock() + + for _, seg := range root.segment { delta, err := seg.segment.DocNumbers(ids) if err != nil { - s.rootLock.RUnlock() return err } introduction.obsoletes[seg.id] = delta } - s.rootLock.RUnlock() + + _ = root.DecRef() s.introductions <- introduction
scorch zap tighten up prepareSegment()'s lock area
blevesearch_bleve
train
go
98c53e1ce38f9aaf77d287c27162d8bd62b8dd57
diff --git a/src/Illuminate/Database/DatabaseManager.php b/src/Illuminate/Database/DatabaseManager.php index <HASH>..<HASH> 100755 --- a/src/Illuminate/Database/DatabaseManager.php +++ b/src/Illuminate/Database/DatabaseManager.php @@ -79,10 +79,23 @@ class DatabaseManager implements ConnectionResolverInterface { { $name = $name ?: $this->getDefaultConnection(); - unset($this->connections[$name]); + $this->disconnect($name); return $this->connection($name); } + + /** + * Disconnect from the given database. + * + * @param string $name + * @return boolean + */ + public function disconnect($name = null) + { + $name = $name ?: $this->getDefaultConnection(); + + return unset($this->connections[$name]); + } /** * Make the database connection instance. @@ -219,4 +232,4 @@ class DatabaseManager implements ConnectionResolverInterface { return call_user_func_array(array($this->connection(), $method), $parameters); } -} \ No newline at end of file +}
Added `disconnect()` method to DatabaseManager. This method helps with unit testing where multiple connections are opened during a single PHPUnit process. Calling `DB::disconnect($name)` provides access to the protected `$connections` variable in a similar manner to `DB::reconnect($name)` but without recreating the connection. This prevents PDO Max Connection errors during database-heavy unit testing.
laravel_framework
train
php
9042536d0befbcfc43f20eb7c8bc33a0db59d128
diff --git a/lib/webcomment.py b/lib/webcomment.py index <HASH>..<HASH> 100644 --- a/lib/webcomment.py +++ b/lib/webcomment.py @@ -825,7 +825,7 @@ def query_add_comment_or_remark(reviews=0, recID=0, uid=-1, msg="", # FCKeditor when clicking the 'quote' button, as well as those # that we have introduced when quoting the original message msg = re.sub('<blockquote\s*>\s*<div.*?>', '>>', msg) - msg = msg.replace('</div></blockquote>', '') + msg = re.sub('</div>\s*</blockquote>', '\n', msg) msg = msg.replace('&nbsp;', ' ') # In case additional <p> or <div> got inserted, interpret # these as new lines (with a sad trick to do it only once)
WebComment: better identify end of quotations * Improve recognition of end of quote blocks, taking into account possible newlines/spaces, and transform them into new line characters.
inveniosoftware-attic_invenio-comments
train
py
947b8511aac244165f3b51fa545a823f2a088eda
diff --git a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/JmlGenerator.java b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/JmlGenerator.java index <HASH>..<HASH> 100644 --- a/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/JmlGenerator.java +++ b/core/codegen/vdm2jml/src/main/java/org/overture/codegen/vdm2jml/JmlGenerator.java @@ -464,6 +464,9 @@ public class JmlGenerator implements IREventObserver { continue; } + + // Invariant methods are really functions so we'll annotate them as pure + annotator.makePure(method); AIdentifierVarExpCG paramExp = util.getInvParamVar(method);
Named type invariants methods must be annotated as JML @pure
overturetool_overture
train
java
f9cd48259a9a25bda122524fb3fc015f74e8e8ba
diff --git a/bind.go b/bind.go index <HASH>..<HASH> 100644 --- a/bind.go +++ b/bind.go @@ -113,7 +113,7 @@ func In(query string, args ...interface{}) (string, []interface{}, error) { v := reflect.ValueOf(arg) t := reflectx.Deref(v.Type()) - if t.Kind() == reflect.Slice { + if t.Kind() == reflect.Slice && t != reflect.TypeOf([]byte{}) { meta[i].length = v.Len() meta[i].v = v
[]byte should not be expanded by In []byte is one of the driver.Value types, and should therefore not be expanded by `In`.
jmoiron_sqlx
train
go
e64988be01e8e996d58e567002052b91989a7eda
diff --git a/src/main/com/mongodb/DBPort.java b/src/main/com/mongodb/DBPort.java index <HASH>..<HASH> 100644 --- a/src/main/com/mongodb/DBPort.java +++ b/src/main/com/mongodb/DBPort.java @@ -130,6 +130,7 @@ public class DBPort { IOException lastError = null; try { + _authed.clear(); _socket = new Socket(); _socket.connect( _addr , _options.connectTimeout );
clear authentication list when re-connect JAVA-<I>
mongodb_mongo-java-driver
train
java
8f5f1a42a909e628d7861457dacaebb9e8d727e8
diff --git a/src/PHPCR/Shell/Phpcr/PhpcrSession.php b/src/PHPCR/Shell/Phpcr/PhpcrSession.php index <HASH>..<HASH> 100644 --- a/src/PHPCR/Shell/Phpcr/PhpcrSession.php +++ b/src/PHPCR/Shell/Phpcr/PhpcrSession.php @@ -104,6 +104,10 @@ class PhpcrSession implements SessionInterface } } + if ($newPath !== '/') { + $newPath = rtrim($newPath, '/'); + } + // check that path is valid $this->getNode($newPath); }
Command shell:path:change (cd): Allow trailing slash on path The 'cd' command complains if the path ends with a slash. That's annoying.
phpcr_phpcr-shell
train
php
01566bab6e5ce2eca8d0b88d24a1d8b1356f3154
diff --git a/lib/http/version.rb b/lib/http/version.rb index <HASH>..<HASH> 100644 --- a/lib/http/version.rb +++ b/lib/http/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module HTTP - VERSION = "2.2.1".freeze + VERSION = "3.0.0-dev".freeze end
[skip-ci] Fix version to be <I>-dev
httprb_http
train
rb
dd5f909a323903119e68ed46fc582fa6f70fa8e8
diff --git a/lib/app/models/open_object_resource.rb b/lib/app/models/open_object_resource.rb index <HASH>..<HASH> 100644 --- a/lib/app/models/open_object_resource.rb +++ b/lib/app/models/open_object_resource.rb @@ -231,7 +231,7 @@ module Ooor #actually finds many resources specified with scope = ids_array def find_single(scope, options) - fields = options[:fields] || options[:only] || [] + fields = options[:fields] || options[:only] || (@fields.keys.select {|k| @fields[k]["type"] != "binary"} + @associations_keys) context = options[:context] || {} # prefix_options, query_options = split_options(options[:params]) is_collection = true
don't read binary fields by default, they can still be read lazily later
akretion_ooor
train
rb
253313ccdc4d65175af0d2ca02ead547ba5e9bba
diff --git a/test/utils/remark-newpage-directive/indexTest.js b/test/utils/remark-newpage-directive/indexTest.js index <HASH>..<HASH> 100644 --- a/test/utils/remark-newpage-directive/indexTest.js +++ b/test/utils/remark-newpage-directive/indexTest.js @@ -20,6 +20,7 @@ describe('remark-newpage-directive', () => { }, { type: 'no-newpage', + options: {}, }, { type: 'classname',
fixup! Wrap contents with page when newpage directives does not exist
izumin5210_OHP
train
js
455d0cfb2a1299d1294f3c27b1cebd52a304c3a2
diff --git a/redongo/redongo_server.py b/redongo/redongo_server.py index <HASH>..<HASH> 100644 --- a/redongo/redongo_server.py +++ b/redongo/redongo_server.py @@ -66,8 +66,13 @@ class RedongoServer(object): self.completed_bulks = set() self.objs = [] self.cipher = cipher_utils.AESCipher(__get_sk__()) + disk_queue_load_time = time.time() + logger.info('Loading disk queues...') self.disk_queue = queue_utils.Queue(queue_name=options.diskQueue) + logger.info('Loading disk queue took {0}'.format(time.time() - disk_queue_load_time)) + ret_disk_queue_load_time = time.time() self.returned_disk_queue = queue_utils.Queue(queue_name='{0}_returned'.format(options.diskQueue)) + logger.info('Loading returned disk queue took {0}'.format(time.time() - ret_disk_queue_load_time)) self.lock_key = '{0}_LOCK'.format(self.redisQueue) def create_redis_connection(self):
Added loggers for queue load time
stoneworksolutions_redongo
train
py
e8df59a0346030562785891c788f38ea890fadb8
diff --git a/datajoint/settings.py b/datajoint/settings.py index <HASH>..<HASH> 100644 --- a/datajoint/settings.py +++ b/datajoint/settings.py @@ -52,7 +52,7 @@ default = OrderedDict({ 'display.width': 14 }) -logger = logging.getLogger() +logger = logging.getLogger(__name__) log_levels = { 'INFO': logging.INFO, 'WARNING': logging.WARNING,
Associate name with logger in settings.py
datajoint_datajoint-python
train
py
7765212b10880398cb3c539e8c89a351cf5311d7
diff --git a/config/application.rb b/config/application.rb index <HASH>..<HASH> 100644 --- a/config/application.rb +++ b/config/application.rb @@ -15,8 +15,8 @@ require "rails/test_unit/railtie" # you've limited to :test, :development, or :production. Bundler.require(:default, Rails.env) if defined?(Bundler) -GRAYLOG2_VERSION = "0.9.5p2" -GRAYLOG2_VERSION_TIMESTAMP = 1302475256 +GRAYLOG2_VERSION = "0.9.6-PREVIEW" +GRAYLOG2_VERSION_TIMESTAMP = 1319387943 module Graylog2WebInterface class Application < Rails::Application
updated VERSION and timestamp for preview version release
Graylog2_graylog2-server
train
rb
c925b98f0dadbf1fe836fe70251ba294ef8f6c81
diff --git a/guava-testlib/src/com/google/common/collect/testing/TestContainerGenerator.java b/guava-testlib/src/com/google/common/collect/testing/TestContainerGenerator.java index <HASH>..<HASH> 100644 --- a/guava-testlib/src/com/google/common/collect/testing/TestContainerGenerator.java +++ b/guava-testlib/src/com/google/common/collect/testing/TestContainerGenerator.java @@ -57,11 +57,11 @@ public interface TestContainerGenerator<T, E> { * original list unchanged, the original list modified in place, or a * different list. * - * <p>This method runs only when {@link - * com.google.common.collect.testing.features.CollectionFeature#KNOWN_ORDER} - * is specified when creating the test suite. It should never run when testing - * containers such as {@link java.util.HashSet}, which have a - * non-deterministic iteration order. + * <p>If the order is non-deterministic, as with {@link java.util.HashSet}, + * this method can return its input unmodified. Provided that the test suite + * is built without {@link + * com.google.common.collect.testing.features.CollectionFeature#KNOWN_ORDER}, + * the tests will look only at the returned contents without regard for order. */ Iterable<E> order(List<E> insertionOrder); }
Document that order() is called even without KNOWN_ORDER. Fixes <URL>
google_guava
train
java
add5e8b19349a8b4f1d69eef1c229a714093137b
diff --git a/shield/decorators.py b/shield/decorators.py index <HASH>..<HASH> 100644 --- a/shield/decorators.py +++ b/shield/decorators.py @@ -30,7 +30,7 @@ class Rule(RuleBase): super(Rule, self).__init__(*args, **kwargs) def __call__(self, **kwargs): - kwargs['target'] = self.target + kwargs.setdefault('target', self.target) return self.function(**kwargs) @@ -96,6 +96,7 @@ class DeferredRule(RuleBase): kwargs = dict(params) kwargs['query'] = q.join(alias, col) + kwargs['target'] = alias return rule(**kwargs)
Fix issue where the rule was not recieving the aliased target.
concordusapps_python-shield
train
py
64f4296e4d562c7e7a62d132bc373023aa8205f3
diff --git a/common-core-open/src/main/java/com/bbn/bue/common/files/FileUtils.java b/common-core-open/src/main/java/com/bbn/bue/common/files/FileUtils.java index <HASH>..<HASH> 100755 --- a/common-core-open/src/main/java/com/bbn/bue/common/files/FileUtils.java +++ b/common-core-open/src/main/java/com/bbn/bue/common/files/FileUtils.java @@ -511,4 +511,13 @@ public final class FileUtils { } }; + /** + * Throws an {@link java.io.IOException} if the supplied directory either + * does not exist or is not a directory. + */ + public static void assertDirectoryExists(File directory) throws IOException { + if (!directory.isDirectory()) { + throw new IOException(directory + " does not exist or is not a directory"); + } + } }
Adds FileUtils.assertDirectoryExists Throws an {@link java.io.IOException} if the supplied directory either does not exist or is not a directory.
BBN-E_bue-common-open
train
java
1b5772a2d491c0ffe0b886b23694ab07de54480e
diff --git a/lib/methods/drush.py b/lib/methods/drush.py index <HASH>..<HASH> 100644 --- a/lib/methods/drush.py +++ b/lib/methods/drush.py @@ -130,7 +130,11 @@ class DrushMethod(BaseMethod): if self.methodName == 'drush8': if uuid: self.run_drush('cset system.site uuid %s -y' % uuid) + if 'configurationManagement' in config: + # Clear the cache, so all classes get found. + self.run_drush('cr') + for key, cmds in config['configurationManagement'].iteritems(): script_fn(config, script=cmds, rootFolder=config['siteFolder']) else:
Clear cache before config-import as autodiscovery of classes and plugins needs to be run before cache-clear
factorial-io_fabalicious
train
py
0943771641eb87b4ef06279de2d7b9f3734d270e
diff --git a/cli/src/main/java/org/jboss/as/cli/handlers/DeploymentOverlayHandler.java b/cli/src/main/java/org/jboss/as/cli/handlers/DeploymentOverlayHandler.java index <HASH>..<HASH> 100644 --- a/cli/src/main/java/org/jboss/as/cli/handlers/DeploymentOverlayHandler.java +++ b/cli/src/main/java/org/jboss/as/cli/handlers/DeploymentOverlayHandler.java @@ -964,7 +964,7 @@ public class DeploymentOverlayHandler extends CommandHandlerWithHelp { final ModelNode result = response.get(Util.RESULT); if(!result.isDefined()) { final String descr = Util.getFailureDescription(response); - if(descr != null && descr.contains("JBAS014807")) { + if(descr != null && (descr.contains("JBAS014807") || descr.contains("JBAS014793"))) { // resource doesn't exist return null; }
cli: deployment-overlay domain tests was: <I>fcfc1d<I>e4c6edde<I>
wildfly_wildfly-core
train
java
f1463b7c736d6fed3b2b723b256122e701076c71
diff --git a/astrocats/__init__.py b/astrocats/__init__.py index <HASH>..<HASH> 100644 --- a/astrocats/__init__.py +++ b/astrocats/__init__.py @@ -1,2 +1,6 @@ """Astrocats: Scripts for creating and analyzing catalogs of astronomical data. """ + +__version__ = '0.1.7' +__author__ = 'James Guillochon' +__license__ = 'MIT' diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -1,9 +1,19 @@ import os +import re import uuid -from setuptools import setup, find_packages from pip.req import parse_requirements +from setuptools import find_packages, setup +VERSIONFILE = "astrocats/__init__.py" +ver_file = open(VERSIONFILE, "rt").read() +VSRE = r"^__version__ = ['\"]([^'\"]*)['\"]" +mo = re.search(VSRE, ver_file, re.M) + +if mo: + version = mo.group(1) +else: + raise RuntimeError("Unable to find version string in %s." % (VERSIONFILE)) # Utility function to read the README file. # Used for the long_description. It's nice, because now 1) we have a top level
ENH: added version to __init__, using in setup.py
astrocatalogs_astrocats
train
py,py