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
PHP
PHP
fix union with join issue
c34ad52bdeea9163b8283e4793c2cb9a951469bf
<ide><path>src/Illuminate/Database/Query/Builder.php <ide> public function join($table, $one, $operator = null, $two = null, $type = 'inner <ide> // is trying to build a join with a complex "on" clause containing more than <ide> // one condition, so we'll add the join and call a Closure with the query. <ide> if ($one instanceof Closure) { <del> $this->joins[] = new JoinClause($type, $table); <add> $join = new JoinClause($type, $table); <add> <add> call_user_func($one, $join); <ide> <del> call_user_func($one, end($this->joins)); <add> $this->joins[] = $join; <add> <add> $this->addBinding($join->bindings, 'join'); <ide> } <ide> <ide> // If the column is simply a string, we can assume the join simply has a basic <ide> public function join($table, $one, $operator = null, $two = null, $type = 'inner <ide> $this->joins[] = $join->on( <ide> $one, $operator, $two, 'and', $where <ide> ); <add> <add> $this->addBinding($join->bindings, 'join'); <ide> } <ide> <ide> return $this; <ide><path>tests/Database/DatabaseQueryBuilderTest.php <ide> public function testUnionWithJoin() <ide> { <ide> $builder = $this->getBuilder(); <ide> $builder->select('*')->from('users'); <del> $builder->union($this->getBuilder()->select('*')->from('dogs')->join('breeds', function($join) { <add> $builder->union($this->getBuilder()->select('*')->from('dogs')->join('breeds', function ($join) { <ide> $join->on('dogs.breed_id', '=', 'breeds.id') <ide> ->where('breeds.is_native', '=', 1); <ide> }));
2
Ruby
Ruby
remove unreachable database warning
25839860711987b48b5e5a6d919b4ea294ac10a8
<ide><path>activerecord/lib/active_record/railtie.rb <ide> class Railtie < Rails::Railtie # :nodoc: <ide> initializer "active_record.initialize_database" do <ide> ActiveSupport.on_load(:active_record) do <ide> self.configurations = Rails.application.config.database_configuration <del> <del> begin <del> establish_connection <del> rescue ActiveRecord::NoDatabaseError <del> warn <<-end_warning <del>Oops - You have a database configured, but it doesn't exist yet! <del> <del>Here's how to get started: <del> <del> 1. Configure your database in config/database.yml. <del> 2. Run `rails db:create` to create the database. <del> 3. Run `rails db:setup` to load your database schema. <del>end_warning <del> raise <del> end <add> establish_connection <ide> end <ide> end <ide>
1
Text
Text
fix typos found on examples docs
d96de6ea6b52e152388c6b6a8ef40a1fe61acc6c
<ide><path>examples/with-ant-design-mobile/README.md <ide> # Ant Design Mobile example <ide> <del>This example features how you use [antd-mobile](https://github.com/ant-design/ant-design-mobile) (Ant Design Mobile FrontEnd Framwork) with Next.js. <add>This example features how you use [antd-mobile](https://github.com/ant-design/ant-design-mobile) (Ant Design Mobile FrontEnd Framework) with Next.js. <ide> <ide> ## Deploy your own <ide> <ide><path>examples/with-deta-base/README.md <ide> Then set each variable on `.env.local`: <ide> <ide> - `DETA_PROJECT_KEY` should be the default _Project Key_ that you saved from step 1. <ide> <del>The resulting `env.local` file shoule look like this: <add>The resulting `env.local` file should look like this: <ide> <ide> ```bash <del>DETA_PROEJECT_KEY=... <add>DETA_PROJECT_KEY=... <ide> ``` <ide> <ide> ### Step 3. Run Next.js in development mode <ide><path>examples/with-electron-typescript/README.md <ide> Available commands: <ide> "build-electron": transpile electron layer <ide> "build": build both layers <ide> "dev": start dev version <del>"dist": create production elctron build <add>"dist": create production electron build <ide> "type-check": check TypeScript in project <ide> ``` <ide> <ide><path>examples/with-env-from-next-config-js/README.md <ide> following behavior while you are doing development. <ide> - When you run `next build` then `next start`, assuming you set externally the environmental variable STAGING to anything but 1, you will get the results assuming `isProd` is true. <ide> - When your run `next build` or `npm run build` in production, if the environmental variable `STAGING` is set to `1`, `isStaging` will be set and you will get those values returned. <ide> <del>You can read more about this feature in thie blog post <a href="https://vercel.com/blog/next5-1" target="_blank">Next.js 5.1: Faster Page Resolution, Environment Config and More</a> (under Environment Config). <add>You can read more about this feature in this blog post <a href="https://vercel.com/blog/next5-1" target="_blank">Next.js 5.1: Faster Page Resolution, Environment Config and More</a> (under Environment Config). <ide><path>examples/with-firebase-hosting/README.md <ide> Then you can create components and pages in `.tsx` or `.ts` <ide> ## Good to know <ide> <ide> - [`firebase.json`](firebase.json:#L7) outlines the catchall rewrite rule for our Cloud Function. <del>- The empty `public/.gitignore` file is to ensure `public/` dir exists as it is required for Firebase Hosting. It is [configured](firebase.json:#L4) (by [default](https://firebase.google.com/docs/hosting/full-config#ignore)) that dotfiles (`public/.*`) are ignored from bein publicly served. <add>- The empty `public/.gitignore` file is to ensure `public/` dir exists as it is required for Firebase Hosting. It is [configured](firebase.json:#L4) (by [default](https://firebase.google.com/docs/hosting/full-config#ignore)) that dotfiles (`public/.*`) are ignored from being publicly served. <ide> - The Cloud Function is named `nextjsFunc` (changeable in [firebaseFunctions.js](firebaseFunctions.js#L16) and [firebase.json](firebase.json#L8)). <ide> - `public/*` files are statically served through [Firebase hosting](https://firebase.google.com/docs/hosting/full-config#public), not through [NextJs server](https://nextjs.org/docs/basic-features/static-file-serving). <ide>
5
Ruby
Ruby
install glibc/gcc automatically if too old
d271614872279cce7cec6344d3262f5a19315787
<ide><path>Library/Homebrew/dependency_collector.rb <ide> class DependencyCollector <ide> def initialize <ide> @deps = Dependencies.new <ide> @requirements = Requirements.new <add> <add> init_global_dep_tree_if_needed! <ide> end <ide> <ide> def initialize_copy(other) <ide> def build(spec) <ide> parse_spec(spec, Array(tags)) <ide> end <ide> <add> sig { params(related_formula_names: T::Array[String]).returns(T.nilable(Dependency)) } <add> def gcc_dep_if_needed(related_formula_names); end <add> <add> sig { params(related_formula_names: T::Array[String]).returns(T.nilable(Dependency)) } <add> def glibc_dep_if_needed(related_formula_names); end <add> <ide> def git_dep_if_needed(tags) <ide> return if Utils::Git.available? <ide> <ide> def self.tar_needs_xz_dependency? <ide> <ide> private <ide> <add> sig { void } <add> def init_global_dep_tree_if_needed!; end <add> <ide> def parse_spec(spec, tags) <ide> case spec <ide> when String <ide><path>Library/Homebrew/development_tools.rb <ide> def clear_version_cache <ide> @gcc_version = {} <ide> end <ide> <add> sig { returns(T::Boolean) } <add> def build_system_too_old? <add> false <add> end <add> <add> sig { returns(T::Boolean) } <add> def system_gcc_too_old? <add> false <add> end <add> <ide> sig { returns(T::Boolean) } <ide> def ca_file_handles_most_https_certificates? <ide> # The system CA file is too old for some modern HTTPS certificates on <ide><path>Library/Homebrew/extend/os/dependency_collector.rb <ide> # typed: strict <ide> # frozen_string_literal: true <ide> <del>require "extend/os/mac/dependency_collector" if OS.mac? <add>if OS.mac? <add> require "extend/os/mac/dependency_collector" <add>elsif OS.linux? <add> require "extend/os/linux/dependency_collector" <add>end <ide><path>Library/Homebrew/extend/os/linux/dependency_collector.rb <add># typed: true <add># frozen_string_literal: true <add> <add>require "os/linux/glibc" <add> <add>class DependencyCollector <add> extend T::Sig <add> <add> undef gcc_dep_if_needed <add> undef glibc_dep_if_needed <add> undef init_global_dep_tree_if_needed! <add> <add> sig { params(related_formula_names: T::Set[String]).returns(T.nilable(Dependency)) } <add> def gcc_dep_if_needed(related_formula_names) <add> return unless DevelopmentTools.system_gcc_too_old? <add> return if related_formula_names.include?(GCC) <add> return if global_dep_tree[GCC]&.intersect?(related_formula_names) <add> return if global_dep_tree[GLIBC]&.intersect?(related_formula_names) # gcc depends on glibc <add> <add> Dependency.new(GCC) <add> end <add> <add> sig { params(related_formula_names: T::Set[String]).returns(T.nilable(Dependency)) } <add> def glibc_dep_if_needed(related_formula_names) <add> return unless OS::Linux::Glibc.below_ci_version? <add> return if global_dep_tree[GLIBC]&.intersect?(related_formula_names) <add> <add> Dependency.new(GLIBC) <add> end <add> <add> private <add> <add> GLIBC = "glibc" <add> GCC = CompilerSelector.preferred_gcc.freeze <add> <add> # Use class variables to avoid this expensive logic needing to be done more <add> # than once. <add> # rubocop:disable Style/ClassVars <add> @@global_dep_tree = {} <add> <add> sig { void } <add> def init_global_dep_tree_if_needed! <add> return unless DevelopmentTools.build_system_too_old? <add> return if @@global_dep_tree.present? <add> <add> # Defined in precedence order (gcc depends on glibc). <add> global_deps = [GLIBC, GCC].freeze <add> <add> @@global_dep_tree = global_deps.to_h { |name| [name, Set.new([name])] } <add> <add> global_deps.each do |global_dep_name| <add> # This is an arbitrary number picked based on testing the current tree <add> # depth and just to ensure that this doesn't loop indefinitely if we <add> # introduce a circular dependency by mistake. <add> maximum_tree_depth = 10 <add> current_tree_depth = 0 <add> <add> deps = Formula[global_dep_name].deps <add> while deps.present? <add> current_tree_depth += 1 <add> if current_tree_depth > maximum_tree_depth <add> raise "maximum tree depth (#{maximum_tree_depth}) exceeded calculating #{global_dep_name} dependency tree!" <add> end <add> <add> @@global_dep_tree[global_dep_name].merge(deps.map(&:name)) <add> deps = deps.flat_map { |dep| dep.to_formula.deps } <add> end <add> end <add> end <add> <add> sig { returns(T::Hash[String, T::Set[String]]) } <add> def global_dep_tree <add> @@global_dep_tree <add> end <add> # rubocop:enable Style/ClassVars <add>end <ide><path>Library/Homebrew/extend/os/linux/development_tools.rb <ide> def default_compiler <ide> :gcc <ide> end <ide> <add> sig { returns(T::Boolean) } <add> def build_system_too_old? <add> return @build_system_too_old if defined? @build_system_too_old <add> <add> @build_system_too_old = (system_gcc_too_old? || OS::Linux::Glibc.below_ci_version?) <add> end <add> <add> sig { returns(T::Boolean) } <add> def system_gcc_too_old? <add> gcc_version("gcc") < OS::LINUX_GCC_CI_VERSION <add> end <add> <ide> sig { returns(T::Hash[String, T.nilable(String)]) } <ide> def build_system_info <ide> generic_build_system_info.merge({ <ide><path>Library/Homebrew/extend/os/linux/formula.rb <ide> class Formula <ide> undef shared_library <ide> undef loader_path <ide> undef deuniversalize_machos <add> undef add_global_deps_to_spec <ide> <ide> sig { params(name: String, version: T.nilable(T.any(String, Integer))).returns(String) } <ide> def shared_library(name, version = nil) <ide> def loader_path <ide> <ide> sig { params(targets: T.nilable(T.any(Pathname, String))).void } <ide> def deuniversalize_machos(*targets); end <add> <add> sig { params(spec: SoftwareSpec).void } <add> def add_global_deps_to_spec(spec) <add> @global_deps ||= begin <add> dependency_collector = spec.dependency_collector <add> related_formula_names = Set.new([ <add> name, <add> *versioned_formulae_names, <add> ]) <add> [ <add> dependency_collector.gcc_dep_if_needed(related_formula_names), <add> dependency_collector.glibc_dep_if_needed(related_formula_names), <add> ].compact.freeze <add> end <add> @global_deps.each { |dep| spec.dependency_collector.add(dep) } <add> end <ide> end <ide><path>Library/Homebrew/extend/os/linux/linkage_checker.rb <ide> def check_dylibs(rebuild_cache:) <ide> @unwanted_system_dylibs = @system_dylibs.reject do |s| <ide> SYSTEM_LIBRARY_ALLOWLIST.include? File.basename(s) <ide> end <del> # FIXME: Remove this when these dependencies are injected correctly (e.g. through `DependencyCollector`) <del> # See discussion at <del> # https://github.com/Homebrew/brew/pull/13577 <del> @undeclared_deps -= [CompilerSelector.preferred_gcc, "glibc", "gcc"] <ide> end <ide> end <ide><path>Library/Homebrew/formula.rb <ide> def spec_eval(name) <ide> return unless spec.url <ide> <ide> spec.owner = self <add> add_global_deps_to_spec(spec) <ide> instance_variable_set("@#{name}", spec) <ide> end <ide> <add> sig { params(spec: SoftwareSpec).void } <add> def add_global_deps_to_spec(spec); end <add> <ide> def determine_active_spec(requested) <ide> spec = send(requested) || stable || head <ide> spec || raise(FormulaSpecificationError, "formulae require at least a URL") <ide> def versioned_formula? <ide> # Returns any `@`-versioned formulae names for any formula (including versioned formulae). <ide> sig { returns(T::Array[String]) } <ide> def versioned_formulae_names <del> @versioned_formulae_names ||= Pathname.glob(path.to_s.gsub(/(@[\d.]+)?\.rb$/, "@*.rb")).map do |versioned_path| <add> Pathname.glob(path.to_s.gsub(/(@[\d.]+)?\.rb$/, "@*.rb")).map do |versioned_path| <ide> next if versioned_path == path <ide> <ide> versioned_path.basename(".rb").to_s <ide> def versioned_formulae_names <ide> # Returns any `@`-versioned Formula objects for any Formula (including versioned formulae). <ide> sig { returns(T::Array[Formula]) } <ide> def versioned_formulae <del> @versioned_formulae ||= versioned_formulae_names.map do |name| <add> versioned_formulae_names.map do |name| <ide> Formula[name] <ide> rescue FormulaUnavailableError <ide> nil <ide><path>Library/Homebrew/formula_installer.rb <ide> def expand_requirements <ide> end <ide> <ide> def expand_dependencies_for_formula(formula, inherited_options) <del> any_bottle_used = false <del> <ide> # Cache for this expansion only. FormulaInstaller has a lot of inputs which can alter expansion. <ide> cache_key = "FormulaInstaller-#{formula.full_name}-#{Time.now.to_f}" <del> expanded_deps = Dependency.expand(formula, cache_key: cache_key) do |dependent, dep| <add> Dependency.expand(formula, cache_key: cache_key) do |dependent, dep| <ide> inherited_options[dep.name] |= inherited_options_for(dep) <ide> build = effective_build_options_for( <ide> dependent, <ide> def expand_dependencies_for_formula(formula, inherited_options) <ide> Dependency.prune <ide> elsif dep.satisfied?(inherited_options[dep.name]) <ide> Dependency.skip <del> else <del> any_bottle_used ||= install_bottle_for?(dep.to_formula, build) <ide> end <ide> end <del> <del> [expanded_deps, any_bottle_used] <ide> end <ide> <ide> def expand_dependencies <ide> inherited_options = Hash.new { |hash, key| hash[key] = Options.new } <del> any_bottle_used = pour_bottle? <ide> <del> expanded_deps, any_dep_bottle_used = expand_dependencies_for_formula(formula, inherited_options) <del> any_bottle_used ||= any_dep_bottle_used <del> <del> # We require some dependencies (glibc, GCC 5, etc.) if binaries were built. <del> # Native binaries shouldn't exist in cross-platform `all` bottles. <del> if any_bottle_used && !formula.bottled?(:all) && !Keg.bottle_dependencies.empty? <del> all_bottle_deps = Keg.bottle_dependencies.flat_map do |bottle_dep| <del> bottle_dep.recursive_dependencies.map(&:name) + [bottle_dep.name] <del> end <del> <del> if all_bottle_deps.exclude?(formula.name) <del> bottle_deps = Keg.bottle_dependencies.flat_map do |bottle_dep| <del> expanded_bottle_deps, = expand_dependencies_for_formula(bottle_dep, inherited_options) <del> expanded_bottle_deps <del> end <del> expanded_deps = Dependency.merge_repeats(bottle_deps + expanded_deps) <del> end <del> end <add> expanded_deps = expand_dependencies_for_formula(formula, inherited_options) <ide> <ide> expanded_deps.map { |dep| [dep, inherited_options[dep.name]] } <ide> end <ide><path>Library/Homebrew/keg_relocate.rb <ide> def self.text_matches_in_file(file, string, ignores, linked_libraries, formula_a <ide> def self.file_linked_libraries(_file, _string) <ide> [] <ide> end <del> <del> def self.bottle_dependencies <del> return [] unless Homebrew::SimulateSystem.simulating_or_running_on_linux? <del> <del> @bottle_dependencies ||= begin <del> formulae = [] <del> gcc = Formulary.factory(CompilerSelector.preferred_gcc) <del> formulae << gcc if DevelopmentTools.gcc_version("gcc") < gcc.version.to_i <del> formulae <del> end <del> end <ide> end <ide> <ide> require "extend/os/keg_relocate" <ide><path>Library/Homebrew/os/linux/glibc.rb <ide> def minimum_version <ide> def below_minimum_version? <ide> system_version < minimum_version <ide> end <add> <add> sig { returns(T::Boolean) } <add> def below_ci_version? <add> system_version < LINUX_GLIBC_CI_VERSION <add> end <ide> end <ide> end <ide> end <ide><path>Library/Homebrew/software_spec.rb <ide> def initialize(flags: []) <ide> @uses_from_macos_elements = [] <ide> end <ide> <add> def initialize_copy(other) <add> super <add> @dependency_collector = @dependency_collector.dup <add> end <add> <ide> def owner=(owner) <ide> @name = owner.name <ide> @full_name = owner.full_name <ide><path>Library/Homebrew/test/installed_dependents_spec.rb <ide> describe InstalledDependents do <ide> include FileUtils <ide> <del> def setup_test_keg(name, version) <add> def stub_formula(name, version = "1.0", &block) <add> f = formula(name) do <add> url "#{name}-#{version}" <add> <add> instance_eval(&block) if block <add> end <add> stub_formula_loader f <add> stub_formula_loader f, "homebrew/core/#{f}" <add> f <add> end <add> <add> def setup_test_keg(name, version, &block) <add> stub_formula(name, version, &block) <add> <ide> path = HOMEBREW_CELLAR/name/version <ide> (path/"bin").mkpath <ide> <ide> def setup_test_keg(name, version) <ide> end <ide> <ide> let!(:keg) { setup_test_keg("foo", "1.0") } <del> <del> describe "::find_some_installed_dependents" do <del> def stub_formula_name(name) <del> f = formula(name) { url "foo-1.0" } <del> stub_formula_loader f <del> stub_formula_loader f, "homebrew/core/#{f}" <del> f <add> let!(:keg_only_keg) do <add> setup_test_keg("foo-keg-only", "1.0") do <add> keg_only "a good reason" <ide> end <add> end <ide> <del> def setup_test_keg(name, version) <del> f = stub_formula_name(name) <add> describe "::find_some_installed_dependents" do <add> def setup_test_keg(name, version, &block) <ide> keg = super <del> Tab.create(f, DevelopmentTools.default_compiler, :libcxx).write <add> Tab.create(keg.to_formula, DevelopmentTools.default_compiler, :libcxx).write <ide> keg <ide> end <ide> <ide> before do <ide> keg.link <add> keg_only_keg.optlink <ide> end <ide> <del> def alter_tab(keg = dependent) <add> def alter_tab(keg) <ide> tab = Tab.for_keg(keg) <ide> yield tab <ide> tab.write <ide> end <ide> <ide> # 1.1.6 is the earliest version of Homebrew that generates correct runtime <ide> # dependency lists in {Tab}s. <del> def dependencies(deps, homebrew_version: "1.1.6") <del> alter_tab do |tab| <add> def tab_dependencies(keg, deps, homebrew_version: "1.1.6") <add> alter_tab(keg) do |tab| <ide> tab.homebrew_version = homebrew_version <del> tab.tabfile = dependent/Tab::FILENAME <add> tab.tabfile = keg/Tab::FILENAME <ide> tab.runtime_dependencies = deps <ide> end <ide> end <ide> <del> def unreliable_dependencies(deps) <add> def unreliable_tab_dependencies(keg, deps) <ide> # 1.1.5 is (hopefully!) the last version of Homebrew that generates <ide> # incorrect runtime dependency lists in {Tab}s. <del> dependencies(deps, homebrew_version: "1.1.5") <add> tab_dependencies(keg, deps, homebrew_version: "1.1.5") <ide> end <ide> <del> let(:dependent) { setup_test_keg("bar", "1.0") } <del> <ide> specify "a dependency with no Tap in Tab" do <ide> tap_dep = setup_test_keg("baz", "1.0") <add> dependent = setup_test_keg("bar", "1.0") do <add> depends_on "foo" <add> depends_on "baz" <add> end <ide> <ide> # allow tap_dep to be linked too <ide> FileUtils.rm_r tap_dep/"bin" <ide> tap_dep.link <ide> <ide> alter_tab(keg) { |t| t.source["tap"] = nil } <ide> <del> dependencies nil <del> Formula["bar"].class.depends_on "foo" <del> Formula["bar"].class.depends_on "baz" <add> tab_dependencies dependent, nil <ide> <ide> result = described_class.find_some_installed_dependents([keg, tap_dep]) <ide> expect(result).to eq([[keg, tap_dep], ["bar"]]) <ide> end <ide> <ide> specify "no dependencies anywhere" do <del> dependencies nil <add> dependent = setup_test_keg("bar", "1.0") <add> tab_dependencies dependent, nil <ide> expect(described_class.find_some_installed_dependents([keg])).to be_nil <ide> end <ide> <ide> specify "missing Formula dependency" do <del> dependencies nil <del> Formula["bar"].class.depends_on "foo" <add> dependent = setup_test_keg("bar", "1.0") do <add> depends_on "foo" <add> end <add> tab_dependencies dependent, nil <ide> expect(described_class.find_some_installed_dependents([keg])).to eq([[keg], ["bar"]]) <ide> end <ide> <ide> specify "uninstalling dependent and dependency" do <del> dependencies nil <del> Formula["bar"].class.depends_on "foo" <add> dependent = setup_test_keg("bar", "1.0") do <add> depends_on "foo" <add> end <add> tab_dependencies dependent, nil <ide> expect(described_class.find_some_installed_dependents([keg, dependent])).to be_nil <ide> end <ide> <ide> specify "renamed dependency" do <del> dependencies nil <add> dependent = setup_test_keg("bar", "1.0") do <add> depends_on "foo" <add> end <add> tab_dependencies dependent, nil <ide> <ide> stub_formula_loader Formula["foo"], "homebrew/core/foo-old" <ide> renamed_path = HOMEBREW_CELLAR/"foo-old" <ide> (HOMEBREW_CELLAR/"foo").rename(renamed_path) <del> renamed_keg = Keg.new(renamed_path/"1.0") <del> <del> Formula["bar"].class.depends_on "foo" <add> renamed_keg = Keg.new(renamed_path/keg.version.to_s) <ide> <ide> result = described_class.find_some_installed_dependents([renamed_keg]) <ide> expect(result).to eq([[renamed_keg], ["bar"]]) <ide> end <ide> <ide> specify "empty dependencies in Tab" do <del> dependencies [] <add> dependent = setup_test_keg("bar", "1.0") <add> tab_dependencies dependent, [] <ide> expect(described_class.find_some_installed_dependents([keg])).to be_nil <ide> end <ide> <ide> specify "same name but different version in Tab" do <del> dependencies [{ "full_name" => "foo", "version" => "1.1" }] <add> dependent = setup_test_keg("bar", "1.0") <add> tab_dependencies dependent, [{ "full_name" => keg.name, "version" => "1.1" }] <ide> expect(described_class.find_some_installed_dependents([keg])).to eq([[keg], ["bar"]]) <ide> end <ide> <ide> specify "different name and same version in Tab" do <del> stub_formula_name("baz") <del> dependencies [{ "full_name" => "baz", "version" => keg.version.to_s }] <add> stub_formula("baz") <add> dependent = setup_test_keg("bar", "1.0") <add> tab_dependencies dependent, [{ "full_name" => "baz", "version" => keg.version.to_s }] <ide> expect(described_class.find_some_installed_dependents([keg])).to be_nil <ide> end <ide> <ide> specify "same name and version in Tab" do <del> dependencies [{ "full_name" => "foo", "version" => "1.0" }] <add> dependent = setup_test_keg("bar", "1.0") <add> tab_dependencies dependent, [{ "full_name" => keg.name, "version" => keg.version.to_s }] <ide> expect(described_class.find_some_installed_dependents([keg])).to eq([[keg], ["bar"]]) <ide> end <ide> <ide> specify "fallback for old versions" do <del> unreliable_dependencies [{ "full_name" => "baz", "version" => "1.0" }] <del> Formula["bar"].class.depends_on "foo" <add> dependent = setup_test_keg("bar", "1.0") do <add> depends_on "foo" <add> end <add> unreliable_tab_dependencies dependent, [{ "full_name" => "baz", "version" => "1.0" }] <ide> expect(described_class.find_some_installed_dependents([keg])).to eq([[keg], ["bar"]]) <ide> end <ide> <ide> specify "non-opt-linked" do <ide> keg.remove_opt_record <del> dependencies [{ "full_name" => "foo", "version" => "1.0" }] <add> dependent = setup_test_keg("bar", "1.0") <add> tab_dependencies dependent, [{ "full_name" => keg.name, "version" => keg.version.to_s }] <ide> expect(described_class.find_some_installed_dependents([keg])).to be_nil <ide> end <ide> <ide> specify "keg-only" do <del> keg.unlink <del> Formula["foo"].class.keg_only "a good reason" <del> dependencies [{ "full_name" => "foo", "version" => "1.1" }] # different version <del> expect(described_class.find_some_installed_dependents([keg])).to eq([[keg], ["bar"]]) <add> dependent = setup_test_keg("bar", "1.0") <add> tab_dependencies dependent, [{ "full_name" => keg_only_keg.name, "version" => "1.1" }] # different version <add> expect(described_class.find_some_installed_dependents([keg_only_keg])).to eq([[keg_only_keg], ["bar"]]) <ide> end <ide> <ide> def stub_cask_name(name, version, dependency)
13
PHP
PHP
unify signature for custom finders
203ef36a95063bc55884b7645530bc6b38800192
<ide><path>src/Model/Behavior/TreeBehavior.php <ide> use Cake\Event\Event; <ide> use Cake\ORM\Behavior; <ide> use Cake\ORM\Entity; <add>use Cake\ORM\Query; <ide> use Cake\ORM\Table; <ide> <ide> /** <ide> protected function _unmarkInternalTree() { <ide> * @return \Cake\ORM\Query <ide> * @throws \InvalidArgumentException If the 'for' key is missing in options <ide> */ <del> public function findPath($query, array $options) { <add> public function findPath(Query $query, array $options) { <ide> if (empty($options['for'])) { <ide> throw new \InvalidArgumentException("The 'for' key is required for find('path')"); <ide> } <ide> public function childCount(Entity $node, $direct = false) { <ide> * @return \Cake\ORM\Query <ide> * @throws \InvalidArgumentException When the 'for' key is not passed in $options <ide> */ <del> public function findChildren($query, array $options) { <add> public function findChildren(Query $query, array $options) { <ide> $config = $this->config(); <ide> $options += ['for' => null, 'direct' => false]; <ide> list($parent, $left, $right) = [$config['parent'], $config['left'], $config['right']]; <ide> public function findChildren($query, array $options) { <ide> * @param array $options Array of options as described above <ide> * @return \Cake\ORM\Query <ide> */ <del> public function findTreeList($query, array $options) { <add> public function findTreeList(Query $query, array $options) { <ide> return $this->_scope($query) <ide> ->find('threaded', ['parentField' => $this->config()['parent']]) <ide> ->formatResults(function($results) use ($options) { <ide><path>src/ORM/Behavior.php <ide> * methods should expect the following arguments: <ide> * <ide> * {{{ <del> * findSlugged(Query $query, array $options = []) <add> * findSlugged(Query $query, array $options) <ide> * }}} <ide> * <ide> * @see \Cake\ORM\Table::addBehavior() <ide><path>src/ORM/Table.php <ide> public function find($type = 'all', $options = []) { <ide> * @param array $options <ide> * @return \Cake\ORM\Query <ide> */ <del> public function findAll(Query $query, array $options = []) { <add> public function findAll(Query $query, array $options) { <ide> return $query; <ide> } <ide> <ide> public function findAll(Query $query, array $options = []) { <ide> * @param array $options <ide> * @return \Cake\ORM\Query <ide> */ <del> public function findList(Query $query, array $options = []) { <add> public function findList(Query $query, array $options) { <ide> $options += [ <ide> 'idField' => $this->primaryKey(), <ide> 'valueField' => $this->displayField(), <ide> public function findList(Query $query, array $options = []) { <ide> * @param array $options <ide> * @return \Cake\ORM\Query <ide> */ <del> public function findThreaded(Query $query, array $options = []) { <add> public function findThreaded(Query $query, array $options) { <ide> $options += [ <ide> 'idField' => $this->primaryKey(), <ide> 'parentField' => 'parent_id', <ide><path>tests/TestCase/Model/Behavior/CounterCacheBehaviorTest.php <ide> */ <ide> class PostTable extends Table { <ide> <del> public function findPublished(Query $query, array $options = []) { <add> public function findPublished(Query $query, array $options) { <ide> return $query->where(['published' => true]); <ide> } <ide>
4
PHP
PHP
fix forever length
912f4e5e72d31613b090ee44a7185d6b3bc9401e
<ide><path>laravel/cookie.php <ide> class Cookie { <ide> * <ide> * @var int <ide> */ <del> const forever = 525600; <add> const forever = 2628000; <ide> <ide> /** <ide> * The cookies that have been set.
1
Ruby
Ruby
remove unused variable warning
91cf768fa68bbbc37e08a5cc27235156a393cd4e
<ide><path>activerecord/test/cases/adapters/postgresql/schema_test.rb <ide> def test_habtm_table_name_with_schema <ide> SQL <ide> <ide> song = Song.create <del> album = Album.create <add> Album.create <ide> assert_equal song, Song.includes(:albums).references(:albums).first <ide> ensure <ide> ActiveRecord::Base.connection.execute "DROP SCHEMA music CASCADE;"
1
Ruby
Ruby
display exit code when nonzero
c3169b56001db03171992d205b86951ea574f0e5
<ide><path>Library/Homebrew/formula.rb <ide> def system cmd, *args <ide> end <ide> end <ide> unless $? == 0 <add> puts "Exit code: #{$?}" <ide> puts out <ide> raise <ide> end <ide><path>Library/Homebrew/utils.rb <ide> def safe_system cmd, *args <ide> # CTRL-C interrupt to us too, so execution continues, but the exit code os <ide> # still 2 so we raise our own interrupt <ide> raise Interrupt, cmd if $?.termsig == 2 <del> raise ExecutionError.new(cmd, args) unless exec_success and $?.success? <add> unless exec_success and $?.success? <add> puts "Exit code: #{$?}" <add> raise ExecutionError.new(cmd, args) <add> end <ide> end <ide> <ide> def curl url, *args
2
Python
Python
update pytest conf for sudachipy with japanese
44967a3f9cfc3e20375aac3782897325785e15a9
<ide><path>spacy/tests/conftest.py <ide> def it_tokenizer(): <ide> <ide> @pytest.fixture(scope="session") <ide> def ja_tokenizer(): <del> pytest.importorskip("fugashi") <add> pytest.importorskip("sudachipy") <ide> return get_lang_class("ja").Defaults.create_tokenizer() <ide> <ide>
1
Java
Java
add clonebuilder method on webclient.builder
8ac29c8ce7055e1421ba5995ebb44f0aecc92223
<ide><path>spring-webflux/src/main/java/org/springframework/web/reactive/function/client/DefaultWebClientBuilder.java <ide> public WebClient.Builder baseUrl(String baseUrl) { <ide> return this; <ide> } <ide> <add> @Override <add> public WebClient.Builder cloneBuilder() { <add> return new DefaultWebClientBuilder(this); <add> } <add> <ide> @Override <ide> public WebClient.Builder defaultUriVariables(Map<String, ?> defaultUriVariables) { <ide> this.defaultUriVariables = defaultUriVariables; <ide><path>spring-webflux/src/main/java/org/springframework/web/reactive/function/client/WebClient.java <ide> interface Builder { <ide> */ <ide> Builder baseUrl(String baseUrl); <ide> <add> /** <add> * Clone this {@code WebClient.Builder} <add> */ <add> Builder cloneBuilder(); <add> <ide> /** <ide> * Configure default URI variable values that will be used when expanding <ide> * URI templates using a {@link Map}.
2
Javascript
Javascript
handle 404 thrown from send
633dd87b189f4bec720626d3f12369871e84c33b
<ide><path>packages/next-server/server/next-server.js <ide> export default class Server { <ide> try { <ide> return await serveStatic(req, res, path) <ide> } catch (err) { <del> if (err.code === 'ENOENT') { <add> if (err.code === 'ENOENT' || err.statusCode === 404) { <ide> this.render404(req, res) <ide> } else { <ide> throw err <ide><path>test/integration/production/test/index.test.js <ide> describe('Production Usage', () => { <ide> expect(res.status).toBe(404) <ide> }) <ide> <add> it('should render 404 for dotfiles in /static', async () => { <add> const url = `http://localhost:${appPort}/static/.env` <add> const res = await fetch(url) <add> expect(res.status).toBe(404) <add> }) <add> <ide> it('should render 501 if the HTTP method is not GET or HEAD', async () => { <ide> const url = `http://localhost:${appPort}/_next/abcdef` <ide> const methods = ['POST', 'PUT', 'DELETE']
2
Text
Text
improve consistency in usage of null
5a4f24e7e1d96af39a75c70eaacb14e28fed5341
<ide><path>doc/api/n-api.md <ide> SemVer applying. In order to support this model with N-API, both <ide> in internal functionality and for module specific functionality <ide> (as its good practice), the `throw_` and `create_` functions <ide> take an optional code parameter which is the string for the code <del>to be added to the error object. If the optional parameter is NULL <add>to be added to the error object. If the optional parameter is `NULL` <ide> then no code will be associated with the error. If a code is provided, <ide> the name associated with the error is also updated to be: <ide> <ide> napi_status napi_get_and_clear_last_exception(napi_env env, <ide> ``` <ide> <ide> * `[in] env`: The environment that the API is invoked under. <del>* `[out] result`: The exception if one is pending, NULL otherwise. <add>* `[out] result`: The exception if one is pending, `NULL` otherwise. <ide> <ide> Returns `napi_ok` if the API succeeded. <ide> <ide> then be modified through [`napi_reference_ref`][] and <ide> [`napi_reference_unref`][]. If an object is collected while the count <ide> for a reference is 0, all subsequent calls to <ide> get the object associated with the reference [`napi_get_reference_value`][] <del>will return NULL for the returned `napi_value`. An attempt to call <add>will return `NULL` for the returned `napi_value`. An attempt to call <ide> [`napi_reference_ref`][] for a reference whose object has been collected <ide> will result in an error. <ide> <ide> Returns `napi_ok` if the API succeeded. <ide> <ide> If still valid, this API returns the `napi_value` representing the <ide> JavaScript `Object` associated with the `napi_ref`. Otherwise, result <del>will be NULL. <add>will be `NULL`. <ide> <ide> ### Cleanup on exit of the current Node.js instance <ide> <ide> napi_value Init(napi_env env, napi_value exports); <ide> <ide> The return value from `Init` is treated as the `exports` object for the module. <ide> The `Init` method is passed an empty object via the `exports` parameter as a <del>convenience. If `Init` returns NULL, the parameter passed as `exports` is <add>convenience. If `Init` returns `NULL`, the parameter passed as `exports` is <ide> exported by the module. N-API modules cannot modify the `module` object but can <ide> specify anything as the `exports` property of the module. <ide> <ide> napi_status napi_get_value_string_latin1(napi_env env, <ide> <ide> * `[in] env`: The environment that the API is invoked under. <ide> * `[in] value`: `napi_value` representing JavaScript string. <del>* `[in] buf`: Buffer to write the ISO-8859-1-encoded string into. If NULL is <add>* `[in] buf`: Buffer to write the ISO-8859-1-encoded string into. If `NULL` is <ide> passed in, the length of the string (in bytes) is returned. <ide> * `[in] bufsize`: Size of the destination buffer. When this value is <ide> insufficient, the returned string will be truncated. <ide> napi_status napi_get_value_string_utf8(napi_env env, <ide> <ide> * `[in] env`: The environment that the API is invoked under. <ide> * `[in] value`: `napi_value` representing JavaScript string. <del>* `[in] buf`: Buffer to write the UTF8-encoded string into. If NULL is passed <add>* `[in] buf`: Buffer to write the UTF8-encoded string into. If `NULL` is passed <ide> in, the length of the string (in bytes) is returned. <ide> * `[in] bufsize`: Size of the destination buffer. When this value is <ide> insufficient, the returned string will be truncated. <ide> napi_status napi_get_value_string_utf16(napi_env env, <ide> <ide> * `[in] env`: The environment that the API is invoked under. <ide> * `[in] value`: `napi_value` representing JavaScript string. <del>* `[in] buf`: Buffer to write the UTF16-LE-encoded string into. If NULL is <add>* `[in] buf`: Buffer to write the UTF16-LE-encoded string into. If `NULL` is <ide> passed in, the length of the string (in 2-byte code units) is returned. <ide> * `[in] bufsize`: Size of the destination buffer. When this value is <ide> insufficient, the returned string will be truncated.
1
Javascript
Javascript
make suggested fix by @vagsa2
b592f68552586b8d81d41afdc290e95355ecacf0
<ide><path>src/test/moment/format.js <ide> test('long years', function (assert) { <ide> assert.equal(moment.utc().year(-20123).format('YYYYYY'), '-020123', 'big negative year with YYYYYY'); <ide> }); <ide> <add>test('toISOString() when 0 year', function (assert) { <add> // https://github.com/moment/moment/issues/3765 <add> var date = moment('0000-01-01T21:00:00.000Z'); <add> assert.equal(date.toISOString(), '0000-01-01T21:00:00.000Z'); <add> assert.equal(date.toDate().toISOString(), '0000-01-01T21:00:00.000Z'); <add>}); <add> <ide> test('iso week formats', function (assert) { <ide> // https://en.wikipedia.org/wiki/ISO_week_date <ide> var cases = {
1
Python
Python
update tokenization_camembert.py with urls
fb6c70a91d3183742ce0a6d97add68103253ca3a
<ide><path>transformers/tokenization_camembert.py <ide> # distributed under the License is distributed on an "AS IS" BASIS, <ide> # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <ide> # See the License for the specific language governing permissions and <del># limitations under the License. <add># limitations under the License <ide> """ Tokenization classes for Camembert model.""" <ide> from __future__ import (absolute_import, division, print_function, <ide> unicode_literals) <ide> from transformers.tokenization_utils import PreTrainedTokenizer <ide> <ide> <add>VOCAB_FILES_NAMES = {'vocab_file': 'sentencepiece.bpe.model'} <add> <add>PRETRAINED_VOCAB_FILES_MAP = { <add> 'vocab_file': <add> { <add> 'camembert-base': "https://dl.fbaipublicfiles.com/camembert/camembert-base-v0-sentencepiece.bpe.model", <add> } <add>} <add> <add>PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES = { <add> 'camembert-base': None, <add>} <add> <ide> class CamembertTokenizer(PreTrainedTokenizer): <ide> """ <ide> Adapted from RobertaTokenizer and XLNetTokenizer <ide> SentencePiece based tokenizer. Peculiarities: <ide> <ide> - requires `SentencePiece <https://github.com/google/sentencepiece>`_ <ide> """ <del> vocab_files_names = {'vocab_file': None} <add> vocab_files_names = VOCAB_FILES_NAMES <add> pretrained_vocab_files_map = PRETRAINED_VOCAB_FILES_MAP <add> max_model_input_sizes = PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES <ide> <ide> def __init__(self, vocab_file, bos_token="<s>", eos_token="</s>", sep_token="</s>", <ide> cls_token="<s>", unk_token="<unk>", pad_token='<pad>', mask_token='<mask>', **kwargs):
1
Ruby
Ruby
set the join type on construction
8e1b363167c22adcf75e3454dc8bfd34b5801d79
<ide><path>activerecord/lib/active_record/associations/join_dependency.rb <ide> def build(associations, parent = join_parts.last, join_type = Arel::InnerJoin) <ide> raise ConfigurationError, "Association named '#{ associations }' was not found on #{ parent.base_klass.name }; perhaps you misspelled it?" <ide> unless join_association = find_join_association(reflection, parent) <ide> @reflections << reflection <del> join_association = build_join_association(reflection, parent) <del> join_association.join_type = join_type <add> join_association = build_join_association(reflection, parent, join_type) <ide> @join_parts << join_association <ide> cache_joined_association(join_association) <ide> end <ide> def remove_uniq_by_reflection(reflection, records) <ide> end <ide> end <ide> <del> def build_join_association(reflection, parent) <add> def build_join_association(reflection, parent, join_type) <ide> reflection.check_validity! <ide> <ide> if reflection.options[:polymorphic] <ide> raise EagerLoadPolymorphicError.new(reflection) <ide> end <ide> <del> JoinAssociation.new(reflection, self, parent) <add> JoinAssociation.new(reflection, self, parent, join_type) <ide> end <ide> <ide> def construct(parent, associations, join_parts, row) <ide><path>activerecord/lib/active_record/associations/join_dependency/join_association.rb <ide> class JoinAssociation < JoinPart # :nodoc: <ide> delegate :options, :through_reflection, :source_reflection, :chain, :to => :reflection <ide> delegate :alias_tracker, :to => :join_dependency <ide> <del> def initialize(reflection, join_dependency, parent) <add> def initialize(reflection, join_dependency, parent, join_type) <ide> super(reflection.klass) <ide> <ide> @reflection = reflection <ide> @join_dependency = join_dependency <ide> @parent = parent <del> @join_type = Arel::InnerJoin <add> @join_type = join_type <ide> @aliased_prefix = "t#{ join_dependency.join_parts.size }" <ide> @tables = construct_tables.reverse <ide> end
2
PHP
PHP
remove jsonexpression class
2e2fd1ff8deef57f5e03bb0263567ac9efd3367e
<ide><path>src/Illuminate/Database/Query/Grammars/MySqlGrammar.php <ide> namespace Illuminate\Database\Query\Grammars; <ide> <ide> use Illuminate\Database\Query\Builder; <del>use Illuminate\Database\Query\JsonExpression; <ide> <ide> class MySqlGrammar extends Grammar <ide> { <ide> protected function compileUpdateColumns($values) <ide> { <ide> return collect($values)->map(function ($value, $key) { <ide> if ($this->isJsonSelector($key)) { <del> return $this->compileJsonUpdateColumn($key, new JsonExpression($value)); <add> return $this->compileJsonUpdateColumn($key, $value); <ide> } <ide> <ide> return $this->wrap($key).' = '.$this->parameter($value); <ide> })->implode(', '); <ide> } <ide> <ide> /** <del> * Prepares a JSON column being updated using the JSON_SET function. <add> * Prepare a JSON column being updated using the JSON_SET function. <ide> * <ide> * @param string $key <del> * @param \Illuminate\Database\Query\JsonExpression $value <add> * @param mixed $value <ide> * @return string <ide> */ <del> protected function compileJsonUpdateColumn($key, JsonExpression $value) <add> protected function compileJsonUpdateColumn($key, $value) <ide> { <add> if (is_bool($value)) { <add> $value = $value ? 'true' : 'false'; <add> } elseif (is_array($value)) { <add> $value = 'cast(? as json)'; <add> } else { <add> $value = $this->parameter($value); <add> } <add> <ide> [$field, $path] = $this->wrapJsonFieldAndPath($key); <ide> <del> return "{$field} = json_set({$field}{$path}, {$value->getValue()})"; <add> return "{$field} = json_set({$field}{$path}, {$value})"; <ide> } <ide> <ide> /** <ide><path>src/Illuminate/Database/Query/JsonExpression.php <del><?php <del> <del>namespace Illuminate\Database\Query; <del> <del>use InvalidArgumentException; <del> <del>class JsonExpression extends Expression <del>{ <del> /** <del> * Create a new raw query expression. <del> * <del> * @param mixed $value <del> * @return void <del> */ <del> public function __construct($value) <del> { <del> parent::__construct( <del> $this->getJsonBindingParameter($value) <del> ); <del> } <del> <del> /** <del> * Translate the given value into the appropriate JSON binding parameter. <del> * <del> * @param mixed $value <del> * @return string <del> * <del> * @throws \InvalidArgumentException <del> */ <del> protected function getJsonBindingParameter($value) <del> { <del> if ($value instanceof Expression) { <del> return $value->getValue(); <del> } <del> <del> switch ($type = gettype($value)) { <del> case 'boolean': <del> return $value ? 'true' : 'false'; <del> case 'NULL': <del> case 'integer': <del> case 'double': <del> case 'string': <del> case 'object': <del> return '?'; <del> case 'array': <del> return 'cast(? as json)'; <del> } <del> <del> throw new InvalidArgumentException("JSON value is of illegal type: {$type}"); <del> } <del>}
2
Python
Python
fix 2.5 build failure
93b842284f548d1edf2fce7a9109915e094413ad
<ide><path>libcloud/test/compute/test_ssh_client.py <ide> # See the License for the specific language governing permissions and <ide> # limitations under the License. <ide> <add>from __future__ import absolute_import <add> <ide> import sys <ide> import unittest <ide>
1
Javascript
Javascript
add regression test for issue 1697
8b754a9e02cb2404bd780322d440b73aacec7517
<ide><path>test/simple/test-regress-GH-1697.js <add>// Copyright Joyent, Inc. and other Node contributors. <add>// <add>// Permission is hereby granted, free of charge, to any person obtaining a <add>// copy of this software and associated documentation files (the <add>// "Software"), to deal in the Software without restriction, including <add>// without limitation the rights to use, copy, modify, merge, publish, <add>// distribute, sublicense, and/or sell copies of the Software, and to permit <add>// persons to whom the Software is furnished to do so, subject to the <add>// following conditions: <add>// <add>// The above copyright notice and this permission notice shall be included <add>// in all copies or substantial portions of the Software. <add>// <add>// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS <add>// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF <add>// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN <add>// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, <add>// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR <add>// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE <add>// USE OR OTHER DEALINGS IN THE SOFTWARE. <add> <add>var common = require('../common.js'), <add> net = require('net'), <add> spawn = require('child_process').spawn; <add> <add>if (process.argv[2] === 'server') { <add> // Server <add> <add> var server = net.createServer(function(conn) { <add> conn.on('data', function(data) { <add> console.log('server received ' + data.length + ' bytes'); <add> }); <add> <add> conn.on('close', function() { <add> server.close(); <add> }); <add> }); <add> server.listen(common.PORT); <add> <add>} else { <add> // Client <add> <add> var cp = spawn(process.execPath, [process.argv[1], 'server']); <add> cp.stdout.pipe(process.stdout); <add> cp.stderr.pipe(process.stdout); <add> <add> var client = net.createConnection(common.PORT, '127.0.0.1'); <add> client.on('connect', function() { <add> var alot = new Buffer(1024), <add> alittle = new Buffer(1); <add> <add> for (var i = 0; i < 100; i++) { <add> client.write(alot); <add> } <add> <add> // Block the event loop for a while. <add> var start = (new Date()).getTime(); <add> while ((new Date).getTime() < start + 100) {} <add> <add> client.write(alittle); <add> <add> client.destroySoon(); <add> }); <add>} <ide>\ No newline at end of file
1
Javascript
Javascript
extend config window on ui
abe842cf6b68472cc4f84dcec1a5ef94ff98ba5b
<ide><path>airflow/www/static/js/trigger.js <ide> * under the License. <ide> */ <ide> <del>/* global document, CodeMirror */ <add>/* global document, CodeMirror, window */ <ide> <ide> const textArea = document.getElementById('json'); <add>const minHeight = 300; <add>const maxHeight = window.innerHeight - 450; <add>const height = maxHeight > minHeight ? maxHeight : minHeight; <ide> <ide> CodeMirror.fromTextArea(textArea, { <ide> lineNumbers: true, <ide> mode: { name: 'javascript', json: true }, <ide> gutters: ['CodeMirror-lint-markers'], <ide> lint: true, <del>}); <add>}).setSize(null, height);
1
PHP
PHP
fix array tests
cb027980ae229169f427c3a070bcd54c96e8fda4
<ide><path>tests/Cases/ArrTest.php <del><?php <add><?php use Laravel\Arr; <ide> <ide> class ArrTest extends PHPUnit_Framework_TestCase { <ide>
1
Javascript
Javascript
add textures es6 unit tests
7011e96ad34f7dad830d2a1e3a4be3e3799425d9
<ide><path>test/unit/src/textures/CanvasTexture.tests.js <add>/** <add> * @author TristanVALCKE / https://github.com/Itee <add> */ <add>/* global QUnit */ <add> <add>import { CanvasTexture } from '../../../../src/textures/CanvasTexture'; <add> <add>export default QUnit.module( 'Textures', () => { <add> <add> QUnit.module.todo( 'CanvasTexture', () => { <add> <add> // INHERITANCE <add> QUnit.test( "Extending", ( assert ) => { <add> <add> assert.ok( false, "everything's gonna be alright" ); <add> <add> } ); <add> <add> // INSTANCING <add> QUnit.test( "Instancing", ( assert ) => { <add> <add> assert.ok( false, "everything's gonna be alright" ); <add> <add> } ); <add> <add> // PUBLIC STUFF <add> QUnit.test( "isCanvasTexture", ( assert ) => { <add> <add> assert.ok( false, "everything's gonna be alright" ); <add> <add> } ); <add> <add> } ); <add> <add>} ); <ide><path>test/unit/src/textures/CompressedTexture.tests.js <add>/** <add> * @author TristanVALCKE / https://github.com/Itee <add> */ <add>/* global QUnit */ <add> <add>import { CompressedTexture } from '../../../../src/textures/CompressedTexture'; <add> <add>export default QUnit.module( 'Textures', () => { <add> <add> QUnit.module.todo( 'CompressedTexture', () => { <add> <add> // INHERITANCE <add> QUnit.test( "Extending", ( assert ) => { <add> <add> assert.ok( false, "everything's gonna be alright" ); <add> <add> } ); <add> <add> // INSTANCING <add> QUnit.test( "Instancing", ( assert ) => { <add> <add> assert.ok( false, "everything's gonna be alright" ); <add> <add> } ); <add> <add> // PUBLIC STUFF <add> QUnit.test( "isCompressedTexture", ( assert ) => { <add> <add> assert.ok( false, "everything's gonna be alright" ); <add> <add> } ); <add> <add> } ); <add> <add>} ); <ide><path>test/unit/src/textures/CubeTexture.tests.js <add>/** <add> * @author TristanVALCKE / https://github.com/Itee <add> */ <add>/* global QUnit */ <add> <add>import { CubeTexture } from '../../../../src/textures/CubeTexture'; <add> <add>export default QUnit.module( 'Textures', () => { <add> <add> QUnit.module.todo( 'CubeTexture', () => { <add> <add> // INHERITANCE <add> QUnit.test( "Extending", ( assert ) => { <add> <add> assert.ok( false, "everything's gonna be alright" ); <add> <add> } ); <add> <add> // INSTANCING <add> QUnit.test( "Instancing", ( assert ) => { <add> <add> assert.ok( false, "everything's gonna be alright" ); <add> <add> } ); <add> <add> // PROPERTIES <add> QUnit.test( "images", ( assert ) => { <add> <add> assert.ok( false, "everything's gonna be alright" ); <add> <add> } ); <add> <add> // PUBLIC STUFF <add> QUnit.test( "isCubeTexture", ( assert ) => { <add> <add> assert.ok( false, "everything's gonna be alright" ); <add> <add> } ); <add> <add> } ); <add> <add>} ); <ide><path>test/unit/src/textures/DataTexture.tests.js <add>/** <add> * @author TristanVALCKE / https://github.com/Itee <add> */ <add>/* global QUnit */ <add> <add>import { DataTexture } from '../../../../src/textures/DataTexture'; <add> <add>export default QUnit.module( 'Textures', () => { <add> <add> QUnit.module.todo( 'DataTexture', () => { <add> <add> // INHERITANCE <add> QUnit.test( "Extending", ( assert ) => { <add> <add> assert.ok( false, "everything's gonna be alright" ); <add> <add> } ); <add> <add> // INSTANCING <add> QUnit.test( "Instancing", ( assert ) => { <add> <add> assert.ok( false, "everything's gonna be alright" ); <add> <add> } ); <add> <add> // PUBLIC STUFF <add> QUnit.test( "isDataTexture", ( assert ) => { <add> <add> assert.ok( false, "everything's gonna be alright" ); <add> <add> } ); <add> <add> } ); <add> <add>} ); <ide><path>test/unit/src/textures/DepthTexture.tests.js <add>/** <add> * @author TristanVALCKE / https://github.com/Itee <add> */ <add>/* global QUnit */ <add> <add>import { DepthTexture } from '../../../../src/textures/DepthTexture'; <add> <add>export default QUnit.module( 'Textures', () => { <add> <add> QUnit.module.todo( 'DepthTexture', () => { <add> <add> // INHERITANCE <add> QUnit.test( "Extending", ( assert ) => { <add> <add> assert.ok( false, "everything's gonna be alright" ); <add> <add> } ); <add> <add> // INSTANCING <add> QUnit.test( "Instancing", ( assert ) => { <add> <add> assert.ok( false, "everything's gonna be alright" ); <add> <add> } ); <add> <add> // PUBLIC STUFF <add> QUnit.test( "isDepthTexture", ( assert ) => { <add> <add> assert.ok( false, "everything's gonna be alright" ); <add> <add> } ); <add> <add> } ); <add> <add>} ); <ide><path>test/unit/src/textures/Texture.tests.js <add>/** <add> * @author TristanVALCKE / https://github.com/Itee <add> */ <add>/* global QUnit */ <add> <add>import { Texture } from '../../../../src/textures/Texture'; <add> <add>export default QUnit.module( 'Textures', () => { <add> <add> QUnit.module.todo( 'Texture', () => { <add> <add> // INSTANCING <add> QUnit.test( "Instancing", ( assert ) => { <add> <add> assert.ok( false, "everything's gonna be alright" ); <add> <add> } ); <add> <add> // PROPERTIES <add> QUnit.test( "needsUpdate", ( assert ) => { <add> <add> assert.ok( false, "everything's gonna be alright" ); <add> <add> } ); <add> <add> // PUBLIC STUFF <add> QUnit.test( "isTexture", ( assert ) => { <add> <add> assert.ok( false, "everything's gonna be alright" ); <add> <add> } ); <add> <add> QUnit.test( "clone", ( assert ) => { <add> <add> assert.ok( false, "everything's gonna be alright" ); <add> <add> } ); <add> <add> QUnit.test( "copy", ( assert ) => { <add> <add> assert.ok( false, "everything's gonna be alright" ); <add> <add> } ); <add> <add> QUnit.test( "toJSON", ( assert ) => { <add> <add> assert.ok( false, "everything's gonna be alright" ); <add> <add> } ); <add> <add> QUnit.test( "dispose", ( assert ) => { <add> <add> assert.ok( false, "everything's gonna be alright" ); <add> <add> } ); <add> <add> QUnit.test( "transformUv", ( assert ) => { <add> <add> assert.ok( false, "everything's gonna be alright" ); <add> <add> } ); <add> <add> } ); <add> <add>} ); <ide><path>test/unit/src/textures/VideoTexture.tests.js <add>/** <add> * @author TristanVALCKE / https://github.com/Itee <add> */ <add>/* global QUnit */ <add> <add>import { VideoTexture } from '../../../../src/textures/VideoTexture'; <add> <add>export default QUnit.module( 'Textures', () => { <add> <add> QUnit.module.todo( 'VideoTexture', () => { <add> <add> // INHERITANCE <add> QUnit.test( "Extending", ( assert ) => { <add> <add> assert.ok( false, "everything's gonna be alright" ); <add> <add> } ); <add> <add> // INSTANCING <add> QUnit.test( "Instancing", ( assert ) => { <add> <add> assert.ok( false, "everything's gonna be alright" ); <add> <add> } ); <add> <add> // PUBLIC STUFF <add> QUnit.test( "isVideoTexture", ( assert ) => { <add> <add> assert.ok( false, "everything's gonna be alright" ); <add> <add> } ); <add> <add> } ); <add> <add>} );
7
Mixed
Ruby
permit uploading files larger than 5 gb
9c5135ce6a10c8318e25a587620c8cde4563f348
<ide><path>activestorage/CHANGELOG.md <add>* The S3 service now permits uploading files larger than 5 gigabytes. <ide> <add> When uploading a file greater than 100 megabytes in size, the service <add> transparently switches to [multipart uploads](https://docs.aws.amazon.com/AmazonS3/latest/dev/mpuoverview.html) <add> using a part size computed from the file's total size and S3's part count limit. <add> <add> No application changes are necessary to take advantage of this feature. You <add> can customize the default 100 MB multipart upload threshold in your S3 <add> service's configuration: <add> <add> ```yaml <add> production: <add> service: s3 <add> access_key_id: <%= Rails.application.credentials.dig(:aws, :access_key_id) %> <add> secret_access_key: <%= Rails.application.credentials.dig(:aws, :secret_access_key) %> <add> region: us-east-1 <add> bucket: my-bucket <add> upload: <add> multipart_threshold: <%= 250.megabytes %> <add> ``` <add> <add> *George Claghorn* <ide> <ide> Please check [6-0-stable](https://github.com/rails/rails/blob/6-0-stable/activestorage/CHANGELOG.md) for previous changes. <ide><path>activestorage/lib/active_storage/service/s3_service.rb <ide> # frozen_string_literal: true <ide> <add>gem "aws-sdk-s3", "~> 1.14" <add> <ide> require "aws-sdk-s3" <ide> require "active_support/core_ext/numeric/bytes" <ide> <ide> module ActiveStorage <ide> # Wraps the Amazon Simple Storage Service (S3) as an Active Storage service. <ide> # See ActiveStorage::Service for the generic API documentation that applies to all services. <ide> class Service::S3Service < Service <del> attr_reader :client, :bucket, :upload_options <add> attr_reader :client, :bucket <add> attr_reader :multipart_upload_threshold, :upload_options <ide> <ide> def initialize(bucket:, upload: {}, **options) <ide> @client = Aws::S3::Resource.new(**options) <ide> @bucket = @client.bucket(bucket) <ide> <add> @multipart_upload_threshold = upload.fetch(:multipart_threshold, 100.megabytes) <ide> @upload_options = upload <ide> end <ide> <ide> def upload(key, io, checksum: nil, content_type: nil, **) <ide> instrument :upload, key: key, checksum: checksum do <del> object_for(key).put(upload_options.merge(body: io, content_md5: checksum, content_type: content_type)) <del> rescue Aws::S3::Errors::BadDigest <del> raise ActiveStorage::IntegrityError <add> if io.size < multipart_upload_threshold <add> upload_with_single_part key, io, checksum: checksum, content_type: content_type <add> else <add> upload_with_multipart key, io, content_type: content_type <add> end <ide> end <ide> end <ide> <ide> def headers_for_direct_upload(key, content_type:, checksum:, **) <ide> end <ide> <ide> private <add> MAXIMUM_UPLOAD_PARTS_COUNT = 10000 <add> MINIMUM_UPLOAD_PART_SIZE = 5.megabytes <add> <add> def upload_with_single_part(key, io, checksum: nil, content_type: nil) <add> object_for(key).put(body: io, content_md5: checksum, content_type: content_type, **upload_options) <add> rescue Aws::S3::Errors::BadDigest <add> raise ActiveStorage::IntegrityError <add> end <add> <add> def upload_with_multipart(key, io, content_type: nil) <add> part_size = [ io.size.fdiv(MAXIMUM_UPLOAD_PARTS_COUNT).ceil, MINIMUM_UPLOAD_PART_SIZE ].max <add> <add> object_for(key).upload_stream(content_type: content_type, part_size: part_size, **upload_options) do |out| <add> IO.copy_stream(io, out) <add> end <add> end <add> <add> <ide> def object_for(key) <ide> bucket.object(key) <ide> end <ide><path>activestorage/test/service/s3_service_test.rb <ide> class ActiveStorage::Service::S3ServiceTest < ActiveSupport::TestCase <ide> end <ide> <ide> test "uploading with server-side encryption" do <del> config = SERVICE_CONFIGURATIONS.deep_merge(s3: { upload: { server_side_encryption: "AES256" } }) <del> service = ActiveStorage::Service.configure(:s3, config) <add> service = build_service(upload: { server_side_encryption: "AES256" }) <ide> <ide> begin <ide> key = SecureRandom.base58(24) <ide> class ActiveStorage::Service::S3ServiceTest < ActiveSupport::TestCase <ide> ensure <ide> @service.delete key <ide> end <add> <add> test "uploading a large object in multiple parts" do <add> service = build_service(upload: { multipart_threshold: 5.megabytes }) <add> <add> begin <add> key = SecureRandom.base58(24) <add> data = SecureRandom.bytes(8.megabytes) <add> <add> service.upload key, StringIO.new(data), checksum: Digest::MD5.base64digest(data) <add> assert data == service.download(key) <add> ensure <add> service.delete key <add> end <add> end <add> <add> private <add> def build_service(configuration) <add> ActiveStorage::Service.configure :s3, SERVICE_CONFIGURATIONS.deep_merge(s3: configuration) <add> end <ide> end <ide> else <ide> puts "Skipping S3 Service tests because no S3 configuration was supplied"
3
Mixed
Javascript
implement ref() and unref() on client sessions
120ea9b5c480c985dc77846a150008f6092c08d0
<ide><path>doc/api/http2.md <ide> session.ping(Buffer.from('abcdefgh'), (err, duration, payload) => { <ide> If the `payload` argument is not specified, the default payload will be the <ide> 64-bit timestamp (little endian) marking the start of the `PING` duration. <ide> <del>#### http2session.remoteSettings <add>#### http2session.ref() <ide> <!-- YAML <del>added: v8.4.0 <add>added: REPLACEME <ide> --> <ide> <del>* Value: {[Settings Object][]} <add>Calls [`ref()`][`net.Socket.prototype.ref`] on this `Http2Session` <add>instance's underlying [`net.Socket`]. <ide> <del>A prototype-less object describing the current remote settings of this <del>`Http2Session`. The remote settings are set by the *connected* HTTP/2 peer. <del> <del>#### http2session.request(headers[, options]) <add>#### http2session.remoteSettings <ide> <!-- YAML <ide> added: v8.4.0 <ide> --> <ide> <del>* `headers` {[Headers Object][]} <del>* `options` {Object} <del> * `endStream` {boolean} `true` if the `Http2Stream` *writable* side should <del> be closed initially, such as when sending a `GET` request that should not <del> expect a payload body. <del> * `exclusive` {boolean} When `true` and `parent` identifies a parent Stream, <del> the created stream is made the sole direct dependency of the parent, with <del> all other existing dependents made a dependent of the newly created stream. <del> **Default:** `false` <del> * `parent` {number} Specifies the numeric identifier of a stream the newly <del> created stream is dependent on. <del> * `weight` {number} Specifies the relative dependency of a stream in relation <del> to other streams with the same `parent`. The value is a number between `1` <del> and `256` (inclusive). <del> * `getTrailers` {Function} Callback function invoked to collect trailer <del> headers. <del> <del>* Returns: {ClientHttp2Stream} <del> <del>For HTTP/2 Client `Http2Session` instances only, the `http2session.request()` <del>creates and returns an `Http2Stream` instance that can be used to send an <del>HTTP/2 request to the connected server. <del> <del>This method is only available if `http2session.type` is equal to <del>`http2.constants.NGHTTP2_SESSION_CLIENT`. <del> <del>```js <del>const http2 = require('http2'); <del>const clientSession = http2.connect('https://localhost:1234'); <del>const { <del> HTTP2_HEADER_PATH, <del> HTTP2_HEADER_STATUS <del>} = http2.constants; <del> <del>const req = clientSession.request({ [HTTP2_HEADER_PATH]: '/' }); <del>req.on('response', (headers) => { <del> console.log(headers[HTTP2_HEADER_STATUS]); <del> req.on('data', (chunk) => { /** .. **/ }); <del> req.on('end', () => { /** .. **/ }); <del>}); <del>``` <del> <del>When set, the `options.getTrailers()` function is called immediately after <del>queuing the last chunk of payload data to be sent. The callback is passed a <del>single object (with a `null` prototype) that the listener may used to specify <del>the trailing header fields to send to the peer. <del> <del>*Note*: The HTTP/1 specification forbids trailers from containing HTTP/2 <del>"pseudo-header" fields (e.g. `':method'`, `':path'`, etc). An `'error'` event <del>will be emitted if the `getTrailers` callback attempts to set such header <del>fields. <del> <del>The the `:method` and `:path` pseudoheaders are not specified within `headers`, <del>they respectively default to: <add>* Value: {[Settings Object][]} <ide> <del>* `:method` = `'GET'` <del>* `:path` = `/` <add>A prototype-less object describing the current remote settings of this <add>`Http2Session`. The remote settings are set by the *connected* HTTP/2 peer. <ide> <ide> #### http2session.setTimeout(msecs, callback) <ide> <!-- YAML <ide> The `http2session.type` will be equal to <ide> server, and `http2.constants.NGHTTP2_SESSION_CLIENT` if the instance is a <ide> client. <ide> <add>#### http2session.unref() <add><!-- YAML <add>added: REPLACEME <add>--> <add> <add>Calls [`unref()`][`net.Socket.prototype.unref`] on this `Http2Session` <add>instance's underlying [`net.Socket`]. <add> <add>### Class: ClientHttp2Session <add><!-- YAML <add>added: v8.4.0 <add>--> <add> <add>#### clienthttp2session.request(headers[, options]) <add><!-- YAML <add>added: v8.4.0 <add>--> <add> <add>* `headers` {[Headers Object][]} <add>* `options` {Object} <add> * `endStream` {boolean} `true` if the `Http2Stream` *writable* side should <add> be closed initially, such as when sending a `GET` request that should not <add> expect a payload body. <add> * `exclusive` {boolean} When `true` and `parent` identifies a parent Stream, <add> the created stream is made the sole direct dependency of the parent, with <add> all other existing dependents made a dependent of the newly created stream. <add> **Default:** `false` <add> * `parent` {number} Specifies the numeric identifier of a stream the newly <add> created stream is dependent on. <add> * `weight` {number} Specifies the relative dependency of a stream in relation <add> to other streams with the same `parent`. The value is a number between `1` <add> and `256` (inclusive). <add> * `getTrailers` {Function} Callback function invoked to collect trailer <add> headers. <add> <add>* Returns: {ClientHttp2Stream} <add> <add>For HTTP/2 Client `Http2Session` instances only, the `http2session.request()` <add>creates and returns an `Http2Stream` instance that can be used to send an <add>HTTP/2 request to the connected server. <add> <add>This method is only available if `http2session.type` is equal to <add>`http2.constants.NGHTTP2_SESSION_CLIENT`. <add> <add>```js <add>const http2 = require('http2'); <add>const clientSession = http2.connect('https://localhost:1234'); <add>const { <add> HTTP2_HEADER_PATH, <add> HTTP2_HEADER_STATUS <add>} = http2.constants; <add> <add>const req = clientSession.request({ [HTTP2_HEADER_PATH]: '/' }); <add>req.on('response', (headers) => { <add> console.log(headers[HTTP2_HEADER_STATUS]); <add> req.on('data', (chunk) => { /** .. **/ }); <add> req.on('end', () => { /** .. **/ }); <add>}); <add>``` <add> <add>When set, the `options.getTrailers()` function is called immediately after <add>queuing the last chunk of payload data to be sent. The callback is passed a <add>single object (with a `null` prototype) that the listener may used to specify <add>the trailing header fields to send to the peer. <add> <add>*Note*: The HTTP/1 specification forbids trailers from containing HTTP/2 <add>"pseudo-header" fields (e.g. `':method'`, `':path'`, etc). An `'error'` event <add>will be emitted if the `getTrailers` callback attempts to set such header <add>fields. <add> <add>The `:method` and `:path` pseudoheaders are not specified within `headers`, <add>they respectively default to: <add> <add>* `:method` = `'GET'` <add>* `:path` = `/` <add> <ide> ### Class: Http2Stream <ide> <!-- YAML <ide> added: v8.4.0 <ide> changes: <ide> [`Duplex`][] stream that is to be used as the connection for this session. <ide> * ...: Any [`net.connect()`][] or [`tls.connect()`][] options can be provided. <ide> * `listener` {Function} <del>* Returns {Http2Session} <add>* Returns {ClientHttp2Session} <ide> <del>Returns a HTTP/2 client `Http2Session` instance. <add>Returns a `ClientHttp2Session` instance. <ide> <ide> ```js <ide> const http2 = require('http2'); <ide> if the stream is closed. <ide> [`http2.createServer()`]: #http2_http2_createserver_options_onrequesthandler <ide> [`http2stream.pushStream()`]: #http2_http2stream_pushstream_headers_options_callback <ide> [`net.Socket`]: net.html#net_class_net_socket <add>[`net.Socket.prototype.ref`]: net.html#net_socket_ref <add>[`net.Socket.prototype.unref`]: net.html#net_socket_unref <ide> [`net.connect()`]: net.html#net_net_connect <ide> [`request.socket.getPeerCertificate()`]: tls.html#tls_tlssocket_getpeercertificate_detailed <ide> [`response.end()`]: #http2_response_end_data_encoding_callback <ide><path>lib/internal/http2/core.js <ide> class Http2Session extends EventEmitter { <ide> <ide> process.nextTick(emit, this, 'timeout'); <ide> } <add> <add> ref() { <add> if (this[kSocket]) { <add> this[kSocket].ref(); <add> } <add> } <add> <add> unref() { <add> if (this[kSocket]) { <add> this[kSocket].unref(); <add> } <add> } <ide> } <ide> <ide> // ServerHttp2Session instances should never have to wait for the socket <ide><path>lib/net.js <ide> Socket.prototype.ref = function() { <ide> return this; <ide> } <ide> <del> this._handle.ref(); <add> if (typeof this._handle.ref === 'function') { <add> this._handle.ref(); <add> } <ide> <ide> return this; <ide> }; <ide> Socket.prototype.unref = function() { <ide> return this; <ide> } <ide> <del> this._handle.unref(); <add> if (typeof this._handle.unref === 'function') { <add> this._handle.unref(); <add> } <ide> <ide> return this; <ide> }; <ide><path>test/parallel/test-http2-session-unref.js <add>'use strict'; <add>// Flags: --expose-internals <add> <add>// Tests that calling unref() on Http2Session: <add>// (1) Prevents it from keeping the process alive <add>// (2) Doesn't crash <add> <add>const common = require('../common'); <add>if (!common.hasCrypto) <add> common.skip('missing crypto'); <add>const http2 = require('http2'); <add>const makeDuplexPair = require('../common/duplexpair'); <add> <add>const server = http2.createServer(); <add>const { clientSide, serverSide } = makeDuplexPair(); <add> <add>// 'session' event should be emitted 3 times: <add>// - the vanilla client <add>// - the destroyed client <add>// - manual 'connection' event emission with generic Duplex stream <add>server.on('session', common.mustCallAtLeast((session) => { <add> session.unref(); <add>}, 3)); <add> <add>server.listen(0, common.mustCall(() => { <add> const port = server.address().port; <add> <add> // unref new client <add> { <add> const client = http2.connect(`http://localhost:${port}`); <add> client.unref(); <add> } <add> <add> // unref destroyed client <add> { <add> const client = http2.connect(`http://localhost:${port}`); <add> client.destroy(); <add> client.unref(); <add> } <add> <add> // unref destroyed client <add> { <add> const client = http2.connect(`http://localhost:${port}`, { <add> createConnection: common.mustCall(() => clientSide) <add> }); <add> client.destroy(); <add> client.unref(); <add> } <add>})); <add>server.emit('connection', serverSide); <add>server.unref(); <add> <add>setTimeout(common.mustNotCall(() => {}), 1000).unref();
4
Ruby
Ruby
add user to staff if necessary
e12165138fe4064d42a016249d13daa40db8c070
<ide><path>install_homebrew.rb <ide> # If you do fork, please ensure you add a comment here that explains what the <ide> # changes are intended to do and how well you tested them. <ide> # <add># 30th March 2010: <add># Added a check to make sure user is in the staff group. This was a problem <add># for me, and I think it was due to me migrating my account over several <add># versions of OS X. I cannot verify that for sure, and it was tested on <add># 10.6.2 using the Directory Service command line utility and my laptop. <add># <add># My assumptions are: <add># - you are running OS X 10.6.x <add># - your machine is not managed as part of a group using networked <add># Directory Services <add># - you have not recently killed any baby seals or kittens <add># <ide> # 14th March 2010: <ide> # Adapted CodeButler's fork: http://gist.github.com/331512 <ide> # <ide> def getc # NOTE only tested on OS X <ide> select{ |d| File.directory? d and not File.writable? d } <ide> chgrps = chmods.reject{ |d| File.stat(d).grpowned? } <ide> <add>unless `groups`.split.include?("staff") <add> ohai "The user #{`whoami`.strip} will be added to the staff group." <add>end <add> <ide> unless chmods.empty? <ide> ohai "The following directories will be made group writable:" <ide> puts *chmods <ide> def getc # NOTE only tested on OS X <ide> puts "Press enter to continue" <ide> abort unless getc == 13 <ide> <add>unless `groups`.split.include?("staff") <add> sudo "dscl /Local/Default -append /Groups/staff GroupMembership #{`whoami`.strip}" <add>end <add> <ide> if File.directory? "/usr/local" <ide> sudo "/bin/chmod", "g+w", *chmods unless chmods.empty? <ide> # all admin users are in staff
1
Python
Python
add support for stateful metrics.
e6c3f77b0b10b0d76778109a40d6d3282f1cadd0
<ide><path>keras/backend/cntk_backend.py <ide> def batch_get_value(xs): <ide> def set_value(x, value): <ide> if (isinstance(x, C.variables.Parameter) or <ide> isinstance(x, C.variables.Constant)): <del> if isinstance(value, float): <del> value = np.full(x.shape, value) <add> if isinstance(value, (float, int)): <add> value = np.full(x.shape, value, dtype=floatx()) <ide> x.value = value <ide> else: <ide> raise NotImplementedError <ide><path>keras/callbacks.py <ide> from collections import Iterable <ide> from .utils.generic_utils import Progbar <ide> from . import backend as K <add>from .engine.topology import Layer <ide> <ide> try: <ide> import requests <ide> class BaseLogger(Callback): <ide> """Callback that accumulates epoch averages of metrics. <ide> <ide> This callback is automatically applied to every Keras model. <add> <add> # Arguments <add> stateful_metrics: Iterable of string names of metrics that <add> should *not* be averaged over an epoch. <add> Metrics in this list will be logged as-is in `on_epoch_end`. <add> All others will be averaged in `on_epoch_end`. <ide> """ <ide> <add> def __init__(self, stateful_metrics=None): <add> if stateful_metrics: <add> self.stateful_metrics = set(stateful_metrics) <add> else: <add> self.stateful_metrics = set() <add> <ide> def on_epoch_begin(self, epoch, logs=None): <ide> self.seen = 0 <ide> self.totals = {} <ide> def on_batch_end(self, batch, logs=None): <ide> self.seen += batch_size <ide> <ide> for k, v in logs.items(): <del> if k in self.totals: <del> self.totals[k] += v * batch_size <add> if k in self.stateful_metrics: <add> self.totals[k] = v <ide> else: <del> self.totals[k] = v * batch_size <add> if k in self.totals: <add> self.totals[k] += v * batch_size <add> else: <add> self.totals[k] = v * batch_size <ide> <ide> def on_epoch_end(self, epoch, logs=None): <ide> if logs is not None: <ide> for k in self.params['metrics']: <ide> if k in self.totals: <ide> # Make value available to next callbacks. <del> logs[k] = self.totals[k] / self.seen <add> if k in self.stateful_metrics: <add> logs[k] = self.totals[k] <add> else: <add> logs[k] = self.totals[k] / self.seen <ide> <ide> <ide> class TerminateOnNaN(Callback): <ide> class ProgbarLogger(Callback): <ide> count_mode: One of "steps" or "samples". <ide> Whether the progress bar should <ide> count samples seen or steps (batches) seen. <add> stateful_metrics: Iterable of string names of metrics that <add> should *not* be averaged over an epoch. <add> Metrics in this list will be logged as-is. <add> All others will be averaged over time (e.g. loss, etc). <ide> <ide> # Raises <ide> ValueError: In case of invalid `count_mode`. <ide> """ <ide> <del> def __init__(self, count_mode='samples'): <add> def __init__(self, count_mode='samples', <add> stateful_metrics=None): <ide> super(ProgbarLogger, self).__init__() <ide> if count_mode == 'samples': <ide> self.use_steps = False <ide> elif count_mode == 'steps': <ide> self.use_steps = True <ide> else: <ide> raise ValueError('Unknown `count_mode`: ' + str(count_mode)) <add> if stateful_metrics: <add> self.stateful_metrics = set(stateful_metrics) <add> else: <add> self.stateful_metrics = set() <ide> <ide> def on_train_begin(self, logs=None): <ide> self.verbose = self.params['verbose'] <ide> def on_epoch_begin(self, epoch, logs=None): <ide> target = self.params['samples'] <ide> self.target = target <ide> self.progbar = Progbar(target=self.target, <del> verbose=self.verbose) <add> verbose=self.verbose, <add> stateful_metrics=self.stateful_metrics) <ide> self.seen = 0 <ide> <ide> def on_batch_begin(self, batch, logs=None): <ide><path>keras/engine/training.py <ide> from scipy.sparse import issparse <ide> <ide> from .topology import Container <add>from .topology import Layer <ide> from .. import backend as K <ide> from .. import optimizers <ide> from .. import losses <ide> def compile(self, optimizer, loss=None, metrics=None, loss_weights=None, <ide> self._feed_sample_weight_modes.append(self.sample_weight_modes[i]) <ide> <ide> # Prepare metrics. <del> self.metrics = metrics <add> self.metrics = metrics or [] <ide> self.weighted_metrics = weighted_metrics <ide> self.metrics_names = ['loss'] <ide> self.metrics_tensors = [] <ide> def compile(self, optimizer, loss=None, metrics=None, loss_weights=None, <ide> # contains tuples (metrics for output, names of metrics). <ide> nested_metrics = _collect_metrics(metrics, self.output_names) <ide> nested_weighted_metrics = _collect_metrics(weighted_metrics, self.output_names) <del> <del> def append_metric(layer_index, metric_name, metric_tensor): <del> """Helper function used in loop below.""" <del> if len(self.output_names) > 1: <del> metric_name = self.output_names[layer_index] + '_' + metric_name <del> self.metrics_names.append(metric_name) <del> self.metrics_tensors.append(metric_tensor) <del> <add> self.metrics_updates = [] <add> self.stateful_metric_names = [] <ide> with K.name_scope('metrics'): <ide> for i in range(len(self.outputs)): <ide> if i in skip_target_indices: <ide> def handle_metrics(metrics, weights=None): <ide> self.loss_functions[i] == losses.binary_crossentropy): <ide> # case: binary accuracy/crossentropy <ide> if metric in ('accuracy', 'acc'): <del> acc_fn = metrics_module.binary_accuracy <add> metric_fn = metrics_module.binary_accuracy <ide> elif metric in ('crossentropy', 'ce'): <del> acc_fn = metrics_module.binary_crossentropy <add> metric_fn = metrics_module.binary_crossentropy <ide> elif self.loss_functions[i] == losses.sparse_categorical_crossentropy: <ide> # case: categorical accuracy/crossentropy with sparse targets <ide> if metric in ('accuracy', 'acc'): <del> acc_fn = metrics_module.sparse_categorical_accuracy <add> metric_fn = metrics_module.sparse_categorical_accuracy <ide> elif metric in ('crossentropy', 'ce'): <del> acc_fn = metrics_module.sparse_categorical_crossentropy <add> metric_fn = metrics_module.sparse_categorical_crossentropy <ide> else: <ide> # case: categorical accuracy/crossentropy <ide> if metric in ('accuracy', 'acc'): <del> acc_fn = metrics_module.categorical_accuracy <add> metric_fn = metrics_module.categorical_accuracy <ide> elif metric in ('crossentropy', 'ce'): <del> acc_fn = metrics_module.categorical_crossentropy <add> metric_fn = metrics_module.categorical_crossentropy <ide> if metric in ('accuracy', 'acc'): <ide> suffix = 'acc' <ide> elif metric in ('crossentropy', 'ce'): <ide> suffix = 'ce' <del> weighted_metric_fn = _weighted_masked_objective(acc_fn) <add> weighted_metric_fn = _weighted_masked_objective(metric_fn) <ide> metric_name = metric_name_prefix + suffix <ide> else: <ide> metric_fn = metrics_module.get(metric) <ide> weighted_metric_fn = _weighted_masked_objective(metric_fn) <del> metric_name = metric_name_prefix + metric_fn.__name__ <add> # Get metric name as string <add> if hasattr(metric_fn, 'name'): <add> metric_name = metric_fn.name <add> else: <add> metric_name = metric_fn.__name__ <add> metric_name = metric_name_prefix + metric_name <ide> <ide> with K.name_scope(metric_name): <ide> metric_result = weighted_metric_fn(y_true, y_pred, <ide> weights=weights, <ide> mask=masks[i]) <del> append_metric(i, metric_name, metric_result) <add> <add> # Append to self.metrics_names, self.metric_tensors, <add> # self.stateful_metric_names <add> if len(self.output_names) > 1: <add> metric_name = self.output_names[i] + '_' + metric_name <add> # Dedupe name <add> j = 1 <add> base_metric_name = metric_name <add> while metric_name in self.metrics_names: <add> metric_name = base_metric_name + '_' + str(j) <add> j += 1 <add> self.metrics_names.append(metric_name) <add> self.metrics_tensors.append(metric_result) <add> <add> # Keep track of state updates created by <add> # stateful metrics (i.e. metrics layers). <add> if isinstance(metric_fn, Layer): <add> self.stateful_metric_names.append(metric_name) <add> self.metrics_updates += metric_fn.updates <ide> <ide> handle_metrics(output_metrics) <ide> handle_metrics(output_weighted_metrics, weights=weights) <ide> def _make_train_function(self): <ide> training_updates = self.optimizer.get_updates( <ide> params=self._collected_trainable_weights, <ide> loss=self.total_loss) <del> updates = self.updates + training_updates <add> updates = self.updates + training_updates + self.metrics_updates <ide> # Gets loss and metrics. Updates weights at each call. <ide> self.train_function = K.function(inputs, <ide> [self.total_loss] + self.metrics_tensors, <ide> def _make_test_function(self): <ide> # Does update the network states. <ide> self.test_function = K.function(inputs, <ide> [self.total_loss] + self.metrics_tensors, <del> updates=self.state_updates, <add> updates=self.state_updates + self.metrics_updates, <ide> name='test_function', <ide> **self._function_kwargs) <ide> <ide> def _fit_loop(self, f, ins, out_labels=None, batch_size=None, <ide> index_array = np.arange(num_train_samples) <ide> <ide> self.history = cbks.History() <del> callbacks = [cbks.BaseLogger()] + (callbacks or []) + [self.history] <add> _callbacks = [cbks.BaseLogger( <add> stateful_metrics=self.stateful_metric_names)] <ide> if verbose: <ide> if steps_per_epoch is not None: <ide> count_mode = 'steps' <ide> else: <ide> count_mode = 'samples' <del> callbacks.insert(1, cbks.ProgbarLogger(count_mode)) <del> callbacks = cbks.CallbackList(callbacks) <add> _callbacks.append( <add> cbks.ProgbarLogger( <add> count_mode, <add> stateful_metrics=self.stateful_metric_names)) <add> _callbacks += (callbacks or []) + [self.history] <add> callbacks = cbks.CallbackList(_callbacks) <ide> out_labels = out_labels or [] <ide> <ide> # it's possible to callback a different model than self <ide> def _fit_loop(self, f, ins, out_labels=None, batch_size=None, <ide> indices_for_conversion_to_dense.append(i) <ide> <ide> for epoch in range(initial_epoch, epochs): <add> # Reset stateful metrics <add> for m in self.metrics: <add> if isinstance(m, Layer): <add> m.reset_states() <ide> callbacks.on_epoch_begin(epoch) <ide> epoch_logs = {} <ide> if steps_per_epoch is not None: <ide> def _predict_loop(self, f, ins, batch_size=32, verbose=0, steps=None): <ide> or list of arrays of predictions <ide> (if the model has multiple outputs). <ide> """ <add> <add> if hasattr(self, 'metrics'): <add> for m in self.metrics: <add> if isinstance(m, Layer): <add> m.reset_states() <ide> num_samples = self._check_num_samples(ins, batch_size, <ide> steps, <ide> 'steps') <ide> if verbose == 1: <ide> if steps is not None: <del> progbar = Progbar(target=steps) <add> progbar = Progbar(target=steps, <add> stateful_metrics=self.stateful_metric_names) <ide> else: <del> progbar = Progbar(target=num_samples) <add> progbar = Progbar(target=num_samples, <add> stateful_metrics=self.stateful_metric_names) <ide> <ide> indices_for_conversion_to_dense = [] <ide> for i in range(len(self._feed_inputs)): <ide> def _test_loop(self, f, ins, batch_size=None, verbose=0, steps=None): <ide> and/or metrics). The attribute `model.metrics_names` will give you <ide> the display labels for the scalar outputs. <ide> """ <add> <add> if hasattr(self, 'metrics'): <add> for m in self.metrics: <add> if isinstance(m, Layer): <add> m.reset_states() <add> stateful_metric_indices = [ <add> i for i, name in enumerate(self.metrics_names) <add> if str(name) in self.stateful_metric_names] <add> else: <add> stateful_metric_indices = [] <add> <ide> num_samples = self._check_num_samples(ins, batch_size, <ide> steps, <ide> 'steps') <ide> def _test_loop(self, f, ins, batch_size=None, verbose=0, steps=None): <ide> for _ in enumerate(batch_outs): <ide> outs.append(0.) <ide> for i, batch_out in enumerate(batch_outs): <del> outs[i] += batch_out <add> if i in stateful_metric_indices: <add> outs[i] = batch_out <add> else: <add> outs[i] += batch_out <ide> else: <ide> if step == 0: <ide> outs.append(0.) <ide> outs[0] += batch_outs <ide> if verbose == 1: <ide> progbar.update(step + 1) <ide> for i in range(len(outs)): <del> outs[i] /= steps <add> if i not in stateful_metric_indices: <add> outs[i] /= steps <ide> else: <ide> batches = _make_batches(num_samples, batch_size) <ide> index_array = np.arange(num_samples) <ide> def _test_loop(self, f, ins, batch_size=None, verbose=0, steps=None): <ide> for batch_out in enumerate(batch_outs): <ide> outs.append(0.) <ide> for i, batch_out in enumerate(batch_outs): <del> outs[i] += batch_out * len(batch_ids) <add> if i in stateful_metric_indices: <add> outs[i] = batch_out <add> else: <add> outs[i] += batch_out * len(batch_ids) <ide> else: <ide> if batch_index == 0: <ide> outs.append(0.) <ide> def _test_loop(self, f, ins, batch_size=None, verbose=0, steps=None): <ide> if verbose == 1: <ide> progbar.update(batch_end) <ide> for i in range(len(outs)): <del> outs[i] /= num_samples <add> if i not in stateful_metric_indices: <add> outs[i] /= num_samples <ide> if len(outs) == 1: <ide> return outs[0] <ide> return outs <ide> def _standardize_user_data(self, x, y, <ide> str(x[0].shape[0]) + ' samples') <ide> return x, y, sample_weights <ide> <del> def _get_deduped_metrics_names(self): <del> out_labels = self.metrics_names <del> <del> # Rename duplicated metrics name <del> # (can happen with an output layer shared among multiple dataflows). <del> deduped_out_labels = [] <del> for i, label in enumerate(out_labels): <del> new_label = label <del> if out_labels.count(label) > 1: <del> dup_idx = out_labels[:i].count(label) <del> new_label += '_' + str(dup_idx + 1) <del> deduped_out_labels.append(new_label) <del> return deduped_out_labels <del> <ide> def fit(self, <ide> x=None, <ide> y=None, <ide> def fit(self, <ide> f = self.train_function <ide> <ide> # Prepare display labels. <del> out_labels = self._get_deduped_metrics_names() <add> out_labels = self.metrics_names <ide> <ide> if do_validation: <ide> self._make_test_function() <ide> def generate_arrays_from_file(path): <ide> ' the `keras.utils.Sequence` class.') <ide> <ide> # Prepare display labels. <del> out_labels = self._get_deduped_metrics_names() <add> out_labels = self.metrics_names <ide> callback_metrics = out_labels + ['val_' + n for n in out_labels] <ide> <ide> # prepare callbacks <ide> self.history = cbks.History() <del> callbacks = [cbks.BaseLogger()] + (callbacks or []) + [self.history] <add> _callbacks = [cbks.BaseLogger( <add> stateful_metrics=self.stateful_metric_names)] <ide> if verbose: <del> callbacks.insert(1, cbks.ProgbarLogger(count_mode='steps')) <del> callbacks = cbks.CallbackList(callbacks) <add> _callbacks.append( <add> cbks.ProgbarLogger( <add> count_mode='steps', <add> stateful_metrics=self.stateful_metric_names)) <add> _callbacks += (callbacks or []) + [self.history] <add> callbacks = cbks.CallbackList(_callbacks) <ide> <ide> # it's possible to callback a different model than self: <ide> if hasattr(self, 'callback_model') and self.callback_model: <ide><path>keras/metrics.py <ide> from .losses import poisson <ide> from .losses import cosine_proximity <ide> from .utils.generic_utils import deserialize_keras_object <add>from .utils.generic_utils import serialize_keras_object <ide> <ide> <ide> def binary_accuracy(y_true, y_pred): <ide> def sparse_top_k_categorical_accuracy(y_true, y_pred, k=5): <ide> <ide> <ide> def serialize(metric): <del> return metric.__name__ <add> return serialize_keras_object(metric) <ide> <ide> <del>def deserialize(name, custom_objects=None): <del> return deserialize_keras_object(name, <add>def deserialize(config, custom_objects=None): <add> return deserialize_keras_object(config, <ide> module_objects=globals(), <ide> custom_objects=custom_objects, <ide> printable_module_name='metric function') <ide> <ide> <ide> def get(identifier): <del> if isinstance(identifier, six.string_types): <del> identifier = str(identifier) <del> return deserialize(identifier) <add> if isinstance(identifier, dict): <add> config = {'class_name': str(identifier), 'config': {}} <add> return deserialize(config) <add> elif isinstance(identifier, six.string_types): <add> return deserialize(str(identifier)) <ide> elif callable(identifier): <ide> return identifier <ide> else: <ide><path>keras/utils/generic_utils.py <ide> import types as python_types <ide> import inspect <ide> import codecs <add>import collections <ide> <ide> _GLOBAL_CUSTOM_OBJECTS = {} <ide> <ide> class Progbar(object): <ide> <ide> # Arguments <ide> target: Total number of steps expected, None if unknown. <add> width: Progress bar width on screen. <add> verbose: Verbosity mode, 0 (silent), 1 (verbose), 2 (semi-verbose) <add> stateful_metrics: Iterable of string names of metrics that <add> should *not* be averaged over time. Metrics in this list <add> will be displayed as-is. All others will be averaged <add> by the progbar before display. <ide> interval: Minimum visual progress update interval (in seconds). <ide> """ <ide> <del> def __init__(self, target, width=30, verbose=1, interval=0.05): <del> self.width = width <add> def __init__(self, target, width=30, verbose=1, interval=0.05, <add> stateful_metrics=None): <ide> self.target = target <del> self.sum_values = {} <del> self.unique_values = [] <del> self.start = time.time() <del> self.last_update = 0 <del> self.interval = interval <del> self.total_width = 0 <del> self.seen_so_far = 0 <add> self.width = width <ide> self.verbose = verbose <add> self.interval = interval <add> if stateful_metrics: <add> self.stateful_metrics = set(stateful_metrics) <add> else: <add> self.stateful_metrics = set() <add> <ide> self._dynamic_display = ((hasattr(sys.stdout, 'isatty') and <ide> sys.stdout.isatty()) or <ide> 'ipykernel' in sys.modules) <add> self._total_width = 0 <add> self._seen_so_far = 0 <add> self._values = collections.OrderedDict() <add> self._start = time.time() <add> self._last_update = 0 <ide> <ide> def update(self, current, values=None): <ide> """Updates the progress bar. <ide> def update(self, current, values=None): <ide> current: Index of current step. <ide> values: List of tuples: <ide> `(name, value_for_last_step)`. <del> The progress bar will display averages for these values. <add> If `name` is in `stateful_metrics`, <add> `value_for_last_step` will be displayed as-is. <add> Else, an average of the metric over time will be displayed. <ide> """ <ide> values = values or [] <ide> for k, v in values: <del> if k not in self.sum_values: <del> self.sum_values[k] = [v * (current - self.seen_so_far), <del> current - self.seen_so_far] <del> self.unique_values.append(k) <add> if k not in self.stateful_metrics: <add> if k not in self._values: <add> self._values[k] = [v * (current - self._seen_so_far), <add> current - self._seen_so_far] <add> else: <add> self._values[k][0] += v * (current - self._seen_so_far) <add> self._values[k][1] += (current - self._seen_so_far) <ide> else: <del> self.sum_values[k][0] += v * (current - self.seen_so_far) <del> self.sum_values[k][1] += (current - self.seen_so_far) <del> self.seen_so_far = current <add> self._values[k] = v <add> self._seen_so_far = current <ide> <ide> now = time.time() <del> info = ' - %.0fs' % (now - self.start) <add> info = ' - %.0fs' % (now - self._start) <ide> if self.verbose == 1: <del> if (now - self.last_update < self.interval and <add> if (now - self._last_update < self.interval and <ide> self.target is not None and current < self.target): <ide> return <ide> <del> prev_total_width = self.total_width <add> prev_total_width = self._total_width <ide> if self._dynamic_display: <ide> sys.stdout.write('\b' * prev_total_width) <ide> sys.stdout.write('\r') <ide> def update(self, current, values=None): <ide> else: <ide> bar = '%7d/Unknown' % current <ide> <del> self.total_width = len(bar) <add> self._total_width = len(bar) <ide> sys.stdout.write(bar) <ide> <ide> if current: <del> time_per_unit = (now - self.start) / current <add> time_per_unit = (now - self._start) / current <ide> else: <ide> time_per_unit = 0 <ide> if self.target is not None and current < self.target: <ide> def update(self, current, values=None): <ide> else: <ide> info += ' %.0fus/step' % (time_per_unit * 1e6) <ide> <del> for k in self.unique_values: <add> for k in self._values: <ide> info += ' - %s:' % k <del> if isinstance(self.sum_values[k], list): <add> if isinstance(self._values[k], list): <ide> avg = np.mean( <del> self.sum_values[k][0] / max(1, self.sum_values[k][1])) <add> self._values[k][0] / max(1, self._values[k][1])) <ide> if abs(avg) > 1e-3: <ide> info += ' %.4f' % avg <ide> else: <ide> info += ' %.4e' % avg <ide> else: <del> info += ' %s' % self.sum_values[k] <add> info += ' %s' % self._values[k] <ide> <del> self.total_width += len(info) <del> if prev_total_width > self.total_width: <del> info += (' ' * (prev_total_width - self.total_width)) <add> self._total_width += len(info) <add> if prev_total_width > self._total_width: <add> info += (' ' * (prev_total_width - self._total_width)) <ide> <ide> if self.target is not None and current >= self.target: <ide> info += '\n' <ide> def update(self, current, values=None): <ide> <ide> elif self.verbose == 2: <ide> if self.target is None or current >= self.target: <del> for k in self.unique_values: <add> for k in self._values: <ide> info += ' - %s:' % k <ide> avg = np.mean( <del> self.sum_values[k][0] / max(1, self.sum_values[k][1])) <add> self._values[k][0] / max(1, self._values[k][1])) <ide> if avg > 1e-3: <ide> info += ' %.4f' % avg <ide> else: <ide> def update(self, current, values=None): <ide> sys.stdout.write(info) <ide> sys.stdout.flush() <ide> <del> self.last_update = now <add> self._last_update = now <ide> <ide> def add(self, n, values=None): <del> self.update(self.seen_so_far + n, values) <add> self.update(self._seen_so_far + n, values) <ide><path>tests/keras/metrics_test.py <ide> import pytest <ide> import numpy as np <ide> <add>import keras <ide> from keras import metrics <ide> from keras import backend as K <add>from keras.utils.test_utils import keras_test <ide> <ide> all_metrics = [ <ide> metrics.binary_accuracy, <ide> ] <ide> <ide> <add>@keras_test <ide> def test_metrics(): <ide> y_a = K.variable(np.random.random((6, 7))) <ide> y_b = K.variable(np.random.random((6, 7))) <ide> def test_metrics(): <ide> assert K.eval(output).shape == (6,) <ide> <ide> <add>@keras_test <ide> def test_sparse_metrics(): <ide> for metric in all_sparse_metrics: <ide> y_a = K.variable(np.random.randint(0, 7, (6,)), dtype=K.floatx()) <ide> def test_invalid_get(): <ide> <ide> <ide> @pytest.mark.skipif((K.backend() == 'cntk'), <del> reason="keras cntk backend does not support top_k yet") <add> reason='CNTK backend does not support top_k yet') <add>@keras_test <ide> def test_top_k_categorical_accuracy(): <ide> y_pred = K.variable(np.array([[0.3, 0.2, 0.1], [0.1, 0.2, 0.7]])) <ide> y_true = K.variable(np.array([[0, 1, 0], [1, 0, 0]])) <ide> def test_top_k_categorical_accuracy(): <ide> <ide> <ide> @pytest.mark.skipif((K.backend() == 'cntk'), <del> reason="keras cntk backend does not support top_k yet") <add> reason='CNTK backend does not support top_k yet') <add>@keras_test <ide> def test_sparse_top_k_categorical_accuracy(): <ide> y_pred = K.variable(np.array([[0.3, 0.2, 0.1], [0.1, 0.2, 0.7]])) <ide> y_true = K.variable(np.array([[1], [0]])) <ide> def test_sparse_top_k_categorical_accuracy(): <ide> assert failure_result == 0 <ide> <ide> <add>@keras_test <add>def test_stateful_metrics(): <add> np.random.seed(1334) <add> <add> class BinaryTruePositives(keras.layers.Layer): <add> """Stateful Metric to count the total true positives over all batches. <add> <add> Assumes predictions and targets of shape `(samples, 1)`. <add> <add> # Arguments <add> threshold: Float, lower limit on prediction value that counts as a <add> positive class prediction. <add> name: String, name for the metric. <add> """ <add> <add> def __init__(self, name='true_positives', **kwargs): <add> super(BinaryTruePositives, self).__init__(name=name, **kwargs) <add> self.true_positives = K.variable(value=0, dtype='int32') <add> <add> def reset_states(self): <add> K.set_value(self.true_positives, 0) <add> <add> def __call__(self, y_true, y_pred): <add> """Computes the number of true positives in a batch. <add> <add> # Arguments <add> y_true: Tensor, batch_wise labels <add> y_pred: Tensor, batch_wise predictions <add> <add> # Returns <add> The total number of true positives seen this epoch at the <add> completion of the batch. <add> """ <add> y_true = K.cast(y_true, 'int32') <add> y_pred = K.cast(K.round(y_pred), 'int32') <add> correct_preds = K.cast(K.equal(y_pred, y_true), 'int32') <add> true_pos = K.cast(K.sum(correct_preds * y_true), 'int32') <add> current_true_pos = self.true_positives * 1 <add> self.add_update(K.update_add(self.true_positives, <add> true_pos), <add> inputs=[y_true, y_pred]) <add> return current_true_pos + true_pos <add> <add> metric_fn = BinaryTruePositives() <add> config = metrics.serialize(metric_fn) <add> metric_fn = metrics.deserialize( <add> config, custom_objects={'BinaryTruePositives': BinaryTruePositives}) <add> <add> # Test on simple model <add> inputs = keras.Input(shape=(2,)) <add> outputs = keras.layers.Dense(1, activation='sigmoid')(inputs) <add> model = keras.Model(inputs, outputs) <add> model.compile(optimizer='sgd', <add> loss='binary_crossentropy', <add> metrics=['acc', metric_fn]) <add> <add> # Test fit, evaluate <add> samples = 1000 <add> x = np.random.random((samples, 2)) <add> y = np.random.randint(2, size=(samples, 1)) <add> model.fit(x, y, epochs=1, batch_size=10) <add> outs = model.evaluate(x, y, batch_size=10) <add> preds = model.predict(x) <add> <add> def ref_true_pos(y_true, y_pred): <add> return np.sum(np.logical_and(y_pred > 0.5, y_true == 1)) <add> <add> # Test correctness (e.g. updates should have been run) <add> np.testing.assert_allclose(outs[2], ref_true_pos(y, preds), atol=1e-5) <add> <add> <ide> if __name__ == '__main__': <ide> pytest.main([__file__])
6
Javascript
Javascript
update react-tools to support transform as object
4ecde425f9012f3ecad0144a317a03a8977bfa2a
<ide><path>main.js <ide> module.exports = { <ide> output += '\n' + map; <ide> } <ide> return output; <add> }, <add> transformAsObject: function(input, options) { <add> options = options || {}; <add> var visitorList = getVisitors(options.harmony); <add> var resultRaw = transform(visitorList, input, options); <add> var result = { <add> code: resultRaw.code <add> }; <add> if (options.sourceMap) { <add> result.sourceMap = resultRaw.sourceMap; <add> } <add> return result; <ide> } <ide> }; <ide>
1
Javascript
Javascript
move arraystream to common
f2e319b7578326b0f5adb5c986533d3136404cbd
<ide><path>test/common.js <ide> var fs = require('fs'); <ide> var assert = require('assert'); <ide> var os = require('os'); <ide> var child_process = require('child_process'); <add>const stream = require('stream'); <add>const util = require('util'); <ide> <ide> <ide> exports.testDir = path.dirname(__filename); <ide> exports.fileExists = function(pathname) { <ide> exports.fail = function(msg) { <ide> assert.fail(null, null, msg); <ide> }; <add> <add> <add>// A stream to push an array into a REPL <add>function ArrayStream() { <add> this.run = function(data) { <add> data.forEach(line => { <add> this.emit('data', line + '\n'); <add> }); <add> }; <add>} <add> <add>util.inherits(ArrayStream, stream.Stream); <add>exports.ArrayStream = ArrayStream; <add>ArrayStream.prototype.readable = true; <add>ArrayStream.prototype.writable = true; <add>ArrayStream.prototype.pause = function() {}; <add>ArrayStream.prototype.resume = function() {}; <add>ArrayStream.prototype.write = function() {}; <ide><path>test/parallel/test-repl-.save.load.js <ide> common.refreshTmpDir(); <ide> <ide> var repl = require('repl'); <ide> <del>// A stream to push an array into a REPL <del>function ArrayStream() { <del> this.run = function(data) { <del> var self = this; <del> data.forEach(function(line) { <del> self.emit('data', line + '\n'); <del> }); <del> }; <del>} <del>util.inherits(ArrayStream, require('stream').Stream); <del>ArrayStream.prototype.readable = true; <del>ArrayStream.prototype.writable = true; <del>ArrayStream.prototype.resume = function() {}; <del>ArrayStream.prototype.write = function() {}; <del> <ide> var works = [['inner.one'], 'inner.o']; <ide> <del>var putIn = new ArrayStream(); <add>const putIn = new common.ArrayStream(); <ide> var testMe = repl.start('', putIn); <ide> <ide> <ide><path>test/parallel/test-repl-autolibs.js <del>/* eslint-disable required-modules */ <ide> 'use strict'; <add>const common = require('../common'); <ide> var assert = require('assert'); <ide> var util = require('util'); <ide> var repl = require('repl'); <ide> <del>// A stream to push an array into a REPL <del>function ArrayStream() { <del> this.run = function(data) { <del> var self = this; <del> data.forEach(function(line) { <del> self.emit('data', line + '\n'); <del> }); <del> }; <del>} <del>util.inherits(ArrayStream, require('stream').Stream); <del>ArrayStream.prototype.readable = true; <del>ArrayStream.prototype.writable = true; <del>ArrayStream.prototype.resume = function() {}; <del>ArrayStream.prototype.write = function() {}; <add>// This test adds global variables <add>common.globalCheck = false; <ide> <del>var putIn = new ArrayStream(); <add>const putIn = new common.ArrayStream(); <ide> var testMe = repl.start('', putIn, null, true); <ide> <ide> test1(); <ide><path>test/parallel/test-repl-console.js <ide> 'use strict'; <ide> var common = require('../common'), <ide> assert = require('assert'), <del> Stream = require('stream'), <ide> repl = require('repl'); <ide> <del>// create a dummy stream that does nothing <del>var stream = new Stream(); <del>stream.write = stream.pause = stream.resume = function() {}; <del>stream.readable = stream.writable = true; <add>// Create a dummy stream that does nothing <add>const stream = new common.ArrayStream(); <ide> <ide> var r = repl.start({ <ide> input: stream, <ide><path>test/parallel/test-repl-domain.js <ide> var common = require('../common'); <ide> var util = require('util'); <ide> var repl = require('repl'); <ide> <del>// A stream to push an array into a REPL <del>function ArrayStream() { <del> this.run = function(data) { <del> var self = this; <del> data.forEach(function(line) { <del> self.emit('data', line + '\n'); <del> }); <del> }; <del>} <del>util.inherits(ArrayStream, require('stream').Stream); <del>ArrayStream.prototype.readable = true; <del>ArrayStream.prototype.writable = true; <del>ArrayStream.prototype.resume = function() {}; <del>ArrayStream.prototype.write = function() {}; <del> <del>var putIn = new ArrayStream(); <add>const putIn = new common.ArrayStream(); <ide> var testMe = repl.start('', putIn); <ide> <ide> putIn.write = function(data) { <ide><path>test/parallel/test-repl-end-emits-exit.js <ide> 'use strict'; <ide> var common = require('../common'), <ide> assert = require('assert'), <del> Stream = require('stream'), <ide> repl = require('repl'), <ide> terminalExit = 0, <ide> regularExit = 0; <ide> <del>// create a dummy stream that does nothing <del>var stream = new Stream(); <del>stream.write = stream.pause = stream.resume = function() {}; <del>stream.readable = stream.writable = true; <add>// Create a dummy stream that does nothing <add>const stream = new common.ArrayStream(); <ide> <ide> function testTerminalMode() { <ide> var r1 = repl.start({ <ide><path>test/parallel/test-repl-options.js <ide> 'use strict'; <ide> var common = require('../common'), <ide> assert = require('assert'), <del> Stream = require('stream'), <ide> repl = require('repl'); <ide> <ide> common.globalCheck = false; <ide> <del>// create a dummy stream that does nothing <del>var stream = new Stream(); <del>stream.write = stream.pause = stream.resume = function() {}; <del>stream.readable = stream.writable = true; <add>// Create a dummy stream that does nothing <add>const stream = new common.ArrayStream(); <ide> <ide> // 1, mostly defaults <ide> var r1 = repl.start({ <ide><path>test/parallel/test-repl-reset-event.js <ide> common.globalCheck = false; <ide> <ide> var assert = require('assert'); <ide> var repl = require('repl'); <del>var Stream = require('stream'); <ide> <del>// create a dummy stream that does nothing <del>var dummy = new Stream(); <del>dummy.write = dummy.pause = dummy.resume = function() {}; <del>dummy.readable = dummy.writable = true; <add>// Create a dummy stream that does nothing <add>const dummy = new common.ArrayStream(); <ide> <ide> function testReset(cb) { <ide> var r = repl.start({ <ide><path>test/parallel/test-repl-syntax-error-stack.js <ide> process.on('exit', () => { <ide> assert.strictEqual(found, true); <ide> }); <ide> <del>// A stream to push an array into a REPL <del>function ArrayStream() { <del> this.run = function(data) { <del> data.forEach(line => { <del> this.emit('data', line + '\n'); <del> }); <del> }; <del>} <del>util.inherits(ArrayStream, require('stream').Stream); <del>ArrayStream.prototype.readable = true; <del>ArrayStream.prototype.writable = true; <del>ArrayStream.prototype.resume = function() {}; <del>ArrayStream.prototype.write = function(output) { <add>common.ArrayStream.prototype.write = function(output) { <ide> if (/var foo bar;/.test(output)) <ide> found = true; <ide> }; <ide> <del>const putIn = new ArrayStream(); <add>const putIn = new common.ArrayStream(); <ide> const testMe = repl.start('', putIn); <ide> let file = path.resolve(__dirname, '../fixtures/syntax/bad_syntax'); <ide> <ide><path>test/parallel/test-repl-tab-complete-crash.js <ide> 'use strict'; <ide> <del>require('../common'); <add>const common = require('../common'); <ide> const assert = require('assert'); <ide> const util = require('util'); <ide> const repl = require('repl'); <ide> <ide> var referenceErrorCount = 0; <ide> <del>// A stream to push an array into a REPL <del>function ArrayStream() { <del> this.run = function(data) { <del> const self = this; <del> data.forEach(function(line) { <del> self.emit('data', line + '\n'); <del> }); <del> }; <del>} <del>util.inherits(ArrayStream, require('stream').Stream); <del>ArrayStream.prototype.readable = true; <del>ArrayStream.prototype.writable = true; <del>ArrayStream.prototype.resume = function() {}; <del>ArrayStream.prototype.write = function(msg) { <add>common.ArrayStream.prototype.write = function(msg) { <ide> if (msg.startsWith('ReferenceError: ')) { <ide> referenceErrorCount++; <ide> } <ide> }; <ide> <del>const putIn = new ArrayStream(); <add>const putIn = new common.ArrayStream(); <ide> const testMe = repl.start('', putIn); <ide> <ide> // https://github.com/nodejs/node/issues/3346 <ide><path>test/parallel/test-repl-tab-complete.js <ide> process.on('exit', function() { <ide> assert.strictEqual(referenceErrors, expectedReferenceErrors); <ide> }); <ide> <del>// A stream to push an array into a REPL <del>function ArrayStream() { <del> this.run = function(data) { <del> var self = this; <del> data.forEach(function(line) { <del> self.emit('data', line + '\n'); <del> }); <del> }; <del>} <del>util.inherits(ArrayStream, require('stream').Stream); <del>ArrayStream.prototype.readable = true; <del>ArrayStream.prototype.writable = true; <del>ArrayStream.prototype.resume = function() {}; <del>ArrayStream.prototype.write = function() {}; <del> <ide> var works = [['inner.one'], 'inner.o']; <del>var putIn = new ArrayStream(); <add>const putIn = new common.ArrayStream(); <ide> var testMe = repl.start('', putIn); <ide> <ide> // Some errors are passed to the domain, but do not callback
11
Text
Text
fix typos in changelog
3ef2e4acf393774ccc3ae3face746b7ff685899a
<ide><path>CHANGELOG.md <ide> See https://github.com/nodejs/node/labels/confirmed-bug for complete and current <ide> <ide> ### Notable changes <ide> <del>* **buffer**: Fixed a minor errors that was causing crashes (Michaël Zasso) [#2635](https://github.com/nodejs/node/pull/2635), <add>* **buffer**: Fixed a minor errors that was causing crashes (Michaël Zasso) [#2635](https://github.com/nodejs/node/pull/2635), <ide> * **child_process**: Fix error that was causing crashes (Evan Lucas) [#2727](https://github.com/nodejs/node/pull/2727) <ide> * **crypto**: Replace use of rwlocks, unsafe on Windows XP / 2003 (Ben Noordhuis) [#2723](https://github.com/nodejs/node/pull/2723) <ide> * **libuv**: Upgrade from 1.7.3 to 1.7.4 (Saúl Ibarra Corretgé) [#2817](https://github.com/nodejs/node/pull/2817) <ide> _Note: a new version of the 'url' module was reverted prior to release as it was <ide> - Add support for default author field to make `npm init -y` work without user-input (@othiym23) [npm/npm/d8eee6cf9d](https://github.com/npm/npm/commit/d8eee6cf9d2ff7aca68dfaed2de76824a3e0d9af) <ide> - Include local modules in `npm outdated` and `npm update` (@ArnaudRinquin) [npm/npm#7426](https://github.com/npm/npm/issues/7426) <ide> - The prefix used before the version number on `npm version` is now configurable via `tag-version-prefix` (@kkragenbrink) [npm/npm#8014](https://github.com/npm/npm/issues/8014) <del>* **os**: `os.tmpdir()` is now cross-platform consistent and will no longer returns a path with a trailling slash on any platform (Christian Tellnes) [#747](https://github.com/nodejs/node/pull/747) <add>* **os**: `os.tmpdir()` is now cross-platform consistent and will no longer returns a path with a trailing slash on any platform (Christian Tellnes) [#747](https://github.com/nodejs/node/pull/747) <ide> * **process**: <ide> - `process.nextTick()` performance has been improved by between 2-42% across the benchmark suite, notable because this is heavily used across core (Brian White) [#1571](https://github.com/nodejs/node/pull/1571) <ide> - New `process.geteuid()`, `process.seteuid(id)`, `process.getegid()` and `process.setegid(id)` methods allow you to get and set effective UID and GID of the process (Evan Lucas) [#1536](https://github.com/nodejs/node/pull/1536) <ide> _Note: version **1.4.0** was tagged and built but not released. A libuv bug was <ide> * [[`10277d2`](https://github.com/nodejs/node/commit/10277d2e57ee7fe9e0e3f63f10b9ea521e86e7f0)] - docs: include mention of new crypto methods (Calvin Metcalf) <ide> * [[`9a8f186`](https://github.com/nodejs/node/commit/9a8f18613da4956c963377e2ad55cdd3dabc32aa)] - child_process: add debug and error details (Zach Bruggeman) <ide> * [[`6f7a978`](https://github.com/nodejs/node/commit/6f7a9784eaef82a1aa6cf53bbbd7224c446876a0)] - crypto: clear error on return in TLS methods (Fedor Indutny) <del>* [[`50daee7`](https://github.com/nodejs/node/commit/50daee7243a3f987e1a28d93c43f913471d6885a)] - stream: simpler stream constructon (Sam Newman) <add>* [[`50daee7`](https://github.com/nodejs/node/commit/50daee7243a3f987e1a28d93c43f913471d6885a)] - stream: simpler stream construction (Sam Newman) <ide> * [[`e0730ee`](https://github.com/nodejs/node/commit/e0730eeaa5231841a7eba080c8170e41278c3c52)] - benchmark: allow compare via fine-grained filters (Brian White) <ide> * [[`96ffcb9`](https://github.com/nodejs/node/commit/96ffcb9a210a2fa1248ae5931290193573512a96)] - src: reduce cpu profiler overhead (Ben Noordhuis) <ide> * [[`3e675e4`](https://github.com/nodejs/node/commit/3e675e44b59f1be8e5581de000f3cb17ef747c14)] - benchmark: don't use template strings (Evan Lucas) <ide> _Note: version **1.4.0** was tagged and built but not released. A libuv bug was <ide> * [[`b5166cb`](https://github.com/nodejs/node/commit/b5166cb7d269cd1bf90d1768f82767b05b9ac1f8)] - benchmark: add bench-(url &amp; events) make targets (Yosuke Furukawa) <ide> * [[`5843ae8`](https://github.com/nodejs/node/commit/5843ae8dfba5db83f2c04ed2db847049cbd2ab0d)] - Revert "doc: clarify fs.symlink and fs.symlinkSync parameters" (Bert Belder) <ide> * [[`668bde8`](https://github.com/nodejs/node/commit/668bde8ac0d16382cbc98c904d8b5f55fd9fd9f0)] - win,msi: broadcast WM_SETTINGCHANGE after install (Mathias Küsel) <del>* [[`69ce064`](https://github.com/nodejs/node/commit/69ce0641dc6a84c90ffdd0906790cd945f1c3629)] - build: remove artefacts on distclean (Johan Bergström) <add>* [[`69ce064`](https://github.com/nodejs/node/commit/69ce0641dc6a84c90ffdd0906790cd945f1c3629)] - build: remove artifacts on distclean (Johan Bergström) <ide> * [[`1953886`](https://github.com/nodejs/node/commit/1953886126a2ab3e7291a73767ee4302a391a208)] - test: fs.createReadStream().destroy() fd leak (Rod Vagg) <ide> * [[`497fd72`](https://github.com/nodejs/node/commit/497fd72e21d2d1216e8457928d1a8082349fd0e5)] - fs: fix fd leak in ReadStream.destroy() (Alex Kocharin) <ide> * [[`8b09ae7`](https://github.com/nodejs/node/commit/8b09ae76f1d854a0db579fc0737df4809ce6087d)] - doc: add links for http_parser/libuv upgrades (Michael Hart) <ide> https://github.com/nodejs/node/commit/01994e8119c24f2284bac0779b32acb49c95bee7 <ide> * fs: make 'end' work with ReadStream without 'start' (Ben Noordhuis) <ide> * https: optimize createConnection() (Ryunosuke SATO) <ide> * buffer: speed up base64 encoding by 20% (Ben Noordhuis) <del>* doc: Colorize API stabilitity index headers in docs (Luke Arduini) <add>* doc: Colorize API stability index headers in docs (Luke Arduini) <ide> * net: socket.readyState corrections (bentaber) <ide> * http: Performance enhancements for http under streams2 (isaacs) <ide> * stream: fix to emit end event on http.ClientResponse (Shigeki Ohtsu) <ide> https://github.com/nodejs/node/commit/2c4eef0d972838c51999d32c0d251857a713dc18 <ide> <ide> * npm: Upgrade to v1.2.2 <ide> * dns: make error message match errno (Dan Milon) <del>* tls: follow RFC6125 more stricly (Fedor Indutny) <add>* tls: follow RFC6125 more strictly (Fedor Indutny) <ide> * buffer: reject negative SlowBuffer offsets (Ben Noordhuis) <ide> * install: add simplejson fallback (Chris Dent) <ide> * http: fix "Cannot call method 'emit' of null" (Ben Noordhuis) <ide> https://github.com/nodejs/node/commit/2134aa3d5c622fc3c3b02ccb713fcde0e0df479a <ide> - Support for parallel use of the cache folder <ide> - Retry on registry timeouts or network failures (Trent Mick) <ide> - Reduce 'engines' failures to a warning <del> - Use new zsh completion if aviailable (Jeremy Cantrell) <add> - Use new zsh completion if available (Jeremy Cantrell) <ide> <ide> * Fix [#3577](https://github.com/joyent/node/issues/3577) Un-break require('sys') <ide> * util: speed up formatting of large arrays/objects (Ben Noordhuis) <ide> https://github.com/nodejs/node/commit/9cc55dca6f67a6096c858b841c677b0593404321 <ide> <ide> * Upgrade V8 to 3.8.6 <ide> * Use GYP build system on unix (Ben Noordhuis) <del>* Experimenetal isolates support (Ben Noordhuis) <add>* Experimental isolates support (Ben Noordhuis) <ide> * Improvements to Cluster API (Andreas Madsen) <ide> * Use isolates for internal debugger (Fedor Indutny) <ide> * Bug fixes <ide> https://github.com/nodejs/node/commit/220e61c1f65bf4db09699fcf6399c0809c0bc446 <ide> * Remove cmake build system, support for Cygwin, legacy code base, <ide> process.ENV, process.ARGV, process.memoryUsage().vsize, os.openOSHandle <ide> <del>* Documentation improvments (Igor Zinkovsky, Bert Belder, Ilya Dmitrichenko, <add>* Documentation improvements (Igor Zinkovsky, Bert Belder, Ilya Dmitrichenko, <ide> koichik, Maciej Małecki, Guglielmo Ferri, isaacs) <ide> <ide> * Performance improvements (Daniel Ennis, Bert Belder, Ben Noordhuis) <ide> https://github.com/nodejs/node/commit/a745d19ce7d1c0e3778371af4f0346be70cf2c8e <ide> * cmake improvements (Tom Hughes) <ide> * node_net.cc: fix incorrect sizeof() (Tom Hughes) <ide> * Windows/cygwin: no more GetConsoleTitleW errors on XP (Bert Belder) <del>* Doc improvments (koichik, Logan Smyth, Ben Noordhuis, Arnout Kazemier) <add>* Doc improvements (koichik, Logan Smyth, Ben Noordhuis, Arnout Kazemier) <ide> <ide> ## 2011.07.19, Version 0.4.10 (stable) <ide> <ide> https://github.com/nodejs/node/commit/2a4568c85f33869c75ff43ccd30f0ec188b43eab <ide> <ide> * Fix Buffer.toString() on 0-length slices. (Peter Griess) <ide> * Cache modules based on filename rather than ID (Isaac Schlueter) <del>* querystring improvments (Jan Kassens, Micheil Smith) <add>* querystring improvements (Jan Kassens, Micheil Smith) <ide> * Support DEL in the REPL. (Jérémy Lal) <ide> * Upgrade http-parser, upgrade V8 to 2.3.2 <ide> <ide> https://github.com/nodejs/node/commit/39ca93549af91575ca9d4cbafd1e170fbcef3dfa <ide> <ide> * API: request.uri -> request.url <ide> It is no longer an object, but a string. The 'url' module <del> was addded to parse that string. That is, node no longer <add> was added to parse that string. That is, node no longer <ide> parses the request URL automatically. <ide> require('url').parse(request.url) <del> is roughly equivlent to the old request.uri object. <add> is roughly equivalent to the old request.uri object. <ide> (isaacs) <ide> <ide> * Bugfix: Several libeio related race conditions. <ide> https://github.com/nodejs/node/commit/12bb0d46ce761e3d00a27170e63b40408c15b558 <ide> * Bugfix: Internally use full paths when loading modules <ide> this fixes a shebang loading problem. <ide> <del> * Bugfix: Add '--' command line argument for seperating v8 <add> * Bugfix: Add '--' command line argument for separating v8 <ide> args from program args. <ide> <ide> * Add man page. <ide> https://github.com/nodejs/node/commit/b0fd3e281cb5f7cd8d3a26bd2b89e1b59998e5ed <ide> connection before sending data every time (Kevin van Zonneveld) <ide> <ide> * Bugfix: stdin fd (0) being ignored by node.File. (Abe Fettig) <del> * API: Remove connnection.fullClose() <add> * API: Remove connection.fullClose() <ide> <ide> * API: Return the EventEmitter from addListener for chaining. <ide> * API: tcp.Connection "disconnect" event renamed to "close"
1
Javascript
Javascript
add a test for generated texteditor ids
3ad3852dd6a2fbdc5d64f21d4838fdd81ff1dbc4
<ide><path>spec/text-editor-spec.js <ide> describe('TextEditor', () => { <ide> await atom.packages.activatePackage('language-javascript') <ide> }) <ide> <add> it('generates unique ids for each editor', () => { <add> // Deserialized editors are initialized with an id: <add> new TextEditor({id: 0}) <add> new TextEditor({id: 1}) <add> new TextEditor({id: 2}) <add> // Initializing an editor without an id causes a new id to be generated: <add> const generatedId = new TextEditor().id <add> expect(generatedId).toBe(3) <add> }) <add> <ide> describe('when the editor is deserialized', () => { <ide> it('restores selections and folds based on markers in the buffer', async () => { <ide> editor.setSelectedBufferRange([[1, 2], [3, 4]])
1
Mixed
Ruby
fix rails/info routes for apps with globbing route
9d513e0a19f2b9333cd752b2747db4f350fcddc4
<ide><path>railties/CHANGELOG.md <add>* Ensure `/rails/info` routes match in development for apps with a catch-all globbing route. <add> <add> *Nicholas Firth-McCoy* <add> <ide> * Added a shared section to `config/secrets.yml` that will be loaded for all environments. <ide> <ide> *DHH* <ide><path>railties/lib/rails/application/finisher.rb <ide> module Finisher <ide> <ide> initializer :add_builtin_route do |app| <ide> if Rails.env.development? <del> app.routes.append do <add> app.routes.prepend do <ide> get '/rails/info/properties' => "rails/info#properties", internal: true <ide> get '/rails/info/routes' => "rails/info#routes", internal: true <ide> get '/rails/info' => "rails/info#index", internal: true <add> end <add> <add> app.routes.append do <ide> get '/' => "rails/welcome#index", internal: true <ide> end <ide> end <ide><path>railties/test/application/routing_test.rb <ide> def teardown <ide> assert_equal 200, last_response.status <ide> end <ide> <add> test "/rails/info routes are accessible with globbing route present" do <add> app("development") <add> <add> app_file "config/routes.rb", <<-RUBY <add> Rails.application.routes.draw do <add> get '*foo', to: 'foo#index' <add> end <add> RUBY <add> <add> get "/rails/info" <add> assert_equal 302, last_response.status <add> <add> get "rails/info/routes" <add> assert_equal 200, last_response.status <add> <add> get "rails/info/properties" <add> assert_equal 200, last_response.status <add> end <add> <ide> test "root takes precedence over internal welcome controller" do <ide> app("development") <ide>
3
Javascript
Javascript
add spacings to interleavedbuffer
97374fdcbbd34e07cfb949ee8108ae03cc17fc68
<ide><path>test/unit/core/InterleavedBuffer.js <ide> <ide> module( "InterleavedBuffer" ); <ide> <del>function checkInstanceAgainstCopy(instance, copiedInstance) { <add>function checkInstanceAgainstCopy( instance, copiedInstance ) { <ide> ok( copiedInstance instanceof THREE.InterleavedBuffer, "the clone has the correct type" ); <ide> <del> for (var i = 0; i < instance.array.length; i++) { <add> for ( var i = 0; i < instance.array.length; i++ ) { <ide> ok( copiedInstance.array[i] === instance.array[i], "array was copied" ); <ide> } <ide>
1
PHP
PHP
reduce duplication in docs and fix typos
443f6cb1d96ac080f768e8043732a17c08fae7db
<ide><path>src/View/Helper/FormHelper.php <ide> public function year($fieldName, $options = []) { <ide> * ### Options: <ide> * <ide> * - `monthNames` - If false, 2 digit numbers will be used instead of text. <del> * If a array, the given array will be used. <add> * If an array, the given array will be used. <ide> * - `empty` - If true, the empty select option is shown. If a string, <ide> * that string is displayed as the empty element. <ide> * - `value` The selected value of the input. <ide> public function meridian($fieldName, $options = array()) { <ide> /** <ide> * Returns a set of SELECT elements for a full datetime setup: day, month and year, and then time. <ide> * <del> * ### Options: <add> * ### Date Options: <ide> * <ide> * - `empty` - If true, the empty select option is shown. If a string, <ide> * that string is displayed as the empty element. <add> * - `value` | `default` The default value to be used by the input. A value in `$this->data` <add> * matching the field name will override this value. If no default is provided `time()` will be used. <ide> * - `monthNames` If false, 2 digit numbers will be used instead of text. <del> * If a array, the given array will be used. <del> * - `minYear` - The lowest year to use in the year select <del> * - `maxYear` - The maximum year to use in the year select <add> * If an array, the given array will be used. <add> * - `minYear` The lowest year to use in the year select <add> * - `maxYear` The maximum year to use in the year select <ide> * - `orderYear` - Order of year values in select options. <ide> * Possible values 'asc', 'desc'. Default 'desc'. <del> * - `interval` - The interval for the minutes select. Defaults to 1 <del> * - `round` - Set to `up` or `down` if you want to force rounding in either <del> * direction. Defaults to null. <del> * - `value` | `default` - The default value to be used by the input. <del> * A value in `$this->data` matching the field name will override this value. <del> * If no default is provided `time()` will be used. <del> * - `timeFormat` - The time format to use, either 12 or 24. <del> * - `second` - Set to true to enable seconds drop down. <add> * <add> * ### Time options: <add> * <add> * - `empty` - If true, the empty select option is shown. If a string, <add> * - `value` | `default` The default value to be used by the input. A value in `$this->data` <add> * matching the field name will override this value. If no default is provided `time()` will be used. <add> * - `timeFormat` The time format to use, either 12 or 24. <add> * - `interval` The interval for the minutes select. Defaults to 1 <add> * - `round` - Set to `up` or `down` if you want to force rounding in either direction. Defaults to null. <add> * - `second` Set to true to enable seconds drop down. <ide> * <ide> * To control the order of inputs, and any elements/content between the inputs you <ide> * can override the `dateWidget` template. By default the `dateWidget` template is: <ide> protected function _datetimeOptions($options) { <ide> * <ide> * ### Options: <ide> * <del> * - `interval` The interval for the minutes select. Defaults to 1 <del> * - `empty` - If true, the empty select option is shown. If a string, <del> * that string is displayed as the empty element. <del> * - `round` - Set to `up` or `down` if you want to force rounding in either direction. Defaults to null. <del> * - `value` | `default` The default value to be used by the input. A value in `$this->data` <del> * matching the field name will override this value. If no default is provided `time()` will be used. <del> * - `timeFormat` The time format to use, either 12 or 24. <del> * - `second` Set to true to enable seconds drop down. <add> * See dateTime() for time options. <ide> * <ide> * @param string $fieldName Prefix name for the SELECT element <ide> * @param array $options Array of Options <ide> public function time($fieldName, $options = []) { <ide> * <ide> * ### Options: <ide> * <del> * ### Options: <del> * <del> * - `monthNames` If false, 2 digit numbers will be used instead of text. <del> * If a array, the given array will be used. <del> * - `minYear` The lowest year to use in the year select <del> * - `maxYear` The maximum year to use in the year select <del> * - `empty` - If true, the empty select option is shown. If a string, <del> * that string is displayed as the empty element. <del> * - `value` | `default` The default value to be used by the input. A value in `$this->data` <del> * matching the field name will override this value. If no default is provided `time()` will be used. <add> * See dateTime() for date options. <ide> * <ide> * @param string $fieldName Prefix name for the SELECT element <ide> * @param array $options Array of Options
1
Javascript
Javascript
fix error message typo
6a8c998ebdb76e91051055befd623b28d92acc75
<ide><path>web/pdf_find_controller.js <ide> var PDFFindController = { <ide> initialize: function(options) { <ide> if(typeof PDFFindBar === 'undefined' || PDFFindBar === null) { <ide> throw 'PDFFindController cannot be initialized ' + <del> 'without a PDFFindController instance'; <add> 'without a PDFFindBar instance'; <ide> } <ide> <ide> this.pdfPageSource = options.pdfPageSource;
1
Javascript
Javascript
add workaround for safari / webdriver problem
6b915ad9db29027e0aa70634e08a8a3c5af897b8
<ide><path>src/Angular.js <ide> function angularInit(element, bootstrap) { <ide> }); <ide> if (appElement) { <ide> if (!isAutoBootstrapAllowed) { <del> window.console.error('AngularJS: disabling automatic bootstrap. <script> protocol indicates ' + <add> try { <add> window.console.error('AngularJS: disabling automatic bootstrap. <script> protocol indicates ' + <ide> 'an extension, document.location.href does not match.'); <add> } catch (e) { <add> // Support: Safari 11 w/ Webdriver <add> // The console.error will throw and make the test fail <add> } <ide> return; <ide> } <ide> config.strictDi = getNgAttribute(appElement, 'strict-di') !== null;
1
Text
Text
expand stack doc
cd2237c2bc6bce738a42a7eaf0ba82d57857fe2f
<ide><path>experimental/docker-stacks.md <ide> ## Overview <ide> <ide> Docker Stacks are an experimental feature introduced in Docker 1.12, alongside <del>the new concepts of Swarms and Services inside the Engine. <add>the concept of swarm mode, and Nodes and Services in the Engine API. <ide> <ide> A Dockerfile can be built into an image, and containers can be created from that <del>image. Similarly, a docker-compose.yml can be built into a **bundle**, and <del>**stacks** can be created from that bundle. In that sense, the bundle is a <del>multi-services distributable image format. <add>image. Similarly, a docker-compose.yml can be built into a **distributed application bundle**, and **stacks** can be created from that bundle. In that sense, the bundle is a multi-services distributable image format. <ide> <del>As of 1.12, the feature is introduced as experimental, and Docker Engine doesn't <del>support distribution of bundles. <add>As of Docker 1.12, the feature is experimental. Neither Docker Engine nor the Docker Registry support distribution of bundles. <ide> <ide> ## Producing a bundle <ide> <ide> Tasks are managed using the `docker stack` command: <ide> <ide> Run 'docker stack COMMAND --help' for more information on a command. <ide> ``` <add> <add>## Bundle file format <add> <add>Distributed application bundles are described in a JSON format. When bundles are persisted as files, the file extension is `.dab` (Docker 1.12RC2 tools use `.dsb` for the file extension—this will be updated in the next release client). <add> <add>A bundle has two top-level fields: `version` and `services`. The version used by Docker 1.12 tools is `0.1`. <add> <add>`services` in the bundle are the services that comprise the app. They correspond to the new `Service` object introduced in the 1.12 Docker Engine API. <add> <add>A service has the following fields: <add> <add><dl> <add> <dt> <add> Image (required) <code>string</code> <add> </dt> <add> <dd> <add>The image that the service will run. Docker images should be referenced with full content hash to fully specify the deployment artifact for the service. Example: <code>postgres@sha256:f76245b04ddbcebab5bb6c28e76947f49222c99fec4aadb0bb1c24821a9e83ef</code> <add> </dd> <add> <add> <dt> <add> Command <code>[]string</code> <add> </dt> <add> <dd> <add> Command to run in service containers. <add> </dd> <add> <add> <dt> <add> Args <code>[]string</code> <add> </dt> <add> <dd> <add> Arguments passed to the service containers. <add> </dd> <add> <add> <dt> <add> Env <code>[]string</code> <add> </dt> <add> <dd> <add> Environment variables. <add> </dd> <add> <add> <dt> <add> Labels <code>map[string]string</code> <add> </dt> <add> <dd> <add> Labels used for setting meta data on services. <add> </dd> <add> <add> <dt> <add> Ports <code>[]Port</code> <add> </dt> <add> <dd> <add> Service ports (composed of `Port` (`int`) and `Protocol` (`string`). A service description can only specify the container port to be exposed. These ports can be mapped on runtime hosts at the operator's discretion. <add> </dd> <add> <add> <dt> <add> WorkingDir <code>string</code> <add> </dt> <add> <dd> <add> Working directory inside the service containers. <add> </dd> <add> <add> <dt> <add> User <code>string</code> <add> </dt> <add> <dd> <add> Username or UID (format: <name|uid>[:<group|gid>]). <add> </dd> <add> <add> <dt> <add> Networks <code>[]string</code> <add> </dt> <add> <dd> <add> Networks that the service containers should be connected to. An entity deploying a bundle should create networks as needed. <add> </dd> <add></dl> <add>
1
PHP
PHP
use sha1 rather than md5
2a4acfb65f8fb69cec32cd9f4ccda4566524d5e2
<ide><path>src/Illuminate/Auth/SessionGuard.php <ide> public function getLastAttempted() <ide> */ <ide> public function getName() <ide> { <del> return 'login_'.$this->name.'_'.md5(get_class($this)); <add> return 'login_'.$this->name.'_'.sha1(get_class($this)); <ide> } <ide> <ide> /** <ide> public function getName() <ide> */ <ide> public function getRecallerName() <ide> { <del> return 'remember_'.$this->name.'_'.md5(get_class($this)); <add> return 'remember_'.$this->name.'_'.sha1(get_class($this)); <ide> } <ide> <ide> /** <ide><path>src/Illuminate/Cache/FileStore.php <ide> public function flush() <ide> */ <ide> protected function path($key) <ide> { <del> $parts = array_slice(str_split($hash = md5($key), 2), 0, 2); <add> $parts = array_slice(str_split($hash = sha1($key), 2), 0, 2); <ide> <ide> return $this->directory.'/'.implode('/', $parts).'/'.$hash; <ide> } <ide><path>src/Illuminate/Console/Scheduling/CallbackEvent.php <ide> public function withoutOverlapping() <ide> */ <ide> protected function mutexPath() <ide> { <del> return storage_path('framework/schedule-'.md5($this->description)); <add> return storage_path('framework/schedule-'.sha1($this->description)); <ide> } <ide> <ide> /** <ide><path>src/Illuminate/Console/Scheduling/Event.php <ide> public function buildCommand() <ide> */ <ide> protected function mutexPath() <ide> { <del> return storage_path('framework/schedule-'.md5($this->expression.$this->command)); <add> return storage_path('framework/schedule-'.sha1($this->expression.$this->command)); <ide> } <ide> <ide> /** <ide><path>src/Illuminate/View/Compilers/Compiler.php <ide> public function __construct(Filesystem $files, $cachePath) <ide> */ <ide> public function getCompiledPath($path) <ide> { <del> return $this->cachePath.'/'.md5($path).'.php'; <add> return $this->cachePath.'/'.sha1($path).'.php'; <ide> } <ide> <ide> /** <ide><path>tests/Cache/CacheFileStoreTest.php <ide> public function testNullIsReturnedIfFileDoesntExist() <ide> public function testPutCreatesMissingDirectories() <ide> { <ide> $files = $this->mockFilesystem(); <del> $md5 = md5('foo'); <del> $full_dir = __DIR__.'/'.substr($md5, 0, 2).'/'.substr($md5, 2, 2); <add> $hash = sha1('foo'); <add> $full_dir = __DIR__.'/'.substr($hash, 0, 2).'/'.substr($hash, 2, 2); <ide> $files->expects($this->once())->method('makeDirectory')->with($this->equalTo($full_dir), $this->equalTo(0777), $this->equalTo(true)); <del> $files->expects($this->once())->method('put')->with($this->equalTo($full_dir.'/'.$md5)); <add> $files->expects($this->once())->method('put')->with($this->equalTo($full_dir.'/'.$hash)); <ide> $store = new FileStore($files, __DIR__); <ide> $store->put('foo', '0000000000', 0); <ide> } <ide> public function testStoreItemProperlyStoresValues() <ide> $store = $this->getMock('Illuminate\Cache\FileStore', ['expiration'], [$files, __DIR__]); <ide> $store->expects($this->once())->method('expiration')->with($this->equalTo(10))->will($this->returnValue(1111111111)); <ide> $contents = '1111111111'.serialize('Hello World'); <del> $md5 = md5('foo'); <del> $cache_dir = substr($md5, 0, 2).'/'.substr($md5, 2, 2); <del> $files->expects($this->once())->method('put')->with($this->equalTo(__DIR__.'/'.$cache_dir.'/'.$md5), $this->equalTo($contents)); <add> $hash = sha1('foo'); <add> $cache_dir = substr($hash, 0, 2).'/'.substr($hash, 2, 2); <add> $files->expects($this->once())->method('put')->with($this->equalTo(__DIR__.'/'.$cache_dir.'/'.$hash), $this->equalTo($contents)); <ide> $store->put('foo', 'Hello World', 10); <ide> } <ide> <ide> public function testForeversAreStoredWithHighTimestamp() <ide> { <ide> $files = $this->mockFilesystem(); <ide> $contents = '9999999999'.serialize('Hello World'); <del> $md5 = md5('foo'); <del> $cache_dir = substr($md5, 0, 2).'/'.substr($md5, 2, 2); <del> $files->expects($this->once())->method('put')->with($this->equalTo(__DIR__.'/'.$cache_dir.'/'.$md5), $this->equalTo($contents)); <add> $hash = sha1('foo'); <add> $cache_dir = substr($hash, 0, 2).'/'.substr($hash, 2, 2); <add> $files->expects($this->once())->method('put')->with($this->equalTo(__DIR__.'/'.$cache_dir.'/'.$hash), $this->equalTo($contents)); <ide> $store = new FileStore($files, __DIR__); <ide> $store->forever('foo', 'Hello World', 10); <ide> } <ide> public function testForeversAreNotRemovedOnIncrement() <ide> public function testRemoveDeletesFileDoesntExist() <ide> { <ide> $files = $this->mockFilesystem(); <del> $md5 = md5('foobull'); <del> $cache_dir = substr($md5, 0, 2).'/'.substr($md5, 2, 2); <del> $files->expects($this->once())->method('exists')->with($this->equalTo(__DIR__.'/'.$cache_dir.'/'.$md5))->will($this->returnValue(false)); <add> $hash = sha1('foobull'); <add> $cache_dir = substr($hash, 0, 2).'/'.substr($hash, 2, 2); <add> $files->expects($this->once())->method('exists')->with($this->equalTo(__DIR__.'/'.$cache_dir.'/'.$hash))->will($this->returnValue(false)); <ide> $store = new FileStore($files, __DIR__); <ide> $store->forget('foobull'); <ide> } <ide> <ide> public function testRemoveDeletesFile() <ide> { <ide> $files = $this->mockFilesystem(); <del> $md5 = md5('foobar'); <del> $cache_dir = substr($md5, 0, 2).'/'.substr($md5, 2, 2); <add> $hash = sha1('foobar'); <add> $cache_dir = substr($hash, 0, 2).'/'.substr($hash, 2, 2); <ide> $store = new FileStore($files, __DIR__); <ide> $store->put('foobar', 'Hello Baby', 10); <del> $files->expects($this->once())->method('exists')->with($this->equalTo(__DIR__.'/'.$cache_dir.'/'.$md5))->will($this->returnValue(true)); <del> $files->expects($this->once())->method('delete')->with($this->equalTo(__DIR__.'/'.$cache_dir.'/'.$md5)); <add> $files->expects($this->once())->method('exists')->with($this->equalTo(__DIR__.'/'.$cache_dir.'/'.$hash))->will($this->returnValue(true)); <add> $files->expects($this->once())->method('delete')->with($this->equalTo(__DIR__.'/'.$cache_dir.'/'.$hash)); <ide> $store->forget('foobar'); <ide> } <ide> <ide><path>tests/Database/DatabaseEloquentModelTest.php <ide> public function testCalculatedAttributes() <ide> // ensure password attribute was not set to null <ide> $this->assertArrayNotHasKey('password', $attributes); <ide> $this->assertEquals('******', $model->password); <del> $this->assertEquals('5ebe2294ecd0e0f08eab7690d2a6ee69', $attributes['password_hash']); <del> $this->assertEquals('5ebe2294ecd0e0f08eab7690d2a6ee69', $model->password_hash); <add> <add> $hash = 'e5e9fa1ba31ecd1ae84f75caaa474f3a663f05f4'; <add> <add> $this->assertEquals($hash, $attributes['password_hash']); <add> $this->assertEquals($hash, $model->password_hash); <ide> } <ide> <ide> public function testNewInstanceReturnsNewInstanceWithAttributesSet() <ide> public function getPasswordAttribute() <ide> <ide> public function setPasswordAttribute($value) <ide> { <del> $this->attributes['password_hash'] = md5($value); <add> $this->attributes['password_hash'] = sha1($value); <ide> } <ide> <ide> public function publicIncrement($column, $amount = 1) <ide><path>tests/View/ViewBladeCompilerTest.php <ide> public function tearDown() <ide> public function testIsExpiredReturnsTrueIfCompiledFileDoesntExist() <ide> { <ide> $compiler = new BladeCompiler($files = $this->getFiles(), __DIR__); <del> $files->shouldReceive('exists')->once()->with(__DIR__.'/'.md5('foo').'.php')->andReturn(false); <add> $files->shouldReceive('exists')->once()->with(__DIR__.'/'.sha1('foo').'.php')->andReturn(false); <ide> $this->assertTrue($compiler->isExpired('foo')); <ide> } <ide> <ide> public function testIsExpiredReturnsTrueIfCachePathIsNull() <ide> public function testIsExpiredReturnsTrueWhenModificationTimesWarrant() <ide> { <ide> $compiler = new BladeCompiler($files = $this->getFiles(), __DIR__); <del> $files->shouldReceive('exists')->once()->with(__DIR__.'/'.md5('foo').'.php')->andReturn(true); <add> $files->shouldReceive('exists')->once()->with(__DIR__.'/'.sha1('foo').'.php')->andReturn(true); <ide> $files->shouldReceive('lastModified')->once()->with('foo')->andReturn(100); <del> $files->shouldReceive('lastModified')->once()->with(__DIR__.'/'.md5('foo').'.php')->andReturn(0); <add> $files->shouldReceive('lastModified')->once()->with(__DIR__.'/'.sha1('foo').'.php')->andReturn(0); <ide> $this->assertTrue($compiler->isExpired('foo')); <ide> } <ide> <ide> public function testCompilePathIsProperlyCreated() <ide> { <ide> $compiler = new BladeCompiler($this->getFiles(), __DIR__); <del> $this->assertEquals(__DIR__.'/'.md5('foo').'.php', $compiler->getCompiledPath('foo')); <add> $this->assertEquals(__DIR__.'/'.sha1('foo').'.php', $compiler->getCompiledPath('foo')); <ide> } <ide> <ide> public function testCompileCompilesFileAndReturnsContents() <ide> { <ide> $compiler = new BladeCompiler($files = $this->getFiles(), __DIR__); <ide> $files->shouldReceive('get')->once()->with('foo')->andReturn('Hello World'); <del> $files->shouldReceive('put')->once()->with(__DIR__.'/'.md5('foo').'.php', 'Hello World'); <add> $files->shouldReceive('put')->once()->with(__DIR__.'/'.sha1('foo').'.php', 'Hello World'); <ide> $compiler->compile('foo'); <ide> } <ide> <ide> public function testCompileCompilesAndGetThePath() <ide> { <ide> $compiler = new BladeCompiler($files = $this->getFiles(), __DIR__); <ide> $files->shouldReceive('get')->once()->with('foo')->andReturn('Hello World'); <del> $files->shouldReceive('put')->once()->with(__DIR__.'/'.md5('foo').'.php', 'Hello World'); <add> $files->shouldReceive('put')->once()->with(__DIR__.'/'.sha1('foo').'.php', 'Hello World'); <ide> $compiler->compile('foo'); <ide> $this->assertEquals('foo', $compiler->getPath()); <ide> } <ide> public function testCompileWithPathSetBefore() <ide> { <ide> $compiler = new BladeCompiler($files = $this->getFiles(), __DIR__); <ide> $files->shouldReceive('get')->once()->with('foo')->andReturn('Hello World'); <del> $files->shouldReceive('put')->once()->with(__DIR__.'/'.md5('foo').'.php', 'Hello World'); <add> $files->shouldReceive('put')->once()->with(__DIR__.'/'.sha1('foo').'.php', 'Hello World'); <ide> // set path before compilation <ide> $compiler->setPath('foo'); <ide> // trigger compilation with null $path
8
Ruby
Ruby
remove options as an ivar
eaaf8995b13e411f6ecff2a0fcd515e8b4b7a42d
<ide><path>actionpack/lib/action_dispatch/routing/mapper.rb <ide> def constraint_args(constraint, request) <ide> class Mapping #:nodoc: <ide> ANCHOR_CHARACTERS_REGEX = %r{\A(\\A|\^)|(\\Z|\\z|\$)\Z} <ide> <del> attr_reader :options, :requirements, :conditions, :defaults <add> attr_reader :requirements, :conditions, :defaults <ide> attr_reader :to, :default_controller, :default_action, :as, :anchor <ide> <ide> def initialize(scope, path, options) <ide> def initialize(scope, path, options) <ide> path = normalize_path! path, formatted <ide> ast = path_ast path <ide> path_params = path_params ast <del> @options = normalize_options!(options, formatted, path_params, ast, scope[:module]) <ide> <add> options = normalize_options!(options, formatted, path_params, ast, scope[:module]) <ide> <del> constraints = constraints(options_constraints, <add> <add> constraints = constraints(options, <add> options_constraints, <ide> (scope[:constraints] || {}), <ide> path_params) <ide> <ide> def initialize(scope, path, options) <ide> @conditions[:parsed_path_info] = ast <ide> <ide> add_request_method(via, @conditions) <del> normalize_defaults!(formatted, options_constraints) <add> normalize_defaults!(options, formatted, options_constraints) <ide> end <ide> <ide> def to_route <ide> def verify_regexp_requirement(requirement) <ide> end <ide> end <ide> <del> def normalize_defaults!(formatted, options_constraints) <add> def normalize_defaults!(options, formatted, options_constraints) <ide> options.each do |key, default| <ide> unless Regexp === default <ide> @defaults[key] = default <ide> def blocks(options_constraints, scope_blocks) <ide> end <ide> end <ide> <del> def constraints(option_constraints, constraints, path_params) <add> def constraints(options, option_constraints, constraints, path_params) <ide> required_defaults = [] <ide> options.each_pair do |key, option| <ide> if Regexp === option
1
Python
Python
add lookup argument to lemmatizer.load
95f866f99f42ca2475991c23ef10141730000324
<ide><path>spacy/lemmatizer.py <ide> <ide> class Lemmatizer(object): <ide> @classmethod <del> def load(cls, path, index=None, exc=None, rules=None): <del> return cls(index or {}, exc or {}, rules or {}) <add> def load(cls, path, index=None, exc=None, rules=None, lookup=None): <add> return cls(index or {}, exc or {}, rules or {}, lookup or {}) <ide> <ide> def __init__(self, index=None, exceptions=None, rules=None, lookup=None): <ide> self.index = index if index is not None else {}
1
PHP
PHP
fix failing tests
ff73229ab8b3b586d1b5f0ef7689a2beee54abb1
<ide><path>lib/Cake/Test/Case/Model/Datasource/Database/MysqlTest.php <ide> public function testReadCustomJoinsAfterGeneratedJoins() { <ide> ->method('getDataSource') <ide> ->will($this->returnValue($test)); <ide> <del> $search = "LEFT JOIN `cake_test_db`.`test_model8` AS `TestModel8` ON " . <add> $model8Table = $test->fullTableName($this->Model->TestModel8); <add> $usersTable = $test->fullTableName('users'); <add> <add> $search = "LEFT JOIN $model8Table AS `TestModel8` ON " . <ide> "(`TestModel8`.`name` != 'larry' AND `TestModel9`.`test_model8_id` = `TestModel8`.`id`) " . <del> "LEFT JOIN `cake_test_db`.`users` AS `User` ON (`TestModel9`.`id` = `User`.`test_id`)"; <add> "LEFT JOIN $usersTable AS `User` ON (`TestModel9`.`id` = `User`.`test_id`)"; <ide> <ide> $test->expects($this->at(0))->method('execute') <ide> ->with($this->stringContains($search));
1
Python
Python
fix password flags handling [issues #314 & #315]
427d70340f8a0ad314a9890efff741da3a43d398
<ide><path>glances/glances.py <ide> def signal_handler(signal, frame): <ide> end() <ide> <ide> <del>def getpassword(description='', confirm=False): <add>def get_password(description='', confirm=False): <ide> """ <ide> Read a password from the command line (with confirmation if confirm = True) <ide> """ <ide> def getpassword(description='', confirm=False): <ide> return password1 <ide> else: <ide> sys.stdout.write(_("[Warning] Passwords did not match, please try again...\n")) <del> return getpassword(description=description, confirm=confirm) <add> return get_password(description=description, confirm=confirm) <ide> <ide> <ide> def main(): <ide> def main(): <ide> html_tag = False <ide> csv_tag = False <ide> client_tag = False <add> password_tag = False <add> password_prompt = False <ide> if is_Windows and not is_colorConsole: <ide> # Force server mode for Windows OS without colorconsole <ide> server_tag = True <ide> def main(): <ide> sys.exit(0) <ide> elif opt in ("-s", "--server"): <ide> server_tag = True <del> elif opt in ("-P", "--password"): <add> elif opt in ("-P"): <ide> try: <ide> arg <ide> except NameError: <ide> print(_("Error: -P flag need an argument (password)")) <ide> sys.exit(2) <add> password_tag = True <ide> password = arg <add> elif opt in ("--password"): <add> password_prompt = True <ide> elif opt in ("-B", "--bind"): <ide> try: <ide> arg <ide> def main(): <ide> sys.exit(0) <ide> <ide> # Check options <add> if password_tag and password_prompt: <add> print(_("Error: Cannot use both -P and --password flag")) <add> sys.exit(2) <add> <ide> if server_tag: <ide> if client_tag: <ide> print(_("Error: Cannot use both -s and -c flag")) <ide> sys.exit(2) <ide> if html_tag or csv_tag: <ide> print(_("Error: Cannot use both -s and -o flag")) <ide> sys.exit(2) <del> if password == '': <del> password = getpassword(description=_("Define the password for the Glances server"), confirm=True) <add> if password_prompt: <add> password = get_password(description=_("Define the password for the Glances server"), confirm=True) <ide> <ide> if client_tag: <ide> if html_tag or csv_tag: <ide> def main(): <ide> print(_("Error: Cannot use both -c and -C flag")) <ide> print(_(" Limits are set based on the server ones")) <ide> sys.exit(2) <del> if password == '': <del> password = getpassword(description=_("Enter the Glances server password"), confirm=False) <add> if password_prompt: <add> password = get_password(description=_("Enter the Glances server password"), confirm=False) <ide> <ide> if html_tag: <ide> if not html_lib_tag: <ide> def main(): <ide> print(_("Glances server is running on") + " %s:%s" % (bind_ip, server_port)) <ide> server = GlancesServer(bind_ip, int(server_port), GlancesXMLRPCHandler, cached_time) <ide> <del> # Set the server login/password (if -P tag) <add> # Set the server login/password (if -P/--password tag) <ide> if password != "": <ide> server.add_user(username, password) <ide>
1
Python
Python
restore changes from nn-beam-parser
11c31d285ce0bc7d64099f29e0d5c4cd26ce7e99
<ide><path>spacy/cli/convert.py <ide> @plac.annotations( <ide> input_file=("input file", "positional", None, str), <ide> output_dir=("output directory for converted file", "positional", None, str), <del> n_sents=("Number of sentences per doc", "option", "n", float), <add> n_sents=("Number of sentences per doc", "option", "n", int), <ide> morphology=("Enable appending morphology to tags", "flag", "m", bool) <ide> ) <del>def convert(cmd, input_file, output_dir, n_sents, morphology): <add>def convert(cmd, input_file, output_dir, n_sents=1, morphology=False): <ide> """ <ide> Convert files into JSON format for use with train command and other <ide> experiment management functions. <ide><path>spacy/cli/train.py <ide> def train(cmd, lang, output_dir, train_data, dev_data, n_iter=20, n_sents=0, <ide> for batch in minibatch(train_docs, size=batch_sizes): <ide> docs, golds = zip(*batch) <ide> nlp.update(docs, golds, sgd=optimizer, <del> drop=next(dropout_rates), losses=losses) <add> drop=next(dropout_rates), losses=losses, <add> update_tensors=True) <ide> pbar.update(sum(len(doc) for doc in docs)) <ide> <ide> with nlp.use_params(optimizer.averages): <ide> util.set_env_log(False) <ide> epoch_model_path = output_path / ('model%d' % i) <ide> nlp.to_disk(epoch_model_path) <del> with (output_path / ('model%d.pickle' % i)).open('wb') as file_: <del> dill.dump(nlp, file_, -1) <ide> nlp_loaded = lang_class(pipeline=pipeline) <ide> nlp_loaded = nlp_loaded.from_disk(epoch_model_path) <ide> scorer = nlp_loaded.evaluate( <ide><path>spacy/language.py <ide> def __call__(self, text, disable=[]): <ide> def make_doc(self, text): <ide> return self.tokenizer(text) <ide> <del> def update(self, docs, golds, drop=0., sgd=None, losses=None): <add> def update(self, docs, golds, drop=0., sgd=None, losses=None, <add> update_tensors=False): <ide> """Update the models in the pipeline. <ide> <ide> docs (iterable): A batch of `Doc` objects. <ide> def get_grads(W, dW, key=None): <ide> grads[key] = (W, dW) <ide> pipes = list(self.pipeline[1:]) <ide> random.shuffle(pipes) <add> tokvecses, bp_tokvecses = tok2vec.model.begin_update(feats, drop=drop) <add> all_d_tokvecses = [tok2vec.model.ops.allocate(tv.shape) for tv in tokvecses] <ide> for proc in pipes: <ide> if not hasattr(proc, 'update'): <ide> continue <del> tokvecses, bp_tokvecses = tok2vec.model.begin_update(feats, drop=drop) <ide> d_tokvecses = proc.update((docs, tokvecses), golds, <ide> drop=drop, sgd=get_grads, losses=losses) <del> if d_tokvecses is not None: <del> bp_tokvecses(d_tokvecses, sgd=sgd) <add> if update_tensors and d_tokvecses is not None: <add> for i, d_tv in enumerate(d_tokvecses): <add> all_d_tokvecses[i] += d_tv <add> bp_tokvecses(all_d_tokvecses, sgd=sgd) <ide> for key, (W, dW) in grads.items(): <ide> sgd(W, dW, key=key) <ide> # Clear the tensor variable, to free GPU memory. <ide> def begin_training(self, get_gold_tuples, **cfg): <ide> return optimizer <ide> <ide> def evaluate(self, docs_golds): <del> docs, golds = zip(*docs_golds) <ide> scorer = Scorer() <del> for doc, gold in zip(self.pipe(docs, batch_size=32), golds): <add> docs, golds = zip(*docs_golds) <add> docs = list(docs) <add> golds = list(golds) <add> for pipe in self.pipeline: <add> if not hasattr(pipe, 'pipe'): <add> for doc in docs: <add> pipe(doc) <add> else: <add> docs = list(pipe.pipe(docs)) <add> assert len(docs) == len(golds) <add> for doc, gold in zip(docs, golds): <ide> scorer.score(doc, gold) <ide> doc.tensor = None <ide> return scorer
3
Text
Text
update relation to other libraries.md
ac9319d5e9330bd494857f280a4c64cb51af09dd
<ide><path>docs/Basics/Relation to Other Libraries.md <ide> Can Redux be considered a [Flux](https://facebook.github.io/flux/) implementatio <ide> <ide> Redux was inspired by several important qualities of Flux. Like Flux, Redux prescribes you to concentrate your model update logic in a certain layer of your application (“stores” in Flux, “reducers” in Redux). Instead of letting the application code directly mutate the data, both tell you to describe every mutation as a plain object called “action”. <ide> <del>Unlike Flux, **Redux does not have a concept of Dispatcher**. This is because it relies on pure functions instead of event emitters, and pure functions are easy to compose and don’t need an additional entity managing them. WDepending on how you view Flux, you may see this as a deviation or an implementation detail. Flux has often been [described as `(state, action) => state`](https://speakerdeck.com/jmorrell/jsconf-uy-flux-those-who-forget-the-past-dot-dot-dot). In this sense, Redux is true to the Flux architecture, but makes it simpler thanks to pure functions. <add>Unlike Flux, **Redux does not have a concept of Dispatcher**. This is because it relies on pure functions instead of event emitters, and pure functions are easy to compose and don’t need an additional entity managing them. Depending on how you view Flux, you may see this as a deviation or an implementation detail. Flux has often been [described as `(state, action) => state`](https://speakerdeck.com/jmorrell/jsconf-uy-flux-those-who-forget-the-past-dot-dot-dot). In this sense, Redux is true to the Flux architecture, but makes it simpler thanks to pure functions. <ide> <ide> Another important difference from Flux is that **Redux assumes you never mutate your data**. You can use plain objects and arrays for your state just fine, but mutating them inside the reducers is severely discouraged. You should always return a new object, which is easy with the [object spread syntax proposed for ES7](https://github.com/sebmarkbage/ecmascript-rest-spread) and implemented in [Babel](http://babeljs.io), or with a library like [Immutable](https://facebook.github.io/immutable-js). <ide>
1
Ruby
Ruby
retrive the right pool for db tasks
34856ba9fa893bd1483ca5b08b65562cd5c02c58
<ide><path>activerecord/lib/active_record/tasks/database_tasks.rb <ide> def create(*arguments) <ide> end <ide> <ide> def create_all <del> old_pool = ActiveRecord::Base.connection_handler.retrieve_connection_pool(ActiveRecord::Base) <add> old_pool = ActiveRecord::Base.connection_handler.retrieve_connection_pool(ActiveRecord::Base.specification_id) <ide> each_local_configuration { |configuration| create configuration } <ide> if old_pool <del> ActiveRecord::Base.connection_handler.establish_connection(ActiveRecord::Base, old_pool.spec) <add> ActiveRecord::Base.connection_handler.establish_connection(old_pool.spec) <ide> end <ide> end <ide>
1
Python
Python
initialize finished counter at zero
3b2ef88f877fc5e4fcbe8038f0a9251263eaafbc
<ide><path>airflow/models/taskinstance.py <ide> def _run_raw_task( <ide> session.commit() <ide> actual_start_date = timezone.utcnow() <ide> Stats.incr(f'ti.start.{self.task.dag_id}.{self.task.task_id}') <add> # Initialize final state counters at zero <add> for state in State.task_states: <add> Stats.incr(f'ti.finish.{self.task.dag_id}.{self.task.task_id}.{state}', count=0) <ide> try: <ide> if not mark_success: <ide> self.task = self.task.prepare_for_execution() <ide><path>tests/models/test_taskinstance.py <ide> def test_task_stats(self, stats_mock, create_task_instance): <ide> ti._run_raw_task() <ide> ti.refresh_from_db() <ide> stats_mock.assert_called_with(f'ti.finish.{ti.dag_id}.{ti.task_id}.{ti.state}') <add> for state in State.task_states: <add> assert call(f'ti.finish.{ti.dag_id}.{ti.task_id}.{state}', count=0) in stats_mock.mock_calls <ide> assert call(f'ti.start.{ti.dag_id}.{ti.task_id}') in stats_mock.mock_calls <del> assert stats_mock.call_count == 4 <add> assert stats_mock.call_count == 19 <ide> <ide> def test_command_as_list(self, create_task_instance): <ide> ti = create_task_instance()
2
Javascript
Javascript
improve spec spacing
42e3a5015db82aea4f9969f8dc259660e2ef28f5
<ide><path>spec/menu-sort-helpers-spec.js <ide> describe('contextMenu', () => { <ide> expect(sortMenuItems(items)).toEqual(items) <ide> }) <ide> }) <add> <ide> describe('dedupes separators', () => { <ide> it('trims leading separators', () => { <ide> const items = [{ type: 'separator' }, { command: 'core:one' }] <ide> const expected = [{ command: 'core:one' }] <ide> expect(sortMenuItems(items)).toEqual(expected) <ide> }) <add> <ide> it('preserves separators at the begining of set two', () => { <ide> const items = [ <ide> { command: 'core:one' }, <ide> describe('contextMenu', () => { <ide> ] <ide> expect(sortMenuItems(items)).toEqual(expected) <ide> }) <add> <ide> it('trims trailing separators', () => { <ide> const items = [{ command: 'core:one' }, { type: 'separator' }] <ide> const expected = [{ command: 'core:one' }] <ide> expect(sortMenuItems(items)).toEqual(expected) <ide> }) <add> <ide> it('removes duplicate separators across sets', () => { <ide> const items = [ <ide> { command: 'core:one' }, { type: 'separator' }, <ide> describe('contextMenu', () => { <ide> expect(sortMenuItems(items)).toEqual(expected) <ide> }) <ide> }) <add> <ide> describe('can move an item to a different group by merging groups', () => { <ide> it('can move a group of one item', () => { <ide> const items = [ <ide> describe('contextMenu', () => { <ide> ] <ide> expect(sortMenuItems(items)).toEqual(expected) <ide> }) <add> <ide> it("moves all items in the moving item's group", () => { <ide> const items = [ <ide> { command: 'core:one' }, <ide> describe('contextMenu', () => { <ide> ] <ide> expect(sortMenuItems(items)).toEqual(expected) <ide> }) <add> <ide> it("ignores positions relative to commands that don't exist", () => { <ide> const items = [ <ide> { command: 'core:one' }, <ide> describe('contextMenu', () => { <ide> ] <ide> expect(sortMenuItems(items)).toEqual(expected) <ide> }) <add> <ide> it('can handle recursive group merging', () => { <ide> const items = [ <ide> { command: 'core:one', after: ['core:three'] }, <ide> describe('contextMenu', () => { <ide> ] <ide> expect(sortMenuItems(items)).toEqual(expected) <ide> }) <add> <ide> it('can merge multiple groups when given a list of before/after commands', () => { <ide> const items = [ <ide> { command: 'core:one' }, <ide> describe('contextMenu', () => { <ide> ] <ide> expect(sortMenuItems(items)).toEqual(expected) <ide> }) <add> <ide> it('can merge multiple groups based on both before/after commands', () => { <ide> const items = [ <ide> { command: 'core:one' }, <ide> describe('contextMenu', () => { <ide> expect(sortMenuItems(items)).toEqual(expected) <ide> }) <ide> }) <add> <ide> describe('sorts items within their ultimate group', () => { <ide> it('does a simple sort', () => { <ide> const items = [ <ide> describe('contextMenu', () => { <ide> { command: 'core:two', after: ['core:one'] } <ide> ]) <ide> }) <add> <ide> it('resolves cycles by ignoring things that conflict', () => { <ide> const items = [ <ide> { command: 'core:two', after: ['core:one'] }, <ide> describe('contextMenu', () => { <ide> ]) <ide> }) <ide> }) <add> <ide> describe('sorts groups', () => { <ide> it('does a simple sort', () => { <ide> const items = [ <ide> describe('contextMenu', () => { <ide> { command: 'core:two', afterGroupContaining: ['core:one'] } <ide> ]) <ide> }) <add> <ide> it('resolves cycles by ignoring things that conflict', () => { <ide> const items = [ <ide> { command: 'core:two', afterGroupContaining: ['core:one'] }, <ide> describe('contextMenu', () => { <ide> { command: 'core:two', afterGroupContaining: ['core:one'] } <ide> ]) <ide> }) <add> <ide> it('ignores references to commands that do not exist', () => { <ide> const items = [ <ide> { command: 'core:one' }, <ide> describe('contextMenu', () => { <ide> { command: 'core:two', afterGroupContaining: ['core:does-not-exist'] } <ide> ]) <ide> }) <add> <ide> it('only respects the first matching [before|after]GroupContaining rule in a given group', () => { <ide> const items = [ <ide> { command: 'core:one' },
1
Mixed
Text
add navigation overview
35f5ce296b47fa1ad13077f7d7d01dd25c5422fa
<ide><path>Libraries/Components/Navigation/NavigatorIOS.ios.js <ide> type Event = Object; <ide> * [`Navigator`](/docs/navigator.html) for a similar solution for your <ide> * cross-platform needs. <ide> * <del> * > **NOTE**: This component is not maintained by Facebook and is the <del> * > community's responsibility. <del> * <ide> * To set up the navigator, provide the `initialRoute` prop with a route <ide> * object. A route object is used to describe each scene that your app <ide> * navigates to. `initialRoute` represents the first route in your navigator. <ide><path>docs/JavaScriptEnvironment.md <ide> title: JavaScript Environment <ide> layout: docs <ide> category: Guides <ide> permalink: docs/javascript-environment.html <del>next: navigator-comparison <add>next: navigation <ide> --- <ide> <ide> ## JavaScript Runtime <ide><path>docs/Navigation.md <add>--- <add>id: navigation <add>title: Navigation <add>layout: docs <add>category: Guides <add>permalink: docs/navigation.html <add>next: navigator-comparison <add>--- <add> <add>Mobile apps rarely consist of just one screen or scene. As soon as you add a second scene to your app, you will have to take into consideration how the user will navigate from one scene to the other. <add> <add>Navigators in React Native allow you to push and pop scenes in a master/detail stack, or to pop up modal scenes. Navigators handle the transitions between scenes, and also maintain the navigational state of your application. <add> <add>If you are just getting started with React Native, you will probably want to start with the `Navigator` component. <add> <add>## Navigator <add> <add>`Navigator` is a cross-platform implementation of a navigation stack, so it works on both iOS and Android. It is easy to customize and includes simple navigation bars. <add> <add>```js <add><Navigator <add> initialRoute={{ title: 'My Initial Scene', index: 0}} <add> renderScene={(route, navigator) => { <add> // We'll get to this function soon. <add> }} <add>/> <add>``` <add> <add>Something you will encounter a lot when dealing with navigation is the concept of routes. A route is an object that contains information about a scene. It is used to provide all the context the `renderScene` function needs to render a scene. <add> <add>The `push` and `pop` functions provided by Navigator can be used to push and pop routes into the navigation stack. A more complete example that demonstrates the pushing and popping of routes could therefore look something like this: <add> <add>```js <add>class MyScene extends Component { <add> static propTypes = { <add> title: PropTypes.string.isRequired, <add> onForward: PropTypes.func.isRequired, <add> onBack: PropTypes.func.isRequired, <add> } <add> render() { <add> return ( <add> <View> <add> <Text>Current Scene: { this.props.title }</Text> <add> <TouchableHighlight onPress={this.props.onForward}> <add> <Text>Tap me to load the next scene</Text> <add> </TouchableHighlight> <add> <TouchableHighlight onPress={this.props.onBack}> <add> <Text>Tap me to go back</Text> <add> </TouchableHighlight> <add> </View> <add> ) <add> } <add>} <add> <add>class SimpleNavigationApp extends Component { <add> render() { <add> return ( <add> <Navigator <add> initialRoute={{ title: 'My Initial Scene', index: 0 }} <add> renderScene={(route, navigator) => <add> <MyScene <add> title={route.title} <add> onForward={ () => { <add> const nextIndex = route.index + 1; <add> navigator.push({ <add> title: 'Scene ' + nextIndex, <add> index: nextIndex, <add> }); <add> }} <add> onBack={() => { <add> if (route.index > 0) { <add> navigator.pop(); <add> } <add> }} <add> /> <add> } <add> /> <add> ) <add> } <add>} <add>``` <add> <add>In this example, the `MyScene` component is passed the title of the current route via the `title` prop. It displays two tappable components that call the `onForward` and `onBack` functions passed through its props, which in turn will call `navigator.push()` and `navigator.pop()` as needed. <add> <add>While this is a very basic example, it can easily be adapted to render an entirely different component based on the route that is passed to the `renderScene` function. Navigator will push new scenes from the right by default, and you can control this behavior by using the `configureScene` function. Check out the [Navigator API reference](docs/navigator.html) to learn more. <add> <add>## NavigatorIOS <add> <add>If you are targeting iOS only, you may also want to consider using `NavigatorIOS`. It looks and feels just like `UINavigationController`, because it is actually built on top of it. <add> <add>```js <add><NavigatorIOS <add> initialRoute={{ <add> component: MyScene, <add> title: 'My Initial Scene', <add> passProps: { myProp: 'foo' }, <add> }} <add>/> <add>``` <add> <add>Just like Navigator, it it uses routes to represent scenes, with some important differences. The actual component that will be rendered can be specified using the `component` key in the route, and any props that should be passed to this component can be specified in `passProps`. A navigator object is automatically passed as a prop to the component, allowing you to call `push` and `pop` as needed. <add> <add>Check out the [NavigatorIOS reference docs](docs/navigatorios.html) to learn more about this component. <add> <add>```js <add>class MyScene extends Component { <add> static propTypes = { <add> title: PropTypes.string.isRequired, <add> navigator: PropTypes.object.isRequired, <add> } <add> <add> constructor(props, context) { <add> super(props, context); <add> this._onForward = this._onForward.bind(this); <add> this._onBack = this._onBack.bind(this); <add> } <add> <add> _onForward() { <add> this.props.navigator.push({ <add> title: 'Scene ' + nextIndex, <add> }); <add> } <add> <add> _onBack() { <add> this.props.navigator.pop(); <add> } <add> <add> render() { <add> return ( <add> <View> <add> <Text>Current Scene: { this.props.title }</Text> <add> <TouchableHighlight onPress={this._onForward}> <add> <Text>Tap me to load the next scene</Text> <add> </TouchableHighlight> <add> <TouchableHighlight onPress={this._onBack}> <add> <Text>Tap me to go back</Text> <add> </TouchableHighlight> <add> </View> <add> ) <add> } <add>} <add> <add>class NavigatorIOSApp extends Component { <add> render() { <add> return ( <add> <NavigatorIOS <add> initialRoute={{ <add> component: MyScene, <add> title: 'My Initial Scene', <add> index: 0 <add> }} <add> renderScene={ (route, navigator) => <add> <MyScene title={route.title} /> <add> } <add> /> <add> ) <add> } <add>} <add>``` <add> <add>> You may also want to check out [react-native-navigation](https://github.com/wix/react-native-navigation), a component that aims to provide native navigation on both iOS and Android. <add> <add>## Navigation (Experimental) <add> <add>If you are looking for a more powerful navigation API, check out [NavigationExperimental](https://github.com/facebook/react-native/tree/master/Examples/UIExplorer/NavigationExperimental). It provides greater customization over your transitions, uses single-directional data flow using reducers to manipulate state at a top-level object, and offloads transition animations to the GPU.
3
PHP
PHP
add exception accesor to http client
33af82595b5f36d8f77cea69a4f275556e1ebfb4
<ide><path>src/Illuminate/Http/Client/Response.php <ide> public function toPsrResponse() <ide> return $this->response; <ide> } <ide> <add> /** <add> * Create an exception if a server or client error occurred. <add> * <add> * @return \Illuminate\Http\Client\RequestException|null <add> */ <add> public function toException() <add> { <add> if ($this->failed()) { <add> return new RequestException($this); <add> } <add> } <add> <ide> /** <ide> * Throw an exception if a server or client error occurred. <ide> * <ide> public function throw() <ide> $callback = func_get_args()[0] ?? null; <ide> <ide> if ($this->failed()) { <del> throw tap(new RequestException($this), function ($exception) use ($callback) { <add> throw tap($this->toException(), function ($exception) use ($callback) { <ide> if ($callback && is_callable($callback)) { <ide> $callback($this, $exception); <ide> } <ide><path>tests/Http/HttpClientTest.php <ide> public function testCanConfirmManyHeadersUsingAString() <ide> }); <ide> } <ide> <add> public function testExceptionAccessorOnSuccess() <add> { <add> $resp = new Response(new Psr7Response()); <add> <add> $this->assertNull($resp->toException()); <add> } <add> <add> public function testExceptionAccessorOnFailure() <add> { <add> $error = [ <add> 'error' => [ <add> 'code' => 403, <add> 'message' => 'The Request can not be completed', <add> ], <add> ]; <add> $response = new Psr7Response(403, [], json_encode($error)); <add> $resp = new Response($response); <add> <add> $this->assertInstanceOf(RequestException::class, $resp->toException()); <add> } <add> <ide> public function testRequestExceptionSummary() <ide> { <ide> $this->expectException(RequestException::class);
2
Python
Python
add `sequence` section in utils page
21c5e5479b5dce27c6b1c3971fd02d2eb96353d7
<ide><path>docs/autogen.py <ide> 'page': 'utils.md', <ide> 'all_module_functions': [utils], <ide> 'classes': [utils.CustomObjectScope, <del> utils.HDF5Matrix] <add> utils.HDF5Matrix, <add> utils.Sequence] <ide> }, <ide> ] <ide>
1
PHP
PHP
add comment to cache file driver
5f0ffe135dcf2540f925033ddf7d786615928f81
<ide><path>system/cache/file.php <ide> public function get($key) <ide> <ide> $cache = file_get_contents(CACHE_PATH.$key); <ide> <add> // The cache expiration date is stored as a UNIX timestamp at the beginning <add> // of the cache file. We'll extract it out and check it here. <ide> if (time() >= substr($cache, 0, 10)) <ide> { <ide> $this->forget($key);
1
Text
Text
fix some typos
0db928a63aee9ab5d9c277d551f17e28d860c8ae
<ide><path>guides/source/configuring.md <ide> Below is a comprehensive list of all the initializers found in Rails in the orde <ide> <ide> * `active_support.initialize_time_zone` Sets the default time zone for the application based on the `config.time_zone` setting, which defaults to "UTC". <ide> <del>* `active_support.initialize_beginning_of_week` Sets the default beginnig of week for the application based on `config.beginning_of_week` setting, which defaults to `:monday`. <add>* `active_support.initialize_beginning_of_week` Sets the default beginning of week for the application based on `config.beginning_of_week` setting, which defaults to `:monday`. <ide> <ide> * `action_dispatch.configure` Configures the `ActionDispatch::Http::URL.tld_length` to be set to the value of `config.action_dispatch.tld_length`. <ide> <ide> Below is a comprehensive list of all the initializers found in Rails in the orde <ide> <ide> * `engines_blank_point` Provides a point-in-initialization to hook into if you wish to do anything before engines are loaded. After this point, all railtie and engine initializers are run. <ide> <del>* `add_generator_templates` Finds templates for generators at `lib/templates` for the application, railities and engines and adds these to the `config.generators.templates` setting, which will make the templates available for all generators to reference. <add>* `add_generator_templates` Finds templates for generators at `lib/templates` for the application, railties and engines and adds these to the `config.generators.templates` setting, which will make the templates available for all generators to reference. <ide> <ide> * `ensure_autoload_once_paths_as_subset` Ensures that the `config.autoload_once_paths` only contains paths from `config.autoload_paths`. If it contains extra paths, then an exception will be raised. <ide> <ide><path>guides/source/contributing_to_ruby_on_rails.md <ide> The above are guidelines — please use your best judgment in using them. <ide> <ide> The CHANGELOG is an important part of every release. It keeps the list of changes for every Rails version. <ide> <del>You should add an entry to the CHANGELOG of the framework that you modified if you're adding or removing a feature, commiting a bug fix or adding deprecation notices. Refactorings and documentation changes generally should not go to the CHANGELOG. <add>You should add an entry to the CHANGELOG of the framework that you modified if you're adding or removing a feature, committing a bug fix or adding deprecation notices. Refactorings and documentation changes generally should not go to the CHANGELOG. <ide> <ide> A CHANGELOG entry should summarize what was changed and should end with author's name. You can use multiple lines if you need more space and you can attach code examples indented with 4 spaces. If a change is related to a specific issue, you should attach issue's number. Here is an example CHANGELOG entry: <ide>
2
Go
Go
add logs to containerattachoptions
fc8097f957ec7ae990f84faf54bce85a399c96af
<ide><path>api/types/client.go <ide> type ContainerAttachOptions struct { <ide> Stdout bool <ide> Stderr bool <ide> DetachKeys string <add> Logs bool <ide> } <ide> <ide> // ContainerCommitOptions holds parameters to commit changes into a container. <ide><path>client/container_attach.go <ide> func (cli *Client) ContainerAttach(ctx context.Context, container string, option <ide> if options.DetachKeys != "" { <ide> query.Set("detachKeys", options.DetachKeys) <ide> } <add> if options.Logs { <add> query.Set("logs", "1") <add> } <ide> <ide> headers := map[string][]string{"Content-Type": {"text/plain"}} <ide> return cli.postHijacked(ctx, "/containers/"+container+"/attach", query, nil, headers) <ide><path>integration-cli/docker_api_attach_test.go <ide> package main <ide> <ide> import ( <ide> "bufio" <add> "bytes" <add> "context" <ide> "io" <ide> "net" <ide> "net/http" <ide> "strings" <ide> "time" <ide> <add> "github.com/docker/docker/api/types" <add> "github.com/docker/docker/client" <ide> "github.com/docker/docker/pkg/integration/checker" <add> "github.com/docker/docker/pkg/stdcopy" <ide> "github.com/go-check/check" <ide> "golang.org/x/net/websocket" <ide> ) <ide> func (s *DockerSuite) TestPostContainersAttach(c *check.C) { <ide> // Nothing should be received because both the stdout and stderr of the container will be <ide> // sent to the client as stdout when tty is enabled. <ide> expectTimeout(conn, br, "stdout") <add> <add> // Test the client API <add> // Make sure we don't see "hello" if Logs is false <add> client, err := client.NewEnvClient() <add> c.Assert(err, checker.IsNil) <add> <add> cid, _ = dockerCmd(c, "run", "-di", "busybox", "/bin/sh", "-c", "echo hello; cat") <add> cid = strings.TrimSpace(cid) <add> <add> attachOpts := types.ContainerAttachOptions{ <add> Stream: true, <add> Stdin: true, <add> Stdout: true, <add> } <add> <add> resp, err := client.ContainerAttach(context.Background(), cid, attachOpts) <add> c.Assert(err, checker.IsNil) <add> expectSuccess(resp.Conn, resp.Reader, "stdout", false) <add> <add> // Make sure we do see "hello" if Logs is true <add> attachOpts.Logs = true <add> resp, err = client.ContainerAttach(context.Background(), cid, attachOpts) <add> c.Assert(err, checker.IsNil) <add> <add> defer resp.Conn.Close() <add> resp.Conn.SetReadDeadline(time.Now().Add(time.Second)) <add> <add> _, err = resp.Conn.Write([]byte("success")) <add> c.Assert(err, checker.IsNil) <add> <add> actualStdout := new(bytes.Buffer) <add> actualStderr := new(bytes.Buffer) <add> stdcopy.StdCopy(actualStdout, actualStderr, resp.Reader) <add> c.Assert(actualStdout.Bytes(), checker.DeepEquals, []byte("hello\nsuccess"), check.Commentf("Attach didn't return the expected data from stdout")) <ide> }
3
Ruby
Ruby
check only formulas with resources
ebf52091eb372171f529aff3324b6eb3af59c9c5
<ide><path>Library/Homebrew/dev-cmd/livecheck.rb <ide> def livecheck <ide> casks = args.formula? ? [] : Cask::Caskroom.casks <ide> formulae + casks <ide> elsif args.resources? <del> livecheckable_resources = Formula.all.map { |formula| formula.resources }.flatten.filter{ |resource| resource.livecheckable? } <del> livecheckable_resources <add> formula_with_resources = Formula.all.select { |formula| formula.resources.any? } <add> formula_with_resources <ide> elsif args.all? <ide> formulae = args.cask? ? [] : Formula.all <ide> casks = args.formula? ? [] : Cask::Cask.all <ide> def livecheck <ide> raise UsageError, "A watchlist file is required when no arguments are given." <ide> end <ide> <del> p package_and_resource_to_check.class <del> p package_and_resource_to_check.length <del> p package_and_resource_to_check[0].class <del> p package_and_resource_to_check.map { |d| d.name } <add> # p package_and_resource_to_check.class <add> # p package_and_resource_to_check.length <add> # p package_and_resource_to_check[0].class <add> # p package_and_resource_to_check.map { |d| d.name } <ide> <ide> package_and_resource_to_check = package_and_resource_to_check.sort_by do |package_or_resource| <ide> package_or_resource.respond_to?(:token) ? package_or_resource.token : package_or_resource.name
1
Ruby
Ruby
add missing require to activerecord base_test.rb
afde7e3c0ec5e5fd8305539764e385256caf1eaf
<ide><path>activerecord/test/cases/base_test.rb <ide> require "models/owner" <ide> require "concurrent/atomic/count_down_latch" <ide> require "active_support/core_ext/enumerable" <add>require "active_support/core_ext/kernel/reporting" <ide> <ide> class FirstAbstractClass < ActiveRecord::Base <ide> self.abstract_class = true
1
Text
Text
add santigimeno to collaborators
0f0711601683e1e4170b9e56153703b040429628
<ide><path>README.md <ide> information about the governance of the Node.js project, see <ide> * [romankl](https://github.com/romankl) - **Roman Klauke** &lt;romaaan.git@gmail.com&gt; <ide> * [saghul](https://github.com/saghul) - **Saúl Ibarra Corretgé** &lt;saghul@gmail.com&gt; <ide> * [sam-github](https://github.com/sam-github) - **Sam Roberts** &lt;vieuxtech@gmail.com&gt; <add>* [santigimeno](https://github.com/santigimeno) - **Santiago Gimeno** &lt;santiago.gimeno@gmail.com&gt; <ide> * [seishun](https://github.com/seishun) - **Nikolai Vavilov** &lt;vvnicholas@gmail.com&gt; <ide> * [silverwind](https://github.com/silverwind) - **Roman Reiss** &lt;me@silverwind.io&gt; <ide> * [srl295](https://github.com/srl295) - **Steven R Loomis** &lt;srloomis@us.ibm.com&gt;
1
Text
Text
remove extra space in readme.md
f25104e1364cf7c56ae4a09a86b64a87de326ec3
<ide><path>README.md <ide> For more information about the governance of the Node.js project, see <ide> * [misterdjules](https://github.com/misterdjules) - <ide> **Julien Gilli** &lt;jgilli@nodejs.org&gt; <ide> * [mmarchini](https://github.com/mmarchini) - <del>**Matheus Marchini** &lt;matheus@sthima.com&gt; <add>**Matheus Marchini** &lt;matheus@sthima.com&gt; <ide> * [mscdex](https://github.com/mscdex) - <ide> **Brian White** &lt;mscdex@mscdex.net&gt; <ide> * [MylesBorins](https://github.com/MylesBorins) -
1
Ruby
Ruby
pass remaining args to `help`
652480207979026e9db9ab5e19e69cbe636d6964
<ide><path>Library/Homebrew/brew.rb <ide> class MissingEnvironmentVariables < RuntimeError; end <ide> # - if cmd is Cask, let Cask handle the help command instead <ide> if (empty_argv || help_flag) && cmd != "cask" <ide> require "help" <del> Homebrew::Help.help cmd, empty_argv: empty_argv <del> # `Homebrew.help` never returns, except for unknown commands. <add> Homebrew::Help.help cmd, remaining_args: args.remaining, empty_argv: empty_argv <add> # `Homebrew::Help.help` never returns, except for unknown commands. <ide> end <ide> <ide> if internal_cmd || Commands.external_ruby_v2_cmd_path(cmd) <ide> class MissingEnvironmentVariables < RuntimeError; end <ide> end <ide> rescue UsageError => e <ide> require "help" <del> Homebrew::Help.help cmd, usage_error: e.message <add> Homebrew::Help.help cmd, remaining_args: args.remaining, usage_error: e.message <ide> rescue SystemExit => e <ide> onoe "Kernel.exit" if args.debug? && !e.success? <ide> $stderr.puts e.backtrace if args.debug? <ide><path>Library/Homebrew/cmd/help.rb <ide> require "help" <ide> <ide> module Homebrew <del> def help(cmd = nil, flags = {}) <del> Help.help(cmd, flags) <add> def help <add> Help.help <ide> end <ide> end <ide><path>Library/Homebrew/help.rb <ide> module Homebrew <ide> module Help <ide> module_function <ide> <del> def help(cmd = nil, empty_argv: false, usage_error: nil) <add> def help(cmd = nil, empty_argv: false, usage_error: nil, remaining_args: []) <ide> if cmd.nil? <ide> # Handle `brew` (no arguments). <ide> if empty_argv <ide> def help(cmd = nil, empty_argv: false, usage_error: nil) <ide> <ide> # Display command-specific (or generic) help in response to `UsageError`. <ide> if usage_error <del> $stderr.puts path ? command_help(cmd, path) : HOMEBREW_HELP <add> $stderr.puts path ? command_help(cmd, path, remaining_args: remaining_args) : HOMEBREW_HELP <ide> $stderr.puts <ide> onoe usage_error <ide> exit 1 <ide> def help(cmd = nil, empty_argv: false, usage_error: nil) <ide> return if path.nil? <ide> <ide> # Display help for internal command (or generic help if undocumented). <del> puts command_help(cmd, path) <add> puts command_help(cmd, path, remaining_args: remaining_args) <ide> exit 0 <ide> end <ide> <del> def command_help(cmd, path) <add> def command_help(cmd, path, remaining_args:) <ide> # Only some types of commands can have a parser. <ide> output = if Commands.valid_internal_cmd?(cmd) || <ide> Commands.valid_internal_dev_cmd?(cmd) || <ide> Commands.external_ruby_v2_cmd_path(cmd) <del> parser_help(path) <add> parser_help(path, remaining_args: remaining_args) <ide> end <ide> <ide> output ||= comment_help(path) <ide> def command_help(cmd, path) <ide> output <ide> end <ide> <del> def parser_help(path) <add> def parser_help(path, remaining_args:) <ide> # Let OptionParser generate help text for commands which have a parser. <ide> cmd_parser = CLI::Parser.from_cmd_path(path) <ide> return unless cmd_parser <ide> <ide> # Try parsing arguments here in order to show formula options in help output. <del> cmd_parser.parse(Homebrew.args.remaining, ignore_invalid_options: true) <add> cmd_parser.parse(remaining_args, ignore_invalid_options: true) <ide> cmd_parser.generate_help_text <ide> end <ide>
3
Ruby
Ruby
simplify parse arguments in `consoletest`
c4bbce969779179457218558be7554b4ee4b3230
<ide><path>railties/test/commands/console_test.rb <ide> def load_console <ide> end <ide> <ide> def parse_arguments(args) <del> Rails::Command::ConsoleCommand.class_eval do <del> alias_method :old_perform, :perform <del> define_method(:perform) do <del> extract_environment_option_from_argument <del> <del> options <del> end <del> end <del> <del> Rails::Command.invoke(:console, args) <del> ensure <del> Rails::Command::ConsoleCommand.class_eval do <del> undef_method :perform <del> alias_method :perform, :old_perform <del> undef_method :old_perform <del> end <add> command = Rails::Command::ConsoleCommand.new([], args) <add> command.send(:extract_environment_option_from_argument) <add> command.options <ide> end <ide> end
1
Javascript
Javascript
add rfc232 variants
27b852ac99c7846162f8b263ced800bbfed2833c
<ide><path>blueprints/component-test/qunit-rfc-232-files/tests/__testType__/__path__/__test__.js <add><% if (testType === 'integration') { %>import { module, test } from 'qunit'; <add>import { setupRenderingTest } from 'ember-qunit'; <add>import { render } from '@ember/test-helpers'; <add>import hbs from 'htmlbars-inline-precompile'; <add> <add>module('<%= friendlyTestDescription %>', function(hooks) { <add> setupRenderingTest(hooks); <add> <add> test('it renders', async function(assert) { <add> // Set any properties with this.set('myProperty', 'value'); <add> // Handle any actions with this.set('myAction', function(val) { ... }); <add> <add> await render(hbs`{{<%= componentPathName %>}}`); <add> <add> assert.equal(this.element.textContent.trim(), ''); <add> <add> // Template block usage: <add> await render(hbs` <add> {{#<%= componentPathName %>}} <add> template block text <add> {{/<%= componentPathName %>}} <add> `); <add> <add> assert.equal(this.element.textContent.trim(), 'template block text'); <add> }); <add>});<% } else if (testType === 'unit') { %>import { module, test } from 'qunit'; <add>import { setupTest } from 'ember-qunit'; <add> <add>module('<%= friendlyTestDescription %>', function(hooks) { <add> setupTest(hooks); <add> <add> test('it exists', function(assert) { <add> let component = this.owner.factoryFor('component:<%= componentPathName %>').create(); <add> assert.ok(component); <add> }); <add>});<% } %> <ide><path>node-tests/blueprints/component-test.js <ide> describe('Acceptance: ember generate component', function() { <ide> })); <ide> }); <ide> <add> it('component-test x-foo for RFC232', function() { <add> var args = ['component-test', 'x-foo']; <add> <add> return emberNew() <add> .then(() => generateFakePackageManifest('ember-cli-qunit', '4.1.1')) <add> .then(() => emberGenerateDestroy(args, _file => { <add> expect(_file('tests/integration/components/x-foo-test.js')) <add> .to.equal(fixture('component-test/rfc232.js')); <add> })); <add> }); <add> <add> it('component-test x-foo --unit for RFC232', function() { <add> var args = ['component-test', 'x-foo', '--unit']; <add> <add> return emberNew() <add> .then(() => generateFakePackageManifest('ember-cli-qunit', '4.1.1')) <add> .then(() => emberGenerateDestroy(args, _file => { <add> expect(_file('tests/unit/components/x-foo-test.js')) <add> .to.equal(fixture('component-test/rfc232-unit.js')); <add> })); <add> }); <add> <ide> it('component-test x-foo for mocha', function() { <ide> var args = ['component-test', 'x-foo']; <ide> <ide><path>node-tests/fixtures/component-test/rfc232-unit.js <add>import { module, test } from 'qunit'; <add>import { setupTest } from 'ember-qunit'; <add> <add>module('Unit | Component | x foo', function(hooks) { <add> setupTest(hooks); <add> <add> test('it exists', function(assert) { <add> let component = this.owner.factoryFor('component:x-foo').create(); <add> assert.ok(component); <add> }); <add>}); <ide><path>node-tests/fixtures/component-test/rfc232.js <add>import { module, test } from 'qunit'; <add>import { setupRenderingTest } from 'ember-qunit'; <add>import { render } from '@ember/test-helpers'; <add>import hbs from 'htmlbars-inline-precompile'; <add> <add>module('Integration | Component | x foo', function(hooks) { <add> setupRenderingTest(hooks); <add> <add> test('it renders', async function(assert) { <add> // Set any properties with this.set('myProperty', 'value'); <add> // Handle any actions with this.set('myAction', function(val) { ... }); <add> <add> await render(hbs`{{x-foo}}`); <add> <add> assert.equal(this.element.textContent.trim(), ''); <add> <add> // Template block usage: <add> await render(hbs` <add> {{#x-foo}} <add> template block text <add> {{/x-foo}} <add> `); <add> <add> assert.equal(this.element.textContent.trim(), 'template block text'); <add> }); <add>});
4
Javascript
Javascript
unify xform @array edition
5769c87030d257cd33faba9070bc58f1fed344ac
<ide><path>packages/ember-runtime/lib/mixins/array.js <ide> function none(obj) { return obj===null || obj===undefined; } <ide> <ide> /** @private */ <ide> function xform(target, method, params) { <del> method.call(target, params[0], params[2], params[3], params[4]); <add> var args = [].slice.call(params, 2); <add> method.apply(target, args); <ide> } <ide> <ide> // .......................................................... <ide> Ember.Array = Ember.Mixin.create(Ember.Enumerable, /** @scope Ember.Array.protot <ide> if (addAmt === undefined) addAmt=-1; <ide> } <ide> <del> Ember.sendEvent(this, '@array:before', startIdx, removeAmt, addAmt); <add> Ember.sendEvent(this, '@array:before', this, startIdx, removeAmt, addAmt); <ide> <ide> var removing, lim; <ide> if (startIdx>=0 && removeAmt>=0 && get(this, 'hasEnumerableObservers')) { <ide> Ember.Array = Ember.Mixin.create(Ember.Enumerable, /** @scope Ember.Array.protot <ide> } <ide> <ide> this.enumerableContentDidChange(removeAmt, adding); <del> Ember.sendEvent(this, '@array:change', startIdx, removeAmt, addAmt); <add> Ember.sendEvent(this, '@array:change', this, startIdx, removeAmt, addAmt); <ide> <ide> var length = get(this, 'length'), <ide> cachedFirst = cacheFor(this, 'firstObject'),
1
Ruby
Ruby
use \a in regexps
baa240d09c09b74e9bc69c91e4b5c9fb5bca2005
<ide><path>actionpack/lib/action_controller/metal/redirecting.rb <ide> def _compute_redirect_to_location(options) <ide> # letters, digits, and the plus ("+"), period ("."), or hyphen ("-") <ide> # characters; and is terminated by a colon (":"). <ide> # The protocol relative scheme starts with a double slash "//" <del> when %r{^(\w[\w+.-]*:|//).*} <add> when %r{\A(\w[\w+.-]*:|//).*} <ide> options <ide> when String <ide> request.protocol + request.host_with_port + options
1
Text
Text
update changelog for 2.10.6
6a2e2c04c07431d50ed40184062923c8da76433c
<ide><path>CHANGELOG.md <ide> Changelog <ide> ========= <ide> <add>### 2.10.6 <add> <add>[#2515](https://github.com/moment/moment/pull/2515) Fix regression introduced <add>in `2.10.5` related to `moment.ISO_8601` parsing. <add> <ide> ### 2.10.5 [See full changelog](https://gist.github.com/ichernev/6ec13ac7efc396da44b2) <ide> <ide> Important changes:
1
Python
Python
update tokenizer exceptions for english
78e63dc7d08b764447f5a42d39145a5649537bf8
<ide><path>spacy/en/tokenizer_exceptions.py <ide> ], <ide> <ide> "Theydve": [ <del> {ORTH: "They", LEMMA: PRON_LEMMA}, <add> {ORTH: "They", LEMMA: PRON_LEMMA, TAG: "PRP"}, <ide> {ORTH: "d", LEMMA: "would", TAG: "MD"}, <ide> {ORTH: "ve", LEMMA: "have", TAG: "VB"} <ide> ], <ide> ], <ide> <ide> "itll": [ <del> {ORTH: "it", LEMMA: PRON_LEMMA}, <add> {ORTH: "it", LEMMA: PRON_LEMMA, TAG: "PRP"}, <ide> {ORTH: "ll", LEMMA: "will", TAG: "MD"} <ide> ], <ide> <ide> ], <ide> <ide> "Idve": [ <del> {ORTH: "I", LEMMA: PRON_LEMMA}, <add> {ORTH: "I", LEMMA: PRON_LEMMA, TAG: "PRP"}, <ide> {ORTH: "d", LEMMA: "would", TAG: "MD"}, <ide> {ORTH: "ve", LEMMA: "have", TAG: "VB"} <ide> ], <ide> ], <ide> <ide> "Ive": [ <del> {ORTH: "I", LEMMA: PRON_LEMMA}, <add> {ORTH: "I", LEMMA: PRON_LEMMA, TAG: "PRP"}, <ide> {ORTH: "ve", LEMMA: "have", TAG: "VB"} <ide> ], <ide> <ide> "they'd": [ <del> {ORTH: "they", LEMMA: PRON_LEMMA}, <add> {ORTH: "they", LEMMA: PRON_LEMMA, TAG: "PRP"}, <ide> {ORTH: "'d", LEMMA: "would", TAG: "MD"} <ide> ], <ide> <ide> "Youdve": [ <del> {ORTH: "You", LEMMA: PRON_LEMMA}, <add> {ORTH: "You", LEMMA: PRON_LEMMA, TAG: "PRP"}, <ide> {ORTH: "d", LEMMA: "would", TAG: "MD"}, <ide> {ORTH: "ve", LEMMA: "have", TAG: "VB"} <ide> ], <ide> <ide> "theyve": [ <del> {ORTH: "they", LEMMA: PRON_LEMMA}, <add> {ORTH: "they", LEMMA: PRON_LEMMA, TAG: "PRP"}, <ide> {ORTH: "ve", LEMMA: "have", TAG: "VB"} <ide> ], <ide> <ide> ], <ide> <ide> "I'm": [ <del> {ORTH: "I", LEMMA: PRON_LEMMA}, <add> {ORTH: "I", LEMMA: PRON_LEMMA, TAG: "PRP"}, <ide> {ORTH: "'m", TAG: "VBP", "tenspect": 1, "number": 1, LEMMA: "be"} <ide> ], <ide> <ide> "She'd've": [ <del> {ORTH: "She", LEMMA: PRON_LEMMA}, <add> {ORTH: "She", LEMMA: PRON_LEMMA, TAG: "PRP"}, <ide> {ORTH: "'d", LEMMA: "would", TAG: "MD"}, <ide> {ORTH: "'ve", LEMMA: "have", TAG: "VB"} <ide> ], <ide> ], <ide> <ide> "they've": [ <del> {ORTH: "they", LEMMA: PRON_LEMMA}, <add> {ORTH: "they", LEMMA: PRON_LEMMA, TAG: "PRP"}, <ide> {ORTH: "'ve", LEMMA: "have", TAG: "VB"} <ide> ], <ide> <ide> ], <ide> <ide> "i'll": [ <del> {ORTH: "i", LEMMA: PRON_LEMMA}, <add> {ORTH: "i", LEMMA: PRON_LEMMA, TAG: "PRP"}, <ide> {ORTH: "'ll", LEMMA: "will", TAG: "MD"} <ide> ], <ide> <ide> "you'd": [ <del> {ORTH: "you", LEMMA: PRON_LEMMA}, <add> {ORTH: "you", LEMMA: PRON_LEMMA, TAG: "PRP"}, <ide> {ORTH: "'d", LEMMA: "would", TAG: "MD"} <ide> ], <ide> <ide> ], <ide> <ide> "youll": [ <del> {ORTH: "you", LEMMA: PRON_LEMMA}, <add> {ORTH: "you", LEMMA: PRON_LEMMA, TAG: "PRP"}, <ide> {ORTH: "ll", LEMMA: "will", TAG: "MD"} <ide> ], <ide> <ide> ], <ide> <ide> "Youre": [ <del> {ORTH: "You", LEMMA: PRON_LEMMA}, <add> {ORTH: "You", LEMMA: PRON_LEMMA, TAG: "PRP"}, <ide> {ORTH: "re", LEMMA: "be"} <ide> ], <ide> <ide> ], <ide> <ide> "You'll": [ <del> {ORTH: "You", LEMMA: PRON_LEMMA}, <add> {ORTH: "You", LEMMA: PRON_LEMMA, TAG: "PRP"}, <ide> {ORTH: "'ll", LEMMA: "will", TAG: "MD"} <ide> ], <ide> <ide> ], <ide> <ide> "i'd": [ <del> {ORTH: "i", LEMMA: PRON_LEMMA}, <add> {ORTH: "i", LEMMA: PRON_LEMMA, TAG: "PRP"}, <ide> {ORTH: "'d", LEMMA: "would", TAG: "MD"} <ide> ], <ide> <ide> ], <ide> <ide> "i'm": [ <del> {ORTH: "i", LEMMA: PRON_LEMMA}, <add> {ORTH: "i", LEMMA: PRON_LEMMA, TAG: "PRP"}, <ide> {ORTH: "'m", TAG: "VBP", "tenspect": 1, "number": 1, LEMMA: "be"} <ide> ], <ide> <ide> ], <ide> <ide> "Hes": [ <del> {ORTH: "He", LEMMA: PRON_LEMMA}, <add> {ORTH: "He", LEMMA: PRON_LEMMA, TAG: "PRP"}, <ide> {ORTH: "s"} <ide> ], <ide> <ide> ], <ide> <ide> "It's": [ <del> {ORTH: "It", LEMMA: PRON_LEMMA}, <add> {ORTH: "It", LEMMA: PRON_LEMMA, TAG: "PRP"}, <ide> {ORTH: "'s"} <ide> ], <ide> <ide> ], <ide> <ide> "Hed": [ <del> {ORTH: "He", LEMMA: PRON_LEMMA}, <add> {ORTH: "He", LEMMA: PRON_LEMMA, TAG: "PRP"}, <ide> {ORTH: "d", LEMMA: "would", TAG: "MD"} <ide> ], <ide> <ide> ], <ide> <ide> "It'd": [ <del> {ORTH: "It", LEMMA: PRON_LEMMA}, <add> {ORTH: "It", LEMMA: PRON_LEMMA, TAG: "PRP"}, <ide> {ORTH: "'d", LEMMA: "would", TAG: "MD"} <ide> ], <ide> <ide> "theydve": [ <del> {ORTH: "they", LEMMA: PRON_LEMMA}, <add> {ORTH: "they", LEMMA: PRON_LEMMA, TAG: "PRP"}, <ide> {ORTH: "d", LEMMA: "would", TAG: "MD"}, <ide> {ORTH: "ve", LEMMA: "have", TAG: "VB"} <ide> ], <ide> ], <ide> <ide> "I've": [ <del> {ORTH: "I", LEMMA: PRON_LEMMA}, <add> {ORTH: "I", LEMMA: PRON_LEMMA, TAG: "PRP"}, <ide> {ORTH: "'ve", LEMMA: "have", TAG: "VB"} <ide> ], <ide> <ide> ], <ide> <ide> "Itdve": [ <del> {ORTH: "It", LEMMA: PRON_LEMMA}, <add> {ORTH: "It", LEMMA: PRON_LEMMA, TAG: "PRP"}, <ide> {ORTH: "d", LEMMA: "would", TAG: "MD"}, <ide> {ORTH: "ve", LEMMA: "have", TAG: "VB"} <ide> ], <ide> <ide> "I'ma": [ <del> {ORTH: "I", LEMMA: PRON_LEMMA}, <add> {ORTH: "I", LEMMA: PRON_LEMMA, TAG: "PRP"}, <ide> {ORTH: "'ma"} <ide> ], <ide> <ide> ], <ide> <ide> "They'd": [ <del> {ORTH: "They", LEMMA: PRON_LEMMA}, <add> {ORTH: "They", LEMMA: PRON_LEMMA, TAG: "PRP"}, <ide> {ORTH: "'d", LEMMA: "would", TAG: "MD"} <ide> ], <ide> <ide> ], <ide> <ide> "You've": [ <del> {ORTH: "You", LEMMA: PRON_LEMMA}, <add> {ORTH: "You", LEMMA: PRON_LEMMA, TAG: "PRP"}, <ide> {ORTH: "'ve", LEMMA: "have", TAG: "VB"} <ide> ], <ide> <ide> ], <ide> <ide> "I'd've": [ <del> {ORTH: "I", LEMMA: PRON_LEMMA}, <add> {ORTH: "I", LEMMA: PRON_LEMMA, TAG: "PRP"}, <ide> {ORTH: "'d", LEMMA: "would", TAG: "MD"}, <ide> {ORTH: "'ve", LEMMA: "have", TAG: "VB"} <ide> ], <ide> ], <ide> <ide> "it'd": [ <del> {ORTH: "it", LEMMA: PRON_LEMMA}, <add> {ORTH: "it", LEMMA: PRON_LEMMA, TAG: "PRP"}, <ide> {ORTH: "'d", LEMMA: "would", TAG: "MD"} <ide> ], <ide> <ide> "what're": [ <ide> {ORTH: "what"}, <del> {ORTH: "'re", LEMMA: "be"} <add> {ORTH: "'re", LEMMA: "be", NORM: "are"} <ide> ], <ide> <ide> "Wasn't": [ <ide> ], <ide> <ide> "he'd've": [ <del> {ORTH: "he", LEMMA: PRON_LEMMA}, <add> {ORTH: "he", LEMMA: PRON_LEMMA, TAG: "PRP"}, <ide> {ORTH: "'d", LEMMA: "would", TAG: "MD"}, <ide> {ORTH: "'ve", LEMMA: "have", TAG: "VB"} <ide> ], <ide> <ide> "She'd": [ <del> {ORTH: "She", LEMMA: PRON_LEMMA}, <add> {ORTH: "She", LEMMA: PRON_LEMMA, TAG: "PRP"}, <ide> {ORTH: "'d", LEMMA: "would", TAG: "MD"} <ide> ], <ide> <ide> "shedve": [ <del> {ORTH: "she", LEMMA: PRON_LEMMA}, <add> {ORTH: "she", LEMMA: PRON_LEMMA, TAG: "PRP"}, <ide> {ORTH: "d", LEMMA: "would", TAG: "MD"}, <ide> {ORTH: "ve", LEMMA: "have", TAG: "VB"} <ide> ], <ide> ], <ide> <ide> "She's": [ <del> {ORTH: "i", LEMMA: PRON_LEMMA}, <add> {ORTH: "i", LEMMA: PRON_LEMMA, TAG: "PRP"}, <ide> {ORTH: "'s"} <ide> ], <ide> <ide> "i'd've": [ <del> {ORTH: "i", LEMMA: PRON_LEMMA}, <add> {ORTH: "i", LEMMA: PRON_LEMMA, TAG: "PRP"}, <ide> {ORTH: "'d", LEMMA: "would", TAG: "MD"}, <ide> {ORTH: "'ve", LEMMA: "have", TAG: "VB"} <ide> ], <ide> ], <ide> <ide> "you'd've": [ <del> {ORTH: "you", LEMMA: PRON_LEMMA}, <add> {ORTH: "you", LEMMA: PRON_LEMMA, TAG: "PRP"}, <ide> {ORTH: "'d", LEMMA: "would", TAG: "MD"}, <ide> {ORTH: "'ve", LEMMA: "have", TAG: "VB"} <ide> ], <ide> ], <ide> <ide> "Youd": [ <del> {ORTH: "You", LEMMA: PRON_LEMMA}, <add> {ORTH: "You", LEMMA: PRON_LEMMA, TAG: "PRP"}, <ide> {ORTH: "d", LEMMA: "would", TAG: "MD"} <ide> ], <ide> <ide> ], <ide> <ide> "ive": [ <del> {ORTH: "i", LEMMA: PRON_LEMMA}, <add> {ORTH: "i", LEMMA: PRON_LEMMA, TAG: "PRP"}, <ide> {ORTH: "ve", LEMMA: "have", TAG: "VB"} <ide> ], <ide> <ide> "It'd've": [ <del> {ORTH: "It", LEMMA: PRON_LEMMA}, <add> {ORTH: "It", LEMMA: PRON_LEMMA, TAG: "PRP"}, <ide> {ORTH: "'d", LEMMA: "would", TAG: "MD"}, <ide> {ORTH: "'ve", LEMMA: "have", TAG: "VB"} <ide> ], <ide> ], <ide> <ide> "Itll": [ <del> {ORTH: "It", LEMMA: PRON_LEMMA}, <add> {ORTH: "It", LEMMA: PRON_LEMMA, TAG: "PRP"}, <ide> {ORTH: "ll", LEMMA: "will", TAG: "MD"} <ide> ], <ide> <ide> ], <ide> <ide> "im": [ <del> {ORTH: "i", LEMMA: PRON_LEMMA}, <add> {ORTH: "i", LEMMA: PRON_LEMMA, TAG: "PRP"}, <ide> {ORTH: "m", TAG: "VBP", "tenspect": 1, "number": 1, LEMMA: "be"} <ide> ], <ide> <ide> "they'd've": [ <del> {ORTH: "they", LEMMA: PRON_LEMMA}, <add> {ORTH: "they", LEMMA: PRON_LEMMA, TAG: "PRP"}, <ide> {ORTH: "'d", LEMMA: "would", TAG: "MD"}, <ide> {ORTH: "'ve", LEMMA: "have", TAG: "VB"} <ide> ], <ide> ], <ide> <ide> "youdve": [ <del> {ORTH: "you", LEMMA: PRON_LEMMA}, <add> {ORTH: "you", LEMMA: PRON_LEMMA, TAG: "PRP"}, <ide> {ORTH: "d", LEMMA: "would", TAG: "MD"}, <ide> {ORTH: "ve", LEMMA: "have", TAG: "VB"} <ide> ], <ide> <ide> "Shedve": [ <del> {ORTH: "i", LEMMA: PRON_LEMMA}, <add> {ORTH: "i", LEMMA: PRON_LEMMA, TAG: "PRP"}, <ide> {ORTH: "d", LEMMA: "would", TAG: "MD"}, <ide> {ORTH: "ve", LEMMA: "have", TAG: "VB"} <ide> ], <ide> <ide> "theyd": [ <del> {ORTH: "they", LEMMA: PRON_LEMMA}, <add> {ORTH: "they", LEMMA: PRON_LEMMA, TAG: "PRP"}, <ide> {ORTH: "d", LEMMA: "would", TAG: "MD"} <ide> ], <ide> <ide> <ide> "What're": [ <ide> {ORTH: "What"}, <del> {ORTH: "'re", LEMMA: "be"} <add> {ORTH: "'re", LEMMA: "be", NORM: "are"} <ide> ], <ide> <ide> "He'll": [ <del> {ORTH: "He", LEMMA: PRON_LEMMA}, <add> {ORTH: "He", LEMMA: PRON_LEMMA, TAG: "PRP"}, <ide> {ORTH: "'ll", LEMMA: "will", TAG: "MD"} <ide> ], <ide> <ide> ], <ide> <ide> "They're": [ <del> {ORTH: "They", LEMMA: PRON_LEMMA}, <del> {ORTH: "'re", LEMMA: "be"} <add> {ORTH: "They", LEMMA: PRON_LEMMA, TAG: "PRP"}, <add> {ORTH: "'re", LEMMA: "be", NORM: "are"} <ide> ], <ide> <ide> "shouldnt": [ <ide> ], <ide> <ide> "youve": [ <del> {ORTH: "you", LEMMA: PRON_LEMMA}, <add> {ORTH: "you", LEMMA: PRON_LEMMA, TAG: "PRP"}, <ide> {ORTH: "ve", LEMMA: "have", TAG: "VB"} <ide> ], <ide> <ide> ], <ide> <ide> "Youve": [ <del> {ORTH: "You", LEMMA: PRON_LEMMA}, <add> {ORTH: "You", LEMMA: PRON_LEMMA, TAG: "PRP"}, <ide> {ORTH: "ve", LEMMA: "have", TAG: "VB"} <ide> ], <ide> <ide> ], <ide> <ide> "they're": [ <del> {ORTH: "they", LEMMA: PRON_LEMMA}, <del> {ORTH: "'re", LEMMA: "be"} <add> {ORTH: "they", LEMMA: PRON_LEMMA, TAG: "PRP"}, <add> {ORTH: "'re", LEMMA: "be", NORM: "are"} <ide> ], <ide> <ide> "idve": [ <del> {ORTH: "i", LEMMA: PRON_LEMMA}, <add> {ORTH: "i", LEMMA: PRON_LEMMA, TAG: "PRP"}, <ide> {ORTH: "d", LEMMA: "would", TAG: "MD"}, <ide> {ORTH: "ve", LEMMA: "have", TAG: "VB"} <ide> ], <ide> ], <ide> <ide> "youre": [ <del> {ORTH: "you", LEMMA: PRON_LEMMA}, <del> {ORTH: "re"} <add> {ORTH: "you", LEMMA: PRON_LEMMA, TAG: "PRP"}, <add> {ORTH: "re", LEMMA: "be", NORM: "are"} <ide> ], <ide> <ide> "Didn't": [ <ide> ], <ide> <ide> "Im": [ <del> {ORTH: "I", LEMMA: PRON_LEMMA}, <del> {ORTH: "m", TAG: "VBP", "tenspect": 1, "number": 1, LEMMA: "be"} <add> {ORTH: "I", LEMMA: PRON_LEMMA, TAG: "PRP"}, <add> {ORTH: "m", TAG: "VBP", "tenspect": 1, "number": 1, LEMMA: "be", NORM: "am"} <ide> ], <ide> <ide> "howd": [ <ide> ], <ide> <ide> "you've": [ <del> {ORTH: "you", LEMMA: PRON_LEMMA}, <add> {ORTH: "you", LEMMA: PRON_LEMMA, TAG: "PRP"}, <ide> {ORTH: "'ve", LEMMA: "have", TAG: "VB"} <ide> ], <ide> <ide> "You're": [ <del> {ORTH: "You", LEMMA: PRON_LEMMA}, <del> {ORTH: "'re", LEMMA: "be"} <add> {ORTH: "You", LEMMA: PRON_LEMMA, TAG: "PRP"}, <add> {ORTH: "'re", LEMMA: "be", NORM: "are"} <ide> ], <ide> <ide> "she'll": [ <del> {ORTH: "she", LEMMA: PRON_LEMMA}, <add> {ORTH: "she", LEMMA: PRON_LEMMA, TAG: "PRP"}, <ide> {ORTH: "'ll", LEMMA: "will", TAG: "MD"} <ide> ], <ide> <ide> "Theyll": [ <del> {ORTH: "They", LEMMA: PRON_LEMMA}, <add> {ORTH: "They", LEMMA: PRON_LEMMA, TAG: "PRP"}, <ide> {ORTH: "ll", LEMMA: "will", TAG: "MD"} <ide> ], <ide> <ide> ], <ide> <ide> "itd": [ <del> {ORTH: "it", LEMMA: PRON_LEMMA}, <add> {ORTH: "it", LEMMA: PRON_LEMMA, TAG: "PRP"}, <ide> {ORTH: "d", LEMMA: "would", TAG: "MD"} <ide> ], <ide> <ide> "Hedve": [ <del> {ORTH: "He", LEMMA: PRON_LEMMA}, <add> {ORTH: "He", LEMMA: PRON_LEMMA, TAG: "PRP"}, <ide> {ORTH: "d", LEMMA: "would", TAG: "MD"}, <ide> {ORTH: "ve", LEMMA: "have", TAG: "VB"} <ide> ], <ide> ], <ide> <ide> "We're": [ <del> {ORTH: "We", LEMMA: PRON_LEMMA}, <del> {ORTH: "'re", LEMMA: "be"} <add> {ORTH: "We", LEMMA: PRON_LEMMA, TAG: "PRP"}, <add> {ORTH: "'re", LEMMA: "be", NORM: "are"} <ide> ], <ide> <ide> "\u2018S": [ <ide> ], <ide> <ide> "ima": [ <del> {ORTH: "i", LEMMA: PRON_LEMMA}, <add> {ORTH: "i", LEMMA: PRON_LEMMA, TAG: "PRP"}, <ide> {ORTH: "ma"} <ide> ], <ide> <ide> ], <ide> <ide> "he's": [ <del> {ORTH: "he", LEMMA: PRON_LEMMA}, <add> {ORTH: "he", LEMMA: PRON_LEMMA, TAG: "PRP"}, <ide> {ORTH: "'s"} <ide> ], <ide> <ide> ], <ide> <ide> "hedve": [ <del> {ORTH: "he", LEMMA: PRON_LEMMA}, <add> {ORTH: "he", LEMMA: PRON_LEMMA, TAG: "PRP"}, <ide> {ORTH: "d", LEMMA: "would", TAG: "MD"}, <ide> {ORTH: "ve", LEMMA: "have", TAG: "VB"} <ide> ], <ide> <ide> "he'd": [ <del> {ORTH: "he", LEMMA: PRON_LEMMA}, <add> {ORTH: "he", LEMMA: PRON_LEMMA, TAG: "PRP"}, <ide> {ORTH: "'d", LEMMA: "would", TAG: "MD"} <ide> ], <ide> <ide> ], <ide> <ide> "You'd've": [ <del> {ORTH: "You", LEMMA: PRON_LEMMA}, <add> {ORTH: "You", LEMMA: PRON_LEMMA, TAG: "PRP"}, <ide> {ORTH: "'d", LEMMA: "would", TAG: "MD"}, <ide> {ORTH: "'ve", LEMMA: "have", TAG: "VB"} <ide> ], <ide> ], <ide> <ide> "wont": [ <del> {ORTH: "wo"}, <add> {ORTH: "wo", LEMMA: "will"}, <ide> {ORTH: "nt", LEMMA: "not", TAG: "RB"} <ide> ], <ide> <ide> "she'd've": [ <del> {ORTH: "she", LEMMA: PRON_LEMMA}, <add> {ORTH: "she", LEMMA: PRON_LEMMA, TAG: "PRP"}, <ide> {ORTH: "'d", LEMMA: "would", TAG: "MD"}, <ide> {ORTH: "'ve", LEMMA: "have", TAG: "VB"} <ide> ], <ide> ], <ide> <ide> "theyre": [ <del> {ORTH: "they", LEMMA: PRON_LEMMA}, <add> {ORTH: "they", LEMMA: PRON_LEMMA, TAG: "PRP"}, <ide> {ORTH: "re"} <ide> ], <ide> <ide> ], <ide> <ide> "They'll": [ <del> {ORTH: "They", LEMMA: PRON_LEMMA}, <add> {ORTH: "They", LEMMA: PRON_LEMMA, TAG: "PRP"}, <ide> {ORTH: "'ll", LEMMA: "will", TAG: "MD"} <ide> ], <ide> <ide> ], <ide> <ide> "Wedve": [ <del> {ORTH: "We"}, <add> {ORTH: "We", LEMMA: PRON_LEMMA, TAG: "PRP"}, <ide> {ORTH: "d", LEMMA: "would", TAG: "MD"}, <ide> {ORTH: "ve", LEMMA: "have", TAG: "VB"} <ide> ], <ide> ], <ide> <ide> "we'd": [ <del> {ORTH: "we"}, <add> {ORTH: "we", LEMMA: PRON_LEMMA, TAG: "PRP"}, <ide> {ORTH: "'d", LEMMA: "would", TAG: "MD"} <ide> ], <ide> <ide> <ide> "why're": [ <ide> {ORTH: "why"}, <del> {ORTH: "'re", LEMMA: "be"} <add> {ORTH: "'re", LEMMA: "be", NORM: "are"} <ide> ], <ide> <ide> "Doesnt": [ <ide> ], <ide> <ide> "they'll": [ <del> {ORTH: "they", LEMMA: PRON_LEMMA}, <add> {ORTH: "they", LEMMA: PRON_LEMMA, TAG: "PRP"}, <ide> {ORTH: "'ll", LEMMA: "will", TAG: "MD"} <ide> ], <ide> <ide> "I'd": [ <del> {ORTH: "I", LEMMA: PRON_LEMMA}, <add> {ORTH: "I", LEMMA: PRON_LEMMA, TAG: "PRP"}, <ide> {ORTH: "'d", LEMMA: "would", TAG: "MD"} <ide> ], <ide> <ide> ], <ide> <ide> "you're": [ <del> {ORTH: "you", LEMMA: PRON_LEMMA}, <del> {ORTH: "'re", LEMMA: "be"} <add> {ORTH: "you", LEMMA: PRON_LEMMA, TAG: "PRP"}, <add> {ORTH: "'re", LEMMA: "be", NORM: "are"} <ide> ], <ide> <ide> "They've": [ <del> {ORTH: "They", LEMMA: PRON_LEMMA}, <add> {ORTH: "They", LEMMA: PRON_LEMMA, TAG: "PRP"}, <ide> {ORTH: "'ve", LEMMA: "have", TAG: "VB"} <ide> ], <ide> <ide> ], <ide> <ide> "She'll": [ <del> {ORTH: "i", LEMMA: PRON_LEMMA}, <add> {ORTH: "She", LEMMA: PRON_LEMMA, TAG: "PRP"}, <ide> {ORTH: "'ll", LEMMA: "will", TAG: "MD"} <ide> ], <ide> <ide> "You'd": [ <del> {ORTH: "You", LEMMA: PRON_LEMMA}, <add> {ORTH: "You", LEMMA: PRON_LEMMA, TAG: "PRP"}, <ide> {ORTH: "'d", LEMMA: "would", TAG: "MD"} <ide> ], <ide> <ide> ], <ide> <ide> "Theyre": [ <del> {ORTH: "They", LEMMA: PRON_LEMMA}, <del> {ORTH: "re"} <add> {ORTH: "They", LEMMA: PRON_LEMMA, TAG: "PRP"}, <add> {ORTH: "re", LEMMA: "be", NORM: "are"} <ide> ], <ide> <ide> "Won't": [ <ide> ], <ide> <ide> "it's": [ <del> {ORTH: "it", LEMMA: PRON_LEMMA}, <add> {ORTH: "it", LEMMA: PRON_LEMMA, TAG: "PRP"}, <ide> {ORTH: "'s"} <ide> ], <ide> <ide> "it'll": [ <del> {ORTH: "it", LEMMA: PRON_LEMMA}, <add> {ORTH: "it", LEMMA: PRON_LEMMA, TAG: "PRP"}, <ide> {ORTH: "'ll", LEMMA: "will", TAG: "MD"} <ide> ], <ide> <ide> "They'd've": [ <del> {ORTH: "They", LEMMA: PRON_LEMMA}, <add> {ORTH: "They", LEMMA: PRON_LEMMA, TAG: "PRP"}, <ide> {ORTH: "'d", LEMMA: "would", TAG: "MD"}, <ide> {ORTH: "'ve", LEMMA: "have", TAG: "VB"} <ide> ], <ide> <ide> "Ima": [ <del> {ORTH: "I", LEMMA: PRON_LEMMA}, <add> {ORTH: "I", LEMMA: PRON_LEMMA, TAG: "PRP"}, <ide> {ORTH: "ma"} <ide> ], <ide> <ide> "gonna": [ <del> {ORTH: "gon", LEMMA: "go"}, <add> {ORTH: "gon", LEMMA: "go", NORM: "going"}, <ide> {ORTH: "na", LEMMA: "to"} <ide> ], <ide> <ide> "Gonna": [ <del> {ORTH: "Gon", LEMMA: "go"}, <add> {ORTH: "Gon", LEMMA: "go", NORM: "going"}, <ide> {ORTH: "na", LEMMA: "to"} <ide> ], <ide> <ide> ], <ide> <ide> "youd": [ <del> {ORTH: "you", LEMMA: PRON_LEMMA}, <add> {ORTH: "you", LEMMA: PRON_LEMMA, TAG: "PRP"}, <ide> {ORTH: "d", LEMMA: "would", TAG: "MD"} <ide> ], <ide> <ide> ], <ide> <ide> "He'd've": [ <del> {ORTH: "He", LEMMA: PRON_LEMMA}, <add> {ORTH: "He", LEMMA: PRON_LEMMA, TAG: "PRP"}, <ide> {ORTH: "'d", LEMMA: "would", TAG: "MD"}, <ide> {ORTH: "'ve", LEMMA: "have", TAG: "VB"} <ide> ], <ide> ], <ide> <ide> "hes": [ <del> {ORTH: "he", LEMMA: PRON_LEMMA}, <add> {ORTH: "he", LEMMA: PRON_LEMMA, TAG: "PRP"}, <ide> {ORTH: "s"} <ide> ], <ide> <ide> "he'll": [ <del> {ORTH: "he", LEMMA: PRON_LEMMA}, <add> {ORTH: "he", LEMMA: PRON_LEMMA, TAG: "PRP"}, <ide> {ORTH: "'ll", LEMMA: "will", TAG: "MD"} <ide> ], <ide> <ide> "hed": [ <del> {ORTH: "he", LEMMA: PRON_LEMMA}, <add> {ORTH: "he", LEMMA: PRON_LEMMA, TAG: "PRP"}, <ide> {ORTH: "d", LEMMA: "would", TAG: "MD"} <ide> ], <ide> <ide> ], <ide> <ide> "we're": [ <del> {ORTH: "we", LEMMA: PRON_LEMMA}, <del> {ORTH: "'re", LEMMA: "be"} <add> {ORTH: "we", LEMMA: PRON_LEMMA, TAG: "PRP"}, <add> {ORTH: "'re", LEMMA: "be", NORM :"are"} <ide> ], <ide> <ide> "Hadnt": [ <ide> ], <ide> <ide> "Shant": [ <del> {ORTH: "Sha"}, <add> {ORTH: "Sha", LEMMA: "shall"}, <ide> {ORTH: "nt", LEMMA: "not", TAG: "RB"} <ide> ], <ide> <ide> "Theyve": [ <del> {ORTH: "They", LEMMA: PRON_LEMMA}, <add> {ORTH: "They", LEMMA: PRON_LEMMA, TAG: "PRP"}, <ide> {ORTH: "ve", LEMMA: "have", TAG: "VB"} <ide> ], <ide> <ide> ], <ide> <ide> "i've": [ <del> {ORTH: "i", LEMMA: PRON_LEMMA}, <add> {ORTH: "i", LEMMA: PRON_LEMMA, TAG: "PRP"}, <ide> {ORTH: "'ve", LEMMA: "have", TAG: "VB"} <ide> ], <ide> <ide> ], <ide> <ide> "i'ma": [ <del> {ORTH: "i", LEMMA: PRON_LEMMA}, <add> {ORTH: "i", LEMMA: PRON_LEMMA, TAG: "PRP"}, <ide> {ORTH: "'ma"} <ide> ], <ide> <ide> ], <ide> <ide> "shant": [ <del> {ORTH: "sha"}, <add> {ORTH: "sha", LEMMA: "shall"}, <ide> {ORTH: "nt", LEMMA: "not", TAG: "RB"} <ide> ], <ide> <ide> ], <ide> <ide> "I'll": [ <del> {ORTH: "I", LEMMA: PRON_LEMMA}, <add> {ORTH: "I", LEMMA: PRON_LEMMA, TAG: "PRP"}, <ide> {ORTH: "'ll", LEMMA: "will", TAG: "MD"} <ide> ], <ide> <ide> ], <ide> <ide> "shes": [ <del> {ORTH: "she", LEMMA: PRON_LEMMA}, <add> {ORTH: "she", LEMMA: PRON_LEMMA, TAG: "PRP"}, <ide> {ORTH: "s"} <ide> ], <ide> <ide> ], <ide> <ide> "Hasnt": [ <del> {ORTH: "Has"}, <add> {ORTH: "Has", LEMMA: "have"}, <ide> {ORTH: "nt", LEMMA: "not", TAG: "RB"} <ide> ], <ide> <ide> "He's": [ <del> {ORTH: "He", LEMMA: PRON_LEMMA}, <add> {ORTH: "He", LEMMA: PRON_LEMMA, TAG: "PRP"}, <ide> {ORTH: "'s"} <ide> ], <ide> <ide> ], <ide> <ide> "He'd": [ <del> {ORTH: "He", LEMMA: PRON_LEMMA}, <add> {ORTH: "He", LEMMA: PRON_LEMMA, TAG: "PRP"}, <ide> {ORTH: "'d", LEMMA: "would", TAG: "MD"} <ide> ], <ide> <ide> "Shes": [ <del> {ORTH: "i", LEMMA: PRON_LEMMA}, <add> {ORTH: "She", LEMMA: PRON_LEMMA, TAG: "PRP"}, <ide> {ORTH: "s"} <ide> ], <ide> <ide> ], <ide> <ide> "Youll": [ <del> {ORTH: "You", LEMMA: PRON_LEMMA}, <add> {ORTH: "You", LEMMA: PRON_LEMMA, TAG: "PRP"}, <ide> {ORTH: "ll", LEMMA: "will", TAG: "MD"} <ide> ], <ide> <ide> ], <ide> <ide> "theyll": [ <del> {ORTH: "they", LEMMA: PRON_LEMMA}, <add> {ORTH: "they", LEMMA: PRON_LEMMA, TAG: "PRP"}, <ide> {ORTH: "ll", LEMMA: "will", TAG: "MD"} <ide> ], <ide> <ide> "it'd've": [ <del> {ORTH: "it", LEMMA: PRON_LEMMA}, <add> {ORTH: "it", LEMMA: PRON_LEMMA, TAG: "PRP"}, <ide> {ORTH: "'d", LEMMA: "would", TAG: "MD"}, <ide> {ORTH: "'ve", LEMMA: "have", TAG: "VB"} <ide> ], <ide> <ide> "itdve": [ <del> {ORTH: "it", LEMMA: PRON_LEMMA}, <add> {ORTH: "it", LEMMA: PRON_LEMMA, TAG: "PRP"}, <ide> {ORTH: "d", LEMMA: "would", TAG: "MD"}, <ide> {ORTH: "ve", LEMMA: "have", TAG: "VB"} <ide> ], <ide> ], <ide> <ide> "Wont": [ <del> {ORTH: "Wo"}, <add> {ORTH: "Wo", LEMMA: "will"}, <ide> {ORTH: "nt", LEMMA: "not", TAG: "RB"} <ide> ], <ide> <ide> <ide> "Whatre": [ <ide> {ORTH: "What"}, <del> {ORTH: "re"} <add> {ORTH: "re", LEMMA: "be", NORM: "are"} <ide> ], <ide> <ide> "'s": [ <ide> ], <ide> <ide> "It'll": [ <del> {ORTH: "It", LEMMA: PRON_LEMMA}, <add> {ORTH: "It", LEMMA: PRON_LEMMA, TAG: "PRP"}, <ide> {ORTH: "'ll", LEMMA: "will", TAG: "MD"} <ide> ], <ide> <ide> "We'd": [ <del> {ORTH: "We"}, <add> {ORTH: "We", LEMMA: PRON_LEMMA, TAG: "PRP"}, <ide> {ORTH: "'d", LEMMA: "would", TAG: "MD"} <ide> ], <ide> <ide> ], <ide> <ide> "Itd": [ <del> {ORTH: "It", LEMMA: PRON_LEMMA}, <add> {ORTH: "It", LEMMA: PRON_LEMMA, TAG: "PRP"}, <ide> {ORTH: "d", LEMMA: "would", TAG: "MD"} <ide> ], <ide> <ide> "she'd": [ <del> {ORTH: "she", LEMMA: PRON_LEMMA}, <add> {ORTH: "she", LEMMA: PRON_LEMMA, TAG: "PRP"}, <ide> {ORTH: "'d", LEMMA: "would", TAG: "MD"} <ide> ], <ide> <ide> ], <ide> <ide> "you'll": [ <del> {ORTH: "you", LEMMA: PRON_LEMMA}, <add> {ORTH: "you", LEMMA: PRON_LEMMA, TAG: "PRP"}, <ide> {ORTH: "'ll", LEMMA: "will", TAG: "MD"} <ide> ], <ide> <ide> "Theyd": [ <del> {ORTH: "They", LEMMA: PRON_LEMMA}, <add> {ORTH: "They", LEMMA: PRON_LEMMA, TAG: "PRP"}, <ide> {ORTH: "d", LEMMA: "would", TAG: "MD"} <ide> ], <ide> <ide> "she's": [ <del> {ORTH: "she", LEMMA: PRON_LEMMA}, <add> {ORTH: "she", LEMMA: PRON_LEMMA, TAG: "PRP"}, <ide> {ORTH: "'s"} <ide> ], <ide> <ide> ], <ide> <ide> "'em": [ <del> {ORTH: "'em", LEMMA: PRON_LEMMA} <add> {ORTH: "'em", LEMMA: PRON_LEMMA, NORM: "them"} <ide> ], <ide> <ide> "ol'": [
1
Text
Text
add a variable declaration in the buffer.md
39ed512d8a9c7c3f2e5a63155fb4ab282f6497b5
<ide><path>doc/api/buffer.md <ide> The transcoding process will use substitution characters if a given byte <ide> sequence cannot be adequately represented in the target encoding. For instance: <ide> <ide> ```js <add>const buffer = require('buffer'); <add> <ide> const newBuf = buffer.transcode(Buffer.from('€'), 'utf8', 'ascii'); <ide> console.log(newBuf.toString('ascii')); <ide> // Prints: '?'
1
Ruby
Ruby
fix exception when installing with --use-llvm
154d0fa92d982bc485acb0922ec646caf87f0445
<ide><path>Library/Homebrew/extend/ENV.rb <ide> def setup_build_environment <ide> if MACOS_VERSION >= 10.6 and (ENV['HOMEBREW_USE_LLVM'] or ARGV.include? '--use-llvm') <ide> # you can install Xcode wherever you like you know. <ide> xcode_path = `/usr/bin/xcode-select -print-path`.chomp <del> xcode_path = "/Developer" if xcode_prefix.to_s.empty? <add> xcode_path = "/Developer" if xcode_path.to_s.empty? <ide> <ide> ENV['CC'] = "#{xcode_path}/usr/bin/llvm-gcc" <ide> ENV['CXX'] = "#{xcode_path}/usr/bin/llvm-g++"
1
PHP
PHP
add cascadecallback option to associations
2b99452dbce0a06c623b4aa2e8d113c7e2adfc12
<ide><path>Cake/ORM/Association.php <ide> abstract class Association { <ide> */ <ide> protected $_dependent = false; <ide> <add>/** <add> * Whether or not cascaded deletes should also fire callbacks. <add> * <add> * @var string <add> */ <add> protected $_cascadeCallbacks = false; <add> <ide> /** <ide> * Source table instance <ide> * <ide> public function __construct($name, array $options = []) { <ide> 'foreignKey', <ide> 'conditions', <ide> 'dependent', <add> 'cascadeCallbacks', <ide> 'sourceTable', <ide> 'targetTable', <ide> 'joinType', <ide><path>Cake/ORM/Association/BelongsToMany.php <ide> public function cascadeDelete(Entity $entity, $options = []) { <ide> $conditions = array_merge($conditions, $this->conditions()); <ide> <ide> $table = $this->pivot(); <del> return $table->deleteAll($conditions); <add> if ($this->_cascadeCallbacks) { <add> foreach ($table->find('all')->where($conditions) as $related) { <add> $table->delete($related, $options); <add> } <add> } else { <add> return $table->deleteAll($conditions); <add> } <ide> } <ide> <ide> /** <ide><path>Cake/ORM/Association/DependentDeleteTrait.php <ide> public function cascadeDelete(Entity $entity, $options = []) { <ide> // TODO fix multi-column primary keys. <ide> $conditions = array_merge($conditions, $this->conditions()); <ide> <del> $query = $table->find('all')->where($conditions); <del> foreach ($query as $related) { <del> $table->delete($related, $options); <add> if ($this->_cascadeCallbacks) { <add> foreach ($table->find('all')->where($conditions) as $related) { <add> $table->delete($related, $options); <add> } <add> } else { <add> $table->deleteAll($conditions); <ide> } <ide> return true; <ide> } <ide><path>Cake/ORM/Table.php <ide> public function belongsTo($associated, array $options = []) { <ide> * - foreignKey: The name of the field to use as foreign key, if false none <ide> * will be used <ide> * - dependent: Set to true if you want CakePHP to cascade deletes to the <del> * associated table when an entity is removed on this table. <add> * associated table when an entity is removed on this table. Set to false <add> * if you don't want CakePHP to remove associated data, for when you are using <add> * database constraints. <add> * - cascadeCallbacks: Set to true if you want CakePHP to fire callbacks on <add> * cascaded deletes. If false the ORM will use deleteAll() to remove data. <add> * When true records will be loaded and then deleted. <ide> * - conditions: array with a list of conditions to filter the join with <ide> * - joinType: The type of join to be used (e.g. LEFT) <ide> * <ide> public function hasOne($associated, array $options = []) { <ide> * - foreignKey: The name of the field to use as foreign key, if false none <ide> * will be used <ide> * - dependent: Set to true if you want CakePHP to cascade deletes to the <del> * associated table when an entity is removed on this table. <add> * associated table when an entity is removed on this table. Set to false <add> * if you don't want CakePHP to remove associated data, for when you are using <add> * database constraints. <add> * - cascadeCallbacks: Set to true if you want CakePHP to fire callbacks on <add> * cascaded deletes. If false the ORM will use deleteAll() to remove data. <add> * When true records will be loaded and then deleted. <ide> * - conditions: array with a list of conditions to filter the join with <ide> * - sort: The order in which results for this association should be returned <ide> * - strategy: The strategy to be used for selecting results Either 'select' <ide> public function hasMany($associated, array $options = []) { <ide> * - through: If you choose to use an already instantiated link table, set this <ide> * key to a configured Table instance containing associations to both the source <ide> * and target tables in this association. <add> * - cascadeCallbacks: Set to true if you want CakePHP to fire callbacks on <add> * cascaded deletes. If false the ORM will use deleteAll() to remove data. <add> * When true pivot table records will be loaded and then deleted. <ide> * - conditions: array with a list of conditions to filter the join with <ide> * - sort: The order in which results for this association should be returned <ide> * - strategy: The strategy to be used for selecting results Either 'select' <ide> protected function _update($entity, $data) { <ide> * Delete a single entity. <ide> * <ide> * Deletes an entity and possibly related associations from the database <del> * based on the 'cascade' option. When true, the cascade option will cause <del> * any associations marked as dependent to be removed. Any <del> * rows in a BelongsToMany join table will be removed as well. <add> * based on the 'dependent' option used when defining the association. <add> * For HasMany and HasOne associations records will be removed based on <add> * the dependent option. Join table records in BelongsToMany associations <add> * will always be removed. You can use the `cascadeCallbacks` option <add> * when defining associations to change how associated data is deleted. <ide> * <ide> * ## Options <ide> * <del> * - `cascade` Defaults to true. Set to false to disable cascaded deletes. <del> * Use this when you don't want to cascade or when your foreign keys <del> * will handle the cascading delete for you. Cascaded deletes <del> * will occur inside the transaction when atomic is true. <ide> * - `atomic` Defaults to true. When true the deletion happens within a transaction. <ide> * <ide> * ## Events <ide> protected function _update($entity, $data) { <ide> * @return boolean success <ide> */ <ide> public function delete(Entity $entity, array $options = []) { <del> $options = new \ArrayObject($options + ['atomic' => true, 'cascade' => true]); <add> $options = new \ArrayObject($options + ['atomic' => true]); <ide> <ide> $process = function() use ($entity, $options) { <ide> return $this->_processDelete($entity, $options); <ide> public function delete(Entity $entity, array $options = []) { <ide> * Will delete the entity provided. Will remove rows from any <ide> * dependent associations, and clear out join tables for BelongsToMany associations. <ide> * <del> * Setting $options['cascade'] = false will prevent associated data including <del> * join tables from being cleared. <del> * <ide> * @param Entity $entity The entity to delete. <ide> * @param ArrayObject $options The options for the delete. <ide> * @return boolean success <ide> protected function _processDelete($entity, $options) { <ide> ->executeStatement(); <ide> <ide> $success = $statement->rowCount() > 0; <del> <del> if (!$success || !$options['cascade']) { <add> if (!$success) { <ide> return $success; <ide> } <ide> <ide><path>Cake/Test/TestCase/ORM/Association/BelongsToManyTest.php <ide> public function testCascadeDelete() { <ide> $association->cascadeDelete($entity); <ide> } <ide> <add>/** <add> * Test cascading deletes with callbacks. <add> * <add> * @return void <add> */ <add> public function testCascadeDeleteWithCallbacks() { <add> $articleTag = $this->getMock('Cake\ORM\Table', ['find', 'delete'], [], '', false); <add> $config = [ <add> 'sourceTable' => $this->article, <add> 'targetTable' => $this->tag, <add> 'conditions' => ['Tag.name' => 'foo'], <add> 'cascadeCallbacks' => true, <add> ]; <add> $association = new BelongsToMany('Tag', $config); <add> $association->pivot($articleTag); <add> <add> $articleTagOne = new Entity(['article_id' => 1, 'tag_id' => 2]); <add> $articleTagTwo = new Entity(['article_id' => 1, 'tag_id' => 4]); <add> $iterator = new \ArrayIterator([ <add> $articleTagOne, <add> $articleTagTwo <add> ]); <add> <add> $query = $this->getMock('\Cake\ORM\Query', [], [], '', false); <add> $query->expects($this->once()) <add> ->method('where') <add> ->with(['Tag.name' => 'foo', 'article_id' => 1]) <add> ->will($this->returnSelf()); <add> <add> $query->expects($this->any()) <add> ->method('getIterator') <add> ->will($this->returnValue($iterator)); <add> <add> $articleTag->expects($this->once()) <add> ->method('find') <add> ->will($this->returnValue($query)); <add> <add> $articleTag->expects($this->at(1)) <add> ->method('delete') <add> ->with($articleTagOne, []); <add> $articleTag->expects($this->at(2)) <add> ->method('delete') <add> ->with($articleTagTwo, []); <add> <add> $articleTag->expects($this->never()) <add> ->method('deleteAll'); <add> <add> $entity = new Entity(['id' => 1, 'name' => 'PHP']); <add> $association->cascadeDelete($entity); <add> } <add> <ide> } <ide><path>Cake/Test/TestCase/ORM/Association/HasManyTest.php <ide> public function setUp() { <ide> ] <ide> ]); <ide> $this->article = $this->getMock( <del> 'Cake\ORM\Table', ['find', 'delete'], [['alias' => 'Article', 'table' => 'articles']] <add> 'Cake\ORM\Table', ['find', 'deleteAll', 'delete'], [['alias' => 'Article', 'table' => 'articles']] <ide> ); <ide> $this->article->schema([ <ide> 'id' => ['type' => 'integer'], <ide> public function testAttachToNoFields() { <ide> } <ide> <ide> /** <del> * Test cascading delete with has many. <add> * Test cascading deletes. <ide> * <ide> * @return void <ide> */ <ide> public function testCascadeDelete() { <ide> 'dependent' => true, <ide> 'sourceTable' => $this->author, <ide> 'targetTable' => $this->article, <del> 'conditions' => ['Article.is_active' => true] <add> 'conditions' => ['Article.is_active' => true], <add> ]; <add> $association = new HasMany('Article', $config); <add> <add> $this->article->expects($this->once()) <add> ->method('deleteAll') <add> ->with([ <add> 'Article.is_active' => true, <add> 'author_id' => 1 <add> ]); <add> <add> $entity = new Entity(['id' => 1, 'name' => 'PHP']); <add> $association->cascadeDelete($entity); <add> } <add> <add>/** <add> * Test cascading delete with has many. <add> * <add> * @return void <add> */ <add> public function testCascadeDeleteCallbacks() { <add> $config = [ <add> 'dependent' => true, <add> 'sourceTable' => $this->author, <add> 'targetTable' => $this->article, <add> 'conditions' => ['Article.is_active' => true], <add> 'cascadeCallbacks' => true, <ide> ]; <ide> $association = new HasMany('Article', $config); <ide> <ide><path>Cake/Test/TestCase/ORM/TableTest.php <ide> public function testDeleteDependent() { <ide> } <ide> <ide> /** <del> * Test delete with dependent records and cascade = false <add> * Test delete with dependent = false does not cascade. <ide> * <ide> * @return void <ide> */ <del> public function testDeleteDependentCascadeFalse() { <add> public function testDeleteNoDependentNoCascade() { <ide> $table = TableRegistry::get('author'); <del> $table->hasOne('article', [ <add> $table->hasMany('article', [ <ide> 'foreignKey' => 'author_id', <del> 'dependent' => true, <add> 'dependent' => false, <ide> ]); <ide> <ide> $query = $table->find('all')->where(['id' => 1]); <ide> $entity = $query->first(); <del> $result = $table->delete($entity, ['cascade' => false]); <add> $result = $table->delete($entity); <ide> <ide> $articles = $table->association('article')->target(); <ide> $query = $articles->find('all')->where(['author_id' => $entity->id]); <ide> public function testDeleteBelongsToMany() { <ide> $this->assertNull($query->execute()->one(), 'Should not find any rows.'); <ide> } <ide> <del>/** <del> * Test delete with belongsToMany and cascade = false <del> * <del> * @return void <del> */ <del> public function testDeleteCascadeFalseBelongsToMany() { <del> $table = TableRegistry::get('article'); <del> $table->belongsToMany('tag', [ <del> 'foreignKey' => 'article_id', <del> 'joinTable' => 'articles_tags' <del> ]); <del> $query = $table->find('all')->where(['id' => 1]); <del> $entity = $query->first(); <del> $table->delete($entity, ['cascade' => false]); <del> <del> $pivot = $table->association('tag')->pivot(); <del> $query = $pivot->find('all')->where(['article_id' => 1]); <del> $this->assertCount(2, $query->execute(), 'Should find rows.'); <del> } <del> <ide> /** <ide> * Test delete callbacks <ide> * <ide> * @return void <ide> */ <ide> public function testDeleteCallbacks() { <ide> $entity = new \Cake\ORM\Entity(['id' => 1, 'name' => 'mark']); <del> $options = new \ArrayObject(['atomic' => true, 'cascade' => true]); <add> $options = new \ArrayObject(['atomic' => true]); <ide> <ide> $mock = $this->getMock('Cake\Event\EventManager'); <ide> $mock->expects($this->at(0))
7
PHP
PHP
fix arrayaccess implemention in request class
8f150dc51a5e356f722ebdb66a090d6c4ffddd23
<ide><path>src/Network/Request.php <ide> public function offsetSet($name, $value) <ide> */ <ide> public function offsetExists($name) <ide> { <add> if ($name === 'url' || $name === 'data') { <add> return true; <add> } <ide> return isset($this->params[$name]); <ide> } <ide>
1
Javascript
Javascript
send 400 bad request on parse error
f2f391e575fc8072d10e1ad1601ef3f67f13a4db
<ide><path>lib/_http_server.js <ide> const { <ide> const { OutgoingMessage } = require('_http_outgoing'); <ide> const { outHeadersKey, ondrain } = require('internal/http'); <ide> const errors = require('internal/errors'); <add>const Buffer = require('buffer').Buffer; <ide> <ide> const STATUS_CODES = { <ide> 100: 'Continue', <ide> function onParserExecute(server, socket, parser, state, ret, d) { <ide> onParserExecuteCommon(server, socket, parser, state, ret, undefined); <ide> } <ide> <add>const badRequestResponse = Buffer.from( <add> 'HTTP/1.1 400 ' + STATUS_CODES[400] + CRLF + CRLF, 'ascii' <add>); <ide> function socketOnError(e) { <ide> // Ignore further errors <ide> this.removeListener('error', socketOnError); <ide> this.on('error', () => {}); <ide> <del> if (!this.server.emit('clientError', e, this)) <add> if (!this.server.emit('clientError', e, this)) { <add> if (this.writable) { <add> this.end(badRequestResponse); <add> return; <add> } <ide> this.destroy(e); <add> } <ide> } <ide> <ide> function onParserExecuteCommon(server, socket, parser, state, ret, d) { <ide><path>test/parallel/test-http-blank-header.js <ide> const server = http.createServer(common.mustCall((req, res) => { <ide> <ide> server.listen(0, common.mustCall(() => { <ide> const c = net.createConnection(server.address().port); <add> let received = ''; <ide> <ide> c.on('connect', common.mustCall(() => { <ide> c.write('GET /blah HTTP/1.1\r\n' + <ide> server.listen(0, common.mustCall(() => { <ide> '\r\n\r\nhello world' <ide> ); <ide> })); <del> <del> c.on('end', common.mustCall(() => c.end())); <add> c.on('data', common.mustCall((data) => { <add> received += data.toString(); <add> })); <add> c.on('end', common.mustCall(() => { <add> assert.strictEqual('HTTP/1.1 400 Bad Request\r\n\r\n', received); <add> c.end(); <add> })); <ide> c.on('close', common.mustCall(() => server.close())); <ide> }));
2
Javascript
Javascript
avoid bugs with native date class
39d9476992420bac12751b48d592c79caa9ac8d1
<add><path>examples/blog-starter/components/date-formater.js <del><path>examples/blog-starter/components/date.js <ide> import { parseISO, format } from 'date-fns' <ide> <del>export default function Date({ dateString }) { <add>export default function DateFormater({ dateString }) { <ide> const date = parseISO(dateString) <ide> return <time dateTime={dateString}>{format(date, 'LLLL d, yyyy')}</time> <ide> } <ide><path>examples/blog-starter/components/hero-post.js <ide> import Avatar from '../components/avatar' <del>import Date from '../components/date' <add>import DateFormater from '../components/date-formater' <ide> import CoverImage from '../components/cover-image' <ide> import Link from 'next/link' <ide> <ide> export default function HeroPost({ <ide> </Link> <ide> </h3> <ide> <div className="mb-4 md:mb-0 text-lg"> <del> <Date dateString={date} /> <add> <DateFormater dateString={date} /> <ide> </div> <ide> </div> <ide> <div> <ide><path>examples/blog-starter/components/post-header.js <ide> import Avatar from '../components/avatar' <del>import Date from '../components/date' <add>import DateFormater from '../components/date-formater' <ide> import CoverImage from '../components/cover-image' <ide> import PostTitle from '../components/post-title' <ide> <ide> export default function PostHeader({ title, coverImage, date, author }) { <ide> <Avatar name={author.name} picture={author.picture} /> <ide> </div> <ide> <div className="mb-6 text-lg"> <del> <Date dateString={date} /> <add> <DateFormater dateString={date} /> <ide> </div> <ide> </div> <ide> </> <ide><path>examples/blog-starter/components/post-preview.js <ide> import Avatar from '../components/avatar' <del>import Date from '../components/date' <add>import DateFormater from '../components/date-formater' <ide> import CoverImage from './cover-image' <ide> import Link from 'next/link' <ide> <ide> export default function PostPreview({ <ide> </Link> <ide> </h3> <ide> <div className="text-lg mb-4"> <del> <Date dateString={date} /> <add> <DateFormater dateString={date} /> <ide> </div> <ide> <p className="text-lg leading-relaxed mb-4">{excerpt}</p> <ide> <Avatar name={author.name} picture={author.picture} />
4
Python
Python
handle torch_dtype in low cpu mem usage
21decb7731e998d3d208ec33e5b249b0a84c0a02
<ide><path>src/transformers/modeling_utils.py <ide> def find_submodule_and_param_name(model, long_key): <ide> for k in loaded_state_dict_keys: <ide> submodule, param_name = find_submodule_and_param_name(model, k) <ide> if submodule is not None: <del> new_val = state_dict[k] <add> param_dtype = getattr(submodule, param_name).dtype <add> new_val = state_dict[k].to(param_dtype) <ide> if isinstance(getattr(submodule, param_name), torch.nn.Parameter): <ide> new_val = torch.nn.Parameter(new_val) <ide> setattr(submodule, param_name, new_val)
1
PHP
PHP
add getter for view instance
7e730731b6a6282333ebd32cf697122726567234
<ide><path>src/View/Helper.php <ide> public function __get($name) <ide> } <ide> } <ide> <add> /** <add> * Get the view instance this helper is bound to. <add> * <add> * @return \Cake\View\View The bound view instance. <add> */ <add> public function getView() <add> { <add> return $this->_View; <add> } <add> <ide> /** <ide> * Returns a string to be used as onclick handler for confirm dialogs. <ide> * <ide><path>tests/TestCase/View/HelperTest.php <ide> public function testLazyLoadingUsesReferences() <ide> $this->assertEquals($resultA->testprop, $resultB->testprop); <ide> } <ide> <add> /** <add> * test getting view instance <add> * <add> * @return void <add> */ <add> public function testGetView() <add> { <add> $Helper = new TestHelper($this->View); <add> $this->assertSame($this->View, $Helper->getView()); <add> } <add> <ide> /** <ide> * Tests __debugInfo <ide> *
2
Python
Python
fix documentation errors
c099e0a2b576ddd56ac528b0b09467339badd538
<ide><path>airflow/operators/python.py <ide> def get_current_context() -> Dict[str, Any]: <ide> Obtain the execution context for the currently executing operator without <ide> altering user method's signature. <ide> This is the simplest method of retrieving the execution context dictionary. <del> ** Old style: <add> <add> **Old style:** <add> <add> .. code:: python <add> <ide> def my_task(**context): <ide> ti = context["ti"] <del> ** New style: <add> <add> **New style:** <add> <add> .. code:: python <add> <ide> from airflow.task.context import get_current_context <ide> def my_task(): <ide> context = get_current_context() <ide><path>airflow/secrets/local_filesystem.py <ide> def get_connection_parameter_names() -> Set[str]: <ide> <ide> def _parse_env_file(file_path: str) -> Tuple[Dict[str, List[str]], List[FileSyntaxError]]: <ide> """ <del> Parse a file in the ``.env '' format. <add> Parse a file in the ``.env`` format. <ide> <ide> .. code-block:: text <ide>
2
PHP
PHP
create a composite index for morphing columns
9997b7ffb5a9b09914db2eca12118f84a70da24f
<ide><path>src/Illuminate/Database/Schema/Blueprint.php <ide> public function morphs($name) <ide> $this->unsignedInteger("{$name}_id"); <ide> <ide> $this->string("{$name}_type"); <add> <add> $this->index(array("{$name}_id", "{$name}_type")); <ide> } <ide> <ide> /**
1
Text
Text
add v3.16.8 to changelog.md
f879ca2209a48426437218af1f454d4e120375f0
<ide><path>CHANGELOG.md <ide> - [#18694](https://github.com/emberjs/ember.js/pull/18694) [BUGFIX] Ensure tag updates are buffered, remove error message <ide> - [#18709](https://github.com/emberjs/ember.js/pull/18709) [BUGFIX] Fix `this` in `@tracked` initializer <ide> <add>### v3.16.8 (April 24, 2020) <add> <add>- [#18879](https://github.com/emberjs/ember.js/pull/18879) Ensure errors thrown during component construction do not cause (unrelated) errors during application teardown (fixes a common issue when using `setupOnerror` with components asserting during `constructor`/`init`/`didInssertElement`). <add> <ide> ### v3.16.7 (April 13, 2020) <ide> <ide> - [#18854](https://github.com/emberjs/ember.js/pull/18854) Pass value through to `PROPERTY_DID_CHANGE` to avoid calling `get` when setting values for computed props
1
Javascript
Javascript
move custom method to loopback model extension
0452a9d1d556cb2b31f1427e00184b98198f5b3e
<ide><path>common/models/Access-Token.js <add>import { Observable } from 'rx'; <add> <add>module.exports = AccessToken => { <add> // wait for datasource to attach before adding methods <add> // prevents loopback from unnecessarily <add> // adding watchers on startup <add> AccessToken.on('dataSourceAttached', () => { <add> AccessToken.findOne$ = Observable.fromNodeCallback( <add> AccessToken.findOne.bind(AccessToken) <add> ); <add> }); <add>}; <ide><path>server/boot/user.js <ide> module.exports = function(app) { <ide> ); <ide> } <ide> <del> AccessToken.findOne$ = Observable.fromNodeCallback( <del> AccessToken.findOne, AccessToken <del> ); <del> <ide> router.get('/login', function(req, res) { <ide> res.redirect(301, '/signin'); <ide> });
2
Text
Text
fix typo in css-in-js page
4299cc169c6552ffd54d02155a2efc0ebd355f68
<ide><path>docs/basic-features/built-in-css-support.md <ide> $primary-color: #64FF00 <ide> <ide> ```js <ide> // pages/_app.js <del>import variables from '../styles/variables.module.css' <add>import variables from '../styles/variables.module.scss' <ide> <ide> export default function MyApp({ Component, pageProps }) { <ide> return (
1
Text
Text
clarify undocumented stream properties
7cfa1bee418696c1c97c1f2466520ab4f4cc8791
<ide><path>doc/api/stream.md <ide> object mode is not safe. <ide> <!--type=misc--> <ide> <ide> Both [`Writable`][] and [`Readable`][] streams will store data in an internal <del>buffer that can be retrieved using `writable.writableBuffer` or <del>`readable.readableBuffer`, respectively. <add>buffer. <ide> <ide> The amount of data potentially buffered depends on the `highWaterMark` option <ide> passed into the stream's constructor. For normal streams, the `highWaterMark` <ide> writing data *to* the socket. Because data may be written to the socket at a <ide> faster or slower rate than data is received, each side should <ide> operate (and buffer) independently of the other. <ide> <add>The mechanics of the internal buffering are an internal implementation detail <add>and may be changed at any time. However, for certain advanced implementations, <add>the internal buffers can be retrieved using `writable.writableBuffer` or <add>`readable.readableBuffer`. Use of these undocumented properties is discouraged. <add> <ide> ## API for stream consumers <ide> <ide> <!--type=misc-->
1
Javascript
Javascript
fix lint for eslint 1.7
b106e968648dc6980c159bf9c4954220415896df
<ide><path>src/renderers/shared/event/eventPlugins/ResponderTouchHistoryStore.js <ide> var MAX_TOUCH_BANK = 20; <ide> * } <ide> */ <ide> var touchHistory = { <del> touchBank: [ ], <add> touchBank: [], <ide> numberActiveTouches: 0, <ide> // If there is only one active touch, we remember its location. This prevents <ide> // us having to loop through all of the touches all the time in the most <ide><path>src/renderers/shared/reconciler/__tests__/ReactEmptyComponent-test.js <ide> describe('ReactEmptyComponent', function() { <ide> ); <ide> <ide> it('should have getDOMNode return null when multiple layers of composite ' + <del> 'components render to the same null placeholder', () => { <add> 'components render to the same null placeholder', <add> () => { <ide> spyOn(console, 'log'); <ide> <ide> var GrandChild = React.createClass({
2
Text
Text
add rubys to collaborators
f19fa7ca4deea517f66cb0ef8b5fd9574bb33a66
<ide><path>README.md <ide> For more information about the governance of the Node.js project, see <ide> **Ron Korving** &lt;ron@ronkorving.nl&gt; <ide> * [RReverser](https://github.com/RReverser) - <ide> **Ingvar Stepanyan** &lt;me@rreverser.com&gt; <add>* [rubys](https://github.com/rubys) - <add>**Sam Ruby** &lt;rubys@intertwingly.net&gt; <ide> * [rvagg](https://github.com/rvagg) - <ide> **Rod Vagg** &lt;rod@vagg.org&gt; <ide> * [ryzokuken](https://github.com/ryzokuken) -
1
Ruby
Ruby
use tempfile when writing schema cache
e10019ea60ea72a6d1f763df9acca49583ca2259
<ide><path>activerecord/lib/active_record/connection_adapters/schema_cache.rb <ide> # frozen_string_literal: true <ide> <add>require "active_support/core_ext/file/atomic" <add> <ide> module ActiveRecord <ide> module ConnectionAdapters <ide> class SchemaCache <ide> def clear_data_source_cache!(name) <ide> def dump_to(filename) <ide> clear! <ide> connection.data_sources.each { |table| add(table) } <del> open(filename, "wb") { |f| <add> File.atomic_write(filename) { |f| <ide> if filename.end_with?(".dump") <ide> f.write(Marshal.dump(self)) <ide> else
1
Python
Python
add flaubert types
a23a7c0cd6db89f68b4ce542c2c66cb2e8110070
<ide><path>src/transformers/models/flaubert/modeling_flaubert.py <ide> <ide> <ide> import random <add>from typing import Dict, Optional, Tuple, Union <ide> <ide> import torch <ide> from packaging import version <ide> def __init__(self, config): # , dico, is_encoder, with_output): <ide> ) <ide> def forward( <ide> self, <del> input_ids=None, <del> attention_mask=None, <del> langs=None, <del> token_type_ids=None, <del> position_ids=None, <del> lengths=None, <del> cache=None, <del> head_mask=None, <del> inputs_embeds=None, <del> output_attentions=None, <del> output_hidden_states=None, <del> return_dict=None, <del> ): <add> input_ids: Optional[torch.LongTensor] = None, <add> attention_mask: Optional[torch.FloatTensor] = None, <add> langs: Optional[torch.Tensor] = None, <add> token_type_ids: Optional[torch.LongTensor] = None, <add> position_ids: Optional[torch.LongTensor] = None, <add> lengths: Optional[torch.LongTensor] = None, <add> cache: Optional[Dict[str, torch.FloatTensor]] = None, <add> head_mask: Optional[torch.FloatTensor] = None, <add> inputs_embeds: Optional[torch.FloatTensor] = None, <add> output_attentions: Optional[bool] = None, <add> output_hidden_states: Optional[bool] = None, <add> return_dict: Optional[bool] = None, <add> ) -> Union[Tuple, BaseModelOutput]: <ide> output_attentions = output_attentions if output_attentions is not None else self.config.output_attentions <ide> output_hidden_states = ( <ide> output_hidden_states if output_hidden_states is not None else self.config.output_hidden_states <ide><path>src/transformers/models/flaubert/modeling_tf_flaubert.py <ide> import random <ide> import warnings <ide> from dataclasses import dataclass <del>from typing import Optional, Tuple <add>from typing import Dict, Optional, Tuple, Union <ide> <add>import numpy as np <ide> import tensorflow as tf <ide> <ide> from ...activations_tf import get_tf_activation <ide> def __init__(self, config, *inputs, **kwargs): <ide> ) <ide> def call( <ide> self, <del> input_ids=None, <del> attention_mask=None, <del> langs=None, <del> token_type_ids=None, <del> position_ids=None, <del> lengths=None, <del> cache=None, <del> head_mask=None, <del> inputs_embeds=None, <del> output_attentions=None, <del> output_hidden_states=None, <del> return_dict=None, <del> training=False, <add> input_ids: Optional[Union[np.ndarray, tf.Tensor]] = None, <add> attention_mask: Optional[Union[np.ndarray, tf.Tensor]] = None, <add> langs: Optional[Union[np.ndarray, tf.Tensor]] = None, <add> token_type_ids: Optional[Union[np.ndarray, tf.Tensor]] = None, <add> position_ids: Optional[Union[np.ndarray, tf.Tensor]] = None, <add> lengths: Optional[Union[np.ndarray, tf.Tensor]] = None, <add> cache: Optional[Dict[str, tf.Tensor]] = None, <add> head_mask: Optional[Union[np.ndarray, tf.Tensor]] = None, <add> inputs_embeds: Optional[tf.Tensor] = None, <add> output_attentions: Optional[bool] = None, <add> output_hidden_states: Optional[bool] = None, <add> return_dict: Optional[bool] = None, <add> training: Optional[bool] = False, <ide> **kwargs, <del> ): <add> ) -> Union[Tuple, TFBaseModelOutput]: <ide> inputs = input_processing( <ide> func=self.call, <ide> config=self.config, <ide> def set_input_embeddings(self, value): <ide> <ide> def call( <ide> self, <del> input_ids=None, <del> attention_mask=None, <del> langs=None, <del> token_type_ids=None, <del> position_ids=None, <del> lengths=None, <del> cache=None, <del> head_mask=None, <del> inputs_embeds=None, <del> output_attentions=None, <del> output_hidden_states=None, <del> return_dict=None, <del> training=False, <add> input_ids: Optional[Union[np.ndarray, tf.Tensor]] = None, <add> attention_mask: Optional[Union[np.ndarray, tf.Tensor]] = None, <add> langs: Optional[Union[np.ndarray, tf.Tensor]] = None, <add> token_type_ids: Optional[Union[np.ndarray, tf.Tensor]] = None, <add> position_ids: Optional[Union[np.ndarray, tf.Tensor]] = None, <add> lengths: Optional[Union[np.ndarray, tf.Tensor]] = None, <add> cache: Optional[Dict[str, tf.Tensor]] = None, <add> head_mask: Optional[Union[np.ndarray, tf.Tensor]] = None, <add> inputs_embeds: Optional[tf.Tensor] = None, <add> output_attentions: Optional[bool] = None, <add> output_hidden_states: Optional[bool] = None, <add> return_dict: Optional[bool] = None, <add> training: Optional[bool] = False, <ide> **kwargs, <del> ): <add> ) -> Union[Tuple, TFBaseModelOutput]: <ide> # removed: src_enc=None, src_len=None <ide> inputs = input_processing( <ide> func=self.call, <ide> def prepare_inputs_for_generation(self, inputs, **kwargs): <ide> ) <ide> def call( <ide> self, <del> input_ids=None, <del> attention_mask=None, <del> langs=None, <del> token_type_ids=None, <del> position_ids=None, <del> lengths=None, <del> cache=None, <del> head_mask=None, <del> inputs_embeds=None, <del> output_attentions=None, <del> output_hidden_states=None, <del> return_dict=None, <del> training=False, <add> input_ids: Optional[Union[np.ndarray, tf.Tensor]] = None, <add> attention_mask: Optional[Union[np.ndarray, tf.Tensor]] = None, <add> langs: Optional[Union[np.ndarray, tf.Tensor]] = None, <add> token_type_ids: Optional[Union[np.ndarray, tf.Tensor]] = None, <add> position_ids: Optional[Union[np.ndarray, tf.Tensor]] = None, <add> lengths: Optional[Union[np.ndarray, tf.Tensor]] = None, <add> cache: Optional[Dict[str, tf.Tensor]] = None, <add> head_mask: Optional[Union[np.ndarray, tf.Tensor]] = None, <add> inputs_embeds: Optional[tf.Tensor] = None, <add> output_attentions: Optional[bool] = None, <add> output_hidden_states: Optional[bool] = None, <add> return_dict: Optional[bool] = None, <add> training: Optional[bool] = False, <ide> **kwargs, <del> ): <add> ) -> Union[Tuple, TFFlaubertWithLMHeadModelOutput]: <ide> inputs = input_processing( <ide> func=self.call, <ide> config=self.config,
2
Text
Text
add notice about useglobal option in repl docs
6e47e133ab90045db8df611cf34a3f461f291327
<ide><path>doc/api/repl.md <ide> changes: <ide> REPL instances `terminal` value. <ide> * `useGlobal` {boolean} If `true`, specifies that the default evaluation <ide> function will use the JavaScript `global` as the context as opposed to <del> creating a new separate context for the REPL instance. Defaults to `false`. <add> creating a new separate context for the REPL instance. The node CLI REPL <add> sets this value to `true`. Defaults to `false`. <ide> * `ignoreUndefined` {boolean} If `true`, specifies that the default writer <ide> will not output the return value of a command if it evaluates to <ide> `undefined`. Defaults to `false`.
1
Javascript
Javascript
fix launchchrome for chromium on ubuntu
758111a7066e2e8745b3629e918d3941fa62e453
<ide><path>local-cli/server/util/launchChrome.js <ide> function getChromeAppName(): string { <ide> case 'linux': <ide> if (commandExistsUnixSync('google-chrome')) { <ide> return 'google-chrome'; <add> } else if (commandExistsUnixSync('chromium-browser')) { <add> return 'chromium-browser'; <ide> } else { <ide> return 'chromium'; <ide> }
1
Python
Python
fix merge issue
ff4c3d3613bed679dfd2be487a69df058a168848
<ide><path>glances/plugins/glances_help.py <ide> def generate_view_data(self): <ide> self.view_data['sort_network'] = msg_col2.format("b", _("Bytes or bits for network I/O")) <ide> self.view_data['sort_cpu'] = msg_col.format("c", _("Sort processes by CPU%")) <ide> self.view_data['show_hide_alert'] = msg_col2.format("l", _("Show/hide alert logs")) <del> <del> <del> self.view_data['show_mem'] = msg_col.format("m", _("Sort processes by MEM%")) <add> self.view_data['sort_mem'] = msg_col.format("m", _("Sort processes by MEM%")) <add> self.view_data['sort_user'] = msg_col.format("u", _("Sort processes by USER")) <ide> self.view_data['delete_warning_alerts'] = msg_col2.format("w", _("Delete warning alerts")) <ide> self.view_data['sort_proc'] = msg_col.format("p", _("Sort processes by name")) <ide> self.view_data['delete_warning_critical_alerts'] = msg_col2.format("x", _("Delete warning and critical alerts")) <ide> self.view_data['sort_io'] = msg_col.format("i", _("Sort processes by I/O rate")) <ide> self.view_data['percpu'] = msg_col2.format("1", _("Global CPU or per-CPU stats")) <del> self.view_data['sort_cpu_times'] = msg_col.format("t", _("Sort processes by CPU times")) <add> self.view_data['sort_cpu_times'] = msg_col.format("t", _("Sort processes by TIME")) <ide> self.view_data['show_hide_help'] = msg_col2.format("h", _("Show/hide this help screen")) <ide> self.view_data['show_hide_diskio'] = msg_col.format("d", _("Show/hide disk I/O stats")) <ide> self.view_data['view_network_io_combination'] = msg_col2.format("T", _("View network I/O as combination")) <ide> self.view_data['show_hide_filesystem'] = msg_col.format("f", _("Show/hide filesystem stats")) <del> self.view_data['view_cumulative_network'] = msg_col2.format("u", _("View cumulative network I/O")) <add> self.view_data['view_cumulative_network'] = msg_col2.format("U", _("View cumulative network I/O")) <ide> self.view_data['show_hide_network'] = msg_col.format("n", _("Show/hide network stats")) <ide> self.view_data['show_hide_filesytem_freespace'] = msg_col2.format("F", _("Show filesystem free space")) <ide> self.view_data['show_hide_sensors'] = msg_col.format("s", _("Show/hide sensors stats")) <ide> def generate_view_data(self): <ide> self.view_data['quit'] = msg_col2.format("q", _("Quit (Esc and Ctrl-C also work)")) <ide> self.view_data['enable_disable_top_extends_stats'] = msg_col.format("e", _("Enable/disable top extended stats")) <ide> self.view_data['enable_disable_short_processname'] = msg_col.format("/", _("Enable/disable short processes name")) <del> self.view_data['enable_disable_docker'] = msg_col.format("D", _("Enable/disable Docker stats")) <add> self.view_data['enable_disable_docker'] = msg_col2.format("D", _("Enable/disable Docker stats")) <add> self.view_data['enable_disable_quick_look'] = msg_col.format("3", _("Enable/disable quick look plugin")) <ide> self.view_data['edit_pattern_filter'] = '{0}: {1}'.format("ENTER", _("Edit the process filter pattern")) <ide> <ide> <ide> def msg_curse(self, args=None): <ide> ret.append(self.curse_new_line()) <ide> <ide> <del> ret.append(self.curse_add_line(self.view_data['show_mem'])) <add> ret.append(self.curse_add_line(self.view_data['sort_mem'])) <ide> ret.append(self.curse_add_line(self.view_data['delete_warning_alerts'])) <ide> ret.append(self.curse_new_line()) <del> ret.append(self.curse_add_line(self.view_data['sort_proc'])) <add> ret.append(self.curse_add_line(self.view_data['sort_user'])) <ide> ret.append(self.curse_add_line(self.view_data['delete_warning_critical_alerts'])) <ide> ret.append(self.curse_new_line()) <del> ret.append(self.curse_add_line(self.view_data['sort_io'])) <add> ret.append(self.curse_add_line(self.view_data['sort_proc'])) <ide> ret.append(self.curse_add_line(self.view_data['percpu'])) <ide> ret.append(self.curse_new_line()) <add> ret.append(self.curse_add_line(self.view_data['sort_io'])) <add> ret.append(self.curse_add_line(self.view_data['enable_disable_docker'])) <add> ret.append(self.curse_new_line()) <ide> ret.append(self.curse_add_line(self.view_data['sort_cpu_times'])) <del> ret.append(self.curse_add_line(self.view_data['show_hide_help'])) <add> ret.append(self.curse_add_line(self.view_data['view_network_io_combination'])) <ide> ret.append(self.curse_new_line()) <ide> ret.append(self.curse_add_line(self.view_data['show_hide_diskio'])) <del> ret.append(self.curse_add_line(self.view_data['view_network_io_combination'])) <add> ret.append(self.curse_add_line(self.view_data['view_cumulative_network'])) <ide> ret.append(self.curse_new_line()) <ide> ret.append(self.curse_add_line(self.view_data['show_hide_filesystem'])) <del> ret.append(self.curse_add_line(self.view_data['view_cumulative_network'])) <add> ret.append(self.curse_add_line(self.view_data['show_hide_filesytem_freespace'])) <ide> ret.append(self.curse_new_line()) <ide> ret.append(self.curse_add_line(self.view_data['show_hide_network'])) <del> ret.append(self.curse_add_line(self.view_data['show_hide_filesytem_freespace'])) <add> ret.append(self.curse_add_line(self.view_data['generate_graphs'])) <ide> ret.append(self.curse_new_line()) <ide> ret.append(self.curse_add_line(self.view_data['show_hide_sensors'])) <del> ret.append(self.curse_add_line(self.view_data['generate_graphs'])) <add> ret.append(self.curse_add_line(self.view_data['reset_history'])) <ide> ret.append(self.curse_new_line()) <ide> ret.append(self.curse_add_line(self.view_data['show_hide_left_sidebar'])) <del> ret.append(self.curse_add_line(self.view_data['reset_history'])) <add> ret.append(self.curse_add_line(self.view_data['show_hide_help'])) <ide> ret.append(self.curse_new_line()) <ide> ret.append(self.curse_add_line(self.view_data['enable_disable_process_stats'])) <ide> ret.append(self.curse_add_line(self.view_data['quit'])) <ide> ret.append(self.curse_new_line()) <add> ret.append(self.curse_add_line(self.view_data['enable_disable_quick_look'])) <add> ret.append(self.curse_new_line()) <ide> ret.append(self.curse_add_line(self.view_data['enable_disable_top_extends_stats'])) <ide> ret.append(self.curse_new_line()) <ide> ret.append(self.curse_add_line(self.view_data['enable_disable_short_processname'])) <ide> ret.append(self.curse_new_line()) <ide> <del> ret.append(self.curse_add_line(self.view_data['enable_disable_docker'])) <del> <del> ret.append(self.curse_new_line()) <ide> ret.append(self.curse_new_line()) <ide> <ide> ret.append(self.curse_add_line(self.view_data['edit_pattern_filter']))
1
PHP
PHP
skip hydrating associations when they are empty
703a6ddb8d5d64b412641bf09b0b1ff24b69795a
<ide><path>src/ORM/EagerLoader.php <ide> public function loadExternal($query, $statement) { <ide> ); <ide> $statement = new CallbackStatement($statement, $driver, $f); <ide> } <del> <ide> return $statement; <ide> } <ide> <ide> protected function _groupKeys($statement, $collectKeys) { <ide> $keys = []; <ide> while ($result = $statement->fetch('assoc')) { <ide> foreach ($collectKeys as $parts) { <add> // Missed joins will have null in the results. <add> if ($parts[2] && !isset($result[$parts[1][0]])) { <add> continue; <add> } <ide> if ($parts[2]) { <ide> $keys[$parts[0]][] = $result[$parts[1][0]]; <ide> continue; <ide><path>src/ORM/ResultSet.php <ide> protected function _groupResult($row) { <ide> $alias = $assoc['nestKey']; <ide> $instance = $assoc['instance']; <ide> <add> // Doing this before we're sure the root assoc has data is the problem. <ide> if (!isset($results[$alias])) { <ide> $results = $instance->defaultRowValue($results, $assoc['canBeJoined']); <ide> continue; <ide> protected function _groupResult($row) { <ide> <ide> $hasData = false; <ide> foreach ($results[$alias] as $v) { <del> if ($v !== null) { <add> if ($v !== null && $v !== []) { <ide> $hasData = true; <ide> break; <ide> }
2
Go
Go
expand graphtest package
8b0441d42cca4f89cf871c1b64172cc06f9c98e6
<ide><path>daemon/graphdriver/graphtest/graphbench_unix.go <add>// +build linux freebsd <add> <add>package graphtest <add> <add>import ( <add> "bytes" <add> "io" <add> "io/ioutil" <add> "path/filepath" <add> "testing" <add> <add> "github.com/docker/docker/pkg/stringid" <add>) <add> <add>// DriverBenchExists benchmarks calls to exist <add>func DriverBenchExists(b *testing.B, drivername string, driveroptions ...string) { <add> driver := GetDriver(b, drivername, driveroptions...) <add> defer PutDriver(b) <add> <add> base := stringid.GenerateRandomID() <add> <add> if err := driver.Create(base, "", "", nil); err != nil { <add> b.Fatal(err) <add> } <add> <add> b.ResetTimer() <add> for i := 0; i < b.N; i++ { <add> if !driver.Exists(base) { <add> b.Fatal("Newly created image doesn't exist") <add> } <add> } <add>} <add> <add>// DriverBenchGetEmpty benchmarks calls to get on an empty layer <add>func DriverBenchGetEmpty(b *testing.B, drivername string, driveroptions ...string) { <add> driver := GetDriver(b, drivername, driveroptions...) <add> defer PutDriver(b) <add> <add> base := stringid.GenerateRandomID() <add> <add> if err := driver.Create(base, "", "", nil); err != nil { <add> b.Fatal(err) <add> } <add> <add> b.ResetTimer() <add> for i := 0; i < b.N; i++ { <add> _, err := driver.Get(base, "") <add> b.StopTimer() <add> if err != nil { <add> b.Fatalf("Error getting mount: %s", err) <add> } <add> if err := driver.Put(base); err != nil { <add> b.Fatalf("Error putting mount: %s", err) <add> } <add> b.StartTimer() <add> } <add>} <add> <add>// DriverBenchDiffBase benchmarks calls to diff on a root layer <add>func DriverBenchDiffBase(b *testing.B, drivername string, driveroptions ...string) { <add> driver := GetDriver(b, drivername, driveroptions...) <add> defer PutDriver(b) <add> <add> base := stringid.GenerateRandomID() <add> <add> if err := driver.Create(base, "", "", nil); err != nil { <add> b.Fatal(err) <add> } <add> <add> if err := addFiles(driver, base, 3); err != nil { <add> b.Fatal(err) <add> } <add> <add> b.ResetTimer() <add> for i := 0; i < b.N; i++ { <add> arch, err := driver.Diff(base, "") <add> if err != nil { <add> b.Fatal(err) <add> } <add> _, err = io.Copy(ioutil.Discard, arch) <add> if err != nil { <add> b.Fatalf("Error copying archive: %s", err) <add> } <add> arch.Close() <add> } <add>} <add> <add>// DriverBenchDiffN benchmarks calls to diff on two layers with <add>// a provided number of files on the lower and upper layers. <add>func DriverBenchDiffN(b *testing.B, bottom, top int, drivername string, driveroptions ...string) { <add> driver := GetDriver(b, drivername, driveroptions...) <add> defer PutDriver(b) <add> base := stringid.GenerateRandomID() <add> upper := stringid.GenerateRandomID() <add> <add> if err := driver.Create(base, "", "", nil); err != nil { <add> b.Fatal(err) <add> } <add> <add> if err := addManyFiles(driver, base, bottom, 3); err != nil { <add> b.Fatal(err) <add> } <add> <add> if err := driver.Create(upper, base, "", nil); err != nil { <add> b.Fatal(err) <add> } <add> <add> if err := addManyFiles(driver, upper, top, 6); err != nil { <add> b.Fatal(err) <add> } <add> b.ResetTimer() <add> for i := 0; i < b.N; i++ { <add> arch, err := driver.Diff(upper, "") <add> if err != nil { <add> b.Fatal(err) <add> } <add> _, err = io.Copy(ioutil.Discard, arch) <add> if err != nil { <add> b.Fatalf("Error copying archive: %s", err) <add> } <add> arch.Close() <add> } <add>} <add> <add>// DriverBenchDiffApplyN benchmarks calls to diff and apply together <add>func DriverBenchDiffApplyN(b *testing.B, fileCount int, drivername string, driveroptions ...string) { <add> driver := GetDriver(b, drivername, driveroptions...) <add> defer PutDriver(b) <add> base := stringid.GenerateRandomID() <add> upper := stringid.GenerateRandomID() <add> <add> if err := driver.Create(base, "", "", nil); err != nil { <add> b.Fatal(err) <add> } <add> <add> if err := addManyFiles(driver, base, fileCount, 3); err != nil { <add> b.Fatal(err) <add> } <add> <add> if err := driver.Create(upper, base, "", nil); err != nil { <add> b.Fatal(err) <add> } <add> <add> if err := addManyFiles(driver, upper, fileCount, 6); err != nil { <add> b.Fatal(err) <add> } <add> diffSize, err := driver.DiffSize(upper, "") <add> if err != nil { <add> b.Fatal(err) <add> } <add> b.ResetTimer() <add> b.StopTimer() <add> for i := 0; i < b.N; i++ { <add> diff := stringid.GenerateRandomID() <add> if err := driver.Create(diff, base, "", nil); err != nil { <add> b.Fatal(err) <add> } <add> <add> if err := checkManyFiles(driver, diff, fileCount, 3); err != nil { <add> b.Fatal(err) <add> } <add> <add> b.StartTimer() <add> <add> arch, err := driver.Diff(upper, "") <add> if err != nil { <add> b.Fatal(err) <add> } <add> <add> applyDiffSize, err := driver.ApplyDiff(diff, "", arch) <add> if err != nil { <add> b.Fatal(err) <add> } <add> <add> b.StopTimer() <add> arch.Close() <add> <add> if applyDiffSize != diffSize { <add> // TODO: enforce this <add> //b.Fatalf("Apply diff size different, got %d, expected %s", applyDiffSize, diffSize) <add> } <add> if err := checkManyFiles(driver, diff, fileCount, 6); err != nil { <add> b.Fatal(err) <add> } <add> } <add>} <add> <add>// DriverBenchDeepLayerDiff benchmarks calls to diff on top of a given number of layers. <add>func DriverBenchDeepLayerDiff(b *testing.B, layerCount int, drivername string, driveroptions ...string) { <add> driver := GetDriver(b, drivername, driveroptions...) <add> defer PutDriver(b) <add> <add> base := stringid.GenerateRandomID() <add> <add> if err := driver.Create(base, "", "", nil); err != nil { <add> b.Fatal(err) <add> } <add> <add> if err := addFiles(driver, base, 50); err != nil { <add> b.Fatal(err) <add> } <add> <add> topLayer, err := addManyLayers(driver, base, layerCount) <add> if err != nil { <add> b.Fatal(err) <add> } <add> <add> b.ResetTimer() <add> for i := 0; i < b.N; i++ { <add> arch, err := driver.Diff(topLayer, "") <add> if err != nil { <add> b.Fatal(err) <add> } <add> _, err = io.Copy(ioutil.Discard, arch) <add> if err != nil { <add> b.Fatalf("Error copying archive: %s", err) <add> } <add> arch.Close() <add> } <add>} <add> <add>// DriverBenchDeepLayerRead benchmarks calls to read a file under a given number of layers. <add>func DriverBenchDeepLayerRead(b *testing.B, layerCount int, drivername string, driveroptions ...string) { <add> driver := GetDriver(b, drivername, driveroptions...) <add> defer PutDriver(b) <add> <add> base := stringid.GenerateRandomID() <add> <add> if err := driver.Create(base, "", "", nil); err != nil { <add> b.Fatal(err) <add> } <add> <add> content := []byte("test content") <add> if err := addFile(driver, base, "testfile.txt", content); err != nil { <add> b.Fatal(err) <add> } <add> <add> topLayer, err := addManyLayers(driver, base, layerCount) <add> if err != nil { <add> b.Fatal(err) <add> } <add> <add> root, err := driver.Get(topLayer, "") <add> if err != nil { <add> b.Fatal(err) <add> } <add> defer driver.Put(topLayer) <add> <add> b.ResetTimer() <add> for i := 0; i < b.N; i++ { <add> <add> // Read content <add> c, err := ioutil.ReadFile(filepath.Join(root, "testfile.txt")) <add> if err != nil { <add> b.Fatal(err) <add> } <add> <add> b.StopTimer() <add> if bytes.Compare(c, content) != 0 { <add> b.Fatalf("Wrong content in file %v, expected %v", c, content) <add> } <add> b.StartTimer() <add> } <add>} <ide><path>daemon/graphdriver/graphtest/graphtest_unix.go <ide> package graphtest <ide> <ide> import ( <del> "fmt" <add> "bytes" <ide> "io/ioutil" <ide> "math/rand" <ide> "os" <ide> import ( <ide> "unsafe" <ide> <ide> "github.com/docker/docker/daemon/graphdriver" <add> "github.com/docker/docker/pkg/stringid" <ide> "github.com/docker/go-units" <ide> ) <ide> <ide> type Driver struct { <ide> refCount int <ide> } <ide> <del>// InitLoopbacks ensures that the loopback devices are properly created within <del>// the system running the device mapper tests. <del>func InitLoopbacks() error { <del> statT, err := getBaseLoopStats() <del> if err != nil { <del> return err <del> } <del> // create at least 8 loopback files, ya, that is a good number <del> for i := 0; i < 8; i++ { <del> loopPath := fmt.Sprintf("/dev/loop%d", i) <del> // only create new loopback files if they don't exist <del> if _, err := os.Stat(loopPath); err != nil { <del> if mkerr := syscall.Mknod(loopPath, <del> uint32(statT.Mode|syscall.S_IFBLK), int((7<<8)|(i&0xff)|((i&0xfff00)<<12))); mkerr != nil { <del> return mkerr <del> } <del> os.Chown(loopPath, int(statT.Uid), int(statT.Gid)) <del> } <del> } <del> return nil <del>} <del> <del>// getBaseLoopStats inspects /dev/loop0 to collect uid,gid, and mode for the <del>// loop0 device on the system. If it does not exist we assume 0,0,0660 for the <del>// stat data <del>func getBaseLoopStats() (*syscall.Stat_t, error) { <del> loop0, err := os.Stat("/dev/loop0") <del> if err != nil { <del> if os.IsNotExist(err) { <del> return &syscall.Stat_t{ <del> Uid: 0, <del> Gid: 0, <del> Mode: 0660, <del> }, nil <del> } <del> return nil, err <del> } <del> return loop0.Sys().(*syscall.Stat_t), nil <del>} <del> <del>func newDriver(t *testing.T, name string) *Driver { <add>func newDriver(t testing.TB, name string, options []string) *Driver { <ide> root, err := ioutil.TempDir("", "docker-graphtest-") <ide> if err != nil { <ide> t.Fatal(err) <ide> func newDriver(t *testing.T, name string) *Driver { <ide> t.Fatal(err) <ide> } <ide> <del> d, err := graphdriver.GetDriver(name, root, nil, nil, nil) <add> d, err := graphdriver.GetDriver(name, root, options, nil, nil) <ide> if err != nil { <ide> t.Logf("graphdriver: %v\n", err) <ide> if err == graphdriver.ErrNotSupported || err == graphdriver.ErrPrerequisites || err == graphdriver.ErrIncompatibleFS { <ide> func newDriver(t *testing.T, name string) *Driver { <ide> return &Driver{d, root, 1} <ide> } <ide> <del>func cleanup(t *testing.T, d *Driver) { <add>func cleanup(t testing.TB, d *Driver) { <ide> if err := drv.Cleanup(); err != nil { <ide> t.Fatal(err) <ide> } <ide> os.RemoveAll(d.root) <ide> } <ide> <ide> // GetDriver create a new driver with given name or return an existing driver with the name updating the reference count. <del>func GetDriver(t *testing.T, name string) graphdriver.Driver { <add>func GetDriver(t testing.TB, name string, options ...string) graphdriver.Driver { <ide> if drv == nil { <del> drv = newDriver(t, name) <add> drv = newDriver(t, name, options) <ide> } else { <ide> drv.refCount++ <ide> } <ide> return drv <ide> } <ide> <ide> // PutDriver removes the driver if it is no longer used and updates the reference count. <del>func PutDriver(t *testing.T) { <add>func PutDriver(t testing.TB) { <ide> if drv == nil { <ide> t.Skip("No driver to put!") <ide> } <ide> func PutDriver(t *testing.T) { <ide> } <ide> } <ide> <del>func verifyFile(t *testing.T, path string, mode os.FileMode, uid, gid uint32) { <del> fi, err := os.Stat(path) <del> if err != nil { <add>// DriverTestCreateEmpty creates a new image and verifies it is empty and the right metadata <add>func DriverTestCreateEmpty(t testing.TB, drivername string, driverOptions ...string) { <add> driver := GetDriver(t, drivername, driverOptions...) <add> defer PutDriver(t) <add> <add> if err := driver.Create("empty", "", "", nil); err != nil { <ide> t.Fatal(err) <ide> } <ide> <del> if fi.Mode()&os.ModeType != mode&os.ModeType { <del> t.Fatalf("Expected %s type 0x%x, got 0x%x", path, mode&os.ModeType, fi.Mode()&os.ModeType) <del> } <add> defer func() { <add> if err := driver.Remove("empty"); err != nil { <add> t.Fatal(err) <add> } <add> }() <ide> <del> if fi.Mode()&os.ModePerm != mode&os.ModePerm { <del> t.Fatalf("Expected %s mode %o, got %o", path, mode&os.ModePerm, fi.Mode()&os.ModePerm) <add> if !driver.Exists("empty") { <add> t.Fatal("Newly created image doesn't exist") <ide> } <ide> <del> if fi.Mode()&os.ModeSticky != mode&os.ModeSticky { <del> t.Fatalf("Expected %s sticky 0x%x, got 0x%x", path, mode&os.ModeSticky, fi.Mode()&os.ModeSticky) <add> dir, err := driver.Get("empty", "") <add> if err != nil { <add> t.Fatal(err) <ide> } <ide> <del> if fi.Mode()&os.ModeSetuid != mode&os.ModeSetuid { <del> t.Fatalf("Expected %s setuid 0x%x, got 0x%x", path, mode&os.ModeSetuid, fi.Mode()&os.ModeSetuid) <del> } <add> verifyFile(t, dir, 0755|os.ModeDir, 0, 0) <ide> <del> if fi.Mode()&os.ModeSetgid != mode&os.ModeSetgid { <del> t.Fatalf("Expected %s setgid 0x%x, got 0x%x", path, mode&os.ModeSetgid, fi.Mode()&os.ModeSetgid) <add> // Verify that the directory is empty <add> fis, err := readDir(dir) <add> if err != nil { <add> t.Fatal(err) <ide> } <ide> <del> if stat, ok := fi.Sys().(*syscall.Stat_t); ok { <del> if stat.Uid != uid { <del> t.Fatalf("%s no owned by uid %d", path, uid) <del> } <del> if stat.Gid != gid { <del> t.Fatalf("%s not owned by gid %d", path, gid) <del> } <add> if len(fis) != 0 { <add> t.Fatal("New directory not empty") <ide> } <ide> <add> driver.Put("empty") <ide> } <ide> <del>// readDir reads a directory just like ioutil.ReadDir() <del>// then hides specific files (currently "lost+found") <del>// so the tests don't "see" it <del>func readDir(dir string) ([]os.FileInfo, error) { <del> a, err := ioutil.ReadDir(dir) <del> if err != nil { <del> return nil, err <del> } <add>// DriverTestCreateBase create a base driver and verify. <add>func DriverTestCreateBase(t testing.TB, drivername string, driverOptions ...string) { <add> driver := GetDriver(t, drivername, driverOptions...) <add> defer PutDriver(t) <ide> <del> b := a[:0] <del> for _, x := range a { <del> if x.Name() != "lost+found" { // ext4 always have this dir <del> b = append(b, x) <add> createBase(t, driver, "Base") <add> defer func() { <add> if err := driver.Remove("Base"); err != nil { <add> t.Fatal(err) <ide> } <del> } <del> <del> return b, nil <add> }() <add> verifyBase(t, driver, "Base") <ide> } <ide> <del>// DriverTestCreateEmpty creates a new image and verifies it is empty and the right metadata <del>func DriverTestCreateEmpty(t *testing.T, drivername string) { <del> driver := GetDriver(t, drivername) <add>// DriverTestCreateSnap Create a driver and snap and verify. <add>func DriverTestCreateSnap(t testing.TB, drivername string, driverOptions ...string) { <add> driver := GetDriver(t, drivername, driverOptions...) <ide> defer PutDriver(t) <ide> <del> if err := driver.Create("empty", "", "", nil); err != nil { <add> createBase(t, driver, "Base") <add> <add> defer func() { <add> if err := driver.Remove("Base"); err != nil { <add> t.Fatal(err) <add> } <add> }() <add> <add> if err := driver.Create("Snap", "Base", "", nil); err != nil { <ide> t.Fatal(err) <ide> } <ide> <ide> defer func() { <del> if err := driver.Remove("empty"); err != nil { <add> if err := driver.Remove("Snap"); err != nil { <ide> t.Fatal(err) <ide> } <ide> }() <ide> <del> if !driver.Exists("empty") { <del> t.Fatal("Newly created image doesn't exist") <del> } <add> verifyBase(t, driver, "Snap") <add>} <ide> <del> dir, err := driver.Get("empty", "") <del> if err != nil { <add>// DriverTestDeepLayerRead reads a file from a lower layer under a given number of layers <add>func DriverTestDeepLayerRead(t testing.TB, layerCount int, drivername string, driverOptions ...string) { <add> driver := GetDriver(t, drivername, driverOptions...) <add> defer PutDriver(t) <add> <add> base := stringid.GenerateRandomID() <add> <add> if err := driver.Create(base, "", "", nil); err != nil { <ide> t.Fatal(err) <ide> } <ide> <del> verifyFile(t, dir, 0755|os.ModeDir, 0, 0) <add> content := []byte("test content") <add> if err := addFile(driver, base, "testfile.txt", content); err != nil { <add> t.Fatal(err) <add> } <ide> <del> // Verify that the directory is empty <del> fis, err := readDir(dir) <add> topLayer, err := addManyLayers(driver, base, layerCount) <ide> if err != nil { <ide> t.Fatal(err) <ide> } <ide> <del> if len(fis) != 0 { <del> t.Fatal("New directory not empty") <add> err = checkManyLayers(driver, topLayer, layerCount) <add> if err != nil { <add> t.Fatal(err) <ide> } <ide> <del> driver.Put("empty") <add> if err := checkFile(driver, topLayer, "testfile.txt", content); err != nil { <add> t.Fatal(err) <add> } <ide> } <ide> <del>func createBase(t *testing.T, driver graphdriver.Driver, name string) { <del> // We need to be able to set any perms <del> oldmask := syscall.Umask(0) <del> defer syscall.Umask(oldmask) <add>// DriverTestDiffApply tests diffing and applying produces the same layer <add>func DriverTestDiffApply(t testing.TB, fileCount int, drivername string, driverOptions ...string) { <add> driver := GetDriver(t, drivername, driverOptions...) <add> defer PutDriver(t) <add> base := stringid.GenerateRandomID() <add> upper := stringid.GenerateRandomID() <ide> <del> if err := driver.CreateReadWrite(name, "", "", nil); err != nil { <add> if err := driver.Create(base, "", "", nil); err != nil { <ide> t.Fatal(err) <ide> } <ide> <del> dir, err := driver.Get(name, "") <del> if err != nil { <add> if err := addManyFiles(driver, base, fileCount, 3); err != nil { <add> t.Fatal(err) <add> } <add> <add> if err := driver.Create(upper, base, "", nil); err != nil { <ide> t.Fatal(err) <ide> } <del> defer driver.Put(name) <ide> <del> subdir := path.Join(dir, "a subdir") <del> if err := os.Mkdir(subdir, 0705|os.ModeSticky); err != nil { <add> if err := addManyFiles(driver, upper, fileCount, 6); err != nil { <ide> t.Fatal(err) <ide> } <del> if err := os.Chown(subdir, 1, 2); err != nil { <add> diffSize, err := driver.DiffSize(upper, "") <add> if err != nil { <ide> t.Fatal(err) <ide> } <ide> <del> file := path.Join(dir, "a file") <del> if err := ioutil.WriteFile(file, []byte("Some data"), 0222|os.ModeSetuid); err != nil { <add> diff := stringid.GenerateRandomID() <add> if err := driver.Create(diff, base, "", nil); err != nil { <ide> t.Fatal(err) <ide> } <del>} <ide> <del>func verifyBase(t *testing.T, driver graphdriver.Driver, name string) { <del> dir, err := driver.Get(name, "") <del> if err != nil { <add> if err := checkManyFiles(driver, diff, fileCount, 3); err != nil { <ide> t.Fatal(err) <ide> } <del> defer driver.Put(name) <ide> <del> subdir := path.Join(dir, "a subdir") <del> verifyFile(t, subdir, 0705|os.ModeDir|os.ModeSticky, 1, 2) <add> arch, err := driver.Diff(upper, base) <add> if err != nil { <add> t.Fatal(err) <add> } <ide> <del> file := path.Join(dir, "a file") <del> verifyFile(t, file, 0222|os.ModeSetuid, 0, 0) <add> buf := bytes.NewBuffer(nil) <add> if _, err := buf.ReadFrom(arch); err != nil { <add> t.Fatal(err) <add> } <add> if err := arch.Close(); err != nil { <add> t.Fatal(err) <add> } <ide> <del> fis, err := readDir(dir) <add> applyDiffSize, err := driver.ApplyDiff(diff, base, bytes.NewReader(buf.Bytes())) <ide> if err != nil { <ide> t.Fatal(err) <ide> } <ide> <del> if len(fis) != 2 { <del> t.Fatal("Unexpected files in base image") <add> if applyDiffSize != diffSize { <add> t.Fatalf("Apply diff size different, got %d, expected %d", applyDiffSize, diffSize) <add> } <add> if err := checkManyFiles(driver, diff, fileCount, 6); err != nil { <add> t.Fatal(err) <ide> } <ide> } <ide> <del>// DriverTestCreateBase create a base driver and verify. <del>func DriverTestCreateBase(t *testing.T, drivername string) { <del> driver := GetDriver(t, drivername) <add>// DriverTestChanges tests computed changes on a layer matches changes made <add>func DriverTestChanges(t testing.TB, drivername string, driverOptions ...string) { <add> driver := GetDriver(t, drivername, driverOptions...) <ide> defer PutDriver(t) <add> base := stringid.GenerateRandomID() <add> upper := stringid.GenerateRandomID() <ide> <del> createBase(t, driver, "Base") <del> defer func() { <del> if err := driver.Remove("Base"); err != nil { <del> t.Fatal(err) <del> } <del> }() <del> verifyBase(t, driver, "Base") <del>} <add> if err := driver.Create(base, "", "", nil); err != nil { <add> t.Fatal(err) <add> } <ide> <del>// DriverTestCreateSnap Create a driver and snap and verify. <del>func DriverTestCreateSnap(t *testing.T, drivername string) { <del> driver := GetDriver(t, drivername) <del> defer PutDriver(t) <add> if err := addManyFiles(driver, base, 20, 3); err != nil { <add> t.Fatal(err) <add> } <ide> <del> createBase(t, driver, "Base") <add> if err := driver.Create(upper, base, "", nil); err != nil { <add> t.Fatal(err) <add> } <ide> <del> defer func() { <del> if err := driver.Remove("Base"); err != nil { <del> t.Fatal(err) <del> } <del> }() <add> expectedChanges, err := changeManyFiles(driver, upper, 20, 6) <add> if err != nil { <add> t.Fatal(err) <add> } <ide> <del> if err := driver.Create("Snap", "Base", "", nil); err != nil { <add> changes, err := driver.Changes(upper, base) <add> if err != nil { <ide> t.Fatal(err) <ide> } <del> defer func() { <del> if err := driver.Remove("Snap"); err != nil { <del> t.Fatal(err) <del> } <del> }() <ide> <del> verifyBase(t, driver, "Snap") <add> if err = checkChanges(expectedChanges, changes); err != nil { <add> t.Fatal(err) <add> } <ide> } <ide> <ide> func writeRandomFile(path string, size uint64) error { <ide><path>daemon/graphdriver/graphtest/testutil.go <add>package graphtest <add> <add>import ( <add> "bytes" <add> "fmt" <add> "io/ioutil" <add> "math/rand" <add> "os" <add> "path" <add> "sort" <add> <add> "github.com/docker/docker/daemon/graphdriver" <add> "github.com/docker/docker/pkg/archive" <add> "github.com/docker/docker/pkg/stringid" <add>) <add> <add>func randomContent(size int, seed int64) []byte { <add> s := rand.NewSource(seed) <add> content := make([]byte, size) <add> <add> for i := 0; i < len(content); i += 7 { <add> val := s.Int63() <add> for j := 0; i+j < len(content) && j < 7; j++ { <add> content[i+j] = byte(val) <add> val >>= 8 <add> } <add> } <add> <add> return content <add>} <add> <add>func addFiles(drv graphdriver.Driver, layer string, seed int64) error { <add> root, err := drv.Get(layer, "") <add> if err != nil { <add> return err <add> } <add> defer drv.Put(layer) <add> <add> if err := ioutil.WriteFile(path.Join(root, "file-a"), randomContent(64, seed), 0755); err != nil { <add> return err <add> } <add> if err := os.MkdirAll(path.Join(root, "dir-b"), 0755); err != nil { <add> return err <add> } <add> if err := ioutil.WriteFile(path.Join(root, "dir-b", "file-b"), randomContent(128, seed+1), 0755); err != nil { <add> return err <add> } <add> <add> return ioutil.WriteFile(path.Join(root, "file-c"), randomContent(128*128, seed+2), 0755) <add>} <add> <add>func checkFile(drv graphdriver.Driver, layer, filename string, content []byte) error { <add> root, err := drv.Get(layer, "") <add> if err != nil { <add> return err <add> } <add> defer drv.Put(layer) <add> <add> fileContent, err := ioutil.ReadFile(path.Join(root, filename)) <add> if err != nil { <add> return err <add> } <add> <add> if bytes.Compare(fileContent, content) != 0 { <add> return fmt.Errorf("mismatched file content %v, expecting %v", fileContent, content) <add> } <add> <add> return nil <add>} <add> <add>func addFile(drv graphdriver.Driver, layer, filename string, content []byte) error { <add> root, err := drv.Get(layer, "") <add> if err != nil { <add> return err <add> } <add> defer drv.Put(layer) <add> <add> return ioutil.WriteFile(path.Join(root, filename), content, 0755) <add>} <add> <add>func addManyFiles(drv graphdriver.Driver, layer string, count int, seed int64) error { <add> root, err := drv.Get(layer, "") <add> if err != nil { <add> return err <add> } <add> defer drv.Put(layer) <add> <add> for i := 0; i < count; i += 100 { <add> dir := path.Join(root, fmt.Sprintf("directory-%d", i)) <add> if err := os.MkdirAll(dir, 0755); err != nil { <add> return err <add> } <add> for j := 0; i+j < count && j < 100; j++ { <add> file := path.Join(dir, fmt.Sprintf("file-%d", i+j)) <add> if err := ioutil.WriteFile(file, randomContent(64, seed+int64(i+j)), 0755); err != nil { <add> return err <add> } <add> } <add> } <add> <add> return nil <add>} <add> <add>func changeManyFiles(drv graphdriver.Driver, layer string, count int, seed int64) ([]archive.Change, error) { <add> root, err := drv.Get(layer, "") <add> if err != nil { <add> return nil, err <add> } <add> defer drv.Put(layer) <add> <add> changes := []archive.Change{} <add> for i := 0; i < count; i += 100 { <add> archiveRoot := fmt.Sprintf("/directory-%d", i) <add> if err := os.MkdirAll(path.Join(root, archiveRoot), 0755); err != nil { <add> return nil, err <add> } <add> for j := 0; i+j < count && j < 100; j++ { <add> if j == 0 { <add> changes = append(changes, archive.Change{ <add> Path: archiveRoot, <add> Kind: archive.ChangeModify, <add> }) <add> } <add> var change archive.Change <add> switch j % 3 { <add> // Update file <add> case 0: <add> change.Path = path.Join(archiveRoot, fmt.Sprintf("file-%d", i+j)) <add> change.Kind = archive.ChangeModify <add> if err := ioutil.WriteFile(path.Join(root, change.Path), randomContent(64, seed+int64(i+j)), 0755); err != nil { <add> return nil, err <add> } <add> // Add file <add> case 1: <add> change.Path = path.Join(archiveRoot, fmt.Sprintf("file-%d-%d", seed, i+j)) <add> change.Kind = archive.ChangeAdd <add> if err := ioutil.WriteFile(path.Join(root, change.Path), randomContent(64, seed+int64(i+j)), 0755); err != nil { <add> return nil, err <add> } <add> // Remove file <add> case 2: <add> change.Path = path.Join(archiveRoot, fmt.Sprintf("file-%d", i+j)) <add> change.Kind = archive.ChangeDelete <add> if err := os.Remove(path.Join(root, change.Path)); err != nil { <add> return nil, err <add> } <add> } <add> changes = append(changes, change) <add> } <add> } <add> <add> return changes, nil <add>} <add> <add>func checkManyFiles(drv graphdriver.Driver, layer string, count int, seed int64) error { <add> root, err := drv.Get(layer, "") <add> if err != nil { <add> return err <add> } <add> defer drv.Put(layer) <add> <add> for i := 0; i < count; i += 100 { <add> dir := path.Join(root, fmt.Sprintf("directory-%d", i)) <add> for j := 0; i+j < count && j < 100; j++ { <add> file := path.Join(dir, fmt.Sprintf("file-%d", i+j)) <add> fileContent, err := ioutil.ReadFile(file) <add> if err != nil { <add> return err <add> } <add> <add> content := randomContent(64, seed+int64(i+j)) <add> <add> if bytes.Compare(fileContent, content) != 0 { <add> return fmt.Errorf("mismatched file content %v, expecting %v", fileContent, content) <add> } <add> } <add> } <add> <add> return nil <add>} <add> <add>type changeList []archive.Change <add> <add>func (c changeList) Less(i, j int) bool { <add> if c[i].Path == c[j].Path { <add> return c[i].Kind < c[j].Kind <add> } <add> return c[i].Path < c[j].Path <add>} <add>func (c changeList) Len() int { return len(c) } <add>func (c changeList) Swap(i, j int) { c[j], c[i] = c[i], c[j] } <add> <add>func checkChanges(expected, actual []archive.Change) error { <add> if len(expected) != len(actual) { <add> return fmt.Errorf("unexpected number of changes, expected %d, got %d", len(expected), len(actual)) <add> } <add> sort.Sort(changeList(expected)) <add> sort.Sort(changeList(actual)) <add> <add> for i := range expected { <add> if expected[i] != actual[i] { <add> return fmt.Errorf("unexpected change, expecting %v, got %v", expected[i], actual[i]) <add> } <add> } <add> <add> return nil <add>} <add> <add>func addLayerFiles(drv graphdriver.Driver, layer, parent string, i int) error { <add> root, err := drv.Get(layer, "") <add> if err != nil { <add> return err <add> } <add> defer drv.Put(layer) <add> <add> if err := ioutil.WriteFile(path.Join(root, "top-id"), []byte(layer), 0755); err != nil { <add> return err <add> } <add> layerDir := path.Join(root, fmt.Sprintf("layer-%d", i)) <add> if err := os.MkdirAll(layerDir, 0755); err != nil { <add> return err <add> } <add> if err := ioutil.WriteFile(path.Join(layerDir, "layer-id"), []byte(layer), 0755); err != nil { <add> return err <add> } <add> if err := ioutil.WriteFile(path.Join(layerDir, "parent-id"), []byte(parent), 0755); err != nil { <add> return err <add> } <add> <add> return nil <add>} <add> <add>func addManyLayers(drv graphdriver.Driver, baseLayer string, count int) (string, error) { <add> lastLayer := baseLayer <add> for i := 1; i <= count; i++ { <add> nextLayer := stringid.GenerateRandomID() <add> if err := drv.Create(nextLayer, lastLayer, "", nil); err != nil { <add> return "", err <add> } <add> if err := addLayerFiles(drv, nextLayer, lastLayer, i); err != nil { <add> return "", err <add> } <add> <add> lastLayer = nextLayer <add> <add> } <add> return lastLayer, nil <add>} <add> <add>func checkManyLayers(drv graphdriver.Driver, layer string, count int) error { <add> root, err := drv.Get(layer, "") <add> if err != nil { <add> return err <add> } <add> defer drv.Put(layer) <add> <add> layerIDBytes, err := ioutil.ReadFile(path.Join(root, "top-id")) <add> if err != nil { <add> return err <add> } <add> <add> if bytes.Compare(layerIDBytes, []byte(layer)) != 0 { <add> return fmt.Errorf("mismatched file content %v, expecting %v", layerIDBytes, []byte(layer)) <add> } <add> <add> for i := count; i > 0; i-- { <add> layerDir := path.Join(root, fmt.Sprintf("layer-%d", i)) <add> <add> thisLayerIDBytes, err := ioutil.ReadFile(path.Join(layerDir, "layer-id")) <add> if err != nil { <add> return err <add> } <add> if bytes.Compare(thisLayerIDBytes, layerIDBytes) != 0 { <add> return fmt.Errorf("mismatched file content %v, expecting %v", thisLayerIDBytes, layerIDBytes) <add> } <add> layerIDBytes, err = ioutil.ReadFile(path.Join(layerDir, "parent-id")) <add> if err != nil { <add> return err <add> } <add> } <add> return nil <add>} <add> <add>// readDir reads a directory just like ioutil.ReadDir() <add>// then hides specific files (currently "lost+found") <add>// so the tests don't "see" it <add>func readDir(dir string) ([]os.FileInfo, error) { <add> a, err := ioutil.ReadDir(dir) <add> if err != nil { <add> return nil, err <add> } <add> <add> b := a[:0] <add> for _, x := range a { <add> if x.Name() != "lost+found" { // ext4 always have this dir <add> b = append(b, x) <add> } <add> } <add> <add> return b, nil <add>} <ide><path>daemon/graphdriver/graphtest/testutil_unix.go <add>// +build linux freebsd <add> <add>package graphtest <add> <add>import ( <add> "fmt" <add> "io/ioutil" <add> "os" <add> "path" <add> "syscall" <add> "testing" <add> <add> "github.com/docker/docker/daemon/graphdriver" <add>) <add> <add>// InitLoopbacks ensures that the loopback devices are properly created within <add>// the system running the device mapper tests. <add>func InitLoopbacks() error { <add> statT, err := getBaseLoopStats() <add> if err != nil { <add> return err <add> } <add> // create at least 8 loopback files, ya, that is a good number <add> for i := 0; i < 8; i++ { <add> loopPath := fmt.Sprintf("/dev/loop%d", i) <add> // only create new loopback files if they don't exist <add> if _, err := os.Stat(loopPath); err != nil { <add> if mkerr := syscall.Mknod(loopPath, <add> uint32(statT.Mode|syscall.S_IFBLK), int((7<<8)|(i&0xff)|((i&0xfff00)<<12))); mkerr != nil { <add> return mkerr <add> } <add> os.Chown(loopPath, int(statT.Uid), int(statT.Gid)) <add> } <add> } <add> return nil <add>} <add> <add>// getBaseLoopStats inspects /dev/loop0 to collect uid,gid, and mode for the <add>// loop0 device on the system. If it does not exist we assume 0,0,0660 for the <add>// stat data <add>func getBaseLoopStats() (*syscall.Stat_t, error) { <add> loop0, err := os.Stat("/dev/loop0") <add> if err != nil { <add> if os.IsNotExist(err) { <add> return &syscall.Stat_t{ <add> Uid: 0, <add> Gid: 0, <add> Mode: 0660, <add> }, nil <add> } <add> return nil, err <add> } <add> return loop0.Sys().(*syscall.Stat_t), nil <add>} <add> <add>func verifyFile(t testing.TB, path string, mode os.FileMode, uid, gid uint32) { <add> fi, err := os.Stat(path) <add> if err != nil { <add> t.Fatal(err) <add> } <add> <add> if fi.Mode()&os.ModeType != mode&os.ModeType { <add> t.Fatalf("Expected %s type 0x%x, got 0x%x", path, mode&os.ModeType, fi.Mode()&os.ModeType) <add> } <add> <add> if fi.Mode()&os.ModePerm != mode&os.ModePerm { <add> t.Fatalf("Expected %s mode %o, got %o", path, mode&os.ModePerm, fi.Mode()&os.ModePerm) <add> } <add> <add> if fi.Mode()&os.ModeSticky != mode&os.ModeSticky { <add> t.Fatalf("Expected %s sticky 0x%x, got 0x%x", path, mode&os.ModeSticky, fi.Mode()&os.ModeSticky) <add> } <add> <add> if fi.Mode()&os.ModeSetuid != mode&os.ModeSetuid { <add> t.Fatalf("Expected %s setuid 0x%x, got 0x%x", path, mode&os.ModeSetuid, fi.Mode()&os.ModeSetuid) <add> } <add> <add> if fi.Mode()&os.ModeSetgid != mode&os.ModeSetgid { <add> t.Fatalf("Expected %s setgid 0x%x, got 0x%x", path, mode&os.ModeSetgid, fi.Mode()&os.ModeSetgid) <add> } <add> <add> if stat, ok := fi.Sys().(*syscall.Stat_t); ok { <add> if stat.Uid != uid { <add> t.Fatalf("%s no owned by uid %d", path, uid) <add> } <add> if stat.Gid != gid { <add> t.Fatalf("%s not owned by gid %d", path, gid) <add> } <add> } <add>} <add> <add>func createBase(t testing.TB, driver graphdriver.Driver, name string) { <add> // We need to be able to set any perms <add> oldmask := syscall.Umask(0) <add> defer syscall.Umask(oldmask) <add> <add> if err := driver.CreateReadWrite(name, "", "", nil); err != nil { <add> t.Fatal(err) <add> } <add> <add> dir, err := driver.Get(name, "") <add> if err != nil { <add> t.Fatal(err) <add> } <add> defer driver.Put(name) <add> <add> subdir := path.Join(dir, "a subdir") <add> if err := os.Mkdir(subdir, 0705|os.ModeSticky); err != nil { <add> t.Fatal(err) <add> } <add> if err := os.Chown(subdir, 1, 2); err != nil { <add> t.Fatal(err) <add> } <add> <add> file := path.Join(dir, "a file") <add> if err := ioutil.WriteFile(file, []byte("Some data"), 0222|os.ModeSetuid); err != nil { <add> t.Fatal(err) <add> } <add>} <add> <add>func verifyBase(t testing.TB, driver graphdriver.Driver, name string) { <add> dir, err := driver.Get(name, "") <add> if err != nil { <add> t.Fatal(err) <add> } <add> defer driver.Put(name) <add> <add> subdir := path.Join(dir, "a subdir") <add> verifyFile(t, subdir, 0705|os.ModeDir|os.ModeSticky, 1, 2) <add> <add> file := path.Join(dir, "a file") <add> verifyFile(t, file, 0222|os.ModeSetuid, 0, 0) <add> <add> fis, err := readDir(dir) <add> if err != nil { <add> t.Fatal(err) <add> } <add> <add> if len(fis) != 2 { <add> t.Fatal("Unexpected files in base image") <add> } <add> <add>}
4
Javascript
Javascript
avoid error when target module failed
8db617db80c4107e7ac0c9ee3640b3e2d63a49b5
<ide><path>lib/dependencies/HarmonyImportSpecifierDependency.js <ide> HarmonyImportSpecifierDependency.Template = class HarmonyImportSpecifierDependen <ide> <ide> let exportExpr; <ide> if ( <add> connection && <ide> concatenationScope && <ide> concatenationScope.isModuleInScope(connection.module) <ide> ) {
1
PHP
PHP
test queued handlers
25c6a77749387b709b1ea270b76c200b68ddd706
<ide><path>tests/Bus/BusDispatcherTest.php <ide> public function testCommandsThatShouldBeQueuedAreQueued() <ide> } <ide> <ide> <add> public function testHandlersThatShouldBeQueuedAreQueued() <add> { <add> $container = new Container; <add> $dispatcher = new Dispatcher($container, function() { <add> $mock = m::mock('Illuminate\Contracts\Queue\Queue'); <add> $mock->shouldReceive('push')->once(); <add> return $mock; <add> }); <add> $dispatcher->mapUsing(function() { return 'BusDispatcherTestQueuedHandler@handle'; }); <add> <add> $dispatcher->dispatch(new BusDispatcherTestBasicCommand); <add> } <add> <add> <ide> public function testDispatchNowShouldNeverQueue() <ide> { <ide> $container = new Container; <ide> public function handle(BusDispatcherTestBasicCommand $command) <ide> <ide> } <ide> } <add> <add>class BusDispatcherTestQueuedHandler implements Illuminate\Contracts\Queue\ShouldBeQueued { <add> <add>}
1
Javascript
Javascript
delay ret declaration in method _flushoutput
2788fd6b980860d51490f0cd0c59639e1b7f6140
<ide><path>lib/_http_outgoing.js <ide> OutgoingMessage.prototype._flush = function _flush() { <ide> }; <ide> <ide> OutgoingMessage.prototype._flushOutput = function _flushOutput(socket) { <del> var ret; <del> var outputLength = this.outputData.length; <add> const outputLength = this.outputData.length; <ide> if (outputLength <= 0) <del> return ret; <add> return undefined; <ide> <del> var outputData = this.outputData; <add> const outputData = this.outputData; <ide> socket.cork(); <add> let ret; <ide> for (var i = 0; i < outputLength; i++) { <ide> const { data, encoding, callback } = outputData[i]; <ide> ret = socket.write(data, encoding, callback);
1
Go
Go
fix dumper program to use proper import
1477a3d7fda5e8b29d68ffd5c4d6edead9ba2c61
<ide><path>builder/dockerfile/parser/dumper/main.go <ide> import ( <ide> "fmt" <ide> "os" <ide> <del> "github.com/docker/docker/builder/parser" <add> "github.com/docker/docker/builder/dockerfile/parser" <ide> ) <ide> <ide> func main() {
1
Ruby
Ruby
fix tests for sqlite3
27dea760f8f08927fd9c370f0f565b6ad1b2c0fe
<ide><path>activerecord/test/cases/adapters/sqlite3/statement_pool_test.rb <ide> require 'cases/helper' <ide> <ide> module ActiveRecord::ConnectionAdapters <del> class SQLiteAdapter <add> class SQLite3Adapter <ide> class StatementPoolTest < ActiveRecord::TestCase <ide> def test_cache_is_per_pid <ide> return skip('must support fork') unless Process.respond_to?(:fork)
1
Text
Text
remove extra newline
bdb37c4dee127efdf30fe2475430a76172a19469
<ide><path>docs/publishing-a-package.md <ide> publishing. <ide> install it by running `apm install my-package` or from the Atom settings view <ide> via the *Atom > Preferences...* menu. <ide> <del> <ide> [atomio]: https://atom.io <ide> [github]: https://github.com <ide> [git-tag]: http://git-scm.com/book/en/Git-Basics-Tagging
1
Python
Python
add some tests for the autoscaler
37d35ed5762412727f3445b87dd7f8abecfd4516
<ide><path>celery/tests/test_worker/test_worker_autoscale.py <ide> def test_shrink_raises_ValueError(self): <ide> x.scale_down(1) <ide> self.assertTrue(x.logger.debug.call_count) <ide> <add> def test_update_and_force(self): <add> x = autoscale.Autoscaler(self.pool, 10, 3, logger=logger) <add> self.assertEqual(x.processes, 3) <add> x.force_scale_up(5) <add> self.assertEqual(x.processes, 8) <add> x.update(5, None) <add> self.assertEqual(x.processes, 5) <add> x.force_scale_down(3) <add> self.assertEqual(x.processes, 2) <add> x.update(3, None) <add> self.assertEqual(x.processes, 3) <add> <add> def test_info(self): <add> x = autoscale.Autoscaler(self.pool, 10, 3, logger=logger) <add> info = x.info() <add> self.assertEqual(info['max'], 10) <add> self.assertEqual(info['min'], 3) <add> self.assertEqual(info['current'], 3) <add> <ide> @patch("os._exit") <ide> def test_thread_crash(self, _exit): <ide>
1
Go
Go
add todo for removing parsesearchindexinfo()
d9261561f997f299fcc6a1838a358f70a35a15ec
<ide><path>registry/config.go <ide> func ParseRepositoryInfo(reposName reference.Named) (*RepositoryInfo, error) { <ide> } <ide> <ide> // ParseSearchIndexInfo will use repository name to get back an indexInfo. <add>// <add>// TODO(thaJeztah) this function is only used by the CLI, and used to get <add>// information of the registry (to provide credentials if needed). We should <add>// move this function (or equivalent) to the CLI, as it's doing too much just <add>// for that. <ide> func ParseSearchIndexInfo(reposName string) (*registrytypes.IndexInfo, error) { <ide> indexName, _ := splitReposSearchTerm(reposName) <ide>
1
PHP
PHP
remove useless imports
ea22e103278516528afceacdaba1bd666ae36139
<ide><path>src/Illuminate/Database/Eloquent/Relations/Concerns/AsPivot.php <ide> <ide> namespace Illuminate\Database\Eloquent\Relations\Concerns; <ide> <del>use Illuminate\Database\Eloquent\Builder; <ide> use Illuminate\Database\Eloquent\Model; <ide> use Illuminate\Support\Str; <ide> <ide><path>src/Illuminate/Support/Pluralizer.php <ide> <ide> namespace Illuminate\Support; <ide> <del>use Doctrine\Inflector\Inflector; <ide> use Doctrine\Inflector\InflectorFactory; <ide> <ide> class Pluralizer <ide><path>src/Illuminate/Testing/TestComponent.php <ide> <ide> use Illuminate\Testing\Assert as PHPUnit; <ide> use Illuminate\Testing\Constraints\SeeInOrder; <del>use Illuminate\View\Component; <ide> <ide> class TestComponent <ide> { <ide><path>tests/Container/ContainerTest.php <ide> use Illuminate\Container\Container; <ide> use Illuminate\Container\EntryNotFoundException; <ide> use Illuminate\Contracts\Container\BindingResolutionException; <del>use Illuminate\Contracts\Container\CircularDependencyException; <ide> use PHPUnit\Framework\TestCase; <ide> use Psr\Container\ContainerExceptionInterface; <ide> use stdClass; <ide> public function testContainerCanResolveClasses() <ide> <ide> // public function testContainerCanCatchCircularDependency() <ide> // { <del> // $this->expectException(CircularDependencyException::class); <add> // $this->expectException(\Illuminate\Contracts\Container\CircularDependencyException::class); <ide> <ide> // $container = new Container; <ide> // $container->get(CircularAStub::class); <ide><path>tests/Routing/RouteRegistrarTest.php <ide> use Illuminate\Container\Container; <ide> use Illuminate\Contracts\Events\Dispatcher; <ide> use Illuminate\Http\Request; <del>use Illuminate\Routing\Route; <ide> use Illuminate\Routing\Router; <ide> use Mockery as m; <ide> use PHPUnit\Framework\TestCase;
5
Go
Go
use image version, not os version for tty fixup
6508c015fe764fd59438cabffcbc6102c9cf04ef
<ide><path>daemon/oci_windows.go <ide> func (daemon *Daemon) createSpec(c *container.Container) (*libcontainerd.Spec, e <ide> return nil, fmt.Errorf("Failed to graph.Get on ImageID %s - %s", c.ImageID, err) <ide> } <ide> <add> s.Platform.OSVersion = img.OSVersion <add> <ide> // In base spec <ide> s.Hostname = c.FullHostname() <ide> <ide><path>libcontainerd/client_windows.go <ide> func (clnt *client) AddProcess(containerID, processFriendlyName string, procToAd <ide> iopipe.Stdin = createStdInCloser(stdin, newProcess) <ide> <ide> // TEMP: Work around Windows BS/DEL behavior. <del> iopipe.Stdin = fixStdinBackspaceBehavior(iopipe.Stdin, procToAdd.Terminal) <add> iopipe.Stdin = fixStdinBackspaceBehavior(iopipe.Stdin, container.ociSpec.Platform.OSVersion, procToAdd.Terminal) <ide> <ide> // Convert io.ReadClosers to io.Readers <ide> if stdout != nil { <ide><path>libcontainerd/container_windows.go <ide> func (ctr *container) start() error { <ide> iopipe.Stdin = createStdInCloser(stdin, hcsProcess) <ide> <ide> // TEMP: Work around Windows BS/DEL behavior. <del> iopipe.Stdin = fixStdinBackspaceBehavior(iopipe.Stdin, ctr.ociSpec.Process.Terminal) <add> iopipe.Stdin = fixStdinBackspaceBehavior(iopipe.Stdin, ctr.ociSpec.Platform.OSVersion, ctr.ociSpec.Process.Terminal) <ide> <ide> // Convert io.ReadClosers to io.Readers <ide> if stdout != nil { <ide><path>libcontainerd/process_windows.go <ide> package libcontainerd <ide> <ide> import ( <ide> "io" <add> "strconv" <add> "strings" <ide> <ide> "github.com/Microsoft/hcsshim" <del> "github.com/docker/docker/pkg/system" <ide> ) <ide> <ide> // process keeps the state for both main container process and exec process. <ide> func openReaderFromPipe(p io.ReadCloser) io.Reader { <ide> // fixStdinBackspaceBehavior works around a bug in Windows before build 14350 <ide> // where it interpreted DEL as VK_DELETE instead of as VK_BACK. This replaces <ide> // DEL with BS to work around this. <del>func fixStdinBackspaceBehavior(w io.WriteCloser, tty bool) io.WriteCloser { <del> if !tty || system.GetOSVersion().Build >= 14350 { <add>func fixStdinBackspaceBehavior(w io.WriteCloser, osversion string, tty bool) io.WriteCloser { <add> if !tty { <ide> return w <ide> } <add> v := strings.Split(osversion, ".") <add> if len(v) < 3 { <add> return w <add> } <add> <add> if build, err := strconv.Atoi(v[2]); err != nil || build >= 14350 { <add> return w <add> } <add> <ide> return &delToBsWriter{w} <ide> } <ide> <ide><path>libcontainerd/windowsoci/oci_windows.go <ide> type Platform struct { <ide> OS string `json:"os"` <ide> // Arch is the architecture <ide> Arch string `json:"arch"` <add> // OSVersion is the version of the operating system. <add> OSVersion string `json:"os.version,omitempty"` <ide> } <ide> <ide> // Mount specifies a mount for a container.
5
Javascript
Javascript
resolve default prop values in cloneelement
48ded230fca7983dafeb310b8bf5f6ec96958b3d
<ide><path>src/isomorphic/classic/element/ReactElement.js <ide> ReactElement.cloneElement = function(element, config, children) { <ide> key = '' + config.key; <ide> } <ide> // Remaining properties override existing props <add> var defaultProps; <add> if (element.type && element.type.defaultProps) { <add> defaultProps = element.type.defaultProps; <add> } <ide> for (propName in config) { <ide> if (config.hasOwnProperty(propName) && <ide> !RESERVED_PROPS.hasOwnProperty(propName)) { <del> props[propName] = config[propName]; <add> if (config[propName] === undefined && defaultProps !== undefined) { <add> // Resolve default props <add> props[propName] = defaultProps[propName]; <add> } else { <add> props[propName] = config[propName]; <add> } <ide> } <ide> } <ide> } <ide><path>src/isomorphic/classic/element/__tests__/ReactElement-test.js <ide> describe('ReactElement', function() { <ide> expect(inst2.props.prop).toBe(null); <ide> }); <ide> <add> it('should normalize props with default values in cloning', function() { <add> var Component = React.createClass({ <add> getDefaultProps: function() { <add> return {prop: 'testKey'}; <add> }, <add> render: function() { <add> return <span />; <add> }, <add> }); <add> <add> var instance = React.createElement(Component); <add> var clonedInstance = React.cloneElement(instance, {prop: undefined}); <add> expect(clonedInstance.props.prop).toBe('testKey'); <add> var clonedInstance2 = React.cloneElement(instance, {prop: null}); <add> expect(clonedInstance2.props.prop).toBe(null); <add> <add> var instance2 = React.createElement(Component, {prop: 'newTestKey'}); <add> var cloneInstance3 = React.cloneElement(instance2, {prop: undefined}); <add> expect(cloneInstance3.props.prop).toBe('testKey'); <add> var cloneInstance4 = React.cloneElement(instance2, {}); <add> expect(cloneInstance4.props.prop).toBe('newTestKey'); <add> }); <add> <ide> it('throws when changing a prop (in dev) after element creation', function() { <ide> var Outer = React.createClass({ <ide> render: function() {
2
Javascript
Javascript
add a way to disable running service workers.
d8af41d6903e09e0b779c8199aa02fb1fec912cb
<ide><path>lib/router/router.js <ide> import { loadGetInitialProps, getLocationOrigin } from '../utils' <ide> // Add "fetch" polyfill for older browsers <ide> if (typeof window !== 'undefined') { <ide> require('whatwg-fetch') <add> // Unregister if there's an exisiting service worker. <add> // This is because we ship a service worker in previous version. <add> // We don't use it and having a already running worker might cause issues. <add> // (We can remove this in future releases) <add> navigator.serviceWorker.getRegistrations() <add> .then((registrations) => { <add> for (let registration of registrations) { <add> registration.unregister() <add> } <add> }) <ide> } <ide> <ide> export default class Router extends EventEmitter {
1
Text
Text
add pr template
b6bb0be10ad84d456bb1cea535a4a922d7f2e2c6
<ide><path>PULL_REQUEST_TEMPLATE.md <add>### Summary <add> <add>### Related Issues <add> <add>### PR Overview <add> <add>- [ ] This PR requires new unit tests [y/n] (make sure tests are included) <add>- [ ] This PR requires to update the documentation [y/n] (make sure the docs are up-to-date) <add>- [ ] This PR is backwards compatible [y/n] <add>- [ ] This PR changes the current API [y/n] (all API changes need to be approved by fchollet)
1
PHP
PHP
improve errorlogger for php errors
ab46638329068574a93ebc2042aa183483211730
<ide><path>src/Error/BaseErrorHandler.php <ide> <ide> use Cake\Core\Configure; <ide> use Cake\Core\InstanceConfigTrait; <del>use Cake\Log\Log; <ide> use Cake\Routing\Router; <ide> use Psr\Http\Message\ServerRequestInterface; <add>use RuntimeException; <ide> use Throwable; <ide> <ide> /** <ide> protected function _logError($level, array $data): bool <ide> } <ide> $message .= "\nTrace:\n" . $trace . "\n"; <ide> } <del> $message .= "\n\n"; <ide> <del> return Log::write($level, $message); <add> return $this->getLogger()->logMessage($level, $message); <ide> } <ide> <ide> /** <ide> public function logException(Throwable $exception, ?ServerRequestInterface $requ <ide> public function getLogger() <ide> { <ide> if ($this->logger === null) { <del> /** @var \Cake\Error\ErrorLogger $logger */ <add> /** @var \Cake\Error\ErrorLoggerInterface $logger */ <ide> $logger = new $this->_config['errorLogger']($this->_config); <add> <add> if (!$logger instanceof ErrorLoggerInterface) { <add> // Set the logger so that the next error can be logged. <add> $this->logger = new ErrorLogger($this->_config); <add> <add> $interface = ErrorLoggerInterface::class; <add> $type = getTypeName($logger); <add> throw new RuntimeException("Cannot create logger. {$type} does not implement {$interface}"); <add> } <ide> $this->logger = $logger; <ide> } <ide> <add> <ide> return $this->logger; <ide> } <ide> <ide><path>src/Error/ErrorLogger.php <ide> /** <ide> * Log errors and unhandled exceptions to `Cake\Log\Log` <ide> */ <del>class ErrorLogger <add>class ErrorLogger implements ErrorLoggerInterface <ide> { <ide> use InstanceConfigTrait; <ide> <ide> public function __construct(array $config = []) <ide> } <ide> <ide> /** <del> * Generate the error log message. <del> * <del> * @param \Throwable $exception The exception to log a message for. <del> * @param \Psr\Http\Message\ServerRequestInterface|null $request The current request if available. <del> * @return bool <add> * @inheritdoc <add> */ <add> public function logMessage(int $level, string $message): bool <add> { <add> return Log::write($level, $message); <add> } <add> <add> /** <add> * @inheritdoc <ide> */ <ide> public function log(Throwable $exception, ?ServerRequestInterface $request = null): bool <ide> { <ide><path>src/Error/ErrorLoggerInterface.php <add><?php <add>declare(strict_types=1); <add> <add>/** <add> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org) <add> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) <add> * <add> * Licensed under The MIT License <add> * For full copyright and license information, please see the LICENSE.txt <add> * Redistributions of files must retain the above copyright notice. <add> * <add> * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) <add> * @link https://cakephp.org CakePHP(tm) Project <add> * @since 4.1.0 <add> * @license https://opensource.org/licenses/mit-license.php MIT License <add> */ <add>namespace Cake\Error; <add> <add>use Psr\Http\Message\ServerRequestInterface; <add>use \Throwable; <add> <add>/** <add> * Interface for error logging handlers. <add> * <add> * Used by the ErrorHandlerMiddleware and global <add> * error handlers to log exceptions and errors. <add> */ <add>interface ErrorLoggerInterface <add>{ <add> /** <add> * Log an error for an exception with optional request context. <add> * <add> * @param \Throwable $exception The exception to log a message for. <add> * @param \Psr\Http\Message\ServerRequestInterface|null $request The current request if available. <add> * @return bool <add> */ <add> public function log( <add> Throwable $exception, <add> ?ServerRequestInterface $request = null <add> ): bool; <add> <add> /** <add> * Log a an error message to the error logger. <add> * <add> * @param int $level The logging level <add> * @param string $message The message to be logged. <add> * @return bool <add> */ <add> public function logMessage(int $level, string $message): bool; <add>} <ide><path>tests/TestCase/Error/ErrorHandlerTest.php <ide> use Cake\Core\Configure; <ide> use Cake\Datasource\Exception\RecordNotFoundException; <ide> use Cake\Error\ErrorHandler; <add>use Cake\Error\ErrorLoggerInterface; <ide> use Cake\Http\Exception\ForbiddenException; <ide> use Cake\Http\Exception\MissingControllerException; <ide> use Cake\Http\Exception\NotFoundException; <ide> public function testHandleErrorDebugOff() <ide> $messages = $this->logger->read(); <ide> $this->assertRegExp('/^(notice|debug)/', $messages[0]); <ide> $this->assertStringContainsString( <del> 'Notice (8): Undefined variable: out in [' . __FILE__ . ', line ' . (__LINE__ - 5) . ']' . "\n\n", <add> 'Notice (8): Undefined variable: out in [' . __FILE__ . ', line ' . (__LINE__ - 5) . ']', <ide> $messages[0] <ide> ); <ide> } <ide> public function testIncreaseMemoryLimit($start, $adjust, $expected) <ide> <ide> ini_set('memory_limit', $initial); <ide> } <add> <add> /** <add> * Test getting a logger <add> * <add> * @return void <add> */ <add> public function testGetLogger() <add> { <add> $errorHandler = new TestErrorHandler(['key' => 'value', 'log' => true]); <add> $logger = $errorHandler->getLogger(); <add> <add> $this->assertInstanceOf(ErrorLoggerInterface::class, $logger); <add> $this->assertEquals('value', $logger->getConfig('key'), 'config should be forwarded.'); <add> $this->assertSame($logger, $errorHandler->getLogger()); <add> } <add> <add> /** <add> * Test getting a logger <add> * <add> * @return void <add> */ <add> public function testGetLoggerInvalid() <add> { <add> $errorHandler = new TestErrorHandler(['errorLogger' => \stdClass::class]); <add> $this->expectException(RuntimeException::class); <add> $this->expectExceptionMessage('Cannot create logger'); <add> $errorHandler->getLogger(); <add> } <ide> }
4
Ruby
Ruby
prefer interpolation to concatenation
424187fc15e3d0dd0cab8795a98f2b16a87c7a31
<ide><path>Library/Homebrew/cmd/doctor.rb <ide> def check_for_bad_python_symlink <ide> end <ide> <ide> def check_for_non_prefixed_coreutils <del> gnubin = Formula.factory('coreutils').prefix.to_s + "/libexec/gnubin" <add> gnubin = "#{Formula.factory('coreutils').prefix}/libexec/gnubin" <ide> if paths.include? gnubin then <<-EOS.undent <ide> Putting non-prefixed coreutils in your path can cause gmp builds to fail. <ide> EOS <ide> def check_for_non_prefixed_findutils <ide> end <ide> <ide> def check_for_pydistutils_cfg_in_home <del> if File.exist? ENV['HOME']+'/.pydistutils.cfg' then <<-EOS.undent <add> if File.exist? "#{ENV['HOME']}/.pydistutils.cfg" then <<-EOS.undent <ide> A .pydistutils.cfg file was found in $HOME, which may cause Python <ide> builds to fail. See: <ide> http://bugs.python.org/issue6138
1