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
e7030b13acae4170a0f26f67d834e9a342357679
diff --git a/angr/surveyors/explorer.py b/angr/surveyors/explorer.py index <HASH>..<HASH> 100644 --- a/angr/surveyors/explorer.py +++ b/angr/surveyors/explorer.py @@ -183,6 +183,10 @@ class Explorer(Surveyor): self.avoided.append(p) return False elif self._match(self._find, p, imark_set): + if not p.state.satisfiable(): + l.debug("Discarding 'found' path %s because it is unsat", p) + return False + l.debug("Marking path %s as found.", p) self.found.append(p) return False
make sure found paths are satisfiable
angr_angr
train
py
d8e905c3906edb2a2bdac490f63d0ef383d72d2c
diff --git a/src/decorators/on.js b/src/decorators/on.js index <HASH>..<HASH> 100644 --- a/src/decorators/on.js +++ b/src/decorators/on.js @@ -44,7 +44,7 @@ on.helper.registerEvent = (target, eventDomain, method, callback = function(){}) let [ event, delegateSelector ] = on.helper.prepareEventDomain(eventDomain); // define events - target.$appDecorators.on.events[method] = [ event, delegateSelector, callback ]; + target.$appDecorators.on.events[eventDomain] = callback; return target;
src/decorators/on.js: refactored the part of how to structure target.$appDecorators.on.events
SerkanSipahi_app-decorators
train
js
9b447c1b9625ffb3bfe30e01ea0e98a697079ef3
diff --git a/gem_dependency_checker.rb b/gem_dependency_checker.rb index <HASH>..<HASH> 100755 --- a/gem_dependency_checker.rb +++ b/gem_dependency_checker.rb @@ -17,6 +17,7 @@ require 'git' require 'xmlrpc/client' XMLRPC::Config::ENABLE_NIL_PARSER = true +XMLRPC::Config::ENABLE_NIL_CREATE = true ########################################################## @@ -157,9 +158,8 @@ def check_koji(name, version) if $conf[:check_koji] $u ||= $conf[:check_koji].split('/') $x ||= XMLRPC::Client.new($u[0..-2].join('/'), '/' + $u.last) - $last_event ||= $x.call('getLastEvent')['id'] - # FIXME pkg may need ruby193 or other prefix - nbuilds = $x.call('getLatestBuilds', $conf[:koji_tag], $last_event, "#{$conf[:rpm_prefix]}#{name}") + #$last_event ||= $x.call('getLastEvent')['id'] + nbuilds = $x.call('listTagged', $conf[:koji_tag], nil, false, nil, false, "#{$conf[:rpm_prefix]}#{name}") pbuilds = if version dep = Gem::Dependency.new(name, version)
use listTagged in koji lookup to retrieve all builds as opposed to the lasted one as returned with getLatestBuilds
ManageIQ_polisher
train
rb
ef1f9aaa79a339be5f00a17a052e2fa899f7b016
diff --git a/bolt/utils.py b/bolt/utils.py index <HASH>..<HASH> 100644 --- a/bolt/utils.py +++ b/bolt/utils.py @@ -14,6 +14,8 @@ def tupleize(arg): return tuple((arg,)) elif isinstance(arg, (list, ndarray)): return tuple(arg) + elif hasattr(arg, '__iter__'): + return tuple(list(arg)) else: return arg
fixed tupleize to work with iterators
bolt-project_bolt
train
py
1c58143a18e4b6fcf62cba6bbcc1461b10dc9161
diff --git a/lib/has_scope.rb b/lib/has_scope.rb index <HASH>..<HASH> 100644 --- a/lib/has_scope.rb +++ b/lib/has_scope.rb @@ -12,6 +12,7 @@ module HasScope base.class_eval do extend ClassMethods class_attribute :scopes_configuration, :instance_writer => false + self.scopes_configuration = {} end end @@ -83,11 +84,11 @@ module HasScope options[:only] = Array(options[:only]) options[:except] = Array(options[:except]) - self.scopes_configuration = (self.scopes_configuration || {}).dup + self.scopes_configuration = scopes_configuration.dup scopes.each do |scope| - self.scopes_configuration[scope] ||= { :as => scope, :type => :default, :block => block } - self.scopes_configuration[scope] = self.scopes_configuration[scope].merge(options) + scopes_configuration[scope] ||= { :as => scope, :type => :default, :block => block } + scopes_configuration[scope] = self.scopes_configuration[scope].merge(options) end end end @@ -106,9 +107,7 @@ module HasScope # end # def apply_scopes(target, hash=params) - return target unless scopes_configuration - - self.scopes_configuration.each do |scope, options| + scopes_configuration.each do |scope, options| next unless apply_scope_to_action?(options) key = options[:as]
Initialize scopes configuration to avoid guard method Remove unnecessary self calls.
plataformatec_has_scope
train
rb
145f57d9b4dbb901301279916b11c60c1dcffea8
diff --git a/lib/websession_templates.py b/lib/websession_templates.py index <HASH>..<HASH> 100644 --- a/lib/websession_templates.py +++ b/lib/websession_templates.py @@ -1231,7 +1231,7 @@ class Template: out = '''<div class="hassubmenu%(on)s"> <a hreflang="en" class="header%(selected)s" href="%(CFG_SITE_SECURE_URL)s/youraccount/display?ln=%(ln)s">%(personalize)s</a> - <ul class="subsubmenu" style="width: 13em;">''' % { + <ul class="subsubmenu">''' % { 'CFG_SITE_SECURE_URL' : CFG_SITE_SECURE_URL, 'ln' : ln, 'personalize': _("Personalize"), @@ -1340,7 +1340,7 @@ class Template: if activities: out += '''<div class="hassubmenu%(on)s"> <a hreflang="en" class="header%(selected)s" href="%(CFG_SITE_SECURE_URL)s/youraccount/youradminactivities?ln=%(ln)s">%(admin)s</a> - <ul class="subsubmenu" style="width: 19em;">''' % { + <ul class="subsubmenu">''' % { 'CFG_SITE_SECURE_URL' : CFG_SITE_SECURE_URL, 'ln' : ln, 'admin': _("Administration"),
WebStyle: fluid width of the menu * Deletes the fixed width of the menus of the websession_templates.py and bibcirculation_templates.py files. (closes #<I>) * Adds new file invenio-ie7.css with some specific styles for IE7. * Adds aconditional comment in the webstyle_templates.py file, to force IE7 to load the specific styles.
inveniosoftware_invenio-accounts
train
py
d9031e3c0b089d29042f654eda5a59edf50bf253
diff --git a/modeldict/base.py b/modeldict/base.py index <HASH>..<HASH> 100644 --- a/modeldict/base.py +++ b/modeldict/base.py @@ -14,7 +14,7 @@ class PersistedDict(object): self.__dict = dict() self.last_synced = 0 self.autosync = autosync - # self.__sync_with_persistent_storage(force=True) + self.__sync_with_persistent_storage(force=True) @property def cache_expired(self): diff --git a/tests/test_dict.py b/tests/test_dict.py index <HASH>..<HASH> 100644 --- a/tests/test_dict.py +++ b/tests/test_dict.py @@ -86,6 +86,11 @@ class BaseTest(object): del self.dict['foo'] dp.assert_called_with('foo') + def test_uses_existing_persistents_on_initialize(self): + with mock.patch(self.mockmeth('persistents')) as p: + p.return_value = dict(a=1, b=2, c=3) + self.assertEquals(self.new_dict(), dict(a=1, b=2, c=3)) + def test_last_updated_setup_on_intialize(self): self.assertTrue(self.dict.last_updated())
Add back in syncing for modeldict.
disqus_durabledict
train
py,py
ac3378022cd80daaa48ad1fbeded6a892c8f9082
diff --git a/server.go b/server.go index <HASH>..<HASH> 100644 --- a/server.go +++ b/server.go @@ -102,3 +102,7 @@ func (s *Server) HandleFile(handler HandlerFunction, description ...string) { func (s *Server) HandleDefault(handler HandlerFunction, description ...string) { s.mux.HandleDefault(handler, description...) } + +func (s *Server) SetAlias(route string, aliases ...string) { + s.mux.SetAlias(route, aliases...) +}
Delegate SetAlias from Server to Mux.
yanzay_tbot
train
go
1cfd16b095b8793fdda2a21c8dd0c5348ec386b9
diff --git a/lib/solr_wrapper/configuration.rb b/lib/solr_wrapper/configuration.rb index <HASH>..<HASH> 100644 --- a/lib/solr_wrapper/configuration.rb +++ b/lib/solr_wrapper/configuration.rb @@ -55,7 +55,7 @@ module SolrWrapper end def default_download_dir - if defined? Rails + if defined?(Rails) && Rails.root File.join(Rails.root, 'tmp') else Dir.tmpdir
Guard against having Rails but not running in a Rails application
cbeer_solr_wrapper
train
rb
87de6f020c109f2c0a1a8f437524a3af5db73f22
diff --git a/pkg/cmd/cli/kubectl_compat_test.go b/pkg/cmd/cli/kubectl_compat_test.go index <HASH>..<HASH> 100644 --- a/pkg/cmd/cli/kubectl_compat_test.go +++ b/pkg/cmd/cli/kubectl_compat_test.go @@ -27,6 +27,7 @@ var MissingCommands = sets.NewString( "uncordon", "taint", "top", + "certificate", ) // WhitelistedCommands is the list of commands we're never going to have in oc
Added certificate to ignored kube commands in tests
openshift_origin
train
go
790d6d65879f64f2f5ca760db4242cd3a61693a5
diff --git a/sos/report/plugins/virsh.py b/sos/report/plugins/virsh.py index <HASH>..<HASH> 100644 --- a/sos/report/plugins/virsh.py +++ b/sos/report/plugins/virsh.py @@ -48,7 +48,11 @@ class LibvirtClient(Plugin, IndependentPlugin): if k_list['status'] == 0: k_lines = k_list['output'].splitlines() # the 'Name' column position changes between virsh cmds - pos = k_lines[0].split().index('Name') + # catch the rare exceptions when 'Name' is not found + try: + pos = k_lines[0].split().index('Name') + except Exception: + continue for j in filter(lambda x: x, k_lines[2:]): n = j.split()[pos] self.add_cmd_output('%s %s-dumpxml %s' % (cmd, k, n),
[virsh] Catch parsing exception In case virsh output is malformed or missing 'Name' otherwise, catch parsing exception and continue in next for loop iteration. Resolves: #<I>
sosreport_sos
train
py
1af7158c272b3a724db3884114a975aae2b2dfaf
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100755 --- a/setup.py +++ b/setup.py @@ -38,6 +38,12 @@ setup( 'Intended Audience :: Developers', 'License :: OSI Approved :: Apache Software License', 'Programming Language :: Python', + 'Programming Language :: Python :: 2', + 'Programming Language :: Python :: 2.6', + 'Programming Language :: Python :: 2.7', + 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3.2', + 'Programming Language :: Python :: 3.3', 'Topic :: Software Development :: Libraries :: Python Modules', ], )
Add more classifiers to setup.py. Show we support Python3.
ocadotechnology_django-closuretree
train
py
2c1b5e8530034cace550cda78778d129552b97d4
diff --git a/src/Engine/Solr/SolrMapper.php b/src/Engine/Solr/SolrMapper.php index <HASH>..<HASH> 100644 --- a/src/Engine/Solr/SolrMapper.php +++ b/src/Engine/Solr/SolrMapper.php @@ -37,7 +37,15 @@ class SolrMapper implements MapperInterface /** * @param IdentityInterface $identity */ - public function find(IdentityInterface $identity){} + public function find(IdentityInterface $identity) + { + try { + $rawData = $this->adapter->select($this->collectionName, $this->makeSelectionFactory($identity)); + } catch (\Exception $exception) { + $this->handleException($exception); + } + return $rawData; + } /** * @param MappingInterface $mapping
<I> - Added find method.
g4code_data-mapper
train
php
394fa5c55eb85d4a77413170b0b99bc29227d563
diff --git a/joinGame.py b/joinGame.py index <HASH>..<HASH> 100644 --- a/joinGame.py +++ b/joinGame.py @@ -30,7 +30,7 @@ def playerJoin(hostCfg, config, agentCallBack=go.doNothing, debug=False): joinReq.server_ports.game_port = gameP joinReq.server_ports.base_port = baseP joinReq.shared_port = sharedP - for myGP, myBP in hostCfg.slaveConnections: + for myGP, myBP in hostCfg.slavePorts: joinReq.client_ports.add(game_port=myGP, base_port=myBP) if config.numAgents: playerType = c.PARTICIPANT
- joinGame.py needs to be updated to match the latest refactored code
ttinies_sc2gameLobby
train
py
1ad612298e3729dce965cf84049002e0fd86fe8f
diff --git a/tests/Integration/TypesTest.php b/tests/Integration/TypesTest.php index <HASH>..<HASH> 100644 --- a/tests/Integration/TypesTest.php +++ b/tests/Integration/TypesTest.php @@ -30,7 +30,8 @@ class TypesTest extends BaseTest $event = $this->createAndInsertValue($create_query, $insert_query); - self::assertEquals('9000000123.1234560000', $event->getValues()[0]['test']); + self::assertSame($expect = '9000000123.1234560000', $value = $event->getValues()[0]['test']); + self::assertSame(strlen($expect), strlen($value)); } /**
Fixed decimal is not correct (#<I>) * Added test case for decimal * Fixed decimal
krowinski_php-mysql-replication
train
php
91a5027db783f445889bdb65ab2ca32e82329cd8
diff --git a/tests/index.test.js b/tests/index.test.js index <HASH>..<HASH> 100644 --- a/tests/index.test.js +++ b/tests/index.test.js @@ -325,3 +325,16 @@ it('can deal with non-numerical version numbers returned by browserslist for saf })) .toBeTruthy() }) + +it('gracefully fails on invalid inputs', () => { + expect( + matchesUA(undefined)) + .toBeFalsy() + + expect( + matchesUA(null)) + .toBeFalsy() +}) + + +
chore(tests): add failing test case
browserslist_browserslist-useragent
train
js
5d78c19ece8b5c1c2d18b55603bbdd7833aa4166
diff --git a/lib/cable_ready/identifiable.rb b/lib/cable_ready/identifiable.rb index <HASH>..<HASH> 100644 --- a/lib/cable_ready/identifiable.rb +++ b/lib/cable_ready/identifiable.rb @@ -17,7 +17,7 @@ module CableReady [prefix, record.to_s.strip].compact.join("_") end - "##{id}".squeeze("#").strip + "##{id}".squeeze("#").strip.downcase end def identifiable?(obj)
dom_id should always be lowercase (#<I>)
hopsoft_cable_ready
train
rb
0463519cd32b4ff8d723d21a13ffc96f66e20330
diff --git a/DoctrineCommand.php b/DoctrineCommand.php index <HASH>..<HASH> 100644 --- a/DoctrineCommand.php +++ b/DoctrineCommand.php @@ -30,10 +30,6 @@ abstract class DoctrineCommand extends Command protected function getEntityGenerator() { $entityGenerator = new EntityGenerator(); - - if (version_compare(DoctrineVersion::VERSION, "2.0.2-DEV") >= 0) { - $entityGenerator->setAnnotationPrefix("orm:"); - } $entityGenerator->setGenerateAnnotations(false); $entityGenerator->setGenerateStubMethods(true); $entityGenerator->setRegenerateEntityIfExists(false);
[DoctrineBundle] removed the annotation prefix in doctrine:mapping:import (this will work as soon as the EntityGenerator has been updated in Doctrine)
saxulum_saxulum-doctrine-orm-commands
train
php
6bed7e142f43f100fcaad8d377c42d6e11225574
diff --git a/src/main/java/skadistats/clarity/decoder/prop/Int64Decoder.java b/src/main/java/skadistats/clarity/decoder/prop/Int64Decoder.java index <HASH>..<HASH> 100644 --- a/src/main/java/skadistats/clarity/decoder/prop/Int64Decoder.java +++ b/src/main/java/skadistats/clarity/decoder/prop/Int64Decoder.java @@ -30,7 +30,7 @@ public class Int64Decoder implements PropDecoder<Long> { } long l = stream.readNumericBits(32); long r = stream.readNumericBits(remainder); - long v = (l << 32) | r; + long v = (r << 32) | l; return negate ? -v : v; }
Fixed shifting problems with steam ids. The shifting was done the wrong way around which lead to problems when accessing the steam id and possibly other long values.
skadistats_clarity
train
java
bfc802b8ae8212831c314259725753b84fac2d2c
diff --git a/pdftotree/utils/pdf/pdf_parsers.py b/pdftotree/utils/pdf/pdf_parsers.py index <HASH>..<HASH> 100644 --- a/pdftotree/utils/pdf/pdf_parsers.py +++ b/pdftotree/utils/pdf/pdf_parsers.py @@ -995,10 +995,10 @@ def extract_text_candidates(boxes, page_bbox, avg_font_pts, width, char_width, node.y1 - node.y0 < 2 * avg_font_pts): #can be header idx_new = idx + 1 if idx_new < len(new_nodes) - 1: - while (idx_new < len(new_nodes) - 1 and - (round(node.y0) == round(new_nodes[idx_new].y0)) - or (math.floor(node.y0) == math.floor( - new_nodes[idx_new].y0))): + while (idx_new < len(new_nodes) - 1 and ( + (round(node.y0) == round(new_nodes[idx_new].y0)) or + (math.floor(node.y0) == math.floor( + new_nodes[idx_new].y0)))): idx_new += 1 if (idx_new < len(new_nodes) - 1): if (new_nodes[idx_new].y0 - node.y0 >
Fixes missing parenthesis We had an order of operations error. Closes #<I>.
HazyResearch_pdftotree
train
py
a4963d075655e57b65674ed754760a6ce0744bf8
diff --git a/src/AbstractDriver.php b/src/AbstractDriver.php index <HASH>..<HASH> 100644 --- a/src/AbstractDriver.php +++ b/src/AbstractDriver.php @@ -6,6 +6,7 @@ use Cake\Core\InstanceConfigTrait; use Cake\Utility\Inflector; use Muffin\Webservice\Exception\MissingWebserviceClassException; use Muffin\Webservice\Exception\UnimplementedWebserviceMethodException; +use Muffin\Webservice\Webservice\Webservice; use Muffin\Webservice\Webservice\WebserviceInterface; use Psr\Log\LoggerAwareInterface; use Psr\Log\LoggerAwareTrait; @@ -88,13 +89,9 @@ abstract class AbstractDriver implements LoggerAwareInterface } if (!isset($this->_webservices[$name])) { - // Split the driver class namespace in chunks - $namespaceParts = explode('\\', get_class($this)); + list($pluginName) = pluginSplit(Webservice::shortName(get_class($this), 'Webservice/Driver')); - // Get the plugin name out of the namespace - $pluginName = implode('/', array_reverse(array_slice(array_reverse($namespaceParts), -2))); - - $webserviceClass = $pluginName . '.' . Inflector::camelize($name); + $webserviceClass = implode('.', array_filter([$pluginName, Inflector::camelize($name)])); $webservice = $this->_createWebservice($webserviceClass, [ 'endpoint' => $name,
Use the shortName method to get the plugin name
UseMuffin_Webservice
train
php
5231fcadb730b4d4afe6d7cbd8920f518426810e
diff --git a/test/typescript/definitions-spec.js b/test/typescript/definitions-spec.js index <HASH>..<HASH> 100644 --- a/test/typescript/definitions-spec.js +++ b/test/typescript/definitions-spec.js @@ -1,5 +1,7 @@ import * as ts from 'typescript' import * as tt from 'typescript-definition-tester' +import path from 'path' +import fs from 'fs' describe('TypeScript definitions', function () { @@ -11,13 +13,9 @@ describe('TypeScript definitions', function () { jsx: ts.JsxEmit.React } - it('should compile against index.d.ts', (done) => { - - tt.compileDirectory( - __dirname + '/definitions', - fileName => fileName.match(/\.tsx?$/), - options, - () => done() - ) - }) + fs.readdirSync(path.join(__dirname, 'definitions')).forEach((filename) => { + it(`should compile ${path.basename(filename, path.extname(filename))} against index.d.ts`, (done) => { + tt.compile(path.join(__dirname, 'definitions', filename), options, done) + }).timeout(5000) + }); }) \ No newline at end of file
Seperated typescript tests into seperate tests and increased timeout
ioof-holdings_redux-subspace
train
js
5e2df1fc8e85355ac92e17844a7f00a44ab478c3
diff --git a/activerecord/test/cases/calculations_test.rb b/activerecord/test/cases/calculations_test.rb index <HASH>..<HASH> 100644 --- a/activerecord/test/cases/calculations_test.rb +++ b/activerecord/test/cases/calculations_test.rb @@ -1004,6 +1004,14 @@ class CalculationsTest < ActiveRecord::TestCase end end + def test_pluck_loaded_relation_aliased_attribute + companies = Company.order(:id).limit(3).load + + assert_queries(0) do + assert_equal ["37signals", "Summit", "Microsoft"], companies.pluck(:new_name) + end + end + def test_pick_one assert_equal "The First Topic", Topic.order(:id).pick(:heading) assert_no_queries do @@ -1049,6 +1057,14 @@ class CalculationsTest < ActiveRecord::TestCase end end + def test_pick_loaded_relation_aliased_attribute + companies = Company.order(:id).limit(3).load + + assert_no_queries do + assert_equal "37signals", companies.pick(:new_name) + end + end + def test_grouped_calculation_with_polymorphic_relation part = ShipPart.create!(name: "has trinket") part.trinkets.create!
Add tests for loaded pluck and pick with alias
rails_rails
train
rb
15b751d6e228aec8cbccad454bca6359df49bf07
diff --git a/salt/states/dockerio.py b/salt/states/dockerio.py index <HASH>..<HASH> 100644 --- a/salt/states/dockerio.py +++ b/salt/states/dockerio.py @@ -82,7 +82,7 @@ Available Functions .. note:: - The ``port_bindings`` argument above is a dictionary. The double + The ``ports`` argument above is a dictionary. The double indentation is required for PyYAML to load the data structure properly as a python dictionary. More information can be found :ref:`here <nested-dict-indentation>`
doc: Docker state use ports and not port_bindings anymore
saltstack_salt
train
py
0f63b1312ecff987d41757990e0c4ec942fd862a
diff --git a/lib/apipony/endpoint.rb b/lib/apipony/endpoint.rb index <HASH>..<HASH> 100644 --- a/lib/apipony/endpoint.rb +++ b/lib/apipony/endpoint.rb @@ -18,22 +18,30 @@ module Apipony @method = method.to_sym @path = path @url = build_url(@path) + @request = NilRequest.new + @response = NilResponse.new instance_eval(&block) if block_given? end - ## # DSL method to start describing a response def response_with(&block) @response = Apipony::Response.new(&block) end - ## + def response? + @response.instance_of?(Apipony::Response) + end + # DSL method to start describind a request def request_with(&block) @request = Apipony::Request.new(&block) end + def request? + @request.instance_of?(Apipony::Request) + end + ## # Create a unique identifier for this endpoint def id
Add default nil classes for request and response to endpoint
droptheplot_apipony
train
rb
902e78b20fe3189c4d424a65e4338710c9acd9dd
diff --git a/examples/jsf/numberguess/src/main/java/org/jboss/weld/examples/numberguess/Game.java b/examples/jsf/numberguess/src/main/java/org/jboss/weld/examples/numberguess/Game.java index <HASH>..<HASH> 100644 --- a/examples/jsf/numberguess/src/main/java/org/jboss/weld/examples/numberguess/Game.java +++ b/examples/jsf/numberguess/src/main/java/org/jboss/weld/examples/numberguess/Game.java @@ -66,9 +66,9 @@ public class Game implements Serializable { } public void check() { - if (isGuessHigher()) { + if (guess > number) { biggest = guess - 1; - } else if (isGuessLower()) { + } else if (guess < number) { smallest = guess + 1; } else if (isGuessCorrect()) { FacesContext.getCurrentInstance().addMessage(null, new FacesMessage("Correct!"));
Fix numberguess example - adjust interval also when guessing 0
weld_core
train
java
90a7d16c26469e8496765aafc833bef152ff6a95
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -111,12 +111,9 @@ Drop by our `Gitter chat room <https://gitter.im/PraatParselmouth/Lobby>`__ if you have any question, remarks, or requests! -*More information on the -`**installation** <https://github.com/YannickJadoul/Parselmouth#installation>`__ -and some basic -`**examples** <https://github.com/YannickJadoul/Parselmouth#example-usage>`__ -can be found on **Parselmouth's GitHub repository**: -https://github.com/YannickJadoul/Parselmouth*""" +More information on the **installation** and some basic **examples** +can be found on Parselmouth's GitHub repository: +https://github.com/YannickJadoul/Parselmouth""" setup( name='praat-parselmouth',
Fixing reStructuredText's unsupported features in setup.py's 'long_description'
YannickJadoul_Parselmouth
train
py
c9cf557e854cb4f772743943c2f849ccc60db28a
diff --git a/examples/interfacechangeEvents/IfchangeServer.py b/examples/interfacechangeEvents/IfchangeServer.py index <HASH>..<HASH> 100644 --- a/examples/interfacechangeEvents/IfchangeServer.py +++ b/examples/interfacechangeEvents/IfchangeServer.py @@ -1,9 +1,8 @@ import logging import tango -from tango.server import Device -from tango.server import DispLevel +from tango.server import Device from tango.server import attribute, command @@ -53,7 +52,8 @@ class IfchangeServer(Device): cmd = command(f=self.start, dtype_in=str, dtype_out=int, doc_in='description of input', doc_out='description of output', - display_level=DispLevel.EXPERT, polling_period=5.1) + display_level=tango.DispLevel.EXPERT, + polling_period=5100) self.add_command(cmd, device_level) @command(dtype_in=str, doc_in='name of dynamic command to delete')
Fix interfacechangeEvents example Server code had a few issues.
tango-controls_pytango
train
py
ad32de0eee981a83924e516bd6feda4a99ec6b6c
diff --git a/signature/signature.go b/signature/signature.go index <HASH>..<HASH> 100644 --- a/signature/signature.go +++ b/signature/signature.go @@ -159,7 +159,7 @@ func (s privateSignature) sign(mech SigningMechanism, keyIdentity string) ([]byt // signatureAcceptanceRules specifies how to decide whether an untrusted signature is acceptable. // We centralize the actual parsing and data extraction in verifyAndExtractSignature; this supplies // the policy. We use an object instead of supplying func parameters to verifyAndExtractSignature -// because all of the functions have the same type, so there is a risk of exchanging the functions; +// because the functions have the same or similar types, so there is a risk of exchanging the functions; // named members of this struct are more explicit. type signatureAcceptanceRules struct { validateKeyIdentity func(string) error
Fix a comment The comment became imprecise when one of the functions started accepting a digest.Digest instead of a string. (This is unrelated to the rest of the PR.)
containers_image
train
go
545de1fd2a143335a2706c9640ca70e84f580811
diff --git a/test/functional/replicaset_mock_tests.js b/test/functional/replicaset_mock_tests.js index <HASH>..<HASH> 100644 --- a/test/functional/replicaset_mock_tests.js +++ b/test/functional/replicaset_mock_tests.js @@ -119,7 +119,8 @@ exports['Should correctly print warning and error when no mongos proxies in seed requires: { generators: true, topology: "single" - } + }, + ignore: { travis:true } }, test: function(configuration, test) {
Added ignore:travis to another test
mongodb_node-mongodb-native
train
js
83391b41d23c3e4fb0941a7e15bd4c45e035cd41
diff --git a/pkg/k8s/watchers/namespace.go b/pkg/k8s/watchers/namespace.go index <HASH>..<HASH> 100644 --- a/pkg/k8s/watchers/namespace.go +++ b/pkg/k8s/watchers/namespace.go @@ -92,6 +92,12 @@ func (k *K8sWatcher) updateK8sV1Namespace(oldNS, newNS *slim_corev1.Namespace) e oldIdtyLabels, _ := labelsfilter.Filter(oldLabels) newIdtyLabels, _ := labelsfilter.Filter(newLabels) + // Do not perform any other operations the the old labels are the same as + // the new labels + if oldIdtyLabels.DeepEqual(&newIdtyLabels) { + return nil + } + eps := k.endpointManager.GetEndpoints() failed := false for _, ep := range eps {
pkg/k8s: ignore namespace events that do not change labels As we can receive different type of namespace events, like difference in the annotations. We can ignore all of these events unless the labels are different.
cilium_cilium
train
go
1197e82d7bee7d96f84dc5a1df88ee6d22f60d3d
diff --git a/deezer/client.py b/deezer/client.py index <HASH>..<HASH> 100644 --- a/deezer/client.py +++ b/deezer/client.py @@ -4,11 +4,10 @@ Implements a client class to query the """ import json -try: +try: # pragma: no cover - python 2 from urllib import urlencode from urllib2 import urlopen -except ImportError: - #python 3 +except ImportError: # pragma: no cover - python 3 from urllib.parse import urlencode from urllib.request import urlopen from deezer.resources import Album, Artist, Comment, Genre @@ -90,10 +89,9 @@ class Client(object): :returns: str instance """ - try: + try: # pragma: no cover - python 3 value = str(value) - except UnicodeEncodeError: - #python2 + except UnicodeEncodeError: # pragma: no cover - python 2 value = value.encode('utf-8') return value
pragma to ignore python 2 or 3 specific lines
browniebroke_deezer-python
train
py
bb7c2c4a6e030d6a9998173de71725b1522ba50b
diff --git a/lib/packetgen/header/dns/question.rb b/lib/packetgen/header/dns/question.rb index <HASH>..<HASH> 100644 --- a/lib/packetgen/header/dns/question.rb +++ b/lib/packetgen/header/dns/question.rb @@ -100,13 +100,6 @@ module PacketGen self.class::TYPES[type] == self.type end - # @deprecated Use {#type?} instead - # @return [Boolean] - def has_type?(type) - Deprecation.deprecated(self.class, __method__, 'type?') - type?(type) - end - # Get human readable type # @return [String] def human_type
Remove deprecated stuff from Header::DNS.
sdaubert_packetgen
train
rb
916d13c0da681bc856141621b7f225bd437e20ea
diff --git a/src/Decorator/FormCollectionDecorator.php b/src/Decorator/FormCollectionDecorator.php index <HASH>..<HASH> 100644 --- a/src/Decorator/FormCollectionDecorator.php +++ b/src/Decorator/FormCollectionDecorator.php @@ -146,7 +146,7 @@ class FormCollectionDecorator implements FormHandlerInterface, FormCollectionHan $em = $this->registry->getManager(); foreach ($this->formData as $data) { - if ($data['class'] !== get_class($entity) && $data['id'] !== $entity->getId()) { + if ($data['class'] !== get_class($entity) || $data['id'] !== $entity->getId()) { continue; }
Change collection check to keep checks separate when resolving entity collections
SolidWorx_FormHandlerBundle
train
php
93b865efd19705d850b6e59900bb541449816f37
diff --git a/framework/core/js/forum/src/components/post-stream.js b/framework/core/js/forum/src/components/post-stream.js index <HASH>..<HASH> 100644 --- a/framework/core/js/forum/src/components/post-stream.js +++ b/framework/core/js/forum/src/components/post-stream.js @@ -248,7 +248,7 @@ class PostStream extends mixin(Component, evented) { } clearTimeout(this.calculatePositionTimeout); - this.calculatePositionTimeout = setTimeout(this.calculatePosition.bind(this), 500); + this.calculatePositionTimeout = setTimeout(this.calculatePosition.bind(this), 100); } /**
Speed up committing of scroll position in URL/marking as read
flarum_core
train
js
73ba558a3897dfd4bf6e1351489dbccd926ddc81
diff --git a/spec/active_record/connection_adapters/oracle_enhanced_context_index_spec.rb b/spec/active_record/connection_adapters/oracle_enhanced_context_index_spec.rb index <HASH>..<HASH> 100644 --- a/spec/active_record/connection_adapters/oracle_enhanced_context_index_spec.rb +++ b/spec/active_record/connection_adapters/oracle_enhanced_context_index_spec.rb @@ -381,6 +381,9 @@ describe "OracleEnhancedAdapter context index" do describe "with table prefix and suffix" do before(:all) do + @conn = ActiveRecord::Base.connection + @oracle12c = !! @conn.select_value( + "select * from product_component_version where product like 'Oracle%' and to_number(substr(version,1,2)) = 12") ActiveRecord::Base.table_name_prefix = 'xxx_' ActiveRecord::Base.table_name_suffix = '_xxx' create_tables @@ -405,6 +408,7 @@ describe "OracleEnhancedAdapter context index" do end it "should dump definition of multiple table index with options" do + pending "It always fails when Oracle 12c 12.1.0 used." if @oracle12c options = { name: 'xxx_post_and_comments_i', index_column: :all_text, index_column_trigger_on: :updated_at,
Skip since this test always fails with Oracle <I>c
rsim_oracle-enhanced
train
rb
21bf629fde3dee2c3bce0cb98f989dc5ea7e4713
diff --git a/tests/ClientTest.php b/tests/ClientTest.php index <HASH>..<HASH> 100644 --- a/tests/ClientTest.php +++ b/tests/ClientTest.php @@ -2,8 +2,8 @@ namespace Denpa\Bitcoin\Tests; -use Denpa\Bitcoin\Config; use Denpa\Bitcoin\Client as BitcoinClient; +use Denpa\Bitcoin\Config; use Denpa\Bitcoin\Exceptions; use Denpa\Bitcoin\Responses\BitcoindResponse; use Denpa\Bitcoin\Responses\Response;
Apply fixes from StyleCI (#<I>)
denpamusic_php-bitcoinrpc
train
php
d0dfac866735dd77db58f46f2a16e47332753142
diff --git a/ngrest/base/Model.php b/ngrest/base/Model.php index <HASH>..<HASH> 100644 --- a/ngrest/base/Model.php +++ b/ngrest/base/Model.php @@ -48,9 +48,10 @@ abstract class Model extends \yii\db\ActiveRecord { parent::init(); - $this->_ngrestCall = Yii::$app->request->get('ngrestCall', false); - $this->_ngrestCallType = Yii::$app->request->get('ngrestCallType', false); - + if (Yii::$app instanceof \yii\web\Application) { + $this->_ngrestCall = Yii::$app->request->get('ngrestCall', false); + $this->_ngrestCallType = Yii::$app->request->get('ngrestCallType', false); + } if (count($this->getI18n()) > 0) { $this->on(self::EVENT_BEFORE_INSERT, [$this, 'i18nBeforeUpdateAndCreate']); $this->on(self::EVENT_BEFORE_UPDATE, [$this, 'i18nBeforeUpdateAndCreate']);
fixed cli/web bug for AR base model.
luyadev_luya-module-admin
train
php
6354df0a8a0790566cd289d8fd26d8145b6ad4e0
diff --git a/defender/tasks.py b/defender/tasks.py index <HASH>..<HASH> 100644 --- a/defender/tasks.py +++ b/defender/tasks.py @@ -1,12 +1,7 @@ from .data import store_login_attempt +from . import config -# not sure how to get this to look better. ideally we want to dynamically -# apply the celery decorator based on the USE_CELERY setting. -from celery import shared_task - - -@shared_task() def add_login_attempt_task( user_agent, ip_address, username, http_accept, path_info, login_valid ): @@ -14,3 +9,7 @@ def add_login_attempt_task( store_login_attempt( user_agent, ip_address, username, http_accept, path_info, login_valid ) + +if config.USE_CELERY: + from celery import shared_task + add_login_attempt_task = shared_task(add_login_attempt_task)
dynamic load celery (#<I>)
kencochrane_django-defender
train
py
385ac1bc2f9f20a1951ffdc7143e3c9939afbc36
diff --git a/peewee.py b/peewee.py index <HASH>..<HASH> 100644 --- a/peewee.py +++ b/peewee.py @@ -2493,14 +2493,18 @@ class Model(object): for query, fk_field, depth in select_queries: model = query.model if not self._meta.database.adapter.subquery_delete_same_table: - query = list(query) + query = [obj.get_pk() for obj in query] + if not query: + continue model.delete().where(**{ '%s__in' % model._meta.pk_name: query, }).execute() for query, fk_field, depth in nullable_queries: model = query.model if not self._meta.database.adapter.subquery_delete_same_table: - query = list(query) + query = [obj.get_pk() for obj in query] + if not query: + continue model.update(**{fk_field: None}).where(**{ '%s__in' % model._meta.pk_name: query, }).execute()
Small fix for recursive delete bits
coleifer_peewee
train
py
47240481b9c0e7341bd51a3021f092124837c8e1
diff --git a/src/SearchParameters/index.js b/src/SearchParameters/index.js index <HASH>..<HASH> 100644 --- a/src/SearchParameters/index.js +++ b/src/SearchParameters/index.js @@ -1036,7 +1036,7 @@ SearchParameters.prototype = { return this.numericRefinements[attribute] && !isUndefined(this.numericRefinements[attribute][operator]) && - this.numericRefinements[attribute][operator].indexOf(value) !== -1; + indexOf(this.numericRefinements[attribute][operator], value) !== -1; }, /** * Returns true if the tag refined, false otherwise
fix: IE8 has no Array.indexOf Yes. I. Know. :D
algolia_algoliasearch-helper-js
train
js
21326f67a0205bdae067526fd5ffeee9a2db598e
diff --git a/src/client/ClientDataResolver.js b/src/client/ClientDataResolver.js index <HASH>..<HASH> 100644 --- a/src/client/ClientDataResolver.js +++ b/src/client/ClientDataResolver.js @@ -171,7 +171,7 @@ class ClientDataResolver { * @returns {string} */ resolveInviteCode(data) { - const inviteRegex = /discord(?:app\.com\/invite|\.gg)\/([\w-]{2,255})/i; + const inviteRegex = /discord(?:app\.com\/invite|\.gg(?:\/invite)?)\/([\w-]{2,255})/i; const match = inviteRegex.exec(data); if (match && match[1]) return match[1]; return data;
feat(ClientDataResolver): account for discord.gg/invite/<code> invites
discordjs_discord.js
train
js
dd94f2a5012bdcc01f5f673194ec64d8562a1b9e
diff --git a/isvcs/docker_registry.go b/isvcs/docker_registry.go index <HASH>..<HASH> 100644 --- a/isvcs/docker_registry.go +++ b/isvcs/docker_registry.go @@ -50,7 +50,7 @@ func init() { Tag: IMAGE_TAG, Command: func() string { return command }, PortBindings: []portBinding{dockerPortBinding}, - Volumes: map[string]string{"registry": "/tmp/registry"}, + Volumes: map[string]string{"registry": "/tmp/registry-dev"}, HealthChecks: healthChecks, }, )
repointed the docker registry to the correct volume path
control-center_serviced
train
go
1c714bf93d0933357efe41fca67347e3603a8ab2
diff --git a/fireplace/cards/__init__.py b/fireplace/cards/__init__.py index <HASH>..<HASH> 100644 --- a/fireplace/cards/__init__.py +++ b/fireplace/cards/__init__.py @@ -59,8 +59,11 @@ def merge(xmlcard, carddef): # it exists. # This code is only ran once, at initial import. -with open(_PATH, "r") as f: - db = cardxml.load(_PATH) - for id, card in db.items(): - carddef = globals().get(id) - globals()[id] = merge(card, carddef) +if "cardlist" not in globals(): + with open(_PATH, "r") as f: + db = cardxml.load(_PATH) + cardlist = [] + for id, card in db.items(): + carddef = globals().get(id) + globals()[id] = merge(card, carddef) + cardlist.append(id)
Ensure the import initialization only happens once
jleclanche_fireplace
train
py
e0df8db9ccfedd8056804267f2eb7224f4944777
diff --git a/src/scout_apm/django/middleware.py b/src/scout_apm/django/middleware.py index <HASH>..<HASH> 100644 --- a/src/scout_apm/django/middleware.py +++ b/src/scout_apm/django/middleware.py @@ -75,7 +75,7 @@ class MiddlewareTimingMiddleware(object): try: return self.get_response(request) finally: - TrackedRequest.instance().stop_span() + tracked_request.stop_span() class ViewTimingMiddleware(object): @@ -107,10 +107,9 @@ class ViewTimingMiddleware(object): # process_view tracked_request.start_span(operation="Unknown") try: - response = self.get_response(request) + return self.get_response(request) finally: tracked_request.stop_span() - return response def process_view(self, request, view_func, view_args, view_kwargs): """
Tidy Django middleware span balancing (#<I>) Small tidy up in new middleware to avoid refteching the `TrackedRequest` instance.
scoutapp_scout_apm_python
train
py
1a9221350c8b30ded58d444e1a6aa07c0686e060
diff --git a/controller/src/main/java/org/jboss/as/controller/operations/global/GlobalOperationHandlers.java b/controller/src/main/java/org/jboss/as/controller/operations/global/GlobalOperationHandlers.java index <HASH>..<HASH> 100644 --- a/controller/src/main/java/org/jboss/as/controller/operations/global/GlobalOperationHandlers.java +++ b/controller/src/main/java/org/jboss/as/controller/operations/global/GlobalOperationHandlers.java @@ -1190,7 +1190,7 @@ public class GlobalOperationHandlers { if (!operation.hasDefined(LOCALE)) { return null; } - String unparsed = operation.get(LOCALE).asString(); + String unparsed = normalizeLocale(operation.get(LOCALE).asString()); int len = unparsed.length(); if (len != 2 && len != 5 && len < 7) { throw MESSAGES.invalidLocaleString(unparsed); @@ -1228,5 +1228,9 @@ public class GlobalOperationHandlers { return new Locale(unparsed.substring(0, 2), unparsed.substring(3, 5), unparsed.substring(6)); } + private static String normalizeLocale(String toNormalize) { + return "zh_Hans".equalsIgnoreCase(toNormalize) ? "zh_CN" : toNormalize; + } + }
AS7-<I> Deal with zh_Hans coming from the console
wildfly_wildfly
train
java
023a795db41a678354256f32dd31d4d174f8fab5
diff --git a/public/hft/0.x.x/scripts/hft-settings.js b/public/hft/0.x.x/scripts/hft-settings.js index <HASH>..<HASH> 100644 --- a/public/hft/0.x.x/scripts/hft-settings.js +++ b/public/hft/0.x.x/scripts/hft-settings.js @@ -29,9 +29,13 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ "use strict"; +(function(window) { define([], function() { + if (window === undefined) { + window = {}; + } window.hftSettings = window.hftSettings || {}; var numRE = /\d+/; @@ -113,3 +117,5 @@ define([], function() { return window.hftSettings; }); +}(this)); +
try to make hft-settings.js work on node
greggman_HappyFunTimes
train
js
d2bd6c590c517d786109de215258bf0ada41f7a9
diff --git a/src/main/org/codehaus/groovy/control/SourceUnit.java b/src/main/org/codehaus/groovy/control/SourceUnit.java index <HASH>..<HASH> 100644 --- a/src/main/org/codehaus/groovy/control/SourceUnit.java +++ b/src/main/org/codehaus/groovy/control/SourceUnit.java @@ -99,7 +99,7 @@ import org.codehaus.groovy.tools.Utilities; public class SourceUnit extends ProcessingUnit { - private static ParserPlugin parserPlugin; + private ParserPlugin parserPlugin; protected ReaderSource source; // Where we can get Readers for our source unit protected String name; // A descriptive name of the source unit @@ -282,6 +282,9 @@ public class SourceUnit extends ProcessingUnit { reader = source.getReader(); + // lets force the recreation of the plugin + parserPlugin = null; + cst = getParserPlugin().parseCST(this, reader); completePhase(); @@ -434,7 +437,7 @@ public class SourceUnit extends ProcessingUnit return sample; } - public static ParserPlugin getParserPlugin() { + public ParserPlugin getParserPlugin() { if (parserPlugin == null) { parserPlugin = ParserPlugin.newInstance(); }
First cut of the basic Antlr plugin shell, ready for the hard work of actually converting the Antlr AST to groovy AST git-svn-id: <URL>
apache_groovy
train
java
fc4fac76ddc15405d541b06b052402135a729f64
diff --git a/tests/shell/test_core.py b/tests/shell/test_core.py index <HASH>..<HASH> 100644 --- a/tests/shell/test_core.py +++ b/tests/shell/test_core.py @@ -18,7 +18,6 @@ import pelix.shell.beans as beans # Standard library import os -import shlex import sys try: from StringIO import StringIO
Removed the unused shlex import
tcalmant_ipopo
train
py
e7a93fa32b98a6d8a20d2c28035233928523a46f
diff --git a/polyinterface/polyinterface.py b/polyinterface/polyinterface.py index <HASH>..<HASH> 100644 --- a/polyinterface/polyinterface.py +++ b/polyinterface/polyinterface.py @@ -75,6 +75,7 @@ def setup_log(): return logger LOGGER = setup_log() +sys.stdout = LoggerWriter(LOGGER.debug) sys.stderr = LoggerWriter(LOGGER.error) LOGGER.info('Polyglot v2 Interface Starting...')
redirect stout and sterr
UniversalDevicesInc_polyglot-v2-python-interface
train
py
bad4b22f1404ac85bcc92b9c04da1777d5a885da
diff --git a/app/policies/renalware/base_policy.rb b/app/policies/renalware/base_policy.rb index <HASH>..<HASH> 100644 --- a/app/policies/renalware/base_policy.rb +++ b/app/policies/renalware/base_policy.rb @@ -16,7 +16,7 @@ module Renalware def index? return true if user_is_devops? || user_is_super_admin? - return has_permission_for_restricted? if restricted? + return permission_for_restricted? if restricted? has_any_role? end @@ -26,7 +26,7 @@ module Renalware def create? return true if user_is_devops? || user_is_super_admin? - return has_permission_for_restricted? if restricted? + return permission_for_restricted? if restricted? has_write_privileges? end @@ -67,7 +67,7 @@ module Renalware permission_configuration.restricted? end - def has_permission_for_restricted? + def permission_for_restricted? permission_configuration.has_permission?(user) end
Remove has_ from predicate method names
airslie_renalware-core
train
rb
2d46f42e7be522c48799f0aab8972a43244ff391
diff --git a/test/integration/version_upgrade_test.go b/test/integration/version_upgrade_test.go index <HASH>..<HASH> 100644 --- a/test/integration/version_upgrade_test.go +++ b/test/integration/version_upgrade_test.go @@ -75,7 +75,7 @@ func TestVersionUpgrade(t *testing.T) { } defer os.Remove(tf.Name()) - releaseRunner := NewMinikubeRunner(t, "--wait=false") + releaseRunner := NewMinikubeRunner(t) releaseRunner.BinaryPath = tf.Name() // For full coverage: also test upgrading from oldest to newest supported k8s release releaseRunner.Start(fmt.Sprintf("--kubernetes-version=%s", constants.OldestKubernetesVersion))
Omit --wait for the released version, as it does not support this new flag
kubernetes_minikube
train
go
8947c54900ee42c03d1b851f906191031db91146
diff --git a/testing/stubs.go b/testing/stubs.go index <HASH>..<HASH> 100644 --- a/testing/stubs.go +++ b/testing/stubs.go @@ -99,11 +99,7 @@ func TestInterceptor(testID string, stubbedWorkflows, stubbedShortWorkflows []st d.StartChildWorkflowExecutionDecisionAttributes.TaskList = ShortStubTaskList } case swf.DecisionTypeScheduleActivityTask: - log.Printf("%+v", d.ScheduleActivityTaskDecisionAttributes) - log.Printf("%+v", d.ScheduleActivityTaskDecisionAttributes.TaskList.Name) - d.ScheduleActivityTaskDecisionAttributes.TaskList.Name = S(*d.ScheduleActivityTaskDecisionAttributes.TaskList.Name + testID) - log.Printf("%+v", d.ScheduleActivityTaskDecisionAttributes.TaskList.Name) - + d.ScheduleActivityTaskDecisionAttributes.TaskList = &swf.TaskList{Name: S(*d.ScheduleActivityTaskDecisionAttributes.TaskList.Name + testID)} } } },
dont modify the pointed to task list, make a different one
sclasen_swfsm
train
go
b75f3c99502be5625bcd06ab82fd51f16a4a7314
diff --git a/src/compatibility/json/stringify.js b/src/compatibility/json/stringify.js index <HASH>..<HASH> 100644 --- a/src/compatibility/json/stringify.js +++ b/src/compatibility/json/stringify.js @@ -94,7 +94,7 @@ function _gpfJsonStringifyCheckReplacer (replacer) { if (_gpfIsArray(replacer)) { // whitelist return function (key, value) { - if (replacer.indexOf(key) !== -1) { + if (replacer.includes(key)) { return value; } };
no-magic-numbers (#<I>)
ArnaudBuchholz_gpf-js
train
js
3529b31003319fcff21a19af712044ef0ba770de
diff --git a/bittrex/bittrex.py b/bittrex/bittrex.py index <HASH>..<HASH> 100644 --- a/bittrex/bittrex.py +++ b/bittrex/bittrex.py @@ -135,7 +135,7 @@ class Bittrex(object): """ Used to get the last 24 hour summary of all active exchanges in specific coin - :param market: String literal for the market(ex: XRP) + :param market: String literal for the market(ex: BTC-XRP) :type market: str :return: Summaries of active exchanges of a coin in JSON
Rectified description for get_marketsummary
ericsomdahl_python-bittrex
train
py
8903779084b7319f9d4b6cfa2cb4efb172ebab09
diff --git a/gulp/download-locales.js b/gulp/download-locales.js index <HASH>..<HASH> 100644 --- a/gulp/download-locales.js +++ b/gulp/download-locales.js @@ -1,13 +1,23 @@ var downloadLocales = require('webmaker-download-locales'); +var glob = require('glob'); +var fs = require('fs-extra'); // Which languages should we pull down? // Don't include en-US because that's committed into git already var supportedLanguages = ['id', 'en_CA', 'es_CL', 'fr', 'nl', 'es_MX', 'cs', 'sv', 'bn_BD']; module.exports = function (callback) { - downloadLocales({ - app: 'webmaker-app', - dir: 'locale', - languages: supportedLanguages - }, callback); + + glob('!./locale/!(en_US)/**.json', function (err, files) { + files.forEach(function (file) { + fs.removeSync(file); + }); + downloadLocales({ + app: 'webmaker-app', + dir: 'locale', + languages: supportedLanguages + }, function (err) { + console.log('foo'); + }); + }); };
[#<I>] Remove old locale files
mozilla_webmaker-android
train
js
761d70108039c75900b4d0d0b478ec6515ea946b
diff --git a/h2o-algos/src/main/java/hex/deeplearning/DeepLearningModel.java b/h2o-algos/src/main/java/hex/deeplearning/DeepLearningModel.java index <HASH>..<HASH> 100755 --- a/h2o-algos/src/main/java/hex/deeplearning/DeepLearningModel.java +++ b/h2o-algos/src/main/java/hex/deeplearning/DeepLearningModel.java @@ -112,7 +112,7 @@ public class DeepLearningModel extends SupervisedModel<DeepLearningModel,DeepLea * results. Note that deterministic sampling and initialization might * still lead to some weak sense of determinism in the model. */ - public long _seed = new Random().nextLong(); + public long _seed = RandomUtils.getRNG(System.currentTimeMillis()).nextLong(); /*Adaptive Learning Rate*/ /**
Explicitly use ms since epoch for seed generation to not get FindBugs warning..
h2oai_h2o-3
train
java
64f78b0b291bcfa74e0d323b7558a2d66e154cdc
diff --git a/index.js b/index.js index <HASH>..<HASH> 100644 --- a/index.js +++ b/index.js @@ -54,7 +54,7 @@ function physicsSimulator(settings) { springForce = createSpringForce(), dragForce = createDragForce(); - return { + var publicApi = { /** * Array of bodies, registered with current simulator * @@ -144,8 +144,41 @@ function physicsSimulator(settings) { springs.splice(idx, 1); return true; } + }, + + // expose api to change simulator settings: + springLength: function (value) { + if (value !== undefined) { + settings.springLength = value; + } + } + } + + exposeSettings(publicApi); + + return publicApi; + + /** + * Augment our public API with setting accessor/modifier methods + * Each setting in the 'settings' object gets identical function name on the + * publicly exposed API + * + * E.g. simulator.springLength() will return current settings.springLength + * and simulator.springLength(20) will set current spring length to 20 + */ + function exposeSettings(target) { + for (var key in settings) { + if (settings.hasOwnProperty(key)) { + target[key] = function (value) { + if (value !== undefined) { + settings[key] = value; + return target; + } + return settings[key]; + } + } } - }; + } function accumulateForces() { // Accumulate forces acting on bodies.
Exposing settings as part of public api
anvaka_ngraph.physics.simulator
train
js
6751287fdffc4749033d703379504ad3cea409e0
diff --git a/sdk/src/main/java/com/wonderpush/sdk/NotificationManager.java b/sdk/src/main/java/com/wonderpush/sdk/NotificationManager.java index <HASH>..<HASH> 100644 --- a/sdk/src/main/java/com/wonderpush/sdk/NotificationManager.java +++ b/sdk/src/main/java/com/wonderpush/sdk/NotificationManager.java @@ -64,10 +64,10 @@ public class NotificationManager { if (overrideNotificationReceipt != null) { notifReceipt = overrideNotificationReceipt; } - if (notifReceipt) { - WonderPush.trackInternalEvent("@NOTIFICATION_RECEIVED", trackData); - } else if (receiptUsingMeasurements) { + if (receiptUsingMeasurements) { WonderPush.trackInternalEventWithMeasurementsApi("@NOTIFICATION_RECEIVED", trackData); + } else if (notifReceipt) { + WonderPush.trackInternalEvent("@NOTIFICATION_RECEIVED", trackData); } WonderPushConfiguration.setLastReceivedNotificationInfoJson(trackData); } catch (JSONException ex) {
if both receipt and receiptUsingMeasurements are true, use the measurements api
wonderpush_wonderpush-android-sdk
train
java
16e78dc9a62150fd79932b78c150d50e1f8154ce
diff --git a/lib/classy_enum/base.rb b/lib/classy_enum/base.rb index <HASH>..<HASH> 100644 --- a/lib/classy_enum/base.rb +++ b/lib/classy_enum/base.rb @@ -3,10 +3,8 @@ module ClassyEnum extend ClassyEnum::ClassMethods include ClassyEnum::InstanceMethods include Comparable - include ActiveModel::AttributeMethods class_attribute :enum_options, :base_class - attribute_method_suffix '?' attr_accessor :owner, :serialize_as_json end end diff --git a/lib/classy_enum/class_methods.rb b/lib/classy_enum/class_methods.rb index <HASH>..<HASH> 100644 --- a/lib/classy_enum/class_methods.rb +++ b/lib/classy_enum/class_methods.rb @@ -22,7 +22,11 @@ module ClassyEnum enum = klass.name.gsub(klass.base_class.name, '').underscore.to_sym enum_options << klass - define_attribute_method enum + + # Define attribute methods like two? + base_class.class_eval do + define_method "#{enum}?", lambda { attribute?(enum.to_s) } + end klass.class_eval do @index = enum_options.size
Removing use of ActiveModel::AttributeMethods
beerlington_classy_enum
train
rb,rb
810ba666202d20c670ae7d7de508f5a4c6d19d84
diff --git a/authenticators/cf_authenticator.go b/authenticators/cf_authenticator.go index <HASH>..<HASH> 100644 --- a/authenticators/cf_authenticator.go +++ b/authenticators/cf_authenticator.go @@ -10,7 +10,7 @@ import ( "strings" "code.cloudfoundry.org/lager" - "github.com/dgrijalva/jwt-go" + "github.com/golang-jwt/jwt/v4" "golang.org/x/crypto/ssh" )
Switch to golang-jwt/jwt instead of dgrijalva/jwt dgrijalva/jwt is deprecated and golang-jwt/jwt is supported
cloudfoundry_diego-ssh
train
go
2a345d74899fa5c1977b15d0ce32f7f8336650b9
diff --git a/src/Presenters/Application/Search/SearchPanel.php b/src/Presenters/Application/Search/SearchPanel.php index <HASH>..<HASH> 100644 --- a/src/Presenters/Application/Search/SearchPanel.php +++ b/src/Presenters/Application/Search/SearchPanel.php @@ -207,7 +207,7 @@ class SearchPanel extends HtmlPresenter if (sizeof($filters) == 0) { // The search doesn't want to filter anything. - return false; + return null; } if ($filter === null) {
Changes to search panel to allow multiple actors to filter a collection
RhubarbPHP_Module.Leaf
train
php
4f2da04e5d7005115ffc9590f6b7887f14d26156
diff --git a/test/katex-spec.js b/test/katex-spec.js index <HASH>..<HASH> 100644 --- a/test/katex-spec.js +++ b/test/katex-spec.js @@ -3364,6 +3364,7 @@ describe("Unicode", function() { expect`┌x┐ └x┘`.toBuild(); expect("\u231Cx\u231D \u231Ex\u231F").toBuild(); expect("\u27E6x\u27E7").toBuild(); + expect("\\llbracket \\rrbracket").toBuild(); expect("\\lBrace \\rBrace").toBuild(); });
Add test for double square brackets to katex-spec (#<I>)
KaTeX_KaTeX
train
js
047b187d0e2cf932feb4179e49714f18608e8018
diff --git a/railties/lib/rails/api/task.rb b/railties/lib/rails/api/task.rb index <HASH>..<HASH> 100644 --- a/railties/lib/rails/api/task.rb +++ b/railties/lib/rails/api/task.rb @@ -16,8 +16,7 @@ module Rails :include => %w( README.rdoc lib/active_record/**/*.rb - ), - :exclude => 'lib/active_record/vendor/*' + ) }, 'activemodel' => { @@ -33,23 +32,22 @@ module Rails lib/abstract_controller/**/*.rb lib/action_controller/**/*.rb lib/action_dispatch/**/*.rb - ), - :exclude => 'lib/action_controller/vendor/*' + ) }, 'actionview' => { :include => %w( README.rdoc lib/action_view/**/*.rb - ) + ), + :exclude => 'lib/action_view/vendor/*' }, 'actionmailer' => { :include => %w( README.rdoc lib/action_mailer/**/*.rb - ), - :exclude => 'lib/action_mailer/vendor/*' + ) }, 'railties' => {
Fixed API task file 1. As we have vendor in AV only 2. No more vendor in AC 3. No vendor folder in AR
rails_rails
train
rb
60e1cec39c36d4eea7057accb444e888d0fbba05
diff --git a/raiden/channel.py b/raiden/channel.py index <HASH>..<HASH> 100644 --- a/raiden/channel.py +++ b/raiden/channel.py @@ -405,7 +405,7 @@ class Channel(object): # As a receiver: If the lock expiration is larger than the settling # time a secret could be revealed after the channel is settled and # we won't be able to claim the asset - if transfer.lock.expiration - self.chain.block_number >= self.settle_timeout: + if not transfer.lock.expiration - self.chain.block_number < self.settle_timeout: log.error( "Transfer expiration doesn't allow for correct settlement.", transfer_expiration_block=transfer.lock.expiration, @@ -415,7 +415,7 @@ class Channel(object): raise ValueError("Transfer expiration doesn't allow for correct settlement.") - if transfer.lock.expiration - self.chain.block_number > self.reveal_timeout: + if not transfer.lock.expiration - self.chain.block_number > self.reveal_timeout: log.error( 'Expiration smaller than the minimum required.', transfer_expiration_block=transfer.lock.expiration,
fix logical statement of expiration error
raiden-network_raiden
train
py
d90de1f65a4fbafeb09cc89a450762e51c9b5a7d
diff --git a/lifxlan/device.py b/lifxlan/device.py index <HASH>..<HASH> 100644 --- a/lifxlan/device.py +++ b/lifxlan/device.py @@ -44,9 +44,8 @@ def get_broadcast_addrs(): ip = ni.ifaddresses(iface)[ni.AF_INET][0]['addr'] if ip != '127.0.0.1': local_ips.append(ip) - except: + except: # for interfaces that don't support ni.AF_INET pass - #local_ips = [l for l in ([ip for ip in gethostbyname_ex(gethostname())[2] if not ip.startswith("127.")][:1], [[(s.connect(('8.8.8.8', 53)), s.getsockname()[0], s.close()) for s in [socket(AF_INET, SOCK_DGRAM)]][0][1]]) if l] for local_ip in local_ips: ip_parts = local_ip.split(".") ip_parts[-1] = "255"
cleaned up code by removing commented out code
mclarkk_lifxlan
train
py
6ff8e70fd09b02b14ddcc305a14f7c49fe04b862
diff --git a/lib/cinch/names.rb b/lib/cinch/names.rb index <HASH>..<HASH> 100644 --- a/lib/cinch/names.rb +++ b/lib/cinch/names.rb @@ -22,8 +22,12 @@ module Cinch end on(:part) do |m| - channel_names[m.channel] ||= [] - channel_names[m.channel].delete m.nick + if m.nick == nick + channel_names.delete(m.channel) + else + channel_names[m.channel] ||= [] + channel_names[m.channel].delete m.nick + end end end end diff --git a/spec/names_spec.rb b/spec/names_spec.rb index <HASH>..<HASH> 100644 --- a/spec/names_spec.rb +++ b/spec/names_spec.rb @@ -186,6 +186,19 @@ describe Cinch::Base do @listener.call(@message) @bot.channel_names[@message.channel].should == @nicks end + + describe 'and the parter is the bot' do + before :each do + @message.nick = @bot.nick + end + + it 'should completely remove the channel from the names hash' do + channel_names = { '#otherchan' => %w[some people], @message.channel => %w[bunch of people] } + @bot.instance_variable_set('@channel_names', channel_names.dup) + @listener.call(@message) + @bot.channel_names.should == { '#otherchan' => %w[some people] } + end + end end end end
Handling bot leaving channel. When the bot joins, it doesn't help much to just remove its own nick from the list. Kill it entirely. That channel isn't a concern anymore.
cinchrb_cinch
train
rb,rb
782322b808b6300d414c41887d5dc0a01efe41fe
diff --git a/src/Validation/Validation.php b/src/Validation/Validation.php index <HASH>..<HASH> 100644 --- a/src/Validation/Validation.php +++ b/src/Validation/Validation.php @@ -16,6 +16,7 @@ namespace Cake\Validation; use Cake\Utility\Text; use LogicException; +use NumberFormatter; use RuntimeException; /** @@ -480,9 +481,9 @@ class Validation // account for localized floats. $locale = ini_get('intl.default_locale') ?: 'en_US'; - $formatter = new \NumberFormatter($locale, \NumberFormatter::DECIMAL); - $decimalPoint = $formatter->getSymbol(\NumberFormatter::DECIMAL_SEPARATOR_SYMBOL); - $groupingSep = $formatter->getSymbol(\NumberFormatter::GROUPING_SEPARATOR_SYMBOL); + $formatter = new NumberFormatter($locale, NumberFormatter::DECIMAL); + $decimalPoint = $formatter->getSymbol(NumberFormatter::DECIMAL_SEPARATOR_SYMBOL); + $groupingSep = $formatter->getSymbol(NumberFormatter::GROUPING_SEPARATOR_SYMBOL); $check = str_replace($groupingSep, '', $check); $check = str_replace($decimalPoint, '.', $check);
Use NumberFormatter at the top of file
cakephp_cakephp
train
php
a53ce2de125f07d7a1c71857ee320c4a449dd39b
diff --git a/packages/ember-handlebars/lib/ext.js b/packages/ember-handlebars/lib/ext.js index <HASH>..<HASH> 100644 --- a/packages/ember-handlebars/lib/ext.js +++ b/packages/ember-handlebars/lib/ext.js @@ -182,6 +182,8 @@ Ember.Handlebars.registerHelper('blockHelperMissing', function(path) { if (Ember.FEATURES.isEnabled('container-renderables')) { + Ember.assert("`blockHelperMissing` was invoked without a helper name, which is most likely due to a mismatch between the version of Ember.js you're running now and the one used to precompile your templates. Please make sure the version of `ember-handlebars-compiler` you're using is up to date.", path); + var helper = Ember.Handlebars.resolveHelper(options.data.view.container, path); if (helper) {
[BUGFIX beta] Added assert mismatched template compiler version. See #<I>. Using an old version of Ember to precompile templates can result in an unusual error when trying to render a component in block form, e.g. ``` {{#my-component}}Hello{{/my-component}} ``` This commit adds an assert to give the user more information as to what's going on.
emberjs_ember.js
train
js
6a4c02b850396b9d9e6f3ec8828b613459b71223
diff --git a/activerecord/lib/active_record/relation/batches.rb b/activerecord/lib/active_record/relation/batches.rb index <HASH>..<HASH> 100644 --- a/activerecord/lib/active_record/relation/batches.rb +++ b/activerecord/lib/active_record/relation/batches.rb @@ -271,7 +271,7 @@ module ActiveRecord end def batch_order - "#{quoted_table_name}.#{quoted_primary_key} ASC" + arel_attribute(primary_key).asc end def act_on_ignored_order(error_on_ignore) diff --git a/activerecord/test/cases/batches_test.rb b/activerecord/test/cases/batches_test.rb index <HASH>..<HASH> 100644 --- a/activerecord/test/cases/batches_test.rb +++ b/activerecord/test/cases/batches_test.rb @@ -614,6 +614,17 @@ class EachTest < ActiveRecord::TestCase assert_equal expected, actual end + test ".find_each respects table alias" do + assert_queries(1) do + table_alias = Post.arel_table.alias("omg_posts") + table_metadata = ActiveRecord::TableMetadata.new(Post, table_alias) + predicate_builder = ActiveRecord::PredicateBuilder.new(table_metadata) + + posts = ActiveRecord::Relation.create(Post, table_alias, predicate_builder) + posts.find_each {} + end + end + test ".find_each bypasses the query cache for its own queries" do Post.cache do assert_queries(2) do
`quoted_table_name` doesn't respect table alias So using `arel_attribute(primary_key).asc` in `batch_order` instead.
rails_rails
train
rb,rb
d24ae4ccdf4d6a890ac4ad3fc54df56c130e98c8
diff --git a/__init__.py b/__init__.py index <HASH>..<HASH> 100644 --- a/__init__.py +++ b/__init__.py @@ -3,4 +3,4 @@ __copyright__ = "Copyright (c) 2010-2016, Haibao Tang" __email__ = "tanghaibao@gmail.com" __license__ = "BSD" __status__ = "Development" -__version__ = "0.6.9" +__version__ = "0.6.10" diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -1,7 +1,6 @@ #!/usr/bin/env python from setuptools import setup, find_packages -from glob import glob name = "jcvi" @@ -30,7 +29,7 @@ setup( url='http://github.com/tanghaibao/jcvi', description='Python utility libraries on genome assembly, '\ 'annotation and comparative genomics', - long_description=open("README.rst").read(), + long_description=open("README.md").read(), install_requires=['biopython', 'numpy', 'matplotlib', 'deap', 'networkx'] )
[readme] setup.py include md rather than rst
tanghaibao_jcvi
train
py,py
ec5a953db67d1c99534b5a20c021d2fa9f8345df
diff --git a/src/components/breakpoints.js b/src/components/breakpoints.js index <HASH>..<HASH> 100644 --- a/src/components/breakpoints.js +++ b/src/components/breakpoints.js @@ -1,7 +1,7 @@ import { warn } from '../utils/log' import { throttle } from '../utils/wait' import { isObject } from '../utils/unit' -import { sortKeys, mergeOptions } from '../utils/object' +import { sortKeys } from '../utils/object' import EventsBinder from '../core/event/events-binder'
Remove unused import in breakpoints component
glidejs_glide
train
js
662e7ac5c2af3bcfd3c5211829b2d9bf183cd9a9
diff --git a/graphistry/pygraphistry.py b/graphistry/pygraphistry.py index <HASH>..<HASH> 100644 --- a/graphistry/pygraphistry.py +++ b/graphistry/pygraphistry.py @@ -425,7 +425,7 @@ class PyGraphistry(object): :returns: {'entities': DF, 'events': DF, 'edges': DF, 'nodes': DF, 'graph': Plotter} :rtype: dict - **Example: Connect user<-row->boss ** + **Example: Connect user<-row->boss** :: @@ -434,7 +434,7 @@ class PyGraphistry(object): h = graphistry.hypergraph(users_df) g = h['graph'].plot() - **Example: Connect user->boss ** + **Example: Connect user->boss** :: @@ -443,7 +443,7 @@ class PyGraphistry(object): h = graphistry.hypergraph(users_df, direct=True) g = h['graph'].plot() - **Example: Connect user<->boss ** + **Example: Connect user<->boss** :: @@ -452,7 +452,7 @@ class PyGraphistry(object): h = graphistry.hypergraph(users_df, direct=True, opts={'EDGES': {'user': ['boss'], 'boss': ['user']}}) g = h['graph'].plot() - **Example: Only consider some columns for nodes ** + **Example: Only consider some columns for nodes** ::
fix(docs): typos
graphistry_pygraphistry
train
py
74d56c6dea7799c4465a14840f2bfe51bf13024f
diff --git a/openshift/dynamic/discovery.py b/openshift/dynamic/discovery.py index <HASH>..<HASH> 100644 --- a/openshift/dynamic/discovery.py +++ b/openshift/dynamic/discovery.py @@ -9,7 +9,7 @@ from abc import abstractmethod, abstractproperty from urllib3.exceptions import ProtocolError, MaxRetryError from openshift import __version__ -from .exceptions import ResourceNotFoundError, ResourceNotUniqueError, ApiException +from .exceptions import ResourceNotFoundError, ResourceNotUniqueError, ApiException, ServiceUnavailableError from .resource import Resource, ResourceList @@ -182,7 +182,10 @@ class Discoverer(object): subresources = {} path = '/'.join(filter(None, [prefix, group, version])) - resources_response = self.client.request('GET', path).resources or [] + try: + resources_response = self.client.request('GET', path).resources or [] + except ServiceUnavailableError: + resources_response = [] resources_raw = list(filter(lambda resource: '/' not in resource['name'], resources_response)) subresources_raw = list(filter(lambda resource: '/' in resource['name'], resources_response))
Ignore ServiceUnavailableError for an all resource group search (#<I>) There are situations where a given api service unrelated to the requested resource is unavailable and an ServiceUnavailableError exception is thrown. The change in this PR will allow resources to be found if the resource being requested is unrelated to an api service that is unavailable. Resolves <URL>
openshift_openshift-restclient-python
train
py
b05c76df9fc5b35c88a4b288c1fa2c58b1d8273e
diff --git a/mythril/laser/ethereum/svm.py b/mythril/laser/ethereum/svm.py index <HASH>..<HASH> 100644 --- a/mythril/laser/ethereum/svm.py +++ b/mythril/laser/ethereum/svm.py @@ -9,7 +9,7 @@ from mythril.analysis.potential_issues import check_potential_issues from mythril.laser.ethereum.cfg import NodeFlags, Node, Edge, JumpType from mythril.laser.ethereum.evm_exceptions import StackUnderflowException from mythril.laser.ethereum.evm_exceptions import VmException -from mythril.laser.ethereum.instructions import Instruction +from mythril.laser.ethereum.instructions import Instruction, transfer_ether from mythril.laser.ethereum.instruction_data import get_required_stack_elements from mythril.laser.ethereum.plugins.signals import PluginSkipWorldState, PluginSkipState from mythril.laser.ethereum.plugins.implementations.plugin_annotations import ( @@ -351,6 +351,13 @@ class LaserEVM: start_signal.global_state.world_state.constraints ) + transfer_ether( + new_global_state, + start_signal.transaction.caller, + start_signal.transaction.callee_account.address, + start_signal.transaction.call_value, + ) + log.debug("Starting new transaction %s", start_signal.transaction) return [new_global_state], op_code
Add ether transfer to TransactionStartSignal exception handler
ConsenSys_mythril-classic
train
py
0a6c0cd8fb36792efdeeb0f1226389fa69f23ba4
diff --git a/mitogen/compat/pkgutil.py b/mitogen/compat/pkgutil.py index <HASH>..<HASH> 100644 --- a/mitogen/compat/pkgutil.py +++ b/mitogen/compat/pkgutil.py @@ -542,7 +542,7 @@ def extend_path(path, name): if os.path.isfile(pkgfile): try: f = open(pkgfile) - except IOError, msg: + except IOError as msg: sys.stderr.write("Can't open %s: %s\n" % (pkgfile, msg)) else:
pkgutil: fix Python3 compatibility Starting with Python3 the `as` clause must be used to associate a name to the exception being passed.
dw_mitogen
train
py
a6ea8015f368b8f26abca13cd64bf5646a02fc67
diff --git a/spec/bblib_spec.rb b/spec/bblib_spec.rb index <HASH>..<HASH> 100644 --- a/spec/bblib_spec.rb +++ b/spec/bblib_spec.rb @@ -66,7 +66,7 @@ describe BBLib do b = {b:[8], c:{d:{e:9, f:'test', g:0}}} expect(a.deep_merge b).to eq ({:a=>1, :b=>[2, 3, 8], :c=>{:d=>{:e=>9, :f=>"test", :g=>0}}}) expect(a.deep_merge b, merge_arrays: false).to eq ({:a=>1, :b=>[8], :c=>{:d=>{:e=>9, :f=>"test", :g=>0}}}) - expect(a.deep_merge b, overwrite_vals: false).to eq ({:a=>1, :b=>[2, 3, 8], :c=>{:d=>{:e=>[4, 9], :f=>[5, 6, 7, "test"], :g=>0}}}) + expect(a.deep_merge b, overwrite: false).to eq ({:a=>1, :b=>[2, 3, 8], :c=>{:d=>{:e=>[4, 9], :f=>[5, 6, 7, "test"], :g=>0}}}) end # Hash Path
Modified the named param to deep merge to the new, correct name.
bblack16_bblib-ruby
train
rb
3968c583e773c471b9e9b65a84dbbd9d907b23bd
diff --git a/spec/i2c_spec.rb b/spec/i2c_spec.rb index <HASH>..<HASH> 100644 --- a/spec/i2c_spec.rb +++ b/spec/i2c_spec.rb @@ -34,5 +34,19 @@ describe 'pi_piper' do end end + describe "write operation" do + + it "should set address" do + Platform.driver = StubDriver.new.tap do |d| + d.should_receive(:i2c_set_address).with(4) + end + + I2C.begin do + write :to => 4, :data => [1, 2, 3, 4] + end + end + + end + end end
write op should set addr
jwhitehorn_pi_piper
train
rb
d271d44b1bbadf673c02512e6d2792e7a2370f52
diff --git a/classes/Boom/Model/Page.php b/classes/Boom/Model/Page.php index <HASH>..<HASH> 100644 --- a/classes/Boom/Model/Page.php +++ b/classes/Boom/Model/Page.php @@ -173,6 +173,13 @@ class Boom_Model_Page extends Model_Taggable ->execute($this->db); } + public function delete_from_linksets() + { + DB::delete('chunk_linkset_links') + ->where('target_page_id', '=', $this->id) + ->execute($this->id); + } + public function get_author_names_as_string() { $authors = $this->get_tags_with_name_like('Author/%'); @@ -312,6 +319,7 @@ class Boom_Model_Page extends Model_Taggable if ($this->_loaded) { $this->delete_from_feature_boxes(); + $this->delete_from_linksets(); // Delete the child pages as well? if ($with_children === TRUE)
Delete page from linksets when it's deleted
boomcms_boom-core
train
php
7a6a9c5fca2e24af546006c6a13526d19b3bf87b
diff --git a/code/libraries/koowa/loader/loader.php b/code/libraries/koowa/loader/loader.php index <HASH>..<HASH> 100755 --- a/code/libraries/koowa/loader/loader.php +++ b/code/libraries/koowa/loader/loader.php @@ -26,7 +26,10 @@ require_once Koowa::getPath().'/identifier/exception.php'; require_once Koowa::getPath().'/loader/adapter/interface.php'; require_once Koowa::getPath().'/loader/adapter/exception.php'; require_once Koowa::getPath().'/loader/adapter/abstract.php'; -require_once Koowa::getPath().'/loader/adapter/koowa.php'; +require_once Koowa::getPath().'/loader/adapter/koowa.php'; + +//Instantiate the loader singleton +KLoader::instantiate(); /** * KLoader class @@ -70,9 +73,6 @@ class KLoader if (function_exists('__autoload')) { spl_autoload_register('__autoload'); } - - //Add the koowa adapter - self::addAdapter(new KLoaderAdapterKoowa()); } /**
Loader now instantiates itself.
joomlatools_joomlatools-framework
train
php
18222800ccebadd2633c3a2410f3eac8b74ea966
diff --git a/lib/cfoundry/v2/app.rb b/lib/cfoundry/v2/app.rb index <HASH>..<HASH> 100644 --- a/lib/cfoundry/v2/app.rb +++ b/lib/cfoundry/v2/app.rb @@ -199,7 +199,7 @@ module CFoundry::V2 else state end - rescue CFoundry::StagingError + rescue CFoundry::StagingError, CFoundry::NotStaged "STAGING FAILED" end
Catch NotStaged exception causing app listing to fail in console/cf
cloudfoundry-attic_cfoundry
train
rb
227640ab0970ab1512de6668364b369a802622b6
diff --git a/src/Component/UrlSetInterface.php b/src/Component/UrlSetInterface.php index <HASH>..<HASH> 100644 --- a/src/Component/UrlSetInterface.php +++ b/src/Component/UrlSetInterface.php @@ -20,6 +20,11 @@ interface UrlSetInterface const XML_NAMESPACE_URI = 'http://www.sitemaps.org/schemas/sitemap/0.9'; /** + * Constant for the maximum number of URLs which can be added to a UrlSet + */ + const URL_MAX_COUNT = 50000; + + /** * @param UrlInterface $url */ public function addUrl(UrlInterface $url); diff --git a/test/Component/UrlSetInterfaceTest.php b/test/Component/UrlSetInterfaceTest.php index <HASH>..<HASH> 100644 --- a/test/Component/UrlSetInterfaceTest.php +++ b/test/Component/UrlSetInterfaceTest.php @@ -19,5 +19,7 @@ class UrlSetInterfaceTest extends \PHPUnit_Framework_TestCase { $this->assertSame('xmlns', UrlSetInterface::XML_NAMESPACE_ATTRIBUTE); $this->assertSame('http://www.sitemaps.org/schemas/sitemap/0.9', UrlSetInterface::XML_NAMESPACE_URI); + + $this->assertSame(50000, UrlSetInterface::URL_MAX_COUNT); } }
Enhancement: Add constant for maximum number of URLs
refinery29_sitemap
train
php,php
242625ec57df245ec88626fcc96b91304ad2b42c
diff --git a/NavigationReactNative/src/android/src/main/java/com/navigation/reactnative/TabBarView.java b/NavigationReactNative/src/android/src/main/java/com/navigation/reactnative/TabBarView.java index <HASH>..<HASH> 100644 --- a/NavigationReactNative/src/android/src/main/java/com/navigation/reactnative/TabBarView.java +++ b/NavigationReactNative/src/android/src/main/java/com/navigation/reactnative/TabBarView.java @@ -29,14 +29,15 @@ public class TabBarView extends ViewPager { public TabBarView(Context context) { super(context); addOnPageChangeListener(new TabChangeListener()); - setAdapter(new Adapter()); - getAdapter().registerDataSetObserver(new DataSetObserver() { + Adapter adapter = new Adapter(); + adapter.registerDataSetObserver(new DataSetObserver() { @Override public void onChanged() { if (getCurrentItem() != selectedTab && getTabsCount() > selectedTab) setCurrentItem(selectedTab, false); } }); + setAdapter(adapter); } @Override
Removed compiler warning that adapter may be null
grahammendick_navigation
train
java
7a193988226db01849e00bb15189123ba74ce042
diff --git a/internal/oci/runtime_vm.go b/internal/oci/runtime_vm.go index <HASH>..<HASH> 100644 --- a/internal/oci/runtime_vm.go +++ b/internal/oci/runtime_vm.go @@ -534,6 +534,7 @@ func (r *runtimeVM) StopContainer(ctx context.Context, c *Container, timeout int err := r.waitCtrTerminate(sig, stopCh, timeoutDuration) if err == nil { + c.state.Finished = time.Now() return nil } logrus.Warnf("%v", err) @@ -550,6 +551,7 @@ func (r *runtimeVM) StopContainer(ctx context.Context, c *Container, timeout int return err } + c.state.Finished = time.Now() return nil }
runtime_vm: set finished time when containers stop
cri-o_cri-o
train
go
9c6076d4cbc43e61f7196d17224be63352ea96b1
diff --git a/lib/site_prism/page.rb b/lib/site_prism/page.rb index <HASH>..<HASH> 100644 --- a/lib/site_prism/page.rb +++ b/lib/site_prism/page.rb @@ -10,11 +10,11 @@ module SitePrism include Loadable include ElementContainer - load_validation do - [ - displayed?, - "Expected #{current_url} to match #{url_matcher} but it did not." - ] + # When instantiating the page. A single default validation will be added + # When calling #load, all of the validations set will be ran + # in order, with the default "displayed?" validation being ran first + def initialize + add_displayed_validation end def page @@ -140,6 +140,15 @@ module SitePrism def matcher_template @matcher_template ||= AddressableUrlMatcher.new(url_matcher) end + + def add_displayed_validation + self.class.load_validation do + [ + displayed?, + "Expected #{current_url} to match #{url_matcher} but it did not." + ] + end + end end # rubocop:enable Metrics/ClassLength end
Remove procedural block in page.rb
natritmeyer_site_prism
train
rb
35e1928934d4948b1d4ff2b5a07539fbc120ea53
diff --git a/lib/waterline.js b/lib/waterline.js index <HASH>..<HASH> 100644 --- a/lib/waterline.js +++ b/lib/waterline.js @@ -160,6 +160,7 @@ Waterline.prototype.initialize = function(options, cb) { schemas[collection.identity] = collection; schemas[collection.identity].definition = schema; + schemas[collection.identity].attributes = collection._attributes; schemas[collection.identity].meta = meta; }); @@ -191,7 +192,7 @@ Waterline.prototype.initialize = function(options, cb) { identity = self.collections[coll].__proto__.tableName; } - usedSchemas[identity] = results.buildCollectionSchemas[coll]; + usedSchemas[identity] = _.pick(results.buildCollectionSchemas[coll], ['definition', 'attributes', 'meta']); }); // Call the registerConnection method
send a limited set of data to registerConnection on an adapter - Adapters don't need to handle all of the internals of waterline, all they care about is the definition, user attributes and any meta flags that have been sent in
balderdashy_waterline
train
js
cbc2184b2de459020e6b84a0b01b9121d9c273d4
diff --git a/serf/serf_test.go b/serf/serf_test.go index <HASH>..<HASH> 100644 --- a/serf/serf_test.go +++ b/serf/serf_test.go @@ -327,7 +327,7 @@ func TestSerf_eventsUser_sizeLimit(t *testing.T) { if err == nil { t.Fatalf("expect error") } - if !strings.HasPrefix(err.Error(), "user event exceeds limit of ") { + if !strings.HasPrefix(err.Error(), "user event exceeds") { t.Fatalf("should get size limit error") } }
Fix the TestSerf_eventsUser_sizeLimit test The string it was expecting in the error was no longer accurate.
hashicorp_serf
train
go
740bd6ca0f0de71bbf8a76c734fc38ba777a5fac
diff --git a/app/services/socializer/activity_creator.rb b/app/services/socializer/activity_creator.rb index <HASH>..<HASH> 100644 --- a/app/services/socializer/activity_creator.rb +++ b/app/services/socializer/activity_creator.rb @@ -21,8 +21,11 @@ module Socializer # # @return [OpenStruct] def perform - # TODO: Add translation - fail(RecordInvalid, "Validation failed: #{errors.full_messages.to_sentence}") unless valid? + unless valid? + message = I18n.t('activerecord.errors.messages.record_invalid', errors: errors.full_messages.to_sentence) + fail(RecordInvalid, message) + end + create_activity end
use the active record record_invalid translation
socializer_socializer
train
rb
3a4a30e879e9ff74b4eee7fbf622a5ddb6579d0b
diff --git a/flight/Engine.php b/flight/Engine.php index <HASH>..<HASH> 100644 --- a/flight/Engine.php +++ b/flight/Engine.php @@ -101,10 +101,10 @@ class Engine { } // Default configuration settings - $this->set('flight.views.path', './views'); - $this->set('flight.log_errors', false); - $this->set('flight.handle_errors', true); $this->set('flight.base_url', null); + $this->set('flight.handle_errors', true); + $this->set('flight.log_errors', false); + $this->set('flight.views.path', './views'); $initialized = true; } @@ -386,10 +386,9 @@ class Engine { * @param int $code HTTP status code */ public function _redirect($url, $code = 303) { - if ($this->get('flight.base_url') !== null) { - $base = $this->get('flight.base_url'); - } - else { + $base = $this->get('flight.base_url'); + + if ($base === null) { $base = $this->request()->base; }
Updated check for base_url.
mikecao_flight
train
php
c639615615c88e5d06e31c7d80781284adfd75c6
diff --git a/plugin/kubernetes/setup.go b/plugin/kubernetes/setup.go index <HASH>..<HASH> 100644 --- a/plugin/kubernetes/setup.go +++ b/plugin/kubernetes/setup.go @@ -202,8 +202,6 @@ func ParseStanza(c *caddy.Controller) (*Kubernetes, error) { continue } return nil, c.ArgErr() - case "resyncperiod": - continue case "labels": args := c.RemainingArgs() if len(args) > 0 { @@ -230,9 +228,6 @@ func ParseStanza(c *caddy.Controller) (*Kubernetes, error) { return nil, c.ArgErr() case "fallthrough": k8s.Fall.SetZonesFromArgs(c.RemainingArgs()) - case "upstream": - // remove soon - c.RemainingArgs() // eat remaining args case "ttl": args := c.RemainingArgs() if len(args) == 0 {
remove ignored option at kubernetes plugin (#<I>)
coredns_coredns
train
go
bf91adda73a6330d8ef2ef659421e95a230ed7ce
diff --git a/salt/modules/solaris_user.py b/salt/modules/solaris_user.py index <HASH>..<HASH> 100644 --- a/salt/modules/solaris_user.py +++ b/salt/modules/solaris_user.py @@ -57,14 +57,15 @@ def add(name, uid=None, gid=None, groups=None, - home=True, + home=None, shell=None, unique=True, system=False, fullname='', roomnumber='', workphone='', - homephone=''): + homephone='', + createhome=True): ''' Add a user to the minion @@ -83,15 +84,16 @@ def add(name, cmd += '-g {0} '.format(gid) if groups: cmd += '-G {0} '.format(','.join(groups)) - if home: - if home is not True: - if system: - cmd += '-d {0} '.format(home) - else: - cmd += '-m -d {0} '.format(home) + + if home is None: + if createhome: + cmd += '-m ' + else: + if createhome: + cmd += '-m -d {0} '.format(home) else: - if not system: - cmd += '-m ' + cmd += '-d {0} '.format(home) + if not unique: cmd += '-o ' cmd += name
Mimic what was done in d<I>d<I> but for Solaris.
saltstack_salt
train
py
26388503e0edbb92aef9f4301df5cd02e7885453
diff --git a/agent/agent_endpoint.go b/agent/agent_endpoint.go index <HASH>..<HASH> 100644 --- a/agent/agent_endpoint.go +++ b/agent/agent_endpoint.go @@ -97,7 +97,7 @@ func (s *HTTPServer) AgentMetrics(resp http.ResponseWriter, req *http.Request) ( return nil, acl.ErrPermissionDenied } if enablePrometheusOutput(req) { - if s.agent.config.TelemetryPrometheusRetentionTime.Nanoseconds() < 1 { + if s.agent.config.TelemetryPrometheusRetentionTime < 1 { resp.WriteHeader(http.StatusUnsupportedMediaType) fmt.Fprint(resp, "Prometheus is not enable since its retention time is not positive") return nil, nil
Removed Nanoseconds cast as requested by @banks
hashicorp_consul
train
go
09375b8a60c8a34889de593aad52a74e4b7e2558
diff --git a/client/lib/cart-values/index.js b/client/lib/cart-values/index.js index <HASH>..<HASH> 100644 --- a/client/lib/cart-values/index.js +++ b/client/lib/cart-values/index.js @@ -14,7 +14,6 @@ import config from 'config'; */ import cartItems from './cart-items'; import productsValues from 'lib/products-values'; -import { requestGeoLocation } from 'state/data-getters'; // #tax-on-checout-placeholder import { reduxGetState } from 'lib/redux-bridge'; @@ -318,15 +317,6 @@ function paymentMethodName( method ) { 'web-payment': i18n.translate( 'Wallet' ), }; - // Temporarily override 'credit or debit' with just 'credit' for india - // while debit cards are served by the paywall - if ( method === 'credit-card' ) { - const userCountryCode = requestGeoLocation().data; - if ( 'IN' === userCountryCode ) { - return i18n.translate( 'Credit Card' ); - } - } - return paymentMethodsNames[ method ] || method; }
remove override on payment methods name in India (#<I>)
Automattic_wp-calypso
train
js
91efc0b4d641f93aa923f1cf01063e37ec3db7c1
diff --git a/lib/spotify.js b/lib/spotify.js index <HASH>..<HASH> 100644 --- a/lib/spotify.js +++ b/lib/spotify.js @@ -945,9 +945,9 @@ Spotify.prototype.isTrackAvailable = function (track, country) { // guessing at names here, corrections welcome... var accountTypeMap = { - premium: 'SUBSCRIPTION', - unlimited: 'SUBSCRIPTION', - free: 'AD' + premium: 1, + unlimited: 1, + free: 0 }; if (has(allowed, country) && has(forbidden, country)) { @@ -955,7 +955,7 @@ Spotify.prototype.isTrackAvailable = function (track, country) { isForbidden = false; } - var type = accountTypeMap[this.accountType] || 'AD'; + var type = accountTypeMap[this.accountType] || 0; var applicable = has(restriction.catalogue, type); available = isAllowed && !isForbidden && applicable;
spotify: use number instead of strings for Catalogue The `isTrackAvailable()` function wasn't working properly anymore due to a server-side change in the response format.
TooTallNate_node-spotify-web
train
js
b769cce9042ea51c498af89fe69be5480f509b33
diff --git a/container_linux_test.go b/container_linux_test.go index <HASH>..<HASH> 100644 --- a/container_linux_test.go +++ b/container_linux_test.go @@ -493,7 +493,7 @@ func testContainerUser(t *testing.T, userstr, expectedOutput string) { var ( image Image ctx, cancel = testContext() - id = t.Name() + id = strings.Replace(t.Name(), "/", "_", -1) ) defer cancel()
Fix tests using invalid ID These tests are using their name as ID, but subtests add a forward slash connected to the parent test, and slash (/) is an invalid character for container IDs.
containerd_containerd
train
go
769216392f4dec49c107e67889f57d40567b2235
diff --git a/i3pystatus/pulseaudio/__init__.py b/i3pystatus/pulseaudio/__init__.py index <HASH>..<HASH> 100644 --- a/i3pystatus/pulseaudio/__init__.py +++ b/i3pystatus/pulseaudio/__init__.py @@ -2,7 +2,6 @@ from .pulse import * from i3pystatus import Module - class PulseAudio(Module): """ @@ -40,7 +39,7 @@ class PulseAudio(Module): # connection to Pulseaudio _mainloop = pa_threaded_mainloop_new() _mainloop_api = pa_threaded_mainloop_get_api(_mainloop) - context = pa_context_new(_mainloop_api, 'peak_demo'.encode("ascii")) + context = pa_context_new(_mainloop_api, "i3pystatus_pulseaudio".encode("ascii")) pa_context_set_state_callback(context, self._context_notify_cb, None) pa_context_connect(context, None, 0, None)
pulseaudio: change context name to something meaningful
enkore_i3pystatus
train
py
bb4be3333162926c8652e868ba8c1dfa371e4e05
diff --git a/pkg/chartutil/files.go b/pkg/chartutil/files.go index <HASH>..<HASH> 100644 --- a/pkg/chartutil/files.go +++ b/pkg/chartutil/files.go @@ -22,7 +22,7 @@ import ( "path" "strings" - yaml "gopkg.in/yaml.v2" + "github.com/ghodss/yaml" "github.com/BurntSushi/toml" "github.com/gobwas/glob"
fixed fromYaml | toJson
helm_helm
train
go
3f2f4b427f30cf0d40c95630875080bcc5f9f8f5
diff --git a/drf_compound_fields/fields.py b/drf_compound_fields/fields.py index <HASH>..<HASH> 100755 --- a/drf_compound_fields/fields.py +++ b/drf_compound_fields/fields.py @@ -37,6 +37,7 @@ class ListField(WritableField): return obj def from_native(self, data): + self.validate_is_list(data) if self.item_field and data: return [ self.item_field.from_native(item_data) @@ -47,8 +48,7 @@ class ListField(WritableField): def validate(self, value): super(ListField, self).validate(value) - if not isinstance(value, list): - raise ValidationError(self.error_messages['invalid_type'] % {'value': value}) + self.validate_is_list(value) if self.item_field: errors = {} @@ -62,6 +62,10 @@ class ListField(WritableField): if errors: raise ValidationError(errors) + def validate_is_list(self, value): + if not isinstance(value, list): + raise ValidationError(self.error_messages['invalid_type'] % {'value': value}) + class DictField(WritableField): """
In ListField, factor out validation of list value, and use it at beginning of from_native
estebistec_drf-compound-fields
train
py
3cb6fd676618dd85b82c8d91e778a310d1e0dc6f
diff --git a/lib/Widget/View.php b/lib/Widget/View.php index <HASH>..<HASH> 100644 --- a/lib/Widget/View.php +++ b/lib/Widget/View.php @@ -60,7 +60,10 @@ class View extends Base parent::__construct($options); // Adds widget to template variable - $this->assign('widget', $this->widget); + $this->assign(array( + 'widget' => $this->widget, + 'wei' => $this->widget + )); } /**
assign $wei to view variable to
twinh_wei
train
php
9ebb5d64988d04ddb801c5b51dcefd6c9090feb3
diff --git a/invenio_search_ui/assets/semantic-ui/js/invenio_search_ui/components/SearchApp.js b/invenio_search_ui/assets/semantic-ui/js/invenio_search_ui/components/SearchApp.js index <HASH>..<HASH> 100644 --- a/invenio_search_ui/assets/semantic-ui/js/invenio_search_ui/components/SearchApp.js +++ b/invenio_search_ui/assets/semantic-ui/js/invenio_search_ui/components/SearchApp.js @@ -78,7 +78,7 @@ export const SearchApp = ({ config, appName }) => { </Grid.Column> </Grid.Row> </Grid> - <Grid relaxed padded> + <Grid relaxed> <Grid.Row columns={2}> <Grid.Column width={4}> <SearchAppFacets aggs={config.aggs} />
search: removes side padding in search results and facets
inveniosoftware_invenio-search-ui
train
js