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 |
|---|---|---|---|---|---|
47ca4675e3a9463e16d5d8f8a2f5968aed360055 | diff --git a/lib/shoulda/matchers/active_record/validate_uniqueness_of_matcher.rb b/lib/shoulda/matchers/active_record/validate_uniqueness_of_matcher.rb
index <HASH>..<HASH> 100644
--- a/lib/shoulda/matchers/active_record/validate_uniqueness_of_matcher.rb
+++ b/lib/shoulda/matchers/active_record/validate_uniqueness_of_matcher.rb
@@ -396,7 +396,7 @@ module Shoulda
end
def validations
- model._validators[@attribute].select do |validator|
+ model.validators_on(@attribute).select do |validator|
validator.is_a?(::ActiveRecord::Validations::UniquenessValidator)
end
end | uniqueness: don't use a private Rails API
`ActiveRecord::Validations#_validations` is a private API.
Fortunately, Rails provides an API that does exactly what's needed here,
and it's been in Rails since at least <I>, so let's use that instead. | thoughtbot_shoulda-matchers | train | rb |
9b2d496b88d6b893aada4aefb93a53f8d5108cce | diff --git a/cwltool/stdfsaccess.py b/cwltool/stdfsaccess.py
index <HASH>..<HASH> 100644
--- a/cwltool/stdfsaccess.py
+++ b/cwltool/stdfsaccess.py
@@ -45,4 +45,6 @@ class StdFsAccess(object):
return os.path.join(path, *paths)
def realpath(self, path): # type: (Text) -> Text
+ if os.name == 'nt':
+ return path
return os.path.realpath(path) | On windows os.realpath appends Drive letter, we need to avoid that | common-workflow-language_cwltool | train | py |
ff343656c019221b89188176ba7118e470e87e8e | diff --git a/src/org/openscience/cdk/atomtype/StructGenAtomTypeGuesser.java b/src/org/openscience/cdk/atomtype/StructGenAtomTypeGuesser.java
index <HASH>..<HASH> 100644
--- a/src/org/openscience/cdk/atomtype/StructGenAtomTypeGuesser.java
+++ b/src/org/openscience/cdk/atomtype/StructGenAtomTypeGuesser.java
@@ -86,7 +86,7 @@ public class StructGenAtomTypeGuesser implements IAtomTypeGuesser {
for (int i=0; i<types.length; i++) {
IAtomType type = types[i];
logger.debug(" ... matching atom ", atom, " vs ", type);
- if (bondOrderSum - charge + hcount == types[i].getBondOrderSum() &&
+ if (bondOrderSum - charge + hcount <= types[i].getBondOrderSum() &&
maxBondOrder <= types[i].getMaxBondOrder()) {
matchingTypes.add(type);
} | Be more flexible in what possible matches are, as this class should do.
git-svn-id: <URL> | cdk_cdk | train | java |
57363540ad24e8df38588668b697be77d570f9e1 | diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100755
--- a/setup.py
+++ b/setup.py
@@ -7,15 +7,11 @@ versionfile = open('VERSION', 'r')
ver = versionfile.read().strip()
versionfile.close()
-setup(name='SCoT',
+setup(name='scot',
version=ver,
description='Source Connectivity Toolbox',
author='Martin Billinger',
author_email='martin.billinger@tugraz.at',
url='https://github.com/scot-dev/scot',
- packages=['scot',
- 'scot.eegtopo'],
-
- package_data={'scot': ['binica/ica_linux']},
-
+ packages=['scot', 'scot.eegtopo', 'scot.external'],
install_requires=['numpy >=1.7', 'scipy >=0.12']) | Update setup.py (remove binica, change SCoT to scot, and add scot.external). | scot-dev_scot | train | py |
9746273b81faad17006f2532273e15e7643c6e88 | diff --git a/source/application/transforms/react/index.js b/source/application/transforms/react/index.js
index <HASH>..<HASH> 100644
--- a/source/application/transforms/react/index.js
+++ b/source/application/transforms/react/index.js
@@ -77,7 +77,7 @@ export default function createReactCodeFactory(application) {
function createWrappedRenderFunction(file, source, resolveDependencies, opts) {
const dependencies = writeDependencyImports(file).join('\n');
- return renderCodeTemplate(source, dependencies, template, pascalCase(file.pattern.id), opts);
+ return renderCodeTemplate(source, dependencies, template, pascalCase(file.pattern.manifest.name), opts);
}
function renderCodeTemplate(source, dependencies, templateCode, className, opts) { | fix: use manifest.name for plain jsx class names | patternplate-archive_patternplate-server | train | js |
1c47ccaf9b95bef97f3865d30b1b632d7a361917 | diff --git a/src/Versioned.php b/src/Versioned.php
index <HASH>..<HASH> 100644
--- a/src/Versioned.php
+++ b/src/Versioned.php
@@ -686,7 +686,6 @@ class Versioned extends DataExtension implements TemplateGlobalProvider, Resetta
*/
protected function promoteConditions(SQLSelect $baseQuery, SQLSelect $newQuery)
{
-
}
/** | Remove empty line to fix linting error | silverstripe_silverstripe-versioned | train | php |
7081f4230bc9c93cdacda30145e2fcee221d4c37 | diff --git a/packages/cli/lib/lib/webpack/webpack-client-config.js b/packages/cli/lib/lib/webpack/webpack-client-config.js
index <HASH>..<HASH> 100644
--- a/packages/cli/lib/lib/webpack/webpack-client-config.js
+++ b/packages/cli/lib/lib/webpack/webpack-client-config.js
@@ -229,6 +229,7 @@ function isProd(config) {
],
},
},
+ extractComments: false,
sourceMap: true,
}),
new OptimizeCssAssetsPlugin({ | Configure terser to not extract comments in production mode (#<I>)
Sets `extractComments: false` in webpack production config.
Fixes this error message I was seeing during builds:
```
× ERROR The comment file "route-dataset/index.tsx.chunk<I>d<I>e.esm.js.LICENSE.txt" conflicts with an existing asset, this may lead to code corruption, please use a different name
``` | developit_preact-cli | train | js |
01699f99b7a9a1f60fcee813f01d3007e042049c | diff --git a/lib/discordrb/data.rb b/lib/discordrb/data.rb
index <HASH>..<HASH> 100644
--- a/lib/discordrb/data.rb
+++ b/lib/discordrb/data.rb
@@ -252,6 +252,13 @@ module Discordrb
# A member is a user on a server. It differs from regular users in that it has roles, voice statuses and things like
# that.
class Member
+ # @return [true, false] whether this member is muted server-wide.
+ attr_reader :mute
+ alias_method :muted?, :mute
+
+ # @return [true, false] whether this member is deafened server-wide.
+ attr_reader :deaf
+ alias_method :deafened?, :deaf
# @!visibility private
def initialize(data, server, bot) | Create readers for mute and deaf | meew0_discordrb | train | rb |
34cb53239b797bf0a31c0f3b656562dd36fae0f5 | diff --git a/service-name-handler.js b/service-name-handler.js
index <HASH>..<HASH> 100644
--- a/service-name-handler.js
+++ b/service-name-handler.js
@@ -47,8 +47,8 @@ TChannelServiceNameHandler.prototype.handleRequest = function handleRequest(req,
if (self.isBusy) {
var busyInfo = self.isBusy();
- if (busyInfo && busyInfo.busy === true) {
- buildRes().sendError('Busy', busyInfo.reason || 'server is busy');
+ if (busyInfo) {
+ buildRes().sendError('Busy', busyInfo);
}
}
diff --git a/test/busy.js b/test/busy.js
index <HASH>..<HASH> 100644
--- a/test/busy.js
+++ b/test/busy.js
@@ -33,14 +33,11 @@ allocCluster.test('request().send() to a server', 2, function t(cluster, assert)
count += 1;
if (count < 2) {
- return {busy: false};
+ return null;
}
else {
- return {
- busy: true,
- reason: 'server is too busy'
- };
+ return 'server is too busy';
}
} | just returning string reason from isBusy | uber_tchannel-node | train | js,js |
c3214f82b53c72eb6884359020fa23449ba789b4 | diff --git a/MatchMakingLobby/Match/Plugin.php b/MatchMakingLobby/Match/Plugin.php
index <HASH>..<HASH> 100644
--- a/MatchMakingLobby/Match/Plugin.php
+++ b/MatchMakingLobby/Match/Plugin.php
@@ -601,10 +601,22 @@ class Plugin extends \ManiaLive\PluginHandler\Plugin
\ManiaLive\Utilities\Logger::debug('Player illegal leave: '.$login);
$this->gui->createLabel($this->gui->getIllegalLeaveText(), null, null, false, false);
+
+ $this->updateMatchPlayerState($login, Services\PlayerInfo::PLAYER_STATE_QUITTER);
- $this->changeState(self::PLAYER_LEFT);
- $this->updateMatchPlayerState($login, Services\PlayerInfo::PLAYER_STATE_QUITTER);
+ //If already waiting backup, no need to change state.
+ //maybe the player won't have his 40 seconds to come back
+ //but hard to manage all possible cases
+ if ($this->state == self::WAITING_BACKUPS)
+ {
+ //Forcing wait backup to handle match cancellation etc...
+ $this->waitBackups();
+ }
+ else
+ {
+ $this->changeState(self::PLAYER_LEFT);
+ }
}
protected function giveUp($login) | Fix rare bug when changing state multiple times | maniaplanet_matchmaking-lobby | train | php |
906d023d29cb428fa350746b7286d24ae9cd04b2 | diff --git a/lib/sequent/core/command_record.rb b/lib/sequent/core/command_record.rb
index <HASH>..<HASH> 100644
--- a/lib/sequent/core/command_record.rb
+++ b/lib/sequent/core/command_record.rb
@@ -43,8 +43,9 @@ module Sequent
def parent
EventRecord
- .find_by(aggregate_id: event_aggregate_id, sequence_number: event_sequence_number)
+ .where(aggregate_id: event_aggregate_id, sequence_number: event_sequence_number)
.where('event_type != ?', Sequent::Core::SnapshotEvent.name)
+ .first
end
def children | Fix broken selecting parent of CommandRecord | zilverline_sequent | train | rb |
e975fdab010f555022d086b209f2241ecb283589 | diff --git a/src/engine/keyManager.js b/src/engine/keyManager.js
index <HASH>..<HASH> 100644
--- a/src/engine/keyManager.js
+++ b/src/engine/keyManager.js
@@ -377,19 +377,19 @@ export class KeyManager {
}
if (newPubKey) {
const index = children.length
- const pubKeyHash = await this.hash160(newPubKey.publicKey)
- let address = null
+ let nested = false
+ let witness = false
if (this.bip === 'bip49') {
- address = bcoin.primitives.Address.fromScripthash(
- pubKeyHash,
- this.network
- ).toBase58(this.network)
- } else {
- address = bcoin.primitives.Address.fromPubkeyhash(
- pubKeyHash,
- this.network
- ).toBase58(this.network)
+ nested = true
+ witness = true
}
+ const key = bcoin.primitives.KeyRing.fromOptions({
+ publicKey: newPubKey,
+ nested,
+ witness
+ })
+ key.network = bcoin.network.get(this.network)
+ const address = key.getAddress('base58')
const scriptHash = await this.addressToScriptHash(address)
this.engineState.addAddress(
scriptHash, | create key correctly for nested address under bip<I> | EdgeApp_edge-currency-bitcoin | train | js |
1fc2fa5c9fe8cfa4a7b820cac90eff4d9dcbd762 | diff --git a/examples/router/router-mock.js b/examples/router/router-mock.js
index <HASH>..<HASH> 100644
--- a/examples/router/router-mock.js
+++ b/examples/router/router-mock.js
@@ -5,6 +5,20 @@ Vue.component('RouterLink', {
tag: { type: String, default: 'a' }
},
render(createElement) {
- return createElement(this.tag, {}, this.$slots.default)
+ const href = this.$attrs.to
+ return createElement(
+ this.tag,
+ {
+ attrs: { href },
+ on: {
+ click(e) {
+ // eslint-disable-next-line no-console
+ console.log('Navigated to: ', href)
+ e.preventDefault()
+ }
+ }
+ },
+ this.$slots.default
+ )
}
}) | docs(router): add href to examples | vue-styleguidist_vue-styleguidist | train | js |
13b54ada7f65c85b02b964dc58b97d805d498527 | diff --git a/includes/functions-auth.php b/includes/functions-auth.php
index <HASH>..<HASH> 100644
--- a/includes/functions-auth.php
+++ b/includes/functions-auth.php
@@ -157,9 +157,11 @@ function yourls_store_cookie( $user = null ) {
die('Stealing cookies?'); // This should never happen
}
$time = time() + YOURLS_COOKIE_LIFE;
- }
- setcookie('yourls_username', yourls_salt( $user ), $time, '/' );
- setcookie('yourls_password', yourls_salt( $pass ), $time, '/' );
+ }
+ if ( !headers_sent() ) {
+ setcookie('yourls_username', yourls_salt( $user ), $time, '/' );
+ setcookie('yourls_password', yourls_salt( $pass ), $time, '/' );
+ }
}
// Set user name | Remove warning when trying to store cookie after headers sent
git-svn-id: <URL> | YOURLS_YOURLS | train | php |
652b3f90bc8170a41b04b589d147d366a7858424 | diff --git a/pyrogram/client/ext/base_client.py b/pyrogram/client/ext/base_client.py
index <HASH>..<HASH> 100644
--- a/pyrogram/client/ext/base_client.py
+++ b/pyrogram/client/ext/base_client.py
@@ -105,10 +105,10 @@ class BaseClient:
async def resolve_peer(self, *args, **kwargs):
pass
- async def fetch_peers(self, *args, **kwargs):
+ def fetch_peers(self, *args, **kwargs):
pass
- async def add_handler(self, *args, **kwargs):
+ def add_handler(self, *args, **kwargs):
pass
async def save_file(self, *args, **kwargs): | Remove async from some method signatures. They are not asynchronous | pyrogram_pyrogram | train | py |
b02ee1c220a9968c67888ca631b42a2e09512853 | diff --git a/js/jquery.fileupload.js b/js/jquery.fileupload.js
index <HASH>..<HASH> 100644
--- a/js/jquery.fileupload.js
+++ b/js/jquery.fileupload.js
@@ -1,5 +1,5 @@
/*
- * jQuery File Upload Plugin 5.16.1
+ * jQuery File Upload Plugin 5.16.2
* https://github.com/blueimp/jQuery-File-Upload
*
* Copyright 2010, Sebastian Tschan
@@ -850,7 +850,7 @@
fileInput.prop('entries'),
files,
value;
- if (entries && entries.length > 0) {
+ if (entries && entries.length) {
return this._handleFileTreeEntries(entries);
}
files = $.makeArray(fileInput.prop('files')); | Refactored last merge and updated version number. | blueimp_jQuery-File-Upload | train | js |
03fb84d5592ac145d5cdb342011cf0f10e37d888 | diff --git a/bika/lims/browser/js/utils.js b/bika/lims/browser/js/utils.js
index <HASH>..<HASH> 100644
--- a/bika/lims/browser/js/utils.js
+++ b/bika/lims/browser/js/utils.js
@@ -369,8 +369,12 @@ $(document).ready(function(){
}
});
- // Archetypes :int inputs get numeric class
- $("input[name*='\\:int']").addClass('numeric');
+ // Archetypes :int and IntegerWidget inputs get filtered
+ $("input[name*='\\:int'], .ArchetypesIntegerWidget input").keyup(function(e) {
+ if (/\D/g.test(this.value)) {
+ this.value = this.value.replace(/\D/g, '');
+ }
+ });
});
}(jQuery)); | Filter archetypes integer widget values
This prevents entry of anything but integers. fixes #<I> | senaite_senaite.core | train | js |
479330a49a28e4f7443982ba235d2adee3e49d58 | diff --git a/google_auth_oauthlib/interactive.py b/google_auth_oauthlib/interactive.py
index <HASH>..<HASH> 100644
--- a/google_auth_oauthlib/interactive.py
+++ b/google_auth_oauthlib/interactive.py
@@ -166,7 +166,7 @@ def get_user_credentials(
client_config, scopes=scopes
)
- port = find_open_port()
+ port = find_open_port(start=minimum_port, stop=maximum_port)
if not port:
raise ConnectionError("Could not find open port.")
diff --git a/tests/unit/test_interactive.py b/tests/unit/test_interactive.py
index <HASH>..<HASH> 100644
--- a/tests/unit/test_interactive.py
+++ b/tests/unit/test_interactive.py
@@ -80,7 +80,7 @@ def test_get_user_credentials_raises_connectionerror(monkeypatch):
from google_auth_oauthlib import flow
from google_auth_oauthlib import interactive as module_under_test
- def mock_find_open_port():
+ def mock_find_open_port(start=8080, stop=None):
return None
monkeypatch.setattr(module_under_test, "find_open_port", mock_find_open_port) | fix: Pass port range from `get_user_credentials` to `find_open_port` (#<I>)
* Port range now passed in | googleapis_google-auth-library-python-oauthlib | train | py,py |
ea2ea33d828d699c4ad3cc186b63e0eb29478d19 | diff --git a/provision/local/lxc.go b/provision/local/lxc.go
index <HASH>..<HASH> 100644
--- a/provision/local/lxc.go
+++ b/provision/local/lxc.go
@@ -15,7 +15,7 @@ func runCmd(cmd string, args ...string) error {
command := exec.Command(cmd, args...)
out, err := command.CombinedOutput()
log.Printf("running the cmd: %s with the args: %s", cmd, args)
- log.Print(out)
+ log.Print(string(out))
return err
} | provision/local: converting bytes do string. | tsuru_tsuru | train | go |
bdaef48743df6f22d6ffbdf9e72efee73986d6b5 | diff --git a/src/pyoram/storage/block_storage_sftp.py b/src/pyoram/storage/block_storage_sftp.py
index <HASH>..<HASH> 100644
--- a/src/pyoram/storage/block_storage_sftp.py
+++ b/src/pyoram/storage/block_storage_sftp.py
@@ -29,6 +29,7 @@ class BlockStorageSFTP(BlockStorageFile):
_filesystem=sshclient.open_sftp(),
**kwds)
self._sshclient = sshclient
+ self._f.set_pipelined()
#
# Define BlockStorageInterface Methods
diff --git a/src/pyoram/tests/test_block_storage.py b/src/pyoram/tests/test_block_storage.py
index <HASH>..<HASH> 100644
--- a/src/pyoram/tests/test_block_storage.py
+++ b/src/pyoram/tests/test_block_storage.py
@@ -831,6 +831,8 @@ class _dummy_sftp_file(object):
return data
def __getattr__(self, key):
return getattr(self._f, key)
+ def set_pipelined(self):
+ pass
class dummy_sftp(object):
remove = os.remove | set pipelined mode to true on the paramiko sftp object | ghackebeil_PyORAM | train | py,py |
6bc348f4a9e07e621da5fcd501706e79884fddcc | diff --git a/src/filter/RuleHelper.js b/src/filter/RuleHelper.js
index <HASH>..<HASH> 100644
--- a/src/filter/RuleHelper.js
+++ b/src/filter/RuleHelper.js
@@ -143,7 +143,7 @@ export class RuleHelper {
case ngeoFormatAttributeType.GEOMETRY:
rule = new ngeoRuleGeometry({
name: name,
- operator: RuleSpatialOperatorType.WITHIN,
+ operator: RuleSpatialOperatorType.INTERSECTS,
operators: [
RuleSpatialOperatorType.CONTAINS,
RuleSpatialOperatorType.INTERSECTS, | Set default spatial operator to INTERSECTS | camptocamp_ngeo | train | js |
7156acf5e583f1ee9b15d027321cb8e26bac1898 | diff --git a/blueflood-core/src/main/java/com/rackspacecloud/blueflood/rollup/Granularity.java b/blueflood-core/src/main/java/com/rackspacecloud/blueflood/rollup/Granularity.java
index <HASH>..<HASH> 100644
--- a/blueflood-core/src/main/java/com/rackspacecloud/blueflood/rollup/Granularity.java
+++ b/blueflood-core/src/main/java/com/rackspacecloud/blueflood/rollup/Granularity.java
@@ -35,7 +35,7 @@ public final class Granularity {
private static final int GET_BY_POINTS_ASSUME_INTERVAL = Configuration.getInstance().getIntegerProperty(CoreConfig.GET_BY_POINTS_ASSUME_INTERVAL);
private static final String GET_BY_POINTS_SELECTION_ALGORITHM = Configuration.getInstance().getStringProperty(CoreConfig.GET_BY_POINTS_GRANULARITY_SELECTION);
private static int INDEX_COUNTER = 0;
- public static final int BASE_SLOTS_PER_GRANULARITY = 4032; // needs to be a multiple of the GCF of 4, 12, 48, 288.
+ private static final int BASE_SLOTS_PER_GRANULARITY = 4032; // needs to be a multiple of the GCF of 4, 12, 48, 288.
public static final int MILLISECONDS_IN_SLOT = 300000;
private static final int SECS_PER_DAY = 86400; | [square] doesn't need to be private | rackerlabs_blueflood | train | java |
8a63a08c695e59e0d3a769ac133685484fe80e82 | diff --git a/example/grouptest/settings.py b/example/grouptest/settings.py
index <HASH>..<HASH> 100644
--- a/example/grouptest/settings.py
+++ b/example/grouptest/settings.py
@@ -136,8 +136,8 @@ INSTALLED_APPS = (
)
-MIDDLEWARE_CLASSES += ('debug_toolbar.middleware.DebugToolbarMiddleware',)
-INSTALLED_APPS += ('debug_toolbar',)
+#MIDDLEWARE_CLASSES += ('debug_toolbar.middleware.DebugToolbarMiddleware',)
+#INSTALLED_APPS += ('debug_toolbar',)
INTERNAL_IPS = ('127.0.0.1',)
DEBUG_TOOLBAR_CONFIG = { | Disable debug_toolbar
Could probably do with removing this altogether. | bennylope_django-organizations | train | py |
34ab47758eb318009a99168eb66e5934f6ce8e18 | diff --git a/app/index.js b/app/index.js
index <HASH>..<HASH> 100644
--- a/app/index.js
+++ b/app/index.js
@@ -285,10 +285,6 @@ module.exports = yeoman.Base.extend({
},
babel: function () {
- if (!this.options.babel) {
- return;
- }
-
this.fs.copy(
this.templatePath('babelrc'),
this.destinationPath('.babelrc')
diff --git a/test/test-generator.js b/test/test-generator.js
index <HASH>..<HASH> 100644
--- a/test/test-generator.js
+++ b/test/test-generator.js
@@ -66,7 +66,6 @@ describe('Generator test', function () {
]);
assert.noFile([
- '.babelrc',
'app/scripts.babel/background.js',
'app/scripts.babel/chromereload.js'
]); | Copy babelrc in anytime | yeoman_generator-chrome-extension | train | js,js |
d15f1ec2793c3d7cb12f7bd49c73192222f0fd81 | diff --git a/openquake/utils/db/loader.py b/openquake/utils/db/loader.py
index <HASH>..<HASH> 100644
--- a/openquake/utils/db/loader.py
+++ b/openquake/utils/db/loader.py
@@ -158,10 +158,10 @@ def parse_mfd(fault, mfd_java_obj):
min_mag = mfd_java_obj.getMinX() - (delta / 2)
max_mag = mfd_java_obj.getMaxX() + (delta / 2)
total_cumul_rate = mfd_java_obj.getTotCumRate()
- denominator = (numpy.power(10, -(mfd['b_val'] * min_mag))
+ denominator = float(numpy.power(10, -(mfd['b_val'] * min_mag))
- numpy.power(10, -(mfd['b_val'] * max_mag)))
- mfd['a_val'] = numpy.log10(total_cumul_rate / denominator)
+ mfd['a_val'] = float(numpy.log10(total_cumul_rate / denominator))
mfd['total_cumulative_rate'] = \
mfd_java_obj.getTotCumRate() / surface_area | re-added bug fix; (I had removed it to exercise a test)
Former-commit-id: <I>be<I>c9a<I>b7e<I>d8bad | gem_oq-engine | train | py |
63258a8c2a764980da94722fb129ad9f6ac53dd8 | diff --git a/abydos/bm.py b/abydos/bm.py
index <HASH>..<HASH> 100644
--- a/abydos/bm.py
+++ b/abydos/bm.py
@@ -409,7 +409,7 @@ def normalize_language_attributes(text, strip):
"""
uninitialized = -1; # all 1's
attrib = uninitialized
- while text.find('[') != -1:
+ while '[' in text:
bracket_start = text.find('[')
bracket_end = text.find(']', bracket_start)
if bracket_end == -1:
@@ -446,7 +446,7 @@ def apply_rule_if_compatible(phonetic, target, language_arg):
apply the rule
"""
candidate = phonetic + target
- if candidate.find('[') == -1: # no attributes so we need test no further
+ if '[' in candidate: # no attributes so we need test no further
return candidate
# expand the result, converting incompatible attributes to [0]
@@ -472,7 +472,7 @@ def apply_rule_if_compatible(phonetic, target, language_arg):
return ''
# return the result of applying the rule
- if candidate.find('|') != -1:
+ if '|' in candidate:
candidate = '('+candidate+')'
return candidate | simplified a few str.finds to ins | chrislit_abydos | train | py |
2f8dd847fc2565336b9b5bdbbabaf9582dd639a9 | diff --git a/core-bundle/src/Resources/contao/library/Contao/Message.php b/core-bundle/src/Resources/contao/library/Contao/Message.php
index <HASH>..<HASH> 100644
--- a/core-bundle/src/Resources/contao/library/Contao/Message.php
+++ b/core-bundle/src/Resources/contao/library/Contao/Message.php
@@ -178,7 +178,15 @@ class Message
return;
}
- $session->getFlashBag()->clear();
+ $flashBag = $session->getFlashBag();
+
+ // Find all contao. keys (see #3393)
+ $keys = preg_grep('(^contao\.)', $flashBag->keys());
+
+ foreach ($keys as $key)
+ {
+ $flashBag->get($key); // clears the message
+ }
}
/** | Do not reset the entire flash bag when resetting the message system (see #<I>)
Description
-----------
| Q | A
| -----------------| ---
| Fixed issues | Fixes #<I>
| Docs PR or issue | -
Commits
-------
ef0a8bfb Do not reset the entire flash bag when resetting the message system
4ff<I>f0 Adjust the regex | contao_contao | train | php |
76c99950031a2310f982876a0ecf9e085af342c1 | diff --git a/state/allcollections.go b/state/allcollections.go
index <HASH>..<HASH> 100644
--- a/state/allcollections.go
+++ b/state/allcollections.go
@@ -319,7 +319,11 @@ func allCollections() CollectionSchema {
// These collections hold information associated with machines.
containerRefsC: {},
- instanceDataC: {},
+ instanceDataC: {
+ indexes: []mgo.Index{{
+ Key: []string{"model-uuid", "machineid"},
+ }},
+ },
machinesC: {
indexes: []mgo.Index{{
Key: []string{"model-uuid", "machineid"}, | Adds index for model UUID and machine ID to instanceData collection.
Full scans are being seen against this table even when filters are
applied. | juju_juju | train | go |
6971d6443cb5c9bd2f43cde032f3fb036c348e89 | diff --git a/src/RedisClustr.js b/src/RedisClustr.js
index <HASH>..<HASH> 100644
--- a/src/RedisClustr.js
+++ b/src/RedisClustr.js
@@ -614,9 +614,17 @@ setupCommands(RedisClustr);
* @date 2014-11-19
* @return {RedisBatch} A RedisBatch which has a very similar interface to redis/
*/
-RedisClustr.prototype.batch = RedisClustr.prototype.multi = function() {
+RedisClustr.prototype.batch = RedisClustr.prototype.multi = function(commands) {
var self = this;
- return new RedisBatch(self);
+ var batch = new RedisBatch(self);
+
+ if (Array.isArray(commands) && commands.length > 0) {
+ commands.forEach(function (command) {
+ batch[command[0]](...command.slice(1));
+ });
+ }
+
+ return batch;
};
/** | Added pre-defined commands support to batch() and multi(). | gosquared_redis-clustr | train | js |
d77b7ed18829ae833b6083b04019ed90eb938864 | diff --git a/src/providers/index.js b/src/providers/index.js
index <HASH>..<HASH> 100644
--- a/src/providers/index.js
+++ b/src/providers/index.js
@@ -1,22 +1,18 @@
import BitcoinRPCProvider from './bitcoin/BitcoinRPCProvider'
import BitcoinLedgerProvider from './bitcoin/BitcoinLedgerProvider'
-import BitcoinSwapProvider from './bitcoin/BitcoinSwapProvider'
import EthereumRPCProvider from './ethereum/EthereumRPCProvider'
import EthereumLedgerProvider from './ethereum/EthereumLedgerProvider'
import EthereumMetaMaskProvider from './ethereum/EthereumMetaMaskProvider'
-import EthereumSwapProvider from './ethereum/EthereumSwapProvider'
export default {
bitcoin: {
BitcoinRPCProvider,
- BitcoinLedgerProvider,
- BitcoinSwapProvider
+ BitcoinLedgerProvider
},
ethereum: {
EthereumRPCProvider,
EthereumLedgerProvider,
- EthereumMetaMaskProvider,
- EthereumSwapProvider
+ EthereumMetaMaskProvider
}
} | Removed swap from providers
They are in another branch ;-) | liquality_chainabstractionlayer | train | js |
2866c82cef0b028519bdc89f526462846b38da22 | diff --git a/engine-rest/engine-rest/src/test/java/org/camunda/bpm/engine/rest/util/container/TomcatServerBootstrap.java b/engine-rest/engine-rest/src/test/java/org/camunda/bpm/engine/rest/util/container/TomcatServerBootstrap.java
index <HASH>..<HASH> 100644
--- a/engine-rest/engine-rest/src/test/java/org/camunda/bpm/engine/rest/util/container/TomcatServerBootstrap.java
+++ b/engine-rest/engine-rest/src/test/java/org/camunda/bpm/engine/rest/util/container/TomcatServerBootstrap.java
@@ -41,7 +41,7 @@ public abstract class TomcatServerBootstrap extends EmbeddedServerBootstrap {
String contextPath = "/" + getContextPath();
PomEquippedResolveStage resolver = Maven.configureResolver()
- .useLegacyLocalRepo(true).loadPomFromFile("pom.xml");
+ .useLegacyLocalRepo(true).workOffline().loadPomFromFile("pom.xml");
WebArchive wa = ShrinkWrap.create(WebArchive.class, "rest-test.war").setWebXML(webXmlPath)
.addAsLibraries(resolver.resolve("org.codehaus.jackson:jackson-jaxrs:1.6.5").withTransitivity().asFile()) | test(engine-rest): try harder to let shrinkwrap work offline
related to #CAM-<I> | camunda_camunda-bpm-platform | train | java |
2e266d8ac19495646c61388953bdbc57508f0f2a | diff --git a/lib/Doctrine/MongoDB/Query/Builder.php b/lib/Doctrine/MongoDB/Query/Builder.php
index <HASH>..<HASH> 100644
--- a/lib/Doctrine/MongoDB/Query/Builder.php
+++ b/lib/Doctrine/MongoDB/Query/Builder.php
@@ -1308,22 +1308,20 @@ class Builder
* field name (key) and order (value) pairs.
*
* @param array|string $fieldName Field name or array of field/order pairs
- * @param string $order Field order (if one field is specified)
+ * @param int|string $order Field order (if one field is specified)
* @return self
*/
public function sort($fieldName, $order = null)
{
- if (is_array($fieldName)) {
- foreach ($fieldName as $fieldName => $order) {
- $this->sort($fieldName, $order);
- }
- } else {
+ $fields = is_array($fieldName) ? $fieldName : array($fieldName => $order);
+
+ foreach ($fields as $fieldName => $order) {
if (is_string($order)) {
$order = strtolower($order) === 'asc' ? 1 : -1;
}
- $order = (int) $order;
- $this->query['sort'][$fieldName] = $order;
+ $this->query['sort'][$fieldName] = (int) $order;
}
+
return $this;
} | Refactor Builder::sort() to not use recursion | doctrine_mongodb | train | php |
72f5fa9e099dae230de38f4da25546c054c494e4 | diff --git a/src/wyc/stages/ModuleBuilder.java b/src/wyc/stages/ModuleBuilder.java
index <HASH>..<HASH> 100755
--- a/src/wyc/stages/ModuleBuilder.java
+++ b/src/wyc/stages/ModuleBuilder.java
@@ -676,7 +676,7 @@ public class ModuleBuilder {
String lab = Block.freshLabel();
postcondition = new Block();
postcondition.addAll(resolveCondition(lab, fd.postcondition, environment));
- postcondition.add(Code.Fail("postcondition not satisfied"), attributes(fd.precondition));
+ postcondition.add(Code.Fail("postcondition not satisfied"), attributes(fd.postcondition));
postcondition.add(Code.Label(lab));
} | Another bug fix for post-conditions. | Whiley_WhileyCompiler | train | java |
f294431c8157b63d16bf67b74a774eed334dc4c9 | diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -50,7 +50,7 @@ else:
# We will embed this metadata into the package so it can be recalled for debugging.
-version = '0.5.0'
+version = '0.5.1.dev0'
try:
git_commit, _ = Popen(['git', 'describe', '--tags'], stdout=PIPE, stderr=PIPE).communicate()
except OSError: | Bump to the next dev version.
We forgot to do this for <I>-dev. Whoops! | mikeboers_PyAV | train | py |
3f482ba8a8c7d50ac53fa6a772283d8ed457c20e | diff --git a/Facades/Facade.php b/Facades/Facade.php
index <HASH>..<HASH> 100755
--- a/Facades/Facade.php
+++ b/Facades/Facade.php
@@ -62,7 +62,6 @@ abstract class Facade
/**
* Initiate a mock expectation on the facade.
*
- * @param mixed
* @return \Mockery\Expectation
*/
public static function shouldReceive() | Fix possible errors on DocBlocks (#<I>)
Generating documentation using Sami, it reported some errors.
I'm not sure if the tags in the comments are wrong or we should just
ignore the error output of Sami.
Anyway this is not a big issue at all, just a minor detail. | illuminate_support | train | php |
59a61f8dd39fa6c7418a5775f028f9f2a796a14f | diff --git a/pid/__init__.py b/pid/__init__.py
index <HASH>..<HASH> 100644
--- a/pid/__init__.py
+++ b/pid/__init__.py
@@ -37,7 +37,7 @@ class PidFile(object):
def __init__(self, pidname=None, piddir=None, enforce_dotpid_postfix=True,
register_term_signal_handler=True, term_signal_handler=None,
lock_pidfile=True, chmod=0o644, uid=-1, gid=-1, force_tmpdir=False,
- lazy=False):
+ lazy=True):
self.pidname = pidname
self.piddir = piddir
self.enforce_dotpid_postfix = enforce_dotpid_postfix | default to lazy setup for all instantiations | trbs_pid | train | py |
33a621acc7f48e53d3873f4ae3711beed6ed0951 | diff --git a/vendor/plugins/typo_converter/spec/converters/wp25_spec.rb b/vendor/plugins/typo_converter/spec/converters/wp25_spec.rb
index <HASH>..<HASH> 100644
--- a/vendor/plugins/typo_converter/spec/converters/wp25_spec.rb
+++ b/vendor/plugins/typo_converter/spec/converters/wp25_spec.rb
@@ -11,4 +11,28 @@ describe "WordPress 2.5 converter" do
it "runs without crashing" do
TypoPlugins.convert_from :wp25
end
+
+ describe "given a user" do
+ it "creates a user"
+ end
+
+ describe "given a post" do
+ it "creates an article"
+
+ describe "with a comment" do
+ it "creates a comment"
+
+ describe "that is spam" do
+ it "marks the created comment as spam"
+ end
+ end
+
+ describe "that is a page" do
+ it "creates a page"
+ end
+ end
+
+ describe "given tags and categories" do
+ it "behaves in a manner to be determined"
+ end
end | Added a bunch of pending specs. | publify_publify | train | rb |
6d842aa92eb10796e392e971d585554e5d6542d5 | diff --git a/awss/awsc.py b/awss/awsc.py
index <HASH>..<HASH> 100644
--- a/awss/awsc.py
+++ b/awss/awsc.py
@@ -79,8 +79,11 @@ def get_all_aminames(i_info):
"""
for i in i_info:
- # pylint: disable=maybe-no-member
- i_info[i]['aminame'] = EC2R.Image(i_info[i]['ami']).name
+ try:
+ # pylint: disable=maybe-no-member
+ i_info[i]['aminame'] = EC2R.Image(i_info[i]['ami']).name
+ except AttributeError:
+ i_info[i]['aminame'] = "Unknown"
return i_info
@@ -93,7 +96,10 @@ def get_one_aminame(inst_img_id):
aminame (str): name of the image.
"""
- aminame = EC2R.Image(inst_img_id).name
+ try:
+ aminame = EC2R.Image(inst_img_id).name
+ except AttributeError:
+ aminame = "Unknown"
return aminame | Change AMI-Name Lookup to Account for AMI-index without a name
If an AMI-number does not have a corresponding name, it is assigned the value “Unknown”
This value will display in instance lists
This value used as a special-case in the cmd_ssh_user function
[ci skip] | robertpeteuil_aws-shortcuts | train | py |
a41c0a4c5bab438c50a9c26e6a6b6660733fd6ed | diff --git a/lib/git_wit/auth.rb b/lib/git_wit/auth.rb
index <HASH>..<HASH> 100644
--- a/lib/git_wit/auth.rb
+++ b/lib/git_wit/auth.rb
@@ -1,5 +1,8 @@
module GitWit
def self.user_for_authentication(username)
+ if config.user_for_authentication.respond_to?(:call)
+ return config.user_for_authentication.call(username)
+ end
username
end | Fix user fetching in GitWit::Auth. | xdissent_git_wit | train | rb |
5837401bc97b4c401483dea96865642a80f0a549 | diff --git a/tests/test_cookiecutter_invocation.py b/tests/test_cookiecutter_invocation.py
index <HASH>..<HASH> 100644
--- a/tests/test_cookiecutter_invocation.py
+++ b/tests/test_cookiecutter_invocation.py
@@ -38,6 +38,7 @@ def project_dir(request):
return rendered_dir
+@pytest.mark.usefixtures('clean_system')
def test_should_invoke_main(monkeypatch, project_dir):
monkeypatch.setenv('PYTHONPATH', '.') | Use clean up fixture in test_cookiecutter_invocation | audreyr_cookiecutter | train | py |
0f4ec56f9a8c8663656b3fa8b2e195d100bcba45 | diff --git a/packages/node_modules/@ciscospark/internal-plugin-wdm/test/integration/spec/ping.js b/packages/node_modules/@ciscospark/internal-plugin-wdm/test/integration/spec/ping.js
index <HASH>..<HASH> 100644
--- a/packages/node_modules/@ciscospark/internal-plugin-wdm/test/integration/spec/ping.js
+++ b/packages/node_modules/@ciscospark/internal-plugin-wdm/test/integration/spec/ping.js
@@ -59,6 +59,10 @@ describe(`plugin-wdm`, function() {
`mercuryAlternateDC`
];
+ const decommissionedServices = [
+ `stickies`
+ ];
+
knownServices.forEach((service) => {
describe(`.${service}`, () => {
it(`responds to pings`, () => ping(service));
@@ -69,6 +73,7 @@ describe(`plugin-wdm`, function() {
it(`responds to pings`, () => Object.keys(spark.internal.device.services)
.map((service) => service.replace(`ServiceUrl`, ``))
.filter((service) => !knownServices.includes(service))
+ .filter((service) => !knownServices.includes(service) && !decommissionedServices.includes(service))
.reduce((p, service) => p.then(() => ping(service)), Promise.resolve()));
}); | test(@ciscospark/i-plugin-wdm): decomission stickies service | webex_spark-js-sdk | train | js |
55df6b8a6a090bdffbad6a713932ff92ad826cac | diff --git a/dvc/command/remove.py b/dvc/command/remove.py
index <HASH>..<HASH> 100644
--- a/dvc/command/remove.py
+++ b/dvc/command/remove.py
@@ -13,8 +13,8 @@ class CmdRemove(CmdBase):
for target in self.args.targets:
try:
self.repo.remove(target, outs=self.args.outs)
- except DvcException as exc:
- logger.error(exc)
+ except DvcException:
+ logger.exception("")
return 1
return 0 | cli: remove: Show traceback on verbose (#<I>) | iterative_dvc | train | py |
eddf2483f9eda8e9b4da79d50d28d8984246cc13 | diff --git a/lib/xlsx/xlsx.js b/lib/xlsx/xlsx.js
index <HASH>..<HASH> 100644
--- a/lib/xlsx/xlsx.js
+++ b/lib/xlsx/xlsx.js
@@ -46,8 +46,6 @@ var XLSX = module.exports = function (workbook) {
};
-var getTheme1Xml = utils.readModuleFile(require.resolve('./xml/theme1.xml'));
-
XLSX.RelType = require('./rel-type');
@@ -265,7 +263,7 @@ XLSX.prototype = {
},
addThemes: function (zip) {
- return getTheme1Xml
+ return utils.readModuleFile(require.resolve('./xml/theme1.xml'));
.then(function (data) {
zip.append(data, {name: 'xl/theme/theme1.xml'});
return zip; | Stops Bluebird warning about unreturned promise
Fixes guyonroche/exceljs#<I> | exceljs_exceljs | train | js |
1be5bf7a577e6353de966b2a29cd70743c845b97 | diff --git a/lib/cancan/can_definition.rb b/lib/cancan/can_definition.rb
index <HASH>..<HASH> 100644
--- a/lib/cancan/can_definition.rb
+++ b/lib/cancan/can_definition.rb
@@ -104,7 +104,7 @@ module CanCan
def nested_subject_matches_conditions?(subject_hash)
parent, child = subject_hash.shift
- matches_conditions_hash?(parent, @conditions[parent.class.name.downcase.to_sym])
+ matches_conditions_hash?(parent, @conditions[parent.class.name.downcase.to_sym] || {})
end
def call_block_with_all(action, subject, extra_args)
diff --git a/spec/cancan/ability_spec.rb b/spec/cancan/ability_spec.rb
index <HASH>..<HASH> 100644
--- a/spec/cancan/ability_spec.rb
+++ b/spec/cancan/ability_spec.rb
@@ -254,6 +254,7 @@ describe CanCan::Ability do
@ability.can :read, Range, :string => {:length => 3}
@ability.can?(:read, "foo" => Range).should be_true
@ability.can?(:read, "foobar" => Range).should be_false
+ @ability.can?(:read, 123 => Range).should be_true
end
describe "unauthorized message" do | don't fail if association conditions aren't specified for nested association check | ryanb_cancan | train | rb,rb |
a6886ebb769628221945b7f54cbcb3e5ee2424f8 | diff --git a/indra/databases/hgnc_client.py b/indra/databases/hgnc_client.py
index <HASH>..<HASH> 100644
--- a/indra/databases/hgnc_client.py
+++ b/indra/databases/hgnc_client.py
@@ -1,17 +1,14 @@
-from __future__ import absolute_import, print_function, unicode_literals
-from builtins import dict, str
import os
import re
-import csv
import logging
-import requests
import xml.etree.ElementTree as ET
# Python3
try:
- from functools import lru_cache
-# Python2
+ import requests
except ImportError:
- from functools32 import lru_cache
+ requests = None
+ print("Warning: Could not import requests, only local resources available.")
+from functools import lru_cache
from indra.util import read_unicode_csv, UnicodeXMLTreeBuilder as UTB
@@ -367,6 +364,7 @@ def _read_hgnc_maps():
uniprot_ids, entrez_ids, entrez_ids_reverse, mouse_map, rat_map,
prev_sym_map)
+
(hgnc_names, hgnc_ids, hgnc_withdrawn, uniprot_ids, entrez_ids,
entrez_ids_reverse, mouse_map, rat_map, prev_sym_map) = \
_read_hgnc_maps() | Don't require requests as import for hgnc_client. | sorgerlab_indra | train | py |
750ee341290d9b5c5abeec4c1ed6506ed147924d | diff --git a/tests/frontend/org/voltdb/regressionsuites/TestFunctionsSuite.java b/tests/frontend/org/voltdb/regressionsuites/TestFunctionsSuite.java
index <HASH>..<HASH> 100644
--- a/tests/frontend/org/voltdb/regressionsuites/TestFunctionsSuite.java
+++ b/tests/frontend/org/voltdb/regressionsuites/TestFunctionsSuite.java
@@ -836,7 +836,8 @@ public class TestFunctionsSuite extends RegressionSuite {
System.out.println("VERIFY_STRING_TIMESTAMP_EQ failed on " + r.getRowCount() +
" rows, where only 2 were expected:");
System.out.println(r.toString());
- fail("VERIFY_TIMESTAMP_STRING_EQ failed on " + r.getRowCount() + " rows");
+ fail("VERIFY_TIMESTAMP_STRING_EQ failed on " + r.getRowCount() +
+ " rows, where only 2 were expected:");
}
cr = client.callProcedure("DUMP_TIMESTAMP_STRING_PATHS"); | add messages when fails according to Paul's comment. | VoltDB_voltdb | train | java |
2e86cec48bf2da0fd0d1fe8de605ba73725bef61 | diff --git a/aurelia-slickgrid/assets/lib/multiple-select/multiple-select.js b/aurelia-slickgrid/assets/lib/multiple-select/multiple-select.js
index <HASH>..<HASH> 100644
--- a/aurelia-slickgrid/assets/lib/multiple-select/multiple-select.js
+++ b/aurelia-slickgrid/assets/lib/multiple-select/multiple-select.js
@@ -670,7 +670,7 @@
}
// finally re-adjust the drop to the new calculated width when necessary
- if (maxDropWidth > currentDefinedWidth || currentDefinedWidth === '100%') {
+ if (currentDefinedWidth > maxDropWidth || this.$drop.width() > maxDropWidth || currentDefinedWidth === '100%') {
this.$drop.css({ 'width': maxDropWidth, 'max-width': maxDropWidth });
}
}, | fix(select): multiple-select autoAdjustDropWidth sometime incorrect | ghiscoding_aurelia-slickgrid | train | js |
8e592876bc04b007ec3c0687ab9f803327721608 | diff --git a/internal/services/storage/storage_account_resource.go b/internal/services/storage/storage_account_resource.go
index <HASH>..<HASH> 100644
--- a/internal/services/storage/storage_account_resource.go
+++ b/internal/services/storage/storage_account_resource.go
@@ -996,9 +996,6 @@ func resourceStorageAccountCreate(d *pluginsdk.ResourceData, meta interface{}) e
(accountTier == string(storage.Standard) && accountKind == string(storage.StorageV2))) {
return fmt.Errorf("`nfsv3_enabled` can only be used with account tier `Standard` and account kind `StorageV2`, or account tier `Premium` and account kind `BlockBlobStorage`")
}
- if nfsV3Enabled && enableHTTPSTrafficOnly {
- return fmt.Errorf("`nfsv3_enabled` can only be used when `enable_https_traffic_only` is `false`")
- }
if nfsV3Enabled && !isHnsEnabled {
return fmt.Errorf("`nfsv3_enabled` can only be used when `is_hns_enabled` is `true`")
} | remove invalid storage account restriction (#<I>) | terraform-providers_terraform-provider-azurerm | train | go |
8a033fc1cb93042793e9b169de1396aaa4cecdf7 | diff --git a/glue/ligolw/table.py b/glue/ligolw/table.py
index <HASH>..<HASH> 100644
--- a/glue/ligolw/table.py
+++ b/glue/ligolw/table.py
@@ -423,8 +423,6 @@ class TableStream(ligolw.Stream):
parent element, and knows how to turn the parent's rows back into a
character stream.
"""
- __slots__ = ["__tokenizer", "__colnames", "__numcols", "__row", "__colindex"]
-
def __init__(self, attrs):
ligolw.Stream.__init__(self, attrs)
self.__tokenizer = tokenizer.Tokenizer(self.getAttribute("Delimiter")) | The __slots__ thing isn't doing anything for the TableStream element, so get
rid of it (it was never working, or how else could an instance have a
parentNode attribute?). | gwastro_pycbc-glue | train | py |
18ae10eef196e0806f08c68e47238d415b8e3596 | diff --git a/packages/ember-glimmer/lib/helpers/action.js b/packages/ember-glimmer/lib/helpers/action.js
index <HASH>..<HASH> 100644
--- a/packages/ember-glimmer/lib/helpers/action.js
+++ b/packages/ember-glimmer/lib/helpers/action.js
@@ -205,8 +205,8 @@ export const ACTION = symbol('ACTION');
If you need the default handler to trigger you should either register your
own event handler, or use event methods on your view class. See
- ["Responding to Browser Events"](/api/classes/Ember.View.html#toc_responding-to-browser-events)
- in the documentation for Ember.View for more information.
+ ["Responding to Browser Events"](/api/classes/Ember.Component#responding-to-browser-events)
+ in the documentation for Ember.Component for more information.
### Specifying DOM event type
@@ -220,7 +220,7 @@ export const ACTION = symbol('ACTION');
</div>
```
- See ["Event Names"](/api/classes/Ember.View.html#toc_event-names) for a list of
+ See ["Event Names"](/api/classes/Ember.Component#event-names) for a list of
acceptable DOM event names.
### Specifying whitelisted modifier keys | [DOC release] Fix links in {{action}} helper documentation
Documentation in the `{{action}}` helper still referred to Ember.View
documentation.
Fixes #<I> | emberjs_ember.js | train | js |
ce88f1fbaa2a68d5852d13203205cd51f79787b2 | diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -16,7 +16,7 @@ classifiers = ["License :: OSI Approved :: Apache Software License",
"Topic :: Software Development :: Testing",
"Operating System :: Microsoft :: Windows",
"Operating System :: MacOS :: MacOS X"] + \
- [("Programming Language :: Python :: %s" % x) for x in "3.5 3.6 3.7".split()]
+ [("Programming Language :: Python :: %s" % x) for x in "3.6 3.7 3.8 3.9".split()]
def make_cmdline_entry_points():
@@ -47,7 +47,7 @@ def main():
classifiers=classifiers,
packages=["ptest"],
package_data={"ptest": ["htmltemplate/*.*"]},
- python_requires=">=3.5",
+ python_requires=">=3.6",
zip_safe=False,
) | do not support python <I> | KarlGong_ptest | train | py |
fe9047d51b26df35a314190813ce24c7bc11f74d | diff --git a/registry/registry.go b/registry/registry.go
index <HASH>..<HASH> 100644
--- a/registry/registry.go
+++ b/registry/registry.go
@@ -132,7 +132,8 @@ func (c *client) GetRepository(repository string) (_ []flux.ImageDescription, er
Transport: roundtripperFunc(func(r *http.Request) (*http.Response, error) {
return transport.RoundTrip(r.WithContext(ctx))
}),
- Jar: jar,
+ Jar: jar,
+ Timeout: 10 * time.Second,
},
Logf: dockerregistry.Quiet,
} | Add a client timeout to all registry requests | weaveworks_flux | train | go |
ade6dbaa9bc52265962762fbaf17b0b9c690fa9d | diff --git a/lib/songkickr/remote_api/upcoming_events.rb b/lib/songkickr/remote_api/upcoming_events.rb
index <HASH>..<HASH> 100644
--- a/lib/songkickr/remote_api/upcoming_events.rb
+++ b/lib/songkickr/remote_api/upcoming_events.rb
@@ -86,8 +86,8 @@ module Songkickr
#
# ==== Query Parameters
# * +name+ - Metro area or city named 'location_name' string <em>Ex. 'Minneapolis', 'Nashville', or 'London'</em>.
- # * +location+ - 'geo:{lat,lng}' string <em>Ex. 'geo:{-0.128,51.5078}'</em>
- # * +ip+ - 'ip:{ip-addr}' string <em>Ex. 'ip:{123.123.123.123}'</em>
+ # * +location+ - 'geo:lat,lng' string <em>Ex. 'geo:-0.128,51.5078'</em>
+ # * +ip+ - 'ip:ip-addr' string <em>Ex. 'ip:123.123.123.123'</em>
# * +page+ - Page number
# * +per_page+ - Number of results per page, max 50.
def location_search(query = {}) | Update location search example docs
The examples in the docs for location_search show queries surrounded with braces, but those queries throw an APIError
APIError: Bad request. Please check the documentation: parameter 'location' must be one of the forms: 'geo:-<I>,<I>', 'clientip' or 'ip:<I>'
This just updates the documentation. | jrmehle_songkickr | train | rb |
7481ae45207bddb2f47be3beeb951a34e10e862a | diff --git a/lib/hooks.rb b/lib/hooks.rb
index <HASH>..<HASH> 100644
--- a/lib/hooks.rb
+++ b/lib/hooks.rb
@@ -77,11 +77,18 @@ module Hooks
end
def define_hook_writer(name)
- instance_eval <<-RUBY_EVAL, __FILE__, __LINE__ + 1
+ instance_eval *hook_writer_args(name)
+ end
+
+ def hook_writer_args(name)
+ # DISCUSS: isn't there a simpler way to define a dynamic method? should the internal logic be handled by HooksSet instead?
+ str = <<-RUBY_EVAL
def #{name}(method=nil, &block)
_hooks[:#{name}] << (block || method)
end
RUBY_EVAL
+
+ [str, __FILE__, __LINE__ + 1]
end
def extract_options!(args) | move the dynamic writer method code to ::hook_writer_args. | apotonick_hooks | train | rb |
545a0d04d08b5a166b5bc5be9c1ac6d38cb792e1 | diff --git a/test/index.js b/test/index.js
index <HASH>..<HASH> 100644
--- a/test/index.js
+++ b/test/index.js
@@ -2,7 +2,7 @@
const os = require('os')
const assert = require('chai').assert
-const uuid = require('uuid/v4')
+const uuid = require('uuid').v4
const index = require('./../src/index')
const fsify = require('fsify')({ | Remove deep requiring of uuid | electerious_require-data | train | js |
3ab11970d80f86e19576526fd52da32b77f5878b | diff --git a/test/e2e/load.go b/test/e2e/load.go
index <HASH>..<HASH> 100644
--- a/test/e2e/load.go
+++ b/test/e2e/load.go
@@ -77,11 +77,12 @@ var _ = Describe("Load capacity", func() {
AfterEach(func() {
deleteAllRC(configs)
- framework.afterEach()
// Verify latency metrics
highLatencyRequests, err := HighLatencyRequests(c, 3*time.Second, sets.NewString("events"))
expectNoError(err, "Too many instances metrics above the threshold")
Expect(highLatencyRequests).NotTo(BeNumerically(">", 0))
+
+ framework.afterEach()
})
type Load struct { | Properly use framework in load test | kubernetes_kubernetes | train | go |
c4079216440af73c03343f53a6a4734688c87b60 | diff --git a/pkg/markup/orgmode.go b/pkg/markup/orgmode.go
index <HASH>..<HASH> 100644
--- a/pkg/markup/orgmode.go
+++ b/pkg/markup/orgmode.go
@@ -8,6 +8,8 @@ import (
"path/filepath"
"strings"
+ log "gopkg.in/clog.v1"
+
"github.com/chaseadamsio/goorgeous"
)
@@ -25,7 +27,14 @@ func IsOrgModeFile(name string) bool {
}
// RawOrgMode renders content in Org-mode syntax to HTML without handling special links.
-func RawOrgMode(body []byte, urlPrefix string) []byte {
+func RawOrgMode(body []byte, urlPrefix string) (result []byte) {
+ // TODO: remove recover code once the third-party package is stable
+ defer func() {
+ if err := recover(); err != nil {
+ result = body
+ log.Warn("PANIC (RawOrgMode): %v", err)
+ }
+ }()
return goorgeous.OrgCommon(body)
} | orgmode: recover panic from third-party package | gogs_gogs | train | go |
300649e2d91d497ed462dbf01c275989bca98075 | diff --git a/migrations/m141222_110026_update_ip_field.php b/migrations/m141222_110026_update_ip_field.php
index <HASH>..<HASH> 100644
--- a/migrations/m141222_110026_update_ip_field.php
+++ b/migrations/m141222_110026_update_ip_field.php
@@ -39,8 +39,22 @@ class m141222_110026_update_ip_field extends Migration
public function down()
{
- echo "m141222_110026_update_ip_field cannot be reverted.\n";
+ $users = (new Query())->from('{{%user}}')->select('id, registration_ip ip')->all();
- return false;
+ $transaction = Yii::$app->db->beginTransaction();
+ try {
+ foreach ($users as $user) {
+ if ($user['ip'] == null)
+ continue;
+ Yii::$app->db->createCommand()->update('{{%user}}', [
+ 'registration_ip' => ip2long($user['ip'])
+ ], 'id = ' . $user['id'])->execute();
+ }
+ $this->alterColumn('{{%user}}', 'registration_ip', Schema::TYPE_BIGINT);
+ $transaction->commit();
+ } catch (Exception $e) {
+ $transaction->rollBack();
+ throw $e;
+ }
}
} | migrations/update_ip_field::down()
I manage all the migrations in my application automatically, including extensions' migrations.
A migration should be revertible.
I created the down function for this migration. | dektrium_yii2-user | train | php |
598ce1e3540ff86827ed2633af0424a30b97aef1 | diff --git a/cmd/erasure-server-pool.go b/cmd/erasure-server-pool.go
index <HASH>..<HASH> 100644
--- a/cmd/erasure-server-pool.go
+++ b/cmd/erasure-server-pool.go
@@ -27,6 +27,7 @@ import (
"net/http"
"sort"
"strconv"
+ "strings"
"sync"
"time"
@@ -1723,14 +1724,16 @@ func (z *erasureServerPools) Walk(ctx context.Context, bucket, prefix string, re
}
path := baseDirFromPrefix(prefix)
- if path == "" {
- path = prefix
+ filterPrefix := strings.Trim(strings.TrimPrefix(prefix, path), slashSeparator)
+ if path == prefix {
+ filterPrefix = ""
}
lopts := listPathRawOptions{
disks: disks,
bucket: bucket,
path: path,
+ filterPrefix: filterPrefix,
recursive: true,
forwardTo: "",
minDisks: 1,
@@ -1783,14 +1786,16 @@ func listAndHeal(ctx context.Context, bucket, prefix string, set *erasureObjects
}
path := baseDirFromPrefix(prefix)
- if path == "" {
- path = prefix
+ filterPrefix := strings.Trim(strings.TrimPrefix(prefix, path), slashSeparator)
+ if path == prefix {
+ filterPrefix = ""
}
lopts := listPathRawOptions{
disks: disks,
bucket: bucket,
path: path,
+ filterPrefix: filterPrefix,
recursive: true,
forwardTo: "",
minDisks: 1, | supply prefix filtering when necessary (#<I>)
currently filterPefix was never used and set
that would filter out entries when needed
when `prefix` doesn't end with `/` - this
often leads to objects getting Walked(), Healed()
that were never requested by the caller. | minio_minio | train | go |
a8161e1a2e731fcb59271d213dbd249a9d89d105 | diff --git a/tasks/cucumber.js b/tasks/cucumber.js
index <HASH>..<HASH> 100644
--- a/tasks/cucumber.js
+++ b/tasks/cucumber.js
@@ -86,6 +86,7 @@ module.exports = function(grunt) {
cucumber = spawn(binPath, commands);
cucumber.stdout.on('data', function(data) {
+ process.stdout.write(data);
if (options.format === 'html') {
buffer.push(data);
} else {
@@ -94,6 +95,7 @@ module.exports = function(grunt) {
});
cucumber.stderr.on('data', function (data) {
+ process.stdout.write(data);
var stderr = new Buffer(data);
grunt.log.error(stderr.toString());
}); | Added changes so that grunt cucumber.js can output live
Added `process.stdout.write` so that grunt cucumberjs can output live on whats happening. This is great when you are debugging a test, you don't need to wait to look at console output until after test execution is complete | mavdi_grunt-cucumberjs | train | js |
c79b62f86945f32266e936c5a6179e2d05c7daa9 | diff --git a/api/server.js b/api/server.js
index <HASH>..<HASH> 100644
--- a/api/server.js
+++ b/api/server.js
@@ -17,10 +17,27 @@ if (cluster.isMaster) {
}
cluster.on('death', function(worker) {
- console.log('worker ' + worker.pid + ' died, restarting.');
- // restart worker
- cluster.fork();
+ if(!worker.suicide) {
+ console.log('worker ' + worker.pid + ' died, restarting.');
+ // restart worker
+ cluster.fork();
+ }
});
+ process.on('SIGTERM', function() {
+ console.log('master shutting down, killing workers');
+ for(var i = 0; i < workers.length; i++) {
+ console.log('Killing worker ' + i + ' with PID ' + workers[i].pid);
+ // disconnect() doesn't work for some reason
+ //workers[i].disconnect();
+ workers[i].kill('SIGTERM');
+ }
+ console.log('Done killing workers, bye');
+ process.exit(1);
+ } );
} else {
+ process.on('SIGTERM', function() {
+ console.log('Worker shutting down');
+ process.exit(1);
+ });
app.listen(8000);
} | When the main server process is killed, kill the children too
Change-Id: If<I>a8c<I>d5c1d4ac<I>fe8cd<I>ef<I>c<I> | wikimedia_parsoid | train | js |
21ad7a743de095343bc425da1829943d5ed431fb | diff --git a/zxbpp.py b/zxbpp.py
index <HASH>..<HASH> 100755
--- a/zxbpp.py
+++ b/zxbpp.py
@@ -198,7 +198,7 @@ def p_token(p):
def p_include_file(p):
''' include_file : include NEWLINE program _ENDFILE_
'''
- p[0] = [p[1]] + p[3] + [p[4]]
+ p[0] = [p[1] + p[2]] + p[3] + [p[4]]
CURRENT_FILE.pop() # Remove top of the stack | Fixed a bug in file include which was removing the 1st newline. | boriel_zxbasic | train | py |
de17fcd6f60ec18462761e453c1fce2a282e9693 | diff --git a/cmd/influxd/run/server.go b/cmd/influxd/run/server.go
index <HASH>..<HASH> 100644
--- a/cmd/influxd/run/server.go
+++ b/cmd/influxd/run/server.go
@@ -346,7 +346,7 @@ func (s *Server) startServerReporting() {
func (s *Server) reportServer() {
dis, err := s.MetaStore.Databases()
if err != nil {
- log.Printf("failed to retrieve databases for reporting: %s", err.Error)
+ log.Printf("failed to retrieve databases for reporting: %s", err.Error())
return
}
numDatabases := len(dis)
@@ -366,7 +366,7 @@ func (s *Server) reportServer() {
clusterID, err := s.MetaStore.ClusterID()
if err != nil {
- log.Printf("failed to retrieve cluster ID for reporting: %s", err.Error)
+ log.Printf("failed to retrieve cluster ID for reporting: %s", err.Error())
return
} | missing parens to call func | influxdata_influxdb | train | go |
9e212cf23df0df7a6ef22a9fc4a6537d1f0638de | diff --git a/tools/visualizations/next-century/neon/charts/src/main/javascript/timeline.js b/tools/visualizations/next-century/neon/charts/src/main/javascript/timeline.js
index <HASH>..<HASH> 100644
--- a/tools/visualizations/next-century/neon/charts/src/main/javascript/timeline.js
+++ b/tools/visualizations/next-century/neon/charts/src/main/javascript/timeline.js
@@ -221,7 +221,6 @@ charts.Timeline.prototype.createSlider_ = function () {
$('#' + charts.Timeline.SLIDER_DIV_NAME_).width(me.plotWidth_).css({
'margin-left': me.margin.left + 'px',
'margin-right': me.margin.right + 'px',
- 'top': $(me.chartSelector_).position().top + $(me.chartSelector_).innerHeight() - this.margin.bottom
});
if (me.data_.length === 0) {
$('#' + charts.Timeline.SLIDER_DIV_NAME_).slider('disable'); | accidentally committed code to move timeline that was from an experimental branch | NextCenturyCorporation_neon | train | js |
572de3670c6038bb1d15ec72e7cba982d988b717 | diff --git a/plugin/PhpVersion/Php53.php b/plugin/PhpVersion/Php53.php
index <HASH>..<HASH> 100644
--- a/plugin/PhpVersion/Php53.php
+++ b/plugin/PhpVersion/Php53.php
@@ -84,6 +84,7 @@ class Php53 implements PhpVersion, MemoryLimit, PostLimit, UploadFileLimit, Defa
*/
$phpFpmService->addLinksFrom($mainService);
+ $mainService->addLink($phpFpmService, 'phpfpm');
$mainService->addSidekick($phpFpmService);
$mainService->addVolumeFrom($phpFpmService);
$infrastructure->addService($phpFpmService); | added link from master service to fpm | ipunkt_rancherize-php53 | train | php |
2a2de66304460481e95e5575aa35019e52650b83 | diff --git a/src/parser/Scanner.js b/src/parser/Scanner.js
index <HASH>..<HASH> 100644
--- a/src/parser/Scanner.js
+++ b/src/parser/Scanner.js
@@ -16,19 +16,18 @@ function Scanner(source) {
this.get = function get() {
_currentIndex += 1;
-
+
+ if (_currentIndex > _lastIndex) {
+ _currentIndex = _lastIndex + 1;
+ return _makeChar(null);
+ }
if (_currentIndex > 0 && _source[_currentIndex - 1] === '\n') {
_line += 1;
_col = -1;
}
_col += 1;
- let char = null;
- if (_currentIndex <= _lastIndex) {
- char = _source[_currentIndex];
- }
-
- return _makeChar(char);
+ return _makeChar(_source[_currentIndex]);
};
this.lookahead = function lookahead() { | update Scanner.get to handle end of file properly | lps-js_lps.js | train | js |
f8d34d6c2ff52c87ee1fc2972c0145d5180aab1e | diff --git a/src/processor/intents/spawns/_charge-energy.js b/src/processor/intents/spawns/_charge-energy.js
index <HASH>..<HASH> 100644
--- a/src/processor/intents/spawns/_charge-energy.js
+++ b/src/processor/intents/spawns/_charge-energy.js
@@ -15,7 +15,7 @@ module.exports = function(spawn, roomObjects, cost, bulk, roomController) {
return false;
}
- extensions.sort(utils.comparatorDistance(spawn));
+ spawns.sort(utils.comparatorDistance(spawn));
spawns.forEach((i) => {
var neededEnergy = Math.min(cost, i.energy);
@@ -23,7 +23,13 @@ module.exports = function(spawn, roomObjects, cost, bulk, roomController) {
cost -= neededEnergy;
bulk.update(i, {energy: i.energy});
});
+
+ if(cost <= 0) {
+ return true;
+ }
+ extensions.sort(utils.comparatorDistance(spawn));
+
extensions.forEach((extension) => {
if(cost <= 0) {
return;
@@ -35,4 +41,4 @@ module.exports = function(spawn, roomObjects, cost, bulk, roomController) {
});
return true;
-};
\ No newline at end of file
+}; | Fixed order of energy charged for spawns. (#<I>)
* Fixed order of energy charged for spawns.
* Update _charge-energy.js
Fixed whitespace mess.
* Update _charge-energy.js
Added return true.
Added extra whitespace after extension sorting. | screeps_engine | train | js |
47c9c8f5dd6a03b32df135df4634adeb7a38e1ca | diff --git a/mod/forum/lib.php b/mod/forum/lib.php
index <HASH>..<HASH> 100644
--- a/mod/forum/lib.php
+++ b/mod/forum/lib.php
@@ -1948,7 +1948,7 @@ function forum_print_post(&$post, $courseid, $ownpost=false, $reply=false, $link
echo '<td class="topic starter">';
}
- echo '<div class="subject">'.$post->subject.'</div>';
+ echo '<div class="subject">'.format_string($post->subject).'</div>';
echo '<div class="author">';
$fullname = fullname($post, has_capability('moodle/site:viewfullnames', $modcontext)); | Added one missing format_string() to post->subject
Merged from MOODLE_<I>_STABLE | moodle_moodle | train | php |
19b4ad57890cf81d12a9a06d54370630927693a2 | diff --git a/src/cf/commands/application/helpers.go b/src/cf/commands/application/helpers.go
index <HASH>..<HASH> 100644
--- a/src/cf/commands/application/helpers.go
+++ b/src/cf/commands/application/helpers.go
@@ -39,7 +39,7 @@ func extractLogHeader(msg *logmessage.Message) (logHeader, coloredLogHeader stri
}
// Calculate padding
- longestHeader := fmt.Sprintf("%s [Executor] ", timeFormat)
+ longestHeader := fmt.Sprintf("%s [API] ", timeFormat)
expectedHeaderLength := len(longestHeader)
padding := strings.Repeat(" ", expectedHeaderLength-len(logHeader)) | Adjust spacing around loggregator jobs
[#<I>] | cloudfoundry_cli | train | go |
2bd25877ce5d79a4c3936fc165bc3c079dcddb29 | diff --git a/h2o-core/src/main/java/water/parser/CsvParser.java b/h2o-core/src/main/java/water/parser/CsvParser.java
index <HASH>..<HASH> 100644
--- a/h2o-core/src/main/java/water/parser/CsvParser.java
+++ b/h2o-core/src/main/java/water/parser/CsvParser.java
@@ -716,6 +716,10 @@ MAIN_LOOP:
// now guess the types
if (columnTypes == null || ncols != columnTypes.length) {
+ int i = bits.length-1;
+ for(; i > 0; --i)
+ if(bits[i] == '\n') break;
+ if(i > 0) bits = Arrays.copyOf(bits,i); // stop at the last full line
InputStream is = new ByteArrayInputStream(bits);
CsvParser p = new CsvParser(resSetup, null);
PreviewParseWriter dout = new PreviewParseWriter(resSetup._number_columns); | Fixed guess parse setup to stop at the last full line. | h2oai_h2o-3 | train | java |
b0c5a86addf7eb0dbf84a5469380576e155eb151 | diff --git a/core/src/main/java/hudson/model/AbstractProject.java b/core/src/main/java/hudson/model/AbstractProject.java
index <HASH>..<HASH> 100644
--- a/core/src/main/java/hudson/model/AbstractProject.java
+++ b/core/src/main/java/hudson/model/AbstractProject.java
@@ -1198,7 +1198,12 @@ public abstract class AbstractProject<P extends AbstractProject<P,R>,R extends A
return true; // no SCM
FilePath workspace = build.getWorkspace();
- workspace.mkdirs();
+ if(workspace!=null){
+ workspace.mkdirs();
+ } else {
+ throw new AbortException("Cannot checkout SCM, workspace is not defined");
+ }
+
boolean r = scm.checkout(build, launcher, workspace, listener, changelogFile);
if (r) { | [JENKINS-<I>] - Prevent NPE in AbstractProject.checkout when agent disconnects during the build (#<I>)
[JENKINS-<I>] - Prevent NPE in AbstractProject.checkout when agent disconnects during the build | jenkinsci_jenkins | train | java |
34e144bafa0af123a088843d1e9668f011aa3fca | diff --git a/src/index.js b/src/index.js
index <HASH>..<HASH> 100644
--- a/src/index.js
+++ b/src/index.js
@@ -1,12 +1,10 @@
// main component
export AutoForm from './AutoForm.js';
-
-//TODO JS: add redux-autoform-utils import
// component factories
export ComponentFactory from 'redux-autoform-utils/lib/factory/ComponentFactory';
-export DefaultEditComponentFactory from './factory/bootstrap/BootstrapEditComponentFactory';
-export DefaultDetailsComponentFactory from './factory/bootstrap/BootstrapDetailsComponentFactory';
+// export DefaultEditComponentFactory from './factory/bootstrap/BootstrapEditComponentFactory';
+// export DefaultDetailsComponentFactory from './factory/bootstrap/BootstrapDetailsComponentFactory';
//localizers
export momentLocalizer from 'redux-autoform-utils/lib/localization/momentLocalizer'; | Default factories will not be exposed anymore by the index.js since they will get it's own packages. | redux-autoform_redux-autoform | train | js |
f06f90c5b2b1fa43b3b52b81e19e7f59f839f479 | diff --git a/lib/detect-dependencies.js b/lib/detect-dependencies.js
index <HASH>..<HASH> 100644
--- a/lib/detect-dependencies.js
+++ b/lib/detect-dependencies.js
@@ -140,7 +140,7 @@ function gatherInfo(config) {
var componentConfigFile = findComponentConfigFile(config, component);
if (!componentConfigFile) {
- var error = new Error(component + ' is not installed. Try running `bower install`.');
+ var error = new Error(component + ' is not installed. Try running `bower install` or remove the component from your bower.json file.');
error.code = 'PKG_NOT_INSTALLED';
config.get('on-error')(error);
return;
diff --git a/test/wiredup_test.js b/test/wiredup_test.js
index <HASH>..<HASH> 100644
--- a/test/wiredup_test.js
+++ b/test/wiredup_test.js
@@ -356,7 +356,7 @@ describe('wiredep', function () {
src: filePath,
onError: function(err) {
assert.ok(err instanceof Error);
- assert.equal(err.message, missingComponent + ' is not installed. Try running `bower install`.');
+ assert.equal(err.message, missingComponent + ' is not installed. Try running `bower install` or remove the component from your bower.json file.');
done();
}
}); | more helpful missing component error message - in case you uninstalled a component without --save | taptapship_wiredep | train | js,js |
5b1503e20b838a584dc2c89dac57afe79176dcc3 | diff --git a/src/main/java/org/jboss/pressgang/ccms/utils/common/DocBookUtilities.java b/src/main/java/org/jboss/pressgang/ccms/utils/common/DocBookUtilities.java
index <HASH>..<HASH> 100644
--- a/src/main/java/org/jboss/pressgang/ccms/utils/common/DocBookUtilities.java
+++ b/src/main/java/org/jboss/pressgang/ccms/utils/common/DocBookUtilities.java
@@ -2539,6 +2539,10 @@ public class DocBookUtilities {
return "<xref linkend=\"" + xref + "\" xrefstyle=\"" + xrefStyle + "\" />";
}
+ public static String buildLink(final String xref, final String style, final String value) {
+ return "<link linkend=\"" + xref + "\" xrefstyle=\"" + style + "\">" + value + "</link>";
+ }
+
public static List<Element> buildULink(final Document xmlDoc, final String url, final String label) {
final List<Element> retValue = new ArrayList<Element>(); | Added a helper method for create link elements. | pressgang-ccms_PressGangCCMSCommonUtilities | train | java |
21475cf64dfd5b6a4b9414ffe07fbd53c0ab9f6e | diff --git a/demo/load.js b/demo/load.js
index <HASH>..<HASH> 100644
--- a/demo/load.js
+++ b/demo/load.js
@@ -27,8 +27,8 @@
* mode during development.
*/
(function() { // anonymous namespace
- // The URL of the page itself, without URL fragments.
- var pageUrl = location.href.split('#')[0];
+ // The URL of the page itself, without URL fragments or search strings.
+ var pageUrl = location.href.split('#')[0].split('?')[0];
// The URL of the page, up to and including the final '/'.
var baseUrl = pageUrl.split('/').slice(0, -1).join('/') + '/'; | Fixed urls with query strings.
In a previous change, urls with query strings were broken such that
if one contained a /, it caused the demo page to fail to load.
Therefore, legacy custom URLs from before we added URL fragments which
contain asset or license URIs stopped working.
This change accounts for that.
Fixes: <I>
Change-Id: I9e<I>a<I>fc7a<I>e<I>dd4bec<I>a2fd0a<I> | google_shaka-player | train | js |
ea61387a7a06d1f2ff0d6ca916a5c95519d128f4 | diff --git a/brikar-server/src/main/java/com/truward/brikar/server/launcher/StandardLauncher.java b/brikar-server/src/main/java/com/truward/brikar/server/launcher/StandardLauncher.java
index <HASH>..<HASH> 100644
--- a/brikar-server/src/main/java/com/truward/brikar/server/launcher/StandardLauncher.java
+++ b/brikar-server/src/main/java/com/truward/brikar/server/launcher/StandardLauncher.java
@@ -27,6 +27,9 @@ public class StandardLauncher {
private String defaultDirPrefix;
public StandardLauncher(@Nonnull String defaultDirPrefix) {
+ // Loggers need to be configured as soon as possible, otherwise jetty will use its own default logger
+ configureLoggers();
+
setDefaultDirPrefix(defaultDirPrefix);
}
@@ -35,8 +38,6 @@ public class StandardLauncher {
}
public final void start(@Nonnull String[] args) throws Exception {
- configureLoggers();
-
final StandardArgParser argParser = new StandardArgParser(args, defaultDirPrefix + "default.properties");
final int result = argParser.parse();
if (result != 0) { | Configuring loggers in the class constructor instead of launcher's start method | truward_brikar | train | java |
ae36b2a7278741176fc9777ad32aeabb7c151090 | diff --git a/src/main/java/com/googlecode/lanterna/terminal/virtual/DefaultVirtualTerminal.java b/src/main/java/com/googlecode/lanterna/terminal/virtual/DefaultVirtualTerminal.java
index <HASH>..<HASH> 100644
--- a/src/main/java/com/googlecode/lanterna/terminal/virtual/DefaultVirtualTerminal.java
+++ b/src/main/java/com/googlecode/lanterna/terminal/virtual/DefaultVirtualTerminal.java
@@ -174,7 +174,7 @@ public class DefaultVirtualTerminal extends AbstractTerminal implements VirtualT
@Override
public synchronized void putString(String string) {
- for (TextCharacter textCharacter: TextCharacter.fromString(string)) {
+ for (TextCharacter textCharacter: TextCharacter.fromString(string, activeForegroundColor, activeBackgroundColor, activeModifiers)) {
putCharacter(textCharacter);
}
} | Issue #<I>: Fixing SwingTerminal color regression | mabe02_lanterna | train | java |
9bcb39538792834f316dab01b780e429abb89f02 | diff --git a/code/Model/RedirectorPage.php b/code/Model/RedirectorPage.php
index <HASH>..<HASH> 100644
--- a/code/Model/RedirectorPage.php
+++ b/code/Model/RedirectorPage.php
@@ -136,7 +136,7 @@ class RedirectorPage extends Page
}
}
- public function onBeforeWrite()
+ protected function onBeforeWrite()
{
parent::onBeforeWrite(); | Changing to protected to match the rest of the changes | silverstripe_silverstripe-cms | train | php |
8826e526cca16d6bd8f38e5912482ba4b050738c | diff --git a/mesh_tensorflow/transformer/utils.py b/mesh_tensorflow/transformer/utils.py
index <HASH>..<HASH> 100644
--- a/mesh_tensorflow/transformer/utils.py
+++ b/mesh_tensorflow/transformer/utils.py
@@ -422,7 +422,8 @@ def tpu_estimator_model_fn(model_type,
# Verify that the right features exist, and transform them if necessary
if mode == tf.estimator.ModeKeys.PREDICT:
_verify_feature_exists("inputs", True)
- _verify_feature_exists("targets", False)
+ # "targets" may or may not exist depending on whether we are doing
+ # evaluation or open-ended inference.
else:
_verify_feature_exists("targets", True)
_verify_feature_exists("inputs", model_type != "lm") | fix a bug - targets may be present when evaluating in inference mode
PiperOrigin-RevId: <I> | tensorflow_mesh | train | py |
7a54dc390843b3d501c2e4a69fbd8a7ca23a9930 | diff --git a/php/WporgClient.php b/php/WporgClient.php
index <HASH>..<HASH> 100644
--- a/php/WporgClient.php
+++ b/php/WporgClient.php
@@ -24,6 +24,11 @@ class WporgClient extends GuzzleClient
return new self($client, $description, $config);
}
+ public static function toObject(array $array)
+ {
+ return (object) $array;
+ }
+
public function getSalt()
{
$command = $this->getCommand('getSalt');
diff --git a/php/WporgService.php b/php/WporgService.php
index <HASH>..<HASH> 100644
--- a/php/WporgService.php
+++ b/php/WporgService.php
@@ -138,7 +138,7 @@ class WporgService
'location' => 'postField',
'type' => 'array',
'filters' => [
- 'stdClass::__set_state',
+ 'Rarst\\Guzzle\\WporgClient::toObject',
'serialize',
],
], | Reverted object casting to the method. | Rarst_wporg-client | train | php,php |
869f77b8d5a59f016cf62c84cc80192e45ed21d9 | diff --git a/src/i18n-module.php b/src/i18n-module.php
index <HASH>..<HASH> 100644
--- a/src/i18n-module.php
+++ b/src/i18n-module.php
@@ -270,7 +270,7 @@ class Yoast_I18n_v3 {
echo '<div>';
echo '<h2>' . sprintf( __( 'Translation of %s', $this->textdomain ), $this->plugin_name ) . '</h2>';
- if ( isset( $this->glotpress_logo ) && '' != $this->glotpress_logo ) {
+ if ( isset( $this->glotpress_logo ) && is_string( $this->glotpress_logo ) && '' !== $this->glotpress_logo ) {
echo '<a href="' . esc_url( $this->register_url ) . '"><img class="alignright" style="margin:0 5px 5px 5px;max-width:200px;" src="' . esc_url( $this->glotpress_logo ) . '" alt="' . esc_attr( $this->glotpress_name ) . '"/></a>';
}
echo $message; | CS/QA: replace a loose comparison
Reasoning:
* Initially the property is `null` (not set).
* The property may get initialized by it being passed in via `$args`. In that case, it is expected to be a `string`, but there is no type check anywhere, so it could be something else.
Having said that, changing this to a strict comparison could still create a passing condition, unless we also add an `is_string()` as well. | Yoast_i18n-module | train | php |
062ca0592712cc557c0ed3488f768a5824b02458 | diff --git a/lib/store_configurable/object.rb b/lib/store_configurable/object.rb
index <HASH>..<HASH> 100644
--- a/lib/store_configurable/object.rb
+++ b/lib/store_configurable/object.rb
@@ -1,8 +1,4 @@
-begin
- require 'active_support/basic_object'
-rescue LoadError
- require 'active_support/proxy_object'
-end
+require 'active_support/proxy_object'
module StoreConfigurable | In Rails <I> and up, there is only the ProxyObject. | metaskills_store_configurable | train | rb |
8ca59435d4e2827171d3428db821da6e70111139 | diff --git a/examples/books-AMD/app/views.js b/examples/books-AMD/app/views.js
index <HASH>..<HASH> 100644
--- a/examples/books-AMD/app/views.js
+++ b/examples/books-AMD/app/views.js
@@ -37,4 +37,4 @@ define(["underscore", "backbone"], function (_, Backbone) {
};
return views;
-});
\ No newline at end of file
+}); | Insert missing line break at end-of-file | biril_backbone-faux-server | train | js |
049183e00cae8abf4ed94a0cf09d2418b2c038a6 | diff --git a/ok.views.js b/ok.views.js
index <HASH>..<HASH> 100644
--- a/ok.views.js
+++ b/ok.views.js
@@ -4,8 +4,6 @@
ok.View = ok.Base.extend({
el: null,
- ownerDocument: null,
- nodeType: 1,
tagName: 'div',
constructor: function (options) {
options = options || {};
@@ -33,7 +31,6 @@ ok.View = ok.Base.extend({
},
setElement: function (el) {
this.el = el;
- this.ownerDocument = el.ownerDocument;
},
createElement: function () {
var el = document.createElement(this.tagName); | Remove `ownerDocument` property from view | j-_ok | train | js |
1a0eebe7564b0dd360dd36d9809cf8613b6658cd | diff --git a/src/sap.ui.rta/test/sap/ui/rta/internal/testdata/rta/GroupElementTest.flexibility.js b/src/sap.ui.rta/test/sap/ui/rta/internal/testdata/rta/GroupElementTest.flexibility.js
index <HASH>..<HASH> 100644
--- a/src/sap.ui.rta/test/sap/ui/rta/internal/testdata/rta/GroupElementTest.flexibility.js
+++ b/src/sap.ui.rta/test/sap/ui/rta/internal/testdata/rta/GroupElementTest.flexibility.js
@@ -19,6 +19,9 @@ sap.ui.define([
},
completeChangeContent : function(oChange, mSpecificChangeInfo, mPropertyBag){
return RenameField.completeChangeContent(oChange, mSpecificChangeInfo, mPropertyBag);
+ },
+ revertChange : function(oChange, oControl, mPropertyBag) {
+ return RenameField.revertChange(oChange, oControl, mPropertyBag);
}
}
} | [INTERNAL] sap.ui.rta - Fixed specific change handler for test app
The control-specific change handler in the RTA test app was missing the
revertChange method.
Change-Id: Id<I>ddda1b<I>c6e9d<I>fbec1e<I>fa5 | SAP_openui5 | train | js |
21efa2a16d270fb3a8436f608094cbca4fcd8fb1 | diff --git a/classes/PodsInit.php b/classes/PodsInit.php
index <HASH>..<HASH> 100644
--- a/classes/PodsInit.php
+++ b/classes/PodsInit.php
@@ -243,8 +243,10 @@ class PodsInit {
define( 'TRIBE_HIDE_MARKETING_NOTICES', true );
}
- // Disable shortcode handling since we aren't using that.
+ // Disable shortcodes/customizer/widgets handling since we aren't using these.
add_filter( 'tribe_shortcodes_is_active', '__return_false' );
+ add_filter( 'tribe_customizer_is_active', '__return_false' );
+ add_filter( 'tribe_widgets_is_active', '__return_false' );
}
$GLOBALS['tribe-common-info'] = [ | Disable TC customizer/widget handling too | pods-framework_pods | train | php |
bf78c5425fdca4cf19df8049ee9da6ccf762f8aa | diff --git a/djstripe/models/billing.py b/djstripe/models/billing.py
index <HASH>..<HASH> 100644
--- a/djstripe/models/billing.py
+++ b/djstripe/models/billing.py
@@ -2096,6 +2096,11 @@ class TaxCode(StripeModel):
def __str__(self):
return f"{self.name}: {self.id}"
+ @classmethod
+ def _find_owner_account(cls, data, api_key=djstripe_settings.STRIPE_SECRET_KEY):
+ # Tax Codes do not belong to any Stripe Account
+ pass
+
class TaxId(StripeModel):
""" | Overode TaxCode._find_owner_account as they are independent of Stripe Accounts. | dj-stripe_dj-stripe | train | py |
bb2a2d81f73a33d55757f8c5937e26dabc07b087 | diff --git a/visidata/canvas.py b/visidata/canvas.py
index <HASH>..<HASH> 100644
--- a/visidata/canvas.py
+++ b/visidata/canvas.py
@@ -190,7 +190,9 @@ class Plotter(BaseSheet):
def getPixelAttrMost(self, x, y):
'most common attr at this pixel.'
r = self.pixels[y][x]
- c = [(len(rows), attr, rows) for attr, rows in list(r.items()) if attr and attr not in self.hiddenAttrs]
+ if not r:
+ return 0
+ c = [(len(rows), attr, rows) for attr, rows in r.items() if attr and attr not in self.hiddenAttrs]
if not c:
return 0
_, attr, rows = max(c) | [canvas perf] early out if no pixels | saulpw_visidata | train | py |
63540eeaca083cd4b44e22c735679dfb7c24237b | diff --git a/dryscrape/xvfb.py b/dryscrape/xvfb.py
index <HASH>..<HASH> 100644
--- a/dryscrape/xvfb.py
+++ b/dryscrape/xvfb.py
@@ -5,13 +5,13 @@ _xvfb = None
def start_xvfb():
- from xvfbwrapper import Xvfb
- global _xvfb
- _xvfb = Xvfb()
- _xvfb.start()
- atexit.register(_xvfb.stop)
+ from xvfbwrapper import Xvfb
+ global _xvfb
+ _xvfb = Xvfb()
+ _xvfb.start()
+ atexit.register(_xvfb.stop)
def stop_xvfb():
- global _xvfb
- _xvfb.stop()
+ global _xvfb
+ _xvfb.stop() | Two space indent size to be consistent | niklasb_dryscrape | train | py |
bdcaab0331fcb34e34941993023aff4cdc573b04 | diff --git a/widgets/ace/WhAceEditor.php b/widgets/ace/WhAceEditor.php
index <HASH>..<HASH> 100644
--- a/widgets/ace/WhAceEditor.php
+++ b/widgets/ace/WhAceEditor.php
@@ -106,7 +106,7 @@ class WhAceEditor extends CInputWidget
/* @var $cs CClientScript */
$cs = Yii::app()->getClientScript();
- $cs->registerScriptFile($assetsUrl . '/js/ace.js');
+ $cs->registerScriptFile($assetsUrl . '/js/ace.js', CClientScript::POS_END);
$id = TbHtml::getOption('id', $this->htmlOptions, $this->getId());
@@ -133,4 +133,4 @@ class WhAceEditor extends CInputWidget
$cs->registerScript(uniqid(__CLASS__ . '#ReadyJS' . $id, true), ob_get_clean());
}
-}
\ No newline at end of file
+} | Update WhAceEditor.php
Register script (.js) at END instead of TOP | 2amigos_yiiwheels | train | php |
27b0cda0547fb1da708d849153e23c22bc5e23d6 | diff --git a/forms/HtmlEditorField.php b/forms/HtmlEditorField.php
index <HASH>..<HASH> 100644
--- a/forms/HtmlEditorField.php
+++ b/forms/HtmlEditorField.php
@@ -429,14 +429,17 @@ class HtmlEditorField_Toolbar extends RequestHandler {
$tabSet = new TabSet(
"MediaFormInsertMediaTabs",
new Tab(
+ 'FromComputer',
_t('HtmlEditorField.FROMCOMPUTER','From your computer'),
$computerUploadField
),
new Tab(
+ 'FromWeb',
_t('HtmlEditorField.FROMWEB', 'From the web'),
$fromWeb
),
new Tab(
+ 'FromCms',
_t('HtmlEditorField.FROMCMS','From the CMS'),
$fromCMS
) | FIX Localized HtmlEditorField Tabs
Tabs can have only lattin characters in it's name | silverstripe_silverstripe-framework | train | php |
eba04185d4a023de98f92e61d03979ca5941dcff | diff --git a/lib/common/common.go b/lib/common/common.go
index <HASH>..<HASH> 100644
--- a/lib/common/common.go
+++ b/lib/common/common.go
@@ -336,8 +336,22 @@ func parseDockerUser(dockerUser string) (string, string) {
}
func subtractWhiteouts(pathWhitelist []string, whiteouts []string) []string {
- for _, whiteout := range whiteouts {
- idx := util.IndexOf(pathWhitelist, whiteout)
+ matchPaths := []string{}
+ for _, path := range pathWhitelist {
+ // If one of the parent dirs of the current path matches the
+ // whiteout then also this path should be removed
+ curPath := path
+ for curPath != "/" {
+ for _, whiteout := range whiteouts {
+ if curPath == whiteout {
+ matchPaths = append(matchPaths, path)
+ }
+ }
+ curPath = filepath.Dir(curPath)
+ }
+ }
+ for _, matchPath := range matchPaths {
+ idx := util.IndexOf(pathWhitelist, matchPath)
if idx != -1 {
pathWhitelist = append(pathWhitelist[:idx], pathWhitelist[idx+1:]...)
} | common: remove from pathWhiteList also files inside whited out directories.
If a directory is whited out, subtractWhiteouts should remove from
pathWhiteList also all the files inside it. | appc_docker2aci | train | go |
98bdbe7a767c7b8b1434aad46f735515e0283b3f | diff --git a/core/src/main/java/hudson/Util.java b/core/src/main/java/hudson/Util.java
index <HASH>..<HASH> 100644
--- a/core/src/main/java/hudson/Util.java
+++ b/core/src/main/java/hudson/Util.java
@@ -64,9 +64,11 @@ public class Util {
// identify the key
int end=idx+1;
while(end<s.length()) {
- char ch = s.charAt(end++);
+ char ch = s.charAt(end);
if(!Character.isJavaIdentifierPart(ch))
break;
+ else
+ end++;
}
String key = s.substring(idx+1,end);
String value = properties.get(key); | Fixed such that more interesting macro expressions, such as /$FOO/bar will work.
git-svn-id: <URL> | jenkinsci_jenkins | train | java |
fc4fd47deba61610f136b330b2c939f70f9dc5ed | diff --git a/pkg/services/accesscontrol/ossaccesscontrol/permissions_services.go b/pkg/services/accesscontrol/ossaccesscontrol/permissions_services.go
index <HASH>..<HASH> 100644
--- a/pkg/services/accesscontrol/ossaccesscontrol/permissions_services.go
+++ b/pkg/services/accesscontrol/ossaccesscontrol/permissions_services.go
@@ -289,8 +289,7 @@ func ProvideServiceAccountPermissions(
ServiceAccounts: false,
},
PermissionsToActions: map[string][]string{
- "View": {serviceaccounts.ActionRead},
- "Edit": {serviceaccounts.ActionRead, serviceaccounts.ActionWrite, serviceaccounts.ActionDelete},
+ "Edit": {serviceaccounts.ActionRead, serviceaccounts.ActionWrite},
"Admin": {serviceaccounts.ActionRead, serviceaccounts.ActionWrite, serviceaccounts.ActionDelete, serviceaccounts.ActionPermissionsRead, serviceaccounts.ActionPermissionsWrite},
},
ReaderRoleName: "Service account permission reader", | change managed permissions for service accounts (#<I>) | grafana_grafana | train | go |
c208dac9e4e3d8d0ccca8db2a58aae6195c586bd | diff --git a/ladybug/datacollection.py b/ladybug/datacollection.py
index <HASH>..<HASH> 100644
--- a/ladybug/datacollection.py
+++ b/ladybug/datacollection.py
@@ -400,8 +400,7 @@ class LBDataCollection(list):
DBT = epw.dryBulbTemperature
filteredDBT = DBT.filterByHOYs(HOYs)
"""
- _moys = tuple((int(hour) + int(round((hour - int(hour))) * 60))
- for hour in HOYs)
+ _moys = tuple(int(hour * 60) for hour in HOYs)
return self.filterByMOYs(_moys) | Fixed bug with filterByHOYs | ladybug-tools_ladybug | train | py |
3b2d0577462fec5985fdca75c524870b985de18c | diff --git a/lib/gir_ffi/in_pointer.rb b/lib/gir_ffi/in_pointer.rb
index <HASH>..<HASH> 100644
--- a/lib/gir_ffi/in_pointer.rb
+++ b/lib/gir_ffi/in_pointer.rb
@@ -16,7 +16,7 @@ module GirFFI
end
def self.from type, val
- ArgHelper.utf8_to_inptr val
+ self.new ArgHelper.utf8_to_inptr(val)
end
def self.from_utf8_array ary
diff --git a/test/unit/in_pointer_test.rb b/test/unit/in_pointer_test.rb
index <HASH>..<HASH> 100644
--- a/test/unit/in_pointer_test.rb
+++ b/test/unit/in_pointer_test.rb
@@ -53,6 +53,10 @@ describe GirFFI::InPointer do
ary = @result.read_array_of_pointer(3)
assert { @result.read_string == "foo" }
end
+
+ it "is an instance of GirFFI::InPointer" do
+ assert { @result.is_a? GirFFI::InPointer }
+ end
end
end | InPointer.from must return an InPointer. | mvz_gir_ffi | train | rb,rb |
f2c1e53a8e58c86bc4fa2db68cc9a881cf80527d | diff --git a/Module.php b/Module.php
index <HASH>..<HASH> 100644
--- a/Module.php
+++ b/Module.php
@@ -28,7 +28,7 @@ class Module implements
$app->getEventManager()->attach($strategy);
}
- public function getServiceConfiguration()
+ public function getServiceConfig()
{
return array(
'factories' => array(
@@ -69,7 +69,7 @@ class Module implements
);
}
- public function getViewHelperConfiguration()
+ public function getViewHelperConfig()
{
return array(
'factories' => array(
@@ -83,7 +83,7 @@ class Module implements
);
}
- public function getControllerPluginConfiguration()
+ public function getControllerPluginConfig()
{
return array(
'factories' => array( | s/Configuration/Config for ZF2 master | bjyoungblood_BjyAuthorize | train | php |
8d83bf80b28f71f32a3b1d6da01860a7e99f335c | diff --git a/oshino/core/heart.py b/oshino/core/heart.py
index <HASH>..<HASH> 100644
--- a/oshino/core/heart.py
+++ b/oshino/core/heart.py
@@ -84,7 +84,7 @@ async def main_loop(cfg: Config,
init(agents)
- while continue_fn():
+ while True:
ts = time()
await step(client, agents, loop=loop)
te = time()
@@ -96,7 +96,10 @@ async def main_loop(cfg: Config,
len(client.queue.events))
flush_riemann(client, transport, logger)
- await asyncio.sleep(cfg.interval - int(td), loop=loop)
+ if continue_fn():
+ await asyncio.sleep(cfg.interval - int(td), loop=loop)
+ else:
+ break
def start_loop(cfg: Config): | Do sleep only if we consider to continue | CodersOfTheNight_oshino | train | py |
631de09630492c10f2cc930c4c969d7deaf17d99 | diff --git a/bin/wasm-init.js b/bin/wasm-init.js
index <HASH>..<HASH> 100644
--- a/bin/wasm-init.js
+++ b/bin/wasm-init.js
@@ -47,21 +47,21 @@ if (args['clean'] || args['clean-all']) {
process.stdout.write(colors.yellow('Deleting WASM template...\n'));
folders.forEach(el => {
if (fs.existsSync(el)) {
- exec(`rm -rf ${el}`, (err, stdout) => {
- if (err) process.stderr.write(colors.white(err));
- process.stdout.write(stdout);
+ let curPath;
+ fs.readdirSync(el).forEach((file, i) => {
+ curPath = `${el}/${file}`;
+ fs.unlinkSync(curPath);
});
+ fs.rmdirSync(el);
}
});
// delete other files
files.forEach(el => {
if (fs.existsSync(el)) {
- exec(`rm -rf ${el}`, (err, stdout) => {
- if (err) process.stderr.write(colors.white(err));
- process.stdout.write(stdout);
- });
+ fs.unlinkSync(el);
}
});
+
return;
} | rewriting delete file commands with Node | shamadee_wasm-init | train | js |
9ccb8ad07c6279cf708dbe3760a9abf64cd685a3 | diff --git a/machina/apps/search/forms.py b/machina/apps/search/forms.py
index <HASH>..<HASH> 100644
--- a/machina/apps/search/forms.py
+++ b/machina/apps/search/forms.py
@@ -6,6 +6,7 @@ from django import forms
from django.db.models import get_model
from django.utils.translation import ugettext_lazy as _
from haystack.forms import FacetedSearchForm
+from haystack.inputs import AutoQuery
# Local application / specific library imports
from machina.core.loading import get_class
@@ -17,6 +18,9 @@ perm_handler = PermissionHandler()
class SearchForm(FacetedSearchForm):
+ search_topics = forms.BooleanField(
+ label=_('Search only in topic subjects'), required=False)
+
search_poster_name = forms.CharField(
label=_('Search for poster'), help_text=_('Enter a user name to limit the search to a specific user.'),
max_length=255, required=False)
@@ -40,6 +44,10 @@ class SearchForm(FacetedSearchForm):
if not self.is_valid():
return self.no_query_found()
+ # Handles topic-based searches
+ if self.cleaned_data['search_topics']:
+ sqs = sqs.filter(topic_subject=AutoQuery(self.cleaned_data['q']))
+
# Handles searches by poster name
if self.cleaned_data['search_poster_name']:
sqs = sqs.filter(poster_name__icontains=self.cleaned_data['search_poster_name']) | 'search' app updated to allow restricting the search to topic subjects | ellmetha_django-machina | train | py |
Subsets and Splits
Java Commits in Train Set
Queries for all entries where the diff_languages column is 'java', providing a filtered dataset but without deeper analysis.
Java Commits Test Data
Returns a subset of 5000 entries from the dataset where the programming language difference is Java, providing basic filtering for exploration.
Java Commits Sample
Retrieves the first 1,000 records where the 'diff_languages' column is 'java', providing limited insight into the specific data entries.
Java Commits Validation Sample
Retrieves a sample of entries from the validation dataset where the diff languages are Java, providing limited insight into specific Java-related data points.
Java Commits in Validation
This query retrieves a limited sample of entries from the validation dataset where the programming language difference is Java, providing basic filtering with minimal insight.
Java Commits Sample
This query retrieves a sample of 100 records where the 'diff_languages' is 'java', providing basic filtering but limited analytical value.
Java Commits Sample
Retrieves 100 samples where the language difference is Java, providing basic filtering but minimal analytical value.
Java Commits Sample
Retrieves 10 samples where the diff_languages column is 'java', providing basic examples of data entries with this specific language.
Java Commits Validation Sample
Retrieves 1,000 records where the differences in languages are marked as Java, providing a snapshot of that specific subset but limited to raw data.
Java Commits Sample
This query retrieves 1000 random samples from the dataset where the programming language is Java, offering limited insight beyond raw data.