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
|
---|---|---|---|---|---|
c9db0333c7e24c6b1ad2fbec043b633945142cfa | diff --git a/udiskie/mount.py b/udiskie/mount.py
index <HASH>..<HASH> 100644
--- a/udiskie/mount.py
+++ b/udiskie/mount.py
@@ -727,7 +727,8 @@ class DeviceActions(object):
"""Return an iterable over all available methods the device has."""
if device.is_filesystem:
if device.is_mounted:
- yield 'browse'
+ if self._mounter._browser:
+ yield 'browse'
yield 'unmount'
else:
yield 'mount' | Don't report 'browse' action if unavailable
This influences the tray icon and can potentially fix the behaviour of
shown actions in the device_added notification. | coldfix_udiskie | train | py |
b3e6cd75ffb7a658cb614d1f82ae349e7246f798 | diff --git a/examples/index.js b/examples/index.js
index <HASH>..<HASH> 100644
--- a/examples/index.js
+++ b/examples/index.js
@@ -44,4 +44,6 @@ async function init() {
});
}
-init().catch(logger.error);
+if (require.main === module) {
+ init().catch(logger.error);
+} | fix: run the examples as a module, or as a main entry point | yfinkelstein_node-zookeeper | train | js |
d95c2e0638882b3275ac6f7450d39b6d3aebf5f9 | diff --git a/lib/amq/protocol/version.rb b/lib/amq/protocol/version.rb
index <HASH>..<HASH> 100644
--- a/lib/amq/protocol/version.rb
+++ b/lib/amq/protocol/version.rb
@@ -1,5 +1,5 @@
module AMQ
module Protocol
- VERSION = "1.1.0"
+ VERSION = "1.2.0.pre1"
end # Protocol
end # AMQ | Now working on <I>.pre1 | ruby-amqp_amq-protocol | train | rb |
08f0d9c3ce27d13b100dcba624ec5ded990f5682 | diff --git a/database/migrations/2016_09_02_153301_create_love_likes_table.php b/database/migrations/2016_09_02_153301_create_love_likes_table.php
index <HASH>..<HASH> 100644
--- a/database/migrations/2016_09_02_153301_create_love_likes_table.php
+++ b/database/migrations/2016_09_02_153301_create_love_likes_table.php
@@ -38,8 +38,8 @@ class CreateLoveLikesTable extends Migration
$table->timestamps();
$table->unique([
- 'likeable_id',
'likeable_type',
+ 'likeable_id',
'user_id',
], 'like_user_unique'); | Change migration since Laravel morph creates type as first one | cybercog_laravel-love | train | php |
255dc35a2675a9315cfb61b57fc61f888e90d7b4 | diff --git a/lib/Field/Reference.php b/lib/Field/Reference.php
index <HASH>..<HASH> 100644
--- a/lib/Field/Reference.php
+++ b/lib/Field/Reference.php
@@ -97,7 +97,9 @@ class Field_Reference extends Field {
return $f;
}
function destroy(){
- $this->owner->getElement($this->getDereferenced())->destroy();
+ if($e=$this->owner->hasElement($this->getDereferenced())){
+ $e->destroy();
+ }
return parent::destroy();
}
function calculateSubQuery($model,$select){ | don't destroy dereferenced field if it was ommitted | atk4_atk4 | train | php |
7aa332e6d25acfdedbbb28cee5fda577d384079f | diff --git a/squad/frontend/views.py b/squad/frontend/views.py
index <HASH>..<HASH> 100644
--- a/squad/frontend/views.py
+++ b/squad/frontend/views.py
@@ -44,7 +44,7 @@ def project(request, group_slug, project_slug):
def builds(request, group_slug, project_slug):
group = Group.objects.get(slug=group_slug)
project = group.projects.get(slug=project_slug)
- builds = project.builds.prefetch_related('test_runs').order_by('-datetime').all()
+ builds = project.builds.prefetch_related('test_runs').reverse().all()
context = {
'project': project,
'builds': builds, | frontend: use default ordering for builds | Linaro_squad | train | py |
71d3ae26dbc725338046a2f5c3bd090b2a7e17e7 | diff --git a/lib/commands/submit.js b/lib/commands/submit.js
index <HASH>..<HASH> 100644
--- a/lib/commands/submit.js
+++ b/lib/commands/submit.js
@@ -16,7 +16,10 @@ var cmd = {
var INDENT = ' ';
cmd.handler = function(argv) {
- var keyword = h.getFilename(argv.filename);
+ // use the 1st section in filename as keyword
+ // e.g. two-sum.cpp, or two-sum.78502271.ac.cpp
+ var keyword = h.getFilename(argv.filename).split('.')[0];
+
core.getProblem(keyword, function(e, problem) {
if (e) return log.fail(e);
diff --git a/lib/commands/test.js b/lib/commands/test.js
index <HASH>..<HASH> 100644
--- a/lib/commands/test.js
+++ b/lib/commands/test.js
@@ -55,7 +55,10 @@ cmd.handler = function(argv) {
testcase = h.readStdin();
}
- var keyword = h.getFilename(argv.filename);
+ // use the 1st section in filename as keyword
+ // e.g. two-sum.cpp, or two-sum.78502271.ac.cpp
+ var keyword = h.getFilename(argv.filename).split('.')[0];
+
core.getProblem(keyword, function(e, problem) {
if (e) return log.fail(e); | Support test/submit with complex filename. | skygragon_leetcode-cli | train | js,js |
094179dd8cf026d2902d6d4754cb676bf3db4b25 | diff --git a/src/Sylius/Bundle/ResourceBundle/spec/Sylius/Bundle/ResourceBundle/Twig/SyliusResourceExtensionSpec.php b/src/Sylius/Bundle/ResourceBundle/spec/Sylius/Bundle/ResourceBundle/Twig/SyliusResourceExtensionSpec.php
index <HASH>..<HASH> 100644
--- a/src/Sylius/Bundle/ResourceBundle/spec/Sylius/Bundle/ResourceBundle/Twig/SyliusResourceExtensionSpec.php
+++ b/src/Sylius/Bundle/ResourceBundle/spec/Sylius/Bundle/ResourceBundle/Twig/SyliusResourceExtensionSpec.php
@@ -28,7 +28,7 @@ use Symfony\Component\Routing\RouterInterface;
* @author Paweł Jędrzejewski <[email protected]>
* @author Arnaud Langlade <[email protected]>
*/
-class BaseExtensionSpec extends ObjectBehavior
+class SyliusResourceExtensionSpec extends ObjectBehavior
{
function let(ContainerInterface $container, RouterInterface $router, TwigEngine $templating)
{
@@ -44,7 +44,7 @@ class BaseExtensionSpec extends ObjectBehavior
function it_is_initializable()
{
- $this->shouldHaveType('Sylius\Bundle\ResourceBundle\Twig\BaseExtension');
+ $this->shouldHaveType('Sylius\Bundle\ResourceBundle\Twig\SyliusResourceExtension');
}
function it_is_a_Twig_extension() | [ResourceBundle] Fix broken spec for Twig extension | Sylius_Sylius | train | php |
01b00d45f7eaef31f624a53b9bd34474dd78ca5e | diff --git a/lib/pkgr/distributions/debian.rb b/lib/pkgr/distributions/debian.rb
index <HASH>..<HASH> 100644
--- a/lib/pkgr/distributions/debian.rb
+++ b/lib/pkgr/distributions/debian.rb
@@ -66,7 +66,7 @@ module Pkgr
end
unless missing_packages.empty?
- package_install_command = "sudo apt-get install -y #{missing_packages.map{|package| "\"#{package}\""}.join(" ")}"
+ package_install_command = "sudo apt-get install --force-yes -y #{missing_packages.map{|package| "\"#{package}\""}.join(" ")}"
if config.auto
package_install = Mixlib::ShellOut.new(package_install_command)
package_install.logger = Pkgr.logger | force-yes when installing (build) dependencies. | crohr_pkgr | train | rb |
c3527d98d03e61847bd25f9e5cedf86dcc46bebf | diff --git a/lib/class.pdf.php b/lib/class.pdf.php
index <HASH>..<HASH> 100644
--- a/lib/class.pdf.php
+++ b/lib/class.pdf.php
@@ -749,7 +749,7 @@ end
EOT;
$res = "<</Length " . mb_strlen($stream, '8bit') . " >>\n";
- $res .= "stream\n" . $stream . "endstream";
+ $res .= "stream\n" . $stream . "\nendstream";
$this->objects[$toUnicodeId]['c'] = $res;
@@ -1875,7 +1875,7 @@ EOT;
$tmp = 'o_'.$v['t'];
$cont = $this->$tmp($k, 'out');
$content.= $cont;
- $xref[] = $pos;
+ $xref[] = $pos+1; //+1 to account for \n at the start of each object
$pos+= mb_strlen($cont, '8bit');
}
@@ -2426,7 +2426,7 @@ EOT;
$flags+= pow(2, 5); // assume non-sybolic
$list = array(
'Ascent' => 'Ascender',
- 'CapHeight' => 'CapHeight',
+ 'CapHeight' => 'Ascender', //FIXME: php-font-lib is not grabbing this value, so we'll fake it and use the Ascender value // 'CapHeight'
'MissingWidth' => 'MissingWidth',
'Descent' => 'Descender',
'FontBBox' => 'FontBBox', | Fix structural errors in PDF produced by CPDF (#<I>) | dompdf_dompdf | train | php |
0f5f757909ba4456018d5f5c20e3f1441b939d34 | diff --git a/Document API/tableaudocumentapi/workbook.py b/Document API/tableaudocumentapi/workbook.py
index <HASH>..<HASH> 100644
--- a/Document API/tableaudocumentapi/workbook.py
+++ b/Document API/tableaudocumentapi/workbook.py
@@ -115,10 +115,6 @@ class Workbook(object):
@staticmethod
def _is_valid_file(filename):
- valid = 0
fileExtension = os.path.splitext(filename)[-1].lower()
- if fileExtension == ".twb":
- valid = 1
- elif fileExtension == ".tds":
- valid = 1
- return valid
+ return fileExtension in ('.twb', '.tds')
+ | Refactor _is_valid_file to be mroe pythonic and extensible if we add more filetypes in the future. No more C++ code in the python :) | tableau_document-api-python | train | py |
0dd2c1238a62aa620d7f7e5737843380a31c8b6a | diff --git a/symphony/lib/toolkit/class.entrymanager.php b/symphony/lib/toolkit/class.entrymanager.php
index <HASH>..<HASH> 100644
--- a/symphony/lib/toolkit/class.entrymanager.php
+++ b/symphony/lib/toolkit/class.entrymanager.php
@@ -369,6 +369,7 @@ class EntryManager
public static function fetch($entry_id = null, $section_id = null, $limit = null, $start = null, $where = null, $joins = null, $group = false, $buildentries = true, $element_names = null, $enable_sort = true)
{
$sort = null;
+ $select = null;
if (!$entry_id && !$section_id) {
return false; | Declare the $select variable
Re <I>bc<I>f2a<I>ce0d7ad0e<I>ab4a9e6b<I>
We should always declare variables to prevent PHP warnings.
Picked from 9d<I>de<I> | symphonycms_symphony-2 | train | php |
665ef21c858589e8beddd07d2b3fd7a36627bc99 | diff --git a/src/structures/DMChannel.js b/src/structures/DMChannel.js
index <HASH>..<HASH> 100644
--- a/src/structures/DMChannel.js
+++ b/src/structures/DMChannel.js
@@ -37,8 +37,8 @@ class DMChannel extends Channel {
}
// These are here only for documentation purposes - they are implemented by TextBasedChannel
+ send() { return; }
sendMessage() { return; }
- sendTTSMessage() { return; }
sendEmbed() { return; }
sendFile() { return; }
sendCode() { return; }
diff --git a/src/structures/GroupDMChannel.js b/src/structures/GroupDMChannel.js
index <HASH>..<HASH> 100644
--- a/src/structures/GroupDMChannel.js
+++ b/src/structures/GroupDMChannel.js
@@ -121,8 +121,8 @@ class GroupDMChannel extends Channel {
}
// These are here only for documentation purposes - they are implemented by TextBasedChannel
+ send() { return; }
sendMessage() { return; }
- sendTTSMessage() { return; }
sendEmbed() { return; }
sendFile() { return; }
sendCode() { return; } | Update DMChannel, GroupDMChannel for docs (#<I>) | discordjs_discord.js | train | js,js |
079138e6eac58ddfecbfdab1fdc6936d3078fa7e | diff --git a/pyinfra/api/operations.py b/pyinfra/api/operations.py
index <HASH>..<HASH> 100644
--- a/pyinfra/api/operations.py
+++ b/pyinfra/api/operations.py
@@ -329,7 +329,7 @@ def _run_single_op(state, op_hash):
]
for batch in batches:
- with progress_spinner(state.inventory) as progress:
+ with progress_spinner(batch) as progress:
# Spawn greenlet for each host
greenlet_to_host = {
state.pool.spawn(_run_server_op, state, host, op_hash): host | Correct bug in spinner call when running operations in batches (parallel kwarg). | Fizzadar_pyinfra | train | py |
f8cd4f3a237c55be007858a27c75d46012c346af | diff --git a/views/js/qtiCommonRenderer/renderers/interactions/PortableCustomInteraction.js b/views/js/qtiCommonRenderer/renderers/interactions/PortableCustomInteraction.js
index <HASH>..<HASH> 100644
--- a/views/js/qtiCommonRenderer/renderers/interactions/PortableCustomInteraction.js
+++ b/views/js/qtiCommonRenderer/renderers/interactions/PortableCustomInteraction.js
@@ -178,7 +178,7 @@ define([
assetManager : pciAssetManager
};
- pci.getInstance($dom[0], config, state);
+ pci.getInstance(containerHelper.get(interaction).get(0), config, state);
}else{
//call pci initialize() to render the pci
pci.initialize(id, $dom[0], properties, pciAssetManager); | fixed given the root dom element given to the IMS PCI | oat-sa_extension-tao-itemqti | train | js |
f5423a6a72bb1269ceed8de84335b80c52b79566 | diff --git a/routing.go b/routing.go
index <HASH>..<HASH> 100644
--- a/routing.go
+++ b/routing.go
@@ -222,30 +222,24 @@ func (dht *IpfsDHT) SearchValue(ctx context.Context, key string, opts ...ropts.O
}
// Select best value
if best != nil {
+ if bytes.Equal(best.Val, v.Val) {
+ continue
+ }
sel, err := dht.Validator.Select(key, [][]byte{best.Val, v.Val})
if err != nil {
log.Warning("Failed to select dht key: ", err)
continue
}
- if sel == 1 && !bytes.Equal(v.Val, best.Val) {
- best = &v
- select {
- case out <- v.Val:
- case <-ctx.Done():
- return
- }
- }
- } else {
- // Output first valid value
- if err := dht.Validator.Validate(key, v.Val); err == nil {
- best = &v
- select {
- case out <- v.Val:
- case <-ctx.Done():
- return
- }
+ if sel != 1 {
+ continue
}
}
+ best = &v
+ select {
+ case out <- v.Val:
+ case <-ctx.Done():
+ return
+ }
case <-ctx.Done():
return
} | don't double-validate values
Also, de-duplicate some logic. | libp2p_go-libp2p-kad-dht | train | go |
319f146daae0bd2bf618b1b939302bdc941ef21f | diff --git a/src/frontend/org/voltdb/utils/PBDRegularSegment.java b/src/frontend/org/voltdb/utils/PBDRegularSegment.java
index <HASH>..<HASH> 100644
--- a/src/frontend/org/voltdb/utils/PBDRegularSegment.java
+++ b/src/frontend/org/voltdb/utils/PBDRegularSegment.java
@@ -92,7 +92,7 @@ public class PBDRegularSegment extends PBDSegment {
if (m_fc.size() >= SEGMENT_HEADER_BYTES) {
m_tmpHeaderBuf.b().clear();
PBDUtils.readBufferFully(m_fc, m_tmpHeaderBuf.b(), 0);
- m_numOfEntries = m_tmpHeaderBuf.b().getInt(COUNT_OFFSET);
+ m_numOfEntries = m_tmpHeaderBuf.b().getInt();
m_size = m_tmpHeaderBuf.b().getInt();
} else {
m_numOfEntries = 0; | OP-<I>:
A corner case of the file truncation causes the PBD Segment size counter to be read incorrectly from the entry count field. This is now fixed. | VoltDB_voltdb | train | java |
136c09cd33756e31c01c07e47a81cb8c72d47f29 | diff --git a/exp/audio/audio.go b/exp/audio/audio.go
index <HASH>..<HASH> 100644
--- a/exp/audio/audio.go
+++ b/exp/audio/audio.go
@@ -147,8 +147,10 @@ func (p *Player) Play() error {
}
// TODO: IsPlaying
+// TODO: Stop
+// TODO: Seek
-func (p *Player) Stop() error {
+func (p *Player) Pause() error {
p.context.Lock()
defer p.context.Unlock() | audio: Rename Stop -> Pause | hajimehoshi_ebiten | train | go |
0c71409e3790a7fee244f9ad0435af482e479c5a | diff --git a/tests/unit/Command/CheckerTest.php b/tests/unit/Command/CheckerTest.php
index <HASH>..<HASH> 100644
--- a/tests/unit/Command/CheckerTest.php
+++ b/tests/unit/Command/CheckerTest.php
@@ -21,11 +21,10 @@ declare(strict_types=1);
namespace DocHeaderTest\Command;
use DocHeader\Command\Checker;
+use org\bovigo\vfs\vfsStream;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Console\Input\StringInput;
use Symfony\Component\Console\Output\StreamOutput;
-use function microtime;
-use function sys_get_temp_dir;
use function tmpfile;
/**
@@ -63,7 +62,7 @@ DOCHEADER;
*/
protected function setUp() : void
{
- $this->checker = new Checker('test', $this->expectedDocHeader);
+ $this->checker = new Checker('test');
}
/**
@@ -71,8 +70,10 @@ DOCHEADER;
*/
public function it_should_not_fail_when_cant_find_files_to_validate() : void
{
- $directory = sys_get_temp_dir() . '/' . microtime(true);
+ $fileSystem = vfsStream::setup();
+
$outputResource = tmpfile();
+ $directory = $fileSystem->path();
$input = new StringInput($directory);
$output = new StreamOutput($outputResource); | Fix permission error with tempfiles on test | malukenho_docheader | train | php |
fdd402d9f6f02c89d1bf793e575cd9afd3494eef | diff --git a/pyang/translators/dsdl.py b/pyang/translators/dsdl.py
index <HASH>..<HASH> 100644
--- a/pyang/translators/dsdl.py
+++ b/pyang/translators/dsdl.py
@@ -357,7 +357,10 @@ class HybridDSDLSchema(object):
else:
result += c
elif state == 1: # inside name
- if c.isalnum() or c in "_-.:":
+ if c.isalnum() or c in "_-.":
+ name += c
+ elif c == ":":
+ state = 4
name += c
elif c == "(": # function
state = 0
@@ -378,6 +381,13 @@ class HybridDSDLSchema(object):
result += c
else:
result += c
+ elif state == 4: # axis
+ if c == ":":
+ state = 0
+ result += name + c
+ else:
+ state = 1
+ name += c
if state == 1:
if ":" not in name: result += prefix()
result += name | Proper handling of axes during XSLT translation. | mbj4668_pyang | train | py |
5cb91a16a3ce661474ffb9143ca7226204c33362 | diff --git a/src/main.js b/src/main.js
index <HASH>..<HASH> 100644
--- a/src/main.js
+++ b/src/main.js
@@ -7,9 +7,9 @@ export default function lazyReq(req, modules) {
configurable: true,
get() {
let mod;
- if(typeof mVal === 'function') {
+ if (typeof mVal === 'function') {
mod = mVal(mKey);
- } else if(typeof mVal === 'string') {
+ } else if (typeof mVal === 'string') {
mod = req(mVal);
} else {
throw new Error(`Invalid module type of ${mKey}`);
@@ -21,7 +21,7 @@ export default function lazyReq(req, modules) {
});
return mod;
- }
+ },
});
}); | fix code style in src | chpio_lazyreq | train | js |
ef52cdec66d269e0fbded5306ffafdf313aab760 | diff --git a/webpack.config.js b/webpack.config.js
index <HASH>..<HASH> 100644
--- a/webpack.config.js
+++ b/webpack.config.js
@@ -84,6 +84,7 @@ const config = {
if(process.env.NODE_ENV === 'production') {
config.plugins.push(new webpack.optimize.ModuleConcatenationPlugin())
config.plugins.push(new BabiliPlugin())
+ config.output.publicPath = 'https://slupjs.github.io/'
} else {
config.output.publicPath = 'http://localhost:8080/'
config.plugins.push(new webpack.HotModuleReplacementPlugin()) | :ambulance: Support github pages in production mode | slupjs_slup | train | js |
2f0e5807d076e6f1881e073faa398dafae233992 | diff --git a/lib/controller/error_controller.js b/lib/controller/error_controller.js
index <HASH>..<HASH> 100644
--- a/lib/controller/error_controller.js
+++ b/lib/controller/error_controller.js
@@ -32,6 +32,9 @@ utils.mixin(ErrorController.prototype, new (function () {
if (err.statusCode == 404) {
err.message = 'Could not find page "' + this.request.url + '"'
}
+ if (parseInt(err.statusCode, 10) > 499) {
+ this.response.resp._stack = err.stack || err.message;
+ }
this._respond(err, opts);
}; | Get stack-traces back in request logs, custom-error code | mde_ejs | train | js |
5355df94fde268d4eabad9608666f67b11c7fb80 | diff --git a/src/cli.js b/src/cli.js
index <HASH>..<HASH> 100755
--- a/src/cli.js
+++ b/src/cli.js
@@ -22,7 +22,14 @@ const cli = createCli(`
Examples
$ kode lint
$ kode test --watch
-`);
+`, {
+ boolean: [
+ 'any-branch',
+ 'skip-cleanup',
+ 'skip-test',
+ 'watch',
+ ],
+});
/** | fix: Force parsing arguments as boolean | SimonDegraeve_kode | train | js |
3c892e0366c220932cf9030978ac0315f3f48b0d | diff --git a/server/kiwi.js b/server/kiwi.js
index <HASH>..<HASH> 100755
--- a/server/kiwi.js
+++ b/server/kiwi.js
@@ -215,9 +215,9 @@ this.kiwi_mod.printMods();
// Make sure Kiwi doesn't simply quit on an exception
-//process.on('uncaughtException', function (e) {
-// console.log('[Uncaught exception] ' + e);
-//});
+process.on('uncaughtException', function (e) {
+ console.log('[Uncaught exception] ' + e);
+});
// Start the server up
this.websocketListen(this.config.servers, this.httpHandler); | UncaughtException handler in server re-enabled | prawnsalad_KiwiIRC | train | js |
cf86c3ab593c5212970e301dd3f0dffca9585b4a | diff --git a/search/action-builder.js b/search/action-builder.js
index <HASH>..<HASH> 100644
--- a/search/action-builder.js
+++ b/search/action-builder.js
@@ -19,25 +19,9 @@ module.exports = function(config){
* @param {string} value - The query value
* @return {function} The update query function for the given identifier.
*/
- updateQuery(value){
+ updateProperties(value){
return dispatcher.handleViewAction({
- data: {
- query: value
- },
- type: 'update',
- identifier: config.identifier
- });
- },
- /**
- * Update the scope for the identifier scope.
- * @param {string} value - The scope value
- * @return {function} The update scope function for the given identifier.
- */
- updateScope(value){
- return dispatcher.handleViewAction({
- data: {
- scope: value
- },
+ data: value,
type: 'update',
identifier: config.identifier
}); | [action-builder] Add update properties. | KleeGroup_focus-core | train | js |
d6511836b287111fd026d56c368eda5c5dcf18b6 | diff --git a/telepot/helper.py b/telepot/helper.py
index <HASH>..<HASH> 100644
--- a/telepot/helper.py
+++ b/telepot/helper.py
@@ -1,5 +1,6 @@
import time
import traceback
+import threading
import telepot
import telepot.filter
from functools import partial
@@ -13,20 +14,29 @@ except ImportError:
class Microphone(object):
def __init__(self):
self._queues = set()
+ self._lock = threading.Lock()
+ def _locked(func):
+ def k(self, *args, **kwargs):
+ with self._lock:
+ func(self, *args, **kwargs)
+ return k
+
+ @_locked
def add(self, q):
self._queues.add(q)
+ @_locked
def remove(self, q):
self._queues.remove(q)
+ @_locked
def send(self, msg):
for q in self._queues:
try:
q.put_nowait(msg)
except queue.Full:
traceback.print_exc()
- pass
class WaitTooLong(telepot.TelepotException): | Microphone added lock, thread-safe | AmanoTeam_amanobot | train | py |
c545305dccbf71c5654599f64bff82c8ac1e3cf0 | diff --git a/lib/rasn1/model.rb b/lib/rasn1/model.rb
index <HASH>..<HASH> 100644
--- a/lib/rasn1/model.rb
+++ b/lib/rasn1/model.rb
@@ -206,9 +206,7 @@ module RASN1
when Proc
proc_or_class.call
when Class
- options = {}
- options[:root] = name unless name.nil?
- proc_or_class.new(options)
+ proc_or_class.new
end
end
@@ -234,13 +232,6 @@ module RASN1
end
def initialize_elements(obj, args)
- if args[:root]
- rootname = args.delete(:root)
- @elements[rootname] = @elements.delete(@root)
- @elements[rootname].name = rootname
- @root = rootname
- end
-
args.each do |name, value|
if obj[name]
if value.is_a? Hash
@@ -264,7 +255,7 @@ module RASN1
when Types::Sequence, Types::Set
h[subel.name] = private_to_h(subel)
when Model
- h[subel.name] = subel.to_h[subel.name]
+ h[@elements.key(subel)] = subel.to_h[subel.name]
when Hash
# Array of Hash for SequenceOf and SetOf
return element.value | Model: always keep given name to access element, but for a model, access its
root element trhough it defined name in this model. | sdaubert_rasn1 | train | rb |
9fa452f31489d053dbb9c7e1b9115190c41a9a8d | diff --git a/Client.php b/Client.php
index <HASH>..<HASH> 100644
--- a/Client.php
+++ b/Client.php
@@ -17,10 +17,10 @@ class Client extends Elastica_Client
$this->logger = $logger;
}
- public function request($path, $method, $data = array())
+ public function request($path, $method, $data = array(), array $query = array())
{
$start = microtime(true);
- $response = parent::request($path, $method, $data);
+ $response = parent::request($path, $method, $data, $query);
if (null !== $this->logger) {
$time = microtime(true) - $start; | Updating break from `<I>` | FriendsOfSymfony_FOSElasticaBundle | train | php |
04dc5c8b4a1cfce7a8131c10f2c8899fe207cc31 | diff --git a/lib/sshkit/command_map.rb b/lib/sshkit/command_map.rb
index <HASH>..<HASH> 100644
--- a/lib/sshkit/command_map.rb
+++ b/lib/sshkit/command_map.rb
@@ -39,7 +39,8 @@ module SSHKit
def [](command)
if prefix[command].any?
- prefixes = prefix[command].join(" ")
+ prefixes = prefix[command].map{ |prefix| prefix.respond_to?(:call) ? prefix.call : prefix }
+ prefixes = prefixes.join(" ")
"#{prefixes} #{command}"
else
diff --git a/test/unit/test_command_map.rb b/test/unit/test_command_map.rb
index <HASH>..<HASH> 100644
--- a/test/unit/test_command_map.rb
+++ b/test/unit/test_command_map.rb
@@ -28,6 +28,14 @@ module SSHKit
assert_equal map[:rake], "/home/vagrant/.rbenv/bin/rbenv exec bundle exec rake"
end
+ def test_prefix_procs
+ map = CommandMap.new
+ map.prefix[:rake].push("/home/vagrant/.rbenv/bin/rbenv exec")
+ map.prefix[:rake].push(proc{ "bundle exec" })
+
+ assert_equal map[:rake], "/home/vagrant/.rbenv/bin/rbenv exec bundle exec rake"
+ end
+
def test_prefix_unshift
map = CommandMap.new
map.prefix[:rake].push("bundle exec") | Added support for procs to command prefixes | capistrano_sshkit | train | rb,rb |
1617fc48f22491a2d6c14f7ac0aed6e474461f7c | diff --git a/client/cmd/swarming/lib/common.go b/client/cmd/swarming/lib/common.go
index <HASH>..<HASH> 100644
--- a/client/cmd/swarming/lib/common.go
+++ b/client/cmd/swarming/lib/common.go
@@ -176,7 +176,7 @@ func (s *swarmingServiceImpl) GetTaskOutputs(ctx context.Context, taskID, output
return nil, errors.Annotate(err, "failed to remove directory: %s", dir).Err()
}
- if err := os.Mkdir(dir, os.ModePerm); err != nil {
+ if err := os.MkdirAll(dir, os.ModePerm); err != nil {
return nil, err
} | [swarming] create output directory if not exists
I think it is useful if directory is created automatically.
Change-Id: Ie<I>d<I>b9e<I>dfede<I>a<I>bc<I>ba<I>b2d<I>
Reviewed-on: <URL> | luci_luci-go | train | go |
2a0366e551835556afe5b47d407cabb546182372 | diff --git a/datatableview/utils.py b/datatableview/utils.py
index <HASH>..<HASH> 100644
--- a/datatableview/utils.py
+++ b/datatableview/utils.py
@@ -129,7 +129,12 @@ def contains_plural_field(model, fields):
model = source_model
bits = orm_path.lstrip('+-').split('__')
for bit in bits[:-1]:
- field, _, direct, m2m = model._meta.get_field_by_name(bit)
+ # Use the new Model _meta API
+ # https://docs.djangoproject.com/en/1.9/ref/models/meta/
+ if hasattr(model._meta, 'get_field_by_name'):
+ field, _, direct, m2m = model._meta.get_field_by_name(bit)
+ else:
+ field = model._meta.get_field(bit)
if isinstance(field, models.ManyToManyField) \
or (USE_RELATED_OBJECT and isinstance(field, RelatedObject) and field.field.rel.multiple) \
or (not USE_RELATED_OBJECT and isinstance(field, RelatedField) and field.one_to_many): | fixes the contains_plural_field function in utils.py which did not include the correct api for model._meta for django <I> and above. | pivotal-energy-solutions_django-datatable-view | train | py |
14aa61d304c310427d58fa57f88f25909ff23523 | diff --git a/core/src/main/java/org/infinispan/loaders/file/FileCacheStoreConfig.java b/core/src/main/java/org/infinispan/loaders/file/FileCacheStoreConfig.java
index <HASH>..<HASH> 100644
--- a/core/src/main/java/org/infinispan/loaders/file/FileCacheStoreConfig.java
+++ b/core/src/main/java/org/infinispan/loaders/file/FileCacheStoreConfig.java
@@ -108,7 +108,7 @@ public class FileCacheStoreConfig extends LockSupportCacheStoreConfig {
*/
@Deprecated
public void setStreamBufferSize(int streamBufferSize) {
- testImmutability("steamBufferSize");
+ testImmutability("streamBufferSize");
this.streamBufferSize = streamBufferSize;
} | ISPN-<I> Typo in testing immutability of streamBufferSize in FileCacheStoreConfig | infinispan_infinispan | train | java |
f22f4dc4fc710e4b81f49a03929ea96866e0cc18 | diff --git a/salt/state.py b/salt/state.py
index <HASH>..<HASH> 100644
--- a/salt/state.py
+++ b/salt/state.py
@@ -2434,7 +2434,6 @@ class BaseHighState(object):
'''
Render a state file and retrieve all of the include states
'''
- err = ''
errors = []
if not local:
state_data = self.client.get_state(sls, saltenv)
@@ -2449,7 +2448,8 @@ class BaseHighState(object):
if not fn_:
errors.append(
'Specified SLS {0} in saltenv {1} is not '
- 'available on the salt master'.format(sls, saltenv)
+ 'available on the salt master or through a configured '
+ 'fileserver'.format(sls, saltenv)
)
state = None
try: | Clarify that an sls is not available on a fileserver
Instead of just assuming that it should be looking to the master only.
Refs #<I> | saltstack_salt | train | py |
119f24188535a4f5b410a134e7edeef0b6e10d93 | diff --git a/test/future_execution_test.rb b/test/future_execution_test.rb
index <HASH>..<HASH> 100644
--- a/test/future_execution_test.rb
+++ b/test/future_execution_test.rb
@@ -58,7 +58,7 @@ module Dynflow
it 'delays the action' do
_(execution_plan.steps.count).must_equal 1
- _(delayed_plan.start_at).must_be_within_delta(@start_at, 0.5)
+ _(delayed_plan.start_at.to_i).must_equal(@start_at.to_i)
_(history_names.call(execution_plan)).must_equal ['delay']
end | Fix future execution test
Apparently MySQL stores timestamps with seconds precision, which often broke
tests which checked for sub-second precision. | Dynflow_dynflow | train | rb |
99f76f50fe5b55db2cc08d523d0113ae1a003d73 | diff --git a/app/lib/ServerNodesRefreshService.java b/app/lib/ServerNodesRefreshService.java
index <HASH>..<HASH> 100644
--- a/app/lib/ServerNodesRefreshService.java
+++ b/app/lib/ServerNodesRefreshService.java
@@ -24,8 +24,8 @@ import com.google.inject.Inject;
import com.google.inject.Singleton;
import lib.security.Graylog2ServerUnavailableException;
import models.Node;
-import models.api.responses.cluster.NodesResponse;
import models.api.responses.cluster.NodeSummaryResponse;
+import models.api.responses.cluster.NodesResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -92,6 +92,10 @@ public class ServerNodesRefreshService {
api.get(NodeSummaryResponse.class).path("/system/cluster/node").nodes(configuredNodes).timeout(2, TimeUnit.SECONDS).executeOnAll();
List<Node> resolvedNodes = Lists.newArrayList();
for (Map.Entry<Node, NodeSummaryResponse> nsr : responses.entrySet()) {
+ if (nsr.getValue() == null) {
+ //skip empty responses, they indicate an error
+ continue;
+ }
final Node resolvedNode = nodeFactory.fromSummaryResponse(nsr.getValue());
resolvedNode.setActive(true);
resolvedNodes.add(resolvedNode); | guard against failure in the node discovery api | Graylog2_graylog2-server | train | java |
8076d7b5a3563b5c25bb302d4300370b5b8da7b6 | diff --git a/consul/base.py b/consul/base.py
index <HASH>..<HASH> 100644
--- a/consul/base.py
+++ b/consul/base.py
@@ -703,7 +703,8 @@ class Consul(object):
interval=None,
ttl=None,
http=None,
- timeout=None):
+ timeout=None,
+ enable_tag_override=False):
"""
Add a new service to the local agent. There is more
documentation on services
@@ -728,8 +729,18 @@ class Consul(object):
*script*, *interval*, *ttl*, *http*, and *timeout* arguments
are deprecated. use *check* instead.
+
+ *enable_tag_override* is an optional bool that enable you
+ to modify a service tags from servers(consul agent role server)
+ Default is set to False.
+ This option is only for >=v0.6.0 version on both agent and
+ servers.
+ for more information
+ https://www.consul.io/docs/agent/services.html
"""
- payload = {'name': name}
+ payload = {}
+ payload['name'] = name
+ payload['enabletagoverride'] = enable_tag_override
if service_id:
payload['id'] = service_id
if address: | Added EnableTagOverride option to service registration method. | cablehead_python-consul | train | py |
e8cde6a6e978694e881c4ea50b33b22bff3c6155 | diff --git a/pyphi/models/__init__.py b/pyphi/models/__init__.py
index <HASH>..<HASH> 100644
--- a/pyphi/models/__init__.py
+++ b/pyphi/models/__init__.py
@@ -1,4 +1,3 @@
-
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# models/__init__.py
diff --git a/pyphi/models/fmt.py b/pyphi/models/fmt.py
index <HASH>..<HASH> 100644
--- a/pyphi/models/fmt.py
+++ b/pyphi/models/fmt.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
-# fmt.py
+# models/fmt.py
"""
Helper functions for formatting pretty representations of PyPhi models. | Fix `models.fmt` file path | wmayner_pyphi | train | py,py |
84bccb3cd861e17745585b57f11876ad8308a4d5 | diff --git a/giotto/programs.py b/giotto/programs.py
index <HASH>..<HASH> 100644
--- a/giotto/programs.py
+++ b/giotto/programs.py
@@ -139,15 +139,20 @@ class ProgramManifest(object):
try:
program = self[program_name]
except KeyError:
- # program is not in name, drop down to root...
+ # program name is not in keys, drop down to root...
if '' in self.manifest:
- return {
- 'program': self[''],
- 'name': '',
- 'superformat': None,
- 'superformat_mime': None,
- 'args': [program_name] + args,
- }
+
+ result = self['']
+ if type(result) == ProgramManifest:
+ return result._parse(program_name, args)
+ else:
+ return {
+ 'program': result,
+ 'name': '',
+ 'superformat': None,
+ 'superformat_mime': None,
+ 'args': [program_name] + args,
+ }
else:
raise ProgramNotFound('Program %s Does Not Exist' % program_name)
else: | fixed some manifest parsing testcases | priestc_giotto | train | py |
27a9427d7480799a208ede94dce66899595e903a | diff --git a/web/concrete/models/users_friends.php b/web/concrete/models/users_friends.php
index <HASH>..<HASH> 100644
--- a/web/concrete/models/users_friends.php
+++ b/web/concrete/models/users_friends.php
@@ -64,6 +64,7 @@ class UsersFriends extends Object {
$sql = 'INSERT INTO UsersFriends ( friendUID, uID, status, uDateAdded ) values (?, ?, ?, ?)';
}
$db->query($sql,$vals);
+ Events::fire('on_user_friend_add', $uID, $friendUID);
return true;
}
@@ -74,9 +75,14 @@ class UsersFriends extends Object {
if(!$u || !intval($u->uID)) return false;
$uID=$u->uID;
}
+ Events::fire('on_before_user_friend_remove', $uID, $friendUID);
$db = Loader::db();
$vals = array( $friendUID, $uID);
$sql = 'DELETE FROM UsersFriends WHERE friendUID=? AND uID=?';
+ $ret = Events::fire('on_user_friend_remove', $uID, $friendUID);
+ if($ret < 0) {
+ return;
+ }
$db->query($sql,$vals);
return true;
} | friend events
Former-commit-id: dc<I>ed<I>a<I>db1e7d<I>cd<I>a<I>d | concrete5_concrete5 | train | php |
58df2a12bf386a12975d809572336f44992810f8 | diff --git a/tests/suite.php b/tests/suite.php
index <HASH>..<HASH> 100644
--- a/tests/suite.php
+++ b/tests/suite.php
@@ -28,5 +28,10 @@ class eZTestSuite extends ezpTestSuite
{
return new self();
}
+
+ public function setUp()
+ {
+ eZDir::recursiveDelete( eZINI::instance()->variable( 'FileSettings', 'VarDir' ) );
+ }
}
?> | Added a cleanup of the tests var folder in the global suite.php | ezsystems_ezpublish-legacy | train | php |
b678b02650046b6fbd8a74485158bec0e43ca851 | diff --git a/src/sandbox.js b/src/sandbox.js
index <HASH>..<HASH> 100644
--- a/src/sandbox.js
+++ b/src/sandbox.js
@@ -19,3 +19,6 @@ afterEach(function() {
this.sandbox.restore();
});
+process.on('unhandledRejection', (err) => {
+ throw err;
+}); | Throw unhandled rejections in mocha tests
Only works under >= 3.x, but will still help us potentially catch issues in test. | kpdecker_linoleum | train | js |
c4af8713c0fe18522d495eaf77da9b8b559984d5 | diff --git a/src/Sag.php b/src/Sag.php
index <HASH>..<HASH> 100644
--- a/src/Sag.php
+++ b/src/Sag.php
@@ -130,6 +130,15 @@ class Sag {
}
/**
+ * Get current session information on the server with /_session.
+ *
+ * @return stdClass
+ */
+ public function getSession() {
+ return $this->procPacket('GET', '/_session');
+ }
+
+ /**
* Sets whether Sag will decode CouchDB's JSON responses with json_decode()
* or to simply return the JSON as a string. Defaults to true.
* | Added getSession method, needed to grab the _session for finding current user when authenticating with cookie auth | sbisbee_sag | train | php |
78e0f5caa794c36dd7121c57db9aadaac8085c3a | diff --git a/tests/unit/core/oxcategoryTest.php b/tests/unit/core/oxcategoryTest.php
index <HASH>..<HASH> 100644
--- a/tests/unit/core/oxcategoryTest.php
+++ b/tests/unit/core/oxcategoryTest.php
@@ -416,6 +416,7 @@ class Unit_Core_oxCategoryTest extends OxidTestCase
public function testUpdate()
{
+ $this->markTestSkippedUntil('2014-04-23', 'Shop relations with categories not implemented yet.');
$this->_oCategoryB->oxcategories__oxparentid = new oxField("oxrootid", oxField::T_RAW);
$this->_oCategoryB->save(); // call update
$this->reload();
@@ -703,6 +704,7 @@ class Unit_Core_oxCategoryTest extends OxidTestCase
// #M291: unassigning categories
public function testUnassignWithSubCat()
{
+ $this->markTestSkippedUntil('2014-04-23', 'Shop relations with categories not implemented yet.');
}
public function testUnassignIdNotSet() | ESDEV-<I> Mark test related with categories skipped until next sprint. | OXID-eSales_oxideshop_ce | train | php |
95036f5a4c8bf68f55f84479e38535ee5384bd5b | diff --git a/lib/liebre/publisher.rb b/lib/liebre/publisher.rb
index <HASH>..<HASH> 100644
--- a/lib/liebre/publisher.rb
+++ b/lib/liebre/publisher.rb
@@ -33,12 +33,6 @@ module Liebre
end
rescue Timeout::Error
#do nothing
- ensure
- begin
- reply_queue.delete
- rescue Timeout::Error
- logger.error "error while trying to delete RPC exclusive queue"
- end
end
end
result
@@ -61,7 +55,7 @@ module Liebre
def reply_queue correlation_id
queue_name = "#{publisher_name}_callback_#{correlation_id}"
- channel.queue queue_name, :exclusive => true
+ channel.queue queue_name, :exclusive => true, :auto_delete => true
end
def exchange | rpc queues are now auto_delete | iadbox_liebre | train | rb |
fe61552fd2016095642c911414e4b9748b425589 | diff --git a/tool.go b/tool.go
index <HASH>..<HASH> 100644
--- a/tool.go
+++ b/tool.go
@@ -563,10 +563,7 @@ type serveCommandFileSystem struct {
}
func (fs serveCommandFileSystem) Open(requestName string) (http.File, error) {
- name := requestName[1:] // requestName[0] == '/'
- if !strings.HasSuffix(requestName, ".go") {
- name = path.Join(fs.serveRoot, name)
- }
+ name := path.Join(fs.serveRoot, requestName[1:]) // requestName[0] == '/'
dir, file := path.Split(name)
base := path.Base(dir) // base is parent folder name, which becomes the output file name.
@@ -627,7 +624,15 @@ func (fs serveCommandFileSystem) Open(requestName string) (http.File, error) {
}
for _, d := range fs.dirs {
- f, err := http.Dir(filepath.Join(d, "src")).Open(name)
+ dir := http.Dir(filepath.Join(d, "src"))
+
+ f, err := dir.Open(name)
+ if err == nil {
+ return f, nil
+ }
+
+ // source maps are served outside of serveRoot
+ f, err = dir.Open(requestName)
if err == nil {
return f, nil
} | Serve files outside of serveRoot to handle files referenced by sourcemaps | gopherjs_gopherjs | train | go |
e591a4160fee4eb82ef46829486a85dd7c445195 | diff --git a/lib/classes/cache/databox.php b/lib/classes/cache/databox.php
index <HASH>..<HASH> 100644
--- a/lib/classes/cache/databox.php
+++ b/lib/classes/cache/databox.php
@@ -78,8 +78,7 @@ class cache_databox
$key = 'record_' . $sbas_id . '_' . $row['value'] . '_' . \record_adapter::CACHE_TECHNICAL_DATA;
$databox->delete_data_from_cache($key);
- $sql = 'DELETE FROM memcached
- WHERE site_id = :site_id AND type="record" AND value = :value';
+ $sql = 'DELETE FROM memcached WHERE site_id = :site_id AND type="record" AND value = :value';
$params = [
':site_id' => $app['conf']->get('servername')
@@ -101,8 +100,7 @@ class cache_databox
case 'structure':
$app->getApplicationBox()->delete_data_from_cache(\appbox::CACHE_LIST_BASES);
- $sql = 'DELETE FROM memcached
- WHERE site_id = :site_id AND type="structure" AND value = :value';
+ $sql = 'DELETE FROM memcached WHERE site_id = :site_id AND type="structure" AND value = :value';
$params = [
':site_id' => $app['conf']->get('servername') | PHRAS-<I>_remove_back_slash_n (#<I>)
removing \n into SQL requests causing memcached content deletion issues. | alchemy-fr_Phraseanet | train | php |
37e1d4803513fdb31052da5f73aa577cf5931756 | diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
setup(
name='django-sniplates',
- version='0.2.0',
+ version='0.2.1',
description='Efficient template macro sets for Django',
author='Curtis Maloney',
author_email='[email protected]', | Bumped version to <I> | funkybob_django-sniplates | train | py |
8f89c608e804ab8937b50d970d44848f313c8a2c | diff --git a/library/CM/Model/Language.php b/library/CM/Model/Language.php
index <HASH>..<HASH> 100644
--- a/library/CM/Model/Language.php
+++ b/library/CM/Model/Language.php
@@ -2,9 +2,6 @@
class CM_Model_Language extends CM_Model_Abstract {
- /** @var CM_Model_Language|null $_backup */
- private $_backup;
-
/**
* @return string
*/
@@ -48,7 +45,7 @@ class CM_Model_Language extends CM_Model_Abstract {
}
/**
- * @param string $phrase
+ * @param string $phrase
* @param array|null $variableNames
* @param bool|null $skipCacheLocal
* @return string
@@ -74,7 +71,6 @@ class CM_Model_Language extends CM_Model_Abstract {
if ($variableNames !== $translations[$phrase]['variables']) {
$languageKey = CM_Model_LanguageKey::findByName($phrase);
$languageKey->setVariables($variableNames);
- $languageKey->commit();
return $this->getTranslation($phrase, $variableNames, $skipCacheLocal);
}
}
@@ -89,7 +85,7 @@ class CM_Model_Language extends CM_Model_Abstract {
}
/**
- * @param string $phrase
+ * @param string $phrase
* @param string|null $value
* @param array|null $variables
*/ | Remove unsued backup, remove unnecessary commit | cargomedia_cm | train | php |
1564f9b439c3dcec1299cda07c639633818a035d | diff --git a/test/test_crystal.rb b/test/test_crystal.rb
index <HASH>..<HASH> 100644
--- a/test/test_crystal.rb
+++ b/test/test_crystal.rb
@@ -12,7 +12,7 @@ class TestAsm < MiniTest::Test
assert_equal :mov , m.opcode
binary = @generator.assemble
assert_equal 4 , binary.length
- should = [5,0,160,227]
+ should = [0x05,0x00,0xa0,0xe3]
index = 0
binary.each_byte do |byte |
assert_equal byte , should[index] | change result to hex because that is what objectdump disasemles | ruby-x_rubyx | train | rb |
106f5df7715b280136bf5611ee2c3718f8df1975 | diff --git a/framework/core/js/lib/models/post.js b/framework/core/js/lib/models/post.js
index <HASH>..<HASH> 100644
--- a/framework/core/js/lib/models/post.js
+++ b/framework/core/js/lib/models/post.js
@@ -7,7 +7,7 @@ Post.prototype.id = Model.prop('id');
Post.prototype.number = Model.prop('number');
Post.prototype.discussion = Model.one('discussion');
-Post.prototype.time = Model.prop('time');
+Post.prototype.time = Model.prop('time', Model.date);
Post.prototype.user = Model.one('user');
Post.prototype.contentType = Model.prop('contentType');
Post.prototype.content = Model.prop('content'); | Transform post time into a date | flarum_core | train | js |
16564c42b8a01cb60b3ef3c73ea71d09ab0fcadc | diff --git a/mastodon/Mastodon.py b/mastodon/Mastodon.py
index <HASH>..<HASH> 100644
--- a/mastodon/Mastodon.py
+++ b/mastodon/Mastodon.py
@@ -563,7 +563,8 @@ class Mastodon:
included.
If `only_media` is set, return only statuses with media attachments.
- If `pinned` is set, return only statuses that have been pinned.
+ If `pinned` is set, return only statuses that have been pinned. Note that
+ as of Mastodon 2.1.0, this only works properly for instance-local users.
If `exclude_replies` is set, filter out all statuses that are replies.
Returns a list of `toot dicts`_.
@@ -574,8 +575,15 @@ class Mastodon:
if since_id != None:
since_id = self.__unpack_id(since_id)
-
+
params = self.__generate_params(locals(), ['id'])
+ if pinned == False:
+ del params["pinned"]
+ if only_media == False:
+ del params["only_media"]
+ if exclude_replies == False:
+ del params["exclude_replies"]
+
url = '/api/v1/accounts/{0}/statuses'.format(str(id))
return self.__api_request('GET', url, params) | Fix account_statuses breakage | halcy_Mastodon.py | train | py |
03e9b99044dbc57e9cf7265102761a60753a04f9 | diff --git a/imgaug/augmenters/meta.py b/imgaug/augmenters/meta.py
index <HASH>..<HASH> 100644
--- a/imgaug/augmenters/meta.py
+++ b/imgaug/augmenters/meta.py
@@ -2149,6 +2149,14 @@ class WithChannels(Augmenter):
hooks=hooks
)
+ ia.do_assert(
+ all([img_out.shape[0:2] == img_in.shape[0:2] for img_out, img_in in zip(result_then_list, result)]),
+ "Heights/widths of images changed in WithChannels from %s to %s, but expected to be the same." % (
+ str([img_in.shape[0:2] for img_in in result]),
+ str([img_out.shape[0:2] for img_out in result_then_list]),
+ )
+ )
+
if ia.is_np_array(images):
result[..., self.channels] = result_then_list
else: | Add check in WithChannels that heights/widths of images remain unchanged | aleju_imgaug | train | py |
b825a3dc346b88ec2e771ec8c9fe5412a9a466f9 | diff --git a/src/github.com/otoolep/rqlite/server/server.go b/src/github.com/otoolep/rqlite/server/server.go
index <HASH>..<HASH> 100644
--- a/src/github.com/otoolep/rqlite/server/server.go
+++ b/src/github.com/otoolep/rqlite/server/server.go
@@ -19,18 +19,29 @@ import (
"github.com/otoolep/rqlite/db"
)
-// isPretty returns whether the HTTP response body should be pretty-printed.
-func isPretty(req *http.Request) (bool, error) {
+// queryParam returns whether the given query param is set to true.
+func queryParam(req *http.Request, param string) (bool, error) {
err := req.ParseForm()
if err != nil {
return false, err
}
- if _, ok := req.Form["pretty"]; ok {
+ if _, ok := req.Form[param]; ok {
return true, nil
}
return false, nil
}
+// isPretty returns whether the HTTP response body should be pretty-printed.
+func isPretty(req *http.Request) (bool, error) {
+ return queryParam(req, "pretty")
+}
+
+// transactionRequested returns whether the client requested an explicit
+// transaction for the request.
+func transactionRequested(req *http.Request) (bool, error) {
+ return queryParam(req, "transaction")
+}
+
// The raftd server is a combination of the Raft server and an HTTP
// server which acts as the transport.
type Server struct { | Factor out detection of URL query params | rqlite_rqlite | train | go |
09e41571b53e209c3a96b3f213efdc2da6239d12 | diff --git a/src/SAML2/Assertion.php b/src/SAML2/Assertion.php
index <HASH>..<HASH> 100644
--- a/src/SAML2/Assertion.php
+++ b/src/SAML2/Assertion.php
@@ -153,10 +153,21 @@ class Assertion implements SignedElement
private $AuthenticatingAuthority;
/**
- * The attributes, as an associative array.
+ * The attributes, as an associative array, indexed by attribute name
*
- * @var array multi-dimensional array, indexed by attribute name with each value representing the attribute value
- * of that attribute. This value is an array of \DOMNodeList|string|int
+ * To ease handling, all attribute values are represented as an array of values, also for values with a multiplicity
+ * of single. There are 4 possible variants of datatypes for the values: a string, an integer, an array or
+ * a DOMNodeList
+ *
+ * If the attribute is an eduPersonTargetedID, the values will be arrays that are created by @see Utils::parseNameId
+ * and compatible with @see Utils::addNameID
+ * If the attribute value has an type-definition (xsi:string or xsi:int), the values will be of that type.
+ * If the attribute value contains a nested XML structure, the values will be a DOMNodeList
+ * In all other cases the values are treated as strings
+ *
+ * **WARNING** a DOMNodeList cannot be serialized without data-loss and should be handled explicitly
+ *
+ * @var array multi-dimensional array of \DOMNodeList|string|int|array
*/
private $attributes; | Documentation of attribute value representation is complete | simplesamlphp_saml2 | train | php |
995dc3e4af7f868f6046ac1ca498adc312c853a6 | diff --git a/ReText/tab.py b/ReText/tab.py
index <HASH>..<HASH> 100644
--- a/ReText/tab.py
+++ b/ReText/tab.py
@@ -365,6 +365,7 @@ class ReTextTab(QSplitter):
self.editBox.setPlainText(text)
self.editBox.document().setModified(False)
+ self.handleModificationChanged()
cssFileName = self.getBaseName() + '.css'
self.cssFileExists = QFile.exists(cssFileName) | tab: Do not treat empty files as modified after opening them | retext-project_retext | train | py |
fe6cdadd8897edf7d21131afed85bb9949f693c1 | diff --git a/test/helpers/console_runner.js b/test/helpers/console_runner.js
index <HASH>..<HASH> 100644
--- a/test/helpers/console_runner.js
+++ b/test/helpers/console_runner.js
@@ -121,6 +121,27 @@
}
};
+ function isExplorerConsole() {
+ if (!window || !window.console) {
+ return;
+ }
+ return window.console.clear;
+ }
+ function logTypes(str, color) {
+ if (color === undefined) {
+ console.log(str);
+ }
+ if (color === 'green') {
+ console.info(str);
+ }
+ if (color === 'red') {
+ console.error(str);
+ }
+ }
+ if (isExplorerConsole()) {
+ proto.log = logTypes;
+ }
+
function isChromeConsole() {
if (!window) {
return; | Internet Explorer console color support
As setting the colors on IE's console is not an option, we can use
console.info for good messages, and console.error for errors.
As Internet Explorer only returns info about its console when the dev
tools are active, it can be helpful to have the console open before
loading the page. Either that, or you can reload the page after opening
the console. | alex-seville_blanket | train | js |
6c0f39f4cf15769232541d106b0af71396e62418 | diff --git a/tests/ApiTest.php b/tests/ApiTest.php
index <HASH>..<HASH> 100644
--- a/tests/ApiTest.php
+++ b/tests/ApiTest.php
@@ -28,9 +28,7 @@ class ApiTest extends TestCase
$api->go()->respond();
- $output = json_decode(ob_get_contents());
-
- ob_clean();
+ $output = json_decode(ob_get_clean());
// Children | Get and clean and hopefully not break tests. | AyeAyeApi_Api | train | php |
88e6c048dca38624ac9e371782ad62eaea8fb7f8 | diff --git a/src/Handler/CloudWatch.php b/src/Handler/CloudWatch.php
index <HASH>..<HASH> 100644
--- a/src/Handler/CloudWatch.php
+++ b/src/Handler/CloudWatch.php
@@ -72,7 +72,7 @@ class CloudWatch extends AbstractProcessingHandler
// update sequence token
$this->uploadSequenceToken = $response->get('nextSequenceToken');
}
-
+
private function initialize()
{
// fetch existing groups
@@ -120,7 +120,7 @@ class CloudWatch extends AbstractProcessingHandler
$existingStreamsNames = array_map(function ($stream) {
// set sequence token
- if ($stream['logStreamName'] === $this->logStreamName) {
+ if ($stream['logStreamName'] === $this->logStreamName && isset($stream['uploadSequenceToken'])) {
$this->uploadSequenceToken = $stream['uploadSequenceToken'];
} | Using stream uploadSequenceToken only if it was defined | maxbanton_cwh | train | php |
24725bd6b88006199b8c17db78a92e693ea2cd0b | diff --git a/tests/Fixtures/TestBundle/Entity/DummyTableInheritanceRelated.php b/tests/Fixtures/TestBundle/Entity/DummyTableInheritanceRelated.php
index <HASH>..<HASH> 100644
--- a/tests/Fixtures/TestBundle/Entity/DummyTableInheritanceRelated.php
+++ b/tests/Fixtures/TestBundle/Entity/DummyTableInheritanceRelated.php
@@ -78,5 +78,4 @@ class DummyTableInheritanceRelated
return $this;
}
-
} | PHP CS Fixer changes to conform with requirements | api-platform_core | train | php |
fe54aa088426803116b7ec74a01f75afe557d274 | diff --git a/bugwarrior/services/githubutils.py b/bugwarrior/services/githubutils.py
index <HASH>..<HASH> 100644
--- a/bugwarrior/services/githubutils.py
+++ b/bugwarrior/services/githubutils.py
@@ -45,8 +45,12 @@ def get_issues(username, repo, auth):
def get_directly_assigned_issues(auth):
- """ username and repo should be strings
- auth should be a tuple of username and password.
+ """ Returns all issues assigned to authenticated user.
+
+ This will return all issues assigned to the authenticated user
+ regardless of whether the user owns the repositories in which the
+ issues exist.
+
"""
url = "https://api.github.com/user/issues?per_page=100"
return _getter(url, auth) | Updating an inaccurate docstring. | ralphbean_bugwarrior | train | py |
4606d4d4e02b9520745a65b459a9430844eb74a4 | diff --git a/src/server/pkg/worker/master.go b/src/server/pkg/worker/master.go
index <HASH>..<HASH> 100644
--- a/src/server/pkg/worker/master.go
+++ b/src/server/pkg/worker/master.go
@@ -42,6 +42,9 @@ const (
maximumRetriesPerDatum = 3
masterLockPath = "_master_worker_lock"
+
+ // The number of datums that will be enqueued on each worker.
+ queueSize = 10
)
func (a *APIServer) getMasterLogger() *taggedLogger {
@@ -386,7 +389,7 @@ func (a *APIServer) runJob(ctx context.Context, jobInfo *pps.JobInfo, pool *pool
}
failed := false
- limiter := limit.New(a.numWorkers * 10)
+ limiter := limit.New(a.numWorkers * queueSize)
// process all datums
df, err := newDatumFactory(ctx, pfsClient, jobInfo.Input)
if err != nil { | Add a constant for queue size. | pachyderm_pachyderm | train | go |
65d7b8dcaa784c3a3f175ba86eca9831bfef7309 | diff --git a/media/boom/js/boom/helpers.js b/media/boom/js/boom/helpers.js
index <HASH>..<HASH> 100755
--- a/media/boom/js/boom/helpers.js
+++ b/media/boom/js/boom/helpers.js
@@ -2,17 +2,6 @@
@fileOverview Helper functions
*/
/**
-strip all tags, return plain text
-@function
-*/
-String.prototype.text = function(){
- var str = this;
- try { str = decodeURIComponent(str); } catch(e) {}
- str = str && str.length ? $.trim(str.replace(/<\S[^><]*>/g, '')) : '';
- return str;
-};
-
-/**
convert 8 bit characters to their 7 bit equivalent
@function
*/ | Removed possibly unused function String.prototype.text() | boomcms_boom-core | train | js |
05708fb56f8d9975485e6ee4251d09629838d877 | diff --git a/lib/claide/command.rb b/lib/claide/command.rb
index <HASH>..<HASH> 100644
--- a/lib/claide/command.rb
+++ b/lib/claide/command.rb
@@ -466,7 +466,7 @@ module CLAide
# @todo Remove deprecated format support
#
def self.arguments_array=(arguments)
- warn '[!] The signature of CLAide#arguments as changed. ' \
+ warn '[!] The signature of CLAide#arguments has changed. ' \
"Use CLAide::Argument (#{self}: `#{arguments}`)".ansi.yellow
@arguments = arguments.map do |(name_str, type)|
names = name_str.split('|') | Fixed typo spotted by @segiddins | CocoaPods_CLAide | train | rb |
604779e9e7ec9c62dfe0a3c12c50b01904ab8ba0 | diff --git a/src/SxBootstrap/View/Helper/Bootstrap/FlashMessenger.php b/src/SxBootstrap/View/Helper/Bootstrap/FlashMessenger.php
index <HASH>..<HASH> 100644
--- a/src/SxBootstrap/View/Helper/Bootstrap/FlashMessenger.php
+++ b/src/SxBootstrap/View/Helper/Bootstrap/FlashMessenger.php
@@ -28,7 +28,7 @@ class FlashMessenger extends AbstractHelper
* @param bool $isBlock
* @return string
*/
- public function render($namespace = null, $isBlock = false)
+ public function __invoke($namespace = null, $isBlock = false)
{
if($namespace) {
$messagesToPrint = $this->view->flashMessenger()->render($namespace); | change render to invoke method in flashmessenger view helper | SpoonX_SxBootstrap | train | php |
42a3404db0fa3e9e635245309b15b246f20a53df | diff --git a/recipe-server/normandy/settings.py b/recipe-server/normandy/settings.py
index <HASH>..<HASH> 100644
--- a/recipe-server/normandy/settings.py
+++ b/recipe-server/normandy/settings.py
@@ -280,7 +280,7 @@ class Base(Core):
SECURE_PROXY_SSL_HEADER = values.TupleValue()
SECURE_HSTS_SECONDS = values.IntegerValue(3600)
SECURE_HSTS_INCLUDE_SUBDOMAINS = values.BooleanValue(True)
- CSRF_COOKIE_HTTPONLY = values.BooleanValue(True)
+ CSRF_COOKIE_HTTPONLY = values.BooleanValue(False)
CSRF_COOKIE_SECURE = values.BooleanValue(True)
SECURE_SSL_REDIRECT = values.BooleanValue(True)
SECURE_REDIRECT_EXEMPT = values.ListValue([]) | Set CSRF_COOKIE_HTTPONLY to False by default | mozilla_normandy | train | py |
c8f42cad3ddf243b72cddea0377ae42d367cbbcb | diff --git a/lxd/instance/drivers/driver_qemu.go b/lxd/instance/drivers/driver_qemu.go
index <HASH>..<HASH> 100644
--- a/lxd/instance/drivers/driver_qemu.go
+++ b/lxd/instance/drivers/driver_qemu.go
@@ -422,8 +422,15 @@ func (d *qemu) getMonitorEventHandler() func(event string, data map[string]inter
inst, err := instance.LoadByProjectAndName(state, projectName, instanceName)
if err != nil {
- logger.Error("Failed to load instance", log.Ctx{"err": err})
- return
+ // If DB not available, try loading from backup file.
+ logger.Warn("Failed loading instance from database, trying backup file", log.Ctx{"err": err})
+
+ instancePath := filepath.Join(shared.VarPath("virtual-machines"), project.Instance(projectName, instanceName))
+ inst, err = instance.LoadFromBackup(state, projectName, instancePath, false)
+ if err != nil {
+ logger.Error("Failed loading instance", log.Ctx{"err": err})
+ return
+ }
}
if event == "RESET" { | lxd/instance/drivers/driver/qemu: Update getMonitorEventHandler to try and load instance from backup if DB not available | lxc_lxd | train | go |
83366ce35401bfac6cbf966ca21755e48d6707ce | diff --git a/lib/index.js b/lib/index.js
index <HASH>..<HASH> 100644
--- a/lib/index.js
+++ b/lib/index.js
@@ -184,10 +184,11 @@ class SendFeedback extends HTMLElement {
throw new Error('Reporter is not set yet!');
}
+ const appName = 'name' in app ? app.name : app.getName();
body += [
'\n',
'------------------------------------',
- `App: ${app.getName()} ${app.getVersion()}`,
+ `App: ${appName} ${app.getVersion()}`,
`Electron: ${process.versions.electron} (Node ${process.version})`,
`Operating System: ${process.platform} ${process.arch} ${os.release()}`
].join('\n'); | send-feedback: Use app.name in newer electron versions.
app.getName() is depereacted and will throw exeception in electron v9. | electron-elements_send-feedback | train | js |
fb4eae9fe2c01bb9096940bf30045edbfb35505a | diff --git a/cyclops/src/main/java/cyclops/function/Memoize.java b/cyclops/src/main/java/cyclops/function/Memoize.java
index <HASH>..<HASH> 100644
--- a/cyclops/src/main/java/cyclops/function/Memoize.java
+++ b/cyclops/src/main/java/cyclops/function/Memoize.java
@@ -23,7 +23,7 @@ import com.oath.cyclops.util.ExceptionSoftener;
import lombok.val;
public class Memoize {
-
+ private final static Object UNSET = new Object();
/**
* Convert a Supplier into one that caches it's result
*
@@ -31,8 +31,22 @@ public class Memoize {
* @return Memoised Supplier
*/
public static <T> Function0<T> memoizeSupplier(final Supplier<T> s) {
- final LazyImmutable<T> lazy = LazyImmutable.def();
- return () -> lazy.computeIfAbsent( s);
+ AtomicReference value = new AtomicReference<>(
+ UNSET);
+ return ()->{
+ Object val = value.get();
+ if (val == UNSET) {
+ synchronized (UNSET){
+ if(value.get()==UNSET) {
+ val = s.get();
+ value.set(val);
+ }
+ }
+ }
+
+ return (T)val;
+ };
+
}
/** | more direct impl for memoizeSupplier | aol_cyclops | train | java |
49afc39e9d4523a637fac258de02f3cd2887a06d | diff --git a/app/scripts/Widget/plugins/PressureWidget/Widget.js b/app/scripts/Widget/plugins/PressureWidget/Widget.js
index <HASH>..<HASH> 100644
--- a/app/scripts/Widget/plugins/PressureWidget/Widget.js
+++ b/app/scripts/Widget/plugins/PressureWidget/Widget.js
@@ -39,7 +39,7 @@ export class PressureWidget extends Component {
firstname: data.name,
lastname: data.lastname,
email: data.email,
- city: data.city
+ city: !!data.city ? data.city : null
},
mail: {
cc: this.getTargetList().map(target => this.getEmailTarget(target)), | [#<I>] Fix if it is an empty string, put null to city. #<I> | nossas_bonde-client | train | js |
38a8383bd44c56706dcb18f51ceecb9f6e974fa9 | diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -8,6 +8,6 @@ setup(name='chess_py',
author='Aubhro Sengupta',
author_email='[email protected]',
url='https://github.com/LordDarkula/chess_py',
- packages=['chess_py'],
- package_data=['README.md']
+ packages=['chess_py', 'chess_py.core', 'chess_py.core.algebraic', 'chess_py.game', 'chess_py.pieces',
+ 'chess_py.players'],
) | Updated setup.py so this project is an installable package | LordDarkula_chess_py | train | py |
123401cb6ed88b77d9a584eea8f2de75e518e5da | diff --git a/libact/query_strategies/__init__.py b/libact/query_strategies/__init__.py
index <HASH>..<HASH> 100644
--- a/libact/query_strategies/__init__.py
+++ b/libact/query_strategies/__init__.py
@@ -5,10 +5,7 @@ import logging
logger = logging.getLogger(__name__)
from .active_learning_by_learning import ActiveLearningByLearning
-try:
- from .hintsvm import HintSVM
-except ImportError:
- logger.warn('HintSVM library not found, not importing.')
+from .hintsvm import HintSVM
from .uncertainty_sampling import UncertaintySampling
from .query_by_committee import QueryByCommittee
from .quire import QUIRE | remove try except when hintsvm is not installed | ntucllab_libact | train | py |
a2e53a91d773024429837e7efa3e3db820320662 | diff --git a/src/angular-block-ui/service.test.js b/src/angular-block-ui/service.test.js
index <HASH>..<HASH> 100644
--- a/src/angular-block-ui/service.test.js
+++ b/src/angular-block-ui/service.test.js
@@ -606,6 +606,5 @@ describe('block-ui-service', function() {
expect($document[0].activeElement).toBe($otherInput[0]);
});
-
}); // focus management
}); | Fix window switching in IE #<I> | McNull_angular-block-ui | train | js |
b84512d2a2194f06de7a9b94ed4eb4d4a7c47a28 | diff --git a/lib/util/slice_test.go b/lib/util/slice_test.go
index <HASH>..<HASH> 100644
--- a/lib/util/slice_test.go
+++ b/lib/util/slice_test.go
@@ -20,8 +20,8 @@ func TestExist(t *testing.T) {
[]bool{true, false, false},
}
for i, exp := range test.exps {
- if exist(test.array, test.elms[i]) != exp {
- t.Errorf("Expected in %v exist result of element %s be %v, but got %v", test.array, test.elms[i], exp, exist(test.array, test.elms[i]))
+ if Exists(test.array, test.elms[i]) != exp {
+ t.Errorf("Expected in %v exist result of element %s be %v, but got %v", test.array, test.elms[i], exp, Exists(test.array, test.elms[i]))
}
}
}
@@ -44,7 +44,7 @@ func TestRemove(t *testing.T) {
},
}
for i, test := range tests {
- if exp := remove(test.slice, test.remove); !reflect.DeepEqual(exp, test.exp) {
+ if exp := Remove(test.slice, test.remove); !reflect.DeepEqual(exp, test.exp) {
t.Errorf("Test %d: Expected %v be equal to %v", i, exp, test.exp)
}
} | forgot to change method names in slice tests | limetext_backend | train | go |
70f73e1ebc5845fb77b51ba552fbe315eafc6930 | diff --git a/src/Symfony/Component/HttpKernel/Profiler/FileProfilerStorage.php b/src/Symfony/Component/HttpKernel/Profiler/FileProfilerStorage.php
index <HASH>..<HASH> 100644
--- a/src/Symfony/Component/HttpKernel/Profiler/FileProfilerStorage.php
+++ b/src/Symfony/Component/HttpKernel/Profiler/FileProfilerStorage.php
@@ -107,8 +107,14 @@ class FileProfilerStorage implements ProfilerStorageInterface
*/
public function write(Profile $profile)
{
+ $file = $this->getFilename($profile->getToken());
+
+ if (file_exists($file)) {
+ return false;
+ }
+
// Store profile
- file_put_contents($this->getFilename($profile->getToken()), serialize($profile));
+ file_put_contents($file, serialize($profile));
// Add to index
$file = fopen($this->getIndexFilename(), 'a');
@@ -120,6 +126,8 @@ class FileProfilerStorage implements ProfilerStorageInterface
$profile->getParent() ? $profile->getParent()->getToken() : null
));
fclose($file);
+
+ return true;
}
/** | [HttpKernel] Fix tests for the file storage of profiler | symfony_symfony | train | php |
e05461559cd1d15906ca89853dcfcbe100f10e47 | diff --git a/hug/interface.py b/hug/interface.py
index <HASH>..<HASH> 100644
--- a/hug/interface.py
+++ b/hug/interface.py
@@ -331,7 +331,7 @@ class CLI(Interface):
self.interface.cli = self
used_options = {'h', 'help'}
- nargs_set = self.interface.takes_kargs
+ nargs_set = self.interface.takes_kargs or self.interface.takes_kwargs
self.parser = argparse.ArgumentParser(description=route.get('doc', self.interface.spec.__doc__))
if 'version' in route:
self.parser.add_argument('-v', '--version', action='version', | Set narg to true for kwargs | hugapi_hug | train | py |
4d487760f2f0746b5752debc996d73c2e93a0684 | diff --git a/PBB_Core.py b/PBB_Core.py
index <HASH>..<HASH> 100755
--- a/PBB_Core.py
+++ b/PBB_Core.py
@@ -729,8 +729,10 @@ class WDItemEngine(object):
json_data = json.loads(reply.text)
pprint.pprint(json_data)
+ if 'error' in json_data.keys:
+ raise UserWarning("Wikidata api returns error: "+json_data['error']['info']
- except requests.HTTPError as e:
+ except (requests.HTTPError, UserWarning) as e:
print(e)
PBB_Debug.getSentryClient().captureException(PBB_Debug.getSentryClient()) | catch API error and raise an exxception | SuLab_WikidataIntegrator | train | py |
85d800d9979fa122e0888af48c2e6a697f9da458 | diff --git a/test/test_sc2replay.py b/test/test_sc2replay.py
index <HASH>..<HASH> 100644
--- a/test/test_sc2replay.py
+++ b/test/test_sc2replay.py
@@ -17,3 +17,7 @@ class TestSC2Replay(unittest.TestCase):
self.assertEqual(self.replay.duration, '26m 17s')
self.assertEqual(self.replay.version, '1.0.2.16223')
self.assertEqual(len(self.replay.players), 8)
+
+ def test_init_with_a_file_arg(self):
+ self.replay = SC2Replay(open(TEST_DIR + 'test.SC2Replay', 'rb'))
+ self.assertEqual(self.replay.map, 'Toxic Slums') | Add a small test for init with a file arg. | eagleflo_adjutant | train | py |
86a7e23f70dae7aad1a6734269e781a5f942a9a8 | diff --git a/lib/rack/rewrite/rule.rb b/lib/rack/rewrite/rule.rb
index <HASH>..<HASH> 100644
--- a/lib/rack/rewrite/rule.rb
+++ b/lib/rack/rewrite/rule.rb
@@ -165,6 +165,8 @@ module Rack
string =~ matcher
elsif matcher.is_a?(String)
string == matcher
+ elsif matcher.is_a?(Symbol)
+ string.downcase == matcher.to_s.downcase
else
false
end | Allow matchers to be (case insensitive) Symbols. | jtrupiano_rack-rewrite | train | rb |
7743ecf92f218fea49dabb9c59fce51333861009 | diff --git a/sacad.py b/sacad.py
index <HASH>..<HASH> 100755
--- a/sacad.py
+++ b/sacad.py
@@ -860,6 +860,8 @@ class CoverParadiseCoverSource(CoverSource):
size = tuple(map(int, re_match.group(1, 2)))
# get thumbnail url
link = td1.find("a")
+ if link is None:
+ link = td2.find("b").find("a")
thumbnail_url = link.find("img").get("src")
# deduce img url without downloading subpage
cover_id = int(thumbnail_url.rsplit(".", 1)[0].rsplit("/", 1)[1]) | Fix Cover Paradise source failing for some searches | desbma_sacad | train | py |
91515ae379d2ad245fb4873d8c55bf20d44e3f33 | diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -21,9 +21,7 @@ with open(os.path.join(here, version_filename)) as version_file:
# change setup.py for readthedocs
on_rtd = os.environ.get('READTHEDOCS') == 'True'
-install_requires=['pandas', 'numpy', 'sgp4', 'pyEphem', 'requests',
- 'xarray',
- # remaining packages are excluded if on ReadTheDocs
+install_requires=['xarray', 'pandas', 'numpy', 'sgp4', 'pyEphem', 'requests',
'pysatCDF', 'apexpy', 'aacgmv2', 'pysatMagVect',
'madrigalWeb', 'h5py', 'PyForecastTools']
@@ -32,6 +30,7 @@ install_requires=['pandas', 'numpy', 'sgp4', 'pyEphem', 'requests',
# # TODO Remove when pyglow works in python 3
# install_requires.append('pyglow')
+# all packages after pysatCDF are excluded if on ReadTheDocs
if on_rtd:
# read the docs doesn't do Fortran
# remove pysatCDF through h5py | Update setup.py
Moved xarray import to the front. Read the Docs isn't getting the correct pandas version and can't handle self upgrading for some reason. | rstoneback_pysat | train | py |
db17a7c70048686531d6f525dc8351ff1558ed68 | diff --git a/Lib/glyphsLib/classes.py b/Lib/glyphsLib/classes.py
index <HASH>..<HASH> 100755
--- a/Lib/glyphsLib/classes.py
+++ b/Lib/glyphsLib/classes.py
@@ -1925,6 +1925,8 @@ class GSNode(GSBase):
else:
if self.type == CURVE:
content = "c"
+ elif self.type == QCURVE:
+ content = "q"
elif self.type == OFFCURVE:
content = "o"
elif self.type == LINE: | Fix saving quadratic curves in Glyphs 3 | googlefonts_glyphsLib | train | py |
b08ae3f008d8ee979c11b2567906b5e4d92677e1 | diff --git a/lib/csscomb.js b/lib/csscomb.js
index <HASH>..<HASH> 100644
--- a/lib/csscomb.js
+++ b/lib/csscomb.js
@@ -71,6 +71,10 @@ Comb.prototype = {
* @returns {Array}
*/
processTree: function(tree) {
+
+ // We walk across complete tree for each handler,
+ // because we need strictly maintain order in which handlers work,
+ // despite fact that handlers work on different level of the tree.
this._handlers.forEach(function(handler) {
this.processNode(['tree', tree], 0, handler);
}, this); | Add comment with explanation for independed pass | csscomb_csscomb.js | train | js |
e491dc7a060ec8026689991f25c3d2b0dc574bc9 | diff --git a/jquery.flot.pie.js b/jquery.flot.pie.js
index <HASH>..<HASH> 100644
--- a/jquery.flot.pie.js
+++ b/jquery.flot.pie.js
@@ -232,19 +232,21 @@ More detail and specific examples can be found in the included HTML file.
for (var i = 0; i < data.length; ++i) {
- if (data[i].data[0][1] / total <= options.series.pie.combine.threshold) {
- combined += data[i].data[0][1];
+ var value = data[i].data[0][1];
+
+ if (value / total <= options.series.pie.combine.threshold) {
+ combined += value;
numCombined++;
if (!color) {
color = data[i].color;
}
} else {
newdata.push({
- data: [[1, data[i].data[0][1]]],
+ data: [[1, value]],
color: data[i].color,
label: data[i].label,
- angle: data[i].data[0][1] * Math.PI * 2 / total,
- percent: data[i].data[0][1] / (total / 100)
+ angle: value * Math.PI * 2 / total,
+ percent: value / (total / 100)
});
}
} | Cache the data value, since it is used repeatedly. | ni-kismet_engineering-flot | train | js |
7450fc1000ff5cbb5a2c2a229a6fed673933d65d | diff --git a/apps/advanced/frontend/config/main.php b/apps/advanced/frontend/config/main.php
index <HASH>..<HASH> 100644
--- a/apps/advanced/frontend/config/main.php
+++ b/apps/advanced/frontend/config/main.php
@@ -11,12 +11,12 @@ $params = array_merge(
return [
'id' => 'app-frontend',
'basePath' => dirname(__DIR__),
- 'vendorPath' => dirname(dirname(__DIR__)) . '/vendor',
+ 'vendorPath' => $rootDir . '/vendor',
'controllerNamespace' => 'frontend\controllers',
'modules' => [
'gii' => 'yii\gii\Module'
],
- 'extensions' => require(__DIR__ . '/../../vendor/yiisoft/extensions.php'),
+ 'extensions' => require($rootDir . '/vendor/yiisoft/extensions.php'),
'components' => [
'request' => [
'enableCsrfValidation' => true, | Small edit for consistency with frontend config.
Small edit for consistency with /apps/advanced/backend/config/main.php. Sorry, my OCD kicked in. | yiisoft_yii2-debug | train | php |
3f9a19c7a68b65636bcd2d8cd8ea3f71d62e135a | diff --git a/isotopic_logging/context.py b/isotopic_logging/context.py
index <HASH>..<HASH> 100644
--- a/isotopic_logging/context.py
+++ b/isotopic_logging/context.py
@@ -45,6 +45,8 @@ _stack = InjectionStack(_local)
class InjectionContext(object):
+ _old_enter_time = None
+
def __init__(self, injector, inherit=False):
if _stack.is_empty:
if callable(injector):
@@ -63,14 +65,18 @@ class InjectionContext(object):
_stack.push(item)
def __enter__(self):
- injector = _stack.top.injector
- injector.enter_time = time.time()
- return injector
+ inj = _stack.top.injector
+ self._old_enter_time, inj.enter_time = inj.enter_time, time.time()
+ return inj
def __exit__(self, type, value, traceback):
- if _stack.top.parent is self:
- item = _stack.pop()
- item.injector.enter_time = None
+ item = _stack.top
+
+ inj = item.injector
+ inj.enter_time, self._old_enter_time = self._old_enter_time, None
+
+ if item.parent is self:
+ _stack.pop()
def direct_injector(prefix, inherit=False): | ensure `elapsed_time` is related only to current context manager (#3) | oblalex_isotopic-logging | train | py |
45453f8334fb6dcc1cdc9889bee1b93cf24b9ab2 | diff --git a/src/labels/label_point.js b/src/labels/label_point.js
index <HASH>..<HASH> 100644
--- a/src/labels/label_point.js
+++ b/src/labels/label_point.js
@@ -34,6 +34,10 @@ export default class LabelPoint extends Label {
this.aabb = this.obb.getExtent();
}
+ getNextFittingSegment() {
+ return this.moveIntoTile();
+ }
+
// Try to move the label into the tile bounds
// Returns true if label was moved into tile, false if it couldn't be moved
moveIntoTile () {
@@ -63,7 +67,7 @@ export default class LabelPoint extends Label {
this.updateBBoxes();
}
- return this.inTileBounds();
+ return updated;
}
} | Temporary API symmetry between label_point and label_line for finding next | tangrams_tangram | train | js |
a20534fa2827a3243616b51005a55bf6e7485325 | diff --git a/ocLazyLoad.js b/ocLazyLoad.js
index <HASH>..<HASH> 100644
--- a/ocLazyLoad.js
+++ b/ocLazyLoad.js
@@ -29,7 +29,7 @@
//injector hasn't been assigned to the rootElement yet:
providers.getInstanceInjector = function() {
return (instanceInjector) ? instanceInjector : (instanceInjector = $rootElement.data('$injector'));
- }
+ };
return {
getModuleConfig: function(name) {
if(!modules[name]) {
@@ -127,7 +127,7 @@
loadedModule,
requires,
promisesList = [],
- load_complete;
+ loadComplete;
moduleName = self.getModuleName(module);
loadedModule = angular.module(moduleName);
@@ -177,12 +177,12 @@
});
// Create a wrapper promise to watch the promise list and resolve it once everything is done.
- load_complete = $q.defer();
+ loadComplete = $q.defer();
$q.all(promisesList).then(function () {
- load_complete.resolve();
+ loadComplete.resolve();
});
- return load_complete.promise;
+ return loadComplete.promise;
}
asyncLoader(config.files, function () { | Code style: variable name/semicolon
Renamed load_complete to loadComplete
Added missing semicolon | ocombe_ocLazyLoad | train | js |
54ca878d16b3e134e7732af94a08928151ce01c3 | diff --git a/salt/states/ceph.py b/salt/states/ceph.py
index <HASH>..<HASH> 100644
--- a/salt/states/ceph.py
+++ b/salt/states/ceph.py
@@ -66,8 +66,8 @@ def quorum(name, **kwargs):
return _test(name, "cluster quorum")
try:
cluster_quorum = __salt__['ceph.cluster_quorum'](**paramters)
- except (CommandExecutionError, CommandNotFoundError) as e:
- return _error(name, e.message)
+ except (CommandExecutionError, CommandNotFoundError) as err:
+ return _error(name, err.strerror)
if cluster_quorum:
return _unchanged(name, "cluster is quorum")
return _error(name, "cluster is not quorum") | salt.states.ceph: Rename exception.
pylint3 does not like single character variables. | saltstack_salt | train | py |
af2b1096aa22091d680855afd30bd54006b04909 | diff --git a/integrations/helm/chartsync/deps.go b/integrations/helm/chartsync/deps.go
index <HASH>..<HASH> 100644
--- a/integrations/helm/chartsync/deps.go
+++ b/integrations/helm/chartsync/deps.go
@@ -11,6 +11,15 @@ import (
func updateDependencies(chartDir, helmhome string) error {
var hasLockFile bool
+ // sanity check: does the chart directory exist
+ chartInfo, err := os.Stat(chartDir)
+ switch {
+ case err != nil:
+ return err
+ case !chartInfo.IsDir():
+ return fmt.Errorf("chart path %s is not a directory", chartDir)
+ }
+
// check if the requirements file exists
reqFilePath := filepath.Join(chartDir, "requirements.yaml")
reqInfo, err := os.Stat(reqFilePath) | Check that chart exists when updating its deps
We don't want to fail at updating chart dependencies when a chart
doesn't have a requirements.yaml file (which is optional, for a
chart). However, we _do_ want to fail if the chart doesn't exist in
the filesystem at all. | weaveworks_flux | train | go |
546e28ad1b69e1ba3121289b0a3862541348f47d | diff --git a/src/Bundle/Parser/IniParser.php b/src/Bundle/Parser/IniParser.php
index <HASH>..<HASH> 100644
--- a/src/Bundle/Parser/IniParser.php
+++ b/src/Bundle/Parser/IniParser.php
@@ -103,7 +103,7 @@ class IniParser implements ParserInterface
{
$ini = parse_ini_file($file, true);
- if (false === $ini) {
+ if (!is_array($ini)) {
throw new \RuntimeException("File $file cannot be decoded");
} | Handle the case that the parse_ini_file() function is disabled (see #8). | contao_manager-plugin | train | php |
c24a27405a3b3c37d6af22d6d6aac8686de3b2c0 | diff --git a/demo/basic/index.js b/demo/basic/index.js
index <HASH>..<HASH> 100644
--- a/demo/basic/index.js
+++ b/demo/basic/index.js
@@ -2,5 +2,5 @@ var dataContext = {
points: require('./randomPoints')(10)
};
-var vivasvg = require('../');
+var vivasvg = require('../../');
vivasvg.bootstrap(document.getElementById('scene'), dataContext); | Updated path to vivasvg | anvaka_vivasvg | train | js |
a638b1c17519c9511c897306555ca4134163798d | diff --git a/khard/khard.py b/khard/khard.py
index <HASH>..<HASH> 100644
--- a/khard/khard.py
+++ b/khard/khard.py
@@ -1029,9 +1029,8 @@ def list_subcommand(vcard_list, parsable):
name = vcard.get_first_name_last_name()
else:
name = vcard.get_last_name_first_name()
- contact_line_list.append(
- '\t'.join([config.get_shortened_uid(vcard.get_uid()), name,
- vcard.address_book.name]))
+ contact_line_list.append('\t'.join([vcard.get_uid(), name,
+ vcard.address_book.name]))
print('\n'.join(contact_line_list))
else:
list_contacts(vcard_list) | Display full UID in parsable output
This is a preparation for the following move of all short uid handling
code to the AddressBook class. It also makes more sense to have the
full uid in the parsable output as it is not intended to be consumed by
humans. | scheibler_khard | train | py |
59eed8395dbddf82343d79ae0339ee8efcd54fb2 | diff --git a/Tools/build-website.js b/Tools/build-website.js
index <HASH>..<HASH> 100644
--- a/Tools/build-website.js
+++ b/Tools/build-website.js
@@ -308,7 +308,7 @@ https://github.com/laurent22/joplin/blob/master/{{{sourceMarkdownFile}}}
const footerHtml = `
<div class="footer">
-Copyright (c) 2016-2019 Laurent Cozic
+Copyright (c) 2016-2020 Laurent Cozic
</div>
</body>
</html> | fix copyright year in web site generation | laurent22_joplin | train | js |
8e25db7becd552c3893f2c739964deac7fba457d | diff --git a/aws.js b/aws.js
index <HASH>..<HASH> 100644
--- a/aws.js
+++ b/aws.js
@@ -234,7 +234,7 @@ aws.queryRoute53 = function(method, path, data, options, callback)
if (!options) options = {};
var curTime = new Date().toUTCString();
- var uri = "https://route53.amazonaws.com/2013-04-01/" + path;
+ var uri = "https://route53.amazonaws.com/2013-04-01" + path;
var headers = { "x-amz-date": curTime, "content-type": "text/xml; charset=UTF-8", "content-length": data.length };
headers["X-Amzn-Authorization"] = "AWS3-HTTPS AWSAccessKeyId=" + this.key + ",Algorithm=HmacSHA1,Signature=" + core.sign(this.secret, curTime); | Updated docs, minor bugfixes | vseryakov_backendjs | train | js |
39b6a2020422275b9d1643865669e0a2edaf4242 | diff --git a/whois.ip.php b/whois.ip.php
index <HASH>..<HASH> 100644
--- a/whois.ip.php
+++ b/whois.ip.php
@@ -65,15 +65,11 @@ function parse ($data,$query)
{
$this->Query=array();
+$this->Query['server'] = 'whois.arin.net';
+$this->Query['string'] = $query;
-unset($this->Query['handler']);
-
-if (!isset($result['rawdata']))
- {
- $result['rawdata'] = array();
- }
-
-$result['regyinfo']=array();
+$result['rawdata'] = array();
+$result['regyinfo'] = array();
$result['regyinfo']['registrar']='American Registry for Internet Numbers (ARIN)';
reset($this->REGISTRARS); | fixed problem with lastest changes in whois.ip | phpWhois_phpWhois | train | php |
78e3885dff22b86c9984b1eeb87748290e7a5c83 | diff --git a/vdom/core.py b/vdom/core.py
index <HASH>..<HASH> 100644
--- a/vdom/core.py
+++ b/vdom/core.py
@@ -79,7 +79,7 @@ class VDOM(object):
self.key = key
# Validate that all children are VDOMs or strings
- if not all([isinstance(c, VDOM) or isinstance(c, str) for c in children]):
+ if not all([isinstance(c, VDOM) or isinstance(c, str) for c in self.children]):
raise ValueError('Children must be a list of VDOM objects or strings')
# mark completion of object creation. Object is immutable from now. | Don't fail validation when no children are passed in | nteract_vdom | train | py |
74679cc566f98398db13df0312cc11188733f1f3 | diff --git a/torchvision/models/mnasnet.py b/torchvision/models/mnasnet.py
index <HASH>..<HASH> 100644
--- a/torchvision/models/mnasnet.py
+++ b/torchvision/models/mnasnet.py
@@ -1,4 +1,3 @@
-import math
import warnings
import torch | cleanup unused import (#<I>)
cleanup | pytorch_vision | train | py |
0bd2a339e92ccbae89b0c7456d5bb2c4e9f1ee55 | diff --git a/lib/vcards/vcard.rb b/lib/vcards/vcard.rb
index <HASH>..<HASH> 100644
--- a/lib/vcards/vcard.rb
+++ b/lib/vcards/vcard.rb
@@ -66,18 +66,42 @@ module Vcards
number.save
end
+ def phone_number
+ phone_numbers.first
+ end
+
+ def phone_number=(number)
+ phone_numbers.build(:number => number, :phone_number_type => 'phone')
+ end
+
has_many :mobile_numbers, :class_name => 'PhoneNumber', :conditions => ["phone_number_type = ?", 'mobile'], :after_add => :add_mobile_number
def add_mobile_number(number)
number.phone_number_type = 'mobile'
number.save
end
+ def mobile_number
+ mobile_numbers.first
+ end
+
+ def mobile_number=(number)
+ mobile_numbers.build(:number => number, :phone_number_type => 'mobile')
+ end
+
has_many :fax_numbers, :class_name => 'PhoneNumber', :conditions => ["phone_number_type = ?", 'fax'], :after_add => :add_fax_number
def add_fax_number(number)
number.phone_number_type = 'fax'
number.save
end
+ def fax_number
+ fax_numbers.first
+ end
+
+ def fax_number=(number)
+ fax_numbers.build(:number => number, :phone_number_type => 'fax')
+ end
+
# Salutation
def salutation
case honorific_prefix | Add convenience accessors for *_numbers. | huerlisi_has_vcards | train | rb |
e852580cc09ebead2ef1f8d385338ebea645308a | diff --git a/install.rb b/install.rb
index <HASH>..<HASH> 100755
--- a/install.rb
+++ b/install.rb
@@ -73,7 +73,7 @@ bins = glob(%w{bin/*})
rdoc = glob(%w{bin/* sbin/* lib/**/*.rb README README-library CHANGELOG TODO Install}).reject { |e| e=~ /\.(bat|cmd)$/ }
ri = glob(%w{bin/*.rb sbin/* lib/**/*.rb}).reject { |e| e=~ /\.(bat|cmd)$/ }
man = glob(%w{man/man[0-9]/*})
-libs = glob(%w{lib/**/*.rb lib/**/*.py lib/puppet/util/command_line/*})
+libs = glob(%w{lib/**/*.rb lib/**/*.erb lib/**/*.py lib/puppet/util/command_line/*})
tests = glob(%w{test/**/*.rb})
def do_configs(configs, target, strip = 'conf/') | maint: install erb templates under lib/
We now use a handful of erb templates to generate help, so it matters that we
install them into the right destination. This extends install.rb to reflect
that change. | puppetlabs_puppet | train | rb |
Subsets and Splits