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
615cbc778f3d1d32fb2a62b5da97bdbf9da15112
diff --git a/docs/pages/upgradeGuide/index.js b/docs/pages/upgradeGuide/index.js index <HASH>..<HASH> 100644 --- a/docs/pages/upgradeGuide/index.js +++ b/docs/pages/upgradeGuide/index.js @@ -264,6 +264,32 @@ const customFilter = createFilter({ See the [Advanced Guide](/advanced) for more details and examples. +## Storing strings with non multi select + +React-select v1 allowed to use strings for the \`value\` prop, but with v2 it +uses arrays or objects in all the cases. If you still want to use strings you +can easily do so by filtering the value out off all your options: + +~~~js +const options = [ + {name: 'John', id: 1}, + {name: 'Doe', id: 2}, +] +return ( + <ReactSelect + options={options} + value={options.filter(({id}) => id === this.state.id)} + getOptionLabel={({name}) => name} + getOptionValue={({id}) => id} + onChange={({value}) => this.setState({id: value})} + /> +) +~~~ + +Note that if you use the default react-select options schema (an array with +objects having \`label\` and \`value\` keys) you don't need to define +\`getOptionValue\` nor \`getOptionLabel\`. + ## Prop Update Guide `} <PropChanges />
Update docs to add the single-value stored as string use case closes #<I>
JedWatson_react-select
train
js
f946ee90c0299bac5117bb9b100a9028efe3ef87
diff --git a/lib/songbirdsh/player.rb b/lib/songbirdsh/player.rb index <HASH>..<HASH> 100644 --- a/lib/songbirdsh/player.rb +++ b/lib/songbirdsh/player.rb @@ -39,7 +39,7 @@ module Songbirdsh puts "track with id #{id} did not refer to a file" next end - puts "playing #{id.to_s(32)}: \"#{path}\"" + puts "playing #{id.to_s(36)}: \"#{path}\"" player_pid = path.to_player Process.wait player_pid end
fixed minor issue with reporting base <I> numbers (instead of <I>)
markryall_songbirdsh
train
rb
b4c62e6e3af1f7bc79d9b4509603a2c6d96b72e1
diff --git a/packages/tabs/src/Tab.js b/packages/tabs/src/Tab.js index <HASH>..<HASH> 100644 --- a/packages/tabs/src/Tab.js +++ b/packages/tabs/src/Tab.js @@ -98,7 +98,7 @@ Tab.propTypes = { /** * Sets the label of a tab */ - label: PropTypes.string, + label: PropTypes.node, /** * Function to modify the component's styles */ diff --git a/packages/tabs/src/presenters/TabPresenter.js b/packages/tabs/src/presenters/TabPresenter.js index <HASH>..<HASH> 100644 --- a/packages/tabs/src/presenters/TabPresenter.js +++ b/packages/tabs/src/presenters/TabPresenter.js @@ -142,7 +142,7 @@ export default function TabPresenter({ TabPresenter.propTypes = { active: PropTypes.bool, - label: PropTypes.string, + label: PropTypes.node, icon: PropTypes.node, disabled: PropTypes.bool, closable: PropTypes.bool,
feat: Tab label to accept a node
Autodesk_hig
train
js,js
3e137c1de61c0f23028ef4fbd5b5e05248c0d444
diff --git a/src/GameQ/Filters/Normalize.php b/src/GameQ/Filters/Normalize.php index <HASH>..<HASH> 100644 --- a/src/GameQ/Filters/Normalize.php +++ b/src/GameQ/Filters/Normalize.php @@ -81,7 +81,6 @@ class Normalize extends Base } $data['filtered'][$server->id()] = $result; - file_put_contents('/home/gameqv3/css_1.json', json_encode($data)); // Return the normalized result return $result;
Removed debug that was missed.
Austinb_GameQ
train
php
7ecc8715fd631f3e9f90afde085e62e34d086a9a
diff --git a/src/main/java/com/tomgibara/bits/BitStore.java b/src/main/java/com/tomgibara/bits/BitStore.java index <HASH>..<HASH> 100644 --- a/src/main/java/com/tomgibara/bits/BitStore.java +++ b/src/main/java/com/tomgibara/bits/BitStore.java @@ -547,6 +547,7 @@ public interface BitStore extends Mutability<BitStore>, Comparable<BitStore> { default int compareNumericallyTo(BitStore that) { if (this == that) return 0; // cheap check + if (that == null) throw new IllegalArgumentException("that"); return Bits.compareNumeric(this, that); }
Guards against null comparator.
tomgibara_bits
train
java
0082ae4cf74108740739aa05ebd897ff410e77ef
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -12,7 +12,7 @@ setup( packages=find_packages(), include_package_data=True, install_requires=[ - 'vr.runners>=2.8', + 'vr.runners>=2.10,<3', 'path.py>=7.1', 'yg.lockfile', 'jaraco.itertools',
Bumping vr.runners
yougov_vr.builder
train
py
08eacc12c902418777be1f6fe8f5610885860473
diff --git a/provision/docker/containers_test.go b/provision/docker/containers_test.go index <HASH>..<HASH> 100644 --- a/provision/docker/containers_test.go +++ b/provision/docker/containers_test.go @@ -7,6 +7,7 @@ package docker import ( "io/ioutil" "net/http" + "regexp" "strings" dtesting "github.com/fsouza/go-dockerclient/testing" @@ -99,8 +100,14 @@ func (s *S) TestMoveContainersUnknownDest(c *check.C) { parts := strings.Split(buf.String(), "\n") c.Assert(parts, check.HasLen, 6) c.Assert(parts[0], check.Matches, ".*Moving 2 units.*") - c.Assert(parts[3], check.Matches, "(?s).*Error moving unit.*Caused by:.*unknown.*not found") - c.Assert(parts[4], check.Matches, "(?s).*Error moving unit.*Caused by:.*unknown.*not found") + var matches int + errorRegexp := regexp.MustCompile(`(?s).*Error moving unit.*Caused by:.*unknown.*not found`) + for _, line := range parts[2:] { + if errorRegexp.MatchString(line) { + matches++ + } + } + c.Assert(matches, check.Equals, 2) } func (s *S) TestMoveContainer(c *check.C) {
provision/docker: make test more reliable The containers are moved in parallel, so we cannot guarantee the order of the messages, here's what happens: - the first message is always "Moving 2 units" - the second message is always "Moving unit 1... from localhost -> unknown" - the third message might be "Moving unit 2... from localhost -> unknown" or "Error moving unit 1..." That's why I'm checking whether the error message happens twice, starting in the third log line.
tsuru_tsuru
train
go
4b51878c84c4a2ad614cdc6fb88c3307ebc99682
diff --git a/lib/models.js b/lib/models.js index <HASH>..<HASH> 100644 --- a/lib/models.js +++ b/lib/models.js @@ -717,6 +717,7 @@ class ContentProfileRule { constructor(path = []) { this._path = path; // Identifier[] this._mustSupport = false; // boolean + this._noProfile = false; // boolean } // path is the array of Identifiers (namespace+name) corresponding to the field/path this rule applies to get path() { return this._path; } @@ -732,16 +733,23 @@ class ContentProfileRule { return this; } + get noProfile() { return this._noProfile; } + set noProfile(noProfile) { + this._noProfile = noProfile; + } + clone() { const clone = new ContentProfileRule(this._path.map(id => id.clone())); clone.mustSupport = this._mustSupport; + clone.noProfile = this._noProfile; return clone; } toJSON() { var output = { 'path': this.path.map(id => id.name).join('.'), - 'mustSupport': this.mustSupport + 'mustSupport': this.mustSupport, + 'noProfile': this.noProfile }; clearEmptyFields(output, true);
Added no profile to ContentProfileRule class
standardhealth_shr-models
train
js
f84f9cf1846554a13f388693220378edb8d17be6
diff --git a/dvc/fs/base.py b/dvc/fs/base.py index <HASH>..<HASH> 100644 --- a/dvc/fs/base.py +++ b/dvc/fs/base.py @@ -273,7 +273,7 @@ class FileSystem: callback: FsspecCallback = DEFAULT_CALLBACK, **kwargs, ) -> None: - size = kwargs.get("size") + size = kwargs.pop("size") if size: callback.set_size(size) if hasattr(from_file, "read"):
fs: do not pass size to underlying fs.put_file
iterative_dvc
train
py
4195453da13a844cd952f9a4023813f2f840326c
diff --git a/h2o-py/tests/testdir_jira/pyunit_pubdev_5352.py b/h2o-py/tests/testdir_jira/pyunit_pubdev_5352.py index <HASH>..<HASH> 100644 --- a/h2o-py/tests/testdir_jira/pyunit_pubdev_5352.py +++ b/h2o-py/tests/testdir_jira/pyunit_pubdev_5352.py @@ -13,6 +13,10 @@ def pubdev_5352(): drf_checkpoint = H2ORandomForestEstimator(model_id='drf_checkpoint',checkpoint=drf, ntrees=4, seed=1234) drf_checkpoint.train(x=predictors, y=target, training_frame=new_data) + assert drf_checkpoint.ntrees == 4 + + + if __name__ == "__main__": pyunit_utils.standalone_test(pubdev_5352)
Final checkpointed model number of trees assertion added
h2oai_h2o-3
train
py
b0386b9ab5e02d46562e368d53e6408d62df9602
diff --git a/src/sentry_plugins/__init__.py b/src/sentry_plugins/__init__.py index <HASH>..<HASH> 100644 --- a/src/sentry_plugins/__init__.py +++ b/src/sentry_plugins/__init__.py @@ -3,5 +3,23 @@ from __future__ import absolute_import try: VERSION = __import__('pkg_resources') \ .get_distribution('sentry-plugins').version -except Exception, e: +except Exception as e: VERSION = 'unknown' + +# Try to hook our webhook watcher into the rest of the watchers +# iff this module is installed in editable mode. +if 'site-packages' not in __file__: + import os + + root = os.path.normpath(os.path.join(os.path.dirname(__file__), os.pardir, os.pardir)) + node_modules = os.path.join(root, 'node_modules') + + if os.path.isdir(node_modules): + from django.conf import settings + settings.SENTRY_WATCHERS += ( + ('webpack.plugins', [ + os.path.join(node_modules, '.bin', 'webpack'), + '--output-pathinfo', '--watch', + '--config={}'.format(os.path.join(root, 'webpack.config.js')), + ]), + )
Auto hook up webpack watcher process for `devserver`
getsentry_sentry-plugins
train
py
4f9ce8324b989d55deeae7b7880c01c714fc9edb
diff --git a/hazelcast/src/main/java/com/hazelcast/config/MapStoreConfig.java b/hazelcast/src/main/java/com/hazelcast/config/MapStoreConfig.java index <HASH>..<HASH> 100644 --- a/hazelcast/src/main/java/com/hazelcast/config/MapStoreConfig.java +++ b/hazelcast/src/main/java/com/hazelcast/config/MapStoreConfig.java @@ -305,7 +305,7 @@ public class MapStoreConfig { * Default value is {@value #DEFAULT_WRITE_COALESCING}. * * @param writeCoalescing {@code true} to enable write-coalescing, {@code false} otherwise. - * @see com.hazelcast.instance.GroupProperties.GroupProperty#MAP_WRITE_BEHIND_QUEUE_CAPACITY + * @see com.hazelcast.instance.GroupProperty#MAP_WRITE_BEHIND_QUEUE_CAPACITY */ public void setWriteCoalescing(boolean writeCoalescing) { this.writeCoalescing = writeCoalescing;
Fixed wrong package name in JavaDoc of MapStoreConfig.
hazelcast_hazelcast
train
java
34f9f41628273d1554760f85414eb326aaea605e
diff --git a/lib/puppet/parser/resource.rb b/lib/puppet/parser/resource.rb index <HASH>..<HASH> 100644 --- a/lib/puppet/parser/resource.rb +++ b/lib/puppet/parser/resource.rb @@ -66,6 +66,8 @@ class Puppet::Parser::Resource < Puppet::Resource # is drawn from the class to the stage. The stage for containment # defaults to main, if none is specified. def add_edge_to_stage + return unless self.type.to_s.downcase == "class" + unless stage = catalog.resource(:stage, self[:stage] || (scope && scope.resource && scope.resource[:stage]) || :main) raise ArgumentError, "Could not find stage #{self[:stage] || :main} specified by #{self}" end
Maint: Fix a #<I> introduced log inconsistency When we moved code from the compiler to parser/resource, we lost a conditional that prevented defined resources from gaining containment edges to stages. Adding a stage to a defined resource was usually harmless, but it violated the invariant of "resources should only have exactly one container as their direct parent", producing a <I>% chance of a malformed containment path in log messages.
puppetlabs_puppet
train
rb
19b8878f5de75ecd7ab1c02d128bc89469739503
diff --git a/raven/transport.py b/raven/transport.py index <HASH>..<HASH> 100644 --- a/raven/transport.py +++ b/raven/transport.py @@ -80,9 +80,6 @@ class UDPTransport(Transport): udp_socket = None def compute_scope(self, url, scope): - netloc = url.hostname - netloc += ':%s' % url.port - path_bits = url.path.rsplit('/', 1) if len(path_bits) > 1: path = path_bits[0] @@ -90,9 +87,12 @@ class UDPTransport(Transport): path = '' project = path_bits[-1] - if not all([netloc, project, url.username, url.password]): + if not all([url.port, project, url.username, url.password]): raise ValueError('Invalid Sentry DSN: %r' % url.geturl()) + netloc = url.hostname + netloc += ':%s' % url.port + server = '%s://%s%s/api/store/' % (url.scheme, netloc, path) scope.update({ 'SENTRY_SERVERS': [server],
Throw an error if a port is not specified in the UDP transport
elastic_apm-agent-python
train
py
6959e1ab4e2d44a0722960e6c4acb7ab2d1080f7
diff --git a/geist/backends/_x11_common.py b/geist/backends/_x11_common.py index <HASH>..<HASH> 100644 --- a/geist/backends/_x11_common.py +++ b/geist/backends/_x11_common.py @@ -51,11 +51,12 @@ class GeistXBase(object): def display(self): return self._display - def create_process(self, command, shell=True, stdout=None, stderr=None): + def create_process(self, command, shell=True, stdout=None, stderr=None, + env=None): """ Execute a process using subprocess.Popen, setting the backend's DISPLAY """ - env = kwargs.pop('env', dict(os.environ)) + env = env if env is not None else dict(os.environ) env['DISPLAY'] = self.display return subprocess.Popen(command, shell=shell, stdout=stdout, stderr=stderr,
Take env as a specific kwarg
ten10solutions_Geist
train
py
9bdf9098964d380e758a084f58f1c45b5131cae3
diff --git a/Tests/LocaleTest.php b/Tests/LocaleTest.php index <HASH>..<HASH> 100644 --- a/Tests/LocaleTest.php +++ b/Tests/LocaleTest.php @@ -11,7 +11,6 @@ namespace Symfony\Component\Locale\Tests; -use Symfony\Component\Intl\Intl; use Symfony\Component\Intl\Util\IntlTestHelper; use Symfony\Component\Locale\Locale;
Fix phpdoc and coding standards This removes the unused use statements which were not catched by PHP-CS-Fixer because of string occurences. It also fixes some invalid phpdoc (scalar is not recognized as a valid type for instance).
symfony_locale
train
php
b8be517be08c5d7b42315ac1af7da23d978d5f9f
diff --git a/moto/organizations/models.py b/moto/organizations/models.py index <HASH>..<HASH> 100644 --- a/moto/organizations/models.py +++ b/moto/organizations/models.py @@ -157,6 +157,11 @@ class OrganizationsBackend(BaseBackend): return self.org.describe() def describe_organization(self): + if not self.org: + raise RESTError( + 'AWSOrganizationsNotInUseException', + "Your account is not a member of an organization." + ) return self.org.describe() def list_roots(self):
organizations support: add exception handling for describe_organizations
spulec_moto
train
py
966dccef77470cf6235a521daba5a4cfddfe8b4c
diff --git a/src/Environment.php b/src/Environment.php index <HASH>..<HASH> 100644 --- a/src/Environment.php +++ b/src/Environment.php @@ -48,7 +48,7 @@ class Environment $this->identifyHostname(); // Identifies the current hostname, sets the binding using the native resolving strategy. $this->app->make(CurrentHostname::class); - } elseif($this->installed() && !$this->app->bound(CurrentHostname::class)) { + } elseif ($this->installed() && !$this->app->bound(CurrentHostname::class)) { $this->app->singleton(CurrentHostname::class, null); } }
Apply fixes from StyleCI (#<I>)
tenancy_multi-tenant
train
php
b6d927711ead945e3199546773689ac9a0d8d862
diff --git a/src/ListensForStorageOpportunities.php b/src/ListensForStorageOpportunities.php index <HASH>..<HASH> 100644 --- a/src/ListensForStorageOpportunities.php +++ b/src/ListensForStorageOpportunities.php @@ -85,7 +85,9 @@ trait ListensForStorageOpportunities if (empty(static::$processingJobs)) { static::store($app[EntriesRepository::class]); - static::stopRecording(); + if (! $app->make('queue.connection') instanceof SyncQueue) { + static::stopRecording(); + } } } }
Avoid jobs recording stop if queue driver is sync
laravel_telescope
train
php
9b6e3f25cd60fecca26845c9caf9c05c6a373487
diff --git a/client.go b/client.go index <HASH>..<HASH> 100644 --- a/client.go +++ b/client.go @@ -856,13 +856,6 @@ func (me *Client) downloadedChunk(t *torrent, c *connection, msg *pp.Message) er } me.dataReady(dataSpec{t.InfoHash, req}) - // Cancel pending requests for this chunk. - for _, c := range t.Conns { - if me.connCancel(t, c, req) { - me.replenishConnRequests(t, c) - } - } - // Record that we have the chunk. delete(t.Pieces[req.Index].PendingChunkSpecs, req.chunkSpec) if len(t.Pieces[req.Index].PendingChunkSpecs) == 0 { @@ -878,6 +871,14 @@ func (me *Client) downloadedChunk(t *torrent, c *connection, msg *pp.Message) er } } + // Cancel pending requests for this chunk. + for _, c := range t.Conns { + if me.connCancel(t, c, req) { + log.Print("cancelled concurrent request for %s", req) + me.replenishConnRequests(t, c) + } + } + return nil }
Reorder actions after a chunk is received
anacrolix_torrent
train
go
11d3174579ff34e29b6facf1037165a4bf05cd38
diff --git a/src/greplin/scales/graphite.py b/src/greplin/scales/graphite.py index <HASH>..<HASH> 100644 --- a/src/greplin/scales/graphite.py +++ b/src/greplin/scales/graphite.py @@ -84,7 +84,7 @@ class GraphitePusher(object): value = None logging.exception('Error when calling stat function for graphite push') if self._forbidden(subpath, value): - break + continue else: if type(value) in [int, long, float] and len(name) < 500: self.graphite.log(prefix + self._sanitize(name), value)
Graphite pusher bugfix Previously the first forbidden key would disqualify all other keys in that stat.
Cue_scales
train
py
0028c1c3159bdb668c1a119ec0bdbf5e24e7ff65
diff --git a/proton-c/bindings/python/proton/utils.py b/proton-c/bindings/python/proton/utils.py index <HASH>..<HASH> 100644 --- a/proton-c/bindings/python/proton/utils.py +++ b/proton-c/bindings/python/proton/utils.py @@ -109,12 +109,12 @@ class BlockingReceiver(BlockingLink): if credit: receiver.flow(credit) self.fetcher = fetcher - def fetch(self, timeout=False): + def receive(self, timeout=False): if not self.fetcher: - raise Exception("Can't call fetch on this receiver as a handler was provided") + raise Exception("Can't call receive on this receiver as a handler was provided") if not self.link.credit: self.link.flow(1) - self.connection.wait(lambda: self.fetcher.has_message, msg="Fetching on receiver %s" % self.link.name, timeout=timeout) + self.connection.wait(lambda: self.fetcher.has_message, msg="Receiving on receiver %s" % self.link.name, timeout=timeout) return self.fetcher.pop() def accept(self):
Changed name of method from fetch to receive
apache_qpid-proton
train
py
da96a603a4720b85cef1ff595fb600bc8db35334
diff --git a/template/config.js b/template/config.js index <HASH>..<HASH> 100644 --- a/template/config.js +++ b/template/config.js @@ -1,16 +1,16 @@ var config = { - param1: '', // example - param2: process.env.NODE_ENV === 'production' ? 'foo' : 'bar', // example - git: { - remoteList: ['origin', 'heroku'] // add any other remotes here - }, - app_name: 'reactatouille Boilerplate', // your app name here - build_name: 'Reactatouille Boilerplate' + ' | ' + (process.env.NODE_ENV || 'development') + ' | ' + '201702062335' + param1: '', // example + param2: process.env.NODE_ENV === 'production' ? 'foo' : 'bar', // example + git: { + remoteList: ['origin', 'heroku'] // add any other remotes here + }, + app_name: 'reactatouille Boilerplate', // your app name here + build_name: 'Reactatouille Boilerplate' + ' | ' + (process.env.NODE_ENV || 'development') + ' | ' + '201702062335' } // Modified production configuration parameters if (process.env.NODE_ENV === 'production') { - config.param1 = 'valueProduction'; + config.param1 = 'valueProduction' } -module.exports = config; +module.exports = config
modified the config js according to standardjs
heldrida_reactatouille-boilerplate
train
js
14bc5bd75077a48e0486288dccde7d2b51ce841f
diff --git a/src/layouts/ltrTreeLayout/ranker.js b/src/layouts/ltrTreeLayout/ranker.js index <HASH>..<HASH> 100644 --- a/src/layouts/ltrTreeLayout/ranker.js +++ b/src/layouts/ltrTreeLayout/ranker.js @@ -54,7 +54,7 @@ function normalizeRanks (graph) { } } -function forcePrimaryRankPromotions (graph, entryNodeName) { +function forcePrimaryRankPromotions (graph, entryNodeName = 'INTERNET') { let entryNodes = graph.entryNodes(); if (entryNodeName) { if (entryNodes.includes(entryNodeName)) { @@ -67,7 +67,7 @@ function forcePrimaryRankPromotions (graph, entryNodeName) { } } -function forceSecondaryRankPromotions (graph, entryNodeName) { +function forceSecondaryRankPromotions (graph, entryNodeName = 'INTERNET') { let entryNodes = graph.entryNodes(); if (entryNodeName) { if (entryNodes.includes(entryNodeName)) {
Use 'INTERNET' as default entryNodeName for backward compatibility
Netflix_vizceral
train
js
0f1cdef21d8c991a82fc6b5dc7f4e7feb225f953
diff --git a/src/test/java/water/JUnitRunner.java b/src/test/java/water/JUnitRunner.java index <HASH>..<HASH> 100644 --- a/src/test/java/water/JUnitRunner.java +++ b/src/test/java/water/JUnitRunner.java @@ -1,6 +1,6 @@ package water; -import hex.NeuralNetSpiralsTest; +import hex.*; import org.apache.commons.lang.ArrayUtils; import org.junit.Ignore; import org.junit.Test; @@ -36,6 +36,7 @@ public class JUnitRunner { tests.remove(ConcurrentKeyTest.class); tests.remove(ValueArrayToFrameTestAll.class); tests.remove(NeuralNetSpiralsTest.class); + tests.remove(NeuralNetIrisTest.class); // Pure JUnit test // tests.remove(CBSChunkTest.class); //tests.remove(GBMDomainTest.class);
Disable NeuralNet Iris comparison against reference. Already done indirectly by comparing against NN, which is compared against the reference.
h2oai_h2o-2
train
java
b2a45fc7de52b52e459edd573ac687d991b5c20d
diff --git a/modules/aggregation-layers/src/screen-grid-layer/screen-grid-layer.js b/modules/aggregation-layers/src/screen-grid-layer/screen-grid-layer.js index <HASH>..<HASH> 100644 --- a/modules/aggregation-layers/src/screen-grid-layer/screen-grid-layer.js +++ b/modules/aggregation-layers/src/screen-grid-layer/screen-grid-layer.js @@ -134,9 +134,11 @@ export default class ScreenGridLayer extends GridAggregationLayer { getPickingInfo({info, mode}) { const {index} = info; if (index >= 0) { - const {gpuGridAggregator} = this.state; + const {gpuGridAggregator, gpuAggregation, weights} = this.state; // Get count aggregation results - const aggregationResults = gpuGridAggregator.getData('count'); + const aggregationResults = gpuAggregation + ? gpuGridAggregator.getData('count') + : weights.count; // Each instance (one cell) is aggregated into single pixel, // Get current instance's aggregation details.
Fix ScreenGridLayer picking error w/ cpu aggregation (#<I>)
uber_deck.gl
train
js
980ee39c425971c3b6cc6afb435aa50449446146
diff --git a/pandas/tseries/tests/test_timeseries.py b/pandas/tseries/tests/test_timeseries.py index <HASH>..<HASH> 100644 --- a/pandas/tseries/tests/test_timeseries.py +++ b/pandas/tseries/tests/test_timeseries.py @@ -2507,7 +2507,7 @@ class TestTimestamp(tm.TestCase): import pytz def compare(x,y): - self.assert_(int(Timestamp(x).value/1e9) == int(Timestamp(y).value/1e9)) + self.assertEqual(int(Timestamp(x).value/1e9), int(Timestamp(y).value/1e9)) compare(Timestamp.now(),datetime.now()) compare(Timestamp.now('UTC'),datetime.now(pytz.timezone('UTC')))
CLN: use assertEqual over assert_ for better exception messages
pandas-dev_pandas
train
py
0000551cc3f495b4e3281a88db6498d75a5756fa
diff --git a/gandi/cli/commands/vm.py b/gandi/cli/commands/vm.py index <HASH>..<HASH> 100644 --- a/gandi/cli/commands/vm.py +++ b/gandi/cli/commands/vm.py @@ -203,7 +203,7 @@ def delete(gandi, background, force, resource): 'and the created login.') @click.option('--hostname', default=None, help='Hostname of the VM, will be generated if not provided.') -@option('--image', type=DISK_IMAGE, default='Debian 7 64 bits', +@option('--image', type=DISK_IMAGE, default='Debian 7 64 bits (HVM)', help='Disk image used to boot the VM.') @click.option('--run', default=None, help='Shell command that will run at the first startup of a VM.'
vm: choose HVM image as the default one
Gandi_gandi.cli
train
py
5a20deab9a8122c7a02bc9a1743e5a93ee7788c7
diff --git a/integration_tests/web/test_async_web_client.py b/integration_tests/web/test_async_web_client.py index <HASH>..<HASH> 100644 --- a/integration_tests/web/test_async_web_client.py +++ b/integration_tests/web/test_async_web_client.py @@ -123,7 +123,7 @@ class TestAsyncWebClient(unittest.TestCase): channels=self.channel_id, title="Good Old Slack Logo", filename="slack_logo.png", file=file) self.assertIsNotNone(upload) - deletion = client.files_delete(file=upload["file"]["id"]) + deletion = await client.files_delete(file=upload["file"]["id"]) self.assertIsNotNone(deletion) @async_test @@ -140,7 +140,7 @@ class TestAsyncWebClient(unittest.TestCase): ) self.assertIsNotNone(upload) - deletion = client.files_delete( + deletion = await client.files_delete( token=self.bot_token, file=upload["file"]["id"], )
Fix never-awaited coro in integration tests
slackapi_python-slackclient
train
py
36871499d5078cc85f291d5ecc17b6094c49c33e
diff --git a/lib/nydp/pair.rb b/lib/nydp/pair.rb index <HASH>..<HASH> 100644 --- a/lib/nydp/pair.rb +++ b/lib/nydp/pair.rb @@ -74,12 +74,12 @@ class Nydp::Pair def compile_to_ruby a,x = [], self - while x + while x.is_a?(Nydp::Pair) a << x.car.compile_to_ruby x = x.cdr end - "Nydp::Pair.from_list([" + a.join(", ") + "])" + "Nydp::Pair.from_list([" + a.join(", ") + "], #{x.compile_to_ruby})" end def nth n @@ -113,12 +113,16 @@ class Nydp::Pair # returns Array of elements as they are def to_a list=[] - list << car - cdr.is_a?(Nydp::Pair) ? cdr.to_a(list) : list + x = self + while x.is_a?(Nydp::Pair) + list << x.car + x = x.cdr + end + list end def self.parse_list list - if sym? list.slice(-2), "." + if list.slice(-2) == :"." from_list(list[0...-2], list.slice(-1)) else from_list list
pair: nonrecursive implementation of #to_a, and other small fixes
conanite_nydp
train
rb
b944e9955ec4565876e124107ec416a330c6d094
diff --git a/src/TokenRemover.php b/src/TokenRemover.php index <HASH>..<HASH> 100644 --- a/src/TokenRemover.php +++ b/src/TokenRemover.php @@ -17,7 +17,10 @@ final class TokenRemover { self::removeTrailingHorizontalWhitespaces($tokens, $tokens->getNonEmptySibling($index, -1)); - self::removeLeadingNewline($tokens, $tokens->getNonEmptySibling($index, 1)); + $nextIndex = $tokens->getNonEmptySibling($index, 1); + if ($nextIndex !== null) { + self::removeLeadingNewline($tokens, $tokens->getNonEmptySibling($index, 1)); + } $tokens->clearTokenAndMergeSurroundingWhitespace($index); } diff --git a/tests/TokenRemoverTest.php b/tests/TokenRemoverTest.php index <HASH>..<HASH> 100644 --- a/tests/TokenRemoverTest.php +++ b/tests/TokenRemoverTest.php @@ -145,5 +145,12 @@ namespace Foo; /** Some comment */ namespace Foo; ', ]; + + yield [ + '<?php +', + '<?php +// comment as last element', + ]; } }
TokenRemover - fix for comment as last element
kubawerlos_php-cs-fixer-custom-fixers
train
php,php
8715c7fdd2224a2e46a64c4e3bfcb43de48c313e
diff --git a/src/Plugin.php b/src/Plugin.php index <HASH>..<HASH> 100644 --- a/src/Plugin.php +++ b/src/Plugin.php @@ -99,6 +99,7 @@ class Plugin implements } $runtimeUtils = new \Vaimo\ComposerPatches\Utils\RuntimeUtils(); + $compExecutor = new \Vaimo\ComposerPatches\Compatibility\Executor(); $lockSanitizer = $this->lockSanitizer; $bootstrap = $this->bootstrap; @@ -107,10 +108,10 @@ class Plugin implements function () use ($bootstrap, $event) { return $bootstrap->applyPatches($event->isDevMode()); }, - function () use ($event, $lockSanitizer) { + function () use ($event, $lockSanitizer, $compExecutor) { $repository = $event->getComposer()->getRepositoryManager()->getLocalRepository(); - - $repository->write($event->isDevMode(), $event->getComposer()->getInstallationManager()); + $installationManager = $event->getComposer()->getInstallationManager(); + $compExecutor->repositoryWrite($repository, $installationManager, $event->isDevMode()); $lockSanitizer->sanitize(); } );
change V2-style call to repo->write to use copmatibilityExecutor
vaimo_composer-patches
train
php
4a799a20e40c216415f91b8ff1b98324b1ceff6e
diff --git a/gg/scale.go b/gg/scale.go index <HASH>..<HASH> 100644 --- a/gg/scale.go +++ b/gg/scale.go @@ -275,7 +275,7 @@ func defaultRanger(aes string) Ranger { return &defaultColorRanger{} case "opacity": - return NewFloatRanger(0, 1) + return NewFloatRanger(0.1, 1) case "size": // Default to ranging between 1% and 10% of the
gg: change default opacity range to [<I>,1] Currently it goes from 0 to 1, but you can't see something that 0% opaque, so bring up the lower bound to where it's visible.
aclements_go-gg
train
go
ca76f5731658ee627aef4000f530ca42df3ab710
diff --git a/resources/assets/build/config.js b/resources/assets/build/config.js index <HASH>..<HASH> 100644 --- a/resources/assets/build/config.js +++ b/resources/assets/build/config.js @@ -20,7 +20,6 @@ const config = merge({ root: rootPath, assets: path.join(rootPath, 'resources/assets'), dist: path.join(rootPath, 'dist'), - eslintProd: path.join(rootPath, '.eslintrc.production.json'), }, enabled: { sourceMaps: !isProduction,
Don't need this any more! :(
roots_sage
train
js
f8b10df1e7d2ea7950dde433c1cb6d5225112f4f
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -72,7 +72,7 @@ setup( name='pyspool', version=find_version('spool', '__init__.py'), url='https://github.com/ascribe/pyspool', - license='Apache Software License', + license='Apache2', author='pyspool contributors', author_email='devel@ascribe.io', packages=['spool'],
Fixed the license value in setup.py Changed it from "Apache" to "Apache2". Note that the other license string, `'License :: OSI Approved :: Apache Software License'` is correct: it [should not contain a 2](<URL>).
ascribe_pyspool
train
py
c0121bc0c02981cc9fea5c04b31df012e2a7dd99
diff --git a/mongo_connector/doc_managers/mongo_doc_manager.py b/mongo_connector/doc_managers/mongo_doc_manager.py index <HASH>..<HASH> 100644 --- a/mongo_connector/doc_managers/mongo_doc_manager.py +++ b/mongo_connector/doc_managers/mongo_doc_manager.py @@ -55,8 +55,6 @@ class DocManager(DocManagerBase): except pymongo.errors.ConnectionFailure: raise errors.ConnectionFailed("Failed to connect to MongoDB") self.namespace_set = kwargs.get("namespace_set") - for namespace in self._namespaces(): - self.mongo["__mongo_connector"][namespace].create_index("_ts") @wrap_exceptions def _namespaces(self): @@ -83,8 +81,8 @@ class DocManager(DocManagerBase): """ logging.info( "Mongo DocManager Stopped: If you will not target this system " - "again with mongo-connector then please drop the database " - "__mongo_connector in order to return resources to the OS." + "again with mongo-connector then you may drop the database " + "__mongo_connector, which holds metadata for Mongo Connector." ) @wrap_exceptions
Don't create an index on '_ts' when replicating to MongoDB, since this causes continuously growing index names like '__mongo_connector.__mongo_connector.__mongo_connector.<...>'.
yougov_mongo-connector
train
py
adfbc2f3f2f6d81990744b7159fbffe61f9ea470
diff --git a/imbox/imap.py b/imbox/imap.py index <HASH>..<HASH> 100644 --- a/imbox/imap.py +++ b/imbox/imap.py @@ -11,22 +11,19 @@ class ImapTransport(object): def __init__(self, hostname, port=None, ssl=True, usesslcontext=True): self.hostname = hostname self.port = port + kwargs = {} if ssl: - if usesslcontext is True: - context = pythonssllib.create_default_context() - else: - context = None - + self.transport = IMAP4_SSL if not self.port: self.port = 993 - self.server = self.IMAP4_SSL(self.hostname, self.port, - ssl_context=context) + kwargs["ssl_context"] = pythonssllib.create_default_context() else: + self.transport = IMAP4 if not self.port: self.port = 143 - self.server = self.IMAP4(self.hostname, self.port) + self.server = self.transport(self.hostname, self.port, **kwargs) logger.debug("Created IMAP4 transport for {host}:{port}" .format(host=self.hostname, port=self.port))
Fix IMAP transport instantiation This reverts the approach to IMAP transport instantiation back to how it was done prior to 2a<I>b6 which introduced the usesslcontext parameter. This reduces code duplication and importantly make instantiation work again because self.IMAP4 and self.IMAP4_SSL do not exist.
martinrusev_imbox
train
py
6e4726ebd147018a235fc8cf108df8c068bbf0fc
diff --git a/src/sultan/echo/__init__.py b/src/sultan/echo/__init__.py index <HASH>..<HASH> 100644 --- a/src/sultan/echo/__init__.py +++ b/src/sultan/echo/__init__.py @@ -4,7 +4,14 @@ from sultan.echo.colorlog import StreamHandler, ColoredFormatter handler = StreamHandler() handler.setFormatter(ColoredFormatter( - '%(log_color)s[%(name)s]: %(message)s' + '%(log_color)s[%(name)s]: %(message)s', + log_colors={ + 'DEBUG': 'cyan', + 'INFO': 'green', + 'WARNING': 'yellow', + 'ERROR': 'red', + 'CRITICAL': 'bold_red', + } ))
Made better color scheme for logging.
aeroxis_sultan
train
py
f2d1253d256a1cc84395e58510b49d07b28e981c
diff --git a/src/Artifact.js b/src/Artifact.js index <HASH>..<HASH> 100644 --- a/src/Artifact.js +++ b/src/Artifact.js @@ -152,8 +152,14 @@ class Artifact extends OIPObject { * @param {number} time - The Timestamp you wish to set the Artifact to */ setTimestamp(time){ - if (typeof time === "number") - this.artifact.timestamp = time; + if (typeof time === "number"){ + if (String(time).length === 13){ + let seconds_time_string = parseInt(time/1000) + this.artifact.timestamp = seconds_time_string + } else if (String(time).length === 10) { + this.artifact.timestamp = time; + } + } } /** * Get the publish/signature timestamp for the Artifact
Store timestamp in seconds instead of miliseconds
oipwg_oip-index
train
js
73338855c64849c6d1da48d9ccee26f240eff329
diff --git a/ipywidgets/widgets/widget_selection.py b/ipywidgets/widgets/widget_selection.py index <HASH>..<HASH> 100644 --- a/ipywidgets/widgets/widget_selection.py +++ b/ipywidgets/widgets/widget_selection.py @@ -166,6 +166,7 @@ class _Selection(DescriptionWidget, ValueWidget, CoreWidget): # Select the first item by default, if we can if 'index' not in kwargs and 'value' not in kwargs and 'label' not in kwargs: + options = self._options_full nonempty = (len(options) > 0) kwargs['index'] = 0 if nonempty else None kwargs['label'], kwargs['value'] = options[0] if nonempty else (None, None)
Fix options initialization logic for selection widgets
jupyter-widgets_ipywidgets
train
py
3e487b888110946fe26fd1f01eb191f90ba74b9a
diff --git a/lxc/copy.go b/lxc/copy.go index <HASH>..<HASH> 100644 --- a/lxc/copy.go +++ b/lxc/copy.go @@ -135,6 +135,10 @@ func (c *cmdCopy) copyContainer(conf *config.Config, sourceResource string, var op lxd.RemoteOperation if shared.IsSnapshot(sourceName) { + if containerOnly { + return fmt.Errorf(i18n.G("--container-only can't be passed when the source is a snapshot")) + } + // Prepare the container creation request args := lxd.ContainerSnapshotCopyArgs{ Name: destName,
lxc/copy: --container-only is meaningless for snapshots
lxc_lxd
train
go
365e7da40d3a93d718c27fb45935d837a7306a3a
diff --git a/src/CatLab/Accounts/Models/User.php b/src/CatLab/Accounts/Models/User.php index <HASH>..<HASH> 100644 --- a/src/CatLab/Accounts/Models/User.php +++ b/src/CatLab/Accounts/Models/User.php @@ -208,10 +208,14 @@ class User implements \Neuron\Interfaces\Models\User */ public function getDisplayName($formal = false) { - if ($formal) { + if ($formal && $this->getFirstName() && $this->getFamilyName()) { return $this->getFirstName() . ' ' . $this->getFamilyName(); - } else { + } elseif ($this->getFirstName()) { return $this->getFirstName(); + } elseif ($this->getFamilyName()) { + return $this->getFamilyName(); + } else { + return 'User ' . $this->getId(); } }
Make sure User::getDisplayName() always returns something.
CatLabInteractive_Accounts
train
php
13bf35d6403ab32f4442161fb4b197f2ee348255
diff --git a/executor/oci/mounts_test.go b/executor/oci/mounts_test.go index <HASH>..<HASH> 100644 --- a/executor/oci/mounts_test.go +++ b/executor/oci/mounts_test.go @@ -3,7 +3,7 @@ package oci import ( "testing" - "github.com/stretchr/testify/require" + "github.com/stretchr/testify/assert" ) func TestHasPrefix(t *testing.T) { @@ -51,6 +51,6 @@ func TestHasPrefix(t *testing.T) { } for i, tc := range testCases { actual := hasPrefix(tc.path, tc.prefix) - require.Equal(t, tc.expected, actual, "#%d: under(%q,%q)", i, tc.path, tc.prefix) + assert.Equal(t, tc.expected, actual, "#%d: under(%q,%q)", i, tc.path, tc.prefix) } }
Run all the hasPrefix test-cases, even if one fails This makes it easier to see what's gone wrong if they start failing.
moby_buildkit
train
go
dc034386a4123df147029b274144b367b797c2c0
diff --git a/javamelody-for-spring-boot/src/main/java/hello/JavaMelodyConfiguration.java b/javamelody-for-spring-boot/src/main/java/hello/JavaMelodyConfiguration.java index <HASH>..<HASH> 100644 --- a/javamelody-for-spring-boot/src/main/java/hello/JavaMelodyConfiguration.java +++ b/javamelody-for-spring-boot/src/main/java/hello/JavaMelodyConfiguration.java @@ -55,8 +55,6 @@ public class JavaMelodyConfiguration implements ServletContextInitializer { return javaMelody; } - // Note: if you have auto-proxy issues, you can add the following in your application.properties instead of that method: - // spring.aop.proxy-target-class=true @Bean public DefaultAdvisorAutoProxyCreator getDefaultAdvisorAutoProxyCreator() { return new DefaultAdvisorAutoProxyCreator();
adding aspectjweaver dependency is better
javamelody_javamelody
train
java
f8e95fd603de1a028aeac9a5e942f05f5b2dfca6
diff --git a/lib/git_diff/diff_file.rb b/lib/git_diff/diff_file.rb index <HASH>..<HASH> 100644 --- a/lib/git_diff/diff_file.rb +++ b/lib/git_diff/diff_file.rb @@ -15,8 +15,8 @@ module GitDiff def <<(string) return if extract_diff_meta_data(string) - if(hunk = Hunk.from_string(string)) - add_hunk hunk + if(range_info = RangeInfo.from_string(string)) + add_hunk Hunk.new(range_info) else append_to_current_hunk string end diff --git a/lib/git_diff/hunk.rb b/lib/git_diff/hunk.rb index <HASH>..<HASH> 100644 --- a/lib/git_diff/hunk.rb +++ b/lib/git_diff/hunk.rb @@ -9,19 +9,6 @@ module GitDiff attr_reader :lines, :range_info - module ClassMethods - def from_string(string) - if(range_info = RangeInfo.from_string(string)) - Hunk.new(range_info) - end - end - - # def extract_hunk_range_data(string) - # /@@ \-(\d+,\d+) \+(\d+,\d+) @@(.*)/.match(string) - # end - end - extend ClassMethods - def initialize(range_info) @range_info = range_info @lines = []
Remove extraneous method Hunk.from_string.
anolson_git_diff
train
rb,rb
042d2378b321948bb71af85f28485d9a957e6afc
diff --git a/findbugs/src/java/edu/umd/cs/findbugs/FindBugs.java b/findbugs/src/java/edu/umd/cs/findbugs/FindBugs.java index <HASH>..<HASH> 100644 --- a/findbugs/src/java/edu/umd/cs/findbugs/FindBugs.java +++ b/findbugs/src/java/edu/umd/cs/findbugs/FindBugs.java @@ -198,6 +198,8 @@ public class FindBugs implements Constants2 private void addFileToRepository(String fileName, List<String> repositoryClassList) throws IOException, InterruptedException { + try { + if (fileName.endsWith(".jar") || fileName.endsWith(".zip")) { ZipFile zipFile = new ZipFile(fileName); Enumeration entries = zipFile.entries(); @@ -223,6 +225,12 @@ public class FindBugs implements Constants2 } progressCallback.finishArchive(); + + } catch (IOException e) { + // You'd think that the message for a FileNotFoundException would include + // the filename, but you'd be wrong. So, we'll add it explicitly. + throw new IOException("Could not analyze " + fileName + ": " + e.getMessage()); + } } /**
If we get an IOException trying to add a file to the repository, make sure the filename is included in the exception. git-svn-id: <URL>
spotbugs_spotbugs
train
java
a62c12bdb25eb6c7c0b7319cdaa7dd1311ec0ef0
diff --git a/txaws/_auth_v4.py b/txaws/_auth_v4.py index <HASH>..<HASH> 100644 --- a/txaws/_auth_v4.py +++ b/txaws/_auth_v4.py @@ -1,13 +1,13 @@ # Licenced under the txaws licence available at /LICENSE in the txaws source. """ -AWS authorization, version 4 +AWS authorization, version 4. """ -import attr - import hashlib import hmac -import urlparse import urllib +import urlparse + +import attr # The following four functions are taken straight from diff --git a/txaws/tests/test_auth_v4.py b/txaws/tests/test_auth_v4.py index <HASH>..<HASH> 100644 --- a/txaws/tests/test_auth_v4.py +++ b/txaws/tests/test_auth_v4.py @@ -1,11 +1,12 @@ # Licenced under the txaws licence available at /LICENSE in the txaws source. """ -Unit tests for AWS authorization, version 4 +Unit tests for AWS authorization, version 4. """ import datetime import hashlib import hmac +import urlparse from twisted.trial import unittest @@ -29,8 +30,6 @@ from txaws.credentials import AWSCredentials from txaws.service import REGION_US_EAST_1 -import urlparse - def _create_canonical_request_fixture(): """
Clean up docstrings and imports
twisted_txaws
train
py,py
82298e601d0eeb34e7fa9c06c8b2166cf516b441
diff --git a/src/gl/gl_texture.js b/src/gl/gl_texture.js index <HASH>..<HASH> 100644 --- a/src/gl/gl_texture.js +++ b/src/gl/gl_texture.js @@ -25,6 +25,12 @@ export default function GLTexture (gl, name, options = {}) { // TODO: better support for non-URL sources: canvas/video elements, raw pixel buffers this.name = name; + + // Destroy previous texture if present + if (GLTexture.textures[this.name]) { + GLTexture.textures[this.name].destroy(); + } + GLTexture.textures[this.name] = this; this.sprites = options.sprites;
clean up previous texture when re-creating w/same name
tangrams_tangram
train
js
e93b60eb5b75df5a94c0249137c6d71186aacd0a
diff --git a/application/tests/_ci_phpunit_test/autoloader.php b/application/tests/_ci_phpunit_test/autoloader.php index <HASH>..<HASH> 100644 --- a/application/tests/_ci_phpunit_test/autoloader.php +++ b/application/tests/_ci_phpunit_test/autoloader.php @@ -19,5 +19,6 @@ spl_autoload_register(function ($class) }); // Register CodeIgniter's tests/mocks/autoloader.php +define('SYSTEM_PATH', BASEPATH); require __DIR__ .'/../mocks/autoloader.php'; spl_autoload_register('autoload');
Fix bug which constant SYSTEM_PATH is missing
kenjis_ci-phpunit-test
train
php
0ef575c6f60b9b504aa686b39214ee51af9c8e74
diff --git a/lib/graphql/schema/warden.rb b/lib/graphql/schema/warden.rb index <HASH>..<HASH> 100644 --- a/lib/graphql/schema/warden.rb +++ b/lib/graphql/schema/warden.rb @@ -138,16 +138,18 @@ module GraphQL def visible_type?(type_defn) return false unless visible?(type_defn) - referenced = referenced_by_visible_members?(type_defn) - if type_defn.kind.object? && has_abstract_type?(type_defn) - if orphan?(type_defn) - member_or_implements?(type_defn) - else - referenced || member_or_implements?(type_defn) - end + visible_implementation?(type_defn) + else + referenced_by_visible_members?(type_defn) + end + end + + def visible_implementation?(type_defn) + if orphan?(type_defn) + member_or_implements?(type_defn) else - referenced + referenced_by_visible_members?(type_defn) || member_or_implements?(type_defn) end end
break up visible_type? in smaller methods
rmosolgo_graphql-ruby
train
rb
f4a0e239392712336028228704d29831fe3aa1d5
diff --git a/lib/index.js b/lib/index.js index <HASH>..<HASH> 100644 --- a/lib/index.js +++ b/lib/index.js @@ -132,6 +132,7 @@ RpcClient.prototype.batch = function(batchCallback, resultCallback) { }; RpcClient.callspec = { + abandonTransaction: 'str', addMultiSigAddress: '', addNode: '', backupWallet: '',
added abandonTransaction method to spec
dashevo_dashd-rpc
train
js
722c50dcd0cd675950304b6bffa9ee722b0bcdc3
diff --git a/lib/rabbitmq/util.rb b/lib/rabbitmq/util.rb index <HASH>..<HASH> 100644 --- a/lib/rabbitmq/util.rb +++ b/lib/rabbitmq/util.rb @@ -4,7 +4,8 @@ class RabbitMQ::FFI::Error < RuntimeError; end module RabbitMQ::Util class << self - def error_check rc + def error_check rc=nil + rc ||= yield return if rc == 0 raise RabbitMQ::FFI::Error, RabbitMQ::FFI.amqp_error_string2(rc) end diff --git a/spec/util_spec.rb b/spec/util_spec.rb index <HASH>..<HASH> 100644 --- a/spec/util_spec.rb +++ b/spec/util_spec.rb @@ -13,5 +13,13 @@ describe RabbitMQ::Util do it "raises an error when given a nonzero result code" do expect { subject.error_check(-1) }.to raise_error RabbitMQ::FFI::Error end + + it "returns nil when given a zero result code in a block" do + subject.error_check { 0 }.should eq nil + end + + it "raises an error when given a nonzero result code in a block" do + expect { subject.error_check { -1 } }.to raise_error RabbitMQ::FFI::Error + end end end
Add block form to Util.error_check.
jemc_ruby-rabbitmq
train
rb,rb
314ef35475fcb8eceb2c18fc8fd6ffab26d45cd9
diff --git a/lib/IDS/Converter.php b/lib/IDS/Converter.php index <HASH>..<HASH> 100644 --- a/lib/IDS/Converter.php +++ b/lib/IDS/Converter.php @@ -561,6 +561,9 @@ class IDS_Converter $value ); + // normalize separation char repetion + $value = preg_replace('/([.+~=\-])\1{2,}/m', '$1', $value); + //remove parenthesis inside sentences $value = preg_replace('/(\w\s)\(([&\w]+)\)(\s\w|$)/', '$1$2$3', $value);
added code to deal with abnormal repetiton of separation chars git-svn-id: <URL>
ZendExperts_phpids
train
php
0a64c64aaf35d4382b94e97096a47ce00ce1e758
diff --git a/classes/MUtil/Ra/RaObject.php b/classes/MUtil/Ra/RaObject.php index <HASH>..<HASH> 100644 --- a/classes/MUtil/Ra/RaObject.php +++ b/classes/MUtil/Ra/RaObject.php @@ -84,6 +84,17 @@ class RaObject extends \ArrayObject implements \MUtil_Registry_TargetInterface } /** + * + * @param mixed $input The input parameter accepts an array or an Object. + * @param int $flags Flags to control the behaviour of the ArrayObject object, STD_PROP_LIST is always set on + * @param string $iterator_class Specify the class that will be used for iteration of the ArrayObject object. + */ + public function __construct($input = array(), $flags = 0, $iterator_class = "ArrayIterator") + { + parent::__construct($input, $flags | \ArrayObject::STD_PROP_LIST, $iterator_class); + } + + /** * Called after the check that all required registry values * have been set correctly has run. *
RaObject should use it's props as a normal object
GemsTracker_gemstracker-library
train
php
3d633c60873b778e4c12906b617d91eff4ef9ad7
diff --git a/functions/timber-post.php b/functions/timber-post.php index <HASH>..<HASH> 100644 --- a/functions/timber-post.php +++ b/functions/timber-post.php @@ -30,7 +30,11 @@ class TimberPost extends TimberCore implements TimberCoreInterface { * @return \TimberPost TimberPost object -- woo! */ function __construct($pid = null) { - if ($pid === null && get_the_ID()) { + global $wp_query; + if ($pid === null && isset($wp_query->queried_object_id) && $wp_query->queried_object_id) { + $pid = $wp_query->queried_object_id; + $this->ID = $pid; + } else if ($pid === null && get_the_ID()) { $pid = get_the_ID(); $this->ID = $pid; } else if ($pid === null && ($pid_from_loop = TimberPostGetter::loop_to_id())) {
ref #<I> -- changed TimberPost to prefer data from $wp_query before get_the_ID
timber_timber
train
php
932f6f894fa8166698b55a9363258400cdf51625
diff --git a/src/Model/Table/QueueProcessesTable.php b/src/Model/Table/QueueProcessesTable.php index <HASH>..<HASH> 100644 --- a/src/Model/Table/QueueProcessesTable.php +++ b/src/Model/Table/QueueProcessesTable.php @@ -66,9 +66,7 @@ class QueueProcessesTable extends Table { 'bindingKey' => 'workerkey', 'propertyName' => 'active_job', 'conditions' => [ - 'CurrentQueuedJobs.completed IS NULL', - 'CurrentQueuedJobs.failure_message IS NULL', - 'CurrentQueuedJobs.failed = 0', + 'CurrentQueuedJobs.completed IS NULL' ], ] );
remove conditions from hasOne CurrentQueuedJobs Assoc so failed, re-run jobs are still being shown
dereuromark_cakephp-queue
train
php
4808ea90dfe9722a58986f8ec583e77384bff0fb
diff --git a/client/deis.py b/client/deis.py index <HASH>..<HASH> 100755 --- a/client/deis.py +++ b/client/deis.py @@ -600,7 +600,9 @@ class DeisClient(object): Usage: deis apps:run <command>... """ - app = self._session.app + app = args.get('--app') + if not app: + app = self._session.app body = {'command': ' '.join(sys.argv[2:])} response = self._dispatch('post', "/api/apps/{}/run".format(app),
feat(client): add --app option to apps:run All of the other apps commands have a --app option. This commit introduces that option to the apps:run command as well. fixes #<I>
deis_deis
train
py
41ceff0598e958e36623338d983f6c6c5ab3e87f
diff --git a/query/src/test/java/org/infinispan/query/backend/KeyTransformationHandlerTest.java b/query/src/test/java/org/infinispan/query/backend/KeyTransformationHandlerTest.java index <HASH>..<HASH> 100644 --- a/query/src/test/java/org/infinispan/query/backend/KeyTransformationHandlerTest.java +++ b/query/src/test/java/org/infinispan/query/backend/KeyTransformationHandlerTest.java @@ -134,7 +134,7 @@ public class KeyTransformationHandlerTest { public void testStringToKeyWithInvalidTransformer() { ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader(); - key = keyTransformationHandler.stringToKey("T:org.infinispan.SomeTransformer:key1", contextClassLoader); + key = keyTransformationHandler.stringToKey("T:org.infinispan.InexistentTransformer:key1", contextClassLoader); } public void testStringToKeyWithCustomTransformable() {
ISPN-<I> Make it easier to spot expected exceptions in the test
infinispan_infinispan
train
java
b974dd85daf70c63e391f2b8a0c85b6a46ae3e1a
diff --git a/pywindow/molecular.py b/pywindow/molecular.py index <HASH>..<HASH> 100644 --- a/pywindow/molecular.py +++ b/pywindow/molecular.py @@ -121,7 +121,7 @@ class Molecule(object): self.MW = molecular_weight(self.elements) return self.MW - def save_molecule_json(self, filepath=None, molecular=False, **kwargs): + def dump_properties_json(self, filepath=None, molecular=False, **kwargs): # We pass a copy of the properties dictionary. dict_obj = deepcopy(self.properties) # If molecular data is also required we update the dictionary. @@ -138,7 +138,7 @@ class Molecule(object): # Dump the dictionary to json file. self._Output.dump2json(dict_obj, filepath, **kwargs) - def save_molecule(self, filepath=None, include_coms=False, **kwargs): + def dump_molecule(self, filepath=None, include_coms=False, **kwargs): # If no filepath is provided we create one. if filepath is None: filepath = "_".join(
Changed the names of function for saving output and molecule
marcinmiklitz_pywindow
train
py
d6526387de5b41988e6c6e70bbff445b75baac3d
diff --git a/src/main/java/com/xebia/incubator/xebium/ScreenCapture.java b/src/main/java/com/xebia/incubator/xebium/ScreenCapture.java index <HASH>..<HASH> 100644 --- a/src/main/java/com/xebia/incubator/xebium/ScreenCapture.java +++ b/src/main/java/com/xebia/incubator/xebium/ScreenCapture.java @@ -71,11 +71,12 @@ class ScreenCapture { } } - void setScreenshotPolicy(String policy) { + void setScreenshotPolicy(String policy) throws IOException { if ("none".equals(policy) || "nothing".equals(policy)) { screenshotPolicy = ScreenshotPolicy.NONE; } else if ("failure".equals(policy) || "error".equals(policy)) { - screenshotPolicy =ScreenshotPolicy.FAILURE; + screenshotPolicy = ScreenshotPolicy.FAILURE; + initializeIndexIfNeeded(); } else if ("step".equals(policy) || "every step".equals(policy)) { screenshotPolicy = ScreenshotPolicy.STEP; } else if ("assertion".equals(policy) || "every assertion".equals(policy)) {
Initialize index file early when screenshots are triggered by errors
xebia_Xebium
train
java
f3745a7ea535aa0e88b0650c16479b696d6fd446
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -49,7 +49,7 @@ CONSOLE_SCRIPTS = [ py_version = platform.python_version() -_APITOOLS_VERSION = '0.5.26' +_APITOOLS_VERSION = '0.5.27' with open('README.rst') as fileobj: README = fileobj.read()
Update for <I> release. (#<I>)
google_apitools
train
py
0f1ca383af6433a81c0dbb422b29fb92677c10b5
diff --git a/test/test_blackbox.py b/test/test_blackbox.py index <HASH>..<HASH> 100644 --- a/test/test_blackbox.py +++ b/test/test_blackbox.py @@ -7,7 +7,7 @@ from pyphi import compute, config, macro, models, Network, utils # TODO: move these to examples.py -@pytest.mark.slow +@pytest.mark.veryslow def test_basic_propogation_delay(): # Create basic network with propagation delay. # COPY gates on each of the connections in the original network.
Mark basic propogation delay test as `veryslow`
wmayner_pyphi
train
py
244ac18df59c8be2e2e5fbacd1ef0125ef31f886
diff --git a/webapps/webapp/src/main/webapp/app/cockpit/directives/stateCircle.js b/webapps/webapp/src/main/webapp/app/cockpit/directives/stateCircle.js index <HASH>..<HASH> 100644 --- a/webapps/webapp/src/main/webapp/app/cockpit/directives/stateCircle.js +++ b/webapps/webapp/src/main/webapp/app/cockpit/directives/stateCircle.js @@ -1,12 +1,11 @@ /* global ngDefine: false */ -ngDefine('camunda.common.directives.stateCircle', [], function(module) { +ngDefine('camunda.common.directives', [], function(module) { 'use strict'; var CircleDirective = function () { return { restrict: 'EAC', link: function(scope, element, attrs) { - element.addClass('circle'); scope.$watch(attrs.incidents, function() {
fix(cockpit/dashboard): fix the missing state circle
camunda_camunda-bpm-platform
train
js
1f31e5e36bf94b1849bb38fd8e22ca5ddebfcf0b
diff --git a/src/Testing/TestCase.php b/src/Testing/TestCase.php index <HASH>..<HASH> 100644 --- a/src/Testing/TestCase.php +++ b/src/Testing/TestCase.php @@ -42,6 +42,6 @@ abstract class TestCase extends BaseTestCase protected function getTestName() { - return class_basename(static::class) . '::' . $this->getName(); + return class_basename(static::class).'::'.$this->getName(); } }
Apply fixes from StyleCI (#9)
beyondcode_dusk-dashboard
train
php
9081dfb68d7ed067d88960d42936694b22e166e7
diff --git a/test/images/agnhost/guestbook/guestbook.go b/test/images/agnhost/guestbook/guestbook.go index <HASH>..<HASH> 100644 --- a/test/images/agnhost/guestbook/guestbook.go +++ b/test/images/agnhost/guestbook/guestbook.go @@ -84,14 +84,14 @@ func registerNode(registerTo, port string) { for time.Since(start) < timeout { _, err := net.ResolveTCPAddr("tcp", hostPort) if err != nil { - log.Printf("--slaveof param and/or --backend-port param are invalid. %v. Retrying in 1 second.", err) + log.Printf("unable to resolve %s, --slaveof param and/or --backend-port param are invalid: %v. Retrying in %s.", hostPort, err, sleep) time.Sleep(sleep) continue } response, err := dialHTTP(request, hostPort) if err != nil { - log.Printf("encountered error while registering to master: %v. Retrying in 1 second.", err) + log.Printf("encountered error while registering to master: %v. Retrying in %s.", err, sleep) time.Sleep(sleep) continue }
Improve error messages in agnhost/guestbook This updates the error messages when registering a node to be more explicit about what error occurred and how long it will wait to retry.
kubernetes_kubernetes
train
go
93e083da4fd8a936d534abb6d16e42f37837da4d
diff --git a/src/client/actions/GuildMemberRemove.js b/src/client/actions/GuildMemberRemove.js index <HASH>..<HASH> 100644 --- a/src/client/actions/GuildMemberRemove.js +++ b/src/client/actions/GuildMemberRemove.js @@ -8,8 +8,8 @@ class GuildMemberRemoveAction extends Action { let member = null; if (guild) { member = guild.members.get(data.user.id); + guild.memberCount--; if (member) { - guild.memberCount--; guild.members.remove(member.id); if (client.status === Status.READY) client.emit(Events.GUILD_MEMBER_REMOVE, member); } diff --git a/src/structures/GuildMember.js b/src/structures/GuildMember.js index <HASH>..<HASH> 100644 --- a/src/structures/GuildMember.js +++ b/src/structures/GuildMember.js @@ -526,12 +526,7 @@ class GuildMember extends Base { */ kick(reason) { return this.client.api.guilds(this.guild.id).members(this.user.id).delete({ reason }) - .then(() => - this.client.actions.GuildMemberRemove.handle({ - guild_id: this.guild.id, - user: this.user, - }).member - ); + .then(() => this); } /**
fix(Guild): memberCount not decrementing when an uncached member leaves This leads to GuildMemberStore#_fetchMany to always reject because it expects more member than possible. Also no longer call the GuildMemberRemove handler locally to not decrement twice.
discordjs_discord.js
train
js,js
af1cbd762b5bb3a9b33ee4d006f0c758df32e0e2
diff --git a/core-bundle/src/Image/Studio/Figure.php b/core-bundle/src/Image/Studio/Figure.php index <HASH>..<HASH> 100644 --- a/core-bundle/src/Image/Studio/Figure.php +++ b/core-bundle/src/Image/Studio/Figure.php @@ -25,7 +25,7 @@ use Contao\Template; * * Wherever possible, the actual data is only requested/built on demand. * - * @final + * @final This class will be made final in Contao 5. */ class Figure {
Add note that Figure will be final in Contao 5 (see #<I>) Description ----------- | Q | A | -----------------| --- | Fixed issues | See #<I> | Docs PR or issue | - Adds a reminder, that the `@final` annotation will be upgraded to `final` in Contao 5. Commits ------- 6e<I> add note that Figure will be final in Contao 5
contao_contao
train
php
60bcd2bea177f70c24515025812b0a0389153969
diff --git a/src/Search.php b/src/Search.php index <HASH>..<HASH> 100644 --- a/src/Search.php +++ b/src/Search.php @@ -159,8 +159,6 @@ class Search { $query = '(' . implode(') AND (', $q) . ')'; } else if (count($q) > 0) { $query = $q[0]; - } else { - return false; } // Implode different sort arrays
Removed to allow pagination or sorting without searching.
lutsen_lagan-core
train
php
893409f2a92ae8dba011d7daf98664a0225ba4c4
diff --git a/src/Illuminate/Console/Scheduling/ScheduleWorkCommand.php b/src/Illuminate/Console/Scheduling/ScheduleWorkCommand.php index <HASH>..<HASH> 100644 --- a/src/Illuminate/Console/Scheduling/ScheduleWorkCommand.php +++ b/src/Illuminate/Console/Scheduling/ScheduleWorkCommand.php @@ -38,7 +38,11 @@ class ScheduleWorkCommand extends Command if (Carbon::now()->second === 0 && ! Carbon::now()->startOfMinute()->equalTo($lastExecutionStartedAt)) { - $executions[] = $execution = new Process([PHP_BINARY, 'artisan', 'schedule:run']); + $executions[] = $execution = new Process([ + PHP_BINARY, + defined('ARTISAN_BINARY') ? ARTISAN_BINARY : 'artisan', + 'schedule:run' + ]); $execution->start();
[8.x] Fix schedule:work command Artisan binary name (#<I>) * Fix schedule:work command Artisan binary name * formatting
laravel_framework
train
php
66ffec290abfbb57408a47cd578da410567e62e4
diff --git a/core/src/main/java/io/undertow/server/protocol/ajp/AjpServerRequestConduit.java b/core/src/main/java/io/undertow/server/protocol/ajp/AjpServerRequestConduit.java index <HASH>..<HASH> 100644 --- a/core/src/main/java/io/undertow/server/protocol/ajp/AjpServerRequestConduit.java +++ b/core/src/main/java/io/undertow/server/protocol/ajp/AjpServerRequestConduit.java @@ -96,7 +96,7 @@ public class AjpServerRequestConduit extends AbstractStreamSourceConduit<StreamS if (size == null) { state = STATE_SEND_REQUIRED; remaining = -1; - } else if (size.equals(0)) { + } else if (size.longValue() == 0L) { state = STATE_FINISHED; remaining = 0; } else {
- fixes the initialization of state and remaining fields in case size is zero (Long.equals(Integer) results always in false; replaced by simpler and faster code).
undertow-io_undertow
train
java
bcaa0b0e7c5e6bb4752caefd981fc5aba05af495
diff --git a/src/Curl.php b/src/Curl.php index <HASH>..<HASH> 100644 --- a/src/Curl.php +++ b/src/Curl.php @@ -234,10 +234,6 @@ class Curl curl_close($ch); if ($curlInfo['result'] == CURLE_OK) { $this->onProcess($task, $param); - if (isset($task['opt'][CURLOPT_FILE]) && - is_resource($task['opt'][CURLOPT_FILE])) { - fclose($task['opt'][CURLOPT_FILE]); - } } // error handle $callFail = false;
Remove auto close for CURLOPT_FILE.
ares333_php-curl
train
php
1e1bd4f5687ff5c75de4f0e5fa4ff4967348b413
diff --git a/src/Field.php b/src/Field.php index <HASH>..<HASH> 100644 --- a/src/Field.php +++ b/src/Field.php @@ -260,9 +260,7 @@ abstract class Field $this->type = ''; } - for($i = 1; $i < count($parts) && $parts[$i] != "Field"; $i++); - - for(; $i < count($parts); $i++) + for ($i = array_search('Field', $parts); 0 < $i && $i < count($parts); $i++) { $this->type .= '\\' . StringHelper::ucfirst($parts[$i]); }
Code style for control statement fixed; followed by code simplification. Actual one was causing Travis, build to fail due to inline-control-structure usage and no space before parens of for statements.
joomla-framework_form
train
php
4f6f18c73b6ddcd957fbca79ceb9f5fc97131d03
diff --git a/core/src/main/java/io/undertow/security/impl/SingleSignOnAuthenticationMechanism.java b/core/src/main/java/io/undertow/security/impl/SingleSignOnAuthenticationMechanism.java index <HASH>..<HASH> 100644 --- a/core/src/main/java/io/undertow/security/impl/SingleSignOnAuthenticationMechanism.java +++ b/core/src/main/java/io/undertow/security/impl/SingleSignOnAuthenticationMechanism.java @@ -169,7 +169,11 @@ public class SingleSignOnAuthenticationMechanism implements AuthenticationMechan if (reason == SessionDestroyedReason.INVALIDATED) { for (Session associatedSession : sso) { associatedSession.invalidate(null); + sso.remove(associatedSession); } + } + // If there are no more associated sessions, remove the SSO altogether + if (!sso.iterator().hasNext()) { manager.removeSingleSignOn(ssoId); } } finally {
UNDERTOW-<I> SSO not destroyed when the last associated session times out
undertow-io_undertow
train
java
b1006d75ab0344bffaf08cd4d44fba791bb288d7
diff --git a/tests/functional/TimeSeriesOperationsTest.php b/tests/functional/TimeSeriesOperationsTest.php index <HASH>..<HASH> 100644 --- a/tests/functional/TimeSeriesOperationsTest.php +++ b/tests/functional/TimeSeriesOperationsTest.php @@ -116,7 +116,6 @@ class TimeSeriesOperationsTest extends TestCase { $row = static::generateRow(true); $row[2] = (new Riak\TimeSeries\Cell("time"))->setTimestampValue(static::threeHoursAgo()); - $b64 = base64_encode($row[7]->getValue()); $command = (new Command\Builder\TimeSeries\StoreRows(static::$riak)) ->inTable(static::$table) @@ -137,7 +136,12 @@ class TimeSeriesOperationsTest extends TestCase $this->assertEquals('200', $response->getCode(), $response->getMessage()); $this->assertCount(8, $response->getRow()); - $this->assertEquals($b64, $response->getRow()['blob_field']); + if (getenv('PB_INTERFACE')) { + $this->assertEquals($row[7]->getValue(), $response->getRow()[7]->getValue()); + } else { + $b64 = base64_encode($row[7]->getValue()); + $this->assertEquals($b64, $response->getRow()['blob_field']); + } } public function testFetchRow()
Handle PB / HTTP responses separately.
basho_riak-php-client
train
php
ebabfffd75b1010b31a83bf5e05448bbf249b61a
diff --git a/lib/cliff.js b/lib/cliff.js index <HASH>..<HASH> 100644 --- a/lib/cliff.js +++ b/lib/cliff.js @@ -97,7 +97,7 @@ cliff.stringifyRows = function (rows, colors) { for (i = 0; i < row.length; i += 1) { item = cliff.stringifyLiteral(row[i]); item = colorize ? item[colors[i]] : item; - length = real_length(item); + length = realLength(item); padding = length < lengths[i] ? lengths[i] - length + 2 : 2; rowtext += item + new Array(padding).join(' '); } @@ -242,14 +242,14 @@ cliff.typeOf = function typeOf (value) { return s; } -var real_length = function (str) { +var realLength = function (str) { return ("" + str).replace(/\u001b\[\d+m/g,'').length; } var longestElement = function (a) { var l = 0; for (var i = 0; i < a.length; i++) { - var new_l = real_length(a[i]); + var new_l = realLength(a[i]); if (l < new_l) { l = new_l; }
[minor] fixed some style issues
flatiron_cliff
train
js
d373a1c3c17fb8b830e5e8e3949016694f0713ff
diff --git a/src/Illuminate/Database/Eloquent/Model.php b/src/Illuminate/Database/Eloquent/Model.php index <HASH>..<HASH> 100644 --- a/src/Illuminate/Database/Eloquent/Model.php +++ b/src/Illuminate/Database/Eloquent/Model.php @@ -435,6 +435,20 @@ abstract class Model implements Arrayable, ArrayAccess, HasBroadcastChannel, Jso } /** + * Qualify the column's lists name by the model's table. + * + * @param array|mixed $columns + * @return array + */ + public function qualifyColumns(...$columns) { + $qualifiedArray = []; + foreach($columns as $column) { + $qualifiedArray[] = $this->qualifyColumn($column); + } + return $qualifiedArray; + } + + /** * Create a new instance of the given model. * * @param array $attributes
Define qualifyColumns method
laravel_framework
train
php
d5d3f025d17d4ca7d355856ad6ae2fd28b074bb4
diff --git a/node-perf-dash/www/controller/index.js b/node-perf-dash/www/controller/index.js index <HASH>..<HASH> 100644 --- a/node-perf-dash/www/controller/index.js +++ b/node-perf-dash/www/controller/index.js @@ -71,7 +71,7 @@ var plotRules = { // Rules to parse test options var testOptions = { 'density': { - options: ['opertation', 'mode', 'pods', 'background pods', 'interval (ms)', 'QPS'], + options: ['operation', 'mode', 'pods', 'background pods', 'interval (ms)', 'QPS'], remark: '', }, 'resource': {
Fix typo: oper(t)ation
kubernetes-retired_contrib
train
js
6021d07abfb1a8d5be1e05832262a86dc9bc4d2e
diff --git a/lib/Cpdf.php b/lib/Cpdf.php index <HASH>..<HASH> 100644 --- a/lib/Cpdf.php +++ b/lib/Cpdf.php @@ -15,6 +15,9 @@ * @license Public Domain http://creativecommons.org/licenses/publicdomain/ * @package Cpdf */ +use FontLib\Font; +use FontLib\Binary_Stream; + class Cpdf { /** @@ -2358,7 +2361,7 @@ EOT; // Write new font $tmp_name = "$fbfile.tmp.".uniqid(); - $font_obj->open($tmp_name, Font_Binary_Stream::modeWrite); + $font_obj->open($tmp_name, Binary_Stream::modeWrite); $font_obj->encode(array("OS/2")); $font_obj->close();
Update CPDF to work with php-font-lib v3
dompdf_dompdf
train
php
bb49fe9e6e39f9e3dba022b9dbaa9463de5d5ad3
diff --git a/sum/checks.go b/sum/checks.go index <HASH>..<HASH> 100644 --- a/sum/checks.go +++ b/sum/checks.go @@ -53,3 +53,17 @@ func (c Checks) Get(id string) *Check { } return nil } + +func (c Checks) Versions() []tarsum.Version { + versionsMap := map[tarsum.Version]int{} + for _, check := range c { + if _, ok := versionsMap[check.Version]; !ok { + versionsMap[check.Version] = 0 + } + } + versions := []tarsum.Version{} + for k := range versionsMap { + versions = append(versions, k) + } + return versions +}
Convenience access for versions in checks for a group of sum checks, expose a function that provides all the tarsum.Version's present.
vbatts_docker-utils
train
go
81abec023851cc9f60443ec3b4d815e83fe9c39d
diff --git a/cheroot/server.py b/cheroot/server.py index <HASH>..<HASH> 100644 --- a/cheroot/server.py +++ b/cheroot/server.py @@ -1602,6 +1602,7 @@ class HTTPServer(object): pass self.socket.bind(self.bind_addr) + self.bind_addr = self.socket.getsockname()[:2] # TODO: keep separate def tick(self): """Accept a new connection and put it on the Queue."""
Hotfix saving actual bound addr for ephemeral port While this workaround would work, I'd prefer keeping both requested and actual bind addrs within the server object, which might need bits of redesign.
cherrypy_cheroot
train
py
6f2925f02bde4344fb8ffcd26549248c29abe235
diff --git a/input/observable.js b/input/observable.js index <HASH>..<HASH> 100644 --- a/input/observable.js +++ b/input/observable.js @@ -114,8 +114,8 @@ Object.defineProperties(PropObserv.prototype, { dom.classList.add('dbjs-input-component'); // Required - dom.classList[desc.required ? 'add' : 'remove']('required'); - dom.classList[desc.required ? 'remove' : 'add']('optional'); + dom.classList[desc.required ? 'add' : 'remove']('dbjs-required'); + dom.classList[desc.required ? 'remove' : 'add']('dbjs-optional'); // Changed input.on('change:changed', cb = function (value) {
Rename 'required' class, up to 'dbjs-required'
medikoo_dbjs-dom
train
js
bcd2610823007e7fffdb54672872de6eae2bc254
diff --git a/lavalink/websocket.py b/lavalink/websocket.py index <HASH>..<HASH> 100644 --- a/lavalink/websocket.py +++ b/lavalink/websocket.py @@ -24,7 +24,7 @@ class WebSocket: self._shards = self._node._lavalink._shard_count self._user_id = self._node._lavalink._user_id - self._loop = self._lavalink.loop + self._loop = self._node._lavalink._loop self._loop.create_task(self.connect()) # TODO: Consider making add_node an async function to prevent creating a bunch of tasks? @property
naniware doesn't exist smfh
Devoxin_Lavalink.py
train
py
ead3811df6cc10873d9e32f8cff227cf6e5d15a8
diff --git a/guacamole-common-js/src/main/resources/guacamole.js b/guacamole-common-js/src/main/resources/guacamole.js index <HASH>..<HASH> 100644 --- a/guacamole-common-js/src/main/resources/guacamole.js +++ b/guacamole-common-js/src/main/resources/guacamole.js @@ -439,10 +439,10 @@ Guacamole.Client = function(tunnel) { var channelMask = parseInt(parameters[0]); var layer = getLayer(parseInt(parameters[1])); - var r = getLayer(parseInt(parameters[2])); - var g = getLayer(parseInt(parameters[3])); - var b = getLayer(parseInt(parameters[4])); - var a = getLayer(parseInt(parameters[5])); + var r = parseInt(parameters[2]); + var g = parseInt(parameters[3]); + var b = parseInt(parameters[4]); + var a = parseInt(parameters[5]); layer.setChannelMask(channelMask);
Accidentally used getLayer() in RGBA component ints.
glyptodon_guacamole-client
train
js
42f38c2ec8508f97efdf22d312cf5f6bd01d9ae6
diff --git a/lib/rrschedule.rb b/lib/rrschedule.rb index <HASH>..<HASH> 100644 --- a/lib/rrschedule.rb +++ b/lib/rrschedule.rb @@ -40,7 +40,9 @@ module RRSchedule team_b = t.reverse!.shift t.reverse! - matchup = {:team_a => team_a, :team_b => team_b} + + x = [team_a,team_b].shuffle + matchup = {:team_a => x[0], :team_b => x[1]} games << matchup end #done processing round @@ -205,12 +207,12 @@ module RRSchedule if @cur_rule_index < @rules.size-1 last_rule=@cur_rule @cur_rule_index += 1 - @cur_rule = @rules[@cur_rule_index] + @cur_rule = @rules[@cur_rule_index] #Go to the next date (except if the new rule is for the same weekday) @cur_date = next_game_date(@cur_date+=1,@cur_rule.wday) if last_rule.wday != @cur_rule.wday else @cur_rule_index = 0 - @cur_rule = @rules[@cur_rule_index] + @cur_rule = @rules[@cur_rule_index] @cur_date = next_game_date(@cur_date+=1,@cur_rule.wday) end @gt_stack = @cur_rule.gt.clone; @cur_gt = @gt_stack.shift
randomize team_a and team_b for each matchup. That way it's not always the same team that is 'home' or 'away'
flamontagne_rrschedule
train
rb
abefba7b033c937cd34748bd2d50dd32164ca3c1
diff --git a/src/Qcloud/Cos/Client.php b/src/Qcloud/Cos/Client.php index <HASH>..<HASH> 100644 --- a/src/Qcloud/Cos/Client.php +++ b/src/Qcloud/Cos/Client.php @@ -22,7 +22,7 @@ use GuzzleHttp\Pool; class Client extends GuzzleClient { - const VERSION = '2.0.2'; + const VERSION = '2.0.3'; private $httpCilent; private $api; @@ -252,12 +252,16 @@ class Client extends GuzzleClient { return False; } } - + public static function explodeKey($key) { + // Remove a leading slash if one is found $split_key = explode('/', $key && $key[0] == '/' ? substr($key, 1) : $key); // Remove empty element - $split_key = array_filter($split_key); + + $split_key = array_filter($split_key, function($var) { + return !($var == '' || $var == null); + }); return implode("/", $split_key); }
update Client (#<I>)
tencentyun_cos-php-sdk-v5
train
php
4acb56f51c39bbfa2e995580903ed94ea832667c
diff --git a/lib/bummr/outdated.rb b/lib/bummr/outdated.rb index <HASH>..<HASH> 100644 --- a/lib/bummr/outdated.rb +++ b/lib/bummr/outdated.rb @@ -1,5 +1,6 @@ require 'open3' require 'singleton' +require 'bundler' module Bummr class Outdated
Explicity require bundler to detect its version
lpender_bummr
train
rb
8dd27e599ae7bc8f900b536bf891cc885dcab0ec
diff --git a/spec/tester_spec.rb b/spec/tester_spec.rb index <HASH>..<HASH> 100644 --- a/spec/tester_spec.rb +++ b/spec/tester_spec.rb @@ -50,7 +50,7 @@ describe Zxcvbn::Tester do context 'nil password' do specify do - expect { tester.test(nil) }.to_not raise_error + expect(tester.test(nil)).to have_attributes(entropy: 0, score: 0, crack_time: 0) end end -end \ No newline at end of file +end
Tell us how it *is* expected to behave
envato_zxcvbn-ruby
train
rb
a8bb6e7e900e9448aedcc9d5bd0e326ce13f30d0
diff --git a/src/components/picker/index.js b/src/components/picker/index.js index <HASH>..<HASH> 100644 --- a/src/components/picker/index.js +++ b/src/components/picker/index.js @@ -61,6 +61,10 @@ class Picker extends TextInput { */ renderPicker: PropTypes.func, /** + * Custom picker props (when using renderPicker, will apply on the button wrapper) + */ + customPickerProps: PropTypes.object, + /** * Add onPress callback for when pressing the picker */ onPress: PropTypes.func, @@ -280,7 +284,7 @@ class Picker extends TextInput { } render() { - const {useNativePicker, renderPicker, testID} = this.props; + const {useNativePicker, renderPicker, customPickerProps, testID} = this.props; if (useNativePicker) return <NativePicker {...this.props} />; @@ -288,7 +292,7 @@ class Picker extends TextInput { const {value} = this.state; return ( <View left> - <Button link onPress={this.handlePickerOnPress} testID={testID}> + <Button {...customPickerProps} link onPress={this.handlePickerOnPress} testID={testID} style={{borderWidth: 1}}> {renderPicker(value)} </Button> {this.renderExpandableModal()}
add customPickerProps prop to allow control the custom picker wrapper
wix_react-native-ui-lib
train
js
7b1ffda1c4648404316e502bcfde9f97ebacb969
diff --git a/src/User/User.php b/src/User/User.php index <HASH>..<HASH> 100644 --- a/src/User/User.php +++ b/src/User/User.php @@ -282,7 +282,7 @@ class User extends \Hubzero\Database\Relational */ public function tokens() { - return $this->oneToMany('Hubzero\User\Token'); + return $this->oneToMany('Hubzero\User\Token', 'user_id'); } /** @@ -293,7 +293,7 @@ class User extends \Hubzero\Database\Relational */ public function reputation() { - return $this->oneToOne('Hubzero\User\Reputation'); + return $this->oneToOne('Hubzero\User\Reputation', 'user_id'); } /**
Be explicit on foreign key name, in case class is being extended (#<I>)
hubzero_framework
train
php
1d89818236916d51a70872bcf9551108c5b1311f
diff --git a/lib/weblib.php b/lib/weblib.php index <HASH>..<HASH> 100644 --- a/lib/weblib.php +++ b/lib/weblib.php @@ -503,14 +503,6 @@ class moodle_url { */ public function compare(moodle_url $url, $matchtype = URL_MATCH_EXACT) { - // Set path to / if it is not set - if ($this->path == '') { - $this->path = '/'; - } - if ($url->path == '') { - $url->path = '/'; - } - $baseself = $this->out(true); $baseother = $url->out(true);
navigation MDL-<I> Fixed regression created earlier
moodle_moodle
train
php
cb09e0058c308c596d14da201c8c9795ae262524
diff --git a/molgenis-data-annotators/src/main/java/org/molgenis/data/annotation/CrudRepositoryAnnotator.java b/molgenis-data-annotators/src/main/java/org/molgenis/data/annotation/CrudRepositoryAnnotator.java index <HASH>..<HASH> 100644 --- a/molgenis-data-annotators/src/main/java/org/molgenis/data/annotation/CrudRepositoryAnnotator.java +++ b/molgenis-data-annotators/src/main/java/org/molgenis/data/annotation/CrudRepositoryAnnotator.java @@ -117,8 +117,8 @@ public class CrudRepositoryAnnotator { if (createCopy) { - DefaultEntityMetaData newEntityMetaData = new DefaultEntityMetaData( - RandomStringUtils.randomAlphanumeric(30), entityMetaData); + DefaultEntityMetaData newEntityMetaData = new DefaultEntityMetaData(RandomStringUtils.randomAlphabetic(30), + entityMetaData); if (newEntityMetaData.getAttribute(compoundAttributeMetaData.getName()) == null) { newEntityMetaData.addAttributeMetaData(compoundAttributeMetaData);
User alphabetic id's
molgenis_molgenis
train
java
44cf8ea3507848ac135520ce8aeb934dd5b0240f
diff --git a/openquake/calculators/export/loss_curves.py b/openquake/calculators/export/loss_curves.py index <HASH>..<HASH> 100644 --- a/openquake/calculators/export/loss_curves.py +++ b/openquake/calculators/export/loss_curves.py @@ -21,7 +21,22 @@ from openquake.commonlib import writers class LossCurveExporter(object): """ - Abstract Base Class with common methods for its subclasses + Exporter for the loss curves. The most importante method is + `.export(export_type, what)` where `export_type` is a string like 'csv', + and `what` is a string called export specifier. Here are some examples + for the export specifier: + + sid-42/ # export loss curves of site #42 for all realizations + sid-42/rlz-003 # export all loss curves of site #42, realization #3 + sid-42/stats # export statistical loss curves of site #42 + sid-42/mean # export mean loss curves of site #42 + sid-42/quantile-0.1 # export quantile loss curves of site #42 + + ref-a1/ # export loss curves of asset a1 for all realizations + ref-a1/rlz-003 # export loss curves of asset a1, realization 3 + ref-a1/stats # export statistical loss curves of asset a1 + ref-a1/mean # export mean loss curves of asset a1 + ref-a1/quantile-0.1 # export quantile loss curves of asset a1 """ def __init__(self, dstore): self.dstore = dstore
Added a docstring [skip CI] Former-commit-id: a5ad1d8eec<I>b<I>fa<I>b<I>e<I>aefea6ebd<I>b
gem_oq-engine
train
py
fc617ad605ba45dca5f8330cf08ed9b0b46f1317
diff --git a/unittests/autoconfig.py b/unittests/autoconfig.py index <HASH>..<HASH> 100644 --- a/unittests/autoconfig.py +++ b/unittests/autoconfig.py @@ -8,6 +8,9 @@ import sys import logging import warnings +# Prevents copy.deepcopy RecursionError in some tests (Travis build) +sys.setrecursionlimit(10000) + this_module_dir_path = os.path.abspath( os.path.dirname(sys.modules[__name__].__file__))
Increase recursion limit for python, needed to fix travis build error Three tests are failing in declarations_comparison_tester with: RecursionError: maximum recursion depth exceeded This is an attempt to fix it, it is not sure it will help.
gccxml_pygccxml
train
py
892a3e63e969c1ee1e61f92593ceb55cd3451156
diff --git a/tpb/tpb.py b/tpb/tpb.py index <HASH>..<HASH> 100644 --- a/tpb/tpb.py +++ b/tpb/tpb.py @@ -18,12 +18,7 @@ import re import sys import time -from bs4 import BeautifulSoup - -from utils import URL -#from constants import CATEGORIES -#from constants import ORDERS -from constants import * +from .utils import URL if sys.version_info >= (3, 0): from urllib.request import urlopen
Fixed imports and restored .gitignore.
karan_TPB
train
py
22c19ffe7970ab430edd748cf1c45239f3d3e20a
diff --git a/src/requirementslib/models/cache.py b/src/requirementslib/models/cache.py index <HASH>..<HASH> 100644 --- a/src/requirementslib/models/cache.py +++ b/src/requirementslib/models/cache.py @@ -63,13 +63,11 @@ class DependencyCache(object): def __init__(self, cache_dir=None): if cache_dir is None: cache_dir = CACHE_DIR - if not vistir.compat.Path(CACHE_DIR).is_dir(): + if not vistir.compat.Path(CACHE_DIR).absolute().is_dir(): try: - _ensure_dir(cache_dir) - except OSError: - if os.path.isdir(os.path.abspath(cache_dir)): - pass - raise + vistir.path.mkdir_p(os.path.abspath(cache_dir)) + except FileExistsError: + pass py_version = '.'.join(str(digit) for digit in sys.version_info[:2]) cache_filename = 'depcache-py{}.json'.format(py_version)
wtf is going on with appveyor...
sarugaku_requirementslib
train
py
a0d1e5c8fcd07f0930cda0a8bbdd19c0cee83696
diff --git a/lib/trusty_cms/setup.rb b/lib/trusty_cms/setup.rb index <HASH>..<HASH> 100644 --- a/lib/trusty_cms/setup.rb +++ b/lib/trusty_cms/setup.rb @@ -91,7 +91,7 @@ module TrustyCms def prompt_for_admin_name username = ask('Name (Administrator): ', String) do |q| q.validate = /^.{0,100}$/ - q.responses[:not_valid] = "Invalid name. Must be at less than 100 characters long." + q.responses[:not_valid] = "Invalid name. Must be under 100 characters long." q.whitespace = :strip end username = "Administrator" if username.blank? @@ -109,13 +109,14 @@ module TrustyCms end def prompt_for_admin_password - password = ask('Password (radiant): ', String) do |q| + default_password = 'trusty' + password = ask("Password (#{default_password}): ", String) do |q| q.echo = false unless defined?(::JRuby) # JRuby doesn't support stty interaction q.validate = /^(|.{5,40})$/ q.responses[:not_valid] = "Invalid password. Must be at least 5 characters long." q.whitespace = :strip end - password = "radiant" if password.blank? + password = default_password if password.blank? password end
Let's make the default admin password trusty while we're at it :)
pgharts_trusty-cms
train
rb
916653ff8ca5587f640543ec80b32530ceafe4aa
diff --git a/saltcloud/cloud.py b/saltcloud/cloud.py index <HASH>..<HASH> 100644 --- a/saltcloud/cloud.py +++ b/saltcloud/cloud.py @@ -6,6 +6,7 @@ correct cloud modules import os import glob import time +import signal import logging import tempfile import multiprocessing @@ -204,10 +205,25 @@ class Cloud(object): }) output = {} - parallel_pmap = multiprocessing.Pool(len(providers)).map( - func=run_paralel_map_providers_query, - iterable=multiprocessing_data + providers_count = len(providers) + pool = multiprocessing.Pool( + providers_count < 10 and providers_count or 10, + init_pool_worker ) + try: + parallel_pmap = pool.map( + func=run_paralel_map_providers_query, + iterable=multiprocessing_data + ) + except KeyboardInterrupt: + print 'Caught KeyboardInterrupt, terminating workers' + pool.terminate() + pool.join() + raise SaltCloudSystemExit('Keyboard Interrupt caught') + else: + pool.close() + pool.join() + for obj in parallel_pmap: output.update(obj) return output @@ -1079,6 +1095,14 @@ class Map(Cloud): return output +def init_pool_worker(): + ''' + Make every worker ignore KeyboarInterrup's since it will be handled by the + parent process. + ''' + signal.signal(signal.SIGINT, signal.SIG_IGN) + + def create_multiprocessing(parallel_data): ''' This function will be called from another process when running a map in
Properly handle keyboard interrupts when parallel loading providers.
saltstack_salt
train
py
0380c62ac2ef684f17155c15c2ecfd3a7f8df078
diff --git a/src/Field/Configurator/CommonPreConfigurator.php b/src/Field/Configurator/CommonPreConfigurator.php index <HASH>..<HASH> 100644 --- a/src/Field/Configurator/CommonPreConfigurator.php +++ b/src/Field/Configurator/CommonPreConfigurator.php @@ -104,7 +104,9 @@ final class CommonPreConfigurator implements FieldConfiguratorInterface { // don't autogenerate a label for these special fields (there's a dedicated configurator for them) if (FormField::class === $field->getFieldFqcn()) { - return $field->getLabel(); + $label = $field->getLabel(); + + return null === $label ? $label: $this->translator->trans($label, $field->getTranslationParameters(), $translationDomain); } // if an Avatar field doesn't define its label, don't autogenerate it for the 'index' page
Translate the (optional) label of form panels
EasyCorp_EasyAdminBundle
train
php
30dff28d8ad3741b3d6f3e85fda01f859eced59e
diff --git a/Twilio/Stream.php b/Twilio/Stream.php index <HASH>..<HASH> 100644 --- a/Twilio/Stream.php +++ b/Twilio/Stream.php @@ -10,11 +10,11 @@ class Stream implements \Iterator { function __construct(Page $page, $limit, $pageLimit) { $this->page = $page; + $this->firstPage = $page; $this->limit = $limit; $this->currentRecord = 1; $this->pageLimit = $pageLimit; $this->currentPage = 1; - $this->started = false; } /** @@ -76,12 +76,11 @@ class Stream implements \Iterator { * Rewind the Iterator to the first element * @link http://php.net/manual/en/iterator.rewind.php * @return void Any returned value is ignored. - * @throws TwilioException on restart */ public function rewind() { - if ($this->started) { - throw new TwilioException('Streams can not be restarted'); - } + $this->page = $this->firstPage; + $this->currentPage = 1; + $this->currentRecord = 1; } protected function overLimit() {
Implement Stream rewind properly in PHP
twilio_twilio-php
train
php
6d59777e51f12b04f793fc7a85901cacb64fa700
diff --git a/salt/netapi/rest_cherrypy/app.py b/salt/netapi/rest_cherrypy/app.py index <HASH>..<HASH> 100644 --- a/salt/netapi/rest_cherrypy/app.py +++ b/salt/netapi/rest_cherrypy/app.py @@ -508,8 +508,10 @@ def lowdata_fmt(): data = cherrypy.request.unserialized_data - if (cherrypy.request.headers['Content-Type'] - == 'application/x-www-form-urlencoded'): + # if the data was sent as urlencoded, we need to make it a list. + # this is a very forgiving implementation as different clients set different + # headers for form encoded data (including charset or something similar) + if not isinstance(data, list): # Make the 'arg' param a list if not already if 'arg' in data and not isinstance(data['arg'], list): data['arg'] = [data['arg']]
Fix regression in url encoded salt-api messages Most clients that do url encoding include other data in the Content-Type field (requests for example sets "application/x-www-form-urlencoded; charset=utf-8"). This changes the api to be a more forgiving server which will make any non-list struct a list
saltstack_salt
train
py