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
a8842526a6de9070ae474bafbe06387e24c2c9d0
diff --git a/core/src/main/java/com/orientechnologies/orient/core/serialization/serializer/object/OObjectSerializerHelper.java b/core/src/main/java/com/orientechnologies/orient/core/serialization/serializer/object/OObjectSerializerHelper.java index <HASH>..<HASH> 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/serialization/serializer/object/OObjectSerializerHelper.java +++ b/core/src/main/java/com/orientechnologies/orient/core/serialization/serializer/object/OObjectSerializerHelper.java @@ -97,20 +97,16 @@ public class OObjectSerializerHelper { private static Class jpaTransientClass; static { - // DETERMINE IF THERE IS AVAILABLE JPA 2 try { + // DETERMINE IF THERE IS AVAILABLE JPA 1 jpaIdClass = Class.forName("javax.persistence.Id"); jpaVersionClass = Class.forName("javax.persistence.Version"); - - // DETERMINE IF THERE IS AVAILABLE JPA 2 jpaEmbeddedClass = Class.forName("javax.persistence.Embedded"); + jpaTransientClass = Class.forName("javax.persistence.Transient"); // DETERMINE IF THERE IS AVAILABLE JPA 2 jpaAccessClass = Class.forName("javax.persistence.Access"); - // DETERMINE IF THERE IS AVAILABLE JPA 2 - jpaTransientClass = Class.forName("javax.persistence.Transient"); - } catch (Exception e) { } }
Fixed issue <I>: support for JPA @Transient annotation
orientechnologies_orientdb
train
java
ecec265305b7f26bbf90924ad4ad37c571caa085
diff --git a/src/Transfer.php b/src/Transfer.php index <HASH>..<HASH> 100644 --- a/src/Transfer.php +++ b/src/Transfer.php @@ -23,11 +23,26 @@ class Transfer extends Entity return parent::all($options); } + /** + * Create a direct transfer from merchant's account to + * any of the linked accounts, without linking it to a + * payment + */ public function create($attributes = array()) { return parent::create($attributes); } + /** + * Create a transfer to a linked account for a payment + */ + public function transfer($paymentId, $attributes = array()) + { + $relativeUrl = 'payments/' . $paymentId. '/transfers'; + + return $this->request('POST', $relativeUrl, $options); + } + public function edit($attributes = null) { $entityUrl = $this->getEntityUrl() . $this->id;
feat(transfers): Create a transfer to a linked account for a payment
razorpay_razorpay-php
train
php
9c1766b80681e49e98f6de3ded654b9863c87a80
diff --git a/socketIO_client/__init__.py b/socketIO_client/__init__.py index <HASH>..<HASH> 100644 --- a/socketIO_client/__init__.py +++ b/socketIO_client/__init__.py @@ -260,8 +260,9 @@ class SocketIO(object): self.client_supported_transports, socketIO_session, self.is_secure, self.base_url, **self.kw) # Update namespaces - for namespace in self._namespace_by_path.values(): + for path, namespace in self._namespace_by_path.iteritems(): namespace._transport = transport + transport.connect(path) return transport def _make_heartbeat_pacemaker(self, heartbeat_interval):
Automatically reconnect transport to existing namespaces
invisibleroads_socketIO-client
train
py
5b3808aca4d7ea18ca173deb5360562cd84263b4
diff --git a/packages/oas-resolver/index.js b/packages/oas-resolver/index.js index <HASH>..<HASH> 100644 --- a/packages/oas-resolver/index.js +++ b/packages/oas-resolver/index.js @@ -329,11 +329,7 @@ function findExternalRefs(options) { } refs[ref].data = data; // sort $refs by length - let pointers = unique(refs[ref].paths).sort(function(a,b){ - if (a.length < b.length) return -1; - if (a.length > b.length) return +1; - return 0; - }); + let pointers = unique(refs[ref].paths); for (let ptr of pointers) { // shared x-ms-examples $refs confuse the fixupRefs heuristic in index.js if (refs[ref].resolvedAt && (ptr !== refs[ref].resolvedAt) && (ptr.indexOf('x-ms-examples/')<0)) {
resolver; omit sorting of ref paths, see octokit
Mermade_oas-kit
train
js
da585baade17e496919d722acf0367836b0ed1a0
diff --git a/src/Action/RetrieveAutocompleteItemsAction.php b/src/Action/RetrieveAutocompleteItemsAction.php index <HASH>..<HASH> 100644 --- a/src/Action/RetrieveAutocompleteItemsAction.php +++ b/src/Action/RetrieveAutocompleteItemsAction.php @@ -178,7 +178,7 @@ final class RetrieveAutocompleteItemsAction return new JsonResponse([ 'status' => 'OK', - 'more' => !$pager->isLastPage(), + 'more' => \count($items) > 0 && !$pager->isLastPage(), 'items' => $items, ]); }
Avoid infinite calls to retrieveAutocompleteItemsAction When searching through autocomplete returns 0 results, the lastPage is 0, but the current one is 1, so technically it isn't the last page.
sonata-project_SonataAdminBundle
train
php
2e63de9b0494f995a948176077561a70ef0f9c9a
diff --git a/ontobio/rdfgen/gocamgen/gocam_builder.py b/ontobio/rdfgen/gocamgen/gocam_builder.py index <HASH>..<HASH> 100644 --- a/ontobio/rdfgen/gocamgen/gocam_builder.py +++ b/ontobio/rdfgen/gocamgen/gocam_builder.py @@ -49,6 +49,9 @@ class GoCamBuilder: self.gpi_entities = self.parse_gpi(parser_config.gpi_authority_path) def translate_to_model(self, gene, assocs: List[GoAssociation]): + if gene not in self.gpi_entities: + error_msg = "Gene ID '{}' missing from provided GPI. Skipping model translation.".format(gene) + raise GocamgenException(error_msg) model_id = gene.replace(":", "_") model_title = self.model_title(gene) model = AssocGoCamModel(model_title, assocs, config=self.config, store=self.store, gpi_entities=self.gpi_entities, model_id=model_id)
Skip and report if annot entity not in GPI; for geneontology/gocamgen#<I>
biolink_ontobio
train
py
af2c5ab759a6812da402a59a2f328604b93d7542
diff --git a/salt/modules/win_useradd.py b/salt/modules/win_useradd.py index <HASH>..<HASH> 100644 --- a/salt/modules/win_useradd.py +++ b/salt/modules/win_useradd.py @@ -341,7 +341,7 @@ def info(name): ret['logonscript'] = items['script_path'] ret['profile'] = items['profile'] if not ret['profile']: - ret['profile'] = _get_userprofile_from_registry(name, ret['uid'])['vdata'] + ret['profile'] = _get_userprofile_from_registry(name, ret['uid']) ret['home'] = items['home_dir'] if not ret['home']: ret['home'] = ret['profile'] @@ -360,7 +360,7 @@ def _get_userprofile_from_registry(user, sid): 'HKEY_LOCAL_MACHINE', u'SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\ProfileList\\{0}'.format(sid), 'ProfileImagePath' - ) + )['vdata'] log.debug(u'user {0} with sid={2} profile is located at "{1}"'.format(user, profile_dir, sid)) return profile_dir
Fixed win_useradd.py The real fix. Instead of getting vdata in the calling function, _get_userprofile_from_registry should return just the profile and not a dict full of a bunch of crap. This also fixes the debug log for the _get_userprofile_from_registry function.
saltstack_salt
train
py
cd1a9c6853b70f38a0cc621a547d5de361a6fcf4
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -21,11 +21,12 @@ if any([v < (2, 6), (3,) < v < (3, 3)]): import os from os.path import abspath import sys +import numpy as np from setuptools import setup, Extension, find_packages # Sources & libraries -inc_dirs = [abspath('bquery')] +inc_dirs = [abspath('bquery'), np.get_include()] lib_dirs = [] libs = [] def_macros = []
setup in clude numpy bette
visualfabriq_bquery
train
py
e074e0f9ad7975ab196090fd75c7475c4f81ad59
diff --git a/Kwf/Component/Abstract/ContentSender/Lightbox.php b/Kwf/Component/Abstract/ContentSender/Lightbox.php index <HASH>..<HASH> 100644 --- a/Kwf/Component/Abstract/ContentSender/Lightbox.php +++ b/Kwf/Component/Abstract/ContentSender/Lightbox.php @@ -103,6 +103,7 @@ class Kwf_Component_Abstract_ContentSender_Lightbox extends Kwf_Component_Abstra " $lightboxContent\n". " </div>\n". "</div>\n</div>\n"; + $lightboxContent .= "<div class=\"kwfLightboxMask kwfLightboxMaskOpen\"></div>\n"; return preg_replace('#(<body[^>]*>)#', "\\1\n".$lightboxContent, $parentContent); } else { return $lightboxContent;
Create the mask in php Prevent the mask from animating
koala-framework_koala-framework
train
php
8b81afedf659eb30d41d4a81c0e3324702856dce
diff --git a/src/ActiveQuery.php b/src/ActiveQuery.php index <HASH>..<HASH> 100644 --- a/src/ActiveQuery.php +++ b/src/ActiveQuery.php @@ -14,6 +14,7 @@ use hiqdev\hiart\rest\QueryBuilder; use yii\db\ActiveQueryInterface; use yii\db\ActiveQueryTrait; use yii\db\ActiveRelationTrait; +use yii\db\BaseActiveRecord; class ActiveQuery extends Query implements ActiveQueryInterface { @@ -358,6 +359,7 @@ class ActiveQuery extends Query implements ActiveQueryInterface $relatedModelClass::populateRecord($relatedModel, $item); $relation->populateJoinedRelations($relatedModel, $item); $relation->addInverseRelation($relatedModel, $model); + $relatedModel->trigger(BaseActiveRecord::EVENT_AFTER_FIND); if ($relation->indexBy !== null) { $index = is_string($relation->indexBy) ? $relatedModel[$relation->indexBy] @@ -373,6 +375,7 @@ class ActiveQuery extends Query implements ActiveQueryInterface $relatedModelClass::populateRecord($relatedModel, $value); $relation->populateJoinedRelations($relatedModel, $value); $relation->addInverseRelation($relatedModel, $model); + $relatedModel->trigger(BaseActiveRecord::EVENT_AFTER_FIND); $records = $relatedModel; }
Trigger EVENT_AFTER_FIND for joined relations for consistency
hiqdev_yii2-hiart
train
php
9dae6c9174c0cd3bbb429d52319fcf776318a031
diff --git a/intranet/apps/eighth/views/admin/groups.py b/intranet/apps/eighth/views/admin/groups.py index <HASH>..<HASH> 100644 --- a/intranet/apps/eighth/views/admin/groups.py +++ b/intranet/apps/eighth/views/admin/groups.py @@ -662,8 +662,7 @@ def add_member_to_group_view(request, group_id): if not results: return redirect(next_url + "?error=n") else: - users = results - results = sorted(results, key=lambda x: (x.last_name, x.first_name)) + users = sorted(results, key=lambda x: (x.last_name, x.first_name)) context = {"query": query, "users": users, "group": group, "admin_page_title": "Add Members to Group"} return render(request, "eighth/admin/possible_students_add_group.html", context)
refactor(eighth): sort users in group add view
tjcsl_ion
train
py
44ea453a84942f3266414fda24810ec5c886e0b4
diff --git a/src/GitHub_Updater/WP-CLI/CLI.php b/src/GitHub_Updater/WP-CLI/CLI.php index <HASH>..<HASH> 100644 --- a/src/GitHub_Updater/WP-CLI/CLI.php +++ b/src/GitHub_Updater/WP-CLI/CLI.php @@ -61,6 +61,8 @@ class CLI extends WP_CLI_Command { } else { WP_CLI::error( sprintf( 'Incorrect command syntax, see %s for proper syntax.', '`wp help github-updater cache`' ) ); } + WP_CLI::success( 'WP-Cron is now running.' ); + WP_CLI::runcommand( 'cron event run --due-now' ); } /**
run wp-cron after deleting cache
afragen_github-updater
train
php
cc63061a214416b88592b520299246ad426ec001
diff --git a/src/Stillat/Common/Database/Repositories/ConnectionRepository.php b/src/Stillat/Common/Database/Repositories/ConnectionRepository.php index <HASH>..<HASH> 100644 --- a/src/Stillat/Common/Database/Repositories/ConnectionRepository.php +++ b/src/Stillat/Common/Database/Repositories/ConnectionRepository.php @@ -44,6 +44,16 @@ abstract class ConnectionRepository implements RepositoryInterface { } /** + * Sets the connection name for the repository. + * + * @param string $connectionName + */ + public function setConnection($connectionName) + { + $this->connectionName = $connectionName; + } + + /** * Get the table name for the repository. * * @return string
Added a setConnection() function.
Stillat_Common
train
php
035d160ba515a50128ee17b36158855aea35761b
diff --git a/common/src/main/java/tachyon/conf/TachyonConf.java b/common/src/main/java/tachyon/conf/TachyonConf.java index <HASH>..<HASH> 100644 --- a/common/src/main/java/tachyon/conf/TachyonConf.java +++ b/common/src/main/java/tachyon/conf/TachyonConf.java @@ -25,6 +25,8 @@ import java.util.Properties; import java.util.regex.Matcher; import java.util.regex.Pattern; +import javax.annotation.concurrent.ThreadSafe; + import org.apache.commons.lang3.SerializationUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -68,6 +70,7 @@ import tachyon.util.network.NetworkAddressUtils; * The class only supports creation using {@code new TachyonConf(properties)} to override default * values. */ +@ThreadSafe public final class TachyonConf { /** File to set default properties */ public static final String DEFAULT_PROPERTIES = "tachyon-default.properties";
Adding thread safety annotations for tachyon.conf in common module.
Alluxio_alluxio
train
java
6cbb8b5f29ec2be643e339b654a71b516cf233f2
diff --git a/CarbonPHP.php b/CarbonPHP.php index <HASH>..<HASH> 100644 --- a/CarbonPHP.php +++ b/CarbonPHP.php @@ -173,8 +173,7 @@ class CarbonPHP } // More cache control is given in the .htaccess File - Request::setHeader('Cache-Control: must-revalidate'); // TODO - not this per say (better cache) - + // Request::setHeader('Cache-Control: must-revalidate'); // TODONE - not this per say (better cache) ################## VALIDATE URL / URI ################## // Even if a request is bad, we need to store the log @@ -183,7 +182,7 @@ class CarbonPHP $this->IP_FILTER(); } - $this->URI_FILTER($PHP['SITE']['URL'] ?? '', $PHP['SITE']['ALLOWED_EXTENSIONS'] ?? ''); + $this->URI_FILTER($PHP['SITE']['URL'] ?? '', $PHP['SITE']['CACHE_CONTROL'] ?? []); if ($PHP['DATABASE']['REBUILD'] ?? false) { Database::setUp(false); // redirect = false
Trying to move into stable dev life.
RichardTMiles_CarbonPHP
train
php
44cf09a854de4d28f9d06326a32c8dac3f9d4420
diff --git a/km3pipe/tests/test_hardware.py b/km3pipe/tests/test_hardware.py index <HASH>..<HASH> 100644 --- a/km3pipe/tests/test_hardware.py +++ b/km3pipe/tests/test_hardware.py @@ -277,7 +277,10 @@ class TestDetector(TestCase): det = self.det det._parse_doms() pmt_dir = det.pmts[det.pmts.dom_id == dom_id].dir[channel_id].copy() + pmt_pos = det.pmts[det.pmts.dom_id == dom_id].pos[channel_id].copy() for i in range(360): det.rotate_dom_by_yaw(dom_id, 1) pmt_dir_rot = det.pmts[det.pmts.dom_id == dom_id].dir[channel_id] assert np.allclose(pmt_dir, pmt_dir_rot) + pmt_pos_rot = det.pmts[det.pmts.dom_id == dom_id].pos[channel_id] + assert np.allclose(pmt_pos, pmt_pos_rot)
Failing test for PMT positions when rotating the DOM
tamasgal_km3pipe
train
py
74424feb921f171867d29c64a9f2134be3cb21c6
diff --git a/lib/appsignal/version.rb b/lib/appsignal/version.rb index <HASH>..<HASH> 100644 --- a/lib/appsignal/version.rb +++ b/lib/appsignal/version.rb @@ -1,4 +1,4 @@ module Appsignal - VERSION = '0.12.beta.4' + VERSION = '0.12.beta.5' AGENT_VERSION = '5399e29' end
Bump to <I>.beta<I> [ci skip]
appsignal_appsignal-ruby
train
rb
e402b8f0ce49684a3ce19af479556272c3956756
diff --git a/src/Aimeos/Shop/Base/Support.php b/src/Aimeos/Shop/Base/Support.php index <HASH>..<HASH> 100644 --- a/src/Aimeos/Shop/Base/Support.php +++ b/src/Aimeos/Shop/Base/Support.php @@ -79,7 +79,7 @@ class Support foreach( array_reverse( $context->getLocale()->getSitePath() ) as $siteid ) { - if( (string) $user->siteid === $siteid ) { + if( (string) $user->siteid === (string) $siteid ) { $this->cache[$user->id][$groups] = $this->checkGroups( $context, $user->id, $groupcodes ); } }
Fixed login problem for admins and editors in admin interface
aimeos_aimeos-laravel
train
php
2f57e7b2475bc7567bf3becdca1fa922b6b3f9ae
diff --git a/backtrader/observers/drawdown.py b/backtrader/observers/drawdown.py index <HASH>..<HASH> 100644 --- a/backtrader/observers/drawdown.py +++ b/backtrader/observers/drawdown.py @@ -47,6 +47,28 @@ class DrawDown(Observer): self.lines.maxdrawdown[0] = self._dd.rets.max.drawdown # update max +class DrawDownLength(Observer): + '''This observer keeps track of the current drawdown length (plotted) and + the drawdown max length (not plotted) + + Params: None + ''' + _stclock = True + + lines = ('len', 'maxlen',) + + plotinfo = dict(plot=True, subplot=True) + + plotlines = dict(maxlength=dict(_plotskip=True,)) + + def __init__(self): + self._dd = self._owner._addanalyzer_slave(bt.analyzers.DrawDown) + + def next(self): + self.lines.len[0] = self._dd.rets.len # update drawdown length + self.lines.maxlen[0] = self._dd.rets.max.len # update max length + + class DrawDown_Old(Observer): '''This observer keeps track of the current drawdown level (plotted) and the maxdrawdown (not plotted) levels
Add drawdown length observer (#<I>)
backtrader_backtrader
train
py
7bb19d61d5d893f79a4d4cf0e7598d9dc5eaf273
diff --git a/lib/specjour/cpu.rb b/lib/specjour/cpu.rb index <HASH>..<HASH> 100644 --- a/lib/specjour/cpu.rb +++ b/lib/specjour/cpu.rb @@ -3,7 +3,7 @@ module Specjour def self.cores case RUBY_PLATFORM when /darwin/ - command('hostinfo') =~ /^(\d+).+logically/ + command('hostinfo') =~ /^(\d+).+physically/ $1.to_i when /linux/ command('grep --count processor /proc/cpuinfo').to_i diff --git a/spec/specjour/cpu_spec.rb b/spec/specjour/cpu_spec.rb index <HASH>..<HASH> 100644 --- a/spec/specjour/cpu_spec.rb +++ b/spec/specjour/cpu_spec.rb @@ -7,7 +7,7 @@ describe Specjour::CPU do Mach kernel version: Darwin Kernel Version 10.2.0: Tue Nov 3 10:37:10 PST 2009; root:xnu-1486.2.11~1/RELEASE_I386 Kernel configured for up to 2 processors. -2 processors are physically available. +440 processors are physically available. 220 processors are logically available. Processor type: i486 (Intel 80486) Processors active: 0 1 @@ -21,8 +21,8 @@ Load average: 0.09, Mach factor: 1.90 stub(Specjour::CPU).command.returns(hostinfo) end - it "returns the number of logically available processors" do - Specjour::CPU.cores.should == 220 + it "returns the number of physically available processors" do + Specjour::CPU.cores.should == 440 end end end
Remove cpu hyperthreading detection Proves to be very unstable while running selenium
sandro_specjour
train
rb,rb
7289d470e8862daa3eeba3f40acf66c76aeea096
diff --git a/src/sap.m/test/sap/m/demokit/sample/PopoverControllingCloseBehavior/C.controller.js b/src/sap.m/test/sap/m/demokit/sample/PopoverControllingCloseBehavior/C.controller.js index <HASH>..<HASH> 100644 --- a/src/sap.m/test/sap/m/demokit/sample/PopoverControllingCloseBehavior/C.controller.js +++ b/src/sap.m/test/sap/m/demokit/sample/PopoverControllingCloseBehavior/C.controller.js @@ -46,11 +46,11 @@ sap.ui.define([ }, disablePointerEvents: function () { - this.byId("idProductsTable").$().css("pointer-events", "none"); + this.byId("idProductsTable").setBlocked(true); }, enablePointerEvents: function () { - this.byId("idProductsTable").$().css("pointer-events", "all"); + this.byId("idProductsTable").setBlocked(false); }, handleActionPress: function (oEvent) {
[INTERNAL] Popover: Export app example improved Export app example about popover - controlling closing behaviour is now adopted to use the new setBlocked API of the Control. Change-Id: Ie9cad6eae6c<I>a<I>ab0fb<I>b<I>ef7b<I>a1e<I> JIRA: BGSOFUIRILA-<I>
SAP_openui5
train
js
875f6430958b087164745210c8733729babf176b
diff --git a/lib/aruba/api/core.rb b/lib/aruba/api/core.rb index <HASH>..<HASH> 100644 --- a/lib/aruba/api/core.rb +++ b/lib/aruba/api/core.rb @@ -177,9 +177,11 @@ module Aruba end file_name else - directory = File.join(aruba.root_directory, aruba.current_directory) - directory = File.expand_path(dir_string, directory) if dir_string - File.expand_path(file_name, directory) + with_environment do + directory = File.expand_path(aruba.current_directory, aruba.root_directory) + directory = File.expand_path(dir_string, directory) if dir_string + File.expand_path(file_name, directory) + end end end # rubocop:enable Metrics/MethodLength
Fix expanding paths when current directory contains '~'
cucumber_aruba
train
rb
f23403f82b885f4396623113ee7487bdbd0c761f
diff --git a/js/sendmessage.js b/js/sendmessage.js index <HASH>..<HASH> 100644 --- a/js/sendmessage.js +++ b/js/sendmessage.js @@ -119,7 +119,7 @@ window.textsecure.messaging = function() { message.fetch().then(function() { textsecure.storage.removeEncrypted("devices" + number); var proto = textsecure.protobuf.PushMessageContent.decode(encodedMessage, 'binary'); - sendMessageProto([number], proto, function(res) { + sendMessageProto(message.get('sent_at'), [number], proto, function(res) { if (res.failure.length > 0) { message.set('errors', res.failure); }
Fix arguments to sendMessageProto in tryMessageAgain As ov ccc<I>d2 sendMessageProto takes a timestamp for the first argument, in service of app-level delivery receipts.
ForstaLabs_librelay-node
train
js
e9fe867997e39c0d73ce70cb3fc52c5abe95d437
diff --git a/tests/test_coders.py b/tests/test_coders.py index <HASH>..<HASH> 100644 --- a/tests/test_coders.py +++ b/tests/test_coders.py @@ -147,6 +147,19 @@ class TestQPCoders(unittest.TestCase): # [0] self.assertEqual(request['quad'], self.encode_doubles([0])) + def test_qp_request_encoding_undirected_biases(self): + """Quadratic terms are correctly encoded when given as undirected biases.""" + + solver = get_structured_solver() + linear = {} + quadratic = {(0,3): -1, (3,0): -1} + request = encode_problem_as_qp(solver, linear, quadratic, undirected_biases=True) + self.assertEqual(request['format'], 'qp') + # [0, NaN, NaN, 0] + self.assertEqual(request['lin'], self.encode_doubles([0, self.nan, self.nan, 0])) + # [-1] + self.assertEqual(request['quad'], self.encode_doubles([-1])) + def test_qp_response_decoding(self): res = decode_qp(copy.deepcopy(self.res_msg))
Add unittest for undirected biases qp encoder
dwavesystems_dwave-cloud-client
train
py
dd90a5ca46858780fc38df584c36203c94a9f3c6
diff --git a/src/js/vis/dendrogram.js b/src/js/vis/dendrogram.js index <HASH>..<HASH> 100644 --- a/src/js/vis/dendrogram.js +++ b/src/js/vis/dendrogram.js @@ -105,7 +105,7 @@ d.y = d.y / maxY * (width - 150); }); - if (nodeLimit) { + if (nodeLimit && nodes.length > nodeLimit) { // Filter out everything beyond parent y-position to keep things interactive nodes.sort(function (a, b) { return d3.ascending(a.parent.y, b.parent.y); }); nodes.forEach(function (d, i) { d.index = i; });
Don't use node limit if you don't need to
Kitware_tangelo
train
js
56a8bbdda9b0d2afdc1ab61ac457e36138d2cfa1
diff --git a/fleetspeak/src/server/https/streaming_message_server.go b/fleetspeak/src/server/https/streaming_message_server.go index <HASH>..<HASH> 100644 --- a/fleetspeak/src/server/https/streaming_message_server.go +++ b/fleetspeak/src/server/https/streaming_message_server.go @@ -320,6 +320,7 @@ func (m *streamManager) readOne() (*stats.PollInfo, error) { }() buf := make([]byte, size) if _, err := io.ReadFull(m.body, buf); err != nil { + pi.Status = http.StatusBadRequest return &pi, fmt.Errorf("error reading streamed data: %v", err) } pi.ReadTime = time.Since(pi.Start) @@ -339,7 +340,7 @@ func (m *streamManager) readOne() (*stats.PollInfo, error) { } return &pi, err } - + pi.Status = http.StatusOK return &pi, nil } @@ -366,7 +367,10 @@ func (m *streamManager) writeLoop() { for { select { - case cd := <-m.out: + case cd, ok := <-m.out: + if !ok { + return + } pi, err := m.writeOne(cd) if err != nil { if m.ctx.Err() != nil {
Small fixes to make integration test pass.
google_fleetspeak
train
go
5fc12d6d9c784f47c6a36d5c5a8d4b14cbb424ec
diff --git a/salt/modules/slsutil.py b/salt/modules/slsutil.py index <HASH>..<HASH> 100644 --- a/salt/modules/slsutil.py +++ b/salt/modules/slsutil.py @@ -53,6 +53,26 @@ def merge(obj_a, obj_b, strategy='smart', renderer='yaml', merge_lists=False): return salt.utils.dictupdate.merge(obj_a, obj_b, strategy, renderer, merge_lists) +def merge_all(lst, strategy='smart', renderer='yaml', merge_lists=False): + ''' + Merge a list of objects into each other in order + + CLI Example: + + .. code-block:: shell + + > salt '*' slsutil.merge_all '[{foo: Foo}, {foo: Bar}]' + local: {u'foo': u'Bar'} + ''' + + ret = {} + for obj in lst: + ret = salt.utils.dictupdate.merge( + ret, obj, strategy, renderer, merge_lists + ) + + return ret + def renderer(path=None, string=None, default_renderer='jinja|yaml', **kwargs): '''
Adding a merge_all function to slsutil The merge_all function merges a list of objects in order. This will make it easier to merge more than two objects.
saltstack_salt
train
py
6f3bdedd221709b7241ad9c61be36653606b316c
diff --git a/mustache.js b/mustache.js index <HASH>..<HASH> 100644 --- a/mustache.js +++ b/mustache.js @@ -171,7 +171,7 @@ var Mustache = function() { var renderedBefore = before ? that.render_tags(before, context, partials, true) : "", // after may contain both sections and tags, so use full rendering function - renderedAfter = after ? that.render_section(after, context, partials, true) : ""; + renderedAfter = after ? that.render(after, context, partials, true) : ""; var value = that.find(name, context); if(type == "^") { // inverted section
back to render instead of render_section
janl_mustache.js
train
js
57217d1a793a5806feb5f3e89739d580ecd738fa
diff --git a/lib/olive_branch/middleware.rb b/lib/olive_branch/middleware.rb index <HASH>..<HASH> 100644 --- a/lib/olive_branch/middleware.rb +++ b/lib/olive_branch/middleware.rb @@ -3,7 +3,7 @@ require "multi_json" module OliveBranch class Checks def self.content_type_check(content_type) - content_type =~ /application\/json/ + content_type =~ /application\/json/ || content_type =~ /application\/vnd\.api\+json/ end def self.default_exclude(env)
Check for application/vnd.api+json content type as well by default
vigetlabs_olive_branch
train
rb
2e07fee2a4e587055c5ac65f159097d55147e774
diff --git a/pymatbridge/version.py b/pymatbridge/version.py index <HASH>..<HASH> 100644 --- a/pymatbridge/version.py +++ b/pymatbridge/version.py @@ -88,6 +88,7 @@ VERSION = __version__ PACKAGES = ['pymatbridge'] PACKAGE_DATA = {"pymatbridge": ["matlab/matlabserver.m", "matlab/messenger.*", "matlab/usrprog/*", "matlab/util/*.m", + "matlab/util/publish-notebook", "matlab/util/json_v0.2.2/LICENSE", "matlab/util/json_v0.2.2/README.md", "matlab/util/json_v0.2.2/test/*",
Added publish-notebook to installation
arokem_python-matlab-bridge
train
py
d4cbc71b0a1c578340d826a7bfcbf07ec0d763bf
diff --git a/moto/ec2/models.py b/moto/ec2/models.py index <HASH>..<HASH> 100644 --- a/moto/ec2/models.py +++ b/moto/ec2/models.py @@ -1964,7 +1964,7 @@ class ElasticAddress(object): @property def physical_resource_id(self): - return self.allocation_id + return self.allocation_id if self.allocation_id else self.public_ip def get_cfn_attribute(self, attribute_name): from moto.cloudformation.exceptions import UnformattedGetAttTemplateException
fix eip physical_resource_id not returning an public_ip if it is in EC2 classic.
spulec_moto
train
py
866e3ff5dabf0091e4f097dfd42e537e18f6f5b6
diff --git a/bot/action/extra/messages.py b/bot/action/extra/messages.py index <HASH>..<HASH> 100644 --- a/bot/action/extra/messages.py +++ b/bot/action/extra/messages.py @@ -55,7 +55,7 @@ class ListMessageAction(Action): action = args[0] elif len(args) == 2: if args[1].isnumeric() or args[0] == "opt-out": - action_param = int(args[1]) + action_param = int(args[1]) if args[0] != "opt-out" else args[1] action = args[0] return action, action_param, help_args
Add option for users to toggle their opt-out status
alvarogzp_telegram-bot-framework
train
py
5b237d99ef054d6a0ddc68412af1d46a355d13c2
diff --git a/lib/rewire.js b/lib/rewire.js index <HASH>..<HASH> 100644 --- a/lib/rewire.js +++ b/lib/rewire.js @@ -56,7 +56,7 @@ function internalRewire(parentModulePath, targetPath) { // Check if the module uses the strict mode. // If so we must ensure that "use strict"; stays at the beginning of the module. - src = fs.readFileSync(targetPath, "utf8"); + var src = fs.readFileSync(targetPath, "utf8"); if (detectStrictMode(src) === true) { prelude = ' "use strict"; ' + prelude; } diff --git a/test/rewire.test.js b/test/rewire.test.js index <HASH>..<HASH> 100644 --- a/test/rewire.test.js +++ b/test/rewire.test.js @@ -31,4 +31,10 @@ describe("rewire", function () { }); expect(coffeeModule.readFileSync()).to.be("It works!"); }); + it("should keep src variable in function scope", function () { + //expect(src).to.be(undefined); + // detectStrictMode(); + // console.dir(global); + expect(global.src).to.be(undefined); + }); }); \ No newline at end of file
fix leak, add test, for #<I>
jhnns_rewire
train
js,js
97d42130fe599b68d33ee8d6cbd5f3f7eea4463d
diff --git a/app/models/blog.rb b/app/models/blog.rb index <HASH>..<HASH> 100644 --- a/app/models/blog.rb +++ b/app/models/blog.rb @@ -70,7 +70,7 @@ end def config - raise NoMethodError, "config is no longer a global method. If you get this error, please contact Piers Cawley <[email protected]>", caller + this_blog end def this_blog
Making legacy themes work again; I knew there was something I'd missed... git-svn-id: <URL>
publify_publify
train
rb
d9c68afb3f637553f6b25202421a241dd4cc7305
diff --git a/lib/actionkit_connector/version.rb b/lib/actionkit_connector/version.rb index <HASH>..<HASH> 100644 --- a/lib/actionkit_connector/version.rb +++ b/lib/actionkit_connector/version.rb @@ -1,3 +1,3 @@ module ActionkitConnector - VERSION = '0.1.3' + VERSION = '0.1.4' end
Bumping to version <I>
EricBoersma_actionkit_connector
train
rb
26d29e384d79436caee6e769246c3a0b37a69105
diff --git a/rope/refactor/importutils/module_imports.py b/rope/refactor/importutils/module_imports.py index <HASH>..<HASH> 100644 --- a/rope/refactor/importutils/module_imports.py +++ b/rope/refactor/importutils/module_imports.py @@ -37,11 +37,15 @@ class ModuleImports: all_star_list = pymodule.get_attribute("__all__") except exceptions.AttributeNotFoundError: return result + + assignments = getattr(all_star_list, "assignments", None) + if assignments is None: + return result # FIXME: Need a better way to recursively infer possible values. # Currently pyobjects can recursively infer type, but not values. # Do a very basic 1-level value inference - for assignment in all_star_list.assignments: + for assignment in assignments: if isinstance(assignment.ast_node, ast.List): stack = list(assignment.ast_node.elts) while stack:
Check whether assignments attribute exists in all_star_list
python-rope_rope
train
py
c70f84702abba38f45588d41bfa01a3ff2e768c0
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -4,13 +4,11 @@ from __future__ import absolute_import from __future__ import print_function from setuptools import setup -import sys -sys.path.insert(0, '.') -import version +import si_prefix setup(name='si-prefix', - version=version.getVersion(), + version=si_prefix.__version__, description='Functions for formatting numbers according to SI standards.', keywords='si prefix format number precision', author='Christian Fobel',
fix(setup): fix package version lookup
cfobel_si-prefix
train
py
74292c80892d5b0d5a669612f7bfc259cbc5ee6e
diff --git a/storage/serveruserstorage.js b/storage/serveruserstorage.js index <HASH>..<HASH> 100644 --- a/storage/serveruserstorage.js +++ b/storage/serveruserstorage.js @@ -4,10 +4,10 @@ * Author: Tamas Kecskes */ -define([ 'storage/mongo', 'storage/cache', 'storage/log'], function (Mongo,Cache,Log) { +define([ 'storage/mongo', 'storage/cache', 'storage/log', 'storage/commit'], function (Mongo,Cache,Log,Commit) { "use strict"; function server(options){ - return new Log(new Cache(new Mongo(options),options),options); + return new Log(new Commit(new Cache(new Mongo(options),options),options),options); } return server;
storage update - commit layer was missing - Former-commit-id: ff<I>ec<I>fea<I>d<I>a3ce<I>e<I>f2d3ccf
webgme_webgme-engine
train
js
fa067b31c60a035bae61745fbb78f21b4da50b3c
diff --git a/lib/generators/templates/devise.rb b/lib/generators/templates/devise.rb index <HASH>..<HASH> 100755 --- a/lib/generators/templates/devise.rb +++ b/lib/generators/templates/devise.rb @@ -126,8 +126,11 @@ Devise.setup do |config| # A period that the user is allowed to access the website even without # confirming their account. For instance, if set to 2.days, the user will be # able to access the website for two days without confirming their account, - # access will be blocked just in the third day. Default is 0.days, meaning - # the user cannot access the website without confirming their account. + # access will be blocked just in the third day. + # You can also set it to nil, which will allow the user to access the website + # without confirming their account. + # Default is 0.days, meaning the user cannot access the website without + # confirming their account. # config.allow_unconfirmed_access_for = 2.days # A period that the user is allowed to confirm their account before their
chore(docs): allow_unconfirmed_access_for = nil (#<I>) (#<I>)
plataformatec_devise
train
rb
4be63c471feccbe9b9b812ba24315b44a2042ace
diff --git a/spec/ImmutableAssign2Spec.js b/spec/ImmutableAssign2Spec.js index <HASH>..<HASH> 100644 --- a/spec/ImmutableAssign2Spec.js +++ b/spec/ImmutableAssign2Spec.js @@ -41,6 +41,9 @@ } else if (typeof(window) !== "undefined") { console.log("In browser"); + if (window.__coverage__) { + iassign.disableExtraStatementCheck = true; + } } describe("Test 2", function () {
Allow tests to detect if coverage is running, and handle it accordingly.
engineforce_ImmutableAssign
train
js
233dcf3e209b84e6b63182e6277d5e1c604f9de0
diff --git a/core/logging/client.js b/core/logging/client.js index <HASH>..<HASH> 100644 --- a/core/logging/client.js +++ b/core/logging/client.js @@ -21,6 +21,12 @@ var console_log = Function.prototype.bind.call(_console.log, _console); // IE9 also doesn't support color. var monochrome = typeof _console.log == "object"; +// We don't chain our transports in the same way as winston client-side, but +// we'll conform more-or-less to winston's interface for the `log` method for +// consistency's sake. This means passing a function as the fourth argument. +// We'll use a noop. +var noop = () => {}; + var makeLogger = function(group, opts){ var config = common.config[group] @@ -38,7 +44,7 @@ var makeLogger = function(group, opts){ this.transports.forEach(transport => { if (config.levels[level] < config.levels[transport.level]) return; - setTimeout(transport.log.bind(transport, level, msg, meta), 0); + setTimeout(transport.log.bind(transport, level, msg, meta, noop), 0); }); if (config.levels[level] < config.levels[this.level]) return;
More consistent client/server logger transport interface Client now passes noop function for fourth argument.
redfin_react-server
train
js
413f8bef6d460ba3e1ff32a7eb0aa38426c6ae60
diff --git a/src/test/java/org/rythmengine/issue/GhIssueTest.java b/src/test/java/org/rythmengine/issue/GhIssueTest.java index <HASH>..<HASH> 100644 --- a/src/test/java/org/rythmengine/issue/GhIssueTest.java +++ b/src/test/java/org/rythmengine/issue/GhIssueTest.java @@ -368,7 +368,8 @@ public class GhIssueTest extends TestBase { // the test pass in case no exception thrown out t = "gh211/foo.txt"; s = r(t); - System.out.println(s); + if (debug) + System.out.println(s); } @Test
System.out only in debug mode for GhIssueTest to cleanup mvn test results and fixes #<I>
rythmengine_rythmengine
train
java
396764d21d605650f38910439a1c40896c8b0ede
diff --git a/lib/puppet/provider/package/portage.rb b/lib/puppet/provider/package/portage.rb index <HASH>..<HASH> 100644 --- a/lib/puppet/provider/package/portage.rb +++ b/lib/puppet/provider/package/portage.rb @@ -20,9 +20,9 @@ Puppet::Type.type(:package).provide :portage, :parent => Puppet::Provider::Packa end end - confine :operatingsystem => :gentoo + confine :osfamily => :gentoo - defaultfor :operatingsystem => :gentoo + defaultfor :osfamily => :gentoo def self.instances result_format = self.eix_result_format diff --git a/spec/unit/provider/package/portage_spec.rb b/spec/unit/provider/package/portage_spec.rb index <HASH>..<HASH> 100644 --- a/spec/unit/provider/package/portage_spec.rb +++ b/spec/unit/provider/package/portage_spec.rb @@ -72,6 +72,11 @@ describe Puppet::Type.type(:package).provider(:portage) do expect(described_class).to be_reinstallable end + it "should be the default provider on :osfamily => Gentoo" do + expect(Facter).to receive(:value).with(:osfamily).and_return("Gentoo") + expect(described_class.default?).to be_truthy + end + it 'should support string install options' do expect(@provider).to receive(:emerge).with('--foo', '--bar', @resource[:name])
(PUP-<I>) Fix portage package provider confine The original confine against operatingsystem makes the portage provider unusable on other Gentoo-based distributions, if they have a proper operatingsystem name fact. Switching it to confine against osfamily instead will let it be used for all Gentoo-based distributions, regardless of their name.
puppetlabs_puppet
train
rb,rb
39e20a9bc85e8253c3531e31a33c15167d5b74c3
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -2,5 +2,4 @@ from setuptools import setup -if __name__ == "__main__": - setup() +setup()
Remove import guard from setup.py because something somewhere did not handle it properly in the past
cpburnz_python-path-specification
train
py
efddcc3b376457796e90ee71afc92f85565ca806
diff --git a/src/common/DayGrid.limit.js b/src/common/DayGrid.limit.js index <HASH>..<HASH> 100644 --- a/src/common/DayGrid.limit.js +++ b/src/common/DayGrid.limit.js @@ -241,7 +241,7 @@ DayGrid.mixin({ options = { className: 'fc-more-popover', content: this.renderSegPopoverContent(row, col, segs), - parentEl: this.el, + parentEl: this.view.el, // attach to root of view. guarantees outside of scrollbars. top: topEl.offset().top, autoHide: true, // when the user clicks elsewhere, hide the popover viewportConstrain: view.opt('popoverViewportConstrain'), @@ -264,6 +264,10 @@ DayGrid.mixin({ this.segPopover = new Popover(options); this.segPopover.show(); + + // the popover doesn't live within the grid's container element, and thus won't get the event + // delegated-handlers for free. attach event-related handlers to the popover. + this.bindSegHandlersToEl(this.segPopover.el); },
more link popover now displayed outside scroll container
fullcalendar_fullcalendar
train
js
6ec674e1ced1a6a5d4ec9298698a9e9fad45c4e2
diff --git a/lib/node-static.js b/lib/node-static.js index <HASH>..<HASH> 100644 --- a/lib/node-static.js +++ b/lib/node-static.js @@ -158,8 +158,8 @@ this.Server.prototype.resolve = function (pathname) { this.Server.prototype.serve = function (req, res, callback) { var that = this, promise = new(events.EventEmitter); - - var pathname = url.parse(req.url).pathname; + + var pathname = decodeURI(url.parse(req.url).pathname); var finish = function (status, headers) { that.finish(status, headers, req, res, promise, callback);
Fix: International characters (like umlauts) in URLs where not decoded The filename requested was "Summerfäscht.jpg", what encodes to "Summerf <I>X1.D<I>P-<I>scht.jpg". The reconversion was not made in node-static. This lead to a <I> despite the files availability.
cloudhead_node-static
train
js
99dc0a6624b07756cfefbdbc2a5b8434a7782219
diff --git a/src/test/java/com/cloudant/sync/indexing/IndexManagerIndexTest.java b/src/test/java/com/cloudant/sync/indexing/IndexManagerIndexTest.java index <HASH>..<HASH> 100644 --- a/src/test/java/com/cloudant/sync/indexing/IndexManagerIndexTest.java +++ b/src/test/java/com/cloudant/sync/indexing/IndexManagerIndexTest.java @@ -610,7 +610,7 @@ public class IndexManagerIndexTest { public void index_UpdateCrudMultiThreaded() throws IndexExistsException, SQLException, ConflictException, InterruptedException { - int n_threads = 5; + int n_threads = 3; final int n_docs = 100; // We'll later search for search == success
Bring thread count down to 3, to speed up travis builds
cloudant_sync-android
train
java
74b3c4e58cd660b9e8650ce4e652c41c58ea9832
diff --git a/mod/quiz/locallib.php b/mod/quiz/locallib.php index <HASH>..<HASH> 100644 --- a/mod/quiz/locallib.php +++ b/mod/quiz/locallib.php @@ -1837,7 +1837,9 @@ function quiz_process_group_deleted_in_course($courseid) { FROM {quiz_overrides} o JOIN {quiz} quiz ON quiz.id = o.quiz LEFT JOIN {groups} grp ON grp.id = o.groupid - WHERE quiz.course = :courseid AND grp.id IS NULL"; + WHERE quiz.course = :courseid + AND o.groupid IS NOT NULL + AND grp.id IS NULL"; $params = array('courseid' => $courseid); $records = $DB->get_records_sql_menu($sql, $params); if (!$records) {
MDL-<I> mod_quiz: Fixing group deleted handler so it does not remove user overrides.
moodle_moodle
train
php
6152f23c2720682408a5fc44d710fbea35a5696a
diff --git a/atlasclient/models.py b/atlasclient/models.py index <HASH>..<HASH> 100644 --- a/atlasclient/models.py +++ b/atlasclient/models.py @@ -832,6 +832,23 @@ class SearchBasic(base.QueryableModel): 'attributes': AttributeDef, 'fullTextResults': FullTextResult} + def inflate(self): + """Load the resource from the server, if not already loaded.""" + if not self._is_inflated: + if self._is_inflating: + # catch infinite recursion when attempting to inflate + # an object that doesn't have enough data to inflate + msg = ("There is not enough data to inflate this object. " + "Need either an href: {} or a {}: {}") + msg = msg.format(self._href, self.primary_key, self._data.get(self.primary_key)) + raise exceptions.ClientError(msg) + + self._is_inflating = True + self.load(self._data) + self._is_inflated = True + self._is_inflating = False + return self + class SearchDslCollection(base.QueryableModelCollection): def load(self, response):
Inflate the object in case of basic search
jpoullet2000_atlasclient
train
py
92dc19092aca79a1d3f1a368e1c23b01dec0dead
diff --git a/baron/grammator_operators.py b/baron/grammator_operators.py index <HASH>..<HASH> 100644 --- a/baron/grammator_operators.py +++ b/baron/grammator_operators.py @@ -65,13 +65,14 @@ def include_operators(pg): @pg.production("or_test : and_test OR or_test") @pg.production("and_test : not_test AND and_test") def and_or_node((first, operator, second)): - return boolean_operator( - operator.value, - first=first, - second=second, - first_space=operator.before_space, - second_space=operator.after_space, - ) + return { + "type": "boolean_operator", + "value": operator.value, + "first": first, + "second": second, + "first_space": operator.before_space, + "second_space": operator.after_space, + } @pg.production("not_test : NOT not_test")
[mod] continue refactoring
PyCQA_baron
train
py
953be018ab64df740e2554f4f66440257b80a698
diff --git a/blueprints/ember-cli-blanket/index.js b/blueprints/ember-cli-blanket/index.js index <HASH>..<HASH> 100644 --- a/blueprints/ember-cli-blanket/index.js +++ b/blueprints/ember-cli-blanket/index.js @@ -28,6 +28,15 @@ module.exports = { ); }.bind(this)) + // modify the blanket reporter styles so it's not covered by the ember testing container + .then(function() { + return this.insertIntoFile( + 'tests/index.html', + ' <style>#blanket-main { position: relative; z-index: 99999; }</style>', + { after: '<link rel="stylesheet" href="assets/test-support.css">' + EOL } + ); + }.bind(this)) + .then(function() { var fullPath = path.join(this.project.root, 'tests/blanket-options.js');
Add styles to place blanket reporting div above ember testing container Prior to this commit, the blanket reports were obscured by the ember testing container. This commit adds styles to the host application's test/index.html that raises the blanket report div above the ember testing container so all the blanket reports can be read.
sglanzer_ember-cli-blanket
train
js
941be04948db1fc5d5727c91f48e23a84a9fb88f
diff --git a/test/models/artefact_test.rb b/test/models/artefact_test.rb index <HASH>..<HASH> 100644 --- a/test/models/artefact_test.rb +++ b/test/models/artefact_test.rb @@ -167,4 +167,15 @@ class ArtefactTest < ActiveSupport::TestCase assert_equal true, artefact.attributes.include?("specialist_body") assert_equal "Something wicked this way comes", artefact.specialist_body end + + test "should have 'video' as a supported FORMAT" do + assert_equal true, Artefact::FORMATS.include?("video") + end + + test "should allow creation of artefacts with 'video' as the kind" do + artefact = Artefact.create!(slug: "omlette-du-fromage", name: "Omlette du fromage", kind: "video", owning_app: "Dexter's Lab") + + assert_equal false, artefact.nil? + assert_equal "video", artefact.kind + end end
Test that artefacts of kind 'video' can be created The process of creating an Artefact with a specific 'kind' requires it to be one of the supported FORMATS. Test that 'video' is a supported format.
alphagov_govuk_content_models
train
rb
22dfb34adac946fcf373a096bb9da98be523bf87
diff --git a/pkg/tlscert/tlscert.go b/pkg/tlscert/tlscert.go index <HASH>..<HASH> 100644 --- a/pkg/tlscert/tlscert.go +++ b/pkg/tlscert/tlscert.go @@ -11,7 +11,7 @@ type Cert struct { Cert string `json:"cert"` Pin string `json:"pin"` - PrivateKey string `json:"-"` + PrivateKey string `json:"key"` } func (c *Cert) String() string {
pkg/tlscert: don't discard PrivateKey when serializing as json
flynn_flynn
train
go
a9938457db3e3b6c4baf6608560f99336a4c2866
diff --git a/fmts/doc.go b/fmts/doc.go index <HASH>..<HASH> 100644 --- a/fmts/doc.go +++ b/fmts/doc.go @@ -44,6 +44,7 @@ // black A uncompromising Python code formatter - https://github.com/psf/black // flake8 Tool for python style guide enforcement - https://flake8.pycqa.org/ // isort A Python utility / library to sort Python imports - https://github.com/PyCQA/isort +// mypy An optional static type checker for Python - http://mypy-lang.org/ // pep8 Python style guide checker - https://pypi.python.org/pypi/pep8 // ruby // brakeman (brakeman --quiet --format tabs) A static analysis security vulnerability scanner for Ruby on Rails applications - https://github.com/presidentbeef/brakeman
feat(docs): update documentation for Python mypy ... by using `go generate ./...`
reviewdog_errorformat
train
go
c3e6633b675def1cca7f86e434e759018473c378
diff --git a/src/utils/DayEventLayout.js b/src/utils/DayEventLayout.js index <HASH>..<HASH> 100644 --- a/src/utils/DayEventLayout.js +++ b/src/utils/DayEventLayout.js @@ -143,7 +143,9 @@ function getStyledEvents({ events, ...props }) { const event = eventsInRenderOrder[i] // Check if this event can go into a container event. - const container = containerEvents.find(c => c.end > event.start) + const container = containerEvents.find( + c => c.end > event.start || Math.abs(event.start - c.start) < 30 + ) // Couldn't find a container — that means this event is a container. if (!container) {
fix dates collisions (#<I>) * fix dates collisions * fix check if event can go into container
intljusticemission_react-big-calendar
train
js
46ae7e87c7cba397677e6d2a2d1e59c4eff03bdf
diff --git a/pkg/proxy/userspace/proxier_test.go b/pkg/proxy/userspace/proxier_test.go index <HASH>..<HASH> 100644 --- a/pkg/proxy/userspace/proxier_test.go +++ b/pkg/proxy/userspace/proxier_test.go @@ -200,12 +200,12 @@ func testEchoUDP(t *testing.T, address string, port int) { func waitForNumProxyLoops(t *testing.T, p *Proxier, want int32) { var got int32 - for i := 0; i < 4; i++ { + for i := 0; i < 600; i++ { got = atomic.LoadInt32(&p.numProxyLoops) if got == want { return } - time.Sleep(500 * time.Millisecond) + time.Sleep(100 * time.Millisecond) } t.Errorf("expected %d ProxyLoops running, got %d", want, got) }
Increase timeout to fix flaky tests
kubernetes_kubernetes
train
go
56170813fe1d0473004786ffc1f5c26b64ee4518
diff --git a/context.go b/context.go index <HASH>..<HASH> 100644 --- a/context.go +++ b/context.go @@ -286,6 +286,7 @@ func (c *context) Apply(resource Resource) error { return err } + var chmod = true var exists bool if _, err := c.driver.Lstat(fp); err != nil { if !os.IsNotExist(err) { @@ -346,14 +347,16 @@ func (c *context) Apply(resource Resource) error { if err := c.driver.Symlink(target, fp); err != nil { return err } - if err := c.driver.Lchmod(fp, resource.Mode()); err != nil { - return err - } + // Not supported on linux, skip chmod on links + //if err := c.driver.Lchmod(fp, resource.Mode()); err != nil { + // return err + //} } + chmod = false } // Update filemode if file was not created - if exists { + if chmod && exists { if err := c.driver.Lchmod(fp, resource.Mode()); err != nil { return err }
Skip chmod on symlinks No follow for chmod on symlinks is currently not implemented in the linux kernel. Skip to prevent unintended chmod on targets.
containerd_continuity
train
go
e072dc8842d0ce2957eea5cda9a84960dd6d05b6
diff --git a/index.js b/index.js index <HASH>..<HASH> 100644 --- a/index.js +++ b/index.js @@ -179,7 +179,7 @@ function oneOra(str, options) { */ function loggerStart(...args) { let options = args[args.length - 1] - args = args.slice(0,args.length-1) + args = args.slice(0,args.length-1 || 1) let { ora, log,
fix: 🐛 two-log:start args length >= 1
chinanf-boy_two-log-min
train
js
fb62194f64259bdc805168df4efdb33779b7ce4a
diff --git a/ryu/app/rest_router.py b/ryu/app/rest_router.py index <HASH>..<HASH> 100644 --- a/ryu/app/rest_router.py +++ b/ryu/app/rest_router.py @@ -1628,12 +1628,12 @@ class OfCtl_v1_0(OfCtl): v = (32 - src_mask) << ofp.OFPFW_NW_SRC_SHIFT | \ ~ofp.OFPFW_NW_SRC_MASK wildcards &= v - nw_src = ipv4_text_to_int(nw_src), + nw_src = ipv4_text_to_int(nw_src) if nw_dst: v = (32 - dst_mask) << ofp.OFPFW_NW_DST_SHIFT | \ ~ofp.OFPFW_NW_DST_MASK wildcards &= v - nw_dst = ipv4_text_to_int(nw_dst), + nw_dst = ipv4_text_to_int(nw_dst) if nw_proto: wildcards &= ~ofp.OFPFW_NW_PROTO
rest_router: bug fix of match parameter It was regarded as the list because of the unnecessary comma.
osrg_ryu
train
py
db91daca51cd9ef256129698294423ca8225a19e
diff --git a/ca/ca/test_settings.py b/ca/ca/test_settings.py index <HASH>..<HASH> 100644 --- a/ca/ca/test_settings.py +++ b/ca/ca/test_settings.py @@ -33,7 +33,11 @@ DATABASES = { # Hosts/domain names that are valid for this site; required if DEBUG is False # See https://docs.djangoproject.com/en/1.5/ref/settings/#allowed-hosts -ALLOWED_HOSTS = [] +# NOTE: 'testserver' is always added by Django itself +ALLOWED_HOSTS = [ + 'localhost', + 'example.com', +] # Local time zone for this installation. Choices can be found here: # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
add localhost and example.com to allowed hosts
mathiasertl_django-ca
train
py
c68f1024771fe6fe48f8475ab98881834317aeca
diff --git a/sumo/cli/dosplot.py b/sumo/cli/dosplot.py index <HASH>..<HASH> 100644 --- a/sumo/cli/dosplot.py +++ b/sumo/cli/dosplot.py @@ -196,8 +196,12 @@ def dosplot(filename=None, code='vasp', prefix=None, directory=None, # If not, we cannot plot the PDOS if pdos_file is not None: if cell_file is None: - warnings.warn("Plotting PDOS requires the cell file to be present. Falling back to TDOS.") + logging.info("Plotting PDOS requires the cell file to be present, falling back to TDOS.") pdos_file = None + else: + logging.info(f"Found PDOS binary file {pdos_file}, including PDOS in the plot.") + else: + logging.info("PDOS not available, falling back to TDOS.") dos, pdos = sumo.io.castep.read_dos(bands_file, pdos_file=pdos_file, cell_file=cell_file,
Added verbose information about PDOS availability
SMTG-UCL_sumo
train
py
36201f3b8bc5257b4aa8f1899f07dee00774e1aa
diff --git a/src/Cellmap.php b/src/Cellmap.php index <HASH>..<HASH> 100644 --- a/src/Cellmap.php +++ b/src/Cellmap.php @@ -574,7 +574,7 @@ class Cellmap $this->_frames[$key]["rows"] = range($start_row, max(0, $this->__row - 1)); $this->_frames[$key]["frame"] = $frame; - if ($display !== "table-row" && $collapse) { + if ($collapse) { $bp = $style->get_border_properties(); // Resolve vertical borders
Resolve table-row borders with collapsed table borders Fixes #<I>
dompdf_dompdf
train
php
4dc79e061de4a2f01d641e58f18ea448b01ec97b
diff --git a/lib/sippy_cup/runner.rb b/lib/sippy_cup/runner.rb index <HASH>..<HASH> 100644 --- a/lib/sippy_cup/runner.rb +++ b/lib/sippy_cup/runner.rb @@ -1,9 +1,10 @@ require 'yaml' +require 'active_support/core_ext/hash' module SippyCup class Runner def initialize(opts = {}) - @options = opts + @options = ActiveSupport::HashWithIndifferentAccess.new opts end def prepare_command
Allow simpler syntax in YAML (no need for leading colons)
mojolingo_sippy_cup
train
rb
8014d39cf036548571952df0c257f5ee42bcabb8
diff --git a/lib/resourceful/serialize.rb b/lib/resourceful/serialize.rb index <HASH>..<HASH> 100644 --- a/lib/resourceful/serialize.rb +++ b/lib/resourceful/serialize.rb @@ -177,5 +177,9 @@ module Resourceful end end -class ActiveRecord::Base; include Resourceful::Serialize::Model; end +if defined? ActiveModel + class ActiveModel::Base; include Resourceful::Serialize::Model; end +else + class ActiveRecord::Base; include Resourceful::Serialize::Model; end +end class Array; include Resourceful::Serialize::Array; end
Rails3: Include either into ActiveModel or ActiveRecord
hcatlin_make_resourceful
train
rb
9a5a62c719d99a89e8f85dd1207e4b2f16c015b0
diff --git a/registry/quilt_server/views.py b/registry/quilt_server/views.py index <HASH>..<HASH> 100644 --- a/registry/quilt_server/views.py +++ b/registry/quilt_server/views.py @@ -1552,6 +1552,7 @@ def profile(): ), plan=plan, have_credit_card=have_cc, + is_admin=g.auth.is_admin, ) @app.route('/api/payments/update_plan', methods=['POST'])
Return is_admin from /profile (#<I>)
quiltdata_quilt
train
py
59b78b67eb2b48c53c3334e563eac2c4f5ce0d91
diff --git a/mavproxy.py b/mavproxy.py index <HASH>..<HASH> 100755 --- a/mavproxy.py +++ b/mavproxy.py @@ -1342,9 +1342,10 @@ def set_stream_rates(): rate = mpstate.settings.streamrate else: rate = mpstate.settings.streamrate2 - master.mav.request_data_stream_send(mpstate.status.target_system, mpstate.status.target_component, - mavutil.mavlink.MAV_DATA_STREAM_ALL, - rate, 1) + if rate != -1: + master.mav.request_data_stream_send(mpstate.status.target_system, mpstate.status.target_component, + mavutil.mavlink.MAV_DATA_STREAM_ALL, + rate, 1) def check_link_status(): '''check status of master links'''
use streamrate of -1 to mean to not set stream rates
ArduPilot_MAVProxy
train
py
6004daa7270ff7020b0c769f06a1eff3d429937a
diff --git a/test/build/yield_handlers.js b/test/build/yield_handlers.js index <HASH>..<HASH> 100644 --- a/test/build/yield_handlers.js +++ b/test/build/yield_handlers.js @@ -189,5 +189,7 @@ describe( 'yield with custom handler', function() { return ref.apply( this, arguments ); }; })(); + + return test6(); } ); } ); diff --git a/test/src/yield_handlers.js b/test/src/yield_handlers.js index <HASH>..<HASH> 100644 --- a/test/src/yield_handlers.js +++ b/test/src/yield_handlers.js @@ -128,6 +128,8 @@ describe( 'yield with custom handler', function() { } catch( err ) { assert( false ); } - } + }; + + return test6(); } ) } );
tests: Fix test not being executed.
novacrazy_bluebird-co
train
js,js
52c780dc9b98197c1e4f8a19db8265d3a1451563
diff --git a/docker-gen.go b/docker-gen.go index <HASH>..<HASH> 100644 --- a/docker-gen.go +++ b/docker-gen.go @@ -61,6 +61,7 @@ type RuntimeContainer struct { Addresses []Address Gateway string Name string + Hostname string Image DockerImage Env map[string]string Volumes map[string]Volume diff --git a/docker_client.go b/docker_client.go index <HASH>..<HASH> 100644 --- a/docker_client.go +++ b/docker_client.go @@ -121,6 +121,7 @@ func getContainers(client *docker.Client) ([]*RuntimeContainer, error) { Tag: tag, }, Name: strings.TrimLeft(container.Name, "/"), + Hostname: container.Config.Hostname, Gateway: container.NetworkSettings.Gateway, Addresses: []Address{}, Env: make(map[string]string),
added container hostname to RuntimeContainer struct
jwilder_docker-gen
train
go,go
1dea7d3086b8d9200aa48d051420bcf8c51dbe98
diff --git a/sos/plugins/apport.py b/sos/plugins/apport.py index <HASH>..<HASH> 100644 --- a/sos/plugins/apport.py +++ b/sos/plugins/apport.py @@ -24,6 +24,14 @@ class Apport(Plugin, DebianPlugin, UbuntuPlugin): profiles = ('debug',) def setup(self): + if not self.get_option("all_logs"): + limit = self.get_option("log_size") + self.add_copy_spec_limit("/var/log/apport.log", + sizelimit=limit) + self.add_copy_spec_limit("/var/log/apport.log.1", + sizelimit=limit) + else: + self.add_copy_spec("/var/log/apport*") self.add_copy_spec("/etc/apport/*") self.add_copy_spec("/var/lib/whoopsie/whoopsie-id") self.add_cmd_output( diff --git a/sos/plugins/logs.py b/sos/plugins/logs.py index <HASH>..<HASH> 100644 --- a/sos/plugins/logs.py +++ b/sos/plugins/logs.py @@ -86,8 +86,7 @@ class DebianLogs(Logs, DebianPlugin, UbuntuPlugin): "/var/log/mail*", "/var/log/dist-upgrade", "/var/log/installer", - "/var/log/unattended-upgrades", - "/var/log/apport.log" + "/var/log/unattended-upgrades" ])
[apport] Move apport logging to apport plugin Apport logging was in the logs plugin previously. Also added "all logs" support so it could collect more than it previously did.
sosreport_sos
train
py,py
cb01fa18c8d42605489deda0d16881b42246c6c4
diff --git a/mode/sql/sql.js b/mode/sql/sql.js index <HASH>..<HASH> 100644 --- a/mode/sql/sql.js +++ b/mode/sql/sql.js @@ -193,7 +193,7 @@ CodeMirror.defineMode("sql", function(config, parserConfig) { blockCommentStart: "/*", blockCommentEnd: "*/", - lineComment: support.commentSlashSlash ? "//" : support.commentHash ? "#" : null + lineComment: support.commentSlashSlash ? "//" : support.commentHash ? "#" : "--" }; });
[sql mode] Set lineComment to "--" when no other style is used
codemirror_CodeMirror
train
js
9520ee2b7954fc7fd6c8fbe2566c868706aaa4a1
diff --git a/lib/fasten/runner.rb b/lib/fasten/runner.rb index <HASH>..<HASH> 100644 --- a/lib/fasten/runner.rb +++ b/lib/fasten/runner.rb @@ -31,7 +31,7 @@ module Fasten def reconfigure(**options) self.stats = options[:name] && true if options[:name] || options.key?(:stats) - self.name = options[:name] || "#{self.class} #{$PID}" if options.key?(:name) + self.name = options[:name] || "#{self.class.to_s.gsub('::', '-')}-#{$PID}" if options.key?(:name) self.workers = options[:workers] if options.key?(:workers) self.worker_class = options[:worker_class] if options.key?(:worker_class) self.fasten_dir = options[:fasten_dir] if options.key?(:fasten_dir) @@ -225,7 +225,7 @@ module Fasten unless worker @worker_id = (@worker_id || 0) + 1 - worker = worker_class.new runner: self, name: "#{worker_class}-#{format '%02X', @worker_id}", use_threads: use_threads + worker = worker_class.new runner: self, name: "#{worker_class.to_s.gsub('::', '-')}-#{format '%02X', @worker_id}", use_threads: use_threads worker.start worker_list << worker
Replace :: to - in worker and runner names.
a0_a0-fasten-ruby
train
rb
3e8527ae8dd45af2ab62c225b21a57881c65fa62
diff --git a/pyethereum/blockfetcherpatch.py b/pyethereum/blockfetcherpatch.py index <HASH>..<HASH> 100644 --- a/pyethereum/blockfetcherpatch.py +++ b/pyethereum/blockfetcherpatch.py @@ -8,7 +8,7 @@ configure to connect to one peer, no mine """ print('IMPORTED BLOCKFETCHERPATCH') -fn = 'blocks.poc7.p46.hexdata' +fn = 'tests/raw_remote_blocks_hex.txt' import pyethereum.config
blockfetcher write to tests/
ethereum_pyethereum
train
py
fef2305bd18bea320133d9ac73494e9939124a39
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index <HASH>..<HASH> 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -7,7 +7,7 @@ require 'mongoid/tree' require 'rspec' Mongoid.configure do |config| - config.connect_to('mongoid_test') + config.connect_to('mongoid_tree_test') end Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
Fixes naming of test database
benedikt_mongoid-tree
train
rb
804ecd5125d94f94d9ac829e82e512597ca161e4
diff --git a/src/main/java/org/xbill/DNS/lookup/RedirectOverflowException.java b/src/main/java/org/xbill/DNS/lookup/RedirectOverflowException.java index <HASH>..<HASH> 100644 --- a/src/main/java/org/xbill/DNS/lookup/RedirectOverflowException.java +++ b/src/main/java/org/xbill/DNS/lookup/RedirectOverflowException.java @@ -1,18 +1,24 @@ // SPDX-License-Identifier: BSD-2-Clause package org.xbill.DNS.lookup; +import lombok.Getter; + /** * Thrown if the lookup results in too many CNAME and/or DNAME indirections. This would be the case * for example if two CNAME records point to each other. */ public class RedirectOverflowException extends LookupFailedException { - /** @deprecated do not use, this class is meant for internal dnsjava usage only. */ + @Getter private final int maxRedirects; + + /** @deprecated Use {@link RedirectOverflowException#RedirectOverflowException(int)}. */ @Deprecated public RedirectOverflowException(String message) { super(message); + maxRedirects = 0; } - RedirectOverflowException(int maxRedirects) { + public RedirectOverflowException(int maxRedirects) { super("Refusing to follow more than " + maxRedirects + " redirects"); + this.maxRedirects = maxRedirects; } }
Make constructor public for unit testing by library users
dnsjava_dnsjava
train
java
8f1ba01e755f0f39d99f12900c431b1235e5b7f3
diff --git a/lib/cluster/services/cluster/backends/native.js b/lib/cluster/services/cluster/backends/native.js index <HASH>..<HASH> 100644 --- a/lib/cluster/services/cluster/backends/native.js +++ b/lib/cluster/services/cluster/backends/native.js @@ -645,7 +645,13 @@ module.exports = function module(context, messaging, executionService) { Promise.all(nodeQueries) .then((results) => { clearTimeout(timer); - resolve(results.map(formatResponse)); + const formatedData = results.map(formatResponse); + const sortedData = _.sortBy(formatedData, ['name', 'started']); + const reversedData = sortedData.reduce((prev, curr) => { + prev.push(curr); + return prev; + }, []); + resolve(reversedData); }) .catch(err => reject({ message: parseError(err), code: 500 }));
sorts by job name resolves #<I> (#<I>)
terascope_teraslice
train
js
aa318c82a2ad462bb37300534017dfd114d4b809
diff --git a/drivers/overlay/overlay.go b/drivers/overlay/overlay.go index <HASH>..<HASH> 100644 --- a/drivers/overlay/overlay.go +++ b/drivers/overlay/overlay.go @@ -142,16 +142,18 @@ func Init(home string, options []string, uidMaps, gidMaps []idtools.IDMap) (grap return nil, err } - supportsDType, err := supportsOverlay(home, fsMagic, rootUID, rootGID) - if err != nil { - return nil, errors.Wrap(graphdriver.ErrNotSupported, "kernel does not support overlay fs") - } - // Create the driver home dir if err := idtools.MkdirAllAs(path.Join(home, linkDir), 0700, rootUID, rootGID); err != nil && !os.IsExist(err) { return nil, err } + supportsDType, err := supportsOverlay(home, fsMagic, rootUID, rootGID) + if err != nil { + os.Remove(filepath.Join(home, linkDir)) + os.Remove(home) + return nil, errors.Wrap(graphdriver.ErrNotSupported, "kernel does not support overlay fs") + } + if err := mount.MakePrivate(home); err != nil { return nil, err }
overlay: perform the support check after creating homedir The supports-dtype check tries to create a subdirectory of the driver's home directory to use for its checks, so it needs to be called after that directory has been created. If it fails, go ahead and try to rmdir() the directories that we've created to avoid creating a false positive indicator that this driver works, but let the attempt to remove them fail in case we've had previous successful startups and there's actually data here.
containers_storage
train
go
838c104bf00414d6986431ec917a52a39ba4c8e3
diff --git a/src/index.js b/src/index.js index <HASH>..<HASH> 100644 --- a/src/index.js +++ b/src/index.js @@ -537,7 +537,6 @@ export default class Matic { async _fillOptions(options, txObject, web3) { // delete chain id delete txObject.chainId - const gas = !web3.matic ? await web3.eth.getGasPrice() : 0 const from = options.from || this.walletAddress if (!from) { throw new Error( @@ -549,7 +548,8 @@ export default class Matic { !(options.gasLimit || options.gas) ? await txObject.estimateGas({ from, value: options.value }) : options.gasLimit || options.gas, - !options.gasPrice ? gas : options.gasPrice, + // NOTE: Gas Price is set to '0', take care of type of gasPrice on web3^1.0.0-beta.36 + !options.gasPrice ? !web3.matic ? await web3.eth.getGasPrice() : '0' : options.gasPrice, !options.nonce ? await web3.eth.getTransactionCount(from, 'pending') : options.nonce,
fix 0 gas price on matic
maticnetwork_matic.js
train
js
a446879579ad7f5e92cf61dd0a533623fd3c4077
diff --git a/lib/strava/api/v3/athlete.rb b/lib/strava/api/v3/athlete.rb index <HASH>..<HASH> 100644 --- a/lib/strava/api/v3/athlete.rb +++ b/lib/strava/api/v3/athlete.rb @@ -88,6 +88,7 @@ module Strava::Api::V3 # # @return segment effort json array (http://strava.github.io/api/v3/athlete/#stats) def totals_and_stats(id, args = {}, options = {}, &block) + api_call("athletes/#{id}/stats", args, "get", options, &block) end end end
readd totals_and_stats
jaredholdcroft_strava-api-v3
train
rb
5b04ac5de2704bfc803119e4c1c91ad0a1a6663d
diff --git a/src/PHPUnitHelper.php b/src/PHPUnitHelper.php index <HASH>..<HASH> 100644 --- a/src/PHPUnitHelper.php +++ b/src/PHPUnitHelper.php @@ -119,7 +119,7 @@ trait PHPUnitHelper $this->testingResource->$addMethod($mock); } } else { - if ($accessor->isReadable($this->getTestingResource(), $property)) { + if ($accessor->isWritable($this->getTestingResource(), $property)) { $accessor->setValue($this->testingResource, $property, $value); } }
Use `PropertyAccessor::isWritable()` to check if an expected value can be binded to the testing resource. Use `Symfony\Component\PropertyAccess\PropertyAccessor::isWritable()` instead of `PropertyAccessor::isReadable()` to avoid errors in binding expected values to the testing resource.
SerendipityHQ_SHQ_PHPUnit_Helper
train
php
9aa554734f10da2107da0a422c00b8b02120df54
diff --git a/lib/hobby/app.rb b/lib/hobby/app.rb index <HASH>..<HASH> 100644 --- a/lib/hobby/app.rb +++ b/lib/hobby/app.rb @@ -42,15 +42,11 @@ module Hobby @request = Request.new @env @response = Response.new - catch(:halt) { route_eval } + route_eval end private - def halt response - throw :halt, response - end - def route_eval route = self.class.router.route_for request diff --git a/test/test_app.rb b/test/test_app.rb index <HASH>..<HASH> 100644 --- a/test/test_app.rb +++ b/test/test_app.rb @@ -123,11 +123,11 @@ describe Hobby::App do mock_app do get '/halt' do response.status = 501 - halt response.finish end get '/halt_finished' do - halt [404, {}, ['Not found']] + response.status = 404 + 'Not found' end end end
Do not interrupt control flow with halting
ch1c0t_hobby
train
rb,rb
b2082715c526ef1764ec069f964e180814f6b28f
diff --git a/lib/scraped/html.rb b/lib/scraped/html.rb index <HASH>..<HASH> 100644 --- a/lib/scraped/html.rb +++ b/lib/scraped/html.rb @@ -1,5 +1,7 @@ class Scraped class HTML < Scraped + private + def noko @noko ||= Nokogiri::HTML(response.body) end
Make Scraped::HTML#noko method private It's not necessary for this method to be public as it's used internally by the `field` definitions.
everypolitician_scraped
train
rb
115b7728480f5a05769b84f8c9c505f56710ed31
diff --git a/sc2maptool/mapRecord.py b/sc2maptool/mapRecord.py index <HASH>..<HASH> 100644 --- a/sc2maptool/mapRecord.py +++ b/sc2maptool/mapRecord.py @@ -9,7 +9,7 @@ def standardizeMapName(mapName): newName = os.path.basename(mapName) newName = newName.split(".")[0] newName = newName.split("(")[0] - newName = re.sub("[LTE]+$", "", newName) + newName = re.sub("[LT]E+$", "", newName) return re.sub(' ', '', newName, flags=re.UNICODE)
- fixed regex to ensure map name isn't artificially truncated (e.g. for BackSite2E)
ttinies_sc2gameMapRepo
train
py
3ac9727e0624087b17d9917da40d767931ee82c8
diff --git a/lib/phonelib/version.rb b/lib/phonelib/version.rb index <HASH>..<HASH> 100644 --- a/lib/phonelib/version.rb +++ b/lib/phonelib/version.rb @@ -1,4 +1,4 @@ module Phonelib # :nodoc: - VERSION = "0.0.1" + VERSION = "0.0.2" end
bumped version with fixed rdoc
daddyz_phonelib
train
rb
e8edc0147dbc3af7f453ff9e59533b14467797a0
diff --git a/app/controllers/simple_resource/base_controller.rb b/app/controllers/simple_resource/base_controller.rb index <HASH>..<HASH> 100644 --- a/app/controllers/simple_resource/base_controller.rb +++ b/app/controllers/simple_resource/base_controller.rb @@ -11,6 +11,10 @@ module SimpleResource end end end + + if defined?(Devise) + before_filter :authenticate_user! + end inherit_resources defaults route_prefix: "" diff --git a/app/controllers/simple_resource/user_controller.rb b/app/controllers/simple_resource/user_controller.rb index <HASH>..<HASH> 100644 --- a/app/controllers/simple_resource/user_controller.rb +++ b/app/controllers/simple_resource/user_controller.rb @@ -1,9 +1,5 @@ module SimpleResource class UserController < SimpleResource::BaseController - if defined?(Devise) - before_filter :authenticate_user! - end - protected def begin_of_association_chain
Move before_filter :authenticate_user! to BaseController
jarijokinen_simple_resource
train
rb,rb
11f22a280884ced9c33f928cf3ca5764b802c446
diff --git a/src/BeanstalkPool.php b/src/BeanstalkPool.php index <HASH>..<HASH> 100644 --- a/src/BeanstalkPool.php +++ b/src/BeanstalkPool.php @@ -302,18 +302,16 @@ class BeanstalkPool implements BeanstalkInterface continue; } - switch (true) { - case in_array($name, $list): - if ($cumulative[$name] != $value) { - $cumulative[$name] .= ',' . $value; - } - break; - case in_array($name, $maximum): - if ($value > $cumulative[$name]) { - $cumulative[$name] = $value; - } - default: - $cumulative[$name] += $value; + if (in_array($name, $list)) { + if ($cumulative[$name] != $value) { + $cumulative[$name] .= ',' . $value; + } + } elseif (in_array($name, $maximum)) { + if ($value > $cumulative[$name]) { + $cumulative[$name] = $value; + } + } else { + $cumulative[$name] += $value; } } return $cumulative;
Changed switch to be an if Decided series of if statements was marginally better than the switch. There must be a better way of dealing with this.
phlib_beanstalk
train
php
f316d188f9639eebbe7b8254a857c9b1a0729897
diff --git a/ConditionGenerator.php b/ConditionGenerator.php index <HASH>..<HASH> 100644 --- a/ConditionGenerator.php +++ b/ConditionGenerator.php @@ -62,7 +62,7 @@ interface ConditionGenerator * @throws UnknownFieldException When the field is not registered in the fieldset * @throws BadMethodCallException When the where-clause is already generated * - * @return $this + * @return static */ public function setField(string $fieldName, string $column, string $alias = null, string $type = 'string'); diff --git a/Tests/SchemaRecord.php b/Tests/SchemaRecord.php index <HASH>..<HASH> 100644 --- a/Tests/SchemaRecord.php +++ b/Tests/SchemaRecord.php @@ -65,7 +65,7 @@ final class SchemaRecord /** * Semantic method for chaining. * - * @return $this + * @return static */ public function end() { @@ -75,7 +75,7 @@ final class SchemaRecord /** * Semantic method for chaining. * - * @return $this + * @return static */ public function records() {
Fix PhpStan errors and minor CS
rollerworks_search-doctrine-dbal
train
php,php
907818af8f9d5345997fea3f2bb79622a94fd0a0
diff --git a/eli5/sklearn/unhashing.py b/eli5/sklearn/unhashing.py index <HASH>..<HASH> 100644 --- a/eli5/sklearn/unhashing.py +++ b/eli5/sklearn/unhashing.py @@ -308,13 +308,7 @@ def _fit_invhashing_union(vec_union, docs): # type: (FeatureUnion, Any) -> FeatureUnion """ Fit InvertableHashingVectorizer on doc inside a FeatureUnion. """ - transformer_list = [] - for vec_name, vec in vec_union.transformer_list: - if isinstance(vec, HashingVectorizer): - vec = InvertableHashingVectorizer(vec) - vec.fit(docs) - transformer_list.append((vec_name, vec)) return FeatureUnion( - transformer_list, + [(name, invert_and_fit(v, docs)) for name, v in vec_union.transformer_list], transformer_weights=vec_union.transformer_weights, n_jobs=vec_union.n_jobs)
Simplify code, handle recursive case
TeamHG-Memex_eli5
train
py
b6ede82b5aeaed3320054c14c7b0c391c708f390
diff --git a/lib/puppet/application/lookup.rb b/lib/puppet/application/lookup.rb index <HASH>..<HASH> 100644 --- a/lib/puppet/application/lookup.rb +++ b/lib/puppet/application/lookup.rb @@ -57,7 +57,6 @@ class Puppet::Application::Lookup < Puppet::Application options[:node] = arg end - # not yet supported option('--facts FACT_FILE') do |arg| if %w{.yaml .yml .json}.include?(arg.match(/\.[^.]*$/)[0]) options[:fact_file] = arg @@ -331,6 +330,18 @@ Copyright (c) 2015 Puppet Labs, LLC Licensed under the Apache 2.0 License end node = Puppet::Node.indirection.find(node) unless node.is_a?(Puppet::Node) # to allow unit tests to pass a node instance + + if options[:fact_file] + original_facts = node.facts.values + if options[:fact_file].match(/.*\.json/) + given_facts = JSON.parse(File.read(options[:fact_file])) + else + given_facts = YAML.load(File.read(options[:fact_file])) + end + + node.facts.values = original_facts.merge(given_facts) + end + compiler = Puppet::Parser::Compiler.new(node) compiler.compile { |catalog| yield(compiler.topscope); catalog } end
(PUP-<I>) Allow users to override facts Add support for the --facts flag in puppet lookup. This allows the user to give a .json or .yaml file full of fact names and values via the --facts flag. The facts the user specified will be merged with the existing facts for the current node. This means that if a fact is specified in the file it's value will be overridden, but if it is not specified, the original fact value for the node will stay the same.
puppetlabs_puppet
train
rb
9de39f89494998e4a961b3ce92cc3ff3d28cbdb9
diff --git a/src/CSSUtils.js b/src/CSSUtils.js index <HASH>..<HASH> 100644 --- a/src/CSSUtils.js +++ b/src/CSSUtils.js @@ -154,10 +154,15 @@ define(function (require, exports, module) { selector = "(^|\\s)" + selector; } - var re = new RegExp(selector + "(\\[[^\\]]*\\]|:{1,2}[\\w-]+|\\.[\\w-]+)*\\s*$", classOrIdSelector ? "" : "i"); + var re = new RegExp(selector + "(\\[[^\\]]*\\]|:{1,2}[\\w-]+|\\.[\\w-]+|#[\\w-]+)*\\s*$", classOrIdSelector ? "" : "i"); for (i = 0; i < allSelectors.length; i++) { if (allSelectors[i].selector.search(re) !== -1) { result.push(allSelectors[i]); + } else if (!classOrIdSelector) { + // Special case for tag selectors - match "*" + if (allSelectors[i].selector.trim() === "*") { + result.push(allSelectors[i]); + } } }
Add support for *, and trailing id selector
adobe_brackets
train
js
4237021bc736ba6eaa0f2d21cd582cf4fa193d0b
diff --git a/lib/svtplay_dl/service/svtplay.py b/lib/svtplay_dl/service/svtplay.py index <HASH>..<HASH> 100644 --- a/lib/svtplay_dl/service/svtplay.py +++ b/lib/svtplay_dl/service/svtplay.py @@ -64,7 +64,7 @@ class Svtplay(Service, OpenGraphThumbMixin): if "subtitleReferences" in data: for i in data["subtitleReferences"]: - if i["format"] == "wsrt": + if i["format"] == "websrt": yield subtitle(copy.copy(self.options), "wrst", i["url"]) if old and dataj["video"]["subtitleReferences"]: try:
svtplay: it should be websrt and not wsrt
spaam_svtplay-dl
train
py
725703204210073e0a7e0aded1a018f665a08b0e
diff --git a/httpdlog/httpdlog-inputformat/src/main/java/nl/basjes/hadoop/input/ApacheHttpdLogfileRecordReader.java b/httpdlog/httpdlog-inputformat/src/main/java/nl/basjes/hadoop/input/ApacheHttpdLogfileRecordReader.java index <HASH>..<HASH> 100644 --- a/httpdlog/httpdlog-inputformat/src/main/java/nl/basjes/hadoop/input/ApacheHttpdLogfileRecordReader.java +++ b/httpdlog/httpdlog-inputformat/src/main/java/nl/basjes/hadoop/input/ApacheHttpdLogfileRecordReader.java @@ -51,7 +51,7 @@ public class ApacheHttpdLogfileRecordReader extends private static final Logger LOG = LoggerFactory.getLogger(ApacheHttpdLogfileRecordReader.class); - private static final String HTTPD_LOGFILE_INPUT_FORMAT = "HTTPD (Nginx/Apache) Logfile InputFormat"; + private static final String HTTPD_LOGFILE_INPUT_FORMAT = "HTTPD Access Logfile InputFormat"; public static final String FIELDS = "fields"; // --------------------------------------------
Rename the Hadoop counter group. Sometimes the webUI of Hadoop gets confused by the '/' in the name.
nielsbasjes_logparser
train
java
7178c4bb53122ec2f841d45bb7b0da7ec6d5b555
diff --git a/lib/class/datasource.js b/lib/class/datasource.js index <HASH>..<HASH> 100644 --- a/lib/class/datasource.js +++ b/lib/class/datasource.js @@ -343,6 +343,11 @@ Datasource.setMethod(function update(model, data, options, callback) { return callback(err); } + if (options.set_updated !== false) { + // Set the updated field + data.updated = new Date(); + } + // Call the real _create method that._update(model, data, options, callback); });
Set option `set_updated` to false during saving so the `updated` field won't be changed
skerit_alchemy
train
js
72dd51d11fc874611e6b553791bc88bd63c174ee
diff --git a/lib/channel.js b/lib/channel.js index <HASH>..<HASH> 100644 --- a/lib/channel.js +++ b/lib/channel.js @@ -262,6 +262,7 @@ AuthCastMessageDecoder.prototype._transform = function(chunk, enc, done) { done(); } else { this.push(chunk); + done(); } };
Fix a bug in auth layer not forwarding messages once authentication is done.
vincentbernat_nodecastor
train
js
d69706aa941045ff67091c6e6a699fbc0f5c7ec9
diff --git a/tty.go b/tty.go index <HASH>..<HASH> 100644 --- a/tty.go +++ b/tty.go @@ -84,7 +84,7 @@ func (tty *TTY) ReadPassword() (string, error) { return tty.readString(displayMask) } -func (tty *TTY) ReadPasswordNoMask() (string, error) { +func (tty *TTY) ReadPasswordNoEcho() (string, error) { defer tty.Output().WriteString("\n") return tty.readString(displayNone) }
Replace NoMask to NoEcho
mattn_go-tty
train
go
33f4aca658c9f67467de99646f8c1438c104c29f
diff --git a/lib/mongo/cursor.rb b/lib/mongo/cursor.rb index <HASH>..<HASH> 100644 --- a/lib/mongo/cursor.rb +++ b/lib/mongo/cursor.rb @@ -282,6 +282,8 @@ module Mongo returning({}) do |hash| fields.each { |field| hash[field] = 1 } end + when Hash + return fields end end diff --git a/test/unit/cursor_test.rb b/test/unit/cursor_test.rb index <HASH>..<HASH> 100644 --- a/test/unit/cursor_test.rb +++ b/test/unit/cursor_test.rb @@ -30,6 +30,13 @@ class CursorTest < Test::Unit::TestCase assert @cursor.fields == {:name => 1, :date => 1} end + should "set mix fields 0 and 1" do + assert_nil @cursor.fields + + @cursor = Cursor.new(@collection, :fields => {:name => 1, :date => 0}) + assert @cursor.fields == {:name => 1, :date => 0} + end + should "set limit" do assert_equal 0, @cursor.limit
More flexible :fields option, supporting {} This allows exact definition of the fields you want included in the query results. For example :fields => {:name => 1, :people => 0} will include the name key but exclude the people key.
mongodb_mongo-ruby-driver
train
rb,rb
09a869307696d97eba199c31ef37a9b52e5bc0ec
diff --git a/tests/test_core.py b/tests/test_core.py index <HASH>..<HASH> 100644 --- a/tests/test_core.py +++ b/tests/test_core.py @@ -1,5 +1,5 @@ import unittest -from xigt.core import XigtCorpus, Igt, Tier, Item, Metadata +from xigt import XigtCorpus, Igt, Tier, Item, Metadata class TestMetadata(unittest.TestCase): def test_empty(self): diff --git a/xigt/__init__.py b/xigt/__init__.py index <HASH>..<HASH> 100644 --- a/xigt/__init__.py +++ b/xigt/__init__.py @@ -0,0 +1,3 @@ + +from .core import (XigtCorpus, Igt, Tier, Item, Metadata, Meta, + resolve_alignment_expression, resolve_alignment)
Added more convenient interface to the modules through xigt/__init__.py, and verified it works by changing the unittest import statement.
xigt_xigt
train
py,py
a566c3e531b3392db12e4d0a1957a5480085ca1b
diff --git a/sitebricks-persist-disk/src/test/java/com/google/sitebricks/persist/disk/DiskStoreIntegrationTest.java b/sitebricks-persist-disk/src/test/java/com/google/sitebricks/persist/disk/DiskStoreIntegrationTest.java index <HASH>..<HASH> 100644 --- a/sitebricks-persist-disk/src/test/java/com/google/sitebricks/persist/disk/DiskStoreIntegrationTest.java +++ b/sitebricks-persist-disk/src/test/java/com/google/sitebricks/persist/disk/DiskStoreIntegrationTest.java @@ -44,7 +44,12 @@ public class DiskStoreIntegrationTest { @AfterMethod public void post() throws IOException { persister.shutdown(); - FileUtils.deleteDirectory(new File(STORE_DIR)); + try { + FileUtils.deleteDirectory(new File(STORE_DIR)); + } catch (IOException e) { + e.printStackTrace(); + // Can't do much really. + } } @Test
Trap cleanup exceptions in tests in disk store module (on some platforms) issue #<I>
dhanji_sitebricks
train
java
0fc1e6137e2f37e0873bc9d3ba2509ffabe2ec90
diff --git a/src/Search/Search.php b/src/Search/Search.php index <HASH>..<HASH> 100644 --- a/src/Search/Search.php +++ b/src/Search/Search.php @@ -65,7 +65,7 @@ trait Search // checks $user = auth()->user(); - $messages = MailHeader::with('body', 'recipients'); + $messages = MailHeader::with('body', 'recipients', 'sender'); // If the user is a super user, return all if (! $user->hasSuperUser()) {
some minor refactoring and testing of <URL> * Using generic partial blades * disable columns for search which are irrelevant * disable front end ordering of table as ordering is done in the query.
eveseat_services
train
php
6b71df24b77a60603f05bd3775d8942a14608e19
diff --git a/metasrc/pandoc/convert.py b/metasrc/pandoc/convert.py index <HASH>..<HASH> 100644 --- a/metasrc/pandoc/convert.py +++ b/metasrc/pandoc/convert.py @@ -26,7 +26,11 @@ def ensure_pandoc(func): # Install pandoc and retry message = "pandoc needed but not found. Now installing it for you." logger.warning(message) - pypandoc.download_pandoc() + # This version of pandoc is known to be compatible with both + # pypandoc.download_pandoc and the functionality that metasrc + # needs. Travis CI tests are useful for ensuring download_pandoc + # works. + pypandoc.download_pandoc(version='1.19.1') logger.debug("pandoc download complete") result = func(*args, **kwargs)
Constrain pandoc download to <I> This may be because pandoc <I>+ seems to be is currently incompatible with pypandoc's auto download feature (this isn't fully diagnosed, but seems to be how it's working out).
lsst-sqre_lsst-projectmeta-kit
train
py
48d392635f9037da6f797e4f525cc9239eaa3c6b
diff --git a/select2.js b/select2.js index <HASH>..<HASH> 100644 --- a/select2.js +++ b/select2.js @@ -762,6 +762,8 @@ the specific language governing permissions and limitations under the Apache Lic // dom it will trigger the popup close, which is not what we want this.dropdown.on("click mouseup mousedown", function (e) { e.stopPropagation(); }); + this.nextSearchTerm = undefined; + if ($.isFunction(this.opts.initSelection)) { // initialize selection based on the current value of the source element this.initSelection(); @@ -789,8 +791,7 @@ the specific language governing permissions and limitations under the Apache Lic this.autofocus = opts.element.prop("autofocus"); opts.element.prop("autofocus", false); if (this.autofocus) this.focus(); - - this.nextSearchTerm = undefined; + }, // abstract @@ -2144,9 +2145,10 @@ the specific language governing permissions and limitations under the Apache Lic self.updateSelection(selected); self.close(); self.setPlaceholder(); + self.nextSearchTerm = self.opts.nextSearchTerm(selected, self.search.val()); } }); - } + } }, isPlaceholderOptionSelected: function() {
singleSelect: setting nextSearchTerm in initSelection For single select the nextSearchTerm callback is called when initSelection returned data
select2_select2
train
js