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
|
|---|---|---|---|---|---|
e959c5d71c32c51e501b309c0f415d4623f3e2d5
|
diff --git a/cmd/global-heal.go b/cmd/global-heal.go
index <HASH>..<HASH> 100644
--- a/cmd/global-heal.go
+++ b/cmd/global-heal.go
@@ -68,6 +68,9 @@ func newBgHealSequence() *healSequence {
}
func getLocalBackgroundHealStatus() (madmin.BgHealState, bool) {
+ if globalBackgroundHealState == nil {
+ return madmin.BgHealState{}, false
+ }
bgSeq, ok := globalBackgroundHealState.getHealSequenceByToken(bgHealingUUID)
if !ok {
return madmin.BgHealState{}, false
|
fix: server panic in FS mode (#<I>)
fixes #<I>
|
minio_minio
|
train
|
go
|
485614dfc89f7ec670fab247b61000fdb202fcea
|
diff --git a/Event/DoctrineToEAVEventConverter.php b/Event/DoctrineToEAVEventConverter.php
index <HASH>..<HASH> 100644
--- a/Event/DoctrineToEAVEventConverter.php
+++ b/Event/DoctrineToEAVEventConverter.php
@@ -100,7 +100,7 @@ class DoctrineToEAVEventConverter implements EventSubscriber
$data = $valueChangeset['data'][0];
}
}
- if (null === $data) {
+ if (!$data instanceof DataInterface) {
$this->logger->error(
"Unable to find any previous data associated to Value: {$changedValue->getIdentifier()}"
);
|
Fixing error where EAVEvent is triggered with a non-EAV data
|
VincentChalnot_SidusEAVModelBundle
|
train
|
php
|
5dea85304fc67f958c21c2d646f95c62559b75df
|
diff --git a/src/AnimeDb/Bundle/CatalogBundle/Controller/NoticeController.php b/src/AnimeDb/Bundle/CatalogBundle/Controller/NoticeController.php
index <HASH>..<HASH> 100644
--- a/src/AnimeDb/Bundle/CatalogBundle/Controller/NoticeController.php
+++ b/src/AnimeDb/Bundle/CatalogBundle/Controller/NoticeController.php
@@ -64,7 +64,7 @@ class NoticeController extends Controller
}
$em->flush();
}
- return $this->redirect($this->generateUrl('notice_list'));
+ return $this->redirect($this->generateUrl('notice_list', $current_page ? ['page' => $current_page] : []));
}
// get count all items
|
after remove notice save current page in redirect
|
anime-db_catalog-bundle
|
train
|
php
|
121e2d576d1435a8e3d5922c87318b6a620cba2d
|
diff --git a/Controller/AdminController.php b/Controller/AdminController.php
index <HASH>..<HASH> 100644
--- a/Controller/AdminController.php
+++ b/Controller/AdminController.php
@@ -117,8 +117,20 @@ class AdminController extends Controller
{
$accelerators = '';
- if (function_exists('apc_store') && ini_get('apc.enabled')) {
- $accelerators = 'APC';
+ if (function_exists('apc_store')) {
+ if (ini_get('apc.enabled')) {
+ $accelerators = 'APC';
+ } else {
+ $accelerators = 'APC (disabled)';
+ }
+ }
+
+ if (function_exists('apcu_store')) {
+ if (ini_get('apc.enabled')) {
+ $accelerators = 'APCu';
+ } else {
+ $accelerators = 'APCu (disabled)';
+ }
}
if (extension_loaded('wincache') and ini_get('wincache.ocenabled')) {
|
apcu in sysinfo
|
Smart-Core_CMSBundle
|
train
|
php
|
18a6aa9a9d3602d0f68e49fb4823d760ceceff39
|
diff --git a/hazelcast-jet-core/src/main/java/com/hazelcast/jet/impl/connector/IListWriter.java b/hazelcast-jet-core/src/main/java/com/hazelcast/jet/impl/connector/IListWriter.java
index <HASH>..<HASH> 100644
--- a/hazelcast-jet-core/src/main/java/com/hazelcast/jet/impl/connector/IListWriter.java
+++ b/hazelcast-jet-core/src/main/java/com/hazelcast/jet/impl/connector/IListWriter.java
@@ -24,6 +24,7 @@ import com.hazelcast.jet.Processor;
import com.hazelcast.jet.ProcessorSupplier;
import javax.annotation.Nonnull;
+import java.util.ArrayList;
import java.util.List;
import java.util.stream.Stream;
@@ -32,7 +33,8 @@ import static java.util.stream.Collectors.toList;
public final class IListWriter implements Processor {
- private List list;
+ private final List list;
+ private final ArrayList<Object> buffer = new ArrayList<>();
IListWriter(List list) {
this.list = list;
@@ -40,7 +42,9 @@ public final class IListWriter implements Processor {
@Override
public void process(int ordinal, @Nonnull Inbox inbox) {
- inbox.drainTo(list);
+ inbox.drainTo(buffer);
+ list.addAll(buffer);
+ buffer.clear();
}
@Override
|
Speed up writes to IList by writing in bulk
|
hazelcast_hazelcast
|
train
|
java
|
3d2672c385988f0f95b99ebe21ec01c6f43cb1af
|
diff --git a/classes/ezgmaplocation.php b/classes/ezgmaplocation.php
index <HASH>..<HASH> 100644
--- a/classes/ezgmaplocation.php
+++ b/classes/ezgmaplocation.php
@@ -55,7 +55,10 @@ class eZGmapLocation extends eZPersistentObject
'name' => 'contentobject_attribute_id',
'datatype' => 'integer',
'default' => 0,
- 'required' => true ),
+ 'required' => true,
+ 'foreign_class' => 'eZContentObjectAttribute',
+ 'foreign_attribute' => 'id',
+ 'multiplicity' => '1..*' ),
'contentobject_version' => array(
'name' => 'contentobject_version',
'datatype' => 'integer',
|
- Added foreign key meta data to contentobject_attribute_id's field definition
|
ezsystems_ezgmaplocation-ls-extension
|
train
|
php
|
728d8d1f12bbd5b94e98bcf2f4741588d60047b9
|
diff --git a/test/robots/can-crawl.js b/test/robots/can-crawl.js
index <HASH>..<HASH> 100644
--- a/test/robots/can-crawl.js
+++ b/test/robots/can-crawl.js
@@ -58,10 +58,6 @@ describe('can-crawl-async', () => {
expect(robotsParser.canCrawl('test.com')).to.be.an.instanceOf(Promise);
});
- it('Should call the callback (uncached).', (done) => {
- expect(robotsParser.canCrawl('http://bbc.co.uk', done));
- });
-
it('Should call the callback (cached).', (done) => {
robotsParser.parseRobots('http://example.com', exampleRobotsShort);
expect(robotsParser.canCrawl('http://example.com', done));
|
Removed test that fails due to github coveralls script timeout.
|
ChristopherAkroyd_robots-txt-parser
|
train
|
js
|
6aa8dc8ceb73009857ae82236df51a4ae2bd4778
|
diff --git a/PLYBinaryExporter.js b/PLYBinaryExporter.js
index <HASH>..<HASH> 100644
--- a/PLYBinaryExporter.js
+++ b/PLYBinaryExporter.js
@@ -132,8 +132,8 @@ THREE.PLYBinaryExporter.prototype = {
var vertexListLength = vertexCount * ( 4 * 3 + ( includeNormals ? 4 * 3 : 0 ) + ( includeColors ? 3 : 0 ) + ( includeUVs ? 4 * 2 : 0 ) );
// 1 byte shape desciptor
- // 3 vertex indices at 4 bytes
- var faceListLength = faceCount * ( 4 * 3 + 1 );
+ // 3 vertex indices at ${indexByteCount} bytes
+ var faceListLength = faceCount * ( indexByteCount * 3 + 1 );
var output = new DataView( new ArrayBuffer( headerBin.length + vertexListLength + faceListLength ) );
new Uint8Array( output.buffer ).set( headerBin, 0 );
|
Account for the face index size in the initial array buffer
|
gkjohnson_ply-exporter-js
|
train
|
js
|
49090a10beaccfafe76fa2ddf4a609cecfc3a4bb
|
diff --git a/lib/chef/resource/windows_share.rb b/lib/chef/resource/windows_share.rb
index <HASH>..<HASH> 100644
--- a/lib/chef/resource/windows_share.rb
+++ b/lib/chef/resource/windows_share.rb
@@ -241,6 +241,10 @@ class Chef
Chef::Log.debug("Running '#{share_cmd}' to create the share")
powershell_out!(share_cmd)
+
+ # New-SmbShare adds the "Everyone" user with read access no matter what so we need to remove it
+ # before we add our permissions
+ revoke_user_permissions(["Everyone"])
end
# determine what users in the current state don't exist in the desired state
@@ -296,6 +300,8 @@ class Chef
false
end
+ # revoke user permissions from a share
+ # @param [Array] users
def revoke_user_permissions(users)
revoke_command = "Revoke-SmbShareAccess -Name '#{new_resource.share_name}' -AccountName \"#{users.join(',')}\" -Force"
Chef::Log.debug("Running '#{revoke_command}' to revoke share permissions")
|
windows_share: Fix idempotency by removing the "everyone" access
This resource uses powershell under the hood and calls new-smbshare,
which defaults to adding read only access to the everyone group. With
this change when we create the share we'll remove that permission. Once
that's done we'll go about adding our desired permissions. This only
runs once so the overhead is pretty low and fixes idempotency.
|
chef_chef
|
train
|
rb
|
e86d48691565123ef7f7541b7fbd6d788dfe2d78
|
diff --git a/test/unit/GetDepthCapableTraitTest.php b/test/unit/GetDepthCapableTraitTest.php
index <HASH>..<HASH> 100644
--- a/test/unit/GetDepthCapableTraitTest.php
+++ b/test/unit/GetDepthCapableTraitTest.php
@@ -130,12 +130,15 @@ class GetDepthCapableTraitTest extends TestCase
public function testGetDepth()
{
$segments = [uniqid('segment'), uniqid('segment')];
- $subject = $this->createInstance(['_getPathSegments']);
+ $subject = $this->createInstance(['_getPathSegments', '_countIterable']);
$_subject = $this->reflect($subject);
$subject->expects($this->exactly(1))
->method('_getPathSegments')
->will($this->returnValue($segments));
+ $subject->expects($this->exactly(1))
+ ->method('_countIterable')
+ ->will($this->returnValue(count($segments)));
$result = $_subject->_getDepth();
$this->assertEquals(count($segments) - 1, $result, 'Retrieved depth is wrong');
|
Changed expectations for `GetDepthCapableTrait`
Now must abstract counting of the path segments
|
Dhii_iterator-base
|
train
|
php
|
c3aec364e6ce30213176bae3a3d0ec5b4cb37898
|
diff --git a/titan-cassandra/src/main/java/com/thinkaurelius/titan/diskstorage/cassandra/astyanax/AstyanaxStoreManager.java b/titan-cassandra/src/main/java/com/thinkaurelius/titan/diskstorage/cassandra/astyanax/AstyanaxStoreManager.java
index <HASH>..<HASH> 100644
--- a/titan-cassandra/src/main/java/com/thinkaurelius/titan/diskstorage/cassandra/astyanax/AstyanaxStoreManager.java
+++ b/titan-cassandra/src/main/java/com/thinkaurelius/titan/diskstorage/cassandra/astyanax/AstyanaxStoreManager.java
@@ -163,8 +163,7 @@ public class AstyanaxStoreManager extends AbstractCassandraStoreManager {
@Override
public Deployment getDeployment() {
- //return Deployment.REMOTE;
- //return LOCAL if over localhost else REMOTE
+ return Deployment.REMOTE; // TODO
}
@Override
|
Make Astyanax always assume Deployment.REMOTE
This is a slight improvement over returning nothing and causing a
compile error.
|
thinkaurelius_titan
|
train
|
java
|
9456b97cfb4750f75ac227b571e76750cf1576fa
|
diff --git a/holoviews/core/data/grid.py b/holoviews/core/data/grid.py
index <HASH>..<HASH> 100644
--- a/holoviews/core/data/grid.py
+++ b/holoviews/core/data/grid.py
@@ -548,6 +548,9 @@ class GridInterface(DictInterface):
@classmethod
def select(cls, dataset, selection_mask=None, **selection):
+ if selection_mask is not None:
+ raise ValueError("Masked selections currently not supported for {0}.".format(cls.__name__))
+
dimensions = dataset.kdims
val_dims = [vdim for vdim in dataset.vdims if vdim in selection]
if val_dims:
diff --git a/holoviews/core/data/xarray.py b/holoviews/core/data/xarray.py
index <HASH>..<HASH> 100644
--- a/holoviews/core/data/xarray.py
+++ b/holoviews/core/data/xarray.py
@@ -537,6 +537,9 @@ class XArrayInterface(GridInterface):
@classmethod
def select(cls, dataset, selection_mask=None, **selection):
+ if selection_mask is not None:
+ return dataset.data.where(selection_mask, drop=True)
+
validated = {}
for k, v in selection.items():
dim = dataset.get_dimension(k, strict=True)
|
Support selection masks and expressions on gridded data (#<I>)
|
pyviz_holoviews
|
train
|
py,py
|
be85767ad65988882c993445d561582acd0e1df1
|
diff --git a/src/Command/Humbug.php b/src/Command/Humbug.php
index <HASH>..<HASH> 100644
--- a/src/Command/Humbug.php
+++ b/src/Command/Humbug.php
@@ -539,6 +539,10 @@ class Humbug extends Command
AdapterAbstract $testFrameworkAdapter,
ProgressBar $progressBar
) {
+ $onProgress = function ($count) use ($progressBar) {
+ $progressBar->setProgress($count);
+ };
+
$hasFailure = false;
$process->start();
@@ -546,7 +550,7 @@ class Humbug extends Command
while ($process->isRunning()) {
usleep(2500);
if (($count = $testFrameworkAdapter->hasOks($process->getOutput()))) {
- $progressBar->setProgress($count);
+ $onProgress($count);
$process->clearOutput();
} elseif (!$testFrameworkAdapter->ok($process->getOutput())) {
sleep(1);
@@ -555,7 +559,7 @@ class Humbug extends Command
}
}
$process->stop();
-
+
return $hasFailure;
}
}
|
Some code rearrange - onProgress callback introduced
|
humbug_humbug
|
train
|
php
|
07c7ba9de783872403d4369140a20b4ff36d6401
|
diff --git a/lib/container.js b/lib/container.js
index <HASH>..<HASH> 100644
--- a/lib/container.js
+++ b/lib/container.js
@@ -28,11 +28,15 @@ module.exports = function(config, logger) {
* out - ouput stream
* cb - complete callback
*/
+ /*
+ * commented out as it the blank-container does not need any
+ * specific building.
var build = function build(mode, system, cdef, out, cb) {
logger.info('building');
out.stdout('building');
cb(null, {});
};
+ */
@@ -127,7 +131,6 @@ module.exports = function(config, logger) {
return {
- build: build,
deploy: deploy,
start: start,
stop: stop,
|
Do not expose build, as it does nothing.
|
nearform_blank-container
|
train
|
js
|
477773d2ccbd744910c3f22876a615919c2d12b0
|
diff --git a/ospd/ospd.py b/ospd/ospd.py
index <HASH>..<HASH> 100644
--- a/ospd/ospd.py
+++ b/ospd/ospd.py
@@ -1497,10 +1497,11 @@ class OSPDaemon:
return count
def get_count_running_scans(self) -> int:
- """ Get the amount of scans with RUNNING status """
+ """ Get the amount of scans with INIT/RUNNING status """
count = 0
for scan_id in self.scan_collection.ids_iterator():
- if self.get_scan_status(scan_id) == ScanStatus.RUNNING:
+ status = self.get_scan_status(scan_id)
+ if status == ScanStatus.RUNNING or status == ScanStatus.INIT:
count += 1
return count
|
Consider INIT and RUNNING status for running scans, since an INIT scan is not in the queue anymore
(cherry picked from commit 2acd<I>fbb<I>a<I>cc<I>a<I>e<I>eee<I>)
|
greenbone_ospd
|
train
|
py
|
6bdc04624dcc0f45aab93af42d00224f67da36d5
|
diff --git a/railties/test/rails_info_controller_test.rb b/railties/test/rails_info_controller_test.rb
index <HASH>..<HASH> 100644
--- a/railties/test/rails_info_controller_test.rb
+++ b/railties/test/rails_info_controller_test.rb
@@ -50,7 +50,6 @@ class InfoControllerTest < ActionController::TestCase
test "info controller renders with routes" do
get :routes
- assert_select 'pre'
+ assert_select 'table#routeTable'
end
-
end
|
Fix failing test in railties
Related to the HTML route inspector changes:
ae<I>fc<I>e<I>ab<I>c<I>fd<I>e<I>f6b<I>
|
rails_rails
|
train
|
rb
|
146cbec20b273c236f104abb5554d1fb8623aaca
|
diff --git a/system/HTTP/Files/FileCollection.php b/system/HTTP/Files/FileCollection.php
index <HASH>..<HASH> 100644
--- a/system/HTTP/Files/FileCollection.php
+++ b/system/HTTP/Files/FileCollection.php
@@ -310,7 +310,7 @@ class FileCollection
*/
protected function getValueDotNotationSyntax(array $index, array $value)
{
- if (is_array($index) && ! empty($index))
+ if (! empty($index))
{
$current_index = array_shift($index);
}
|
Remove pointless check from conditional
Because the argument $index has a type declaration of 'array' there is no point in using is_array($index) in the conditional.
|
codeigniter4_CodeIgniter4
|
train
|
php
|
7b2607b0a6c1ebf2b3d56a34ecbea840d73b56d5
|
diff --git a/manticore/ethereum.py b/manticore/ethereum.py
index <HASH>..<HASH> 100644
--- a/manticore/ethereum.py
+++ b/manticore/ethereum.py
@@ -1163,7 +1163,7 @@ class ManticoreEVM(Manticore):
tx_summary.write('\n')
tx_summary.write( "Function call:\n")
tx_summary.write("%s(" % state.solve_one(function_name ))
- tx_summary.write(','.join(map(str, map(state.solve_one, arguments))))
+ tx_summary.write(','.join(map(repr, map(state.solve_one, arguments))))
is_argument_symbolic = any(map(issymbolic, arguments))
is_something_symbolic = is_something_symbolic or is_argument_symbolic
tx_summary.write(') -> %s %s\n' % ( tx.result, flagged(is_argument_symbolic)))
|
Improved readability of .tx files using repr to print function call arguments (#<I>)
|
trailofbits_manticore
|
train
|
py
|
cb89413f8220facc158f5d0177bfe3951eca80a9
|
diff --git a/lib/index.js b/lib/index.js
index <HASH>..<HASH> 100644
--- a/lib/index.js
+++ b/lib/index.js
@@ -56,7 +56,7 @@ class Service extends AdapterService {
if (!this.options.Model) {
throw new Error('The Model getter was called with no Model provided in options!');
}
-
+
return this.options.Model;
}
@@ -256,7 +256,7 @@ class Service extends AdapterService {
// By default we will just query for the one id. For multi patch
// we create a list of the ids of all items that will be changed
// to re-query them after the update
- const ids = id === null ? this._find(params)
+ const ids = id === null ? this._getOrFind(null, params)
.then(mapIds) : Promise.resolve([ id ]);
return ids.then(idList => {
|
Fix issue with patch when using pagination by default (#<I>)
|
feathersjs-ecosystem_feathers-sequelize
|
train
|
js
|
4895f8d5dbb5c0446534164a62df61d9700a2cb6
|
diff --git a/raiden/utils/migrations/v17_to_v18.py b/raiden/utils/migrations/v17_to_v18.py
index <HASH>..<HASH> 100644
--- a/raiden/utils/migrations/v17_to_v18.py
+++ b/raiden/utils/migrations/v17_to_v18.py
@@ -5,6 +5,9 @@ from raiden.exceptions import RaidenDBUpgradeError
from raiden.transfer.state import RouteState
from raiden.utils.typing import Any, Dict
+SOURCE_VERSION = 17
+TARGET_VERSION = 18
+
def get_snapshots(cursor: sqlite3.Cursor):
cursor.execute('SELECT identifier, data FROM state_snapshot')
@@ -97,5 +100,7 @@ def upgrade_mediators_with_waiting_transfer(
old_version: int,
current_version: int,
):
- if current_version > 17:
+ if old_version == SOURCE_VERSION:
_add_routes_to_mediator(cursor)
+
+ return TARGET_VERSION
|
Only run migration if old_version is <I>
|
raiden-network_raiden
|
train
|
py
|
2d06c787f2f8edb0e0844e7399faf19127386e82
|
diff --git a/src/Orders/OrdersStatus.php b/src/Orders/OrdersStatus.php
index <HASH>..<HASH> 100644
--- a/src/Orders/OrdersStatus.php
+++ b/src/Orders/OrdersStatus.php
@@ -104,6 +104,11 @@ class OrdersStatus {
return $result;
}
+ /**
+ * [RO] Preluare lista de statusuri ale comenzilor (https://github.com/celdotro/marketplace/wiki/Preluare-lista-de-statusuri-pentru-comenzi)
+ * [EN] Retrieves the list of statuses for orders (https://github.com/celdotro/marketplace/wiki/Get-status-list-for-orders)
+ * @return mixed
+ */
public function getOrderStatusList(){
// Set method and action
$method = 'orders';
|
Added comments for order status list retrieval
|
celdotro_marketplace
|
train
|
php
|
3d6f846861b7b1269e0ec8746f01e25c5b86ec42
|
diff --git a/lib/escher/auth.rb b/lib/escher/auth.rb
index <HASH>..<HASH> 100644
--- a/lib/escher/auth.rb
+++ b/lib/escher/auth.rb
@@ -9,7 +9,7 @@ module Escher
@current_time = options[:current_time] || Time.now
@auth_header_name = options[:auth_header_name] || 'X-Escher-Auth'
@date_header_name = options[:date_header_name] || 'X-Escher-Date'
- @clock_skew = options[:clock_skew] || 900
+ @clock_skew = options[:clock_skew] || 300
@algo = create_algo
@algo_id = @algo_prefix + '-HMAC-' + @hash_algo
end
|
SUITEDEV-<I> Reduce clockSkew to <I>
|
emartech_escher-ruby
|
train
|
rb
|
4fda01fa13ff14cde1960a49ded1b45212c89005
|
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/resources/File.java b/sonar-plugin-api/src/main/java/org/sonar/api/resources/File.java
index <HASH>..<HASH> 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/resources/File.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/resources/File.java
@@ -39,18 +39,8 @@ public class File extends Resource {
private Directory parent;
private String qualifier = Qualifiers.FILE;
- private final String relativePathFromSourceDir;
-
- private File() {
+ protected File() {
// Used by factory method
- this.relativePathFromSourceDir = null;
- }
-
- /**
- * Internal.
- */
- public String relativePathFromSourceDir() {
- return relativePathFromSourceDir;
}
/**
|
Relax visibility of File constructor to allow hacking in SonarLint
|
SonarSource_sonarqube
|
train
|
java
|
71ad9f87b5ac48e403adfa733582357674556781
|
diff --git a/lib/pry-byebug/commands.rb b/lib/pry-byebug/commands.rb
index <HASH>..<HASH> 100644
--- a/lib/pry-byebug/commands.rb
+++ b/lib/pry-byebug/commands.rb
@@ -122,6 +122,8 @@ module PryByebug
end
def process
+ Byebug.start unless Byebug.started?
+
{ :delete => :delete,
:disable => :disable,
:enable => :enable,
|
Make sure byebug's started when setting breakpoint
|
deivid-rodriguez_pry-byebug
|
train
|
rb
|
0dcc203b606e901eafb6b760eaf9a60473e13727
|
diff --git a/cpu6809.py b/cpu6809.py
index <HASH>..<HASH> 100755
--- a/cpu6809.py
+++ b/cpu6809.py
@@ -355,14 +355,6 @@ class Instruction(object):
mnemonic1, mnemonic2
))
- cc1 = msg[98:106]
- if cc1 != xroar_cc:
- log.info("trace: %s" , ref_line)
- log.info("own..: %s" , msg)
- log.error("CC (%r != %r) not the same as trace reference!\n" % (
- cc1, xroar_cc
- ))
-
registers1 = msg[52:95]
registers2 = ref_line[52:95]
if registers1 != registers2:
@@ -371,6 +363,14 @@ class Instruction(object):
log.error("registers (%r != %r) not the same as trace reference!\n" % (
registers1, registers2
))
+ else:
+ cc1 = msg[98:106]
+ if cc1 != xroar_cc:
+ log.info("trace: %s" , ref_line)
+ log.info("own..: %s" , msg)
+ log.error("CC (%r != %r) not the same as trace reference!\n" % (
+ cc1, xroar_cc
+ ))
log.debug("\t%s", repr(self.data))
log.debug("-"*79)
|
conmpare first the registers than CC
|
6809_MC6809
|
train
|
py
|
b4aadcd658b877ea2369790bdbfc3330efb30125
|
diff --git a/lib/active_record_survey/node_map.rb b/lib/active_record_survey/node_map.rb
index <HASH>..<HASH> 100644
--- a/lib/active_record_survey/node_map.rb
+++ b/lib/active_record_survey/node_map.rb
@@ -37,6 +37,21 @@ module ActiveRecordSurvey
result
end
+ # Whether decendant of a particular node_map
+ def is_decendant_of?(node_map)
+ # Hit ourselves
+ if node_map == self
+ return true
+ end
+
+ # Recurse
+ if self.parent
+ return self.parent.is_decendant_of?(node_map)
+ end
+
+ false
+ end
+
# Gets all the ancestor nodes until one is not an ancestor of klass
def ancestors_until_node_not_ancestor_of(klass)
if !self.parent || !self.node.class.ancestors.include?(klass)
diff --git a/lib/active_record_survey/version.rb b/lib/active_record_survey/version.rb
index <HASH>..<HASH> 100644
--- a/lib/active_record_survey/version.rb
+++ b/lib/active_record_survey/version.rb
@@ -1,3 +1,3 @@
module ActiveRecordSurvey
- VERSION = "0.1.38"
+ VERSION = "0.1.39"
end
|
Version <I>
Added is_decendent_of? method to node_maps
|
butchmarshall_active_record_survey
|
train
|
rb,rb
|
36ee4378fa7ce2af9cfcd2d0a38fe6acac7273eb
|
diff --git a/tchannel-core/src/main/java/com/uber/tchannel/schemes/JSONSerializer.java b/tchannel-core/src/main/java/com/uber/tchannel/schemes/JSONSerializer.java
index <HASH>..<HASH> 100644
--- a/tchannel-core/src/main/java/com/uber/tchannel/schemes/JSONSerializer.java
+++ b/tchannel-core/src/main/java/com/uber/tchannel/schemes/JSONSerializer.java
@@ -50,6 +50,10 @@ public final class JSONSerializer implements Serializer.SerializerInterface {
public Map<String, String> decodeHeaders(ByteBuf arg2) {
String headerJSON = arg2.toString(CharsetUtil.UTF_8);
arg2.release();
+ if (headerJSON == null || headerJSON.isEmpty() || headerJSON.equals("\"\"")) {
+ headerJSON = "{}";
+ }
+
Map<String, String> headers = new Gson().fromJson(headerJSON, HEADER_TYPE);
return (headers == null) ? new HashMap<String, String>() : headers;
}
|
compatible with other languages when application header is empty
|
uber_tchannel-java
|
train
|
java
|
3cd017a43e65c6137079d668f256c59e907df702
|
diff --git a/dockerpty/io.py b/dockerpty/io.py
index <HASH>..<HASH> 100644
--- a/dockerpty/io.py
+++ b/dockerpty/io.py
@@ -111,13 +111,15 @@ class Stream(object):
Return `n` bytes of data from the Stream, or None at end of stream.
"""
- try:
- if hasattr(self.fd, 'recv'):
- return self.fd.recv(n)
- return os.read(self.fd.fileno(), n)
- except EnvironmentError as e:
- if e.errno not in Stream.ERRNO_RECOVERABLE:
- raise e
+ while True:
+ try:
+ if hasattr(self.fd, 'recv'):
+ return self.fd.recv(n)
+ return os.read(self.fd.fileno(), n)
+ except EnvironmentError as e:
+ if e.errno not in Stream.ERRNO_RECOVERABLE:
+ raise e
+
def write(self, data):
"""
|
Retry after encountering a recoverable error when reading.
Addresses d<I>wtq/dockerpty#<I>.
|
d11wtq_dockerpty
|
train
|
py
|
886a462c6704207d0118fd635776b575da7c401c
|
diff --git a/Component/RepositoryRegistry.php b/Component/RepositoryRegistry.php
index <HASH>..<HASH> 100644
--- a/Component/RepositoryRegistry.php
+++ b/Component/RepositoryRegistry.php
@@ -19,7 +19,7 @@ class RepositoryRegistry
/** @var mixed[][] */
protected $repositoryConfigs;
/** @var DataStore[] */
- protected $repositories;
+ protected $repositories = array();
/**
* @param DataStoreFactory $factory
|
Fix error in first invocation of getDataStoreByName
|
mapbender_data-source
|
train
|
php
|
b30ce92d500bfa0cea9bd56f104cf3eb339fd585
|
diff --git a/codec/rpc.go b/codec/rpc.go
index <HASH>..<HASH> 100644
--- a/codec/rpc.go
+++ b/codec/rpc.go
@@ -8,7 +8,6 @@ import (
"errors"
"io"
"net/rpc"
- "sync"
)
var errRpcJsonNeedsTermWhitespace = errors.New("rpc requires a JsonHandle with TermWhitespace set to true")
@@ -40,8 +39,7 @@ type rpcCodec struct {
enc *Encoder
// bw *bufio.Writer
// br *bufio.Reader
- mu sync.Mutex
- h Handle
+ h Handle
cls atomicClsErr
}
@@ -160,15 +158,10 @@ type goRpcCodec struct {
}
func (c *goRpcCodec) WriteRequest(r *rpc.Request, body interface{}) error {
- // Must protect for concurrent access as per API
- c.mu.Lock()
- defer c.mu.Unlock()
return c.write(r, body, true)
}
func (c *goRpcCodec) WriteResponse(r *rpc.Response, body interface{}) error {
- c.mu.Lock()
- defer c.mu.Unlock()
return c.write(r, body, true)
}
|
codec: rpc: remove unnecessary mutex Lock/Unlock during WriteXXX methods of codec
The net/rpc package states that the io.ReadWriteCloser should handle
concurrency if desired. This means that any required lock/unlock should be at the
implementation of io.ReadWriteCloser, not the codec.
Updates #<I>
|
ugorji_go
|
train
|
go
|
1371a6288cb5303e395104ae0c2226acc730d219
|
diff --git a/test/full_tst.py b/test/full_tst.py
index <HASH>..<HASH> 100644
--- a/test/full_tst.py
+++ b/test/full_tst.py
@@ -66,7 +66,7 @@ class fullTest(unittest.TestCase):
files = ['cfg/full/daemons/brokerd.ini', 'cfg/full/daemons/pollerd.ini',
'cfg/full/daemons/reactionnerd.ini', 'cfg/full/daemons/receiverd.ini',
'cfg/full/daemons/schedulerd.ini', 'cfg/full/alignak.cfg']
- replacements = {'/var/run/alignak': '/tmp', '/var/log/alignak': '/tmp'}
+ replacements = {'/usr/local/var/run/alignak': '/tmp', '/usr/local/var/log/alignak': '/tmp'}
for filename in files:
lines = []
with open(filename) as infile:
|
Update full_tst to comply with the new default configuration (/usr/local/ prefixed directories
|
Alignak-monitoring_alignak
|
train
|
py
|
69701cc82584e27c25d8ac4a0deec3af4508feb2
|
diff --git a/dallinger/command_line.py b/dallinger/command_line.py
index <HASH>..<HASH> 100755
--- a/dallinger/command_line.py
+++ b/dallinger/command_line.py
@@ -858,9 +858,7 @@ def export(app, local, no_scrub):
@click.option('--app', default=None, callback=verify_id, help='Experiment id')
def logs(app):
"""Show the logs."""
- subprocess.check_call([
- "heroku", "addons:open", "papertrail", "--app", app_name(app)
- ])
+ heroku.open_logs(app)
@dallinger.command()
|
Use new tool in CLI log command
|
Dallinger_Dallinger
|
train
|
py
|
2eada99f75a73c2dc4bcd7ac36aab84f03289724
|
diff --git a/lib/wechat/responder.rb b/lib/wechat/responder.rb
index <HASH>..<HASH> 100644
--- a/lib/wechat/responder.rb
+++ b/lib/wechat/responder.rb
@@ -166,7 +166,7 @@ module Wechat
self.class.wechat # Make sure user can continue access wechat at instance level similar to class level
end
- def wechat_oauth2_url(page_url = nil)
+ def wechat_oauth2_url(scope = 'snsapi_base', page_url = nil)
appid = self.class.corpid || self.class.appid
page_url ||= if self.class.trusted_domain_fullname
"#{self.class.trusted_domain_fullname}#{request.original_fullpath}"
@@ -174,7 +174,7 @@ module Wechat
request.original_url
end
redirect_uri = CGI.escape(page_url)
- "https://open.weixin.qq.com/connect/oauth2/authorize?appid=#{appid}&redirect_uri=#{redirect_uri}&response_type=code&scope=snsapi_base#wechat_redirect"
+ "https://open.weixin.qq.com/connect/oauth2/authorize?appid=#{appid}&redirect_uri=#{redirect_uri}&response_type=code&scope=#{scope}#wechat_redirect"
end
def show
|
Enable user using snsapi_userinfo as well.
|
Eric-Guo_wechat
|
train
|
rb
|
12a5751d266aadc19f8b17cde4baf9bc3dfc9321
|
diff --git a/test/rules/helpers.js b/test/rules/helpers.js
index <HASH>..<HASH> 100644
--- a/test/rules/helpers.js
+++ b/test/rules/helpers.js
@@ -8,8 +8,8 @@ const onWarn = function (rule, el, needCall, cb) {
let called = false
const a11y = new A11y(React, ReactDOM, {
reporter (info) {
+ console.log(info)
called = true
- a11y.restoreAll()
cb(info)
}
, rules: {
@@ -28,6 +28,8 @@ const onWarn = function (rule, el, needCall, cb) {
if ( needCall ) {
expect(called).to.be.true
}
+
+ a11y.restoreAll()
done()
}
}
|
fix bug where rule tests interfered with each other
|
reactjs_react-a11y
|
train
|
js
|
8d40f702c3d5a1a82025da112b00a5062f237db9
|
diff --git a/app/suite_test.go b/app/suite_test.go
index <HASH>..<HASH> 100644
--- a/app/suite_test.go
+++ b/app/suite_test.go
@@ -105,7 +105,7 @@ func (s *S) TearDownSuite(c *C) {
}
func (s *S) SetUpTest(c *C) {
- cleanQueue()
+ ttesting.CleanQueues(queueName, QueueName)
}
func (s *S) TearDownTest(c *C) {
@@ -189,15 +189,3 @@ func (h *testHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
h.header = append(h.header, r.Header)
w.Write([]byte(h.content))
}
-
-func cleanQueue() {
- var (
- err error
- msg *queue.Message
- )
- for err == nil {
- if msg, err = queue.Get(queueName, 1e6); err == nil {
- err = msg.Delete()
- }
- }
-}
|
app: use testing.CleanQueues to clean queues
|
tsuru_tsuru
|
train
|
go
|
ac2bdb463ca599594037fa41097e2ca35a9c922a
|
diff --git a/src/main/java/com/algorithmia/data/DataFile.java b/src/main/java/com/algorithmia/data/DataFile.java
index <HASH>..<HASH> 100644
--- a/src/main/java/com/algorithmia/data/DataFile.java
+++ b/src/main/java/com/algorithmia/data/DataFile.java
@@ -48,7 +48,7 @@ public class DataFile extends DataObject {
* @throws IOException if there were any problems consuming the response content
*/
public File getFile() throws APIException, IOException {
- File tempFile = File.createTempFile(getName(), null);
+ File tempFile = File.createTempFile("algodata", null);
FileOutputStream outputStream = new FileOutputStream(tempFile);
IOUtils.copy(getInputStream(), outputStream);
return tempFile;
|
Fix #4: ensure temp file prefix length is always valid
|
algorithmiaio_algorithmia-java
|
train
|
java
|
ea421ab1fd2fee1f0448d1adcd6bff0c7d2726b7
|
diff --git a/test.js b/test.js
index <HASH>..<HASH> 100644
--- a/test.js
+++ b/test.js
@@ -2,7 +2,7 @@ var koa = require('koa');
var request = require('supertest');
var assert = require('assert');
-var koajwt = require('./index.js');
+var koajwt = require('./index');
describe('failure tests', function () {
|
Removing the unnecessary '.js' extension from the index require
|
koajs_jwt
|
train
|
js
|
fa7cbbfb25444d7a5c4e9b770874130de03b41e4
|
diff --git a/Git.php b/Git.php
index <HASH>..<HASH> 100644
--- a/Git.php
+++ b/Git.php
@@ -196,14 +196,15 @@ class Git
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $this->_classHash['repos_url']);
+ curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 1);
+ curl_setopt($ch, CURLOPT_USERAGENT, 'seagoj@gmail.com');
$raw = curl_exec($ch);
curl_close($ch);
$this->_log->write($raw);
-
/* $postdata = http_build_query(
array(
'user'=>'seagoj',
|
Adds USERAGENT to curl call
|
seagoj_devtools
|
train
|
php
|
8442ee5067c3b05168f91d331324bdb8700c9836
|
diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -12,9 +12,9 @@ def read_file(filename):
setup(
name = "calloway",
version = __import__('calloway').get_version().replace(' ', '-'),
- url = 'http://opensource.washingtontimes.com/projects/calloway/',
- author = 'The Washington Times Web Devs',
- author_email = 'webdev@washingtontimes.com',
+ url = 'https://github.com/callowayproject/Calloway',
+ author = 'Calloway Project Devs',
+ author_email = 'webmaster@callowayproject.com',
description = 'A builder of boring stuff for opinionated developers',
long_description = read_file('README'),
packages = find_packages(),
|
Updated the url, author and author email
|
callowayproject_Calloway
|
train
|
py
|
2bbdd79d78c7903fc2d19a0d1c0d0be56ab7ad1b
|
diff --git a/src/main/java/net/finmath/marketdata/calibration/Solver.java b/src/main/java/net/finmath/marketdata/calibration/Solver.java
index <HASH>..<HASH> 100644
--- a/src/main/java/net/finmath/marketdata/calibration/Solver.java
+++ b/src/main/java/net/finmath/marketdata/calibration/Solver.java
@@ -174,7 +174,7 @@ public class Solver {
double error = calibrationProducts.get(i).getValue(evaluationTime, calibratedModel);
accuracy += error * error;
}
- accuracy = Math.sqrt(accuracy);
+ accuracy = Math.sqrt(accuracy/calibrationProducts.size());
return calibratedModel;
}
diff --git a/src/main/java6/net/finmath/marketdata/calibration/Solver.java b/src/main/java6/net/finmath/marketdata/calibration/Solver.java
index <HASH>..<HASH> 100644
--- a/src/main/java6/net/finmath/marketdata/calibration/Solver.java
+++ b/src/main/java6/net/finmath/marketdata/calibration/Solver.java
@@ -174,7 +174,7 @@ public class Solver {
double error = calibrationProducts.get(i).getValue(evaluationTime, calibratedModel);
accuracy += error * error;
}
- accuracy = Math.sqrt(accuracy);
+ accuracy = Math.sqrt(accuracy/calibrationProducts.size());
return calibratedModel;
}
|
Reported accuracy is now a rms.
git-svn-id: <URL>
|
finmath_finmath-lib
|
train
|
java,java
|
57d3b6cad38061e205f1c6b04344a265027af98e
|
diff --git a/faker/providers/ssn/fi_FI/__init__.py b/faker/providers/ssn/fi_FI/__init__.py
index <HASH>..<HASH> 100644
--- a/faker/providers/ssn/fi_FI/__init__.py
+++ b/faker/providers/ssn/fi_FI/__init__.py
@@ -39,7 +39,7 @@ class Provider(SsnProvider):
if birthday.year < 2000:
separator = '-'
else:
- separator += 'A'
+ separator = 'A'
suffix = str(random.randrange(2, 899)).zfill(3)
checksum = _checksum(hetu_date + suffix)
hetu = "".join([hetu_date, separator, suffix, checksum])
|
Correct UnboundLocalError in Finnish SSN generator.
|
joke2k_faker
|
train
|
py
|
6068b67cee8079605cbc83440d7065b6d4fdb517
|
diff --git a/Element/PhpFile.php b/Element/PhpFile.php
index <HASH>..<HASH> 100755
--- a/Element/PhpFile.php
+++ b/Element/PhpFile.php
@@ -17,6 +17,15 @@ class PhpFile extends AbstractElement
return self::START_FILE;
}
/**
+ * @see \WsdlToPhp\PhpGenerator\Element\AbstractElement::toString()
+ * @param int $indentation
+ * @return string
+ */
+ public function toString($indentation = null)
+ {
+ return sprintf('%s%s', parent::toString($indentation), self::BREAK_LINE_CHAR);
+ }
+ /**
* @see \WsdlToPhp\PhpGenerator\Element\AbstractElement::getChildrenTypes()
* @return string[]
*/
|
ensure generated file contains one line at end of file (PSR-2)
|
WsdlToPhp_PhpGenerator
|
train
|
php
|
e9b463f787d19c4a02cf1620199146536aa87368
|
diff --git a/plugins/org.eclipse.xtext/src/org/eclipse/xtext/serializer/analysis/GrammarConstraintProvider.java b/plugins/org.eclipse.xtext/src/org/eclipse/xtext/serializer/analysis/GrammarConstraintProvider.java
index <HASH>..<HASH> 100644
--- a/plugins/org.eclipse.xtext/src/org/eclipse/xtext/serializer/analysis/GrammarConstraintProvider.java
+++ b/plugins/org.eclipse.xtext/src/org/eclipse/xtext/serializer/analysis/GrammarConstraintProvider.java
@@ -176,10 +176,11 @@ public class GrammarConstraintProvider implements IGrammarConstraintProvider {
case ASSIGNED_PARSER_RULE_CALL:
case ASSIGNED_TERMINAL_RULE_CALL:
EClass type = ele.getContainingConstraint().getType();
- if (type.getEStructuralFeature(ele.getFeatureName()) == null)
+ EStructuralFeature feature = type.getEStructuralFeature(ele.getFeatureName());
+ if (feature == null)
throw new RuntimeException("Feature " + ele.getFeatureName() + " not found in "
+ type.getName());
- int featureID = type.getEStructuralFeature(ele.getFeatureName()).getFeatureID();
+ int featureID = type.getFeatureID(feature);
List<IConstraintElement> assignmentByFeature = assignmentsByFeature[featureID];
if (assignmentByFeature == null)
assignmentsByFeature[featureID] = assignmentByFeature = Lists.newArrayList();
|
[serializer] bugfix: wrong EStruturalFeatureIDs were used in case of multiple inheritance
|
eclipse_xtext-core
|
train
|
java
|
2809882f0a9cd473244814f4840d34969a4da51a
|
diff --git a/omgeo/tests/tests.py b/omgeo/tests/tests.py
index <HASH>..<HASH> 100755
--- a/omgeo/tests/tests.py
+++ b/omgeo/tests/tests.py
@@ -75,8 +75,8 @@ class GeocoderTest(OmgeoTestCase):
if MAPQUEST_API_KEY is not None:
mapquest_settings = dict(api_key=MAPQUEST_API_KEY)
- self.g_mapquest = Geocoder(['omgeo.services.MapQuest', {'settings': mapquest_settings}])
- self.g_mapquest_ssl = Geocoder(['omgeo.services.MapQuestSSL', {'settings': mapquest_settings}])
+ self.g_mapquest = Geocoder([['omgeo.services.MapQuest', {'settings': mapquest_settings}]])
+ self.g_mapquest_ssl = Geocoder([['omgeo.services.MapQuestSSL', {'settings': mapquest_settings}]])
#: main geocoder used for tests, using default APIs
self.g = Geocoder()
|
fix mapquest list nesting issue in tests
|
azavea_python-omgeo
|
train
|
py
|
7a587f62a6891905ee987ea993c3a0ca71640b78
|
diff --git a/framework/yii/base/Controller.php b/framework/yii/base/Controller.php
index <HASH>..<HASH> 100644
--- a/framework/yii/base/Controller.php
+++ b/framework/yii/base/Controller.php
@@ -18,6 +18,15 @@ use Yii;
class Controller extends Component
{
/**
+ * @event ActionEvent an event raised right before executing a controller action.
+ * You may set [[ActionEvent::isValid]] to be false to cancel the action execution.
+ */
+ const EVENT_BEFORE_ACTION = 'beforeAction';
+ /**
+ * @event ActionEvent an event raised right after executing a controller action.
+ */
+ const EVENT_AFTER_ACTION = 'afterAction';
+ /**
* @var string the ID of this controller
*/
public $id;
@@ -192,7 +201,9 @@ class Controller extends Component
*/
public function beforeAction($action)
{
- return true;
+ $event = new ActionEvent($action);
+ $this->trigger(self::EVENT_BEFORE_ACTION, $event);
+ return $event->isValid;
}
/**
@@ -203,6 +214,9 @@ class Controller extends Component
*/
public function afterAction($action, &$result)
{
+ $event = new ActionEvent($action);
+ $event->result = & $result;
+ $this->trigger(self::EVENT_AFTER_ACTION, $event);
}
/**
|
Added back the events for Controller.
|
yiisoft_yii2-debug
|
train
|
php
|
5b9cb5ed8b047088c76373c297d9860e09507d37
|
diff --git a/packages/create-quip-app/bin/create-quip-app.py b/packages/create-quip-app/bin/create-quip-app.py
index <HASH>..<HASH> 100755
--- a/packages/create-quip-app/bin/create-quip-app.py
+++ b/packages/create-quip-app/bin/create-quip-app.py
@@ -132,7 +132,8 @@ def create_package(app_dir, package_path=None):
# make sure the package_path exists even if its in a non-existent subdir
package_dir = os.path.dirname(package_path)
try:
- os.makedirs(package_dir)
+ if package_dir:
+ os.makedirs(package_dir)
except OSError:
if not os.path.isdir(package_dir):
raise
|
don't attempt to create package_dir when it is empty
|
quip_quip-apps
|
train
|
py
|
aff16ce03e8b7065959e5b1bf562ca7bb522d333
|
diff --git a/src/lib/sys-proc.rb b/src/lib/sys-proc.rb
index <HASH>..<HASH> 100644
--- a/src/lib/sys-proc.rb
+++ b/src/lib/sys-proc.rb
@@ -1,8 +1,18 @@
+# rubocop:disable Style/FileName
# frozen_string_literal: true
+# rubocop:enable Style/FileName
-require 'active_support/inflector'
require 'pathname'
-
$LOAD_PATH.unshift Pathname.new(__dir__)
+if 'development' == ENV['PROJECT_MODE']
+ require 'pp'
+ require 'coderay'
+ require 'pry/color_printer'
+
+ def pp(obj, out=STDOUT, width=79)
+ (out.isatty ? Pry::ColorPrinter : PP).pp(obj, out, width)
+ end
+end
+
require 'sys/proc'
|
loader provides a better pp (development)
|
SwagDevOps_sys-proc
|
train
|
rb
|
9983b7abada15d36998a7113a73776dfcfcab056
|
diff --git a/lib/jsduck/ast.rb b/lib/jsduck/ast.rb
index <HASH>..<HASH> 100644
--- a/lib/jsduck/ast.rb
+++ b/lib/jsduck/ast.rb
@@ -1,7 +1,6 @@
require "jsduck/serializer"
require "jsduck/evaluator"
require "jsduck/function_ast"
-require "jsduck/ext_patterns"
require "jsduck/ast_node"
module JsDuck
@@ -142,15 +141,11 @@ module JsDuck
private
def function?(ast)
- ast["type"] == "FunctionDeclaration" || ast["type"] == "FunctionExpression" || empty_fn?(ast)
+ AstNode.new(ast).function?
end
def empty_fn?(ast)
- ast["type"] == "MemberExpression" && ext_pattern?("Ext.emptyFn", ast)
- end
-
- def ext_pattern?(pattern, ast)
- ExtPatterns.matches?(pattern, to_s(ast))
+ AstNode.new(ast).ext_empty_fn?
end
def object?(ast)
|
Eliminate use of ExtPatterns class from Ast.
|
senchalabs_jsduck
|
train
|
rb
|
45643ac0e70094a96477d15af9004653898eb55f
|
diff --git a/library/src/main/java/com/prolificinteractive/materialcalendarview/MaterialCalendarView.java b/library/src/main/java/com/prolificinteractive/materialcalendarview/MaterialCalendarView.java
index <HASH>..<HASH> 100644
--- a/library/src/main/java/com/prolificinteractive/materialcalendarview/MaterialCalendarView.java
+++ b/library/src/main/java/com/prolificinteractive/materialcalendarview/MaterialCalendarView.java
@@ -12,6 +12,7 @@ import android.util.TypedValue;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
+import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.widget.TextView;
@@ -43,7 +44,7 @@ import java.util.Locale;
* @attr ref R.styleable.MaterialCalendarView_weekDayTextAppearance
* @attr ref R.styleable.MaterialCalendarView_showOtherMonths
*/
-public class MaterialCalendarView extends LinearLayout {
+public class MaterialCalendarView extends FrameLayout {
private final TextView title;
private final DirectionButton buttonPast;
@@ -123,7 +124,6 @@ public class MaterialCalendarView extends LinearLayout {
public MaterialCalendarView(Context context, AttributeSet attrs) {
super(context, attrs);
- setOrientation(VERTICAL);
setClipChildren(false);
setClipToPadding(false);
|
Changed super class to be FrameLayout
|
prolificinteractive_material-calendarview
|
train
|
java
|
03a924267bad0b9d0cfa7afa549748b6ff0ee2f3
|
diff --git a/lib/rb-inotify/notifier.rb b/lib/rb-inotify/notifier.rb
index <HASH>..<HASH> 100644
--- a/lib/rb-inotify/notifier.rb
+++ b/lib/rb-inotify/notifier.rb
@@ -242,6 +242,7 @@ module INotify
#
# @raise [SystemCallError] if closing the underlying file descriptor fails.
def close
+ stop
if Native.close(@fd) == 0
@watchers.clear
return
@@ -292,7 +293,11 @@ module INotify
# Same as IO#readpartial, or as close as we need.
def readpartial(size)
# Use Ruby's readpartial if possible, to avoid blocking other threads.
- return to_io.readpartial(size) if self.class.supports_ruby_io?
+ begin
+ return to_io.readpartial(size) if self.class.supports_ruby_io?
+ rescue Errno::EBADF
+ return []
+ end
tries = 0
begin
|
Avoid exception in case of closing a file watched by notifier, like trapping SIGINT to close the file without exception.
|
guard_rb-inotify
|
train
|
rb
|
1088403fed7993305db7b2c30243b663d0e909a6
|
diff --git a/lib/achoo/ui/date_chooser.rb b/lib/achoo/ui/date_chooser.rb
index <HASH>..<HASH> 100644
--- a/lib/achoo/ui/date_chooser.rb
+++ b/lib/achoo/ui/date_chooser.rb
@@ -67,7 +67,7 @@ module Achoo
puts "Accepted formats:"
puts date_format_help_string
puts
- system 'cal -3m'
+ system 'cal -3'
end
def date_format_help_string
|
The -m option to cal seems to have changed its definition. Remove it
|
kjellm_achoo
|
train
|
rb
|
75a859716b36d587e6f8a750da82edac1091f6db
|
diff --git a/src/Propel/Generator/Builder/Om/ObjectBuilder.php b/src/Propel/Generator/Builder/Om/ObjectBuilder.php
index <HASH>..<HASH> 100644
--- a/src/Propel/Generator/Builder/Om/ObjectBuilder.php
+++ b/src/Propel/Generator/Builder/Om/ObjectBuilder.php
@@ -4046,7 +4046,7 @@ abstract class ".$this->getClassname()." extends ".$parentClass." ";
* @param " . $crossObjectClassName . " " . $crossObjectName . " The $className object to relate
* @return void
*/
- public function add{$relatedObjectClassName}($crossObjectName)
+ public function add{$relatedObjectClassName}($crossObjectClassName $crossObjectName)
{
if (\$this->" . $collName . " === null) {
\$this->init" . $relCol . "();
|
Fixed missing typehint on crossFK methods
|
propelorm_Propel2
|
train
|
php
|
34b23be3d523c18ae051510b6ae7eba516bc3e9a
|
diff --git a/fsevents.py b/fsevents.py
index <HASH>..<HASH> 100644
--- a/fsevents.py
+++ b/fsevents.py
@@ -194,4 +194,7 @@ class FileEventCallback(object):
if os.path.isdir(path):
refs[os.path.join(root, path)] = {}
for name in os.listdir(os.path.join(root, path)):
- refs[path][name] = os.stat(os.path.join(path, name))
+ try:
+ refs[path][name] = os.stat(os.path.join(path, name))
+ except OSError:
+ pass
|
ignore files that don't exist while recursing.
Specifically this avoids the problem where we explode when trying to
stat a symlink that has a nonexistent target
|
malthe_macfsevents
|
train
|
py
|
e4e728710ddf15cc79ff19f146b6512b698605d7
|
diff --git a/src/services/ModelByHandle.php b/src/services/ModelByHandle.php
index <HASH>..<HASH> 100644
--- a/src/services/ModelByHandle.php
+++ b/src/services/ModelByHandle.php
@@ -289,7 +289,7 @@ abstract class ModelByHandle extends Model
// Get existing record
if ($model instanceof ModelWithHandle) {
- if ($record = $this->getRecordByCondition([
+ if ($record = $this->findRecordByCondition([
'handle' => $model->handle
])
) {
|
removing forceful check for record when finding via handle
|
flipbox_spark
|
train
|
php
|
189585c7ecfdd34ac6a901f3f00c3f8c81da5aa0
|
diff --git a/lib/model/type/index.js b/lib/model/type/index.js
index <HASH>..<HASH> 100644
--- a/lib/model/type/index.js
+++ b/lib/model/type/index.js
@@ -35,6 +35,8 @@ const files = [
"./string",
"./integer",
"./boolean",
+ "./number",
+ "./date",
];
|
fixing attribute type handlers for numbers and dates not exposed commonly
|
hitchyjs_odem
|
train
|
js
|
37e29aa31aec0c27d73433816f3325658a5c0108
|
diff --git a/src/TextFormatter/Parser.php b/src/TextFormatter/Parser.php
index <HASH>..<HASH> 100644
--- a/src/TextFormatter/Parser.php
+++ b/src/TextFormatter/Parser.php
@@ -155,15 +155,17 @@ class Parser
}
/**
- * Clear this instance's properties
+ * Reset this instance's properties
*
* Used internally at the beginning of a new parsing. I suppose some memory-obsessive users will
* appreciate to be able to do it whenever they feel like it
*
* @return void
*/
- public function clear()
+ public function reset($text)
{
+ $this->text = $text;
+
$this->log = array();
$this->unprocessedTags = array();
$this->processedTags = array();
@@ -172,7 +174,7 @@ class Parser
$this->cntOpen = array();
$this->cntTotal = array();
- unset($this->text, $this->currentTag, $this->currentAttribute);
+ unset($this->currentTag, $this->currentAttribute);
}
/**
@@ -183,8 +185,7 @@ class Parser
*/
public function parse($text)
{
- $this->clear();
- $this->text = $text;
+ $this->reset($text);
/**
* Capture all tags
|
TextFormatter: small change in code
|
s9e_TextFormatter
|
train
|
php
|
0379c8f96a738158e9d92623a1fcaff6b70716aa
|
diff --git a/pkg/features/kube_features.go b/pkg/features/kube_features.go
index <HASH>..<HASH> 100644
--- a/pkg/features/kube_features.go
+++ b/pkg/features/kube_features.go
@@ -577,7 +577,7 @@ const (
DisableCloudProviders featuregate.Feature = "DisableCloudProviders"
// owner: @andrewsykim
- // alpha: v1.22
+ // alpha: v1.23
//
// Disable in-tree functionality in kubelet to authenticate to cloud provider container registries for image pull credentials.
DisableKubeletCloudCredentialProviders featuregate.Feature = "DisableKubeletCloudCredentialProviders"
|
Fix documented version for DisableKubeletCloudCredentialProviders feature gate
|
kubernetes_kubernetes
|
train
|
go
|
92c5fc1729cdbbfe3bad67e4466ffca5d36d52e4
|
diff --git a/safe/utilities/metadata.py b/safe/utilities/metadata.py
index <HASH>..<HASH> 100644
--- a/safe/utilities/metadata.py
+++ b/safe/utilities/metadata.py
@@ -60,8 +60,8 @@ def write_iso19115_metadata(layer_uri, keywords):
metadata = GenericLayerMetadata(layer_uri)
metadata.update_from_dict(keywords)
- if 'keyword_version' not in metadata.dict.keys():
- metadata.update_from_dict({'keyword_version': inasafe_keyword_version})
+ # Always set keyword_version to the latest one.
+ metadata.update_from_dict({'keyword_version': inasafe_keyword_version})
if metadata.layer_is_file_based:
xml_file_path = os.path.splitext(layer_uri)[0] + '.xml'
|
Alway set keyword version to the latest version.
|
inasafe_inasafe
|
train
|
py
|
b54f697974de9c5d3237bd9fcd1d79b29488ec99
|
diff --git a/lib/Item/ValueConverter/EntryValueConverter.php b/lib/Item/ValueConverter/EntryValueConverter.php
index <HASH>..<HASH> 100644
--- a/lib/Item/ValueConverter/EntryValueConverter.php
+++ b/lib/Item/ValueConverter/EntryValueConverter.php
@@ -36,4 +36,9 @@ final class EntryValueConverter implements ValueConverterInterface
{
return $object->getIsPublished();
}
+
+ public function getObject($object)
+ {
+ return $object;
+ }
}
diff --git a/tests/lib/Item/ValueConverter/EntryValueConverterTest.php b/tests/lib/Item/ValueConverter/EntryValueConverterTest.php
index <HASH>..<HASH> 100644
--- a/tests/lib/Item/ValueConverter/EntryValueConverterTest.php
+++ b/tests/lib/Item/ValueConverter/EntryValueConverterTest.php
@@ -84,4 +84,14 @@ class EntryValueConverterTest extends TestCase
$this->assertTrue($this->valueConverter->getIsVisible($entry));
}
+
+ /**
+ * @covers \Netgen\BlockManager\Contentful\Item\ValueConverter\EntryValueConverter::getObject
+ */
+ public function testGetObject()
+ {
+ $entry = new ContentfulEntry();
+
+ $this->assertEquals($entry, $this->valueConverter->getObject($entry));
+ }
}
|
Add ValueConverterInterface::getObject method to be able to enrich the object from CMS
|
netgen-layouts_layouts-contentful
|
train
|
php,php
|
6434896385c3030a704fd07dd3c64c50a1b36832
|
diff --git a/client/layout/guided-tours/config-elements/step.js b/client/layout/guided-tours/config-elements/step.js
index <HASH>..<HASH> 100644
--- a/client/layout/guided-tours/config-elements/step.js
+++ b/client/layout/guided-tours/config-elements/step.js
@@ -182,7 +182,7 @@ export default class Step extends Component {
this.setAnalyticsTimestamp( context );
if ( when && ! isValid( when ) ) {
- const nextStepName = anyFrom( branching[ step ] );
+ const nextStepName = props.next || anyFrom( branching[ step ] );
const skipping = this.shouldSkipAnalytics();
next( { tour, tourVersion, step, nextStepName, skipping } );
}
|
Guided Tours: actually use `Step`'s `next` prop as claimed in the docs :)
|
Automattic_wp-calypso
|
train
|
js
|
287e2a34dba279baedf31c558ef2910ee4d63266
|
diff --git a/lib/editor/tinymce/plugins/managefiles/tinymce/editor_plugin.js b/lib/editor/tinymce/plugins/managefiles/tinymce/editor_plugin.js
index <HASH>..<HASH> 100644
--- a/lib/editor/tinymce/plugins/managefiles/tinymce/editor_plugin.js
+++ b/lib/editor/tinymce/plugins/managefiles/tinymce/editor_plugin.js
@@ -93,9 +93,10 @@
var managefiles = ed.getParam('managefiles', {});
// Get draft area id from filepicker options.
- if (!managefiles.itemid && M.editor_tinymce.filepicker_options
- && M.editor_tinymce.filepicker_options[ed.id]
- && M.editor_tinymce.filepicker_options[ed.id].image) {
+ if (!managefiles.itemid && M.editor_tinymce.filepicker_options
+ && M.editor_tinymce.filepicker_options[ed.id]
+ && M.editor_tinymce.filepicker_options[ed.id].image
+ && M.editor_tinymce.filepicker_options[ed.id].image.itemid) {
managefiles.itemid = M.editor_tinymce.filepicker_options[ed.id].image.itemid;
ed.settings['managefiles'].itemid = managefiles.itemid;
}
|
MDL-<I> Additional check to be extra sure that no JS error occurs
|
moodle_moodle
|
train
|
js
|
619a9c236bf79c63d955490c0803833004a47154
|
diff --git a/git.go b/git.go
index <HASH>..<HASH> 100644
--- a/git.go
+++ b/git.go
@@ -139,6 +139,16 @@ func init() {
C.git_openssl_set_locking()
}
+// Shutdown frees all the resources acquired by libgit2. Make sure no
+// references to any git2go objects are live before calling this.
+// After this is called, invoking any function from this library will result in
+// undefined behavior, so make sure this is called carefully.
+func Shutdown() {
+ pointerHandles.Clear()
+
+ C.git_libgit2_shutdown()
+}
+
// Oid represents the id for a Git object.
type Oid [20]byte
diff --git a/handles.go b/handles.go
index <HASH>..<HASH> 100644
--- a/handles.go
+++ b/handles.go
@@ -43,6 +43,16 @@ func (v *HandleList) Untrack(handle unsafe.Pointer) {
v.Unlock()
}
+// Clear stops tracking all the managed pointers.
+func (v *HandleList) Clear() {
+ v.Lock()
+ for handle := range v.handles {
+ delete(v.handles, handle)
+ C.free(handle)
+ }
+ v.Unlock()
+}
+
// Get retrieves the pointer from the given handle
func (v *HandleList) Get(handle unsafe.Pointer) interface{} {
v.RLock()
|
Add a way to cleanly shut down the library (#<I>)
This change adds the Shutdown() method, so that the library can be
cleanly shut down. This helps significanly reduce the amount of noise in
the leak detector.
|
libgit2_git2go
|
train
|
go,go
|
614302d40c2fd972654947566f92eef46f17fedc
|
diff --git a/model/qti/Service.php b/model/qti/Service.php
index <HASH>..<HASH> 100755
--- a/model/qti/Service.php
+++ b/model/qti/Service.php
@@ -112,14 +112,7 @@ class Service extends tao_models_classes_Service
throw new common_Exception('Non QTI item('.$item->getUri().') opened via QTI Service');
}
-// common_Logger::i(print_r($itemService->getItemDirectory($item, $language), true));
-
$file = $itemService->getItemDirectory($item, $language)->getFile(self::QTI_ITEM_FILE);
-
- if (! $file->exists()) {
- return '';
- }
-// common_Logger::i(print_r($file->getPrefix(), true));
return $file->read();
}
|
Get xml data throw file not found as expected
|
oat-sa_extension-tao-itemqti
|
train
|
php
|
2ebe15caa7c9773897dc4584325fcff0a97df96d
|
diff --git a/gitlab_registry_usage/_version.py b/gitlab_registry_usage/_version.py
index <HASH>..<HASH> 100644
--- a/gitlab_registry_usage/_version.py
+++ b/gitlab_registry_usage/_version.py
@@ -1,2 +1,2 @@
-__version_info__ = (0, 2, 5)
+__version_info__ = (0, 2, 6)
__version__ = '.'.join(map(str, __version_info__))
|
Increase the version number to <I>
|
sciapp_gitlab-registry-usage
|
train
|
py
|
0de1fd7ef5a12ea1d72e43f2ca58d86da92c4a44
|
diff --git a/cloudmesh/common/ConfigDict.py b/cloudmesh/common/ConfigDict.py
index <HASH>..<HASH> 100644
--- a/cloudmesh/common/ConfigDict.py
+++ b/cloudmesh/common/ConfigDict.py
@@ -92,7 +92,8 @@ class Config(object):
"""
filename = path_expand(filename)
file_contains_tabs = False
- with file(filename) as f:
+
+ with open(filename, 'r') as f:
lines = f.read().split("\n")
line_no = 1
|
chg:usr: replace file() with open() to make it portable between <I> and <I>
|
cloudmesh_cloudmesh-common
|
train
|
py
|
301dcec3af8a30a5f0f7d9a677c6c49656249f58
|
diff --git a/bundles/org.eclipse.orion.client.javascript/web/javascript/validator.js b/bundles/org.eclipse.orion.client.javascript/web/javascript/validator.js
index <HASH>..<HASH> 100644
--- a/bundles/org.eclipse.orion.client.javascript/web/javascript/validator.js
+++ b/bundles/org.eclipse.orion.client.javascript/web/javascript/validator.js
@@ -258,6 +258,15 @@ define([
}
if(token) {
error.node = token;
+ if(token.value) {
+ if(!error.args) {
+ error.args = Object.create(null);
+ }
+ if(!error.args.data) {
+ error.args.data = Object.create(null);
+ }
+ error.args.data.tokenValue = token.value;
+ }
}
errors.push(error);
}
|
Bug <I> - Need a way to check if a problem returned from js validation has a token saying "return".
|
eclipse_orion.client
|
train
|
js
|
a99a266962bb190093930d1ac238d516bbce045d
|
diff --git a/lib/features/context-pad/ContextPad.js b/lib/features/context-pad/ContextPad.js
index <HASH>..<HASH> 100644
--- a/lib/features/context-pad/ContextPad.js
+++ b/lib/features/context-pad/ContextPad.js
@@ -138,12 +138,13 @@ ContextPad.prototype.trigger = function(action, event, autoActivate) {
* Open the context pad for the given element
*
* @param {djs.model.Base} element
+ * @param {Boolean} force if true, force reopening the context pad
*/
-ContextPad.prototype.open = function(element) {
+ContextPad.prototype.open = function(element, force) {
if (this._current && this._current.open) {
- if (this._current.element === element) {
+ if (force !== true && this._current.element === element) {
// no change needed
return;
}
|
feat(context-pad): add ability to force reopening it
Related to bpmn-io/bpmn-js#<I>
|
bpmn-io_diagram-js
|
train
|
js
|
c5bcd3d07f676e843cfc8fc8bcc431447eba72be
|
diff --git a/src/main/org/openscience/cdk/io/RssWriter.java b/src/main/org/openscience/cdk/io/RssWriter.java
index <HASH>..<HASH> 100644
--- a/src/main/org/openscience/cdk/io/RssWriter.java
+++ b/src/main/org/openscience/cdk/io/RssWriter.java
@@ -241,7 +241,7 @@ public class RssWriter extends DefaultChemObjectWriter {
writer.write(doc.toXML());
writer.flush();
}catch(IOException ex){
- throw new CDKException(ex.getMessage());
+ throw new CDKException(ex.getMessage(), ex);
}
}
|
calls to CDKException constructor made within a catch block now include the root exception to preserve stack trace
git-svn-id: <URL>
|
cdk_cdk
|
train
|
java
|
c128d8e0845c95f5eedcd64c4685a9a04ab6e039
|
diff --git a/src/main.js b/src/main.js
index <HASH>..<HASH> 100644
--- a/src/main.js
+++ b/src/main.js
@@ -20,17 +20,22 @@ $.fn.fullCalendar = function(options) {
// a method call
if (typeof options === 'string') {
- if (calendar && $.isFunction(calendar[options])) {
- singleRes = calendar[options].apply(calendar, args);
- if (!i) {
- res = singleRes; // record the first method call result
+ if (calendar) {
+ if ($.isFunction(calendar[options])) {
+ singleRes = calendar[options].apply(calendar, args);
+ if (!i) {
+ res = singleRes; // record the first method call result
+ }
+ if (options === 'destroy') { // for the destroy method, must remove Calendar object data
+ element.removeData('fullCalendar');
+ }
}
- if (options === 'destroy') { // for the destroy method, must remove Calendar object data
- element.removeData('fullCalendar');
+ else {
+ FC.warn("'" + options + "' is an unknown FullCalendar method.");
}
}
else {
- console.error("'" + options +"' is an unknown FullCalendar method.");
+ FC.warn("Attempting to call a FullCalendar method on an element with no calendar.");
}
}
// a new calendar initialization
|
adjust warnings for lack of fullcalendar object and method
|
fullcalendar_fullcalendar
|
train
|
js
|
c0904c2ed77dc9be776e404319c4ad929533bdc3
|
diff --git a/concrete/src/Package/PackageService.php b/concrete/src/Package/PackageService.php
index <HASH>..<HASH> 100644
--- a/concrete/src/Package/PackageService.php
+++ b/concrete/src/Package/PackageService.php
@@ -159,12 +159,16 @@ class PackageService
}
}
- public function bootPackageEntityManager(Package $p)
+ public function bootPackageEntityManager(Package $p, $clearCache = false)
{
$configUpdater = new EntityManagerConfigUpdater($this->entityManager);
$providerFactory = new PackageProviderFactory($this->application, $p);
$provider = $providerFactory->getEntityManagerProvider();
$configUpdater->addProvider($provider);
+ if ($clearCache) {
+ $cache = $this->entityManager->getConfiguration()->getMetadataCacheImpl();
+ $cache->flushAll();
+ }
}
public function uninstall(Package $p)
@@ -188,7 +192,7 @@ class PackageService
return $response;
}
- $this->bootPackageEntityManager($p);
+ $this->bootPackageEntityManager($p, true);
$p->install($data);
$u = new \User();
|
Fixing package installation when packages contain attributes that are immediately used in installation'
|
concrete5_concrete5
|
train
|
php
|
bde8756110f094e8d6eafdac0797334414b446db
|
diff --git a/Library/Console/Application.php b/Library/Console/Application.php
index <HASH>..<HASH> 100644
--- a/Library/Console/Application.php
+++ b/Library/Console/Application.php
@@ -12,6 +12,7 @@
namespace Zephir\Console;
use Symfony\Component\Console\Application as BaseApplication;
+use Symfony\Component\Console\Exception\CommandNotFoundException;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputDefinition;
use Symfony\Component\Console\Input\InputInterface;
@@ -90,7 +91,14 @@ final class Application extends BaseApplication
return 0;
}
- return parent::doRun($input, $output);
+ try {
+ return parent::doRun($input, $output);
+ } catch (CommandNotFoundException $e) {
+ $this->setCatchExceptions(false);
+ fprintf(STDERR, $e->getMessage().PHP_EOL);
+
+ return 1;
+ }
}
/**
|
Do not print exception backtrace when command not found
|
phalcon_zephir
|
train
|
php
|
0e5a4bc38eeaa65a1f6250490ea6c1853564096d
|
diff --git a/src/Framework/helpers.php b/src/Framework/helpers.php
index <HASH>..<HASH> 100644
--- a/src/Framework/helpers.php
+++ b/src/Framework/helpers.php
@@ -38,6 +38,8 @@ if (!function_exists('dumprr')) {
*/
function dumprr($value): void
{
- dump($value, Dumper::ERROR_LOG);
+ $result = dump($value, Dumper::RETURN);
+
+ file_put_contents('php://stderr', $result);
}
}
|
Switch dumper from error_log to direct writing into php://stderr
|
spiral_framework
|
train
|
php
|
4bedcbdf4c86c9b1f5c7f46be5172347b7cab469
|
diff --git a/src/test/java/com/smartsheet/api/models/format/FormatTest.java b/src/test/java/com/smartsheet/api/models/format/FormatTest.java
index <HASH>..<HASH> 100644
--- a/src/test/java/com/smartsheet/api/models/format/FormatTest.java
+++ b/src/test/java/com/smartsheet/api/models/format/FormatTest.java
@@ -1,4 +1,24 @@
package com.smartsheet.api.models.format;
+
+/*
+ * #[license]
+ * Smartsheet Java SDK
+ * %%
+ * Copyright (C) 2014 Smartsheet
+ * %%
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * %[license]
+ */
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
|
Added license to top of java files
|
smartsheet-platform_smartsheet-java-sdk
|
train
|
java
|
f831aa0cb298f847b1a0539d34924304892749e8
|
diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -9,5 +9,5 @@ setup(
author='Luis y Anita',
author_email='luismasuelli@hotmail.com',
description='Python library with quick utilities to make use of in a wide variety of situations',
- python_requires='>=3'
+ python_requires='>=3.6'
)
|
Moving to python version <I>+
|
luismasuelli_python-cantrips
|
train
|
py
|
247bccaca619cb4c3da1044715ca07e9377e8de2
|
diff --git a/src/multitail2.py b/src/multitail2.py
index <HASH>..<HASH> 100644
--- a/src/multitail2.py
+++ b/src/multitail2.py
@@ -1,8 +1,9 @@
import time
import glob
import os
+import random
-__version__ = "1.0.0"
+__version__ = "1.1.0"
class TailedFile:
_max_buf_size = 1 * 1024 * 1024 # 1mb
@@ -121,7 +122,13 @@ class MultiTail:
self._last_scan = time.time()
# Read new lines from all files and yield them.
- for path, tailedfile in self._tailedfiles.iteritems():
+ # Files are read from in random order each time poll is called
+ # in an attempt to read from all files evenly.
+ keys = self._tailedfiles.keys()
+ random.shuffle(keys)
+ for path in keys:
+ tailedfile = self._tailedfiles[path]
+
for line, offset in tailedfile.readlines():
self._offsets[path] = offset
yield (path, offset), line
|
Reading from files in random order in an attempt to read from all files evenly, preventing one large file from starving the others of reads.
|
derpston_python-multitail2
|
train
|
py
|
53edfee461e1eb8dbc8fe5d7343322c8eeeaca22
|
diff --git a/taco-team-build.js b/taco-team-build.js
index <HASH>..<HASH> 100644
--- a/taco-team-build.js
+++ b/taco-team-build.js
@@ -136,7 +136,7 @@ function prepareProject(cordovaPlatforms, args, /* optional */ projectPath) {
promise = promise.then(function () {
// Build app with platform specific args if specified
var callArgs = utilities.getCallArgs(platform, args);
- var argsString = _getArgsString(callArgs);
+ var argsString = _getArgsString(callArgs.options);
console.log('Queueing prepare for platform ' + platform + ' w/options: ' +argsString);
return cordova.raw.prepare(callArgs);
});
@@ -192,7 +192,7 @@ function buildProject(cordovaPlatforms, args, /* optional */ projectPath) {
promise = promise.then(function () {
// Build app with platform specific args if specified
var callArgs = utilities.getCallArgs(platform, args, cordovaVersion);
- var argsString = _getArgsString(callArgs);
+ var argsString = _getArgsString(callArgs.options);
console.log('Queueing build for platform ' + platform + ' w/options: ' + argsString);
return cordova.raw.build(callArgs);
});
|
fix one more issue with displaying args passed to build
|
Microsoft_taco-team-build
|
train
|
js
|
a23ac1d63c42472eca89c28be6d5d975c7e62c74
|
diff --git a/lib/carrierwave/storage/roz.rb b/lib/carrierwave/storage/roz.rb
index <HASH>..<HASH> 100644
--- a/lib/carrierwave/storage/roz.rb
+++ b/lib/carrierwave/storage/roz.rb
@@ -46,9 +46,7 @@ module CarrierWave
# Backwards compatibility for when we were storing only the filename
URI.join(uploader.files_base_url, "#{uploader.access_id.to_s}/", "#{uploader.store_dir}/", path).to_s
else
- dirname = ::File.dirname(path)
- basename = [uploader.version_name, ::File.basename(path)].compact.join('_')
- URI.join(uploader.files_base_url, "#{dirname}/", basename).to_s
+ URI.join(uploader.files_base_url, path).to_s
end
end
|
Fix issue with duplicate sizes in file name.
For example /some/path/small_small_zoidberg.jpg
|
biola_carrierwave-roz
|
train
|
rb
|
6673f34d092d005eaa303fd4ac696c267a2206d8
|
diff --git a/src/Tenant/Setting.php b/src/Tenant/Setting.php
index <HASH>..<HASH> 100644
--- a/src/Tenant/Setting.php
+++ b/src/Tenant/Setting.php
@@ -99,7 +99,7 @@ class Tenant_Setting extends Pluf_Model
'col' => 'mode, key'
),
'key_idx' => array(
- 'type' => 'index',
+ 'type' => 'unique',
'col' => 'key'
)
);
|
Bug fixed: key is a unique index.
|
pluf_tenant
|
train
|
php
|
c15e8efb31974c81d5ed14a4ada0515b2a7c1cd0
|
diff --git a/configfile.js b/configfile.js
index <HASH>..<HASH> 100644
--- a/configfile.js
+++ b/configfile.js
@@ -57,6 +57,9 @@ cfreader.load_config = function(name, type) {
result = cfreader.load_flat_config(name);
if (result && type !== 'list') {
result = result[0];
+ if (/^\d+$/.test(result)) {
+ result = parseInt(result);
+ }
}
}
|
if flat files contain integers, treat them as such
|
haraka_Haraka
|
train
|
js
|
afd888e6fa3d4e28ebc3ddba2e215978b81eb3c2
|
diff --git a/lang/en_US.rb b/lang/en_US.rb
index <HASH>..<HASH> 100644
--- a/lang/en_US.rb
+++ b/lang/en_US.rb
@@ -8,7 +8,7 @@ Localization.define('en_US') do |l|
l.store "he_IL", "Hebrew"
l.store "it_IT", "Italian"
l.store "ja_JP", "Japanese"
- l.store "lt_LT", "Lituanian"
+ l.store "lt_LT", "Lithuanian"
l.store "nb_NO", "Norwegian"
l.store "nl_NL", "Nederland"
l.store "pl_PL", "Polish"
|
missing the h in the lithuanian definition
|
publify_publify
|
train
|
rb
|
b1953e1d95613e1e80e2f4d4eec7e90f8b4da0a3
|
diff --git a/aioredis/connection.py b/aioredis/connection.py
index <HASH>..<HASH> 100644
--- a/aioredis/connection.py
+++ b/aioredis/connection.py
@@ -161,8 +161,8 @@ class RedisConnection(AbcConnection):
self._db = 0
self._closing = False
self._closed = False
- self._close_waiter = loop.create_future()
- self._reader_task.add_done_callback(self._close_waiter.set_result)
+ self._close_state = asyncio.Event()
+ self._reader_task.add_done_callback(lambda x: self._close_state.set())
self._in_transaction = None
self._transaction_error = None # XXX: never used?
self._in_pubsub = 0
@@ -431,7 +431,7 @@ class RedisConnection(AbcConnection):
async def wait_closed(self):
"""Coroutine waiting until connection is closed."""
- await asyncio.shield(self._close_waiter, loop=self._loop)
+ await self._close_state.wait()
@property
def db(self):
|
simplify RedisConnection wait_closed() logic
|
aio-libs_aioredis
|
train
|
py
|
052a8eec9f8ca86a72c964e2208eaf672b1c127b
|
diff --git a/scss/__init__.py b/scss/__init__.py
index <HASH>..<HASH> 100644
--- a/scss/__init__.py
+++ b/scss/__init__.py
@@ -751,7 +751,7 @@ class Scss(object):
@print_timing(2)
def Compilation(self, scss_string=None, scss_file=None):
if scss_string is not None:
- self._scss_files = {'<string>': scss_string}
+ self._scss_files = {'<string %r>' % (scss_string.strip()[:50] + '...'): scss_string}
elif scss_file is not None:
self._scss_files = {scss_file: open(scss_file).read()}
@@ -778,7 +778,7 @@ class Scss(object):
final_cont = ''
for fileid in self.css_files:
- if fileid != '<string>':
+ if not fileid.startswith('<string '):
final_cont += '/* Generated from: ' + fileid + ' */\n'
fcont = self.create_css(fileid)
final_cont += fcont
|
Added a chunk of code when code comes from string
|
Kronuz_pyScss
|
train
|
py
|
4737e525866a06768f6bfc921631dc12c3acd153
|
diff --git a/ChunkSplittingPlugin.js b/ChunkSplittingPlugin.js
index <HASH>..<HASH> 100644
--- a/ChunkSplittingPlugin.js
+++ b/ChunkSplittingPlugin.js
@@ -118,13 +118,13 @@ function extractOriginsOfChunkWithExtractedModules(chunk, reason = 'async common
// from CommonsChunkPlugin (async methods):
function extractOriginsOfChunksWithExtractedModules(chunks, reason) {
return flatMap(
- chunks,
+ Array.from(chunks),
chunk => extractOriginsOfChunkWithExtractedModules(chunk, reason)
)
}
function breakChunksIntoPieces(chunksToSplit, compilation, {
- getPartName = (sourceChunk, idx) => sourceChunk.name && `${sourceChunk.name}-part-${leadingZeros(idx + 1, 2)}`,
+ getPartName = (sourceChunk, idx, extractableModules) => sourceChunk.name && `${sourceChunk.name}-part-${leadingZeros(idx + 1, 2)}`,
maxModulesPerChunk = 100,
maxModulesPerEntry = 1,
segregator =
@@ -161,7 +161,7 @@ function breakChunksIntoPieces(chunksToSplit, compilation, {
// return new chunks
return freshChunkModuleGroups.map((extractableModules, idx) => {
- let targetName = getPartName(chunk, idx)
+ let targetName = getPartName(chunk, idx, extractableModules)
const targetChunk = compilation.addChunk(targetName)
// Remove modules that are moved to commons chunk from their original chunks
|
fix(plugin): properly iterate chunks inside 'extractOriginsOfChunkWithExtractedModules' and pass additional data to 'getPartName' (#9)
- lodash is expecting an Array, but a Set is passed to it, so the iterator is never used and the "async split" string is not added to the chunk origins as expected.
- pass set of modules to getPartName() to provide additional data for those who need it
|
niieani_chunk-splitting-plugin
|
train
|
js
|
16df4e787026f049569c7f98f30d0d714c241556
|
diff --git a/pyinfra/__main__.py b/pyinfra/__main__.py
index <HASH>..<HASH> 100644
--- a/pyinfra/__main__.py
+++ b/pyinfra/__main__.py
@@ -11,7 +11,7 @@ Usage:
pyinfra -i INVENTORY DEPLOY [-v -vv options]
pyinfra -i INVENTORY --run OP ARGS [-v -vv options]
pyinfra -i INVENTORY --run COMMAND [-v -vv options]
- pyinfra -i INVENTORY --fact FACT [-v options]
+ pyinfra -i INVENTORY --fact FACT [-vv options]
pyinfra -i INVENTORY [DEPLOY] --debug-data [options]
pyinfra (--facts | --help | --version)
|
Flip back to `-vv` on facts to print output, consistent with deploy.
|
Fizzadar_pyinfra
|
train
|
py
|
ce113fde236bf3b99404958c1561219d569d5630
|
diff --git a/generators/upgrade/index.js b/generators/upgrade/index.js
index <HASH>..<HASH> 100644
--- a/generators/upgrade/index.js
+++ b/generators/upgrade/index.js
@@ -151,7 +151,7 @@ module.exports = UpgradeGenerator.extend({
if (code !== 0) this.error('Unable to record current code has been generated with version ' +
this.currentVersion + ':\n' + msg + ' ' + err);
this.log('Current code recorded as generated with version ' + this.currentVersion);
- this._gitCheckout(UPGRADE_BRANCH, done);
+ done();
}.bind(this));
}.bind(this);
@@ -195,6 +195,11 @@ module.exports = UpgradeGenerator.extend({
}.bind(this));
},
+ checkoutUpgradeBranch: function() {
+ var done = this.async();
+ this._gitCheckout(UPGRADE_BRANCH, done);
+ },
+
generateWithLatestVersion: function() {
var done = this.async();
this._regenerate(this.latestVersion, done);
|
Upgrade submodule doesn't commit on jhipster_upgrade branch from second
upgrade
Fix #<I>
|
jhipster_generator-jhipster
|
train
|
js
|
9e3df0763c30e6986c2923b36a3f67b1798b3c0e
|
diff --git a/app_generators/ahn/templates/components/simon_game/lib/simon_game.rb b/app_generators/ahn/templates/components/simon_game/lib/simon_game.rb
index <HASH>..<HASH> 100644
--- a/app_generators/ahn/templates/components/simon_game/lib/simon_game.rb
+++ b/app_generators/ahn/templates/components/simon_game/lib/simon_game.rb
@@ -38,8 +38,7 @@ class SimonGame
call_context.play 'good'
else
call_context.play %W(#{number.size - 1} times wrong-try-again-smarty)
- initialize_attempt
- initialize_number
+ reset
end
end
@@ -54,4 +53,9 @@ class SimonGame
def initialize_number
@number ||= ''
end
+
+ def reset
+ @attempt, @number = '', ''
+ end
+
end
|
The SimonGame component formerly forgot to reset its number after a failed try. Closes ticket #5.
git-svn-id: <URL>
|
adhearsion_adhearsion
|
train
|
rb
|
c29330826c2d963764a17ae1e55ff3e2e484b1c4
|
diff --git a/lib/core/seleniumRunner.js b/lib/core/seleniumRunner.js
index <HASH>..<HASH> 100644
--- a/lib/core/seleniumRunner.js
+++ b/lib/core/seleniumRunner.js
@@ -140,8 +140,10 @@ class SeleniumRunner {
// watch Jake Archibald on ‘The Event Loop’ https://vimeo.com/254947206
// TODO do we only want to do this when we record a video?
const navigate = `(function() {
- document.body.innerHTML = '';
- document.body.style.background = '#FFFFFF';
+ const orange = document.getElementById('browsertime-orange');
+ if (orange) {
+ orange.style.backgroundColor = '#FFFFFF';
+ }
window.requestAnimationFrame(function(){
window.requestAnimationFrame(function(){
window.location="${url}";
diff --git a/lib/video/screenRecording/setOrangeBackground.js b/lib/video/screenRecording/setOrangeBackground.js
index <HASH>..<HASH> 100644
--- a/lib/video/screenRecording/setOrangeBackground.js
+++ b/lib/video/screenRecording/setOrangeBackground.js
@@ -10,6 +10,7 @@ module.exports = async function(driver) {
const orangeScript = `
(function() {
const orange = document.createElement('div');
+ orange.id = 'browsertime-orange';
orange.style.position = 'absolute';
orange.style.top = '0';
orange.style.left = '0';
|
Change the div to white the same way of do with orange (#<I>)
|
sitespeedio_browsertime
|
train
|
js,js
|
c373fea5571462c27fc47d4c2e277c5f328b82da
|
diff --git a/src/Utils.php b/src/Utils.php
index <HASH>..<HASH> 100644
--- a/src/Utils.php
+++ b/src/Utils.php
@@ -167,7 +167,7 @@ function getUserDefinedClasses()
# TODO optimize
$all = get_declared_classes();
return array_filter($all, function($class) {
- return (new \ReflectionClass($class))->isUserDefined();
+ return !(new \ReflectionClass($class))->isInternal();
});
}
|
HHVM fix attempt for wildcards
|
antecedent_patchwork
|
train
|
php
|
f88277b42d4324bdc2ce95c02662669231e68cc5
|
diff --git a/howdoi/howdoi.py b/howdoi/howdoi.py
index <HASH>..<HASH> 100755
--- a/howdoi/howdoi.py
+++ b/howdoi/howdoi.py
@@ -46,8 +46,10 @@ else:
if os.getenv('HOWDOI_DISABLE_SSL'): # Set http instead of https
SEARCH_URL = 'http://www.google.com/search?q=site:{0}%20{1}'
+ VERIFY_SSL_CERTIFICATE = False
else:
SEARCH_URL = 'https://www.google.com/search?q=site:{0}%20{1}'
+ VERIFY_SSL_CERTIFICATE = True
URL = os.getenv('HOWDOI_URL') or 'stackoverflow.com'
@@ -81,7 +83,8 @@ def get_proxies():
def _get_result(url):
try:
- return requests.get(url, headers={'User-Agent': random.choice(USER_AGENTS)}, proxies=get_proxies()).text
+ return requests.get(url, headers={'User-Agent': random.choice(USER_AGENTS)}, proxies=get_proxies(),
+ verify=VERIFY_SSL_CERTIFICATE).text
except requests.exceptions.SSLError as e:
print('[ERROR] Encountered an SSL Error. Try using HTTP instead of '
'HTTPS by setting the environment variable "HOWDOI_DISABLE_SSL".\n')
|
ignoring ssl certificate when HOWDOI_DISABLE_SSL is set
|
gleitz_howdoi
|
train
|
py
|
37ccedc46928acaf908b6d545636c1b94b3ad988
|
diff --git a/lxd/container_backup.go b/lxd/container_backup.go
index <HASH>..<HASH> 100644
--- a/lxd/container_backup.go
+++ b/lxd/container_backup.go
@@ -81,10 +81,27 @@ func containerBackupsPost(d *Daemon, r *http.Request) Response {
return SmartError(err)
}
- req := api.ContainerBackupsPost{
- ExpiryDate: time.Now().Add(30 * time.Minute), // default expiry time of 30 minutes
+ rj := shared.Jmap{}
+ err = json.NewDecoder(r.Body).Decode(&rj)
+ if err != nil {
+ return InternalError(err)
}
- err = json.NewDecoder(r.Body).Decode(&req)
+
+ expiry, _ := rj.GetString("expiry")
+ if expiry == "" {
+ // Disable expiration by setting it to zero time
+ rj["expiry"] = time.Date(1, time.January, 1, 0, 0, 0, 0, time.UTC)
+ }
+
+ // Create body with correct expiry
+ body, err := json.Marshal(rj)
+ if err != nil {
+ return InternalError(err)
+ }
+
+ req := api.ContainerBackupsPost{}
+
+ err = json.Unmarshal(body, &req)
if err != nil {
return BadRequest(err)
}
|
backup: Allow backups to not expire
|
lxc_lxd
|
train
|
go
|
ae3c26bf6491a6e3f2bf84c4f5a637a17d8d64d0
|
diff --git a/spec/cliver_spec.rb b/spec/cliver_spec.rb
index <HASH>..<HASH> 100644
--- a/spec/cliver_spec.rb
+++ b/spec/cliver_spec.rb
@@ -15,7 +15,7 @@ describe Cliver do
end
context 'when dependency is present, but wrong version' do
let(:executable) { 'ruby' }
- let(:requirements) { ['~>0.1.0'] }
+ let(:requirements) { ['~> 0.1.0'] }
let(:detector) { proc { RUBY_VERSION.sub('p', '.') } }
it { should_not be_false }
it { should match 'Dependency Version Mismatch:' }
|
<I>.x Gem::Requirement vs auto-spacing in specs
|
yaauie_cliver
|
train
|
rb
|
1a448aef8ed2716b5090817e15abbfcc0242ca67
|
diff --git a/user_management/api/tests/test_views.py b/user_management/api/tests/test_views.py
index <HASH>..<HASH> 100644
--- a/user_management/api/tests/test_views.py
+++ b/user_management/api/tests/test_views.py
@@ -23,7 +23,7 @@ TEST_SERVER = 'http://testserver'
class TestThrottle(APIRequestTestCase):
view_class = views.GetToken
- @patch('rest_framework.throttling.SimpleRateThrottle.THROTTLE_RATES', new={
+ @patch('rest_framework.throttling.AnonRateThrottle.THROTTLE_RATES', new={
'anon': '1/day',
'user': '1/day',
})
@@ -39,9 +39,9 @@ class TestThrottle(APIRequestTestCase):
response = self.view_class.as_view()(request)
self.assertEqual(response.status_code, expected_status)
- @patch('rest_framework.throttling.SimpleRateThrottle.THROTTLE_RATES', new={
- 'anon': '2/day',
- 'user': '2/day',
+ @patch('rest_framework.throttling.UserRateThrottle.THROTTLE_RATES', new={
+ 'anon': '1/day',
+ 'user': '1/day',
})
def test_user_password_reset_throttle(self):
auth_url = reverse('user_management_api:password_reset')
|
Test different throttle class to avoid request conflicts
|
incuna_django-user-management
|
train
|
py
|
7981b8df333df188f78a8c674703331cd426e341
|
diff --git a/test/player_spec.js b/test/player_spec.js
index <HASH>..<HASH> 100644
--- a/test/player_spec.js
+++ b/test/player_spec.js
@@ -53,8 +53,11 @@ describe('Player', function() {
var onError = sinon.spy()
player.on(Events.PLAYER_ERROR, onError)
player.attachTo(element)
- player.core.getCurrentContainer().playback.error()
- expect(onError).called.once
+ // some playbacks don't have an error() method. e.g flash
+ if (player.core.getCurrentContainer().playback.error) {
+ player.core.getCurrentContainer().playback.error()
+ expect(onError).called.once
+ }
})
})
})
|
PlayerSpec test fix
Not all playbacks have an error method.
Previously this test would fail on firefox, maybe it was using flash
there?
|
clappr_clappr
|
train
|
js
|
5fe5eb40f2846b2732bfbe42baa0ff04d758ce90
|
diff --git a/lib/svtplay_dl/__init__.py b/lib/svtplay_dl/__init__.py
index <HASH>..<HASH> 100644
--- a/lib/svtplay_dl/__init__.py
+++ b/lib/svtplay_dl/__init__.py
@@ -72,7 +72,7 @@ def get_media(url, options):
options.output = filenamify(title_tag)
else:
# output is a directory
- os.path.join(options.output, filenamify(title_tag))
+ options.output = os.path.join(options.output, filenamify(title_tag))
try:
stream.get(options)
|
Fix automatic filename generation when output is a directory
|
spaam_svtplay-dl
|
train
|
py
|
7d55fc92c25b787b1feddd463e4e838a164cf717
|
diff --git a/test/calendar.spec.js b/test/calendar.spec.js
index <HASH>..<HASH> 100644
--- a/test/calendar.spec.js
+++ b/test/calendar.spec.js
@@ -367,12 +367,12 @@ describe('uiCalendar', function () {
}
};
- spyOn($rootScope,'$apply');
+ spyOn($rootScope,'$apply').andCallThrough();
angular.forEach(scope.uiConfig.calendar, function(value,key){
if (typeof value === 'function'){
functionCount++;
- spyOn(scope.uiConfig.calendar, key);
+ spyOn(scope.uiConfig.calendar, key).andCallThrough();
var fullCalendarConfig = calendarCtrl.getFullCalendarConfig(scope.uiConfig.calendar, {});
@@ -401,12 +401,12 @@ describe('uiCalendar', function () {
}
};
- spyOn($rootScope,'$apply');
+ spyOn($rootScope,'$apply').andCallThrough();
angular.forEach(scope.uiConfig.calendar, function(value,key){
if (typeof value === 'function'){
functionCount++;
- spyOn(scope.uiConfig.calendar, key);
+ spyOn(scope.uiConfig.calendar, key).andCallThrough();
var fullCalendarConfig = calendarCtrl.getFullCalendarConfig(scope.uiConfig.calendar, {});
|
Ensure spied functions contents is executed
|
angular-ui_ui-calendar
|
train
|
js
|
f1d05060356f0bb31cc418c1d4abca9438c39d86
|
diff --git a/km3pipe/tests/test_srv.py b/km3pipe/tests/test_srv.py
index <HASH>..<HASH> 100644
--- a/km3pipe/tests/test_srv.py
+++ b/km3pipe/tests/test_srv.py
@@ -18,5 +18,5 @@ class TestSrvEvent(TestCase):
def test_call(self, srv_data_mock):
hits = Table({'pos_x': [1, 2], 'pos_y': [3, 4], 'pos_z': [5, 6],
'time': [100, 200], 'tot': [11, 22]})
- srv_event('token', hits)
+ srv_event('token', hits, 'rba_url')
srv_data_mock.assert_called_once()
|
Add rba url, since it's normally taken from the config
|
tamasgal_km3pipe
|
train
|
py
|
55533b36716709a5eebf39fa35c78ecb1d850849
|
diff --git a/spec/dragonfly/image_magick/plugin_spec.rb b/spec/dragonfly/image_magick/plugin_spec.rb
index <HASH>..<HASH> 100644
--- a/spec/dragonfly/image_magick/plugin_spec.rb
+++ b/spec/dragonfly/image_magick/plugin_spec.rb
@@ -124,7 +124,7 @@ describe "a configured imagemagick app" do
describe "identify" do
it "gives the output of the command line" do
image.identify.should =~ /280/
- image.identify("-format %h").should == "355\n"
+ image.identify("-format %h").chomp.should == "355"
end
end
|
modifying indentify spec to chomp the trailing /n
|
markevans_dragonfly
|
train
|
rb
|
8345ccd680c0d7af86391889ffeac640506f4009
|
diff --git a/torf/_torrent.py b/torf/_torrent.py
index <HASH>..<HASH> 100644
--- a/torf/_torrent.py
+++ b/torf/_torrent.py
@@ -714,7 +714,7 @@ class Torrent():
3. The number of pieces that have been hashed (:class:`int`)
4. The total number of pieces (:class:`int`)
- If `callback` returns anything that is not None, hashing is stopped.
+ If `callback` returns anything that is not ``None``, hashing is stopped.
:raises PathEmptyError: if :attr:`path` contains only empty
files/directories
|
Torrent.generate(): Highlight 'None' properly in docstring
|
rndusr_torf
|
train
|
py
|
d84a9818c6322a2a669e72af1e573bb727441e5c
|
diff --git a/binomial.go b/binomial.go
index <HASH>..<HASH> 100644
--- a/binomial.go
+++ b/binomial.go
@@ -32,31 +32,25 @@ func (bing BinomialGenerator) Binomial(n int64, p float64) int64 {
panic(fmt.Sprintf("Invalid parameter n: %d", n))
}
- workers := 0
- resChan := make(chan int64)
- for n > 0 {
- if n > 1000 {
+ if n > 1000 {
+ workers := 0
+ resChan := make(chan int64)
+ for n > 0 {
go func() {
res := bing.binomial(1000, p)
resChan <- res
}()
n -= 1000
workers++
- } else {
- go func() {
- res := bing.binomial(n, p)
- resChan <- res
- }()
- workers++
- break
}
+ var result int64
+ for i := 0; i < workers; i++ {
+ result += <-resChan
+ }
+ return result
+ } else {
+ return bing.binomial(n, p)
}
-
- var result int64
- for i := 0; i < workers; i++ {
- result += <-resChan
- }
- return result
}
func (bing BinomialGenerator) binomial(n int64, p float64) int64 {
|
binomial: simplify for clarity and performance.
this also fixes a mistake about a loop iterator variable:
<URL>
|
leesper_go_rng
|
train
|
go
|
61d894eacfecf2cbe9c1ff0fd37eb81aed136615
|
diff --git a/lib/puppet/indirector/exec.rb b/lib/puppet/indirector/exec.rb
index <HASH>..<HASH> 100644
--- a/lib/puppet/indirector/exec.rb
+++ b/lib/puppet/indirector/exec.rb
@@ -39,7 +39,7 @@ class Puppet::Indirector::Exec < Puppet::Indirector::Terminus
end
if output =~ /\A\s*\Z/ # all whitespace
- Puppet.debug "Empty response for #{name} from exec #{self.name} terminus"
+ Puppet.debug "Empty response for #{name} from #{self.name} terminus"
return nil
else
return output
|
Merge pull request #<I> from jblaine/patch-1
Removed spurious "exec" from a debug string
|
puppetlabs_puppet
|
train
|
rb
|
Subsets and Splits
Java Commits in Train Set
Queries for all entries where the diff_languages column is 'java', providing a filtered dataset but without deeper analysis.
Java Commits Test Data
Returns a subset of 5000 entries from the dataset where the programming language difference is Java, providing basic filtering for exploration.
Java Commits Sample
Retrieves the first 1,000 records where the 'diff_languages' column is 'java', providing limited insight into the specific data entries.
Java Commits Validation Sample
Retrieves a sample of entries from the validation dataset where the diff languages are Java, providing limited insight into specific Java-related data points.
Java Commits in Validation
This query retrieves a limited sample of entries from the validation dataset where the programming language difference is Java, providing basic filtering with minimal insight.
Java Commits Sample
This query retrieves a sample of 100 records where the 'diff_languages' is 'java', providing basic filtering but limited analytical value.
Java Commits Sample
Retrieves 100 samples where the language difference is Java, providing basic filtering but minimal analytical value.
Java Commits Sample
Retrieves 10 samples where the diff_languages column is 'java', providing basic examples of data entries with this specific language.
Java Commits Validation Sample
Retrieves 1,000 records where the differences in languages are marked as Java, providing a snapshot of that specific subset but limited to raw data.
Java Commits Sample
This query retrieves 1000 random samples from the dataset where the programming language is Java, offering limited insight beyond raw data.