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
c003e6113ae063660fe52f095abc35d55d3dce52
diff --git a/lib/api-client/resources/history.js b/lib/api-client/resources/history.js index <HASH>..<HASH> 100644 --- a/lib/api-client/resources/history.js +++ b/lib/api-client/resources/history.js @@ -107,6 +107,9 @@ History.userOperation = function(params, done) { * Valid values are instanceId, definitionId, businessKey, startTime, endTime, duration. Must be used in conjunction with the sortOrder parameter. * @param {String} [params.sortOrder] Sort the results in a given order. * Values may be asc for ascending order or desc for descending order. Must be used in conjunction with the sortBy parameter. + * @param {Number} [params.firstResult] Pagination of results. Specifies the index of the first result to return. + * @param {Number} [params.maxResults] Pagination of results. Specifies the maximum number of results to return. Will return less results if there are no more results left. + * @param {Function} done */ History.processInstance = function(params, done) {
chore(history): document pagination params of processInstance method related to CAM-<I>
camunda_camunda-bpm-sdk-js
train
js
bc19c0d09cd04e1862c7a8f3bb7bcaf289270df3
diff --git a/activemodel/test/cases/conversion_test.rb b/activemodel/test/cases/conversion_test.rb index <HASH>..<HASH> 100644 --- a/activemodel/test/cases/conversion_test.rb +++ b/activemodel/test/cases/conversion_test.rb @@ -29,4 +29,8 @@ class ConversionTest < ActiveModel::TestCase assert_equal "helicopters/helicopter", Helicopter.new.to_partial_path, "ActiveModel::Conversion#to_partial_path caching should be class-specific" end + + test "to_partial_path handles namespaced models" do + assert_equal "helicopter/comanches/comanche", Helicopter::Comanche.new.to_partial_path + end end diff --git a/activemodel/test/models/helicopter.rb b/activemodel/test/models/helicopter.rb index <HASH>..<HASH> 100644 --- a/activemodel/test/models/helicopter.rb +++ b/activemodel/test/models/helicopter.rb @@ -1,3 +1,7 @@ class Helicopter include ActiveModel::Conversion end + +class Helicopter::Comanche + include ActiveModel::Conversion +end
test for ActiveModel::Conversion#to_partial_path and namespaced models
rails_rails
train
rb,rb
f999596ec2e42d2fdb8df9b9ecc42f8f3c21edae
diff --git a/source/org/jasig/portal/tools/checks/SpringBeanCheck.java b/source/org/jasig/portal/tools/checks/SpringBeanCheck.java index <HASH>..<HASH> 100644 --- a/source/org/jasig/portal/tools/checks/SpringBeanCheck.java +++ b/source/org/jasig/portal/tools/checks/SpringBeanCheck.java @@ -14,12 +14,14 @@ import org.springframework.beans.factory.NoSuchBeanDefinitionException; /** * Check that a particular named Spring bean is defined. - * @author [email protected] + * * @version $Revision$ $Date$ + * @since uPortal 2.5 */ public class SpringBeanCheck implements ICheck { - Log LOG = LogFactory.getLog(SpringBeanCheck.class); + + protected final Log log = LogFactory.getLog(getClass()); private final String beanName; @@ -75,7 +77,7 @@ public class SpringBeanCheck "Fix the declaration of bean [" + this.beanName + "] to be of the required type."); } catch (BeansException be) { - LOG.error("Error instantiating "+ this.beanName, be); + log.error("Error instantiating "+ this.beanName, be); return CheckResult.createFailure("There was an error instantiating the bean [" + this.beanName + "] required for configuration of configuration checking.", "The required XML files for Spring bean configuration in uPortal may not be present or may not conform to the required DTD or they may have definitions that a syntactically valid but do not correspond to actual bean constructors and methods."); } catch (ClassNotFoundException cnfe) {
UP-<I> declared @since uPortal <I> renamed non-static Log to reflect that it is not static (log rather than LOG) descreased scope of Log instance to protected. git-svn-id: <URL>
Jasig_uPortal
train
java
baeebeb736b088f8f673304448d6de90e3ea1531
diff --git a/pdfwatermarker/utils/path.py b/pdfwatermarker/utils/path.py index <HASH>..<HASH> 100644 --- a/pdfwatermarker/utils/path.py +++ b/pdfwatermarker/utils/path.py @@ -24,7 +24,20 @@ def set_destination(source, suffix): # Concatenate new filename dst_path = src_file_name + '_' + suffix + src_file_ext - return os.path.join(directory, dst_path) # new full path + full_path = os.path.join(directory, dst_path) # new full path + + if not os.path.exists(full_path): + return full_path + else: + # If file exists, increment number until filename is unique + number = 1 + while True: + dst_path = src_file_name + '_' + suffix + '_' + str(number) + src_file_ext + if not os.path.exists(dst_path): + break + number = number + 1 + full_path = os.path.join(directory, dst_path) # new full path + return full_path def resource_path(relative):
Added if statement and number incrementer to check if filename is unique.
mrstephenneal_pdfconduit
train
py
3af56360bd3bc4ddb9c0147b932dd7f74edcc07d
diff --git a/lib/jazzy/doc_builder.rb b/lib/jazzy/doc_builder.rb index <HASH>..<HASH> 100644 --- a/lib/jazzy/doc_builder.rb +++ b/lib/jazzy/doc_builder.rb @@ -128,11 +128,20 @@ module Jazzy DocsetBuilder.new(output_dir, source_module).build! - puts "jam out ♪♫ to your fresh new docs in `#{output_dir}`" + puts "jam out ♪♫ to your fresh new docs in `#{relative_path_if_inside(output_dir, Pathname.pwd)}`" source_module end + def self.relative_path_if_inside(path, base_path) + relative = path.relative_path_from(base_path) + if relative.to_path =~ /^..(\/|$)/ + path + else + relative + end + end + def self.decl_for_token(token) if token['key.parsed_declaration'] token['key.parsed_declaration']
Show output path relative to working dir when appropriate
realm_jazzy
train
rb
0cffc7bfb5ebeb618c0f5a95cf30663489bd7f82
diff --git a/client/extjs/src/panel/AbstractListUi.js b/client/extjs/src/panel/AbstractListUi.js index <HASH>..<HASH> 100644 --- a/client/extjs/src/panel/AbstractListUi.js +++ b/client/extjs/src/panel/AbstractListUi.js @@ -342,8 +342,6 @@ MShop.panel.AbstractListUi = Ext.extend(Ext.Panel, { getRecord: function( action ) { if( action === 'add' ) { return null; - } else if( action === 'edit' ) { - return this.grid.getSelectionModel().getSelected(); } else if( action === 'copy' ) { @@ -351,6 +349,7 @@ MShop.panel.AbstractListUi = Ext.extend(Ext.Panel, { record.data[ this.idProperty ] = null; return record; } + return this.grid.getSelectionModel().getSelected(); }, onStoreException: function(proxy, type, action, options, response) {
Removing one else if.
Arcavias_arcavias-core
train
js
b84d0c4167226fcc693f3953916cea8d47ac7538
diff --git a/src/cli/commands/name/resolve.js b/src/cli/commands/name/resolve.js index <HASH>..<HASH> 100644 --- a/src/cli/commands/name/resolve.js +++ b/src/cli/commands/name/resolve.js @@ -17,7 +17,7 @@ module.exports = { recursive: { type: 'boolean', alias: 'r', - describe: 'Resolve until the result is not an IPNS name. Default: false.', + describe: 'Resolve until the result is not an IPNS name. Default: true.', default: true } },
docs: change recursive IPNS resolve default value (#<I>) Value was updated but docs were not.
ipfs_js-ipfs
train
js
6499d92416c91fd54a3a97b07b252ace86e8d484
diff --git a/lib/addressable/uri.rb b/lib/addressable/uri.rb index <HASH>..<HASH> 100644 --- a/lib/addressable/uri.rb +++ b/lib/addressable/uri.rb @@ -284,7 +284,7 @@ module Addressable uri.path.tr!("\\", SLASH) if File.exist?(uri.path) && File.stat(uri.path).directory? - uri.path.sub!(/\/$/, EMPTY_STR) + uri.path.chomp!(SLASH) uri.path = uri.path + '/' end
Prefer `#chomp!` to remove trailing character
sporkmonger_addressable
train
rb
d1b45bee9d5b0ecaf9cb299f0507f776e8dc68d6
diff --git a/lib/kamerling/task.rb b/lib/kamerling/task.rb index <HASH>..<HASH> 100644 --- a/lib/kamerling/task.rb +++ b/lib/kamerling/task.rb @@ -1,7 +1,2 @@ module Kamerling class Task < UUIDObject :input, :project, done: false - def self.from_h hash, repos = Repos - hash.merge! project: repos[Project][hash[:project_uuid]] - hash.delete :project_uuid - new hash - end end end diff --git a/spec/kamerling/task_spec.rb b/spec/kamerling/task_spec.rb index <HASH>..<HASH> 100644 --- a/spec/kamerling/task_spec.rb +++ b/spec/kamerling/task_spec.rb @@ -3,14 +3,6 @@ require_relative '../spec_helper' module Kamerling describe Task do fakes :project - describe '.from_h' do - it 'backtranslates a project_uuid to project' do - repos = { Project => { project.uuid => project } } - hash = { input: 'input', project_uuid: project.uuid, uuid: UUID.new } - Task.from_h(hash, repos).project.must_equal project - end - end - describe '.new' do it 'gives the task a random UUID' do t1 = Task[input: 'some input', project: project]
Task.from_h: no need to custom-deserialise
chastell_kamerling
train
rb,rb
14184dea1a06d4a1de8d1106f182887e208b739f
diff --git a/example/simple-chat/app.js b/example/simple-chat/app.js index <HASH>..<HASH> 100644 --- a/example/simple-chat/app.js +++ b/example/simple-chat/app.js @@ -4,7 +4,8 @@ var sio , chat , counter = 1 , express = require('express') - , app = express.createServer(); + , http = require('http') + , app = express(); app.configure(function () { app.use(express['static'](__dirname + '/public')); @@ -15,8 +16,8 @@ app.get('/', function (req, res) { }); -app.listen(8080); -sio = require('socket.io').listen(app); +server = http.createServer(app); +sio = require('socket.io').listen(server); chat = require('../../lib/chat.io').createChat(sio.of('/chat')); sio.configure(function () { @@ -25,3 +26,5 @@ sio.configure(function () { callback(null, true); }); }); + +server.listen(8080); \ No newline at end of file
updated example to work with latest version of express
DanielBaulig_chat.io
train
js
7a0f86a885e4a06a7ebb286d92da0b14747008ba
diff --git a/src/index.js b/src/index.js index <HASH>..<HASH> 100644 --- a/src/index.js +++ b/src/index.js @@ -1,5 +1,6 @@ 'use strict'; +/** @class BEMQuery */ import './utils'; import './html'; import './state';
[ci skip] Updated docs.
BEMQuery_bemquery-async-dom
train
js
aefbde2a7133ed6bc534484b338937a6c1533aa0
diff --git a/yangson/schema.py b/yangson/schema.py index <HASH>..<HASH> 100644 --- a/yangson/schema.py +++ b/yangson/schema.py @@ -18,7 +18,7 @@ class SchemaNode: self.name = None # type: YangIdentifier self.ns = None # type: YangIdentifier self.parent = None # type: "InternalNode" - self.must = None # type: "Expr" + self.must = [] # type: List["Expr"] self.when = None # type: "Expr" @property @@ -106,12 +106,17 @@ class SchemaNode: def _must_stmt(self, stmt: Statement, mid: ModuleId) -> None: xpp = XPathParser(stmt.argument, mid) - self.must = xpp.parse() + mex = xpp.parse() if not xpp.at_end(): raise WrongArgument(stmt) + self.must.append(mex) def _when_stmt(self, stmt: Statement, mid: ModuleId) -> None: - self.when = XPathParser(stmt.argument, mid).parse() + xpp = XPathParser(stmt.argument, mid) + wex = xpp.parse() + if not xpp.at_end(): + raise WrongArgument(stmt) + self.when = wex def _mandatory_stmt(self, stmt, mid: ModuleId) -> None: if stmt.argument == "true":
Allow for multiple "must" statements.
CZ-NIC_yangson
train
py
ea456ec2a6fe977e69efab52edfc4574772f5988
diff --git a/lib/tugboat/middleware/create_droplet.rb b/lib/tugboat/middleware/create_droplet.rb index <HASH>..<HASH> 100644 --- a/lib/tugboat/middleware/create_droplet.rb +++ b/lib/tugboat/middleware/create_droplet.rb @@ -47,10 +47,11 @@ module Tugboat droplet_backups_enabled = env["create_droplet_backups_enabled"] : droplet_backups_enabled = env["config"].default_backups_enabled - droplet_key_array = droplet_ssh_key_ids.split(',') - - droplet_key_array = nil if [droplet_key_array].empty? - + if droplet_ssh_key_ids.kind_of?(Array) + droplet_key_array = droplet_ssh_key_ids + else + droplet_key_array = droplet_ssh_key_ids.split(',') + end create_opts = { :name => env["create_droplet_name"],
Fix to allow setting an array of keys in config Allows setting an array of keys in your config: ``` ssh_key: ['<I>','<I>'] ```
petems_tugboat
train
rb
cb271b407260f5c1d06564129dcb334b0151e116
diff --git a/src/main/java/reactor/ipc/netty/http/client/HttpClientOperations.java b/src/main/java/reactor/ipc/netty/http/client/HttpClientOperations.java index <HASH>..<HASH> 100644 --- a/src/main/java/reactor/ipc/netty/http/client/HttpClientOperations.java +++ b/src/main/java/reactor/ipc/netty/http/client/HttpClientOperations.java @@ -389,7 +389,6 @@ class HttpClientOperations extends HttpOperations<HttpClientResponse, HttpClient if (Objects.equals(method(), HttpMethod.GET) || Objects.equals(method(), HttpMethod.HEAD)) { ByteBufAllocator alloc = channel().alloc(); return then(Flux.from(source) - .doOnNext(ByteBuf::retain) .collect(alloc::buffer, ByteBuf::writeBytes) .flatMapMany(agg -> { if (!hasSentHeaders() &&
Do not invoke ByteBuf.retain as the bytes are copied to the new buffer
reactor_reactor-netty
train
java
664ed3902c517c1bef96478791769bfb2c1495d5
diff --git a/calendar-bundle/contao/config/config.php b/calendar-bundle/contao/config/config.php index <HASH>..<HASH> 100644 --- a/calendar-bundle/contao/config/config.php +++ b/calendar-bundle/contao/config/config.php @@ -68,4 +68,11 @@ $GLOBALS['TL_CRON']['daily'][] = array('Calendar', 'generateFeeds'); */ $GLOBALS['TL_HOOKS']['getSearchablePages'][] = array('Calendar', 'getSearchablePages'); + +/** + * Add permissions + */ +$GLOBALS['TL_PERMISSIONS'][] = 'calendars'; +$GLOBALS['TL_PERMISSIONS'][] = 'calendarp'; + ?> \ No newline at end of file
[Calendar] Added FAQ permissions in the back end (see #<I>)
contao_contao
train
php
4ddac6193f457dae9faead0ebf349b79e021e484
diff --git a/concrete/controllers/single_page/dashboard/users/groups/bulk_user_assignment.php b/concrete/controllers/single_page/dashboard/users/groups/bulk_user_assignment.php index <HASH>..<HASH> 100644 --- a/concrete/controllers/single_page/dashboard/users/groups/bulk_user_assignment.php +++ b/concrete/controllers/single_page/dashboard/users/groups/bulk_user_assignment.php @@ -118,7 +118,7 @@ class BulkUserAssignment extends DashboardPageController } $this->set('success', t( - 'Done! %s user records are found in the given CSV. %s users were added to the target group and %s users were removed from target group. For further details please check the logs.', + 'Done! %s user records are found in the given CSV file. %s users were added to the target group and %s users were removed from target group. For further details please check the logs.', $totalUsersProvided, $totalUsersAddedToTargetGroup, $totalUsersRemovedFromTargetGroup
bulk_user_assignment: CSV file instead of CSV alone
concrete5_concrete5
train
php
b0236456bbee57c5867a5a78da9b462a2bb6a70c
diff --git a/src/Plugin.php b/src/Plugin.php index <HASH>..<HASH> 100644 --- a/src/Plugin.php +++ b/src/Plugin.php @@ -152,17 +152,16 @@ class Plugin extends AbstractPlugin implements LoopAwareInterface } /** - * Indicates that the plugin monitors MOTD (message of the day) events, - * which it does because they are one-time per-connection events that - * enable it to obtain a reference to the event queue for each connection. + * Indicates that the plugin monitors USER events because they are one-time + * per-connection events that enable it to obtain a reference to the event + * queue for each connection. * * @return array */ public function getSubscribedEvents() { return array( - 'irc.received.rpl_endofmotd' => 'getEventQueue', - 'irc.received.err_nomotd' => 'getEventQueue', + 'irc.sent.user' => 'getEventQueue', ); } @@ -273,10 +272,10 @@ class Plugin extends AbstractPlugin implements LoopAwareInterface foreach ($this->targets as $connection => $targets) { if (!isset($this->queues[$connection])) { $logger->notice( - 'Encountered unknown connection', + 'Encountered unknown connection, or USER event not yet received', array( 'connection' => $connection, - 'queues' => $this->queues, + 'connections' => array_keys($this->queues), ) ); continue;
Modified Plugin to obtain queues on USER instead of MOTD events
phergie_phergie-irc-plugin-react-feedticker
train
php
b8a2e9a47112de46c937c4a799586459172b1b2d
diff --git a/bugwarrior/db.py b/bugwarrior/db.py index <HASH>..<HASH> 100644 --- a/bugwarrior/db.py +++ b/bugwarrior/db.py @@ -385,7 +385,9 @@ def synchronize(issue_generator, conf, main_section, dry_run=False): send_notification(issue, 'Created', conf) try: - tw.task_add(**issue) + new_task = tw.task_add(**issue) + if 'end' in issue and issue['end']: + tw.task_done(uuid=new_task['uuid']) except TaskwarriorError as e: log.exception("Unable to add task: %s" % e.stderr) @@ -410,7 +412,9 @@ def synchronize(issue_generator, conf, main_section, dry_run=False): continue try: - tw.task_update(issue) + _, updated_task = tw.task_update(issue) + if 'end' in issue and issue['end']: + tw.task_done(uuid=updated_task['uuid']) except TaskwarriorError as e: log.exception("Unable to modify task: %s" % e.stderr)
Mark new and updated tasks as completed if end date
ralphbean_bugwarrior
train
py
11ae35d94f17760f3c27f51b64e858aca33752f7
diff --git a/certbot/tests/test_fake_marathon.py b/certbot/tests/test_fake_marathon.py index <HASH>..<HASH> 100644 --- a/certbot/tests/test_fake_marathon.py +++ b/certbot/tests/test_fake_marathon.py @@ -2,20 +2,20 @@ import json import treq +from testtools.matchers import Equals + from twisted.internet.defer import inlineCallbacks from twisted.protocols.loopback import _LoopbackAddress from twisted.web.server import Site -from certbot.tests.fake_marathon import FakeMarathon, FakeMarathonAPI -from certbot.tests.helpers import FakeServerAgent, TestCase -from certbot.tests.matchers import IsJsonResponseWithCode - -from testtools.matchers import Equals - from txfake import FakeServer from uritools import uricompose +from certbot.tests.fake_marathon import FakeMarathon, FakeMarathonAPI +from certbot.tests.helpers import FakeServerAgent, TestCase +from certbot.tests.matchers import IsJsonResponseWithCode + class TestFakeMarathonAPI(TestCase):
Fake Marathon tests: reorder imports
praekeltfoundation_marathon-acme
train
py
482b1a180a3957d446b128dcb925a0abcd4ad6b5
diff --git a/examples/animated-three-basic-cube.js b/examples/animated-three-basic-cube.js index <HASH>..<HASH> 100644 --- a/examples/animated-three-basic-cube.js +++ b/examples/animated-three-basic-cube.js @@ -35,7 +35,7 @@ const sketch = ({ context }) => { camera.lookAt(new THREE.Vector3()); // Setup camera controller - const controls = new THREE.OrbitControls(camera); + const controls = new THREE.OrbitControls(camera, context.canvas); // Setup your scene const scene = new THREE.Scene(); diff --git a/examples/animated-three-text-canvas.js b/examples/animated-three-text-canvas.js index <HASH>..<HASH> 100644 --- a/examples/animated-three-text-canvas.js +++ b/examples/animated-three-text-canvas.js @@ -77,7 +77,7 @@ const sketch = async ({ context }) => { camera.lookAt(new THREE.Vector3()); // set up some orbit controls - const controls = new THREE.OrbitControls(camera); + const controls = new THREE.OrbitControls(camera, context.canvas); // setup your scene const scene = new THREE.Scene();
fixes threejs examples that use orbit controls
mattdesl_canvas-sketch
train
js,js
6a9f3db92330c83240f49cff50a6fdce9f2e270a
diff --git a/Minimal-J/src/main/java/org/minimalj/application/MjApplication.java b/Minimal-J/src/main/java/org/minimalj/application/MjApplication.java index <HASH>..<HASH> 100644 --- a/Minimal-J/src/main/java/org/minimalj/application/MjApplication.java +++ b/Minimal-J/src/main/java/org/minimalj/application/MjApplication.java @@ -94,7 +94,9 @@ public abstract class MjApplication { return null; } - public abstract Class<?>[] getSearchClasses(); + public Class<?>[] getSearchClasses() { + return new Class<?>[0]; + } public Page createDefaultPage(PageContext context) { return new EmptyPage(context);
MjApplication: Make default implementation for getSearchClasses so it doesn't need to be overridden for demo applications
BrunoEberhard_minimal-j
train
java
66abe3a04f5234ff699115feda7e3fadede9f246
diff --git a/keanu-project/src/main/java/io/improbable/keanu/plating/PlateBuilder.java b/keanu-project/src/main/java/io/improbable/keanu/plating/PlateBuilder.java index <HASH>..<HASH> 100644 --- a/keanu-project/src/main/java/io/improbable/keanu/plating/PlateBuilder.java +++ b/keanu-project/src/main/java/io/improbable/keanu/plating/PlateBuilder.java @@ -13,7 +13,7 @@ import io.improbable.keanu.vertices.VertexLabel; import io.improbable.keanu.vertices.VertexLabelException; /** - * PlateBuilder allows plates to constructed in steps + * PlateBuilder allows plates to be constructed in steps * * @param <T> The data type provided to user-provided plate * factory function, if building from data @@ -175,10 +175,7 @@ public class PlateBuilder<T> { throw new IllegalArgumentException("You must provide a base case for the Proxy Vertices - use withInitialState()"); } for (Vertex<?> proxy : proxyVertices) { - VertexLabel label = proxyMapping.get(proxy.getLabel()); - if (label == null) { - label = proxyMapping.get(proxy.getLabel().withoutOuterNamespace()); - } + VertexLabel label = proxyMapping.get(proxy.getLabel().withoutOuterNamespace()); if (label == null) { throw new VertexLabelException("Cannot find proxy mapping for " + proxy.getLabel()); }
remove unnecessary check for label with full namespace in Plate mapping
improbable-research_keanu
train
java
03d677492fddd6bbe313ba7beef63f87de0128a6
diff --git a/django_extensions/management/modelviz.py b/django_extensions/management/modelviz.py index <HASH>..<HASH> 100644 --- a/django_extensions/management/modelviz.py +++ b/django_extensions/management/modelviz.py @@ -159,13 +159,13 @@ def generate_dot(app_labels, **kwargs): # find primary key and print it first, ignoring implicit id if other pk exists pk = appmodel._meta.pk - if not appmodel._meta.abstract and pk in attributes: + if pk and not appmodel._meta.abstract and pk in attributes: add_attributes(pk) for field in attributes: if skip_field(field): continue - if field == pk: + if pk and field == pk: continue add_attributes(field)
Allow a model not to have a primary key. Fixes #<I>
django-extensions_django-extensions
train
py
e3556eeb20bd425fd3ae946ceb32ad4b98243b38
diff --git a/src/mui/detail/TabbedShowLayout.js b/src/mui/detail/TabbedShowLayout.js index <HASH>..<HASH> 100644 --- a/src/mui/detail/TabbedShowLayout.js +++ b/src/mui/detail/TabbedShowLayout.js @@ -1,4 +1,5 @@ -import React, { Component, PropTypes } from 'react'; +import React, { Component } from 'react'; +import PropTypes from 'prop-types'; import { connect } from 'react-redux'; import compose from 'recompose/compose'; import { Tabs, Tab } from 'material-ui/Tabs';
Fix warning in TabbedShowLayout
marmelab_react-admin
train
js
9dbb05ef63d7dd0f85e5a805484256de1d3b4fe4
diff --git a/test/ubiq/Array_Test.php b/test/ubiq/Array_Test.php index <HASH>..<HASH> 100644 --- a/test/ubiq/Array_Test.php +++ b/test/ubiq/Array_Test.php @@ -4,7 +4,7 @@ namespace Test\Ubiq; require_once( dirname( dirname( __DIR__ ) ) . '/vendor/autoload.php' ); -echo 'Ubiq ' . \Pixel418\Ubiq::VERSION . ' '; +echo 'Ubiq ' . \Pixel418\Ubiq::VERSION . ' tested with '; class Array_Test extends \PHPUnit_Framework_TestCase {
Add the Ubiq version in the test output
Elephant418_Ubiq
train
php
286fbf371c0b0c7f3a4ac3c61361c274f9f77603
diff --git a/cxx-squid/src/main/java/org/sonar/cxx/CxxLanguage.java b/cxx-squid/src/main/java/org/sonar/cxx/CxxLanguage.java index <HASH>..<HASH> 100644 --- a/cxx-squid/src/main/java/org/sonar/cxx/CxxLanguage.java +++ b/cxx-squid/src/main/java/org/sonar/cxx/CxxLanguage.java @@ -42,7 +42,7 @@ public class CxxLanguage extends AbstractLanguage { /** * cxx language name */ - public static final String NAME = "C++ (Community)"; + public static final String NAME = "CXX"; /** * Key of the file suffix parameter
rename CxxLanguage.NAME to CXX - "C++ (Community)" => "CXX" - in Issues / Rules there is the language name in brackets before the rule; old name was too long
SonarOpenCommunity_sonar-cxx
train
java
6908b21d885a7b7567fd34bd5f3dc6a9300c5638
diff --git a/docroot/modules/custom/ymca_blog_listing/src/Controller/YMCANewsEventsPageController.php b/docroot/modules/custom/ymca_blog_listing/src/Controller/YMCANewsEventsPageController.php index <HASH>..<HASH> 100644 --- a/docroot/modules/custom/ymca_blog_listing/src/Controller/YMCANewsEventsPageController.php +++ b/docroot/modules/custom/ymca_blog_listing/src/Controller/YMCANewsEventsPageController.php @@ -34,7 +34,7 @@ class YMCANewsEventsPageController extends ControllerBase { break; default: - \Drupal::logger('ymca_blog_listing')->alert(t('Not defined CT view.')); + throw new \Symfony\Component\HttpKernel\Exception\NotFoundHttpException(); } return [
[YMCA-<I>] Show 'not found' for news&events pages of not camps/locations
ymcatwincities_openy
train
php
dd75bdb069e3ee9ef0fa6773ad955c462867b76e
diff --git a/sprockets/sprockets.go b/sprockets/sprockets.go index <HASH>..<HASH> 100644 --- a/sprockets/sprockets.go +++ b/sprockets/sprockets.go @@ -12,6 +12,7 @@ package sprockets import ( "html/template" + "net/http" ) type AssetPipeline interface { @@ -23,6 +24,15 @@ type ViewHelper struct { AssetPipeline } +func (vh ViewHelper) ServeHTTP(w http.ResponseWriter, r *http.Request) { + c, err := vh.GetAssetContents(r.URL.Path[1:]) + if err != nil { + http.Error(w, err.Error(), 404) + } else { + w.Write(c) + } +} + func (vh *ViewHelper) StylesheetLinkTag(name string) (template.HTML, error) { url, err := vh.asset_url(name) return template.HTML(`<link href="` + template.HTMLEscaper(url) + `" rel="stylesheet" type="text/css">`), err
Support serving assets directly from the asset pipeline
99designs_goodies
train
go
798885950d98de32ff611cdf00c855cd5d0a2880
diff --git a/uvicorn/workers.py b/uvicorn/workers.py index <HASH>..<HASH> 100644 --- a/uvicorn/workers.py +++ b/uvicorn/workers.py @@ -20,10 +20,12 @@ class UvicornWorker(Worker): logger = logging.getLogger("uvicorn.error") logger.handlers = self.log.error_log.handlers logger.setLevel(self.log.error_log.level) + logger.propagate = False logger = logging.getLogger("uvicorn.access") logger.handlers = self.log.access_log.handlers logger.setLevel(self.log.access_log.level) + logger.propagate = False config_kwargs = { "app": None,
Don't propagate logs in Gunicorn worker (#<I>)
encode_uvicorn
train
py
9e959b0d84f7f4b88ae12aa97c28b757687a7bc4
diff --git a/src/Illuminate/Translation/FileLoader.php b/src/Illuminate/Translation/FileLoader.php index <HASH>..<HASH> 100755 --- a/src/Illuminate/Translation/FileLoader.php +++ b/src/Illuminate/Translation/FileLoader.php @@ -135,10 +135,13 @@ class FileLoader implements Loader { return collect(array_merge($this->jsonPaths, [$this->path])) ->reduce(function ($output, $path) use ($locale) { - return $this->files->exists($full = "{$path}/{$locale}.json") - ? array_merge($output, - json_decode($this->files->get($full), true) - ) : $output; + if ($this->files->exists($full = "{$path}/{$locale}.json")) { + $filecontent = json_decode($this->files->get($full), true); + if (!is_null($filecontent) && json_last_error() === 0) { + $output = array_merge($output, $filecontent); + } + } + return $output; }, []); }
additional check for loaded language file using json format * as the json file may contain invalid json this helps to ignore such files * just merges the language array when it's valid for the rest of the files * produced a php exception before, as the second parameter for array_merge was null due to invalid json in file
laravel_framework
train
php
e53012972915a2a02da5607b3c77c32959b1da8d
diff --git a/lib/Fakturoid.php b/lib/Fakturoid.php index <HASH>..<HASH> 100644 --- a/lib/Fakturoid.php +++ b/lib/Fakturoid.php @@ -143,17 +143,17 @@ class Fakturoid { /* Event */ public function get_events($options = NULL) { - return $this->get('/events.json') . $this->convert_options($options, array('subject_id', 'since', 'page')); + return $this->get('/events.json' . $this->convert_options($options, array('subject_id', 'since', 'page'))); } public function get_paid_events($options = NULL) { - return $this->get('/events/paid.json') . $this->convert_options($options, array('subject_id', 'since', 'page')); + return $this->get('/events/paid.json' . $this->convert_options($options, array('subject_id', 'since', 'page'))); } /* Todo */ public function get_todos($options = NULL) { - return $this->get('/todos.json') . $this->convert_options($options, array('subject_id', 'since', 'page')); + return $this->get('/todos.json' . $this->convert_options($options, array('subject_id', 'since', 'page'))); } /* Helper functions */
Fix URL construction in some methods. Closes #6.
fakturoid_fakturoid-php
train
php
cad4c74e98e2da7a8458a173da61fcc7382891a2
diff --git a/lib/stripe/handlers/customer.subscription.deleted.js b/lib/stripe/handlers/customer.subscription.deleted.js index <HASH>..<HASH> 100644 --- a/lib/stripe/handlers/customer.subscription.deleted.js +++ b/lib/stripe/handlers/customer.subscription.deleted.js @@ -1,6 +1,7 @@ 'use strict'; var models = require('../../models'); var sessionStore = require('../../app').sessionStore; +var Promise = require('rsvp').Promise; module.exports = function (data, callbackToStripe) { if (isCanceled(data)) { @@ -26,3 +27,17 @@ module.exports = function (data, callbackToStripe) { function isCanceled(obj) { return obj.status ? obj.status === 'canceled' : isCanceled(obj.data || obj.object); } +function removeProStatusFromDB (customer) { + return new Promise(function(reject, resolve) { + models.user.setProAccount(customer.user, false, function(err) { + if (err) { + return reject(err); + } + resolve(customer); + }); + }); +} + +function removeProStatusFromSession (customer) { + return sessionStore.set(customer.name, false); +}
Split the removal of pro from session and db into separate functions Both now use promises keeping flow control simple and less buggy
jsbin_jsbin
train
js
ac50c2fdfa2ff66a4b337b11f43ffa0b44683536
diff --git a/distutils/tests/test_register.py b/distutils/tests/test_register.py index <HASH>..<HASH> 100644 --- a/distutils/tests/test_register.py +++ b/distutils/tests/test_register.py @@ -287,7 +287,7 @@ class TestRegister(BasePyPIRCCommandTestCase): del register_module.input @unittest.skipUnless(docutils is not None, 'needs docutils') - def test_register_invalid_long_description(self): + def test_register_invalid_long_description(self, monkeypatch): description = ':funkie:`str`' # mimic Sphinx-specific markup metadata = { 'url': 'xxx', @@ -301,8 +301,7 @@ class TestRegister(BasePyPIRCCommandTestCase): cmd.ensure_finalized() cmd.strict = True inputs = Inputs('2', 'tarek', '[email protected]') - register_module.input = inputs - self.addCleanup(delattr, register_module, 'input') + monkeypatch.setattr(register_module, 'input', inputs, raising=False) with pytest.raises(DistutilsSetupError): cmd.run()
Replace addCleanup with monkeypatch.
pypa_setuptools
train
py
d9c753e7dab9d23976ab705923c3a4e633ee71d8
diff --git a/src/Plinth/Main.php b/src/Plinth/Main.php index <HASH>..<HASH> 100644 --- a/src/Plinth/Main.php +++ b/src/Plinth/Main.php @@ -536,6 +536,10 @@ class Main { $this->getUserService()->logout(); + //Strip the logout parameter & redirect to the original destination page + header('Location: ' . __BASE_URL . preg_replace('/(logout&|\?logout$|&logout$)/', '', Request::getRequestPath(__BASE, false))); + exit; + } }
A logout now redirects to the requested path but without the logout GET
Warsaalk_Plinth
train
php
2df13affb8fb4e5497f76a5312f15218902edb45
diff --git a/src/benchsuite/core/model/benchmark.py b/src/benchsuite/core/model/benchmark.py index <HASH>..<HASH> 100644 --- a/src/benchsuite/core/model/benchmark.py +++ b/src/benchsuite/core/model/benchmark.py @@ -28,7 +28,7 @@ from benchsuite.core.model.exception import ControllerConfigurationException class Benchmark: """ - the class that represents a benchmark test + A Benchmark """ @abstractmethod
testing the integration with readthedocs
benchmarking-suite_benchsuite-core
train
py
79b96a89c54e68dd055d7bc6df26622c064be3a8
diff --git a/src/main/java/io/github/lukehutch/fastclasspathscanner/FastClasspathScanner.java b/src/main/java/io/github/lukehutch/fastclasspathscanner/FastClasspathScanner.java index <HASH>..<HASH> 100644 --- a/src/main/java/io/github/lukehutch/fastclasspathscanner/FastClasspathScanner.java +++ b/src/main/java/io/github/lukehutch/fastclasspathscanner/FastClasspathScanner.java @@ -1481,7 +1481,8 @@ public class FastClasspathScanner { @Override public boolean filePathMatches(final Path absolutePath, final String relativePath) { - final boolean matched = relativePath.toLowerCase().endsWith(suffixToMatch); + final boolean matched = relativePath.endsWith(suffixToMatch) + || relativePath.toLowerCase().endsWith(suffixToMatch); if (matched && verbose) { Log.log(3, "File " + relativePath + " matched extension ." + extensionToMatch); }
Optimization: don't call toLowerCase if extension matches and is already lowercase
classgraph_classgraph
train
java
3acbe663af7dfbca05d598c8e3a7c12a2c54d336
diff --git a/lib/datalib.php b/lib/datalib.php index <HASH>..<HASH> 100644 --- a/lib/datalib.php +++ b/lib/datalib.php @@ -1039,11 +1039,20 @@ function fix_course_sortorder() { HAVING cc.coursecount <> COUNT(c.id)"; if ($updatecounts = $DB->get_records_sql($sql)) { + // categories with more courses than MAX_COURSES_IN_CATEGORY + $categories = array(); foreach ($updatecounts as $cat) { $cat->coursecount = $cat->newcount; + if ($cat->coursecount >= MAX_COURSES_IN_CATEGORY) { + $categories[] = $cat->id; + } unset($cat->newcount); $DB->update_record_raw('course_categories', $cat, true); } + if (!empty($categories)) { + $str = implode(', ', $categories); + debugging("The number of courses (category id: $str) has reached MAX_COURSES_IN_CATEGORY (" . MAX_COURSES_IN_CATEGORY . "), it will cause a sorting performance issue, please increase the value of MAX_COURSES_IN_CATEGORY in lib/datalib.php file. See tracker issue: MDL-25669", DEBUG_DEVELOPER); + } } // now make sure that sortorders in course table are withing the category sortorder ranges
MDL-<I>, fix_course_sortorder should check MAX_COURSE_CATEGORIES limit, and print debugging message when the number of courses in a category reach the limit
moodle_moodle
train
php
a9a992525c56d1886792e2568ec4a3880ad4c6ee
diff --git a/spec/licensee/content_helper_spec.rb b/spec/licensee/content_helper_spec.rb index <HASH>..<HASH> 100644 --- a/spec/licensee/content_helper_spec.rb +++ b/spec/licensee/content_helper_spec.rb @@ -70,6 +70,10 @@ RSpec.describe Licensee::ContentHelper do expect(mit.similarity(mit)).to be(100.0) end + it 'calculates simple delta for similarity' do + expect(subject.similarity(mit)).to be_within(1).of(3) + end + it 'calculates the hash' do content_hash = '9b4bed43726cf39e17b11c2942f37be232f5709a' expect(subject.content_hash).to eql(content_hash)
failing test for non-license content helpers erring out on similarity
licensee_licensee
train
rb
4aa4b18b66e002b8da7ae3537aef3cc2cade6185
diff --git a/eli5/sklearn/transform.py b/eli5/sklearn/transform.py index <HASH>..<HASH> 100644 --- a/eli5/sklearn/transform.py +++ b/eli5/sklearn/transform.py @@ -18,6 +18,7 @@ from eli5.sklearn.utils import get_feature_names as _get_feature_names # Feature selection: +@transform_feature_names.register(SelectorMixin) def _select_names(est, in_names=None): mask = est.get_support(indices=False) in_names = _get_feature_names(est, feature_names=in_names, @@ -33,7 +34,6 @@ try: _select_names = transform_feature_names.register(RandomizedLogisticRegression)(_select_names) except ImportError: # Removed in scikit-learn 0.21 pass -_select_names = transform_feature_names.register(SelectorMixin)(_select_names) # Scaling
Use decorator syntax for SelectorMixin
TeamHG-Memex_eli5
train
py
b3123271124c5338554a408cb61ca7a52b153107
diff --git a/src/js/pannellum.js b/src/js/pannellum.js index <HASH>..<HASH> 100644 --- a/src/js/pannellum.js +++ b/src/js/pannellum.js @@ -2472,12 +2472,23 @@ this.getConfig = function() { * @memberof Viewer * @instance * @param {Object} hs - The configuration for the hot spot + * @param {string} [sceneId] - Adds hot spot to specified scene if provided, else to current scene * @returns {Viewer} `this` - */ -this.addHotSpot = function(hs) { - createHotSpot(hs); - config.hotSpots.push(hs); - renderHotSpot(hs); + * @throws Throws an error if the scene ID is provided but invalid + */ +this.addHotSpot = function(hs, sceneId) { + if (sceneId === undefined || config.scene == sceneId) { + // Add to current scene + createHotSpot(hs); + config.hotSpots.push(hs); + renderHotSpot(hs); + } else { + // Add to a different scene + if (initialConfig.scenes.hasOwnProperty(sceneId)) + initialConfig.scenes[sceneId].hotSpots.push(hs); + else + throw 'Invalid scene ID!' + } return this; }
Extend API `addHotSpot` function such that hot spots can be added to other scenes besides the current scene.
mpetroff_pannellum
train
js
c435c82003fbdb6f421a0612abbf70ce5aea5013
diff --git a/src/Gerrie/Gerrie.php b/src/Gerrie/Gerrie.php index <HASH>..<HASH> 100644 --- a/src/Gerrie/Gerrie.php +++ b/src/Gerrie/Gerrie.php @@ -435,7 +435,7 @@ class Gerrie throw new \Exception('No projects found on "' . $host . '"!', 1363894633); } - $projectTransformer = TransformerFactory::getTransformer('Project', $this->isDebugFunctionalityEnables()); + $projectTransformer = TransformerFactory::getTransformer('Project', $this->isDebugFunctionalityEnabled()); $transformedProjects = []; foreach ($projects as $name => $project) { @@ -2204,7 +2204,7 @@ class Gerrie * * @return bool */ - public function isDebugFunctionalityEnables() + public function isDebugFunctionalityEnabled() { return $this->debug; }
Fixed typo in method name "isDebugFunctionalityEnables"
andygrunwald_Gerrie
train
php
5d49d39a7ee395234d6c06ee210705c26fad8b1d
diff --git a/web/concrete/startup/jobs.php b/web/concrete/startup/jobs.php index <HASH>..<HASH> 100644 --- a/web/concrete/startup/jobs.php +++ b/web/concrete/startup/jobs.php @@ -32,14 +32,12 @@ if(ENABLE_JOB_SCHEDULING) { } if(strlen($url)) { - echo $url; exit; $ch = curl_init($url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,1); curl_setopt($ch,CURLOPT_TIMEOUT,1); $res = curl_exec($ch); - } } }
Remove `exit` statement from startup/job Remove `exit` statement from startup/job Former-commit-id: b<I>c<I>bf8c<I>e<I>d6e2e<I>bdeb<I>
concrete5_concrete5
train
php
9cf4a25e7a1ed7f1818ec9676bcdd044f6f6a5c7
diff --git a/Tests/IntegrationTest.php b/Tests/IntegrationTest.php index <HASH>..<HASH> 100644 --- a/Tests/IntegrationTest.php +++ b/Tests/IntegrationTest.php @@ -14,7 +14,7 @@ namespace Geocoder\Provider\MaxMindBinary\Tests; use Geocoder\IntegrationTest\ProviderIntegrationTest; use Geocoder\Provider\MaxMindBinary\MaxMindBinary; -use Http\Client\HttpClient; +use Psr\Http\Client\ClientInterface; /** * @author Tobias Nyholm <[email protected]> @@ -45,7 +45,7 @@ class IntegrationTest extends ProviderIntegrationTest parent::setUpBeforeClass(); } - protected function createProvider(HttpClient $httpClient) + protected function createProvider(ClientInterface $httpClient) { return new MaxMindBinary(__DIR__.'/fixtures/GeoLiteCity.dat'); }
Expect a PSR-<I> client instead of a PHP-HTTP client (#<I>) * Expect a PSR-<I> client instead of a PHP-HTTP client * Update integration tests
geocoder-php_maxmind-binary-provider
train
php
389156d6ba1ebac95f690fa96ddc910fbc645c06
diff --git a/ugly/Poisson.php b/ugly/Poisson.php index <HASH>..<HASH> 100644 --- a/ugly/Poisson.php +++ b/ugly/Poisson.php @@ -8,7 +8,7 @@ * * use gburtini\Distributions\Poisson; * - * $poisson = new Poissin($lambda>0); + * $poisson = new Poisson($lambda>0); * $poisson->pdf($x) = [0,1] * $poisson->cdf($x) = [0,1] non-decreasing * $poisson::quantile($y in [0,1]) = [0,1] (aliased Poisson::icdf) @@ -18,10 +18,7 @@ * * Other Credits * ------------- - * Interface and structure all (C) Giuseppe Burtini. - * Some work derived (with permission/license) from jStat - Javascript Statistical Library (MIT licensed). - * Some work derived (with permission/license) from Python Core (PSL licensed). - * Some work, especially advice, provided by Graeme Douglas. + * Implementation by Frank Wikström. */ require_once dirname(__FILE__) . "/Distribution.php";
Adding credit to Frank Wikström for his work here.
gburtini_Probability-Distributions-for-PHP
train
php
ccd74afa6d24b370269c96bd55a2b982eda2cdc1
diff --git a/winrm/protocol.py b/winrm/protocol.py index <HASH>..<HASH> 100644 --- a/winrm/protocol.py +++ b/winrm/protocol.py @@ -402,7 +402,7 @@ class Protocol(object): See #open_shell @param string command_id: The command id on the remote machine. See #run_command - @param string stdin_input: The input unicode string or byte array to be sent. + @param string stdin_input: The input unicode string or byte string to be sent. @return: None """ if isinstance(stdin_input, text_type):
Change send std input function doc by a single word.
diyan_pywinrm
train
py
ffa104e5bf9cb2f14cf4abbb34bb6deab311cd30
diff --git a/lib/cached_resource/caching.rb b/lib/cached_resource/caching.rb index <HASH>..<HASH> 100644 --- a/lib/cached_resource/caching.rb +++ b/lib/cached_resource/caching.rb @@ -82,7 +82,11 @@ module CachedResource def cache_read(key) key = cache_key(Array(key)) unless key.is_a? String object = cached_resource.cache.read(key).try do |cache| - cache.dup.tap { |o| o.instance_variable_set(:@persisted, cache.persisted?) if cache.respond_to?(:persisted?) } + if cache.is_a? Enumerable + cache.map { |record| full_dup(record) } + else + full_dup(cache) + end end object && cached_resource.logger.info("#{CachedResource::Configuration::LOGGER_PREFIX} READ #{key}") object @@ -102,6 +106,14 @@ module CachedResource "#{name.parameterize.gsub("-", "/")}/#{arguments.join('/')}".downcase end + # Make a full duplicate of an ActiveResource record. + # Currently just dups the record then copies the persisted state. + def full_dup(record) + record.dup.tap do |o| + o.instance_variable_set(:@persisted, record.persisted?) + end + end + end end end
Refactor persistence-maintaining code
mhgbrown_cached_resource
train
rb
9c9a7d51a20eb74a9067f0d27f89d73d6a421ad6
diff --git a/test/shared/syncer.test.js b/test/shared/syncer.test.js index <HASH>..<HASH> 100644 --- a/test/shared/syncer.test.js +++ b/test/shared/syncer.test.js @@ -86,7 +86,7 @@ describe('syncer', function() { backboneSync.should.have.been.calledOnce; // Don't need to verify the options because they will be modified. // Test for the modification is lower. - backboneSync.should.have.been.calledWith('read', model, options); + backboneSync.should.have.been.calledWith('read', model); }); it('should get the prefixed API url', function () {
Oops, forgot to remove one argument in the test.
rendrjs_rendr
train
js
5d6f362bf1a1134a0199b3dd4faf0efdda9187ee
diff --git a/webpack.common.js b/webpack.common.js index <HASH>..<HASH> 100644 --- a/webpack.common.js +++ b/webpack.common.js @@ -47,17 +47,7 @@ module.exports = { library: ['NextcloudVue', '[name]'], umdNamedDefine: true }, - optimization: { - splitChunks: { - cacheGroups: { - vendor: { - test: /node_modules/, - chunks: "all", - filename: 'vendor[id].js', - } - } - } - }, + externals: { vue: { commonjs: 'vue',
Remove splitChunks as it breaks the full package
nextcloud_nextcloud-vue
train
js
8aa3f15d576650f30e20804367a60bf069f90445
diff --git a/tej/submission.py b/tej/submission.py index <HASH>..<HASH> 100644 --- a/tej/submission.py +++ b/tej/submission.py @@ -269,17 +269,22 @@ class RemoteQueue(object): cmd, " (stdout)" if get_output else "") chan.exec_command('/bin/sh -c %s' % shell_escape(cmd)) output = b'' - while not chan.exit_status_ready(): + while True: r, w, e = select.select([chan], [], []) - if chan in r: - if chan.recv_stderr_ready(): - data = chan.recv_stderr(1024) - if data: - server_err.append(data) - if chan.recv_ready(): - data = chan.recv(1024) - if get_output: - output += data + if chan not in r: + continue + recvd = False + while chan.recv_stderr_ready(): + data = chan.recv_stderr(1024) + server_err.append(data) + recvd = True + while chan.recv_ready(): + data = chan.recv(1024) + if get_output: + output += data + recvd = True + if not recvd and chan.exit_status_ready(): + break output = output.rstrip(b'\r\n') return chan.recv_exit_status(), output finally:
Fixes _call() dropping output after exit status If exit_status_ready() is True, we might still have some stdout or stderr messages in the queue.
VisTrails_tej
train
py
205eab97bf9c63602d3d0148f7dc356861be8f03
diff --git a/lib/delfos/neo4j/batch/execution.rb b/lib/delfos/neo4j/batch/execution.rb index <HASH>..<HASH> 100644 --- a/lib/delfos/neo4j/batch/execution.rb +++ b/lib/delfos/neo4j/batch/execution.rb @@ -59,6 +59,13 @@ module Delfos queries.length end + def retry_count + @retry_count ||= 0 + end + + attr_writer :retry_count + + private def perform_query(query, params) @@ -73,20 +80,23 @@ module Delfos check_retry_limit! if retrying Delfos.logger.error do - "Transaction expired - retrying batch. #{query_count} queries retry_count: #{@retry_count}" + "Transaction expired - retrying batch. #{query_count} queries retry_count: #{retry_count}" end reset_transaction! retry_batch! + + Delfos.logger.error do + "Batch retry successful" + end end def check_retry_limit! - @retry_count ||= 0 - @retry_count += 1 + self.retry_count += 1 - return if @retry_count <= 5 + return if self.retry_count <= 5 - @retry_count = 0 + self.retry_count = 0 Delfos.logger.error "Transaction expired - 5 retries failed aborting" raise end
refactor retry_count on batch/execution.rb
ruby-analysis_delfos
train
rb
defcd6074e525fffcc4509342fb2aada8dc6ba14
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index <HASH>..<HASH> 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -9,13 +9,12 @@ require 'rspec' require 'counter_culture' CI_TEST_RUN = (ENV['TRAVIS'] && 'TRAVIS') || (ENV['CIRCLECI'] && 'CIRCLE') || ENV["CI"] && 'CI' -SUPPRESS_MIGRATION_MESSAGES = !CI_TEST_RUN begin - was, ActiveRecord::Migration.verbose = ActiveRecord::Migration.verbose, false if SUPPRESS_MIGRATION_MESSAGES + was, ActiveRecord::Migration.verbose = ActiveRecord::Migration.verbose, false unless ENV['SHOW_MIGRATION_MESSAGES'] load "#{File.dirname(__FILE__)}/schema.rb" ensure - ActiveRecord::Migration.verbose = was if SUPPRESS_MIGRATION_MESSAGES + ActiveRecord::Migration.verbose = was unless ENV['SHOW_MIGRATION_MESSAGES'] end # Requires supporting files with custom matchers and macros, etc,
Hide migration messages unless env var set. Make CI and local parallel, but give an easy way to reveal if needed
magnusvk_counter_culture
train
rb
588eeb1d4244e764bde69cec39a99883c72249ed
diff --git a/test/www/js/thali_main.js b/test/www/js/thali_main.js index <HASH>..<HASH> 100644 --- a/test/www/js/thali_main.js +++ b/test/www/js/thali_main.js @@ -28,6 +28,12 @@ // (function () { + var doExit = function () { + // This is to inform the CI system the process exits. + console.log('****TEST_LOGGER:[PROCESS_ON_EXIT_FAILED]****'); + navigator.app.exitApp(); + }; + var inter = setInterval(function () { if (typeof jxcore == 'undefined') { return; } @@ -42,7 +48,7 @@ loadMainFile(); }, function (error) { console.log('Location permission not granted. Error: ' + error); - navigator.app.exitApp(); + doExit(); }); } else { loadMainFile(); @@ -54,7 +60,7 @@ jxcore('app.js').loadMainFile(function (ret, err) { if (err) { console.log('App.js file failed to load : ' + JSON.stringify(err)); - navigator.app.exitApp(); + doExit(); } else { jxcore_ready(); }
Inform CI if we need to exit the app
thaliproject_Thali_CordovaPlugin
train
js
638df9d47b95f73e7ebf7682127fa0fb0d363659
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -59,6 +59,7 @@ setup( include_package_data=True, platforms='any', test_suite='sandman.test.test_sandman', + zip_safe=False, classifiers = [ 'Programming Language :: Python', 'Development Status :: 4 - Beta',
Set sandman as not zip_safe since it expects templates to be in specific location. Closes #<I>
jeffknupp_sandman
train
py
58af14a839f48b82bb2fcccde9075917742aa3f0
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -13,9 +13,14 @@ if sys.argv[-1] == 'publish': os.system('python setup.py sdist upload') sys.exit() -with open('README.rst') as f: - long_description = f.read() +def open_file(filename): + """Open and read the file *filename*.""" + with open(filename) as f: + return f.read() + +readme = open_file('README.rst') +history = open_file('CHANGES.rst').replace('.. :changelog:', '') setup( name='dragonmapper', @@ -25,7 +30,7 @@ setup( url='https://github.com/tsroten/dragonmapper', description=('Identification and conversion functions for Chinese ' 'text processing'), - long_description=long_description, + long_description=readme + '\n\n' + history, platforms='any', classifiers=[ 'Programming Language :: Python',
Adds change log to long description.
tsroten_dragonmapper
train
py
d08eeb39468740085f1488e7e031e8122dba0124
diff --git a/gulpfile.js b/gulpfile.js index <HASH>..<HASH> 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -30,3 +30,15 @@ gulp.task("watch", function() { }) gulp.task("default", ["scripts", "watch"]) + +var buildBranch = require("buildbranch") +gulp.task("publish", function(cb) { + buildBranch({folder: "src"} + , function(err) { + if (err) { + throw err + } + console.log(pkg.name + " published.") + cb() + }) +})
Add publish task (for gh-pages)
MoOx_parallaxify
train
js
680a4ee037b00c39187fff65335aa919a10c5259
diff --git a/releaf-i18n_database/app/controllers/releaf/i18n_database/translations_controller.rb b/releaf-i18n_database/app/controllers/releaf/i18n_database/translations_controller.rb index <HASH>..<HASH> 100644 --- a/releaf-i18n_database/app/controllers/releaf/i18n_database/translations_controller.rb +++ b/releaf-i18n_database/app/controllers/releaf/i18n_database/translations_controller.rb @@ -72,10 +72,6 @@ module Releaf::I18nDatabase end end - def searchable_fields - true - end - def import_view @import = true @breadcrumbs << { name: I18n.t("import", scope: controller_scope_name) }
Remove unused `searchable_fields` method from translation controller
cubesystems_releaf
train
rb
19960099587f3373c6770610b88cd91852887d9a
diff --git a/src/helpers/Manifest.php b/src/helpers/Manifest.php index <HASH>..<HASH> 100644 --- a/src/helpers/Manifest.php +++ b/src/helpers/Manifest.php @@ -217,9 +217,6 @@ EOT; { // Get the module entry $module = self::getModuleEntry($config, $moduleName, $type, $soft); - // Determine whether we should use the devServer for HMR or not - $devMode = Craft::$app->getConfig()->getGeneral()->devMode; - self::$isHot = ($devMode && $config['useDevServer']); if ($module !== null) { $prefix = self::$isHot ? $config['devServer']['publicPath']
Revert a PR that caused Twigpack to no longer gracefully fall back on locally built assets if the `webpack-dev-server` is not running
nystudio107_craft-twigpack
train
php
0436b57f83db95fe04c36a9e6e0e223636cc7de7
diff --git a/ocrd/ocrd/task_sequence.py b/ocrd/ocrd/task_sequence.py index <HASH>..<HASH> 100644 --- a/ocrd/ocrd/task_sequence.py +++ b/ocrd/ocrd/task_sequence.py @@ -41,7 +41,7 @@ class ProcessorTask(): def validate(self): if not which(self.executable): raise Exception("Executable not found in PATH: %s" % self.executable) - result = run([self.executable, '--dump-json'], stdout=PIPE) + result = run([self.executable, '--dump-json'], stdout=PIPE, check=True, universal_newlines=True) ocrd_tool_json = json.loads(result.stdout) # TODO check for required parameters in ocrd_tool if self.parameter_path:
subprocess.run with text response in python <= <I>
OCR-D_core
train
py
167f3fae368d4c27b250e086ef20a67994fc16a3
diff --git a/mod/forum/lib.php b/mod/forum/lib.php index <HASH>..<HASH> 100644 --- a/mod/forum/lib.php +++ b/mod/forum/lib.php @@ -995,7 +995,6 @@ function forum_search_posts($searchterms, $courseid, $page=0, $recordsperpage=50 $onlyvisibletable = ", {$CFG->prefix}course_modules cm"; if ($groupid) { $separategroups = SEPARATEGROUPS; - //$selectgroup = " AND (cm.groupmode <> '$separategroups' OR d.groupid = '$groupid')"; $selectgroup = " AND ( NOT (cm.groupmode='$separategroups'". " OR (c.groupmode='$separategroups' AND c.groupmodeforce='1') )". " OR d.groupid = '$groupid')";
Removing commented line from previous commit. (SE)
moodle_moodle
train
php
cfd3ecffedf0f2b6be18a66657706adeec236cad
diff --git a/mardao-core/src/main/java/net/sf/mardao/core/dao/DaoImpl.java b/mardao-core/src/main/java/net/sf/mardao/core/dao/DaoImpl.java index <HASH>..<HASH> 100644 --- a/mardao-core/src/main/java/net/sf/mardao/core/dao/DaoImpl.java +++ b/mardao-core/src/main/java/net/sf/mardao/core/dao/DaoImpl.java @@ -780,8 +780,18 @@ public abstract class DaoImpl<T, ID extends Serializable, @Override public T getDomain(Future<?> future) { if (null != future) { - try { - final T domain = coreToDomain((E) future.get()); + try { + final Object result = future.get(); + if (null == result) { + return null; + } + + // if it was found in cache, it will be the Domain object, not core Entity + if (this.persistentClass.equals(result.getClass())) { + return (T) result; + } + + final T domain = coreToDomain((E) result); if (memCacheEntities && null != domain) { final Object parentKey = getParentKey(domain); final ID simpleKey = getSimpleKey(domain);
#6 cached future value is not Entity but T
sosandstrom_mardao
train
java
6d0d5c8bbd2904387e99fb5cc84cc1a3e35dcdf1
diff --git a/src/Chronos/Scaffolding/app/Models/Setting.php b/src/Chronos/Scaffolding/app/Models/Setting.php index <HASH>..<HASH> 100644 --- a/src/Chronos/Scaffolding/app/Models/Setting.php +++ b/src/Chronos/Scaffolding/app/Models/Setting.php @@ -16,6 +16,13 @@ class Setting extends Model ]; /** + * The primary key for the model. + * + * @var string + */ + protected $primaryKey = null; + + /** * Indicates that the model should not be timestamped * * @var bool
Added .gitignore & removed primary key from settings model
c4studio_chronos
train
php
ffbc56cab3f1af7b1476b9815f7eadf6af0330d3
diff --git a/natsort/natsort.py b/natsort/natsort.py index <HASH>..<HASH> 100644 --- a/natsort/natsort.py +++ b/natsort/natsort.py @@ -712,4 +712,4 @@ def natcmp(x, y, alg=0, **kwargs): -1 """ key = natsort_keygen(alg=alg, **kwargs) - return cmp(key(x), key(y)) + return (key(x) > key(y)) - (key(x) < key(y))
Used the official workaround for cmp in Python3
SethMMorton_natsort
train
py
1d325fc7097347c5e5030032654980fba67779bf
diff --git a/services/OauthService.php b/services/OauthService.php index <HASH>..<HASH> 100644 --- a/services/OauthService.php +++ b/services/OauthService.php @@ -244,6 +244,27 @@ class OauthService extends BaseApplicationComponent { return Oauth_ProviderInfosModel::populateModel($record); } + else + { + $allProviderInfos = craft()->config->get('providerInfos', 'oauth'); + + if(isset($allProviderInfos[$handle])) + { + $attributes = []; + + if(isset($allProviderInfos[$handle]['clientId'])) + { + $attributes['clientId'] = $allProviderInfos[$handle]['clientId']; + } + + if(isset($allProviderInfos[$handle]['clientSecret'])) + { + $attributes['clientSecret'] = $allProviderInfos[$handle]['clientSecret']; + } + + return Oauth_ProviderInfosModel::populateModel($attributes); + } + } } /**
OauthService::getProviderInfos() now tries to use clientId/clientSecret from config files when no record is found
dukt_oauth
train
php
c5024298fcc58b20dd77212c0cb7446789beed6c
diff --git a/src/java/com/threerings/parlor/turn/server/TurnGameManagerDelegate.java b/src/java/com/threerings/parlor/turn/server/TurnGameManagerDelegate.java index <HASH>..<HASH> 100644 --- a/src/java/com/threerings/parlor/turn/server/TurnGameManagerDelegate.java +++ b/src/java/com/threerings/parlor/turn/server/TurnGameManagerDelegate.java @@ -200,10 +200,6 @@ public class TurnGameManagerDelegate extends GameManagerDelegate } // find the next occupied active player slot - // - // FIXME: This might be a player that has state PLAYER_LEFT_GAME. - // It seems possible to make the GameManager track the active - // player count, not just the player count, and ignore int size = _turnGame.getPlayers().length; int oturnIdx = _turnIdx; do {
Fixme was fixed implicitly a while back; just cleaning up comments. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@<I> <I>f4-<I>e9-<I>-aa3c-eee0fc<I>fb1
threerings_narya
train
java
2f42e3b3e7046a891f0fef6f92ebafbd46c4f0dc
diff --git a/v2/server.go b/v2/server.go index <HASH>..<HASH> 100644 --- a/v2/server.go +++ b/v2/server.go @@ -227,18 +227,22 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) { // Extract the result to error if needed. var errResult error - if !errValue[0].IsNil() { - errResult = errValue[0].Interface().(error) + statusCode := 200 + errInter := errValue[0].Interface() + if errInter != nil { + statusCode = 400 + errResult = errInter.(error) } // Prevents Internet Explorer from MIME-sniffing a response away // from the declared content-type w.Header().Set("x-content-type-options", "nosniff") + // Encode the response. if errResult == nil { codecReq.WriteResponse(w, reply.Interface()) } else { - codecReq.WriteError(w, 400, errResult) + codecReq.WriteError(w, statusCode, errResult) } // Call the registered After Function @@ -247,7 +251,7 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) { Request: r, Method: method, Error: errResult, - StatusCode: 200, + StatusCode: statusCode, }) } }
Pass the correct status code to AfterFunc We're passing a <I> even when we respond <I> to the client.
gorilla_rpc
train
go
d72aefd6594421806ccd8d1c8dc054fe570ab56f
diff --git a/rpc_string_parser.php b/rpc_string_parser.php index <HASH>..<HASH> 100644 --- a/rpc_string_parser.php +++ b/rpc_string_parser.php @@ -34,7 +34,23 @@ class rpc_string_parser private function GetAllCallVariations($callee) { $lazy = $this->FormCallable($callee); - $callee[] = ["Reserve", []]; + + // Greedy also inherit last token arguments: + // api/main(5) become /api/main/Reserve(5) + // not /api/main(5)/Reserve which is obnoxious + + $last = array_pop($callee); + if (is_string($last)) + { + $callee[] = $last; + $callee[] = "Reserve"; + } + else + { + $callee[] = $last[0]; + $callee[] = ["Reserve", $last[1]]; + } + $greedy = $this->FormCallable($callee); $ret = [];
Improve greedy rpc object resolving
phoxy_phoxy
train
php
fe8a65ca00a1729fc7920a705c6114273947c5cc
diff --git a/tests/test_scheduler.py b/tests/test_scheduler.py index <HASH>..<HASH> 100644 --- a/tests/test_scheduler.py +++ b/tests/test_scheduler.py @@ -234,7 +234,7 @@ class TestScheduler(unittest.TestCase): 'url': 'url' }) time.sleep(0.1) - self.assertEqual(self.rpc.size(), 0) + self.assertEqual(self.rpc.size(), 1) def test_50_taskdone_error_no_track(self): self.status_queue.put({ @@ -243,7 +243,7 @@ class TestScheduler(unittest.TestCase): 'url': 'url' }) time.sleep(0.1) - self.assertEqual(self.rpc.size(), 0) + self.assertEqual(self.rpc.size(), 1) self.status_queue.put({ 'taskid': 'taskid', 'project': 'test_project', @@ -251,7 +251,7 @@ class TestScheduler(unittest.TestCase): 'track': {} }) time.sleep(0.1) - self.assertEqual(self.rpc.size(), 0) + self.assertEqual(self.rpc.size(), 1) def test_60_taskdone_failed_retry(self): self.status_queue.put({
fix test as task_queue contain processing tasks now
binux_pyspider
train
py
870dd4ea7699134c12c2ae18e3bd122e8cde4dbf
diff --git a/test/test_motor_client.py b/test/test_motor_client.py index <HASH>..<HASH> 100644 --- a/test/test_motor_client.py +++ b/test/test_motor_client.py @@ -165,7 +165,7 @@ class MotorClientTest(MotorTest): self.assertEqual(cx.max_pool_size, 100) cx.close() - @gen_test + @gen_test(timeout=30) def test_high_concurrency(self): yield self.make_test_data()
Longer timeout for test_high_concurrency.
mongodb_motor
train
py
e01080f1667f8f3f52088bbcda18e9f741f5791c
diff --git a/backend/scrapers/classes/differentCollegeUrls.js b/backend/scrapers/classes/differentCollegeUrls.js index <HASH>..<HASH> 100644 --- a/backend/scrapers/classes/differentCollegeUrls.js +++ b/backend/scrapers/classes/differentCollegeUrls.js @@ -92,7 +92,7 @@ 'https://infobear.bridgew.edu/BANP/bwckschd.p_disp_dyn_sched', 'https://new-sis-app.sph.harvard.edu:9010/prod/bwckschd.p_disp_dyn_sched', // This is Harvard's School of public health, not the Undergraduate College. 'https://novasis.villanova.edu/pls/bannerprd/bwckschd.p_disp_dyn_sched', - 'https://www.bannerssb.bucknell.edu/ERPPRD/bwckctlg.p_disp_dyn_ctlg' + 'https://www.bannerssb.bucknell.edu/ERPPRD/bwckschd.p_disp_dyn_sched' ]; // https://ssb.vcu.edu/proddad/bwckschd.p_disp_dyn_sched
"Fixed bucknell url"
ryanhugh_searchneu
train
js
3c3826ab8b6630f968282ee4dbab3e61f6d2e7ed
diff --git a/cli/log.go b/cli/log.go index <HASH>..<HASH> 100644 --- a/cli/log.go +++ b/cli/log.go @@ -21,7 +21,7 @@ usage: flynn log [-f] [-j <id>] [-n <lines>] [-r] [-s] [-t <type>] Stream log for an app. Options: - -f, --follow stream new lines after printing log buffer + -f, --follow stream new lines -j, --job=<id> filter logs to a specific job ID -n, --number=<lines> return at most n lines from the log buffer -r, --raw-output output raw log messages with no prefix
cli: Update log usage --follow doesn't print the backlog, --lines can be used to do so
flynn_flynn
train
go
0cc74f7bcf12a2a9a6382f94459a29ef1b35c8cd
diff --git a/src/org/zoodb/api/impl/ZooPC.java b/src/org/zoodb/api/impl/ZooPC.java index <HASH>..<HASH> 100644 --- a/src/org/zoodb/api/impl/ZooPC.java +++ b/src/org/zoodb/api/impl/ZooPC.java @@ -24,6 +24,7 @@ import javax.jdo.ObjectState; import javax.jdo.listener.ClearCallback; import org.zoodb.api.ZooInstanceEvent; +import org.zoodb.internal.GenericObject; import org.zoodb.internal.Node; import org.zoodb.internal.Session; import org.zoodb.internal.ZooClassDef; @@ -179,7 +180,11 @@ public abstract class ZooPC { break; case HOLLOW_PERSISTENT_NONTRANSACTIONAL: //refresh first, then make dirty - zooActivateRead(); + if (getClass() == GenericObject.class) { + ((GenericObject)this).activateRead(); + } else { + zooActivateRead(); + } jdoZooMarkDirty(); break; default:
Fixed wrong call to zooActivateRead() on generic objects
tzaeschke_zoodb
train
java
b19876d98300f0e1d8cbb990b5bf7ffedc03e74b
diff --git a/buildbot/status/web/logs.py b/buildbot/status/web/logs.py index <HASH>..<HASH> 100644 --- a/buildbot/status/web/logs.py +++ b/buildbot/status/web/logs.py @@ -65,7 +65,7 @@ class TextLog(Resource): if not self.asText: # jinja only works with unicode, or pure ascii, so assume utf-8 in logs if not isinstance(entry, unicode): - entry = unicode(entry, 'utf-8') + entry = unicode(entry, 'utf-8', 'replace') html_entries.append(dict(type = builder.ChunkTypes[type], text = entry, is_header = is_header))
Try and treat log files as UTF-8 encoded, but fallback to replacing unknown characters with placeholders.
buildbot_buildbot
train
py
a8e84cb47f4aea1aacc6231ed791770e6dc07bfb
diff --git a/index.js b/index.js index <HASH>..<HASH> 100644 --- a/index.js +++ b/index.js @@ -8,6 +8,13 @@ module.exports = { included: function(app, parentAddon) { var target = (parentAddon || app); + // necessary for nested usage + // parent addon should call `this._super.included.apply(this, arguments);` + if (target.app) { + target = target.app; + } + + this.app = target; this._super.included.apply(this, arguments); target.import('vendor/ember-palette.css');
Actually fix nested usage Also add a tip for consumers
knownasilya_ember-palette
train
js
5950656de3340f0c2c2df597202d76001da0306e
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100755 --- a/setup.py +++ b/setup.py @@ -40,7 +40,7 @@ class PyTest(test.test): def finalize_options(self): test.test.finalize_options(self) - self.test_args = ['-x', "tests"] + self.test_args = ['-x', "tests/mobly"] self.test_suite = True def run_tests(self):
Fix pytest warning when run via setup.py test (#<I>)
google_mobly
train
py
427b51d8239c586fea76507f0fe79010d3974110
diff --git a/salt/utils/network.py b/salt/utils/network.py index <HASH>..<HASH> 100644 --- a/salt/utils/network.py +++ b/salt/utils/network.py @@ -35,6 +35,14 @@ from salt.ext.six.moves import range # pylint: disable=import-error,redefined-b from salt.utils.decorators.jinja import jinja_filter from salt.utils.versions import LooseVersion +try: + import salt.utils.win_network + + WIN_NETWORK_LOADED = True +except ImportError: + WIN_NETWORK_LOADED = False + + if salt.utils.platform.is_windows(): # inet_pton does not exist in Windows, this is a workaround from salt.ext import win_inet_pton # pylint: disable=unused-import @@ -1053,6 +1061,9 @@ def win_interfaces(): """ Obtain interface information for Windows systems """ + if WIN_NETWORK_LOADED is False: + # Let's throw the ImportException again + import salt.utils.win_network return salt.utils.win_network.get_interface_info()
Get a chance for the import error to buble up
saltstack_salt
train
py
3ae7eca3928d5dd9d0c93e61ceedc38f60573eb5
diff --git a/spec/unit/indirector/ldap.rb b/spec/unit/indirector/ldap.rb index <HASH>..<HASH> 100755 --- a/spec/unit/indirector/ldap.rb +++ b/spec/unit/indirector/ldap.rb @@ -113,15 +113,25 @@ describe Puppet::Indirector::Ldap do describe "when connecting to ldap" do confine "LDAP is not available" => Puppet.features.ldap? + it "should create and start a Util::Ldap::Connection instance" do + conn = mock 'connection', :connection => "myconn", :start => nil + Puppet::Util::Ldap::Connection.expects(:instance).returns conn + + @searcher.connection.should == "myconn" + end + it "should only create the ldap connection when asked for it the first time" do - @searcher.connection.should equal(@searcher.connection) + conn = mock 'connection', :connection => "myconn", :start => nil + Puppet::Util::Ldap::Connection.expects(:instance).returns conn + + @searcher.connection end - it "should create and start a Util::Ldap::Connection instance" do + it "should cache the connection" do conn = mock 'connection', :connection => "myconn", :start => nil Puppet::Util::Ldap::Connection.expects(:instance).returns conn - @searcher.connection.should == "myconn" + @searcher.connection.should equal(@searcher.connection) end end
Fixing an ldap connectivity test
puppetlabs_puppet
train
rb
ca4ae92b28efb96b16c87e7fe5b1516489d472dc
diff --git a/spyder/utils/encoding.py b/spyder/utils/encoding.py index <HASH>..<HASH> 100644 --- a/spyder/utils/encoding.py +++ b/spyder/utils/encoding.py @@ -231,8 +231,12 @@ def write(text, filename, encoding='utf-8', mode='wb', overwrite=True): Return (eventually new) encoding """ text, encoding = encode(text, encoding) - with atomic_write(filename, overwrite=overwrite, mode=mode) as textfile: - textfile.write(text) + if 'a' in mode: + with open(filename, mode) as textfile: + textfile.write(text) + else: + with atomic_write(filename, overwrite=overwrite, mode=mode) as textfile: + textfile.write(text) return encoding
Encoding: Handle append operations (write function)
spyder-ide_spyder
train
py
4d5de8a5defd464652e4c5273895271f06773ff3
diff --git a/src/index.js b/src/index.js index <HASH>..<HASH> 100644 --- a/src/index.js +++ b/src/index.js @@ -90,7 +90,7 @@ function getKarmaFiles(files, mappings) { .values() .flatten() .value(), - exclude: _.result(_.findWhere(karmaFiles, { type: 'ignore' }), 'files') + exclude: _.result(_.findWhere(karmaFiles, { type: 'ignore' }), 'files', []) }; }
Karma: when there are no ignored files, set the exclude config property to empty erray
fvanwijk_testRunnerConfig
train
js
cdaa21c5225df78f3f5f34ffc3b1ac8e7e686e6b
diff --git a/area4/util/__init__.py b/area4/util/__init__.py index <HASH>..<HASH> 100644 --- a/area4/util/__init__.py +++ b/area4/util/__init__.py @@ -14,7 +14,4 @@ def check(internal_name): :return: If __name__ is '__main__' (boolean) :rtype: bool """ - if internal_name == "__main__": - return True - else: - return False + return internal_name is "__main__" diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -6,7 +6,7 @@ with open("README.md", "r") as fh: long_description = fh.read() # Package version: -version = "2.0.6" +version = "2.0.7" setuptools.setup( name="area4",
Fixed an issue from CodeFactor
area4lib_area4
train
py,py
23e6f65156256b45fe55c1508ae7e20303831a03
diff --git a/patroni/postgresql.py b/patroni/postgresql.py index <HASH>..<HASH> 100644 --- a/patroni/postgresql.py +++ b/patroni/postgresql.py @@ -804,8 +804,8 @@ class Postgresql(object): self._replace_pg_hba() self.resolve_connection_addresses() - opts = {p: self._server_parameters[p] for p in self.CMDLINE_OPTIONS if p in self._server_parameters} - options = ['--{0}={1}'.format(p, v) for p, v in opts.items()] + options = ['--{0}={1}'.format(p, self._server_parameters[p]) for p in self.CMDLINE_OPTIONS + if p in self._server_parameters and p != 'wal_keep_segments'] start_initiated = time.time()
Don't wal_keep_segments as command line argument to postgres (#<I>) It make it not possible to change it without restart. Fixes <URL>
zalando_patroni
train
py
390b197d51e562a5d63088601db98e441c227ca8
diff --git a/src/Picqer/Financials/Exact/SalesEntry.php b/src/Picqer/Financials/Exact/SalesEntry.php index <HASH>..<HASH> 100644 --- a/src/Picqer/Financials/Exact/SalesEntry.php +++ b/src/Picqer/Financials/Exact/SalesEntry.php @@ -22,6 +22,7 @@ * @property String $Description Description. Can be different for header and lines * @property Int16 $Status Status: 5 = Rejected, 20 = Open, 50 = Processed * @property DateTime $PaymentCondition The due date for payments. This date is calculated based on the EntryDate and the Paymentcondition + * @property String $PaymentReference The reference in PSP system */ class SalesEntry extends Model {
Missing doc PaymentReference was missing
picqer_exact-php-client
train
php
2df09cced72a91e6f38e9f8585576d05f4c3af4c
diff --git a/paramz/optimization/optimization.py b/paramz/optimization/optimization.py index <HASH>..<HASH> 100644 --- a/paramz/optimization/optimization.py +++ b/paramz/optimization/optimization.py @@ -64,7 +64,7 @@ class Optimizer(object): return diagnostics def __getstate__(self): - return {} + return self.__dict__ class opt_tnc(Optimizer):
return the optimization object in dict form with Optimize.__getstate__()
sods_paramz
train
py
f8d587156798a694e5cfbf3afbed7d0beb2a8706
diff --git a/handler/src/test/java/io/netty/handler/ssl/SniHandlerTest.java b/handler/src/test/java/io/netty/handler/ssl/SniHandlerTest.java index <HASH>..<HASH> 100644 --- a/handler/src/test/java/io/netty/handler/ssl/SniHandlerTest.java +++ b/handler/src/test/java/io/netty/handler/ssl/SniHandlerTest.java @@ -368,10 +368,12 @@ public class SniHandlerTest { ch.close(); - // When the channel is closed the SslHandler will write an empty buffer to the channel. - ByteBuf buf = ch.readOutbound(); - if (buf != null) { - assertFalse(buf.isReadable()); + // Consume all the outbound data that may be produced by the SSLEngine. + for (;;) { + ByteBuf buf = ch.readOutbound(); + if (buf == null) { + break; + } buf.release(); }
Don't depend on implementation details of SSLEngine in SniHandlerTest (#<I>) Motivation: In SniHandlerTest we depended on implementation details of the SSLEngine. We should better not doing this Modifications: Just release all outbound data Result: Dont depend on implementation details
netty_netty
train
java
c7ff3627e44775d6128050eee7b486eadf8a8496
diff --git a/src/Database/Schema/Schema.php b/src/Database/Schema/Schema.php index <HASH>..<HASH> 100644 --- a/src/Database/Schema/Schema.php +++ b/src/Database/Schema/Schema.php @@ -60,10 +60,14 @@ class Schema extends \DreamFactory\Core\Database\Schema\Schema /** * @inheritdoc */ - public function createTable($table, $schema, $options = null) + protected function createTable($table, $options) { - if (!is_array($options)) { - $options = []; + if (empty($tableName = array_get($table, 'name'))) { + throw new \Exception("No valid name exist in the received table schema."); + } + + $options = []; + if (!empty($native = array_get($table, 'native'))) { } return $this->connection->getMongoDB()->createCollection($table, $options); @@ -72,7 +76,7 @@ class Schema extends \DreamFactory\Core\Database\Schema\Schema /** * @inheritdoc */ - protected function updateTable($table_name, $schema) + protected function updateTable($table, $changes) { // nothing to do here }
change base create and update table methods to allow for native settings
dreamfactorysoftware_df-mongodb
train
php
30936a3c772acc1c92448ea759671a709b0ace8b
diff --git a/includes/class-freemius.php b/includes/class-freemius.php index <HASH>..<HASH> 100755 --- a/includes/class-freemius.php +++ b/includes/class-freemius.php @@ -5530,7 +5530,7 @@ * * @param bool $is_enabled */ - private function update_extensions_tracking_flag( $is_enabled ) { + function update_extensions_tracking_flag( $is_enabled ) { $this->_storage->store( 'is_extensions_tracking_allowed', $is_enabled ); }
Allow developers to override the extension tracking flag as they wish.
Freemius_wordpress-sdk
train
php
766e1aa42fe50a29c42c952dbb15f1dc8bf248ac
diff --git a/components/cdn.js b/components/cdn.js index <HASH>..<HASH> 100644 --- a/components/cdn.js +++ b/components/cdn.js @@ -96,9 +96,9 @@ SteamUser.prototype.getDepotDecryptionKey = function(appID, depotID, callback) { var key = body.depot_encryption_key.toBuffer(); var file = Buffer.concat([new Buffer(4), key]); file.writeUInt32LE(Math.floor(Date.now() / 1000), 0); - self.storage.writeFile("depot_key_" + appID + "_" + depotID + ".bin", file); - - callback(null, body.depot_encryption_key.toBuffer()); + self.storage.writeFile("depot_key_" + appID + "_" + depotID + ".bin", file, function() { + callback(null, body.depot_encryption_key.toBuffer()); + }); }); }); };
Call callback only after writing to disk to avoid broken writes
DoctorMcKay_node-steam-user
train
js
8276492a5c28be9a75df02de20510bbfc9a06e45
diff --git a/warehouse/legacy/api/pypi.py b/warehouse/legacy/api/pypi.py index <HASH>..<HASH> 100644 --- a/warehouse/legacy/api/pypi.py +++ b/warehouse/legacy/api/pypi.py @@ -35,7 +35,6 @@ from warehouse.packaging.interfaces import IFileStorage from warehouse.packaging.models import ( Project, Release, Dependency, DependencyKind, Role, File, Filename, ) -from warehouse.sessions import uses_session from warehouse.utils.http import require_POST @@ -414,10 +413,13 @@ class MetadataForm(forms.Form): ) -@view_config( - route_name="legacy.api.pypi.file_upload", - decorator=[require_POST, csrf_exempt, uses_session], -) +# TODO: Uncomment the below code once the upload view is safe to be used on +# warehouse.python.org. For now, we'll disable it so people can't use +# Warehouse to upload and get broken or not properly validated data. +# @view_config( +# route_name="legacy.api.pypi.file_upload", +# decorator=[require_POST, csrf_exempt, uses_session], +# ) def file_upload(request): # Before we do anything, if their isn't an authenticated user with this # request, then we'll go ahead and bomb out.
Disable the upload view until we finish it
pypa_warehouse
train
py
bc5315a8fb82830a1966550e00a318da1c43f592
diff --git a/spec/netsuite/records/basic_record_spec.rb b/spec/netsuite/records/basic_record_spec.rb index <HASH>..<HASH> 100644 --- a/spec/netsuite/records/basic_record_spec.rb +++ b/spec/netsuite/records/basic_record_spec.rb @@ -34,6 +34,7 @@ describe 'basic records' do NetSuite::Records::ContactRole, NetSuite::Records::PaymentItem, NetSuite::Records::CreditMemo, + NetSuite::Records::GiftCertRedemption, ] }
Adds NetSuite::Records::GiftCertRedemption to the basic_record_list in the basic_record_spec.
NetSweet_netsuite
train
rb
5648411db284d9f5b6d9827e1ae72a4cbe1b8cb0
diff --git a/ui/src/shared/components/DatabaseDropdown.js b/ui/src/shared/components/DatabaseDropdown.js index <HASH>..<HASH> 100644 --- a/ui/src/shared/components/DatabaseDropdown.js +++ b/ui/src/shared/components/DatabaseDropdown.js @@ -43,12 +43,18 @@ class DatabaseDropdown extends Component { const proxy = source.links.proxy try { const {data} = await showDatabases(proxy) - const {databases} = showDatabasesParser(data) + const {databases, errors} = showDatabasesParser(data) + if (errors.length > 0) { + throw errors[0] // only one error can come back from this, but it's returned as an array + } - this.setState({databases}) - const selectedDatabaseText = databases.includes(database) + // system databases are those preceded with an '_' + const nonSystemDatabases = databases.filter((name) => name[0] !== '_') + + this.setState({databases: nonSystemDatabases}) + const selectedDatabaseText = nonSystemDatabases.includes(database) ? database - : databases[0] || 'No databases' + : nonSystemDatabases[0] || 'No databases' onSelectDatabase({text: selectedDatabaseText}) } catch (error) { console.error(error)
Remove system databases from "Write Data" dropdown Users should not write to _internal, or generally any other database preceeded with an '_', as we take that to mean a system-internal database of some kind. This filters the list of databases to remove those with names preceeded by a '_' character. Also 'SHOW DATABASES' can return an error if users are not authorized to do that, so it's important to throw that so it can be properly handled / displayed to the user.
influxdata_influxdb
train
js
3cd0543178e745e823ef941803d9c6c8354f6a70
diff --git a/ruby_event_store/lib/ruby_event_store/projection.rb b/ruby_event_store/lib/ruby_event_store/projection.rb index <HASH>..<HASH> 100644 --- a/ruby_event_store/lib/ruby_event_store/projection.rb +++ b/ruby_event_store/lib/ruby_event_store/projection.rb @@ -27,7 +27,7 @@ module RubyEventStore def when(events, handler) Array(events).each do |event| - @handlers[event] = handler + handlers[event] = handler end self
Kill mutation. There's a reader on handlers and is used in other methods as well.
RailsEventStore_rails_event_store
train
rb
b099f0309f4a0881a8007946dbaeb0c565e06caa
diff --git a/pkg/cmd/grafana-cli/commands/install_command.go b/pkg/cmd/grafana-cli/commands/install_command.go index <HASH>..<HASH> 100644 --- a/pkg/cmd/grafana-cli/commands/install_command.go +++ b/pkg/cmd/grafana-cli/commands/install_command.go @@ -94,7 +94,7 @@ func InstallPlugin(pluginName, version string, c CommandLine) error { res, _ := s.ReadPlugin(pluginFolder, pluginName) for _, v := range res.Dependencies.Plugins { - InstallPlugin(v.Id, version, c) + InstallPlugin(v.Id, "", c) logger.Infof("Installed dependency: %v ✔\n", v.Id) }
cli: download latest dependency by default
grafana_grafana
train
go
d049284120bd132fb98db24ba9511a1cffe30c27
diff --git a/builder/amazon/common/step_run_spot_instance.go b/builder/amazon/common/step_run_spot_instance.go index <HASH>..<HASH> 100644 --- a/builder/amazon/common/step_run_spot_instance.go +++ b/builder/amazon/common/step_run_spot_instance.go @@ -295,7 +295,6 @@ func (s *StepRunSpotInstance) Run(ctx context.Context, state multistep.StateBag) var describeOutput *ec2.DescribeInstancesOutput err = retry.Config{ Tries: 11, - ShouldRetry: func(error) bool { return true }, RetryDelay: (&retry.Backoff{InitialBackoff: 200 * time.Millisecond, MaxBackoff: 30 * time.Second, Multiplier: 2}).Linear, }.Run(ctx, func(ctx context.Context) error { describeOutput, err = ec2conn.DescribeInstances(&ec2.DescribeInstancesInput{
Update builder/amazon/common/step_run_spot_instance.go remove unused code that might induce errors
hashicorp_packer
train
go
4ff5f431bd43db6aa7d30605e77477151b24144e
diff --git a/pybasex/basex_client.py b/pybasex/basex_client.py index <HASH>..<HASH> 100644 --- a/pybasex/basex_client.py +++ b/pybasex/basex_client.py @@ -100,7 +100,7 @@ class BaseXClient(object): return response def _check_response_tag(self, response_xml): - if response_xml.tag != '{http://basex.org/rest}databases': + if not response_xml.tag.startswith('{http://basex.org/rest}database'): self._handle_wrong_url() def _wrap_results(self, res_text): @@ -230,7 +230,7 @@ class BaseXClient(object): not_found_params=(db,) ) result = pbx_xml_utils.str_to_xml(response.text) - if result.tag == '{http://basex.org/rest}databases' and int(result.get('resources')) == 0: + if result.tag.startswith('{http://basex.org/rest}database') and int(result.get('resources')) == 0: self.logger.info('There is not document with ID "%s" in database "%s"' % (document_id, db)) return None else:
fixed compatibility with BaseX <I>
lucalianas_pyBaseX
train
py
d9f7ea0d79902e4fc6f1b823f7704e68b215438a
diff --git a/js/demo/demo.js b/js/demo/demo.js index <HASH>..<HASH> 100644 --- a/js/demo/demo.js +++ b/js/demo/demo.js @@ -132,7 +132,8 @@ $(function () { canvas: true, pixelRatio: window.devicePixelRatio, downsamplingRatio: 0.5, - orientation: true + orientation: true, + meta: true } exifNode.hide() iptcNode.hide()
Enable meta option for the demo. For browsers supporting automatic image orientation, setting `orientation:true` does not enable `meta:true` anymore.
blueimp_JavaScript-Load-Image
train
js
461c951fc94c83bcc65694160525a27506941a08
diff --git a/lib/scrape.js b/lib/scrape.js index <HASH>..<HASH> 100644 --- a/lib/scrape.js +++ b/lib/scrape.js @@ -129,11 +129,18 @@ var handleHtml = function(html, definition, url, cb) { // extract element var selector = element.selector; - var attribute = element.attribute || 'text'; + var attribute = element.attribute; var matches = xpath.select(selector, doc); for (var i = 0; i < matches.length; i++) { - var res = matches[i][attribute]; + var res = matches[i]; if (res) { + if (!attribute || attribute == 'text') { + res = res.textContent; + } else if (attribute == 'html') { + res = res.innerHTML; + } else { + res = res[attribute]; + } console.log(key + ": " + res); // save the result
add ability to process html and text with special attributes
ContentMine_quickscrape
train
js
671b77f64b1cc8190f987e71a670ecf1dcf29579
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100755 --- a/setup.py +++ b/setup.py @@ -23,7 +23,7 @@ setup(name='pysrt', keywords = "SubRip srt subtitle", url = "http://github.com/byroot/pysrt", classifiers = [ - "Development Status :: 4 - Beta", + "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "License :: OSI Approved :: GNU General Public License (GPL)", "Operating System :: OS Independent",
let say that pysrt is now stable
byroot_pysrt
train
py
47f50bbe3e90235aebb5344ec61d8c6cde83aa3c
diff --git a/pdf/utils/receipt.py b/pdf/utils/receipt.py index <HASH>..<HASH> 100644 --- a/pdf/utils/receipt.py +++ b/pdf/utils/receipt.py @@ -1,6 +1,6 @@ import os from datetime import datetime -import PySimpleGUI as sg +from sys import modules class Receipt: @@ -9,13 +9,9 @@ class Receipt: self.use = use self.gui = gui self.items = [] - self._print = self._gui_print if self.gui else print + self._print = print self.add('PDF Watermarker', datetime.now().strftime("%Y-%m-%d %H:%M")) - @staticmethod - def _gui_print(msg): - sg.Print(msg) - def set_dst(self, doc, file_name='watermark receipt.txt'): self.dst = os.path.join(os.path.dirname(doc), file_name) self.add('Directory', os.path.dirname(doc)) @@ -37,5 +33,6 @@ class Receipt: for item in self.items: f.write(item + '\n') - if self.gui: + if self.gui and 'PySimpleGUI' in modules: + import PySimpleGUI as sg sg.Popup('Success!')
Modified library imports to only use PySimpleGUI if already installed
mrstephenneal_pdfconduit
train
py
395e962a18b618183b395e9d8f764e72abb2fab1
diff --git a/slacker/__init__.py b/slacker/__init__.py index <HASH>..<HASH> 100644 --- a/slacker/__init__.py +++ b/slacker/__init__.py @@ -264,13 +264,15 @@ class IM(BaseAPI): def list(self): return self.get('im.list') - def history(self, channel, latest=None, oldest=None, count=None): + def history(self, channel, latest=None, oldest=None, count=None, + inclusive=None): return self.get('im.history', params={ 'channel': channel, 'latest': latest, 'oldest': oldest, - 'count': count + 'count': count, + 'inclusive': inclusive }) def mark(self, channel, ts):
"inclusive" argument for im.history API.
os_slacker
train
py
bf926a44867e1cbffa1864aba7f0d66170094739
diff --git a/test/compatibility.js b/test/compatibility.js index <HASH>..<HASH> 100644 --- a/test/compatibility.js +++ b/test/compatibility.js @@ -240,6 +240,38 @@ describe("compatibility", function () { }); + describe("Object", function () { + + it("allows creating objects with a given prototype", function () { + var object = Object.create({ + method: function () { + return "myMethod"; + } + }); + assert(!object.hasOwnProperty("method")); + assert("function" === typeof object.method); + assert(object.method() === "myMethod"); + }); + + it("allows adding properties to the object", function () { + var object = Object.create({ + method: function () { + return this.myValue; + } + }, { + myValue: { + value: "myMethod" + } + }); + assert(!object.hasOwnProperty("method")); + assert("function" === typeof object.method); + assert(object.method() === "myMethod"); + assert(object.hasOwnProperty("myValue")); + assert(object.myValue === "myMethod"); + }); + + }), + describe("String", function () { it("should expose trim", function () {
Test case for Object methods (WIP)
ArnaudBuchholz_gpf-js
train
js
fada7fc0dbaeaadd2a5610e33d5fcffecec5a2ac
diff --git a/spec/microspec/assert.rb b/spec/microspec/assert.rb index <HASH>..<HASH> 100644 --- a/spec/microspec/assert.rb +++ b/spec/microspec/assert.rb @@ -31,3 +31,7 @@ end spec do asserts(true).truthy? end + +spec do + asserts(false).falsey? +end
Pass if falsey predicate is true
Erol_microspec
train
rb