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
a49555a5453446b3ba6285644183e9f7fb64af8b
diff --git a/spec/mongoid/criteria_spec.rb b/spec/mongoid/criteria_spec.rb index <HASH>..<HASH> 100644 --- a/spec/mongoid/criteria_spec.rb +++ b/spec/mongoid/criteria_spec.rb @@ -395,7 +395,7 @@ describe Mongoid::Criteria do context "chaining more than one scope" do let(:criteria) do - Person.accepted.old.knight + Person.accepted.knight end let(:chained) do @@ -404,7 +404,7 @@ describe Mongoid::Criteria do it "returns the final merged criteria" do criteria.selector.should == - { :title => "Sir", :terms => true, :age => { "$gt" => 50 } } + { :title => "Sir", :terms => true } end it "always returns a new criteria" do
Update spec not to check overwritten age
mongodb_mongoid
train
rb
999aa7d94268b7374238e06839088d9fe14406c4
diff --git a/src/Ractive.js b/src/Ractive.js index <HASH>..<HASH> 100644 --- a/src/Ractive.js +++ b/src/Ractive.js @@ -40,6 +40,20 @@ export default function Ractive ( options ) { initialise( this, options || {}, {} ); } +// check to see if we're being asked to force Ractive as a global for some weird environments +if ( win && !win.Ractive ) { + let opts = ''; + const script = document.currentScript || document.querySelector( 'script[data-ractive-options]' ); + + if ( script ) { + opts = script.getAttribute( 'data-ractive-options' ) || ''; + } + + if ( ~opts.indexOf( 'ForceGlobal' ) ) { + win.Ractive = Ractive; + } +} + extendObj( Ractive.prototype, proto, defaults ); Ractive.prototype.constructor = Ractive;
add a way to force ractive to register as a global - fixes #<I>
ractivejs_ractive
train
js
af9c19ab7fa61cc4ed423d69f76bdce5b469d237
diff --git a/spec/unit/type/augeas.rb b/spec/unit/type/augeas.rb index <HASH>..<HASH> 100644 --- a/spec/unit/type/augeas.rb +++ b/spec/unit/type/augeas.rb @@ -114,6 +114,8 @@ describe augeas do end it "should set the context when a specific file is used" do + fake_provider = stub_everything "fake_provider" + augeas.stubs(:defaultprovider).returns fake_provider augeas.new(:name => :no_incl, :lens => "Hosts.lns", :incl => "/etc/hosts")[:context].should == "/files/etc/hosts" end end
Bug #<I> augeas spec fails if there is not a default provider So I stubbed out the default provider.
puppetlabs_puppet
train
rb
dbba6f10c867e64031ae07adb3d21becfe4a4e5a
diff --git a/law/contrib/cms/__init__.py b/law/contrib/cms/__init__.py index <HASH>..<HASH> 100644 --- a/law/contrib/cms/__init__.py +++ b/law/contrib/cms/__init__.py @@ -5,9 +5,10 @@ CMS-related contrib package. https://home.cern/about/experiments/cms """ -__all__ = ["CMSJobDashboard", "BundleCMSSW"] +__all__ = ["CMSJobDashboard", "BundleCMSSW", "Site", "lfn_to_pfn"] # provisioning imports from law.contrib.cms.job import CMSJobDashboard from law.contrib.cms.tasks import BundleCMSSW +from law.contrib.cms.util import Site, lfn_to_pfn
Load utils in cms contrib package.
riga_law
train
py
4520a53c37fd8ea7cc9126e1b8509518f227ccc1
diff --git a/test/test_helper.rb b/test/test_helper.rb index <HASH>..<HASH> 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -6,6 +6,8 @@ require 'minitest/autorun' require 'ethereum' require 'json' +Logging.logger.root.level = :error + def fixture_root File.expand_path('../../fixtures', __FILE__) end
set logger level to error in tests
cryptape_ruby-ethereum
train
rb
c823976827c782ecfc3fbc6c810c88c59237aedd
diff --git a/src/commands/seedJsonFile.php b/src/commands/seedJsonFile.php index <HASH>..<HASH> 100644 --- a/src/commands/seedJsonFile.php +++ b/src/commands/seedJsonFile.php @@ -18,16 +18,17 @@ class seedJsonFile extends Command public function __construct() { parent::__construct(); - $this->pdo = DB::connection()->getPdo(PDO::FETCH_ASSOC); - if (! Schema::hasTable('geo')) { - return; - } $this->geoItems = new geoCollection(); } public function handle() { + $this->pdo = DB::connection()->getPdo(PDO::FETCH_ASSOC); + if (! Schema::hasTable('geo')) { + return; + } + $start = microtime(true); $filename = $this->argument('file');
Update seedJsonFile.php
igaster_laravel_cities
train
php
52e8598a96be9ffcfae44149fe3cd07c9966a404
diff --git a/__snapshots__/mocha-snapshot-spec.js b/__snapshots__/mocha-snapshot-spec.js index <HASH>..<HASH> 100644 --- a/__snapshots__/mocha-snapshot-spec.js +++ b/__snapshots__/mocha-snapshot-spec.js @@ -18,7 +18,7 @@ exports['captures mocha output 1'] = ` ✓ works - 1 passing (10ms) + 1 passing (<time>ms) ------- stderr: ------- diff --git a/scripts/mocha-snapshot-spec.js b/scripts/mocha-snapshot-spec.js index <HASH>..<HASH> 100644 --- a/scripts/mocha-snapshot-spec.js +++ b/scripts/mocha-snapshot-spec.js @@ -6,6 +6,7 @@ function normalize (s) { // and the command is hardcoded in package.json // using forward slashes return s.replace(process.cwd(), '<folder path>') + .replace(/passing \(\d+ms\)/, 'passing (<time>ms)') } /* eslint-env mocha */
normalize mocha spec duration in snapshot
cypress-io_cypress
train
js,js
df621371094ad0205d7878919c2414bf8916e624
diff --git a/tx_people/models.py b/tx_people/models.py index <HASH>..<HASH> 100644 --- a/tx_people/models.py +++ b/tx_people/models.py @@ -193,9 +193,6 @@ class Person(mixins.TimeTrackingMixin, sort_name = fields.OptionalCharField(max_length=250) email = fields.OptionalCharField(max_length=250) gender = fields.OptionalCharField(max_length=10) - races = fields.OptionalManyToManyField(Race, related_name='people') - ethnicities = fields.OptionalManyToManyField(Ethnicity, - related_name='people') birth_date = fields.OptionalReducedDateField() death_date = fields.OptionalReducedDateField() image = models.ImageField(upload_to=settings.TX_PEOPLE_UPLOAD_TO, @@ -207,4 +204,9 @@ class Person(mixins.TimeTrackingMixin, links = fields.OptionalManyToManyField(Link, related_name='people') sources = fields.OptionalManyToManyField(Source, related_name='people') + # Not included in Popolo spec + races = fields.OptionalManyToManyField(Race, related_name='people') + ethnicities = fields.OptionalManyToManyField(Ethnicity, + related_name='people') + objects = InheritanceManager()
Heeded advice to separate non-Popolo spec things from actual spec things
texas_tx_people
train
py
8e6a0065e010a9b1d6681aaa42fb602cb7a5b3d8
diff --git a/elki/src/main/java/de/lmu/ifi/dbs/elki/application/greedyensemble/ComputeKNNOutlierScores.java b/elki/src/main/java/de/lmu/ifi/dbs/elki/application/greedyensemble/ComputeKNNOutlierScores.java index <HASH>..<HASH> 100644 --- a/elki/src/main/java/de/lmu/ifi/dbs/elki/application/greedyensemble/ComputeKNNOutlierScores.java +++ b/elki/src/main/java/de/lmu/ifi/dbs/elki/application/greedyensemble/ComputeKNNOutlierScores.java @@ -188,6 +188,8 @@ public class ComputeKNNOutlierScores<O extends NumberVector> extends AbstractApp public void run() { final Database database = inputstep.getDatabase(); final Relation<O> relation = database.getRelation(distf.getInputTypeRestriction()); + // Ensure we don't go beyond the relation size: + final int maxk = Math.min(this.maxk, relation.size() - 1); // Get a KNN query. KNNQuery<O> knnq = QueryUtil.getKNNQuery(relation, distf, maxk + 2);
Safeguard against too large k for small data sets.
elki-project_elki
train
java
449bdce1c7674fe166924e9d2085b292959c1eec
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ license: GNU-GPL2 from setuptools import setup setup(name='arguments', - version='54', + version='55', description='Argument parser based on docopt', url='https://github.com/erikdejonge/arguments', author='Erik de Jonge',
Albert Pujols: We are made to know and love God. Friday <I> June <I> (week:<I> day:<I>), <I>:<I>:<I>
erikdejonge_arguments
train
py
4cd985e13e87a80e6df81260f4519e2e7fb38545
diff --git a/toytree/Toytree.py b/toytree/Toytree.py index <HASH>..<HASH> 100644 --- a/toytree/Toytree.py +++ b/toytree/Toytree.py @@ -390,9 +390,14 @@ class ToyTree: # -------------------------------------------------------------------- # functions to modify the ete3 tree - MUST CALL ._coords.update() # -------------------------------------------------------------------- - def ladderize(self): + def ladderize(self, direction=0): + """ + Ladderize tree (order descendants) so that top child has fewer + descendants than the bottom child in a left to right tree plot. + To reverse this pattern use direction=1. + """ nself = deepcopy(self) - nself.treenode.ladderize() + nself.treenode.ladderize(direction=direction) nself._fixed_order = None nself._coords.update() return nself @@ -427,6 +432,10 @@ class ToyTree: # make a deepcopy of the tree nself = self.copy() + # return if nothing to drop + if not any([names, wildcard, regex]): + return nself + # get matching names list with fuzzy match tipnames = fuzzy_match_tipnames( ttree=nself,
ladderize can take direction arg. Drop_tips can take no args and return same.
eaton-lab_toytree
train
py
84b94c506fe0ff02b227cc87ced08e3ec110f92e
diff --git a/multilingual/translation.py b/multilingual/translation.py index <HASH>..<HASH> 100644 --- a/multilingual/translation.py +++ b/multilingual/translation.py @@ -256,8 +256,11 @@ class Translation: main_cls.get_translation = get_translation main_cls.fill_translation_cache = fill_translation_cache - connect(fill_translation_cache, signal=signals.post_init, - sender=main_cls) + # Note: don't fill the translation cache in post_init, as all + # the extra values selected by QAddTranslationData will be + # assigned AFTER init() +# connect(fill_translation_cache, signal=signals.post_init, +# sender=main_cls) # connect the pre_save signal on translation class to a # function removing previous translation entries.
Fixed a bug that would cause DM to always load translation data with a separate query for each translatable model instance. git-svn-id: <URL>
ojii_django-multilingual-ng
train
py
b8fc784ca77200344256dad89fb98281ef89cdbd
diff --git a/dispatch/modules/content/models.py b/dispatch/modules/content/models.py index <HASH>..<HASH> 100644 --- a/dispatch/modules/content/models.py +++ b/dispatch/modules/content/models.py @@ -1,6 +1,5 @@ import datetime import StringIO -import json import os import re @@ -216,8 +215,9 @@ class Publishable(Model): attachment = self.featured_image - if data is None and attachment: - attachment.delete() + if data is None: + if attachment: + attachment.delete() return if not attachment:
Don't try to delete null attachment
ubyssey_dispatch
train
py
99126eed20761d73723670acb95e1d0d7205358b
diff --git a/generators/app/index.js b/generators/app/index.js index <HASH>..<HASH> 100644 --- a/generators/app/index.js +++ b/generators/app/index.js @@ -94,6 +94,6 @@ module.exports = generators.Base.extend({ }, install: function () { - this.installDependencies(); + this.installDependencies({bower: false}); } }); diff --git a/generators/git/index.js b/generators/git/index.js index <HASH>..<HASH> 100644 --- a/generators/git/index.js +++ b/generators/git/index.js @@ -13,5 +13,11 @@ module.exports = generators.Base.extend({ this.templatePath('gitignore'), this.destinationPath('.gitignore') ); + }, + + end: function () { + this.spawnCommandSync('git', ['init'], { + cwd: this.destinationPath() + }); } });
Init git and skip bower install
sondr3_generator-statisk
train
js,js
c690cd26bdb2fce15192b86bda582f9406842358
diff --git a/hamster/stats.py b/hamster/stats.py index <HASH>..<HASH> 100644 --- a/hamster/stats.py +++ b/hamster/stats.py @@ -246,7 +246,7 @@ class StatsViewer: label.set_text(label_text) label2 = self.get_widget("dayview_caption") - label2.set_markup(_("<b>%s</b>") % (dayview_caption)) + label2.set_markup("<b>%s</b>" % (dayview_caption)) facts = self.get_facts()
some strings should remain untranslated svn path=/trunk/; revision=<I>
projecthamster_hamster
train
py
9f88ff3e30479b5cc2925636dfb6f38d93659c40
diff --git a/test/topo_flavor/zookeeper.py b/test/topo_flavor/zookeeper.py index <HASH>..<HASH> 100644 --- a/test/topo_flavor/zookeeper.py +++ b/test/topo_flavor/zookeeper.py @@ -6,7 +6,6 @@ import logging import os -import socket import json import server @@ -24,9 +23,10 @@ class ZkTopoServer(server.TopoServer): return from environment import reserve_ports + import utils self.zk_port_base = reserve_ports(3) - self.hostname = socket.getaddrinfo(socket.getfqdn(), None, 0, 0, 0, socket.AI_CANONNAME)[0][3] + self.hostname = utils.hostname self.zk_ports = ':'.join(str(self.zk_port_base + i) for i in range(3)) self.zk_client_port = self.zk_port_base + 2 self.ports_assigned = True diff --git a/test/utils.py b/test/utils.py index <HASH>..<HASH> 100644 --- a/test/utils.py +++ b/test/utils.py @@ -25,7 +25,7 @@ from topo_flavor.server import set_topo_server_flavor options = None devnull = open('/dev/null', 'w') -hostname = socket.getfqdn() +hostname = socket.getaddrinfo(socket.getfqdn(), None, 0, 0, 0, socket.AI_CANONNAME)[0][3] class TestError(Exception): pass
Make utils.hostname use CNAME too, not just ZkTopoServer. Other Python tests such as reparent.py also need the hostname to match the one seen by Vitess.
vitessio_vitess
train
py,py
a26b617cc98eb02abec93586d2a2bcf93508ac04
diff --git a/Lib/ufo2ft/markFeatureWriter.py b/Lib/ufo2ft/markFeatureWriter.py index <HASH>..<HASH> 100644 --- a/Lib/ufo2ft/markFeatureWriter.py +++ b/Lib/ufo2ft/markFeatureWriter.py @@ -160,19 +160,21 @@ class MarkFeatureWriter(object): # nothing to do, don't write empty feature return featureName = "mkmk" if isMkmk else "mark" - - lines.append("feature %s {" % featureName) + feature = [] for i, anchorPair in enumerate(anchorList): lookupName = "%s%d" % (featureName, i + 1) - self._addMarkLookup(lines, lookupName, isMkmk, anchorPair) + self._addMarkLookup(feature, lookupName, isMkmk, anchorPair) if not isMkmk: for i, anchorPairs in enumerate(self.ligaAnchorList): lookupName = "mark2liga%d" % (i + 1) - self._addMarkToLigaLookup(lines, lookupName, anchorPairs) + self._addMarkToLigaLookup(feature, lookupName, anchorPairs) - lines.append("} %s;\n" % featureName) + if feature: + lines.append("feature %s {" % featureName) + lines.extend(feature) + lines.append("} %s;\n" % featureName) def setupAnchorPairs(self): """
[markFeatureWriter] skip writing mark/mkmk feature if empty sometimes empty blocks like this are emitted by the MarkFeatureWriter: feature mkmk { } mkmk; feaLib silently ignores them, while MakeOTF crashes on them with syntax error. <URL>
googlefonts_ufo2ft
train
py
55cafc44e8793142dd525b5c4fbcbacd44c64369
diff --git a/dipper/sources/IMPC.py b/dipper/sources/IMPC.py index <HASH>..<HASH> 100644 --- a/dipper/sources/IMPC.py +++ b/dipper/sources/IMPC.py @@ -2,6 +2,7 @@ import csv import gzip import re import logging +import os from dipper.sources.Source import Source from dipper.models.Assoc import Assoc @@ -294,10 +295,11 @@ class IMPC(Source): reference_checksums = self.parse_checksum_file( self.files['checksum']['file']) for md5, file in reference_checksums.items(): - if self.get_file_md5(self.rawdir, file) != md5: - is_match = False - logger.warn('%s was not downloaded completely', file) - return is_match + if os.path.isfile('/'.join((self.rawdir, file))): + if self.get_file_md5(self.rawdir, file) != md5: + is_match = False + logger.warn('%s was not downloaded completely', file) + return is_match return is_match
IMPC.py - compare_checksums: only check files that exist locally
monarch-initiative_dipper
train
py
4da7f7b2306b36b3af3c3316c643985ba0c37547
diff --git a/conf.py b/conf.py index <HASH>..<HASH> 100644 --- a/conf.py +++ b/conf.py @@ -137,7 +137,7 @@ html_theme = 'sphinx_rtd_theme' # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". -html_static_path = ['_static'] +#html_static_path = ['_static'] # Add any extra paths that contain custom files (such as robots.txt or # .htaccess) here, relative to this directory. These files are copied
removed not used _static path from Sphinx build
domnikl_DesignPatternsPHP
train
py
0cf94a7ce3ba10064c41043d233a72eb3b194570
diff --git a/app/Module/AncestorsChartModule.php b/app/Module/AncestorsChartModule.php index <HASH>..<HASH> 100644 --- a/app/Module/AncestorsChartModule.php +++ b/app/Module/AncestorsChartModule.php @@ -47,7 +47,7 @@ class AncestorsChartModule extends AbstractModule implements ModuleChartInterfac // Defaults protected const DEFAULT_COUSINS = false; protected const DEFAULT_STYLE = self::CHART_STYLE_LIST; - protected const DEFAULT_GENERATIONS = '3'; + protected const DEFAULT_GENERATIONS = '4'; // Limits protected const MINIMUM_GENERATIONS = 2; @@ -133,8 +133,8 @@ class AncestorsChartModule extends AbstractModule implements ModuleChartInterfac $chart_style = $request->get('chart_style', self::DEFAULT_STYLE); $generations = (int) $request->get('generations', self::DEFAULT_GENERATIONS); - $generations = min($generations, self::MINIMUM_GENERATIONS); - $generations = max($generations, self::MAXIMUM_GENERATIONS); + $generations = min($generations, self::MAXIMUM_GENERATIONS); + $generations = max($generations, self::MINIMUM_GENERATIONS); if ($ajax) { $ancestors = $chart_service->sosaStradonitzAncestors($individual, $generations);
Fix number of generations in ancestors chart
fisharebest_webtrees
train
php
e44d6d22eb30bab572be32893bba2c9dca017393
diff --git a/app/assets/javascripts/jquery/active_scaffold.js b/app/assets/javascripts/jquery/active_scaffold.js index <HASH>..<HASH> 100644 --- a/app/assets/javascripts/jquery/active_scaffold.js +++ b/app/assets/javascripts/jquery/active_scaffold.js @@ -932,8 +932,8 @@ var ActiveScaffold = { if (send_form == 'row') base = element.closest('.association-record, form'); if (selector = element.data('update_send_form_selector')) params = base.find(selector).serialize(); - else if (send_form != as_form) params = base.find(':input').serialize(); - else base.serialize(); + else if (base != as_form) params = base.find(':input').serialize(); + else params = base.serialize(); params += '&_method=&' + jQuery.param({"source_id": source_id}); if (additional_params) params += '&' + additional_params; } else {
fix update_column method, compare send_form with as_form doesn't make sense
activescaffold_active_scaffold
train
js
670707e17263f27f3a420542c08fcd02d721eb84
diff --git a/astroid/brain/brain_numpy_core_umath.py b/astroid/brain/brain_numpy_core_umath.py index <HASH>..<HASH> 100644 --- a/astroid/brain/brain_numpy_core_umath.py +++ b/astroid/brain/brain_numpy_core_umath.py @@ -4,7 +4,8 @@ # Licensed under the LGPL: https://www.gnu.org/licenses/old-licenses/lgpl-2.1.en.html # For details: https://github.com/PyCQA/astroid/blob/master/COPYING.LESSER - +# Note: starting with version 1.18 numpy module has `__getattr__` method which prevent `pylint` to emit `no-member` message for +# all numpy's attributes. (see pylint's module typecheck in `_emit_no_member` function) """Astroid hooks for numpy.core.umath module.""" import astroid
Adds a note dealing with numpy version <I> and the __getattr__ method
PyCQA_astroid
train
py
4eb3405df770c79f0823404a8934a7bf0b4bd5d9
diff --git a/spacy/lemmatizer.py b/spacy/lemmatizer.py index <HASH>..<HASH> 100644 --- a/spacy/lemmatizer.py +++ b/spacy/lemmatizer.py @@ -93,7 +93,6 @@ def lemmatize(string, index, exceptions, rules): orig = string string = string.lower() forms = [] - forms.extend(exceptions.get(string, [])) oov_forms = [] for old, new in rules: if string.endswith(old): @@ -104,8 +103,18 @@ def lemmatize(string, index, exceptions, rules): forms.append(form) else: oov_forms.append(form) + # Remove duplicates, and sort forms generated by rules alphabetically. + forms = list(set(forms)) + forms.sort() + # Put exceptions at the front of the list, so they get priority. + # This is a dodgy heuristic -- but it's the best we can do until we get + # frequencies on this. We can at least prune out problematic exceptions, + # if they shadow more frequent analyses. + for form in exceptions.get(string, []): + if form not in forms: + forms.insert(0, form) if not forms: forms.extend(oov_forms) if not forms: forms.append(orig) - return list(set(forms)) + return forms
Fix lemmatizer ordering, re Issue #<I>
explosion_spaCy
train
py
782a596c8f01060d22b44151e9dbd60a8ef138d6
diff --git a/lib/stripe.rb b/lib/stripe.rb index <HASH>..<HASH> 100644 --- a/lib/stripe.rb +++ b/lib/stripe.rb @@ -96,12 +96,12 @@ module Stripe request_opts = {:verify_ssl => OpenSSL::SSL::VERIFY_PEER, :ssl_ca_file => @ssl_bundle_path} else + request_opts = {:verify_ssl => false} unless @verify_ssl_warned @verify_ssl_warned = true $stderr.puts("WARNING: Running without SSL cert verification. " \ "You should never do this in production. " \ "Execute 'Stripe.verify_ssl_certs = true' to enable verification.") - request_opts = {:verify_ssl => false} end end
Fix error when SSL verification is disabled. Fixes #<I>
stripe_stripe-ruby
train
rb
ef279436a754c5df26c1952ffb2d08eec0c9af57
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/control/PackageTest.java b/logback-classic/src/test/java/ch/qos/logback/classic/control/PackageTest.java index <HASH>..<HASH> 100644 --- a/logback-classic/src/test/java/ch/qos/logback/classic/control/PackageTest.java +++ b/logback-classic/src/test/java/ch/qos/logback/classic/control/PackageTest.java @@ -16,7 +16,6 @@ public class PackageTest extends TestCase { public static Test suite() { TestSuite suite = new TestSuite(); suite.addTest(new JUnit4TestAdapter(RandomUtilTest.class)); - suite.addTest(new JUnit4TestAdapter(ScenarioMakerTest.class)); return suite; } } \ No newline at end of file
- removed reference to previously deleted test
tony19_logback-android
train
java
caa5f315c8a3a39f5c09fba7d96f36d21d315893
diff --git a/src/Providers/ModuleProvider.php b/src/Providers/ModuleProvider.php index <HASH>..<HASH> 100644 --- a/src/Providers/ModuleProvider.php +++ b/src/Providers/ModuleProvider.php @@ -5,6 +5,7 @@ namespace TypiCMS\Modules\Files\Providers; use Illuminate\Foundation\AliasLoader; use Illuminate\Support\ServiceProvider; use TypiCMS\Modules\Core\Observers\FileObserver; +use TypiCMS\Modules\Core\Services\FileUploader; use TypiCMS\Modules\Files\Composers\SidebarViewComposer; use TypiCMS\Modules\Files\Facades\Files; use TypiCMS\Modules\Files\Models\File; @@ -34,7 +35,7 @@ class ModuleProvider extends ServiceProvider AliasLoader::getInstance()->alias('Files', Files::class); // Observers - File::observe(new FileObserver()); + File::observe(new FileObserver(new FileUploader())); /* * Sidebar view composer
FileUpload replaced by FileUploader
TypiCMS_Files
train
php
3ec9b7fb979c8fc97073fd97bff953e83d80ae9a
diff --git a/discord/ext/commands/formatter.py b/discord/ext/commands/formatter.py index <HASH>..<HASH> 100644 --- a/discord/ext/commands/formatter.py +++ b/discord/ext/commands/formatter.py @@ -160,7 +160,7 @@ class HelpFormatter: try: commands = self.command.commands if not self.is_cog() else self.context.bot.commands if commands: - return max(map(lambda c: len(c.name), commands.values())) + return max(map(lambda c: len(c.name) if self.show_hidden or not c.hidden else 0, commands.values())) return 0 except AttributeError: return len(self.command.name)
[commands] Make HelpFormatter ignore hidden commands for max_width.
Rapptz_discord.py
train
py
e7bef369eefbf7b16df1d4bba9d8e71b9f5107a3
diff --git a/Sockets/Factory.php b/Sockets/Factory.php index <HASH>..<HASH> 100644 --- a/Sockets/Factory.php +++ b/Sockets/Factory.php @@ -7,7 +7,8 @@ use \Exception; class Factory { - private $pollInterval = 0.01; + private $loop; + private $poller = null; public function __construct(LoopInterface $loop) { @@ -27,12 +28,20 @@ class Factory return $this->create(AF_INET6, SOCK_DGRAM, SOL_UDP); } + public function getPoller() + { + if ($this->poller === null) { + $this->poller = new SelectPoller($this->loop); + } + return $this->poller; + } + private function create($domain, $type, $protocol) { $sock = socket_create($domain, $type, $protocol); if ($sock === false) { throw new Exception('Unable to create socket'); } - return new Socket($sock, $this->pollInterval, $this->loop); + return new Socket($sock, $this->getPoller()); } }
Pass SelectPoller to each Socket
clue_php-socket-react
train
php
0081f75ee8acc8c16fe3c165b7e41dacbbf14df5
diff --git a/src/Illuminate/Database/MigrationServiceProvider.php b/src/Illuminate/Database/MigrationServiceProvider.php index <HASH>..<HASH> 100755 --- a/src/Illuminate/Database/MigrationServiceProvider.php +++ b/src/Illuminate/Database/MigrationServiceProvider.php @@ -171,10 +171,7 @@ class MigrationServiceProvider extends ServiceProvider { */ protected function registerMakeCommand() { - $this->app->bindShared('migration.creator', function($app) - { - return new MigrationCreator($app['files']); - }); + $this->registerCreator(); $this->app->bindShared('command.migrate.make', function($app) { @@ -190,6 +187,19 @@ class MigrationServiceProvider extends ServiceProvider { } /** + * Register the migration creator. + * + * @return void + */ + protected function registerCreator() + { + $this->app->bindShared('migration.creator', function($app) + { + return new MigrationCreator($app['files']); + }); + } + + /** * Get the services provided by the provider. * * @return array
Extract registerCreator method Make it easier to register a custom creator.
laravel_framework
train
php
8c42f61723981c93127e6d29c8cfd5f183eadb5b
diff --git a/lib/searchkick/logging.rb b/lib/searchkick/logging.rb index <HASH>..<HASH> 100644 --- a/lib/searchkick/logging.rb +++ b/lib/searchkick/logging.rb @@ -232,10 +232,11 @@ module Searchkick end end end -Searchkick::Query.send(:prepend, Searchkick::QueryWithInstrumentation) -Searchkick::Index.send(:prepend, Searchkick::IndexWithInstrumentation) -Searchkick::Indexer.send(:prepend, Searchkick::IndexerWithInstrumentation) -Searchkick.singleton_class.send(:prepend, Searchkick::SearchkickWithInstrumentation) + +Searchkick::Query.prepend(Searchkick::QueryWithInstrumentation) +Searchkick::Index.prepend(Searchkick::IndexWithInstrumentation) +Searchkick::Indexer.prepend(Searchkick::IndexerWithInstrumentation) +Searchkick.singleton_class.prepend(Searchkick::SearchkickWithInstrumentation) Searchkick::LogSubscriber.attach_to :searchkick ActiveSupport.on_load(:action_controller) do include Searchkick::ControllerRuntime
Prepend no longer private [skip ci]
ankane_searchkick
train
rb
5e8ac25869878fa7d8c55c60cd61cd26ccb67f75
diff --git a/src/Renderer.js b/src/Renderer.js index <HASH>..<HASH> 100644 --- a/src/Renderer.js +++ b/src/Renderer.js @@ -243,11 +243,17 @@ class Renderer { }; // TODO: make state immutable? - this._plugins.forEach(el => { - if (el.plugin.hasObjects()) { - el.plugin.render(state); - } - }); + const pluginsToRender = this._plugins + .map(item => item.plugin) + .filter(plugin => plugin.hasObjects()); + + for (let i = 0; i < pluginsToRender.length; i++) { + pluginsToRender[i].render( + state, + pluginsToRender[i - 1], + pluginsToRender[i + 1] + ); + } if (this._renderTarget) { this._renderTarget.unbind(gl);
pass prev and next plugins to plugin render (#<I>)
2gis_2gl
train
js
57a4e638c2d4dde3d7e0475d04ebe7ae8c3a69b9
diff --git a/lib/the86-client/version.rb b/lib/the86-client/version.rb index <HASH>..<HASH> 100644 --- a/lib/the86-client/version.rb +++ b/lib/the86-client/version.rb @@ -1,5 +1,5 @@ module The86 module Client - VERSION = "0.0.8" + VERSION = "1.0.0" end end
Incremented version to <I>.
sitepoint_the86-client
train
rb
9befb321aaafca9998c69a9b1ea51c7be30fcde0
diff --git a/examples/app.js b/examples/app.js index <HASH>..<HASH> 100644 --- a/examples/app.js +++ b/examples/app.js @@ -4,6 +4,8 @@ var express = require('express'); var app = module.exports = express(); var MongoQS = require('../index'); + +// Create a new Mongo QueryString parser var qs = new MongoQS({ custom: { bbox: 'geojson', @@ -14,6 +16,7 @@ var qs = new MongoQS({ app.get('/api/places', function(req, res) { res.set('Content-Type', 'application/json'); + // Parse the request query parameters var query = qs.parse(req.query); var collection = require('./db').db.collection('places'); var cursor = collection.find(query).limit(3);
docs(examples): add comments to example application
Turistforeningen_node-mongo-querystring
train
js
dfa2c8a53af94ebe86d95c740f50e9460f31aaf6
diff --git a/src/UserAgent.php b/src/UserAgent.php index <HASH>..<HASH> 100644 --- a/src/UserAgent.php +++ b/src/UserAgent.php @@ -9,6 +9,7 @@ use Innmind\Immutable\Str; final class UserAgent implements UserAgentInterface { private $value; + private $string; public function __construct(string $value) { @@ -16,6 +17,7 @@ final class UserAgent implements UserAgentInterface throw new InvalidArgumentException; } + $this->string = 'User-agent: '.$value; $this->value = (string) (new Str($value))->toLower(); } @@ -32,6 +34,6 @@ final class UserAgent implements UserAgentInterface public function __toString(): string { - return 'User-agent: '.$this->value; + return $this->string; } } diff --git a/tests/UserAgentTest.php b/tests/UserAgentTest.php index <HASH>..<HASH> 100644 --- a/tests/UserAgentTest.php +++ b/tests/UserAgentTest.php @@ -40,8 +40,8 @@ class UserAgentTest extends \PHPUnit_Framework_TestCase public function testStringCast() { $this->assertSame( - 'User-agent: *', - (string) new UserAgent('*') + 'User-agent: GoogleBot', + (string) new UserAgent('GoogleBot') ); }
leave the user agent intact when casting it to string
Innmind_Robots.txt
train
php,php
33616600e45311997ebe8fcb4f8e472b25ea3619
diff --git a/audio/vorbis/vorbis.go b/audio/vorbis/vorbis.go index <HASH>..<HASH> 100644 --- a/audio/vorbis/vorbis.go +++ b/audio/vorbis/vorbis.go @@ -44,6 +44,8 @@ func (s *Stream) Seek(offset int64, whence int) (int64, error) { } // Length returns the size of decoded stream in bytes. +// +// If the source is not io.Seeker, Length returns 0. func (s *Stream) Length() int64 { return s.size } diff --git a/audio/vorbis/vorbis_test.go b/audio/vorbis/vorbis_test.go index <HASH>..<HASH> 100644 --- a/audio/vorbis/vorbis_test.go +++ b/audio/vorbis/vorbis_test.go @@ -83,5 +83,10 @@ func TestNonSeeker(t *testing.T) { if err != nil { t.Fatal(err) } - _ = s + + got := s.Length() + want := int64(0) + if got != want { + t.Errorf("s.Length(): got: %d, want: %d", got, want) + } }
audio/vorbis: test Length with a non-seekable source Updates #<I>
hajimehoshi_ebiten
train
go,go
c5d9f5abf11b520efaa8d5dec53db481197899e0
diff --git a/tests/job_unittest.py b/tests/job_unittest.py index <HASH>..<HASH> 100644 --- a/tests/job_unittest.py +++ b/tests/job_unittest.py @@ -369,6 +369,7 @@ class PrepareJobTestCase(unittest.TestCase, helpers.DbTestCase): 'TRUNCATION_LEVEL': '3', 'GMPE_TRUNCATION_TYPE': '1 Sided', 'GROUND_MOTION_CORRELATION': 'true', + 'EPSILON_RANDOM_SEED': '37', } BASE_EVENT_BASED_PARAMS = {
missed a file Former-commit-id: d<I>be<I>ae<I>c7e8fdf<I>acd<I>e9da
gem_oq-engine
train
py
4ff1cf37c8d3d5f0b6acddda5aaa38f4806f91eb
diff --git a/k8s.go b/k8s.go index <HASH>..<HASH> 100644 --- a/k8s.go +++ b/k8s.go @@ -291,9 +291,9 @@ func (c *Client) CreateKubernetesCluster(cluster KubernetesCluster) (*Kubernetes } // DeleteKubernetesCluster deletes cluster -func (c *Client) DeleteKubernetesCluster(clusterId string) (*http.Header, error) { +func (c *Client) DeleteKubernetesCluster(clusterID string) (*http.Header, error) { h := &http.Header{} - return h, c.Delete(kubernetesClusterPath(clusterId), h, http.StatusOK) + return h, c.Delete(kubernetesClusterPath(clusterID), h, http.StatusAccepted) } // UpdateKubernetesCluster updates cluster
Fix: Expect accepted status for k8s cluster deletion requests
profitbricks_profitbricks-sdk-go
train
go
a0c0d983bf6df8e217956c63cb5c7de0b871ca61
diff --git a/test/helper.rb b/test/helper.rb index <HASH>..<HASH> 100644 --- a/test/helper.rb +++ b/test/helper.rb @@ -28,17 +28,21 @@ class Test::Unit::TestCase include RR::Adapters::TestUnit def dest_dir(*subdirs) - File.join(File.dirname(__FILE__), 'dest', *subdirs) + test_dir('dest', *subdirs) end def source_dir(*subdirs) - File.join(File.dirname(__FILE__), 'source', *subdirs) + test_dir('source', *subdirs) end def clear_dest FileUtils.rm_rf(dest_dir) end + def test_dir(*subdirs) + File.join(File.dirname(__FILE__), *subdirs) + end + def capture_stdout $old_stdout = $stdout $stdout = StringIO.new
Using a test_dir helper method for tests.
jekyll_jekyll
train
rb
5cd7396c6a0357b71e54d0861d07826b5fb6f854
diff --git a/src/MUIDataTable.js b/src/MUIDataTable.js index <HASH>..<HASH> 100644 --- a/src/MUIDataTable.js +++ b/src/MUIDataTable.js @@ -535,8 +535,6 @@ class MUIDataTable extends React.Component { this.options.onRowsDelete(selectedRows); } - this.updateToolbarSelect(false); - this.setTableData( { columns: this.props.columns,
resolve bug in toolbarSelect
gregnb_mui-datatables
train
js
1ab3031ae051a88beb82e3d0122476ecb7da60ad
diff --git a/assets/samples/sample_activity.rb b/assets/samples/sample_activity.rb index <HASH>..<HASH> 100644 --- a/assets/samples/sample_activity.rb +++ b/assets/samples/sample_activity.rb @@ -16,7 +16,7 @@ class SampleActivity :gravity => :center, :text_size => 48.0 button :text => 'M-x butterfly', :width => :match_parent, :id => 43, :on_click_listener => proc { butterfly } end - rescue + rescue Exception puts "Exception creating activity: #{$!}" puts $!.backtrace.join("\n") end
* Catch Java exception in the Activity example.
ruboto_ruboto
train
rb
559a2a0fab79c9396ee6a7d3f64ebd44397d35ef
diff --git a/src/engine/sequencer.js b/src/engine/sequencer.js index <HASH>..<HASH> 100644 --- a/src/engine/sequencer.js +++ b/src/engine/sequencer.js @@ -88,11 +88,6 @@ Sequencer.prototype.startThread = function (thread) { // Start showing run feedback in the editor. this.runtime.glowBlock(currentBlockId, true); - // Push the current block to the stack, if executing for the first time. - if (thread.peekStack() != currentBlockId) { - thread.pushStack(currentBlockId); - } - // Execute the current block execute(this, thread);
Remove redundant piece of code The stack is pushed in after the thread finishes (`proceedThread`).
LLK_scratch-vm
train
js
ef7fcdb2b4a0d6a3c121ba6ef0eec4fcb736b870
diff --git a/includes/layouts.php b/includes/layouts.php index <HASH>..<HASH> 100644 --- a/includes/layouts.php +++ b/includes/layouts.php @@ -477,7 +477,7 @@ function _carelib_is_post_layout_forced( $post_id = '' ) { } foreach ( $post_ids as $id ) { - if ( $id === $post_id ) { + if ( (int) $id === (int) $post_id ) { return true; } }
Ensure post IDs are always integers
cipherdevgroup_carelib
train
php
ae5497d34ace5336e1eacce89755276ef3ff05e9
diff --git a/lib/instana/util.rb b/lib/instana/util.rb index <HASH>..<HASH> 100644 --- a/lib/instana/util.rb +++ b/lib/instana/util.rb @@ -176,10 +176,14 @@ module Instana end if defined?(::Resque) + # Just because Resque is defined doesn't mean this is a resque process necessarily + # Check arguments for a match if ($0 =~ /resque-#{Resque::Version}/) return "Resque Worker" elsif ($0 =~ /resque-pool-master/) return "Resque Pool Master" + elsif ($0 =~ /resque-scheduler/) + return "Resque Scheduler" end end @@ -187,10 +191,20 @@ module Instana return Rails.application.class.to_s.split('::')[0] end - return File.basename($0) + if $0.to_s.empty? + return "Ruby" + end + + exe = File.basename($0) + if exe == "rake" + return "Rake" + end + + return exe rescue Exception => e Instana.logger.info "#{__method__}:#{File.basename(__FILE__)}:#{__LINE__}: #{e.message}" Instana.logger.debug { e.backtrace.join("\r\n") } + return "Ruby" end # Get the current time in milliseconds from the epoch
Extended application name detection (#<I>) * Extended application name detection * Don't run basename twice
instana_ruby-sensor
train
rb
e38a2847b30a1a22d3615be231069c4a753d3d21
diff --git a/rpc_differ/rpc_differ.py b/rpc_differ/rpc_differ.py index <HASH>..<HASH> 100644 --- a/rpc_differ/rpc_differ.py +++ b/rpc_differ/rpc_differ.py @@ -66,6 +66,12 @@ projects between two RPC-OpenStack revisions. help="Git repo storage directory (default: ~/.osa-differ)", ) parser.add_argument( + '-r', '--rpc-repo-url', + action='store', + default="https://github.com/rcbops/rpc-openstack", + help="Github repository for the rpc-openstack project" + ) + parser.add_argument( '-u', '--update', action='store_true', default=False, @@ -123,7 +129,7 @@ def get_osa_commits(repo_dir, old_commit, new_commit): def make_rpc_report(repo_dir, old_commit, new_commit, args): """Create initial RST report header for OpenStack-Ansible.""" - rpc_repo_url = "https://github.com/rcbops/rpc-openstack" + rpc_repo_url = args.rpc_repo_url osa_differ.update_repo(repo_dir, rpc_repo_url, args.update) # Are these commits valid?
Add argument for arbitrary rpc repo This commit adds an argument, rpc-repo-url, so user-forked repositories can be used for comparing commits. The default for this argument is the offical rpc-openstack repository. This might be useful for anyone who might doing revesion release testing in a forked version of rpc-openstack.
rcbops_rpc_differ
train
py
34db2b7caacefac2dd808b52a7f77d58ff6a8b69
diff --git a/activerecord/lib/active_record/associations/has_many_association.rb b/activerecord/lib/active_record/associations/has_many_association.rb index <HASH>..<HASH> 100644 --- a/activerecord/lib/active_record/associations/has_many_association.rb +++ b/activerecord/lib/active_record/associations/has_many_association.rb @@ -121,13 +121,11 @@ module ActiveRecord # Deletes the records according to the <tt>:dependent</tt> option. def delete_records(records, method) if method == :destroy - count = records.length records.each(&:destroy!) - update_counter(-count) unless inverse_updates_counter_cache? + update_counter(-records.length) unless inverse_updates_counter_cache? else scope = self.scope.where(reflection.klass.primary_key => records) - count = delete_count(method, scope) - update_counter(-count) + update_counter(-delete_count(method, scope)) end end
remove count var this change was unneccsary as nothing was gained from it
rails_rails
train
rb
66e472039501efb41eeea7a45d69ada75dc337ba
diff --git a/scripts/devops_tasks/git_helper.py b/scripts/devops_tasks/git_helper.py index <HASH>..<HASH> 100644 --- a/scripts/devops_tasks/git_helper.py +++ b/scripts/devops_tasks/git_helper.py @@ -30,6 +30,7 @@ EXCLUDED_PACKAGE_VERSIONS = { 'azure-communication-phonenumbers': '1.0.0', 'azure-communication-sms': '1.0.0', 'azure-search-documents': '11.2.0b3', + 'azure-ai-language-questionanswering': '1.0.0b1' } # This method identifies release tag for latest or oldest released version of a given package
disable regression testing for beta version of questionanswering (#<I>)
Azure_azure-sdk-for-python
train
py
8922f64e923ea97231953997e8b12b186761b35d
diff --git a/lib/components/app/responsive-webapp.js b/lib/components/app/responsive-webapp.js index <HASH>..<HASH> 100644 --- a/lib/components/app/responsive-webapp.js +++ b/lib/components/app/responsive-webapp.js @@ -118,7 +118,7 @@ class ResponsiveWebapp extends Component { componentWillUnmount () { // Remove on back button press listener. - window.removeEventListener('popstate', () => {}) + window.removeEventListener('popstate') } render () {
refactor(webapp): remove no-op function arg This was added in an attempt to silence an error/warning during debugging the upgrade to React <I>, but the fix was a red herring (something else was the matter).
opentripplanner_otp-react-redux
train
js
c45fefd52292f2defd89297b4c2da93d6e8014ec
diff --git a/commands.go b/commands.go index <HASH>..<HASH> 100644 --- a/commands.go +++ b/commands.go @@ -24,6 +24,18 @@ func (a commandArgs) Arg(i int) string { return a[i+2] } +func (a commandArgs) DebugPrint(prompt string) { + fmt.Printf("%s\n", prompt) + fmt.Printf("\tFull Command: %s\n", a.FullCommand()) + fmt.Printf("\t.ID(): %s\n", a.ID()) + for index, arg := range a { + if index < 2 { + continue + } + fmt.Printf("\t.Arg(%d): \"%s\"\n", index-2, arg) + } +} + var commands []command // Register all supported client command handlers
Add debug print for command args to help in debugging
jordwest_imap-server
train
go
8a231f3f44ae3a31dfb498697df4deaf4a13b910
diff --git a/ingreedypy.py b/ingreedypy.py index <HASH>..<HASH> 100644 --- a/ingreedypy.py +++ b/ingreedypy.py @@ -268,7 +268,9 @@ class Ingreedy(NodeVisitor): = "touches" / "touch" - number + number = written_number space + + written_number = "a" / "an" / "zero" @@ -371,6 +373,9 @@ class Ingreedy(NodeVisitor): return self.res def visit_number(self, node, visited_children): + return visited_children[0] + + def visit_written_number(self, node, visited_children): return number_value[node.text] def generic_visit(self, node, visited_children): diff --git a/ingreedytest.py b/ingreedytest.py index <HASH>..<HASH> 100644 --- a/ingreedytest.py +++ b/ingreedytest.py @@ -197,6 +197,11 @@ test_cases = { 'ingredient': 'vanilla ice cream', 'unit': 'ounce', }, + 'apple': { + 'amount': None, + 'ingredient': 'apple', + 'unit': None, + }, }
Issue with parsing of ingredients where description has prefix 'a' (#3)
scttcper_ingreedy-py
train
py,py
8f7a397731707217ed73e83c268f8ba7539e858f
diff --git a/src/ExtendedPdo.php b/src/ExtendedPdo.php index <HASH>..<HASH> 100644 --- a/src/ExtendedPdo.php +++ b/src/ExtendedPdo.php @@ -469,7 +469,9 @@ class ExtendedPdo extends PDO implements ExtendedPdoInterface $sth = parent::prepare($statement, $options); // for the placeholders we found, bind the corresponding data values, - // along with all sequential values for question marks + // along with all sequential values for question marks. + // PROBLEM: THIS WILL NOT QUOTE ARRAYS INTO CSV STRINGS. HOW CAN WE + // DEAL WITH THIS? foreach ($this->bind_values as $key => $val) { if (is_int($key) || in_array($key, $placeholders)) { $sth->bindValue($key, $this->bind_values[$key]);
add note about question-mark placeholders and array quoting
auraphp_Aura.Sql
train
php
30e4e8e406165f61dc207abf5685f83ff193f662
diff --git a/src/physics/body.js b/src/physics/body.js index <HASH>..<HASH> 100644 --- a/src/physics/body.js +++ b/src/physics/body.js @@ -75,8 +75,7 @@ this.collisionMask = me.collision.types.ALL_OBJECT; /** - * define the collision type of the body for collision filtering<br> - * (set to `NO_OBJECT` to disable collision for this object). + * define the collision type of the body for collision filtering * @public * @type Number * @name collisionType @@ -293,9 +292,9 @@ }, /** - * By default all entities are able to collide with all the other entities, <br> + * By default all entities are able to collide with all other entities, <br> * but it's also possible to specificy 'collision filters' to provide a finer <br> - * control over which entities can collide with each other, using collisionMask. + * control over which entities can collide with each other. * @name setCollisionMask * @memberOf me.Body * @public @@ -305,6 +304,9 @@ * @example * // filter collision detection with collision shapes, enemies and collectables * myEntity.body.setCollisionMask(me.collision.types.WORLD_SHAPE | me.collision.types.ENEMY_OBJECT | me.collision.types.COLLECTABLE_OBJECT); + * ... + * // disable collision detection with all other objects + * myEntity.body.setCollisionMask(me.collision.types.NO_OBJECT); */ setCollisionMask : function (bitmask) { this.collisionMask = bitmask;
Clarified documentation for the `setCollisionMask` function to indicate how to properly disable collision for a given object
melonjs_melonJS
train
js
d6de746ce8b42946f4446984f9f795eae4c771c7
diff --git a/router/http.go b/router/http.go index <HASH>..<HASH> 100644 --- a/router/http.go +++ b/router/http.go @@ -438,6 +438,7 @@ func (s *httpService) ServeHTTP(w http.ResponseWriter, req *http.Request) { outreq.ProtoMajor = 1 outreq.ProtoMinor = 1 outreq.Close = false + outreq.Body = &fakeCloseReadCloser{outreq.Body} // TODO: Proxy HTTP CONNECT? (example: Go RPC over HTTP) @@ -491,9 +492,11 @@ func (s *httpService) ServeHTTP(w http.ResponseWriter, req *http.Request) { continue } log.Println("http: proxy error:", err) + outreq.Body.(*fakeCloseReadCloser).RealClose() fail(w, 503) return } + outreq.Body.(*fakeCloseReadCloser).RealClose() defer res.Body.Close() break } @@ -708,3 +711,18 @@ func shuffle(s []string) []string { } return s } + +type fakeCloseReadCloser struct { + io.ReadCloser +} + +func (w *fakeCloseReadCloser) Close() error { + return nil +} + +func (w *fakeCloseReadCloser) RealClose() error { + if w.ReadCloser == nil { + return nil + } + return w.ReadCloser.Close() +}
router: make request bodies stay open for retries http.Transport will call Close() on any Request.Body after it encounters any error. We are retrying the same request under certain circumstances (dial errors in particular), so we need to keep the body open until we're done retrying. Fixes #<I>.
flynn_flynn
train
go
ad3ed38e269550318ea2117e32e578848ec2f6f8
diff --git a/app.php b/app.php index <HASH>..<HASH> 100644 --- a/app.php +++ b/app.php @@ -4,7 +4,13 @@ $request = split('/', preg_replace('/^\//', '', preg_replace('/\/$/', '', preg_r $action = array_pop($request); $edit_mode = true; // determines whether we should go ahead and load index.php $code_id = ''; -$ajax = isset($_SERVER['HTTP_X_REQUESTED_WITH']) || (isset($_SERVER['HTTP_ACCESS_CONTROL_REQUEST_METHOD']) && $_SERVER['HTTP_ACCESS_CONTROL_REQUEST_METHOD'] == 'GET'); + +// if it contains the x-requested-with header, or is a CORS request on GET only +$ajax = isset($_SERVER['HTTP_X_REQUESTED_WITH']) || (isset($_SERVER['HTTP_ORIGIN']) && $_SERVER[' REQUEST_METHOD'] == 'GET'); + +foreach ($_SERVER as $k => $v) { + error_log($k . ' = ' . $v); +} // respond to preflights if ($_SERVER['REQUEST_METHOD'] == 'OPTIONS') {
Support CORS requests that don't have preflight
jsbin_jsbin
train
php
6f7b96b93ba98abdc260c3e7549c0ee72f04298e
diff --git a/activerecord/lib/active_record/persistence.rb b/activerecord/lib/active_record/persistence.rb index <HASH>..<HASH> 100644 --- a/activerecord/lib/active_record/persistence.rb +++ b/activerecord/lib/active_record/persistence.rb @@ -1076,7 +1076,8 @@ module ActiveRecord def _raise_record_not_destroyed @_association_destroy_exception ||= nil - raise @_association_destroy_exception || RecordNotDestroyed.new("Failed to destroy the #{self.class} record", self) + key = self.class.primary_key + raise @_association_destroy_exception || RecordNotDestroyed.new("Failed to destroy #{self.class} with #{key}=#{send(key)}", self) ensure @_association_destroy_exception = nil end
Update activerecord/lib/active_record/persistence.rb
rails_rails
train
rb
dea055014394d440be5cc3fc9490fe13841ce5cd
diff --git a/salt/master.py b/salt/master.py index <HASH>..<HASH> 100644 --- a/salt/master.py +++ b/salt/master.py @@ -732,6 +732,13 @@ class MWorker(multiprocessing.Process): raise # catch all other exceptions, so we don't go defunct except Exception as exc: + # since we are in an exceptional state, lets attempt to tell + # the minion we have a problem, otherwise the minion will get + # no response and be forced to wait for their max timeout + try: + socket.send('Unexpected Error in Mworker') + except: # pylint: disable=W0702 + pass # Properly handle EINTR from SIGUSR1 if isinstance(exc, zmq.ZMQError) and exc.errno == errno.EINTR: continue
Attempt to return errors to minions from Master Right now for all exceptions on the master we handle the exception and reset the socket. This means the master doesn't die-- but we aren't being very nice to the minion, since we never sent a response. This means the minion has to wait until their max timeout. This way we will attempt to notify the minion so they can stop waiting.
saltstack_salt
train
py
d40810c702ef3be06389243b3a361330c0afaf8b
diff --git a/lib/temple/html/fast.rb b/lib/temple/html/fast.rb index <HASH>..<HASH> 100644 --- a/lib/temple/html/fast.rb +++ b/lib/temple/html/fast.rb @@ -21,7 +21,7 @@ module Temple set_default_options :format => :xhtml, :attr_wrapper => "'", :autoclose => %w[meta img link br hr input area param col base], - :join_delimiter => {'id' => '_', 'class' => ' '} + :attr_delimiter => {'id' => '_', 'class' => ' '} def initialize(options = {}) super @@ -87,7 +87,7 @@ module Temple raise 'Attribute is not a html attr' if attr[0] != :html || attr[1] != :attr name, value = attr[2].to_s, attr[3] if result[name] - delimiter = options[:join_delimiter][name] + delimiter = options[:attr_delimiter][name] raise "Multiple #{name} attributes specified" unless delimiter if contains_static?(value) result[name] = [:html, :attr, name,
rename join_delimiter to attr_delimiter
judofyr_temple
train
rb
4e65908faf409e6ee5ff14118e399f043d92a2b2
diff --git a/src/Orm/Entity.php b/src/Orm/Entity.php index <HASH>..<HASH> 100755 --- a/src/Orm/Entity.php +++ b/src/Orm/Entity.php @@ -52,11 +52,14 @@ class Entity { /** * Removed field from object - * @param string $field + * @param string|array $fields * @return $this */ - public function unsetField($field) { - unset($this->data[$field]); + public function unsetField($fields) { + $fields = (array)$fields; + foreach ($fields as $field) { + unset($this->data[$field]); + } return $this; }
Entity unset field - can supply array
devp-eu_tmcms-core
train
php
24778553cd5499777492b8b81ad8a762a014f089
diff --git a/src/Symfony/Component/HttpFoundation/RequestMatcher.php b/src/Symfony/Component/HttpFoundation/RequestMatcher.php index <HASH>..<HASH> 100644 --- a/src/Symfony/Component/HttpFoundation/RequestMatcher.php +++ b/src/Symfony/Component/HttpFoundation/RequestMatcher.php @@ -70,13 +70,7 @@ class RequestMatcher implements RequestMatcherInterface */ public function matchMethod($method) { - $this->methods = array_map( - function ($m) - { - return strtolower($m); - }, - is_array($method) ? $method : array($method) - ); + $this->methods = array_map('strtolower', is_array($method) ? $method : array($method)); } /**
[HttpFoundation] simplified code
symfony_symfony
train
php
2b2f30b80c785f0d8357f8ec642ee4e536402481
diff --git a/lib/updater.js b/lib/updater.js index <HASH>..<HASH> 100644 --- a/lib/updater.js +++ b/lib/updater.js @@ -78,7 +78,10 @@ var Updater = function(options) { function(callback) { plot.emptyNotified = now; plot.save(callback); - }], logError); + } + ], callback); + } else { + callback(null); } return; }, @@ -141,7 +144,7 @@ var Updater = function(options) { ], callback); } else { log.info("No change"); - callback(null); + callback(null, crop); } break; case Crop.NEW: // new stuff needs water
Empty plots are taking up the whole plot queue
e14n_pump.io-client-app
train
js
4f9adfe208b20121bd653bfddd269be658ff9699
diff --git a/packages/app-frontend/src/features/apps/index.js b/packages/app-frontend/src/features/apps/index.js index <HASH>..<HASH> 100644 --- a/packages/app-frontend/src/features/apps/index.js +++ b/packages/app-frontend/src/features/apps/index.js @@ -26,6 +26,8 @@ export function useApps () { watch(currentAppId, value => { bridge.send(BridgeEvents.TO_BACK_APP_SELECT, value) + }, { + immediate: true }) return {
fix(app): not selecting on initial mount
vuejs_vue-devtools
train
js
0e35ffb4fb15b2fac75606370179d12beae454cf
diff --git a/django_extensions/utils/uuid.py b/django_extensions/utils/uuid.py index <HASH>..<HASH> 100644 --- a/django_extensions/utils/uuid.py +++ b/django_extensions/utils/uuid.py @@ -506,8 +506,8 @@ def uuid1(node=None, clock_seq=None): def uuid3(namespace, name): """Generate a UUID from the MD5 hash of a namespace UUID and a name.""" - import md5 - hash = md5.md5(namespace.bytes + name).digest() + from hashlib import md5 + hash = md5(namespace.bytes + name).digest() return UUID(bytes=hash[:16], version=3) def uuid4(): @@ -529,8 +529,8 @@ def uuid4(): def uuid5(namespace, name): """Generate a UUID from the SHA-1 hash of a namespace UUID and a name.""" - import sha - hash = sha.sha(namespace.bytes + name).digest() + from hashlib import sha1 + hash = sha1(namespace.bytes + name).digest() return UUID(bytes=hash[:16], version=5) # The following standard UUIDs are for use with uuid3() or uuid5().
removed sha1/md5 import in favor of hashlib
django-extensions_django-extensions
train
py
775342d1b5ddcbf412fcf0605b239580dcdd22ad
diff --git a/spec/link_shrink/config_spec.rb b/spec/link_shrink/config_spec.rb index <HASH>..<HASH> 100644 --- a/spec/link_shrink/config_spec.rb +++ b/spec/link_shrink/config_spec.rb @@ -15,7 +15,13 @@ describe LinkShrink::Config do describe '#api' do it 'sets api' do link_shrink.api = LinkShrink::Shrinkers::Google - expect(link_shrink.api).to eq(LinkShrink::Shrinkers::Google) + expect(link_shrink.api.class).to eq(LinkShrink::Shrinkers::Google) + end + + context 'by default api is set to Google' do + it 'returns api name' do + expect(link_shrink.api.class).to eq(LinkShrink::Shrinkers::Google) + end end end
Update config_spec to test fallback
jonahoffline_link_shrink
train
rb
572d63a38198d35ef68a9e6e0a2473e55bd5006d
diff --git a/Neos.Flow/Classes/Persistence/Doctrine/Service.php b/Neos.Flow/Classes/Persistence/Doctrine/Service.php index <HASH>..<HASH> 100644 --- a/Neos.Flow/Classes/Persistence/Doctrine/Service.php +++ b/Neos.Flow/Classes/Persistence/Doctrine/Service.php @@ -606,7 +606,7 @@ class Service <?php namespace $namespace; -use Doctrine\DBAL\Migrations\AbstractMigration; +use Doctrine\Migrations\AbstractMigration; use Doctrine\DBAL\Schema\Schema; /**
TASK: Change generated use to new AbstractCLass Exchange `use Doctrine\DBAL\Migrations\AbstractMigration;` (deprecated since Doctrine/Dbal <I>) with `use Doctrine\Migrations\AbstractMigration;
neos_flow-development-collection
train
php
0e9b7ac9d1dbf9b892b94b0b538443c4f1814b1f
diff --git a/example_cookie/main.go b/example_cookie/main.go index <HASH>..<HASH> 100644 --- a/example_cookie/main.go +++ b/example_cookie/main.go @@ -2,7 +2,7 @@ package main import ( "github.com/gin-contrib/sessions" - "github.com/gin-gonic/gin" + "gopkg.in/gin-gonic/gin.v1" ) func main() { diff --git a/example_redis/main.go b/example_redis/main.go index <HASH>..<HASH> 100644 --- a/example_redis/main.go +++ b/example_redis/main.go @@ -2,7 +2,7 @@ package main import ( "github.com/gin-contrib/sessions" - "github.com/gin-gonic/gin" + "gopkg.in/gin-gonic/gin.v1" ) func main() {
Use gopkg.in in examples
gin-contrib_sessions
train
go,go
8d88b1f4d7d2ffce722bd9e9e6ea0d742d09b4db
diff --git a/validator/webapp.py b/validator/webapp.py index <HASH>..<HASH> 100644 --- a/validator/webapp.py +++ b/validator/webapp.py @@ -47,7 +47,7 @@ def detect_webapp_raw(err, webapp): if "name" in webapp and len(webapp["name"]) > 9: err.warning( err_id=("webapp", "b2g", "name_truncated"), - warning="App name may be truncated in Gaia.", + warning="App name may be truncated on Firefox OS devices.", description="Your app's name is long enough to possibly be " "truncated on Firefox OS devices. Consider using " "a shorter name for your app.")
Missed one, oops.
mozilla_amo-validator
train
py
0312d967c86cb1e640b74ed82f231f09645c432c
diff --git a/src/Pux/Executor.php b/src/Pux/Executor.php index <HASH>..<HASH> 100644 --- a/src/Pux/Executor.php +++ b/src/Pux/Executor.php @@ -12,17 +12,20 @@ class Executor */ public static function execute($route) { - $cb = $route[2]; /* get callback */ + list($pcre,$pattern,$cb,$options) = $route; // create the reflection class $rc = new ReflectionClass( $cb[0] ); - $args = null; + $constructArgs = null; + if ( isset($options['constructor_args']) ) { + $constructArgs = $options['constructor_args']; + } // if the first argument is a class name string, // then create the controller object. if( is_string($cb[0]) ) { - $cb[0] = $controller = $args ? $rc->newInstanceArgs($args) : $rc->newInstance(); + $cb[0] = $controller = $constructArgs ? $rc->newInstanceArgs($constructArgs) : $rc->newInstance(); } else { $controller = $cb[0]; } @@ -40,8 +43,8 @@ class Executor // XXX: - $vars = isset($route[3]['vars']) - ? $route[3]['vars'] + $vars = isset($options['vars']) + ? $options['vars'] : array() ;
Add constructor_args paraemter support for executor
c9s_Pux
train
php
1d70ee43ff7cb1fa84564cd4bc1f16a6c67f05f8
diff --git a/Command/StopWorkerCommand.php b/Command/StopWorkerCommand.php index <HASH>..<HASH> 100644 --- a/Command/StopWorkerCommand.php +++ b/Command/StopWorkerCommand.php @@ -38,7 +38,7 @@ class StopWorkerCommand extends ContainerAwareCommand $output->writeln($worker->getId()); } } else { - $output->writeln('<error>There is no running worker.</error>'); + $output->writeln('<error>There are no running workers to stop.</error>'); } return 1; @@ -47,6 +47,12 @@ class StopWorkerCommand extends ContainerAwareCommand $workers = array($worker); } + if (!count($workers)) { + $output->writeln('<error>There are no running workers to stop.</error>'); + + return 0; + } + foreach ($workers as $worker) { $output->writeln(\sprintf('Stopping %s...', $worker->getId())); $worker->stop();
Display warning If there are no running workers and you try to stop them Before this PR there would be no output if you attempted to stop all workers, when there were no active workers. After this PR you get told there are no running workers to stop Also fixes some english :-)
resquebundle_resque
train
php
cbcf835ddad6d9d2a4cd6f99bd848a2169b026bc
diff --git a/test.js b/test.js index <HASH>..<HASH> 100644 --- a/test.js +++ b/test.js @@ -497,6 +497,10 @@ function runTests (options) { it('should check ignore after stating', function(done) { var testDir = getFixturePath('subdir'); var spy = sinon.spy(); + try {fs.mkdirSync(testDir, 0x1ed);} catch(err) {} + fs.writeFileSync(testDir + '/add.txt', ''); + fs.mkdirSync(testDir + '/dir', 0x1ed); + fs.writeFileSync(testDir + '/dir/ignored.txt', ''); function ignoredFn(path, stats) { if (path === testDir || !stats) return false; return stats.isDirectory(); @@ -504,10 +508,6 @@ function runTests (options) { options.ignored = ignoredFn; var watcher = chokidar.watch(testDir, options); watcher.on('add', spy); - try {fs.mkdirSync(testDir, 0x1ed);} catch(err) {} - fs.writeFileSync(testDir + '/add.txt', ''); - fs.mkdirSync(testDir + '/dir', 0x1ed); - fs.writeFileSync(testDir + '/dir/ignored.txt', ''); delay(function() { watcher.close(); spy.should.have.been.calledOnce;
Create fixtures prior to starting watcher This test worked before by exploiting an inefficiency in chokidar (an unnecessary fs.realpath call), which was removed in the prior commit. This could also be made to work by adding a delay between creating watcher, and writing the fixtures, but dealing with watching previously non-existent paths is not what this test is about.
paulmillr_chokidar
train
js
77bd7eaedea1ab7fb2112e070435091eeb4e7c36
diff --git a/core/dnsserver/zdirectives.go b/core/dnsserver/zdirectives.go index <HASH>..<HASH> 100644 --- a/core/dnsserver/zdirectives.go +++ b/core/dnsserver/zdirectives.go @@ -41,6 +41,7 @@ var Directives = []string{ "proxy", "erratic", "whoami", + "on", "startup", "shutdown", } diff --git a/core/plugin/zplugin.go b/core/plugin/zplugin.go index <HASH>..<HASH> 100644 --- a/core/plugin/zplugin.go +++ b/core/plugin/zplugin.go @@ -35,5 +35,6 @@ import ( _ "github.com/coredns/coredns/plugin/tls" _ "github.com/coredns/coredns/plugin/trace" _ "github.com/coredns/coredns/plugin/whoami" + _ "github.com/mholt/caddy/onevent" _ "github.com/mholt/caddy/startupshutdown" ) diff --git a/plugin.cfg b/plugin.cfg index <HASH>..<HASH> 100644 --- a/plugin.cfg +++ b/plugin.cfg @@ -50,5 +50,6 @@ etcd:etcd proxy:proxy erratic:erratic whoami:whoami +on:github.com/mholt/caddy/onevent startup:github.com/mholt/caddy/startupshutdown shutdown:github.com/mholt/caddy/startupshutdown
Add on plugin (#<I>) Enable this Caddy plugin by default. Docs will go up coredns.io for this as well. See <URL>
coredns_coredns
train
go,go,cfg
a442c01e57af2fc09d4ff794883f8d08629c0ce6
diff --git a/php/lib/GrabzItClient.class.php b/php/lib/GrabzItClient.class.php index <HASH>..<HASH> 100644 --- a/php/lib/GrabzItClient.class.php +++ b/php/lib/GrabzItClient.class.php @@ -73,7 +73,7 @@ class GrabzItClient } /* - This method creates an encryption key to pass to the encryption key parameter. + This method creates a cryptographically secure encryption key to pass to the encryption key parameter. */ public function CreateEncrpytionKey() {
Added encrypted captures to the PHP API
GrabzIt_grabzit
train
php
f1a9181a3f3f9af4e6d58e2eaecccd5076744fd3
diff --git a/core/src/main/java/com/orientechnologies/orient/core/db/document/ODocumentFieldWalker.java b/core/src/main/java/com/orientechnologies/orient/core/db/document/ODocumentFieldWalker.java index <HASH>..<HASH> 100755 --- a/core/src/main/java/com/orientechnologies/orient/core/db/document/ODocumentFieldWalker.java +++ b/core/src/main/java/com/orientechnologies/orient/core/db/document/ODocumentFieldWalker.java @@ -96,13 +96,12 @@ public class ODocumentFieldWalker { if (fieldWalker.goDeeper(fieldType, linkedType, fieldValue)) { if (fieldValue instanceof Map) walkMap((Map) fieldValue, fieldType, fieldWalker, walked); - else if (OMultiValue.isIterable(fieldValue)) - walkIterable(OMultiValue.getMultiValueIterable(fieldValue), fieldType, fieldWalker, walked); else if (fieldValue instanceof ODocument) { final ODocument doc = (ODocument) fieldValue; if (OType.EMBEDDED.equals(fieldType) || doc.isEmbedded()) walkDocument((ODocument) fieldValue, fieldWalker); - } + } else if (OMultiValue.isIterable(fieldValue)) + walkIterable(OMultiValue.getMultiValueIterable(fieldValue), fieldType, fieldWalker, walked); } }
fixed bug on link rewrite in case of embedded document, issue #<I>, test missing
orientechnologies_orientdb
train
java
b01b073e85d29fb547c238919dc8d545ffbe917f
diff --git a/src/Head/AttributeTrait.php b/src/Head/AttributeTrait.php index <HASH>..<HASH> 100644 --- a/src/Head/AttributeTrait.php +++ b/src/Head/AttributeTrait.php @@ -30,11 +30,6 @@ trait AttributeTrait public function withAttribute($key, $value) { $newAttributes = $this->attributes->withAttribute($key, $value); - // If there was no change, don't bother changing this object either. - if ($newAttributes === $this->attributes) { - return $this; - } - $that = clone($this); $that->attributes = $newAttributes; diff --git a/src/HtmlPage.php b/src/HtmlPage.php index <HASH>..<HASH> 100644 --- a/src/HtmlPage.php +++ b/src/HtmlPage.php @@ -195,11 +195,6 @@ class HtmlPage implements HtmlPageInterface, Linkable { $newAttributes = $this->$collection->withAttribute($key, $value); - // If there was no change, don't bother changing this object either. - if ($newAttributes === $this->$collection) { - return $this; - } - $that = clone($this); $that->$collection = $newAttributes;
Remove hard to test micro-optimizations.
Crell_HtmlModel
train
php,php
3557a1314778d09f638bab9dbc5b05c49e537357
diff --git a/src/ol/renderer/canvas/TileLayer.js b/src/ol/renderer/canvas/TileLayer.js index <HASH>..<HASH> 100644 --- a/src/ol/renderer/canvas/TileLayer.js +++ b/src/ol/renderer/canvas/TileLayer.js @@ -108,6 +108,16 @@ class CanvasTileLayerRenderer extends CanvasLayerRenderer { /** * @inheritDoc */ + loadedTileCallback(tiles, zoom, tile) { + if (this.isDrawableTile(tile)) { + return super.loadedTileCallback(tiles, zoom, tile); + } + return false; + } + + /** + * @inheritDoc + */ prepareFrame(frameState, layerState) { return true; }
Only consider child range with drawable tiles
openlayers_openlayers
train
js
046490972d0277d5b60da945f7f246ad1f5b48d7
diff --git a/src/observatoryControl/main.py b/src/observatoryControl/main.py index <HASH>..<HASH> 100755 --- a/src/observatoryControl/main.py +++ b/src/observatoryControl/main.py @@ -156,7 +156,7 @@ if "clippingRegion" not in obstory_status: db.register_obstory_metadata(obstory_name=obstory_name, key="clippingRegion", value="[[]]", - metadata_time=get_utc(), + metadata_time=0, time_created=get_utc(), user_created=mod_settings.settings['meteorpiUser']) obstory_status = db.get_obstory_status(obstory_name=obstory_name)
Fixed bug that if clipping region data goes missing from MySQL observatory goes into infinite fail loop
camsci_meteor-pi
train
py
615ec2b10266f39c6d78b76bfbba52914376bb12
diff --git a/features/support/env.rb b/features/support/env.rb index <HASH>..<HASH> 100644 --- a/features/support/env.rb +++ b/features/support/env.rb @@ -9,7 +9,6 @@ require_relative 'executor' Before do FileUtils.mkdir_p(expand_path('.')) - FileUtils.cp_r('examples', expand_path('.')) # Use InProcess testing by default Aruba.configure do |config|
Do not copy examples over (causes warning in cookbooks_path)
chefspec_chefspec
train
rb
60e272b90df1b26dee8309017fcaaf3cb9c5e081
diff --git a/lib/setupHttpRoutes.js b/lib/setupHttpRoutes.js index <HASH>..<HASH> 100644 --- a/lib/setupHttpRoutes.js +++ b/lib/setupHttpRoutes.js @@ -59,6 +59,14 @@ function errorResponse(error, res){ } function setupHttpRoutes(server, skynet){ + + server.opts('/data', function(req,res){ + res.header('Access-Control-Allow-Origin', '*'); + res.header('Access-Control-Allow-Methods', 'GET,PUT,POST,DELETE,OPTIONS'); + res.header('Access-Control-Allow-Headers', 'Content-Type, Authorization, Content-Length, X-Requested-With'); + res.send(200); + }); + // curl http://localhost:3000/status server.get('/status', function(req, res){ res.setHeader('Access-Control-Allow-Origin','*');
added more CORS logic to support mobile app
octoblu_meshblu
train
js
211dde287223d7c99d353f0750e649cdfd653845
diff --git a/resource_aws_sns_topic.go b/resource_aws_sns_topic.go index <HASH>..<HASH> 100644 --- a/resource_aws_sns_topic.go +++ b/resource_aws_sns_topic.go @@ -47,7 +47,10 @@ func resourceAwsSnsTopic() *schema.Resource { ForceNew: false, Computed: true, StateFunc: func(v interface{}) string { - jsonb := []byte(v.(string)) + jsonb := []byte{} + if v != nil { + jsonb = []byte(v.(string)) + } buffer := new(bytes.Buffer) if err := json.Compact(buffer, jsonb); err != nil { log.Printf("[WARN] Error compacting JSON for Policy in SNS Topic")
Fix panic I see when upgrading to <I> Check if the policy is nil or not before type casting it
terraform-providers_terraform-provider-aws
train
go
44f7325a9138aebf800ada92277505d65a6a9f9e
diff --git a/lib/devise/models/authenticatable.rb b/lib/devise/models/authenticatable.rb index <HASH>..<HASH> 100644 --- a/lib/devise/models/authenticatable.rb +++ b/lib/devise/models/authenticatable.rb @@ -1,6 +1,5 @@ # frozen_string_literal: true -require 'active_model/version' require 'devise/hooks/activatable' require 'devise/hooks/csrf_cleaner'
Remove unneeded require The code that was using that constant is not being used anymore. Closes #<I>
plataformatec_devise
train
rb
344ddbc8e112b3958860943f52f9bcfd3f1f0c86
diff --git a/suds/bindings/document.py b/suds/bindings/document.py index <HASH>..<HASH> 100644 --- a/suds/bindings/document.py +++ b/suds/bindings/document.py @@ -68,7 +68,7 @@ class Document(Binding): # how they would be affected by this change. # * If caller actually wishes to pass an empty choice parameter he # can specify its value explicitly as an empty string. - if pd[2] and value is None: + if len(pd) > 2 and pd[2] and value is None: continue p = self.mkparam(method, pd, value) if p is None:
Fix IndexError occurring when we have a single web service operation parameter.
ovnicraft_suds2
train
py
2e1fd69af9a38a74fc5fee8dd54807bda7d4325c
diff --git a/v2/websocket/api.go b/v2/websocket/api.go index <HASH>..<HASH> 100644 --- a/v2/websocket/api.go +++ b/v2/websocket/api.go @@ -4,6 +4,7 @@ import ( "context" "fmt" + "github.com/bitfinexcom/bitfinex-api-go/pkg/models/fundingloan" "github.com/bitfinexcom/bitfinex-api-go/v2" ) @@ -223,12 +224,12 @@ func (c *Client) SubmitFundingCancel(ctx context.Context, fundingOffer *bitfinex } // CloseFundingLoan - cancels funding loan by ID. Emits an error if not authenticated. -func (c *Client) CloseFundingLoan(ctx context.Context, fundingOffer *bitfinex.FundingLoanCancelRequest) error { +func (c *Client) CloseFundingLoan(ctx context.Context, flcr *fundingloan.CancelRequest) error { socket, err := c.GetAuthenticatedSocket() if err != nil { return err } - return socket.Asynchronous.Send(ctx, fundingOffer) + return socket.Asynchronous.Send(ctx, flcr) } // CloseFundingCredit - cancels funding credit by ID. Emits an error if not authenticated.
v2/websocket/api.go putting new fundingloan package to work
bitfinexcom_bitfinex-api-go
train
go
efc1328410ee009f109f93288a48e690ed550a3c
diff --git a/lib/beanstalkd_view/server.rb b/lib/beanstalkd_view/server.rb index <HASH>..<HASH> 100644 --- a/lib/beanstalkd_view/server.rb +++ b/lib/beanstalkd_view/server.rb @@ -6,7 +6,7 @@ module BeanstalkdView root = File.dirname(File.expand_path(__FILE__)) set :root, root - set :views, "#{root}/views" + set :views, (ENV['BEANSTALKD_VIEW_TEMPLATES'] || "#{root}/views") if respond_to? :public_folder set :public_folder, "#{root}/resources" else @@ -85,6 +85,7 @@ module BeanstalkdView end get "/peek-range" do + begin @min = params[:min].to_i @max = params[:max].to_i
Support views path override by ENV. It can be helpfull if one wants to make own looking table.
denniskuczynski_beanstalkd_view
train
rb
38721a5e9e6bfc3bda835602fa0171673f7a85b1
diff --git a/common.go b/common.go index <HASH>..<HASH> 100644 --- a/common.go +++ b/common.go @@ -1,7 +1,9 @@ package syslogparser import ( + "fmt" "strconv" + "strings" ) const ( @@ -149,3 +151,9 @@ func parseHostname(buff []byte, cursor *int, l int) (string, error) { return string(hostname), nil } + +func showCursorPos(buff []byte, cursor int) { + fmt.Println(string(buff)) + padding := strings.Repeat("-", cursor) + fmt.Println(padding + "↑\n") +}
Added showCursorPos Useful for debugging
mcuadros_go-syslog
train
go
eb1734a896670cabe056b71bc5829fe25c6789d9
diff --git a/core/src/main/java/com/ibm/watson/developer_cloud/service/WatsonService.java b/core/src/main/java/com/ibm/watson/developer_cloud/service/WatsonService.java index <HASH>..<HASH> 100644 --- a/core/src/main/java/com/ibm/watson/developer_cloud/service/WatsonService.java +++ b/core/src/main/java/com/ibm/watson/developer_cloud/service/WatsonService.java @@ -422,6 +422,7 @@ public abstract class WatsonService { this.username = username; this.password = password; apiKey = Credentials.basic(username, password); + clearIamCredentials(); } } @@ -451,6 +452,9 @@ public abstract class WatsonService { this.tokenManager = new IamTokenManager(iamOptions); } + private void clearIamCredentials(){ + this.tokenManager = null; + } /* * (non-Javadoc) *
fix bugs when different authentication of each instance of same service if there is vcapserices environment.
watson-developer-cloud_java-sdk
train
java
40c78e6227fee077934bff8ed66ce00ddde7fafa
diff --git a/molgenis-app/src/main/java/org/molgenis/app/WebAppSecurityConfig.java b/molgenis-app/src/main/java/org/molgenis/app/WebAppSecurityConfig.java index <HASH>..<HASH> 100644 --- a/molgenis-app/src/main/java/org/molgenis/app/WebAppSecurityConfig.java +++ b/molgenis-app/src/main/java/org/molgenis/app/WebAppSecurityConfig.java @@ -47,9 +47,7 @@ public class WebAppSecurityConfig extends MolgenisWebAppSecurityConfig listOfVoters.add(new MolgenisAccessDecisionVoter()); expressionInterceptUrlRegistry.accessDecisionManager(new AffirmativeBased(listOfVoters)); - expressionInterceptUrlRegistry.antMatchers("/").permitAll() - - .antMatchers("/fdp/**").permitAll(); + expressionInterceptUrlRegistry.antMatchers("/").permitAll(); } @Override
Remove unnecessary access decision path for fdp (already handled by /api)
molgenis_molgenis
train
java
2ff8afdfb43566638d697aa469b338973ef56227
diff --git a/panflute/tools.py b/panflute/tools.py index <HASH>..<HASH> 100644 --- a/panflute/tools.py +++ b/panflute/tools.py @@ -13,7 +13,6 @@ import sys import json import yaml import shlex -import shutil # shutil.which: new in version 3.3 try: @@ -92,7 +91,7 @@ def run_pandoc(text='', args=None): if args is None: args = [] - pandoc_path = shutil.which('pandoc') + pandoc_path = which('pandoc') if pandoc_path is None or not os.path.exists(pandoc_path): raise OSError("Path to pandoc executable does not exists")
tools.py: simplifies import which
sergiocorreia_panflute
train
py
0a638a697c4bb1951a4cd8caec0f4008052dcc00
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100755 --- a/setup.py +++ b/setup.py @@ -9,7 +9,7 @@ from setuptools import setup, find_packages setup( name='blockstack-profiles', - version='0.4.3', + version='0.4.4', url='https://github.com/blockstack/blockstack-profiles-py', license='MIT', author='Blockstack Developers',
version bump; depend on blockstack-zones instead of zone-file
blockstack-packages_blockstack-profiles-py
train
py
658bc30994a6652b795dd1231b6ab8fa81280bde
diff --git a/ykman/driver_otp.py b/ykman/driver_otp.py index <HASH>..<HASH> 100644 --- a/ykman/driver_otp.py +++ b/ykman/driver_otp.py @@ -28,6 +28,7 @@ from __future__ import absolute_import import six +import sys import time from .native.ykpers import Ykpers from ctypes import sizeof, byref, c_int, c_uint, c_size_t, create_string_buffer @@ -386,10 +387,9 @@ def open_devices(): if libversion < (1, 18): yield OTPDriver(ykpers.yk_open_first_key()) else: - i = 0 - while True: + for i in range(255): dev = ykpers.yk_open_key(i) if ykpers.yk_get_errno() != 0: - break - i += 1 + if not (sys.platform == 'win32' and ykpers.yk_get_errno() == 1): + break # A bug in ykpers sets errno = 1 on Windows. yield OTPDriver(dev)
Workaround for yk_get_errno() on Windows.
Yubico_yubikey-manager
train
py
64241330937fa9832d0910ea87b5377bc82cb4c1
diff --git a/symphony/content/content.systemauthors.php b/symphony/content/content.systemauthors.php index <HASH>..<HASH> 100644 --- a/symphony/content/content.systemauthors.php +++ b/symphony/content/content.systemauthors.php @@ -54,7 +54,7 @@ $td1 = Widget::TableData($a->getFullName(), 'inactive'); } - $td2 = Widget::TableData(Widget::Anchor($a->get('email'), 'mailto:'.$a->get('email'), 'Email this author')); + $td2 = Widget::TableData(Widget::Anchor($a->get('email'), 'mailto:'.$a->get('email'), __('Email this author'))); if(!is_null($a->get('last_seen'))) { $td3 = Widget::TableData(
Found an emancipated string
symphonycms_symphony-2
train
php
edb459e3af748f615963abd903dbab842b23afb0
diff --git a/pysat/tests/test_avg.py b/pysat/tests/test_avg.py index <HASH>..<HASH> 100644 --- a/pysat/tests/test_avg.py +++ b/pysat/tests/test_avg.py @@ -302,3 +302,16 @@ class TestSeasonalAverageUnevenBins: assert self.testInst.data['dummy1'].size*32 == sum([ sum(i) for i in results['dummy1']['count'] ]) assert np.all(check) + + def test_nonmonotonic_bins(self): + '''if the user provides non-monotonic bins then numpy.digitize should + raise a ValueError + ''' + self.testInst.bounds = (pysat.datetime(2008,1,1), + pysat.datetime(2008,2,1)) + with assert_raises(ValueError): + pysat.ssnl.avg.median2D(self.testInst, + np.array([0., 300., 100.]), 'longitude', + np.array([0., 24., 13.]), 'mlt', + ['dummy1', 'dummy2', 'dummy3'], + auto_bin=False)
added non monotonic testing for uneven bins
rstoneback_pysat
train
py
b55d733ac08f92829b8877603883304d76453f2d
diff --git a/bundles/org.eclipse.orion.client.javascript/web/javascript/ternPlugins/quickfixes.js b/bundles/org.eclipse.orion.client.javascript/web/javascript/ternPlugins/quickfixes.js index <HASH>..<HASH> 100644 --- a/bundles/org.eclipse.orion.client.javascript/web/javascript/ternPlugins/quickfixes.js +++ b/bundles/org.eclipse.orion.client.javascript/web/javascript/ternPlugins/quickfixes.js @@ -327,7 +327,11 @@ define([ */ "no-comma-dangle": function(annotation, annotations, file) { return applySingleFixToAll(annotations, function(annot){ - return {text: '', start: annot.start, end: annot.end}; + var end = annot.end; + if(annot.start+1 !== end) { + end = annot.start+1; + } + return {text: '', start: annot.start, end: end}; }); }, /**
Bug <I> - Remove extra comma quick fix breaks file
eclipse_orion.client
train
js
af21e2c0dcd7cb5b3d530a1a1fd100fb76729108
diff --git a/lib/kpeg.rb b/lib/kpeg.rb index <HASH>..<HASH> 100644 --- a/lib/kpeg.rb +++ b/lib/kpeg.rb @@ -60,7 +60,9 @@ module KPeg m.move! ans, pos - if lr.detected + # Don't bother trying to grow the left recursion + # if it's failing straight away (thus there is no seed) + if ans and lr.detected return grow_lr(rule, start_pos, m) else return ans
Minor optimization, don't grow if there is a failure
evanphx_kpeg
train
rb
7481bc15db018b8baf5ddec7936623b21e678f18
diff --git a/librosa/core/spectrum.py b/librosa/core/spectrum.py index <HASH>..<HASH> 100644 --- a/librosa/core/spectrum.py +++ b/librosa/core/spectrum.py @@ -928,10 +928,6 @@ def fmt(y, t_min=0.5, n_fmt=None, kind='slinear', beta=0.5, over_sample=1, axis= endpoint=False, base=base)[:-n_over] - # Clean up any rounding errors at the boundaries of the interpolation - # The interpolator gets angry if we try to extrapolate, so clipping is necessary here. - x_exp = np.clip(x_exp, float(t_min) / n, x[-1]) - # Resample the signal y_res = f_interp(x_exp)
trying to remove clipping in fmt sample coordinates
librosa_librosa
train
py
56637774df9b1801ef8b381d92addad8408f2fd2
diff --git a/js/bam/bamTrack.js b/js/bam/bamTrack.js index <HASH>..<HASH> 100755 --- a/js/bam/bamTrack.js +++ b/js/bam/bamTrack.js @@ -39,6 +39,7 @@ var igv = (function (igv) { this.label = config.label || ""; this.id = config.id || this.label; this.height = config.height || 400; + this.maxHeight = config.maxHeight || this.height; this.alignmentRowHeight = config.expandedHeight || 14; this.alignmentRowYInset = 1; this.visibilityWindow = config.visibilityWindow || 30000; // 30kb default @@ -366,6 +367,26 @@ var igv = (function (igv) { }; + + /** + * Optional method to compute pixel height to accomodate the list of features. The implementation below + * has side effects (modifiying the samples hash). This is unfortunate, but harmless. + * + * @param features + * @returns {number} + */ + igv.BAMTrack.prototype.computePixelHeight = function(features) { + + if(features.packedAlignments) { + return this.alignmentRowYInset + this.coverageTrackHeight + (this.alignmentRowHeight * features.packedAlignments.length) + 5; + } + else { + return this.height; + } + + } + + function shadedBaseColor(qual, nucleotide) { var color,
Adjust bam track height based on # alignment depth
igvteam_igv.js
train
js
68b64f5279f921b0a6cfaa5bddae308f3c1dbaa9
diff --git a/lib/responses/methods/index.js b/lib/responses/methods/index.js index <HASH>..<HASH> 100644 --- a/lib/responses/methods/index.js +++ b/lib/responses/methods/index.js @@ -256,8 +256,6 @@ module.exports = { console.trace('400', req.path); } - log.warn('Bad request:', data); - if (!data) { data = {}; } else if (typeof data == 'string') {
remove uneed log.warn from bad request response method
wejs_we-core
train
js
bd74424eceaa5f108ec8c89f70cc2fa98d0b0d67
diff --git a/spec/integration/global_networking/migrating_to_cloud_config_spec.rb b/spec/integration/global_networking/migrating_to_cloud_config_spec.rb index <HASH>..<HASH> 100644 --- a/spec/integration/global_networking/migrating_to_cloud_config_spec.rb +++ b/spec/integration/global_networking/migrating_to_cloud_config_spec.rb @@ -57,7 +57,7 @@ describe 'migrating to cloud config', type: :integration do upload_cloud_config(cloud_config_hash: cloud_config_hash) deploy_simple_manifest(manifest_hash: second_deployment_manifest) - vms = director.vms + vms = director.vms('second_deployment') expect(vms.size).to eq(1) expect(vms.first.ips).to eq('192.168.1.16') end
Fix migration test to get vms for one deployment only
cloudfoundry_bosh
train
rb
bcbbc5122f028dc3e483f41006e00f00d8fc27db
diff --git a/src/CacheScraper.php b/src/CacheScraper.php index <HASH>..<HASH> 100644 --- a/src/CacheScraper.php +++ b/src/CacheScraper.php @@ -42,11 +42,16 @@ class CacheScraper extends SuperScraper return $this->cache_dir; } + public function cacheFilename($url, $post, $JSON) + { + return md5($url . print_r($post, true)) . ($JSON ? '.json ' : '.html'); + } + public function cache_get($url, $post = NULL, $JSON = false, $disable_cache = false) { if(!$this->use_cache || $disable_cache) return $this->getCurl($url, $post, $JSON); - $cachefile = $this->getCacheDir() . $this->cache_prefix . "-" . md5($url . print_r($post, true)) . '.html'; + $cachefile = $this->getCacheDir() . $this->cache_prefix . "-" . $this->cacheFilename($url, $post, $JSON); if(!file_exists($cachefile)) { $content = $this->getCurl($url, $post, $JSON);
Created method for providing cache filename based on request parameters.
projectivemotion_php-scraper-tools
train
php
6bda4f00b6787e645bcb54e5246e3273655879b2
diff --git a/lib/wavefront-sdk/mixins.rb b/lib/wavefront-sdk/mixins.rb index <HASH>..<HASH> 100644 --- a/lib/wavefront-sdk/mixins.rb +++ b/lib/wavefront-sdk/mixins.rb @@ -30,3 +30,31 @@ module Wavefront end end end + +# Extensions to the Hash class +# +class Hash + + # Convert a tag hash into a string. The quoting is recommended in + # the WF wire-format guide. No validation is performed here. + # + def to_wf_tag + self.map { |k, v| "#{k}=\"#{v}\"" }.join(' ') + end +end + +# Extensions to stdlib Array +# +class Array + + # Join strings together to make a URI path in a way that is more + # flexible than URI::Join. Removes multiple and trailing + # separators. Does not have to produce fully qualified paths. Has + # no concept of protocols, hostnames, or query strings. + # + # @return [String] a URI path + # + def uri_concat + self.join('/').squeeze('/').sub(/\/$/, '').sub(/\/\?/, '?') + end +end
move stdlib extensions to mixins
snltd_wavefront-sdk
train
rb
66d34258414b7ab6d178e6c1a41b86e4bc79d46b
diff --git a/lib/Parser/XML.php b/lib/Parser/XML.php index <HASH>..<HASH> 100644 --- a/lib/Parser/XML.php +++ b/lib/Parser/XML.php @@ -88,27 +88,59 @@ class XML extends Parser { ); $parentComponent->add($property); - /* + // special cases switch($propertyName) { - // special cases + /* case 'categories': case 'resources': case 'freebusy': case 'exdate': case 'rdate': break; + */ case 'geo': - break; + $latitude = null; + $longitude = null; + + foreach($xmlPropertyChildren as $xmlGeoChild) { + + $xmlGeoValue = $xmlGeoChild['value']; + + switch(static::getTagName($xmlGeoChild['name'])) { + + case 'latitude': + $latitude = $xmlGeoValue; + break; + + case 'longitude': + $longitude = $xmlGeoValue; + break; + + default: + // TODO: EXCEPTION + break; + } + } + + var_dump($latitude, $longitude); + + $property->setRawMimeDirValue( + $latitude . + ';' . + $longitude + ); + break 2; + /* case 'request-status': break; + */ default: break; } - */ foreach($xmlPropertyChildren as $xmlPropertyChild) {
!xml Implement the `geo` property.
sabre-io_vobject
train
php
5bff93960815a92050e2cc4ce13873068bd69e03
diff --git a/scot/datatools.py b/scot/datatools.py index <HASH>..<HASH> 100644 --- a/scot/datatools.py +++ b/scot/datatools.py @@ -29,9 +29,8 @@ def cut_segments(rawdata, tr, start, stop): Returns ------- - x : array - Segments cut from `rawdata`. Individual segments are stacked along the - third dimension. + x : array, shape (t, m, e) + e segments of length t cut from `rawdata`. See also --------
Added shape of output array in docstring
scot-dev_scot
train
py
2474ad2deb6eb9724100283d3bc7ef3f78c31821
diff --git a/modules/culture.js b/modules/culture.js index <HASH>..<HASH> 100644 --- a/modules/culture.js +++ b/modules/culture.js @@ -171,7 +171,7 @@ define([ 'DAY': standardCalendar.days.names, "ERANAMES": eras, "ERAS": eras, - "FIRSTDAYOFWEEK": standardCalendar.firstDay, + "FIRSTDAYOFWEEK": standardCalendar.firstDay + 6 % 7, 'MONTH': standardCalendar.months.names, 'SHORTDAY': standardCalendar.days.namesAbbr, 'SHORTMONTH': standardCalendar.months.namesAbbr,
Transform firstDayWeek from javascript format to ISO-<I>
w20-framework_w20
train
js