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
344404fb3eaeb9b602a04c2056e8123014457831
diff --git a/indra/db/__init__.py b/indra/db/__init__.py index <HASH>..<HASH> 100644 --- a/indra/db/__init__.py +++ b/indra/db/__init__.py @@ -218,8 +218,8 @@ class DatabaseManager(object): ForeignKey('statements.id'), nullable=False) statements = relationship(Statements) - db_name = Column(String(20), nullable=False) - db_id = Column(String(20), nullable=False) + db_name = Column(String(40), nullable=False) + db_id = Column(String(40), nullable=False) role = Column(String(20), nullable=False) self.tables = {}
Lengthen agent db_name and db_id columns.
sorgerlab_indra
train
py
20d25f60d5aba9915c0b3755a783838d8e276041
diff --git a/index.js b/index.js index <HASH>..<HASH> 100644 --- a/index.js +++ b/index.js @@ -15,7 +15,7 @@ var AUTH_ENDPOINT = 'https://login.salesforce.com/services/oauth2/authorize var TEST_AUTH_ENDPOINT = 'https://test.salesforce.com/services/oauth2/authorize'; var LOGIN_URI = 'https://login.salesforce.com/services/oauth2/token'; var TEST_LOGIN_URI = 'https://test.salesforce.com/services/oauth2/token'; -var API_VERSIONS = ['v20.0', 'v21.0', 'v22.0', 'v23.0', 'v24.0', 'v25.0', 'v26.0', 'v27.0', 'v28.0']; +var API_VERSIONS = ['v20.0', 'v21.0', 'v22.0', 'v23.0', 'v24.0', 'v25.0', 'v26.0', 'v27.0', 'v28.0', 'v29.0']; // nforce connection object
Updates available API version to include <I>
heroku_force.js
train
js
400c13ce755cea90c2fdaea65ab53c38ee0fc014
diff --git a/openhtf/plugs/__init__.py b/openhtf/plugs/__init__.py index <HASH>..<HASH> 100644 --- a/openhtf/plugs/__init__.py +++ b/openhtf/plugs/__init__.py @@ -426,9 +426,10 @@ class PlugManager(object): self._plug_types.add(plug_type) if plug_type in self._plugs_by_type: self._plugs_by_type[plug_type].tearDown() + plug_name = self.get_plug_name(plug_type) self._plugs_by_type[plug_type] = plug_value - self._plugs_by_name[self.get_plug_name(plug_type)] = plug_value - self._plug_descriptors[plug_type] = self._make_plug_descriptor(plug_type) + self._plugs_by_name[plug_name] = plug_value + self._plug_descriptors[plug_name] = self._make_plug_descriptor(plug_type) def provide_plugs(self, plug_name_map): """Provide the requested plugs [(name, type),] as {name: plug instance}."""
Fix bug: plug class can't be serialized
google_openhtf
train
py
93d59805ee08d1a723588ae3d441ee91de66c9cc
diff --git a/lib/flame/controller.rb b/lib/flame/controller.rb index <HASH>..<HASH> 100644 --- a/lib/flame/controller.rb +++ b/lib/flame/controller.rb @@ -121,8 +121,7 @@ module Flame ## Execute the method of the controller with hooks (may be overloaded) ## @param method [Symbol] name of the controller method def execute(method) - # send method - body send(method, *extract_params_for(method).values) + body send(method, *extract_params_for(method)) end ## Default method for Internal Server Error, can be inherited @@ -148,12 +147,18 @@ module Flame end def extract_params_for(action) - # p action, params, parameters - method(action).parameters.each_with_object({}) do |parameter, result| - key = parameter.last - next if params[key].nil? - result[key] = params[key] + # Take parameters from action method + parameters = method(action).parameters + # Fill variables with values from params + req_values, opt_values = %i[req opt].map! do |type| + params.values_at( + *parameters.select { |key, _value| key == type }.map!(&:last) + ) end + # Remove nils from the end of optional values + opt_values.pop while opt_values.last.nil? && !opt_values.empty? + # Concat values + req_values + opt_values end def add_controller_class(args)
Improve `Controller#extract_params_for` method
AlexWayfer_flame
train
rb
6845b8b5a6549a490dd61594cb439583bc67327c
diff --git a/nvr/nvr.py b/nvr/nvr.py index <HASH>..<HASH> 100644 --- a/nvr/nvr.py +++ b/nvr/nvr.py @@ -100,6 +100,10 @@ class Neovim(): if not self.is_attached(silent): return + modified = self.server.current.buffer.options['modified'] + if modified: + self.server.current.buffer.options['modified'] = False + cmds, files = split_cmds_from_files(arguments) for fname in files: @@ -126,6 +130,9 @@ class Neovim(): for cmd in cmds: self.server.command(cmd if cmd else '$') + if modified: + self.server.current.buffer.options['modified'] = True + return len(files) def _show_msg(self, old_address): diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -18,7 +18,7 @@ setup( 'console_scripts': ['nvr = nvr.nvr:main'] }, packages = ['nvr'], - version = '1.8.0', + version = '1.8.1', license = 'MIT', keywords = 'neovim nvim nvr remote helper', classifiers = [
Temporarily reset &modified when opening files :edit and similar commands used by the --remote* options throw an exception if the buffer is modified: E<I>: No write since last change (add ! to override) Using :enew! doesn't work, since it reverts all changes. Thus we simply reset &modified temporarily. References <URL>
mhinz_neovim-remote
train
py,py
7cc8a68d922e11b6168032b44ad70ac0c1df8749
diff --git a/src/address-edit/index.js b/src/address-edit/index.js index <HASH>..<HASH> 100644 --- a/src/address-edit/index.js +++ b/src/address-edit/index.js @@ -113,6 +113,12 @@ export default createComponent({ } return ''; }, + + // hide bottom field when use search && detail get focused + hideBottomFields() { + const { searchResult } = this; + return searchResult && searchResult.length && this.detailFocused; + }, }, watch: { @@ -290,13 +296,9 @@ export default createComponent({ }, render(h) { - const { data, errorInfo, searchResult, disableArea } = this; + const { data, errorInfo, disableArea, hideBottomFields } = this; const onFocus = (name) => () => this.onFocus(name); - // hide bottom field when use search && detail get focused - const hideBottomFields = - searchResult && searchResult.length && this.detailFocused; - return ( <div class={bem()}> <div class={bem('fields')}>
fix(AddressEdit): incorrect bottom fields when get focused
youzan_vant
train
js
e8057934a201af05a70f7bd6f1fd4ec9124ba4e7
diff --git a/core/src/main/java/me/prettyprint/cassandra/model/MutatorImpl.java b/core/src/main/java/me/prettyprint/cassandra/model/MutatorImpl.java index <HASH>..<HASH> 100644 --- a/core/src/main/java/me/prettyprint/cassandra/model/MutatorImpl.java +++ b/core/src/main/java/me/prettyprint/cassandra/model/MutatorImpl.java @@ -69,6 +69,14 @@ public final class MutatorImpl<K> implements Mutator<K> { addDeletion(key, cf, columnName, nameSerializer); return execute(); } + + @Override + public <N> MutationResult delete(K key, String cf, N columnName, + Serializer<N> nameSerializer, long clock) { + addDeletion(key, cf, columnName, nameSerializer, clock); + return execute(); + } + /** * Deletes a subcolumn of a supercolumn @@ -86,7 +94,7 @@ public final class MutatorImpl<K> implements Mutator<K> { return null; } })); - } + } /** * Deletes the columns defined in the HSuperColumn. If there are no HColumns attached,
add overloaded version of delete for taking a clock
hector-client_hector
train
java
73ddf6f83890b1504dd6c420f047d807761547f6
diff --git a/Bundle/BlogBundle/Controller/ArticleController.php b/Bundle/BlogBundle/Controller/ArticleController.php index <HASH>..<HASH> 100644 --- a/Bundle/BlogBundle/Controller/ArticleController.php +++ b/Bundle/BlogBundle/Controller/ArticleController.php @@ -150,15 +150,15 @@ class ArticleController extends Controller $em->persist($tag); } } - $businessPage->setTemplate($article->getTemplate()); - - $em->flush(); - $template = $article->getTemplate(); + $businessPage->setTemplate($template); $page = $pageHelper->findPageByParameters([ 'viewId' => $template->getId(), 'entityId' => $article->getId(), ]); + $page->setStatus($article->getStatus()); + + $em->flush(); $response = [ 'success' => true,
On article update, change status of its page too.
Victoire_victoire
train
php
b6990c7c13b25a41f4d78de875533abbef634071
diff --git a/Controller/ConfiguratorController.php b/Controller/ConfiguratorController.php index <HASH>..<HASH> 100644 --- a/Controller/ConfiguratorController.php +++ b/Controller/ConfiguratorController.php @@ -60,21 +60,9 @@ class ConfiguratorController extends ContainerAware { $configurator = $this->container->get('sensio.distribution.webconfigurator'); - $steps = $configurator->getSteps(); - - $majors = array(); - $minors = array(); - // Trying to get as much requirements as possible - foreach ($steps as $step) { - foreach ($step->checkRequirements() as $major) { - $majors[] = $major; - } - - foreach ($step->checkOptionalSettings() as $minor) { - $minors[] = $minor; - } - } + $majors = $configurator->getRequirements(); + $minors = $configurator->getOptionalSettings(); $url = $this->container->get('router')->generate('_configurator_step', array('index' => 0));
[Controller] refactored the controller class to take benefit from the new methods in the Configurator class.
sensiolabs_SensioDistributionBundle
train
php
481a4b0f1be05d82833505a1ebcc6d37480263a3
diff --git a/src/app/features/dashboard/unsavedChangesSrv.js b/src/app/features/dashboard/unsavedChangesSrv.js index <HASH>..<HASH> 100644 --- a/src/app/features/dashboard/unsavedChangesSrv.js +++ b/src/app/features/dashboard/unsavedChangesSrv.js @@ -88,8 +88,11 @@ function(angular, _, config) { _.each(current.templating.list, function(value, index) { value.current = null; value.options = null; - original.templating.list[index].current = null; - original.templating.list[index].options = null; + + if (original.templating.list.length > index) { + original.templating.list[index].current = null; + original.templating.list[index].options = null; + } }); var currentTimepicker = _.findWhere(current.nav, { type: 'timepicker' });
Small fix to unsavedChangesSrv, did not handle new template variable correctly
grafana_grafana
train
js
af7d818beb8485ff5334ab6e8c987e3e14075121
diff --git a/pmagpy/pmagplotlib.py b/pmagpy/pmagplotlib.py index <HASH>..<HASH> 100644 --- a/pmagpy/pmagplotlib.py +++ b/pmagpy/pmagplotlib.py @@ -31,6 +31,19 @@ version_num = pmag.get_version() # matplotlib.ticker_Formatter.xaxis.set_powerlimits((-3,4)) # matplotlib.ticker_Formatter.yaxis.set_powerlimits((-3,4)) +import matplotlib + +# matplotlib >= 2.1 not yet available for Canopy (also not default with anaconda) +if matplotlib.__version__ < '2.1': + print("""-W- Please upgrade to matplotlib >= 2.1 + On the command line, for Anaconda users: + conda upgrade matplotlib + For those with an alternative Python distribution: + pip install matplotlib --upgrade +""") +# For users with Canopy Python, you can open the installed Canopy program to# update packages. + + def poly(X, Y, deg): return pylab.polyfit(X, Y, deg)
Add upgrade warning for matplotlib to pmagplotlib
PmagPy_PmagPy
train
py
ccf51bde374f744cbc3c8b7c514ad3fe1cd2217e
diff --git a/src/Engine/AlgoliaEngine.php b/src/Engine/AlgoliaEngine.php index <HASH>..<HASH> 100644 --- a/src/Engine/AlgoliaEngine.php +++ b/src/Engine/AlgoliaEngine.php @@ -40,7 +40,7 @@ class AlgoliaEngine implements EngineInterface public function remove($searchableEntities) { - if ($searchableEntities instanceof SearchableEntityInterface) { + if ($searchableEntities instanceof SearchableEntityInterface && !empty($searchableEntities->getSearchableArray())) { return [ $searchableEntities->getIndexName() => $this->algolia ->initIndex($searchableEntities->getIndexName()) @@ -96,6 +96,7 @@ class AlgoliaEngine implements EngineInterface if (empty($entity->getSearchableArray())) { break; } + $indexName = $entity->getIndexName(); if (! isset($data[$indexName])) { @@ -121,6 +122,9 @@ class AlgoliaEngine implements EngineInterface { $data = []; foreach ($searchableEntities as $entity) { + if (empty($entity->getSearchableArray())) { + break; + } $indexName = $entity->getIndexName(); if (! isset($data[$indexName])) {
Do not index the hit when an empty array is returned from normalizer
algolia_search-bundle
train
php
9cae4598f1d93056c1cc92c5e4c4bfceda885755
diff --git a/src/livestreamer/plugins/freedocast.py b/src/livestreamer/plugins/freedocast.py index <HASH>..<HASH> 100644 --- a/src/livestreamer/plugins/freedocast.py +++ b/src/livestreamer/plugins/freedocast.py @@ -1,7 +1,7 @@ -from livestreamer.exceptions import PluginError, NoStreamsError +from livestreamer.exceptions import NoStreamsError from livestreamer.plugin import Plugin +from livestreamer.plugin.api import http from livestreamer.stream import RTMPStream -from livestreamer.utils import urlget import re @@ -15,7 +15,7 @@ class Freedocast(Plugin): def _get_streams(self): self.logger.debug("Fetching stream info") - res = urlget(self.url) + res = http.get(self.url) match = re.search("\"User_channelid\".+?value=\"(.+?)\"", res.text) if not match: @@ -25,7 +25,7 @@ class Freedocast(Plugin): "Referer": self.url } - res = urlget(self.PlayerURL.format(match.group(1)), headers=headers) + res = http.get(self.PlayerURL.format(match.group(1)), headers=headers) match = re.search("stream:\s+'(rtmp://.+?)'", res.text) if not match:
plugins.freedocast: Update to use new HTTP APIs.
streamlink_streamlink
train
py
64a715750d393994b3409ea38932925fc6cd2d58
diff --git a/NavigationReactNative/sample/zoom/Grid.js b/NavigationReactNative/sample/zoom/Grid.js index <HASH>..<HASH> 100644 --- a/NavigationReactNative/sample/zoom/Grid.js +++ b/NavigationReactNative/sample/zoom/Grid.js @@ -24,9 +24,7 @@ export default () => ( }); }}> <SharedElementAndroid name={color} style={{flex: 1}}> - <View style={[styles.box, {backgroundColor: color}]}> - <Text style={styles.text}>{color}</Text> - </View> + <View style={{backgroundColor: color, flex: 1}} /> </SharedElementAndroid> </TouchableHighlight> ))} @@ -50,15 +48,4 @@ const styles = StyleSheet.create({ marginRight: 10, marginBottom: 20, }, - box: { - flex: 1, - justifyContent: 'center' - }, - text: { - color: '#fff', - fontSize: 20, - lineHeight: 20, - textAlign: 'center', - fontWeight: 'bold', - } }); \ No newline at end of file
Removed text because doesn't zoom Sharing text elements of different font-sizes doesn't work well
grahammendick_navigation
train
js
74c5db80fc2fb93dd34660eebda0e35377235153
diff --git a/src/main/java/org/sameas/sameas4j/core/Equivalence.java b/src/main/java/org/sameas/sameas4j/core/Equivalence.java index <HASH>..<HASH> 100644 --- a/src/main/java/org/sameas/sameas4j/core/Equivalence.java +++ b/src/main/java/org/sameas/sameas4j/core/Equivalence.java @@ -1,6 +1,7 @@ package org.sameas.sameas4j.core; import java.net.URI; +import java.util.Collections; import java.util.HashSet; import java.util.Set; @@ -36,7 +37,7 @@ public class Equivalence { } public Set<URI> getDuplicates() { - return this.duplicates; + return Collections.unmodifiableSet(this.duplicates); } public void addDuplicate(URI uri) {
the returned duplicates URI set was exposed to external modifications git-svn-id: <URL>
99soft_sameas4j
train
java
fdb3eca3cb9be66f6d95fe93b33762d4c651d623
diff --git a/estnltk/converters/dict_exporter.py b/estnltk/converters/dict_exporter.py index <HASH>..<HASH> 100644 --- a/estnltk/converters/dict_exporter.py +++ b/estnltk/converters/dict_exporter.py @@ -10,8 +10,10 @@ def layer_to_dict(layer, text): if layer.parent: parent_spanlist = text[layer._base].spans records = layer.to_records() + last_index = 0 for span, record in zip(layer, records): - index = parent_spanlist.index(span) + index = parent_spanlist.index(span, last_index) + last_index = index if layer.ambiguous: for rec in record: rec['_index_'] = index @@ -22,8 +24,10 @@ def layer_to_dict(layer, text): enveloped_spanlist = text[layer.enveloping].spans records = [] + last_index = 0 for spanlist in layer: - index = [enveloped_spanlist.index(span) for span in spanlist] + index = [enveloped_spanlist.index(span, last_index) for span in spanlist] + last_index = index[0] if layer.ambiguous: pass # TODO: @@ -34,7 +38,7 @@ def layer_to_dict(layer, text): layer_dict['spans'] = records else: layer_dict['spans'] = layer.to_records() - + return layer_dict
dict_exporter performance improvement
estnltk_estnltk
train
py
4386f0ed5b3af39abcc09a4f47ccd2b5d0b0a2d8
diff --git a/src/Helpers/functions.php b/src/Helpers/functions.php index <HASH>..<HASH> 100644 --- a/src/Helpers/functions.php +++ b/src/Helpers/functions.php @@ -263,7 +263,7 @@ function countries() */ function subdivisions($country) { - $subdivisions = json_decode(file_get_contents("../resources/subdivisions.json"),true); + $subdivisions = json_decode(file_get_contents(__DIR__ . "/../resources/subdivisions.json"),true); if (!isset($subdivisions[$country])) { throw new InvalidArgumentException($country . " is not a valid country code.");
Fix relative path for subdivisions.json
SonarSoftware_customer_portal_framework
train
php
482d066bdb32fc376f5bb178b0a71c86e2ec0866
diff --git a/app/models/manager_refresh/save_collection/saver/sql_helper.rb b/app/models/manager_refresh/save_collection/saver/sql_helper.rb index <HASH>..<HASH> 100644 --- a/app/models/manager_refresh/save_collection/saver/sql_helper.rb +++ b/app/models/manager_refresh/save_collection/saver/sql_helper.rb @@ -59,11 +59,13 @@ module ManagerRefresh::SaveCollection def build_update_query(inventory_collection, all_attribute_keys, hashes) all_attribute_keys_array = all_attribute_keys.to_a.delete_if { |x| %i(type).include?(x) } table_name = inventory_collection.model_class.table_name + used_unique_index_keys = inventory_collection.unique_index_columns & all_attribute_keys.to_a + values = hashes.map do |hash| "(#{all_attribute_keys_array.map { |x| quote(hash[x], x, inventory_collection) }.join(",")})" end.join(",") - where_cond = inventory_collection.unique_index_columns.map do |x| + where_cond = used_unique_index_keys.map do |x| "updated_values.#{quote_column_name(x)} = #{table_name}.#{quote_column_name(x)}" end.join(" AND ")
Work with only used unique keys Work with only used unique keys, since each provider can use only a subset of the unique keys. (transferred from ManageIQ/manageiq@<I>f<I>b<I>ce7a<I>b<I>ee<I>d)
ManageIQ_inventory_refresh
train
rb
97067cbd7c243cd71d39e327f56d9469b4145c99
diff --git a/lib/builder/xmlbase.rb b/lib/builder/xmlbase.rb index <HASH>..<HASH> 100644 --- a/lib/builder/xmlbase.rb +++ b/lib/builder/xmlbase.rb @@ -132,7 +132,11 @@ module Builder end else def _escape(text) - text.to_xs((@encoding != 'utf-8' or $KCODE != 'UTF8')) + if (text.method(:to_xs).arity == 0) + text.to_xs + else + text.to_xs((@encoding != 'utf-8' or $KCODE != 'UTF8')) + end end end
Applied arity patch for to_xs Needed for weird compatibility issues with Rails.
jimweirich_builder
train
rb
9022661d262f73b258af4765a87721ee04c22dd9
diff --git a/src/Behat/Mink/Behat/Context/PageContext.php b/src/Behat/Mink/Behat/Context/PageContext.php index <HASH>..<HASH> 100644 --- a/src/Behat/Mink/Behat/Context/PageContext.php +++ b/src/Behat/Mink/Behat/Context/PageContext.php @@ -53,7 +53,7 @@ class PageContext extends ActionsContext throw new ElementNotFoundException('element', $element); } - assertContains($value, preg_replace('/\s+/', ' ', str_replace("\n", '', $node->getText()))); + assertContains($value, preg_replace('/\s+/', ' ', str_replace("\n", '', $node->getPlainText()))); } /**
assert plain element content instead of full text
minkphp_Mink
train
php
f13e985a37d2183bd7e4778a2ca05d55745489fe
diff --git a/lib/tilejson.js b/lib/tilejson.js index <HASH>..<HASH> 100644 --- a/lib/tilejson.js +++ b/lib/tilejson.js @@ -110,6 +110,7 @@ TileJSON.registerProtocols = function(tilelive) { TileJSON.list = function(filepath, callback) { filepath = path.resolve(filepath); fs.readdir(filepath, function(err, files) { + if (err && err.code === 'ENOENT') return callback(null, {}); if (err) return callback(err); for (var result = {}, i = 0; i < files.length; i++) { var name = files[i].match(/^([\w-]+)\.tilejson$/);
Return empty hash from list if directory doesn't exist.
mapbox_node-tilejson
train
js
1c748b5f4955c527251ff782d91608d86a5d1af3
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -4,7 +4,7 @@ from setuptools import find_packages import time -_version = "0.1" +_version = "0.2.dev%s" % int(time.time()) _packages = find_packages(exclude=["*.tests", "*.tests.*", "tests.*", "tests"]) _short_description = "pylint-common is a Pylint plugin to improve Pylint error analysis of the" \
Bumping version to <I> in develop branch
landscapeio_pylint-common
train
py
7c9a08a122d146419c47709309dfbb5570e38188
diff --git a/webmap/models.py b/webmap/models.py index <HASH>..<HASH> 100644 --- a/webmap/models.py +++ b/webmap/models.py @@ -323,8 +323,8 @@ class MapPreset(models.Model): verbose_name=_(u"preset icon"), ) - def base_layer_names(self): - return [l.name for l in self.overlay_layers.all()] + def overlay_layers_slugs(self): + return [l.slug for l in self.overlay_layers.all()] @with_author
switch layers by slug, not by name
auto-mat_django-webmap-corpus
train
py
fc166c43560384d8dfbe02598825f1252d4b5039
diff --git a/inflect/__init__.py b/inflect/__init__.py index <HASH>..<HASH> 100644 --- a/inflect/__init__.py +++ b/inflect/__init__.py @@ -2455,6 +2455,18 @@ class engine: p:p - word1 and word2 are two different plural forms of the one word False - otherwise + >>> compare = engine().compare + >>> compare("egg", "eggs") + 's:p' + >>> compare('egg', 'egg') + 'eq' + + Words should not be empty. + + >>> compare('egg', '') # #157: # doctest: +SKIP + Traceback (most recent call last): + ... + ValueError: empty words not allowed """ norms = self.plural_noun, self.plural_verb, self.plural_adj results = (self._plequal(word1, word2, norm) for norm in norms)
Add doc test capturing expectation when an empty word is passed. Ref #<I>.
jazzband_inflect
train
py
020538689ea1e86978369f78d3664effd7454239
diff --git a/app/models/katello/concerns/organization_extensions.rb b/app/models/katello/concerns/organization_extensions.rb index <HASH>..<HASH> 100644 --- a/app/models/katello/concerns/organization_extensions.rb +++ b/app/models/katello/concerns/organization_extensions.rb @@ -32,6 +32,7 @@ module Katello has_many :org_tasks, :dependent => :destroy, :class_name => "Katello::TaskStatus", :inverse_of => :organization attr_accessor :statistics + attr_accessible :label scope :having_name_or_label, ->(name_or_label) { { :conditions => ["name = :id or label = :id", {:id => name_or_label}] } } scoped_search :on => :label, :complete_value => :true
Fixes #<I> - Add attr_accessible to Organization label for Rails 4 Multiple tests try to mass_assign :label by calling Organization.create!(:name => '', :label => ''), but that's not allowed with attr_accessible without explicitly marking it as allowed. See spec/models/pulp_task_status_spec.rb line <I> for an example. This depends on <URL>
Katello_katello
train
rb
3a5e7cba2742f897a2b49c8b64156d0f5338b2ed
diff --git a/index.js b/index.js index <HASH>..<HASH> 100644 --- a/index.js +++ b/index.js @@ -3,7 +3,7 @@ module.exports = compressible compressible.specs = compressible.specifications = require('./specifications.json') -compressible.regex +compressible.regex = compressible.regexp = /json|text|javascript|dart|ecmascript|xml/ function compressible(type) {
[fix] compressible.regex is now defined properly.
jshttp_compressible
train
js
528bd619468eea8f9336156f53bd9d80f171231b
diff --git a/src/fileLoaders.py b/src/fileLoaders.py index <HASH>..<HASH> 100644 --- a/src/fileLoaders.py +++ b/src/fileLoaders.py @@ -173,8 +173,9 @@ class LocalLoader(BaseLoader): return 'local-file-system' class ParamLoader(BaseLoader): - def __init__(self, query_urls): + def __init__(self, specUrl, query_urls): # Implement the list of queries with a list of dicts {'name', 'download_url'} + self.specUrl = specUrl self.query_urls = [] for q in query_urls: name = q.split('/')[-1] @@ -203,6 +204,9 @@ class ParamLoader(BaseLoader): else: return None + def getSpecUrl(self): + """ Returns the original spec URL""" + return self.specUrl def getRawRepoUri(self): """ Returns the root url of the remote repo"""
added specUrl getter
CLARIAH_grlc
train
py
d089c87c32b2e71257a59c3062e9eed3ad253244
diff --git a/demo/app.js b/demo/app.js index <HASH>..<HASH> 100644 --- a/demo/app.js +++ b/demo/app.js @@ -914,6 +914,7 @@ const Demo = React.createClass({ onDateSelect={this._handleDateRangeSelect} selectedEndDate={this.state.selectedEndDate} selectedStartDate={this.state.selectedStartDate} + showDefaultRanges={true} /> <br /><br />
Update demo app to use default ranges
mxenabled_mx-react-components
train
js
9fca39444716980b096bcd802c407770cadf5aca
diff --git a/lib/acts_as_paranoid/associations.rb b/lib/acts_as_paranoid/associations.rb index <HASH>..<HASH> 100644 --- a/lib/acts_as_paranoid/associations.rb +++ b/lib/acts_as_paranoid/associations.rb @@ -17,8 +17,8 @@ module ActsAsParanoid if with_deleted class_eval <<-RUBY, __FILE__, __LINE__ def #{target}_with_unscoped(*args) - return #{target}_without_unscoped(*args) unless #{result.klass}.paranoid? - #{result.klass}.unscoped { #{target}_without_unscoped(*args) } + return #{target}_without_unscoped(*args) unless association(:#{target}).klass.paranoid? + association(:#{target}).klass.with_deleted.merge(association(:#{target}).association_scope) end alias_method_chain :#{target}, :unscoped RUBY
belongs_to associations using the :with_deleted option will play nicely with other default scopes.
goncalossilva_acts_as_paranoid
train
rb
743a37bd1785bf24eeacf2ca391efcf042b8ffe4
diff --git a/src/ULogin/Init.php b/src/ULogin/Init.php index <HASH>..<HASH> 100644 --- a/src/ULogin/Init.php +++ b/src/ULogin/Init.php @@ -374,4 +374,4 @@ class Init } -} \ No newline at end of file +} diff --git a/src/ULogin/Parser.php b/src/ULogin/Parser.php index <HASH>..<HASH> 100644 --- a/src/ULogin/Parser.php +++ b/src/ULogin/Parser.php @@ -92,4 +92,4 @@ class Parser return $array; } -} \ No newline at end of file +}
Scrutinizer Auto-Fixes This commit consists of patches automatically generated for this project on <URL>
stanislav-web_phalcon-ulogin
train
php,php
5ea9c65a7aba47b0e2c0e5e942a195209d7d7191
diff --git a/lib/annotation.rb b/lib/annotation.rb index <HASH>..<HASH> 100644 --- a/lib/annotation.rb +++ b/lib/annotation.rb @@ -92,6 +92,7 @@ module Annotation end def self.extended(other) + super other.module_eval do #private #def method_added(method_name) ... end
change 'Annotation.extended()' to call super
kwatch_annotation
train
rb
f531e328ab6f2ae750e451ff4199b6fff4dcbf7d
diff --git a/web/dialect/dispatch.py b/web/dialect/dispatch.py index <HASH>..<HASH> 100755 --- a/web/dialect/dispatch.py +++ b/web/dialect/dispatch.py @@ -40,6 +40,9 @@ class ObjectDispatchDialect(object): log.debug(chunk=chunk, chunks=path) parent = current + if isclass(parent): + parent = parent(context) + # Security: prevent access to real private attributes. # This is tricky as we need to avoid __getattr__ behaviour. if chunk[0] == '_' and (hasattr(current.__class__, chunk) or chunk in current.__dict__):
Added parent node instantiation.
marrow_WebCore
train
py
608268a49a0495c6e9890fcb4980a23eaa19c69a
diff --git a/src/core/services/interimElement/interimElement.js b/src/core/services/interimElement/interimElement.js index <HASH>..<HASH> 100644 --- a/src/core/services/interimElement/interimElement.js +++ b/src/core/services/interimElement/interimElement.js @@ -603,19 +603,6 @@ function InterimElementProvider() { } }; - /** - * Replace `{{` and `}}` in a string (usually a template) with the actual start-/endSymbols used - * for interpolation. This allows pre-defined templates (for components such as dialog, toast etc) - * to continue to work in apps that use custom interpolation start-/endSymbols. - * - * @param {string} text The text in which to replace `{{` / `}}` - * @returns {string} The modified string using the actual interpolation start-/endSymbols - */ - function replaceInterpolationSymbols(text) { - if (!text || !angular.isString(text)) return text; - return text.replace(/\{\{/g, startSymbol).replace(/}}/g, endSymbol); - } - } }
removes unused function that was causing closure errors
angular_material
train
js
8b41166a7592a381acd38cf12871bddd7cdf864e
diff --git a/keyring/errors.py b/keyring/errors.py index <HASH>..<HASH> 100644 --- a/keyring/errors.py +++ b/keyring/errors.py @@ -27,7 +27,8 @@ class ExceptionRaisedContext(object): def __exit__(self, *exc_info): self.exc_info.__init__(*exc_info) - return issubclass(self.exc_info.type, self.ExpectedException) + return self.exc_info.type and issubclass( + self.exc_info.type, self.ExpectedException) class ExceptionInfo(object): def __init__(self, *info):
Fixed behavior when no exception was raised in ExceptionRaisedContext --HG-- branch : prioritized backends
jaraco_keyring
train
py
c7b118fc79e40f2136d727189f377da1cee1e237
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -38,6 +38,7 @@ distutils.core.setup( version=version, packages = ["tornado", "tornado.test"], package_data = { + "tornado": ["ca-certificates.crt"], "tornado.test": ["README", "test.crt", "test.key"], }, ext_modules = extensions,
Add ca-certificates.crt as a data file in setup.py
tornadoweb_tornado
train
py
3b83fac2125f2968e4a775b1ff609a6ef87f41fe
diff --git a/src/Neuron/Models/Helpers/Errorable.php b/src/Neuron/Models/Helpers/Errorable.php index <HASH>..<HASH> 100644 --- a/src/Neuron/Models/Helpers/Errorable.php +++ b/src/Neuron/Models/Helpers/Errorable.php @@ -32,6 +32,14 @@ abstract class Errorable } /** + * Set the error array. By reference! + * @param array $errors + */ + public function setErrors (array &$errors){ + $this->errors = $errors; + } + + /** * @return string|null */ public function getError ()
Adding setERrors to Errorable.
CatLabInteractive_Neuron
train
php
786dabbabc24c935e3da79ba570f45c9e9bada21
diff --git a/test/test_sg_postcode.rb b/test/test_sg_postcode.rb index <HASH>..<HASH> 100644 --- a/test/test_sg_postcode.rb +++ b/test/test_sg_postcode.rb @@ -10,4 +10,8 @@ class TestSgPostcode < Minitest::Test postcode_array = SgPostcode::Array.new([]) postcode_array.convert end + + def test_send_request + request = SgPostcode::LongLatConverter.place_info(nil) + end end
wip: add test for google service
ManagedApplicationServices_sg_postcode
train
rb
272b5dd1b2807acac229095d66f4312fe130ff2e
diff --git a/plugin/pkg/scheduler/factory/factory.go b/plugin/pkg/scheduler/factory/factory.go index <HASH>..<HASH> 100644 --- a/plugin/pkg/scheduler/factory/factory.go +++ b/plugin/pkg/scheduler/factory/factory.go @@ -80,12 +80,12 @@ type ConfigFactory struct { StopEverything chan struct{} informerFactory informers.SharedInformerFactory - scheduledPodPopulator *cache.Controller - nodePopulator *cache.Controller - pvPopulator *cache.Controller + scheduledPodPopulator cache.ControllerInterface + nodePopulator cache.ControllerInterface + pvPopulator cache.ControllerInterface pvcPopulator cache.ControllerInterface - servicePopulator *cache.Controller - controllerPopulator *cache.Controller + servicePopulator cache.ControllerInterface + controllerPopulator cache.ControllerInterface schedulerCache schedulercache.Cache
Use controller interface for everything in config factory
kubernetes_kubernetes
train
go
f2538fa09706bf24d4f43e7917b346876baa0cab
diff --git a/src/rez/packages.py b/src/rez/packages.py index <HASH>..<HASH> 100644 --- a/src/rez/packages.py +++ b/src/rez/packages.py @@ -36,6 +36,9 @@ def split_name(pkg_str, exact=False): def pkg_name(pkg_str): return pkg_str.split('-')[0] +def join_name(family_name, version): + return '%s-%s' % (family_name, version) + def iter_package_families(name=None, paths=None): """Iterate through top-level `PackageFamily` instances.""" if paths is None:
Provide packages.join_name() for creating a valid package name from a family name and a version.
nerdvegas_rez
train
py
f4a4edbcd491f30dd9e30755d8dad507b48ec54d
diff --git a/src/Model/Message/Attachment/Template/ButtonTemplate.php b/src/Model/Message/Attachment/Template/ButtonTemplate.php index <HASH>..<HASH> 100644 --- a/src/Model/Message/Attachment/Template/ButtonTemplate.php +++ b/src/Model/Message/Attachment/Template/ButtonTemplate.php @@ -30,7 +30,7 @@ class ButtonTemplate extends Template { parent::__construct(); - $this->isValidString($text, 320); + $this->isValidString($text, 640); $this->isValidArray($buttons, 3); $this->text = $text;
Update ButtonTemplate.php The 'button' template type takes up to <I> characters on the 'text' field but this class is limiting it to just <I>. Reference documentation: <URL>
ker0x_messenger
train
php
04e9376a5a65a4f02ae091ee55207b05f5cfe1eb
diff --git a/core/manifest/ManifestFileFinder.php b/core/manifest/ManifestFileFinder.php index <HASH>..<HASH> 100644 --- a/core/manifest/ManifestFileFinder.php +++ b/core/manifest/ManifestFileFinder.php @@ -22,7 +22,8 @@ class ManifestFileFinder extends SS_FileFinder { protected static $default_options = array( 'include_themes' => false, 'ignore_tests' => true, - 'min_depth' => 1 + 'min_depth' => 1, + 'ignore_dirs' => array('node_modules') ); public function acceptDir($basename, $pathname, $depth) {
Exclude node_modules from manifests Believe it or not, some node modules contain PHP files, which get included by default otherwise. This also fixes a performance regression on ?flush, the existence of node_modules will cause a lot of unneccesary file lookups.
silverstripe_silverstripe-framework
train
php
618671ecaf0fc03a3de4b6ae7b1a3018b379cbcc
diff --git a/browser.js b/browser.js index <HASH>..<HASH> 100644 --- a/browser.js +++ b/browser.js @@ -8,8 +8,10 @@ var CONTENT_TYPE_MAP = { module.exports = function (options, callback) { var timeout function done (err, res) { - if (err && !(err instanceof Error)) { - err = new Error('' + (err || 'Unknown XMLHttpRequest Error')) + if (err !== null) { + if (!(err instanceof Error)) { + err = new Error('' + (err || 'Unknown XMLHttpRequest Error')) + } } if (timeout) clearTimeout(timeout)
browser: err is sometimes 0
dcousens_dhttp
train
js
e605240c4172bc38687f21214e8dcd2c23c2a00e
diff --git a/lib/verbs/constrain.js b/lib/verbs/constrain.js index <HASH>..<HASH> 100644 --- a/lib/verbs/constrain.js +++ b/lib/verbs/constrain.js @@ -14,11 +14,6 @@ function ConstrainVerbObject(args) this.data.values = []; } - if (args.length === 1 && utils.isArray(args[0])) - { - args = args[0]; - } - this.chainPosition = 0; this.data.values[this.chainPosition] = {data: args}; diff --git a/test.js b/test.js index <HASH>..<HASH> 100755 --- a/test.js +++ b/test.js @@ -256,6 +256,17 @@ fluent.bundle(obj, 'hola', [], [1]) console.log('-------'); console.log('TEST #%s', testCount++); +var arr = [1, 2]; + +fluent.constrain(arr).array().throws() +.valid(function() +{ + console.log('Everything\'s OK'); +}); + +console.log('-------'); +console.log('TEST #%s', testCount++); + function callMeMaybe(arg1, arg2, arg3) { fluent.constrain(arg1, arg2, arg3).notnull()
Fixed an issue caused by the explosion of arrays when entering 'Constrain' verb
NicolaOrritos_fluent
train
js,js
02a9885f774b8e49edba8d470af00a33518e724f
diff --git a/examples/api.php b/examples/api.php index <HASH>..<HASH> 100644 --- a/examples/api.php +++ b/examples/api.php @@ -12,9 +12,8 @@ * @author Tiago Sampaio <tiago.sampaio@e-smart.com.br> */ -$baseUri = 'https://api.skyhub.com.br'; $email = 'teste.sdk@skyhub.com.br'; $apiKey = 'ddRTGUrf_bho17FooTjC'; /** @var \SkyHub\Api $api */ -$api = new SkyHub\Api($baseUri, $email, $apiKey); +$api = new SkyHub\Api($email, $apiKey);
Changing the example to fit the correct parameters.
bittools_skyhub-php
train
php
e5fcd8eb0701f891034c09cca230590bd3f244fb
diff --git a/js/btcmarkets.js b/js/btcmarkets.js index <HASH>..<HASH> 100644 --- a/js/btcmarkets.js +++ b/js/btcmarkets.js @@ -175,7 +175,7 @@ module.exports = class btcmarkets extends Exchange { let amount = this.safeFloat (item, 'amount'); if (amount !== undefined) { amount = amount * 1e-8; - } + } return { 'id': this.safeString (item, 'fundTransferId'), 'txid': txid,
btcmarkets linting trailing space
ccxt_ccxt
train
js
cfaaf6420076bb142da971451af249d2453600a7
diff --git a/bundler.js b/bundler.js index <HASH>..<HASH> 100644 --- a/bundler.js +++ b/bundler.js @@ -76,9 +76,6 @@ var Bundler = module.exports = function(options) { this.get = this.get.bind(this); this.compile = Promise.promisify(this.bundler.run.bind(this.bundler)); - // Optionally compile - if (options.compile) this.compile(); - // Only watch directory with index file: breaks outside watchers otherwise if (options.watch) { chokidar.watch(path.join(path.dirname(options.entry), "**", "*")).on("all", function(event, file) { @@ -88,6 +85,10 @@ var Bundler = module.exports = function(options) { }); } + // Optionally compile + // TO DO: Address race conditions here + if (options.compile) this.compile(); + }; @@ -101,7 +102,6 @@ var Bundler = module.exports = function(options) { **/ Bundler.prototype.get = function() { - console.log("GETTING"); return readFile(this.path, "utf8"); };
Bundler: inserts comments regarding race conditions
shippjs_shipp-server
train
js
626e07c116900ff5a939aea3d8a02fd5a1192c8b
diff --git a/core-spi-test/src/main/java/org/ehcache/internal/store/StoreBulkComputeIfAbsentTest.java b/core-spi-test/src/main/java/org/ehcache/internal/store/StoreBulkComputeIfAbsentTest.java index <HASH>..<HASH> 100644 --- a/core-spi-test/src/main/java/org/ehcache/internal/store/StoreBulkComputeIfAbsentTest.java +++ b/core-spi-test/src/main/java/org/ehcache/internal/store/StoreBulkComputeIfAbsentTest.java @@ -72,7 +72,6 @@ public class StoreBulkComputeIfAbsentTest<K, V> extends SPIStoreTester<K, V> { kvStore.bulkComputeIfAbsent(Arrays.asList((K[]) set.toArray()), new Function<Iterable<? extends K>, Iterable<? extends Map.Entry<? extends K, ? extends V>>>() { @Override public Iterable<? extends Map.Entry<? extends K, ? extends V>> apply(Iterable<? extends K> entries) { - System.err.println("HERE ARE " + entries.toString()); assertThat(entries.iterator().hasNext(), is(false)); return null; }
#<I>, removing debug statement
ehcache_ehcache3
train
java
6f623bbed69c8e0dab656792fb16cb73692573eb
diff --git a/test/library/run-options.test.js b/test/library/run-options.test.js index <HASH>..<HASH> 100644 --- a/test/library/run-options.test.js +++ b/test/library/run-options.test.js @@ -124,7 +124,7 @@ describe('Newman run options', function () { bail: ['folder'] }, function (err) { expect(err).to.be.ok; - expect(err.message).to.equal('getaddrinfo ENOTFOUND 123.random.z 123.random.z:443'); + expect(err.message).to.include('getaddrinfo ENOTFOUND 123.random.z'); done(); });
Test: fix library test on Node <I>
postmanlabs_newman
train
js
461fa5ebcfc6875bde081f8ea1eeae1d4c709aa2
diff --git a/instabot/api/api.py b/instabot/api/api.py index <HASH>..<HASH> 100644 --- a/instabot/api/api.py +++ b/instabot/api/api.py @@ -980,6 +980,11 @@ class API(object): url = "friendships/destroy/{user_id}/".format(user_id=user_id) return self.send_request(url, data) + def remove_follower(self, user_id): + data = self.json_data({'user_id': user_id}) + url = 'friendships/remove_follower/{user_id}/'.format(user_id=user_id) + return self.send_request(url, data) + def block(self, user_id): data = self.json_data({"user_id": user_id}) url = "friendships/block/{user_id}/".format(user_id=user_id)
Update api.py Added signature /remove_follower/ (on followers page, more button)
instagrambot_instabot
train
py
d4b72f372e3cd49d4667aad9692ae2a2db84c1f9
diff --git a/gtm.go b/gtm.go index <HASH>..<HASH> 100644 --- a/gtm.go +++ b/gtm.go @@ -381,7 +381,6 @@ func TailOps(ctx *OpCtx, session *mgo.Session, channels []OpChan, options *Optio } if err = iter.Close(); err != nil { ctx.ErrC <- err - return err } if iter.Timeout() { select {
let client decide to stop goroutine
rwynn_gtm
train
go
81e1e2489f71e9f0250034492b0d52616a450c77
diff --git a/pytorch_pretrained_bert/optimization.py b/pytorch_pretrained_bert/optimization.py index <HASH>..<HASH> 100644 --- a/pytorch_pretrained_bert/optimization.py +++ b/pytorch_pretrained_bert/optimization.py @@ -17,6 +17,7 @@ import math import torch from torch.optim import Optimizer +from torch.optim.optimizer import required from torch.nn.utils import clip_grad_norm_ def warmup_cosine(x, warmup=0.002): @@ -55,10 +56,10 @@ class BertAdam(Optimizer): weight_decay_rate: Weight decay. Default: 0.01 max_grad_norm: Maximum norm for the gradients (-1 means no clipping). Default: 1.0 """ - def __init__(self, params, lr, warmup=-1, t_total=-1, schedule='warmup_linear', + def __init__(self, params, lr=required, warmup=-1, t_total=-1, schedule='warmup_linear', b1=0.9, b2=0.999, e=1e-6, weight_decay_rate=0.01, max_grad_norm=1.0): - if not lr >= 0.0: + if lr is not required and lr < 0.0: raise ValueError("Invalid learning rate: {} - should be >= 0.0".format(lr)) if schedule not in SCHEDULES: raise ValueError("Invalid schedule parameter: {}".format(schedule))
Fix optimizer to work with horovod
huggingface_pytorch-pretrained-BERT
train
py
1b6dcf16d83099c0efe5aaa0e77b94c7ab029585
diff --git a/lib/axlsx/drawing/cat_axis.rb b/lib/axlsx/drawing/cat_axis.rb index <HASH>..<HASH> 100644 --- a/lib/axlsx/drawing/cat_axis.rb +++ b/lib/axlsx/drawing/cat_axis.rb @@ -77,7 +77,7 @@ module Axlsx super(str) str << '<c:auto val="' << @auto.to_s << '"/>' str << '<c:lblAlgn val="' << @lblAlgn.to_s << '"/>' - str << '<c:lblOffset val="' << @lblOffset.to_s << '"/>' + str << '<c:lblOffset val="' << @lblOffset.to_i.to_s << '"/>' str << '<c:tickLblSkip val="' << @tickLblSkip.to_s << '"/>' str << '<c:tickMarkSkip val="' << @tickMarkSkip.to_s << '"/>' str << '</c:catAx>'
poor mans way to strip off the % from the setting.
randym_axlsx
train
rb
da9acb8710f61123c3263cd9d2c3a27e7e1bded7
diff --git a/klein.php b/klein.php index <HASH>..<HASH> 100644 --- a/klein.php +++ b/klein.php @@ -151,11 +151,21 @@ function dispatch($uri = null, $req_method = null, array $params = null, $captur //Easily handle 404's } elseif ($_route === '404' && !$matched && count($methods_matched) <= 0) { - $callback($request, $response, $app, $matched, $methods_matched); + try { + $callback($request, $response, $app, $matched, $methods_matched); + } catch (Exception $e) { + $response->error($e); + } + ++$matched; //Easily handle 405's } elseif ($_route === '405' && !$matched && count($methods_matched) > 0) { - $callback($request, $response, $app, $matched, $methods_matched); + try { + $callback($request, $response, $app, $matched, $methods_matched); + } catch (Exception $e) { + $response->error($e); + } + ++$matched; //@ is used to specify custom regex
Pass exceptions from our <I> and <I> routes to our Klein-registered error handler for more proper/expected handling
klein_klein.php
train
php
6db68ffd705990df1779da19a9070eb88f4385dd
diff --git a/local_settings/loader.py b/local_settings/loader.py index <HASH>..<HASH> 100644 --- a/local_settings/loader.py +++ b/local_settings/loader.py @@ -84,9 +84,9 @@ class Loader(Base): settings.pop('extends', None) self._interpolate(settings, settings) - self._import_from_string(settings) self._append_extras(settings) self._swap_list_items(settings) + self._import_from_string(settings) return settings def _parse_path(self, path):
When loading settings, do imports after adding extras & swapping
PSU-OIT-ARC_django-local-settings
train
py
60b3ae372411bd74f93aaf3cf86e267765bee282
diff --git a/src/js/mep-player.js b/src/js/mep-player.js index <HASH>..<HASH> 100644 --- a/src/js/mep-player.js +++ b/src/js/mep-player.js @@ -348,22 +348,7 @@ // move the <video/video> tag into the right spot - if (mf.isiOS) { - - // sadly, you can't move nodes in iOS, so we have to destroy and recreate it! - var $newMedia = t.$media.clone(); - - t.container.find('.mejs-mediaelement').append($newMedia); - - t.$media.remove(); - t.$node = t.$media = $newMedia; - t.node = t.media = $newMedia[0]; - - } else { - - // normal way of moving it into place (doesn't work on iOS) - t.container.find('.mejs-mediaelement').append(t.$media); - } + t.container.find('.mejs-mediaelement').append(t.$media); // needs to be assigned here, after iOS remap t.node.player = t;
no longer clone media DOM element on iOS iOS used to not allow you to move elements on the DOM, so we needed to clone, append, and then destroy an element in order to move it. This no longer appears to be the case. Also, cloning the element had unintended side effects, like losing event listeners. This commit makes VideoElementPlayer treat elements the same on iOS as other platforms.
mediaelement_mediaelement
train
js
5dc8870fa65eff74afda1e61f4814c8b93c53c78
diff --git a/grade/simpletest/testreportlib.php b/grade/simpletest/testreportlib.php index <HASH>..<HASH> 100644 --- a/grade/simpletest/testreportlib.php +++ b/grade/simpletest/testreportlib.php @@ -33,7 +33,7 @@ require_once($CFG->dirroot.'/grade/report/lib.php'); /** * @TODO create a set of mock objects to simulate the database operations. We don't want to connect to any real sql server. */ -class gradereportlib_test extends FakeDBUnitTestCase { +class gradereportlib_test extends UnitTestCaseUsingDatabase { var $courseid = 1; var $context = null; var $report = null;
MDL-<I> testreportlib migrated to UnitTestCaseUsingDatabase. Easy one!
moodle_moodle
train
php
42cc96e95a38088df355c829273e824238ad412f
diff --git a/test/test_generic_spreadsheet.rb b/test/test_generic_spreadsheet.rb index <HASH>..<HASH> 100644 --- a/test/test_generic_spreadsheet.rb +++ b/test/test_generic_spreadsheet.rb @@ -62,7 +62,7 @@ class TestGenericSpreadsheet < Test::Unit::TestCase end should "give us the correct value for 'ZZ'" do - assert_equal (26**2 + 26),Roo::GenericSpreadsheet.letter_to_number('ZZ') + assert_equal 26**2 + 26,Roo::GenericSpreadsheet.letter_to_number('ZZ') end end
Fix a "warning: (...) interpreted as grouped expression"
roo-rb_roo
train
rb
b770db0f58b445734b651c35b5199a14f4ad9640
diff --git a/src/Koldy/Db/Model.php b/src/Koldy/Db/Model.php index <HASH>..<HASH> 100644 --- a/src/Koldy/Db/Model.php +++ b/src/Koldy/Db/Model.php @@ -748,6 +748,40 @@ abstract class Model implements Serializable } /** + * Fetch the array of initialized records from database, where key in the returned array is something from the + * results + * + * @param string $key The name of the column which will be taken from results to be used as key in array + * @param mixed $where the WHERE condition + * @param array $fields array of fields to select; by default, all fields will be fetched + * @param string|null $orderField + * @param string|null $orderDirection + * @param int|null $limit + * + * @param int|null $start + * + * @return array + * @link http://koldy.net/docs/database/models#fetch + */ + public static function fetchWithKey( + string $key, + $where, + array $fields = null, + string $orderField = null, + string $orderDirection = null, + int $limit = null, + int $start = null + ): array { + $data = []; + + foreach (static::fetch($where, $fields, $orderField, $orderDirection, $limit, $start) as $record) { + $data[$record->$key] = $record; + } + + return $data; + } + + /** * Fetch all records from database * * @param string $orderField
Added fetchWithKey method in Model class
koldy_framework
train
php
206de12f12594a648e2be2f82d544ff17af0bf5e
diff --git a/pymatgen/io/vasp/inputs.py b/pymatgen/io/vasp/inputs.py index <HASH>..<HASH> 100644 --- a/pymatgen/io/vasp/inputs.py +++ b/pymatgen/io/vasp/inputs.py @@ -1335,7 +1335,7 @@ class Kpoints(MSONable): def as_dict(self): """json friendly dict representation of Kpoints""" - d = {"comment": self.comment, "nkpoints": len(self.kpts), + d = {"comment": self.comment, "nkpoints": self.num_kpts, "generation_style": self.style.name, "kpoints": self.kpts, "usershift": self.kpts_shift, "kpts_weights": self.kpts_weights, "coord_type": self.coord_type,
revert input nkpoints to self.num_kpts
materialsproject_pymatgen
train
py
748a5ce236ee420b76e843bedbadd345feeb365d
diff --git a/apptentive/src/main/java/com/apptentive/android/sdk/model/JsonPayload.java b/apptentive/src/main/java/com/apptentive/android/sdk/model/JsonPayload.java index <HASH>..<HASH> 100644 --- a/apptentive/src/main/java/com/apptentive/android/sdk/model/JsonPayload.java +++ b/apptentive/src/main/java/com/apptentive/android/sdk/model/JsonPayload.java @@ -169,8 +169,7 @@ public abstract class JsonPayload extends Payload { protected JSONObject marshallForSending() { try { if (encryptionKey != null) { - JSONObject wrapper = new JSONObject(); - wrapper.put("token", token); + jsonObject.put("token", token); } } catch (Exception e) { // Can't happen.
Include token at correct place inside encrypted payloads.
apptentive_apptentive-android
train
java
4e53848d97925918c62a3bc5fdcbd2f4bc82ca02
diff --git a/filters/__init__.py b/filters/__init__.py index <HASH>..<HASH> 100644 --- a/filters/__init__.py +++ b/filters/__init__.py @@ -17,4 +17,4 @@ from .complex import * from .string import * -__version__ = '1.0.4' +__version__ = '1.1.0' diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -16,7 +16,7 @@ setup( url = 'https://github.com/eflglobal/filters/', # Don't forget to update version number in `filters/__init__.py`! - version = '1.0.4', + version = '1.1.0', packages = ['filters'],
Changing to <I>. The internal reorg is pretty intense. Most users shouldn't be affected by it, but just in case....
eflglobal_filters
train
py,py
147b743fd0690f34111d784db827f85fccd2eae2
diff --git a/src/styles/points/points.js b/src/styles/points/points.js index <HASH>..<HASH> 100755 --- a/src/styles/points/points.js +++ b/src/styles/points/points.js @@ -136,7 +136,7 @@ Object.assign(Points, { } } else { - log('warn', `Style: in style '${this.name}', could not find sprite '${sprite}' for texture '${this.texture}'`); + log('debug', `Style: in style '${this.name}', could not find sprite '${sprite}' for texture '${this.texture}'`); return; } }
missing sprite match should be debug message, not warning
tangrams_tangram
train
js
9e7d1a4f9ed34466a05ac1356e97a98686f7da67
diff --git a/src/Composer/Command/GlobalCommand.php b/src/Composer/Command/GlobalCommand.php index <HASH>..<HASH> 100644 --- a/src/Composer/Command/GlobalCommand.php +++ b/src/Composer/Command/GlobalCommand.php @@ -42,6 +42,9 @@ is to add the COMPOSER_HOME/vendor/bin dir to your PATH env var. COMPOSER_HOME is c:\Users\<user>\AppData\Roaming\Composer on Windows and /home/<user>/.composer on unix systems. +If your system uses freedesktop.org standards, then it will first check +XDG_CONFIG_HOME or default to /home/<user>/.config/composer + Note: This path may vary depending on customizations to bin-dir in composer.json or the environmental variable COMPOSER_BIN_DIR.
update help page on global for COMPOSER_HOME info default installation directory for global packages has changed since adding support for freedesktop.org standards per confusion from <URL>
composer_composer
train
php
960ac99bf6083496b0077f2aaebfec3210a8b64f
diff --git a/question/type/numerical/questiontype.php b/question/type/numerical/questiontype.php index <HASH>..<HASH> 100644 --- a/question/type/numerical/questiontype.php +++ b/question/type/numerical/questiontype.php @@ -730,10 +730,8 @@ class question_numerical_qtype extends question_shortanswer_qtype { function get_correct_responses(&$question, &$state) { $correct = parent::get_correct_responses($question, $state); $unit = $this->get_default_numerical_unit($question); - $correct['answer']= $correct['']; if (isset($correct['']) && $correct[''] != '*' && $unit) { $correct[''] .= ' '.$unit->unit; - $correct['unit']= $unit->unit; } return $correct; }
MDL-<I> correcting Correct response display
moodle_moodle
train
php
e8d7152a89f16a487a3d67d16a63bf065183b405
diff --git a/activerecord/lib/active_record/associations/association_collection.rb b/activerecord/lib/active_record/associations/association_collection.rb index <HASH>..<HASH> 100644 --- a/activerecord/lib/active_record/associations/association_collection.rb +++ b/activerecord/lib/active_record/associations/association_collection.rb @@ -32,7 +32,7 @@ module ActiveRecord if @reflection.options[:finder_sql] find_by_scan(*args) else - find_by_sql(*args) + scoped.find(*args) end end @@ -560,10 +560,6 @@ module ActiveRecord load_target.select { |r| ids.include?(r.id) } end end - - def find_by_sql(*args) - scoped.find(*args) - end end end end
Use scoped.find directly rather than having a find_by_sql method
rails_rails
train
rb
27741e3953cdf88c4dee37307065ca36a04c73c7
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -89,7 +89,7 @@ setup( scripts=ProjectScripts, install_requires=requires, include_package_data=False, - packages=["quantum.client", "quantum.common"], + packages=["quantum", "quantum.client", "quantum.common"], package_data=PackageData, eager_resources=EagerResources, entry_points={
Add "quantum" package so that __init__.py is included Change-Id: I<I>fcc<I>ca<I>e<I>c<I>e8dabc5faed9b<I>b
rackerlabs_rackspace-python-neutronclient
train
py
9895c9895ba2f6deb491dfca031416f372a8e239
diff --git a/python/thunder/factorization/util.py b/python/thunder/factorization/util.py index <HASH>..<HASH> 100644 --- a/python/thunder/factorization/util.py +++ b/python/thunder/factorization/util.py @@ -1,6 +1,6 @@ # utilities for factorization -from numpy import random, mean, real, argsort, transpose, dot, inner, outer +from numpy import random, mean, real, argsort, transpose, dot, inner, outer, zeros from scipy.linalg import eig, inv, orth @@ -12,12 +12,15 @@ def svd1(data, k, meanSubtract=1): yield sum(outer(x, x) for x in iterator) n = data.count() + m = len(data.first()) if meanSubtract == 1: data = data.map(lambda x: x - mean(x)) # TODO: confirm speed increase for mapPartitions vs map - cov = data.mapPartitions(outerSum).reduce(lambda x, y: x + y) / n + #cov = data.mapPartitions(outerSum).reduce(lambda x, y: x + y) / n + + cov = data.fold(zeros((m, m)), lambda x, y: outer(x, x) + y) w, v = eig(cov) w = real(w)
Testing fold versus mapPartitions
thunder-project_thunder
train
py
8ccd3808da884fb58e8498eb5b65dc509e0b1a17
diff --git a/src/com/backendless/servercode/extension/UserExtender.java b/src/com/backendless/servercode/extension/UserExtender.java index <HASH>..<HASH> 100644 --- a/src/com/backendless/servercode/extension/UserExtender.java +++ b/src/com/backendless/servercode/extension/UserExtender.java @@ -22,24 +22,24 @@ public abstract class UserExtender { } - public void beforeFind( RunnerContext context, BackendlessDataQuery query ) + public void beforeFind( RunnerContext context, BackendlessDataQuery query ) throws Exception { } public BackendlessCollection afterFind( RunnerContext context, BackendlessDataQuery query, - ExecutionResult<BackendlessCollection> result ) + ExecutionResult<BackendlessCollection> result ) throws Exception { return result.getResult(); } - public void beforeFindById( RunnerContext context, String objectId, String[] relations ) + public void beforeFindById( RunnerContext context, String objectId, String[] relations ) throws Exception { } public HashMap afterFindById( RunnerContext context, String objectId, String[] relations, - ExecutionResult<HashMap> result ) + ExecutionResult<HashMap> result ) throws Exception { return result.getResult(); }
throws Exception in UserService event handlers
Backendless_Android-SDK
train
java
ee4b71651439f0fa405fb691fe3caf5ab55217cb
diff --git a/slice.go b/slice.go index <HASH>..<HASH> 100644 --- a/slice.go +++ b/slice.go @@ -16,6 +16,13 @@ func NewSlice(data *C.char, size C.size_t) *Slice { return &Slice{data, size, false} } +// MakeSlice is similar to NewSlice, but can be called with +// a Go string type. This exists to make testing integration +// with Gorocksdb easier. +func MakeSlice(data string) *Slice { + return NewSlice(C.CString(data), C.size_t(len(data))) +} + // Data returns the data of the slice. func (s *Slice) Data() []byte { return charToByte(s.data, s.size)
Add MakeSlice function MakeSlice is similar to NewSlice, but can be called with a Go string type. This exists to make testing integration with Gorocksdb easier. This exists due to some complexity of calling NewSlice from tests in other projects using Gorocksdb.
tecbot_gorocksdb
train
go
44a96e8bd88fbf23471277c9e98ec414c9379477
diff --git a/cli/lib/dev.js b/cli/lib/dev.js index <HASH>..<HASH> 100644 --- a/cli/lib/dev.js +++ b/cli/lib/dev.js @@ -12,6 +12,11 @@ const modes = { module.exports = opts => { opts.webpack = { + resolve: { + alias: { + 'webpack-hot-client/client': path.resolve('../node_modules/webpack-hot-client/client') + } + }, plugins: [ new webpack.DefinePlugin({ USER_APP: JSON.stringify(opts.app)
Resolve webpack-hot-client in cli
c8r_kit
train
js
534aa1fc4be4edb18df8925638d815dabd72529f
diff --git a/src/db.js b/src/db.js index <HASH>..<HASH> 100644 --- a/src/db.js +++ b/src/db.js @@ -238,6 +238,14 @@ return new IndexQuery( table , db , index ); }; + this.count = function (table , key) { + if ( closed ) { + throw 'Database has been closed'; + } + var transaction = db.transaction( table ), + store = transaction.objectStore( table ); + } + for ( var i = 0 , il = db.objectStoreNames.length ; i < il ; i++ ) { (function ( storeName ) { that[ storeName ] = { };
The db is new things.
aaronpowell_db.js
train
js
dc55785761d5c7da4ec1eb1e00ed647425cc9d39
diff --git a/lib/gnip-stream/stream.rb b/lib/gnip-stream/stream.rb index <HASH>..<HASH> 100644 --- a/lib/gnip-stream/stream.rb +++ b/lib/gnip-stream/stream.rb @@ -3,6 +3,8 @@ require 'em-http-request' module GnipStream class Stream + + EventMachine.threadpool_size = 3 attr_accessor :headers, :options, :url, :username, :password
limit the size of the eventmachine threadpool to 3. Larger threadpool than that can cause connection problems with the standard ActiveRecord Connection pool.
rweald_gnip-stream
train
rb
03981b535bda5c314e4cf008948f46fcbfbd0abf
diff --git a/src/Generators/Webserver/Database/DatabaseGenerator.php b/src/Generators/Webserver/Database/DatabaseGenerator.php index <HASH>..<HASH> 100644 --- a/src/Generators/Webserver/Database/DatabaseGenerator.php +++ b/src/Generators/Webserver/Database/DatabaseGenerator.php @@ -189,7 +189,6 @@ class DatabaseGenerator public function updated(Events\Websites\Updated $event) { - if (!config('tenancy.db.auto-rename-tenant-database', false)) { return; }
Apply fixes from StyleCI (#<I>)
tenancy_multi-tenant
train
php
faa3087d928f76f0fe86f2ab387298805040e88b
diff --git a/lib/function/arithmetic/cbrt.js b/lib/function/arithmetic/cbrt.js index <HASH>..<HASH> 100644 --- a/lib/function/arithmetic/cbrt.js +++ b/lib/function/arithmetic/cbrt.js @@ -45,12 +45,14 @@ function factory (type, config, load, typed) { */ var cbrt = typed('cbrt', { 'number': _cbrtNumber, + // TODO: implement 'number, boolean' to return all roots 'Complex': _cbrtComplex, 'Complex, boolean': _cbrtComplex, 'BigNumber': _cbrtBigNumber, + // TODO: implement 'BigNumber, boolean' to return all roots 'Array | Matrix': function (x) { // deep map collection, skip zeros since sqrt(0) = 0
Added a few todo's
josdejong_mathjs
train
js
e43891f2be9945b659684df6042f8a079c3b59a7
diff --git a/code/libraries/koowa/database/behavior/sluggable.php b/code/libraries/koowa/database/behavior/sluggable.php index <HASH>..<HASH> 100644 --- a/code/libraries/koowa/database/behavior/sluggable.php +++ b/code/libraries/koowa/database/behavior/sluggable.php @@ -227,8 +227,9 @@ class KDatabaseBehaviorSluggable extends KDatabaseBehaviorAbstract { $db = $table->getDatabase(); $query = $this->getService('koowa:database.query.select') - ->select('slug') - ->where('slug', 'LIKE', $this->slug.'-%'); + ->columns('slug') + ->where('slug LIKE :slug') + ->bind(array('slug' => $this->slug . '-%')); $slugs = $table->select($query, KDatabase::FETCH_FIELD_LIST);
KDatabaseBehaviorSluggable
joomlatools_joomlatools-framework
train
php
5c87957be0fc3e6cc636a8f16acbcc82713da289
diff --git a/src/BaseValidator.php b/src/BaseValidator.php index <HASH>..<HASH> 100644 --- a/src/BaseValidator.php +++ b/src/BaseValidator.php @@ -560,6 +560,10 @@ abstract class BaseValidator { $isFromBase = (static::class === self::class); + if (!is_object($object)) { + throw new \Exception('Expecting an object'); + } + //Test type if it's set if (property_exists($object, 'type') && !empty($object->type)) { if (array_key_exists($object->type, self::$validatorRegistry)) { diff --git a/tests/src/BaseValidatorTest.php b/tests/src/BaseValidatorTest.php index <HASH>..<HASH> 100644 --- a/tests/src/BaseValidatorTest.php +++ b/tests/src/BaseValidatorTest.php @@ -788,6 +788,15 @@ class BaseValidatorTest extends \PHPUnit_Framework_TestCase } /** + * @covers Phramework\Validate\BaseValidator::createFromObject + * @expectedException Exception + */ + public function testCreateFromObjectFailureNotObject() + { + BaseValidator::createFromObject('string'); + } + + /** * @covers Phramework\Validate\BaseValidator::toObject */ public function testToObject()
Allow only objects at BaseValidator::createFromObject
phramework_validate
train
php,php
1e7611211002dee71ebe5bfc38ce5552beee41fd
diff --git a/template/app/view/cls/Overview.js b/template/app/view/cls/Overview.js index <HASH>..<HASH> 100644 --- a/template/app/view/cls/Overview.js +++ b/template/app/view/cls/Overview.js @@ -26,7 +26,7 @@ Ext.define('Docs.view.cls.Overview', { var scrollOffset = el.getY() - (isMember ? 145 : 135); var docContent = this.getEl().down('.x-panel-body'); var currentScroll = docContent.getScroll()['top']; - docContent.scrollTo('top', currentScroll + scrollOffset, true); + docContent.scrollTo('top', currentScroll + scrollOffset); if (isMember && el.down(".expandable")) { el.addCls('open');
Turn of scrolling animation. As suggested in: <URL>
senchalabs_jsduck
train
js
9e42de8171456965329950e8df21b48f61514752
diff --git a/deploy/vagrant/core/EnvSetup.rb b/deploy/vagrant/core/EnvSetup.rb index <HASH>..<HASH> 100644 --- a/deploy/vagrant/core/EnvSetup.rb +++ b/deploy/vagrant/core/EnvSetup.rb @@ -186,7 +186,11 @@ class HadoopVersion end def tarball_url - return @url_template[@type] % {Version: @version} + if @type == '' + return '' + else + return @url_template[@type] % {Version: @version} + end end def version
bug fix: when type is not hadoop#, type is not key in url_template
Alluxio_alluxio
train
rb
ba8c02f5946a0ead15f633b79b7359ac35135c79
diff --git a/pkg/services/sqlstore/alert.go b/pkg/services/sqlstore/alert.go index <HASH>..<HASH> 100644 --- a/pkg/services/sqlstore/alert.go +++ b/pkg/services/sqlstore/alert.go @@ -94,9 +94,9 @@ func HandleAlertsQuery(query *m.GetAlertsQuery) error { if i > 0 { sql.WriteString(" OR ") } - if strings.HasPrefix(v, "not") { + if strings.HasPrefix(v, "not_") { sql.WriteString("state <> ? ") - v = v[4:] + v = strings.TrimPrefix(v, "not_") } else { sql.WriteString("state = ? ") }
refactor: changed string slicing to strings.TrimPrefix, #<I>
grafana_grafana
train
go
13969d63c21f81d5e06195587027904eb73ea913
diff --git a/test/unit/ut_22_filter.rb b/test/unit/ut_22_filter.rb index <HASH>..<HASH> 100644 --- a/test/unit/ut_22_filter.rb +++ b/test/unit/ut_22_filter.rb @@ -520,5 +520,24 @@ class UtFilterTest < Test::Unit::TestCase { 'field' => 'y', 'copy_from' => '^.x' } ], { 'x' => 'a' }) end + + def test_cumulation + + assert_valid( + [ { 'field' => 'x', 't' => 'array', 'has' => 'a' } ], + { 'x' => %w[ a b c ] }) + + assert_not_valid( + [ { 'field' => 'x', 't' => 'hash', 'has' => 'a' } ], + { 'x' => %w[ a b c ] }) + end + + def test_cumulation_or + + assert_filter( + { 'x' => { 'a' => 2 } }, + [ { 'field' => 'x', 't' => 'hash', 'has' => 'a', 'or' => { 'a' => 2 } } ], + { 'x' => %w[ a b c ] }) + end end
filter : cumulating validations is OK transformations too :-)
jmettraux_ruote
train
rb
af5af430f62e6cf9f958ed88b2cfe9844fe66cdc
diff --git a/faq-bundle/contao/ModuleFaq.php b/faq-bundle/contao/ModuleFaq.php index <HASH>..<HASH> 100644 --- a/faq-bundle/contao/ModuleFaq.php +++ b/faq-bundle/contao/ModuleFaq.php @@ -65,7 +65,7 @@ class ModuleFaq extends \Frontend $arrProcessed = array(); // Get all categories - $objFaq = \FaqCategoryModel::findAll(); + $objFaq = \FaqCategoryCollection::findAll(); // Walk through each category if ($objFaq !== null)
[Faq] Check the request token in the back end when `$_GET['act']` is set (see #<I>)
contao_contao
train
php
807519204989d79fdd10cd1d43d83fd5d5ce39d7
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -9,7 +9,7 @@ from os import path here = path.abspath(path.dirname(__file__)) # Get the long description from the README file -with open(path.join(here, 'README.md')) as f: +with open(path.join(here, 'README.rst')) as f: long_description = f.read() setup(
Make setup.py use rst file instead of md file.
csurfer_rake-nltk
train
py
3d5bd94825688a6814266e7e1401b56e513f84c9
diff --git a/src/components/autocomplete/js/autocompleteDirective.js b/src/components/autocomplete/js/autocompleteDirective.js index <HASH>..<HASH> 100644 --- a/src/components/autocomplete/js/autocompleteDirective.js +++ b/src/components/autocomplete/js/autocompleteDirective.js @@ -153,9 +153,10 @@ function MdAutocomplete ($mdTheming, $mdUtil) { </li>\ ' + (function () { return noItemsTemplate - ? '<li ng-if="!$mdAutocompleteCtrl.matches.length"\ - ng-hide="$mdAutocompleteCtrl.hidden"\ - md-autocomplete-parent-scope>' + noItemsTemplate + '</li>' + ? '<li ng-if="!$mdAutocompleteCtrl.matches.length && !$mdAutocompleteCtrl.loading\ + && !$mdAutocompleteCtrl.hidden"\ + ng-hide="$mdAutocompleteCtrl.hidden"\ + md-autocomplete-parent-scope>' + noItemsTemplate + '</li>' : ''; })() + '\ </ul>\
fix(autocomplete): prevents `not found` message from displaying while results are loading
angular_material
train
js
257a1b233362e93cd607b64b8943f153a7cfae80
diff --git a/src/Convert/BaseConverter.php b/src/Convert/BaseConverter.php index <HASH>..<HASH> 100644 --- a/src/Convert/BaseConverter.php +++ b/src/Convert/BaseConverter.php @@ -364,13 +364,13 @@ class BaseConverter if (function_exists('shell_exec')) { // Try Imagick - $quality = shell_exec("identify -format '%Q' '" . $filename . "'"); + $quality = shell_exec("identify -format '%Q' " . escapeshellarg($filename)); if ($quality) { return intval($quality); } // Try GraphicsMagick - $quality = shell_exec("gm identify -format '%Q' '" . $filename . "'"); + $quality = shell_exec("gm identify -format '%Q' " . escapeshellarg($filename)); if ($quality) { return intval($quality); }
Fixed failure to detect quality for files containing spaces in filename (for <I>). Also switched to using escapeshellarg, which is more secure. #<I>.
rosell-dk_webp-convert
train
php
5e54a735929a5c4737120dbddc43d02ba7a34ba0
diff --git a/ripe/atlas/cousteau/request.py b/ripe/atlas/cousteau/request.py index <HASH>..<HASH> 100644 --- a/ripe/atlas/cousteau/request.py +++ b/ripe/atlas/cousteau/request.py @@ -266,7 +266,7 @@ class AtlasStopRequest(AtlasRequest): class AtlasLatestRequest(AtlasRequest): - def __init__(self, msm_id=None, probe_ids=(), **kwargs): + def __init__(self, msm_id, probe_ids=(), **kwargs): super(AtlasLatestRequest, self).__init__(**kwargs) self.url_path = "/api/v2/measurements/{0}/latest"
There's no point making an AtlasLatestRequest without specifying msm_id
RIPE-NCC_ripe-atlas-cousteau
train
py
ffe3eb03daf9e21497e147e8010ba9e52c5472f6
diff --git a/mount_linux.go b/mount_linux.go index <HASH>..<HASH> 100644 --- a/mount_linux.go +++ b/mount_linux.go @@ -108,8 +108,8 @@ func disableFunc(flag uintptr) func(uintptr) uintptr { // As per libfuse/fusermount.c:602: https://bit.ly/2SgtWYM#L602 var mountflagopts = map[string]func(uintptr) uintptr{ - "rw": enableFunc(unix.MS_RDONLY), - "ro": disableFunc(unix.MS_RDONLY), + "rw": disableFunc(unix.MS_RDONLY), + "ro": enableFunc(unix.MS_RDONLY), "suid": disableFunc(unix.MS_NOSUID), "nosuid": enableFunc(unix.MS_NOSUID), "dev": disableFunc(unix.MS_NODEV),
rw and ro were flipped (#<I>) when user mount via fstab, we get '-o rw' implicitly, and under directmount this _enabled_ MS_RDONLY, which is the opposite of what we want refs <URL>
jacobsa_fuse
train
go
a8ab9d666417c740d222891fa9011d92fdc5786f
diff --git a/ShareLinks.php b/ShareLinks.php index <HASH>..<HASH> 100644 --- a/ShareLinks.php +++ b/ShareLinks.php @@ -64,9 +64,10 @@ class ShareLinks extends \yii\base\Widget echo $this->render($this->viewName); } - public function shareUrl($networkId) + public function shareUrl($networkId, $url=null) { - return str_replace('{url}', urlencode($this->url), ArrayHelper::getValue($this->shareUrlMap, $networkId)); + if( !$url ) { $url = $this->url; } + return str_replace('{url}', urlencode($url), ArrayHelper::getValue($this->shareUrlMap, $networkId)); } }
the ability to share any url, not just the current
iJackUA_yii2-sharelinks-widget
train
php
6f77fcff16d34b4aeba347bf0c167c150afabfed
diff --git a/disco/disco_test.go b/disco/disco_test.go index <HASH>..<HASH> 100644 --- a/disco/disco_test.go +++ b/disco/disco_test.go @@ -14,6 +14,7 @@ import ( "github.com/signalfx/golib/zkplus" "github.com/signalfx/golib/zkplus/zktest" "github.com/stretchr/testify/require" + "time" ) func TestUnableToConn(t *testing.T) { @@ -147,6 +148,7 @@ func TestBadRefresh(t *testing.T) { d1.manualEvents <- zk.Event{ Path: "/TestAdvertiseService", } + time.Sleep(time.Millisecond) require.Equal(t, badForce, s.refresh(z)) z.ForcedErrorCheck(nil)
Give another goroutine time to startup
signalfx_golib
train
go
39b8d14634d18ce545c34324251d70884d0855b9
diff --git a/code/Model/SiteTree.php b/code/Model/SiteTree.php index <HASH>..<HASH> 100755 --- a/code/Model/SiteTree.php +++ b/code/Model/SiteTree.php @@ -2371,7 +2371,7 @@ class SiteTree extends DataObject implements PermissionProvider, i18nEntityProvi } // "unpublish" - if ($isPublished && $canPublish && $isOnDraft && $canUnpublish) { + if ($isPublished && $isOnDraft && $canUnpublish) { $moreOptions->push( FormAction::create('unpublish', _t(__CLASS__.'.BUTTONUNPUBLISH', 'Unpublish'), 'delete') ->setDescription(_t(__CLASS__.'.BUTTONUNPUBLISHDESC', 'Remove this page from the published site'))
BUG: Unpublish permission decoupled from publish permission.
silverstripe_silverstripe-cms
train
php
7008a670b1f5e4188e45250b42be00d4c203899f
diff --git a/green/command.py b/green/command.py index <HASH>..<HASH> 100644 --- a/green/command.py +++ b/green/command.py @@ -13,8 +13,11 @@ from green.cmdline import main def get_user_options(): - r = parseArguments() + if "--help-commands" in sys.argv: + return [] + + r = parseArguments() options = [] for action in r.store_opt.actions: @@ -29,7 +32,7 @@ def get_user_options(): class green(Command): command_name = "green" - description = " green is a clean, colorful, fast python test runner" + description = "Run unit tests using green" user_options = get_user_options() def initialize_options(self):
Fix `python setup.py --help-commands` not working (#<I>)
CleanCut_green
train
py
5d3f220f35e717ea57a385e3ccdaff9561b367a2
diff --git a/addon/components/layers-dialogs/edit-modes/base.js b/addon/components/layers-dialogs/edit-modes/base.js index <HASH>..<HASH> 100644 --- a/addon/components/layers-dialogs/edit-modes/base.js +++ b/addon/components/layers-dialogs/edit-modes/base.js @@ -3,6 +3,7 @@ */ import Ember from 'ember'; +import FlexberryEditLayerMapComponent from '../../flexberry-edit-layermap'; /** Flexberry add layer modal dialog with [Semantic UI modal](http://semantic-ui.com/modules/modal.html) style. @@ -29,8 +30,17 @@ export default Ember.Component.extend({ @method bindProperties */ bindProperties() { + let findEditLayerMapComponent = (component) => { + let result = component.get('parentView'); + if (result instanceof FlexberryEditLayerMapComponent) { + return result; + } else { + return findEditLayerMapComponent(result); + } + }; + // Instance of flexberry-edit-layermap component. - let parent = this.get('parentView.parentView.parentView'); + let parent = findEditLayerMapComponent(this); let bindingProperties = this.get('bindingProperties'); bindingProperties.forEach((property) => {
Refactored flexberry-edit-layermap component search for binding
Flexberry_ember-flexberry-gis
train
js
ebd894fbbf9dd27d510299bcb0aaa3f47d3d479a
diff --git a/src/Conversions/Conversion.php b/src/Conversions/Conversion.php index <HASH>..<HASH> 100644 --- a/src/Conversions/Conversion.php +++ b/src/Conversions/Conversion.php @@ -13,7 +13,7 @@ class Conversion protected ConversionFileNamer $conversionFileNamer; - protected int $extractVideoFrameAtSecond = 0; + protected float $extractVideoFrameAtSecond = 0; protected Manipulations $manipulations; @@ -59,14 +59,14 @@ class Conversion return $this->performOnCollections; } - public function extractVideoFrameAtSecond(int $timeCode): self + public function extractVideoFrameAtSecond(float $timeCode): self { $this->extractVideoFrameAtSecond = $timeCode; return $this; } - public function getExtractVideoFrameAtSecond(): int + public function getExtractVideoFrameAtSecond(): float { return $this->extractVideoFrameAtSecond; }
Use float for extractVideoFrameAtSecond (#<I>)
spatie_laravel-medialibrary
train
php
e6b81a15cd5be13709519162db03ab84a30668a7
diff --git a/src/java/com/samskivert/jdbc/depot/operator/Conditionals.java b/src/java/com/samskivert/jdbc/depot/operator/Conditionals.java index <HASH>..<HASH> 100644 --- a/src/java/com/samskivert/jdbc/depot/operator/Conditionals.java +++ b/src/java/com/samskivert/jdbc/depot/operator/Conditionals.java @@ -220,7 +220,11 @@ public abstract class Conditionals public void appendExpression (Query query, StringBuilder builder) { builder.append("match("); + int idx = 0; for (ColumnExp column : _columns) { + if (idx++ > 0) { + builder.append(", "); + } column.appendExpression(query, builder); } builder.append(") against (?)");
Them thar columns was all jammed together. Give 'em some breathin' room with commas. git-svn-id: <URL>
samskivert_samskivert
train
java
6990832155349377b0aad5fa4e7416c488f31147
diff --git a/symphony/content/content.ajaxtranslate.php b/symphony/content/content.ajaxtranslate.php index <HASH>..<HASH> 100644 --- a/symphony/content/content.ajaxtranslate.php +++ b/symphony/content/content.ajaxtranslate.php @@ -5,7 +5,6 @@ function __construct(&$parent){ $this->_Parent = $parent; $this->_status = self::STATUS_OK; - $this->addHeaderToPage('Content-Type', 'application/json'); $this->_Parent->Profiler->sample('Page template created', PROFILE_LAP); } @@ -26,6 +25,7 @@ } public function generate(){ + header('Content-Type: application/json'); echo $this->_Result; exit; }
Makes JSON translation responses correctly send 'application/json' as their MIME type. Resolves issue #<I> - <URL>
symphonycms_symphony-2
train
php
91e9c08b9c3658df00414d635fdf305fc7d1222b
diff --git a/freemius/includes/class-fs-api.php b/freemius/includes/class-fs-api.php index <HASH>..<HASH> 100755 --- a/freemius/includes/class-fs-api.php +++ b/freemius/includes/class-fs-api.php @@ -267,6 +267,11 @@ function test( $unique_anonymous_id = null ) { $this->_logger->entrance(); + if ( ! function_exists( 'curl_version' ) ) { + // cUrl extension is not active. + return false; + } + $test = is_null( $unique_anonymous_id ) ? $this->_api->Test() : $this->_api->Test( $this->_call( 'ping.json?uid=' . $unique_anonymous_id ) );
[connectivity] No need to test API connectivity when cURL is not installed. Simply return false.
Freemius_wordpress-sdk
train
php
f04c5d1135f9a625c9cc59f8c2026162ca03e568
diff --git a/hppc/src/main/templates/com/carrotsearch/hppc/KTypeOpenHashSet.java b/hppc/src/main/templates/com/carrotsearch/hppc/KTypeOpenHashSet.java index <HASH>..<HASH> 100644 --- a/hppc/src/main/templates/com/carrotsearch/hppc/KTypeOpenHashSet.java +++ b/hppc/src/main/templates/com/carrotsearch/hppc/KTypeOpenHashSet.java @@ -405,14 +405,10 @@ public class KTypeOpenHashSet<KType> return false; } - Iterator<? extends KTypeCursor<?>> i = other.iterator(); - while (i.hasNext()) { - KTypeCursor<?> c = i.next(); - KType key = Intrinsics.<KType> cast(c.value); - if (contains(key)) { - continue; + for (KTypeCursor<?> c : other) { + if (!contains(Intrinsics.<KType> cast(c.value))) { + return false; } - return false; } return true;
Simplify code a bit.
carrotsearch_hppc
train
java
52856a55ef8822a4a96b7915b393765442d1273c
diff --git a/lib/rest-core/middleware/cache.rb b/lib/rest-core/middleware/cache.rb index <HASH>..<HASH> 100644 --- a/lib/rest-core/middleware/cache.rb +++ b/lib/rest-core/middleware/cache.rb @@ -16,7 +16,7 @@ class RestCore::Cache end def call env, &k - e = if env['cache.update'] && env[REQUEST_METHOD] == :get + e = if env['cache.update'] && cache_for?(env) cache_assign(env, nil) else env @@ -59,8 +59,7 @@ class RestCore::Cache def cache_for env, response return response unless cache(env) - # fake post (env['cache.post'] => true) is considered get and need cache - return response if env[REQUEST_METHOD] != :get unless env['cache.post'] + return response unless cache_for?(env) value = response[RESPONSE_BODY] @@ -87,4 +86,8 @@ class RestCore::Cache env end end + + def cache_for? env + [:get, :head, :otpions].include?(env[REQUEST_METHOD]) + end end
remove support for weird env['cache.post'] and cache for also HEAD, OPTIONS
godfat_rest-core
train
rb
cfdbdb9d2761be1dfbc8c56eaca1f70912fcf390
diff --git a/generators/generator-constants.js b/generators/generator-constants.js index <HASH>..<HASH> 100644 --- a/generators/generator-constants.js +++ b/generators/generator-constants.js @@ -69,7 +69,7 @@ const DOCKER_SONAR = 'sonarqube:8.7.0-community'; const DOCKER_TRAEFIK = 'traefik:1.7.28'; // waiting for https://github.com/jhipster/generator-jhipster/issues/11198 const DOCKER_CONSUL = 'consul:1.9.4'; const DOCKER_CONSUL_CONFIG_LOADER = 'jhipster/consul-config-loader:v0.4.1'; -const DOCKER_PROMETHEUS = 'prom/prometheus:v2.24.0'; +const DOCKER_PROMETHEUS = 'prom/prometheus:v2.25.0'; const DOCKER_PROMETHEUS_ALERTMANAGER = 'prom/alertmanager:v0.21.0'; const DOCKER_GRAFANA = 'grafana/grafana:7.3.7'; const DOCKER_JENKINS = 'jenkins/jenkins:lts-jdk11';
Update prom/prometheus docker image version to <I>
jhipster_generator-jhipster
train
js
1485100f0e18125fa8f5b67f5734694e2b5f51e9
diff --git a/p2p/protocol/identify/id.go b/p2p/protocol/identify/id.go index <HASH>..<HASH> 100644 --- a/p2p/protocol/identify/id.go +++ b/p2p/protocol/identify/id.go @@ -351,9 +351,6 @@ func (ids *idService) identifyConn(c network.Conn) error { s, err := c.NewStream(network.WithUseTransient(context.TODO(), "identify")) if err != nil { log.Debugw("error opening identify stream", "error", err) - // the connection is probably already closed if we hit this. - // TODO: Remove this? - c.Close() // We usually do this on disconnect, but we may have already // processed the disconnect event.
don't close the connection when opening the identify stream fails
libp2p_go-libp2p
train
go
def101a15ed69a813291ea8bfc81c1f9293ef668
diff --git a/src/Request/Session.php b/src/Request/Session.php index <HASH>..<HASH> 100644 --- a/src/Request/Session.php +++ b/src/Request/Session.php @@ -44,5 +44,19 @@ class Session { session_id($this->parseSessionId($this->sessionId)); return session_start(); } + + /** + * Returns attribute value of $default. + * @param string $key + * @param mixed $default + * @return mixed + */ + public function getAttribute($key, $default = false) { + if(array_key_exists($key, $this->attributes)) { + return $this->attributes[$key]; + } else { + return $default; + } + } } \ No newline at end of file
Added function to read and attribute from Alexa's session.
internetofvoice_libvoice
train
php