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
7c93cc48bb3e26761e749222f20172a9359242f8
diff --git a/lib/numina/recipes/__init__.py b/lib/numina/recipes/__init__.py index <HASH>..<HASH> 100644 --- a/lib/numina/recipes/__init__.py +++ b/lib/numina/recipes/__init__.py @@ -62,8 +62,8 @@ class RecipeBase: self.repeat = run.get('repeat', 1) self._current = 0 - def setup(self, _param): - warnings.warn("the setup method is deprecated", DeprecationWarning, stacklevel=2) + def setup(self): + pass def cleanup(self): '''Cleanup structures after recipe execution.'''
setup method is reserrected
guaix-ucm_pyemir
train
py
f36b3ad416fb06f6b9c42af92f5c46802a3c27ef
diff --git a/misc/log-analytics/import_logs.py b/misc/log-analytics/import_logs.py index <HASH>..<HASH> 100755 --- a/misc/log-analytics/import_logs.py +++ b/misc/log-analytics/import_logs.py @@ -1353,7 +1353,7 @@ class Parser(object): hit.host = config.options.log_hostname else: try: - hit.host = match.group('host') + hit.host = match.group('host').lower().strip('.') except IndexError: # Some formats have no host. pass
import_logs.py: lowercase the host and strip dots at both ends. git-svn-id: <URL>
matomo-org_matomo
train
py
6605ea95d6aa01975b1537c240f0fa09c6ff6b80
diff --git a/lib/ronin/config.rb b/lib/ronin/config.rb index <HASH>..<HASH> 100644 --- a/lib/ronin/config.rb +++ b/lib/ronin/config.rb @@ -38,10 +38,14 @@ module Ronin # Temporary file directory TMP_DIR = File.join(PATH,'tmp') + + # Directory for storing recovered remote files + FILES_DIR = File.join(PATH,'files') FileUtils.mkdir(PATH) unless File.directory?(PATH) FileUtils.mkdir(CONFIG_DIR) unless File.directory?(PATH) FileUtils.mkdir(TMP_DIR) unless File.directory?(TMP_DIR) + FileUtils.mkdir(FILES_DIR) unless File.directory?(FILES_DIR) # # Loads the Ronin configuration file.
Added the ~/.ronin/files/ directory for storing RemoteFiles.
ronin-ruby_ronin
train
rb
dab929bbc758012f558abee88cb5aa39095ebca6
diff --git a/setup.py b/setup.py index <HASH>..<HASH> 100644 --- a/setup.py +++ b/setup.py @@ -271,7 +271,7 @@ def get_version_info(): # If this is a release or another kind of source distribution of PyCBC except: - version = '1.7.5' + version = '1.7.6' release = 'True' date = hash = branch = tag = author = committer = status = builder = build_date = ''
set for <I> release (#<I>)
gwastro_pycbc
train
py
d4f244901a48464e583574adee9da27ee005a056
diff --git a/fermipy/jobs/batch.py b/fermipy/jobs/batch.py index <HASH>..<HASH> 100644 --- a/fermipy/jobs/batch.py +++ b/fermipy/jobs/batch.py @@ -48,7 +48,7 @@ def get_batch_job_interface(job_time=1500): if DEFAULT_JOB_TYPE == 'slac': from fermipy.jobs.slac_impl import SlacInterface - return Slac_Interface(**batch_job_args) + return SlacInterface(**batch_job_args) elif DEFAULT_JOB_TYPE == 'native': from fermipy.jobs.native_impl import NativeInterface - return Native_Interface(**batch_job_args) + return NativeInterface(**batch_job_args) diff --git a/fermipy/jobs/link.py b/fermipy/jobs/link.py index <HASH>..<HASH> 100644 --- a/fermipy/jobs/link.py +++ b/fermipy/jobs/link.py @@ -589,7 +589,7 @@ class Link(object): By default this checks the status of the top-level job """ - if key in self.jobs.has_key: + if key in self.jobs: status = self.jobs[key].status if status in [JobStatus.unknown, JobStatus.ready, JobStatus.pending, JobStatus.running] or force_check:
Fix a couple of minor issues left over from code cleanup
fermiPy_fermipy
train
py,py
51204d79bbc6c8e9da75bb613c90af76de1f5988
diff --git a/lib/conceptql/database.rb b/lib/conceptql/database.rb index <HASH>..<HASH> 100644 --- a/lib/conceptql/database.rb +++ b/lib/conceptql/database.rb @@ -1,4 +1,4 @@ -require 'facets/core/hash/revalue' +require 'facets/hash/revalue' module ConceptQL class Database
Fix incorrect require of hash/revalue
outcomesinsights_conceptql
train
rb
cf6bc67c62868919f26973ed60ad8190c2c5b5e8
diff --git a/lib/shopify_theme/cli.rb b/lib/shopify_theme/cli.rb index <HASH>..<HASH> 100644 --- a/lib/shopify_theme/cli.rb +++ b/lib/shopify_theme/cli.rb @@ -19,7 +19,7 @@ module ShopifyTheme desc "configure API_KEY PASSWORD STORE", "generate a config file for the store to connect to" def configure(api_key=nil, password=nil, store=nil) - config = {:api_key => api_key, :password => password, :store => store, :ignore_files => []} + config = {:api_key => api_key, :password => password, :store => store, :ignore_files => ["README"]} create_file('config.yml', config.to_yaml) end @@ -84,7 +84,7 @@ module ShopifyTheme end if !options['keep_files'] m.delete do |base, relative| - delete_asset(relative, options['quiet']) + delete_asset(relative, options['quiet']) if local_assets_list.include?(relative) end end end
default ignore files config, delete should check the ignore files as well
Shopify_shopify_theme
train
rb
8a81fe31ce8f0fa26fae7aa4ca776e30279dd3d4
diff --git a/Model/Variant.php b/Model/Variant.php index <HASH>..<HASH> 100644 --- a/Model/Variant.php +++ b/Model/Variant.php @@ -13,7 +13,6 @@ namespace Sylius\Component\Variation\Model; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; -use Sylius\Component\Resource\Model\SoftDeletableTrait; use Sylius\Component\Resource\Model\TimestampableTrait; /** diff --git a/Model/VariantInterface.php b/Model/VariantInterface.php index <HASH>..<HASH> 100644 --- a/Model/VariantInterface.php +++ b/Model/VariantInterface.php @@ -13,7 +13,6 @@ namespace Sylius\Component\Variation\Model; use Doctrine\Common\Collections\Collection; use Sylius\Component\Resource\Model\ResourceInterface; -use Sylius\Component\Resource\Model\SoftDeletableInterface; use Sylius\Component\Resource\Model\TimestampableInterface; /**
Get rid of the SoftDeletable Interface and Trait
Sylius_Variation
train
php,php
04997bc40b5fde6b7c94987da8eb237411acbb32
diff --git a/lib/ovirt/vm.rb b/lib/ovirt/vm.rb index <HASH>..<HASH> 100644 --- a/lib/ovirt/vm.rb +++ b/lib/ovirt/vm.rb @@ -174,8 +174,9 @@ module OVIRT unless runcmd.nil? runcmd.each do |cmd| cmdlist = \ - "#{cmdlist}\n" \ - "- #{cmd}\n" + "#{cmdlist}\n" \ + "- |\n"\ + " #{cmd.lines.join(" ")}\n" end if extracmd.nil? extracmd = cmdlist
Support for multi-line runcmd params In Foreman, we use cloud-init templates like this: ``` runcmd: - | echo 1 echo 2 echo 3 - | echo a echo b echo c ``` Currently, the rbovirt is preparing the cloud-init template, it counts on the fact the runcmd are only single lines, which limits it's use significantly.
abenari_rbovirt
train
rb
5a51187be3e2ded5c5910789f96c31ea72caddf4
diff --git a/urwid_datatable/datatable.py b/urwid_datatable/datatable.py index <HASH>..<HASH> 100644 --- a/urwid_datatable/datatable.py +++ b/urwid_datatable/datatable.py @@ -1255,7 +1255,7 @@ class DataTable(urwid.WidgetWrap, MutableSequence): # raise Exception(columns) # for c in self.columns: # self.remove_column(c.name) - del self.columns[:] + self.columns = [] for c in columns: self._add_column(c) self.update_header()
Fix another bug with removing columns.
tonycpsu_panwid
train
py
b2fe19ce71894e141568f22500a3d7748390a660
diff --git a/index.js b/index.js index <HASH>..<HASH> 100644 --- a/index.js +++ b/index.js @@ -250,22 +250,6 @@ function session(options){ : rawCookie; } - // set-cookie - var writeHead = res.writeHead; - res.writeHead = function(){ - if (!req.session) { - debug('no session'); - writeHead.apply(res, arguments); - return; - } - - var val = 's:' + signature.sign(req.sessionID, secret); - val = cookie.serialize(key, val); - debug('set-cookie %s', val); - res.setHeader('Set-Cookie', val); - writeHead.apply(res, arguments); - }; - // proxy end() to commit the session var end = res.end; res.end = function(data, encoding){
forgot part of set-cookie to remove
trestoa_token-session
train
js
3e049172980cf8c4169b50dc8ddb5a53bebb0368
diff --git a/cli/Valet/Valet.php b/cli/Valet/Valet.php index <HASH>..<HASH> 100644 --- a/cli/Valet/Valet.php +++ b/cli/Valet/Valet.php @@ -80,7 +80,7 @@ class Valet $url = 'https://api.github.com/repos/laravel/valet/releases/latest'; $response = Utils::jsonDecode((new Client())->get($url)->getBody()); - return version_compare($currentVersion, trim($response->body->tag_name, 'v'), '>='); + return version_compare($currentVersion, trim($response->tag_name, 'v'), '>='); } /**
Access `tag_name` directly Since `$response` is the response body now the body below is obsolete.
laravel_valet
train
php
aa79801f904a8c6dbc47f4a75bc2a1fced15054c
diff --git a/src/android/CameraPreview.java b/src/android/CameraPreview.java index <HASH>..<HASH> 100644 --- a/src/android/CameraPreview.java +++ b/src/android/CameraPreview.java @@ -466,9 +466,6 @@ public class CameraPreview extends CordovaPlugin implements CameraActivity.Camer private boolean setOnPictureTakenHandler(JSONArray args, CallbackContext callbackContext) { Log.d(TAG, "setOnPictureTakenHandler"); takePictureCallbackContext = callbackContext; - PluginResult pluginResult = new PluginResult(PluginResult.Status.OK); - pluginResult.setKeepCallback(true); - callbackContext.sendPluginResult(pluginResult); return true; } }
fix: setOnPictureTakenHandler should not be called back immediately after set (#<I>)
cordova-plugin-camera-preview_cordova-plugin-camera-preview
train
java
d5384f1abf551bbea7cdc23742f2abce4a832ddb
diff --git a/wandb/integration/keras/keras.py b/wandb/integration/keras/keras.py index <HASH>..<HASH> 100644 --- a/wandb/integration/keras/keras.py +++ b/wandb/integration/keras/keras.py @@ -1014,7 +1014,8 @@ class WandbCallback(tf.keras.callbacks.Callback): self.model.save(self.filepath[:-3], overwrite=True, save_format="tf") # Log the model as artifact. - model_artifact = wandb.Artifact(f"model-{wandb.run.name}", type="model") + name = wandb.util.make_artifact_name_safe(f"model-{wandb.run.name}") + model_artifact = wandb.Artifact(name, type="model") model_artifact.add_dir(self.filepath[:-3]) wandb.run.log_artifact(model_artifact, aliases=["latest", f"epoch_{epoch}"])
sanitize run name (#<I>)
wandb_client
train
py
10a70b8192cedc2ae80f44aac1b61f3ca0ab6cbd
diff --git a/lib/devise/models/timeoutable.rb b/lib/devise/models/timeoutable.rb index <HASH>..<HASH> 100644 --- a/lib/devise/models/timeoutable.rb +++ b/lib/devise/models/timeoutable.rb @@ -12,13 +12,12 @@ module Devise # Checks whether the user session has expired based on configured time. def timeout?(last_access) - last_access && last_access <= timeout.ago.utc + last_access && last_access <= self.class.timeout.ago.utc end module ClassMethods + Devise::Models.config(self, :timeout) end - - Devise::Models.config(self, :timeout) end end end diff --git a/test/models_test.rb b/test/models_test.rb index <HASH>..<HASH> 100644 --- a/test/models_test.rb +++ b/test/models_test.rb @@ -115,7 +115,7 @@ class ActiveRecordTest < ActiveSupport::TestCase end test 'set a default value for timeout' do - assert_equal 15.minutes, Configurable.new.timeout + assert_equal 15.minutes, Configurable.timeout end test 'set null fields on migrations' do
Updating timeoutable with last devise changes.
plataformatec_devise
train
rb,rb
371998239913c280a436e4486946d90b287ad60e
diff --git a/tests/integration/modules/event.py b/tests/integration/modules/event.py index <HASH>..<HASH> 100644 --- a/tests/integration/modules/event.py +++ b/tests/integration/modules/event.py @@ -81,7 +81,7 @@ class EventModuleTest(integration.ModuleCase): with self.assertRaises(Empty): eventfired = events.get(block=True, timeout=10) - def test_event_fire_ipc_mode_tcp(self): + def __test_event_fire_ipc_mode_tcp(self): events = Queue() def get_event(events):
stub out another event test that needs refinement
saltstack_salt
train
py
923e40e5fa7d2e68ebc2b4d475668fd47584c7e8
diff --git a/cumulusci/core/flows.py b/cumulusci/core/flows.py index <HASH>..<HASH> 100644 --- a/cumulusci/core/flows.py +++ b/cumulusci/core/flows.py @@ -175,7 +175,12 @@ class BaseFlow(object): self._run_task(flow_task_config) def _run_flow(self, flow_task_config): - flow = BaseFlow( + class_path = flow_task_config['task_config'].config.get( + 'class_path', + 'cumulusci.core.flows.BaseFlow', + ) + flow_class = import_class(class_path) + flow = flow_class( self.project_config, flow_task_config['task_config'], self.org_config,
support class override for nested flows
SFDO-Tooling_CumulusCI
train
py
1caf9854deecbcdbd6dd992d8c7b260f313267ed
diff --git a/servers/src/main/java/tachyon/UserInfo.java b/servers/src/main/java/tachyon/UserInfo.java index <HASH>..<HASH> 100644 --- a/servers/src/main/java/tachyon/UserInfo.java +++ b/servers/src/main/java/tachyon/UserInfo.java @@ -57,14 +57,14 @@ public class UserInfo { @Override public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - UserInfo userInfo = (UserInfo) o; - return mUserId == userInfo.mUserId; + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + UserInfo userInfo = (UserInfo) o; + return mUserId == userInfo.mUserId; } @Override public int hashCode() { - return (int) (mUserId ^ (mUserId >>> 32)); + return (int) (mUserId ^ (mUserId >>> 32)); } }
Update UserInfo.java fixed indentation.
Alluxio_alluxio
train
java
8e6aefb48793518ee1551d943e7c6580af62f250
diff --git a/test/integration/fixtures/adapter.withHandlers.fixture.js b/test/integration/fixtures/adapter.withHandlers.fixture.js index <HASH>..<HASH> 100644 --- a/test/integration/fixtures/adapter.withHandlers.fixture.js +++ b/test/integration/fixtures/adapter.withHandlers.fixture.js @@ -10,7 +10,7 @@ module.exports = { // // The tests work by passing a `_simulate` option as a property to the first argument, // which might be `options` or `values`. If `options`, it's a criteria, so we have to - // check the `where` + // check the `where` since it's being automatically normalized in Waterline core. find: function (cid, options, cb) { return _interpretUsageTest(options.where && options.where._simulate, cb); },
Bit more explanation on why we have to look in 'where' in our test fixture for handlers (automatically normalized)
balderdashy_waterline
train
js
36248569c073a2f43fc4d7d0cf199fd445adba4a
diff --git a/lib/rabbitmq/channel.rb b/lib/rabbitmq/channel.rb index <HASH>..<HASH> 100644 --- a/lib/rabbitmq/channel.rb +++ b/lib/rabbitmq/channel.rb @@ -35,13 +35,13 @@ module RabbitMQ end # @see {Connection#on_event} - def on(event_type, callable=nil, &block) - @connection.on_event(@id, event_type, callable, &block) + def on(*args, &block) + @connection.on_event(@id, *args, &block) end # @see {Connection#run_loop!} - def run_loop! - @connection.run_loop! + def run_loop!(*args) + @connection.run_loop!(*args) end # @see {Connection#break!}
Fix signature of forwarding methods in Channel to be more general.
jemc_ruby-rabbitmq
train
rb
cce06e7f5d4d86518ae7b44c8ac0c4b423a69b6a
diff --git a/webpack.config.js b/webpack.config.js index <HASH>..<HASH> 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -1,4 +1,4 @@ require('argv-set-env')(); var webpack = require('./webpack/config')[process.env.NODE_ENV === 'development' ? 'dist' : 'prod']; -module.exports = webpack; \ No newline at end of file +module.exports = webpack; diff --git a/webpack/build.js b/webpack/build.js index <HASH>..<HASH> 100644 --- a/webpack/build.js +++ b/webpack/build.js @@ -22,4 +22,4 @@ module.exports = function (type) { } ]; } -}; \ No newline at end of file +};
style: missing new lines in webpack
formly-js_angular-formly-templates-material
train
js,js
4f72534121ef7d9928a2c734dfc439d718db2d13
diff --git a/lib/hobo/virtual_box.rb b/lib/hobo/virtual_box.rb index <HASH>..<HASH> 100644 --- a/lib/hobo/virtual_box.rb +++ b/lib/hobo/virtual_box.rb @@ -27,6 +27,7 @@ class VirtualBox "cableconnected1" => "on", "nictrace1" => "off", "bridgeadapter1" => "en0: Ethernet", + "macaddress1" => "08002771F257", # Ports "audio" => "none", "clipboard" => "bidirectional",
Hard code MAC address for NIC. Must match the base VM.
hashicorp_vagrant
train
rb
09d2ff12c9deed9ca4f8fa08a2ca4173a7ec817a
diff --git a/definitions/npm/react-apollo_v2.x.x/flow_v0.58.x-/react-apollo_v2.x.x.js b/definitions/npm/react-apollo_v2.x.x/flow_v0.58.x-/react-apollo_v2.x.x.js index <HASH>..<HASH> 100644 --- a/definitions/npm/react-apollo_v2.x.x/flow_v0.58.x-/react-apollo_v2.x.x.js +++ b/definitions/npm/react-apollo_v2.x.x/flow_v0.58.x-/react-apollo_v2.x.x.js @@ -206,7 +206,7 @@ declare module 'react-apollo' { declare export function cleanupApolloState(apolloState: any): void; declare type QueryRenderPropFunction<TData, TVariables> = ({ - data: TData, + data?: TData, loading: boolean, error: ?ApolloError, variables: TVariables,
[react-apollo] Fix Query component typing (#<I>) If case of error, result object doesn't contain `data` property, please see the original TypeScript typings: <URL>
flow-typed_flow-typed
train
js
a7c97281075bd43b9f842bb21bcc6c25d46b4aa3
diff --git a/lib/cancan/ability.rb b/lib/cancan/ability.rb index <HASH>..<HASH> 100644 --- a/lib/cancan/ability.rb +++ b/lib/cancan/ability.rb @@ -283,9 +283,9 @@ module CanCan protected - def rules - @rules - end + # Must be protected as an ability can merge with other abilities. + # This means that an ability must expose their rules with another ability. + attr_reader :rules private @@ -356,8 +356,7 @@ module CanCan def alternative_subjects(subject) subject = subject.class unless subject.is_a?(Module) - descendants = [] - [:all, *subject.ancestors, *descendants, subject.class.to_s] + [:all, *subject.ancestors, subject.class.to_s] end # Returns an array of Rule instances which match the action and subject
Minor ability cleanup. decendants in the alternative_subjects methods will never not be an empty array. We can remove this statement. Make rules an attr_reader and add a bit of documentations as to why it needs to be protected, as this is one of the -few- cases in ruby where it makes sense for it to be so.
CanCanCommunity_cancancan
train
rb
b30510f824c441f2e697be7a486323c5aa51364f
diff --git a/kbfsblock/bserver_constants.go b/kbfsblock/bserver_constants.go index <HASH>..<HASH> 100644 --- a/kbfsblock/bserver_constants.go +++ b/kbfsblock/bserver_constants.go @@ -8,5 +8,5 @@ const ( // ServerTokenServer is the expected server type for bserver authentication. ServerTokenServer = "kbfs_block" // ServerTokenExpireIn is the TTL to use when constructing an authentication token. - ServerTokenExpireIn = 2 * 60 * 60 // 2 hours + ServerTokenExpireIn = 24 * 60 * 60 // 24 hours ) diff --git a/kbfsmd/server_constants.go b/kbfsmd/server_constants.go index <HASH>..<HASH> 100644 --- a/kbfsmd/server_constants.go +++ b/kbfsmd/server_constants.go @@ -8,5 +8,5 @@ const ( // ServerTokenServer is the expected server type for mdserver authentication. ServerTokenServer = "kbfs_md" // ServerTokenExpireIn is the TTL to use when constructing an authentication token. - ServerTokenExpireIn = 2 * 60 * 60 // 2 hours + ServerTokenExpireIn = 24 * 60 * 60 // 24 hours )
kbfsmd/kbfsblock: Increase bserver and mdserver token expiry times. Needs to be deployed before any clients start sending such expire times.
keybase_client
train
go,go
822270dc1a739b0d0772160ffddadba474e09cc2
diff --git a/define-test.js b/define-test.js index <HASH>..<HASH> 100644 --- a/define-test.js +++ b/define-test.js @@ -1489,3 +1489,18 @@ QUnit.test("async setter is provided", 5, function(){ QUnit.equal(instance.prop2, 9, "used async setter updates after"); }); + +QUnit.test('setter with default value causes an infinite loop (#142)', function(){ + var A = define.Constructor({ + val: { + value: 'hello', + set(val){ + console.log(this.val); + return val; + } + } + }); + + var a = new A(); + QUnit.equal(a.val, 'hello', 'creating an instance should not cause an inifinte loop'); +});
adding test for ininite loop issue
canjs_can-define
train
js
8c0a940cdb85b40c49009a92f6d0d6da9e827f3f
diff --git a/src/structures/Channel.js b/src/structures/Channel.js index <HASH>..<HASH> 100644 --- a/src/structures/Channel.js +++ b/src/structures/Channel.js @@ -100,17 +100,12 @@ class Channel extends Base { const Structures = require('../util/Structures'); let channel; if (!data.guild_id && !guild) { - switch (data.type) { - case ChannelTypes.DM: { - const DMChannel = Structures.get('DMChannel'); - channel = new DMChannel(client, data); - break; - } - case ChannelTypes.GROUP: { - const PartialGroupDMChannel = require('./PartialGroupDMChannel'); - channel = new PartialGroupDMChannel(client, data); - break; - } + if ((data.recipients && data.type !== ChannelTypes.GROUP) || data.type === ChannelTypes.DM) { + const DMChannel = Structures.get('DMChannel'); + channel = new DMChannel(client, data); + } else if (data.type === ChannelTypes.GROUP) { + const PartialGroupDMChannel = require('./PartialGroupDMChannel'); + channel = new PartialGroupDMChannel(client, data); } } else { guild = guild || client.guilds.cache.get(data.guild_id);
fix(Channel): ensure partial DMChannels get created (#<I>)
discordjs_discord.js
train
js
28760875277b1767cdb929058e8a564edfb86780
diff --git a/src/Illuminate/Database/Query/Builder.php b/src/Illuminate/Database/Query/Builder.php index <HASH>..<HASH> 100755 --- a/src/Illuminate/Database/Query/Builder.php +++ b/src/Illuminate/Database/Query/Builder.php @@ -715,7 +715,7 @@ class Builder * Add a raw or where clause to the query. * * @param string $sql - * @param array $bindings + * @param mixed $bindings * @return \Illuminate\Database\Query\Builder|static */ public function orWhereRaw($sql, $bindings = [])
Update orWhereRaw docblock following #<I> (#<I>) Thanks @a-komarev for pointing out.
laravel_framework
train
php
0fe536a74a545346ecd7a79d8d2b51b0d0c2f978
diff --git a/mdc_api/mdc_api.py b/mdc_api/mdc_api.py index <HASH>..<HASH> 100755 --- a/mdc_api/mdc_api.py +++ b/mdc_api/mdc_api.py @@ -448,12 +448,21 @@ class connector: :return: successful ``.status_code`` / ``.is_done``. Check the ``.error`` :rtype: asyncResult ''' + if isinstance(JSONdata,str) and self._isJSON(JSONdata): + self.log.warn("pre-subscription data was a string, converting to a list : %s",JSONdata) + JSONdata = json.loads(JSONdata) # convert json string to list + if not (isinstance(JSONdata,list) and self._isJSON(JSONdata)): + self.log.error("pre-subscription data is not valid. Please make sure it is a valid JSON list") result = asyncResult() data = self._putURL("/subscriptions",JSONdata, versioned=False) - if data.status_code == 200: #immediate success + if data.status_code == 200: #immediate success with response result.error = False result.is_done = True result.result = data.json() + elif data.status_code == 204: # immediate success with no response + result.error = False + result.is_done = True + result.result = [] else: result.error = response_codes("presubscription",data.status_code) result.is_done = True
fixed putPreSubscription to handle both list and str json objects, enhanced return code handling
ARMmbed_mbed-connector-api-python
train
py
c73248775b933e3fce8af0148e198f1af2df2c68
diff --git a/gandi/cli/modules/vhost.py b/gandi/cli/modules/vhost.py index <HASH>..<HASH> 100644 --- a/gandi/cli/modules/vhost.py +++ b/gandi/cli/modules/vhost.py @@ -45,6 +45,7 @@ class Vhost(GandiModule): cls.echo("We're creating a new vhost.") cls.display_progress(result) cls.echo('Your vhost %s have been created.' % vhost) + return result @classmethod def delete(cls, resources, background=False):
To know if something was done during the process.
Gandi_gandi.cli
train
py
7b7f68f284cc95f90486fe9456622c1cc0c79cce
diff --git a/tests/test_extra.py b/tests/test_extra.py index <HASH>..<HASH> 100644 --- a/tests/test_extra.py +++ b/tests/test_extra.py @@ -637,7 +637,8 @@ def test_promises_with_only_then(): promise3 = promise1.then(lambda x: None) context["promise1_reject"](error) - promise1._wait() + promise2._wait() + promise3._wait() assert promise2.reason == error assert promise3.reason == error diff --git a/tests/test_issues.py b/tests/test_issues.py index <HASH>..<HASH> 100644 --- a/tests/test_issues.py +++ b/tests/test_issues.py @@ -61,9 +61,11 @@ def test_issue_26(): context["promise1_reject"](RuntimeError("Ooops!")) promise2 = Promise(lambda resolve, reject: context.update({"promise2_resolve": resolve})) - promise2.then(lambda x: context.update({"success": True})) + promise3 = promise2.then(lambda x: context.update({"success": True})) context["promise2_resolve"](None) + # We wait so it works in asynchronous envs + promise3._wait(timeout=.1) assert context["success"]
Fixed tests in async environments
syrusakbary_promise
train
py,py
c6bdeb0c35eb4b1f9b915ebadc7f7a9bc9cd4659
diff --git a/safe_qgis/widgets/dock.py b/safe_qgis/widgets/dock.py index <HASH>..<HASH> 100644 --- a/safe_qgis/widgets/dock.py +++ b/safe_qgis/widgets/dock.py @@ -1929,11 +1929,13 @@ class Dock(QtGui.QDockWidget, Ui_DockBase): mySettings = QSettings() lastSaveDir = mySettings.value('inasafe/lastSourceDir', '.') lastSaveDir = str(lastSaveDir.toString()) + default_name = myTitle.replace( + ' ', '_').replace('(', '').replace(')', '') if theScenarioFilePath is None: # noinspection PyCallByClass,PyTypeChecker myFileName = str(QFileDialog.getSaveFileName( self, myTitleDialog, - os.path.join(lastSaveDir, myTitle + '.txt'), + os.path.join(lastSaveDir, default_name + '.txt'), "Text files (*.txt)")) else: myFileName = theScenarioFilePath
Underscore separate batch file names by default.
inasafe_inasafe
train
py
f7bb08b6bd372be896ba8aeccf8b389d7cb05b0c
diff --git a/src/main/java/com/ibm/stocator/fs/swift/SwiftAPIClient.java b/src/main/java/com/ibm/stocator/fs/swift/SwiftAPIClient.java index <HASH>..<HASH> 100644 --- a/src/main/java/com/ibm/stocator/fs/swift/SwiftAPIClient.java +++ b/src/main/java/com/ibm/stocator/fs/swift/SwiftAPIClient.java @@ -497,7 +497,9 @@ public class SwiftAPIClient implements IStoreClient { LOG.trace("{} does not match {}. Skipped", unifiedObjectName, obj); continue; } - if (isSparkOrigin(unifiedObjectName) && !fullListing) { + LOG.trace("Unified name: {}, path {}", unifiedObjectName, tmp.getName()); + if (!unifiedObjectName.equals(tmp.getName()) && isSparkOrigin(unifiedObjectName) + && !fullListing) { LOG.trace("{} created by Spark", unifiedObjectName); if (!isJobSuccessful(unifiedObjectName)) { LOG.trace("{} created by failed Spark job. Skipped", unifiedObjectName);
no need to check isSparkOrigin on objects that unified name equals object name
CODAIT_stocator
train
java
3d142fb0bc92ecbc48453cd4234ef9423f6f050a
diff --git a/lib/services/s3.js b/lib/services/s3.js index <HASH>..<HASH> 100644 --- a/lib/services/s3.js +++ b/lib/services/s3.js @@ -495,7 +495,7 @@ AWS.util.update(AWS.S3.prototype, { return done(); } - var regionReq = req.service.listObjects({Bucket: bucket}); + var regionReq = req.service.listObjects({Bucket: bucket, MaxKeys: 0}); regionReq._requestRegionForBucket = bucket; regionReq.send(function() { var region = req.service.bucketRegionCache[bucket] || null; @@ -535,7 +535,7 @@ AWS.util.update(AWS.S3.prototype, { } done(); } else if (request.httpRequest.virtualHostedBucket) { - var getRegionReq = service.listObjects({Bucket: bucket}); + var getRegionReq = service.listObjects({Bucket: bucket, MaxKeys: 0}); service.updateReqBucketRegion(getRegionReq, 'us-east-1'); getRegionReq._requestRegionForBucket = bucket;
For internal SDK requests for bucket region, adds a MaxKeys constraint of 0 so that response will not return any object keys. Although in most cases the request will return an error as well as the region and not be retried, there are some cases in the browser where the request may succeed and return a list of object keys, so this new constraint addresses those cases.
aws_aws-sdk-js
train
js
fed6da136d88c7ebcf35535f0aa69c4d6d123e30
diff --git a/bulk_writer.js b/bulk_writer.js index <HASH>..<HASH> 100644 --- a/bulk_writer.js +++ b/bulk_writer.js @@ -1,3 +1,5 @@ +/* eslint no-underscore-dangle: ["error", { "allow": ["_index", "_type"] }] */ + const fs = require('fs'); const path = require('path'); const Promise = require('promise');
allow understcode dangling for _index and _type (expected by ES client)
vanthome_winston-elasticsearch
train
js
9548ab59940ea6e6b277250e07c4f0ce53a8c1a4
diff --git a/lib/sendwithus_ruby_action_mailer/version.rb b/lib/sendwithus_ruby_action_mailer/version.rb index <HASH>..<HASH> 100644 --- a/lib/sendwithus_ruby_action_mailer/version.rb +++ b/lib/sendwithus_ruby_action_mailer/version.rb @@ -1,3 +1,3 @@ module SendWithUsMailer - VERSION = "0.4.0" + VERSION = "1.0.0" end
Update the version number to <I>
sendwithus_sendwithus_ruby_action_mailer
train
rb
77c1278888429b4d6d17554155bc411c8d67a99f
diff --git a/src/browser/extension/inject/pageScript.js b/src/browser/extension/inject/pageScript.js index <HASH>..<HASH> 100644 --- a/src/browser/extension/inject/pageScript.js +++ b/src/browser/extension/inject/pageScript.js @@ -185,9 +185,11 @@ const preEnhancer = instanceId => next => const store = next(reducer, preloadedState, enhancer); // Mutate the store in order to keep the reference - stores[instanceId].dispatch = store.dispatch; - stores[instanceId].liftedStore = store.liftedStore; - stores[instanceId].getState = store.getState; + if (stores[instanceId]) { + stores[instanceId].dispatch = store.dispatch; + stores[instanceId].liftedStore = store.liftedStore; + stores[instanceId].getState = store.getState; + } return { ...store,
Don't update the store when the page is blacklisted in settings
zalmoxisus_redux-devtools-extension
train
js
3ba2f45cd9eab89ad78af88c144321a0991b34a5
diff --git a/lib/fog/dreamhost/dns.rb b/lib/fog/dreamhost/dns.rb index <HASH>..<HASH> 100644 --- a/lib/fog/dreamhost/dns.rb +++ b/lib/fog/dreamhost/dns.rb @@ -1,6 +1,5 @@ require File.expand_path(File.join(File.dirname(__FILE__), '..', 'dreamhost')) require 'fog/dns' -require 'uuid' module Fog module DNS @@ -70,8 +69,7 @@ module Fog def request(params) params[:query].merge!( { :key => @dreamhost_api_key, - :format => 'json', - :unique_id => UUID.generate } ) + :format => 'json' } ) response = @connection.request(params) unless response.body.empty?
[dreamhost|dns] drop uuid gem requirements, not needed Not sure to understand unique_id documentation from Dreamhost, but experimentation shows that a new UUID every request isn't required and Dreamhost says it's optional. <URL>
fog_fog
train
rb
d93c95a332b65948cf37a87a84900323657571f0
diff --git a/integration-cli/docker_cli_top_test.go b/integration-cli/docker_cli_top_test.go index <HASH>..<HASH> 100644 --- a/integration-cli/docker_cli_top_test.go +++ b/integration-cli/docker_cli_top_test.go @@ -52,7 +52,7 @@ func TestTopPrivileged(t *testing.T) { topCmd = exec.Command(dockerBinary, "top", cleanedContainerID) out2, _, err2 := runCommandWithOutput(topCmd) - errorOut(err, t, fmt.Sprintf("failed to run top: %v %v", out2, err2)) + errorOut(err2, t, fmt.Sprintf("failed to run top: %v %v", out2, err2)) killCmd := exec.Command(dockerBinary, "kill", cleanedContainerID) _, err = runCommand(killCmd)
Fixed error check using the wrong error value errorOut was using the err from the previous test. same as #<I> but on TestTopPrivileged, which I missed last time
moby_moby
train
go
3440869716f73c14a5fc45c31404b877575dd5cc
diff --git a/lib/jazzy/sourcekitten.rb b/lib/jazzy/sourcekitten.rb index <HASH>..<HASH> 100644 --- a/lib/jazzy/sourcekitten.rb +++ b/lib/jazzy/sourcekitten.rb @@ -97,13 +97,11 @@ module Jazzy # Determine the subdirectory in which a doc should be placed def self.subdir_for_doc(doc, parents) - # To group docs by category file instead of declaration type, - # return parents.map(&:name) - - if doc.type.name - [doc.type.plural_name] - else - [] + parents.map(&:name).tap do |names| + # We always want to create top-level subdirs according to type (Struct, + # Class, etc), but parents[0] might be a custom category name. + top_level_decl = (parents + [doc])[1] + names[0] = top_level_decl.type.plural_name if top_level_decl end end
Fixed subdirs for nested types e.g. Classes/Request/TaskDelegate.html, not Classes/TaskDelegate.html
realm_jazzy
train
rb
b2ec8c6e1afb178adec9d295675a5482a4b58a1b
diff --git a/dropwizard-core/src/test/java/io/dropwizard/validation/InjectValidatorFeatureTest.java b/dropwizard-core/src/test/java/io/dropwizard/validation/InjectValidatorFeatureTest.java index <HASH>..<HASH> 100644 --- a/dropwizard-core/src/test/java/io/dropwizard/validation/InjectValidatorFeatureTest.java +++ b/dropwizard-core/src/test/java/io/dropwizard/validation/InjectValidatorFeatureTest.java @@ -36,7 +36,7 @@ class InjectValidatorFeatureTest { private ValidatorFactory validatorFactory; @BeforeEach - void setUp() throws Exception { + void setUp() { Bootstrap<Configuration> bootstrap = new Bootstrap<>(application); application.initialize(bootstrap); @@ -57,14 +57,10 @@ class InjectValidatorFeatureTest { // Run validation manually Set<ConstraintViolation<Bean>> constraintViolations = validator.validate(new Bean(1)); - - assertThat(constraintViolations.size()).isEqualTo(1); - - Optional<String> message = constraintViolations.stream() - .findFirst() - .map(ConstraintViolation::getMessage); - - assertThat(message).hasValue("must be greater than or equal to 10"); + assertThat(constraintViolations) + .singleElement() + .extracting(ConstraintViolation::getMessage) + .isEqualTo("must be greater than or equal to 10"); } @Test
Simplify InjectValidatorFeatureTest
dropwizard_dropwizard
train
java
02d3b1d5fc58a24b1f5fee038ee387251a1a45db
diff --git a/spec/apruve/resources/order_spec.rb b/spec/apruve/resources/order_spec.rb index <HASH>..<HASH> 100644 --- a/spec/apruve/resources/order_spec.rb +++ b/spec/apruve/resources/order_spec.rb @@ -145,7 +145,7 @@ describe Apruve::Order do context 'successful response' do let! (:stubs) do faraday_stubs do |stub| - stub.get('/api/v4/orders') { [200, {}, '{}'] } + stub.get('/api/v4/orders') { [200, {}, '[]'] } end end it 'should get all orders' do
AP-<I>: changed spec response to contain json array not an object
apruve_apruve-ruby
train
rb
c1bdc2c58c5001a36196f81aaf696c89a5245caa
diff --git a/dragonpy/core/configs.py b/dragonpy/core/configs.py index <HASH>..<HASH> 100644 --- a/dragonpy/core/configs.py +++ b/dragonpy/core/configs.py @@ -130,6 +130,7 @@ class BaseConfig(object): self.mem_info = DummyMemInfo() self.memory_byte_middlewares = {} + self.memory_word_middlewares = {} def _get_initial_Memory(self, size): return [0x00] * size
bugfix: 'Cfg' object has no attribute 'memory_word_middlewares'
6809_MC6809
train
py
379bba537a4824952c9c3a17d1b6474ef1e2c3a6
diff --git a/Datagrid/PropelDatagrid.php b/Datagrid/PropelDatagrid.php index <HASH>..<HASH> 100644 --- a/Datagrid/PropelDatagrid.php +++ b/Datagrid/PropelDatagrid.php @@ -346,10 +346,8 @@ abstract class PropelDatagrid implements PropelDatagridInterface foreach ($sort as $column => $order) { $method = 'orderBy'.ucfirst($column); - try { + if (method_exists($this->getQuery(), $method)) { $this->getQuery()->{$method}($order); - } catch (\Exception $e) { - throw new \Exception('There is no method "'.$method.'" to sort the datagrid on column "'.$column.'". Just create it in the "'.get_class($this->query).'" object.'); } } }
Fail silently when sorting on unknown column.
spyrit_PropelDatagridBundle
train
php
00568cfa909e666117fbd84290923af890c4c667
diff --git a/tests/PackageManager/ComposerIOBridgeTest.php b/tests/PackageManager/ComposerIOBridgeTest.php index <HASH>..<HASH> 100644 --- a/tests/PackageManager/ComposerIOBridgeTest.php +++ b/tests/PackageManager/ComposerIOBridgeTest.php @@ -13,11 +13,6 @@ namespace Yosymfony\Spress\PackageManager; use Yosymfony\Spress\Core\IO\NullIO; -/** - * Bridge between Spress IO and Composer IO. - * - * @author Victor Puertas <vpgugr@gmail.com> - */ class ComposerIOBridgeTest extends \PHPUnit_Framework_TestCase { public function testVerbosity()
Deleted unnecesary docblock
spress_spress
train
php
9f1407ce696f807e3c00984ea29de201a6c015b5
diff --git a/lib/schema.js b/lib/schema.js index <HASH>..<HASH> 100644 --- a/lib/schema.js +++ b/lib/schema.js @@ -285,7 +285,7 @@ var RootTable = { return "CREATE TABLE " + this.name + "(" + atts.join(",") + ")"; }, toJSON: function () { - var o = { name : this.name, attributes: this.attributes }; + var o = { attributes: this.attributes }; if(this.constraints && this.constraints.length > 0) o.constraints = this.constraints; return o; },
table.name is not required in the json format (surrounding object holds name alredy)
arlac77_sorm
train
js
c01b4030c40afade249b578bf53d359508c44767
diff --git a/lib/autokey/scripting/engine.py b/lib/autokey/scripting/engine.py index <HASH>..<HASH> 100644 --- a/lib/autokey/scripting/engine.py +++ b/lib/autokey/scripting/engine.py @@ -91,9 +91,8 @@ class Engine: cannot use absolute paths.") path = parent_folder.expanduser() / title path.mkdir(parents=True, exist_ok=True) - new_folder = model.Folder(title) + new_folder = model.Folder(title, str(path.resolve()) self.configManager.allFolders.append(new_folder) - new_folder.path = str(path.resolve()) return new_folder # TODO: Convert this to use get_folder, when we change to specifying # the exact folder by more than just title.
Create_folder: Set path as arg, not after creation
autokey_autokey
train
py
ed6b6c6ce99ac3e97905e89fbb72aa20f81f261c
diff --git a/lib/adhearsion/console.rb b/lib/adhearsion/console.rb index <HASH>..<HASH> 100644 --- a/lib/adhearsion/console.rb +++ b/lib/adhearsion/console.rb @@ -33,10 +33,10 @@ module Adhearsion if libedit? logger.error "Cannot start. You are running Adhearsion on Ruby with libedit. You must use readline for the console to work." else - logger.info "Starting up..." + logger.info "Launching Adhearsion Console" @pry_thread = Thread.current pry - logger.info "Console exiting" + logger.info "Adhearsion Console exiting" end end diff --git a/lib/adhearsion/router.rb b/lib/adhearsion/router.rb index <HASH>..<HASH> 100644 --- a/lib/adhearsion/router.rb +++ b/lib/adhearsion/router.rb @@ -23,7 +23,7 @@ module Adhearsion def handle(call) return unless route = match(call) - logger.debug "Call #{call.id} passing through router matched route #{route}" + logger.debug "Call #{call.id} selected route \"#{route.name}\" (#{route.target})" route.dispatcher end end
Tweak log messages for readability
adhearsion_adhearsion
train
rb,rb
9b5001c337f4160837bff59d0c0d91f1e19cca74
diff --git a/openquake/calculators/hazard/disagg/core.py b/openquake/calculators/hazard/disagg/core.py index <HASH>..<HASH> 100644 --- a/openquake/calculators/hazard/disagg/core.py +++ b/openquake/calculators/hazard/disagg/core.py @@ -19,6 +19,7 @@ Disaggregation calculator core functionality """ import nhlib +import numpy from django.db import transaction @@ -116,8 +117,9 @@ def compute_disagg(job_id, points, lt_rlz_id): hazard_curve__sa_damping=sa_damping, ) - for poe in []: - pass + for poe in hc.poes_disagg: + iml = numpy.interp(poe, curve.poes[::-1], imls) + logs.LOG.warn('iml is %s' % iml) # TODO: for each disagg poe, interpolate IML for the curve # TODO: load the site model, if there is one # TODO: Prepare the args for the calculator.
calcs/hazard/disagg/core: Added sketch of curve interpolation.
gem_oq-engine
train
py
54a118d4b2ab2a21e05bc2e9bf92947993d67c0c
diff --git a/rspec-crispy/spec/rspec/crispy/configure_without_conflict_spec.rb b/rspec-crispy/spec/rspec/crispy/configure_without_conflict_spec.rb index <HASH>..<HASH> 100644 --- a/rspec-crispy/spec/rspec/crispy/configure_without_conflict_spec.rb +++ b/rspec-crispy/spec/rspec/crispy/configure_without_conflict_spec.rb @@ -112,6 +112,13 @@ RSpec.describe ::RSpec::Crispy do context 'with arguments' do + context 'given a method and arguments ObjectClass actually called' do + let(:method_name){ :hoge } + let(:arguments){ [1, 1, 1] } + + it { is_expected.to be_matches(ObjectClass) } + end + end end
add spec when given argument to have_received
igrep_crispy
train
rb
b3135254dd4c0e932441d0c6ee752cc3a2f8cdc8
diff --git a/src/Symfony/Bundle/TwigBundle/CacheWarmer/TemplateCacheCacheWarmer.php b/src/Symfony/Bundle/TwigBundle/CacheWarmer/TemplateCacheCacheWarmer.php index <HASH>..<HASH> 100644 --- a/src/Symfony/Bundle/TwigBundle/CacheWarmer/TemplateCacheCacheWarmer.php +++ b/src/Symfony/Bundle/TwigBundle/CacheWarmer/TemplateCacheCacheWarmer.php @@ -26,7 +26,7 @@ use Symfony\Bundle\FrameworkBundle\CacheWarmer\TemplateFinderInterface; class TemplateCacheCacheWarmer implements CacheWarmerInterface { protected $container; - protected $warmer; + protected $finder; /** * Constructor.
Rename misprint property (from warmer to finder)
symfony_symfony
train
php
9b81f63bd1bfa3813efa24017abfb987c5f5bb53
diff --git a/src/photini/__init__.py b/src/photini/__init__.py index <HASH>..<HASH> 100644 --- a/src/photini/__init__.py +++ b/src/photini/__init__.py @@ -1,4 +1,4 @@ from __future__ import unicode_literals __version__ = '2016.08.0' -build = '683 (8b2ed70)' +build = '684 (d3a9ad5)' diff --git a/src/photini/photinimap.py b/src/photini/photinimap.py index <HASH>..<HASH> 100644 --- a/src/photini/photinimap.py +++ b/src/photini/photinimap.py @@ -141,6 +141,8 @@ class PhotiniMap(QtWidgets.QWidget): @QtCore.pyqtSlot(QtCore.QUrl) def link_clicked(self, url): + if url.isLocalFile(): + url.setScheme('http') webbrowser.open_new(url.toString()) @QtCore.pyqtSlot()
Ensure links from maps are not 'local'.
jim-easterbrook_Photini
train
py,py
75c6e4a1e78d52d698704ebe3a39a35b51c8ade7
diff --git a/raven/utils/stacks.py b/raven/utils/stacks.py index <HASH>..<HASH> 100644 --- a/raven/utils/stacks.py +++ b/raven/utils/stacks.py @@ -233,7 +233,7 @@ def get_stack_info(frames, transformer=transform, capture_locals=True, # This changes /foo/site-packages/baz/bar.py into baz/bar.py try: base_filename = sys.modules[module_name.split('.', 1)[0]].__file__ - filename = abs_path.split(base_filename.rsplit('/', 2)[0], 1)[-1][1:] + filename = abs_path.split(base_filename.rsplit('/', 2)[0], 1)[-1].lstrip("/") except: filename = abs_path
Use lstrip to get rid of leading slashes, because in some cases the paths have already been replaced.
getsentry_raven-python
train
py
38cd929fc88b757e0d91a05e270b32630e9c1e4c
diff --git a/src/Guzzle/Stream/Stream.php b/src/Guzzle/Stream/Stream.php index <HASH>..<HASH> 100644 --- a/src/Guzzle/Stream/Stream.php +++ b/src/Guzzle/Stream/Stream.php @@ -70,9 +70,7 @@ class Stream implements StreamInterface */ public function __destruct() { - if (is_resource($this->stream)) { - fclose($this->stream); - } + $this->close(); } /** @@ -92,6 +90,18 @@ class Stream implements StreamInterface } /** + * {@inheritdoc} + */ + public function close() + { + if (is_resource($this->stream)) { + fclose($this->stream); + } + $this->cache[self::IS_READABLE] = false; + $this->cache[self::IS_WRITABLE] = false; + } + + /** * Calculate a hash of a Stream * * @param StreamInterface $stream Stream to calculate the hash for diff --git a/src/Guzzle/Stream/StreamInterface.php b/src/Guzzle/Stream/StreamInterface.php index <HASH>..<HASH> 100644 --- a/src/Guzzle/Stream/StreamInterface.php +++ b/src/Guzzle/Stream/StreamInterface.php @@ -15,6 +15,11 @@ interface StreamInterface public function __toString(); /** + * Close the underlying stream + */ + public function close(); + + /** * Get stream metadata * * @param string $key Specific metadata to retrieve
Adding close() method to stream objects
guzzle_guzzle3
train
php,php
0f990938c276da8a6146979252af69ab101d12ec
diff --git a/tests/test_protobuf.py b/tests/test_protobuf.py index <HASH>..<HASH> 100644 --- a/tests/test_protobuf.py +++ b/tests/test_protobuf.py @@ -33,7 +33,7 @@ def doc_pb(): def test_parse_protobuf(doc_pb): - assert doc_pb.ByteSize() == 4239 + assert doc_pb.ByteSize() == 4709 def test_write_protobuf(doc_pb):
Update the expected size of the protobuf
stanfordnlp_stanza
train
py
94804accfd94aa3cec4b990280f57f13536ac80e
diff --git a/backend/handler.py b/backend/handler.py index <HASH>..<HASH> 100644 --- a/backend/handler.py +++ b/backend/handler.py @@ -171,7 +171,7 @@ class TensorboardHandler(BaseHTTPServer.BaseHTTPRequestHandler): code: The numeric HTTP status code to use. """ out = BytesIO() - f = gzip.GzipFile(fileobj=out, mode='wb') + f = gzip.GzipFile(fileobj=out, mode='wb', compresslevel=3) f.write(compat.as_bytes(content)) f.close() gzip_content = out.getvalue()
Make GZip faster for TensorBoard It turns out compresslevel=3 is 4x faster and nearly as good. Less time spent compressing is going to be important, because this HTTP server is multithreaded and CPU bound operations scale negatively, i.e. 1 + 1 < 1. Benchmark: <URL>
tensorflow_tensorboard
train
py
80956de70762a6051180819f29c1fd11ccfcfcd5
diff --git a/flattened_serializers.go b/flattened_serializers.go index <HASH>..<HASH> 100644 --- a/flattened_serializers.go +++ b/flattened_serializers.go @@ -1,6 +1,7 @@ package manta import ( + "encoding/json" "os" "github.com/dotabuff/manta/dota" @@ -40,6 +41,23 @@ type flattened_serializers struct { proto *dota.CSVCMsg_FlattenedSerializer } +// Dumps a flattened table as json +func (sers *flattened_serializers) dump_json(name string) string { + // Can't marshal map[int32]x + type jContainer struct { + Version int32 + Data *dt + } + + j := make([]jContainer, 0) + for i, o := range sers.Serializers[name] { + j = append(j, jContainer{i, o}) + } + + str, _ := json.MarshalIndent(j, "", " ") // two space ident + return string(str) +} + // Fills properties for a data table func (sers *flattened_serializers) recurse_table(cur *dota.ProtoFlattenedSerializerT) *dt { // Basic table structure
Added dump_json to flattened_serializers.go
dotabuff_manta
train
go
668fe804a7641f166b918c70b0e8eafcc673dc43
diff --git a/uproot_methods/convert.py b/uproot_methods/convert.py index <HASH>..<HASH> 100644 --- a/uproot_methods/convert.py +++ b/uproot_methods/convert.py @@ -58,6 +58,9 @@ def towriteable(obj): elif any(x == ("uproot_methods.classes.TH1", "Methods") for x in types(obj.__class__, obj)): return (None, None, "uproot.write.objects.TH1", "TH1") + elif any(x == ("TH1", "Methods") for x in types(obj.__class__, obj)): + return (None, None, "uproot.write.objects.TH1", "TH1") + else: raise TypeError("type {0} from module {1} is not writeable by uproot".format(obj.__class__.__name__, obj.__class__.__module__))
Write histogram read by uproot
scikit-hep_uproot-methods
train
py
88028533ca9a63fed4fcda2f7724c1af1155f342
diff --git a/src/_0_scripts/ie8-main.js b/src/_0_scripts/ie8-main.js index <HASH>..<HASH> 100644 --- a/src/_0_scripts/ie8-main.js +++ b/src/_0_scripts/ie8-main.js @@ -1,3 +1,10 @@ +// indexOf polyfill +// Minified version of this: +// https://stackoverflow.com/a/35054662/1611058 +if (!Array.prototype.indexOf) { + Array.prototype.indexOf=function(r){var t=this.length>0,i=Number(arguments[1])||0;for((i=i<0?Math.ceil(i):Math.floor(i))<0&&(i+=t);i<t;i++)if(i in this&&this[i]===r)return i;return-1}; +} + $(document).ready(function(){ //IE8 tabs code
Fixed IE8 js error I thought indexOf would be safe to use but apparantly it isn't. I'm adding a polyfill to make it safe
Dan503_gutter-grid
train
js
5f6246376b2f13bfe60ed0200a460758f7f117eb
diff --git a/index.js b/index.js index <HASH>..<HASH> 100644 --- a/index.js +++ b/index.js @@ -13,6 +13,7 @@ convert = function(source) { line, objectNames = [], output = {}, + parents, parentObj = {}, i, linesLength,
Added `parents` declaration
adrianlee44_ical2json
train
js
02bc13b91507fedf1ad9a62ea954dee76e525f08
diff --git a/studio/lib/archivefile.py b/studio/lib/archivefile.py index <HASH>..<HASH> 100644 --- a/studio/lib/archivefile.py +++ b/studio/lib/archivefile.py @@ -52,5 +52,4 @@ def extractall(archive, filename, dstdir): tar.extractall(path=dstdir) else: # seems to be a single file, save it - shutil.copyfile(archive, - file(os.path.join(dstdir, filename), 'wb')) + shutil.copyfile(archive, os.path.join(dstdir, filename))
shutil.copyfile does take a filename as the destination file to be written instead of a file object
camptocamp_Studio
train
py
0ada3fbfa4aeef94eb34d0c2678a36ce772f89d8
diff --git a/src/Leevel/Event/Observer.php b/src/Leevel/Event/Observer.php index <HASH>..<HASH> 100644 --- a/src/Leevel/Event/Observer.php +++ b/src/Leevel/Event/Observer.php @@ -68,7 +68,8 @@ class Observer implements SplObserver */ public function __invoke(...$args) { - call_user_func($this->handle, ...$args); + $handle = $this->handle; + $handle(...$args); } /**
perf(event): improves observer performance
hunzhiwange_framework
train
php
734a52e15a0e8c244d84d74acf3fd64721074732
diff --git a/rwa/pandas.py b/rwa/pandas.py index <HASH>..<HASH> 100644 --- a/rwa/pandas.py +++ b/rwa/pandas.py @@ -63,7 +63,11 @@ else: service.poke('name', ix.name, container, visited=visited, _stack=_stack) def peek_index(service, container, _stack=None, force_unicode=None): - data = service.peek('data', container, _stack=_stack) + try: + data = service.peek('data', container, _stack=_stack) + except KeyError: + # try loading it as a generic sequence (backward compatibility) + data = service.byPythonType(list, True).peek(service, container, _stack=_stack) try: name = service.peek('name', container, _stack=_stack) except (SystemExit, KeyboardInterrupt):
backward compatibility bugfix for Pandas' Index
DecBayComp_RWA-python
train
py
4d05e233de4cbb77f5998ad86be7f921d521ff37
diff --git a/tests/test_pandora/test_models.py b/tests/test_pandora/test_models.py index <HASH>..<HASH> 100644 --- a/tests/test_pandora/test_models.py +++ b/tests/test_pandora/test_models.py @@ -253,3 +253,23 @@ class TestAdItem(TestCase): self.result.prepare_playback() assert self.result.register_ad.called assert super_mock.called + + def test_prepare_playback_raises_paramater_missing(self): + with patch.object(PlaylistModel, 'prepare_playback') as super_mock: + + self.result.register_ad = Mock(side_effect=ParameterMissing('No ad tracking tokens provided for ' + 'registration.') + ) + self.assertRaises(ParameterMissing, self.result.prepare_playback) + assert self.result.register_ad.called + assert not super_mock.called + + def test_prepare_playback_handles_paramater_missing_if_no_tokens(self): + with patch.object(PlaylistModel, 'prepare_playback') as super_mock: + + self.result.tracking_tokens = [] + self.result.register_ad = Mock(side_effect=ParameterMissing('No ad tracking tokens provided for ' + 'registration.')) + self.result.prepare_playback() + assert self.result.register_ad.called + assert super_mock.called
Test cases for handling exceptions in prepare_playback.
mcrute_pydora
train
py
b202d910dcd47e0a3f2c2b4e75497ec1537503bc
diff --git a/python/thunder/utils/ec2.py b/python/thunder/utils/ec2.py index <HASH>..<HASH> 100644 --- a/python/thunder/utils/ec2.py +++ b/python/thunder/utils/ec2.py @@ -177,6 +177,9 @@ def install_anaconda(master, opts): ssh(master, opts, "/root/anaconda/bin/conda install --yes jsonschema pillow seaborn scikit-learn") print_success() + # add mistune (for notebook conversions) + ssh(master, opts, "pip install mistune") + # copy to slaves print_status("Copying Anaconda to workers") ssh(master, opts, "/root/spark-ec2/copy-dir /root/anaconda")
Add mistune (for notebook HTML conversions)
thunder-project_thunder
train
py
235e747219dd0f6c06ab942b89971782db876fa4
diff --git a/cronjobs/indexcontent.php b/cronjobs/indexcontent.php index <HASH>..<HASH> 100644 --- a/cronjobs/indexcontent.php +++ b/cronjobs/indexcontent.php @@ -62,6 +62,8 @@ while( true ) if ( !( $node instanceof eZContentObjectTreeNode ) ) { $cli->error( "An error occured while trying fetching node $nodeId" ); + $db->query( "DELETE FROM ezpending_actions WHERE action = '$action' AND param = '$objectID'" ); + $db->commit(); continue; }
Fix EZP-<I>: Delayed indexing should fail gracefully on trashed / broken node
ezsystems_ezpublish-legacy
train
php
27cf957e1e607315414aff98870a4c0c4d1535e0
diff --git a/karaage/projectreports/views/user.py b/karaage/projectreports/views/user.py index <HASH>..<HASH> 100644 --- a/karaage/projectreports/views/user.py +++ b/karaage/projectreports/views/user.py @@ -69,7 +69,7 @@ def thanks(request, project_id): survey, created = ProjectSurvey.objects.get_or_create(project=project, survey_group=survey_group) if created: - return HttpResponseRedirect(reverse('kg_survey')) + return HttpResponseRedirect(reverse('kg_survey', args=project.pid)) return render_to_response('surveys/thanks.html', locals(), context_instance=RequestContext(request))
Fixed bug in project reports url redirection
Karaage-Cluster_karaage
train
py
30844a038188bcddec1af296ec47d38576c39ecb
diff --git a/grammar.js b/grammar.js index <HASH>..<HASH> 100644 --- a/grammar.js +++ b/grammar.js @@ -375,7 +375,7 @@ module.exports = grammar({ ) ), - string_expansion: $ => seq('$', $.string), + string_expansion: $ => seq('$', choice($.string, $.raw_string)), expansion: $ => seq( '${',
Allow $'\n' (whatever that is)
tree-sitter_tree-sitter-bash
train
js
3a2541becbf467920f3ac35bc4e582b4abaa8151
diff --git a/controllers/DefaultController.php b/controllers/DefaultController.php index <HASH>..<HASH> 100644 --- a/controllers/DefaultController.php +++ b/controllers/DefaultController.php @@ -51,7 +51,7 @@ class DefaultController extends \cms\base\Controller throw new NotFoundHttpException("The requested url '$activeUrl' does not exist."); } - $link = Yii::$app->links->findOneByArguments(['lang_id' => $this->getLangId(), 'url' => $activeUrl]); + $link = Yii::$app->links->findOneByArguments(['lang_id' => $this->getLangId(), 'url' => $suffix]); if (!$link) { throw new NotFoundHttpException("The page '$activeUrl' does not exist in this language.");
fixed but in Cms DefaultController in links lookup
luyadev_luya-module-cms
train
php
6d1890389c7b4a8a6ab252c51bc9f95568ec4d84
diff --git a/gnupg/test/test_gnupg.py b/gnupg/test/test_gnupg.py index <HASH>..<HASH> 100755 --- a/gnupg/test/test_gnupg.py +++ b/gnupg/test/test_gnupg.py @@ -1152,9 +1152,9 @@ know, maybe you shouldn't be doing it in the first place. self.assertTrue(os.path.isfile(output)) # Check the contents: - with open(output) as fh: + with open(output, 'rb') as fh: encrypted_message = fh.read() - log.debug("Encrypted file contains:\n\n%s\n" % encrypted_message) + self.assertTrue(b"-----BEGIN PGP MESSAGE-----" in encrypted_message) def test_encryption_to_filehandle(self): """Test that ``encrypt(..., output=filelikething)`` is successful.""" @@ -1174,9 +1174,9 @@ know, maybe you shouldn't be doing it in the first place. self.assertTrue(os.path.isfile(output)) # Check the contents: - with open(output) as fh: + with open(output, 'rb') as fh: encrypted_message = fh.read() - log.debug("Encrypted file contains:\n\n%s\n" % encrypted_message) + self.assertTrue(b"-----BEGIN PGP MESSAGE-----" in encrypted_message) def test_encryption_from_filehandle(self): """Test that ``encrypt(open('foo'), ...)`` is successful."""
Actually check output file contents in to test_encrypt_*() tests. This provides more accurate testing for issues like #<I>.
isislovecruft_python-gnupg
train
py
b7385a0b7ff9f87e368fca8b50e300e9e256f5a2
diff --git a/test/jss_test.py b/test/jss_test.py index <HASH>..<HASH> 100644 --- a/test/jss_test.py +++ b/test/jss_test.py @@ -12,6 +12,7 @@ defaults write org.da.jss_helper jss_url <URL to JSS> import subprocess import base64 +import inspect from xml.etree import ElementTree from nose.tools import * @@ -110,6 +111,16 @@ def test_jss_delete(): assert_raises(JSSGetError, j_global.Policy, id_) +@with_setup(setup) +def test_jss_method_constructors(): + skip_these_methods = ['__init__', 'get', 'delete', 'put', 'post', '_error_handler'] + method_constructors = [ m[1] for m in inspect.getmembers(j_global) if inspect.ismethod(m[1]) and m[0] not in skip_these_methods] + for cls in method_constructors: + instance = cls() + print(type(instance)) + assert_true(isinstance(instance, JSSObject) or isinstance(instance, JSSObjectList)) + + #JSSObject Tests###############################################################
Add test for JSS constructor methods.
jssimporter_python-jss
train
py
f5d009ca6a8b40e60543219746c71c7632677fb7
diff --git a/src/IdentifierGenerator.php b/src/IdentifierGenerator.php index <HASH>..<HASH> 100644 --- a/src/IdentifierGenerator.php +++ b/src/IdentifierGenerator.php @@ -13,8 +13,6 @@ interface IdentifierGenerator * * The generated ID is supposed to be used on a resource that * is going to be created by a command handler - * - * @return mixed */ - public function generate(); + public function generate(): object; }
Force identifier generator to always return objects As of PHP <I>, we can override the return type declaration of the method as long as covariance is kept. This also makes the library a bit more type-safe, which is always good. More info: <URL>
chimeraphp_foundation
train
php
10469f8a539338e94a82bbbf8bbe69e2898532c6
diff --git a/Core/FieldType/SyliusProduct/SyliusProductStorage.php b/Core/FieldType/SyliusProduct/SyliusProductStorage.php index <HASH>..<HASH> 100644 --- a/Core/FieldType/SyliusProduct/SyliusProductStorage.php +++ b/Core/FieldType/SyliusProduct/SyliusProductStorage.php @@ -215,7 +215,18 @@ class SyliusProductStorage extends GatewayBasedStorage $productId = $gateway->getFieldData( $versionInfo ); - $product = $this->repository->find( $productId ); + $product = null; + if( !empty( $productId ) ) + { + $product = $this->repository->find( $productId ); + } + + if ( $product ) + { + $product->setCurrentLocale( + $this->localeConverter->convertToPOSIX( $field->languageCode ) + ); + } $field->value->externalData = $product; }
Added sanity check and locale setting when loading field data
netgen_NetgenEzSyliusBundle
train
php
7230430f8680159623fdbc855399ac893ce92687
diff --git a/lib/widget_list.rb b/lib/widget_list.rb index <HASH>..<HASH> 100755 --- a/lib/widget_list.rb +++ b/lib/widget_list.rb @@ -1043,10 +1043,10 @@ module WidgetList if $_REQUEST.key?('ajax') model = model_name.constantize - model.columns.keys.each { |field| - fields[field] = field.gsub(/_/,' _').camelize - all_fields[field] = field.gsub(/_/,' _').camelize - fields_function[field] = 'CNT(' + field + ') or NVL(' + field + ') or TO_DATE(' + field + ') etc...' + model.columns.each { |field| + fields[field.name] = field.name.gsub(/_/,' _').camelize + all_fields[field.name] = field.name.gsub(/_/,' _').camelize + fields_function[field.name] = 'CNT(' + field.name + ') or NVL(' + field.name + ') or TO_DATE(' + field.name + ') etc...' } footer_buttons['Add New ' + model_name] = {} footer_buttons['Add New ' + model_name]['url'] = '/' + controller + '/add/'
Hot fixes to get the admin ajax working.
davidrenne_widget_list
train
rb
2243158daf2dcc14b2b080fcfa23b03d59a8b454
diff --git a/lib/fog/fogdocker/models/compute/server.rb b/lib/fog/fogdocker/models/compute/server.rb index <HASH>..<HASH> 100644 --- a/lib/fog/fogdocker/models/compute/server.rb +++ b/lib/fog/fogdocker/models/compute/server.rb @@ -79,11 +79,12 @@ module Fog # } def ready? - state_running == true + reload if state_running.nil? + state_running end def stopped? - state_running == false + !ready? end def mac
[Docker] fixes running state is not loaded, becase list-containers get only part of the container attributes
fog_fog
train
rb
ebe5c5c8a6b0a2f47b63c8d4947896cda6032189
diff --git a/lib/simple_memoize.rb b/lib/simple_memoize.rb index <HASH>..<HASH> 100644 --- a/lib/simple_memoize.rb +++ b/lib/simple_memoize.rb @@ -3,17 +3,21 @@ module SimpleMemoize module Module def memoize(method_name) + method_name = method_name.to_s memoized_method_name = "#{method_name}_with_memo" regular_method_name = "#{method_name}_without_memo" + unless (instance_methods + private_instance_methods).include?(method_name) + raise NoMethodError, "#{method_name} cannot be memoized because it doesn't exist in #{self}" + end return if self.method_defined?(memoized_method_name) self.class_eval do define_method memoized_method_name do |*args| - @simple_memo ||= {} - @simple_memo[method_name] ||= {} - @simple_memo[method_name][args] ||= send(regular_method_name, *args) + @simple_memoize ||= {} + @simple_memoize[method_name] ||= {} + @simple_memoize[method_name][args] ||= send(regular_method_name, *args) end alias_method regular_method_name, method_name
Matching the memoization hash to the project name
JackDanger_simple_memoize
train
rb
36a8d70d8dad15addecae83b7dd5184b7a731620
diff --git a/src/main/java/io/github/bonigarcia/wdm/config/Config.java b/src/main/java/io/github/bonigarcia/wdm/config/Config.java index <HASH>..<HASH> 100644 --- a/src/main/java/io/github/bonigarcia/wdm/config/Config.java +++ b/src/main/java/io/github/bonigarcia/wdm/config/Config.java @@ -1084,8 +1084,8 @@ public class Config { public String getDockerTmpfsMount() { if (IS_OS_WINDOWS) { - String tmpdir = System.getProperty("java.io.tmpdir"); - tmpdir = "//" + tmpdir.replace(":\\", "/").replace("\\", "/"); + String tmpdir = new File("").getAbsolutePath(); + tmpdir = "/" + tmpdir.replace(":\\", "/").replace("\\", "/"); log.trace("Using temporal folder for Tmpfs: {}", tmpdir); return tmpdir; }
Use local folder for Tmpfs volume in Windows
bonigarcia_webdrivermanager
train
java
1bdd69d6486420832ee1aadde4b00f633346c668
diff --git a/src/Database/Barry/Model.php b/src/Database/Barry/Model.php index <HASH>..<HASH> 100644 --- a/src/Database/Barry/Model.php +++ b/src/Database/Barry/Model.php @@ -728,7 +728,7 @@ abstract class Model implements \ArrayAccess, \JsonSerializable */ public function __toString() { - return json_encode($this->attributes); + return $this->toJson(); } /**
change: refactoring to string method
bowphp_framework
train
php
58bbdde7028a81e11026aadd1ff636c76aa01063
diff --git a/pushy/src/main/java/com/turo/pushy/apns/server/BaseHttp2ServerBuilder.java b/pushy/src/main/java/com/turo/pushy/apns/server/BaseHttp2ServerBuilder.java index <HASH>..<HASH> 100644 --- a/pushy/src/main/java/com/turo/pushy/apns/server/BaseHttp2ServerBuilder.java +++ b/pushy/src/main/java/com/turo/pushy/apns/server/BaseHttp2ServerBuilder.java @@ -291,6 +291,15 @@ abstract class BaseHttp2ServerBuilder <T extends BaseHttp2Server> { sslContextBuilder.trustManager(this.trustedClientCertificates); } + // Mock server needs to be able to inform to ALPN-enabled HTTP clients + // which protocols are supported during the protocol negotiation phase. + // In this case, mock server should only support HTTP/2 in order to mock real APNS servers. + sslContextBuilder.applicationProtocolConfig(new ApplicationProtocolConfig( + ApplicationProtocolConfig.Protocol.ALPN, + ApplicationProtocolConfig.SelectorFailureBehavior.NO_ADVERTISE, + ApplicationProtocolConfig.SelectedListenerFailureBehavior.ACCEPT, + ApplicationProtocolNames.HTTP_2)); + sslContext = sslContextBuilder.build(); }
Fixing an issue in mock server where the ALPN extension fields for protocol negotiation were not being added to the 'Server Hello' TLS package.
relayrides_pushy
train
java
98e65ff33c109e289a36400e5739da33f5cfd605
diff --git a/tests/src/Functional/InstallationTest.php b/tests/src/Functional/InstallationTest.php index <HASH>..<HASH> 100644 --- a/tests/src/Functional/InstallationTest.php +++ b/tests/src/Functional/InstallationTest.php @@ -93,15 +93,4 @@ class InstallationTest extends TestCase { $this->assertEquals('/api', $output['result']['openApi']['basePath']); } - public function testGraphQLQuery() { - $query = '{"query":"query{nodeQuery{entities{entityLabel ... on NodeRecipe { fieldIngredients }}}}","variables":null}'; - $response = $this->httpClient->post($this->baseUrl . '/graphql', [ - 'body' => $query, - ]); - $this->assertEquals(200, $response->getStatusCode()); - $body = $response->getBody()->getContents(); - $output = Json::decode($body); - $entities = $output['data']['nodeQuery']['entities']; - $this->assertFalse(empty($entities)); - } }
fix: remove GraphQL tests
contentacms_contenta_jsonapi
train
php
6be0e02d8df059e6618fc9de915cbf951a7a4e4d
diff --git a/src/index.js b/src/index.js index <HASH>..<HASH> 100644 --- a/src/index.js +++ b/src/index.js @@ -28,14 +28,15 @@ async function resolveAsDirectory(request: string, parent: string, config: Confi try { manifest = JSON.parse(await config.fs.readFile(Path.join(request, 'package.json'))) } catch (_) { /* No Op */ } - let givenMainFile = Path.normalize(config.process(manifest, request)) + let givenMainFile = config.process(manifest, request) + givenMainFile = Path.normalize(givenMainFile) + (givenMainFile.substr(0, 1) === '/' ? '/' : '') if (givenMainFile === '.' || givenMainFile === '.\\' || givenMainFile === './') { givenMainFile = './index' } let mainFile = Path.isAbsolute(givenMainFile) ? givenMainFile : Path.resolve(request, givenMainFile) const stat = await statItem(mainFile, config) // $/ should be treated as a dir first - if (stat && mainFile.substr(-1) === '/') { + if (stat && givenMainFile.substr(-1) === '/') { // Disallow requiring a file as a directory if (!stat.isDirectory()) { throw getError(givenRequest, parent, config)
:bug: Fix a priority bug in deep manifest resolution
steelbrain_resolve
train
js
41e0df8f32d0baa065242c14bc4266c90be54599
diff --git a/scalar.py b/scalar.py index <HASH>..<HASH> 100755 --- a/scalar.py +++ b/scalar.py @@ -13,7 +13,6 @@ def main(): print(f.header); print("reading in data"); data = f.get_data(pool_size=24,lazy=False); - print("selecting data"); print("dumping"); with open(sys.argv[2],"wb") as f: cPickle.dump(data,f,2);
removed extraneous print line...
noobermin_lspreader
train
py
33cad513931faf511c6fc44f02dd2ee9c09a5d28
diff --git a/src/Illuminate/Http/Request.php b/src/Illuminate/Http/Request.php index <HASH>..<HASH> 100755 --- a/src/Illuminate/Http/Request.php +++ b/src/Illuminate/Http/Request.php @@ -197,9 +197,9 @@ class Request extends \Symfony\Component\HttpFoundation\Request { { $keys = is_array($keys) ? $keys : func_get_args(); - $input = $this->input(); + $input = array_only($this->input(), $keys); - return array_only($input, $keys); + return array_merge(array_fill_keys($keys, null), $input); } /**
Set default value to null for Input::only instead of being undefined.
laravel_framework
train
php
ae10696e9562d9a7c72527470ade0f9617b2c709
diff --git a/ghost/members-api/lib/MembersAPI.js b/ghost/members-api/lib/MembersAPI.js index <HASH>..<HASH> 100644 --- a/ghost/members-api/lib/MembersAPI.js +++ b/ghost/members-api/lib/MembersAPI.js @@ -234,10 +234,7 @@ module.exports = function MembersAPI({ await MemberLoginEvent.add({member_id: member.id}); if (oldEmail) { // user exists but wants to change their email address - if (oldEmail) { - member.email = email; - } - await users.update(member, {id: member.id}); + await users.update({email}, {id: member.id}); return getMemberIdentityData(email); } return member; @@ -279,8 +276,7 @@ module.exports = function MembersAPI({ // max request time is 500ms so shouldn't slow requests down too much let geolocation = JSON.stringify(await geolocationService.getGeolocationFromIP(ip)); if (geolocation) { - member.geolocation = geolocation; - await users.update(member, {id: member.id}); + await users.update({geolocation}, {id: member.id}); } return getMemberIdentityData(email);
Fixed issue with new members always subscribing to defaults no issue The member was updated when setting the geolocation, but that also included setting subscribed to true.
TryGhost_Ghost
train
js
342f3a491dba504abc57e3aa58728c5550b4dce2
diff --git a/check_manifest.py b/check_manifest.py index <HASH>..<HASH> 100755 --- a/check_manifest.py +++ b/check_manifest.py @@ -139,8 +139,10 @@ def run(command, encoding=None, decode=True, cwd=None): if not encoding: encoding = locale.getpreferredencoding() try: - pipe = subprocess.Popen(command, stdout=subprocess.PIPE, - stderr=subprocess.STDOUT, cwd=cwd) + with open(os.devnull, 'rb') as devnull: + pipe = subprocess.Popen(command, stdin=devnull, + stdout=subprocess.PIPE, + stderr=subprocess.STDOUT, cwd=cwd) except OSError as e: raise Failure("could not run %s: %s" % (command, e)) output = pipe.communicate()[0]
Explicitly close stdin for subprocesses One reason to do that is because any prompts would be invisible, since we're intercepting the stdout and stderr. Another (and main reason) to do this is that I'm getting weird "0: Bad file descriptor" errors from git-submodule on Appveyor.
mgedmin_check-manifest
train
py
312cfe9b77915e87f4262cf086eafd6dc628f7de
diff --git a/my-smappee.js b/my-smappee.js index <HASH>..<HASH> 100644 --- a/my-smappee.js +++ b/my-smappee.js @@ -1,10 +1,13 @@ var SmappeeAPI = require('./lib/smappee-api'); var smappee = new SmappeeAPI({ - ip: "0.0.0.0", debug: true, - username: "admin", - password: "admin" + + clientId: "xxx", + clientSecret: "xxx", + + username: "xxx", + password: "xxx" }); module.exports = smappee; \ No newline at end of file
example my-smappee file
Adeptive_Smappee-NodeJS
train
js
d72110280ece703ac3983107aef246ed974e630b
diff --git a/iota/codecs.py b/iota/codecs.py index <HASH>..<HASH> 100644 --- a/iota/codecs.py +++ b/iota/codecs.py @@ -4,7 +4,7 @@ from __future__ import absolute_import, division, print_function, \ from codecs import Codec, CodecInfo, register as lookup_function -from six import binary_type +from six import PY3, binary_type __all__ = [ 'TrytesCodec', @@ -46,11 +46,17 @@ class TrytesCodec(Codec): """ codec = cls() - return CodecInfo( - encode = codec.encode, - decode = codec.decode, - _is_text_encoding = False, - ) + codec_info = { + 'encode': codec.encode, + 'decode': codec.decode, + } + + # In Python 2, all codecs are made equal. + # In Python 3, some codecs are more equal than others. + if PY3: + codec_info['_is_text_encoding'] = False + + return CodecInfo(**codec_info) # noinspection PyShadowingBuiltins def encode(self, input, errors='strict'):
Improved compatibility with Python <I>.
iotaledger_iota.lib.py
train
py
3f76194a5c6307a6a0ddfea6d5b55285aec33bb6
diff --git a/client/signup/index.js b/client/signup/index.js index <HASH>..<HASH> 100644 --- a/client/signup/index.js +++ b/client/signup/index.js @@ -32,7 +32,6 @@ module.exports = function() { } if ( config.isEnabled( 'jetpack/connect' ) ) { - page( '/jetpack/connect/install', jetpackConnectController.install ); page( '/jetpack/connect', jetpackConnectController.connect ); page( '/jetpack/connect/authorize/:locale?',
Jetpack Connect: Remove extra jetpack/connect/install page statement
Automattic_wp-calypso
train
js
9aa515a0396b865a2b57265852a3c6d1a181713d
diff --git a/packages/eslint-config-4catalyzer-react/rules.js b/packages/eslint-config-4catalyzer-react/rules.js index <HASH>..<HASH> 100644 --- a/packages/eslint-config-4catalyzer-react/rules.js +++ b/packages/eslint-config-4catalyzer-react/rules.js @@ -11,16 +11,17 @@ module.exports = { aspects: ['noHref', 'invalidHref', 'preferButton'], }, ], - 'jsx-a11y/label-has-for': [ + 'jsx-a11y/label-has-associated-control': [ 'error', { - components: [], - required: { - some: ['nesting', 'id'], - }, - allowChildren: false, + labelComponents: [], + labelAttributes: [], + controlComponents: [], + assert: 'either', + depth: 25, }, ], + 'jsx-a11y/label-has-for': 'off', 'react-hooks/rules-of-hooks': 'error', 'react-hooks/exhaustive-deps': 'warn', // It's clearer to use required even on props with defaults to indicate
fix: Update jsx-a<I>y overrides (#<I>)
4Catalyzer_javascript
train
js
124c9de2d8be57891c27b1b2c1b0ad69ec7a9a34
diff --git a/src/Intahwebz/Timer.php b/src/Intahwebz/Timer.php index <HASH>..<HASH> 100644 --- a/src/Intahwebz/Timer.php +++ b/src/Intahwebz/Timer.php @@ -25,12 +25,38 @@ class Timer { $this->timeRecords[] = array($time, $this->description); $this->startTime = null; - $this->lineNumber = null; $this->description = null; } function dumpTime() { - var_dump($this->timeRecords); + + $totals = array(); + + foreach ($this->timeRecords as $timeRecord) { + $time = $timeRecord[0]; + $description = $timeRecord[1]; + + if(isset($totals[$description])) { + $total = $totals[$description]; + $total['called'] += 1; + $total['time'] += $time; + } + else { + $total = array(); + $total['called'] = 1; + $total['time'] = $time; + + $totals[$description] = $total; + } + } + + echo "Timer results\n"; + + foreach ($totals as $description => $total) { + echo '"'.$description.'", '; + echo 'called '.$total['called'].' time, '; + echo 'total time:'.$total['time']."\n"; + } } }
Made timer be able to show results.
Danack_intahwebz-core
train
php
bf3e372ee9c786a7f4a55a4ea5a8af56a79bd374
diff --git a/omrdatasettools/__init__.py b/omrdatasettools/__init__.py index <HASH>..<HASH> 100644 --- a/omrdatasettools/__init__.py +++ b/omrdatasettools/__init__.py @@ -1,4 +1,4 @@ -__version__ = '1.1' +__version__ = '1.2' from .Downloader import * from .OmrDataset import OmrDataset
Upgrading to <I> for adding lxml into requirements when installing omrdatasettools
apacha_OMR-Datasets
train
py
36a82723dfc2734b18eede4b75708595345c9d7a
diff --git a/sos/plugins/crio.py b/sos/plugins/crio.py index <HASH>..<HASH> 100644 --- a/sos/plugins/crio.py +++ b/sos/plugins/crio.py @@ -11,7 +11,7 @@ from sos.plugins import Plugin, RedHatPlugin, UbuntuPlugin -class CRIO(Plugin): +class CRIO(Plugin, RedHatPlugin, UbuntuPlugin): """CRI-O containers """
[crio] Add tagging classes Adds tagging classes so plugin will run on Red Hat and Ubuntu based systems. Resolves: #<I>
sosreport_sos
train
py
7a8aa8f681b9d77fd692aae2e4ab365b3ae2038e
diff --git a/pystache/tests/test_doctests.py b/pystache/tests/test_doctests.py index <HASH>..<HASH> 100644 --- a/pystache/tests/test_doctests.py +++ b/pystache/tests/test_doctests.py @@ -25,9 +25,12 @@ text_file_paths = ['README.rst'] # The following load_tests() function implements unittests's load_tests -# protocol added in Python 2.7. Using this protocol allows us to -# include the doctests in test runs without the use of nose, for example -# when using Distribute's test as in the following: +# protocol added in Python 2.7: +# +# http://docs.python.org/library/unittest.html#load-tests-protocol +# +# Using this protocol lets us include the doctests in test runs without +# using nose, for example when using Distribute's test as in the following: # # python setup.py test #
Added a code comment with a link to unittest's load_tests protocol.
defunkt_pystache
train
py
b3e4c45d8888114414bb67beff1088b3c297226c
diff --git a/castWebApi.js b/castWebApi.js index <HASH>..<HASH> 100644 --- a/castWebApi.js +++ b/castWebApi.js @@ -30,7 +30,7 @@ interpretArguments(); if (!windows) { startApi(); } else { - console.log( process.argv[1].split("\bin\cast-web-api")[0] ); + console.log( process.argv[1].replace("\bin\cast-web-api", "") ); } function startApi() {
Changed --windows for global install path
vervallsweg_cast-web-api
train
js
43189ef6f2b55b4a09c042ce3fd4d1703c2091e3
diff --git a/tests/util.py b/tests/util.py index <HASH>..<HASH> 100644 --- a/tests/util.py +++ b/tests/util.py @@ -10,6 +10,7 @@ from paramiko.py3compat import builtins, PY2 from paramiko.ssh_gss import GSS_AUTH_AVAILABLE from cryptography.exceptions import UnsupportedAlgorithm, _Reasons +from cryptography.hazmat.backends import default_backend from cryptography.hazmat.primitives import hashes from cryptography.hazmat.primitives.asymmetric import padding, rsa @@ -155,7 +156,7 @@ def sha1_signing_unsupported(): not supported by the backend. """ private_key = rsa.generate_private_key( - public_exponent=65537, key_size=2048 + public_exponent=65537, key_size=2048, backend=default_backend() ) message = b"Some dummy text" try:
Fix for compatibility with old versions of cryptography
paramiko_paramiko
train
py
428cd35dc017dabc59b78373a07b114d57968880
diff --git a/src/authority/admin.py b/src/authority/admin.py index <HASH>..<HASH> 100644 --- a/src/authority/admin.py +++ b/src/authority/admin.py @@ -6,7 +6,7 @@ from django.utils.text import capfirst, truncate_words from authority.models import Permission from authority.widgets import GenericForeignKeyRawIdWidget -from autority import get_choices_for +from authority import get_choices_for class PermissionInline(generic.GenericTabularInline): model = Permission
Fixing issue #3 for realz.
jazzband_django-authority
train
py
6fbb217e875e9cd7bb73a774bac98b1a95d50950
diff --git a/php/commands/cron.php b/php/commands/cron.php index <HASH>..<HASH> 100644 --- a/php/commands/cron.php +++ b/php/commands/cron.php @@ -509,7 +509,9 @@ class Cron_Command extends WP_CLI_Command { * @return WP_Error|array The response or WP_Error on failure. */ protected static function get_cron_spawn() { + global $wp_version; + $sslverify = version_compare( $wp_version, 4.0, '<' ); $doing_wp_cron = sprintf( '%.22F', microtime( true ) ); $cron_request = apply_filters( 'cron_request', array( @@ -518,7 +520,7 @@ class Cron_Command extends WP_CLI_Command { 'args' => array( 'timeout' => 3, 'blocking' => true, - 'sslverify' => apply_filters( 'https_local_ssl_verify', true ) + 'sslverify' => apply_filters( 'https_local_ssl_verify', $sslverify ) ) ) );
When testing WP-Cron, correctly set the `sslverify `argument depending on the version of WordPress in use.
wp-cli_export-command
train
php
ece3dbfc43ab7d5655117b9429df46dfdcd376d4
diff --git a/core/api/src/main/java/org/openengsb/core/api/workflow/WorkflowService.java b/core/api/src/main/java/org/openengsb/core/api/workflow/WorkflowService.java index <HASH>..<HASH> 100644 --- a/core/api/src/main/java/org/openengsb/core/api/workflow/WorkflowService.java +++ b/core/api/src/main/java/org/openengsb/core/api/workflow/WorkflowService.java @@ -21,9 +21,10 @@ import java.util.Map; import java.util.concurrent.Future; import org.openengsb.core.api.Event; +import org.openengsb.core.api.OpenEngSBService; import org.openengsb.core.api.workflow.model.ProcessBag; -public interface WorkflowService { +public interface WorkflowService extends OpenEngSBService { /** * processes the event in the Knowledgebase by inserting it as a fact, and signaling it the processes it may * concern. The processes the Event is signaled to are determined by looking at the processId-field of the event. If
[OPENENGSB-<I>] WorkflowService has to extend OpenEngSBService
openengsb_openengsb
train
java
f67fa7908713dcf70e8077867f07cd88ec965201
diff --git a/packages/tractor-ui/src/app/Core/Services/RedirectionService.js b/packages/tractor-ui/src/app/Core/Services/RedirectionService.js index <HASH>..<HASH> 100644 --- a/packages/tractor-ui/src/app/Core/Services/RedirectionService.js +++ b/packages/tractor-ui/src/app/Core/Services/RedirectionService.js @@ -6,7 +6,6 @@ function RedirectionService ($state, fileTypes) { this.fileTypes = fileTypes; } RedirectionService.prototype.goToFile = function (file) { - file.url = '/' + file.url; var fileType = this.fileTypes.find(function (fileType) { return file.url.endsWith(fileType.extension); });
fix(ui :lipstick:) - fix extra slash in redirection logic
TradeMe_tractor
train
js
d20b6468f847a5afba0fb6a70c46c06848d94d3f
diff --git a/pyfakefs/fake_filesystem.py b/pyfakefs/fake_filesystem.py index <HASH>..<HASH> 100644 --- a/pyfakefs/fake_filesystem.py +++ b/pyfakefs/fake_filesystem.py @@ -5041,10 +5041,11 @@ class FakePipeWrapper(object): def __init__(self, filesystem, fd): self._filesystem = filesystem self.fd = fd # the real file descriptor + self.file_object = None self.filedes = None def get_object(self): - return None + return self.file_object def fileno(self): """Return the fake file descriptor of the pipe object."""
Added dummy file object to FakePipeWrapper - used if iterating open files
jmcgeheeiv_pyfakefs
train
py