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 |
|---|---|---|---|---|---|
b06c4518f3c9d9d0ba45acbab87e62670ff8c834 | diff --git a/host/calibrate_pulser_dac_correction.py b/host/calibrate_pulser_dac_correction.py
index <HASH>..<HASH> 100644
--- a/host/calibrate_pulser_dac_correction.py
+++ b/host/calibrate_pulser_dac_correction.py
@@ -33,7 +33,8 @@ class PulserDacCorrectionCalibration(ThresholdScan):
with tb.open_file(self.scan_data_filename + "_interpreted.h5") as t:
thr = t.root.HistThresholdFitted[:]
- corr = [thr[:, i * 2 + 1:i * 2 + 3].mean() for i in range(0, 38)]
+ thr_masked = np.ma.masked_where(np.isclose(thr, 0), thr)
+ corr = [thr_masked[:, i * 2 + 1:i * 2 + 3].mean() for i in range(0, 38)]
corr = np.array(corr)
corr -= corr.min()
corr = np.around(corr).astype(int) | BUG: when calculating men threshold, mask pixels with 0 | SiLab-Bonn_pyBAR | train | py |
1452facb25aeb380d0839a0f6f8cd2aee458a699 | diff --git a/ryu/ofproto/ofproto_v1_5_parser.py b/ryu/ofproto/ofproto_v1_5_parser.py
index <HASH>..<HASH> 100644
--- a/ryu/ofproto/ofproto_v1_5_parser.py
+++ b/ryu/ofproto/ofproto_v1_5_parser.py
@@ -5888,12 +5888,14 @@ class OFPActionCopyField(OFPAction):
return cls(n_bits, src_offset, dst_offset, oxm_ids, type_, len_)
def serialize(self, buf, offset):
+ oxm_ids_buf = bytearray()
+ for i in self.oxm_ids:
+ oxm_ids_buf += i.serialize()
+ self.len += len(oxm_ids_buf)
msg_pack_into(ofproto.OFP_ACTION_COPY_FIELD_PACK_STR, buf,
offset, self.type, self.len,
self.n_bits, self.src_offset, self.dst_offset)
-
- for i in self.oxm_ids:
- buf += i.serialize()
+ buf += oxm_ids_buf
@OFPAction.register_action_type(ofproto.OFPAT_METER, | ofproto_v1_5_parser: Fix serialized length of OFPActionCopyField | osrg_ryu | train | py |
a0aaba2c9608c491aaa7199a896ce65574901c33 | diff --git a/scp.go b/scp.go
index <HASH>..<HASH> 100644
--- a/scp.go
+++ b/scp.go
@@ -30,9 +30,13 @@ func CopyPath(filePath, destinationPath string, session *ssh.Session) error {
func copy(size int64, mode os.FileMode, fileName string, contents io.Reader, destination string, session *ssh.Session) error {
defer session.Close()
+ w, err := session.StdinPipe()
+ if err != nil {
+ return err
+ }
+ defer w.Close()
+
go func() {
- w, _ := session.StdinPipe()
- defer w.Close()
fmt.Fprintf(w, "C%#o %d %s\n", mode, size, fileName)
io.Copy(w, contents)
fmt.Fprint(w, "\x00") | Fixed: the function copy could panic if the goroutine execution starts after the session run method. It could happen before stdin needs to be init before the run of the session. In this pr, we make sure to init the stdin before the run of the session | tmc_scp | train | go |
556f62d50a65567800aa97699e3e5b444700c251 | diff --git a/src/main/java/nl/hsac/fitnesse/fixture/slim/web/BrowserTest.java b/src/main/java/nl/hsac/fitnesse/fixture/slim/web/BrowserTest.java
index <HASH>..<HASH> 100644
--- a/src/main/java/nl/hsac/fitnesse/fixture/slim/web/BrowserTest.java
+++ b/src/main/java/nl/hsac/fitnesse/fixture/slim/web/BrowserTest.java
@@ -1208,8 +1208,12 @@ public class BrowserTest extends SlimFixture {
* @return (escaped) HTML content of current page.
*/
public String pageSource() {
+ String result = null;
String html = getSeleniumHelper().getHtml();
- return "<pre>" + StringEscapeUtils.escapeHtml4(html) + "</pre>";
+ if (html != null) {
+ result = "<pre>" + StringEscapeUtils.escapeHtml4(html) + "</pre>";
+ }
+ return result;
}
/** | Don't break if no HTML can be captured | fhoeben_hsac-fitnesse-fixtures | train | java |
beb414dc5e1a5a8fc4e510f76160f151be22345c | diff --git a/doc/conf.py b/doc/conf.py
index <HASH>..<HASH> 100644
--- a/doc/conf.py
+++ b/doc/conf.py
@@ -52,6 +52,8 @@ extensions = [
'sphinx.ext.coverage',
'sphinx.ext.pngmath',
'sphinx.ext.viewcode',
+ 'sphinx.ext.napoleon', # enable Napoleon Sphinx v>1.3
+ 'sphinx.ext.extlinks' # enables external links with a key
]
# Add any paths that contain templates here, relative to this directory. | add napoleon and extlinks to sphinx conf | openego_eDisGo | train | py |
808b373a79c7f4c53e2688d14efdc176f6b55dcd | diff --git a/src/com/googlecode/objectify/test/BasicTests.java b/src/com/googlecode/objectify/test/BasicTests.java
index <HASH>..<HASH> 100644
--- a/src/com/googlecode/objectify/test/BasicTests.java
+++ b/src/com/googlecode/objectify/test/BasicTests.java
@@ -139,7 +139,7 @@ public class BasicTests extends TestBase
{
Objectify ofy = ObjectifyFactory.begin();
- Trivial parent = new Trivial("parent", 1);
+ Child parent = new Child(null, "1");
ofy.put(parent);
Key parentKey = ObjectifyFactory.createKey(parent); | test still failing with a child as the @parent
git-svn-id: <URL> | objectify_objectify | train | java |
0b0c5c383ae61ae456ea5b97c464d0c6cc978b64 | diff --git a/test/incompatibilities.js b/test/incompatibilities.js
index <HASH>..<HASH> 100644
--- a/test/incompatibilities.js
+++ b/test/incompatibilities.js
@@ -60,7 +60,9 @@ describe("Parser", function() {
// ES5: allows any LeftHandSideExpression on the left of an assignment
// ES6: allows only valid bindings on the left of an assignment
assertParseFailure("a+b=c", "Invalid left-hand side in assignment");
- assertParseSuccess("(a+b)=c");
assertParseFailure("+i = 42", "Invalid left-hand side in assignment");
+ assertParseSuccess("new a=b");
+ assertParseSuccess("(a+b)=c");
+
});
}); | fixes #9: added unparenthesised new a on the left | shapesecurity_shift-parser-js | train | js |
6486c88abfbea80562f3aa3136b6aacd89aa931e | diff --git a/scripts/utils.py b/scripts/utils.py
index <HASH>..<HASH> 100644
--- a/scripts/utils.py
+++ b/scripts/utils.py
@@ -207,4 +207,4 @@ class AlignmentFileTool(object):
indexFilePath = "{}.{}".format(
outputFilePath, AlignmentFileConstants.BAI.lower())
log("Creating index file '{}'".format(indexFilePath))
- runCommand("samtools index {}".format(outputFilePath))
+ pysam.index(outputFilePath) | Replace samtools index runCommand with pysam call
pysam provides the capability to call samtools methods directly...
we should use that instead of using shell commands! | ga4gh_ga4gh-server | train | py |
46500f81cd965a3132d7d3352d0d6ce6b2cc48dc | diff --git a/absl/flags/_validators.py b/absl/flags/_validators.py
index <HASH>..<HASH> 100644
--- a/absl/flags/_validators.py
+++ b/absl/flags/_validators.py
@@ -340,9 +340,8 @@ def mark_flag_as_required(flag_name, flag_values=_flagvalues.FLAGS):
app.run()
Because validation happens at app.run() we want to ensure required-ness
- is enforced at that time. However, you generally do not want to force
- users who import your code to have additional required flags for their
- own binaries or tests.
+ is enforced at that time. You generally do not want to force users who import
+ your code to have additional required flags for their own binaries or tests.
Args:
flag_name: str, name of the flag | Remove 'However' from methoddoc.
The negation/contrast word 'however' may be confusing/misleading since the sentence supports the argument to not introduce required-ness by imports/tests which occurs when this practice is not followed.
PiperOrigin-RevId: <I> | abseil_abseil-py | train | py |
3fa4a7d3ad8a1b976089c648b0403f940360e910 | diff --git a/spock/plugins/plugin_base.py b/spock/plugins/plugin_base.py
index <HASH>..<HASH> 100644
--- a/spock/plugins/plugin_base.py
+++ b/spock/plugins/plugin_base.py
@@ -1,6 +1,12 @@
from ..utils import get_settings
class BasePlugin(object):
+ """A base class for cleaner plugin code.
+
+ Extending from BasePlugin allows you to declare any requirements, default
+ settings, and event listeners in a declarative way. Define the appropriate
+ attributes on your subclass and enjoy cleaner code.
+ """
requires = ()
defaults = {}
events = {} | Added docstring for the BasePlugin | SpockBotMC_SpockBot | train | py |
dcc87602f9bb7fdf8a3b3ae62ce13f61fb157e60 | diff --git a/panels/_version.py b/panels/_version.py
index <HASH>..<HASH> 100644
--- a/panels/_version.py
+++ b/panels/_version.py
@@ -1,2 +1,2 @@
# Versions compliant with PEP 440 https://www.python.org/dev/peps/pep-0440
-__version__ = "0.0.41"
+__version__ = "0.0.42" | Update version number to <I> | chaoss_grimoirelab-sigils | train | py |
faf36875cb3ab6d455e1cc6b882e911118c9986b | diff --git a/src/test/java/org/dynjs/runtime/builtins/RequireTest.java b/src/test/java/org/dynjs/runtime/builtins/RequireTest.java
index <HASH>..<HASH> 100644
--- a/src/test/java/org/dynjs/runtime/builtins/RequireTest.java
+++ b/src/test/java/org/dynjs/runtime/builtins/RequireTest.java
@@ -89,7 +89,7 @@ public class RequireTest {
@Test
public void testSupportsNestedRequires() {
- check("var result = require('outer').quadruple(4);", 16);
+ check("var x = require('outer'); var result = x.quadruple(4);", 16);
}
private void check(String scriptlet, Object expected) { | fixed nested requires
- note that due to current changes on scope
resolution you need to have an intermediate step
for it to work | dynjs_dynjs | train | java |
57e006642af31b0f2c8e1623a487b3249e314f7f | diff --git a/src/Calendar.render.js b/src/Calendar.render.js
index <HASH>..<HASH> 100644
--- a/src/Calendar.render.js
+++ b/src/Calendar.render.js
@@ -237,11 +237,14 @@ Calendar.mixin({
renderView: function(viewType, forcedScroll) {
var oldView = this.view;
+ if (oldView && oldView.type === viewType) {
+ return;
+ }
+
this.freezeContentHeight();
this.ignoreUpdateViewSize++;
- // if viewType is changing, remove the old view's rendering
- if (oldView && viewType && oldView.type !== viewType) {
+ if (oldView) {
this.clearView();
this.destroyBatchRenderingForView(oldView); // do AFTER the clear b/c the clear updates lots of props
} | issue with switching to same view that was already active | fullcalendar_fullcalendar | train | js |
6abd72220b0e4c7b9cede8a1486a5fc928bbcddf | diff --git a/web/ext/authentication/__init__.py b/web/ext/authentication/__init__.py
index <HASH>..<HASH> 100755
--- a/web/ext/authentication/__init__.py
+++ b/web/ext/authentication/__init__.py
@@ -35,11 +35,12 @@ class AuthenticationExtension(object):
if not callable(auth_callback):
raise ValueError('Option "auth_callback" must be a callable, got %r instead' % type(auth_callback))
- if not 'lookup_callback' in options:
- raise ValueError('Missing required option: lookup_callback')
- lookup_callback = options['lookup_callback']
- if not callable(lookup_callback):
- raise ValueError('Option "lookup_callback" must be a callable, got %r instead' % type(lookup_callback))
+ if options['method'] == 'session':
+ if 'lookup_callback' not in options:
+ raise ValueError('Missing required option: lookup_callback')
+ lookup_callback = options['lookup_callback']
+ if not callable(lookup_callback):
+ raise ValueError('Option "lookup_callback" must be a callable, got %r instead' % type(lookup_callback))
realm = options.get('realm')
if isinstance(realm, unicode): | The "lookup" callback is only used with session-based authentication, so
don't require it for other methods. | marrow_WebCore | train | py |
5bdecd403e6c0f3c2628ba0d7a3a4047329c26ee | diff --git a/spec/functional/api_versions_spec.rb b/spec/functional/api_versions_spec.rb
index <HASH>..<HASH> 100644
--- a/spec/functional/api_versions_spec.rb
+++ b/spec/functional/api_versions_spec.rb
@@ -3,6 +3,6 @@ describe "API Versions API", functional: true do
produce_api = kafka.apis.find {|v| v.api_key == 0 }
expect(produce_api.min_version).to eq 0
- expect(produce_api.max_version).to eq 2
+ expect(produce_api.max_version).to be >= 2
end
end | Make the API versions spec work with Kafka <I> as well | zendesk_ruby-kafka | train | rb |
00119a216d62c5f6b047b7f773e8767464ba5423 | diff --git a/src/NewRelicMiddleware.php b/src/NewRelicMiddleware.php
index <HASH>..<HASH> 100644
--- a/src/NewRelicMiddleware.php
+++ b/src/NewRelicMiddleware.php
@@ -74,34 +74,34 @@ class NewRelicMiddleware
/**
* Get the current controller / action
*
- * @param array $route the details about the current route
+ * @param mixed $route the details about the current route
*
* @return string
*/
- protected function getController(array $route)
+ protected function getController($route)
{
- if (isset($route[1]) && isset($route[1]['uses'])) {
+ if (is_array($route) && isset($route[1]) && isset($route[1]['uses'])) {
return $route[1]['uses'];
}
- return 'Closure';
+ return 'index.php';
}
/**
* Get the current route name
*
- * @param array $route the details about the current route
+ * @param mixed $route the details about the current route
*
* @return string
*/
- protected function getRouteName(array $route)
+ protected function getRouteName($route)
{
- if (isset($route[1]) && isset($route[1]['as'])) {
+ if (is_array($route) && isset($route[1]) && isset($route[1]['as'])) {
return $route[1]['as'];
}
- return '';
+ return 'index.php';
}
} | Fix errors when the route information is not an array | digiaonline_lumen-newrelic | train | php |
1fcd799521d2f5c6b73f9703e0e2db17cf137fb8 | diff --git a/blended/__main__.py b/blended/__main__.py
index <HASH>..<HASH> 100644
--- a/blended/__main__.py
+++ b/blended/__main__.py
@@ -299,7 +299,7 @@ def build_files(outdir):
else:
sys.path.insert(0, cwd)
try:
- from config import website_name, website_description, website_language, home_page_list, blended_version
+ from config import website_name, website_description, website_language, home_page_list
except:
sys.exit("Some of the crucial configuration values could not be found! Maybe your config.py is too old. Run 'blended init' to fix.")
try: | possible fix for version issue in a config file | BlendedSiteGenerator_Blended | train | py |
b6f1d2d2a7f4a13f0c664aa53fca7980326a622c | diff --git a/wrapper.js b/wrapper.js
index <HASH>..<HASH> 100644
--- a/wrapper.js
+++ b/wrapper.js
@@ -29,7 +29,13 @@ function setupMethods (soljson) {
var compileInternal = soljson.cwrap('compileJSONCallback', 'string', ['string', 'number', 'number']);
compileJSONCallback = function (input, optimize, readCallback) {
var cb = wrapCallback(readCallback);
- var output = compileInternal(input, optimize, cb);
+ var output;
+ try {
+ output = compileInternal(input, optimize, cb);
+ } catch (e) {
+ soljson.Runtime.removeFunction(cb);
+ throw e;
+ }
soljson.Runtime.removeFunction(cb);
return output;
}; | Catch & rethrow exception so the function pointer can be freed | dexon-foundation_dsolc-js | train | js |
6fa326d9f13fc6705cc071c234a053f663852c8b | diff --git a/test/blend.test.js b/test/blend.test.js
index <HASH>..<HASH> 100644
--- a/test/blend.test.js
+++ b/test/blend.test.js
@@ -381,7 +381,8 @@ describe('mapnik.blend', function() {
if (err) throw err;
var actual = new mapnik.Image.fromBytesSync(result);
//fs.writeFileSync('test/blend-fixtures/actual.jpg',result);
- assert(4000 > expected.compare(actual));
+ // This is so flexible because windows is a PITA
+ assert(6200 > expected.compare(actual));
done();
});
}); | fix for windows test failure [republish binary] | mapnik_node-mapnik | train | js |
ce40b9391a996b8218e1c7b1e83905b8dd4bc1fd | diff --git a/xarray/tutorial.py b/xarray/tutorial.py
index <HASH>..<HASH> 100644
--- a/xarray/tutorial.py
+++ b/xarray/tutorial.py
@@ -39,6 +39,7 @@ external_rasterio_urls = {
file_formats = {
"air_temperature": 3,
"air_temperature_gradient": 4,
+ "ASE_ice_velocity": 4,
"basin_mask": 4,
"ersstv5": 4,
"rasm": 3,
@@ -93,6 +94,7 @@ def open_dataset(
* ``"air_temperature"``: NCEP reanalysis subset
* ``"air_temperature_gradient"``: NCEP reanalysis subset with approximate x,y gradients
* ``"basin_mask"``: Dataset with ocean basins marked using integers
+ * ``"ASE_ice_velocity"``: MEaSUREs InSAR-Based Ice Velocity of the Amundsen Sea Embayment, Antarctica, Version 1
* ``"rasm"``: Output of the Regional Arctic System Model (RASM)
* ``"ROMS_example"``: Regional Ocean Model System (ROMS) output
* ``"tiny"``: small synthetic dataset with a 1D data variable | added ASE ice velocity to tutorial docstring (#<I>) | pydata_xarray | train | py |
7f6a3c97de5491473aa613addb02e55289b9661d | diff --git a/samples/treeview-pivottable-combination.js b/samples/treeview-pivottable-combination.js
index <HASH>..<HASH> 100644
--- a/samples/treeview-pivottable-combination.js
+++ b/samples/treeview-pivottable-combination.js
@@ -857,7 +857,7 @@ var QueryDesignerAxis;
case "vertical":
var rows = dom.rows, n = rows.length, i;
for (i = 1; i < n; i++) {
- rows[i].deleteCell(item + 1);
+ rows[i].deleteCell(item);
}
break;
} | Fixed a one-off bug in remove member. | rpbouman_xmla4js | train | js |
e2fb695e74110a73f4acbd9b5e7b04b40c50e96a | diff --git a/cwl_airflow_parser/cwldag.py b/cwl_airflow_parser/cwldag.py
index <HASH>..<HASH> 100644
--- a/cwl_airflow_parser/cwldag.py
+++ b/cwl_airflow_parser/cwldag.py
@@ -160,6 +160,11 @@ class CWLDAG(DAG):
t.reader_task_id = self.top_task.task_id
def get_output_list(self):
- outputs = {out_val["outputSource"]: out_id for out_id, out_val in self.cwlwf["outputs"].items() if "outputSource" in out_val}
+ outputs = {}
+ for out_id, out_val in self.cwlwf["outputs"].items():
+ if "outputSource" in out_val:
+ outputs[out_val["outputSource"]] = out_id
+ else:
+ outputs[out_id] = out_id
_logger.debug("{0} get_output_list: \n{1}".format(self.dag_id, outputs))
return outputs | Fix bug in getting outputs
If CommandLineTool, there is no any
outputSource field | datirium_cwl-airflow-parser | train | py |
292eecf0add4f160319f3d775c6d8a524c36f62d | diff --git a/examples/geweke.py b/examples/geweke.py
index <HASH>..<HASH> 100644
--- a/examples/geweke.py
+++ b/examples/geweke.py
@@ -157,7 +157,7 @@ def run_geweke_no_subs((seed, num_rows, num_cols, num_iters)):
specified_s_grid=s_grid,
specified_mu_grid=mu_grid,
)
- fu.pickle(dict(X_L=X_L,X_D=X_D), 'X_L_X_D.pkl.gz')
+ # fu.pickle(dict(X_L=X_L,X_D=X_D), 'X_L_X_D.pkl.gz')
for key, func in diagnostics_funcs.iteritems():
diagnostics_data[key].append(func(X_L))
pass
@@ -185,7 +185,7 @@ def run_geweke_no_subs((seed, num_rows, num_cols, num_iters)):
T.clip(-max_magnitude, max_magnitude)
T = T.tolist()
pass
- fu.pickle(T, 'T.pkl.gz')
+ # fu.pickle(T, 'T.pkl.gz')
#
pass
return diagnostics_data | Don't pickle artifcats | probcomp_crosscat | train | py |
1b5837f240ff13fb94b6415f54f1b6344fc84994 | diff --git a/src/Plinth/Main.php b/src/Plinth/Main.php
index <HASH>..<HASH> 100644
--- a/src/Plinth/Main.php
+++ b/src/Plinth/Main.php
@@ -311,7 +311,7 @@ class Main {
$this->getRouter()->loadRoutes(__APP_CONFIG_ROUTING, $public);
}
- if ($this->component !== false) {
+ if ($this->component !== false && $this->component->getRouting() !== false) {
$this->getRouter()->loadRoutes($this->component->getRoutingPath(), $public);
} | Fix for when no routing file is defined | Warsaalk_Plinth | train | php |
9f7470793949f518522faad0d5151214b543c57c | diff --git a/core/src/main/java/com/orientechnologies/orient/core/index/OIndexMultiValues.java b/core/src/main/java/com/orientechnologies/orient/core/index/OIndexMultiValues.java
index <HASH>..<HASH> 100755
--- a/core/src/main/java/com/orientechnologies/orient/core/index/OIndexMultiValues.java
+++ b/core/src/main/java/com/orientechnologies/orient/core/index/OIndexMultiValues.java
@@ -355,11 +355,12 @@ public abstract class OIndexMultiValues extends OIndexAbstract<Collection<ORID>>
return sortedKeys.stream().flatMap((key) -> {
key = getCollatingValue(key);
+ final Object entryKey = key;
acquireSharedLock();
try {
while (true) {
try {
- return storage.iterateIndexEntriesBetween(indexId, key, true, key, true, ascSortOrder, MultiValuesTransformer.INSTANCE);
+ return ((Collection<ORID>) storage.getIndexValue(indexId, key)).stream().map((rid) -> new ORawPair<>(entryKey, rid));
} catch (OInvalidIndexEngineIdException ignore) {
doReloadIndexEngine();
} | Get entries in multi-value index supports hash index. | orientechnologies_orientdb | train | java |
bf3a7a933bdef877322fd61c1f09a180064ba7eb | diff --git a/src/hooks.js b/src/hooks.js
index <HASH>..<HASH> 100755
--- a/src/hooks.js
+++ b/src/hooks.js
@@ -6,7 +6,7 @@ const { checkContext } = require('feathers-hooks-common');
const { getLongToken, getShortToken } = require('./helpers');
module.exports.addVerification = path => hook => {
- checkContext(hook, 'before', 'create');
+ checkContext(hook, 'before', ['create', 'patch', 'update']);
return Promise.resolve()
.then(() => hook.app.service(path || 'authManagement').create({ action: 'options' })) | Allow addVerification in patch & update hooks | feathers-plus_feathers-authentication-management | train | js |
a9b972544587d7a7b1b1d2e038da321e8c5c9b08 | diff --git a/src/Provider/GuardAuthenticationProvider.php b/src/Provider/GuardAuthenticationProvider.php
index <HASH>..<HASH> 100644
--- a/src/Provider/GuardAuthenticationProvider.php
+++ b/src/Provider/GuardAuthenticationProvider.php
@@ -87,10 +87,8 @@ class GuardAuthenticationProvider implements AuthenticationProviderInterface
}
}
- throw new \LogicException(sprintf(
- 'The correct GuardAuthenticator could not be found for unique key "%s". The listener and provider should be passed the same list of authenticators.',
- $token->getGuardProviderKey()
- ));
+ // no matching authenticator found - but there will be multiple GuardAuthenticationProvider
+ // instances that will be checked if you have multiple firewalls.
}
private function authenticateViaGuard(GuardAuthenticatorInterface $guardAuthenticator, PreAuthenticationGuardToken $token) | Fixing a bug where multiple firewalls with authenticators would not work
It turns out that the AuthenticationProviderManager receives 2 instances of GuardAuthenticationProvider,
one for reach of the 2 firewalls. Each contains the guard authenticator(s) for each firewall.
So, if no matching authenticator is found, it's likely because the next GuardAuthenticationProvider
actually contains the correct guard authenticator. We need to not throw an error so the
next one can be tried. | knpuniversity_KnpUGuard | train | php |
0d1306dfe71cfd613627603f0b99f21b500b6759 | diff --git a/core/api.go b/core/api.go
index <HASH>..<HASH> 100644
--- a/core/api.go
+++ b/core/api.go
@@ -142,6 +142,12 @@ func rpcAuthedHandler(c *protocol.Chain, signer *blocksigner.Signer) http.Handle
m.Handle("/rpc/get-blocks", jsonHandler(func(ctx context.Context, h uint64) ([]*bc.Block, error) {
return generator.GetBlocks(ctx, c, h)
}))
+ m.Handle("/rpc/block-height", jsonHandler(func(ctx context.Context) map[string]uint64 {
+ h := c.Height()
+ return map[string]uint64{
+ "block_height": h,
+ }
+ }))
if signer != nil {
m.Handle("/rpc/signer/sign-block", jsonHandler(signer.SignBlock)) | core/generator: add /rpc/block-height route
Non-generator Cores will be able to query this route to check that they are sufficiently up-to-date.
Closes chain/chainprv#<I>.
Reviewers: @bobg @erykwalder | chain_chain | train | go |
757f79180f022b22a74038b625cb5b7d89698ddd | diff --git a/tests/integration/runloop-test.js b/tests/integration/runloop-test.js
index <HASH>..<HASH> 100644
--- a/tests/integration/runloop-test.js
+++ b/tests/integration/runloop-test.js
@@ -1,7 +1,6 @@
import { run } from '@ember/runloop';
import hbs from 'htmlbars-inline-precompile';
import { moduleForComponent, test } from 'ember-qunit';
-import Ember from 'ember';
var original, joined;
@@ -11,15 +10,15 @@ moduleForComponent('count-list', 'integration: runloop test', {
this.inject.service('redux');
joined = false;
- original = Ember.run.join;
- Ember.run.join = function() {
+ original = run.join;
+ run.join = function() {
joined = true;
return original.apply(this, arguments);
};
},
teardown() {
joined = false;
- Ember.run.join = original;
+ run.join = original;
}
}); | [FUTURE]: workaround for ES<I> run.join monkey patch | ember-redux_ember-redux | train | js |
3652670dcb5af1ff3dc2d178303bedc8641ef300 | diff --git a/src/angular.js b/src/angular.js
index <HASH>..<HASH> 100644
--- a/src/angular.js
+++ b/src/angular.js
@@ -38,7 +38,7 @@ if (typeof angular === 'object' && angular.module) {
// Ionic Auth
// ----------
- angular.module('ionic.cloud.auth', [])
+ angular.module('ionic.cloud.auth', ['ionic.cloud.core'])
.factory('$ionicAuth', [function() {
return Ionic.Auth;
@@ -46,7 +46,7 @@ if (typeof angular === 'object' && angular.module) {
// Ionic Push
// ----------
- angular.module('ionic.cloud.push', [])
+ angular.module('ionic.cloud.push', ['ionic.cloud.core'])
/**
* IonicPushAction Service
@@ -104,7 +104,7 @@ if (typeof angular === 'object' && angular.module) {
// Ionic Deploy
// ------------
- angular.module('ionic.cloud.deploy', [])
+ angular.module('ionic.cloud.deploy', ['ionic.cloud.core'])
.factory('$ionicDeploy', [function() {
if (!deployInstance) { | The core module is a dependency of the others | ionic-team_legacy-ionic-cloud | train | js |
24aeba162ccc0d2754f34f9a03eee0dd4e63f3c4 | diff --git a/asl/application/initializers/logger_initializer.py b/asl/application/initializers/logger_initializer.py
index <HASH>..<HASH> 100644
--- a/asl/application/initializers/logger_initializer.py
+++ b/asl/application/initializers/logger_initializer.py
@@ -1,5 +1,6 @@
from asl.application.service_application import service_application
from flask import Config
+from asl.utils.import_helper import fetch_class
import logging
import asl.vendor
from logging import Formatter
@@ -23,7 +24,7 @@ class LoggerInitializer:
elif handler_type == "rotating-file":
handler = logging.handlers.RotatingFileHandler(**parameters)
elif getattr(logging, handler_type):
- handler = getattr(logging, handler_type)(**parameters)
+ handler = fetch_class( handler_type)(**parameters)
else:
raise Exception('Unknown logger type {0}.'.fromat(handler_settings['type']))
@@ -51,7 +52,9 @@ class LoggerInitializer:
def getChild(self, suffix):
name = self.name + "." + suffix
- return logging.getLogger(name)
+ logger_child = logging.getLogger(name)
+ logger_child.getChild = getChild
+ return logger_child
if app.config.get('IS_USING_MEDIEVAL_SOFTWARE', False):
logging.Logger.getChild = getChild | Changes in loggers - initialization of any handler, getChild is propagated. | AtteqCom_zsl | train | py |
743a85b8a2bef0819173face6bd52a72dd5a2c5d | diff --git a/approvals.go b/approvals.go
index <HASH>..<HASH> 100644
--- a/approvals.go
+++ b/approvals.go
@@ -16,6 +16,7 @@ var (
defaultFrontLoadedReporter = reporters.NewFrontLoadedReporter()
)
+// Interface wrapper around testing.T
type Failable interface {
Fail()
} | Fix lint issue
with @isidore | approvals_go-approval-tests | train | go |
a5f825f6f5cf470ff51e77d22b5f5b3cc40cd0cc | diff --git a/mackerel-plugin.go b/mackerel-plugin.go
index <HASH>..<HASH> 100644
--- a/mackerel-plugin.go
+++ b/mackerel-plugin.go
@@ -240,7 +240,7 @@ func (h *MackerelPlugin) generateTempfilePath(args []string) string {
const (
metricTypeUint32 = "uint32"
metricTypeUint64 = "uint64"
- metricTypeFloat = "float64"
+ // metricTypeFloat = "float64"
)
func (h *MackerelPlugin) formatValues(prefix string, metric Metrics, metricValues MetricValues, lastMetricValues MetricValues) { | lint: `metricTypeFloat` is unused | mackerelio_go-mackerel-plugin-helper | train | go |
ced744def930034ea1dafab594b90aa46ef9c189 | diff --git a/src/js/components/Box.js b/src/js/components/Box.js
index <HASH>..<HASH> 100644
--- a/src/js/components/Box.js
+++ b/src/js/components/Box.js
@@ -144,7 +144,8 @@ export default class Box extends Component {
return (
<Component {...restProps} ref="boxContainer" id={this.props.id}
className={classes.join(' ')} style={style}
- role={this.props.role} tabIndex={this.props.tabIndex} {...a11yProps}>
+ role={this.props.role} tabIndex={this.props.tabIndex}
+ onClick={this.props.onClick} {...a11yProps}>
{skipLinkAnchor}
{texture}
{this.props.children} | Fixed the missing click handler for Box. | grommet_grommet | train | js |
482b2c7e040c2c8a146b24ef210215499a26a384 | diff --git a/monolithe/specifications/repositorymanager.py b/monolithe/specifications/repositorymanager.py
index <HASH>..<HASH> 100644
--- a/monolithe/specifications/repositorymanager.py
+++ b/monolithe/specifications/repositorymanager.py
@@ -203,10 +203,17 @@ class RepositoryManager (object):
f.write(chunk)
f.flush()
+ strippedRepoPath = self.repository_path.strip("/")
+
# reads the content of the archive and generate Specification objects
with zipfile.ZipFile(archive_path, "r") as archive_content:
for file_name in archive_content.namelist():
+ spec_dir = os.path.split(file_name)[0]
+
+ if not spec_dir.startswith(strippedRepoPath):
+ continue
+
spec_name = os.path.split(file_name)[1]
if spec_name == "api.info": | Added check in get_all_specifications(...) to filter out all files not under the repository_path. | nuagenetworks_monolithe | train | py |
044fe24cbc0b1187e0d53e4c8c429448b2e85de2 | diff --git a/fireplace/card.py b/fireplace/card.py
index <HASH>..<HASH> 100644
--- a/fireplace/card.py
+++ b/fireplace/card.py
@@ -255,9 +255,6 @@ class PlayableCard(BaseCard):
return self.game.queue_actions(self, [Heal(target, amount)])
def hit(self, target, amount):
- if getattr(target, "immune", False):
- logging.info("%r is immune to %i damage from %r" % (target, amount, self))
- return
return self.game.queue_actions(self, [Damage(target, amount)])
def is_playable(self):
@@ -449,6 +446,9 @@ class Character(LiveEntity):
return max(0, self.max_health - self.damage)
def _hit(self, source, amount):
+ if self.immune:
+ logging.info("%r is immune to %i damage from %r", self, amount, source)
+ return 0
self.damage += amount
return amount | Move immune check to Character._hit() | jleclanche_fireplace | train | py |
23dc3b1a76c45b215a0b4f800b416dd6e6e15dbd | diff --git a/js/huobipro.js b/js/huobipro.js
index <HASH>..<HASH> 100644
--- a/js/huobipro.js
+++ b/js/huobipro.js
@@ -750,7 +750,7 @@ module.exports = class huobipro extends Exchange {
}
}
}
- if (type === 'limit') {
+ if (type === 'limit' || type === 'ioc' || type === 'limit-maker') {
request['price'] = this.priceToPrecision (symbol, price);
}
let method = this.options['createOrderMethod']; | Fixed Huobipro IOC and Limit-maker orders | ccxt_ccxt | train | js |
d97be239d14ed643921ded8e72f4ac0a04b61611 | diff --git a/nats.go b/nats.go
index <HASH>..<HASH> 100644
--- a/nats.go
+++ b/nats.go
@@ -1287,7 +1287,9 @@ func (nc *Conn) publish(subj, reply string, data []byte) error {
nc.OutMsgs += 1
nc.OutBytes += uint64(len(data))
- nc.kickFlusher()
+ if len(nc.fch) == 0 {
+ nc.kickFlusher()
+ }
nc.mu.Unlock()
return nil
} | Put back changes that derek made for the publisher
* See commit <URL> | nats-io_go-nats | train | go |
959dcc4f44bf370560f006df8159041253f746b1 | diff --git a/tests/test.py b/tests/test.py
index <HASH>..<HASH> 100644
--- a/tests/test.py
+++ b/tests/test.py
@@ -190,6 +190,13 @@ class TestParse(unittest.TestCase):
with self.assertRaises(ParseError):
Calendar(cal11)
+ def test_repr(self):
+
+ e = Event(begin=0, end=10)
+ c = Container("test", e)
+
+ self.assertEqual("<Container 'test' with 1 elements>", repr(c))
+
class TestEvent(unittest.TestCase): | [new] Test for parse repr | C4ptainCrunch_ics.py | train | py |
0d0f3e63aff8671c354873a7d80f4ccebfa85d14 | diff --git a/salt/client/__init__.py b/salt/client/__init__.py
index <HASH>..<HASH> 100644
--- a/salt/client/__init__.py
+++ b/salt/client/__init__.py
@@ -841,8 +841,8 @@ class LocalClient(object):
# iterator for this job's return
ret_iter = self.get_returns_no_block(jid)
# iterator for the info of this job
- jinfo_iter = None
- jinfo_timeout = None
+ jinfo_iter = []
+ jinfo_timeout = time.time() + timeout
while True:
# Process events until timeout is reached or all minions have returned
for raw in ret_iter:
@@ -888,7 +888,7 @@ class LocalClient(object):
minion_timeouts[id_] = time.time() + timeout
# if we don't have the job info iterator (or its timed out), lets make it
- if jinfo_iter is None or time.time() > jinfo_timeout:
+ if time.time() > jinfo_timeout:
# need our own event listener, so we don't clobber the class one
event = salt.utils.event.get_event(
'master', | Start pinging minions after TIMEOUT, instead of immediately | saltstack_salt | train | py |
d51c4277d334497a42a130869b50ced6d2868bcd | diff --git a/test/helpers/createLazyTestEnv.js b/test/helpers/createLazyTestEnv.js
index <HASH>..<HASH> 100644
--- a/test/helpers/createLazyTestEnv.js
+++ b/test/helpers/createLazyTestEnv.js
@@ -1,6 +1,15 @@
const STATE_SYM = Object.getOwnPropertySymbols(global).find(
- s => s.description === "JEST_STATE_SYMBOL"
+ Symbol("x").description
+ ? s => s.description === "JEST_STATE_SYMBOL"
+ : s => s.toString() === "Symbol(JEST_STATE_SYMBOL)"
);
+if (!STATE_SYM) {
+ throw new Error(
+ `Unable to find JEST_STATE_SYMBOL in ${Object.getOwnPropertySymbols(global)
+ .map(s => s.toString())
+ .join(", ")}`
+ );
+}
module.exports = (globalTimeout = 2000, nameSuffix = "") => {
const state = global[STATE_SYM]; | fix Symbol lookup for older node.js versions | webpack_webpack | train | js |
9d4271f023e61d2b501bc5693d375b01dfa5fd0e | diff --git a/src/Psalm/Type.php b/src/Psalm/Type.php
index <HASH>..<HASH> 100644
--- a/src/Psalm/Type.php
+++ b/src/Psalm/Type.php
@@ -11,7 +11,7 @@ abstract class Type
{
/**
* Parses a string type representation
- * @param string $string
+ * @param string $type_string
* @return Union
*/
public static function parseString($type_string)
@@ -20,6 +20,8 @@ abstract class Type
$type_string = self::convertSquareBrackets($type_string);
}
+ $type_string = str_replace('?', 'null|', $type_string);
+
$type_tokens = self::tokenize($type_string);
if (count($type_tokens) === 1) { | Allow better handling of questionmark type annotations | vimeo_psalm | train | php |
b09462fc870b52065cbf058c4ae509a8278470d9 | diff --git a/dataviews/plots.py b/dataviews/plots.py
index <HASH>..<HASH> 100644
--- a/dataviews/plots.py
+++ b/dataviews/plots.py
@@ -540,7 +540,6 @@ class SheetPlot(Plot):
views = [overlay[label] for label in layer_labels]
overlay_slice = SheetOverlay(views, overlay.bounds)
collapsed_view = fn(overlay_slice)
- collapsed_view.style = style_key
collapsed_views.append(collapsed_view)
skip = len(views)-1
elif skip: | Fixed a bug in _collapse method of SheetPlot | pyviz_holoviews | train | py |
0377cc25f536a1d20d0120fede6b3855f343ec7f | diff --git a/libaaron/libaaron.py b/libaaron/libaaron.py
index <HASH>..<HASH> 100644
--- a/libaaron/libaaron.py
+++ b/libaaron/libaaron.py
@@ -356,8 +356,11 @@ class reportiter:
try:
from lxml import etree # type: ignore
-except ImportError:
- pass
+except ImportError as e:
+
+ def lxml_little_iter(*args, **kwargs):
+ raise e
+
else:
def lxml_little_iter(*args, **kwargs): | try to work with not having lxml a little more cleanly | ninjaaron_libaaron | train | py |
e4268d853ac381976a6b62c3a0405ecb319eb3b0 | diff --git a/api/app.go b/api/app.go
index <HASH>..<HASH> 100644
--- a/api/app.go
+++ b/api/app.go
@@ -661,6 +661,14 @@ func grantAppAccess(w http.ResponseWriter, r *http.Request, t auth.Token) error
return err
}
+// title: revoke access to app
+// path: /apps/{app}/teams/{team}
+// method: DELETE
+// responses:
+// 200: Access revoked
+// 401: Unauthorized
+// 403: Forbidden
+// 404: App or team not found
func revokeAppAccess(w http.ResponseWriter, r *http.Request, t auth.Token) error {
u, err := t.User()
if err != nil { | api/app: add comments to describe revoke access to app | tsuru_tsuru | train | go |
9c835eedf03bd4c29db9bb38c9548c99268a60a0 | diff --git a/test/lib/register.js b/test/lib/register.js
index <HASH>..<HASH> 100644
--- a/test/lib/register.js
+++ b/test/lib/register.js
@@ -186,7 +186,6 @@ describe('Register', function() {
data.form.fields[0].label.should.equal('Name')
data.form.fields[1].var.should.equal('x-romeo')
data.form.fields[1].type.should.equal('list-single')
- data.form.fields[1].required.should.be.false
data.form.fields[1].label.should.equal('Art thou Romeo?')
data.form.fields[1].options.should.eql([
{ value: 'Y', label: 'Y' },
@@ -745,7 +744,6 @@ describe('Register', function() {
error.form.fields[1].var.should.equal('x-romeo')
error.form.fields[1].type.should.equal('list-single')
- error.form.fields[1].required.should.be.false
error.form.fields[1].label.should.equal('Art thou Romeo?')
done() | No longer always set a required value | xmpp-ftw_xmpp-ftw-register | train | js |
543cea978de071ac19c6b98ff1fded58bfa0eefa | diff --git a/aeron-driver/src/main/java/io/aeron/driver/media/SendChannelEndpoint.java b/aeron-driver/src/main/java/io/aeron/driver/media/SendChannelEndpoint.java
index <HASH>..<HASH> 100644
--- a/aeron-driver/src/main/java/io/aeron/driver/media/SendChannelEndpoint.java
+++ b/aeron-driver/src/main/java/io/aeron/driver/media/SendChannelEndpoint.java
@@ -225,7 +225,9 @@ public class SendChannelEndpoint extends UdpChannelTransport
{
multiSndDestination.checkForReResolution(this, nowNs, conductorProxy);
}
- else if (!udpChannel.isMulticast() && nowNs > (timeOfLastSmNs + DESTINATION_TIMEOUT))
+ else if (!udpChannel.isMulticast() &&
+ !udpChannel.isDynamicControlMode() &&
+ nowNs > (timeOfLastSmNs + DESTINATION_TIMEOUT))
{
final String endpoint = udpChannel.channelUri().get(CommonContext.ENDPOINT_PARAM_NAME);
final InetSocketAddress address = udpChannel.remoteData(); | [Java]: add check to avoid trying to re-resolve dynamic DMC. | real-logic_aeron | train | java |
6cb025586316fafe023d0407e4ff650b353c573f | diff --git a/src/index.js b/src/index.js
index <HASH>..<HASH> 100644
--- a/src/index.js
+++ b/src/index.js
@@ -153,13 +153,27 @@ async function bundleAll({
}).start()
}
- extractTypes({
- entry: entries.library,
- output: dirname(output.types),
- root,
- verbose,
- quiet
- })
+ try {
+ extractTypes({
+ entry: entries.library,
+ output: dirname(output.types),
+ root,
+ verbose,
+ quiet
+ })
+ } catch(typeError) {
+ if (!quiet) {
+ progress.fail(typeError.message)
+ } else if (process.env.NODE_ENV === "test") {
+ throw new Error(typeError.message)
+ } else {
+ console.error(typeError.message)
+ }
+
+ if (process.env.NODE_ENV !== "test") {
+ process.exit(1)
+ }
+ }
if (!quiet) {
progress.succeed(`${message}`) | Added improved error handling to type extraction | sebastian-software_preppy | train | js |
78ab330c61a02426e3f51c5d70cf0d7ca6360322 | diff --git a/canmatrix/dbc.py b/canmatrix/dbc.py
index <HASH>..<HASH> 100644
--- a/canmatrix/dbc.py
+++ b/canmatrix/dbc.py
@@ -585,6 +585,8 @@ def load(f, **options):
botschaftId = temp.group(1)
signal = temp.group(2)
tempList = temp.group(3).split('"')
+ if not botschaftId.isdigit():
+ continue
try:
for i in range(math.floor(len(tempList) / 2)):
bo = db.frameById(botschaftId) | Fix so _VAL with no botschaftID is ignored
This fix targets .dbc files. Signals that are not used in any
messages have no id. Thus when trying to parse those signals
exceptions are thrown. This fix will ignore lines that start
with _VAL and has no id. | ebroecker_canmatrix | train | py |
99ad8ddac16f5326f0d2b5feabd0b49f62d9c4c7 | diff --git a/index.js b/index.js
index <HASH>..<HASH> 100644
--- a/index.js
+++ b/index.js
@@ -58,7 +58,7 @@ module.exports = function(options) {
var error;
if (code && 65 !== code) {
- error = new gutil.PluginError(plugin.name, plugin.name + ': returned ' + code);
+ error = new gutil.PluginError(plugin.name, file.path + ': returned ' + code);
}
cb(error, file); | on exit code, log name of file returning code rather than gulp-gulp plugin.name | oskarjakiela_gulp-gulp | train | js |
4964f6ddb4bda7877e28bc0f16f87430749f7927 | diff --git a/src/Helpers/Model.php b/src/Helpers/Model.php
index <HASH>..<HASH> 100644
--- a/src/Helpers/Model.php
+++ b/src/Helpers/Model.php
@@ -37,21 +37,28 @@ class Model
return false;
}
+ // Make Sure model name is uppercased.
+ $model = ucfirst($model);
+
// If namespace is not detected or set then set to the laravel default of App.
if ($this->crudApi->namespace === null) {
- $this->crudApi->setNamespace('App');
+ $this->crudApi->setNamespace('App\\');
}
- $fqModel = $this->crudApi->namespace.$model;
- if (!class_exists($fqModel)) {
- $fqModel = $this->crudApi->namespace.'Models\\'.$model;
- if (!class_exists($fqModel)) {
- return false;
+ // Test conventional namespace model combinations
+ $conventions = [
+ $this->crudApi->namespace . $model,
+ $this->crudApi->namespace . 'Models\\' . $model
+ ];
+
+ foreach ($conventions as $fqModel) {
+ if (class_exists($fqModel)) {
+ return $fqModel;
}
}
- return $fqModel;
+ return false;
}
public function instance() | Refactor code from if statements to a foreach loop with early return. | taskforcedev_crud-api | train | php |
ca35b089d8f0ef69a3212e4e4a0113fb7b930de3 | diff --git a/cytoscape-edgehandles.js b/cytoscape-edgehandles.js
index <HASH>..<HASH> 100644
--- a/cytoscape-edgehandles.js
+++ b/cytoscape-edgehandles.js
@@ -1178,10 +1178,13 @@ SOFTWARE.
var rpos = e.renderedPosition || e.cyRenderedPosition;
drawLine( rpos.x, rpos.y );
-
+ mx = rpos.x;
+ my = rpos.y;
}
+
+
} ).on( 'cxtdragover tapdragover', 'node', cxtdragoverHandler = function( e ) {
var cxtOk = options().cxt && e.type === 'cxtdragover';
var tapOk = drawMode && e.type === 'tapdragover'; | set mx,my on ctxdrag to ensure cancel works properly in drawMode | cytoscape_cytoscape.js-edgehandles | train | js |
b0a3c99a632cefd75c3d893906f26d6079d38111 | diff --git a/impl/src/main/java/org/jboss/weld/context/AbstractConversationContext.java b/impl/src/main/java/org/jboss/weld/context/AbstractConversationContext.java
index <HASH>..<HASH> 100644
--- a/impl/src/main/java/org/jboss/weld/context/AbstractConversationContext.java
+++ b/impl/src/main/java/org/jboss/weld/context/AbstractConversationContext.java
@@ -242,6 +242,11 @@ public abstract class AbstractConversationContext<R, S> extends AbstractBoundCon
if (conversation != null && !isExpired(conversation)) {
boolean lock = lock(conversation);
if (lock) {
+ // WELD-1690 Don't associate a conversation which was ended (race condition)
+ if(conversation.isTransient()) {
+ associateRequestWithNewConversation();
+ throw ConversationLogger.LOG.noConversationFoundToRestore(cid);
+ }
associateRequest(conversation);
} else {
// CDI 6.7.4 we must activate a new transient conversation before we throw the exception | WELD-<I> Don't associate a conversation which was ended | weld_core | train | java |
63a1a58e32c36ec591cc6d937544605cd2220692 | diff --git a/tests/unit/modules/sysmod_test.py b/tests/unit/modules/sysmod_test.py
index <HASH>..<HASH> 100644
--- a/tests/unit/modules/sysmod_test.py
+++ b/tests/unit/modules/sysmod_test.py
@@ -82,12 +82,11 @@ class Mockloader(object):
self.lst = lst
return {}
-sysmod.salt.state = Mockstate
-sysmod.salt.runner = Mockrunner
-sysmod.salt.loader = Mockloader()
-
@skipIf(NO_MOCK, NO_MOCK_REASON)
+@patch('salt.state', Mockstate())
+@patch('salt.runner', Mockrunner())
+@patch('salt.loader', Mockloader())
class SysmodTestCase(TestCase):
'''
Test cases for salt.modules.sysmod | used @patch for mocking. | saltstack_salt | train | py |
1b88ba0b075788507771993f33b981bd552e942e | diff --git a/src/widgets/form/sync/sync.js b/src/widgets/form/sync/sync.js
index <HASH>..<HASH> 100755
--- a/src/widgets/form/sync/sync.js
+++ b/src/widgets/form/sync/sync.js
@@ -91,7 +91,7 @@
for ( let i = 0, l = $otherElements.length; i < l; i++ ) {
- let otherElements = $otherElements[i],
+ let otherElement = $otherElements[i],
$otherElement = $(otherElement),
otherValue = $otherElement.val (),
otherChecked = !!$otherElement.prop ( 'checked' ); | Form Sync: fixed a typo | svelto_svelto | train | js |
5834bf3561c2907a791c68699586cb49ab1fb0f7 | diff --git a/lib/frameit/template_finder.rb b/lib/frameit/template_finder.rb
index <HASH>..<HASH> 100644
--- a/lib/frameit/template_finder.rb
+++ b/lib/frameit/template_finder.rb
@@ -17,11 +17,12 @@ module Frameit
if templates.count == 0
if screenshot.screen_size == Deliver::AppScreenshot::ScreenSize::IOS_35
Helper.log.warn "Unfortunately 3.5\" device frames were discontinued. Skipping screen '#{screenshot.path}'".yellow
+ Helper.log.debug "Looked for: '#{parts.join('_')}.png'".red
else
Helper.log.error "Could not find a valid template for screenshot '#{screenshot.path}'".red
Helper.log.error "You can download new templates from '#{FrameConverter::DOWNLOAD_URL}'"
Helper.log.error "and store them in '#{templates_path}'"
- Helper.log.error "Missing file: '#{parts.join('_')}.psd'".red
+ Helper.log.error "Missing file: '#{parts.join('_')}.png'".red
end
return nil
else | Changed frame output to png extension | fastlane_fastlane | train | rb |
8279169c007213227d0e0c2295ca3d2efb024891 | diff --git a/lib/puppet/ssl/oids.rb b/lib/puppet/ssl/oids.rb
index <HASH>..<HASH> 100644
--- a/lib/puppet/ssl/oids.rb
+++ b/lib/puppet/ssl/oids.rb
@@ -26,6 +26,10 @@ require 'puppet/ssl'
# @api private
module Puppet::SSL::Oids
+ # Note: When updating the following OIDs make sure to also update the OID
+ # definitions here:
+ # https://github.com/puppetlabs/puppetserver/blob/master/src/clj/puppetlabs/puppetserver/certificate_authority.clj#L122-L159
+
PUPPET_OIDS = [
["1.3.6.1.4.1.34380", 'puppetlabs', 'Puppet Labs'],
["1.3.6.1.4.1.34380.1", 'ppCertExt', 'Puppet Certificate Extension'], | (PUP-<I>) Add note explaining duplication to oids.rb
The information captured in PUPPET_OIDS in oids.rb is duplicated in the
puppetserver codebase. Creating a shared oids file isn't easily
achieveable today, so instead this commit adds a comment to the oids.rb
file explaining that any changes to the oids need to be replicated in
the puppetserver codebase. | puppetlabs_puppet | train | rb |
d852f834226a9e3020e70acb68963ba423d52a19 | diff --git a/lib/formula.rb b/lib/formula.rb
index <HASH>..<HASH> 100644
--- a/lib/formula.rb
+++ b/lib/formula.rb
@@ -246,13 +246,14 @@ module Formula
# <%= f.input :password %>
# <% end %>
- alias :formula_for :formula_form_for
def formula_form_for(record_or_name_or_array, *args, &proc)
options = args.extract_options!
options[:builder] ||= @@builder
form_for(record_or_name_or_array, *(args << options), &proc)
end
+ alias :formula_for :formula_form_for
+
# Generates a wrapper around fields_form with :builder set to FormulaFormBuilder.
#
@@ -272,13 +273,14 @@ module Formula
# <%= company_f.input :phone %>
# <% end %>
- alias :fieldsula_for :formula_fields_for
def formula_fields_for(record_or_name_or_array, *args, &block)
options = args.extract_options!
options[:builder] ||= @@builder
fields_for(record_or_name_or_array, *(args << options), &block)
end
+ alias :fieldsula_for :formula_fields_for
+
end
end
\ No newline at end of file | modified alias to come after method to fix no method found error | ksylvest_formula | train | rb |
8234f665bdb3d42df187a18fe6645eb12914a8c2 | diff --git a/method.js b/method.js
index <HASH>..<HASH> 100644
--- a/method.js
+++ b/method.js
@@ -75,3 +75,7 @@ proto.setImplementation = function setImplementation (func) {
, oldFuncPointer = core.method_setImplementation(wrapperPtr)
return imp.createWrapperFunc(oldFuncPointer)
}
+
+proto.toString = function toString () {
+ return '[Method: '+this.getName()+' '+this.getReturnType()+'('+this.getArgumentTypes()+') ]'
+} | Add a 'toString()' override to the Method wrap objects. | TooTallNate_NodObjC | train | js |
cdff84b84a52236ad8a56a58bf61ffcd1291fad2 | diff --git a/middleman-more/lib/middleman-more/core_extensions/compass.rb b/middleman-more/lib/middleman-more/core_extensions/compass.rb
index <HASH>..<HASH> 100644
--- a/middleman-more/lib/middleman-more/core_extensions/compass.rb
+++ b/middleman-more/lib/middleman-more/core_extensions/compass.rb
@@ -34,11 +34,12 @@ module Middleman::CoreExtensions::Compass
end
end
- # if build?
- # ::Compass.configuration do |config|
- # config.environment = :production
- # end
- # end
+ if build?
+ ::Compass.configuration do |config|
+ config.environment = :production
+ config.project_path = File.join(root, build_dir)
+ end
+ end
run_hook :compass_config, ::Compass.configuration
run_hook :after_compass_config | continue trying to fix compass issue | middleman_middleman | train | rb |
2b97b2f48d5348486aaf649ed45797cc0b6de3b4 | diff --git a/src/Encoding/FilteredStream.php b/src/Encoding/FilteredStream.php
index <HASH>..<HASH> 100644
--- a/src/Encoding/FilteredStream.php
+++ b/src/Encoding/FilteredStream.php
@@ -13,7 +13,7 @@ use Psr\Http\Message\StreamInterface;
*/
abstract class FilteredStream implements StreamInterface
{
- const BUFFER_SIZE = 65536;
+ const BUFFER_SIZE = 8192;
use StreamDecorator;
@@ -115,7 +115,7 @@ abstract class FilteredStream implements StreamInterface
$buffer = '';
while (!$this->eof()) {
- $buf = $this->read(1048576);
+ $buf = $this->read(self::BUFFER_SIZE);
// Using a loose equality here to match on '' and false.
if ($buf == null) {
break; | Lower buffer size, and use it in the getContents
This is mainly to avoid too much nested call to the read method, as if we got a stream where the reads provide too few bytes (like <I>) it will make a nested call to the read method for each part of the messages and will stop on a too muche nested call exception with xdebug.
Also there is no need to have more than <I> as PHP already have a buffer with this size, so no performance issue. | php-http_message | train | php |
cf601c448305ec8d4a9748a43c6e6b7d5f59d873 | diff --git a/src/Installer.php b/src/Installer.php
index <HASH>..<HASH> 100644
--- a/src/Installer.php
+++ b/src/Installer.php
@@ -241,6 +241,12 @@ class Installer extends LibraryInstaller
$this->compileTemplate($templatePath, $dotEnvExamplePath, $envExample);
}
+ protected function configureComposer()
+ {
+ $composerConfigurator = new ComposerConfigurator($this->plugin);
+ $composerConfigurator->configure($this->composer, $this->io;
+ }
+
/**
* {@inheritDoc}
*/
@@ -275,6 +281,7 @@ class Installer extends LibraryInstaller
$this->installGitignore($package);
$this->installDotEnv($package);
+ $this->configureComposer();
$this->filesystem->remove($downloadPath);
} | Configure composer.json in Installer | CupOfTea696_WordPress-Composer | train | php |
fdcd8dfad0b579da6d898652ddc728e7741196e5 | diff --git a/lib/numerals/rounding.rb b/lib/numerals/rounding.rb
index <HASH>..<HASH> 100644
--- a/lib/numerals/rounding.rb
+++ b/lib/numerals/rounding.rb
@@ -199,8 +199,10 @@ class Rounding
if value.zero?
ZERO_DIGITS
else
- # Assume no leading zeros; otherwise value = value.normalize(remove_trailing_zeros: true)
- value.point
+ if @base != value.base
+ value = value.to_base(@base)
+ end
+ value.normalized(remove_trailing_zeros: true).point
end
else
Conversions.order_of_magnitude(value, base: @base) | Fix: Rounding#num_integral_digits did not handle numerals in different base | jgoizueta_numerals | train | rb |
7a76664f2f53b7c9e9cad9cc5a990e16482d61c1 | diff --git a/src/GDAO/Model.php b/src/GDAO/Model.php
index <HASH>..<HASH> 100644
--- a/src/GDAO/Model.php
+++ b/src/GDAO/Model.php
@@ -24,7 +24,7 @@ abstract class Model
*
* This is a REQUIRED field & must be properly set by consumers of this class
*
- * @todo Work on supporting tables that do not have any primary key column defined
+ * @todo Work on supporting tables that don't have any primary key column defined
*
* @var string
* | Second commit after adding github remote. | rotexsoft_gdao | train | php |
121165f06e7ce246105230e62b4568cdc15beba6 | diff --git a/src/ng-quill.js b/src/ng-quill.js
index <HASH>..<HASH> 100755
--- a/src/ng-quill.js
+++ b/src/ng-quill.js
@@ -135,7 +135,6 @@ app.component('ngQuillEditor', {
restrict: 'E',
templateUrl: 'ngQuill/template.html',
controller: ['$scope', '$element', '$timeout', 'ngQuillService', 'ngQuillConfig', function ($scope, $element, $timeout, ngQuillService, ngQuillConfig) {
- console.log(this.ngModel);
var config = {
theme: this.theme || 'snow',
save: this.save || 'html',
@@ -261,7 +260,6 @@ app.component('ngQuillEditor', {
};
this.$onInit = function () {
- console.log(this);
// init editor
editor = new Quill($element[0].querySelector('.advanced-wrapper .editor-container'), config); | Update ng-quill.js
console.log in a release version? really? | KillerCodeMonkey_ng-quill | train | js |
8fc686d41bade96b3b3cb1284029f155c5ae05ab | diff --git a/src/com/google/caliper/Run.java b/src/com/google/caliper/Run.java
index <HASH>..<HASH> 100644
--- a/src/com/google/caliper/Run.java
+++ b/src/com/google/caliper/Run.java
@@ -16,7 +16,6 @@
package com.google.caliper;
-import com.google.common.base.Objects;
import java.io.Serializable;
import java.util.Date;
import java.util.LinkedHashMap;
@@ -71,7 +70,7 @@ public final class Run
Run that = (Run) o;
return measurements.equals(that.measurements)
&& benchmarkName.equals(that.benchmarkName)
- && Objects.equal(apiKey, that.apiKey)
+ && apiKey.equals(that.apiKey)
&& executedTimestamp == that.executedTimestamp;
}
@@ -79,7 +78,11 @@ public final class Run
}
@Override public int hashCode() {
- return Objects.hashCode(measurements, benchmarkName, apiKey, executedTimestamp);
+ int result = measurements.hashCode();
+ result = result * 37 + benchmarkName.hashCode();
+ result = result * 37 + apiKey.hashCode();
+ result = result * 37 + (int) ((executedTimestamp >> 32) ^ executedTimestamp);
+ return result;
}
@Override public String toString() { | Removing Guava dependency from Run. This is for GWT safety (and build simplicity). Sigh.
git-svn-id: <URL> | trajano_caliper | train | java |
ae0d46b366a68a2668e418085e4841ec156185c8 | diff --git a/src/Support/Timezone.php b/src/Support/Timezone.php
index <HASH>..<HASH> 100644
--- a/src/Support/Timezone.php
+++ b/src/Support/Timezone.php
@@ -583,11 +583,9 @@ class Timezone
/**
* Timezones midnight by now.
*
- * @param \DateTimeZone|string|null $timezone
- *
* @return \Illuminate\Support\Collection
*/
- public static function now($timezone = null): Collection
+ public static function now(): Collection
{
return static::whereHourInUtc(Carbon::now()->hour);
}
@@ -602,7 +600,7 @@ class Timezone
*/
public static function at(int $hour, $timezone = null): Collection
{
- return static::whereHourInUtc(Carbon::now()->subHours($hour)->hour);
+ return static::whereHourInUtc(Carbon::now($timezone)->subHours($hour)->timezone('UTC')->hour);
}
/** | Fixes timezone implementation with $timezone usage. | orchestral_support | train | php |
533bf04c7f6e2ec3bafcb2765046c9c9712a350c | diff --git a/test/server3.js b/test/server3.js
index <HASH>..<HASH> 100644
--- a/test/server3.js
+++ b/test/server3.js
@@ -35,6 +35,8 @@ http.createServer(function(req, resp) {
resp.end("stderr3")
})
})
+ } else if (req.url === "/argv") {
+ resp.end(process.argv.slice(2).join(','))
}
}).listen(process.env.PORT, function() {
console.error("server3 listening");
diff --git a/test/test.js b/test/test.js
index <HASH>..<HASH> 100644
--- a/test/test.js
+++ b/test/test.js
@@ -309,6 +309,7 @@ steps = [
});
},
},
+ get("command line arguments passed to server correctly", "/argv", "--custom1,aoeu,herp derp"),
get("multi-worker server responding to get requests", "/stdout", "stdout3"),
get("(test setup) generate log output", "/stderr", "stderr3"),
get("(test setup) generate log output", "/stdout", "stdout3"), | test sending command line args to script. #7 | andrewrk_naught | train | js,js |
f389cc483fcd6e4913672dbaf7823fc55220bfd6 | diff --git a/lib/bitcoin/payments/payment_request.pb.rb b/lib/bitcoin/payments/payment_request.pb.rb
index <HASH>..<HASH> 100644
--- a/lib/bitcoin/payments/payment_request.pb.rb
+++ b/lib/bitcoin/payments/payment_request.pb.rb
@@ -57,6 +57,13 @@ module Bitcoin
certs.first.public_key.verify(digest, signature, sig_message)
end
+ # verify expire time for payment request.
+ def valid_time?
+ expires = details.expires
+ return true if expires == 0
+ Time.now.to_i <= expires
+ end
+
private
# Generate data to be signed
diff --git a/spec/bitcoin/payments_spec.rb b/spec/bitcoin/payments_spec.rb
index <HASH>..<HASH> 100644
--- a/spec/bitcoin/payments_spec.rb
+++ b/spec/bitcoin/payments_spec.rb
@@ -13,6 +13,9 @@ describe Bitcoin::Payments do
}
describe 'PaymentRequest#parse_from_payload' do
+ after {
+ Timecop.return
+ }
subject {
Bitcoin::Payments::PaymentRequest.parse_from_payload(load_payment('r1521439154.bitcoinpaymentrequest'))
}
@@ -34,6 +37,9 @@ describe Bitcoin::Payments do
certs = subject.certs
expect(certs.size).to eq(1)
expect(subject.valid_sig?).to be true
+ expect(subject.valid_time?).to be false
+ Timecop.freeze(Time.utc(2017, 3, 18, 15, 13, 25))
+ expect(subject.valid_time?).to be true
end
end | Add Bitcoin::Payments::PaymentRequest#valid_time? which verify expire time for payment request | chaintope_bitcoinrb | train | rb,rb |
fc96f1d2da65fbe4a68a6147e941a33214cf4ed6 | diff --git a/lib/melon/ruby_compiler.rb b/lib/melon/ruby_compiler.rb
index <HASH>..<HASH> 100644
--- a/lib/melon/ruby_compiler.rb
+++ b/lib/melon/ruby_compiler.rb
@@ -50,7 +50,9 @@ module Melon
def get_name( statement )
return nil unless statement
- statement.children[1]
+ name = statement.children[1]
+ raise "Not symbol #{name}" unless name.is_a? Symbol
+ name
end
end
diff --git a/test/melon/test_compiler.rb b/test/melon/test_compiler.rb
index <HASH>..<HASH> 100644
--- a/test/melon/test_compiler.rb
+++ b/test/melon/test_compiler.rb
@@ -7,6 +7,13 @@ module Melon
Register.machine.boot
end
+ def test_doesnt_create_existing_clas
+ space_class = Parfait.object_space.get_class_by_name(:Space)
+ RubyCompiler.compile "class Space ; end"
+ clazz = Parfait.object_space.get_class_by_name(:Space)
+ assert_equal clazz , space_class
+ end
+
def test_creates_class_without_deriviation
RubyCompiler.compile "class Testing ; end"
clazz = Parfait.object_space.get_class_by_name(:Testing) | checking classes don't get created twice | ruby-x_rubyx | train | rb,rb |
bbeb44fc45ce262ad5c9b986a6f09ea3f5b60699 | diff --git a/setup.py b/setup.py
index <HASH>..<HASH> 100644
--- a/setup.py
+++ b/setup.py
@@ -33,7 +33,7 @@ def main():
description = "Tools for manipulating biological data, particularly multiple sequence alignments",
url = "http://bitbucket.org/james_taylor/bx-python/wiki/Home",
license = "MIT",
- clssifiers = [
+ classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"Intended Audience :: Science/Research", | Fix typo in classifiers list name in setup.py pointed out by Bob Harris. | bxlab_bx-python | train | py |
01d74ef6ad12e93cd90213519cd17646b4c2fd0b | diff --git a/src/body-renderer.js b/src/body-renderer.js
index <HASH>..<HASH> 100644
--- a/src/body-renderer.js
+++ b/src/body-renderer.js
@@ -14,7 +14,7 @@ export default class BodyRenderer {
renderRows(rows) {
let config = {
- itemHeight: 40,
+ itemHeight: this.options.cellHeight,
total: rows.length,
generate: (index) => {
const el = document.createElement('div');
@@ -30,7 +30,7 @@ export default class BodyRenderer {
const rows = this.datamanager.getRowsForView();
let config = {
- itemHeight: 40,
+ itemHeight: this.options.cellHeight,
total: rows.length,
generate: (index) => {
const el = document.createElement('div');
diff --git a/src/defaults.js b/src/defaults.js
index <HASH>..<HASH> 100644
--- a/src/defaults.js
+++ b/src/defaults.js
@@ -52,7 +52,7 @@ export default {
logs: false,
layout: 'fixed', // fixed, fluid, ratio
noDataMessage: 'No Data',
- cellHeight: null,
+ cellHeight: 40,
inlineFilters: false,
treeView: false,
checkedRowStatus: true, | fix: 🐛 Pick cellHeight from options
HyperList should take cellHeight from options | frappe_datatable | train | js,js |
0a30725b5971bd4f81e9ce22056929cb388623c7 | diff --git a/rados/ioctx.go b/rados/ioctx.go
index <HASH>..<HASH> 100644
--- a/rados/ioctx.go
+++ b/rados/ioctx.go
@@ -141,17 +141,18 @@ func (ioctx *IOContext) Append(oid string, data []byte) error {
// Read reads up to len(data) bytes from the object with key oid starting at byte
// offset offset. It returns the number of bytes read and an error, if any.
func (ioctx *IOContext) Read(oid string, data []byte, offset uint64) (int, error) {
- if len(data) == 0 {
- return 0, nil
- }
-
c_oid := C.CString(oid)
defer C.free(unsafe.Pointer(c_oid))
+ var buf *C.char
+ if len(data) > 0 {
+ buf = (*C.char)(unsafe.Pointer(&data[0]))
+ }
+
ret := C.rados_read(
ioctx.ioctx,
c_oid,
- (*C.char)(unsafe.Pointer(&data[0])),
+ buf,
(C.size_t)(len(data)),
(C.uint64_t)(offset)) | ioctx: do not short-circuit read for empty slice
ioctx.read should contact the cluster even when its slice is empty so
that errors like ENOENT can be reported. | ceph_go-ceph | train | go |
4fc817317e486bda7db7fdf5ee82acda3f21d139 | diff --git a/src/drilldown.js b/src/drilldown.js
index <HASH>..<HASH> 100644
--- a/src/drilldown.js
+++ b/src/drilldown.js
@@ -83,8 +83,19 @@ function dd(object, _context, _key) {
}
};
drill.invoke = isFunction(object) ? object.bind(_context) : console.log.bind(null, 'dd', object);
+
+ drill.set = deprecate(drill.update, 'set', 'update');
+ drill.func = deprecate(drill.invoke, 'func', 'invoke');
+
return drill;
}
+function deprecate(func, oldName, newName) {
+ return function() {
+ console.warn(oldName + ' is deprecated. Please use ' + newName);
+ return func.apply(this, arguments);
+ }
+}
+
module.exports = dd; | Add deprecation warnings to previously removed fn | d10n_drilldown | train | js |
a51e36999e58fe792dede75a77ec23d47d049ccf | diff --git a/tests/test_cli.py b/tests/test_cli.py
index <HASH>..<HASH> 100644
--- a/tests/test_cli.py
+++ b/tests/test_cli.py
@@ -629,6 +629,7 @@ def test_sync(runner, git_repo):
assert "Uploading history metrics" in str(result.output)
assert result.exit_code == 0
+@pytest.mark.skipif(os.getenv("NO_ML") or sys.version_info < (3, 5), reason="Tensorboard not installed and we don't support tensorboard syncing in py2")
@pytest.mark.vcr()
def test_sync_tensorboard_ignore(runner, git_repo):
# Un comment this line when re-recording the cassette | Dont test tensorboard in py2 or without ml | wandb_client | train | py |
0f5e1f86f75c22b16b8196ba7d60e8ca8fe5e06f | diff --git a/lib/etcd/client.rb b/lib/etcd/client.rb
index <HASH>..<HASH> 100644
--- a/lib/etcd/client.rb
+++ b/lib/etcd/client.rb
@@ -11,7 +11,11 @@ module Etcd
def initialize(opts={})
@host = opts[:host] || '127.0.0.1'
@port = opts[:port] || 4001
- @allow_redirect = opts[:allow_redirect] || true
+ if opts.has_key?(:allow_redirect)
+ @allow_redirect = opts[:allow_redirect]
+ else
+ @allow_redirect = true
+ end
end
def version_prefix
@@ -116,11 +120,11 @@ module Etcd
else
Log.debug("Http error")
Log.debug(res.body)
- #res.error!
- res
+ res.error!
end
end
+ private
def redirect?(code)
(code >= 300) and (code < 400)
end | silly bugs. false is a valid value for allow_redirect, raise error instead of returning | ranjib_etcd-ruby | train | rb |
aa63ba8e985ce73a1c1720de25b27a460012eb2b | diff --git a/go/vt/tabletmanager/healthcheck.go b/go/vt/tabletmanager/healthcheck.go
index <HASH>..<HASH> 100644
--- a/go/vt/tabletmanager/healthcheck.go
+++ b/go/vt/tabletmanager/healthcheck.go
@@ -271,7 +271,7 @@ func (agent *ActionAgent) runHealthCheck(targetTabletType topo.TabletType) {
// Change the Type, update the health. Note we pass in a map
// that's not nil, meaning if it's empty, we will clear it.
- if err := topotools.ChangeType(agent.batchCtx, agent.TopoServer, tablet.Alias, newTabletType, health, true /*runHooks*/); err != nil {
+ if err := topotools.ChangeType(agent.batchCtx, agent.TopoServer, tablet.Alias, newTabletType, health, false /*runHooks*/); err != nil {
log.Infof("Error updating tablet record: %v", err)
return
} | Not running hooks, to fix unit tests in some cases. | vitessio_vitess | train | go |
0246aaa23b1df0c752274892f69b3f61c1e72883 | diff --git a/x2j.go b/x2j.go
index <HASH>..<HASH> 100644
--- a/x2j.go
+++ b/x2j.go
@@ -24,7 +24,6 @@ import (
"encoding/xml"
"errors"
"fmt"
- // "reflect"
"regexp"
"strconv"
"strings" | <I> - cleanup some noice in comments | clbanning_x2j | train | go |
2fe11251ecdda76fdda39d696d809f8ddad775f3 | diff --git a/test.js b/test.js
index <HASH>..<HASH> 100644
--- a/test.js
+++ b/test.js
@@ -26,9 +26,8 @@ after(function() {
try {fs.rmdirSync(fixturesPath, 0x1ed);} catch(err) {}
});
-describe('chokidar', function() {
- this.timeout(5000);
+describe('chokidar', function() {
it('should expose public API methods', function() {
chokidar.FSWatcher.should.be.a('function');
chokidar.watch.should.be.a('function'); | Fail faster
hopefully won’t need this anymore | paulmillr_chokidar | train | js |
996fd958ac12a7906367470fe2f6bdd05f56f608 | diff --git a/scrape/manager.go b/scrape/manager.go
index <HASH>..<HASH> 100644
--- a/scrape/manager.go
+++ b/scrape/manager.go
@@ -110,7 +110,7 @@ func (m *Manager) reload() {
scrapeConfig, ok := m.scrapeConfigs[setName]
if !ok {
level.Error(m.logger).Log("msg", "error reloading target set", "err", "invalid config id:"+setName)
- return
+ continue
}
sp = newScrapePool(scrapeConfig, m.append, log.With(m.logger, "scrape_pool", setName))
m.scrapePools[setName] = sp | fix deadlock in scrape manager (#<I>)
Scrape manager will fall in deadlock when we reload configs frequently. | prometheus_prometheus | train | go |
e4cf3931b3938457faf2f4fd1467bc46049552ae | diff --git a/tests/integration/modules/state.py b/tests/integration/modules/state.py
index <HASH>..<HASH> 100644
--- a/tests/integration/modules/state.py
+++ b/tests/integration/modules/state.py
@@ -74,6 +74,31 @@ class StateModuleTest(integration.ModuleCase,
sls = self.run_function('state.show_sls', mods='recurse_ok_two')
self.assertIn('/etc/nagios/nrpe.cfg', sls)
+ def test_running_dictionary_consistency(self):
+ '''
+ Test the structure of the running dictionary so we don't change it
+ without deprecating/documenting the change
+ '''
+ running_dict_fields = [
+ '__id__',
+ '__run_num__',
+ '__sls__',
+ 'changes',
+ 'comment',
+ 'duration',
+ 'name',
+ 'result',
+ 'start_time',
+ ]
+
+ sls = self.run_function('state.single',
+ fun='test.succeed_with_changes',
+ name='gndn')
+
+ for state, ret in sls.items():
+ for field in running_dict_fields:
+ self.assertIn(field, ret)
+
def _remove_request_cache_file(self):
'''
remove minion state request file | Add integration test for the running dictionary structure
This will fail if we remove/rename any fields from the running
dictionary by accident. | saltstack_salt | train | py |
73b2be6a51b01b51443e9e5357e061e1664a3196 | diff --git a/spec/rails_best_practices/reviews/remove_unused_methods_in_models_review_spec.rb b/spec/rails_best_practices/reviews/remove_unused_methods_in_models_review_spec.rb
index <HASH>..<HASH> 100644
--- a/spec/rails_best_practices/reviews/remove_unused_methods_in_models_review_spec.rb
+++ b/spec/rails_best_practices/reviews/remove_unused_methods_in_models_review_spec.rb
@@ -556,23 +556,25 @@ module RailsBestPractices
end
end
- context 'short syntax value' do
- it 'does not remove unused method' do
- content = <<-EOF
- class Post < ActiveRecord::Base
- def build
- new(value:)
- end
+ if RUBY_VERSION.to_f > 3.0
+ context 'short syntax value' do
+ it 'does not remove unused method' do
+ content = <<-EOF
+ class Post < ActiveRecord::Base
+ def build
+ new(value:)
+ end
- def value
- 'value'
+ def value
+ 'value'
+ end
end
+ EOF
+ runner.prepare('app/models/post.rb', content)
+ runner.review('app/models/post.rb', content)
+ runner.after_review
+ expect(runner.errors.size).to eq(1)
end
- EOF
- runner.prepare('app/models/post.rb', content)
- runner.review('app/models/post.rb', content)
- runner.after_review
- expect(runner.errors.size).to eq(1)
end
end | test short syntax hash only in ruby <I> | flyerhzm_rails_best_practices | train | rb |
3aee123bc018bc117ff6cdeff8a317060502ad7b | diff --git a/lang.php b/lang.php
index <HASH>..<HASH> 100644
--- a/lang.php
+++ b/lang.php
@@ -1,5 +1,6 @@
<?php
require_once(dirname(__FILE__).'/lexical.php');
+use Pharen\Lexical as Lexical;
Lexical::$scopes['lang'] = array();
define("SYSTEM", dirname(__FILE__));
define("LIB_PATH", (SYSTEM . "/lib/")); | Use the namespaced Lexical class in lang. | Scriptor_pharen | train | php |
8a8f76a7b24aba4ae7a60148115632e7bbe4994e | diff --git a/lib/site_prism/element_container.rb b/lib/site_prism/element_container.rb
index <HASH>..<HASH> 100644
--- a/lib/site_prism/element_container.rb
+++ b/lib/site_prism/element_container.rb
@@ -108,8 +108,7 @@ module SitePrism::ElementContainer
def create_visibility_waiter element_name, element_selector
method_name = "wait_until_#{element_name.to_s}_visible"
build_checker_or_waiter element_name, method_name, element_selector do
- define_method method_name do |*args|
- timeout = args.shift || Capybara.default_wait_time
+ define_method method_name do |timeout = Capybara.default_wait_time|
Capybara.using_wait_time timeout do
element_waiter element_selector
end
@@ -127,8 +126,7 @@ module SitePrism::ElementContainer
def create_invisibility_waiter element_name, element_selector
method_name = "wait_until_#{element_name.to_s}_invisible"
build_checker_or_waiter element_name, method_name, element_selector do
- define_method method_name do |*args|
- timeout = args.shift || Capybara.default_wait_time
+ define_method method_name do |timeout = Capybara.default_wait_time|
begin
Timeout.timeout(timeout) do
sleep 0.1 while element_exists?(element_selector) && find_first(element_selector).visible? | putting the block-args back as capybara no longer supports ruby <I> | natritmeyer_site_prism | train | rb |
0e631cd28be3e134d1dd1b940258634dfc93c5c9 | diff --git a/spec/routemaster/receiver/basic_spec.rb b/spec/routemaster/receiver/basic_spec.rb
index <HASH>..<HASH> 100644
--- a/spec/routemaster/receiver/basic_spec.rb
+++ b/spec/routemaster/receiver/basic_spec.rb
@@ -29,11 +29,11 @@ describe Routemaster::Receiver::Basic do
let(:payload) do
[{
- topic: 'widgets', event: 'created', url: 'https://example.com/widgets/1', t: 1234
+ topic: 'widgets', type: 'create', url: 'https://example.com/widgets/1', t: 1234
}, {
- topic: 'widgets', event: 'created', url: 'https://example.com/widgets/2', t: 1234
+ topic: 'widgets', type: 'create', url: 'https://example.com/widgets/2', t: 1234
}, {
- topic: 'widgets', event: 'created', url: 'https://example.com/widgets/3', t: 1234
+ topic: 'widgets', type: 'create', url: 'https://example.com/widgets/3', t: 1234
}].to_json
end | Fixes test payload (did not match RM messages) | deliveroo_routemaster-drain | train | rb |
93bdc1337ae2c1f7f8ac5546b30feff7d0206366 | diff --git a/source/js/TL.Timeline.js b/source/js/TL.Timeline.js
index <HASH>..<HASH> 100755
--- a/source/js/TL.Timeline.js
+++ b/source/js/TL.Timeline.js
@@ -566,7 +566,9 @@ TL.Timeline = TL.Class.extend({
// Update hashbookmark in the url bar
_updateHashBookmark: function(id) {
var hash = "#" + "event-" + id.toString();
- window.history.replaceState(null, "Browsing TimelineJS", hash);
+ if (window.location.protocol != 'file:') {
+ window.history.replaceState(null, "Browsing TimelineJS", hash);
+ }
this.fire("hash_updated", {unique_id:this.current_id, hashbookmark:"#" + "event-" + id.toString()}, this);
}, | make replaceState conditional. closes #<I> | NUKnightLab_TimelineJS3 | train | js |
4e2e8f597122e6af35ddc791bcb9febd0d59a6b0 | diff --git a/lib/appsignal/version.rb b/lib/appsignal/version.rb
index <HASH>..<HASH> 100644
--- a/lib/appsignal/version.rb
+++ b/lib/appsignal/version.rb
@@ -1,4 +1,4 @@
module Appsignal
- VERSION = '0.12.beta.29'
- AGENT_VERSION = '5a9fb30'
+ VERSION = '0.12.beta.30'
+ AGENT_VERSION = '8cdd29b'
end | Bump to <I>.beta<I> [ci skip] | appsignal_appsignal-ruby | train | rb |
daa729f9046c93cf4cd5f616a7de89dd253f3adf | diff --git a/ebs_deploy/__init__.py b/ebs_deploy/__init__.py
index <HASH>..<HASH> 100644
--- a/ebs_deploy/__init__.py
+++ b/ebs_deploy/__init__.py
@@ -411,7 +411,7 @@ class EbsHelper(object):
sleep(2)
def wait_for_environments(self, environment_names, health=None, status=None, version_label=None,
- include_deleted=True, wait_time_secs=600):
+ include_deleted=True, wait_time_secs=300):
"""
Waits for an environment to have the given version_label
and to be in the green state
@@ -473,9 +473,9 @@ class EbsHelper(object):
if version_label is not None:
good_to_go = good_to_go and str(env['VersionLabel']) == version_label
- if env['Status'] == 'Ready' and env['Health'] == 'Ready':
+ if env['Status'] == 'Ready' and env['Health'] == 'Red':
out('Deploy failed')
- raise Exception('Ready and read')
+ raise Exception('Ready and red')
# log it
if good_to_go: | Fix typo in wait_for_environments | briandilley_ebs-deploy | train | py |
6bd159ac20cd41a035304bc2925ec939f75116f6 | diff --git a/src/Phar/PharComposer.php b/src/Phar/PharComposer.php
index <HASH>..<HASH> 100644
--- a/src/Phar/PharComposer.php
+++ b/src/Phar/PharComposer.php
@@ -208,6 +208,7 @@ class PharComposer
// failure to write will emit a warning (ignore) and throw an (uncaught) exception
try {
@$targetPhar->stopBuffering();
+ $targetPhar = null;
} catch (\PharException $e) {
throw new \RuntimeException('Unable to write phar: ' . $e->getMessage());
}
@@ -223,8 +224,12 @@ class PharComposer
$this->log(' - Overwriting existing file <info>' . $target . '</info> (' . $this->getSize($target) . ')');
}
- if (rename($tmp, $target) === false) {
- throw new \UnexpectedValueException('Unable to rename temporary phar archive to "'.$target.'"');
+ if (@rename($tmp, $target) === false) {
+ // retry renaming after sleeping to give slow network drives some time to flush data
+ sleep(5);
+ if (rename($tmp, $target) === false) {
+ throw new \UnexpectedValueException('Unable to rename temporary phar archive to "'.$target.'"');
+ }
}
$time = max(microtime(true) - $time, 0); | Improve Windows support by retrying rename to fix slow network drives | clue_phar-composer | train | php |
6de96721b0fe18fbf5906fc81797e4a31362a6f0 | diff --git a/blockstack/lib/operations/register.py b/blockstack/lib/operations/register.py
index <HASH>..<HASH> 100644
--- a/blockstack/lib/operations/register.py
+++ b/blockstack/lib/operations/register.py
@@ -583,8 +583,8 @@ def check_renewal( state_engine, nameop, block_id, checked_ops ):
# pre F-day 2017: we don't change sender_pubkey
# post F-day 2017: we do, since the sender can have changed
- if EPOCH_FEATURE_OP_RENEW_TRANSFER_UPDATE not in epoch_features:
- del nameop['sender_pubkey']
+ #if EPOCH_FEATURE_OP_RENEW_TRANSFER_UPDATE not in epoch_features:
+ # del nameop['sender_pubkey']
del nameop['burn_address'] | don't clear out sender_pubkey | blockstack_blockstack-core | train | py |
2d7438a6de82c439a5390b39d33f0c07e36b57a3 | diff --git a/model/NextDocumentSchema.js b/model/NextDocumentSchema.js
index <HASH>..<HASH> 100644
--- a/model/NextDocumentSchema.js
+++ b/model/NextDocumentSchema.js
@@ -82,6 +82,14 @@ export default class NextDocumentSchema {
].join('\n')
}
+ getNodeSchema (type) {
+ return this._documentSchema.getNodeSchema(type)
+ }
+
+ getNodeClass (type) {
+ return this._documentSchema.getNodeClass(type)
+ }
+
_getPublicId (version) {
// TODO: until we introduce minor versions we just use '0' for minor
return `-//${this.issuer.toUpperCase()}//DTD ${this.name} v${version}.0//EN` | Expose more of the existing doc schema API. | substance_substance | train | js |
f115a45115f20bd5ac863b4417b156d2fbdf9e83 | diff --git a/tests/contrib/test_bootstrap.py b/tests/contrib/test_bootstrap.py
index <HASH>..<HASH> 100644
--- a/tests/contrib/test_bootstrap.py
+++ b/tests/contrib/test_bootstrap.py
@@ -43,3 +43,17 @@ class TestBootstrapTapeformMixin:
form = DummyForm()
assert form.get_widget_css_class(
'my_field2', form.fields['my_field2']) == 'form-check-input'
+
+ def test_widget_css_class_invalid(self):
+ form = DummyForm({})
+ form.full_clean()
+ css_classes = form.fields['my_field1'].widget.attrs['class'].split(' ')
+ assert 'is-invalid' in css_classes
+ assert 'form-control' in css_classes
+
+ def test_add_error(self):
+ form = DummyForm({})
+ form.add_error(None, 'Non field error!')
+ form.add_error('my_field1', 'Error!')
+ css_classes = form.fields['my_field1'].widget.attrs['class'].split(' ')
+ assert 'is-invalid' in css_classes | Add tests for invalid fields in bootstrap | stephrdev_django-tapeforms | train | py |
2bd330f7cffc7ae8c59f588650e8d53190bc315b | diff --git a/src/Illuminate/Routing/Router.php b/src/Illuminate/Routing/Router.php
index <HASH>..<HASH> 100755
--- a/src/Illuminate/Routing/Router.php
+++ b/src/Illuminate/Routing/Router.php
@@ -690,14 +690,17 @@ class Router implements RegistrarContract
*/
protected function runRouteWithinStack(Route $route, Request $request)
{
- $middleware = $this->gatherRouteMiddlewares($route);
-
+ // First we try to know if middleware is disabled or not, if it is disabled it
+ // means we should skip middleware so we just pass an empty array
+ // otherwise we try to gather route middlewares.
$shouldSkipMiddleware = $this->container->bound('middleware.disable') &&
$this->container->make('middleware.disable') === true;
+ $middleware = $shouldSkipMiddleware ? [] : $this->gatherRouteMiddlewares($route);
+
return (new Pipeline($this->container))
->send($request)
- ->through($shouldSkipMiddleware ? [] : $middleware)
+ ->through($middleware)
->then(function ($request) use ($route) {
return $this->prepareResponse(
$request, | should we gather route middlewares or not
Before this change we first gather the route middlewares and then check
wether we should pass them or not , but now we check if we want to use
them or not , if yes then we gather them otherwise we do not gather them. | laravel_framework | train | php |
af02e9c531c228394a8375f9fa76e11b64b18622 | diff --git a/lib/compile.js b/lib/compile.js
index <HASH>..<HASH> 100644
--- a/lib/compile.js
+++ b/lib/compile.js
@@ -143,7 +143,8 @@ function compileCodeFromFile(filename, options = {}) {
if (options.cache) {
const code = options.cache.get(filename);
if (code !== undefined) {
- return code;
+ resolve(code);
+ return;
}
} | Fixed a bug where compiling cached templates never completes. | mxjp_node-subcode | train | js |
4fe47a02eee1ff16624d83498170b3996c5c4a85 | diff --git a/lib/solve/constraint.rb b/lib/solve/constraint.rb
index <HASH>..<HASH> 100644
--- a/lib/solve/constraint.rb
+++ b/lib/solve/constraint.rb
@@ -150,34 +150,28 @@ module Solve
attr_reader :pre_release
attr_reader :build
- # @param [#to_s] constraint (">= 0.0.0")
- def initialize(constraint = nil)
- if constraint.nil? || constraint.empty?
- constraint = ">= 0.0.0"
- end
+ # Return the Solve::Version representation of the major, minor, and patch
+ # attributes of this instance
+ #
+ # @return [Solve::Version]
+ attr_reader :version
+ # @param [#to_s] constraint
+ def initialize(constraint = '>= 0.0.0')
@operator, @major, @minor, @patch, @pre_release, @build = self.class.split(constraint)
unless operator_type == :approx
@minor ||= 0
@patch ||= 0
end
- end
- # Return the Solve::Version representation of the major, minor, and patch
- # attributes of this instance
- #
- # @return [Solve::Version]
- def version
- @version ||= Version.new(
- [
- self.major,
- self.minor,
- self.patch,
- self.pre_release,
- self.build
- ]
- )
+ @version = Version.new([
+ self.major,
+ self.minor,
+ self.patch,
+ self.pre_release,
+ self.build,
+ ])
end
# @return [Symbol] | Eagerload @version for Constraint
Formerly, if a Constraint is frozen, calling #version would raise an
exception because it lazily cached the the version and saved it to an
instance variable. This commit eagerloads the version attribute and uses
an attr_reader instead. | berkshelf_solve | train | rb |
d8716a7582f5301787f25213c6421aef9c0d5aa7 | diff --git a/salt/cloud/clouds/openstack.py b/salt/cloud/clouds/openstack.py
index <HASH>..<HASH> 100644
--- a/salt/cloud/clouds/openstack.py
+++ b/salt/cloud/clouds/openstack.py
@@ -844,7 +844,7 @@ def _assign_floating_ips(vm_, conn, kwargs):
pool = OpenStack_1_1_FloatingIpPool(
'', conn.connection
)
- for idx in [pool.create_floating_ip()]:
+ for idx in pool.list_floating_ips():
if idx.node_id is None:
floating.append(idx)
if not floating: | salt-cloud will use list_floating_ips for Openstack (#<I>)
This changes salt-cloud for Openstack to list_floating_ips when
nodes are provisioned. This prevents quota errors whe attempting
to allocate IPs to a project when the quota is maxed out but there
are unassigned IPs. | saltstack_salt | train | py |
f87defddcaeb777249c23cba873aeff1942a3ff5 | diff --git a/src/Application.php b/src/Application.php
index <HASH>..<HASH> 100644
--- a/src/Application.php
+++ b/src/Application.php
@@ -293,22 +293,4 @@ class Application extends \Symfony\Component\Console\Application
$command = $this->get($command);
return $this->doRunCommand($command, $input, $output);
}
-
-
- /**
- * {@inheritDoc}
- */
- public function getTerminalWidth()
- {
- return parent::getTerminalWidth();
- }
-
-
- /**
- * {@inheritDoc}
- */
- public function getTerminalHeight()
- {
- return parent::getTerminalHeight();
- }
} | Drop the terminal dimension methods that have been removed upstream | duncan3dc_console | train | php |
bfa71bcd42a8f1a9018aa8c89266ccc574d11f57 | diff --git a/alot/addressbook/abook.py b/alot/addressbook/abook.py
index <HASH>..<HASH> 100644
--- a/alot/addressbook/abook.py
+++ b/alot/addressbook/abook.py
@@ -15,7 +15,7 @@ class AbookAddressBook(AddressBook):
:type path: str
"""
AddressBook.__init__(self, **kwargs)
- DEFAULTSPATH = os.path.join(os.path.dirname(__file__), 'defaults')
+ DEFAULTSPATH = os.path.join(os.path.dirname(__file__), '..', 'defaults')
self._spec = os.path.join(DEFAULTSPATH, 'abook_contacts.spec')
path = os.path.expanduser(path)
self._config = read_config(path, self._spec) | alot/addressbook/abook.py: fix DEFAULTSPATH to account for code movement in commit 2f<I>af | pazz_alot | train | py |
0837c385a6477ebde0f5aa867cd41b4d12360d70 | diff --git a/client.go b/client.go
index <HASH>..<HASH> 100644
--- a/client.go
+++ b/client.go
@@ -118,7 +118,7 @@ func (self *Client) Streams() (streams []av.CodecData, err error) {
return
}
-func (self *Client) sendRtpKeepalive() (err error) {
+func (self *Client) SendRtpKeepalive() (err error) {
if self.RtpKeepAliveTimeout > 0 && self.rtpKeepaliveEnterCnt == 0 {
self.rtpKeepaliveEnterCnt++
defer func() {
@@ -201,7 +201,7 @@ func (self *Client) ReadResponse() (res Response, err error) {
if _, err = io.ReadFull(self.rconn, res.Block); err != nil {
return
}
- if err = self.sendRtpKeepalive(); err != nil {
+ if err = self.SendRtpKeepalive(); err != nil {
return
}
} | make send rtp keepalive public | nareix_joy4 | train | go |
a5ece8397b520f350e75abdb1b7bac8fbbba2d62 | diff --git a/pycm/pycm_obj.py b/pycm/pycm_obj.py
index <HASH>..<HASH> 100644
--- a/pycm/pycm_obj.py
+++ b/pycm/pycm_obj.py
@@ -797,11 +797,10 @@ class ConfusionMatrix():
"""
if self.predict_vector is None or self.actual_vector is None:
raise pycmVectorError(VECTOR_ONLY_ERROR)
- classes = set.union(set(self.predict_vector), set(self.actual_vector))
if self.positions is None:
+ classes = list(self.label_map.keys())
positions = {self.label_map[_class] : {'TP':[], 'FP':[], 'TN':[], 'FN':[]} for _class in classes}
- predict_vector = self.predict_vector
- actual_vector = self.actual_vector
+ [actual_vector, predict_vector] = vector_filter(self.actual_vector, self.predict_vector)
for index, observation in enumerate(predict_vector):
for _class in classes:
if observation == actual_vector[index]: | fix : minor edit in position method | sepandhaghighi_pycm | 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.