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
77db56abac5be05f9244f10e77a92e02c4abae35
diff --git a/flat/style/flat.editor.js b/flat/style/flat.editor.js index <HASH>..<HASH> 100644 --- a/flat/style/flat.editor.js +++ b/flat/style/flat.editor.js @@ -1335,10 +1335,8 @@ function editor_submit(addtoqueue) { parentselector += " FOR"; var forids = ""; //jshint ignore:line sortededittargets.forEach(function(t){ - if (forids) { - forids += " ,"; - } forids += " ID " + t; + return; //only one should be enough }); parentselector += forids; }
fixed issue #<I> (prevent duplicate comments...bit patchy, may be something wrong in FQL library)
proycon_flat
train
js
e19bc56e731dc147269e99a16c78e57987d6a073
diff --git a/test/config/config.go b/test/config/config.go index <HASH>..<HASH> 100644 --- a/test/config/config.go +++ b/test/config/config.go @@ -70,5 +70,5 @@ func (c *CiliumTestConfigType) ParseFlags() { "Specifies timeout for test run") flag.StringVar(&c.Kubeconfig, "cilium.kubeconfig", "", "Kubeconfig to be used for k8s tests") - flag.StringVar(&c.Kubeconfig, "cilium.registry", "k8s1:5000", "docker registry hostname for Cilium image") + flag.StringVar(&c.Registry, "cilium.registry", "k8s1:5000", "docker registry hostname for Cilium image") }
CI: Fix typo setting kubeconfig variable from registry This caused some off errors, particularly around how we determine whether we are in the CI or running with a custom kubeconfig.
cilium_cilium
train
go
88a94f028b25b696be699106037d39d3654114ed
diff --git a/client-side/src/core/js/modules/loadEvents.js b/client-side/src/core/js/modules/loadEvents.js index <HASH>..<HASH> 100644 --- a/client-side/src/core/js/modules/loadEvents.js +++ b/client-side/src/core/js/modules/loadEvents.js @@ -18,7 +18,7 @@ define(["modules/module", "modules/utils"], function(module, utils) { complete = false, debug = module.options.modulesEnabled.loadEvents && module.options.modulesOptions.loadEvents.debug; - if (!module.options.modulesEnabled.loadEvents) { + if ( (!module.options.modulesEnabled.loadEvents) || (window.CustomEvent === undefined)) { if (debug && utils.isDevelopmentMode()) { console.log('LoadEvents Module disabled.'); }
loadEvents ie8 fix
sourcejs_Source
train
js
5c10ac6579543d79642c65b70210264c1b488e51
diff --git a/packages/posts/photos/instagram/photoSource.js b/packages/posts/photos/instagram/photoSource.js index <HASH>..<HASH> 100644 --- a/packages/posts/photos/instagram/photoSource.js +++ b/packages/posts/photos/instagram/photoSource.js @@ -46,7 +46,7 @@ class InstagramSource extends CachedDataSource { posts = posts.concat(await this.allPostsGetter( searchParams .set("all", true) - .set("beforeId", lastPost) + .set("beforeId", lastPost.id) )); }
fix(posts): Instagram `allPostsGetter` passes an id into `beforeId`. We're only grabbing <I> posts anyways so it's not like we actually have to have this implementation...
randytarampi_me
train
js
a73e9ec40c6cb28d0a5cd9dc1566d8dc0a31e9e5
diff --git a/src/com/google/caliper/LinearTranslation.java b/src/com/google/caliper/LinearTranslation.java index <HASH>..<HASH> 100644 --- a/src/com/google/caliper/LinearTranslation.java +++ b/src/com/google/caliper/LinearTranslation.java @@ -16,8 +16,6 @@ package com.google.caliper; -import com.google.common.base.Preconditions; - public class LinearTranslation { // y = mx + b private final double m; @@ -30,8 +28,6 @@ public class LinearTranslation { * @throws IllegalArgumentException if {@code in1 == in2} */ public LinearTranslation(double in1, double out1, double in2, double out2) { - Preconditions.checkArgument(in1 != in2); - double divisor = in1 - in2; this.m = (out1 - out2) / divisor; this.b = (in1 * out2 - in2 * out1) / divisor;
Remove guava dependency of LinearTranslation so it can be used by GWT git-svn-id: <URL>
trajano_caliper
train
java
6b26687fe011290355679c9dc0522b5074d02930
diff --git a/aiogram/utils/exceptions.py b/aiogram/utils/exceptions.py index <HASH>..<HASH> 100644 --- a/aiogram/utils/exceptions.py +++ b/aiogram/utils/exceptions.py @@ -1,9 +1,11 @@ +_PREFIXES = ['Error: ', '[Error]: ', 'Bad Request: '] + + def _clean_message(text): - return text. \ - lstrip('Error: '). \ - lstrip('[Error]: '). \ - lstrip('Bad Request: '). \ - capitalize() + for prefix in _PREFIXES: + if text.startswith(prefix): + text = text[len(prefix):] + return text class TelegramAPIError(Exception):
Oops. Fix error message cleaner. (In past it can strip first symbol in message)
aiogram_aiogram
train
py
f49851ee6bb62dbec9f3820a85bcce342f42ccc8
diff --git a/bindings.js b/bindings.js index <HASH>..<HASH> 100644 --- a/bindings.js +++ b/bindings.js @@ -115,7 +115,9 @@ function bindings(opts) { } return b; } catch (e) { - if (e.code !== 'MODULE_NOT_FOUND' && e.code !== 'QUALIFIED_PATH_RESOLUTION_FAILED') { + if (e.code !== 'MODULE_NOT_FOUND' && + e.code !== 'QUALIFIED_PATH_RESOLUTION_FAILED' && + !/not find/i.test(e.message)) { throw e; } }
Add back the old module not found check So that we don't have to do a major version bump by dropping support for older Node.js versions.
TooTallNate_node-bindings
train
js
4197b9d443f99b2beb4fabb9f001da0aa2e3f355
diff --git a/go/service/main.go b/go/service/main.go index <HASH>..<HASH> 100644 --- a/go/service/main.go +++ b/go/service/main.go @@ -549,7 +549,7 @@ func (d *Service) runHomePoller(ctx context.Context) { } func (d *Service) runMerkleAudit(ctx context.Context) { - if !libkb.IsMobilePlatform() { + if libkb.IsMobilePlatform() { d.G().Log.Debug("MerkleAudit disabled (not desktop, not starting)") return }
Fixed a bug where the audits would run only on mobile
keybase_client
train
go
835d7e067f4e7168fc59f28ccd05eae89d650fd1
diff --git a/findbugs/src/gui/edu/umd/cs/findbugs/gui2/MainFrameTree.java b/findbugs/src/gui/edu/umd/cs/findbugs/gui2/MainFrameTree.java index <HASH>..<HASH> 100644 --- a/findbugs/src/gui/edu/umd/cs/findbugs/gui2/MainFrameTree.java +++ b/findbugs/src/gui/edu/umd/cs/findbugs/gui2/MainFrameTree.java @@ -618,6 +618,11 @@ public class MainFrameTree implements Serializable { return; } + if(currentSelectedBugLeaf == path.getLastPathComponent()) { + // sync mainFrame if user just clicks on the same bug + mainFrame.syncBugInformation(); + } + if ((e.getButton() == MouseEvent.BUTTON3) || (e.getButton() == MouseEvent.BUTTON1 && e.isControlDown())) { if (tree.getModel().isLeaf(path.getLastPathComponent())) {
bug#<I>: sync bug view when clicking on the already selected tree node (useful when you scrolled away from bug position)
spotbugs_spotbugs
train
java
f8f5c43c33f16baa02c5bb0cde145355ba55d9ba
diff --git a/activerecord/lib/active_record/coders/yaml_column.rb b/activerecord/lib/active_record/coders/yaml_column.rb index <HASH>..<HASH> 100644 --- a/activerecord/lib/active_record/coders/yaml_column.rb +++ b/activerecord/lib/active_record/coders/yaml_column.rb @@ -45,14 +45,20 @@ module ActiveRecord raise ArgumentError, "Cannot serialize #{object_class}. Classes passed to `serialize` must have a 0 argument constructor." end - def yaml_load(payload) - if !ActiveRecord.use_yaml_unsafe_load - YAML.safe_load(payload, permitted_classes: ActiveRecord.yaml_column_permitted_classes, aliases: true) - else - if YAML.respond_to?(:unsafe_load) + if YAML.respond_to?(:unsafe_load) + def yaml_load(payload) + if ActiveRecord.use_yaml_unsafe_load YAML.unsafe_load(payload) else + YAML.safe_load(payload, permitted_classes: ActiveRecord.yaml_column_permitted_classes, aliases: true) + end + end + else + def yaml_load(payload) + if ActiveRecord.use_yaml_unsafe_load YAML.load(payload) + else + YAML.safe_load(payload, permitted_classes: ActiveRecord.yaml_column_permitted_classes, aliases: true) end end end
Improve performance by removing respond_to? from runtime code respond_to? is inherently slow, and the YAML class won't change whether it does or does not respond to unsafe_load, so just check it once during file load, and define methods accordingly.
rails_rails
train
rb
e85c0e628ef564dd2a9fab1822023c8a538c0ff8
diff --git a/lib/maruku/input/parse_block.rb b/lib/maruku/input/parse_block.rb index <HASH>..<HASH> 100644 --- a/lib/maruku/input/parse_block.rb +++ b/lib/maruku/input/parse_block.rb @@ -603,7 +603,7 @@ module MaRuKu; module In; module Markdown; module BlockLevelParser # empty cells increase the colspan of the previous cell found = false colspan += 1 - al = currElem.al || AttributeList.new + al = (currElem &&currElem.al) || AttributeList.new if (al.size>0) elem = find_colspan(al) if (elem != nil)
Corrected a possible crash during processing a table with a blank first column.
bhollis_maruku
train
rb
9521044e26d15c8a820952dbbb4a7e8b214d88f2
diff --git a/spec/controllers/theme_controller_spec.rb b/spec/controllers/theme_controller_spec.rb index <HASH>..<HASH> 100644 --- a/spec/controllers/theme_controller_spec.rb +++ b/spec/controllers/theme_controller_spec.rb @@ -30,7 +30,8 @@ describe ThemeController do assert @response.body =~ /Static View Test from typographic/ end - def disabled_test_javascript + it "disabled_test_javascript" + if false get :stylesheets, :filename => "typo.js" assert_response :success assert_equal "text/javascript", @response.content_type
Make disabled spec show up in test output.
publify_publify
train
rb
c9770f5781a8584c5fabf1fc1a2d5ab9607c5d5e
diff --git a/src/View/View.php b/src/View/View.php index <HASH>..<HASH> 100644 --- a/src/View/View.php +++ b/src/View/View.php @@ -175,13 +175,6 @@ class View implements EventDispatcherInterface protected $theme; /** - * True when the view has been rendered. - * - * @var bool - */ - protected $hasRendered = false; - - /** * An instance of a \Cake\Http\ServerRequest object that contains information about the current request. * This object contains all the information about a request and several methods for reading * additional information about the request. @@ -701,8 +694,6 @@ class View implements EventDispatcherInterface $this->layout = $defaultLayout; } - $this->hasRendered = true; - return $this->Blocks->get('content'); } @@ -1104,17 +1095,6 @@ class View implements EventDispatcherInterface } /** - * Check whether the view has been rendered. - * - * @return bool - * @since 3.7.0 - */ - public function hasRendered(): bool - { - return $this->hasRendered; - } - - /** * Set sub-directory for this template files. * * @param string $subDir Sub-directory name.
Remove unneeded View::$hasRendered flag. Calling View::render() multiple times should simply render again with given arguments and existing context.
cakephp_cakephp
train
php
5366f8af6f18e20c55b2ceef0d4a5dc6b0a9e8ed
diff --git a/router/galeb/router.go b/router/galeb/router.go index <HASH>..<HASH> 100644 --- a/router/galeb/router.go +++ b/router/galeb/router.go @@ -289,6 +289,9 @@ func (r *galebRouter) SetHealthcheck(name string, data router.HealthcheckData) e if err != nil { return err } + if data.Path == "" { + data.Path = "/" + } poolProperties := galebClient.BackendPoolProperties{ HcPath: data.Path, HcStatusCode: fmt.Sprintf("%d", data.Status),
router/galeb: default to healthcheck on /
tsuru_tsuru
train
go
6153c328d69eed32712a722382cd3242ee54fa8f
diff --git a/lib/passport-userapp/strategy.js b/lib/passport-userapp/strategy.js index <HASH>..<HASH> 100644 --- a/lib/passport-userapp/strategy.js +++ b/lib/passport-userapp/strategy.js @@ -92,18 +92,6 @@ Strategy.prototype.authenticate = function (req, options) { } function parseProfile(userappUser) { - /* Function to convert an object from - value/override structure to a simple object */ - function fixObject(object) { - for (var i in object) { - object[i] = object[i].value; - } - } - - var permissions = fixObject(userappUser.permissions), - properties = fixObject(userappUser.properties), - features = fixObject(userappUser.features); - return { provider: 'userapp', id: userappUser.user_id, @@ -116,9 +104,9 @@ Strategy.prototype.authenticate = function (req, options) { emails: [ { value: userappUser.email } ], - permissions: permissions, - features: features, - properties: properties, + permissions: userappUser.permissions, + features: userappUser.features, + properties: userappUser.properties, subscription: userappUser.subscription, lastLoginAt: userappUser.last_login_at, updatedAt: userappUser.updated_at,
Modified the user profile fields (see docs).
userapp-io_passport-userapp
train
js
7934cc74f3e22fe93fa9dc4b8cb0395ba301b7f4
diff --git a/src/main/java/com/buschmais/jqassistant/scm/cli/task/AbstractTask.java b/src/main/java/com/buschmais/jqassistant/scm/cli/task/AbstractTask.java index <HASH>..<HASH> 100644 --- a/src/main/java/com/buschmais/jqassistant/scm/cli/task/AbstractTask.java +++ b/src/main/java/com/buschmais/jqassistant/scm/cli/task/AbstractTask.java @@ -110,7 +110,9 @@ public abstract class AbstractTask implements Task { protected Store getStore() { File directory = new File(storeDirectory); LOG.info("Opening store in directory '" + directory.getAbsolutePath() + "'"); - directory.getParentFile().mkdirs(); + if (!directory.exists()) { + directory.getParentFile().mkdirs(); + } return new EmbeddedGraphStore(directory.getAbsolutePath()); }
#<I> split up scanning of model and artifacts
buschmais_jqa-commandline-tool
train
java
83ed8a054cdb593ad46703cd068c298cf780c797
diff --git a/lib/utils.js b/lib/utils.js index <HASH>..<HASH> 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -9,19 +9,20 @@ var child_process = require('child_process') exports.execSync = (function (command) { 'use strict'; + var execCommand = ''; switch(os.platform()) { case 'win32': case 'win64': - command = command + ' 2>&1 1>output & echo done! > done'; + execCommand = command + ' 2>&1 1>output & echo done! > done'; break; case 'linux': case 'darwin': default: - command = command + ' 2>&1 1>output ; echo done! > done'; + execCommand = command + ' 2>&1 1>output ; echo done! > done'; break; } - child_process.exec(command); + child_process.exec(execCommand); while (!fs.existsSync('done')) { }
ahh, what the hell is wrong with me today.
dustywusty_interfaces
train
js
17624e82d486be8bd71ff9b618ae1ea93dc72340
diff --git a/src/Controller/Controller.php b/src/Controller/Controller.php index <HASH>..<HASH> 100644 --- a/src/Controller/Controller.php +++ b/src/Controller/Controller.php @@ -442,10 +442,6 @@ class Controller extends Object implements EventListener { * @return void */ protected function _mergeControllerVars() { - $pluginDot = null; - if (!empty($this->plugin)) { - $pluginDot = $this->plugin . '.'; - } $this->_mergeVars( ['components', 'helpers'], ['associative' => ['components', 'helpers']]
Removed 4 lines of useless code.
cakephp_cakephp
train
php
da4e883f24a4c6eaa9b4e22bbc231904b632d4b8
diff --git a/lib/index.js b/lib/index.js index <HASH>..<HASH> 100644 --- a/lib/index.js +++ b/lib/index.js @@ -21,7 +21,7 @@ module.exports = function (fileName, globalOptions) { // new copy of globalOptions for each file options = extend({}, globalOptions || {}); - options.includePaths = extend([], globalOptions.includePaths || []); + options.includePaths = extend([], (globalOptions ? globalOptions.includePaths : {}) || []); options.data = inputString; options.includePaths.unshift(path.dirname(fileName));
Let globalOptions be undefined If globalOptions is undefined, referencing something on it throws an error. This lets the globalOptions be undefined, as it will only reference the includePaths if it is defined.
davidguttman_sassify
train
js
8883e9270a347822970a60893d26a10e5f8d3928
diff --git a/src/engine/currencyEngine.js b/src/engine/currencyEngine.js index <HASH>..<HASH> 100644 --- a/src/engine/currencyEngine.js +++ b/src/engine/currencyEngine.js @@ -465,12 +465,20 @@ export class CurrencyEngine { } addGapLimitAddresses (addresses: Array<string>, options: any): void { - const scriptHashes = addresses.map( - displayAddress => this.engineState.scriptHashes[displayAddress] + const scriptHashesPromises = addresses.map( + (displayAddress: string): Promise<string> => { + const scriptHash = this.engineState.scriptHashes[displayAddress] + if (typeof scriptHash === 'string') return Promise.resolve(scriptHash) + return this.keyManager.addressToScriptHash(displayAddress) + } ) - this.engineState.markAddressesUsed(scriptHashes) - if (this.keyManager) this.keyManager.setLookAhead() + Promise.all(scriptHashesPromises) + .then(scriptHashes => { + this.engineState.markAddressesUsed(scriptHashes) + if (this.keyManager) this.keyManager.setLookAhead() + }) + .catch(this.log) } isAddressUsed (address: string, options: any): boolean {
try and get the "scriptHash" from the engineState cache but in case it's not there, manually calculate it.
EdgeApp_edge-currency-bitcoin
train
js
7055fe4356db0f84d3ed6e71bc939fd8ac71756e
diff --git a/database/certificate.go b/database/certificate.go index <HASH>..<HASH> 100644 --- a/database/certificate.go +++ b/database/certificate.go @@ -217,7 +217,7 @@ func (db *DB) UpdateCACertTruststore(id int64, tsName string) error { // In that case it returns -1 with no error. func (db *DB) GetCertIDBySHA1Fingerprint(sha1 string) (int64, error) { - query := fmt.Sprintf(`SELECT id FROM certificates WHERE sha1_fingerprint='%s'`, sha1) + query := fmt.Sprintf(`SELECT id FROM certificates WHERE sha1_fingerprint='%s' ORDER BY id ASC LIMIT 1`, sha1) row := db.QueryRow(query) @@ -242,7 +242,7 @@ func (db *DB) GetCertIDBySHA1Fingerprint(sha1 string) (int64, error) { // In that case it returns -1 with no error. func (db *DB) GetCertIDBySHA256Fingerprint(sha256 string) (int64, error) { - query := fmt.Sprintf(`SELECT id FROM certificates WHERE sha256_fingerprint='%s'`, sha256) + query := fmt.Sprintf(`SELECT id FROM certificates WHERE sha256_fingerprint='%s' ORDER BY id ASC LIMIT 1`, sha256) row := db.QueryRow(query)
Limit GetCert queries to the first result sorted by ID
mozilla_tls-observatory
train
go
a93b3a2eeeb39b3aa003a05c57420e49cb9078b4
diff --git a/src/config/newsletter.php b/src/config/newsletter.php index <HASH>..<HASH> 100644 --- a/src/config/newsletter.php +++ b/src/config/newsletter.php @@ -56,8 +56,8 @@ return [ * */ 'link' => [ - 'arret' => url('jurisprudence'), - 'analyse' => url('jurisprudence') + 'arret' => PHP_SAPI === 'cli' ? false : url('jurisprudence'), + 'analyse' => PHP_SAPI === 'cli' ? false : url('jurisprudence') ] ]; \ No newline at end of file
fix url problem with artisan in config file
DesignPond_newsletter
train
php
810968561c09d46cc2b22b342387d506a7861603
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -1,5 +1,7 @@ #!/usr/bin/env python +"""setup.py.""" + import setuptools if __name__ == '__main__':
Add docstring to satisfy linter
cherrypy_cheroot
train
py
b1be3f77b412af4c1bb36f8e9aeb643dba7e6fa5
diff --git a/apiserver/facades/client/modelmanager/modelmanager.go b/apiserver/facades/client/modelmanager/modelmanager.go index <HASH>..<HASH> 100644 --- a/apiserver/facades/client/modelmanager/modelmanager.go +++ b/apiserver/facades/client/modelmanager/modelmanager.go @@ -781,9 +781,12 @@ func (m *ModelManagerAPI) ListModels(user params.Entity) (params.UserModelList, } for _, mi := range modelInfos { - ownerTag, err := names.ParseUserTag(mi.Owner) - if err != nil { - return params.UserModelList{}, err + var ownerTag names.UserTag + if names.IsValidUser(mi.Owner) { + ownerTag = names.NewUserTag(mi.Owner) + } else { + // no reason to fail the request here, as it wasn't the users fault + logger.Warningf("for model %v, got an invalid owner: %q", mi.UUID, mi.Owner) } result.UserModels = append(result.UserModels, params.UserModel{ Model: params.Model{
Owner is just a user string, not a tag.
juju_juju
train
go
8a2f84b67841786a4a5f0d3d165bd0a49753b2d1
diff --git a/src/store/indexeddb.js b/src/store/indexeddb.js index <HASH>..<HASH> 100644 --- a/src/store/indexeddb.js +++ b/src/store/indexeddb.js @@ -20,6 +20,7 @@ limitations under the License. import Promise from 'bluebird'; import {MemoryStore} from "./memory"; import utils from "../utils"; +import {EventEmitter} from 'events'; import LocalIndexedDBStoreBackend from "./indexeddb-local-backend.js"; import RemoteIndexedDBStoreBackend from "./indexeddb-remote-backend.js"; import User from "../models/user"; @@ -112,6 +113,7 @@ const IndexedDBStore = function IndexedDBStore(opts) { }; }; utils.inherits(IndexedDBStore, MemoryStore); +utils.extend(IndexedDBStore.prototype, EventEmitter.prototype); IndexedDBStore.exists = function(indexedDB, dbName) { return LocalIndexedDBStoreBackend.exists(indexedDB, dbName); @@ -286,6 +288,7 @@ function degradable(func, fallback) { return await func.call(this, ...args); } catch (e) { console.error("IndexedDBStore failure, degrading to MemoryStore", e); + this.emit("degraded", e); try { // We try to delete IndexedDB after degrading since this store is only a // cache (the app will still function correctly without the data).
Emit event when `IndexedDBStore` degrades This allows for optional tracking of when the store degrades to see how often it happens in the field.
matrix-org_matrix-js-sdk
train
js
27e8bbaee4de7858a9b1a2d3ca08c6412006c710
diff --git a/datetime_tz/__init__.py b/datetime_tz/__init__.py index <HASH>..<HASH> 100644 --- a/datetime_tz/__init__.py +++ b/datetime_tz/__init__.py @@ -226,6 +226,8 @@ def _detect_timezone_windows(): olson_name = win32tz_map.win32timezones.get(win32tz_key_name, None) if not olson_name: return None + if not isinstance(olson_name, str): + olson_name = olson_name.encode('ascii') return pytz.timezone(olson_name) def detect_timezone():
Hopefully fix a weird error which only happens with pytz <I>b without breaking Python 3 support
mithro_python-datetime-tz
train
py
2f78a477df6195490f167cd75ec4e86e7e9045cc
diff --git a/autoflake.py b/autoflake.py index <HASH>..<HASH> 100644 --- a/autoflake.py +++ b/autoflake.py @@ -38,7 +38,7 @@ import pyflakes.messages import pyflakes.reporter -__version__ = '0.6' +__version__ = '0.6.1' ATOMS = frozenset([tokenize.NAME, tokenize.NUMBER, tokenize.STRING])
Increment patch version to <I>
myint_autoflake
train
py
63df56af7e612f0a31a411e7db27df5b3f61ea24
diff --git a/lib/gastropod/active_record/validations.rb b/lib/gastropod/active_record/validations.rb index <HASH>..<HASH> 100644 --- a/lib/gastropod/active_record/validations.rb +++ b/lib/gastropod/active_record/validations.rb @@ -3,7 +3,7 @@ module Gastropod module Validations def self.included(base) base.validates :slug, :uniqueness => true - base.validates :slug, :format => { :with => /^[a-z0-9-]+$/, :allow_blank => true } + base.validates :slug, :format => { :with => /\A[a-z0-9-]+\z/, :allow_blank => true } base.validates :slug, :presence => true base.before_validation :assign_generated_slug, :if => :generate_slug?
Updates regex to fix Rails 4 security whine.
vigetlabs_gastropod
train
rb
ca19744b2f10733801861e04194a9e2dcf1e91d6
diff --git a/Sniffs/Arrays/ArrayDeclarationSniff.php b/Sniffs/Arrays/ArrayDeclarationSniff.php index <HASH>..<HASH> 100644 --- a/Sniffs/Arrays/ArrayDeclarationSniff.php +++ b/Sniffs/Arrays/ArrayDeclarationSniff.php @@ -411,7 +411,7 @@ class WordPress_Sniffs_Arrays_ArrayDeclarationSniff implements PHP_CodeSniffer_S // Check each line ends in a comma. if ($tokens[$index['value']]['code'] !== T_ARRAY) { - $nextComma = $phpcsFile->findNext(array(T_COMMA), ($index['value'] + 1)); + $nextComma = $phpcsFile->findNext(array(T_COMMA, T_OPEN_PARENTHESIS), ($index['value'] + 1)); if (($nextComma === false) || ($tokens[$nextComma]['line'] !== $tokens[$index['value']]['line'])) { $error = 'Each line in an array declaration must end in a comma'; $phpcsFile->addError($error, $index['value']);
Fix trailing comma issue in array definition where it choked on closures and multiline functions
WordPress-Coding-Standards_WordPress-Coding-Standards
train
php
eb374c4ea1d953fbabb304bf9151f18691617903
diff --git a/library/CM/Process.php b/library/CM/Process.php index <HASH>..<HASH> 100644 --- a/library/CM/Process.php +++ b/library/CM/Process.php @@ -69,7 +69,7 @@ class CM_Process { * @param int $signal */ public function killChildren($signal) { - foreach ($this->_forkHandlerList as $processId => $workload) { + foreach ($this->_forkHandlerList as $processId => $forkHandler) { posix_kill($processId, $signal); } }
Rename $workload to $forkHandler in loop
cargomedia_cm
train
php
81f4181d8950cc86958986820a2fba62fdce3424
diff --git a/tests/TestCase/Database/Driver/SqlserverTest.php b/tests/TestCase/Database/Driver/SqlserverTest.php index <HASH>..<HASH> 100644 --- a/tests/TestCase/Database/Driver/SqlserverTest.php +++ b/tests/TestCase/Database/Driver/SqlserverTest.php @@ -126,7 +126,7 @@ class SqlserverTest extends TestCase 'settings' => ['config1' => 'value1', 'config2' => 'value2'], ]; $driver = $this->getMockBuilder('Cake\Database\Driver\Sqlserver') - ->setMethods(['_connect', 'getConnection']) + ->setMethods(['_connect', 'setConnection', 'getConnection']) ->setConstructorArgs([$config]) ->getMock(); $dsn = 'sqlsrv:Server=foo;Database=bar;MultipleActiveResultSets=false';
add setConnection to mocked Method list
cakephp_cakephp
train
php
7ab3278dc1b875080cb3d8c77668ae1e2c87cc6d
diff --git a/lib/fog/openstack/models/storage/directory.rb b/lib/fog/openstack/models/storage/directory.rb index <HASH>..<HASH> 100644 --- a/lib/fog/openstack/models/storage/directory.rb +++ b/lib/fog/openstack/models/storage/directory.rb @@ -10,7 +10,7 @@ module Fog attribute :bytes, :aliases => 'X-Container-Bytes-Used' attribute :count, :aliases => 'X-Container-Object-Count' - attr_reader :public + attr_writer :public def destroy requires :key
fix mistyping in openstack storage directory model
fog_fog
train
rb
bf2727d281009bdf6ae59bc3924c8bb2f1f353f2
diff --git a/lib/preview.js b/lib/preview.js index <HASH>..<HASH> 100644 --- a/lib/preview.js +++ b/lib/preview.js @@ -15,7 +15,7 @@ const { module.exports = run; -function run(input, size, vivliostyleTimeout) { +function run(input, sandbox = true) { const stat = fs.statSync(input); const root = stat.isDirectory()? input : path.dirname(input); const index = stat.isDirectory()? 'index.html' : path.basename(input); @@ -41,6 +41,7 @@ function run(input, size, vivliostyleTimeout) { chromeLauncher.launch({ startingUrl: url, + chromeFlags: sandbox ? [] : ['--no-sandbox'] }).then(chrome => { ['SIGNIT', 'SIGTERM'].forEach(sig => { process.on(sig, () => {
make previewer enable to launch without sandbox
violapub_viola-savepdf
train
js
6fb9eb8e470c31f2a6a3d5fb5f91606479d5ef26
diff --git a/searx/static/default/js/searx.js b/searx/static/default/js/searx.js index <HASH>..<HASH> 100644 --- a/searx/static/default/js/searx.js +++ b/searx/static/default/js/searx.js @@ -9,7 +9,7 @@ if(searx.autocompleter) { timeout: 5 // Correct option? }, 'minLength': 4, - // 'selectMode': 'type-ahead', + 'selectMode': false, cache: true, delay: 300 });
[mod] select autocomplete results with mouse click
asciimoo_searx
train
js
a7390425891c5dd292d391e4176acf94824a9b71
diff --git a/spinoff/actor/actor.py b/spinoff/actor/actor.py index <HASH>..<HASH> 100644 --- a/spinoff/actor/actor.py +++ b/spinoff/actor/actor.py @@ -261,8 +261,6 @@ class Actor(BaseActor): self.exit(('error', self, (result.value, result.tb or result.getTraceback()), False)) super(Actor, self).stop() - return d - def stop(self, silent=False): self._on_stop() super(Actor, self).stop()
Removed the unused returning of a Deferred in Actor.start
eallik_spinoff
train
py
5db3d0820bf1a47dd531d152ac8386f43d022344
diff --git a/dist/Button.js b/dist/Button.js index <HASH>..<HASH> 100644 --- a/dist/Button.js +++ b/dist/Button.js @@ -41,7 +41,8 @@ var AriaMenuButtonButton = function (_React$Component) { case 'ArrowDown': event.preventDefault(); if (!ambManager.isOpen) { - ambManager.openMenu({ focusMenu: true }); + ambManager.openMenu(); + ambManager.focusItem(0); } else { ambManager.focusItem(0); } diff --git a/dist/createManager.js b/dist/createManager.js index <HASH>..<HASH> 100644 --- a/dist/createManager.js +++ b/dist/createManager.js @@ -66,7 +66,7 @@ var protoManager = { }, openMenu: function openMenu(openOptions) { if (this.isOpen) return; - openOptions = openOptions || {}; + openOptions = openOptions || { focusMenu: true }; this.isOpen = true; this.update(); this.focusGroup.activate();
adds remaining changes to let menu focus first item
davidtheclark_react-aria-menubutton
train
js,js
1ccee7f031486f6a0145c8449f21fd9094f3e38f
diff --git a/glue/ligolw/ligolw.py b/glue/ligolw/ligolw.py index <HASH>..<HASH> 100644 --- a/glue/ligolw/ligolw.py +++ b/glue/ligolw/ligolw.py @@ -106,7 +106,7 @@ class Element(object): Remove a child from this element. The child element is returned, and it's parentNode element is reset. """ - del self.childNodes[self.childNodes.index(child)] + self.childNodes.remove(child) child.parentNode = None return child
This might be a bit faster...
gwastro_pycbc-glue
train
py
4da4d5b9ab9ad16484e8af58a1c565a3af31ff2b
diff --git a/spec/lib/roots/engine_route_collection_spec.rb b/spec/lib/roots/engine_route_collection_spec.rb index <HASH>..<HASH> 100644 --- a/spec/lib/roots/engine_route_collection_spec.rb +++ b/spec/lib/roots/engine_route_collection_spec.rb @@ -18,6 +18,25 @@ module Roots it 'adds the engine name to each route' do expect(subject.routes.all? { |route| route[:engine] == engine_name }).to eq(true) end + + context 'all an engine\'s routes are internal' do + it 'does not add it to the ivar' do + allow(fake_route).to receive(:internal?) { true } + expect(subject.routes).to be_empty + end + end + + context 'only some of an engine\'s routes are internal' do + let(:another_fake_route) { instance_double(EngineRoute, internal?: false) } + let(:routes) { [fake_route, another_fake_route]} + subject { described_class.new([{engine: engine_name, routes: routes }]) } + + it 'adds the engine to the ivar' do + expect(subject.routes).to_not be_empty + expect(subject.routes.all? { |r| r[:engine] == engine_name }).to eq(true) + expect(subject.routes.first[:routes]).to eq(routes) + end + end end end end
More specs about how engine route collection works
yez_passages
train
rb
9c6e1a2fa80909bb2f5bca66c76f384ea5a2aa09
diff --git a/server/src/main/java/io/atomix/copycat/server/state/ServerSession.java b/server/src/main/java/io/atomix/copycat/server/state/ServerSession.java index <HASH>..<HASH> 100644 --- a/server/src/main/java/io/atomix/copycat/server/state/ServerSession.java +++ b/server/src/main/java/io/atomix/copycat/server/state/ServerSession.java @@ -430,11 +430,13 @@ class ServerSession implements Session { * @return The index of the highest event acked for the session. */ long getLastCompleted() { + // If there are any queued events, return the index prior to the first event in the queue. EventHolder event = events.poll(); if (event != null && event.eventVersion > eventAckVersion) { return event.eventVersion - 1; } - return eventAckVersion; + // If no events are queued, return the highest index applied to the session. + return version; } /**
Ensure last applied index for each session is used as the last event index if no events are queued.
atomix_copycat
train
java
8b8bda63d4198799a933a20af639279a0c00544a
diff --git a/lib/stream/leo-stream.js b/lib/stream/leo-stream.js index <HASH>..<HASH> 100644 --- a/lib/stream/leo-stream.js +++ b/lib/stream/leo-stream.js @@ -430,7 +430,7 @@ module.exports = function(configure) { eid: rOpts.eid || obj.eid, correlation_id: { source: obj.event, - start: rOpts.eid || obj.eid, + [rOpts.partial === true ? 'partial_start' : 'start']: rOpts.eid || obj.eid, units: rOpts.units || obj.units || 1 } });
EN-<I> - allows for setting partial_start attribute If we pass in partial === true, then we set the partial_start attribute instead of start. This enables us to do one to many events in the enrich that we need for new lambda load listeners.
LeoPlatform_Nodejs
train
js
be70b83e7c7f06a75af9014becec711201007454
diff --git a/src/facebook.py b/src/facebook.py index <HASH>..<HASH> 100644 --- a/src/facebook.py +++ b/src/facebook.py @@ -87,6 +87,15 @@ class GraphAPI(object): """Fetchs the given object from the graph.""" return self.request(id, args) + def get_objects(self, ids, **args): + """Fetchs all of the given object from the graph. + + We return a map from ID to object. If any of the IDs are invalid, + we raise an exception. + """ + args["ids"] = ",".join(ids) + return self.request("", args) + def get_connections(self, id, connection_name, **args): """Fetchs the connections for given object.""" return self.request(id + "/" + connection_name, args)
Add multi-get support to Python SDK
mobolic_facebook-sdk
train
py
401899e436a770af77a3b81606d7d36faded3b5e
diff --git a/testsuite/integration/clustering/src/test/java/org/jboss/as/test/clustering/cluster/jpa2lc/DummyEntity.java b/testsuite/integration/clustering/src/test/java/org/jboss/as/test/clustering/cluster/jpa2lc/DummyEntity.java index <HASH>..<HASH> 100644 --- a/testsuite/integration/clustering/src/test/java/org/jboss/as/test/clustering/cluster/jpa2lc/DummyEntity.java +++ b/testsuite/integration/clustering/src/test/java/org/jboss/as/test/clustering/cluster/jpa2lc/DummyEntity.java @@ -27,8 +27,12 @@ import javax.persistence.Cacheable; import javax.persistence.Entity; import javax.persistence.Id; +import org.hibernate.annotations.Cache; +import org.hibernate.annotations.CacheConcurrencyStrategy; + @Entity @Cacheable +@Cache(usage = CacheConcurrencyStrategy.TRANSACTIONAL) public class DummyEntity implements Serializable { @Id
WFLY-<I> ClusteredJPA2LCTestCase fails intermittently
wildfly_wildfly
train
java
e7d48b0b935af6fc95b6aedf328fa2f0654ae754
diff --git a/test/unit/vagrant/action/builtin/handle_forwarded_port_collisions_test.rb b/test/unit/vagrant/action/builtin/handle_forwarded_port_collisions_test.rb index <HASH>..<HASH> 100644 --- a/test/unit/vagrant/action/builtin/handle_forwarded_port_collisions_test.rb +++ b/test/unit/vagrant/action/builtin/handle_forwarded_port_collisions_test.rb @@ -207,7 +207,6 @@ describe Vagrant::Action::Builtin::HandleForwardedPortCollisions do context "with loopback address" do let (:host_ip) { "127.1.2.40" } - let (:addrinfo) { double("addrinfo", ipv4_loopback?: true) } it "should check if the port is open" do expect(instance).to receive(:is_port_open?).with(host_ip, host_port).and_return(true)
Remove test double We don't actually need a test double here because `#ipv4_loopback?` will return true for any address in the `<I>/8` space.
hashicorp_vagrant
train
rb
8e14cc8bd9e722c476dbc893796dc0e16a5a3dc9
diff --git a/src/com/google/javascript/jscomp/DefaultPassConfig.java b/src/com/google/javascript/jscomp/DefaultPassConfig.java index <HASH>..<HASH> 100644 --- a/src/com/google/javascript/jscomp/DefaultPassConfig.java +++ b/src/com/google/javascript/jscomp/DefaultPassConfig.java @@ -2717,6 +2717,11 @@ public final class DefaultPassConfig extends PassConfig { protected CompilerPass create(AbstractCompiler compiler) { return new FlowSensitiveInlineVariables(compiler); } + + @Override + public FeatureSet featureSet() { + return ES8_MODULES; + } }; /** Uses register-allocation algorithms to use fewer variables. */
Run flowSensitiveInlineVariables pass when language_out is ES6+. ------------- Created by MOE: <URL>
google_closure-compiler
train
java
ea837d9ac10e68faa4873be167ab3464edb42fdb
diff --git a/test/nested-model.js b/test/nested-model.js index <HASH>..<HASH> 100644 --- a/test/nested-model.js +++ b/test/nested-model.js @@ -493,6 +493,23 @@ $(document).ready(function() { ok(callbackFired, "callback wasn't fired"); }); + test("#add() on nested array should trigger 'add' event after model is updated", function() { + var callbackFired = false; + var initialLength = doc.get('addresses').length; + var newLength; + + doc.bind('add:addresses', function(model, newAddr){ + newLength = doc.get('addresses').length; + callbackFired = true; + }); + doc.add('addresses', { + city: 'Lincoln', + state: 'NE' + }); + + ok(callbackFired, "callback wasn't fired"); + equal(newLength, initialLength + 1, "array length should be incremented prior to 'add' event firing"); + }); // ----- REMOVE --------
Added failing test for #<I>
afeld_backbone-nested
train
js
deeb67d01251c43aebc04a86ec203e615bd60338
diff --git a/src/replace.js b/src/replace.js index <HASH>..<HASH> 100644 --- a/src/replace.js +++ b/src/replace.js @@ -79,13 +79,13 @@ export class Slice { return new Slice(Fragment.fromJSON(schema, json.content), json.openStart || 0, json.openEnd || 0) } - // :: (Fragment) → Slice + // :: (Fragment, ?bool) → Slice // Create a slice from a fragment by taking the maximum possible // open value on both side of the fragment. - static maxOpen(fragment) { + static maxOpen(fragment, openIsolating=true) { let openStart = 0, openEnd = 0 - for (let n = fragment.firstChild; n && !n.isLeaf; n = n.firstChild) openStart++ - for (let n = fragment.lastChild; n && !n.isLeaf; n = n.lastChild) openEnd++ + for (let n = fragment.firstChild; n && !n.isLeaf && (openIsolating || !n.type.spec.isolating); n = n.firstChild) openStart++ + for (let n = fragment.lastChild; n && !n.isLeaf && (openIsolating || !n.type.spec.isolating); n = n.lastChild) openEnd++ return new Slice(fragment, openStart, openEnd) } }
Add an `openIsolating` argument to Slice.maxOpen FEATURE: [`Slice.maxOpen`](##model.Slice^maxOpen) now has a second argument that can be used to prevent it from opening isolating nodes.
ProseMirror_prosemirror-model
train
js
aa55bcd3f5698e3fffbf2fe8dc162216e9545548
diff --git a/modules/cmsadmin/apis/NavController.php b/modules/cmsadmin/apis/NavController.php index <HASH>..<HASH> 100644 --- a/modules/cmsadmin/apis/NavController.php +++ b/modules/cmsadmin/apis/NavController.php @@ -51,7 +51,7 @@ class NavController extends \admin\base\RestController $model = \cmsadmin\models\Property::find()->where(['admin_prop_id' => $atrs['admin_prop_id'], 'nav_id' => $navId])->one(); if ($model) { - if (empty($atrs['value'])) { + if (empty($atrs['value']) && $atrs['value'] != 0) { $model->delete(); } else { // update
fixed bug where admin properties with 0 values have been deleted.
luyadev_luya
train
php
218d8404082186ef0f9fe971576f0b71a97c8958
diff --git a/src/TextField/TextField.js b/src/TextField/TextField.js index <HASH>..<HASH> 100644 --- a/src/TextField/TextField.js +++ b/src/TextField/TextField.js @@ -11,7 +11,7 @@ import TextFieldLabel from './TextFieldLabel'; import TextFieldUnderline from './TextFieldUnderline'; import warning from 'warning'; -const getStyles = (props, state) => { +const getStyles = (props, context, state) => { const { baseTheme, textField: { @@ -23,7 +23,7 @@ const getStyles = (props, state) => { hintColor, errorColor, }, - } = state.muiTheme; + } = context.muiTheme; const styles = { root: { @@ -438,7 +438,7 @@ class TextField extends React.Component { } = this.props; const {prepareStyles} = this.context.muiTheme; - const styles = getStyles(this.props, this.context); + const styles = getStyles(this.props, this.context, this.state); const inputId = id || this.uniqueId; const errorTextElement = this.state.errorText && (
[TextField] Fix incorrect state in getStyles() getStyles() was reading state, from context, so dynamic styling was not being applied correctly.
mui-org_material-ui
train
js
1c54d999f66ab0dd2b69361ffda3a32979671c2b
diff --git a/config/hoe.rb b/config/hoe.rb index <HASH>..<HASH> 100644 --- a/config/hoe.rb +++ b/config/hoe.rb @@ -52,6 +52,7 @@ $hoe = Hoe.spec(GEM_NAME) do |p| p.summary = SUMMARY p.url = HOMEPATH p.rubyforge_name = RUBYFORGE_PROJECT if RUBYFORGE_PROJECT + p.readme_file = "README.markdown" p.test_globs = ["test/**/test_*.rb"] p.clean_globs |= ['**/.*.sw?', '*.gem', '.config', '**/.DS_Store', 'classes'] #An array of file patterns to delete on clean.
let hoe know about the renamed readme
jarib_celerity
train
rb
9bbce4a223fd0496e65abee46471b6dfbbf19ada
diff --git a/src/main/java/org/jboss/netty/buffer/DynamicChannelBuffer.java b/src/main/java/org/jboss/netty/buffer/DynamicChannelBuffer.java index <HASH>..<HASH> 100644 --- a/src/main/java/org/jboss/netty/buffer/DynamicChannelBuffer.java +++ b/src/main/java/org/jboss/netty/buffer/DynamicChannelBuffer.java @@ -275,7 +275,7 @@ public class DynamicChannelBuffer extends AbstractChannelBuffer { } ChannelBuffer newBuffer = factory().getBuffer(order(), newCapacity); - newBuffer.writeBytes(buffer, readerIndex(), readableBytes()); + newBuffer.writeBytes(buffer, 0, writerIndex()); buffer = newBuffer; } }
Fixed a bug where a dynamic buffer's readerIndex goes out of sync on expansion
netty_netty
train
java
991f3d6c16e60a0cf3cb5982e939eb153aa8fca5
diff --git a/src/Chord.js b/src/Chord.js index <HASH>..<HASH> 100644 --- a/src/Chord.js +++ b/src/Chord.js @@ -73,9 +73,14 @@ class ConductorChord { this.conductor = Conductor.create(this.config.conductorConfig); u.log(this, "Channel and conductor created? "+this.conductor!=null); - //Set onconnection event. + //Set onconnection event to handle connections made to us. this.conductor.onconnection = conn => { - result.on("message", (a)=>{console.log(a); conn.send(a)}); + conn.ondatachannel = dChan => { + dChan.on("message", (a)=>{ + console.log(a); + dChan.send(a); + }); + } }; //Create a module registry, register the RPC default module.
Testing new ondatachannel event of conductor.
FelixMcFelix_conductor-chord
train
js
934711a10aaa95d0ffb90ccf204d1b9863eb4252
diff --git a/system/core/models/Language.php b/system/core/models/Language.php index <HASH>..<HASH> 100644 --- a/system/core/models/Language.php +++ b/system/core/models/Language.php @@ -335,7 +335,7 @@ class Language extends Model public function text($string, array $arguments = array(), $class = '') { if (empty($this->langcode)) { - return $string; + return $this->formatString($string, $arguments); } if (empty($class)) {
Bug fix \core\models\Language::text()
gplcart_gplcart
train
php
b918602157598e32db3205b98d1e4b7d8863c116
diff --git a/war/resources/scripts/hudson-behavior.js b/war/resources/scripts/hudson-behavior.js index <HASH>..<HASH> 100644 --- a/war/resources/scripts/hudson-behavior.js +++ b/war/resources/scripts/hudson-behavior.js @@ -284,7 +284,7 @@ function expandTextArea(button,id) { function refreshPart(id,url) { window.setTimeout(function() { new Ajax.Request(url, { - method: "get", + method: "post", onComplete: function(rsp, _) { var hist = $(id); var p = hist.parentNode;
don't know if this causes a problem, but in other places GET->POST change seemed to make things work, so I'm just changing it here as a precaution. git-svn-id: <URL>
jenkinsci_jenkins
train
js
b4709dc5004d962f9914ea300b800e01b4b27eef
diff --git a/src/java/org/apache/cassandra/service/StorageService.java b/src/java/org/apache/cassandra/service/StorageService.java index <HASH>..<HASH> 100644 --- a/src/java/org/apache/cassandra/service/StorageService.java +++ b/src/java/org/apache/cassandra/service/StorageService.java @@ -169,15 +169,6 @@ public class StorageService implements IEndpointStateChangeSubscriber, StorageSe /* This abstraction maintains the token/endpoint metadata information */ private TokenMetadata tokenMetadata_ = new TokenMetadata(); - /* This thread pool does consistency checks when the client doesn't care about consistency */ - private ExecutorService consistencyManager_ = new JMXEnabledThreadPoolExecutor(DatabaseDescriptor.getConsistencyThreads(), - DatabaseDescriptor.getConsistencyThreads(), - StageManager.KEEPALIVE, - TimeUnit.SECONDS, - new LinkedBlockingQueue<Runnable>(), - new NamedThreadFactory("ReadRepair"), - "request"); - private Set<InetAddress> replicatingNodes; private InetAddress removingNode;
r/m unused consistencyManager executor (obsoleted by #<I>) git-svn-id: <URL>
Stratio_stratio-cassandra
train
java
bcfc24d64a2a745f91f0415c733f2baab8dbf948
diff --git a/lib/tjbot.js b/lib/tjbot.js index <HASH>..<HASH> 100644 --- a/lib/tjbot.js +++ b/lib/tjbot.js @@ -156,8 +156,8 @@ TJBot.prototype.defaultConfiguration = { }, speak: { language: 'en-US', // see TJBot.prototype.languages.speak - voice: undefined // use a specific voice; if undefined, a voice is chosen based on robot.gender and speak.language - speakerDeviceId: "plughw:0,0", // plugged-in USB card 1, device 0; see aplay -l for a list of playback devices + voice: undefined, // use a specific voice; if undefined, a voice is chosen based on robot.gender and speak.language + speakerDeviceId: "plughw:0,0" // plugged-in USB card 1, device 0; see aplay -l for a list of playback devices }, see: { confidenceThreshold: {
add support specifying speaker device id
ibmtjbot_tjbotlib
train
js
82e819da6547ead523e6286e08d7222eb6024c67
diff --git a/peewee.py b/peewee.py index <HASH>..<HASH> 100644 --- a/peewee.py +++ b/peewee.py @@ -560,11 +560,16 @@ class ReverseForeignRelatedObject(object): class ForeignKeyField(IntegerField): - field_template = '%(db_field)s NOT NULL REFERENCES "%(to_table)s" ("id")' + field_template = '%(db_field)s %(nullable)s REFERENCES "%(to_table)s" ("id")' - def __init__(self, to, *args, **kwargs): + def __init__(self, to, null=False, *args, **kwargs): self.to = to + self.null = null kwargs['to_table'] = to._meta.db_table + if null: + kwargs['nullable'] = '' + else: + kwargs['nullable'] = 'NOT NULL' super(ForeignKeyField, self).__init__(*args, **kwargs) def add_to_class(self, klass, name):
Adding nullable fks
coleifer_peewee
train
py
16d34911f7fadbf233922fd3fbf786bce2b14dec
diff --git a/js/gateio.js b/js/gateio.js index <HASH>..<HASH> 100755 --- a/js/gateio.js +++ b/js/gateio.js @@ -692,8 +692,7 @@ module.exports = class gateio extends Exchange { for (let i = 0; i < response.length; i++) { const market = response[i]; const id = this.safeString2 (market, 'id', 'name'); - const baseId = id.split ('_')[0]; - const quoteId = id.split ('_')[1]; + const [baseId, quoteId] = id.split ('_'); const base = this.safeCurrencyCode (baseId); const quote = this.safeCurrencyCode (quoteId); const taker = this.safeNumber2 (market, 'fee', 'taker_fee_rate') / 100;
one split for gateio loadMarkets
ccxt_ccxt
train
js
4e0fa975e8de36d8342c03f2ab018a9c5c5fa7b6
diff --git a/src/rinoh/font/google.py b/src/rinoh/font/google.py index <HASH>..<HASH> 100644 --- a/src/rinoh/font/google.py +++ b/src/rinoh/font/google.py @@ -106,7 +106,7 @@ def download_file(name, url): break f.write(buffer) except HTTPError as e: - if e.code == 404: + if e.code in (404, 403): return None # not found raise return download_path
Google Fonts: handle <I> error Sometimes the server returns error <I> (forbidden) instead of <I> for an unknown reason. This happens when looking for 'Comic Sans MS', for example.
brechtm_rinohtype
train
py
8d3049af04f7427502a0d09e4f368027d4da3ca7
diff --git a/bin/get-webpack-config.js b/bin/get-webpack-config.js index <HASH>..<HASH> 100644 --- a/bin/get-webpack-config.js +++ b/bin/get-webpack-config.js @@ -1,8 +1,5 @@ const webpack = require('webpack'); const path = require('path'); -const requireFromString = require('require-from-string'); -const MemoryFS = require('memory-fs'); -const deasync = require('deasync'); // Plugins const ExtractTextPlugin = require('extract-text-webpack-plugin'); @@ -215,6 +212,14 @@ const getWebpackConfig = (options = ({}), privateOptions = ({})) => { * @return {String} String which contains the server rendered app */ getServerString = options => { + // Requiring dependencies here because there is no need or use while running eslint (which also imports webpack config). + // Some packages like `deasync` fail while running from some IDE's + /* eslint-disable global-require */ + const requireFromString = require('require-from-string'); + const MemoryFS = require('memory-fs'); + const deasync = require('deasync'); + /* eslint-enable global-require */ + const { isProd } = options; const bundlePath = path.join(rootPath, 'www', `app${isProd ? '.min' : ''}.js`);
Fix lints on electron based IDEs, closes #<I>
unimonkiez_react-cordova-boilerplate
train
js
cf50ffcd3324a7eb9d3c5b4cab56a911ffc0ba37
diff --git a/signer/api/ecdsa_hardware_crypto_service.go b/signer/api/ecdsa_hardware_crypto_service.go index <HASH>..<HASH> 100644 --- a/signer/api/ecdsa_hardware_crypto_service.go +++ b/signer/api/ecdsa_hardware_crypto_service.go @@ -243,6 +243,7 @@ func sign(ctx *pkcs11.Ctx, session pkcs11.SessionHandle, pkcs11KeyID []byte, pas // Get the SHA256 of the payload digest := sha256.Sum256(payload) + fmt.Println("Please touch the attached Yubikey to perform signing.") sig, err = ctx.Sign(session, digest[:]) if err != nil { logrus.Debugf("Error while signing: %s", err)
add message when user is required to touch yubikey to sign. N.B. touch is required during Sign, not SignInit
theupdateframework_notary
train
go
5c3199ceed55926f4fd016646fbc27ac3875330b
diff --git a/Controller/StepController.php b/Controller/StepController.php index <HASH>..<HASH> 100644 --- a/Controller/StepController.php +++ b/Controller/StepController.php @@ -110,7 +110,11 @@ class StepController extends Controller /** * - * @Route("/plop/", name="innova_user_resources", options = {"expose"=true}) + * @Route( + * "/step/resources", + * name="innova_user_resources", + * options = {"expose"=true} + * ) * @Method("GET") */ public function getUserResourcesAction() @@ -123,7 +127,7 @@ class StepController extends Controller $resources = array(); foreach ($resourceNodes as $resourceNode) { - if(in_array( $resourceNode->getResourceType()->getId(), $resourceTypeToShow)){ + if (in_array( $resourceNode->getResourceType()->getId(), $resourceTypeToShow)) { $resource = new \stdClass(); $resource->id = $resourceNode->getId(); $resource->workspace = $resourceNode->getWorkspace()->getName();
[PathBundle] change route used to load claro resources
claroline_Distribution
train
php
a271b18a09b49cfc9cc1d04da421b5a680340e20
diff --git a/core/ClientController.js b/core/ClientController.js index <HASH>..<HASH> 100644 --- a/core/ClientController.js +++ b/core/ClientController.js @@ -156,6 +156,8 @@ class ClientController extends EventEmitter { this._previouslyRendered = true; debug('React Rendered'); this.emit('render'); + }).catch((err) => { + debug("Error while rendering.", err); }); } diff --git a/core/renderMiddleware.js b/core/renderMiddleware.js index <HASH>..<HASH> 100644 --- a/core/renderMiddleware.js +++ b/core/renderMiddleware.js @@ -220,6 +220,8 @@ function writeBody(req, res, context, start, page) { // reduce is called length - 1 times. we need to call one final time here to make sure we // chain the final promise. renderElement(res, element, context, elementPromises.length - 1); + }).catch((err) => { + debug("Error while rendering", err); }); }
Triton API Refactor: Added some tests for promises of ReactElement
redfin_react-server
train
js,js
b634951affed9eec7ac3ce5d94b1490e15a609e1
diff --git a/OpenPNM/__init__.py b/OpenPNM/__init__.py index <HASH>..<HASH> 100644 --- a/OpenPNM/__init__.py +++ b/OpenPNM/__init__.py @@ -54,7 +54,7 @@ import scipy as _sp if _sys.version_info < (3, 4): raise Exception('OpenPNM requires Python 3.4 or greater to run') -__version__ = '1.6.2' +__version__ = '1.7.0' from . import Base from . import Network
Bumping version number to <I>
PMEAL_OpenPNM
train
py
442dde814285b73bf4c0be107d37d12005fbccaa
diff --git a/src/com/mebigfatguy/fbcontrib/detect/PossibleConstantAllocationInLoop.java b/src/com/mebigfatguy/fbcontrib/detect/PossibleConstantAllocationInLoop.java index <HASH>..<HASH> 100755 --- a/src/com/mebigfatguy/fbcontrib/detect/PossibleConstantAllocationInLoop.java +++ b/src/com/mebigfatguy/fbcontrib/detect/PossibleConstantAllocationInLoop.java @@ -277,7 +277,7 @@ public class PossibleConstantAllocationInLoop extends BytecodeScanningDetector { if (offsets.length > 0) { int top = getPC(); int bottom = top + offsets[offsets.length - 1]; - SwitchInfo switchInfo = new SwitchInfo(top, bottom); + SwitchInfo switchInfo = new SwitchInfo(bottom); switchInfos.add(switchInfo); } break; @@ -344,11 +344,9 @@ public class PossibleConstantAllocationInLoop extends BytecodeScanningDetector { } static class SwitchInfo { - int switchTop; int switchBottom; - public SwitchInfo(int top, int bottom) { - switchTop = top; + public SwitchInfo(int bottom) { switchBottom = bottom; } }
Github #<I> drop unread field
mebigfatguy_fb-contrib
train
java
12c06a644b2c6f44adbe7d0422a66991ed70ec1a
diff --git a/treetime/clock_tree.py b/treetime/clock_tree.py index <HASH>..<HASH> 100644 --- a/treetime/clock_tree.py +++ b/treetime/clock_tree.py @@ -476,7 +476,7 @@ class ClockTree(TreeAnc): LH -= node.branch_length_interpolator(node.branch_length) # add the root sequence LH and return - if self.aln: + if self.aln and self.sequence_reconstruction: LH += self.gtr.sequence_logLH(self.tree.root.cseq, pattern_multiplicity=self.data.multiplicity) return LH
only add sequence LH to total if reconstruction has been performed
neherlab_treetime
train
py
6c9257c5eb085507838730268c3929bc34374e15
diff --git a/library/Phrozn/Site/View/Base.php b/library/Phrozn/Site/View/Base.php index <HASH>..<HASH> 100644 --- a/library/Phrozn/Site/View/Base.php +++ b/library/Phrozn/Site/View/Base.php @@ -90,6 +90,12 @@ abstract class Base private $siteConfig; /** + * Loaded content of configs/phrozn.yml + * @var array + */ + private $appConfig; + + /** * Initialize page * * @param string $inputFile Path to page source file @@ -302,6 +308,7 @@ abstract class Base { $params['page'] = $this->getFrontMatter(); $params['site'] = $this->getSiteConfig(); + $params['phr'] = $this->getAppConfig(); // also create merged configuration if (isset($params['page'], $params['site'])) { $params['this'] = array_merge($params['page'], $params['site']); @@ -509,4 +516,14 @@ abstract class Base } return $this->source; } + + private function getAppConfig() + { + if (null === $this->appConfig) { + $path = dirname(__FILE__) . '/../../../../configs/phrozn.yml'; + $this->appConfig = Yaml::load(file_get_contents($path)); + } + + return $this->appConfig; + } }
Added phr section to exposed global vars
Pawka_phrozn
train
php
be1b281c5e0abf89738bba7b0299f3ce36817753
diff --git a/lib/infograph.js b/lib/infograph.js index <HASH>..<HASH> 100644 --- a/lib/infograph.js +++ b/lib/infograph.js @@ -95,6 +95,9 @@ class InfoGraph { addEdge(fromId, toId) { + if (!fromId || !toId) + throw new Error(`Cannot add edge from ${fromId} to ${toId}`) + const edges = this.adjacencyList[fromId] || new Set() edges.add(toId) this.adjacencyList[fromId] = edges
InfoGraph#addEdge: throws errors when information is missing
shippjs_shipp-server
train
js
26452445ad3bee47a9014eaa7a018bc81be39708
diff --git a/bundles/org.eclipse.orion.client.javascript/web/javascript/plugins/javascriptPlugin.js b/bundles/org.eclipse.orion.client.javascript/web/javascript/plugins/javascriptPlugin.js index <HASH>..<HASH> 100644 --- a/bundles/org.eclipse.orion.client.javascript/web/javascript/plugins/javascriptPlugin.js +++ b/bundles/org.eclipse.orion.client.javascript/web/javascript/plugins/javascriptPlugin.js @@ -373,7 +373,7 @@ define([ { nls: 'javascript/nls/messages', //$NON-NLS-0$ name: 'jsHover', - contentType: ["application/javascript", "text/html"] //$NON-NLS-0$ //$NON-NLS-1$ + contentType: ["application/javascript"] //$NON-NLS-0$ //$NON-NLS-1$ }); provider.registerService("orion.edit.contentassist", new ContentAssist.JSContentAssist(astManager), //$NON-NLS-0$
[nobug] remove accidental addition to hook JS hover to HTML files
eclipse_orion.client
train
js
e84cef691325110d9df87cb2a8e1964901841733
diff --git a/src/Valkyrja/View/Templates/Template.php b/src/Valkyrja/View/Templates/Template.php index <HASH>..<HASH> 100644 --- a/src/Valkyrja/View/Templates/Template.php +++ b/src/Valkyrja/View/Templates/Template.php @@ -18,7 +18,6 @@ use Valkyrja\View\Template as Contract; use Valkyrja\View\View; use function array_merge; -use function count; use function htmlentities; use const ENT_QUOTES; @@ -247,15 +246,11 @@ class Template implements Contract */ public function endBlock(): void { - $lastCount = count($this->blockStatus) - 1; - $block = $this->blockStatus[$lastCount]; - - unset($this->blockStatus[$lastCount]); - - if ($lastCount === 0) { - $this->blockStatus = []; - } - + // Get the last item in the array (newest block to close) + $block = end($this->blockStatus); + // Remove the last item in the array (as we are now closing it out) + array_pop($this->blockStatus); + // Render the block and set the value in the blocks array $this->blocks[$block] = $this->engine->endRender(); }
View: Fix bug with blocks' endBlock functionality.
valkyrjaio_valkyrja
train
php
e58bae57dfd242fb770b68cd82ab7f438b1c24fe
diff --git a/cfpiva.js b/cfpiva.js index <HASH>..<HASH> 100644 --- a/cfpiva.js +++ b/cfpiva.js @@ -44,7 +44,8 @@ cfpiva.controllaPIVA = function (piva, callback) { if (piva == '') return ''; if (piva.length != 11) return formatReturn(false, 'La lunghezza della partita IVA non è corretta: la partita IVA dovrebbe essere lunga esattamente 11 caratteri.', callback); - var validi = '0123456789'; + var validi, i, s, c; + validi = '0123456789'; for (i = 0; i < 11; i++) { if (validi.indexOf(piva.charAt(i)) == -1) return formatReturn(false, 'La partita IVA contiene un carattere non valido \'' + piva.charAt(i) + '\'. I caratteri validi sono solo cifre.', callback);
declaring undeclared vars fix #3
dennybiasiolli_node-cfpiva
train
js
506623645d71432a6620d03bb0c67ced04b8482e
diff --git a/lib/sass/engine.rb b/lib/sass/engine.rb index <HASH>..<HASH> 100755 --- a/lib/sass/engine.rb +++ b/lib/sass/engine.rb @@ -205,6 +205,8 @@ END return node, index end + node.line = @line + if node.is_a? Tree::CommentNode while has_children line, index = raw_next_line(index) @@ -253,11 +255,9 @@ END if c.is_a?(Tree::DirectiveNode) raise SyntaxError.new("Import directives may only be used at the root of a document.", @line) end - c.line = @line parent << c end when Tree::Node - child.line = @line parent << child end end
Fix a line-numbering error error in Sass. Reported by Mike Judge. Thanks, Mike!
sass_ruby-sass
train
rb
a149fc4195f55f778cdb6bc34564e4cfc29ff900
diff --git a/tests/virgil-cards.js b/tests/virgil-cards.js index <HASH>..<HASH> 100644 --- a/tests/virgil-cards.js +++ b/tests/virgil-cards.js @@ -130,7 +130,7 @@ test('create private virgil card', function (t) { var token = VirgilSDK.utils.generateValidationToken( username, identityType, - process.env.VIRGIL_APP_PRIVATE_KEY.replace(/\\n/g, '\n'), + process.env.VIRGIL_APP_PRIVATE_KEY.replace(/\\n/g, '\n').replace(/\|/g, '\n'), // workaround for travis env vars process.env.VIRGIL_APP_PRIVATE_KEY_PASSWORD );
Update test, add workaround for travis env variables new lines
VirgilSecurity_virgil-sdk-javascript
train
js
f09337e50ed0d3499679e9dff9fa56886f61e078
diff --git a/tests/big-ass-files.test.js b/tests/big-ass-files.test.js index <HASH>..<HASH> 100644 --- a/tests/big-ass-files.test.js +++ b/tests/big-ass-files.test.js @@ -4,7 +4,9 @@ describe.only('when some big files start coming in, this adapter', function() { // Set up a route which listens to uploads app.post('/upload', function (req, res, next) { assert(_.isFunction(req.file)); - req.file('avatar').upload(adapter.receive(), function (err, files) { + req.file('avatar').upload(adapter.receive({ + maxBytes: 50000000 // 50 MB + }), function (err, files) { if (err) throw err; res.statusCode = 200; return res.end();
Adjust maxBytes for the big ass file test.
balderdashy_skipper-adapter-tests
train
js
2e5dd8a21326ecaf2cf131081c707a022d41a146
diff --git a/plenum/test/client/test_client_retry.py b/plenum/test/client/test_client_retry.py index <HASH>..<HASH> 100644 --- a/plenum/test/client/test_client_retry.py +++ b/plenum/test/client/test_client_retry.py @@ -100,7 +100,7 @@ def testClientNotRetryRequestWhenReqnackReceived(looper, nodeSet, client1, origTrans = alpha.transmitToClient def nackReq(self, req, frm): - self.transmitToClient(RequestNack(*req.key, reason="testing"), frm) + self.transmitToClient(RequestNack(*req.key, "testing"), frm) def onlyTransNack(msg, remoteName): if not isinstance(msg, RequestNack):
Fix testClientNotRetryRequestWhenReqnackReceived
hyperledger_indy-plenum
train
py
7f713ace56a57c9ca15b5084e498e13719795a69
diff --git a/src/StreamEncryption.php b/src/StreamEncryption.php index <HASH>..<HASH> 100644 --- a/src/StreamEncryption.php +++ b/src/StreamEncryption.php @@ -31,6 +31,10 @@ class StreamEncryption // On versions affected by this bug we need to fread the stream until we // get an empty string back because the buffer indicator could be wrong $this->wrapSecure = true; + + if (PHP_VERSION_ID >= 50600) { + $this->method = STREAM_CRYPTO_METHOD_TLSv1_0_CLIENT | STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT | STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT; + } } public function enable(Stream $stream)
Explicitly set supported TLS version for PHP<I>+
reactphp_socket
train
php
a4d50c2b6d9fc0625cd1e53c8598d442949b7262
diff --git a/Model/ExtendedFieldModel.php b/Model/ExtendedFieldModel.php index <HASH>..<HASH> 100644 --- a/Model/ExtendedFieldModel.php +++ b/Model/ExtendedFieldModel.php @@ -240,7 +240,7 @@ class ExtendedFieldModel extends FieldModel $entity->deletedId = $id; $this->dispatchEvent('post_delete', $entity, false, $event); } - + /** * @param string $object *
Actually run php-cs-fixer (for real)
TheDMSGroup_mautic-extended-field
train
php
c077c2432ef63a11db6a091c36bc394e03af1f5e
diff --git a/rinoh/flowable.py b/rinoh/flowable.py index <HASH>..<HASH> 100644 --- a/rinoh/flowable.py +++ b/rinoh/flowable.py @@ -26,7 +26,7 @@ from .dimension import DimensionBase, PT from .draw import ShapeStyle, Rectangle, Line, LineStyle, Stroke from .layout import (InlineDownExpandingContainer, VirtualContainer, MaybeContainer, discard_state, ContainerOverflow, - EndOfContainer, PageBreakException) + EndOfContainer, PageBreakException, CONTENT) from .style import Styled, Style, OptionSet, Attribute, Bool from .text import StyledText from .util import ReadAliasAttribute, NotImplementedAttribute @@ -118,7 +118,8 @@ class Flowable(Styled): as specified in its style's `space_above` attribute. Similarly, the flowed content is followed by a vertical space with a height given by the `space_below` style attribute.""" - container.page._empty = False + if container.type == CONTENT: + container.page._empty = False top_to_baseline = 0 state = state or self.initial_state(container) if state.initial:
Fix infinite loop. Non-content containers should not influence a page's "emptyness".
brechtm_rinohtype
train
py
8a74e27e725708546f0e5c72d68c3359c3a5cb22
diff --git a/fragments/config.py b/fragments/config.py index <HASH>..<HASH> 100644 --- a/fragments/config.py +++ b/fragments/config.py @@ -55,6 +55,7 @@ class FragmentsConfig(dict): except Exception, exc: raise ConfigurationFileCorrupt(exc.message) self.update(parsed_json) + self['version'] = tuple(self['version']) else: raise ConfigurationFileNotFound("Could not access %r, if the file exists, check its permissions" % self.path)
config['version'] should always be a tuple
glyphobet_fragments
train
py
dae2de5ddd6b31ce3861eac3ee229a08641f5771
diff --git a/api/src/opentrons/api/session.py b/api/src/opentrons/api/session.py index <HASH>..<HASH> 100755 --- a/api/src/opentrons/api/session.py +++ b/api/src/opentrons/api/session.py @@ -135,6 +135,7 @@ class Session(object): self.modules = None self.metadata = {} self.api_level = None + self.protocol_text = protocol.text self.startTime = None self._motion_lock = motion_lock diff --git a/api/tests/opentrons/api/test_session.py b/api/tests/opentrons/api/test_session.py index <HASH>..<HASH> 100755 --- a/api/tests/opentrons/api/test_session.py +++ b/api/tests/opentrons/api/test_session.py @@ -138,6 +138,7 @@ async def test_load_and_run_v2( session.run() assert len(session.command_log) == 4, \ "Clears command log on the next run" + assert session.protocol_text == protocol.text @pytest.mark.api1_only @@ -183,6 +184,7 @@ async def test_load_and_run( session.run() assert len(session.command_log) == 6, \ "Clears command log on the next run" + assert session.protocol_text == protocol.text def test_init(run_session):
fix(api): reflect protocol text over rpc (#<I>) The session needs a protocol text member exposed via rpc to let apps that aren't the one that uploaded the protocol see what the protocol was. The app also relies on it (perhaps incorrectly) in a couple ways, for instance the creation method, and without this exposed it can't decide what it is. In addition, add a test to catch the regression in the future.
Opentrons_opentrons
train
py,py
3d7532ca921df0dfd857c3b4e71debb263f5a664
diff --git a/lib/twostroke/runtime/lib/string.rb b/lib/twostroke/runtime/lib/string.rb index <HASH>..<HASH> 100644 --- a/lib/twostroke/runtime/lib/string.rb +++ b/lib/twostroke/runtime/lib/string.rb @@ -44,7 +44,7 @@ module Twostroke::Runtime md = re.match s, offset break unless md && (offset.zero? || global) retn << md.pre_match[offset..-1] - retn << Types.to_string(callback.(scope, nil, [*md.to_a.map { |c| Types::String.new c }, Types::Number.new(md.begin 0), sobj])).string + retn << Types.to_string(callback.(scope, nil, [*md.to_a.map { |c| Types::String.new(c || "") }, Types::Number.new(md.begin 0), sobj])).string offset = md.end 0 end
avoid passing nil into Types::String.new
charliesome_twostroke
train
rb
0b3ed9fb588c3ee98de0413e664916885803293e
diff --git a/lib/itamae/recipe.rb b/lib/itamae/recipe.rb index <HASH>..<HASH> 100644 --- a/lib/itamae/recipe.rb +++ b/lib/itamae/recipe.rb @@ -2,6 +2,8 @@ require 'itamae' module Itamae class Recipe + NotFoundError = Class.new(StandardError) + attr_reader :path attr_reader :runner attr_reader :dependencies @@ -55,6 +57,9 @@ module Itamae def include_recipe(target) target = ::File.expand_path(target, File.dirname(@path)) + unless File.exist?(target) + raise NotFoundError, "File not found. (#{target})" + end recipe = Recipe.new(@runner, target) @dependencies << recipe end
If a file to be included doesn't exist, raise an error.
itamae-kitchen_itamae
train
rb
f96fdd3be1cae3e3774c9e83d90b7b779089d16f
diff --git a/shardingsphere-db-protocol/shardingsphere-db-protocol-postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/generic/PostgreSQLCommandCompletePacket.java b/shardingsphere-db-protocol/shardingsphere-db-protocol-postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/generic/PostgreSQLCommandCompletePacket.java index <HASH>..<HASH> 100644 --- a/shardingsphere-db-protocol/shardingsphere-db-protocol-postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/generic/PostgreSQLCommandCompletePacket.java +++ b/shardingsphere-db-protocol/shardingsphere-db-protocol-postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/generic/PostgreSQLCommandCompletePacket.java @@ -46,7 +46,7 @@ public final class PostgreSQLCommandCompletePacket implements PostgreSQLIdentifi return; } String delimiter = "INSERT".equals(sqlCommand) ? " 0 " : " "; - payload.writeStringNul(String.join(delimiter, sqlCommand, Long.toString(rowCount))); + payload.writeStringNul(sqlCommand + delimiter + rowCount); } @Override
Simplify String concat in PostgreSQLCommandCompletePacket (#<I>)
apache_incubator-shardingsphere
train
java
836bfe569605c4efba1a27856ddeb799c67054a9
diff --git a/tests/test_popobject_create.py b/tests/test_popobject_create.py index <HASH>..<HASH> 100644 --- a/tests/test_popobject_create.py +++ b/tests/test_popobject_create.py @@ -97,7 +97,8 @@ class testMlocusPopCreate(unittest.TestCase): def testConstruction(self): pop = fwdpy11.MlocusPop(self.diploids, self.gametes, self.mutations) - self.assertTrue(pop.N, 1) + self.assertEqual(pop.N, 1) + self.assertEqual(pop.nloci, 2) def testStaticMethod(self): pop = fwdpy11.MlocusPop.create(
test that MlocusPop.nloci is assigned
molpopgen_fwdpy11
train
py
f2467b147f54392ad88ee9d1c74c9880c6e364be
diff --git a/js/language/c.js b/js/language/c.js index <HASH>..<HASH> 100644 --- a/js/language/c.js +++ b/js/language/c.js @@ -50,13 +50,13 @@ Rainbow.extend('c', [ 3: 'storage.type', 4: 'entity.name.function' }, - 'pattern': /\b((un)?signed|const)?\s?(void|char|short|int|long|float|double)\*?\s+((\w+)(?=\())?/g + 'pattern': /\b((un)?signed|const)?\s?(void|char|short|int|long|float|double)\*?\s+((\w+)(?=\s?\())?/g }, { 'matches': { 2: 'entity.name.function' }, - 'pattern': /(\w|\*)(\s(\w+)(?=\())?/g + 'pattern': /(\w|\*)(\s(\w+)(?=\s?\())?/g }, { 'name': 'storage.modifier',
Add support for functions with spaces before the parenthesis
ccampbell_rainbow
train
js
a3de38200301f510eeb1d6628539e9110213f8ea
diff --git a/spec/functional/resource/deploy_revision_spec.rb b/spec/functional/resource/deploy_revision_spec.rb index <HASH>..<HASH> 100644 --- a/spec/functional/resource/deploy_revision_spec.rb +++ b/spec/functional/resource/deploy_revision_spec.rb @@ -42,14 +42,16 @@ describe Chef::Resource::DeployRevision, :unix_only => true do FileUtils.remove_entry_secure observe_order_file end - ohai = Ohai::System.new - ohai.require_plugin("os") + before(:all) do + @ohai = Ohai::System.new + @ohai.require_plugin("os") + end let(:node) do Chef::Node.new.tap do |n| n.name "rspec-test" - n.consume_external_attrs(ohai.data, {}) + n.consume_external_attrs(@ohai.data, {}) end end
[OC-<I>] move ohai into before(:all) in deploy_rev test
chef_chef
train
rb
07eff12b72a3467275781ecb6687145262280be5
diff --git a/complexity.go b/complexity.go index <HASH>..<HASH> 100644 --- a/complexity.go +++ b/complexity.go @@ -14,7 +14,9 @@ import ( // Complexity calculates the cyclomatic complexity of a function. // The 'fn' node is either a *ast.FuncDecl or a *ast.FuncLit. func Complexity(fn ast.Node) int { - v := complexityVisitor{} + v := complexityVisitor{ + complexity: 1, + } ast.Walk(&v, fn) return v.complexity } @@ -27,7 +29,7 @@ type complexityVisitor struct { // Visit implements the ast.Visitor interface. func (v *complexityVisitor) Visit(n ast.Node) ast.Visitor { switch n := n.(type) { - case *ast.FuncDecl, *ast.IfStmt, *ast.ForStmt, *ast.RangeStmt: + case *ast.IfStmt, *ast.ForStmt, *ast.RangeStmt: v.complexity++ case *ast.CaseClause: if n.List != nil { // ignore default case
Fix cyclomatic complexity for function literals
fzipp_gocyclo
train
go
1365a8584e3349fb4539143d3f10316946a54fbb
diff --git a/lib/gclitest/index.js b/lib/gclitest/index.js index <HASH>..<HASH> 100644 --- a/lib/gclitest/index.js +++ b/lib/gclitest/index.js @@ -114,6 +114,8 @@ exports.createDisplay = function(options) { var options = { window: window, display: window.display, + isNode: false, + isFirefox: false, isPhantomjs: isPhantomjs, isHttp: window.location.protocol === 'http:', hideExec: true diff --git a/lib/server/commands/test.js b/lib/server/commands/test.js index <HASH>..<HASH> 100644 --- a/lib/server/commands/test.js +++ b/lib/server/commands/test.js @@ -64,6 +64,9 @@ exports.items = [ display: window.display, isNode: true, isJsdom: true, + isHttp: false, + isFirefox: false, + isPhantomjs: false, isUnamdized: main.useUnamd }; helpers.resetResponseTimes();
refactor-<I>: Clearer flags for tests Be clearer about what environment we are running in by explicitly setting isNode, isFirefox, etc.
joewalker_gcli
train
js,js
a0aa3d602337de804f2dc85fc9d86767fac7e294
diff --git a/src/Repo/Data/Entity/Retro/Downline/Compressed/Phase1.php b/src/Repo/Data/Entity/Retro/Downline/Compressed/Phase1.php index <HASH>..<HASH> 100644 --- a/src/Repo/Data/Entity/Retro/Downline/Compressed/Phase1.php +++ b/src/Repo/Data/Entity/Retro/Downline/Compressed/Phase1.php @@ -9,6 +9,7 @@ namespace Praxigento\BonusHybrid\Repo\Data\Entity\Retro\Downline\Compressed; * Retrospective Downline Tree that is Compressed in Phase 1 */ class Phase1 + extends \Praxigento\Core\Data\Entity\Base { const ATTR_CALC_ID = 'calc_id'; const ATTR_CUSTOMER_ID = 'customer_ref'; @@ -19,4 +20,10 @@ class Phase1 const ATTR_PV = 'pv'; const ATTR_TV = 'tv'; const ENTITY_NAME = 'prxgt_bon_hyb_retro_cmprs_phase1'; + + public function getPrimaryKeyAttrs() + { + $result = [self::ATTR_CALC_ID, self::ATTR_CUSTOMER_ID]; + return $result; + } } \ No newline at end of file
MOBI-<I> - Repositories and queries
praxigento_mobi_mod_bonus_hybrid
train
php
0f47d74fded7950b2f2a9a8ef04acf7936555e6f
diff --git a/agreement.rb b/agreement.rb index <HASH>..<HASH> 100644 --- a/agreement.rb +++ b/agreement.rb @@ -7,7 +7,8 @@ module TicketSharing attr_accessor :direction, :remote_url def initialize(attrs = {}) - self.direction = attrs['direction'] if attrs['direction'] + self.direction = attrs['direction'] if attrs['direction'] + self.remote_url = attrs['remote_url'] if attrs['remote_url'] end def self.parse(json) @@ -21,7 +22,6 @@ module TicketSharing end def send_to_partner - # Client API subject to change. client = Client.new(remote_url) client.post('/agreements', self.to_json) end
Connecting the Sharing::Agreement dots. An api request is successfully sent after a Sharing::Agreement is created! * Connecting the front end to the back end * Cleaning up errors * Adding some more test coverage * Making the UI reflect the mockups a bit more * Adding some missing pieces
zendesk_ticket_sharing
train
rb
95fbd025451138f414e916f0f90dfe5503c4be8a
diff --git a/Resources/public/Admin.js b/Resources/public/Admin.js index <HASH>..<HASH> 100644 --- a/Resources/public/Admin.js +++ b/Resources/public/Admin.js @@ -114,7 +114,7 @@ var Admin = { jQuery("input[type='checkbox']:not('label.btn>input'), input[type='radio']:not('label.btn>input')", subject).iCheck({ checkboxClass: 'icheckbox_square-blue', - radioClass: 'iradio_sqaure-blue' + radioClass: 'iradio_square-blue' }); } },
typo fix in css class name
sonata-project_SonataAdminBundle
train
js
4b4f7df01c8fdcc7adf6d4f63581ed15a36c0141
diff --git a/spec/functional/callbacks_spec.rb b/spec/functional/callbacks_spec.rb index <HASH>..<HASH> 100644 --- a/spec/functional/callbacks_spec.rb +++ b/spec/functional/callbacks_spec.rb @@ -156,6 +156,20 @@ describe "Callbacks" do end end + context "By default" do + it "should not run callbacks when no callbacks were explicitly defined" do + EDoc { key :name, String }.embedded_callbacks_off?.should == true + end + + it "should run callbacks when a callback was explicitly defined" do + EDoc { + key :name, String + before_save :no_op + def noop; end + }.embedded_callbacks_on?.should == true + end + end + context "Turning embedded callbacks off" do before do @root_class = Doc { include CallbacksSupport; embedded_callbacks_off } @@ -164,9 +178,6 @@ describe "Callbacks" do @root_class.many :children, :class => @child_class @child_class.many :children, :class => @grand_child_class - - @root_class.many :children, :class => @child_class - @child_class.many :children, :class => @grand_child_class end it "should not run create callbacks" do
Add specs for embedded callback deferral
mongomapper_mongomapper
train
rb
0af8be35bb9d29e29f2a3af3acf9a65fd41ef7df
diff --git a/api/handler/api/util.go b/api/handler/api/util.go index <HASH>..<HASH> 100644 --- a/api/handler/api/util.go +++ b/api/handler/api/util.go @@ -29,16 +29,20 @@ func requestToProto(r *http.Request) (*api.Request, error) { ct, _, err := mime.ParseMediaType(r.Header.Get("Content-Type")) if err != nil { - ct = "application/x-www-form-urlencoded" + ct = "text/plain; charset=UTF-8" //default CT is text/plain r.Header.Set("Content-Type", ct) } - switch ct { - case "application/x-www-form-urlencoded": - // expect form vals - default: - data, _ := ioutil.ReadAll(r.Body) - req.Body = string(data) + //set the body: + if r.Body != nil { + switch ct { + case "application/x-www-form-urlencoded": + // expect form vals in Post data + default: + + data, _ := ioutil.ReadAll(r.Body) + req.Body = string(data) + } } // Set X-Forwarded-For if it does not exist
-bugfix #<I> set body corretly in case of missing content-type (#<I>)
micro_go-micro
train
go
5f65e3c4d96435d505e38134d8a580dc990f1fa8
diff --git a/django_plotly_dash/__init__.py b/django_plotly_dash/__init__.py index <HASH>..<HASH> 100644 --- a/django_plotly_dash/__init__.py +++ b/django_plotly_dash/__init__.py @@ -26,6 +26,6 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ''' -__version__ = "0.7.0" +__version__ = "0.8.0" from .dash_wrapper import DjangoDash
Update version to prerelease <I> (#<I>)
GibbsConsulting_django-plotly-dash
train
py
9af90ea698698b3b4a89b30a4bec8161b6558690
diff --git a/src/ValuSo/Annotation/AnnotationBuilder.php b/src/ValuSo/Annotation/AnnotationBuilder.php index <HASH>..<HASH> 100644 --- a/src/ValuSo/Annotation/AnnotationBuilder.php +++ b/src/ValuSo/Annotation/AnnotationBuilder.php @@ -237,8 +237,9 @@ class AnnotationBuilder implements EventManagerAwareInterface protected function configureOperation(AnnotationCollection $annotations, MethodReflection $method, ArrayObject $serviceSpec) { - // Skip if no annotations are present - if (!$annotations->count()) { + // Skip if no annotations are present and operations + // has previously been configured + if (!$annotations->count() && isset($serviceSpec['operations'][$method->getName()])) { return; }
Fixes issue, where operation wasn't parsed if it wasn't annotated
valu-digital_valuso
train
php
583b2438d9531ef85f882ddf9f90ba71ea2e06da
diff --git a/pipes/iam/__main__.py b/pipes/iam/__main__.py index <HASH>..<HASH> 100644 --- a/pipes/iam/__main__.py +++ b/pipes/iam/__main__.py @@ -20,7 +20,7 @@ def main(): help='Set DEBUG output') parser.add_argument('-e', '--env', - choices=('build', 'dev', 'stage', 'prod'), + choices=('build', 'dev', 'stage', 'prod', 'sox', 'pci'), default='dev', help='Deploy environment') parser.add_argument('-a',
fix: Add environments for IAM See also: PSOBAT-<I>
foremast_foremast
train
py
fa7aebba7742ecb0b0e05855e320c1c31cfbce2d
diff --git a/src/plugins/Entity/Entity.Controller.js b/src/plugins/Entity/Entity.Controller.js index <HASH>..<HASH> 100644 --- a/src/plugins/Entity/Entity.Controller.js +++ b/src/plugins/Entity/Entity.Controller.js @@ -159,7 +159,6 @@ Entity.Controller = meta.Controller.extend // Force update hover if is needed. if(this._flags & this.Flag.UPDATE_HOVER) { - console.log("update_hover"); this._checkHover(Input.ctrl.getEvent()); this._flags &= ~this.Flag.UPDATE_HOVER; }
Re: Update hover when new entity is added.
tenjou_meta2d
train
js
5ca283c72c037126ab7136941cc84b1e24cb8c72
diff --git a/test/libwebsocket/test_url.rb b/test/libwebsocket/test_url.rb index <HASH>..<HASH> 100644 --- a/test/libwebsocket/test_url.rb +++ b/test/libwebsocket/test_url.rb @@ -4,6 +4,12 @@ class TestURL < Test::Unit::TestCase def test_parse url = LibWebSocket::URL.new + assert url.parse('ws://example.com') + assert !url.secure + assert_equal 'example.com', url.host + assert_equal '/', url.resource_name + + url = LibWebSocket::URL.new assert url.parse('ws://example.com/') assert !url.secure assert_equal 'example.com', url.host
Test also URL without trailing slash
imanel_libwebsocket
train
rb
6f409b3237058e7c71f2e558764dc5b9d928b1e2
diff --git a/spec/pro_motion/data_table_screen_spec.rb b/spec/pro_motion/data_table_screen_spec.rb index <HASH>..<HASH> 100644 --- a/spec/pro_motion/data_table_screen_spec.rb +++ b/spec/pro_motion/data_table_screen_spec.rb @@ -1,6 +1,5 @@ -include ContributorsModule - describe 'DataTableScreen' do + extend ContributorsModule class TestDataTableScreen < ProMotion::DataTableScreen model Contributor
Specs require an extend, not an include
infinitered_redpotion
train
rb
790fba9a5f421a5ff532283382b5603763b330cc
diff --git a/packages/react-scripts/scripts/start.js b/packages/react-scripts/scripts/start.js index <HASH>..<HASH> 100644 --- a/packages/react-scripts/scripts/start.js +++ b/packages/react-scripts/scripts/start.js @@ -171,7 +171,6 @@ checkBrowsers(paths.appPath, isInteractive) devServer.close(); process.exit(); }); - process.stdin.resume(); } }) .catch(err => {
Skip stdin resuming to support lerna parallel (#<I>)
facebook_create-react-app
train
js
ef4a59b46ab8636a2e5fef8b1404fbda01a465e4
diff --git a/spec/phone_spec/app/spec_runner.rb b/spec/phone_spec/app/spec_runner.rb index <HASH>..<HASH> 100644 --- a/spec/phone_spec/app/spec_runner.rb +++ b/spec/phone_spec/app/spec_runner.rb @@ -64,7 +64,9 @@ if !defined?(RHO_WP7) && !(System.get_property('platform') == 'Blackberry' && (S config[:files] << "spec/uri_spec" end +if !defined?(RHO_WP7) && !defined?( RHO_ME ) config[:files] << "spec/database_spec" +end end
bb: fix phone_spec
rhomobile_rhodes
train
rb