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
baab528974771e22cb59d9fe1a4990ff04d1e3cb
diff --git a/QuickBooks/Encryption/Aes.php b/QuickBooks/Encryption/Aes.php index <HASH>..<HASH> 100755 --- a/QuickBooks/Encryption/Aes.php +++ b/QuickBooks/Encryption/Aes.php @@ -20,7 +20,7 @@ QuickBooks_Loader::load('/QuickBooks/Encryption.php'); /** * */ -class QuickBooks_Encryption_AES extends QuickBooks_Encryption +class QuickBooks_Encryption_Aes extends QuickBooks_Encryption { static function encrypt($key, $plain, $salt = null) { @@ -84,4 +84,4 @@ class QuickBooks_Encryption_AES extends QuickBooks_Encryption return $decrypted; } -} \ No newline at end of file +}
QuickBooks_Encryption_Aes instead of QuickBooks_Encryption_AES. Remainder of PR <URL>
consolibyte_quickbooks-php
train
php
c25a821003af42699fb1e1a63a58a4cc593eb75d
diff --git a/code/macroeco/ssad.py b/code/macroeco/ssad.py index <HASH>..<HASH> 100644 --- a/code/macroeco/ssad.py +++ b/code/macroeco/ssad.py @@ -118,8 +118,13 @@ def nbd(n, N, a, k, summary = False): p = float(1) / (mu / float(k) + 1) # See Bolker book Chapt 4 pmf = scipy.stats.nbinom.pmf(n, k, p) - if summary: return -sum(np.log(pmf)) - else: return pmf + if summary: + if (pmf == 0).any(): + return np.nan + else: + return -sum(np.log(pmf)) + else: + return pmf def fnbd(n, N, a, k, summary = False): @@ -164,8 +169,13 @@ def fnbd(n, N, a, k, summary = False): for i in xrange(0,np.size(n)): pmf[i] = ln_L(n[i], N, a, k) - if summary: return -sum(pmf) - else: return np.exp(pmf) + if summary: + if (pmf == 0).any(): + return np.nan + else: + return -sum(np.log(pmf)) + else: + return pmf def cnbd(n, N, a, k, summary = False):
Add catch to return nan if pmf has a zero in it
jkitzes_macroeco
train
py
983dd9643aef17f460a0ea5546e5a8d8e41ab0cb
diff --git a/src/Layers/TiledMapLayer.js b/src/Layers/TiledMapLayer.js index <HASH>..<HASH> 100644 --- a/src/Layers/TiledMapLayer.js +++ b/src/Layers/TiledMapLayer.js @@ -42,7 +42,7 @@ export var TiledMapLayer = TileLayer.extend({ // set the urls options = getUrlParams(options); - this.tileUrl = options.url + 'tile/{z}/{y}/{x}' + (options.requestParams && Object.keys(options.requestParams).length > 0 ? Util.getParamString(options.requestParams) : ''); + this.tileUrl = (options.proxy ? options.proxy + '?' : '') + options.url + 'tile/{z}/{y}/{x}' + (options.requestParams && Object.keys(options.requestParams).length > 0 ? Util.getParamString(options.requestParams) : ''); // Remove subdomain in url // https://github.com/Esri/esri-leaflet/issues/991 if (options.url.indexOf('{s}') !== -1 && options.subdomains) {
Tiledmaplayer proxy support (#<I>) * allow override of 'isModern' Add an option to let users decide to not use geoJSON, even if the underlying service supports it. Occasionally handy when ArcGIS Server has geoJSON geometry problems. * Add proxy support to tileUrl Make sure that tile requests use the proxy URL if defined in options. * Undo change to 'isModern' Can't assume that all feature layers support geojson.
Esri_esri-leaflet
train
js
9e49ff0d7fafaf79762b47158581966942bc30d9
diff --git a/Helper/Product.php b/Helper/Product.php index <HASH>..<HASH> 100644 --- a/Helper/Product.php +++ b/Helper/Product.php @@ -665,7 +665,7 @@ class Product extends AbstractHelper ); if (!$webShopPrice) { $webShopPrice = $price; - }elseif ($price > 0) { + } elseif ($price > 0) { if ($webShopPrice > $price) { $webShopPrice = $price; } else { @@ -689,7 +689,7 @@ class Product extends AbstractHelper ); if (!$originalWebShopPrice) { $originalWebShopPrice = $originalPrice; - }elseif ($originalPrice > 0) { + } elseif ($originalPrice > 0) { if ($originalWebShopPrice > $originalPrice) { $originalWebShopPrice = $originalPrice; } else {
fix(code-style): missing spaces CDP-<I>
emartech_magento2-extension
train
php
56fdd296185c299a2d731d9e7c6b458087aa9782
diff --git a/tests/Go/Instrument/Transformer/MagicConstantTransformerTest.php b/tests/Go/Instrument/Transformer/MagicConstantTransformerTest.php index <HASH>..<HASH> 100644 --- a/tests/Go/Instrument/Transformer/MagicConstantTransformerTest.php +++ b/tests/Go/Instrument/Transformer/MagicConstantTransformerTest.php @@ -56,6 +56,14 @@ class MagicConstantTransformerTest extends \PHPUnit_Framework_TestCase $this->assertEquals($expected, $this->metadata->source); } + public function testTransformerDoesNotReplaceStringWithConst() + { + $expected = '<?php echo "__FILE__"; ?>'; + $this->metadata->source = $expected; + $this->transformer->transform($this->metadata); + $this->assertEquals($expected, $this->metadata->source); + } + public function testTransformerWrapsReflectionFileName() { $this->metadata->source = '<?php $class = new ReflectionClass("stdClass"); echo $class->getFileName(); ?>';
Added failing test for replacing magic strings in another strings
goaop_framework
train
php
945cd31129de60ae9ef6482951c430374fafaa3b
diff --git a/psycopg2_pgevents/event.py b/psycopg2_pgevents/event.py index <HASH>..<HASH> 100644 --- a/psycopg2_pgevents/event.py +++ b/psycopg2_pgevents/event.py @@ -11,7 +11,20 @@ from psycopg2.extensions import connection class Event: - """Represent a psycopg2-pgevents event.""" + """Represent a psycopg2-pgevents event. + + Attributes + ---------- + type: str + PostGreSQL event type, one of 'INSERT', 'UPDATE', or 'DELETE'. + schema_name: str + Schema in which the event occurred. + table_name: str + Table in which event occurred. + row_id: str + Row ID of event. This attribute is a string so that it can + represent both regular id's and things like UUID's. + """ type: str schema_name: str table_name: str @@ -25,9 +38,9 @@ class Event: type_: str PostGreSQL event type, one of 'INSERT', 'UPDATE', or 'DELETE'. schema_name: str - Schema where the event occurred. + Schema in which the event occurred. table_name: str - Table where event occurred. + Table in which event occurred. row_id: str Row ID of event. This attribute is a string so that it can represent both regular id's and things like UUID's.
adds docstring to Event class
shawalli_psycopg2-pgevents
train
py
e3ca44e800ee8efe8e8ed8b9f16f8d98cca6b4ed
diff --git a/pushbullet_cli/app.py b/pushbullet_cli/app.py index <HASH>..<HASH> 100755 --- a/pushbullet_cli/app.py +++ b/pushbullet_cli/app.py @@ -1,16 +1,26 @@ #!/usr/bin/env python import argparse +import os import os.path import requests import re import sys +from contextlib import contextmanager PUSH_URL = "https://api.pushbullet.com/api/pushes" DEVICE_URL = "https://api.pushbullet.com/api/devices" KEY_PATH = os.path.expanduser("~/.pushbulletkey") URL_RE = re.compile(r"^[a-zA-Z]+://.+$") +@contextmanager +def private_files(): + oldmask = os.umask(077) + try: + yield + finally: + os.umask(oldmask) + class PushbulletException(Exception): pass @@ -48,7 +58,7 @@ def _get_api_key(): print("What's your API key?") print("Find it at <https://www.pushbullet.com/account>.") api_key = raw_input("> ").strip() - with open(KEY_PATH, "w") as api_file: + with private_files(), open(KEY_PATH, "w") as api_file: api_file.write(api_key) return api_key
Key file should be created with private permissions
GustavoKatel_pushbullet-cli
train
py
5daf8411ccae819f039be275d2a975a4779907d0
diff --git a/error.js b/error.js index <HASH>..<HASH> 100644 --- a/error.js +++ b/error.js @@ -42,6 +42,10 @@ class MongoError extends Error { static create(options) { return new MongoError(options); } + + hasErrorLabel(label) { + return this.errorLabels && this.errorLabels.indexOf(label) !== -1; + } } /**
feat(error): all `hasErrorLabel` method to MongoError This improves readability in the transactions code when branching on error labels for certain retry scenarios.
mongodb_node-mongodb-native
train
js
6aa9ae799cc640693e10c473638b12db30211f21
diff --git a/scripts/generate_modules_docs.py b/scripts/generate_modules_docs.py index <HASH>..<HASH> 100644 --- a/scripts/generate_modules_docs.py +++ b/scripts/generate_modules_docs.py @@ -44,6 +44,7 @@ def build_facts(): and value.__module__ == module.__name__ and getattr(value, '_pyinfra_op', False) and not value.__name__.startswith('_') + and not key.startswith('_') ) ]
Ignore modules starting with '_'.
Fizzadar_pyinfra
train
py
adffa8dfbb0b9ce391148db4ebbe3cebd1a0326c
diff --git a/src/Parser.php b/src/Parser.php index <HASH>..<HASH> 100644 --- a/src/Parser.php +++ b/src/Parser.php @@ -142,10 +142,6 @@ class Parser implements ParserInterface protected function parseValue($value, $key = null) { $value = trim($value); - if ('' === $value) { // implicit boolean - - return true; - } $type = '\Minime\\Annotations\\Types\\Dynamic'; if (preg_match($this->typesPattern, $value, $found)) { // strong typed $type = $found[1]; diff --git a/src/Types/Dynamic.php b/src/Types/Dynamic.php index <HASH>..<HASH> 100644 --- a/src/Types/Dynamic.php +++ b/src/Types/Dynamic.php @@ -16,6 +16,7 @@ class Dynamic implements TypeInterface */ public function parse($value, $annotation = null) { + if ('' === $value) return true; // implicit boolean $json = Json::jsonDecode($value); if (JSON_ERROR_NONE === json_last_error()) { return $json;
move implicit boolean resolution from Parser to Dynamic type
marcioAlmada_annotations
train
php,php
e421ea6d99fb5ba0c9d24850f0e26cffa980a82c
diff --git a/raiden/network/transport/matrix/client.py b/raiden/network/transport/matrix/client.py index <HASH>..<HASH> 100644 --- a/raiden/network/transport/matrix/client.py +++ b/raiden/network/transport/matrix/client.py @@ -596,7 +596,8 @@ class GMatrixClient(MatrixClient): for event in sync_room["account_data"]["events"]: room.account_data[event["type"]] = event["content"] - self.handle_messages_callback(all_messages) + if len(all_messages) > 0: + self.handle_messages_callback(all_messages) if first_sync: # Only update the local account data on first sync to avoid races. diff --git a/raiden/network/transport/matrix/transport.py b/raiden/network/transport/matrix/transport.py index <HASH>..<HASH> 100644 --- a/raiden/network/transport/matrix/transport.py +++ b/raiden/network/transport/matrix/transport.py @@ -903,7 +903,7 @@ class MatrixTransport(Runnable): self._raiden_service.on_messages(all_messages) - return bool(all_messages) + return len(all_messages) > 0 def _get_retrier(self, receiver: Address) -> _RetryQueue: """ Construct and return a _RetryQueue for receiver """
Don't call callback when there are no messages
raiden-network_raiden
train
py,py
abd369c17c884fdf5eaaf96920a74305730cdd7f
diff --git a/src/GameQ/Protocols/Quake3.php b/src/GameQ/Protocols/Quake3.php index <HASH>..<HASH> 100644 --- a/src/GameQ/Protocols/Quake3.php +++ b/src/GameQ/Protocols/Quake3.php @@ -165,6 +165,9 @@ class Quake3 extends Protocol */ protected function processPlayers(Buffer $buffer) { + // Some games do not have a number of current players + $playerCount = 0; + // Set the result to a new result instance $result = new Result(); @@ -183,10 +186,15 @@ class Quake3 extends Protocol // Add player name, encoded $result->addPlayer('name', utf8_encode(trim(($playerInfo->readString('"'))))); + // Increment + $playerCount++; + // Clear unset($playerInfo); } + $result->add('clients', $playerCount); + // Clear unset($buffer);
Added clients count for Quake 3 protocol. Some games may not show current client count.
Austinb_GameQ
train
php
e2bb1371c0ac409c42664649e73c73489c298035
diff --git a/inquirer/questions.py b/inquirer/questions.py index <HASH>..<HASH> 100644 --- a/inquirer/questions.py +++ b/inquirer/questions.py @@ -254,6 +254,8 @@ class Path(Text): if current is None: raise errors.ValidationError(current) + current = self.normalize_value(current) + if not is_pathname_valid(current): raise errors.ValidationError(current)
Fixing validating Path's normalized value
magmax_python-inquirer
train
py
8c4e5c1c72033271114676fe964c34a4b7a30fd3
diff --git a/src/utils/parse.js b/src/utils/parse.js index <HASH>..<HASH> 100644 --- a/src/utils/parse.js +++ b/src/utils/parse.js @@ -59,7 +59,6 @@ function sanitizeFunction(functionString) { } const func = Function(...params, match.groups.body || ''); - func.name = match.groups.name; func.displayName = match.groups.name; return func; }
Don't set function.name because it's read-only.
oxyno-zeta_react-editable-json-tree
train
js
c2885ab1451287fe615c7591b524827d707580dd
diff --git a/test.js b/test.js index <HASH>..<HASH> 100644 --- a/test.js +++ b/test.js @@ -156,6 +156,10 @@ function consoleTestReport(results, allFailures) { msg = '✔ passed'; passedCnt += 1; } + } else if (test.result === 'ignore') { + formatter = f.yellow; + msg = '⚑ deferred'; + deferredCnt += 1; } else { formatter = f.red; msg = '✖ FAILED';
Added showing ignored tests with deferred styling. Otherwise ignored tests (set with _should.ignore in TestCase definition) were marked as errors.
YahooArchive_mojito-cli-test
train
js
755830ea064e0af3b89deb7caaf0eae182dd23b1
diff --git a/p2p/net/swarm/swarm_test.go b/p2p/net/swarm/swarm_test.go index <HASH>..<HASH> 100644 --- a/p2p/net/swarm/swarm_test.go +++ b/p2p/net/swarm/swarm_test.go @@ -102,12 +102,10 @@ func connectSwarms(t *testing.T, ctx context.Context, swarms []*Swarm) { } log.Info("Connecting swarms simultaneously.") - for _, s1 := range swarms { - for _, s2 := range swarms { - if s2.local != s1.local { // don't connect to self. - wg.Add(1) - connect(s1, s2.LocalPeer(), s2.ListenAddresses()[0]) // try the first. - } + for i, s1 := range swarms { + for _, s2 := range swarms[i+1:] { + wg.Add(1) + connect(s1, s2.LocalPeer(), s2.ListenAddresses()[0]) // try the first. } } wg.Wait()
test: connect each peer precisely once. Otherwise, some tests will get confused by duplicate (temporary, we close duplicates quickly) connections. fixes libp2p/go-libp2p#<I>
libp2p_go-libp2p
train
go
d336344d346a65ec9c7e22957e2544a337db1c34
diff --git a/Facades/Route.php b/Facades/Route.php index <HASH>..<HASH> 100755 --- a/Facades/Route.php +++ b/Facades/Route.php @@ -29,7 +29,7 @@ namespace Illuminate\Support\Facades; * @method static \Illuminate\Routing\Router|\Illuminate\Routing\RouteRegistrar group(\Closure|string|array $attributes, \Closure|string $routes) * @method static \Illuminate\Routing\Route redirect(string $uri, string $destination, int $status = 302) * @method static \Illuminate\Routing\Route permanentRedirect(string $uri, string $destination) - * @method static \Illuminate\Routing\Route view(string $uri, string $view, array $data = []) + * @method static \Illuminate\Routing\Route view(string $uri, string $view, array $data = [], int $status = 200, array $headers = []) * @method static void bind(string $key, string|callable $binder) * @method static void model(string $key, string $class, \Closure|null $callback = null) * @method static \Illuminate\Routing\Route current()
Allow Route::view() helper to set status and headers (#<I>)
illuminate_support
train
php
abfa420b9228cc711a79b39c9e969cdf91f65ca4
diff --git a/core/src/main/java/net/kuujo/vertigo/util/serialization/SerializerFactory.java b/core/src/main/java/net/kuujo/vertigo/util/serialization/SerializerFactory.java index <HASH>..<HASH> 100644 --- a/core/src/main/java/net/kuujo/vertigo/util/serialization/SerializerFactory.java +++ b/core/src/main/java/net/kuujo/vertigo/util/serialization/SerializerFactory.java @@ -119,7 +119,7 @@ public abstract class SerializerFactory { while (type != null && type != Object.class) { for (Class<?> iface : type.getInterfaces()) { if (iface == JsonSerializable.class) { - return iface; + return type; } Class<?> serializable = findSerializableType(iface); if (serializable != null) {
Use parent as serializable type.
kuujo_vertigo
train
java
6d4cddbb002156dd5f0014de11423c39b2359842
diff --git a/lib/support/cli.js b/lib/support/cli.js index <HASH>..<HASH> 100644 --- a/lib/support/cli.js +++ b/lib/support/cli.js @@ -226,8 +226,8 @@ module.exports.parseCommandLine = function parseCommandLine() { }) .option('cpu', { type: 'boolean', - describe: 'Easy way to enable both chrome.timeline and CPU long tasks.', - group: 'chrome' + describe: + 'Easy way to enable both chrome.timeline and CPU long tasks for Chrome and geckoProfile for Firefox' }) .option('chrome.CPUThrottlingRate', { type: 'number', @@ -854,8 +854,12 @@ module.exports.parseCommandLine = function parseCommandLine() { // Simplest way to just to get CPU metrics if (argv.cpu) { - set(argv, 'chrome.collectLongTasks', true); - set(argv, 'chrome.timeline', true); + if (argv.browser === 'chrome') { + set(argv, 'chrome.collectLongTasks', true); + set(argv, 'chrome.timeline', true); + } else if (argv.browser === 'firefox') { + set(argv, 'firefox.geckoProfiler', true); + } } if (argv.docker) {
Collect gecko profiler with --cpu (#<I>)
sitespeedio_browsertime
train
js
7ef5b4d55ecd91892360d927a57a7f2aad5c7082
diff --git a/src/lib/KevinGH/Box/Command/Build.php b/src/lib/KevinGH/Box/Command/Build.php index <HASH>..<HASH> 100644 --- a/src/lib/KevinGH/Box/Command/Build.php +++ b/src/lib/KevinGH/Box/Command/Build.php @@ -429,6 +429,7 @@ HELP $this->putln('?', "Output path: $path"); $this->box = Box::create($path); + $this->box->getPhar()->startBuffering(); // set replacement values, if any if (array() !== ($values = $this->config->getProcessedReplacements())) {
Speed-p build process Call the startBuffering method when building archive to speedup the phar building
box-project_box2
train
php
3283a286af1f4aee3d2b309a94ea9607038dffad
diff --git a/sirmordred/_version.py b/sirmordred/_version.py index <HASH>..<HASH> 100644 --- a/sirmordred/_version.py +++ b/sirmordred/_version.py @@ -1,2 +1,2 @@ # Versions compliant with PEP 440 https://www.python.org/dev/peps/pep-0440 -__version__ = "0.1.30" +__version__ = "0.1.31"
[release] Update version number to <I>
chaoss_grimoirelab-sirmordred
train
py
96ecbb017459823453dc79b3645f787c3cf7be2a
diff --git a/src/Message/PxPostCreateCardRequest.php b/src/Message/PxPostCreateCardRequest.php index <HASH>..<HASH> 100644 --- a/src/Message/PxPostCreateCardRequest.php +++ b/src/Message/PxPostCreateCardRequest.php @@ -13,6 +13,7 @@ class PxPostCreateCardRequest extends PxPostAuthorizeRequest $this->getCard()->validate(); $data = $this->getBaseData(); + $data->InputCurrency = $this->getCurrency(); $data->Amount = '1.00'; $data->EnableAddBillCard = 1; $data->CardNumber = $this->getCard()->getNumber();
Add required currency for creating a credit card token Omitting the currency from the credit card token request fails if the currency defaults to the incorrect currency. In my case was defaulting to NZD and should be AUD. Specifying it clears up the issue.
thephpleague_omnipay-paymentexpress
train
php
9e357da05f177e1437b851f0862220b02931f2af
diff --git a/plex/__init__.py b/plex/__init__.py index <HASH>..<HASH> 100644 --- a/plex/__init__.py +++ b/plex/__init__.py @@ -2,7 +2,7 @@ from plex.client import PlexClient from plex.lib.six import add_metaclass from plex.helpers import has_attribute -__version__ = '0.6.1' +__version__ = '0.6.2' class PlexMeta(type):
Bumped version to <I>
fuzeman_plex.py
train
py
d3e18bc5fd16cc871ba9504717a0273260d997c6
diff --git a/lib/jade/index.js b/lib/jade/index.js index <HASH>..<HASH> 100644 --- a/lib/jade/index.js +++ b/lib/jade/index.js @@ -53,6 +53,14 @@ exports.doctypes = require('./doctypes'); exports.filters = require('./filters'); /** + * Utilities. + * + * @type Object + */ + +exports.utils = require('./utils'); + +/** * Render the given attributes object. * * @param {Object} obj
Exporting utils for those who wish to write compilers
pugjs_then-pug
train
js
a82f69c890fbf655c83231d42106e9606f8d93c3
diff --git a/packages/neos-ui/src/Containers/RightSideBar/Inspector/TabPanel/index.js b/packages/neos-ui/src/Containers/RightSideBar/Inspector/TabPanel/index.js index <HASH>..<HASH> 100644 --- a/packages/neos-ui/src/Containers/RightSideBar/Inspector/TabPanel/index.js +++ b/packages/neos-ui/src/Containers/RightSideBar/Inspector/TabPanel/index.js @@ -34,7 +34,7 @@ export default class TabPanel extends PureComponent { <Tabs.Panel theme={{panel: style.inspectorTabPanel}}> <SelectedElement/> { - groups.filter(g => ($get('properties', g) && $get('properties', g).filter(this.isPropertyEnabled).count()) || $get('views', g)).map(group => ( + groups.filter(g => ($get('properties', g) && $get('properties', g).filter(this.isPropertyEnabled).count()) || ($get('views', g) && $get('views', g).count())).map(group => ( <PropertyGroup key={$get('id', group)} label={$get('label', group)}
BUGFIX: Hide empty groups in inspector
neos_neos-ui
train
js
278d66f7601d40a0eaff0f9b46e259be59a15727
diff --git a/src/index.js b/src/index.js index <HASH>..<HASH> 100644 --- a/src/index.js +++ b/src/index.js @@ -21,9 +21,9 @@ throw Error('f and g must be functions. f:' + f + ' g:' + g) } - return setProp('name', dot(f, g), function () { + return setProp('length', g.length, setProp('name', dot(f, g), function () { return f(g.apply(null, arguments)) - }) + })) } function dot (a, b) {
[PATCH][FIX] set length of resulting function
bagrounds_fun-compose
train
js
699489041c64db332a6e0e238ed22f60f0d20bd9
diff --git a/annoying/decorators.py b/annoying/decorators.py index <HASH>..<HASH> 100644 --- a/annoying/decorators.py +++ b/annoying/decorators.py @@ -188,7 +188,7 @@ def ajax_request(func): else: format_type = 'application/json' response = func(request, *args, **kwargs) - if isinstance(response, dict) or isinstance(response, list): + if not isinstance(response, HttpResponse): data = FORMAT_TYPES[format_type](response) response = HttpResponse(data, content_type=format_type) response['content-length'] = len(data)
Why limit it to serialise lists/dicts? Try everything but HttpResponse subclasses
skorokithakis_django-annoying
train
py
108b33919373e2f7a8f1fd41511eda6c1a7a3d9f
diff --git a/django_extensions/management/commands/reset_db.py b/django_extensions/management/commands/reset_db.py index <HASH>..<HASH> 100644 --- a/django_extensions/management/commands/reset_db.py +++ b/django_extensions/management/commands/reset_db.py @@ -92,7 +92,7 @@ Type 'yes' to continue, or 'no' to cancel: """ % (settings.DATABASE_NAME,)) if password is None: password = settings.DATABASE_PASSWORD - if engine == 'sqlite3': + if engine in ('sqlite3', 'spatialite'): import os try: logging.info("Unlinking sqlite3 database")
reset_db made to work with spatialite (backend from geodjango)
django-extensions_django-extensions
train
py
9fc032412ed7f9627af053db566fb40b76d1ce4f
diff --git a/src/atoms/Icon/constants.js b/src/atoms/Icon/constants.js index <HASH>..<HASH> 100644 --- a/src/atoms/Icon/constants.js +++ b/src/atoms/Icon/constants.js @@ -90,6 +90,7 @@ module.exports = { 'fastTrack', 'family', 'fastClock', + 'finalExpense', 'fineArt', 'fireExtinguisher', 'firearm', @@ -138,9 +139,11 @@ module.exports = { 'invite', 'jewelry', 'largeHome', + 'legacy', 'lifeAgentsOff', 'lifeAgentsOn', 'life', + 'lifestyle', 'lifeColor3X', 'lightbulb', 'linkedin', @@ -166,6 +169,7 @@ module.exports = { 'norton', 'nortonSecured', 'nortonW', + 'notesSimple', 'openBook', 'overflow', 'pawprint',
Add new icons for Coverage Needs (#<I>)
policygenius_athenaeum
train
js
ac9a1abc73894847cc791f00839d02dddb4ee339
diff --git a/src/browser/extension/background/index.js b/src/browser/extension/background/index.js index <HASH>..<HASH> 100644 --- a/src/browser/extension/background/index.js +++ b/src/browser/extension/background/index.js @@ -10,7 +10,5 @@ window.store = store; window.store.liftedStore.instances = {}; chrome.commands.onCommand.addListener(shortcut => { - if (store.liftedStore.isSet()) { - openDevToolsWindow(shortcut); - } + openDevToolsWindow(shortcut); });
Keyboard shortcuts are now enabled even when store isn't initialized
zalmoxisus_redux-devtools-extension
train
js
5f889a2106f6584583458e01dbd0f3b9b696fab2
diff --git a/pandas/tests/test_base.py b/pandas/tests/test_base.py index <HASH>..<HASH> 100644 --- a/pandas/tests/test_base.py +++ b/pandas/tests/test_base.py @@ -949,6 +949,21 @@ class TestIndexOps(Ops): s.drop_duplicates(inplace=True) tm.assert_series_equal(s, original) + def test_drop_duplicates_series_vs_dataframe(self): + # GH 14192 + df = pd.DataFrame({'a': [1, 1, 1, 'one', 'one'], + 'b': [2, 2, np.nan, np.nan, np.nan], + 'c': [3, 3, np.nan, np.nan, 'three'], + 'd': [1, 2, 3, 4, 4], + 'e': [datetime(2015, 1, 1), datetime(2015, 1, 1), + datetime(2015, 2, 1), pd.NaT, pd.NaT] + }) + for column in df.columns: + for keep in ['first', 'last', False]: + dropped_frame = df[[column]].drop_duplicates(keep=keep) + dropped_series = df[column].drop_duplicates(keep=keep) + tm.assert_frame_equal(dropped_frame, dropped_series.to_frame()) + def test_fillna(self): # # GH 11343 # though Index.fillna and Series.fillna has separate impl,
TST: Same return values in drop_duplicates for Series and DataFrames(#<I>) (#<I>)
pandas-dev_pandas
train
py
889b0343ba5c9e7de2fa898370afa66bd88dac11
diff --git a/src/Intervention/Image/Image.php b/src/Intervention/Image/Image.php index <HASH>..<HASH> 100644 --- a/src/Intervention/Image/Image.php +++ b/src/Intervention/Image/Image.php @@ -1723,7 +1723,7 @@ class Image $saved = @file_put_contents($path, $this->encode(pathinfo($path, PATHINFO_EXTENSION), $quality)); if ($saved === false) { - throw new Exception\ImageNotWritableException; + throw new Exception\ImageNotWritableException("Can't write image data to path [{$path}]"); } return $this;
added text to ImageNotWritableException
Intervention_image
train
php
6f3438100a318997bfb4c5d0c1b1024075701a7e
diff --git a/Joyst_Model.php b/Joyst_Model.php index <HASH>..<HASH> 100644 --- a/Joyst_Model.php +++ b/Joyst_Model.php @@ -291,8 +291,8 @@ class Joyst_Model extends CI_Model { if ( // Is read-only during a 'set' $operation == 'set' && - isset($this->schema[$key]['allowget']) && - !$this->schema[$key]['allowget'] + isset($this->schema[$key]['allowset']) && + !$this->schema[$key]['allowset'] ) continue;
BUGFIX: Pretty major issue where allowget/allowset would get mixed up during a set operation
hash-bang_Joyst
train
php
6d6e4f51cd604a5b9ae4e67177a5af9e06195578
diff --git a/modules/social_features/social_core/src/Plugin/Block/SocialPageTitleBlock.php b/modules/social_features/social_core/src/Plugin/Block/SocialPageTitleBlock.php index <HASH>..<HASH> 100644 --- a/modules/social_features/social_core/src/Plugin/Block/SocialPageTitleBlock.php +++ b/modules/social_features/social_core/src/Plugin/Block/SocialPageTitleBlock.php @@ -54,7 +54,7 @@ class SocialPageTitleBlock extends PageTitleBlock { if ($group && $request->attributes->get('_route') == 'entity.group_content.create_form') { return [ '#type' => 'page_title', - '#title' => t('@title blaat @group', [ + '#title' => t('@title in @group', [ '@title' => $title, '@group' => $group->label(), ], ['context' => 'social_page_title']),
DS-<I> by bramtenhove: Fix testing typo
goalgorilla_open_social
train
php
55c0b47ef6c6124456d72d92f09d1206e658336e
diff --git a/django_extensions/management/commands/sqldiff.py b/django_extensions/management/commands/sqldiff.py index <HASH>..<HASH> 100644 --- a/django_extensions/management/commands/sqldiff.py +++ b/django_extensions/management/commands/sqldiff.py @@ -49,15 +49,16 @@ def flatten(l, ltypes=(list, tuple)): def all_local_fields(meta): all_fields = [] - if not meta.managed or meta.proxy: - for parent in meta.parents: - all_fields.extend(all_local_fields(parent._meta)) - else: - for f in meta.local_fields: - col_type = f.db_type(connection=connection) - if col_type is None: - continue - all_fields.append(f) + if meta.managed: + if meta.proxy: + for parent in meta.parents: + all_fields.extend(all_local_fields(parent._meta)) + else: + for f in meta.local_fields: + col_type = f.db_type(connection=connection) + if col_type is None: + continue + all_fields.append(f) return all_fields
Not managed models should not return fields Fixes previous commit where non-managed models were returning fields.
django-extensions_django-extensions
train
py
7caa0f53a757eb266bf7e479da8e81b1881cee24
diff --git a/src/Grid/Filter/AbstractFilter.php b/src/Grid/Filter/AbstractFilter.php index <HASH>..<HASH> 100644 --- a/src/Grid/Filter/AbstractFilter.php +++ b/src/Grid/Filter/AbstractFilter.php @@ -248,7 +248,7 @@ abstract class AbstractFilter } /** - * @param array $options + * @param array|\Illuminate\Support\Collection $options * * @return MultipleSelect */ @@ -258,7 +258,7 @@ abstract class AbstractFilter } /** - * @param array $options + * @param array|\Illuminate\Support\Collection $options * * @return Radio */ @@ -268,7 +268,7 @@ abstract class AbstractFilter } /** - * @param array $options + * @param array|\Illuminate\Support\Collection $options * * @return Checkbox */ @@ -280,7 +280,7 @@ abstract class AbstractFilter /** * Datetime filter. * - * @param array $options + * @param array|\Illuminate\Support\Collection $options * * @return DateTime */
multipleSeletct/... methods support collection
z-song_laravel-admin
train
php
014828ae0a9ad7065cd278d83563b17bf3cbffa7
diff --git a/src/main/java/com/bladecoder/ink/runtime/Story.java b/src/main/java/com/bladecoder/ink/runtime/Story.java index <HASH>..<HASH> 100644 --- a/src/main/java/com/bladecoder/ink/runtime/Story.java +++ b/src/main/java/com/bladecoder/ink/runtime/Story.java @@ -1202,6 +1202,9 @@ public class Story extends RTObject implements VariablesState.VariableChanged { // In normal flow - allow safe exit without warning else { state.setDidSafeExit(true); + + // Stop flow in current thread + state.setCurrentContentObject(null); } break;
Ref. C#: -> DONE should stop flow in the current thread.
bladecoder_blade-ink
train
java
ac04729cff28af9c3269d23badfb953a2271150e
diff --git a/routing/router_test.go b/routing/router_test.go index <HASH>..<HASH> 100644 --- a/routing/router_test.go +++ b/routing/router_test.go @@ -421,9 +421,10 @@ func TestChannelUpdateValidation(t *testing.T) { }, } - route := &Route{ - Hops: hops, - } + route := NewRouteFromHops( + lnwire.MilliSatoshi(10000), 100, + NewVertex(ctx.aliases["a"]), hops, + ) // Set up a channel update message with an invalid signature to be // returned to the sender.
routing: use complete route in test Previously not all route fields were properly populated. Example: prev and next hop maps.
lightningnetwork_lnd
train
go
cc4a51d0af0332adc703d5ca71e207ed17e67915
diff --git a/bcbio/variation/vardict.py b/bcbio/variation/vardict.py index <HASH>..<HASH> 100644 --- a/bcbio/variation/vardict.py +++ b/bcbio/variation/vardict.py @@ -47,6 +47,9 @@ def _vardict_options_from_config(items, config, out_file, target=None): ((vardict_cl == "vardict-java" and LooseVersion(version) >= LooseVersion("1.5.5")) or (vardict_cl == "vardict" and LooseVersion(version) >= LooseVersion("2018.07.25")))): opts += ["--nosv"] + if (vardict_cl and version and + (vardict_cl == "vardict-java" and LooseVersion(version) >= LooseVersion("1.5.6"))): + opts += ["--deldupvar"] # remove low mapping quality reads opts += ["-Q", "10"] # Remove QCfail reads, avoiding high depth repetitive regions
VarDictJava: exclude SVs starting before start region This avoids duplicate SVs present at the end of one region and before the start of the next
bcbio_bcbio-nextgen
train
py
3bac1816bac4be72ef2be7ab305eaea081604c2f
diff --git a/pandas/tests/test_frame.py b/pandas/tests/test_frame.py index <HASH>..<HASH> 100644 --- a/pandas/tests/test_frame.py +++ b/pandas/tests/test_frame.py @@ -7678,7 +7678,7 @@ class TestDataFrame(unittest.TestCase, CheckIndexing, def test_mask_edge_case_1xN_frame(self): # GH4071 df = DataFrame([[1, 2]]) - res = df.mask(np.array([[True, False]])) + res = df.mask(DataFrame([[True, False]])) expec = DataFrame([[nan, 2]]) assert_frame_equal(res, expec)
TST: use DataFrame in the test
pandas-dev_pandas
train
py
b2f89d45a62e99e8312de21b7b6431521489134d
diff --git a/openquake/risklib/asset.py b/openquake/risklib/asset.py index <HASH>..<HASH> 100644 --- a/openquake/risklib/asset.py +++ b/openquake/risklib/asset.py @@ -253,7 +253,7 @@ aids_dt = numpy.dtype([('aids', hdf5.vuint32)]) class AssetCollection(object): - # the information about the assets is store in a numpy array and in a + # the information about the assets is stored in a numpy array and in a # variable-length dataset aids_by_tags; we could store everything in a # single array and it would be easier, but then we would need to transfer # unneeded strings; also we would have to use fixed-length string, since
Updated a comment [skip CI]
gem_oq-engine
train
py
811b8c28433a6dc0215914a769517e9775c6fe05
diff --git a/test/traverse_spec.js b/test/traverse_spec.js index <HASH>..<HASH> 100644 --- a/test/traverse_spec.js +++ b/test/traverse_spec.js @@ -4,8 +4,19 @@ const expect = require('chai').expect; describe('findAll', () => { it('retrieves a collection of kernel specs', () => { - return findAll().then(dirs => { - expect(dirs).to.have.any.keys('python3', 'python2'); + return findAll().then(kernelspecs => { + expect(kernelspecs).to.have.any.keys('python3', 'python2'); + + const defaultKernel = kernelspecs.python2 || kernelspecs.python3; + + expect(defaultKernel).to.have.property('spec'); + expect(defaultKernel).to.have.property('resources_dir'); + + const spec = defaultKernel.spec; + + expect(spec).to.have.property('display_name'); + expect(spec).to.have.property('argv'); + }); }); });
Problem: findAll's test wasn't very robust Solution: Check more properties
nteract_kernelspecs
train
js
a97e7377b3babbb11229c1ad34907d3293d3befc
diff --git a/test/test_motor_client.py b/test/test_motor_client.py index <HASH>..<HASH> 100644 --- a/test/test_motor_client.py +++ b/test/test_motor_client.py @@ -170,6 +170,7 @@ class MotorClientTest(MotorTest): collection = cx.motor_test.test_collection insert_collection = cx.motor_test.insert_collection + yield insert_collection.remove() ndocs = [0] insert_future = Future()
More reliable test_high_concurrency.
mongodb_motor
train
py
a852f6aed399094031a03476d555a06b892213ea
diff --git a/robobrowser/browser.py b/robobrowser/browser.py index <HASH>..<HASH> 100644 --- a/robobrowser/browser.py +++ b/robobrowser/browser.py @@ -337,7 +337,7 @@ class RoboBrowser(object): # Send request url = self._build_url(form.action) or self.url form_data = form.serialize() - response = self.session.request(method, url, **form_data.to_requests()) + response = self.session.request(method, url, **form_data.to_requests(method)) # Update history self._update_state(response)
fix issue with building bad POST requests
jmcarp_robobrowser
train
py
2ac1c4c9ed5f7561330fb5881e7f039f38ce6ce5
diff --git a/tools/functional-tester/etcd-tester/lease_stresser.go b/tools/functional-tester/etcd-tester/lease_stresser.go index <HASH>..<HASH> 100644 --- a/tools/functional-tester/etcd-tester/lease_stresser.go +++ b/tools/functional-tester/etcd-tester/lease_stresser.go @@ -114,7 +114,7 @@ func (ls *leaseStresser) setupOnce() error { panic("expect keysPerLease to be set") } - conn, err := grpc.Dial(ls.endpoint, grpc.WithInsecure()) + conn, err := grpc.Dial(ls.endpoint, grpc.WithInsecure(), grpc.WithBackoffMaxDelay(1*time.Second)) if err != nil { return fmt.Errorf("%v (%s)", err, ls.endpoint) }
etcd-tester:limit max retry backoff delay grpc uses expoential retry if a connection is lost. grpc will sleep base on exponential delay. if delay is too large, it slows down tester.
etcd-io_etcd
train
go
82a6e8d662ba91dfa5a12aea7e888003f809a4cf
diff --git a/l/cli.py b/l/cli.py index <HASH>..<HASH> 100644 --- a/l/cli.py +++ b/l/cli.py @@ -120,7 +120,6 @@ I_hate_everything = [ click.option( "--no-group-directories-first", "sort_by", flag_value=lambda thing : thing, - default=True, help="Show content in alphabetical order regardless of type", ), click.argument(
Remove the default to allow run to decide what to use.
Julian_L
train
py
513bf10a38e10f5dc69f1a93fe28478df4f0b32d
diff --git a/superset/views/core.py b/superset/views/core.py index <HASH>..<HASH> 100755 --- a/superset/views/core.py +++ b/superset/views/core.py @@ -33,7 +33,7 @@ from flask_appbuilder.security.decorators import has_access, has_access_api from flask_appbuilder.security.sqla import models as ab_models from flask_babel import gettext as __, lazy_gettext as _ from jinja2.exceptions import TemplateError -from sqlalchemy import and_, or_, select +from sqlalchemy import and_, or_ from sqlalchemy.engine.url import make_url from sqlalchemy.exc import ( ArgumentError, @@ -1129,8 +1129,8 @@ class Superset(BaseSupersetView): # pylint: disable=too-many-public-methods username = g.user.username if g.user is not None else None engine = database.get_sqla_engine(user_name=username) - with closing(engine.connect()) as conn: - conn.scalar(select([1])) + with closing(engine.raw_connection()) as conn: + engine.dialect.do_ping(conn) return json_success('"OK"') except CertificateException as ex: logger.info("Certificate exception")
chore: Leverage SQLALchemy ping rather than explicit SELECT 1 for testconn (#<I>)
apache_incubator-superset
train
py
60ea31f1ffee7e483b6cbd6e0abbc2452dd6925b
diff --git a/HashCacheClient.js b/HashCacheClient.js index <HASH>..<HASH> 100644 --- a/HashCacheClient.js +++ b/HashCacheClient.js @@ -54,6 +54,7 @@ class HashCacheClient { request .delete(this.host + '/channel/' + hash) .set('Authorization', this.credentials) + .send({ password: password }) .end((err, res) => { this._resolveRequest(err, res, resolve, reject) }); }) }
Fix missing password for channel deletion in HashCacheClient
orbitdb_orbit-db
train
js
86b693dc94aa3cb5c323d27efc96e102e6865b44
diff --git a/src/Model.php b/src/Model.php index <HASH>..<HASH> 100644 --- a/src/Model.php +++ b/src/Model.php @@ -467,7 +467,7 @@ abstract class Model extends PhalconModel $params['order'] = $orderBy; } if ($columns) { - $params['columns'] = is_array($columns) ? explode(',', $columns) : $columns; + $params['columns'] = is_array($columns) ? implode(',', $columns) : $columns; } if (is_int($limit)) { $params['limit'] = $limit;
fix(Model): implode an array.
phwoolcon_phwoolcon
train
php
3b55a2dd170166278576c6ed03c4e7190a662fec
diff --git a/src/MageTest/PhpSpec/MagentoExtension/Autoloader/MageLoader.php b/src/MageTest/PhpSpec/MagentoExtension/Autoloader/MageLoader.php index <HASH>..<HASH> 100644 --- a/src/MageTest/PhpSpec/MagentoExtension/Autoloader/MageLoader.php +++ b/src/MageTest/PhpSpec/MagentoExtension/Autoloader/MageLoader.php @@ -189,6 +189,9 @@ class MageLoader array_splice($controller, 2, 0 , 'controllers'); $pathToController = implode(DS, $controller); $classFile = $local . $pathToController . '.php'; + if (!file_exists($classFile)) { + return false; + } return include_once $classFile; } }
Add file exists test to prevent warning Add a test for the file existing ahead of the include_one. Without the tests the warning thrown would prevent the user from being prompted to create the file and the spec functionality is blocked.
MageTest_MageSpec
train
php
f540c4e0897842f477551c5bf48fc9a60884b4ad
diff --git a/telethon/events/inlinequery.py b/telethon/events/inlinequery.py index <HASH>..<HASH> 100644 --- a/telethon/events/inlinequery.py +++ b/telethon/events/inlinequery.py @@ -178,11 +178,17 @@ class InlineQuery(EventBuilder): return if results: - results = [self._as_awaitable(x, self._client.loop) + futures = [self._as_future(x, self._client.loop) for x in results] - done, _ = await asyncio.wait(results, loop=self._client.loop) - results = [x.result() for x in done] + await asyncio.wait(futures, loop=self._client.loop) + + # All futures will be in the `done` *set* that `wait` returns. + # + # Precisely because it's a `set` and not a `list`, it + # will not preserve the order, but since all futures + # completed we can use our original, ordered `list`. + results = [x.result() for x in futures] else: results = [] @@ -202,9 +208,9 @@ class InlineQuery(EventBuilder): ) @staticmethod - def _as_awaitable(obj, loop): + def _as_future(obj, loop): if inspect.isawaitable(obj): - return obj + return asyncio.ensure_future(obj, loop=loop) f = loop.create_future() f.set_result(obj)
Fix order of inline results not being preserved
LonamiWebs_Telethon
train
py
31a322284e22d90a7ceafa0a99cfbd87a301dd6c
diff --git a/test/unittests/test_record.py b/test/unittests/test_record.py index <HASH>..<HASH> 100644 --- a/test/unittests/test_record.py +++ b/test/unittests/test_record.py @@ -21,6 +21,7 @@ EXPECTED_RECORD_ATTRIBUTES = { 'values' } + @given(attributes) def test_empty_constructor_has_no_attributes(attr): assume(attr not in EXPECTED_RECORD_ATTRIBUTES)
Fixed pep8 blip.
sixty-north_cosmic-ray
train
py
39c1eb9e75e3c7aed80924b13be9456ee0f49f7c
diff --git a/bosh_aws_bootstrap/lib/bosh/cli/commands/aws.rb b/bosh_aws_bootstrap/lib/bosh/cli/commands/aws.rb index <HASH>..<HASH> 100644 --- a/bosh_aws_bootstrap/lib/bosh/cli/commands/aws.rb +++ b/bosh_aws_bootstrap/lib/bosh/cli/commands/aws.rb @@ -90,8 +90,13 @@ module Bosh::Cli::Command usage "aws create" desc "create everything in config file" + option "--trace", "print all HTTP traffic" def create(config_file = nil) config_file ||= default_config_file + if !!options[:trace] + require 'logger' + ::AWS.config(:logger => Logger.new($stdout), :http_wire_trace => true) + end create_vpc(config_file) create_rds_dbs(config_file) create_s3(config_file)
AWS create --trace option to print all HTTP traffic with AWS
cloudfoundry_bosh
train
rb
62d7e9575d37bfd3ca953f8da9ff01750c4d8f07
diff --git a/src/Table.php b/src/Table.php index <HASH>..<HASH> 100644 --- a/src/Table.php +++ b/src/Table.php @@ -232,7 +232,7 @@ class Table implements TableInterface */ public function get(string $key, $field = null) { - return $this->table->get($key, $field); + return $field ? $this->table->get($key, $field) : $this->table->get($key); } /**
Update Table.php Fix bug when pass null value as $filed will return false
swoft-cloud_swoft-memory
train
php
3d557678383f4a8cedbebda1f876fc0892ff32fc
diff --git a/lnwallet/reservation.go b/lnwallet/reservation.go index <HASH>..<HASH> 100644 --- a/lnwallet/reservation.go +++ b/lnwallet/reservation.go @@ -276,16 +276,6 @@ func (r *ChannelReservation) SetNumConfsRequired(numConfs uint16) { r.partialState.NumConfsRequired = numConfs } -// RegisterMinHTLC registers our desired amount for the smallest acceptable -// HTLC we'll accept within this channel. Any HTLC's that are extended which -// are below this value will SHOULD be rejected. -func (r *ChannelReservation) RegisterMinHTLC(minHTLC lnwire.MilliSatoshi) { - r.Lock() - defer r.Unlock() - - r.ourContribution.MinHTLC = minHTLC -} - // CommitConstraints takes the constraints that the remote party specifies for // the type of commitments that we can generate for them. These constraints // include several parameters that serve as flow control restricting the amount
lnwallet/reservation: remove RegisterMinHTLC We remove this method, as our minHtlc value is set using the CommitConstraints method.
lightningnetwork_lnd
train
go
6312cb87c8fbc64e83404d0259688d97d62b7d16
diff --git a/lib/access-granted/controller_methods.rb b/lib/access-granted/controller_methods.rb index <HASH>..<HASH> 100644 --- a/lib/access-granted/controller_methods.rb +++ b/lib/access-granted/controller_methods.rb @@ -5,7 +5,7 @@ module AccessGranted end def self.included(base) - base.helper_method :can?, :cannot?, :current_ability + base.helper_method :can?, :cannot?, :current_policy end def can?(*args) diff --git a/spec/controller_methods_spec.rb b/spec/controller_methods_spec.rb index <HASH>..<HASH> 100644 --- a/spec/controller_methods_spec.rb +++ b/spec/controller_methods_spec.rb @@ -5,7 +5,7 @@ describe AccessGranted::ControllerMethods do @current_user = double("User") @controller_class = Class.new @controller = @controller_class.new - @controller_class.stub(:helper_method).with(:can?, :cannot?, :current_ability) + @controller_class.stub(:helper_method).with(:can?, :cannot?, :current_policy) @controller_class.send(:include, AccessGranted::ControllerMethods) @controller.stub(:current_user).and_return(@current_user) end
Rename incorrect current_ability to current_policy.
chaps-io_access-granted
train
rb,rb
f6abf48a7b422b84da8944762912833e1fce1b80
diff --git a/wp-cli.php b/wp-cli.php index <HASH>..<HASH> 100755 --- a/wp-cli.php +++ b/wp-cli.php @@ -50,6 +50,14 @@ foreach (glob(WP_CLI_ROOT.'/commands/community/*.php') as $filename) { include $filename; } +// Check if there are commands installed +if(empty(WP_CLI::$commands)) { + WP_CLI::error('No commands installed'); + WP_CLI::line(); + WP_CLI::line('Visit the wp-cli page on github on more information on how to install commands.'); + exit(); +} + // Get the cli arguments $arguments = $GLOBALS['argv']; @@ -59,18 +67,11 @@ array_shift($arguments); // Get the command $command = array_shift($arguments); -// Check if there are commands installed -if(empty(WP_CLI::$commands)) { - WP_CLI::error('No commands installed'); - WP_CLI::line(); - WP_CLI::line('Visit the wp-cli page on github on more information on how to install commands.'); - exit(); -} // Try to load the class, otherwise it's an Unknown command -elseif(isset(WP_CLI::$commands[$command])) { +if(isset(WP_CLI::$commands[$command])) { new WP_CLI::$commands[$command]($arguments); } // Show the general help for wp-cli else { WP_CLI::generalHelp(); -} \ No newline at end of file +}
check if there are any commands before doing anything with the args
wp-cli_export-command
train
php
6d2f957d5417299e13f2414e64a91038296ce885
diff --git a/src/ModelSearch.php b/src/ModelSearch.php index <HASH>..<HASH> 100755 --- a/src/ModelSearch.php +++ b/src/ModelSearch.php @@ -520,6 +520,8 @@ class ModelSearch // Review each request. foreach ($this->request as $name => $filters) { + $name = str_replace('-', '.', $name); + // This name is not present in available attributes. if (! Arr::has($this->attributes, $name)) { continue;
Convert parameter names into dot-notation (. in url converts to underscore which is harder to detect)
hnhdigital-os_laravel-model-search
train
php
caf63ab2e99c215057b492416c70fb32585571ad
diff --git a/src/index.js b/src/index.js index <HASH>..<HASH> 100644 --- a/src/index.js +++ b/src/index.js @@ -9,7 +9,7 @@ function addModifier(baseClass, modifier) { function getClassArray(block, element, modifiers = []) { const baseClass = getBaseClass(block, element); const modifierFn = addModifier.bind(null, baseClass); - return [baseClass].concat(modifiers.map(modifierFn)); + return [baseClass].concat(modifiers.map(modifierFn)).filter(c => c); } function getClassesAsString(block, element, modifiers) {
fix(modifiers): disallow empty modifiers Ignore values such as `null` and empty strings when generating modifier classes.
jlengstorf_bemmit
train
js
e32666c4521dfb84da5af1e23f7bcca755594bf7
diff --git a/grimoire/elk/gerrit.py b/grimoire/elk/gerrit.py index <HASH>..<HASH> 100644 --- a/grimoire/elk/gerrit.py +++ b/grimoire/elk/gerrit.py @@ -221,7 +221,7 @@ class GerritEnrich(Enrich): eitem = {} # Item enriched # Fields that are the same in item and eitem - copy_fields = ["status", "branch", "url","__metadata__updated_on"] + copy_fields = ["status", "branch", "url","__metadata__updated_on","number"] for f in copy_fields: eitem[f] = review[f] # Fields which names are translated
[gerrit enrich] Include the number of gerrit review.
chaoss_grimoirelab-elk
train
py
b9922b521508ac608d996ae6c1e4b26ffc96b7a6
diff --git a/src/main/java/com/couchbase/cblite/replicator/CBLReplicator.java b/src/main/java/com/couchbase/cblite/replicator/CBLReplicator.java index <HASH>..<HASH> 100644 --- a/src/main/java/com/couchbase/cblite/replicator/CBLReplicator.java +++ b/src/main/java/com/couchbase/cblite/replicator/CBLReplicator.java @@ -395,7 +395,17 @@ public abstract class CBLReplicator extends Observable { } String buildRelativeURLString(String relativePath) { - return remote.toExternalForm() + relativePath; + + // the following code is a band-aid for a system problem in the codebase + // where it is appending "relative paths" that start with a slash, eg: + // http://dotcom/db/ + /relpart == http://dotcom/db/relpart + // which is not compatible with the way the java url concatonation works. + + String remoteUrlString = remote.toExternalForm(); + if (remoteUrlString.endsWith("/") && relativePath.startsWith("/")) { + remoteUrlString = remoteUrlString.substring(0, remoteUrlString.length() - 1); + } + return remoteUrlString + relativePath; } public void sendAsyncRequest(String method, URL url, Object body, CBLRemoteRequestCompletionBlock onCompletion) {
Re-do another fix for issue #<I> since the first one caused major issues.
couchbase_couchbase-lite-java-core
train
java
2b2a9655269217bf7746262055f275f6a1c9085d
diff --git a/tinman/handlers/rabbitmq.py b/tinman/handlers/rabbitmq.py index <HASH>..<HASH> 100644 --- a/tinman/handlers/rabbitmq.py +++ b/tinman/handlers/rabbitmq.py @@ -11,6 +11,7 @@ Example configuration: password: tornado """ +from tornado import gen import logging import pika from pika.adapters import tornado_connection @@ -235,6 +236,7 @@ class RabbitMQRequestHandler(web.RequestHandler): self._set_rabbitmq_channel(channel) self._publish_deferred_messages() + @gen.coroutine def prepare(self): """Prepare the handler, ensuring RabbitMQ is connected or start a new connection attempt.
Make sure prepare is async
gmr_tinman
train
py
37b4851590be128a48e6dd7c12e3c901515261e7
diff --git a/thjs.js b/thjs.js index <HASH>..<HASH> 100644 --- a/thjs.js +++ b/thjs.js @@ -520,8 +520,13 @@ function receive(msg, path) var from = self.whois(local.der2hn(open.rsa)); if (!from) return warn("invalid hashname", local.der2hn(open.rsa), open.rsa); - // make sure this open is newer (if any others) + // make sure this open is legit if (typeof open.js.at != "number") return warn("invalid at", open.js.at); + if(from.openAt) + { + if(open.js.at <= from.openAt) return; // ignore dups + from.sentOpen = 0; // make sure we send a new open + } // open is legit! debug("inOpen verified", from.hashname); @@ -674,8 +679,8 @@ function whois(hashname) // always default to minimum 0 here if(typeof path.priority != "number") path.priority = 0; - // when multiple networks detected, trigger a sync - if(hn.paths.length > 1) hn.sync(); + // when multiple networks detected, trigger a sync (delayed so caller can continue/respond first) + if(hn.paths.length > 1) setTimeout(hn.sync,1); // update public ipv4 address if(path.type == "ipv4" && !isLocalIP(path.ip)) hn.address = [hn.hashname,path.ip,path.port].join(",");
fix a timing issue after open, and improve open logic
telehash_e3x-js
train
js
0f2698ed6c0bd55fe2a70a3d92c8fc3334cd99cc
diff --git a/wandb/integration/tensorboard/log.py b/wandb/integration/tensorboard/log.py index <HASH>..<HASH> 100644 --- a/wandb/integration/tensorboard/log.py +++ b/wandb/integration/tensorboard/log.py @@ -83,7 +83,14 @@ def tf_summary_to_dict(tf_summary_str_or_pb, namespace=""): # noqa: C901 return None def encode_images(img_strs, value): - from PIL import Image + try: + from PIL import Image + except ImportError: + wandb.termwarn( + 'Install pillow if you are logging images with Tensorboard. To install, run "pip install pillow".', + repeat=False, + ) + return if len(img_strs) == 0: return
[WB-<I>] Check if pillow is installed before importing (#<I>) * Check if pillow is installed before importing * Skip the image encoding if pillow isn't installed instead of exiting out of the whole run.
wandb_client
train
py
5c51cebdf9f10c2ebd1a1a39e535f377ecf84b84
diff --git a/src/nwmatcher.js b/src/nwmatcher.js index <HASH>..<HASH> 100644 --- a/src/nwmatcher.js +++ b/src/nwmatcher.js @@ -180,18 +180,15 @@ NW.Dom = (function(global) { // tests are based on the jQuery selector test suite BUGGY_GEBCN = NATIVE_GEBCN ? (function() { - var isBuggy, - div = context.createElement('div'), - method = 'getElementsByClassName', - test = /\u53f0\u5317/; + var isBuggy, div = context.createElement('div'), test = '\u53f0\u5317'; // Opera tests div.innerHTML = '<span class="' + test + 'abc ' + test + '"></span><span class="x"></span>'; - isBuggy = !div[method](test)[0]; + isBuggy = !div.getElementsByClassName(test)[0]; // Safari test div.lastChild.className = test; - if (!isBuggy) isBuggy = div[method](test).length !== 2; + if (!isBuggy) isBuggy = div.getElementsByClassName(test).length !== 2; div.innerHTML = ''; div = null;
fixed GEBCN feature test to use a string instead of a regular expression, formatting changes
dperini_nwmatcher
train
js
df693c7e058ef1c7af5dbf97fd8146447ad0428a
diff --git a/lib/puavo/client/hash_mixin/device_base.rb b/lib/puavo/client/hash_mixin/device_base.rb index <HASH>..<HASH> 100644 --- a/lib/puavo/client/hash_mixin/device_base.rb +++ b/lib/puavo/client/hash_mixin/device_base.rb @@ -4,6 +4,11 @@ module Puavo module DeviceBase include Base + def booleanize(value) + v = Array(value).first + (v && v != 'FALSE') ? true : false + end + def prettify_attributes # Note: value of attribute may be raw ldap value eg. { puavoHostname => ["thinclient-01"] } [ @@ -87,7 +92,7 @@ module Puavo :value_block => lambda{ |value| Array(value) } }, { :original_attribute_name => "puavoDeviceXrandrDisable", :new_attribute_name => "xrandr_disable", - :value_block => lambda{ |value| Array(value).first } }, + :value_block => lambda{ |value| booleanize(value) } }, { :original_attribute_name => "puavoDeviceType", :new_attribute_name => "device_type", :value_block => lambda{ |value| Array(value).first } },
Fix boolean handling for xrandr_disable.
opinsys_puavo-client
train
rb
5c9fea3aa869bf83b2fdf1942255c95fdd30f7e4
diff --git a/test/unexpectedAssetGraph.js b/test/unexpectedAssetGraph.js index <HASH>..<HASH> 100644 --- a/test/unexpectedAssetGraph.js +++ b/test/unexpectedAssetGraph.js @@ -73,7 +73,13 @@ module.exports = { } else if (typeof number === 'undefined') { number = 1; } - expect(subject.findAssets(value), 'to have length', number); + const foundAssets = subject.findAssets(value); + expect(foundAssets, 'to have length', number); + if (number === 1) { + return foundAssets[0]; + } else { + return foundAssets; + } }); expect.addAssertion('<AssetGraph> to contain (url|urls) <string|array?>', function (expect, subject, urls) { @@ -103,7 +109,13 @@ module.exports = { number = 1; } this.errorMode = 'nested'; - expect(subject.findRelations(queryObj), 'to have length', number); + const foundRelations = subject.findRelations(queryObj); + expect(foundRelations, 'to have length', number); + if (number === 1) { + return foundRelations[0]; + } else { + return foundRelations; + } }); expect.addAssertion('<AssetGraph> to contain [no] (relation|relations) [including unresolved] <string|object|number> <number?>', function (expect, subject, queryObj, number) {
Test, to contain {asset,relation}(s): Provide the found asset(s) as the fulfillment value of the assertion
assetgraph_assetgraph
train
js
6e25c4cfa96892a9b542499c5242733c03e4846f
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index <HASH>..<HASH> 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -61,9 +61,9 @@ module SpecHelpers "#{RUN_ID}-topic-#{SecureRandom.uuid}" end - def create_random_topic(*args) + def create_random_topic(**args) topic = generate_topic_name - create_topic(topic, *args) + create_topic(topic, **args) topic end diff --git a/spec/transaction_manager_spec.rb b/spec/transaction_manager_spec.rb index <HASH>..<HASH> 100644 --- a/spec/transaction_manager_spec.rb +++ b/spec/transaction_manager_spec.rb @@ -591,10 +591,10 @@ describe ::Kafka::TransactionManager do ) ) allow(group_coordinator).to receive(:txn_offset_commit).and_return( - txn_offset_commit_response( + txn_offset_commit_response({ 'hello' => [1], 'world' => [2] - ) + }) ) end
Resolve "Passing the keyword argument as ..." deprecation warning
zendesk_ruby-kafka
train
rb,rb
0a8d0d248a1d92f1b0d214c57e8b1841df87eb17
diff --git a/src/Provider/AssetServiceProvider.php b/src/Provider/AssetServiceProvider.php index <HASH>..<HASH> 100644 --- a/src/Provider/AssetServiceProvider.php +++ b/src/Provider/AssetServiceProvider.php @@ -34,11 +34,12 @@ class AssetServiceProvider implements ServiceProviderInterface $app['asset.file.hash'] = $app->protect(function ($fileName) use ($app) { $fullPath = $app['resources']->getPath('root') . '/' . $fileName; + if (is_readable($fullPath)) { - return substr(md5($app['asset.salt'] . filemtime($fullPath)), 0, 10); + return substr(md5($app['asset.salt'] . (string) filemtime($fullPath, 0, 10))); + } elseif (is_readable($fileName)) { + return substr(md5($app['asset.salt'] . (string) filemtime($fileName)), 0, 10); } - - return substr(md5($app['asset.salt'] . $fileName), 0, 10); }); $app['asset.injector'] = $app->share(
Only return a hash if the file can be found
bolt_bolt
train
php
1079d399919d255159bcd90fe9babcec91baf576
diff --git a/container.php b/container.php index <HASH>..<HASH> 100644 --- a/container.php +++ b/container.php @@ -159,7 +159,7 @@ class Metrodi_Container { $loaded = FALSE; foreach ($this->searchDirs as $_dir) { if(file_exists($_dir.$filesep.$file)) { - if(include_once($file)) { + if(include_once($_dir.$filesep.$file)) { $loaded = TRUE; break; }
Fix loading file bug. Missing directory path, but still passed unit tests.
metrophp_metrodi
train
php
378983ec98e8f2ffae9b0e49114d862492c0b5f1
diff --git a/lib/src/controller.php b/lib/src/controller.php index <HASH>..<HASH> 100644 --- a/lib/src/controller.php +++ b/lib/src/controller.php @@ -400,7 +400,7 @@ class Trails_Controller { * @return object a response object */ function rescue($exception) { - return ($this->response = $this->dispatcher->trails_error($exception)); + return $this->dispatcher->trails_error($exception); } }
Controller#rescue does not have to set response
luniki_trails
train
php
61740a492a145c87c79f4a7a3de83d4e4a0b3bc6
diff --git a/index.js b/index.js index <HASH>..<HASH> 100644 --- a/index.js +++ b/index.js @@ -75,10 +75,14 @@ module.exports = function(service, dcPath, app) { * last, and that allows us to override everything: */ - addFileIfExists('docker-compose.yml', command); - addFileIfExists('docker-compose.dcr.yml', command) - addFileIfExists('docker-compose.' + service + '.yml', command); - addFileIfExists('docker-compose.' + process.env.DCR_ENVIRONMENT + '.yml', command); + [ + 'docker-compose.yml', + 'docker-compose.dcr.yml', + 'docker-compose.' + service + '.yml', + 'docker-compose.' + process.env.DCR_ENVIRONMENT + '.yml' + ].map(function(fileName) { + addFileIfExists(fileName, command); + }); } /**
[#<I>] use map for list of files to try to load
markbirbeck_docker-compose-run
train
js
6fbcfed5b8eaeeeb7922005ee0149e6631943e76
diff --git a/tests/calculators/hazard/classical/post_processing_test.py b/tests/calculators/hazard/classical/post_processing_test.py index <HASH>..<HASH> 100644 --- a/tests/calculators/hazard/classical/post_processing_test.py +++ b/tests/calculators/hazard/classical/post_processing_test.py @@ -31,8 +31,10 @@ import numpy import random import unittest +from tests.utils import helpers from tests.utils.helpers import random_location_generator +from openquake.db import models from openquake.calculators.hazard.classical.post_processing import ( setup_tasks, mean_curves, quantile_curves, persite_result_decorator, mean_curves_weighted, quantile_curves_weighted, compute_hazard_map) @@ -473,3 +475,10 @@ class HazardMapsTestCase(unittest.TestCase): actual = compute_hazard_maps(curves, imls, poes) aaae(expected, actual) + + def test_do_hazard_map_post_process(self): + cfg = helpers.get_data_path( + 'calculators/hazard/classical/haz_map_test_job.ini') + helpers.run_hazard_job(cfg) + + # TODO: verify hazard maps
tests/calcs/hazard/classical/post_processing_test: Stubbed the basic test run for exercising hazard map creation. The hazard maps are created, but we still test the output values. Former-commit-id: c8b1e<I>fceb4f<I>ca<I>aa4bbb0dd4c<I>c3c
gem_oq-engine
train
py
f199af1f317f4cf3528311785302397d2fdd374f
diff --git a/Tone/source/PulseOscillator.js b/Tone/source/PulseOscillator.js index <HASH>..<HASH> 100644 --- a/Tone/source/PulseOscillator.js +++ b/Tone/source/PulseOscillator.js @@ -34,7 +34,7 @@ define(["../core/Tone", "../source/Source", "../source/Oscillator", * @type {Tone.Gain} * @private */ - this._widthGate = new Tone.Gain(); + this._widthGate = new Tone.Gain(0); /** * the sawtooth oscillator
setting gain to 0 initially keeps it from popping
Tonejs_Tone.js
train
js
4baccef5e924db1b3e9414e8e18da21c9ac39ed3
diff --git a/src/Console/Command/Task/PluginTask.php b/src/Console/Command/Task/PluginTask.php index <HASH>..<HASH> 100644 --- a/src/Console/Command/Task/PluginTask.php +++ b/src/Console/Command/Task/PluginTask.php @@ -47,7 +47,7 @@ class PluginTask extends BakeTask { */ public function initialize() { $this->path = current(App::path('Plugin')); - $this->bootstrap = ROOT . 'config' . DS . 'bootstrap.php'; + $this->bootstrap = ROOT . DS . 'config' . DS . 'bootstrap.php'; } /**
Fix bootstrap file path in PluginTask.
cakephp_cakephp
train
php
59c55463734be1bf37dc3b7ac5f0faed00a5fc6c
diff --git a/src/Post_Meta_Command.php b/src/Post_Meta_Command.php index <HASH>..<HASH> 100644 --- a/src/Post_Meta_Command.php +++ b/src/Post_Meta_Command.php @@ -1,7 +1,7 @@ <?php /** - * Manage post custom fields. + * Adds, updates, deletes, and lists post custom fields. * * ## EXAMPLES *
Use a more descriptive base summary for what actions are possible for post meta subcommands.
wp-cli_entity-command
train
php
e0be8b28e0df8c07b3073124a8c726cb0c8f602a
diff --git a/lib/resque/errors.rb b/lib/resque/errors.rb index <HASH>..<HASH> 100644 --- a/lib/resque/errors.rb +++ b/lib/resque/errors.rb @@ -4,4 +4,7 @@ module Resque # Raised when trying to create a job without a class class NoClassError < RuntimeError; end + + # Raised when a worker was killed while processing a job. + class DirtyExit < RuntimeError; end end diff --git a/lib/resque/worker.rb b/lib/resque/worker.rb index <HASH>..<HASH> 100644 --- a/lib/resque/worker.rb +++ b/lib/resque/worker.rb @@ -326,6 +326,15 @@ module Resque # Unregisters ourself as a worker. Useful when shutting down. def unregister_worker + # If we're still processing a job, make sure it gets logged as a + # failure. + if job + # Ensure the proper worker is attached to this job, even if + # it's not the precise instance that died. + job.worker = self + job.fail(DirtyExit.new) + end + redis.srem(:workers, self) redis.del("worker:#{self}") redis.del("worker:#{self}:started")
Ensure a terminated worker's job is put in the error queue.
resque_resque
train
rb,rb
a64296fa1934893a3c37f8fa0f32f23eba835426
diff --git a/src/Shortcodes/FileLink.php b/src/Shortcodes/FileLink.php index <HASH>..<HASH> 100644 --- a/src/Shortcodes/FileLink.php +++ b/src/Shortcodes/FileLink.php @@ -27,4 +27,12 @@ class FileLink extends DataObject 'Parent' => DataObject::class, 'Linked' => File::class, ]; + + /** + * Don't show this model in campaign admin as part of implicit change sets + * + * @config + * @var bool + */ + private static $hide_in_campaigns = true; }
Do not display records with `hide_in_campaigns` config set to `true` in the `Used On` table of files
silverstripe_silverstripe-assets
train
php
fedf3973a29704232eb182d55aff67838dfbb28a
diff --git a/holoviews/core/__init__.py b/holoviews/core/__init__.py index <HASH>..<HASH> 100644 --- a/holoviews/core/__init__.py +++ b/holoviews/core/__init__.py @@ -14,6 +14,6 @@ def public(obj): return any([issubclass(obj, bc) for bc in baseclasses]) _public = list(set([_k for _k, _v in locals().items() if public(_v)])) -__all__ = _public + ["boundingregion", "dimension", "holoview", "layer", - "layout", "operation", "options", "sheetcoords", "viewmap"] +__all__ = _public + ["boundingregion", "dimension", "layer", "layout", + "ndmapping", "operation", "options", "sheetcoords", "view"]
Removed import of core.holoview
pyviz_holoviews
train
py
00d8f6434da710b3c17e78ce807d3ed1679a7154
diff --git a/kerncraft/iaca.py b/kerncraft/iaca.py index <HASH>..<HASH> 100755 --- a/kerncraft/iaca.py +++ b/kerncraft/iaca.py @@ -77,7 +77,7 @@ def find_asm_blocks(asm_lines): m.group('idx'), int(m.group('scale')) if m.group('scale') else 1)) - if re.match(r"^[v]?(mul|add|sub|div)[h]?p[ds]", line): + if re.match(r"^[v]?(mul|add|sub|div|fmadd(132|213)?)[h]?p[ds]", line): if line.startswith('v'): avx_ctr += 1 packed_ctr += 1
added support for FMA in block stats
RRZE-HPC_kerncraft
train
py
8336c026f9e3570d3a4d78fd2c507e99e5c1dc7b
diff --git a/napalm_base/utils/string_parsers.py b/napalm_base/utils/string_parsers.py index <HASH>..<HASH> 100644 --- a/napalm_base/utils/string_parsers.py +++ b/napalm_base/utils/string_parsers.py @@ -94,7 +94,7 @@ def convert_uptime_string_seconds(uptime): uptime_seconds = 0 for unit, value in uptime_dict.items(): - if value != None: + if value is not None: if unit == 'weeks': uptime_seconds += int(value) * 604800 elif unit == 'days':
Fixing minor pylama issue
napalm-automation_napalm-base
train
py
d4362f4a39c70cd699bd2fd5813c08562be1cde6
diff --git a/spyder/plugins/console/plugin.py b/spyder/plugins/console/plugin.py index <HASH>..<HASH> 100644 --- a/spyder/plugins/console/plugin.py +++ b/spyder/plugins/console/plugin.py @@ -216,6 +216,7 @@ class Console(SpyderPluginWidget): if is_pyls_error: title = "Internal Python Language Server error" self.error_dlg.set_title(title) + self.error_dlg.title.setEnabled(False) self.error_dlg.append_traceback(text) self.error_dlg.show() elif DEV or get_debug_level():
Error dialog: Disable title when reporting PyLS errors
spyder-ide_spyder
train
py
b69e0cf710cdec1cf01bed27204c7cabf50679b5
diff --git a/salt/grains/core.py b/salt/grains/core.py index <HASH>..<HASH> 100644 --- a/salt/grains/core.py +++ b/salt/grains/core.py @@ -165,7 +165,7 @@ def _linux_gpu_data(): devs = [] try: - lspci_out = __salt__['cmd.run']('lspci -vmm') + lspci_out = __salt__['cmd.run']('{0} -vmm'.format(lspci)) cur_dev = {} error = False @@ -510,7 +510,7 @@ def _virtual(osdata): if not cmd: continue - cmd = '{0} {1}'.format(command, ' '.join(args)) + cmd = '{0} {1}'.format(cmd, ' '.join(args)) ret = __salt__['cmd.run_all'](cmd)
Use path found by salt.utils.which I ran into this problem running `salt-ssh '*' test.ping` with a XenServer <I> node as the target. Even though the `lspci` and `dmidecode` (after I installed it) commands are found by `salt.utils.which`, because they're not actually in the `$PATH`, they fail to execute.
saltstack_salt
train
py
fbd7dea61e8e2da4f03d2a5366d3c61f64f0abf3
diff --git a/docs/conf.py b/docs/conf.py index <HASH>..<HASH> 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -79,7 +79,7 @@ master_doc = 'index' # General information about the project. project = u'cookiecutter' -copyright = u'2013-2015, Audrey Roy' +copyright = u'2013-2016, Audrey Roy' # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the @@ -292,7 +292,7 @@ texinfo_documents = [ epub_title = u'cookiecutter' epub_author = u'Audrey Roy' epub_publisher = u'Audrey Roy' -epub_copyright = u'2013-2015, Audrey Roy' +epub_copyright = u'2013-2016, Audrey Roy' # The language of the text. It defaults to the language option # or en if the language is not set.
Updated copyright on docs from <I>-<I> to <I>-<I> per #<I>.
audreyr_cookiecutter
train
py
1e7c2887c1eb8900ab2a644aa423ae9ca2d91c1d
diff --git a/code/Calendar.php b/code/Calendar.php index <HASH>..<HASH> 100755 --- a/code/Calendar.php +++ b/code/Calendar.php @@ -661,7 +661,8 @@ class Calendar_Controller extends Page_Controller { $xml = trim($xml); HTTP::add_cache_headers(); $this->getResponse()->addHeader('Content-Type', 'application/rss+xml'); - echo $xml; + $this->getResponse()->setBody($xml); + return $this->getResponse(); } public function monthjson(SS_HTTPRequest $r) {
Set headers correctly on RSS feed In order for the headers to be set correctly, the response needs to be returned from the function rather than the raw content.
unclecheese_silverstripe-event-calendar
train
php
f039938e05a23080afd65e5527b6ee9e2025d7ff
diff --git a/tools/repl.js b/tools/repl.js index <HASH>..<HASH> 100644 --- a/tools/repl.js +++ b/tools/repl.js @@ -17,6 +17,7 @@ var RapydScript = (typeof create_rapydscript_compiler === 'function') ? create_r function create_ctx(baselib, show_js, console) { var ctx = vm.createContext({'console':console, 'show_js': !!show_js, 'RapydScript':RapydScript, 'require':require}); vm.runInContext(baselib, ctx, {'filename':'baselib-plain-pretty.js'}); + vm.runInContext('var __name__ = "__repl__";', ctx); RapydScript.AST_Node.warn_function = function() {}; return ctx; }
Fix default __repr__ not working in REPL
kovidgoyal_rapydscript-ng
train
js
920ee582de643147150faea036acd3c228542d5f
diff --git a/wffweb/src/main/java/com/webfirmframework/wffweb/server/page/js/WffJsFile.java b/wffweb/src/main/java/com/webfirmframework/wffweb/server/page/js/WffJsFile.java index <HASH>..<HASH> 100644 --- a/wffweb/src/main/java/com/webfirmframework/wffweb/server/page/js/WffJsFile.java +++ b/wffweb/src/main/java/com/webfirmframework/wffweb/server/page/js/WffJsFile.java @@ -80,7 +80,7 @@ public enum WffJsFile { private static volatile int variableId = 0; private static String[][] minifiableParts = { { "else {", "else{" }, - { "} else", "}else" }, { "if (", "if(" }, }; + { "} else", "}else" }, { "if (", "if(" }, { ") {", "){" } }; private static final String HEART_BEAT_JS = "setInterval(function(){try{wffWS.send([]);}catch(e){wffWS.closeSocket();}},\"${HEARTBEAT_INTERVAL}\");";
Minor optimizations -- Improved js minification
webfirmframework_wff
train
java
7f28fe06cf7888589e8d4fdaa65d537490c45438
diff --git a/lxd/storage/drivers/utils.go b/lxd/storage/drivers/utils.go index <HASH>..<HASH> 100644 --- a/lxd/storage/drivers/utils.go +++ b/lxd/storage/drivers/utils.go @@ -295,17 +295,12 @@ func deleteParentSnapshotDirIfEmpty(poolName string, volType VolumeType, volName // ensureSparseFile creates a sparse empty file at specified location with specified size. // If the path already exists, the file is truncated to the requested size. func ensureSparseFile(filePath string, sizeBytes int64) error { - f, err := os.Create(filePath) + f, err := os.OpenFile(filePath, os.O_RDWR|os.O_CREATE, 0600) if err != nil { return errors.Wrapf(err, "Failed to open %s", filePath) } defer f.Close() - err = f.Chmod(0600) - if err != nil { - return errors.Wrapf(err, "Failed to chmod %s", filePath) - } - err = f.Truncate(sizeBytes) if err != nil { return errors.Wrapf(err, "Failed to create sparse file %s", filePath)
lxd/storage: Fix regression in truncate handling
lxc_lxd
train
go
fc7d2f2206f804563d439e383bcbdec58760c384
diff --git a/lib/roo/open_office.rb b/lib/roo/open_office.rb index <HASH>..<HASH> 100644 --- a/lib/roo/open_office.rb +++ b/lib/roo/open_office.rb @@ -13,9 +13,7 @@ class Roo::OpenOffice < Roo::Base def process_zipfile(tmpdir, zip, path='') if zip.file.file? path if path == "content.xml" - open(File.join(tmpdir, 'roo_content.xml'),'wb') {|f| - f << zip.read(path) - } + File.write(File.join(tmpdir, 'roo_content.xml'), zip.read(path), mode: 'wb') end else unless path.empty?
Write the OpenOffice content file in one call.
roo-rb_roo
train
rb
74140dbf53456c30600d7870316c5ac79878a003
diff --git a/handler/src/main/java/io/netty/handler/ssl/ReferenceCountedOpenSslEngine.java b/handler/src/main/java/io/netty/handler/ssl/ReferenceCountedOpenSslEngine.java index <HASH>..<HASH> 100644 --- a/handler/src/main/java/io/netty/handler/ssl/ReferenceCountedOpenSslEngine.java +++ b/handler/src/main/java/io/netty/handler/ssl/ReferenceCountedOpenSslEngine.java @@ -235,7 +235,6 @@ public class ReferenceCountedOpenSslEngine extends SSLEngine implements Referenc } finally { readerLock.unlock(); } - ssl = SSL.newSSL(context.ctx, !context.isClient()); try { networkBIO = SSL.bioNewByteBuffer(ssl, context.getBioNonApplicationBufferSize());
Correct merge error from f7b3caeddc5bb1da<I>aaafa4a<I>dec<I>ed<I>d<I>
netty_netty
train
java
c907258a61ab7d196d576e462224623b98c173e4
diff --git a/ara/clients/offline.py b/ara/clients/offline.py index <HASH>..<HASH> 100644 --- a/ara/clients/offline.py +++ b/ara/clients/offline.py @@ -27,10 +27,10 @@ from django.core.management import execute_from_command_line from django.test import Client -class OfflineClient(object): +class AraOfflineClient(object): def __init__(self): - self.client = self.bootstrap_django_client() self.log = logging.getLogger('ara.clients.offline') + self.client = self._bootstrap_django_client() def _bootstrap_django_client(self): self.log.debug('Bootstrapping Django offline client')
Rename offline client class and fix django bootstrap Wrong method name was used when bootstrapping django. Change-Id: Iee<I>e<I>daaa7e<I>fb<I>f4da<I>a8
ansible-community_ara
train
py
1fcd7aa31a71003f61f1f9af9a843bff265661cd
diff --git a/plexapi/playlist.py b/plexapi/playlist.py index <HASH>..<HASH> 100644 --- a/plexapi/playlist.py +++ b/plexapi/playlist.py @@ -253,15 +253,13 @@ class Playlist(PlexPartialObject, Playable, ArtMixin, PosterMixin): return cls(server, data, initpath=key) def copyToUser(self, user): - """ Copy playlist to another user account. """ - from plexapi.server import PlexServer - myplex = self._server.myPlexAccount() - user = myplex.user(user) - # Get the token for your machine. - token = user.get_token(self._server.machineIdentifier) - # Login to your server using your friends credentials. - user_server = PlexServer(self._server._baseurl, token) - return self.create(user_server, self.title, self.items()) + """ Copy playlist to another user account. + + Parameters: + user (str): Username, email or user id of the user to copy the playlist to. + """ + userServer = self._server.switchUser(user) + return self.create(userServer, self.title, self.items()) def sync(self, videoQuality=None, photoResolution=None, audioBitrate=None, client=None, clientId=None, limit=None, unwatched=False, title=None):
Update Playlist.copyToUser with switchUser
pkkid_python-plexapi
train
py
f81cf0cebc163db7eba8cf0c111d9972571c6636
diff --git a/commands/command_pre_push.go b/commands/command_pre_push.go index <HASH>..<HASH> 100644 --- a/commands/command_pre_push.go +++ b/commands/command_pre_push.go @@ -7,6 +7,7 @@ import ( "github.com/github/git-lfs/git" "github.com/github/git-lfs/lfs" + "github.com/rubyist/tracerx" "github.com/spf13/cobra" ) @@ -66,6 +67,8 @@ func prePushCommand(cmd *cobra.Command, args []string) { continue } + tracerx.Printf("pre-push: %s", line) + left, right := decodeRefs(line) if left == prePushDeleteBranch { continue
trace the refs and shas given to pre-push
git-lfs_git-lfs
train
go
2f0a125384acf8c6144370a1300d04c415067e22
diff --git a/lib/synvert/core/node_ext.rb b/lib/synvert/core/node_ext.rb index <HASH>..<HASH> 100644 --- a/lib/synvert/core/node_ext.rb +++ b/lib/synvert/core/node_ext.rb @@ -387,7 +387,9 @@ module Parser::AST end when String if Parser::AST::Node === actual - actual.to_source == expected || actual.to_source[1...-1] == expected + actual.to_source == expected || + (actual.to_source[0] == ':' && actual.to_source[1..-1] == expected) || + actual.to_source[1...-1] == expected else actual.to_s == expected end
fix match_value between symbol and string
xinminlabs_synvert-core
train
rb
f73140fd4773a1de47017eb0d053a4164c9f3747
diff --git a/activesupport/test/core_ext/enumerable_test.rb b/activesupport/test/core_ext/enumerable_test.rb index <HASH>..<HASH> 100644 --- a/activesupport/test/core_ext/enumerable_test.rb +++ b/activesupport/test/core_ext/enumerable_test.rb @@ -24,7 +24,7 @@ class EnumerableTests < ActiveSupport::TestCase def test_group_by names = %w(marcel sam david jeremy) klass = Struct.new(:name) - objects = (1..50).inject([]) do |people,| + objects = (1..50).inject([]) do |people| p = klass.new p.name = names.sort_by { rand }.first people << p
Removed unused comma after loop variable
rails_rails
train
rb
5ba7f2e7dab6ef2471462597c8adafaab4dbcdb6
diff --git a/shinken/modules/livestatus_broker/mapping.py b/shinken/modules/livestatus_broker/mapping.py index <HASH>..<HASH> 100644 --- a/shinken/modules/livestatus_broker/mapping.py +++ b/shinken/modules/livestatus_broker/mapping.py @@ -1557,7 +1557,7 @@ livestatus_attribute_map = { }, 'alias': { 'description': 'An alias of the service group', - 'function': lambda item, req: getattr(item, 'alias', 'will_be_fixed_soon'), # REPAIRME in test_livestatus there is an alias. in multisite there is none (Service has no attr. alias. hahaha liar) + 'function': lambda item, req: item.alias, }, 'members': { 'description': 'A list of all members of the service group as host/service pairs',
Remove the servicegroup alias workaround in livestatus
Alignak-monitoring_alignak
train
py
4d91708c3afcde33fa6af75b9a489fb63b87e1f3
diff --git a/docs/conf.py b/docs/conf.py index <HASH>..<HASH> 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -31,6 +31,7 @@ MOCK_MODULES = [ 'larcc.MAP', 'PyQt4', 'PyQt4.QtCore', 'PyQt4.QtGui', 'web', 'lar2psm', 'scipy.ndimage.measurements', 'lar', 'extern.lar', 'splines', 'scipy.sparse', 'skimage.filter', 'mapper', 'skelet3d', 'numpy.core', + 'skimage.filters', 'lbpLibrary', 'skimage.exposure', 'PyQt4.QVTKRenderWindowInteractor', 'matplotlib.backends', 'matplotlib.backends.backend_qt4agg', 'numpy.linalg', 'PyQt4.Qt', 'matplotlib.figure', 'skimage.morphology', 'gtk',
mock skimage.filters
mjirik_imtools
train
py
0329f8c85bb88b33a97c8d529bcbe29dbf9c9641
diff --git a/lib/sanford/version.rb b/lib/sanford/version.rb index <HASH>..<HASH> 100644 --- a/lib/sanford/version.rb +++ b/lib/sanford/version.rb @@ -1,3 +1,3 @@ module Sanford - VERSION = "0.6.4" + VERSION = "0.6.5" end
<I> * Don't re-daemonize the process when restarting (#<I>)
redding_sanford
train
rb
a2bf2d30504de5e5a8ed4ff262ee6dc8b0c00d88
diff --git a/Resources/Public/JavaScript/Libs/jquery.responsiveimages.js b/Resources/Public/JavaScript/Libs/jquery.responsiveimages.js index <HASH>..<HASH> 100644 --- a/Resources/Public/JavaScript/Libs/jquery.responsiveimages.js +++ b/Resources/Public/JavaScript/Libs/jquery.responsiveimages.js @@ -14,6 +14,7 @@ this.$element = $(element); this.options = $.extend({}, ResponsiveImage.DEFAULTS, options); this.attrib = "src"; + this.loaded = false; this.checkviewport(); }; @@ -26,7 +27,6 @@ 1200: 'bigger' }, attrib: "src", - container: window, skip_invisible: false, preload: false }; @@ -52,8 +52,11 @@ }); if (old_attrib !== attrib) { this.attrib = attrib; + this.loaded = false; } - this.unveil(); + if (!this.loaded){ + this.unveil(); + } }; ResponsiveImage.prototype.boundingbox = function() { @@ -79,6 +82,7 @@ this.$element.attr("src", source); this.$element.css("opacity", 1); $(window).trigger('loaded.bk2k.responsiveimage'); + this.loaded = true; } } };
Update jquery.responsiveimages.js Use loaded flag to call unveil only when realy needed. Fix container option no more needed.
benjaminkott_bootstrap_package
train
js
199155f449bc527f7056f1595a5aa7d6bab8b27b
diff --git a/src/remote.js b/src/remote.js index <HASH>..<HASH> 100644 --- a/src/remote.js +++ b/src/remote.js @@ -65,8 +65,8 @@ module.exports = { r.lambda = userResults[0].data.lambda; r.Eg2 = n.rep([firstUserResult.numFeatures], 0); r.EdW = n.rep([firstUserResult.numFeatures], 0); - r.rho = 0.99; // watch out for this and the eps - r.eps = 1e-4; + r.rho = 0.5; // watch out for this and the eps + r.eps = 0.1; r.deltaW = 0; r.iteration = 1; return r;
fix rho/eps for convergence
MRN-Code_decentralized-laplacian-ridge-regression
train
js