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
|
---|---|---|---|---|---|
886ebc0427fa8d93b26aa56807b5150530d346c5 | diff --git a/pyfilemail/__main__.py b/pyfilemail/__main__.py
index <HASH>..<HASH> 100755
--- a/pyfilemail/__main__.py
+++ b/pyfilemail/__main__.py
@@ -155,7 +155,7 @@ https://github.com/apetrynet/pyfilemail',
return args
-if __name__ == '__main__':
+def main():
args = parse_args()
pwd = None
@@ -191,3 +191,6 @@ if __name__ == '__main__':
if res.status_code == 200:
msg = 'Transfer complete!'
logger.info(msg)
+
+if __name__ == '__main__':
+ main()
\ No newline at end of file | put all logic in a main function as attempt to get console_scripts in setup.py to work | apetrynet_pyfilemail | train | py |
659458f33d5390f6410ac87c499a6ae00c548761 | diff --git a/lib/legacy/init.php b/lib/legacy/init.php
index <HASH>..<HASH> 100644
--- a/lib/legacy/init.php
+++ b/lib/legacy/init.php
@@ -9,7 +9,7 @@
*/
if (!class_exists('Composer\\Autoload\\ClassLoader', false)) {
- require_once(__DIR__.'/autoloader.php');
+ require_once(__DIR__.'/../autoloader.php');
}
if(!isset($GLOBALS['BUILD_OPTIONS'])) { | Fix bad path into legacy/init.php | jelix_BuildTools | train | php |
897b7e4682f420b8a525d5f9d9cfce9ccb0bafbf | diff --git a/welly/curve.py b/welly/curve.py
index <HASH>..<HASH> 100644
--- a/welly/curve.py
+++ b/welly/curve.py
@@ -77,7 +77,7 @@ class Curve(object):
run=None,
service_company=None,
units=None,
- family=None):
+ log_type=None):
if isinstance(mnemonic, str):
mnemonic = [mnemonic]
@@ -98,7 +98,7 @@ class Curve(object):
self.code = code
self.description = description
self.units = units
- self.family = family
+ self.log_type = log_type
# set parameters related to well
self.api = api
self.date = date | change 'family' to 'log_type' attribute to be assigned by user | agile-geoscience_welly | train | py |
979a99b0564ed7686dd5c3edc7c9cb7a8395ff94 | diff --git a/gwpy/plotter/core.py b/gwpy/plotter/core.py
index <HASH>..<HASH> 100644
--- a/gwpy/plotter/core.py
+++ b/gwpy/plotter/core.py
@@ -982,7 +982,7 @@ class Plot(figure.Figure):
# -- utilities ------------------------------
@staticmethod
- def _get_axes_data(inputs, sep=False):
+ def _get_axes_data(inputs, sep=False, flat=False):
"""Determine the number of axes from the input args to this `Plot`
Parameters
@@ -993,11 +993,15 @@ class Plot(figure.Figure):
sep : `bool`, optional
plot each set of data on a separate `Axes`
+ flat : `bool`, optional
+ Return a flattened list of data objects
+
Returns
-------
axesdata : `list` of lists of array-like data
a `list` with one element per required `Axes` containing the
- array-like data sets for those `Axes`
+ array-like data sets for those `Axes`, unless ``flat=True``
+ is given.
Notes
-----
@@ -1041,6 +1045,10 @@ class Plot(figure.Figure):
out.append(x.values())
else:
out.append([x])
+
+ if flat:
+ return [s for group in out for s in group]
+
return out
@staticmethod | Plot._get_axes_data: added flat utility keyword
just returns a flattened list of data object | gwpy_gwpy | train | py |
d42a104808e8266877e41483697cffad1da617b8 | diff --git a/evaluators/melody_eval.py b/evaluators/melody_eval.py
index <HASH>..<HASH> 100755
--- a/evaluators/melody_eval.py
+++ b/evaluators/melody_eval.py
@@ -66,10 +66,10 @@ def evaluate(reference_file, estimated_file):
# Check if missing sample at time 0 and if so add one
if ref_time[0] > 0:
ref_time = np.insert(ref_time, 0, 0)
- ref_freq = np.insert(ref_freq, 0, ref_voicing[0])
+ ref_freq = np.insert(ref_freq, 0, ref_freq[0])
if est_time[0] > 0:
est_time = np.insert(est_time, 0, 0)
- est_freq = np.insert(est_freq, 0, est_voicing[0])
+ est_freq = np.insert(est_freq, 0, est_freq[0])
# Get separated frequency array and voicing boolean array
ref_freq, ref_voicing = mir_eval.melody.freq_to_voicing(ref_freq)
est_freq, est_voicing = mir_eval.melody.freq_to_voicing(est_freq) | corrected value inserted into time 0 when missing | craffel_mir_eval | train | py |
5ccb808163a8c2435d5f55ba3eeeee2f7f33ac20 | diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -12,7 +12,7 @@ def get_project_path(*args):
return os.path.abspath(os.path.join(this_dir, *args))
PACKAGE_NAME = 'xplenty'
-PACKAGE_VERSION = '1.0.8'
+PACKAGE_VERSION = '1.1.0'
PACKAGE_AUTHOR = 'Xplenty'
PACKAGE_AUTHOR_EMAIL = '[email protected]'
PACKAGE_URL = 'https://github.com/xplenty/xplenty.py' | Increase minor version
New functionality (new args for client.get_packages()) requires a
bump in the minor version. | xplenty_xplenty.py | train | py |
01403dbc168125ca01a16def6781b93754eb67e1 | diff --git a/trunk/JLanguageTool/src/java/de/danielnaber/languagetool/tools/Tools.java b/trunk/JLanguageTool/src/java/de/danielnaber/languagetool/tools/Tools.java
index <HASH>..<HASH> 100644
--- a/trunk/JLanguageTool/src/java/de/danielnaber/languagetool/tools/Tools.java
+++ b/trunk/JLanguageTool/src/java/de/danielnaber/languagetool/tools/Tools.java
@@ -93,8 +93,9 @@ public final class Tools {
System.out.println("<!--");
}
System.out.printf(Locale.ENGLISH,
- "Time: %dms for %d sentences (%.1f sentences/sec)\n",
+ "Time: %dms for %d sentences (%.1f sentences/sec)",
time, lt.getSentenceCount(), sentencesPerSecond);
+ System.out.println();
if (apiFormat) {
System.out.println("-->");
} | don't hardcode \n as line break | languagetool-org_languagetool | train | java |
438c354aac7eca1f7dd6b886ac4fcaebf4f60da1 | diff --git a/prestans/bin/pride.py b/prestans/bin/pride.py
index <HASH>..<HASH> 100755
--- a/prestans/bin/pride.py
+++ b/prestans/bin/pride.py
@@ -65,7 +65,8 @@ def main():
if __name__ == "__main__":
- prestans_path = os.path.join("..", "..")
+ directory = os.path.dirname(__file__)
+ prestans_path = os.path.join(directory, "..", "..")
#:
#: While in development attempt to import prestans from top dir | added relative import of prestans devel package | anomaly_prestans | train | py |
0e73d2083e9e3982007c9b9f64248d28cb662b1a | diff --git a/public/assets/appCore.js b/public/assets/appCore.js
index <HASH>..<HASH> 100644
--- a/public/assets/appCore.js
+++ b/public/assets/appCore.js
@@ -1066,9 +1066,6 @@ var app = {
/* SET LOADING */
app.setLoading($div);
- /* MENU ACTIVE */
- checkMenuActive();
-
/* VERIFICA NECESSIDADE DE ATUALIZAÇÃO DOS DADOS DAS ENTIDADES */
downloadEntityData();
@@ -1093,7 +1090,7 @@ var app = {
})
}
} else {
- app.applyView('403')
+ pageTransition('403', 'route', 'fade');
}
} else {
$div.html("");
@@ -1250,6 +1247,8 @@ function pageTransition(route, type, animation, target, param, scroll, setHistor
window[history.state.funcao](history.state.param !== "" ? history.state.param : undefined);
}
}).then(() => {
+ checkMenuActive();
+
/**
* Se tiver requisição de página específica, busca
* */ | adjust menu active and fix <I> page to pageTransition control | edineibauer_uebConfig | train | js |
052ee49d67a81d1e10f00bb5d3837599c71721d0 | diff --git a/DependencyInjection/ZendCacheExtension.php b/DependencyInjection/ZendCacheExtension.php
index <HASH>..<HASH> 100644
--- a/DependencyInjection/ZendCacheExtension.php
+++ b/DependencyInjection/ZendCacheExtension.php
@@ -22,7 +22,7 @@ class ZendCacheExtension extends Extension
/**
* Loads the cache manager configuration.
*/
- public function configLoad(array $configs, ContainerBuilder $container)
+ public function load(array $configs, ContainerBuilder $container)
{
foreach ($configs as $config) {
$this->doConfigLoad($config, $container); | Upgrade DIC extension to latest Symfony2 requirements | KnpLabs_KnpZendCacheBundle | train | php |
17bf81eb365d8a8ef4341e1082bbd6c747d0c1d7 | diff --git a/datadog_checks_dev/datadog_checks/dev/tooling/commands/release.py b/datadog_checks_dev/datadog_checks/dev/tooling/commands/release.py
index <HASH>..<HASH> 100644
--- a/datadog_checks_dev/datadog_checks/dev/tooling/commands/release.py
+++ b/datadog_checks_dev/datadog_checks/dev/tooling/commands/release.py
@@ -284,7 +284,7 @@ def testable(ctx, start_id, agent_version, milestone, dry_run):
echo_success(current_agent_version)
current_release_branch = '{}.x'.format(current_agent_version)
- diff_target_branch = 'master'
+ diff_target_branch = 'origin/master'
echo_info('Branch `{}` will be compared to `{}`.'.format(current_release_branch, diff_target_branch))
echo_waiting('Getting diff... ', nl=False)
@@ -382,7 +382,7 @@ def testable(ctx, start_id, agent_version, milestone, dry_run):
elif api_response.status_code == 403:
echo_failure(
'Error getting info for #{}. Please set a GitHub HTTPS '
- 'token to avoid rate limits.'.format(commit_id)
+ 'token to avoid rate limits.'.format(commit_hash)
)
continue | Use origin/master instead of master (#<I>) | DataDog_integrations-core | train | py |
b6cf5ce5b485c9917d9edaf580dd8fdbdf3831d2 | diff --git a/src/main/java/org/stripesstuff/plugin/security/SecurityInterceptor.java b/src/main/java/org/stripesstuff/plugin/security/SecurityInterceptor.java
index <HASH>..<HASH> 100644
--- a/src/main/java/org/stripesstuff/plugin/security/SecurityInterceptor.java
+++ b/src/main/java/org/stripesstuff/plugin/security/SecurityInterceptor.java
@@ -116,6 +116,11 @@ public class SecurityInterceptor
if (securityManager != null)
{
+ // Add the security manager to the request.
+ // This is used (for example) by the security tag.
+ executionContext.getActionBeanContext().getRequest().setAttribute(SecurityInterceptor.SECURITY_MANAGER,
+ securityManager);
+
switch (executionContext.getLifecycleStage())
{
case BindingAndValidation:
@@ -216,12 +221,6 @@ public class SecurityInterceptor
protected Resolution interceptResolutionExecution(ExecutionContext executionContext)
throws Exception
{
- // Before processing the resolution, add the security manager to the request.
- // This is used (for example) by the security tag.
-
- executionContext.getActionBeanContext().getRequest().setAttribute(SecurityInterceptor.SECURITY_MANAGER,
- securityManager);
-
return executionContext.proceed();
} | Fixes #<I>. SecurityManager is set in request first.
SecurityManager is set in request as soon as the interceptor is called
in case an exception is thrown before ResolutionExecution. | StripesFramework_stripes-stuff | train | java |
33ce96bfb96b5dab46ff42539d6fcd3b5d46297a | diff --git a/lib/firefox/webdriver/firefoxDelegate.js b/lib/firefox/webdriver/firefoxDelegate.js
index <HASH>..<HASH> 100644
--- a/lib/firefox/webdriver/firefoxDelegate.js
+++ b/lib/firefox/webdriver/firefoxDelegate.js
@@ -216,8 +216,14 @@ class FirefoxDelegate {
async afterCollect(index, result) {
for (let i = 0; i < result.length; i++) {
if (!this.options.firefox.appconstants) {
- delete result[i].browserScripts.browser.appConstants;
- delete result[i].browserScripts.browser.asyncAppConstants;
+ // We need to be extra careful here, see
+ // https://github.com/sitespeedio/browsertime/issues/1261
+ if (result[i].browserScripts.browser.appConstants) {
+ delete result[i].browserScripts.browser.appConstants;
+ }
+ if (result[i].browserScripts.browser.asyncAppConstants) {
+ delete result[i].browserScripts.browser.asyncAppConstants;
+ }
}
if (this.firefoxConfig.geckoProfiler && this.options.visualMetrics) { | Verify that the FF data exist before deleting it #<I> (#<I>) | sitespeedio_browsertime | train | js |
c25da1bcb977edacac3200f5e0c10268086a2b4a | diff --git a/pyqode/python/bootstrapper.py b/pyqode/python/bootstrapper.py
index <HASH>..<HASH> 100644
--- a/pyqode/python/bootstrapper.py
+++ b/pyqode/python/bootstrapper.py
@@ -32,12 +32,21 @@ class PreloadWorker(object):
def __init__(self, modules):
self.modules = modules
- def __call__(self, *args, **kwargs):
- import jedi
+ def __call__(self, conn, *args, **kwargs):
logger.debug("Boostrapper.preload started: %r" % self.modules)
- jedi.api.preload_module(*self.modules)
+ for m in self.modules:
+ conn.send("Preloading module %s" % m)
+ self.preload(m)
logger.debug("Boostrapper.preload finished")
+ def preload(self, m):
+ import jedi
+ try:
+ s = "import %s as x; x." % m
+ jedi.Script(s, 1, len(s), None).completions()
+ except :
+ logger.exception("Failed to preload %s" % m)
+
class Bootstrapper(QtCore.QObject):
""" | Send preload log message to the main process (may be used in a splash screen) | pyQode_pyqode.python | train | py |
7a487e1d29aa4300be8da1b3475847864cb033ea | diff --git a/reactor-core/src/test/java/reactor/core/publisher/FluxGenerateTest.java b/reactor-core/src/test/java/reactor/core/publisher/FluxGenerateTest.java
index <HASH>..<HASH> 100644
--- a/reactor-core/src/test/java/reactor/core/publisher/FluxGenerateTest.java
+++ b/reactor-core/src/test/java/reactor/core/publisher/FluxGenerateTest.java
@@ -207,6 +207,15 @@ public class FluxGenerateTest {
}
@Test
+ public void generatorThrowsFusion() {
+ StepVerifier.create(
+ Flux.<Integer>generate(o -> { throw new IllegalStateException("forced failure"); }))
+ .expectFusion(Fuseable.SYNC)
+ .verifyErrorSatisfies(e -> assertThat(e).isInstanceOf(IllegalStateException.class)
+ .hasMessage("forced failure"));
+ }
+
+ @Test
public void generatorMultipleOnErrors() {
AssertSubscriber<Integer> ts = AssertSubscriber.create(); | Polish: test coverage of generate throwing in SYNC fusion | reactor_reactor-core | train | java |
fb3c0f8bd8f3bdcbf749630dc93bf900611530e4 | diff --git a/examples/sys_info.py b/examples/sys_info.py
index <HASH>..<HASH> 100644
--- a/examples/sys_info.py
+++ b/examples/sys_info.py
@@ -1,7 +1,8 @@
#!/usr/bin/env python
#
-# !!! Needs psutil installing:
+# !!! Needs psutil (+ dependencies) installing:
#
+# $ sudo apt-get install python-dev
# $ sudo pip install psutil
# | Add note about python-dev dependency on installing psutil | rm-hull_luma.oled | train | py |
1b89d3ec50da085e2c76fbdde2e0ab63263a257a | diff --git a/index.js b/index.js
index <HASH>..<HASH> 100644
--- a/index.js
+++ b/index.js
@@ -570,7 +570,6 @@ microgear.prototype.resettoken = function(callback) {
result += chunk;
});
res.on('end', function(){
- console.log('result=='+result);
if (result !== 'FAILED') {
clearGearCache();
if (typeof(callback)=='function') callback(null); | remove token from local cache only after the revocation succeeds | netpieio_microgear-nodejs | train | js |
e7ebb23f14f1b6d68ac6a6036b1a0625a6b35029 | diff --git a/src/client/websocket/packets/handlers/GuildMembersChunk.js b/src/client/websocket/packets/handlers/GuildMembersChunk.js
index <HASH>..<HASH> 100644
--- a/src/client/websocket/packets/handlers/GuildMembersChunk.js
+++ b/src/client/websocket/packets/handlers/GuildMembersChunk.js
@@ -26,7 +26,7 @@ class GuildMembersChunkHandler extends AbstractHandler {
/**
* Emitted whenever a chunk of guild members is received (all members come from the same guild).
* @event Client#guildMembersChunk
- * @param {Collection<Snowflake, GuildMember>} members The members in the chunk
+ * @param {GuildMember[]} members The members in the chunk
* @param {Guild} guild The guild related to the member chunk
*/ | Fix guildMembersChunk documents for <I>-dev (#<I>) | discordjs_discord.js | train | js |
b55f9e2b93d64fce405a941ced8a5b751f6c5013 | diff --git a/ampersand-form-view.js b/ampersand-form-view.js
index <HASH>..<HASH> 100644
--- a/ampersand-form-view.js
+++ b/ampersand-form-view.js
@@ -129,7 +129,7 @@ extend(FormView.prototype, BBEvents, {
clear: function (skipValidation) {
for (var key in this._fieldViews) {
- if (this._fieldViews[key].clear === 'function') {
+ if (typeof this._fieldViews[key].clear === 'function') {
this._fieldViews[key].clear(skipValidation);
}
} | Forgot typeof in check for clear method in child views | AmpersandJS_ampersand-form-view | train | js |
68754484255b7c484b485669b33529b82eb005a2 | diff --git a/Test/CLI_test.py b/Test/CLI_test.py
index <HASH>..<HASH> 100644
--- a/Test/CLI_test.py
+++ b/Test/CLI_test.py
@@ -12,7 +12,7 @@ import argparse
class CLITest(unittest.TestCase):
def setUp(self):
# create a directory to use in testing the cp command
- self.client = Algorithmia.client('simdylfCeXZ8/MgaQzokUHlalWm1')
+ self.client = Algorithmia.client()
CLI().mkdir("data://.my/moredata", self.client)
if(not os.path.exists("./TestFiles/")):
os.mkdir("./TestFiles/")
@@ -130,7 +130,7 @@ class CLITest(unittest.TestCase):
def test_auth(self):
#key for test account
- key = "simdylfCeXZ8/MgaQzokUHlalWm1"
+ key = os.getenv('ALGORITHMIA_API_KEY')
address = 'apiAddress'
profile = 'default'
CLI().auth(key,address,profile) | Remove test key (#<I>) | algorithmiaio_algorithmia-python | train | py |
b270ba9d66dae7b8b43069cb91affda6ae1cd615 | diff --git a/lib/i18n/tasks/data/file_system_base.rb b/lib/i18n/tasks/data/file_system_base.rb
index <HASH>..<HASH> 100644
--- a/lib/i18n/tasks/data/file_system_base.rb
+++ b/lib/i18n/tasks/data/file_system_base.rb
@@ -48,7 +48,7 @@ module I18n::Tasks
router.route locale, tree do |path, tree_slice|
write_tree path, tree_slice
end
- @trees&.delete(locale)
+ @trees.delete(locale) if @trees
@available_locales = nil
end
diff --git a/lib/i18n/tasks/data/tree/traversal.rb b/lib/i18n/tasks/data/tree/traversal.rb
index <HASH>..<HASH> 100644
--- a/lib/i18n/tasks/data/tree/traversal.rb
+++ b/lib/i18n/tasks/data/tree/traversal.rb
@@ -102,7 +102,7 @@ module I18n::Tasks
to_remove = []
each do |node|
if block.yield(node)
- node.children&.select_nodes!(&block)
+ node.children.select_nodes!(&block) if node.children
else
# removing during each is unsafe
to_remove << node | revert lonely operator change since we support older rubies | glebm_i18n-tasks | train | rb,rb |
ad29811005d2ae4bf15e488a4d271c174e50a6d3 | diff --git a/lib/tetra/version_matcher.rb b/lib/tetra/version_matcher.rb
index <HASH>..<HASH> 100644
--- a/lib/tetra/version_matcher.rb
+++ b/lib/tetra/version_matcher.rb
@@ -38,7 +38,8 @@ module Tetra
[]
end
)
- their_chunks_for_version += [nil] * [my_chunks.length - their_chunks_for_version.length, 0].max
+ chunks_count = [my_chunks.length - their_chunks_for_version.length, 0].max
+ their_chunks_for_version += [nil] * chunks_count
[their_version, their_chunks_for_version]
end
] | Refactoring: fixing rubocop LineTooLong offenses | moio_tetra | train | rb |
4541b6c424325ecc1382fe31eff5ea2f743e24a8 | diff --git a/guava-tests/test/com/google/common/util/concurrent/FuturesTest.java b/guava-tests/test/com/google/common/util/concurrent/FuturesTest.java
index <HASH>..<HASH> 100644
--- a/guava-tests/test/com/google/common/util/concurrent/FuturesTest.java
+++ b/guava-tests/test/com/google/common/util/concurrent/FuturesTest.java
@@ -1809,9 +1809,9 @@ public class FuturesTest extends TestCase {
tester.setDefault(Future.class, Futures.immediateFuture(DATA1));
tester.setDefault(Executor.class, MoreExecutors.sameThreadExecutor());
tester.setDefault(Callable.class, Callables.returning(null));
- tester.setDefault(AsyncFunction.class, new AsyncFunction() {
+ tester.setDefault(AsyncFunction.class, new AsyncFunction<Object, String>() {
@Override
- public ListenableFuture apply(Object input) throws Exception {
+ public ListenableFuture<String> apply(Object input) throws Exception {
return immediateFuture(DATA1);
}
}); | Internal-only changes with some spillover.
-------------
Created by MOE: <URL> | google_guava | train | java |
60e79b0c2562d602961732256826b09a8a9bdefb | diff --git a/pkglib/pkglib/multipkg.py b/pkglib/pkglib/multipkg.py
index <HASH>..<HASH> 100644
--- a/pkglib/pkglib/multipkg.py
+++ b/pkglib/pkglib/multipkg.py
@@ -18,17 +18,17 @@ import sys
import subprocess
import config
-import manage
+import cmdline
def setup():
""" Mirror pkglib's setup() method for each sub-package in this repository.
"""
top_level_parser = config.get_pkg_cfg_parser()
- cfg = config._parse_metadata(top_level_parser, 'multipkg', ['pkg_dirs'])
+ cfg = config.parse_section(top_level_parser, 'multipkg', ['pkg_dirs'])
rc = [0]
for dirname in cfg['pkg_dirs']:
- with manage.chdir(dirname):
+ with cmdline.chdir(dirname):
# Update sub-package setup.cfg with top-level version if it's specified
if 'version' in cfg:
sub_parser = config.get_pkg_cfg_parser() | Fixing imports on clean environment. | manahl_pytest-plugins | train | py |
08a13b203e8b3aa53672222d203da99b8ba985f3 | diff --git a/alignak/misc/filter.py b/alignak/misc/filter.py
index <HASH>..<HASH> 100755
--- a/alignak/misc/filter.py
+++ b/alignak/misc/filter.py
@@ -68,26 +68,26 @@ def only_related_to(lst, user):
return lst
# Ok the user is a simple user, we should filter
- r = set()
- for i in lst:
+ res = set()
+ for item in lst:
# Maybe the user is a direct contact
- if user in i.contacts:
- r.add(i)
+ if user in item.contacts:
+ res.add(item)
continue
# TODO: add a notified_contact pass
# Maybe it's a contact of a linked elements (source problems or impacts)
is_find = False
- for s in i.source_problems:
- if user in s.contacts:
- r.add(i)
+ for serv in item.source_problems:
+ if user in serv.contacts:
+ res.add(item)
is_find = True
# Ok skip this object now
if is_find:
continue
# Now impacts related maybe?
- for imp in i.impacts:
+ for imp in item.impacts:
if user in imp.contacts:
- r.add(i)
+ res.add(item)
- return list(r)
+ return list(res) | Enh: Pylint - C<I> on variables names in filter.py | Alignak-monitoring_alignak | train | py |
6193cb6fe546976ad4896ec86d5e4eaf0496aa49 | diff --git a/datasketch/hyperloglog.py b/datasketch/hyperloglog.py
index <HASH>..<HASH> 100644
--- a/datasketch/hyperloglog.py
+++ b/datasketch/hyperloglog.py
@@ -184,7 +184,7 @@ class HyperLogLog(object):
'''
Estimate the cardinality of the data seen so far.
'''
- num_zero = self.reg.count(0)
+ num_zero = sum(1 for v in self.reg if v == 0)
if num_zero > 0:
# linear counting
lc = self.m * math.log(self.m / float(num_zero)) | make hyperloglog compatible with numpy array as reg | ekzhu_datasketch | train | py |
854f34e5d20efe6de54d262d4426191571d9df55 | diff --git a/checkpoint.go b/checkpoint.go
index <HASH>..<HASH> 100644
--- a/checkpoint.go
+++ b/checkpoint.go
@@ -4,8 +4,8 @@ package checkpoint
import (
"crypto/rand"
- "encoding/json"
"encoding/binary"
+ "encoding/json"
"fmt"
"io"
"io/ioutil"
@@ -87,6 +87,10 @@ type CheckAlert struct {
// Check checks for alerts and new version information.
func Check(p *CheckParams) (*CheckResponse, error) {
+ if disabled := os.Getenv("CHECKPOINT_DISABLE"); disabled != "" {
+ return &CheckResponse{}, nil
+ }
+
// If we have a cached result, then use that
if r, err := checkCache(p.Version, p.CacheFile, p.CacheDuration); err != nil {
return nil, err | Provide a way to disable checkpoint via environment variable | hashicorp_go-checkpoint | train | go |
d857d7b4b1ae93451555768667279c3cea7c456c | diff --git a/spyder/widgets/reporterror.py b/spyder/widgets/reporterror.py
index <HASH>..<HASH> 100644
--- a/spyder/widgets/reporterror.py
+++ b/spyder/widgets/reporterror.py
@@ -13,6 +13,8 @@ from qtpy.QtCore import Qt, Signal
# Local Imports
from spyder.config.base import _
+from spyder.widgets.sourcecode.codeeditor import CodeEditor
+from spyder.config.main import CONF
class SpyderErrorMsgBox(QMessageBox):
@@ -68,11 +70,19 @@ class FillDescription(QDialog):
def __init__(self, parent=None):
super().__init__(parent)
+
+ color_scheme = CONF.get('color_schemes', 'selected')
+
self.setWindowTitle(_("Error Description"))
self.label_description = QLabel(
"What steps will reproduce the problem")
- self.input_description = QPlainTextEdit()
+ self.input_description = CodeEditor()
+ self.input_description.setup_editor(
+ language='md', linenumbers=False, scrollflagarea=False,
+ color_scheme=color_scheme)
+ self.input_description.set_text("1. \n2. \n3. ")
+ self.input_description.move_cursor(3)
self.input_description.textChanged.connect(self.text_changed)
self.ok_button = QPushButton("Ok") | Use a CodeEditor in the error dialog.
I personally dislike this change because it makes the error dialog
complex and will be really annoying a failure while trying to report an
error. | spyder-ide_spyder | train | py |
ea9af7d746369e8ce686ddea650539f73b0fb01b | diff --git a/bin/now-deploy.js b/bin/now-deploy.js
index <HASH>..<HASH> 100755
--- a/bin/now-deploy.js
+++ b/bin/now-deploy.js
@@ -1,7 +1,7 @@
#!/usr/bin/env node
// Native
-const { resolve } = require('path')
+const { resolve, basename } = require('path')
// Packages
const Progress = require('progress')
@@ -263,6 +263,11 @@ if (deploymentName || wantsPublic) {
let alwaysForwardNpm
async function main() {
+ if (!fs.existsSync(path)) {
+ error(`The specified directory "${basename(path)}" doesn't exist.`)
+ process.exit(1)
+ }
+
let config = await cfg.read({ token: argv.token })
alwaysForwardNpm = config.forwardNpm | Display proper error message if path doesn't exist
This closes #<I> | zeit_now-cli | train | js |
176f17c6eb0527a4f251a5ef7ea7fc0e37382ce9 | diff --git a/setuptools/package_index.py b/setuptools/package_index.py
index <HASH>..<HASH> 100755
--- a/setuptools/package_index.py
+++ b/setuptools/package_index.py
@@ -623,7 +623,11 @@ def fix_sf_url(url):
def get_sf_ip(_mirrors=[]):
if not _mirrors:
- _mirrors[:] = socket.gethostbyname_ex('dl.sourceforge.net')[-1]
+ try:
+ _mirrors[:] = socket.gethostbyname_ex('dl.sourceforge.net')[-1]
+ except socket.error:
+ # DNS-bl0ck1n9 f1r3w4llz sUx0rs!
+ _mirrors[:] = ['dl.sourceforge.net']
return random.choice(_mirrors)
@@ -650,7 +654,3 @@ def get_sf_ip(_mirrors=[]):
-
-
-
- | Fall back to a reasonable default Sourceforge address if the machine is
unable to obtain the mirror IP list via DNS.
--HG--
branch : setuptools
extra : convert_revision : svn%3A<I>fed2-<I>-<I>-9fe1-9d<I>cc<I>/sandbox/trunk/setuptools%<I> | pypa_setuptools | train | py |
4d8470b870962fb0029ceab88d42e94b5c92daa4 | diff --git a/lib/clicoder/sites/aoj.rb b/lib/clicoder/sites/aoj.rb
index <HASH>..<HASH> 100644
--- a/lib/clicoder/sites/aoj.rb
+++ b/lib/clicoder/sites/aoj.rb
@@ -40,11 +40,11 @@ module Clicoder
end
def inputs_xpath
- '//pre[preceding-sibling::h2[1][text()="Sample Input"]]'
+ '//pre[preceding-sibling::*[self::h2 or self::h3][1][text()="Sample Input"]]'
end
def outputs_xpath
- '//pre[preceding-sibling::h2[1][text()="Output for the Sample Input"]]'
+ '//pre[preceding-sibling::*[self::h2 or self::h3][text()="Output for the Sample Input"]]'
end
def working_directory | Fix AOJ download xpaths | Genki-S_clicoder | train | rb |
f7524fd0d64ae063dedff5e080df0f62a68004ad | diff --git a/tests/frontend/org/voltdb/regressionsuites/RegressionSuite.java b/tests/frontend/org/voltdb/regressionsuites/RegressionSuite.java
index <HASH>..<HASH> 100644
--- a/tests/frontend/org/voltdb/regressionsuites/RegressionSuite.java
+++ b/tests/frontend/org/voltdb/regressionsuites/RegressionSuite.java
@@ -126,7 +126,7 @@ public class RegressionSuite extends TestCase {
}
public Client getClient() throws IOException {
- return getClient(1000 * 120);
+ return getClient(1000 * 60 * 10); // 10 minute default
}
/** | ENG-<I>: Bump the default client timeout for r-suites to <I>min | VoltDB_voltdb | train | java |
039583724fd9105c88bda669ecfd80405a87c540 | diff --git a/lib/veewee/provider/virtualbox/box/helper/version.rb b/lib/veewee/provider/virtualbox/box/helper/version.rb
index <HASH>..<HASH> 100644
--- a/lib/veewee/provider/virtualbox/box/helper/version.rb
+++ b/lib/veewee/provider/virtualbox/box/helper/version.rb
@@ -8,7 +8,9 @@ module Veewee
# For example: 4.1.8_Debianr75467 -> 4.1.8
def vbox_version
command="#{@vboxcmd} --version"
- shell_results=shell_exec("#{command}",{:mute => true, :stderr => "/dev/null"})
+ stderr = "/dev/null"
+ stderr = "nul" if definition.os_type_id=~/^Win/
+ shell_results=shell_exec("#{command}",{:mute => true, :stderr => stderr})
version=shell_results.stdout.strip.split(/[^0-9\.]/)[0]
return version
end | Windows support for stderr redirecting | jedi4ever_veewee | train | rb |
64e67ca9b8fdb6c114de4e23f0b4d386eb9bf31b | diff --git a/lib/pancake/mixins/request_helper.rb b/lib/pancake/mixins/request_helper.rb
index <HASH>..<HASH> 100644
--- a/lib/pancake/mixins/request_helper.rb
+++ b/lib/pancake/mixins/request_helper.rb
@@ -44,7 +44,7 @@ module Pancake
# @api public
# @author Daniel Neighman
def url(name, opts = {})
- configuration.router.generate(name, opts)
+ configuration.router.url(name, opts)
end
# Generate the base url for the router that got you to this point. | Updates the url helper to use the router url method rather than the raw generate | hassox_pancake | train | rb |
7d890aa456b65ce284491806d052769f26a36229 | diff --git a/spoon-maven-plugin/src/main/java/com/squareup/spoon/SpoonMojo.java b/spoon-maven-plugin/src/main/java/com/squareup/spoon/SpoonMojo.java
index <HASH>..<HASH> 100644
--- a/spoon-maven-plugin/src/main/java/com/squareup/spoon/SpoonMojo.java
+++ b/spoon-maven-plugin/src/main/java/com/squareup/spoon/SpoonMojo.java
@@ -119,10 +119,14 @@ public class SpoonMojo extends AbstractMojo {
return;
}
+ if (androidSdk == null) {
+ throw new MojoExecutionException(
+ "Could not find Android SDK. Ensure ANDROID_HOME environment variable is set.");
+ }
File sdkFile = new File(androidSdk);
if (!sdkFile.exists()) {
throw new MojoExecutionException(
- "Could not find Android SDK. Ensure ANDROID_HOME environment variable is set.");
+ String.format("Could not find Android SDK at: %s", androidSdk));
}
log.debug("Android SDK: " + sdkFile.getAbsolutePath()); | Add check on android SDK location to prevent NPE.
androidSdk can be null if ANDROID_HOME is not defined, so the
extra check prevents an NPE.
Also added the location of the SDK in the error message when
the location does not exist. | square_spoon | train | java |
ba592028e5863956a321c26651c57f3e3cbd772e | diff --git a/torrent.go b/torrent.go
index <HASH>..<HASH> 100644
--- a/torrent.go
+++ b/torrent.go
@@ -1091,6 +1091,9 @@ func (t *Torrent) piecePriorityChanged(piece pieceIndex, reason string) {
if !c.peerHasPiece(piece) {
return
}
+ if c.peerChoking && !c.peerAllowedFast.Contains(uint32(piece)) {
+ return
+ }
c.updateRequests(reason)
})
} | Filter update requests on piece priority change by peer choking and allowed fast | anacrolix_torrent | train | go |
01dde75f08f0a265a66e08741e57c30a212a017c | diff --git a/liquibase-cli/src/main/java/liquibase/integration/commandline/LiquibaseCommandLine.java b/liquibase-cli/src/main/java/liquibase/integration/commandline/LiquibaseCommandLine.java
index <HASH>..<HASH> 100644
--- a/liquibase-cli/src/main/java/liquibase/integration/commandline/LiquibaseCommandLine.java
+++ b/liquibase-cli/src/main/java/liquibase/integration/commandline/LiquibaseCommandLine.java
@@ -828,7 +828,7 @@ public class LiquibaseCommandLine {
final SortedSet<ConfigurationDefinition<?>> globalConfigurations = Scope.getCurrentScope().getSingleton(LiquibaseConfiguration.class).getRegisteredDefinitions(false);
for (ConfigurationDefinition<?> def : globalConfigurations) {
- String[] argNames = toArgNames(def);
+ final String[] argNames = toArgNames(def);
for (int i = 0; i < argNames.length; i++) {
final CommandLine.Model.OptionSpec.Builder optionBuilder = CommandLine.Model.OptionSpec.builder(argNames[i])
.required(false) | Make variable final like it was before
DAT-<I> | liquibase_liquibase | train | java |
34553959a9b21f69b279d00f3775b79719ddccca | diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -703,7 +703,7 @@ INSTALL_REQUIREMENTS = [
'flask-caching>=1.3.3, <2.0.0',
'flask-login>=0.3, <0.5',
'flask-swagger==0.2.13',
- 'flask-wtf>=0.14.2, <0.15',
+ 'flask-wtf>=0.14.3, <0.15',
'funcsigs>=1.0.0, <2.0.0',
'graphviz>=0.12',
'gunicorn>=19.5.0, <20.0', | Update flask_wtf version to work with werkzeug>=<I> (#<I>)
Werkzeug <I> deprecated werkzeug.url_encode, and removed it in <I>, so
we need the fixed version of flask_wtf | apache_airflow | train | py |
d630076af126f4de3da902dae3c689678d0d1a5e | diff --git a/aws/aws_sweeper_test.go b/aws/aws_sweeper_test.go
index <HASH>..<HASH> 100644
--- a/aws/aws_sweeper_test.go
+++ b/aws/aws_sweeper_test.go
@@ -15,12 +15,8 @@ func TestMain(m *testing.M) {
// sharedClientForRegion returns a common AWSClient setup needed for the sweeper
// functions for a given region
func sharedClientForRegion(region string) (interface{}, error) {
- if os.Getenv("AWS_ACCESS_KEY_ID") == "" {
- return nil, fmt.Errorf("empty AWS_ACCESS_KEY_ID")
- }
-
- if os.Getenv("AWS_SECRET_ACCESS_KEY") == "" {
- return nil, fmt.Errorf("empty AWS_SECRET_ACCESS_KEY")
+ if os.Getenv("AWS_PROFILE") == "" && (os.Getenv("AWS_ACCESS_KEY_ID") == "" || os.Getenv("AWS_SECRET_ACCESS_KEY") == "") {
+ return nil, fmt.Errorf("must provide environment variables AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY or environment variable AWS_PROFILE")
}
conf := &Config{ | tests/provider: Allow AWS_PROFILE environment variable for acceptance test sweepers
The AWS Go SDK will automatically pick up and use the AWS_PROFILE environment variable for credentials if provided. | terraform-providers_terraform-provider-aws | train | go |
eb8ee51d42399aca913401bc7d073b6e63aa5aa9 | diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -100,7 +100,7 @@ setup(
python_requires=">=2.7,!=3.0,!=3.1,!=3.2,!=3.3",
install_requires=[
'wrapt~=1.10',
- 'typing',
+ 'typing;python_version<"3.5"',
'windows-curses;platform_system=="Windows"',
],
extras_require=extras_require, | Make typing dependency conditional < python <I> | hardbyte_python-can | train | py |
e498d330c609cf6df44457184e8e902ae24c7423 | diff --git a/lib/elephrame/bot.rb b/lib/elephrame/bot.rb
index <HASH>..<HASH> 100644
--- a/lib/elephrame/bot.rb
+++ b/lib/elephrame/bot.rb
@@ -71,6 +71,18 @@ module Elephrame
return nil
end
+
+ ##
+ # Checks to see if a user has some form of "#NoBot" in their bio
+ # (so we can make make friendly bots easier!)
+ #
+ # @param account_id [String] id of account to check bio
+ #
+ # @return [Bool]
+
+ def no_bot? account_id
+ @client.account(account_id).note =~ /#?NoBot/i
+ end
end
end | added no_bot? to BaseBot | theZacAttacks_elephrame | train | rb |
9978467017e6717e87cbb806d788c90493454ee3 | diff --git a/rival-evaluate/src/test/java/net/recommenders/rival/evaluation/metric/NDCGTest.java b/rival-evaluate/src/test/java/net/recommenders/rival/evaluation/metric/NDCGTest.java
index <HASH>..<HASH> 100644
--- a/rival-evaluate/src/test/java/net/recommenders/rival/evaluation/metric/NDCGTest.java
+++ b/rival-evaluate/src/test/java/net/recommenders/rival/evaluation/metric/NDCGTest.java
@@ -31,7 +31,7 @@ public class NDCGTest<U, V> {
predictions.addPreference((long) i, (long) j, (double) i * j % 5 + 1.0);
}
}
- ndcg = new NDCG(predictions, test);
+ ndcg = new NDCG(predictions, test, new int[]{5, 10, 20});
}
@Test
@@ -41,6 +41,13 @@ public class NDCGTest<U, V> {
}
@Test
+ public void testComputeNDCGAt() {
+ ndcg.compute();
+ assertEquals(1.0, ndcg.getValue(5), 0.0);
+ assertEquals(1.0, ndcg.getValue(10), 0.0);
+ }
+
+ @Test
public void testGetValuePerUser() {
ndcg.compute();
Map<Long, Double> ndcgPerUser = ndcg.getValuePerUser(); | Fixed unit test for NDCG (see #<I>) | recommenders_rival | train | java |
657b93f001d63d44102f347ea932edefe89f3288 | diff --git a/test/adapter/http.test.js b/test/adapter/http.test.js
index <HASH>..<HASH> 100644
--- a/test/adapter/http.test.js
+++ b/test/adapter/http.test.js
@@ -13,7 +13,7 @@ var droongaAPI = require('../../lib/adapter/api/droonga');
var groongaAPI = require('../../lib/adapter/api/groonga');
suite('HTTP Adapter', function() {
- test('registeration of plugin commands', function() {
+ test('registration of plugin commands', function() {
var basePlugin = {
getCommand: new command.HTTPRequestResponse({
path: '/get' | Fix a typo
registeration
regist ration
- | droonga_express-droonga | train | js |
261ec6e231e4d8dac0482c6d1ad9ab1ea8bd92ea | diff --git a/client/html/tests/Client/Html/Basket/Standard/Coupon/DefaultTest.php b/client/html/tests/Client/Html/Basket/Standard/Coupon/DefaultTest.php
index <HASH>..<HASH> 100644
--- a/client/html/tests/Client/Html/Basket/Standard/Coupon/DefaultTest.php
+++ b/client/html/tests/Client/Html/Basket/Standard/Coupon/DefaultTest.php
@@ -94,7 +94,7 @@ class Client_Html_Basket_Standard_Coupon_DefaultTest extends MW_Unittest_Testcas
$view->standardBasket = $controller->get();
$output = $this->_object->getBody();
- $this->assertRegExp( '#<li class="coupon-item">.*90AB.*</li>#smU', $output );
+ $this->assertRegExp( '#<li class="attr-item">.*90AB.*</li>#smU', $output );
}
@@ -123,7 +123,7 @@ class Client_Html_Basket_Standard_Coupon_DefaultTest extends MW_Unittest_Testcas
$view->standardBasket = $controller->get();
$output = $this->_object->getBody();
- $this->assertNotRegExp( '#<ul class="coupon-list">#smU', $output );
+ $this->assertNotRegExp( '#<ul class="attr-list">#smU', $output );
} | Adapts test to changed coupon HTML | Arcavias_arcavias-core | train | php |
edd38f54a2ff8f4d0383b94362d1c03fbda62943 | diff --git a/lib/cxxproject/buildingblocks/binary_library.rb b/lib/cxxproject/buildingblocks/binary_library.rb
index <HASH>..<HASH> 100644
--- a/lib/cxxproject/buildingblocks/binary_library.rb
+++ b/lib/cxxproject/buildingblocks/binary_library.rb
@@ -8,13 +8,15 @@ module Cxxproject
include HasLibraries
include HasIncludes
- def initialize(name)
+ def initialize(name, useNameAsLib = true)
super(name)
- libs_to_search << name
+ @useNameAsLib = useNameAsLib
+ libs_to_search << name if @useNameAsLib
end
def get_task_name()
- libs_to_search[0]
+ return libs_to_search[0] if @useNameAsLib
+ @name
end | more flexible BinaryLib (now compatible to Lake) | marcmo_cxxproject | train | rb |
b2b53fe0880e8d5d0cf21772eec50191305425c9 | diff --git a/lib/controllers/actions/oauth2.js b/lib/controllers/actions/oauth2.js
index <HASH>..<HASH> 100644
--- a/lib/controllers/actions/oauth2.js
+++ b/lib/controllers/actions/oauth2.js
@@ -36,6 +36,12 @@ module.exports = function (req, res){
res.serverError();
} else {
var _data = JSON.parse(body);
+
+ if(_data.error){
+ waterlock.logger.debug(_data);
+ res.serverError(_data.error);
+ }
+
var attr = {
facebookId: _data.id,
name: _data.name
@@ -66,4 +72,4 @@ module.exports = function (req, res){
waterlock.cycle.loginSuccess(req, res, user);
}
-};
\ No newline at end of file
+}; | Update oauth2.js
If FB respond with an error log it and respond with server error | waterlock_waterlock-facebook-auth | train | js |
996ac1cc2cb89d5730c3ef2aaf4d4dbb5e191115 | diff --git a/src/modules/appProps.js b/src/modules/appProps.js
index <HASH>..<HASH> 100644
--- a/src/modules/appProps.js
+++ b/src/modules/appProps.js
@@ -9,6 +9,11 @@ var app_props = null;
var load = function(cb) {
var doc_url = document.location.href;
var url_params = qs(doc_url);
+ for(var key in url_params){
+ if(url_params.hasOwnProperty(key)){
+ url_params[key] = url_params[key].replace(/#.*?$/g, '');
+ }
+ }
//default properties
app_props = {
@@ -24,7 +29,6 @@ var load = function(cb) {
app_props.host = url_params.url;
}
- app_props.host = app_props.host.replace(/#.*?$/g, '');
app_props.local = !!(url_params.host || url_params.url);
cb(null, app_props);
} | sanitized all url params | feedhenry_fh-sync-js | train | js |
ccda545f81bc7e70995498dd3a104389f37957c1 | diff --git a/Corrfunc/utils.py b/Corrfunc/utils.py
index <HASH>..<HASH> 100644
--- a/Corrfunc/utils.py
+++ b/Corrfunc/utils.py
@@ -75,8 +75,8 @@ def read_catalog(filebase=None):
return x, y, z
def read_fastfood(filename, return_dtype=None, need_header=None):
- if return_dtype is None:
- msg = "Return data-type must be set and a valid numpy data-type"
+ if return_dtype is None or return_dtype not in [np.float32, np.float]:
+ msg = "Return data-type must be set and a valid numpy float"
raise ValueError(msg)
import struct | Added an explanatory message for reading fast-food files | manodeep_Corrfunc | train | py |
9368b500708d0c6825f5e0233accbdbaf96ef9cd | diff --git a/index.js b/index.js
index <HASH>..<HASH> 100644
--- a/index.js
+++ b/index.js
@@ -377,9 +377,7 @@ PageClass.prototype.waitReady = function() {
var p = new Promise(function(resolve) {
solve = resolve;
});
- // https://github.com/jquery/jquery/issues/2100
- if (document.readyState == "complete" ||
- (document.readyState != "loading" && !document.documentElement.doScroll)) {
+ if (document.readyState == "complete") {
this.docReady = true;
setTimeout(solve);
return p; | Fix #<I>: waitReady better return too late than too soon. | kapouer_window-page | train | js |
d88bee777d7d3b15e762666289a43093a6fb4ac1 | diff --git a/Event/PasswordResetTokenEvent.php b/Event/PasswordResetTokenEvent.php
index <HASH>..<HASH> 100644
--- a/Event/PasswordResetTokenEvent.php
+++ b/Event/PasswordResetTokenEvent.php
@@ -11,7 +11,7 @@
namespace Darvin\UserBundle\Event;
use Darvin\UserBundle\Entity\PasswordResetToken;
-use Symfony\Component\EventDispatcher\Event;
+use Symfony\Contracts\EventDispatcher\Event;
/**
* Password reset token event
diff --git a/Event/UserEvent.php b/Event/UserEvent.php
index <HASH>..<HASH> 100644
--- a/Event/UserEvent.php
+++ b/Event/UserEvent.php
@@ -11,9 +11,9 @@
namespace Darvin\UserBundle\Event;
use Darvin\UserBundle\Entity\BaseUser;
-use Symfony\Component\EventDispatcher\Event;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
+use Symfony\Contracts\EventDispatcher\Event;
/**
* User event | Replace deprecated base event class. | DarvinStudio_DarvinUserBundle | train | php,php |
6251b4711bc6fef6bc392fe79279d6a7dffb367e | diff --git a/src/Methods/helpers.php b/src/Methods/helpers.php
index <HASH>..<HASH> 100644
--- a/src/Methods/helpers.php
+++ b/src/Methods/helpers.php
@@ -57,3 +57,15 @@ if (! function_exists('take')) {
return new \SebastiaanLuca\Helpers\Pipe\Item($value);
}
}
+
+if (! function_exists('rand_bool')) {
+ /**
+ * Randomly return true or false.
+ *
+ * @return bool
+ */
+ function rand_bool()
+ {
+ return rand(0, 1) === 0;
+ }
+} | Add rand_bool() method | sebastiaanluca_laravel-helpers | train | php |
b294ad2c977b1bd4218d0edd9a7ab5179ef6cfda | diff --git a/test/unit/components/validity/lifecycle.test.js b/test/unit/components/validity/lifecycle.test.js
index <HASH>..<HASH> 100644
--- a/test/unit/components/validity/lifecycle.test.js
+++ b/test/unit/components/validity/lifecycle.test.js
@@ -28,7 +28,7 @@ describe('validity component: lifecycle', () => {
}
}
}).$mount()
- assert(vm._elementable.isBuiltIn !== undefined)
+ assert.equal(vm._elementable.constructor.name, 'SingleElement')
})
})
@@ -56,7 +56,7 @@ describe('validity component: lifecycle', () => {
}
}
}).$mount()
- assert(vm._elementable.getCheckedValue !== undefined)
+ assert.equal(vm._elementable.constructor.name, 'MultiElement')
})
})
}) | :shirt: refactor: change instance checking to class name | kazupon_vue-validator | train | js |
6ee3c4a8fe5efab054acdc2ae8546712cd2dbbe6 | diff --git a/jax/interpreters/ad.py b/jax/interpreters/ad.py
index <HASH>..<HASH> 100644
--- a/jax/interpreters/ad.py
+++ b/jax/interpreters/ad.py
@@ -411,15 +411,9 @@ def map_transpose(primitive, params, jaxpr, consts, freevar_vals, args, ct):
all_args = pack((pack(args), pack(consts), ct))
ans = primitive.bind(fun, all_args, **params)
cts_out, freevar_cts = build_tree(out_tree_def(), ans)
- freevar_cts = tree_map(_sum_leading_axis, freevar_cts)
+ freevar_cts = tree_map(lambda x: x.sum(0), freevar_cts)
return cts_out, freevar_cts
-def _sum_leading_axis(x):
- try:
- return x.sum(0)
- except AttributeError:
- return onp.sum(x, 0)
-
primitive_transposes[core.call_p] = partial(call_transpose, call_p)
primitive_transposes[pe.compiled_call_p] = partial(call_transpose, pe.compiled_call_p) | simplify map_transpose summing | tensorflow_probability | train | py |
bff76ba76ef112622d81fba4925e2e062ef1197d | diff --git a/test/json_api_test.rb b/test/json_api_test.rb
index <HASH>..<HASH> 100644
--- a/test/json_api_test.rb
+++ b/test/json_api_test.rb
@@ -16,7 +16,6 @@ class JsonApiTest < MiniTest::Spec
module Singular
include Representable::Hash
- include Roar::Representer::JSON # activates prepare_links
include Roar::Representer::Feature::Hypermedia
extend Roar::Representer::JSON::JsonApi::ClassMethods
include Roar::Representer::JSON::JsonApi::Singular | no need to include JSON atm. | trailblazer_roar | train | rb |
0f4d7b6a85011525e3b7238ff1ca2dd91622736c | diff --git a/modules/system/assets/js/framework.extras.js b/modules/system/assets/js/framework.extras.js
index <HASH>..<HASH> 100644
--- a/modules/system/assets/js/framework.extras.js
+++ b/modules/system/assets/js/framework.extras.js
@@ -52,7 +52,7 @@
})
if (!!$container.length) {
- $container = $('[data-validate-error]')
+ $container = $('[data-validate-error]', $this)
}
if (!!$container.length) { | Pass the current context to the selector
This fixes an issue with more than one form on a single page. The messages will be correctly displayed in the container of their corresponding form. | octobercms_october | train | js |
f84ed98e3f1b9e963aebe7d6ef5c80ab6251bd54 | diff --git a/src/GkSmarty/Smarty/SmartyResolverFactory.php b/src/GkSmarty/Smarty/SmartyResolverFactory.php
index <HASH>..<HASH> 100644
--- a/src/GkSmarty/Smarty/SmartyResolverFactory.php
+++ b/src/GkSmarty/Smarty/SmartyResolverFactory.php
@@ -26,7 +26,7 @@ class SmartyResolverFactory implements FactoryInterface
{
$resolver = new AggregateResolver();
$resolver->attach($serviceLocator->get('GkSmartyTemplateMapResolver'));
- $resolver->attach($serviceLocator->get('GkSmartyTemplatePathStackResolver'));
+ $resolver->attach($serviceLocator->get('GkSmartyTemplatePathStack'));
return $resolver;
} | fix wrong SM key in SmartyResolverFactory | gkralik_gk-smarty | train | php |
83c2f638c183fa26af55f757607ff937efda4a3a | diff --git a/spec/active_record/connection_adapters/oracle_enhanced_emulate_oracle_adapter_spec.rb b/spec/active_record/connection_adapters/oracle_enhanced_emulate_oracle_adapter_spec.rb
index <HASH>..<HASH> 100644
--- a/spec/active_record/connection_adapters/oracle_enhanced_emulate_oracle_adapter_spec.rb
+++ b/spec/active_record/connection_adapters/oracle_enhanced_emulate_oracle_adapter_spec.rb
@@ -16,4 +16,10 @@ describe "OracleEnhancedAdapter emulate OracleAdapter" do
ActiveRecord::Base.connection.is_a?(ActiveRecord::ConnectionAdapters::OracleAdapter).should be_true
end
+ after(:all) do
+ if defined?(ActiveRecord::ConnectionAdapters::OracleAdapter)
+ ActiveRecord::ConnectionAdapters.send(:remove_const, :OracleAdapter)
+ end
+ end
+
end | remove OracleAdapter constant after emulate OracleAdapter test | rsim_oracle-enhanced | train | rb |
5d58c411906d8e80bfc577a1ebf58036264e4c66 | diff --git a/generators/generator-constants.js b/generators/generator-constants.js
index <HASH>..<HASH> 100644
--- a/generators/generator-constants.js
+++ b/generators/generator-constants.js
@@ -18,7 +18,7 @@
*/
// version of docker images
-const DOCKER_JHIPSTER_REGISTRY = 'jhipster/jhipster-registry:v4.0.2';
+const DOCKER_JHIPSTER_REGISTRY = 'jhipster/jhipster-registry:v4.0.3';
const DOCKER_JAVA_JRE = 'openjdk:8-jre-alpine';
const DOCKER_MYSQL = 'mysql:5.7.20';
const DOCKER_MARIADB = 'mariadb:10.3.7'; | Update to the latest JHipster Registry release | jhipster_generator-jhipster | train | js |
c1f3bb1d8b6aede472229f111ea6621687dd9943 | diff --git a/packages/core/parcel/src/cli.js b/packages/core/parcel/src/cli.js
index <HASH>..<HASH> 100755
--- a/packages/core/parcel/src/cli.js
+++ b/packages/core/parcel/src/cli.js
@@ -116,6 +116,7 @@ var hmrOptions = {
'--cert <path>': 'path to certificate to use with HTTPS',
'--key <path>': 'path to private key to use with HTTPS',
'--hmr-port <port>': ['hot module replacement port', process.env.HMR_PORT],
+ '--hmr-host <host>': ['hot module replacement host', process.env.HMR_HOST],
};
function applyOptions(cmd, options) {
@@ -446,8 +447,9 @@ async function normalizeOptions(
let hmrOptions = null;
if (command.name() !== 'build' && command.hmr !== false) {
let hmrport = command.hmrPort ? parsePort(command.hmrPort) : port;
+ let hmrhost = command.hmrHost ? command.hmrHost : host;
- hmrOptions = {port: hmrport, host};
+ hmrOptions = {port: hmrport, host: hmrhost};
}
if (command.detailedReport === true) { | Add --hmr-host option to set her host (#<I>) | parcel-bundler_parcel | train | js |
dff9efa5f3831943dc1af885dc638103b96eec68 | diff --git a/cmd/ctr/list.go b/cmd/ctr/list.go
index <HASH>..<HASH> 100644
--- a/cmd/ctr/list.go
+++ b/cmd/ctr/list.go
@@ -6,7 +6,7 @@ import (
"text/tabwriter"
"github.com/containerd/containerd"
- "github.com/containerd/containerd/api/services/execution"
+ tasks "github.com/containerd/containerd/api/services/tasks/v1"
tasktypes "github.com/containerd/containerd/api/types/task"
"github.com/urfave/cli"
)
@@ -67,9 +67,9 @@ func taskListFn(context *cli.Context) error {
return err
}
- tasks := client.TaskService()
+ s := client.TaskService()
- tasksResponse, err := tasks.List(ctx, &execution.ListRequest{})
+ tasksResponse, err := s.List(ctx, &tasks.ListTasksRequest{})
if err != nil {
return err
} | [ctr] fix tasks service refernce | containerd_containerd | train | go |
9a4c203e1ee396471beecf79e3c5b86cf43c83c6 | diff --git a/heron/common/src/java/com/twitter/heron/common/basics/Communicator.java b/heron/common/src/java/com/twitter/heron/common/basics/Communicator.java
index <HASH>..<HASH> 100644
--- a/heron/common/src/java/com/twitter/heron/common/basics/Communicator.java
+++ b/heron/common/src/java/com/twitter/heron/common/basics/Communicator.java
@@ -53,8 +53,12 @@ public class Communicator<E> {
private volatile int capacity;
/**
- * Used in Used in updateExpectedAvailableCapacity()
+ * Used in updateExpectedAvailableCapacity()
* Variables related to dynamically tune Communicator's expected available capacity
+ * <p>
+ * The value should be positive number && smaller than the capacity
+ * -- Non-positive number can cause starvation concerns.
+ * -- Too large positive number can bring gc issues.
*/
private volatile int expectedAvailableCapacity;
@@ -225,7 +229,8 @@ public class Communicator<E> {
expectedAvailableCapacity = availableCapacity + 1;
}
- if (inAvgSize > expectedQueueSize && availableCapacity > 0) {
+ // Make sure expectedAvailableCapacity will still be positive number if we decrease it
+ if (inAvgSize > expectedQueueSize && availableCapacity > 1) {
// The decrease of available capacity is quick since
// we want to recover quickly once we back-up items , which may cause GC issues
expectedAvailableCapacity = availableCapacity / 2; | Increase the minimal queue size for Communicator (#<I>)
Currently we use a strategy tuning the soft capacity of Communicator,
which can trigger back-pressure too easily.
In this pull request, we increase the minimal queue size from 0 to 1,
enhancing the concurrent processing between Gateway and Slave thread. | apache_incubator-heron | train | java |
3d00efa584a953906626e1ad2d69536db6a2b662 | diff --git a/menu_launcher.py b/menu_launcher.py
index <HASH>..<HASH> 100755
--- a/menu_launcher.py
+++ b/menu_launcher.py
@@ -1,7 +1,6 @@
#!/usr/bin/env python2.7
import ConfigParser
-import curses
import os
import sys
import termios
@@ -12,6 +11,7 @@ from subprocess import call, check_output, PIPE, Popen
# !! TODO tmeporary fix for tests
try:
+ import curses
screen = curses.initscr()
curses.noecho()
curses.cbreak() | make curses optional for testing for now | CyberReboot_vent | train | py |
c687772a707cb852e18ae3f2055f6ca87b98cdd4 | diff --git a/fastlane/actions/plugin_scores.rb b/fastlane/actions/plugin_scores.rb
index <HASH>..<HASH> 100644
--- a/fastlane/actions/plugin_scores.rb
+++ b/fastlane/actions/plugin_scores.rb
@@ -7,7 +7,9 @@ module Fastlane
plugins = fetch_plugins.sort_by { |v| v.data[:overall_score] }.reverse
- result = "# Available Plugins\n\n\n"
+ result = "<!--\nAuto generated, please only modify https://github.com/fastlane/fastlane/blob/master/fastlane/actions/plugin_scores.rb\n-->\n"
+ result += "{!docs/setup-fastlane-header.md!}\n"
+ result += "# Available Plugins\n\n\n"
result += plugins.collect do |current_plugin|
@plugin = current_plugin
result = ERB.new(File.read(params[:template_path]), 0, '-').result(binding) # https://web.archive.org/web/20160430190141/www.rrn.dk/rubys-erb-templating-system | Add note that available-plugins.md is auto generated & add installation header (#<I>)
Related to <URL> | fastlane_fastlane | train | rb |
aa3fd6daae71a3f4258d0da9d3ed5633a6732309 | diff --git a/lib/lifeguard/infinite_threadpool.rb b/lib/lifeguard/infinite_threadpool.rb
index <HASH>..<HASH> 100644
--- a/lib/lifeguard/infinite_threadpool.rb
+++ b/lib/lifeguard/infinite_threadpool.rb
@@ -18,11 +18,18 @@ module Lifeguard
def async(*args, &block)
return false if @shutdown
+ sleep 0.5 if @queued_jobs.size > 1000
@queued_jobs << { :args => args, :block => block }
return true
end
+ def shutdown(shutdown_timeout = 30)
+ @shutdown = true
+ @scheduler.join
+ super(shutdown_timeout)
+ end
+
def create_scheduler
Thread.new do
while !@shutdown || @queud_jobs.size > 0 | Throttle when queue is larger than 1,<I> | mxenabled_lifeguard | train | rb |
80a8252112b913418e905719aa9682a4fdf4ddee | diff --git a/elk-util-parent/elk-util-common/src/main/java/org/semanticweb/elk/io/IOUtils.java b/elk-util-parent/elk-util-common/src/main/java/org/semanticweb/elk/io/IOUtils.java
index <HASH>..<HASH> 100644
--- a/elk-util-parent/elk-util-common/src/main/java/org/semanticweb/elk/io/IOUtils.java
+++ b/elk-util-parent/elk-util-common/src/main/java/org/semanticweb/elk/io/IOUtils.java
@@ -30,6 +30,7 @@ import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
+import java.io.OutputStream;
import java.net.URI;
import java.net.URL;
import java.security.CodeSource;
@@ -54,6 +55,14 @@ public class IOUtils {
}
}
+ public static void closeQuietly(OutputStream stream) {
+ if (stream != null) {
+ try {
+ stream.close();
+ } catch (IOException e) {}
+ }
+ }
+
public static List<String> getResourceNamesFromDir(File dir, String extension) {
List<String> testResources = new ArrayList<String>(); | a method to quietly close all output streams (as it's done for input stream). | liveontologies_elk-reasoner | train | java |
1b2197d68340953c15ba191544866331eab1bff2 | diff --git a/lib/parse/model/model.rb b/lib/parse/model/model.rb
index <HASH>..<HASH> 100644
--- a/lib/parse/model/model.rb
+++ b/lib/parse/model/model.rb
@@ -91,8 +91,8 @@ class String
end;
#users for properties: ex. :users -> "_User" or :songs -> Song
- def to_parse_class
- final_class = self.singularize.camelize
+ def to_parse_class(singularize: false)
+ final_class = singularize ? self.singularize.camelize : self.camelize
klass = Parse::Model.find_class(final_class) || Parse::Model.find_class(self)
#handles the case that a class has a custom parse table
final_class = klass.parse_class if klass.present?
@@ -114,7 +114,7 @@ class Symbol
to_s.camelize
end
- def to_parse_class
- to_s.to_parse_class
+ def to_parse_class(singularize: false)
+ to_s.to_parse_class(singularize: singularize)
end
end | The use of singularize is now optional.
Off by default | modernistik_parse-stack | train | rb |
b300614d2c166574e73fc1e1dc5563ac3f84ae89 | diff --git a/lib/test.js b/lib/test.js
index <HASH>..<HASH> 100644
--- a/lib/test.js
+++ b/lib/test.js
@@ -1267,7 +1267,7 @@ class Test extends Base {
}
resolves (promise, message, extra) {
- this.currentAssert = Test.prototype.rejects
+ this.currentAssert = Test.prototype.resolves
if (message && typeof message === 'object')
extra = message, message = ''
@@ -1304,7 +1304,7 @@ class Test extends Base {
}
resolveMatch (promise, wanted, message, extra) {
- this.currentAssert = Test.prototype.rejects
+ this.currentAssert = Test.prototype.resolveMatch
if (message && typeof message === 'object')
extra = message, message = '' | correct currentAssert in t.resolves/resolveMatch | tapjs_node-tap | train | js |
26e01abfae38da15959d92d66d9b4a3ae345ee0e | diff --git a/src/Composer/Compiler.php b/src/Composer/Compiler.php
index <HASH>..<HASH> 100644
--- a/src/Composer/Compiler.php
+++ b/src/Composer/Compiler.php
@@ -118,7 +118,7 @@ class Compiler
$finder = new Finder();
$finder->files()
->ignoreVCS(true)
- ->notPath('/\/(composer\.(json|lock)|[A-Z]+\.md|\.gitignore|appveyor.yml|phpunit\.xml\.dist|phpstan\.neon\.dist|phpstan-config\.neon|phpstan-baseline\.neon)$/')
+ ->notPath('/\/(composer\.(json|lock)|[A-Z]+\.md(?:own)?|\.gitignore|appveyor.yml|phpunit\.xml\.dist|phpstan\.neon\.dist|phpstan-config\.neon|phpstan-baseline\.neon)$/')
->notPath('/bin\/(jsonlint|validate-json|simple-phpunit|phpstan|phpstan\.phar)(\.bat)?$/')
->notPath('justinrainbow/json-schema/demo/')
->notPath('justinrainbow/json-schema/dist/') | Fix handling of .mdown files in phar compiler | composer_composer | train | php |
e1687414195769ac16bd4ca7954565b253d83181 | diff --git a/src/jquery.fancytree.wide.js b/src/jquery.fancytree.wide.js
index <HASH>..<HASH> 100644
--- a/src/jquery.fancytree.wide.js
+++ b/src/jquery.fancytree.wide.js
@@ -143,7 +143,7 @@ $.ui.fancytree.registerExtension({
}
this._local.measureUnit = iconWidthUnit;
this._local.levelOfs = parseFloat(levelOfs);
- this._local.lineOfs = (ctx.options.checkbox ? 3 : 2) * (iconWidth + iconSpacing) + iconSpacing;
+ this._local.lineOfs = (1 + (ctx.options.checkbox ? 1 : 0) + (ctx.options.icons ? 1 : 0)) * (iconWidth + iconSpacing) + iconSpacing;
this._local.maxDepth = 10;
// Get/Set a unique Id on the container (if not already exists) | Check if the user is using icons or checkboxes
The old version only checked for checkboxes, so if the user had icons disabled it would mess up formatting. This commit fixes that. | mar10_fancytree | train | js |
a50c348f3463d3a33cebec2d8cbad0b23c6c8e6f | diff --git a/lib/processes.js b/lib/processes.js
index <HASH>..<HASH> 100644
--- a/lib/processes.js
+++ b/lib/processes.js
@@ -156,9 +156,21 @@ function services(srv, callback) {
srvs = srvString.split('|');
}
} catch (f) {
- // allSrv = [];
- srvString = '';
- srvs = [];
+ try {
+ const tmpsrv = execSync('systemctl --type=service --no-legend 2> /dev/null').toString().split('\n');
+ srvs = [];
+ for (const s of tmpsrv) {
+ const name = s.split('.service')[0];
+ if (name) {
+ srvs.push(name);
+ }
+ }
+ srvString = srvs.join('|');
+ } catch (g) {
+ // allSrv = [];
+ srvString = '';
+ srvs = [];
+ }
}
}
} | added service list on RHEL, CentOS 7.x/8.x | sebhildebrandt_systeminformation | train | js |
d7d1bdd97a2fa88da44321815b53eabd79dcde95 | diff --git a/lib/Doctrine/Hydrate.php b/lib/Doctrine/Hydrate.php
index <HASH>..<HASH> 100644
--- a/lib/Doctrine/Hydrate.php
+++ b/lib/Doctrine/Hydrate.php
@@ -855,9 +855,9 @@ class Doctrine_Hydrate implements Serializable
$relation = $this->_aliasMap[$cache[$key]['alias']]['relation'];
// check the type of the relation
if ( ! $relation->isOneToOne()) {
- if ($prev[$parent][$component] instanceof Doctrine_Record) {
+ /*if ($prev[$parent][$component] instanceof Doctrine_Record) {
throw new Exception();
- }
+ }*/
$prev[$parent][$component][] = $element;
$driver->registerCollection($prev[$parent][$component]);
@@ -894,7 +894,8 @@ class Doctrine_Hydrate implements Serializable
}
}
foreach ($currData as $alias => $data) {
- $componentName = $this->_aliasMap[$alias]['table']->getComponentName();
+ $table = $this->_aliasMap[$alias]['table'];
+ $componentName = $table->getComponentName();
// component changed
$identifiable = $driver->isIdentifiable($currData[$alias], $table); | Bugfix for parseData2(). Unrelated to the issues mentioned in my previous commit. | doctrine_annotations | train | php |
08288e79f5933cc1a7d227dd4c6aba6163bd0149 | diff --git a/spyder_kernels/_version.py b/spyder_kernels/_version.py
index <HASH>..<HASH> 100644
--- a/spyder_kernels/_version.py
+++ b/spyder_kernels/_version.py
@@ -8,5 +8,5 @@
"""Version File."""
-VERSION_INFO = (1, 6, 0)
+VERSION_INFO = (1, 7, 0, 'dev0')
__version__ = '.'.join(map(str, VERSION_INFO)) | Back to work
[ci skip] | spyder-ide_spyder-kernels | train | py |
ff1eff68c2b4cca76f813ff83b11df046a38b68c | diff --git a/WeaveData/src/WeavePathData.js b/WeaveData/src/WeavePathData.js
index <HASH>..<HASH> 100644
--- a/WeaveData/src/WeavePathData.js
+++ b/WeaveData/src/WeavePathData.js
@@ -27,6 +27,21 @@ weave.WeavePath.qkeyToIndex = function(key)
return this._qkeys_to_numeric[key_str];
};
+function toArray(args)
+{
+ var array = [];
+ for (var i = 0; i < args.length; i++)
+ array[i] = args[i];
+ return array;
+}
+
+if (!Function.prototype.bind)
+ Function.prototype.bind = function(/* that, ...args */):Function
+ {
+ var args = toArray(arguments), that = args.shift();
+ return function():*{ return this.apply(that, args.concat(toArray(arguments))); };
+ }
+
weave.WeavePath.prototype.qkeyToIndex = weave.WeavePath.qkeyToIndex.bind(weave.WeavePath);
weave.WeavePath.indexToQKey = function (index) | added shim for missing JS Function.bind() | WeaveTeam_WeaveJS | train | js |
6b68f426d945be8b7c3498025b1251b8d2410fb5 | diff --git a/pythonforandroid/recipes/librt/__init__.py b/pythonforandroid/recipes/librt/__init__.py
index <HASH>..<HASH> 100644
--- a/pythonforandroid/recipes/librt/__init__.py
+++ b/pythonforandroid/recipes/librt/__init__.py
@@ -19,7 +19,7 @@ class LibRt(Recipe):
finishes'''
def build_arch(self, arch):
- libc_path = join(arch.ndk_platform, 'usr', 'lib', 'libc')
+ libc_path = join(arch.ndk_lib_dir, 'usr', 'lib', 'libc')
# Create a temporary folder to add to link path with a fake librt.so:
fake_librt_temp_folder = join(
self.get_build_dir(arch.arch), | changed arch.ndk_platform to arch.ndk_lib_dir
fix for
```python
AttributeError: 'ArchARMv7_a' object has no attribute 'ndk_platform'
``` | kivy_python-for-android | train | py |
6c27717b19235681842961c7a3a5bf9bd717052a | diff --git a/lib/rain/deployer.rb b/lib/rain/deployer.rb
index <HASH>..<HASH> 100644
--- a/lib/rain/deployer.rb
+++ b/lib/rain/deployer.rb
@@ -24,7 +24,7 @@ module Rain
run_cmd("git tag #{tag.to_s}")
push_tag(tag)
else
- say "Deploying existing tag #{GitTools::ReleaseTag.current} to '#{environment}'."
+ say "Deploying existing tag #{GitTools::ReleaseTag.current("stage")} to '#{environment}'."
end
run_cmd "bundle exec cap to_#{environment} deploy" | Deploy the latest stage, not the current prod | eLocal_rain | train | rb |
b3ac874100ac8ac2f6b0df47e39395d3ea88c1f8 | diff --git a/sonar-server/src/main/java/org/sonar/server/permission/InternalPermissionTemplateService.java b/sonar-server/src/main/java/org/sonar/server/permission/InternalPermissionTemplateService.java
index <HASH>..<HASH> 100644
--- a/sonar-server/src/main/java/org/sonar/server/permission/InternalPermissionTemplateService.java
+++ b/sonar-server/src/main/java/org/sonar/server/permission/InternalPermissionTemplateService.java
@@ -144,7 +144,7 @@ public class InternalPermissionTemplateService implements ServerComponent {
List<PermissionTemplateDto> existingTemplates = permissionDao.selectAllPermissionTemplates();
if(existingTemplates != null) {
for (PermissionTemplateDto existingTemplate : existingTemplates) {
- if((templateId == null || templateId != existingTemplate.getId()) && (existingTemplate.getName().equals(templateName))) {
+ if((templateId == null || !existingTemplate.getId().equals(templateId)) && (existingTemplate.getName().equals(templateName))) {
String errorMsg = "A template with that name already exists";
LOG.error(errorMsg);
throw new BadRequestException(errorMsg); | SONAR-<I> Fixed quality issue | SonarSource_sonarqube | train | java |
513b0104a995dd7a0cad4d38ea367197d0eaabd3 | diff --git a/src/Composer/ArtifactsPlugin.php b/src/Composer/ArtifactsPlugin.php
index <HASH>..<HASH> 100644
--- a/src/Composer/ArtifactsPlugin.php
+++ b/src/Composer/ArtifactsPlugin.php
@@ -29,7 +29,7 @@ class ArtifactsPlugin implements PluginInterface
{
$packagesDir = $composer->getConfig()->get('data-dir').'/packages';
- if (!is_dir($packagesDir)) {
+ if (!is_dir($packagesDir) || !class_exists(\ZipArchive::class)) {
return;
} | Bypass artifacts plugin if ext-zip is not installed | contao_manager-plugin | train | php |
a37fe92df48e0e622f2b8eead01aa0c66ea5ee81 | diff --git a/lib/percheron/cli/main_command.rb b/lib/percheron/cli/main_command.rb
index <HASH>..<HASH> 100644
--- a/lib/percheron/cli/main_command.rb
+++ b/lib/percheron/cli/main_command.rb
@@ -1,6 +1,6 @@
module Percheron
module CLI
- class MainCommand < Clamp::Command
+ class MainCommand < AbstractCommand
subcommand 'list', "List stacks and it's containers", ListCommand
subcommand 'start', 'Start a stack', StartCommand
end | MainCommand needs to < AbstractCommand so -c is available to all subcommands | ashmckenzie_percheron | train | rb |
83583023d19ba36983f74477a9c237c4bfb13622 | diff --git a/lib/userlist/push/resource.rb b/lib/userlist/push/resource.rb
index <HASH>..<HASH> 100644
--- a/lib/userlist/push/resource.rb
+++ b/lib/userlist/push/resource.rb
@@ -67,9 +67,10 @@ module Userlist
def to_hash
Serializer.serialize(self)
end
+ alias to_h to_hash
- def to_h
- to_hash
+ def to_json(*args)
+ to_hash.to_json(*args)
end
def url | Add Userlist::Push::Resource#to_json to fix serialization accross different JSON implementations | userlistio_userlist-ruby | train | rb |
3fa6faf98ee367b148e800e1cad4f7323876139c | diff --git a/js/tabs.js b/js/tabs.js
index <HASH>..<HASH> 100644
--- a/js/tabs.js
+++ b/js/tabs.js
@@ -132,7 +132,9 @@
if (!clicked) {
var prev_index = index;
index = $tabs_wrapper.index(item);
+ $active.removeClass('active');
$active = $links.eq(index);
+ $active.addClass('active');
animateIndicator(prev_index);
if (typeof(options.onShow) === "function") {
options.onShow.call($this[0], $content); | Fixed active bug on swipeable tabs | Dogfalo_materialize | train | js |
acaeb740697fab6201c69ec5fb35f36438228988 | diff --git a/src/utils/get-coords.spec.js b/src/utils/get-coords.spec.js
index <HASH>..<HASH> 100644
--- a/src/utils/get-coords.spec.js
+++ b/src/utils/get-coords.spec.js
@@ -6,6 +6,7 @@ import getCoords from './get-coords';
test('should return null when no coordinates were found ', (t) => {
t.deepEqual(
+ // $FlowFixMe: Find a way of simulating an actual synthetic react event
getCoords(new FocusEvent('focus')),
null,
);
@@ -15,6 +16,7 @@ test('should return the coords when it\'s a mouse event', (t) => {
// Simulated mouse event
const ev = new MouseEvent('mousedown');
+ // $FlowFixMe: Find a way of simulating an actual synthetic react event
t.deepEqual(getCoords(ev), {
x: ev.clientX,
y: ev.clientY,
@@ -30,6 +32,7 @@ test('should return the coords when it\'s a touch event', (t) => {
}],
});
+ // $FlowFixMe: Find a way of simulating an actual synthetic react event
t.deepEqual(getCoords(ev), {
x: ev.touches[0].clientX,
y: ev.touches[0].clientY, | Suppress flow warnings in getCoords test as there is no way of creating a simulated synthetic event | HenriBeck_materialize-react | train | js |
39fdfa00eb9b171bb440e24222bd1d2a5ef372e1 | diff --git a/lib/veritas/relation/operation/order/direction.rb b/lib/veritas/relation/operation/order/direction.rb
index <HASH>..<HASH> 100644
--- a/lib/veritas/relation/operation/order/direction.rb
+++ b/lib/veritas/relation/operation/order/direction.rb
@@ -26,15 +26,15 @@ module Veritas
self.class.reverse.new(attribute)
end
+ def ==(other)
+ eql?(other)
+ end
+
def eql?(other)
instance_of?(other.class) &&
attribute.eql?(other.attribute)
end
- def ==(other)
- eql?(other)
- end
-
def hash
attribute.hash
end | Prefer #eql? and #hash definitions together in the source | dkubb_axiom | train | rb |
3549e29c381ba8381ad1009c01bd363c689d7cf2 | diff --git a/packages/pob/lib/generators/common/babel/index.js b/packages/pob/lib/generators/common/babel/index.js
index <HASH>..<HASH> 100644
--- a/packages/pob/lib/generators/common/babel/index.js
+++ b/packages/pob/lib/generators/common/babel/index.js
@@ -569,7 +569,9 @@ module.exports = class BabelGenerator extends Generator {
/* webpack 5 and node with ESM support */
if (useBabel) {
- pkg.exports = {};
+ pkg.exports = {
+ './package.json': './package.json',
+ };
this.entries.forEach((entry) => {
const isBrowserOnly = | feat: exports package.json by default | christophehurpeau_pob-lerna | train | js |
961df90ecdde407bdbe27e41a5f6bd6fe4bfd45c | diff --git a/lib/cancan/inherited_resource.rb b/lib/cancan/inherited_resource.rb
index <HASH>..<HASH> 100644
--- a/lib/cancan/inherited_resource.rb
+++ b/lib/cancan/inherited_resource.rb
@@ -3,16 +3,16 @@ module CanCan
class InheritedResource < ControllerResource # :nodoc:
def load_resource_instance
if parent?
- @controller.parent
+ @controller.send :parent
elsif new_actions.include? @params[:action].to_sym
- @controller.build_resource
+ @controller.send :build_resource
else
- @controller.resource
+ @controller.send :resource
end
end
def resource_base
- @controller.end_of_association_chain
+ @controller.send :end_of_association_chain
end
end
end | Controllers which use 'inherit_resources' instead of Inheritance may have inherited_resource's methods protected | ryanb_cancan | train | rb |
caa22298a182f62423dab2429804133cb72a17c4 | diff --git a/cartoframes/context.py b/cartoframes/context.py
index <HASH>..<HASH> 100644
--- a/cartoframes/context.py
+++ b/cartoframes/context.py
@@ -1,4 +1,5 @@
"""CartoContext and BatchJobStatus classes"""
+from __future__ import absolute_import
import json
import os
import random
@@ -20,11 +21,11 @@ from carto.exceptions import CartoException
from carto.datasets import DatasetManager
from pyrestcli.exceptions import NotFoundException
-from cartoframes.credentials import Credentials
-from cartoframes.dataobs import get_countrytag
-from cartoframes import utils
-from cartoframes.layer import BaseMap, AbstractLayer
-from cartoframes.maps import (non_basemap_layers, get_map_name,
+from .credentials import Credentials
+from .dataobs import get_countrytag
+from . import utils
+from .layer import BaseMap, AbstractLayer
+from .maps import (non_basemap_layers, get_map_name,
get_map_template, top_basemap_layer_url)
from cartoframes.__version__ import __version__ | add absolute_import to make imports clearer | CartoDB_cartoframes | train | py |
2fcfee853444b56fc3c5a7007b903b89457352b5 | diff --git a/consumer.go b/consumer.go
index <HASH>..<HASH> 100644
--- a/consumer.go
+++ b/consumer.go
@@ -3,6 +3,7 @@ package cony
import (
"fmt"
"os"
+ "sync"
"github.com/streadway/amqp"
)
@@ -21,6 +22,8 @@ type Consumer struct {
exclusive bool
noLocal bool
stop chan struct{}
+ dead bool
+ m sync.Mutex
}
// Deliveries return deliveries shipped to this consumer
@@ -36,9 +39,13 @@ func (c *Consumer) Errors() <-chan error {
// Cancel this consumer
func (c *Consumer) Cancel() {
- select {
- case c.stop <- struct{}{}:
- default:
+ c.m.Lock()
+ defer c.m.Unlock()
+
+ if !c.dead {
+ close(c.deliveries)
+ close(c.stop)
+ c.dead = true
}
} | Consumer will close its delivery channel once Close()-ed
* Close deliveries channel
* Guard closing channel with mutex and condition | assembla_cony | train | go |
104fda5667b87019f9ead73c34f3ffa4d1bf03e9 | diff --git a/src/dna-template-component.js b/src/dna-template-component.js
index <HASH>..<HASH> 100644
--- a/src/dna-template-component.js
+++ b/src/dna-template-component.js
@@ -30,7 +30,7 @@ export const TemplateMixin = (SuperClass) => class extends SuperClass {
constructor() {
super();
let template = this.constructor.template;
- if (template) {
+ if (template && !this.hasOwnProperty('template')) {
if (typeof template === 'string') {
template = new Template(template);
Object.defineProperty(this.constructor, 'template', {
@@ -42,9 +42,13 @@ export const TemplateMixin = (SuperClass) => class extends SuperClass {
value: template.clone().setScope(this),
});
}
- this.observeProperties(() => {
- this.render();
- });
+ }
+ if (this.hasOwnProperty('template')) {
+ if (this.observeProperties) {
+ this.observeProperties(() => {
+ this.render();
+ });
+ }
this.render();
}
} | refactor: improve template property handling | chialab_dna | train | js |
fc3b0516491a1217fe6443aaee36f8ae88dda268 | diff --git a/src/L.Control.Locate.js b/src/L.Control.Locate.js
index <HASH>..<HASH> 100644
--- a/src/L.Control.Locate.js
+++ b/src/L.Control.Locate.js
@@ -1,3 +1,9 @@
+/*
+Copyright (c) 2013 Dominik Moritz
+
+This file is part of the leaflet locate control. It is licensed under the MIT license.
+You can find the project at: https://github.com/domoritz/leaflet-locatecontrol
+*/
L.Control.Locate = L.Control.extend({
options: {
position: 'topleft', | Add notice about origin to main js file | domoritz_leaflet-locatecontrol | train | js |
6e000c2b26131e120b888e3404076d60fa1a3485 | diff --git a/lib/Github/HttpClient/Message/ResponseMediator.php b/lib/Github/HttpClient/Message/ResponseMediator.php
index <HASH>..<HASH> 100644
--- a/lib/Github/HttpClient/Message/ResponseMediator.php
+++ b/lib/Github/HttpClient/Message/ResponseMediator.php
@@ -46,5 +46,7 @@ class ResponseMediator
if (null !== $remainingCalls && 1 > $remainingCalls) {
throw new ApiLimitExceedException($remainingCalls);
}
+
+ return $remainingCalls;
}
} | Add the missing return statement
Simply return the 'X-RateLimit-Remaining' as expected. | KnpLabs_php-github-api | train | php |
e29e3ce115766ef31f38c7e43cb61b8115aeeac0 | diff --git a/bundles/org.eclipse.orion.client.core/web/orion/commonHTMLFragments.js b/bundles/org.eclipse.orion.client.core/web/orion/commonHTMLFragments.js
index <HASH>..<HASH> 100644
--- a/bundles/org.eclipse.orion.client.core/web/orion/commonHTMLFragments.js
+++ b/bundles/org.eclipse.orion.client.core/web/orion/commonHTMLFragments.js
@@ -66,7 +66,7 @@ define(['require'],
'<div class="layoutRight" id="statusPane"></div>' +
'<div class="layoutRight pageActions" id="pageNavigationActions"></div>' +
'<div id="notificationArea" class="layoutLeft layoutBlock slideContainer">' +
- '<div class="layoutLeft" id="notifications"></div>' +
+ '<div class="layoutLeft" id="notifications" aria-live="assertive" aria-atomic="true"></div>' +
// still need to hook it up and get correct icon '<div class="layoutRight core-sprite-delete imageSprite" id="close"></div>' +
'</div>' +
'<div id="parameterArea" class="layoutBlock slideParameters slideContainer">' + | Fix bug <I> - Status Messages cannot be read by screen reader | eclipse_orion.client | train | js |
3b4248ef6f2be7da33a135a2d084ddbfde0c1213 | diff --git a/ext/memory/src/main/java/org/minimalj/repository/memory/InMemoryRepository.java b/ext/memory/src/main/java/org/minimalj/repository/memory/InMemoryRepository.java
index <HASH>..<HASH> 100644
--- a/ext/memory/src/main/java/org/minimalj/repository/memory/InMemoryRepository.java
+++ b/ext/memory/src/main/java/org/minimalj/repository/memory/InMemoryRepository.java
@@ -179,9 +179,9 @@ public class InMemoryRepository implements Repository {
Object value = field.get(object);
if (field.getAnnotation(NotEmpty.class) != null) {
if (value == null) {
- throw new IllegalArgumentException();
+ throw new IllegalArgumentException(field.getName() + " must not be null");
} else if (value instanceof String && ((String)value).isEmpty()) {
- throw new IllegalArgumentException();
+ throw new IllegalArgumentException(field.getName() + " must not be empty");
}
} | InMemoryRepository: more meaningful exceptions for invalid fields | BrunoEberhard_minimal-j | train | java |
29c56a5831cc7c97c85b46b7f53c5b43bf2c08f9 | diff --git a/lib/arel/session.rb b/lib/arel/session.rb
index <HASH>..<HASH> 100644
--- a/lib/arel/session.rb
+++ b/lib/arel/session.rb
@@ -11,26 +11,23 @@ module Arel
@instance = nil
end
- module CRUD
- def create(insert)
- insert.call
- end
+ def create(insert)
+ insert.call
+ end
- def read(select)
- @read ||= {}
- key = select.object_id
- return @read[key] if @read.key? key
- @read[key] = select.call
- end
+ def read(select)
+ @read ||= {}
+ key = select.object_id
+ return @read[key] if @read.key? key
+ @read[key] = select.call
+ end
- def update(update)
- update.call
- end
+ def update(update)
+ update.call
+ end
- def delete(delete)
- delete.call
- end
+ def delete(delete)
+ delete.call
end
- include CRUD
end
end
diff --git a/spec/algebra/unit/session/session_spec.rb b/spec/algebra/unit/session/session_spec.rb
index <HASH>..<HASH> 100644
--- a/spec/algebra/unit/session/session_spec.rb
+++ b/spec/algebra/unit/session/session_spec.rb
@@ -30,7 +30,7 @@ module Arel
end
end
- describe Session::CRUD do
+ describe 'session crud' do
before do
@insert = Insert.new(@relation, @relation[:name] => 'nick')
@update = Update.new(@relation, @relation[:name] => 'nick') | CRUD is not being reused, so we should not expose it | rails_rails | train | rb,rb |
d4f14313f39da61143c8bd71666557863ac7d9e8 | diff --git a/src/wa_kat/zeo/request_info.py b/src/wa_kat/zeo/request_info.py
index <HASH>..<HASH> 100755
--- a/src/wa_kat/zeo/request_info.py
+++ b/src/wa_kat/zeo/request_info.py
@@ -105,7 +105,25 @@ class RequestInfo(Persistent):
@transaction_manager
def get_log(self):
- return "\n".join(
+ # create banlist
+ banlist = set(worker_mapping().keys())
+ banlist.add("index")
+
+ # log the state of properties in RequestInfo, except thos in banlist
+ property_status = [
+ " %s=%s," % (key, repr(val))
+ for key, val in self.__dict__.items()
+ if not key.startswith("_") and key not in banlist
+ ]
+
+ # construct the namedtuple-like view on data
+ status = "%s(\n%s\n)\n---\n" % (
+ self.__class__.__name__,
+ "\n".join(property_status),
+ )
+
+ # add logged messages
+ return status + "\n".join(
"%s: %s" % (str(timestamp), self._log[timestamp])
for timestamp in sorted(self._log.keys())
) | #<I>: Log improved. | WebarchivCZ_WA-KAT | train | py |
7612adce9092c308b999fe4e470f0c4236894776 | diff --git a/src/main/java/moa/tasks/EvaluatePeriodicHeldOutTest.java b/src/main/java/moa/tasks/EvaluatePeriodicHeldOutTest.java
index <HASH>..<HASH> 100644
--- a/src/main/java/moa/tasks/EvaluatePeriodicHeldOutTest.java
+++ b/src/main/java/moa/tasks/EvaluatePeriodicHeldOutTest.java
@@ -169,7 +169,9 @@ public class EvaluatePeriodicHeldOutTest extends MainTask {
if (totalTrainTime > this.trainTimeOption.getValue()) {
break;
}
- //testStream.restart();
+ if (this.cacheTestOption.isSet()) {
+ testStream.restart();
+ }
evaluator.reset();
long testInstancesProcessed = 0;
monitor.setCurrentActivityDescription("Testing (after " | Updated EvaluatePeriodicHeldOutTest | Waikato_moa | train | java |
1e55c69a32f51667535e52890b58728bc622c53b | diff --git a/src/ol/source/geojsonsource.js b/src/ol/source/geojsonsource.js
index <HASH>..<HASH> 100644
--- a/src/ol/source/geojsonsource.js
+++ b/src/ol/source/geojsonsource.js
@@ -9,6 +9,7 @@ goog.require('ol.source.VectorFile');
* @constructor
* @extends {ol.source.VectorFile}
* @param {olx.source.GeoJSONOptions=} opt_options Options.
+ * @todo stability experimental
*/
ol.source.GeoJSON = function(opt_options) { | Add stability annotation to ol.source.GeoJSON | openlayers_openlayers | train | js |
5ffbd7cc92d5ad17c030419a210f96cfd2371ff9 | diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -4,12 +4,7 @@ appinstance
Active8 (04-03-15)
license: GNU-GPL2
"""
-from __future__ import unicode_literals
-from __future__ import print_function
-from __future__ import division
-from __future__ import absolute_import
-from future import standard_library
-standard_library.install_aliases()
+
from setuptools import setup
setup(name='consoleprinter',
version='16', | appinstance
Friday <I> March <I> (week:9 day:<I>), <I>:<I>:<I> | erikdejonge_consoleprinter | train | py |
1dd5cf80b91d3f9d0770770fb8385345a396e8ed | diff --git a/grails-core/src/main/groovy/org/codehaus/groovy/grails/exceptions/DefaultStackTraceFilterer.java b/grails-core/src/main/groovy/org/codehaus/groovy/grails/exceptions/DefaultStackTraceFilterer.java
index <HASH>..<HASH> 100644
--- a/grails-core/src/main/groovy/org/codehaus/groovy/grails/exceptions/DefaultStackTraceFilterer.java
+++ b/grails-core/src/main/groovy/org/codehaus/groovy/grails/exceptions/DefaultStackTraceFilterer.java
@@ -35,6 +35,7 @@ public class DefaultStackTraceFilterer implements StackTraceFilterer {
public static final Log STACK_LOG = LogFactory.getLog("StackTrace");
private static final String[] DEFAULT_INTERNAL_PACKAGES = new String[] {
+ "org.grails.plugin.resource.DevMode",
"org.codehaus.groovy.grails.",
"gant.",
"org.codehaus.groovy.runtime.", | filter resources plugin DevModeSanityFilter by default | grails_grails-core | train | java |
6367b96a2ab596f8dcff6aff1e35d0be8b043811 | diff --git a/lib/less/rhino.js b/lib/less/rhino.js
index <HASH>..<HASH> 100644
--- a/lib/less/rhino.js
+++ b/lib/less/rhino.js
@@ -188,14 +188,15 @@ function writeFile(filename, content) {
return false;
}
- if (match = arg.match(/^--?([a-z][0-9a-z-]*)(?:=(.*))?$/i)) { arg = match[1] } // was (?:=([^\s]*)), check!
- else { return arg }
+ if (match = arg.match(/^--?([a-z][0-9a-z-]*)(?:=(.*))?$/i)) { arg = match[1]; } // was (?:=([^\s]*)), check!
+ else { return arg; }
switch (arg) {
case 'v':
case 'version':
console.log("lessc " + less.version.join('.') + " (LESS Compiler) [JavaScript]");
continueProcessing = false;
+ break;
case 'verbose':
options.verbose = true;
break;
@@ -215,6 +216,7 @@ function writeFile(filename, content) {
//TODO
// require('../lib/less/lessc_helper').printUsage();
continueProcessing = false;
+ break;
case 'x':
case 'compress':
options.compress = true; | fixed some jshint errors | less_less.js | train | js |
21eddb11194e5146b01a41ed02e596e6b5f6466e | diff --git a/src/index.js b/src/index.js
index <HASH>..<HASH> 100644
--- a/src/index.js
+++ b/src/index.js
@@ -1,3 +1,5 @@
+#!/usr/bin/env/node
+
import modules from './modules/';
import MupAPI from './mup-api';
import checkUpdates from './updates'; | Add hash-bang line to cli file | zodern_meteor-up | train | js |
dac2174f189f2d08cfb103f78c7f643e59caf64f | diff --git a/src/Piano.js b/src/Piano.js
index <HASH>..<HASH> 100644
--- a/src/Piano.js
+++ b/src/Piano.js
@@ -27,7 +27,7 @@ class Piano extends React.Component {
};
state = {
- activeNotes: [],
+ activeNotes: this.props.activeNotes || [],
};
componentDidUpdate(prevProps) { | make Piano use activeNotes prop for initial state | kevinsqi_react-piano | train | js |
Subsets and Splits