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
b8ff6f41b7644f431ff10da4857c464978f35070
diff --git a/pyrser/grammar.py b/pyrser/grammar.py index <HASH>..<HASH> 100644 --- a/pyrser/grammar.py +++ b/pyrser/grammar.py @@ -147,10 +147,8 @@ class Grammar(parsing.Parser, metaclass=MetaGrammar): """Parse filename using the grammar""" self.from_string = False import os.path - if os.path.exists(filename): - f = open(filename, 'r') + with open(filename, 'r') as f: self.parsed_stream(f.read(), os.path.abspath(filename)) - f.close() if entry is None: entry = self.entry if entry is None:
Added: with statement in parse_file
LionelAuroux_pyrser
train
py
ad37c5b28fd4bc9b2f8d0502c791251a966cdb0e
diff --git a/Source/Form/Field/Type/ArrayOfType.php b/Source/Form/Field/Type/ArrayOfType.php index <HASH>..<HASH> 100644 --- a/Source/Form/Field/Type/ArrayOfType.php +++ b/Source/Form/Field/Type/ArrayOfType.php @@ -64,10 +64,12 @@ class ArrayOfType extends FieldType $this->buildArrayLengthValidators($processors); - $processors[] = new ArrayAllProcessor( - $this->elementField->getProcessors(), - $this->getElementType()->getProcessedPhpType() - ); + if (count($this->elementField->getProcessors()) > 0) { + $processors[] = new ArrayAllProcessor( + $this->elementField->getProcessors(), + $this->getElementType()->getProcessedPhpType() + ); + } $this->buildArrayElementsValidators($processors);
Only process elements of array if element field has a processor
dms-org_core
train
php
3811e11bf0a0c956b5f8d8b019e938dbb74c8ea7
diff --git a/lib/cequel/record/properties.rb b/lib/cequel/record/properties.rb index <HASH>..<HASH> 100644 --- a/lib/cequel/record/properties.rb +++ b/lib/cequel/record/properties.rb @@ -253,6 +253,30 @@ module Cequel end # + # Read an attribute + # + # @param column_name [Symbol] the name of the column + # @return the value of that column + # @raise [MissingAttributeError] if the attribute has not been loaded + # @raise [UnknownAttributeError] if the attribute does not exist + # + def [](column_name) + read_attribute(column_name) + end + + # + # Write an attribute + # + # @param column_name [Symbol] name of the column to write + # @param value the value to write to the column + # @return [void] + # @raise [UnknownAttributeError] if the attribute does not exist + # + def []=(column_name, value) + write_attribute(column_name, value) + end + + # # @return [Boolean] true if this record has the same type and key # attributes as the other record def ==(other) @@ -289,6 +313,9 @@ module Cequel end def write_attribute(name, value) + unless self.class.reflect_on_column(name) + fail UnknownAttributeError, "unknown attribute: #{name}" + end @attributes[name] = value end
Add `[]` and `[]=` method for property access Parity with ActiveRecord
cequel_cequel
train
rb
16a254102695404b9ba52a67dfa7073df36d3ff9
diff --git a/parsl/executors/high_throughput/executor.py b/parsl/executors/high_throughput/executor.py index <HASH>..<HASH> 100644 --- a/parsl/executors/high_throughput/executor.py +++ b/parsl/executors/high_throughput/executor.py @@ -128,7 +128,7 @@ class HighThroughputExecutor(ParslExecutor, RepresentationMixin): raise ConfigurationError('Multiple storage access schemes are not supported') self.working_dir = working_dir self.managed = managed - self.engines = [] + self.blocks = [] self.tasks = {} self.cores_per_worker = cores_per_worker @@ -169,12 +169,12 @@ class HighThroughputExecutor(ParslExecutor, RepresentationMixin): if hasattr(self.provider, 'init_blocks'): try: for i in range(self.provider.init_blocks): - engine = self.provider.submit(self.launch_cmd, 1) - logger.debug("Launched block: {0}:{1}".format(i, engine)) - if not engine: + block = self.provider.submit(self.launch_cmd, 1) + logger.debug("Launched block {}:{}".format(i, block)) + if not block: raise(ScalingFailed(self.provider.label, "Attempts to provision nodes via provider has failed")) - self.blocks.extend([engine]) + self.blocks.extend([block]) except Exception as e: logger.error("Scaling out failed: %s" % e)
Change 'engines' to 'blocks' Fixes #<I>.
Parsl_parsl
train
py
3b5fa52c142281e709df2f4102fdcb259a97099d
diff --git a/tests/sockjs_server.js b/tests/sockjs_server.js index <HASH>..<HASH> 100644 --- a/tests/sockjs_server.js +++ b/tests/sockjs_server.js @@ -60,7 +60,7 @@ server.addListener('upgrade', function(req, res){ }); sockjs_app.install({ - sockjs_url: 'http://localhost:'+port+'/lib/sockjs.js', + sockjs_url: '/lib/sockjs.js', websocket: true }, server);
Fix tests when not running on localhost
sockjs_sockjs-client
train
js
8f53edae3bd628e00f052182a3a5e84ee578f018
diff --git a/integration-cli/docker_cli_network_unix_test.go b/integration-cli/docker_cli_network_unix_test.go index <HASH>..<HASH> 100644 --- a/integration-cli/docker_cli_network_unix_test.go +++ b/integration-cli/docker_cli_network_unix_test.go @@ -201,7 +201,8 @@ func isNwPresent(c *check.C, name string) bool { out, _ := dockerCmd(c, "network", "ls") lines := strings.Split(out, "\n") for i := 1; i < len(lines)-1; i++ { - if strings.Contains(lines[i], name) { + netFields := strings.Fields(lines[i]) + if netFields[1] == name { return true } }
bug fix for test cases Fix bug that `isNwPresent` can't distinguish network names with same prefix.
moby_moby
train
go
e2d20ee7fddc18d2d65ac12eb13356c60ecc704e
diff --git a/lxd/events/common.go b/lxd/events/common.go index <HASH>..<HASH> 100644 --- a/lxd/events/common.go +++ b/lxd/events/common.go @@ -45,7 +45,7 @@ func (e *listenerCommon) heartbeat() { defer e.Close() - pingInterval := time.Second * 5 + pingInterval := time.Second * 10 e.pongsPending = 0 e.SetPongHandler(func(msg string) error {
lxd/events: Increase websocket pings to <I>s Slow servers, especially when going through a cluster seem to be able to exceed the 5s delay causing connection issues.
lxc_lxd
train
go
db8626dc9a579246bdf1760c86a477e496203d33
diff --git a/src/java/com/threerings/gwt/ui/Widgets.java b/src/java/com/threerings/gwt/ui/Widgets.java index <HASH>..<HASH> 100644 --- a/src/java/com/threerings/gwt/ui/Widgets.java +++ b/src/java/com/threerings/gwt/ui/Widgets.java @@ -225,6 +225,18 @@ public class Widgets return button; } + /** + * Makes a widget that takes up horizontal and or vertical space. Shim shimminy shim shim + * shiree. + */ + public static Widget newShim (int width, int height) + { + Label shim = new Label(""); + shim.setWidth(width + "px"); + shim.setHeight(height + "px"); + return shim; + } + protected static void maybeAddClickHandler (HasClickHandlers target, ClickHandler onClick) { if (onClick != null) {
Added newShim(). I'd like to nix WidgetUtil and move the Flash crap to FlashUtil or SWFUtil, but I'll save that for another day.
threerings_gwt-utils
train
java
7679cbb18a46d7635be34a532029206ba42a489c
diff --git a/kernel/classes/datatypes/ezimage/ezimagefile.php b/kernel/classes/datatypes/ezimage/ezimagefile.php index <HASH>..<HASH> 100644 --- a/kernel/classes/datatypes/ezimage/ezimagefile.php +++ b/kernel/classes/datatypes/ezimage/ezimagefile.php @@ -109,11 +109,16 @@ class eZImageFile extends eZPersistentObject { $db = eZDB::instance(); $contentObjectAttributeID = (int) $contentObjectAttributeID; - $query = "SELECT contentobject_id, contentclassattribute_id - FROM ezcontentobject_attribute - WHERE id = $contentObjectAttributeID - LIMIT 1"; - $rows = $db->arrayQuery( $query ); + + $cond = array( 'id' => $contentObjectAttributeID ); + $fields = array( 'contentobject_id', 'contentclassattribute_id' ); + $limit = array( 'offset' => 0, 'length' => 1 ); + $rows = eZPersistentObject::fetchObjectList( eZContentObjectAttribute::definition(), + $fields, + $cond, + null, + $limit, + false ); if ( count( $rows ) != 1 ) return array();
Fixed #<I>: (Oracle) (Webin) Clicking on "discard draft" button on "Site settings" raises a DB error
ezsystems_ezpublish-legacy
train
php
7ca9c37bc61b6800bb578e8b3cde1832208e468a
diff --git a/lib/magic_grid/definition.rb b/lib/magic_grid/definition.rb index <HASH>..<HASH> 100644 --- a/lib/magic_grid/definition.rb +++ b/lib/magic_grid/definition.rb @@ -85,7 +85,6 @@ module MagicGrid Rails.logger.debug "#{self.class.name}: Ignoring sorting on non-AR collection" end - @options[:searchable] = false if @options[:searchable] == [] @options[:searchable] = [] if @options[:searchable] and not @options[:searchable].kind_of? Array @accepted = [:action, :controller, param_key(:page)] @@ -139,7 +138,7 @@ module MagicGrid end end else - if @options[:searchable] and param(:q) + if @options[:searchable] or param(:q) Rails.logger.warn "#{self.class.name}: Ignoring searchable fields on non-AR collection" end @options[:searchable] = false
Break backward compatibility for sake of cleaner code
rmg_magic_grid
train
rb
92a37da6b6c7e8f7bb3311516e3789c5a9d74f87
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100755 --- a/setup.py +++ b/setup.py @@ -47,7 +47,7 @@ setup(name='ReText', ('share/retext/locale', glob('locale/*.qm')), ('share/wpgen', glob('templates/*.css') + glob('templates/*.html')) ], - requires=['Markups', 'Markdown', 'pyenchant'], + requires=['docutils', 'Markups', 'Markdown', 'pyenchant'], cmdclass={'build': retext_build, 'sdist': retext_sdist}, license='GPL 2+' )
setup.py: add docutils to requirements
retext-project_retext
train
py
ced1c6887281bec00ec5581cf581c92933d4e6ba
diff --git a/test/signal/TickSignal.js b/test/signal/TickSignal.js index <HASH>..<HASH> 100644 --- a/test/signal/TickSignal.js +++ b/test/signal/TickSignal.js @@ -252,5 +252,17 @@ define(["Test", "Tone/signal/TickSignal", "helper/Offline"], expect(tickSignal.getDurationOfTicks(2, 1.5)).to.be.closeTo(0.6, 0.01); }); + it("outputs a signal", function(){ + var sched; + return Offline(function(){ + sched = new TickSignal(1).toMaster(); + sched.linearRampToValueBetween(3, 1, 2); + }, 3).then(function(buffer){ + buffer.forEach(function(sample, time){ + expect(sample).to.be.closeTo(sched.getValueAtTime(time), 0.01); + }); + }); + }); + }); }); \ No newline at end of file
testing that it outputs a signal
Tonejs_Tone.js
train
js
3a6b8daf832c2b81d714b4ff9b6e5da7a3dd6ad8
diff --git a/ravel.py b/ravel.py index <HASH>..<HASH> 100644 --- a/ravel.py +++ b/ravel.py @@ -272,8 +272,13 @@ class Connection : "for server-side use; registers the specified instance of an @interface()" \ " class for handling method calls on the specified path, and also on subpaths" \ " if fallback." - if not is_interface_instance(interface) : - raise TypeError("interface must be an instance of an @interface() class") + if is_interface_instance(interface) : + pass + elif is_interface(interface) : + # assume can instantiate without arguments + interface = interface() + else : + raise TypeError("interface must be an @interface() class or instance thereof") #end if if self._dispatch == None : self._dispatch = {}
ravel.Connection now allows registering an interface class if it can be instantiated without arguments
ldo_dbussy
train
py
81637cdf7a0bbe3700d8f28669e25a6f079f9300
diff --git a/i3ipc.py b/i3ipc.py index <HASH>..<HASH> 100644 --- a/i3ipc.py +++ b/i3ipc.py @@ -5,6 +5,7 @@ import json import socket import os import re +import subprocess from enum import Enum @@ -172,7 +173,12 @@ class Connection(object): socket_path = os.environ.get("I3SOCK") if not socket_path: - raise Exception('could not get i3 socket path') + try: + socket_path = subprocess.check_output( + ['i3', '--get-socketpath'], + close_fds=True, universal_newlines=True) + except: + raise Exception('Failed to retrieve the i3 IPC socket path') self._pubsub = _PubSub(self) self.props = _PropsObject(self)
Retrieve the IPC socket path directly from i3 Call i3 with the `--get-socketpath' command-line option, which is available since <I> release, to retrieve the i3 IPC socket path. This restores backwards compatibility after the previous commit.
acrisci_i3ipc-python
train
py
8a01e9cda1ae33289daaac512c4dd67f3a8e8672
diff --git a/core-bundle/src/HttpKernel/Bundle/ResourceProvider.php b/core-bundle/src/HttpKernel/Bundle/ResourceProvider.php index <HASH>..<HASH> 100644 --- a/core-bundle/src/HttpKernel/Bundle/ResourceProvider.php +++ b/core-bundle/src/HttpKernel/Bundle/ResourceProvider.php @@ -63,6 +63,7 @@ class ResourceProvider */ public function getBundleNames() { + // FIXME: this method should be removed as soon as we drop coreOnlyMode return array_keys($this->contaoResources); }
[Core] ResourceProvider::getBundleNames should not be used We should always use kernel.bundles from the DIC
contao_contao
train
php
06d41fbad1d8a5df938babd734b44d1a41c68fc5
diff --git a/examples/gaussian_process_regression.py b/examples/gaussian_process_regression.py index <HASH>..<HASH> 100644 --- a/examples/gaussian_process_regression.py +++ b/examples/gaussian_process_regression.py @@ -56,6 +56,9 @@ def main(unused_argv): def softplus(x): return np.logaddexp(x, 0.) + # Note, writing out the vectorized form of the identity + # ||x-y||^2 = <x-y,x-y> = ||x||^2 + ||y||^2 - 2<x,y> + # for computing squared distances would be more efficient (but less succinct). def exp_quadratic(x1, x2): return np.exp(-np.sum((x1 - x2)**2))
Added a note about squared distances
tensorflow_probability
train
py
6263453fd3cbaa8718937d75009cac9ab163f64c
diff --git a/buildpackrunner/runner.go b/buildpackrunner/runner.go index <HASH>..<HASH> 100644 --- a/buildpackrunner/runner.go +++ b/buildpackrunner/runner.go @@ -125,7 +125,7 @@ func (runner *Runner) buildpackPath(buildpack string) (string, error) { files, err := ioutil.ReadDir(buildpackPath) if err != nil { - return "", newDescriptiveError(nil, "failed to read buildpack directory for buildpack: %s", buildpack) + return "", newDescriptiveError(nil, "failed to read buildpack directory '%s' for buildpack '%s'", buildpackPath, buildpack) } if len(files) == 1 {
Add a bit more info to error logging when looking for buildpacks to run 'detect' with
cloudfoundry_buildpackapplifecycle
train
go
bcaff02554548e4c6fcf3d0819f62353506a0825
diff --git a/src/abcWalletTxLib-ETH.js b/src/abcWalletTxLib-ETH.js index <HASH>..<HASH> 100644 --- a/src/abcWalletTxLib-ETH.js +++ b/src/abcWalletTxLib-ETH.js @@ -866,8 +866,8 @@ class ABCTxLibETH { return false } - // synchronous - makeSpend (abcSpendInfo:any) { + // ssynchronous + async makeSpend (abcSpendInfo:any) { // Validate the spendInfo const valid = validateObject(abcSpendInfo, { 'type': 'object',
makeSpend to async
EdgeApp_edge-currency-ethereum
train
js
2a3162694755fae52129f5f4a45b97a1255dacd2
diff --git a/aikif/cls_log.py b/aikif/cls_log.py index <HASH>..<HASH> 100644 --- a/aikif/cls_log.py +++ b/aikif/cls_log.py @@ -246,7 +246,7 @@ class LogSummary(object): log_3.close() log_4.close() - def extract_logs(fname, prg): + def extract_logs(self, fname, prg): """ read a logfile and return entries for a program """
bug fix extract_logs had missing self param
acutesoftware_AIKIF
train
py
255fb52d1c607170b72303fe0d5cc36a2a2e03fb
diff --git a/src/Http/MiddlewareQueue.php b/src/Http/MiddlewareQueue.php index <HASH>..<HASH> 100644 --- a/src/Http/MiddlewareQueue.php +++ b/src/Http/MiddlewareQueue.php @@ -60,6 +60,18 @@ class MiddlewareQueue implements Countable } /** + * Alias for MiddlewareQueue::add(). + * + * @param callable $callable The middleware callable to append. + * @return $this + * @see MiddlewareQueue::add() + */ + public function push(callable $callable) + { + return $this->add($callable); + } + + /** * Prepend a middleware callable to the start of the queue. * * @param callable $callable The middleware callable to prepend.
Add back push() as alias for MiddlewareQueue::add().
cakephp_cakephp
train
php
6d9d9c1f496472186908389dc9421991a9f86fe0
diff --git a/tests/Handler/FpmHandlerTest.php b/tests/Handler/FpmHandlerTest.php index <HASH>..<HASH> 100644 --- a/tests/Handler/FpmHandlerTest.php +++ b/tests/Handler/FpmHandlerTest.php @@ -19,12 +19,14 @@ class FpmHandlerTest extends TestCase implements HttpRequestProxyTest { parent::setUp(); + ob_start(); $this->fakeContext = new Context('abc', time(), 'abc', 'abc'); } public function tearDown() { $this->fpm->stop(); + ob_end_clean(); } public function test simple request()
Clean up the output of tests using output buffering
mnapoli_bref
train
php
16f9c6ee881fa8738be90c4ebd4f2adc36f42021
diff --git a/go/engine/pgp_encrypt.go b/go/engine/pgp_encrypt.go index <HASH>..<HASH> 100644 --- a/go/engine/pgp_encrypt.go +++ b/go/engine/pgp_encrypt.go @@ -184,7 +184,7 @@ func (e *PGPEncrypt) loadSelfKey() (*libkb.PGPKeyBundle, error) { keys := me.FilterActivePGPKeys(true, e.arg.KeyQuery) if len(keys) == 0 { - return nil, libkb.NoKeyError{Msg: "No PGP key found for encrypting for self"} + return nil, libkb.NoKeyError{Msg: "No PGP key found for encrypting for self (add a PGP key or use --no-self flag)"} } return keys[0], nil } diff --git a/go/libkb/rpc_exim.go b/go/libkb/rpc_exim.go index <HASH>..<HASH> 100644 --- a/go/libkb/rpc_exim.go +++ b/go/libkb/rpc_exim.go @@ -244,7 +244,7 @@ func ImportStatusAsError(s *keybase1.Status) error { } return KeyExistsError{fp} case SCKeyNotFound: - return NoKeyError{} + return NoKeyError{s.Desc} case SCKeyNoEldest: return NoSigChainError{} case SCStreamExists:
Fix NoKeyError not getting its Msg through in ImportStatusAsError Also be more descriptive when loadSelfKey in `pgp encrypt` fails, mention that there is --no-self flag.
keybase_client
train
go,go
cafad18fc332cb848918ec5020f10b602d912c32
diff --git a/api-generator/components/datatable.js b/api-generator/components/datatable.js index <HASH>..<HASH> 100644 --- a/api-generator/components/datatable.js +++ b/api-generator/components/datatable.js @@ -387,13 +387,13 @@ const DataTableProps = [ name: 'rowClassName', type: 'function', default: 'null', - description: `Function that takes the row data and <br/> returns an object in "&#123;'styleclass' : condition&#125;" format to define a classname for a particular now.` + description: `Function that takes the row data and <br/> returns an object in "&#123;'styleclass' : condition&#125;" format to define a class name for a particular row.` }, { name: 'cellClassName', type: 'function', default: 'null', - description: `Function that takes the cell data and <br/> returns an object in "&#123;'styleclass' : condition&#125;" format to define a classname for a particular now.` + description: `Function that takes the cell data and <br/> returns an object in "&#123;'styleclass' : condition&#125;" format to define a class name for a particular cell.` }, { name: 'rowGroupHeaderTemplate',
Attempt to improve DataTable.rowClassName and DataTable.cellClassName descriptions (#<I>)
primefaces_primereact
train
js
1c00aaf8e3c01c613414ce9e1d555b41f3cb01c6
diff --git a/lib/python/voltdbclient.py b/lib/python/voltdbclient.py index <HASH>..<HASH> 100644 --- a/lib/python/voltdbclient.py +++ b/lib/python/voltdbclient.py @@ -301,13 +301,13 @@ class FastSerializer: print "ERROR: Connection failed. Please check that the host and port are correct." raise e except socket.timeout: - raise SystemExit("Authentication timed out after %d seconds." + raise RuntimeError("Authentication timed out after %d seconds." % self.socket.gettimeout()) version = self.readByte() status = self.readByte() if status != 0: - raise SystemExit("Authentication failed.") + raise RuntimeError("Authentication failed.") self.readInt32() self.readInt64()
ENG-<I> Python client change SystemExit to RuntimeError
VoltDB_voltdb
train
py
82986e3b95748fab6e5d372829a3d41e69970e01
diff --git a/src/Behat/Mink/Exception/ExpectationException.php b/src/Behat/Mink/Exception/ExpectationException.php index <HASH>..<HASH> 100644 --- a/src/Behat/Mink/Exception/ExpectationException.php +++ b/src/Behat/Mink/Exception/ExpectationException.php @@ -133,8 +133,10 @@ class ExpectationException extends Exception $driver = basename(str_replace('\\', '/', get_class($this->session->getDriver()))); $info = '+--[ '; - if (!in_array($driver, array('SahiDriver', 'SeleniumDriver', 'Selenium2Driver'))) { + try { $info .= 'HTTP/1.1 '.$this->session->getStatusCode().' | '; + } catch (UnsupportedDriverActionException $e) { + // Ignore the status code when not supported } $info .= $this->session->getCurrentUrl().' | '.$driver." ]\n|\n";
Changed the handling of drivers not supporting status code This avoids hardcoding the list of excluded drivers in the ExpectationException but relying on the UnsupportedDriverActionException instead.
minkphp_Mink
train
php
770e9ff4c225bae26f631a0198c76f185785aa57
diff --git a/openpnm/core/Base.py b/openpnm/core/Base.py index <HASH>..<HASH> 100644 --- a/openpnm/core/Base.py +++ b/openpnm/core/Base.py @@ -16,9 +16,9 @@ class Base(dict): instance = super(Base, cls).__new__(cls, *args, **kwargs) return instance - def __init__(self, Np=0, Nt=0, name=None, simulation=None): + def __init__(self, kv={}, Np=0, Nt=0, name=None, simulation=None): self.settings.setdefault('prefix', 'base') - super().__init__() + super().__init__(kv) if simulation is None: simulation = ws.new_simulation() simulation.append(self) diff --git a/openpnm/core/Simulation.py b/openpnm/core/Simulation.py index <HASH>..<HASH> 100644 --- a/openpnm/core/Simulation.py +++ b/openpnm/core/Simulation.py @@ -88,6 +88,8 @@ class Simulation(list): num = str(len(self.physics.keys())).zfill(2) elif 'GenericAlgorithm' in obj.mro(): num = str(len(self.algorithms.keys())).zfill(2) + else: + num = str(len(self)).zfill(2) name = prefix + '_' + num return name
Chnage Base to accept a dict during intialization
PMEAL_OpenPNM
train
py,py
7ec9b59182bc510420c7110ba79623b2301cb6d6
diff --git a/lib/motion/RMXEventManager.rb b/lib/motion/RMXEventManager.rb index <HASH>..<HASH> 100644 --- a/lib/motion/RMXEventManager.rb +++ b/lib/motion/RMXEventManager.rb @@ -108,7 +108,7 @@ class RMXEventManager .distinctUntilChanged .subscribeNext(->(s) { NSLog("[#{className}] status=#{STATUSES[s]}") - }.rmx_weak!) + }.rmx_unsafe!) end @@ -122,7 +122,7 @@ class RMXEventManager .takeUntil(rac_willDeallocSignal) .subscribeNext(->(x) { refresh - }.rmx_weak!) + }.rmx_unsafe!) end def disableRefresh diff --git a/lib/motion/RMXViewControllerPresentation.rb b/lib/motion/RMXViewControllerPresentation.rb index <HASH>..<HASH> 100644 --- a/lib/motion/RMXViewControllerPresentation.rb +++ b/lib/motion/RMXViewControllerPresentation.rb @@ -91,7 +91,7 @@ module RMXViewControllerPresentation viewStateSignal .filter(->((_state, animated)) { state == _state - }.rmx_weak!) + }.rmx_unsafe!) end def whenOrIfViewState(viewState, &block)
switch to rmx_unsafe! where there is a rac_willDeallocSignal
joenoon_rmx
train
rb,rb
d4697cf802e20577a0b4b6d24bad6df3fb2a070f
diff --git a/codenerix/models_people.py b/codenerix/models_people.py index <HASH>..<HASH> 100644 --- a/codenerix/models_people.py +++ b/codenerix/models_people.py @@ -26,7 +26,7 @@ from functools import reduce from django.db.models import Q from django.db import models from django.utils.encoding import smart_text -from django.utils.translation import ugettext as _ +from django.utils.translation import ugettext_lazy as _ from django.contrib.auth.models import User, Group, Permission from django.core.exceptions import ValidationError from django.core.validators import validate_email
Changed ugettext for ugettext_lazy inside models.py
codenerix_django-codenerix
train
py
8977df882e8146f2202307a996b4a2339057fbb9
diff --git a/lib/cyborg/plugin/assets/svgs.rb b/lib/cyborg/plugin/assets/svgs.rb index <HASH>..<HASH> 100644 --- a/lib/cyborg/plugin/assets/svgs.rb +++ b/lib/cyborg/plugin/assets/svgs.rb @@ -30,8 +30,11 @@ module Cyborg return if find_files.empty? @svg.read_files + if write_path = @svg.write puts "Built: #{write_path.sub(plugin.root+'/','')}" + else + puts "FAILED TO WRITE: #{write_path.sub(plugin.root+'/','')}" end end end
Also notifiy if SVG files failed to write
imathis_spark
train
rb
02642fc8f9113df52afc4cd98d9c7b888928a35a
diff --git a/yatiml/dumper.py b/yatiml/dumper.py index <HASH>..<HASH> 100644 --- a/yatiml/dumper.py +++ b/yatiml/dumper.py @@ -73,7 +73,7 @@ class Representer: class_.yatiml_sweeten(represented_object) -class Dumper(yaml.Dumper): +class Dumper(yaml.SafeDumper): """The YAtiML Dumper class. Derive your own Dumper class from this one, then add classes to it \ diff --git a/yatiml/loader.py b/yatiml/loader.py index <HASH>..<HASH> 100644 --- a/yatiml/loader.py +++ b/yatiml/loader.py @@ -94,7 +94,7 @@ class Constructor: node.start_mark, os.linesep, self.class_.__name__, node))) -class Loader(yaml.Loader): +class Loader(yaml.SafeLoader): def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) self.__recognizer = Recognizer(self._registered_classes)
Use SafeLoader and SafeDumper
yatiml_yatiml
train
py,py
53136e0f35881f9eff2e5b18ba5544c79c8625a0
diff --git a/gulpfile.js b/gulpfile.js index <HASH>..<HASH> 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -41,7 +41,7 @@ gulp.task('build:release', function () { var majorVersion = version.match(/^(\d).(\d).(\d)/)[1] var versionPath = './dist/' + majorVersion - var prodPath = './dist/prod' + var prodPath = './dist' var tasks = sourceTargets.map(function (entry) { return browserify({
gulpfile change production path to root
opbeat_opbeat-react
train
js
1529af6cb969d308be5f1bf0fab91984ca78ffe0
diff --git a/parser.go b/parser.go index <HASH>..<HASH> 100644 --- a/parser.go +++ b/parser.go @@ -4,8 +4,10 @@ import ( "bytes" "errors" "fmt" + "reflect" d "runtime/debug" "strconv" + "unsafe" ) // Find position of next character which is not ' ', ',', '}' or ']' @@ -319,7 +321,7 @@ func GetNumber(data []byte, keys ...string) (val float64, offset int, err error) return 0, offset, fmt.Errorf("Value is not a number: %s", string(v)) } - val, err = strconv.ParseFloat(string(v), 64) + val, err = strconv.ParseFloat(toString(v), 64) return } @@ -345,3 +347,11 @@ func GetBoolean(data []byte, keys ...string) (val bool, offset int, err error) { return } + +// A hack until issue golang/go#2632 is fixed. +// See: https://github.com/golang/go/issues/2632 +func toString(data []byte) string { + h := (*reflect.SliceHeader)(unsafe.Pointer(&data)) + sh := reflect.StringHeader{Data: h.Data, Len: h.Len} + return *(*string)(unsafe.Pointer(&sh)) +}
Avoid allocating memory in GetNumber See #<I>
buger_jsonparser
train
go
e20556d2a6e7892ab4870c1ad657f0ab6017a5b0
diff --git a/lib/get-unused-file-path.js b/lib/get-unused-file-path.js index <HASH>..<HASH> 100644 --- a/lib/get-unused-file-path.js +++ b/lib/get-unused-file-path.js @@ -2,6 +2,8 @@ var fs = require("fs"); var uuid = require("node-uuid"); +var recentlyUsedFileNames = []; +var lastLength = 0; var generateNewPath = function (path) { return path.replace(/[^\/]*(\.[a-z]{3,4})$/, uuid.v4() + "$1"); @@ -9,11 +11,22 @@ var generateNewPath = function (path) { module.exports = function getUniqueFilePath(path, cb) { fs.exists(path, function (exists) { - if (exists) { + if (exists || recentlyUsedFileNames.indexOf(path) != -1) { var newPath = generateNewPath(path); return getUniqueFilePath(newPath, cb); } + recentlyUsedFileNames.push(path); cb(path); }); }; + +setInterval(function () { + if (!lastLength) { + lastLength = recentlyUsedFileNames.length; + return; + } + + recentlyUsedFileNames = recentlyUsedFileNames.slice(lastLength); + lastLength = recentlyUsedFileNames.length; +}, 60000);
remove rename file race condition with a recently used file names cache
thomaspeklak_express-upload-resizer
train
js
17f44ca79cabeb7953d0a59c9fda0f8ad1806b4b
diff --git a/server/camlistored/ui/index.js b/server/camlistored/ui/index.js index <HASH>..<HASH> 100644 --- a/server/camlistored/ui/index.js +++ b/server/camlistored/ui/index.js @@ -486,7 +486,7 @@ cam.IndexPage = React.createClass({ searchSession: this.searchSession_, searchURL: searchURL, oldURL: oldURL, - getDetailURL: this.handleDetailURL_.bind(this), + getDetailURL: this.handleDetailURL_, navigator: this.navigator_, keyEventTarget: this.props.eventTarget, width: this.props.availWidth,
Fix React warning about unnecessary bind (with aspects CL as well) Change-Id: Iff<I>cda<I>beecbdbb0bb<I>d9a0bf<I>c<I>
perkeep_perkeep
train
js
d35132bf1d1fd84c3563f5a8f1d176d1c71e6280
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -30,7 +30,7 @@ setup(name='django-plugins', packages=find_packages(exclude=['sample-project']), install_requires=[ 'django>=1.6', - 'django-dirtyfields', + 'django-dirtyfields<1.3', ], url='https://github.com/krischer/django-plugins', download_url='http://pypi.python.org/pypi/django-plugins',
Pin Django-dirtyfields to < <I> <I> is the last build to support Django < <I>
krischer_django-plugins
train
py
ddd6f27080422b12625844a693c7b19bcb7c6ca0
diff --git a/spec/spec.collection.js b/spec/spec.collection.js index <HASH>..<HASH> 100644 --- a/spec/spec.collection.js +++ b/spec/spec.collection.js @@ -283,7 +283,7 @@ describe 'Express' describe '#toArray()' it 'should return an array' - $(['foo', 'bar']).keys().toArray().should.eql [0, 1] + $(['foo', 'bar']).keys().toArray().should.eql ['0', '1'] end it 'should work on nested collections'
Fixed faulty Collection#toArray() spec due to keys() returning strings
expressjs_express
train
js
055a65f4f1b084c934a7a1fd99375f1716d8444f
diff --git a/src/Context/FeatureContext.php b/src/Context/FeatureContext.php index <HASH>..<HASH> 100644 --- a/src/Context/FeatureContext.php +++ b/src/Context/FeatureContext.php @@ -498,10 +498,6 @@ class FeatureContext implements SnippetAcceptingContext { $this->variables['DB_PASSWORD'] = getenv( 'WP_CLI_TEST_DBPASS' ); } - if ( false !== getenv( 'WP_CLI_TEST_DBPASS' ) ) { - $this->variables['DB_PASSWORD'] = getenv( 'WP_CLI_TEST_DBPASS' ); - } - if ( getenv( 'WP_CLI_TEST_DBHOST' ) ) { $this->variables['DB_HOST'] = getenv( 'WP_CLI_TEST_DBHOST' ); }
Remove accidental duplicate Committed in error.
wp-cli_wp-cli-tests
train
php
01869d7377a1024572fe53ea0a95a8d9a98a8481
diff --git a/scripts/git-precommit-hook.py b/scripts/git-precommit-hook.py index <HASH>..<HASH> 100755 --- a/scripts/git-precommit-hook.py +++ b/scripts/git-precommit-hook.py @@ -7,7 +7,7 @@ import subprocess def has_cargo_fmt(): """Runs a quick check to see if cargo fmt is installed.""" try: - c = subprocess.Popen(['cargo', 'fmt', '--help'], + c = subprocess.Popen(['cargo', 'fmt', '--', '--help'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) return c.wait() == 0 @@ -29,6 +29,7 @@ def run_format_check(files): return 0 return subprocess.Popen(['cargo', 'fmt', '--', '--write-mode=diff', + '--skip-children', '--color=always'] + rust_files).wait()
fix: Skip over children in precommit hook
getsentry_semaphore
train
py
19d6b875a2fa460a58f5d445ebf3786a9c509686
diff --git a/examples/nas/multi-trial/mnist/search.py b/examples/nas/multi-trial/mnist/search.py index <HASH>..<HASH> 100644 --- a/examples/nas/multi-trial/mnist/search.py +++ b/examples/nas/multi-trial/mnist/search.py @@ -107,6 +107,7 @@ def evaluate_model(model_cls): device = torch.device('cuda') if torch.cuda.is_available() else torch.device('cpu') + model.to(device) for epoch in range(3): # train the model for one epoch train_epoch(model, device, train_loader, optimizer, epoch)
fix: model is not synced to device when not using CPU (#<I>)
Microsoft_nni
train
py
70cebfd3db8d1d43c7b83bf519eb3c37a30a3801
diff --git a/keanu-project/src/main/java/io/improbable/keanu/tensor/INDArrayShim.java b/keanu-project/src/main/java/io/improbable/keanu/tensor/INDArrayShim.java index <HASH>..<HASH> 100644 --- a/keanu-project/src/main/java/io/improbable/keanu/tensor/INDArrayShim.java +++ b/keanu-project/src/main/java/io/improbable/keanu/tensor/INDArrayShim.java @@ -45,12 +45,7 @@ public class INDArrayShim { * We have raised https://github.com/deeplearning4j/deeplearning4j/issues/6690 to address this */ public static void startNewThreadForNd4j() { - Thread nd4jInitThread = new Thread(new Runnable() { - @Override - public void run() { - Nd4j.create(1); - } - }); + Thread nd4jInitThread = new Thread(() -> Nd4j.create(1)); nd4jInitThread.start(); try { nd4jInitThread.join();
Use lambda to clean up ND4J thread workaround.
improbable-research_keanu
train
java
20cf0b0b005ab19a8b6b1fa870b3b04fdef5abf7
diff --git a/lib/post_install.js b/lib/post_install.js index <HASH>..<HASH> 100644 --- a/lib/post_install.js +++ b/lib/post_install.js @@ -11,6 +11,7 @@ function exec(command) { stat('dist-modules', function(error, stat) { if (error || !stat.isDirectory()) { + exec('npm i babel'); exec('npm run dist-modules'); } });
Install Babel before trying to generate `dist-modules` Otherwise it will rely on global Babel...
Stupidism_stupid-rc-starter
train
js
2069984357893273f806d374984ceffa95be80cf
diff --git a/views/js/ui/mediaplayer.js b/views/js/ui/mediaplayer.js index <HASH>..<HASH> 100644 --- a/views/js/ui/mediaplayer.js +++ b/views/js/ui/mediaplayer.js @@ -343,7 +343,10 @@ define([ showinfo: 0, wmode: 'transparent', modestbranding: 1, - disablekb: 1 + disablekb: 1, + playsinline: 1, + enablejsapi: 1, + origin: location.hostname }, events: { onReady: player.onReady.bind(player), @@ -387,7 +390,7 @@ define([ injectApi : function injectApi() { var self = this; if (!self.isApiReady()) { - require(['//www.youtube.com/iframe_api'], function() { + require(['https://www.youtube.com/iframe_api'], function() { var check = function() { if (!self.isApiReady()) { setTimeout(check, 100); @@ -1042,9 +1045,7 @@ define([ height = Math.max(defaults.minHeight, height); if (this.$component) { - this.$component.width(width); - height -= this.$component.outerHeight() - this.$component.height(); - width -= this.$component.outerWidth() - this.$component.width(); + this.$component.width(width).height(height); if (!this.is('nogui')) { height -= this.$controls.outerHeight();
mediaplayer: fix pixel gap at resize
oat-sa_tao-core
train
js
5e337a0feb53fbc674c064d1ef23947233b7177c
diff --git a/jaraco/itertools.py b/jaraco/itertools.py index <HASH>..<HASH> 100644 --- a/jaraco/itertools.py +++ b/jaraco/itertools.py @@ -14,7 +14,7 @@ import math import warnings import six -from six.moves import queue +from six.moves import queue, xrange as range import inflect from more_itertools import more @@ -788,7 +788,7 @@ def partition_items(count, bin_size): """ num_bins = int(math.ceil(count / float(bin_size))) bins = [0] * num_bins - for i in six.moves.xrange(count): + for i in range(count): bins[i % num_bins] += 1 return bins
Always prefer the 'range' name
jaraco_jaraco.itertools
train
py
a1d7a9612f9dee663adf2b0c077fa4c66716df4b
diff --git a/kitty/model/high_level/graph.py b/kitty/model/high_level/graph.py index <HASH>..<HASH> 100644 --- a/kitty/model/high_level/graph.py +++ b/kitty/model/high_level/graph.py @@ -190,9 +190,9 @@ class GraphModel(BaseModel): for key in skeys: for conn in self._graph[key]: t_hashed = conn.dst.hash() - self.logger.info('hash of template %s is %s' % (conn.dst.get_name(), t_hashed)) + self.logger.debug('hash of template %s is %s' % (conn.dst.get_name(), t_hashed)) hashed = khash(hashed, t_hashed) - self.logger.info('hash of model is %s' % hashed) + self.logger.debug('hash of model is %s' % hashed) return hashed def get_model_info(self):
[DataModel] GraphModel: relax debug prints of hashes
cisco-sas_kitty
train
py
186e5251bc3f34a15319fb4d142c7ba2712c3d33
diff --git a/drools-compiler/src/main/java/org/drools/compiler/testframework/TestingEventListener.java b/drools-compiler/src/main/java/org/drools/compiler/testframework/TestingEventListener.java index <HASH>..<HASH> 100644 --- a/drools-compiler/src/main/java/org/drools/compiler/testframework/TestingEventListener.java +++ b/drools-compiler/src/main/java/org/drools/compiler/testframework/TestingEventListener.java @@ -63,8 +63,6 @@ public class TestingEventListener implements AgendaEventListener { if (ruleNames.size() ==0) return true; String ruleName = match.getRule().getName(); - http://www.wtf.com - //jdelong: please don't want to see records of cancelled activations if (inclusive) {
Remove label from code (#<I>) This removed some comment/code fragment which happens to be valid Java syntax, but doesn't look like it really belongs here.
kiegroup_drools
train
java
580c9399d1a9fe43678ae83273244edfb7ba07d4
diff --git a/src/Codeception/Module/Silex.php b/src/Codeception/Module/Silex.php index <HASH>..<HASH> 100644 --- a/src/Codeception/Module/Silex.php +++ b/src/Codeception/Module/Silex.php @@ -12,7 +12,7 @@ use Symfony\Component\HttpKernel\Client; * Module for testing Silex applications like you would regularly do with Silex\WebTestCase. * This module uses Symfony2 Crawler and HttpKernel to emulate requests and get response. * - * This module may be considered experimental and require feedback and pull requests from you ) + * This module may be considered experimental and require feedback and pull requests from you. * * ## Status * @@ -30,7 +30,7 @@ use Symfony\Component\HttpKernel\Client; * Bootstrap is the same as [WebTestCase.createApplication](http://silex.sensiolabs.org/doc/testing.html#webtestcase). * * ``` php - * <? + * <?php * $app = require __DIR__.'/path/to/app.php'; * $app['debug'] = true; * unset($app['exception_handler']); @@ -100,7 +100,7 @@ class Silex extends Framework implements DoctrineProvider }); } - // some silex apps (like bolt) may rely on global $app variable + // some Silex apps (like Bolt) may rely on global $app variable $GLOBALS['app'] = $this->app; }
Make codeblock in Silex docs uniform in <?php use (#<I>)
Codeception_base
train
php
2a5561b39855b77411de2f29056f293d56405eef
diff --git a/ejb3/src/main/java/org/jboss/as/ejb3/remote/LocalEjbReceiver.java b/ejb3/src/main/java/org/jboss/as/ejb3/remote/LocalEjbReceiver.java index <HASH>..<HASH> 100644 --- a/ejb3/src/main/java/org/jboss/as/ejb3/remote/LocalEjbReceiver.java +++ b/ejb3/src/main/java/org/jboss/as/ejb3/remote/LocalEjbReceiver.java @@ -309,7 +309,7 @@ public class LocalEjbReceiver extends EJBReceiver { } public Object getResult() throws Exception { - throw (Exception) LocalEjbReceiver.clone(invocation.getInvokedMethod().getReturnType(), resultCloner, exception, allowPassByReference); + throw (Exception) LocalEjbReceiver.clone(resultCloner, exception); } public void discardResult() {
Fix issue with EJB exception cloning
wildfly_wildfly
train
java
b718e24fd8800deb668f3c6b5ff7989f7f1be058
diff --git a/Swat/SwatTile.php b/Swat/SwatTile.php index <HASH>..<HASH> 100644 --- a/Swat/SwatTile.php +++ b/Swat/SwatTile.php @@ -164,7 +164,7 @@ class SwatTile extends SwatCellRendererContainer $renderer->getBaseCSSClassNames()); $classes = array_merge($classes, - $renderer->getDataSpecificCSSClassNames()); + $renderer->getDataSpecificCSSClassNames()); $classes = array_merge($classes, $renderer->classes);
Fix tabbing svn commit r<I>
silverorange_swat
train
php
b0aded1382b9dbde1e7bfb9707798e3b8621d3d7
diff --git a/satpy/tests/test_resample.py b/satpy/tests/test_resample.py index <HASH>..<HASH> 100644 --- a/satpy/tests/test_resample.py +++ b/satpy/tests/test_resample.py @@ -90,10 +90,6 @@ class TestKDTreeResampler(unittest.TestCase): resampler.compute(data, fill_value=fill_value) resampler.resampler.get_sample_from_neighbour_info.assert_called_with(data, fill_value) - data.attrs = {'_FillValue': 8} - resampler.compute(data) - resampler.resampler.get_sample_from_neighbour_info.assert_called_with(data, fill_value) - class TestEWAResampler(unittest.TestCase): """Test EWA resampler class."""
Fix kdtree resampler test to not expect _FillValue to be used
pytroll_satpy
train
py
9eccb9bb1f4e7a0235d8ff0475d2b6b49b38a2e9
diff --git a/src/Hamlet/Bootstraps/SwooleBootstrap.php b/src/Hamlet/Bootstraps/SwooleBootstrap.php index <HASH>..<HASH> 100644 --- a/src/Hamlet/Bootstraps/SwooleBootstrap.php +++ b/src/Hamlet/Bootstraps/SwooleBootstrap.php @@ -20,15 +20,19 @@ class SwooleBootstrap * @param string $host * @param int $port * @param callable $applicationProvider + * @param callable|null $initializer * @return void */ - public static function run(string $host, int $port, callable $applicationProvider) + public static function run(string $host, int $port, callable $applicationProvider, callable $initializer = null) { $application = $applicationProvider(); if (!($application instanceof AbstractApplication)) { throw new RuntimeException('Application required'); } $server = new Server($host, $port); + if ($initializer !== null) { + $initializer($server); + } $server->on('request', function (SwooleRequest $swooleRequest, SwooleResponse $swooleResponse) use ($application) { $request = Request::fromSwooleRequest($swooleRequest); $writer = new SwooleResponseWriter($swooleResponse);
Adding initializer for swoole
vasily-kartashov_hamlet-core
train
php
edd15adbf0f43ecc86d844fb8a40ef45ac05cc24
diff --git a/lib/celluloid/version.rb b/lib/celluloid/version.rb index <HASH>..<HASH> 100644 --- a/lib/celluloid/version.rb +++ b/lib/celluloid/version.rb @@ -1,3 +1,3 @@ module Celluloid - VERSION = '0.17.0.pre3' + VERSION = '0.17.0.pre4' end
cutting pre4 after major refactor in celluloid-supervision
celluloid_celluloid
train
rb
8dd2d724de236c52d64a7db3743737f666af9ce6
diff --git a/src/plugin/exec.js b/src/plugin/exec.js index <HASH>..<HASH> 100644 --- a/src/plugin/exec.js +++ b/src/plugin/exec.js @@ -5,25 +5,33 @@ import { onlyPackage, exec as execCmd, separator, - log + log, + filter } from '../util' export const plugin = function exec (program, config, directory) { program.command(command).description(description) .option('-o, --only <packageName>', 'Only execute in a single package directory') + .option('-e, --exclude [packageNames...]', 'Exclude directories') .action((...args) => action(config, directory, ...args)) } const command = 'exec [command...]' const description = 'Execute a command in all packages' +function filterExclusions (packages, exclusions) { + return filter(packages, x => exclusions.indexOf(x) === -1, ) +} + // exported for testing export function action (config, workingDir, args, options) { isInitialized(config, 'exec') - const packages = options.only + const packages = filterExclusions(options.only ? onlyPackage(options.only, config.packages) : config.packages + , options.exclude || [] + ) if (packages.length === 0) { if (options.only) {
feat(northbrook): add option to exclude packages from exec
northbrookjs_northbrook
train
js
3208ac51e3af59fc6d9a8023d4d249384f9601fb
diff --git a/durastore/src/main/java/org/duracloud/durastore/rest/AuditLogRest.java b/durastore/src/main/java/org/duracloud/durastore/rest/AuditLogRest.java index <HASH>..<HASH> 100644 --- a/durastore/src/main/java/org/duracloud/durastore/rest/AuditLogRest.java +++ b/durastore/src/main/java/org/duracloud/durastore/rest/AuditLogRest.java @@ -15,6 +15,7 @@ import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.core.Response; +import org.duracloud.audit.reader.AuditLogEmptyException; import org.duracloud.audit.reader.AuditLogReader; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -56,9 +57,15 @@ public class AuditLogRest extends BaseRest { spaceId); return responseOkStream(auditLog); } catch (Exception e) { + log.error(MessageFormat.format("Error for account:{0}, storeId:{1}, spaceId:{2}", account, storeId, spaceId), e); - return responseBad(e); + + if(e instanceof AuditLogEmptyException){ + return responseNotFound("No audit logs found."); + }else{ + return responseBad(e); + } } }
ensures that empty logs return a <I> rather than <I> httpcode.
duracloud_duracloud
train
java
7efef86cdc3d952c5fec4f09d230d7b1218e9964
diff --git a/recsql/rest_table.py b/recsql/rest_table.py index <HASH>..<HASH> 100644 --- a/recsql/rest_table.py +++ b/recsql/rest_table.py @@ -18,7 +18,6 @@ the following additional restriction apply: * All row data must be on a single line. * Column spans are not supported. -* Neither additional '----' separators nor blank lines are supported. * Headings must be single legal SQL and python words as they are used as column names. * The delimiters are used to extract the fields. Only data within the @@ -80,6 +79,10 @@ TABLE = re.compile(""" ^(?P<botrule>[ \t]*==+[ \t=]+)[ \t]*$ # bottom rule """, re_FLAGS) +EMPTY_ROW = re.compile(""" + ^[-\s]*$ # white-space lines or '----' dividers are ignored (or '-- - ---') + """, re.VERBOSE) + # HEADER = re.compile(""" # ^[ \t]*Table(\[(?P<name>\w*)\])?:\s*(?P<title>[^\n]*)[ \t]*$ # title line required # [\n]+ @@ -138,6 +141,8 @@ class Table2array(object): self.parse_fields() records = [] for line in self.t['data'].split('\n'): + if EMPTY_ROW.match(line): + continue row = [besttype(line[start_field:end_field+1]) for start_field, end_field in self.fields] records.append(tuple(row))
removed restriction: ignores properly empty table lines and lines with dividers git-svn-id: svn+ssh://gonzo.med.jhmi.edu/scratch/svn/woolf_repository/users/oliver/Library/RecSQL@<I> df5ba8eb-4b0b-<I>-8c<I>-c<I>f<I>b<I>c
orbeckst_RecSQL
train
py
0e20c51c7f4ca34f5034b3ddea3f28177f86a324
diff --git a/lib/vagrant/action/builtin/provisioner_cleanup.rb b/lib/vagrant/action/builtin/provisioner_cleanup.rb index <HASH>..<HASH> 100644 --- a/lib/vagrant/action/builtin/provisioner_cleanup.rb +++ b/lib/vagrant/action/builtin/provisioner_cleanup.rb @@ -10,14 +10,23 @@ module Vagrant class ProvisionerCleanup include MixinProvisioners - def initialize(app, env) + def initialize(app, env, place=nil) @app = app @logger = Log4r::Logger.new("vagrant::action::builtin::provision_cleanup") + @place ||= :after + @place = @place.to_sym end def call(env) - @env = env + do_cleanup(env) if @place == :before + # Continue, we need the VM to be booted. + @app.call(env) + + do_cleanup(env) if @place == :after + end + + def do_cleanup(env) # Ask the provisioners to modify the configuration if needed provisioner_instances.each do |p| env[:ui].info(I18n.t( @@ -25,9 +34,6 @@ module Vagrant name: provisioner_type_map[p].to_s)) p.cleanup end - - # Continue, we need the VM to be booted. - @app.call(env) end end end
core: allow provisioner cleanup to happen after call
hashicorp_vagrant
train
rb
28179541c3f2e1247ce60ac80916276042928cb4
diff --git a/lib/publify_avatar_gravatar.rb b/lib/publify_avatar_gravatar.rb index <HASH>..<HASH> 100644 --- a/lib/publify_avatar_gravatar.rb +++ b/lib/publify_avatar_gravatar.rb @@ -32,7 +32,7 @@ module PublifyPlugins url = +"https://www.gravatar.com/avatar.php?" url << opts.map { |key, value| "#{key}=#{value}" }.sort.join("&") - tag "img", src: url, class: klass, alt: "Gravatar" + tag.img(src: url, class: klass, alt: "Gravatar") end end end diff --git a/publify_core/app/helpers/base_helper.rb b/publify_core/app/helpers/base_helper.rb index <HASH>..<HASH> 100644 --- a/publify_core/app/helpers/base_helper.rb +++ b/publify_core/app/helpers/base_helper.rb @@ -66,7 +66,7 @@ module BaseHelper end def meta_tag(name, value) - tag :meta, name: name, content: value if value.present? + tag.meta(name: name, content: value) if value.present? end def markup_help_popup(markup, text)
Autocorrect Rails/ContentTag
publify_publify
train
rb,rb
9c761fe27d747f6dbdbc3f920155fac8d6c9c004
diff --git a/test/tools/javac/7079713/TestCircularClassfile.java b/test/tools/javac/7079713/TestCircularClassfile.java index <HASH>..<HASH> 100644 --- a/test/tools/javac/7079713/TestCircularClassfile.java +++ b/test/tools/javac/7079713/TestCircularClassfile.java @@ -149,6 +149,7 @@ public class TestCircularClassfile { //step 3: move a classfile from the temp folder to the test subfolder File fileToMove = new File(tmpDir, tk.targetClass); File target = new File(destDir, tk.targetClass); + target.delete(); boolean success = fileToMove.renameTo(target); if (!success) {
<I>: tools/javac/<I>/TestCircularClassfile.java fails on windows Summary: delete file before renaming another file to it Reviewed-by: jjg
wmdietl_jsr308-langtools
train
java
a5d361f7c10a815cd901e2644c3c607acf05bdda
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100755 --- a/setup.py +++ b/setup.py @@ -200,6 +200,7 @@ if not ISRELEASED: import subprocess FULLVERSION += '.dev' + pipe = None for cmd in ['git','git.cmd']: try: pipe = subprocess.Popen([cmd, "describe", "--always"], @@ -210,7 +211,7 @@ if not ISRELEASED: except: pass - if pipe.returncode != 0: + if pipe is None or pipe.returncode != 0: warnings.warn("WARNING: Couldn't get git revision, using generic version string") else: rev = so.strip() @@ -218,7 +219,7 @@ if not ISRELEASED: if sys.version_info[0] >= 3: rev = rev.decode('ascii') - # use result og git describe as version string + # use result of git describe as version string FULLVERSION = rev.lstrip('v') else:
BLD: fixup setup.py, initialize pipe variable to None
pandas-dev_pandas
train
py
2e22b06548e22c9f276791c6d119ad11e570ac40
diff --git a/trackhub/test/test_parentonoff/test_parentonoff.py b/trackhub/test/test_parentonoff/test_parentonoff.py index <HASH>..<HASH> 100644 --- a/trackhub/test/test_parentonoff/test_parentonoff.py +++ b/trackhub/test/test_parentonoff/test_parentonoff.py @@ -69,5 +69,5 @@ def test_parentonoff(): results = hub.render() - assert( open( 'hg19/trackDb.txt').read() == open('expected/hg19/trackDb.txt').read() ) + assert( open( 'trackhub/test/test_parentonoff/hg19/trackDb.txt').read() == open('trackhub/test/test_parentonoff/expected/hg19/trackDb.txt').read() )
Changing the trackDb.txt path in test_parentonoff.py
daler_trackhub
train
py
b47b00e892827f578beba62a62e999b021b0efb3
diff --git a/lib/Resque/Worker.php b/lib/Resque/Worker.php index <HASH>..<HASH> 100755 --- a/lib/Resque/Worker.php +++ b/lib/Resque/Worker.php @@ -493,7 +493,7 @@ class Resque_Worker */ public function registerWorker() { - Resque::redis()->sadd('workers', (string)$this); + Resque::redis()->lpush('workers', (string)$this); Resque::redis()->set('worker:' . (string)$this . ':started', strftime('%a %b %d %H:%M:%S %Z %Y')); }
Store workers list in a List instead of a Set
wa0x6e_php-resque-ex
train
php
c43bc2b3d950b8028fd8e73a7052dcec6c5e19b7
diff --git a/src/DatabaseServiceProvider.php b/src/DatabaseServiceProvider.php index <HASH>..<HASH> 100644 --- a/src/DatabaseServiceProvider.php +++ b/src/DatabaseServiceProvider.php @@ -19,14 +19,14 @@ class DatabaseServiceProvider extends \Illuminate\Database\DatabaseServiceProvid // The connection factory is used to create the actual connection instances on // the database. We will inject the factory into the manager so that it may // make the connections while they are actually needed and not of before. - $this->app->bindShared('db.factory', function ($app) { + $this->app->singleton('db.factory', function ($app) { return new ConnectionFactory($app); }); // The database manager is used to resolve various connections, since multiple // connections might be managed. It also implements the connection resolver // interface which may be used by other components requiring connections. - $this->app->bindShared('db', function ($app) { + $this->app->singleton('db', function ($app) { return new DatabaseManager($app, $app['db.factory']); }); }
Replace usages of 'bindShared' with 'singleton'
bosnadev_database
train
php
bebb2dc7189ec5aa4fef92d77285ec09aa75e4fc
diff --git a/drivers/openstack/openstack.go b/drivers/openstack/openstack.go index <HASH>..<HASH> 100644 --- a/drivers/openstack/openstack.go +++ b/drivers/openstack/openstack.go @@ -384,14 +384,15 @@ func (d *Driver) Stop() error { } func (d *Driver) Remove() error { - log.WithField("MachineId", d.MachineId).Info("Deleting OpenStack instance...") + log.WithField("MachineId", d.MachineId).Debug("deleting instance...") + log.Info("Deleting OpenStack instance...") if err := d.initCompute(); err != nil { return err } if err := d.client.DeleteInstance(d); err != nil { return err } - log.WithField("Name", d.KeyPairName).Info("Deleting Key Pair...") + log.WithField("Name", d.KeyPairName).Debug("deleting key pair...") if err := d.client.DeleteKeyPair(d, d.KeyPairName); err != nil { return err }
show detailed messages only in debug for rackspace remove
docker_machine
train
go
7530e9236a9e88b306587c6c497d336eadc2c4a9
diff --git a/lib/cucumber/salad/widgets/widget.rb b/lib/cucumber/salad/widgets/widget.rb index <HASH>..<HASH> 100644 --- a/lib/cucumber/salad/widgets/widget.rb +++ b/lib/cucumber/salad/widgets/widget.rb @@ -90,6 +90,9 @@ module Cucumber const_set(Salad::WidgetName.new(name).to_sym, type) end + # @return The root node of the current widget + attr_reader :root + def_delegators :root, :click def initialize(settings = {}) @@ -117,7 +120,7 @@ module Cucumber private - attr_accessor :root + attr_writer :root def page Capybara.current_session
[widget] Make a widget's root node publicly available.
mojotech_capybara-ui
train
rb
2c9b25a94ac44702132a179db8380f63056841ac
diff --git a/src/FieldHandlers/BaseFileFieldHandler.php b/src/FieldHandlers/BaseFileFieldHandler.php index <HASH>..<HASH> 100644 --- a/src/FieldHandlers/BaseFileFieldHandler.php +++ b/src/FieldHandlers/BaseFileFieldHandler.php @@ -30,7 +30,7 @@ class BaseFileFieldHandler extends BaseFieldHandler /** * Limit of thumbnails to display */ - const THUMBNAIL_LIMIT = 3; + const THUMBNAIL_LIMIT = 6; /** * CSS Framework row html markup
Increasing number of file icons in the view (task #<I>)
QoboLtd_cakephp-csv-migrations
train
php
2906b5790e590a6cceb0116d89a5227994ced43b
diff --git a/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRActivity.java b/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRActivity.java index <HASH>..<HASH> 100644 --- a/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRActivity.java +++ b/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRActivity.java @@ -220,7 +220,7 @@ public class GVRActivity extends Activity implements IEventReceiver, IScriptable mDockEventReceiver.stop(); } - if (!mConfigurationManager.isDockListenerRequired()) { + if (null != mConfigurationManager && !mConfigurationManager.isDockListenerRequired()) { handleOnUndock(); }
framework: fix an unlikely NPE in GVRActivity.onDestroy (#<I>)
Samsung_GearVRf
train
java
64d0cbab9aa95fde068abebef1d5223b41ba49c1
diff --git a/javascript/HtmlEditorField.js b/javascript/HtmlEditorField.js index <HASH>..<HASH> 100644 --- a/javascript/HtmlEditorField.js +++ b/javascript/HtmlEditorField.js @@ -654,7 +654,7 @@ ss.editorWrappers['default'] = ss.editorWrappers.tinyMCE; .toggleClass('ui-state-disabled', !hasItems); // Hide file selection and step labels when editing an existing file - this.find('.header-select,.content-select,.header-edit')[editingSelected ? 'hide' : 'show'](); + this.find('#MediaFormInsertImageTabs,.header-edit')[editingSelected ? 'hide' : 'show'](); }, getFileView: function(idOrUrl) { return this.find('.ss-htmleditorfield-file[data-id=' + idOrUrl + ']');
BUGFIX: SSF-<I> hiding the insert image controls when editing an already inserted image.
silverstripe_silverstripe-framework
train
js
39fc3782487f46095ed33cd3ab15f9ce109b84bc
diff --git a/Gruntfile.js b/Gruntfile.js index <HASH>..<HASH> 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -61,6 +61,9 @@ module.exports = function(grunt) { files: { 'tmp/yuicompress.css': ['test/fixtures/style.less'] } + }, + nomatchedfiles: { + files: { "tmp/nomatchedfiles.css" : 'test/nonexistent/*.less' } } }, diff --git a/tasks/less.js b/tasks/less.js index <HASH>..<HASH> 100644 --- a/tasks/less.js +++ b/tasks/less.js @@ -39,7 +39,7 @@ module.exports = function(grunt) { if (files.length === 0) { // No src files, goto next target. Warn would have been issued above. - nextFileObj(); + return nextFileObj(); } var compiled = []; @@ -101,4 +101,4 @@ module.exports = function(grunt) { grunt.log.error(message); grunt.fail.warn('Error compiling LESS.'); }; -}; \ No newline at end of file +};
Fixes #<I>: Don't let async.forEachSeries overrun asyncforEachSeries' continue() callback must be the last executed statement or it will iterate past the last item in the collection. This will then cause 'f' to be undefined in that iteration.
gruntjs_grunt-contrib-less
train
js,js
fe3ca728a9aff4862dc90c7f6e6dac2e29dbf102
diff --git a/tilde/core/api.py b/tilde/core/api.py index <HASH>..<HASH> 100755 --- a/tilde/core/api.py +++ b/tilde/core/api.py @@ -11,6 +11,7 @@ import inspect import traceback import datetime import importlib +from functools import reduce from numpy import dot, array @@ -27,7 +28,7 @@ from sqlalchemy import exists, func from sqlalchemy.orm.exc import NoResultFound import ujson as json -from functools import reduce +import six class API: @@ -268,7 +269,7 @@ class API: except IOError: yield None, 'read error!' return - f = open(parsable, 'r') # open the file once again with right mode + f = open(parsable, 'r', errors='surrogateescape') if six.PY3 else open(parsable, 'r') # open the file once again with right mode f.seek(0) i, detected = 0, False while not detected:
workarounding binary file opening in Python3
tilde-lab_tilde
train
py
2b7cce384fa1de6846a4945d2a0b80de55ec8f55
diff --git a/raven/utils/serializer/base.py b/raven/utils/serializer/base.py index <HASH>..<HASH> 100644 --- a/raven/utils/serializer/base.py +++ b/raven/utils/serializer/base.py @@ -175,6 +175,6 @@ if not six.PY3: # register all serializers -for obj in globals().values(): +for obj in tuple(globals().values()): if (isinstance(obj, type) and issubclass(obj, Serializer) and obj is not Serializer): serialization_manager.register(obj)
Coerce globals to a tuple (fixes GH-<I>)
getsentry_raven-python
train
py
95a2c127f788e8e4356de7e83e8cc9149f2cb496
diff --git a/src/main/java/org/mariadb/jdbc/internal/protocol/AbstractConnectProtocol.java b/src/main/java/org/mariadb/jdbc/internal/protocol/AbstractConnectProtocol.java index <HASH>..<HASH> 100644 --- a/src/main/java/org/mariadb/jdbc/internal/protocol/AbstractConnectProtocol.java +++ b/src/main/java/org/mariadb/jdbc/internal/protocol/AbstractConnectProtocol.java @@ -1121,15 +1121,24 @@ public abstract class AbstractConnectProtocol implements Protocol { private void parseVersion() { String[] versionArray = serverVersion.split("[^0-9]"); + + //standard version + if (versionArray.length > 2) { + majorVersion = Integer.parseInt(versionArray[0]); + minorVersion = Integer.parseInt(versionArray[1]); + patchVersion = Integer.parseInt(versionArray[2]); + return; + } + + // in case version string has been forced if (versionArray.length > 0) { majorVersion = Integer.parseInt(versionArray[0]); } + if (versionArray.length > 1) { minorVersion = Integer.parseInt(versionArray[1]); } - if (versionArray.length > 2) { - patchVersion = Integer.parseInt(versionArray[2]); - } + } public int getMajorServerVersion() {
[misc] connection optimization (based on standard case)
MariaDB_mariadb-connector-j
train
java
fcebaf5b4c1bdaf60e8c867446d30534517159bd
diff --git a/tests/Base58Test.php b/tests/Base58Test.php index <HASH>..<HASH> 100644 --- a/tests/Base58Test.php +++ b/tests/Base58Test.php @@ -49,4 +49,42 @@ class Base58Tests extends PHPUnit_Framework_TestCase $this->assertSame($string, $base58->decode($encoded), "Testing {$encoded} decodes to {$string}."); } } + + /** + * @expectedException InvalidArgumentException + * @expectedExceptionMessage Argument $alphabet must be a string. + */ + public function testConstructorTypeException() + { + new Base58(intval(123)); + } + + /** + * @expectedException InvalidArgumentException + * @expectedExceptionMessage Argument $alphabet must contain 58 characters. + */ + public function testConstructorLengthException() + { + new Base58(''); + } + + /** + * @expectedException InvalidArgumentException + * @expectedExceptionMessage Argument $string must be a string. + */ + public function testEncodeTypeException() + { + $base58 = new Base58(); + $base58->encode(intval(123)); + } + + /** + * @expectedException InvalidArgumentException + * @expectedExceptionMessage Argument $base58 must be a string. + */ + public function testDecodeTypeException() + { + $base58 = new Base58(); + $base58->decode(intval(123)); + } }
Added exception tests to reach <I>% coverage.
stephen-hill_base58php
train
php
777458368fb73b7ad5afcaaef857d81df03b95cb
diff --git a/CHANGES.rst b/CHANGES.rst index <HASH>..<HASH> 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -130,9 +130,7 @@ v1.2.2 * Update pt_BR locale * Add raw check on post_save signal for GoogleAddress -v1.2.3 +v1.2.3[unreleased] ----------- * Add #get_country_code() to GoogleAddress - -v1.2.4[unreleased] ------------ +* Add id to SkillSerializer and CauseSerializer diff --git a/ovp_core/serializers/cause.py b/ovp_core/serializers/cause.py index <HASH>..<HASH> 100644 --- a/ovp_core/serializers/cause.py +++ b/ovp_core/serializers/cause.py @@ -4,5 +4,5 @@ from rest_framework import serializers class CauseSerializer(serializers.ModelSerializer): class Meta: - fields = ['name'] + fields = ['id', 'name'] model = models.Cause diff --git a/ovp_core/serializers/skill.py b/ovp_core/serializers/skill.py index <HASH>..<HASH> 100644 --- a/ovp_core/serializers/skill.py +++ b/ovp_core/serializers/skill.py @@ -4,5 +4,5 @@ from rest_framework import serializers class SkillSerializer(serializers.ModelSerializer): class Meta: - fields = ['name'] + fields = ['id', 'name'] model = models.Skill
Add id to SkillSerializer and CauseSerializer
OpenVolunteeringPlatform_django-ovp-core
train
rst,py,py
d831d9962282142e396f331d88cba88ef429a8ae
diff --git a/test/test_execute.py b/test/test_execute.py index <HASH>..<HASH> 100644 --- a/test/test_execute.py +++ b/test/test_execute.py @@ -1372,11 +1372,11 @@ depends: 'non-existent.txt' wf = script.workflow() self.assertRaises(Exception, Base_Executor(wf).run) - def testExecuteIPynb(self): - '''Test extracting and executing workflow from .ipynb files''' - script = SoS_Script(filename='sample_workflow.ipynb') - wf = script.workflow() - Base_Executor(wf).run() +# def testExecuteIPynb(self): +# '''Test extracting and executing workflow from .ipynb files''' +# script = SoS_Script(filename='sample_workflow.ipynb') +# wf = script.workflow() +# Base_Executor(wf).run() def testOutputReport(self): '''Test generation of report'''
Disable a test that is suspected to cause zoombie process
vatlab_SoS
train
py
694bdb5badfe15eada80395ba64f20641c07027f
diff --git a/test/msl-client-browser/spec/MSLTestSpec.js b/test/msl-client-browser/spec/MSLTestSpec.js index <HASH>..<HASH> 100644 --- a/test/msl-client-browser/spec/MSLTestSpec.js +++ b/test/msl-client-browser/spec/MSLTestSpec.js @@ -11,7 +11,7 @@ describe('Example suite', function() { setTimeout(function() { done(); - }, 100); + }, 200); }); afterEach(function() {
Added more timeout to beforeEach
FINRAOS_MSL
train
js
5f4d7909d45739198ff2e9b9a741dbaf723a5519
diff --git a/salt/modules/pip.py b/salt/modules/pip.py index <HASH>..<HASH> 100644 --- a/salt/modules/pip.py +++ b/salt/modules/pip.py @@ -341,9 +341,23 @@ def freeze(bin_env=None): return __salt__['cmd.run'](cmd).split('\n') -def list(name, bin_env=None): +def list(prefix='', bin_env=None): ''' - Filter list of instaslled apps from ``freeze`` and check to see if ``name`` + Filter list of instaslled apps from ``freeze`` and check to see if ``prefix`` exists in the list of packages installed. ''' - pass + packages = {} + cmd = '{0} freeze'.format(_get_pip_bin(bin_env)) + for line in __salt__['cmd.run'](cmd).split("\n"): + if len(line.split("==")) >= 2: + name = line.split("==")[0] + version = line.split("==")[1] + if prefix: + if line.lower().startswith(prefix.lower()): + packages[name]=version + else: + packages[name]=version + return packages + + +
adding list method for use in pip state
saltstack_salt
train
py
f562bd5c0719ae892f5869b7e12dc94e7900c89d
diff --git a/tests/test-json-users-controller.php b/tests/test-json-users-controller.php index <HASH>..<HASH> 100644 --- a/tests/test-json-users-controller.php +++ b/tests/test-json-users-controller.php @@ -6,7 +6,7 @@ * @package WordPress * @subpackage JSON API */ -class WP_Test_JSON_Users_Controller extends WP_Test_JSON_TestCase { +class WP_Test_JSON_Users_Controller extends WP_Test_JSON_Controller_Testcase { /** * This function is run before each method */ @@ -29,7 +29,7 @@ class WP_Test_JSON_Users_Controller extends WP_Test_JSON_TestCase { $this->assertArrayHasKey( '/wp/users/(?P<id>[\d]+)', $routes ); } - public function test_get_users() { + public function test_get_items() { wp_set_current_user( $this->user ); $request = new WP_JSON_Request; @@ -37,7 +37,7 @@ class WP_Test_JSON_Users_Controller extends WP_Test_JSON_TestCase { $this->check_get_users_response( $response ); } - public function test_get_user() { + public function test_get_item() { $user_id = $this->factory->user->create(); wp_set_current_user( $this->user );
Users controller extends Controller testcase And it's not yet compliant
WP-API_WP-API
train
php
b3dd57361a07c3acfff528147b7668eb7b874a31
diff --git a/openquake/hazardlib/tests/gsim/abrahamson_2018_test.py b/openquake/hazardlib/tests/gsim/abrahamson_2018_test.py index <HASH>..<HASH> 100644 --- a/openquake/hazardlib/tests/gsim/abrahamson_2018_test.py +++ b/openquake/hazardlib/tests/gsim/abrahamson_2018_test.py @@ -15,7 +15,11 @@ # # You should have received a copy of the GNU Affero General Public License # along with OpenQuake. If not, see <http://www.gnu.org/licenses/>. - +""" +Test case for the Abrahamson et al. (2018) "BC Hydro Update". Test tables +generated by hand using the Excel implementation provided as a supplement +to PEER Report 2018/02 +""" from openquake.hazardlib.gsim.abrahamson_2018 import ( AbrahamsonEtAl2018SInter, AbrahamsonEtAl2018SInterHigh,
Adds indication of source of test tables Former-commit-id: e<I>e<I>fc<I>ada<I>e8c4
gem_oq-engine
train
py
c4d19418820960becb2f4efc6a950f414f857f46
diff --git a/Annis-web/src/main/webapp/javascript/annis/SearchResultWindow.js b/Annis-web/src/main/webapp/javascript/annis/SearchResultWindow.js index <HASH>..<HASH> 100644 --- a/Annis-web/src/main/webapp/javascript/annis/SearchResultWindow.js +++ b/Annis-web/src/main/webapp/javascript/annis/SearchResultWindow.js @@ -250,15 +250,18 @@ Ext.onReady(function() { } }); + var gridViewSearchResult = new Ext.grid.GridView({ + ensureVisible: Ext.emptyFn + }); var gridSearchResult = new Ext.grid.GridPanel({ header: false, store: storeSearchResult, id: 'gridSearchResult', cm: cm, + view: gridViewSearchResult, viewConfig: { - enableRowBody: true, - showPreview: true + enableRowBody: true }, loadMask: true, collapsible: true,
- disable scrolling to row when clicking on it
korpling_ANNIS
train
js
db3bd3bc897624cfd081ef5622d019c1f976e02c
diff --git a/src/.stories/index.js b/src/.stories/index.js index <HASH>..<HASH> 100644 --- a/src/.stories/index.js +++ b/src/.stories/index.js @@ -590,8 +590,6 @@ storiesOf('General | Layout / Grid', module) }); }} onSortEnd={({nodes}) => { - console.log(nodes); - nodes.forEach(({node}) => { const wrapperNode = node.querySelector(`.${style.wrapper}`);
chore: remove console.log from grid story
clauderic_react-sortable-hoc
train
js
5e00b76fd622f3e5dac004b5d45adeaeea47d0f2
diff --git a/src/LiveDevelopment/Agents/RemoteFunctions.js b/src/LiveDevelopment/Agents/RemoteFunctions.js index <HASH>..<HASH> 100644 --- a/src/LiveDevelopment/Agents/RemoteFunctions.js +++ b/src/LiveDevelopment/Agents/RemoteFunctions.js @@ -649,6 +649,9 @@ function RemoteFunctions(experimental) { break; } }); + + // update highlight after applying diffs + redrawHighlights(); } /**
redraw highlights after modifying in-browser DOM
adobe_brackets
train
js
f3db28c94b50cff322d7b74ccd08d84dfaa651ce
diff --git a/test/requestinterception.spec.js b/test/requestinterception.spec.js index <HASH>..<HASH> 100644 --- a/test/requestinterception.spec.js +++ b/test/requestinterception.spec.js @@ -114,6 +114,20 @@ module.exports.addTests = function({testRunner, expect, CHROME}) { const response = await page.goto(server.EMPTY_PAGE); expect(response.ok()).toBe(true); }); + // @see https://github.com/GoogleChrome/puppeteer/issues/4337 + xit('should work with redirect inside sync XHR', async({page, server}) => { + await page.goto(server.EMPTY_PAGE); + server.setRedirect('/logo.png', '/pptr.png'); + await page.setRequestInterception(true); + page.on('request', request => request.continue()); + const status = await page.evaluate(async() => { + const request = new XMLHttpRequest(); + request.open('GET', '/logo.png', false); // `false` makes the request synchronous + request.send(null); + return request.status; + }); + expect(status).toBe(200); + }); it('should works with customizing referer headers', async({page, server}) => { await page.setExtraHTTPHeaders({ 'referer': server.EMPTY_PAGE }); await page.setRequestInterception(true);
test: add failing test for request interception with sync XHRs (#<I>) `Network.requestWillBeSent` is not issued for the redirect inside sync XHRs. References #<I>.
GoogleChrome_puppeteer
train
js
edf9fc528277a53ec37d1bd79fb4f8608cce11ae
diff --git a/lib/git/cmd.py b/lib/git/cmd.py index <HASH>..<HASH> 100644 --- a/lib/git/cmd.py +++ b/lib/git/cmd.py @@ -132,12 +132,12 @@ class Git(MethodMissingMixin): if len(k) == 1: if v is True: args.append("-%s" % k) - else: + elif type(v) is not bool: args.append("-%s%s" % (k, v)) else: if v is True: args.append("--%s" % dashify(k)) - else: + elif type(v) is not bool: args.append("--%s=%s" % (dashify(k), v)) return args
Git: guard against passing False to git commands git does not accept commands of the form: git cmd --xx=False or git cmd -xFalse This patch prevents transform_kwargs from producing command lines with those values. This adds some flexibility/syntactic sugar for callers since they can then assume that kwargs with a False value are not passed to git commands.
gitpython-developers_GitPython
train
py
f1b5bf43f77ea78991f708f9de352444be9183f5
diff --git a/packages/dva-core/src/createStore.js b/packages/dva-core/src/createStore.js index <HASH>..<HASH> 100644 --- a/packages/dva-core/src/createStore.js +++ b/packages/dva-core/src/createStore.js @@ -35,8 +35,8 @@ export default function ({ const enhancers = [ applyMiddleware(...middlewares), - devtools(window.__REDUX_DEVTOOLS_EXTENSION__OPTIONS), ...extraEnhancers, + devtools(window.__REDUX_DEVTOOLS_EXTENSION__OPTIONS), ]; return createStore(reducers, initialState, compose(...enhancers));
fix: redux devtools maybe effect other enhancers. <URL> )); ```
dvajs_dva
train
js
6283c0820fb536eb6474642189207295234408ce
diff --git a/src/NumPHP/Core/NumArray/Shape.php b/src/NumPHP/Core/NumArray/Shape.php index <HASH>..<HASH> 100644 --- a/src/NumPHP/Core/NumArray/Shape.php +++ b/src/NumPHP/Core/NumArray/Shape.php @@ -72,7 +72,7 @@ class Shape * @param array $data * @return array */ - protected function reshapeToVectorRecursive(array $data) + protected static function reshapeToVectorRecursive(array $data) { $vector = []; foreach ($data as $row) { @@ -90,7 +90,7 @@ class Shape * @param $shape * @return array */ - protected function reshapeRecursive(array $data, $shape) + protected static function reshapeRecursive(array $data, $shape) { if (count($shape) > 1) { $reshaped = [];
make reshapeToVectorRecursive and reshapeRecursive static
NumPHP_NumPHP
train
php
56a3db6da28ea5c0f7a73657939e2279096ece7b
diff --git a/core/testMinimumPhpVersion.php b/core/testMinimumPhpVersion.php index <HASH>..<HASH> 100644 --- a/core/testMinimumPhpVersion.php +++ b/core/testMinimumPhpVersion.php @@ -76,7 +76,7 @@ if (!function_exists('Piwik_ExitWithMessage')) { */ function Piwik_ShouldPrintBackTraceWithMessage() { - return defined('PIWIK_PRINT_ERROR_BACKTRACE'); + return defined('PIWIK_PRINT_ERROR_BACKTRACE') || define('PIWIK_TRACKER_DEBUG'); } /**
Output exception backtrace also if PIWIK_TRACKER_DEBUG is defined.
matomo-org_matomo
train
php
631c78e655359526e3a71c69cf275440f0e7c6bb
diff --git a/cmd/http/listen_nix.go b/cmd/http/listen_nix.go index <HASH>..<HASH> 100644 --- a/cmd/http/listen_nix.go +++ b/cmd/http/listen_nix.go @@ -27,6 +27,9 @@ import ( var cfg = &tcplisten.Config{ DeferAccept: true, FastOpen: true, + // Bump up the soMaxConn value from 128 to 2048 to + // handle large incoming concurrent requests. + Backlog: 2048, } // Unix listener with special TCP options.
Bump up soMaxConn backlog for listener to <I> (#<I>) soMaxConn value is <I> on almost all linux systems, this value is too low for Minio at times when used against large concurrent workload e.g: spark applications this causes a sort of SYN flooding observed by the kernel to allow for large backlog increase this value to <I>. With this value we do not see anymore SYN flooding kernel messages.
minio_minio
train
go
22c222bf75d6f1e1887e8c4ad2702d697e600141
diff --git a/lib/model/folder.go b/lib/model/folder.go index <HASH>..<HASH> 100644 --- a/lib/model/folder.go +++ b/lib/model/folder.go @@ -460,13 +460,8 @@ func (f *folder) scanSubdirs(subDirs []string) error { continue } - if batch.full() { - if err := batch.flush(); err != nil { - return err - } - snap.Release() - snap = f.fset.Snapshot() - alreadyUsed = make(map[string]struct{}) + if err := batch.flushIfFull(); err != nil { + return err } batch.append(res.File)
lib/model: Partial revert of rename fix (fixes #<I>) (#<I>) We can't just drop the snap because it's in use elsewhere. This should be equally functional.
syncthing_syncthing
train
go
a0c369af0d0588978afe6c38364b4350bcff0f54
diff --git a/lib/couch_potato/persistence/persister.rb b/lib/couch_potato/persistence/persister.rb index <HASH>..<HASH> 100644 --- a/lib/couch_potato/persistence/persister.rb +++ b/lib/couch_potato/persistence/persister.rb @@ -21,6 +21,10 @@ class Persister document._rev = nil end + def inspect + "#<Persister>" + end + private def create_document(document)
changed persister inspect so it won't show the list of cached uuids
langalex_couch_potato
train
rb
3a52676d2441101a9ee8449658a439434a3be66c
diff --git a/src/Friday/Helper/PHPParser.php b/src/Friday/Helper/PHPParser.php index <HASH>..<HASH> 100644 --- a/src/Friday/Helper/PHPParser.php +++ b/src/Friday/Helper/PHPParser.php @@ -18,6 +18,8 @@ namespace Friday\Helper; +use Exception; + class PHPParser { /**
Instantiated class Friday\Helper\Exception not found
ironphp_ironphp
train
php
e45c5009027c4f148b7a1d8791f19f7455284d03
diff --git a/src/MigrationTrait.php b/src/MigrationTrait.php index <HASH>..<HASH> 100644 --- a/src/MigrationTrait.php +++ b/src/MigrationTrait.php @@ -145,7 +145,9 @@ trait MigrationTrait { $data = $this->_csvDataToCsvObj($this->_csvData(true)); - $this->setFileAssociations($config, $data); + if (!empty($data[$config['table']])) { + $this->setFileAssociations($data[$config['table']]); + } $this->setFieldAssociations($config, $data); } @@ -153,13 +155,12 @@ trait MigrationTrait /** * Set associations with FileStorage table. * - * @param array $config The configuration for the Table. - * @param array $data All modules csv fields. + * @param array $data Current module csv fields. * @return void */ - protected function setFileAssociations(array $config, array $data) + protected function setFileAssociations(array $data) { - foreach ($data[$config['table']] as $fields) { + foreach ($data as $fields) { foreach ($fields as $field) { // skip non file or image types if (!in_array($field->getType(), ['files', 'images'])) {
Set file associations only if current module has migration fields (task #<I>)
QoboLtd_cakephp-csv-migrations
train
php
2f34ee7e58c47759cb6a5d3bea8940f0e5b2ed50
diff --git a/src/Render.php b/src/Render.php index <HASH>..<HASH> 100644 --- a/src/Render.php +++ b/src/Render.php @@ -106,7 +106,12 @@ class Render // maximum duration, otherwise a proxy/cache might keep the // cache twice as long in the worst case scenario, and now it's // only 50% max, but likely less - $response->setSharedMaxAge($this->cacheDuration() / 2); + // 's_maxage' sets the cache for shared caches. + // max_age sets it for regular browser caches + $response->setCache(array( + 'max_age' => $this->cacheDuration() / 2, + 's_maxage' => $this->cacheDuration() / 2 + )); } }
add in cache-control max age to go along with s-max-age directive
bolt_bolt
train
php
f901d5497d8f324950bbb80bc8cdbb486e49a67b
diff --git a/src/main/java/com/googlecode/lanterna/terminal/swing/SwingTerminal.java b/src/main/java/com/googlecode/lanterna/terminal/swing/SwingTerminal.java index <HASH>..<HASH> 100644 --- a/src/main/java/com/googlecode/lanterna/terminal/swing/SwingTerminal.java +++ b/src/main/java/com/googlecode/lanterna/terminal/swing/SwingTerminal.java @@ -171,6 +171,9 @@ public class SwingTerminal extends JComponent implements IOSafeTerminal { //noinspection unchecked setFocusTraversalKeys(KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS, Collections.EMPTY_SET); + //Make sure the component is double-buffered to prevent flickering + setDoubleBuffered(true); + addKeyListener(new TerminalInputListener()); addMouseListener(new MouseAdapter() { @Override
Try enabling double-buffer to reduce flickering
mabe02_lanterna
train
java
006789763fb3a93d21003c02bb359cb480bd9cd0
diff --git a/test/e2e/specs/wp-calypso-gutenberg-post-editor-spec.js b/test/e2e/specs/wp-calypso-gutenberg-post-editor-spec.js index <HASH>..<HASH> 100644 --- a/test/e2e/specs/wp-calypso-gutenberg-post-editor-spec.js +++ b/test/e2e/specs/wp-calypso-gutenberg-post-editor-spec.js @@ -790,7 +790,8 @@ describe( `[${ host }] Calypso Gutenberg Editor: Posts (${ screenSize })`, funct step( 'Can enter post title and content', async function() { const gEditorComponent = await GutenbergEditorComponent.Expect( driver ); await gEditorComponent.enterTitle( blogPostTitle ); - return await gEditorComponent.enterText( blogPostQuote ); + await gEditorComponent.enterText( blogPostQuote ); + return gEditorComponent.ensureSaved(); } ); step( 'Can trash the new post', async function() {
Fix trash post test by ensuring saved (#<I>)
Automattic_wp-calypso
train
js
fbb75ab5b4e581a4f081fcdb3fc58c6662e36493
diff --git a/tests/test_test.py b/tests/test_test.py index <HASH>..<HASH> 100644 --- a/tests/test_test.py +++ b/tests/test_test.py @@ -317,7 +317,7 @@ def test_follow_redirect_with_post_307(): response = Response('current url: %s' % req.url) else: response = redirect('http://localhost/some/redirect/', code=307) - return response(environ, start_response) + return response(environ, start_response) c = Client(redirect_with_post_307_app, response_wrapper=BaseResponse) resp = c.post('/', follow_redirects=True, data='foo=blub+hehe&blah=42')
Fix indentation level Probably happened when i was resolving conflicts.
pallets_werkzeug
train
py
ca37d154b59dbfb6d778fe40eb233c35e5fb329b
diff --git a/tests/Unit/Delivery/DynamicEntryTest.php b/tests/Unit/Delivery/DynamicEntryTest.php index <HASH>..<HASH> 100644 --- a/tests/Unit/Delivery/DynamicEntryTest.php +++ b/tests/Unit/Delivery/DynamicEntryTest.php @@ -135,6 +135,13 @@ class DynamicEntryTest extends \PHPUnit_Framework_TestCase $this->assertEquals('happycat', $entry->getBestFriend()->getId()); } + public function testIdGetter() + { + $entry = $this->entry; + + $this->assertEquals('happycat', $entry->getBestFriendId()); + } + public function testLinkResolution() { $ct = new ContentType(
Adds more test for DynamicEntry.
contentful_contentful.php
train
php
80fd0fa90441863886ec80486e64de45a3a70f48
diff --git a/spring-cloud-config-client/src/main/java/org/springframework/cloud/config/client/ConfigServicePropertySourceLocator.java b/spring-cloud-config-client/src/main/java/org/springframework/cloud/config/client/ConfigServicePropertySourceLocator.java index <HASH>..<HASH> 100644 --- a/spring-cloud-config-client/src/main/java/org/springframework/cloud/config/client/ConfigServicePropertySourceLocator.java +++ b/spring-cloud-config-client/src/main/java/org/springframework/cloud/config/client/ConfigServicePropertySourceLocator.java @@ -134,8 +134,8 @@ public class ConfigServicePropertySourceLocator implements PropertySourceLocator } if (properties.isFailFast()) { throw new IllegalStateException( - "Could not locate PropertySource and the fail fast property is set, failing", - error); + "Could not locate PropertySource and the fail fast property is set, failing" + + (errorBody == null ? "" : ": " + errorBody), error); } logger.warn("Could not locate PropertySource: " + (errorBody == null ? error == null ? "label not found" : error.getMessage()
Log more detailed error info when failfast=true and error happened (#<I>) * when failfast=true, client can log detailed error info
spring-cloud_spring-cloud-config
train
java
35e40d95b7c1b46a6da0d80f1e7c62bd914d52d8
diff --git a/twine/repository.py b/twine/repository.py index <HASH>..<HASH> 100644 --- a/twine/repository.py +++ b/twine/repository.py @@ -77,12 +77,19 @@ class Repository: @staticmethod def _make_adapter_with_retries() -> adapters.HTTPAdapter: - retry = urllib3.Retry( + retry_kwargs = dict( connect=5, total=10, - method_whitelist=["GET"], status_forcelist=[500, 501, 502, 503], ) + + try: + retry = urllib3.Retry(allowed_methods=["GET"], **retry_kwargs) + except TypeError: # pragma: no cover + # Avoiding DeprecationWarning starting in urllib3 1.26 + # Remove when that's the mininum version + retry = urllib3.Retry(method_whitelist=["GET"], **retry_kwargs) + return adapters.HTTPAdapter(max_retries=retry) @staticmethod
Avoid DeprecationWarning from urllib3 (#<I>) * Avoid DeprecationWarning from urllib3 * Don't use a version check * Add coverage of deprecated kwarg * Skip deprecation coverage
pypa_twine
train
py
75f14720738c16778e2d5671dc11ff6c99483ec3
diff --git a/gsheets/backend.py b/gsheets/backend.py index <HASH>..<HASH> 100644 --- a/gsheets/backend.py +++ b/gsheets/backend.py @@ -36,7 +36,8 @@ def iterfiles(service, name=None, mimeType=SHEET, order=FILEORDER): # noqa: N80 params['q'] = ' and '.join(q) while True: - response = service.files().list(**params).execute() + request = service.files().list(**params) + response = request.execute() for f in response['files']: yield f['id'], f['name'] try: @@ -62,7 +63,9 @@ def values(service, id, ranges): """Fetch and return spreadsheet cell values with Google sheets API.""" params = {'majorDimension': 'ROWS', 'valueRenderOption': 'UNFORMATTED_VALUE', - 'dateTimeRenderOption': 'FORMATTED_STRING'} - params.update(spreadsheetId=id, ranges=ranges) - response = service.spreadsheets().values().batchGet(**params).execute() + 'dateTimeRenderOption': 'FORMATTED_STRING', + 'spreadsheetId': id, + 'ranges': ranges} + request = service.spreadsheets().values().batchGet(**params) + response = request.execute() return response['valueRanges']
assign request object to facilitate debugging
xflr6_gsheets
train
py
3ef316bbb4a60b4d44fa7533a1a76113d127fdfd
diff --git a/src/org/jgroups/jmx/ResourceDMBean.java b/src/org/jgroups/jmx/ResourceDMBean.java index <HASH>..<HASH> 100755 --- a/src/org/jgroups/jmx/ResourceDMBean.java +++ b/src/org/jgroups/jmx/ResourceDMBean.java @@ -19,7 +19,7 @@ import java.util.Vector; * * @author Chris Mills * @author Vladimir Blagojevic - * @version $Id: ResourceDMBean.java,v 1.2 2008/03/06 00:50:17 vlada Exp $ + * @version $Id: ResourceDMBean.java,v 1.3 2008/03/06 01:03:54 vlada Exp $ * @see ManagedAttribute * @see ManagedOperation * @see MBean @@ -69,7 +69,10 @@ public class ResourceDMBean implements DynamicMBean { false)); } //walk class hierarchy and find all fields - for(Class<?> clazz=obj.getClass();clazz != null;clazz=clazz.getSuperclass()) { + for(Class<?> clazz=obj.getClass(); + clazz != null && clazz.isAnnotationPresent(MBean.class); + clazz=clazz.getSuperclass()) { + Field[] fields=clazz.getDeclaredFields(); for(Field field:fields) { ManagedAttribute attr=field.getAnnotation(ManagedAttribute.class);
limit field traversal to annotated beans
belaban_JGroups
train
java
3b44677bff3541723b0c3d5e9e4e9f48416e1ff4
diff --git a/src/Foundation/Providers/MenuServiceProvider.php b/src/Foundation/Providers/MenuServiceProvider.php index <HASH>..<HASH> 100644 --- a/src/Foundation/Providers/MenuServiceProvider.php +++ b/src/Foundation/Providers/MenuServiceProvider.php @@ -88,7 +88,6 @@ class MenuServiceProvider extends ServiceProvider 'divider' => false, ]; - $errorMenu = [ 'slug' => 'logs', 'icon' => 'fa fa-bug', @@ -188,7 +187,6 @@ class MenuServiceProvider extends ServiceProvider $dashboard->menu->add('Systems', 'dashboard::partials.leftMenu', $backupMenu, 2); - $dashboard->menu->add('Systems', 'dashboard::partials.leftMenu', $usersMenu, 501); $dashboard->menu->add('Systems', 'dashboard::partials.leftMenu', $groupsMenu, 601); }
Apply fixes from StyleCI (#<I>) [ci skip] [skip ci]
orchidsoftware_platform
train
php