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
561542f0682ce88ec518f1a7ceca24395b6c7066
diff --git a/flight/Flight.php b/flight/Flight.php index <HASH>..<HASH> 100644 --- a/flight/Flight.php +++ b/flight/Flight.php @@ -38,12 +38,10 @@ * @method static void render($file, array $data = null, $key = null) Renders a template file. * @method static flight\template\View view() Returns View instance. * - * Redirects. - * @method static void redirect($url, $code = 303) Redirects to another URL. - * * Request & Response. * @method static flight\net\Request request() Returns Request instance. * @method static flight\net\Response response() Returns Request instance. + * @method static void redirect($url, $code = 303) Redirects to another URL. * @method static void json($data, $code = 200, $encode = true) Sends a JSON response. * @method static void jsonp($data, $param = 'jsonp', $code = 200, $encode = true) Sends a JSONP response. * @method static void error($exception) Sends an HTTP 500 response.
Redirects > Request & Response
mikecao_flight
train
php
eeccf0911a0ae696971069fd75b5e6a18077162c
diff --git a/state/apiserver/common/addresses.go b/state/apiserver/common/addresses.go index <HASH>..<HASH> 100644 --- a/state/apiserver/common/addresses.go +++ b/state/apiserver/common/addresses.go @@ -6,8 +6,6 @@ package common import ( "launchpad.net/loggo" - "launchpad.net/juju-core/state" - "launchpad.net/juju-core/state/api" "launchpad.net/juju-core/state/api/params" )
we don't need the imports, either
juju_juju
train
go
cb3f9e039bd45e060c43e56e9deccee9a58edfce
diff --git a/src/Intahwebz/Jig/JigBase.php b/src/Intahwebz/Jig/JigBase.php index <HASH>..<HASH> 100644 --- a/src/Intahwebz/Jig/JigBase.php +++ b/src/Intahwebz/Jig/JigBase.php @@ -24,10 +24,16 @@ abstract class JigBase { function __construct(ViewModel $viewModel, $jigRender){ $this->viewModel = $viewModel; $this->jigRender = $jigRender; + $this->init(); } abstract function renderInternal(); + function init() { + //Override stuff. + } + + /** * @param $view */ diff --git a/src/Intahwebz/Jig/JigRender.php b/src/Intahwebz/Jig/JigRender.php index <HASH>..<HASH> 100644 --- a/src/Intahwebz/Jig/JigRender.php +++ b/src/Intahwebz/Jig/JigRender.php @@ -226,8 +226,6 @@ class JigRender { $className = $this->jigConverter->getNamespacedClassNameFromFileName($templateFilename, $proxied); - - //If not cached if ($this->compileCheck == JigRender::COMPILE_CHECK_EXISTS) { if (class_exists($className) == true) {
Added init function to allow overriding.
Danack_Jig
train
php,php
873481999a1da3dcea02f9f5c485da6688074c2d
diff --git a/WordPress/Sniffs/VIP/ValidatedSanitizedInputSniff.php b/WordPress/Sniffs/VIP/ValidatedSanitizedInputSniff.php index <HASH>..<HASH> 100644 --- a/WordPress/Sniffs/VIP/ValidatedSanitizedInputSniff.php +++ b/WordPress/Sniffs/VIP/ValidatedSanitizedInputSniff.php @@ -91,9 +91,7 @@ class WordPress_Sniffs_VIP_ValidatedSanitizedInputSniff extends WordPress_Sniff // Handling string interpolation if ( T_DOUBLE_QUOTED_STRING === $tokens[ $stackPtr ]['code'] ) { $interpolated_variables = array_map( - function ( $symbol ) { - return '$' . $symbol; - }, + create_function( '$symbol', 'return "$" . $symbol;' ), // Replace with closure when 5.3 is minimum requirement for PHPCS. $this->get_interpolated_variables( $tokens[ $stackPtr ]['content'] ) ); foreach ( array_intersect( $interpolated_variables, $superglobals ) as $bad_variable ) {
Replace closure with create_function() for <I> support
WordPress-Coding-Standards_WordPress-Coding-Standards
train
php
f5a63a0a8853e76b4ef270bcdddec873d6953ece
diff --git a/mappings/document.js b/mappings/document.js index <HASH>..<HASH> 100644 --- a/mappings/document.js +++ b/mappings/document.js @@ -186,9 +186,6 @@ var schema = { _source: { excludes : ['shape','phrase'] }, - _all: { - enabled: false - }, dynamic: 'strict' }; diff --git a/test/document.js b/test/document.js index <HASH>..<HASH> 100644 --- a/test/document.js +++ b/test/document.js @@ -185,7 +185,7 @@ module.exports.tests.dynamic_templates = function(test, common) { // _all should be disabled module.exports.tests.all_disabled = function(test, common) { test('_all disabled', function(t) { - t.equal(schema._all.enabled, false, '_all disabled'); + t.false(schema._all, '_all undefined'); t.end(); }); }; diff --git a/test/fixtures/expected.json b/test/fixtures/expected.json index <HASH>..<HASH> 100644 --- a/test/fixtures/expected.json +++ b/test/fixtures/expected.json @@ -1149,9 +1149,6 @@ "phrase" ] }, - "_all": { - "enabled": false - }, "dynamic": "strict" } }
feat(es7): remove _all mapping The `_all` field was deprecated in Elasticsearch 6 and completely removed in [Elasticsearch 7](<URL>
pelias_schema
train
js,js,json
a0d3f9452a246f4826157991647b6df30a03a806
diff --git a/workflows/frontend/__init__.py b/workflows/frontend/__init__.py index <HASH>..<HASH> 100644 --- a/workflows/frontend/__init__.py +++ b/workflows/frontend/__init__.py @@ -231,7 +231,11 @@ class Frontend(): if self._pipe_commands: self._pipe_commands.send(command) else: - self.log.error('No command queue pipe found for command\n%s', str(command)) + if self.shutdown: + # Stop delivering messages in shutdown. + self.log.info('During shutdown no command queue pipe found for command\n%s', str(command)) + else: + self.log.error('No command queue pipe found for command\n%s', str(command)) def process_transport_command(self, header, message): '''Parse a command coming in through the transport command subscription'''
Ignore errors occurring during message forward due to closed connection when service is in shutdown
DiamondLightSource_python-workflows
train
py
2e0391ea84ba02b6a8462209f55019f07d01bdd4
diff --git a/cmd/swarm/config.go b/cmd/swarm/config.go index <HASH>..<HASH> 100644 --- a/cmd/swarm/config.go +++ b/cmd/swarm/config.go @@ -38,7 +38,7 @@ import ( bzzapi "github.com/ethereum/go-ethereum/swarm/api" ) -const SWARM_VERSION = "0.3" +const SWARM_VERSION = "0.3.1-unstable" var ( //flag definition for the dumpconfig command
cmd/swarm: change version of swarm binary (#<I>)
ethereum_go-ethereum
train
go
696432d53b373e80ead783a3bf4c4f3fdfdb7d26
diff --git a/lib/core/staticFile.js b/lib/core/staticFile.js index <HASH>..<HASH> 100644 --- a/lib/core/staticFile.js +++ b/lib/core/staticFile.js @@ -1,8 +1,5 @@ -var mime = require('mime'); - // TODO: support Range requests - module.exports = function handle_staticFile() { if (this.allowMethod(['GET', 'HEAD'])) return;
[cleanup] mime require in staticFile
AndreasMadsen_piccolo
train
js
3099b814969f0abf23f93008fb7260e134d9f7d2
diff --git a/includes/os/class.WINNT.inc.php b/includes/os/class.WINNT.inc.php index <HASH>..<HASH> 100644 --- a/includes/os/class.WINNT.inc.php +++ b/includes/os/class.WINNT.inc.php @@ -1345,15 +1345,15 @@ class WINNT extends OS $this->_loadavg(); $this->_processes(); } - if (!$this->blockname || $this->blockname==='network') { - $this->_network(); - } if (!$this->blockname || $this->blockname==='hardware') { $this->_machine(); $this->_cpuinfo(); $this->_meminfo(); $this->_hardware(); } + if (!$this->blockname || $this->blockname==='network') { + $this->_network(); + } if (!$this->blockname || $this->blockname==='filesystem') { $this->_filesystems(); }
Update class.WINNT.inc.php
phpsysinfo_phpsysinfo
train
php
020e23e8053313cdc1c565c433d7dff9827772f7
diff --git a/capidup/tests/test_round_up.py b/capidup/tests/test_round_up.py index <HASH>..<HASH> 100644 --- a/capidup/tests/test_round_up.py +++ b/capidup/tests/test_round_up.py @@ -42,21 +42,16 @@ known_values = [ # list of (n, n, n) tuples, with length RANDOM_REPEATS _random_same = [ - (_n, _n, _n) - for _n in - map(lambda _: random.randrange(0, MAX_RANDOM_NUM), - range(RANDOM_REPEATS)) + (random.randrange(0, MAX_RANDOM_NUM),) * 3 + for _ in range(RANDOM_REPEATS) ] # list of (n, m) tuples, with length RANDOM_REPEATS, where # n >= 0 and m >= 1 _random_n_mult = [ - (n, mult) - for n, mult in - map(lambda _: (random.randrange(0, MAX_RANDOM_NUM), - random.randrange(1, MAX_RANDOM_NUM)), - range(RANDOM_REPEATS)) + (random.randrange(0, MAX_RANDOM_NUM), random.randrange(1, MAX_RANDOM_NUM)) + for _ in range(RANDOM_REPEATS) ]
Simplify test data generation in test_round_up.
israel-lugo_capidup
train
py
3f2a95f5dc37e311ead2c538237106c9391d6a27
diff --git a/hazelcast-client/src/test/java/com/hazelcast/client/ClientMemberAttributeTest.java b/hazelcast-client/src/test/java/com/hazelcast/client/ClientMemberAttributeTest.java index <HASH>..<HASH> 100644 --- a/hazelcast-client/src/test/java/com/hazelcast/client/ClientMemberAttributeTest.java +++ b/hazelcast-client/src/test/java/com/hazelcast/client/ClientMemberAttributeTest.java @@ -48,7 +48,7 @@ public class ClientMemberAttributeTest extends HazelcastTestSupport { @Test(timeout = 40000) public void testChangeMemberAttributes() throws Exception { - final int count = 1000; + final int count = 100; final HazelcastInstance instance = Hazelcast.newHazelcastInstance(); final ClientConfig config = new ClientConfig();
Lowered count to make it finish in time
hazelcast_hazelcast
train
java
11d0cef36c05f77b4debdfe1e0d69745c2aa428a
diff --git a/klein.php b/klein.php index <HASH>..<HASH> 100644 --- a/klein.php +++ b/klein.php @@ -108,7 +108,7 @@ function dispatch($uri = null, $req_method = null, array $params = null, $captur } $matched = 0; - $methods_matched = null; + $methods_matched = array(); $apc = function_exists('apc_fetch'); ob_start(); @@ -205,7 +205,8 @@ function dispatch($uri = null, $req_method = null, array $params = null, $captur if (isset($match) && $match ^ $negate) { // Keep track of possibly matched methods - $methods_matched = array_merge( (array) $methods_matched, (array) $method ); + $methods_matched[] = $method; + $methods_matched = array_filter( $methods_matched ); $methods_matched = array_unique( $methods_matched ); if ( $possible_match ) {
Now using more efficient array operations for "methods_matched"
klein_klein.php
train
php
031f728beecb837aebe6255d0815fc526268e7b6
diff --git a/spec/grape/api_spec.rb b/spec/grape/api_spec.rb index <HASH>..<HASH> 100644 --- a/spec/grape/api_spec.rb +++ b/spec/grape/api_spec.rb @@ -579,6 +579,31 @@ describe Grape::API do last_response.body.should eql 'first second' end + it 'adds a before filter to current and child namespaces only' do + subject.get '/' do + "root - #{@foo}" + end + subject.namespace :blah do + before { @foo = 'foo' } + get '/' do + "blah - #{@foo}" + end + + namespace :bar do + get '/' do + "blah - bar - #{@foo}" + end + end + end + + get '/' + last_response.body.should eql 'root - ' + get '/blah' + last_response.body.should eql 'blah - foo' + get '/blah/bar' + last_response.body.should eql 'blah - bar - foo' + end + it 'adds a after_validation filter' do subject.after_validation { @foo = "first #{params[:id] }:#{params[:id].class}" } subject.after_validation { @bar = 'second' }
Test to confirm behaviour of before in namespace
ruby-grape_grape
train
rb
364214229dc459f059974e2f3355bb8c55af9e54
diff --git a/internal/protocol/packet_number_test.go b/internal/protocol/packet_number_test.go index <HASH>..<HASH> 100644 --- a/internal/protocol/packet_number_test.go +++ b/internal/protocol/packet_number_test.go @@ -10,8 +10,8 @@ import ( // Tests taken and extended from chrome var _ = Describe("packet number calculation", func() { - PIt("works with the example from the draft", func() { - Expect(InferPacketNumber(PacketNumberLen2, 0xa82f30ea, 0x9b32)).To(Equal(PacketNumber(0xa8309b32))) + It("works with the example from the draft", func() { + Expect(InferPacketNumber(PacketNumberLen2, 0xa82f30ea, 0x9b32)).To(Equal(PacketNumber(0xa82f9b32))) }) getEpoch := func(len PacketNumberLen) uint64 {
enable packet number encoding test case taken from the draft
lucas-clemente_quic-go
train
go
e9e7f6b2341f677fbf967602bdd6810e8e556d25
diff --git a/rapidoid-commons/src/main/java/org/rapidoid/scan/ClasspathUtil.java b/rapidoid-commons/src/main/java/org/rapidoid/scan/ClasspathUtil.java index <HASH>..<HASH> 100644 --- a/rapidoid-commons/src/main/java/org/rapidoid/scan/ClasspathUtil.java +++ b/rapidoid-commons/src/main/java/org/rapidoid/scan/ClasspathUtil.java @@ -128,16 +128,18 @@ public class ClasspathUtil extends RapidoidThing { } AtomicInteger searched = new AtomicInteger(); - List<String> classes = U.list(); + Set<String> classes = U.set(); for (String pkg : pkgs) { classes.addAll(retrieveClasses(pkg, params.annotated(), pattern, params.classLoader(), searched)); } + List<String> classList = U.list(classes); + long timeMs = U.time() - startingAt; - Log.info("Finished classpath scan", "time", timeMs + "ms", "searched", searched.get(), "!found", Msc.classNames(classes)); + Log.info("Finished classpath scan", "time", timeMs + "ms", "searched", searched.get(), "!found", Msc.classNames(classList)); - return classes; + return classList; } private static List<String> retrieveClasses(String packageName, Class<? extends Annotation>[] annotated,
Preventing duplicates on classpath scan.
rapidoid_rapidoid
train
java
b2e84d9bf6c6cbb53cece9c24e67615c802574e8
diff --git a/niworkflows/tests/test_confounds.py b/niworkflows/tests/test_confounds.py index <HASH>..<HASH> 100644 --- a/niworkflows/tests/test_confounds.py +++ b/niworkflows/tests/test_confounds.py @@ -160,6 +160,15 @@ def test_ConfoundsCorrelationPlot(): """confounds correlation report test""" confounds_file = os.path.join(datadir, "confounds_test.tsv") cc_rpt = ConfoundsCorrelationPlot( - confounds_file=confounds_file, reference_column="a" + confounds_file=confounds_file, reference_column="a", ) _smoke_test_report(cc_rpt, "confounds_correlation.svg") + + +def test_ConfoundsCorrelationPlotColumns(): + """confounds correlation report test""" + confounds_file = os.path.join(datadir, "confounds_test.tsv") + cc_rpt = ConfoundsCorrelationPlot( + confounds_file=confounds_file, reference_column="a", columns=["b", "d", "f"], + ) + _smoke_test_report(cc_rpt, "confounds_correlation_cols.svg")
enh(tests): improve coverage
poldracklab_niworkflows
train
py
3378651548d4bda6a856c69719d593d902ec8b21
diff --git a/curse.go b/curse.go index <HASH>..<HASH> 100644 --- a/curse.go +++ b/curse.go @@ -19,6 +19,8 @@ type Cursor struct { Position StartingPosition Position Style + + terminal *term.Terminal } type Position struct { @@ -38,7 +40,8 @@ func New() (*Cursor, error) { c := &Cursor{} c.Position.X, c.StartingPosition.X = col, col c.Position.Y, c.StartingPosition.Y = line, line - return c, nil + c.terminal, err = term.New() + return c, err } func (c *Cursor) MoveUp(nLines int) *Cursor { @@ -126,6 +129,18 @@ func (c *Cursor) SetDefaultStyle() *Cursor { return c } +func (c *Cursor) ModeRaw() *Cursor { + _ = c.terminal.RawMode() + + return c +} + +func (c *Cursor) ModeRestore() *Cursor { + _ = c.terminal.Restore() + + return c +} + // using named returns to help when using the method to know what is what func GetScreenDimensions() (cols int, lines int, err error) { // todo: use kless/term to listen in on screen size changes
patch to fix raw mode issues by borrowing code from kless terminal
sethgrid_curse
train
go
7668aa556561988ff87527cc4217d92565de9cce
diff --git a/src/pythonfinder/__init__.py b/src/pythonfinder/__init__.py index <HASH>..<HASH> 100644 --- a/src/pythonfinder/__init__.py +++ b/src/pythonfinder/__init__.py @@ -1,6 +1,6 @@ from __future__ import print_function, absolute_import -__version__ = '1.1.9' +__version__ = '1.1.10.dev0' # Add NullHandler to "pythonfinder" logger, because Python2's default root # logger has no handler and warnings like this would be reported:
Prebump to <I>.dev0
sarugaku_pythonfinder
train
py
247f7f4e2785e69e6512e9785dc8c62e43a2d5b0
diff --git a/src/httpAdapters/SagCURLHTTPAdapter.php b/src/httpAdapters/SagCURLHTTPAdapter.php index <HASH>..<HASH> 100644 --- a/src/httpAdapters/SagCURLHTTPAdapter.php +++ b/src/httpAdapters/SagCURLHTTPAdapter.php @@ -93,18 +93,7 @@ class SagCURLHTTPAdapter extends SagHTTPAdapter { $response->body = ''; // split headers and body - list($continue, $headers, $response->body) = explode("\r\n\r\n", $chResponse); - - /* - * It doesn't always happen, but it seems that we will sometimes get a - * Continue header that will screw parsing up. - */ - if(!$response->body) { - $response->body = $headers; - $headers = $continue; - } - - unset($continue); + list($headers, $response->body) = explode("\r\n\r\n", $chResponse); // split up the headers $headers = explode("\r\n", $headers);
Removing old and broken Continue header handling code now that we prevent them.
sbisbee_sag
train
php
b0c87d0a8b1792f0761f54ddb3967f5f06fa9bdf
diff --git a/plugin.js b/plugin.js index <HASH>..<HASH> 100644 --- a/plugin.js +++ b/plugin.js @@ -40,6 +40,7 @@ const globals = new Set([ 'requestAnimationFrame', '_WORKLET', 'arguments', + 'Boolean', 'Map', 'Set', '_log',
Update plugin.js (#<I>)
kmagiera_react-native-reanimated
train
js
8103bcd7b0f29a3badedc47553800ae02318cf2c
diff --git a/sslyze/plugins/session_renegotiation_plugin.py b/sslyze/plugins/session_renegotiation_plugin.py index <HASH>..<HASH> 100755 --- a/sslyze/plugins/session_renegotiation_plugin.py +++ b/sslyze/plugins/session_renegotiation_plugin.py @@ -152,12 +152,12 @@ def _test_client_renegotiation( except socket.timeout: # This is how Netty rejects a renegotiation - https://github.com/nabla-c0d3/sslyze/issues/114 accepts_client_renegotiation = False - except socket.error as e: - if "connection was forcibly closed" in str(e.args): - accepts_client_renegotiation = False - elif "reset by peer" in str(e.args): - accepts_client_renegotiation = False - elif "Nassl SSL handshake failed" in str(e.args): + except ConnectionError: + accepts_client_renegotiation = False + except OSError as e: + # OSError is the parent of all (non-TLS) socket/connection errors so it should be last + if "Nassl SSL handshake failed" in e.args[0]: + # Special error returned by nassl accepts_client_renegotiation = False else: raise
[#<I>] Make error handling language agnostic for reneg
nabla-c0d3_sslyze
train
py
e1ce78443497b7b8795a0070621e9ba95cf7c954
diff --git a/src/store/modules/navigation.js b/src/store/modules/navigation.js index <HASH>..<HASH> 100644 --- a/src/store/modules/navigation.js +++ b/src/store/modules/navigation.js @@ -19,9 +19,14 @@ function transformViewName (view) { } function newIDGen (view, viewPosition) { let ID = '' - if (viewPosition === 'previous') store.state.cache[store.state.cache.length - 1].id.split('--') - if (viewPosition === 'past') store.state.cache[store.state.cache.length - 2].id.split('--') - if (viewPosition === 'last') store.state.cache[store.state.cache.length - 3].id.split('--') + if (viewPosition === 'previous') { + var index = 1 + } else if (viewPosition === 'past') { + index = 2 + } else { + index = 3 + } + store.state.cache[store.state.cache.length - index].id.split('--') view === viewPosition[0] ? ID = view + '--' + (Number(viewPosition[1]) + 1) : ID = view + '--0' return ID }
Simplify code for TransformViewName
zircleUI_zircleUI
train
js
60ea9ba9c174b5cd1e85042b64414b025000f8ac
diff --git a/aws/awserr/types.go b/aws/awserr/types.go index <HASH>..<HASH> 100644 --- a/aws/awserr/types.go +++ b/aws/awserr/types.go @@ -94,7 +94,9 @@ func (b baseError) OrigErr() error { // Pushes a new error to the stack func (b *baseError) Append(err error) { - b.errs = append(b.errs, err) + if err != nil { + b.errs = append(b.errs, err) + } } // So that the Error interface type can be included as an anonymous field
Append shouldn't push to the stack for errors
aws_aws-sdk-go
train
go
15c982985575ec61252d0f94f4b8caad64755a65
diff --git a/bbc_tracklist.py b/bbc_tracklist.py index <HASH>..<HASH> 100755 --- a/bbc_tracklist.py +++ b/bbc_tracklist.py @@ -159,13 +159,13 @@ def get_output_filename(args): Returns a filename without an extension. """ # if filename and path provided, use these for output text file - if args.directory is not None and args.filename is not None: + if args.directory is not None and args.fileprefix is not None: path = args.directory - filename = args.filename + filename = args.fileprefix output = os.path.join(path, filename) # otherwise set output to current path - elif args.filename is not None: - output = args.filename + elif args.fileprefix is not None: + output = args.fileprefix else: output = args.pid return output
Change 'filename' to 'fileprefix' to be clearer about what is required; updated main script accordingly.
StevenMaude_bbc-radio-tracklisting-downloader
train
py
359dd29e69d7efdc08bedfff887c5af72542093e
diff --git a/lib/generators/my_zipcode_gem/templates/zipcode_model.rb b/lib/generators/my_zipcode_gem/templates/zipcode_model.rb index <HASH>..<HASH> 100644 --- a/lib/generators/my_zipcode_gem/templates/zipcode_model.rb +++ b/lib/generators/my_zipcode_gem/templates/zipcode_model.rb @@ -13,6 +13,7 @@ class Zipcode < ActiveRecord::Base def find_by_city_state(city, state) includes(county: :state) .where("city like ? AND states.abbr like ?", "#{city}%", "%#{state}%") + .references(:state) .first end end
fix(zipcode): Fix zipcode in Rails 4+ Close #<I>
midwire_my_zipcode_gem
train
rb
d5c05842d6ca79b024bd1291e3952b9606be1bba
diff --git a/shamir/shamir.go b/shamir/shamir.go index <HASH>..<HASH> 100644 --- a/shamir/shamir.go +++ b/shamir/shamir.go @@ -29,13 +29,11 @@ func makePolynomial(intercept, degree uint8) (polynomial, error) { // Ensure the intercept is set p.coefficients[0] = intercept - // Assign random co-efficients to the polynomial, ensuring - // the highest order co-efficient is non-zero - for p.coefficients[degree] == 0 { - if _, err := rand.Read(p.coefficients[1:]); err != nil { - return p, err - } + // Assign random co-efficients to the polynomial + if _, err := rand.Read(p.coefficients[1:]); err != nil { + return p, err } + return p, nil }
Don't exclude 0 from the set of valid polynomials in Shamir. This leads to a potential (although extremely trivial) amount of information leakage.
hashicorp_vault
train
go
3c9aed910208d3d7e2589216f9bd52054d8750f2
diff --git a/discord/http.py b/discord/http.py index <HASH>..<HASH> 100644 --- a/discord/http.py +++ b/discord/http.py @@ -409,7 +409,7 @@ class HTTPClient: return self.request(route, form=form, files=files) - def send_file( + def send_files( self, channel_id, *,
Fix AttributeError on HTTPClient.send_file to be send_files
Rapptz_discord.py
train
py
72055a0783d0df302d590b23e3b4d79b9416cf82
diff --git a/structr-ui/src/test/java/org/structr/web/frontend/selenium/ParallelLoginTest.java b/structr-ui/src/test/java/org/structr/web/frontend/selenium/ParallelLoginTest.java index <HASH>..<HASH> 100644 --- a/structr-ui/src/test/java/org/structr/web/frontend/selenium/ParallelLoginTest.java +++ b/structr-ui/src/test/java/org/structr/web/frontend/selenium/ParallelLoginTest.java @@ -77,8 +77,8 @@ public class ParallelLoginTest extends SeleniumTest { WebDriver driver = new ChromeDriver(chromeOptions); try { - // Wait 60 s for successful login - loginAsAdmin(menuEntry, driver, 60); + // Wait 10 min for successful login + loginAsAdmin(menuEntry, driver, 600); } catch (Exception ex) { logger.error("Error in nested test in thread " + Thread.currentThread().toString(), ex); return ex;
Increased timeout to wait for successful login to rule out the possibility of a resource bottleneck in parallel test.
structr_structr
train
java
d7e9afc801a8160b50d5642685c663ddd47e7822
diff --git a/commands/command.go b/commands/command.go index <HASH>..<HASH> 100644 --- a/commands/command.go +++ b/commands/command.go @@ -21,6 +21,7 @@ func (c *Command) Register(id string, sub *Command) error { // check for duplicate option names (only checks downwards) names := make(map[string]bool) + globalCommand.checkOptions(names) c.checkOptions(names) err := sub.checkOptions(names) if err != nil { @@ -39,6 +40,7 @@ func (c *Command) Register(id string, sub *Command) error { func (c *Command) Call(path []string, req *Request) (interface{}, error) { options := make([]Option, len(c.Options)) copy(options, c.Options) + options = append(options, globalOptions...) cmd := c if path != nil {
commands: Use global options when registering and calling commands
ipfs_go-ipfs
train
go
1caddc7d414c1d7aa97ccfd4b0743532f0a4d291
diff --git a/classes/PodsAPI.php b/classes/PodsAPI.php index <HASH>..<HASH> 100644 --- a/classes/PodsAPI.php +++ b/classes/PodsAPI.php @@ -3412,7 +3412,7 @@ class PodsAPI { foreach ( $values as $v ) { if ( !empty( $v ) ) { if ( !is_array( $v ) ) { - if ( !preg_match( '/[^0-9]*/', $v ) ) { + if ( !preg_match( '/[^0-9]/', $v ) ) { $v = (int) $v; } // File handling
Quick hotfix for search data lookup
pods-framework_pods
train
php
c290bc117e069bf6f018091823fadb69bec01b43
diff --git a/gocron.go b/gocron.go index <HASH>..<HASH> 100644 --- a/gocron.go +++ b/gocron.go @@ -320,7 +320,7 @@ func (s *Scheduler) Swap(i, j int) { } func (s *Scheduler) Less(i, j int) bool { - return s.jobs[j].nextRun.After(s.jobs[i].nextRun) + return s.jobs[j].nextRun.Second() >= s.jobs[i].nextRun.Second() } // NewScheduler creates a new scheduler @@ -335,9 +335,7 @@ func (s *Scheduler) getRunnableJobs() (running_jobs [MAXJOBNUM]*Job, n int) { sort.Sort(s) for i := 0; i < s.size; i++ { if s.jobs[i].shouldRun() { - runnableJobs[n] = s.jobs[i] - //fmt.Println(runnableJobs) n++ } else { break
This alone fixes #<I>. Now we compare only seconds instead of relying on the default time comparison method, which compares up to nanoseconds
jasonlvhit_gocron
train
go
47cd3ee999b830cfa3993b8a4f450ccef4c16821
diff --git a/mapping/mapping_test.go b/mapping/mapping_test.go index <HASH>..<HASH> 100644 --- a/mapping/mapping_test.go +++ b/mapping/mapping_test.go @@ -1192,6 +1192,7 @@ func TestMappingArrayOfStringGeoPoints(t *testing.T) { "points": []string { "1.0, 2.0", "3.0, 4.0", + "5.0, 6.0", }, } @@ -1205,6 +1206,7 @@ func TestMappingArrayOfStringGeoPoints(t *testing.T) { expectPoints := map[string][]float64{ "first": {2.0, 1.0}, "second": {4.0, 3.0}, + "third": {6.0, 5.0}, } for _, f := range doc.Fields { @@ -1237,4 +1239,4 @@ func TestMappingArrayOfStringGeoPoints(t *testing.T) { t.Errorf("some points not found: %v", expectPoints) } -} \ No newline at end of file +}
add third point to test removes any possible confusion around slice len 2 checks in the geo parsing code
blevesearch_bleve
train
go
439317e8da2dd3f19d596fbdf7a3509e5d66182c
diff --git a/src/main/java/org/jboss/wsf/spi/deployment/Deployment.java b/src/main/java/org/jboss/wsf/spi/deployment/Deployment.java index <HASH>..<HASH> 100644 --- a/src/main/java/org/jboss/wsf/spi/deployment/Deployment.java +++ b/src/main/java/org/jboss/wsf/spi/deployment/Deployment.java @@ -41,18 +41,6 @@ public interface Deployment extends Extensible ClassLoader getClassLoader(); /** - * Get the deployment type - * @return deployment type - */ - DeploymentType getType(); - - /** - * Set the deployment type - * @param type deployment type - */ - void setType(DeploymentType type); - - /** * Get the service associated with this deployment * @return service for the deployment */
[JBWS-<I>] removed unintended methods
jbossws_jbossws-spi
train
java
22ae381f188167d45157b574993bdaaf80778658
diff --git a/dronekit/__init__.py b/dronekit/__init__.py index <HASH>..<HASH> 100644 --- a/dronekit/__init__.py +++ b/dronekit/__init__.py @@ -3009,7 +3009,7 @@ class CommandSequence(object): self._vehicle._wploader.add(cmd, comment='Added by DroneKit') self._vehicle._wpts_dirty = True - def upload(self): + def upload(self, timeout=None): """ Call ``upload()`` after :py:func:`adding <CommandSequence.add>` or :py:func:`clearing <CommandSequence.clear>` mission commands. @@ -3018,10 +3018,13 @@ class CommandSequence(object): """ if self._vehicle._wpts_dirty: self._vehicle._master.waypoint_clear_all_send() + start_time = time.time() if self._vehicle._wploader.count() > 0: self._vehicle._wp_uploaded = [False] * self._vehicle._wploader.count() self._vehicle._master.waypoint_count_send(self._vehicle._wploader.count()) while False in self._vehicle._wp_uploaded: + if timeout and time.time() - start_time > timeout: + raise TimeoutError time.sleep(0.1) self._vehicle._wp_uploaded = None self._vehicle._wpts_dirty = False
Set a timeout for uploading missions
dronekit_dronekit-python
train
py
e917b48f332f636029cedaec6fdc01b371482150
diff --git a/bin/index.js b/bin/index.js index <HASH>..<HASH> 100644 --- a/bin/index.js +++ b/bin/index.js @@ -8,7 +8,7 @@ function printErrors(errorObj) { for(let m of errorObj.message) { content += m; } - console.log(content); + console.error(content); fs.writeFileSync(cli.errorLogFile, content); } @@ -68,7 +68,8 @@ const html = ltd.toHtml( if(typeof html !== "string") { printErrors(html); - return; + return 1; } -fs.writeFileSync(cli.documentFile, html); \ No newline at end of file +fs.writeFileSync(cli.documentFile, html); +return 0; \ No newline at end of file
- correct exit status and error logging for cli
VolumeGraphics_license-info-printer
train
js
f37e433546ba0ec892d34ba4287645488505a1d2
diff --git a/openquake/commonlib/rlzs_assoc.py b/openquake/commonlib/rlzs_assoc.py index <HASH>..<HASH> 100644 --- a/openquake/commonlib/rlzs_assoc.py +++ b/openquake/commonlib/rlzs_assoc.py @@ -115,9 +115,9 @@ class RlzsAssoc(object): else: # dictionary for the selected source model for rlz in self.rlzs_by_smodel[sm_id]: gsim_by_trt = self.gsim_by_trt[rlz.ordinal] - try: # if there is a single TRT + if trt == '*': # for scenario with 1 gsim [gsim] = gsim_by_trt.values() - except ValueError: # there is more than 1 TRT + else: gsim = gsim_by_trt[trt] acc[gsim].append(rlz.ordinal) # EventBasedTestCase::test_case_10 is a case with num_rlzs=[25, 36, 39]
Retried simplifying get_rlzs_by_gsim
gem_oq-engine
train
py
facbba915ed8f56310b8ee0375f7647877ab32e0
diff --git a/src/ox_modules/module-web/commands/makeVisible.js b/src/ox_modules/module-web/commands/makeVisible.js index <HASH>..<HASH> 100644 --- a/src/ox_modules/module-web/commands/makeVisible.js +++ b/src/ox_modules/module-web/commands/makeVisible.js @@ -50,10 +50,10 @@ module.exports = async function (locator) { if (opacity === '0') { curElm.style.cssText += ';opacity:1 !important;'; } - if (height === '0') { + if (height === '0' || height === '0px') { curElm.style.cssText += ';height:1px !important;'; } - if (width === '0') { + if (width === '0' || width === '0px') { curElm.style.cssText += ';width:1px !important;'; } curElm = curElm.parentElement;
Fix setting width and height in web.makeVIsible
oxygenhq_oxygen
train
js
025af1393d3e0bb2c9af0e94576e990cd2c3de86
diff --git a/src/templates/valuelists/form.php b/src/templates/valuelists/form.php index <HASH>..<HASH> 100644 --- a/src/templates/valuelists/form.php +++ b/src/templates/valuelists/form.php @@ -20,8 +20,8 @@ <? if (isset($valuelist)) : ?> <? foreach ($valuelist->pairs as $key => $value) : ?> <li class="form-element parameters"> - <input type="text" required="required" name="keys[]" placeholder="Key" value="<?= $key ?>"/>&nbsp; - <input type="text" required="required" name="values[]" placeholder="Value" value="<?= $value ?>"/> + <input type="text" required="required" name="keys[]" placeholder="Key" value="<?= htmlentities($key) ?>"/>&nbsp; + <input type="text" required="required" name="values[]" placeholder="Value" value="<?= htmlentities($value) ?>"/> <a class="btn error" id="sitemap_remove_parameter"><i class="fa fa-trash"></i></a> </li> <? endforeach ?>
Added escaping for valulist entries
jenskooij_cloudcontrol
train
php
b7267fc7abde043f8976023b18aafe1a0f36761f
diff --git a/slumber/__init__.py b/slumber/__init__.py index <HASH>..<HASH> 100644 --- a/slumber/__init__.py +++ b/slumber/__init__.py @@ -109,10 +109,12 @@ class Resource(ResourceAttributesMixin, object): resp = self._request("GET", params=kwargs) if 200 <= resp.status_code <= 299: - if resp.status_code == 200: - return s.loads(resp.content) - else: + try: + stype = s.get_serializer(content_type=resp.headers.get("content-type")) + except exceptions.SerializerNotAvailable: return resp.content + + return stype.loads(resp.content) else: return # @@@ We should probably do some sort of error here? (Is this even possible?)
Don't assume on the format of the serialized, use content_type
samgiles_slumber
train
py
10e34c44d778618c8b654562b6c62eeaa69dcae8
diff --git a/lems/model/model.py b/lems/model/model.py index <HASH>..<HASH> 100644 --- a/lems/model/model.py +++ b/lems/model/model.py @@ -247,7 +247,8 @@ class Model(LEMSBase): else: if self.debug: print("Already included: %s"%path) return - raise Exception('Unable to open ' + path) + if self.debug: print('Unable to open' + path) + #raise Exception('Unable to open ' + path) def import_from_file(self, filepath): """
Turn Exception into debug message to give user option to ignore irrelevant includes
LEMS_pylems
train
py
463a0e8c585579c764705df9744e62ade414e79b
diff --git a/lib/hash/tree_hash.rb b/lib/hash/tree_hash.rb index <HASH>..<HASH> 100644 --- a/lib/hash/tree_hash.rb +++ b/lib/hash/tree_hash.rb @@ -157,7 +157,9 @@ class TreeHash def move(paths) paths.each do |from, to| - value = find(from).first + values = find(from) + next if values.empty? + value = values.first bridge(to => value) value.kill if value end
Modified move to only create the to path if the from actually existed.
bblack16_bblib-ruby
train
rb
6353fd0b9ec04b9303dc3980a28a49788b8be54c
diff --git a/QuickPay/api/Request.php b/QuickPay/api/Request.php index <HASH>..<HASH> 100644 --- a/QuickPay/api/Request.php +++ b/QuickPay/api/Request.php @@ -157,7 +157,7 @@ class Request // If additional data is delivered, we will send it along with the API request if( is_array( $form ) && ! empty( $form ) ) { - curl_setopt( $this->client->ch, CURLOPT_POSTFIELDS, $form ); + curl_setopt( $this->client->ch, CURLOPT_POSTFIELDS, http_build_query($form) ); } // Execute the request
Support for parameters of type object - eg POST /payments with variables. Example: $form = [ 'currency' => 'DKK', 'order_id' => '<I>-1', 'variables' => [ 'foo' => 'bar', 'more' => 'less' ] ]; $response = $client->request->post('/payments', $form);
QuickPay_quickpay-php-client
train
php
d8f8fe29a1ae44db2df577b0de708627711d5123
diff --git a/CodeIgniter4/Sniffs/Files/FilenameMatchesClassSniff.php b/CodeIgniter4/Sniffs/Files/FilenameMatchesClassSniff.php index <HASH>..<HASH> 100644 --- a/CodeIgniter4/Sniffs/Files/FilenameMatchesClassSniff.php +++ b/CodeIgniter4/Sniffs/Files/FilenameMatchesClassSniff.php @@ -69,12 +69,11 @@ class FilenameMatchesClassSniff implements Sniff return; } - $className = trim($phpcsFile->getDeclarationName($stackPtr)); - + $className = trim($phpcsFile->getDeclarationName($stackPtr)); $nextContentPtr = $phpcsFile->findNext(T_WHITESPACE, ($stackPtr + 1), null, true); + $type = $tokens[$stackPtr]['content']; if ($fileName !== $className.'.php' && $this->badFilename === false) { - $type = $tokens[$stackPtr]['content']; $data = array( $fileName, $className.'.php',
Fixed issue with unreachable $type variable.
codeigniter4_coding-standard
train
php
ce01adf6c929c60ace5d4df04adc0ec6d64fb01f
diff --git a/lib/cool.io/listener.rb b/lib/cool.io/listener.rb index <HASH>..<HASH> 100644 --- a/lib/cool.io/listener.rb +++ b/lib/cool.io/listener.rb @@ -59,6 +59,9 @@ module Coolio else def on_readable begin + # In Windows, accept_nonblock() with multiple processes + # causes thundering herd problem. + # To avoid this, we need to use accept(). on_connection @listen_socket.accept rescue Errno::EAGAIN, Errno::ECONNABORTED end
Add comment for why to use accept in Windows
tarcieri_cool.io
train
rb
ffb641e0d5b4f661014706833c9b0211f115513c
diff --git a/lib/sup/crypto.rb b/lib/sup/crypto.rb index <HASH>..<HASH> 100644 --- a/lib/sup/crypto.rb +++ b/lib/sup/crypto.rb @@ -108,6 +108,9 @@ EOS else Chunk::CryptoNotice.new :invalid, $1, output_lines end + elsif output_lines.length == 0 && rc == 0 + # the message wasn't signed + Chunk::CryptoNotice.new :valid, "Encrypted message wasn't signed", output_lines else unknown_status output_lines end
Stop worrying notice when no signature present When no signature is present, there was a message saying "Unable to determine validity of cryptographic signature". This fix means that if there are no error messages and no messages about signature verification then the message is assumed to not be signed at all. This fix also saves the encrypted messages to a temp file with a suffix of .asc to stop gpg complaining about "unknown suffix".
sup-heliotrope_sup
train
rb
467e017cdb447ba0485aa063d845b9e9a86971ff
diff --git a/salt/cloud/clouds/azurearm.py b/salt/cloud/clouds/azurearm.py index <HASH>..<HASH> 100644 --- a/salt/cloud/clouds/azurearm.py +++ b/salt/cloud/clouds/azurearm.py @@ -68,7 +68,6 @@ import salt.utils.data import salt.utils.files import salt.utils.stringutils import salt.utils.yaml -from salt.utils.versions import LooseVersion from salt.ext import six import salt.version from salt.exceptions import (
remove unused import from azurearm driver
saltstack_salt
train
py
c426517ac07047336167dbedfb9f0bb252a1dce7
diff --git a/cmd/kubeadm/app/features/features.go b/cmd/kubeadm/app/features/features.go index <HASH>..<HASH> 100644 --- a/cmd/kubeadm/app/features/features.go +++ b/cmd/kubeadm/app/features/features.go @@ -32,12 +32,15 @@ const ( IPv6DualStack = "IPv6DualStack" // PublicKeysECDSA is expected to be alpha in v1.19 PublicKeysECDSA = "PublicKeysECDSA" + // RootlessControlPlane is expected to be in alpha in v1.22 + RootlessControlPlane = "RootlessControlPlane" ) // InitFeatureGates are the default feature gates for the init command var InitFeatureGates = FeatureList{ - IPv6DualStack: {FeatureSpec: featuregate.FeatureSpec{Default: true, PreRelease: featuregate.Beta}}, - PublicKeysECDSA: {FeatureSpec: featuregate.FeatureSpec{Default: false, PreRelease: featuregate.Alpha}}, + IPv6DualStack: {FeatureSpec: featuregate.FeatureSpec{Default: true, PreRelease: featuregate.Beta}}, + PublicKeysECDSA: {FeatureSpec: featuregate.FeatureSpec{Default: false, PreRelease: featuregate.Alpha}}, + RootlessControlPlane: {FeatureSpec: featuregate.FeatureSpec{Default: false, PreRelease: featuregate.Alpha}}, } // Feature represents a feature being gated
Add a feature-gate to kubeadm to enable/disable Rootless control-plane.
kubernetes_kubernetes
train
go
8580bd151e6e9eb1592827ea0cc1ca3ba1d16068
diff --git a/honeybadger.go b/honeybadger.go index <HASH>..<HASH> 100644 --- a/honeybadger.go +++ b/honeybadger.go @@ -163,7 +163,7 @@ func NewReportWithSkipCallers(msg interface{}, skipCallers int) (r *Report, err r = &Report{ Notifier: &Notifier{ Name: "Honeybadger (Go)", - Url: "https://github.com/jcoene/honeybadger-go", + Url: "https://github.com/librato/honeybadger-go", Version: "1.0", Language: "Go", },
Change notifier Url to point to Librato's fork
jcoene_honeybadger
train
go
9a197aec4bfa23b5ca6f8617d477bc8dba502a69
diff --git a/buckets.go b/buckets.go index <HASH>..<HASH> 100644 --- a/buckets.go +++ b/buckets.go @@ -8,7 +8,7 @@ import ( "github.com/boltdb/bolt" ) -// A buckets DB is a set of buckets. +// A DB is a bolt database with convenience methods for working with buckets. // // A DB embeds the exposed bolt.DB methods. type DB struct { diff --git a/rangescan.go b/rangescan.go index <HASH>..<HASH> 100644 --- a/rangescan.go +++ b/rangescan.go @@ -36,7 +36,6 @@ func (rs *RangeScanner) Count() (count int, err error) { return count, err } -// Values returns a slice of values for keys within the range. // Keys returns a slice of keys within the range. func (rs *RangeScanner) Keys() (keys [][]byte, err error) { err = rs.db.View(func(tx *bolt.Tx) error {
Edit code comments to make linter happy
joyrexus_buckets
train
go,go
91ee35d1dd0cfe4b8a2444fd31d21e527f8030ee
diff --git a/src/Writer.php b/src/Writer.php index <HASH>..<HASH> 100644 --- a/src/Writer.php +++ b/src/Writer.php @@ -158,6 +158,7 @@ class Writer $writer->setDelimiter($this->delimiter); $writer->setEnclosure($this->enclosure); $writer->setLineEnding($this->lineEnding); + $writer->setUseBOM($this->useBom); $writer->setIncludeSeparatorLine($this->includeSeparatorLine); $writer->setExcelCompatibility($this->excelCompatibility); }
Fix csv.use_bom option doesn't take effect (#<I>)
Maatwebsite_Laravel-Excel
train
php
9cb3644f1888771795b29bf1fb76bea2f80d763a
diff --git a/lime/tests/test_scikit_image.py b/lime/tests/test_scikit_image.py index <HASH>..<HASH> 100755 --- a/lime/tests/test_scikit_image.py +++ b/lime/tests/test_scikit_image.py @@ -2,7 +2,7 @@ import unittest from lime.wrappers.scikit_image import BaseWrapper from lime.wrappers.scikit_image import SegmentationAlgorithm from skimage.segmentation import quickshift -from skimage.data import astronaut +from skimage.data import chelsea from skimage.util import img_as_float import numpy as np @@ -105,7 +105,7 @@ class TestBaseWrapper(unittest.TestCase): class TestSegmentationAlgorithm(unittest.TestCase): def test_instanciate_segmentation_algorithm(self): - img = img_as_float(astronaut()[::2, ::2]) + img = img_as_float(chelsea()[::2, ::2]) # wrapped functions provide the same result fn = SegmentationAlgorithm('quickshift', kernel_size=3, max_dist=6,
changing image in test, trying to fix travis
marcotcr_lime
train
py
dd9c0762b2683d438ab16a98d6839211babfed50
diff --git a/lib/checkSystem.js b/lib/checkSystem.js index <HASH>..<HASH> 100644 --- a/lib/checkSystem.js +++ b/lib/checkSystem.js @@ -6,9 +6,11 @@ let check = function(pathToPackage) { const exec = require('child_process').exec; const Promise = require('bluebird'); const _ = require('lodash'); + const fs = require('fs'); + const jsonfile = require('jsonfile'); const validaterRules = require('./validatorRules'); const promiseHelpers = require('./promiseHelpers'); - const fs = require('fs'); + let engines; const checkerResult = { @@ -20,7 +22,7 @@ let check = function(pathToPackage) { const packageJsonPath = pathToPackage || path.join(process.cwd(), 'package.json'); try { fs.accessSync(packageJsonPath); - engines = require(packageJsonPath).engines; + engines = jsonfile.readFileSync(pathToPackage).engines; } catch (ex) { checkerResult.message = {
started using jsonfile (fs) to get the package instead
mohlsen_check-engine
train
js
b5e042d9d1392aec523b82585526e16ab4800fff
diff --git a/python-package/lightgbm/libpath.py b/python-package/lightgbm/libpath.py index <HASH>..<HASH> 100644 --- a/python-package/lightgbm/libpath.py +++ b/python-package/lightgbm/libpath.py @@ -21,9 +21,8 @@ def find_lib_path(): os.path.join(curr_path, './lib/'), os.path.join(sys.prefix, 'lightgbm')] if os.name == 'nt': - dll_path.append(os.path.join(curr_path, '../../windows/x64/Dll/')) - dll_path.append(os.path.join(curr_path, './windows/x64/Dll/')) dll_path.append(os.path.join(curr_path, '../../Release/')) + dll_path.append(os.path.join(curr_path, '../../windows/x64/DLL/')) dll_path = [os.path.join(p, 'lib_lightgbm.dll') for p in dll_path] else: dll_path = [os.path.join(p, 'lib_lightgbm.so') for p in dll_path]
change the dll search order in windows (cmake-build first)
Microsoft_LightGBM
train
py
a43553f3ab96237275096bc295cb113ef46c3dbc
diff --git a/go/engine/pgp_pull.go b/go/engine/pgp_pull.go index <HASH>..<HASH> 100644 --- a/go/engine/pgp_pull.go +++ b/go/engine/pgp_pull.go @@ -5,9 +5,10 @@ package engine import ( "fmt" + "time" + "github.com/keybase/client/go/libkb" keybase1 "github.com/keybase/client/go/protocol/keybase1" - "time" ) type PGPPullEngineArg struct { @@ -257,7 +258,8 @@ func (e *PGPPullEngine) exportKeysToGPG(m libkb.MetaContext, user *libkb.User, t } if err := e.gpgClient.ExportKey(*bundle, false /* export public key only */, false /* no batch */); err != nil { - return err + m.Warning("Failed to import %'s public key %s: %s", user.GetName(), bundle.GetFingerprint(), err.Error()) + continue } m.Info("Imported key for %s.", user.GetName())
reduce severity of gpg2 import fails during keybase pgp pull (#<I>)
keybase_client
train
go
277f0f7f5e35ddb18aee7d939b59cd504e6db280
diff --git a/src/misc/Animation.js b/src/misc/Animation.js index <HASH>..<HASH> 100644 --- a/src/misc/Animation.js +++ b/src/misc/Animation.js @@ -191,24 +191,15 @@ Z.Util.extend(Z.animation.Player.prototype, { this.duration = duration; }, cancel:function() { - if (this._animeFrameId) { - Z.Util.cancelAnimFrame(this._animeFrameId); - } this.playState = "idle"; this.finished = false; }, finish:function() { - if (this._animeFrameId) { - Z.Util.cancelAnimFrame(this._animeFrameId); - } this.playState = "finished"; this.finished = true; }, pause:function() { - if (this._animeFrameId) { - Z.Util.cancelAnimFrame(this._animeFrameId); - } this.playState = "paused"; this.duration = this.duration - this.currentTime; },
remove cancelAnimation in Animation.js
maptalks_maptalks.js
train
js
b60348b2532ebef54815956fa243068bc72e7348
diff --git a/transport/ws/src/main/java/org/kaazing/gateway/transport/ws/bridge/filter/WsFrameDecoder.java b/transport/ws/src/main/java/org/kaazing/gateway/transport/ws/bridge/filter/WsFrameDecoder.java index <HASH>..<HASH> 100644 --- a/transport/ws/src/main/java/org/kaazing/gateway/transport/ws/bridge/filter/WsFrameDecoder.java +++ b/transport/ws/src/main/java/org/kaazing/gateway/transport/ws/bridge/filter/WsFrameDecoder.java @@ -324,10 +324,8 @@ public class WsFrameDecoder extends CumulativeProtocolDecoderEx { * Checks if masking is allowed/expected for the frame being decoded. */ private void validateMaskingAllowed(boolean masked) throws ProtocolDecoderException { - if (masked && !maskingExpected) { - throw new ProtocolDecoderException("Received masked frame from server."); - } else if (!masked && maskingExpected) { - throw new ProtocolDecoderException("Received unmasked frame from client."); + if (masked != maskingExpected) { + throw new ProtocolDecoderException(String.format("Received unexpected %s frame", masked ? "masked" : "unmasked")); } }
update masking validation check according to feedback
kaazing_gateway
train
java
950cb6a490aeeaf03243fe50de8979a79c1e4091
diff --git a/src/index.js b/src/index.js index <HASH>..<HASH> 100644 --- a/src/index.js +++ b/src/index.js @@ -269,7 +269,7 @@ const VirtualList = Vue.component('virtual-list', { if (dataSource) { if (Object.prototype.hasOwnProperty.call(dataSource, dataKey)) { slots.push(h(Item, { - key: dataSource[dataKey], + // key: dataSource[dataKey], props: { index, tag: itemTag,
Fix nextTick tigger before really render
tangbc_vue-virtual-scroll-list
train
js
9a5f054ebb3ad84e570042727ff8343a6cdae4aa
diff --git a/src/main/java/net/bootsfaces/component/progressBar/ProgressBarRenderer.java b/src/main/java/net/bootsfaces/component/progressBar/ProgressBarRenderer.java index <HASH>..<HASH> 100644 --- a/src/main/java/net/bootsfaces/component/progressBar/ProgressBarRenderer.java +++ b/src/main/java/net/bootsfaces/component/progressBar/ProgressBarRenderer.java @@ -68,7 +68,8 @@ public class ProgressBarRenderer extends CoreRenderer { double progressCompletion = (value - min) / (max - min) * 100; String style = "width: " + progressCompletion + "%;"; - style += progressBar.getStyle(); + //append inline style, if set + style += progressBar.getStyle() != null ? progressBar.getStyle() : ""; rw.writeAttribute("style", style, null); @@ -105,7 +106,8 @@ public class ProgressBarRenderer extends CoreRenderer { if (progressBar.isStriped() || progressBar.isAnimated()) classes += " progress-bar-striped"; - classes += " " + progressBar.getStyleClass(); + //append style class, if set + classes += progressBar.getStyleClass() != null ? " " + progressBar.getStyleClass() : ""; rw.writeAttribute("class", classes, "class"); }
dont append 'null' if no style was provided
TheCoder4eu_BootsFaces-OSP
train
java
6d8dedb6ee30583f805c0ed2342445d0bf36b544
diff --git a/src/Valkyrja/Http/Factories/ResponseFactory.php b/src/Valkyrja/Http/Factories/ResponseFactory.php index <HASH>..<HASH> 100644 --- a/src/Valkyrja/Http/Factories/ResponseFactory.php +++ b/src/Valkyrja/Http/Factories/ResponseFactory.php @@ -201,7 +201,7 @@ class ResponseFactory implements ResponseFactoryContract */ public function view(string $template, array $data = null, int $statusCode = null, array $headers = null): Response { - $content = $this->app->view()->make($template, $data)->render(); + $content = $this->app->view()->make($template, $data ?? [])->render(); return $this->createResponse($content, $statusCode, $headers); }
Fixing ResponseFactory::view.
valkyrjaio_valkyrja
train
php
1c1abfcf656697444624e9b2c893c6b07c5ee067
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -220,6 +220,7 @@ sources_phono3py = ['c/_phono3py.c', 'c/real_self_energy.c', 'c/real_to_reciprocal.c', 'c/reciprocal_to_normal.c', + 'c/rgrid.c', 'c/tetrahedron_method.c', 'c/triplet.c', 'c/triplet_iw.c',
Include forgotten file of rgrid.c in setup.py
atztogo_phono3py
train
py
f25ed630f1f8a7cfd3c5bb6b12c82d978c848aa6
diff --git a/src/ChrisKonnertz/DeepLy/DeepLy.php b/src/ChrisKonnertz/DeepLy/DeepLy.php index <HASH>..<HASH> 100644 --- a/src/ChrisKonnertz/DeepLy/DeepLy.php +++ b/src/ChrisKonnertz/DeepLy/DeepLy.php @@ -54,7 +54,7 @@ class DeepLy /** * Current version number */ - const VERSION = '1.0.0'; + const VERSION = '1.1.0'; /** * The protocol used for communication
--- VERSION <I> ---
chriskonnertz_DeepLy
train
php
5b9eb937fffea55f5fc1416560c1208c4a10cb50
diff --git a/wakatime/projects/base.py b/wakatime/projects/base.py index <HASH>..<HASH> 100644 --- a/wakatime/projects/base.py +++ b/wakatime/projects/base.py @@ -22,9 +22,9 @@ class BaseProject(object): be found for the current path. """ - def __init__(self, path, config): + def __init__(self, path, settings): self.path = path - self.config = config + self.settings = settings def type(self): """ Returns None if this is the base class. diff --git a/wakatime/projects/projectmap.py b/wakatime/projects/projectmap.py index <HASH>..<HASH> 100644 --- a/wakatime/projects/projectmap.py +++ b/wakatime/projects/projectmap.py @@ -23,7 +23,7 @@ log = logging.getLogger(__name__) class ProjectMap(BaseProject): def process(self): - if self.config: + if self.settings: return True return False @@ -33,8 +33,8 @@ class ProjectMap(BaseProject): def name(self): for path in self._path_generator(): - if self.config.has_option('projectmap', path): - return self.config.get('projectmap', path) + if self.settings.has_option('projectmap', path): + return self.settings.get('projectmap', path) return None
Rename config to settings in BaseProject
wakatime_wakatime
train
py,py
e1ab432c40ab0114a9acb26ef4d9aaba92619580
diff --git a/tests/models/test_seq2seq_model.py b/tests/models/test_seq2seq_model.py index <HASH>..<HASH> 100644 --- a/tests/models/test_seq2seq_model.py +++ b/tests/models/test_seq2seq_model.py @@ -90,7 +90,7 @@ class Model_SEQ2SEQ_Test(CustomTestCase): top_n = 1 for i in range(top_n): prediction = model_([test_sample], seq_length = self.dec_seq_length, start_token = 0, top_n = top_n) - print("Prediction: >>>>> ", prediction[0], "\n Target: >>>>> ", trainY[0,1:], "\n\n") + print("Prediction: >>>>> ", prediction[0].numpy(), "\n Target: >>>>> ", trainY[0,1:], "\n\n") # printing average loss after every epoch print('Epoch [{}/{}]: loss {:.4f}'.format(epoch + 1, self.num_epochs, total_loss / n_iter))
Print list instead of tensor
tensorlayer_tensorlayer
train
py
04182623f6075b5133e020adffae077dd8c24191
diff --git a/bin/grails-plugin-package.js b/bin/grails-plugin-package.js index <HASH>..<HASH> 100755 --- a/bin/grails-plugin-package.js +++ b/bin/grails-plugin-package.js @@ -133,7 +133,13 @@ archive.append( //adding standalone files for (var standaloneId in project.grails.standaloneFiles) { var stanalone = project.grails.standaloneFiles[standaloneId]; - archive.append(fs.readFileSync(path.join(buildDir, standaloneId)).toString(), {name: stanalone}); + + if (fs.lstatSync(path.join(buildDir, standaloneId)).isDirectory()) { + // append files from a directory if it's directory + archive.directory(path.join(buildDir, standaloneId)); + } else { + archive.append(fs.readFileSync(path.join(buildDir, standaloneId)).toString(), {name: stanalone}); + } } archive.finalize();
Added supporting direcroties as standaloneFiles.
OpusCapita_npm-scripts
train
js
70e7f6d58baaa35d1cabb943eaf55ab4e46e8ce1
diff --git a/salt/fileclient.py b/salt/fileclient.py index <HASH>..<HASH> 100644 --- a/salt/fileclient.py +++ b/salt/fileclient.py @@ -803,12 +803,17 @@ class Client(object): elif not os.path.isabs(cachedir): cachedir = os.path.join(self.opts['cachedir'], cachedir) + if url_data.query is not None: + file_name = '-'.join([url_data.path, url_data.query]) + else: + file_name = url_data.path + return salt.utils.path_join( cachedir, 'extrn_files', saltenv, netloc, - url_data.path + file_name )
cache query args with url as well Without this, we can't use query args to get the hash of a file or add query args to change what a file returns
saltstack_salt
train
py
1a88459c769f234190f3907ed696dc62be1958d1
diff --git a/bitshares/transactionbuilder.py b/bitshares/transactionbuilder.py index <HASH>..<HASH> 100644 --- a/bitshares/transactionbuilder.py +++ b/bitshares/transactionbuilder.py @@ -345,6 +345,7 @@ class TransactionBuilder(dict): signedtx.sign(self.wifs, chain=self.blockchain.rpc.chain_params) self["signatures"].extend(signedtx.json().get("signatures")) + return signedtx def verify_authority(self): """ Verify the authority of the signed transaction
Return newly created SignedTransaction when `sign` is invoked. This is useful for tearing down/rebuilding and passing transactions around.
bitshares_python-bitshares
train
py
480ccc1e2c640c29874bc6291155c7b3ad50587d
diff --git a/src/views/ui_graph.py b/src/views/ui_graph.py index <HASH>..<HASH> 100644 --- a/src/views/ui_graph.py +++ b/src/views/ui_graph.py @@ -63,5 +63,5 @@ class Ui_Graph(object): def retranslateUi(self, Graph): pass -from matplotlibwidget import MatplotlibWidget +from widgets.matplotlibwidget import MatplotlibWidget import resources_rc
problem with matplotlibwidget to fix
openfisca_openfisca-core
train
py
1de558c5d47e956ceed13c494d42a5bb125583a9
diff --git a/js/render/console.js b/js/render/console.js index <HASH>..<HASH> 100644 --- a/js/render/console.js +++ b/js/render/console.js @@ -506,7 +506,8 @@ jsconsole.init = function () { editors.console.settings.render = function () { // TODO decide whether we should also grab all the JS in the HTML panel // jsconsole.reset(); - jsconsole.run(editors.javascript.render()); + var code = editors.javascript.render(); + if ($.trim(code)) jsconsole.run(code); }; editors.console.settings.show = function () { if (editors.live.visible) {
Only run console if we have some code in the js panel
jsbin_jsbin
train
js
0cdb91928eebf3a653ca6c1cda4dba9707d36eb1
diff --git a/includes/general.php b/includes/general.php index <HASH>..<HASH> 100644 --- a/includes/general.php +++ b/includes/general.php @@ -560,7 +560,7 @@ function pods_access ( $privs, $method = 'OR' ) { if ( 0 === strpos( $priv, 'manage_' ) ) $priv = pods_str_replace( 'manage_', 'pods_', $priv, 1 ); - if ( isset( $approved_privs[ $priv ] ) ) + if ( !isset( $approved_privs[ $priv ] ) ) return false; } @@ -2008,4 +2008,4 @@ function pods_session_start() { return true; -} \ No newline at end of file +}
pods_access used with AND always returns FALSE Fixes #<I>
pods-framework_pods
train
php
b538d58c2ed6152bd489c1911f6d3bea2152eec3
diff --git a/src/dolo/misc/calculus.py b/src/dolo/misc/calculus.py index <HASH>..<HASH> 100644 --- a/src/dolo/misc/calculus.py +++ b/src/dolo/misc/calculus.py @@ -51,7 +51,14 @@ def solve_triangular_system(sdict,return_order=False,unknown_type=sympy.Symbol): else: res = copy.copy(sdict) for s in oks: - res[s] = lambda_sub(res[s],res) + try: + res[s] = lambda_sub(res[s],res) + except Exception as e: + print('Error evaluating: '+ str(res[s])) + print('with :') + print(res) + raise(e) + return [res,oks] def simple_triangular_solve(sdict, l=0):
(Slightly) better error messages for non triangular systems.
EconForge_dolo
train
py
e79d76191f836365421b6c348f22854357536da7
diff --git a/asyncblock.js b/asyncblock.js index <HASH>..<HASH> 100644 --- a/asyncblock.js +++ b/asyncblock.js @@ -39,7 +39,9 @@ var getNextTaskId = (function(){ var taskId = 1; return function(){ - return taskId++; + ++taskId; + + return '_ab_' + taskId; }; })();
Reducing likelihood of collision with generated task ids
scriby_asyncblock-generators
train
js
34091d049455c5f3a9c015b49be89c6bc18439d1
diff --git a/lib/countries/select_helper.rb b/lib/countries/select_helper.rb index <HASH>..<HASH> 100644 --- a/lib/countries/select_helper.rb +++ b/lib/countries/select_helper.rb @@ -24,7 +24,7 @@ module ActionView def to_country_select_tag(priority_countries, options, html_options) html_options = html_options.stringify_keys add_default_name_and_id(html_options) - value = value(object) + value = options.delete(:selected) || value(object) content_tag("select", add_options( country_options_for_select(value, priority_countries),
allow overriding selected option in country_select helper.
hexorx_countries
train
rb
7ef6d9a08b8ccfc410f310e4487bf17464ed7335
diff --git a/core/src/main/java/hudson/model/AbstractItem.java b/core/src/main/java/hudson/model/AbstractItem.java index <HASH>..<HASH> 100644 --- a/core/src/main/java/hudson/model/AbstractItem.java +++ b/core/src/main/java/hudson/model/AbstractItem.java @@ -265,7 +265,7 @@ public abstract class AbstractItem extends Actionable implements Item, HttpDelet cp.setProject(new org.apache.tools.ant.Project()); cp.setTodir(newRoot); FileSet src = new FileSet(); - src.setDir(getRootDir()); + src.setDir(oldRoot); cp.addFileset(src); cp.setOverwrite(true); cp.setPreserveLastModified(true);
Wrong source root ... as pointed out by <URL>
jenkinsci_jenkins
train
java
0a7e33f6200f6a60b3426d20dbdc7c3e9295e511
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -36,7 +36,8 @@ def get_version(module='spyder_kernels'): REQUIREMENTS = ['ipykernel>=4.8.2', - 'pyzmq>=17' + 'pyzmq>=17', + 'jupyter-client>=5.2.3', 'cloudpickle']
Setup.py: Add specific requirement on jupyter-client
spyder-ide_spyder-kernels
train
py
0721ab610d92e1f02ed4fc314e8e5b8de7211fd8
diff --git a/etk/core.py b/etk/core.py index <HASH>..<HASH> 100644 --- a/etk/core.py +++ b/etk/core.py @@ -471,8 +471,7 @@ class Core(object): doc = Core.rearrange_description(doc) doc = Core.rearrange_title(doc) except Exception as e: - # print e - raise e + print e print 'Failed doc:', doc['doc_id'] return None return doc
fix bug when there is no state or country for populated places
usc-isi-i2_etk
train
py
84c083760d084a7c9bbabc1c85de11416ccb7bae
diff --git a/packages/mui-material/src/IconButton/IconButton.js b/packages/mui-material/src/IconButton/IconButton.js index <HASH>..<HASH> 100644 --- a/packages/mui-material/src/IconButton/IconButton.js +++ b/packages/mui-material/src/IconButton/IconButton.js @@ -54,7 +54,7 @@ const IconButtonRoot = styled(ButtonBase, { ...(!ownerState.disableRipple && { '&:hover': { backgroundColor: theme.vars - ? `rgba(${theme.vars.palette.action.active} / ${theme.vars.palette.action.hoverOpacity})` + ? `rgba(${theme.vars.palette.action.activeChannel} / ${theme.vars.palette.action.hoverOpacity})` : alpha(theme.palette.action.active, theme.palette.action.hoverOpacity), // Reset on touch devices, it doesn't add specificity '@media (hover: none)': {
[IconButton] Fix hover effect when CSS Variables are enabled (#<I>)
mui-org_material-ui
train
js
cc575b6352efaad7e9ed5077f28018706f8c43e2
diff --git a/src/Zicht/Util/Str.php b/src/Zicht/Util/Str.php index <HASH>..<HASH> 100644 --- a/src/Zicht/Util/Str.php +++ b/src/Zicht/Util/Str.php @@ -263,28 +263,12 @@ class Str /** * Slugify a text. * + * @deprecated Please use Str::systemize() * @param string $text * @return string */ public static function slugify($text) { - // replace non letter or digits by - - $text = preg_replace('~[^\\pL\d]+~u', '-', $text); - - // trim - $text = trim($text, '-'); - - // transliterate - if (function_exists('iconv')) { - $text = iconv('UTF-8', 'ASCII//TRANSLIT', $text); - } - - // lowercase - $text = strtolower($text); - - // remove unwanted characters - $text = preg_replace('~[^-\w]+~', '', $text); - - return $text; + return self::systemize($text); } -} \ No newline at end of file +}
deprecated slugify, which serves more as documentation than anything else
zicht_util
train
php
2d0ab9e9bf6a63b3cbd251d1e41c8139eaec5ccd
diff --git a/internal/client/github.go b/internal/client/github.go index <HASH>..<HASH> 100644 --- a/internal/client/github.go +++ b/internal/client/github.go @@ -225,7 +225,7 @@ func (c *githubClient) CreateRelease(ctx *context.Context, body string) (string, ctx, ctx.Config.Release.GitHub.Owner, ctx.Config.Release.GitHub.Name, - ctx.Git.CurrentTag, + data.GetTagName(), ) if err != nil { release, _, err = c.client.Repositories.CreateRelease(
fix: ensure same tag on edit this change is just to prevent merge conflicts in goreleaser pro refs #<I>
goreleaser_goreleaser
train
go
1e7b1ddb334122cd45198bbda4a3c162dd8dc1e4
diff --git a/Resources/public/js/sequence/Correction/Controllers/CorrectionClozeCtrl.js b/Resources/public/js/sequence/Correction/Controllers/CorrectionClozeCtrl.js index <HASH>..<HASH> 100644 --- a/Resources/public/js/sequence/Correction/Controllers/CorrectionClozeCtrl.js +++ b/Resources/public/js/sequence/Correction/Controllers/CorrectionClozeCtrl.js @@ -124,6 +124,7 @@ var holes = this.question.holes; for (var j=0; j<holes.length; j++) { + console.log(holes[j]); good_answer = false; Object.keys(answers).map(function(key){ if (holes[j].position === key) { @@ -134,7 +135,7 @@ else { value_to_compare = holes[j].wordResponses[k].response; } - if (value_to_compare === answers[key]) { + if (value_to_compare === answers[key] && holes[j].wordResponses[k].score > 0) { good_answer = true; } }
[ExoBundle] Fix error on cloze correction
claroline_Distribution
train
js
ce84460b7d573a899f567337b668001d01bd8088
diff --git a/lib/lock_jar/domain/gem_dsl.rb b/lib/lock_jar/domain/gem_dsl.rb index <HASH>..<HASH> 100644 --- a/lib/lock_jar/domain/gem_dsl.rb +++ b/lib/lock_jar/domain/gem_dsl.rb @@ -30,7 +30,7 @@ module LockJar builder.gem_dir = spec.gem_dir jarfile = File.join( spec.gem_dir, jarfile ) - builder.file_path = "gem:#{spec.name}:#{jarfile.gsub( "#{spec.base_dir}/", "" )}" + builder.file_path = "gem:#{spec.name}:#{jarfile.gsub( "#{spec.base_dir}/", "" )}.lock" evaluate(builder, jarfile) end
track Jarfile.lock in lockfile merged
mguymon_lock_jar
train
rb
4916d4df546428b7b43d728f6b3d3ca75f42632a
diff --git a/components/switch/index.js b/components/switch/index.js index <HASH>..<HASH> 100644 --- a/components/switch/index.js +++ b/components/switch/index.js @@ -59,10 +59,12 @@ export default class Switch extends Intact { _dragEnd(e) { this.set('_dragging', false); + this.element.blur(); const bar = this.refs.bar; // treat mousedown -> mouseup as click if (this._x === e.clientX) { + bar.style.width = ''; this._toggle(); } else { const percent = (bar.clientWidth - this._height / 2) / this._maxWidth; @@ -102,6 +104,7 @@ export default class Switch extends Intact { } _onKeypress(e) { + if (e.keyCode === 13) { this._toggle(e, true); }
upd: blur on mouseup, #7
ksc-fe_kpc
train
js
605d5953b63c7e62c653930ff0d9de6008827f42
diff --git a/src/js/form-builder.js b/src/js/form-builder.js index <HASH>..<HASH> 100644 --- a/src/js/form-builder.js +++ b/src/js/form-builder.js @@ -6,6 +6,7 @@ var defaults = { typeUserAttrs: {}, //+gimigliano + typeUserEvents: {}, //+gimigliano controlPosition: 'right', controlOrder: [ 'autocomplete', @@ -1072,7 +1073,10 @@ _helpers.closeAllEdit($sortableFields); _helpers.toggleEdit(lastID); } - + + //+gimigliano + if (opts.typeUserEvents[type] && opts.typeUserEvents[type]['onadd']) opts.typeUserEvents[type]['onadd']($('#'+lastID)); + lastID = _helpers.incrementId(lastID); }; @@ -1161,6 +1165,9 @@ $clone.attr('name', cloneName); $clone.addClass('cloned'); $('.sortable-options', $clone).sortable(); + //+gimigliano + if (opts.typeUserEvents[type] && opts.typeUserEvents[type]['onclone']) opts.typeUserEvents[type]['onclone']($('#'+lastID)); + lastID = _helpers.incrementId(lastID); return $clone; };
Added typeUserEvents option (#<I>)
kevinchappell_formBuilder
train
js
879e830656386a2293a6a9d319c625d8ea899789
diff --git a/bencode.js b/bencode.js index <HASH>..<HASH> 100644 --- a/bencode.js +++ b/bencode.js @@ -280,7 +280,7 @@ var Bdecode = function () { if (LIST_START === obj) { var obj2 = null var list = [] - while( obj2 = tmp_stack.pop() ) { + while( undefined !== (obj2 = tmp_stack.pop()) ) { list.push(obj2) } self.cb(list) diff --git a/test/test.js b/test/test.js index <HASH>..<HASH> 100644 --- a/test/test.js +++ b/test/test.js @@ -1,6 +1,5 @@ -var benc = require('../bencode.js'), - hexy = require('hexy') +var benc = require('../bencode.js'); function log(msg) { @@ -305,6 +304,12 @@ function file_bug() { }) } +function list_0() { + var data = 'li0ee'; + var decoded = benc.decode(data); + assert_obj("List with 0", [0], decoded); +} + docs() str_e() num_e() @@ -317,6 +322,7 @@ list_d() errors() file() file_bug() +list_0() //file_readStream("test/bloeh.torrent"); //console.log("here") file_readStream("test/chipcheezum.torrent");
properly decode lists with the integer 0
a2800276_bncode
train
js,js
a78bf30a3b3cb934b9cf96426e406c5133624c78
diff --git a/_builder_lib/docsitebuilder/helpers.rb b/_builder_lib/docsitebuilder/helpers.rb index <HASH>..<HASH> 100644 --- a/_builder_lib/docsitebuilder/helpers.rb +++ b/_builder_lib/docsitebuilder/helpers.rb @@ -209,6 +209,23 @@ EOF end end + def git_stash_all + # See if there are any changes in need of stashing + @stash_needed = `git status --porcelain` !~ /^\s*$/ + if @stash_needed + puts "\nNOTICE: Stashing uncommited changes and files in working branch." + `git stash -a` + end + end + + def git_apply_and_drop + return unless @stash_needed + puts "\nNOTICE: Re-applying uncommitted changes and files to working branch." + `git stash apply` + `git stash drop` + @stash_needed = false + end + # Returns the local git branches; current branch is always first def local_branches @local_branches ||= begin @@ -727,10 +744,18 @@ EOF end end - # Return to the original branch - git_checkout(working_branch) + if local_branch == working_branch + # We're moving away from the working branch, so save off changed files + git_stash_all + end end + # Return to the original branch + git_checkout(working_branch) + + # If necessary, restore temporarily stashed files + git_apply_and_drop + puts "\nAll builds completed." end
Detect and stash un-added working branch files during packaging
redhataccess_ascii_binder
train
rb
0ac545000d1fab976026812384d3d1434d3742c7
diff --git a/commander/types/sensor_event.py b/commander/types/sensor_event.py index <HASH>..<HASH> 100644 --- a/commander/types/sensor_event.py +++ b/commander/types/sensor_event.py @@ -20,5 +20,5 @@ class SensorEvent: self.stream = stream self.metadata = metadata - self.timestamp = datetime(timestamp_year, timestamp_month, timestamp_day, timestamp_hours, timestamp_minutes, timestamp_seconds) + self.timestamp = datetime(1960,4,12,0,0,30)#timestamp_year, timestamp_month, timestamp_day, timestamp_hours, timestamp_minutes, timestamp_seconds) self.value = value \ No newline at end of file
Finalize buffer overrun fix, implement an exhaustive test.
iotile_coretools
train
py
7ab9e696ff01b3ebfcb83d9ce609ef3dd8e53ad6
diff --git a/lib/rspectacles/formatter/legacy/redis.rb b/lib/rspectacles/formatter/legacy/redis.rb index <HASH>..<HASH> 100644 --- a/lib/rspectacles/formatter/legacy/redis.rb +++ b/lib/rspectacles/formatter/legacy/redis.rb @@ -5,6 +5,8 @@ module RSpectacles module Formatter module Legacy class Redis < RSpec::Core::Formatters::BaseFormatter + attr_reader :output + def initialize(_) end diff --git a/lib/rspectacles/version.rb b/lib/rspectacles/version.rb index <HASH>..<HASH> 100644 --- a/lib/rspectacles/version.rb +++ b/lib/rspectacles/version.rb @@ -1,3 +1,3 @@ module RSpectacles - VERSION='0.1.1' + VERSION='0.1.2' end
Adding an output method to the formatters to match API
g2crowd_rspectacles
train
rb,rb
3ab7b739bc2e0140139d97a0b99611d7f278e075
diff --git a/bct/bct/algorithms/distance.py b/bct/bct/algorithms/distance.py index <HASH>..<HASH> 100644 --- a/bct/bct/algorithms/distance.py +++ b/bct/bct/algorithms/distance.py @@ -374,7 +374,7 @@ def efficiency_bin(G,local=False): #symmetrized adjacency vector sa=G[u,V]+G[V,u].T - numer = np.sum(np.dot(sa.T,sa)*se)/2 + numer = np.sum(np.outer(sa.T,sa)*se)/2 if numer!=0: denom = np.sum(sa)**2 - np.sum(sa*sa) E[u] = numer/denom #local efficiency
propagate correct local efficiency calculation to efficiency_bin
aestrivex_bctpy
train
py
9f674fad489f4c86b07cbfa596b34986528352c1
diff --git a/lib/server.js b/lib/server.js index <HASH>..<HASH> 100644 --- a/lib/server.js +++ b/lib/server.js @@ -56,6 +56,17 @@ Server.prototype = { next() }) exp.use(Express.static(__dirname + '/../public')) + + // Load other static dirs that you want pathed relative to test server + // Example + // static_dirs: + // - app + // - temp + var dirs = config.get('static_dirs') || [] + for (var i = 0; i < dirs.length; i++) { + console.log(path.resolve(dirs[i])) + exp.use(Express.static(path.resolve(dirs[i]))) + } }) exp.get('/', function(req, res){ var framework = config.get('framework') || 'jasmine'
added configurable static_dirs for pathing for platforms like yeoman
testem_testem
train
js
2e4501cb53b940f8bb8aadac7c4f77f39d67e6dd
diff --git a/jsonrpc/tests/test_backend_flask/tests.py b/jsonrpc/tests/test_backend_flask/tests.py index <HASH>..<HASH> 100644 --- a/jsonrpc/tests/test_backend_flask/tests.py +++ b/jsonrpc/tests/test_backend_flask/tests.py @@ -1,5 +1,6 @@ import json import sys +from mock import patch if sys.version_info < (2, 7): import unittest2 as unittest @@ -116,3 +117,7 @@ class TestFlaskBackend(unittest.TestCase): def test_resource_map_prefix(self): response = self.client.get('/map') self.assertEqual(response.status_code, 200) + + def test_as_view(self): + with patch.object(api, 'jsonrpc') as mock_jsonrpc: + self.assertIs(api.as_view(), mock_jsonrpc)
cover code up to <I>%
pavlov99_json-rpc
train
py
16e548397e7800053de025bf9c05a9f8b079a182
diff --git a/backbone.js b/backbone.js index <HASH>..<HASH> 100644 --- a/backbone.js +++ b/backbone.js @@ -914,7 +914,10 @@ // Create a new collection with an identical list of models as this one. clone: function() { - return new this.constructor(this.models); + return new this.constructor(this.models, { + model: this.model, + comparator: this.comparator + }); }, // Private method to reset all internal state. Called when the collection diff --git a/test/collection.js b/test/collection.js index <HASH>..<HASH> 100644 --- a/test/collection.js +++ b/test/collection.js @@ -60,6 +60,17 @@ strictEqual(collection.last().get('a'), 4); }); + test("clone preserves model and comparator", 3, function() { + var Model = Backbone.Model.extend(), + comparator = function() {}; + + var col = (new Backbone.Collection([{id: 1}], {model: Model, comparator: comparator})).clone(); + col.add({id: 2}); + ok(col.at(0) instanceof Model); + ok(col.at(1) instanceof Model); + strictEqual(col.comparator, comparator); + }); + test("get", 6, function() { equal(col.get(0), d); equal(col.get(d.clone()), d);
pass along model and comparator to cloned collection. Fixes #<I>
jashkenas_backbone
train
js,js
6c9946aca876697cb5ddaea59cbb6a34d15f98b0
diff --git a/src/Monolog/Handler/GroupHandler.php b/src/Monolog/Handler/GroupHandler.php index <HASH>..<HASH> 100644 --- a/src/Monolog/Handler/GroupHandler.php +++ b/src/Monolog/Handler/GroupHandler.php @@ -11,8 +11,6 @@ namespace Monolog\Handler; -use Monolog\Logger; - /** * Forwards records to multiple handlers * @@ -28,6 +26,12 @@ class GroupHandler extends AbstractHandler */ public function __construct(array $handlers, $bubble = false) { + foreach ($handlers as $handler) { + if (!$handler instanceof HandlerInterface) { + throw new \InvalidArgumentException('The first argument of the GroupHandler must be an array of HandlerInterface instances.'); + } + } + $this->handlers = $handlers; $this->bubble = $bubble; } @@ -37,7 +41,13 @@ class GroupHandler extends AbstractHandler */ public function isHandling(array $record) { - return true; + foreach ($this->handlers as $handler) { + if ($handler->isHandling($record)) { + return true; + } + } + + return false; } /** @@ -48,6 +58,7 @@ class GroupHandler extends AbstractHandler foreach ($this->handlers as $handler) { $handler->handle($record); } + return false === $this->bubble; }
Tweaked the GroupHandler to make it handle a record only when needed
Seldaek_monolog
train
php
ddcda4b1a9dc7e84c80e9bbf6aa6b8dbfffeed66
diff --git a/bl/integration/drivers/azure.js b/bl/integration/drivers/azure.js index <HASH>..<HASH> 100644 --- a/bl/integration/drivers/azure.js +++ b/bl/integration/drivers/azure.js @@ -66,7 +66,7 @@ let lib = { let profile = { firstName: soajsResponse.profile.given_name, lastName: soajsResponse.profile.family_name, - email: soajsResponse.profile.email, + email: soajsResponse.profile.email || soajsResponse.profile.upn, username: soajsResponse.profile.oid, id: soajsResponse.profile.oid, originalProfile: soajsResponse.profile,
assure email is set when azure login happens
soajs_soajs.oauth
train
js
93024e53c1445cb4630ee5c07926abff8943715f
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -101,7 +101,7 @@ setup( license="Apache", packages=find_packages(exclude=["*.tests", "*.tests.*", "tests.*", "tests"]), install_requires=[ - "torch>=1.2.0", + "torch>=1.2.0,<1.3", "jsonnet>=0.10.0 ; sys.platform != 'win32'", "overrides", "nltk",
Pin to pytorch <I> in setup.py (#<I>)
allenai_allennlp
train
py
a2789b3abb196e3183f08c5a8411b7f038316f89
diff --git a/src/Model.php b/src/Model.php index <HASH>..<HASH> 100644 --- a/src/Model.php +++ b/src/Model.php @@ -47,7 +47,7 @@ class Model extends Datachore { if ($this->updates[$key] instanceof \google\appengine\datastore\v4\Key) { - $fkey = $this->values[$key]; + $fkey = $this->updates[$key]; } }
FIX: use updates when checking for them (in __get) with keys.
pwhelan_datachore
train
php
d94248be8d892aeeef8a0a72f1e79d148f597f3d
diff --git a/pykechain/client.py b/pykechain/client.py index <HASH>..<HASH> 100644 --- a/pykechain/client.py +++ b/pykechain/client.py @@ -412,7 +412,7 @@ class Client(object): r = self._request('POST', self._build_url('activities'), data=data) - if r.status_code != 201: + if r.status_code != 201: # pragma: no cover raise APIError("Could not create activity") data = r.json() @@ -424,7 +424,7 @@ class Client(object): params={"select_action": action}, data=data) - if r.status_code != requests.codes.created: + if r.status_code != requests.codes.created: # pragma: no cover raise APIError("Could not create part, {}: {}".format(str(r), r.content)) return Part(r.json()['results'][0], client=self)
- removed APIError(s) from coverage inside client.py
KE-works_pykechain
train
py
67ed2ac35a303caddf09fb47e9563a289ddfb8a0
diff --git a/lib/cocoaseeds/core.rb b/lib/cocoaseeds/core.rb index <HASH>..<HASH> 100644 --- a/lib/cocoaseeds/core.rb +++ b/lib/cocoaseeds/core.rb @@ -507,8 +507,12 @@ module Seeds # def configure_phase self.project.targets.each do |target| - phase = target.sources_build_phase - next if not phase + begin + phase = target.sources_build_phase + next unless phase + rescue NoMethodError + next + end # remove zombie build files phase.files_references.each do |file|
Catch an exception when trying to access target's undefined `sources_build_phase`
devxoul_CocoaSeeds
train
rb
3ee8d2728199ef5ecb6dfbc0b4be98b132c61067
diff --git a/framework/bootstrap.js b/framework/bootstrap.js index <HASH>..<HASH> 100644 --- a/framework/bootstrap.js +++ b/framework/bootstrap.js @@ -84,6 +84,9 @@ Bootstrap = Type.create({ if (Type.isNumber(env.port)) { this.setListenPort(env.port); } + if (Type.isString(env.host)) { + this.setListenHost(env.host); + } // set aliases if (Type.isArray(env.aliases)) { env.aliases.forEach(function setAlias(item) {
Add possibility to set listen host in env.son
AdminJuwel191_node-mvc
train
js
1bdf0290abbcf1cd218d3c0f9a8fefa64e7fb7c0
diff --git a/gnupg/gnupg.py b/gnupg/gnupg.py index <HASH>..<HASH> 100644 --- a/gnupg/gnupg.py +++ b/gnupg/gnupg.py @@ -180,7 +180,7 @@ class GPG(GPGBase): else: log.warn("No 'default_key' given! Using first key on secring.") - if isinstance(data, file): + if hasattr(data, 'read'): result = self._sign_file(data, **kwargs) elif not _is_stream(data): stream = _make_binary_stream(data, self._encoding)
File and IO handling in Py3 is different than Py2 Instead of checking whether data isinstance of 'file', then we check that it is file-like _enough_ to be treated as a file (i.e. it hasattr 'read').
isislovecruft_python-gnupg
train
py
7f54360df37734241f8d555143ec1c17b9aad829
diff --git a/audiolazy/tests/test_poly.py b/audiolazy/tests/test_poly.py index <HASH>..<HASH> 100644 --- a/audiolazy/tests/test_poly.py +++ b/audiolazy/tests/test_poly.py @@ -28,6 +28,7 @@ p = pytest.mark.parametrize import operator import types from itertools import combinations_with_replacement, combinations +from functools import reduce # Audiolazy internal imports from ..lazy_poly import Poly, lagrange, resample, x @@ -479,6 +480,20 @@ class TestPoly(object): assert poly == x ** 3 + x + 1 assert poly in my_set + @p("poly", [x ** 2 - 2 * x + 1, .3 * x ** 7 - 4 * x ** 2 + .1]) + def test_roots(self, poly): + prod = lambda iterable: reduce(operator.mul, iterable, Poly(1)) + rebuilt_poly = poly[poly.order] * prod(x - r for r in poly.roots) + assert almost_eq.diff(poly.values(), rebuilt_poly.values()) + + @p("poly", [5 - x ** -2, x + 2 * x ** .3]) + def test_roots_invalid(self, poly): + with pytest.raises(AttributeError): + poly.roots + + def test_constants_have_no_roots(self): + assert all(Poly(c).roots == [] for c in [2, -3, 4j, .2 + 3.4j]) + class TestLagrange(object):
Tests for the Poly.roots property
danilobellini_audiolazy
train
py
78ae85beec91382b981930225ae23a4acbcae5dd
diff --git a/git_repo/services/bitbucket.py b/git_repo/services/bitbucket.py index <HASH>..<HASH> 100644 --- a/git_repo/services/bitbucket.py +++ b/git_repo/services/bitbucket.py @@ -92,6 +92,10 @@ class BitbucketService(RepositoryService): fqdn = 'bitbucket.org' def connect(self): + if not self._privatekey: + raise ConnectionError('Could not connect to BitBucket. Please configure .gitconfig with your bitbucket credentials.') + if not ':' in self._privatekey: + raise ConnectionError('Could not connect to BitBucket. Please setup your private key with login:password') username, password = self._privatekey.split(':') self.bb = Bitbucket(username, password) monkey_patch(self.bb)
Fixed error handling of lack of privatekey for bitbucket
guyzmo_git-repo
train
py