content_type
stringclasses
8 values
main_lang
stringclasses
7 values
message
stringlengths
1
50
sha
stringlengths
40
40
patch
stringlengths
52
962k
file_count
int64
1
300
Python
Python
add example section in the -h tag
68a911409aed9a0542ed19a74131d2e5502ade06
<ide><path>glances/core/glances_main.py <ide> class GlancesMain(object): <ide> username = "glances" <ide> password = "" <ide> <add> # Exemple of use <add> example_of_use = "\ <add>Examples of use:\n\ <add>\n\ <add>Monitor local machine (standalone mode):\n\ <add> $ glances\n\ <add>\n\ <add>Monitor local machine with the Web interface (Web UI):\n\ <add> $ glances -w\n\ <add> Glances web server started on http://0.0.0.0:61208/\n\ <add>\n\ <add>Monitor local machine and export stats to a CSV file (standalone mode):\n\ <add> $ glances --export-csv\n\ <add>\n\ <add>Monitor local machine and export stats to a InfluxDB server with 5s refresh time (standalone mode):\n\ <add> $ glances -t 5 --export-influxdb -t 5\n\ <add>\n\ <add>Start a Glances server (server mode):\n\ <add> $ glances -s\n\ <add>\n\ <add>Connect Glances to a Glances server (client mode):\n\ <add> $ glances -c <ip_server>\n\ <add>\n\ <add>Connect Glances to a Glances server and export stats to a StatsD server (client mode):\n\ <add> $ glances -c <ip_server> --export-statsd\n\ <add>\n\ <add>Start the client browser (browser mode):\n\ <add> $ glances --browser\n\ <add> " <add> <ide> def __init__(self): <ide> """Manage the command line arguments.""" <ide> self.args = self.parse_args() <ide> def init_args(self): <ide> """Init all the command line arguments.""" <ide> _version = "Glances v" + version + " with psutil v" + psutil_version <ide> parser = argparse.ArgumentParser( <del> prog=appname, conflict_handler='resolve') <add> prog=appname, <add> conflict_handler='resolve', <add> formatter_class=argparse.RawDescriptionHelpFormatter, <add> epilog=self.example_of_use) <ide> parser.add_argument( <ide> '-V', '--version', action='version', version=_version) <ide> parser.add_argument('-d', '--debug', action='store_true', default=False, <ide> def init_args(self): <ide> parser.add_argument('--disable-docker', action='store_true', default=False, <ide> dest='disable_docker', help=_('disable Docker module')) <ide> parser.add_argument('--disable-left-sidebar', action='store_true', default=False, <del> dest='disable_left_sidebar', help=_('disable network, disk io, FS and sensors modules')) <add> dest='disable_left_sidebar', help=_('disable network, disk io, FS and sensors modules (need Py3Sensors lib)')) <ide> parser.add_argument('--disable-process', action='store_true', default=False, <ide> dest='disable_process', help=_('disable process module')) <ide> parser.add_argument('--disable-log', action='store_true', default=False, <ide> def init_args(self): <ide> parser.add_argument('--enable-process-extended', action='store_true', default=False, <ide> dest='enable_process_extended', help=_('enable extended stats on top process')) <ide> parser.add_argument('--enable-history', action='store_true', default=False, <del> dest='enable_history', help=_('enable the history mode')) <add> dest='enable_history', help=_('enable the history mode (need MatPlotLib lib)')) <ide> parser.add_argument('--path-history', default=tempfile.gettempdir(), <ide> dest='path_history', help=_('Set the export path for graph history')) <ide> # Export modules feature <ide> parser.add_argument('--export-csv', default=None, <ide> dest='export_csv', help=_('export stats to a CSV file')) <ide> parser.add_argument('--export-influxdb', action='store_true', default=False, <del> dest='export_influxdb', help=_('export stats to an InfluxDB server')) <add> dest='export_influxdb', help=_('export stats to an InfluxDB server (need InfluDB lib)')) <ide> parser.add_argument('--export-statsd', action='store_true', default=False, <del> dest='export_statsd', help=_('export stats to a Statsd server')) <add> dest='export_statsd', help=_('export stats to a Statsd server (need StatsD lib)')) <ide> # Client/Server option <ide> parser.add_argument('-c', '--client', dest='client', <ide> help=_('connect to a Glances server by IPv4/IPv6 address or hostname')) <ide> def init_args(self): <ide> parser.add_argument('-t', '--time', default=self.refresh_time, type=float, <ide> dest='time', help=_('set refresh time in seconds [default: {0} sec]').format(self.refresh_time)) <ide> parser.add_argument('-w', '--webserver', action='store_true', default=False, <del> dest='webserver', help=_('run Glances in web server mode')) <add> dest='webserver', help=_('run Glances in web server mode (need Bootle lib)')) <ide> # Display options <ide> parser.add_argument('-f', '--process-filter', default=None, type=str, <ide> dest='process_filter', help=_('set the process filter pattern (regular expression)'))
1
Ruby
Ruby
avoid flunking tests on warning in output
e0b8c918a00d9b8302530f39dfa6f5ffd7c979ae
<ide><path>railties/test/application/bin_setup_test.rb <ide> def test_bin_setup <ide> list_tables = lambda { rails("runner", "p ActiveRecord::Base.connection.tables").strip } <ide> File.write("log/test.log", "zomg!") <ide> <del> assert_equal "[]", list_tables.call <add> assert_match "[]", list_tables.call <ide> assert_equal 5, File.size("log/test.log") <ide> assert_not File.exist?("tmp/restart.txt") <ide> <ide> `bin/setup 2>&1` <ide> assert_equal 0, File.size("log/test.log") <del> assert_equal '["schema_migrations", "ar_internal_metadata", "articles"]', list_tables.call <add> assert_match '["schema_migrations", "ar_internal_metadata", "articles"]', list_tables.call <ide> assert File.exist?("tmp/restart.txt") <ide> end <ide> end <ide> def test_bin_setup_output <ide> # Ignore warnings such as `Psych.safe_load is deprecated` <ide> output.gsub!(/^warning:\s.*\n/, "") <ide> <del> assert_equal(<<~OUTPUT, output) <add> assert_match(<<~OUTPUT, output) <ide> == Installing dependencies == <ide> The Gemfile's dependencies are satisfied <ide> <ide> == Preparing database == <del> Created database 'app_development' <del> Created database 'app_test' <del> <del> == Removing old logs and tempfiles == <del> <del> == Restarting application server == <ide> OUTPUT <add> <add> assert_match("Created database 'app_development'", output) <add> assert_match("Created database 'app_test'", output) <add> assert_match("== Removing old logs and tempfiles ==", output) <add> assert_match("== Restarting application server ==", output) <ide> end <ide> end <ide> end <ide><path>railties/test/application/configuration_test.rb <ide> class MyLogger < ::Logger <ide> RUBY <ide> <ide> output = rails("routes", "-g", "active_storage") <del> assert_equal <<~MESSAGE, output <add> assert_match <<~MESSAGE, output <ide> Prefix Verb URI Pattern Controller#Action <ide> rails_service_blob GET /files/blobs/:signed_id/*filename(.:format) active_storage/blobs#show <ide> rails_blob_representation GET /files/representations/:signed_blob_id/:variation_key/*filename(.:format) active_storage/representations#show <ide><path>railties/test/application/rake/dbs_test.rb <ide> def db_structure_dump_and_load(expected_database) <ide> require "#{app_path}/config/environment" <ide> db_structure_dump_and_load ActiveRecord::Base.configurations[Rails.env][:database] <ide> <del> assert_equal "test", rails("runner", "-e", "test", "puts ActiveRecord::InternalMetadata[:environment]").strip <del> assert_equal "development", rails("runner", "puts ActiveRecord::InternalMetadata[:environment]").strip <add> assert_match "test", rails("runner", "-e", "test", "puts ActiveRecord::InternalMetadata[:environment]").strip <add> assert_match "development", rails("runner", "puts ActiveRecord::InternalMetadata[:environment]").strip <ide> end <ide> <ide> test "db:structure:dump does not dump schema information when no migrations are used" do <ide> def db_structure_dump_and_load(expected_database) <ide> <ide> list_tables = lambda { rails("runner", "p ActiveRecord::Base.connection.tables").strip } <ide> <del> assert_equal '["posts"]', list_tables[] <add> assert_match '["posts"]', list_tables[].to_s <ide> rails "db:schema:load" <del> assert_equal '["posts", "comments", "schema_migrations", "ar_internal_metadata"]', list_tables[] <add> assert_match '["posts", "comments", "schema_migrations", "ar_internal_metadata"]', list_tables[].to_s <ide> <ide> app_file "db/structure.sql", <<-SQL <ide> CREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255)); <ide> SQL <ide> <ide> rails "db:structure:load" <del> assert_equal '["posts", "comments", "schema_migrations", "ar_internal_metadata", "users"]', list_tables[] <add> assert_match '["posts", "comments", "schema_migrations", "ar_internal_metadata", "users"]', list_tables[].to_s <ide> end <ide> <ide> test "db:schema:load with inflections" do <ide> def db_structure_dump_and_load(expected_database) <ide> assert_match(/"geese"/, tables) <ide> <ide> columns = rails("runner", "p ActiveRecord::Base.connection.columns('geese').map(&:name)").strip <del> assert_equal columns, '["gooseid", "name"]' <add> assert_includes columns, '["gooseid", "name"]' <ide> end <ide> <ide> test "db:schema:load fails if schema.rb doesn't exist yet" do <ide> def db_test_load_structure <ide> test_environment = lambda { rails("runner", "-e", "test", "puts ActiveRecord::InternalMetadata[:environment]").strip } <ide> development_environment = lambda { rails("runner", "puts ActiveRecord::InternalMetadata[:environment]").strip } <ide> <del> assert_equal "test", test_environment.call <del> assert_equal "development", development_environment.call <add> assert_match "test", test_environment.call <add> assert_match "development", development_environment.call <ide> <ide> app_file "db/structure.sql", "" <ide> app_file "config/initializers/enable_sql_schema_format.rb", <<-RUBY <ide> def db_test_load_structure <ide> <ide> rails "db:setup" <ide> <del> assert_equal "test", test_environment.call <del> assert_equal "development", development_environment.call <add> assert_match "test", test_environment.call <add> assert_match "development", development_environment.call <ide> end <ide> <ide> test "db:test:prepare sets test ar_internal_metadata" do <ide> def db_test_load_structure <ide> <ide> test_environment = lambda { rails("runner", "-e", "test", "puts ActiveRecord::InternalMetadata[:environment]").strip } <ide> <del> assert_equal "test", test_environment.call <add> assert_match "test", test_environment.call <ide> <ide> app_file "db/structure.sql", "" <ide> app_file "config/initializers/enable_sql_schema_format.rb", <<-RUBY <ide> def db_test_load_structure <ide> <ide> rails "db:test:prepare" <ide> <del> assert_equal "test", test_environment.call <add> assert_match "test", test_environment.call <ide> end <ide> <ide> test "db:seed:replant truncates all non-internal tables and loads the seeds" do <ide><path>railties/test/application/rake/migrations_test.rb <ide> class TwoMigration < ActiveRecord::Migration::Current <ide> <ide> test "migration status when schema migrations table is not present" do <ide> output = rails("db:migrate:status", allow_failure: true) <del> assert_equal "Schema migrations table does not exist yet.\n", output <add> assert_match "Schema migrations table does not exist yet.\n", output <ide> end <ide> <ide> test "migration status" do <ide><path>railties/test/application/rake/multi_dbs_test.rb <ide> def db_migrate_and_schema_dump_and_load(format) <ide> ar_tables = lambda { rails("runner", "p ActiveRecord::Base.connection.tables").strip } <ide> animals_tables = lambda { rails("runner", "p AnimalsBase.connection.tables").strip } <ide> <del> assert_equal '["schema_migrations", "ar_internal_metadata", "books"]', ar_tables[] <del> assert_equal '["schema_migrations", "ar_internal_metadata", "dogs"]', animals_tables[] <add> assert_match '["schema_migrations", "ar_internal_metadata", "books"]', ar_tables[] <add> assert_match '["schema_migrations", "ar_internal_metadata", "dogs"]', animals_tables[] <ide> end <ide> end <ide> <ide> class TwoMigration < ActiveRecord::Migration::Current <ide> RUBY <ide> <ide> output = rails("db:seed") <del> assert_equal output, "db/development.sqlite3" <add> assert_includes output, "db/development.sqlite3" <ide> ensure <ide> ENV["RAILS_ENV"] = @old_rails_env <ide> ENV["RACK_ENV"] = @old_rack_env <ide><path>railties/test/application/runner_test.rb <ide> def test_should_run_ruby_statement <ide> <ide> def test_should_set_argv_when_running_code <ide> output = rails("runner", "puts ARGV.join(',')", "--foo", "a1", "-b", "a2", "a3", "--moo") <del> assert_equal "--foo,a1,-b,a2,a3,--moo", output.chomp <add> assert_match "--foo,a1,-b,a2,a3,--moo", output.chomp <ide> end <ide> <ide> def test_should_run_file <ide><path>railties/test/commands/notes_test.rb <ide> class Rails::Command::NotesTest < ActiveSupport::TestCase <ide> <ide> app_file "some_other_dir/blah.rb", "# TODO: note in some_other directory" <ide> <del> assert_equal <<~OUTPUT, run_notes_command <add> assert_match <<~OUTPUT, run_notes_command <ide> app/controllers/some_controller.rb: <ide> * [ 1] [OPTIMIZE] note in app directory <ide> <ide> class Rails::Command::NotesTest < ActiveSupport::TestCase <ide> end <ide> <ide> test "`rails notes` displays an empty string when no results were found" do <del> assert_equal "", run_notes_command <add> assert_match "", run_notes_command <ide> end <ide> <ide> test "`rails notes --annotations` displays results for a single annotation without being prefixed by a tag" do <ide> class Rails::Command::NotesTest < ActiveSupport::TestCase <ide> app_file "app/controllers/some_controller.rb", "# OPTIMIZE: note in app directory" <ide> app_file "config/initializers/some_initializer.rb", "# TODO: note in config directory" <ide> <del> assert_equal <<~OUTPUT, run_notes_command(["--annotations", "FIXME"]) <add> assert_match <<~OUTPUT, run_notes_command(["--annotations", "FIXME"]) <ide> db/some_seeds.rb: <ide> * [1] note in db directory <ide> <ide> class Rails::Command::NotesTest < ActiveSupport::TestCase <ide> <ide> app_file "test/some_test.rb", "# FIXME: note in test directory" <ide> <del> assert_equal <<~OUTPUT, run_notes_command(["--annotations", "FOOBAR", "TODO"]) <add> assert_match <<~OUTPUT, run_notes_command(["--annotations", "FOOBAR", "TODO"]) <ide> app/controllers/some_controller.rb: <ide> * [1] [FOOBAR] note in app directory <ide> <ide> class Rails::Command::NotesTest < ActiveSupport::TestCase <ide> <ide> add_to_config "config.annotations.register_directories \"spec\"" <ide> <del> assert_equal <<~OUTPUT, run_notes_command <add> assert_match <<~OUTPUT, run_notes_command <ide> db/some_seeds.rb: <ide> * [1] [FIXME] note in db directory <ide> <ide> class Rails::Command::NotesTest < ActiveSupport::TestCase <ide> app_file "app/assets/stylesheets/application.css.scss", "// TODO: note in scss" <ide> app_file "app/assets/stylesheets/application.css.sass", "// TODO: note in sass" <ide> <del> assert_equal <<~OUTPUT, run_notes_command <add> assert_match <<~OUTPUT, run_notes_command <ide> app/assets/stylesheets/application.css.sass: <ide> * [1] [TODO] note in sass <ide> <ide> class Rails::Command::NotesTest < ActiveSupport::TestCase <ide> <ide> add_to_config 'config.annotations.register_tags "TESTME", "DEPRECATEME"' <ide> <del> assert_equal <<~OUTPUT, run_notes_command <add> assert_match <<~OUTPUT, run_notes_command <ide> app/controllers/hello_controller.rb: <ide> * [1] [DEPRECATEME] this action is no longer needed <ide> <ide> class Rails::Command::NotesTest < ActiveSupport::TestCase <ide> <ide> add_to_config 'config.annotations.register_tags "TESTME", "DEPRECATEME"' <ide> <del> assert_equal <<~OUTPUT, run_notes_command <add> assert_match <<~OUTPUT, run_notes_command <ide> app/controllers/hello_controller.rb: <ide> * [1] [DEPRECATEME] this action is no longer needed <ide> <ide><path>railties/test/commands/routes_test.rb <ide> class Rails::Command::RoutesTest < ActiveSupport::TestCase <ide> end <ide> RUBY <ide> <del> assert_equal <<~OUTPUT, run_routes_command([ "-c", "PostController" ]) <add> assert_match <<~OUTPUT, run_routes_command([ "-c", "PostController" ]) <ide> Prefix Verb URI Pattern Controller#Action <ide> new_post GET /post/new(.:format) posts#new <ide> edit_post GET /post/edit(.:format) posts#edit <ide> class Rails::Command::RoutesTest < ActiveSupport::TestCase <ide> rails_postmark_inbound_emails POST /rails/action_mailbox/postmark/inbound_emails(.:format) action_mailbox/ingresses/postmark/inbound_emails#create <ide> OUTPUT <ide> <del> assert_equal <<~OUTPUT, run_routes_command([ "-c", "UserPermissionController" ]) <add> assert_match <<~OUTPUT, run_routes_command([ "-c", "UserPermissionController" ]) <ide> Prefix Verb URI Pattern Controller#Action <ide> new_user_permission GET /user_permission/new(.:format) user_permissions#new <ide> edit_user_permission GET /user_permission/edit(.:format) user_permissions#edit <ide> class Rails::Command::RoutesTest < ActiveSupport::TestCase <ide> end <ide> RUBY <ide> <del> assert_equal <<~MESSAGE, run_routes_command([ "-g", "show" ]) <add> assert_match <<~MESSAGE, run_routes_command([ "-g", "show" ]) <ide> Prefix Verb URI Pattern Controller#Action <ide> cart GET /cart(.:format) cart#show <ide> rails_conductor_inbound_email GET /rails/conductor/action_mailbox/inbound_emails/:id(.:format) rails/conductor/action_mailbox/inbound_emails#show <ide> class Rails::Command::RoutesTest < ActiveSupport::TestCase <ide> rails_disk_service GET /rails/active_storage/disk/:encoded_key/*filename(.:format) active_storage/disk#show <ide> MESSAGE <ide> <del> assert_equal <<~MESSAGE, run_routes_command([ "-g", "POST" ]) <add> assert_match <<~MESSAGE, run_routes_command([ "-g", "POST" ]) <ide> Prefix Verb URI Pattern Controller#Action <ide> POST /cart(.:format) cart#create <ide> rails_mandrill_inbound_emails POST /rails/action_mailbox/mandrill/inbound_emails(.:format) action_mailbox/ingresses/mandrill/inbound_emails#create <ide> class Rails::Command::RoutesTest < ActiveSupport::TestCase <ide> rails_direct_uploads POST /rails/active_storage/direct_uploads(.:format) active_storage/direct_uploads#create <ide> MESSAGE <ide> <del> assert_equal <<~MESSAGE, run_routes_command([ "-g", "basketballs" ]) <add> assert_match <<~MESSAGE, run_routes_command([ "-g", "basketballs" ]) <ide> Prefix Verb URI Pattern Controller#Action <ide> basketballs GET /basketballs(.:format) basketball#index <ide> MESSAGE <ide> class Rails::Command::RoutesTest < ActiveSupport::TestCase <ide> <ide> expected_cart_output = "Prefix Verb URI Pattern Controller#Action\n cart GET /cart(.:format) cart#show\n" <ide> output = run_routes_command(["-c", "cart"]) <del> assert_equal expected_cart_output, output <add> assert_match expected_cart_output, output <ide> <ide> output = run_routes_command(["-c", "Cart"]) <del> assert_equal expected_cart_output, output <add> assert_match expected_cart_output, output <ide> <ide> output = run_routes_command(["-c", "CartController"]) <del> assert_equal expected_cart_output, output <add> assert_match expected_cart_output, output <ide> <ide> expected_perm_output = [" Prefix Verb URI Pattern Controller#Action", <ide> "user_permission GET /user_permission(.:format) user_permission#index\n"].join("\n") <ide> output = run_routes_command(["-c", "user_permission"]) <del> assert_equal expected_perm_output, output <add> assert_match expected_perm_output, output <ide> <ide> output = run_routes_command(["-c", "UserPermission"]) <del> assert_equal expected_perm_output, output <add> assert_match expected_perm_output, output <ide> <ide> output = run_routes_command(["-c", "UserPermissionController"]) <del> assert_equal expected_perm_output, output <add> assert_match expected_perm_output, output <ide> end <ide> <ide> test "rails routes with namespaced controller search key" do <ide> class Rails::Command::RoutesTest < ActiveSupport::TestCase <ide> end <ide> RUBY <ide> <del> assert_equal <<~OUTPUT, run_routes_command([ "-c", "Admin::PostController" ]) <add> assert_match <<~OUTPUT, run_routes_command([ "-c", "Admin::PostController" ]) <ide> Prefix Verb URI Pattern Controller#Action <ide> new_admin_post GET /admin/post/new(.:format) admin/posts#new <ide> edit_admin_post GET /admin/post/edit(.:format) admin/posts#edit <ide> class Rails::Command::RoutesTest < ActiveSupport::TestCase <ide> POST /admin/post(.:format) admin/posts#create <ide> OUTPUT <ide> <del> assert_equal <<~OUTPUT, run_routes_command([ "-c", "PostController" ]) <add> assert_match <<~OUTPUT, run_routes_command([ "-c", "PostController" ]) <ide> Prefix Verb URI Pattern Controller#Action <ide> new_admin_post GET /admin/post/new(.:format) admin/posts#new <ide> edit_admin_post GET /admin/post/edit(.:format) admin/posts#edit <ide> class Rails::Command::RoutesTest < ActiveSupport::TestCase <ide> POST /admin/user_permission(.:format) admin/user_permissions#create <ide> OUTPUT <ide> <del> assert_equal expected_permission_output, run_routes_command([ "-c", "Admin::UserPermissionController" ]) <del> assert_equal expected_permission_output, run_routes_command([ "-c", "UserPermissionController" ]) <add> assert_match expected_permission_output, run_routes_command([ "-c", "Admin::UserPermissionController" ]) <add> assert_match expected_permission_output, run_routes_command([ "-c", "UserPermissionController" ]) <ide> end <ide> <ide> test "rails routes displays message when no routes are defined" do <ide> class Rails::Command::RoutesTest < ActiveSupport::TestCase <ide> end <ide> RUBY <ide> <del> assert_equal <<~MESSAGE, run_routes_command <add> assert_match <<~MESSAGE, run_routes_command <ide> Prefix Verb URI Pattern Controller#Action <ide> rails_mandrill_inbound_emails POST /rails/action_mailbox/mandrill/inbound_emails(.:format) action_mailbox/ingresses/mandrill/inbound_emails#create <ide> rails_postmark_inbound_emails POST /rails/action_mailbox/postmark/inbound_emails(.:format) action_mailbox/ingresses/postmark/inbound_emails#create <ide> class Rails::Command::RoutesTest < ActiveSupport::TestCase <ide> end <ide> <ide> # rubocop:disable Layout/TrailingWhitespace <del> assert_equal <<~MESSAGE, output <add> assert_match <<~MESSAGE, output <ide> --[ Route 1 ]-------------- <ide> Prefix | cart <ide> Verb | GET
8
Javascript
Javascript
fix undefined username and remove old function
8a1a7f238d892e9cdcfba0b17662360af6892fa1
<ide><path>server/boot/user.js <del>import _ from 'lodash'; <del>import async from 'async'; <add>import dedent from 'dedent'; <ide> import moment from 'moment'; <ide> import debugFactory from 'debug'; <ide> <del>import { ifNoUser401 } from '../utils/middleware'; <add>import { ifNoUser401, ifNoUserRedirectTo } from '../utils/middleware'; <ide> <ide> const debug = debugFactory('freecc:boot:user'); <ide> const daysBetween = 1.5; <add>const sendNonUserToMap = ifNoUserRedirectTo('/map'); <ide> <ide> function calcCurrentStreak(cals) { <ide> const revCals = cals.concat([Date.now()]).slice().reverse(); <ide> function dayDiff([head, tail]) { <ide> module.exports = function(app) { <ide> var router = app.loopback.Router(); <ide> var User = app.models.User; <del> var Story = app.models.Story; <add> // var Story = app.models.Story; <ide> <ide> router.get('/login', function(req, res) { <ide> res.redirect(301, '/signin'); <ide> module.exports = function(app) { <ide> router.post('/reset-password', postReset); <ide> router.get('/email-signup', getEmailSignup); <ide> router.get('/email-signin', getEmailSignin); <del> router.get('/toggle-lockdown-mode', toggleLockdownMode); <add> router.get( <add> '/toggle-lockdown-mode', <add> sendNonUserToMap, <add> toggleLockdownMode <add> ); <ide> router.post( <ide> '/account/delete', <ide> ifNoUser401, <ide> postDeleteAccount <ide> ); <del> router.get('/account/unlink/:provider', getOauthUnlink); <del> router.get('/account', getAccount); <add> router.get( <add> '/account', <add> sendNonUserToMap, <add> getAccount <add> ); <ide> router.get('/vote1', vote1); <ide> router.get('/vote2', vote2); <ide> // Ensure this is the last route! <ide> module.exports = function(app) { <ide> } <ide> <ide> function getAccount(req, res) { <del> return res.redirect('/' + user.username); <add> const { username } = req.user; <add> return res.redirect('/' + username); <ide> } <ide> <ide> function returnUser(req, res, next) { <ide> module.exports = function(app) { <ide> ); <ide> } <ide> <add> function toggleLockdownMode(req, res, next) { <add> if (req.user.lockdownMode === true) { <add> req.user.lockdownMode = false; <add> return req.user.save(function(err) { <add> if (err) { return next(err); } <ide> <del> <del> function toggleLockdownMode(req, res) { <del> if (req.user) { <del> if (req.user.lockdownMode === true) { <del> req.user.lockdownMode = false; <del> req.user.save(function (err) { <del> if (err) { <del> return next(err); <del> } <del> req.flash('success', {msg: 'Other people can now view all your challenge solutions. You can change this back at any time in the "Manage My Account" section at the bottom of this page.'}); <del> res.redirect(req.user.username); <add> req.flash('success', { <add> msg: dedent` <add> Other people can now view all your challenge solutions. <add> You can change this back at any time in the "Manage My Account" <add> section at the bottom of this page. <add> ` <ide> }); <del> } else { <del> req.user.lockdownMode = true; <del> req.user.save(function (err) { <del> if (err) { <del> return next(err); <del> } <del> req.flash('success', {msg: 'All your challenge solutions are now hidden from other people. You can change this back at any time in the "Manage My Account" section at the bottom of this page.'}); <del> res.redirect(req.user.username); <del> }); <del> } <del> } else { <del> req.flash('error', {msg: 'You must be signed in to change your account settings.'}); <del> res.redirect('/'); <add> res.redirect('/' + req.user.username); <add> }); <ide> } <add> req.user.lockdownMode = true; <add> return req.user.save(function(err) { <add> if (err) { return next(err); } <add> <add> req.flash('success', { <add> msg: dedent` <add> All your challenge solutions are now hidden from other people. <add> You can change this back at any time in the "Manage My Account" <add> section at the bottom of this page. <add> ` <add> }); <add> res.redirect('/' + req.user.username); <add> }); <ide> } <ide> <ide> function postDeleteAccount(req, res, next) { <ide> module.exports = function(app) { <ide> }); <ide> } <ide> <del> function getOauthUnlink(req, res, next) { <del> var provider = req.params.provider; <del> User.findById(req.user.id, function(err, user) { <del> if (err) { return next(err); } <del> <del> user[provider] = null; <del> user.tokens = <del> _.reject(user.tokens, function(token) { <del> return token.kind === provider; <del> }); <del> <del> user.save(function(err) { <del> if (err) { return next(err); } <del> req.flash('info', { msg: provider + ' account has been unlinked.' }); <del> res.redirect('/account'); <del> }); <del> }); <del> } <del> <ide> function getReset(req, res) { <ide> if (!req.accessToken) { <ide> req.flash('errors', { msg: 'access token invalid' }); <ide> module.exports = function(app) { <ide> }); <ide> } <ide> <add> /* <ide> function updateUserStoryPictures(userId, picture, username, cb) { <ide> Story.find({ 'author.userId': userId }, function(err, stories) { <ide> if (err) { return cb(err); } <ide> module.exports = function(app) { <ide> }); <ide> }); <ide> } <add> */ <ide> <del> function vote1(req, res) { <add> function vote1(req, res, next) { <ide> if (req.user) { <ide> req.user.tshirtVote = 1; <del> req.user.save(function (err) { <del> if (err) { <del> return next(err); <del> } <del> req.flash('success', {msg: 'Thanks for voting!'}); <add> req.user.save(function(err) { <add> if (err) { return next(err); } <add> <add> req.flash('success', { msg: 'Thanks for voting!' }); <ide> res.redirect('/map'); <ide> }); <ide> } else { <del> req.flash('error', {msg: 'You must be signed in to vote.'}); <add> req.flash('error', { msg: 'You must be signed in to vote.' }); <ide> res.redirect('/map'); <ide> } <ide> } <ide> <del> function vote2(req, res) { <add> function vote2(req, res, next) { <ide> if (req.user) { <ide> req.user.tshirtVote = 2; <del> req.user.save(function (err) { <del> if (err) { <del> return next(err); <del> } <del> req.flash('success', {msg: 'Thanks for voting!'}); <add> req.user.save(function(err) { <add> if (err) { return next(err); } <add> <add> req.flash('success', { msg: 'Thanks for voting!' }); <ide> res.redirect('/map'); <ide> }); <ide> } else {
1
Go
Go
update testrunwithblkioinvaliddevice tests
2236ecddfb89dcc09ba1f4f416b1e44e17308497
<ide><path>integration-cli/docker_cli_run_unix_test.go <ide> func (s *DockerSuite) TestRunWithBlkioInvalidWeightDevice(c *check.C) { <ide> <ide> func (s *DockerSuite) TestRunWithBlkioInvalidDeviceReadBps(c *check.C) { <ide> testRequires(c, blkioWeight) <del> out, _, err := dockerCmdWithError("run", "--device-read-bps", "/dev/sda:500", "busybox", "true") <add> out, _, err := dockerCmdWithError("run", "--device-read-bps", "/dev/sdX:500", "busybox", "true") <ide> c.Assert(err, check.NotNil, check.Commentf(out)) <ide> } <ide> <ide> func (s *DockerSuite) TestRunWithBlkioInvalidDeviceWriteBps(c *check.C) { <ide> testRequires(c, blkioWeight) <del> out, _, err := dockerCmdWithError("run", "--device-write-bps", "/dev/sda:500", "busybox", "true") <add> out, _, err := dockerCmdWithError("run", "--device-write-bps", "/dev/sdX:500", "busybox", "true") <ide> c.Assert(err, check.NotNil, check.Commentf(out)) <ide> } <ide>
1
Javascript
Javascript
set the target_commitish of the draft release
8be222bd96265d391bb4985aed5fbff3c8f0ed21
<ide><path>script/vsts/upload-artifacts.js <ide> const fs = require('fs') <ide> const os = require('os') <ide> const path = require('path') <ide> const glob = require('glob') <add>const spawnSync = require('../lib/spawn-sync') <ide> const publishRelease = require('publish-release') <ide> const releaseNotes = require('./lib/release-notes') <ide> const uploadToS3 = require('./lib/upload-to-s3') <ide> async function uploadArtifacts () { <ide> <ide> console.log(`New release notes:\n\n${newReleaseNotes}`) <ide> <add> const releaseSha = <add> !isNightlyRelease <add> ? spawnSync('git', ['rev-parse', 'HEAD']).stdout.toString().trimEnd() <add> : undefined <add> <ide> console.log(`Creating GitHub release v${releaseVersion}`) <ide> const release = <ide> await publishReleaseAsync({ <ide> async function uploadArtifacts () { <ide> repo: !isNightlyRelease ? 'atom' : 'atom-nightly-releases', <ide> name: CONFIG.computedAppVersion, <ide> notes: newReleaseNotes, <add> target_commitish: releaseSha, <ide> tag: `v${CONFIG.computedAppVersion}`, <ide> draft: !isNightlyRelease, <ide> prerelease: CONFIG.channel !== 'stable',
1
PHP
PHP
fix mock data
10c549f382c123264bfdd2aecd04124f3831aef1
<ide><path>tests/Database/DatabaseSoftDeletingTraitTest.php <ide> public function getUpdatedAtColumn() <ide> { <ide> return defined('static::UPDATED_AT') ? static::UPDATED_AT : 'updated_at'; <ide> } <add> <add> public function syncOriginal() <add> { <add> } <ide> }
1
PHP
PHP
add date_equals validation message
ef89ad7dd1890206f2ab6f28ab6331619990edbc
<ide><path>src/Illuminate/Validation/Concerns/ReplacesAttributes.php <ide> protected function replaceAfterOrEqual($message, $attribute, $rule, $parameters) <ide> return $this->replaceBefore($message, $attribute, $rule, $parameters); <ide> } <ide> <add> /** <add> * Replace all place-holders for the date_equals rule. <add> * <add> * @param string $message <add> * @param string $attribute <add> * @param string $rule <add> * @param array $parameters <add> * @return string <add> */ <add> protected function replaceDateEquals($message, $attribute, $rule, $parameters) <add> { <add> return $this->replaceBefore($message, $attribute, $rule, $parameters); <add> } <add> <ide> /** <ide> * Replace all place-holders for the dimensions rule. <ide> *
1
Text
Text
add daeyeon to collaborators
e4d06d26b8761a03c3e9849285348c58cb4c6bf4
<ide><path>README.md <ide> For information about the governance of the Node.js project, see <ide> **Shelley Vohr** <<shelley.vohr@gmail.com>> (she/her) <ide> * [cola119](https://github.com/cola119) - <ide> **Kohei Ueno** <<kohei.ueno119@gmail.com>> (he/him) <add>* [daeyeon](https://github.com/daeyeon) - <add> **Daeyeon Jeong** <<daeyeon.dev@gmail.com>> (he/him) <ide> * [danbev](https://github.com/danbev) - <ide> **Daniel Bevenius** <<daniel.bevenius@gmail.com>> (he/him) <ide> * [danielleadams](https://github.com/danielleadams) -
1
Javascript
Javascript
fix context in persian (fa) locale files
5004252b55a574fc759ac527c6b887d238829be2
<ide><path>src/locale/fa.js <ide> export default moment.defineLocale('fa', { <ide> relativeTime : { <ide> future : 'در %s', <ide> past : '%s پیش', <del> s : 'چندین ثانیه', <add> s : 'چند ثانیه', <ide> m : 'یک دقیقه', <ide> mm : '%d دقیقه', <ide> h : 'یک ساعت', <ide><path>src/test/locale/fa.js <ide> test('format week', function (assert) { <ide> <ide> test('from', function (assert) { <ide> var start = moment([2007, 1, 28]); <del> assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'چندین ثانیه', '44 seconds = a few seconds'); <add> assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'چند ثانیه', '44 seconds = a few seconds'); <ide> assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'یک دقیقه', '45 seconds = a minute'); <ide> assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'یک دقیقه', '89 seconds = a minute'); <ide> assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '۲ دقیقه', '90 seconds = 2 minutes'); <ide> test('from', function (assert) { <ide> }); <ide> <ide> test('suffix', function (assert) { <del> assert.equal(moment(30000).from(0), 'در چندین ثانیه', 'prefix'); <del> assert.equal(moment(0).from(30000), 'چندین ثانیه پیش', 'suffix'); <add> assert.equal(moment(30000).from(0), 'در چند ثانیه', 'prefix'); <add> assert.equal(moment(0).from(30000), 'چند ثانیه پیش', 'suffix'); <ide> }); <ide> <ide> test('now from now', function (assert) { <del> assert.equal(moment().fromNow(), 'چندین ثانیه پیش', 'now from now should display as in the past'); <add> assert.equal(moment().fromNow(), 'چند ثانیه پیش', 'now from now should display as in the past'); <ide> }); <ide> <ide> test('fromNow', function (assert) { <del> assert.equal(moment().add({s: 30}).fromNow(), 'در چندین ثانیه', 'in a few seconds'); <add> assert.equal(moment().add({s: 30}).fromNow(), 'در چند ثانیه', 'in a few seconds'); <ide> assert.equal(moment().add({d: 5}).fromNow(), 'در ۵ روز', 'in 5 days'); <ide> }); <ide>
2
Javascript
Javascript
add codegen flowtypes to unimplementednativeview
2c1fd6f764f92669351713a6373a113ea6cb5da2
<ide><path>Libraries/Components/UnimplementedViews/UnimplementedNativeView.js <del>/** <del> * Copyright (c) Facebook, Inc. and its affiliates. <del> * <del> * This source code is licensed under the MIT license found in the <del> * LICENSE file in the root directory of this source tree. <del> * <del> * @format <del> * @flow <del> */ <del> <del>'use strict'; <del> <del>const requireNativeComponent = require('../../ReactNative/requireNativeComponent'); <del> <del>import type {ViewProps} from '../View/ViewPropTypes'; <del>import type {ViewStyleProp} from '../../StyleSheet/StyleSheet'; <del>import type {NativeComponent} from '../../Renderer/shims/ReactNative'; <del> <del>type NativeProps = $ReadOnly<{| <del> ...ViewProps, <del> name?: ?string, <del> style?: ?ViewStyleProp, <del>|}>; <del> <del>type UnimplementedViewNativeType = Class<NativeComponent<NativeProps>>; <del> <del>module.exports = ((requireNativeComponent( <del> 'UnimplementedNativeView', <del>): any): UnimplementedViewNativeType); <ide><path>Libraries/Components/UnimplementedViews/UnimplementedNativeViewNativeComponent.js <add>/** <add> * Copyright (c) Facebook, Inc. and its affiliates. <add> * <add> * This source code is licensed under the MIT license found in the <add> * LICENSE file in the root directory of this source tree. <add> * <add> * @format <add> * @flow <add> */ <add> <add>'use strict'; <add> <add>import type {WithDefault} from '../../Types/CodegenTypes'; <add>import type {ViewProps} from '../View/ViewPropTypes'; <add> <add>import codegenNativeComponent from '../../Utilities/codegenNativeComponent'; <add> <add>type NativeProps = $ReadOnly<{| <add> ...ViewProps, <add> name?: ?WithDefault<string, ''>, <add>|}>; <add> <add>// NOTE: This compoenent is not implemented in paper <add>// Do not include in paper builds <add>module.exports = codegenNativeComponent<NativeProps>( <add> './UnimplementedNativeViewNativeViewConfig', <add>);
2
Mixed
Go
add cgroupdriver to docker info
ca89c329b9f0748da74d08d02a47bc494e7965e2
<ide><path>api/client/info.go <ide> func (cli *DockerCli) CmdInfo(args ...string) error { <ide> } <ide> ioutils.FprintfIfNotEmpty(cli.out, "Execution Driver: %s\n", info.ExecutionDriver) <ide> ioutils.FprintfIfNotEmpty(cli.out, "Logging Driver: %s\n", info.LoggingDriver) <add> ioutils.FprintfIfNotEmpty(cli.out, "Cgroup Driver: %s\n", info.CgroupDriver) <ide> <ide> fmt.Fprintf(cli.out, "Plugins: \n") <ide> fmt.Fprintf(cli.out, " Volume:") <ide><path>daemon/daemon_unix.go <ide> func verifyContainerResources(resources *containertypes.Resources, sysInfo *sysi <ide> return warnings, nil <ide> } <ide> <add>func (daemon *Daemon) getCgroupDriver() string { <add> cgroupDriver := "cgroupfs" <add> if daemon.usingSystemd() { <add> cgroupDriver = "systemd" <add> } <add> return cgroupDriver <add>} <add> <ide> func usingSystemd(config *Config) bool { <ide> for _, option := range config.ExecOptions { <ide> key, val, err := parsers.ParseKeyValueOpt(option) <ide><path>daemon/daemon_windows.go <ide> func checkKernel() error { <ide> return nil <ide> } <ide> <add>func (daemon *Daemon) getCgroupDriver() string { <add> return "" <add>} <add> <ide> // adaptContainerSettings is called during container creation to modify any <ide> // settings necessary in the HostConfig structure. <ide> func (daemon *Daemon) adaptContainerSettings(hostConfig *containertypes.HostConfig, adjustCPUShares bool) error { <ide><path>daemon/info.go <ide> func (daemon *Daemon) SystemInfo() (*types.Info, error) { <ide> SystemTime: time.Now().Format(time.RFC3339Nano), <ide> ExecutionDriver: daemon.ExecutionDriver().Name(), <ide> LoggingDriver: daemon.defaultLogConfig.Type, <add> CgroupDriver: daemon.getCgroupDriver(), <ide> NEventsListener: daemon.EventsService.SubscribersCount(), <ide> KernelVersion: kernelVersion, <ide> OperatingSystem: operatingSystem, <ide><path>docs/reference/api/docker_remote_api.md <ide> This section lists each version from latest to oldest. Each listing includes a <ide> * `GET /networks/(name)` now returns an `EnableIPv6` field showing whether the network has ipv6 enabled or not. <ide> * `POST /containers/(name)/update` now supports updating container's restart policy. <ide> * `POST /networks/create` now supports enabling ipv6 on the network by setting the `EnableIPv6` field (doing this with a label will no longer work). <add>* `GET /info` now returns `CgroupDriver` field showing what cgroup driver the daemon is using; `cgroupfs` or `systemd`. <ide> <ide> ### v1.22 API changes <ide> <ide><path>docs/reference/api/docker_remote_api_v1.23.md <ide> Display system-wide information <ide> <ide> { <ide> "Architecture": "x86_64", <add> "CgroupDriver": "cgroupfs", <ide> "Containers": 11, <ide> "ContainersRunning": 7, <ide> "ContainersStopped": 3, <ide><path>docs/reference/commandline/info.md <ide> For example: <ide> Dirperm1 Supported: true <ide> Execution Driver: native-0.2 <ide> Logging Driver: json-file <add> Cgroup Driver: cgroupfs <ide> Plugins: <ide> Volume: local <ide> Network: bridge null host <ide><path>man/docker-info.1.md <ide> Here is a sample output: <ide> Dirs: 80 <ide> Execution Driver: native-0.2 <ide> Logging Driver: json-file <add> Cgroup Driver: cgroupfs <ide> Plugins: <ide> Volume: local <ide> Network: bridge null host
8
Javascript
Javascript
fix bug in target tracking
f7c5087b3a6ab596ec50166b3fbe9f3cacda1661
<ide><path>lib/FlagDependencyExportsPlugin.js <ide> class FlagDependencyExportsPlugin { <ide> ) { <ide> changed = true; <ide> } <del> // TODO support from, calculate target for all imported provided exports <del> // run dynamic-reexports test case!! <ide> } else if (Array.isArray(exports)) { <ide> /** <ide> * merge in new exports <ide> class FlagDependencyExportsPlugin { <ide> targetExportsInfo = targetModuleExportsInfo.getNestedExportsInfo( <ide> target.export <ide> ); <add> // add dependency for this module <add> const set = dependencies.get(target.module); <add> if (set === undefined) { <add> dependencies.set(target.module, new Set([module])); <add> } else { <add> set.add(module); <add> } <ide> } <ide> <ide> if (exportInfo.exportsInfoOwned) { <ide> class FlagDependencyExportsPlugin { <ide> module = queue.dequeue(); <ide> <ide> exportsInfo = moduleGraph.getExportsInfo(module); <del> if (exportsInfo.otherExportsInfo.provided !== null) { <del> if (!module.buildMeta || !module.buildMeta.exportsType) { <add> if (!module.buildMeta || !module.buildMeta.exportsType) { <add> if (exportsInfo.otherExportsInfo.provided !== null) { <ide> // It's a module without declared exports <ide> exportsInfo.setUnknownExportsProvided(); <ide> modulesToStore.add(module); <ide> notifyDependencies(); <del> } else { <del> // It's a module with declared exports <add> } <add> } else { <add> // It's a module with declared exports <ide> <del> cacheable = true; <del> changed = false; <add> cacheable = true; <add> changed = false; <ide> <del> processDependenciesBlock(module); <add> processDependenciesBlock(module); <ide> <del> if (cacheable) { <del> modulesToStore.add(module); <del> } <add> if (cacheable) { <add> modulesToStore.add(module); <add> } <ide> <del> if (changed) { <del> notifyDependencies(); <del> } <add> if (changed) { <add> notifyDependencies(); <ide> } <ide> } <ide> }
1
Text
Text
create model card
13a8588f2d70fe78dc36d84829c04fa9d39572d1
<ide><path>model_cards/mrm8488/electra-base-finetuned-squadv1/README.md <add>--- <add>language: english <add>--- <add> <add># Electra base ⚡ + SQuAD v1 ❓ <add> <add>[Electra-base-discriminator](https://huggingface.co/google/electra-base-discriminator) fine-tuned on [SQUAD v1.1 dataset](https://rajpurkar.github.io/SQuAD-explorer/explore/1.1/dev/) for **Q&A** downstream task. <add> <add>## Details of the downstream task (Q&A) - Model 🧠 <add> <add>**ELECTRA** is a new method for self-supervised language representation learning. It can be used to pre-train transformer networks using relatively little compute. ELECTRA models are trained to distinguish "real" input tokens vs "fake" input tokens generated by another neural network, similar to the discriminator of a [GAN](https://arxiv.org/pdf/1406.2661.pdf). At small scale, ELECTRA achieves strong results even when trained on a single GPU. At large scale, ELECTRA achieves state-of-the-art results on the [SQuAD 2.0](https://rajpurkar.github.io/SQuAD-explorer/) dataset. <add> <add> <add>## Details of the downstream task (Q&A) - Dataset 📚 <add> <add>**S**tanford **Q**uestion **A**nswering **D**ataset (SQuAD) is a reading comprehension dataset, consisting of questions posed by crowdworkers on a set of Wikipedia articles, where the answer to every question is a segment of text, or span, from the corresponding reading passage, or the question might be unanswerable. <add>SQuAD v1.1 contains **100,000+** question-answer pairs on **500+** articles. <add> <add>## Model training 🏋️‍ <add> <add>The model was trained on a Tesla P100 GPU and 25GB of RAM with the following command: <add> <add>```bash <add>python transformers/examples/question-answering/run_squad.py \ <add> --model_type electra \ <add> --model_name_or_path 'google/electra-base-discriminator' \ <add> --do_eval \ <add> --do_train \ <add> --do_lower_case \ <add> --train_file '/content/dataset/train-v1.1.json' \ <add> --predict_file '/content/dataset/dev-v1.1.json' \ <add> --per_gpu_train_batch_size 16 \ <add> --learning_rate 3e-5 \ <add> --num_train_epochs 10 \ <add> --max_seq_length 384 \ <add> --doc_stride 128 \ <add> --output_dir '/content/output' \ <add> --overwrite_output_dir \ <add> --save_steps 1000 <add>``` <add> <add>## Test set Results 🧾 <add> <add>| Metric | # Value | <add>| ------ | --------- | <add>| **EM** | **83.03** | <add>| **F1** | **90.77** | <add>| **Size**| **+ 400 MB** | <add> <add>Very good metrics for such a "small" model! <add> <add>```json <add>{ <add>'exact': 83.03689687795648, <add>'f1': 90.77486052446231, <add>'total': 10570, <add>'HasAns_exact': 83.03689687795648, <add>'HasAns_f1': 90.77486052446231, <add>'HasAns_total': 10570, <add>'best_exact': 83.03689687795648, <add>'best_exact_thresh': 0.0, <add>'best_f1': 90.77486052446231, <add>'best_f1_thresh': 0.0 <add>} <add>``` <add> <add>### Model in action 🚀 <add> <add>Fast usage with **pipelines**: <add> <add>```python <add>from transformers import pipeline <add> <add>QnA_pipeline = pipeline('question-answering', model='mrm8488/electra-base-finetuned-squadv1') <add> <add>QnA_pipeline({ <add> 'context': 'A new strain of flu that has the potential to become a pandemic has been identified in China by scientists.', <add> 'question': 'What has been discovered by scientists from China ?' <add>}) <add># Output: <add>{'answer': 'A new strain of flu', 'end': 19, 'score': 0.9995211430099182, 'start': 0} <add>``` <add> <add>> Created by [Manuel Romero/@mrm8488](https://twitter.com/mrm8488) | [LinkedIn](https://www.linkedin.com/in/manuel-romero-cs/) <add>> Made with <span style="color: #e25555;">&hearts;</span> in Spain
1
Ruby
Ruby
raise error if no rewriting"
2b60a99d4ac8721d2976db0fa1447f90768ebd07
<ide><path>Library/Homebrew/test/utils/shebang_spec.rb <del># typed: false <del># frozen_string_literal: true <del> <del>require "utils/shebang" <del> <del>describe Utils::Shebang do <del> let(:file) { Tempfile.new("shebang") } <del> <del> before do <del> file.write "#!/usr/bin/python" <del> file.flush <del> end <del> <del> after { file.unlink } <del> <del> describe "rewrite_shebang" do <del> it "rewrites a shebang" do <del> rewrite_info = Utils::Shebang::RewriteInfo.new(/^#!.*python$/, 25, "new_shebang") <del> described_class.rewrite_shebang rewrite_info, file <del> expect(File.read(file)).to eq "#!new_shebang" <del> end <del> <del> it "raises an error if no rewriting occurs" do <del> rewrite_info = Utils::Shebang::RewriteInfo.new(/^#!.*perl$/, 25, "new_shebang") <del> expect { <del> described_class.rewrite_shebang rewrite_info, file <del> }.to raise_error("No matching files found to rewrite shebang") <del> end <del> end <del>end <ide><path>Library/Homebrew/utils/shebang.rb <ide> def initialize(regex, max_length, replacement) <ide> # @api public <ide> sig { params(rewrite_info: RewriteInfo, paths: T::Array[T.any(String, Pathname)]).void } <ide> def rewrite_shebang(rewrite_info, *paths) <del> found = T.let(false, T::Boolean) <ide> paths.each do |f| <ide> f = Pathname(f) <ide> next unless f.file? <ide> next unless rewrite_info.regex.match?(f.read(rewrite_info.max_length)) <ide> <ide> Utils::Inreplace.inreplace f.to_s, rewrite_info.regex, "#!#{rewrite_info.replacement}" <del> found = true <ide> end <del> <del> raise "No matching files found to rewrite shebang" unless found <ide> end <ide> end <ide> end
2
Javascript
Javascript
ignore missing editable regions
dd7fba4558f5a0c4b2dc35ebd919c22921c0b0df
<ide><path>client/src/templates/Challenges/classic/Editor.js <ide> class Editor extends Component { <ide> ); <ide> this.data.model = model; <ide> <del> const editableRegion = [ <del> ...challengeFiles[fileKey].editableRegionBoundaries <del> ]; <add> const editableRegion = challengeFiles[fileKey].editableRegionBoundaries <add> ? [...challengeFiles[fileKey].editableRegionBoundaries] <add> : []; <ide> <ide> if (editableRegion.length === 2) <ide> this.decorateForbiddenRanges(editableRegion); <ide> class Editor extends Component { <ide> } <ide> }); <ide> <del> const editableBoundaries = [ <del> ...challengeFiles[fileKey].editableRegionBoundaries <del> ]; <add> const editableBoundaries = challengeFiles[fileKey].editableRegionBoundaries <add> ? [...challengeFiles[fileKey].editableRegionBoundaries] <add> : []; <ide> <ide> if (editableBoundaries.length === 2) { <ide> // TODO: is there a nicer approach/way of organising everything that
1
PHP
PHP
skip a frame so warning is in app code
3f3c8b74ed7d6fbd87c1cdb9d7d0b0d483cec429
<ide><path>src/Datasource/QueryTrait.php <ide> public function __call(string $method, array $arguments) <ide> 'Calling result set method `%s()` directly on query instance is deprecated. ' . <ide> 'You must call `all()` to retrieve the results first.', <ide> $method <del> )); <add> ), 2); <ide> $results = $this->all(); <ide> <ide> return $results->$method(...$arguments);
1
Javascript
Javascript
move docs for $$messageformat to module namespace
9a7431c71b7d2a08cd8e14394d88da3229afcd53
<ide><path>src/ngMessageFormat/messageFormatService.js <ide> /* global stringify: false */ <ide> <ide> /** <del> * @ngdoc service <del> * @name $$messageFormat <add> * @ngdoc module <add> * @name ngMessageFormat <add> * @packageName angular-message-format <ide> * <ide> * @description <del> * Angular internal service to recognize MessageFormat extensions in interpolation expressions. <del> * For more information, see: <del> * https://docs.google.com/a/google.com/document/d/1pbtW2yvtmFBikfRrJd8VAsabiFkKezmYZ_PbgdjQOVU/edit <ide> * <del> * @example <del> * ## Gender <add> * ## What is ngMessageFormat? <add> * <add> * The ngMessageFormat module extends the Angular {@link ng.$interpolate `$interpolate`} service <add> * with a syntax for handling pluralization and gender specific messages, which is based on the <add> * [ICU MessageFormat syntax][ICU]. <add> * <add> * See [the design doc][ngMessageFormat doc] for more information. <add> * <add> * [ICU]: http://userguide.icu-project.org/formatparse/messages#TOC-MessageFormat <add> * [ngMessageFormat doc]: https://docs.google.com/a/google.com/document/d/1pbtW2yvtmFBikfRrJd8VAsabiFkKezmYZ_PbgdjQOVU/edit <add> * <add> * ## Examples <add> * <add> * ### Gender <ide> * <ide> * This example uses the "select" keyword to specify the message based on gender. <ide> * <del> * <example name="ngMessageFormat-example-gender" module="msgFmtExample" deps="angular-message-format.min.js"> <add> * <example name="ngMessageFormat-example-gender" module="msgFmtExample" deps="angular-message-format.js"> <ide> * <file name="index.html"> <ide> * <div ng-controller="AppController"> <ide> * Select Recipient:<br> <ide> * </file> <ide> * </example> <ide> * <del> * @example <del> * ## Plural <add> * ### Plural <ide> * <ide> * This example shows how the "plural" keyword is used to account for a variable number of entities. <ide> * The "#" variable holds the current number and can be embedded in the message. <ide> * <ide> * The example also shows the "offset" keyword, which allows you to offset the value of the "#" variable. <ide> * <del> * <example name="ngMessageFormat-example-plural" module="msgFmtExample" deps="angular-message-format.min.js"> <add> * <example name="ngMessageFormat-example-plural" module="msgFmtExample" deps="angular-message-format.js"> <ide> * <file name="index.html"> <ide> * <div ng-controller="AppController"> <ide> Select recipients:<br> <ide> * </file> <ide> * </example> <ide> * <del> * @example <del> * ## Plural and Gender <add> * ### Plural and Gender together <ide> * <ide> * This example shows how you can specify gender rules for specific plural matches - in this case, <ide> * =1 is special cased for gender. <del> * <example name="ngMessageFormat-example-plural-gender" module="msgFmtExample" deps="angular-message-format.min.js"> <add> * <example name="ngMessageFormat-example-plural-gender" module="msgFmtExample" deps="angular-message-format.js"> <ide> * <file name="index.html"> <ide> * <div ng-controller="AppController"> <ide> Select recipients:<br> <ide> * </file> <ide> </example> <ide> */ <add> <ide> var $$MessageFormatFactory = ['$parse', '$locale', '$sce', '$exceptionHandler', function $$messageFormat( <ide> $parse, $locale, $sce, $exceptionHandler) { <ide> <ide> var $$interpolateDecorator = ['$$messageFormat', '$delegate', function $$interpo <ide> return interpolate; <ide> }]; <ide> <del> <del>/** <del> * @ngdoc module <del> * @name ngMessageFormat <del> * @packageName angular-message-format <del> * @description <del> */ <ide> var module = window['angular']['module']('ngMessageFormat', ['ng']); <ide> module['factory']('$$messageFormat', $$MessageFormatFactory); <ide> module['config'](['$provide', function($provide) { <ide> $provide['decorator']('$interpolate', $$interpolateDecorator); <del>}]); <add>}]); <ide>\ No newline at end of file
1
Text
Text
add c++ client library
e54d8c47e45ca19ab9548a7e3689aa1584733210
<ide><path>docs/sources/reference/api/remote_api_client_libraries.md <ide> will add the libraries here. <ide> <td><a class="reference external" href="https://github.com/ahmetalpbalkan/Docker.DotNet">https://github.com/ahmetalpbalkan/Docker.DotNet</a></td> <ide> <td>Active</td> <ide> </tr> <add> <tr class="row-even"> <add> <td>C++</td> <add> <td>lasote/docker_client</td> <add> <td><a class="reference external" href="http://www.biicode.com/lasote/docker_client">http://www.biicode.com/lasote/docker_client (Biicode C++ dependency manager)</a></td> <add> <td>Active</td> <add> </tr> <ide> <tr class="row-odd"> <ide> <td>Erlang</td> <ide> <td>erldocker</td>
1
Python
Python
remove django 1.8 & 1.9 compatibility code
c674687782ef96a3bb8466b412e99debd3d04f00
<ide><path>rest_framework/authtoken/management/commands/drf_create_token.py <ide> from django.contrib.auth import get_user_model <ide> from django.core.management.base import BaseCommand, CommandError <del>from rest_framework.authtoken.models import Token <ide> <add>from rest_framework.authtoken.models import Token <ide> <ide> UserModel = get_user_model() <ide> <ide><path>rest_framework/compat.py <ide> def distinct(queryset, base): <ide> return queryset.distinct() <ide> <ide> <del># Obtaining manager instances and names from model options differs after 1.10. <del>def get_names_and_managers(options): <del> if django.VERSION >= (1, 10): <del> # Django 1.10 onwards provides a `.managers` property on the Options. <del> return [ <del> (manager.name, manager) <del> for manager <del> in options.managers <del> ] <del> # For Django 1.8 and 1.9, use the three-tuple information provided <del> # by .concrete_managers and .abstract_managers <del> return [ <del> (manager_info[1], manager_info[2]) <del> for manager_info <del> in (options.concrete_managers + options.abstract_managers) <del> ] <del> <del> <del># field.rel is deprecated from 1.9 onwards <del>def get_remote_field(field, **kwargs): <del> if 'default' in kwargs: <del> if django.VERSION < (1, 9): <del> return getattr(field, 'rel', kwargs['default']) <del> return getattr(field, 'remote_field', kwargs['default']) <del> <del> if django.VERSION < (1, 9): <del> return field.rel <del> return field.remote_field <del> <del> <ide> def _resolve_model(obj): <ide> """ <ide> Resolve supplied `obj` to a Django model class. <ide> def _resolve_model(obj): <ide> raise ValueError("{0} is not a Django model".format(obj)) <ide> <ide> <del>def is_authenticated(user): <del> if django.VERSION < (1, 10): <del> return user.is_authenticated() <del> return user.is_authenticated <del> <del> <del>def is_anonymous(user): <del> if django.VERSION < (1, 10): <del> return user.is_anonymous() <del> return user.is_anonymous <del> <del> <del>def get_related_model(field): <del> if django.VERSION < (1, 9): <del> return _resolve_model(field.rel.to) <del> return field.remote_field.model <del> <del> <del>def value_from_object(field, obj): <del> if django.VERSION < (1, 9): <del> return field._get_val_from_obj(obj) <del> return field.value_from_object(obj) <del> <del> <del># contrib.postgres only supported from 1.8 onwards. <add># django.contrib.postgres requires psycopg2 <ide> try: <ide> from django.contrib.postgres import fields as postgres_fields <ide> except ImportError: <ide> postgres_fields = None <ide> <ide> <del># JSONField is only supported from 1.9 onwards <del>try: <del> from django.contrib.postgres.fields import JSONField <del>except ImportError: <del> JSONField = None <del> <del> <ide> # coreapi is optional (Note that uritemplate is a dependency of coreapi) <ide> try: <ide> import coreapi <ide> def md_filter_add_syntax_highlight(md): <ide> LONG_SEPARATORS = (b', ', b': ') <ide> INDENT_SEPARATORS = (b',', b': ') <ide> <del>try: <del> # DecimalValidator is unavailable in Django < 1.9 <del> from django.core.validators import DecimalValidator <del>except ImportError: <del> DecimalValidator = None <ide> <ide> class CustomValidatorMessage(object): <ide> """ <ide> We need to avoid evaluation of `lazy` translated `message` in `django.core.validators.BaseValidator.__init__`. <ide> https://github.com/django/django/blob/75ed5900321d170debef4ac452b8b3cf8a1c2384/django/core/validators.py#L297 <del> <add> <ide> Ref: https://github.com/encode/django-rest-framework/pull/5452 <ide> """ <ide> def __init__(self, *args, **kwargs): <ide> def set_rollback(): <ide> pass <ide> <ide> <del>def template_render(template, context=None, request=None): <del> """ <del> Passing Context or RequestContext to Template.render is deprecated in 1.9+, <del> see https://github.com/django/django/pull/3883 and <del> https://github.com/django/django/blob/1.9/django/template/backends/django.py#L82-L84 <del> <del> :param template: Template instance <del> :param context: dict <del> :param request: Request instance <del> :return: rendered template as SafeText instance <del> """ <del> if isinstance(template, Template): <del> if request: <del> context = RequestContext(request, context) <del> else: <del> context = Context(context) <del> return template.render(context) <del> # backends template, e.g. django.template.backends.django.Template <del> else: <del> return template.render(context, request=request) <del> <del> <del>def set_many(instance, field, value): <del> if django.VERSION < (1, 10): <del> setattr(instance, field, value) <del> else: <del> field = getattr(instance, field) <del> field.set(value) <del> <del> <del>def include(module, namespace=None, app_name=None): <del> from django.conf.urls import include <del> if django.VERSION < (1,9): <del> return include(module, namespace, app_name) <del> else: <del> return include((module, app_name), namespace) <del> <del> <ide> def authenticate(request=None, **credentials): <ide> from django.contrib.auth import authenticate <ide> if django.VERSION < (1, 11): <ide><path>rest_framework/fields.py <ide> from rest_framework import ISO_8601 <ide> from rest_framework.compat import ( <ide> InvalidTimeError, MaxLengthValidator, MaxValueValidator, <del> MinLengthValidator, MinValueValidator, get_remote_field, unicode_repr, <del> unicode_to_repr, value_from_object <add> MinLengthValidator, MinValueValidator, unicode_repr, unicode_to_repr <ide> ) <ide> from rest_framework.exceptions import ErrorDetail, ValidationError <ide> from rest_framework.settings import api_settings <ide> def __init__(self, model_field, **kwargs): <ide> MaxLengthValidator(self.max_length, message=message)) <ide> <ide> def to_internal_value(self, data): <del> rel = get_remote_field(self.model_field, default=None) <add> rel = self.model_field.remote_field <ide> if rel is not None: <ide> return rel.model._meta.get_field(rel.field_name).to_python(data) <ide> return self.model_field.to_python(data) <ide> def get_attribute(self, obj): <ide> return obj <ide> <ide> def to_representation(self, obj): <del> value = value_from_object(self.model_field, obj) <add> value = self.model_field.value_from_object(obj) <ide> if is_protected_type(value): <ide> return value <ide> return self.model_field.value_to_string(obj) <ide><path>rest_framework/filters.py <ide> from django.utils.encoding import force_text <ide> from django.utils.translation import ugettext_lazy as _ <ide> <del>from rest_framework.compat import ( <del> coreapi, coreschema, distinct, guardian, template_render <del>) <add>from rest_framework.compat import coreapi, coreschema, distinct, guardian <ide> from rest_framework.settings import api_settings <ide> <ide> <ide> def to_html(self, request, queryset, view): <ide> 'term': term <ide> } <ide> template = loader.get_template(self.template) <del> return template_render(template, context) <add> return template.render(context) <ide> <ide> def get_schema_fields(self, view): <ide> assert coreapi is not None, 'coreapi must be installed to use `get_schema_fields()`' <ide> def get_template_context(self, request, queryset, view): <ide> def to_html(self, request, queryset, view): <ide> template = loader.get_template(self.template) <ide> context = self.get_template_context(request, queryset, view) <del> return template_render(template, context) <add> return template.render(context) <ide> <ide> def get_schema_fields(self, view): <ide> assert coreapi is not None, 'coreapi must be installed to use `get_schema_fields()`' <ide><path>rest_framework/pagination.py <ide> from django.utils.six.moves.urllib import parse as urlparse <ide> from django.utils.translation import ugettext_lazy as _ <ide> <del>from rest_framework.compat import coreapi, coreschema, template_render <add>from rest_framework.compat import coreapi, coreschema <ide> from rest_framework.exceptions import NotFound <ide> from rest_framework.response import Response <ide> from rest_framework.settings import api_settings <ide> def page_number_to_url(page_number): <ide> def to_html(self): <ide> template = loader.get_template(self.template) <ide> context = self.get_html_context() <del> return template_render(template, context) <add> return template.render(context) <ide> <ide> def get_schema_fields(self, view): <ide> assert coreapi is not None, 'coreapi must be installed to use `get_schema_fields()`' <ide> def page_number_to_url(page_number): <ide> def to_html(self): <ide> template = loader.get_template(self.template) <ide> context = self.get_html_context() <del> return template_render(template, context) <add> return template.render(context) <ide> <ide> def get_schema_fields(self, view): <ide> assert coreapi is not None, 'coreapi must be installed to use `get_schema_fields()`' <ide> def get_html_context(self): <ide> def to_html(self): <ide> template = loader.get_template(self.template) <ide> context = self.get_html_context() <del> return template_render(template, context) <add> return template.render(context) <ide> <ide> def get_schema_fields(self, view): <ide> assert coreapi is not None, 'coreapi must be installed to use `get_schema_fields()`' <ide><path>rest_framework/permissions.py <ide> from django.http import Http404 <ide> <ide> from rest_framework import exceptions <del>from rest_framework.compat import is_authenticated <ide> <ide> SAFE_METHODS = ('GET', 'HEAD', 'OPTIONS') <ide> <ide> class IsAuthenticated(BasePermission): <ide> """ <ide> <ide> def has_permission(self, request, view): <del> return request.user and is_authenticated(request.user) <add> return request.user and request.user.is_authenticated <ide> <ide> <ide> class IsAdminUser(BasePermission): <ide> def has_permission(self, request, view): <ide> return ( <ide> request.method in SAFE_METHODS or <ide> request.user and <del> is_authenticated(request.user) <add> request.user.is_authenticated <ide> ) <ide> <ide> <ide> def has_permission(self, request, view): <ide> return True <ide> <ide> if not request.user or ( <del> not is_authenticated(request.user) and self.authenticated_users_only): <add> not request.user.is_authenticated and self.authenticated_users_only): <ide> return False <ide> <ide> queryset = self._queryset(view) <ide><path>rest_framework/renderers.py <ide> from django.core.exceptions import ImproperlyConfigured <ide> from django.core.paginator import Page <ide> from django.http.multipartparser import parse_header <del>from django.template import Template, loader <add>from django.template import engines, loader <ide> from django.test.client import encode_multipart <ide> from django.utils import six <ide> from django.utils.html import mark_safe <ide> <ide> from rest_framework import VERSION, exceptions, serializers, status <ide> from rest_framework.compat import ( <ide> INDENT_SEPARATORS, LONG_SEPARATORS, SHORT_SEPARATORS, coreapi, <del> pygments_css, template_render <add> pygments_css <ide> ) <ide> from rest_framework.exceptions import ParseError <ide> from rest_framework.request import is_form_media_type, override_method <ide> def render(self, data, accepted_media_type=None, renderer_context=None): <ide> context = self.resolve_context(data, request, response) <ide> else: <ide> context = self.get_template_context(data, renderer_context) <del> return template_render(template, context, request=request) <add> return template.render(context, request=request) <ide> <ide> def resolve_template(self, template_names): <ide> return loader.select_template(template_names) <ide> def get_exception_template(self, response): <ide> return self.resolve_template(template_names) <ide> except Exception: <ide> # Fall back to using eg '404 Not Found' <del> return Template('%d %s' % (response.status_code, <del> response.status_text.title())) <add> body = '%d %s' % (response.status_code, response.status_text.title()) <add> template = engines['django'].from_string(body) <add> return template <ide> <ide> <ide> # Note, subclass TemplateHTMLRenderer simply for the exception behavior <ide> def render(self, data, accepted_media_type=None, renderer_context=None): <ide> context = self.resolve_context(data, request, response) <ide> else: <ide> context = self.get_template_context(data, renderer_context) <del> return template_render(template, context, request=request) <add> return template.render(context, request=request) <ide> <ide> return data <ide> <ide> def render_field(self, field, parent_style): <ide> <ide> template = loader.get_template(template_name) <ide> context = {'field': field, 'style': style} <del> return template_render(template, context) <add> return template.render(context) <ide> <ide> def render(self, data, accepted_media_type=None, renderer_context=None): <ide> """ <ide> def render(self, data, accepted_media_type=None, renderer_context=None): <ide> 'form': form, <ide> 'style': style <ide> } <del> return template_render(template, context) <add> return template.render(context) <ide> <ide> <ide> class BrowsableAPIRenderer(BaseRenderer): <ide> def get_filter_form(self, data, view, request): <ide> <ide> template = loader.get_template(self.filter_template) <ide> context = {'elements': elements} <del> return template_render(template, context) <add> return template.render(context) <ide> <ide> def get_context(self, data, accepted_media_type, renderer_context): <ide> """ <ide> def render(self, data, accepted_media_type=None, renderer_context=None): <ide> <ide> template = loader.get_template(self.template) <ide> context = self.get_context(data, accepted_media_type, renderer_context) <del> ret = template_render(template, context, request=renderer_context['request']) <add> ret = template.render(context, request=renderer_context['request']) <ide> <ide> # Munge DELETE Response code to allow us to return content <ide> # (Do this *after* we've rendered the template so that we include <ide> def render(self, data, accepted_media_type=None, renderer_context=None): <ide> <ide> template = loader.get_template(self.template) <ide> context = self.get_context(data, accepted_media_type, renderer_context) <del> ret = template_render(template, context, request=renderer_context['request']) <add> ret = template.render(context, request=renderer_context['request']) <ide> <ide> # Creation and deletion should use redirects in the admin style. <ide> if response.status_code == status.HTTP_201_CREATED and 'Location' in response: <ide> def get_context(self, data, request): <ide> def render(self, data, accepted_media_type=None, renderer_context=None): <ide> template = loader.get_template(self.template) <ide> context = self.get_context(data, renderer_context['request']) <del> return template_render(template, context, request=renderer_context['request']) <add> return template.render(context, request=renderer_context['request']) <ide> <ide> <ide> class SchemaJSRenderer(BaseRenderer): <ide> def render(self, data, accepted_media_type=None, renderer_context=None): <ide> template = loader.get_template(self.template) <ide> context = {'schema': mark_safe(schema)} <ide> request = renderer_context['request'] <del> return template_render(template, context, request=request) <add> return template.render(context, request=request) <ide> <ide> <ide> class MultiPartRenderer(BaseRenderer): <ide><path>rest_framework/serializers.py <ide> from django.utils.functional import cached_property <ide> from django.utils.translation import ugettext_lazy as _ <ide> <del>from rest_framework.compat import JSONField as ModelJSONField <del>from rest_framework.compat import postgres_fields, set_many, unicode_to_repr <add>from rest_framework.compat import postgres_fields, unicode_to_repr <ide> from rest_framework.exceptions import ErrorDetail, ValidationError <ide> from rest_framework.fields import get_error_detail, set_value <ide> from rest_framework.settings import api_settings <ide> class ModelSerializer(Serializer): <ide> } <ide> if ModelDurationField is not None: <ide> serializer_field_mapping[ModelDurationField] = DurationField <del> if ModelJSONField is not None: <del> serializer_field_mapping[ModelJSONField] = JSONField <ide> serializer_related_field = PrimaryKeyRelatedField <ide> serializer_related_to_field = SlugRelatedField <ide> serializer_url_field = HyperlinkedIdentityField <ide> def create(self, validated_data): <ide> # Save many-to-many relationships after the instance is created. <ide> if many_to_many: <ide> for field_name, value in many_to_many.items(): <del> set_many(instance, field_name, value) <add> field = getattr(instance, field_name) <add> field.set(value) <ide> <ide> return instance <ide> <ide> def update(self, instance, validated_data): <ide> # have an instance pk for the relationships to be associated with. <ide> for attr, value in validated_data.items(): <ide> if attr in info.relations and info.relations[attr].to_many: <del> set_many(instance, attr, value) <add> field = getattr(instance, attr) <add> field.set(value) <ide> else: <ide> setattr(instance, attr, value) <ide> instance.save() <ide> class CharMappingField(DictField): <ide> <ide> ModelSerializer.serializer_field_mapping[postgres_fields.HStoreField] = CharMappingField <ide> ModelSerializer.serializer_field_mapping[postgres_fields.ArrayField] = ListField <add> ModelSerializer.serializer_field_mapping[postgres_fields.JSONField] = JSONField <ide> <ide> <ide> class HyperlinkedModelSerializer(ModelSerializer): <ide><path>rest_framework/settings.py <ide> back to the defaults. <ide> """ <ide> from __future__ import unicode_literals <add> <ide> from importlib import import_module <ide> <ide> from django.conf import settings <ide><path>rest_framework/templatetags/rest_framework.py <ide> from django.utils.safestring import SafeData, mark_safe <ide> <ide> from rest_framework.compat import ( <del> NoReverseMatch, apply_markdown, pygments_highlight, reverse, <del> template_render <add> NoReverseMatch, apply_markdown, pygments_highlight, reverse <ide> ) <ide> from rest_framework.renderers import HTMLFormRenderer <ide> from rest_framework.utils.urls import replace_query_param <ide> def format_value(value): <ide> else: <ide> template = loader.get_template('rest_framework/admin/simple_list_value.html') <ide> context = {'value': value} <del> return template_render(template, context) <add> return template.render(context) <ide> elif isinstance(value, dict): <ide> template = loader.get_template('rest_framework/admin/dict_value.html') <ide> context = {'value': value} <del> return template_render(template, context) <add> return template.render(context) <ide> elif isinstance(value, six.string_types): <ide> if ( <ide> (value.startswith('http:') or value.startswith('https:')) and not <ide><path>rest_framework/throttling.py <ide> from django.core.cache import cache as default_cache <ide> from django.core.exceptions import ImproperlyConfigured <ide> <del>from rest_framework.compat import is_authenticated <ide> from rest_framework.settings import api_settings <ide> <ide> <ide> class AnonRateThrottle(SimpleRateThrottle): <ide> scope = 'anon' <ide> <ide> def get_cache_key(self, request, view): <del> if is_authenticated(request.user): <add> if request.user.is_authenticated: <ide> return None # Only throttle unauthenticated requests. <ide> <ide> return self.cache_format % { <ide> class UserRateThrottle(SimpleRateThrottle): <ide> scope = 'user' <ide> <ide> def get_cache_key(self, request, view): <del> if is_authenticated(request.user): <add> if request.user.is_authenticated: <ide> ident = request.user.pk <ide> else: <ide> ident = self.get_ident(request) <ide> def get_cache_key(self, request, view): <ide> Otherwise generate the unique cache key by concatenating the user id <ide> with the '.throttle_scope` property of the view. <ide> """ <del> if is_authenticated(request.user): <add> if request.user.is_authenticated: <ide> ident = request.user.pk <ide> else: <ide> ident = self.get_ident(request) <ide><path>rest_framework/urlpatterns.py <ide> from __future__ import unicode_literals <ide> <del>from django.conf.urls import url <add>from django.conf.urls import include, url <ide> <del>from rest_framework.compat import RegexURLResolver, include <add>from rest_framework.compat import RegexURLResolver <ide> from rest_framework.settings import api_settings <ide> <ide> <ide> def apply_suffix_patterns(urlpatterns, suffix_pattern, suffix_required): <ide> patterns = apply_suffix_patterns(urlpattern.url_patterns, <ide> suffix_pattern, <ide> suffix_required) <del> ret.append(url(regex, include(patterns, namespace, app_name), kwargs)) <del> <add> ret.append(url(regex, include((patterns, app_name), namespace), kwargs)) <ide> else: <ide> # Regular URL pattern <ide> regex = urlpattern.regex.pattern.rstrip('$').rstrip('/') + suffix_pattern <ide><path>rest_framework/utils/field_mapping.py <ide> from django.db import models <ide> from django.utils.text import capfirst <ide> <del>from rest_framework.compat import DecimalValidator, JSONField <add>from rest_framework.compat import postgres_fields <ide> from rest_framework.validators import UniqueValidator <ide> <ide> NUMERIC_FIELD_TYPES = ( <ide> def get_field_kwargs(field_name, model_field): <ide> if decimal_places is not None: <ide> kwargs['decimal_places'] = decimal_places <ide> <del> if isinstance(model_field, models.TextField) or (JSONField and isinstance(model_field, JSONField)): <add> if isinstance(model_field, models.TextField) or (postgres_fields and isinstance(model_field, postgres_fields.JSONField)): <ide> kwargs['style'] = {'base_template': 'textarea.html'} <ide> <ide> if isinstance(model_field, models.AutoField) or not model_field.editable: <ide> def get_field_kwargs(field_name, model_field): <ide> if validator is not validators.validate_ipv46_address <ide> ] <ide> # Our decimal validation is handled in the field code, not validator code. <del> # (In Django 1.9+ this differs from previous style) <del> if isinstance(model_field, models.DecimalField) and DecimalValidator: <add> if isinstance(model_field, models.DecimalField): <ide> validator_kwarg = [ <ide> validator for validator in validator_kwarg <del> if not isinstance(validator, DecimalValidator) <add> if not isinstance(validator, validators.DecimalValidator) <ide> ] <ide> <ide> # Ensure that max_length is passed explicitly as a keyword arg, <ide><path>rest_framework/utils/model_meta.py <ide> """ <ide> from collections import OrderedDict, namedtuple <ide> <del>from rest_framework.compat import get_related_model, get_remote_field <del> <ide> FieldInfo = namedtuple('FieldResult', [ <ide> 'pk', # Model field instance <ide> 'fields', # Dict of field name -> model field instance <ide> def get_field_info(model): <ide> <ide> def _get_pk(opts): <ide> pk = opts.pk <del> rel = get_remote_field(pk) <add> rel = pk.remote_field <ide> <ide> while rel and rel.parent_link: <ide> # If model is a child via multi-table inheritance, use parent's pk. <del> pk = get_related_model(pk)._meta.pk <del> rel = get_remote_field(pk) <add> pk = pk.remote_field.model._meta.pk <add> rel = pk.remote_field <ide> <ide> return pk <ide> <ide> <ide> def _get_fields(opts): <ide> fields = OrderedDict() <del> for field in [field for field in opts.fields if field.serialize and not get_remote_field(field)]: <add> for field in [field for field in opts.fields if field.serialize and not field.remote_field]: <ide> fields[field.name] = field <ide> <ide> return fields <ide> def _get_forward_relationships(opts): <ide> Returns an `OrderedDict` of field names to `RelationInfo`. <ide> """ <ide> forward_relations = OrderedDict() <del> for field in [field for field in opts.fields if field.serialize and get_remote_field(field)]: <add> for field in [field for field in opts.fields if field.serialize and field.remote_field]: <ide> forward_relations[field.name] = RelationInfo( <ide> model_field=field, <del> related_model=get_related_model(field), <add> related_model=field.remote_field.model, <ide> to_many=False, <ide> to_field=_get_to_field(field), <ide> has_through_model=False, <ide> def _get_forward_relationships(opts): <ide> for field in [field for field in opts.many_to_many if field.serialize]: <ide> forward_relations[field.name] = RelationInfo( <ide> model_field=field, <del> related_model=get_related_model(field), <add> related_model=field.remote_field.model, <ide> to_many=True, <ide> # manytomany do not have to_fields <ide> to_field=None, <ide> has_through_model=( <del> not get_remote_field(field).through._meta.auto_created <add> not field.remote_field.through._meta.auto_created <ide> ), <ide> reverse=False <ide> ) <ide> def _get_reverse_relationships(opts): <ide> reverse_relations[accessor_name] = RelationInfo( <ide> model_field=None, <ide> related_model=related, <del> to_many=get_remote_field(relation.field).multiple, <add> to_many=relation.field.remote_field.multiple, <ide> to_field=_get_to_field(relation.field), <ide> has_through_model=False, <ide> reverse=True <ide> def _get_reverse_relationships(opts): <ide> # manytomany do not have to_fields <ide> to_field=None, <ide> has_through_model=( <del> (getattr(get_remote_field(relation.field), 'through', None) is not None) and <del> not get_remote_field(relation.field).through._meta.auto_created <add> (getattr(relation.field.remote_field, 'through', None) is not None) and <add> not relation.field.remote_field.through._meta.auto_created <ide> ), <ide> reverse=True <ide> ) <ide><path>rest_framework/utils/representation.py <ide> from django.utils.encoding import force_text <ide> from django.utils.functional import Promise <ide> <del>from rest_framework.compat import get_names_and_managers, unicode_repr <add>from rest_framework.compat import unicode_repr <ide> <ide> <ide> def manager_repr(value): <ide> model = value.model <ide> opts = model._meta <del> for manager_name, manager_instance in get_names_and_managers(opts): <add> names_and_managers = [ <add> (manager.name, manager) <add> for manager <add> in opts.managers <add> ] <add> for manager_name, manager_instance in names_and_managers: <ide> if manager_instance == value: <ide> return '%s.%s.all()' % (model._meta.object_name, manager_name) <ide> return repr(value) <ide><path>tests/test_authentication.py <ide> HTTP_HEADER_ENCODING, exceptions, permissions, renderers, status <ide> ) <ide> from rest_framework.authentication import ( <del> BaseAuthentication, BasicAuthentication, RemoteUserAuthentication, SessionAuthentication, <del> TokenAuthentication) <add> BaseAuthentication, BasicAuthentication, RemoteUserAuthentication, <add> SessionAuthentication, TokenAuthentication <add>) <ide> from rest_framework.authtoken.models import Token <ide> from rest_framework.authtoken.views import obtain_auth_token <del>from rest_framework.compat import is_authenticated <ide> from rest_framework.response import Response <ide> from rest_framework.test import APIClient, APIRequestFactory <ide> from rest_framework.views import APIView <ide> class AuthAccessingRenderer(renderers.BaseRenderer): <ide> <ide> def render(self, data, media_type=None, renderer_context=None): <ide> request = renderer_context['request'] <del> if is_authenticated(request.user): <add> if request.user.is_authenticated: <ide> return b'authenticated' <ide> return b'not authenticated' <ide> <ide><path>tests/test_compat.py <ide> class MockTimedelta(object): <ide> expected = (timedelta.days * 86400.0) + float(timedelta.seconds) + (timedelta.microseconds / 1000000.0) <ide> assert compat.total_seconds(timedelta) == expected <ide> <del> def test_get_remote_field_with_old_django_version(self): <del> class MockField(object): <del> rel = 'example_rel' <del> compat.django.VERSION = (1, 8) <del> assert compat.get_remote_field(MockField(), default='default_value') == 'example_rel' <del> assert compat.get_remote_field(object(), default='default_value') == 'default_value' <del> <del> def test_get_remote_field_with_new_django_version(self): <del> class MockField(object): <del> remote_field = 'example_remote_field' <del> compat.django.VERSION = (1, 10) <del> assert compat.get_remote_field(MockField(), default='default_value') == 'example_remote_field' <del> assert compat.get_remote_field(object(), default='default_value') == 'default_value' <del> <ide> def test_set_rollback_for_transaction_in_managed_mode(self): <ide> class MockTransaction(object): <ide> called_rollback = False <ide><path>tests/test_htmlrenderer.py <ide> from django.conf.urls import url <ide> from django.core.exceptions import ImproperlyConfigured, PermissionDenied <ide> from django.http import Http404 <del>from django.template import Template, TemplateDoesNotExist <add>from django.template import TemplateDoesNotExist, engines <ide> from django.test import TestCase, override_settings <ide> from django.utils import six <ide> <ide> def _monkey_patch_get_template(self): <ide> <ide> def get_template(template_name, dirs=None): <ide> if template_name == 'example.html': <del> return Template("example: {{ object }}") <add> return engines['django'].from_string("example: {{ object }}") <ide> raise TemplateDoesNotExist(template_name) <ide> <ide> def select_template(template_name_list, dirs=None, using=None): <ide> if template_name_list == ['example.html']: <del> return Template("example: {{ object }}") <add> return engines['django'].from_string("example: {{ object }}") <ide> raise TemplateDoesNotExist(template_name_list[0]) <ide> <ide> django.template.loader.get_template = get_template <ide> def setUp(self): <ide> <ide> def get_template(template_name): <ide> if template_name == '404.html': <del> return Template("404: {{ detail }}") <add> return engines['django'].from_string("404: {{ detail }}") <ide> if template_name == '403.html': <del> return Template("403: {{ detail }}") <add> return engines['django'].from_string("403: {{ detail }}") <ide> raise TemplateDoesNotExist(template_name) <ide> <ide> django.template.loader.get_template = get_template <ide><path>tests/test_model_serializer.py <ide> from django.utils import six <ide> <ide> from rest_framework import serializers <del>from rest_framework.compat import set_many, unicode_repr <add>from rest_framework.compat import unicode_repr <ide> <ide> <ide> def dedent(blocktext): <ide> def setUp(self): <ide> foreign_key=self.foreign_key_target, <ide> one_to_one=self.one_to_one_target, <ide> ) <del> set_many(self.instance, 'many_to_many', self.many_to_many_targets) <del> self.instance.save() <add> self.instance.many_to_many.set(self.many_to_many_targets) <ide> <ide> def test_pk_retrival(self): <ide> class TestSerializer(serializers.ModelSerializer): <ide><path>tests/test_one_to_one_with_inheritance.py <ide> <ide> from rest_framework import serializers <ide> from tests.models import RESTFrameworkModel <del> <del> <ide> # Models <ide> from tests.test_multitable_inheritance import ChildModel <ide> <ide><path>tests/test_permissions.py <ide> HTTP_HEADER_ENCODING, authentication, generics, permissions, serializers, <ide> status, views <ide> ) <del>from rest_framework.compat import ResolverMatch, guardian, set_many <add>from rest_framework.compat import ResolverMatch, guardian <ide> from rest_framework.filters import DjangoObjectPermissionsFilter <ide> from rest_framework.routers import DefaultRouter <ide> from rest_framework.test import APIRequestFactory <ide> class ModelPermissionsIntegrationTests(TestCase): <ide> def setUp(self): <ide> User.objects.create_user('disallowed', 'disallowed@example.com', 'password') <ide> user = User.objects.create_user('permitted', 'permitted@example.com', 'password') <del> set_many(user, 'user_permissions', [ <add> user.user_permissions.set([ <ide> Permission.objects.get(codename='add_basicmodel'), <ide> Permission.objects.get(codename='change_basicmodel'), <ide> Permission.objects.get(codename='delete_basicmodel') <ide> ]) <add> <ide> user = User.objects.create_user('updateonly', 'updateonly@example.com', 'password') <del> set_many(user, 'user_permissions', [ <add> user.user_permissions.set([ <ide> Permission.objects.get(codename='change_basicmodel'), <ide> ]) <ide> <ide><path>tests/test_prefetch_related.py <ide> from django.test import TestCase <ide> <ide> from rest_framework import generics, serializers <del>from rest_framework.compat import set_many <ide> from rest_framework.test import APIRequestFactory <ide> <ide> factory = APIRequestFactory() <ide> class TestPrefetchRelatedUpdates(TestCase): <ide> def setUp(self): <ide> self.user = User.objects.create(username='tom', email='tom@example.com') <ide> self.groups = [Group.objects.create(name='a'), Group.objects.create(name='b')] <del> set_many(self.user, 'groups', self.groups) <del> self.user.save() <add> self.user.groups.set(self.groups) <ide> <ide> def test_prefetch_related_updates(self): <ide> view = UserUpdate.as_view() <ide><path>tests/test_relations_pk.py <ide> from rest_framework import serializers <ide> from tests.models import ( <ide> ForeignKeySource, ForeignKeyTarget, ManyToManySource, ManyToManyTarget, <del> NullableForeignKeySource, NullableOneToOneSource, NullableUUIDForeignKeySource, <del> OneToOnePKSource, OneToOneTarget, UUIDForeignKeyTarget <add> NullableForeignKeySource, NullableOneToOneSource, <add> NullableUUIDForeignKeySource, OneToOnePKSource, OneToOneTarget, <add> UUIDForeignKeyTarget <ide> ) <ide> <ide> <ide><path>tests/test_request.py <ide> <ide> from rest_framework import status <ide> from rest_framework.authentication import SessionAuthentication <del>from rest_framework.compat import is_anonymous <ide> from rest_framework.parsers import BaseParser, FormParser, MultiPartParser <ide> from rest_framework.request import Request <ide> from rest_framework.response import Response <ide> def test_user_can_login(self): <ide> <ide> def test_user_can_logout(self): <ide> self.request.user = self.user <del> self.assertFalse(is_anonymous(self.request.user)) <add> self.assertFalse(self.request.user.is_anonymous) <ide> logout(self.request) <del> self.assertTrue(is_anonymous(self.request.user)) <add> self.assertTrue(self.request.user.is_anonymous) <ide> <ide> def test_logged_in_user_is_set_on_wrapped_request(self): <ide> login(self.request, self.user) <ide><path>tests/test_requests_client.py <ide> from django.utils.decorators import method_decorator <ide> from django.views.decorators.csrf import csrf_protect, ensure_csrf_cookie <ide> <del>from rest_framework.compat import is_authenticated, requests <add>from rest_framework.compat import requests <ide> from rest_framework.response import Response <ide> from rest_framework.test import APITestCase, RequestsClient <ide> from rest_framework.views import APIView <ide> def post(self, request): <ide> class AuthView(APIView): <ide> @method_decorator(ensure_csrf_cookie) <ide> def get(self, request): <del> if is_authenticated(request.user): <add> if request.user.is_authenticated: <ide> username = request.user.username <ide> else: <ide> username = None <ide><path>tests/test_routers.py <ide> from collections import namedtuple <ide> <ide> import pytest <del>from django.conf.urls import url <add>from django.conf.urls import include, url <ide> from django.core.exceptions import ImproperlyConfigured <ide> from django.db import models <ide> from django.test import TestCase, override_settings <ide> <ide> from rest_framework import permissions, serializers, viewsets <del>from rest_framework.compat import include <ide> from rest_framework.decorators import detail_route, list_route <ide> from rest_framework.response import Response <ide> from rest_framework.routers import DefaultRouter, SimpleRouter <ide><path>tests/test_versioning.py <ide> import pytest <del>from django.conf.urls import url <add>from django.conf.urls import include, url <ide> from django.test import override_settings <ide> <ide> from rest_framework import serializers, status, versioning <del>from rest_framework.compat import include <ide> from rest_framework.decorators import APIView <ide> from rest_framework.relations import PKOnlyObject <ide> from rest_framework.response import Response <ide><path>tests/urls.py <ide> We need only the docs urls for DocumentationRenderer tests. <ide> """ <ide> from django.conf.urls import url <add> <ide> from rest_framework.documentation import include_docs_urls <ide> <ide> urlpatterns = [ <ide><path>tests/utils.py <ide> from django.core.exceptions import ObjectDoesNotExist <add> <ide> from rest_framework.compat import NoReverseMatch <ide> <ide>
29
Javascript
Javascript
fix typo in tree-sitter-language-mode-spec.js
a9724cb915f43d341ac013696164b3ef4b33e1e3
<ide><path>spec/tree-sitter-language-mode-spec.js <ide> describe('TreeSitterLanguageMode', () => { <ide> type: 'else', <ide> <ide> // There are double quotes around the `else` type. This indicates that <del> // we're targetting an *anonymous* node in the syntax tree. The fold <add> // we're targeting an *anonymous* node in the syntax tree. The fold <ide> // should start at the token representing the literal string "else", <ide> // not at an `else` node. <ide> start: { type: '"else"' }
1
Python
Python
remove outdated test
1575b8c33bb1c391cd574ccfbc2812bd5bae54ec
<ide><path>tests/integration_tests/test_image_data_tasks.py <ide> def test_image_data_generator_training(): <ide> optimizer='rmsprop', <ide> metrics=['accuracy']) <ide> history = model.fit_generator(img_gen.flow(x_train, y_train, batch_size=16), <del> epochs=10, <add> epochs=12, <ide> validation_data=img_gen.flow(x_test, y_test, <ide> batch_size=16), <ide> verbose=0) <ide><path>tests/integration_tests/test_temporal_data_tasks.py <ide> def test_stacked_lstm_char_prediction(): <ide> assert(generated == alphabet) <ide> <ide> <del>def test_masked_temporal(): <del> ''' <del> Confirm that even with masking on both inputs and outputs, cross-entropies are <del> of the expected scale. <del> <del> In this task, there are variable length inputs of integers from 1-9, and a random <del> subset of unmasked outputs. Each of these outputs has a 50% probability of being <del> the input number unchanged, and a 50% probability of being 2*input%10. <del> <del> The ground-truth best cross-entropy loss should, then be -log(0.5) = 0.69 <del> <del> ''' <del> np.random.seed(1337) <del> <del> model = Sequential() <del> model.add(layers.Embedding(10, 10, mask_zero=True)) <del> model.add(layers.Activation('softmax')) <del> model.compile(loss='categorical_crossentropy', <del> optimizer='adam') <del> <del> x = np.random.randint(1, 10, size=(20000, 10)) <del> for rowi in range(x.shape[0]): <del> padding = np.random.randint(0, x.shape[1] / 2 + 1) <del> x[rowi, :padding] = 0 <del> <del> # 50% of the time the correct output is the input. <del> # The other 50% of the time it's 2 * input % 10 <del> y = (x * np.random.randint(1, 3, size=x.shape)) % 10 <del> ys = np.zeros((y.size, 10), dtype='int32') <del> for i, target in enumerate(y.flat): <del> ys[i, target] = 1 <del> ys = ys.reshape(y.shape + (10,)) <del> <del> history = model.fit(x, ys, validation_split=0.05, batch_size=10, <del> verbose=0, epochs=3) <del> ground_truth = -np.log(0.5) <del> assert(np.abs(history.history['loss'][-1] - ground_truth) < 0.06) <del> <del> <ide> @pytest.mark.skipif(K.backend() != 'tensorflow', reason='Requires TF backend') <ide> def test_embedding_with_clipnorm(): <ide> model = Sequential()
2
Go
Go
fix racy test in pkg/plugins
4bc908ec8910468711960a4bcd4f3ec8dce909fb
<ide><path>pkg/plugins/client_test.go <ide> func teardownRemotePluginServer() { <ide> } <ide> } <ide> <del>func TestHttpTimeout(t *testing.T) { <add>func testHTTPTimeout(t *testing.T, timeout, epsilon time.Duration) { <ide> addr := setupRemotePluginServer() <ide> defer teardownRemotePluginServer() <del> stop := false // we need this variable to stop the http server <add> stop := make(chan struct{}) // we need this variable to stop the http server <ide> mux.HandleFunc("/hang", func(w http.ResponseWriter, r *http.Request) { <del> for { <del> if stop { <del> break <del> } <del> time.Sleep(5 * time.Second) <del> } <add> <-stop <ide> }) <ide> c, _ := NewClient(addr, &tlsconfig.Options{InsecureSkipVerify: true}) <add> c.http.Timeout = timeout <add> begin := time.Now() <ide> _, err := c.callWithRetry("hang", nil, false) <del> stop = true <add> close(stop) <ide> if err == nil || !strings.Contains(err.Error(), "request canceled") { <ide> t.Fatalf("The request should be canceled %v", err) <ide> } <add> elapsed := time.Now().Sub(begin) <add> if elapsed < timeout || elapsed > timeout+epsilon { <add> t.Fatalf("elapsed time: got %v, expected %v (epsilon=%v)", <add> elapsed, timeout, epsilon) <add> } <add>} <add> <add>func TestHTTPTimeout(t *testing.T) { <add> testHTTPTimeout(t, 5*time.Second, 1*time.Second) <ide> } <ide> <ide> func TestFailedConnection(t *testing.T) {
1
PHP
PHP
fix deprecation warning
6dcf7cd551dfc5692882e5364dbf89fcbd1841ac
<ide><path>src/Http/ServerRequest.php <ide> public function addPaths(array $paths) <ide> public function here($base = true) <ide> { <ide> deprecationWarning( <del> 'This method will be removed in 4.0.0. ' . <ide> 'This method will be removed in 4.0.0. You should use getRequestTarget() instead.' <ide> ); <ide>
1
Text
Text
reduce confusion in testing documentation.
0990c938063f0604373bb4bdd156d31ecf700599
<ide><path>docs/docs/10.4-test-utils.md <ide> prev: two-way-binding-helpers.html <ide> next: clone-with-props.html <ide> --- <ide> <del>`ReactTestUtils` makes it easy to test React components in the testing framework of your choice (we use [Jest](https://facebook.github.io/jest/)). <add>`ReactTestUtils` makes it easy to test React components in the testing framework of your choice. At Facebook we use [Jest](https://facebook.github.io/jest/) for painless JavaScript testing. Learn how to get started with Jest through the Jest website's [React Tutorial](http://facebook.github.io/jest/docs/tutorial-react.html#content). <ide> <ide> ``` <ide> var ReactTestUtils = require('react-addons-test-utils'); <ide> ``` <ide> <ide> > Note: <ide> > <del>> Airbnb has released a testing utility called Enzyme, which makes it easy to assert, manipulate, and traverse your React Components' output. If you're deciding on a unit testing library, it's worth checking out: [http://airbnb.io/enzyme/](http://airbnb.io/enzyme/) <add>> Airbnb has released a testing utility called Enzyme, which makes it easy to assert, manipulate, and traverse your React Components' output. If you're deciding on a unit testing utility to use together with Jest, or any other test runner, it's worth checking out: [http://airbnb.io/enzyme/](http://airbnb.io/enzyme/) <ide> <ide> ### Simulate <ide>
1
Python
Python
improve optimizer configuration
5f7e78df65a865084a34fc54a6cb4f78c1592137
<ide><path>keras/optimizers.py <ide> class Optimizer(object): <ide> when their absolute value exceeds this value. <ide> ''' <ide> def __init__(self, **kwargs): <add> allowed_kwargs = {'clipnorm', 'clipvalue'} <add> for k in kwargs: <add> if k not in allowed_kwargs: <add> raise Exception('Unexpected keyword argument ' <add> 'passed to optimizer: ' + str(k)) <ide> self.__dict__.update(kwargs) <ide> self.updates = [] <ide> self.weights = [] <ide> def get_weights(self): <ide> return weights <ide> <ide> def get_config(self): <del> return {"name": self.__class__.__name__} <add> config = {'name': self.__class__.__name__} <add> if hasattr(self, 'clipnorm'): <add> config['clipnorm'] = self.clipnorm <add> if hasattr(self, 'clipvalue'): <add> config['clipvalue'] = self.clipvalue <add> return config <ide> <ide> <ide> class SGD(Optimizer): <ide> class SGD(Optimizer): <ide> decay: float >= 0. Learning rate decay over each update. <ide> nesterov: boolean. Whether to apply Nesterov momentum. <ide> ''' <del> def __init__(self, lr=0.01, momentum=0., decay=0., nesterov=False, <del> *args, **kwargs): <add> def __init__(self, lr=0.01, momentum=0., decay=0., <add> nesterov=False, **kwargs): <ide> super(SGD, self).__init__(**kwargs) <ide> self.__dict__.update(locals()) <ide> self.iterations = K.variable(0.) <ide> def get_updates(self, params, constraints, loss): <ide> return self.updates <ide> <ide> def get_config(self): <del> return {"name": self.__class__.__name__, <del> "lr": float(K.get_value(self.lr)), <del> "momentum": float(K.get_value(self.momentum)), <del> "decay": float(K.get_value(self.decay)), <del> "nesterov": self.nesterov} <add> config = {'lr': float(K.get_value(self.lr)), <add> 'momentum': float(K.get_value(self.momentum)), <add> 'decay': float(K.get_value(self.decay)), <add> 'nesterov': self.nesterov} <add> base_config = super(SGD, self).get_config() <add> return dict(list(base_config.items()) + list(config.items())) <ide> <ide> <ide> class RMSprop(Optimizer): <ide> class RMSprop(Optimizer): <ide> rho: float >= 0. <ide> epsilon: float >= 0. Fuzz factor. <ide> ''' <del> def __init__(self, lr=0.001, rho=0.9, epsilon=1e-6, *args, **kwargs): <add> def __init__(self, lr=0.001, rho=0.9, epsilon=1e-6, **kwargs): <ide> super(RMSprop, self).__init__(**kwargs) <ide> self.__dict__.update(locals()) <ide> self.lr = K.variable(lr) <ide> def get_updates(self, params, constraints, loss): <ide> return self.updates <ide> <ide> def get_config(self): <del> return {"name": self.__class__.__name__, <del> "lr": float(K.get_value(self.lr)), <del> "rho": float(K.get_value(self.rho)), <del> "epsilon": self.epsilon} <add> config = {'lr': float(K.get_value(self.lr)), <add> 'rho': float(K.get_value(self.rho)), <add> 'epsilon': self.epsilon} <add> base_config = super(RMSprop, self).get_config() <add> return dict(list(base_config.items()) + list(config.items())) <ide> <ide> <ide> class Adagrad(Optimizer): <ide> class Adagrad(Optimizer): <ide> lr: float >= 0. Learning rate. <ide> epsilon: float >= 0. <ide> ''' <del> def __init__(self, lr=0.01, epsilon=1e-6, *args, **kwargs): <add> def __init__(self, lr=0.01, epsilon=1e-6, **kwargs): <ide> super(Adagrad, self).__init__(**kwargs) <ide> self.__dict__.update(locals()) <ide> self.lr = K.variable(lr) <ide> def get_updates(self, params, constraints, loss): <ide> return self.updates <ide> <ide> def get_config(self): <del> return {"name": self.__class__.__name__, <del> "lr": float(K.get_value(self.lr)), <del> "epsilon": self.epsilon} <add> config = {'lr': float(K.get_value(self.lr)), <add> 'epsilon': self.epsilon} <add> base_config = super(Adagrad, self).get_config() <add> return dict(list(base_config.items()) + list(config.items())) <ide> <ide> <ide> class Adadelta(Optimizer): <ide> class Adadelta(Optimizer): <ide> # References <ide> - [Adadelta - an adaptive learning rate method](http://arxiv.org/abs/1212.5701) <ide> ''' <del> def __init__(self, lr=1.0, rho=0.95, epsilon=1e-6, *args, **kwargs): <add> def __init__(self, lr=1.0, rho=0.95, epsilon=1e-6, **kwargs): <ide> super(Adadelta, self).__init__(**kwargs) <ide> self.__dict__.update(locals()) <ide> self.lr = K.variable(lr) <ide> def get_updates(self, params, constraints, loss): <ide> return self.updates <ide> <ide> def get_config(self): <del> return {"name": self.__class__.__name__, <del> "lr": float(K.get_value(self.lr)), <del> "rho": self.rho, <del> "epsilon": self.epsilon} <add> config = {'lr': float(K.get_value(self.lr)), <add> 'rho': self.rho, <add> 'epsilon': self.epsilon} <add> base_config = super(Adadelta, self).get_config() <add> return dict(list(base_config.items()) + list(config.items())) <ide> <ide> <ide> class Adam(Optimizer): <ide> class Adam(Optimizer): <ide> # References <ide> - [Adam - A Method for Stochastic Optimization](http://arxiv.org/abs/1412.6980v8) <ide> ''' <del> def __init__(self, lr=0.001, beta_1=0.9, beta_2=0.999, epsilon=1e-8, <del> *args, **kwargs): <add> def __init__(self, lr=0.001, beta_1=0.9, beta_2=0.999, <add> epsilon=1e-8, **kwargs): <ide> super(Adam, self).__init__(**kwargs) <ide> self.__dict__.update(locals()) <ide> self.iterations = K.variable(0) <ide> def get_updates(self, params, constraints, loss): <ide> return self.updates <ide> <ide> def get_config(self): <del> return {"name": self.__class__.__name__, <del> "lr": float(K.get_value(self.lr)), <del> "beta_1": float(K.get_value(self.beta_1)), <del> "beta_2": float(K.get_value(self.beta_2)), <del> "epsilon": self.epsilon} <add> config = {'lr': float(K.get_value(self.lr)), <add> 'beta_1': float(K.get_value(self.beta_1)), <add> 'beta_2': float(K.get_value(self.beta_2)), <add> 'epsilon': self.epsilon} <add> base_config = super(Adam, self).get_config() <add> return dict(list(base_config.items()) + list(config.items())) <ide> <ide> <ide> class Adamax(Optimizer): <ide> class Adamax(Optimizer): <ide> # References <ide> - [Adam - A Method for Stochastic Optimization](http://arxiv.org/abs/1412.6980v8) <ide> ''' <del> def __init__(self, lr=0.002, beta_1=0.9, beta_2=0.999, epsilon=1e-8, <del> *args, **kwargs): <add> def __init__(self, lr=0.002, beta_1=0.9, beta_2=0.999, <add> epsilon=1e-8, **kwargs): <ide> super(Adamax, self).__init__(**kwargs) <ide> self.__dict__.update(locals()) <ide> self.iterations = K.variable(0.) <ide> def get_updates(self, params, constraints, loss): <ide> return self.updates <ide> <ide> def get_config(self): <del> return {"name": self.__class__.__name__, <del> "lr": float(K.get_value(self.lr)), <del> "beta_1": float(K.get_value(self.beta_1)), <del> "beta_2": float(K.get_value(self.beta_2)), <del> "epsilon": self.epsilon} <add> config = {'lr': float(K.get_value(self.lr)), <add> 'beta_1': float(K.get_value(self.beta_1)), <add> 'beta_2': float(K.get_value(self.beta_2)), <add> 'epsilon': self.epsilon} <add> base_config = super(Adamax, self).get_config() <add> return dict(list(base_config.items()) + list(config.items())) <ide> <ide> <ide> # aliases
1
Javascript
Javascript
avoid lastprops[key] lookup in initial render
22a240fd39b893982cc397ea8b8bcb78eb31158f
<ide><path>src/renderers/dom/shared/ReactDOMComponent.js <ide> ReactDOMComponent.Mixin = { <ide> DOMPropertyOperations.setAttributeForID(el, this._rootNodeID); <ide> // Populate node cache <ide> ReactMount.getID(el); <del> this._updateDOMProperties({}, props, transaction); <add> this._updateDOMProperties(null, props, transaction); <ide> var lazyTree = DOMLazyTree(el); <ide> this._createInitialChildren(transaction, props, context, lazyTree); <ide> mountImage = lazyTree; <ide> ReactDOMComponent.Mixin = { <ide> } <ide> for (propKey in nextProps) { <ide> var nextProp = nextProps[propKey]; <del> var lastProp = propKey === STYLE ? <del> this._previousStyleCopy : <del> lastProps[propKey]; <add> var lastProp = <add> propKey === STYLE ? this._previousStyleCopy : <add> lastProps != null ? lastProps[propKey] : undefined; <ide> if (!nextProps.hasOwnProperty(propKey) || <ide> nextProp === lastProp || <ide> nextProp == null && lastProp == null) {
1
Python
Python
update mnist_tpu.py with recommended tf.data apis
aead3912c8d1c228a6240057d4c1072f96fab2a9
<ide><path>official/mnist/mnist_tpu.py <ide> def train_input_fn(params): <ide> # computed according to the input pipeline deployment. See <ide> # `tf.contrib.tpu.RunConfig` for details. <ide> ds = dataset.train(data_dir).cache().repeat().shuffle( <del> buffer_size=50000).apply( <del> tf.contrib.data.batch_and_drop_remainder(batch_size)) <del> images, labels = ds.make_one_shot_iterator().get_next() <del> return images, labels <add> buffer_size=50000).batch(batch_size, drop_remainder=True) <add> return ds <ide> <ide> <ide> def eval_input_fn(params): <ide> batch_size = params["batch_size"] <ide> data_dir = params["data_dir"] <del> ds = dataset.test(data_dir).apply( <del> tf.contrib.data.batch_and_drop_remainder(batch_size)) <del> images, labels = ds.make_one_shot_iterator().get_next() <del> return images, labels <add> ds = dataset.test(data_dir).batch(batch_size, drop_remainder=True) <add> return ds <ide> <ide> <ide> def predict_input_fn(params):
1
Ruby
Ruby
follow the coding conventions
b1879124a82b34168412ac699cf6f654e005c4d6
<ide><path>activerecord/lib/active_record/scoping/named.rb <ide> def scope_attributes? # :nodoc: <ide> # Article.published.featured.latest_article <ide> # Article.featured.titles <ide> def scope(name, body, &block) <del> unless body.respond_to?:call <add> unless body.respond_to?(:call) <ide> raise ArgumentError, 'The scope body needs to be callable.' <ide> end <ide>
1
Javascript
Javascript
remove route#redirect soft deprecation
3890d3c4de3f5a8e97887b74377ff3f1b0fb3645
<ide><path>packages/ember-routing/lib/system/route.js <ide> Ember.Route = Ember.Object.extend(Ember.ActionHandler, { <ide> Transition into another route. Optionally supply model(s) for the <ide> route in question. If multiple models are supplied they will be applied <ide> last to first recursively up the resource tree (see Multiple Models Example <del> below). The model(s) will be serialized into the URL using the appropriate <add> below). The model(s) will be serialized into the URL using the appropriate <ide> route's `serialize` hook. See also 'replaceWith'. <ide> <ide> Simple Transition Example <ide> Ember.Route = Ember.Object.extend(Ember.ActionHandler, { <ide> <ide> /** <ide> Transition into another route while replacing the current URL, if possible. <del> This will replace the current history entry instead of adding a new one. <add> This will replace the current history entry instead of adding a new one. <ide> Beside that, it is identical to `transitionTo` in all other respects. See <ide> 'transitionTo' for additional information regarding multiple models. <ide> <ide> Ember.Route = Ember.Object.extend(Ember.ActionHandler, { <ide> }, <ide> <ide> /** <del> @deprecated <del> <ide> A hook you can implement to optionally redirect to another route. <ide> <ide> If you call `this.transitionTo` from inside of this hook, this route <ide> will not be entered in favor of the other hook. <ide> <del> This hook is deprecated in favor of using the `afterModel` hook <del> for performing redirects after the model has resolved. <add> Note that this hook is called by the default implementation of <add> `afterModel`, so if you override `afterModel`, you must either <add> explicitly call `redirect` or just put your redirecting <add> `this.transitionTo()` call within `afterModel`. <ide> <ide> @method redirect <ide> @param {Object} model the model for this route
1
Javascript
Javascript
improve mode validation
1cdeb9f956a9f54dde7c6b1a792b97584acbfb8e
<ide><path>lib/internal/validators.js <ide> function validateMode(value, name, def) { <ide> } <ide> <ide> if (typeof value === 'number') { <del> if (!Number.isInteger(value)) { <del> throw new ERR_OUT_OF_RANGE(name, 'an integer', value); <del> } else { <del> // 2 ** 32 === 4294967296 <del> throw new ERR_OUT_OF_RANGE(name, '>= 0 && < 4294967296', value); <del> } <add> validateInt32(value, name, 0, 2 ** 32 - 1); <ide> } <ide> <ide> if (typeof value === 'string') { <ide> if (!octalReg.test(value)) { <ide> throw new ERR_INVALID_ARG_VALUE(name, value, modeDesc); <ide> } <del> const parsed = parseInt(value, 8); <del> return parsed; <add> return parseInt(value, 8); <ide> } <ide> <del> // TODO(BridgeAR): Only return `def` in case `value == null` <del> if (def !== undefined) { <add> if (def !== undefined && value == null) { <ide> return def; <ide> } <ide> <ide><path>test/parallel/test-fs-fchmod.js <ide> const fs = require('fs'); <ide> const errObj = { <ide> code: 'ERR_OUT_OF_RANGE', <ide> name: 'RangeError [ERR_OUT_OF_RANGE]', <del> message: 'The value of "mode" is out of range. It must be >= 0 && < ' + <del> `4294967296. Received ${input}` <add> message: 'The value of "mode" is out of range. It must be >= 0 && <= ' + <add> `4294967295. Received ${input}` <ide> }; <ide> <ide> assert.throws(() => fs.fchmod(1, input), errObj); <ide><path>test/parallel/test-fs-lchmod.js <ide> assert.throws(() => fs.lchmod(f, {}), { code: 'ERR_INVALID_CALLBACK' }); <ide> `octal string. Received ${util.inspect(input)}` <ide> }; <ide> <del> promises.lchmod(f, input, () => {}) <del> .then(common.mustNotCall()) <del> .catch(common.expectsError(errObj)); <add> assert.rejects(promises.lchmod(f, input, () => {}), errObj); <ide> assert.throws(() => fs.lchmodSync(f, input), errObj); <ide> }); <ide> <ide> [-1, 2 ** 32].forEach((input) => { <ide> const errObj = { <ide> code: 'ERR_OUT_OF_RANGE', <ide> name: 'RangeError [ERR_OUT_OF_RANGE]', <del> message: 'The value of "mode" is out of range. It must be >= 0 && < ' + <del> `4294967296. Received ${input}` <add> message: 'The value of "mode" is out of range. It must be >= 0 && <= ' + <add> `4294967295. Received ${input}` <ide> }; <ide> <del> promises.lchmod(f, input, () => {}) <del> .then(common.mustNotCall()) <del> .catch(common.expectsError(errObj)); <add> assert.rejects(promises.lchmod(f, input, () => {}), errObj); <ide> assert.throws(() => fs.lchmodSync(f, input), errObj); <ide> }); <ide><path>test/parallel/test-fs-open.js <ide> for (const extra of [[], ['r'], ['r', 0], ['r', 0, 'bad callback']]) { <ide> type: TypeError <ide> } <ide> ); <del> fs.promises.open(i, 'r') <del> .then(common.mustNotCall()) <del> .catch(common.mustCall((err) => { <del> common.expectsError( <del> () => { throw err; }, <del> { <del> code: 'ERR_INVALID_ARG_TYPE', <del> type: TypeError <del> } <del> ); <del> })); <add> assert.rejects( <add> fs.promises.open(i, 'r'), <add> { <add> code: 'ERR_INVALID_ARG_TYPE', <add> name: 'TypeError [ERR_INVALID_ARG_TYPE]' <add> } <add> ); <add>}); <add> <add>// Check invalid modes. <add>[false, [], {}].forEach((mode) => { <add> assert.throws( <add> () => fs.open(__filename, 'r', mode, common.mustNotCall()), <add> { <add> message: /'mode' must be a 32-bit/, <add> code: 'ERR_INVALID_ARG_VALUE' <add> } <add> ); <add> assert.throws( <add> () => fs.openSync(__filename, 'r', mode, common.mustNotCall()), <add> { <add> message: /'mode' must be a 32-bit/, <add> code: 'ERR_INVALID_ARG_VALUE' <add> } <add> ); <add> assert.rejects( <add> fs.promises.open(__filename, 'r', mode), <add> { <add> message: /'mode' must be a 32-bit/, <add> code: 'ERR_INVALID_ARG_VALUE' <add> } <add> ); <ide> });
4
Python
Python
fix suppported versions in setup.py
f4fcf56b63a145d8e26d0275898e915e7e54b794
<ide><path>setup.py <ide> PY2 = sys.version_info[0] == 2 <ide> PY3 = sys.version_info[0] == 3 <ide> PY3_pre_34 = PY3 and sys.version_info < (3, 4) <del>PY2_pre_26 = PY2 and sys.version_info < (2, 6) <ide> PY2_pre_27 = PY2 and sys.version_info < (2, 7) <ide> PY2_pre_279 = PY2 and sys.version_info < (2, 7, 9) <ide> <ide> 'libcloud.container.drivers.dummy', <ide> 'libcloud.backup.drivers.dummy'] <ide> <del>SUPPORTED_VERSIONS = ['2.6', '2.7', 'PyPy', '3.x'] <add>SUPPORTED_VERSIONS = ['2.7', 'PyPy', '3.3+'] <ide> <ide> TEST_REQUIREMENTS = [ <ide> 'mock', <ide> def run(self): <ide> author='Apache Software Foundation', <ide> author_email='dev@libcloud.apache.org', <ide> install_requires=install_requires, <add> python_requires=">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, <4", <ide> packages=get_packages('libcloud'), <ide> package_dir={ <ide> 'libcloud': 'libcloud', <ide> def run(self): <ide> 'Operating System :: OS Independent', <ide> 'Programming Language :: Python', <ide> 'Topic :: Software Development :: Libraries :: Python Modules', <del> 'Programming Language :: Python :: 2.6', <ide> 'Programming Language :: Python :: 2.7', <ide> 'Programming Language :: Python :: 3', <del> 'Programming Language :: Python :: 3.3', <ide> 'Programming Language :: Python :: 3.4', <ide> 'Programming Language :: Python :: 3.5', <ide> 'Programming Language :: Python :: 3.6',
1
Javascript
Javascript
fix more indentation
8a7b34d332be351320bf7b63cae62ed7635f8da8
<ide><path>examples/js/loaders/FBXLoader.js <ide> <ide> } <ide> <del>// create the main THREE.Group() to be returned by the loader <add> // create the main THREE.Group() to be returned by the loader <ide> function parseScene( FBXTree, connections, deformers, geometryMap, materialMap ) { <ide> <ide> var sceneGraph = new THREE.Group(); <ide> <ide> } <ide> <del> // parse nodes in FBXTree.Objects.subNodes.Model <add> // parse nodes in FBXTree.Objects.subNodes.Model <ide> function parseModels( FBXTree, deformers, geometryMap, materialMap, connections ) { <ide> <ide> var modelMap = new Map(); <ide> model = new THREE.Bone(); <ide> deformer.bones[ subDeformer.index ] = model; <ide> <del> // seems like we need this not to make non-connected bone, maybe? <del> // TODO: confirm <add> // seems like we need this not to make non-connected bone, maybe? <add> // TODO: confirm <ide> if ( model2 !== null ) model.add( model2 ); <ide> <ide> } <ide> <ide> } <ide> <del> // create a THREE.PerspectiveCamera or THREE.OrthographicCamera <add> // create a THREE.PerspectiveCamera or THREE.OrthographicCamera <ide> function createCamera( FBXTree, conns ) { <ide> <ide> var model; <ide> <ide> } <ide> <del> // Create a THREE.DirectionalLight, THREE.PointLight or THREE.SpotLight <add> // Create a THREE.DirectionalLight, THREE.PointLight or THREE.SpotLight <ide> function createLight( FBXTree, conns ) { <ide> <ide> var model; <ide> <ide> var type; <ide> <del> // LightType can be undefined for Point lights <add> // LightType can be undefined for Point lights <ide> if ( lightAttribute.LightType === undefined ) { <ide> <ide> type = 0; <ide> <ide> var intensity = ( lightAttribute.Intensity === undefined ) ? 1 : lightAttribute.Intensity.value / 100; <ide> <del> // light disabled <add> // light disabled <ide> if ( lightAttribute.CastLightOnObject !== undefined && lightAttribute.CastLightOnObject.value === 0 ) { <ide> <ide> intensity = 0; <ide> <ide> } <ide> <del> // TODO: could this be calculated linearly from FarAttenuationStart to FarAttenuationEnd? <add> // TODO: could this be calculated linearly from FarAttenuationStart to FarAttenuationEnd? <ide> var decay = 1; <ide> <ide> switch ( type ) { <ide> var penumbra = 0; <ide> if ( lightAttribute.OuterAngle !== undefined ) { <ide> <del> // TODO: this is not correct - FBX calculates outer and inner angle in degrees <del> // with OuterAngle > InnerAngle && OuterAngle <= Math.PI <del> // while three.js uses a penumbra between (0, 1) to attenuate the inner angle <add> // TODO: this is not correct - FBX calculates outer and inner angle in degrees <add> // with OuterAngle > InnerAngle && OuterAngle <= Math.PI <add> // while three.js uses a penumbra between (0, 1) to attenuate the inner angle <ide> penumbra = THREE.Math.degToRad( lightAttribute.OuterAngle.value ); <ide> penumbra = Math.max( penumbra, 1 ); <ide> <ide> // to attach animations to, since FBX treats animations as animations for the entire scene, <ide> // not just for individual objects. <ide> sceneGraph.skeleton = { <add> <ide> bones: Array.from( modelMap.values() ), <add> <ide> }; <ide> <ide> }
1
Javascript
Javascript
add button to add cert to linkedin profile
422bacd15dc73d1e3367b5b9b7074763fefe25f8
<ide><path>client/src/client-only-routes/ShowCertification.js <ide> import standardErrorMessage from '../utils/standardErrorMessage'; <ide> import reallyWeirdErrorMessage from '../utils/reallyWeirdErrorMessage'; <ide> <ide> import RedirectHome from '../components/RedirectHome'; <del>import { Loader } from '../components/helpers'; <add>import { Loader, Spacer } from '../components/helpers'; <ide> <ide> const propTypes = { <ide> cert: PropTypes.shape({ <ide> const propTypes = { <ide> errored: PropTypes.bool <ide> }), <ide> isDonating: PropTypes.bool, <add> location: PropTypes.shape({ <add> pathname: PropTypes.string <add> }), <ide> showCert: PropTypes.func.isRequired, <ide> signedInUserName: PropTypes.string, <ide> userFetchState: PropTypes.shape({ <ide> class ShowCertification extends Component { <ide> fetchState, <ide> validCertName, <ide> createFlashMessage, <del> certName <add> signedInUserName, <add> location: { pathname } <ide> } = this.props; <ide> <ide> const { <ide> class ShowCertification extends Component { <ide> completionTime <ide> } = cert; <ide> <add> const certDate = new Date(issueDate); <add> const certYear = certDate.getFullYear(); <add> const certMonth = certDate.getMonth(); <add> const certURL = `https://freecodecamp.org${pathname}`; <add> <ide> const donationCloseBtn = ( <ide> <div> <ide> <Button <ide> class ShowCertification extends Component { <ide> </Grid> <ide> ); <ide> <add> const shareCertBtns = ( <add> <Row className='text-center'> <add> <Spacer size={2} /> <add> <Button <add> block={true} <add> bsSize='lg' <add> bsStyle='primary' <add> target='_blank' <add> href={`https://www.linkedin.com/profile/add?startTask=CERTIFICATION_NAME&name=${certTitle}&organizationId=4831032&issueYear=${certYear}&issueMonth=${certMonth}&certUrl=${certURL}`} <add> > <add> Add this certification to my LinkedIn profile <add> </Button> <add> <Spacer /> <add> <Button <add> block={true} <add> bsSize='lg' <add> bsStyle='primary' <add> target='_blank' <add> href={`https://twitter.com/intent/tweet?text=I just earned the ${certTitle} certification @freeCodeCamp! Check it out here: ${certURL}`} <add> > <add> Share this certification on Twitter <add> </Button> <add> </Row> <add> ); <add> <ide> return ( <ide> <div className='certificate-outer-wrapper'> <ide> {isDonationDisplayed && !isDonationClosed ? donationSection : ''} <ide> class ShowCertification extends Component { <ide> <Col md={7} sm={12}> <ide> <div className='issue-date'> <ide> Issued&nbsp; <del> <strong>{format(new Date(issueDate), 'MMMM D, YYYY')}</strong> <add> <strong>{format(certDate, 'MMMM D, YYYY')}</strong> <ide> </div> <ide> </Col> <ide> </header> <ide> class ShowCertification extends Component { <ide> <p>Executive Director, freeCodeCamp.org</p> <ide> </div> <ide> <Row> <del> <p className='verify'> <del> Verify this certification at: <del> https://www.freecodecamp.org/certification/ <del> {username}/{certName} <del> </p> <add> <p className='verify'>Verify this certification at {certURL}</p> <ide> </Row> <ide> </footer> <ide> </Row> <ide> </Grid> <add> {signedInUserName === username ? shareCertBtns : ''} <ide> </div> <ide> ); <ide> } <ide><path>client/src/components/layouts/Certification.js <ide> import { connect } from 'react-redux'; <ide> <ide> import { fetchUser, isSignedInSelector, executeGA } from '../../redux'; <ide> import { createSelector } from 'reselect'; <add>import Helmet from 'react-helmet'; <ide> <ide> const mapStateToProps = createSelector( <ide> isSignedInSelector, <ide> class CertificationLayout extends Component { <ide> } <ide> this.props.executeGA({ type: 'page', data: pathname }); <ide> } <add> <ide> render() { <del> return <Fragment>{this.props.children}</Fragment>; <add> const { children } = this.props; <add> <add> return ( <add> <Fragment> <add> <Helmet bodyAttributes={{ class: 'light-palette' }}></Helmet> <add> {children} <add> </Fragment> <add> ); <ide> } <ide> } <ide> <ide><path>cypress/integration/ShowCertification.js <add>/* global cy */ <add> <add>describe('A certification,', function() { <add> describe('while viewing your own,', function() { <add> before(() => { <add> cy.visit('/'); <add> cy.contains("Get started (it's free)").click({ force: true }); <add> cy.contains('Update my account settings').click({ force: true }); <add> <add> // set user settings to public to claim a cert <add> cy.get('label:contains(Public)>input').each(el => { <add> if (!/toggle-active/.test(el[0].parentElement.className)) { <add> cy.wrap(el).click({ force: true }); <add> cy.wait(1000); <add> } <add> }); <add> <add> // if honest policy not accepted <add> cy.get('.honesty-policy button').then(btn => { <add> if (btn[0].innerText === 'Agree') { <add> btn[0].click({ force: true }); <add> cy.wait(1000); <add> } <add> }); <add> <add> // fill in legacy front end form <add> cy.get('#dynamic-legacy-front-end input').each(el => { <add> cy.wrap(el) <add> .clear({ force: true }) <add> .type('https://nhl.com', { force: true, delay: 0 }); <add> }); <add> <add> // if "Save Progress" button exists <add> cy.get('#dynamic-legacy-front-end').then(form => { <add> if (form[0][10] && form[0][10].innerHTML === 'Save Progress') { <add> form[0][10].click({ force: true }); <add> cy.wait(1000); <add> } <add> }); <add> <add> // if "Claim Certification" button exists <add> cy.get('#dynamic-legacy-front-end').then(form => { <add> if (form[0][10] && form[0][10].innerHTML === 'Claim Certification') { <add> form[0][10].click({ force: true }); <add> cy.wait(1000); <add> } <add> }); <add> <add> cy.get('#button-legacy-front-end') <add> .contains('Show Certification') <add> .click({ force: true }); <add> }); <add> <add> it('should render a LinkedIn button', function() { <add> cy.contains('Add this certification to my LinkedIn profile').should( <add> 'have.attr', <add> 'href', <add> 'https://www.linkedin.com/profile/add?startTask=CERTIFICATION_NAME&name=Legacy Front End&organizationId=4831032&issueYear=2020&issueMonth=8&certUrl=https://freecodecamp.org/certification/developmentuser/legacy-front-end' <add> ); <add> }); <add> <add> it('should render a Twitter button', function() { <add> cy.contains('Share this certification on Twitter').should( <add> 'have.attr', <add> 'href', <add> 'https://twitter.com/intent/tweet?text=I just earned the Legacy Front End certification @freeCodeCamp! Check it out here: https://freecodecamp.org/certification/developmentuser/legacy-front-end' <add> ); <add> }); <add> }); <add> <add> describe("while viewing someone else's,", function() { <add> before(() => { <add> cy.go('back'); <add> cy.contains('Sign me out of freeCodeCamp').click({ force: true }); <add> cy.visit('/certification/developmentuser/legacy-front-end'); <add> }); <add> <add> it('should not render a LinkedIn button', function() { <add> cy.contains('Add this certification to my LinkedIn profile').should( <add> 'not.exist' <add> ); <add> }); <add> <add> it('should not render a Twitter button', function() { <add> cy.contains('Share this certification on Twitter').should('not.exist'); <add> }); <add> }); <add>});
3
Python
Python
reformat the code
a62ea3d21ea169066fa9dff774020800946d6f37
<ide><path>docs/conf.py <ide> # All configuration values have a default; values that are commented out <ide> # serve to show the default. <ide> <add>from glances import __version__ <ide> import sys <ide> import os <ide> from datetime import datetime <ide> # Insert Glances' path into the system. <ide> sys.path.insert(0, os.path.abspath('..')) <ide> <del>from glances import __version__ <ide> <ide> # -- General configuration ------------------------------------------------ <ide> <ide><path>glances/outputs/glances_bottle.py <ide> def check_auth(self, username, password): <ide> if username == self.args.username: <ide> from glances.password import GlancesPassword <ide> <del> pwd = GlancesPassword(username=username, <del> config=self.config) <add> pwd = GlancesPassword(username=username, config=self.config) <ide> return pwd.check_password(self.args.password, pwd.sha256_hash(password)) <ide> else: <ide> return False <ide><path>glances/password.py <ide> def local_password_path(self): <ide> if self.config is None: <ide> return user_config_dir() <ide> else: <del> return self.config.get_value('passwords', <del> 'local_password_path', <del> default=user_config_dir()) <add> return self.config.get_value('passwords', 'local_password_path', default=user_config_dir()) <ide> <ide> def sha256_hash(self, plain_password): <ide> """Return the SHA-256 of the given password.""" <ide><path>glances/plugins/glances_help.py <ide> """ <ide> import sys <ide> from glances.compat import iteritems <del>from collections import OrderedDict <ide> from glances import __version__, psutil_version <ide> from glances.plugins.glances_plugin import GlancesPlugin <ide> from itertools import chain <ide> def generate_view_data(self): <ide> <ide> self.view_data.update( <ide> [ <del> ## First column <add> # First column <ide> # <ide> ('header_sort', msg_header.format('SORT PROCESSES:')), <ide> ('sort_auto', msg_col.format('a', 'Automatically')), <ide> def generate_view_data(self): <ide> ('show_hide_wifi_module', msg_col.format('W', 'Wifi')), <ide> ('show_hide_processes', msg_col.format('z', 'Processes')), <ide> ('show_hide_left_sidebar', msg_col.format('2', 'Left sidebar')), <del> ## Second column <add> # Second column <ide> # <ide> ('show_hide_quick_look', msg_col.format('3', 'Quick Look')), <ide> ('show_hide_cpu_mem_swap', msg_col.format('4', 'CPU, MEM, and SWAP')), <ide> def msg_curse(self, args=None, max_width=None): <ide> <ide> ret.append(self.curse_new_line()) <ide> <del> ## key-shortcuts <add> # key-shortcuts <ide> # <ide> # Collect all values after the 1st key-msg <ide> # in a list of curse-lines. <ide><path>glances/server.py <ide> def check_user(self, username, password): <ide> if username in self.server.user_dict: <ide> from glances.password import GlancesPassword <ide> <del> pwd = GlancesPassword(username=username, <del> config=self.config) <add> pwd = GlancesPassword(username=username, config=self.config) <ide> return pwd.check_password(self.server.user_dict[username], password) <ide> else: <ide> return False <ide> class GlancesXMLRPCServer(SimpleXMLRPCServer, object): <ide> <ide> finished = False <ide> <del> def __init__(self, bind_address, <del> bind_port=61209, <del> requestHandler=GlancesXMLRPCHandler, <del> config=None): <add> def __init__(self, bind_address, bind_port=61209, requestHandler=GlancesXMLRPCHandler, config=None): <ide> <ide> self.bind_address = bind_address <ide> self.bind_port = bind_port <ide> def __init__(self, requestHandler=GlancesXMLRPCHandler, config=None, args=None): <ide> <ide> # Init the XML RPC server <ide> try: <del> self.server = GlancesXMLRPCServer(args.bind_address, <del> args.port, <del> requestHandler, <del> config=config) <add> self.server = GlancesXMLRPCServer(args.bind_address, args.port, requestHandler, config=config) <ide> except Exception as e: <ide> logger.critical("Cannot start Glances server: {}".format(e)) <ide> sys.exit(2)
5
Mixed
Ruby
add formula cleanup to install and reinstall
51ca60d6d5faf97f74774ee8366785a6a8d1e168
<ide><path>Library/Homebrew/cmd/install.rb <ide> #: <ide> #: If `--git` (or `-g`) is passed, Homebrew will create a Git repository, useful for <ide> #: creating patches to the software. <add>#: <add>#: If `HOMEBREW_INSTALL_CLEANUP` is set then remove previously installed versions <add>#: of upgraded <formulae>. <ide> <ide> require "missing_formula" <ide> require "formula_installer" <ide> def install <ide> formulae.each do |f| <ide> Migrator.migrate_if_needed(f) <ide> install_formula(f) <add> Cleanup.new.cleanup_formula(f) if ENV["HOMEBREW_INSTALL_CLEANUP"] <ide> end <ide> Homebrew.messages.display_messages <ide> rescue FormulaUnreadableError, FormulaClassUnavailableError, <ide><path>Library/Homebrew/cmd/reinstall.rb <ide> #: <ide> #: If `--display-times` is passed, install times for each formula are printed <ide> #: at the end of the run. <add>#: <add>#: If `HOMEBREW_INSTALL_CLEANUP` is set then remove previously installed versions <add>#: of upgraded <formulae>. <ide> <ide> require "formula_installer" <ide> require "development_tools" <ide> def reinstall <ide> end <ide> Migrator.migrate_if_needed(f) <ide> reinstall_formula(f) <add> Cleanup.new.cleanup_formula(f) if ENV["HOMEBREW_INSTALL_CLEANUP"] <ide> end <ide> Homebrew.messages.display_messages <ide> end <ide><path>Library/Homebrew/cmd/upgrade.rb <ide> #: <ide> #: Options for the `install` command are also valid here. <ide> #: <del>#: If `--cleanup` is specified, `HOMEBREW_INSTALL_CLEANUP` or `HOMEBREW_UPGRADE_CLEANUP` is set then remove <add>#: If `--cleanup` is specified or `HOMEBREW_INSTALL_CLEANUP` is set then remove <ide> #: previously installed version(s) of upgraded <formulae>. <ide> #: <ide> #: If `--fetch-HEAD` is passed, fetch the upstream repository to detect if <ide><path>Library/Homebrew/test/cmd/upgrade_spec.rb <ide> expect(HOMEBREW_CELLAR/"testball/0.1").to be_a_directory <ide> expect(HOMEBREW_CELLAR/"testball/0.0.1").not_to exist <ide> end <del> <del> it "upgrades a Formula and cleans up old versions when `HOMEBREW_INSTALL_CLEANUP` is set" do <del> setup_test_formula "testball" <del> # allow(ENV).to receive(:[]).and_call_original <del> # allow(ENV).to receive(:[]).with("HOMEBREW_INSTALL_CLEANUP").and_return("1") <del> ENV["HOMEBREW_INSTALL_CLEANUP"] = "1" <del> (HOMEBREW_CELLAR/"testball/0.0.1/foo").mkpath <del> <del> expect { brew "upgrade" }.to be_a_success <del> <del> expect(HOMEBREW_CELLAR/"testball/0.1").to be_a_directory <del> expect(HOMEBREW_CELLAR/"testball/0.0.1").not_to exist <del> end <ide> end <ide><path>docs/Manpage.md <ide> Note that environment variables must have a value set to be detected. For exampl <ide> This issue typically occurs when using FileVault or custom SSD <ide> configurations. <ide> <del> * `HOMEBREW_UPGRADE_CLEANUP`: <del> If set, `brew upgrade` always assumes `--cleanup` has been passed. <del> <ide> * `HOMEBREW_INSTALL_CLEANUP`: <ide> If set, `brew upgrade` always assumes `--cleanup` has been passed. <add> Additionally, `brew install` and `brew reinstall` will clean up associated <add> formulae. <ide> <ide> * `HOMEBREW_VERBOSE`: <ide> If set, Homebrew always assumes `--verbose` when running commands.
5
Javascript
Javascript
use mapvalues for readability
dc848697ec640f7635777c76ca9e410364a3ddf3
<ide><path>src/Injector.js <ide> import { Component, PropTypes } from 'react'; <add>import mapValues from 'lodash/object/mapValues'; <ide> <ide> export default class Injector extends Component { <ide> static contextTypes = { <ide> export default class Injector extends Component { <ide> const { children, actions: _actions } = this.props; <ide> const { atom } = this.state; <ide> <del> const actions = Object.keys(_actions).reduce((result, key) => { <del> result[key] = this.performAction.bind(this, _actions[key]); <del> return result; <del> }, {}); <add> const actions = mapValues(_actions, actionCreator => <add> this.performAction.bind(this, actionCreator) <add> ); <ide> <ide> return children({ atom, actions }); <ide> } <ide><path>src/addons/composeStores.js <add>import mapValues from 'lodash/object/mapValues'; <add> <ide> export default function composeStores(stores) { <ide> return function Composition(atom = {}, action) { <del> return Object.keys(stores).reduce((result, key) => { <del> result[key] = stores[key](atom[key], action); <del> return result; <del> }, {}); <add> return mapValues(stores, (store, key) => <add> store(atom[key], action) <add> ); <ide> }; <ide> }
2
Ruby
Ruby
add xcode 5.0.1
535c02674ca9a3841b7a90c65350b23ac3c07da3
<ide><path>Library/Homebrew/macos.rb <ide> def preferred_arch <ide> "4.6.2" => { :llvm_build => 2336, :clang => "4.2", :clang_build => 425 }, <ide> "4.6.3" => { :llvm_build => 2336, :clang => "4.2", :clang_build => 425 }, <ide> "5.0" => { :clang => "5.0", :clang_build => 500 }, <add> "5.0.1" => { :clang => "5.0", :clang_build => 500 }, <ide> } <ide> <ide> def compilers_standard? <ide><path>Library/Homebrew/os/mac/xcode.rb <ide> def latest_version <ide> else <ide> # Default to newest known version of Xcode for unreleased OSX versions. <ide> if MacOS.version > 10.9 <del> "5.0" <add> "5.0.1" <ide> else <ide> raise "Mac OS X '#{MacOS.version}' is invalid" <ide> end
2
Java
Java
improve exception message
e5b505224b77bb2428ab9ca85e894a1ba51f8994
<ide><path>spring-context/src/main/java/org/springframework/cache/interceptor/CacheAspectSupport.java <ide> public void afterSingletonsInstantiated() { <ide> } <ide> catch (NoUniqueBeanDefinitionException ex) { <ide> throw new IllegalStateException("No CacheResolver specified, and no unique bean of type " + <del> "CacheManager found. Mark one as primary or declare a specific CacheManager to use."); <add> "CacheManager found. Mark one as primary (or give it the name 'cacheManager') or " + <add> "declare a specific CacheManager to use, that serves as the default one."); <ide> } <ide> catch (NoSuchBeanDefinitionException ex) { <ide> throw new IllegalStateException("No CacheResolver specified, and no bean of type CacheManager found. " +
1
Java
Java
replace deprecated methods in rsocket tests
7d68a65dc07e960e6d373f5a258d3e8b80f87819
<ide><path>spring-messaging/src/test/java/org/springframework/messaging/rsocket/RSocketBufferLeakTests.java <ide> public static void setupOnce() { <ide> <ide> server = RSocketFactory.receive() <ide> .frameDecoder(PayloadDecoder.ZERO_COPY) <del> .addServerPlugin(payloadInterceptor) // intercept responding <add> .addResponderPlugin(payloadInterceptor) // intercept responding <ide> .acceptor(context.getBean(RSocketMessageHandler.class).serverAcceptor()) <ide> .transport(TcpServerTransport.create("localhost", 7000)) <ide> .start() <ide> public static void setupOnce() { <ide> requester = RSocketRequester.builder() <ide> .rsocketFactory(factory -> { <ide> factory.frameDecoder(PayloadDecoder.ZERO_COPY); <del> factory.addClientPlugin(payloadInterceptor); // intercept outgoing requests <add> factory.addRequesterPlugin(payloadInterceptor); // intercept outgoing requests <ide> }) <ide> .rsocketStrategies(context.getBean(RSocketStrategies.class)) <ide> .connectTcp("localhost", 7000) <ide><path>spring-messaging/src/test/java/org/springframework/messaging/rsocket/RSocketClientToServerIntegrationTests.java <ide> public static void setupOnce() { <ide> context = new AnnotationConfigApplicationContext(ServerConfig.class); <ide> <ide> server = RSocketFactory.receive() <del> .addServerPlugin(interceptor) <add> .addResponderPlugin(interceptor) <ide> .frameDecoder(PayloadDecoder.ZERO_COPY) <ide> .acceptor(context.getBean(RSocketMessageHandler.class).serverAcceptor()) <ide> .transport(TcpServerTransport.create("localhost", 7000))
2
Go
Go
fix issue within auth test
0146f65a448d2d42271300f1477ea9fa378d6360
<ide><path>api_test.go <ide> func TestGetAuth(t *testing.T) { <ide> t.Fatalf("%d OK or 0 expected, received %d\n", http.StatusOK, r.Code) <ide> } <ide> <del> newAuthConfig := srv.registry.GetAuthConfig() <add> newAuthConfig := srv.registry.GetAuthConfig(false) <ide> if newAuthConfig.Username != authConfig.Username || <ide> newAuthConfig.Email != authConfig.Email { <ide> t.Fatalf("The auth configuration hasn't been set correctly")
1
Javascript
Javascript
improve test for crypto padding
72b1f79a64fcfe243e7d3b8600f9e10dc96c5694
<ide><path>test/parallel/test-crypto-padding.js <ide> function dec(encd, pad) { <ide> * Test encryption <ide> */ <ide> <del>assert.equal(enc(ODD_LENGTH_PLAIN, true), ODD_LENGTH_ENCRYPTED); <del>assert.equal(enc(EVEN_LENGTH_PLAIN, true), EVEN_LENGTH_ENCRYPTED); <add>assert.strictEqual(enc(ODD_LENGTH_PLAIN, true), ODD_LENGTH_ENCRYPTED); <add>assert.strictEqual(enc(EVEN_LENGTH_PLAIN, true), EVEN_LENGTH_ENCRYPTED); <ide> <ide> assert.throws(function() { <ide> // input must have block length % <ide> enc(ODD_LENGTH_PLAIN, false); <del>}); <add>}, /data not multiple of block length/); <ide> <ide> assert.doesNotThrow(function() { <del> assert.equal(enc(EVEN_LENGTH_PLAIN, false), EVEN_LENGTH_ENCRYPTED_NOPAD); <add> assert.strictEqual( <add> enc(EVEN_LENGTH_PLAIN, false), EVEN_LENGTH_ENCRYPTED_NOPAD <add> ); <ide> }); <ide> <ide> <ide> /* <ide> * Test decryption <ide> */ <ide> <del>assert.equal(dec(ODD_LENGTH_ENCRYPTED, true), ODD_LENGTH_PLAIN); <del>assert.equal(dec(EVEN_LENGTH_ENCRYPTED, true), EVEN_LENGTH_PLAIN); <add>assert.strictEqual(dec(ODD_LENGTH_ENCRYPTED, true), ODD_LENGTH_PLAIN); <add>assert.strictEqual(dec(EVEN_LENGTH_ENCRYPTED, true), EVEN_LENGTH_PLAIN); <ide> <ide> assert.doesNotThrow(function() { <ide> // returns including original padding <del> assert.equal(dec(ODD_LENGTH_ENCRYPTED, false).length, 32); <del> assert.equal(dec(EVEN_LENGTH_ENCRYPTED, false).length, 48); <add> assert.strictEqual(dec(ODD_LENGTH_ENCRYPTED, false).length, 32); <add> assert.strictEqual(dec(EVEN_LENGTH_ENCRYPTED, false).length, 48); <ide> }); <ide> <ide> assert.throws(function() { <ide> // must have at least 1 byte of padding (PKCS): <del> assert.equal(dec(EVEN_LENGTH_ENCRYPTED_NOPAD, true), EVEN_LENGTH_PLAIN); <del>}); <add> assert.strictEqual( <add> dec(EVEN_LENGTH_ENCRYPTED_NOPAD, true), EVEN_LENGTH_PLAIN <add> ); <add>}, /bad decrypt/); <ide> <ide> assert.doesNotThrow(function() { <ide> // no-pad encrypted string should return the same: <del> assert.equal(dec(EVEN_LENGTH_ENCRYPTED_NOPAD, false), EVEN_LENGTH_PLAIN); <add> assert.strictEqual( <add> dec(EVEN_LENGTH_ENCRYPTED_NOPAD, false), EVEN_LENGTH_PLAIN <add> ); <ide> });
1
Text
Text
improve the changelog entry [ci skip]
096ee1594d329f53ef47d0aff9bb6eef25a18b96
<ide><path>actionpack/CHANGELOG.md <ide> ## Rails 4.0.0 (unreleased) ## <ide> <del>* Fix explicit names on multiple file fields. If a file field tag is passed <add>* Fix explicit names on multiple file fields. If a file field tag has <ide> the multiple option, it is turned into an array field (appending `[]`), <del> but if the file field is passed an explicit name as an option, leave the <del> name alone (do not append `[]`). Fixes #9830 <add> but if an explicit name is passed to `file_field` the `[]` is not <add> appended. <add> Fixes #9830. <ide> <ide> *Ryan McGeary* <ide>
1
Text
Text
add documentation on jquery chaining
cd18e168a63127bd9a6b5cf357a138f628aca15e
<ide><path>guide/english/jquery/jquery-chaining/index.md <add>--- <add>title: jQuery Chaining <add>--- <add>## jQuery Chaining <add>jQuery chaining allows you to execute multiple methods on the same jQuery selection, all on a single line. <add> <add>Chaining allows us to turn multi-line statements: <add>```javascript <add>$('#someElement').removeClass('classA'); <add>$('#someElement').addClass('classB'); <add>``` <add>Into a single statement: <add>```javascript <add>$('#someElement').removeClass('classA').addClass('classB'); <add>``` <add> <add>#### More Information: <add>For more information, please visit the [w3schools documentation](https://www.w3schools.com/jquery/jquery_chaining.asp). <ide>\ No newline at end of file
1
Javascript
Javascript
remove unused catch bindings
39a027224e81681251266cdd104229ae53a0c12a
<ide><path>lib/assert.js <ide> function getErrMessage(message, fn) { <ide> errorCache.set(identifier, message); <ide> <ide> return message; <del> } catch (e) { <del> // Invalidate cache to prevent trying to read this part again. <add> } catch { <add> // Invalidate cache to prevent trying to read this part again. <ide> errorCache.set(identifier, undefined); <ide> } finally { <ide> // Reset limit.
1
Java
Java
fix initialization issue in reactorresourcefactory
2163fa94a7f0b8bf5de1398f0a79249f342f497c
<ide><path>spring-web/src/main/java/org/springframework/http/client/reactive/ReactorResourceFactory.java <ide> public class ReactorResourceFactory implements InitializingBean, DisposableBean <ide> private Consumer<HttpResources> globalResourcesConsumer; <ide> <ide> <del> private Supplier<ConnectionProvider> connectionProviderSupplier = () -> ConnectionProvider.elastic("http"); <add> private Supplier<ConnectionProvider> connectionProviderSupplier = () -> ConnectionProvider.elastic("webflux"); <ide> <del> private Supplier<LoopResources> loopResourcesSupplier = () -> LoopResources.create("reactor-http"); <add> private Supplier<LoopResources> loopResourcesSupplier = () -> LoopResources.create("webflux-http"); <ide> <ide> <ide> @Nullable <ide> public void afterPropertiesSet() throws Exception { <ide> if (this.globalResourcesConsumer != null) { <ide> this.globalResourcesConsumer.accept(httpResources); <ide> } <add> this.connectionProvider = httpResources; <add> this.loopResources = httpResources; <ide> } <ide> else { <ide> if (this.loopResources == null) { <ide><path>spring-web/src/test/java/org/springframework/http/client/reactive/ReactorResourceFactoryTests.java <add>/* <add> * Copyright 2002-2018 the original author or authors. <add> * <add> * Licensed under the Apache License, Version 2.0 (the "License"); <add> * you may not use this file except in compliance with the License. <add> * You may obtain a copy of the License at <add> * <add> * http://www.apache.org/licenses/LICENSE-2.0 <add> * <add> * Unless required by applicable law or agreed to in writing, software <add> * distributed under the License is distributed on an "AS IS" BASIS, <add> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <add> * See the License for the specific language governing permissions and <add> * limitations under the License. <add> */ <add>package org.springframework.http.client.reactive; <add> <add>import java.util.concurrent.atomic.AtomicBoolean; <add> <add>import org.junit.Test; <add>import reactor.netty.http.HttpResources; <add>import reactor.netty.resources.ConnectionProvider; <add>import reactor.netty.resources.LoopResources; <add> <add>import static org.junit.Assert.*; <add>import static org.mockito.Mockito.*; <add> <add>/** <add> * Unit tests for {@link ReactorResourceFactory}. <add> * @author Rossen Stoyanchev <add> */ <add>public class ReactorResourceFactoryTests { <add> <add> private final ReactorResourceFactory resourceFactory = new ReactorResourceFactory(); <add> <add> private final ConnectionProvider connectionProvider = mock(ConnectionProvider.class); <add> <add> private final LoopResources loopResources = mock(LoopResources.class); <add> <add> <add> @Test <add> public void globalResources() throws Exception { <add> <add> this.resourceFactory.setUseGlobalResources(true); <add> this.resourceFactory.afterPropertiesSet(); <add> <add> HttpResources globalResources = HttpResources.get(); <add> assertSame(globalResources, this.resourceFactory.getConnectionProvider()); <add> assertSame(globalResources, this.resourceFactory.getLoopResources()); <add> assertFalse(globalResources.isDisposed()); <add> <add> this.resourceFactory.destroy(); <add> <add> assertTrue(globalResources.isDisposed()); <add> } <add> <add> @Test <add> public void globalResourcesWithConsumer() throws Exception { <add> <add> AtomicBoolean invoked = new AtomicBoolean(false); <add> <add> this.resourceFactory.addGlobalResourcesConsumer(httpResources -> invoked.set(true)); <add> this.resourceFactory.afterPropertiesSet(); <add> <add> assertTrue(invoked.get()); <add> this.resourceFactory.destroy(); <add> } <add> <add> @Test <add> public void localResources() throws Exception { <add> <add> this.resourceFactory.setUseGlobalResources(false); <add> this.resourceFactory.afterPropertiesSet(); <add> <add> ConnectionProvider connectionProvider = this.resourceFactory.getConnectionProvider(); <add> LoopResources loopResources = this.resourceFactory.getLoopResources(); <add> <add> assertNotSame(HttpResources.get(), connectionProvider); <add> assertNotSame(HttpResources.get(), loopResources); <add> <add> // The below does not work since ConnectionPoolProvider simply checks if pool is empty. <add> // assertFalse(connectionProvider.isDisposed()); <add> assertFalse(loopResources.isDisposed()); <add> <add> this.resourceFactory.destroy(); <add> <add> assertTrue(connectionProvider.isDisposed()); <add> assertTrue(loopResources.isDisposed()); <add> } <add> <add> @Test <add> public void localResourcesViaSupplier() throws Exception { <add> <add> this.resourceFactory.setUseGlobalResources(false); <add> this.resourceFactory.setConnectionProviderSupplier(() -> this.connectionProvider); <add> this.resourceFactory.setLoopResourcesSupplier(() -> this.loopResources); <add> this.resourceFactory.afterPropertiesSet(); <add> <add> ConnectionProvider connectionProvider = this.resourceFactory.getConnectionProvider(); <add> LoopResources loopResources = this.resourceFactory.getLoopResources(); <add> <add> assertSame(this.connectionProvider, connectionProvider); <add> assertSame(this.loopResources, loopResources); <add> <add> verifyNoMoreInteractions(this.connectionProvider, this.loopResources); <add> <add> this.resourceFactory.destroy(); <add> <add> // Managed (destroy disposes).. <add> verify(this.connectionProvider).dispose(); <add> verify(this.loopResources).dispose(); <add> verifyNoMoreInteractions(this.connectionProvider, this.loopResources); <add> } <add> <add> @Test <add> public void externalResources() throws Exception { <add> <add> this.resourceFactory.setUseGlobalResources(false); <add> this.resourceFactory.setConnectionProvider(this.connectionProvider); <add> this.resourceFactory.setLoopResources(this.loopResources); <add> this.resourceFactory.afterPropertiesSet(); <add> <add> ConnectionProvider connectionProvider = this.resourceFactory.getConnectionProvider(); <add> LoopResources loopResources = this.resourceFactory.getLoopResources(); <add> <add> assertSame(this.connectionProvider, connectionProvider); <add> assertSame(this.loopResources, loopResources); <add> <add> verifyNoMoreInteractions(this.connectionProvider, this.loopResources); <add> <add> this.resourceFactory.destroy(); <add> <add> // Not managed (destroy has no impact).. <add> verifyNoMoreInteractions(this.connectionProvider, this.loopResources); <add> } <add> <add>}
2
Javascript
Javascript
fix sr-cyr and tzm-la close
4e7c24ab495cf7d2ba89ac2893326d7c82bd6d70
<add><path>lang/sr-cyrl.js <del><path>lang/sr-cyr.js <ide> // moment.js language configuration <del>// language : Serbian-cyrillic (sr-cyr) <add>// language : Serbian-cyrillic (sr-cyrl) <ide> // author : Milan Janačković<milanjanackovic@gmail.com> : https://github.com/milan-j <ide> <ide> (function (factory) { <ide> } <ide> }; <ide> <del> return moment.lang('sr-cyr', { <add> return moment.lang('sr-cyrl', { <ide> months: ['јануар', 'фебруар', 'март', 'април', 'мај', 'јун', 'јул', 'август', 'септембар', 'октобар', 'новембар', 'децембар'], <ide> monthsShort: ['јан.', 'феб.', 'мар.', 'апр.', 'мај', 'јун', 'јул', 'авг.', 'сеп.', 'окт.', 'нов.', 'дец.'], <ide> weekdays: ['недеља', 'понедељак', 'уторак', 'среда', 'четвртак', 'петак', 'субота'], <add><path>lang/tzm-latn.js <del><path>lang/tzm-la.js <ide> // moment.js language configuration <del>// language : Morocco Central Atlas Tamaziɣt in Latin (tzm-la) <add>// language : Morocco Central Atlas Tamaziɣt in Latin (tzm-latn) <ide> // author : Abdel Said : https://github.com/abdelsaid <ide> <ide> (function (factory) { <ide> factory(window.moment); // Browser global <ide> } <ide> }(function (moment) { <del> return moment.lang('tzm-la', { <add> return moment.lang('tzm-latn', { <ide> months : "innayr_brˤayrˤ_marˤsˤ_ibrir_mayyw_ywnyw_ywlywz_ɣwšt_šwtanbir_ktˤwbrˤ_nwwanbir_dwjnbir".split("_"), <ide> monthsShort : "innayr_brˤayrˤ_marˤsˤ_ibrir_mayyw_ywnyw_ywlywz_ɣwšt_šwtanbir_ktˤwbrˤ_nwwanbir_dwjnbir".split("_"), <ide> weekdays : "asamas_aynas_asinas_akras_akwas_asimwas_asiḍyas".split("_"), <add><path>test/lang/sr-cyrl.js <del><path>test/lang/sr-cyr.js <ide> var moment = require("../../moment"); <ide> Serbian-cyrillic (sr-cyr) <ide> *************************************************/ <ide> <del>exports["lang:sr-cyr"] = { <add>exports["lang:sr-cyrl"] = { <ide> setUp : function (cb) { <del> moment.lang('sr-cyr'); <add> moment.lang('sr-cyrl'); <ide> moment.createFromInputFallback = function () { <ide> throw new Error("input not handled by moment"); <ide> }; <ide> exports["lang:sr-cyr"] = { <ide> <ide> "returns the name of the language" : function (test) { <ide> if (typeof module !== 'undefined' && module.exports) { <del> test.equal(require('../../lang/sr-cyr'), 'sr-cyr', "module should export sr-cyr"); <add> test.equal(require('../../lang/sr-cyrl'), 'sr-cyrl', "module should export sr-cyrl"); <ide> } <ide> <ide> test.done(); <add><path>test/lang/tzm-latn.js <del><path>test/lang/tzm-la.js <ide> var moment = require("../../moment"); <ide> <ide> <del>exports["lang:tzm-la"] = { <add>exports["lang:tzm-latn"] = { <ide> setUp : function (cb) { <del> moment.lang('tzm-la'); <add> moment.lang('tzm-latn'); <ide> moment.createFromInputFallback = function () { <ide> throw new Error("input not handled by moment"); <ide> }; <ide> exports["lang:tzm-la"] = { <ide> <ide> "returns the name of the language" : function (test) { <ide> if (typeof module !== 'undefined' && module.exports) { <del> test.equal(require('../../lang/tzm-la'), 'tzm-la', "module should export tzm-la"); <add> test.equal(require('../../lang/tzm-latn'), 'tzm-latn', "module should export tzm-latn"); <ide> } <ide> <ide> test.done();
4
PHP
PHP
fix asterisk spacing cs error
d9914558d84767937c11a2ce63e3884379a87aac
<ide><path>src/View/Helper/TimeHelper.php <ide> public function daysAsSql($begin, $end, $fieldName, $timezone = null) { <ide> /** <ide> * Returns a partial SQL string to search for all records between two times <ide> * occurring on the same day. <del> * <add> * <ide> * @see Cake\Utility\Time::dayAsSql() <ide> * <ide> * @param integer|string|DateTime $dateString UNIX timestamp, strtotime() valid string or DateTime object
1
PHP
PHP
apply fixes from styleci
cada3d21c7f127ba01bb949b2fa045b7faaedbca
<ide><path>src/Illuminate/View/Engines/CompilerEngine.php <ide> namespace Illuminate\View\Engines; <ide> <ide> use Illuminate\View\Compilers\CompilerInterface; <del>use Throwable; <ide> use Illuminate\View\ViewException; <add>use Throwable; <ide> <ide> class CompilerEngine extends PhpEngine <ide> {
1
Java
Java
update javadoc in sqlscriptstestexecutionlistener
da5b0b97d3a4f425576fe216ef6b5d1e4465af84
<ide><path>spring-test/src/main/java/org/springframework/test/context/jdbc/SqlScriptsTestExecutionListener.java <ide> private void executeSqlScripts(TestContext testContext, ExecutionPhase execution <ide> * Execute the SQL scripts configured via the supplied {@link Sql @Sql} <ide> * annotation for the given {@link ExecutionPhase} and {@link TestContext}. <ide> * <del> * <p>Special care must be taken in order to properly support the <del> * {@link Sql#requireNewTransaction requireNewTransaction} <del> * flag. <add> * <p>Special care must be taken in order to properly support the configured <add> * {@link SqlConfig#transactionMode}. <ide> * <ide> * @param sql the {@code @Sql} annotation to parse <ide> * @param executionPhase the current execution phase
1
PHP
PHP
add tests for escaping name + value
d8944c6b3b112fc357e3bd4ed21d625f0a83af4e
<ide><path>src/View/Input/MultiCheckbox.php <ide> public function __construct($templates) { <ide> /** <ide> * Render multi-checkbox widget. <ide> * <add> * Data supports the following options. <add> * <add> * - `name` The name attribute of the inputs to create. <add> * `[]` will be appended to the name. <add> * - `options` An array of options to create checkboxes out of. <add> * - `val` Either a string/integer or array of values that should be <add> * checked. <add> * - `disabled` Either a boolean or an array of checkboxes to disable. <add> * - `escape` Set to false to disable HTML escaping. <add> * <ide> * @param array $data <ide> * @return string <ide> */ <ide> public function render($data) { <ide> protected function _renderInput($checkbox) { <ide> $input = $this->_templates->format('checkbox', [ <ide> 'name' => $checkbox['name'] . '[]', <del> 'value' => $checkbox['value'], <add> 'value' => $checkbox['escape'] ? h($checkbox['value']) : $checkbox['value'], <ide> 'attrs' => $this->_templates->formatAttributes( <ide> $checkbox, <ide> ['name', 'value', 'text'] <ide><path>tests/TestCase/View/Input/MultiCheckboxTest.php <ide> public function testRenderSimple() { <ide> * @return void <ide> */ <ide> public function testRenderEscaping() { <del> $this->markTestIncomplete(); <add> $input = new MultiCheckbox($this->templates); <add> $data = [ <add> 'name' => 'Tags[id]', <add> 'options' => [ <add> '>' => '>>', <add> ] <add> ]; <add> $result = $input->render($data); <add> $expected = [ <add> ['div' => ['class' => 'checkbox']], <add> ['input' => [ <add> 'type' => 'checkbox', <add> 'name' => 'Tags[id][]', <add> 'value' => '&gt;', <add> 'id' => 'tags-id', <add> ]], <add> ['label' => ['for' => 'tags-id']], <add> '&gt;&gt;', <add> '/label', <add> '/div', <add> ]; <add> $this->assertTags($result, $expected); <ide> } <ide> <ide> /**
2
PHP
PHP
rename some methods
1349d70b659732c4592bef8901312a2840cef536
<ide><path>src/Illuminate/Validation/Validator.php <ide> protected function validateNotIn($attribute, $value, $parameters) <ide> */ <ide> protected function validateDistinct($attribute, $value, $parameters) <ide> { <del> $rawAttribute = $this->getRawAttribute($attribute); <add> $attributeName = $this->getPrimaryAttribute($attribute); <ide> <del> $data = Arr::where(Arr::dot($this->data), function ($key) use ($attribute, $rawAttribute) { <del> return $key != $attribute && Str::is($rawAttribute, $key); <add> $data = Arr::where(Arr::dot($this->data), function ($key) use ($attribute, $attributeName) { <add> return $key != $attribute && Str::is($attributeName, $key); <ide> }); <ide> <ide> return ! in_array($value, array_values($data)); <ide> protected function getAttributeList(array $values) <ide> */ <ide> protected function getAttribute($attribute) <ide> { <del> $rawAttribute = $this->getRawAttribute($attribute); <add> $attributeName = $this->getPrimaryAttribute($attribute); <ide> <ide> // The developer may dynamically specify the array of custom attributes <ide> // on this Validator instance. If the attribute exists in this array <ide> // it takes precedence over all other ways we can pull attributes. <del> if (isset($this->customAttributes[$rawAttribute])) { <del> return $this->customAttributes[$rawAttribute]; <add> if (isset($this->customAttributes[$attributeName])) { <add> return $this->customAttributes[$attributeName]; <ide> } <ide> <del> $key = "validation.attributes.{$rawAttribute}"; <add> $key = "validation.attributes.{$attributeName}"; <ide> <ide> // We allow for the developer to specify language lines for each of the <ide> // attributes allowing for more displayable counterparts of each of <ide> protected function getAttribute($attribute) <ide> } <ide> <ide> /** <del> * Get the raw attribute name. <add> * Get the primary attribute name. <add> * <add> * For example, if "name.0" is given, "name.*" will be returned. <ide> * <ide> * @param string $attribute <ide> * @return string|null <ide> */ <del> protected function getRawAttribute($attribute) <add> protected function getPrimaryAttribute($attribute) <ide> { <del> $rawAttribute = $attribute; <del> <del> foreach ($this->implicitAttributes as $raw => $dataAttributes) { <del> if (in_array($attribute, $dataAttributes)) { <del> $rawAttribute = $raw; <del> break; <add> foreach ($this->implicitAttributes as $unparsed => $parsed) { <add> if (in_array($attribute, $parsed)) { <add> return $unparsed; <ide> } <ide> } <ide> <del> return $rawAttribute; <add> return $attribute; <ide> } <ide> <ide> /**
1
Java
Java
fix typo in javadoc for abstractjdbccall
9d124fffcbe1a4167a251b267bf2cc763bb2d3ec
<ide><path>spring-jdbc/src/main/java/org/springframework/jdbc/core/simple/AbstractJdbcCall.java <ide> protected List<SqlParameter> getCallParameters() { <ide> /** <ide> * Match the provided in parameter values with registered parameters and <ide> * parameters defined via meta-data processing. <del> * @param parameterSource the parameter vakues provided as a {@link SqlParameterSource} <add> * @param parameterSource the parameter values provided as a {@link SqlParameterSource} <ide> * @return a Map with parameter names and values <ide> */ <ide> protected Map<String, Object> matchInParameterValuesWithCallParameters(SqlParameterSource parameterSource) {
1
Ruby
Ruby
fix example for database-specific locking clause
6e2357f0fe764e15fae280b879c49136b563c2ba
<ide><path>activerecord/lib/active_record/locking/pessimistic.rb <ide> module Locking <ide> # of your own such as 'LOCK IN SHARE MODE' or 'FOR UPDATE NOWAIT'. Example: <ide> # <ide> # Account.transaction do <del> # # select * from accounts where name = 'shugo' limit 1 for update <del> # shugo = Account.where("name = 'shugo'").lock(true).first <del> # yuko = Account.where("name = 'yuko'").lock(true).first <add> # # select * from accounts where name = 'shugo' limit 1 for update nowait <add> # shugo = Account.lock("FOR UPDATE NOWAIT").find_by(name: "shugo") <add> # yuko = Account.lock("FOR UPDATE NOWAIT").find_by(name: "yuko") <ide> # shugo.balance -= 100 <ide> # shugo.save! <ide> # yuko.balance += 100
1
Text
Text
add xz utils as a runtime dep
4f5c2cbccc2ef80f5372ebb4abb38d33343f2c86
<ide><path>hack/PACKAGERS.md <ide> To run properly, docker needs the following software to be installed at runtime: <ide> * iptables version 1.4 or later <ide> * The lxc utility scripts (http://lxc.sourceforge.net) version 0.8 or later. <ide> * Git version 1.7 or later <add>* XZ Utils 4.9 or later <ide> <ide> ## Kernel dependencies <ide>
1
Python
Python
fix uninitialized value in masked ndenumerate test
6996397b00e4d2dd609deca430d05f6e80e8cea2
<ide><path>numpy/ma/tests/test_extras.py <ide> def test_shape_scalar(self): <ide> class TestNDEnumerate: <ide> <ide> def test_ndenumerate_nomasked(self): <del> ordinary = np.ndarray(6).reshape((1, 3, 2)) <add> ordinary = np.arange(6.).reshape((1, 3, 2)) <ide> empty_mask = np.zeros_like(ordinary, dtype=bool) <ide> with_mask = masked_array(ordinary, mask=empty_mask) <ide> assert_equal(list(np.ndenumerate(ordinary)),
1
Javascript
Javascript
improve wording and formatting
618e3f2558170ff49ff50852bb7833a54585e328
<ide><path>src/ngResource/resource.js <ide> function shallowClearAndCopy(src, dst) { <ide> * <ide> * <div doc-module-components="ngResource"></div> <ide> * <del> * See {@link ngResource.$resource `$resource`} for usage. <del> * <del> * See {@link ngResource.$resourceProvider `$resourceProvider`} for usage. <add> * See {@link ngResource.$resourceProvider} and {@link ngResource.$resource} for usage. <ide> */ <ide> <ide> /** <ide> function shallowClearAndCopy(src, dst) { <ide> * <ide> * @description <ide> * <del> * Use for configuring {@link ngResource.$resource `$resource`} in module configuration phase. <del> * <del> * ## Example <del> * See {@link ngResource.$resourceProvider#defaults `Properties`} for configuring `ngResource`. <add> * Use `$resourceProvider` to change the default behavior of the {@link ngResource.$resource} <add> * service. <ide> * <ide> * ## Dependencies <del> * Requires {@link ngResource `ngResource`} module to be installed. <add> * Requires the {@link ngResource } module to be installed. <ide> * <ide> */ <ide> <ide> angular.module('ngResource', ['ng']). <ide> * @ngdoc property <ide> * @name $resourceProvider#defaults <ide> * @description <del> * A configuration object for `$resource` instances. <add> * Object containing default options used when creating `$resource` instances. <ide> * <del> * Properties of this object are initialized with a set of values that satisfies a wide range of use cases. <del> * User can also choose to override these properties in application configuration phase. <add> * The default values satisfy a wide range of usecases, but you may choose to overwrite any of <add> * them to further customize your instances. The available properties are: <ide> * <del> * Property `stripTrailingSlashes`, default to true, strips trailing slashes from <del> * calculated URLs. <add> * - **stripTrailingSlashes** – `{boolean}` – If true, then the trailing slashes from any <add> * calculated URL will be stripped.<br /> <add> * (Defaults to true.) <add> * - **cancellable** – `{boolean}` – If true, the request made by a "non-instance" call will be <add> * cancelled (if not already completed) by calling `$cancelRequest()` on the call's return <add> * value. For more details, see {@link ngResource.$resource}. This can be overwritten per <add> * resource class or action.<br /> <add> * (Defaults to false.) <add> * - **actions** - `{Object.<Object>}` - A hash with default actions declarations. Actions are <add> * high-level methods corresponding to RESTful actions/methods on resources. An action may <add> * specify what HTTP method to use, what URL to hit, if the return value will be a single <add> * object or a collection (array) of objects etc. For more details, see <add> * {@link ngResource.$resource}. The actions can also be enhanced or overwritten per resource <add> * class.<br /> <add> * The default actions are: <add> * ```js <add> * { <add> * get: {method: 'GET'}, <add> * save: {method: 'POST'}, <add> * query: {method: 'GET', isArray: true}, <add> * remove: {method: 'DELETE'}, <add> * delete: {method: 'DELETE'} <add> * } <add> * ``` <ide> * <del> * Property `actions` is an object that sets up high level methods/aliases on `$resource` object <del> * based on standard HTTP methods. Users can supply an "actions" object with method aliases that <del> * comply with alternative conventions. <add> * #### Example <ide> * <del> * To add your own set of configurations, set it up like so: <del> * ``` <del> * angular.module('myApp').config(['resourceProvider', function ($resourceProvider){ <add> * For example, you can specify a new `update` action that uses the `PUT` HTTP verb: <ide> * <del> * // Provide your own set of actions on $resource factory. <del> * // The following comments are Angular's default actions, which are being <del> * // replaced by an object that includes a PUT method as shown. <del> * // { 'get': {method:'GET'}, <del> * // 'save': {method:'POST'}, <del> * // 'query': {method:'GET', isArray:true}, <del> * // 'remove': {method:'DELETE'}, <del> * // 'delete': {method:'DELETE'} }; <add> * ```js <add> * angular. <add> * module('myApp'). <add> * config(['resourceProvider', function ($resourceProvider) { <add> * $resourceProvider.defaults.actions.update = { <add> * method: 'PUT' <add> * }; <add> * }); <add> * ``` <ide> * <del> * $resourceProvider.defaults.actions = { <del> * create:{method: 'POST'}, <del> * save: {method: 'POST'}, <del> * update:{method: 'PUT'}, <del> * get: {method: 'GET'}, <del> * query: {method: 'GET', isArray:true}, <del> * remove: {method: 'DELETE'}, <del> * delete: {method: 'DELETE'} <del> * }; <add> * Or you can even overwrite the whole `actions` list and specify your own: <ide> * <del> * // Don't strip trailing slashes from calculated URLs. <del> * // Consult your application server's configuration to work in concert with this setting. <del> * $resourceProvider.defaults.stripTrailingSlashes = false; <del> * }]); <add> * ```js <add> * angular. <add> * module('myApp'). <add> * config(['resourceProvider', function ($resourceProvider) { <add> * $resourceProvider.defaults.actions = { <add> * create: {method: 'POST'} <add> * get: {method: 'GET'}, <add> * getAll: {method: 'GET', isArray:true}, <add> * update: {method: 'PUT'}, <add> * delete: {method: 'DELETE'} <add> * }; <add> * }); <ide> * ``` <ide> * <ide> */
1
Javascript
Javascript
add syntax error check in test cases
47086c6e7e7da22aa09c0f0f07daba6647150030
<ide><path>test/RuntimeTemplateCheck.test.js <del>"use strict"; <del> <del>const path = require("path"); <del>const webpack = require(".."); <del>const fs = require("graceful-fs"); <del>const rimraf = require("rimraf"); <del> <del>const tempFolderPath = path.join(__dirname, "TemplateRuntimeTemp"); <del>const tempSourceFilePath = path.join(tempFolderPath, "temp-file.js"); <del>const tempBundleFilePath = path.join(tempFolderPath, "bundle.js"); <del> <del>const createSingleCompiler = () => { <del> return webpack({ <del> entry: tempSourceFilePath, <del> context: tempFolderPath, <del> mode: "development", <del> output: { <del> path: tempFolderPath, <del> filename: "bundle.js" <del> }, <del> devtool: "inline-cheap-source-map" <del> }); <del>}; <del> <del>function cleanup(callback) { <del> rimraf(tempFolderPath, callback); <del>} <del> <del>function createFiles() { <del> fs.mkdirSync(tempFolderPath, { recursive: true }); <del> <del> fs.writeFileSync( <del> tempSourceFilePath, <del> `import { SomeClass } from "./somemodule"; <del> <del>const result = new SomeClass(); <del> <del>const a = function test(arg) { <del> console.log(arg); <del>} <del> <del>if (true) a <del>SomeClass <del>`, <del> "utf-8" <del> ); <del>} <del> <del>const checkOutputFileStatus = outputFilePath => { <del> const result = { <del> status: "Ok" <del> }; <del> try { <del> if (!fs.existsSync(outputFilePath)) { <del> result.status = "CompilerError"; <del> return result; <del> } <del> <del> const contentStr = fs.readFileSync(outputFilePath, "utf-8"); <del> <del> // check syntax <del> Function(contentStr); <del> <del> return result; <del> } catch (e) { <del> const error = e.toString(); <del> <del> result.status = "error"; <del> <del> if (error.indexOf("SyntaxError") === 0) { <del> result.status = "SyntaxError"; <del> return result; <del> } <del> <del> result.type = error; <del> return result; <del> } <del>}; <del> <del>describe("TemplateRuntimeCheck", () => { <del> jest.setTimeout(10000); <del> <del> beforeEach(done => { <del> cleanup(err => { <del> if (err) return done(err); <del> createFiles(); <del> setTimeout(done, 1000); <del> }); <del> }); <del> <del> afterEach(cleanup); <del> <del> it("should build syntax correct code", done => { <del> const compiler = createSingleCompiler(); <del> compiler.run((err, stats) => { <del> if (err) throw err; <del> <del> compiler.close(err2 => { <del> if (err2) throw err2; <del> <del> const result = checkOutputFileStatus(tempBundleFilePath); <del> <del> expect(result.status).toBe("Ok"); <del> <del> done(); <del> }); <del> }); <del> }); <del>}); <ide><path>test/cases/runtime/missing-module-syntax-error/errors.js <add>module.exports = [ <add> [/Module not found/, /Can't resolve '\.\/someModule' /], <add>]; <ide><path>test/cases/runtime/missing-module-syntax-error/index.js <add> <add> <add>it("should have correct error code", function() { <add> <add> try { <add> require("./module"); <add> } catch(e) { <add> expect(e.code).toBe("MODULE_NOT_FOUND"); <add> } <add> <add>}); <ide><path>test/cases/runtime/missing-module-syntax-error/module.js <add>import { SomeClass } from "./someModule"; <add> <add>new SomeClass();
4
Python
Python
fix ner_jsonl2json converter (fix )
fd4a5341b0beffa126f1868eb9031cd581fd9515
<ide><path>spacy/cli/converters/jsonl2json.py <ide> from ...util import get_lang_class, minibatch <ide> <ide> <del>def ner_jsonl2json(input_data, lang=None, n_sents=10, use_morphology=False): <add>def ner_jsonl2json(input_data, lang=None, n_sents=10, use_morphology=False, **_): <ide> if lang is None: <ide> raise ValueError("No --lang specified, but tokenization required") <ide> json_docs = []
1
Text
Text
update unmaintained ffmpeg tap to current
5dddbf1e8c27e2cc258201ff3651a61945cf8e7c
<ide><path>docs/Interesting-Taps-and-Forks.md <ide> Homebrew has the capability to add (and remove) multiple taps to your local inst <ide> Your taps are Git repositories located at `$(brew --repository)/Library/Taps`. <ide> <ide> ## Unsupported interesting taps <del>* [varenc/ffmpeg](https://github.com/varenc/homebrew-ffmpeg): A tap for FFmpeg with additional options, including nonfree additions. <add>* [homebrew-ffmpeg/ffmpeg](https://github.com/homebrew-ffmpeg/homebrew-ffmpeg): A tap for FFmpeg with additional options, including nonfree additions. <ide> <ide> * [denji/nginx](https://github.com/denji/homebrew-nginx): A tap for NGINX modules, intended for its `nginx-full` formula which includes more module options. <ide>
1
Python
Python
add indexing functions by fernando perez
133e5c29958ef7090a9ca80665c9436cdcebb7f9
<ide><path>numpy/lib/index_tricks.py <ide> 'ogrid', <ide> 'r_', 'c_', 's_', <ide> 'index_exp', 'ix_', <del> 'ndenumerate','ndindex'] <add> 'ndenumerate','ndindex', <add> 'fill_diagonal','diag_indices','diag_indices_from'] <ide> <ide> import sys <ide> import numpy.core.numeric as _nx <del>from numpy.core.numeric import asarray, ScalarType, array <add>from numpy.core.numeric import ( asarray, ScalarType, array, alltrue, cumprod, <add> arange ) <ide> from numpy.core.numerictypes import find_common_type <ide> import math <ide> <ide> import function_base <ide> import numpy.core.defmatrix as matrix <add>from function_base import diff <ide> makemat = matrix.matrix <ide> <ide> # contributed by Stefan van der Walt <ide> def __getslice__(self, start, stop): <ide> s_ = IndexExpression(maketuple=False) <ide> <ide> # End contribution from Konrad. <add> <add># I'm not sure this is the best place in numpy for these functions, but since <add># they handle multidimensional arrays, it seemed better than twodim_base. <add> <add>def fill_diagonal(a,val): <add> """Fill the main diagonal of the given array of any dimensionality. <add> <add> For an array with ndim > 2, the diagonal is the list of locations with <add> indices a[i,i,...,i], all identical. <add> <add> This function modifies the input array in-place, it does not return a <add> value. <add> <add> This functionality can be obtained via diag_indices(), but internally this <add> version uses a much faster implementation that never constructs the indices <add> and uses simple slicing. <add> <add> Parameters <add> ---------- <add> a : array, at least 2-dimensional. <add> Array whose diagonal is to be filled, it gets modified in-place. <add> <add> val : scalar <add> Value to be written on the diagonal, its type must be compatible with <add> that of the array a. <add> <add> Examples <add> -------- <add> >>> a = zeros((3,3),int) <add> >>> fill_diagonal(a,5) <add> >>> a <add> array([[5, 0, 0], <add> [0, 5, 0], <add> [0, 0, 5]]) <add> <add> The same function can operate on a 4-d array: <add> >>> a = zeros((3,3,3,3),int) <add> >>> fill_diagonal(a,4) <add> <add> We only show a few blocks for clarity: <add> >>> a[0,0] <add> array([[4, 0, 0], <add> [0, 0, 0], <add> [0, 0, 0]]) <add> >>> a[1,1] <add> array([[0, 0, 0], <add> [0, 4, 0], <add> [0, 0, 0]]) <add> >>> a[2,2] <add> array([[0, 0, 0], <add> [0, 0, 0], <add> [0, 0, 4]]) <add> <add> See also <add> -------- <add> - diag_indices: indices to access diagonals given shape information. <add> - diag_indices_from: indices to access diagonals given an array. <add> """ <add> if a.ndim < 2: <add> raise ValueError("array must be at least 2-d") <add> if a.ndim == 2: <add> # Explicit, fast formula for the common case. For 2-d arrays, we <add> # accept rectangular ones. <add> step = a.shape[1] + 1 <add> else: <add> # For more than d=2, the strided formula is only valid for arrays with <add> # all dimensions equal, so we check first. <add> if not alltrue(diff(a.shape)==0): <add> raise ValueError("All dimensions of input must be of equal length") <add> step = cumprod((1,)+a.shape[:-1]).sum() <add> <add> # Write the value out into the diagonal. <add> a.flat[::step] = val <add> <add> <add>def diag_indices(n,ndim=2): <add> """Return the indices to access the main diagonal of an array. <add> <add> This returns a tuple of indices that can be used to access the main <add> diagonal of an array with ndim (>=2) dimensions and shape (n,n,...,n). For <add> ndim=2 this is the usual diagonal, for ndim>2 this is the set of indices <add> to access A[i,i,...,i] for i=[0..n-1]. <add> <add> Parameters <add> ---------- <add> n : int <add> The size, along each dimension, of the arrays for which the returned <add> indices can be used. <add> <add> ndim : int, optional <add> The number of dimensions <add> <add> Examples <add> -------- <add> Create a set of indices to access the diagonal of a (4,4) array: <add> >>> di = diag_indices(4) <add> <add> >>> a = np.array([[1,2,3,4],[5,6,7,8],[9,10,11,12],[13,14,15,16]]) <add> >>> a <add> array([[ 1, 2, 3, 4], <add> [ 5, 6, 7, 8], <add> [ 9, 10, 11, 12], <add> [13, 14, 15, 16]]) <add> >>> a[di] = 100 <add> >>> a <add> array([[100, 2, 3, 4], <add> [ 5, 100, 7, 8], <add> [ 9, 10, 100, 12], <add> [ 13, 14, 15, 100]]) <add> <add> Now, we create indices to manipulate a 3-d array: <add> >>> d3 = diag_indices(2,3) <add> <add> And use it to set the diagonal of a zeros array to 1: <add> >>> a = zeros((2,2,2),int) <add> >>> a[d3] = 1 <add> >>> a <add> array([[[1, 0], <add> [0, 0]], <add> <add> [[0, 0], <add> [0, 1]]]) <add> <add> See also <add> -------- <add> - diag_indices_from: create the indices based on the shape of an existing <add> array. <add> """ <add> idx = arange(n) <add> return (idx,)*ndim <add> <add> <add>def diag_indices_from(arr): <add> """Return the indices to access the main diagonal of an n-dimensional array. <add> <add> See diag_indices() for full details. <add> <add> Parameters <add> ---------- <add> arr : array, at least 2-d <add> """ <add> <add> if not arr.ndim >= 2: <add> raise ValueError("input array must be at least 2-d") <add> # For more than d=2, the strided formula is only valid for arrays with <add> # all dimensions equal, so we check first. <add> if not alltrue(diff(a.shape)==0): <add> raise ValueError("All dimensions of input must be of equal length") <add> <add> return diag_indices(a.shape[0],a.ndim) <ide><path>numpy/lib/tests/test_index_tricks.py <ide> from numpy.testing import * <del>from numpy import array, ones, r_, mgrid, unravel_index, ndenumerate <add>from numpy import ( array, ones, r_, mgrid, unravel_index, zeros, where, <add> fill_diagonal, diag_indices, diag_indices_from ) <ide> <ide> class TestUnravelIndex(TestCase): <ide> def test_basic(self): <ide> def test_basic(self): <ide> assert_equal(list(ndenumerate(a)), <ide> [((0,0), 1), ((0,1), 2), ((1,0), 3), ((1,1), 4)]) <ide> <add> <add>def test_fill_diagonal(): <add> a = zeros((3, 3),int) <add> fill_diagonal(a, 5) <add> yield (assert_array_equal, a, <add> array([[5, 0, 0], <add> [0, 5, 0], <add> [0, 0, 5]])) <add> <add> # The same function can operate on a 4-d array: <add> a = zeros((3, 3, 3, 3), int) <add> fill_diagonal(a, 4) <add> i = array([0, 1, 2]) <add> yield (assert_equal, where(a != 0), (i, i, i, i)) <add> <add> <add>def test_diag_indices(): <add> di = diag_indices(4) <add> a = array([[1, 2, 3, 4], <add> [5, 6, 7, 8], <add> [9, 10, 11, 12], <add> [13, 14, 15, 16]]) <add> a[di] = 100 <add> yield (assert_array_equal, a, <add> array([[100, 2, 3, 4], <add> [ 5, 100, 7, 8], <add> [ 9, 10, 100, 12], <add> [ 13, 14, 15, 100]])) <add> <add> # Now, we create indices to manipulate a 3-d array: <add> d3 = diag_indices(2, 3) <add> <add> # And use it to set the diagonal of a zeros array to 1: <add> a = zeros((2, 2, 2),int) <add> a[d3] = 1 <add> yield (assert_array_equal, a, <add> array([[[1, 0], <add> [0, 0]], <add> <add> [[0, 0], <add> [0, 1]]]) ) <add> <add> <ide> if __name__ == "__main__": <ide> run_module_suite() <ide><path>numpy/lib/tests/test_twodim_base.py <ide> """ <ide> <ide> from numpy.testing import * <del>from numpy import arange, rot90, add, fliplr, flipud, zeros, ones, eye, \ <del> array, diag, histogram2d, tri <add> <add>from numpy import ( arange, rot90, add, fliplr, flipud, zeros, ones, eye, <add> array, diag, histogram2d, tri, mask_indices, triu_indices, <add> triu_indices_from, tril_indices, tril_indices_from ) <add> <ide> import numpy as np <ide> <ide> def get_mat(n): <ide> def test_diag2d(self): <ide> <ide> class TestDiag(TestCase): <ide> def test_vector(self): <del> vals = (100*arange(5)).astype('l') <del> b = zeros((5,5)) <add> vals = (100 * arange(5)).astype('l') <add> b = zeros((5, 5)) <ide> for k in range(5): <del> b[k,k] = vals[k] <del> assert_equal(diag(vals),b) <del> b = zeros((7,7)) <add> b[k, k] = vals[k] <add> assert_equal(diag(vals), b) <add> b = zeros((7, 7)) <ide> c = b.copy() <ide> for k in range(5): <del> b[k,k+2] = vals[k] <del> c[k+2,k] = vals[k] <del> assert_equal(diag(vals,k=2), b) <del> assert_equal(diag(vals,k=-2), c) <add> b[k, k + 2] = vals[k] <add> c[k + 2, k] = vals[k] <add> assert_equal(diag(vals, k=2), b) <add> assert_equal(diag(vals, k=-2), c) <ide> <ide> def test_matrix(self): <del> vals = (100*get_mat(5)+1).astype('l') <add> vals = (100 * get_mat(5) + 1).astype('l') <ide> b = zeros((5,)) <ide> for k in range(5): <ide> b[k] = vals[k,k] <del> assert_equal(diag(vals),b) <del> b = b*0 <add> assert_equal(diag(vals), b) <add> b = b * 0 <ide> for k in range(3): <del> b[k] = vals[k,k+2] <del> assert_equal(diag(vals,2),b[:3]) <add> b[k] = vals[k, k + 2] <add> assert_equal(diag(vals, 2), b[:3]) <ide> for k in range(3): <del> b[k] = vals[k+2,k] <del> assert_equal(diag(vals,-2),b[:3]) <add> b[k] = vals[k + 2, k] <add> assert_equal(diag(vals, -2), b[:3]) <ide> <ide> class TestFliplr(TestCase): <ide> def test_basic(self): <ide> def test_dtype(self): <ide> assert_array_equal(tri(3,dtype=bool),out.astype(bool)) <ide> <ide> <add>def test_mask_indices(): <add> # simple test without offset <add> iu = mask_indices(3, np.triu) <add> a = np.arange(9).reshape(3, 3) <add> yield (assert_array_equal, a[iu], array([0, 1, 2, 4, 5, 8])) <add> # Now with an offset <add> iu1 = mask_indices(3, np.triu, 1) <add> yield (assert_array_equal, a[iu1], array([1, 2, 5])) <add> <add> <add>def test_tril_indices(): <add> # indices without and with offset <add> il1 = tril_indices(4) <add> il2 = tril_indices(4, 2) <add> <add> a = np.array([[1, 2, 3, 4], <add> [5, 6, 7, 8], <add> [9, 10, 11, 12], <add> [13, 14, 15, 16]]) <add> <add> # indexing: <add> yield (assert_array_equal, a[il1], <add> array([ 1, 5, 6, 9, 10, 11, 13, 14, 15, 16]) ) <add> <add> # And for assigning values: <add> a[il1] = -1 <add> yield (assert_array_equal, a, <add> array([[-1, 2, 3, 4], <add> [-1, -1, 7, 8], <add> [-1, -1, -1, 12], <add> [-1, -1, -1, -1]]) ) <add> <add> # These cover almost the whole array (two diagonals right of the main one): <add> a[il2] = -10 <add> yield (assert_array_equal, a, <add> array([[-10, -10, -10, 4], <add> [-10, -10, -10, -10], <add> [-10, -10, -10, -10], <add> [-10, -10, -10, -10]]) ) <add> <add> <add>def test_triu_indices(): <add> iu1 = triu_indices(4) <add> iu2 = triu_indices(4, 2) <add> <add> a = np.array([[1, 2, 3, 4], <add> [5, 6, 7, 8], <add> [9, 10, 11, 12], <add> [13, 14, 15, 16]]) <add> <add> # Both for indexing: <add> yield (assert_array_equal, a[iu1], <add> array([ 1, 5, 6, 9, 10, 11, 13, 14, 15, 16]) ) <add> <add> # And for assigning values: <add> a[iu1] = -1 <add> yield (assert_array_equal, a, <add> array([[-1, -1, -1, -1], <add> [ 5, -1, -1, -1], <add> [ 9, 10, -1, -1], <add> [13, 14, 15, -1]]) ) <add> <add> # These cover almost the whole array (two diagonals right of the main one): <add> a[iu2] = -10 <add> yield ( assert_array_equal, a, <add> array([[ -1, -1, -10, -10], <add> [ 5, -1, -1, -10], <add> [ 9, 10, -1, -1], <add> [ 13, 14, 15, -1]]) ) <add> <add> <ide> if __name__ == "__main__": <ide> run_module_suite() <ide><path>numpy/lib/twodim_base.py <ide> """ <ide> <ide> __all__ = ['diag','diagflat','eye','fliplr','flipud','rot90','tri','triu', <del> 'tril','vander','histogram2d'] <add> 'tril','vander','histogram2d','mask_indices', <add> 'tril_indices','tril_indices_from','triu_indices','triu_indices_from', <add> ] <ide> <ide> from numpy.core.numeric import asanyarray, equal, subtract, arange, \ <del> zeros, greater_equal, multiply, ones, asarray <add> zeros, greater_equal, multiply, ones, asarray, alltrue, where <ide> <ide> def fliplr(m): <ide> """ <ide> def histogram2d(x,y, bins=10, range=None, normed=False, weights=None): <ide> bins = [xedges, yedges] <ide> hist, edges = histogramdd([x,y], bins, range, normed, weights) <ide> return hist, edges[0], edges[1] <add> <add> <add>def mask_indices(n,mask_func,k=0): <add> """Return the indices to access (n,n) arrays, given a masking function. <add> <add> Assume mask_func() is a function that, for a square array a of size (n,n) <add> with a possible offset argument k, when called as mask_func(a,k) returns a <add> new array with zeros in certain locations (functions like triu() or tril() <add> do precisely this). Then this function returns the indices where the <add> non-zero values would be located. <add> <add> Parameters <add> ---------- <add> n : int <add> The returned indices will be valid to access arrays of shape (n,n). <add> <add> mask_func : callable <add> A function whose api is similar to that of numpy.tri{u,l}. That is, <add> mask_func(x,k) returns a boolean array, shaped like x. k is an optional <add> argument to the function. <add> <add> k : scalar <add> An optional argument which is passed through to mask_func(). Functions <add> like tri{u,l} take a second argument that is interpreted as an offset. <add> <add> Returns <add> ------- <add> indices : an n-tuple of index arrays. <add> The indices corresponding to the locations where mask_func(ones((n,n)),k) <add> is True. <add> <add> Examples <add> -------- <add> These are the indices that would allow you to access the upper triangular <add> part of any 3x3 array: <add> >>> iu = mask_indices(3,np.triu) <add> <add> For example, if `a` is a 3x3 array: <add> >>> a = np.arange(9).reshape(3,3) <add> >>> a <add> array([[0, 1, 2], <add> [3, 4, 5], <add> [6, 7, 8]]) <add> <add> Then: <add> >>> a[iu] <add> array([0, 1, 2, 4, 5, 8]) <add> <add> An offset can be passed also to the masking function. This gets us the <add> indices starting on the first diagonal right of the main one: <add> >>> iu1 = mask_indices(3,np.triu,1) <add> <add> with which we now extract only three elements: <add> >>> a[iu1] <add> array([1, 2, 5]) <add> """ <add> m = ones((n,n),int) <add> a = mask_func(m,k) <add> return where(a != 0) <add> <add> <add>def tril_indices(n,k=0): <add> """Return the indices for the lower-triangle of an (n,n) array. <add> <add> Parameters <add> ---------- <add> n : int <add> Sets the size of the arrays for which the returned indices will be valid. <add> <add> k : int, optional <add> Diagonal offset (see tril() for details). <add> <add> Examples <add> -------- <add> Commpute two different sets of indices to access 4x4 arrays, one for the <add> lower triangular part starting at the main diagonal, and one starting two <add> diagonals further right: <add> <add> >>> il1 = tril_indices(4) <add> >>> il2 = tril_indices(4,2) <add> <add> Here is how they can be used with a sample array: <add> >>> a = np.array([[1,2,3,4],[5,6,7,8],[9,10,11,12],[13,14,15,16]]) <add> >>> a <add> array([[ 1, 2, 3, 4], <add> [ 5, 6, 7, 8], <add> [ 9, 10, 11, 12], <add> [13, 14, 15, 16]]) <add> <add> Both for indexing: <add> >>> a[il1] <add> array([ 1, 5, 6, 9, 10, 11, 13, 14, 15, 16]) <add> <add> And for assigning values: <add> >>> a[il1] = -1 <add> >>> a <add> array([[-1, 2, 3, 4], <add> [-1, -1, 7, 8], <add> [-1, -1, -1, 12], <add> [-1, -1, -1, -1]]) <add> <add> These cover almost the whole array (two diagonals right of the main one): <add> >>> a[il2] = -10 <add> >>> a <add> array([[-10, -10, -10, 4], <add> [-10, -10, -10, -10], <add> [-10, -10, -10, -10], <add> [-10, -10, -10, -10]]) <add> <add> See also <add> -------- <add> - triu_indices : similar function, for upper-triangular. <add> - mask_indices : generic function accepting an arbitrary mask function. <add> """ <add> return mask_indices(n,tril,k) <add> <add> <add>def tril_indices_from(arr,k=0): <add> """Return the indices for the lower-triangle of an (n,n) array. <add> <add> See tril_indices() for full details. <add> <add> Parameters <add> ---------- <add> n : int <add> Sets the size of the arrays for which the returned indices will be valid. <add> <add> k : int, optional <add> Diagonal offset (see tril() for details). <add> <add> """ <add> if not arr.ndim==2 and arr.shape[0] == arr.shape[1]: <add> raise ValueError("input array must be 2-d and square") <add> return tril_indices(arr.shape[0],k) <add> <add> <add>def triu_indices(n,k=0): <add> """Return the indices for the upper-triangle of an (n,n) array. <add> <add> Parameters <add> ---------- <add> n : int <add> Sets the size of the arrays for which the returned indices will be valid. <add> <add> k : int, optional <add> Diagonal offset (see triu() for details). <add> <add> Examples <add> -------- <add> Commpute two different sets of indices to access 4x4 arrays, one for the <add> lower triangular part starting at the main diagonal, and one starting two <add> diagonals further right: <add> <add> >>> iu1 = triu_indices(4) <add> >>> iu2 = triu_indices(4,2) <add> <add> Here is how they can be used with a sample array: <add> >>> a = np.array([[1,2,3,4],[5,6,7,8],[9,10,11,12],[13,14,15,16]]) <add> >>> a <add> array([[ 1, 2, 3, 4], <add> [ 5, 6, 7, 8], <add> [ 9, 10, 11, 12], <add> [13, 14, 15, 16]]) <add> <add> Both for indexing: <add> >>> a[il1] <add> array([ 1, 5, 6, 9, 10, 11, 13, 14, 15, 16]) <add> <add> And for assigning values: <add> >>> a[iu] = -1 <add> >>> a <add> array([[-1, -1, -1, -1], <add> [ 5, -1, -1, -1], <add> [ 9, 10, -1, -1], <add> [13, 14, 15, -1]]) <add> <add> These cover almost the whole array (two diagonals right of the main one): <add> >>> a[iu2] = -10 <add> >>> a <add> array([[ -1, -1, -10, -10], <add> [ 5, -1, -1, -10], <add> [ 9, 10, -1, -1], <add> [ 13, 14, 15, -1]]) <add> <add> See also <add> -------- <add> - tril_indices : similar function, for lower-triangular. <add> - mask_indices : generic function accepting an arbitrary mask function. <add> """ <add> return mask_indices(n,triu,k) <add> <add> <add>def triu_indices_from(arr,k=0): <add> """Return the indices for the lower-triangle of an (n,n) array. <add> <add> See triu_indices() for full details. <add> <add> Parameters <add> ---------- <add> n : int <add> Sets the size of the arrays for which the returned indices will be valid. <add> <add> k : int, optional <add> Diagonal offset (see triu() for details). <add> <add> """ <add> if not arr.ndim==2 and arr.shape[0] == arr.shape[1]: <add> raise ValueError("input array must be 2-d and square") <add> return triu_indices(arr.shape[0],k) <add>
4
Javascript
Javascript
add comment about bug in yields
362e56a1c1d033b4dd5c289b98c2cf0b9fb921f7
<ide><path>src/renderers/shared/fiber/ReactFiber.js <ide> function createFiberFromElementType(type : mixed, key : null | string) { <ide> fiber.type = type; <ide> } else if (typeof type === 'object' && type !== null) { <ide> // Currently assumed to be a continuation and therefore is a fiber already. <add> // TODO: The yield system is currently broken for updates in some cases. <add> // The reified yield stores a fiber, but we don't know which fiber that is; <add> // the current or a workInProgress? When the continuation gets rendered here <add> // we don't know if we can reuse that fiber or if we need to clone it. <add> // There is probably a clever way to restructure this. <ide> fiber = type; <ide> } else { <ide> throw new Error('Unknown component type: ' + typeof type);
1
Text
Text
remove needless `break;` [ci skip]
7fc10468b6ee7891a83f50d5ccf2266c8baf23e0
<ide><path>guides/source/asset_pipeline.md <ide> location ~ ^/assets/ { <ide> add_header Cache-Control public; <ide> <ide> add_header ETag ""; <del> break; <ide> } <ide> ``` <ide>
1
Text
Text
fix a typo in contrib/man/md/docker.1.md
653328c6cef8bab89343587b134ba7676ee39867
<ide><path>contrib/man/md/docker.1.md <ide> port=[4243] or path =[/var/run/docker.sock] is omitted, default values are used. <ide> **-v**=*true*|*false* <ide> Print version information and quit. Default is false. <ide> <del>**--selinux-enabled=*true*|*false* <add>**--selinux-enabled**=*true*|*false* <ide> Enable selinux support. Default is false. <ide> <ide> # COMMANDS
1
Python
Python
fix bugs and add related tests
80daa5750a8e5ee6ffcbcad72b2b52540d0b502d
<ide><path>sorts/radix_sort.py <ide> def radix_sort(list_of_ints: List[int]) -> List[int]: <ide> True <ide> radix_sort(reversed(range(15))) == sorted(range(15)) <ide> True <add> radix_sort([1,100,10,1000]) == sorted([1,100,10,1000]) <add> True <ide> """ <ide> RADIX = 10 <ide> placement = 1 <ide> max_digit = max(list_of_ints) <del> while placement < max_digit: <add> while placement <= max_digit: <ide> # declare and initialize empty buckets <ide> buckets = [list() for _ in range(RADIX)] <ide> # split list_of_ints between the buckets
1
PHP
PHP
fix some docblock typo
118eca6482fc54c3cf615909ec43dc2f177d101d
<ide><path>src/Cache/Cache.php <ide> public static function read($key, $config = 'default') { <ide> * @param array $keys an array of keys to fetch from the cache <ide> * @param string $config optional name of the configuration to use. Defaults to 'default' <ide> * @return array An array containing, for each of the given $keys, the cached data or false if cached data could not be <del> * retreived <add> * retrieved. <ide> */ <ide> public static function readMany($keys, $config = 'default') { <ide> $engine = static::engine($config); <ide><path>src/Cache/Engine/MemcachedEngine.php <ide> public function read($key) { <ide> * <ide> * @param array $keys An array of identifiers for the data <ide> * @return An array containing, for each of the given $keys, the cached data or <del> * false if cached data could not be retreived. <add> * false if cached data could not be retrieved. <ide> */ <ide> public function readMany($keys) { <ide> $cacheKeys = array(); <ide><path>src/Collection/CollectionInterface.php <ide> public function max($callback, $type = SORT_NUMERIC); <ide> public function min($callback, $type = SORT_NUMERIC); <ide> <ide> /** <del> * Returns a sorted iterator out of the elements in this colletion, <add> * Returns a sorted iterator out of the elements in this collection, <ide> * ranked in ascending order by the results of running each value through a <ide> * callback. $callback can also be a string representing the column or property <ide> * name. <ide><path>src/Collection/Iterator/InsertIterator.php <ide> /** <ide> * This iterator will insert values into a property of each of the records returned. <ide> * The values to be inserted come out of another traversal object. This is useful <del> * when you have two separate collections and want to merge them toghether by placing <add> * when you have two separate collections and want to merge them together by placing <ide> * each of the values from one collection into a property inside the other collection. <ide> */ <ide> class InsertIterator extends Collection { <ide> class InsertIterator extends Collection { <ide> protected $_values; <ide> <ide> /** <del> * Holds whether the values colelction is still valid. (has more records) <add> * Holds whether the values collection is still valid. (has more records) <ide> * <ide> * @var bool <ide> */ <ide><path>src/Console/ShellDispatcher.php <ide> protected function _shellExists($shell) { <ide> /** <ide> * Create the given shell name, and set the plugin property <ide> * <del> * @param string $className The class name to instanciate <add> * @param string $className The class name to instantiate <ide> * @param string $shortName The plugin-prefixed shell name <ide> * @return \Cake\Console\Shell A shell instance. <ide> */ <ide><path>src/Controller/Controller.php <ide> public function paginate($object = null) { <ide> * and allows all public methods on all subclasses of this class. <ide> * <ide> * @param string $action The action to check. <del> * @return bool Whether or not the method is accesible from a URL. <add> * @return bool Whether or not the method is accessible from a URL. <ide> */ <ide> public function isAction($action) { <ide> try { <ide><path>src/Core/StaticConfigTrait.php <ide> trait StaticConfigTrait { <ide> protected static $_config = []; <ide> <ide> /** <del> * This method can be used to define confguration adapters for an application <add> * This method can be used to define configuration adapters for an application <ide> * or read existing configuration. <ide> * <ide> * To change an adapter's configuration at runtime, first drop the adapter and then <ide> public static function config($key, $config = null) { <ide> * If the implementing objects supports a `$_registry` object the named configuration <ide> * will also be unloaded from the registry. <ide> * <del> * @param string $config An existing configuation you wish to remove. <add> * @param string $config An existing configuration you wish to remove. <ide> * @return bool success of the removal, returns false when the config does not exist. <ide> */ <ide> public static function drop($config) { <ide><path>src/Database/Connection.php <ide> public function compileQuery(Query $query, ValueBinder $generator) { <ide> } <ide> <ide> /** <del> * Executes the provided query after compiling it for the specific dirver <add> * Executes the provided query after compiling it for the specific driver <ide> * dialect and returns the executed Statement object. <ide> * <ide> * @param \Cake\Database\Query $query The query to be executed <ide> public function logQueries($enable = null) { <ide> } <ide> <ide> /** <del> * Enables or disables metadata caching for this connectino <add> * Enables or disables metadata caching for this connection <ide> * <ide> * Changing this setting will not modify existing schema collections objects. <ide> * <ide><path>src/Database/Driver.php <ide> public function autoQuoting($enable = null) { <ide> * <ide> * @param \Cake\Database\Query $query The query to compile. <ide> * @param \Cake\Database\ValueBinder $generator The value binder to use. <del> * @return array containing 2 entries. The first enty is the transformed query <del> * and the secod one the compiled SQL <add> * @return array containing 2 entries. The first entity is the transformed query <add> * and the second one the compiled SQL <ide> */ <ide> public function compileQuery(Query $query, ValueBinder $generator) { <ide> $processor = $this->newCompiler(); <ide><path>src/Database/Driver/PDODriverTrait.php <ide> trait PDODriverTrait { <ide> protected $_connection; <ide> <ide> /** <del> * Establishes a connection to the databse server <add> * Establishes a connection to the database server <ide> * <ide> * @param array $config configuration to be used for creating connection <ide> * @return bool true on success <ide> protected function _connect(array $config) { <ide> <ide> /** <ide> * Returns correct connection resource or object that is internally used <del> * If first argument is passed, it will set internal conenction object or <add> * If first argument is passed, it will set internal connection object or <ide> * result to the value passed <ide> * <ide> * @param null|\PDO $connection The PDO connection instance. <ide><path>src/Database/Driver/Postgres.php <ide> class Postgres extends \Cake\Database\Driver { <ide> ]; <ide> <ide> /** <del> * Establishes a connection to the databse server <add> * Establishes a connection to the database server <ide> * <ide> * @return bool true on success <ide> */ <ide><path>src/Database/Driver/Sqlite.php <ide> class Sqlite extends \Cake\Database\Driver { <ide> ]; <ide> <ide> /** <del> * Establishes a connection to the databse server <add> * Establishes a connection to the database server <ide> * <ide> * @return bool true on success <ide> */ <ide><path>src/Database/Expression/CaseExpression.php <ide> public function __construct($conditions = [], $values = [], $types = []) { <ide> * The trueValues must be a similar structure, but may contain a string value. <ide> * <ide> * @param array|ExpressionInterface $conditions Must be a ExpressionInterface instance, or an array of ExpressionInterface instances. <del> * @param array|ExpressionInterface $values associtative array of values of each condition <add> * @param array|ExpressionInterface $values associative array of values of each condition <ide> * @param array $types associative array of types to be associated with the values <ide> * <ide> * @return $this <ide> public function add($conditions = [], $values = [], $types = []) { <ide> * If no matching true value, then it is defaulted to '1'. <ide> * <ide> * @param array|ExpressionInterface $conditions Must be a ExpressionInterface instance, or an array of ExpressionInterface instances. <del> * @param array|ExpressionInterface $values associtative array of values of each condition <add> * @param array|ExpressionInterface $values associative array of values of each condition <ide> * @param array $types associative array of types to be associated with the values <ide> * <ide> * @return void <ide><path>src/Database/Expression/Comparison.php <ide> protected function _stringExpression($generator) { <ide> $type = str_replace('[]', '', $this->_type); <ide> $value = $this->_flattenValue($this->_value, $generator, $type); <ide> <del> // To avoid SQL erros when comparing a field to a list of empty values, <add> // To avoid SQL errors when comparing a field to a list of empty values, <ide> // generate a condition that will always evaluate to false <ide> if ($value === '') { <ide> return ['1 != 1', '']; <ide><path>src/Database/Expression/FunctionExpression.php <ide> public function name($name = null) { <ide> * If associative the key would be used as argument when value is 'literal' <ide> * @param array $types associative array of types to be associated with the <ide> * passed arguments <del> * @param bool $prepend Whehter to prepend or append to the list of arguments <add> * @param bool $prepend Whether to prepend or append to the list of arguments <ide> * @see FunctionExpression::__construct() for more details. <ide> * @return FunctionExpression <ide> */ <ide><path>src/Database/Expression/QueryExpression.php <ide> public function lte($field, $value, $type = null) { <ide> /** <ide> * Adds a new condition to the expression object in the form "field IS NULL". <ide> * <del> * @param string|\Cake\Database\ExpressionInteface $field database field to be <add> * @param string|\Cake\Database\ExpressionInterface $field database field to be <ide> * tested for null <ide> * @return QueryExpression <ide> */ <ide> public function isNull($field) { <ide> /** <ide> * Adds a new condition to the expression object in the form "field IS NOT NULL". <ide> * <del> * @param string|\Cake\Database\ExpressionInteface $field database field to be <add> * @param string|\Cake\Database\ExpressionInterface $field database field to be <ide> * tested for not null <ide> * @return QueryExpression <ide> */ <ide> public function notIn($field, $values, $type = null) { <ide> <ide> // @codingStandardsIgnoreStart <ide> /** <del> * Returns a new QueryExpresion object containing all the conditions passed <add> * Returns a new QueryExpression object containing all the conditions passed <ide> * and set up the conjunction to be "AND" <ide> * <ide> * @param string|array|QueryExpression $conditions to be joined with AND <ide> public function and_($conditions, $types = []) { <ide> } <ide> <ide> /** <del> * Returns a new QueryExpresion object containing all the conditions passed <add> * Returns a new QueryExpression object containing all the conditions passed <ide> * and set up the conjunction to be "OR" <ide> * <ide> * @param string|array|QueryExpression $conditions to be joined with OR <ide><path>src/Database/Expression/TupleComparison.php <ide> protected function _bindValue($generator, $value, $type) { <ide> * Traverses the tree of expressions stored in this object, visiting first <ide> * expressions in the left hand side and then the rest. <ide> * <del> * Callback function receives as its only argument an instance of an ExpressoinInterface <add> * Callback function receives as its only argument an instance of an ExpressionInterface <ide> * <ide> * @param callable $callable The callable to apply to sub-expressions <ide> * @return void <ide><path>src/Database/QueryCompiler.php <ide> class QueryCompiler { <ide> ]; <ide> <ide> /** <del> * The list of query clauses to traverse for generating a SELECT statment <add> * The list of query clauses to traverse for generating a SELECT statement <ide> * <ide> * @var array <ide> */ <ide> class QueryCompiler { <ide> ]; <ide> <ide> /** <del> * The list of query clauses to traverse for generating an UPDATE statment <add> * The list of query clauses to traverse for generating an UPDATE statement <ide> * <ide> * @var array <ide> */ <ide> protected $_updateParts = ['update', 'set', 'where', 'epilog']; <ide> <ide> /** <del> * The list of query clauses to traverse for generating a DELETE statment <add> * The list of query clauses to traverse for generating a DELETE statement <ide> * <ide> * @var array <ide> */ <ide> protected $_deleteParts = ['delete', 'from', 'where', 'epilog']; <ide> <ide> /** <del> * The list of query clauses to traverse for generating an INSERT statment <add> * The list of query clauses to traverse for generating an INSERT statement <ide> * <ide> * @var array <ide> */ <ide><path>src/Database/Schema/CachedCollection.php <ide> public function cacheKey($name) { <ide> <ide> /** <ide> * Sets the cache config name to use for caching table metadata, or <del> * disabels it if false is passed. <add> * disables it if false is passed. <ide> * If called with no arguments it returns the current configuration name. <ide> * <ide> * @param bool $enable whether or not to enable caching <ide><path>src/Database/Schema/Table.php <ide> public function primaryKey() { <ide> * Add a constraint. <ide> * <ide> * Used to add constraints to a table. For example primary keys, unique <del> * keys and foriegn keys. <add> * keys and foreign keys. <ide> * <ide> * ### Attributes <ide> * <ide> public function constraint($name) { <ide> * For example the engine type in MySQL. <ide> * <ide> * @param array|null $options The options to set, or null to read options. <del> * @return this|array Either the table instance, or an array of options when reading. <add> * @return $this|array Either the table instance, or an array of options when reading. <ide> */ <ide> public function options($options = null) { <ide> if ($options === null) { <ide> public function options($options = null) { <ide> * Get/Set whether the table is temporary in the database <ide> * <ide> * @param bool|null $set whether or not the table is to be temporary <del> * @return this|bool Either the table instance, the current temporary setting <add> * @return $this|bool Either the table instance, the current temporary setting <ide> */ <ide> public function temporary($set = null) { <ide> if ($set === null) { <ide><path>src/Database/Statement/CallbackStatement.php <ide> public function __construct($statement, $driver, $callback) { <ide> /** <ide> * Fetch a row from the statement. <ide> * <del> * The result will be procssed by the callback when it is not `false. <add> * The result will be processed by the callback when it is not `false. <ide> * <ide> * @param string $type Either 'num' or 'assoc' to indicate the result format you would like. <ide> * @return mixed <ide> public function fetch($type = 'num') { <ide> /** <ide> * Fetch all rows from the statement. <ide> * <del> * Each row in the result will be procssed by the callback when it is not `false. <add> * Each row in the result will be processed by the callback when it is not `false. <ide> * <ide> * @param string $type Either 'num' or 'assoc' to indicate the result format you would like. <ide> * @return mixed <ide><path>src/Database/TypeMapTrait.php <ide> trait TypeMapTrait { <ide> * or exchanges it for the given one. <ide> * <ide> * @param array|TypeMap $typeMap Creates a TypeMap if array, otherwise sets the given TypeMap <del> * @return this|TypeMap <add> * @return $this|TypeMap <ide> */ <ide> public function typeMap($typeMap = null) { <ide> if (!$this->_typeMap) { <ide> public function typeMap($typeMap = null) { <ide> * Allows setting default types when chaining query <ide> * <ide> * @param array $types The array of types to set. <del> * @return this|array <add> * @return $this|array <ide> */ <ide> public function defaultTypes(array $types = null) { <ide> if ($types === null) { <ide><path>src/Datasource/QueryTrait.php <ide> public function eagerLoaded($value = null) { <ide> * Will return either the results set through setResult(), or execute this query <ide> * and return the ResultSetDecorator object ready for streaming of results. <ide> * <del> * ResultSetDecorator is a travesable object that implements the methods found <add> * ResultSetDecorator is a traversable object that implements the methods found <ide> * on Cake\Collection\Collection. <ide> * <ide> * @return \Cake\Datasource\ResultSetInterface <ide><path>src/Event/EventManager.php <ide> public function attach($callable, $eventKey = null, array $options = array()) { <ide> * Auxiliary function to attach all implemented callbacks of a Cake\Event\EventListener class instance <ide> * as individual methods on this manager <ide> * <del> * @param \Cake\Event\EventListener $subscriber Event listerner. <add> * @param \Cake\Event\EventListener $subscriber Event listener. <ide> * @return void <ide> */ <ide> protected function _attachSubscriber(EventListener $subscriber) { <ide><path>src/I18n/I18n.php <ide> class I18n { <ide> /** <ide> * The translators collection <ide> * <del> * @var \Aura\Int\TranslatorLocator <add> * @var \Aura\Intl\TranslatorLocator <ide> */ <ide> protected static $_collection; <ide> <ide><path>src/I18n/Number.php <ide> public static function toPercentage($value, $precision = 2, array $options = arr <ide> * <ide> * Options: <ide> * <del> * - `places` - Minimim number or decimals to use, e.g 0 <add> * - `places` - Minimum number or decimals to use, e.g 0 <ide> * - `precision` - Maximum Number of decimal places to use, e.g. 2 <ide> * - `pattern` - An ICU number pattern to use for formatting the number. e.g #,###.00 <ide> * - `locale` - The locale name to use for formatting the number, e.g. fr_FR <ide> public static function format($value, array $options = []) { <ide> * <ide> * ### Options <ide> * <del> * - `places` - Minimim number or decimals to use, e.g 0 <add> * - `places` - Minimum number or decimals to use, e.g 0 <ide> * - `precision` - Maximum Number of decimal places to use, e.g. 2 <ide> * - `locale` - The locale name to use for formatting the number, e.g. fr_FR <ide> * - `before` - The string to place before whole numbers, e.g. '[' <ide> public static function defaultCurrency($currency = null) { <ide> * The options array accepts the following keys: <ide> * <ide> * - `locale` - The locale name to use for formatting the number, e.g. fr_FR <del> * - `type` - The formatter type to construct, set it to `curency` if you need to format <add> * - `type` - The formatter type to construct, set it to `currency` if you need to format <ide> * numbers representing money. <ide> * - `places` - Number of decimal places to use. e.g. 2 <ide> * - `precision` - Maximum Number of decimal places to use, e.g. 2 <ide><path>src/I18n/Parser/MoFileParser.php <ide> class MoFileParser { <ide> * <ide> * @param resource $resource The file to be parsed. <ide> * <del> * @return array List of messages extrated from the file <add> * @return array List of messages extracted from the file <ide> * @throws \RuntimeException If stream content has an invalid format. <ide> */ <ide> public function parse($resource) { <ide> public function parse($resource) { <ide> * Reads an unsigned long from stream respecting endianess. <ide> * <ide> * @param resource $stream The File being read. <del> * @param bool $isBigEndian Whether or not the current platfomr is Big Endian <add> * @param bool $isBigEndian Whether or not the current platformer is Big Endian <ide> * @return int <ide> */ <ide> protected function _readLong($stream, $isBigEndian) { <ide><path>src/I18n/Time.php <ide> public function __toString() { <ide> /** <ide> * Get list of timezone identifiers <ide> * <del> * @param int|string $filter A regex to filter identifer <add> * @param int|string $filter A regex to filter identifier <ide> * Or one of DateTimeZone class constants <ide> * @param string $country A two-letter ISO 3166-1 compatible country code. <ide> * This option is only used when $filter is set to DateTimeZone::PER_COUNTRY <ide><path>src/I18n/TranslatorRegistry.php <ide> class TranslatorRegistry extends TranslatorLocator { <ide> * @param string $locale The locale to use; if empty, uses the default <ide> * locale. <ide> * @return \Aura\Intl\TranslatorInterface A translator object. <del> * @throws \Aura\Intl\Exception If no translattor with that name could be found <add> * @throws \Aura\Intl\Exception If no translator with that name could be found <ide> * for the given locale. <ide> */ <ide> public function get($name, $locale = null) { <ide><path>src/Log/Engine/FileLog.php <ide> class FileLog extends BaseLog { <ide> * - `size` Used to implement basic log file rotation. If log file size <ide> * reaches specified size the existing file is renamed by appending timestamp <ide> * to filename and new log file is created. Can be integer bytes value or <del> * human reabable string values like '10MB', '100KB' etc. <add> * human readable string values like '10MB', '100KB' etc. <ide> * - `rotate` Log files are rotated specified times before being removed. <ide> * If value is 0, old versions are removed rather then rotated. <ide> * - `mask` A mask is applied when log files are created. Left empty no chmod <ide><path>src/Model/Behavior/TreeBehavior.php <ide> function ($field) use ($alias) { <ide> * the primary key for the table and the values are the display field for the table. <ide> * Values are prefixed to visually indicate relative depth in the tree. <ide> * <del> * Avaliable options are: <add> * Available options are: <ide> * <ide> * - keyPath: A dot separated path to fetch the field to use for the array key, or a closure to <ide> * return the key out of the provided row. <ide> protected function _getNode($id) { <ide> } <ide> <ide> /** <del> * Recovers the lft and right column values out of the hirearchy defined by the <add> * Recovers the lft and right column values out of the hierarchy defined by the <ide> * parent column. <ide> * <ide> * @return void <ide><path>src/Network/Email/SmtpTransport.php <ide> public function send(Email $email) { <ide> } <ide> <ide> /** <del> * Parses and stores the reponse lines in `'code' => 'message'` format. <add> * Parses and stores the response lines in `'code' => 'message'` format. <ide> * <ide> * @param array $responseLines Response lines to parse. <ide> * @return void <ide><path>src/Network/Http/Adapter/Stream.php <ide> public function send(Request $request, array $options) { <ide> * Create the response list based on the headers & content <ide> * <ide> * Creates one or many response objects based on the number <del> * of redirects that occured. <add> * of redirects that occurred. <ide> * <ide> * @param array $headers The list of headers from the request(s) <ide> * @param string $content The response content. <ide><path>src/Network/Http/Client.php <ide> * <ide> * ### Scoped clients <ide> * <del> * If you're doing multiple requests to the same hostname its often convienent <add> * If you're doing multiple requests to the same hostname its often convenient <ide> * to use the constructor arguments to create a scoped client. This allows you <ide> * to keep your code DRY and not repeat hostnames, authentication, and other options. <ide> * <ide> protected function _addProxy(Request $request, $options) { <ide> * @param array $auth The authentication options to use. <ide> * @param array $options The overall request options to use. <ide> * @return mixed Authentication strategy instance. <del> * @throws \Cake\Core\Exception\Exception when an invalid stratgey is chosen. <add> * @throws \Cake\Core\Exception\Exception when an invalid strategy is chosen. <ide> */ <ide> protected function _createAuth($auth, $options) { <ide> if (empty($auth['type'])) { <ide><path>src/Network/Http/FormData/Part.php <ide> public function contentId($id = null) { <ide> /** <ide> * Get/set the filename. <ide> * <del> * Setting the filname to `false` will exclude it from the <add> * Setting the filename to `false` will exclude it from the <ide> * generated output. <ide> * <ide> * @param null|string $filename Use null to get/string to set. <ide><path>src/Network/Http/Response.php <ide> * <ide> * ### Get header values <ide> * <del> * Header names are case-insensitve, but normalized to Title-Case <add> * Header names are case-insensitive, but normalized to Title-Case <ide> * when the response is parsed. <ide> * <ide> * `$val = $response->header('content-type');` <ide><path>src/Network/Response.php <ide> public function vary($cacheVariances = null) { <ide> * makes it unique. <ide> * <ide> * Second parameter is used to instruct clients that the content has <del> * changed, but sematicallly, it can be used as the same thing. Think <add> * changed, but semantically, it can be used as the same thing. Think <ide> * for instance of a page with a hit counter, two different page views <ide> * are equivalent, but they differ by a few bytes. This leaves off to <ide> * the Client the decision of using or not the cached page. <ide><path>src/Network/Session.php <ide> class Session { <ide> <ide> /** <del> * The Session handler instace used as an engine for persisting the session data. <add> * The Session handler instance used as an engine for persisting the session data. <ide> * <ide> * @var SessionHandlerInterface <ide> */ <ide> class Session { <ide> protected $_lifetime; <ide> <ide> /** <del> * Whehter this session is running under a CLI environment <add> * Whether this session is running under a CLI environment <ide> * <ide> * @var bool <ide> */ <ide><path>src/ORM/Association.php <ide> public function strategy($name = null) { <ide> <ide> /** <ide> * Sets the default finder to use for fetching rows from the target table. <del> * If no parameters are passed, it will reeturn the currently configured <add> * If no parameters are passed, it will return the currently configured <ide> * finder name. <ide> * <ide> * @param string $finder the finder name to use <ide><path>src/ORM/Association/SelectableAssociationTrait.php <ide> protected function _addFilteringCondition($query, $key, $filter) { <ide> } <ide> <ide> /** <del> * Returns a TupleComparison object that can be used for mathching all the fields <add> * Returns a TupleComparison object that can be used for matching all the fields <ide> * from $keys with the tuple values in $filter using the provided operator. <ide> * <ide> * @param \Cake\ORM\Query $query Target table's query <ide><path>src/ORM/Marshaller.php <ide> protected function _buildPropertyMap($options) { <ide> * ### Options: <ide> * <ide> * * associated: Associations listed here will be marshalled as well. <del> * * fiedlList: A whitelist of fields to be assigned to the entity. If not present, <add> * * fieldList: A whitelist of fields to be assigned to the entity. If not present, <ide> * the accessible fields list in the entity will be used. <ide> * * accessibleFields: A list of fields to allow or deny in entity accessible fields. <ide> * <ide> protected function _marshalAssociation($assoc, $value, $options) { <ide> * ### Options: <ide> * <ide> * * associated: Associations listed here will be marshalled as well. <del> * * fiedlList: A whitelist of fields to be assigned to the entity. If not present, <add> * * fieldList: A whitelist of fields to be assigned to the entity. If not present, <ide> * the accessible fields list in the entity will be used. <ide> * <ide> * @param array $data The data to hydrate. <ide> protected function _loadBelongsToMany($assoc, $ids) { <ide> * ### Options: <ide> * <ide> * * associated: Associations listed here will be marshalled as well. <del> * * fiedlList: A whitelist of fields to be assigned to the entity. If not present <add> * * fieldList: A whitelist of fields to be assigned to the entity. If not present <ide> * the accessible fields list in the entity will be used. <ide> * <ide> * @param \Cake\Datasource\EntityInterface $entity the entity that will get the <ide> public function merge(EntityInterface $entity, array $data, array $options = []) <ide> * ### Options: <ide> * <ide> * * associated: Associations listed here will be marshalled as well. <del> * * fiedlList: A whitelist of fields to be assigned to the entity. If not present, <add> * * fieldList: A whitelist of fields to be assigned to the entity. If not present, <ide> * the accessible fields list in the entity will be used. <ide> * <ide> * @param array|\Traversable $entities the entities that will get the <ide><path>src/ORM/Query.php <ide> class Query extends DatabaseQuery implements JsonSerializable { <ide> protected $_eagerLoader; <ide> <ide> /** <del> * Constuctor <add> * Constructor <ide> * <ide> * @param \Cake\Database\Connection $connection The connection object <ide> * @param \Cake\ORM\Table $table The table this query is starting on <ide> public function aliasField($field, $alias = null) { <ide> } <ide> <ide> /** <del> * Runs `aliasfield()` for each field in the provided list and returns <add> * Runs `aliasField()` for each field in the provided list and returns <ide> * the result under a single array. <ide> * <ide> * @param array $fields The fields to alias <ide> public function counter($counter) { <ide> } <ide> <ide> /** <del> * Toggle hydrating entites. <add> * Toggle hydrating entities. <ide> * <ide> * If set to false array results will be returned <ide> * <ide><path>src/Routing/Filter/LocaleSelectorFilter.php <ide> public function __construct($config = []) { <ide> } <ide> <ide> /** <del> * Inspects the request for the Accept-Langauge header and sets the default <add> * Inspects the request for the Accept-Language header and sets the default <ide> * Locale for the current runtime if it matches the list of valid locales <ide> * as passed in the configuration. <ide> * <ide><path>src/Routing/RequestActionTrait.php <ide> trait RequestActionTrait { <ide> * <ide> * ### Passing other request data <ide> * <del> * You can pass POST, GET, COOKIE and other data into the request using the apporpriate keys. <add> * You can pass POST, GET, COOKIE and other data into the request using the appropriate keys. <ide> * Cookies can be passed using the `cookies` key. Get parameters can be set with `query` and post <ide> * data can be sent using the `post` key. <ide> * <ide><path>src/Routing/Route/InflectedRoute.php <ide> class InflectedRoute extends Route { <ide> protected $_inflectedDefaults = false; <ide> <ide> /** <del> * Parses a string URL into an array. If it mathes, it will convert the prefix, controller and <add> * Parses a string URL into an array. If it matches, it will convert the prefix, controller and <ide> * plugin keys to their camelized form <ide> * <ide> * @param string $url The URL to parse <ide><path>src/TestSuite/Fixture/FixtureInjector.php <ide> class FixtureInjector implements PHPUnit_Framework_TestListener { <ide> protected $_fixtureManager; <ide> <ide> /** <del> * Holds a reference to the conainer test suite <add> * Holds a reference to the container test suite <ide> * <ide> * @var \PHPUnit_Framework_TestSuite <ide> */ <ide><path>src/TestSuite/Fixture/FixtureManager.php <ide> public function loaded() { <ide> } <ide> <ide> /** <del> * Add aliaes for all non test prefixed connections. <add> * Add aliases for all non test prefixed connections. <ide> * <ide> * This allows models to use the test connections without <ide> * a pile of configuration work. <ide><path>src/TestSuite/TestCase.php <ide> protected function _normalizePath($path) { <ide> * @param float $expected <ide> * @param float $margin the rage of acceptation <ide> * @param string $message the text to display if the assertion is not correct <del> * @deprecated 3.0.0 This is a compatiblity wrapper for 1.x. It will be removed in 3.0 <add> * @deprecated 3.0.0 This is a compatibility wrapper for 1.x. It will be removed in 3.0 <ide> * @return void <ide> */ <ide> protected static function assertWithinMargin($result, $expected, $margin, $message = '') { <ide><path>src/TestSuite/TestSuite.php <ide> class TestSuite extends \PHPUnit_Framework_TestSuite { <ide> <ide> /** <del> * Adds all the files in a directory to the test suite. Does not recurse through directories. <add> * Adds all the files in a directory to the test suite. Does not recursive through directories. <ide> * <ide> * @param string $directory The directory to add tests from. <ide> * @return void <ide><path>src/View/Form/ArrayContext.php <ide> * the inferred type for fields and allows auto generation of attributes <ide> * like maxlength, step and other HTML attributes. If you want <ide> * primary key/id detection to work. Make sure you have provided a `_constraints` <del> * array that contains `primary`. See below for an exmaple. <add> * array that contains `primary`. See below for an example. <ide> * - `errors` An array of validation errors. Errors should be nested following <ide> * the dot separated paths you access your fields with. <ide> * <ide><path>src/View/Helper/FlashHelper.php <ide> /** <ide> * FlashHelper class to render flash messages. <ide> * <del> * After setting messsages in your controllers with FlashComponent, you can use <add> * After setting messages in your controllers with FlashComponent, you can use <ide> * this class to output your flash messages in your views. <ide> */ <ide> class FlashHelper extends Helper { <ide><path>src/View/Helper/NumberHelper.php <ide> public function toPercentage($number, $precision = 2, array $options = array()) <ide> * <ide> * Options: <ide> * <del> * - `places` - Minimim number or decimals to use, e.g 0 <add> * - `places` - Minimum number or decimals to use, e.g 0 <ide> * - `precision` - Maximum Number of decimal places to use, e.g. 2 <ide> * - `locale` - The locale name to use for formatting the number, e.g. fr_FR <ide> * - `before` - The string to place before whole numbers, e.g. '[' <ide> public function currency($number, $currency = null, array $options = array()) { <ide> * <ide> * ### Options <ide> * <del> * - `places` - Minimim number or decimals to use, e.g 0 <add> * - `places` - Minimum number or decimals to use, e.g 0 <ide> * - `precision` - Maximum Number of decimal places to use, e.g. 2 <ide> * - `locale` - The locale name to use for formatting the number, e.g. fr_FR <ide> * - `before` - The string to place before whole numbers, e.g. '[' <ide><path>src/View/Helper/PaginatorHelper.php <ide> class PaginatorHelper extends Helper { <ide> public $helpers = ['Url', 'Number']; <ide> <ide> /** <del> * Defualt config for this class <add> * Default config for this class <ide> * <ide> * Options: Holds the default options for pagination links <ide> * <ide><path>src/View/JsonView.php <ide> * views to provide layout-like functionality. <ide> * <ide> * You can also enable JSONP support by setting parameter `_jsonp` to true or a string to specify <del> * custom query string paramater name which will contain the callback function name. <add> * custom query string parameter name which will contain the callback function name. <ide> */ <ide> class JsonView extends View { <ide> <ide><path>src/View/Widget/DateTime.php <ide> public function __construct(StringTemplate $templates, SelectBox $selectBox) { <ide> * option elements. Set to a string to define the display value of the <ide> * empty option. <ide> * <del> * In addtion to the above options, the following options allow you to control <add> * In addition to the above options, the following options allow you to control <ide> * which input elements are generated. By setting any option to false you can disable <ide> * that input picker. In addition each picker allows you to set additional options <ide> * that are set as HTML properties on the picker.
55
Go
Go
fix race condition between exec start and resize
e6783656f917c5a8b8c6f346b4ff840d97b1b6ce
<ide><path>daemon/exec.go <ide> import ( <ide> "github.com/docker/docker/pkg/pools" <ide> "github.com/docker/docker/pkg/signal" <ide> "github.com/docker/docker/pkg/term" <del> "github.com/opencontainers/runtime-spec/specs-go" <add> specs "github.com/opencontainers/runtime-spec/specs-go" <ide> "github.com/pkg/errors" <ide> "github.com/sirupsen/logrus" <ide> ) <ide> func (d *Daemon) ContainerExecStart(ctx context.Context, name string, stdin io.R <ide> ec.Lock() <ide> c.ExecCommands.Lock() <ide> systemPid, err := d.containerd.Exec(ctx, c.ID, ec.ID, p, cStdin != nil, ec.InitializeStdio) <add> // the exec context should be ready, or error happened. <add> // close the chan to notify readiness <add> close(ec.Started) <ide> if err != nil { <ide> c.ExecCommands.Unlock() <ide> ec.Unlock() <ide><path>daemon/exec/exec.go <ide> import ( <ide> // examined both during and after completion. <ide> type Config struct { <ide> sync.Mutex <add> Started chan struct{} <ide> StreamConfig *stream.Config <ide> ID string <ide> Running bool <ide> func NewConfig() *Config { <ide> return &Config{ <ide> ID: stringid.GenerateNonCryptoID(), <ide> StreamConfig: stream.NewConfig(), <add> Started: make(chan struct{}), <ide> } <ide> } <ide> <ide><path>daemon/resize.go <ide> package daemon // import "github.com/docker/docker/daemon" <ide> import ( <ide> "context" <ide> "fmt" <add> "time" <ide> <ide> "github.com/docker/docker/libcontainerd" <ide> ) <ide> func (daemon *Daemon) ContainerExecResize(name string, height, width int) error <ide> if err != nil { <ide> return err <ide> } <del> return daemon.containerd.ResizeTerminal(context.Background(), ec.ContainerID, ec.ID, width, height) <add> // TODO: the timeout is hardcoded here, it would be more flexible to make it <add> // a parameter in resize request context, which would need API changes. <add> timeout := 10 * time.Second <add> select { <add> case <-ec.Started: <add> return daemon.containerd.ResizeTerminal(context.Background(), ec.ContainerID, ec.ID, width, height) <add> case <-time.After(timeout): <add> return fmt.Errorf("timeout waiting for exec session ready") <add> } <ide> } <ide><path>daemon/resize_test.go <add>// +build linux <add> <add>package daemon <add> <add>import ( <add> "context" <add> "testing" <add> <add> "github.com/docker/docker/container" <add> "github.com/docker/docker/daemon/exec" <add> "github.com/gotestyourself/gotestyourself/assert" <add>) <add> <add>// This test simply verify that when a wrong ID used, a specific error should be returned for exec resize. <add>func TestExecResizeNoSuchExec(t *testing.T) { <add> n := "TestExecResize" <add> d := &Daemon{ <add> execCommands: exec.NewStore(), <add> } <add> c := &container.Container{ <add> ExecCommands: exec.NewStore(), <add> } <add> ec := &exec.Config{ <add> ID: n, <add> } <add> d.registerExecCommand(c, ec) <add> err := d.ContainerExecResize("nil", 24, 8) <add> assert.ErrorContains(t, err, "No such exec instance") <add>} <add> <add>type execResizeMockContainerdClient struct { <add> MockContainerdClient <add> ProcessID string <add> ContainerID string <add> Width int <add> Height int <add>} <add> <add>func (c *execResizeMockContainerdClient) ResizeTerminal(ctx context.Context, containerID, processID string, width, height int) error { <add> c.ProcessID = processID <add> c.ContainerID = containerID <add> c.Width = width <add> c.Height = height <add> return nil <add>} <add> <add>// This test is to make sure that when exec context is ready, resize should call ResizeTerminal via containerd client. <add>func TestExecResize(t *testing.T) { <add> n := "TestExecResize" <add> width := 24 <add> height := 8 <add> ec := &exec.Config{ <add> ID: n, <add> ContainerID: n, <add> Started: make(chan struct{}), <add> } <add> close(ec.Started) <add> mc := &execResizeMockContainerdClient{} <add> d := &Daemon{ <add> execCommands: exec.NewStore(), <add> containerd: mc, <add> containers: container.NewMemoryStore(), <add> } <add> c := &container.Container{ <add> ExecCommands: exec.NewStore(), <add> State: &container.State{Running: true}, <add> } <add> d.containers.Add(n, c) <add> d.registerExecCommand(c, ec) <add> err := d.ContainerExecResize(n, height, width) <add> assert.NilError(t, err) <add> assert.Equal(t, mc.Width, width) <add> assert.Equal(t, mc.Height, height) <add> assert.Equal(t, mc.ProcessID, n) <add> assert.Equal(t, mc.ContainerID, n) <add>} <add> <add>// This test is to make sure that when exec context is not ready, a timeout error should happen. <add>// TODO: the expect running time for this test is 10s, which would be too long for unit test. <add>func TestExecResizeTimeout(t *testing.T) { <add> n := "TestExecResize" <add> width := 24 <add> height := 8 <add> ec := &exec.Config{ <add> ID: n, <add> ContainerID: n, <add> Started: make(chan struct{}), <add> } <add> mc := &execResizeMockContainerdClient{} <add> d := &Daemon{ <add> execCommands: exec.NewStore(), <add> containerd: mc, <add> containers: container.NewMemoryStore(), <add> } <add> c := &container.Container{ <add> ExecCommands: exec.NewStore(), <add> State: &container.State{Running: true}, <add> } <add> d.containers.Add(n, c) <add> d.registerExecCommand(c, ec) <add> err := d.ContainerExecResize(n, height, width) <add> assert.ErrorContains(t, err, "timeout waiting for exec session ready") <add>} <ide><path>daemon/util_test.go <add>// +build linux <add> <add>package daemon <add> <add>import ( <add> "context" <add> "time" <add> <add> "github.com/containerd/containerd" <add> "github.com/docker/docker/libcontainerd" <add> specs "github.com/opencontainers/runtime-spec/specs-go" <add>) <add> <add>// Mock containerd client implementation, for unit tests. <add>type MockContainerdClient struct { <add>} <add> <add>func (c *MockContainerdClient) Version(ctx context.Context) (containerd.Version, error) { <add> return containerd.Version{}, nil <add>} <add>func (c *MockContainerdClient) Restore(ctx context.Context, containerID string, attachStdio libcontainerd.StdioCallback) (alive bool, pid int, err error) { <add> return false, 0, nil <add>} <add>func (c *MockContainerdClient) Create(ctx context.Context, containerID string, spec *specs.Spec, runtimeOptions interface{}) error { <add> return nil <add>} <add>func (c *MockContainerdClient) Start(ctx context.Context, containerID, checkpointDir string, withStdin bool, attachStdio libcontainerd.StdioCallback) (pid int, err error) { <add> return 0, nil <add>} <add>func (c *MockContainerdClient) SignalProcess(ctx context.Context, containerID, processID string, signal int) error { <add> return nil <add>} <add>func (c *MockContainerdClient) Exec(ctx context.Context, containerID, processID string, spec *specs.Process, withStdin bool, attachStdio libcontainerd.StdioCallback) (int, error) { <add> return 0, nil <add>} <add>func (c *MockContainerdClient) ResizeTerminal(ctx context.Context, containerID, processID string, width, height int) error { <add> return nil <add>} <add>func (c *MockContainerdClient) CloseStdin(ctx context.Context, containerID, processID string) error { <add> return nil <add>} <add>func (c *MockContainerdClient) Pause(ctx context.Context, containerID string) error { return nil } <add>func (c *MockContainerdClient) Resume(ctx context.Context, containerID string) error { return nil } <add>func (c *MockContainerdClient) Stats(ctx context.Context, containerID string) (*libcontainerd.Stats, error) { <add> return nil, nil <add>} <add>func (c *MockContainerdClient) ListPids(ctx context.Context, containerID string) ([]uint32, error) { <add> return nil, nil <add>} <add>func (c *MockContainerdClient) Summary(ctx context.Context, containerID string) ([]libcontainerd.Summary, error) { <add> return nil, nil <add>} <add>func (c *MockContainerdClient) DeleteTask(ctx context.Context, containerID string) (uint32, time.Time, error) { <add> return 0, time.Time{}, nil <add>} <add>func (c *MockContainerdClient) Delete(ctx context.Context, containerID string) error { return nil } <add>func (c *MockContainerdClient) Status(ctx context.Context, containerID string) (libcontainerd.Status, error) { <add> return "null", nil <add>} <add>func (c *MockContainerdClient) UpdateResources(ctx context.Context, containerID string, resources *libcontainerd.Resources) error { <add> return nil <add>} <add>func (c *MockContainerdClient) CreateCheckpoint(ctx context.Context, containerID, checkpointDir string, exit bool) error { <add> return nil <add>} <ide><path>integration-cli/docker_api_exec_resize_test.go <ide> func (s *DockerSuite) TestExecResizeImmediatelyAfterExecStart(c *check.C) { <ide> defer conn.Close() <ide> <ide> _, rc, err := request.Post(fmt.Sprintf("/exec/%s/resize?h=24&w=80", execID), request.ContentType("text/plain")) <del> // It's probably a panic of the daemon if io.ErrUnexpectedEOF is returned. <del> if err == io.ErrUnexpectedEOF { <del> return fmt.Errorf("The daemon might have crashed.") <add> if err != nil { <add> // It's probably a panic of the daemon if io.ErrUnexpectedEOF is returned. <add> if err == io.ErrUnexpectedEOF { <add> return fmt.Errorf("The daemon might have crashed.") <add> } <add> // Other error happened, should be reported. <add> return fmt.Errorf("Fail to exec resize immediately after start. Error: %q", err.Error()) <ide> } <ide> <del> if err == nil { <del> rc.Close() <del> } <add> rc.Close() <ide> <del> // We only interested in the io.ErrUnexpectedEOF error, so we return nil otherwise. <ide> return nil <ide> } <ide>
6
Python
Python
fix batch_dot tests on backend
d09e2a67bb9ce53f9318930296a9825dd82f7197
<ide><path>tests/keras/backend/test_backends.py <ide> def test_linear_operations(self): <ide> check_two_tensor_operation('dot', (4, 2), (5, 2, 3)) <ide> <ide> check_two_tensor_operation('batch_dot', (4, 2, 3), (4, 5, 3), <del> axes=((2,), (2,))) <add> axes=(2, 2)) <ide> check_single_tensor_operation('transpose', (4, 2)) <ide> <ide> def test_shape_operations(self):
1
Text
Text
fix changelog [ci skip]
7eed607b122b4089c1390dfcf6918515672e8c4c
<ide><path>activemodel/CHANGELOG.md <ide> * Pass in `base` instead of `base_class` to Error.human_attribute_name <ide> <del> *Filipe Sabella* <del> <ide> This is useful in cases where the `human_attribute_name` method depends <ide> on other attributes' values of the class under validation to derive what the <del> attirbute name should be. <add> attribute name should be. <add> <add> *Filipe Sabella* <ide> <ide> * Deprecate marshalling load from legacy attributes format. <ide>
1
Text
Text
update details about cache control headers
a52bd712fe797b59cfd05ceaa4c33096a0c346ff
<ide><path>docs/api-reference/next.config.js/headers.md <ide> module.exports = { <ide> <ide> ### Cache-Control <ide> <del>Cache-Control headers set in next.config.js will be overwritten in production to ensure that static assets can be cached effectively. If you need to revalidate the cache of a page that has been [statically generated](https://nextjs.org/docs/basic-features/pages#static-generation-recommended), you can do so by setting `revalidate` in the page's [`getStaticProps`](/docs/basic-features/data-fetching/get-static-props.md) function. <add>You can set the `Cache-Control` header in your [Next.js API Routes](/docs/api-routes/introduction.md) by using the `res.setHeader` method: <add> <add>```js <add>// pages/api/user.js <add> <add>export default function handler(req, res) { <add> res.setHeader('Cache-Control', 's-maxage=86400') <add> res.status(200).json({ name: 'John Doe' }) <add>} <add>``` <add> <add>You cannot set `Cache-Control` headers in `next.config.js` file as these will be overwritten in production to ensure that API Routes and static assets are cached effectively. <add> <add>If you need to revalidate the cache of a page that has been [statically generated](/docs/basic-features/pages.md#static-generation-recommended), you can do so by setting the `revalidate` prop in the page's [`getStaticProps`](/docs/basic-features/data-fetching/get-static-props.md) function. <ide> <ide> ## Related <ide>
1
Ruby
Ruby
add translation to the new base
c90f613ad68253cb253bf47cb812f9e027c35d10
<ide><path>actionpack/lib/action_controller/new_base.rb <ide> module ActionController <ide> autoload :Streaming, 'action_controller/base/streaming' <ide> autoload :HttpAuthentication, 'action_controller/base/http_authentication' <ide> autoload :FilterParameterLogging, 'action_controller/base/filter_parameter_logging' <add> autoload :Translation, 'action_controller/translation' <ide> <ide> require 'action_controller/routing' <ide> end <ide><path>actionpack/lib/action_controller/new_base/base.rb <ide> class Base < Http <ide> include ActionController::HttpAuthentication::Basic::ControllerMethods <ide> include ActionController::HttpAuthentication::Digest::ControllerMethods <ide> include ActionController::FilterParameterLogging <add> include ActionController::Translation <ide> <ide> # TODO: Extract into its own module <ide> # This should be moved together with other normalizing behavior <ide><path>actionpack/test/new_base/abstract_unit.rb <ide> <ide> require 'test/unit' <ide> require 'active_support' <add> <add># TODO : Revisit requiring all the core extensions here <ide> require 'active_support/core_ext' <add> <ide> require 'active_support/test_case' <ide> require 'action_controller/abstract' <ide> require 'action_controller/new_base'
3
Text
Text
add basic js scrimba links
409c39abf1cf9ca42be056171c50f13f27c11737
<ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/access-array-data-with-indexes.english.md <ide> id: 56bbb991ad1ed5201cd392ca <ide> title: Access Array Data with Indexes <ide> challengeType: 1 <ide> guideUrl: 'https://www.freecodecamp.org/guide/certificates/access-array-data-with-indexes' <add>videoUrl: 'https://scrimba.com/c/cBZQbTz' <ide> --- <ide> <ide> ## Description <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/access-multi-dimensional-arrays-with-indexes.english.md <ide> id: 56592a60ddddeae28f7aa8e1 <ide> title: Access Multi-Dimensional Arrays With Indexes <ide> challengeType: 1 <ide> guideUrl: 'https://www.freecodecamp.org/guide/certificates/access-array-data-with-indexes' <add>videoUrl: 'https://scrimba.com/c/ckND4Cq' <ide> --- <ide> <ide> ## Description <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-nested-arrays.english.md <ide> id: 56533eb9ac21ba0edf2244cd <ide> title: Accessing Nested Arrays <ide> challengeType: 1 <ide> guideUrl: 'https://www.freecodecamp.org/guide/certificates/access-array-data-with-indexes' <add>videoUrl: 'https://scrimba.com/c/cLeGDtZ' <ide> --- <ide> <ide> ## Description <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-nested-objects.english.md <ide> id: 56533eb9ac21ba0edf2244cc <ide> title: Accessing Nested Objects <ide> challengeType: 1 <ide> guideUrl: 'https://www.freecodecamp.org/guide/certificates/accessing-nested-objects-in-json' <add>videoUrl: 'https://scrimba.com/c/cRnRnfa' <ide> --- <ide> <ide> ## Description <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-bracket-notation.english.md <ide> id: 56533eb9ac21ba0edf2244c8 <ide> title: Accessing Object Properties with Bracket Notation <ide> challengeType: 1 <ide> guideUrl: 'https://www.freecodecamp.org/guide/certificates/accessing-objects-properties-with-bracket-notation' <add>videoUrl: 'https://scrimba.com/c/cBvmEHP' <ide> --- <ide> <ide> ## Description <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-dot-notation.english.md <ide> id: 56533eb9ac21ba0edf2244c7 <ide> title: Accessing Object Properties with Dot Notation <ide> challengeType: 1 <add>videoUrl: 'https://scrimba.com/c/cGryJs8' <ide> --- <ide> <ide> ## Description <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-variables.english.md <ide> id: 56533eb9ac21ba0edf2244c9 <ide> title: Accessing Object Properties with Variables <ide> challengeType: 1 <ide> guideUrl: 'https://www.freecodecamp.org/guide/certificates/accessing-objects-properties-with-variables' <add>videoUrl: 'https://scrimba.com/c/cnQyKur' <ide> --- <ide> <ide> ## Description <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/add-new-properties-to-a-javascript-object.english.md <ide> id: 56bbb991ad1ed5201cd392d2 <ide> title: Add New Properties to a JavaScript Object <ide> challengeType: 1 <add>videoUrl: 'https://scrimba.com/c/cQe38UD' <ide> --- <ide> <ide> ## Description <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/add-two-numbers-with-javascript.english.md <ide> id: cf1111c1c11feddfaeb3bdef <ide> title: Add Two Numbers with JavaScript <ide> challengeType: 1 <add>videoUrl: 'https://scrimba.com/c/cM2KBAG' <ide> --- <ide> <ide> ## Description <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/adding-a-default-option-in-switch-statements.english.md <ide> id: 56533eb9ac21ba0edf2244de <ide> title: Adding a Default Option in Switch Statements <ide> challengeType: 1 <ide> guideUrl: 'https://www.freecodecamp.org/guide/certificates/adding-a-default-option-in-switch-statements' <add>videoUrl: 'https://scrimba.com/c/c3JvVfg' <ide> --- <ide> <ide> ## Description <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/appending-variables-to-strings.english.md <ide> id: 56533eb9ac21ba0edf2244ed <ide> title: Appending Variables to Strings <ide> challengeType: 1 <ide> guideUrl: 'https://www.freecodecamp.org/guide/certificates/appending-variables-to-strings' <add>videoUrl: 'https://scrimba.com/c/cbQmZfa' <ide> --- <ide> <ide> ## Description <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/assignment-with-a-returned-value.english.md <ide> id: 56533eb9ac21ba0edf2244c3 <ide> title: Assignment with a Returned Value <ide> challengeType: 1 <ide> guideUrl: 'https://www.freecodecamp.org/guide/certificates/assignment-with-a-returned-value' <add>videoUrl: 'https://scrimba.com/c/ce2pEtB' <ide> --- <ide> <ide> ## Description <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/build-javascript-objects.english.md <ide> id: 56bbb991ad1ed5201cd392d0 <ide> title: Build JavaScript Objects <ide> challengeType: 1 <add>videoUrl: 'https://scrimba.com/c/cWGkbtd' <ide> --- <ide> <ide> ## Description <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/chaining-if-else-statements.english.md <ide> id: 56533eb9ac21ba0edf2244dc <ide> title: Chaining If Else Statements <ide> challengeType: 1 <add>videoUrl: 'https://scrimba.com/c/caeJgsw' <ide> --- <ide> <ide> ## Description <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/comment-your-javascript-code.english.md <ide> id: bd7123c9c441eddfaeb4bdef <ide> title: Comment Your JavaScript Code <ide> challengeType: 1 <add>videoUrl: 'https://scrimba.com/c/c7ynnTp' <ide> --- <ide> <ide> ## Description <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-equality-operator.english.md <ide> id: 56533eb9ac21ba0edf2244d0 <ide> title: Comparison with the Equality Operator <ide> challengeType: 1 <add>videoUrl: 'https://scrimba.com/c/cKyVMAL' <ide> --- <ide> <ide> ## Description <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-greater-than-operator.english.md <ide> id: 56533eb9ac21ba0edf2244d4 <ide> title: Comparison with the Greater Than Operator <ide> challengeType: 1 <add>videoUrl: 'https://scrimba.com/c/cp6GbH4' <ide> --- <ide> <ide> ## Description <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-greater-than-or-equal-to-operator.english.md <ide> id: 56533eb9ac21ba0edf2244d5 <ide> title: Comparison with the Greater Than Or Equal To Operator <ide> challengeType: 1 <add>videoUrl: 'https://scrimba.com/c/c6KBqtV' <ide> --- <ide> <ide> ## Description <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-inequality-operator.english.md <ide> id: 56533eb9ac21ba0edf2244d2 <ide> title: Comparison with the Inequality Operator <ide> challengeType: 1 <add>videoUrl: 'https://scrimba.com/c/cdBm9Sr' <ide> --- <ide> <ide> ## Description <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-less-than-operator.english.md <ide> id: 56533eb9ac21ba0edf2244d6 <ide> title: Comparison with the Less Than Operator <ide> challengeType: 1 <add>videoUrl: 'https://scrimba.com/c/cNVRWtB' <ide> --- <ide> <ide> ## Description <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-less-than-or-equal-to-operator.english.md <ide> id: 56533eb9ac21ba0edf2244d7 <ide> title: Comparison with the Less Than Or Equal To Operator <ide> challengeType: 1 <add>videoUrl: 'https://scrimba.com/c/cNVR7Am' <ide> --- <ide> <ide> ## Description <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-strict-equality-operator.english.md <ide> id: 56533eb9ac21ba0edf2244d1 <ide> title: Comparison with the Strict Equality Operator <ide> challengeType: 1 <add>videoUrl: 'https://scrimba.com/c/cy87atr' <ide> --- <ide> <ide> ## Description <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-strict-inequality-operator.english.md <ide> id: 56533eb9ac21ba0edf2244d3 <ide> title: Comparison with the Strict Inequality Operator <ide> challengeType: 1 <add>videoUrl: 'https://scrimba.com/c/cKekkUy' <ide> --- <ide> <ide> ## Description <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/comparisons-with-the-logical-and-operator.english.md <ide> id: 56533eb9ac21ba0edf2244d8 <ide> title: Comparisons with the Logical And Operator <ide> challengeType: 1 <add>videoUrl: 'https://scrimba.com/c/cvbRVtr' <ide> --- <ide> <ide> ## Description <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/comparisons-with-the-logical-or-operator.english.md <ide> id: 56533eb9ac21ba0edf2244d9 <ide> title: Comparisons with the Logical Or Operator <ide> challengeType: 1 <add>videoUrl: 'https://scrimba.com/c/cEPrGTN' <ide> --- <ide> <ide> ## Description <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-addition.english.md <ide> id: 56533eb9ac21ba0edf2244af <ide> title: Compound Assignment With Augmented Addition <ide> challengeType: 1 <add>videoUrl: 'https://scrimba.com/c/cDR6LCb' <ide> --- <ide> <ide> ## Description <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-division.english.md <ide> id: 56533eb9ac21ba0edf2244b2 <ide> title: Compound Assignment With Augmented Division <ide> challengeType: 1 <add>videoUrl: 'https://scrimba.com/c/c2QvKT2' <ide> --- <ide> <ide> ## Description <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-multiplication.english.md <ide> id: 56533eb9ac21ba0edf2244b1 <ide> title: Compound Assignment With Augmented Multiplication <ide> challengeType: 1 <add>videoUrl: 'https://scrimba.com/c/c83vrfa' <ide> --- <ide> <ide> ## Description <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-subtraction.english.md <ide> id: 56533eb9ac21ba0edf2244b0 <ide> title: Compound Assignment With Augmented Subtraction <ide> challengeType: 1 <add>videoUrl: 'https://scrimba.com/c/c2Qv7AV' <ide> --- <ide> <ide> ## Description <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-plus-operator.english.md <ide> id: 56533eb9ac21ba0edf2244b7 <ide> title: Concatenating Strings with Plus Operator <ide> challengeType: 1 <add>videoUrl: 'https://scrimba.com/c/cNpM8AN' <ide> --- <ide> <ide> ## Description <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-the-plus-equals-operator.english.md <ide> id: 56533eb9ac21ba0edf2244b8 <ide> title: Concatenating Strings with the Plus Equals Operator <ide> challengeType: 1 <add>videoUrl: 'https://scrimba.com/c/cbQmmC4' <ide> --- <ide> <ide> ## Description <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/constructing-strings-with-variables.english.md <ide> id: 56533eb9ac21ba0edf2244b9 <ide> title: Constructing Strings with Variables <ide> challengeType: 1 <add>videoUrl: 'https://scrimba.com/c/cqk8rf4' <ide> --- <ide> <ide> ## Description <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/count-backwards-with-a-for-loop.english.md <ide> id: 56105e7b514f539506016a5e <ide> title: Count Backwards With a For Loop <ide> challengeType: 1 <add>videoUrl: 'https://scrimba.com/c/c2R6BHa' <ide> --- <ide> <ide> ## Description <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/counting-cards.english.md <ide> id: 565bbe00e9cc8ac0725390f4 <ide> title: Counting Cards <ide> challengeType: 1 <add>videoUrl: 'https://scrimba.com/c/c6KE7ty' <ide> --- <ide> <ide> ## Description <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/create-decimal-numbers-with-javascript.english.md <ide> id: cf1391c1c11feddfaeb4bdef <ide> title: Create Decimal Numbers with JavaScript <ide> challengeType: 1 <add>videoUrl: 'https://scrimba.com/c/ca8GEuW' <ide> --- <ide> <ide> ## Description <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/declare-javascript-variables.english.md <ide> id: bd7123c9c443eddfaeb5bdef <ide> title: Declare JavaScript Variables <ide> challengeType: 1 <add>videoUrl: 'https://scrimba.com/c/cNanrHq' <ide> --- <ide> <ide> ## Description <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/declare-string-variables.english.md <ide> id: bd7123c9c444eddfaeb5bdef <ide> title: Declare String Variables <ide> challengeType: 1 <add>videoUrl: 'https://scrimba.com/c/c2QvWU6' <ide> --- <ide> <ide> ## Description <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/decrement-a-number-with-javascript.english.md <ide> id: 56533eb9ac21ba0edf2244ad <ide> title: Decrement a Number with JavaScript <ide> challengeType: 1 <add>videoUrl: 'https://scrimba.com/c/cM2KeS2' <ide> --- <ide> <ide> ## Description <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/delete-properties-from-a-javascript-object.english.md <ide> id: 56bbb991ad1ed5201cd392d3 <ide> title: Delete Properties from a JavaScript Object <ide> challengeType: 1 <add>videoUrl: 'https://scrimba.com/c/cDqKdTv' <ide> --- <ide> <ide> ## Description <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/divide-one-decimal-by-another-with-javascript.english.md <ide> id: bd7993c9ca9feddfaeb7bdef <ide> title: Divide One Decimal by Another with JavaScript <ide> challengeType: 1 <add>videoUrl: 'https://scrimba.com/c/cBZe9AW' <ide> --- <ide> <ide> ## Description <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/divide-one-number-by-another-with-javascript.english.md <ide> id: cf1111c1c11feddfaeb6bdef <ide> title: Divide One Number by Another with JavaScript <ide> challengeType: 1 <add>videoUrl: 'https://scrimba.com/c/cqkbdAr' <ide> --- <ide> <ide> ## Description <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/escape-sequences-in-strings.english.md <ide> id: 56533eb9ac21ba0edf2244b6 <ide> title: Escape Sequences in Strings <ide> challengeType: 1 <add>videoUrl: 'https://scrimba.com/c/cvmqRh6' <ide> --- <ide> <ide> ## Description <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/escaping-literal-quotes-in-strings.english.md <ide> id: 56533eb9ac21ba0edf2244b5 <ide> title: Escaping Literal Quotes in Strings <ide> challengeType: 1 <add>videoUrl: 'https://scrimba.com/c/c2QvgSr' <ide> --- <ide> <ide> ## Description <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/find-the-length-of-a-string.english.md <ide> id: bd7123c9c448eddfaeb5bdef <ide> title: Find the Length of a String <ide> challengeType: 1 <add>videoUrl: 'https://scrimba.com/c/cvmqEAd' <ide> --- <ide> <ide> ## Description <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/finding-a-remainder-in-javascript.english.md <ide> id: 56533eb9ac21ba0edf2244ae <ide> title: Finding a Remainder in JavaScript <ide> challengeType: 1 <add>videoUrl: 'https://scrimba.com/c/cWP24Ub' <ide> --- <ide> <ide> ## Description <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-fractions-with-javascript.english.md <ide> id: cf1111c1c11feddfaeb9bdef <ide> title: Generate Random Fractions with JavaScript <ide> challengeType: 1 <add>videoUrl: 'https://scrimba.com/c/cyWJJs3' <ide> --- <ide> <ide> ## Description <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-whole-numbers-with-javascript.english.md <ide> id: cf1111c1c12feddfaeb1bdef <ide> title: Generate Random Whole Numbers with JavaScript <ide> challengeType: 1 <add>videoUrl: 'https://scrimba.com/c/cRn6bfr' <ide> --- <ide> <ide> ## Description <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-whole-numbers-within-a-range.english.md <ide> id: cf1111c1c12feddfaeb2bdef <ide> title: Generate Random Whole Numbers within a Range <ide> challengeType: 1 <add>videoUrl: 'https://scrimba.com/c/cm83yu6' <ide> --- <ide> <ide> ## Description <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/global-scope-and-functions.english.md <ide> id: 56533eb9ac21ba0edf2244be <ide> title: Global Scope and Functions <ide> challengeType: 1 <add>videoUrl: 'https://scrimba.com/c/cQM7mCN' <ide> --- <ide> <ide> ## Description <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/global-vs.-local-scope-in-functions.english.md <ide> id: 56533eb9ac21ba0edf2244c0 <ide> title: Global vs. Local Scope in Functions <ide> challengeType: 1 <add>videoUrl: 'https://scrimba.com/c/c2QwKH2' <ide> --- <ide> <ide> ## Description <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/golf-code.english.md <ide> id: 5664820f61c48e80c9fa476c <ide> title: Golf Code <ide> challengeType: 1 <add>videoUrl: 'https://scrimba.com/c/c9ykNUR' <ide> --- <ide> <ide> ## Description <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/increment-a-number-with-javascript.english.md <ide> id: 56533eb9ac21ba0edf2244ac <ide> title: Increment a Number with JavaScript <ide> challengeType: 1 <add>videoUrl: 'https://scrimba.com/c/ca8GLT9' <ide> --- <ide> <ide> ## Description <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/initializing-variables-with-the-assignment-operator.english.md <ide> id: 56533eb9ac21ba0edf2244a9 <ide> title: Initializing Variables with the Assignment Operator <ide> challengeType: 1 <add>videoUrl: 'https://scrimba.com/c/cWJ4Bfb' <ide> --- <ide> <ide> ## Description <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/introducing-else-if-statements.english.md <ide> id: 56533eb9ac21ba0edf2244db <ide> title: Introducing Else If Statements <ide> challengeType: 1 <add>videoUrl: 'https://scrimba.com/c/caeJ2hm' <ide> --- <ide> <ide> ## Description <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/introducing-else-statements.english.md <ide> id: 56533eb9ac21ba0edf2244da <ide> title: Introducing Else Statements <ide> challengeType: 1 <add>videoUrl: 'https://scrimba.com/c/cek4Efq' <ide> --- <ide> <ide> ## Description <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-odd-numbers-with-a-for-loop.english.md <ide> id: 56104e9e514f539506016a5c <ide> title: Iterate Odd Numbers With a For Loop <ide> challengeType: 1 <add>videoUrl: 'https://scrimba.com/c/cm8n7T9' <ide> --- <ide> <ide> ## Description <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-through-an-array-with-a-for-loop.english.md <ide> id: 5675e877dbd60be8ad28edc6 <ide> title: Iterate Through an Array with a For Loop <ide> challengeType: 1 <add>videoUrl: 'https://scrimba.com/c/caeR3HB' <ide> --- <ide> <ide> ## Description <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-do...while-loops.english.md <ide> id: 5a2efd662fb457916e1fe604 <ide> title: Iterate with JavaScript Do...While Loops <ide> challengeType: 1 <add>videoUrl: 'https://scrimba.com/c/cDqWGcp' <ide> --- <ide> <ide> ## Description <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-for-loops.english.md <ide> id: cf1111c1c11feddfaeb5bdef <ide> title: Iterate with JavaScript For Loops <ide> challengeType: 1 <add>videoUrl: 'https://scrimba.com/c/c9yNVCe' <ide> --- <ide> <ide> ## Description <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-while-loops.english.md <ide> id: cf1111c1c11feddfaeb1bdef <ide> title: Iterate with JavaScript While Loops <ide> challengeType: 1 <add>videoUrl: 'https://scrimba.com/c/c8QbnCM' <ide> --- <ide> <ide> ## Description <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/local-scope-and-functions.english.md <ide> id: 56533eb9ac21ba0edf2244bf <ide> title: Local Scope and Functions <ide> challengeType: 1 <add>videoUrl: 'https://scrimba.com/c/cd62NhM' <ide> --- <ide> <ide> ## Description <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/logical-order-in-if-else-statements.english.md <ide> id: 5690307fddb111c6084545d7 <ide> title: Logical Order in If Else Statements <ide> challengeType: 1 <add>videoUrl: 'https://scrimba.com/c/cwNvMUV' <ide> --- <ide> <ide> ## Description <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/manipulate-arrays-with-pop.english.md <ide> id: 56bbb991ad1ed5201cd392cc <ide> title: Manipulate Arrays With pop() <ide> challengeType: 1 <add>videoUrl: 'https://scrimba.com/c/cRbVZAB' <ide> --- <ide> <ide> ## Description <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/manipulate-arrays-with-push.english.md <ide> id: 56bbb991ad1ed5201cd392cb <ide> title: Manipulate Arrays With push() <ide> challengeType: 1 <add>videoUrl: 'https://scrimba.com/c/cnqmVtJ' <ide> --- <ide> <ide> ## Description <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/manipulate-arrays-with-shift.english.md <ide> id: 56bbb991ad1ed5201cd392cd <ide> title: Manipulate Arrays With shift() <ide> challengeType: 1 <add>videoUrl: 'https://scrimba.com/c/cRbVETW' <ide> --- <ide> <ide> ## Description <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/manipulate-arrays-with-unshift.english.md <ide> id: 56bbb991ad1ed5201cd392ce <ide> title: Manipulate Arrays With unshift() <ide> challengeType: 1 <add>videoUrl: 'https://scrimba.com/c/ckNDESv' <ide> --- <ide> <ide> ## Description <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/manipulating-complex-objects.english.md <ide> id: 56533eb9ac21ba0edf2244cb <ide> title: Manipulating Complex Objects <ide> challengeType: 1 <add>videoUrl: 'https://scrimba.com/c/c9yNMfR' <ide> --- <ide> <ide> ## Description <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/modify-array-data-with-indexes.english.md <ide> id: cf1111c1c11feddfaeb8bdef <ide> title: Modify Array Data With Indexes <ide> challengeType: 1 <add>videoUrl: 'https://scrimba.com/c/czQM4A8' <ide> --- <ide> <ide> ## Description <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/multiple-identical-options-in-switch-statements.english.md <ide> id: 56533eb9ac21ba0edf2244df <ide> title: Multiple Identical Options in Switch Statements <ide> challengeType: 1 <add>videoUrl: 'https://scrimba.com/c/cdBKWCV' <ide> --- <ide> <ide> ## Description <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/multiply-two-decimals-with-javascript.english.md <ide> id: bd7993c9c69feddfaeb7bdef <ide> title: Multiply Two Decimals with JavaScript <ide> challengeType: 1 <add>videoUrl: 'https://scrimba.com/c/ce2GeHq' <ide> --- <ide> <ide> ## Description <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/multiply-two-numbers-with-javascript.english.md <ide> id: cf1231c1c11feddfaeb5bdef <ide> title: Multiply Two Numbers with JavaScript <ide> challengeType: 1 <add>videoUrl: 'https://scrimba.com/c/cP3y3Aq' <ide> --- <ide> <ide> ## Description <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/nest-one-array-within-another-array.english.md <ide> id: cf1111c1c11feddfaeb7bdef <ide> title: Nest one Array within Another Array <ide> challengeType: 1 <add>videoUrl: 'https://scrimba.com/c/crZQZf8' <ide> --- <ide> <ide> ## Description <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/nesting-for-loops.english.md <ide> id: 56533eb9ac21ba0edf2244e1 <ide> title: Nesting For Loops <ide> challengeType: 1 <add>videoUrl: 'https://scrimba.com/c/cRn6GHM' <ide> --- <ide> <ide> ## Description <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/passing-values-to-functions-with-arguments.english.md <ide> id: 56533eb9ac21ba0edf2244bd <ide> title: Passing Values to Functions with Arguments <ide> challengeType: 1 <add>videoUrl: 'https://scrimba.com/c/cy8rahW' <ide> --- <ide> <ide> ## Description <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/practice-comparing-different-values.english.md <ide> id: 599a789b454f2bbd91a3ff4d <ide> title: Practice comparing different values <ide> challengeType: 1 <add>videoUrl: 'https://scrimba.com/c/cm8PqCa' <ide> --- <ide> <ide> ## Description <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/profile-lookup.english.md <ide> id: 5688e62ea601b2482ff8422b <ide> title: Profile Lookup <ide> challengeType: 1 <add>videoUrl: 'https://scrimba.com/c/cDqW2Cg' <ide> --- <ide> <ide> ## Description <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/quoting-strings-with-single-quotes.english.md <ide> id: 56533eb9ac21ba0edf2244b4 <ide> title: Quoting Strings with Single Quotes <ide> challengeType: 1 <add>videoUrl: 'https://scrimba.com/c/cbQmnhM' <ide> --- <ide> <ide> ## Description <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/record-collection.english.md <ide> id: 56533eb9ac21ba0edf2244cf <ide> title: Record Collection <ide> challengeType: 1 <add>videoUrl: 'https://scrimba.com/c/c4mpysg' <ide> --- <ide> <ide> ## Description <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/replacing-if-else-chains-with-switch.english.md <ide> id: 56533eb9ac21ba0edf2244e0 <ide> title: Replacing If Else Chains with Switch <ide> challengeType: 1 <add>videoUrl: 'https://scrimba.com/c/c3JE8fy' <ide> --- <ide> <ide> ## Description <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/return-a-value-from-a-function-with-return.english.md <ide> id: 56533eb9ac21ba0edf2244c2 <ide> title: Return a Value from a Function with Return <ide> challengeType: 1 <add>videoUrl: 'https://scrimba.com/c/cy87wue' <ide> --- <ide> <ide> ## Description <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/return-early-pattern-for-functions.english.md <ide> id: 56533eb9ac21ba0edf2244c4 <ide> title: Return Early Pattern for Functions <ide> challengeType: 1 <add>videoUrl: 'https://scrimba.com/c/cQe39Sq' <ide> --- <ide> <ide> ## Description <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/returning-boolean-values-from-functions.english.md <ide> id: 5679ceb97cbaa8c51670a16b <ide> title: Returning Boolean Values from Functions <ide> challengeType: 1 <add>videoUrl: 'https://scrimba.com/c/cp62qAQ' <ide> --- <ide> <ide> ## Description <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/selecting-from-many-options-with-switch-statements.english.md <ide> id: 56533eb9ac21ba0edf2244dd <ide> title: Selecting from Many Options with Switch Statements <ide> challengeType: 1 <add>videoUrl: 'https://scrimba.com/c/c4mv4fm' <ide> --- <ide> <ide> ## Description <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/shopping-list.english.md <ide> id: 56533eb9ac21ba0edf2244bc <ide> title: Shopping List <ide> challengeType: 1 <add>videoUrl: 'https://scrimba.com/c/c9MEKHZ' <ide> --- <ide> <ide> ## Description <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/stand-in-line.english.md <ide> id: 56533eb9ac21ba0edf2244c6 <ide> title: Stand in Line <ide> challengeType: 1 <add>videoUrl: 'https://scrimba.com/c/ca8Q8tP' <ide> --- <ide> <ide> ## Description <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/store-multiple-values-in-one-variable-using-javascript-arrays.english.md <ide> id: bd7993c9c69feddfaeb8bdef <ide> title: Store Multiple Values in one Variable using JavaScript Arrays <ide> challengeType: 1 <add>videoUrl: 'https://scrimba.com/c/crZQWAm' <ide> --- <ide> <ide> ## Description <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/storing-values-with-the-assignment-operator.english.md <ide> id: 56533eb9ac21ba0edf2244a8 <ide> title: Storing Values with the Assignment Operator <ide> challengeType: 1 <add>videoUrl: 'https://scrimba.com/c/cEanysE' <ide> --- <ide> <ide> ## Description <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/subtract-one-number-from-another-with-javascript.english.md <ide> id: cf1111c1c11feddfaeb4bdef <ide> title: Subtract One Number from Another with JavaScript <ide> challengeType: 1 <add>videoUrl: 'https://scrimba.com/c/cP3yQtk' <ide> --- <ide> <ide> ## Description <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/testing-objects-for-properties.english.md <ide> id: 567af2437cbaa8c51670a16c <ide> title: Testing Objects for Properties <ide> challengeType: 1 <add>videoUrl: 'https://scrimba.com/c/cm8Q7Ua' <ide> --- <ide> <ide> ## Description <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/understand-string-immutability.english.md <ide> id: 56533eb9ac21ba0edf2244ba <ide> title: Understand String Immutability <ide> challengeType: 1 <add>videoUrl: 'https://scrimba.com/c/cWPVaUR' <ide> --- <ide> <ide> ## Description <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-boolean-values.english.md <ide> id: bd7123c9c441eddfaeb5bdef <ide> title: Understanding Boolean Values <ide> challengeType: 1 <add>videoUrl: 'https://scrimba.com/c/c9Me8t4' <ide> --- <ide> <ide> ## Description <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-case-sensitivity-in-variables.english.md <ide> id: 56533eb9ac21ba0edf2244ab <ide> title: Understanding Case Sensitivity in Variables <ide> challengeType: 1 <add>videoUrl: 'https://scrimba.com/c/cd6GDcD' <ide> --- <ide> <ide> ## Description <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-undefined-value-returned-from-a-function.english.md <ide> id: 598e8944f009e646fc236146 <ide> title: Understanding Undefined Value returned from a Function <ide> challengeType: 1 <add>videoUrl: 'https://scrimba.com/c/ce2p7cL' <ide> --- <ide> <ide> ## Description <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-uninitialized-variables.english.md <ide> id: 56533eb9ac21ba0edf2244aa <ide> title: Understanding Uninitialized Variables <ide> challengeType: 1 <add>videoUrl: 'https://scrimba.com/c/cBa2JAL' <ide> --- <ide> <ide> ## Description <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/updating-object-properties.english.md <ide> id: 56bbb991ad1ed5201cd392d1 <ide> title: Updating Object Properties <ide> challengeType: 1 <add>videoUrl: 'https://scrimba.com/c/c9yEJT4' <ide> --- <ide> <ide> ## Description <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-first-character-in-a-string.english.md <ide> id: bd7123c9c549eddfaeb5bdef <ide> title: Use Bracket Notation to Find the First Character in a String <ide> challengeType: 1 <add>videoUrl: 'https://scrimba.com/c/ca8JwhW' <ide> --- <ide> <ide> ## Description <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-last-character-in-a-string.english.md <ide> id: bd7123c9c451eddfaeb5bdef <ide> title: Use Bracket Notation to Find the Last Character in a String <ide> challengeType: 1 <add>videoUrl: 'https://scrimba.com/c/cBZQGcv' <ide> --- <ide> <ide> ## Description <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-nth-character-in-a-string.english.md <ide> id: bd7123c9c450eddfaeb5bdef <ide> title: Use Bracket Notation to Find the Nth Character in a String <ide> challengeType: 1 <add>videoUrl: 'https://scrimba.com/c/cWPVJua' <ide> --- <ide> <ide> ## Description <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-nth-to-last-character-in-a-string.english.md <ide> id: bd7123c9c452eddfaeb5bdef <ide> title: Use Bracket Notation to Find the Nth-to-Last Character in a String <ide> challengeType: 1 <add>videoUrl: 'https://scrimba.com/c/cw4vkh9' <ide> --- <ide> <ide> ## Description <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/use-conditional-logic-with-if-statements.english.md <ide> id: cf1111c1c12feddfaeb3bdef <ide> title: Use Conditional Logic with If Statements <ide> challengeType: 1 <add>videoUrl: 'https://scrimba.com/c/cy87mf3' <ide> --- <ide> <ide> ## Description <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/use-multiple-conditional-ternary-operators.english.md <ide> id: 587d7b7e367417b2b2512b21 <ide> title: Use Multiple Conditional (Ternary) Operators <ide> challengeType: 1 <add>videoUrl: 'https://scrimba.com/c/cyWJBT4' <ide> --- <ide> <ide> ## Description <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-conditional-ternary-operator.english.md <ide> id: 587d7b7e367417b2b2512b24 <ide> title: Use the Conditional (Ternary) Operator <ide> challengeType: 1 <add>videoUrl: 'https://scrimba.com/c/c3JRmSg' <ide> --- <ide> <ide> ## Description <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-parseint-function-with-a-radix.english.md <ide> id: 587d7b7e367417b2b2512b22 <ide> title: Use the parseInt Function with a Radix <ide> challengeType: 1 <add>videoUrl: 'https://scrimba.com/c/c6K4Kh3' <ide> --- <ide> <ide> ## Description <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-parseint-function.english.md <ide> id: 587d7b7e367417b2b2512b23 <ide> title: Use the parseInt Function <ide> challengeType: 1 <add>videoUrl: 'https://scrimba.com/c/cm83LSW' <ide> --- <ide> <ide> ## Description <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/using-objects-for-lookups.english.md <ide> id: 56533eb9ac21ba0edf2244ca <ide> title: Using Objects for Lookups <ide> challengeType: 1 <add>videoUrl: 'https://scrimba.com/c/cdBk8sM' <ide> --- <ide> <ide> ## Description <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/word-blanks.english.md <ide> id: 56533eb9ac21ba0edf2244bb <ide> title: Word Blanks <ide> challengeType: 1 <add>videoUrl: 'https://scrimba.com/c/cP3vVsm' <ide> --- <ide> <ide> ## Description <ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/write-reusable-javascript-with-functions.english.md <ide> id: 56bbb991ad1ed5201cd392cf <ide> title: Write Reusable JavaScript with Functions <ide> challengeType: 1 <add>videoUrl: 'https://scrimba.com/c/cL6dqfy' <ide> --- <ide> <ide> ## Description
107
Text
Text
alphabetize tls options
25c92a90262e4bdaa97999f5fade56a9551701c9
<ide><path>doc/api/tls.md <ide> changes: <ide> --> <ide> <ide> * `options` {Object} <del> * `pfx` {string|string[]|Buffer|Buffer[]|Object[]} Optional PFX or PKCS12 <del> encoded private key and certificate chain. `pfx` is an alternative to <del> providing `key` and `cert` individually. PFX is usually encrypted, if it is, <del> `passphrase` will be used to decrypt it. Multiple PFX can be provided either <del> as an array of unencrypted PFX buffers, or an array of objects in the form <del> `{buf: <string|buffer>[, passphrase: <string>]}`. The object form can only <del> occur in an array. `object.passphrase` is optional. Encrypted PFX will be <del> decrypted with `object.passphrase` if provided, or `options.passphrase` if <del> it is not. <del> * `key` {string|string[]|Buffer|Buffer[]|Object[]} Optional private keys in <del> PEM format. PEM allows the option of private keys being encrypted. Encrypted <del> keys will be decrypted with `options.passphrase`. Multiple keys using <del> different algorithms can be provided either as an array of unencrypted key <del> strings or buffers, or an array of objects in the form `{pem: <del> <string|buffer>[, passphrase: <string>]}`. The object form can only occur in <del> an array. `object.passphrase` is optional. Encrypted keys will be decrypted <del> with `object.passphrase` if provided, or `options.passphrase` if it is not. <del> * `passphrase` {string} Optional shared passphrase used for a single private <del> key and/or a PFX. <del> * `cert` {string|string[]|Buffer|Buffer[]} Optional cert chains in PEM format. <del> One cert chain should be provided per private key. Each cert chain should <del> consist of the PEM formatted certificate for a provided private `key`, <del> followed by the PEM formatted intermediate certificates (if any), in order, <del> and not including the root CA (the root CA must be pre-known to the peer, <del> see `ca`). When providing multiple cert chains, they do not have to be in <del> the same order as their private keys in `key`. If the intermediate <del> certificates are not provided, the peer will not be able to validate the <del> certificate, and the handshake will fail. <ide> * `ca` {string|string[]|Buffer|Buffer[]} Optionally override the trusted CA <ide> certificates. Default is to trust the well-known CAs curated by Mozilla. <ide> Mozilla's CAs are completely replaced when CAs are explicitly specified <ide> changes: <ide> certificate can match or chain to. <ide> For self-signed certificates, the certificate is its own CA, and must be <ide> provided. <add> * `cert` {string|string[]|Buffer|Buffer[]} Optional cert chains in PEM format. <add> One cert chain should be provided per private key. Each cert chain should <add> consist of the PEM formatted certificate for a provided private `key`, <add> followed by the PEM formatted intermediate certificates (if any), in order, <add> and not including the root CA (the root CA must be pre-known to the peer, <add> see `ca`). When providing multiple cert chains, they do not have to be in <add> the same order as their private keys in `key`. If the intermediate <add> certificates are not provided, the peer will not be able to validate the <add> certificate, and the handshake will fail. <ide> * `ciphers` {string} Optional cipher suite specification, replacing the <ide> default. For more information, see [modifying the default cipher suite][]. <del> * `honorCipherOrder` {boolean} Attempt to use the server's cipher suite <del> preferences instead of the client's. When `true`, causes <del> `SSL_OP_CIPHER_SERVER_PREFERENCE` to be set in `secureOptions`, see <del> [OpenSSL Options][] for more information. <del> * `ecdhCurve` {string} A string describing a named curve or a colon separated <del> list of curve NIDs or names, for example `P-521:P-384:P-256`, to use for <del> ECDH key agreement, or `false` to disable ECDH. Set to `auto` to select the <del> curve automatically. Use [`crypto.getCurves()`][] to obtain a list of <del> available curve names. On recent releases, `openssl ecparam -list_curves` <del> will also display the name and description of each available elliptic curve. <del> **Default:** [`tls.DEFAULT_ECDH_CURVE`]. <ide> * `clientCertEngine` {string} Optional name of an OpenSSL engine which can <ide> provide the client certificate. <ide> * `crl` {string|string[]|Buffer|Buffer[]} Optional PEM formatted <ide> changes: <ide> error will be thrown. It is strongly recommended to use 2048 bits or larger <ide> for stronger security. If omitted or invalid, the parameters are silently <ide> discarded and DHE ciphers will not be available. <add> * `ecdhCurve` {string} A string describing a named curve or a colon separated <add> list of curve NIDs or names, for example `P-521:P-384:P-256`, to use for <add> ECDH key agreement, or `false` to disable ECDH. Set to `auto` to select the <add> curve automatically. Use [`crypto.getCurves()`][] to obtain a list of <add> available curve names. On recent releases, `openssl ecparam -list_curves` <add> will also display the name and description of each available elliptic curve. <add> **Default:** [`tls.DEFAULT_ECDH_CURVE`]. <add> * `honorCipherOrder` {boolean} Attempt to use the server's cipher suite <add> preferences instead of the client's. When `true`, causes <add> `SSL_OP_CIPHER_SERVER_PREFERENCE` to be set in `secureOptions`, see <add> [OpenSSL Options][] for more information. <add> * `key` {string|string[]|Buffer|Buffer[]|Object[]} Optional private keys in <add> PEM format. PEM allows the option of private keys being encrypted. Encrypted <add> keys will be decrypted with `options.passphrase`. Multiple keys using <add> different algorithms can be provided either as an array of unencrypted key <add> strings or buffers, or an array of objects in the form `{pem: <add> <string|buffer>[, passphrase: <string>]}`. The object form can only occur in <add> an array. `object.passphrase` is optional. Encrypted keys will be decrypted <add> with `object.passphrase` if provided, or `options.passphrase` if it is not. <add> * `passphrase` {string} Optional shared passphrase used for a single private <add> key and/or a PFX. <add> * `pfx` {string|string[]|Buffer|Buffer[]|Object[]} Optional PFX or PKCS12 <add> encoded private key and certificate chain. `pfx` is an alternative to <add> providing `key` and `cert` individually. PFX is usually encrypted, if it is, <add> `passphrase` will be used to decrypt it. Multiple PFX can be provided either <add> as an array of unencrypted PFX buffers, or an array of objects in the form <add> `{buf: <string|buffer>[, passphrase: <string>]}`. The object form can only <add> occur in an array. `object.passphrase` is optional. Encrypted PFX will be <add> decrypted with `object.passphrase` if provided, or `options.passphrase` if <add> it is not. <ide> * `secureOptions` {number} Optionally affect the OpenSSL protocol behavior, <ide> which is not usually necessary. This should be used carefully if at all! <ide> Value is a numeric bitmask of the `SSL_OP_*` options from <ide> changes: <ide> --> <ide> <ide> * `options` {Object} <add> * `ALPNProtocols`: {string[]|Buffer[]|Uint8Array[]|Buffer|Uint8Array} <add> An array of strings, `Buffer`s or `Uint8Array`s, or a single `Buffer` or <add> `Uint8Array` containing the supported ALPN protocols. `Buffer`s should have <add> the format `[len][name][len][name]...` e.g. `0x05hello0x05world`, where the <add> first byte is the length of the next protocol name. Passing an array is <add> usually much simpler, e.g. `['hello', 'world']`. <add> (Protocols should be ordered by their priority.) <ide> * `clientCertEngine` {string} Optional name of an OpenSSL engine which can <ide> provide the client certificate. <ide> * `handshakeTimeout` {number} Abort the connection if the SSL/TLS handshake <ide> does not finish in the specified number of milliseconds. <ide> A `'tlsClientError'` is emitted on the `tls.Server` object whenever <ide> a handshake times out. **Default:** `120000` (120 seconds). <del> * `requestCert` {boolean} If `true` the server will request a certificate from <del> clients that connect and attempt to verify that certificate. **Default:** <del> `false`. <ide> * `rejectUnauthorized` {boolean} If not `false` the server will reject any <ide> connection which is not authorized with the list of supplied CAs. This <ide> option only has an effect if `requestCert` is `true`. **Default:** `true`. <del> * `ALPNProtocols`: {string[]|Buffer[]|Uint8Array[]|Buffer|Uint8Array} <del> An array of strings, `Buffer`s or `Uint8Array`s, or a single `Buffer` or <del> `Uint8Array` containing the supported ALPN protocols. `Buffer`s should have <del> the format `[len][name][len][name]...` e.g. `0x05hello0x05world`, where the <del> first byte is the length of the next protocol name. Passing an array is <del> usually much simpler, e.g. `['hello', 'world']`. <del> (Protocols should be ordered by their priority.) <add> * `requestCert` {boolean} If `true` the server will request a certificate from <add> clients that connect and attempt to verify that certificate. **Default:** <add> `false`. <add> * `sessionTimeout` {number} An integer specifying the number of seconds after <add> which the TLS session identifiers and TLS session tickets created by the <add> server will time out. See [`SSL_CTX_set_timeout`] for more details. <ide> * `SNICallback(servername, cb)` {Function} A function that will be called if <ide> the client supports SNI TLS extension. Two arguments will be passed when <ide> called: `servername` and `cb`. `SNICallback` should invoke `cb(null, ctx)`, <ide> where `ctx` is a `SecureContext` instance. (`tls.createSecureContext(...)` <ide> can be used to get a proper `SecureContext`.) If `SNICallback` wasn't <ide> provided the default callback with high-level API will be used (see below). <del> * `sessionTimeout` {number} An integer specifying the number of seconds after <del> which the TLS session identifiers and TLS session tickets created by the <del> server will time out. See [`SSL_CTX_set_timeout`] for more details. <ide> * `ticketKeys`: A 48-byte `Buffer` instance consisting of a 16-byte prefix, <ide> a 16-byte HMAC key, and a 16-byte AES key. This can be used to accept TLS <ide> session tickets on multiple instances of the TLS server. <del> * ...: Any [`tls.createSecureContext()`][] options can be provided. For <add> * ...: Any [`tls.createSecureContext()`][] option can be provided. For <ide> servers, the identity options (`pfx` or `key`/`cert`) are usually required. <ide> * `secureConnectionListener` {Function} <ide>
1
Javascript
Javascript
improve future tense
2e3388171450f39ed4799123737f7aed4addec8e
<ide><path>src/locale/sk.js <ide> export default moment.defineLocale('sk', { <ide> sameElse: 'L' <ide> }, <ide> relativeTime : { <del> future : 'za %s', <add> future : 'o %s', <ide> past : 'pred %s', <ide> s : translate, <ide> ss : translate, <ide><path>src/test/locale/sk.js <ide> test('from', function (assert) { <ide> }); <ide> <ide> test('suffix', function (assert) { <del> assert.equal(moment(30000).from(0), 'za pár sekúnd', 'prefix'); <add> assert.equal(moment(30000).from(0), 'o pár sekúnd', 'prefix'); <ide> assert.equal(moment(0).from(30000), 'pred pár sekundami', 'suffix'); <ide> }); <ide> <ide> test('now from now', function (assert) { <ide> }); <ide> <ide> test('fromNow (future)', function (assert) { <del> assert.equal(moment().add({s: 30}).fromNow(), 'za pár sekúnd', 'in a few seconds'); <del> assert.equal(moment().add({m: 1}).fromNow(), 'za minútu', 'in a minute'); <del> assert.equal(moment().add({m: 3}).fromNow(), 'za 3 minúty', 'in 3 minutes'); <del> assert.equal(moment().add({m: 10}).fromNow(), 'za 10 minút', 'in 10 minutes'); <del> assert.equal(moment().add({h: 1}).fromNow(), 'za hodinu', 'in an hour'); <del> assert.equal(moment().add({h: 3}).fromNow(), 'za 3 hodiny', 'in 3 hours'); <del> assert.equal(moment().add({h: 10}).fromNow(), 'za 10 hodín', 'in 10 hours'); <del> assert.equal(moment().add({d: 1}).fromNow(), 'za deň', 'in a day'); <del> assert.equal(moment().add({d: 3}).fromNow(), 'za 3 dni', 'in 3 days'); <del> assert.equal(moment().add({d: 10}).fromNow(), 'za 10 dní', 'in 10 days'); <del> assert.equal(moment().add({M: 1}).fromNow(), 'za mesiac', 'in a month'); <del> assert.equal(moment().add({M: 3}).fromNow(), 'za 3 mesiace', 'in 3 months'); <del> assert.equal(moment().add({M: 10}).fromNow(), 'za 10 mesiacov', 'in 10 months'); <del> assert.equal(moment().add({y: 1}).fromNow(), 'za rok', 'in a year'); <del> assert.equal(moment().add({y: 3}).fromNow(), 'za 3 roky', 'in 3 years'); <del> assert.equal(moment().add({y: 10}).fromNow(), 'za 10 rokov', 'in 10 years'); <add> assert.equal(moment().add({s: 30}).fromNow(), 'o pár sekúnd', 'in a few seconds'); <add> assert.equal(moment().add({m: 1}).fromNow(), 'o minútu', 'in a minute'); <add> assert.equal(moment().add({m: 3}).fromNow(), 'o 3 minúty', 'in 3 minutes'); <add> assert.equal(moment().add({m: 10}).fromNow(), 'o 10 minút', 'in 10 minutes'); <add> assert.equal(moment().add({h: 1}).fromNow(), 'o hodinu', 'in an hour'); <add> assert.equal(moment().add({h: 3}).fromNow(), 'o 3 hodiny', 'in 3 hours'); <add> assert.equal(moment().add({h: 10}).fromNow(), 'o 10 hodín', 'in 10 hours'); <add> assert.equal(moment().add({d: 1}).fromNow(), 'o deň', 'in a day'); <add> assert.equal(moment().add({d: 3}).fromNow(), 'o 3 dni', 'in 3 days'); <add> assert.equal(moment().add({d: 10}).fromNow(), 'o 10 dní', 'in 10 days'); <add> assert.equal(moment().add({M: 1}).fromNow(), 'o mesiac', 'in a month'); <add> assert.equal(moment().add({M: 3}).fromNow(), 'o 3 mesiace', 'in 3 months'); <add> assert.equal(moment().add({M: 10}).fromNow(), 'o 10 mesiacov', 'in 10 months'); <add> assert.equal(moment().add({y: 1}).fromNow(), 'o rok', 'in a year'); <add> assert.equal(moment().add({y: 3}).fromNow(), 'o 3 roky', 'in 3 years'); <add> assert.equal(moment().add({y: 10}).fromNow(), 'o 10 rokov', 'in 10 years'); <ide> }); <ide> <ide> test('fromNow (past)', function (assert) { <ide> test('calendar all else', function (assert) { <ide> <ide> test('humanize duration', function (assert) { <ide> assert.equal(moment.duration(1, 'minutes').humanize(), 'minúta', 'a minute (future)'); <del> assert.equal(moment.duration(1, 'minutes').humanize(true), 'za minútu', 'in a minute'); <add> assert.equal(moment.duration(1, 'minutes').humanize(true), 'o minútu', 'in a minute'); <ide> assert.equal(moment.duration(-1, 'minutes').humanize(), 'minúta', 'a minute (past)'); <ide> assert.equal(moment.duration(-1, 'minutes').humanize(true), 'pred minútou', 'a minute ago'); <ide> });
2
Python
Python
fix installation of numarray headers on windows
988678cf6d0eb8459588e1067dd3a91468cbaa2d
<ide><path>numpy/numarray/setup.py <ide> def configuration(parent_package='',top_path=None): <ide> from numpy.distutils.misc_util import Configuration <ide> config = Configuration('numarray',parent_package,top_path) <ide> <del> config.add_data_files('numpy/') <add> config.add_data_files('numpy/*') <ide> <ide> config.add_extension('_capi', <ide> sources=['_capi.c'],
1
Go
Go
fix devmapper backend in docker info
fdc2641c2b329c48cf1d1c8c0b806bec8784b3e0
<ide><path>daemon/graphdriver/devmapper/deviceset.go <ide> type DeviceSet struct { <ide> dataLoopbackSize int64 <ide> metaDataLoopbackSize int64 <ide> baseFsSize uint64 <del> userFilesystem string // FS specified by user using dm.fs <add> filesystem string <ide> mountOptions string <ide> mkfsArgs []string <ide> dataDevice string // block or loop dev <ide> type Status struct { <ide> Metadata DiskUsage <ide> // BaseDeviceSize is base size of container and image <ide> BaseDeviceSize uint64 <add> // BaseDeviceFS is backing filesystem. <add> BaseDeviceFS string <ide> // SectorSize size of the vector. <ide> SectorSize uint64 <ide> // UdevSyncSupported is true if sync is supported. <ide> func (devices *DeviceSet) createFilesystem(info *devInfo) error { <ide> <ide> var err error <ide> <del> fs := devices.userFilesystem <del> if fs == "" { <del> fs = determineDefaultFS() <add> if devices.filesystem == "" { <add> devices.filesystem = determineDefaultFS() <ide> } <ide> <del> switch fs { <add> switch devices.filesystem { <ide> case "xfs": <ide> err = exec.Command("mkfs.xfs", args...).Run() <ide> case "ext4": <ide> func (devices *DeviceSet) createFilesystem(info *devInfo) error { <ide> } <ide> err = exec.Command("tune2fs", append([]string{"-c", "-1", "-i", "0"}, devname)...).Run() <ide> default: <del> err = fmt.Errorf("Unsupported filesystem type %s", fs) <add> err = fmt.Errorf("Unsupported filesystem type %s", devices.filesystem) <ide> } <ide> if err != nil { <ide> return err <ide> func (devices *DeviceSet) getBaseDeviceSize() uint64 { <ide> return info.Size <ide> } <ide> <add>func (devices *DeviceSet) getBaseDeviceFS() string { <add> return devices.filesystem <add>} <add> <ide> func (devices *DeviceSet) verifyBaseDeviceUUIDFS(baseInfo *devInfo) error { <ide> devices.Lock() <ide> defer devices.Unlock() <ide> func (devices *DeviceSet) verifyBaseDeviceUUIDFS(baseInfo *devInfo) error { <ide> // If user specified a filesystem using dm.fs option and current <ide> // file system of base image is not same, warn user that dm.fs <ide> // will be ignored. <del> if devices.userFilesystem != "" { <add> if devices.filesystem != "" { <ide> fs, err := ProbeFsType(baseInfo.DevName()) <ide> if err != nil { <ide> return err <ide> } <ide> <del> if fs != devices.userFilesystem { <del> logrus.Warnf("Base device already exists and has filesystem %s on it. User specified filesystem %s will be ignored.", fs, devices.userFilesystem) <add> if fs != devices.filesystem { <add> logrus.Warnf("Base device already exists and has filesystem %s on it. User specified filesystem %s will be ignored.", fs, devices.filesystem) <add> devices.filesystem = fs <ide> } <ide> } <ide> return nil <ide> func (devices *DeviceSet) Status() *Status { <ide> status.DeferredDeleteEnabled = devices.deferredDelete <ide> status.DeferredDeletedDeviceCount = devices.nrDeletedDevices <ide> status.BaseDeviceSize = devices.getBaseDeviceSize() <add> status.BaseDeviceFS = devices.getBaseDeviceFS() <ide> <ide> totalSizeInSectors, _, dataUsed, dataTotal, metadataUsed, metadataTotal, err := devices.poolStatus() <ide> if err == nil { <ide> func NewDeviceSet(root string, doInit bool, options []string, uidMaps, gidMaps [ <ide> if val != "ext4" && val != "xfs" { <ide> return nil, fmt.Errorf("Unsupported filesystem %s\n", val) <ide> } <del> devices.userFilesystem = val <add> devices.filesystem = val <ide> case "dm.mkfsarg": <ide> devices.mkfsArgs = append(devices.mkfsArgs, val) <ide> case "dm.mountopt": <ide><path>daemon/graphdriver/devmapper/driver.go <ide> func (d *Driver) Status() [][2]string { <ide> {"Pool Name", s.PoolName}, <ide> {"Pool Blocksize", fmt.Sprintf("%s", units.HumanSize(float64(s.SectorSize)))}, <ide> {"Base Device Size", fmt.Sprintf("%s", units.HumanSize(float64(s.BaseDeviceSize)))}, <del> {"Backing Filesystem", backingFs}, <add> {"Backing Filesystem", s.BaseDeviceFS}, <ide> {"Data file", s.DataFile}, <ide> {"Metadata file", s.MetadataFile}, <ide> {"Data Space Used", fmt.Sprintf("%s", units.HumanSize(float64(s.Data.Used)))},
2
PHP
PHP
fix deprecation message for request->here usage
a2d5a5ab9d45d02d9d5b5542474b2441efcf846f
<ide><path>src/Http/ServerRequest.php <ide> class ServerRequest implements ArrayAccess, ServerRequestInterface <ide> 'url' => ['get' => 'getPath()', 'set' => 'withRequestTarget()'], <ide> 'base' => ['get' => 'getAttribute("base")', 'set' => 'withAttribute("base")'], <ide> 'webroot' => ['get' => 'getAttribute("webroot")', 'set' => 'withAttribute("webroot")'], <del> 'here' => ['get' => 'getRequestTarget()', 'set' => 'withRequestTarget()'], <add> 'here' => ['get' => 'getAttribute("here")', 'set' => 'withAttribute("here")'], <ide> ]; <ide> <ide> /**
1
Javascript
Javascript
use factory method to create worker executor
dcca74ab92947b1b2c7c8fc12f92784abf3b2c51
<ide><path>client/src/templates/Challenges/rechallenge/transformers.js <ide> import presetReact from '@babel/preset-react'; <ide> import protect from 'loop-protect'; <ide> <ide> import * as vinyl from '../utils/polyvinyl.js'; <del>import WorkerExecutor from '../utils/worker-executor'; <add>import createWorker from '../utils/worker-executor'; <ide> <ide> const protectTimeout = 100; <ide> Babel.registerPlugin('loopProtection', protect(protectTimeout)); <ide> export const babelTransformer = cond([ <ide> [stubTrue, identity] <ide> ]); <ide> <del>const sassWorker = new WorkerExecutor('sass-compile'); <add>const sassWorker = createWorker('sass-compile'); <ide> async function transformSASS(element) { <ide> const styleTags = element.querySelectorAll('style[type="text/sass"]'); <ide> await Promise.all( <ide><path>client/src/templates/Challenges/redux/execute-challenge-saga.js <ide> import { <ide> <ide> import { challengeTypes } from '../../../../utils/challengeTypes'; <ide> <del>import WorkerExecutor from '../utils/worker-executor'; <add>import createWorker from '../utils/worker-executor'; <ide> import { <ide> createMainFramer, <ide> createTestFramer, <ide> runTestInTestFrame <ide> } from '../utils/frame.js'; <ide> <del>const testWorker = new WorkerExecutor('test-evaluator'); <add>const testWorker = createWorker('test-evaluator'); <ide> const testTimeout = 5000; <ide> <ide> function* ExecuteChallengeSaga() { <ide><path>client/src/templates/Challenges/utils/worker-executor.js <ide> import { homeLocation } from '../../../../config/env.json'; <ide> <del>export default class WorkerExecutor { <add>class WorkerExecutor { <ide> constructor(workerName) { <ide> this.workerName = workerName; <ide> this.worker = null; <ide> export default class WorkerExecutor { <ide> } <ide> } <ide> } <add> <add>export default function createWorkerExecutor(workerName) { <add> return new WorkerExecutor(workerName); <add>}
3
Java
Java
implement limit to execute pre-mount operations
ed8573f957f4dfa1ffd76df965867aaf0a7282a3
<ide><path>ReactAndroid/src/main/java/com/facebook/react/fabric/FabricUIManager.java <ide> import android.support.annotation.GuardedBy; <ide> import android.support.annotation.Nullable; <ide> import android.support.annotation.UiThread; <add>import android.util.Log; <ide> import android.view.View; <ide> import com.facebook.common.logging.FLog; <ide> import com.facebook.infer.annotation.Assertions; <ide> import com.facebook.react.uimanager.ViewManagerRegistry; <ide> import com.facebook.react.uimanager.events.EventDispatcher; <ide> import com.facebook.systrace.Systrace; <add>import java.util.ArrayDeque; <ide> import java.util.ArrayList; <ide> import java.util.HashMap; <ide> import java.util.List; <ide> public class FabricUIManager implements UIManager, LifecycleEventListener { <ide> private static final String TAG = FabricUIManager.class.getSimpleName(); <ide> <ide> private static final Map<String, String> sComponentNames = new HashMap<>(); <add> private static final int FRAME_TIME_MS = 16; <add> private static final int MAX_TIME_IN_FRAME_FOR_NON_BATCHED_OPERATIONS_MS = 8; <ide> <ide> static { <ide> FabricSoLoader.staticInit(); <ide> public class FabricUIManager implements UIManager, LifecycleEventListener { <ide> private List<MountItem> mMountItems = new ArrayList<>(); <ide> <ide> @GuardedBy("mPreMountItemsLock") <del> private List<MountItem> mPreMountItems = new ArrayList<>(); <add> private ArrayDeque<MountItem> mPreMountItems = new ArrayDeque<>(); <ide> <ide> @ThreadConfined(UI) <ide> private final DispatchUIFrameCallback mDispatchUIFrameCallback; <ide> private void scheduleMountItems( <ide> } <ide> <ide> if (UiThreadUtil.isOnUiThread()) { <del> flushMountItems(); <add> dispatchMountItems(); <ide> } <ide> } <ide> <ide> @UiThread <del> private void flushMountItems() { <del> if (!mIsMountingEnabled) { <del> FLog.w( <del> ReactConstants.TAG, <del> "Not flushing pending UI operations because of previously thrown Exception"); <del> return; <add> private void dispatchMountItems() { <add> mRunStartTime = SystemClock.uptimeMillis(); <add> List<MountItem> mountItemsToDispatch; <add> synchronized (mMountItemsLock) { <add> mountItemsToDispatch = mMountItems; <add> mMountItems = new ArrayList<>(); <ide> } <ide> <del> try { <del> List<MountItem> preMountItemsToDispatch; <del> synchronized (mPreMountItemsLock) { <del> preMountItemsToDispatch = mPreMountItems; <del> mPreMountItems = new ArrayList<>(); <del> } <add> Systrace.beginSection( <add> Systrace.TRACE_TAG_REACT_JAVA_BRIDGE, <add> "FabricUIManager::mountViews (" + mountItemsToDispatch.size() + " batches)"); <ide> <del> mRunStartTime = SystemClock.uptimeMillis(); <del> List<MountItem> mountItemsToDispatch; <del> synchronized (mMountItemsLock) { <del> mountItemsToDispatch = mMountItems; <del> mMountItems = new ArrayList<>(); <del> } <add> long batchedExecutionStartTime = SystemClock.uptimeMillis(); <add> for (MountItem mountItem : mountItemsToDispatch) { <add> mountItem.execute(mMountingManager); <add> } <add> mBatchedExecutionTime = SystemClock.uptimeMillis() - batchedExecutionStartTime; <add> Systrace.endSection(Systrace.TRACE_TAG_REACT_JAVA_BRIDGE); <add> } <ide> <del> long nonBatchedExecutionStartTime = SystemClock.uptimeMillis(); <del> Systrace.beginSection( <del> Systrace.TRACE_TAG_REACT_JAVA_BRIDGE, <del> "FabricUIManager::premountViews (" + preMountItemsToDispatch.size() + " batches)"); <del> for (MountItem mountItem : preMountItemsToDispatch) { <del> mountItem.execute(mMountingManager); <add> @UiThread <add> private void dispatchPreMountItems(long frameTimeNanos) { <add> long nonBatchedExecutionStartTime = SystemClock.uptimeMillis(); <add> Systrace.beginSection( <add> Systrace.TRACE_TAG_REACT_JAVA_BRIDGE, <add> "FabricUIManager::premountViews"); <add> <add> while (true) { <add> long timeLeftInFrame = FRAME_TIME_MS - ((System.nanoTime() - frameTimeNanos) / 1000000); <add> if (timeLeftInFrame < MAX_TIME_IN_FRAME_FOR_NON_BATCHED_OPERATIONS_MS) { <add> break; <ide> } <del> mNonBatchedExecutionTime = SystemClock.uptimeMillis() - nonBatchedExecutionStartTime; <del> Systrace.endSection(Systrace.TRACE_TAG_REACT_JAVA_BRIDGE); <ide> <del> Systrace.beginSection( <del> Systrace.TRACE_TAG_REACT_JAVA_BRIDGE, <del> "FabricUIManager::mountViews (" + mountItemsToDispatch.size() + " batches)"); <del> <del> long batchedExecutionStartTime = SystemClock.uptimeMillis(); <del> for (MountItem mountItem : mountItemsToDispatch) { <del> mountItem.execute(mMountingManager); <add> MountItem preMountItemsToDispatch; <add> synchronized (mPreMountItemsLock) { <add> if (mPreMountItems.isEmpty()) { <add> break; <add> } <add> preMountItemsToDispatch = mPreMountItems.pollFirst(); <ide> } <del> mBatchedExecutionTime = SystemClock.uptimeMillis() - batchedExecutionStartTime; <del> Systrace.endSection(Systrace.TRACE_TAG_REACT_JAVA_BRIDGE); <del> } catch (Exception ex) { <del> FLog.e(ReactConstants.TAG, "Exception thrown when executing UIFrameGuarded", ex); <del> mIsMountingEnabled = false; <del> throw ex; <add> <add> preMountItemsToDispatch.execute(mMountingManager); <ide> } <add> mNonBatchedExecutionTime = SystemClock.uptimeMillis() - nonBatchedExecutionStartTime; <add> Systrace.endSection(Systrace.TRACE_TAG_REACT_JAVA_BRIDGE); <ide> } <ide> <ide> public void setBinding(Binding binding) { <ide> public void doFrameGuarded(long frameTimeNanos) { <ide> } <ide> <ide> try { <del> flushMountItems(); <add> <add> dispatchPreMountItems(frameTimeNanos); <add> <add> dispatchMountItems(); <add> <ide> } catch (Exception ex) { <ide> FLog.i(ReactConstants.TAG, "Exception thrown when executing UIFrameGuarded", ex); <ide> mIsMountingEnabled = false;
1
Go
Go
print everything except progress in non-terminal
aeeb0d59d3ed40c3b0d9cecd3c19a52f005dd140
<ide><path>utils/jsonmessage.go <ide> func (jm *JSONMessage) Display(out io.Writer, isTerminal bool) error { <ide> // <ESC>[2K = erase entire current line <ide> fmt.Fprintf(out, "%c[2K\r", 27) <ide> endl = "\r" <del> } else if jm.Progress != nil { //disable progressbar in non-terminal <add> } else if jm.Progress != nil && jm.Progress.String() != "" { //disable progressbar in non-terminal <ide> return nil <ide> } <ide> if jm.Time != 0 { <ide> func (jm *JSONMessage) Display(out io.Writer, isTerminal bool) error { <ide> if jm.From != "" { <ide> fmt.Fprintf(out, "(from %s) ", jm.From) <ide> } <del> if jm.Progress != nil { <add> if jm.Progress != nil && isTerminal { <ide> fmt.Fprintf(out, "%s %s%s", jm.Status, jm.Progress.String(), endl) <ide> } else if jm.ProgressMessage != "" { //deprecated <ide> fmt.Fprintf(out, "%s %s%s", jm.Status, jm.ProgressMessage, endl)
1
Python
Python
add solution() for problem 54 of project euler
08eb1efafe01c89f83914d8792ef0dc849f92360
<ide><path>project_euler/problem_54/sol1.py <ide> """ <ide> from __future__ import annotations <ide> <add>import os <add> <ide> <ide> class PokerHand(object): <ide> """Create an object representing a Poker Hand based on an input of a <ide> def __ge__(self, other): <ide> <ide> def __hash__(self): <ide> return object.__hash__(self) <add> <add> <add>def solution() -> int: <add> # Solution for problem number 54 from Project Euler <add> # Input from poker_hands.txt file <add> answer = 0 <add> script_dir = os.path.abspath(os.path.dirname(__file__)) <add> poker_hands = os.path.join(script_dir, "poker_hands.txt") <add> with open(poker_hands, "r") as file_hand: <add> for line in file_hand: <add> player_hand = line[:14].strip() <add> opponent_hand = line[15:].strip() <add> player, opponent = PokerHand(player_hand), PokerHand(opponent_hand) <add> output = player.compare_with(opponent) <add> if output == "Win": <add> answer += 1 <add> return answer <add> <add> <add>if __name__ == "__main__": <add> solution()
1
Python
Python
add override method to taskgroupdecorator
b815e221e828aa039e166378c3e393d144b174e8
<ide><path>airflow/decorators/task_group.py <ide> def __call__(self, *args, **kwargs) -> Union[R, TaskGroup]: <ide> # start >> tg >> end <ide> return task_group <ide> <add> def override(self, **kwargs: Any) -> "TaskGroupDecorator[R]": <add> return attr.evolve(self, kwargs={**self.kwargs, **kwargs}) <add> <ide> <ide> class Group(Generic[F]): <ide> """Declaration of a @task_group-decorated callable for type-checking. <ide><path>tests/decorators/test_task_group.py <add># <add># Licensed to the Apache Software Foundation (ASF) under one <add># or more contributor license agreements. See the NOTICE file <add># distributed with this work for additional information <add># regarding copyright ownership. The ASF licenses this file <add># to you under the Apache License, Version 2.0 (the <add># "License"); you may not use this file except in compliance <add># with the License. You may obtain a copy of the License at <add># <add># http://www.apache.org/licenses/LICENSE-2.0 <add># <add># Unless required by applicable law or agreed to in writing, <add># software distributed under the License is distributed on an <add># "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY <add># KIND, either express or implied. See the License for the <add># specific language governing permissions and limitations <add># under the License. <add> <add>from airflow.decorators import task_group <add> <add> <add>def test_task_group_with_overridden_kwargs(): <add> @task_group( <add> default_args={ <add> 'params': { <add> 'x': 5, <add> 'y': 5, <add> }, <add> }, <add> add_suffix_on_collision=True, <add> ) <add> def simple_tg(): <add> ... <add> <add> tg_with_overridden_kwargs = simple_tg.override( <add> group_id='custom_group_id', <add> default_args={ <add> 'params': { <add> 'x': 10, <add> }, <add> }, <add> ) <add> <add> assert tg_with_overridden_kwargs.kwargs == { <add> 'group_id': 'custom_group_id', <add> 'default_args': { <add> 'params': { <add> 'x': 10, <add> }, <add> }, <add> 'add_suffix_on_collision': True, <add> }
2
Text
Text
add space after ellipses
86287bffd4ed4e29bda8df9c4a6acb85c574efaf
<ide><path>starter/README.md <ide> # Welcome to React! <ide> <del>You've just downloaded the React starter kit...Congratulations! <add>You've just downloaded the React starter kit... Congratulations! <ide> <ide> To begin, check out the `examples/` directory for a bunch of examples, or check out [Getting Started](http://facebook.github.io/react/docs/getting-started.html) for more information. <ide>
1
Java
Java
avoid store all bean name
d494621ee3d2e0d6c706f401028b0bbd62491495
<ide><path>spring-context/src/main/java/org/springframework/context/support/ApplicationListenerDetector.java <ide> public ApplicationListenerDetector(AbstractApplicationContext applicationContext <ide> <ide> @Override <ide> public void postProcessMergedBeanDefinition(RootBeanDefinition beanDefinition, Class<?> beanType, String beanName) { <del> this.singletonNames.put(beanName, beanDefinition.isSingleton()); <add> if (ApplicationListener.class.isAssignableFrom(beanType)) { <add> this.singletonNames.put(beanName, beanDefinition.isSingleton()); <add> } <ide> } <ide> <ide> @Override
1
Go
Go
add docker create tests
b0cb37fd3bd65b27a63954b36507a9782088cfc4
<ide><path>api/client/commands.go <ide> func (cid *cidFile) Close() error { <ide> <ide> if !cid.written { <ide> if err := os.Remove(cid.path); err != nil { <del> return fmt.Errorf("failed to remove CID file '%s': %s \n", cid.path, err) <add> return fmt.Errorf("failed to remove the CID file '%s': %s \n", cid.path, err) <ide> } <ide> } <ide> <ide> func (cli *DockerCli) CmdRun(args ...string) error { <ide> // These are flags not stored in Config/HostConfig <ide> var ( <ide> flAutoRemove = cmd.Bool([]string{"#rm", "-rm"}, false, "Automatically remove the container when it exits (incompatible with -d)") <del> flDetach = cmd.Bool([]string{"d", "-detach"}, false, "Detached mode: run container in the background and print new container ID") <add> flDetach = cmd.Bool([]string{"d", "-detach"}, false, "Detached mode: run the container in the background and print the new container ID") <ide> flSigProxy = cmd.Bool([]string{"#sig-proxy", "-sig-proxy"}, true, "Proxy received signals to the process (even in non-TTY mode). SIGCHLD, SIGSTOP, and SIGKILL are not proxied.") <ide> flName = cmd.String([]string{"#name", "-name"}, "", "Assign a name to the container") <ide> <ide><path>integration-cli/docker_cli_create_test.go <add>package main <add> <add>import ( <add> "encoding/json" <add> "fmt" <add> "os/exec" <add> "testing" <add> "time" <add>) <add> <add>// Make sure we can create a simple container with some args <add>func TestDockerCreateArgs(t *testing.T) { <add> runCmd := exec.Command(dockerBinary, "create", "busybox", "command", "arg1", "arg2", "arg with space") <add> out, _, _, err := runCommandWithStdoutStderr(runCmd) <add> errorOut(err, t, out) <add> <add> cleanedContainerID := stripTrailingCharacters(out) <add> <add> inspectCmd := exec.Command(dockerBinary, "inspect", cleanedContainerID) <add> inspectOut, _, err := runCommandWithOutput(inspectCmd) <add> errorOut(err, t, fmt.Sprintf("out should've been a container id: %v %v", inspectOut, err)) <add> <add> containers := []struct { <add> ID string <add> Created time.Time <add> Path string <add> Args []string <add> Image string <add> }{} <add> if err := json.Unmarshal([]byte(inspectOut), &containers); err != nil { <add> t.Fatalf("Error inspecting the container: %s", err) <add> } <add> if len(containers) != 1 { <add> t.Fatalf("Unexpected container count. Expected 0, received: %d", len(containers)) <add> } <add> <add> c := containers[0] <add> if c.Path != "command" { <add> t.Fatalf("Unexpected container path. Expected command, received: %s", c.Path) <add> } <add> <add> b := false <add> expected := []string{"arg1", "arg2", "arg with space"} <add> for i, arg := range expected { <add> if arg != c.Args[i] { <add> b = true <add> break <add> } <add> } <add> if len(c.Args) != len(expected) || b { <add> t.Fatalf("Unexpected args. Expected %v, received: %v", expected, c.Args) <add> } <add> <add> deleteAllContainers() <add> <add> logDone("create - args") <add>} <add> <add>// Make sure we can set hostconfig options too <add>func TestDockerCreateHostConfig(t *testing.T) { <add> runCmd := exec.Command(dockerBinary, "create", "-P", "busybox", "echo") <add> out, _, _, err := runCommandWithStdoutStderr(runCmd) <add> errorOut(err, t, out) <add> <add> cleanedContainerID := stripTrailingCharacters(out) <add> <add> inspectCmd := exec.Command(dockerBinary, "inspect", cleanedContainerID) <add> inspectOut, _, err := runCommandWithOutput(inspectCmd) <add> errorOut(err, t, fmt.Sprintf("out should've been a container id: %v %v", inspectOut, err)) <add> <add> containers := []struct { <add> HostConfig *struct { <add> PublishAllPorts bool <add> } <add> }{} <add> if err := json.Unmarshal([]byte(inspectOut), &containers); err != nil { <add> t.Fatalf("Error inspecting the container: %s", err) <add> } <add> if len(containers) != 1 { <add> t.Fatalf("Unexpected container count. Expected 0, received: %d", len(containers)) <add> } <add> <add> c := containers[0] <add> if c.HostConfig == nil { <add> t.Fatalf("Expected HostConfig, got none") <add> } <add> <add> if !c.HostConfig.PublishAllPorts { <add> t.Fatalf("Expected PublishAllPorts, got false") <add> } <add> <add> deleteAllContainers() <add> <add> logDone("create - hostconfig") <add>} <add> <add>// "test123" should be printed by docker create + start <add>func TestDockerCreateEchoStdout(t *testing.T) { <add> runCmd := exec.Command(dockerBinary, "create", "busybox", "echo", "test123") <add> out, _, _, err := runCommandWithStdoutStderr(runCmd) <add> errorOut(err, t, out) <add> <add> cleanedContainerID := stripTrailingCharacters(out) <add> <add> runCmd = exec.Command(dockerBinary, "start", "-ai", cleanedContainerID) <add> out, _, _, err = runCommandWithStdoutStderr(runCmd) <add> errorOut(err, t, out) <add> <add> if out != "test123\n" { <add> t.Errorf("container should've printed 'test123', got '%s'", out) <add> } <add> <add> deleteAllContainers() <add> <add> logDone("create - echo test123") <add>}
2
Go
Go
pass info rather than hash to deactivatedevice()
5955846774c9b43291d6de0584fa8c3f62414c43
<ide><path>runtime/graphdriver/devmapper/deviceset.go <ide> func (devices *DeviceSet) deactivatePool() error { <ide> return nil <ide> } <ide> <del>func (devices *DeviceSet) deactivateDevice(hash string) error { <del> utils.Debugf("[devmapper] deactivateDevice(%s)", hash) <add>func (devices *DeviceSet) deactivateDevice(info *DevInfo) error { <add> utils.Debugf("[devmapper] deactivateDevice(%s)", info.Hash) <ide> defer utils.Debugf("[devmapper] deactivateDevice END") <ide> <ide> // Wait for the unmount to be effective, <ide> // by watching the value of Info.OpenCount for the device <del> if err := devices.waitClose(hash); err != nil { <del> utils.Errorf("Warning: error waiting for device %s to close: %s\n", hash, err) <add> if err := devices.waitClose(info); err != nil { <add> utils.Errorf("Warning: error waiting for device %s to close: %s\n", info.Hash, err) <ide> } <ide> <del> info := devices.Devices[hash] <del> if info == nil { <del> return fmt.Errorf("Unknown device %s", hash) <del> } <ide> devinfo, err := getInfo(info.Name()) <ide> if err != nil { <ide> utils.Debugf("\n--->Err: %s\n", err) <ide> func (devices *DeviceSet) waitRemove(devname string) error { <ide> // waitClose blocks until either: <ide> // a) the device registered at <device_set_prefix>-<hash> is closed, <ide> // or b) the 10 second timeout expires. <del>func (devices *DeviceSet) waitClose(hash string) error { <del> info := devices.Devices[hash] <del> if info == nil { <del> return fmt.Errorf("Unknown device %s", hash) <del> } <add>func (devices *DeviceSet) waitClose(info *DevInfo) error { <ide> i := 0 <ide> for ; i < 1000; i += 1 { <ide> devinfo, err := getInfo(info.Name()) <ide> if err != nil { <ide> return err <ide> } <ide> if i%100 == 0 { <del> utils.Debugf("Waiting for unmount of %s: opencount=%d", hash, devinfo.OpenCount) <add> utils.Debugf("Waiting for unmount of %s: opencount=%d", info.Hash, devinfo.OpenCount) <ide> } <ide> if devinfo.OpenCount == 0 { <ide> break <ide> func (devices *DeviceSet) waitClose(hash string) error { <ide> devices.Lock() <ide> } <ide> if i == 1000 { <del> return fmt.Errorf("Timeout while waiting for device %s to close", hash) <add> return fmt.Errorf("Timeout while waiting for device %s to close", info.Hash) <ide> } <ide> return nil <ide> } <ide> func (devices *DeviceSet) Shutdown() error { <ide> utils.Debugf("Shutdown unmounting %s, error: %s\n", info.mountPath, err) <ide> } <ide> <del> if err := devices.deactivateDevice(info.Hash); err != nil { <add> if err := devices.deactivateDevice(info); err != nil { <ide> utils.Debugf("Shutdown deactivate %s , error: %s\n", info.Hash, err) <ide> } <ide> } <ide> info.lock.Unlock() <ide> } <ide> <del> if err := devices.deactivateDevice(""); err != nil { <del> utils.Debugf("Shutdown deactivate base , error: %s\n", err) <add> info := devices.Devices[""] <add> if info != nil { <add> if err := devices.deactivateDevice(info); err != nil { <add> utils.Debugf("Shutdown deactivate base , error: %s\n", err) <add> } <ide> } <ide> <ide> if err := devices.deactivatePool(); err != nil { <ide> func (devices *DeviceSet) UnmountDevice(hash string, mode UnmountMode) error { <ide> } <ide> utils.Debugf("[devmapper] Unmount done") <ide> <del> if err := devices.deactivateDevice(hash); err != nil { <add> if err := devices.deactivateDevice(info); err != nil { <ide> return err <ide> } <ide>
1
PHP
PHP
fix a cs issue
c2521b4d3d4ab5680471826feac7b5530ed6892a
<ide><path>src/Console/ConsoleInputOption.php <ide> public function __construct( <ide> $default = '', <ide> $choices = [], <ide> $multiple = false <del> ) <del> { <add> ) { <ide> if (is_array($name) && isset($name['name'])) { <ide> foreach ($name as $key => $value) { <ide> $this->{'_' . $key} = $value;
1
Ruby
Ruby
fix rubocop style
776785459be67096efd0331c2d69f6133ab18dff
<ide><path>Library/Homebrew/test/test_audit.rb <ide> def teardown <ide> <ide> def formula_auditor(name, text, options = {}) <ide> path = Pathname.new "#{@dir}/#{name}.rb" <del> path.open("w") { |f| f.write text } <add> path.open("w") do |f| <add> f.write text <add> end <ide> FormulaAuditor.new Formulary.factory(path), options <ide> end <ide>
1
Javascript
Javascript
create tag after building cdn files
9aacb89f363dcaacfffcfe794ecf54b2c49e5b19
<ide><path>build/release.js <ide> steps( <ide> checkGitStatus, <ide> setReleaseVersion, <ide> gruntBuild, <del> createTag, <ide> makeReleaseCopies, <ide> copyTojQueryCDN, <ide> buildGoogleCDN, <ide> buildMicrosoftCDN, <add> createTag, <ide> setNextVersion, <ide> pushToGithub, <del> publishToNpm, <add> // publishToNpm, <ide> exit <ide> ); <ide> <ide> function commitDistFiles( next ) { <ide> fs.writeFileSync( "package.json", JSON.stringify( pkgClone, null, "\t" ) ); <ide> fs.unlinkSync( ".gitignore" ); <ide> // Add files to be committed <del> git( [ "add", "package.json", "dist", sizzleLoc ], function() { <add> git( [ "add", "package.json", devFile, minFile, mapFile, sizzleLoc ], function() { <ide> // Remove unneeded files <ide> git( [ "rm", "-r", <ide> "build", <ide> function commitDistFiles( next ) { <ide> "Gruntfile.js", <ide> "README.md" <ide> ], function() { <del> git( [ "commit", "-a", "-m", releaseVersion ], next, debug ); <add> git( [ "commit", "-m", releaseVersion ], next, debug ); <ide> }, debug ); <ide> }, debug ); <ide> } <ide> function makeArchive( cdn, files, fn ) { <ide> <ide> /* NPM <ide> ---------------------------------------------------------------------- */ <add>/* <ide> function publishToNpm( next ) { <ide> // Only publish the master branch to NPM <ide> // You must be the jquery npm user for this not to fail <ide> function publishToNpm( next ) { <ide> }, debug || skipRemote ); <ide> }, debug ); <ide> }, debug); <del>} <add>}*/ <ide> <ide> /* Death <ide> ---------------------------------------------------------------------- */
1
Ruby
Ruby
remove unused exception; closes homebrew/homebrew
4abf49367006f3d695efddbc04de7b308fc99528
<ide><path>Library/Homebrew/cmd/create.rb <ide> def version <ide> <ide> def generate <ide> raise "#{path} already exists" if path.exist? <del> raise VersionUndetermined if version.nil? <ide> <ide> require 'digest' <ide> require 'erb'
1
Javascript
Javascript
add more of the node semantics
9a8095eab8dfcea29476028e8c15a3aa744641e0
<ide><path>test/cases/parsing/issue-4940/index.js <ide> define("local-module-non-object", ["local-side-effect"], function (sideEffect) { <ide> it("should create dependency when require is called with 'new' (object export)", function() { <ide> const result = new require("./object-export"); <ide> result.foo.should.equal("bar"); <add> result.should.equal(require("./object-export")); <ide> }); <ide> <ide> it("should create dependency when require is called with 'new' (non-object export)", function() { <ide> const sideEffect = require("./sideEffect"); <ide> const result = new require("./non-object-export"); <ide> result.should.instanceof(__webpack_require__); <ide> sideEffect.foo.should.equal("bar"); <add> result.should.not.equal(require("./non-object-export")); <ide> }); <ide> <ide> it("should create dependency with 'new' on a local dependency (object export)", function() { <ide> const result = new require("local-module-object"); <ide> result.foo.should.equal("bar"); <add> result.should.equal(require("local-module-object")); <ide> }); <ide> <ide> it("shouldn't fail with a local dependency (non-object export)", function() {
1
Java
Java
fix resolvabletype hashcode generation
ab2949f2b7149db155cdee661a4ce1baf3362ef0
<ide><path>spring-core/src/main/java/org/springframework/core/ResolvableType.java <ide> public boolean equals(Object obj) { <ide> @Override <ide> public int hashCode() { <ide> int hashCode = ObjectUtils.nullSafeHashCode(this.type); <del> hashCode = hashCode * 31 + ObjectUtils.nullSafeHashCode(this.variableResolver); <add> hashCode = hashCode * 31 + ObjectUtils.nullSafeHashCode( <add> this.variableResolver == null ? null : this.variableResolver.getSource()); <ide> hashCode = hashCode * 31 + ObjectUtils.nullSafeHashCode(this.componentType); <ide> return hashCode; <ide> }
1
Javascript
Javascript
fix valgrind uninitialized memory warning
ac70bc82404ec60a71e651a9e16dd4910c020b72
<ide><path>test/parallel/test-buffer.js <ide> assert.equal(buf[4], 0); <ide> <ide> // Check for fractional length args, junk length args, etc. <ide> // https://github.com/joyent/node/issues/1758 <del>Buffer(3.3).toString(); // throws bad argument error in commit 43cb4ec <add> <add>// Call .fill() first, stops valgrind warning about uninitialized memory reads. <add>Buffer(3.3).fill().toString(); // throws bad argument error in commit 43cb4ec <ide> assert.equal(Buffer(-1).length, 0); <ide> assert.equal(Buffer(NaN).length, 0); <ide> assert.equal(Buffer(3.3).length, 3);
1
Java
Java
fix javadoc reference to throwsadvice
00375df4e8acc97f88c96cfaf5e4c0c44e7f8960
<ide><path>spring-aop/src/main/java/org/springframework/aop/framework/adapter/ThrowsAdviceAdapter.java <ide> import org.springframework.aop.ThrowsAdvice; <ide> <ide> /** <del> * Adapter to enable {@link org.springframework.aop.MethodBeforeAdvice} <add> * Adapter to enable {@link org.springframework.aop.ThrowsAdvice} <ide> * to be used in the Spring AOP framework. <ide> * <ide> * @author Rod Johnson
1
Ruby
Ruby
fix comment about which mail headers are excluded
738be4457b964fe5e46d2eb7797e9055c4876de8
<ide><path>actionmailer/lib/action_mailer/base.rb <ide> def mail(headers = {}, &block) <ide> # Set configure delivery behavior <ide> wrap_delivery_behavior!(headers.delete(:delivery_method), headers.delete(:delivery_method_options)) <ide> <del> # Assign all headers except parts_order, content_type and body <add> # Assign all headers except parts_order, content_type, body, template_name, and template_path <ide> assignable = headers.except(:parts_order, :content_type, :body, :template_name, :template_path) <ide> assignable.each { |k, v| m[k] = v } <ide>
1
Ruby
Ruby
convert acceptlist to a regular class
f8c9ef8401ab11db5f64fc1e13e8b1fe5a0803ce
<ide><path>actionpack/lib/action_dispatch/http/mime_type.rb <ide> def <=>(item) <ide> end <ide> end <ide> <del> class AcceptList < Array #:nodoc: <del> def assort! <del> sort! <add> class AcceptList #:nodoc: <add> def self.sort!(list) <add> list.sort! <ide> <del> text_xml_idx = find_item_by_name self, 'text/xml' <del> app_xml_idx = find_item_by_name self, Mime[:xml].to_s <add> text_xml_idx = find_item_by_name list, 'text/xml' <add> app_xml_idx = find_item_by_name list, Mime[:xml].to_s <ide> <ide> # Take care of the broken text/xml entry by renaming or deleting it <ide> if text_xml_idx && app_xml_idx <del> app_xml = self[app_xml_idx] <del> text_xml = self[text_xml_idx] <add> app_xml = list[app_xml_idx] <add> text_xml = list[text_xml_idx] <ide> <ide> app_xml.q = [text_xml.q, app_xml.q].max # set the q value to the max of the two <ide> if app_xml_idx > text_xml_idx # make sure app_xml is ahead of text_xml in the list <del> self[app_xml_idx], self[text_xml_idx] = text_xml, app_xml <add> list[app_xml_idx], list[text_xml_idx] = text_xml, app_xml <ide> app_xml_idx, text_xml_idx = text_xml_idx, app_xml_idx <ide> end <del> delete_at(text_xml_idx) # delete text_xml from the list <add> list.delete_at(text_xml_idx) # delete text_xml from the list <ide> elsif text_xml_idx <del> self[text_xml_idx].name = Mime[:xml].to_s <add> list[text_xml_idx].name = Mime[:xml].to_s <ide> end <ide> <ide> # Look for more specific XML-based types and sort them ahead of app/xml <ide> if app_xml_idx <del> app_xml = self[app_xml_idx] <add> app_xml = list[app_xml_idx] <ide> idx = app_xml_idx <ide> <del> while idx < length <del> type = self[idx] <add> while idx < list.length <add> type = list[idx] <ide> break if type.q < app_xml.q <ide> <ide> if type.name.ends_with? '+xml' <del> self[app_xml_idx], self[idx] = self[idx], app_xml <add> list[app_xml_idx], list[idx] = list[idx], app_xml <ide> app_xml_idx = idx <ide> end <ide> idx += 1 <ide> end <ide> end <ide> <del> map! { |i| Mime::Type.lookup(i.name) }.uniq! <del> to_a <add> list.map! { |i| Mime::Type.lookup(i.name) }.uniq! <add> list <ide> end <ide> <del> private <del> def find_item_by_name(array, name) <add> def self.find_item_by_name(array, name) <ide> array.index { |item| item.name == name } <ide> end <ide> end <ide> def parse(accept_header) <ide> accept_header = accept_header.split(PARAMETER_SEPARATOR_REGEXP).first <ide> parse_trailing_star(accept_header) || [Mime::Type.lookup(accept_header)].compact <ide> else <del> list, index = AcceptList.new, 0 <add> list, index = [], 0 <ide> accept_header.split(',').each do |header| <ide> params, q = header.split(PARAMETER_SEPARATOR_REGEXP) <ide> if params.present? <ide> def parse(accept_header) <ide> end <ide> end <ide> end <del> list.assort! <add> AcceptList.sort! list <ide> end <ide> end <ide>
1
Javascript
Javascript
fix normalization of unc paths
bc9388342f59ed5c69d69c7095e5a17fcbd80ba8
<ide><path>lib/path.js <ide> if (isWindows) { <ide> // Regex to split a windows path into three parts: [*, device, slash, <ide> // tail] windows-only <ide> var splitDeviceRe = <del> /^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/][^\\\/]+)?([\\\/])?([\s\S]*?)$/; <add> /^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/; <ide> <ide> // Regex to split the tail part of the above into [*, dir, basename, ext] <ide> var splitTailRe = <ide> if (isWindows) { <ide> return [device, dir, basename, ext]; <ide> }; <ide> <add> var normalizeUNCRoot = function(device) { <add> return '\\\\' + device.replace(/^[\\\/]+/, '').replace(/[\\\/]+/g, '\\'); <add> } <add> <ide> // path.resolve([from ...], to) <ide> // windows version <ide> exports.resolve = function() { <ide> if (isWindows) { <ide> } <ide> } <ide> <del> // Replace slashes (in UNC share name) by backslashes <del> resolvedDevice = resolvedDevice.replace(/\//g, '\\'); <add> // Convert slashes to backslashes when `resolvedDevice` points to an UNC <add> // root. Also squash multiple slashes into a single one where appropriate. <add> if (isUnc) { <add> resolvedDevice = normalizeUNCRoot(resolvedDevice); <add> } <ide> <ide> // At this point the path should be resolved to a full absolute path, <ide> // but handle relative paths to be safe (might happen when process.cwd() <ide> if (isWindows) { <ide> } <ide> <ide> // Convert slashes to backslashes when `device` points to an UNC root. <del> device = device.replace(/\//g, '\\'); <add> // Also squash multiple slashes into a single one where appropriate. <add> if (isUnc) { <add> device = normalizeUNCRoot(device); <add> } <ide> <ide> return device + (isAbsolute ? '\\' : '') + tail; <ide> }; <ide> if (isWindows) { <ide> var paths = Array.prototype.filter.call(arguments, f); <ide> var joined = paths.join('\\'); <ide> <del> // Make sure that the joined path doesn't start with two slashes <del> // - it will be mistaken for an unc path by normalize() - <del> // unless the paths[0] also starts with two slashes <del> if (/^[\\\/]{2}/.test(joined) && !/^[\\\/]{2}/.test(paths[0])) { <del> joined = joined.substr(1); <add> // Make sure that the joined path doesn't start with two slashes, because <add> // normalize() will mistake it for an UNC path then. <add> // <add> // This step is skipped when it is very clear that the user actually <add> // intended to point at an UNC path. This is assumed when the first <add> // non-empty string arguments starts with exactly two slashes followed by <add> // at least one more non-slash character. <add> // <add> // Note that for normalize() to treat a path as an UNC path it needs to <add> // have at least 2 components, so we don't filter for that here. <add> // This means that the user can use join to construct UNC paths from <add> // a server name and a share name; for example: <add> // path.join('//server', 'share') -> '\\\\server\\share\') <add> if (!/^[\\\/]{2}[^\\\/]/.test(paths[0])) { <add> joined = joined.replace(/^[\\\/]{2,}/, '\\'); <ide> } <ide> <ide> return exports.normalize(joined); <ide><path>test/simple/test-path.js <ide> var joinTests = <ide> [[' ', '.'], ' '], <ide> [[' ', '/'], ' /'], <ide> [[' ', ''], ' '], <add> [['/', 'foo'], '/foo'], <add> [['/', '/foo'], '/foo'], <add> [['/', '//foo'], '/foo'], <add> [['/', '', '/foo'], '/foo'], <add> [['', '/', 'foo'], '/foo'], <add> [['', '/', '/foo'], '/foo'], <ide> // filtration of non-strings. <ide> [['x', true, 7, 'y', null, {}], 'x/y'] <ide> ]; <add> <add>// Windows-specific join tests <add>if (isWindows) { <add> joinTests = joinTests.concat( <add> [// UNC path expected <add> [['//foo/bar'], '//foo/bar/'], <add> [['\\/foo/bar'], '//foo/bar/'], <add> [['\\\\foo/bar'], '//foo/bar/'], <add> // UNC path expected - server and share separate <add> [['//foo', 'bar'], '//foo/bar/'], <add> [['//foo/', 'bar'], '//foo/bar/'], <add> [['//foo', '/bar'], '//foo/bar/'], <add> // UNC path expected - questionable <add> [['//foo', '', 'bar'], '//foo/bar/'], <add> [['//foo/', '', 'bar'], '//foo/bar/'], <add> [['//foo/', '', '/bar'], '//foo/bar/'], <add> // UNC path expected - even more questionable <add> [['', '//foo', 'bar'], '//foo/bar/'], <add> [['', '//foo/', 'bar'], '//foo/bar/'], <add> [['', '//foo/', '/bar'], '//foo/bar/'], <add> // No UNC path expected (no double slash in first component) <add> [['\\', 'foo/bar'], '/foo/bar'], <add> [['\\', '/foo/bar'], '/foo/bar'], <add> [['', '/', '/foo/bar'], '/foo/bar'], <add> // No UNC path expected (no non-slashes in first component - questionable) <add> [['//', 'foo/bar'], '/foo/bar'], <add> [['//', '/foo/bar'], '/foo/bar'], <add> [['\\\\', '/', '/foo/bar'], '/foo/bar'], <add> [['//'], '/'], <add> // No UNC path expected (share name missing - questionable). <add> [['//foo'], '/foo'], <add> [['//foo/'], '/foo/'], <add> [['//foo', '/'], '/foo/'], <add> [['//foo', '', '/'], '/foo/'], <add> // No UNC path expected (too many leading slashes - questionable) <add> [['///foo/bar'], '/foo/bar'], <add> [['////foo', 'bar'], '/foo/bar'], <add> [['\\\\\\/foo/bar'], '/foo/bar'], <add> // Drive-relative vs drive-absolute paths. This merely describes the <add> // status quo, rather than being obviously right <add> [['c:'], 'c:.'], <add> [['c:.'], 'c:.'], <add> [['c:', ''], 'c:.'], <add> [['', 'c:'], 'c:.'], <add> [['c:.', '/'], 'c:./'], <add> [['c:.', 'file'], 'c:file'], <add> [['c:', '/'], 'c:/'], <add> [['c:', 'file'], 'c:/file'] <add> ]); <add>} <add> <add>// Run the join tests. <ide> joinTests.forEach(function(test) { <ide> var actual = path.join.apply(path, test[0]); <ide> var expected = isWindows ? test[1].replace(/\//g, '\\') : test[1]; <ide> if (isWindows) { <ide> [['c:/ignore', 'c:/some/file'], 'c:\\some\\file'], <ide> [['d:/ignore', 'd:some/dir//'], 'd:\\ignore\\some\\dir'], <ide> [['.'], process.cwd()], <del> [['//server/share', '..', 'relative\\'], '\\\\server\\share\\relative']]; <add> [['//server/share', '..', 'relative\\'], '\\\\server\\share\\relative'], <add> [['c:/', '//'], 'c:\\'], <add> [['c:/', '//dir'], 'c:\\dir'], <add> [['c:/', '//server/share'], '\\\\server\\share\\'], <add> [['c:/', '//server//share'], '\\\\server\\share\\'], <add> [['c:/', '///some//dir'], 'c:\\some\\dir'] <add> ]; <ide> } else { <ide> // Posix <ide> var resolveTests =
2
Java
Java
fix jsonobjectdecoder chunks handling
b1030eba3f6f0601413e1652f9b2151d21adc245
<ide><path>spring-web/src/main/java/org/springframework/http/codec/json/JsonObjectDecoder.java <ide> public Publisher<? extends DataBuffer> apply(DataBuffer buffer) { <ide> this.writerIndex = this.input.writerIndex(); <ide> } <ide> else { <add> this.index = this.index - this.input.readerIndex(); <ide> this.input = Unpooled.copiedBuffer(this.input, <ide> Unpooled.copiedBuffer(buffer.asByteBuffer())); <ide> DataBufferUtils.release(buffer); <ide><path>spring-web/src/test/java/org/springframework/http/codec/json/JsonObjectDecoderTests.java <ide> public void decodeMultipleChunksToJsonObject() throws InterruptedException { <ide> @Test <ide> public void decodeSingleChunkToArray() throws InterruptedException { <ide> JsonObjectDecoder decoder = new JsonObjectDecoder(); <add> <ide> Flux<DataBuffer> source = Flux.just(stringBuffer( <ide> "[{\"foo\": \"foofoo\", \"bar\": \"barbar\"},{\"foo\": \"foofoofoo\", \"bar\": \"barbarbar\"}]")); <ide> Flux<String> output = <ide> public void decodeSingleChunkToArray() throws InterruptedException { <ide> .expectNext("{\"foo\": \"foofoofoo\", \"bar\": \"barbarbar\"}") <ide> .expectComplete() <ide> .verify(output); <add> <add> source = Flux.just(stringBuffer("[{\"foo\": \"bar\"},{\"foo\": \"baz\"}]")); <add> output = decoder.decode(source, null, null, Collections.emptyMap()).map(JsonObjectDecoderTests::toString); <add> ScriptedSubscriber.<String>create() <add> .expectNext("{\"foo\": \"bar\"}") <add> .expectNext("{\"foo\": \"baz\"}") <add> .expectComplete() <add> .verify(output); <ide> } <ide> <ide> @Test <ide> public void decodeMultipleChunksToArray() throws InterruptedException { <ide> JsonObjectDecoder decoder = new JsonObjectDecoder(); <add> <ide> Flux<DataBuffer> source = <ide> Flux.just(stringBuffer("[{\"foo\": \"foofoo\", \"bar\""), stringBuffer( <ide> ": \"barbar\"},{\"foo\": \"foofoofoo\", \"bar\": \"barbarbar\"}]")); <ide> public void decodeMultipleChunksToArray() throws InterruptedException { <ide> .expectNext("{\"foo\": \"foofoofoo\", \"bar\": \"barbarbar\"}") <ide> .expectComplete() <ide> .verify(output); <add> <add> source = Flux.just( <add> stringBuffer("[{\"foo\": \""), <add> stringBuffer("bar\"},{\"fo"), <add> stringBuffer("o\": \"baz\"}"), <add> stringBuffer("]")); <add> output = decoder.decode(source, null, null, Collections.emptyMap()).map(JsonObjectDecoderTests::toString); <add> ScriptedSubscriber.<String>create() <add> .expectNext("{\"foo\": \"bar\"}") <add> .expectNext("{\"foo\": \"baz\"}") <add> .expectComplete() <add> .verify(output); <ide> } <ide> <ide>
2
Javascript
Javascript
use this.dir to join the resolved path
83b5c138100e7bb7fdf19d23b38a52d60a384427
<ide><path>server/index.js <ide> export default class Server { <ide> this.http = null <ide> const phase = dev ? PHASE_DEVELOPMENT_SERVER : PHASE_PRODUCTION_SERVER <ide> this.nextConfig = loadConfig(phase, this.dir, conf) <del> this.distDir = join(dir, this.nextConfig.distDir) <add> this.distDir = join(this.dir, this.nextConfig.distDir) <ide> <ide> this.hotReloader = dev ? this.getHotReloader(this.dir, { quiet, config: this.nextConfig }) : null <ide>
1
Java
Java
revise servlet 4 httpservletmapping check
4cc831238c825c6d361d35ebf2563603da5eccae
<ide><path>spring-web/src/main/java/org/springframework/web/util/UrlPathHelper.java <ide> import java.util.Properties; <ide> <ide> import javax.servlet.ServletRequest; <add>import javax.servlet.http.HttpServletMapping; <ide> import javax.servlet.http.HttpServletRequest; <ide> import javax.servlet.http.MappingMatch; <ide> <ide> public class UrlPathHelper { <ide> */ <ide> public static final String PATH_ATTRIBUTE = UrlPathHelper.class.getName() + ".PATH"; <ide> <del> private static final boolean isServlet4Present = <del> ClassUtils.isPresent("javax.servlet.http.HttpServletMapping", <del> UrlPathHelper.class.getClassLoader()); <add> private static final boolean servlet4Present = <add> ClassUtils.hasMethod(HttpServletRequest.class, "getHttpServletMapping"); <ide> <ide> /** <ide> * Special WebSphere request attribute, indicating the original request URI. <ide> public String getLookupPathForRequest(HttpServletRequest request) { <ide> } <ide> } <ide> <add> /** <add> * Check whether servlet path determination can be skipped for the given request. <add> * @param request current HTTP request <add> * @return {@code true} if the request mapping has not been achieved using a path <add> * or if the servlet has been mapped to root; {@code false} otherwise <add> */ <ide> private boolean skipServletPathDetermination(HttpServletRequest request) { <del> if (isServlet4Present) { <del> if (request.getHttpServletMapping().getMappingMatch() != null) { <del> return !request.getHttpServletMapping().getMappingMatch().equals(MappingMatch.PATH) || <del> request.getHttpServletMapping().getPattern().equals("/*"); <del> } <add> if (servlet4Present) { <add> return Servlet4Delegate.skipServletPathDetermination(request); <ide> } <ide> return false; <ide> } <ide> public String removeSemicolonContent(String requestUri) { <ide> rawPathInstance.setReadOnly(); <ide> } <ide> <add> <add> /** <add> * Inner class to avoid a hard dependency on Servlet 4 {@link HttpServletMapping} <add> * and {@link MappingMatch} at runtime. <add> */ <add> private static class Servlet4Delegate { <add> <add> public static boolean skipServletPathDetermination(HttpServletRequest request) { <add> HttpServletMapping mapping = request.getHttpServletMapping(); <add> MappingMatch match = mapping.getMappingMatch(); <add> return (match != null && (!match.equals(MappingMatch.PATH) || mapping.getPattern().equals("/*"))); <add> } <add> } <add> <ide> }
1
Python
Python
set version to v2.1.0a7.dev3
63dc4234a33da79df93c5649aaac04478dfea6a2
<ide><path>spacy/about.py <ide> # fmt: off <ide> <ide> __title__ = "spacy-nightly" <del>__version__ = "2.1.0a7.dev2" <add>__version__ = "2.1.0a7.dev3" <ide> __summary__ = "Industrial-strength Natural Language Processing (NLP) with Python and Cython" <ide> __uri__ = "https://spacy.io" <ide> __author__ = "Explosion AI"
1