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
a4ba0a96f1cdc16b00addfe272c8d1504a5edee7
diff --git a/lib/editorlib.php b/lib/editorlib.php index <HASH>..<HASH> 100644 --- a/lib/editorlib.php +++ b/lib/editorlib.php @@ -106,7 +106,7 @@ function get_texteditor($editorname) { function get_available_editors() { $editors = array(); foreach (get_plugin_list('editor') as $editorname => $dir) { - $editors[$editorname] = get_string('modulename', 'editor_'.$editorname); + $editors[$editorname] = get_string('pluginname', 'editor_'.$editorname); } return $editors; } @@ -185,7 +185,7 @@ abstract class texteditor { } //TODO: this is very wrong way to do admin settings - this has to be rewritten -require_once($CFG->libdir.'/formslib.php'); +require_once($CFG->libdir.'/formslib.php'); /** * Editor settings moodle form class. *
fixed recent regression when fixing pluginname in editors
moodle_moodle
train
php
fa04ac3a90bcbaacc25a0e1477d21781d0fb4212
diff --git a/public/js/editors/libraries.js b/public/js/editors/libraries.js index <HASH>..<HASH> 100644 --- a/public/js/editors/libraries.js +++ b/public/js/editors/libraries.js @@ -681,6 +681,16 @@ var libraries = [ 'url': 'https://cdnjs.cloudflare.com/ajax/libs/mori/0.3.2/mori.js', 'label': 'mori 0.3.2', 'group': 'Data structures' + }, + { + 'url': 'http://cdn.jsdelivr.net/ramda/0.15.1/ramda.min.js', + 'label': 'Ramda 0.15.1', + 'group': 'Ramda' + }, + { + 'url': 'http://cdn.jsdelivr.net/ramda/latest/ramda.min.js', + 'label': 'Ramda Latest', + 'group': 'Ramda' } ];
Add Ramda as an available library
jsbin_jsbin
train
js
6fc409a30cf41c985621b2109944c83df7ab0b49
diff --git a/src/Codeception/Lib/Generator/Cest.php b/src/Codeception/Lib/Generator/Cest.php index <HASH>..<HASH> 100644 --- a/src/Codeception/Lib/Generator/Cest.php +++ b/src/Codeception/Lib/Generator/Cest.php @@ -13,11 +13,11 @@ class Cest { class {{name}}Cest { - public function _before() + public function _before({{actor}} \$I) { } - public function _after() + public function _after({{actor}} \$I) { }
Repair TestCase/Cest.php such that the _before and _after methods receive "the guy" in their argument lists.
Codeception_base
train
php
cdaf6d7459be2384ee59665e42fbbd264d61aaf6
diff --git a/satpy/readers/yaml_reader.py b/satpy/readers/yaml_reader.py index <HASH>..<HASH> 100644 --- a/satpy/readers/yaml_reader.py +++ b/satpy/readers/yaml_reader.py @@ -40,7 +40,7 @@ from pyresample.geometry import AreaDefinition from satpy.composites import IncompatibleAreas from satpy.config import recursive_dict_update from satpy.projectable import Projectable -from satpy.readers import DatasetDict, DatasetID +from satpy.readers import DATASET_KEYS, DatasetDict, DatasetID from satpy.readers.helper_functions import get_area_slices, get_sub_area from trollsift.parser import globify, parse @@ -203,8 +203,7 @@ class AbstractYAMLReader(six.with_metaclass(ABCMeta, object)): """Get the dataset matching a given a dataset id.""" if ids is None: ids = self.ids.keys() - keys = dsid._asdict().keys() - for key in keys: + for key in DATASET_KEYS: value = getattr(dsid, key) if value is None: continue
Fix test by using DATASET_KEYS instead of DatasetID's as_dict
pytroll_satpy
train
py
59e0cc914b973679bdba216a08b8cb0e42dbd406
diff --git a/logback-access/src/main/java/ch/qos/logback/access/jetty/RequestLogImpl.java b/logback-access/src/main/java/ch/qos/logback/access/jetty/RequestLogImpl.java index <HASH>..<HASH> 100644 --- a/logback-access/src/main/java/ch/qos/logback/access/jetty/RequestLogImpl.java +++ b/logback-access/src/main/java/ch/qos/logback/access/jetty/RequestLogImpl.java @@ -146,9 +146,6 @@ public class RequestLogImpl extends ContextBase implements RequestLog, getStatusManager().add(new InfoStatus(msg, this)); } -// private void addWarn(String msg) { -// getStatusManager().add(new WarnStatus(msg, this)); -// } private void addError(String msg) { getStatusManager().add(new ErrorStatus(msg, this)); } @@ -219,6 +216,10 @@ public class RequestLogImpl extends ContextBase implements RequestLog, this.fileName = fileName; } + public void setResource(String resource) { + this.resource = resource; + } + public boolean isStarted() { return started; }
added setter for 'resource'
tony19_logback-android
train
java
35bbac969b0db6478c8be9aa63750819b9439d7a
diff --git a/src/editor/components/TableComponent.js b/src/editor/components/TableComponent.js index <HASH>..<HASH> 100644 --- a/src/editor/components/TableComponent.js +++ b/src/editor/components/TableComponent.js @@ -213,13 +213,14 @@ export default class TableComponent extends CustomSurface { // console.log('IS RIGHT BUTTON') // this will be handled by onContextMenu if (target.type === 'cell') { + let targetCell = this.props.node.get(target.id) let _needSetSelection = true let _selData = this._getSelectionData() - if (_selData) { + if (_selData && targetCell) { let { startRow, startCol, endRow, endCol } = getCellRange(this.props.node, _selData.anchorCellId, _selData.focusCellId) _needSetSelection = ( - target.colIdx < startCol || target.colIdx > endCol || - target.rowIdx < startRow || target.rowIdx > endRow + targetCell.colIdx < startCol || targetCell.colIdx > endCol || + targetCell.rowIdx < startRow || targetCell.rowIdx > endRow ) } if (_needSetSelection) {
Fix TableComponent's right-click handling.
substance_texture
train
js
fe6df9829500c8ab6dfbb1ae354fdb7cf699c822
diff --git a/src/scripts/cli-script-helper-functions.php b/src/scripts/cli-script-helper-functions.php index <HASH>..<HASH> 100644 --- a/src/scripts/cli-script-helper-functions.php +++ b/src/scripts/cli-script-helper-functions.php @@ -257,6 +257,19 @@ function printInfo($str, $append_new_line = true) { if( ((bool)$append_new_line) ) { echo PHP_EOL; } } +function normalizeNameSpaceName($namespace_name){ + + $namespace_name = ''.$namespace_name; + + if(strlen($namespace_name) > 1 && $namespace_name[0] === '\\') { + + //strip off the preceding \ + $namespace_name = substr($namespace_name, 1); + } + + return $namespace_name; +} + /** * * @@ -516,6 +529,7 @@ function createController($argc, array $argv) { } //validation passed + $namepace_4_controller = normalizeNameSpaceName($namepace_4_controller); $namepace_declaration = "namespace {$namepace_4_controller};"; } else { @@ -530,6 +544,7 @@ function createController($argc, array $argv) { } //validation passed + $namepace_4_controller = normalizeNameSpaceName($namepace_4_controller); $namepace_declaration = "namespace {$namepace_4_controller};"; }
Fixed bug in ./vendor/bin/s3mvc-create-controller-wizard that creates controller with namespace prefixed with \
rotexsoft_slim3-skeleton-mvc-tools
train
php
a475d79886db95e35c286d1f13e301c50e4d4c3d
diff --git a/addon/components/block-slot.js b/addon/components/block-slot.js index <HASH>..<HASH> 100644 --- a/addon/components/block-slot.js +++ b/addon/components/block-slot.js @@ -12,7 +12,7 @@ const { * The maximum allowed number of block parameters supported * * @memberof module:addon/components/block-slot - * @const {Number} blockParamsAllowed + * @constant {Number} blockParamsAllowed * @default 10 */ const blockParamsAllowed = 10
fixed use of constant in docBlock to be consistent with style docs
ciena-blueplanet_ember-block-slots
train
js
d90905e40435f3e61f5ca86f654447598e033919
diff --git a/src/article/InternalArticleSchema.js b/src/article/InternalArticleSchema.js index <HASH>..<HASH> 100644 --- a/src/article/InternalArticleSchema.js +++ b/src/article/InternalArticleSchema.js @@ -120,7 +120,8 @@ Figure.schema = { class TableFigure extends Figure {} TableFigure.schema = { type: 'table-figure', - content: CHILD('table') + content: CHILD('table'), + footnotes: CHILDREN('fn') } class Groups extends XMLElementNode {}
Keep footnotes inside Table Figure.
substance_texture
train
js
e4f205aabf066008b5a7c338d32f28a2866bb2cd
diff --git a/src/asset.js b/src/asset.js index <HASH>..<HASH> 100644 --- a/src/asset.js +++ b/src/asset.js @@ -2,7 +2,7 @@ import * as validators from './validators' export default function (Vue: GlobalAPI): void { - const extend = Vue.util.extend + const { extend } = Vue.util // set global validators asset const assets: Object = Object.create(null)
:shirt: refactor: destructuring
kazupon_vue-validator
train
js
5e4071d7fba80d8a3815c147a04eaad6ea82ca73
diff --git a/models/classes/http/Controller.php b/models/classes/http/Controller.php index <HASH>..<HASH> 100644 --- a/models/classes/http/Controller.php +++ b/models/classes/http/Controller.php @@ -37,7 +37,10 @@ abstract class Controller use HttpRequestHelperTrait; use HttpFlowTrait; + /** @var ServerRequestInterface */ protected $request; + + /** @var ResponseInterface */ protected $response; /** @@ -52,6 +55,11 @@ abstract class Controller return $this; } + public function isJsonRequest(): bool + { + return $this->request && current($this->request->getHeader('content-type')) === 'application/json'; + } + /** * Set Psr7 http response *
add isJsonRequest method for controller
oat-sa_tao-core
train
php
4572ad810bf7c2e3468fcee11b3cf54b9fa19b76
diff --git a/lib/puppet/type/exec.rb b/lib/puppet/type/exec.rb index <HASH>..<HASH> 100644 --- a/lib/puppet/type/exec.rb +++ b/lib/puppet/type/exec.rb @@ -413,7 +413,8 @@ module Puppet `grep` determines it's already there. Note that this command follows the same rules as the main command, - which is to say that it must be fully qualified if the path is not set. + such as which user and group it's run as. + This also means it must be fully qualified if the path is not set. It also uses the same provider as the main command, so any behavior that differs by provider will match. EOT @@ -456,7 +457,9 @@ module Puppet This would run `logrotate` only if that test returned true. Note that this command follows the same rules as the main command, - which is to say that it must be fully qualified if the path is not set. + such as which user and group it's run as. + This also means it must be fully qualified if the path is not set. + It also uses the same provider as the main command, so any behavior that differs by provider will match.
(docs) Clarification on unless and only Could probably clearer that the `unless` and `only` parameters have all the same parameters as the main exec, not just the path. (DOCUMENT-<I>)
puppetlabs_puppet
train
rb
e108669bab2eca7ed4b1210b98e2580f74f5470c
diff --git a/src/components/Button.js b/src/components/Button.js index <HASH>..<HASH> 100644 --- a/src/components/Button.js +++ b/src/components/Button.js @@ -43,7 +43,6 @@ const Button = React.createClass({ <button aria-label={this.props.ariaLabel} onClick={this.props.type === 'disabled' ? null : this.props.onClick} - role='button' style={Object.assign({}, styles.component, styles[this.props.type], this.props.style)} > <div style={styles.children}>
Removes button role now that element is native button
mxenabled_mx-react-components
train
js
d8c947e66b7a4cf31d01d1177702f2a35c913205
diff --git a/squad/core/models.py b/squad/core/models.py index <HASH>..<HASH> 100644 --- a/squad/core/models.py +++ b/squad/core/models.py @@ -856,7 +856,12 @@ class Test(models.Model): @property def full_name(self): - return join_name(self.suite.slug, self.name) + suite = '' + if self.metadata is None: + suite = self.suite.slug + else: + suite = self.metadata.suite + return join_name(suite, self.name) class History(object): def __init__(self, since, count, last_different):
core: models: use metadata for retrieving test full name Prioritize SuiteMetadata.suite in favor of Suite.slug when making test's full name. This will reduce one prefetch_related when fetching tests.
Linaro_squad
train
py
e6c4fc72ce5dc7c5b0e260b7b3a9e4d010eb08f6
diff --git a/src/Http/FormAuthenticationModule.php b/src/Http/FormAuthenticationModule.php index <HASH>..<HASH> 100644 --- a/src/Http/FormAuthenticationModule.php +++ b/src/Http/FormAuthenticationModule.php @@ -102,6 +102,7 @@ class FormAuthenticationModule implements ServiceModuleInterface $this->session->delete('_two_factor_verified'); $this->session->delete('_cached_groups_user_id'); $this->session->delete('_cached_groups'); + $this->session->delete('_last_authenticated_at_ping_sent'); $this->session->regenerate(true); return new RedirectResponse($request->requireHeader('HTTP_REFERER'));
also delete _last_authenticated_at_ping_sent from session on logout
eduvpn_vpn-lib-common
train
php
fe5a271a203ac75edc248e0e2c3a61d4c1b9a3e7
diff --git a/angular-loggly-logger.js b/angular-loggly-logger.js index <HASH>..<HASH> 100644 --- a/angular-loggly-logger.js +++ b/angular-loggly-logger.js @@ -168,7 +168,7 @@ } else if(angular.isObject(msg)){ //handling JSON objects - sending.messageObj = msg; + sending = angular.extend({}, msg, sending); } else{ //sending plain text
Removed messageObj field Removed messageObj field for the custom object and extended custom json object fields to the parent json.
ajbrown_angular-loggly-logger
train
js
702541356f8fc0fb7da1c7e623413771619bdf06
diff --git a/solidity/test/BancorFormula.js b/solidity/test/BancorFormula.js index <HASH>..<HASH> 100644 --- a/solidity/test/BancorFormula.js +++ b/solidity/test/BancorFormula.js @@ -48,4 +48,19 @@ contract('BancorFormula', () => { assert(retVal.lessThan(maxVal), `Result of function fixedExp(${maxExp.plus(1)}, ${precision}) indicates that maxExpArray[${precision}] is wrong`); }); } + + for (let n = 1; n <= 255; n++) { + let val1 = web3.toBigNumber(2).toPower(n); + let val2 = web3.toBigNumber(2).toPower(n).plus(1); + let val3 = web3.toBigNumber(2).toPower(n+1).minus(1); + + it('Verify function floorLog2 legal input', async () => { + let retVal1 = await formula.testFloorLog2.call(val1); + let retVal2 = await formula.testFloorLog2.call(val2); + let retVal3 = await formula.testFloorLog2.call(val3); + assert(retVal1.equals(web3.toBigNumber(n)), `Result of function floorLog2(${val1}) is wrong`); + assert(retVal2.equals(web3.toBigNumber(n)), `Result of function floorLog2(${val2}) is wrong`); + assert(retVal3.equals(web3.toBigNumber(n)), `Result of function floorLog2(${val3}) is wrong`); + }); + } });
Update the BancorFormula JS test.
bancorprotocol_contracts
train
js
9492c9bda83d99b4d55bb171bea3d27702591898
diff --git a/rendersheet.js b/rendersheet.js index <HASH>..<HASH> 100644 --- a/rendersheet.js +++ b/rendersheet.js @@ -204,9 +204,14 @@ class RenderSheet const current = this.textures[key]; if (current.texture) { - current.texture.destroy(); + current.texture = new PIXI.Texture(this.baseTextures[current.canvas], new PIXI.Rectangle(current.x, current.y, current.width, current.height)); + } + else + { + current.texture.baseTexture = this.baseTextures[current.canvas]; + current.texture.frame = new PIXI.Rectangle(current.x, current.y, current.width, current.height); + current.texture.update(); } - current.texture = new PIXI.Texture(this.baseTextures[current.canvas], new PIXI.Rectangle(current.x, current.y, current.width, current.height)); } } @@ -342,6 +347,7 @@ class RenderSheet { if (packers[j].add(block, j)) { + block.texture = j; packed = true; break; } @@ -357,6 +363,10 @@ class RenderSheet } return; } + else + { + block.texture = j; + } } }
Fixing an issue with canvas index not added to texture
davidfig_rendersheet
train
js
94d9d851cd990c918c2a4b3da0d8c02ca95c2dba
diff --git a/isort/isort.py b/isort/isort.py index <HASH>..<HASH> 100644 --- a/isort/isort.py +++ b/isort/isort.py @@ -209,7 +209,14 @@ class SortImports(object): if module_name_to_check in self.config[config_key]: return placement - for prefix in PYTHONPATH: + paths = PYTHONPATH + virtual_env = os.environ.get('VIRTUAL_ENV', None) + if virtual_env: + paths = list(paths) + for version in ((2, 6), (2, 7), (3, 0), (3, 1), (3, 2), (3, 3), (3, 4)): + paths.append("{0}/lib/python{1}.{2}/site-packages".format(virtual_env, version[0], version[1])) + + for prefix in paths: module_path = "/".join((prefix, moduleName.replace(".", "/"))) package_path = "/".join((prefix, moduleName.split(".")[0])) if (os.path.exists(module_path + ".py") or os.path.exists(module_path + ".so") or
Smarter virtualenv behaviour inspired by feedback from @spookylukey
timothycrosley_isort
train
py
8ae6d9b61d60b1d1e26eea8e95deab0bf4dfd8c1
diff --git a/blimpy/waterfall.py b/blimpy/waterfall.py index <HASH>..<HASH> 100755 --- a/blimpy/waterfall.py +++ b/blimpy/waterfall.py @@ -110,7 +110,7 @@ class Waterfall(Filterbank): t_start (int): start integration ID t_stop (int): stop integration ID load_data (bool): load data. If set to False, only header will be read. - max_load (float): maximum data to load in GB. Default: 1GB. + max_load (float): maximum data to load in GB. Default: 1GB. e.g. 0.1 is 100 MB header_dict (dict): Create blimpy from header dictionary + data array data_array (np.array): Create blimpy from header dict + data array @@ -576,9 +576,10 @@ def cmd_tool(args=None): parser.add_argument('-l', action='store', default=None, dest='max_load', type=float, help='Maximum data limit to load. Default:1GB') - if args is None: - args = sys.argv - parse_args = parser.parse_args(args) +# if args is None: +# args = sys.argv +# parse_args = parser.parse_args(args) + parse_args = parser.parse_args() # Open blimpy data filename = parse_args.filename
Pushing back on commit 1d<I>d<I>fb1e<I>d0cac<I>fb<I>aea<I>ca since it causes command line “watutil” to break. Need new solution.
UCBerkeleySETI_blimpy
train
py
a4e822107246d4393bf241129f3dbf86e5b1aecb
diff --git a/lib/plugins/stats.js b/lib/plugins/stats.js index <HASH>..<HASH> 100644 --- a/lib/plugins/stats.js +++ b/lib/plugins/stats.js @@ -61,7 +61,14 @@ module.exports = function(options){ // requests if (options.requests) { - server.on('request', function(req, res){ + // force cluster's callback first + if (Array.isArray(server._events.request)) { + server._events.request.unshift(request); + } else { + server._events.request = [request, server._events.request]; + } + + function request(req, res){ var data = { remoteAddress: req.socket.remoteAddress , headers: req.headers @@ -79,7 +86,7 @@ module.exports = function(options){ res.end(str, encoding); master.call('reportStats', 'request complete', data); } - }); + }; } // master stats } else {
force cluster's request callback first to proxy end() for sync req/res cycle'
LearnBoost_cluster
train
js
17c7c25258c8b5f5b5092c294cfa41b70a877ea5
diff --git a/core/vocabulary/src/test/java/org/trellisldp/vocabulary/AbstractVocabularyTest.java b/core/vocabulary/src/test/java/org/trellisldp/vocabulary/AbstractVocabularyTest.java index <HASH>..<HASH> 100644 --- a/core/vocabulary/src/test/java/org/trellisldp/vocabulary/AbstractVocabularyTest.java +++ b/core/vocabulary/src/test/java/org/trellisldp/vocabulary/AbstractVocabularyTest.java @@ -76,7 +76,7 @@ public abstract class AbstractVocabularyTest { assertTrue(subjects.contains(namespace() + field), "Field definition is not in published ontology! " + field); } else if (!subjects.contains(namespace() + field)) { - LOGGER.warn("Field definition is not in published ontology! {}", field); + LOGGER.debug("Field definition is not in published ontology! {}", field); } }); } @@ -93,7 +93,7 @@ public abstract class AbstractVocabularyTest { .filterKeep(Objects::nonNull) .filterKeep(uri -> uri.startsWith(namespace())).filterDrop(namespace()::equals) .filterDrop(subjects::contains).forEachRemaining(uri -> { - LOGGER.warn("{} not defined in {} class", uri, vocabulary().getName()); + LOGGER.debug("{} not defined in {} class", uri, vocabulary().getName()); }); }
Turn down console warnings Related to #<I>
trellis-ldp_trellis
train
java
92b3506eee7466fa4cfb95951e2e6c24c7af95ba
diff --git a/test/tests/signature.js b/test/tests/signature.js index <HASH>..<HASH> 100644 --- a/test/tests/signature.js +++ b/test/tests/signature.js @@ -41,7 +41,7 @@ describe("Signature", function() { assert.equal(when.offset(), -now.getTimezoneOffset()); }); - it("can get a default signature when no user name is set", function(done) { + it("can get a default signature when no user name is set", function() { var savedUserName; var savedUserEmail; @@ -75,11 +75,9 @@ describe("Signature", function() { assert.equal(sig.email(), "unknown@example.com"); }) .then(cleanUp) - .then(done) .catch(function(e) { - cleanUp() + return cleanUp() .then(function() { - done(e); return Promise.reject(e); }); });
Fix asynchronous testing of signatures The previous implementation mixed promises and callbacks in a way that was incompatible with mocha. This patch removes the callback and uses promises only.
nodegit_nodegit
train
js
911abe69c29cdc23046d288abe6337d3ab3eb823
diff --git a/spec/filters/bugs/hash.rb b/spec/filters/bugs/hash.rb index <HASH>..<HASH> 100644 --- a/spec/filters/bugs/hash.rb +++ b/spec/filters/bugs/hash.rb @@ -86,7 +86,6 @@ opal_filter "Hash" do fails "Hash#initialize_copy does not transfer default values" fails "Hash#initialize_copy calls to_hash on hash subclasses" fails "Hash#initialize_copy tries to convert the passed argument to a hash using #to_hash" - fails "Hash#initialize_copy tries to convert the passed argument to a hash using #to_hash" fails "Hash#initialize_copy replaces the contents of self with other" fails "Hash#inspect handles hashes with recursive values"
Move another frozen hash spec to unsupported
opal_opal
train
rb
b067866c6976f5349fe99e46e3cd18e359f49aeb
diff --git a/cheroot/workers/threadpool.py b/cheroot/workers/threadpool.py index <HASH>..<HASH> 100644 --- a/cheroot/workers/threadpool.py +++ b/cheroot/workers/threadpool.py @@ -320,7 +320,7 @@ class ThreadPool: return ( thread for thread in threads - if thread is not threading.currentThread() + if thread is not threading.current_thread() ) @property
Use `current_thread()` to address Python <I> `DeprecationWarning` PR #<I>
cherrypy_cheroot
train
py
97b44085e4417d415b648418c66167effee7d308
diff --git a/src/js/panels.js b/src/js/panels.js index <HASH>..<HASH> 100644 --- a/src/js/panels.js +++ b/src/js/panels.js @@ -38,8 +38,14 @@ var Panels = { remove: function(id) { var panels = this.panels; for (var i = panels.length - 1; i >= 0; i--) { - if (panels[i].id === id) { + if (panels[i].id === id){ + var panelToRemove = panels[i]; panels.splice(i, 1); + //if removed panel was default, set first panel as new default, if exists + if (panelToRemove.default && panels.length){ + panels[0].default = true; + } + return; //should be no more panels with the same id } } }
set first panel as default, if default is removed
pattern-lab_styleguidekit-assets-default
train
js
0d900605d6dcfc22496d48cd374308a285008ebf
diff --git a/src/components/metadata/MetaObject.js b/src/components/metadata/MetaObject.js index <HASH>..<HASH> 100644 --- a/src/components/metadata/MetaObject.js +++ b/src/components/metadata/MetaObject.js @@ -34,7 +34,7 @@ export class MetaObject extends Component { {items} <a onClick={() => addField(namePrefix)} className="add-field-object" title="Add new key/value pair"> - New key/value pair + New key/value pair under <strong>{fieldKey}</strong> </a> </div> );
improve accessibility for deep nested objects
jekyll_jekyll-admin
train
js
9bba376ea8573c15d40f626c1ea0950ae2982813
diff --git a/common-core-open/src/main/java/com/bbn/bue/common/files/FileUtils.java b/common-core-open/src/main/java/com/bbn/bue/common/files/FileUtils.java index <HASH>..<HASH> 100755 --- a/common-core-open/src/main/java/com/bbn/bue/common/files/FileUtils.java +++ b/common-core-open/src/main/java/com/bbn/bue/common/files/FileUtils.java @@ -75,6 +75,18 @@ public final class FileUtils { } /** + * Create the parent directories of the given file, if needed. + */ + public static void ensureParentDirectoryExists(File f) throws IOException { + final File parent = f.getParentFile(); + if (parent != null) { + if (!parent.isDirectory() && !parent.mkdirs()) { + throw new IOException("Could not create parent directories for " + f.getAbsolutePath()); + } + } + } + + /** * Takes a file with filenames listed one per line and returns a list of the corresponding File * objects. Ignores blank lines and lines with a "#" in the first column position. Treats the * file as UTF-8 encoded.
Utility method to ensure the parent directories of a file exist
BBN-E_bue-common-open
train
java
ecba36e7f717e2df8db53cf7a1bfd315ca50dc1e
diff --git a/parallel.js b/parallel.js index <HASH>..<HASH> 100644 --- a/parallel.js +++ b/parallel.js @@ -18,7 +18,7 @@ function parallel (options) { last = null if (toCall.length === 0) { - done() + done.call(that) released(last) } else { holder._callback = done diff --git a/test.js b/test.js index <HASH>..<HASH> 100644 --- a/test.js +++ b/test.js @@ -199,3 +199,14 @@ test('call the callback with the given this with no results', function (t) { } } }) + +test('call the callback with the given this with no data', function (t) { + t.plan(1) + + var instance = parallel() + var obj = {} + + instance(obj, [], 42, function done () { + t.equal(obj, this, 'this matches') + }) +})
Call the final callback with the given this even if there is nothing to call.
mcollina_fastparallel
train
js,js
9cf6540dc0ed56b43bc8c9288701ea91e934abc3
diff --git a/templates/js/routes/index.js b/templates/js/routes/index.js index <HASH>..<HASH> 100644 --- a/templates/js/routes/index.js +++ b/templates/js/routes/index.js @@ -2,7 +2,7 @@ var express = require('express'); var router = express.Router(); /* GET home page. */ -router.get('/', function(req, res) { +router.get('/', function(req, res, next) { res.render('index', { title: 'Express' }); }); diff --git a/templates/js/routes/users.js b/templates/js/routes/users.js index <HASH>..<HASH> 100644 --- a/templates/js/routes/users.js +++ b/templates/js/routes/users.js @@ -2,7 +2,7 @@ var express = require('express'); var router = express.Router(); /* GET users listing. */ -router.get('/', function(req, res) { +router.get('/', function(req, res, next) { res.send('respond with a resource'); });
gen: include next argument in route handlers closes #<I> closes #<I>
nodeGame_nodegame-generator
train
js,js
28726f737c444037116c9d3896229580aea2c2d4
diff --git a/peerconn.go b/peerconn.go index <HASH>..<HASH> 100644 --- a/peerconn.go +++ b/peerconn.go @@ -869,7 +869,7 @@ func (cn *PeerConn) wroteBytes(n int64) { cn.allStats(add(n, func(cs *ConnStats) *Count { return &cs.BytesWritten })) } -func (cn *PeerConn) readBytes(n int64) { +func (cn *Peer) readBytes(n int64) { cn.allStats(add(n, func(cs *ConnStats) *Count { return &cs.BytesRead })) } diff --git a/webseed-peer.go b/webseed-peer.go index <HASH>..<HASH> 100644 --- a/webseed-peer.go +++ b/webseed-peer.go @@ -126,6 +126,7 @@ func (ws *webseedPeer) requestResultHandler(r Request, webseedRequest webseed.Re // sure if we can divine which errors indicate cancellation on our end without hitting the // network though. ws.peer.doChunkReadStats(int64(len(result.Bytes))) + ws.peer.readBytes(int64(len(result.Bytes))) ws.peer.t.cl.lock() defer ws.peer.t.cl.unlock() if result.Err != nil {
Record webseed request result bytes against client stats Should fix the issue where webseeds cause ><I>% useful data readings.
anacrolix_torrent
train
go,go
b6f01b29a08427d46cb90fdb87577e0f8a73efbf
diff --git a/src/api.js b/src/api.js index <HASH>..<HASH> 100644 --- a/src/api.js +++ b/src/api.js @@ -30,6 +30,28 @@ exports = module.exports = { return fs.getData(source); }) .then(function (data) { + var group, i; + var count = 0; + var shouldBeDisplayed = function (item) { + return (config.display.access.indexOf(item.access[0]) !== -1) && !(!config.display.alias && item.alias); + }; + + // Adding a `display` key to each item + for (group in data) { + for (i = 0; i < data[group].length; i++) { + data[group][i].display = shouldBeDisplayed(data[group][i]); + + if (data[group][i].display === true) { + count++; + } + } + } + + config.dataCount = count; + + return data; + }) + .then(function (data) { logger.log('Folder `' + source + '` successfully parsed.'); config.data = data;
Moved some logic away from templates, back in the JS side
SassDoc_sassdoc
train
js
b33d25152730d9c3f37db43ae8d291176f1563ac
diff --git a/pysnmp/cache.py b/pysnmp/cache.py index <HASH>..<HASH> 100644 --- a/pysnmp/cache.py +++ b/pysnmp/cache.py @@ -21,7 +21,6 @@ class Cache: if self.__size >= self.__maxSize: keys = self.__usage.keys() keys.sort(lambda x,y,d=self.__usage: cmp(d[x],d[y])) - print keys[:self.__chopSize] for _k in keys[:self.__chopSize]: del self.__cache[_k] del self.__usage[_k]
stray debug printout removed
etingof_pysnmp
train
py
e1056bd3b6803258b4b20eb4f733c463307d7d1a
diff --git a/src/Traits/TButtonRenderer.php b/src/Traits/TButtonRenderer.php index <HASH>..<HASH> 100644 --- a/src/Traits/TButtonRenderer.php +++ b/src/Traits/TButtonRenderer.php @@ -33,10 +33,15 @@ trait TButtonRenderer * @return mixed * @throws DataGridColumnRendererException */ - public function useRenderer(?Row $row = null) + public function useRenderer($row = null) { $renderer = $this->getRenderer(); - $args = $row ? [$row->getItem()] : []; + + if ($row instanceof Row) { + $args = [$row->getItem()]; + } else { + $args = []; + } if (!$renderer) { throw new DataGridColumnRendererException;
Fixed TButtonRenderer to support php < <I>
contributte_datagrid
train
php
01189ea954372b005a6664d5701acfa57f854aa3
diff --git a/Provider/AdminMenuProvider.php b/Provider/AdminMenuProvider.php index <HASH>..<HASH> 100755 --- a/Provider/AdminMenuProvider.php +++ b/Provider/AdminMenuProvider.php @@ -100,12 +100,8 @@ class AdminMenuProvider { $file = $this->kernel->getCacheDir() . '/' . self::CACHE_FILENAME; $content = sprintf('<?php return %s;', var_export($menu, true)); - $tmpFile = tempnam(dirname($file), basename($file)); - if (false !== @file_put_contents($tmpFile, $content) && @rename($tmpFile, $file)) { - @chmod($file, 0666 & ~umask()); - - return; - } + $fs = new Filesystem(); + $fs->dumpFile($file, $content); } /** @@ -124,5 +120,4 @@ class AdminMenuProvider return $children; } - }
Changed cache dump method in admin menu provider (cherry picked from commit 9b<I>e<I>ac<I>fe<I>d1bfee<I>a7a7f<I>c<I>)
WellCommerce_WishlistBundle
train
php
671a494c4e501bb345995d0501a456c7aca29658
diff --git a/tests/Pheasant/Tests/EnumeratorTest.php b/tests/Pheasant/Tests/EnumeratorTest.php index <HASH>..<HASH> 100644 --- a/tests/Pheasant/Tests/EnumeratorTest.php +++ b/tests/Pheasant/Tests/EnumeratorTest.php @@ -11,7 +11,7 @@ class EnumeratorTest extends \Pheasant\Tests\MysqlTestCase public function testEnumerating() { - $dir = __DIR__.'/examples'; + $dir = __DIR__.'/Examples'; $files = array_map(function($f) { return substr(basename($f),0,-4); }, glob($dir.'/*.php'));
Fix bug with incorrect case in path, damn you HFS
lox_pheasant
train
php
8ae3558b27fe1690c0a24110dff81cb9dc84492b
diff --git a/sregistry/version.py b/sregistry/version.py index <HASH>..<HASH> 100644 --- a/sregistry/version.py +++ b/sregistry/version.py @@ -19,7 +19,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>. ''' -__version__ = "0.0.7" +__version__ = "0.0.61" AUTHOR = 'Vanessa Sochat' AUTHOR_EMAIL = 'vsochat@stanford.edu' NAME = 'sregistry'
don't more version up so quickly
singularityhub_sregistry-cli
train
py
c7f0dddf94ce4c0836747c35cd2e997b28ca02bb
diff --git a/resweb/views.py b/resweb/views.py index <HASH>..<HASH> 100644 --- a/resweb/views.py +++ b/resweb/views.py @@ -222,12 +222,17 @@ class Failed(ResWeb): import simplejson as json jobs = [] for job in failure.all(self.resq, self._start, self._start + 20): + backtrace = job['backtrace'] + + if isinstance(backtrace, list): + backtrace = '\n'.join(backtrace) + item = job item['failed_at'] = str(datetime.datetime.fromtimestamp(float(job['failed_at']))) item['worker_url'] = '/workers/%s/' % job['worker'] item['payload_args'] = str(job['payload']['args']) item['payload_class'] = job['payload']['class'] - item['traceback'] = job['backtrace'] + item['traceback'] = backtrace jobs.append(item) return jobs
Become compatible with resque-web without breaking backwards compatibility.
binarydud_pyres
train
py
43fcf969f47aa2fe3310be2657405c21c75c0375
diff --git a/Tests/AppKernel.php b/Tests/AppKernel.php index <HASH>..<HASH> 100644 --- a/Tests/AppKernel.php +++ b/Tests/AppKernel.php @@ -37,6 +37,14 @@ final class AppKernel extends Kernel /** * {@inheritdoc} */ + public function __construct(string $environment, bool $debug) + { + parent::__construct($environment, false); + } + + /** + * {@inheritdoc} + */ public function registerBundles() { $bundles = [
JWELoaderFactory and JWSLoaderfactory added
web-token_jwt-bundle
train
php
8205e82a7de320518efe1a3c83e5a9f5379db18b
diff --git a/src/main/groovy/util/slurpersupport/NodeChildren.java b/src/main/groovy/util/slurpersupport/NodeChildren.java index <HASH>..<HASH> 100644 --- a/src/main/groovy/util/slurpersupport/NodeChildren.java +++ b/src/main/groovy/util/slurpersupport/NodeChildren.java @@ -17,6 +17,7 @@ package groovy.util.slurpersupport; +import groovy.lang.Buildable; import groovy.lang.Closure; import groovy.lang.GroovyObject; import groovy.lang.GroovyRuntimeException; @@ -248,7 +249,13 @@ class NodeChildren extends GPathResult { final Iterator iter = nodeIterator(); while (iter.hasNext()) { - ((Node)iter.next()).build(builder, this.namespaceMap, this.namespaceTagHints); + final Object next = iter.next(); + + if (next instanceof Buildable) { + ((Buildable)next).build(builder); + } else { + ((Node)next).build(builder, this.namespaceMap, this.namespaceTagHints); + } } }
Fix problem when the result of a GPath filter operation is used in a builder git-svn-id: <URL>
apache_groovy
train
java
79c0dcaad5b0d4254affada05427064853bb40b4
diff --git a/indra/preassembler/__init__.py b/indra/preassembler/__init__.py index <HASH>..<HASH> 100644 --- a/indra/preassembler/__init__.py +++ b/indra/preassembler/__init__.py @@ -310,10 +310,11 @@ def check_sequence(stmt): return failures def check_agent_mod(agent, mods=None, mod_sites=None): + failures = [] # If no UniProt ID is found, we don't report a failure up_id = agent.db_refs.get('UP') if up_id is None: - return True + return failures # If the UniProt ID is a list then choose the first one. if not isinstance(up_id, basestring): @@ -327,7 +328,6 @@ def check_agent_mod(agent, mods=None, mod_sites=None): check_mods = agent.mods check_mod_sites = agent.mod_sites - failures = [] for m, mp in zip(check_mods, check_mod_sites): if mp is None: continue
Fix bug in sequence checking when no UniProt ID is given
sorgerlab_indra
train
py
ddacd64cb41fff3203797b13fc3fd5a5363ffdc6
diff --git a/lib/helpers/form_column_helpers.rb b/lib/helpers/form_column_helpers.rb index <HASH>..<HASH> 100644 --- a/lib/helpers/form_column_helpers.rb +++ b/lib/helpers/form_column_helpers.rb @@ -65,8 +65,8 @@ module ActiveScaffold value = associated.to_label end - input_name = "#{options[:name]}[id]" # "record[#{column.name}][id]" - input_id = input_name.gsub("[", "_").gsub("]", "") # "record_#{column.name}_id" + input_name = "#{options[:name]}" + input_id = input_name.gsub("[", "_").gsub("]", "") id_tag = hidden_field_tag(input_name, value_id, {:id => input_id}) companion_name = "record[#{column.name}_companion]" @@ -183,7 +183,7 @@ module ActiveScaffold if column.singular_association? record_select_field( - "#{options[:name]}[id]", + "#{options[:name]}", @record.send(column.name) || column.association.klass.new, {:controller => remote_controller, :params => params}.merge(column.options) )
Make active_scaffold_input_singular_association_with_auto_complete and active_scaffold_input_record_select both compliant with the new singular association naming convention - no [id] This keeps update_record_from_params, from trying to update the associations. git-svn-id: <URL>
activescaffold_active_scaffold
train
rb
aee16fbb286670e37e3469e50695b6125a69f765
diff --git a/src/watcher.js b/src/watcher.js index <HASH>..<HASH> 100644 --- a/src/watcher.js +++ b/src/watcher.js @@ -3,6 +3,7 @@ var chokidar = require('chokidar'); var eslint = require('eslint'); var chalk = require('chalk'); var _ = require('lodash'); +var path = require('path'); var success = require('./formatters/helpers/success'); var formatter = require('./formatters/simple-detail'); @@ -33,9 +34,9 @@ function lintFile(path, config) { logger.log(formatter(results)); } -function isWatchableExtension(path){ +function isWatchableExtension(filePath){ return _.some(cli.options.extensions, function (ext){ - return path.indexOf(ext) > -1; + return path.extname(filePath) === ext; }); }
Comparing the extension of the file using path.extname
rizowski_eslint-watch
train
js
13c80abe878a8ed0ad33d9116639d5f8734022de
diff --git a/app/models/esr_record.rb b/app/models/esr_record.rb index <HASH>..<HASH> 100644 --- a/app/models/esr_record.rb +++ b/app/models/esr_record.rb @@ -95,6 +95,8 @@ class EsrRecord < ActiveRecord::Base end def assign_invoice + # Prepare remarks to not be null + self.remarks ||= '' if Invoice.exists?(invoice_id) self.invoice_id = invoice_id self.remarks += "Referenz #{reference}"
Prepare esr record remarks to not be null.
raskhadafi_vesr
train
rb
437956618d51cbda1d6a7ccd40f649981073dfd7
diff --git a/vm.go b/vm.go index <HASH>..<HASH> 100644 --- a/vm.go +++ b/vm.go @@ -102,18 +102,14 @@ func (l *State) equalObjects(t1, t2 value) bool { case *userData: if t1 == t2 { return true - } else if t2, ok := t2.(*userData); ok && t2 != nil { + } else if t2, ok := t2.(*userData); ok { tm = l.equalTagMethod(t1.metaTable, t2.metaTable, tmEq) - } else if !ok || t2 == nil { - return false } case *table: if t1 == t2 { return true - } else if t2, ok := t2.(*table); ok && t2 != nil { + } else if t2, ok := t2.(*table); ok { tm = l.equalTagMethod(t1.metaTable, t2.metaTable, tmEq) - } else if !ok || t2 == nil { - return false } default: return t1 == t2
Simplify type check on (*State).equalObjects Removes excess `return false`. This also removes the ok check since we only really care if t2 is a table or userdata. If t2 is also a nil pointer to a table/UD, then the Lua state is somehow far worse off than anticipated anyway and a panic may be more valuable when accessing t2.metaTable.
Shopify_go-lua
train
go
aab869e5fcfe82528a62c31538713b32180837c1
diff --git a/test/history_test.js b/test/history_test.js index <HASH>..<HASH> 100644 --- a/test/history_test.js +++ b/test/history_test.js @@ -553,8 +553,8 @@ describe('History', function() { return browser.visit('/history/referer'); }); - it('should be empty', function() { - browser.assert.text('title', ''); + it('should be missing', function() { + browser.assert.text('title', 'undefined'); }); });
FIXED don't send Referer header if no referrer
assaf_zombie
train
js
a06ad4940c37ad735dcd8f02a023126af911a225
diff --git a/src/ol/control.js b/src/ol/control.js index <HASH>..<HASH> 100644 --- a/src/ol/control.js +++ b/src/ol/control.js @@ -5,6 +5,7 @@ export {default as Attribution} from './control/Attribution.js'; export {default as Control} from './control/Control.js'; export {default as FullScreen} from './control/FullScreen.js'; +export {default as MousePosition} from './control/MousePosition.js'; export {default as OverviewMap} from './control/OverviewMap.js'; export {default as Rotate} from './control/Rotate.js'; export {default as ScaleLine} from './control/ScaleLine.js';
Re-export MousePosition from ol/control
openlayers_openlayers
train
js
d3a5cd3233d4f2c942fe3382fd5ac37cea887769
diff --git a/glim/facades.py b/glim/facades.py index <HASH>..<HASH> 100644 --- a/glim/facades.py +++ b/glim/facades.py @@ -13,4 +13,7 @@ class Router(Facade): pass class Database(Facade): + pass + +class Orm(Facade): pass \ No newline at end of file
add Orm class to facadeas
aacanakin_glim
train
py
4eb49b9119e051c4fa01f3deca5fd51779f5573b
diff --git a/fbchat/models.py b/fbchat/models.py index <HASH>..<HASH> 100644 --- a/fbchat/models.py +++ b/fbchat/models.py @@ -131,6 +131,17 @@ class Group(Thread): self.approval_requests = approval_requests self.join_link = join_link + +class Room(Group): + # True is room is not discoverable + privacy_mode = None + + def __init__(self, uid, privacy_mode=None, **kwargs): + """Deprecated. Use :class:`Group` instead""" + super(Room, self).__init__(ThreadType.Room, uid, **kwargs) + self.privacy_mode = privacy_mode + + class Page(Thread): #: The page's custom url url = None @@ -518,6 +529,7 @@ class ThreadType(Enum): """Used to specify what type of Facebook thread is being used. See :ref:`intro_threads` for more info""" USER = 1 GROUP = 2 + ROOM = 2 PAGE = 3 class ThreadLocation(Enum):
Backwards compability for `Room`s
carpedm20_fbchat
train
py
8877e159caa68e8fbbb1d47404fdc56381b34fb2
diff --git a/model/PathEventProxy.js b/model/PathEventProxy.js index <HASH>..<HASH> 100644 --- a/model/PathEventProxy.js +++ b/model/PathEventProxy.js @@ -94,7 +94,7 @@ NotifyByPathProxy.Prototype = function() { if (this._list[i].listener === listener) { var entry = this._list[i]; this._list.splice(i, 1); - var key = entry.concat(['listeners']); + var key = entry.path.concat(['listeners']); var listeners = this.listeners.get(key); deleteFromArray(listeners, entry); }
Fix regression in PathEventProxy.disconnect.
substance_substance
train
js
a42d3ef74cfc79182ae3c182ceddb80199751b2f
diff --git a/librosa/core/spectrum.py b/librosa/core/spectrum.py index <HASH>..<HASH> 100644 --- a/librosa/core/spectrum.py +++ b/librosa/core/spectrum.py @@ -999,7 +999,7 @@ def reassigned_spectrogram( ... 1e-6 * np.random.randn(2*sr) >>> freqs, times, mags = librosa.reassigned_spectrogram(y=y, sr=sr, ... n_fft=n_fft) - >>> mags_db = librosa.power_to_db(mags, ref=np.max) + >>> mags_db = librosa.amplitude_to_db(mags, ref=np.max) >>> fig, ax = plt.subplots(nrows=2, sharex=True, sharey=True) >>> img = librosa.display.specshow(mags_db, x_axis="s", y_axis="linear", sr=sr,
tiny fix (#<I>)
librosa_librosa
train
py
f66cc9858258f4801d83d0f46a4837294453b1d2
diff --git a/css-transform.js b/css-transform.js index <HASH>..<HASH> 100644 --- a/css-transform.js +++ b/css-transform.js @@ -195,7 +195,7 @@ var cssTransform = function(options, filename, callback) { return; } - var rules = css.parse(data).stylesheet.rules; + var rules = css.parse(data, { source: filename }).stylesheet.rules; _.each(rules, function(rule) { if (rule.type === 'import') { @@ -259,6 +259,7 @@ var cssTransform = function(options, filename, callback) { rules: [ rule ] } }); + cssStream.write(cssText + '\n'); } });
Specify the path to the file containing css
cheton_browserify-css
train
js
28eb9cfeadf1b6b2427e9a035b52d315adc6c3da
diff --git a/directions/base.py b/directions/base.py index <HASH>..<HASH> 100644 --- a/directions/base.py +++ b/directions/base.py @@ -122,7 +122,7 @@ class Route: self.coords = coords self.distance = distance self.duration = duration - self.props = kwargs.copy() + self.properties = kwargs.copy() if maneuvers is None: maneuvers = [] @@ -132,13 +132,13 @@ class Route: def __geo_interface__(self): geom = {'type': 'LineString', 'coordinates': self.coords} - props = self.props.copy() - props.update({'distance': self.distance, - 'duration': self.duration}) + properties = self.properties.copy() + properties.update({'distance': self.distance, + 'duration': self.duration}) f = {'type': 'Feature', 'geometry': geom, - 'properties': props} + 'properties': properties} return f @@ -161,7 +161,7 @@ class Maneuver: """ self.coords = coords - self.props = kwargs.copy() + self.properties = kwargs.copy() @property def __geo_interface__(self): @@ -170,6 +170,6 @@ class Maneuver: f = {'type': 'Feature', 'geometry': geom, - 'properties': self.props} + 'properties': self.properties} return f
Add properties to Route and Maneuver classes
jwass_directions.py
train
py
7be83c17481f511cb3697ca1aa57804eb4fcae29
diff --git a/src/extensions/jquery.cytoscapeweb.renderer.svg.js b/src/extensions/jquery.cytoscapeweb.renderer.svg.js index <HASH>..<HASH> 100644 --- a/src/extensions/jquery.cytoscapeweb.renderer.svg.js +++ b/src/extensions/jquery.cytoscapeweb.renderer.svg.js @@ -1304,6 +1304,14 @@ originY = mousedownEvent.pageY; } + var elements; + + if( element.selected() ){ + elements = self.selectedElements.add(element).filter(":grabbable"); + } else { + elements = element.collection(); + } + var justStartedDragging = true; var dragHandler = function(dragEvent){ @@ -1329,14 +1337,6 @@ originX = dragX; originY = dragY; - var elements; - - if( element.selected() ){ - elements = self.selectedElements.add(element); - } else { - elements = element.collection(); - } - elements.each(function(i, e){ e.element()._private.position.x += dx; e.element()._private.position.y += dy;
Ungrabbable nodes aren't moved when a grabbable node is grabbed and moved
cytoscape_cytoscape.js
train
js
f221c7f77a870b20b863a305c4411c2b572d002b
diff --git a/scapy/layers/inet6.py b/scapy/layers/inet6.py index <HASH>..<HASH> 100644 --- a/scapy/layers/inet6.py +++ b/scapy/layers/inet6.py @@ -2706,7 +2706,7 @@ class MIP6MH_HoTI(_MobilityHeader): ByteEnumField("mhtype", 1, mhtypes), ByteField("res", None), XShortField("cksum", None), - StrFixedLenField("reserved", "\x00"*16, 16), + StrFixedLenField("reserved", "\x00"*2, 2), StrFixedLenField("cookie", "\x00"*8, 8), _PhantomAutoPadField("autopad", 1), # autopad activated by default _MobilityOptionsField("options", [], MIP6OptUnknown, 16,
Reserved is <I> bits (not bytes) --HG-- branch : Issue #<I>
secdev_scapy
train
py
b8220447d6f812adccbb8df27fa2bbc082acef0d
diff --git a/raus.go b/raus.go index <HASH>..<HASH> 100644 --- a/raus.go +++ b/raus.go @@ -298,16 +298,15 @@ func (r *Raus) holdLock(c *redis.Client) error { return errors.Wrap(err, "PUBLISH failed") } - res, err := c.GetSet(r.lockKey(), r.uuid).Result() + pipe := c.TxPipeline() + getset := pipe.GetSet(r.lockKey(), r.uuid) + pipe.Expire(r.lockKey(), LockExpires) + _, err := pipe.Exec() if err != nil { - return errors.Wrap(err, "GETSET failed") + return errors.Wrap(err, "GETSET or EXPIRE failed") } - if res != r.uuid { - return fatalError{fmt.Errorf("unexpected uuid got: %s", res)} - } - - if err := c.Expire(r.lockKey(), LockExpires).Err(); err != nil { - return errors.Wrap(err, "EXPIRE failed") + if v := getset.Val(); v != r.uuid { + return fatalError{fmt.Errorf("unexpected uuid got: %s", v)} } return nil }
use multi/exec to holdLock() Ensure lock key's TTL is set.
fujiwara_raus
train
go
12fd4c3054ffd3092dea62c2d093f765ceffb3a6
diff --git a/lineage/individual.py b/lineage/individual.py index <HASH>..<HASH> 100644 --- a/lineage/individual.py +++ b/lineage/individual.py @@ -295,9 +295,18 @@ class Individual(object): """ try: - return pd.read_csv(file, skiprows=1, na_values='--', - names=['rsid', 'chrom', 'pos', 'genotype'], - index_col=0, dtype={'chrom': object}) + df = pd.read_csv(file, skiprows=1, na_values='--', + names=['rsid', 'chrom', 'pos', 'genotype'], + index_col=0, dtype={'chrom': object}) + + # remove incongruous data + df = df.drop(df.loc[df['chrom'] == '0'].index) + df = df.drop(df.loc[df.index == 'RSID'].index) # second header for concatenated data + + # if second header existed, pos dtype will be object (should be np.int64) + df['pos'] = df['pos'].astype(np.int64) + + return df except Exception as err: print(err) return None
Improve reading and parsing of FTDNA files
apriha_lineage
train
py
87bf27fc77015fa0d74add2a056941c94a8f05b6
diff --git a/tests/CrEOF/Spatial/Tests/DBAL/Types/GeometryTypeTest.php b/tests/CrEOF/Spatial/Tests/DBAL/Types/GeometryTypeTest.php index <HASH>..<HASH> 100644 --- a/tests/CrEOF/Spatial/Tests/DBAL/Types/GeometryTypeTest.php +++ b/tests/CrEOF/Spatial/Tests/DBAL/Types/GeometryTypeTest.php @@ -102,6 +102,28 @@ class GeometryTypeTest extends OrmTest } /** + * @group srid + */ + public function testPointGeometryWithZeroSrid() + { + $entity = new GeometryEntity(); + $point = new Point(1, 1); + + $point->setSrid(0); + $entity->setGeometry($point); + $this->_em->persist($entity); + $this->_em->flush(); + + $id = $entity->getId(); + + $this->_em->clear(); + + $queryEntity = $this->_em->getRepository(self::GEOMETRY_ENTITY)->find($id); + + $this->assertEquals($entity, $queryEntity); + } + + /** * @group common */ public function testLineStringGeometry()
Added additional test for geometry with srid of 0.
creof_doctrine2-spatial
train
php
9ce8cd109573861fa215304c6adcf58f2a8b2da7
diff --git a/src/naarad/utils.py b/src/naarad/utils.py index <HASH>..<HASH> 100644 --- a/src/naarad/utils.py +++ b/src/naarad/utils.py @@ -501,7 +501,7 @@ def get_standardized_timestamp(timestamp, ts_format): elif ts_format == 'epoch': ts = datetime.datetime.utcfromtimestamp(int(timestamp)).strftime('%Y-%m-%d %H:%M:%S.%f') elif ts_format == 'epoch_ms': - ts = datetime.datetime.utcfromtimestamp(int(timestamp) / 1000).strftime('%Y-%m-%d %H:%M:%S.%f') + ts = datetime.datetime.utcfromtimestamp(float(timestamp) / 1000).strftime('%Y-%m-%d %H:%M:%S.%f') elif ts_format in ('%H:%M:%S', '%H:%M:%S.%f'): date_today = str(datetime.date.today()) ts = datetime.datetime.strptime(date_today + ' ' + timestamp,'%Y-%m-%d ' + ts_format).strftime('%Y-%m-%d %H:%M:%S.%f')
Fix epoch ms to standardized timestamp conversion to avoid loss of ms resolution
linkedin_naarad
train
py
720c25b7b22e8a10c68807ebf151d00563e4c1e8
diff --git a/src/chart/map/MapSeries.js b/src/chart/map/MapSeries.js index <HASH>..<HASH> 100644 --- a/src/chart/map/MapSeries.js +++ b/src/chart/map/MapSeries.js @@ -81,8 +81,7 @@ define(function (require) { var map = echarts.getMap(option.map); var geoJson = map && map.geoJson; - geoJson && option.data - && (option.data = fillData(option.data, geoJson)); + geoJson && (option.data = fillData((option.data || []), geoJson)); return option; },
Optimize in case when map has no data
apache_incubator-echarts
train
js
0be8972bcc2b6f168b83a7811c16a7a7011ee469
diff --git a/src/feat/agencies/net/agency.py b/src/feat/agencies/net/agency.py index <HASH>..<HASH> 100644 --- a/src/feat/agencies/net/agency.py +++ b/src/feat/agencies/net/agency.py @@ -550,6 +550,11 @@ class Agency(agency.Agency): iterator = (x.show_connection_status() for x in connections) return t.render(iterator) + @manhole.expose() + def show_locked_db_documents(self): + return ("_document_locks: %r\n_pending_notifications: %r" % + (self._database.show_document_locks())) + ### Manhole inspection methods ### @manhole.expose() diff --git a/src/feat/agencies/net/database.py b/src/feat/agencies/net/database.py index <HASH>..<HASH> 100644 --- a/src/feat/agencies/net/database.py +++ b/src/feat/agencies/net/database.py @@ -142,6 +142,9 @@ class Database(common.ConnectionManager, log.LogProxy, ChangeListener): time.left(self.reconnector.getTime()) return "CouchDB", self.is_connected(), self.host, self.port, eta + def show_document_locks(self): + return dict(self._document_locks), dict(self._pending_notifications) + ### IDbConnectionFactory def get_connection(self):
Expose in manhole method to take a sneakpeak at the database locks.
f3at_feat
train
py,py
d052a2241191e5cf27f69226d07f37d13db4325d
diff --git a/rhodes/rhodes-framework/spec/spec_helper.rb b/rhodes/rhodes-framework/spec/spec_helper.rb index <HASH>..<HASH> 100644 --- a/rhodes/rhodes-framework/spec/spec_helper.rb +++ b/rhodes/rhodes-framework/spec/spec_helper.rb @@ -10,6 +10,7 @@ $:.unshift(File.join(File.dirname(__FILE__), '..')) # Use the rubygem for local testing require 'spec/stubs' +require 'sqlite3/database' require 'rho/rho' require 'rhom/rhom'
fixed loading of sqlite, specs still don't run though
rhomobile_rhodes
train
rb
3a237bd3cf1984a50a8b61843b185dc1ce145b3a
diff --git a/zuul-core/src/main/java/com/netflix/zuul/netty/ssl/BaseSslContextFactory.java b/zuul-core/src/main/java/com/netflix/zuul/netty/ssl/BaseSslContextFactory.java index <HASH>..<HASH> 100644 --- a/zuul-core/src/main/java/com/netflix/zuul/netty/ssl/BaseSslContextFactory.java +++ b/zuul-core/src/main/java/com/netflix/zuul/netty/ssl/BaseSslContextFactory.java @@ -75,7 +75,10 @@ public class BaseSslContextFactory implements SslContextFactory { ArrayList<X509Certificate> trustedCerts = getTrustedX509Certificates(); SslProvider sslProvider = chooseSslProvider(); - LOG.warn("Using SslProvider of type - " + sslProvider.name() + " for certChainFile - " + serverSslConfig.getCertChainFile()); + LOG.debug( + "Using SslProvider of type {} for certChainFile {}", + sslProvider.name(), + serverSslConfig.getCertChainFile()); InputStream certChainInput = new FileInputStream(serverSslConfig.getCertChainFile()); InputStream keyInput = getKeyInputStream();
zuul-core: avoid warnspam on SSL connections
Netflix_zuul
train
java
569de9b3445dd9e3b092cee594f9daf6116df50b
diff --git a/girder/utility/gridfs_assetstore_adapter.py b/girder/utility/gridfs_assetstore_adapter.py index <HASH>..<HASH> 100644 --- a/girder/utility/gridfs_assetstore_adapter.py +++ b/girder/utility/gridfs_assetstore_adapter.py @@ -247,7 +247,12 @@ class GridFsAssetstoreAdapter(AbstractAssetstoreAdapter): } matching = ModelImporter().model('file').find(q, limit=2, fields=[]) if matching.count(True) == 1: - self.chunkColl.remove({'uuid': file['chunkUuid']}) + try: + self.chunkColl.remove({'uuid': file['chunkUuid']}) + except pymongo.errors.AutoReconnect: + # we can't reach the database. Go ahead and return; a system + # check will be necessary to remove the abandoned file + pass def cancelUpload(self, upload): """
If the mongo database for a gridfs assetstore goes offline, let files appear to be deleted. A system check will eventually need to clean up these abandoned files, but this will allow the assetstore to be removed from the system when it is no longer reachable. This doesn't fix the problem when the assetstore hasn't been reachable since this instance of girder was started (but it had been reachable once and has had files put in it).
girder_girder
train
py
5a1d002bb80f78f0a8e93be36347f0aa017ff26e
diff --git a/buildozer/__init__.py b/buildozer/__init__.py index <HASH>..<HASH> 100644 --- a/buildozer/__init__.py +++ b/buildozer/__init__.py @@ -461,6 +461,14 @@ class Buildozer(object): requirements = [x for x in requirements if onlyname(x) not in target_available_packages] + if requirements and hasattr(sys, 'real_prefix'): + e = self.error + e('virtualenv is needed to install pure-Python modules, but') + e('virtualenv does not support nesting, and you are running') + e('buildozer in one. Please run buildozer outside of a') + e('virtualenv instead.') + exit(1) + # did we already installed the libs ? if exists(self.applibs_dir) and \ self.state.get('cache.applibs', '') == requirements:
throw error early if running in venv
kivy_buildozer
train
py
aa8279ad1c39dd5d20d4822f89bf782c13da187d
diff --git a/core/src/main/java/com/capitalone/dashboard/repository/ComponentRepository.java b/core/src/main/java/com/capitalone/dashboard/repository/ComponentRepository.java index <HASH>..<HASH> 100644 --- a/core/src/main/java/com/capitalone/dashboard/repository/ComponentRepository.java +++ b/core/src/main/java/com/capitalone/dashboard/repository/ComponentRepository.java @@ -19,6 +19,6 @@ public interface ComponentRepository extends CrudRepository<Component, ObjectId> @Query(value="{'collectorItems.Build._id': ?0}") List<Component> findByBuildCollectorItemId(ObjectId buildCollectorItemId); - @Query(value="{'collectorItems.Deploy._id': ?0}") + @Query(value="{'collectorItems.Deployment._id': ?0}") List<Component> findByDeployCollectorItemId(ObjectId deployCollectorItemId); }
Fixed query for finding component by deployment collector item id. The deploy key is Deployment not Deploy.
Hygieia_Hygieia
train
java
a986efef0a47abdd5b7a4b3136bb547fffdb0aae
diff --git a/.github/build-packages.php b/.github/build-packages.php index <HASH>..<HASH> 100644 --- a/.github/build-packages.php +++ b/.github/build-packages.php @@ -49,8 +49,8 @@ foreach ($dirs as $k => $dir) { $packages[$package->name][$package->version] = $package; - $versions = file_get_contents('https://packagist.org/packages/'.$package->name.'.json'); - $versions = json_decode($versions)->package->versions; + $versions = file_get_contents('https://packagist.org/p/'.$package->name.'.json'); + $versions = json_decode($versions)->packages->{$package->name}; if ($package->version === str_replace('-dev', '.x-dev', $versions->{'dev-master'}->extra->{'branch-alias'}->{'dev-master'})) { unset($versions->{'dev-master'});
fix the Composer API being used
symfony_symfony
train
php
853898e679298f4eefe817ed71db23716e5a41f6
diff --git a/sharding-jdbc/src/test/java/io/shardingsphere/dbtest/env/EnvironmentPath.java b/sharding-jdbc/src/test/java/io/shardingsphere/dbtest/env/EnvironmentPath.java index <HASH>..<HASH> 100644 --- a/sharding-jdbc/src/test/java/io/shardingsphere/dbtest/env/EnvironmentPath.java +++ b/sharding-jdbc/src/test/java/io/shardingsphere/dbtest/env/EnvironmentPath.java @@ -39,7 +39,7 @@ public final class EnvironmentPath { private static final String SHARDING_RULE_RESOURCES_PATH = "asserts/env/%s/sharding-rule.yaml"; - private static final String AUTHORITY_RESOURCES_PATH = "asserts/env/%s/authority.yaml"; + private static final String AUTHORITY_RESOURCES_PATH = "asserts/env/%s/authority.xml"; /** * Get database environment resource File.
moidfy AUTHORITY_RESOURCES_PATH.
apache_incubator-shardingsphere
train
java
a98c129d056e234dc04615bbb860a534b81940e3
diff --git a/pkg/tsdb/cloudwatch/credentials.go b/pkg/tsdb/cloudwatch/credentials.go index <HASH>..<HASH> 100644 --- a/pkg/tsdb/cloudwatch/credentials.go +++ b/pkg/tsdb/cloudwatch/credentials.go @@ -60,8 +60,8 @@ func GetCredentials(dsInfo *DatasourceInfo) (*credentials.Credentials, error) { []credentials.Provider{ &credentials.EnvProvider{}, &credentials.SharedCredentialsProvider{Filename: "", Profile: dsInfo.Profile}, - remoteCredProvider(stsSess), webIdentityProvider(stsSess), + remoteCredProvider(stsSess), }) stsConfig := &aws.Config{ Region: aws.String(dsInfo.Region),
CloudWatch: Prefer webIdentity over EC2 role also when assuming a role (#<I>) Same as #<I> but for assumed roles. When using service accounts (webIdentity) on EKS in combination with assuming roles in other AWS accounts Grafana needs to retrieve the service account credentials first and then needs to assume the configured role.
grafana_grafana
train
go
1f23e8058b70989c27d74d2628fff10edfd11103
diff --git a/django_distill/renderer.py b/django_distill/renderer.py index <HASH>..<HASH> 100644 --- a/django_distill/renderer.py +++ b/django_distill/renderer.py @@ -146,6 +146,9 @@ def render_to_dir(output_dir, urls_to_distill, stdout): stdout('Rendering page: {} -> {} ["{}", {} bytes] {}'.format(local_uri, full_path, mime, len(content), renamed)) try: + dirname = os.path.dirname(full_path) + if not os.path.isdir(dirname): + os.makedirs(dirname) with open(full_path, 'w') as f: f.write(content) except IsADirectoryError:
support distill_file path that includes dir.
mgrp_django-distill
train
py
e56252e0e4b6c8a23d2f508c5bf4aba67533368c
diff --git a/bcbio/pipeline/run_info.py b/bcbio/pipeline/run_info.py index <HASH>..<HASH> 100644 --- a/bcbio/pipeline/run_info.py +++ b/bcbio/pipeline/run_info.py @@ -302,7 +302,7 @@ ALGORITHM_KEYS = set(["platform", "aligner", "bam_clean", "bam_sort", "coverage_depth_max", "min_allele_fraction", "remove_lcr", "joint_group_size", "archive", "tools_off", "tools_on", "assemble_transcripts", - "mixup_check", "priority_regions"] + + "mixup_check", "priority_regions", "expression_caller"] + # back compatibility ["coverage_depth"]) ALG_ALLOW_BOOLEANS = set(["merge_bamprep", "mark_duplicates", "remove_lcr",
Add expression_caller to list of allowed algorithm keys.
bcbio_bcbio-nextgen
train
py
a8eff25ff38421fb2825ebcb4dd2e85069060028
diff --git a/test/utils/image/manifest.go b/test/utils/image/manifest.go index <HASH>..<HASH> 100644 --- a/test/utils/image/manifest.go +++ b/test/utils/image/manifest.go @@ -219,7 +219,7 @@ func initImageConfigs() (map[int]Config, map[int]Config) { configs[AuthenticatedWindowsNanoServer] = Config{gcAuthenticatedRegistry, "windows-nanoserver", "v1"} configs[APIServer] = Config{promoterE2eRegistry, "sample-apiserver", "1.17.4"} configs[AppArmorLoader] = Config{promoterE2eRegistry, "apparmor-loader", "1.3"} - configs[BusyBox] = Config{promoterE2eRegistry, "busybox", "1.29"} + configs[BusyBox] = Config{promoterE2eRegistry, "busybox", "1.29-1"} configs[CheckMetadataConcealment] = Config{promoterE2eRegistry, "metadata-concealment", "1.6"} configs[CudaVectorAdd] = Config{e2eRegistry, "cuda-vector-add", "1.0"} configs[CudaVectorAdd2] = Config{promoterE2eRegistry, "cuda-vector-add", "2.2"}
update busybox that includes windows nltest
kubernetes_kubernetes
train
go
3d88b5637f879e2fb0b6316661534d7aa94db3fb
diff --git a/dist/protractor-helpers.js b/dist/protractor-helpers.js index <HASH>..<HASH> 100644 --- a/dist/protractor-helpers.js +++ b/dist/protractor-helpers.js @@ -155,7 +155,7 @@ Helpers.prototype.selectOption = function (optionElement) { Helpers.prototype.scrollToElement = function (element) { return element.getLocation().then(function (location) { - return browser.executeScript('window.scrollTo(0, ' + location.y + ');'); + return browser.executeScript('window.scrollTo(' + location.x + ', ' + location.y + ');'); }); }; diff --git a/src/helpers.js b/src/helpers.js index <HASH>..<HASH> 100644 --- a/src/helpers.js +++ b/src/helpers.js @@ -117,7 +117,7 @@ Helpers.prototype.selectOption = function (optionElement) { Helpers.prototype.scrollToElement = function (element) { return element.getLocation().then(function (location) { - return browser.executeScript('window.scrollTo(0, ' + location.y + ');'); + return browser.executeScript('window.scrollTo(' + location.x + ', ' + location.y + ');'); }); };
feat(Helpers): add ability to scroll to an element and click it with x axis too
wix_protractor-helpers
train
js,js
ee1f7e4553f90701dfa571f4f726a4e745d2be0e
diff --git a/lib/substation/chain.rb b/lib/substation/chain.rb index <HASH>..<HASH> 100644 --- a/lib/substation/chain.rb +++ b/lib/substation/chain.rb @@ -141,6 +141,10 @@ module Substation return response unless processor.success?(response) processor.result(response) rescue => exception + if ENV['DEBUG_SUBSTATION'] + puts exception.message + pp exception.backtrace + end return on_exception(request, result.data, exception) end }
Support ENV['DEBUG_SUBSTATION'] for now
snusnu_substation
train
rb
ebad368d4844143cb8610514c546c75e92b33bc6
diff --git a/Kwc/Root/DomainRoot/Component.php b/Kwc/Root/DomainRoot/Component.php index <HASH>..<HASH> 100644 --- a/Kwc/Root/DomainRoot/Component.php +++ b/Kwc/Root/DomainRoot/Component.php @@ -17,6 +17,9 @@ class Kwc_Root_DomainRoot_Component extends Kwc_Root_Abstract public function formatPath($parsedUrl) { $host = $parsedUrl['host']; + if (isset($parsedUrl['port']) && $parsedUrl['port'] != 80) { + $host .= ':' . $parsedUrl['port']; + } $setting = $this->_getSetting('generators'); $modelName = $setting['domain']['model']; $domain = Kwf_Model_Abstract::getInstance($modelName)->getRowByHost($host);
if port is not <I> add it to host for domainRoot
koala-framework_koala-framework
train
php
68262bbc21265b247f5e2678345e93aaf9c71ed5
diff --git a/code/MultiFormObjectDecorator.php b/code/MultiFormObjectDecorator.php index <HASH>..<HASH> 100644 --- a/code/MultiFormObjectDecorator.php +++ b/code/MultiFormObjectDecorator.php @@ -14,7 +14,7 @@ * * @package multiform */ -class MultiFormObjectDecorator extends DataObjectDecorator { +class MultiFormObjectDecorator extends DataExtension { public function updateDBFields() { return array( @@ -55,5 +55,3 @@ class MultiFormObjectDecorator extends DataObjectDecorator { } } - -?> \ No newline at end of file
Fixing class to extend DataExtension for SS3 compatibility
silverstripe_silverstripe-multiform
train
php
f20ef77c585aaa07a668109f806fb80fb5ea5857
diff --git a/src/TryCatchMiddleware.php b/src/TryCatchMiddleware.php index <HASH>..<HASH> 100644 --- a/src/TryCatchMiddleware.php +++ b/src/TryCatchMiddleware.php @@ -20,7 +20,7 @@ class TryCatchMiddleware implements IMiddleware return $response; } catch (Throwable $throwable) { $response = $response->withStatus(500); - $response->getBody()->write(sprintf('Application encountered an internal error with status code "500" and with message "%s".', $throwable->getMessage())); + $response->getBody()->write('Application encountered an internal error. Please try again later.'); return $response; } }
Remove error message output. It could reveal sensitive informations.
contributte_middlewares
train
php
5eaa9bfd1487153505a0034a1830c68f6ab5c886
diff --git a/ruby/command-t/match_window.rb b/ruby/command-t/match_window.rb index <HASH>..<HASH> 100644 --- a/ruby/command-t/match_window.rb +++ b/ruby/command-t/match_window.rb @@ -407,12 +407,12 @@ module CommandT # Cursor xxx cleared -> :hi! clear Cursor highlight = VIM::capture 'silent! 0verbose highlight Cursor' - if highlight =~ /^Cursor\s+xxx\s+links to (\w+)/ - "link Cursor #{$~[1]}" - elsif highlight =~ /^Cursor\s+xxx\s+cleared/ + if highlight =~ /^Cursor\s+xxx\s+links to (\w+)/m + "link Cursor #{$~[1]}".gsub(/\s+/, ' ') + elsif highlight =~ /^Cursor\s+xxx\s+cleared/m 'clear Cursor' - elsif highlight =~ /Cursor\s+xxx\s+(.+)/ - "Cursor #{$~[1]}" + elsif highlight =~ /Cursor\s+xxx\s+(.+)/m + "Cursor #{$~[1]}".gsub(/\s+/, ' ') else # likely cause E411 Cursor highlight group not found nil end
Cursor saving now looks for newlines and removes them Original pull request: <URL>
wincent_command-t
train
rb
8a309823f096e23de1a7febbb82186871a337cd5
diff --git a/mod/assign/gradingtable.php b/mod/assign/gradingtable.php index <HASH>..<HASH> 100644 --- a/mod/assign/gradingtable.php +++ b/mod/assign/gradingtable.php @@ -485,6 +485,13 @@ class assign_grading_table extends table_sql implements renderable { if ($this->quickgrading && !$gradingdisabled) { $name = 'quickgrade_' . $row->id . '_workflowstate'; $o .= html_writer::select($workflowstates, $name, $workflowstate, array('' => get_string('markingworkflowstatenotmarked', 'assign'))); + // Check if this user is a marker that can't manage allocations and doesn't have the marker column added. + if ($this->assignment->get_instance()->markingallocation && + !has_capability('mod/assign:manageallocations', $this->assignment->get_context())) { + + $name = 'quickgrade_' . $row->id . '_allocatedmarker'; + $o .= html_writer::empty_tag('input', array('type'=>'hidden', 'name'=>$name, 'value'=>$row->allocatedmarker)); + } } else { $o .= $this->output->container(get_string('markingworkflowstate' . $workflowstate, 'assign'), $workflowstate); }
MDL-<I>: assign - prevent loss of associated marker certain markers don't see the marker allocation column.
moodle_moodle
train
php
2ec09d6ff4cfdb7f0d228c0c9e550d7327bc1a71
diff --git a/pyvodb/load.py b/pyvodb/load.py index <HASH>..<HASH> 100644 --- a/pyvodb/load.py +++ b/pyvodb/load.py @@ -9,6 +9,7 @@ import yaml from sqlalchemy import create_engine from sqlalchemy.orm import sessionmaker from sqlalchemy.sql.expression import select +from dateutil import rrule from . import tables @@ -133,9 +134,11 @@ def load_from_dict(db, data, metadata): series = series_dir['series'] recurrence = series.get('recurrence') - if 'recurrence' in series: + if recurrence: + rrule_str = recurrence['rrule'] + rrule.rrulestr(rrule_str) # check rrule syntax recurrence_attrs = { - 'recurrence_rule': recurrence['rrule'], + 'recurrence_rule': rrule_str, 'recurrence_scheme': recurrence['scheme'], 'recurrence_description_cs': recurrence['description']['cs'], 'recurrence_description_en': recurrence['description']['en'],
Check rrule syntax when loading the data The "tests" for pyvo-data involve loading the DB. Make loading fail when the data includes an invalid recurrence rule for meetups.
pyvec_pyvodb
train
py
02d282214a8904823230cbdc64a59f3fad2a2fd7
diff --git a/elasticsearch-extensions/lib/elasticsearch/extensions/test/cluster.rb b/elasticsearch-extensions/lib/elasticsearch/extensions/test/cluster.rb index <HASH>..<HASH> 100644 --- a/elasticsearch-extensions/lib/elasticsearch/extensions/test/cluster.rb +++ b/elasticsearch-extensions/lib/elasticsearch/extensions/test/cluster.rb @@ -30,6 +30,7 @@ module Elasticsearch # @see Cluster#stop Cluster.stop # module Cluster + @@number_of_nodes = 0 # Starts a cluster #
[EXT] Fixed, that the `@@number_of_nodes` variable is initialized on module load This was preventing a use case like: time SERVER=y ruby -I lib:test test/integration/yaml_test_runner.rb
elastic_elasticsearch-ruby
train
rb
feca647087e53d5ac176b79e5eece9635940ce44
diff --git a/audio/vorbis/vorbis.go b/audio/vorbis/vorbis.go index <HASH>..<HASH> 100644 --- a/audio/vorbis/vorbis.go +++ b/audio/vorbis/vorbis.go @@ -157,6 +157,7 @@ func (d *decoded) Close() error { if err := d.source.Close(); err != nil { return err } + d.decoder = nil return nil }
audio/vorbis: Unretain the Ogg decoder on Close (#<I>)
hajimehoshi_ebiten
train
go
de8c8205af7dc66d99df321de0b4a65769003670
diff --git a/lib/hcl/commands.rb b/lib/hcl/commands.rb index <HASH>..<HASH> 100644 --- a/lib/hcl/commands.rb +++ b/lib/hcl/commands.rb @@ -94,7 +94,7 @@ module HCl command ||= $PROGRAM_NAME.split('/').last $stderr.puts \ "The hcl completion command is deprecated (and slow!), instead use something like:", - "> complete -W `cat #{HCl::App::ALIAS_LIST}` #{command}" + "> complete -W "`cat #{HCl::App::ALIAS_LIST}`" #{command}" %[complete -W "#{aliases.join ' '}" #{command}] end
command#completion: fix example in deprecation warning
zenhob_hcl
train
rb
1f55cbea2b5f18e2604efbb3e48bae5fe7accda9
diff --git a/test.js b/test.js index <HASH>..<HASH> 100644 --- a/test.js +++ b/test.js @@ -53,7 +53,8 @@ QUnit.test('basics set', function () { prop: { set: function(newVal) { return "foo" + newVal; - } + }, + configurable: true } }); @@ -63,7 +64,11 @@ QUnit.test('basics set', function () { QUnit.equal(def.prop, "foobar", "setter works"); - define(Defined.prototype, { + var DefinedCB = function(prop){ + this.prop = prop; + }; + + define(DefinedCB.prototype, { prop: { set: function(newVal,setter) { setter("foo" + newVal); @@ -71,9 +76,9 @@ QUnit.test('basics set', function () { } }); - def = new Defined(); + defCallback = new DefinedCB(); def.prop = "bar"; - QUnit.equal(def.prop, "foobar", "setter callback works"); + QUnit.equal(defCallback.prop, "foobar", "setter callback works"); });
basic setter and not working test with setter callback
canjs_can-define
train
js
544c124a211b9a15e8c3aa15465c4d08447881bb
diff --git a/lib/raven/interfaces/http.rb b/lib/raven/interfaces/http.rb index <HASH>..<HASH> 100644 --- a/lib/raven/interfaces/http.rb +++ b/lib/raven/interfaces/http.rb @@ -24,9 +24,16 @@ module Raven self.url = req.scheme && req.url.split('?').first self.method = req.request_method self.query_string = req.query_string + server_protocol = env['SERVER_PROTOCOL'] env.each_pair do |key, value| key = key.to_s #rack env can contain symbols next unless key.upcase == key # Non-upper case stuff isn't either + # Rack adds in an incorrect HTTP_VERSION key, which causes downstream + # to think this is a Version header. Instead, this is mapped to + # env['SERVER_PROTOCOL']. But we don't want to ignore a valid header + # if the request has legitimately sent a Version header themselves. + # See: https://github.com/rack/rack/blob/028438f/lib/rack/handler/cgi.rb#L29 + next if key == 'HTTP_VERSION' and value == server_protocol if key.start_with?('HTTP_') # Header http_key = key[5..key.length - 1].split('_').map { |s| s.capitalize }.join('-')
Ignore HTTP_VERSION headers since Rack misbehaves
getsentry_raven-ruby
train
rb
96dc68433be88f2a47c699149e2dd857159facfd
diff --git a/src/Row.php b/src/Row.php index <HASH>..<HASH> 100644 --- a/src/Row.php +++ b/src/Row.php @@ -92,6 +92,12 @@ class Row extends Nette\Object return $this->item->{$this->formatDibiRowKey($key)}; } else if ($this->item instanceof ActiveRow) { + if (preg_match("/^:([a-zA-Z0-9_$]*)\.([a-zA-Z0-9_$]*)$/", $key, $matches)) { + $relatedTable = $matches[1]; + $relatedColumn = $matches[2]; + + return $this->item->related($relatedTable)->fetch()->{$relatedColumn}; + } return $this->item->{$key}; } else if ($this->item instanceof Nette\Database\Row) {
Basic support for related column names (#<I>) Added basic support for syntax $grid->addColumnType('name', 'Title', ':related_table.column')
contributte_datagrid
train
php
ccdffc4a0ea4a696533ab2e20afb8f65e1f84d36
diff --git a/test/lib/redis-store-zlib-spec.js b/test/lib/redis-store-zlib-spec.js index <HASH>..<HASH> 100644 --- a/test/lib/redis-store-zlib-spec.js +++ b/test/lib/redis-store-zlib-spec.js @@ -42,6 +42,12 @@ describe('Compression Tests', function () { testJson = JSON.stringify(testObject); }); + beforeEach(function(done) { + redisCompressCache.reset(function () { + done(); + }); + }); + describe('compress set', function () { it('should store a value without ttl', function (done) { redisCompressCache.set('foo', 'bar', function (err) {
Add beforeEach method to reset cache prior to each test.
dial-once_node-cache-manager-redis
train
js
b454c3d0c3a17f75daf8b4a258e88358e1be4970
diff --git a/client.go b/client.go index <HASH>..<HASH> 100644 --- a/client.go +++ b/client.go @@ -1891,7 +1891,7 @@ func (c *Client) RecursivePushFile(container string, source string, target strin appendLen-- } - targetPath := path.Join(target, p[appendLen:]) + targetPath := path.Join(target, filepath.ToSlash(p[appendLen:])) if fInfo.IsDir() { mode, uid, gid := shared.GetOwnerMode(fInfo) return c.Mkdir(container, targetPath, mode, uid, gid)
Fix recursive file push on Windows filepath.Walk() sends filenames with backslashes there
lxc_lxd
train
go
afea15885851c72b28a78cb319b181bd8d534a72
diff --git a/lib/index.js b/lib/index.js index <HASH>..<HASH> 100644 --- a/lib/index.js +++ b/lib/index.js @@ -37,9 +37,10 @@ function proxy(callback) { if (!socket.writable) { return socket.destroy(err); } - var stack = util.getErrorStack('clientError: Bad request'); - var code = err && err.code === 'HPE_HEADER_OVERFLOW' ? 431 : 400; - socket.end('HTTP/1.1 ' + code + ' Bad Request\r\n\r\n' + stack); + var errCode = err && err.code; + var statusCode = errCode === 'HPE_HEADER_OVERFLOW' ? 431 : 400; + var stack = util.getErrorStack('clientError: Bad request' + (errCode ? ' (' + errCode + ')' : '')); + socket.end('HTTP/1.1 ' + statusCode + ' Bad Request\r\n\r\n' + stack); }); initSocketMgr(proxyEvents); setupHttps(server, proxyEvents);
refactor: clientError
avwo_whistle
train
js
4c48aa51a3eec003b7a57e13e22aa56bda165dfa
diff --git a/src/Themosis/User/UserFactory.php b/src/Themosis/User/UserFactory.php index <HASH>..<HASH> 100644 --- a/src/Themosis/User/UserFactory.php +++ b/src/Themosis/User/UserFactory.php @@ -4,7 +4,6 @@ namespace Themosis\User; use Illuminate\View\View; use Themosis\Field\Wrapper; -use Themosis\Facades\Action; use Themosis\Field\FieldException; use Themosis\Hook\IHook; use Themosis\Validation\IValidate;
Remove unused instance from User factory.
themosis_framework
train
php
da11a78f544793cf60f983d88aa1c2ddef99d0e1
diff --git a/lib/puppet/file_serving/content.rb b/lib/puppet/file_serving/content.rb index <HASH>..<HASH> 100644 --- a/lib/puppet/file_serving/content.rb +++ b/lib/puppet/file_serving/content.rb @@ -41,6 +41,6 @@ class Puppet::FileServing::Content < Puppet::FileServing::Base end def to_raw - File.new(full_path, "r") + File.new(full_path, "rb") end end diff --git a/spec/unit/file_serving/content_spec.rb b/spec/unit/file_serving/content_spec.rb index <HASH>..<HASH> 100755 --- a/spec/unit/file_serving/content_spec.rb +++ b/spec/unit/file_serving/content_spec.rb @@ -73,7 +73,7 @@ describe Puppet::FileServing::Content do it "should return an opened File when converted to raw" do content = Puppet::FileServing::Content.new("/path") - File.expects(:new).with("/path","r").returns :file + File.expects(:new).with("/path","rb").returns :file content.to_raw.should == :file end
(#<I>) Serve file content in binary mode Previously, Puppet::FileServing::Content opened files in text mode. Changed to binary mode.
puppetlabs_puppet
train
rb,rb
7c97d19bced5de39113b384c69852c7f0169380a
diff --git a/lib/entasis/model.rb b/lib/entasis/model.rb index <HASH>..<HASH> 100644 --- a/lib/entasis/model.rb +++ b/lib/entasis/model.rb @@ -25,7 +25,7 @@ module Entasis # # Takes a hash and assigns keys and values to it's attributes members # - def initialize(hash) + def initialize(hash={}) self.attributes = hash end diff --git a/spec/entasis_spec.rb b/spec/entasis_spec.rb index <HASH>..<HASH> 100644 --- a/spec/entasis_spec.rb +++ b/spec/entasis_spec.rb @@ -15,6 +15,10 @@ describe "Entasis::Model" do Person.new(undefined: 'value') }.to raise_error Person::UnknownAttributeError, 'unkown attribute: undefined' end + + it "does not require attribute hash" do + expect { Person.new }.to_not raise_error + end end describe "#attribute_names" do
Do not require attribute hash at initialization
ingemar_entasis
train
rb,rb
0ba66954b0a7f1398cbb8ebc4c5a8a2ba58f7ef9
diff --git a/lib/active_record_shards/default_slave_patches.rb b/lib/active_record_shards/default_slave_patches.rb index <HASH>..<HASH> 100644 --- a/lib/active_record_shards/default_slave_patches.rb +++ b/lib/active_record_shards/default_slave_patches.rb @@ -60,6 +60,10 @@ module ActiveRecordShards CLASS_FORCE_SLAVE_METHODS = [ :columns, + :replace_bind_variable, + :replace_bind_variables, + :sanitize_sql_array, + :sanitize_sql_hash_for_assignment, :table_exists? ].freeze @@ -103,6 +107,8 @@ module ActiveRecordShards # `where` and `having` clauses call `create_binds`, which will use the master connection ActiveRecordShards::DefaultSlavePatches.wrap_method_in_on_slave(false, base, :create_binds, true) end + + ActiveRecordShards::DefaultSlavePatches.wrap_method_in_on_slave(false, base, :to_sql, true) end def on_slave_unless_tx(&block)
Wrap to_sql and Sanitzation with force_on_slave
zendesk_active_record_shards
train
rb
e97938feab568569ed73328e54d85c491bb6b0fe
diff --git a/resources/lang/hu-HU/notifications.php b/resources/lang/hu-HU/notifications.php index <HASH>..<HASH> 100644 --- a/resources/lang/hu-HU/notifications.php +++ b/resources/lang/hu-HU/notifications.php @@ -51,7 +51,7 @@ return [ 'action' => 'View', ], 'slack' => [ - 'title' => ':name Updated', + 'title' => 'Frissítve', 'content' => ':name was updated to :new_status', ], 'sms' => [ @@ -101,7 +101,7 @@ return [ 'subject' => 'Your invitation is inside...', 'content' => 'You have been invited to join :app_name status page.', 'title' => 'You\'re invited to join :app_name status page.', - 'action' => 'Accept', + 'action' => 'Elfogadás', ], ], ],
New translations notifications.php (Hungarian)
CachetHQ_Cachet
train
php
5cc0de1d392f82d1ef719c8f485cc2682af79158
diff --git a/expr/http_endpoint.go b/expr/http_endpoint.go index <HASH>..<HASH> 100644 --- a/expr/http_endpoint.go +++ b/expr/http_endpoint.go @@ -249,7 +249,7 @@ func (e *HTTPEndpointExpr) Prepare() { // Make sure there's a default response if none define explicitly if len(e.Responses) == 0 { status := StatusOK - if e.MethodExpr.Payload.Type == Empty { + if e.MethodExpr.Payload.Type == Empty && !e.SkipResponseBodyEncodeDecode { status = StatusNoContent } e.Responses = []*HTTPResponseExpr{{StatusCode: status}}
Fix issue with empty body and SkipEncodeDecodeResultBody (#<I>)
goadesign_goa
train
go
ac72d645120e2463ddbb8fb07888bfff2f17f1a1
diff --git a/lib/mongo/protocol/query.rb b/lib/mongo/protocol/query.rb index <HASH>..<HASH> 100644 --- a/lib/mongo/protocol/query.rb +++ b/lib/mongo/protocol/query.rb @@ -252,7 +252,7 @@ module Mongo # # @since 2.1.0 def command_name - command? && filter[:$query].nil? ? filter.keys.first : FIND + (filter[:$query] || !command?) ? FIND : filter.keys.first end private @@ -261,9 +261,13 @@ module Mongo collection == Database::COMMAND end + def query_filter + filter[:$query] || filter + end + def op_command document = BSON::Document.new - (filter[:$query] || filter).each do |field, value| + query_filter.each do |field, value| document.store(field.to_s, value) end document @@ -272,7 +276,7 @@ module Mongo def find_command document = BSON::Document.new document.store(FIND, collection) - document.store(FILTER, filter[:$query] || filter) + document.store(FILTER, query_filter) OPTION_MAPPINGS.each do |legacy, option| document.store(option, options[legacy]) unless options[legacy].nil? end
RUBY-<I> Helper method for query filter
mongodb_mongo-ruby-driver
train
rb
113ca2b204626f6eab1b18a43a0930198ca0551b
diff --git a/opencensus/trace/ext/requests/trace.py b/opencensus/trace/ext/requests/trace.py index <HASH>..<HASH> 100644 --- a/opencensus/trace/ext/requests/trace.py +++ b/opencensus/trace/ext/requests/trace.py @@ -28,7 +28,7 @@ SESSION_CLASS_NAME = 'Session' def trace_integration(): - """Wrap the mysql connector to trace it.""" + """Wrap the requests library to trace it.""" log.info('Integrated module: {}'.format(MODULE_NAME)) # Wrap the requests functions
Fix docstring for trace_integration (#<I>)
census-instrumentation_opencensus-python
train
py
0aee65ba550dd0a2c2a8a0915310924bee75bb49
diff --git a/server/server_test.go b/server/server_test.go index <HASH>..<HASH> 100644 --- a/server/server_test.go +++ b/server/server_test.go @@ -40,6 +40,7 @@ import ( "github.com/pingcap/tidb/config" "github.com/pingcap/tidb/errno" "github.com/pingcap/tidb/kv" + "github.com/pingcap/tidb/session" "github.com/pingcap/tidb/util/logutil" "github.com/pingcap/tidb/util/versioninfo" "github.com/tikv/client-go/v2/tikv" @@ -57,6 +58,10 @@ func TestT(t *testing.T) { if !reflect.DeepEqual(defaultConfig, globalConfig) { t.Fatalf("%#v != %#v\n", defaultConfig, globalConfig) } + + // AsyncCommit will make DDL wait 2.5s before changing to the next state. + // Set schema lease to avoid it from making CI slow. + session.SetSchemaLease(0) CustomVerboseFlag = true logLevel := os.Getenv("log_level") err := logutil.InitLogger(logutil.NewLogConfig(logLevel, logutil.DefaultLogFormat, "", logutil.EmptyFileLogConfig, false))
server: make CI faster (#<I>)
pingcap_tidb
train
go
feb6eda23fc52e4831ff7d45248bb6410a2faa68
diff --git a/salt/utils/cache.py b/salt/utils/cache.py index <HASH>..<HASH> 100644 --- a/salt/utils/cache.py +++ b/salt/utils/cache.py @@ -142,12 +142,10 @@ class CacheDisk(CacheDict): """ if not salt.utils.msgpack.HAS_MSGPACK or not os.path.exists(self._path): return - try: - with salt.utils.files.fopen(self._path, "rb") as fp_: - cache = salt.utils.msgpack.load(fp_, encoding=__salt_system_encoding__) - cache = salt.utils.data.decode(cache) - except UnicodeDecodeError: - pass + with salt.utils.files.fopen(self._path, "rb") as fp_: + cache = salt.utils.msgpack.load( + fp_, encoding=__salt_system_encoding__, raw=False + ) if "CacheDisk_cachetime" in cache: # new format self._dict = cache["CacheDisk_data"] self._key_cache_time = cache["CacheDisk_cachetime"] @@ -172,7 +170,7 @@ class CacheDisk(CacheDict): "CacheDisk_data": self._dict, "CacheDisk_cachetime": self._key_cache_time, } - salt.utils.msgpack.dump(cache, fp_, use_bin_type=True) + salt.utils.msgpack.dump(cache, fp_) class CacheCli:
make proper use of msgpack
saltstack_salt
train
py
bd3aabe61b15dce3afbc90e1d7191367139ded3c
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100755 --- a/setup.py +++ b/setup.py @@ -78,6 +78,18 @@ try: if (match and match[4]) or not match: VERSION += ('' if match else 'a') + COMMIT_COUNT.decode('utf-8').strip() + '+g' + COMMIT_HASH.decode('utf-8').strip() + # Also attempt to retrieve a branch, when applicable + PROCESS = subprocess.Popen( + ['git', 'symbolic-ref', '-q', '--short', 'HEAD'], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE + ) + + COMMIT_BRANCH, ERR = PROCESS.communicate() + + if COMMIT_BRANCH: + VERSION += "." + COMMIT_BRANCH.decode('utf-8').strip() + except FileNotFoundError: pass
Include branches in versions for future feature testing
Gorialis_jishaku
train
py