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
9d1e8e300a0df97739b4ec66094a986ba15f405e
diff --git a/src/VisitorFactory.php b/src/VisitorFactory.php index <HASH>..<HASH> 100644 --- a/src/VisitorFactory.php +++ b/src/VisitorFactory.php @@ -5,6 +5,7 @@ declare(strict_types=1); namespace Ray\Aop; use PhpParser\NodeTraverser; +use PhpParser\NodeVisitor\NameResolver; use PhpParser\Parser; use Ray\Aop\Exception\InvalidSourceClassException; use ReflectionClass; @@ -31,7 +32,9 @@ final class VisitorFactory public function __invoke(ReflectionClass $class): CodeVisitor { $traverser = new NodeTraverser(); + $nameResolver = new NameResolver(); $visitor = new CodeVisitor(); + $traverser->addVisitor($nameResolver); $traverser->addVisitor($visitor); $fileName = $class->getFileName(); if (is_bool($fileName)) {
Use NameResolver for including namespace
ray-di_Ray.Aop
train
php
e4d93055eff9180beac750104c7bdc0ca6570940
diff --git a/src/main/java/net/malisis/core/client/gui/GuiRenderer.java b/src/main/java/net/malisis/core/client/gui/GuiRenderer.java index <HASH>..<HASH> 100644 --- a/src/main/java/net/malisis/core/client/gui/GuiRenderer.java +++ b/src/main/java/net/malisis/core/client/gui/GuiRenderer.java @@ -450,9 +450,7 @@ public class GuiRenderer extends MalisisRenderer draw(); - text = StatCollector.translateToLocal(text); - text = text.replaceAll("\r?\n", ""); - text = text.replaceAll("\t", " "); + text = processString(text); GL11.glPushMatrix(); GL11.glTranslatef(x * (1 - fontScale), y * (1 - fontScale), 0); GL11.glScalef(fontScale, fontScale, 1); @@ -624,9 +622,12 @@ public class GuiRenderer extends MalisisRenderer public static String processString(String str) { + EnumChatFormatting ecf = getFormatting(str, 0); + if (ecf != null) + str = str.substring(2); str = StatCollector.translateToLocal(str); str = str.replaceAll("\r?\n", "").replaceAll("\t", " "); - return str; + return (ecf != null ? ecf : "") + str; } /**
Fixed processString to handle ECF before localization strings
Ordinastie_MalisisCore
train
java
b47348bdf8e3fbf136ea6d8780d976f6d5db6aa1
diff --git a/packages/next-server/lib/loadable.js b/packages/next-server/lib/loadable.js index <HASH>..<HASH> 100644 --- a/packages/next-server/lib/loadable.js +++ b/packages/next-server/lib/loadable.js @@ -170,8 +170,9 @@ function createLoadableComponent (loadFn, options) { } static contextType = LoadableContext - - componentWillMount () { + // TODO: change it before next major React release + // eslint-disable-next-line + UNSAFE_componentWillMount() { this._mounted = true this._loadModule() }
Change componentWillMount to UNSAFE (#<I>) * Change to unsafe * Ignore
zeit_next.js
train
js
50f43bd6d5a84e10965e4f8f269b561d082d5774
diff --git a/src/Front.php b/src/Front.php index <HASH>..<HASH> 100644 --- a/src/Front.php +++ b/src/Front.php @@ -232,8 +232,8 @@ class Front extends Simple\Front implements Routing\FrontController break; case 'application/json': - if($this->route->hasContent('application/json', $contentKey)) - return $this->route->getContentByType('application/json', $contentKey)->asJson(); + if($this->route->hasContent('application/json')) + return $this->route->getContentByType('application/json')->asJson(); elseif(404 != http_response_code()) { http_response_code(404); $_SERVER['REDIRECT_STATUS'] = 404; @@ -243,7 +243,7 @@ class Front extends Simple\Front implements Routing\FrontController break; case 'application/xml': if($this->route->hasContent('application/xml', $contentKey)) - return $this->route->getContent('application/xml', $contentKey)->asJson(); + return $this->route->getContentByType('application/xml')->asJson(); elseif(404 != http_response_code()) { http_response_code(404); $_SERVER['REDIRECT_STATUS'] = 404;
Fix getContent I'm dumb…
RobinDumontChaponet_TransitiveWeb
train
php
16fc8d6327bd0912cb234e1012df055feaca5c81
diff --git a/sqlauth/__init__.py b/sqlauth/__init__.py index <HASH>..<HASH> 100644 --- a/sqlauth/__init__.py +++ b/sqlauth/__init__.py @@ -16,4 +16,4 @@ ## ############################################################################### -__version__ = "0.1.86" +__version__ = "0.1.87"
sync with pypi version: <I>
lgfausak_sqlauth
train
py
5273ba959059339cf291d9e60225d1f40dc2c360
diff --git a/lib/vagrant/util/numeric.rb b/lib/vagrant/util/numeric.rb index <HASH>..<HASH> 100644 --- a/lib/vagrant/util/numeric.rb +++ b/lib/vagrant/util/numeric.rb @@ -49,6 +49,14 @@ module Vagrant bytes end + # Rounds actual value to two decimal places + # + # @param [Integer] bytes + # @return [Integer] megabytes - bytes representation in megabytes + def bytes_to_megabytes(bytes) + (bytes / MEGABYTE).round(2) + end + # @private # Reset the cached values for platform. This is not considered a public # API and should only be used for testing.
Add method for converting bytes to megabytes
hashicorp_vagrant
train
rb
b6b321376fa0e7f211681ae133ccfdf6aafd7b09
diff --git a/packages/components/src/product-icon/config.js b/packages/components/src/product-icon/config.js index <HASH>..<HASH> 100644 --- a/packages/components/src/product-icon/config.js +++ b/packages/components/src/product-icon/config.js @@ -99,6 +99,10 @@ export const iconToProductSlugMap = { 'jetpack_security_daily_monthly_v2', 'jetpack_security_realtime_v2', 'jetpack_security_realtime_monthly_v2', + 'jetpack_security_daily', + 'jetpack_security_daily_monthly', + 'jetpack_security_realtime', + 'jetpack_security_realtime_monthly', ], };
Add missing Jetpack Security slugs (#<I>)
Automattic_wp-calypso
train
js
f2fbb3fc157c8964b40d67aa19899f56ceb076ba
diff --git a/sprd/entity/Configuration.js b/sprd/entity/Configuration.js index <HASH>..<HASH> 100644 --- a/sprd/entity/Configuration.js +++ b/sprd/entity/Configuration.js @@ -53,9 +53,7 @@ define(['js/data/Entity', 'sprd/entity/Offset', 'sprd/entity/Size', 'sprd/entity }, _commitChangedAttributes: function ($) { - if(this.$entityInitialized){ - this._validateTransform($); - } + this._validateTransform($); this.callBase(); },
removed $entityInitialized check in Configuration
spreadshirt_rAppid.js-sprd
train
js
c42393a99435278f577b508e204bdfe1a9a6ff68
diff --git a/testproject/tablib_test/tests.py b/testproject/tablib_test/tests.py index <HASH>..<HASH> 100644 --- a/testproject/tablib_test/tests.py +++ b/testproject/tablib_test/tests.py @@ -6,6 +6,9 @@ from .models import TestModel class DjangoTablibTestCase(TestCase): + def setUp(self): + TestModel.objects.create(field1='value') + def test_declarative_fields(self): class TestModelDataset(ModelDataset): field1 = Field() @@ -20,3 +23,5 @@ class DjangoTablibTestCase(TestCase): self.assertTrue('id' not in data.headers) self.assertTrue('field1' in data.headers) self.assertTrue('field2' in data.headers) + + self.assertEqual(data[0][0], data[0][1])
Test that declarative fields actually work.
joshourisman_django-tablib
train
py
85da04c878d164b9d31818c361940e10c14276fd
diff --git a/shap/explainers/linear.py b/shap/explainers/linear.py index <HASH>..<HASH> 100644 --- a/shap/explainers/linear.py +++ b/shap/explainers/linear.py @@ -45,8 +45,13 @@ class LinearExplainer(Explainer): # sklearn style model elif hasattr(model, "coef_") and hasattr(model, "intercept_"): - self.coef = model.coef_ - self.intercept = model.intercept_ + # work around for multi-class with a single class + if len(model.coef_.shape) and model.coef_.shape[0] == 1: + self.coef = model.coef_[0] + self.intercept = model.intercept_[0] + else: + self.coef = model.coef_ + self.intercept = model.intercept_ else: raise Exception("An unknown model type was passed: " + str(type(model)))
Fix #<I> Still need to support multi-class at some point.
slundberg_shap
train
py
c38143d4dfb4e83b885aaff678c20808412b22a6
diff --git a/lib/resque/plugins/later/method.rb b/lib/resque/plugins/later/method.rb index <HASH>..<HASH> 100644 --- a/lib/resque/plugins/later/method.rb +++ b/lib/resque/plugins/later/method.rb @@ -25,7 +25,6 @@ module Resque::Plugins::Later::Method end def perform_later(queue, method, *args) - ActiveSupport::Deprecation.warn("perform_later will be deprecated in future versions, please use the later method on your models") args = PerformLater::ArgsParser.args_to_resque(args) worker = PerformLater::Workers::ActiveRecord::Worker @@ -33,8 +32,6 @@ module Resque::Plugins::Later::Method end def perform_later!(queue, method, *args) - ActiveSupport::Deprecation.warn("perform_later! will be deprecated in future versions, please use the later method on your models") - args = PerformLater::ArgsParser.args_to_resque(args) digest = PerformLater::PayloadHelper.get_digest(self.class.name, method, args) worker = PerformLater::Workers::ActiveRecord::LoneWorker
Removed deprecation warnings
KensoDev_perform_later
train
rb
f81bb61f2d51a07af62cd8d38e00faef81d6612f
diff --git a/salt/utils/__init__.py b/salt/utils/__init__.py index <HASH>..<HASH> 100644 --- a/salt/utils/__init__.py +++ b/salt/utils/__init__.py @@ -2016,7 +2016,11 @@ def check_state_result(running, recurse=False, highstate=None): ret = True for state_id, state_result in six.iteritems(running): - if not recurse and not isinstance(state_result, dict): + expected_type = dict + # The __extend__ state is a list + if "__extend__" == state_id: + expected_type = list + if not recurse and not isinstance(state_result, expected_type): ret = False if ret and isinstance(state_result, dict): result = state_result.get('result', _empty)
check_result: Correctly check the __extend__ state. <URL> is expecting each highstate item to be a dict, but states using extend are lists. Conflicts: - salt/utils/state.py
saltstack_salt
train
py
0de608f7bb6169870f813eabe42eb834b4c79b6c
diff --git a/spinoff/util/testing.py b/spinoff/util/testing.py index <HASH>..<HASH> 100644 --- a/spinoff/util/testing.py +++ b/spinoff/util/testing.py @@ -10,8 +10,6 @@ from twisted.internet.defer import Deferred, succeed from spinoff.util.async import CancelledError from spinoff.actor import Actor from spinoff.util.pattern_matching import match, ANY, IS_INSTANCE, NOT -from spinoff.util.python import combomethod -from spinoff.actor.comm import ActorRef __all__ = ['deferred', 'assert_raises', 'assert_not_raises', 'MockFunction', 'assert_num_warnings', 'assert_no_warnings', 'assert_one_warning'] @@ -30,6 +28,7 @@ def deferred(f): clock = Clock() d = f(clock) + @d.addErrback def on_error(f): error[0] = sys.exc_info()
Cleaned up in util.testing
eallik_spinoff
train
py
0be4c2651acb3221f4429a66d81f46ea939515d4
diff --git a/lib/generators/social_stream/templates/migration.rb b/lib/generators/social_stream/templates/migration.rb index <HASH>..<HASH> 100644 --- a/lib/generators/social_stream/templates/migration.rb +++ b/lib/generators/social_stream/templates/migration.rb @@ -38,7 +38,6 @@ class CreateSocialStream < ActiveRecord::Migration t.string "name", :limit => 45 t.string "email", :default => "", :null => false t.string "permalink", :limit => 45 - t.boolean "disabled", :default => false t.datetime "created_at" t.datetime "updated_at" t.integer "activity_object_id" diff --git a/lib/social_stream/models/actor.rb b/lib/social_stream/models/actor.rb index <HASH>..<HASH> 100644 --- a/lib/social_stream/models/actor.rb +++ b/lib/social_stream/models/actor.rb @@ -14,7 +14,6 @@ module SocialStream delegate :name, :name=, :email, :email=, :permalink, :permalink=, - :disabled, :disabled=, :ties, :sent_ties, :received_ties, :active_ties_to, :sender_subjects, :receiver_subjects, :suggestion,
Remove actor#disabled for now
ging_social_stream
train
rb,rb
5d710321c549ffd581f1199447a055630d45eb52
diff --git a/classes/Boom/Model/Group.php b/classes/Boom/Model/Group.php index <HASH>..<HASH> 100644 --- a/classes/Boom/Model/Group.php +++ b/classes/Boom/Model/Group.php @@ -177,7 +177,20 @@ class Boom_Model_Group extends ORM public function roles($page_id = 0) { - + // Check that the given page ID is an integer. + if ( ! is_int($page_id)) + { + // No it's not, leave us alone. + throw new InvalidArgumentException('Argument 1 for '.__CLASS__.'::'.__METHOD__.' must be an integer, '.gettype($page_id).' given'); + } + + // Run the query and return the results. + return DB::select('role_id', 'allowed') + ->from('group_roles') + ->where('group_id', '=', $this->id) + ->where('page_id', '=', $page_id) + ->execute($this->_db) + ->as_array('role_id', 'allowed'); } /**
Completed Model_Group::roles()
boomcms_boom-core
train
php
edcc2926867ec56ffa89ff64970d5365a72b8bf2
diff --git a/lib/blimpy/livery/cwd.rb b/lib/blimpy/livery/cwd.rb index <HASH>..<HASH> 100644 --- a/lib/blimpy/livery/cwd.rb +++ b/lib/blimpy/livery/cwd.rb @@ -18,7 +18,7 @@ module Blimpy def flight(box) run_sudo = 'sudo' - if use_sudo?(box) + unless use_sudo?(box) run_sudo = '' end diff --git a/lib/blimpy/livery/puppet.rb b/lib/blimpy/livery/puppet.rb index <HASH>..<HASH> 100644 --- a/lib/blimpy/livery/puppet.rb +++ b/lib/blimpy/livery/puppet.rb @@ -35,7 +35,7 @@ module Blimpy end def bootstrap_script - File.expand_path(File.dirname(__FILE__) + "/../../scripts/#{script}") + File.expand_path(File.dirname(__FILE__) + "/../../../scripts/#{script}") end def self.configure(&block)
Clean-up the remainder of the holes missed when refactoring for the Puppet livery
rtyler_blimpy
train
rb,rb
f62a6737db584cf97b7cc258835b67c4e66c25ea
diff --git a/interface.js b/interface.js index <HASH>..<HASH> 100644 --- a/interface.js +++ b/interface.js @@ -129,7 +129,7 @@ class SuperTask extends SuperTaskInternal { } // Sanitize args - args = (Array.isArray(args)) ? args : []; + args = (Array.isArray(args)) ? args : [args]; // Compile task if it is in source form if (typeof task.func !== 'function') {
Fixed arg conversion in `apply` method
schahriar_supertask
train
js
ffb897bbb34498664aacb66bb6592f32ddae3bc8
diff --git a/src/main/java/org/jboss/ws/common/management/AbstractServerConfigMBean.java b/src/main/java/org/jboss/ws/common/management/AbstractServerConfigMBean.java index <HASH>..<HASH> 100644 --- a/src/main/java/org/jboss/ws/common/management/AbstractServerConfigMBean.java +++ b/src/main/java/org/jboss/ws/common/management/AbstractServerConfigMBean.java @@ -62,4 +62,8 @@ public interface AbstractServerConfigMBean String getWebServicePathRewriteRule(); void setWebServicePathRewriteRule(String path); + + String getWebServiceUriScheme(); + + void setWebServiceUriScheme(String scheme); }
[JBWS-<I>] Also update MBean view
jbossws_jbossws-common
train
java
13f87cb21e3284917ba541c1e4491b18aefb5de3
diff --git a/grade/edit/tree/category_form.php b/grade/edit/tree/category_form.php index <HASH>..<HASH> 100644 --- a/grade/edit/tree/category_form.php +++ b/grade/edit/tree/category_form.php @@ -225,7 +225,7 @@ class edit_category_form extends moodleform { $mform->addElement('header', 'headerparent', get_string('parentcategory', 'grades')); $options = array(); - $default = ''; + $default = -1; $categories = grade_category::fetch_all(array('courseid'=>$COURSE->id)); foreach ($categories as $cat) { @@ -238,6 +238,7 @@ class edit_category_form extends moodleform { if (count($categories) > 1) { $mform->addElement('select', 'parentcategory', get_string('parentcategory', 'grades'), $options); + $mform->setDefault('parentcategory', $default); $mform->addElement('static', 'currentparentaggregation', get_string('currentparentaggregation', 'grades')); }
MDL-<I> gradebook Fixing issue where default parent in Full View Add Category could be inconsistent. Turns out the correct default was already computed, but was not being applied to the setting.
moodle_moodle
train
php
d731fb09721b3f893c0c3c7f0f70057b77174f47
diff --git a/structure_files/FileType/ExcelFile.php b/structure_files/FileType/ExcelFile.php index <HASH>..<HASH> 100644 --- a/structure_files/FileType/ExcelFile.php +++ b/structure_files/FileType/ExcelFile.php @@ -348,6 +348,8 @@ class ExcelFile extends AbstractFile implements Downloadable { } else { array_push($line, $d[$hf]); } + } else { + array_push($line, $section->getNull()); } } } else { diff --git a/structure_files/FileType/TxtFile.php b/structure_files/FileType/TxtFile.php index <HASH>..<HASH> 100644 --- a/structure_files/FileType/TxtFile.php +++ b/structure_files/FileType/TxtFile.php @@ -29,7 +29,7 @@ class TxtFile extends CommonFile { * @param string $extension * @return TxtFile */ - public static function createFromSection(SectionFile $sectionFile, $extension = '.tsv') + public static function createFromSection(SectionFile $sectionFile, $extension = 'tsv') { $cont = []; //handle data @@ -210,6 +210,8 @@ class TxtFile extends CommonFile { } else { array_push($line, $d[$hf]); } + } else { + array_push($line, $section->getNull()); } } } else {
- Fix create from tsv section in ExcelFile and TxtFile
wwtg99_StructureFiles
train
php,php
c3c170b692cdbf493469383179c78f0ef877d7ae
diff --git a/lib/recaptcha/client_helper.rb b/lib/recaptcha/client_helper.rb index <HASH>..<HASH> 100644 --- a/lib/recaptcha/client_helper.rb +++ b/lib/recaptcha/client_helper.rb @@ -25,6 +25,7 @@ module Recaptcha src="#{fallback_uri}" frameborder="0" scrolling="no" style="width: 302px; height:422px; border-style: none;"> + title="ReCAPTCHA" </iframe> </div> </div>
added title attribute to iframe for screen readers
ambethia_recaptcha
train
rb
505a234a4937a7fc95bf80c13de8cb7d655a2991
diff --git a/test/test_repository.rb b/test/test_repository.rb index <HASH>..<HASH> 100644 --- a/test/test_repository.rb +++ b/test/test_repository.rb @@ -113,14 +113,13 @@ class TestRepository < Test::Unit::TestCase end should 'know the most significant commits of the repository' do - commits = @repo.significant_commits - assert_equal 10, commits.size + commits = @repo.significant_commits('master', 8) + assert_equal 8, commits.size assert commits.all? { |commit| commit.is_a? Metior::Commit } - assert_equal [ - "c0f0b4f", "47ab25c", "f3a24ae", "18ec70e", "242253b", "c87612b", - "6bb41e4", "4d9c7be", "756a947", "7569d0d" - ], commits.collect { |commit| commit.id } + assert_equal %w{ + c0f0b4f 47ab25c f3a24ae 18ec70e 242253b c87612b 6bb41e4 4d9c7be + }, commits.collect { |commit| commit.id } modifications = commits.first.modifications commits[1..-1].each do |commit|
Changed assertion to dodge JRuby sorting differently
koraktor_metior
train
rb
7ea0f9ff9093fcd8eee04bb26dd0151a359f9580
diff --git a/test/m-cql3.js b/test/m-cql3.js index <HASH>..<HASH> 100644 --- a/test/m-cql3.js +++ b/test/m-cql3.js @@ -158,7 +158,10 @@ describe('cql3', function() return promise.then(function(v1) { var p2 = conn.cql(config['static_select_cnt#cql']); - return p2.should.be.fulfilled; + return p2.should.eventually.have.property('length', 1).then(function(value) + { + return value[0]; + }); }).should.eventually.be.an.instanceof(scamandrios.Row).then(function(row) { return row.get('cnt');
Fixed the test conditions for the one remaining failing test. The cql3 tests are now all green.
lyveminds_scamandrios
train
js
f3d3804c7707671c9984207bac36217d451907e8
diff --git a/lib/conf/cli.js b/lib/conf/cli.js index <HASH>..<HASH> 100644 --- a/lib/conf/cli.js +++ b/lib/conf/cli.js @@ -63,6 +63,11 @@ var start = function(cb) { // account cli.command('account', 'Prey account management.', function(sub) { + sub.command('setup', 'Starts interactive command-line account setup.', function(cmd) { + cmd.options(['-f', '--force'], 'Force setup even if API key is already set.') + run_if_writable(cmd, account.setup); + }); + sub.command('authorize', 'Validates auth credentials, and stores API key if authorized.', function(cmd) { cmd.parameters(['-a', '--api-key'], 'API Key') cmd.parameters(['-e', '--email'], 'Email') @@ -86,11 +91,6 @@ var start = function(cb) { run_if_writable(cmd, account.signup); }); - sub.command('setup', 'Starts interactive command-line account setup.', function(cmd) { - cmd.options(['-f', '--force'], 'Force setup even if API key is already set.') - run_if_writable(cmd, account.setup); - }); - sub.start(); })
Conf/cli: Move 'setup' to top of config account section.
prey_prey-node-client
train
js
eceef7a5df582eccb61ca6e923363472288986cc
diff --git a/src/Http/Client/Adapter/Stream.php b/src/Http/Client/Adapter/Stream.php index <HASH>..<HASH> 100644 --- a/src/Http/Client/Adapter/Stream.php +++ b/src/Http/Client/Adapter/Stream.php @@ -217,6 +217,7 @@ class Stream implements AdapterInterface 'ssl_allow_self_signed', 'ssl_cafile', 'ssl_local_cert', + 'ssl_local_pk', 'ssl_passphrase', ]; if (empty($options['ssl_cafile'])) {
Added ssl_local_pk option for Http/Client
cakephp_cakephp
train
php
9a9a644c5688dd049bc8fad71d0a45feeb0bf979
diff --git a/framework/core/src/Foundation/Console/CacheClearCommand.php b/framework/core/src/Foundation/Console/CacheClearCommand.php index <HASH>..<HASH> 100644 --- a/framework/core/src/Foundation/Console/CacheClearCommand.php +++ b/framework/core/src/Foundation/Console/CacheClearCommand.php @@ -62,7 +62,13 @@ class CacheClearCommand extends AbstractCommand { $this->info('Clearing the cache...'); - $this->cache->flush(); + $succeeded = $this->cache->flush(); + + if (! $succeeded) { + $this->error('Could not clear contents of `storage/cache`. Please adjust file permissions and try again. This can frequently be fixed by clearing cache via the `Tools` dropdown on the Administration Dashboard page.'); + + return 1; + } $storagePath = $this->paths->storage; array_map('unlink', glob($storagePath.'/formatter/*'));
Don't fail silently on cache clear (#<I>)
flarum_core
train
php
9a55c506942f3298d4301367f7437fb34331fd7b
diff --git a/agent/consul/internal_endpoint_test.go b/agent/consul/internal_endpoint_test.go index <HASH>..<HASH> 100644 --- a/agent/consul/internal_endpoint_test.go +++ b/agent/consul/internal_endpoint_test.go @@ -605,13 +605,13 @@ func TestInternal_ServiceDump(t *testing.T) { // so the response should be the same in all subtests expectedGW := structs.GatewayServices{ { - Service: structs.ServiceName{Name: "api"}, - Gateway: structs.ServiceName{Name: "terminating-gateway"}, + Service: structs.NewServiceName("api", nil), + Gateway: structs.NewServiceName("terminating-gateway", nil), GatewayKind: structs.ServiceKindTerminatingGateway, }, { - Service: structs.ServiceName{Name: "cache"}, - Gateway: structs.ServiceName{Name: "terminating-gateway"}, + Service: structs.NewServiceName("cache", nil), + Gateway: structs.NewServiceName("terminating-gateway", nil), GatewayKind: structs.ServiceKindTerminatingGateway, }, }
ensure these tests work fine with namespaces in enterprise (#<I>)
hashicorp_consul
train
go
0ecf6bbc41985d46778a35f50cd3360217d076ff
diff --git a/idigbio/json_client.py b/idigbio/json_client.py index <HASH>..<HASH> 100644 --- a/idigbio/json_client.py +++ b/idigbio/json_client.py @@ -89,6 +89,13 @@ class ImagesDisabledException(Exception): pass +def make_session(): + import idigbio + s = requests.Session() + s.headers["User-Agent"] = "idigbio-python-client/" + idigbio.__version__ + return s + + class iDigBioMap(object): def __init__(self, api, rq={}, style=None, t="auto", disable_images=False): self.__api = api @@ -162,7 +169,7 @@ class iDigBioMap(object): if y_tiles is None: y_tiles = range(0, 2**zoom) - s = requests.Session() + s = make_session() if self._disable_images: raise ImagesDisabledException() im = Image.new("RGB", (len(x_tiles) * 256, len(y_tiles) * 256)) @@ -200,7 +207,7 @@ class iDbApiJson(object): else: raise BadEnvException - self.s = requests.Session() + self.s = make_session() def __del__(self): self.s.close()
Set the User-Agent in requests Set the user agent to `idigbio-python-client/{version}`. This way we can monitor usage and see what versions are in the wild.
iDigBio_idigbio-python-client
train
py
f06ab6236399647c8744d67929112196fd36c0f5
diff --git a/js/jquery-confirm.js b/js/jquery-confirm.js index <HASH>..<HASH> 100644 --- a/js/jquery-confirm.js +++ b/js/jquery-confirm.js @@ -221,7 +221,7 @@ var jconfirm, Jconfirm; return false; var key = e.which; - console.log(e); + console.log(key); if (key === 27) { /* * if ESC key @@ -240,9 +240,9 @@ var jconfirm, Jconfirm; this.close(); } } - if (key === 13) { + if (key === 13 || key == 32) { /* - * if ENTER key + * if ENTER or SPACE key */ if (this.$confirmButton) { this.$confirmButton.click();
keyboard action , trigger Confirm on SPACE
craftpip_jquery-confirm
train
js
f34948d9fbbf52693f8201b456179f18416f2ddc
diff --git a/lib/csvlint/validate.rb b/lib/csvlint/validate.rb index <HASH>..<HASH> 100644 --- a/lib/csvlint/validate.rb +++ b/lib/csvlint/validate.rb @@ -77,7 +77,7 @@ module Csvlint validate_metadata end request.on_body do |chunk| - io = StringIO.new(@leading + chunk) + io = StringIO.new(chunk) io.each_line do |line| break if line_limit_reached? parse_line(line)
Don't pass leading string to parse_line This is a legacy from when `parse_line` was only used within `validate_url`. We now join the leading and the chunk within `parse_line`
theodi_csvlint.rb
train
rb
0f741cc55c4ead05b78fb0f3437e6dd095f1b823
diff --git a/soco/core.py b/soco/core.py index <HASH>..<HASH> 100755 --- a/soco/core.py +++ b/soco/core.py @@ -288,6 +288,8 @@ class SoCo(_SocoSingletonBase): # pylint: disable=R0904 """ Play a track from the queue by index. The index number is required as an argument, where the first index is 0. + index: the index of the track to play; first item in the queue is 0 + Returns: True if the Sonos speaker successfully started playing the track. @@ -1102,6 +1104,8 @@ class SoCo(_SocoSingletonBase): # pylint: disable=R0904 """ Remove a track from the queue by index. The index number is required as an argument, where the first index is 0. + index: the index of the track to remove; first item in the queue is 0 + Returns: True if the Sonos speaker successfully removed the track
Added argument explanation in remove_from_queue, play_from_queue.
amelchio_pysonos
train
py
34afadb0965f6f3a7782bef3f81f7aafb127bfa3
diff --git a/app/models/test_case.rb b/app/models/test_case.rb index <HASH>..<HASH> 100644 --- a/app/models/test_case.rb +++ b/app/models/test_case.rb @@ -9,14 +9,22 @@ class TestCase < Fire::Model full_description: rspec_example.full_description, file_path: rspec_example.file_path, location: rspec_example.location, - exception: rspec_example.exception, status: rspec_example.metadata[:execution_result].status, started_at: rspec_example.metadata[:execution_result].started_at, run_time: rspec_example.metadata[:execution_result].run_time }.merge!(revision_opts).merge!(extras) + + if rspec_example.exception + data[:exception] = { + message: rspec_example.exception.message, + backtrace: rspec_example.exception.backtrace, + } + end + if rspec_example.respond_to?(:swat_extras) data.merge!(swat_extras: rspec_example.swat_extras) end + create(data) end
prevent exception serialization on TestCase object saving
tw4qa_sw2at-ui
train
rb
940db1f92e7e76e48bab65b68d3bce8e415eb034
diff --git a/lib/jumpstart/base.rb b/lib/jumpstart/base.rb index <HASH>..<HASH> 100644 --- a/lib/jumpstart/base.rb +++ b/lib/jumpstart/base.rb @@ -49,15 +49,7 @@ module JumpStart puts "creating JumpStart project #{@project_name}" # TODO Create functionality for creating projects if they do not exist elsif input == "no" || input == "n" - puts - puts "******************************************************************************************************************************************" - puts - puts "Exiting JumpStart..." - puts "Goodbye!" - puts - puts "******************************************************************************************************************************************" - puts - exit + exit_jumpstart end end end @@ -73,7 +65,9 @@ module JumpStart begin Dir.chdir(x) rescue + puts puts "The directory #{x} could not be found, or you do not have the correct permissions to access it." + exit_jumpstart end end end @@ -151,5 +145,16 @@ module JumpStart number.to_i end + def exit_jumpstart + puts + puts + puts "Exiting JumpStart..." + puts "Goodbye!" + puts + puts "******************************************************************************************************************************************" + puts + exit + end + end end \ No newline at end of file
a little tidying up by moving exit strings into their own method
i0n_jumpstart
train
rb
26a8b9019fa615156c09b9d7de58ed3ba257ee41
diff --git a/lib/services/query.rb b/lib/services/query.rb index <HASH>..<HASH> 100644 --- a/lib/services/query.rb +++ b/lib/services/query.rb @@ -64,10 +64,26 @@ module Services scope = scope.where.not(id: v) when :order next unless v - order = case v - when 'random' then 'RANDOM()' - when /\./ then v - else "#{object_class.table_name}.#{v}" + case v + when 'random' + order = 'RANDOM()' + when /\A([A-Za-z0-9_]+)\./ + table_name = $1 + unless table_name == object_class.table_name + unless reflection = object_class.reflections.values.detect { |reflection| reflection.table_name == table_name } + fail "Reflection on class #{object_class} with table name #{table_name} not found." + end + # TODO: In Rails 5, we can use #left_outer_joins + # http://blog.bigbinary.com/2016/03/24/support-for-left-outer-joins-in-rails-5.html + join_conditions = "LEFT OUTER JOIN #{table_name} ON #{table_name}.#{reflection.foreign_key} = #{object_class.table_name}.id" + if reflection.type + join_conditions << " AND #{table_name}.#{reflection.type} = '#{object_class}'" + end + scope = scope.joins(join_conditions) + end + order = v + else + order = "#{object_class.table_name}.#{v}" end scope = scope.order(order) when :limit
automatically add LEFT OUTER JOIN when trying to sort by a field on an association table
krautcomputing_services
train
rb
b980d5a8d325e0b677ea7e882a9bb8ea8775cc37
diff --git a/src/BoomCMS/Core/Editor/Editor.php b/src/BoomCMS/Core/Editor/Editor.php index <HASH>..<HASH> 100644 --- a/src/BoomCMS/Core/Editor/Editor.php +++ b/src/BoomCMS/Core/Editor/Editor.php @@ -12,7 +12,6 @@ class Editor const PREVIEW = 3; public static $default = Editor::PREVIEW; - public static $instance; /** * @@ -37,19 +36,6 @@ class Editor $this->state = $this->session->get($this->statePersistenceKey, $default); } - /** - * - * @return Editor - */ - public static function instance() - { - if (static::$instance === null) { - static::$instance = new static(new Auth(Session::instance()), Session::instance()); - } - - return static::$instance; - } - public function isDisabled() { return $this->hasState(static::DISABLED);
Deleted method Editor\Editor::instance()
boomcms_boom-core
train
php
29a35e3794144e138e6fd4b60eaceac62eef87db
diff --git a/lib/simple_navigation/rendering/renderer/base.rb b/lib/simple_navigation/rendering/renderer/base.rb index <HASH>..<HASH> 100644 --- a/lib/simple_navigation/rendering/renderer/base.rb +++ b/lib/simple_navigation/rendering/renderer/base.rb @@ -66,18 +66,31 @@ module SimpleNavigation expand_all? || item.selected? end - def suppress_link? - false + # to allow overriding when there is specific logic determining + # when a link should not be rendered (eg. breadcrumbs renderer + # does not render the final breadcrumb as a link when instructed + # not to do so.) + def suppress_link?(item) + item.url.nil? end + # determine and return link or static content depending on + # item/renderer conditions. def tag_for(item) - if item.url.nil? || suppress_link? + if suppress_link?(item) content_tag('span', item.name, link_options_for(item).except(:method)) else - link_to(item.name, item.url, link_options_for(item)) + link_to(item.name, item.url, options_for(item)) end end + # to allow overriding when link options should be special-cased + # (eg. links renderer uses item options for the a-tag rather + # than an li-tag). + def options_for(item) + link_options_for(item) + end + # Extracts the options relevant for the generated link # def link_options_for(item)
better superclass methods to allow renderer subclasses finer control over behaviour
codeplant_simple-navigation
train
rb
3a516187204a8144ced188cb7cfedacc7b36bb14
diff --git a/salt/wheel/config.py b/salt/wheel/config.py index <HASH>..<HASH> 100644 --- a/salt/wheel/config.py +++ b/salt/wheel/config.py @@ -25,6 +25,10 @@ def values(): def apply(key, value): ''' Set a single key + + .. note:: + + This will strip comments from your config file ''' path = __opts__['conf_file'] if os.path.isdir(path):
Added note about stripping comments from master config
saltstack_salt
train
py
b534aaf80e22f9ef5ba0e961bdf3c5656e53d717
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ with open("README.rst", "r") as fh: setuptools.setup( name="parsenvy", - version="2.0.5", + version="2.0.7", author="Nik Kantar", author_email="nik@nkantar.com", description="Enviously elegant environment variable parsing",
Fix bad version in setup.py
nkantar_Parsenvy
train
py
371fc0101b1b39f1f7b0c868f49db3cc1308087e
diff --git a/modeltranslation/admin.py b/modeltranslation/admin.py index <HASH>..<HASH> 100644 --- a/modeltranslation/admin.py +++ b/modeltranslation/admin.py @@ -8,6 +8,11 @@ from django.contrib.contenttypes import generic from modeltranslation.translator import translator from modeltranslation.utils import get_translation_fields +# Ensure that models are registered for translation before TranslationAdmin +# runs. The import is supposed to resolve a race condition between model import +# and translation registration in production (see issue 19). +import modeltranslation.models + class TranslationAdminBase(object): """
Resolved a race condition between model import and translation registration in production by ensuring that models are registered for translation before TranslationAdmin runs. Resolves issue <I> (thanks to carl.j.meyer).
deschler_django-modeltranslation
train
py
8c3db1c5c6007337ebe4cf5b0d45c0cbdd72f595
diff --git a/api/kv.go b/api/kv.go index <HASH>..<HASH> 100644 --- a/api/kv.go +++ b/api/kv.go @@ -156,7 +156,7 @@ func (k *KV) Keys(prefix, separator string, q *QueryOptions) ([]string, *QueryMe } func (k *KV) getInternal(key string, params map[string]string, q *QueryOptions) (*http.Response, *QueryMeta, error) { - r := k.c.newRequest("GET", "/v1/kv/"+key) + r := k.c.newRequest("GET", "/v1/kv/"+strings.TrimPrefix(key, "/")) r.setQueryOptions(q) for param, val := range params { r.params.Set(param, val) @@ -277,7 +277,7 @@ func (k *KV) DeleteTree(prefix string, w *WriteOptions) (*WriteMeta, error) { } func (k *KV) deleteInternal(key string, params map[string]string, q *WriteOptions) (bool, *WriteMeta, error) { - r := k.c.newRequest("DELETE", "/v1/kv/"+key) + r := k.c.newRequest("DELETE", "/v1/kv/"+strings.TrimPrefix(key, "/")) r.setWriteOptions(q) for param, val := range params { r.params.Set(param, val)
Trim leading slash on key to avoid redirect (golang/go#<I>) (#<I>)
hashicorp_consul
train
go
831ede7ecda46233c8db07e1431a5f94a84eec67
diff --git a/src/main/java/org/couchbase/mock/CouchbaseMock.java b/src/main/java/org/couchbase/mock/CouchbaseMock.java index <HASH>..<HASH> 100644 --- a/src/main/java/org/couchbase/mock/CouchbaseMock.java +++ b/src/main/java/org/couchbase/mock/CouchbaseMock.java @@ -133,6 +133,13 @@ public class CouchbaseMock implements HttpRequestHandler, Runnable { this(hostname, port, numNodes, numVBuckets, BucketType.BASE); } + /** + * The port of the http server providing the REST interface. + */ + public int getHttpPort() { + return httpServer.getPort(); + } + public Credentials getRequiredHttpAuthorization() { return requiredHttpAuthorization; }
Expose the port the http server is listening on in CouchbaseMock. Change-Id: Ifd<I>f2c4b<I>b1d6ead<I>deedb5f4 Reviewed-on: <URL>
couchbase_CouchbaseMock
train
java
99182e8b23c56547d99b739a20b99d38b8af0c44
diff --git a/test/cases/EmptyDisallow.php b/test/cases/EmptyDisallow.php index <HASH>..<HASH> 100644 --- a/test/cases/EmptyDisallow.php +++ b/test/cases/EmptyDisallow.php @@ -20,8 +20,10 @@ class EmptyDisallowTest extends \PHPUnit_Framework_TestCase $this->assertTrue($parser->isAllowed("/")); $this->assertTrue($parser->isAllowed("/article")); $this->assertTrue($parser->isDisallowed("/temp")); - - $this->assertTrue($parser->isAllowed("/temp", "spiderX")); + + // The next line is commented out due to a bug. Please see issue #34 + // https://github.com/t1gor/Robots.txt-Parser-Class/issues/34 + //$this->assertTrue($parser->isAllowed("/temp", "spiderX")); $this->assertTrue($parser->isDisallowed("/assets", "spiderX")); $this->assertTrue($parser->isAllowed("/forum", "spiderX"));
Disabled 1 test due to non-related unfixed bug
t1gor_Robots.txt-Parser-Class
train
php
9f42bd7565f4fa7ef37cc083c1191bb806c7b029
diff --git a/src/Console/KeyGenerateCommand.php b/src/Console/KeyGenerateCommand.php index <HASH>..<HASH> 100644 --- a/src/Console/KeyGenerateCommand.php +++ b/src/Console/KeyGenerateCommand.php @@ -24,7 +24,7 @@ class KeyGenerateCommand extends Command * * @return void */ - public function fire() + public function handle() { // call the action to generate a new key. $key = $this->generateRandomKey(); @@ -80,4 +80,4 @@ class KeyGenerateCommand extends Command // empty ending line. $this->line(''); } -} \ No newline at end of file +}
[FIX] rename method fire to handle
codecasts_laravel-jwt
train
php
feff78ac329eee5c24d46b7bce91a4b570c75b4e
diff --git a/system/HTTP/Request.php b/system/HTTP/Request.php index <HASH>..<HASH> 100644 --- a/system/HTTP/Request.php +++ b/system/HTTP/Request.php @@ -131,7 +131,7 @@ class Request extends Message implements RequestInterface if ($spoof) { - for ($i = 0, $c = count($this->proxyIPs); $i < $c; $i ++ ) + for ($i = 0, $c = count($proxy_ips); $i < $c; $i ++ ) { // Check if we have an IP address or a subnet if (strpos($proxy_ips[$i], '/') === FALSE)
php <I> fix Request::getIPAddress() error count(): Parameter must be an array or an object that implements Countable
codeigniter4_CodeIgniter4
train
php
b44ec92f4bea566978d533328de0efbc6abbbfba
diff --git a/Util/Factory/Query/QueryInterface.php b/Util/Factory/Query/QueryInterface.php index <HASH>..<HASH> 100644 --- a/Util/Factory/Query/QueryInterface.php +++ b/Util/Factory/Query/QueryInterface.php @@ -105,6 +105,15 @@ interface QueryInterface function setWhere($where, array $params = array()); /** + * set search + * + * @param bool $search + * + * @return Datatable + */ + function setSearch($search); + + /** * add join * * @example: @@ -122,4 +131,4 @@ interface QueryInterface * @return Datatable */ function addJoin($join_field, $alias, $type = Join::INNER_JOIN, $cond = ''); -} \ No newline at end of file +}
add missing requirement for search call in query interface
waldo2188_DatatableBundle
train
php
038153a3641b6192240923b3ceacb9e6566f40a3
diff --git a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/greedy_dual/GDWheelPolicy.java b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/greedy_dual/GDWheelPolicy.java index <HASH>..<HASH> 100644 --- a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/greedy_dual/GDWheelPolicy.java +++ b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/greedy_dual/GDWheelPolicy.java @@ -122,7 +122,7 @@ public final class GDWheelPolicy implements Policy { clockHand[level] = hand; // if C[idx] has advanced a whole round back to 1, call migration(idx+1) - if ((hand == 0) && (level < wheel.length)) { + if ((hand == 0) && (level + 1 < wheel.length)) { migrate(level + 1); }
Update GDWheelPolicy.java A fix for null pointer in migrate. changed the condition of the if statment as to not cause a null pointer exception by trying to access wheel at index that is out of bounds.
ben-manes_caffeine
train
java
bed55d95a2c95804e50c16b96e13106c63a9d62d
diff --git a/conversejs/boshclient.py b/conversejs/boshclient.py index <HASH>..<HASH> 100644 --- a/conversejs/boshclient.py +++ b/conversejs/boshclient.py @@ -6,11 +6,12 @@ Based on https://friendpaste.com/1R4PCcqaSWiBsveoiq3HSy """ +import gzip +import socket import base64 import httplib import logging import StringIO -import gzip from random import randint from urlparse import urlparse @@ -87,7 +88,7 @@ class BOSHClient(object): # TODO: raise proper exception raise Exception('Invalid URL scheme %s' % self.bosh_service.scheme) - self._connection = Connection(self.bosh_service.netloc) + self._connection = Connection(self.bosh_service.netloc, timeout=10) self.log.debug('Connection initialized') # TODO add exceptions handler there (URL not found etc) @@ -308,7 +309,15 @@ class BOSHClient(object): self.send_request(body) def get_credentials(self): - success = self.authenticate_xmpp() + try: + success = self.authenticate_xmpp() + except socket.error as error: + success = False + self.log.exception(error) + + msg = 'Error trying to connect to bosh service: %s' + self.log.error(msg, self.bosh_service.netloc) + if not success: return None, None, None
Setting timeout to punjab connections
TracyWebTech_django-conversejs
train
py
f6a4b50838365432ca579e2aa335e26257c880bc
diff --git a/src/Kris/LaravelFormBuilder/Fields/FormField.php b/src/Kris/LaravelFormBuilder/Fields/FormField.php index <HASH>..<HASH> 100644 --- a/src/Kris/LaravelFormBuilder/Fields/FormField.php +++ b/src/Kris/LaravelFormBuilder/Fields/FormField.php @@ -248,7 +248,7 @@ abstract class FormField private function setTemplate() { $this->template = $this->parent->getFormHelper() - ->getConfig($this->getTemplate()); + ->getConfig($this->getTemplate(), $this->getTemplate()); } /**
Set loading the form field template if config for it not found.
kristijanhusak_laravel-form-builder
train
php
d2b10333d4c3350d79c0fb952051d2e9a4f18d64
diff --git a/gimmemotifs/maelstrom.py b/gimmemotifs/maelstrom.py index <HASH>..<HASH> 100644 --- a/gimmemotifs/maelstrom.py +++ b/gimmemotifs/maelstrom.py @@ -233,11 +233,17 @@ def run_maelstrom(infile, genome, outdir, pwmfile=None, plot=True, cluster=True, shutil.copyfile(infile, os.path.join(outdir, "input.table.txt")) config = MotifConfig() + motif_dir = config.get_motif_dir() # Default pwmfile if pwmfile is None: pwmfile = config.get_default_params().get("motif_db", None) - if pwmfile is not None: - pwmfile = os.path.join(config.get_motif_dir(), pwmfile) + + if pwmfile is not None and not os.path.exists(pwmfile): + checkfile = os.path.join(motif_dir, pwmfile) + if not os.path.exists(checkfile): + checkfile += ".pwm" + if os.path.exists(checkfile): + pwmfile = checkfile if pwmfile: shutil.copy2(pwmfile, outdir)
fix to work with maelstrom
vanheeringen-lab_gimmemotifs
train
py
3889ec754b0ce8ed7008cb330f89cc964a4a4ddd
diff --git a/TwitterAPIExchange.php b/TwitterAPIExchange.php index <HASH>..<HASH> 100755 --- a/TwitterAPIExchange.php +++ b/TwitterAPIExchange.php @@ -166,7 +166,7 @@ class TwitterAPIExchange } } - $this->getfield = '?' . http_build_query($params); + $this->getfield = '?' . http_build_query($params, '', '&'); return $this; } @@ -298,7 +298,7 @@ class TwitterAPIExchange if (!is_null($postfields)) { - $options[CURLOPT_POSTFIELDS] = http_build_query($postfields); + $options[CURLOPT_POSTFIELDS] = http_build_query($postfields, '', '&'); } else {
Explicitly use '&' in http_build_query() (#<I>)
J7mbo_twitter-api-php
train
php
4a416e177aa5037ba9436e53f531631707e87ea7
diff --git a/sanic/cli/arguments.py b/sanic/cli/arguments.py index <HASH>..<HASH> 100644 --- a/sanic/cli/arguments.py +++ b/sanic/cli/arguments.py @@ -181,19 +181,12 @@ class DevelopmentGroup(Group): dest="debug", action="store_true", help=( - "Run the server in DEBUG mode. It includes DEBUG logging, " - "additional context on exceptions, and other settings " + "Run the server in DEBUG mode. It includes DEBUG logging,\n" + "additional context on exceptions, and other settings\n" "not-safe for PRODUCTION, but helpful for debugging problems." ), ) self.container.add_argument( - "-d", - "--dev", - dest="dev", - action="store_true", - help=("Debug + auto_reload."), - ) - self.container.add_argument( "-r", "--reload", "--auto-reload", @@ -211,6 +204,13 @@ class DevelopmentGroup(Group): action="append", help="Extra directories to watch and reload on changes", ) + self.container.add_argument( + "-d", + "--dev", + dest="dev", + action="store_true", + help=("debug + auto reload."), + ) class OutputGroup(Group):
Updates to CLI help messaging (#<I>)
huge-success_sanic
train
py
f895d18e7d78a0f0a17367d3d8d2c3d633bebbe3
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -16,13 +16,9 @@ setup( 'Programming Language :: Java', 'Programming Language :: Python', 'Programming Language :: Python :: 2', - 'Programming Language :: Python :: 2.5', 'Programming Language :: Python :: 2.6', 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.0', - 'Programming Language :: Python :: 3.1', - 'Programming Language :: Python :: 3.2', 'Programming Language :: Python :: 3.3', 'Programming Language :: Python :: 3.4', 'Programming Language :: Python :: 3.5',
Update setup.py to reflect the supported Python versions
kurtmckee_listparser
train
py
b661933d0ba1061355e7145570115f8ad16be4de
diff --git a/lib/twitter/version.rb b/lib/twitter/version.rb index <HASH>..<HASH> 100644 --- a/lib/twitter/version.rb +++ b/lib/twitter/version.rb @@ -4,7 +4,7 @@ module Twitter::Version #:nodoc: MAJOR = 0 MINOR = 5 - REVISION = 0 + REVISION = 1 class << self # Returns X.Y.Z formatted version string def to_version
Upped version number for Twitter4R to <I>.
twitter4r_twitter4r-core
train
rb
a8325974427766b1f16474fd9b6f2df91446683f
diff --git a/Swat/SwatFileEntry.php b/Swat/SwatFileEntry.php index <HASH>..<HASH> 100644 --- a/Swat/SwatFileEntry.php +++ b/Swat/SwatFileEntry.php @@ -105,7 +105,9 @@ class SwatFileEntry extends SwatInputControl $msg = Swat::_('The %s field is required.'); $this->addMessage(new SwatMessage($msg, SwatMessage::ERROR)); - } elseif (!in_array($this->getMimeType(), $this->accept_mime_types)) { + } elseif ($this->accept_mime_types !== null && + !in_array($this->getMimeType(), $this->accept_mime_types)) { + $msg = sprintf(Swat::_('The %s field must be of the following type(s): %s.'), '%s', implode(', ', $this->accept_mime_types));
Fixed bug when mime types aren't specified svn commit r<I>
silverorange_swat
train
php
8555ff5fb3f3367f81589df3bb6ea3717ac78565
diff --git a/lib/Cake/Test/TestCase/Model/Datasource/Database/QueryTest.php b/lib/Cake/Test/TestCase/Model/Datasource/Database/QueryTest.php index <HASH>..<HASH> 100644 --- a/lib/Cake/Test/TestCase/Model/Datasource/Database/QueryTest.php +++ b/lib/Cake/Test/TestCase/Model/Datasource/Database/QueryTest.php @@ -467,4 +467,21 @@ class QueryTest extends \Cake\TestSuite\TestCase { $this->assertEquals(['id' => 2], $result->fetch('assoc')); } +/** + * Tests that Query::andWhere() can be used without calling where() before + * + * @return void + **/ + public function testSelectAndWhereNoPreviousCondition() { + $this->_insertDateRecords(); + $query = new Query($this->connection); + $result = $query + ->select(['id']) + ->from('dates') + ->andWhere(['posted' => new \DateTime('2012-12-21 12:00')], ['posted' => 'datetime']) + ->andWhere(['id' => 1]) + ->execute(); + $this->assertCount(1, $result); + $this->assertEquals(['id' => 1], $result->fetch('assoc')); + } }
Adding missing test case form previous commit
cakephp_cakephp
train
php
50cbcfe841195c95aa19e0aaa5c138e595455abe
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -18,7 +18,7 @@ if not version: with open(path.join(here, 'README.md'), encoding='utf-8') as readme: LONG_DESC = readme.read() -os.system('pip install git+https://github.com/RegardsCitoyens/lawfactory_utils.git@master') +os.system('pip install --upgrade git+https://github.com/RegardsCitoyens/lawfactory_utils.git@master') setup( name='anpy',
force upgrade lawfactory-utils
regardscitoyens_anpy
train
py
b352bca972c6199a83cda7016d476a4aa32bdbf2
diff --git a/salt/modules/daemontools.py b/salt/modules/daemontools.py index <HASH>..<HASH> 100644 --- a/salt/modules/daemontools.py +++ b/salt/modules/daemontools.py @@ -15,7 +15,10 @@ __outputter__ = { 'get_all': 'yaml', } -SERVICE_DIR = "/service" +if os.path.exists('/service'): + SERVICE_DIR = "/service" +elif os.path.exists('/var/service'): + SERVICE_DIR = "/var/service" def _service_path(name):
Added test to support alternate SERVICE_DIR location
saltstack_salt
train
py
0ed367762c03adfcdd555513a3e7ba78a803eb16
diff --git a/lib/ditty/controllers/main.rb b/lib/ditty/controllers/main.rb index <HASH>..<HASH> 100644 --- a/lib/ditty/controllers/main.rb +++ b/lib/ditty/controllers/main.rb @@ -133,8 +133,8 @@ module Ditty broadcast(:user_logout, target: self, details: "IP: #{request.ip}") logout flash[:info] = 'Logged Out' - - redirect "#{settings.map_path}/" + halt 200 if request.xhr? + redirect("#{settings.map_path}/") end post '/auth/identity/callback' do @@ -143,6 +143,7 @@ module Ditty user = User.find(email: env['omniauth.auth']['info']['email']) self.current_user = user broadcast(:user_login, target: self, details: "IP: #{request.ip}") + halt 200 if request.xhr? flash[:success] = 'Logged In' redirect redirect_path else @@ -165,6 +166,7 @@ module Ditty end self.current_user = user broadcast(:user_login, target: self, details: "IP: #{request.ip}") + halt 200 if request.xhr? flash[:success] = 'Logged In' redirect redirect_path else
chore: Return <I>s on successful XHR logins
EagerELK_ditty
train
rb
387e4e104a6643cb5768bed1016ce54c4f1e8796
diff --git a/niworkflows/viz/utils.py b/niworkflows/viz/utils.py index <HASH>..<HASH> 100644 --- a/niworkflows/viz/utils.py +++ b/niworkflows/viz/utils.py @@ -303,8 +303,8 @@ def compose_view(bg_svgs, fg_svgs, ref=0, out_file='report.svg'): svgt.GroupElement(roots[3:], {'class': 'foreground-svg'}) ] fig.append(newroots) - fig.root.del("width") - fig.root.del("height") + fig.root.pop("width") + fig.root.pop("height") fig.root.set("preserveAspectRatio", "xMidYMid meet") out_file = op.abspath(out_file) fig.save(out_file)
del is not callable like that...
poldracklab_niworkflows
train
py
e23d38bb376895244717dbe4f5c5137d05846159
diff --git a/iothrottler.go b/iothrottler.go index <HASH>..<HASH> 100644 --- a/iothrottler.go +++ b/iothrottler.go @@ -72,6 +72,9 @@ func throttlerPoolDriver(pool *IOThrottlerPool) { timeout := time.NewTicker(time.Second) var thisBandwidthAllocatorChan chan Bandwidth = nil + // Start the timer until we get the first client + timeout.Stop() + recalculateAllocationSize := func() { if currentBandwidth == Unlimited { totalbandwidth = Unlimited
Don't start the time until we get our first client
efarrer_iothrottler
train
go
a3d44ca91cf66deaa870a1ab18572838aec9e743
diff --git a/spec/functional/resource/group_spec.rb b/spec/functional/resource/group_spec.rb index <HASH>..<HASH> 100644 --- a/spec/functional/resource/group_spec.rb +++ b/spec/functional/resource/group_spec.rb @@ -105,7 +105,11 @@ describe Chef::Resource::Group, :requires_root_or_running_windows, :not_supporte end def remove_user(username) - user(username).run_action(:remove) if ! windows_domain_user?(username) + if ! windows_domain_user?(username) + u = user(username) + u.manage_home false # jekins hosts throw mail spool file not owned by user if we use manage_home true + u.run_action(:remove) + end # TODO: User shouldn't exist end
try to fix el breaks the default behavior of the remove action changed to have manage_home set toi true to match the :create action
chef_chef
train
rb
4b55b78dd35560bb3320b8080356155de4c17cb0
diff --git a/raiden/ui/cli.py b/raiden/ui/cli.py index <HASH>..<HASH> 100644 --- a/raiden/ui/cli.py +++ b/raiden/ui/cli.py @@ -364,4 +364,4 @@ def run(ctx, **kwargs): gevent.signal(signal.SIGINT, event.set) event.wait() - app_.stop(leave_channels=True) + app_.stop(leave_channels=False)
Do not close/settle channels at shutdown From our discussions on restartability/recoverability we should not be closing all channels by default at shutdown unless otherwise specifically requested.
raiden-network_raiden
train
py
7dc65d8e762a00e2457e9150aefce83a376502b9
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -10,7 +10,7 @@ with open("README.md", "r") as fh: setup( name='django-cra-helper', - version='1.2.3', + version='2.0.0', description='The missing piece of the Django + React puzzle', long_description=long_description, long_description_content_type="text/markdown",
Bump package version to <I>
MasterKale_django-cra-helper
train
py
053816cd6176e5df815d66a10c3f2689626d9a7a
diff --git a/src/FOM/UserBundle/EventListener/UserProfileListener.php b/src/FOM/UserBundle/EventListener/UserProfileListener.php index <HASH>..<HASH> 100644 --- a/src/FOM/UserBundle/EventListener/UserProfileListener.php +++ b/src/FOM/UserBundle/EventListener/UserProfileListener.php @@ -124,14 +124,9 @@ class UserProfileListener implements EventSubscriber */ protected function isProfileEntity($className) { - // this is checked for ALL entity types, so do as few instance checks as possible - $defaultClass = 'FOM\UserBundle\Entity\BasicProfile'; - if (\is_a($className, $defaultClass, true)) { - return true; - } elseif ($this->profileEntityName !== $defaultClass) { - return \is_a($className, $this->profileEntityName); - } else { - return false; - } + // ONLY detect the configured class + // Relation from one User entity class to multiple different profile entity classes + // cannot be established, so we won't try + return ltrim($className, '\\') === $this->profileEntityName; } }
Limit user => profile mapping to exact configured profile class
mapbender_fom
train
php
97e58ad6d88a29016006c9efa33ffd93e54444b0
diff --git a/src/support.js b/src/support.js index <HASH>..<HASH> 100644 --- a/src/support.js +++ b/src/support.js @@ -25,7 +25,7 @@ export const matrix = { 11: 0b01000000000100000000 }, edge: { - 12: 0b01011010100101001101, + 12: 0b01001010100101001101, 13: 0b01011110100111001111 }, node: {
Edge <I> does not fully support u flag for regexes
bublejs_buble
train
js
d64e54d61aab0084e66f586d5bda086602ee995a
diff --git a/packages/now-cli/src/util/index.js b/packages/now-cli/src/util/index.js index <HASH>..<HASH> 100644 --- a/packages/now-cli/src/util/index.js +++ b/packages/now-cli/src/util/index.js @@ -388,7 +388,12 @@ export default class Now extends EventEmitter { if (!app && !Object.keys(meta).length) { // Get the 20 latest projects and their latest deployment const query = new URLSearchParams({ limit: (20).toString() }); - const projects = await fetchRetry(`/v2/projects/?${query}`); + if (nextTimestamp) { + query.set('until', String(nextTimestamp)); + } + const { projects, pagination } = await fetchRetry( + `/v4/projects/?${query}` + ); const deployments = await Promise.all( projects.map(async ({ id: projectId }) => { @@ -400,7 +405,7 @@ export default class Now extends EventEmitter { }) ); - return { deployments: deployments.filter(x => x) }; + return { deployments: deployments.filter(x => x), pagination }; } const query = new URLSearchParams();
Implement pagination for `now ls` (#<I>)
zeit_now-cli
train
js
bdd82fb42e657b84239200866a888019e03341d8
diff --git a/blueflood-core/src/main/java/com/rackspacecloud/blueflood/service/ScheduleContext.java b/blueflood-core/src/main/java/com/rackspacecloud/blueflood/service/ScheduleContext.java index <HASH>..<HASH> 100644 --- a/blueflood-core/src/main/java/com/rackspacecloud/blueflood/service/ScheduleContext.java +++ b/blueflood-core/src/main/java/com/rackspacecloud/blueflood/service/ScheduleContext.java @@ -151,9 +151,11 @@ public class ScheduleContext implements IngestionContext, ScheduleContextMBean { this.clock = clock; registerMBean(); } - public ScheduleContext(long currentTimeMillis, Collection<Integer> managedShards) { - this(currentTimeMillis, managedShards, new DefaultClockImpl()); + this.scheduleTime = currentTimeMillis; + this.shardStateManager = new ShardStateManager(managedShards, asMillisecondsSinceEpochTicker()); + this.lockManager = new NoOpShardLockManager(); + this.clock = new DefaultClockImpl(); registerMBean(); } @VisibleForTesting
Initialize fields in the constructor. Don't indirectly call registerMBean.
rackerlabs_blueflood
train
java
df97f72590d41b4bfc97c03aa671811238026842
diff --git a/src/Monarkee/Bumble/Fields/DateTimeField.php b/src/Monarkee/Bumble/Fields/DateTimeField.php index <HASH>..<HASH> 100644 --- a/src/Monarkee/Bumble/Fields/DateTimeField.php +++ b/src/Monarkee/Bumble/Fields/DateTimeField.php @@ -21,4 +21,27 @@ class DateTimeField extends TextField implements FieldInterface { return Carbon::parse($value)->format($this->getFormat()); } + + /** + * Process the DateTimeField data + * + * @param $model + * @param $input + * @return BumbleModel + */ + public function process($model, $input) + { + $column = $this->getColumn(); + + // Handle a special case where the data in the database is 0000-00-00 00:00:00 + if ($input[$column] == '-0001-11-30 00:00:00') + { + $model->{$column} = Carbon::now(); + } + elseif(isset($input[$column])) { + $model->{$column} = $input[$column]; + } + + return $model; + } }
Fix bug in DateTimeField where the row had a column value like <I>-<I>-<I> <I>:<I>:<I>
monarkee_bumble
train
php
55d18efef88151356ae62aa1debbb8437d48ea56
diff --git a/zounds/learn/wgan.py b/zounds/learn/wgan.py index <HASH>..<HASH> 100644 --- a/zounds/learn/wgan.py +++ b/zounds/learn/wgan.py @@ -230,9 +230,9 @@ class WassersteinGanTrainer(Trainer): g_loss.backward() self.generator_optim.step() - gl = g_loss.data[0] - dl = d_loss.data[0] - rl = real_mean.data[0] + gl = g_loss.data.item() + dl = d_loss.data.item() + rl = real_mean.data.item() self.on_batch_complete( epoch=epoch,
Use new item() method after upgrade to pytorch <I>
JohnVinyard_zounds
train
py
a06ca53a848752a1c2063f14f05df2e2db033a0b
diff --git a/app/helpers/bootstrap_admin/menu_helper.rb b/app/helpers/bootstrap_admin/menu_helper.rb index <HASH>..<HASH> 100644 --- a/app/helpers/bootstrap_admin/menu_helper.rb +++ b/app/helpers/bootstrap_admin/menu_helper.rb @@ -55,7 +55,12 @@ module BootstrapAdmin::MenuHelper # ============================================================================= def bootstrap_admin_menu_item row - if respond_to?(:cannot?) && cannot?(:read, row[:item].classify.constantize) + obj = if row[:namespace] + "#{row[:namespace]}::#{row[:item]}" + else + row[:item] + end + if respond_to?(:cannot?) && cannot?(:read, obj.classify.constantize) "".html_safe else content_tag(:li) do
fix for support namespaced models in bootstrap_admin_menu_item
LynxEyes_bootstrap_admin
train
rb
41bd21e0f2223fd3a350992ada99d94a3618465e
diff --git a/tests/tests/Localization/Address/FormatterTest.php b/tests/tests/Localization/Address/FormatterTest.php index <HASH>..<HASH> 100644 --- a/tests/tests/Localization/Address/FormatterTest.php +++ b/tests/tests/Localization/Address/FormatterTest.php @@ -71,13 +71,15 @@ class FormatterTest extends TestCase // out and defines in which language the administrative area is printed $address = $address->withLocale('en'); $address = $address->withCountryCode('JP'); - $address = $address->withAddressLine1('1-13, Chiyoda'); + $address = $address->withAddressLine1('1-13'); + $address = $address->withAddressLine2('Chiyoda'); $address = $address->withAdministrativeArea('13'); $address = $address->withLocality('Tokyo'); $address = $address->withPostalCode('101-0054'); $this->assertEquals( - '1-13, Chiyoda' . "\n" . + '1-13' . "\n" . + 'Chiyoda' . "\n" . 'Tokyo, Tokyo' . "\n" . '101-0054' . "\n" . 'Japan',
Move the area name to its own line
concrete5_concrete5
train
php
74df76272051083312ad98f10d1d9c224ee21336
diff --git a/src/Parser/Top/TopListItemParser.php b/src/Parser/Top/TopListItemParser.php index <HASH>..<HASH> 100644 --- a/src/Parser/Top/TopListItemParser.php +++ b/src/Parser/Top/TopListItemParser.php @@ -102,7 +102,7 @@ class TopListItemParser */ public function getType(): string { - return preg_replace('/^(\w+).*$/', '$1', $this->getTextArray()[0]); + return preg_replace('~(.*)\s\(.*~', '$1', $this->getTextArray()[0]); } /**
fix parsing of type light novel
jikan-me_jikan
train
php
0d9c36745a9e3ecb0332ab1802d34cb42e78b6d0
diff --git a/lib/mini_fb.rb b/lib/mini_fb.rb index <HASH>..<HASH> 100644 --- a/lib/mini_fb.rb +++ b/lib/mini_fb.rb @@ -643,7 +643,7 @@ module MiniFB resp = RestClient.get url end - @@log.debug 'resp=' + resp.to_s + @@log.debug 'resp=' + resp.to_s if @@log.debug? if options[:response_type] == :params # Some methods return a param like string, for example: access_token=11935261234123|rW9JMxbN65v_pFWQl5LmHHABC
Checks log level before inspecting a debug log
appoxy_mini_fb
train
rb
e60b846a97c1973b9f23988f3796d4334d2d404d
diff --git a/src/fury.js b/src/fury.js index <HASH>..<HASH> 100644 --- a/src/fury.js +++ b/src/fury.js @@ -61,12 +61,12 @@ class Fury { if (adapter) { try { adapter.parse({generateSourceMap, minim, source}, (err, elements) => { - if (err) { return done(err, elements); } - - if (elements instanceof minim.BaseElement) { - done(null, elements); + if (!elements) { + done(err); + } else if (elements instanceof minim.BaseElement) { + done(err, elements); } else { - done(null, this.load(elements)); + done(err, this.load(elements)); } }); } catch (err) { diff --git a/test/fury.js b/test/fury.js index <HASH>..<HASH> 100644 --- a/test/fury.js +++ b/test/fury.js @@ -278,7 +278,7 @@ describe('Parser', () => { fury.parse({source: 'dummy'}, (err, elements) => { assert.equal(err, expectedError); - assert.equal(elements, expectedElements); + assert.deepEqual(elements, fury.load(expectedElements)); done(); }); });
Process API Elements by minim on error as well.
apiaryio_fury.js
train
js,js
e0dfd0650bee5adb1dba0586eda811aa91f82296
diff --git a/tests/test_utils.py b/tests/test_utils.py index <HASH>..<HASH> 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -1,4 +1,5 @@ """ Tests for jtime utils module """ +import datetime import mock import sys if sys.version_info < (2, 7): @@ -23,3 +24,13 @@ class JtimeUtilsTestCase(unittest.TestCase): def test_get_input_bad_input(self): input_func = mock.Mock(side_effect=["", None, "input!"]) utils.get_input(input_func, "Test to get input!") + + def test_timedelta_total_seconds(self): + one_day = datetime.timedelta(1) # 1 day + one_day_sec = 60 * 60 * 24 + + one_hr = datetime.timedelta(hours=1) + one_hr_sec = 60 * 60 + + self.assertEquals(utils.timedelta_total_seconds(one_day), one_day_sec) + self.assertEquals(utils.timedelta_total_seconds(one_hr), one_hr_sec)
Adding tests around timedelta to total seconds method.
mapmyfitness_jtime
train
py
a9549be691575fb043e7b7a2531da75b2e2272de
diff --git a/app/controllers/content_items_controller.rb b/app/controllers/content_items_controller.rb index <HASH>..<HASH> 100644 --- a/app/controllers/content_items_controller.rb +++ b/app/controllers/content_items_controller.rb @@ -24,8 +24,8 @@ class ContentItemsController < AdminController title = @content_item.field_items.find { |field_item| field_item.field.name == 'Title' }.data['text'] add_breadcrumb content_type.name.pluralize, :content_type_content_items_path - add_breadcrumb 'Edit' add_breadcrumb title + add_breadcrumb 'Edit' end def update
Flip order of title/edit breadcrumbs in ContentItem.edit
cortex-cms_cortex
train
rb
f3dbbb77dbf83ca12064dc2fc903e0a49d667e70
diff --git a/addon/components/as-sidebar.js b/addon/components/as-sidebar.js index <HASH>..<HASH> 100644 --- a/addon/components/as-sidebar.js +++ b/addon/components/as-sidebar.js @@ -28,10 +28,14 @@ export default Ember.Component.extend(TransitionDurationMixin, { Ember.run.later(function() { cancelAnimationFrame(calculationId); - }, this.get('transitionDuration')); + }, this.get('_recalculationDuration')); } }), + _recalculationDuration: Ember.computed('transitionDuration', function() { + return this.get('transitionDuration') + 100; + }), + actions: { toggleCollapse: function() { this.toggleProperty('isCollapsed');
Allow duration to complete before stopping sidebar recalculation
alphasights_ember-cli-paint
train
js
74faea84fd9914f83eb971e34b6f9f605f6d2aa6
diff --git a/scraper.rb b/scraper.rb index <HASH>..<HASH> 100644 --- a/scraper.rb +++ b/scraper.rb @@ -35,8 +35,8 @@ class Scraper @doc.search(selector).each do |node| send(target) << parse_result(node, delegate) end - elsif node = @doc.at(selector) - send("#{target}=", parse_result(node, delegate)) + else + send("#{target}=", parse_result(@doc.at(selector), delegate)) end end self @@ -52,7 +52,7 @@ class Scraper node.inner_text else node.to_s - end + end unless node.nil? end private @@ -195,6 +195,14 @@ if __FILE__ == $0 article.published.should == 'Sep 5' article.link.should == 'http://mislav.uniqpath.com' end + + it "should override singular properties when re-parsing" do + blog = @blog.dup + blog.instance_variable_set('@doc', Nokogiri::HTML('')) + blog.parse + blog.title.should be_nil + blog.should have(2).articles + end end describe SpecialArticle do
`Scraper#parse` overrides any value that singular properties might have had
mislav_nibbler
train
rb
735e6979efbc8eca0656813b3e7cc635319b96b7
diff --git a/experiment/flakedetector.py b/experiment/flakedetector.py index <HASH>..<HASH> 100755 --- a/experiment/flakedetector.py +++ b/experiment/flakedetector.py @@ -41,7 +41,7 @@ data = r.json() jobs = {} for job in data: - if job['type'] != 'pr': + if job['type'] != 'presubmit': continue if job['repo'] != 'kubernetes/kubernetes': continue
Fix pr->presubmit in flakedetector.py.
kubernetes_test-infra
train
py
54d048c9868658fe4c1864398ae0785a51ced5e4
diff --git a/lib/electron-browser.js b/lib/electron-browser.js index <HASH>..<HASH> 100644 --- a/lib/electron-browser.js +++ b/lib/electron-browser.js @@ -75,6 +75,8 @@ Electron.prototype.start = function () { var split = Split() split.on('data', function (line) { + if (line === '') return + var msg try { msg = JSON.parse(line)
fix electron on windows by ignoring empty output lines
airtap_airtap
train
js
c00c2378e8cc8243e971c7ba57f019ad665095ca
diff --git a/electron/main.js b/electron/main.js index <HASH>..<HASH> 100644 --- a/electron/main.js +++ b/electron/main.js @@ -32,8 +32,7 @@ function createWindow () { win = new BrowserWindow({ width: 1280, height: 800, - titleBarStyle: 'hidden-inset', - fullscreen: true + titleBarStyle: 'hidden-inset' }); // Populate the application menu
Removed fullScreen option when creating browser window.
imolorhe_altair
train
js
8fa77c88cbbb1a3a70d067ec672abdd14253966f
diff --git a/broqer/hub.py b/broqer/hub.py index <HASH>..<HASH> 100644 --- a/broqer/hub.py +++ b/broqer/hub.py @@ -161,6 +161,8 @@ class Topic(Publisher, Subscriber): return self._subject.emit(value, who=self) def assign(self, subject): + assert isinstance(subject, (Publisher, Subscriber)) + if self._subject is not None: raise SubscriptionError('Topic is already assigned') self._subject = subject
added assert for hub.assign
semiversus_python-broqer
train
py
bc5a4f1d5aa797d0d4ef342dc2573f391fd902a8
diff --git a/intranet/static/js/common.js b/intranet/static/js/common.js index <HASH>..<HASH> 100644 --- a/intranet/static/js/common.js +++ b/intranet/static/js/common.js @@ -76,7 +76,7 @@ try { udlr.input = ""; e.preventDefault(); return false; - } else if (udlr.input === udlr.pattern.substr(0, udlr.input.length)) e.preventDefault(); + } else udlr.input = ""; }, this); this.iphone.load(link);
If the konami code is being entered, don't preventDefault
tjcsl_ion
train
js
2b65338b01caa68629429411be568c250068c97f
diff --git a/lib/create-runner.js b/lib/create-runner.js index <HASH>..<HASH> 100644 --- a/lib/create-runner.js +++ b/lib/create-runner.js @@ -104,8 +104,8 @@ export default function createRunner(options = {}, configFunc) { const atomHome = temp.mkdirSync({ prefix: "atom-test-home-" }); if (options.testPackages.length > 0) { let { testPackages } = options; - if (typeof options.testPackages === "string") { - testPackages = options.testPackage.split(/\s+/); + if (typeof testPackages === "string") { + testPackages = testPackages.split(/\s+/); } // eslint-disable-next-line no-sync fs.makeTreeSync(path.join(atomHome, "packages"));
fix(testPackages): Fix `testPackages` as string
UziTech_atom-jasmine3-test-runner
train
js
a808888ea22e6c8d216c2fb4c0d373a765715dd2
diff --git a/lib/index.js b/lib/index.js index <HASH>..<HASH> 100644 --- a/lib/index.js +++ b/lib/index.js @@ -204,7 +204,7 @@ }; } - return function (req, res, next) { + return function corsMiddleware(req, res, next) { optionsCallback(req, function (err, options) { if (err) { next(err);
Name currently anonymous middleware function - providing a name makes debugging & memory inspection much easier :)
expressjs_cors
train
js
e87328204484a75bb9c451533d487a52e36daa9d
diff --git a/vyper/ast/nodes.py b/vyper/ast/nodes.py index <HASH>..<HASH> 100644 --- a/vyper/ast/nodes.py +++ b/vyper/ast/nodes.py @@ -802,10 +802,7 @@ class NameConstant(Constant): class Name(VyperNode): - __slots__ = ( - "id", - "_type", - ) + __slots__ = ("id",) class Expr(VyperNode): diff --git a/vyper/parser/stmt.py b/vyper/parser/stmt.py index <HASH>..<HASH> 100644 --- a/vyper/parser/stmt.py +++ b/vyper/parser/stmt.py @@ -234,7 +234,9 @@ class Stmt: # attempt to use the type specified by type checking, fall back to `int128` # this is a stopgap solution to allow uint256 - it will be properly solved # once we refactor `vyper.parser` - iter_typ = self.stmt.target.get("_type") or "int128" + iter_typ = "int128" + if "type" in self.stmt.target._metadata: + iter_typ = self.stmt.target._metadata["type"]._id # Get arg0 arg0 = self.stmt.iter.args[0]
refactor: use metadata for iterator type
ethereum_vyper
train
py,py
71ea6cff9939a1d113d83d5ae3ed4751635e2fff
diff --git a/packages/cozy-jobs-cli/src/manifest.js b/packages/cozy-jobs-cli/src/manifest.js index <HASH>..<HASH> 100644 --- a/packages/cozy-jobs-cli/src/manifest.js +++ b/packages/cozy-jobs-cli/src/manifest.js @@ -21,5 +21,13 @@ module.exports = { } function getManifest (manifestPath) { - return JSON.parse(fs.readFileSync(manifestPath)) + let manifest + try { + manifest = JSON.parse(fs.readFileSync(manifestPath)) + } catch (err) { + log('error', `Error while parsing ${manifestPath}`) + log('error', err.message) + process.exit() + } + return manifest }
fix: handle manifest parsing errors
konnectors_libs
train
js
459c13a90c167487cd63dc441872df8fdc55d46c
diff --git a/src/EntityRepository.php b/src/EntityRepository.php index <HASH>..<HASH> 100644 --- a/src/EntityRepository.php +++ b/src/EntityRepository.php @@ -42,6 +42,10 @@ class EntityRepository extends Doctrine\ORM\EntityRepository */ public function build(Array $terms = NULL, $order = array(), $limit = NULL, $page = 1) { + if (!$order) { + $order = array(); + } + $builder = $this->createQueryBuilder(static::ALIAS_NAME); if ($limit) {
Fix cases where NULL is passed as order
imarc_tenet
train
php
a574c75bba01c078ee5c71e2978f16e2250b7608
diff --git a/src/GeoDataCollection.js b/src/GeoDataCollection.js index <HASH>..<HASH> 100644 --- a/src/GeoDataCollection.js +++ b/src/GeoDataCollection.js @@ -905,9 +905,10 @@ GeoDataCollection.prototype._viewMap = function(request, layer) { url: url, layers : encodeURIComponent(layerName), parameters: { - 'format':'image/png', - 'transparent':'true', - 'styles': '' + format: 'image/png', + transparent: true, + styles: '', + exceptions: 'application/vnd.ogc.se_xml' }, proxy: proxy }); @@ -928,7 +929,8 @@ GeoDataCollection.prototype._viewMap = function(request, layer) { provider = new L.tileLayer.wms(server, { layers: layerName, format: 'image/png', - transparent: true + transparent: true, + exceptions: 'application/vnd.ogc.se_xml' }); } provider.setOpacity(0.6);
Ask WMS servers to provide errors as XML. Instead of returning a "no data" image.
TerriaJS_terriajs
train
js
9292a25b682680782c60b7ca37efd704666fb888
diff --git a/framework/src/play-json/src/main/java/play/libs/Json.java b/framework/src/play-json/src/main/java/play/libs/Json.java index <HASH>..<HASH> 100644 --- a/framework/src/play-json/src/main/java/play/libs/Json.java +++ b/framework/src/play-json/src/main/java/play/libs/Json.java @@ -160,7 +160,7 @@ public class Json { * Inject the object mapper to use. * * This is intended to be used when Play starts up. By default, Play will inject its own object mapper here, - * but this mapper can be overridden either by a custom plugin or from Global.onStart. + * but this mapper can be overridden either by a custom module. */ public static void setObjectMapper(ObjectMapper mapper) { objectMapper = mapper;
Change comment to not include reference to GlobalSettings
playframework_playframework
train
java
fd937ca65b204fa2bf073ceaf99a143435746527
diff --git a/src/main/java/de/rototor/pdfbox/graphics2d/PdfBoxGraphics2D.java b/src/main/java/de/rototor/pdfbox/graphics2d/PdfBoxGraphics2D.java index <HASH>..<HASH> 100644 --- a/src/main/java/de/rototor/pdfbox/graphics2d/PdfBoxGraphics2D.java +++ b/src/main/java/de/rototor/pdfbox/graphics2d/PdfBoxGraphics2D.java @@ -867,15 +867,4 @@ public class PdfBoxGraphics2D extends Graphics2D { return calcGfx.getFontRenderContext(); } - // In case a single 2D graphic object has to be written (one or more times) - // into a PDF document, this method isn't needed. - // If, instead, several 2D graphic objects have to be written (one or more - // times) - // into a PDF document, the graphic state has to be saved after a graphic - // object - // has been written for the last time and a new graphic object has to be - // created - public void saveGraphicsState() throws IOException { - contentStream.saveGraphicsState(); - } }
Removed the dirty workaround method, this should really not be needed.
rototor_pdfbox-graphics2d
train
java
ecf86b073ece31dca2a31d1143b76a69b6d6e5e6
diff --git a/Parsedown.php b/Parsedown.php index <HASH>..<HASH> 100755 --- a/Parsedown.php +++ b/Parsedown.php @@ -78,7 +78,7 @@ class Parsedown # ~ $text = preg_replace('/\n\s*\n/', "\n\n", $text); - $text = trim($text, "\n"); + $text = trim($text, "\n "); $lines = explode("\n", $text);
error when last line consists of 1-3 spaces
erusev_parsedown
train
php
5e3d948cb395ca5dd62b9c9492df134044a555a5
diff --git a/mutant/models/field.py b/mutant/models/field.py index <HASH>..<HASH> 100644 --- a/mutant/models/field.py +++ b/mutant/models/field.py @@ -425,7 +425,7 @@ class FieldDefinitionChoice(OrderableModel): objects = FieldDefinitionChoiceManager() - class Meta: + class Meta(OrderableModel.Meta): app_label = 'mutant' verbose_name = _(u'field definition choice') verbose_name_plural = _(u'field definition choices')
Added an ordering to `FieldDefinition`.
charettes_django-mutant
train
py
f41b793f3a8fefd525110f5dbe30f3304222fd8e
diff --git a/mysql/toolkit/components/manipulate.py b/mysql/toolkit/components/manipulate.py index <HASH>..<HASH> 100644 --- a/mysql/toolkit/components/manipulate.py +++ b/mysql/toolkit/components/manipulate.py @@ -91,7 +91,7 @@ class Select: @staticmethod def _select_limit_statement(table, cols='*', offset=0, limit=MAX_ROWS_PER_QUERY): """Concatenate a select with offset and limit statement.""" - return 'SELECT {0} FROM {1} LIMIT {2}, {3}'.format(cols, wrap(table), offset, limit) + return 'SELECT {0} FROM {1} LIMIT {2}, {3}'.format(join_cols(cols), wrap(table), offset, limit) class Insert:
Fixed issue with columns in _select_limit_statement method
mrstephenneal_mysql-toolkit
train
py
fa7d32ffa819a1350ef85350aa5efc28fc344119
diff --git a/rb/lib/selenium/webdriver/common/service.rb b/rb/lib/selenium/webdriver/common/service.rb index <HASH>..<HASH> 100644 --- a/rb/lib/selenium/webdriver/common/service.rb +++ b/rb/lib/selenium/webdriver/common/service.rb @@ -92,7 +92,12 @@ module Selenium def build_process(*command) WebDriver.logger.debug("Executing Process #{command}") @process = ChildProcess.build(*command) - @process.io.stdout = @process.io.stderr = WebDriver.logger.io if WebDriver.logger.debug? + if WebDriver.logger.debug? + @process.io.stdout = @process.io.stderr = WebDriver.logger.io + elsif Platform.jruby? + # Apparently we need to read the output of drivers on JRuby. + @process.io.stdout = @process.io.stderr = File.new(Platform.null_device, 'w') + end @process end @@ -117,6 +122,7 @@ module Selenium def stop_process return if process_exited? @process.stop STOP_TIMEOUT + @process.io.stdout.close if Platform.jruby? && !WebDriver.logger.debug? end def stop_server
Read stdout/stderr of child process on JRuby Closes #<I>
SeleniumHQ_selenium
train
rb
6ece99a7147fbd784db1fabb461376ed113561a4
diff --git a/src/qtism/runtime/rendering/markup/xhtml/ChoiceInteractionRenderer.php b/src/qtism/runtime/rendering/markup/xhtml/ChoiceInteractionRenderer.php index <HASH>..<HASH> 100644 --- a/src/qtism/runtime/rendering/markup/xhtml/ChoiceInteractionRenderer.php +++ b/src/qtism/runtime/rendering/markup/xhtml/ChoiceInteractionRenderer.php @@ -65,6 +65,7 @@ class ChoiceInteractionRenderer extends InteractionRenderer parent::appendAttributes($fragment, $component, $base); $this->additionalClass('qti-blockInteraction'); $this->additionalClass('qti-choiceInteraction'); + $this->additionalUserClass(($component->getOrientation() === Orientation::VERTICAL) ? 'qti-vertical' : 'qti-horizontal'); $fragment->firstChild->setAttribute('data-shuffle', ($component->mustShuffle() === true) ? 'true' : 'false'); $fragment->firstChild->setAttribute('data-max-choices', $component->getMaxChoices());
missing additional user CSS class 'qti-vertical'/'qti-horinzontal'.
oat-sa_qti-sdk
train
php
518c763c5b450ff89d516bb756c65f83cf1d6a65
diff --git a/index.js b/index.js index <HASH>..<HASH> 100644 --- a/index.js +++ b/index.js @@ -42,8 +42,7 @@ function indentOf(line, opts) { return count; } -// Precondition: lines.length > 0 -function getPadLength(lines, opts) { +function commonIndentFromLines(lines, opts) { let pad = -1; lines.forEach(l => { if (l.length === 0) { @@ -96,7 +95,7 @@ function heredoc(strings, ...args) { } const newline = this.outputNewline !== undefined ? this.outputNewline : this.inputNewline; - const pad = getPadLength(lines, this); + const pad = commonIndentFromLines(lines, this); if (pad <= 0) { return lines.join(newline); } @@ -119,6 +118,7 @@ function heredoc(strings, ...args) { const exported = heredoc.bind(DEFAULT_OPTIONS); exported.DEFAULT_OPTIONS = DEFAULT_OPTIONS; +exported.commonIndentFromLines = commonIndentFromLines; if (typeof module !== 'undefined') { exported.default = exported;
rename getPadLength to commonIndentFromLines and export it
rhysd_heredocument
train
js
29b4115d1a408105c5395393503beea39cb1669f
diff --git a/src/Symfony/Component/Serializer/Normalizer/AbstractObjectNormalizer.php b/src/Symfony/Component/Serializer/Normalizer/AbstractObjectNormalizer.php index <HASH>..<HASH> 100644 --- a/src/Symfony/Component/Serializer/Normalizer/AbstractObjectNormalizer.php +++ b/src/Symfony/Component/Serializer/Normalizer/AbstractObjectNormalizer.php @@ -182,10 +182,7 @@ abstract class AbstractObjectNormalizer extends AbstractNormalizer $attribute = $this->nameConverter->denormalize($attribute); } - $allowed = $allowedAttributes === false || in_array($attribute, $allowedAttributes); - $ignored = in_array($attribute, $this->ignoredAttributes); - - if (!$allowed || $ignored) { + if (($allowedAttributes !== false && !in_array($attribute, $allowedAttributes)) || !$this->isAllowedAttribute($class, $attribute, $format, $context)) { continue; }
[Serializer] AbstractObjectNormalizer: be sure that isAllowedAttribute is called
symfony_symfony
train
php
c5d719a126a57e7f7e57bea07f56a9838b46f724
diff --git a/tests/ObjectManager/ObjectManagerAwareTraitTest.php b/tests/ObjectManager/ObjectManagerAwareTraitTest.php index <HASH>..<HASH> 100644 --- a/tests/ObjectManager/ObjectManagerAwareTraitTest.php +++ b/tests/ObjectManager/ObjectManagerAwareTraitTest.php @@ -5,10 +5,19 @@ namespace Thorr\Persistence\Doctrine\Test\ObjectManager; +use Doctrine\Common\Persistence\ObjectManager; use PHPUnit_Framework_TestCase as TestCase; +use Thorr\Persistence\Doctrine\ObjectManager\ObjectManagerAwareTrait; -class ObjectManagerAwareTraitTest extends - TestCase +class ObjectManagerAwareTraitTest extends TestCase { + public function testAccessors() + { + $sut = $this->getMockForTrait(ObjectManagerAwareTrait::class); + $objectManager = $this->getMock(ObjectManager::class); + $sut->setObjectManager($objectManager); + + $this->assertSame($objectManager, $sut->getObjectManager()); + } }
test trait for the sake of more coverage
stefanotorresi_thorr-persistence-doctrine
train
php
dd5dc19bd946ff1bce40780dbc00cf0a304ce443
diff --git a/traffic/core/traffic.py b/traffic/core/traffic.py index <HASH>..<HASH> 100644 --- a/traffic/core/traffic.py +++ b/traffic/core/traffic.py @@ -916,7 +916,7 @@ class Traffic(HBoxMixin, GeographyMixin): >>> t_dbscan = traffic.clustering( ... nb_samples=15, ... projection=EuroPP(), - ... method=DBSCAN(eps=1.5, min_samples=10), + ... clustering=DBSCAN(eps=1.5, min_samples=10), ... transform=StandardScaler(), ... ).fit_predict() >>> t_dbscan.groupby(["cluster"]).agg({"flight_id": "nunique"})
Wrong method signature in clustering example (#<I>) * Wrong method signature in clustering example * Update traffic.py
xoolive_traffic
train
py