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
|
---|---|---|---|---|---|
9bb16bb383ae0d19acadbefc0d0c2fa22d1b063a | diff --git a/pkg/minikube/image/cache.go b/pkg/minikube/image/cache.go
index <HASH>..<HASH> 100644
--- a/pkg/minikube/image/cache.go
+++ b/pkg/minikube/image/cache.go
@@ -34,6 +34,17 @@ import (
"k8s.io/minikube/pkg/util/lock"
)
+type cacheError struct {
+ Err error
+}
+
+func (f *cacheError) Error() string {
+ return f.Err.Error()
+}
+
+// errCacheImageDoesntExist is thrown when image that user is trying to add does not exist
+var errCacheImageDoesntExist = &cacheError{errors.New("the image you are trying to add does not exist")}
+
// DeleteFromCacheDir deletes tar files stored in cache dir
func DeleteFromCacheDir(images []string) error {
for _, image := range images {
@@ -116,7 +127,7 @@ func saveToTarFile(iname, rawDest string) error {
img, err := retrieveImage(ref)
if err != nil {
- klog.Warningf("unable to retrieve image: %v", err)
+ return errCacheImageDoesntExist
}
if img == nil {
return errors.Wrapf(err, "nil image for %s", iname) | introduced specific error type for case when image does not exist | kubernetes_minikube | train | go |
d15b3fdbe4b6c39aa2dd3a8d9533a1c4eedaf600 | diff --git a/fastlane_core/lib/fastlane_core/ipa_upload_package_builder.rb b/fastlane_core/lib/fastlane_core/ipa_upload_package_builder.rb
index <HASH>..<HASH> 100644
--- a/fastlane_core/lib/fastlane_core/ipa_upload_package_builder.rb
+++ b/fastlane_core/lib/fastlane_core/ipa_upload_package_builder.rb
@@ -34,8 +34,8 @@ module FastlaneCore
private
def copy_ipa(ipa_path)
- ipa_file_name = Digest::MD5.hexdigest(ipa_path)
- resulting_path = File.join(self.package_path, "#{ipa_file_name}.ipa")
+ ipa_file_name = "#{File.basename(ipa_path, '.ipa')}(#{Digest::SHA256.file(ipa_path).hexdigest}).ipa"
+ resulting_path = File.join(self.package_path, ipa_file_name)
FileUtils.cp(ipa_path, resulting_path)
return resulting_path | Set the original name for the uploaded ipa (#<I>) | fastlane_fastlane | train | rb |
713925bf3e5cf9ecde460ec036dd6605e59a61e3 | diff --git a/pkg/volume/plugins.go b/pkg/volume/plugins.go
index <HASH>..<HASH> 100644
--- a/pkg/volume/plugins.go
+++ b/pkg/volume/plugins.go
@@ -878,10 +878,10 @@ func (pm *VolumePluginMgr) FindExpandablePluginBySpec(spec *Spec) (ExpandableVol
if spec.IsKubeletExpandable() {
// for kubelet expandable volumes, return a noop plugin that
// returns success for expand on the controller
- klog.Warningf("FindExpandablePluginBySpec(%s) -> returning noopExpandableVolumePluginInstance", spec.Name())
+ klog.V(4).Infof("FindExpandablePluginBySpec(%s) -> returning noopExpandableVolumePluginInstance", spec.Name())
return &noopExpandableVolumePluginInstance{spec}, nil
}
- klog.Warningf("FindExpandablePluginBySpec(%s) -> err:%v", spec.Name(), err)
+ klog.V(4).Infof("FindExpandablePluginBySpec(%s) -> err:%v", spec.Name(), err)
return nil, err
} | decrease the level of the warning log in volume plugins | kubernetes_kubernetes | train | go |
a638ec8d7cd07ed12ee912ae0bb4193d7d3d4b95 | diff --git a/environs/maas/storage.go b/environs/maas/storage.go
index <HASH>..<HASH> 100644
--- a/environs/maas/storage.go
+++ b/environs/maas/storage.go
@@ -168,13 +168,17 @@ func (stor *maasStorage) URL(name string) (string, error) {
if err != nil {
return "", err
}
- path, err := fileObj.GetField("anon_resource_uri")
+ uri, err := fileObj.GetField("anon_resource_uri")
if err != nil {
msg := fmt.Errorf("could not get file's download URL (may be an outdated MAAS): %s", err)
return "", msg
}
- fullURL := fileObj.GetSubObject(path).URL()
+ partialURL, err := url.Parse(uri)
+ if err != nil {
+ return "", err
+ }
+ fullURL := fileObj.URL().ResolveReference(partialURL)
return fullURL.String(), nil
} | Update for new GetSubObject semantics. | juju_juju | train | go |
4c3bf529c0830bf85ab5ea30098e044c66690e95 | diff --git a/examples/camel-activemq/src/main/java/org/wildfly/camel/examples/activemq/ActiveMQRouteBuilder.java b/examples/camel-activemq/src/main/java/org/wildfly/camel/examples/activemq/ActiveMQRouteBuilder.java
index <HASH>..<HASH> 100644
--- a/examples/camel-activemq/src/main/java/org/wildfly/camel/examples/activemq/ActiveMQRouteBuilder.java
+++ b/examples/camel-activemq/src/main/java/org/wildfly/camel/examples/activemq/ActiveMQRouteBuilder.java
@@ -34,7 +34,8 @@ import javax.naming.InitialContext;
@ContextName("amq-cdi-context")
public class ActiveMQRouteBuilder extends RouteBuilder {
- private static String BROKER_URL = "vm://localhost?broker.persistent=false&broker.useJmx=false";
+ private static String BROKER_URL = "vm://localhost?broker.persistent=false&broker.useJmx=false" +
+ "&broker.useShutdownHook=false";
@Override
public void configure() throws Exception { | [resolves #<I>] Prevent errors being thrown on VM shutdown | wildfly-extras_wildfly-camel | train | java |
6356adeeaa13e8b024f74b9718cfcb49d372eb4c | diff --git a/tests.go b/tests.go
index <HASH>..<HASH> 100644
--- a/tests.go
+++ b/tests.go
@@ -42,7 +42,7 @@ type Test struct {
// Current status at last test
Status string `json:"Status"`
- // 7 Day Uptime
+ // 1 Day Uptime
Uptime float64 `json:"Uptime"`
// Any test locations seperated by a comma (using the Node Location IDs) | Uptime received from /Tests/Detail is only 1 day | DreamItGetIT_statuscake | train | go |
8df79897b4647d524cabc08ea8dd84bc0182f041 | diff --git a/src/libraries/Common.php b/src/libraries/Common.php
index <HASH>..<HASH> 100644
--- a/src/libraries/Common.php
+++ b/src/libraries/Common.php
@@ -17,7 +17,7 @@ final class Common {
/**
* Block instantiation of this object.
*/
- private function __contruct() {}
+ private function __construct() {}
public static function curlRequest($url, $post_content = null,
$content_type = "", $connect_timeout = 5, $max_redirects = 10) { | Fix typo on constructor in Common class | carlbennett_php-mvc | train | php |
8a691f51cb9a141bb953fdf9139c00ed360aef1f | diff --git a/tests/ProxyTest.php b/tests/ProxyTest.php
index <HASH>..<HASH> 100644
--- a/tests/ProxyTest.php
+++ b/tests/ProxyTest.php
@@ -10,9 +10,6 @@ class ProxyTest extends \PHPUnit_Framework_TestCase
const TEST_UPSTREAM = "localhost:6379";
CONST TEST_LISTEN = "localhost:34343";
- const TEST_TOXIC = "latency";
- const TEST_DIRECTION = "downstream";
-
public function tearDown()
{
$toxiproxy = new Toxiproxy();
@@ -45,18 +42,14 @@ class ProxyTest extends \PHPUnit_Framework_TestCase
$callback($proxy);
}
- public function testUpdate()
+ public function testUpdateLatencyDownstream()
{
$this->handleProxy(function(Proxy $proxy){
- $response = $proxy->update(self::TEST_TOXIC, self::TEST_DIRECTION, ["latency" => 100]);
+ $response = $proxy->update("latency", "downstream", ["latency" => 100]);
$this->assertEquals(
$response->getStatusCode(),
Toxiproxy::OK,
- sprintf("Could not update toxic '%s' for proxy '%s' in direction '%s'",
- self::TEST_TOXIC,
- $proxy["name"],
- self::TEST_DIRECTION
- )
+ sprintf("Could not update downstream latency toxic for proxy '%s'", $proxy["name"])
);
});
} | - removing unmaintainable constants (additional tests will require additional constants, not sustainable) | ihsw_toxiproxy-php-client | train | php |
646351cadced73c949401f6d6ea537e14098f547 | diff --git a/rails/init.rb b/rails/init.rb
index <HASH>..<HASH> 100644
--- a/rails/init.rb
+++ b/rails/init.rb
@@ -1,5 +1,7 @@
# Register helpers for Rails < 3
require File.join(File.dirname(__FILE__), *%w[.. lib i18n_rails_helpers])
-require File.join(File.dirname(__FILE__), *%w[.. lib contextual_link_helpers])
ActionView::Base.send :include, I18nRailsHelpers
+require File.join(File.dirname(__FILE__), *%w[.. lib contextual_link_helpers])
ActionView::Base.send :include, ContextualLinkHelpers
+require File.join(File.dirname(__FILE__), *%w[.. lib list_link_helpers.rb])
+ActionView::Base.send :include, ListLinkHelpers | Add support for Rails <3 for list_link_helpers.rb | huerlisi_i18n_rails_helpers | train | rb |
31cfed77f75cce57eecdbd4b52d9d57c6f30839e | diff --git a/src/helpers.js b/src/helpers.js
index <HASH>..<HASH> 100644
--- a/src/helpers.js
+++ b/src/helpers.js
@@ -89,7 +89,7 @@ export function runQuery (instance, query, needResponse) {
if (needResponse) {
response = parseResponse(instance.db.exec(query.toString()))
if (query._sequence && query._sequence[0].method === 'hasTable') {
- return !!response.length
+ response = !!response.length
}
} else {
instance.db.run(query.toString()) | fix(query): return type should always be Promise | citycide_trilogy | train | js |
893c98bd24bc84838f555ae3328529533f12f038 | diff --git a/abl/vpath/base/simpleuri.py b/abl/vpath/base/simpleuri.py
index <HASH>..<HASH> 100644
--- a/abl/vpath/base/simpleuri.py
+++ b/abl/vpath/base/simpleuri.py
@@ -91,7 +91,7 @@ class UriParse(object):
def _init_other_uri(self):
"init code for non http uri"
uri, querysep, rest = self.uri.partition('?')
- if querysep:
+ if querysep and '=' in rest:
self.uri = uri
self.query = parse_query_string(rest)
parts = self.uri.split('://', 1) | only parse query string if "=" is expected | AbletonAG_abl.vpath | train | py |
4ae17dc863172afebf26a21d29741bf1abf1cbc4 | diff --git a/ds4drv/backends/hidraw.py b/ds4drv/backends/hidraw.py
index <HASH>..<HASH> 100644
--- a/ds4drv/backends/hidraw.py
+++ b/ds4drv/backends/hidraw.py
@@ -46,8 +46,11 @@ class HidrawDS4Device(DS4Device):
self.fd.write(hid + data)
def close(self):
- self.fd.close()
- self.input_device.ungrab()
+ try:
+ self.fd.close()
+ self.input_device.ungrab()
+ except IOError:
+ pass
@property
def report_size(self): | hidraw: Fix error on disconnect. | chrippa_ds4drv | train | py |
b42d30bd5734ac924e2024c2b5dc2215e5df3e32 | diff --git a/pdclient/dispenser_client_test.go b/pdclient/dispenser_client_test.go
index <HASH>..<HASH> 100644
--- a/pdclient/dispenser_client_test.go
+++ b/pdclient/dispenser_client_test.go
@@ -140,10 +140,15 @@ var _ = Describe("PDClient struct", func() {
})
})
- XDescribe("given a DeleteLease() method call", func() {
- Context("when called with a valid taskguid", func() {
- It("then it should receive the task object from the rest endpoint, parse and return it", func() {
- Ω(true).Should(Equal(false))
+ Describe("given a DeleteLease() method stub", func() {
+ Context("when called with valid arguments", func() {
+ var err error
+ BeforeEach(func() {
+ pdclient := NewClient("", "", new(fake.ClientDoer))
+ err = pdclient.DeleteLease("", "", "", make(map[string]interface{}, 1))
+ })
+ It("then it should execute a delete call without error", func() {
+ Ω(err).ShouldNot(HaveOccurred())
})
})
}) | [#<I>] even a stubbed out method needs a test | pivotal-pez_pezdispenser | train | go |
5179d3d264d61b1156ef76b6be6c659418123210 | diff --git a/src/scripts/exec_pulse_blaster_sequence.py b/src/scripts/exec_pulse_blaster_sequence.py
index <HASH>..<HASH> 100644
--- a/src/scripts/exec_pulse_blaster_sequence.py
+++ b/src/scripts/exec_pulse_blaster_sequence.py
@@ -119,6 +119,12 @@ class ExecutePulseBlasterSequence(Script, QThread):
# MUST BE IMPLEMENTED IN INHERITING SCRIPT
def _create_pulse_sequences(self):
+ '''
+ A function to create the pulse sequence. This must be overwritten in scripts inheriting from this script
+
+ Returns: pulse_sequences,
+
+ '''
raise NotImplementedError
def _calc_progress(self): | Started to comment exec_pulse_blaster_sequence | LISE-B26_pylabcontrol | train | py |
6be93b38bc9fea20161453c23d75bcbd8546f82c | diff --git a/pubsub.go b/pubsub.go
index <HASH>..<HASH> 100644
--- a/pubsub.go
+++ b/pubsub.go
@@ -169,6 +169,14 @@ func (ps *PubSub) removeTopic(topic string) {
}
func (ps *PubSub) remove(topic string, ch chan interface{}) {
+ if _, ok := ps.topics[topic]; !ok {
+ return
+ }
+
+ if _, ok := ps.topics[topic][ch]; !ok {
+ return
+ }
+
delete(ps.topics[topic], ch)
delete(ps.revTopics[ch], topic)
diff --git a/pubsub_test.go b/pubsub_test.go
index <HASH>..<HASH> 100644
--- a/pubsub_test.go
+++ b/pubsub_test.go
@@ -89,6 +89,19 @@ func (s *Suite) TestClose(c *check.C) {
ps.Shutdown()
}
+func (s *Suite) TestUnsubAfterClose(c *check.C) {
+ ps := New(1)
+ ch := ps.Sub("t1")
+ defer func() {
+ ps.Unsub(ch, "t1")
+ ps.Shutdown()
+ }()
+
+ ps.Close("t1")
+ _, ok := <-ch
+ c.Check(ok, check.Equals, false)
+}
+
func (s *Suite) TestShutdown(c *check.C) {
start := runtime.NumGoroutine()
New(10).Shutdown() | Do not panic on Unsub after Close | cskr_pubsub | train | go,go |
7d54c162e2bf8f65a82e69e1e1b3858b82e354d8 | diff --git a/classes/helper/redirect/MobileRedirect.php b/classes/helper/redirect/MobileRedirect.php
index <HASH>..<HASH> 100644
--- a/classes/helper/redirect/MobileRedirect.php
+++ b/classes/helper/redirect/MobileRedirect.php
@@ -208,6 +208,10 @@ class Shopgate_Helper_Redirect_MobileRedirect
*/
protected function buildTags($pageType, $parameters = array())
{
+ if ($this->settingsManager->isMobileHeaderDisabled()) {
+ return '';
+ }
+
$parameters = $this->siteParameters + $parameters;
$parameters['link_tags'] = $this->tagsGenerator->getTagsFor($pageType, $parameters); | refs LIBRARY-<I> Checking if the mobile header has been disabled (no shop number set or \!shop_is_active in the config) before generating the tags. | shopgate_cart-integration-sdk | train | php |
2b440c1cadbf66eb4a7a963163439f606ad1826c | diff --git a/lib/jets/commands/import/sequence.rb b/lib/jets/commands/import/sequence.rb
index <HASH>..<HASH> 100644
--- a/lib/jets/commands/import/sequence.rb
+++ b/lib/jets/commands/import/sequence.rb
@@ -39,7 +39,12 @@ class Jets::Commands::Import
puts "Creating rack folder"
template_path = File.expand_path(@source)
set_source_paths(template_path)
- directory ".", rack_folder, exclude_pattern: %r{.git}
+ begin
+ directory ".", rack_folder, exclude_pattern: %r{.git}
+ rescue Thor::Error => e
+ puts e.message.colorize(:red)
+ exit 1
+ end
end
def set_source_paths(*paths)
@@ -54,15 +59,18 @@ class Jets::Commands::Import
# normalize repo_url
def repo_url
- if @source.include?('github.com')
+ if repo?
@source # leave as is, user has provided full github url
else
+ # Defaults to GitHub
"https://github.com/#{@source}"
end
end
def repo?
- @source.include?('github.com')
+ @source.include?('github.com') ||
+ @source.include?('bitbucket.org') ||
+ @source.include?('gitlab.com')
end
def check_git_installed | add import support for bitbucket and gitlab also | tongueroo_jets | train | rb |
017715b4218639c8d383c6fed542bbb428f5f596 | diff --git a/test/delocalize_test.rb b/test/delocalize_test.rb
index <HASH>..<HASH> 100644
--- a/test/delocalize_test.rb
+++ b/test/delocalize_test.rb
@@ -63,7 +63,7 @@ class DelocalizeActiveRecordTest < ActiveSupport::TestCase
end
test "delocalizes with fallback locale" do
- I18n::Backend::Simple.include(I18n::Backend::Fallbacks)
+ I18n::Backend::Simple.send(:include, I18n::Backend::Fallbacks)
I18n.fallbacks[:xx] = [:xx, :tt]
I18n.with_locale :xx do | Fix for include being private with older Ruby/Rails versions | clemens_delocalize | train | rb |
26d2d20f959b782008204b81c1dfda40a6314053 | diff --git a/lib/rbbt/entity.rb b/lib/rbbt/entity.rb
index <HASH>..<HASH> 100644
--- a/lib/rbbt/entity.rb
+++ b/lib/rbbt/entity.rb
@@ -164,7 +164,9 @@ module Entity
define_method single_name, &block
define_method name do |*args|
if Array === self
- self.collect{|e| e.send(single_name, *args)}
+ res = self.collect{|e| e.send(single_name, *args)}
+ res.first.annotate(res) if Annotated === res.first && type == :single2array
+ res
else
self.send(single_name, *args)
end | If single property called as :single2array then annotate array as well | mikisvaz_rbbt-util | train | rb |
192c7c5ed9fddd895deb4d5dd5a52e4ba80cb09b | diff --git a/Gruntfile.js b/Gruntfile.js
index <HASH>..<HASH> 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -122,6 +122,14 @@ module.exports = function ( grunt ) {
},
css: {
files: concatCssFiles
+ },
+ demoCss: {
+ options: {
+ banner: '/** This file is generated automatically. Do not modify it. */\n\n'
+ },
+ files: {
+ 'demos/styles/demo.rtl.css': 'demos/styles/demo.rtl.css'
+ }
}
},
@@ -358,7 +366,7 @@ module.exports = function ( grunt ) {
grunt.registerTask( 'build-styling', [
'colorizeSvg', 'less', 'copy:imagesCommon',
'copy:imagesApex', 'copy:imagesMediaWiki', 'svg2png',
- 'concat:css', 'cssjanus', 'csscomb', 'cssmin'
+ 'concat:css', 'cssjanus', 'concat:demoCss', 'csscomb', 'cssmin'
] );
grunt.registerTask( 'build-i18n', [ 'copy:i18n' ] );
grunt.registerTask( 'build-tests', [ 'exec:rubyTestSuiteGenerator', 'exec:phpGenerateJSPHPForKarma' ] ); | build: Add a 'generated automatically' banner to demo.rtl.css
I have accidentally changed that file way more times that it is healthy.
Change-Id: I<I>d4c<I>a<I>e<I>d<I>b<I>f5afd<I>f0ce | wikimedia_oojs-ui | train | js |
d825f407c6e9f9981277653e5a8d737fe2278466 | diff --git a/src/AcMailer/Service/MailService.php b/src/AcMailer/Service/MailService.php
index <HASH>..<HASH> 100644
--- a/src/AcMailer/Service/MailService.php
+++ b/src/AcMailer/Service/MailService.php
@@ -125,6 +125,8 @@ class MailService implements MailServiceInterface, EventManagerAwareInterface, M
// Trigger send error event
$event = new MailEvent($this, MailEvent::EVENT_MAIL_SEND_ERROR);
$this->getEventManager()->trigger($event);
+
+ throw $e;
}
} | fixes #<I> When an exception other than RuntimeException is produced when sending the email, ERROR_SEND events are thiggered and that exception is rethrown | acelaya_ZF-AcMailer | train | php |
5d719ef8320ee5e92601d0a771afae8f26ceded1 | diff --git a/adl-parser/src/main/java/org/openehr/adl/util/AdlUtils.java b/adl-parser/src/main/java/org/openehr/adl/util/AdlUtils.java
index <HASH>..<HASH> 100644
--- a/adl-parser/src/main/java/org/openehr/adl/util/AdlUtils.java
+++ b/adl-parser/src/main/java/org/openehr/adl/util/AdlUtils.java
@@ -93,6 +93,12 @@ public class AdlUtils {
return makeClone(result);
}
+ public static DifferentialArchetype createDifferentialArchetypeClone(FlatArchetype source) {
+ DifferentialArchetype result = new DifferentialArchetype();
+ fillArchetypeFields(result, source);
+ return makeClone(result);
+ }
+
public static Template createTemplateClone(FlatArchetype source) {
Template result = new Template();
fillArchetypeFields(result, source);
@@ -101,7 +107,7 @@ public class AdlUtils {
}
- private static void fillArchetypeFields(FlatArchetype target, Archetype source) {
+ private static void fillArchetypeFields(Archetype target, Archetype source) {
target.setDefinition(source.getDefinition());
target.setIsControlled(source.isIsControlled());
target.setArchetypeId(source.getArchetypeId()); | Added ability to create differential clone | openEHR_adl2-core | train | java |
aed248610c844e9669fa8501af7495b0a8ab40a0 | diff --git a/pdfminer/ccitt.py b/pdfminer/ccitt.py
index <HASH>..<HASH> 100644
--- a/pdfminer/ccitt.py
+++ b/pdfminer/ccitt.py
@@ -723,12 +723,12 @@ def ccittfaxdecode(data, params):
# test
def main(argv):
- import pygame
if not argv[1:]:
return unittest.main()
class Parser(CCITTG4Parser):
def __init__(self, width, bytealign=False):
+ import pygame
CCITTG4Parser.__init__(self, width, bytealign=bytealign)
self.img = pygame.Surface((self.width, 1000))
return
@@ -742,6 +742,7 @@ def main(argv):
return
def close(self):
+ import pygame
pygame.image.save(self.img, 'out.bmp')
return
for path in argv[1:]: | Fixed: dependency on pygame in a unittest. | euske_pdfminer | train | py |
f17c2c91194f3b5b39c9e34cf88aa849b1a499f9 | diff --git a/sip-servlets-impl/src/main/java/org/mobicents/servlet/sip/core/dispatchers/MessageDispatcher.java b/sip-servlets-impl/src/main/java/org/mobicents/servlet/sip/core/dispatchers/MessageDispatcher.java
index <HASH>..<HASH> 100644
--- a/sip-servlets-impl/src/main/java/org/mobicents/servlet/sip/core/dispatchers/MessageDispatcher.java
+++ b/sip-servlets-impl/src/main/java/org/mobicents/servlet/sip/core/dispatchers/MessageDispatcher.java
@@ -411,7 +411,8 @@ public abstract class MessageDispatcher {
}
}
- request.setSipSession(null);
+ // Issue #101 Trying to avoid setting the session to null so it can be retrieved
+// request.setSipSession(null);
}
} | Issue #<I> trying to avoid nullifying the session | RestComm_sip-servlets | train | java |
7cb000b645842ddbcde15b5833c9efc98b14472c | diff --git a/src/test/java/com/github/jmchilton/blend4j/galaxy/SearchTest.java b/src/test/java/com/github/jmchilton/blend4j/galaxy/SearchTest.java
index <HASH>..<HASH> 100644
--- a/src/test/java/com/github/jmchilton/blend4j/galaxy/SearchTest.java
+++ b/src/test/java/com/github/jmchilton/blend4j/galaxy/SearchTest.java
@@ -26,6 +26,7 @@ public class SearchTest {
client = instance.getSearchClient();
}
+ /* // Time dependent test that fails intermittently.
@Test
public void testListJobs() throws InterruptedException {
final String historyId = TestHelpers.getTestHistoryId(instance);
@@ -39,6 +40,7 @@ public class SearchTest {
final Map<String, Object> failedJob = response.getResults().get(0);
TestHelpers.waitForHistory(instance.getHistoriesClient(), historyId);
}
+ */
@Test
public void testLdda() throws InterruptedException { | Comment out poor test (too timing dependent). | galaxyproject_blend4j | train | java |
a3f2eaf2edc01cf2bf385af484eb96f083f058b6 | diff --git a/client/lanes/models/query/array-result.js b/client/lanes/models/query/array-result.js
index <HASH>..<HASH> 100644
--- a/client/lanes/models/query/array-result.js
+++ b/client/lanes/models/query/array-result.js
@@ -76,7 +76,7 @@ export default class ArrayResult extends Result {
if (model[f.id]) { row[f.dataIndex] = model[f.id]; }
});
this.rowUpdateCount += 1;
- });
+ }, 99);
}
});
return model; | save from model to array last after other's completed
To allow the asset save to also complete | argosity_hippo | train | js |
9fa77509328a2cbf6a1474ae86759c8a9c32fe35 | diff --git a/models/Queue.php b/models/Queue.php
index <HASH>..<HASH> 100644
--- a/models/Queue.php
+++ b/models/Queue.php
@@ -10,15 +10,7 @@ use nterms\mailqueue\Message;
/**
* This is the model class for table "{{%mail_queue}}".
*
- * @property string $from
- * @property string $to
- * @property string $cc
- * @property string $bcc
* @property string $subject
- * @property string $html_body
- * @property string $text_body
- * @property string $reply_to
- * @property string $charset
* @property integer $created_at
* @property integer $attempts
* @property integer $last_attempt_time
@@ -61,7 +53,7 @@ class Queue extends ActiveRecord
return [
[['created_at', 'attempts', 'last_attempt_time', 'sent_time'], 'integer'],
[['time_to_send', 'swift_message'], 'required'],
- [['to', 'cc', 'bcc', 'subject', 'html_body', 'text_body', 'charset'], 'safe'],
+ [['subject'], 'safe'],
];
} | Removed obsolete fields
Fields from, to, cc, bcc, html_body, text_body, reply_to and charset are not used anymore.
Subject field is kept for informational purpose. | nterms_yii2-mailqueue | train | php |
dec01b7c4bcf8b40c57f1c99aad8d50b68a51ad0 | diff --git a/CachedImage.js b/CachedImage.js
index <HASH>..<HASH> 100644
--- a/CachedImage.js
+++ b/CachedImage.js
@@ -38,12 +38,16 @@ const CachedImage = React.createClass({
getDefaultProps() {
return {
- renderImage: props => (<Image {...props}/>),
+ renderImage: props => (<Image ref={this.refName} {...props}/>),
activityIndicatorProps: {},
useQueryParamsInCacheKey: false
};
},
+ setNativeProps(nativeProps) {
+ this.refs[this.refName].setNativeProps(nativeProps);
+ },
+
getInitialState() {
this._isMounted = false;
return {
@@ -61,6 +65,8 @@ const CachedImage = React.createClass({
},
componentWillMount() {
+ const rand = Math.floor(Math.random() * 1000000);
+ this.refName = 'cachedImage'+rand;
this._isMounted = true;
NetInfo.isConnected.addEventListener('change', this.handleConnectivityChange);
// initial | Implemented setNativeProps() to support nesting <CachedImage/> component in TouchableOpacity | kfiroo_react-native-cached-image | train | js |
f4c82d62849f27e1ddc6792ef39fe4f4059bcadb | diff --git a/erizo_controller/erizoController/roomController.js b/erizo_controller/erizoController/roomController.js
index <HASH>..<HASH> 100644
--- a/erizo_controller/erizoController/roomController.js
+++ b/erizo_controller/erizoController/roomController.js
@@ -72,16 +72,19 @@ exports.RoomController = function (spec) {
if (publishers[publisher_id] !== undefined) {
logger.info("Adding ExternalOutput to " + publisher_id + " url " + url);
- var args = [publisher_id, url];
+ createErizoJS(publisher_id, function() {
- rpc.callRpc("ErizoJS_" + publisher_id, "addExternalOutput", args, undefined);
+ var args = [publisher_id, url];
- // Track external outputs
- externalOutputs[url] = publisher_id;
+ rpc.callRpc("ErizoJS_" + publisher_id, "addExternalOutput", args, undefined);
- // Track publisher locally
- publishers[publisher_id] = publisher_id;
- subscribers[publisher_id] = [];
+ // Track external outputs
+ externalOutputs[url] = publisher_id;
+
+ // Track publisher locally
+ publishers[publisher_id] = publisher_id;
+ subscribers[publisher_id] = [];
+ });
}
}; | Resolved a bug when adding External Input | lynckia_licode | train | js |
8997c28f780b2adc9a2a82cca5d19cecf79ebb8e | diff --git a/lib/has_constant/orm/mongoid.rb b/lib/has_constant/orm/mongoid.rb
index <HASH>..<HASH> 100644
--- a/lib/has_constant/orm/mongoid.rb
+++ b/lib/has_constant/orm/mongoid.rb
@@ -32,7 +32,7 @@ module HasConstant
if val.instance_of?(String)
if index = self.class.send(name.to_s).index(val)
write_attribute singular.to_sym, index
- else
+ elsif !val.blank?
values = values.call if values.respond_to?(:call)
@has_constant_errors ||= {}
@has_constant_errors.merge!(singular.to_sym => "must be one of #{values.join(', ')}")
diff --git a/test/unit/orm/mongoid_test.rb b/test/unit/orm/mongoid_test.rb
index <HASH>..<HASH> 100644
--- a/test/unit/orm/mongoid_test.rb
+++ b/test/unit/orm/mongoid_test.rb
@@ -42,6 +42,11 @@ class MongoidTest < Test::Unit::TestCase
assert !m.valid?
assert_equal ['must be one of Mr, Mrs'], m.errors[:salutation]
end
+
+ should 'be valid when a blank value is supplied' do
+ m = MongoUserWithProc.new(:salutation => '')
+ assert m.valid?
+ end
end
context 'Named Scopes' do | fixed bug where errors where added when a blank value was supplied to setter | mattbeedle_has_constant | train | rb,rb |
94d1f151078da7d508aa3fcbf070fa363342e19f | diff --git a/lib/active_hash/base.rb b/lib/active_hash/base.rb
index <HASH>..<HASH> 100644
--- a/lib/active_hash/base.rb
+++ b/lib/active_hash/base.rb
@@ -183,6 +183,8 @@ module ActiveHash
nil
when :all
all
+ when :first
+ all(*args).first
when Array
id.map { |i| find(i) }
else
diff --git a/spec/active_hash/base_spec.rb b/spec/active_hash/base_spec.rb
index <HASH>..<HASH> 100644
--- a/spec/active_hash/base_spec.rb
+++ b/spec/active_hash/base_spec.rb
@@ -316,6 +316,20 @@ describe ActiveHash, "Base" do
end
end
+ context "with :first" do
+ it "returns the first record" do
+ Country.find(:first).should == Country.new(:id => 1)
+ end
+
+ it "returns the first record that matches the search criteria" do
+ Country.find(:first, :conditions => {:id => 2}).should == Country.new(:id => 2)
+ end
+
+ it "returns nil if none matches the search criteria" do
+ Country.find(:first, :conditions => {:id => 3}).should == nil
+ end
+ end
+
context "with 2 arguments" do
it "returns the record with the given id and ignores the conditions" do
Country.find(1, :conditions => "foo=bar").should == Country.new(:id => 1) | support for find(:first, ...) | zilkey_active_hash | train | rb,rb |
28f046e9d66fc6be5980ba51ec0db0703f72a037 | diff --git a/lib/crags.rb b/lib/crags.rb
index <HASH>..<HASH> 100644
--- a/lib/crags.rb
+++ b/lib/crags.rb
@@ -1,6 +1,7 @@
require 'rubygems'
require 'curb'
require 'hpricot'
+require "erb"
module Crags
VERSION = '1.2.6'
diff --git a/lib/crags/searcher.rb b/lib/crags/searcher.rb
index <HASH>..<HASH> 100644
--- a/lib/crags/searcher.rb
+++ b/lib/crags/searcher.rb
@@ -1,6 +1,7 @@
module Crags
module Searcher
include Fetch
+ include ERB::Util
def strip_http(url)
url.gsub(/http\:\/\/(.*)(\/|(.html))/,'\1\3')
@@ -49,7 +50,7 @@ module Crags
end
def search_location_link(keyword, loc, category = 'sss')
- "http://#{loc}/search/#{category}?query=#{keyword}"
+ "http://#{loc}/search/#{category}?query=#{url_encode(keyword)}"
end
def search_location(keyword, loc, category = 'sss', &block) | added url_encoding to keyword in search urls | gotascii_crags | train | rb,rb |
07f7b5b8811b9fb0e284a93fb1fcacb76bda9e69 | diff --git a/mapsforge-map/src/main/java/org/mapsforge/map/rendertheme/XmlUtils.java b/mapsforge-map/src/main/java/org/mapsforge/map/rendertheme/XmlUtils.java
index <HASH>..<HASH> 100644
--- a/mapsforge-map/src/main/java/org/mapsforge/map/rendertheme/XmlUtils.java
+++ b/mapsforge-map/src/main/java/org/mapsforge/map/rendertheme/XmlUtils.java
@@ -135,7 +135,13 @@ public final class XmlUtils {
} else if (src.startsWith(PREFIX_FILE)) {
File file = getFile(relativePathPrefix, src.substring(PREFIX_FILE.length()));
if (!file.exists()) {
- throw new FileNotFoundException("file does not exist: " + file.getAbsolutePath());
+ final String pathName = src.substring(PREFIX_FILE.length());
+ if (pathName.length() > 0 && pathName.charAt(0) == File.separatorChar) {
+ file = getFile(relativePathPrefix, pathName.substring(1));
+ }
+ if (!file.exists()) {
+ throw new FileNotFoundException("file does not exist: " + file.getAbsolutePath());
+ }
} else if (!file.isFile()) {
throw new FileNotFoundException("not a file: " + file.getAbsolutePath());
} else if (!file.canRead()) { | RenderTheme: absolute paths resolved to relative path | mapsforge_mapsforge | train | java |
3d8a516d1c63a984bd5c6f184e7af28154bc34e6 | diff --git a/lib/svtplay_dl/fetcher/dash.py b/lib/svtplay_dl/fetcher/dash.py
index <HASH>..<HASH> 100644
--- a/lib/svtplay_dl/fetcher/dash.py
+++ b/lib/svtplay_dl/fetcher/dash.py
@@ -76,6 +76,7 @@ def parsesegments(content, url):
init = vinit.attrib["initialization"]
nrofvideos = content[0].findall(".//{urn:mpeg:dash:schema:mpd:2011}S[@r]")
selemtns = content[0].findall(".//{urn:mpeg:dash:schema:mpd:2011}S")
+ total = 0
if nrofvideos:
total = int(nrofvideos[0].attrib["r"]) + len(selemtns) + 1
time = False | dash: don't crash if we get a total files.
fixes #<I> | spaam_svtplay-dl | train | py |
fdc7cd181ee162982b2e4a2d89d9e8b1c129e6b9 | diff --git a/lib/restforce/collection.rb b/lib/restforce/collection.rb
index <HASH>..<HASH> 100644
--- a/lib/restforce/collection.rb
+++ b/lib/restforce/collection.rb
@@ -32,6 +32,12 @@ module Restforce
@raw_page['totalSize']
end
alias length size
+
+ def count
+ return size unless block_given?
+
+ super
+ end
# Returns true if the size of the Collection is zero.
def empty? | Add fast path for block-less Restforce::Collection#count | restforce_restforce | train | rb |
5727d6afff5e868282f22963aaa5f16a7f11b1e8 | diff --git a/webpack.config.js b/webpack.config.js
index <HASH>..<HASH> 100644
--- a/webpack.config.js
+++ b/webpack.config.js
@@ -26,7 +26,7 @@ module.exports = ( env ) => {
// The point or points to enter the application.
entry: env.element ? {
'main': `./packages/${ env.element }/${ capitalize( env.element ) }.tsx`,
- 'main.demo': `./packages/${ env.element }/${ capitalize( env.element ) }.demo.tsx`,
+ 'main.demo': `./packages/${ env.element }/index.demo.tsx`,
'vendors': './vendors.ts',
'polyfills': './polyfills.ts',
'styles': './styles.ts' | chore(webpack): fix demo component config (#<I>) | wc-catalogue_blaze-elements | train | js |
8282f30200b49534f5f9ecd50e417c39b9a5ba88 | diff --git a/spec/unit/daemon/apns/delivery_spec.rb b/spec/unit/daemon/apns/delivery_spec.rb
index <HASH>..<HASH> 100644
--- a/spec/unit/daemon/apns/delivery_spec.rb
+++ b/spec/unit/daemon/apns/delivery_spec.rb
@@ -95,9 +95,14 @@ describe Rapns::Daemon::Apns::Delivery do
end
it "logs the delivery error" do
- error = Rapns::DeliveryError.new(4, 12, "Missing payload")
- Rapns::DeliveryError.stub(:new => error)
- expect { delivery.perform }.to raise_error(error)
+ # checking for the stubbed error doesn't work in jruby, but checking
+ # for the exception by class does.
+
+ #error = Rapns::DeliveryError.new(4, 12, "Missing payload")
+ #Rapns::DeliveryError.stub(:new => error)
+ #expect { delivery.perform }.to raise_error(error)
+
+ expect { delivery.perform }.to raise_error(Rapns::DeliveryError)
end
it "sets the notification error description" do | Fix test that fails in JRuby | rpush_rpush | train | rb |
8d2c7045a4252ab797cc6b49d55ec3298fec1538 | diff --git a/PHPCI/Languages/lang.ru.php b/PHPCI/Languages/lang.ru.php
index <HASH>..<HASH> 100644
--- a/PHPCI/Languages/lang.ru.php
+++ b/PHPCI/Languages/lang.ru.php
@@ -84,7 +84,7 @@ PHPCI',
'success' => 'Успешно',
'successful' => 'Успешна',
'failed' => 'Провалена',
- 'manual_build' => 'Ручной сборки',
+ 'manual_build' => 'Запущена вручную',
// Add/Edit Project:
'new_project' => 'Новый проект', | Update the "Manual Build" string for the Russian translation.
Closes #<I> | dancryer_PHPCI | train | php |
a327bbe205e2d1299dd7eaf28cf89146c5868ff9 | diff --git a/widget_tweaks/templatetags/widget_tweaks.py b/widget_tweaks/templatetags/widget_tweaks.py
index <HASH>..<HASH> 100644
--- a/widget_tweaks/templatetags/widget_tweaks.py
+++ b/widget_tweaks/templatetags/widget_tweaks.py
@@ -184,4 +184,4 @@ class FieldAttributeNode(Node):
bounded_field = set_attr(bounded_field, '%s:%s' % (k,v.resolve(context)))
for k, v in self.append_attrs:
bounded_field = append_attr(bounded_field, '%s:%s' % (k,v.resolve(context)))
- return bounded_field
+ return str(bounded_field) | Always cast the result of render to a string
Fixes incompatibility with django >= <I> | jazzband_django-widget-tweaks | train | py |
686886383967e424842f083d2c79dbaaf60c8424 | diff --git a/botstory/integrations/fb/validate.py b/botstory/integrations/fb/validate.py
index <HASH>..<HASH> 100644
--- a/botstory/integrations/fb/validate.py
+++ b/botstory/integrations/fb/validate.py
@@ -42,8 +42,8 @@ def send_text_message(text, options):
:param options:
:return:
"""
- if len(text) > 320:
- raise Invalid('send message text should not exceed 320 character limit')
+ if len(text) > 640:
+ raise Invalid('send message text should not exceed 640 character limit')
if isinstance(options, list):
if len(options) > 10:
diff --git a/botstory/integrations/fb/validate_test.py b/botstory/integrations/fb/validate_test.py
index <HASH>..<HASH> 100644
--- a/botstory/integrations/fb/validate_test.py
+++ b/botstory/integrations/fb/validate_test.py
@@ -68,7 +68,7 @@ async def test_validate_persistent_menu(mocker, menu, invalid_message):
@pytest.mark.parametrize('text,options,invalid_message', [
('hi there!', None, False),
- ('very long message ' * 20, None, 'send message text should not exceed 320 character limit'),
+ ('very long message ' * 40, None, 'send message text should not exceed 640 character limit'),
('short message', [{
'content_type': 'text', | double text limit from <I> to <I> | botstory_botstory | train | py,py |
428d32cebdddf95f1d3a6d0d3e7e930e60c8b0c5 | diff --git a/src/Console/ModelsCommand.php b/src/Console/ModelsCommand.php
index <HASH>..<HASH> 100644
--- a/src/Console/ModelsCommand.php
+++ b/src/Console/ModelsCommand.php
@@ -473,6 +473,7 @@ class ModelsCommand extends Command
foreach (array(
'hasMany' => '\Illuminate\Database\Eloquent\Relations\HasMany',
'hasManyThrough' => '\Illuminate\Database\Eloquent\Relations\HasManyThrough',
+ 'hasOneThrough' => '\Illuminate\Database\Eloquent\Relations\HasOneThrough',
'belongsToMany' => '\Illuminate\Database\Eloquent\Relations\BelongsToMany',
'hasOne' => '\Illuminate\Database\Eloquent\Relations\HasOne',
'belongsTo' => '\Illuminate\Database\Eloquent\Relations\BelongsTo', | Add hasOneThrough to ide-helper:models (#<I>)
Added missing relation type. | barryvdh_laravel-ide-helper | train | php |
970363aa52f09130017e0c4112cca12283b14199 | diff --git a/lib/rakuten_web_service/search_result.rb b/lib/rakuten_web_service/search_result.rb
index <HASH>..<HASH> 100644
--- a/lib/rakuten_web_service/search_result.rb
+++ b/lib/rakuten_web_service/search_result.rb
@@ -18,7 +18,7 @@ module RakutenWebService
end
break unless has_next_page?
- response = query(params.merge('page' => response.body['page'] + 1))
+ response = query(params_to_get_next_page)
end while(response)
end
@@ -31,6 +31,10 @@ module RakutenWebService
@response.body['page'] && @response.body['page'] < @response.body['pageCount']
end
+ def params_to_get_next_page
+ @params.merge('page' => @response.body['page'] + 1)
+ end
+
def order(options)
new_params = @params.dup
if options.is_a? Hash | SearchResult#params_to_next_page creates params to get the next page | rakuten-ws_rws-ruby-sdk | train | rb |
fa7e71751abd565bc480c24e19199114cda253d5 | diff --git a/src/mako/http/Request.php b/src/mako/http/Request.php
index <HASH>..<HASH> 100644
--- a/src/mako/http/Request.php
+++ b/src/mako/http/Request.php
@@ -433,7 +433,7 @@ class Request
// Is PHP running as a CGI program?
- $this->isCGI = stripos(PHP_SAPI, 'cgi') !== false;
+ $this->isCGI = strpos(PHP_SAPI, 'cgi') !== false;
// Get the real request method that was used | PHP_SAPI is always lower case | mako-framework_framework | train | php |
012aa80afbeeb30b7d522c6a3b2bf8475c3f694d | diff --git a/normandy/selfrepair/static/js/normandy_driver.js b/normandy/selfrepair/static/js/normandy_driver.js
index <HASH>..<HASH> 100644
--- a/normandy/selfrepair/static/js/normandy_driver.js
+++ b/normandy/selfrepair/static/js/normandy_driver.js
@@ -124,8 +124,11 @@ let Normandy = {
} else {
return fetch('https://input.mozilla.org/api/v2/hb/', {
method: 'POST',
- data: data,
- headers: {Accept: 'application/json'},
+ body: JSON.stringify(data),
+ headers: {
+ Accept: 'application/json',
+ 'Content-Type': 'application/json'
+ }
})
.then(response => response.json())
.then(heartbeatFlow => heartbeatFlow); | Update post request to send JSON.stringified body | mozilla_normandy | train | js |
06903dadebfca12360e9d49926744b8f49f9c393 | diff --git a/lib/redbooth-ruby/version.rb b/lib/redbooth-ruby/version.rb
index <HASH>..<HASH> 100644
--- a/lib/redbooth-ruby/version.rb
+++ b/lib/redbooth-ruby/version.rb
@@ -1,3 +1,3 @@
module RedboothRuby
- VERSION = '0.1.2'
+ VERSION = '0.1.3'
end | Bumped version to <I>. | redbooth_redbooth-ruby | train | rb |
3485a7e0bc43756978f379e748904547b7f95496 | diff --git a/src/Formatter/JUnitFormatter.php b/src/Formatter/JUnitFormatter.php
index <HASH>..<HASH> 100644
--- a/src/Formatter/JUnitFormatter.php
+++ b/src/Formatter/JUnitFormatter.php
@@ -243,7 +243,15 @@ class JUnitFormatter implements Formatter
$code = $event->getTestResult()->getResultCode();
if(TestResult::FAILED === $code) {
if ($event->getTestResult()->hasException()) {
- $failureNode = $this->currentTestcase->addChild('failure', $event->getStep()->getKeyword() . " " . htmlentities($event->getStep()->getText()) . ":\n\n" . htmlentities($event->getTestResult()->getException()->getMessage()));
+ $failureNode = $this->currentTestcase->addChild('failure');
+
+ $failureText = $event->getStep()->getKeyword() . " " . $event->getStep()->getText() . ":\n\n" . $event->getTestResult()->getException()->getMessage();
+
+ // add cdata
+ $node = dom_import_simplexml($failureNode);
+ $no = $node->ownerDocument;
+ $node->appendChild($no->createCDATASection($failureText));
+
$failureNode->addAttribute('type', \get_class($event->getTestResult()->getException()));
}
} | Converted failure text to be in CDATA instead of sanitizing with htmlentities() | j-arnaiz_behat-junit-formatter | train | php |
82b1bf504c2b5846483c21ff89db1687f37159d6 | diff --git a/respite/urls/resource.py b/respite/urls/resource.py
index <HASH>..<HASH> 100644
--- a/respite/urls/resource.py
+++ b/respite/urls/resource.py
@@ -1,7 +1,10 @@
from copy import deepcopy
+import django
+
from django.conf.urls.defaults import *
from django.http import HttpResponse
+from django.utils.translation import ugettext_lazy
from respite.inflector import pluralize, cc2us
@@ -118,6 +121,9 @@ def resource(views, routes, prefix=''):
kwargs[sibling.method] = sibling.view
routes.remove(sibling)
+ if django.VERSION[0:2] == (1, 4):
+ route.regex = ugettext_lazy(route.regex)
+
urls.append(
url(
regex = route.regex,
diff --git a/tests/project/app/urls.py b/tests/project/app/urls.py
index <HASH>..<HASH> 100644
--- a/tests/project/app/urls.py
+++ b/tests/project/app/urls.py
@@ -5,7 +5,7 @@ from respite.urls import resource
from .views import ArticleViews
urlpatterns = resource(
- prefix = _('articles/'),
+ prefix = 'articles/',
views = ArticleViews,
routes = ArticleViews.routes + [
ArticleViews.preview.route | Localize patterns for Django <I>+ | jgorset_django-respite | train | py,py |
d2de9a16b61e786ae145a47d82abcd5b86b3e7ea | diff --git a/internal/provider/resource_password.go b/internal/provider/resource_password.go
index <HASH>..<HASH> 100644
--- a/internal/provider/resource_password.go
+++ b/internal/provider/resource_password.go
@@ -69,6 +69,10 @@ func resourcePasswordV0() *schema.Resource {
}
func resourcePasswordStateUpgradeV0(_ context.Context, rawState map[string]interface{}, _ interface{}) (map[string]interface{}, error) {
+ if rawState == nil {
+ return nil, fmt.Errorf("resource password state upgrade failed, state is nil")
+ }
+
result, ok := rawState["result"].(string)
if !ok {
return nil, fmt.Errorf("resource password state upgrade failed, result could not be asserted as string: %T", rawState["result"]) | Adding check for rawState being nil | terraform-providers_terraform-provider-random | train | go |
e2d5e48dffcbe3980942d6486d2e6689ffc0091e | diff --git a/Template.py b/Template.py
index <HASH>..<HASH> 100755
--- a/Template.py
+++ b/Template.py
@@ -18,7 +18,8 @@ import sys
import DataStore
from TimeZone import Local, utc
-from WeatherStation import pressure_trend_text, wind_dir_text, dew_point
+from WeatherStation import (
+ pressure_trend_text, wind_dir_text, dew_point, apparent_temp)
def Template(raw_data, hourly_data, daily_data, monthly_data,
template_file, output_file):
diff --git a/WeatherStation.py b/WeatherStation.py
index <HASH>..<HASH> 100755
--- a/WeatherStation.py
+++ b/WeatherStation.py
@@ -20,6 +20,13 @@ def dew_point(temp, hum):
gamma = ((a * temp) / (b + temp)) + math.log(float(hum) / 100.0)
return (b * gamma) / (a - gamma)
+def apparent_temp(temp, rh, wind):
+ """Compute apparent temperature (real feel), using formula from
+ http://www.bom.gov.au/info/thermal_stress/"""
+ vap_press = (float(rh) / 100.0) * 6.105 * math.exp(
+ 17.27 * temp / (237.7 + temp))
+ return temp + (0.33 * vap_press) - (0.70 * wind) - 4.00
+
# convert wind direction integer to string
wind_dir_text = [
_('N'), _('NNE'), _('NE'), _('ENE'), | Added 'apparent_temp' function - a sort of wind chill measure. | jim-easterbrook_pywws | train | py,py |
6c08ea2cb373a18f42bb788f787504db25a25f94 | diff --git a/lib/controllers/object.js b/lib/controllers/object.js
index <HASH>..<HASH> 100644
--- a/lib/controllers/object.js
+++ b/lib/controllers/object.js
@@ -388,6 +388,9 @@ exports.putObjectCopy = async function putObjectCopy(ctx) {
* This implementation of the PUT operation uses the tagging subresource to add a set of tags
* to an existing object.
* {@link https://docs.aws.amazon.com/AmazonS3/latest/API/RESTObjectPUTtagging.html}
+ *
+ * @param {Koa.Context} ctx
+ * @returns {Promise<void>}
*/
exports.putObjectTagging = async function putObject(ctx) {
const key = ctx.params.key;
diff --git a/lib/utils.js b/lib/utils.js
index <HASH>..<HASH> 100644
--- a/lib/utils.js
+++ b/lib/utils.js
@@ -124,8 +124,8 @@ exports.toISO8601String = function(date) {
/**
* Reads a request body stream to a string.
*
- * @param ctx
- * @returns {Promise<string>}
+ * @param {Koa.Context} ctx
+ * @returns {Promise<void>}
*/
exports.utf8BodyParser = async function(ctx) {
const { req } = ctx; | Update jsdoc types for tagging methods | jamhall_s3rver | train | js,js |
a8489019c426eb609bcf5e6338e7beea53888f50 | diff --git a/metpy/gridding/gridding_functions.py b/metpy/gridding/gridding_functions.py
index <HASH>..<HASH> 100644
--- a/metpy/gridding/gridding_functions.py
+++ b/metpy/gridding/gridding_functions.py
@@ -134,7 +134,7 @@ def remove_repeat_coordinates(x, y, z):
@exporter.export
def interpolate(x, y, z, interp_type='linear', hres=50000,
- buffer=1, minimum_neighbors=3, gamma=0.25,
+ buffer=0, minimum_neighbors=3, gamma=0.25,
kappa_star=5.052, search_radius=None, rbf_func='linear', rbf_smooth=0):
r"""Interpolate given (x,y), observation (z) pairs to a grid based on given parameters.
@@ -154,7 +154,7 @@ def interpolate(x, y, z, interp_type='linear', hres=50000,
hres: float
The horizontal resolution of the generated grid. Default 50000 meters.
buffer: float
- How many meters to add to the bounds of the grid. Default 1 meters.
+ How many meters to add to the bounds of the grid. Default 0 meters.
minimum_neighbors: int
Minimum number of neighbors needed to perform barnes or cressman interpolation for a
point. Default is 3. | Change default grid buffer to 0
Adding 1 to each edge breaks several tests. | Unidata_MetPy | train | py |
6370430e984c04813902c67c3101482f1ed79320 | diff --git a/uptick/vesting.py b/uptick/vesting.py
index <HASH>..<HASH> 100644
--- a/uptick/vesting.py
+++ b/uptick/vesting.py
@@ -53,3 +53,21 @@ def claim(ctx, vestingid, account, amount):
amount=amount,
account=vesting["owner"]
))
+
+
[email protected]()
[email protected]("--account", default=None)
[email protected](
+ "amount",
+ type=float
+)
[email protected](
+ "symbol",
+ type=str
+)
[email protected]_context
+@online
+@unlock
+def reserve(ctx, amount, symbol, account):
+ pprint(ctx.bitshares.reserve(
+ Amount(amount, symbol, bitshares_instance=ctx.bitshares))) | [reserve] allow to reserve asset | bitshares_uptick | train | py |
93716d321f2d73c9522870bcf64d509bc74da7c9 | diff --git a/hpcbench/campaign.py b/hpcbench/campaign.py
index <HASH>..<HASH> 100644
--- a/hpcbench/campaign.py
+++ b/hpcbench/campaign.py
@@ -25,11 +25,12 @@ def fill_default_campaign_values(campaign):
:rtype: dictionary
"""
default_campaign = dict(
- output_dir="benchmark-%Y%m%d-%H:%M:%S"
+ output_dir="hpcbench-%Y%m%d-%H:%M:%S"
)
for key, value in default_campaign.items():
campaign.setdefault(key, value)
campaign.setdefault('network', {})
+ campaign['network'].setdefault('nodes', ['localhost'])
campaign.network.setdefault('tags', {})
campaign.benchmarks.setdefault('*', {})
for tag in list(campaign.network.tags): | network section in campaign YAML file is now optional | BlueBrain_hpcbench | train | py |
bc7ee97c70b4c39c4cb7aae2ccf76fb71b7bc19f | diff --git a/tensorlayer/models/vgg.py b/tensorlayer/models/vgg.py
index <HASH>..<HASH> 100644
--- a/tensorlayer/models/vgg.py
+++ b/tensorlayer/models/vgg.py
@@ -82,7 +82,7 @@ mapped_cfg = {
model_urls = {
'vgg16': 'http://www.cs.toronto.edu/~frossard/vgg16/',
- 'vgg19': 'https://media.githubusercontent.com/media/tensorlayer/pretrained-models/master/models/'
+ 'vgg19': 'https://github.com/tensorlayer/pretrained-models/blob/master/models/vgg19.npy'
}
model_saved_name = {'vgg16': 'vgg16_weights.npz', 'vgg19': 'vgg19.npy'} | Update vgg.py (#<I>) | tensorlayer_tensorlayer | train | py |
a5833d41a0736107d97f838ebc901733ca4e5741 | diff --git a/lib/miro/dominant_colors.rb b/lib/miro/dominant_colors.rb
index <HASH>..<HASH> 100644
--- a/lib/miro/dominant_colors.rb
+++ b/lib/miro/dominant_colors.rb
@@ -60,7 +60,7 @@ module Miro
tempfile = Tempfile.open(["source", ".#{original_extension}"])
remote_file_data = open(@src_image_path).read
- tempfile.write(RUBY_VERSION =~ /1.9/ ? remote_file_data.force_encoding("UTF-8") : remote_file_data)
+ tempfile.write(should_force_encoding? ? remote_file_data.force_encoding("UTF-8") : remote_file_data)
tempfile.close
return tempfile
else
@@ -68,6 +68,10 @@ module Miro
end
end
+ def should_force_encoding?
+ Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('1.9')
+ end
+
def open_downsampled_image
tempfile = Tempfile.open(["downsampled", '.png'])
tempfile.binmode | Fix encoding issue for Ruby > <I> | jonbuda_miro | train | rb |
377d0c1cce8ea1858169c8433ad7d53edd5b962d | diff --git a/Client.php b/Client.php
index <HASH>..<HASH> 100644
--- a/Client.php
+++ b/Client.php
@@ -299,6 +299,24 @@ class CheddarGetter_Client {
}
/**
+ * Decrement a usage item quantity
+ *
+ * @param string $code Your code for the customer
+ * @param string|null $id CG id for the customer
+ * @param array $data Your (itemCode or CG itemId) and [quantity]
+ * @return CheddarGetter_Response
+ */
+ public function removeItemQuantity($code, $id = null, array $data) {
+ $this->_requireIdentifier($code, $id);
+ return new CheddarGetter_Response(
+ $this->request(
+ '/customers/remove-item-quantity/' . (($id) ? '/id/'.$id : '/code/'.$code),
+ $data
+ )
+ );
+ }
+
+ /**
* Set a usage item quantity
*
* @param string $code Your code for the customer | Added a removeItemQuantity method | marcguyer_cheddargetter-client-php | train | php |
9e69136957207c1b2f58921866706625ad2af8ca | diff --git a/lib/tabula/entities/page.rb b/lib/tabula/entities/page.rb
index <HASH>..<HASH> 100644
--- a/lib/tabula/entities/page.rb
+++ b/lib/tabula/entities/page.rb
@@ -254,9 +254,7 @@ module Tabula
end
def get_cell_text(area=nil)
- s = self.get_text(area)
- # puts s.map(&:inspect)
- TextElement.merge_words(s)
+ TextElement.merge_words(self.get_text(area))
end
def to_json(options={}) | undo a debugging change | tabulapdf_tabula-extractor | train | rb |
eeeae0339633da1e36fb2b544633f10aba6681f5 | diff --git a/lib/helper.js b/lib/helper.js
index <HASH>..<HASH> 100644
--- a/lib/helper.js
+++ b/lib/helper.js
@@ -201,7 +201,7 @@ helper.sendDelete = function(uri, configId, keyType, cb) {
// Find the configId for this accountId
helper.getConfigId = function(accountId) {
var configArr = config.get('configArr');
- for (let i = 0; i < configArr.length; i++) {
+ for (var i = 0; i < configArr.length; i++) {
var configId = configArr[i];
var cfgAccountId = config.get(configId + '.accountId');
if (cfgAccountId == accountId) { | use var instead of let for backwards compatibility | kenahrens_newrelic-api-client-js | train | js |
69bbcf7d0f6d0841fbde88abc1ca906a8c6ab942 | diff --git a/lib/workflow_kit/version.rb b/lib/workflow_kit/version.rb
index <HASH>..<HASH> 100644
--- a/lib/workflow_kit/version.rb
+++ b/lib/workflow_kit/version.rb
@@ -1,3 +1,3 @@
module WorkflowKit
- VERSION = "0.0.4.alpha"
+ VERSION = "0.0.5.alpha"
end | bump to <I>.alpha | fiedl_workflow_kit | train | rb |
6e11cbf6b48790a81b123aec4115a5cd5f5f18bb | diff --git a/src/Models/Corporation/CorporationMemberTracking.php b/src/Models/Corporation/CorporationMemberTracking.php
index <HASH>..<HASH> 100644
--- a/src/Models/Corporation/CorporationMemberTracking.php
+++ b/src/Models/Corporation/CorporationMemberTracking.php
@@ -202,6 +202,7 @@ class CorporationMemberTracking extends Model
/**
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
+ * @deprecated
*/
public function user()
{ | refactor(relationship): deprecating user relation from member tracking | eveseat_eveapi | train | php |
87f978986c9e466cae82e9bb6c4e2231c27888f0 | diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100755
--- a/setup.py
+++ b/setup.py
@@ -34,5 +34,5 @@ and data types of the information within the MIB module.""",
author = "Pieter Hollants",
author_email = "[email protected]",
py_modules = [ "netsnmpagent", "netsnmpapi" ],
- license = 'GPL 3',
+ license = "GPL-3.0",
) | Modify License specification to conform with openSUSE guidelines | pief_python-netsnmpagent | train | py |
715365b36d59ba3a8de1e53a15ab9246956b1bf6 | diff --git a/lib/excon/connection.rb b/lib/excon/connection.rb
index <HASH>..<HASH> 100644
--- a/lib/excon/connection.rb
+++ b/lib/excon/connection.rb
@@ -116,6 +116,7 @@ module Excon
new_socket.connect
end
+ Thread.current[:_excon_sockets] ||= {}
Thread.current[:_excon_sockets][@uri.to_s] = new_socket
end | make sure to initialize thread local in reset socket if needed | excon_excon | train | rb |
4dff29b9aefc8418f8e70b35238bbc05dcfbce80 | diff --git a/spec/twitter/entity/uri_spec.rb b/spec/twitter/entity/uri_spec.rb
index <HASH>..<HASH> 100644
--- a/spec/twitter/entity/uri_spec.rb
+++ b/spec/twitter/entity/uri_spec.rb
@@ -1,3 +1,5 @@
+# encoding: utf-8
+
require 'helper'
describe Twitter::Entity::URI do | Add encoding to uri_spec for Ruby <I> compatibility. | sferik_twitter | train | rb |
d4757d0394bde605ec6723219b0bf787727a4d3a | diff --git a/src/extensions/default/JavaScriptCodeHints/tern-worker.js b/src/extensions/default/JavaScriptCodeHints/tern-worker.js
index <HASH>..<HASH> 100644
--- a/src/extensions/default/JavaScriptCodeHints/tern-worker.js
+++ b/src/extensions/default/JavaScriptCodeHints/tern-worker.js
@@ -113,6 +113,13 @@ var config = {};
return fileName;
}
+ function _getDenormalizedFilename(fileName) {
+ if (ternServer.projectDir && fileName.indexOf(ternServer.projectDir) === 0) {
+ fileName = fileName.slice(ternServer.projectDir.length);
+ }
+ return fileName;
+ }
+
/**
* Create a new tern server.
*
@@ -588,10 +595,7 @@ var config = {};
* @param {string} path - the path of the file
*/
function handlePrimePump(path) {
- var fileName = path;
- if (ternServer.projectDir && fileName.indexOf(ternServer.projectDir) === 0) {
- fileName = fileName.slice(ternServer.projectDir.length);
- }
+ var fileName = _getDenormalizedFilename(path);
var fileInfo = createEmptyUpdate(fileName),
request = buildRequest(fileInfo, "completions", {line: 0, ch: 0}); | Introduce _getDenormalizedFilename and use it | adobe_brackets | train | js |
923442ec6b8f1ac7526ef579147f33fba91aee42 | diff --git a/sshtunnel.py b/sshtunnel.py
index <HASH>..<HASH> 100644
--- a/sshtunnel.py
+++ b/sshtunnel.py
@@ -641,6 +641,7 @@ class SSHTunnelForwarder(object):
self.logger.info('Connecting to gateway: {0}:{1} as user "{2}".'
.format(ssh_host, ssh_port, ssh_username))
+ self.set_keepalive = set_keepalive
# CREATE THE TUNNELS
self.tunnel_is_up = {} # handle status of the other side of the tunnel
try: | Missing argument mapping for set_keepalive | pahaz_sshtunnel | train | py |
f73c6cc777e9e327325e968866948e67b27714de | diff --git a/lib/muack.rb b/lib/muack.rb
index <HASH>..<HASH> 100644
--- a/lib/muack.rb
+++ b/lib/muack.rb
@@ -27,15 +27,15 @@ module Muack
module API
module_function
def mock object=Object.new
- Muack.session["mock #{object.object_id}"] ||= Muack::Mock.new(object)
+ Muack.session["mock #{object.__id__}"] ||= Muack::Mock.new(object)
end
def stub object=Object.new
- Muack.session["stub #{object.object_id}"] ||= Muack::Stub.new(object)
+ Muack.session["stub #{object.__id__}"] ||= Muack::Stub.new(object)
end
def proxy object=Object.new
- Muack.session["proxy #{object.object_id}"] ||= Muack::Proxy.new(object)
+ Muack.session["proxy #{object.__id__}"] ||= Muack::Proxy.new(object)
end
def any_instance_of klass | it seems using __id__ is safer | godfat_muack | train | rb |
cb6a9435816012d1840e3a23eefe49e9894f3582 | diff --git a/lib/util.js b/lib/util.js
index <HASH>..<HASH> 100644
--- a/lib/util.js
+++ b/lib/util.js
@@ -189,7 +189,7 @@ var util = {
parse: function string(ini) {
var currentSection, map = {};
util.arrayEach(ini.split(/\r?\n/), function(line) {
- line = line.split(/(^|\s);/)[0]; // remove comments
+ line = line.split(/(^|\s)[;#]/)[0]; // remove comments
var section = line.match(/^\s*\[([^\[\]]+)\]\s*$/);
if (section) {
currentSection = section[1]; | Parse ini files with comments starting with # | aws_aws-sdk-js | train | js |
3b18f34bdebc85430114075248ae3fa581e0f700 | diff --git a/activerecord/test/cases/associations/has_many_associations_test.rb b/activerecord/test/cases/associations/has_many_associations_test.rb
index <HASH>..<HASH> 100644
--- a/activerecord/test/cases/associations/has_many_associations_test.rb
+++ b/activerecord/test/cases/associations/has_many_associations_test.rb
@@ -46,7 +46,7 @@ class HasManyAssociationsTestForCountWithCountSql < ActiveRecord::TestCase
end
end
-class HasManyAssociationsTestForCountWithFinderSql < ActiveRecord::TestCase
+class HasManyAssociationsTestForCountWithVariousFinderSqls < ActiveRecord::TestCase
class Invoice < ActiveRecord::Base
ActiveSupport::Deprecation.silence do
has_many :custom_line_items, :class_name => 'LineItem', :finder_sql => "SELECT DISTINCT line_items.amount from line_items" | Fix warning: method redefine. Testcase name are duplicated. | rails_rails | train | rb |
171adb0b0fb19b7a5833703e86a92a464b2be6cf | diff --git a/cobraadaptor/adaptor.go b/cobraadaptor/adaptor.go
index <HASH>..<HASH> 100644
--- a/cobraadaptor/adaptor.go
+++ b/cobraadaptor/adaptor.go
@@ -58,6 +58,7 @@ func NewCobraAdaptor(clientFlags *cliflags.ClientFlags) CobraAdaptor {
image.NewImagesCommand(dockerCli),
image.NewLoadCommand(dockerCli),
image.NewRemoveCommand(dockerCli),
+ image.NewSaveCommand(dockerCli),
image.NewSearchCommand(dockerCli),
image.NewImportCommand(dockerCli),
image.NewTagCommand(dockerCli),
diff --git a/usage.go b/usage.go
index <HASH>..<HASH> 100644
--- a/usage.go
+++ b/usage.go
@@ -18,7 +18,6 @@ var DockerCommandUsage = []Command{
{"ps", "List containers"},
{"pull", "Pull an image or a repository from a registry"},
{"push", "Push an image or a repository to a registry"},
- {"save", "Save one or more images to a tar archive"},
{"update", "Update configuration of one or more containers"},
} | Migrate save command to cobra | docker_cli | train | go,go |
d3f1cde59e70007f998bd5664937547ad8da71b0 | diff --git a/lib/db/upgrade.php b/lib/db/upgrade.php
index <HASH>..<HASH> 100644
--- a/lib/db/upgrade.php
+++ b/lib/db/upgrade.php
@@ -4372,7 +4372,7 @@ function xmldb_main_upgrade($oldversion) {
set_config('customusermenuitems', $newconfig);
}
- upgrade_main_savepoint(true, 2015050300.00);
+ upgrade_main_savepoint(true, 2015050401.00);
}
return true; | MDL-<I> upgrade: Correct missing main_savepoint update | moodle_moodle | train | php |
ba532b36df8aac8c39f638514fb613d077a23b01 | diff --git a/build/cleanup-old-tags.js b/build/cleanup-old-tags.js
index <HASH>..<HASH> 100644
--- a/build/cleanup-old-tags.js
+++ b/build/cleanup-old-tags.js
@@ -22,13 +22,13 @@ const tags = execSync ('git tag').toString ().split ('\n').filter (s => s).map (
}
})
-const tagsByMajor = values (groupBy (tags, 'key')).sort ((a, b) => a[0].key - b[0].key)
+const tagsByMajorMinor = values (groupBy (tags, 'key')).sort ((a, b) => a[0].key - b[0].key)
// Preserve all tags for first 3 minor versions
for (let i = 0; i < 3; i++) {
- const tags = tagsByMajor.pop ()
+ const tags = tagsByMajorMinor.pop ()
log.green.bright ('Preserving', tags[0].tag, '...', tags[tags.length - 1].tag)
}
@@ -37,7 +37,7 @@ for (let i = 0; i < 3; i++) {
let tagsToDelete = []
-for (const tags of tagsByMajor) {
+for (const tags of tagsByMajorMinor) {
for (const { tag, patch } of tags) { | more sane variable naming in cleanup-old-tags
[ci skip] | ccxt_ccxt | train | js |
0cc219407412c4fa647be60806c5c9652bed735e | diff --git a/lib/brainstem/controller_methods.rb b/lib/brainstem/controller_methods.rb
index <HASH>..<HASH> 100644
--- a/lib/brainstem/controller_methods.rb
+++ b/lib/brainstem/controller_methods.rb
@@ -27,7 +27,7 @@ module Brainstem
# only required if the name cannot be inferred.
# @return (see PresenterCollection#presenting)
def present_object(objects, options = {})
- options.merge!(:params => params)
+ options.merge!(:params => params, :apply_default_filters => false)
if objects.is_a?(ActiveRecord::Relation) || objects.is_a?(Array)
raise ActiveRecord::RecordNotFound if objects.empty?
diff --git a/spec/brainstem/controller_methods_spec.rb b/spec/brainstem/controller_methods_spec.rb
index <HASH>..<HASH> 100644
--- a/spec/brainstem/controller_methods_spec.rb
+++ b/spec/brainstem/controller_methods_spec.rb
@@ -76,6 +76,11 @@ describe Brainstem::ControllerMethods do
@controller.present_object(Workspace.all)
@controller.call_results[:options][:params][:only].should be_nil
end
+
+ it "passes :apply_default_filters => false to the PresenterCollection so that filters are not applied by default" do
+ @controller.present_object(Workspace.find(1))
+ @controller.call_results[:options][:apply_default_filters].should == false
+ end
end
end
end | add back in skipping of default filters to ControllerMethods.present_object
We recommend using #present_object in your API controllers when handling
show, update, and create requests where you wouldn't want to return an
empty set because of default filters.' | mavenlink_brainstem | train | rb,rb |
5d00d325c79f1b4c503fe2a66a240efc2e0fffe3 | diff --git a/lib/store/documentStore.js b/lib/store/documentStore.js
index <HASH>..<HASH> 100644
--- a/lib/store/documentStore.js
+++ b/lib/store/documentStore.js
@@ -19,6 +19,7 @@ const DocumentStore = (options, validator, encryption) => {
// from extensions. (to avoid adding permissions, attributes or other logic that modifies these internal entities from extensions)
const internalEntitySets = {}
const transactions = new Map()
+ const fileExtensionResolvers = []
transactions.getActiveTransaction = function (req) {
if (req && req.context && req.context.storeTransaction) {
@@ -195,9 +196,19 @@ const DocumentStore = (options, validator, encryption) => {
},
addFileExtensionResolver (fn) {
- if (this.provider.addFileExtensionResolver) {
- this.provider.addFileExtensionResolver(fn)
+ fileExtensionResolvers.push(fn)
+ },
+
+ resolveFileExtension (doc, entitySetName, entityType, propType) {
+ for (const resolver of fileExtensionResolvers) {
+ const extension = resolver(doc, entitySetName, entityType, propType)
+
+ if (extension) {
+ return extension
+ }
}
+
+ return propType.document.extension
},
/** | add reporter.documentStore.resolveFileExtension as a way to general way to get file extension of entity properties (like .content, .contentRaw), etc | jsreport_jsreport-core | train | js |
869bbd9833aeaf1e8abbf91c2289096e6fff6b6e | diff --git a/src/core/index.js b/src/core/index.js
index <HASH>..<HASH> 100644
--- a/src/core/index.js
+++ b/src/core/index.js
@@ -19,7 +19,7 @@ export Sphere from './Sphere'
export Transformable from './Transformable'
export TreeNode from './TreeNode'
export * as Utility from './Utility'
-export {getWebGLRendererThree, destroyWebGLRendererThree} from './WebGLRendererThree'
+export * from './WebGLRendererThree'
export XYZNonNegativeValues from './XYZNonNegativeValues'
export XYZNumberValues from './XYZNumberValues'
export XYZSizeModeValues from './XYZSizeModeValues' | use wild-card re-export syntax | trusktr_infamous | train | js |
40f219469d7ecdc4bbc483c302dbe4d29f4e2cd1 | diff --git a/app/assets/javascripts/govuk_publishing_components/components/details.js b/app/assets/javascripts/govuk_publishing_components/components/details.js
index <HASH>..<HASH> 100644
--- a/app/assets/javascripts/govuk_publishing_components/components/details.js
+++ b/app/assets/javascripts/govuk_publishing_components/components/details.js
@@ -20,7 +20,7 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
var detailsClick = detailsComponent.querySelector('[data-details-track-click]')
var that = this
- $(detailsClick).click(function (e) {
+ detailsClick.addEventListener('click', function (event) {
that.trackDefault(detailsComponent)
})
}
@@ -37,7 +37,7 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
trackOptions = {}
}
- trackOptions['label'] = componentStatus
+ trackOptions.label = componentStatus
if (trackAction && trackCategory) {
window.GOVUK.analytics.trackEvent(trackCategory, trackAction, trackOptions) | Remove jQuery from details component
- Replaced `click()` with `addEventListener()`
- No change to tests required | alphagov_govuk_publishing_components | train | js |
00ad44b706da3ee95f1ab3cfb35751dd9b416f3a | diff --git a/astar.js b/astar.js
index <HASH>..<HASH> 100644
--- a/astar.js
+++ b/astar.js
@@ -56,6 +56,7 @@ var astar = {
closestNode = start; // set the start node to be the closest if required
start.h = heuristic(start, end);
+ graph.markDirty(start);
openHeap.push(start);
@@ -71,7 +72,6 @@ var astar = {
// Normal case -- move currentNode from open to closed, process each of its neighbors.
currentNode.closed = true;
- graph.markDirty(currentNode);
// Find all neighbors for the current node.
var neighbors = graph.neighbors(currentNode); | only mark the start node as dirty to avoid pushing duplicate nodes onto dirty list | bgrins_javascript-astar | train | js |
301a3c34429201f5d5dfdb08625615d8169207db | diff --git a/lib/regexp-examples/repeaters.rb b/lib/regexp-examples/repeaters.rb
index <HASH>..<HASH> 100644
--- a/lib/regexp-examples/repeaters.rb
+++ b/lib/regexp-examples/repeaters.rb
@@ -5,7 +5,7 @@ module RegexpExamples
end
def result(min_repeats, max_repeats)
- group_result = @group.result
+ group_result = @group.result[0 .. MaxGroupResults-1]
results = []
min_repeats.upto(max_repeats) do |repeats|
group_result.each do |result| | Only first 5 chars from each group are returned
E.g. \d = [0, 1, 2, 3, 4], and \w = ['a', 'b', 'c', 'd', 'e']
This prevents a crazy number of examples being returned! | tom-lord_regexp-examples | train | rb |
5b729954bfb039bc73513256193cd07150bc3527 | diff --git a/src/main/java/org/dasein/cloud/openstack/nova/os/network/Quantum.java b/src/main/java/org/dasein/cloud/openstack/nova/os/network/Quantum.java
index <HASH>..<HASH> 100644
--- a/src/main/java/org/dasein/cloud/openstack/nova/os/network/Quantum.java
+++ b/src/main/java/org/dasein/cloud/openstack/nova/os/network/Quantum.java
@@ -254,8 +254,10 @@ public class Quantum extends AbstractVLANSupport {
else {
json.put("ip_version", "4");
}
- md.put("org.dasein.description", options.getDescription());
- json.put("metadata", md);
+ if (!getNetworkType().equals(QuantumType.QUANTUM)) {
+ md.put("org.dasein.description", options.getDescription());
+ json.put("metadata", md);
+ }
wrapper.put("subnet", json); | fixed create subnet call for Quantum | dasein-cloud_dasein-cloud-openstack | train | java |
fdea182f6e822cad89e616f630dd4af5f91fb1c4 | diff --git a/lib/uaa/token_issuer.rb b/lib/uaa/token_issuer.rb
index <HASH>..<HASH> 100644
--- a/lib/uaa/token_issuer.rb
+++ b/lib/uaa/token_issuer.rb
@@ -65,7 +65,7 @@ class CF::UAA::TokenIssuer
uri = authorize_path_args("token", redir_uri, scope, state = SecureRandom.uuid)
# required for current UAA implementation
- headers = {content_type: "application/x-www-form-urlencoded"}
+ headers = {'Content-Type' => "application/x-www-form-urlencoded"}
body = "credentials=#{URI.encode(credentials.to_json)}"
# consistent with the rest of the OAuth calls
diff --git a/lib/uaa/version.rb b/lib/uaa/version.rb
index <HASH>..<HASH> 100644
--- a/lib/uaa/version.rb
+++ b/lib/uaa/version.rb
@@ -13,6 +13,6 @@
module CF
module UAA
- VERSION = "0.0.7.beta.1"
+ VERSION = "0.0.7.beta.2"
end
end | Fixed a bug with the content type in the implicit grant request.
Bumped the gem version.
Change-Id: I<I>f<I>c4d3e<I>ab<I>aa<I>d<I>f<I>ef9 | cloudfoundry_cf-uaa-lib | train | rb,rb |
11dd12f002ef1565afec7333da28b4f498571500 | diff --git a/test/core/Transport.js b/test/core/Transport.js
index <HASH>..<HASH> 100644
--- a/test/core/Transport.js
+++ b/test/core/Transport.js
@@ -90,14 +90,15 @@ function (Test, Transport, Tone, Offline, TransportTime) {
});
it("can get the next subdivision of the transport", function(done){
- var now = Tone.Transport.now() + 0.1;
- Tone.Transport.start(now);
- setTimeout(function(){
- expect(Tone.Transport.nextSubdivision(0.5)).to.be.closeTo(now + 1, 0.01);
- expect(Tone.Transport.nextSubdivision(2)).to.be.closeTo(now + 2, 0.01);
- expect(Tone.Transport.nextSubdivision("8n")).to.be.closeTo(now + 0.75, 0.01);
- done();
- }, 600);
+ Offline(function(dest, testFn, after){
+ Tone.Transport.start(0);
+ after(function(){
+ expect(Tone.Transport.nextSubdivision(0.5)).to.be.closeTo(1, 0.01);
+ expect(Tone.Transport.nextSubdivision(2)).to.be.closeTo(2, 0.01);
+ expect(Tone.Transport.nextSubdivision("8n")).to.be.closeTo(0.75, 0.01);
+ done();
+ });
+ }, 0.7);
});
}); | changing subdivision test to use Offline testing
more reliable than setTimeout | Tonejs_Tone.js | train | js |
f8bf44e68a36a8b73912ab5a34196e21d8f4e336 | diff --git a/js/tests/parserTests.js b/js/tests/parserTests.js
index <HASH>..<HASH> 100755
--- a/js/tests/parserTests.js
+++ b/js/tests/parserTests.js
@@ -1499,6 +1499,7 @@ ParserTests.prototype.processCase = function ( i, options ) {
-1 === item.title.search( this.test_filter ) ) ) {
// Skip test whose title does not match --filter
// or which is disabled or php-only
+ this.comments = [];
process.nextTick( nextCallback );
break;
} | ParserTests: don't accumulate comments when skipping tests with --filter.
Change-Id: I<I>ccfbaaa2bc<I>f<I>e7d<I>bc<I>b<I>b | wikimedia_parsoid | train | js |
a5b59388697773c4df4e0fefa35e8cdead1ad6e5 | diff --git a/test/plugin/test_elasticsearch_error_handler.rb b/test/plugin/test_elasticsearch_error_handler.rb
index <HASH>..<HASH> 100644
--- a/test/plugin/test_elasticsearch_error_handler.rb
+++ b/test/plugin/test_elasticsearch_error_handler.rb
@@ -112,6 +112,7 @@ class TestElasticsearchErrorHandler < Test::Unit::TestCase
@log = Fluent::Log.new(logger)
@plugin = TestPlugin.new(@log)
@handler = Fluent::Plugin::ElasticsearchErrorHandler.new(@plugin)
+ @plugin.log_es_400_reason = true
end
def test_400_responses_reason_log | Set `@plugin.log_es_<I>_reason` as true | uken_fluent-plugin-elasticsearch | train | rb |
1f50a73a01f1806752a058cfe39a9db520ab8337 | diff --git a/src/main/java/com/tdunning/math/stats/MergingDigest.java b/src/main/java/com/tdunning/math/stats/MergingDigest.java
index <HASH>..<HASH> 100644
--- a/src/main/java/com/tdunning/math/stats/MergingDigest.java
+++ b/src/main/java/com/tdunning/math/stats/MergingDigest.java
@@ -519,7 +519,11 @@ public class MergingDigest extends AbstractTDigest {
compress();
List<Centroid> r = new ArrayList<Centroid>();
for (int i = 0; i <= lastUsedCell; i++) {
- r.add(new Centroid(mean[i], (int) weight[i], data != null ? data.get(i) : null));
+ if (weight[i] > 0) {
+ r.add(new Centroid(mean[i], (int) weight[i], data != null ? data.get(i) : null));
+ } else {
+ break;
+ }
}
return r;
} | Fixes #<I> by testing for zero weight. | tdunning_t-digest | train | java |
20544fbbd600291323017c23d499e84e1bb95fc7 | diff --git a/src/rules/prefer-invoke-map.js b/src/rules/prefer-invoke-map.js
index <HASH>..<HASH> 100644
--- a/src/rules/prefer-invoke-map.js
+++ b/src/rules/prefer-invoke-map.js
@@ -18,7 +18,7 @@ module.exports = {
const {isAliasOfMethod} = require('../util/methodDataUtil')
function isOnlyUsedForObject(func, firstParamName) {
- const declaredVariables = context.eslint.getDeclaredVariables(func)
+ const declaredVariables = context.getDeclaredVariables(func)
return declaredVariables.every(variable => variable.references.length === 0 || (variable.name === firstParamName && variable.references.length === 1))
} | fix rule prefer-invoke-map to work with eslint >= <I> (fixes #<I>) | wix_eslint-plugin-lodash | train | js |
845d11d678c7501093e38d93b4ea7119ede7f157 | diff --git a/gomigrate.go b/gomigrate.go
index <HASH>..<HASH> 100644
--- a/gomigrate.go
+++ b/gomigrate.go
@@ -296,7 +296,7 @@ func (m *Migrator) Rollback() error {
func (m *Migrator) RollbackN(n int) error {
migrations := m.Migrations(Active)
if len(migrations) == 0 {
- return NoActiveMigrations
+ return nil
}
last_migration := len(migrations) - 1 - n | Don't raise an error if there aren't any active migrations | DavidHuie_gomigrate | train | go |
839ac0d2382dfba01669eabe43566515ad3ba35c | diff --git a/libkbfs/reporter_kbpki.go b/libkbfs/reporter_kbpki.go
index <HASH>..<HASH> 100644
--- a/libkbfs/reporter_kbpki.go
+++ b/libkbfs/reporter_kbpki.go
@@ -41,6 +41,8 @@ var noErrorNames = map[string]bool{
"_mtn": true, // emacs on Linux
"docker-machine": true, // docker shell stuff
"HEAD": true, // git shell
+ "Keybase.app": true, // some OSX mount thing
+ "DCIM": true, // looking for digital pic folder
}
// ReporterKBPKI implements the Notify function of the Reporter | reporter_kbpki: add Keybase.app and DCIM exceptions
Issue: keybase/client#<I> | keybase_client | train | go |
88c22dab5cc4268f8fb6666d373a1ffe76a27e01 | diff --git a/app/jobs/fastly_log_processor.rb b/app/jobs/fastly_log_processor.rb
index <HASH>..<HASH> 100644
--- a/app/jobs/fastly_log_processor.rb
+++ b/app/jobs/fastly_log_processor.rb
@@ -22,12 +22,14 @@ class FastlyLogProcessor
end
counts = download_counts(log_ticket)
+ StatsD.gauge('fastly_log_processor.processed_versions_count', counts.count)
Delayed::Worker.logger.info "Processed Fastly log counts: #{counts.inspect}"
ActiveRecord::Base.connection.transaction do
GemDownload.bulk_update(counts)
processed_count = counts.sum { |_, v| v }
log_ticket.update(status: "processed", processed_count: processed_count)
+ StatsD.gauge('fastly_log_processor.processed_count', processed_count)
end
end
statsd_count_success :perform, 'fastly_log_processor.perform'
@@ -55,5 +57,4 @@ class FastlyLogProcessor
accum
end
end
- statsd_count :download_counts, 'fastly_log_processor.download_counts'
end | improve statsd metrics for FastlyLogProcessor | rubygems_rubygems.org | train | rb |
cc3f378226c375401f159f3791df33f3a2ec165b | diff --git a/lib/ztk/dsl/base.rb b/lib/ztk/dsl/base.rb
index <HASH>..<HASH> 100644
--- a/lib/ztk/dsl/base.rb
+++ b/lib/ztk/dsl/base.rb
@@ -152,14 +152,14 @@ module ZTK::DSL
def initialize(id=nil, &block)
self.id = (id || self.class.next_id)
- self.class.dataset.delete_if{ |d| d.id == self.id }
self.class.dataset << self
+
block_given? and ((block.arity < 1) ? instance_eval(&block) : block.call(self))
- # primary_key_count = self.class.dataset.count do |d|
- # d.id == self.id
- # end
- # raise StandardError, "Primary key '#{self.id}' already exists!" if (primary_key_count > 1)
+ primary_key_count = self.class.dataset.count do |d|
+ d.id == self.id
+ end
+ raise StandardError, "Primary key '#{self.id}' already exists!" if (primary_key_count > 1)
end
# Instance Inspect | raise an exception if we have a primary key collision | zpatten_ztk | train | rb |
a8782f43d1edb4c31b85871d65e3f7216e8a3743 | diff --git a/storage/Folder.php b/storage/Folder.php
index <HASH>..<HASH> 100644
--- a/storage/Folder.php
+++ b/storage/Folder.php
@@ -52,7 +52,7 @@ class Folder
private function getRootArray()
{
- return ['id' => 0, 'name' => 'Root'];
+ return ['id' => 0, 'name' => 'Stammverzeichnis'];
}
private function getSubFolderOf($folderId) | renamed root folder node | luyadev_luya-module-admin | train | php |
987075553102b750e0f9e31d2ceeb1d05998acfb | diff --git a/index.js b/index.js
index <HASH>..<HASH> 100644
--- a/index.js
+++ b/index.js
@@ -80,7 +80,7 @@ module.exports = function (options) {
less.render(
content,
-
+
function(err, result) {
if (err) {
cb(FOUND_ERROR, 'Error while compiling less template "' + path + '". Error from "less" plugin: ' + err);
@@ -111,15 +111,15 @@ module.exports = function (options) {
var parts = [];
parts.push(Buffer(content.substring(0, matches.index)));
- parts.push(Buffer('styles: [\''));
+ parts.push(Buffer('styles: [`'));
for (var i=0; i<entrances.length; i++) {
parts.push(Buffer(entrances[i].replace(/\n/g, '')));
if (i < entrances.length - 1) {
- parts.push(Buffer('\', \''));
+ parts.push(Buffer('`, `));
}
}
- parts.push(Buffer('\']'));
+ parts.push(Buffer('`]'));
parts.push(Buffer(content.substr(matches.index + matches[0].length)));
return Buffer.concat(parts);
} | feat(joinParts): use backticks insted of singlequotes | amritk_gulp-angular2-embed-sass | train | js |
9051520dee6e06c3ecc13ad6059e090d91f1c588 | diff --git a/src/Module.js b/src/Module.js
index <HASH>..<HASH> 100644
--- a/src/Module.js
+++ b/src/Module.js
@@ -69,8 +69,9 @@ export default class Module {
return reference.call( this.exports, name );
}
- // ... otherwise search exportAlls.
- for ( const module of this.exportAlls ) {
+ // ... otherwise search exportAlls
+ for ( let i = 0; i < this.exportAlls.length; i += 1 ) {
+ const module = this.exportAlls[i];
if ( module.exports.inScope( name ) ) {
return module.exports.reference( name );
}
@@ -83,11 +84,7 @@ export default class Module {
this.exports.inScope = name => {
if ( inScope.call( this.exports, name ) ) return true;
- for ( const module of this.exportAlls ) {
- if ( module.exports.inScope( name ) ) return true;
- }
-
- return false;
+ return this.exportAlls.some( module => module.exports.inScope( name ) );
};
// Create a unique virtual scope for references to the module. | Don't use `for-of` | rollup_rollup | train | js |
f2e73a418ec070340c711ae05315ad73c3982799 | diff --git a/distutils/version.py b/distutils/version.py
index <HASH>..<HASH> 100644
--- a/distutils/version.py
+++ b/distutils/version.py
@@ -50,14 +50,14 @@ class Version:
"""
def __init__ (self, vstring=None):
+ if vstring:
+ self.parse(vstring)
warnings.warn(
"distutils Version classes are deprecated. "
"Use packaging.version instead.",
DeprecationWarning,
stacklevel=2,
)
- if vstring:
- self.parse(vstring)
def __repr__ (self):
return "%s ('%s')" % (self.__class__.__name__, str(self)) | Emit warning after parsing. Fixes pypa/distutils#<I>. | pypa_setuptools | train | py |
5f71d31960e12272f38b200bbe55d4ef3d2a0367 | diff --git a/pylogit/asym_logit.py b/pylogit/asym_logit.py
index <HASH>..<HASH> 100644
--- a/pylogit/asym_logit.py
+++ b/pylogit/asym_logit.py
@@ -304,6 +304,10 @@ def _asym_utility_transform(systematic_utilities,
# Add the intercept values to f(x, beta, c)
transformed_utilities += rows_to_alts.dot(all_intercepts)
+ # Perform final guards against over/underflow in the transformations
+ transformed_utilities[np.isposinf(transformed_utilities)] = max_comp_value
+ transformed_utilities[np.isneginf(transformed_utilities)] = -max_comp_value
+
# Be sure to return a 2D array since other functions will be expecting that
if len(transformed_utilities.shape) == 1:
transformed_utilities = transformed_utilities[:, np.newaxis] | Changed handling of overflow from large systematic utilities in asym_utility_transform. | timothyb0912_pylogit | train | py |
0b48de4ea9f1b7b870cc14b198333e1fee8f4c0b | diff --git a/montblanc/impl/biro/v4/gpu/RimeEBeam.py b/montblanc/impl/biro/v4/gpu/RimeEBeam.py
index <HASH>..<HASH> 100644
--- a/montblanc/impl/biro/v4/gpu/RimeEBeam.py
+++ b/montblanc/impl/biro/v4/gpu/RimeEBeam.py
@@ -79,6 +79,9 @@ void rime_jones_E_beam_impl(
__shared__ T wl[BLOCKDIMX];
+ __shared__ T ld[BLOCKDIMY];
+ __shared__ T md[BLOCKDIMY];
+
// TODO. Using 3 times more shared memory than we
// really require here, since there's only
// one wavelength per channel.
@@ -87,12 +90,21 @@ void rime_jones_E_beam_impl(
wl[threadIdx.x] = wavelength[POLCHAN >> 2];
}
+ __syncthreads();
+
+ int i = 0;
+
for(int TIME=0; TIME < NTIME; ++TIME)
{
+ // Pointing errors vary by time and antenna
+ if(threadIdx.z == 0 && threadIdx.x == 0)
+ {
+ i = TIME*NA + ANT; ld[threadIdx.y] = point_errors[i];
+ i += NTIME*NA; md[threadIdx.y] = point_errors[i];
+ }
+ __syncthreads();
}
-
- __syncthreads();
}
extern "C" { | Load pointing errors into shared memory. | ska-sa_montblanc | train | py |
923fc087437904cf45e94a7b5954e60931f97a04 | diff --git a/tests/conftest.py b/tests/conftest.py
index <HASH>..<HASH> 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -2,5 +2,7 @@ import sys
if sys.version_info > (3,):
collect_ignore = ["test_django_channels.py"]
+ if sys.version_info < (3, 6):
+ collect_ignore.append('test_gevent.py')
else:
collect_ignore = ["test_aiohttp.py"] | Ignore gevent tests on less than Python <I> | graphql-python_graphql-ws | train | py |
1521bcc53a8d32339376035f9d5db3b496dfa61f | diff --git a/rbac_api.go b/rbac_api.go
index <HASH>..<HASH> 100644
--- a/rbac_api.go
+++ b/rbac_api.go
@@ -234,6 +234,8 @@ func (e *Enforcer) GetImplicitUsersForPermission(permission ...string) ([]string
subjects := append(pSubjects, gSubjects...)
util.ArrayRemoveDuplicates(&subjects)
+ subjects = util.SetSubtract(subjects, gInherit)
+
res := []string{}
for _, user := range subjects {
req := util.JoinSliceAny(user, permission...)
@@ -247,7 +249,5 @@ func (e *Enforcer) GetImplicitUsersForPermission(permission ...string) ([]string
}
}
- res = util.SetSubtract(res, gInherit)
-
return res, nil
} | perf: improve performance in GetImplicitUsersForPermission | casbin_casbin | train | go |
24f5291ac7f77809086ab8d38a0110c0c0f160d3 | diff --git a/beaver/transports/rabbitmq_transport.py b/beaver/transports/rabbitmq_transport.py
index <HASH>..<HASH> 100644
--- a/beaver/transports/rabbitmq_transport.py
+++ b/beaver/transports/rabbitmq_transport.py
@@ -12,7 +12,7 @@ class RabbitmqTransport(BaseTransport):
self._rabbitmq_config = {}
config_to_store = [
- 'key', 'exchange', 'username', 'password', 'host', 'port', 'vhost',
+ 'key', 'exchange', 'username', 'password', 'host', 'port', 'vhost',
'queue', 'queue_durable', 'ha_queue', 'exchange_type', 'exchange_durable'
]
@@ -56,6 +56,8 @@ class RabbitmqTransport(BaseTransport):
routing_key=self._rabbitmq_config['key']
)
+ self._is_valid = True;
+
def callback(self, filename, lines, **kwargs):
timestamp = self.get_timestamp(**kwargs)
if kwargs.get('timestamp', False): | Set transport as valid on connect (properly resets for reconnect) | python-beaver_python-beaver | train | py |
4eccae6432671500ea833a02ca007eee87592420 | diff --git a/lib/daybreak/writer.rb b/lib/daybreak/writer.rb
index <HASH>..<HASH> 100644
--- a/lib/daybreak/writer.rb
+++ b/lib/daybreak/writer.rb
@@ -95,7 +95,7 @@ module Daybreak
if s < buf.length
buf = buf[s..-1] # didn't finish
else
- buf.clear
+ buf = ""
end
buf
rescue Errno::EAGAIN | <I> doesn't have String#clear | propublica_daybreak | train | rb |
7e5f6ccf53d7163bcd44ef1da6ca86ed15c11f01 | diff --git a/src/FormObject/FieldList.php b/src/FormObject/FieldList.php
index <HASH>..<HASH> 100644
--- a/src/FormObject/FieldList.php
+++ b/src/FormObject/FieldList.php
@@ -43,6 +43,17 @@ class FieldList extends Field implements Countable, ArrayAccess, IteratorAggrega
return $this->hasSwitchableChildren();
}
+ public function isValid(){
+
+ foreach( $this->getDataFields() as $field) {
+ if (!$field->isValid()) {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
public function hasSwitchableChildren()
{ | Added small helper to wrap isValid with children | mtils_formobject | train | php |
e61f888d36a4012e4744044a9e58402c7a981a14 | diff --git a/lib/xsendfilelib.php b/lib/xsendfilelib.php
index <HASH>..<HASH> 100644
--- a/lib/xsendfilelib.php
+++ b/lib/xsendfilelib.php
@@ -52,7 +52,14 @@ function xsendfile($filepath) {
$aliased = false;
if (!empty($CFG->xsendfilealiases) and is_array($CFG->xsendfilealiases)) {
foreach ($CFG->xsendfilealiases as $alias=>$dir) {
- $dir = realpath($dir).PATH_SEPARATOR;
+ $dir = realpath($dir);
+ if ($dir === false) {
+ continue;
+ }
+ if (substr($dir, -1) !== DIRECTORY_SEPARATOR) {
+ // add trailing dir separator
+ $dir .= DIRECTORY_SEPARATOR;
+ }
if (strpos($filepath, $dir) === 0) {
$filepath = $alias.substr($filepath, strlen($dir));
$aliased = true; | MDL-<I> fix invalid separator constant and support root dirs in aliases
Credit goes to Loic Jeannin, thanks. | moodle_moodle | train | php |
Subsets and Splits